@homebound/truss 2.29.13 → 2.30.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.
- package/build/index.d.ts +57 -2
- package/build/index.js +80 -4
- package/build/index.js.map +1 -1
- package/build/plugin/index.d.ts +4 -0
- package/build/plugin/index.js +188 -11
- package/build/plugin/index.js.map +1 -1
- package/build/runtime.d.ts +7 -0
- package/build/runtime.js +4 -1
- package/build/runtime.js.map +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/build/runtime.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ interface ParsedPropertyDeclaration {
|
|
|
15
15
|
/** The variable name, i.e. `--marginTop`. */
|
|
16
16
|
varName: string;
|
|
17
17
|
}
|
|
18
|
+
/** A parsed @keyframes block extracted from an annotated truss.css file. */
|
|
19
|
+
interface ParsedKeyframesBlock {
|
|
20
|
+
cssText: string;
|
|
21
|
+
/** The animation name, i.e. `spin`. */
|
|
22
|
+
name: string;
|
|
23
|
+
}
|
|
18
24
|
|
|
19
25
|
/** An atomic rule ready for CSSOM insertion, with query metadata supplied by the plugin. */
|
|
20
26
|
interface TestCssRule extends ParsedCssRule {
|
|
@@ -24,6 +30,7 @@ interface TestCssRule extends ParsedCssRule {
|
|
|
24
30
|
interface TestCssPayload {
|
|
25
31
|
rules?: TestCssRule[];
|
|
26
32
|
properties?: ParsedPropertyDeclaration[];
|
|
33
|
+
keyframes?: ParsedKeyframesBlock[];
|
|
27
34
|
/** Complete top-level rules, split by the plugin with nested at-rules left intact. */
|
|
28
35
|
arbitraryRules?: string[];
|
|
29
36
|
/** Canonical application source path, or the combined library source; required for arbitrary rules. */
|
package/build/runtime.js
CHANGED
|
@@ -48,7 +48,7 @@ function compareWidthIntervals(a, b) {
|
|
|
48
48
|
// src/runtime-css.ts
|
|
49
49
|
var trussStyleElement = null;
|
|
50
50
|
function __injectTrussCSS(payload) {
|
|
51
|
-
if (typeof document === "undefined" || !payload.rules?.length && !payload.properties?.length && !payload.arbitraryRules?.length && !payload.prelude)
|
|
51
|
+
if (typeof document === "undefined" || !payload.rules?.length && !payload.properties?.length && !payload.keyframes?.length && !payload.arbitraryRules?.length && !payload.prelude)
|
|
52
52
|
return;
|
|
53
53
|
if (payload.arbitraryRules?.length && !payload.source) {
|
|
54
54
|
throw new Error("Truss arbitrary CSS requires a source identity.");
|
|
@@ -83,6 +83,9 @@ function __injectTrussCSS(payload) {
|
|
|
83
83
|
for (const property of payload.properties ?? []) {
|
|
84
84
|
changed = installRule(state, { ...base, id: `property:${property.varName}`, section: 2, cssText: property.cssText }) || changed;
|
|
85
85
|
}
|
|
86
|
+
for (const block of payload.keyframes ?? []) {
|
|
87
|
+
changed = installRule(state, { ...base, id: `keyframes:${block.name}`, section: 2, cssText: block.cssText }) || changed;
|
|
88
|
+
}
|
|
86
89
|
for (const [position, cssText] of (payload.arbitraryRules ?? []).entries()) {
|
|
87
90
|
changed = installRule(state, {
|
|
88
91
|
...base,
|
package/build/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime.ts","../src/css-order.ts","../src/runtime-css.ts","../src/style-metadata.ts","../src/media-query.ts","../src/css-custom-property.ts"],"sourcesContent":["import { useInsertionEffect } from \"react\";\nimport { getOrCreateTrussStyleElement } from \"./runtime-css\";\nimport {\n TRUSS_CSS_MARKER_KEY,\n TRUSS_CUSTOM_CLASS_PREFIX,\n TRUSS_INLINE_STYLE_PREFIX,\n TRUSS_MARKER_KEY,\n} from \"./style-metadata\";\n\nexport { invertMediaQuery as __invertTrussMediaQuery } from \"./media-query\";\nexport { maybeCssVar } from \"./css-custom-property\";\nexport { __injectTrussCSS } from \"./runtime-css\";\nexport type { TestCssPayload, TestCssRule } from \"./test-css\";\n\n/** A compact source label for a Truss CSS expression, used in debug mode. */\nexport class TrussDebugInfo {\n /** I.e. `\"FileName.tsx:line\"` */\n readonly src: string;\n\n constructor(src: string) {\n this.src = src;\n }\n}\n\n/**\n * Space-separated atomic class names, or a variable tuple with class names + CSS variable map.\n *\n * In debug mode, the transform appends a TrussDebugInfo as an extra tuple element:\n * - static with debug: `[classNames, debugInfo]`\n * - variable with debug: `[classNames, vars, debugInfo]`\n */\nexport type TrussStyleValue =\n | string\n | [classNames: string, vars: Record<string, string>]\n | [classNames: string, debugInfo: TrussDebugInfo]\n | [classNames: string, vars: Record<string, string>, debugInfo: TrussDebugInfo];\n\n/** A property-keyed style hash where each key owns one logical CSS property. */\nexport type TrussCustomClassNameValue = string | ReadonlyArray<string | false | null | undefined>;\nexport type RuntimeStyleDeclarationValue = string | number | null | undefined;\nexport type TrussInlineStyleValue = Record<string, RuntimeStyleDeclarationValue> | false | null | undefined;\nexport type TrussStyleHash = Record<string, TrussStyleValue | TrussCustomClassNameValue | TrussInlineStyleValue>;\nexport type RuntimeStyleDeclarations = Record<string, RuntimeStyleDeclarationValue | Record<string, unknown>>;\nexport type RuntimeStyleCss = Record<string, RuntimeStyleDeclarations | string>;\n\nconst shouldValidateTrussStyleValues = resolveShouldValidateTrussStyleValues();\nconst shouldEmitTrussSrcAttribute = resolveShouldEmitTrussSrcAttribute();\n\n/** Merge one or more Truss style hashes into `{ className, style?, data-truss-src? }`. */\nexport function trussProps(\n ...hashes: ReadonlyArray<TrussStyleHash | false | null | undefined>\n): Record<string, unknown> {\n const merged: Record<string, unknown> = {};\n\n for (const hash of hashes) {\n if (!hash || typeof hash !== \"object\") continue;\n Object.assign(merged, hash);\n }\n\n const classNames: string[] = [];\n const inlineStyle: Record<string, unknown> = {};\n const debugSources: string[] = [];\n\n for (const [key, value] of Object.entries(merged)) {\n // $css is the Css expression marker — skip it\n if (key === TRUSS_CSS_MARKER_KEY) continue;\n\n // __marker is a special key — its value is a marker class name, not a CSS property\n if (key === TRUSS_MARKER_KEY) {\n if (typeof value === \"string\") {\n classNames.push(value);\n }\n continue;\n }\n\n if (key.startsWith(TRUSS_CUSTOM_CLASS_PREFIX)) {\n // I.e. plugin-emitted raw class names that should flow straight into the final prop.\n appendCustomClassNames(classNames, value);\n continue;\n }\n\n if (key.startsWith(TRUSS_INLINE_STYLE_PREFIX)) {\n appendInlineStyles(inlineStyle, value);\n continue;\n }\n\n if (shouldValidateTrussStyleValues) assertValidTrussStyleValue(key, value);\n const trussValue = value as TrussStyleValue;\n\n if (typeof trussValue === \"string\") {\n // I.e. \"df\" or \"black blue_h\"\n classNames.push(trussValue);\n continue;\n }\n\n // Tuple: [classNames, varsOrDebug?, maybeDebug?]\n classNames.push(trussValue[0]);\n\n for (let i = 1; i < trussValue.length; i++) {\n const el = trussValue[i];\n if (el instanceof TrussDebugInfo) {\n debugSources.push(el.src);\n } else if (typeof el === \"object\" && el !== null) {\n Object.assign(inlineStyle, el);\n }\n }\n }\n\n const props: Record<string, unknown> = {\n className: classNames.join(\" \"),\n };\n\n if (Object.keys(inlineStyle).length > 0) {\n props.style = inlineStyle;\n }\n\n if (shouldEmitTrussSrcAttribute && debugSources.length > 0) {\n props[\"data-truss-src\"] = [...new Set(debugSources)].join(\"; \");\n }\n\n return props;\n}\n\nfunction appendCustomClassNames(classNames: string[], value: unknown): void {\n if (typeof value === \"string\") {\n // I.e. `className_button: \"button\"`\n classNames.push(value);\n return;\n }\n\n if (!Array.isArray(value)) return;\n for (const entry of value) {\n if (typeof entry === \"string\") {\n // I.e. `className_button: [\"button\", cond && \"selected\"]`\n classNames.push(entry);\n }\n }\n}\n\nfunction appendInlineStyles(inlineStyle: Record<string, unknown>, value: unknown): void {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return;\n }\n\n for (const [key, entry] of Object.entries(value)) {\n if (entry === undefined || entry === null) {\n continue;\n }\n if (typeof entry === \"string\" || typeof entry === \"number\") {\n inlineStyle[key] = entry;\n }\n }\n}\n\n/** Merge explicit className/style with Truss style hashes. */\nexport function mergeProps(\n explicitClassName: string | undefined,\n explicitStyle: Record<string, unknown> | undefined,\n ...hashes: ReadonlyArray<TrussStyleHash | false | null | undefined>\n): Record<string, unknown> {\n const result = trussProps(...hashes);\n\n if (explicitClassName) {\n result.className = `${explicitClassName} ${result.className ?? \"\"}`.trim();\n }\n\n if (explicitStyle) {\n result.style = { ...explicitStyle, ...(result.style as Record<string, unknown> | undefined) };\n }\n\n return result;\n}\n\nexport interface RuntimeStyleProps {\n css: RuntimeStyleCss;\n}\n\n/**\n * Inject dynamic or selector-based CSS at runtime into a transient `<style>` tag.\n *\n * This is the runtime counterpart to `.css.ts` files:\n * - use `.css.ts` for static/global arbitrary selectors that should be baked into the build output\n * - use `RuntimeStyle` for selectors that depend on runtime values or should only exist while a component is mounted\n *\n * Example with a flat `Css` expression:\n * ```tsx\n * <RuntimeStyle\n * css={{\n * \".preview a\": Css.blue.$,\n * }}\n * />\n * ```\n *\n * Example with raw CSS via `Css.raw`:\n * ```tsx\n * <RuntimeStyle\n * css={{\n * \".preview code\": Css.raw`\n * font-variant-ligatures: none;\n * text-decoration: underline;\n * `,\n * }}\n * />\n * ```\n *\n * The injected `<style>` element is appended on mount and removed on unmount.\n *\n * Note: Only flat `Css.*.$` expressions are supported here; selector/marker helpers like\n * `onHover`, `when`, `ifSm`, `ifContainer`, `element`, `className()`, and `style()` are rejected\n * at runtime.\n */\nexport function RuntimeStyle(props: RuntimeStyleProps): null {\n useRuntimeStyle(props.css);\n return null;\n}\n\n/**\n * Hook that injects dynamic or selector-based CSS at runtime into a transient `<style>` tag.\n *\n * This is the hook counterpart to the `RuntimeStyle` component and `.css.ts` files:\n * - use `.css.ts` for static/global arbitrary selectors baked into the build output\n * - use `useRuntimeStyle` when you need the same thing from a hook instead of a component\n *\n * Example with a flat `Css` expression:\n * ```ts\n * useRuntimeStyle({ \"body\": Css.mbPx(dynamicValue).$ });\n * ```\n *\n * Example with raw CSS via `Css.raw`:\n * ```ts\n * useRuntimeStyle({ \".preview code\": Css.raw`font-variant-ligatures: none;` });\n * ```\n *\n * The injected `<style>` element is appended on mount and removed on unmount.\n *\n * Note: Only flat `Css.*.$` expressions are supported here; selector/marker helpers like\n * `onHover`, `when`, `ifSm`, `ifContainer`, `element`, `className()`, and `style()` are rejected\n * at runtime.\n */\nexport function useRuntimeStyle(css: RuntimeStyleCss): void {\n const cssText = buildRuntimeStyleCssText(css);\n useInsertionEffect(() => {\n if (typeof document === \"undefined\" || cssText.length === 0) return;\n // Reserve the static sheet before transient styles, even when no module CSS has loaded yet.\n //\n // This call is not redundant with getOrCreateTrussStyleElement inserting the static sheet\n // before the first runtime style. jsdom cascades document.styleSheets in attach order, not\n // DOM order. Without this reservation, a static sheet created after this runtime style\n // mounts lands before it in <head> but after it in document.styleSheets, so the static\n // rule wins the cascade. I.e. a runtime `.x { color: green }` mounted first loses to a\n // later injected static `.x { color: red }`.\n getOrCreateTrussStyleElement();\n const style = document.createElement(\"style\");\n style.setAttribute(\"data-truss-runtime-style\", \"\");\n style.textContent = cssText;\n document.head.appendChild(style);\n return () => style.remove();\n }, [cssText]);\n}\n\n/** Serialize RuntimeStyle rules into CSS text for a transient `<style>` tag. */\nfunction buildRuntimeStyleCssText(css: RuntimeStyleCss): string {\n const rules: string[] = [];\n for (const [selector, value] of Object.entries(css)) {\n if (typeof value === \"string\") {\n rules.push(formatRawRuntimeStyleRule(selector, value));\n } else {\n rules.push(formatRuntimeStyleRule(selector, value));\n }\n }\n return rules.join(\"\\n\\n\");\n}\n\nfunction formatRawRuntimeStyleRule(selector: string, raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return `${selector} {}`;\n const body = trimmed\n .split(\"\\n\")\n .map((line) => ` ${line.trim()}`)\n .filter((line) => line.trim().length > 0)\n .join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n\nfunction formatRuntimeStyleRule(selector: string, declarations: RuntimeStyleDeclarations): string {\n const lines: string[] = [];\n for (const [property, value] of Object.entries(declarations)) {\n if (property === TRUSS_CSS_MARKER_KEY) continue;\n if (value === undefined || value === null) continue;\n if (typeof value !== \"string\" && typeof value !== \"number\") {\n throw new Error(runtimeStyleUnsupportedValueMessage(selector, property));\n }\n lines.push(` ${camelToKebabRuntime(property)}: ${String(value)};`);\n }\n if (lines.length === 0) return `${selector} {}`;\n return `${selector} {\\n${lines.join(\"\\n\")}\\n}`;\n}\n\nfunction runtimeStyleUnsupportedValueMessage(selector: string, property: string): string {\n return `RuntimeStyle selector \\`${selector}\\` has an unsupported nested value for \\`${property}\\`. Only flat Css expressions can be used here; selector/marker/className helpers like onHover, when, ifSm, ifContainer, element, className(), and style() are not supported.`;\n}\n\nfunction camelToKebabRuntime(property: string): string {\n return property\n .replace(/^(Webkit|Moz|Ms|O)/, function prefixToCss(prefix) {\n return `-${prefix.toLowerCase()}`;\n })\n .replace(/[A-Z]/g, function upperToCss(letter) {\n return `-${letter.toLowerCase()}`;\n });\n}\n\n/** Fail fast when `trussProps` receives a non-Truss style value. */\nfunction assertValidTrussStyleValue(key: string, value: unknown): asserts value is TrussStyleValue {\n if (typeof value === \"string\") return;\n if (Array.isArray(value) && typeof value[0] === \"string\") {\n for (let i = 1; i < value.length; i++) {\n const el = value[i];\n if (el instanceof TrussDebugInfo) continue;\n if (typeof el === \"object\" && el !== null && !Array.isArray(el)) continue;\n throw new TypeError(invalidTrussStyleValueMessage(key));\n }\n return;\n }\n throw new TypeError(invalidTrussStyleValueMessage(key));\n}\n\nfunction invalidTrussStyleValueMessage(key: string): string {\n return `Invalid Truss style value for \\`${key}\\`. trussProps only accepts generated Truss style hashes; use mergeProps for explicit className/style merging.`;\n}\n\n/** Enable validation in dev/test environments, but skip it in production. */\nfunction resolveShouldValidateTrussStyleValues(): boolean {\n if (typeof process !== \"undefined\" && typeof process.env.NODE_ENV === \"string\") {\n return process.env.NODE_ENV !== \"production\";\n }\n const viteEnv = (import.meta as ImportMeta & { env?: { DEV?: boolean; PROD?: boolean } }).env;\n if (typeof viteEnv?.DEV === \"boolean\") return viteEnv.DEV;\n if (typeof viteEnv?.PROD === \"boolean\") return !viteEnv.PROD;\n return false;\n}\n\n/** Omit unstable source labels from rendered props during Vitest runs. */\nfunction resolveShouldEmitTrussSrcAttribute(): boolean {\n if (typeof process !== \"undefined\" && typeof process.env.VITEST === \"string\") {\n return false;\n }\n return true;\n}\n","/**\n * The sort key shared by `emit-css`, `merge-css`, and `runtime-css`, so a stylesheet merged from\n * library CSS or assembled rule by rule in jsdom keeps the same rule order as the per-file output.\n */\nexport interface RuleSortKey {\n priority: number;\n className: string;\n /** The px widths the rule's media or container query matches, or null when it has no readable interval. */\n widthInterval: WidthInterval | null;\n}\n\n/** The inclusive px widths a query matches; `hi` is Infinity for a min-width-only query. */\nexport interface WidthInterval {\n lo: number;\n hi: number;\n}\n\n/** I.e. `ruleSortKey(3200, \"lg_black\", \"@media screen and (min-width: 960px)\")` → `widthInterval: { lo: 960, hi: Infinity }`. */\nexport function ruleSortKey(priority: number, className: string, atRulePrelude: string | undefined): RuleSortKey {\n const widthInterval = atRulePrelude === undefined ? null : parseWidthInterval(atRulePrelude);\n return { priority, className, widthInterval };\n}\n\n/**\n * Order rules by priority, then by query width interval, then by class name.\n *\n * Priority ties happen between rules in the same tier for the same property, i.e. two `@media`\n * rules for `color`. Those are ordered widest interval first, so the narrower query is emitted\n * later and wins in the cascade wherever both match. Equal widths go by lower bound ascending,\n * and queries with no readable interval (`print`, `not`, comma lists, non-px units) come last,\n * as they do in StyleX. For one-sided queries this is min-width ascending, then max-width descending.\n *\n * The class-name tiebreak keeps the output fully deterministic regardless of file processing\n * order, which differs between dev HMR and production builds.\n *\n * I.e. `(min-width: 600px)` → `(min-width: 960px)` → `(max-width: 1150px)` → `(max-width: 820px)`\n * → `(min-width: 600px) and (max-width: 959px)` → `print`.\n */\nexport function compareRuleSortKeys(a: RuleSortKey, b: RuleSortKey): number {\n return (\n a.priority - b.priority ||\n compareWidthIntervals(a.widthInterval, b.widthInterval) ||\n compareClassNames(a.className, b.className)\n );\n}\n\n/** Code-point order, so identical class sets sort identically in dev and production. */\nexport function compareClassNames(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** I.e. `\"@media (min-width: 600px) { .a.a { color: red; } }\"` → `\"@media (min-width: 600px)\"`, or undefined for a plain rule. */\nexport function atRulePrelude(cssText: string): string | undefined {\n if (!cssText.startsWith(\"@\")) return undefined;\n const brace = cssText.indexOf(\"{\");\n return brace === -1 ? undefined : cssText.slice(0, brace).trim();\n}\n\n/**\n * Parse the px width interval a `@media` or `@container` prelude matches.\n *\n * Only `and`-joined `(min-width: Npx)` / `(max-width: Npx)` terms are read. Other features such as\n * `(orientation: landscape)` and media types such as `screen` add no bound, and repeated terms\n * collapse to the effective bound. The result is exact for what it accepts, and null (\"no interval\")\n * for a prelude with no width term or with anything it cannot read exactly: comma lists, `not`,\n * `or`, range syntax, and non-px units.\n *\n * I.e. `\"@media screen and (min-width: 600px) and (max-width: 959px)\"` → `{ lo: 600, hi: 959 }`,\n * `\"@container grid (min-width: 601px)\"` → `{ lo: 601, hi: Infinity }`, `\"@media print\"` → null.\n */\nfunction parseWidthInterval(prelude: string): WidthInterval | null {\n if (/,|\\bnot\\b|\\bor\\b|[<>]/.test(prelude)) return null;\n const terms = Array.from(prelude.matchAll(/\\((min|max)-width:\\s*([^)]*)\\)/g));\n if (terms.length === 0) return null;\n let lo = 0;\n let hi = Infinity;\n for (const term of terms) {\n const px = parsePxLength(term[2]);\n if (px === null) return null;\n if (term[1] === \"min\") {\n lo = Math.max(lo, px);\n } else {\n hi = Math.min(hi, px);\n }\n }\n return { lo, hi };\n}\n\n/** I.e. `\"600px\"` → 600, `\"0\"` → 0, `\"40rem\"` → null. */\nfunction parsePxLength(value: string): number | null {\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?)(px)?$/);\n if (!match) return null;\n if (match[2] === undefined && Number(match[1]) !== 0) return null;\n return Number(match[1]);\n}\n\n/**\n * Widest interval first, equal widths by lower bound ascending, null last.\n *\n * I.e. `{ lo: 600, hi: Infinity }` (width Infinity) → `{ lo: 0, hi: 1150 }` (width 1150)\n * → `{ lo: 600, hi: 959 }` (width 359) → null.\n */\nfunction compareWidthIntervals(a: WidthInterval | null, b: WidthInterval | null): number {\n if (a === null || b === null) {\n return (a === null ? 1 : 0) - (b === null ? 1 : 0);\n }\n const widthA = a.hi - a.lo;\n const widthB = b.hi - b.lo;\n if (widthA !== widthB) return widthA > widthB ? -1 : 1;\n return a.lo - b.lo;\n}\n","import { compareClassNames, compareRuleSortKeys, ruleSortKey, type RuleSortKey } from \"./css-order\";\nimport type { TestCssPayload } from \"./test-css\";\n\ninterface InstalledRule {\n id: string;\n cssText: string;\n /** Prelude, atomic rules, property declarations, then arbitrary CSS. */\n section: 0 | 1 | 2 | 3;\n key: RuleSortKey | null;\n order: number;\n source: string;\n position: number;\n}\n\ninterface InjectionState {\n sheet: CSSStyleSheet;\n rules: InstalledRule[];\n byId: Map<string, InstalledRule>;\n}\n\ntype TrussStyleElement = HTMLStyleElement & { __trussCssState__?: InjectionState };\nlet trussStyleElement: TrussStyleElement | null = null;\n\n/**\n * Register structured module or library CSS in the document's ordered test stylesheet.\n *\n * Atomic rules are deduplicated by class and inserted with the production\n * comparator, regardless of module execution order. Library definitions take precedence\n * over application definitions of the same class. Arbitrary blocks stay after atomics,\n * in library order followed by canonical application source path order. The plugin supplies\n * rule identities, query metadata, spacing, and complete top-level arbitrary rules. The\n * runtime does not parse annotations, split CSS blocks, or serialize payloads for dedupe.\n *\n * Rules live until the document is discarded, not until a component unmounts. Repeated\n * imports reuse state on the style element. This is not HMR: within one source rank,\n * the first definition wins and omitted rules are not removed. Browser dev HMR replaces\n * its separate virtual stylesheet; useRuntimeStyle owns transient sheets after this one.\n *\n * Only new or replaced rules are parsed by CSSOM. I.e. a late priority-1000 shorthand\n * is inserted before an existing priority-4000 longhand without reparsing that longhand.\n */\nexport function __injectTrussCSS(payload: TestCssPayload): void {\n if (\n typeof document === \"undefined\" ||\n (!payload.rules?.length && !payload.properties?.length && !payload.arbitraryRules?.length && !payload.prelude)\n )\n return;\n if (payload.arbitraryRules?.length && !payload.source) {\n throw new Error(\"Truss arbitrary CSS requires a source identity.\");\n }\n const style = getOrCreateTrussStyleElement();\n const sheet = style.sheet;\n if (!sheet) throw new Error(\"Truss could not create its test stylesheet.\");\n // A removed and reattached style element has a new CSSOM sheet, even in the same document.\n if (style.__trussCssState__?.sheet !== sheet) {\n style.__trussCssState__ = { sheet, rules: [], byId: new Map() };\n }\n const state = style.__trussCssState__!;\n const base = {\n order: payload.order ?? 1,\n source: payload.source ?? \"\",\n position: 0,\n key: null,\n };\n let changed = false;\n try {\n if (payload.prelude) {\n changed = installRule(state, { ...base, id: \"prelude\", section: 0, cssText: payload.prelude }) || changed;\n }\n for (const rule of payload.rules ?? []) {\n changed =\n installRule(state, {\n ...base,\n id: `class:${rule.className}`,\n section: 1,\n cssText: rule.cssText,\n key: ruleSortKey(rule.priority, rule.className, rule.atRule),\n }) || changed;\n }\n for (const property of payload.properties ?? []) {\n changed =\n installRule(state, { ...base, id: `property:${property.varName}`, section: 2, cssText: property.cssText }) ||\n changed;\n }\n for (const [position, cssText] of (payload.arbitraryRules ?? []).entries()) {\n changed =\n installRule(state, {\n ...base,\n id: `arbitrary:${payload.source}:${position}`,\n section: 3,\n position,\n cssText,\n }) || changed;\n }\n } finally {\n // jsdom 29 does not invalidate computed styles after insertRule/deleteRule. An attribute\n // mutation clears that cache without replacing the sheet or reparsing its previous rules.\n if (changed) style.setAttribute(\"data-truss\", \"\");\n }\n}\n\n/**\n * Insert a unique rule at its production sort position and report whether the sheet changed.\n * Lower source ranks can replace existing definitions. Unsupported declarations are registered\n * for dedupe without taking a CSSOM index; invalid atomic rules still throw and can be retried.\n */\nfunction installRule(state: InjectionState, rule: InstalledRule): boolean {\n const previous = state.byId.get(rule.id);\n if (previous && previous.order <= rule.order) return false;\n let lo = 0;\n let hi = state.rules.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compareInstalledRules(state.rules[mid], rule) <= 0) lo = mid + 1;\n else hi = mid;\n }\n try {\n state.sheet.insertRule(rule.cssText, lo);\n } catch (error) {\n // jsdom silently skips unsupported property/arbitrary at-rules in style text, but insertRule throws.\n // Do not swallow errors for atomic rules or corrupt the installed-rule indexes.\n if (\n rule.section >= 2 &&\n typeof error === \"object\" &&\n error !== null &&\n \"name\" in error &&\n error.name === \"SyntaxError\"\n ) {\n // Do not replace an installed definition with one the browser cannot parse.\n if (!previous || !state.rules.includes(previous)) state.byId.set(rule.id, rule);\n return false;\n }\n throw error;\n }\n state.rules.splice(lo, 0, rule);\n state.byId.set(rule.id, rule);\n if (previous) {\n const oldIndex = state.rules.indexOf(previous);\n if (oldIndex !== -1) {\n state.sheet.deleteRule(oldIndex);\n state.rules.splice(oldIndex, 1);\n }\n }\n return true;\n}\n\n/** Use the production atomic comparator and preserve source order within opaque blocks. */\nfunction compareInstalledRules(a: InstalledRule, b: InstalledRule): number {\n if (a.section !== b.section) return a.section - b.section;\n if (a.key && b.key) return compareRuleSortKeys(a.key, b.key);\n return a.order - b.order || compareClassNames(a.source, b.source) || a.position - b.position;\n}\n\n/** Keep one static sheet before transient runtime styles, and recover after document replacement. */\nexport function getOrCreateTrussStyleElement(): TrussStyleElement {\n if (trussStyleElement?.ownerDocument === document && trussStyleElement.isConnected) return trussStyleElement;\n const style = document.querySelector<TrussStyleElement>(\"style[data-truss]\") ?? document.createElement(\"style\");\n if (!style.isConnected) {\n style.setAttribute(\"data-truss\", \"\");\n document.head.insertBefore(style, document.head.querySelector(\"style[data-truss-runtime-style]\"));\n }\n trussStyleElement = style;\n return style;\n}\n","/** Metadata key that carries a marker class through Truss style hashes. */\nexport const TRUSS_MARKER_KEY = \"__marker\";\n\n/** Prefix for style-hash entries that append raw class names at runtime. */\nexport const TRUSS_CUSTOM_CLASS_PREFIX = \"className_\";\n\n/** Prefix for style-hash entries that append raw inline styles at runtime. */\nexport const TRUSS_INLINE_STYLE_PREFIX = \"style_\";\n\n/** Generated Css expressions include this brand marker in runtime-only paths. */\nexport const TRUSS_CSS_MARKER_KEY = \"$css\";\n","/** Return the complementary query used by `Css.*.else` media branches. */\nexport function invertMediaQuery(query: string): string {\n const screenPrefix = \"@media screen and \";\n if (query.startsWith(screenPrefix)) {\n const conditions = query.slice(screenPrefix.length).trim();\n const rangeMatch = conditions.match(/^\\(min-width: (\\d+)px\\) and \\(max-width: (\\d+)px\\)$/);\n if (rangeMatch) {\n const min = Number(rangeMatch[1]);\n const max = Number(rangeMatch[2]);\n return `@media screen and (max-width: ${min - 1}px), screen and (min-width: ${max + 1}px)`;\n }\n const minMatch = conditions.match(/^\\(min-width: (\\d+)px\\)$/);\n if (minMatch) {\n return `@media screen and (max-width: ${Number(minMatch[1]) - 1}px)`;\n }\n const maxMatch = conditions.match(/^\\(max-width: (\\d+)px\\)$/);\n if (maxMatch) {\n return `@media screen and (min-width: ${Number(maxMatch[1]) + 1}px)`;\n }\n }\n return query.replace(\"@media\", \"@media not\");\n}\n","/**\n * Utilities for CSS custom properties (`--token`) in Truss style values.\n */\n\n/**\n * If `value` is a custom property name (`--token`), wrap as `var(--token)` for use as a property value.\n * Passes through values that are not custom-property names (including existing `var(...)`).\n */\nexport function maybeCssVar<T>(value: T): T {\n if (typeof value !== \"string\") return value;\n if (value.startsWith(\"--\")) return `var(${value})` as T;\n return value;\n}\n\n/** True when a runtime variable tuple value may be a `--token` name (not a Px `` `${n}px` `` path). */\nexport function variableValueNeedsMaybeCssVar(opts: { appendPx?: boolean }): boolean {\n return !opts.appendPx;\n}\n\n/** True when a resolved argument value is a CSS custom property name (`--token`). */\nexport function isCustomPropertyName(value: string): boolean {\n return value.startsWith(\"--\");\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;;;ACkB5B,SAAS,YAAY,UAAkB,WAAmB,eAAgD;AAC/G,QAAM,gBAAgB,kBAAkB,SAAY,OAAO,mBAAmB,aAAa;AAC3F,SAAO,EAAE,UAAU,WAAW,cAAc;AAC9C;AAiBO,SAAS,oBAAoB,GAAgB,GAAwB;AAC1E,SACE,EAAE,WAAW,EAAE,YACf,sBAAsB,EAAE,eAAe,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AGA,SAAS,wCAAiD;AACxD,MAAI,OAAO,YAAY,eAAe,OAAO,QAAQ,IAAI,aAAa,UAAU;AAC9E,WAAO,QAAQ,IAAI,aAAa;AAAA,EAClC;AACA,QAAM,UAAW,YAAyE;AAC1F,MAAI,OAAO,SAAS,QAAQ,UAAW,QAAO,QAAQ;AACtD,MAAI,OAAO,SAAS,SAAS,UAAW,QAAO,CAAC,QAAQ;AACxD,SAAO;AACT;AAGA,SAAS,qCAA8C;AACrD,MAAI,OAAO,YAAY,eAAe,OAAO,QAAQ,IAAI,WAAW,UAAU;AAC5E,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/runtime.ts","../src/css-order.ts","../src/runtime-css.ts","../src/style-metadata.ts","../src/media-query.ts","../src/css-custom-property.ts"],"sourcesContent":["import { useInsertionEffect } from \"react\";\nimport { getOrCreateTrussStyleElement } from \"./runtime-css\";\nimport {\n TRUSS_CSS_MARKER_KEY,\n TRUSS_CUSTOM_CLASS_PREFIX,\n TRUSS_INLINE_STYLE_PREFIX,\n TRUSS_MARKER_KEY,\n} from \"./style-metadata\";\n\nexport { invertMediaQuery as __invertTrussMediaQuery } from \"./media-query\";\nexport { maybeCssVar } from \"./css-custom-property\";\nexport { __injectTrussCSS } from \"./runtime-css\";\nexport type { TestCssPayload, TestCssRule } from \"./test-css\";\n\n/** A compact source label for a Truss CSS expression, used in debug mode. */\nexport class TrussDebugInfo {\n /** I.e. `\"FileName.tsx:line\"` */\n readonly src: string;\n\n constructor(src: string) {\n this.src = src;\n }\n}\n\n/**\n * Space-separated atomic class names, or a variable tuple with class names + CSS variable map.\n *\n * In debug mode, the transform appends a TrussDebugInfo as an extra tuple element:\n * - static with debug: `[classNames, debugInfo]`\n * - variable with debug: `[classNames, vars, debugInfo]`\n */\nexport type TrussStyleValue =\n | string\n | [classNames: string, vars: Record<string, string>]\n | [classNames: string, debugInfo: TrussDebugInfo]\n | [classNames: string, vars: Record<string, string>, debugInfo: TrussDebugInfo];\n\n/** A property-keyed style hash where each key owns one logical CSS property. */\nexport type TrussCustomClassNameValue = string | ReadonlyArray<string | false | null | undefined>;\nexport type RuntimeStyleDeclarationValue = string | number | null | undefined;\nexport type TrussInlineStyleValue = Record<string, RuntimeStyleDeclarationValue> | false | null | undefined;\nexport type TrussStyleHash = Record<string, TrussStyleValue | TrussCustomClassNameValue | TrussInlineStyleValue>;\nexport type RuntimeStyleDeclarations = Record<string, RuntimeStyleDeclarationValue | Record<string, unknown>>;\nexport type RuntimeStyleCss = Record<string, RuntimeStyleDeclarations | string>;\n\nconst shouldValidateTrussStyleValues = resolveShouldValidateTrussStyleValues();\nconst shouldEmitTrussSrcAttribute = resolveShouldEmitTrussSrcAttribute();\n\n/** Merge one or more Truss style hashes into `{ className, style?, data-truss-src? }`. */\nexport function trussProps(\n ...hashes: ReadonlyArray<TrussStyleHash | false | null | undefined>\n): Record<string, unknown> {\n const merged: Record<string, unknown> = {};\n\n for (const hash of hashes) {\n if (!hash || typeof hash !== \"object\") continue;\n Object.assign(merged, hash);\n }\n\n const classNames: string[] = [];\n const inlineStyle: Record<string, unknown> = {};\n const debugSources: string[] = [];\n\n for (const [key, value] of Object.entries(merged)) {\n // $css is the Css expression marker — skip it\n if (key === TRUSS_CSS_MARKER_KEY) continue;\n\n // __marker is a special key — its value is a marker class name, not a CSS property\n if (key === TRUSS_MARKER_KEY) {\n if (typeof value === \"string\") {\n classNames.push(value);\n }\n continue;\n }\n\n if (key.startsWith(TRUSS_CUSTOM_CLASS_PREFIX)) {\n // I.e. plugin-emitted raw class names that should flow straight into the final prop.\n appendCustomClassNames(classNames, value);\n continue;\n }\n\n if (key.startsWith(TRUSS_INLINE_STYLE_PREFIX)) {\n appendInlineStyles(inlineStyle, value);\n continue;\n }\n\n if (shouldValidateTrussStyleValues) assertValidTrussStyleValue(key, value);\n const trussValue = value as TrussStyleValue;\n\n if (typeof trussValue === \"string\") {\n // I.e. \"df\" or \"black blue_h\"\n classNames.push(trussValue);\n continue;\n }\n\n // Tuple: [classNames, varsOrDebug?, maybeDebug?]\n classNames.push(trussValue[0]);\n\n for (let i = 1; i < trussValue.length; i++) {\n const el = trussValue[i];\n if (el instanceof TrussDebugInfo) {\n debugSources.push(el.src);\n } else if (typeof el === \"object\" && el !== null) {\n Object.assign(inlineStyle, el);\n }\n }\n }\n\n const props: Record<string, unknown> = {\n className: classNames.join(\" \"),\n };\n\n if (Object.keys(inlineStyle).length > 0) {\n props.style = inlineStyle;\n }\n\n if (shouldEmitTrussSrcAttribute && debugSources.length > 0) {\n props[\"data-truss-src\"] = [...new Set(debugSources)].join(\"; \");\n }\n\n return props;\n}\n\nfunction appendCustomClassNames(classNames: string[], value: unknown): void {\n if (typeof value === \"string\") {\n // I.e. `className_button: \"button\"`\n classNames.push(value);\n return;\n }\n\n if (!Array.isArray(value)) return;\n for (const entry of value) {\n if (typeof entry === \"string\") {\n // I.e. `className_button: [\"button\", cond && \"selected\"]`\n classNames.push(entry);\n }\n }\n}\n\nfunction appendInlineStyles(inlineStyle: Record<string, unknown>, value: unknown): void {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return;\n }\n\n for (const [key, entry] of Object.entries(value)) {\n if (entry === undefined || entry === null) {\n continue;\n }\n if (typeof entry === \"string\" || typeof entry === \"number\") {\n inlineStyle[key] = entry;\n }\n }\n}\n\n/** Merge explicit className/style with Truss style hashes. */\nexport function mergeProps(\n explicitClassName: string | undefined,\n explicitStyle: Record<string, unknown> | undefined,\n ...hashes: ReadonlyArray<TrussStyleHash | false | null | undefined>\n): Record<string, unknown> {\n const result = trussProps(...hashes);\n\n if (explicitClassName) {\n result.className = `${explicitClassName} ${result.className ?? \"\"}`.trim();\n }\n\n if (explicitStyle) {\n result.style = { ...explicitStyle, ...(result.style as Record<string, unknown> | undefined) };\n }\n\n return result;\n}\n\nexport interface RuntimeStyleProps {\n css: RuntimeStyleCss;\n}\n\n/**\n * Inject dynamic or selector-based CSS at runtime into a transient `<style>` tag.\n *\n * This is the runtime counterpart to `.css.ts` files:\n * - use `.css.ts` for static/global arbitrary selectors that should be baked into the build output\n * - use `RuntimeStyle` for selectors that depend on runtime values or should only exist while a component is mounted\n *\n * Example with a flat `Css` expression:\n * ```tsx\n * <RuntimeStyle\n * css={{\n * \".preview a\": Css.blue.$,\n * }}\n * />\n * ```\n *\n * Example with raw CSS via `Css.raw`:\n * ```tsx\n * <RuntimeStyle\n * css={{\n * \".preview code\": Css.raw`\n * font-variant-ligatures: none;\n * text-decoration: underline;\n * `,\n * }}\n * />\n * ```\n *\n * The injected `<style>` element is appended on mount and removed on unmount.\n *\n * Note: Only flat `Css.*.$` expressions are supported here; selector/marker helpers like\n * `onHover`, `when`, `ifSm`, `ifContainer`, `element`, `className()`, and `style()` are rejected\n * at runtime.\n */\nexport function RuntimeStyle(props: RuntimeStyleProps): null {\n useRuntimeStyle(props.css);\n return null;\n}\n\n/**\n * Hook that injects dynamic or selector-based CSS at runtime into a transient `<style>` tag.\n *\n * This is the hook counterpart to the `RuntimeStyle` component and `.css.ts` files:\n * - use `.css.ts` for static/global arbitrary selectors baked into the build output\n * - use `useRuntimeStyle` when you need the same thing from a hook instead of a component\n *\n * Example with a flat `Css` expression:\n * ```ts\n * useRuntimeStyle({ \"body\": Css.mbPx(dynamicValue).$ });\n * ```\n *\n * Example with raw CSS via `Css.raw`:\n * ```ts\n * useRuntimeStyle({ \".preview code\": Css.raw`font-variant-ligatures: none;` });\n * ```\n *\n * The injected `<style>` element is appended on mount and removed on unmount.\n *\n * Note: Only flat `Css.*.$` expressions are supported here; selector/marker helpers like\n * `onHover`, `when`, `ifSm`, `ifContainer`, `element`, `className()`, and `style()` are rejected\n * at runtime.\n */\nexport function useRuntimeStyle(css: RuntimeStyleCss): void {\n const cssText = buildRuntimeStyleCssText(css);\n useInsertionEffect(() => {\n if (typeof document === \"undefined\" || cssText.length === 0) return;\n // Reserve the static sheet before transient styles, even when no module CSS has loaded yet.\n //\n // This call is not redundant with getOrCreateTrussStyleElement inserting the static sheet\n // before the first runtime style. jsdom cascades document.styleSheets in attach order, not\n // DOM order. Without this reservation, a static sheet created after this runtime style\n // mounts lands before it in <head> but after it in document.styleSheets, so the static\n // rule wins the cascade. I.e. a runtime `.x { color: green }` mounted first loses to a\n // later injected static `.x { color: red }`.\n getOrCreateTrussStyleElement();\n const style = document.createElement(\"style\");\n style.setAttribute(\"data-truss-runtime-style\", \"\");\n style.textContent = cssText;\n document.head.appendChild(style);\n return () => style.remove();\n }, [cssText]);\n}\n\n/** Serialize RuntimeStyle rules into CSS text for a transient `<style>` tag. */\nfunction buildRuntimeStyleCssText(css: RuntimeStyleCss): string {\n const rules: string[] = [];\n for (const [selector, value] of Object.entries(css)) {\n if (typeof value === \"string\") {\n rules.push(formatRawRuntimeStyleRule(selector, value));\n } else {\n rules.push(formatRuntimeStyleRule(selector, value));\n }\n }\n return rules.join(\"\\n\\n\");\n}\n\nfunction formatRawRuntimeStyleRule(selector: string, raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return `${selector} {}`;\n const body = trimmed\n .split(\"\\n\")\n .map((line) => ` ${line.trim()}`)\n .filter((line) => line.trim().length > 0)\n .join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n\nfunction formatRuntimeStyleRule(selector: string, declarations: RuntimeStyleDeclarations): string {\n const lines: string[] = [];\n for (const [property, value] of Object.entries(declarations)) {\n if (property === TRUSS_CSS_MARKER_KEY) continue;\n if (value === undefined || value === null) continue;\n if (typeof value !== \"string\" && typeof value !== \"number\") {\n throw new Error(runtimeStyleUnsupportedValueMessage(selector, property));\n }\n lines.push(` ${camelToKebabRuntime(property)}: ${String(value)};`);\n }\n if (lines.length === 0) return `${selector} {}`;\n return `${selector} {\\n${lines.join(\"\\n\")}\\n}`;\n}\n\nfunction runtimeStyleUnsupportedValueMessage(selector: string, property: string): string {\n return `RuntimeStyle selector \\`${selector}\\` has an unsupported nested value for \\`${property}\\`. Only flat Css expressions can be used here; selector/marker/className helpers like onHover, when, ifSm, ifContainer, element, className(), and style() are not supported.`;\n}\n\nfunction camelToKebabRuntime(property: string): string {\n return property\n .replace(/^(Webkit|Moz|Ms|O)/, function prefixToCss(prefix) {\n return `-${prefix.toLowerCase()}`;\n })\n .replace(/[A-Z]/g, function upperToCss(letter) {\n return `-${letter.toLowerCase()}`;\n });\n}\n\n/** Fail fast when `trussProps` receives a non-Truss style value. */\nfunction assertValidTrussStyleValue(key: string, value: unknown): asserts value is TrussStyleValue {\n if (typeof value === \"string\") return;\n if (Array.isArray(value) && typeof value[0] === \"string\") {\n for (let i = 1; i < value.length; i++) {\n const el = value[i];\n if (el instanceof TrussDebugInfo) continue;\n if (typeof el === \"object\" && el !== null && !Array.isArray(el)) continue;\n throw new TypeError(invalidTrussStyleValueMessage(key));\n }\n return;\n }\n throw new TypeError(invalidTrussStyleValueMessage(key));\n}\n\nfunction invalidTrussStyleValueMessage(key: string): string {\n return `Invalid Truss style value for \\`${key}\\`. trussProps only accepts generated Truss style hashes; use mergeProps for explicit className/style merging.`;\n}\n\n/** Enable validation in dev/test environments, but skip it in production. */\nfunction resolveShouldValidateTrussStyleValues(): boolean {\n if (typeof process !== \"undefined\" && typeof process.env.NODE_ENV === \"string\") {\n return process.env.NODE_ENV !== \"production\";\n }\n const viteEnv = (import.meta as ImportMeta & { env?: { DEV?: boolean; PROD?: boolean } }).env;\n if (typeof viteEnv?.DEV === \"boolean\") return viteEnv.DEV;\n if (typeof viteEnv?.PROD === \"boolean\") return !viteEnv.PROD;\n return false;\n}\n\n/** Omit unstable source labels from rendered props during Vitest runs. */\nfunction resolveShouldEmitTrussSrcAttribute(): boolean {\n if (typeof process !== \"undefined\" && typeof process.env.VITEST === \"string\") {\n return false;\n }\n return true;\n}\n","/**\n * The sort key shared by `emit-css`, `merge-css`, and `runtime-css`, so a stylesheet merged from\n * library CSS or assembled rule by rule in jsdom keeps the same rule order as the per-file output.\n */\nexport interface RuleSortKey {\n priority: number;\n className: string;\n /** The px widths the rule's media or container query matches, or null when it has no readable interval. */\n widthInterval: WidthInterval | null;\n}\n\n/** The inclusive px widths a query matches; `hi` is Infinity for a min-width-only query. */\nexport interface WidthInterval {\n lo: number;\n hi: number;\n}\n\n/** I.e. `ruleSortKey(3200, \"lg_black\", \"@media screen and (min-width: 960px)\")` → `widthInterval: { lo: 960, hi: Infinity }`. */\nexport function ruleSortKey(priority: number, className: string, atRulePrelude: string | undefined): RuleSortKey {\n const widthInterval = atRulePrelude === undefined ? null : parseWidthInterval(atRulePrelude);\n return { priority, className, widthInterval };\n}\n\n/**\n * Order rules by priority, then by query width interval, then by class name.\n *\n * Priority ties happen between rules in the same tier for the same property, i.e. two `@media`\n * rules for `color`. Those are ordered widest interval first, so the narrower query is emitted\n * later and wins in the cascade wherever both match. Equal widths go by lower bound ascending,\n * and queries with no readable interval (`print`, `not`, comma lists, non-px units) come last,\n * as they do in StyleX. For one-sided queries this is min-width ascending, then max-width descending.\n *\n * The class-name tiebreak keeps the output fully deterministic regardless of file processing\n * order, which differs between dev HMR and production builds.\n *\n * I.e. `(min-width: 600px)` → `(min-width: 960px)` → `(max-width: 1150px)` → `(max-width: 820px)`\n * → `(min-width: 600px) and (max-width: 959px)` → `print`.\n */\nexport function compareRuleSortKeys(a: RuleSortKey, b: RuleSortKey): number {\n return (\n a.priority - b.priority ||\n compareWidthIntervals(a.widthInterval, b.widthInterval) ||\n compareClassNames(a.className, b.className)\n );\n}\n\n/** Code-point order, so identical class sets sort identically in dev and production. */\nexport function compareClassNames(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** I.e. `\"@media (min-width: 600px) { .a.a { color: red; } }\"` → `\"@media (min-width: 600px)\"`, or undefined for a plain rule. */\nexport function atRulePrelude(cssText: string): string | undefined {\n if (!cssText.startsWith(\"@\")) return undefined;\n const brace = cssText.indexOf(\"{\");\n return brace === -1 ? undefined : cssText.slice(0, brace).trim();\n}\n\n/**\n * Parse the px width interval a `@media` or `@container` prelude matches.\n *\n * Only `and`-joined `(min-width: Npx)` / `(max-width: Npx)` terms are read. Other features such as\n * `(orientation: landscape)` and media types such as `screen` add no bound, and repeated terms\n * collapse to the effective bound. The result is exact for what it accepts, and null (\"no interval\")\n * for a prelude with no width term or with anything it cannot read exactly: comma lists, `not`,\n * `or`, range syntax, and non-px units.\n *\n * I.e. `\"@media screen and (min-width: 600px) and (max-width: 959px)\"` → `{ lo: 600, hi: 959 }`,\n * `\"@container grid (min-width: 601px)\"` → `{ lo: 601, hi: Infinity }`, `\"@media print\"` → null.\n */\nfunction parseWidthInterval(prelude: string): WidthInterval | null {\n if (/,|\\bnot\\b|\\bor\\b|[<>]/.test(prelude)) return null;\n const terms = Array.from(prelude.matchAll(/\\((min|max)-width:\\s*([^)]*)\\)/g));\n if (terms.length === 0) return null;\n let lo = 0;\n let hi = Infinity;\n for (const term of terms) {\n const px = parsePxLength(term[2]);\n if (px === null) return null;\n if (term[1] === \"min\") {\n lo = Math.max(lo, px);\n } else {\n hi = Math.min(hi, px);\n }\n }\n return { lo, hi };\n}\n\n/** I.e. `\"600px\"` → 600, `\"0\"` → 0, `\"40rem\"` → null. */\nfunction parsePxLength(value: string): number | null {\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?)(px)?$/);\n if (!match) return null;\n if (match[2] === undefined && Number(match[1]) !== 0) return null;\n return Number(match[1]);\n}\n\n/**\n * Widest interval first, equal widths by lower bound ascending, null last.\n *\n * I.e. `{ lo: 600, hi: Infinity }` (width Infinity) → `{ lo: 0, hi: 1150 }` (width 1150)\n * → `{ lo: 600, hi: 959 }` (width 359) → null.\n */\nfunction compareWidthIntervals(a: WidthInterval | null, b: WidthInterval | null): number {\n if (a === null || b === null) {\n return (a === null ? 1 : 0) - (b === null ? 1 : 0);\n }\n const widthA = a.hi - a.lo;\n const widthB = b.hi - b.lo;\n if (widthA !== widthB) return widthA > widthB ? -1 : 1;\n return a.lo - b.lo;\n}\n","import { compareClassNames, compareRuleSortKeys, ruleSortKey, type RuleSortKey } from \"./css-order\";\nimport type { TestCssPayload } from \"./test-css\";\n\ninterface InstalledRule {\n id: string;\n cssText: string;\n /** Prelude, atomic rules, at-rule definitions (@property / @keyframes), then arbitrary CSS. */\n section: 0 | 1 | 2 | 3;\n key: RuleSortKey | null;\n order: number;\n source: string;\n position: number;\n}\n\ninterface InjectionState {\n sheet: CSSStyleSheet;\n rules: InstalledRule[];\n byId: Map<string, InstalledRule>;\n}\n\ntype TrussStyleElement = HTMLStyleElement & { __trussCssState__?: InjectionState };\nlet trussStyleElement: TrussStyleElement | null = null;\n\n/**\n * Register structured module or library CSS in the document's ordered test stylesheet.\n *\n * Atomic rules are deduplicated by class and inserted with the production\n * comparator, regardless of module execution order. Library definitions take precedence\n * over application definitions of the same class. Arbitrary blocks stay after atomics,\n * in library order followed by canonical application source path order. The plugin supplies\n * rule identities, query metadata, spacing, and complete top-level arbitrary rules. The\n * runtime does not parse annotations, split CSS blocks, or serialize payloads for dedupe.\n *\n * Rules live until the document is discarded, not until a component unmounts. Repeated\n * imports reuse state on the style element. This is not HMR: within one source rank,\n * the first definition wins and omitted rules are not removed. Browser dev HMR replaces\n * its separate virtual stylesheet; useRuntimeStyle owns transient sheets after this one.\n *\n * Only new or replaced rules are parsed by CSSOM. I.e. a late priority-1000 shorthand\n * is inserted before an existing priority-4000 longhand without reparsing that longhand.\n */\nexport function __injectTrussCSS(payload: TestCssPayload): void {\n if (\n typeof document === \"undefined\" ||\n (!payload.rules?.length &&\n !payload.properties?.length &&\n !payload.keyframes?.length &&\n !payload.arbitraryRules?.length &&\n !payload.prelude)\n )\n return;\n if (payload.arbitraryRules?.length && !payload.source) {\n throw new Error(\"Truss arbitrary CSS requires a source identity.\");\n }\n const style = getOrCreateTrussStyleElement();\n const sheet = style.sheet;\n if (!sheet) throw new Error(\"Truss could not create its test stylesheet.\");\n // A removed and reattached style element has a new CSSOM sheet, even in the same document.\n if (style.__trussCssState__?.sheet !== sheet) {\n style.__trussCssState__ = { sheet, rules: [], byId: new Map() };\n }\n const state = style.__trussCssState__!;\n const base = {\n order: payload.order ?? 1,\n source: payload.source ?? \"\",\n position: 0,\n key: null,\n };\n let changed = false;\n try {\n if (payload.prelude) {\n changed = installRule(state, { ...base, id: \"prelude\", section: 0, cssText: payload.prelude }) || changed;\n }\n for (const rule of payload.rules ?? []) {\n changed =\n installRule(state, {\n ...base,\n id: `class:${rule.className}`,\n section: 1,\n cssText: rule.cssText,\n key: ruleSortKey(rule.priority, rule.className, rule.atRule),\n }) || changed;\n }\n for (const property of payload.properties ?? []) {\n changed =\n installRule(state, { ...base, id: `property:${property.varName}`, section: 2, cssText: property.cssText }) ||\n changed;\n }\n for (const block of payload.keyframes ?? []) {\n changed =\n installRule(state, { ...base, id: `keyframes:${block.name}`, section: 2, cssText: block.cssText }) || changed;\n }\n for (const [position, cssText] of (payload.arbitraryRules ?? []).entries()) {\n changed =\n installRule(state, {\n ...base,\n id: `arbitrary:${payload.source}:${position}`,\n section: 3,\n position,\n cssText,\n }) || changed;\n }\n } finally {\n // jsdom 29 does not invalidate computed styles after insertRule/deleteRule. An attribute\n // mutation clears that cache without replacing the sheet or reparsing its previous rules.\n if (changed) style.setAttribute(\"data-truss\", \"\");\n }\n}\n\n/**\n * Insert a unique rule at its production sort position and report whether the sheet changed.\n * Lower source ranks can replace existing definitions. Unsupported declarations are registered\n * for dedupe without taking a CSSOM index; invalid atomic rules still throw and can be retried.\n */\nfunction installRule(state: InjectionState, rule: InstalledRule): boolean {\n const previous = state.byId.get(rule.id);\n if (previous && previous.order <= rule.order) return false;\n let lo = 0;\n let hi = state.rules.length;\n while (lo < hi) {\n const mid = (lo + hi) >>> 1;\n if (compareInstalledRules(state.rules[mid], rule) <= 0) lo = mid + 1;\n else hi = mid;\n }\n try {\n state.sheet.insertRule(rule.cssText, lo);\n } catch (error) {\n // jsdom silently skips unsupported property/arbitrary at-rules in style text, but insertRule throws.\n // Do not swallow errors for atomic rules or corrupt the installed-rule indexes.\n if (\n rule.section >= 2 &&\n typeof error === \"object\" &&\n error !== null &&\n \"name\" in error &&\n error.name === \"SyntaxError\"\n ) {\n // Do not replace an installed definition with one the browser cannot parse.\n if (!previous || !state.rules.includes(previous)) state.byId.set(rule.id, rule);\n return false;\n }\n throw error;\n }\n state.rules.splice(lo, 0, rule);\n state.byId.set(rule.id, rule);\n if (previous) {\n const oldIndex = state.rules.indexOf(previous);\n if (oldIndex !== -1) {\n state.sheet.deleteRule(oldIndex);\n state.rules.splice(oldIndex, 1);\n }\n }\n return true;\n}\n\n/** Use the production atomic comparator and preserve source order within opaque blocks. */\nfunction compareInstalledRules(a: InstalledRule, b: InstalledRule): number {\n if (a.section !== b.section) return a.section - b.section;\n if (a.key && b.key) return compareRuleSortKeys(a.key, b.key);\n return a.order - b.order || compareClassNames(a.source, b.source) || a.position - b.position;\n}\n\n/** Keep one static sheet before transient runtime styles, and recover after document replacement. */\nexport function getOrCreateTrussStyleElement(): TrussStyleElement {\n if (trussStyleElement?.ownerDocument === document && trussStyleElement.isConnected) return trussStyleElement;\n const style = document.querySelector<TrussStyleElement>(\"style[data-truss]\") ?? document.createElement(\"style\");\n if (!style.isConnected) {\n style.setAttribute(\"data-truss\", \"\");\n document.head.insertBefore(style, document.head.querySelector(\"style[data-truss-runtime-style]\"));\n }\n trussStyleElement = style;\n return style;\n}\n","/** Metadata key that carries a marker class through Truss style hashes. */\nexport const TRUSS_MARKER_KEY = \"__marker\";\n\n/** Prefix for style-hash entries that append raw class names at runtime. */\nexport const TRUSS_CUSTOM_CLASS_PREFIX = \"className_\";\n\n/** Prefix for style-hash entries that append raw inline styles at runtime. */\nexport const TRUSS_INLINE_STYLE_PREFIX = \"style_\";\n\n/** Generated Css expressions include this brand marker in runtime-only paths. */\nexport const TRUSS_CSS_MARKER_KEY = \"$css\";\n","/** Return the complementary query used by `Css.*.else` media branches. */\nexport function invertMediaQuery(query: string): string {\n const screenPrefix = \"@media screen and \";\n if (query.startsWith(screenPrefix)) {\n const conditions = query.slice(screenPrefix.length).trim();\n const rangeMatch = conditions.match(/^\\(min-width: (\\d+)px\\) and \\(max-width: (\\d+)px\\)$/);\n if (rangeMatch) {\n const min = Number(rangeMatch[1]);\n const max = Number(rangeMatch[2]);\n return `@media screen and (max-width: ${min - 1}px), screen and (min-width: ${max + 1}px)`;\n }\n const minMatch = conditions.match(/^\\(min-width: (\\d+)px\\)$/);\n if (minMatch) {\n return `@media screen and (max-width: ${Number(minMatch[1]) - 1}px)`;\n }\n const maxMatch = conditions.match(/^\\(max-width: (\\d+)px\\)$/);\n if (maxMatch) {\n return `@media screen and (min-width: ${Number(maxMatch[1]) + 1}px)`;\n }\n }\n return query.replace(\"@media\", \"@media not\");\n}\n","/**\n * Utilities for CSS custom properties (`--token`) in Truss style values.\n */\n\n/**\n * If `value` is a custom property name (`--token`), wrap as `var(--token)` for use as a property value.\n * Passes through values that are not custom-property names (including existing `var(...)`).\n */\nexport function maybeCssVar<T>(value: T): T {\n if (typeof value !== \"string\") return value;\n if (value.startsWith(\"--\")) return `var(${value})` as T;\n return value;\n}\n\n/** True when a runtime variable tuple value may be a `--token` name (not a Px `` `${n}px` `` path). */\nexport function variableValueNeedsMaybeCssVar(opts: { appendPx?: boolean }): boolean {\n return !opts.appendPx;\n}\n\n/** True when a resolved argument value is a CSS custom property name (`--token`). */\nexport function isCustomPropertyName(value: string): boolean {\n return value.startsWith(\"--\");\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;;;ACkB5B,SAAS,YAAY,UAAkB,WAAmB,eAAgD;AAC/G,QAAM,gBAAgB,kBAAkB,SAAY,OAAO,mBAAmB,aAAa;AAC3F,SAAO,EAAE,UAAU,WAAW,cAAc;AAC9C;AAiBO,SAAS,oBAAoB,GAAgB,GAAwB;AAC1E,SACE,EAAE,WAAW,EAAE,YACf,sBAAsB,EAAE,eAAe,EAAE,aAAa,KACtD,kBAAkB,EAAE,WAAW,EAAE,SAAS;AAE9C;AAGO,SAAS,kBAAkB,GAAW,GAAmB;AAC9D,SAAO,IAAI,IAAI,KAAK,IA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;AACxD;AAEA,SAAS,8BAA8B,KAAqB;AAC1D,SAAO,mCAAmC,GAAG;AAC/C;AAGA,SAAS,wCAAiD;AACxD,MAAI,OAAO,YAAY,eAAe,OAAO,QAAQ,IAAI,aAAa,UAAU;AAC9E,WAAO,QAAQ,IAAI,aAAa;AAAA,EAClC;AACA,QAAM,UAAW,YAAyE;AAC1F,MAAI,OAAO,SAAS,QAAQ,UAAW,QAAO,QAAQ;AACtD,MAAI,OAAO,SAAS,SAAS,UAAW,QAAO,CAAC,QAAQ;AACxD,SAAO;AACT;AAGA,SAAS,qCAA8C;AACrD,MAAI,OAAO,YAAY,eAAe,OAAO,QAAQ,IAAI,WAAW,UAAU;AAC5E,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/breakpoints.test.ts","./src/breakpoints.ts","./src/config.ts","./src/css-custom-property.test.ts","./src/css-custom-property.ts","./src/css-order.ts","./src/generate.test.ts","./src/generate.ts","./src/index.ts","./src/media-query.ts","./src/methods.test.ts","./src/methods.ts","./src/pseudo-selectors.ts","./src/runtime-css.ts","./src/runtime.test.ts","./src/runtime.ts","./src/spacing-css-var.test.ts","./src/spacing-css-var.ts","./src/style-metadata.ts","./src/test-css.ts","./src/testUtils.ts","./src/toHaveStyle.test.ts","./src/toHaveStyle.ts","./src/truss-css.ts","./src/utils.ts","./src/vitest.ts","./src/plugin/ast-utils.ts","./src/plugin/babel-utils.ts","./src/plugin/chain-nodes.ts","./src/plugin/condition-context.ts","./src/plugin/container-query.ts","./src/plugin/css-property-abbreviations.ts","./src/plugin/css-ts-utils.ts","./src/plugin/diagnostic.ts","./src/plugin/emit-css.test.ts","./src/plugin/emit-css.ts","./src/plugin/emit-style-hash.ts","./src/plugin/esbuild-plugin.test.ts","./src/plugin/esbuild-plugin.ts","./src/plugin/index.test.ts","./src/plugin/index.ts","./src/plugin/mapping-utils.ts","./src/plugin/merge-css.test.ts","./src/plugin/merge-css.ts","./src/plugin/priority.ts","./src/plugin/property-priorities.ts","./src/plugin/resolve-calls.ts","./src/plugin/resolve-chain.ts","./src/plugin/resolve-entry.ts","./src/plugin/resolve-literals.ts","./src/plugin/resolve-setvar.ts","./src/plugin/resolve-typography.ts","./src/plugin/resolve-when.ts","./src/plugin/rewrite-css-ts-imports.ts","./src/plugin/rewrite-sites.ts","./src/plugin/style-entries.ts","./src/plugin/test-css.test.ts","./src/plugin/test-css.ts","./src/plugin/transform-css.test.ts","./src/plugin/transform-css.ts","./src/plugin/transform-session.ts","./src/plugin/transform.test.ts","./src/plugin/transform.ts","./src/plugin/truss-css.test.ts","./src/plugin/truss-css.ts","./src/plugin/types.ts","./src/plugin/unknown-abbreviation.ts","./src/plugin/when-relationships.ts","./src/sections/tachyons/animation.ts","./src/sections/tachyons/border.ts","./src/sections/tachyons/borderColors.ts","./src/sections/tachyons/borderRadius.ts","./src/sections/tachyons/borderStyles.ts","./src/sections/tachyons/borderWidths.ts","./src/sections/tachyons/boxShadow.ts","./src/sections/tachyons/container.ts","./src/sections/tachyons/coordinates.ts","./src/sections/tachyons/cursor.ts","./src/sections/tachyons/display.ts","./src/sections/tachyons/flexbox.ts","./src/sections/tachyons/floats.ts","./src/sections/tachyons/fontStyle.ts","./src/sections/tachyons/fontWeight.ts","./src/sections/tachyons/grid.ts","./src/sections/tachyons/heights.ts","./src/sections/tachyons/index.ts","./src/sections/tachyons/lineClamp.ts","./src/sections/tachyons/objectFit.ts","./src/sections/tachyons/opacity.ts","./src/sections/tachyons/outlines.ts","./src/sections/tachyons/overflow.ts","./src/sections/tachyons/position.ts","./src/sections/tachyons/scrollSnap.ts","./src/sections/tachyons/scrollbarWidth.ts","./src/sections/tachyons/skins.ts","./src/sections/tachyons/spacing.ts","./src/sections/tachyons/textAlign.ts","./src/sections/tachyons/textDecoration.ts","./src/sections/tachyons/textTransform.ts","./src/sections/tachyons/transform.ts","./src/sections/tachyons/transition.ts","./src/sections/tachyons/typeScale.ts","./src/sections/tachyons/typography.ts","./src/sections/tachyons/userSelect.ts","./src/sections/tachyons/verticalAlign.ts","./src/sections/tachyons/visibility.ts","./src/sections/tachyons/whitespace.ts","./src/sections/tachyons/widths.ts","./src/sections/tachyons/wordBreak.ts","./src/sections/tachyons/zIndex.ts","./src/sections/tachyons-rn/index.ts","./src/sections/tachyons-rn/spacing.ts"],"version":"6.0.3"}
|
|
1
|
+
{"root":["./src/at-rules.ts","./src/breakpoints.test.ts","./src/breakpoints.ts","./src/config.ts","./src/css-custom-property.test.ts","./src/css-custom-property.ts","./src/css-order.ts","./src/generate.test.ts","./src/generate.ts","./src/index.ts","./src/media-query.ts","./src/methods.test.ts","./src/methods.ts","./src/pseudo-selectors.ts","./src/runtime-css.ts","./src/runtime.test.ts","./src/runtime.ts","./src/spacing-css-var.test.ts","./src/spacing-css-var.ts","./src/style-metadata.ts","./src/test-css.ts","./src/testUtils.ts","./src/toHaveStyle.test.ts","./src/toHaveStyle.ts","./src/truss-css.ts","./src/utils.ts","./src/vitest.ts","./src/plugin/ast-utils.ts","./src/plugin/at-rule-refs.ts","./src/plugin/babel-utils.ts","./src/plugin/chain-nodes.ts","./src/plugin/condition-context.ts","./src/plugin/container-query.ts","./src/plugin/css-property-abbreviations.ts","./src/plugin/css-ts-utils.ts","./src/plugin/diagnostic.ts","./src/plugin/emit-css.test.ts","./src/plugin/emit-css.ts","./src/plugin/emit-style-hash.ts","./src/plugin/esbuild-plugin.test.ts","./src/plugin/esbuild-plugin.ts","./src/plugin/index.test.ts","./src/plugin/index.ts","./src/plugin/keyframe-names.ts","./src/plugin/mapping-utils.ts","./src/plugin/merge-css.test.ts","./src/plugin/merge-css.ts","./src/plugin/priority.ts","./src/plugin/property-priorities.ts","./src/plugin/resolve-calls.ts","./src/plugin/resolve-chain.ts","./src/plugin/resolve-entry.ts","./src/plugin/resolve-literals.ts","./src/plugin/resolve-setvar.ts","./src/plugin/resolve-typography.ts","./src/plugin/resolve-when.ts","./src/plugin/rewrite-css-ts-imports.ts","./src/plugin/rewrite-sites.ts","./src/plugin/style-entries.ts","./src/plugin/test-css.test.ts","./src/plugin/test-css.ts","./src/plugin/transform-css.test.ts","./src/plugin/transform-css.ts","./src/plugin/transform-session.ts","./src/plugin/transform.test.ts","./src/plugin/transform.ts","./src/plugin/truss-css.test.ts","./src/plugin/truss-css.ts","./src/plugin/types.ts","./src/plugin/unknown-abbreviation.ts","./src/plugin/when-relationships.ts","./src/sections/tachyons/animation.ts","./src/sections/tachyons/border.ts","./src/sections/tachyons/borderColors.ts","./src/sections/tachyons/borderRadius.ts","./src/sections/tachyons/borderStyles.ts","./src/sections/tachyons/borderWidths.ts","./src/sections/tachyons/boxShadow.ts","./src/sections/tachyons/container.ts","./src/sections/tachyons/coordinates.ts","./src/sections/tachyons/cursor.ts","./src/sections/tachyons/display.ts","./src/sections/tachyons/flexbox.ts","./src/sections/tachyons/floats.ts","./src/sections/tachyons/fontStyle.ts","./src/sections/tachyons/fontWeight.ts","./src/sections/tachyons/grid.ts","./src/sections/tachyons/heights.ts","./src/sections/tachyons/index.ts","./src/sections/tachyons/lineClamp.ts","./src/sections/tachyons/objectFit.ts","./src/sections/tachyons/opacity.ts","./src/sections/tachyons/outlines.ts","./src/sections/tachyons/overflow.ts","./src/sections/tachyons/position.ts","./src/sections/tachyons/scrollSnap.ts","./src/sections/tachyons/scrollbarWidth.ts","./src/sections/tachyons/skins.ts","./src/sections/tachyons/spacing.ts","./src/sections/tachyons/textAlign.ts","./src/sections/tachyons/textDecoration.ts","./src/sections/tachyons/textTransform.ts","./src/sections/tachyons/transform.ts","./src/sections/tachyons/transition.ts","./src/sections/tachyons/typeScale.ts","./src/sections/tachyons/typography.ts","./src/sections/tachyons/userSelect.ts","./src/sections/tachyons/verticalAlign.ts","./src/sections/tachyons/visibility.ts","./src/sections/tachyons/whitespace.ts","./src/sections/tachyons/widths.ts","./src/sections/tachyons/wordBreak.ts","./src/sections/tachyons/zIndex.ts","./src/sections/tachyons-rn/index.ts","./src/sections/tachyons-rn/spacing.ts"],"version":"6.0.3"}
|