From e4af3666478e296840527b14579052fd2ae04e0c Mon Sep 17 00:00:00 2001
From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com>
Date: Fri, 11 Oct 2024 10:03:22 +0200
Subject: [PATCH] refactor: using invoker command instead of JS glue code
(#989)
---
enterprise.patternlab-config.json | 2 +
package-lock.json | 14 +++++
package.json | 5 +-
source/_meta/_foot.hbs | 1 -
source/_meta/_head.hbs | 1 +
.../_patterns/01-elements/buttons/button.hbs | 4 +-
.../_patterns/02-components/dialog/dialog.hbs | 4 +-
.../_patterns/02-components/dialog/dialog.md | 5 +-
.../02-components/dialog/dialog.script.js | 54 -------------------
.../02-components/dialog/dialog.scss | 5 +-
10 files changed, 31 insertions(+), 64 deletions(-)
delete mode 100644 source/_patterns/02-components/dialog/dialog.script.js
diff --git a/enterprise.patternlab-config.json b/enterprise.patternlab-config.json
index c47d1fed6a..c1c3b13df4 100644
--- a/enterprise.patternlab-config.json
+++ b/enterprise.patternlab-config.json
@@ -57,6 +57,7 @@
"icons": "./node_modules/@db-ui/base/build/assets/icons",
"samples": "./source/samples",
"iframeResizer.contentWindow.js": "node_modules/iframe-resizer/js/iframeResizer.contentWindow.js",
+ "invokers-polyfill.js": "node_modules/invokers-polyfill/invoker.min.js",
"details-element-polyfill.js": "node_modules/details-element-polyfill/dist/details-element-polyfill.js",
"dialog-polyfill.js": "node_modules/dialog-polyfill/dist/dialog-polyfill.js",
"dialog-polyfill.css": "node_modules/dialog-polyfill/dist/dialog-polyfill.css",
@@ -75,6 +76,7 @@
"icons": "out/icons",
"samples": "out/samples",
"iframeResizer.contentWindow.js": "out/js/iframeResizer.contentWindow.js",
+ "invokers-polyfill.js": "out/js/invoker.min.js",
"details-element-polyfill.js": "out/js/details-element-polyfill.js",
"dialog-polyfill.js": "out/js/dialog-polyfill.js",
"dialog-polyfill.css": "out/css/dialog-polyfill.css",
diff --git a/package-lock.json b/package-lock.json
index 74e683537a..5536e61959 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -35,6 +35,7 @@
"html5-boilerplate": "^9.0.1",
"husky": "^9.1.6",
"iframe-resizer": "^4.4.5",
+ "invokers-polyfill": "^0.4.6",
"lint-staged": "^15.2.10",
"markdownlint-cli": "^0.42.0",
"nodemon": "^3.1.7",
@@ -10370,6 +10371,13 @@
"node": ">= 0.10"
}
},
+ "node_modules/invokers-polyfill": {
+ "version": "0.4.6",
+ "resolved": "https://registry.npmjs.org/invokers-polyfill/-/invokers-polyfill-0.4.6.tgz",
+ "integrity": "sha512-+NxCqLu5WSxlq/C0//ubFEO4QCi4gqtMH602eTFNVNq7fzEdzr+iSgiWia8ohr93pTqW33uzv/0JgJQ7fJU7Pg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/ip-address": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
@@ -27370,6 +27378,12 @@
"integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
"dev": true
},
+ "invokers-polyfill": {
+ "version": "0.4.6",
+ "resolved": "https://registry.npmjs.org/invokers-polyfill/-/invokers-polyfill-0.4.6.tgz",
+ "integrity": "sha512-+NxCqLu5WSxlq/C0//ubFEO4QCi4gqtMH602eTFNVNq7fzEdzr+iSgiWia8ohr93pTqW33uzv/0JgJQ7fJU7Pg==",
+ "dev": true
+ },
"ip-address": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
diff --git a/package.json b/package.json
index 72dcdbeef1..c9ed657efb 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "Technical Frontend implementation of the DB UX Design System.",
"style": "./dist/css/enterprise/db-ui-core.css",
"sass": "./sources/css/enterprise/db-ui-core.scss",
- "browser": "./dist/js/main.min.js",
+ "browser": "./dist/js/plugins.min.js",
"bugs": {
"url": "https://github.com/db-ui/core/issues"
},
@@ -36,7 +36,7 @@
"css-build:base": "sass source/css/db-ui-core.vars.scss:dist/css/db-ui-core.vars.css source/css/db-ui-core.general.scss:dist/css/db-ui-core.general.css --style=compressed --embed-sources --load-path=node_modules",
"css-build:pattern-lab-ui": "sass source/css/pattern-scaffolding-project-specific.scss:out/css/pattern-scaffolding-project-specific.css --style=compressed --embed-sources --load-path=node_modules",
"js-deploy": "npm run js-build && cpr source/js dist/js -d",
- "js-build": "babel source/_patterns/**/*.script.js --minified --out-file source/js/main.min.js --source-maps & babel source/**/*.plugin.js --minified --out-file source/js/plugins.min.js --source-maps",
+ "js-build": "babel source/**/*.plugin.js --minified --out-file source/js/plugins.min.js --source-maps",
"js-watch": "npm run js-build -- --watch",
"copy-assets": "cpr node_modules/@db-ui/base/build/assets/icons dist/icons -d && cpr node_modules/@db-ui/base/build/assets/fonts dist/fonts --filter=\"^(.*[/]sources[/]).*$\" -d | cpr source/images dist/images -d | cpr source/favicon.ico dist/favicon.ico -o | cpr source/robots.txt dist/robots.txt -o | cpr source/site.webmanifest dist/site.webmanifest -o",
"copy-scss-sources": "cpr source/_patterns/ sources/_patterns/ --filter=\"^(?!.*[.](scss|sass)$).*$\" -d | cpr source/css/ sources/css/ --filter=\"^(?!.*[.](scss|sass)$).*$\" -d",
@@ -83,6 +83,7 @@
"html5-boilerplate": "^9.0.1",
"husky": "^9.1.6",
"iframe-resizer": "^4.4.5",
+ "invokers-polyfill": "^0.4.6",
"lint-staged": "^15.2.10",
"markdownlint-cli": "^0.42.0",
"nodemon": "^3.1.7",
diff --git a/source/_meta/_foot.hbs b/source/_meta/_foot.hbs
index ba7f5538d8..faa41c70ed 100644
--- a/source/_meta/_foot.hbs
+++ b/source/_meta/_foot.hbs
@@ -6,7 +6,6 @@
-