@madgex/design-system 12.0.2 → 13.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.
- package/README.md +44 -1
- package/dist/css/index.css +1 -1
- package/dist/js/components/mds-dropdown-nav.js +1 -1
- package/dist/js/dropdown-nav-DsMcgeGj.js +1 -0
- package/dist/js/index-fractal.js +1 -1
- package/dist/js/index.js +1 -2
- package/package.json +11 -45
- package/src/components/dropdown-nav/dropdown-nav-entry.js +7 -0
- package/src/components/dropdown-nav/dropdown-nav.js +0 -4
- package/src/components/modal/modal.js +1 -1
- package/src/components/tabs/tabs.js +1 -1
- package/src/js/index.js +5 -11
- package/dist/js/index.js.LICENSE.txt +0 -6
- package/src/js/index-polyfills.js +0 -6
- package/src/js/polyfills/arrayPrototypeFind.js +0 -49
- package/src/js/polyfills/closest.js +0 -17
- package/src/js/polyfills/objectAssign.js +0 -33
- package/src/js/polyfills/remove.js +0 -7
- package/src/js/webpack-public-path.js +0 -3
- package/tasks/css.js +0 -90
- package/tasks/js-bundle.js +0 -50
- package/tasks/js-fractal-bundle.js +0 -49
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ if you want to use the default styling set in the design system, you can use the
|
|
|
22
22
|
|
|
23
23
|
## Working with [hapi.js](https://hapijs.com/), [vision](https://github.com/hapijs/vision) and [Nunjucks](https://mozilla.github.io/nunjucks/)
|
|
24
24
|
|
|
25
|
+
### Nunjucks
|
|
26
|
+
|
|
25
27
|
If you're wanting to use the Madgex DS components from a hapi.js+vision+Nunjucks setup you'll need to include the Madgex DS in the Nunjucks pathing:
|
|
26
28
|
|
|
27
29
|
```js
|
|
@@ -72,6 +74,47 @@ Then you should be able to use components as such:
|
|
|
72
74
|
|
|
73
75
|
Note you'll need the CSS for the component styles.
|
|
74
76
|
|
|
77
|
+
### Serving Design System assets - Hapi
|
|
78
|
+
|
|
79
|
+
We want to serve the whole `dist` folder of the design system package, rather than just singular files. This will enable relative ESM imports which `index.js` does, where it will try to include additional js files relative to itself.
|
|
80
|
+
|
|
81
|
+
Be sure to pevent URL attacks by confining to this dist directory. Inert `directory` handler does this by default.
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
const mdsDistFolderPath = path.join(
|
|
85
|
+
path.dirname(fileURLToPath(import.meta.resolve('@madgex/design-system/package.json'))),
|
|
86
|
+
'dist',
|
|
87
|
+
);
|
|
88
|
+
export default [
|
|
89
|
+
{
|
|
90
|
+
path: `/_/jobseekers-frontend/public/design-system/{path*}`,
|
|
91
|
+
handler: {
|
|
92
|
+
directory: {
|
|
93
|
+
// using `directory` should mean we are using inert's 'confine' automatically, to prevent URL attacks e.g. `/_/jobseekers-frontend/public/design-system/..%2F..%2F..%2F..%2F/package.json`
|
|
94
|
+
path: [mdsDistFolderPath],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
options: {
|
|
98
|
+
id: 'public.assets.design-system',
|
|
99
|
+
description: 'public assets route design system, allows relative ESM imports against whole MDS dist folder',
|
|
100
|
+
validate: {
|
|
101
|
+
params: {
|
|
102
|
+
path: Joi.string().max(200).required(),
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
consuming the `index.js` file is all that is needed, relative ESM imports will automatically happen.
|
|
111
|
+
|
|
112
|
+
```twig
|
|
113
|
+
<link rel="stylesheet" href="{{- getRoute('public.assets.design-system', { path: 'css/index.css' }, { v: designSystemVersion }) -}}">
|
|
114
|
+
<script type="module" src="{{- getRoute('public.assets.design-system', { path: 'js/index.js' }, { v: designSystemVersion }) -}}"></script>
|
|
115
|
+
{# index.js also import `./components/mds-dropdown-nav.js` etc, which is why we serve the whole `dist` folder on `public.assets.design-system` route #}
|
|
116
|
+
```
|
|
117
|
+
|
|
75
118
|
## Releases
|
|
76
119
|
|
|
77
120
|
With every commit to `master` the build server attempts to create a new version using [semantic-release](https://semantic-release.gitbook.io/semantic-release/) and deploys to [npm](https://npmjs.org) as [@madgex/design-system](https://www.npmjs.com/package/@madgex/design-system).
|
|
@@ -140,7 +183,7 @@ await cleanTempFiles();
|
|
|
140
183
|
|
|
141
184
|
### Web Components
|
|
142
185
|
|
|
143
|
-
Web components are
|
|
186
|
+
Web components are included via the main JS bundle, using ESM relative imports.
|
|
144
187
|
|
|
145
188
|
Seperate web component files are also available in `@madgex/design-system/dist/components/{component-name}.js`. e.g. `@madgex/design-system/dist/components/mds-dropdown-nav.js`.
|
|
146
189
|
|