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
@@ -1,5 +1,5 @@
1
- /* eslint-disable no-console */
2
1
  'use strict';
2
+
3
3
  const stripIndent = require('strip-indent');
4
4
 
5
5
  function hasNamedBlocksPolyfillSyntax(node) {
@@ -47,30 +47,28 @@ function cleanupNamedBlocksPolyfillSyntax(sourceString) {
47
47
  return sourceString;
48
48
  }
49
49
 
50
- class FreestyleSourceExtractionAstPlugin {
51
- constructor(env) {
52
- this.originalSource = env.contents;
53
- }
50
+ function extractSource(nodes, contents) {
51
+ // nodes should be a contiguous collection of ast nodes
52
+ let startNode = nodes[0];
53
+ let endNode = nodes[nodes.length - 1];
54
+ let start = startNode.loc.start;
55
+ let end = endNode.loc.end;
56
+ let lines = contents.split('\n').slice(start.line - 1, end.line);
57
+ lines[0] = new Array(start.column).join(' ') + lines[0].slice(start.column);
58
+ lines[lines.length - 1] = lines[lines.length - 1].slice(0, end.column);
59
+ return stripIndent(lines.join('\n'));
60
+ }
54
61
 
55
- extractSource(nodes) {
56
- // nodes should be a contiguous collection of ast nodes
57
- let startNode = nodes[0];
58
- let endNode = nodes[nodes.length - 1];
59
- let start = startNode.loc.start;
60
- let end = endNode.loc.end;
61
- let lines = this.originalSource.split('\n').slice(start.line - 1, end.line);
62
- lines[0] = new Array(start.column).join(' ') + lines[0].slice(start.column);
63
- lines[lines.length - 1] = lines[lines.length - 1].slice(0, end.column);
64
- return stripIndent(lines.join('\n'));
65
- }
62
+ module.exports = function ({ contents, syntax }) {
63
+ const { builders: b } = syntax;
64
+
65
+ return {
66
+ name: 'component-freestyle-source-extracter',
66
67
 
67
- transform(ast) {
68
- const plugin = this;
69
- const { builders: b } = this.syntax;
70
- const visitor = {
68
+ visitor: {
71
69
  ElementNode(node) {
72
70
  if (['FreestyleUsage', 'FreestyleDynamic'].includes(node.tag)) {
73
- const sourceString = plugin.extractSource(node.children);
71
+ const sourceString = extractSource(node.children, contents);
74
72
  node.attributes.push(b.attr('@source', b.text(sourceString)));
75
73
  }
76
74
  if (['Freestyle::Usage'].includes(node.tag)) {
@@ -80,15 +78,15 @@ class FreestyleSourceExtractionAstPlugin {
80
78
  let exampleNode = node.children.find((n) => n.tag === ':example');
81
79
  let sourceString;
82
80
  if (exampleNode) {
83
- sourceString = plugin.extractSource(exampleNode.children);
81
+ sourceString = extractSource(exampleNode.children, contents);
84
82
  } else if (hasNamedBlocksPolyfillSyntax(node)) {
85
83
  // Unfortunately, we may still run after the named-blocks-polyfill when in an Ember Addon, so we do the best we can here.
86
84
  exampleNode = extractFromNamedBlocksPolyfillSyntax(node);
87
- sourceString = plugin.extractSource(exampleNode.body);
85
+ sourceString = extractSource(exampleNode.body, contents);
88
86
  sourceString = cleanupNamedBlocksPolyfillSyntax(sourceString);
89
87
  } else {
90
88
  exampleNode = node; // not using named blocks
91
- sourceString = plugin.extractSource(exampleNode.children);
89
+ sourceString = extractSource(exampleNode.children, contents);
92
90
  }
93
91
  node.attributes.push(b.attr('@source', b.text(sourceString)));
94
92
  }
@@ -103,15 +101,10 @@ class FreestyleSourceExtractionAstPlugin {
103
101
  'templates/components/freestyle-dynamic.hbs'
104
102
  ))
105
103
  ) {
106
- const sourceString = plugin.extractSource(node.program.body);
104
+ const sourceString = extractSource(node.program.body, contents);
107
105
  node.hash.pairs.push(b.pair('source', b.string(sourceString)));
108
106
  }
109
107
  },
110
- };
111
-
112
- this.syntax.traverse(ast, visitor);
113
- return ast;
114
- }
115
- }
116
-
117
- module.exports = FreestyleSourceExtractionAstPlugin;
108
+ },
109
+ };
110
+ };
package/package.json CHANGED
@@ -1,14 +1,10 @@
1
1
  {
2
2
  "name": "ember-freestyle",
3
- "version": "0.12.9",
3
+ "version": "0.13.2",
4
4
  "description": "Create a living styleguide for your Ember app.",
5
5
  "keywords": [
6
6
  "ember-addon"
7
7
  ],
8
- "volta": {
9
- "node": "12.20.1",
10
- "yarn": "1.22.10"
11
- },
12
8
  "repository": "https://github.com/chrislopresto/ember-freestyle.git",
13
9
  "license": "MIT",
14
10
  "author": "Chris LoPresto",
@@ -18,12 +14,16 @@
18
14
  },
19
15
  "scripts": {
20
16
  "build": "ember build --environment=production",
21
- "lint": "npm-run-all --aggregate-output --continue-on-error --parallel 'lint:!(fix)'",
17
+ "compile-styles": "node ./script/compile-styles.js",
18
+ "lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
19
+ "lint:css": "stylelint \"./**/*.scss\"",
20
+ "lint:css:fix": "stylelint \"./**/*.scss\" --fix",
22
21
  "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
23
22
  "lint:hbs": "ember-template-lint .",
24
23
  "lint:hbs:fix": "ember-template-lint . --fix",
25
24
  "lint:js": "eslint . --cache",
26
25
  "lint:js:fix": "eslint . --fix",
26
+ "prepare": "husky install",
27
27
  "start": "ember serve",
28
28
  "test": "npm-run-all lint test:*",
29
29
  "test:ember": "ember test",
@@ -35,70 +35,72 @@
35
35
  "contributors:generate": "all-contributors generate"
36
36
  },
37
37
  "dependencies": {
38
- "@ember/render-modifiers": "^1.0.2",
39
- "ember-auto-import": "^1.10.1",
40
- "ember-cli-babel": "^7.23.0",
41
- "ember-cli-htmlbars": "^5.3.1",
42
- "ember-cli-sass": "^10.0.0",
43
- "ember-json-viewer": "^0.6.0",
44
- "ember-modifier": "^2.1.0",
38
+ "@ember/render-modifiers": "^2.0.0",
39
+ "@glimmer/component": "^1.0.4",
40
+ "@glimmer/tracking": "^1.0.4",
41
+ "ember-auto-import": "^1.11.3",
42
+ "ember-cli-babel": "^7.26.6",
43
+ "ember-cli-htmlbars": "^6.0.0",
44
+ "ember-modifier": "^2.1.2",
45
45
  "ember-named-blocks-polyfill": "^0.2.4",
46
- "ember-runtime-enumerable-includes-polyfill": "^2.0.0",
47
46
  "ember-truth-helpers": "^3.0.0",
48
- "glob": "^7.1.3",
47
+ "json-formatter-js": "^2.3.4",
49
48
  "macro-decorators": "^0.1.2",
50
- "sass": "^1.17.0",
51
49
  "strip-indent": "^3.0.0"
52
50
  },
53
51
  "devDependencies": {
54
52
  "@ember/optional-features": "^2.0.0",
55
- "@ember/test-helpers": "^2.1.4",
56
- "@glimmer/component": "^1.0.3",
57
- "@glimmer/tracking": "^1.0.3",
53
+ "@ember/test-helpers": "^2.6.0",
54
+ "@embroider/test-setup": "^0.47.2",
58
55
  "all-contributors-cli": "^6.14.1",
59
56
  "babel-eslint": "^10.1.0",
60
57
  "broccoli-asset-rev": "^3.0.0",
61
- "ember-cli": "~3.24.0",
62
- "ember-cli-autoprefixer": "^0.8.1",
58
+ "ember-cli": "~3.28.4",
59
+ "ember-cli-autoprefixer": "^1.0.3",
63
60
  "ember-cli-dependency-checker": "^3.2.0",
64
61
  "ember-cli-deploy": "^1.0.2",
65
62
  "ember-cli-deploy-build": "^2.0.0",
66
63
  "ember-cli-deploy-git": "^1.3.4",
67
- "ember-cli-inject-live-reload": "^2.0.2",
68
- "ember-cli-page-object": "^1.17.4",
69
- "ember-cli-sass-lint": "^1.0.3",
70
- "ember-cli-shims": "^1.2.0",
71
- "ember-cli-showdown": "^4.1.0",
64
+ "ember-cli-inject-live-reload": "^2.1.0",
65
+ "ember-cli-sass": "^10.0.0",
66
+ "ember-cli-showdown": "^6.0.0",
72
67
  "ember-cli-sri": "^2.1.0",
73
- "ember-cli-terser": "^4.0.1",
68
+ "ember-cli-terser": "^4.0.2",
74
69
  "ember-code-snippet": "^3.0.0",
75
70
  "ember-export-application-global": "^2.0.1",
76
71
  "ember-load-initializers": "^2.1.2",
77
- "ember-maybe-import-regenerator": "^0.1.6",
78
- "ember-native-dom-helpers": "^0.7.0",
79
- "ember-page-title": "^6.0.3",
80
- "ember-qunit": "^5.1.2",
81
- "ember-resolver": "^8.0.2",
82
- "ember-source": "~3.24.0",
72
+ "ember-maybe-import-regenerator": "^1.0.0",
73
+ "ember-page-title": "^7.0.0",
74
+ "ember-qunit": "^5.1.5",
75
+ "ember-resolver": "^8.0.3",
76
+ "ember-source": "~3.28.6",
83
77
  "ember-source-channel-url": "^3.0.0",
84
- "ember-template-lint": "^2.15.0",
85
- "ember-try": "^1.4.0",
86
- "eslint": "^7.17.0",
78
+ "ember-template-lint": "^3.13.0",
79
+ "ember-try": "^2.0.0",
80
+ "eslint": "^7.32.0",
87
81
  "eslint-config-ember": "0.3.0",
88
- "eslint-config-prettier": "^8.1.0",
89
- "eslint-plugin-ember": "^10.1.1",
82
+ "eslint-config-prettier": "^8.3.0",
83
+ "eslint-plugin-ember": "^10.5.7",
90
84
  "eslint-plugin-node": "^11.1.0",
91
- "eslint-plugin-prettier": "^3.3.1",
85
+ "eslint-plugin-prettier": "^4.0.0",
86
+ "eslint-plugin-qunit": "^7.0.0",
87
+ "husky": "^7.0.4",
92
88
  "loader.js": "^4.7.0",
93
89
  "npm-run-all": "^4.1.5",
94
- "prettier": "^2.2.1",
95
- "qunit": "^2.14.0",
96
- "qunit-dom": "^1.6.0",
90
+ "prettier": "^2.3.2",
91
+ "qunit": "^2.16.0",
92
+ "qunit-dom": "^2.0.0",
97
93
  "remarkable": "^2.0.0",
98
- "standard-version": "^9.1.0"
94
+ "sass": "^1.43.4",
95
+ "standard-version": "^9.3.2",
96
+ "stylelint": "^13.13.1",
97
+ "stylelint-config-prettier": "^9.0.3",
98
+ "stylelint-config-recommended-scss": "^4.3.0",
99
+ "stylelint-prettier": "^1.2.0",
100
+ "stylelint-scss": "^3.21.0"
99
101
  },
100
102
  "engines": {
101
- "node": "10.* || >= 12"
103
+ "node": "12.* || 14.* || >= 16"
102
104
  },
103
105
  "ember": {
104
106
  "edition": "octane"
@@ -112,5 +114,9 @@
112
114
  "after": [
113
115
  "ember-named-blocks-polyfill"
114
116
  ]
117
+ },
118
+ "volta": {
119
+ "node": "12.22.6",
120
+ "yarn": "1.22.15"
115
121
  }
116
122
  }