cssier 0.2.1 → 0.2.3

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 (184) hide show
  1. package/LICENSE +12 -18
  2. package/README.md +20 -8
  3. package/dist/components/A.d.ts +1 -1
  4. package/dist/components/Abbr.d.ts +1 -1
  5. package/dist/components/Address.d.ts +1 -1
  6. package/dist/components/Animate.d.ts +1 -1
  7. package/dist/components/AnimateTransform.d.ts +1 -1
  8. package/dist/components/Area.d.ts +1 -1
  9. package/dist/components/Article.d.ts +1 -1
  10. package/dist/components/Aside.d.ts +1 -1
  11. package/dist/components/Audio.d.ts +1 -1
  12. package/dist/components/B.d.ts +1 -1
  13. package/dist/components/Base.d.ts +1 -1
  14. package/dist/components/Bdi.d.ts +1 -1
  15. package/dist/components/Bdo.d.ts +1 -1
  16. package/dist/components/Blockquote.d.ts +1 -1
  17. package/dist/components/Body.d.ts +1 -1
  18. package/dist/components/Br.d.ts +1 -1
  19. package/dist/components/Button.d.ts +1 -1
  20. package/dist/components/Canvas.d.ts +1 -1
  21. package/dist/components/Caption.d.ts +1 -1
  22. package/dist/components/Circle.d.ts +1 -1
  23. package/dist/components/Cite.d.ts +1 -1
  24. package/dist/components/ClipPath.d.ts +1 -1
  25. package/dist/components/Code.d.ts +1 -1
  26. package/dist/components/Col.d.ts +1 -1
  27. package/dist/components/Colgroup.d.ts +1 -1
  28. package/dist/components/Data.d.ts +1 -1
  29. package/dist/components/Datalist.d.ts +1 -1
  30. package/dist/components/Dd.d.ts +1 -1
  31. package/dist/components/Defs.d.ts +1 -1
  32. package/dist/components/Del.d.ts +1 -1
  33. package/dist/components/Desc.d.ts +1 -1
  34. package/dist/components/Details.d.ts +1 -1
  35. package/dist/components/Dfn.d.ts +1 -1
  36. package/dist/components/Dialog.d.ts +1 -1
  37. package/dist/components/Div.d.ts +1 -1
  38. package/dist/components/Dl.d.ts +1 -1
  39. package/dist/components/Dt.d.ts +1 -1
  40. package/dist/components/Ellipse.d.ts +1 -1
  41. package/dist/components/Em.d.ts +1 -1
  42. package/dist/components/Embed.d.ts +1 -1
  43. package/dist/components/FeBlend.d.ts +1 -1
  44. package/dist/components/FeColorMatrix.d.ts +1 -1
  45. package/dist/components/FeComponentTransfer.d.ts +1 -1
  46. package/dist/components/FeComposite.d.ts +1 -1
  47. package/dist/components/FeConvolveMatrix.d.ts +1 -1
  48. package/dist/components/FeDiffuseLighting.d.ts +1 -1
  49. package/dist/components/FeDisplacementMap.d.ts +1 -1
  50. package/dist/components/FeDistantLight.d.ts +1 -1
  51. package/dist/components/FeFlood.d.ts +1 -1
  52. package/dist/components/FeGaussianBlur.d.ts +1 -1
  53. package/dist/components/FeImage.d.ts +1 -1
  54. package/dist/components/FeMerge.d.ts +1 -1
  55. package/dist/components/FeMergeNode.d.ts +1 -1
  56. package/dist/components/FeMorphology.d.ts +1 -1
  57. package/dist/components/FeOffset.d.ts +1 -1
  58. package/dist/components/FePointLight.d.ts +1 -1
  59. package/dist/components/FeSpecularLighting.d.ts +1 -1
  60. package/dist/components/FeSpotLight.d.ts +1 -1
  61. package/dist/components/FeTile.d.ts +1 -1
  62. package/dist/components/FeTurbulence.d.ts +1 -1
  63. package/dist/components/Fieldset.d.ts +1 -1
  64. package/dist/components/Figcaption.d.ts +1 -1
  65. package/dist/components/Figure.d.ts +1 -1
  66. package/dist/components/Filter.d.ts +1 -1
  67. package/dist/components/Footer.d.ts +1 -1
  68. package/dist/components/ForeignObject.d.ts +1 -1
  69. package/dist/components/Form.d.ts +1 -1
  70. package/dist/components/G.d.ts +1 -1
  71. package/dist/components/H1.d.ts +1 -1
  72. package/dist/components/H2.d.ts +1 -1
  73. package/dist/components/H3.d.ts +1 -1
  74. package/dist/components/H4.d.ts +1 -1
  75. package/dist/components/H5.d.ts +1 -1
  76. package/dist/components/H6.d.ts +1 -1
  77. package/dist/components/Head.d.ts +1 -1
  78. package/dist/components/Header.d.ts +1 -1
  79. package/dist/components/Hgroup.d.ts +1 -1
  80. package/dist/components/Hr.d.ts +1 -1
  81. package/dist/components/Html.d.ts +1 -1
  82. package/dist/components/I.d.ts +1 -1
  83. package/dist/components/Iframe.d.ts +1 -1
  84. package/dist/components/Image.d.ts +1 -1
  85. package/dist/components/Img.d.ts +1 -1
  86. package/dist/components/Input.d.ts +1 -1
  87. package/dist/components/Ins.d.ts +1 -1
  88. package/dist/components/Kbd.d.ts +1 -1
  89. package/dist/components/Label.d.ts +1 -1
  90. package/dist/components/Legend.d.ts +1 -1
  91. package/dist/components/Li.d.ts +1 -1
  92. package/dist/components/Line.d.ts +1 -1
  93. package/dist/components/LinearGradient.d.ts +1 -1
  94. package/dist/components/Link.d.ts +1 -1
  95. package/dist/components/Main.d.ts +1 -1
  96. package/dist/components/Map.d.ts +1 -1
  97. package/dist/components/Mark.d.ts +1 -1
  98. package/dist/components/Marker.d.ts +1 -1
  99. package/dist/components/Mask.d.ts +1 -1
  100. package/dist/components/Meta.d.ts +1 -1
  101. package/dist/components/Metadata.d.ts +1 -1
  102. package/dist/components/Meter.d.ts +1 -1
  103. package/dist/components/Mpath.d.ts +1 -1
  104. package/dist/components/Nav.d.ts +1 -1
  105. package/dist/components/Noscript.d.ts +1 -1
  106. package/dist/components/Object.d.ts +1 -1
  107. package/dist/components/Ol.d.ts +1 -1
  108. package/dist/components/Optgroup.d.ts +1 -1
  109. package/dist/components/Option.d.ts +1 -1
  110. package/dist/components/Output.d.ts +1 -1
  111. package/dist/components/P.d.ts +1 -1
  112. package/dist/components/Param.d.ts +1 -1
  113. package/dist/components/Path.d.ts +1 -1
  114. package/dist/components/Pattern.d.ts +1 -1
  115. package/dist/components/Picture.d.ts +1 -1
  116. package/dist/components/Polygon.d.ts +1 -1
  117. package/dist/components/Polyline.d.ts +1 -1
  118. package/dist/components/Pre.d.ts +1 -1
  119. package/dist/components/Progress.d.ts +1 -1
  120. package/dist/components/Q.d.ts +1 -1
  121. package/dist/components/RadialGradient.d.ts +1 -1
  122. package/dist/components/Rect.d.ts +1 -1
  123. package/dist/components/Rp.d.ts +1 -1
  124. package/dist/components/Rt.d.ts +1 -1
  125. package/dist/components/Ruby.d.ts +1 -1
  126. package/dist/components/S.d.ts +1 -1
  127. package/dist/components/Samp.d.ts +1 -1
  128. package/dist/components/Script.d.ts +1 -1
  129. package/dist/components/Section.d.ts +1 -1
  130. package/dist/components/Select.d.ts +1 -1
  131. package/dist/components/Small.d.ts +1 -1
  132. package/dist/components/Source.d.ts +1 -1
  133. package/dist/components/Span.d.ts +1 -1
  134. package/dist/components/Stop.d.ts +1 -1
  135. package/dist/components/Strong.d.ts +1 -1
  136. package/dist/components/Style.d.ts +1 -1
  137. package/dist/components/Sub.d.ts +1 -1
  138. package/dist/components/Summary.d.ts +1 -1
  139. package/dist/components/Sup.d.ts +1 -1
  140. package/dist/components/Svg.d.ts +1 -1
  141. package/dist/components/Switch.d.ts +1 -1
  142. package/dist/components/Symbol.d.ts +1 -1
  143. package/dist/components/Table.d.ts +1 -1
  144. package/dist/components/Tbody.d.ts +1 -1
  145. package/dist/components/Td.d.ts +1 -1
  146. package/dist/components/Template.d.ts +1 -1
  147. package/dist/components/Text.d.ts +1 -1
  148. package/dist/components/TextPath.d.ts +1 -1
  149. package/dist/components/Textarea.d.ts +1 -1
  150. package/dist/components/Tfoot.d.ts +1 -1
  151. package/dist/components/Th.d.ts +1 -1
  152. package/dist/components/Thead.d.ts +1 -1
  153. package/dist/components/Time.d.ts +1 -1
  154. package/dist/components/Title.d.ts +1 -1
  155. package/dist/components/Tr.d.ts +1 -1
  156. package/dist/components/Tspan.d.ts +1 -1
  157. package/dist/components/U.d.ts +1 -1
  158. package/dist/components/Ul.d.ts +1 -1
  159. package/dist/components/Use.d.ts +1 -1
  160. package/dist/components/Var.d.ts +1 -1
  161. package/dist/components/Video.d.ts +1 -1
  162. package/dist/components/View.d.ts +1 -1
  163. package/dist/components/Wbr.d.ts +1 -1
  164. package/dist/components/index.d.ts +14 -14
  165. package/dist/components/index.js +805 -162
  166. package/dist/consts.d.ts +1 -1
  167. package/dist/cssier.js +165 -805
  168. package/dist/hooks/index.d.ts +2 -0
  169. package/dist/hooks/index.js +72 -189
  170. package/dist/hooks/useAnimation.d.ts +2 -0
  171. package/dist/hooks/useCssProperty.d.ts +2 -0
  172. package/dist/hooks/useStylesheet.d.ts +1 -1
  173. package/dist/index.d.ts +16 -14
  174. package/dist/templates/ChildlessComponentTemplate.d.ts +6 -0
  175. package/dist/templates/ChildlessStoryTemplate.d.ts +6 -0
  176. package/dist/templates/ComponentTemplate.d.ts +1 -1
  177. package/dist/templates/InputStoryTemplate.d.ts +6 -0
  178. package/dist/types.d.ts +23 -2
  179. package/dist/useStylesheet-42306f27.mjs +212 -0
  180. package/dist/utilities/createAnimation.d.ts +2 -0
  181. package/dist/utilities/createCssProperty.d.ts +2 -0
  182. package/dist/utilities/generateId.d.ts +1 -0
  183. package/dist/utilities/index.d.ts +4 -0
  184. package/package.json +20 -2
@@ -1 +1,3 @@
1
1
  export { default as useStylesheet } from './useStylesheet';
2
+ export { default as useAnimation } from './useAnimation';
3
+ export { default as useCssProperty } from './useCssProperty';
@@ -1,198 +1,81 @@
1
- import { useState as o, useEffect as d } from "react";
2
- const p = [
3
- "active",
4
- "checked",
5
- "disabled",
6
- "empty",
7
- "enabled",
8
- "firstChild",
9
- "firstOfType",
10
- "focus",
11
- "hover",
12
- "inRange",
13
- "invalid",
14
- "lastChild",
15
- "lastOfType",
16
- "link",
17
- "not",
18
- "nthChild",
19
- "nthLastChild",
20
- "nthLastOfType",
21
- "nthOfType",
22
- "onlyOfType",
23
- "onlyChild",
24
- "optional",
25
- "outOfRange",
26
- "readOnly",
27
- "readWrite",
28
- "required",
29
- "root",
30
- "target",
31
- "valid",
32
- "visited"
33
- ], s = [
34
- // Shadow DOM elements
35
- "part",
36
- "theme",
37
- // Shadow DOM elements for specific controls
38
- "part(container)",
39
- "part(label)",
40
- "part(option)",
41
- "part(item)",
42
- "part(placeholder)",
43
- "part(header)",
44
- "part(footer)",
45
- "part(overlay)",
46
- "part(menu)",
47
- "part(menuitem)",
48
- "part(list)",
49
- "part(listitem)",
50
- "part(progress-bar)",
51
- "part(progress-value)",
52
- "part(input-container)",
53
- "part(input)",
54
- "part(select)",
55
- "part(option-group)",
56
- "part(option-item)",
57
- "part(button)",
58
- "part(dialog)",
59
- "part(menu-button)",
60
- "part(tablist)",
61
- "part(tab)",
62
- "part(tab-panel)",
63
- "part(carousel)",
64
- "part(slider)",
65
- "part(tooltip)",
66
- "part(radio)",
67
- "part(checkbox)",
68
- "part(switch)",
69
- "part(range)",
70
- "part(textarea)",
71
- "part(search)",
72
- "part(navbar)",
73
- "part(breadcrumbs)",
74
- // Standard pseudoelements
75
- "before",
76
- "after",
77
- "first-line",
78
- "first-letter",
79
- "selection",
80
- "placeholder",
81
- "backdrop",
82
- "marker",
83
- // WebKit-prefixed pseudoelements
84
- "-webkit-before",
85
- "-webkit-after",
86
- "-webkit-first-line",
87
- "-webkit-first-letter",
88
- "-webkit-selection",
89
- "-webkit-placeholder",
90
- "-webkit-backdrop",
91
- "-webkit-marker",
92
- // WebKit scrollbar pseudo-elements
93
- "-webkit-scrollbar",
94
- "-webkit-scrollbar-thumb",
95
- "-webkit-scrollbar-track",
96
- "-webkit-scrollbar-track-piece",
97
- "-webkit-scrollbar-corner",
98
- "-webkit-scrollbar-button",
99
- "-webkit-resizer",
100
- // Other WebKit-prefixed pseudoelements
101
- "-webkit-file-upload-button",
102
- "-webkit-inner-spin-button",
103
- "-webkit-outer-spin-button",
104
- "-webkit-progress-bar",
105
- "-webkit-progress-value",
106
- "-webkit-progress-inner-element",
107
- "-webkit-progress-outer-element",
108
- // Additional pseudo-elements related to shadow DOM and Web Components
109
- "slotted(*)",
110
- "slotted(div)",
111
- "slotted(span)",
112
- "slotted(p)",
113
- "slotted(a)",
114
- "slotted(img)",
115
- "slotted(button)",
116
- "slotted(input)",
117
- // Custom and experimental shadow DOM parts (subject to changes)
118
- "part(dialog-overlay)",
119
- "part(tab-content)",
120
- "part(slider-track)",
121
- "part(slider-thumb)",
122
- "part(menu-icon)",
123
- "part(menu-label)",
124
- "part(list-group)",
125
- "part(list-item)"
126
- ];
127
- function k(t, r) {
128
- if (!r) {
129
- const a = document.head.querySelector(`style#${t}`);
130
- return a && a.remove(), "";
1
+ import { g as $ } from "../useStylesheet-42306f27.mjs";
2
+ import { u as V } from "../useStylesheet-42306f27.mjs";
3
+ import { useState as s, useEffect as d } from "react";
4
+ function v(t, e) {
5
+ if (!e) {
6
+ const y = document.head.querySelector(`style#${t}`);
7
+ return y && y.remove(), "";
131
8
  }
132
- let e = document.head.querySelector(`style#${t}`);
133
- e || (e = document.createElement("style"), e.id = t, e.type = "text/css", document.head.appendChild(e));
9
+ let a = document.head.querySelector(`style#${t}`);
10
+ console.log(t), a || (a = document.createElement("style"), a.id = t, a.type = "text/css", document.head.appendChild(a));
134
11
  let n = "";
135
- return Object.entries(r).forEach(([a, l]) => {
136
- let i = "";
137
- a === "neutral" ? i = `.${t}` : p.includes(a) ? i = `.${t}:${a}` : s.includes(a) ? i = `.${t}::${a}` : (console.error(`Invalid pseudo class: ${a}`), console.log(
138
- p,
139
- s,
140
- a,
141
- a in p,
142
- a in s
143
- )), n += `${i} { ${Object.entries(l).map(([f, b]) => `${f.replace(/[A-Z]/g, (u) => `-${u.toLowerCase()}`)}: ${b}`).join("; ")} }`;
144
- }), e.textContent = n, n;
12
+ n += `@keyframes ${e.name} {`, Object.entries(e.keyframes).forEach(([y, g]) => {
13
+ n += `${y} {
14
+ `, n += Object.entries(g).map(([h, C]) => `${h.replace(/[A-Z]/g, (x) => `-${x.toLowerCase()}`)}: ${C}`).join(`;
15
+ `), n += `
145
16
  }
146
- function c(t, r) {
147
- if (t == null && r == null)
148
- return !0;
149
- if (t == null && typeof r == "object" || r == null && typeof t == "object" || Object.keys(t).length !== Object.keys(r).length)
150
- return !1;
151
- for (const e in t)
152
- if (t[e] !== r[e])
153
- return typeof t[e] == "object" && typeof r[e] == "object" && !c(t[e], r[e]), !1;
154
- return !0;
17
+ `;
18
+ }), n += `}
19
+ `, n += `.${t} {
20
+ `;
21
+ const r = e.delay ?? "0s", u = e.direction ?? "normal", i = e.duration ?? "2s", c = e.fillMode ?? "none", l = e.iterationCount ?? "1", m = e.playState ?? "running", f = e.timingFunction ?? "ease";
22
+ n += ` animation-name: ${e.name};
23
+ `, e.delay && (n += ` animation-delay: ${r};
24
+ `), e.direction && (n += ` animation-direction: ${u};
25
+ `), e.duration && (n += ` animation-duration: ${i};
26
+ `), e.fillMode && (n += ` animation-fill-mode: ${c};
27
+ `), e.iterationCount && (n += ` animation-iteration-count: ${l};
28
+ `), e.playState && (n += ` animation-play-state: ${m};
29
+ `), e.timingFunction && (n += ` animation-timing-function: ${f};
30
+ `), n += `}
31
+ `, a.textContent = n;
32
+ const S = `${e.name} ${i} ${f} ${r} ${l} ${u} ${c} ${m}`;
33
+ return [n, S];
155
34
  }
156
- const h = [
157
- "A",
158
- "B",
159
- "C",
160
- "D",
161
- "E",
162
- "F",
163
- "G",
164
- "H",
165
- "I",
166
- "J",
167
- "K",
168
- "L",
169
- "M",
170
- "N",
171
- "O",
172
- "P",
173
- "Q",
174
- "R",
175
- "S",
176
- "T",
177
- "U",
178
- "V",
179
- "W",
180
- "X",
181
- "Y",
182
- "Z"
183
- ];
184
- function m() {
185
- let t = "";
186
- for (let r = 0; r < 6; r++)
187
- t += h[Math.floor(Math.random() * 24)];
188
- return t;
35
+ function p(t) {
36
+ const e = Array.isArray(t.syntax) ? t.syntax.join(", ") : t.syntax;
37
+ return `@property ${t.name} {
38
+ syntax: ${e};
39
+ inherits: ${t.inherits};
40
+ initial-value: ${t.initialValue};
189
41
  }
190
- function w(t, r) {
191
- const [e] = o(() => r ?? m()), [n, a] = o({}), [l, i] = o("");
42
+
43
+ body{
44
+ ${t.name}: ${t.initialValue};
45
+ }
46
+ `;
47
+ }
48
+ function P(t, e) {
49
+ if (!e) {
50
+ const r = document.head.querySelector(`style#${t}`);
51
+ return r && r.remove(), "";
52
+ }
53
+ let a = document.head.querySelector(`style#${t}`);
54
+ a || (a = document.createElement("style"), a.id = t, a.type = "text/css", document.head.appendChild(a));
55
+ let n = p(e);
56
+ return a.textContent = n, n;
57
+ }
58
+ function k(t, e) {
59
+ return t == null && e == null ? !0 : !(t == null && typeof e == "object" || e == null && typeof t == "object" || Object.keys(t).length !== Object.keys(e).length || (t == null ? void 0 : t.duration) !== (e == null ? void 0 : e.duration) || (t == null ? void 0 : t.delay) !== (e == null ? void 0 : e.delay) || (t == null ? void 0 : t.direction) !== (e == null ? void 0 : e.direction) || (t == null ? void 0 : t.fillMode) !== (e == null ? void 0 : e.fillMode) || (t == null ? void 0 : t.iterationCount) !== (e == null ? void 0 : e.iterationCount) || (t == null ? void 0 : t.name) !== (e == null ? void 0 : e.name) || (t == null ? void 0 : t.playState) !== (e == null ? void 0 : e.playState) || (t == null ? void 0 : t.timingFunction) !== (e == null ? void 0 : e.timingFunction) || JSON.stringify(t == null ? void 0 : t.keyframes) !== JSON.stringify(e == null ? void 0 : e.keyframes));
60
+ }
61
+ function A(t, e) {
62
+ const [a] = s(() => e ?? $()), [n, r] = s({}), [u, i] = s(""), [c, l] = s("");
63
+ return d(() => {
64
+ if (!k(n, t)) {
65
+ r(t);
66
+ const [m, f] = v(a, t);
67
+ i(m), l(f);
68
+ }
69
+ }, [a, t, n, i]), [a, c, u];
70
+ }
71
+ function F(t, e) {
72
+ const [a] = s(() => e ?? $()), [n, r] = s("");
192
73
  return d(() => {
193
- c(n, t) || (a(t), i(k(e, t)));
194
- }, [e, t, n, i]), [e, l];
74
+ r(P(a, t));
75
+ }, [a, r, t]), [a, `var(${t.name})`, n];
195
76
  }
196
77
  export {
197
- w as useStylesheet
78
+ A as useAnimation,
79
+ F as useCssProperty,
80
+ V as useStylesheet
198
81
  };
@@ -0,0 +1,2 @@
1
+ import type { AnimationDefinition } from '../types';
2
+ export default function useAnimation(styles: AnimationDefinition, animationId?: string): string[];
@@ -0,0 +1,2 @@
1
+ import type { ICssProperty } from '../types';
2
+ export default function useStylesheet(property: ICssProperty, propertyId?: string): string[];
@@ -1,2 +1,2 @@
1
- import { PseudoCss } from '../types';
1
+ import type { PseudoCss } from '../types';
2
2
  export default function useStylesheet(styles: PseudoCss | undefined, pseudoId?: string): string[];
package/dist/index.d.ts CHANGED
@@ -1,24 +1,21 @@
1
+ export { default as useAnimation } from './hooks/useAnimation';
2
+ export { default as useCssProperty } from './hooks/useCssProperty';
1
3
  export { default as useStylesheet } from './hooks/useStylesheet';
2
4
  export { default as A } from './components/A';
3
5
  export { default as Abbr } from './components/Abbr';
4
6
  export { default as Address } from './components/Address';
5
- export { default as Area } from './components/Area';
6
7
  export { default as Article } from './components/Article';
7
8
  export { default as Aside } from './components/Aside';
8
- export { default as Audio } from './components/Audio';
9
9
  export { default as B } from './components/B';
10
- export { default as Base } from './components/Base';
11
10
  export { default as Bdi } from './components/Bdi';
12
11
  export { default as Bdo } from './components/Bdo';
13
12
  export { default as Blockquote } from './components/Blockquote';
14
13
  export { default as Body } from './components/Body';
15
- export { default as Br } from './components/Br';
16
14
  export { default as Button } from './components/Button';
17
15
  export { default as Canvas } from './components/Canvas';
18
16
  export { default as Caption } from './components/Caption';
19
17
  export { default as Cite } from './components/Cite';
20
18
  export { default as Code } from './components/Code';
21
- export { default as Col } from './components/Col';
22
19
  export { default as Colgroup } from './components/Colgroup';
23
20
  export { default as Data } from './components/Data';
24
21
  export { default as Datalist } from './components/Datalist';
@@ -31,7 +28,6 @@ export { default as Div } from './components/Div';
31
28
  export { default as Dl } from './components/Dl';
32
29
  export { default as Dt } from './components/Dt';
33
30
  export { default as Em } from './components/Em';
34
- export { default as Embed } from './components/Embed';
35
31
  export { default as Fieldset } from './components/Fieldset';
36
32
  export { default as Figcaption } from './components/Figcaption';
37
33
  export { default as Figure } from './components/Figure';
@@ -46,22 +42,17 @@ export { default as H6 } from './components/H6';
46
42
  export { default as Head } from './components/Head';
47
43
  export { default as Header } from './components/Header';
48
44
  export { default as Hgroup } from './components/Hgroup';
49
- export { default as Hr } from './components/Hr';
50
45
  export { default as Html } from './components/Html';
51
46
  export { default as I } from './components/I';
52
47
  export { default as Iframe } from './components/Iframe';
53
- export { default as Img } from './components/Img';
54
- export { default as Input } from './components/Input';
55
48
  export { default as Ins } from './components/Ins';
56
49
  export { default as Kbd } from './components/Kbd';
57
50
  export { default as Label } from './components/Label';
58
51
  export { default as Legend } from './components/Legend';
59
52
  export { default as Li } from './components/Li';
60
- export { default as Link } from './components/Link';
61
53
  export { default as Main } from './components/Main';
62
54
  export { default as Map } from './components/Map';
63
55
  export { default as Mark } from './components/Mark';
64
- export { default as Meta } from './components/Meta';
65
56
  export { default as Meter } from './components/Meter';
66
57
  export { default as Nav } from './components/Nav';
67
58
  export { default as Noscript } from './components/Noscript';
@@ -71,7 +62,6 @@ export { default as Optgroup } from './components/Optgroup';
71
62
  export { default as Option } from './components/Option';
72
63
  export { default as Output } from './components/Output';
73
64
  export { default as P } from './components/P';
74
- export { default as Param } from './components/Param';
75
65
  export { default as Picture } from './components/Picture';
76
66
  export { default as Pre } from './components/Pre';
77
67
  export { default as Progress } from './components/Progress';
@@ -85,7 +75,6 @@ export { default as Script } from './components/Script';
85
75
  export { default as Section } from './components/Section';
86
76
  export { default as Select } from './components/Select';
87
77
  export { default as Small } from './components/Small';
88
- export { default as Source } from './components/Source';
89
78
  export { default as Span } from './components/Span';
90
79
  export { default as Strong } from './components/Strong';
91
80
  export { default as Style } from './components/Style';
@@ -107,7 +96,6 @@ export { default as U } from './components/U';
107
96
  export { default as Ul } from './components/Ul';
108
97
  export { default as Var } from './components/Var';
109
98
  export { default as Video } from './components/Video';
110
- export { default as Wbr } from './components/Wbr';
111
99
  export { default as Svg } from './components/Svg';
112
100
  export { default as Animate } from './components/Animate';
113
101
  export { default as AnimateTransform } from './components/AnimateTransform';
@@ -160,3 +148,17 @@ export { default as TextPath } from './components/TextPath';
160
148
  export { default as Tspan } from './components/Tspan';
161
149
  export { default as Use } from './components/Use';
162
150
  export { default as View } from './components/View';
151
+ export { default as Area } from './components/Area';
152
+ export { default as Audio } from './components/Audio';
153
+ export { default as Base } from './components/Base';
154
+ export { default as Br } from './components/Br';
155
+ export { default as Col } from './components/Col';
156
+ export { default as Embed } from './components/Embed';
157
+ export { default as Hr } from './components/Hr';
158
+ export { default as Img } from './components/Img';
159
+ export { default as Input } from './components/Input';
160
+ export { default as Link } from './components/Link';
161
+ export { default as Meta } from './components/Meta';
162
+ export { default as Param } from './components/Param';
163
+ export { default as Source } from './components/Source';
164
+ export { default as Wbr } from './components/Wbr';
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from 'react';
2
+ import type { PseudoCss } from '../lib/types';
3
+ export default function COMPONENT_NAME(props: ComponentProps<'TAG'> & {
4
+ pseudo?: PseudoCss;
5
+ pseudoId?: string;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import COMPONENT_NAME from './COMPONENT_NAME';
3
+ declare const meta: Meta<typeof COMPONENT_NAME>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof COMPONENT_NAME>;
6
+ export declare const Primary: Story;
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from 'react';
2
- import { PseudoCss } from '../lib/types';
2
+ import type { PseudoCss } from '../lib/types';
3
3
  export default function COMPONENT_NAME(props: ComponentProps<'TAG'> & {
4
4
  pseudo?: PseudoCss;
5
5
  pseudoId?: string;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import COMPONENT_NAME from './COMPONENT_NAME';
3
+ declare const meta: Meta<typeof COMPONENT_NAME>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof COMPONENT_NAME>;
6
+ export declare const Primary: Story;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { CSSProperties } from 'react';
2
2
  export type PseudoClass = 'active' | 'checked' | 'disabled' | 'empty' | 'enabled' | 'firstChild' | 'firstOfType' | 'focus' | 'hover' | 'inRange' | 'invalid' | 'lastChild' | 'lastOfType' | 'link' | 'not' | 'nthChild' | 'nthLastChild' | 'nthLastOfType' | 'nthOfType' | 'onlyOfType' | 'onlyChild' | 'optional' | 'outOfRange' | 'readOnly' | 'readWrite' | 'required' | 'root' | 'target' | 'valid' | 'visited';
3
3
  export type PseudoElement = 'part' | 'theme' | 'part(container)' | 'part(label)' | 'part(option)' | 'part(item)' | 'part(placeholder)' | 'part(header)' | 'part(footer)' | 'part(overlay)' | 'part(menu)' | 'part(menuitem)' | 'part(list)' | 'part(listitem)' | 'part(progress-bar)' | 'part(progress-value)' | 'part(input-container)' | 'part(input)' | 'part(select)' | 'part(option-group)' | 'part(option-item)' | 'part(button)' | 'part(dialog)' | 'part(menu-button)' | 'part(tablist)' | 'part(tab)' | 'part(tab-panel)' | 'part(carousel)' | 'part(slider)' | 'part(tooltip)' | 'part(radio)' | 'part(checkbox)' | 'part(switch)' | 'part(range)' | 'part(textarea)' | 'part(search)' | 'part(navbar)' | 'part(breadcrumbs)' | 'before' | 'after' | 'first-line' | 'first-letter' | 'selection' | 'placeholder' | 'backdrop' | 'marker' | '-webkit-before' | '-webkit-after' | '-webkit-first-line' | '-webkit-first-letter' | '-webkit-selection' | '-webkit-placeholder' | '-webkit-backdrop' | '-webkit-marker' | '-webkit-scrollbar' | '-webkit-scrollbar-thumb' | '-webkit-scrollbar-track' | '-webkit-scrollbar-track-piece' | '-webkit-scrollbar-corner' | '-webkit-scrollbar-button' | '-webkit-resizer' | '-webkit-file-upload-button' | '-webkit-inner-spin-button' | '-webkit-outer-spin-button' | '-webkit-progress-bar' | '-webkit-progress-value' | '-webkit-progress-inner-element' | '-webkit-progress-outer-element' | 'slotted(*)' | 'slotted(div)' | 'slotted(span)' | 'slotted(p)' | 'slotted(a)' | 'slotted(img)' | 'slotted(button)' | 'slotted(input)' | 'part(dialog-overlay)' | 'part(tab-content)' | 'part(slider-track)' | 'part(slider-thumb)' | 'part(menu-icon)' | 'part(menu-label)' | 'part(list-group)' | 'part(list-item)';
4
4
  type CssVariable = `--${string}`;
@@ -6,6 +6,27 @@ export type ExtendedCssProperties = React.CSSProperties & {
6
6
  [key: CssVariable]: string;
7
7
  };
8
8
  export type PseudoCss = Partial<{
9
- [key in PseudoClass | 'neutral' | PseudoElement]: React.CSSProperties | PseudoCss;
9
+ [key in PseudoClass | 'neutral' | PseudoElement]: ExtendedCssProperties & {
10
+ and?: PseudoCss;
11
+ };
10
12
  }>;
13
+ export type CssVariableName = `--${string}`;
14
+ export type CssPropertySyntax = '<length>' | '<number>' | '<percentage>' | '<length-percentage>' | '<color>' | '<image>' | '<url>' | '<integer>' | '<angle>' | '<time>' | '<resolution>' | '<transform-function>' | '<custom-ident>';
15
+ export type ICssProperty = {
16
+ syntax: CssPropertySyntax | CssPropertySyntax[];
17
+ name: CssVariableName;
18
+ inherits: boolean;
19
+ initialValue: string;
20
+ };
21
+ export type AnimationDefinition = {
22
+ delay?: CSSProperties['animationDelay'];
23
+ direction?: CSSProperties['animationDirection'];
24
+ duration?: CSSProperties['animationDuration'];
25
+ fillMode?: CSSProperties['animationFillMode'];
26
+ iterationCount?: CSSProperties['animationIterationCount'];
27
+ name: CSSProperties['animationName'];
28
+ playState?: CSSProperties['animationPlayState'];
29
+ timingFunction?: CSSProperties['animationTimingFunction'];
30
+ keyframes: Record<string, ExtendedCssProperties>;
31
+ };
11
32
  export {};
@@ -0,0 +1,212 @@
1
+ import { useState as o, useEffect as b } from "react";
2
+ const h = [
3
+ "active",
4
+ "checked",
5
+ "disabled",
6
+ "empty",
7
+ "enabled",
8
+ "firstChild",
9
+ "firstOfType",
10
+ "focus",
11
+ "hover",
12
+ "inRange",
13
+ "invalid",
14
+ "lastChild",
15
+ "lastOfType",
16
+ "link",
17
+ "not",
18
+ "nthChild",
19
+ "nthLastChild",
20
+ "nthLastOfType",
21
+ "nthOfType",
22
+ "onlyOfType",
23
+ "onlyChild",
24
+ "optional",
25
+ "outOfRange",
26
+ "readOnly",
27
+ "readWrite",
28
+ "required",
29
+ "root",
30
+ "target",
31
+ "valid",
32
+ "visited"
33
+ ], k = [
34
+ // Shadow DOM elements
35
+ "part",
36
+ "theme",
37
+ // Shadow DOM elements for specific controls
38
+ "part(container)",
39
+ "part(label)",
40
+ "part(option)",
41
+ "part(item)",
42
+ "part(placeholder)",
43
+ "part(header)",
44
+ "part(footer)",
45
+ "part(overlay)",
46
+ "part(menu)",
47
+ "part(menuitem)",
48
+ "part(list)",
49
+ "part(listitem)",
50
+ "part(progress-bar)",
51
+ "part(progress-value)",
52
+ "part(input-container)",
53
+ "part(input)",
54
+ "part(select)",
55
+ "part(option-group)",
56
+ "part(option-item)",
57
+ "part(button)",
58
+ "part(dialog)",
59
+ "part(menu-button)",
60
+ "part(tablist)",
61
+ "part(tab)",
62
+ "part(tab-panel)",
63
+ "part(carousel)",
64
+ "part(slider)",
65
+ "part(tooltip)",
66
+ "part(radio)",
67
+ "part(checkbox)",
68
+ "part(switch)",
69
+ "part(range)",
70
+ "part(textarea)",
71
+ "part(search)",
72
+ "part(navbar)",
73
+ "part(breadcrumbs)",
74
+ // Standard pseudoelements
75
+ "before",
76
+ "after",
77
+ "first-line",
78
+ "first-letter",
79
+ "selection",
80
+ "placeholder",
81
+ "backdrop",
82
+ "marker",
83
+ // WebKit-prefixed pseudoelements
84
+ "-webkit-before",
85
+ "-webkit-after",
86
+ "-webkit-first-line",
87
+ "-webkit-first-letter",
88
+ "-webkit-selection",
89
+ "-webkit-placeholder",
90
+ "-webkit-backdrop",
91
+ "-webkit-marker",
92
+ // WebKit scrollbar pseudo-elements
93
+ "-webkit-scrollbar",
94
+ "-webkit-scrollbar-thumb",
95
+ "-webkit-scrollbar-track",
96
+ "-webkit-scrollbar-track-piece",
97
+ "-webkit-scrollbar-corner",
98
+ "-webkit-scrollbar-button",
99
+ "-webkit-resizer",
100
+ // Other WebKit-prefixed pseudoelements
101
+ "-webkit-file-upload-button",
102
+ "-webkit-inner-spin-button",
103
+ "-webkit-outer-spin-button",
104
+ "-webkit-progress-bar",
105
+ "-webkit-progress-value",
106
+ "-webkit-progress-inner-element",
107
+ "-webkit-progress-outer-element",
108
+ // Additional pseudo-elements related to shadow DOM and Web Components
109
+ "slotted(*)",
110
+ "slotted(div)",
111
+ "slotted(span)",
112
+ "slotted(p)",
113
+ "slotted(a)",
114
+ "slotted(img)",
115
+ "slotted(button)",
116
+ "slotted(input)",
117
+ // Custom and experimental shadow DOM parts (subject to changes)
118
+ "part(dialog-overlay)",
119
+ "part(tab-content)",
120
+ "part(slider-track)",
121
+ "part(slider-thumb)",
122
+ "part(menu-icon)",
123
+ "part(menu-label)",
124
+ "part(list-group)",
125
+ "part(list-item)"
126
+ ];
127
+ function s(t, r) {
128
+ let e = "";
129
+ return Object.entries(r).forEach(([a, i]) => {
130
+ let n = t;
131
+ h.includes(a) ? n = `${t}:${a}` : k.includes(a) ? n = `${t}::${a}` : a === "neutral" || (console.error(`Invalid pseudo class: ${a}`), console.log(r));
132
+ const { and: l, ...c } = i;
133
+ l && (e += s(n, l)), e += `${n} { ${Object.entries(c).map(([u, f]) => `${u.replace(/[A-Z]/g, (d) => `-${d.toLowerCase()}`)}: ${f}`).join("; ")} }`;
134
+ }), e;
135
+ }
136
+ function m(t, r) {
137
+ if (!r) {
138
+ const i = document.head.querySelector(`style#${t}`);
139
+ return i && i.remove(), "";
140
+ }
141
+ let e = document.head.querySelector(`style#${t}`);
142
+ e || (e = document.createElement("style"), e.id = t, e.type = "text/css", document.head.appendChild(e));
143
+ let a = s(`.${t}`, r);
144
+ return e.textContent = a, a;
145
+ }
146
+ const w = [
147
+ "A",
148
+ "B",
149
+ "C",
150
+ "D",
151
+ "E",
152
+ "F",
153
+ "G",
154
+ "H",
155
+ "I",
156
+ "J",
157
+ "K",
158
+ "L",
159
+ "M",
160
+ "N",
161
+ "O",
162
+ "P",
163
+ "Q",
164
+ "R",
165
+ "S",
166
+ "T",
167
+ "U",
168
+ "V",
169
+ "W",
170
+ "X",
171
+ "Y",
172
+ "Z"
173
+ ];
174
+ function y(t) {
175
+ return new Array(t).fill(0).map(() => w[Math.floor(Math.random() * 24)]).join("");
176
+ }
177
+ function* g() {
178
+ const t = [];
179
+ for (; ; ) {
180
+ let r = y(6);
181
+ t.includes(r) || (t.push(r), yield r);
182
+ }
183
+ }
184
+ const v = g();
185
+ function $() {
186
+ return v.next().value;
187
+ }
188
+ function p(t, r) {
189
+ if (t == null && r == null)
190
+ return !0;
191
+ if (t == null && typeof r == "object" || r == null && typeof t == "object" || Object.keys(t).length !== Object.keys(r).length)
192
+ return !1;
193
+ for (const e in t)
194
+ if (t[e] !== r[e]) {
195
+ if (typeof t[e] == "object" && typeof r[e] == "object") {
196
+ if (!p(t[e], r[e]))
197
+ return !1;
198
+ } else if (t[e] !== r[e])
199
+ return !1;
200
+ }
201
+ return !0;
202
+ }
203
+ function S(t, r) {
204
+ const [e] = o(() => r ?? $()), [a, i] = o({}), [n, l] = o("");
205
+ return b(() => {
206
+ p(a, t) || (i(t), l(m(e, t)));
207
+ }, [e, t, a, l]), [e, n];
208
+ }
209
+ export {
210
+ $ as g,
211
+ S as u
212
+ };
@@ -0,0 +1,2 @@
1
+ import type { AnimationDefinition } from '../types';
2
+ export default function createAnimation(animationId: string, definition: AnimationDefinition | undefined): "" | string[];