custom-elements-manifest icon indicating copy to clipboard operation
custom-elements-manifest copied to clipboard

Add a Option, to mark the "default" Binding Property or Attribute (low prio)

Open jogibear9988 opened this issue 2 years ago • 5 comments

I use the CustomElement Manifest in a designer app. In this designer app you can Drag&Drop Properties from your DataModel to an Element. It will then create automaticly a default Binding. For example if you drag on a "input" it will automaticly bind to "value" property. it would be nice if we could create a "hint" wich you could add to the spec to allow define a default.

jogibear9988 avatar Dec 29 '21 09:12 jogibear9988

While my usage of the manifest currently gives defaults where available: https://unpkg.com/browse/@spectrum-web-components/[email protected]/custom-elements.json#L385 I can see how "hints" would be quite different and useful in the right context. Before thinking about what that might look like within the manifest context, how might you expect a developer to provide those to a consumer through code today?

Westbrook avatar Dec 30 '21 17:12 Westbrook

I don't want the default value. I want to know wich is the default property. Maybe we could add a additional decorator, so the customer could add that to typescript code...

See here: image

I've created a UI for "iobroker" with my designer. Now the Customer add's a custom Slider to the UI. When he now selects a Signal from the "objects" view on the left side, and drop's it to the control, I need to know for wich property I should create a Binding. The customer can modify this later, but I'd like to have a usefull default.

jogibear9988 avatar Dec 30 '21 18:12 jogibear9988

https://watch.screencastify.com/v/5Ba0w3D1wEY3S0EcgBz4

jogibear9988 avatar Dec 30 '21 18:12 jogibear9988

I think I understand the request here even less in that case. Could you share some examples of components you've seen in the wild and what you think the "default property" for those elements might be? It would seem that you're making some inference here that could be built into an editor (e.g. this value is a string and I have only one (or a constrained number of) string property), but I'm currently having trouble seeing the value of this in the schema to the element itself and/or other consumption contexts.

Westbrook avatar Dec 30 '21 18:12 Westbrook

for example in your spectrum components sp-checkbox => default should be checked property sp-color-area => color property sp-meter => progress property sp-switch => value property ...

other examples: iron-list => items or selectedItem

maybe we could also have multiple defaults (per property type one). So if I bind a iron-list to a array, as standard the "items" is used, if I bind to an object "selectedItem" is use.

This as a whole should only be an hint.

If you'd like to bind a "range" silder to a "sp-meter" I'd like that the designer automaticaly suggest the user to bind "value" of range to "progress" of meter.

jogibear9988 avatar Dec 30 '21 20:12 jogibear9988