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

Implement dummy app #2

Merged
merged 8 commits into from
Jun 21, 2017
Merged

Implement dummy app #2

merged 8 commits into from
Jun 21, 2017

Conversation

dfreeman
Copy link
Member

This PR implements a dummy application containing some sample component implementations and a live-edit UI for playing with them, available at https://salsify.github.io/ember-exclaim

I haven't implemented the shorthand we talked about; my plan is to go ahead and get the current system in front of folks for feedback, mentioning that notation as a possibility, and see what the masses thing.

@deverstalmage

Copy link
Contributor

@deverstalmage deverstalmage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few copy edits and questions, otherwise looks good to me

README.md Outdated
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
And something like this would render an input that would update the underlying value of `target` as the user made changes:

```json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be js?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch — I played with both and didn't love how Github highlighted either. Will fix

README.md Outdated
}
```

This would invoke whatever Ember component is configured under the `text` key of the given `componentMap`, passing it a hash of configuration that looks like `{ content: 'hello' }`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalize h in 'hello'

README.md Outdated

You may have noted that the examples in this section appear more verbose than those at the top of the document. By supplying the name of a _shorthand property_, components can be invoked using their name prefixed with a `$` as a key for that property, skipping the `$component` key completely.

For example, the `input` component in [the demo application](https://salsify.github.io/ember-exclaim) declares its shorthand property to be `content`, making this:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean text?


At runtime, exclaim UIs are evaluated relative to an **`Environment`**, which is analogous to scope in a programming language. An `Environment` contains all the bound values that are available to `Binding`s, and may itself contain `Binding` instances that point at other data within itself. When the time comes to resolve the `config` for a component to actual values, `ComponentSpec` instances expose a `resolveConfig(environment)` method, which returns a `Value` instance for the configuration.

A **`Value`** is a proxy for some arbitrary hash or array that resolves any `Binding`s it contains relative to some `Environment`. You can think of `Value`s as chunks of data that remember where they came from. For instance, given a `Value` instance `val` wrapping the data `{ hi: 'hello', bye: new Binding('farewell') }`, calling `val.get('hi')` would return the string `'hello'`, and calling `val.get('bye')` would return whatever the associated `Environment` contains for the key `farewell`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is a bit late, but having a Value wrapping a hash makes me think Value should be plural or use a name that describes that fact that it can contain multiple values/bindings. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@deverstalmage I think I originally named that class when I was thinking of it in terms of what an Environment gives you when you get a prop — "I call get('foo') on the environment and it gives me the value for that key". In context now (and given that primitives don't get wrapped), I totally see how that ends up being a confusing name.

Maybe something like Value => EnvironmentData and ValueArray => EnvironmentArray? (Or possibly abbreviated to like EnvData?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like EnvironmentData and EnvironmentArray (brevity be damned)

@@ -0,0 +1,3 @@
{{#each config.children as |child|}}
{{yield child}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this and vbox want the ~~s that box has?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we know that vbox and hbox have display: flex, we're guaranteed that whitespace doesn't matter. For box (which may or may not need a better name), the whole point is that it basically follows standard browsery flow, so we have to be more careful about it not having the framework accidentally inject whitespace.

* Initial implementation

* Break up environment

* PR feedback

* Shorthand

* Remove bindKey and componentKey config
@dfreeman dfreeman merged commit 1840212 into initial-implementation Jun 21, 2017
@dfreeman dfreeman deleted the dummy-app branch June 21, 2017 20:38
dfreeman added a commit that referenced this pull request Jun 21, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants