@fastkit/plugboy-vanilla-extract-plugin 4.0.0-next.0 → 4.0.0-next.10

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.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # @fastkit/plugboy-vanilla-extract-plugin
2
+
3
+ 🌐 English | [日本語](https://github.com/dadajam4/fastkit/blob/main/packages/plugboy-vanilla-extract-plugin/README-ja.md)
4
+
5
+ A plugin that integrates [Vanilla Extract](https://vanilla-extract.style/) into [Plugboy](https://github.com/dadajam4/fastkit/blob/main/packages/plugboy/README.md) builds. It bundles the CSS extracted from `.css.ts` files into a single stylesheet per package, ships a Vite plugin for development, and provides helpers for working with cascade layers.
6
+
7
+ ## Features
8
+
9
+ - **Single CSS output**: Combines the styles extracted from a package's `.css.ts` files into one `dist/<package>.css`.
10
+ - **Automatic merge with plain CSS**: Merges tsdown's output for plain `.css` / `.scss` with the Vanilla Extract output into a single file (preventing the style loss caused by a file-name collision between the two).
11
+ - **Vite integration**: Ships a Vite plugin for use in dev servers, Storybook, and similar environments.
12
+ - **Layer helpers**: `@fastkit/plugboy-vanilla-extract-plugin/css` exposes utilities for defining cascade layers in a type-safe way.
13
+
14
+ > [!NOTE]
15
+ > Preserving external `@import`s (e.g. `@import url('material-symbols/rounded.css') layer(...)`) and ordering `@layer` declarations are handled by [Plugboy](https://github.com/dadajam4/fastkit/blob/main/packages/plugboy/README.md) itself, and apply to the CSS this plugin combines as well.
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install -D @fastkit/plugboy-vanilla-extract-plugin
21
+ # or
22
+ pnpm add -D @fastkit/plugboy-vanilla-extract-plugin
23
+ ```
24
+
25
+ > [!NOTE]
26
+ > Requires `@fastkit/plugboy` (and `vite`, when using the Vite integration) as peer dependencies.
27
+
28
+ ## Usage
29
+
30
+ ### 1. Register in the build
31
+
32
+ Add it to the `plugins` of `plugboy.project.ts` (project-wide) or a per-workspace `plugboy.workspace.ts`. It activates automatically for packages that contain `.css.ts` files.
33
+
34
+ ```typescript
35
+ import { defineProjectConfig } from '@fastkit/plugboy';
36
+ import { createVanillaExtractPlugin } from '@fastkit/plugboy-vanilla-extract-plugin';
37
+
38
+ export default defineProjectConfig({
39
+ plugins: [
40
+ createVanillaExtractPlugin({
41
+ // Identifier format for class names etc. ('short' recommended for production)
42
+ identifiers: 'short',
43
+ }),
44
+ ],
45
+ });
46
+ ```
47
+
48
+ On build, the package styles are combined into `dist/<package>.css`.
49
+
50
+ ### 2. Use with Vite (dev / Storybook, etc.)
51
+
52
+ For environments that resolve Vanilla Extract without a Plugboy build (Vite dev server, Storybook, etc.), use the Vite plugin.
53
+
54
+ ```typescript
55
+ import { defineConfig } from 'vite';
56
+ import { ViteVanillaExtractPlugin } from '@fastkit/plugboy-vanilla-extract-plugin';
57
+
58
+ export default defineConfig({
59
+ plugins: [
60
+ ViteVanillaExtractPlugin({
61
+ identifiers: 'debug',
62
+ }),
63
+ ],
64
+ });
65
+ ```
66
+
67
+ ### 3. Cascade layer helpers (`/css`)
68
+
69
+ `@fastkit/plugboy-vanilla-extract-plugin/css` lets you define nestable cascade layers in a type-safe way.
70
+
71
+ ```typescript
72
+ import { defineLayerStyle } from '@fastkit/plugboy-vanilla-extract-plugin/css';
73
+
74
+ export const framework = defineLayerStyle({ globalName: 'my-ui' });
75
+
76
+ export const base = framework.defineNestedLayer({ globalName: 'base' });
77
+ export const component = framework.defineNestedLayer({ globalName: 'component' });
78
+ ```
79
+
80
+ ## Options
81
+
82
+ The main options accepted by `createVanillaExtractPlugin(options)` / `ViteVanillaExtractPlugin(options)`.
83
+
84
+ | Option | Type | Description |
85
+ | --- | --- | --- |
86
+ | `identifiers` | `'short' \| 'debug' \| ((meta) => string)` | Format of generated identifiers such as class names. Use `'short'` for production builds and `'debug'` while debugging. |
87
+ | `esbuildOptions` | `EsbuildOptions` | Options forwarded to esbuild when compiling `.css.ts` files. |
88
+
89
+ ## License
90
+
91
+ [MIT](https://github.com/dadajam4/fastkit/blob/main/LICENSE)
package/dist/css.d.mts CHANGED
@@ -69,7 +69,27 @@ interface DefineLayerGlobalOptions<CustomRules extends CustomStyleRules | null =
69
69
  }
70
70
  type DefineLayerOptions<CustomRules extends CustomStyleRules | null = null> = DefineLayerScopedOptions<CustomRules> | DefineLayerGlobalOptions<CustomRules>;
71
71
  type DefineNestableLayerOptions<CustomRules extends CustomStyleRules | null = null> = DefineLayerOptions<CustomRules> & DefineLayerParentOptions;
72
+ /**
73
+ * Re-construct a {@link LayerStyle} from a name that was already resolved at
74
+ * build time, WITHOUT re-running `layer()` / `globalLayer()`.
75
+ *
76
+ * @remarks
77
+ * This is the runtime counterpart used by the function serializer (see
78
+ * {@link defineLayerStyle}). Because the `layerName` is passed verbatim, the
79
+ * re-constructed instance points at the exact layer that was emitted into CSS at
80
+ * build time — even for scoped layers whose name is a non-deterministic hash that
81
+ * could never be reproduced by calling `layer()` again.
82
+ *
83
+ * The re-constructed instance carries only deterministic state (`layerName` /
84
+ * `parentLayerName`). It has no `hooks` and none of the additions made via
85
+ * `extend()`; it is a reference handle to an already-built layer, not a fresh
86
+ * style-defining entry point.
87
+ *
88
+ * @internal Not part of the public API; exported only so the serializer's
89
+ * `importName` can resolve it at runtime.
90
+ */
91
+ declare function defineLayerStyleFromResolvedName<CustomRules extends CustomStyleRules | null = null>(layerName: string, parentLayerName: string | null): LayerStyle<CustomRules>;
72
92
  declare function defineLayerStyle<CustomRules extends CustomStyleRules | null = null>(globalNameOrOptions?: string | DefineNestableLayerOptions<CustomRules>): LayerStyle<CustomRules>;
73
93
  //#endregion
74
- export { DefineLayerBaseOptions, DefineLayerGlobalOptions, DefineLayerOptions, DefineLayerParentOptions, DefineLayerScopedOptions, DefineNestableLayerOptions, LayerStyle, defineLayerStyle };
94
+ export { DefineLayerBaseOptions, DefineLayerGlobalOptions, DefineLayerOptions, DefineLayerParentOptions, DefineLayerScopedOptions, DefineNestableLayerOptions, LayerStyle, defineLayerStyle, defineLayerStyleFromResolvedName };
75
95
  //# sourceMappingURL=css.d.mts.map
package/dist/css.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createThemeContract, globalLayer, globalStyle, layer, style } from "@vanilla-extract/css";
2
-
2
+ import { addFunctionSerializer } from "@vanilla-extract/css/functionSerializer";
3
3
  //#region src/css/utils.ts
4
4
  function get(obj, path) {
5
5
  let result = obj;
@@ -27,7 +27,6 @@ function assignVars(varContract, tokens) {
27
27
  });
28
28
  return varSetters;
29
29
  }
30
-
31
30
  //#endregion
32
31
  //#region src/css/theme.ts
33
32
  function createGlobalTheme$1(layerName, selector, arg2, arg3) {
@@ -37,7 +36,6 @@ function createGlobalTheme$1(layerName, selector, arg2, arg3) {
37
36
  globalStyle(selector, { "@layer": { [layerName]: { vars: assignVars(themeVars, tokens) } } });
38
37
  if (shouldCreateVars) return themeVars;
39
38
  }
40
-
41
39
  //#endregion
42
40
  //#region src/css/layer.ts
43
41
  function isGlobalOptions(options) {
@@ -48,10 +46,20 @@ function normalizeToObject(source) {
48
46
  if (typeof source === "string") return { globalName: source };
49
47
  return source;
50
48
  }
51
- function defineLayerStyle(globalNameOrOptions) {
52
- const options = normalizeToObject(globalNameOrOptions);
53
- const { parent, hooks = {} } = options;
54
- const layerName = isGlobalOptions(options) ? globalLayer({ parent }, options.globalName) : layer({ parent }, options.debugId);
49
+ /**
50
+ * Assemble a {@link LayerStyle} object for an already-resolved `layerName`.
51
+ *
52
+ * @remarks
53
+ * This contains the whole object-building logic shared by {@link defineLayerStyle}
54
+ * (build-time, where `layerName` was just produced by `layer()`/`globalLayer()`)
55
+ * and {@link defineLayerStyleFromResolvedName} (runtime re-construction, where
56
+ * `layerName` is the deterministic value carried over from build time). It must
57
+ * NOT call any `@vanilla-extract/css` side-effecting API (no `layer()` /
58
+ * `globalLayer()`), so that re-construction never regenerates a hash-based name.
59
+ *
60
+ * @internal
61
+ */
62
+ function buildLayerStyle(layerName, parentLayerName, hooks) {
55
63
  const layerStyle = function layerStyle(rule, debugId) {
56
64
  const rules = Array.isArray(rule) ? rule : [rule];
57
65
  const layerAppliedRules = rules.map((_rule) => {
@@ -66,7 +74,7 @@ function defineLayerStyle(globalNameOrOptions) {
66
74
  return style(layerAppliedRules, debugId);
67
75
  };
68
76
  layerStyle.layerName = layerName;
69
- layerStyle.parentLayerName = parent || null;
77
+ layerStyle.parentLayerName = parentLayerName;
70
78
  layerStyle.style = layerStyle;
71
79
  layerStyle.hooks = hooks;
72
80
  layerStyle.global = function layerGlobalStyle(selector, rule) {
@@ -102,7 +110,50 @@ function defineLayerStyle(globalNameOrOptions) {
102
110
  };
103
111
  return layerStyle;
104
112
  }
105
-
113
+ /**
114
+ * Re-construct a {@link LayerStyle} from a name that was already resolved at
115
+ * build time, WITHOUT re-running `layer()` / `globalLayer()`.
116
+ *
117
+ * @remarks
118
+ * This is the runtime counterpart used by the function serializer (see
119
+ * {@link defineLayerStyle}). Because the `layerName` is passed verbatim, the
120
+ * re-constructed instance points at the exact layer that was emitted into CSS at
121
+ * build time — even for scoped layers whose name is a non-deterministic hash that
122
+ * could never be reproduced by calling `layer()` again.
123
+ *
124
+ * The re-constructed instance carries only deterministic state (`layerName` /
125
+ * `parentLayerName`). It has no `hooks` and none of the additions made via
126
+ * `extend()`; it is a reference handle to an already-built layer, not a fresh
127
+ * style-defining entry point.
128
+ *
129
+ * @internal Not part of the public API; exported only so the serializer's
130
+ * `importName` can resolve it at runtime.
131
+ */
132
+ function defineLayerStyleFromResolvedName(layerName, parentLayerName) {
133
+ return buildLayerStyle(layerName, parentLayerName, {});
134
+ }
135
+ function defineLayerStyle(globalNameOrOptions) {
136
+ const options = normalizeToObject(globalNameOrOptions);
137
+ const { parent, hooks = {} } = options;
138
+ const isGlobal = isGlobalOptions(options);
139
+ const layerName = isGlobal ? globalLayer({ parent }, options.globalName) : layer({ parent }, options.debugId);
140
+ const layerStyle = buildLayerStyle(layerName, parent || null, hooks);
141
+ if (isGlobal) addFunctionSerializer(layerStyle, {
142
+ importPath: "@fastkit/plugboy-vanilla-extract-plugin/css",
143
+ importName: "defineLayerStyle",
144
+ args: [{
145
+ globalName: options.globalName,
146
+ ...parent ? { parent } : {}
147
+ }]
148
+ });
149
+ else addFunctionSerializer(layerStyle, {
150
+ importPath: "@fastkit/plugboy-vanilla-extract-plugin/css",
151
+ importName: "defineLayerStyleFromResolvedName",
152
+ args: [layerName, parent || null]
153
+ });
154
+ return layerStyle;
155
+ }
106
156
  //#endregion
107
- export { defineLayerStyle };
157
+ export { defineLayerStyle, defineLayerStyleFromResolvedName };
158
+
108
159
  //# sourceMappingURL=css.mjs.map
package/dist/css.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"css.mjs","names":["createGlobalTheme","createGlobalTheme"],"sources":["../src/css/utils.ts","../src/css/theme.ts","../src/css/layer.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { Contract, MapLeafNodes, CSSVarFunction } from './types';\n\ntype Primitive = string | number | null | undefined;\n\ntype Walkable = {\n [Key in string | number]: Primitive | Walkable;\n};\n\nexport function get(obj: any, path: Array<string>) {\n let result = obj;\n\n for (const key of path) {\n if (!(key in result)) {\n throw new Error(`Path ${path.join(' -> ')} does not exist in object`);\n }\n result = result[key];\n }\n\n return result;\n}\nexport function walkObject<T extends Walkable, MapTo>(\n obj: T,\n fn: (value: Primitive, path: Array<string>) => MapTo,\n path: Array<string> = [],\n): MapLeafNodes<T, MapTo> {\n const clone = obj.constructor();\n\n for (const key in obj) {\n const value = obj[key];\n const currentPath = [...path, key];\n\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value == null\n ) {\n clone[key] = fn(value as Primitive, currentPath);\n } else if (typeof value === 'object' && !Array.isArray(value)) {\n clone[key] = walkObject(value as Walkable, fn, currentPath);\n } else {\n console.warn(\n `Skipping invalid key \"${currentPath.join(\n '.',\n )}\". Should be a string, number, null or object. Received: \"${\n Array.isArray(value) ? 'Array' : typeof value\n }\"`,\n );\n }\n }\n\n return clone;\n}\n\nexport function assignVars<VarContract extends Contract>(\n varContract: VarContract,\n tokens: MapLeafNodes<VarContract, string>,\n): Record<CSSVarFunction, string> {\n const varSetters: { [cssVarName: string]: string } = {};\n // const { valid, diffString } = validateContract(varContract, tokens);\n\n // if (!valid) {\n // throw new Error(`Tokens don't match contract.\\n${diffString}`);\n // }\n\n walkObject(tokens, (value, path) => {\n varSetters[get(varContract, path)] = String(value);\n });\n\n return varSetters;\n}\n","import { createThemeContract, globalStyle } from '@vanilla-extract/css';\nimport { Tokens, ThemeVars, Contract, MapLeafNodes } from './types';\nimport { assignVars } from './utils';\n\nexport function createGlobalTheme<ThemeTokens extends Tokens>(\n layerName: string,\n selector: string,\n tokens: ThemeTokens,\n): ThemeVars<ThemeTokens>;\nexport function createGlobalTheme<ThemeContract extends Contract>(\n layerName: string,\n selector: string,\n themeContract: ThemeContract,\n tokens: MapLeafNodes<ThemeContract, string>,\n): void;\nexport function createGlobalTheme(\n layerName: string,\n selector: string,\n arg2: any,\n arg3?: any,\n): any {\n const shouldCreateVars = Boolean(!arg3);\n\n const themeVars = shouldCreateVars\n ? createThemeContract(arg2)\n : (arg2 as ThemeVars<any>);\n\n const tokens = shouldCreateVars ? arg2 : arg3;\n\n globalStyle(selector, {\n '@layer': {\n [layerName]: {\n vars: assignVars(themeVars, tokens),\n },\n },\n });\n\n // appendCss(\n // {\n // type: 'global',\n // selector: selector,\n // rule: { vars: assignVars(themeVars, tokens) },\n // },\n // getFileScope(),\n // );\n\n if (shouldCreateVars) {\n return themeVars;\n }\n}\n","import {\n style,\n layer,\n globalLayer,\n StyleRule,\n globalStyle,\n GlobalStyleRule,\n createGlobalTheme as _createGlobalTheme,\n} from '@vanilla-extract/css';\nimport { createGlobalTheme } from './theme';\n\ntype CustomStyleRules = Record<string, any>;\n\ntype _LayerStyleRules = NonNullable<StyleRule['@layer']>[string];\n\ntype LayerStyleRules<CustomRules extends CustomStyleRules | null = null> =\n CustomRules extends null ? _LayerStyleRules : _LayerStyleRules & CustomRules;\n\ntype ClassNames = string | ClassNames[];\n\ntype ComplexLayerStyleRule<CustomRules extends CustomStyleRules | null = null> =\n LayerStyleRules<CustomRules> | (LayerStyleRules<CustomRules> | ClassNames)[];\n\ntype _LayerGlobalStyleRules = NonNullable<GlobalStyleRule['@layer']>[string];\n\ntype LayerGlobalStyleRules<CustomRules extends CustomStyleRules | null = null> =\n CustomRules extends null\n ? _LayerGlobalStyleRules\n : _LayerGlobalStyleRules & CustomRules;\n\ntype AnyStyleRule<CustomRules extends CustomStyleRules | null = null> =\n | LayerStyleRules<CustomRules>\n | LayerGlobalStyleRules<CustomRules>;\n\ntype LayerStyleHooks<CustomRules extends CustomStyleRules | null = null> = {\n style?: (rule: ComplexLayerStyleRule<CustomRules>, debugId?: string) => void;\n global?: (selector: string, rule: LayerGlobalStyleRules<CustomRules>) => void;\n anyStyle?: (style: AnyStyleRule<CustomRules>) => void;\n};\n\nexport interface LayerStyle<\n CustomRules extends CustomStyleRules | null = null,\n> {\n layerName: string;\n parentLayerName: string | null;\n /**\n * @see {@link style}\n */\n (rule: ComplexLayerStyleRule<CustomRules>, debugId?: string): string;\n\n /**\n * @see {@link style}\n */\n style(rule: ComplexLayerStyleRule<CustomRules>, debugId?: string): string;\n\n /**\n * @see {@link globalStyle}\n */\n global(selector: string, rule: LayerGlobalStyleRules<CustomRules>): void;\n\n /**\n * @see {@link _createGlobalTheme}\n */\n globalTheme: typeof _createGlobalTheme;\n\n defineNestedLayer(\n globalNameOrNestedOptions?: string | DefineLayerOptions<CustomRules>,\n ): LayerStyle<CustomRules>;\n\n /**\n * Add global CSS variable with layer\n *\n * @remarks The vanilla-extract API is buggy when handling layered css variables.\n *\n * @param selector - selector\n * @param vars - variables\n */\n pushGlobalVars(selector: string, vars: Record<string, string>): void;\n\n /**\n * Output variables accumulated by `pushGlobalVars`.\n *\n * @remarks The vanilla-extract API is buggy when handling layered css variables.\n */\n dumpGlobalVars(): void;\n hooks: LayerStyleHooks<CustomRules>;\n}\n\nexport interface DefineLayerParentOptions {\n parent?: string;\n}\n\nexport interface DefineLayerBaseOptions<\n CustomRules extends CustomStyleRules | null = null,\n> {\n hooks?: LayerStyleHooks<CustomRules>;\n}\n\nexport interface DefineLayerScopedOptions<\n CustomRules extends CustomStyleRules | null = null,\n> extends DefineLayerBaseOptions<CustomRules> {\n /** Debug ID */\n debugId?: string;\n globalName?: never;\n}\n\nexport interface DefineLayerGlobalOptions<\n CustomRules extends CustomStyleRules | null = null,\n> extends DefineLayerBaseOptions<CustomRules> {\n debugId?: never;\n /** Parent layer name */\n globalName: string;\n}\n\nexport type DefineLayerOptions<\n CustomRules extends CustomStyleRules | null = null,\n> =\n | DefineLayerScopedOptions<CustomRules>\n | DefineLayerGlobalOptions<CustomRules>;\n\nexport type DefineNestableLayerOptions<\n CustomRules extends CustomStyleRules | null = null,\n> = DefineLayerOptions<CustomRules> & DefineLayerParentOptions;\n\nfunction isGlobalOptions(\n options: DefineLayerOptions<any>,\n): options is DefineLayerGlobalOptions {\n return 'globalName' in options;\n}\n\nfunction normalizeToObject<T extends DefineLayerOptions<any>>(\n source?: string | T,\n): T {\n if (!source) return {} as T;\n if (typeof source === 'string') return { globalName: source } as unknown as T;\n return source;\n}\n\nexport function defineLayerStyle<\n CustomRules extends CustomStyleRules | null = null,\n>(\n globalNameOrOptions?: string | DefineNestableLayerOptions<CustomRules>,\n): LayerStyle<CustomRules> {\n const options = normalizeToObject(globalNameOrOptions);\n const { parent, hooks = {} } = options;\n\n const layerName = isGlobalOptions(options)\n ? globalLayer({ parent }, options.globalName)\n : layer({ parent }, options.debugId);\n\n const layerStyle = function layerStyle(rule, debugId) {\n const rules = Array.isArray(rule) ? rule : [rule];\n const layerAppliedRules = rules.map((_rule) => {\n if (typeof _rule === 'string' || Array.isArray(_rule)) return _rule;\n return {\n '@layer': {\n [layerName]: _rule,\n },\n };\n });\n if (hooks.anyStyle) {\n for (const _rule of rules) {\n if (typeof _rule === 'string' || Array.isArray(_rule)) continue;\n hooks.anyStyle(_rule);\n }\n }\n hooks.style && hooks.style(rule, debugId);\n return style(layerAppliedRules, debugId);\n } as LayerStyle<CustomRules>;\n\n layerStyle.layerName = layerName;\n layerStyle.parentLayerName = parent || null;\n layerStyle.style = layerStyle;\n layerStyle.hooks = hooks;\n\n layerStyle.global = function layerGlobalStyle(\n selector: string,\n rule: LayerGlobalStyleRules<CustomRules>,\n ) {\n hooks.anyStyle && hooks.anyStyle(rule);\n hooks.global && hooks.global(selector, rule);\n\n return globalStyle(selector, {\n '@layer': {\n [layerName]: rule,\n },\n });\n };\n\n layerStyle.globalTheme = (...args: any) =>\n (createGlobalTheme as any)(layerName, ...args);\n\n let _varQueues: [string, Record<string, string>][] = [];\n\n layerStyle.pushGlobalVars = function pushGlobalVars(\n selector: string,\n vars: Record<string, string>,\n ) {\n let queue = _varQueues.find((q) => q[0] === selector);\n if (!queue) {\n queue = [selector, {}];\n _varQueues.push(queue);\n }\n Object.assign(queue[1], vars);\n };\n\n layerStyle.dumpGlobalVars = function dumpGlobalVars() {\n for (const [selector, vars] of _varQueues) {\n layerStyle.global(selector, {\n vars,\n } as any);\n }\n _varQueues = [];\n };\n\n layerStyle.defineNestedLayer = function defineNestedLayer(\n globalNameOrNestedOptions?: string | DefineLayerOptions<CustomRules>,\n ) {\n const _options = normalizeToObject(globalNameOrNestedOptions);\n const nestedHooks = _options.hooks;\n\n return defineLayerStyle({\n ..._options,\n hooks: {\n ...hooks,\n ...nestedHooks,\n },\n parent: layerName,\n });\n };\n\n return layerStyle;\n}\n"],"mappings":";;;AASA,SAAgB,IAAI,KAAU,MAAqB;CACjD,IAAI,SAAS;AAEb,MAAK,MAAM,OAAO,MAAM;AACtB,MAAI,EAAE,OAAO,QACX,OAAM,IAAI,MAAM,QAAQ,KAAK,KAAK,OAAO,CAAC,2BAA2B;AAEvE,WAAS,OAAO;;AAGlB,QAAO;;AAET,SAAgB,WACd,KACA,IACA,OAAsB,EAAE,EACA;CACxB,MAAM,QAAQ,IAAI,aAAa;AAE/B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AM,WAAW,kBAAkB,0BAA0B;EAC7D,MAAM,cAAc,SAAS;AAE7B,SAAO,iBAAiB;GACtB,GAAG;GACH,OAAO;IACL,GAAG;IACH,GAAG;IACJ;GACD,QAAQ;GACT,CAAC;;AAGJ,QAAO"}
1
+ {"version":3,"file":"css.mjs","names":["createGlobalTheme","createGlobalTheme"],"sources":["../src/css/utils.ts","../src/css/theme.ts","../src/css/layer.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { Contract, MapLeafNodes, CSSVarFunction } from './types';\n\ntype Primitive = string | number | null | undefined;\n\ntype Walkable = {\n [Key in string | number]: Primitive | Walkable;\n};\n\nexport function get(obj: any, path: Array<string>) {\n let result = obj;\n\n for (const key of path) {\n if (!(key in result)) {\n throw new Error(`Path ${path.join(' -> ')} does not exist in object`);\n }\n result = result[key];\n }\n\n return result;\n}\nexport function walkObject<T extends Walkable, MapTo>(\n obj: T,\n fn: (value: Primitive, path: Array<string>) => MapTo,\n path: Array<string> = [],\n): MapLeafNodes<T, MapTo> {\n const clone = obj.constructor();\n\n for (const key in obj) {\n const value = obj[key];\n const currentPath = [...path, key];\n\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value == null\n ) {\n clone[key] = fn(value as Primitive, currentPath);\n } else if (typeof value === 'object' && !Array.isArray(value)) {\n clone[key] = walkObject(value as Walkable, fn, currentPath);\n } else {\n console.warn(\n `Skipping invalid key \"${currentPath.join(\n '.',\n )}\". Should be a string, number, null or object. Received: \"${\n Array.isArray(value) ? 'Array' : typeof value\n }\"`,\n );\n }\n }\n\n return clone;\n}\n\nexport function assignVars<VarContract extends Contract>(\n varContract: VarContract,\n tokens: MapLeafNodes<VarContract, string>,\n): Record<CSSVarFunction, string> {\n const varSetters: { [cssVarName: string]: string } = {};\n // const { valid, diffString } = validateContract(varContract, tokens);\n\n // if (!valid) {\n // throw new Error(`Tokens don't match contract.\\n${diffString}`);\n // }\n\n walkObject(tokens, (value, path) => {\n varSetters[get(varContract, path)] = String(value);\n });\n\n return varSetters;\n}\n","import { createThemeContract, globalStyle } from '@vanilla-extract/css';\nimport { Tokens, ThemeVars, Contract, MapLeafNodes } from './types';\nimport { assignVars } from './utils';\n\nexport function createGlobalTheme<ThemeTokens extends Tokens>(\n layerName: string,\n selector: string,\n tokens: ThemeTokens,\n): ThemeVars<ThemeTokens>;\nexport function createGlobalTheme<ThemeContract extends Contract>(\n layerName: string,\n selector: string,\n themeContract: ThemeContract,\n tokens: MapLeafNodes<ThemeContract, string>,\n): void;\nexport function createGlobalTheme(\n layerName: string,\n selector: string,\n arg2: any,\n arg3?: any,\n): any {\n const shouldCreateVars = Boolean(!arg3);\n\n const themeVars = shouldCreateVars\n ? createThemeContract(arg2)\n : (arg2 as ThemeVars<any>);\n\n const tokens = shouldCreateVars ? arg2 : arg3;\n\n globalStyle(selector, {\n '@layer': {\n [layerName]: {\n vars: assignVars(themeVars, tokens),\n },\n },\n });\n\n // appendCss(\n // {\n // type: 'global',\n // selector: selector,\n // rule: { vars: assignVars(themeVars, tokens) },\n // },\n // getFileScope(),\n // );\n\n if (shouldCreateVars) {\n return themeVars;\n }\n}\n","import {\n style,\n layer,\n globalLayer,\n StyleRule,\n globalStyle,\n GlobalStyleRule,\n createGlobalTheme as _createGlobalTheme,\n} from '@vanilla-extract/css';\nimport { addFunctionSerializer } from '@vanilla-extract/css/functionSerializer';\nimport { createGlobalTheme } from './theme';\n\ntype CustomStyleRules = Record<string, any>;\n\ntype _LayerStyleRules = NonNullable<StyleRule['@layer']>[string];\n\ntype LayerStyleRules<CustomRules extends CustomStyleRules | null = null> =\n CustomRules extends null ? _LayerStyleRules : _LayerStyleRules & CustomRules;\n\ntype ClassNames = string | ClassNames[];\n\ntype ComplexLayerStyleRule<CustomRules extends CustomStyleRules | null = null> =\n | LayerStyleRules<CustomRules>\n | (LayerStyleRules<CustomRules> | ClassNames)[];\n\ntype _LayerGlobalStyleRules = NonNullable<GlobalStyleRule['@layer']>[string];\n\ntype LayerGlobalStyleRules<CustomRules extends CustomStyleRules | null = null> =\n CustomRules extends null\n ? _LayerGlobalStyleRules\n : _LayerGlobalStyleRules & CustomRules;\n\ntype AnyStyleRule<CustomRules extends CustomStyleRules | null = null> =\n | LayerStyleRules<CustomRules>\n | LayerGlobalStyleRules<CustomRules>;\n\ntype LayerStyleHooks<CustomRules extends CustomStyleRules | null = null> = {\n style?: (rule: ComplexLayerStyleRule<CustomRules>, debugId?: string) => void;\n global?: (selector: string, rule: LayerGlobalStyleRules<CustomRules>) => void;\n anyStyle?: (style: AnyStyleRule<CustomRules>) => void;\n};\n\nexport interface LayerStyle<\n CustomRules extends CustomStyleRules | null = null,\n> {\n layerName: string;\n parentLayerName: string | null;\n /**\n * @see {@link style}\n */\n (rule: ComplexLayerStyleRule<CustomRules>, debugId?: string): string;\n\n /**\n * @see {@link style}\n */\n style(rule: ComplexLayerStyleRule<CustomRules>, debugId?: string): string;\n\n /**\n * @see {@link globalStyle}\n */\n global(selector: string, rule: LayerGlobalStyleRules<CustomRules>): void;\n\n /**\n * @see {@link _createGlobalTheme}\n */\n globalTheme: typeof _createGlobalTheme;\n\n defineNestedLayer(\n globalNameOrNestedOptions?: string | DefineLayerOptions<CustomRules>,\n ): LayerStyle<CustomRules>;\n\n /**\n * Add global CSS variable with layer\n *\n * @remarks The vanilla-extract API is buggy when handling layered css variables.\n *\n * @param selector - selector\n * @param vars - variables\n */\n pushGlobalVars(selector: string, vars: Record<string, string>): void;\n\n /**\n * Output variables accumulated by `pushGlobalVars`.\n *\n * @remarks The vanilla-extract API is buggy when handling layered css variables.\n */\n dumpGlobalVars(): void;\n hooks: LayerStyleHooks<CustomRules>;\n}\n\nexport interface DefineLayerParentOptions {\n parent?: string;\n}\n\nexport interface DefineLayerBaseOptions<\n CustomRules extends CustomStyleRules | null = null,\n> {\n hooks?: LayerStyleHooks<CustomRules>;\n}\n\nexport interface DefineLayerScopedOptions<\n CustomRules extends CustomStyleRules | null = null,\n> extends DefineLayerBaseOptions<CustomRules> {\n /** Debug ID */\n debugId?: string;\n globalName?: never;\n}\n\nexport interface DefineLayerGlobalOptions<\n CustomRules extends CustomStyleRules | null = null,\n> extends DefineLayerBaseOptions<CustomRules> {\n debugId?: never;\n /** Parent layer name */\n globalName: string;\n}\n\nexport type DefineLayerOptions<\n CustomRules extends CustomStyleRules | null = null,\n> =\n | DefineLayerScopedOptions<CustomRules>\n | DefineLayerGlobalOptions<CustomRules>;\n\nexport type DefineNestableLayerOptions<\n CustomRules extends CustomStyleRules | null = null,\n> = DefineLayerOptions<CustomRules> & DefineLayerParentOptions;\n\nfunction isGlobalOptions(\n options: DefineLayerOptions<any>,\n): options is DefineLayerGlobalOptions {\n return 'globalName' in options;\n}\n\nfunction normalizeToObject<T extends DefineLayerOptions<any>>(\n source?: string | T,\n): T {\n if (!source) return {} as T;\n if (typeof source === 'string') return { globalName: source } as unknown as T;\n return source;\n}\n\n/**\n * Assemble a {@link LayerStyle} object for an already-resolved `layerName`.\n *\n * @remarks\n * This contains the whole object-building logic shared by {@link defineLayerStyle}\n * (build-time, where `layerName` was just produced by `layer()`/`globalLayer()`)\n * and {@link defineLayerStyleFromResolvedName} (runtime re-construction, where\n * `layerName` is the deterministic value carried over from build time). It must\n * NOT call any `@vanilla-extract/css` side-effecting API (no `layer()` /\n * `globalLayer()`), so that re-construction never regenerates a hash-based name.\n *\n * @internal\n */\nfunction buildLayerStyle<CustomRules extends CustomStyleRules | null = null>(\n layerName: string,\n parentLayerName: string | null,\n hooks: LayerStyleHooks<CustomRules>,\n): LayerStyle<CustomRules> {\n const layerStyle = function layerStyle(rule, debugId) {\n const rules = Array.isArray(rule) ? rule : [rule];\n const layerAppliedRules = rules.map((_rule) => {\n if (typeof _rule === 'string' || Array.isArray(_rule)) return _rule;\n return {\n '@layer': {\n [layerName]: _rule,\n },\n };\n });\n if (hooks.anyStyle) {\n for (const _rule of rules) {\n if (typeof _rule === 'string' || Array.isArray(_rule)) continue;\n hooks.anyStyle(_rule);\n }\n }\n hooks.style && hooks.style(rule, debugId);\n return style(layerAppliedRules, debugId);\n } as LayerStyle<CustomRules>;\n\n layerStyle.layerName = layerName;\n layerStyle.parentLayerName = parentLayerName;\n layerStyle.style = layerStyle;\n layerStyle.hooks = hooks;\n\n layerStyle.global = function layerGlobalStyle(\n selector: string,\n rule: LayerGlobalStyleRules<CustomRules>,\n ) {\n hooks.anyStyle && hooks.anyStyle(rule);\n hooks.global && hooks.global(selector, rule);\n\n return globalStyle(selector, {\n '@layer': {\n [layerName]: rule,\n },\n });\n };\n\n layerStyle.globalTheme = (...args: any) =>\n (createGlobalTheme as any)(layerName, ...args);\n\n let _varQueues: [string, Record<string, string>][] = [];\n\n layerStyle.pushGlobalVars = function pushGlobalVars(\n selector: string,\n vars: Record<string, string>,\n ) {\n let queue = _varQueues.find((q) => q[0] === selector);\n if (!queue) {\n queue = [selector, {}];\n _varQueues.push(queue);\n }\n Object.assign(queue[1], vars);\n };\n\n layerStyle.dumpGlobalVars = function dumpGlobalVars() {\n for (const [selector, vars] of _varQueues) {\n layerStyle.global(selector, {\n vars,\n } as any);\n }\n _varQueues = [];\n };\n\n layerStyle.defineNestedLayer = function defineNestedLayer(\n globalNameOrNestedOptions?: string | DefineLayerOptions<CustomRules>,\n ) {\n const _options = normalizeToObject(globalNameOrNestedOptions);\n const nestedHooks = _options.hooks;\n\n return defineLayerStyle({\n ..._options,\n hooks: {\n ...hooks,\n ...nestedHooks,\n },\n parent: layerName,\n });\n };\n\n return layerStyle;\n}\n\n/**\n * Re-construct a {@link LayerStyle} from a name that was already resolved at\n * build time, WITHOUT re-running `layer()` / `globalLayer()`.\n *\n * @remarks\n * This is the runtime counterpart used by the function serializer (see\n * {@link defineLayerStyle}). Because the `layerName` is passed verbatim, the\n * re-constructed instance points at the exact layer that was emitted into CSS at\n * build time — even for scoped layers whose name is a non-deterministic hash that\n * could never be reproduced by calling `layer()` again.\n *\n * The re-constructed instance carries only deterministic state (`layerName` /\n * `parentLayerName`). It has no `hooks` and none of the additions made via\n * `extend()`; it is a reference handle to an already-built layer, not a fresh\n * style-defining entry point.\n *\n * @internal Not part of the public API; exported only so the serializer's\n * `importName` can resolve it at runtime.\n */\nexport function defineLayerStyleFromResolvedName<\n CustomRules extends CustomStyleRules | null = null,\n>(layerName: string, parentLayerName: string | null): LayerStyle<CustomRules> {\n return buildLayerStyle<CustomRules>(layerName, parentLayerName, {});\n}\n\nexport function defineLayerStyle<\n CustomRules extends CustomStyleRules | null = null,\n>(\n globalNameOrOptions?: string | DefineNestableLayerOptions<CustomRules>,\n): LayerStyle<CustomRules> {\n const options = normalizeToObject(globalNameOrOptions);\n const { parent, hooks = {} } = options;\n\n const isGlobal = isGlobalOptions(options);\n\n const layerName = isGlobal\n ? globalLayer({ parent }, options.globalName)\n : layer({ parent }, options.debugId);\n\n const layerStyle = buildLayerStyle<CustomRules>(\n layerName,\n parent || null,\n hooks,\n );\n\n // Attach vanilla-extract's official function serializer so that a `LayerStyle`\n // can survive being exported from a `.css.ts` module. The `.css.ts` build is\n // delegated to `@vanilla-extract/rollup-plugin`, whose `serializeVanillaModule`\n // rejects plain function exports. `addFunctionSerializer` registers a\n // descriptor (`__function_serializer__`) so the function is emitted as\n // re-construction code instead of throwing.\n //\n // Two re-construction paths, chosen so each reproduces the SAME `layerName`:\n //\n // - global: re-run `defineLayerStyle({ globalName, parent })`. `globalLayer()`\n // derives a deterministic name from `globalName`/`parent`, so re-running it at\n // runtime yields the identical layer. Kept verbatim from the original\n // implementation, so global behavior (including the runtime `globalLayer()`\n // call) is unchanged.\n // - scoped: call `defineLayerStyleFromResolvedName(layerName, parentLayerName)`,\n // which does NOT re-run `layer()`. A scoped layer's name is a hash that cannot\n // be reproduced by calling `layer()` again, so the build-time name is carried\n // over as a plain string instead.\n //\n // What re-construction restores (BOTH paths): only the deterministic state —\n // `layerName` / `parentLayerName`. `hooks` (and anything added via `extend()`:\n // extra `anyStyle`, custom methods, etc.) are intentionally NOT serialized,\n // because they hold functions and the serializer args must be plain serializable\n // values. This does not change build behavior: `hooks` run at `.css.ts`\n // evaluation time when `.style()` / `.global()` are called, and the CSS they emit\n // is already baked in before serialization (which only reads\n // `__function_serializer__` and writes re-construction code). The only caveat is\n // purely runtime: an instance re-constructed in a consumer is a *reference\n // handle* to the already-built layer — calling its `.style()` / `.global()` /\n // extended methods there runs without the original hooks. If a runtime-hooked\n // layer is ever needed, keep that instance build-time only, or add a separately\n // serializable descriptor for it.\n if (isGlobal) {\n addFunctionSerializer(layerStyle, {\n importPath: '@fastkit/plugboy-vanilla-extract-plugin/css',\n importName: 'defineLayerStyle',\n args: [\n {\n globalName: options.globalName,\n ...(parent ? { parent } : {}),\n },\n ],\n });\n } else {\n addFunctionSerializer(layerStyle, {\n importPath: '@fastkit/plugboy-vanilla-extract-plugin/css',\n importName: 'defineLayerStyleFromResolvedName',\n args: [layerName, parent || null],\n });\n }\n\n return layerStyle;\n}\n"],"mappings":";;;AASA,SAAgB,IAAI,KAAU,MAAqB;CACjD,IAAI,SAAS;CAEb,KAAK,MAAM,OAAO,MAAM;EACtB,IAAI,EAAE,OAAO,SACX,MAAM,IAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,EAAE,0BAA0B;EAEtE,SAAS,OAAO;CAClB;CAEA,OAAO;AACT;AACA,SAAgB,WACd,KACA,IACA,OAAsB,CAAC,GACC;CACxB,MAAM,QAAQ,IAAI,YAAY;CAE9B,KAAK,MAAM,OAAO,KAAK;EACrB,MAAM,QAAQ,IAAI;EAClB,MAAM,cAAc,CAAC,GAAG,MAAM,GAAG;EAEjC,IACE,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,SAAS,MAET,MAAM,OAAO,GAAG,OAAoB,WAAW;OAC1C,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAC1D,MAAM,OAAO,WAAW,OAAmB,IAAI,WAAW;OAE1D,QAAQ,KACN,yBAAyB,YAAY,KACnC,GACF,EAAE,4DACA,MAAM,QAAQ,KAAK,IAAI,UAAU,OAAO,MACzC,EACH;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AQ,OAAO;CAErC,MAAM,aAAa,gBACjB,WACA,UAAU,MACV,KACF;CAkCA,IAAI,UACF,sBAAsB,YAAY;EAChC,YAAY;EACZ,YAAY;EACZ,MAAM,CACJ;GACE,YAAY,QAAQ;GACpB,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC7B,CACF;CACF,CAAC;MAED,sBAAsB,YAAY;EAChC,YAAY;EACZ,YAAY;EACZ,MAAM,CAAC,WAAW,UAAU,IAAI;CAClC,CAAC;CAGH,OAAO;AACT"}
@@ -1,11 +1,11 @@
1
1
  import { Plugin } from "@fastkit/plugboy";
2
- import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
3
- import { vanillaExtractPlugin as vanillaExtractPlugin$1 } from "@vanilla-extract/rollup-plugin";
2
+ import { vanillaExtractPlugin } from "@vanilla-extract/rollup-plugin";
3
+ import { vanillaExtractPlugin as vanillaExtractPlugin$1 } from "@vanilla-extract/vite-plugin";
4
4
  import { Plugin as Plugin$1 } from "vite";
5
5
 
6
6
  //#region src/types.d.ts
7
- type VanillaExtractPluginOptions = Omit<NonNullable<Parameters<typeof vanillaExtractPlugin$1>[0]>, 'extract'>;
8
- interface PluginOptions extends Pick<VanillaExtractPluginOptions, 'identifiers' | 'esbuildOptions'> {}
7
+ type VanillaExtractPluginOptions = Omit<NonNullable<Parameters<typeof vanillaExtractPlugin>[0]>, 'extract'>;
8
+ type PluginOptions = Pick<VanillaExtractPluginOptions, 'identifiers' | 'esbuildOptions'>;
9
9
  declare const PLUGIN_NAME = "plugboy-vanilla-extract";
10
10
  interface VanillaExtractPlugin extends Plugin {
11
11
  name: typeof PLUGIN_NAME;
@@ -21,7 +21,7 @@ declare module '@fastkit/plugboy' {
21
21
  declare function createVanillaExtractPlugin(options?: PluginOptions): Promise<VanillaExtractPlugin>;
22
22
  //#endregion
23
23
  //#region src/vite.d.ts
24
- type VanillaExtractVitePluginOptions = NonNullable<Parameters<typeof vanillaExtractPlugin>[0]>;
24
+ type VanillaExtractVitePluginOptions = NonNullable<Parameters<typeof vanillaExtractPlugin$1>[0]>;
25
25
  interface ViteVanillaExtractPluginOptions extends VanillaExtractVitePluginOptions {}
26
26
  declare function ViteVanillaExtractPlugin(options?: ViteVanillaExtractPluginOptions): Promise<Plugin$1[]>;
27
27
  //#endregion