@fluixi-css/core 1.0.0-next.3 → 1.0.0-next.5

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/engine/style.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,6EAA6E;AAC7E,EAAE;AACF,8FAA8F;AAC9F,8FAA8F;AAC9F,6EAA6E;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAkD,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAIxD,gFAAgF;AAEhF,MAAM,QAAQ,GAAG,CAAC,IAAwB,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,IAAI,CAAC,GAAG,0CAAE,KAAK,CAAC,MAAM,mCAAI,CAAC,CAAA,EAAA,CAAC;AAE3E,SAAS,KAAK,CAAC,IAAwB,EAAE,MAA0B;IACjE,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,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,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtD,IAAI,OAAO,CAAC,OAAO,KAAK,KAAK;QAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;IACzD,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAC9G,CAAC","sourcesContent":["// Author CSS as an AST, and what @fluixi-css does to it: `@apply` expanded in place, and,\n// for CSS that is about to be scoped, nesting resolved into plain selectors.\n//\n// Every caller (the project stylesheet through `transform`, a component's `<style>`, a `css``\n// literal) goes through these functions with one shared registry, so a utility means the same\n// thing wherever it is used and nothing here emits the utility layer itself.\nimport { parseCss } from '../css-parser';\nimport type { CssAtRule, CssDeclaration, CssKeyframe, CssRule, CssStylesheet, Location } from '../types/css-parser';\nimport { type AstNode, type Declaration, type SourceLoc, atRule, decl, raw, rule, stringify } from './ast';\nimport { parseAtom } from './atom';\nimport { compileAtom, escapeClass } from './compile';\nimport { createRegistry } from './defaults';\nimport { loadDirectives } from './directives';\nimport type { Registry } from './registry';\nimport { collectVarRefs, loadTheme } from './theme-source';\nimport { registerBreakpointVariants } from './variants';\n\ntype ParsedNode = CssRule | CssAtRule | CssDeclaration | CssKeyframe | { type: string };\n\n// ─── Parser tree → engine AST ────────────────────────────────────────────────\n\nconst offsetOf = (node: { loc?: Location }) => node.loc?.start.offset ?? 0;\n\nfunction locOf(node: { loc?: Location }, source: string | undefined): SourceLoc | undefined {\n if (!source || !node.loc) return undefined;\n return { source, line: node.loc.start.line, column: Math.max(0, node.loc.start.column - 1) };\n}\n\n/** Parses author CSS into the engine's AST, in source order. */\nexport function parseStyle(css: string, from?: string): AstNode[] {\n const sheet: CssStylesheet = parseCss(css, { includeSourceMaps: true, includeComments: false });\n return convertAll(sheet.children as ParsedNode[], from);\n}\n\nfunction convertAll(nodes: ParsedNode[], from: string | undefined): AstNode[] {\n const out: AstNode[] = [];\n for (const node of nodes) {\n const converted = convert(node, from);\n if (converted) out.push(converted);\n }\n return out;\n}\n\nfunction convert(node: ParsedNode, from: string | undefined): AstNode | null {\n switch (node.type) {\n case 'declaration': {\n const d = node as CssDeclaration;\n return decl(d.property, d.rawValue ?? '', d.important, locOf(d, from));\n }\n case 'rule': {\n const r = node as CssRule;\n // The parser keeps declarations and nested rules apart; the source offsets put them\n // back in the order they were written, which is the order they cascade in.\n const children = [...(r.declarations ?? []), ...(r.children ?? [])] as ParsedNode[];\n children.sort((a, b) => offsetOf(a as { loc?: Location }) - offsetOf(b as { loc?: Location }));\n return rule((r.rawSelector ?? '').trim(), convertAll(children, from), locOf(r, from));\n }\n case 'keyframe': {\n const k = node as CssKeyframe;\n return rule(k.selector, convertAll(k.declarations as ParsedNode[], from), locOf(k, from));\n }\n case 'atrule': {\n const a = node as CssAtRule;\n const params = (a.preludeText ?? '').trim();\n // A statement (`@import`, `@apply` before expansion has a block of its own only when\n // nested): no block means no braces in the output either.\n if (!a.block) return a.name === 'apply' ? atRule('apply', params, [], locOf(a, from)) : raw(`@${a.name}${params ? ' ' + params : ''};`, locOf(a, from));\n return atRule(a.name, params, convertAll(a.block.children as ParsedNode[], from), locOf(a, from));\n }\n default:\n return null;\n }\n}\n\n// ─── @apply ──────────────────────────────────────────────────────────────────\n\n/**\n * Replaces each `@apply a b c` with what those utilities produce: flat declarations in place,\n * and a nested rule (`&` standing for the applying selector) for a utility that needs a\n * selector of its own (`hover:`, `group-hover:`, `space-x-*`, `md:`). Unknown classes are\n * skipped. `applied` collects the utilities used.\n */\nexport function applyUtilities(nodes: AstNode[], reg: Registry, applied = new Set<string>()): AstNode[] {\n const out: AstNode[] = [];\n for (const node of nodes) {\n if (node.kind === 'at-rule' && node.name === 'apply') {\n // What it expands to was written on the @apply line, as far as a source map can tell.\n out.push(...expandOne(node.params, reg, applied).map((n) => withLoc(n, node.loc)));\n } else if (node.kind === 'rule' || node.kind === 'at-rule') {\n out.push({ ...node, nodes: applyUtilities(node.nodes, reg, applied) });\n } else {\n out.push(node);\n }\n }\n return out;\n}\n\nfunction expandOne(params: string, reg: Registry, applied: Set<string>): AstNode[] {\n let list = params.trim();\n // A trailing `!important` marks every inlined declaration (Tailwind semantics).\n let important = false;\n const bang = list.match(/!important\\s*$/);\n if (bang) {\n important = true;\n list = list.slice(0, bang.index).trim();\n }\n const decls: AstNode[] = [];\n const nested: AstNode[] = [];\n for (const token of list.split(/\\s+/)) {\n if (!token) continue;\n const atom = parseAtom(token, reg);\n if (!atom) continue;\n const compiled = compileAtom(atom, reg);\n if (!compiled || compiled.length === 0) continue;\n applied.add(token);\n if (important) markImportant(compiled);\n const own = '.' + escapeClass(atom.raw);\n // A plain utility, one rule on its own class with only declarations, inlines.\n const only = compiled[0];\n if (compiled.length === 1 && only.kind === 'rule' && only.selector === own && only.nodes.every((n) => n.kind === 'declaration')) {\n decls.push(...only.nodes.map((n) => ({ ...(n as Declaration) })));\n continue;\n }\n // Anything else keeps its structure, with the utility's class replaced by `&`.\n nested.push(...compiled.map((n) => toNesting(n, own)));\n }\n // Flat declarations first, then the nested rules: the order the author's line implies.\n return [...decls, ...nested];\n}\n\nfunction withLoc(node: AstNode, loc: SourceLoc | undefined): AstNode {\n if (!loc) return node;\n if (node.kind === 'rule' || node.kind === 'at-rule') return { ...node, loc: node.loc ?? loc, nodes: node.nodes.map((n) => withLoc(n, loc)) };\n return node.loc ? node : { ...node, loc };\n}\n\nfunction toNesting(node: AstNode, own: string): AstNode {\n if (node.kind === 'rule') return { ...node, selector: node.selector.split(own).join('&'), nodes: node.nodes.map((n) => toNesting(n, own)) };\n if (node.kind === 'at-rule') return { ...node, nodes: node.nodes.map((n) => toNesting(n, own)) };\n return node;\n}\n\nfunction markImportant(nodes: AstNode[]): void {\n for (const n of nodes) {\n if (n.kind === 'declaration') n.important = true;\n else if (n.kind === 'rule' || n.kind === 'at-rule') markImportant(n.nodes);\n }\n}\n\n// ─── Nesting → plain selectors ───────────────────────────────────────────────\n\n// At-rules whose body is more stylesheet: nesting is resolved through them. Everything else\n// (`@keyframes`, `@font-face`, `@property`, …) is left exactly as written.\nconst GROUPING = new Set(['media', 'supports', 'container', 'layer', 'document', 'scope', 'starting-style']);\n\n/** Splits a selector list on its top-level commas (not those inside `:is(…)`, `[…]` or quotes). */\nexport function splitSelectorList(selector: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let quote = '';\n let start = 0;\n for (let i = 0; i < selector.length; i++) {\n const c = selector[i];\n if (quote) {\n if (c === '\\\\') i++;\n else if (c === quote) quote = '';\n } else if (c === '\"' || c === \"'\") quote = c;\n else if (c === '\\\\') i++;\n else if (c === '(' || c === '[') depth++;\n else if (c === ')' || c === ']') depth--;\n else if (c === ',' && depth === 0) {\n parts.push(selector.slice(start, i).trim());\n start = i + 1;\n }\n }\n parts.push(selector.slice(start).trim());\n return parts.filter(Boolean);\n}\n\n/** The selector a nested rule stands for, given its parent's: `&` replaced, or a descendant. */\nexport function resolveNested(child: string, parent: string): string {\n const parents = splitSelectorList(parent);\n const out: string[] = [];\n for (const c of splitSelectorList(child)) {\n for (const p of parents) out.push(c.includes('&') ? c.split('&').join(p) : `${p} ${c}`);\n }\n return out.join(', ');\n}\n\n/**\n * Resolves CSS nesting into plain rules, keeping the cascade: a rule's declarations stay\n * together until a nested rule interrupts them, and the ones after it follow it. Grouping\n * at-rules nested in a rule wrap a rule on the parent's selector.\n */\nexport function flattenNesting(nodes: AstNode[], parent: string | null = null): AstNode[] {\n const out: AstNode[] = [];\n for (const node of nodes) {\n if (node.kind === 'rule') {\n const selector = parent === null ? node.selector : resolveNested(node.selector, parent);\n out.push(...flattenRule(selector, node.nodes, node.loc));\n } else if (node.kind === 'at-rule' && GROUPING.has(node.name)) {\n out.push({ ...node, nodes: parent === null ? flattenNesting(node.nodes) : flattenRule(parent, node.nodes, node.loc) });\n } else {\n out.push(node);\n }\n }\n return out;\n}\n\nfunction flattenRule(selector: string, children: AstNode[], loc: SourceLoc | undefined): AstNode[] {\n const out: AstNode[] = [];\n let pending: AstNode[] = [];\n const flush = () => {\n if (pending.length) out.push(rule(selector, pending, loc));\n pending = [];\n };\n for (const child of children) {\n if (child.kind === 'declaration' || child.kind === 'raw') {\n pending.push(child);\n } else if (child.kind === 'rule') {\n flush();\n out.push(...flattenRule(resolveNested(child.selector, selector), child.nodes, child.loc));\n } else if (GROUPING.has(child.name)) {\n flush();\n out.push({ ...child, nodes: flattenRule(selector, child.nodes, child.loc) });\n } else {\n flush();\n out.push(child);\n }\n }\n flush();\n return out;\n}\n\n// ─── The shared context ──────────────────────────────────────────────────────\n\n/**\n * What every stylesheet of one project shares: the registry (theme, utilities, variants,\n * custom definitions) and the theme tokens the processed CSS refers to, so the global sheet\n * keeps them however they are reached. One per build, made by whoever orchestrates it.\n */\nexport interface CssContext {\n registry: Registry;\n /** Custom properties referenced by CSS processed in this context (`--spacing`, `--color-…`). */\n usedTokens: Set<string>;\n}\n\nexport interface CssContextOptions {\n /** The project's theme CSS: its `@theme`, `@utility` and `@custom-variant` feed the registry. */\n theme?: string;\n registry?: Registry;\n}\n\nexport function createCssContext(options: CssContextOptions = {}): CssContext {\n const registry = options.registry ?? createRegistry();\n if (options.theme) {\n loadTheme(options.theme, registry.theme);\n registerBreakpointVariants(registry);\n loadDirectives(options.theme, registry);\n }\n return { registry, usedTokens: new Set() };\n}\n\n// Directives that define the context; component CSS does not get to change it.\nconst CONTEXT_DIRECTIVES = new Set(['theme', 'utility', 'custom-variant', 'source', 'fluixi']);\n\nexport interface ProcessOptions {\n /** File the CSS came from, for source locations. */\n from?: string;\n /** Resolve nesting into plain selectors (what scoping needs). Default `true`. */\n flatten?: boolean;\n minify?: boolean;\n}\n\nexport interface ProcessResult {\n ast: AstNode[];\n css: string;\n /** Utilities `@apply` used. */\n applied: string[];\n /** Context directives found and left out: they belong in the project's theme CSS. */\n ignored: string[];\n /**\n * `@reference \"…\"` targets, in order. A stylesheet processed on its own names the CSS whose\n * theme and utilities it relies on; the orchestrator, which reads files, builds the context\n * from them. The referenced CSS is never emitted.\n */\n references: string[];\n}\n\n/**\n * Processes one stylesheet in a shared context, exactly as the project's own CSS would be:\n * `@apply` expanded with the context's utilities, theme values resolved, nesting flattened.\n * It never emits the utility layer or the theme tokens; the tokens it refers to are recorded\n * in `ctx.usedTokens` for the global sheet to keep.\n */\nexport function processCss(input: string | AstNode[], ctx: CssContext, options: ProcessOptions = {}): ProcessResult {\n const parsed = typeof input === 'string' ? parseStyle(input, options.from) : input;\n const ignored: string[] = [];\n const references: string[] = [];\n const kept = parsed.filter((n) => {\n const reference = n.kind === 'raw' ? n.text.match(/^@reference\\s+([\"'])(.+)\\1\\s*;$/) : null;\n if (reference) {\n references.push(reference[2]);\n return false;\n }\n if (n.kind === 'at-rule' && CONTEXT_DIRECTIVES.has(n.name)) {\n ignored.push(n.name);\n return false;\n }\n return true;\n });\n const applied = new Set<string>();\n let ast = applyUtilities(kept, ctx.registry, applied);\n if (options.flatten !== false) ast = flattenNesting(ast);\n collectVarRefs(ast, ctx.usedTokens);\n return { ast, css: stringify(ast, { minify: options.minify }), applied: [...applied], ignored, references };\n}\n"]}
@@ -16,6 +16,12 @@ export interface TransformOptions {
16
16
  from?: string;
17
17
  emitTokens?: boolean;
18
18
  emitUiTokens?: boolean;
19
+ /**
20
+ * Emit every theme token, not only those this sheet's CSS refers to. For a build whose
21
+ * component styles (`processCss`) are compiled separately and may arrive after this sheet:
22
+ * the tokens they refer to have to be here whatever order things are compiled in.
23
+ */
24
+ keepAllTokens?: boolean;
19
25
  /** Reset CSS to prepend at the top of the sheet (baseline, before everything). */
20
26
  reset?: string;
21
27
  /** Source name recorded for the reset in the map. Default `fluixi:reset.css`. */
@@ -1,6 +1,6 @@
1
1
  import { parseCss } from '../css-parser';
2
2
  import { expandApply } from './apply';
3
- import { raw, stringify, stringifyWithMap } from './ast';
3
+ import { atRule, raw, stringify, stringifyWithMap } from './ast';
4
4
  import { parseAtom } from './atom';
5
5
  import { compileAtom } from './compile';
6
6
  import { createRegistry } from './defaults';
@@ -9,7 +9,7 @@ import { scanAtoms } from './scanner';
9
9
  import { parseSources, resolveSourceFiles, scanSourceFiles } from './source';
10
10
  import { registerBreakpointVariants } from './variants';
11
11
  import { collectVarRefs, emitTheme, loadTheme } from './theme-source';
12
- import { emitUiTheme } from './ui-preset';
12
+ import { emitUiTheme, UI_TOKENS_LAYER } from './ui-preset';
13
13
  // Directives consumed to build the registry — dropped from the output.
14
14
  const CONSUMED = new Set(['theme', 'utility', 'custom-variant', 'source']);
15
15
  // The at-rule that marks where generated tokens + utilities are spliced in.
@@ -81,12 +81,18 @@ export function transform(input, options = {}) {
81
81
  if (uiBlocks)
82
82
  collectVarRefs(uiBlocks, used);
83
83
  collectVarRefs(authorNodes, used); // keep tokens the author CSS references by hand / via @apply
84
- const tokens = emitTheme(reg.theme, ':root', used);
84
+ const tokens = emitTheme(reg.theme, ':root', options.keepAllTokens ? undefined : used);
85
85
  if (tokens.nodes.length)
86
86
  generated.push(tokens);
87
87
  }
88
- if (uiBlocks)
89
- generated.push(...uiBlocks.filter((b) => b.nodes.length));
88
+ // In the tokens layer, where fluixi-ui's own defaults live: later in the cascade than those, so
89
+ // the theme still drives them, and below `flx.skin`, so a skin's tokens win. Unlayered, the
90
+ // bridge beat every layer and a skin's radii, sizes and shadows never applied.
91
+ if (uiBlocks) {
92
+ const blocks = uiBlocks.filter((b) => b.nodes.length);
93
+ if (blocks.length)
94
+ generated.push(atRule('layer', UI_TOKENS_LAYER, blocks));
95
+ }
90
96
  generated.push(...rules);
91
97
  const nodes = markerAt >= 0
92
98
  ? [...authorNodes.slice(0, markerAt), ...generated, ...authorNodes.slice(markerAt)]
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","s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AE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;QACpE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type { RawSourceMap } from 'source-map';\nimport { parseCss } from '../css-parser';\nimport { expandApply } from './apply';\nimport { type AstNode, raw, stringify, stringifyWithMap } from './ast';\nimport { parseAtom } from './atom';\nimport { compileAtom } from './compile';\nimport { createRegistry } from './defaults';\nimport { loadDirectives } from './directives';\nimport { Registry } from './registry';\nimport { scanAtoms } from './scanner';\nimport { parseSources, resolveSourceFiles, scanSourceFiles } from './source';\nimport { registerBreakpointVariants } from './variants';\nimport { collectVarRefs, emitTheme, loadTheme } from './theme-source';\nimport { emitUiTheme } from './ui-preset';\n\n// Directives consumed to build the registry — dropped from the output.\nconst CONSUMED = new Set(['theme', 'utility', 'custom-variant', 'source']);\n// The at-rule that marks where generated tokens + utilities are spliced in.\nconst MARKER = 'fluixi';\n\nexport interface TransformOptions {\n registry?: Registry;\n classes?: string[];\n sources?: string[];\n base?: string;\n /**\n * Shared base CSS whose `@theme` / `@utility` / `@custom-variant` are loaded\n * into the registry *before* the input's, so a per-route sheet inherits (and\n * can override) the global theme + custom utilities without redefining them.\n * Only the directives feed the registry — the base CSS itself isn't emitted.\n */\n theme?: string;\n /** Filename of the input CSS, recorded in the source map. */\n from?: string;\n emitTokens?: boolean;\n emitUiTokens?: boolean;\n /** Reset CSS to prepend at the top of the sheet (baseline, before everything). */\n reset?: string;\n /** Source name recorded for the reset in the map. Default `fluixi:reset.css`. */\n resetFrom?: string;\n /** Produce a source map keyed to the passed-through author CSS. */\n sourceMap?: boolean;\n minify?: boolean;\n}\n\nexport interface TransformStats {\n /** Wall-clock milliseconds for this transform. */\n ms: number;\n /** Class tokens scanned (given + `@source` + inline). */\n scanned: number;\n /** Utility rules generated. */\n utilities: number;\n /** Output CSS byte length. */\n bytes: number;\n /** Files scanned via `@source`. */\n sources: number;\n}\n\nexport interface TransformResult {\n css: string;\n map?: RawSourceMap;\n classes: string[];\n sources: string[];\n stats: TransformStats;\n registry: Registry;\n}\n\n// Processes a whole stylesheet: the author's CSS passes through untouched (and\n// mapped back to source), the `@theme`/`@utility`/`@custom-variant`/`@source`\n// directives are consumed, and an `@fluixi;` marker is replaced by the generated\n// token `:root` + utilities. With no marker the generated block is appended.\nexport function transform(input: string, options: TransformOptions = {}): TransformResult {\n const started = performance.now();\n const reg = options.registry ?? createRegistry();\n if (options.theme) loadTheme(options.theme, reg.theme);\n loadTheme(input, reg.theme); // the input's own @theme overrides the base\n registerBreakpointVariants(reg); // pick up any @theme breakpoint overrides\n if (options.theme) loadDirectives(options.theme, reg);\n loadDirectives(input, reg);\n\n const classes = new Set<string>(options.classes ?? []);\n for (const s of options.sources ?? []) for (const c of scanAtoms(s)) classes.add(c);\n const parsed = parseSources(input);\n for (const c of parsed.inline) classes.add(c);\n let sources: string[] = [];\n if (parsed.patterns.length) {\n sources = resolveSourceFiles(parsed, options.base ?? process.cwd());\n for (const c of scanSourceFiles(sources)) classes.add(c);\n }\n\n const rules: AstNode[] = [];\n for (const cls of classes) {\n const atom = parseAtom(cls, reg);\n if (!atom) continue;\n const compiled = compileAtom(atom, reg);\n if (compiled) rules.push(...compiled);\n }\n\n const uiBlocks = options.emitUiTokens ? emitUiTheme(reg.theme) : null;\n\n // Pass the author CSS through first (expanding `@apply`), remembering where the\n // `@fluixi` marker sits so the generated block splices in at that point. Building\n // it up front lets the token tree-shake also see the author's own `var()` refs —\n // a hand-written or `@apply`-injected `var(--color-x)` must keep `--color-x`\n // alive, else the token is stripped and the reference resolves to nothing.\n const from = options.from ?? '<input>';\n const authorNodes: AstNode[] = [];\n let markerAt = -1;\n for (const node of parseCss(input).children) {\n if (node.type === 'atrule' && node.name === MARKER) {\n if (markerAt < 0) markerAt = authorNodes.length;\n continue;\n }\n if (node.type === 'atrule' && node.name && CONSUMED.has(node.name)) continue;\n\n const start = node.loc?.start;\n const end = node.loc?.end;\n if (start && end && typeof start.offset === 'number' && typeof end.offset === 'number') {\n const text = expandApply(input.slice(start.offset, end.offset), reg);\n authorNodes.push(raw(text, { source: from, line: start.line, column: Math.max(0, start.column - 1) }));\n }\n }\n\n const generated: AstNode[] = [];\n if (options.emitTokens !== false) {\n const used = collectVarRefs(rules);\n if (uiBlocks) collectVarRefs(uiBlocks, used);\n collectVarRefs(authorNodes, used); // keep tokens the author CSS references by hand / via @apply\n const tokens = emitTheme(reg.theme, ':root', used);\n if (tokens.nodes.length) generated.push(tokens);\n }\n if (uiBlocks) generated.push(...uiBlocks.filter((b) => b.nodes.length));\n generated.push(...rules);\n\n const nodes: AstNode[] =\n markerAt >= 0\n ? [...authorNodes.slice(0, markerAt), ...generated, ...authorNodes.slice(markerAt)]\n : [...authorNodes, ...generated];\n const resetFrom = options.resetFrom ?? 'fluixi:reset.css';\n if (options.reset) nodes.unshift(raw(options.reset, { source: resetFrom, line: 1, column: 0 }));\n\n let css: string;\n let map: RawSourceMap | undefined;\n if (options.sourceMap) {\n const out = stringifyWithMap(nodes, { minify: options.minify });\n css = out.css;\n out.map.setSourceContent(from, input);\n if (options.reset) out.map.setSourceContent(resetFrom, options.reset);\n const json = out.map.toJSON();\n json.file = from;\n map = json;\n } else {\n css = stringify(nodes, { minify: options.minify });\n }\n\n const stats: TransformStats = {\n ms: performance.now() - started,\n scanned: classes.size,\n utilities: rules.length,\n bytes: css.length,\n sources: sources.length,\n };\n return map\n ? { css, map, classes: [...classes], sources, stats, registry: reg }\n : { css, classes: [...classes], sources, stats, registry: reg };\n}\n"]}
1
+ {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/engine/transform.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC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OAAO,CAAC,IAAI;QACrB,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,KAAK,EAAE,GAAG,CAAC,MAAM;QACjB,OAAO,EAAE,OAAO,CAAC,MAAM;KACxB,CAAC;IACF,OAAO,GAAG;QACR,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE;QACpE,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type { RawSourceMap } from 'source-map';\nimport { parseCss } from '../css-parser';\nimport { expandApply } from './apply';\nimport { type AstNode, atRule, raw, stringify, stringifyWithMap } from './ast';\nimport { parseAtom } from './atom';\nimport { compileAtom } from './compile';\nimport { createRegistry } from './defaults';\nimport { loadDirectives } from './directives';\nimport { Registry } from './registry';\nimport { scanAtoms } from './scanner';\nimport { parseSources, resolveSourceFiles, scanSourceFiles } from './source';\nimport { registerBreakpointVariants } from './variants';\nimport { collectVarRefs, emitTheme, loadTheme } from './theme-source';\nimport { emitUiTheme, UI_TOKENS_LAYER } from './ui-preset';\n\n// Directives consumed to build the registry — dropped from the output.\nconst CONSUMED = new Set(['theme', 'utility', 'custom-variant', 'source']);\n// The at-rule that marks where generated tokens + utilities are spliced in.\nconst MARKER = 'fluixi';\n\nexport interface TransformOptions {\n registry?: Registry;\n classes?: string[];\n sources?: string[];\n base?: string;\n /**\n * Shared base CSS whose `@theme` / `@utility` / `@custom-variant` are loaded\n * into the registry *before* the input's, so a per-route sheet inherits (and\n * can override) the global theme + custom utilities without redefining them.\n * Only the directives feed the registry — the base CSS itself isn't emitted.\n */\n theme?: string;\n /** Filename of the input CSS, recorded in the source map. */\n from?: string;\n emitTokens?: boolean;\n emitUiTokens?: boolean;\n /**\n * Emit every theme token, not only those this sheet's CSS refers to. For a build whose\n * component styles (`processCss`) are compiled separately and may arrive after this sheet:\n * the tokens they refer to have to be here whatever order things are compiled in.\n */\n keepAllTokens?: boolean;\n /** Reset CSS to prepend at the top of the sheet (baseline, before everything). */\n reset?: string;\n /** Source name recorded for the reset in the map. Default `fluixi:reset.css`. */\n resetFrom?: string;\n /** Produce a source map keyed to the passed-through author CSS. */\n sourceMap?: boolean;\n minify?: boolean;\n}\n\nexport interface TransformStats {\n /** Wall-clock milliseconds for this transform. */\n ms: number;\n /** Class tokens scanned (given + `@source` + inline). */\n scanned: number;\n /** Utility rules generated. */\n utilities: number;\n /** Output CSS byte length. */\n bytes: number;\n /** Files scanned via `@source`. */\n sources: number;\n}\n\nexport interface TransformResult {\n css: string;\n map?: RawSourceMap;\n classes: string[];\n sources: string[];\n stats: TransformStats;\n registry: Registry;\n}\n\n// Processes a whole stylesheet: the author's CSS passes through untouched (and\n// mapped back to source), the `@theme`/`@utility`/`@custom-variant`/`@source`\n// directives are consumed, and an `@fluixi;` marker is replaced by the generated\n// token `:root` + utilities. With no marker the generated block is appended.\nexport function transform(input: string, options: TransformOptions = {}): TransformResult {\n const started = performance.now();\n const reg = options.registry ?? createRegistry();\n if (options.theme) loadTheme(options.theme, reg.theme);\n loadTheme(input, reg.theme); // the input's own @theme overrides the base\n registerBreakpointVariants(reg); // pick up any @theme breakpoint overrides\n if (options.theme) loadDirectives(options.theme, reg);\n loadDirectives(input, reg);\n\n const classes = new Set<string>(options.classes ?? []);\n for (const s of options.sources ?? []) for (const c of scanAtoms(s)) classes.add(c);\n const parsed = parseSources(input);\n for (const c of parsed.inline) classes.add(c);\n let sources: string[] = [];\n if (parsed.patterns.length) {\n sources = resolveSourceFiles(parsed, options.base ?? process.cwd());\n for (const c of scanSourceFiles(sources)) classes.add(c);\n }\n\n const rules: AstNode[] = [];\n for (const cls of classes) {\n const atom = parseAtom(cls, reg);\n if (!atom) continue;\n const compiled = compileAtom(atom, reg);\n if (compiled) rules.push(...compiled);\n }\n\n const uiBlocks = options.emitUiTokens ? emitUiTheme(reg.theme) : null;\n\n // Pass the author CSS through first (expanding `@apply`), remembering where the\n // `@fluixi` marker sits so the generated block splices in at that point. Building\n // it up front lets the token tree-shake also see the author's own `var()` refs —\n // a hand-written or `@apply`-injected `var(--color-x)` must keep `--color-x`\n // alive, else the token is stripped and the reference resolves to nothing.\n const from = options.from ?? '<input>';\n const authorNodes: AstNode[] = [];\n let markerAt = -1;\n for (const node of parseCss(input).children) {\n if (node.type === 'atrule' && node.name === MARKER) {\n if (markerAt < 0) markerAt = authorNodes.length;\n continue;\n }\n if (node.type === 'atrule' && node.name && CONSUMED.has(node.name)) continue;\n\n const start = node.loc?.start;\n const end = node.loc?.end;\n if (start && end && typeof start.offset === 'number' && typeof end.offset === 'number') {\n const text = expandApply(input.slice(start.offset, end.offset), reg);\n authorNodes.push(raw(text, { source: from, line: start.line, column: Math.max(0, start.column - 1) }));\n }\n }\n\n const generated: AstNode[] = [];\n if (options.emitTokens !== false) {\n const used = collectVarRefs(rules);\n if (uiBlocks) collectVarRefs(uiBlocks, used);\n collectVarRefs(authorNodes, used); // keep tokens the author CSS references by hand / via @apply\n const tokens = emitTheme(reg.theme, ':root', options.keepAllTokens ? undefined : used);\n if (tokens.nodes.length) generated.push(tokens);\n }\n // In the tokens layer, where fluixi-ui's own defaults live: later in the cascade than those, so\n // the theme still drives them, and below `flx.skin`, so a skin's tokens win. Unlayered, the\n // bridge beat every layer and a skin's radii, sizes and shadows never applied.\n if (uiBlocks) {\n const blocks = uiBlocks.filter((b) => b.nodes.length);\n if (blocks.length) generated.push(atRule('layer', UI_TOKENS_LAYER, blocks));\n }\n generated.push(...rules);\n\n const nodes: AstNode[] =\n markerAt >= 0\n ? [...authorNodes.slice(0, markerAt), ...generated, ...authorNodes.slice(markerAt)]\n : [...authorNodes, ...generated];\n const resetFrom = options.resetFrom ?? 'fluixi:reset.css';\n if (options.reset) nodes.unshift(raw(options.reset, { source: resetFrom, line: 1, column: 0 }));\n\n let css: string;\n let map: RawSourceMap | undefined;\n if (options.sourceMap) {\n const out = stringifyWithMap(nodes, { minify: options.minify });\n css = out.css;\n out.map.setSourceContent(from, input);\n if (options.reset) out.map.setSourceContent(resetFrom, options.reset);\n const json = out.map.toJSON();\n json.file = from;\n map = json;\n } else {\n css = stringify(nodes, { minify: options.minify });\n }\n\n const stats: TransformStats = {\n ms: performance.now() - started,\n scanned: classes.size,\n utilities: rules.length,\n bytes: css.length,\n sources: sources.length,\n };\n return map\n ? { css, map, classes: [...classes], sources, stats, registry: reg }\n : { css, classes: [...classes], sources, stats, registry: reg };\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  import { type Declaration, type StyleRule } from './ast';
2
2
  import { Theme } from './theme';
3
+ /** The cascade layer the bridge is emitted in: fluixi-ui's tokens layer, below its skins. */
4
+ export declare const UI_TOKENS_LAYER = "flx.tokens";
3
5
  /** The primitive + scale bridges (non-colour and the raw scale refs). */
4
6
  export declare function uiTokenBridges(theme: Theme): Declaration[];
5
7
  /** The structural semantic layer — emitted only when the theme drives colour. */
@@ -1,4 +1,6 @@
1
1
  import { decl, rule } from './ast';
2
+ /** The cascade layer the bridge is emitted in: fluixi-ui's tokens layer, below its skins. */
3
+ export const UI_TOKENS_LAYER = 'flx.tokens';
2
4
  // Bridges a fluixi-css theme to the `--flx-ui-*` custom properties the Fluixi UI
3
5
  // components read (`@fluixi-ui/tokens`). Each bridge emits `--flx-ui-x: var(--src)`
4
6
  // so a fluixi-css theme *drives* the UI — change the theme, the components follow —
@@ -1 +1 @@
1
- {"version":3,"file":"ui-preset.js","sourceRoot":"","sources":["../../../src/engine/ui-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAGnF,iFAAiF;AACjF,oFAAoF;AACpF,oFAAoF;AACpF,iFAAiF;AACjF,uFAAuF;AACvF,EAAE;AACF,2EAA2E;AAC3E,kFAAkF;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AAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC;QACrH,SAAS,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { type AstNode, type Declaration, type StyleRule, decl, rule } from './ast';\nimport { Theme } from './theme';\n\n// Bridges a fluixi-css theme to the `--flx-ui-*` custom properties the Fluixi UI\n// components read (`@fluixi-ui/tokens`). Each bridge emits `--flx-ui-x: var(--src)`\n// so a fluixi-css theme *drives* the UI — change the theme, the components follow —\n// without copying any values across. A primitive bridge is emitted only when its\n// source token exists, so the UI's own defaults stand in for anything the theme omits.\n//\n// Colour is the driven half: when the theme supplies the functional scales\n// (`--color-accent-1..12` / `--color-gray-1..12`), this also emits the UI's whole\n// *semantic* layer (`--flx-ui-color-primary`, …). That layer is purely structural —\n// every var references a scale/alias var, never a concrete colour — so it carries no\n// palette data across the package boundary; `@fluixi-ui/tokens` still owns the\n// default values. The semantic layer is re-emitted in a dark scope because\n// custom-property substitution freezes at the declaring element: a `:root`-only\n// `--flx-ui-color-primary: var(--flx-ui-accent-9)` would inherit light's *resolved*\n// colour into a dark subtree instead of re-resolving against the dark scale.\n\n// UI space scale ↔ the `--spacing` base (space-4 = 1rem = 0.25rem × 4).\nconst SPACE_STEPS = [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24];\n\n// UI font-size keys ↔ fluixi `--text-*` keys (the UI's `md` is fluixi's `base`).\nconst FONT_SIZE: [string, string][] = [\n ['xs', 'xs'],\n ['sm', 'sm'],\n ['md', 'base'],\n ['lg', 'lg'],\n ['xl', 'xl'],\n ['2xl', '2xl'],\n ['3xl', '3xl'],\n ['4xl', '4xl'],\n];\n\nconst RADIUS = ['sm', 'md', 'lg', 'xl'];\nconst SHADOW = ['sm', 'md', 'lg', 'xl'];\nconst BREAKPOINT = ['sm', 'md', 'lg', 'xl', '2xl'];\n\n// The UI's semantic layer, mirrored from `@fluixi-ui/tokens` (`semanticColors`).\n// Structural only — refs into the scales/aliases the bridge (or the UI's own\n// defaults) provide. `color-primary-fg` and `color-overlay` are intentionally\n// omitted: they're concrete kit defaults, not scale-derived, so the UI package\n// keeps ownership of them.\nconst SEMANTIC: [string, string][] = [\n ['color-bg', 'gray-1'],\n ['color-bg-subtle', 'gray-2'],\n ['color-bg-muted', 'gray-3'],\n ['color-fg', 'gray-12'],\n ['color-fg-muted', 'gray-11'],\n ['color-border', 'gray-6'],\n ['color-border-strong', 'gray-7'],\n ['color-focus-ring', 'accent-8'],\n ['color-primary', 'accent-9'],\n ['color-primary-hover', 'accent-10'],\n ['color-primary-active', 'accent-11'],\n ['color-primary-subtle', 'accent-3'],\n ['color-danger', 'danger-solid'],\n ['color-danger-fg', 'danger-fg'],\n ['color-danger-subtle', 'danger-subtle'],\n ['color-success', 'success-solid'],\n ['color-success-fg', 'success-fg'],\n ['color-success-subtle', 'success-subtle'],\n ['color-warning', 'warning-solid'],\n ['color-warning-fg', 'warning-fg'],\n ['color-warning-subtle', 'warning-subtle'],\n];\n\n// Optional status-colour bridges: a theme may drive the UI's danger/success/\n// warning solids by supplying `--color-danger` / `--color-success` / `--color-warning`.\nconst STATUS: [string, string][] = [\n ['danger-solid', '--color-danger'],\n ['success-solid', '--color-success'],\n ['warning-solid', '--color-warning'],\n];\n\n/** True once the theme supplies enough of the functional scales to drive colour. */\nfunction hasColorScales(theme: Theme): boolean {\n return theme.has('--color-accent-9') || theme.has('--color-gray-1');\n}\n\n/** The primitive + scale bridges (non-colour and the raw scale refs). */\nexport function uiTokenBridges(theme: Theme): Declaration[] {\n const out: Declaration[] = [];\n const bridge = (flx: string, source: string) => {\n if (theme.has(source)) out.push(decl(`--flx-ui-${flx}`, `var(${source})`));\n };\n\n if (theme.has('--spacing')) {\n for (const n of SPACE_STEPS) {\n out.push(decl(`--flx-ui-space-${n}`, n === 0 ? '0px' : `calc(var(--spacing) * ${n})`));\n }\n }\n\n for (const k of RADIUS) bridge(`radius-${k}`, `--radius-${k}`);\n for (const [flx, key] of FONT_SIZE) bridge(`font-size-${flx}`, `--text-${key}`);\n for (const k of SHADOW) bridge(`shadow-${k}`, `--shadow-${k}`);\n for (const k of BREAKPOINT) bridge(`breakpoint-${k}`, `--breakpoint-${k}`);\n\n // Functional colour scales are opt-in: supply a Radix-style 1..12 ramp and the\n // UI's semantic colours follow. Absent them, the UI's built-in scales stand.\n for (let i = 1; i <= 12; i++) {\n bridge(`accent-${i}`, `--color-accent-${i}`);\n bridge(`gray-${i}`, `--color-gray-${i}`);\n }\n for (const [flx, source] of STATUS) bridge(flx, source);\n\n return out;\n}\n\n/** The structural semantic layer — emitted only when the theme drives colour. */\nexport function uiSemanticLayer(theme: Theme): Declaration[] {\n if (!hasColorScales(theme)) return [];\n return SEMANTIC.map(([name, ref]) => decl(`--flx-ui-${name}`, `var(--flx-ui-${ref})`));\n}\n\nexport interface EmitUiOptions {\n /** Root scope for the bridges + semantic layer. */\n selector?: string;\n /**\n * Dark scope. The scale bridges + semantic layer are re-emitted here so the\n * `var()` refs re-resolve against the theme's dark-scoped `--color-*` values.\n * Emitted only when the theme drives colour. Pass `null` to skip.\n */\n darkSelector?: string | null;\n}\n\n/**\n * The bridges as sibling top-level rules, ready to prepend to the compiled sheet:\n * `:root` (primitives + scales + semantic layer) and, when the theme drives\n * colour, a dark-scope re-emit of the colour half so its `var()` refs re-resolve\n * against the theme's dark-scoped `--color-*` values.\n */\nexport function emitUiTheme(theme: Theme, options: EmitUiOptions = {}): StyleRule[] {\n const { selector = ':root', darkSelector = \"[data-theme='dark']\" } = options;\n\n const out: StyleRule[] = [rule(selector, [...uiTokenBridges(theme), ...uiSemanticLayer(theme)])];\n\n if (darkSelector && hasColorScales(theme)) {\n // Re-emit only the colour half in the dark scope (primitives don't flip).\n const darkColor: AstNode[] = [];\n for (let i = 1; i <= 12; i++) {\n if (theme.has(`--color-accent-${i}`)) darkColor.push(decl(`--flx-ui-accent-${i}`, `var(--color-accent-${i})`));\n if (theme.has(`--color-gray-${i}`)) darkColor.push(decl(`--flx-ui-gray-${i}`, `var(--color-gray-${i})`));\n }\n for (const [flx, source] of STATUS) if (theme.has(source)) darkColor.push(decl(`--flx-ui-${flx}`, `var(${source})`));\n darkColor.push(...uiSemanticLayer(theme));\n out.push(rule(darkSelector, darkColor));\n }\n\n return out;\n}\n"]}
1
+ {"version":3,"file":"ui-preset.js","sourceRoot":"","sources":["../../../src/engine/ui-preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAGnF,6FAA6F;AAC7F,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C,iFAAiF;AACjF,oFAAoF;AACpF,oFAAoF;AACpF,iFAAiF;AACjF,uFAAuF;AACvF,EAAE;AACF,2EAA2E;AAC3E,kFAAkF;AAClF,oFAAoF;AACpF,qFAAqF;AACrF,+EAA+E;AAC/E,2EAA2E;AAC3E,gFAAgF;AAChF,oFAAoF;AACpF,6EAA6E;AAE7E,wEAAwE;AACxE,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAEjE,iFAAiF;AACjF,MAAM,SAAS,GAAuB;IACpC,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,IAAI,EAAE,MAAM,CAAC;IACd,CAAC,IAAI,EAAE,IAAI,CAAC;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AAQ,EAAE,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjG,IAAI,YAAY,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1C,0EAA0E;QAC1E,MAAM,SAAS,GAAc,EAAE,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,IAAI,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/G,IAAI,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3G,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM;YAAE,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,EAAE,EAAE,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC;QACrH,SAAS,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { type AstNode, type Declaration, type StyleRule, decl, rule } from './ast';\nimport { Theme } from './theme';\n\n/** The cascade layer the bridge is emitted in: fluixi-ui's tokens layer, below its skins. */\nexport const UI_TOKENS_LAYER = 'flx.tokens';\n\n// Bridges a fluixi-css theme to the `--flx-ui-*` custom properties the Fluixi UI\n// components read (`@fluixi-ui/tokens`). Each bridge emits `--flx-ui-x: var(--src)`\n// so a fluixi-css theme *drives* the UI — change the theme, the components follow —\n// without copying any values across. A primitive bridge is emitted only when its\n// source token exists, so the UI's own defaults stand in for anything the theme omits.\n//\n// Colour is the driven half: when the theme supplies the functional scales\n// (`--color-accent-1..12` / `--color-gray-1..12`), this also emits the UI's whole\n// *semantic* layer (`--flx-ui-color-primary`, …). That layer is purely structural —\n// every var references a scale/alias var, never a concrete colour — so it carries no\n// palette data across the package boundary; `@fluixi-ui/tokens` still owns the\n// default values. The semantic layer is re-emitted in a dark scope because\n// custom-property substitution freezes at the declaring element: a `:root`-only\n// `--flx-ui-color-primary: var(--flx-ui-accent-9)` would inherit light's *resolved*\n// colour into a dark subtree instead of re-resolving against the dark scale.\n\n// UI space scale ↔ the `--spacing` base (space-4 = 1rem = 0.25rem × 4).\nconst SPACE_STEPS = [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24];\n\n// UI font-size keys ↔ fluixi `--text-*` keys (the UI's `md` is fluixi's `base`).\nconst FONT_SIZE: [string, string][] = [\n ['xs', 'xs'],\n ['sm', 'sm'],\n ['md', 'base'],\n ['lg', 'lg'],\n ['xl', 'xl'],\n ['2xl', '2xl'],\n ['3xl', '3xl'],\n ['4xl', '4xl'],\n];\n\nconst RADIUS = ['sm', 'md', 'lg', 'xl'];\nconst SHADOW = ['sm', 'md', 'lg', 'xl'];\nconst BREAKPOINT = ['sm', 'md', 'lg', 'xl', '2xl'];\n\n// The UI's semantic layer, mirrored from `@fluixi-ui/tokens` (`semanticColors`).\n// Structural only — refs into the scales/aliases the bridge (or the UI's own\n// defaults) provide. `color-primary-fg` and `color-overlay` are intentionally\n// omitted: they're concrete kit defaults, not scale-derived, so the UI package\n// keeps ownership of them.\nconst SEMANTIC: [string, string][] = [\n ['color-bg', 'gray-1'],\n ['color-bg-subtle', 'gray-2'],\n ['color-bg-muted', 'gray-3'],\n ['color-fg', 'gray-12'],\n ['color-fg-muted', 'gray-11'],\n ['color-border', 'gray-6'],\n ['color-border-strong', 'gray-7'],\n ['color-focus-ring', 'accent-8'],\n ['color-primary', 'accent-9'],\n ['color-primary-hover', 'accent-10'],\n ['color-primary-active', 'accent-11'],\n ['color-primary-subtle', 'accent-3'],\n ['color-danger', 'danger-solid'],\n ['color-danger-fg', 'danger-fg'],\n ['color-danger-subtle', 'danger-subtle'],\n ['color-success', 'success-solid'],\n ['color-success-fg', 'success-fg'],\n ['color-success-subtle', 'success-subtle'],\n ['color-warning', 'warning-solid'],\n ['color-warning-fg', 'warning-fg'],\n ['color-warning-subtle', 'warning-subtle'],\n];\n\n// Optional status-colour bridges: a theme may drive the UI's danger/success/\n// warning solids by supplying `--color-danger` / `--color-success` / `--color-warning`.\nconst STATUS: [string, string][] = [\n ['danger-solid', '--color-danger'],\n ['success-solid', '--color-success'],\n ['warning-solid', '--color-warning'],\n];\n\n/** True once the theme supplies enough of the functional scales to drive colour. */\nfunction hasColorScales(theme: Theme): boolean {\n return theme.has('--color-accent-9') || theme.has('--color-gray-1');\n}\n\n/** The primitive + scale bridges (non-colour and the raw scale refs). */\nexport function uiTokenBridges(theme: Theme): Declaration[] {\n const out: Declaration[] = [];\n const bridge = (flx: string, source: string) => {\n if (theme.has(source)) out.push(decl(`--flx-ui-${flx}`, `var(${source})`));\n };\n\n if (theme.has('--spacing')) {\n for (const n of SPACE_STEPS) {\n out.push(decl(`--flx-ui-space-${n}`, n === 0 ? '0px' : `calc(var(--spacing) * ${n})`));\n }\n }\n\n for (const k of RADIUS) bridge(`radius-${k}`, `--radius-${k}`);\n for (const [flx, key] of FONT_SIZE) bridge(`font-size-${flx}`, `--text-${key}`);\n for (const k of SHADOW) bridge(`shadow-${k}`, `--shadow-${k}`);\n for (const k of BREAKPOINT) bridge(`breakpoint-${k}`, `--breakpoint-${k}`);\n\n // Functional colour scales are opt-in: supply a Radix-style 1..12 ramp and the\n // UI's semantic colours follow. Absent them, the UI's built-in scales stand.\n for (let i = 1; i <= 12; i++) {\n bridge(`accent-${i}`, `--color-accent-${i}`);\n bridge(`gray-${i}`, `--color-gray-${i}`);\n }\n for (const [flx, source] of STATUS) bridge(flx, source);\n\n return out;\n}\n\n/** The structural semantic layer — emitted only when the theme drives colour. */\nexport function uiSemanticLayer(theme: Theme): Declaration[] {\n if (!hasColorScales(theme)) return [];\n return SEMANTIC.map(([name, ref]) => decl(`--flx-ui-${name}`, `var(--flx-ui-${ref})`));\n}\n\nexport interface EmitUiOptions {\n /** Root scope for the bridges + semantic layer. */\n selector?: string;\n /**\n * Dark scope. The scale bridges + semantic layer are re-emitted here so the\n * `var()` refs re-resolve against the theme's dark-scoped `--color-*` values.\n * Emitted only when the theme drives colour. Pass `null` to skip.\n */\n darkSelector?: string | null;\n}\n\n/**\n * The bridges as sibling top-level rules, ready to prepend to the compiled sheet:\n * `:root` (primitives + scales + semantic layer) and, when the theme drives\n * colour, a dark-scope re-emit of the colour half so its `var()` refs re-resolve\n * against the theme's dark-scoped `--color-*` values.\n */\nexport function emitUiTheme(theme: Theme, options: EmitUiOptions = {}): StyleRule[] {\n const { selector = ':root', darkSelector = \"[data-theme='dark']\" } = options;\n\n const out: StyleRule[] = [rule(selector, [...uiTokenBridges(theme), ...uiSemanticLayer(theme)])];\n\n if (darkSelector && hasColorScales(theme)) {\n // Re-emit only the colour half in the dark scope (primitives don't flip).\n const darkColor: AstNode[] = [];\n for (let i = 1; i <= 12; i++) {\n if (theme.has(`--color-accent-${i}`)) darkColor.push(decl(`--flx-ui-accent-${i}`, `var(--color-accent-${i})`));\n if (theme.has(`--color-gray-${i}`)) darkColor.push(decl(`--flx-ui-gray-${i}`, `var(--color-gray-${i})`));\n }\n for (const [flx, source] of STATUS) if (theme.has(source)) darkColor.push(decl(`--flx-ui-${flx}`, `var(${source})`));\n darkColor.push(...uiSemanticLayer(theme));\n out.push(rule(darkSelector, darkColor));\n }\n\n return out;\n}\n"]}