@emulsify/core 1.3.1 → 2.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 (96) hide show
  1. package/.github/workflows/addtoprojects.yml +1 -1
  2. package/.storybook/main.js +11 -5
  3. package/.storybook/manager.js +1 -2
  4. package/.storybook/preview.js +2 -5
  5. package/.storybook/webpack.config.js +64 -12
  6. package/config/eslintrc.config.json +0 -1
  7. package/config/webpack/loaders.js +11 -3
  8. package/config/webpack/optimizers.js +18 -0
  9. package/config/webpack/plugins.js +52 -12
  10. package/config/webpack/resolves.js +79 -0
  11. package/config/webpack/sdc-loader.js +8 -0
  12. package/config/webpack/webpack.common.js +119 -23
  13. package/package.json +34 -28
  14. package/.history/.github/workflows/addtoprojects_20240130164835.yml +0 -21
  15. package/.history/.github/workflows/addtoprojects_20240607213528.yml +0 -21
  16. package/.history/.github/workflows/contributors_20240130164835.yml +0 -23
  17. package/.history/.github/workflows/contributors_20240607213836.yml +0 -23
  18. package/.history/.husky/commit-msg_20240729171216 +0 -4
  19. package/.history/.husky/commit-msg_20240729172358 +0 -2
  20. package/.history/.husky/pre-commit_20240729171216 +0 -4
  21. package/.history/.husky/pre-commit_20240729172429 +0 -2
  22. package/.history/.releaserc_20240607133550 +0 -11
  23. package/.history/.releaserc_20240607134831 +0 -18
  24. package/.history/.releaserc_20240607135005 +0 -11
  25. package/.history/.storybook/main_20240722083211.js +0 -153
  26. package/.history/.storybook/manager_20240311205454.js +0 -15
  27. package/.history/.storybook/manager_20240607162817.js +0 -15
  28. package/.history/.storybook/preview_20240401184023.js +0 -40
  29. package/.history/.storybook/preview_20240607162826.js +0 -40
  30. package/.history/.storybook/preview_20240610083720.js +0 -37
  31. package/.history/.storybook/preview_20240610083852.js +0 -30
  32. package/.history/.storybook/setupTwig.test_20240228163244.js +0 -33
  33. package/.history/.storybook/setupTwig.test_20240607163045.js +0 -33
  34. package/.history/.storybook/setupTwig_20240326081425.js +0 -59
  35. package/.history/.storybook/setupTwig_20240607163001.js +0 -43
  36. package/.history/.storybook/setupTwig_20240607163019.js +0 -43
  37. package/.history/README_20240312154948.md +0 -72
  38. package/.history/README_20240607162731.md +0 -94
  39. package/.history/config/a11y.config_20240607110020.js +0 -61
  40. package/.history/config/a11y.config_20240607163052.js +0 -61
  41. package/.history/config/a11y.config_20240607163120.js +0 -61
  42. package/.history/config/webpack/css/style_20240228152007.js +0 -1
  43. package/.history/config/webpack/css/style_20240607163238.js +0 -1
  44. package/.history/config/webpack/css_20240317194751.js +0 -1
  45. package/.history/config/webpack/css_20240607163108.js +0 -1
  46. package/.history/config/webpack/css_20240607163132.js +0 -1
  47. package/.history/config/webpack/loaders_20240730152304.js +0 -87
  48. package/.history/config/webpack/loaders_20240730152315.js +0 -87
  49. package/.history/config/webpack/loaders_20240731075844.js +0 -87
  50. package/.history/config/webpack/loaders_20240806083911.js +0 -88
  51. package/.history/config/webpack/loaders_20240806084032.js +0 -88
  52. package/.history/config/webpack/plugins_20240730152746.js +0 -77
  53. package/.history/config/webpack/plugins_20240730152818.js +0 -76
  54. package/.history/config/webpack/plugins_20240730153144.js +0 -76
  55. package/.history/config/webpack/plugins_20240730153215.js +0 -76
  56. package/.history/config/webpack/plugins_20240731075839.js +0 -48
  57. package/.history/config/webpack/svgSprite_20240401184053.js +0 -5
  58. package/.history/config/webpack/svgSprite_20240607163207.js +0 -5
  59. package/.history/config/webpack/webpack.common_20240730152548.js +0 -74
  60. package/.history/config/webpack/webpack.common_20240730152652.js +0 -76
  61. package/.history/config/webpack/webpack.common_20240731075910.js +0 -72
  62. package/.history/package-lock_20240722091648.json +0 -34023
  63. package/.history/package-lock_20240729171049.json +0 -34023
  64. package/.history/package-lock_20240729171107.json +0 -34023
  65. package/.history/package-lock_20240729171136.json +0 -34023
  66. package/.history/package_20240722085509.json +0 -135
  67. package/.history/package_20240722085523.json +0 -135
  68. package/.history/package_20240722085530.json +0 -135
  69. package/.history/package_20240722085550.json +0 -135
  70. package/.history/package_20240722085556.json +0 -135
  71. package/.history/package_20240722085606.json +0 -135
  72. package/.history/package_20240722091526.json +0 -135
  73. package/.history/package_20240722091548.json +0 -135
  74. package/.history/package_20240729171200.json +0 -135
  75. package/.history/package_20240729171707.json +0 -135
  76. package/.history/package_20240729171737.json +0 -135
  77. package/.history/package_20240729171750.json +0 -135
  78. package/.history/package_20240729171809.json +0 -135
  79. package/.history/package_20240729171834.json +0 -135
  80. package/.history/package_20240729171854.json +0 -135
  81. package/.history/package_20240729172054.json +0 -135
  82. package/.history/package_20240729172133.json +0 -135
  83. package/.history/package_20240729174630.json +0 -135
  84. package/.history/package_20240730153116.json +0 -136
  85. package/.history/package_20240806081212.json +0 -135
  86. package/.history/package_20240806081229.json +0 -135
  87. package/.history/package_20240806081258.json +0 -135
  88. package/.history/package_20240806081538.json +0 -135
  89. package/.history/package_20240806082035.json +0 -135
  90. package/.history/package_20240806082121.json +0 -135
  91. package/.history/package_20240806082142.json +0 -135
  92. package/.history/package_20240806082313.json +0 -135
  93. package/.history/package_20240806082418.json +0 -135
  94. package/.history/package_20240806083920.json +0 -135
  95. package/config/webpack/css/style.js +0 -1
  96. package/config/webpack/css.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emulsify/core",
3
- "version": "1.3.1",
3
+ "version": "2.0.0",
4
4
  "description": "Bundled tooling for Storybook development + Webpack Build",
5
5
  "keywords": [
6
6
  "component library",
@@ -47,16 +47,18 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@babel/core": "^7.25.2",
50
- "@babel/eslint-parser": "^7.25.1",
51
- "@emulsify/cli": "^1.10.2",
52
- "@storybook/addon-a11y": "^7.6.17",
53
- "@storybook/addon-actions": "^7.6.17",
54
- "@storybook/addon-essentials": "^7.6.17",
55
- "@storybook/addon-links": "^7.6.17",
50
+ "@emulsify/cli": "^1.11.0",
51
+ "@storybook/addon-a11y": "^8.2.9",
52
+ "@storybook/addon-actions": "^8.2.9",
53
+ "@storybook/addon-essentials": "^8.2.9",
54
+ "@storybook/addon-links": "^8.2.9",
56
55
  "@storybook/addon-styling-webpack": "^1.0.0",
57
- "@storybook/addon-themes": "^7.6.17",
58
- "@storybook/html": "^7.6.17",
59
- "@storybook/html-webpack5": "^7.6.17",
56
+ "@storybook/addon-themes": "^8.2.9",
57
+ "@storybook/html": "^8.2.9",
58
+ "@storybook/html-webpack5": "^8.2.9",
59
+ "@storybook/manager-api": "^8.2.9",
60
+ "@storybook/preview-api": "^8.2.9",
61
+ "@storybook/theming": "^8.2.9",
60
62
  "add-attributes-twig-extension": "^0.1.0",
61
63
  "autoprefixer": "^10.4.20",
62
64
  "babel-loader": "^9.1.3",
@@ -66,33 +68,36 @@
66
68
  "chalk": "^5.2.0",
67
69
  "clean-webpack-plugin": "^4.0.0",
68
70
  "concurrently": "^8.2.2",
71
+ "copy-webpack-plugin": "^12.0.2",
69
72
  "css-loader": "^7.1.1",
70
73
  "eslint": "^8.57.0",
71
- "eslint-config-airbnb-base": "^15.0.0",
72
74
  "eslint-config-prettier": "^9.1.0",
73
75
  "eslint-plugin-import": "^2.29.1",
74
- "eslint-plugin-jest": "^27.9.0",
76
+ "eslint-plugin-jest": "^28.8.0",
75
77
  "eslint-plugin-prettier": "^5.1.3",
76
- "eslint-plugin-security": "^2.1.1",
78
+ "eslint-plugin-security": "^3.0.1",
77
79
  "eslint-plugin-storybook": "^0.8.0",
78
80
  "eslint-webpack-plugin": "^4.1.0",
79
81
  "file-loader": "^6.2.0",
80
82
  "fs-extra": "^11.2.0",
81
- "glob": "^10.3.12",
83
+ "glob": "^11.0.0",
82
84
  "graceful-fs": "^4.2.11",
83
85
  "html-webpack-plugin": "^5.6.0",
84
- "imagemin-webpack-plugin": "^2.4.2",
86
+ "image-minimizer-webpack-plugin": "^4.1.0",
87
+ "imagemin": "^9.0.0",
88
+ "imagemin-gifsicle": "^7.0.0",
89
+ "imagemin-jpegtran": "^7.0.0",
90
+ "imagemin-optipng": "^8.0.0",
85
91
  "jest": "^29.7.0",
86
92
  "jest-environment-jsdom": "^29.7.0",
87
93
  "js-yaml": "^4.1.0",
88
94
  "js-yaml-loader": "^1.2.2",
89
- "lint-staged": "^15.2.8",
90
- "mini-css-extract-plugin": "^2.9.0",
95
+ "mini-css-extract-plugin": "^2.9.1",
91
96
  "node-sass-glob-importer": "^5.3.3",
92
97
  "normalize.css": "^8.0.1",
93
98
  "open-cli": "^8.0.0",
94
99
  "pa11y": "^8.0.0",
95
- "postcss": "^8.4.41",
100
+ "postcss": "^8.4.44",
96
101
  "postcss-loader": "^8.1.1",
97
102
  "postcss-scss": "^4.0.9",
98
103
  "ramda": "^0.30.1",
@@ -100,10 +105,11 @@
100
105
  "react-dom": "^18.2.0",
101
106
  "regenerator-runtime": "^0.14.1",
102
107
  "sass": "^1.75.0",
103
- "sass-loader": "^16.0.0",
104
- "storybook": "^7.6.17",
105
- "style-dictionary": "^3.9.2",
106
- "stylelint": "^16.8.1",
108
+ "sass-loader": "^16.0.1",
109
+ "semantic-release": "^24.1.0",
110
+ "storybook": "^8.2.9",
111
+ "style-dictionary": "^4.1.0",
112
+ "stylelint": "^16.9.0",
107
113
  "stylelint-config-standard-scss": "^13.1.0",
108
114
  "stylelint-prettier": "^5.0.0",
109
115
  "stylelint-selector-bem-pattern": "^4.0.0",
@@ -111,23 +117,23 @@
111
117
  "svg-sprite-loader": "^6.0.11",
112
118
  "token-transformer": "^0.0.33",
113
119
  "twig-drupal-filters": "^3.2.0",
114
- "twig-loader": "github:fourkitchens/twig-loader",
115
120
  "twig-testing-library": "^1.2.0",
121
+ "twigjs-loader": "^1.0.3",
116
122
  "webpack": "^5.91.0",
117
123
  "webpack-cli": "^5.1.4",
118
124
  "webpack-merge": "^6.0.1",
119
125
  "yaml": "^2.5.0"
120
126
  },
121
127
  "devDependencies": {
122
- "@commitlint/cli": "^19.3.0",
123
- "@commitlint/config-conventional": "^19.1.0",
128
+ "@commitlint/cli": "^19.4.1",
129
+ "@commitlint/config-conventional": "^19.4.1",
124
130
  "@semantic-release/changelog": "^6.0.2",
125
131
  "@semantic-release/commit-analyzer": "^13.0.0",
126
132
  "@semantic-release/git": "^10.0.1",
127
- "@semantic-release/github": "^10.1.3",
133
+ "@semantic-release/github": "^10.3.0",
128
134
  "@semantic-release/release-notes-generator": "^14.0.0",
129
- "husky": "^9.1.4",
130
- "semantic-release": "^24.0.0"
135
+ "husky": "^9.1.5",
136
+ "lint-staged": "^15.2.10"
131
137
  },
132
138
  "overrides": {
133
139
  "graceful-fs": "^4.2.11"
@@ -1,21 +0,0 @@
1
- name: Add to projects
2
-
3
- on:
4
- issues:
5
- types:
6
- - opened
7
- pull_request:
8
- types:
9
- - opened
10
-
11
- jobs:
12
- add-to-project:
13
- name: Add issue to project
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/add-to-project@v0.3.0
17
- with:
18
- # You can target a repository in a different organization
19
- # to the issue
20
- project-url: https://github.com/orgs/emulsify-ds/projects/6
21
- github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
@@ -1,21 +0,0 @@
1
- name: Add to projects
2
-
3
- on:
4
- issues:
5
- types:
6
- - opened
7
- pull_request:
8
- types:
9
- - opened
10
-
11
- jobs:
12
- add-to-project:
13
- name: Add issue to project
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/add-to-project@v0.3.0
17
- with:
18
- # You can target a repository in a different organization
19
- # to the issue
20
- project-url: https://github.com/orgs/emulsify-ds/projects/6
21
- token: ${{ secrets.ADD_TO_PROJECT_PAT }}
@@ -1,23 +0,0 @@
1
- name: Add contributors
2
- on:
3
- schedule:
4
- - cron: "20 20 * * *"
5
- push:
6
- branches:
7
- - master
8
-
9
- jobs:
10
- add-contributors:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
- - uses: BobAnkh/add-contributors@master
15
- with:
16
- CONTRIBUTOR: "### Contributors"
17
- COLUMN_PER_ROW: "6"
18
- ACCESS_TOKEN: ${{secrets.ADD_TO_PROJECT_PAT}}
19
- IMG_WIDTH: "100"
20
- FONT_SIZE: "14"
21
- PATH: "/README.md"
22
- COMMIT_MESSAGE: "docs(README): update contributors"
23
- AVATAR_SHAPE: "round"
@@ -1,23 +0,0 @@
1
- name: Add contributors
2
- on:
3
- schedule:
4
- - cron: "20 20 * * *"
5
- push:
6
- branches:
7
- - main
8
-
9
- jobs:
10
- add-contributors:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
- - uses: BobAnkh/add-contributors@master
15
- with:
16
- CONTRIBUTOR: "### Contributors"
17
- COLUMN_PER_ROW: "6"
18
- ACCESS_TOKEN: ${{secrets.ADD_TO_PROJECT_PAT}}
19
- IMG_WIDTH: "100"
20
- FONT_SIZE: "14"
21
- PATH: "/README.md"
22
- COMMIT_MESSAGE: "docs(README): update contributors"
23
- AVATAR_SHAPE: "round"
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npm run husky:commit-msg
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- npm run husky:commit-msg
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npm run husky:pre-commit
@@ -1,2 +0,0 @@
1
- #!/bin/sh
2
- npm run husky:pre-commit
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- tagFormat: '${version}',
3
- branches: ['main'],
4
- repositoryUrl: 'git@github.com:emulsify-ds/emulsify-core.git',
5
- plugins: [
6
- '@semantic-release/commit-analyzer',
7
- '@semantic-release/release-notes-generator',
8
- ['@semantic-release/npm', { npmPublish: false }],
9
- '@semantic-release/github',
10
- ],
11
- };
@@ -1,18 +0,0 @@
1
- {
2
- "tagFormat": "${version}",
3
- "branches": [
4
- "main"
5
- ],
6
- "repositoryUrl": "git@github.com:emulsify-ds/emulsify-core.git",
7
- "plugins": [
8
- "@semantic-release/commit-analyzer",
9
- "@semantic-release/release-notes-generator",
10
- [
11
- "@semantic-release/npm",
12
- {
13
- "npmPublish": false
14
- }
15
- ],
16
- "@semantic-release/github"
17
- ]
18
- }
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- tagFormat: '${version}',
3
- branches: ['main'],
4
- repositoryUrl: 'git@github.com:emulsify-ds/emulsify-core.git',
5
- plugins: [
6
- '@semantic-release/commit-analyzer',
7
- '@semantic-release/release-notes-generator',
8
- ['@semantic-release/npm', { npmPublish: false }],
9
- '@semantic-release/github',
10
- ],
11
- };
@@ -1,153 +0,0 @@
1
- const { configOverrides } = require('../../../../config/emulsify-core/storybook/main');
2
-
3
- const defaultConfig = {
4
- stories: [
5
- '../../../../components/**/*.stories.@(js|jsx|ts|tsx)',
6
- ],
7
- addons: [
8
- '../../../@storybook/addon-a11y',
9
- '../../../@storybook/addon-links',
10
- '../../../@storybook/addon-essentials',
11
- '../../../@storybook/addon-themes',
12
- '../../../@storybook/addon-styling-webpack'
13
- ],
14
- core: {
15
- builder: 'webpack5',
16
- },
17
- framework: {
18
- name: '@storybook/html-webpack5',
19
- options: {},
20
- },
21
- docs: {
22
- autodocs: true,
23
- },
24
- managerHead: (head) => `
25
- ${head}
26
- <style>
27
- :root {
28
- --colors-emulsify-blue-100: #e6f5fc;
29
- --colors-emulsify-blue-200: #CCECFA;
30
- --colors-emulsify-blue-300: #99D9F4;
31
- --colors-emulsify-blue-400: #66c5ef;
32
- --colors-emulsify-blue-500: #33b2e9;
33
- --colors-emulsify-blue-600: #009fe4;
34
- --colors-emulsify-blue-700: #007FB6;
35
- --colors-emulsify-blue-800: #005f89;
36
- --colors-emulsify-blue-900: #00405b;
37
- --colors-emulsify-blue-1000: #00202e;
38
- --colors-purple: #8B1E7E;
39
- }
40
-
41
- .sidebar-container {
42
- background: url('https://raw.githubusercontent.com/fourkitchens/emulsify-core/main/assets/images/corner-bkg.png?token=GHSAT0AAAAAACIEXLVDMX56QK3ZIZWHWHTEZNYFYIA') no-repeat top left;
43
- }
44
-
45
- .sidebar-container .sidebar-subheading {
46
- color: var(--colors-emulsify-blue-200);
47
- font-size: 13px;
48
- letter-spacing: 0.15em;
49
- }
50
-
51
- .sidebar-container .sidebar-subheading button:focus {
52
- color: var(--colors-emulsify-blue-300);
53
- }
54
-
55
- /** Triangle icon **/
56
- .sidebar-container .sidebar-subheading button span {
57
- color: var(--colors-emulsify-blue-300);
58
- }
59
-
60
- .sidebar-container .search-field input {
61
- border-color: var(--colors-emulsify-blue-700);
62
- }
63
-
64
- .sidebar-container .search-field input:active {
65
- border-color: var(--colors-emulsify-blue-700);
66
- }
67
-
68
- .sidebar-container .search-result-recentlyOpened,
69
- .sidebar-container .search-result-back,
70
- .sidebar-container .search-result-clearHistory {
71
- color: var(--colors-emulsify-blue-300) !important;
72
- letter-spacing: 0.15em;
73
- }
74
-
75
- .sidebar-container .search-result-back span,
76
- .sidebar-container .search-result-back svg,
77
- .sidebar-container .search-result-clearHistory span,
78
- .sidebar-container .search-result-clearHistory svg {
79
- letter-spacing: normal;
80
- color: white;
81
- }
82
-
83
- .sidebar-container .sidebar-item svg {
84
- margin-top: 1px;
85
- }
86
-
87
- .sidebar-container .sidebar-item span {
88
- margin-top: 4px;
89
- }
90
-
91
- .sidebar-container .sidebar-subheading-action svg {
92
- color: var(--colors-emulsify-blue-400);
93
- }
94
-
95
- .sidebar-container .sidebar-subheading-action:hover svg {
96
- color: var(--colors-emulsify-blue-300);
97
- }
98
-
99
- .sidebar-header button[title="Shortcuts"] {
100
- box-shadow: none;
101
- border: 1px solid var(--colors-emulsify-blue-700);
102
- }
103
-
104
- .sidebar-header button[title="Shortcuts"]:active {
105
- border: 1px solid var(--colors-emulsify-blue-500);
106
- }
107
-
108
- .sidebar-header button[title="Shortcuts"]:focus {
109
- background: transparent;
110
- }
111
-
112
- #shortcuts {
113
- border-bottom-color: var(--colors-emulsify-blue-900) !important;
114
- }
115
-
116
- [role="main"]:not(:nth-child(3)) {
117
- top: 1rem !important;
118
- height: calc(100vh - 2rem) !important;
119
- }
120
-
121
- [role="main"] .os-host .os-content button:hover {
122
- background: var(--colors-emulsify-blue-100);
123
- }
124
-
125
- [role="main"] .os-host .os-content button:hover svg {
126
- color: var(--colors-emulsify-blue-900);
127
- }
128
-
129
- #panel-tab-content,
130
- #panel-tab-content>* {
131
- color: var(--colors-emulsify-blue-1000) !important;
132
- }
133
-
134
- #panel-tab-content a,
135
- #panel-tab-content a span,
136
- #panel-tab-content a span svg {
137
- color: var(--colors-emulsify-blue-800);
138
- }
139
-
140
- #panel-tab-content>div>div>div>div>div>div {
141
- background: transparent;
142
- }
143
-
144
- #panel-tab-content>div>div>div>div>div>div>div {
145
- color: var(--colors-emulsify-blue-1000) !important;
146
- }
147
- </style>
148
- `,
149
- };
150
-
151
- const config = Object.keys(configOverrides).length ? configOverrides : defaultConfig;
152
-
153
- module.exports = config;
@@ -1,15 +0,0 @@
1
- import { addons } from '@storybook/addons';
2
-
3
- import emulsifyTheme from './emulsifyTheme';
4
-
5
- import('../../../config/emulsify-core/storybook/theme')
6
- .then((customTheme) => {
7
- addons.setConfig({
8
- theme: customTheme.default,
9
- });
10
- })
11
- .catch(() => {
12
- addons.setConfig({
13
- theme: emulsifyTheme,
14
- });
15
- });
@@ -1,15 +0,0 @@
1
- import { addons } from '@storybook/addons';
2
-
3
- import emulsifyTheme from './emulsifyTheme';
4
-
5
- import('../../../../config/emulsify-core/storybook/theme')
6
- .then((customTheme) => {
7
- addons.setConfig({
8
- theme: customTheme.default,
9
- });
10
- })
11
- .catch(() => {
12
- addons.setConfig({
13
- theme: emulsifyTheme,
14
- });
15
- });
@@ -1,40 +0,0 @@
1
- import { useEffect } from '@storybook/client-api';
2
- import Twig from 'twig';
3
- import { setupTwig } from './setupTwig';
4
-
5
- // GLOBAL CSS
6
- (async () => {
7
- let compiled;
8
- try {
9
- compiled = await import('../../../dist/css/style.css');
10
- } catch (e) {}
11
- })();
12
-
13
- // Custom theme preview config if it exists.
14
- (async () => {
15
- let preview;
16
- try {
17
- preview = await import('../../../config/emulsify-core/storybook/preview');
18
- } catch (e) {}
19
- })();
20
-
21
- // If in a Drupal project, it's recommended to import a symlinked version of drupal.js.
22
- import './_drupal.js';
23
-
24
- export const decorators = [
25
- (Story, { args }) => {
26
- const { renderAs } = args || {};
27
-
28
- // Usual emulsify hack to add Drupal behaviors.
29
- useEffect(() => {
30
- Drupal.attachBehaviors();
31
- }, [args]);
32
- return Story();
33
- },
34
- ];
35
-
36
- setupTwig(Twig);
37
-
38
- export const parameters = {
39
- actions: { argTypesRegex: '^on[A-Z].*' },
40
- };
@@ -1,40 +0,0 @@
1
- import { useEffect } from '@storybook/client-api';
2
- import Twig from 'twig';
3
- import { setupTwig } from './setupTwig';
4
-
5
- // GLOBAL CSS
6
- (async () => {
7
- let compiled;
8
- try {
9
- compiled = await import('../../../../dist/css/style.css');
10
- } catch (e) {}
11
- })();
12
-
13
- // Custom theme preview config if it exists.
14
- (async () => {
15
- let preview;
16
- try {
17
- preview = await import('../../../../config/emulsify-core/storybook/preview');
18
- } catch (e) {}
19
- })();
20
-
21
- // If in a Drupal project, it's recommended to import a symlinked version of drupal.js.
22
- import './_drupal.js';
23
-
24
- export const decorators = [
25
- (Story, { args }) => {
26
- const { renderAs } = args || {};
27
-
28
- // Usual emulsify hack to add Drupal behaviors.
29
- useEffect(() => {
30
- Drupal.attachBehaviors();
31
- }, [args]);
32
- return Story();
33
- },
34
- ];
35
-
36
- setupTwig(Twig);
37
-
38
- export const parameters = {
39
- actions: { argTypesRegex: '^on[A-Z].*' },
40
- };
@@ -1,37 +0,0 @@
1
- import { useEffect } from '@storybook/client-api';
2
- import Twig from 'twig';
3
- import { setupTwig } from './setupTwig';
4
-
5
- (async () => {
6
- let compiled;
7
- let preview;
8
- // GLOBAL CSS
9
- try {
10
- compiled = await import('../../../dist/css/style.css');
11
- } catch (e) { }
12
- // Custom theme preview config if it exists.
13
- try {
14
- preview = await import('../../../../config/emulsify-core/storybook/preview');
15
- } catch (e) {}
16
- })();
17
-
18
- // If in a Drupal project, it's recommended to import a symlinked version of drupal.js.
19
- import './_drupal.js';
20
-
21
- export const decorators = [
22
- (Story, { args }) => {
23
- const { renderAs } = args || {};
24
-
25
- // Usual emulsify hack to add Drupal behaviors.
26
- useEffect(() => {
27
- Drupal.attachBehaviors();
28
- }, [args]);
29
- return Story();
30
- },
31
- ];
32
-
33
- setupTwig(Twig);
34
-
35
- export const parameters = {
36
- actions: { argTypesRegex: '^on[A-Z].*' },
37
- };
@@ -1,30 +0,0 @@
1
- import { useEffect } from '@storybook/client-api';
2
- import Twig from 'twig';
3
- import { setupTwig } from './setupTwig';
4
-
5
- // GLOBAL CSS
6
- import('../../../../dist/css/style.css');
7
-
8
- // Custom theme preview config if it exists.
9
- import('../../../../config/emulsify-core/storybook/preview');
10
-
11
- // If in a Drupal project, it's recommended to import a symlinked version of drupal.js.
12
- import './_drupal.js';
13
-
14
- export const decorators = [
15
- (Story, { args }) => {
16
- const { renderAs } = args || {};
17
-
18
- // Usual emulsify hack to add Drupal behaviors.
19
- useEffect(() => {
20
- Drupal.attachBehaviors();
21
- }, [args]);
22
- return Story();
23
- },
24
- ];
25
-
26
- setupTwig(Twig);
27
-
28
- export const parameters = {
29
- actions: { argTypesRegex: '^on[A-Z].*' },
30
- };
@@ -1,33 +0,0 @@
1
- jest.mock('path', () => ({
2
- resolve: (...paths) => `${paths[1]}${paths[2]}`,
3
- }));
4
- jest.mock('twig-drupal-filters', () => jest.fn());
5
- jest.mock('bem-twig-extension', () => jest.fn());
6
- jest.mock('add-attributes-twig-extension', () => jest.fn());
7
-
8
- import Twig from 'twig';
9
- import twigDrupal from 'twig-drupal-filters';
10
- import twigBEM from 'bem-twig-extension';
11
- import twigAddAttributes from 'add-attributes-twig-extension';
12
-
13
- import { namespaces, setupTwig } from './setupTwig';
14
-
15
- describe('setupTwig', () => {
16
- it('sets up a twig object with drupal, bem, and attribute decorations', () => {
17
- expect.assertions(3);
18
- setupTwig(Twig);
19
- expect(twigDrupal).toHaveBeenCalledWith(Twig);
20
- expect(twigBEM).toHaveBeenCalledWith(Twig);
21
- expect(twigAddAttributes).toHaveBeenCalledWith(Twig);
22
- });
23
-
24
- it('exports emulsifys namespaces', () => {
25
- expect(namespaces).toEqual({
26
- base: '../../../components/00-base',
27
- atoms: '../../../components/01-atoms',
28
- molecules: '../../../components/02-molecules',
29
- organisms: '../../../components/03-organisms',
30
- templates: '../../../components/04-templates',
31
- });
32
- });
33
- });