@emulsify/core 1.3.1 → 1.4.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.
- package/.history/.storybook/main_20240809140306.js +153 -0
- package/.history/{package_20240806082313.json → package_20240809140648.json} +1 -1
- package/.storybook/main.js +5 -4
- package/package.json +1 -1
- package/.history/.github/workflows/addtoprojects_20240130164835.yml +0 -21
- package/.history/.github/workflows/addtoprojects_20240607213528.yml +0 -21
- package/.history/.github/workflows/contributors_20240130164835.yml +0 -23
- package/.history/.github/workflows/contributors_20240607213836.yml +0 -23
- package/.history/.husky/commit-msg_20240729171216 +0 -4
- package/.history/.husky/commit-msg_20240729172358 +0 -2
- package/.history/.husky/pre-commit_20240729171216 +0 -4
- package/.history/.husky/pre-commit_20240729172429 +0 -2
- package/.history/.releaserc_20240607133550 +0 -11
- package/.history/.releaserc_20240607134831 +0 -18
- package/.history/.releaserc_20240607135005 +0 -11
- package/.history/.storybook/manager_20240311205454.js +0 -15
- package/.history/.storybook/manager_20240607162817.js +0 -15
- package/.history/.storybook/preview_20240401184023.js +0 -40
- package/.history/.storybook/preview_20240607162826.js +0 -40
- package/.history/.storybook/preview_20240610083720.js +0 -37
- package/.history/.storybook/preview_20240610083852.js +0 -30
- package/.history/.storybook/setupTwig.test_20240228163244.js +0 -33
- package/.history/.storybook/setupTwig.test_20240607163045.js +0 -33
- package/.history/.storybook/setupTwig_20240326081425.js +0 -59
- package/.history/.storybook/setupTwig_20240607163001.js +0 -43
- package/.history/.storybook/setupTwig_20240607163019.js +0 -43
- package/.history/README_20240312154948.md +0 -72
- package/.history/README_20240607162731.md +0 -94
- package/.history/config/a11y.config_20240607110020.js +0 -61
- package/.history/config/a11y.config_20240607163052.js +0 -61
- package/.history/config/a11y.config_20240607163120.js +0 -61
- package/.history/config/webpack/css/style_20240228152007.js +0 -1
- package/.history/config/webpack/css/style_20240607163238.js +0 -1
- package/.history/config/webpack/css_20240317194751.js +0 -1
- package/.history/config/webpack/css_20240607163108.js +0 -1
- package/.history/config/webpack/css_20240607163132.js +0 -1
- package/.history/config/webpack/loaders_20240730152304.js +0 -87
- package/.history/config/webpack/loaders_20240730152315.js +0 -87
- package/.history/config/webpack/loaders_20240731075844.js +0 -87
- package/.history/config/webpack/loaders_20240806083911.js +0 -88
- package/.history/config/webpack/loaders_20240806084032.js +0 -88
- package/.history/config/webpack/plugins_20240730152746.js +0 -77
- package/.history/config/webpack/plugins_20240730152818.js +0 -76
- package/.history/config/webpack/plugins_20240730153144.js +0 -76
- package/.history/config/webpack/plugins_20240730153215.js +0 -76
- package/.history/config/webpack/plugins_20240731075839.js +0 -48
- package/.history/config/webpack/svgSprite_20240401184053.js +0 -5
- package/.history/config/webpack/svgSprite_20240607163207.js +0 -5
- package/.history/config/webpack/webpack.common_20240730152548.js +0 -74
- package/.history/config/webpack/webpack.common_20240730152652.js +0 -76
- package/.history/config/webpack/webpack.common_20240731075910.js +0 -72
- package/.history/package-lock_20240722091648.json +0 -34023
- package/.history/package-lock_20240729171049.json +0 -34023
- package/.history/package-lock_20240729171107.json +0 -34023
- package/.history/package-lock_20240729171136.json +0 -34023
- package/.history/package_20240722085509.json +0 -135
- package/.history/package_20240722085523.json +0 -135
- package/.history/package_20240722085530.json +0 -135
- package/.history/package_20240722085550.json +0 -135
- package/.history/package_20240722085556.json +0 -135
- package/.history/package_20240722085606.json +0 -135
- package/.history/package_20240722091526.json +0 -135
- package/.history/package_20240722091548.json +0 -135
- package/.history/package_20240729171200.json +0 -135
- package/.history/package_20240729171707.json +0 -135
- package/.history/package_20240729171737.json +0 -135
- package/.history/package_20240729171750.json +0 -135
- package/.history/package_20240729171809.json +0 -135
- package/.history/package_20240729171834.json +0 -135
- package/.history/package_20240729171854.json +0 -135
- package/.history/package_20240729172054.json +0 -135
- package/.history/package_20240729172133.json +0 -135
- package/.history/package_20240729174630.json +0 -135
- package/.history/package_20240730153116.json +0 -136
- package/.history/package_20240806081212.json +0 -135
- package/.history/package_20240806081229.json +0 -135
- package/.history/package_20240806081258.json +0 -135
- package/.history/package_20240806081538.json +0 -135
- package/.history/package_20240806082035.json +0 -135
- package/.history/package_20240806082121.json +0 -135
- package/.history/package_20240806082142.json +0 -135
- package/.history/package_20240806082418.json +0 -135
- /package/.history/.storybook/{main_20240722083211.js → main_20240722090919.js} +0 -0
- /package/.history/{package_20240806083920.json → package_20240806084328.json} +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
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: false,
|
|
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;
|
package/.storybook/main.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const { configOverrides } = require('../../../../config/emulsify-core/storybook/main');
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const safeConfigOverrides = configOverrides || {};
|
|
4
|
+
|
|
5
|
+
const config = {
|
|
4
6
|
stories: [
|
|
5
7
|
'../../../../components/**/*.stories.@(js|jsx|ts|tsx)',
|
|
6
8
|
],
|
|
@@ -19,7 +21,7 @@ const defaultConfig = {
|
|
|
19
21
|
options: {},
|
|
20
22
|
},
|
|
21
23
|
docs: {
|
|
22
|
-
autodocs:
|
|
24
|
+
autodocs: false,
|
|
23
25
|
},
|
|
24
26
|
managerHead: (head) => `
|
|
25
27
|
${head}
|
|
@@ -146,8 +148,7 @@ const defaultConfig = {
|
|
|
146
148
|
}
|
|
147
149
|
</style>
|
|
148
150
|
`,
|
|
151
|
+
...safeConfigOverrides,
|
|
149
152
|
};
|
|
150
153
|
|
|
151
|
-
const config = Object.keys(configOverrides).length ? configOverrides : defaultConfig;
|
|
152
|
-
|
|
153
154
|
module.exports = config;
|
package/package.json
CHANGED
|
@@ -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,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,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
|
-
});
|
|
@@ -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
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
const { resolve } = require('path');
|
|
2
|
-
const twigDrupal = require('twig-drupal-filters');
|
|
3
|
-
const twigBEM = require('bem-twig-extension');
|
|
4
|
-
const twigAddAttributes = require('add-attributes-twig-extension');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Fetches project-based variant configuration. If no such configuration
|
|
8
|
-
* exists, returns default values.
|
|
9
|
-
*
|
|
10
|
-
* @returns project-based variant configuration, or default config.
|
|
11
|
-
*/
|
|
12
|
-
const fetchVariantConfig = () => {
|
|
13
|
-
try {
|
|
14
|
-
return require('../../../project.emulsify.json').variant.structureImplementations;
|
|
15
|
-
} catch (e) {
|
|
16
|
-
return [
|
|
17
|
-
{
|
|
18
|
-
name: 'base',
|
|
19
|
-
directory: '../../components/00-base',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: 'atoms',
|
|
23
|
-
directory: '../../components/01-atoms',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: 'molecules',
|
|
27
|
-
directory: '../../components/02-molecules',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'organisms',
|
|
31
|
-
directory: '../../components/03-organisms',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'templates',
|
|
35
|
-
directory: '../../components/04-templates',
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
module.exports.namespaces = {};
|
|
42
|
-
for (const { name, directory } of fetchVariantConfig()) {
|
|
43
|
-
module.exports.namespaces[name] = resolve(__dirname, '../../../', directory);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Configures and extends a standard twig object.
|
|
48
|
-
*
|
|
49
|
-
* @param {Twig} twig - twig object that should be configured and extended.
|
|
50
|
-
*
|
|
51
|
-
* @returns {Twig} configured twig object.
|
|
52
|
-
*/
|
|
53
|
-
module.exports.setupTwig = function setupTwig(twig) {
|
|
54
|
-
twig.cache();
|
|
55
|
-
twigDrupal(twig);
|
|
56
|
-
twigBEM(twig);
|
|
57
|
-
twigAddAttributes(twig);
|
|
58
|
-
return twig;
|
|
59
|
-
};
|