@schukai/monster 4.37.1 → 4.38.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
- parseBracketedKeyValueHash,
3
- createBracketedKeyValueHash,
2
+ parseBracketedKeyValueHash,
3
+ createBracketedKeyValueHash,
4
4
  } from "../../../text/bracketed-key-value-hash.mjs";
5
5
 
6
6
  /**
@@ -13,154 +13,160 @@ import {
13
13
  * @param {string} allTabsKey - Key for all tab IDs (default: "all")
14
14
  */
15
15
  export function attachTabsHashSync(
16
- tabsEl,
17
- selector = "tabs",
18
- activeKey = "active",
19
- allTabsKey = "all",
16
+ tabsEl,
17
+ selector = "tabs",
18
+ activeKey = "active",
19
+ allTabsKey = "all",
20
20
  ) {
21
- if (!(tabsEl instanceof HTMLElement)) {
22
- throw new TypeError("Expected a monster-tabs HTMLElement");
23
- }
24
-
25
- let lastKnownActiveTabId = null;
26
- let lastKnownAllTabIds = [];
27
-
28
- /**
29
- * Reads active and all tab IDs from the URL hash.
30
- * @returns {{activeTabId: string|null, allTabIds: string[]}}
31
- */
32
- function getTabStateFromHash() {
33
- const hashObj = parseBracketedKeyValueHash(location.hash);
34
- const tabsData = hashObj?.[selector] ?? {};
35
- const activeTabId = tabsData[activeKey] ?? null;
36
- const allTabIdsString = tabsData[allTabsKey] ?? "";
37
- const allTabIds = allTabIdsString
38
- .split(",")
39
- .filter((id) => id.trim() !== "");
40
- return { activeTabId, allTabIds };
41
- }
42
-
43
- /**
44
- * Synchronizes tab state from hash on page load and hash changes.
45
- */
46
- function syncFromHash() {
47
- const { activeTabId, allTabIds } = getTabStateFromHash();
48
-
49
- // Sync active tab
50
- if (activeTabId && activeTabId !== lastKnownActiveTabId) {
51
- tabsEl.activeTab(activeTabId);
52
- lastKnownActiveTabId = activeTabId;
53
- }
54
-
55
- // Sync all tabs (add/remove tabs based on hash)
56
- const currentTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
57
-
58
- // Add tabs that are in hash but not in DOM
59
- for (const tabId of allTabIds) {
60
- if (!currentTabs.includes(tabId)) {
61
- // You'll need a way to get the label and content for new tabs
62
- // This is a placeholder. You might fetch it or have a default.
63
- // For existing tabs in the HTML, we're just ensuring they are present.
64
- // For truly new tabs from the hash, you'd need their content/label.
65
- // For this example, we'll assume the initial HTML already has all potential tabs,
66
- // and we're just making sure they are displayed if their IDs are in the hash.
67
- // If you truly want to create new tabs from scratch based on the hash,
68
- // you'd need more information in the hash or a lookup mechanism.
69
- console.warn(
70
- `Tab with ID '${tabId}' found in hash but not in DOM. Add logic to create it if necessary.`,
71
- );
72
- }
73
- }
74
-
75
- // Remove tabs that are in DOM but not in hash
76
- for (const tabId of currentTabs) {
77
- if (!allTabIds.includes(tabId)) {
78
- tabsEl.removeTab(tabId);
79
- }
80
- }
81
-
82
- lastKnownAllTabIds = allTabIds;
83
- }
84
-
85
- window.addEventListener("hashchange", syncFromHash);
86
- syncFromHash(); // initial load
87
-
88
- /**
89
- * Writes the current active tab and all tab IDs to the URL hash.
90
- * @param {string|null} activeTabId - The ID of the currently active tab.
91
- * @param {string[]} allTabIds - An array of all current tab IDs.
92
- */
93
- function writeHash(activeTabId, allTabIds) {
94
- const hashObj = parseBracketedKeyValueHash(location.hash);
95
- hashObj[selector] = { ...(hashObj[selector] ?? {}) };
96
-
97
- if (activeTabId) {
98
- hashObj[selector][activeKey] = activeTabId;
99
- } else {
100
- delete hashObj[selector][activeKey];
101
- }
102
-
103
- if (allTabIds.length > 0) {
104
- hashObj[selector][allTabsKey] = allTabIds.join(",");
105
- } else {
106
- delete hashObj[selector][allTabsKey];
107
- }
108
-
109
- const newHash = createBracketedKeyValueHash(hashObj);
110
- if (location.hash !== newHash) {
111
- history.replaceState(null, "", newHash);
112
- }
113
- lastKnownActiveTabId = activeTabId;
114
- lastKnownAllTabIds = allTabIds;
115
- }
116
-
117
- // Listen for tab changes (active tab)
118
- tabsEl.addEventListener("monster-tab-changed", (e) => {
119
- if (e.target !== tabsEl) return; // Ignore bubbled events
120
- const newActiveTabId = e.detail?.reference;
121
- const currentTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
122
- writeHash(newActiveTabId, currentTabs);
123
- });
124
-
125
- // Listen for tab additions
126
- const observer = new MutationObserver((mutationsList) => {
127
- let tabsChanged = false;
128
- for (const mutation of mutationsList) {
129
- if (
130
- mutation.type === "childList" &&
131
- (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0)
132
- ) {
133
- // Filter for actual tab elements
134
- const hasTabNodes = Array.from(mutation.addedNodes).some(
135
- (node) => node.nodeType === 1 && node.hasAttribute("data-monster-button-label")
136
- ) || Array.from(mutation.removedNodes).some(
137
- (node) => node.nodeType === 1 && node.hasAttribute("data-monster-button-label")
138
- );
139
-
140
- if (hasTabNodes) {
141
- tabsChanged = true;
142
- break;
143
- }
144
- }
145
- }
146
- if (tabsChanged) {
147
- const currentActiveTabId = tabsEl.getActiveTab();
148
- const currentTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
149
- // Only update hash if the list of tabs has actually changed
150
- if (
151
- currentTabs.length !== lastKnownAllTabIds.length ||
152
- !currentTabs.every((id) => lastKnownAllTabIds.includes(id))
153
- ) {
154
- writeHash(currentActiveTabId, currentTabs);
155
- }
156
- }
157
- });
158
-
159
- // Observe the tabsEl for direct child additions/removals
160
- observer.observe(tabsEl, { childList: true });
161
-
162
- // Initial write of all existing tabs to the hash
163
- const initialActiveTab = tabsEl.getActiveTab();
164
- const initialTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
165
- writeHash(initialActiveTab, initialTabs);
166
- }
21
+ if (!(tabsEl instanceof HTMLElement)) {
22
+ throw new TypeError("Expected a monster-tabs HTMLElement");
23
+ }
24
+
25
+ let lastKnownActiveTabId = null;
26
+ let lastKnownAllTabIds = [];
27
+
28
+ /**
29
+ * Reads active and all tab IDs from the URL hash.
30
+ * @returns {{activeTabId: string|null, allTabIds: string[]}}
31
+ */
32
+ function getTabStateFromHash() {
33
+ const hashObj = parseBracketedKeyValueHash(location.hash);
34
+ const tabsData = hashObj?.[selector] ?? {};
35
+ const activeTabId = tabsData[activeKey] ?? null;
36
+ const allTabIdsString = tabsData[allTabsKey] ?? "";
37
+ const allTabIds = allTabIdsString
38
+ .split(",")
39
+ .filter((id) => id.trim() !== "");
40
+ return { activeTabId, allTabIds };
41
+ }
42
+
43
+ /**
44
+ * Synchronizes tab state from hash on page load and hash changes.
45
+ */
46
+ function syncFromHash() {
47
+ const { activeTabId, allTabIds } = getTabStateFromHash();
48
+
49
+ // Sync active tab
50
+ if (activeTabId && activeTabId !== lastKnownActiveTabId) {
51
+ tabsEl.activeTab(activeTabId);
52
+ lastKnownActiveTabId = activeTabId;
53
+ }
54
+
55
+ // Sync all tabs (add/remove tabs based on hash)
56
+ const currentTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
57
+
58
+ // Add tabs that are in hash but not in DOM
59
+ for (const tabId of allTabIds) {
60
+ if (!currentTabs.includes(tabId)) {
61
+ // You'll need a way to get the label and content for new tabs
62
+ // This is a placeholder. You might fetch it or have a default.
63
+ // For existing tabs in the HTML, we're just ensuring they are present.
64
+ // For truly new tabs from the hash, you'd need their content/label.
65
+ // For this example, we'll assume the initial HTML already has all potential tabs,
66
+ // and we're just making sure they are displayed if their IDs are in the hash.
67
+ // If you truly want to create new tabs from scratch based on the hash,
68
+ // you'd need more information in the hash or a lookup mechanism.
69
+ console.warn(
70
+ `Tab with ID '${tabId}' found in hash but not in DOM. Add logic to create it if necessary.`,
71
+ );
72
+ }
73
+ }
74
+
75
+ // Remove tabs that are in DOM but not in hash
76
+ for (const tabId of currentTabs) {
77
+ if (!allTabIds.includes(tabId)) {
78
+ tabsEl.removeTab(tabId);
79
+ }
80
+ }
81
+
82
+ lastKnownAllTabIds = allTabIds;
83
+ }
84
+
85
+ window.addEventListener("hashchange", syncFromHash);
86
+ syncFromHash(); // initial load
87
+
88
+ /**
89
+ * Writes the current active tab and all tab IDs to the URL hash.
90
+ * @param {string|null} activeTabId - The ID of the currently active tab.
91
+ * @param {string[]} allTabIds - An array of all current tab IDs.
92
+ */
93
+ function writeHash(activeTabId, allTabIds) {
94
+ const hashObj = parseBracketedKeyValueHash(location.hash);
95
+ hashObj[selector] = { ...(hashObj[selector] ?? {}) };
96
+
97
+ if (activeTabId) {
98
+ hashObj[selector][activeKey] = activeTabId;
99
+ } else {
100
+ delete hashObj[selector][activeKey];
101
+ }
102
+
103
+ if (allTabIds.length > 0) {
104
+ hashObj[selector][allTabsKey] = allTabIds.join(",");
105
+ } else {
106
+ delete hashObj[selector][allTabsKey];
107
+ }
108
+
109
+ const newHash = createBracketedKeyValueHash(hashObj);
110
+ if (location.hash !== newHash) {
111
+ history.replaceState(null, "", newHash);
112
+ }
113
+ lastKnownActiveTabId = activeTabId;
114
+ lastKnownAllTabIds = allTabIds;
115
+ }
116
+
117
+ // Listen for tab changes (active tab)
118
+ tabsEl.addEventListener("monster-tab-changed", (e) => {
119
+ if (e.target !== tabsEl) return; // Ignore bubbled events
120
+ const newActiveTabId = e.detail?.reference;
121
+ const currentTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
122
+ writeHash(newActiveTabId, currentTabs);
123
+ });
124
+
125
+ // Listen for tab additions
126
+ const observer = new MutationObserver((mutationsList) => {
127
+ let tabsChanged = false;
128
+ for (const mutation of mutationsList) {
129
+ if (
130
+ mutation.type === "childList" &&
131
+ (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0)
132
+ ) {
133
+ // Filter for actual tab elements
134
+ const hasTabNodes =
135
+ Array.from(mutation.addedNodes).some(
136
+ (node) =>
137
+ node.nodeType === 1 &&
138
+ node.hasAttribute("data-monster-button-label"),
139
+ ) ||
140
+ Array.from(mutation.removedNodes).some(
141
+ (node) =>
142
+ node.nodeType === 1 &&
143
+ node.hasAttribute("data-monster-button-label"),
144
+ );
145
+
146
+ if (hasTabNodes) {
147
+ tabsChanged = true;
148
+ break;
149
+ }
150
+ }
151
+ }
152
+ if (tabsChanged) {
153
+ const currentActiveTabId = tabsEl.getActiveTab();
154
+ const currentTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
155
+ // Only update hash if the list of tabs has actually changed
156
+ if (
157
+ currentTabs.length !== lastKnownAllTabIds.length ||
158
+ !currentTabs.every((id) => lastKnownAllTabIds.includes(id))
159
+ ) {
160
+ writeHash(currentActiveTabId, currentTabs);
161
+ }
162
+ }
163
+ });
164
+
165
+ // Observe the tabsEl for direct child additions/removals
166
+ observer.observe(tabsEl, { childList: true });
167
+
168
+ // Initial write of all existing tabs to the hash
169
+ const initialActiveTab = tabsEl.getActiveTab();
170
+ const initialTabs = tabsEl.getTabs().map((tab) => tab.getAttribute("id"));
171
+ writeHash(initialActiveTab, initialTabs);
172
+ }
@@ -10,10 +10,10 @@
10
10
  * For more information about purchasing a commercial license, please contact schukai GmbH.
11
11
  */
12
12
 
13
- import {addAttributeToken} from "../../../dom/attributes.mjs";
14
- import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
13
+ import { addAttributeToken } from "../../../dom/attributes.mjs";
14
+ import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";
15
15
 
16
- export {MessageStyleSheet}
16
+ export { MessageStyleSheet };
17
17
 
18
18
  /**
19
19
  * @private
@@ -22,10 +22,17 @@ export {MessageStyleSheet}
22
22
  const MessageStyleSheet = new CSSStyleSheet();
23
23
 
24
24
  try {
25
- MessageStyleSheet.insertRule(`
25
+ MessageStyleSheet.insertRule(
26
+ `
26
27
  @layer message {
27
28
  :where(html){line-height:1.15;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%}:where(h1){font-size:2em;margin-block-end:.67em;margin-block-start:.67em}:where(dl,ol,ul) :where(dl,ol,ul){margin-block-end:0;margin-block-start:0}:where(hr){box-sizing:content-box;color:inherit;height:0}:where(abbr[title]){text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}:where(b,strong){font-weight:bolder}:where(code,kbd,pre,samp){font-family:monospace,monospace;font-size:1em}:where(small){font-size:80%}:where(table){border-color:currentColor;text-indent:0}:where(button,input,select){margin:0}:where(button){text-transform:none}:where(button,input:is([type=button i],[type=reset i],[type=submit i])){-webkit-appearance:button}:where(progress){vertical-align:baseline}:where(select){text-transform:none}:where(textarea){margin:0}:where(input[type=search i]){-webkit-appearance:textfield;outline-offset:-2px}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}:where(button,input:is([type=button i],[type=color i],[type=reset i],[type=submit i]))::-moz-focus-inner{border-style:none;padding:0}:where(button,input:is([type=button i],[type=color i],[type=reset i],[type=submit i]))::-moz-focusring{outline:1px dotted ButtonText}:where(:-moz-ui-invalid){box-shadow:none}:where(dialog){background-color:#fff;border:solid;color:#000;height:-moz-fit-content;height:fit-content;left:0;margin:auto;padding:1em;position:absolute;right:0;width:-moz-fit-content;width:fit-content}:where(dialog:not([open])){display:none}:where(summary){display:list-item}html{height:100%}body,html{min-height:calc(100vh - 40px)}body{box-sizing:border-box;margin:0;padding:0;word-break:break-word}body:focus-visible{outline:none}:focus-visible{outline:none}.block{display:block}.inline{display:inline}.inline-block{display:inline-block}.grid{display:grid}.inline-grid{display:inline-grid}.flex{display:flex}.inline-flex{display:inline-flex}.hidden,.hide,.none{display:none}.visible{visibility:visible}.invisible{visibility:hidden}.monster-border-primary-1,.monster-border-primary-2,.monster-border-primary-3,.monster-border-primary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width)}.monster-border-0{border-radius:0;border-style:none;border-width:0}.monster-border-primary-1{border-color:var(--monster-bg-color-primary-1)}.monster-border-primary-2{border-color:var(--monster-bg-color-primary-2)}.monster-border-primary-3{border-color:var(--monster-bg-color-primary-3)}.monster-border-primary-4{border-color:var(--monster-bg-color-primary-4)}.monster-border-secondary-1,.monster-border-secondary-2,.monster-border-secondary-3,.monster-border-secondary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width)}.monster-border-secondary-1{border-color:var(--monster-bg-color-secondary-1)}.monster-border-secondary-2{border-color:var(--monster-bg-color-secondary-2)}.monster-border-secondary-3{border-color:var(--monster-bg-color-secondary-3)}.monster-border-secondary-4{border-color:var(--monster-bg-color-secondary-4)}.monster-border-tertiary-1,.monster-border-tertiary-2,.monster-border-tertiary-3,.monster-border-tertiary-4{border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width)}.monster-border-tertiary-1{border-color:var(--monster-bg-color-tertiary-1)}.monster-border-tertiary-2{border-color:var(--monster-bg-color-tertiary-2)}.monster-border-tertiary-3{border-color:var(--monster-bg-color-tertiary-3)}.monster-border-tertiary-4{border-color:var(--monster-bg-color-tertiary-4)}:after,:before,:root{--monster-color-gray-1:#f6f6f6;--monster-color-gray-2:#e2e2e2;--monster-color-gray-3:#8b8b8b;--monster-color-gray-4:#6f6f6f;--monster-color-gray-5:#3e3e3e;--monster-color-gray-6:#222;--monster-color-rose-1:#fff7f9;--monster-color-rose-2:#ffdce5;--monster-color-rose-3:#ff3b8d;--monster-color-rose-4:#db0072;--monster-color-rose-5:#800040;--monster-color-rose-6:#4c0023;--monster-color-raspberry-1:#fff8f8;--monster-color-raspberry-2:#ffdddf;--monster-color-raspberry-3:#ff426c;--monster-color-raspberry-4:#de0051;--monster-color-raspberry-5:#82002c;--monster-color-raspberry-6:#510018;--monster-color-red-1:#fff8f6;--monster-color-red-2:#ffddd8;--monster-color-red-3:#ff4647;--monster-color-red-4:#e0002b;--monster-color-red-5:#830014;--monster-color-red-6:#530003;--monster-color-orange-1:#fff8f5;--monster-color-orange-2:#ffded1;--monster-color-orange-3:#fd4d00;--monster-color-orange-4:#cd3c00;--monster-color-orange-5:#752100;--monster-color-orange-6:#401600;--monster-color-cinnamon-1:#fff8f3;--monster-color-cinnamon-2:#ffdfc6;--monster-color-cinnamon-3:#d57300;--monster-color-cinnamon-4:#ac5c00;--monster-color-cinnamon-5:#633300;--monster-color-cinnamon-6:#371d00;--monster-color-amber-1:#fff8ef;--monster-color-amber-2:#ffe0b2;--monster-color-amber-3:#b98300;--monster-color-amber-4:#926700;--monster-color-amber-5:#523800;--monster-color-amber-6:#302100;--monster-color-yellow-1:#fff9e5;--monster-color-yellow-2:#ffe53e;--monster-color-yellow-3:#9c8b00;--monster-color-yellow-4:#7d6f00;--monster-color-yellow-5:#463d00;--monster-color-yellow-6:#292300;--monster-color-lime-1:#f7ffac;--monster-color-lime-2:#d5f200;--monster-color-lime-3:#819300;--monster-color-lime-4:#677600;--monster-color-lime-5:#394100;--monster-color-lime-6:#222600;--monster-color-chartreuse-1:#e5ffc3;--monster-color-chartreuse-2:#98fb00;--monster-color-chartreuse-3:#5c9b00;--monster-color-chartreuse-4:#497c00;--monster-color-chartreuse-5:#264500;--monster-color-chartreuse-6:#182600;--monster-color-green-1:#e0ffd9;--monster-color-green-2:#72ff6c;--monster-color-green-3:#00a21f;--monster-color-green-4:#008217;--monster-color-green-5:#004908;--monster-color-green-6:#062800;--monster-color-emerald-1:#dcffe6;--monster-color-emerald-2:#5dffa2;--monster-color-emerald-3:#00a05a;--monster-color-emerald-4:#008147;--monster-color-emerald-5:#004825;--monster-color-emerald-6:#002812;--monster-color-aquamarine-1:#daffef;--monster-color-aquamarine-2:#42ffc6;--monster-color-aquamarine-3:#009f78;--monster-color-aquamarine-4:#007f5f;--monster-color-aquamarine-5:#004734;--monster-color-aquamarine-6:#00281b;--monster-color-teal-1:#d7fff7;--monster-color-teal-2:#00ffe4;--monster-color-teal-3:#009e8c;--monster-color-teal-4:#007c6e;--monster-color-teal-5:#00443c;--monster-color-teal-6:#002722;--monster-color-cyan-1:#c4fffe;--monster-color-cyan-2:#00fafb;--monster-color-cyan-3:#00999a;--monster-color-cyan-4:#007a7b;--monster-color-cyan-5:#004344;--monster-color-cyan-6:#002525;--monster-color-powder-1:#dafaff;--monster-color-powder-2:#8df0ff;--monster-color-powder-3:#0098a9;--monster-color-powder-4:#007987;--monster-color-powder-5:#004048;--monster-color-powder-6:#002227;--monster-color-sky-1:#e3f7ff;--monster-color-sky-2:#aee9ff;--monster-color-sky-3:#0094b4;--monster-color-sky-4:#007590;--monster-color-sky-5:#00404f;--monster-color-sky-6:#001f28;--monster-color-cerulean-1:#e8f6ff;--monster-color-cerulean-2:#b9e3ff;--monster-color-cerulean-3:#0092c5;--monster-color-cerulean-4:#00749d;--monster-color-cerulean-5:#003c54;--monster-color-cerulean-6:#001d2a;--monster-color-azure-1:#e8f2ff;--monster-color-azure-2:#c6e0ff;--monster-color-azure-3:#008fdb;--monster-color-azure-4:#0071af;--monster-color-azure-5:#003b5e;--monster-color-azure-6:#001c30;--monster-color-blue-1:#f0f4ff;--monster-color-blue-2:#d4e0ff;--monster-color-blue-3:#0089fc;--monster-color-blue-4:#006dca;--monster-color-blue-5:#00386d;--monster-color-blue-6:#001a39;--monster-color-indigo-1:#f3f3ff;--monster-color-indigo-2:#deddff;--monster-color-indigo-3:#657eff;--monster-color-indigo-4:#0061fc;--monster-color-indigo-5:#00328a;--monster-color-indigo-6:#001649;--monster-color-violet-1:#f7f1ff;--monster-color-violet-2:#e8daff;--monster-color-violet-3:#9b70ff;--monster-color-violet-4:#794aff;--monster-color-violet-5:#2d0fbf;--monster-color-violet-6:#0b0074;--monster-color-purple-1:#fdf4ff;--monster-color-purple-2:#f7d9ff;--monster-color-purple-3:#d150ff;--monster-color-purple-4:#b01fe3;--monster-color-purple-5:#660087;--monster-color-purple-6:#3a004f;--monster-color-magenta-1:#fff3fc;--monster-color-magenta-2:#ffd7f6;--monster-color-magenta-3:#f911e0;--monster-color-magenta-4:#ca00b6;--monster-color-magenta-5:#740068;--monster-color-magenta-6:#44003c;--monster-color-pink-1:#fff7fb;--monster-color-pink-2:#ffdcec;--monster-color-pink-3:#ff2fb2;--monster-color-pink-4:#d2008f;--monster-color-pink-5:#790051;--monster-color-pink-6:#4b0030;--monster-gradient-tangerine-1:#e5b875;--monster-gradient-tangerine-2:#d9a362;--monster-gradient-tangerine-3:#c08a4e;--monster-gradient-tangerine-4:#a7713b;--monster-gradient-tangerine-5:#8f5a28;--monster-gradient-tangerine-6:#360505;--monster-color-seashell-1:#f7f5ef;--monster-color-seashell-2:#e5e2d9;--monster-color-seashell-3:#cbc6b3;--monster-color-seashell-4:#a19d8a;--monster-color-seashell-5:#7a7566;--monster-color-seashell-6:#514d3f}.monster-theme-primary-1{background-color:var(--monster-bg-color-primary-1);color:var(--monster-color-primary-1)}.monster-theme-primary-disabled-1{background-color:var(--monster-bg-color-primary-disabled-1);color:var(--monster-color-primary-disabled-1)}.monster-theme-secondary-1{background-color:var(--monster-bg-color-secondary-1);color:var(--monster-color-secondary-1)}.monster-theme-tertiary-1{background-color:var(--monster-bg-color-tertiary-1);color:var(--monster-color-tertiary-1)}.monster-theme-destructive-1{background-color:var(--monster-bg-color-destructive-1);color:var(--monster-color-destructive-1)}.monster-theme-success-1{background-color:var(--monster-bg-color-success-1);color:var(--monster-color-success-1)}.monster-theme-warning-1{background-color:var(--monster-bg-color-warning-1);color:var(--monster-color-warning-1)}.monster-theme-error-1{background-color:var(--monster-bg-color-error-1);color:var(--monster-color-error-1)}.monster-theme-selection-1{background-color:var(--monster-bg-color-selection-1);color:var(--monster-color-selection-1)}.monster-border-color-1{border-color:var(--monster-color-border-1)}.monster-color-neutral-1{color:var(--monster-color-primary-1)}.monster-bg-color-primary-1{background-color:var(--monster-bg-color-primary-1)}.monster-bg-color-secondary-1{background-color:var(--monster-bg-color-secondary-1)}.monster-bg-color-tertiary-1{background-color:var(--monster-bg-color-tertiary-1)}.monster-color-primary-1{background-color:var(--monster-bg-color-primary-1);color:var(--monster-color-primary-1)}.monster-color-secondary-1{background-color:var(--monster-bg-color-secondary-1);color:var(--monster-color-secondary-1)}.monster-color-tertiary-1{background-color:var(--monster-bg-color-tertiary-1);color:var(--monster-color-tertiary-1)}.monster-color-destructive-1{background-color:var(--monster-bg-color-destructive-1);color:var(--monster-color-destructive-1)}.monster-color-success-1{background-color:var(--monster-bg-color-success-1);color:var(--monster-color-success-1)}.monster-color-warning-1{background-color:var(--monster-bg-color-warning-1);color:var(--monster-color-warning-1)}.monster-color-error-1{background-color:var(--monster-bg-color-error-1);color:var(--monster-color-error-1)}.monster-color-selection-1{background-color:var(--monster-bg-color-selection-1);color:var(--monster-color-selection-1)}.monster-theme-primary-2{background-color:var(--monster-bg-color-primary-2);color:var(--monster-color-primary-2)}.monster-theme-primary-disabled-2{background-color:var(--monster-bg-color-primary-disabled-2);color:var(--monster-color-primary-disabled-2)}.monster-theme-secondary-2{background-color:var(--monster-bg-color-secondary-2);color:var(--monster-color-secondary-2)}.monster-theme-tertiary-2{background-color:var(--monster-bg-color-tertiary-2);color:var(--monster-color-tertiary-2)}.monster-theme-destructive-2{background-color:var(--monster-bg-color-destructive-2);color:var(--monster-color-destructive-2)}.monster-theme-success-2{background-color:var(--monster-bg-color-success-2);color:var(--monster-color-success-2)}.monster-theme-warning-2{background-color:var(--monster-bg-color-warning-2);color:var(--monster-color-warning-2)}.monster-theme-error-2{background-color:var(--monster-bg-color-error-2);color:var(--monster-color-error-2)}.monster-theme-selection-2{background-color:var(--monster-bg-color-selection-2);color:var(--monster-color-selection-2)}.monster-border-color-2{border-color:var(--monster-color-border-2)}.monster-color-neutral-2{color:var(--monster-color-primary-2)}.monster-bg-color-primary-2{background-color:var(--monster-bg-color-primary-2)}.monster-bg-color-secondary-2{background-color:var(--monster-bg-color-secondary-2)}.monster-bg-color-tertiary-2{background-color:var(--monster-bg-color-tertiary-2)}.monster-color-primary-2{background-color:var(--monster-bg-color-primary-2);color:var(--monster-color-primary-2)}.monster-color-secondary-2{background-color:var(--monster-bg-color-secondary-2);color:var(--monster-color-secondary-2)}.monster-color-tertiary-2{background-color:var(--monster-bg-color-tertiary-2);color:var(--monster-color-tertiary-2)}.monster-color-destructive-2{background-color:var(--monster-bg-color-destructive-2);color:var(--monster-color-destructive-2)}.monster-color-success-2{background-color:var(--monster-bg-color-success-2);color:var(--monster-color-success-2)}.monster-color-warning-2{background-color:var(--monster-bg-color-warning-2);color:var(--monster-color-warning-2)}.monster-color-error-2{background-color:var(--monster-bg-color-error-2);color:var(--monster-color-error-2)}.monster-color-selection-2{background-color:var(--monster-bg-color-selection-2);color:var(--monster-color-selection-2)}.monster-theme-primary-3{background-color:var(--monster-bg-color-primary-3);color:var(--monster-color-primary-3)}.monster-theme-primary-disabled-3{background-color:var(--monster-bg-color-primary-disabled-3);color:var(--monster-color-primary-disabled-3)}.monster-theme-secondary-3{background-color:var(--monster-bg-color-secondary-3);color:var(--monster-color-secondary-3)}.monster-theme-tertiary-3{background-color:var(--monster-bg-color-tertiary-3);color:var(--monster-color-tertiary-3)}.monster-theme-destructive-3{background-color:var(--monster-bg-color-destructive-3);color:var(--monster-color-destructive-3)}.monster-theme-success-3{background-color:var(--monster-bg-color-success-3);color:var(--monster-color-success-3)}.monster-theme-warning-3{background-color:var(--monster-bg-color-warning-3);color:var(--monster-color-warning-3)}.monster-theme-error-3{background-color:var(--monster-bg-color-error-3);color:var(--monster-color-error-3)}.monster-theme-selection-3{background-color:var(--monster-bg-color-selection-3);color:var(--monster-color-selection-3)}.monster-border-color-3{border-color:var(--monster-color-border-3)}.monster-color-neutral-3{color:var(--monster-color-primary-3)}.monster-bg-color-primary-3{background-color:var(--monster-bg-color-primary-3)}.monster-bg-color-secondary-3{background-color:var(--monster-bg-color-secondary-3)}.monster-bg-color-tertiary-3{background-color:var(--monster-bg-color-tertiary-3)}.monster-color-primary-3{background-color:var(--monster-bg-color-primary-3);color:var(--monster-color-primary-3)}.monster-color-secondary-3{background-color:var(--monster-bg-color-secondary-3);color:var(--monster-color-secondary-3)}.monster-color-tertiary-3{background-color:var(--monster-bg-color-tertiary-3);color:var(--monster-color-tertiary-3)}.monster-color-destructive-3{background-color:var(--monster-bg-color-destructive-3);color:var(--monster-color-destructive-3)}.monster-color-success-3{background-color:var(--monster-bg-color-success-3);color:var(--monster-color-success-3)}.monster-color-warning-3{background-color:var(--monster-bg-color-warning-3);color:var(--monster-color-warning-3)}.monster-color-error-3{background-color:var(--monster-bg-color-error-3);color:var(--monster-color-error-3)}.monster-color-selection-3{background-color:var(--monster-bg-color-selection-3);color:var(--monster-color-selection-3)}.monster-theme-primary-4{background-color:var(--monster-bg-color-primary-4);color:var(--monster-color-primary-4)}.monster-theme-primary-disabled-4{background-color:var(--monster-bg-color-primary-disabled-4);color:var(--monster-color-primary-disabled-4)}.monster-theme-secondary-4{background-color:var(--monster-bg-color-secondary-4);color:var(--monster-color-secondary-4)}.monster-theme-tertiary-4{background-color:var(--monster-bg-color-tertiary-4);color:var(--monster-color-tertiary-4)}.monster-theme-destructive-4{background-color:var(--monster-bg-color-destructive-4);color:var(--monster-color-destructive-4)}.monster-theme-success-4{background-color:var(--monster-bg-color-success-4);color:var(--monster-color-success-4)}.monster-theme-warning-4{background-color:var(--monster-bg-color-warning-4);color:var(--monster-color-warning-4)}.monster-theme-error-4{background-color:var(--monster-bg-color-error-4);color:var(--monster-color-error-4)}.monster-theme-selection-4{background-color:var(--monster-bg-color-selection-4);color:var(--monster-color-selection-4)}.monster-border-color-4{border-color:var(--monster-color-border-4)}.monster-color-neutral-4{color:var(--monster-color-primary-4)}.monster-bg-color-primary-4{background-color:var(--monster-bg-color-primary-4)}.monster-bg-color-secondary-4{background-color:var(--monster-bg-color-secondary-4)}.monster-bg-color-tertiary-4{background-color:var(--monster-bg-color-tertiary-4)}.monster-color-primary-4{background-color:var(--monster-bg-color-primary-4);color:var(--monster-color-primary-4)}.monster-color-secondary-4{background-color:var(--monster-bg-color-secondary-4);color:var(--monster-color-secondary-4)}.monster-color-tertiary-4{background-color:var(--monster-bg-color-tertiary-4);color:var(--monster-color-tertiary-4)}.monster-color-destructive-4{background-color:var(--monster-bg-color-destructive-4);color:var(--monster-color-destructive-4)}.monster-color-success-4{background-color:var(--monster-bg-color-success-4);color:var(--monster-color-success-4)}.monster-color-warning-4{background-color:var(--monster-bg-color-warning-4);color:var(--monster-color-warning-4)}.monster-color-error-4{background-color:var(--monster-bg-color-error-4);color:var(--monster-color-error-4)}.monster-color-selection-4{background-color:var(--monster-bg-color-selection-4);color:var(--monster-color-selection-4)}.monster-theme-control-container-1,.monster-theme-control-row-1{border:1px solid var(--monster-theme-control-border-color)}.monster-theme-control-container-1,.monster-theme-control-element,.monster-theme-control-row-1{background-color:var(--monster-theme-control-bg-color);color:var(--monster-theme-control-color)}.monster-theme-control-background{background-color:var(--monster-theme-control-bg-color)}.monster-theme-background-inherit{background-color:inherit!important}.monster-theme-on{background-color:var(--monster-theme-on-bg-color);color:var(--monster-theme-on-color)}.monster-theme-off{background-color:var(--monster-theme-off-bg-color);color:var(--monster-theme-off-color)}[data-monster-role=control]{box-sizing:border-box;outline:none}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:host{box-sizing:border-box;display:block}[data-monster-role=message]{align-items:center;display:flex;flex-direction:row;position:relative;width:100%}[data-monster-role=control]{align-items:center;background-color:var(--monster-bg-color-primary-1);color:var(--monster-color-primary-1);display:flex;justify-content:space-between;padding:8px;width:100%}[data-monster-role=content]{flex-grow:2;@mixins paragraph}[data-monster-role=control] [data-monster-role=close]{cursor:pointer;height:16px;position:absolute;right:-10px;top:-5px;width:16px;z-index:var(--monster-z-index-modal-overlay)}[data-monster-role=control] [data-monster-role=close]:before{background-color:var(--monster-color-primary-1);content:\"\";display:block;height:100%;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath d='M6.669 4.795a31 31 0 0 0-1.418.428.24.24 0 0 0-.164.195c-.277 2.079.363 3.595 1.126 4.594a5.4 5.4 0 0 0 1.144 1.117c.173.122.326.21.446.266q.09.043.147.059l.05.013.05-.013q.057-.017.147-.059a3 3 0 0 0 .447-.266 5.4 5.4 0 0 0 1.143-1.117c.764-.998 1.404-2.515 1.127-4.594a.24.24 0 0 0-.164-.195c-.326-.106-.875-.28-1.419-.427-.555-.151-1.065-.263-1.331-.263-.265 0-.776.112-1.331.262zm-.133-.515C7.079 4.133 7.655 4 8 4s.922.133 1.464.28c.555.15 1.115.328 1.444.435a.77.77 0 0 1 .522.631c.298 2.239-.394 3.898-1.233 4.995a5.9 5.9 0 0 1-1.258 1.227 3.5 3.5 0 0 1-.524.312c-.14.066-.291.12-.415.12s-.274-.054-.414-.12a3.5 3.5 0 0 1-.525-.312 5.9 5.9 0 0 1-1.258-1.227c-.839-1.097-1.53-2.756-1.232-4.995a.77.77 0 0 1 .522-.631 32 32 0 0 1 1.443-.435'/%3E%3Cpath d='M7.5 9.5a.5.5 0 1 1 1 0 .5.5 0 0 1-1 0m.05-3.002a.453.453 0 1 1 .9 0L8.275 8.25a.277.277 0 0 1-.55 0z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' viewBox='0 0 16 16'%3E%3Cpath d='M6.669 4.795a31 31 0 0 0-1.418.428.24.24 0 0 0-.164.195c-.277 2.079.363 3.595 1.126 4.594a5.4 5.4 0 0 0 1.144 1.117c.173.122.326.21.446.266q.09.043.147.059l.05.013.05-.013q.057-.017.147-.059a3 3 0 0 0 .447-.266 5.4 5.4 0 0 0 1.143-1.117c.764-.998 1.404-2.515 1.127-4.594a.24.24 0 0 0-.164-.195c-.326-.106-.875-.28-1.419-.427-.555-.151-1.065-.263-1.331-.263-.265 0-.776.112-1.331.262zm-.133-.515C7.079 4.133 7.655 4 8 4s.922.133 1.464.28c.555.15 1.115.328 1.444.435a.77.77 0 0 1 .522.631c.298 2.239-.394 3.898-1.233 4.995a5.9 5.9 0 0 1-1.258 1.227 3.5 3.5 0 0 1-.524.312c-.14.066-.291.12-.415.12s-.274-.054-.414-.12a3.5 3.5 0 0 1-.525-.312 5.9 5.9 0 0 1-1.258-1.227c-.839-1.097-1.53-2.756-1.232-4.995a.77.77 0 0 1 .522-.631 32 32 0 0 1 1.443-.435'/%3E%3Cpath d='M7.5 9.5a.5.5 0 1 1 1 0 .5.5 0 0 1-1 0m.05-3.002a.453.453 0 1 1 .9 0L8.275 8.25a.277.277 0 0 1-.55 0z'/%3E%3C/svg%3E\");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;width:100%}
28
- }`, 0);
29
+ }`,
30
+ 0,
31
+ );
29
32
  } catch (e) {
30
- addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
33
+ addAttributeToken(
34
+ document.getRootNode().querySelector("html"),
35
+ ATTRIBUTE_ERRORMESSAGE,
36
+ e + "",
37
+ );
31
38
  }
@@ -125,7 +125,7 @@ class Log extends CustomElement {
125
125
  * @return {Log}
126
126
  */
127
127
  clear() {
128
- this[logElementSymbol].setOption("entries", []);
128
+ this.setOption("entries", []);
129
129
  return this;
130
130
  }
131
131
 
@@ -1031,8 +1031,10 @@ function getOptionsFromScriptTag() {
1031
1031
  * @return {object}
1032
1032
  */
1033
1033
  function getOptionsFromAttributes() {
1034
-
1035
- if(this.hasAttribute(ATTRIBUTE_DISABLED) && this.getAttribute(ATTRIBUTE_DISABLED) !== null) {
1034
+ if (
1035
+ this.hasAttribute(ATTRIBUTE_DISABLED) &&
1036
+ this.getAttribute(ATTRIBUTE_DISABLED) !== null
1037
+ ) {
1036
1038
  this.setOption(ATTRIBUTE_DISABLED, true);
1037
1039
  } else {
1038
1040
  this.setOption(ATTRIBUTE_DISABLED, undefined);
@@ -17,12 +17,19 @@ import { ATTRIBUTE_ERRORMESSAGE } from "./constants.mjs";
17
17
 
18
18
  export { resetErrorAttribute, addErrorAttribute, removeErrorAttribute };
19
19
 
20
+ /**
21
+ * This method can be used to reset the error attribute of an element.
22
+ * @license AGPLv3
23
+ * @since 4.37.1
24
+ * @param {HTMLElement} element
25
+ * @return {HTMLElement}
26
+ */
20
27
  function resetErrorAttribute(element) {
21
- validateInstance(element, HTMLElement);
22
- if (element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
23
- element.removeAttribute(ATTRIBUTE_ERRORMESSAGE);
24
- }
25
- return element;
28
+ validateInstance(element, HTMLElement);
29
+ if (element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
30
+ element.removeAttribute(ATTRIBUTE_ERRORMESSAGE);
31
+ }
32
+ return element;
26
33
  }
27
34
 
28
35
  /**
@@ -36,45 +43,45 @@ function resetErrorAttribute(element) {
36
43
  * @return {HTMLElement}
37
44
  */
38
45
  function addErrorAttribute(element, message) {
39
- validateInstance(element, HTMLElement);
46
+ validateInstance(element, HTMLElement);
40
47
 
41
- if (message instanceof Error) {
42
- message = message.message;
43
- }
48
+ if (message instanceof Error) {
49
+ message = message.message;
50
+ }
44
51
 
45
- if (typeof message !== "string") {
46
- if (typeof message === "object" && message !== null) {
47
- if (typeof message.toString === "function") {
48
- message = message.toString();
49
- } else {
50
- message = JSON.stringify(message);
51
- }
52
- } else {
53
- message = String(message);
54
- }
55
- }
52
+ if (typeof message !== "string") {
53
+ if (typeof message === "object" && message !== null) {
54
+ if (typeof message.toString === "function") {
55
+ message = message.toString();
56
+ } else {
57
+ message = JSON.stringify(message);
58
+ }
59
+ } else {
60
+ message = String(message);
61
+ }
62
+ }
56
63
 
57
- validateString(message);
64
+ validateString(message);
58
65
 
59
- if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
60
- element.setAttribute(ATTRIBUTE_ERRORMESSAGE, message);
61
- return element;
62
- }
66
+ if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
67
+ element.setAttribute(ATTRIBUTE_ERRORMESSAGE, message);
68
+ return element;
69
+ }
63
70
 
64
- const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
65
- const list = current.split("::");
71
+ const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
72
+ const list = current.split("::");
66
73
 
67
- for (let i = 0; i < list.length; i++) {
68
- if (list[i] === message) {
69
- return element;
70
- }
71
- }
74
+ for (let i = 0; i < list.length; i++) {
75
+ if (list[i] === message) {
76
+ return element;
77
+ }
78
+ }
72
79
 
73
- list.push(message);
80
+ list.push(message);
74
81
 
75
- element.setAttribute(ATTRIBUTE_ERRORMESSAGE, list.join("::"));
82
+ element.setAttribute(ATTRIBUTE_ERRORMESSAGE, list.join("::"));
76
83
 
77
- return element;
84
+ return element;
78
85
  }
79
86
 
80
87
  /**
@@ -88,20 +95,20 @@ function addErrorAttribute(element, message) {
88
95
  * @return {HTMLElement}
89
96
  */
90
97
  function removeErrorAttribute(element, message) {
91
- validateInstance(element, HTMLElement);
92
- validateString(message);
98
+ validateInstance(element, HTMLElement);
99
+ validateString(message);
93
100
 
94
- if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
95
- return element;
96
- }
101
+ if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
102
+ return element;
103
+ }
97
104
 
98
- const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
99
- const list = current.split("::");
100
- const newList = list.filter(function (token) {
101
- return token !== message;
102
- });
105
+ const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
106
+ const list = current.split("::");
107
+ const newList = list.filter(function (token) {
108
+ return token !== message;
109
+ });
103
110
 
104
- element.setAttribute(ATTRIBUTE_ERRORMESSAGE, newList.join("::"));
111
+ element.setAttribute(ATTRIBUTE_ERRORMESSAGE, newList.join("::"));
105
112
 
106
- return element;
113
+ return element;
107
114
  }
@@ -156,7 +156,7 @@ function getMonsterVersion() {
156
156
  }
157
157
 
158
158
  /** don't touch, replaced by make with package.json version */
159
- monsterVersion = new Version("4.36.0");
159
+ monsterVersion = new Version("4.37.2");
160
160
 
161
161
  return monsterVersion;
162
162
  }
@@ -7,7 +7,7 @@ describe('Monster', function () {
7
7
  let monsterVersion
8
8
 
9
9
  /** don´t touch, replaced by make with package.json version */
10
- monsterVersion = new Version("4.36.0")
10
+ monsterVersion = new Version("4.37.2")
11
11
 
12
12
  let m = getMonsterVersion();
13
13
 
@@ -9,8 +9,8 @@
9
9
  </head>
10
10
  <body>
11
11
  <div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
12
- <h1 style='margin-bottom: 0.1em;'>Monster 4.36.0</h1>
13
- <div id="lastupdate" style='font-size:0.7em'>last update Sa 19. Jul 18:39:06 CEST 2025</div>
12
+ <h1 style='margin-bottom: 0.1em;'>Monster 4.37.2</h1>
13
+ <div id="lastupdate" style='font-size:0.7em'>last update Mo 21. Jul 18:16:57 CEST 2025</div>
14
14
  </div>
15
15
  <div id="mocha-errors"
16
16
  style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>