-
Notifications
You must be signed in to change notification settings - Fork 82
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
Proposed New API #340
Comments
Alternate idea for achieving goals of Freestyle::DynamicItem, via @mattmcmanus. Basically, Freestyle::Item would have the ability to include a control panel so you wouldn't need a dedicated component: <Freestyle::Item as |Item|>
<Item.ControlPanel as |Controls|>
<Controls.Number @value=10 />
</Item.ControlPanel>
<Item.Note>
<Remarkable>I am some documentation about red buttons</Remarkable>
</Item.Note>
<Item.Example as |values|>
<App::Button @size={{values.size}} />
</Item.Example>
<Item.ExampleSource />
</Freestyle::Item> |
What @lukemelia mentioned above is a good summary. I have some spikes on this usage pattern that I've been experimenting with in one of our addons. I'm happy to share what I have if that would be helpful. |
Here's another riff using <Freestyle::Usage as |Usage|>
<Usage.ControlPanel as |Controls|>
<Controls.String @name="label" @value="A Label" />
<Controls.String @name="value" @value="The Value" />
<Controls.Array @name="errors" /> # Comma separated list of strings
<Controls.Array @name="warnings" />
<Controls.Bool @name="disabled" @value={{false}} />
<Controls.Bool @name="autofocus" @value={{false}} />
<Controls.Action @name="onInput" /> # Automatically logs to console, could use a flash message
<Controls.Action @name="onFocusOut" />
</Usage.ControlPanel>
<Usage.Note>DOCUMENTATION</Usage.Note>
<Usage.Example as |values|>
<YInput
@label={{values.label}}
@value={{values.value}}
@errors={{values.errors}}
@warnings={{values.warnings}}
@disabled={{values.disabled}}
@autofocus={{values.autofocus}}
@onInput={{values.onInput}}
@onFocusOut={{values.onFocusOut}}
/>
</Usage.Example>
<Usage.Source />
</ComponentUsage> |
One detail not specifically called out above... this API would see Freestyle get out of the markdown business -- if you want markdown in your notes, you would be responsible for including your own markdown addon and using it in your notes. Update: this particular change has been completed by #357 |
Now that a polyfill is available for the Yieldable Named Blocks feature, I thought it would be worth considering how the proposed API would look using that approach: <Freestyle::Item>
<:control-panel as |Controls|>
<Controls.Number @value=10 />
</:control-panel>
<:example as |values|>
<App::Button @size={{values.size}} />
</:example>
<:note>
<Remarkable>I am some documentation about red buttons</Remarkable>
</:note>
</Freestyle::Item> The biggest advantage I see is that the |
FYI: Exploration is continuing in the lc/better-api branch: https://github.com/chrislopresto/ember-freestyle/blob/lc/better-api/doc/API-DESIGN.md #380 |
Update, the latest releases include |
We have some new ideas for the public API for Freestyle that we think will make conceptual and ergonomic improvements for developers. Here's the idea:
Example of new API usage
The old component names would deprecated. Here is a list:
<FreestyleUsage>
- deprecated, move to Freestyle::Item<FreestyleDynamic>
- deprecated, move to Freestyle::DynamicItem<FreestyleNote>
- deprecated, move to Freestyle::Item'd yielded Note<FreestyleNotes>
- deprecated, was for internal use - open an issue<FreestyleAnnotation>
- deprecated, move to Freestyle::Item'd yielded Note<FreestyleCollection>
- deprecated, move to Freestyle::ItemCollection<FreestyleVariant>
- deprecated, move to Item yielded by ItemCollection<FreestyleGuide>
- deprecated, name change only to Freestyle::Guide<FreestyleMenu>
- deprecated, was for internal use - open an issue<FreestyleUsageControls>
- deprecated, was for internal use - open an issue<FreestylePalette>
- deprecated, name change only to Freestyle::ColorPalette<FreestyleTypeface>
- deprecated, name change only to Freestyle::Typeface<FreestyleSection>
- deprecated, move to Section yielded from Freestyle::Guide<FreestyleSubsection>
- deprecated, was used by yielded Section, still is, internal name change to Freestyle::Subsection<FreestyleSnippet>
- deprecated, was for internal use - open an issueThe text was updated successfully, but these errors were encountered: