Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jogibear9988 opened this issue Dec 29, 2021 · 5 comments

Comments

@jogibear9988
Copy link
Contributor

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.

@Westbrook
Copy link

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?

@jogibear9988
Copy link
Contributor Author

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
Copy link
Contributor Author

@Westbrook
Copy link

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.

@jogibear9988
Copy link
Contributor Author

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 jogibear9988 changed the title Add a Option, to mark the "default" Binding Property or Attribute Add a Option, to mark the "default" Binding Property or Attribute (low prio) Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants