ember-freestyle 0.12.11 → 0.14.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 (73) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +69 -49
  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/array/index.hbs +1 -0
  6. package/addon/components/freestyle/usage/bool/{control.hbs → control/index.hbs} +1 -1
  7. package/addon/components/freestyle/usage/bool/control/index.js +9 -0
  8. package/addon/components/freestyle/usage/bool/index.hbs +1 -0
  9. package/addon/components/freestyle/usage/number/{control.hbs → control/index.hbs} +2 -1
  10. package/addon/components/freestyle/usage/number/{control.js → control/index.js} +5 -0
  11. package/addon/components/freestyle/usage/number/index.hbs +1 -0
  12. package/addon/components/freestyle/usage/object/control/index.hbs +5 -0
  13. package/addon/components/freestyle/usage/object/control/index.js +18 -0
  14. package/addon/components/freestyle/usage/object/index.hbs +1 -0
  15. package/addon/components/freestyle/usage/string/{control.hbs → control/index.hbs} +4 -2
  16. package/addon/components/freestyle/usage/string/{control.js → control/index.js} +6 -0
  17. package/addon/components/freestyle/usage/string/index.hbs +1 -0
  18. package/addon/components/freestyle-collection/index.js +1 -2
  19. package/addon/components/freestyle-dynamic/index.js +1 -2
  20. package/addon/components/freestyle-dynamic-input/index.hbs +34 -6
  21. package/addon/components/freestyle-dynamic-input/index.js +6 -6
  22. package/addon/components/freestyle-focus-button/index.hbs +1 -0
  23. package/addon/components/freestyle-guide/index.hbs +2 -2
  24. package/addon/components/freestyle-palette-item/index.js +1 -1
  25. package/addon/components/freestyle-section/index.js +0 -2
  26. package/addon/components/freestyle-source/index.js +1 -2
  27. package/addon/components/freestyle-subsection/index.js +0 -1
  28. package/addon/components/freestyle-typeface/index.hbs +1 -0
  29. package/addon/components/freestyle-typeface/index.js +1 -1
  30. package/addon/components/freestyle-usage/index.js +3 -4
  31. package/addon/components/freestyle-usage-controls/index.hbs +2 -2
  32. package/addon/services/ember-freestyle.js +2 -2
  33. package/app/components/freestyle/usage/{bool/index.js → bool.js} +0 -0
  34. package/app/components/freestyle/usage/{number/index.js → number.js} +0 -0
  35. package/app/components/freestyle/usage/{object/index.js → object.js} +0 -0
  36. package/app/components/freestyle/usage/{string/index.js → string.js} +0 -0
  37. package/{addon → app}/styles/components/freestyle/usage.scss +14 -14
  38. package/{addon → app}/styles/components/freestyle-annotation.scss +1 -1
  39. package/{addon → app}/styles/components/freestyle-collection.scss +5 -4
  40. package/{addon → app}/styles/components/freestyle-dynamic.scss +2 -1
  41. package/{addon → app}/styles/components/freestyle-guide.scss +7 -6
  42. package/{addon → app}/styles/components/freestyle-menu.scss +1 -1
  43. package/{addon → app}/styles/components/freestyle-palette-item.scss +0 -1
  44. package/{addon → app}/styles/components/freestyle-palette.scss +1 -1
  45. package/{addon → app}/styles/components/freestyle-section.scss +1 -1
  46. package/{addon → app}/styles/components/freestyle-source.scss +2 -2
  47. package/{addon → app}/styles/components/freestyle-subsection.scss +2 -2
  48. package/{addon → app}/styles/components/freestyle-typeface.scss +0 -0
  49. package/{addon → app}/styles/components/freestyle-usage-controls.scss +12 -11
  50. package/{addon → app}/styles/components/freestyle-usage.scss +2 -6
  51. package/{addon → app}/styles/components/freestyle-variant.scss +0 -0
  52. package/app/styles/ember-freestyle/breakpoints.scss +10 -0
  53. package/app/styles/ember-freestyle/colors.scss +6 -0
  54. package/app/styles/ember-freestyle.scss +18 -0
  55. package/blueprints/ember-freestyle/files/__root__/app/controllers/freestyle.js +16 -47
  56. package/blueprints/ember-freestyle/files/__root__/app/templates/freestyle.hbs +12 -18
  57. package/blueprints/ember-freestyle/index.js +0 -1
  58. package/index.js +15 -1
  59. package/lib/ast-transform.js +26 -33
  60. package/package.json +50 -45
  61. package/vendor/ember-freestyle.css +523 -0
  62. package/addon/components/freestyle/usage/object/control.hbs +0 -7
  63. package/addon/components/freestyle-note/index.hbs +0 -3
  64. package/addon/components/freestyle-note/index.js +0 -11
  65. package/addon/components/freestyle-showdown-content/index.hbs +0 -1
  66. package/addon/components/freestyle-showdown-content/index.js +0 -16
  67. package/addon/helpers/is-present.js +0 -10
  68. package/addon/helpers/pick.js +0 -14
  69. package/addon/styles/addon.scss +0 -33
  70. package/app/components/freestyle-note.js +0 -9
  71. package/app/components/freestyle-showdown-content.js +0 -1
  72. package/app/helpers/is-present.js +0 -1
  73. package/app/helpers/pick.js +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,59 @@
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.14.0](https://github.com/chrislopresto/ember-freestyle/compare/v0.13.2...v0.14.0) (2022-03-11)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * remove `freestyle-showdown-content` component
11
+ * update `ember-modifier` to v3
12
+ * update to Ember v4.2
13
+
14
+ * remove `freestyle-showdown-content` component ([5956a9e](https://github.com/chrislopresto/ember-freestyle/commit/5956a9ea183ddb7274a83478c7dbdcaab86a93d8))
15
+ * update `ember-modifier` to v3 ([700eb07](https://github.com/chrislopresto/ember-freestyle/commit/700eb071847449f9843f7dc767b26cf843aa492d))
16
+ * update to Ember v4.2 ([f6646a2](https://github.com/chrislopresto/ember-freestyle/commit/f6646a223880ce7882d1412aa38bc109b2f4f649))
17
+
18
+ ### [0.13.2](https://github.com/chrislopresto/ember-freestyle/compare/v0.13.1...v0.13.2) (2021-11-21)
19
+
20
+ ### [0.13.1](https://github.com/chrislopresto/ember-freestyle/compare/v0.13.0...v0.13.1) (2021-11-21)
21
+
22
+ This release didn't make it to npm. 0.13.2 has the same stuff.
23
+
24
+ ### Features
25
+
26
+ * remove dependency on `ember-cli-sass` and `sass` ([5482db1](https://github.com/chrislopresto/ember-freestyle/commit/5482db1b11332526e6916f2147e59216120b5fd2))
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * pass down [@hide](https://github.com/hide)Controls argument ([c8eac40](https://github.com/chrislopresto/ember-freestyle/commit/c8eac406cc1e59b99f659b68fed7af5b4722d5d4))
32
+
33
+ ## [0.13.0](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.11...v0.13.0) (2021-10-29)
34
+
35
+
36
+ ### ⚠ BREAKING CHANGES
37
+
38
+ * remove the use of `ember-json-viewer`
39
+ * drop support for Node v10
40
+
41
+ ### Features
42
+
43
+ * deprecate `<FreestyleShowdownContent />` component ([78f2568](https://github.com/chrislopresto/ember-freestyle/commit/78f25681c40d33d56c1789601503f3d5ccca88da))
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * fix generated id for `freestyle-dynamic-input` component ([942c901](https://github.com/chrislopresto/ember-freestyle/commit/942c901293827e51f35a976623ccdeb0139181e9))
49
+ * import computed.or directly ([ecb6811](https://github.com/chrislopresto/ember-freestyle/commit/ecb6811368e41c10466bf859e3bb9118f5683bfc))
50
+ * import htmlSafe from @ember/template ([57ea33f](https://github.com/chrislopresto/ember-freestyle/commit/57ea33f6651342488e6cc6209a041dbc15ce977f))
51
+ * make AST plugin functional ([87f521c](https://github.com/chrislopresto/ember-freestyle/commit/87f521ce1371a31f0f1fad9530a973f595819723))
52
+ * resolve deprecations related to built-in component events ([a4d07c6](https://github.com/chrislopresto/ember-freestyle/commit/a4d07c6661299e9ab161a75a35a50ead5e755707))
53
+
54
+
55
+ * drop support for Node v10 ([2add9c7](https://github.com/chrislopresto/ember-freestyle/commit/2add9c7152a5b58b9de45b4e188b836b656d5fb5))
56
+ * remove the use of `ember-json-viewer` ([023f559](https://github.com/chrislopresto/ember-freestyle/commit/023f5591f5531d61188c20d4107447e26172d2b0))
57
+
5
58
  ### [0.12.11](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.10...v0.12.11) (2021-03-23)
6
59
 
7
60
 
package/README.md CHANGED
@@ -2,36 +2,34 @@
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://img.shields.io/npm/v/ember-freestyle?logo=npm)
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-38-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
30
+ * Ember Auto Import v2 or above
28
31
 
29
- ### Support
30
-
31
- Ember Freestyle support is only provided for the 2 latest Ember versions
32
-
33
- Installation
34
- ------------------------------------------------------------------------------
32
+ ## Installation
35
33
 
36
34
  This installation process is opinionated in order to get you going quickly.
37
35
 
@@ -43,63 +41,80 @@ This installation process is opinionated in order to get you going quickly.
43
41
  - Add a `freestyle` template in your app
44
42
  - Add a `freestyle` controller in your app
45
43
 
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:
44
+ 2. Add `this.route('freestyle');` to your `app/router.js` file
45
+ 3. Navigate to `/freestyle`. You should now see something like:
50
46
 
51
47
  ![](doc/freestyle-generated.png)
52
48
 
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.
49
+ All of the generated output is optional. If you don't want a `freestyle` route,
50
+ for example, feel free to get rid of it and add a `freestyle-guide` somewhere
51
+ else in your app.
54
52
 
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.
53
+ You can use the `freestyle-guide` component anywhere you'd like in your app.
54
+ You can organize your components into multiple Freestyle guides if you want to.
55
+ You can even use the constituent components like `freestyle-usage` on their own.
56
56
 
57
57
  ## Problems? No problem.
58
58
 
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!
59
+ Hopefully the installation instructions got you off to a smooth, seamless start.
60
+ 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
61
 
61
- ## Removing Ember Freestyle from Your Production Payload
62
+ ## Excluding Ember Freestyle's Styles
62
63
 
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).
64
+ If you want to exclude Ember Freestyle's styles, you can set the `includeStyles`
65
+ option to `false` in your `ember-cli-build.js` file:
64
66
 
65
- ```javascript
66
- var environment = process.env.EMBER_ENV;
67
- var pluginsToBlacklist = environment === 'production' ? ['ember-freestyle'] : [];
67
+ ```js
68
+ // ember-cli-build.js
68
69
 
69
- module.exports = function(defaults) {
70
- var app = new EmberApp(defaults, {
71
- addons: {
72
- blacklist: pluginsToBlacklist
73
- }
70
+ module.exports = function (defaults) {
71
+ const app = new EmberApp(defaults, {
72
+ 'ember-freestyle': {
73
+ includeStyles: false,
74
+ },
74
75
  };
75
- }
76
+ };
76
77
  ```
77
78
 
78
- ## Using Ember Freestyle Within an Addon
79
+ This might be useful in case you want to define your own styles _or_ if you are
80
+ using `ember-cli-sass` and want to import Ember Freestyle's styles explicitly:
79
81
 
80
- ### Dependency Configuration
82
+ ```scss
83
+ $FreestyleGuide-color--primary: #C70039;
84
+ $FreestyleGuide-color--accent: #DAF7A6;
81
85
 
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.
86
+ @import 'ember-freestyle';
87
+ ```
84
88
 
85
- ## Running
89
+ ## Excluding Ember Freestyle from Your Production Build
86
90
 
87
- * `npm run lint:js`
88
- * `npm run lint:js -- --fix`
91
+ We recommend excluding Ember Freestyle from production builds using Ember CLI's
92
+ `addons.blacklist` option.
89
93
 
90
- ### Running tests
94
+ ```js
95
+ // ember-cli-build.js
91
96
 
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
97
+ const environment = process.env.EMBER_ENV;
98
+ const addonsToExclude = environment === 'production' ? ['ember-freestyle'] : [];
95
99
 
96
- ### Running the dummy application
100
+ module.exports = function (defaults) {
101
+ const app = new EmberAddon(defaults, {
102
+ addons: {
103
+ blacklist: addonsToExclude,
104
+ },
105
+ };
106
+ };
107
+ ```
108
+
109
+ ## Using Ember Freestyle Within an Addon
97
110
 
98
- * `ember serve`
99
- * Visit the dummy application at [http://localhost:4200](http://localhost:4200).
111
+ You should include `ember-freestyle` in your `devDependencies` so that apps
112
+ using your addon will not include Ember Freestyle CSS and JavaScript in their
113
+ production builds.
100
114
 
101
- For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
115
+ ## Contributing
102
116
 
117
+ See the [Contributing](CONTRIBUTING.md) guide for details.
103
118
 
104
119
  ## Contributors ✨
105
120
 
@@ -158,6 +173,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
158
173
  <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>
159
174
  <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>
160
175
  <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>
176
+ <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>
161
177
  </tr>
162
178
  </table>
163
179
 
@@ -166,4 +182,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
166
182
 
167
183
  <!-- ALL-CONTRIBUTORS-LIST:END -->
168
184
 
169
- This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
185
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!
186
+
187
+ ## License
188
+
189
+ 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
  }
@@ -5,6 +5,7 @@
5
5
  @description={{@description}}
6
6
  @required={{@required}}
7
7
  @defaultValue={{@defaultValue}}
8
+ @hideControls={{@hideControls}}
8
9
  >
9
10
  {{#each @items key=@identity as |item index|}}
10
11
  <div class="FreestyleUsageArray-item">
@@ -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
+ }
@@ -4,6 +4,7 @@
4
4
  @description={{@description}}
5
5
  @required={{@required}}
6
6
  @defaultValue={{@defaultValue}}
7
+ @hideControls={{@hideControls}}
7
8
  >
8
9
  <Freestyle::Usage::Bool::Control
9
10
  @value={{@value}}
@@ -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);
@@ -4,6 +4,7 @@
4
4
  @description={{@description}}
5
5
  @required={{@required}}
6
6
  @defaultValue={{@defaultValue}}
7
+ @hideControls={{@hideControls}}
7
8
  >
8
9
  <Freestyle::Usage::Number::Control
9
10
  @value={{@value}}
@@ -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
+ }
@@ -4,6 +4,7 @@
4
4
  @description={{@description}}
5
5
  @required={{@required}}
6
6
  @defaultValue={{@defaultValue}}
7
+ @hideControls={{@hideControls}}
7
8
  >
8
9
  <Freestyle::Usage::Object::Control
9
10
  @value={{@value}}
@@ -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
  }
@@ -5,6 +5,7 @@
5
5
  @required={{@required}}
6
6
  @array={{@array}}
7
7
  @defaultValue={{@defaultValue}}
8
+ @hideControls={{@hideControls}}
8
9
  >
9
10
  <Freestyle::Usage::String::Control
10
11
  @options={{@options}}
@@ -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,3 +1,4 @@
1
+ {{!-- template-lint-disable require-presentational-children --}}
1
2
  <span role="button" ...attributes>
2
3
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="14" viewBox="0 0 24 24" data-code="58332" data-tags="filter_center_focus"><g transform="scale(0.0234375 0.0234375)"><path d="M512 384q52 0 90 38t38 90-38 90-90 38-90-38-38-90 38-90 90-38zM810 810v-170h86v170q0 34-26 60t-60 26h-170v-86h170zM810 128q34 0 60 26t26 60v170h-86v-170h-170v-86h170zM214 214v170h-86v-170q0-34 26-60t60-26h170v86h-170zM214 640v170h170v86h-170q-34 0-60-26t-26-60v-170h86z" /></g></svg>
3
4
  </span>
@@ -7,7 +7,7 @@
7
7
  href="#"
8
8
  {{on 'click' this.toggleNav}}
9
9
  >
10
- <svg height="20px" class="FreestyleGuide-ctaIcon" style="enable-background:new 0 0 32 32;" version="1.1" viewBox="0 0 32 32" width="20px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2 s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2 S29.104,22,28,22z"/></svg>
10
+ <svg height="20px" class="FreestyleGuide-ctaIcon" style="enable-background:new 0 0 32 32;" version="1.1" viewBox="0 0 32 32" width="20px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M4,10h24c1.104,0,2-0.896,2-2s-0.896-2-2-2H4C2.896,6,2,6.896,2,8S2.896,10,4,10z M28,14H4c-1.104,0-2,0.896-2,2 s0.896,2,2,2h24c1.104,0,2-0.896,2-2S29.104,14,28,14z M28,22H4c-1.104,0-2,0.896-2,2s0.896,2,2,2h24c1.104,0,2-0.896,2-2 S29.104,22,28,22z"/></svg>
11
11
  </a>
12
12
  <div class="FreestyleGuide-titleContainer">
13
13
  <div class="FreestyleGuide-title">{{@title}}</div>
@@ -19,7 +19,7 @@
19
19
  title="Show Aside"
20
20
  {{on 'click' this.toggleAside}}
21
21
  >
22
- <svg xmlns="http://www.w3.org/2000/svg" class="FreestyleGuide-ctaIcon" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="14px" height="14px" viewBox="0 0 340.274 340.274" style="enable-background:new 0 0 340.274 340.274;" xml:space="preserve"><path d="M293.629,127.806l-5.795-13.739c19.846-44.856,18.53-46.189,14.676-50.08l-25.353-24.77l-2.516-2.12h-2.937 c-1.549,0-6.173,0-44.712,17.48l-14.184-5.719c-18.332-45.444-20.212-45.444-25.58-45.444h-35.765 c-5.362,0-7.446-0.006-24.448,45.606l-14.123,5.734C86.848,43.757,71.574,38.19,67.452,38.19l-3.381,0.105L36.801,65.032 c-4.138,3.891-5.582,5.263,15.402,49.425l-5.774,13.691C0,146.097,0,147.838,0,153.33v35.068c0,5.501,0,7.44,46.585,24.127 l5.773,13.667c-19.843,44.832-18.51,46.178-14.655,50.032l25.353,24.8l2.522,2.168h2.951c1.525,0,6.092,0,44.685-17.516 l14.159,5.758c18.335,45.438,20.218,45.427,25.598,45.427h35.771c5.47,0,7.41,0,24.463-45.589l14.195-5.74 c26.014,11,41.253,16.585,45.349,16.585l3.404-0.096l27.479-26.901c3.909-3.945,5.278-5.309-15.589-49.288l5.734-13.702 c46.496-17.967,46.496-19.853,46.496-25.221v-35.029C340.268,146.361,340.268,144.434,293.629,127.806z M170.128,228.474 c-32.798,0-59.504-26.187-59.504-58.364c0-32.153,26.707-58.315,59.504-58.315c32.78,0,59.43,26.168,59.43,58.315 C229.552,202.287,202.902,228.474,170.128,228.474z"/></svg>
22
+ <svg xmlns="http://www.w3.org/2000/svg" class="FreestyleGuide-ctaIcon" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="14px" height="14px" viewBox="0 0 340.274 340.274" style="enable-background:new 0 0 340.274 340.274;" xml:space="preserve"><path d="M293.629,127.806l-5.795-13.739c19.846-44.856,18.53-46.189,14.676-50.08l-25.353-24.77l-2.516-2.12h-2.937 c-1.549,0-6.173,0-44.712,17.48l-14.184-5.719c-18.332-45.444-20.212-45.444-25.58-45.444h-35.765 c-5.362,0-7.446-0.006-24.448,45.606l-14.123,5.734C86.848,43.757,71.574,38.19,67.452,38.19l-3.381,0.105L36.801,65.032 c-4.138,3.891-5.582,5.263,15.402,49.425l-5.774,13.691C0,146.097,0,147.838,0,153.33v35.068c0,5.501,0,7.44,46.585,24.127 l5.773,13.667c-19.843,44.832-18.51,46.178-14.655,50.032l25.353,24.8l2.522,2.168h2.951c1.525,0,6.092,0,44.685-17.516 l14.159,5.758c18.335,45.438,20.218,45.427,25.598,45.427h35.771c5.47,0,7.41,0,24.463-45.589l14.195-5.74 c26.014,11,41.253,16.585,45.349,16.585l3.404-0.096l27.479-26.901c3.909-3.945,5.278-5.309-15.589-49.288l5.734-13.702 c46.496-17.967,46.496-19.853,46.496-25.221v-35.029C340.268,146.361,340.268,144.434,293.629,127.806z M170.128,228.474 c-32.798,0-59.504-26.187-59.504-58.364c0-32.153,26.707-58.315,59.504-58.315c32.78,0,59.43,26.168,59.43,58.315 C229.552,202.287,202.902,228.474,170.128,228.474z"/></svg>
23
23
  </a>
24
24
  </header>
25
25
  <main class="FreestyleGuide-body">
@@ -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,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,3 +1,4 @@
1
+ {{!-- template-lint-disable no-whitespace-within-word --}}
1
2
  <div class="FreestyleTypeface" style={{this.fontFamilyStyle}}>
2
3
  <div class="FreestyleTypeface-previewHero">Aa</div>
3
4
  <div class="FreestyleTypeface-previewSampleContainer">
@@ -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 () {