@universityofmaryland/web-model-library 1.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 (252) hide show
  1. package/README.md +138 -0
  2. package/dist/_types.d.ts +77 -0
  3. package/dist/_types.d.ts.map +1 -0
  4. package/dist/_virtual/___vite-browser-external.js +8 -0
  5. package/dist/_virtual/___vite-browser-external.js.map +1 -0
  6. package/dist/_virtual/___vite-browser-external.mjs +7 -0
  7. package/dist/_virtual/___vite-browser-external.mjs.map +1 -0
  8. package/dist/_virtual/__vite-browser-external.js +4 -0
  9. package/dist/_virtual/__vite-browser-external.js.map +1 -0
  10. package/dist/_virtual/__vite-browser-external.mjs +5 -0
  11. package/dist/_virtual/__vite-browser-external.mjs.map +1 -0
  12. package/dist/_virtual/_commonjsHelpers.js +37 -0
  13. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  14. package/dist/_virtual/_commonjsHelpers.mjs +37 -0
  15. package/dist/_virtual/_commonjsHelpers.mjs.map +1 -0
  16. package/dist/_virtual/index.js +7 -0
  17. package/dist/_virtual/index.js.map +1 -0
  18. package/dist/_virtual/index.mjs +8 -0
  19. package/dist/_virtual/index.mjs.map +1 -0
  20. package/dist/_virtual/picocolors.browser.js +5 -0
  21. package/dist/_virtual/picocolors.browser.js.map +1 -0
  22. package/dist/_virtual/picocolors.browser.mjs +5 -0
  23. package/dist/_virtual/picocolors.browser.mjs.map +1 -0
  24. package/dist/_virtual/postcss.js +7 -0
  25. package/dist/_virtual/postcss.js.map +1 -0
  26. package/dist/_virtual/postcss.mjs +8 -0
  27. package/dist/_virtual/postcss.mjs.map +1 -0
  28. package/dist/_virtual/symbols.js +5 -0
  29. package/dist/_virtual/symbols.js.map +1 -0
  30. package/dist/_virtual/symbols.mjs +5 -0
  31. package/dist/_virtual/symbols.mjs.map +1 -0
  32. package/dist/attributes/checks.d.ts +133 -0
  33. package/dist/attributes/checks.d.ts.map +1 -0
  34. package/dist/attributes/checks.js +757 -0
  35. package/dist/attributes/checks.js.map +1 -0
  36. package/dist/attributes/checks.mjs +740 -0
  37. package/dist/attributes/checks.mjs.map +1 -0
  38. package/dist/attributes/handler.d.ts +52 -0
  39. package/dist/attributes/handler.d.ts.map +1 -0
  40. package/dist/attributes/handler.js +205 -0
  41. package/dist/attributes/handler.js.map +1 -0
  42. package/dist/attributes/handler.mjs +206 -0
  43. package/dist/attributes/handler.mjs.map +1 -0
  44. package/dist/attributes/index.d.ts +7 -0
  45. package/dist/attributes/index.d.ts.map +1 -0
  46. package/dist/attributes/names.d.ts +132 -0
  47. package/dist/attributes/names.d.ts.map +1 -0
  48. package/dist/attributes/names.js +145 -0
  49. package/dist/attributes/names.js.map +1 -0
  50. package/dist/attributes/names.mjs +146 -0
  51. package/dist/attributes/names.mjs.map +1 -0
  52. package/dist/attributes/values.d.ts +70 -0
  53. package/dist/attributes/values.d.ts.map +1 -0
  54. package/dist/attributes/values.js +80 -0
  55. package/dist/attributes/values.js.map +1 -0
  56. package/dist/attributes/values.mjs +81 -0
  57. package/dist/attributes/values.mjs.map +1 -0
  58. package/dist/attributes.d.ts +2 -0
  59. package/dist/attributes.js +23 -0
  60. package/dist/attributes.js.map +1 -0
  61. package/dist/attributes.mjs +23 -0
  62. package/dist/attributes.mjs.map +1 -0
  63. package/dist/index.d.ts +10 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +13 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/index.mjs +13 -0
  68. package/dist/index.mjs.map +1 -0
  69. package/dist/model/index.d.ts +43 -0
  70. package/dist/model/index.d.ts.map +1 -0
  71. package/dist/model.d.ts +2 -0
  72. package/dist/model.js +259 -0
  73. package/dist/model.js.map +1 -0
  74. package/dist/model.mjs +259 -0
  75. package/dist/model.mjs.map +1 -0
  76. package/dist/node_modules/nanoid/non-secure/index.js +31 -0
  77. package/dist/node_modules/nanoid/non-secure/index.js.map +1 -0
  78. package/dist/node_modules/nanoid/non-secure/index.mjs +31 -0
  79. package/dist/node_modules/nanoid/non-secure/index.mjs.map +1 -0
  80. package/dist/node_modules/picocolors/picocolors.browser.js +17 -0
  81. package/dist/node_modules/picocolors/picocolors.browser.js.map +1 -0
  82. package/dist/node_modules/picocolors/picocolors.browser.mjs +17 -0
  83. package/dist/node_modules/picocolors/picocolors.browser.mjs.map +1 -0
  84. package/dist/node_modules/postcss/lib/at-rule.js +30 -0
  85. package/dist/node_modules/postcss/lib/at-rule.js.map +1 -0
  86. package/dist/node_modules/postcss/lib/at-rule.mjs +30 -0
  87. package/dist/node_modules/postcss/lib/at-rule.mjs.map +1 -0
  88. package/dist/node_modules/postcss/lib/comment.js +21 -0
  89. package/dist/node_modules/postcss/lib/comment.js.map +1 -0
  90. package/dist/node_modules/postcss/lib/comment.mjs +21 -0
  91. package/dist/node_modules/postcss/lib/comment.mjs.map +1 -0
  92. package/dist/node_modules/postcss/lib/container.js +383 -0
  93. package/dist/node_modules/postcss/lib/container.js.map +1 -0
  94. package/dist/node_modules/postcss/lib/container.mjs +383 -0
  95. package/dist/node_modules/postcss/lib/container.mjs.map +1 -0
  96. package/dist/node_modules/postcss/lib/css-syntax-error.js +92 -0
  97. package/dist/node_modules/postcss/lib/css-syntax-error.js.map +1 -0
  98. package/dist/node_modules/postcss/lib/css-syntax-error.mjs +92 -0
  99. package/dist/node_modules/postcss/lib/css-syntax-error.mjs.map +1 -0
  100. package/dist/node_modules/postcss/lib/declaration.js +27 -0
  101. package/dist/node_modules/postcss/lib/declaration.js.map +1 -0
  102. package/dist/node_modules/postcss/lib/declaration.mjs +27 -0
  103. package/dist/node_modules/postcss/lib/declaration.mjs.map +1 -0
  104. package/dist/node_modules/postcss/lib/document.js +34 -0
  105. package/dist/node_modules/postcss/lib/document.js.map +1 -0
  106. package/dist/node_modules/postcss/lib/document.mjs +34 -0
  107. package/dist/node_modules/postcss/lib/document.mjs.map +1 -0
  108. package/dist/node_modules/postcss/lib/fromJSON.js +67 -0
  109. package/dist/node_modules/postcss/lib/fromJSON.js.map +1 -0
  110. package/dist/node_modules/postcss/lib/fromJSON.mjs +67 -0
  111. package/dist/node_modules/postcss/lib/fromJSON.mjs.map +1 -0
  112. package/dist/node_modules/postcss/lib/input.js +216 -0
  113. package/dist/node_modules/postcss/lib/input.js.map +1 -0
  114. package/dist/node_modules/postcss/lib/input.mjs +216 -0
  115. package/dist/node_modules/postcss/lib/input.mjs.map +1 -0
  116. package/dist/node_modules/postcss/lib/lazy-result.js +467 -0
  117. package/dist/node_modules/postcss/lib/lazy-result.js.map +1 -0
  118. package/dist/node_modules/postcss/lib/lazy-result.mjs +467 -0
  119. package/dist/node_modules/postcss/lib/lazy-result.mjs.map +1 -0
  120. package/dist/node_modules/postcss/lib/list.js +60 -0
  121. package/dist/node_modules/postcss/lib/list.js.map +1 -0
  122. package/dist/node_modules/postcss/lib/list.mjs +60 -0
  123. package/dist/node_modules/postcss/lib/list.mjs.map +1 -0
  124. package/dist/node_modules/postcss/lib/map-generator.js +314 -0
  125. package/dist/node_modules/postcss/lib/map-generator.js.map +1 -0
  126. package/dist/node_modules/postcss/lib/map-generator.mjs +314 -0
  127. package/dist/node_modules/postcss/lib/map-generator.mjs.map +1 -0
  128. package/dist/node_modules/postcss/lib/no-work-result.js +113 -0
  129. package/dist/node_modules/postcss/lib/no-work-result.js.map +1 -0
  130. package/dist/node_modules/postcss/lib/no-work-result.mjs +113 -0
  131. package/dist/node_modules/postcss/lib/no-work-result.mjs.map +1 -0
  132. package/dist/node_modules/postcss/lib/node.js +335 -0
  133. package/dist/node_modules/postcss/lib/node.js.map +1 -0
  134. package/dist/node_modules/postcss/lib/node.mjs +335 -0
  135. package/dist/node_modules/postcss/lib/node.mjs.map +1 -0
  136. package/dist/node_modules/postcss/lib/parse.js +30 -0
  137. package/dist/node_modules/postcss/lib/parse.js.map +1 -0
  138. package/dist/node_modules/postcss/lib/parse.mjs +30 -0
  139. package/dist/node_modules/postcss/lib/parse.mjs.map +1 -0
  140. package/dist/node_modules/postcss/lib/parser.js +543 -0
  141. package/dist/node_modules/postcss/lib/parser.js.map +1 -0
  142. package/dist/node_modules/postcss/lib/parser.mjs +543 -0
  143. package/dist/node_modules/postcss/lib/parser.mjs.map +1 -0
  144. package/dist/node_modules/postcss/lib/postcss.js +28 -0
  145. package/dist/node_modules/postcss/lib/postcss.js.map +1 -0
  146. package/dist/node_modules/postcss/lib/postcss.mjs +29 -0
  147. package/dist/node_modules/postcss/lib/postcss.mjs.map +1 -0
  148. package/dist/node_modules/postcss/lib/postcss2.js +110 -0
  149. package/dist/node_modules/postcss/lib/postcss2.js.map +1 -0
  150. package/dist/node_modules/postcss/lib/postcss2.mjs +110 -0
  151. package/dist/node_modules/postcss/lib/postcss2.mjs.map +1 -0
  152. package/dist/node_modules/postcss/lib/previous-map.js +123 -0
  153. package/dist/node_modules/postcss/lib/previous-map.js.map +1 -0
  154. package/dist/node_modules/postcss/lib/previous-map.mjs +123 -0
  155. package/dist/node_modules/postcss/lib/previous-map.mjs.map +1 -0
  156. package/dist/node_modules/postcss/lib/processor.js +61 -0
  157. package/dist/node_modules/postcss/lib/processor.js.map +1 -0
  158. package/dist/node_modules/postcss/lib/processor.mjs +61 -0
  159. package/dist/node_modules/postcss/lib/processor.mjs.map +1 -0
  160. package/dist/node_modules/postcss/lib/result.js +44 -0
  161. package/dist/node_modules/postcss/lib/result.js.map +1 -0
  162. package/dist/node_modules/postcss/lib/result.mjs +44 -0
  163. package/dist/node_modules/postcss/lib/result.mjs.map +1 -0
  164. package/dist/node_modules/postcss/lib/root.js +58 -0
  165. package/dist/node_modules/postcss/lib/root.js.map +1 -0
  166. package/dist/node_modules/postcss/lib/root.mjs +58 -0
  167. package/dist/node_modules/postcss/lib/root.mjs.map +1 -0
  168. package/dist/node_modules/postcss/lib/rule.js +33 -0
  169. package/dist/node_modules/postcss/lib/rule.js.map +1 -0
  170. package/dist/node_modules/postcss/lib/rule.mjs +33 -0
  171. package/dist/node_modules/postcss/lib/rule.mjs.map +1 -0
  172. package/dist/node_modules/postcss/lib/stringifier.js +308 -0
  173. package/dist/node_modules/postcss/lib/stringifier.js.map +1 -0
  174. package/dist/node_modules/postcss/lib/stringifier.mjs +308 -0
  175. package/dist/node_modules/postcss/lib/stringifier.mjs.map +1 -0
  176. package/dist/node_modules/postcss/lib/stringify.js +19 -0
  177. package/dist/node_modules/postcss/lib/stringify.js.map +1 -0
  178. package/dist/node_modules/postcss/lib/stringify.mjs +19 -0
  179. package/dist/node_modules/postcss/lib/stringify.mjs.map +1 -0
  180. package/dist/node_modules/postcss/lib/symbols.js +13 -0
  181. package/dist/node_modules/postcss/lib/symbols.js.map +1 -0
  182. package/dist/node_modules/postcss/lib/symbols.mjs +13 -0
  183. package/dist/node_modules/postcss/lib/symbols.mjs.map +1 -0
  184. package/dist/node_modules/postcss/lib/tokenize.js +219 -0
  185. package/dist/node_modules/postcss/lib/tokenize.js.map +1 -0
  186. package/dist/node_modules/postcss/lib/tokenize.mjs +219 -0
  187. package/dist/node_modules/postcss/lib/tokenize.mjs.map +1 -0
  188. package/dist/node_modules/postcss/lib/warning.js +40 -0
  189. package/dist/node_modules/postcss/lib/warning.js.map +1 -0
  190. package/dist/node_modules/postcss/lib/warning.mjs +40 -0
  191. package/dist/node_modules/postcss/lib/warning.mjs.map +1 -0
  192. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.js +130 -0
  193. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.js.map +1 -0
  194. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.mjs +130 -0
  195. package/dist/packages/model/node_modules/postcss-discard-duplicates/src/index.mjs.map +1 -0
  196. package/dist/slots/create.d.ts +15 -0
  197. package/dist/slots/create.d.ts.map +1 -0
  198. package/dist/slots/create.js +50 -0
  199. package/dist/slots/create.js.map +1 -0
  200. package/dist/slots/create.mjs +50 -0
  201. package/dist/slots/create.mjs.map +1 -0
  202. package/dist/slots/element.d.ts +3 -0
  203. package/dist/slots/element.d.ts.map +1 -0
  204. package/dist/slots/element.js +42 -0
  205. package/dist/slots/element.js.map +1 -0
  206. package/dist/slots/element.mjs +42 -0
  207. package/dist/slots/element.mjs.map +1 -0
  208. package/dist/slots/extract.d.ts +6 -0
  209. package/dist/slots/extract.d.ts.map +1 -0
  210. package/dist/slots/index.d.ts +140 -0
  211. package/dist/slots/index.d.ts.map +1 -0
  212. package/dist/slots/mapping.d.ts +82 -0
  213. package/dist/slots/mapping.d.ts.map +1 -0
  214. package/dist/slots/mapping.js +97 -0
  215. package/dist/slots/mapping.js.map +1 -0
  216. package/dist/slots/mapping.mjs +97 -0
  217. package/dist/slots/mapping.mjs.map +1 -0
  218. package/dist/slots/query.d.ts +9 -0
  219. package/dist/slots/query.d.ts.map +1 -0
  220. package/dist/slots/validate.d.ts +22 -0
  221. package/dist/slots/validate.d.ts.map +1 -0
  222. package/dist/slots.d.ts +6 -0
  223. package/dist/slots.js +73 -0
  224. package/dist/slots.js.map +1 -0
  225. package/dist/slots.mjs +74 -0
  226. package/dist/slots.mjs.map +1 -0
  227. package/dist/utilities/index.d.ts +4 -0
  228. package/dist/utilities/index.d.ts.map +1 -0
  229. package/dist/utilities/lifecycle.d.ts +12 -0
  230. package/dist/utilities/lifecycle.d.ts.map +1 -0
  231. package/dist/utilities/lifecycle.js +21 -0
  232. package/dist/utilities/lifecycle.js.map +1 -0
  233. package/dist/utilities/lifecycle.mjs +21 -0
  234. package/dist/utilities/lifecycle.mjs.map +1 -0
  235. package/dist/utilities/register.d.ts +17 -0
  236. package/dist/utilities/register.d.ts.map +1 -0
  237. package/dist/utilities/register.js +32 -0
  238. package/dist/utilities/register.js.map +1 -0
  239. package/dist/utilities/register.mjs +32 -0
  240. package/dist/utilities/register.mjs.map +1 -0
  241. package/dist/utilities/styles.d.ts +5 -0
  242. package/dist/utilities/styles.d.ts.map +1 -0
  243. package/dist/utilities/styles.js +79 -0
  244. package/dist/utilities/styles.js.map +1 -0
  245. package/dist/utilities/styles.mjs +80 -0
  246. package/dist/utilities/styles.mjs.map +1 -0
  247. package/dist/utilities.d.ts +2 -0
  248. package/dist/utilities.js +11 -0
  249. package/dist/utilities.js.map +1 -0
  250. package/dist/utilities.mjs +11 -0
  251. package/dist/utilities.mjs.map +1 -0
  252. package/package.json +69 -0
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var src;
4
+ var hasRequiredSrc;
5
+ function requireSrc() {
6
+ if (hasRequiredSrc) return src;
7
+ hasRequiredSrc = 1;
8
+ function trimValue(value) {
9
+ return value ? value.trim() : value;
10
+ }
11
+ function empty(node) {
12
+ return !node.nodes.filter((child) => child.type !== "comment").length;
13
+ }
14
+ function equals(nodeA, nodeB) {
15
+ const a = (
16
+ /** @type {any} */
17
+ nodeA
18
+ );
19
+ const b = (
20
+ /** @type {any} */
21
+ nodeB
22
+ );
23
+ if (a.type !== b.type) {
24
+ return false;
25
+ }
26
+ if (a.important !== b.important) {
27
+ return false;
28
+ }
29
+ if (a.raws && !b.raws || !a.raws && b.raws) {
30
+ return false;
31
+ }
32
+ switch (a.type) {
33
+ case "rule":
34
+ if (a.selector !== b.selector) {
35
+ return false;
36
+ }
37
+ break;
38
+ case "atrule":
39
+ if (a.name !== b.name || a.params !== b.params) {
40
+ return false;
41
+ }
42
+ if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {
43
+ return false;
44
+ }
45
+ if (a.raws && trimValue(a.raws.afterName) !== trimValue(b.raws.afterName)) {
46
+ return false;
47
+ }
48
+ break;
49
+ case "decl":
50
+ if (a.prop !== b.prop || a.value !== b.value) {
51
+ return false;
52
+ }
53
+ if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {
54
+ return false;
55
+ }
56
+ break;
57
+ }
58
+ if (a.nodes) {
59
+ if (a.nodes.length !== b.nodes.length) {
60
+ return false;
61
+ }
62
+ for (let i = 0; i < a.nodes.length; i++) {
63
+ if (!equals(a.nodes[i], b.nodes[i])) {
64
+ return false;
65
+ }
66
+ }
67
+ }
68
+ return true;
69
+ }
70
+ function dedupeRule(last, nodes) {
71
+ let index = nodes.indexOf(last) - 1;
72
+ while (index >= 0) {
73
+ const node = nodes[index--];
74
+ if (node && node.type === "rule" && node.selector === last.selector) {
75
+ last.each((child) => {
76
+ if (child.type === "decl") {
77
+ dedupeNode(child, node.nodes);
78
+ }
79
+ });
80
+ if (empty(node)) {
81
+ node.remove();
82
+ }
83
+ }
84
+ }
85
+ }
86
+ function dedupeNode(last, nodes) {
87
+ let index = nodes.includes(last) ? nodes.indexOf(last) - 1 : nodes.length - 1;
88
+ while (index >= 0) {
89
+ const node = nodes[index--];
90
+ if (node && equals(node, last)) {
91
+ node.remove();
92
+ }
93
+ }
94
+ }
95
+ function dedupe(root) {
96
+ const { nodes } = (
97
+ /** @type {import('postcss').Container<import('postcss').ChildNode>} */
98
+ root
99
+ );
100
+ if (!nodes) {
101
+ return;
102
+ }
103
+ let index = nodes.length - 1;
104
+ while (index >= 0) {
105
+ let last = nodes[index--];
106
+ if (!last || !last.parent) {
107
+ continue;
108
+ }
109
+ dedupe(last);
110
+ if (last.type === "rule") {
111
+ dedupeRule(last, nodes);
112
+ } else if (last.type === "atrule" || last.type === "decl") {
113
+ dedupeNode(last, nodes);
114
+ }
115
+ }
116
+ }
117
+ function pluginCreator() {
118
+ return {
119
+ postcssPlugin: "postcss-discard-duplicates",
120
+ OnceExit(css) {
121
+ dedupe(css);
122
+ }
123
+ };
124
+ }
125
+ pluginCreator.postcss = true;
126
+ src = pluginCreator;
127
+ return src;
128
+ }
129
+ exports.__require = requireSrc;
130
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../node_modules/postcss-discard-duplicates/src/index.js"],"sourcesContent":["'use strict';\n/**\n * @param {string | undefined} value\n * @return {string | undefined}\n */\nfunction trimValue(value) {\n return value ? value.trim() : value;\n}\n\n/**\n * @param {{nodes: import('postcss').Node[]}} node\n * @return {boolean}\n */\nfunction empty(node) {\n return !node.nodes.filter((child) => child.type !== 'comment').length;\n}\n\n/**\n * @param {import('postcss').AnyNode} nodeA\n * @param {import('postcss').AnyNode} nodeB\n * @return {boolean}\n */\nfunction equals(nodeA, nodeB) {\n const a = /** @type {any} */ (nodeA);\n const b = /** @type {any} */ (nodeB);\n if (a.type !== b.type) {\n return false;\n }\n\n if (a.important !== b.important) {\n return false;\n }\n\n if ((a.raws && !b.raws) || (!a.raws && b.raws)) {\n return false;\n }\n\n switch (a.type) {\n case 'rule':\n if (a.selector !== b.selector) {\n return false;\n }\n break;\n case 'atrule':\n if (a.name !== b.name || a.params !== b.params) {\n return false;\n }\n\n if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {\n return false;\n }\n\n if (\n a.raws &&\n trimValue(a.raws.afterName) !== trimValue(b.raws.afterName)\n ) {\n return false;\n }\n break;\n case 'decl':\n if (a.prop !== b.prop || a.value !== b.value) {\n return false;\n }\n\n if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {\n return false;\n }\n break;\n }\n\n if (a.nodes) {\n if (a.nodes.length !== b.nodes.length) {\n return false;\n }\n\n for (let i = 0; i < a.nodes.length; i++) {\n if (!equals(a.nodes[i], b.nodes[i])) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @param {import('postcss').Rule} last\n * @param {import('postcss').AnyNode[]} nodes\n * @return {void}\n */\nfunction dedupeRule(last, nodes) {\n let index = nodes.indexOf(last) - 1;\n while (index >= 0) {\n const node = nodes[index--];\n if (node && node.type === 'rule' && node.selector === last.selector) {\n last.each((child) => {\n if (child.type === 'decl') {\n dedupeNode(child, node.nodes);\n }\n });\n\n if (empty(node)) {\n node.remove();\n }\n }\n }\n}\n\n/**\n * @param {import('postcss').AtRule | import('postcss').Declaration} last\n * @param {import('postcss').AnyNode[]} nodes\n * @return {void}\n */\nfunction dedupeNode(last, nodes) {\n let index = nodes.includes(last) ? nodes.indexOf(last) - 1 : nodes.length - 1;\n\n while (index >= 0) {\n const node = nodes[index--];\n if (node && equals(node, last)) {\n node.remove();\n }\n }\n}\n\n/**\n * @param {import('postcss').AnyNode} root\n * @return {void}\n */\nfunction dedupe(root) {\n const { nodes } =\n /** @type {import('postcss').Container<import('postcss').ChildNode>} */ (\n root\n );\n\n if (!nodes) {\n return;\n }\n\n let index = nodes.length - 1;\n while (index >= 0) {\n let last = nodes[index--];\n if (!last || !last.parent) {\n continue;\n }\n dedupe(last);\n if (last.type === 'rule') {\n dedupeRule(last, nodes);\n } else if (last.type === 'atrule' || last.type === 'decl') {\n dedupeNode(last, nodes);\n }\n }\n}\n\n/**\n * @type {import('postcss').PluginCreator<void>}\n * @return {import('postcss').Plugin}\n */\nfunction pluginCreator() {\n return {\n postcssPlugin: 'postcss-discard-duplicates',\n OnceExit(css) {\n dedupe(css);\n },\n };\n}\n\npluginCreator.postcss = true;\nmodule.exports = pluginCreator;\n"],"names":[],"mappings":";;;;;;;AAKA,WAAS,UAAU,OAAO;AACxB,WAAO,QAAQ,MAAM,KAAI,IAAK;AAAA,EAChC;AAMA,WAAS,MAAM,MAAM;AACnB,WAAO,CAAC,KAAK,MAAM,OAAO,CAAC,UAAU,MAAM,SAAS,SAAS,EAAE;AAAA,EACjE;AAOA,WAAS,OAAO,OAAO,OAAO;AAC5B,UAAM;AAAA;AAAA,MAAwB;AAAA;AAC9B,UAAM;AAAA;AAAA,MAAwB;AAAA;AAC9B,QAAI,EAAE,SAAS,EAAE,MAAM;AACrB,aAAO;AAAA,IACX;AAEE,QAAI,EAAE,cAAc,EAAE,WAAW;AAC/B,aAAO;AAAA,IACX;AAEE,QAAK,EAAE,QAAQ,CAAC,EAAE,QAAU,CAAC,EAAE,QAAQ,EAAE,MAAO;AAC9C,aAAO;AAAA,IACX;AAEE,YAAQ,EAAE,MAAI;AAAA,MACZ,KAAK;AACH,YAAI,EAAE,aAAa,EAAE,UAAU;AAC7B,iBAAO;AAAA,QACf;AACM;AAAA,MACF,KAAK;AACH,YAAI,EAAE,SAAS,E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M,OAAO;AAC/B,QAAI,QAAQ,MAAM,SAAS,IAAI,IAAI,MAAM,QAAQ,IAAI,IAAI,IAAI,MAAM,SAAS;AAE5E,WAAO,SAAS,GAAG;AACjB,YAAM,OAAO,MAAM,OAAO;AAC1B,UAAI,QAAQ,OAAO,MAAM,IAAI,GAAG;AAC9B,aAAK,OAAM;AAAA,MACjB;AAAA,IACA;AAAA,EACA;AAMA,WAAS,OAAO,MAAM;AACpB,UAAM,EAAE,MAAK;AAAA;AAAA,MAET;AAAA;AAGJ,QAAI,CAAC,OAAO;AACV;AAAA,IACJ;AAEE,QAAI,QAAQ,MAAM,SAAS;AAC3B,WAAO,SAAS,GAAG;AACjB,UAAI,OAAO,MAAM,OAAO;AACxB,UAAI,CAAC,QAAQ,CAAC,KAAK,QAAQ;AACzB;AAAA,MACN;AACI,aAAO,IAAI;AACX,UAAI,KAAK,SAAS,QAAQ;AACxB,mBAAW,MAAM,KAAK;AAAA,MAC5B,WAAe,KAAK,SAAS,YAAY,KAAK,SAAS,QAAQ;AACzD,mBAAW,MAAM,KAAK;AAAA,MAC5B;AAAA,IACA;AAAA,EACA;AAMA,WAAS,gBAAgB;AACvB,WAAO;AAAA,MACL,eAAe;AAAA,MACf,SAAS,KAAK;AACZ,eAAO,GAAG;AAAA,MAChB;AAAA;EAEA;AAEA,gBAAc,UAAU;AACxB,QAAiB;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,130 @@
1
+ var src;
2
+ var hasRequiredSrc;
3
+ function requireSrc() {
4
+ if (hasRequiredSrc) return src;
5
+ hasRequiredSrc = 1;
6
+ function trimValue(value) {
7
+ return value ? value.trim() : value;
8
+ }
9
+ function empty(node) {
10
+ return !node.nodes.filter((child) => child.type !== "comment").length;
11
+ }
12
+ function equals(nodeA, nodeB) {
13
+ const a = (
14
+ /** @type {any} */
15
+ nodeA
16
+ );
17
+ const b = (
18
+ /** @type {any} */
19
+ nodeB
20
+ );
21
+ if (a.type !== b.type) {
22
+ return false;
23
+ }
24
+ if (a.important !== b.important) {
25
+ return false;
26
+ }
27
+ if (a.raws && !b.raws || !a.raws && b.raws) {
28
+ return false;
29
+ }
30
+ switch (a.type) {
31
+ case "rule":
32
+ if (a.selector !== b.selector) {
33
+ return false;
34
+ }
35
+ break;
36
+ case "atrule":
37
+ if (a.name !== b.name || a.params !== b.params) {
38
+ return false;
39
+ }
40
+ if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {
41
+ return false;
42
+ }
43
+ if (a.raws && trimValue(a.raws.afterName) !== trimValue(b.raws.afterName)) {
44
+ return false;
45
+ }
46
+ break;
47
+ case "decl":
48
+ if (a.prop !== b.prop || a.value !== b.value) {
49
+ return false;
50
+ }
51
+ if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {
52
+ return false;
53
+ }
54
+ break;
55
+ }
56
+ if (a.nodes) {
57
+ if (a.nodes.length !== b.nodes.length) {
58
+ return false;
59
+ }
60
+ for (let i = 0; i < a.nodes.length; i++) {
61
+ if (!equals(a.nodes[i], b.nodes[i])) {
62
+ return false;
63
+ }
64
+ }
65
+ }
66
+ return true;
67
+ }
68
+ function dedupeRule(last, nodes) {
69
+ let index = nodes.indexOf(last) - 1;
70
+ while (index >= 0) {
71
+ const node = nodes[index--];
72
+ if (node && node.type === "rule" && node.selector === last.selector) {
73
+ last.each((child) => {
74
+ if (child.type === "decl") {
75
+ dedupeNode(child, node.nodes);
76
+ }
77
+ });
78
+ if (empty(node)) {
79
+ node.remove();
80
+ }
81
+ }
82
+ }
83
+ }
84
+ function dedupeNode(last, nodes) {
85
+ let index = nodes.includes(last) ? nodes.indexOf(last) - 1 : nodes.length - 1;
86
+ while (index >= 0) {
87
+ const node = nodes[index--];
88
+ if (node && equals(node, last)) {
89
+ node.remove();
90
+ }
91
+ }
92
+ }
93
+ function dedupe(root) {
94
+ const { nodes } = (
95
+ /** @type {import('postcss').Container<import('postcss').ChildNode>} */
96
+ root
97
+ );
98
+ if (!nodes) {
99
+ return;
100
+ }
101
+ let index = nodes.length - 1;
102
+ while (index >= 0) {
103
+ let last = nodes[index--];
104
+ if (!last || !last.parent) {
105
+ continue;
106
+ }
107
+ dedupe(last);
108
+ if (last.type === "rule") {
109
+ dedupeRule(last, nodes);
110
+ } else if (last.type === "atrule" || last.type === "decl") {
111
+ dedupeNode(last, nodes);
112
+ }
113
+ }
114
+ }
115
+ function pluginCreator() {
116
+ return {
117
+ postcssPlugin: "postcss-discard-duplicates",
118
+ OnceExit(css) {
119
+ dedupe(css);
120
+ }
121
+ };
122
+ }
123
+ pluginCreator.postcss = true;
124
+ src = pluginCreator;
125
+ return src;
126
+ }
127
+ export {
128
+ requireSrc as __require
129
+ };
130
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../../node_modules/postcss-discard-duplicates/src/index.js"],"sourcesContent":["'use strict';\n/**\n * @param {string | undefined} value\n * @return {string | undefined}\n */\nfunction trimValue(value) {\n return value ? value.trim() : value;\n}\n\n/**\n * @param {{nodes: import('postcss').Node[]}} node\n * @return {boolean}\n */\nfunction empty(node) {\n return !node.nodes.filter((child) => child.type !== 'comment').length;\n}\n\n/**\n * @param {import('postcss').AnyNode} nodeA\n * @param {import('postcss').AnyNode} nodeB\n * @return {boolean}\n */\nfunction equals(nodeA, nodeB) {\n const a = /** @type {any} */ (nodeA);\n const b = /** @type {any} */ (nodeB);\n if (a.type !== b.type) {\n return false;\n }\n\n if (a.important !== b.important) {\n return false;\n }\n\n if ((a.raws && !b.raws) || (!a.raws && b.raws)) {\n return false;\n }\n\n switch (a.type) {\n case 'rule':\n if (a.selector !== b.selector) {\n return false;\n }\n break;\n case 'atrule':\n if (a.name !== b.name || a.params !== b.params) {\n return false;\n }\n\n if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {\n return false;\n }\n\n if (\n a.raws &&\n trimValue(a.raws.afterName) !== trimValue(b.raws.afterName)\n ) {\n return false;\n }\n break;\n case 'decl':\n if (a.prop !== b.prop || a.value !== b.value) {\n return false;\n }\n\n if (a.raws && trimValue(a.raws.before) !== trimValue(b.raws.before)) {\n return false;\n }\n break;\n }\n\n if (a.nodes) {\n if (a.nodes.length !== b.nodes.length) {\n return false;\n }\n\n for (let i = 0; i < a.nodes.length; i++) {\n if (!equals(a.nodes[i], b.nodes[i])) {\n return false;\n }\n }\n }\n return true;\n}\n\n/**\n * @param {import('postcss').Rule} last\n * @param {import('postcss').AnyNode[]} nodes\n * @return {void}\n */\nfunction dedupeRule(last, nodes) {\n let index = nodes.indexOf(last) - 1;\n while (index >= 0) {\n const node = nodes[index--];\n if (node && node.type === 'rule' && node.selector === last.selector) {\n last.each((child) => {\n if (child.type === 'decl') {\n dedupeNode(child, node.nodes);\n }\n });\n\n if (empty(node)) {\n node.remove();\n }\n }\n }\n}\n\n/**\n * @param {import('postcss').AtRule | import('postcss').Declaration} last\n * @param {import('postcss').AnyNode[]} nodes\n * @return {void}\n */\nfunction dedupeNode(last, nodes) {\n let index = nodes.includes(last) ? nodes.indexOf(last) - 1 : nodes.length - 1;\n\n while (index >= 0) {\n const node = nodes[index--];\n if (node && equals(node, last)) {\n node.remove();\n }\n }\n}\n\n/**\n * @param {import('postcss').AnyNode} root\n * @return {void}\n */\nfunction dedupe(root) {\n const { nodes } =\n /** @type {import('postcss').Container<import('postcss').ChildNode>} */ (\n root\n );\n\n if (!nodes) {\n return;\n }\n\n let index = nodes.length - 1;\n while (index >= 0) {\n let last = nodes[index--];\n if (!last || !last.parent) {\n continue;\n }\n dedupe(last);\n if (last.type === 'rule') {\n dedupeRule(last, nodes);\n } else if (last.type === 'atrule' || last.type === 'decl') {\n dedupeNode(last, nodes);\n }\n }\n}\n\n/**\n * @type {import('postcss').PluginCreator<void>}\n * @return {import('postcss').Plugin}\n */\nfunction pluginCreator() {\n return {\n postcssPlugin: 'postcss-discard-duplicates',\n OnceExit(css) {\n dedupe(css);\n },\n };\n}\n\npluginCreator.postcss = true;\nmodule.exports = pluginCreator;\n"],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AACxB,mBAAW,MAAM,KAAK;AAAA,MAC5B,WAAe,KAAK,SAAS,YAAY,KAAK,SAAS,QAAQ;AACzD,mBAAW,MAAM,KAAK;AAAA,MAC5B;AAAA,IACA;AAAA,EACA;AAMA,WAAS,gBAAgB;AACvB,WAAO;AAAA,MACL,eAAe;AAAA,MACf,SAAS,KAAK;AACZ,eAAO,GAAG;AAAA,MAChB;AAAA;EAEA;AAEA,gBAAc,UAAU;AACxB,QAAiB;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,15 @@
1
+ export interface BaseProps {
2
+ element: HTMLElement;
3
+ }
4
+ interface BaseConfig extends BaseProps {
5
+ type: string;
6
+ }
7
+ export interface OptionalProps {
8
+ isDefaultStyling: boolean;
9
+ isRequired: boolean;
10
+ }
11
+ type SlotConfig = BaseConfig & Partial<OptionalProps>;
12
+ export type SlotResult = HTMLElement | null;
13
+ declare const createSlot: ({ element, type, isDefaultStyling, isRequired, }: SlotConfig) => SlotResult;
14
+ export { createSlot };
15
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../source/slots/create.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IAExB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,UAAW,SAAQ,SAAS;IACpC,IAAI,EAAE,MAAM,CAAC;CACd;AAKD,MAAM,WAAW,aAAa;IAE5B,gBAAgB,EAAE,OAAO,CAAC;IAE1B,UAAU,EAAE,OAAO,CAAC;CACrB;AAUD,KAAK,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAMtD,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,IAAI,CAAC;AAiD5C,QAAA,MAAM,UAAU,GAAI,kDAKjB,UAAU,KAAG,UAcf,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const createEmptySlot = (type) => {
4
+ const slot = document.createElement("slot");
5
+ slot.setAttribute("name", type);
6
+ return slot;
7
+ };
8
+ const validateSlotRequirements = (element, type, isRequired) => {
9
+ const errors = [];
10
+ const slottedContent = element.querySelector(`[slot="${type}"]`);
11
+ if (isRequired && !slottedContent) {
12
+ errors.push(`Required slot "${type}" is missing in ${element.tagName}`);
13
+ }
14
+ return {
15
+ isValid: errors.length === 0,
16
+ errors
17
+ };
18
+ };
19
+ const cloneWithoutSlotAttribute = (element) => {
20
+ const clone = element.cloneNode(true);
21
+ clone.removeAttribute("slot");
22
+ return clone;
23
+ };
24
+ const processDefaultStyling = (element, slotRef) => {
25
+ const elementRef = element.querySelector(
26
+ `:scope > [slot=${slotRef}]`
27
+ );
28
+ if (!elementRef) {
29
+ return null;
30
+ }
31
+ return elementRef.hasAttribute("styled") ? createEmptySlot(slotRef) : cloneWithoutSlotAttribute(elementRef);
32
+ };
33
+ const createSlot = ({
34
+ element,
35
+ type,
36
+ isDefaultStyling = true,
37
+ isRequired = false
38
+ }) => {
39
+ const validation = validateSlotRequirements(element, type, isRequired);
40
+ if (!validation.isValid) {
41
+ return null;
42
+ }
43
+ const slottedContent = element.querySelector(`[slot="${type}"]`);
44
+ if (!slottedContent) {
45
+ return null;
46
+ }
47
+ return isDefaultStyling ? processDefaultStyling(element, type) : createEmptySlot(type);
48
+ };
49
+ exports.createSlot = createSlot;
50
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sources":["../../source/slots/create.ts"],"sourcesContent":["/**\n * Base properties required for slot creation\n */\nexport interface BaseProps {\n /** The HTML element to extract slot content from */\n element: HTMLElement;\n}\n\ninterface BaseConfig extends BaseProps {\n type: string;\n}\n\n/**\n * Optional properties for slot configuration\n */\nexport interface OptionalProps {\n /** Whether to apply default styling to the slot content */\n isDefaultStyling: boolean;\n /** Whether this slot is required */\n isRequired: boolean;\n}\n\ninterface ValidatonErrors {\n errors: string[];\n}\n\ninterface SlotValidation extends ValidatonErrors {\n isValid: boolean;\n}\n\ntype SlotConfig = BaseConfig & Partial<OptionalProps>;\n\n/**\n * Result type for slot creation operations\n * Returns either the processed slot element or null if not found\n */\nexport type SlotResult = HTMLElement | null;\n\nconst createEmptySlot = (type: string): HTMLSlotElement => {\n const slot = document.createElement('slot');\n slot.setAttribute('name', type);\n return slot;\n};\n\nconst validateSlotRequirements = (\n element: HTMLElement,\n type: string,\n isRequired: boolean,\n): SlotValidation => {\n const errors: string[] = [];\n const slottedContent = element.querySelector(`[slot=\"${type}\"]`);\n\n if (isRequired && !slottedContent) {\n errors.push(`Required slot \"${type}\" is missing in ${element.tagName}`);\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n };\n};\n\nconst cloneWithoutSlotAttribute = (element: HTMLElement): HTMLElement => {\n const clone = element.cloneNode(true) as HTMLElement;\n clone.removeAttribute('slot');\n return clone;\n};\n\nconst processDefaultStyling = (\n element: HTMLElement,\n slotRef: string,\n): SlotResult => {\n const elementRef = element.querySelector(\n `:scope > [slot=${slotRef}]`,\n ) as HTMLElement;\n\n if (!elementRef) {\n return null;\n }\n\n return elementRef.hasAttribute('styled')\n ? createEmptySlot(slotRef)\n : cloneWithoutSlotAttribute(elementRef);\n};\n\nconst createSlot = ({\n element,\n type,\n isDefaultStyling = true,\n isRequired = false,\n}: SlotConfig): SlotResult => {\n const validation = validateSlotRequirements(element, type, isRequired);\n if (!validation.isValid) {\n return null;\n }\n\n const slottedContent = element.querySelector(`[slot=\"${type}\"]`);\n if (!slottedContent) {\n return null;\n }\n\n return isDefaultStyling\n ? processDefaultStyling(element, type)\n : createEmptySlot(type);\n};\n\nexport { createSlot };\n"],"names":[],"mappings":";;AAsCA,MAAM,kBAAkB,CAAC,SAAkC;AACzD,QAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,OAAK,aAAa,QAAQ,IAAI;AAC9B,SAAO;AACT;AAEA,MAAM,2BAA2B,CAC/B,SACA,MACA,eACmB;AACnB,QAAM,SAAmB,CAAA;AACzB,QAAM,iBAAiB,QAAQ,cAAc,UAAU,IAAI,IAAI;AAE/D,MAAI,cAAc,CAAC,gBAAgB;AACjC,WAAO,KAAK,kBAAkB,IAAI,mBAAmB,QAAQ,OAAO,EAAE;AAAA,EACxE;AAEA,SAAO;AAAA,IACL,SAAS,OAAO,WAAW;AAAA,IAC3B;AAAA,EAAA;AAEJ;AAEA,MAAM,4BAA4B,CAAC,YAAsC;AACvE,QAAM,QAAQ,QAAQ,UAAU,IAAI;AACpC,QAAM,gBAAgB,MAAM;AAC5B,SAAO;AACT;AAEA,MAAM,wBAAwB,CAC5B,SACA,YACe;AACf,QAAM,aAAa,QAAQ;AAAA,IACzB,kBAAkB,OAAO;AAAA,EAAA;AAG3B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AAEA,SAAO,WAAW,aAAa,QAAQ,IACnC,gBAAgB,OAAO,IACvB,0BAA0B,UAAU;AAC1C;AAEA,MAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB,aAAa;AACf,MAA8B;AAC5B,QAAM,aAAa,yBAAyB,SAAS,MAAM,UAAU;AACrE,MAAI,CAAC,WAAW,SAAS;AACvB,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB,QAAQ,cAAc,UAAU,IAAI,IAAI;AAC/D,MAAI,CAAC,gBAAgB;AACnB,WAAO;AAAA,EACT;AAEA,SAAO,mBACH,sBAAsB,SAAS,IAAI,IACnC,gBAAgB,IAAI;AAC1B;;"}
@@ -0,0 +1,50 @@
1
+ const createEmptySlot = (type) => {
2
+ const slot = document.createElement("slot");
3
+ slot.setAttribute("name", type);
4
+ return slot;
5
+ };
6
+ const validateSlotRequirements = (element, type, isRequired) => {
7
+ const errors = [];
8
+ const slottedContent = element.querySelector(`[slot="${type}"]`);
9
+ if (isRequired && !slottedContent) {
10
+ errors.push(`Required slot "${type}" is missing in ${element.tagName}`);
11
+ }
12
+ return {
13
+ isValid: errors.length === 0,
14
+ errors
15
+ };
16
+ };
17
+ const cloneWithoutSlotAttribute = (element) => {
18
+ const clone = element.cloneNode(true);
19
+ clone.removeAttribute("slot");
20
+ return clone;
21
+ };
22
+ const processDefaultStyling = (element, slotRef) => {
23
+ const elementRef = element.querySelector(
24
+ `:scope > [slot=${slotRef}]`
25
+ );
26
+ if (!elementRef) {
27
+ return null;
28
+ }
29
+ return elementRef.hasAttribute("styled") ? createEmptySlot(slotRef) : cloneWithoutSlotAttribute(elementRef);
30
+ };
31
+ const createSlot = ({
32
+ element,
33
+ type,
34
+ isDefaultStyling = true,
35
+ isRequired = false
36
+ }) => {
37
+ const validation = validateSlotRequirements(element, type, isRequired);
38
+ if (!validation.isValid) {
39
+ return null;
40
+ }
41
+ const slottedContent = element.querySelector(`[slot="${type}"]`);
42
+ if (!slottedContent) {
43
+ return null;
44
+ }
45
+ return isDefaultStyling ? processDefaultStyling(element, type) : createEmptySlot(type);
46
+ };
47
+ export {
48
+ createSlot
49
+ };
50
+ //# sourceMappingURL=create.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.mjs","sources":["../../source/slots/create.ts"],"sourcesContent":["/**\n * Base properties required for slot creation\n */\nexport interface BaseProps {\n /** The HTML element to extract slot content from */\n element: HTMLElement;\n}\n\ninterface BaseConfig extends BaseProps {\n type: string;\n}\n\n/**\n * Optional properties for slot configuration\n */\nexport interface OptionalProps {\n /** Whether to apply default styling to the slot content */\n isDefaultStyling: boolean;\n /** Whether this slot is required */\n isRequired: boolean;\n}\n\ninterface ValidatonErrors {\n errors: string[];\n}\n\ninterface SlotValidation extends ValidatonErrors {\n isValid: boolean;\n}\n\ntype SlotConfig = BaseConfig & Partial<OptionalProps>;\n\n/**\n * Result type for slot creation operations\n * Returns either the processed slot element or null if not found\n */\nexport type SlotResult = HTMLElement | null;\n\nconst createEmptySlot = (type: string): HTMLSlotElement => {\n const slot = document.createElement('slot');\n slot.setAttribute('name', type);\n return slot;\n};\n\nconst validateSlotRequirements = (\n element: HTMLElement,\n type: string,\n isRequired: boolean,\n): SlotValidation => {\n const errors: string[] = [];\n const slottedContent = element.querySelector(`[slot=\"${type}\"]`);\n\n if (isRequired && !slottedContent) {\n errors.push(`Required slot \"${type}\" is missing in ${element.tagName}`);\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n };\n};\n\nconst cloneWithoutSlotAttribute = (element: HTMLElement): HTMLElement => {\n const clone = element.cloneNode(true) as HTMLElement;\n clone.removeAttribute('slot');\n return clone;\n};\n\nconst processDefaultStyling = (\n element: HTMLElement,\n slotRef: string,\n): SlotResult => {\n const elementRef = element.querySelector(\n `:scope > [slot=${slotRef}]`,\n ) as HTMLElement;\n\n if (!elementRef) {\n return null;\n }\n\n return elementRef.hasAttribute('styled')\n ? createEmptySlot(slotRef)\n : cloneWithoutSlotAttribute(elementRef);\n};\n\nconst createSlot = ({\n element,\n type,\n isDefaultStyling = true,\n isRequired = false,\n}: SlotConfig): SlotResult => {\n const validation = validateSlotRequirements(element, type, isRequired);\n if (!validation.isValid) {\n return null;\n }\n\n const slottedContent = element.querySelector(`[slot=\"${type}\"]`);\n if (!slottedContent) {\n return null;\n }\n\n return isDefaultStyling\n ? processDefaultStyling(element, type)\n : createEmptySlot(type);\n};\n\nexport { createSlot };\n"],"names":[],"mappings":"AAsCA,MAAM,kBAAkB,CAAC,SAAkC;AACzD,QAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,OAAK,aAAa,QAAQ,IAAI;AAC9B,SAAO;AACT;AAEA,MAAM,2BAA2B,CAC/B,SACA,MACA,eACmB;AACnB,QAAM,SAAmB,CAAA;AACzB,QAAM,iBAAiB,QAAQ,cAAc,UAAU,IAAI,IAAI;AAE/D,MAAI,cAAc,CAAC,gBAAgB;AACjC,WAAO,KAAK,kBAAkB,IAAI,mBAAmB,QAAQ,OAAO,EAAE;AAAA,EACxE;AAEA,SAAO;AAAA,IACL,SAAS,OAAO,WAAW;AAAA,IAC3B;AAAA,EAAA;AAEJ;AAEA,MAAM,4BAA4B,CAAC,YAAsC;AACvE,QAAM,QAAQ,QAAQ,UAAU,IAAI;AACpC,QAAM,gBAAgB,MAAM;AAC5B,SAAO;AACT;AAEA,MAAM,wBAAwB,CAC5B,SACA,YACe;AACf,QAAM,aAAa,QAAQ;AAAA,IACzB,kBAAkB,OAAO;AAAA,EAAA;AAG3B,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AAEA,SAAO,WAAW,aAAa,QAAQ,IACnC,gBAAgB,OAAO,IACvB,0BAA0B,UAAU;AAC1C;AAEA,MAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB,aAAa;AACf,MAA8B;AAC5B,QAAM,aAAa,yBAAyB,SAAS,MAAM,UAAU;AACrE,MAAI,CAAC,WAAW,SAAS;AACvB,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB,QAAQ,cAAc,UAAU,IAAI,IAAI;AAC/D,MAAI,CAAC,gBAAgB;AACnB,WAAO;AAAA,EACT;AAEA,SAAO,mBACH,sBAAsB,SAAS,IAAI,IACnC,gBAAgB,IAAI;AAC1B;"}
@@ -0,0 +1,3 @@
1
+ import { SlotConfig } from '../_types';
2
+ export declare const allowed: Record<string, SlotConfig>;
3
+ //# sourceMappingURL=element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../source/slots/element.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAW5C,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAoC9C,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const subHeadlineElements = ["h2", "h3", "h4", "h5", "h6", "p", "a", "span"];
4
+ const textElements = ["div", "p", "span", "strong"];
5
+ const allowed = {
6
+ actions: {
7
+ allowedElements: ["div", "a", "button", "umd-element-call-to-action"]
8
+ },
9
+ body: {
10
+ deprecated: 'Use "text" instead. This attribute will be removed in version 2.0.',
11
+ allowedElements: [...textElements]
12
+ },
13
+ content: {
14
+ allowedElements: ["div"]
15
+ },
16
+ eyebrow: {
17
+ allowedElements: ["span", "p"]
18
+ },
19
+ headline: {
20
+ allowedElements: ["h1", ...subHeadlineElements]
21
+ },
22
+ image: {
23
+ allowedElements: ["img"]
24
+ },
25
+ images: {
26
+ allowedElements: ["div"]
27
+ },
28
+ imageLink: {
29
+ allowedElements: ["img", "a"]
30
+ },
31
+ subHeadline: {
32
+ allowedElements: subHeadlineElements
33
+ },
34
+ text: {
35
+ allowedElements: [...textElements]
36
+ },
37
+ time: {
38
+ allowedElements: ["time"]
39
+ }
40
+ };
41
+ exports.allowed = allowed;
42
+ //# sourceMappingURL=element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.js","sources":["../../source/slots/element.ts"],"sourcesContent":["/**\n * Common Slot Configurations\n *\n * This module provides pre-defined slot configurations that are commonly used\n * across multiple components. These configurations ensure consistency in how\n * components accept and validate slotted content.\n */\n\nimport type { SlotConfig } from '../_types';\n\nconst subHeadlineElements = ['h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'span'];\nconst textElements = ['div', 'p', 'span', 'strong'];\n\n/**\n * Common slot configurations used across multiple components\n *\n * These pre-defined configurations promote consistency and reduce duplication\n * when defining component slots.\n */\nexport const allowed: Record<string, SlotConfig> = {\n actions: {\n allowedElements: ['div', 'a', 'button', 'umd-element-call-to-action'],\n },\n body: {\n deprecated:\n 'Use \"text\" instead. This attribute will be removed in version 2.0.',\n allowedElements: [...textElements],\n },\n content: {\n allowedElements: ['div'],\n },\n eyebrow: {\n allowedElements: ['span', 'p'],\n },\n headline: {\n allowedElements: ['h1', ...subHeadlineElements],\n },\n image: {\n allowedElements: ['img'],\n },\n images: {\n allowedElements: ['div'],\n },\n imageLink: {\n allowedElements: ['img', 'a'],\n },\n subHeadline: {\n allowedElements: subHeadlineElements,\n },\n text: {\n allowedElements: [...textElements],\n },\n time: {\n allowedElements: ['time'],\n },\n};\n"],"names":[],"mappings":";;AAUA,MAAM,sBAAsB,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK,KAAK,MAAM;AAC3E,MAAM,eAAe,CAAC,OAAO,KAAK,QAAQ,QAAQ;AAQ3C,MAAM,UAAsC;AAAA,EACjD,SAAS;AAAA,IACP,iBAAiB,CAAC,OAAO,KAAK,UAAU,4BAA4B;AAAA,EAAA;AAAA,EAEtE,MAAM;AAAA,IACJ,YACE;AAAA,IACF,iBAAiB,CAAC,GAAG,YAAY;AAAA,EAAA;AAAA,EAEnC,SAAS;AAAA,IACP,iBAAiB,CAAC,KAAK;AAAA,EAAA;AAAA,EAEzB,SAAS;AAAA,IACP,iBAAiB,CAAC,QAAQ,GAAG;AAAA,EAAA;AAAA,EAE/B,UAAU;AAAA,IACR,iBAAiB,CAAC,MAAM,GAAG,mBAAmB;AAAA,EAAA;AAAA,EAEhD,OAAO;AAAA,IACL,iBAAiB,CAAC,KAAK;AAAA,EAAA;AAAA,EAEzB,QAAQ;AAAA,IACN,iBAAiB,CAAC,KAAK;AAAA,EAAA;AAAA,EAEzB,WAAW;AAAA,IACT,iBAAiB,CAAC,OAAO,GAAG;AAAA,EAAA;AAAA,EAE9B,aAAa;AAAA,IACX,iBAAiB;AAAA,EAAA;AAAA,EAEnB,MAAM;AAAA,IACJ,iBAAiB,CAAC,GAAG,YAAY;AAAA,EAAA;AAAA,EAEnC,MAAM;AAAA,IACJ,iBAAiB,CAAC,MAAM;AAAA,EAAA;AAE5B;;"}
@@ -0,0 +1,42 @@
1
+ const subHeadlineElements = ["h2", "h3", "h4", "h5", "h6", "p", "a", "span"];
2
+ const textElements = ["div", "p", "span", "strong"];
3
+ const allowed = {
4
+ actions: {
5
+ allowedElements: ["div", "a", "button", "umd-element-call-to-action"]
6
+ },
7
+ body: {
8
+ deprecated: 'Use "text" instead. This attribute will be removed in version 2.0.',
9
+ allowedElements: [...textElements]
10
+ },
11
+ content: {
12
+ allowedElements: ["div"]
13
+ },
14
+ eyebrow: {
15
+ allowedElements: ["span", "p"]
16
+ },
17
+ headline: {
18
+ allowedElements: ["h1", ...subHeadlineElements]
19
+ },
20
+ image: {
21
+ allowedElements: ["img"]
22
+ },
23
+ images: {
24
+ allowedElements: ["div"]
25
+ },
26
+ imageLink: {
27
+ allowedElements: ["img", "a"]
28
+ },
29
+ subHeadline: {
30
+ allowedElements: subHeadlineElements
31
+ },
32
+ text: {
33
+ allowedElements: [...textElements]
34
+ },
35
+ time: {
36
+ allowedElements: ["time"]
37
+ }
38
+ };
39
+ export {
40
+ allowed
41
+ };
42
+ //# sourceMappingURL=element.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.mjs","sources":["../../source/slots/element.ts"],"sourcesContent":["/**\n * Common Slot Configurations\n *\n * This module provides pre-defined slot configurations that are commonly used\n * across multiple components. These configurations ensure consistency in how\n * components accept and validate slotted content.\n */\n\nimport type { SlotConfig } from '../_types';\n\nconst subHeadlineElements = ['h2', 'h3', 'h4', 'h5', 'h6', 'p', 'a', 'span'];\nconst textElements = ['div', 'p', 'span', 'strong'];\n\n/**\n * Common slot configurations used across multiple components\n *\n * These pre-defined configurations promote consistency and reduce duplication\n * when defining component slots.\n */\nexport const allowed: Record<string, SlotConfig> = {\n actions: {\n allowedElements: ['div', 'a', 'button', 'umd-element-call-to-action'],\n },\n body: {\n deprecated:\n 'Use \"text\" instead. This attribute will be removed in version 2.0.',\n allowedElements: [...textElements],\n },\n content: {\n allowedElements: ['div'],\n },\n eyebrow: {\n allowedElements: ['span', 'p'],\n },\n headline: {\n allowedElements: ['h1', ...subHeadlineElements],\n },\n image: {\n allowedElements: ['img'],\n },\n images: {\n allowedElements: ['div'],\n },\n imageLink: {\n allowedElements: ['img', 'a'],\n },\n subHeadline: {\n allowedElements: subHeadlineElements,\n },\n text: {\n allowedElements: [...textElements],\n },\n time: {\n allowedElements: ['time'],\n },\n};\n"],"names":[],"mappings":"AAUA,MAAM,sBAAsB,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK,KAAK,MAAM;AAC3E,MAAM,eAAe,CAAC,OAAO,KAAK,QAAQ,QAAQ;AAQ3C,MAAM,UAAsC;AAAA,EACjD,SAAS;AAAA,IACP,iBAAiB,CAAC,OAAO,KAAK,UAAU,4BAA4B;AAAA,EAAA;AAAA,EAEtE,MAAM;AAAA,IACJ,YACE;AAAA,IACF,iBAAiB,CAAC,GAAG,YAAY;AAAA,EAAA;AAAA,EAEnC,SAAS;AAAA,IACP,iBAAiB,CAAC,KAAK;AAAA,EAAA;AAAA,EAEzB,SAAS;AAAA,IACP,iBAAiB,CAAC,QAAQ,GAAG;AAAA,EAAA;AAAA,EAE/B,UAAU;AAAA,IACR,iBAAiB,CAAC,MAAM,GAAG,mBAAmB;AAAA,EAAA;AAAA,EAEhD,OAAO;AAAA,IACL,iBAAiB,CAAC,KAAK;AAAA,EAAA;AAAA,EAEzB,QAAQ;AAAA,IACN,iBAAiB,CAAC,KAAK;AAAA,EAAA;AAAA,EAEzB,WAAW;AAAA,IACT,iBAAiB,CAAC,OAAO,GAAG;AAAA,EAAA;AAAA,EAE9B,aAAa;AAAA,IACX,iBAAiB;AAAA,EAAA;AAAA,EAEnB,MAAM;AAAA,IACJ,iBAAiB,CAAC,GAAG,YAAY;AAAA,EAAA;AAAA,EAEnC,MAAM;AAAA,IACJ,iBAAiB,CAAC,MAAM;AAAA,EAAA;AAE5B;"}
@@ -0,0 +1,6 @@
1
+ declare const extractSlot: ({ element, type, }: {
2
+ element: HTMLElement;
3
+ type: string;
4
+ }) => HTMLElement | null;
5
+ export { extractSlot };
6
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../source/slots/extract.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,WAAW,GAAI,oBAGlB;IACD,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,KAAG,WAAW,GAAG,IAQjB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}