@tenphi/tasty 0.0.0-snapshot.fa94a5a → 0.0.0-snapshot.fdb16ea

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 (348) hide show
  1. package/README.md +197 -141
  2. package/dist/{ssr/async-storage.js → async-storage-DKK-wTD4.js} +17 -8
  3. package/dist/async-storage-DKK-wTD4.js.map +1 -0
  4. package/dist/babel-CMYf4JZ2.d.ts +83 -0
  5. package/dist/collector-Ctn5s74s.d.ts +145 -0
  6. package/dist/{ssr/collector.js → collector-DMSR6ANK.js} +124 -47
  7. package/dist/collector-DMSR6ANK.js.map +1 -0
  8. package/dist/config-B23gZrfP.js +12317 -0
  9. package/dist/config-B23gZrfP.js.map +1 -0
  10. package/dist/config-CZx8_DCu.d.ts +1296 -0
  11. package/dist/context-CA8YKeMn.js +24 -0
  12. package/dist/context-CA8YKeMn.js.map +1 -0
  13. package/dist/core/index.d.ts +5 -34
  14. package/dist/core/index.js +6 -27
  15. package/dist/core-B1tyn69d.js +1573 -0
  16. package/dist/core-B1tyn69d.js.map +1 -0
  17. package/dist/{zero/extractor.js → css-writer-CvAxkR6S.js} +149 -26
  18. package/dist/css-writer-CvAxkR6S.js.map +1 -0
  19. package/dist/{ssr/format-global-rules.js → format-global-rules-DklyaXv-.js} +3 -3
  20. package/dist/format-global-rules-DklyaXv-.js.map +1 -0
  21. package/dist/format-rules-BCTWVvcS.js +130 -0
  22. package/dist/format-rules-BCTWVvcS.js.map +1 -0
  23. package/dist/hydrate-BCPvkJj3.js +37 -0
  24. package/dist/hydrate-BCPvkJj3.js.map +1 -0
  25. package/dist/index-B3o0aCYV.d.ts +1538 -0
  26. package/dist/index-CsvB0EXZ.d.ts +1909 -0
  27. package/dist/index.d.ts +5 -51
  28. package/dist/index.js +921 -35
  29. package/dist/index.js.map +1 -0
  30. package/dist/keyframes-Dxdx3KOo.js +493 -0
  31. package/dist/keyframes-Dxdx3KOo.js.map +1 -0
  32. package/dist/{utils/merge-styles.js → merge-styles-C-uwpoNW.js} +4 -6
  33. package/dist/merge-styles-C-uwpoNW.js.map +1 -0
  34. package/dist/{utils/merge-styles.d.ts → merge-styles-DJTSfz_M.d.ts} +3 -3
  35. package/dist/{utils/resolve-recipes.js → resolve-recipes-BuOvSEa2.js} +5 -8
  36. package/dist/resolve-recipes-BuOvSEa2.js.map +1 -0
  37. package/dist/ssr/astro-client.d.ts +1 -0
  38. package/dist/ssr/astro-client.js +19 -0
  39. package/dist/ssr/astro-client.js.map +1 -0
  40. package/dist/ssr/astro-middleware-static.d.ts +16 -0
  41. package/dist/ssr/astro-middleware-static.js +18 -0
  42. package/dist/ssr/astro-middleware-static.js.map +1 -0
  43. package/dist/ssr/astro-middleware.d.ts +17 -0
  44. package/dist/ssr/astro-middleware.js +19 -0
  45. package/dist/ssr/astro-middleware.js.map +1 -0
  46. package/dist/ssr/astro.d.ts +74 -10
  47. package/dist/ssr/astro.js +124 -32
  48. package/dist/ssr/astro.js.map +1 -1
  49. package/dist/ssr/index.d.ts +37 -5
  50. package/dist/ssr/index.js +7 -9
  51. package/dist/ssr/index.js.map +1 -1
  52. package/dist/ssr/next.d.ts +6 -6
  53. package/dist/ssr/next.js +19 -16
  54. package/dist/ssr/next.js.map +1 -1
  55. package/dist/static/index.d.ts +91 -5
  56. package/dist/static/index.js +49 -4
  57. package/dist/static/index.js.map +1 -0
  58. package/dist/static/inject.d.ts +5 -0
  59. package/dist/static/inject.js +17 -0
  60. package/dist/static/inject.js.map +1 -0
  61. package/dist/zero/babel.d.ts +2 -167
  62. package/dist/zero/babel.js +161 -57
  63. package/dist/zero/babel.js.map +1 -1
  64. package/dist/zero/index.d.ts +81 -3
  65. package/dist/zero/index.js +2 -4
  66. package/dist/zero/next.d.ts +13 -1
  67. package/dist/zero/next.js +6 -5
  68. package/dist/zero/next.js.map +1 -1
  69. package/docs/README.md +20 -12
  70. package/docs/adoption.md +59 -32
  71. package/docs/ai-agents.md +224 -0
  72. package/docs/comparison.md +76 -48
  73. package/docs/configuration.md +566 -69
  74. package/docs/debug.md +22 -18
  75. package/docs/design-system.md +63 -32
  76. package/docs/dsl.md +527 -181
  77. package/docs/getting-started.md +62 -41
  78. package/docs/injector.md +137 -51
  79. package/docs/methodology.md +116 -35
  80. package/docs/migration-v3.md +285 -0
  81. package/docs/pipeline.md +741 -0
  82. package/docs/plugins.md +353 -0
  83. package/docs/react-api.md +681 -0
  84. package/docs/runtime-benchmarks.md +216 -0
  85. package/docs/ssr.md +197 -130
  86. package/docs/styles.md +84 -15
  87. package/docs/tasty-static.md +219 -70
  88. package/package.json +60 -21
  89. package/tasty.config.ts +6 -0
  90. package/dist/_virtual/_rolldown/runtime.js +0 -8
  91. package/dist/chunks/cacheKey.js +0 -78
  92. package/dist/chunks/cacheKey.js.map +0 -1
  93. package/dist/chunks/definitions.d.ts +0 -37
  94. package/dist/chunks/definitions.js +0 -259
  95. package/dist/chunks/definitions.js.map +0 -1
  96. package/dist/chunks/renderChunk.js +0 -60
  97. package/dist/chunks/renderChunk.js.map +0 -1
  98. package/dist/config.d.ts +0 -366
  99. package/dist/config.js +0 -504
  100. package/dist/config.js.map +0 -1
  101. package/dist/counter-style/index.js +0 -51
  102. package/dist/counter-style/index.js.map +0 -1
  103. package/dist/debug.d.ts +0 -89
  104. package/dist/debug.js +0 -454
  105. package/dist/debug.js.map +0 -1
  106. package/dist/font-face/index.js +0 -63
  107. package/dist/font-face/index.js.map +0 -1
  108. package/dist/hooks/resolve-ssr-collector.js +0 -15
  109. package/dist/hooks/resolve-ssr-collector.js.map +0 -1
  110. package/dist/hooks/useCounterStyle.d.ts +0 -50
  111. package/dist/hooks/useCounterStyle.js +0 -47
  112. package/dist/hooks/useCounterStyle.js.map +0 -1
  113. package/dist/hooks/useFontFace.d.ts +0 -43
  114. package/dist/hooks/useFontFace.js +0 -71
  115. package/dist/hooks/useFontFace.js.map +0 -1
  116. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  117. package/dist/hooks/useGlobalStyles.js +0 -79
  118. package/dist/hooks/useGlobalStyles.js.map +0 -1
  119. package/dist/hooks/useKeyframes.d.ts +0 -56
  120. package/dist/hooks/useKeyframes.js +0 -65
  121. package/dist/hooks/useKeyframes.js.map +0 -1
  122. package/dist/hooks/useProperty.d.ts +0 -79
  123. package/dist/hooks/useProperty.js +0 -110
  124. package/dist/hooks/useProperty.js.map +0 -1
  125. package/dist/hooks/useRawCSS.d.ts +0 -53
  126. package/dist/hooks/useRawCSS.js +0 -36
  127. package/dist/hooks/useRawCSS.js.map +0 -1
  128. package/dist/hooks/useStyles.d.ts +0 -45
  129. package/dist/hooks/useStyles.js +0 -270
  130. package/dist/hooks/useStyles.js.map +0 -1
  131. package/dist/injector/index.d.ts +0 -183
  132. package/dist/injector/index.js +0 -180
  133. package/dist/injector/index.js.map +0 -1
  134. package/dist/injector/injector.d.ts +0 -166
  135. package/dist/injector/injector.js +0 -465
  136. package/dist/injector/injector.js.map +0 -1
  137. package/dist/injector/sheet-manager.d.ts +0 -136
  138. package/dist/injector/sheet-manager.js +0 -731
  139. package/dist/injector/sheet-manager.js.map +0 -1
  140. package/dist/injector/types.d.ts +0 -204
  141. package/dist/keyframes/index.js +0 -206
  142. package/dist/keyframes/index.js.map +0 -1
  143. package/dist/parser/classify.js +0 -320
  144. package/dist/parser/classify.js.map +0 -1
  145. package/dist/parser/const.js +0 -33
  146. package/dist/parser/const.js.map +0 -1
  147. package/dist/parser/lru.js +0 -109
  148. package/dist/parser/lru.js.map +0 -1
  149. package/dist/parser/parser.d.ts +0 -25
  150. package/dist/parser/parser.js +0 -116
  151. package/dist/parser/parser.js.map +0 -1
  152. package/dist/parser/tokenizer.js +0 -69
  153. package/dist/parser/tokenizer.js.map +0 -1
  154. package/dist/parser/types.d.ts +0 -51
  155. package/dist/parser/types.js +0 -46
  156. package/dist/parser/types.js.map +0 -1
  157. package/dist/pipeline/conditions.d.ts +0 -134
  158. package/dist/pipeline/conditions.js +0 -406
  159. package/dist/pipeline/conditions.js.map +0 -1
  160. package/dist/pipeline/exclusive.js +0 -231
  161. package/dist/pipeline/exclusive.js.map +0 -1
  162. package/dist/pipeline/index.d.ts +0 -53
  163. package/dist/pipeline/index.js +0 -699
  164. package/dist/pipeline/index.js.map +0 -1
  165. package/dist/pipeline/materialize.js +0 -1105
  166. package/dist/pipeline/materialize.js.map +0 -1
  167. package/dist/pipeline/parseStateKey.d.ts +0 -15
  168. package/dist/pipeline/parseStateKey.js +0 -447
  169. package/dist/pipeline/parseStateKey.js.map +0 -1
  170. package/dist/pipeline/simplify.js +0 -516
  171. package/dist/pipeline/simplify.js.map +0 -1
  172. package/dist/pipeline/warnings.js +0 -18
  173. package/dist/pipeline/warnings.js.map +0 -1
  174. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  175. package/dist/plugins/okhsl-plugin.js +0 -98
  176. package/dist/plugins/okhsl-plugin.js.map +0 -1
  177. package/dist/plugins/types.d.ts +0 -76
  178. package/dist/properties/index.js +0 -223
  179. package/dist/properties/index.js.map +0 -1
  180. package/dist/properties/property-type-resolver.d.ts +0 -24
  181. package/dist/properties/property-type-resolver.js +0 -91
  182. package/dist/properties/property-type-resolver.js.map +0 -1
  183. package/dist/ssr/async-storage.d.ts +0 -17
  184. package/dist/ssr/async-storage.js.map +0 -1
  185. package/dist/ssr/collect-auto-properties.js +0 -40
  186. package/dist/ssr/collect-auto-properties.js.map +0 -1
  187. package/dist/ssr/collector.d.ts +0 -102
  188. package/dist/ssr/collector.js.map +0 -1
  189. package/dist/ssr/context.d.ts +0 -8
  190. package/dist/ssr/context.js +0 -14
  191. package/dist/ssr/context.js.map +0 -1
  192. package/dist/ssr/format-global-rules.js.map +0 -1
  193. package/dist/ssr/format-keyframes.js +0 -70
  194. package/dist/ssr/format-keyframes.js.map +0 -1
  195. package/dist/ssr/format-property.js +0 -50
  196. package/dist/ssr/format-property.js.map +0 -1
  197. package/dist/ssr/format-rules.js +0 -70
  198. package/dist/ssr/format-rules.js.map +0 -1
  199. package/dist/ssr/hydrate.d.ts +0 -22
  200. package/dist/ssr/hydrate.js +0 -50
  201. package/dist/ssr/hydrate.js.map +0 -1
  202. package/dist/ssr/ssr-collector-ref.js +0 -12
  203. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  204. package/dist/states/index.d.ts +0 -49
  205. package/dist/states/index.js +0 -171
  206. package/dist/states/index.js.map +0 -1
  207. package/dist/static/tastyStatic.d.ts +0 -46
  208. package/dist/static/tastyStatic.js +0 -31
  209. package/dist/static/tastyStatic.js.map +0 -1
  210. package/dist/static/types.d.ts +0 -49
  211. package/dist/static/types.js +0 -24
  212. package/dist/static/types.js.map +0 -1
  213. package/dist/styles/align.d.ts +0 -15
  214. package/dist/styles/align.js +0 -14
  215. package/dist/styles/align.js.map +0 -1
  216. package/dist/styles/border.d.ts +0 -25
  217. package/dist/styles/border.js +0 -114
  218. package/dist/styles/border.js.map +0 -1
  219. package/dist/styles/color.d.ts +0 -14
  220. package/dist/styles/color.js +0 -27
  221. package/dist/styles/color.js.map +0 -1
  222. package/dist/styles/createStyle.js +0 -80
  223. package/dist/styles/createStyle.js.map +0 -1
  224. package/dist/styles/dimension.js +0 -97
  225. package/dist/styles/dimension.js.map +0 -1
  226. package/dist/styles/display.d.ts +0 -37
  227. package/dist/styles/display.js +0 -67
  228. package/dist/styles/display.js.map +0 -1
  229. package/dist/styles/fade.d.ts +0 -15
  230. package/dist/styles/fade.js +0 -58
  231. package/dist/styles/fade.js.map +0 -1
  232. package/dist/styles/fill.d.ts +0 -42
  233. package/dist/styles/fill.js +0 -52
  234. package/dist/styles/fill.js.map +0 -1
  235. package/dist/styles/flow.d.ts +0 -16
  236. package/dist/styles/flow.js +0 -12
  237. package/dist/styles/flow.js.map +0 -1
  238. package/dist/styles/gap.d.ts +0 -31
  239. package/dist/styles/gap.js +0 -37
  240. package/dist/styles/gap.js.map +0 -1
  241. package/dist/styles/height.d.ts +0 -17
  242. package/dist/styles/height.js +0 -20
  243. package/dist/styles/height.js.map +0 -1
  244. package/dist/styles/index.d.ts +0 -2
  245. package/dist/styles/index.js +0 -9
  246. package/dist/styles/index.js.map +0 -1
  247. package/dist/styles/inset.d.ts +0 -52
  248. package/dist/styles/inset.js +0 -150
  249. package/dist/styles/inset.js.map +0 -1
  250. package/dist/styles/justify.d.ts +0 -15
  251. package/dist/styles/justify.js +0 -14
  252. package/dist/styles/justify.js.map +0 -1
  253. package/dist/styles/list.d.ts +0 -16
  254. package/dist/styles/list.js +0 -98
  255. package/dist/styles/list.js.map +0 -1
  256. package/dist/styles/margin.d.ts +0 -24
  257. package/dist/styles/margin.js +0 -104
  258. package/dist/styles/margin.js.map +0 -1
  259. package/dist/styles/outline.d.ts +0 -29
  260. package/dist/styles/outline.js +0 -65
  261. package/dist/styles/outline.js.map +0 -1
  262. package/dist/styles/padding.d.ts +0 -24
  263. package/dist/styles/padding.js +0 -104
  264. package/dist/styles/padding.js.map +0 -1
  265. package/dist/styles/predefined.d.ts +0 -71
  266. package/dist/styles/predefined.js +0 -238
  267. package/dist/styles/predefined.js.map +0 -1
  268. package/dist/styles/preset.d.ts +0 -47
  269. package/dist/styles/preset.js +0 -112
  270. package/dist/styles/preset.js.map +0 -1
  271. package/dist/styles/radius.d.ts +0 -14
  272. package/dist/styles/radius.js +0 -51
  273. package/dist/styles/radius.js.map +0 -1
  274. package/dist/styles/scrollbar.d.ts +0 -25
  275. package/dist/styles/scrollbar.js +0 -48
  276. package/dist/styles/scrollbar.js.map +0 -1
  277. package/dist/styles/shadow.d.ts +0 -14
  278. package/dist/styles/shadow.js +0 -24
  279. package/dist/styles/shadow.js.map +0 -1
  280. package/dist/styles/transition.d.ts +0 -14
  281. package/dist/styles/transition.js +0 -158
  282. package/dist/styles/transition.js.map +0 -1
  283. package/dist/styles/types.d.ts +0 -545
  284. package/dist/styles/width.d.ts +0 -17
  285. package/dist/styles/width.js +0 -20
  286. package/dist/styles/width.js.map +0 -1
  287. package/dist/tasty.d.ts +0 -119
  288. package/dist/tasty.js +0 -232
  289. package/dist/tasty.js.map +0 -1
  290. package/dist/types.d.ts +0 -184
  291. package/dist/utils/cache-wrapper.js +0 -22
  292. package/dist/utils/cache-wrapper.js.map +0 -1
  293. package/dist/utils/case-converter.js +0 -8
  294. package/dist/utils/case-converter.js.map +0 -1
  295. package/dist/utils/color-math.d.ts +0 -46
  296. package/dist/utils/color-math.js +0 -749
  297. package/dist/utils/color-math.js.map +0 -1
  298. package/dist/utils/color-space.d.ts +0 -5
  299. package/dist/utils/color-space.js +0 -229
  300. package/dist/utils/color-space.js.map +0 -1
  301. package/dist/utils/colors.d.ts +0 -5
  302. package/dist/utils/colors.js +0 -11
  303. package/dist/utils/colors.js.map +0 -1
  304. package/dist/utils/css-types.d.ts +0 -7
  305. package/dist/utils/dotize.d.ts +0 -26
  306. package/dist/utils/dotize.js +0 -122
  307. package/dist/utils/dotize.js.map +0 -1
  308. package/dist/utils/filter-base-props.d.ts +0 -15
  309. package/dist/utils/filter-base-props.js +0 -45
  310. package/dist/utils/filter-base-props.js.map +0 -1
  311. package/dist/utils/get-display-name.d.ts +0 -7
  312. package/dist/utils/get-display-name.js +0 -10
  313. package/dist/utils/get-display-name.js.map +0 -1
  314. package/dist/utils/has-keys.js +0 -13
  315. package/dist/utils/has-keys.js.map +0 -1
  316. package/dist/utils/is-dev-env.js +0 -19
  317. package/dist/utils/is-dev-env.js.map +0 -1
  318. package/dist/utils/is-valid-element-type.js +0 -15
  319. package/dist/utils/is-valid-element-type.js.map +0 -1
  320. package/dist/utils/merge-styles.js.map +0 -1
  321. package/dist/utils/mod-attrs.d.ts +0 -8
  322. package/dist/utils/mod-attrs.js +0 -21
  323. package/dist/utils/mod-attrs.js.map +0 -1
  324. package/dist/utils/process-tokens.d.ts +0 -21
  325. package/dist/utils/process-tokens.js +0 -91
  326. package/dist/utils/process-tokens.js.map +0 -1
  327. package/dist/utils/resolve-recipes.d.ts +0 -17
  328. package/dist/utils/resolve-recipes.js.map +0 -1
  329. package/dist/utils/selector-transform.js +0 -32
  330. package/dist/utils/selector-transform.js.map +0 -1
  331. package/dist/utils/string.js +0 -8
  332. package/dist/utils/string.js.map +0 -1
  333. package/dist/utils/styles.d.ts +0 -101
  334. package/dist/utils/styles.js +0 -223
  335. package/dist/utils/styles.js.map +0 -1
  336. package/dist/utils/typography.d.ts +0 -47
  337. package/dist/utils/typography.js +0 -43
  338. package/dist/utils/typography.js.map +0 -1
  339. package/dist/utils/warnings.d.ts +0 -16
  340. package/dist/utils/warnings.js +0 -16
  341. package/dist/utils/warnings.js.map +0 -1
  342. package/dist/zero/css-writer.d.ts +0 -45
  343. package/dist/zero/css-writer.js +0 -74
  344. package/dist/zero/css-writer.js.map +0 -1
  345. package/dist/zero/extractor.d.ts +0 -24
  346. package/dist/zero/extractor.js.map +0 -1
  347. package/docs/PIPELINE.md +0 -519
  348. package/docs/runtime.md +0 -485
@@ -1,183 +0,0 @@
1
- import { CacheMetrics, CounterStyleDescriptors, DisposeFunction, FontFaceDescriptors, FontFaceInput, GlobalInjectResult, InjectResult, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, PropertyDefinition, RawCSSResult, RootRegistry, RuleInfo, SheetInfo, StyleInjectorConfig, StyleRule } from "./types.js";
2
- import { StyleResult } from "../pipeline/index.js";
3
- import { SheetManager } from "./sheet-manager.js";
4
- import { StyleInjector } from "./injector.js";
5
-
6
- //#region src/injector/index.d.ts
7
- /**
8
- * Allocate a className for a cacheKey without injecting styles yet
9
- */
10
- declare function allocateClassName(cacheKey: string, options?: {
11
- root?: Document | ShadowRoot;
12
- }): {
13
- className: string;
14
- isNewAllocation: boolean;
15
- };
16
- /**
17
- * Track a reference to an already-injected cacheKey (refCount + dispose).
18
- * Used on cache hits (SSR hydration or runtime reuse) where the pipeline
19
- * was skipped. Returns null if the cacheKey is not in the cache.
20
- */
21
- declare function trackRef(cacheKey: string, options?: {
22
- root?: Document | ShadowRoot;
23
- }): InjectResult | null;
24
- /**
25
- * Inject styles and return className with dispose function
26
- */
27
- declare function inject(rules: StyleResult[], options?: {
28
- root?: Document | ShadowRoot;
29
- cacheKey?: string;
30
- }): InjectResult;
31
- /**
32
- * Inject global rules that should not reserve tasty class names
33
- */
34
- declare function injectGlobal(rules: StyleResult[], options?: {
35
- root?: Document | ShadowRoot;
36
- }): GlobalInjectResult;
37
- /**
38
- * Inject raw CSS text directly without parsing
39
- * This is a low-overhead method for injecting raw CSS that doesn't need tasty processing.
40
- * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking.
41
- *
42
- * @example
43
- * ```tsx
44
- * // Inject raw CSS
45
- * const { dispose } = injectRawCSS(`
46
- * body { margin: 0; padding: 0; }
47
- * .my-class { color: red; }
48
- * `);
49
- *
50
- * // Later, remove the injected CSS
51
- * dispose();
52
- * ```
53
- */
54
- declare function injectRawCSS(css: string, options?: {
55
- root?: Document | ShadowRoot;
56
- }): {
57
- dispose: () => void;
58
- };
59
- /**
60
- * Get raw CSS text for SSR
61
- */
62
- declare function getRawCSSText(options?: {
63
- root?: Document | ShadowRoot;
64
- }): string;
65
- /**
66
- * Inject keyframes and return object with toString() and dispose()
67
- */
68
- declare function keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
69
- root?: Document | ShadowRoot;
70
- name?: string;
71
- }): KeyframesResult;
72
- interface PropertyOptions {
73
- /**
74
- * CSS syntax string for the property (e.g., '<color>', '<length>', '<angle>')
75
- * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax
76
- */
77
- syntax?: string;
78
- /**
79
- * Whether the property inherits from parent elements
80
- * @default true
81
- */
82
- inherits?: boolean;
83
- /**
84
- * Initial value for the property
85
- */
86
- initialValue?: string | number;
87
- /**
88
- * Shadow root or document to inject into
89
- */
90
- root?: Document | ShadowRoot;
91
- }
92
- /**
93
- * Define a CSS @property custom property.
94
- * This enables advanced features like animating custom properties.
95
- *
96
- * Note: @property rules are global and persistent once defined.
97
- * Re-registering the same property name is a no-op.
98
- *
99
- * @param name - The custom property name (must start with --)
100
- * @param options - Property configuration
101
- *
102
- * @example
103
- * ```ts
104
- * // Define a color property that can be animated
105
- * property('--my-color', {
106
- * syntax: '<color>',
107
- * initialValue: 'red',
108
- * });
109
- *
110
- * // Define an angle property
111
- * property('--rotation', {
112
- * syntax: '<angle>',
113
- * inherits: false,
114
- * initialValue: '0deg',
115
- * });
116
- * ```
117
- */
118
- declare function property(name: string, options?: PropertyOptions): void;
119
- /**
120
- * Check if a CSS @property has already been defined
121
- *
122
- * @param name - The custom property name to check
123
- * @param options - Options including root
124
- */
125
- declare function isPropertyDefined(name: string, options?: {
126
- root?: Document | ShadowRoot;
127
- }): boolean;
128
- /**
129
- * Inject a CSS @font-face rule.
130
- *
131
- * Permanent and global — no dispose or ref-counting.
132
- * Deduplicates by content hash (family + descriptors).
133
- */
134
- declare function fontFace(family: string, descriptors: FontFaceDescriptors, options?: {
135
- root?: Document | ShadowRoot;
136
- }): void;
137
- /**
138
- * Inject a CSS @counter-style rule.
139
- *
140
- * Permanent and global — no dispose or ref-counting.
141
- * Deduplicates by name (first definition wins).
142
- */
143
- declare function counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
144
- root?: Document | ShadowRoot;
145
- }): void;
146
- /**
147
- * Get CSS text from all sheets (for SSR)
148
- */
149
- declare function getCssText(options?: {
150
- root?: Document | ShadowRoot;
151
- }): string;
152
- /**
153
- * Collect only CSS used by a rendered subtree (like jest-styled-components).
154
- * Pass the container returned by render(...).
155
- */
156
- declare function getCssTextForNode(node: ParentNode | Element | DocumentFragment, options?: {
157
- root?: Document | ShadowRoot;
158
- }): string;
159
- /**
160
- * Force cleanup of unused rules
161
- */
162
- declare function cleanup(root?: Document | ShadowRoot): void;
163
- /**
164
- * Check if we're currently running in a test environment
165
- */
166
- declare function getIsTestEnvironment(): boolean;
167
- /**
168
- * Get the global injector instance for debugging
169
- */
170
- declare const injector: {
171
- readonly instance: StyleInjector;
172
- };
173
- /**
174
- * Destroy all resources and clean up
175
- */
176
- declare function destroy(root?: Document | ShadowRoot): void;
177
- /**
178
- * Create a new isolated injector instance
179
- */
180
- declare function createInjector(config?: Partial<StyleInjectorConfig>): StyleInjector;
181
- //#endregion
182
- export { PropertyOptions, allocateClassName, cleanup, counterStyle, createInjector, destroy, fontFace, getCssText, getCssTextForNode, getIsTestEnvironment, getRawCSSText, inject, injectGlobal, injectRawCSS, injector, isPropertyDefined, keyframes, property, trackRef };
183
- //# sourceMappingURL=index.d.ts.map
@@ -1,180 +0,0 @@
1
- import { SheetManager } from "./sheet-manager.js";
2
- import { StyleInjector } from "./injector.js";
3
- import { getConfig, getGlobalInjector, isTestEnvironment, markStylesGenerated } from "../config.js";
4
-
5
- //#region src/injector/index.ts
6
- /**
7
- * Allocate a className for a cacheKey without injecting styles yet
8
- */
9
- function allocateClassName(cacheKey, options) {
10
- return getGlobalInjector().allocateClassName(cacheKey, options);
11
- }
12
- /**
13
- * Track a reference to an already-injected cacheKey (refCount + dispose).
14
- * Used on cache hits (SSR hydration or runtime reuse) where the pipeline
15
- * was skipped. Returns null if the cacheKey is not in the cache.
16
- */
17
- function trackRef(cacheKey, options) {
18
- return getGlobalInjector().trackRef(cacheKey, options);
19
- }
20
- /**
21
- * Inject styles and return className with dispose function
22
- */
23
- function inject(rules, options) {
24
- markStylesGenerated();
25
- return getGlobalInjector().inject(rules, options);
26
- }
27
- /**
28
- * Inject global rules that should not reserve tasty class names
29
- */
30
- function injectGlobal(rules, options) {
31
- return getGlobalInjector().injectGlobal(rules, options);
32
- }
33
- /**
34
- * Inject raw CSS text directly without parsing
35
- * This is a low-overhead method for injecting raw CSS that doesn't need tasty processing.
36
- * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking.
37
- *
38
- * @example
39
- * ```tsx
40
- * // Inject raw CSS
41
- * const { dispose } = injectRawCSS(`
42
- * body { margin: 0; padding: 0; }
43
- * .my-class { color: red; }
44
- * `);
45
- *
46
- * // Later, remove the injected CSS
47
- * dispose();
48
- * ```
49
- */
50
- function injectRawCSS(css, options) {
51
- return getGlobalInjector().injectRawCSS(css, options);
52
- }
53
- /**
54
- * Get raw CSS text for SSR
55
- */
56
- function getRawCSSText(options) {
57
- return getGlobalInjector().getRawCSSText(options);
58
- }
59
- /**
60
- * Inject keyframes and return object with toString() and dispose()
61
- */
62
- function keyframes(steps, nameOrOptions) {
63
- return getGlobalInjector().keyframes(steps, nameOrOptions);
64
- }
65
- /**
66
- * Define a CSS @property custom property.
67
- * This enables advanced features like animating custom properties.
68
- *
69
- * Note: @property rules are global and persistent once defined.
70
- * Re-registering the same property name is a no-op.
71
- *
72
- * @param name - The custom property name (must start with --)
73
- * @param options - Property configuration
74
- *
75
- * @example
76
- * ```ts
77
- * // Define a color property that can be animated
78
- * property('--my-color', {
79
- * syntax: '<color>',
80
- * initialValue: 'red',
81
- * });
82
- *
83
- * // Define an angle property
84
- * property('--rotation', {
85
- * syntax: '<angle>',
86
- * inherits: false,
87
- * initialValue: '0deg',
88
- * });
89
- * ```
90
- */
91
- function property(name, options) {
92
- return getGlobalInjector().property(name, options);
93
- }
94
- /**
95
- * Check if a CSS @property has already been defined
96
- *
97
- * @param name - The custom property name to check
98
- * @param options - Options including root
99
- */
100
- function isPropertyDefined(name, options) {
101
- return getGlobalInjector().isPropertyDefined(name, options);
102
- }
103
- /**
104
- * Inject a CSS @font-face rule.
105
- *
106
- * Permanent and global — no dispose or ref-counting.
107
- * Deduplicates by content hash (family + descriptors).
108
- */
109
- function fontFace(family, descriptors, options) {
110
- return getGlobalInjector().fontFace(family, descriptors, options);
111
- }
112
- /**
113
- * Inject a CSS @counter-style rule.
114
- *
115
- * Permanent and global — no dispose or ref-counting.
116
- * Deduplicates by name (first definition wins).
117
- */
118
- function counterStyle(name, descriptors, options) {
119
- return getGlobalInjector().counterStyle(name, descriptors, options);
120
- }
121
- /**
122
- * Get CSS text from all sheets (for SSR)
123
- */
124
- function getCssText(options) {
125
- return getGlobalInjector().getCssText(options);
126
- }
127
- /**
128
- * Collect only CSS used by a rendered subtree (like jest-styled-components).
129
- * Pass the container returned by render(...).
130
- */
131
- function getCssTextForNode(node, options) {
132
- const classSet = /* @__PURE__ */ new Set();
133
- const readClasses = (el) => {
134
- const cls = el.getAttribute("class");
135
- if (!cls) return;
136
- for (const token of cls.split(/\s+/)) if (/^t\d+$/.test(token)) classSet.add(token);
137
- };
138
- if (node.getAttribute) readClasses(node);
139
- const elements = node.querySelectorAll ? node.querySelectorAll("[class]") : [];
140
- if (elements) elements.forEach(readClasses);
141
- return getGlobalInjector().getCssTextForClasses(classSet, options);
142
- }
143
- /**
144
- * Force cleanup of unused rules
145
- */
146
- function cleanup(root) {
147
- return getGlobalInjector().cleanup(root);
148
- }
149
- /**
150
- * Check if we're currently running in a test environment
151
- */
152
- function getIsTestEnvironment() {
153
- return isTestEnvironment();
154
- }
155
- /**
156
- * Get the global injector instance for debugging
157
- */
158
- const injector = { get instance() {
159
- return getGlobalInjector();
160
- } };
161
- /**
162
- * Destroy all resources and clean up
163
- */
164
- function destroy(root) {
165
- return getGlobalInjector().destroy(root);
166
- }
167
- /**
168
- * Create a new isolated injector instance
169
- */
170
- function createInjector(config = {}) {
171
- return new StyleInjector({
172
- ...getConfig(),
173
- forceTextInjection: config.forceTextInjection ?? isTestEnvironment(),
174
- ...config
175
- });
176
- }
177
-
178
- //#endregion
179
- export { allocateClassName, cleanup, counterStyle, createInjector, destroy, fontFace, getCssText, getCssTextForNode, getIsTestEnvironment, getRawCSSText, inject, injectGlobal, injectRawCSS, injector, isPropertyDefined, keyframes, property, trackRef };
180
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/injector/index.ts"],"sourcesContent":["import {\n getConfig,\n getGlobalInjector,\n isTestEnvironment,\n markStylesGenerated,\n} from '../config';\nimport type { StyleResult } from '../pipeline';\n\nimport { StyleInjector } from './injector';\nimport type {\n CounterStyleDescriptors,\n FontFaceDescriptors,\n GlobalInjectResult,\n InjectResult,\n KeyframesResult,\n KeyframesSteps,\n StyleInjectorConfig,\n} from './types';\n\n/**\n * Allocate a className for a cacheKey without injecting styles yet\n */\nexport function allocateClassName(\n cacheKey: string,\n options?: { root?: Document | ShadowRoot },\n): { className: string; isNewAllocation: boolean } {\n return getGlobalInjector().allocateClassName(cacheKey, options);\n}\n\n/**\n * Track a reference to an already-injected cacheKey (refCount + dispose).\n * Used on cache hits (SSR hydration or runtime reuse) where the pipeline\n * was skipped. Returns null if the cacheKey is not in the cache.\n */\nexport function trackRef(\n cacheKey: string,\n options?: { root?: Document | ShadowRoot },\n): InjectResult | null {\n return getGlobalInjector().trackRef(cacheKey, options);\n}\n\n/**\n * Inject styles and return className with dispose function\n */\nexport function inject(\n rules: StyleResult[],\n options?: { root?: Document | ShadowRoot; cacheKey?: string },\n): InjectResult {\n // Mark that styles have been generated (prevents configuration changes)\n markStylesGenerated();\n\n return getGlobalInjector().inject(rules, options);\n}\n\n/**\n * Inject global rules that should not reserve tasty class names\n */\nexport function injectGlobal(\n rules: StyleResult[],\n options?: { root?: Document | ShadowRoot },\n): GlobalInjectResult {\n return getGlobalInjector().injectGlobal(rules, options);\n}\n\n/**\n * Inject raw CSS text directly without parsing\n * This is a low-overhead method for injecting raw CSS that doesn't need tasty processing.\n * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking.\n *\n * @example\n * ```tsx\n * // Inject raw CSS\n * const { dispose } = injectRawCSS(`\n * body { margin: 0; padding: 0; }\n * .my-class { color: red; }\n * `);\n *\n * // Later, remove the injected CSS\n * dispose();\n * ```\n */\nexport function injectRawCSS(\n css: string,\n options?: { root?: Document | ShadowRoot },\n): { dispose: () => void } {\n return getGlobalInjector().injectRawCSS(css, options);\n}\n\n/**\n * Get raw CSS text for SSR\n */\nexport function getRawCSSText(options?: {\n root?: Document | ShadowRoot;\n}): string {\n return getGlobalInjector().getRawCSSText(options);\n}\n\n/**\n * Inject keyframes and return object with toString() and dispose()\n */\nexport function keyframes(\n steps: KeyframesSteps,\n nameOrOptions?: string | { root?: Document | ShadowRoot; name?: string },\n): KeyframesResult {\n return getGlobalInjector().keyframes(steps, nameOrOptions);\n}\n\nexport interface PropertyOptions {\n /**\n * CSS syntax string for the property (e.g., '<color>', '<length>', '<angle>')\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@property/syntax\n */\n syntax?: string;\n /**\n * Whether the property inherits from parent elements\n * @default true\n */\n inherits?: boolean;\n /**\n * Initial value for the property\n */\n initialValue?: string | number;\n /**\n * Shadow root or document to inject into\n */\n root?: Document | ShadowRoot;\n}\n\n/**\n * Define a CSS @property custom property.\n * This enables advanced features like animating custom properties.\n *\n * Note: @property rules are global and persistent once defined.\n * Re-registering the same property name is a no-op.\n *\n * @param name - The custom property name (must start with --)\n * @param options - Property configuration\n *\n * @example\n * ```ts\n * // Define a color property that can be animated\n * property('--my-color', {\n * syntax: '<color>',\n * initialValue: 'red',\n * });\n *\n * // Define an angle property\n * property('--rotation', {\n * syntax: '<angle>',\n * inherits: false,\n * initialValue: '0deg',\n * });\n * ```\n */\nexport function property(name: string, options?: PropertyOptions): void {\n return getGlobalInjector().property(name, options);\n}\n\n/**\n * Check if a CSS @property has already been defined\n *\n * @param name - The custom property name to check\n * @param options - Options including root\n */\nexport function isPropertyDefined(\n name: string,\n options?: { root?: Document | ShadowRoot },\n): boolean {\n return getGlobalInjector().isPropertyDefined(name, options);\n}\n\n/**\n * Inject a CSS @font-face rule.\n *\n * Permanent and global — no dispose or ref-counting.\n * Deduplicates by content hash (family + descriptors).\n */\nexport function fontFace(\n family: string,\n descriptors: FontFaceDescriptors,\n options?: { root?: Document | ShadowRoot },\n): void {\n return getGlobalInjector().fontFace(family, descriptors, options);\n}\n\n/**\n * Inject a CSS @counter-style rule.\n *\n * Permanent and global — no dispose or ref-counting.\n * Deduplicates by name (first definition wins).\n */\nexport function counterStyle(\n name: string,\n descriptors: CounterStyleDescriptors,\n options?: { root?: Document | ShadowRoot },\n): void {\n return getGlobalInjector().counterStyle(name, descriptors, options);\n}\n\n/**\n * Get CSS text from all sheets (for SSR)\n */\nexport function getCssText(options?: { root?: Document | ShadowRoot }): string {\n return getGlobalInjector().getCssText(options);\n}\n\n/**\n * Collect only CSS used by a rendered subtree (like jest-styled-components).\n * Pass the container returned by render(...).\n */\nexport function getCssTextForNode(\n node: ParentNode | Element | DocumentFragment,\n options?: { root?: Document | ShadowRoot },\n): string {\n // Collect tasty-generated class names (t<number>) from the subtree\n const classSet = new Set<string>();\n\n const readClasses = (el: Element) => {\n const cls = el.getAttribute('class');\n if (!cls) return;\n for (const token of cls.split(/\\s+/)) {\n if (/^t\\d+$/.test(token)) classSet.add(token);\n }\n };\n\n // Include node itself if it's an Element\n if ((node as Element).getAttribute) {\n readClasses(node as Element);\n }\n // Walk descendants\n const elements = (node as ParentNode).querySelectorAll\n ? (node as ParentNode).querySelectorAll('[class]')\n : ([] as unknown as NodeListOf<Element>);\n if (elements) elements.forEach(readClasses);\n\n return getGlobalInjector().getCssTextForClasses(classSet, options);\n}\n\n/**\n * Force cleanup of unused rules\n */\nexport function cleanup(root?: Document | ShadowRoot): void {\n return getGlobalInjector().cleanup(root);\n}\n\n/**\n * Check if we're currently running in a test environment\n */\nexport function getIsTestEnvironment(): boolean {\n return isTestEnvironment();\n}\n\n/**\n * Get the global injector instance for debugging\n */\nexport const injector = {\n get instance() {\n return getGlobalInjector();\n },\n};\n\n/**\n * Destroy all resources and clean up\n */\nexport function destroy(root?: Document | ShadowRoot): void {\n return getGlobalInjector().destroy(root);\n}\n\n/**\n * Create a new isolated injector instance\n */\nexport function createInjector(\n config: Partial<StyleInjectorConfig> = {},\n): StyleInjector {\n const defaultConfig = getConfig();\n\n const fullConfig: StyleInjectorConfig = {\n ...defaultConfig,\n // Auto-enable forceTextInjection in test environments\n forceTextInjection: config.forceTextInjection ?? isTestEnvironment(),\n ...config,\n };\n\n return new StyleInjector(fullConfig);\n}\n\n// Re-export types\nexport type {\n StyleInjectorConfig,\n InjectResult,\n DisposeFunction,\n RuleInfo,\n SheetInfo,\n RootRegistry,\n StyleRule,\n KeyframesInfo,\n KeyframesResult,\n KeyframesSteps,\n KeyframesCacheEntry,\n CacheMetrics,\n RawCSSResult,\n PropertyDefinition,\n FontFaceDescriptors,\n FontFaceInput,\n CounterStyleDescriptors,\n} from './types';\n\nexport { StyleInjector } from './injector';\nexport { SheetManager } from './sheet-manager';\n"],"mappings":";;;;;;;;AAsBA,SAAgB,kBACd,UACA,SACiD;AACjD,QAAO,mBAAmB,CAAC,kBAAkB,UAAU,QAAQ;;;;;;;AAQjE,SAAgB,SACd,UACA,SACqB;AACrB,QAAO,mBAAmB,CAAC,SAAS,UAAU,QAAQ;;;;;AAMxD,SAAgB,OACd,OACA,SACc;AAEd,sBAAqB;AAErB,QAAO,mBAAmB,CAAC,OAAO,OAAO,QAAQ;;;;;AAMnD,SAAgB,aACd,OACA,SACoB;AACpB,QAAO,mBAAmB,CAAC,aAAa,OAAO,QAAQ;;;;;;;;;;;;;;;;;;;AAoBzD,SAAgB,aACd,KACA,SACyB;AACzB,QAAO,mBAAmB,CAAC,aAAa,KAAK,QAAQ;;;;;AAMvD,SAAgB,cAAc,SAEnB;AACT,QAAO,mBAAmB,CAAC,cAAc,QAAQ;;;;;AAMnD,SAAgB,UACd,OACA,eACiB;AACjB,QAAO,mBAAmB,CAAC,UAAU,OAAO,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkD5D,SAAgB,SAAS,MAAc,SAAiC;AACtE,QAAO,mBAAmB,CAAC,SAAS,MAAM,QAAQ;;;;;;;;AASpD,SAAgB,kBACd,MACA,SACS;AACT,QAAO,mBAAmB,CAAC,kBAAkB,MAAM,QAAQ;;;;;;;;AAS7D,SAAgB,SACd,QACA,aACA,SACM;AACN,QAAO,mBAAmB,CAAC,SAAS,QAAQ,aAAa,QAAQ;;;;;;;;AASnE,SAAgB,aACd,MACA,aACA,SACM;AACN,QAAO,mBAAmB,CAAC,aAAa,MAAM,aAAa,QAAQ;;;;;AAMrE,SAAgB,WAAW,SAAoD;AAC7E,QAAO,mBAAmB,CAAC,WAAW,QAAQ;;;;;;AAOhD,SAAgB,kBACd,MACA,SACQ;CAER,MAAM,2BAAW,IAAI,KAAa;CAElC,MAAM,eAAe,OAAgB;EACnC,MAAM,MAAM,GAAG,aAAa,QAAQ;AACpC,MAAI,CAAC,IAAK;AACV,OAAK,MAAM,SAAS,IAAI,MAAM,MAAM,CAClC,KAAI,SAAS,KAAK,MAAM,CAAE,UAAS,IAAI,MAAM;;AAKjD,KAAK,KAAiB,aACpB,aAAY,KAAgB;CAG9B,MAAM,WAAY,KAAoB,mBACjC,KAAoB,iBAAiB,UAAU,GAC/C,EAAE;AACP,KAAI,SAAU,UAAS,QAAQ,YAAY;AAE3C,QAAO,mBAAmB,CAAC,qBAAqB,UAAU,QAAQ;;;;;AAMpE,SAAgB,QAAQ,MAAoC;AAC1D,QAAO,mBAAmB,CAAC,QAAQ,KAAK;;;;;AAM1C,SAAgB,uBAAgC;AAC9C,QAAO,mBAAmB;;;;;AAM5B,MAAa,WAAW,EACtB,IAAI,WAAW;AACb,QAAO,mBAAmB;GAE7B;;;;AAKD,SAAgB,QAAQ,MAAoC;AAC1D,QAAO,mBAAmB,CAAC,QAAQ,KAAK;;;;;AAM1C,SAAgB,eACd,SAAuC,EAAE,EAC1B;AAUf,QAAO,IAAI,cAP6B;EACtC,GAHoB,WAAW;EAK/B,oBAAoB,OAAO,sBAAsB,mBAAmB;EACpE,GAAG;EACJ,CAEmC"}
@@ -1,166 +0,0 @@
1
- import { CacheMetrics, CounterStyleDescriptors, FontFaceDescriptors, GlobalInjectResult, InjectResult, KeyframesResult, KeyframesSteps, PropertyDefinition, RawCSSResult, StyleInjectorConfig } from "./types.js";
2
- import { StyleResult } from "../pipeline/index.js";
3
- import { SheetManager } from "./sheet-manager.js";
4
-
5
- //#region src/injector/injector.d.ts
6
- declare class StyleInjector {
7
- private sheetManager;
8
- private config;
9
- private cleanupScheduled;
10
- private globalRuleCounter;
11
- /** @internal — exposed for debug utilities only */
12
- get _sheetManager(): SheetManager;
13
- constructor(config?: StyleInjectorConfig);
14
- /**
15
- * Allocate a className for a cacheKey without injecting styles yet.
16
- * This allows separating className allocation (render phase) from style injection (insertion phase).
17
- */
18
- allocateClassName(cacheKey: string, options?: {
19
- root?: Document | ShadowRoot;
20
- }): {
21
- className: string;
22
- isNewAllocation: boolean;
23
- };
24
- /**
25
- * Inject styles from StyleResult objects
26
- */
27
- inject(rules: StyleResult[], options?: {
28
- root?: Document | ShadowRoot;
29
- cacheKey?: string;
30
- }): InjectResult;
31
- /**
32
- * Inject global styles (rules without a generated tasty class selector)
33
- * This ensures we don't reserve a tasty class name (t{number}) for global rules,
34
- * which could otherwise collide with element-level styles and break lookups.
35
- */
36
- injectGlobal(rules: StyleResult[], options?: {
37
- root?: Document | ShadowRoot;
38
- }): GlobalInjectResult;
39
- /**
40
- * Inject raw CSS text directly without parsing
41
- * This is a low-overhead alternative to createGlobalStyle for raw CSS
42
- * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking
43
- */
44
- injectRawCSS(css: string, options?: {
45
- root?: Document | ShadowRoot;
46
- }): RawCSSResult;
47
- /**
48
- * Get raw CSS text for SSR
49
- */
50
- getRawCSSText(options?: {
51
- root?: Document | ShadowRoot;
52
- }): string;
53
- /**
54
- * Increment refCount for an already-injected cacheKey and return a dispose.
55
- * Used by useStyles on cache hits (hydration or runtime reuse) where
56
- * the pipeline was skipped but refCount tracking is still needed.
57
- * Returns null if the cacheKey is not found.
58
- */
59
- trackRef(cacheKey: string, options?: {
60
- root?: Document | ShadowRoot;
61
- }): InjectResult | null;
62
- /**
63
- * Dispose of a className
64
- */
65
- private dispose;
66
- /**
67
- * Force bulk cleanup of unused styles
68
- */
69
- cleanup(root?: Document | ShadowRoot): void;
70
- /**
71
- * Get CSS text from all sheets (for SSR)
72
- */
73
- getCssText(options?: {
74
- root?: Document | ShadowRoot;
75
- }): string;
76
- /**
77
- * Get CSS only for the provided tasty classNames (e.g., ["t0","t3"])
78
- */
79
- getCssTextForClasses(classNames: Iterable<string>, options?: {
80
- root?: Document | ShadowRoot;
81
- }): string;
82
- /**
83
- * Get cache performance metrics
84
- */
85
- getMetrics(options?: {
86
- root?: Document | ShadowRoot;
87
- }): CacheMetrics | null;
88
- /**
89
- * Reset cache performance metrics
90
- */
91
- resetMetrics(options?: {
92
- root?: Document | ShadowRoot;
93
- }): void;
94
- /**
95
- * Define a CSS @property custom property.
96
- *
97
- * Accepts tasty token syntax for the property name:
98
- * - `$name` → defines `--name`
99
- * - `#name` → defines `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')
100
- * - `--name` → defines `--name` (legacy format)
101
- *
102
- * Example:
103
- * @property --rotation { syntax: "<angle>"; inherits: false; initial-value: 45deg; }
104
- *
105
- * Note: No caching or dispose — this defines a global property.
106
- *
107
- * If the same property is registered with different options, a warning is emitted
108
- * but the original definition is preserved (CSS @property cannot be redefined).
109
- */
110
- property(name: string, options?: PropertyDefinition & {
111
- root?: Document | ShadowRoot;
112
- }): void;
113
- /**
114
- * Check whether a given @property name was already injected by this injector.
115
- *
116
- * Accepts tasty token syntax:
117
- * - `$name` → checks `--name`
118
- * - `#name` → checks `--name-color`
119
- * - `--name` → checks `--name` (legacy format)
120
- */
121
- isPropertyDefined(name: string, options?: {
122
- root?: Document | ShadowRoot;
123
- }): boolean;
124
- /**
125
- * Inject a CSS @font-face rule.
126
- *
127
- * Permanent and global — no dispose or ref-counting.
128
- * Deduplicates by content hash (family + descriptors).
129
- */
130
- fontFace(family: string, descriptors: FontFaceDescriptors, options?: {
131
- root?: Document | ShadowRoot;
132
- }): void;
133
- /**
134
- * Inject a CSS @counter-style rule.
135
- *
136
- * Permanent and global — no dispose or ref-counting.
137
- * Deduplicates by name (first definition wins).
138
- */
139
- counterStyle(name: string, descriptors: CounterStyleDescriptors, options?: {
140
- root?: Document | ShadowRoot;
141
- }): void;
142
- /**
143
- * Inject keyframes and return object with toString() and dispose()
144
- *
145
- * Keyframes are cached by content (steps). If the same content is injected
146
- * multiple times with different provided names, the first injected name is reused.
147
- *
148
- * If the same name is provided with different content (collision), a unique
149
- * name is generated to avoid overwriting the existing keyframes.
150
- */
151
- keyframes(steps: KeyframesSteps, nameOrOptions?: string | {
152
- root?: Document | ShadowRoot;
153
- name?: string;
154
- }): KeyframesResult;
155
- /**
156
- * Dispose keyframes
157
- */
158
- private disposeKeyframes;
159
- /**
160
- * Destroy all resources for a root
161
- */
162
- destroy(root?: Document | ShadowRoot): void;
163
- }
164
- //#endregion
165
- export { StyleInjector };
166
- //# sourceMappingURL=injector.d.ts.map