@elastic/distillate 0.0.0 → 0.1.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 (285) hide show
  1. package/LICENSE.txt +93 -0
  2. package/NOTICE.txt +30 -0
  3. package/README.md +142 -0
  4. package/THIRD_PARTY_LICENSES.md +768 -0
  5. package/dist/cjs/collector.js +420 -0
  6. package/dist/cjs/collector.js.map +1 -0
  7. package/dist/cjs/css_scan.js +186 -0
  8. package/dist/cjs/css_scan.js.map +1 -0
  9. package/dist/cjs/dom_sink.js +40 -0
  10. package/dist/cjs/dom_sink.js.map +1 -0
  11. package/dist/cjs/emotion.js +189 -0
  12. package/dist/cjs/emotion.js.map +1 -0
  13. package/dist/cjs/engine.js +79 -0
  14. package/dist/cjs/engine.js.map +1 -0
  15. package/dist/cjs/environment.js +9 -0
  16. package/dist/cjs/environment.js.map +1 -0
  17. package/dist/cjs/hash.js +86 -0
  18. package/dist/cjs/hash.js.map +1 -0
  19. package/dist/cjs/idents.js +23 -0
  20. package/dist/cjs/idents.js.map +1 -0
  21. package/dist/cjs/index.js +42 -0
  22. package/dist/cjs/index.js.map +1 -0
  23. package/dist/cjs/instance.js +34 -0
  24. package/dist/cjs/instance.js.map +1 -0
  25. package/dist/cjs/local_vars.js +100 -0
  26. package/dist/cjs/local_vars.js.map +1 -0
  27. package/dist/cjs/minify.js +77 -0
  28. package/dist/cjs/minify.js.map +1 -0
  29. package/dist/cjs/names.js +77 -0
  30. package/dist/cjs/names.js.map +1 -0
  31. package/dist/cjs/nesting.js +406 -0
  32. package/dist/cjs/nesting.js.map +1 -0
  33. package/dist/cjs/package.json +3 -0
  34. package/dist/cjs/runtime.js +257 -0
  35. package/dist/cjs/runtime.js.map +1 -0
  36. package/dist/cjs/styles/authoring.js +169 -0
  37. package/dist/cjs/styles/authoring.js.map +1 -0
  38. package/dist/cjs/styles/declarations.js +139 -0
  39. package/dist/cjs/styles/declarations.js.map +1 -0
  40. package/dist/cjs/styles/index.js +32 -0
  41. package/dist/cjs/styles/index.js.map +1 -0
  42. package/dist/cjs/styles/module.js +233 -0
  43. package/dist/cjs/styles/module.js.map +1 -0
  44. package/dist/cjs/styles/registry.js +187 -0
  45. package/dist/cjs/styles/registry.js.map +1 -0
  46. package/dist/cjs/styles/types.js +9 -0
  47. package/dist/cjs/styles/types.js.map +1 -0
  48. package/dist/cjs/testing.js +37 -0
  49. package/dist/cjs/testing.js.map +1 -0
  50. package/dist/cjs/theme.js +249 -0
  51. package/dist/cjs/theme.js.map +1 -0
  52. package/dist/cjs/tokens/contextual_var.js +39 -0
  53. package/dist/cjs/tokens/contextual_var.js.map +1 -0
  54. package/dist/cjs/tokens/index.js +24 -0
  55. package/dist/cjs/tokens/index.js.map +1 -0
  56. package/dist/cjs/tokens/kind.js +14 -0
  57. package/dist/cjs/tokens/kind.js.map +1 -0
  58. package/dist/cjs/tokens/light_dark.js +42 -0
  59. package/dist/cjs/tokens/light_dark.js.map +1 -0
  60. package/dist/cjs/tokens/scale_token.js +28 -0
  61. package/dist/cjs/tokens/scale_token.js.map +1 -0
  62. package/dist/cjs/tokens/theme_token.js +28 -0
  63. package/dist/cjs/tokens/theme_token.js.map +1 -0
  64. package/dist/cjs/var_invariant.js +115 -0
  65. package/dist/cjs/var_invariant.js.map +1 -0
  66. package/dist/collector.d.ts +84 -0
  67. package/dist/collector.d.ts.map +1 -0
  68. package/dist/collector.js +416 -0
  69. package/dist/collector.js.map +1 -0
  70. package/dist/css_scan.d.ts +57 -0
  71. package/dist/css_scan.d.ts.map +1 -0
  72. package/dist/css_scan.js +180 -0
  73. package/dist/css_scan.js.map +1 -0
  74. package/dist/dom_sink.d.ts +27 -0
  75. package/dist/dom_sink.d.ts.map +1 -0
  76. package/dist/dom_sink.js +36 -0
  77. package/dist/dom_sink.js.map +1 -0
  78. package/dist/emotion.d.ts +47 -0
  79. package/dist/emotion.d.ts.map +1 -0
  80. package/dist/emotion.js +184 -0
  81. package/dist/emotion.js.map +1 -0
  82. package/dist/engine.d.ts +41 -0
  83. package/dist/engine.d.ts.map +1 -0
  84. package/dist/engine.js +75 -0
  85. package/dist/engine.js.map +1 -0
  86. package/dist/environment.d.ts +43 -0
  87. package/dist/environment.d.ts.map +1 -0
  88. package/dist/environment.js +8 -0
  89. package/dist/environment.js.map +1 -0
  90. package/dist/hash.d.ts +2 -0
  91. package/dist/hash.d.ts.map +1 -0
  92. package/dist/hash.js +82 -0
  93. package/dist/hash.js.map +1 -0
  94. package/dist/idents.d.ts +9 -0
  95. package/dist/idents.d.ts.map +1 -0
  96. package/dist/idents.js +19 -0
  97. package/dist/idents.js.map +1 -0
  98. package/dist/index.d.ts +9 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +14 -0
  101. package/dist/index.js.map +1 -0
  102. package/dist/instance.d.ts +16 -0
  103. package/dist/instance.d.ts.map +1 -0
  104. package/dist/instance.js +30 -0
  105. package/dist/instance.js.map +1 -0
  106. package/dist/local_vars.d.ts +75 -0
  107. package/dist/local_vars.d.ts.map +1 -0
  108. package/dist/local_vars.js +92 -0
  109. package/dist/local_vars.js.map +1 -0
  110. package/dist/minify.d.ts +11 -0
  111. package/dist/minify.d.ts.map +1 -0
  112. package/dist/minify.js +73 -0
  113. package/dist/minify.js.map +1 -0
  114. package/dist/names.d.ts +39 -0
  115. package/dist/names.d.ts.map +1 -0
  116. package/dist/names.js +70 -0
  117. package/dist/names.js.map +1 -0
  118. package/dist/nesting.d.ts +59 -0
  119. package/dist/nesting.d.ts.map +1 -0
  120. package/dist/nesting.js +400 -0
  121. package/dist/nesting.js.map +1 -0
  122. package/dist/runtime.d.ts +36 -0
  123. package/dist/runtime.d.ts.map +1 -0
  124. package/dist/runtime.js +252 -0
  125. package/dist/runtime.js.map +1 -0
  126. package/dist/styles/authoring.d.ts +59 -0
  127. package/dist/styles/authoring.d.ts.map +1 -0
  128. package/dist/styles/authoring.js +155 -0
  129. package/dist/styles/authoring.js.map +1 -0
  130. package/dist/styles/declarations.d.ts +10 -0
  131. package/dist/styles/declarations.d.ts.map +1 -0
  132. package/dist/styles/declarations.js +132 -0
  133. package/dist/styles/declarations.js.map +1 -0
  134. package/dist/styles/index.d.ts +7 -0
  135. package/dist/styles/index.d.ts.map +1 -0
  136. package/dist/styles/index.js +12 -0
  137. package/dist/styles/index.js.map +1 -0
  138. package/dist/styles/module.d.ts +5 -0
  139. package/dist/styles/module.d.ts.map +1 -0
  140. package/dist/styles/module.js +229 -0
  141. package/dist/styles/module.js.map +1 -0
  142. package/dist/styles/registry.d.ts +48 -0
  143. package/dist/styles/registry.d.ts.map +1 -0
  144. package/dist/styles/registry.js +182 -0
  145. package/dist/styles/registry.js.map +1 -0
  146. package/dist/styles/types.d.ts +211 -0
  147. package/dist/styles/types.d.ts.map +1 -0
  148. package/dist/styles/types.js +8 -0
  149. package/dist/styles/types.js.map +1 -0
  150. package/dist/testing.d.ts +10 -0
  151. package/dist/testing.d.ts.map +1 -0
  152. package/dist/testing.js +31 -0
  153. package/dist/testing.js.map +1 -0
  154. package/dist/theme.d.ts +85 -0
  155. package/dist/theme.d.ts.map +1 -0
  156. package/dist/theme.js +240 -0
  157. package/dist/theme.js.map +1 -0
  158. package/dist/tokens/contextual_var.d.ts +35 -0
  159. package/dist/tokens/contextual_var.d.ts.map +1 -0
  160. package/dist/tokens/contextual_var.js +33 -0
  161. package/dist/tokens/contextual_var.js.map +1 -0
  162. package/dist/tokens/index.d.ts +5 -0
  163. package/dist/tokens/index.d.ts.map +1 -0
  164. package/dist/tokens/index.js +11 -0
  165. package/dist/tokens/index.js.map +1 -0
  166. package/dist/tokens/kind.d.ts +2 -0
  167. package/dist/tokens/kind.d.ts.map +1 -0
  168. package/dist/tokens/kind.js +10 -0
  169. package/dist/tokens/kind.js.map +1 -0
  170. package/dist/tokens/light_dark.d.ts +20 -0
  171. package/dist/tokens/light_dark.d.ts.map +1 -0
  172. package/dist/tokens/light_dark.js +37 -0
  173. package/dist/tokens/light_dark.js.map +1 -0
  174. package/dist/tokens/scale_token.d.ts +20 -0
  175. package/dist/tokens/scale_token.d.ts.map +1 -0
  176. package/dist/tokens/scale_token.js +23 -0
  177. package/dist/tokens/scale_token.js.map +1 -0
  178. package/dist/tokens/theme_token.d.ts +20 -0
  179. package/dist/tokens/theme_token.d.ts.map +1 -0
  180. package/dist/tokens/theme_token.js +23 -0
  181. package/dist/tokens/theme_token.js.map +1 -0
  182. package/dist/var_invariant.d.ts +25 -0
  183. package/dist/var_invariant.d.ts.map +1 -0
  184. package/dist/var_invariant.js +108 -0
  185. package/dist/var_invariant.js.map +1 -0
  186. package/docs/concepts/authoring.md +115 -0
  187. package/docs/concepts/collection.md +66 -0
  188. package/docs/concepts/distillery.md +47 -0
  189. package/docs/concepts/index.md +18 -0
  190. package/docs/concepts/naming-and-output.md +123 -0
  191. package/docs/concepts/ordering.md +61 -0
  192. package/docs/concepts/single-copy.md +103 -0
  193. package/docs/concepts/tokens.md +99 -0
  194. package/docs/docset.yml +53 -0
  195. package/docs/examples/01-stylesheet.ts +20 -0
  196. package/docs/examples/02-artifact.ts +26 -0
  197. package/docs/examples/03-variants.ts +40 -0
  198. package/docs/examples/04-emotion.ts +33 -0
  199. package/docs/examples/05-var-invariant.ts +31 -0
  200. package/docs/examples/06-payload.ts +85 -0
  201. package/docs/examples/fixture.ts +22 -0
  202. package/docs/getting-started/index.md +14 -0
  203. package/docs/getting-started/installation.md +30 -0
  204. package/docs/getting-started/quick-start.md +61 -0
  205. package/docs/getting-started/your-first-stylesheet.md +57 -0
  206. package/docs/guides/compact-artifacts.md +87 -0
  207. package/docs/guides/emotion-migration.md +60 -0
  208. package/docs/guides/index.md +17 -0
  209. package/docs/guides/name-collisions.md +37 -0
  210. package/docs/guides/non-css-surfaces.md +73 -0
  211. package/docs/guides/react-renderer.md +158 -0
  212. package/docs/guides/theming.md +107 -0
  213. package/docs/guides/var-invariant.md +24 -0
  214. package/docs/guides/vs-emotion.md +61 -0
  215. package/docs/index.md +73 -0
  216. package/docs/logo.svg +7 -0
  217. package/docs/playground/index.html +12 -0
  218. package/docs/playground/package.json +23 -0
  219. package/docs/playground/src/app/app.tsx +109 -0
  220. package/docs/playground/src/app/css_panel.tsx +119 -0
  221. package/docs/playground/src/app/editor_panel.tsx +87 -0
  222. package/docs/playground/src/app/index.ts +8 -0
  223. package/docs/playground/src/app/monaco_css_editor.tsx +84 -0
  224. package/docs/playground/src/app/monaco_source_editor.tsx +132 -0
  225. package/docs/playground/src/app/preview_panel.tsx +99 -0
  226. package/docs/playground/src/app/tokens_panel.tsx +117 -0
  227. package/docs/playground/src/app/types.ts +10 -0
  228. package/docs/playground/src/examples/snippets.test.ts +28 -0
  229. package/docs/playground/src/examples/snippets.ts +418 -0
  230. package/docs/playground/src/lib/compile.test.ts +157 -0
  231. package/docs/playground/src/lib/compile.ts +242 -0
  232. package/docs/playground/src/lib/demo_environment.test.ts +123 -0
  233. package/docs/playground/src/lib/demo_environment.ts +140 -0
  234. package/docs/playground/src/lib/editor_lib.test.ts +39 -0
  235. package/docs/playground/src/lib/editor_lib.ts +142 -0
  236. package/docs/playground/src/lib/format_css.test.ts +41 -0
  237. package/docs/playground/src/lib/format_css.ts +71 -0
  238. package/docs/playground/src/main.tsx +25 -0
  239. package/docs/playground/src/setup/chrome.test.ts +47 -0
  240. package/docs/playground/src/setup/chrome.ts +365 -0
  241. package/docs/playground/src/setup/monaco_env.ts +64 -0
  242. package/docs/playground/tsconfig.json +22 -0
  243. package/docs/playground/vite.config.ts +37 -0
  244. package/docs/playground/vitest.config.ts +35 -0
  245. package/docs/playground.md +28 -0
  246. package/docs/reference/api/emotion.md +372 -0
  247. package/docs/reference/api/index-1.md +2180 -0
  248. package/docs/reference/api/index.md +9 -0
  249. package/docs/reference/api/testing.md +92 -0
  250. package/docs/reference/api.md +12 -0
  251. package/docs/reference/entry-points.md +125 -0
  252. package/docs/reference/environment.md +60 -0
  253. package/docs/reference/index.md +11 -0
  254. package/docs/reference/okf-map.md +92 -0
  255. package/package.json +127 -4
  256. package/src/collector.ts +526 -0
  257. package/src/css_scan.ts +263 -0
  258. package/src/dom_sink.ts +65 -0
  259. package/src/emotion.ts +311 -0
  260. package/src/engine.ts +191 -0
  261. package/src/environment.ts +56 -0
  262. package/src/hash.ts +111 -0
  263. package/src/idents.ts +21 -0
  264. package/src/index.ts +93 -0
  265. package/src/instance.ts +49 -0
  266. package/src/local_vars.ts +220 -0
  267. package/src/minify.ts +87 -0
  268. package/src/names.ts +129 -0
  269. package/src/nesting.ts +596 -0
  270. package/src/runtime.ts +428 -0
  271. package/src/styles/authoring.ts +244 -0
  272. package/src/styles/declarations.ts +172 -0
  273. package/src/styles/index.ts +58 -0
  274. package/src/styles/module.ts +396 -0
  275. package/src/styles/registry.ts +261 -0
  276. package/src/styles/types.ts +283 -0
  277. package/src/testing.ts +48 -0
  278. package/src/theme.ts +454 -0
  279. package/src/tokens/contextual_var.ts +72 -0
  280. package/src/tokens/index.ts +17 -0
  281. package/src/tokens/kind.ts +13 -0
  282. package/src/tokens/light_dark.ts +58 -0
  283. package/src/tokens/scale_token.ts +41 -0
  284. package/src/tokens/theme_token.ts +42 -0
  285. package/src/var_invariant.ts +147 -0
@@ -0,0 +1,28 @@
1
+ ---
2
+ navigation_title: Playground
3
+ description: Live Distillate editor with stylesheet, compact names, and a tree-shaken artifact.
4
+ ---
5
+
6
+ # Playground
7
+
8
+ The playground is a full-viewport workbench: source and tokens on the left, a centered live preview in the remaining canvas, and generated CSS under the preview.
9
+
10
+ - **On GitHub Pages:** [elastic.github.io/distillate/playground](https://elastic.github.io/distillate/playground/)
11
+ - **Locally:** `pnpm playground:dev` from the repo root (Vite, default <http://localhost:5173>)
12
+
13
+ Two authoring modes share one demo environment (`prefix: 'dstl'`, theme vars on `:host`):
14
+
15
+ - **Emotion** — tagged `css` templates, plus `cx`, `injectGlobal`, `tokens`, and `cn`
16
+ - **Native module** — `createStyleModule`, `rule`, `media`, `container`, `variants`, `tokens`, `cn`
17
+
18
+ The editor is Monaco with TypeScript IntelliSense for the injected playground scope (`css` / `createStyleModule`, `tokens`, `cn`, …). Generated CSS is a read-only Monaco view of the compile output. Imports in snippets are educational; the real bindings are injected at eval time. Each snippet ends in `return` of an HTML string.
19
+
20
+ **Readable** and **Compact** are naming modes on the full stylesheet (`stylesheetCollector`). **Artifact** is the compact payload from the handles the returned markup actually named (`artifactCollector`, after collection completes). Byte counts for the full stylesheet versus that artifact stay visible above the CSS; they are the same comparison as [`docs/examples/06-payload.ts`](https://github.com/elastic/distillate/blob/main/docs/examples/06-payload.ts). Card, Buttons, Tree shake, Local vars, and Media + container ship in both modes so you can compare authoring. Switching Emotion vs Native keeps the selected example. **Tree shake** names one style in the markup; the stylesheet still contains the rest. See [`docs/playground/src/examples/snippets.ts`](https://github.com/elastic/distillate/blob/main/docs/playground/src/examples/snippets.ts).
21
+
22
+ Emotion handles collect when `cx(...)`, `cn(...)`, or string interpolation (`${handle}`) runs during the returned markup. `injectGlobal` still follows engine semantics: it ships in the stylesheet and is omitted from the artifact unless you collect those modules yourself.
23
+
24
+ A read-only Tokens table sits under the editor and lists every `tokens.*` path in the demo environment with its resolved CSS (`themeVars` light/dark for colors and fonts; `value` / `.cq` for scales). Color swatches follow the Preview Light/Dark toggle. Demo colors use Borealis brand values (`primary`, `accent`, `accentSecondary`, `success`, `warning`, `danger`) plus text, surface, subtle, and border — hard-coded, not imported from EUI.
25
+
26
+ The chrome around the editor is itself a Distillate readable stylesheet (`prefix: 'pg'`, theme vars on `:root`), kept on a separate distillery from snippet compilation so the two registries never mix.
27
+
28
+ The compile pipeline is sucrase (TypeScript → JS) then `new Function`. It is a demo, not a sandbox: do not paste untrusted source.
@@ -0,0 +1,372 @@
1
+ # emotion
2
+
3
+ ## Interfaces
4
+
5
+ ### CreateDomSinkOptions [#createdomsinkoptions]
6
+
7
+ Defined in: [dom\_sink.ts:25](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L25)
8
+
9
+ Host document and optional flush scheduler for a `<style>` sink.
10
+
11
+ #### Properties
12
+
13
+ | Property | Type | Description | Defined in |
14
+ | ------ | ------ | ------ | ------ |
15
+ | $$$document$$$ `document` | [`DocumentLike`](#documentlike) | The host document where the style element will be appended. | [dom\_sink.ts:27](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L27) |
16
+ | $$$schedule$$$ `schedule?` | (`flush`) => `void` | Defers the flush. Defaults to `queueMicrotask`. | [dom\_sink.ts:29](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L29) |
17
+
18
+ ***
19
+
20
+ ### CreateEmotionOptions [#createemotionoptions]
21
+
22
+ Defined in: [emotion.ts:33](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L33)
23
+
24
+ Shared sink for Emotion compat modules on one registry.
25
+
26
+ #### Properties
27
+
28
+ | Property | Type | Description | Defined in |
29
+ | ------ | ------ | ------ | ------ |
30
+ | $$$sink$$$ `sink?` | [`StyleSink`](#stylesink) | Notified when a compat module registers. Shared across `createEmotion` calls on the same registry. | [emotion.ts:35](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L35) |
31
+
32
+ ***
33
+
34
+ ### DocumentLike [#documentlike]
35
+
36
+ Defined in: [dom\_sink.ts:17](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L17)
37
+
38
+ Minimal interface for a DOM `Document` able to create and append style tags.
39
+
40
+ #### Properties
41
+
42
+ | Property | Modifier | Type | Description | Defined in |
43
+ | ------ | ------ | ------ | ------ | ------ |
44
+ | $$$head$$$ `head` | `readonly` | `object` | Node that receives the created style element. | [dom\_sink.ts:21](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L21) |
45
+ | `head.appendChild` | `public` | `void` | - | [dom\_sink.ts:21](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L21) |
46
+
47
+ #### Methods
48
+
49
+ ##### createElement() [#createelement]
50
+
51
+ ```ts
52
+ createElement(tagName): StyleElementLike;
53
+ ```
54
+
55
+ Defined in: [dom\_sink.ts:19](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L19)
56
+
57
+ Creates a `<style>` element.
58
+
59
+ ###### Parameters
60
+
61
+ | Parameter | Type |
62
+ | ------ | ------ |
63
+ | `tagName` | `"style"` |
64
+
65
+ ###### Returns
66
+
67
+ [`StyleElementLike`](#styleelementlike)
68
+
69
+ ***
70
+
71
+ ### Emotion [#emotion]
72
+
73
+ Defined in: [emotion.ts:59](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L59)
74
+
75
+ Emotion-shaped authoring API bound to one Distillery registry.
76
+
77
+ #### Methods
78
+
79
+ ##### css() [#css]
80
+
81
+ ```ts
82
+ css(strings, ...values): EmotionCss;
83
+ ```
84
+
85
+ Defined in: [emotion.ts:61](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L61)
86
+
87
+ Authors styles and returns a handle that can be used directly or passed to `cx`.
88
+
89
+ ###### Parameters
90
+
91
+ | Parameter | Type |
92
+ | ------ | ------ |
93
+ | `strings` | `TemplateStringsArray` |
94
+ | ...`values` | readonly `unknown`[] |
95
+
96
+ ###### Returns
97
+
98
+ [`EmotionCss`](#emotioncss-1)
99
+
100
+ ##### cx() [#cx]
101
+
102
+ ```ts
103
+ cx(...args): string;
104
+ ```
105
+
106
+ Defined in: [emotion.ts:63](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L63)
107
+
108
+ Combines handles, conditional classes, and plain strings into a space-separated string.
109
+
110
+ ###### Parameters
111
+
112
+ | Parameter | Type |
113
+ | ------ | ------ |
114
+ | ...`args` | readonly [`ClassNameArg`](#classnamearg)[] |
115
+
116
+ ###### Returns
117
+
118
+ `string`
119
+
120
+ ##### globalModules() [#globalmodules]
121
+
122
+ ```ts
123
+ globalModules(): readonly StylesModule<StylesObject>[];
124
+ ```
125
+
126
+ Defined in: [emotion.ts:72](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L72)
127
+
128
+ Returns the underlying modules backing `injectGlobal` calls.
129
+
130
+ ###### Returns
131
+
132
+ readonly [`StylesModule`](index-1.md#stylesmodule)\<[`StylesObject`](index-1.md#stylesobject)\>[]
133
+
134
+ ##### injectGlobal() [#injectglobal]
135
+
136
+ ```ts
137
+ injectGlobal(strings, ...values): void;
138
+ ```
139
+
140
+ Defined in: [emotion.ts:65](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L65)
141
+
142
+ Defines styles that apply globally (e.g. `body`, `html`).
143
+
144
+ ###### Parameters
145
+
146
+ | Parameter | Type |
147
+ | ------ | ------ |
148
+ | `strings` | `TemplateStringsArray` |
149
+ | ...`values` | readonly `unknown`[] |
150
+
151
+ ###### Returns
152
+
153
+ `void`
154
+
155
+ ##### stylesheet() [#stylesheet]
156
+
157
+ ```ts
158
+ stylesheet(): string;
159
+ ```
160
+
161
+ Defined in: [emotion.ts:70](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L70)
162
+
163
+ Emits the full CSS for all generated emotion styles.
164
+
165
+ ###### Returns
166
+
167
+ `string`
168
+
169
+ ***
170
+
171
+ ### EmotionCss [#emotioncss-1]
172
+
173
+ Defined in: [emotion.ts:39](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L39)
174
+
175
+ Style handle that stringifies to its readable class name.
176
+
177
+ #### Extends
178
+
179
+ - [`StyleHandle`](index-1.md#stylehandle)
180
+
181
+ #### Properties
182
+
183
+ | Property | Modifier | Type | Description | Inherited from | Defined in |
184
+ | ------ | ------ | ------ | ------ | ------ | ------ |
185
+ | $$$declarations$$$ `declarations` | `readonly` | [`Declarations`](index-1.md#declarations) | CSS properties for this handle. | [`StyleHandle`](index-1.md#stylehandle).[`declarations`](index-1.md#declarations-1) | [styles/types.ts:117](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L117) |
186
+ | $$$key$$$ `key` | `readonly` | `string` | Full path joined by dots. | [`StyleHandle`](index-1.md#stylehandle).[`key`](index-1.md#key-1) | [styles/types.ts:113](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L113) |
187
+ | $$$kind$$$ `kind` | `readonly` | `"handle"` | Discriminant for [StyleEntry](index-1.md#styleentry). | [`StyleHandle`](index-1.md#stylehandle).[`kind`](index-1.md#kind) | [styles/types.ts:107](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L107) |
188
+ | $$$localname$$$ `localName` | `readonly` | `string` | Leaf key if at root, or composed path for nested handles. | [`StyleHandle`](index-1.md#stylehandle).[`localName`](index-1.md#localname) | [styles/types.ts:111](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L111) |
189
+ | $$$modulename$$$ `moduleName` | `readonly` | `string` | The registered module name this handle belongs to. | [`StyleHandle`](index-1.md#stylehandle).[`moduleName`](index-1.md#modulename) | [styles/types.ts:109](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L109) |
190
+ | $$$readablename$$$ `readableName` | `readonly` | `string` | Predictable name used for output CSS classes. | [`StyleHandle`](index-1.md#stylehandle).[`readableName`](index-1.md#readablename) | [styles/types.ts:115](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L115) |
191
+ | $$$variant$$$ `variant` | `readonly` | `boolean` | `true` when produced inside `variants(...)`. Skipped by [StylesCollector.use](index-1.md#use). | [`StyleHandle`](index-1.md#stylehandle).[`variant`](index-1.md#variant) | [styles/types.ts:119](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L119) |
192
+
193
+ #### Methods
194
+
195
+ ##### \[toPrimitive\]() [#toprimitive]
196
+
197
+ ```ts
198
+ toPrimitive: string;
199
+ ```
200
+
201
+ Defined in: [emotion.ts:43](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L43)
202
+
203
+ Template interpolation; same as [EmotionCss.toString](#tostring).
204
+
205
+ ###### Parameters
206
+
207
+ | Parameter | Type |
208
+ | ------ | ------ |
209
+ | `hint` | `string` |
210
+
211
+ ###### Returns
212
+
213
+ `string`
214
+
215
+ ##### resolveClassName() [#resolveclassname]
216
+
217
+ ```ts
218
+ resolveClassName(context): string;
219
+ ```
220
+
221
+ Defined in: [styles/types.ts:121](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/styles/types.ts#L121)
222
+
223
+ Produces the final class name via the provided resolver context.
224
+
225
+ ###### Parameters
226
+
227
+ | Parameter | Type | Description |
228
+ | ------ | ------ | ------ |
229
+ | `context` | \{ `resolveClassName`: (...`handles`) => `string`; \} | - |
230
+ | `context.resolveClassName` | (...`handles`) => `string` | Joins one or more handles into a class-name string. |
231
+
232
+ ###### Returns
233
+
234
+ `string`
235
+
236
+ ###### Inherited from
237
+
238
+ [`StyleHandle`](index-1.md#stylehandle).[`resolveClassName`](index-1.md#resolveclassname)
239
+
240
+ ##### toString() [#tostring]
241
+
242
+ ```ts
243
+ toString(): string;
244
+ ```
245
+
246
+ Defined in: [emotion.ts:41](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L41)
247
+
248
+ Stringifies to the readable class name.
249
+
250
+ ###### Returns
251
+
252
+ `string`
253
+
254
+ ***
255
+
256
+ ### StyleElementLike [#styleelementlike]
257
+
258
+ Defined in: [dom\_sink.ts:11](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L11)
259
+
260
+ Minimal interface for a DOM `<style>` element.
261
+
262
+ #### Properties
263
+
264
+ | Property | Type | Description | Defined in |
265
+ | ------ | ------ | ------ | ------ |
266
+ | $$$textcontent$$$ `textContent` | `string` \| `null` | Current stylesheet text, or `null` before the first flush. | [dom\_sink.ts:13](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L13) |
267
+
268
+ ***
269
+
270
+ ### StyleSink [#stylesink]
271
+
272
+ Defined in: [emotion.ts:27](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L27)
273
+
274
+ Receives stylesheet invalidation from Emotion compat modules.
275
+
276
+ #### Methods
277
+
278
+ ##### invalidate() [#invalidate]
279
+
280
+ ```ts
281
+ invalidate(render): void;
282
+ ```
283
+
284
+ Defined in: [emotion.ts:29](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L29)
285
+
286
+ Marks the sink dirty. `render` produces the current stylesheet when it flushes.
287
+
288
+ ###### Parameters
289
+
290
+ | Parameter | Type |
291
+ | ------ | ------ |
292
+ | `render` | () => `string` |
293
+
294
+ ###### Returns
295
+
296
+ `void`
297
+
298
+ ## Type Aliases
299
+
300
+ ### ClassNameArg [#classnamearg]
301
+
302
+ ```ts
303
+ type ClassNameArg =
304
+ | string
305
+ | number
306
+ | false
307
+ | null
308
+ | undefined
309
+ | EmotionCss
310
+ | StyleHandle
311
+ | ClassNameArg[]
312
+ | {
313
+ [className: string]: boolean;
314
+ };
315
+ ```
316
+
317
+ Defined in: [emotion.ts:47](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L47)
318
+
319
+ One `cx(...)` argument: a class, handle, list, or truthy map.
320
+
321
+ ## Functions
322
+
323
+ ### createDomSink() [#createdomsink]
324
+
325
+ ```ts
326
+ function createDomSink(__namedParameters): StyleSink;
327
+ ```
328
+
329
+ Defined in: [dom\_sink.ts:35](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/dom_sink.ts#L35)
330
+
331
+ One managed `<style>` element, rewritten on each flush.
332
+
333
+ #### Parameters
334
+
335
+ | Parameter | Type |
336
+ | ------ | ------ |
337
+ | `__namedParameters` | [`CreateDomSinkOptions`](#createdomsinkoptions) |
338
+
339
+ #### Returns
340
+
341
+ [`StyleSink`](#stylesink)
342
+
343
+ ***
344
+
345
+ ### createEmotion() [#createemotion]
346
+
347
+ ```ts
348
+ function createEmotion<TTokens>(distillery, options?): Emotion;
349
+ ```
350
+
351
+ Defined in: [emotion.ts:117](https://github.com/elastic/distillate/blob/f131912edadeb90a659ad22ee215412bedb1394d/src/emotion.ts#L117)
352
+
353
+ `@emotion/css`-shaped API over a distillery.
354
+
355
+ `String(css\`...\`)` is the readable class name and does not collect. Passing the wrapper through `resolveClassName` collects and compacts like a native handle.
356
+
357
+ #### Type Parameters
358
+
359
+ | Type Parameter |
360
+ | ------ |
361
+ | `TTokens` |
362
+
363
+ #### Parameters
364
+
365
+ | Parameter | Type | Description |
366
+ | ------ | ------ | ------ |
367
+ | `distillery` | [`Distillery`](index-1.md#distillery)\<`TTokens`\> | Bound distillery that owns the underlying registry. |
368
+ | `options` | [`CreateEmotionOptions`](#createemotionoptions) | Optional sink for DOM injection. |
369
+
370
+ #### Returns
371
+
372
+ [`Emotion`](#emotion)