ember-freestyle 0.12.8 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +50 -54
  3. package/addon/components/freestyle/usage/argument/index.hbs +1 -1
  4. package/addon/components/freestyle/usage/argument/index.js +5 -0
  5. package/addon/components/freestyle/usage/bool/{control.hbs → control/index.hbs} +1 -1
  6. package/addon/components/freestyle/usage/bool/control/index.js +9 -0
  7. package/addon/components/freestyle/usage/number/{control.hbs → control/index.hbs} +2 -1
  8. package/addon/components/freestyle/usage/number/{control.js → control/index.js} +5 -0
  9. package/addon/components/freestyle/usage/object/control/index.hbs +5 -0
  10. package/addon/components/freestyle/usage/object/control/index.js +18 -0
  11. package/addon/components/freestyle/usage/string/{control.hbs → control/index.hbs} +4 -2
  12. package/addon/components/freestyle/usage/string/{control.js → control/index.js} +6 -0
  13. package/addon/components/freestyle-collection/index.js +1 -2
  14. package/addon/components/freestyle-dynamic/index.js +1 -2
  15. package/addon/components/freestyle-dynamic-input/index.hbs +34 -6
  16. package/addon/components/freestyle-dynamic-input/index.js +6 -6
  17. package/addon/components/freestyle-palette/index.hbs +3 -3
  18. package/addon/components/freestyle-palette/index.js +1 -0
  19. package/addon/components/freestyle-palette-item/index.js +1 -1
  20. package/addon/components/freestyle-section/index.js +0 -2
  21. package/addon/components/freestyle-showdown-content/index.js +14 -0
  22. package/addon/components/freestyle-source/index.js +1 -2
  23. package/addon/components/freestyle-subsection/index.js +0 -1
  24. package/addon/components/freestyle-typeface/index.js +1 -1
  25. package/addon/components/freestyle-usage/index.js +3 -4
  26. package/addon/components/freestyle-usage-controls/index.hbs +2 -2
  27. package/addon/components/freestyle-variant-list/index.hbs +1 -1
  28. package/addon/services/ember-freestyle.js +2 -2
  29. package/addon/styles/addon.scss +3 -3
  30. package/addon/styles/components/freestyle/usage.scss +14 -14
  31. package/addon/styles/components/freestyle-annotation.scss +1 -1
  32. package/addon/styles/components/freestyle-collection.scss +5 -4
  33. package/addon/styles/components/freestyle-dynamic.scss +2 -1
  34. package/addon/styles/components/freestyle-guide.scss +7 -6
  35. package/addon/styles/components/freestyle-menu.scss +1 -1
  36. package/addon/styles/components/freestyle-palette-item.scss +0 -1
  37. package/addon/styles/components/freestyle-palette.scss +1 -1
  38. package/addon/styles/components/freestyle-section.scss +1 -1
  39. package/addon/styles/components/freestyle-source.scss +2 -2
  40. package/addon/styles/components/freestyle-subsection.scss +2 -2
  41. package/addon/styles/components/freestyle-usage-controls.scss +12 -11
  42. package/addon/styles/components/freestyle-usage.scss +2 -6
  43. package/app/components/freestyle/usage/{bool/index.js → bool.js} +0 -0
  44. package/app/components/freestyle/usage/{number/index.js → number.js} +0 -0
  45. package/app/components/freestyle/usage/{object/index.js → object.js} +0 -0
  46. package/app/components/freestyle/usage/{string/index.js → string.js} +0 -0
  47. package/blueprints/ember-freestyle/files/__root__/app/controllers/freestyle.js +16 -47
  48. package/blueprints/ember-freestyle/files/__root__/app/templates/freestyle.hbs +14 -20
  49. package/blueprints/ember-freestyle/index.js +0 -1
  50. package/lib/ast-transform.js +26 -33
  51. package/package.json +45 -42
  52. package/.all-contributorsrc +0 -335
  53. package/.dependabot/config.yml +0 -8
  54. package/.node-version +0 -1
  55. package/.prettierignore +0 -21
  56. package/.prettierrc.js +0 -5
  57. package/.sass-lint.yml +0 -11
  58. package/Brewfile +0 -5
  59. package/FREESTYLE_USAGE_API.md +0 -116
  60. package/addon/components/freestyle/usage/object/control.hbs +0 -7
  61. package/addon/components/freestyle-note/index.hbs +0 -3
  62. package/addon/components/freestyle-note/index.js +0 -11
  63. package/addon/helpers/equal.js +0 -3
  64. package/addon/helpers/is-present.js +0 -10
  65. package/addon/helpers/pick.js +0 -14
  66. package/app/components/freestyle-note.js +0 -9
  67. package/app/helpers/is-present.js +0 -1
  68. package/app/helpers/pick.js +0 -1
  69. package/app/helpers/variant-eq.js +0 -4
  70. package/config/deploy.js +0 -35
  71. package/doc/freestyle-generated.png +0 -0
  72. package/jsconfig.json +0 -4
  73. package/script/bootstrap +0 -12
  74. package/script/postrelease +0 -7
  75. package/script/prerelease +0 -15
  76. package/script/release +0 -11
package/CHANGELOG.md CHANGED
@@ -2,6 +2,53 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [0.13.0](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.11...v0.13.0) (2021-10-29)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * remove the use of `ember-json-viewer`
11
+ * drop support for Node v10
12
+
13
+ ### Features
14
+
15
+ * deprecate `<FreestyleShowdownContent />` component ([78f2568](https://github.com/chrislopresto/ember-freestyle/commit/78f25681c40d33d56c1789601503f3d5ccca88da))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * fix generated id for `freestyle-dynamic-input` component ([942c901](https://github.com/chrislopresto/ember-freestyle/commit/942c901293827e51f35a976623ccdeb0139181e9))
21
+ * import computed.or directly ([ecb6811](https://github.com/chrislopresto/ember-freestyle/commit/ecb6811368e41c10466bf859e3bb9118f5683bfc))
22
+ * import htmlSafe from @ember/template ([57ea33f](https://github.com/chrislopresto/ember-freestyle/commit/57ea33f6651342488e6cc6209a041dbc15ce977f))
23
+ * make AST plugin functional ([87f521c](https://github.com/chrislopresto/ember-freestyle/commit/87f521ce1371a31f0f1fad9530a973f595819723))
24
+ * resolve deprecations related to built-in component events ([a4d07c6](https://github.com/chrislopresto/ember-freestyle/commit/a4d07c6661299e9ab161a75a35a50ead5e755707))
25
+
26
+
27
+ * drop support for Node v10 ([2add9c7](https://github.com/chrislopresto/ember-freestyle/commit/2add9c7152a5b58b9de45b4e188b836b656d5fb5))
28
+ * remove the use of `ember-json-viewer` ([023f559](https://github.com/chrislopresto/ember-freestyle/commit/023f5591f5531d61188c20d4107447e26172d2b0))
29
+
30
+ ### [0.12.11](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.10...v0.12.11) (2021-03-23)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * Move glimmer/tracker to the deps list since ([3a39dc6](https://github.com/chrislopresto/ember-freestyle/commit/3a39dc6daa2d6a69f6b1e090c19e216edf3fef8d))
36
+ * rendering a color palette ([336af81](https://github.com/chrislopresto/ember-freestyle/commit/336af817a43553a3662ebb0cc4b0d174fcf0b23b))
37
+
38
+ ### [0.12.10](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.9...v0.12.10) (2021-03-17)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * blueprint subsection invocation ([#515](https://github.com/chrislopresto/ember-freestyle/issues/515)) ([ad7f63a](https://github.com/chrislopresto/ember-freestyle/commit/ad7f63abf60f2b7013b91881ea2aa0484835226b))
44
+
45
+ ### [0.12.9](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.8...v0.12.9) (2021-03-12)
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * @ember/render-modifiers must be a normal dependency ([4bacc17](https://github.com/chrislopresto/ember-freestyle/commit/4bacc1755df39f0e75a1741ae7401150030e63b0))
51
+
5
52
  ### [0.12.8](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.7...v0.12.8) (2021-03-03)
6
53
 
7
54
 
package/README.md CHANGED
@@ -2,36 +2,33 @@
2
2
 
3
3
  [![Build Status](https://github.com/chrislopresto/ember-freestyle/workflows/CI/badge.svg?branch=master)](https://github.com/chrislopresto/ember-freestyle/actions)
4
4
 
5
- [![npm version](https://badge.fury.io/js/ember-freestyle.svg)](https://badge.fury.io/js/ember-freestyle)
6
- ![Download count all time](https://img.shields.io/npm/dt/ember-freestyle.svg)
5
+ ![NPM Version](https://img.shields.io/npm/v/ember-freestyle?logo=npm)
6
+ ![Download Count All Time](https://img.shields.io/npm/dt/ember-freestyle.svg)
7
7
  [![Ember Observer Score](http://emberobserver.com/badges/ember-freestyle.svg)](http://emberobserver.com/addons/ember-freestyle)
8
8
  [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
9
9
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
10
- [![All Contributors](https://img.shields.io/badge/all_contributors-34-orange.svg?style=flat-square)](#contributors-)
10
+ [![All Contributors](https://img.shields.io/badge/all_contributors-39-orange.svg?style=flat-square)](#contributors-)
11
11
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
12
12
 
13
- Ember Freestyle is an Ember addon that allows you to quickly create a component explorer for your Ember app.
13
+ Ember Freestyle is an Ember addon that allows you to quickly create a component
14
+ explorer for your Ember app.
14
15
 
15
16
  ## Documentation
16
17
 
17
- This README provides a lightweight overview of Ember Freestyle to get you going. More complete documentation can be found at https://chrislopresto.github.io/ember-freestyle
18
+ This README provides a lightweight overview of Ember Freestyle to get you going.
19
+ More complete documentation can be found at [https://chrislopresto.github.io/ember-freestyle](https://chrislopresto.github.io/ember-freestyle).
18
20
 
19
21
  ## Live Demo
20
22
 
21
- To see Ember Freestyle in action, visit [https://chrislopresto.github.io/ember-freestyle/#/acceptance](https://chrislopresto.github.io/ember-freestyle/#/acceptance)
23
+ To see Ember Freestyle in action, visit [https://chrislopresto.github.io/ember-freestyle/#/acceptance](https://chrislopresto.github.io/ember-freestyle/#/acceptance).
22
24
 
23
- ### Compatibility
25
+ ## Compatibility
24
26
 
25
27
  * Ember.js v3.16 or above
26
- * Ember CLI v2.13 or above
27
- * Node.js v10 or above
28
+ * Ember CLI v3.16 or above
29
+ * Node.js v12 or above
28
30
 
29
- ### Support
30
-
31
- Ember Freestyle support is only provided for the 2 latest Ember versions
32
-
33
- Installation
34
- ------------------------------------------------------------------------------
31
+ ## Installation
35
32
 
36
33
  This installation process is opinionated in order to get you going quickly.
37
34
 
@@ -43,63 +40,51 @@ This installation process is opinionated in order to get you going quickly.
43
40
  - Add a `freestyle` template in your app
44
41
  - Add a `freestyle` controller in your app
45
42
 
46
- *Note:* Ember CLI versions < 0.2.3 should use `ember install:addon` instead of `ember install`
47
-
48
- 1. Add `this.route('freestyle');` to your `router.js` file
49
- 1. Navigate to `/freestyle`. You should now see something like:
43
+ 2. Add `this.route('freestyle');` to your `app/router.js` file
44
+ 3. Navigate to `/freestyle`. You should now see something like:
50
45
 
51
46
  ![](doc/freestyle-generated.png)
52
47
 
53
- All of the generated output is optional. If you don't want a `freestyle` route, for example, feel free to get rid of it in and add a `freestyle-guide` somewhere else in your app.
48
+ All of the generated output is optional. If you don't want a `freestyle` route,
49
+ for example, feel free to get rid of it and add a `freestyle-guide` somewhere
50
+ else in your app.
54
51
 
55
- You can use the `freestyle-guide` component anywhere you'd like in your app. You can organize your components into multiple Freestyle guides if you want to. You can even use the constituent components like `freestyle-usage` on their own.
52
+ You can use the `freestyle-guide` component anywhere you'd like in your app.
53
+ You can organize your components into multiple Freestyle guides if you want to.
54
+ You can even use the constituent components like `freestyle-usage` on their own.
56
55
 
57
56
  ## Problems? No problem.
58
57
 
59
- Hopefully the installation instructions got you off to a smooth, seamless start. If you have any problems, feel free to chat with us in the [Ember Community Discord](https://discordapp.com/invite/zT3asNS) or [open an issue](https://github.com/chrislopresto/ember-freestyle/issues/new). As always, PRs are welcome!
58
+ Hopefully the installation instructions got you off to a smooth, seamless start.
59
+ If you have any problems, feel free to chat with us in the [Ember Community Discord](https://discord.gg/emberjs) or [open an issue](https://github.com/chrislopresto/ember-freestyle/issues/new). As always, PRs are welcome!
60
60
 
61
- ## Removing Ember Freestyle from Your Production Payload
61
+ ## Removing Ember Freestyle from Your Production Build
62
62
 
63
- We recommend blacklisting Ember Freestyle for production builds using Ember CLI's [addon blacklist feature](https://ember-cli.com/user-guide/#whitelisting-and-blacklisting-assets).
63
+ We recommend excluding Ember Freestyle from production builds using Ember CLI's
64
+ `addons.blacklist` option.
64
65
 
65
- ```javascript
66
- var environment = process.env.EMBER_ENV;
67
- var pluginsToBlacklist = environment === 'production' ? ['ember-freestyle'] : [];
66
+ ```js
67
+ const environment = process.env.EMBER_ENV;
68
+ const addonsToExclude = environment === 'production' ? ['ember-freestyle'] : [];
68
69
 
69
- module.exports = function(defaults) {
70
- var app = new EmberApp(defaults, {
70
+ module.exports = function (defaults) {
71
+ const app = new EmberAddon(defaults, {
71
72
  addons: {
72
- blacklist: pluginsToBlacklist
73
- }
73
+ blacklist: addonsToExclude,
74
+ },
74
75
  };
75
- }
76
+ };
76
77
  ```
77
78
 
78
79
  ## Using Ember Freestyle Within an Addon
79
80
 
80
- ### Dependency Configuration
81
-
82
- You should include Ember Freestyle as a devDependency so that apps using your addon will not include
83
- Ember Freestyle CSS and JavaScript in their production payloads.
84
-
85
- ## Running
86
-
87
- * `npm run lint:js`
88
- * `npm run lint:js -- --fix`
89
-
90
- ### Running tests
81
+ You should include `ember-freestyle` in your `devDependencies` so that apps
82
+ using your addon will not include Ember Freestyle CSS and JavaScript in their
83
+ production builds.
91
84
 
92
- * `ember test` – Runs the test suite on the current Ember version
93
- * `ember test --server` – Runs the test suite in "watch mode"
94
- * `ember try:each` – Runs the test suite against multiple Ember versions
95
-
96
- ### Running the dummy application
97
-
98
- * `ember serve`
99
- * Visit the dummy application at [http://localhost:4200](http://localhost:4200).
100
-
101
- For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
85
+ ## Contributing
102
86
 
87
+ See the [Contributing](CONTRIBUTING.md) guide for details.
103
88
 
104
89
  ## Contributors ✨
105
90
 
@@ -152,6 +137,13 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
152
137
  <td align="center"><a href="https://twitter.com/fivetanley"><img src="https://avatars0.githubusercontent.com/u/1275021?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stanley Stuart</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/commits?author=fivetanley" title="Code">💻</a></td>
153
138
  <td align="center"><a href="https://mcmanus.io"><img src="https://avatars2.githubusercontent.com/u/9383?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matt McManus</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/commits?author=mattmcmanus" title="Code">💻</a></td>
154
139
  <td align="center"><a href="http://suzidao.com"><img src="https://avatars0.githubusercontent.com/u/6305709?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Suzi Dao</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/commits?author=suzidao" title="Code">💻</a> <a href="https://github.com/chrislopresto/ember-freestyle/commits?author=suzidao" title="Tests">⚠️</a></td>
140
+ <td align="center"><a href="https://github.com/raytiley"><img src="https://avatars.githubusercontent.com/u/41680?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ray Tiley</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/commits?author=raytiley" title="Code">💻</a></td>
141
+ </tr>
142
+ <tr>
143
+ <td align="center"><a href="https://github.com/lucasmerat"><img src="https://avatars.githubusercontent.com/u/32575355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>lucasmerat</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/commits?author=lucasmerat" title="Code">💻</a></td>
144
+ <td align="center"><a href="https://github.com/skwongr"><img src="https://avatars.githubusercontent.com/u/19978361?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kit</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/commits?author=skwongr" title="Code">💻</a></td>
145
+ <td align="center"><a href="https://lolma.us/"><img src="https://avatars.githubusercontent.com/u/200884?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andrey Mikhaylov (lolmaus)</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/issues?q=author%3Alolmaus" title="Bug reports">🐛</a> <a href="https://github.com/chrislopresto/ember-freestyle/commits?author=lolmaus" title="Code">💻</a></td>
146
+ <td align="center"><a href="https://github.com/bertdeblock"><img src="https://avatars.githubusercontent.com/u/7403183?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bert De Block</b></sub></a><br /><a href="https://github.com/chrislopresto/ember-freestyle/commits?author=bertdeblock" title="Code">💻</a> <a href="#ideas-bertdeblock" title="Ideas, Planning, & Feedback">🤔</a></td>
155
147
  </tr>
156
148
  </table>
157
149
 
@@ -160,4 +152,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
160
152
 
161
153
  <!-- ALL-CONTRIBUTORS-LIST:END -->
162
154
 
163
- This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
155
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!
156
+
157
+ ## License
158
+
159
+ This project is licensed under the [MIT License](LICENSE.md).
@@ -15,7 +15,7 @@
15
15
  {{#if @required}}
16
16
  <span class="FreestyleUsageArgument-required">Required</span>
17
17
  {{/if}}
18
- {{#if (is-present @defaultValue)}}
18
+ {{#if this.shouldRenderDefaultValue}}
19
19
  <span class="FreestyleUsageArgument-default u-codePill">
20
20
  {{@defaultValue}}
21
21
  </span>
@@ -1,6 +1,11 @@
1
+ import { isPresent } from '@ember/utils';
1
2
  import Component from '@glimmer/component';
2
3
 
3
4
  export default class FreestyleUsageArgumentComponent extends Component {
5
+ get shouldRenderDefaultValue() {
6
+ return isPresent(this.args.defaultValue);
7
+ }
8
+
4
9
  get typeLabel() {
5
10
  return this.args.typeLabel || this.args.type;
6
11
  }
@@ -4,6 +4,6 @@
4
4
  <input
5
5
  type="checkbox"
6
6
  checked={{@value}}
7
- {{on 'input' (pick 'target.checked' @onInput)}}
7
+ {{on 'input' this.callOnInput}}
8
8
  />
9
9
  </label>
@@ -0,0 +1,9 @@
1
+ import { action } from '@ember/object';
2
+ import Component from '@glimmer/component';
3
+
4
+ export default class FreestyleUsageBoolControlComponent extends Component {
5
+ @action
6
+ callOnInput(event) {
7
+ this.args.onInput(event.target.checked);
8
+ }
9
+ }
@@ -1,5 +1,6 @@
1
+ {{! template-lint-disable require-input-label }}
1
2
 
2
- {{#if (is-present @min @max)}}
3
+ {{#if this.shouldRenderRangeInput}}
3
4
  <input
4
5
  type="range"
5
6
  value={{@value}}
@@ -1,7 +1,12 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
+ import { isPresent } from '@ember/utils';
3
4
 
4
5
  export default class FreestyleUsageNumberComponent extends Component {
6
+ get shouldRenderRangeInput() {
7
+ return isPresent(this.args.min) && isPresent(this.args.max);
8
+ }
9
+
5
10
  @action onInput(event) {
6
11
  let { value } = event.target;
7
12
  this.args.onInput(value ? parseFloat(value) : null);
@@ -0,0 +1,5 @@
1
+ {{#if @value}}
2
+ <div class="FreestyleUsageArgument-jsonViewer">
3
+ {{this.jsonTree}}
4
+ </div>
5
+ {{/if}}
@@ -0,0 +1,18 @@
1
+ import Component from '@glimmer/component';
2
+ import JsonFormatter from 'json-formatter-js';
3
+
4
+ const OPTIONS = {
5
+ animateClose: false,
6
+ animateOpen: false,
7
+ theme: 'dark',
8
+ };
9
+
10
+ export default class FreestyleUsageObjectControlComponent extends Component {
11
+ get jsonTree() {
12
+ const json = this.args.value;
13
+ const openDepth = this.args.jsonCollapseDepth;
14
+ const jsonFormatter = new JsonFormatter(json, openDepth, OPTIONS);
15
+
16
+ return jsonFormatter.render();
17
+ }
18
+ }
@@ -1,5 +1,7 @@
1
+ {{! template-lint-disable require-input-label }}
2
+
1
3
  {{#if @options}}
2
- <select {{on 'change' (pick 'target.value' @onInput)}}>
4
+ <select {{on 'change' this.callOnInput}}>
3
5
  {{#each @options as |optionValue|}}
4
6
  <option value={{optionValue}} selected={{eq optionValue @value}}>{{optionValue}}</option>
5
7
  {{/each}}
@@ -8,6 +10,6 @@
8
10
  <input
9
11
  type="text"
10
12
  value={{@value}}
11
- {{on this.inputEvent (pick 'target.value' @onInput)}}
13
+ {{on this.inputEvent this.callOnInput}}
12
14
  />
13
15
  {{/if}}
@@ -1,7 +1,13 @@
1
+ import { action } from '@ember/object';
1
2
  import Component from '@glimmer/component';
2
3
 
3
4
  export default class FreestyleUsageStringControlComponent extends Component {
4
5
  get inputEvent() {
5
6
  return this.args.inputEvent || 'input';
6
7
  }
8
+
9
+ @action
10
+ callOnInput(event) {
11
+ this.args.onInput(event.target.value);
12
+ }
7
13
  }
@@ -3,8 +3,7 @@ import { and, not } from '@ember/object/computed';
3
3
  import { A } from '@ember/array';
4
4
  import { next } from '@ember/runloop';
5
5
  import Component from '@ember/component';
6
- import { computed } from '@ember/object';
7
- import { action } from '@ember/object';
6
+ import { action, computed } from '@ember/object';
8
7
 
9
8
  export default Component.extend({
10
9
  tagName: '',
@@ -1,8 +1,7 @@
1
1
  import { assign } from '@ember/polyfills';
2
2
  import Component from '@ember/component';
3
- import { set, get, computed } from '@ember/object';
3
+ import { action, set, get, computed } from '@ember/object';
4
4
  import { assert } from '@ember/debug';
5
- import { action } from '@ember/object';
6
5
 
7
6
  export default Component.extend({
8
7
  tagName: '',
@@ -3,22 +3,50 @@
3
3
  {{@propertyName}}:
4
4
  </label>
5
5
  {{#if this.isCheckbox}}
6
- <Input @type="checkbox" @checked={{readonly @value}} @id={{this.inputId}} @change={{this.toggleCheckbox}} />
6
+ <input
7
+ checked={{@value}}
8
+ id={{this.inputId}}
9
+ type="checkbox"
10
+ {{on "input" this.toggleCheckbox}}
11
+ >
7
12
  {{else if this.isTextarea}}
8
- <Textarea @value={{@value}} @id={{this.inputId}} @rows={{5}} @cols={{40}} @key-up={{this.sendChangedText}} />
13
+ <textarea
14
+ cols="40"
15
+ id={{this.inputId}}
16
+ rows="5"
17
+ value={{@value}}
18
+ {{on "input" this.sendChangedText}}
19
+ />
9
20
  {{else if this.isSelect}}
10
- <select {{on 'change' this.onChange}}>
21
+ <select id={{this.inputId}} {{on "change" this.onChange}}>
11
22
  {{#each @options as |option|}}
12
23
  <FreestyleDynamicInputSelectOption @selectedValue={{@value}} @optionValue={{option}} />
13
24
  {{/each}}
14
25
  </select>
15
26
  {{else if this.isNumber}}
16
- <Input @type="number" @value={{@value}} @id={{this.inputId}} @input={{this.onChangeWithNumericCoercion}} />
27
+ <input
28
+ id={{this.inputId}}
29
+ type="number"
30
+ value={{@value}}
31
+ {{on "input" this.onChangeWithNumericCoercion}}
32
+ >
17
33
  {{else if this.isRange}}
18
- <Input @type="range" @id={{this.inputId}} @min={{@min}} @max={{@max}} @input={{this.onChangeWithNumericCoercion}} @value={{readonly @value}} />
34
+ <input
35
+ id={{this.inputId}}
36
+ max={{@max}}
37
+ min={{@min}}
38
+ type="range"
39
+ value={{@value}}
40
+ {{on "input" this.onChangeWithNumericCoercion}}
41
+ >
19
42
  {{@value}}
20
43
  {{else}}
21
- <Input @value={{@value}} @id={{this.inputId}} @key-up={{this.onChange}} />
44
+ <input
45
+ id={{this.inputId}}
46
+ type="text"
47
+ value={{@value}}
48
+ {{on "input" this.onChange}}
49
+ >
22
50
  {{/if}}
23
51
  {{#if @description}}
24
52
  <small class="FreestyleDynamic-inputDescription">
@@ -1,7 +1,7 @@
1
1
  import Component from '@ember/component';
2
- import { computed } from '@ember/object';
2
+ import { action, computed } from '@ember/object';
3
3
  import { equal } from '@ember/object/computed';
4
- import { action } from '@ember/object';
4
+ import { guidFor } from '@ember/object/internals';
5
5
 
6
6
  export default Component.extend({
7
7
  tagName: '',
@@ -12,8 +12,8 @@ export default Component.extend({
12
12
  isNumber: equal('inputType', 'number'),
13
13
  isRange: equal('inputType', 'range'),
14
14
 
15
- inputId: computed('elementId', 'propertyName', function () {
16
- return `${this.elementId}_${this.propertyName}`;
15
+ inputId: computed('propertyName', function () {
16
+ return `${guidFor(this)}_${this.propertyName}`;
17
17
  }),
18
18
 
19
19
  @action
@@ -27,8 +27,8 @@ export default Component.extend({
27
27
  this.changeValueTo(ev.target.value);
28
28
  },
29
29
  @action
30
- sendChangedText(text) {
31
- this.changeValueTo(text);
30
+ sendChangedText(ev) {
31
+ this.changeValueTo(ev.target.value);
32
32
  },
33
33
  @action
34
34
  onChangeWithNumericCoercion(ev) {
@@ -1,7 +1,7 @@
1
1
  <div class='FreestylePalette'>
2
- <div class='FreestylePalette-title'>{{@title}}</div>
3
- <div class='FreestylePalette-description'>{{@description}}</div>
4
- {{#each @colors as |color|}}
2
+ <div class='FreestylePalette-title'>{{this.title}}</div>
3
+ <div class='FreestylePalette-description'>{{this.description}}</div>
4
+ {{#each this.colors as |color|}}
5
5
  <FreestylePaletteItem @color={{color}} />
6
6
  {{/each}}
7
7
  {{yield}}
@@ -5,6 +5,7 @@ import { computed } from '@ember/object';
5
5
  export default Component.extend({
6
6
  tagName: '',
7
7
  title: 'Freestyle Palette',
8
+ description: 'Represents all colors used in this project.',
8
9
 
9
10
  colors: computed('colorPalette', function () {
10
11
  return A(
@@ -1,5 +1,5 @@
1
1
  import Component from '@ember/component';
2
- import { htmlSafe } from '@ember/string';
2
+ import { htmlSafe } from '@ember/template';
3
3
  import { computed } from '@ember/object';
4
4
 
5
5
  export default Component.extend({
@@ -1,5 +1,3 @@
1
- /* eslint-disable ember/no-component-lifecycle-hooks */
2
-
3
1
  import { inject as service } from '@ember/service';
4
2
  import Component from '@glimmer/component';
5
3
 
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable ember/no-component-lifecycle-hooks */
2
2
  /* eslint-disable ember/require-tagless-components */
3
+ import { deprecate } from '@ember/debug';
3
4
  import { inject as service } from '@ember/service';
4
5
  import Component from '@ember/component';
5
6
 
@@ -8,7 +9,20 @@ export default Component.extend({
8
9
 
9
10
  didInsertElement() {
10
11
  this._super(...arguments);
12
+
13
+ deprecate(
14
+ 'The `<FreestyleShowdownContent />` component is deprecated. Please use `ember-cli-showdown` directly if you need Markdown support.',
15
+ false,
16
+ {
17
+ for: 'ember-freestyle',
18
+ id: 'freestyle-showdown-content-component',
19
+ since: '0.13.0',
20
+ until: '0.14.0',
21
+ }
22
+ );
23
+
11
24
  let pre = this.element.getElementsByTagName('pre');
25
+
12
26
  if (pre[0]) {
13
27
  this.emberFreestyle.highlight(pre[0]);
14
28
  }
@@ -1,9 +1,8 @@
1
1
  /* eslint-disable ember/no-component-lifecycle-hooks */
2
2
  /* eslint-disable ember/require-tagless-components */
3
- import { set } from '@ember/object';
4
3
  import { inject as service } from '@ember/service';
5
4
  import Component from '@ember/component';
6
- import { computed, get } from '@ember/object';
5
+ import { computed, get, set } from '@ember/object';
7
6
 
8
7
  export default Component.extend({
9
8
  initialHighlightComplete: false,
@@ -1,4 +1,3 @@
1
- /* eslint-disable ember/no-component-lifecycle-hooks */
2
1
  import { inject as service } from '@ember/service';
3
2
  import Component from '@glimmer/component';
4
3
 
@@ -1,5 +1,5 @@
1
1
  import Component from '@ember/component';
2
- import { htmlSafe } from '@ember/string';
2
+ import { htmlSafe } from '@ember/template';
3
3
  import { computed } from '@ember/object';
4
4
 
5
5
  export default Component.extend({
@@ -1,9 +1,8 @@
1
1
  /* eslint-disable ember/no-component-lifecycle-hooks */
2
2
  import { inject as service } from '@ember/service';
3
- import { and, readOnly } from '@ember/object/computed';
3
+ import { and, or, readOnly } from '@ember/object/computed';
4
4
  import Component from '@ember/component';
5
- import { computed } from '@ember/object';
6
- import { action } from '@ember/object';
5
+ import { action, computed } from '@ember/object';
7
6
 
8
7
  let FreestyleUsage = Component.extend({
9
8
  tagName: '',
@@ -22,7 +21,7 @@ let FreestyleUsage = Component.extend({
22
21
  }),
23
22
  defaultTheme: readOnly('emberFreestyle.defaultTheme'),
24
23
  // highlightJsTheme - passed in
25
- computedTheme: computed.or('defaultTheme', 'highlightJsTheme'),
24
+ computedTheme: or('defaultTheme', 'highlightJsTheme'),
26
25
 
27
26
  hasLabels: and('showLabels', 'title'),
28
27
  hasCode: computed('showCode', 'slug', 'source', function () {
@@ -39,8 +39,8 @@
39
39
  {{#if this.showFocus}}
40
40
  <div class="FreestyleUsageControls-item FreestyleUsageControls-item--focus">
41
41
  <div class="FreestyleUsageControls-itemControl">
42
- <label for="focus" class="FreestyleUsageControls-label--focus">Focus a section
43
- <Input class="FreestyleUsageControls-input--focus" @value={{this.focus}} @name="focus" @enter={{this.setFocus}} />
42
+ <label class="FreestyleUsageControls-label--focus">Focus a section
43
+ <Input class="FreestyleUsageControls-input--focus" @value={{this.focus}} @enter={{this.setFocus}} />
44
44
  </label>
45
45
  <button class="FreestyleUsageControls-button" onclick={{this.setFocus}} type="button">Focus</button>
46
46
  </div>
@@ -1,7 +1,7 @@
1
1
  <ul class='FreestyleCollection-variantList'>
2
2
  {{#each @variants as |variantKey|}}
3
3
  <li
4
- class='FreestyleCollection-variantListItem {{if (variant-eq @activeKey variantKey) 'FreestyleCollection-variantListItem--active'}}'
4
+ class='FreestyleCollection-variantListItem {{if (eq @activeKey variantKey) 'FreestyleCollection-variantListItem--active'}}'
5
5
  role="button"
6
6
  onclick={{fn this.onClickItem variantKey}}
7
7
  >
@@ -1,11 +1,11 @@
1
1
  /* global hljs */
2
2
  import Service from '@ember/service';
3
- import { isPresent } from '@ember/utils';
3
+ import { isBlank, isPresent } from '@ember/utils';
4
4
  import { A } from '@ember/array';
5
5
  import { Promise } from 'rsvp';
6
6
  import { tracked } from '@glimmer/tracking';
7
- import { isBlank } from '@ember/utils';
8
7
  import { action } from '@ember/object';
8
+
9
9
  export default class EmberFreestyleService extends Service {
10
10
  @tracked showLabels = true;
11
11
  @tracked showNotes = true;
@@ -1,13 +1,13 @@
1
1
  // TODO: Replace with actual breakpoint system
2
2
  $FreestyleBreakpoints: (
3
- large: 600px
3
+ large: 600px,
4
4
  );
5
5
 
6
6
  @mixin freestyle-breakpoint($name: 'large') {
7
7
  @media (min-width: map-get($FreestyleBreakpoints, $name)) {
8
- @content
8
+ @content;
9
9
  }
10
- };
10
+ }
11
11
 
12
12
  // Default Ember Freestyle Palette
13
13
  $FreestyleGuide-color--primary: #00bcd4 !default;