@pairdraw/dom-css 0.0.0-stage → 0.16.1
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/LICENSE +21 -0
- package/README.md +219 -2
- package/dist/browser.d.ts +29 -0
- package/dist/browser.js +2 -0
- package/dist/chunks/behaviours/args.js +59 -0
- package/dist/chunks/behaviours/args.js.map +1 -0
- package/dist/chunks/behaviours/controls.js +109 -0
- package/dist/chunks/behaviours/controls.js.map +1 -0
- package/dist/chunks/behaviours/reset.js +40 -0
- package/dist/chunks/behaviours/reset.js.map +1 -0
- package/dist/chunks/behaviours/roles.js +51 -0
- package/dist/chunks/behaviours/roles.js.map +1 -0
- package/dist/chunks/behaviours/states/conditions.js +103 -0
- package/dist/chunks/behaviours/states/conditions.js.map +1 -0
- package/dist/chunks/behaviours/states/css.js +172 -0
- package/dist/chunks/behaviours/states/css.js.map +1 -0
- package/dist/chunks/behaviours/states/layers.js +1736 -0
- package/dist/chunks/behaviours/states/layers.js.map +1 -0
- package/dist/chunks/behaviours/states/model.js +144 -0
- package/dist/chunks/behaviours/states/model.js.map +1 -0
- package/dist/chunks/behaviours/states/tailwind.js +198 -0
- package/dist/chunks/behaviours/states/tailwind.js.map +1 -0
- package/dist/chunks/browser.js +1352 -0
- package/dist/chunks/browser.js.map +1 -0
- package/dist/chunks/export/bundle.js +337 -0
- package/dist/chunks/export/bundle.js.map +1 -0
- package/dist/chunks/export/components/drawn.js +60 -0
- package/dist/chunks/export/components/drawn.js.map +1 -0
- package/dist/chunks/export/components/fields.js +178 -0
- package/dist/chunks/export/components/fields.js.map +1 -0
- package/dist/chunks/export/components/groups.js +297 -0
- package/dist/chunks/export/components/groups.js.map +1 -0
- package/dist/chunks/export/components/icons.js +260 -0
- package/dist/chunks/export/components/icons.js.map +1 -0
- package/dist/chunks/export/components/layers.js +1599 -0
- package/dist/chunks/export/components/layers.js.map +1 -0
- package/dist/chunks/export/index.js +477 -0
- package/dist/chunks/export/index.js.map +1 -0
- package/dist/chunks/export/storybook/component.js +448 -0
- package/dist/chunks/export/storybook/component.js.map +1 -0
- package/dist/chunks/export/storybook/export.js +410 -0
- package/dist/chunks/export/storybook/export.js.map +1 -0
- package/dist/chunks/import/html.js +406 -0
- package/dist/chunks/import/html.js.map +1 -0
- package/dist/chunks/import/jsx/dev-runtime.js +37 -0
- package/dist/chunks/import/jsx/dev-runtime.js.map +1 -0
- package/dist/chunks/tokens/cssom-validator.js +10 -0
- package/dist/chunks/tokens/cssom-validator.js.map +1 -0
- package/dist/export.d.ts +594 -0
- package/dist/export.js +13 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.js +7 -0
- package/dist/jsx-dev-runtime.d.ts +8 -0
- package/dist/jsx-dev-runtime.js +3 -0
- package/dist/jsx-runtime.d.ts +20 -0
- package/dist/jsx-runtime.js +3 -0
- package/dist/rolldown-runtime.js +13 -0
- package/dist/runtime.d.ts +10 -0
- package/dist/scene-graph.d.ts +2 -0
- package/dist/scene-graph.js +2 -0
- package/dist/scene-graph2.d.ts +10 -0
- package/dist/styling.d.ts +93 -0
- package/dist/tailwind.d.ts +39 -0
- package/dist/types.d.ts +89 -0
- package/package.json +88 -4
- package/src/behaviours/args.ts +85 -0
- package/src/behaviours/controls.ts +195 -0
- package/src/behaviours/index.ts +11 -0
- package/src/behaviours/reset.ts +37 -0
- package/src/behaviours/roles.ts +44 -0
- package/src/behaviours/states/conditions.ts +105 -0
- package/src/behaviours/states/css.ts +123 -0
- package/src/behaviours/states/index.ts +4 -0
- package/src/behaviours/states/layers.ts +205 -0
- package/src/behaviours/states/model.ts +175 -0
- package/src/behaviours/states/names.ts +39 -0
- package/src/behaviours/states/tailwind.ts +148 -0
- package/src/behaviours/states/types.ts +56 -0
- package/src/browser.ts +146 -0
- package/src/cssom.d.ts +38 -0
- package/src/export/bundle.ts +461 -0
- package/src/export/components/drawn.ts +73 -0
- package/src/export/components/fields.ts +178 -0
- package/src/export/components/groups.ts +78 -0
- package/src/export/components/icons.ts +230 -0
- package/src/export/components/layers.ts +121 -0
- package/src/export/components/model.ts +544 -0
- package/src/export/components/properties.ts +167 -0
- package/src/export/components/react/fields.ts +129 -0
- package/src/export/components/react/index.ts +412 -0
- package/src/export/components/react/props.ts +151 -0
- package/src/export/components/react/radix.ts +52 -0
- package/src/export/components/react/shared.ts +76 -0
- package/src/export/components/references.ts +212 -0
- package/src/export/components/repeats.ts +128 -0
- package/src/export/components/shaders.ts +125 -0
- package/src/export/components/styling.ts +31 -0
- package/src/export/components/tree.ts +72 -0
- package/src/export/components/vue.ts +517 -0
- package/src/export/css.ts +57 -0
- package/src/export/grid.ts +42 -0
- package/src/export/html.ts +163 -0
- package/src/export/index.ts +44 -0
- package/src/export/projection.ts +581 -0
- package/src/export/storybook/component.ts +334 -0
- package/src/export/storybook/export.ts +430 -0
- package/src/export/storybook/groups.ts +161 -0
- package/src/export/storybook/module.ts +319 -0
- package/src/export/storybook/names.ts +51 -0
- package/src/export/tailwind-jsx.ts +156 -0
- package/src/export/text.ts +415 -0
- package/src/import/css-text.ts +4 -0
- package/src/import/css-values.ts +31 -0
- package/src/import/flow.ts +248 -0
- package/src/import/html.ts +88 -0
- package/src/import/jsx/core.ts +130 -0
- package/src/import/jsx/dev-runtime.ts +8 -0
- package/src/import/jsx/runtime.ts +76 -0
- package/src/import/scene-graph.ts +582 -0
- package/src/import/style-attribute.ts +25 -0
- package/src/import/tailwind.ts +54 -0
- package/src/import/text.ts +518 -0
- package/src/index.ts +51 -0
- package/src/runtime/browser/runtime.ts +301 -0
- package/src/runtime/headless/runtime.ts +99 -0
- package/src/runtime/headless/styles.ts +330 -0
- package/src/runtime/index.ts +11 -0
- package/src/tokens/conditions.ts +66 -0
- package/src/tokens/cssom-validator.ts +8 -0
- package/src/tokens/custom-properties.ts +331 -0
- package/src/tokens/expression.ts +128 -0
- package/src/tokens/formula.ts +140 -0
- package/src/tokens/index.ts +43 -0
- package/src/tokens/names.ts +161 -0
- package/src/tokens/references.ts +201 -0
- package/src/tokens/stylesheet.ts +304 -0
- package/src/tokens/validate.ts +86 -0
- package/src/tokens/values.ts +44 -0
- package/src/types.ts +59 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { behaviourArgs } from "../args.js";
|
|
2
|
+
import { behaviourProperties, readBehaviour } from "@pairdraw/scene-graph/behaviours";
|
|
3
|
+
import { variantDefaultValue } from "@pairdraw/scene-graph/components";
|
|
4
|
+
//#region src/behaviours/states/conditions.ts
|
|
5
|
+
/** The `data-state` value a boolean prop sets when on, as Reka and Radix set it. */
|
|
6
|
+
const DATA_STATE_ON = {
|
|
7
|
+
checked: "checked",
|
|
8
|
+
pressed: "on",
|
|
9
|
+
open: "open"
|
|
10
|
+
};
|
|
11
|
+
const INTERACTIONS = [
|
|
12
|
+
"hover",
|
|
13
|
+
"pressed",
|
|
14
|
+
"focus"
|
|
15
|
+
];
|
|
16
|
+
/** Controls whose focus lands on a layer inside them: a slider's thumb, a field's input. */
|
|
17
|
+
const FOCUS_WITHIN = /* @__PURE__ */ new Set([
|
|
18
|
+
"slider",
|
|
19
|
+
"textField",
|
|
20
|
+
"textarea",
|
|
21
|
+
"numberField"
|
|
22
|
+
]);
|
|
23
|
+
function booleanCondition(arg) {
|
|
24
|
+
return (value) => {
|
|
25
|
+
if (value === arg.off) return null;
|
|
26
|
+
if (arg.name === "disabled") return { type: "disabled" };
|
|
27
|
+
const state = DATA_STATE_ON[arg.name];
|
|
28
|
+
return state ? {
|
|
29
|
+
type: "state",
|
|
30
|
+
value: state
|
|
31
|
+
} : {
|
|
32
|
+
type: "prop",
|
|
33
|
+
name: arg.name,
|
|
34
|
+
value
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** The interaction-state property's values: hover, pressed, focus, and disabled. */
|
|
39
|
+
function interactionCondition(set, states) {
|
|
40
|
+
const behaviour = readBehaviour(set);
|
|
41
|
+
const within = behaviour ? FOCUS_WITHIN.has(behaviour.kind) : false;
|
|
42
|
+
const byValue = /* @__PURE__ */ new Map();
|
|
43
|
+
for (const state of INTERACTIONS) {
|
|
44
|
+
const value = behaviour?.states?.[state];
|
|
45
|
+
if (value !== void 0 && value !== states.rest) byValue.set(value, {
|
|
46
|
+
type: "interaction",
|
|
47
|
+
state,
|
|
48
|
+
...state === "focus" && within ? { within } : {}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (states.disabled !== void 0) byValue.set(states.disabled, { type: "disabled" });
|
|
52
|
+
const name = states.property;
|
|
53
|
+
return (value) => {
|
|
54
|
+
if (value === states.rest) return null;
|
|
55
|
+
return byValue.get(value) ?? {
|
|
56
|
+
type: "prop",
|
|
57
|
+
name,
|
|
58
|
+
value
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Any other variant property is a prop the generated component sets as `data-*`, at rest at
|
|
64
|
+
* its default value, the default variant's when the document leaves it empty.
|
|
65
|
+
*/
|
|
66
|
+
function propCondition(graph, set, definition) {
|
|
67
|
+
const rest = variantDefaultValue(graph, set, definition);
|
|
68
|
+
return (value) => value === rest ? null : {
|
|
69
|
+
type: "prop",
|
|
70
|
+
name: definition.name,
|
|
71
|
+
value
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Reads the conditions that show each variant of a set: from its behaviour's boolean props and
|
|
76
|
+
* interaction states, and every other variant property as a prop. `null` for a variant that
|
|
77
|
+
* leaves a property out, which can't be placed among the others.
|
|
78
|
+
*/
|
|
79
|
+
function variantConditions(graph, set) {
|
|
80
|
+
const args = behaviourArgs(graph, set);
|
|
81
|
+
const conditionOf = (definition) => {
|
|
82
|
+
const boolean = args?.booleans.get(definition.name);
|
|
83
|
+
if (boolean) return booleanCondition(boolean);
|
|
84
|
+
if (args?.states?.property === definition.name) return interactionCondition(set, args.states);
|
|
85
|
+
const filled = args?.filled;
|
|
86
|
+
if (filled?.property === definition.name) return (value) => value === filled.on ? { type: "filled" } : null;
|
|
87
|
+
return propCondition(graph, set, definition);
|
|
88
|
+
};
|
|
89
|
+
const byProperty = new Map(behaviourProperties(graph, set).filter((definition) => definition.type === "VARIANT").map((definition) => [definition.name, conditionOf(definition)]));
|
|
90
|
+
return (variant) => {
|
|
91
|
+
const conditions = [];
|
|
92
|
+
for (const [property, condition] of byProperty) {
|
|
93
|
+
if (!Object.hasOwn(variant.componentPropertyValues, property)) return null;
|
|
94
|
+
const added = condition(variant.componentPropertyValues[property]);
|
|
95
|
+
if (added) conditions.push(added);
|
|
96
|
+
}
|
|
97
|
+
return conditions;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { variantConditions };
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=conditions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.js","names":[],"sources":["../../../../src/behaviours/states/conditions.ts"],"sourcesContent":["import type { ComponentPropertyDefinition, SceneGraph, SceneNode } from '@pairdraw/scene-graph'\nimport {\n behaviourProperties,\n readBehaviour,\n type BehaviourKind\n} from '@pairdraw/scene-graph/behaviours'\nimport { variantDefaultValue } from '@pairdraw/scene-graph/components'\n\nimport { behaviourArgs, type BehaviourArgs, type BooleanArg } from '../args'\nimport type { StateCondition } from './types'\n\n/** The `data-state` value a boolean prop sets when on, as Reka and Radix set it. */\nconst DATA_STATE_ON: Partial<Record<string, string>> = {\n checked: 'checked',\n pressed: 'on',\n open: 'open'\n}\n\nconst INTERACTIONS = ['hover', 'pressed', 'focus'] as const\n\n/** Controls whose focus lands on a layer inside them: a slider's thumb, a field's input. */\nconst FOCUS_WITHIN = new Set<BehaviourKind>(['slider', 'textField', 'textarea', 'numberField'])\n\n/** The condition a variant property's value adds, or `null` for its rest value. */\ntype ValueCondition = (value: string) => StateCondition | null\n\nfunction booleanCondition(arg: BooleanArg): ValueCondition {\n return (value) => {\n if (value === arg.off) return null\n if (arg.name === 'disabled') return { type: 'disabled' }\n const state = DATA_STATE_ON[arg.name]\n return state ? { type: 'state', value: state } : { type: 'prop', name: arg.name, value }\n }\n}\n\n/** The interaction-state property's values: hover, pressed, focus, and disabled. */\nfunction interactionCondition(set: SceneNode, states: NonNullable<BehaviourArgs['states']>) {\n const behaviour = readBehaviour(set)\n const within = behaviour ? FOCUS_WITHIN.has(behaviour.kind) : false\n const byValue = new Map<string, StateCondition>()\n for (const state of INTERACTIONS) {\n const value = behaviour?.states?.[state]\n if (value !== undefined && value !== states.rest)\n byValue.set(value, {\n type: 'interaction',\n state,\n ...(state === 'focus' && within ? { within } : {})\n })\n }\n if (states.disabled !== undefined) byValue.set(states.disabled, { type: 'disabled' })\n const name = states.property\n return (value: string): StateCondition | null => {\n if (value === states.rest) return null\n // A value the behaviour does not map to a state still shows its variant, as a prop.\n return byValue.get(value) ?? { type: 'prop', name, value }\n }\n}\n\n/**\n * Any other variant property is a prop the generated component sets as `data-*`, at rest at\n * its default value, the default variant's when the document leaves it empty.\n */\nfunction propCondition(\n graph: SceneGraph,\n set: SceneNode,\n definition: ComponentPropertyDefinition\n): ValueCondition {\n const rest = variantDefaultValue(graph, set, definition)\n return (value) => (value === rest ? null : { type: 'prop', name: definition.name, value })\n}\n\n/**\n * Reads the conditions that show each variant of a set: from its behaviour's boolean props and\n * interaction states, and every other variant property as a prop. `null` for a variant that\n * leaves a property out, which can't be placed among the others.\n */\nexport function variantConditions(\n graph: SceneGraph,\n set: SceneNode\n): (variant: SceneNode) => StateCondition[] | null {\n const args = behaviourArgs(graph, set)\n const conditionOf = (definition: ComponentPropertyDefinition): ValueCondition => {\n const boolean = args?.booleans.get(definition.name)\n if (boolean) return booleanCondition(boolean)\n if (args?.states?.property === definition.name) return interactionCondition(set, args.states)\n const filled = args?.filled\n if (filled?.property === definition.name)\n return (value) => (value === filled.on ? { type: 'filled' } : null)\n return propCondition(graph, set, definition)\n }\n const byProperty = new Map(\n behaviourProperties(graph, set)\n .filter((definition) => definition.type === 'VARIANT')\n .map((definition) => [definition.name, conditionOf(definition)] as const)\n )\n return (variant) => {\n const conditions: StateCondition[] = []\n for (const [property, condition] of byProperty) {\n if (!Object.hasOwn(variant.componentPropertyValues, property)) return null\n const added = condition(variant.componentPropertyValues[property])\n if (added) conditions.push(added)\n }\n return conditions\n }\n}\n"],"mappings":";;;;;AAYA,MAAM,gBAAiD;CACrD,SAAS;CACT,SAAS;CACT,MAAM;AACR;AAEA,MAAM,eAAe;CAAC;CAAS;CAAW;AAAO;;AAGjD,MAAM,+BAAe,IAAI,IAAmB;CAAC;CAAU;CAAa;CAAY;AAAa,CAAC;AAK9F,SAAS,iBAAiB,KAAiC;CACzD,QAAQ,UAAU;EAChB,IAAI,UAAU,IAAI,KAAK,OAAO;EAC9B,IAAI,IAAI,SAAS,YAAY,OAAO,EAAE,MAAM,WAAW;EACvD,MAAM,QAAQ,cAAc,IAAI;EAChC,OAAO,QAAQ;GAAE,MAAM;GAAS,OAAO;EAAM,IAAI;GAAE,MAAM;GAAQ,MAAM,IAAI;GAAM;EAAM;CACzF;AACF;;AAGA,SAAS,qBAAqB,KAAgB,QAA8C;CAC1F,MAAM,YAAY,cAAc,GAAG;CACnC,MAAM,SAAS,YAAY,aAAa,IAAI,UAAU,IAAI,IAAI;CAC9D,MAAM,0BAAU,IAAI,IAA4B;CAChD,KAAK,MAAM,SAAS,cAAc;EAChC,MAAM,QAAQ,WAAW,SAAS;EAClC,IAAI,UAAU,KAAA,KAAa,UAAU,OAAO,MAC1C,QAAQ,IAAI,OAAO;GACjB,MAAM;GACN;GACA,GAAI,UAAU,WAAW,SAAS,EAAE,OAAO,IAAI,CAAC;EAClD,CAAC;CACL;CACA,IAAI,OAAO,aAAa,KAAA,GAAW,QAAQ,IAAI,OAAO,UAAU,EAAE,MAAM,WAAW,CAAC;CACpF,MAAM,OAAO,OAAO;CACpB,QAAQ,UAAyC;EAC/C,IAAI,UAAU,OAAO,MAAM,OAAO;EAElC,OAAO,QAAQ,IAAI,KAAK,KAAK;GAAE,MAAM;GAAQ;GAAM;EAAM;CAC3D;AACF;;;;;AAMA,SAAS,cACP,OACA,KACA,YACgB;CAChB,MAAM,OAAO,oBAAoB,OAAO,KAAK,UAAU;CACvD,QAAQ,UAAW,UAAU,OAAO,OAAO;EAAE,MAAM;EAAQ,MAAM,WAAW;EAAM;CAAM;AAC1F;;;;;;AAOA,SAAgB,kBACd,OACA,KACiD;CACjD,MAAM,OAAO,cAAc,OAAO,GAAG;CACrC,MAAM,eAAe,eAA4D;EAC/E,MAAM,UAAU,MAAM,SAAS,IAAI,WAAW,IAAI;EAClD,IAAI,SAAS,OAAO,iBAAiB,OAAO;EAC5C,IAAI,MAAM,QAAQ,aAAa,WAAW,MAAM,OAAO,qBAAqB,KAAK,KAAK,MAAM;EAC5F,MAAM,SAAS,MAAM;EACrB,IAAI,QAAQ,aAAa,WAAW,MAClC,QAAQ,UAAW,UAAU,OAAO,KAAK,EAAE,MAAM,SAAS,IAAI;EAChE,OAAO,cAAc,OAAO,KAAK,UAAU;CAC7C;CACA,MAAM,aAAa,IAAI,IACrB,oBAAoB,OAAO,GAAG,CAAC,CAC5B,QAAQ,eAAe,WAAW,SAAS,SAAS,CAAC,CACrD,KAAK,eAAe,CAAC,WAAW,MAAM,YAAY,UAAU,CAAC,CAAU,CAC5E;CACA,QAAQ,YAAY;EAClB,MAAM,aAA+B,CAAC;EACtC,KAAK,MAAM,CAAC,UAAU,cAAc,YAAY;GAC9C,IAAI,CAAC,OAAO,OAAO,QAAQ,yBAAyB,QAAQ,GAAG,OAAO;GACtE,MAAM,QAAQ,UAAU,QAAQ,wBAAwB,SAAS;GACjE,IAAI,OAAO,WAAW,KAAK,KAAK;EAClC;EACA,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { compact, sortBy } from "es-toolkit/array";
|
|
2
|
+
import { kebabCase, pascalCase } from "es-toolkit/string";
|
|
3
|
+
import cssesc from "cssesc";
|
|
4
|
+
//#region src/export/storybook/names.ts
|
|
5
|
+
/**
|
|
6
|
+
* Claim `base`, or the first free `base<separator><n>` from 2 on. `key` decides which
|
|
7
|
+
* names collide, e.g. ignoring case for file names on case-insensitive file systems.
|
|
8
|
+
*/
|
|
9
|
+
function claimName(base, taken, { separator = "", key = (name) => name } = {}) {
|
|
10
|
+
let name = base;
|
|
11
|
+
for (let n = 2; taken.has(key(name)); n++) name = `${base}${separator}${n}`;
|
|
12
|
+
taken.add(key(name));
|
|
13
|
+
return name;
|
|
14
|
+
}
|
|
15
|
+
const NOT_IDENTIFIER_PART = /[^\p{ID_Continue}]/gu;
|
|
16
|
+
const IDENTIFIER_START = /^\p{ID_Start}/u;
|
|
17
|
+
/** A PascalCase JavaScript identifier for `text`, prefixed with `fallback` when it cannot start one. */
|
|
18
|
+
function identifierName(text, fallback) {
|
|
19
|
+
const name = pascalCase(text).replace(NOT_IDENTIFIER_PART, "");
|
|
20
|
+
return IDENTIFIER_START.test(name) ? name : `${fallback}${name}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Storybook's `sanitize` from `src/csf/csf-utils.ts`, which turns titles into story ids.
|
|
24
|
+
* It is only exported from `storybook/internal/csf`, so it is copied here; a test keeps
|
|
25
|
+
* the copy equal to the installed Storybook.
|
|
26
|
+
*/
|
|
27
|
+
function storyId(title) {
|
|
28
|
+
return title.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>{}[\]\\/]/gi, "-").replace(/-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tags a story file carries, which Storybook's sidebar filter and `main.ts` `tags` options
|
|
32
|
+
* select by: every exported file, and the page it comes from.
|
|
33
|
+
*/
|
|
34
|
+
const fileTags = (page) => ["pairdraw", `page:${storyId(page)}`];
|
|
35
|
+
/**
|
|
36
|
+
* The tag every story but a file's first carries: each other variant or state. Excluding it
|
|
37
|
+
* in Storybook leaves one story per component, the one the design shows at rest.
|
|
38
|
+
*/
|
|
39
|
+
const VARIANT_TAG = "variant";
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/behaviours/states/names.ts
|
|
42
|
+
const NOT_NAME_PART = /[^a-z0-9-]/g;
|
|
43
|
+
/** A CSS identifier made from a layer or set name, `fallback` when nothing of it is usable. */
|
|
44
|
+
function cssName(text, fallback) {
|
|
45
|
+
const name = kebabCase(text).replace(NOT_NAME_PART, "");
|
|
46
|
+
return /^[a-z]/.test(name) ? name : `${fallback}${name ? `-${name}` : ""}`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A readable class per layer: the set's name for the root, `<root>__<layer>` below it,
|
|
50
|
+
* numbered where two layers share a name.
|
|
51
|
+
*/
|
|
52
|
+
function layerClassNames(styles) {
|
|
53
|
+
const root = cssName(styles.name, "component");
|
|
54
|
+
const names = /* @__PURE__ */ new Map([[styles.root, root]]);
|
|
55
|
+
const taken = /* @__PURE__ */ new Set([root]);
|
|
56
|
+
const visit = (element) => {
|
|
57
|
+
for (const child of element.children) {
|
|
58
|
+
if (child.type !== "element") continue;
|
|
59
|
+
names.set(child, claimName(`${root}__${cssName(child.name, "layer")}`, taken, { separator: "-" }));
|
|
60
|
+
visit(child);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
visit(styles.root);
|
|
64
|
+
return names;
|
|
65
|
+
}
|
|
66
|
+
/** The attribute a generated component sets for a variant property it takes as a prop. */
|
|
67
|
+
function propAttribute(name) {
|
|
68
|
+
return `data-${cssName(name, "prop")}`;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/behaviours/states/css.ts
|
|
72
|
+
/** A CSS string for an attribute selector's value. */
|
|
73
|
+
const quoted = (value) => cssesc(value, {
|
|
74
|
+
quotes: "double",
|
|
75
|
+
wrap: true
|
|
76
|
+
});
|
|
77
|
+
/** A field whose input or textarea shows text rather than its placeholder. */
|
|
78
|
+
const FILLED = ":has(:is(input, textarea):not(:placeholder-shown))";
|
|
79
|
+
/** The selector part a condition adds to the control's root. */
|
|
80
|
+
function conditionSelector(condition) {
|
|
81
|
+
if (condition.type === "state") return `[data-state=${quoted(condition.value)}]`;
|
|
82
|
+
if (condition.type === "disabled") return "[data-disabled]";
|
|
83
|
+
if (condition.type === "filled") return FILLED;
|
|
84
|
+
if (condition.type === "prop") return `[${propAttribute(condition.name)}=${quoted(condition.value)}]`;
|
|
85
|
+
if (condition.state === "focus") return condition.within ? ":focus-within" : ":focus-visible";
|
|
86
|
+
return `${condition.state === "hover" ? ":hover" : ":active"}:not([data-disabled])`;
|
|
87
|
+
}
|
|
88
|
+
function designNode(node, classes) {
|
|
89
|
+
if (node.type === "text") return node;
|
|
90
|
+
const className = compact([node.attrs.class, classes.get(node)]).join(" ");
|
|
91
|
+
return {
|
|
92
|
+
type: "element",
|
|
93
|
+
tagName: node.tagName,
|
|
94
|
+
attrs: {
|
|
95
|
+
...node.attrs,
|
|
96
|
+
class: className
|
|
97
|
+
},
|
|
98
|
+
children: node.children.map((child) => designNode(child, classes)),
|
|
99
|
+
shader: node.shader
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The state styles as a stylesheet with a readable class per layer. A rule with more
|
|
104
|
+
* conditions comes later and has a more specific selector, so a combined variant wins over
|
|
105
|
+
* each of its parts. The sheet is built with the CSS object model, which rejects an invalid
|
|
106
|
+
* selector and prints the declarations.
|
|
107
|
+
*/
|
|
108
|
+
async function stateStylesToCSS(styles) {
|
|
109
|
+
const classes = layerClassNames(styles);
|
|
110
|
+
const rootClass = classes.get(styles.root) ?? "";
|
|
111
|
+
const rules = [];
|
|
112
|
+
for (const [element, className] of classes) {
|
|
113
|
+
const own = element === styles.root ? "" : ` .${className}`;
|
|
114
|
+
if (Object.keys(element.base).length > 0) rules.push({
|
|
115
|
+
order: 0,
|
|
116
|
+
selector: `.${rootClass}${own}`,
|
|
117
|
+
style: element.base
|
|
118
|
+
});
|
|
119
|
+
for (const rule of element.rules) {
|
|
120
|
+
const when = rule.conditions.map(conditionSelector).join("");
|
|
121
|
+
const on = rule.on && classes.get(rule.on);
|
|
122
|
+
const pseudo = rule.pseudo ? `::${rule.pseudo}` : "";
|
|
123
|
+
const tested = on ? ` .${on}${when}${rule.on === element ? "" : own}${pseudo}` : `${when}${own}${pseudo}`;
|
|
124
|
+
rules.push({
|
|
125
|
+
order: rule.conditions.length,
|
|
126
|
+
selector: `.${rootClass}${tested}`,
|
|
127
|
+
style: rule.style
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const sheet = await writableStyleSheet();
|
|
132
|
+
for (const rule of sortBy(rules, [(item) => item.order])) {
|
|
133
|
+
const index = sheet.insertRule(`${rule.selector} {}`);
|
|
134
|
+
for (const [property, value] of Object.entries(rule.style)) sheet.setProperty(index, property, value);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
document: {
|
|
138
|
+
type: "document",
|
|
139
|
+
children: [designNode(styles.root, classes)]
|
|
140
|
+
},
|
|
141
|
+
css: sheet.text()
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The browser's own CSS object model where there is one, and otherwise `@acemir/cssom`, loaded
|
|
146
|
+
* only when a stylesheet is written. That package's browser build only defines a global and
|
|
147
|
+
* exports nothing, so a browser bundle cannot use it.
|
|
148
|
+
*/
|
|
149
|
+
async function writableStyleSheet() {
|
|
150
|
+
if (typeof globalThis.CSSStyleSheet === "function") {
|
|
151
|
+
const sheet = new globalThis.CSSStyleSheet();
|
|
152
|
+
return {
|
|
153
|
+
insertRule: (rule) => sheet.insertRule(rule, sheet.cssRules.length),
|
|
154
|
+
setProperty: (index, property, value) => {
|
|
155
|
+
const rule = sheet.cssRules[index];
|
|
156
|
+
if (rule instanceof CSSStyleRule) rule.style.setProperty(property, value);
|
|
157
|
+
},
|
|
158
|
+
text: () => Array.from(sheet.cssRules, (rule) => rule.cssText).join("\n")
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const { CSSStyleSheet } = await import("@acemir/cssom");
|
|
162
|
+
const sheet = new CSSStyleSheet();
|
|
163
|
+
return {
|
|
164
|
+
insertRule: (rule) => sheet.insertRule(rule, sheet.cssRules.length),
|
|
165
|
+
setProperty: (index, property, value) => sheet.cssRules[index]?.style.setProperty(property, value),
|
|
166
|
+
text: () => sheet.toString()
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
export { VARIANT_TAG, claimName, conditionSelector, cssName, fileTags, identifierName, layerClassNames, propAttribute, stateStylesToCSS, storyId };
|
|
171
|
+
|
|
172
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","names":[],"sources":["../../../../src/export/storybook/names.ts","../../../../src/behaviours/states/names.ts","../../../../src/behaviours/states/css.ts"],"sourcesContent":["import { pascalCase } from 'es-toolkit/string'\n\n/**\n * Claim `base`, or the first free `base<separator><n>` from 2 on. `key` decides which\n * names collide, e.g. ignoring case for file names on case-insensitive file systems.\n */\nexport function claimName(\n base: string,\n taken: Set<string>,\n { separator = '', key = (name: string) => name } = {}\n): string {\n let name = base\n for (let n = 2; taken.has(key(name)); n++) name = `${base}${separator}${n}`\n taken.add(key(name))\n return name\n}\n\nconst NOT_IDENTIFIER_PART = /[^\\p{ID_Continue}]/gu\nconst IDENTIFIER_START = /^\\p{ID_Start}/u\n\n/** A PascalCase JavaScript identifier for `text`, prefixed with `fallback` when it cannot start one. */\nexport function identifierName(text: string, fallback: string): string {\n const name = pascalCase(text).replace(NOT_IDENTIFIER_PART, '')\n return IDENTIFIER_START.test(name) ? name : `${fallback}${name}`\n}\n\n/**\n * Storybook's `sanitize` from `src/csf/csf-utils.ts`, which turns titles into story ids.\n * It is only exported from `storybook/internal/csf`, so it is copied here; a test keeps\n * the copy equal to the installed Storybook.\n */\nexport function storyId(title: string): string {\n return title\n .toLowerCase()\n .replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\\-=?;:'\",.<>{}[\\]\\\\/]/gi, '-')\n .replace(/-+/g, '-')\n .replace(/^-+/, '')\n .replace(/-+$/, '')\n}\n\n/**\n * Tags a story file carries, which Storybook's sidebar filter and `main.ts` `tags` options\n * select by: every exported file, and the page it comes from.\n */\nexport const fileTags = (page: string) => ['pairdraw', `page:${storyId(page)}`]\n\n/**\n * The tag every story but a file's first carries: each other variant or state. Excluding it\n * in Storybook leaves one story per component, the one the design shows at rest.\n */\nexport const VARIANT_TAG = 'variant'\n","import { claimName } from '#dom-css/export/storybook/names'\nimport { kebabCase } from 'es-toolkit/string'\n\nimport type { StateElement, StateStyles } from './types'\n\nconst NOT_NAME_PART = /[^a-z0-9-]/g\n\n/** A CSS identifier made from a layer or set name, `fallback` when nothing of it is usable. */\nexport function cssName(text: string, fallback: string): string {\n const name = kebabCase(text).replace(NOT_NAME_PART, '')\n return /^[a-z]/.test(name) ? name : `${fallback}${name ? `-${name}` : ''}`\n}\n\n/**\n * A readable class per layer: the set's name for the root, `<root>__<layer>` below it,\n * numbered where two layers share a name.\n */\nexport function layerClassNames(styles: StateStyles): Map<StateElement, string> {\n const root = cssName(styles.name, 'component')\n const names = new Map<StateElement, string>([[styles.root, root]])\n const taken = new Set([root])\n const visit = (element: StateElement) => {\n for (const child of element.children) {\n if (child.type !== 'element') continue\n names.set(\n child,\n claimName(`${root}__${cssName(child.name, 'layer')}`, taken, { separator: '-' })\n )\n visit(child)\n }\n }\n visit(styles.root)\n return names\n}\n\n/** The attribute a generated component sets for a variant property it takes as a prop. */\nexport function propAttribute(name: string): string {\n return `data-${cssName(name, 'prop')}`\n}\n","import type {\n DesignDocument,\n DesignElement,\n DesignNode,\n DesignStyleDeclaration\n} from '#dom-css/types'\nimport cssesc from 'cssesc'\nimport { compact, sortBy } from 'es-toolkit/array'\n\nimport { layerClassNames, propAttribute } from './names'\nimport type { StateCondition, StateElement, StateNode, StateStyles } from './types'\n\nexport interface StateStylesheet {\n /** The merged markup, each layer carrying its class and no inline style. */\n document: DesignDocument\n css: string\n}\n\n/** A CSS string for an attribute selector's value. */\nconst quoted = (value: string) => cssesc(value, { quotes: 'double', wrap: true })\n\n/** A field whose input or textarea shows text rather than its placeholder. */\nconst FILLED = ':has(:is(input, textarea):not(:placeholder-shown))'\n\n/** The selector part a condition adds to the control's root. */\nexport function conditionSelector(condition: StateCondition): string {\n if (condition.type === 'state') return `[data-state=${quoted(condition.value)}]`\n if (condition.type === 'disabled') return '[data-disabled]'\n if (condition.type === 'filled') return FILLED\n if (condition.type === 'prop')\n return `[${propAttribute(condition.name)}=${quoted(condition.value)}]`\n if (condition.state === 'focus') return condition.within ? ':focus-within' : ':focus-visible'\n // A disabled control keeps its disabled look under the pointer.\n return `${condition.state === 'hover' ? ':hover' : ':active'}:not([data-disabled])`\n}\n\nfunction designNode(node: StateNode, classes: Map<StateElement, string>): DesignNode {\n if (node.type === 'text') return node\n const className = compact([node.attrs.class, classes.get(node)]).join(' ')\n const element: DesignElement = {\n type: 'element',\n tagName: node.tagName,\n attrs: { ...node.attrs, class: className },\n children: node.children.map((child) => designNode(child, classes)),\n shader: node.shader\n }\n return element\n}\n\n/**\n * The state styles as a stylesheet with a readable class per layer. A rule with more\n * conditions comes later and has a more specific selector, so a combined variant wins over\n * each of its parts. The sheet is built with the CSS object model, which rejects an invalid\n * selector and prints the declarations.\n */\nexport async function stateStylesToCSS(styles: StateStyles): Promise<StateStylesheet> {\n const classes = layerClassNames(styles)\n const rootClass = classes.get(styles.root) ?? ''\n const rules: { order: number; selector: string; style: DesignStyleDeclaration }[] = []\n for (const [element, className] of classes) {\n const own = element === styles.root ? '' : ` .${className}`\n if (Object.keys(element.base).length > 0)\n rules.push({ order: 0, selector: `.${rootClass}${own}`, style: element.base })\n for (const rule of element.rules) {\n const when = rule.conditions.map(conditionSelector).join('')\n const on = rule.on && classes.get(rule.on)\n const pseudo = rule.pseudo ? `::${rule.pseudo}` : ''\n const tested = on\n ? ` .${on}${when}${rule.on === element ? '' : own}${pseudo}`\n : `${when}${own}${pseudo}`\n rules.push({\n order: rule.conditions.length,\n selector: `.${rootClass}${tested}`,\n style: rule.style\n })\n }\n }\n const sheet = await writableStyleSheet()\n for (const rule of sortBy(rules, [(item) => item.order])) {\n const index = sheet.insertRule(`${rule.selector} {}`)\n for (const [property, value] of Object.entries(rule.style))\n sheet.setProperty(index, property, value)\n }\n return {\n document: { type: 'document', children: [designNode(styles.root, classes)] },\n css: sheet.text()\n }\n}\n\n/** A stylesheet rules are inserted into and printed from. */\ninterface WritableStyleSheet {\n /** Parses `rule` at the end, throwing on an invalid selector, and returns its index. */\n insertRule(rule: string): number\n setProperty(index: number, property: string, value: string): void\n text(): string\n}\n\n/**\n * The browser's own CSS object model where there is one, and otherwise `@acemir/cssom`, loaded\n * only when a stylesheet is written. That package's browser build only defines a global and\n * exports nothing, so a browser bundle cannot use it.\n */\nasync function writableStyleSheet(): Promise<WritableStyleSheet> {\n if (typeof globalThis.CSSStyleSheet === 'function') {\n const sheet = new globalThis.CSSStyleSheet()\n return {\n insertRule: (rule) => sheet.insertRule(rule, sheet.cssRules.length),\n setProperty: (index, property, value) => {\n const rule = sheet.cssRules[index]\n if (rule instanceof CSSStyleRule) rule.style.setProperty(property, value)\n },\n text: () => Array.from(sheet.cssRules, (rule) => rule.cssText).join('\\n')\n }\n }\n const { CSSStyleSheet } = await import('@acemir/cssom')\n const sheet = new CSSStyleSheet()\n return {\n insertRule: (rule) => sheet.insertRule(rule, sheet.cssRules.length),\n setProperty: (index, property, value) =>\n sheet.cssRules[index]?.style.setProperty(property, value),\n text: () => sheet.toString()\n }\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,UACd,MACA,OACA,EAAE,YAAY,IAAI,OAAO,SAAiB,SAAS,CAAC,GAC5C;CACR,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,MAAM,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO,GAAG,OAAO,YAAY;CACxE,MAAM,IAAI,IAAI,IAA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