Open
Description
When developing a component, it is useful to add dummy data for models and things that are not part of the application but would be useful to have when previewing.
Suggestions:
component Foo {
// Load all 'in' properties from a json file (relative to this file)
// (only for preview)
@dummy-data("./file.json")
// the 'dummy' built-in function is like an identity function in preview mode,
// but is deleted and the default value is used in production.
in property [{name: string, age: int}] model: dummy([{name: "John", age: 85}, {name: "Jane", age: 16}]);
}
The preview could offer an UI to edit these.
The slint-viewer can also load these or have an argument to remove them. (it can already load json with --load-data
but that'd be orthogonal)
Exact naming of these macros/functions can be discussed.