ember-freestyle 0.12.9 → 0.13.2

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 (71) hide show
  1. package/.husky/pre-commit +5 -0
  2. package/CHANGELOG.md +54 -0
  3. package/README.md +69 -49
  4. package/addon/components/freestyle/usage/argument/index.hbs +1 -1
  5. package/addon/components/freestyle/usage/argument/index.js +5 -0
  6. package/addon/components/freestyle/usage/array/index.hbs +1 -0
  7. package/addon/components/freestyle/usage/bool/{control.hbs → control/index.hbs} +1 -1
  8. package/addon/components/freestyle/usage/bool/control/index.js +9 -0
  9. package/addon/components/freestyle/usage/bool/index.hbs +1 -0
  10. package/addon/components/freestyle/usage/number/{control.hbs → control/index.hbs} +2 -1
  11. package/addon/components/freestyle/usage/number/{control.js → control/index.js} +5 -0
  12. package/addon/components/freestyle/usage/number/index.hbs +1 -0
  13. package/addon/components/freestyle/usage/object/control/index.hbs +5 -0
  14. package/addon/components/freestyle/usage/object/control/index.js +18 -0
  15. package/addon/components/freestyle/usage/object/index.hbs +1 -0
  16. package/addon/components/freestyle/usage/string/{control.hbs → control/index.hbs} +4 -2
  17. package/addon/components/freestyle/usage/string/{control.js → control/index.js} +6 -0
  18. package/addon/components/freestyle/usage/string/index.hbs +1 -0
  19. package/addon/components/freestyle-collection/index.js +1 -2
  20. package/addon/components/freestyle-dynamic/index.js +1 -2
  21. package/addon/components/freestyle-dynamic-input/index.hbs +34 -6
  22. package/addon/components/freestyle-dynamic-input/index.js +6 -6
  23. package/addon/components/freestyle-palette/index.hbs +3 -3
  24. package/addon/components/freestyle-palette/index.js +1 -0
  25. package/addon/components/freestyle-palette-item/index.js +1 -1
  26. package/addon/components/freestyle-section/index.js +0 -2
  27. package/addon/components/freestyle-showdown-content/index.js +14 -0
  28. package/addon/components/freestyle-source/index.js +1 -2
  29. package/addon/components/freestyle-subsection/index.js +0 -1
  30. package/addon/components/freestyle-typeface/index.js +1 -1
  31. package/addon/components/freestyle-usage/index.js +3 -4
  32. package/addon/components/freestyle-usage-controls/index.hbs +2 -2
  33. package/addon/components/freestyle-variant-list/index.hbs +1 -1
  34. package/addon/services/ember-freestyle.js +2 -2
  35. package/app/components/freestyle/usage/{bool/index.js → bool.js} +0 -0
  36. package/app/components/freestyle/usage/{number/index.js → number.js} +0 -0
  37. package/app/components/freestyle/usage/{object/index.js → object.js} +0 -0
  38. package/app/components/freestyle/usage/{string/index.js → string.js} +0 -0
  39. package/{addon → app}/styles/components/freestyle/usage.scss +14 -14
  40. package/{addon → app}/styles/components/freestyle-annotation.scss +1 -1
  41. package/{addon → app}/styles/components/freestyle-collection.scss +5 -4
  42. package/{addon → app}/styles/components/freestyle-dynamic.scss +2 -1
  43. package/{addon → app}/styles/components/freestyle-guide.scss +7 -6
  44. package/{addon → app}/styles/components/freestyle-menu.scss +1 -1
  45. package/{addon → app}/styles/components/freestyle-palette-item.scss +0 -1
  46. package/{addon → app}/styles/components/freestyle-palette.scss +1 -1
  47. package/{addon → app}/styles/components/freestyle-section.scss +1 -1
  48. package/{addon → app}/styles/components/freestyle-source.scss +2 -2
  49. package/{addon → app}/styles/components/freestyle-subsection.scss +2 -2
  50. package/{addon → app}/styles/components/freestyle-typeface.scss +0 -0
  51. package/{addon → app}/styles/components/freestyle-usage-controls.scss +12 -11
  52. package/{addon → app}/styles/components/freestyle-usage.scss +2 -6
  53. package/{addon → app}/styles/components/freestyle-variant.scss +0 -0
  54. package/{addon/styles/addon.scss → app/styles/ember-freestyle.scss} +3 -3
  55. package/blueprints/ember-freestyle/files/__root__/app/controllers/freestyle.js +16 -47
  56. package/blueprints/ember-freestyle/files/__root__/app/templates/freestyle.hbs +14 -20
  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 -44
  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/helpers/equal.js +0 -3
  66. package/addon/helpers/is-present.js +0 -10
  67. package/addon/helpers/pick.js +0 -14
  68. package/app/components/freestyle-note.js +0 -9
  69. package/app/helpers/is-present.js +0 -1
  70. package/app/helpers/pick.js +0 -1
  71. package/app/helpers/variant-eq.js +0 -4
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ yarn compile-styles
5
+ git add ./vendor/ember-freestyle.css
package/CHANGELOG.md CHANGED
@@ -2,6 +2,60 @@
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.2](https://github.com/chrislopresto/ember-freestyle/compare/v0.13.1...v0.13.2) (2021-11-21)
6
+
7
+ ### [0.13.1](https://github.com/chrislopresto/ember-freestyle/compare/v0.13.0...v0.13.1) (2021-11-21)
8
+
9
+
10
+ ### Features
11
+
12
+ * remove dependency on `ember-cli-sass` and `sass` ([5482db1](https://github.com/chrislopresto/ember-freestyle/commit/5482db1b11332526e6916f2147e59216120b5fd2))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * pass down [@hide](https://github.com/hide)Controls argument ([c8eac40](https://github.com/chrislopresto/ember-freestyle/commit/c8eac406cc1e59b99f659b68fed7af5b4722d5d4))
18
+
19
+ ## [0.13.0](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.11...v0.13.0) (2021-10-29)
20
+
21
+
22
+ ### ⚠ BREAKING CHANGES
23
+
24
+ * remove the use of `ember-json-viewer`
25
+ * drop support for Node v10
26
+
27
+ ### Features
28
+
29
+ * deprecate `<FreestyleShowdownContent />` component ([78f2568](https://github.com/chrislopresto/ember-freestyle/commit/78f25681c40d33d56c1789601503f3d5ccca88da))
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * fix generated id for `freestyle-dynamic-input` component ([942c901](https://github.com/chrislopresto/ember-freestyle/commit/942c901293827e51f35a976623ccdeb0139181e9))
35
+ * import computed.or directly ([ecb6811](https://github.com/chrislopresto/ember-freestyle/commit/ecb6811368e41c10466bf859e3bb9118f5683bfc))
36
+ * import htmlSafe from @ember/template ([57ea33f](https://github.com/chrislopresto/ember-freestyle/commit/57ea33f6651342488e6cc6209a041dbc15ce977f))
37
+ * make AST plugin functional ([87f521c](https://github.com/chrislopresto/ember-freestyle/commit/87f521ce1371a31f0f1fad9530a973f595819723))
38
+ * resolve deprecations related to built-in component events ([a4d07c6](https://github.com/chrislopresto/ember-freestyle/commit/a4d07c6661299e9ab161a75a35a50ead5e755707))
39
+
40
+
41
+ * drop support for Node v10 ([2add9c7](https://github.com/chrislopresto/ember-freestyle/commit/2add9c7152a5b58b9de45b4e188b836b656d5fb5))
42
+ * remove the use of `ember-json-viewer` ([023f559](https://github.com/chrislopresto/ember-freestyle/commit/023f5591f5531d61188c20d4107447e26172d2b0))
43
+
44
+ ### [0.12.11](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.10...v0.12.11) (2021-03-23)
45
+
46
+
47
+ ### Bug Fixes
48
+
49
+ * Move glimmer/tracker to the deps list since ([3a39dc6](https://github.com/chrislopresto/ember-freestyle/commit/3a39dc6daa2d6a69f6b1e090c19e216edf3fef8d))
50
+ * rendering a color palette ([336af81](https://github.com/chrislopresto/ember-freestyle/commit/336af817a43553a3662ebb0cc4b0d174fcf0b23b))
51
+
52
+ ### [0.12.10](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.9...v0.12.10) (2021-03-17)
53
+
54
+
55
+ ### Bug Fixes
56
+
57
+ * blueprint subsection invocation ([#515](https://github.com/chrislopresto/ember-freestyle/issues/515)) ([ad7f63a](https://github.com/chrislopresto/ember-freestyle/commit/ad7f63abf60f2b7013b91881ea2aa0484835226b))
58
+
5
59
  ### [0.12.9](https://github.com/chrislopresto/ember-freestyle/compare/v0.12.8...v0.12.9) (2021-03-12)
6
60
 
7
61
 
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-37-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,80 @@ 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
+ ## Excluding Ember Freestyle's Styles
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
+ If you want to exclude Ember Freestyle's styles, you can set the `includeStyles`
64
+ option to `false` in your `ember-cli-build.js` file:
64
65
 
65
- ```javascript
66
- var environment = process.env.EMBER_ENV;
67
- var pluginsToBlacklist = environment === 'production' ? ['ember-freestyle'] : [];
66
+ ```js
67
+ // ember-cli-build.js
68
68
 
69
- module.exports = function(defaults) {
70
- var app = new EmberApp(defaults, {
71
- addons: {
72
- blacklist: pluginsToBlacklist
73
- }
69
+ module.exports = function (defaults) {
70
+ const app = new EmberApp(defaults, {
71
+ 'ember-freestyle': {
72
+ includeStyles: false,
73
+ },
74
74
  };
75
- }
75
+ };
76
76
  ```
77
77
 
78
- ## Using Ember Freestyle Within an Addon
78
+ This might be useful in case you want to define your own styles _or_ if you are
79
+ using `ember-cli-sass` and want to import Ember Freestyle's styles explicitly:
79
80
 
80
- ### Dependency Configuration
81
+ ```scss
82
+ $FreestyleGuide-color--primary: #C70039;
83
+ $FreestyleGuide-color--accent: #DAF7A6;
81
84
 
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.
85
+ @import 'ember-freestyle';
86
+ ```
84
87
 
85
- ## Running
88
+ ## Excluding Ember Freestyle from Your Production Build
86
89
 
87
- * `npm run lint:js`
88
- * `npm run lint:js -- --fix`
90
+ We recommend excluding Ember Freestyle from production builds using Ember CLI's
91
+ `addons.blacklist` option.
89
92
 
90
- ### Running tests
93
+ ```js
94
+ // ember-cli-build.js
91
95
 
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
96
+ const environment = process.env.EMBER_ENV;
97
+ const addonsToExclude = environment === 'production' ? ['ember-freestyle'] : [];
95
98
 
96
- ### Running the dummy application
99
+ module.exports = function (defaults) {
100
+ const app = new EmberAddon(defaults, {
101
+ addons: {
102
+ blacklist: addonsToExclude,
103
+ },
104
+ };
105
+ };
106
+ ```
107
+
108
+ ## Using Ember Freestyle Within an Addon
97
109
 
98
- * `ember serve`
99
- * Visit the dummy application at [http://localhost:4200](http://localhost:4200).
110
+ You should include `ember-freestyle` in your `devDependencies` so that apps
111
+ using your addon will not include Ember Freestyle CSS and JavaScript in their
112
+ production builds.
100
113
 
101
- For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
114
+ ## Contributing
102
115
 
116
+ See the [Contributing](CONTRIBUTING.md) guide for details.
103
117
 
104
118
  ## Contributors ✨
105
119
 
@@ -157,6 +171,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
157
171
  <tr>
158
172
  <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
173
  <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>
174
+ <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>
175
+ <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>
160
176
  </tr>
161
177
  </table>
162
178
 
@@ -165,4 +181,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
165
181
 
166
182
  <!-- ALL-CONTRIBUTORS-LIST:END -->
167
183
 
168
- This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
184
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!
185
+
186
+ ## License
187
+
188
+ 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,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({