@ebay/skin 16.0.0 → 16.1.0-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 (268) hide show
  1. package/.github/workflows/jekyll-gh-pages.yml +1 -1
  2. package/.percy.yml +4 -3
  3. package/.prettierrc.json +1 -12
  4. package/.storybook/main.js +44 -40
  5. package/.storybook/manager.js +6 -6
  6. package/.storybook/preview-head.html +49 -11
  7. package/.storybook/theme.js +9 -9
  8. package/.stylelintrc +80 -73
  9. package/ICON-CREATION.md +22 -45
  10. package/README.md +1 -1
  11. package/_cdn/skin/v16.1.0-0/skin-default.min.css +6 -0
  12. package/_cdn/skin/v16.1.0-0/skin-full.min.css +6 -0
  13. package/_cdn/skin/v16.1.0-0/skin-headless.min.css +6 -0
  14. package/_cdn/skin/v16.1.0-0/skin-legacy.min.css +6 -0
  15. package/dist/alert-dialog/alert-dialog.css +16 -11
  16. package/dist/breadcrumbs/breadcrumbs.css +1 -1
  17. package/dist/button/button.css +3 -5
  18. package/dist/calendar/calendar.css +1 -4
  19. package/dist/carousel/carousel.css +11 -15
  20. package/dist/combobox/combobox.css +0 -2
  21. package/dist/confirm-dialog/confirm-dialog.css +16 -11
  22. package/dist/date-textbox/date-textbox.css +1 -1
  23. package/dist/drawer-dialog/drawer-dialog.css +11 -8
  24. package/dist/fullscreen-dialog/fullscreen-dialog.css +11 -8
  25. package/dist/icon/icon.css +17 -5
  26. package/dist/image-placeholder/image-placeholder.css +4 -0
  27. package/dist/infotip/infotip.css +2 -5
  28. package/dist/legacy-theme/legacy-theme.css +2 -2
  29. package/dist/legacy-tokens/ds4-light.css +2 -0
  30. package/dist/lightbox-dialog/lightbox-dialog.css +24 -17
  31. package/dist/listbox/listbox.css +0 -2
  32. package/dist/listbox-button/listbox-button.css +0 -2
  33. package/dist/menu/menu.css +0 -2
  34. package/dist/menu-button/menu-button.css +0 -2
  35. package/dist/mixins/utility-mixins.less +1 -4
  36. package/dist/page-grid/page-grid.css +15 -5
  37. package/dist/page-notice/page-notice.css +1 -1
  38. package/dist/panel-dialog/panel-dialog.css +12 -9
  39. package/dist/progress-bar/progress-bar.css +1 -1
  40. package/dist/progress-stepper/progress-stepper.css +1 -1
  41. package/dist/section-notice/section-notice.css +1 -1
  42. package/dist/section-title/section-title.css +1 -1
  43. package/dist/snackbar-dialog/snackbar-dialog.css +7 -1
  44. package/dist/square-corner-theme/square-corner-theme.css +3 -3
  45. package/dist/svg/icon/icon-bookmark-16.svg +7 -0
  46. package/dist/svg/icon/icon-bookmark-24.svg +7 -0
  47. package/dist/svg/icon/icon-play-filled-16-colored.svg +13 -0
  48. package/dist/svg/icon/icon-play-filled-24-colored.svg +11 -0
  49. package/dist/svg/icon/image-placeholder.svg +3 -0
  50. package/dist/svg/icons.svg +49 -11
  51. package/dist/toast-dialog/toast-dialog.css +7 -1
  52. package/dist/tokens/evo-dark.css +2 -0
  53. package/dist/tokens/evo-light.css +2 -0
  54. package/dist/tooltip/tooltip.css +2 -5
  55. package/dist/tourtip/tourtip.css +2 -5
  56. package/dist/typography/typography.css +1 -1
  57. package/dist/utility/utility.css +2 -8
  58. package/dist/video/video.css +1 -4
  59. package/image-placeholder.browser.json +1 -0
  60. package/image-placeholder.css +1 -0
  61. package/image-placeholder.js +1 -0
  62. package/image-placeholder.mjs +1 -0
  63. package/index.browser.json +1 -0
  64. package/index.css +1 -0
  65. package/index.js +1 -0
  66. package/index.mjs +1 -0
  67. package/package.json +12 -12
  68. package/scripts/develop-module_proper/code-generators/doc-generator.js +32 -16
  69. package/scripts/develop-module_proper/code-generators/style-generator.js +89 -34
  70. package/scripts/develop-module_proper/code-generators/test-generator.js +18 -12
  71. package/scripts/develop-module_proper/errors/illegal-input.js +1 -1
  72. package/scripts/develop-module_proper/index.js +6 -6
  73. package/scripts/develop-module_proper/input/module-name.js +9 -7
  74. package/scripts/develop-module_proper/input/parse-input.js +10 -8
  75. package/scripts/develop-module_proper/util/line-writer.js +31 -18
  76. package/scripts/develop-module_proper/util/title-case.js +4 -3
  77. package/scripts/generate-bundle.js +58 -33
  78. package/scripts/generate-images.js +72 -45
  79. package/scripts/generate-imports/config.json +21 -3
  80. package/scripts/generate-imports/index.js +35 -29
  81. package/scripts/generate-imports/module-builder.js +58 -36
  82. package/scripts/import-svgs.js +33 -25
  83. package/scripts/index.js +68 -68
  84. package/scripts/jekyll-config.js +8 -5
  85. package/scripts/log.js +5 -3
  86. package/scripts/split-icon.js +20 -15
  87. package/scripts/storybook/copy.js +29 -10
  88. package/scripts/svgo.config.js +42 -42
  89. package/scripts/util.js +15 -11
  90. package/scripts/verify-build.js +12 -12
  91. package/src/fonts/marketsans/MarketSans-Regular-WebS.css +6 -3
  92. package/src/fonts/marketsans/MarketSans-SemiBold-WebS.css +6 -3
  93. package/src/less/alert-dialog/alert-dialog.less +5 -6
  94. package/src/less/alert-dialog/stories/alert-dialog.stories.js +1 -1
  95. package/src/less/badge/stories/badge.stories.js +1 -1
  96. package/src/less/breadcrumbs/breadcrumbs.less +5 -2
  97. package/src/less/breadcrumbs/stories/button-cascade.stories.js +1 -1
  98. package/src/less/breadcrumbs/stories/button-overflow.stories.js +1 -1
  99. package/src/less/breadcrumbs/stories/buttons.stories.js +1 -1
  100. package/src/less/breadcrumbs/stories/link-cascade.stories.js +1 -1
  101. package/src/less/breadcrumbs/stories/link-overflow.stories.js +1 -1
  102. package/src/less/breadcrumbs/stories/links.stories.js +1 -1
  103. package/src/less/bundles/skin-headless.less +1 -0
  104. package/src/less/button/button.less +16 -10
  105. package/src/less/button/stories/button/base.stories.js +1 -1
  106. package/src/less/button/stories/button/borderless.stories.js +5 -3
  107. package/src/less/button/stories/button/cascade.stories.js +1 -1
  108. package/src/less/button/stories/button/dimensions.stories.js +1 -1
  109. package/src/less/button/stories/button/primary.stories.js +3 -2
  110. package/src/less/button/stories/button/secondary.stories.js +3 -2
  111. package/src/less/button/stories/button/tertiary.stories.js +1 -1
  112. package/src/less/button/stories/destructive-button/primary.stories.js +1 -1
  113. package/src/less/button/stories/destructive-button/secondary.stories.js +1 -1
  114. package/src/less/button/stories/destructive-button/tertiary.stories.js +1 -1
  115. package/src/less/button/stories/fake-button/base.stories.js +3 -2
  116. package/src/less/button/stories/fake-button/cascade.stories.js +1 -1
  117. package/src/less/button/stories/fake-button/dimensions.stories.js +1 -1
  118. package/src/less/button/stories/fake-button/primary.stories.js +1 -1
  119. package/src/less/button/stories/fake-button/secondary.stories.js +1 -1
  120. package/src/less/calendar/calendar.less +21 -10
  121. package/src/less/calendar/stories/calendar.stories.js +317 -88
  122. package/src/less/carousel/carousel.less +14 -9
  123. package/src/less/carousel/stories/carousel.stories.js +1 -1
  124. package/src/less/checkbox/checkbox.less +14 -5
  125. package/src/less/checkbox/stories/checked.stories.js +1 -1
  126. package/src/less/checkbox/stories/mixed.stories.js +1 -1
  127. package/src/less/checkbox/stories/unchecked.stories.js +1 -1
  128. package/src/less/combobox/combobox.less +4 -1
  129. package/src/less/combobox/stories/combobox.stories.js +1 -1
  130. package/src/less/confirm-dialog/confirm-dialog.less +5 -6
  131. package/src/less/confirm-dialog/stories/confirm-dialog.stories.js +1 -1
  132. package/src/less/cta-button/stories/cascade.stories.js +1 -1
  133. package/src/less/cta-button/stories/cta-button.stories.js +1 -1
  134. package/src/less/cta-button/stories/dimensions.stories.js +1 -1
  135. package/src/less/date-textbox/date-textbox.less +1 -1
  136. package/src/less/details/stories/cascade.stories.js +1 -1
  137. package/src/less/details/stories/details.stories.js +1 -1
  138. package/src/less/drawer-dialog/drawer-dialog.less +2 -2
  139. package/src/less/drawer-dialog/stories/drawer-dialog.stories.js +1 -1
  140. package/src/less/eek/eek.less +2 -2
  141. package/src/less/field/stories/stacked.stories.js +1 -1
  142. package/src/less/field/stories/unstacked.stories.js +1 -1
  143. package/src/less/filter-button/stories/button.stories.js +1 -1
  144. package/src/less/filter-button/stories/group.stories.js +1 -1
  145. package/src/less/filter-button/stories/link.stories.js +1 -1
  146. package/src/less/filter-menu/filter-menu.less +8 -4
  147. package/src/less/filter-menu/stories/filter-menu.stories.js +1 -1
  148. package/src/less/filter-menu-button/filter-menu-button.less +2 -1
  149. package/src/less/filter-menu-button/stories/filter-menu-button.stories.js +1 -1
  150. package/src/less/floating-label/stories/floating-label.stories.js +1 -1
  151. package/src/less/fullscreen-dialog/fullscreen-dialog.less +2 -2
  152. package/src/less/fullscreen-dialog/stories/fullscreen-dialog.stories.js +1 -1
  153. package/src/less/global/stories/global.stories.js +1 -1
  154. package/src/less/icon/generated/icon.less +17 -5
  155. package/src/less/icon/stories/icon.stories.js +1 -1
  156. package/src/less/icon-button/stories/alignment.stories.js +1 -1
  157. package/src/less/image-placeholder/image-placeholder.less +4 -0
  158. package/src/less/image-placeholder/stories/image-placeholder.stories.js +35 -0
  159. package/src/less/index.stories.js +1 -1
  160. package/src/less/infotip/infotip.less +1 -1
  161. package/src/less/infotip/stories/infotip.stories.js +1 -1
  162. package/src/less/inline-notice/stories/inline.stories.js +1 -1
  163. package/src/less/legacy-theme/legacy-theme.less +2 -2
  164. package/src/less/lightbox-dialog/lightbox-dialog.less +12 -9
  165. package/src/less/lightbox-dialog/stories/lightbox-dialog.stories.js +91 -1
  166. package/src/less/link/stories/link.stories.js +3 -2
  167. package/src/less/listbox/listbox.less +2 -1
  168. package/src/less/listbox/stories/cascade.stories.js +1 -1
  169. package/src/less/listbox/stories/listbox.stories.js +1 -1
  170. package/src/less/listbox-button/listbox-button.less +2 -1
  171. package/src/less/listbox-button/stories/base.stories.js +1 -1
  172. package/src/less/listbox-button/stories/cascade.stories.js +1 -1
  173. package/src/less/listbox-button/stories/dimensions.stories.js +1 -1
  174. package/src/less/listbox-button/stories/form.stories.js +1 -1
  175. package/src/less/marketsans/marketsans.less +12 -6
  176. package/src/less/menu/stories/fake-menu.stories.js +1 -1
  177. package/src/less/menu/stories/misc.stories.js +1 -1
  178. package/src/less/menu/stories/multiSelect.stories.js +1 -1
  179. package/src/less/menu-button/menu-button.less +2 -1
  180. package/src/less/menu-button/stories/base.stories.js +1 -1
  181. package/src/less/menu-button/stories/cascade.stories.js +1 -1
  182. package/src/less/menu-button/stories/dimensions.stories.js +1 -1
  183. package/src/less/menu-button/stories/fake-menu-button.stories.js +1 -1
  184. package/src/less/mixins/private/bubble-mixins.less +1 -4
  185. package/src/less/mixins/private/dialog-mixins.less +12 -10
  186. package/src/less/mixins/private/filter-menu-mixins.less +4 -1
  187. package/src/less/mixins/private/selection-list-mixins.less +0 -2
  188. package/src/less/mixins/private/token-mixins.less +2 -1
  189. package/src/less/mixins/public/utility-mixins.less +1 -4
  190. package/src/less/page-grid/page-grid.less +32 -10
  191. package/src/less/page-notice/page-notice.less +1 -1
  192. package/src/less/page-notice/stories/page-notice.stories.js +1 -1
  193. package/src/less/page-notice/stories/test.stories.js +1 -1
  194. package/src/less/pagination/stories/button-cascade.stories.js +1 -1
  195. package/src/less/pagination/stories/buttons.stories.js +1 -1
  196. package/src/less/pagination/stories/link-cascade.stories.js +1 -1
  197. package/src/less/pagination/stories/links.stories.js +1 -1
  198. package/src/less/pagination/stories/overflow.stories.js +1 -1
  199. package/src/less/panel-dialog/panel-dialog.less +5 -4
  200. package/src/less/panel-dialog/stories/panel-dialog.stories.js +1 -1
  201. package/src/less/progress-bar/progress-bar.less +1 -1
  202. package/src/less/progress-bar/stories/progress-bar.stories.js +10 -7
  203. package/src/less/progress-spinner/stories/progress-spinner.stories.js +1 -1
  204. package/src/less/progress-stepper/progress-stepper.less +29 -9
  205. package/src/less/progress-stepper/stories/progress-stepper.stories.js +1 -1
  206. package/src/less/radio/radio.less +8 -3
  207. package/src/less/radio/stories/checked.stories.js +1 -1
  208. package/src/less/radio/stories/unchecked.stories.js +1 -1
  209. package/src/less/section-notice/section-notice.less +1 -1
  210. package/src/less/section-notice/stories/rtl.stories.js +1 -1
  211. package/src/less/section-notice/stories/section-notice.stories.js +1 -1
  212. package/src/less/section-notice/stories/test.stories.js +1 -1
  213. package/src/less/section-title/section-title.less +1 -1
  214. package/src/less/section-title/stories/rtl.stories.js +1 -1
  215. package/src/less/section-title/stories/section-title.stories.js +1 -1
  216. package/src/less/select/stories/cascade.stories.js +1 -1
  217. package/src/less/select/stories/default.stories.js +1 -1
  218. package/src/less/select/stories/floating-label.stories.js +1 -1
  219. package/src/less/signal/stories/signal.stories.js +1 -1
  220. package/src/less/snackbar-dialog/snackbar-dialog.less +1 -1
  221. package/src/less/snackbar-dialog/stories/base.stories.js +1 -1
  222. package/src/less/snackbar-dialog/stories/font-size.stories.js +1 -1
  223. package/src/less/snackbar-dialog/stories/rtl.stories.js +1 -1
  224. package/src/less/split-button/stories/base.stories.js +1 -1
  225. package/src/less/split-button/stories/rtl.stories.js +1 -1
  226. package/src/less/split-button/stories/size.stories.js +1 -1
  227. package/src/less/square-corner-theme/square-corner-theme.less +3 -3
  228. package/src/less/star-rating/stories/star-rating.stories.js +1 -1
  229. package/src/less/star-rating-select/star-rating-select.less +6 -2
  230. package/src/less/star-rating-select/stories/star-rating-select.stories.js +1 -1
  231. package/src/less/switch/stories/form.stories.js +1 -1
  232. package/src/less/switch/stories/script.stories.js +1 -1
  233. package/src/less/switch/switch.less +12 -6
  234. package/src/less/tabs/stories/fake-tabs/block.stories.js +1 -1
  235. package/src/less/tabs/stories/fake-tabs/inlineBlock.stories.js +1 -1
  236. package/src/less/tabs/stories/tabs/block.stories.js +1 -1
  237. package/src/less/tabs/stories/tabs/inlineBlock.stories.js +1 -1
  238. package/src/less/textbox/stories/icon.stories.js +1 -1
  239. package/src/less/textbox/stories/rtl/icon.stories.js +1 -1
  240. package/src/less/textbox/stories/rtl/textbox.stories.js +1 -1
  241. package/src/less/textbox/stories/textbox.stories.js +1 -1
  242. package/src/less/toast-dialog/stories/toast-dialog.stories.js +1 -1
  243. package/src/less/toast-dialog/toast-dialog.less +1 -1
  244. package/src/less/tooltip/stories/pointer.stories.js +84 -78
  245. package/src/less/tooltip/stories/tooltip.stories.js +1 -1
  246. package/src/less/tooltip/tooltip.less +1 -1
  247. package/src/less/tourtip/stories/tourtip.stories.js +1 -1
  248. package/src/less/tourtip/tourtip.less +1 -1
  249. package/src/less/typography/typography.less +1 -1
  250. package/src/less/video/video.less +1 -4
  251. package/src/svg/icon/icon-bookmark-16.svg +7 -0
  252. package/src/svg/icon/icon-bookmark-24.svg +7 -0
  253. package/src/svg/icon/icon-play-filled-16-colored.svg +13 -0
  254. package/src/svg/icon/icon-play-filled-24-colored.svg +11 -0
  255. package/src/svg/icon/image-placeholder.svg +3 -0
  256. package/src/svg/icons.svg +49 -11
  257. package/src/tokens/evo-dark.css +2 -0
  258. package/src/tokens/evo-light.css +2 -0
  259. package/svg.svg +49 -11
  260. package/webpack.config.js +6 -6
  261. package/_cdn/skin/v16.0.0/skin-default.min.css +0 -6
  262. package/_cdn/skin/v16.0.0/skin-full.min.css +0 -6
  263. package/_cdn/skin/v16.0.0/skin-headless.min.css +0 -6
  264. package/_cdn/skin/v16.0.0/skin-legacy.min.css +0 -6
  265. package/dist/svg/icon/icon-image-placeholder.svg +0 -10
  266. package/src/svg/icon/icon-image-placeholder.svg +0 -10
  267. /package/dist/svg/icon/{icon-zoom-In-16.svg → icon-zoom-in-16.svg} +0 -0
  268. /package/src/svg/icon/{icon-zoom-In-16.svg → icon-zoom-in-16.svg} +0 -0
@@ -1,22 +1,22 @@
1
- const fs = require('fs');
2
- const prettier = require('prettier');
3
- const path = require('path');
4
- const { removeFile } = require('../util');
1
+ const fs = require("fs");
2
+ const prettier = require("prettier");
3
+ const path = require("path");
4
+ const { removeFile } = require("../util");
5
5
  const currentDir = path.dirname(path.dirname(__dirname));
6
6
 
7
7
  function getBrowserFileName(filename, basePath) {
8
- if (filename === 'index') {
9
- return path.join(currentDir, basePath || '', `browser.json`);
8
+ if (filename === "index") {
9
+ return path.join(currentDir, basePath || "", `browser.json`);
10
10
  }
11
- return path.join(currentDir, basePath || '', `${filename}.browser.json`);
11
+ return path.join(currentDir, basePath || "", `${filename}.browser.json`);
12
12
  }
13
13
 
14
14
  function getMJSFileName(filename, basePath) {
15
- return path.join(currentDir, basePath || '', `${filename}.mjs`);
15
+ return path.join(currentDir, basePath || "", `${filename}.mjs`);
16
16
  }
17
17
 
18
18
  function getFileName(filename, ext, basePath) {
19
- return path.join(currentDir, basePath || '', `${filename}.${ext}`);
19
+ return path.join(currentDir, basePath || "", `${filename}.${ext}`);
20
20
  }
21
21
 
22
22
  function getBrowserRequireSyntax(filename) {
@@ -25,7 +25,7 @@ function getBrowserRequireSyntax(filename) {
25
25
 
26
26
  function getCSSRequireSyntax(filepath, ext) {
27
27
  let fullFilePath = `${filepath}.${ext}`;
28
- if (filepath.endsWith('.css') || filepath.includes('svg')) {
28
+ if (filepath.endsWith(".css") || filepath.includes("svg")) {
29
29
  fullFilePath = filepath;
30
30
  }
31
31
  return `@import "./${fullFilePath}";\n`;
@@ -33,7 +33,7 @@ function getCSSRequireSyntax(filepath, ext) {
33
33
 
34
34
  function getJSRequireSyntax(filepath, ext) {
35
35
  let fullFilePath = `${filepath}.${ext}`;
36
- if (filepath.endsWith('.css') || filepath.includes('svg')) {
36
+ if (filepath.endsWith(".css") || filepath.includes("svg")) {
37
37
  fullFilePath = filepath;
38
38
  }
39
39
  return `require('./${fullFilePath}');\n`;
@@ -41,7 +41,7 @@ function getJSRequireSyntax(filepath, ext) {
41
41
 
42
42
  function getMJSRequireSyntax(filepath, ext) {
43
43
  let fullFilePath = `${filepath}.${ext}`;
44
- if (filepath.endsWith('.css') || filepath.includes('svg')) {
44
+ if (filepath.endsWith(".css") || filepath.includes("svg")) {
45
45
  fullFilePath = filepath;
46
46
  }
47
47
  return `import './${fullFilePath}';\n`;
@@ -61,7 +61,7 @@ class ModuleBuilder {
61
61
  {
62
62
  hasBaseModule: true,
63
63
  isNested: false,
64
- distDir: '',
64
+ distDir: "",
65
65
  addIndexModules: null,
66
66
  },
67
67
  options
@@ -71,13 +71,13 @@ class ModuleBuilder {
71
71
  getFilePath(filename) {
72
72
  let file = filename;
73
73
  let filePath = filename;
74
- let prefixPath = '';
74
+ let prefixPath = "";
75
75
  if (this.config.overrideFile[filename]) {
76
76
  file = this.config.overrideFile[filename];
77
77
  } else if (this.options.isNested) {
78
- filePath = filename === this.moduleName ? 'index' : this.moduleName;
79
- file = file === this.moduleName ? 'index' : filename;
80
- prefixPath = '../';
78
+ filePath = filename === this.moduleName ? "index" : this.moduleName;
79
+ file = file === this.moduleName ? "index" : filename;
80
+ prefixPath = "../";
81
81
  }
82
82
  return `${prefixPath}dist/${filePath}/${file}`;
83
83
  }
@@ -86,8 +86,8 @@ class ModuleBuilder {
86
86
  try {
87
87
  await fs.promises.rm(this.moduleName, { recursive: true });
88
88
  await removeFile(getMJSFileName(this.moduleName));
89
- await removeFile(getFileName(this.moduleName, 'js'));
90
- await removeFile(getFileName(this.moduleName, 'css'));
89
+ await removeFile(getFileName(this.moduleName, "js"));
90
+ await removeFile(getFileName(this.moduleName, "css"));
91
91
  } catch (e) {
92
92
  return;
93
93
  }
@@ -95,8 +95,8 @@ class ModuleBuilder {
95
95
  await removeFile(getBrowserFileName(this.moduleName));
96
96
  await removeFile(getMJSFileName(this.moduleName));
97
97
 
98
- await removeFile(getFileName(this.moduleName, 'js'));
99
- await removeFile(getFileName(this.moduleName, 'css'));
98
+ await removeFile(getFileName(this.moduleName, "js"));
99
+ await removeFile(getFileName(this.moduleName, "css"));
100
100
  }
101
101
  }
102
102
 
@@ -117,7 +117,9 @@ class ModuleBuilder {
117
117
  async run() {
118
118
  if (this.options.isNested) {
119
119
  // create directory
120
- await fs.promises.mkdir(path.join(currentDir, this.moduleName), { recursive: true });
120
+ await fs.promises.mkdir(path.join(currentDir, this.moduleName), {
121
+ recursive: true,
122
+ });
121
123
  // Get all modules now in directory
122
124
  const moduleList = await fs.promises.readdir(
123
125
  path.join(this.options.distDir, this.moduleName)
@@ -150,7 +152,7 @@ class ModuleBuilder {
150
152
  let modName = path.parse(file).name;
151
153
 
152
154
  if (modName === this.moduleName) {
153
- modName = 'index';
155
+ modName = "index";
154
156
  }
155
157
  await this.writeBrowserJSON(modName);
156
158
  await this.writeModuleFiles(modName);
@@ -167,42 +169,62 @@ class ModuleBuilder {
167
169
  );
168
170
  const filename = currentModule || this.moduleName;
169
171
  const requires = additionalRequires.concat(
170
- this.options.hasBaseModule ? [getBrowserRequireSyntax(filename)] : []
172
+ this.options.hasBaseModule
173
+ ? [getBrowserRequireSyntax(filename)]
174
+ : []
171
175
  );
172
176
 
173
177
  const content = { dependencies: requires };
174
178
  return await fs.promises.writeFile(
175
- getBrowserFileName(filename, this.options.isNested && this.moduleName),
176
- prettier.format(JSON.stringify(content), { parser: 'json' })
179
+ getBrowserFileName(
180
+ filename,
181
+ this.options.isNested && this.moduleName
182
+ ),
183
+ prettier.format(JSON.stringify(content), { parser: "json" })
177
184
  );
178
185
  }
179
186
 
180
187
  async writeModuleFiles(currentModule) {
181
188
  const modules = this.additionalModules;
182
189
  const mod = currentModule || this.moduleName;
183
- const filename = this.options.hasBaseModule ? this.getFilePath(mod) : null;
190
+ const filename = this.options.hasBaseModule
191
+ ? this.getFilePath(mod)
192
+ : null;
184
193
  const baseDirectory = this.options.isNested ? this.moduleName : false;
185
194
 
186
195
  await fs.promises.writeFile(
187
- getFileName(mod, 'js', baseDirectory),
188
- this.parseAdditionalModules(getJSRequireSyntax, 'js', { modules, filename })
196
+ getFileName(mod, "js", baseDirectory),
197
+ this.parseAdditionalModules(getJSRequireSyntax, "js", {
198
+ modules,
199
+ filename,
200
+ })
189
201
  );
190
202
 
191
203
  await fs.promises.writeFile(
192
- getFileName(mod, 'css', baseDirectory),
193
- this.parseAdditionalModules(getCSSRequireSyntax, 'css', { modules, filename })
204
+ getFileName(mod, "css", baseDirectory),
205
+ this.parseAdditionalModules(getCSSRequireSyntax, "css", {
206
+ modules,
207
+ filename,
208
+ })
194
209
  );
195
210
 
196
211
  await fs.promises.writeFile(
197
- getFileName(mod, 'mjs', baseDirectory),
198
- this.parseAdditionalModules(getMJSRequireSyntax, 'css', { modules, filename })
212
+ getFileName(mod, "mjs", baseDirectory),
213
+ this.parseAdditionalModules(getMJSRequireSyntax, "css", {
214
+ modules,
215
+ filename,
216
+ })
199
217
  );
200
218
  }
201
219
 
202
220
  parseAdditionalModules(getSyntax, ext, { modules, filename }) {
203
- const additioanlContent = modules.map((addFile) => getSyntax(addFile, ext));
204
- const content = additioanlContent.concat(filename ? [getSyntax(filename, 'css')] : []);
205
- return content.join('');
221
+ const additioanlContent = modules.map((addFile) =>
222
+ getSyntax(addFile, ext)
223
+ );
224
+ const content = additioanlContent.concat(
225
+ filename ? [getSyntax(filename, "css")] : []
226
+ );
227
+ return content.join("");
206
228
  }
207
229
  }
208
230
 
@@ -1,48 +1,56 @@
1
1
  #!/usr/bin/env node
2
2
  /* eslint-disable no-console */
3
- 'use strict';
4
- const fs = require('fs');
5
- const path = require('path');
3
+ "use strict";
4
+ const fs = require("fs");
5
+ const path = require("path");
6
6
  const currentDir = path.dirname(__dirname);
7
- const svgDir = path.resolve(currentDir, 'src', 'svg');
8
- const { optimize } = require('svgo');
9
- const jsdom = require('jsdom');
7
+ const svgDir = path.resolve(currentDir, "src", "svg");
8
+ const { optimize } = require("svgo");
9
+ const jsdom = require("jsdom");
10
10
  const { JSDOM } = jsdom;
11
- const svgConfig = require('./svgo.config');
12
- const { html2xhtml } = require('./util');
11
+ const svgConfig = require("./svgo.config");
12
+ const { html2xhtml } = require("./util");
13
13
 
14
14
  async function runImport(svg, name, file, argv) {
15
- const skinFile = await fs.promises.readFile(path.resolve(svgDir, `${file}.svg`), 'utf8');
16
- const svgFile = await fs.promises.readFile(svg, 'utf8');
15
+ const skinFile = await fs.promises.readFile(
16
+ path.resolve(svgDir, `${file}.svg`),
17
+ "utf8"
18
+ );
19
+ const svgFile = await fs.promises.readFile(svg, "utf8");
17
20
 
18
- const oldSymbols = new JSDOM(skinFile, { contentType: 'text/html' });
21
+ const oldSymbols = new JSDOM(skinFile, { contentType: "text/html" });
19
22
 
20
23
  const newSVGFile = optimize(svgFile, svgConfig)
21
- .data.replace('<svg', '<symbol')
22
- .replace('</svg', '</symbol');
23
-
24
- const svgJsDom = new JSDOM(newSVGFile, { contentType: 'text/xml' });
25
- const svgFragment = svgJsDom.window.document.querySelector('symbol');
26
- svgFragment.setAttribute('id', name);
27
- if (argv.keepFill === 'false') {
28
- svgFragment.removeAttribute('fill');
29
- svgFragment.querySelectorAll('[fill]').forEach((node) => {
30
- node.removeAttribute('fill');
24
+ .data.replace("<svg", "<symbol")
25
+ .replace("</svg", "</symbol");
26
+
27
+ const svgJsDom = new JSDOM(newSVGFile, { contentType: "text/xml" });
28
+ const svgFragment = svgJsDom.window.document.querySelector("symbol");
29
+ svgFragment.setAttribute("id", name);
30
+ if (argv.keepFill === "false") {
31
+ svgFragment.removeAttribute("fill");
32
+ svgFragment.querySelectorAll("[fill]").forEach((node) => {
33
+ node.removeAttribute("fill");
31
34
  });
32
35
  }
33
36
 
34
37
  const existing = oldSymbols.window.document.querySelector(`#${name}`);
35
38
  if (existing) {
36
- console.log('existing icon found, updating');
39
+ console.log("existing icon found, updating");
37
40
  existing.parentNode.replaceChild(svgFragment, existing);
38
41
  } else {
39
- console.log('adding new icon');
40
- oldSymbols.window.document.querySelector('svg').appendChild(svgFragment);
42
+ console.log("adding new icon");
43
+ oldSymbols.window.document
44
+ .querySelector("svg")
45
+ .appendChild(svgFragment);
41
46
  }
42
47
 
43
48
  const newFileData = html2xhtml(oldSymbols);
44
49
 
45
- await fs.promises.writeFile(path.resolve(svgDir, `${file}.svg`), newFileData);
50
+ await fs.promises.writeFile(
51
+ path.resolve(svgDir, `${file}.svg`),
52
+ newFileData
53
+ );
46
54
  }
47
55
 
48
56
  module.exports = { runImport };
package/scripts/index.js CHANGED
@@ -1,21 +1,21 @@
1
- const { listBundles, runCSSBuild } = require('./generate-bundle');
2
- const { runGenerate } = require('./generate-images');
3
- const { runImport } = require('./import-svgs');
4
- const { verifyBuild } = require('./verify-build');
5
- const { generateTopLevel, cleanTopLevel } = require('./generate-imports');
6
- const { copySVGIcons, copyCustomStyles } = require('./storybook/copy');
7
- const { splitter } = require('./split-icon');
1
+ const { listBundles, runCSSBuild } = require("./generate-bundle");
2
+ const { runGenerate } = require("./generate-images");
3
+ const { runImport } = require("./import-svgs");
4
+ const { verifyBuild } = require("./verify-build");
5
+ const { generateTopLevel, cleanTopLevel } = require("./generate-imports");
6
+ const { copySVGIcons, copyCustomStyles } = require("./storybook/copy");
7
+ const { splitter } = require("./split-icon");
8
8
 
9
- require('yargs') // eslint-disable-line
10
- .usage('Usage: $0 <command> [options]')
9
+ require("yargs") // eslint-disable-line
10
+ .usage("Usage: $0 <command> [options]")
11
11
  .command(
12
- 'split <file>',
13
- 'generates less files with styles from svg icons',
12
+ "split <file>",
13
+ "generates less files with styles from svg icons",
14
14
  (yargs) => {
15
- yargs.positional('svg', {
16
- describe: 'SVG file',
15
+ yargs.positional("svg", {
16
+ describe: "SVG file",
17
17
  demand: true,
18
- default: '',
18
+ default: "",
19
19
  });
20
20
  },
21
21
  async (argv) => {
@@ -27,8 +27,8 @@ require('yargs') // eslint-disable-line
27
27
  }
28
28
  )
29
29
  .command(
30
- 'genSVG',
31
- 'generates less files with styles from svg icons',
30
+ "genSVG",
31
+ "generates less files with styles from svg icons",
32
32
  () => {},
33
33
  () => {
34
34
  try {
@@ -40,28 +40,28 @@ require('yargs') // eslint-disable-line
40
40
  )
41
41
 
42
42
  .command(
43
- 'importSVG <svg> <name> <file>',
44
- 'imports given svg into an icon pack or updates if it exists',
43
+ "importSVG <svg> <name> <file>",
44
+ "imports given svg into an icon pack or updates if it exists",
45
45
  (yargs) => {
46
- yargs.positional('svg', {
47
- describe: 'SVG file',
46
+ yargs.positional("svg", {
47
+ describe: "SVG file",
48
48
  demand: true,
49
- default: '',
49
+ default: "",
50
50
  });
51
- yargs.positional('name', {
52
- describe: 'The ID of the SVG',
51
+ yargs.positional("name", {
52
+ describe: "The ID of the SVG",
53
53
  demand: true,
54
- default: '',
54
+ default: "",
55
55
  });
56
- yargs.positional('file', {
57
- describe: 'The file in skin to append the SVG to',
56
+ yargs.positional("file", {
57
+ describe: "The file in skin to append the SVG to",
58
58
  demand: true,
59
- default: '',
59
+ default: "",
60
60
  });
61
- yargs.option('keep-fill', {
62
- describe: 'If true, will keep fill property on svg',
63
- type: 'boolean',
64
- default: 'false',
61
+ yargs.option("keep-fill", {
62
+ describe: "If true, will keep fill property on svg",
63
+ type: "boolean",
64
+ default: "false",
65
65
  });
66
66
  },
67
67
  async (argv) => {
@@ -73,41 +73,41 @@ require('yargs') // eslint-disable-line
73
73
  }
74
74
  )
75
75
  .command(
76
- 'list',
77
- 'List all available modules',
76
+ "list",
77
+ "List all available modules",
78
78
  (yargs) => {},
79
79
  async (argv) => {
80
80
  await listBundles(argv);
81
81
  }
82
82
  )
83
83
  .command(
84
- 'bundle <name>',
85
- 'generates a CDN bundle with the given name',
84
+ "bundle <name>",
85
+ "generates a CDN bundle with the given name",
86
86
  (yargs) => {
87
87
  yargs
88
- .positional('name', {
89
- describe: 'name to generate bundle',
88
+ .positional("name", {
89
+ describe: "name to generate bundle",
90
90
  demand: true,
91
- default: 'skin',
91
+ default: "skin",
92
92
  })
93
- .option('scope-class', {
94
- describe: 'Scoped class to prefix bundle with',
95
- default: '',
93
+ .option("scope-class", {
94
+ describe: "Scoped class to prefix bundle with",
95
+ default: "",
96
96
  })
97
- .option('no-minify', {
97
+ .option("no-minify", {
98
98
  describe:
99
- 'Skips minify stage. Should set this when another bundler like lasso will be used.',
100
- type: 'boolean',
99
+ "Skips minify stage. Should set this when another bundler like lasso will be used.",
100
+ type: "boolean",
101
101
  })
102
- .option('scope-specificity', {
103
- describe: 'How many times to repeat scope',
104
- default: '1',
102
+ .option("scope-specificity", {
103
+ describe: "How many times to repeat scope",
104
+ default: "1",
105
105
  })
106
- .option('modules', {
107
- alias: 'm',
108
- type: 'array',
106
+ .option("modules", {
107
+ alias: "m",
108
+ type: "array",
109
109
  describe:
110
- 'Space separated list of modules to include. If empty, will include all',
110
+ "Space separated list of modules to include. If empty, will include all",
111
111
  default: [],
112
112
  });
113
113
  },
@@ -116,17 +116,17 @@ require('yargs') // eslint-disable-line
116
116
  }
117
117
  )
118
118
  .command(
119
- 'storybook-copy',
120
- 'Copies files to storybook',
119
+ "storybook-copy",
120
+ "Copies files to storybook",
121
121
  (yargs) => {
122
- yargs.option('no-svg', {
123
- describe: 'Skips copying svgs. Default is false',
124
- type: 'boolean',
122
+ yargs.option("no-svg", {
123
+ describe: "Skips copying svgs. Default is false",
124
+ type: "boolean",
125
125
  default: true,
126
126
  });
127
- yargs.option('no-styles', {
128
- describe: 'Skips copying styles. Default is false',
129
- type: 'boolean',
127
+ yargs.option("no-styles", {
128
+ describe: "Skips copying styles. Default is false",
129
+ type: "boolean",
130
130
  default: true,
131
131
  });
132
132
  },
@@ -140,32 +140,32 @@ require('yargs') // eslint-disable-line
140
140
  }
141
141
  )
142
142
  .command(
143
- 'gen',
144
- 'Generates all imports',
143
+ "gen",
144
+ "Generates all imports",
145
145
  () => {},
146
146
  async () => {
147
147
  await generateTopLevel();
148
148
  }
149
149
  )
150
150
  .command(
151
- 'clean',
152
- 'Cleans all imports',
151
+ "clean",
152
+ "Cleans all imports",
153
153
  () => {},
154
154
  async () => {
155
155
  await cleanTopLevel();
156
156
  }
157
157
  )
158
158
  .command(
159
- 'verify',
160
- 'Verifies that build is not broken and there are no unchecked files',
159
+ "verify",
160
+ "Verifies that build is not broken and there are no unchecked files",
161
161
  () => {},
162
162
  async () => {
163
163
  await verifyBuild();
164
164
  }
165
165
  )
166
- .option('verbose', {
167
- alias: 'v',
168
- type: 'boolean',
166
+ .option("verbose", {
167
+ alias: "v",
168
+ type: "boolean",
169
169
  })
170
170
  .demandCommand(1)
171
171
  .help().argv;
@@ -2,15 +2,18 @@
2
2
  /*
3
3
  * Updates the Jekyll front matter defaults with the current skin package version from NPM.
4
4
  */
5
- const fs = require('fs');
6
- const files = ['./docs/_config.yml'];
5
+ const fs = require("fs");
6
+ const files = ["./docs/_config.yml"];
7
7
 
8
8
  files.forEach((file) => {
9
9
  const newContents = fs
10
- .readFileSync(file, 'utf8')
11
- .replace(/version\:.*\n/gi, `version: ${process.env.npm_package_version}\n`);
10
+ .readFileSync(file, "utf8")
11
+ .replace(
12
+ /version\:.*\n/gi,
13
+ `version: ${process.env.npm_package_version}\n`
14
+ );
12
15
 
13
- fs.writeFile(file, newContents, 'utf8', (err) => {
16
+ fs.writeFile(file, newContents, "utf8", (err) => {
14
17
  if (err) {
15
18
  return console.log(err);
16
19
  }
package/scripts/log.js CHANGED
@@ -1,12 +1,14 @@
1
- const winston = require('winston');
1
+ const winston = require("winston");
2
2
 
3
3
  module.exports = winston.createLogger({
4
- level: 'debug',
4
+ level: "debug",
5
5
  format: winston.format.combine(
6
6
  winston.format.splat(),
7
7
  winston.format.simple(),
8
8
  winston.format.colorize(),
9
9
  winston.format.json()
10
10
  ),
11
- transports: [new winston.transports.Console({ format: winston.format.simple() })],
11
+ transports: [
12
+ new winston.transports.Console({ format: winston.format.simple() }),
13
+ ],
12
14
  });
@@ -1,29 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
  /* eslint-disable no-console */
3
- 'use strict';
4
- const fs = require('fs');
5
- const path = require('path');
3
+ "use strict";
4
+ const fs = require("fs");
5
+ const path = require("path");
6
6
  const currentDir = path.dirname(__dirname);
7
- const svgDir = path.resolve(currentDir, 'src', 'svg');
8
- const { optimize } = require('svgo');
9
- const jsdom = require('jsdom');
7
+ const svgDir = path.resolve(currentDir, "src", "svg");
8
+ const { optimize } = require("svgo");
9
+ const jsdom = require("jsdom");
10
10
  const { JSDOM } = jsdom;
11
- const svgConfig = require('./svgo.config');
12
- const { html2xhtml2 } = require('./util');
11
+ const svgConfig = require("./svgo.config");
12
+ const { html2xhtml2 } = require("./util");
13
13
 
14
14
  async function splitter(file, argv) {
15
- const skinFile = await fs.promises.readFile(path.resolve(svgDir, `${file}.svg`), 'utf8');
15
+ const skinFile = await fs.promises.readFile(
16
+ path.resolve(svgDir, `${file}.svg`),
17
+ "utf8"
18
+ );
16
19
 
17
20
  const symbols = JSDOM.fragment(skinFile);
18
21
 
19
- for (const symbol of symbols.querySelectorAll('symbol')) {
20
- const symbolId = symbol.getAttribute('id');
21
- symbol.removeAttribute('id');
22
- symbol.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
22
+ for (const symbol of symbols.querySelectorAll("symbol")) {
23
+ const symbolId = symbol.getAttribute("id");
24
+ symbol.removeAttribute("id");
25
+ symbol.setAttribute("xmlns", "http://www.w3.org/2000/svg");
23
26
 
24
27
  await fs.promises.writeFile(
25
- path.resolve(svgDir, 'icon', `${symbolId}.svg`),
26
- html2xhtml2(symbol).replace('<symbol', '<svg').replace('</symbol>', '</svg>')
28
+ path.resolve(svgDir, "icon", `${symbolId}.svg`),
29
+ html2xhtml2(symbol)
30
+ .replace("<symbol", "<svg")
31
+ .replace("</symbol>", "</svg>")
27
32
  );
28
33
  }
29
34
  }
@@ -1,25 +1,44 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { rawSvgToHtml } = require('../util');
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { rawSvgToHtml } = require("../util");
4
4
 
5
- const SVG_ICONS_FILE = path.join(__dirname, '..', '..', 'src', 'svg', 'icons.svg');
6
- const CUSTOM_STYLES_FILE = path.join(__dirname, '..', '..', 'docs', 'custom-styles.html');
5
+ const SVG_ICONS_FILE = path.join(
6
+ __dirname,
7
+ "..",
8
+ "..",
9
+ "src",
10
+ "svg",
11
+ "icons.svg"
12
+ );
13
+ const CUSTOM_STYLES_FILE = path.join(
14
+ __dirname,
15
+ "..",
16
+ "..",
17
+ "docs",
18
+ "custom-styles.html"
19
+ );
7
20
 
8
- const STORYBOOK_HEADER_FILE = path.join(__dirname, '..', '..', '.storybook', 'preview-head.html');
21
+ const STORYBOOK_HEADER_FILE = path.join(
22
+ __dirname,
23
+ "..",
24
+ "..",
25
+ ".storybook",
26
+ "preview-head.html"
27
+ );
9
28
 
10
29
  function copySVGIcons() {
11
- const svgIconsContent = fs.readFileSync(SVG_ICONS_FILE, 'utf8');
30
+ const svgIconsContent = fs.readFileSync(SVG_ICONS_FILE, "utf8");
12
31
  const storyBookSvgIconsContent = `
13
32
  <!-- This is auto-generated content from npm script -->
14
33
  ${rawSvgToHtml(svgIconsContent)}
15
34
  `;
16
35
 
17
- fs.writeFileSync(STORYBOOK_HEADER_FILE, storyBookSvgIconsContent, 'utf8');
36
+ fs.writeFileSync(STORYBOOK_HEADER_FILE, storyBookSvgIconsContent, "utf8");
18
37
  }
19
38
 
20
39
  function copyCustomStyles() {
21
- const customStylesContent = fs.readFileSync(CUSTOM_STYLES_FILE, 'utf8');
22
- fs.appendFileSync(STORYBOOK_HEADER_FILE, customStylesContent, 'utf8');
40
+ const customStylesContent = fs.readFileSync(CUSTOM_STYLES_FILE, "utf8");
41
+ fs.appendFileSync(STORYBOOK_HEADER_FILE, customStylesContent, "utf8");
23
42
  }
24
43
 
25
44
  module.exports = { copySVGIcons, copyCustomStyles };