@ttoss/fsl-ui 0.2.4
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 +76 -0
- package/dist/_virtual/_rolldown/runtime.cjs +30 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +129 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +61 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.mts +61 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.mjs +126 -0
- package/dist/components/Button/Button.cjs +80 -0
- package/dist/components/Button/Button.d.cts +68 -0
- package/dist/components/Button/Button.d.mts +68 -0
- package/dist/components/Button/Button.mjs +79 -0
- package/dist/components/Checkbox/Checkbox.cjs +183 -0
- package/dist/components/Checkbox/Checkbox.d.cts +45 -0
- package/dist/components/Checkbox/Checkbox.d.mts +45 -0
- package/dist/components/Checkbox/Checkbox.mjs +182 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.cjs +97 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.cts +56 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.mts +56 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.mjs +96 -0
- package/dist/components/FileTrigger/FileTrigger.cjs +51 -0
- package/dist/components/FileTrigger/FileTrigger.d.cts +52 -0
- package/dist/components/FileTrigger/FileTrigger.d.mts +52 -0
- package/dist/components/FileTrigger/FileTrigger.mjs +50 -0
- package/dist/components/GridList/GridList.cjs +220 -0
- package/dist/components/GridList/GridList.d.cts +72 -0
- package/dist/components/GridList/GridList.d.mts +72 -0
- package/dist/components/GridList/GridList.mjs +217 -0
- package/dist/components/Group/Group.cjs +77 -0
- package/dist/components/Group/Group.d.cts +61 -0
- package/dist/components/Group/Group.d.mts +61 -0
- package/dist/components/Group/Group.mjs +74 -0
- package/dist/components/Icon/Icon.cjs +52 -0
- package/dist/components/Icon/Icon.mjs +52 -0
- package/dist/components/Icon/glyphs.cjs +72 -0
- package/dist/components/Icon/glyphs.mjs +63 -0
- package/dist/components/Link/Link.cjs +62 -0
- package/dist/components/Link/Link.d.cts +38 -0
- package/dist/components/Link/Link.d.mts +38 -0
- package/dist/components/Link/Link.mjs +61 -0
- package/dist/components/ListBox/ListBox.cjs +126 -0
- package/dist/components/ListBox/ListBox.d.cts +63 -0
- package/dist/components/ListBox/ListBox.d.mts +63 -0
- package/dist/components/ListBox/ListBox.mjs +123 -0
- package/dist/components/Meter/Meter.cjs +126 -0
- package/dist/components/Meter/Meter.d.cts +63 -0
- package/dist/components/Meter/Meter.d.mts +63 -0
- package/dist/components/Meter/Meter.mjs +125 -0
- package/dist/components/NumberField/NumberField.cjs +221 -0
- package/dist/components/NumberField/NumberField.d.cts +68 -0
- package/dist/components/NumberField/NumberField.d.mts +68 -0
- package/dist/components/NumberField/NumberField.mjs +220 -0
- package/dist/components/ProgressBar/ProgressBar.cjs +132 -0
- package/dist/components/ProgressBar/ProgressBar.d.cts +56 -0
- package/dist/components/ProgressBar/ProgressBar.d.mts +56 -0
- package/dist/components/ProgressBar/ProgressBar.mjs +129 -0
- package/dist/components/RadioGroup/RadioGroup.cjs +218 -0
- package/dist/components/RadioGroup/RadioGroup.d.cts +82 -0
- package/dist/components/RadioGroup/RadioGroup.d.mts +82 -0
- package/dist/components/RadioGroup/RadioGroup.mjs +215 -0
- package/dist/components/Select/Select.cjs +253 -0
- package/dist/components/Select/Select.d.cts +86 -0
- package/dist/components/Select/Select.d.mts +86 -0
- package/dist/components/Select/Select.mjs +250 -0
- package/dist/components/Separator/Separator.cjs +64 -0
- package/dist/components/Separator/Separator.d.cts +44 -0
- package/dist/components/Separator/Separator.d.mts +44 -0
- package/dist/components/Separator/Separator.mjs +63 -0
- package/dist/components/Slider/Slider.cjs +160 -0
- package/dist/components/Slider/Slider.d.cts +45 -0
- package/dist/components/Slider/Slider.d.mts +45 -0
- package/dist/components/Slider/Slider.mjs +159 -0
- package/dist/components/Switch/Switch.cjs +176 -0
- package/dist/components/Switch/Switch.d.cts +43 -0
- package/dist/components/Switch/Switch.d.mts +43 -0
- package/dist/components/Switch/Switch.mjs +175 -0
- package/dist/components/Tabs/Tabs.cjs +180 -0
- package/dist/components/Tabs/Tabs.d.cts +85 -0
- package/dist/components/Tabs/Tabs.d.mts +85 -0
- package/dist/components/Tabs/Tabs.mjs +173 -0
- package/dist/components/Toast/Toast.cjs +218 -0
- package/dist/components/Toast/Toast.d.cts +96 -0
- package/dist/components/Toast/Toast.d.mts +96 -0
- package/dist/components/Toast/Toast.mjs +214 -0
- package/dist/components/ToggleButton/ToggleButton.cjs +125 -0
- package/dist/components/ToggleButton/ToggleButton.d.cts +43 -0
- package/dist/components/ToggleButton/ToggleButton.d.mts +43 -0
- package/dist/components/ToggleButton/ToggleButton.mjs +124 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.cjs +48 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.cts +41 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.mts +41 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.mjs +47 -0
- package/dist/components/Toolbar/Toolbar.cjs +67 -0
- package/dist/components/Toolbar/Toolbar.d.cts +60 -0
- package/dist/components/Toolbar/Toolbar.d.mts +60 -0
- package/dist/components/Toolbar/Toolbar.mjs +66 -0
- package/dist/composites/Accordion/Accordion.cjs +279 -0
- package/dist/composites/Accordion/Accordion.d.cts +176 -0
- package/dist/composites/Accordion/Accordion.d.mts +176 -0
- package/dist/composites/Accordion/Accordion.mjs +270 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.cjs +206 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.cts +166 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.mts +166 -0
- package/dist/composites/ConfirmationDialog/ConfirmationDialog.mjs +203 -0
- package/dist/composites/Dialog/Dialog.cjs +372 -0
- package/dist/composites/Dialog/Dialog.d.cts +234 -0
- package/dist/composites/Dialog/Dialog.d.mts +234 -0
- package/dist/composites/Dialog/Dialog.mjs +360 -0
- package/dist/composites/Disclosure/Disclosure.cjs +214 -0
- package/dist/composites/Disclosure/Disclosure.d.cts +118 -0
- package/dist/composites/Disclosure/Disclosure.d.mts +118 -0
- package/dist/composites/Disclosure/Disclosure.mjs +207 -0
- package/dist/composites/Form/Form.cjs +161 -0
- package/dist/composites/Form/Form.d.cts +176 -0
- package/dist/composites/Form/Form.d.mts +176 -0
- package/dist/composites/Form/Form.mjs +156 -0
- package/dist/composites/Menu/Menu.cjs +190 -0
- package/dist/composites/Menu/Menu.d.cts +158 -0
- package/dist/composites/Menu/Menu.d.mts +158 -0
- package/dist/composites/Menu/Menu.mjs +186 -0
- package/dist/composites/Popover/Popover.cjs +80 -0
- package/dist/composites/Popover/Popover.d.cts +56 -0
- package/dist/composites/Popover/Popover.d.mts +56 -0
- package/dist/composites/Popover/Popover.mjs +78 -0
- package/dist/composites/SearchField/SearchField.cjs +194 -0
- package/dist/composites/SearchField/SearchField.d.cts +81 -0
- package/dist/composites/SearchField/SearchField.d.mts +81 -0
- package/dist/composites/SearchField/SearchField.mjs +189 -0
- package/dist/composites/TagGroup/TagGroup.cjs +212 -0
- package/dist/composites/TagGroup/TagGroup.d.cts +84 -0
- package/dist/composites/TagGroup/TagGroup.d.mts +84 -0
- package/dist/composites/TagGroup/TagGroup.mjs +209 -0
- package/dist/composites/TextArea/TextArea.cjs +190 -0
- package/dist/composites/TextArea/TextArea.d.cts +95 -0
- package/dist/composites/TextArea/TextArea.d.mts +95 -0
- package/dist/composites/TextArea/TextArea.mjs +181 -0
- package/dist/composites/TextField/TextField.cjs +200 -0
- package/dist/composites/TextField/TextField.d.cts +111 -0
- package/dist/composites/TextField/TextField.d.mts +111 -0
- package/dist/composites/TextField/TextField.mjs +191 -0
- package/dist/composites/Tooltip/Tooltip.cjs +79 -0
- package/dist/composites/Tooltip/Tooltip.d.cts +53 -0
- package/dist/composites/Tooltip/Tooltip.d.mts +53 -0
- package/dist/composites/Tooltip/Tooltip.mjs +77 -0
- package/dist/composites/Wizard/Wizard.cjs +333 -0
- package/dist/composites/Wizard/Wizard.d.cts +206 -0
- package/dist/composites/Wizard/Wizard.d.mts +206 -0
- package/dist/composites/Wizard/Wizard.mjs +324 -0
- package/dist/composites/scope.cjs +124 -0
- package/dist/composites/scope.mjs +121 -0
- package/dist/index.cjs +186 -0
- package/dist/index.d.cts +37 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.mjs +39 -0
- package/dist/semantics/componentMeta.d.cts +37 -0
- package/dist/semantics/componentMeta.d.mts +37 -0
- package/dist/semantics/index.cjs +16 -0
- package/dist/semantics/index.d.cts +4 -0
- package/dist/semantics/index.d.mts +4 -0
- package/dist/semantics/index.mjs +3 -0
- package/dist/semantics/taxonomy.cjs +150 -0
- package/dist/semantics/taxonomy.d.cts +153 -0
- package/dist/semantics/taxonomy.d.mts +153 -0
- package/dist/semantics/taxonomy.mjs +140 -0
- package/dist/tokens/escapeHatch.cjs +13 -0
- package/dist/tokens/escapeHatch.mjs +13 -0
- package/dist/tokens/focusRing.cjs +28 -0
- package/dist/tokens/focusRing.mjs +28 -0
- package/dist/tokens/keyframes.cjs +76 -0
- package/dist/tokens/keyframes.mjs +75 -0
- package/dist/tokens/resolveInteractiveStyle.cjs +41 -0
- package/dist/tokens/resolveInteractiveStyle.mjs +41 -0
- package/llms.txt +142 -0
- package/package.json +70 -0
- package/src/tokens/CONTRACT.md +505 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
//#region src/semantics/taxonomy.ts
|
|
3
|
+
/**
|
|
4
|
+
* Layer 1 — Semantic Foundation: Vocabulary
|
|
5
|
+
*
|
|
6
|
+
* Values-first: constants are the source of truth.
|
|
7
|
+
* Types are derived from constants via `typeof … [number]`.
|
|
8
|
+
*
|
|
9
|
+
* No imports — this module is the dependency root of the entire system.
|
|
10
|
+
*
|
|
11
|
+
* @see FSL Lexicon §1–7
|
|
12
|
+
* @see ../tokens/CONTRACT.md — AI-facing guide that consumes this vocabulary
|
|
13
|
+
* to tell component authors which `vars.*` paths to use per Entity.
|
|
14
|
+
*/
|
|
15
|
+
var ENTITIES = ["Action", "Input", "Selection", "Collection", "Overlay", "Navigation", "Disclosure", "Feedback", "Structure"];
|
|
16
|
+
var STRUCTURAL_ROLES = ["root", "control", "surface", "content", "label", "description", "title", "body", "actions", "status", "icon", "indicator", "item", "trigger", "backdrop", "positioner", "closeTrigger", "selectionControl", "leadingAdornment", "trailingAdornment", "validationMessage"];
|
|
17
|
+
var EVALUATIONS = ["primary", "secondary", "accent", "muted", "positive", "caution", "negative"];
|
|
18
|
+
var COMPOSITION_ROLES = ["primaryAction", "secondaryAction", "dismissAction", "heading", "body", "status", "control", "label", "description", "supporting", "selection", "step", "summary", "navigation"];
|
|
19
|
+
var CONSEQUENCES = ["neutral", "committing", "destructive"];
|
|
20
|
+
var STATES = ["default", "hover", "active", "focused", "disabled", "selected", "pressed", "checked", "indeterminate", "expanded", "current", "visited", "droptarget", "invalid"];
|
|
21
|
+
var STATE_PRIORITY = [{
|
|
22
|
+
flag: "isDisabled",
|
|
23
|
+
state: "disabled"
|
|
24
|
+
}, {
|
|
25
|
+
flag: "isInvalid",
|
|
26
|
+
state: "invalid"
|
|
27
|
+
}, {
|
|
28
|
+
flag: "isExpanded",
|
|
29
|
+
state: "expanded"
|
|
30
|
+
}, {
|
|
31
|
+
flag: "isIndeterminate",
|
|
32
|
+
state: "indeterminate"
|
|
33
|
+
}, {
|
|
34
|
+
flag: "isSelected",
|
|
35
|
+
state: "checked"
|
|
36
|
+
}, {
|
|
37
|
+
flag: "isFocusVisible",
|
|
38
|
+
state: "focused"
|
|
39
|
+
}, {
|
|
40
|
+
flag: "isPressed",
|
|
41
|
+
state: "active"
|
|
42
|
+
}, {
|
|
43
|
+
flag: "isHovered",
|
|
44
|
+
state: "hover"
|
|
45
|
+
}];
|
|
46
|
+
/** Which structural roles are legal for each entity. */
|
|
47
|
+
var ENTITY_STRUCTURE = {
|
|
48
|
+
Action: ["root", "control", "icon", "label"],
|
|
49
|
+
Input: ["root", "control", "label", "description", "leadingAdornment", "trailingAdornment", "validationMessage"],
|
|
50
|
+
Selection: ["root", "control", "label", "indicator", "selectionControl", "item"],
|
|
51
|
+
Collection: ["root", "surface", "content", "item", "title", "actions"],
|
|
52
|
+
Overlay: ["root", "surface", "content", "title", "body", "actions", "backdrop", "positioner", "closeTrigger"],
|
|
53
|
+
Navigation: ["root", "control", "label", "icon", "indicator", "item"],
|
|
54
|
+
Disclosure: ["root", "trigger", "content", "icon", "indicator"],
|
|
55
|
+
Feedback: ["root", "content", "icon", "title", "body", "actions", "status", "closeTrigger"],
|
|
56
|
+
Structure: ["root", "surface", "content", "title", "body", "label", "description", "icon", "actions"]
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Which evaluations are legal for each entity.
|
|
60
|
+
*
|
|
61
|
+
* Design note — `Input` and `Selection` carry **no** evaluations. Form
|
|
62
|
+
* controls are data-entry surfaces, not decision hierarchies: there is no
|
|
63
|
+
* authorial choice between `primary`/`secondary`/`muted` for a text field or
|
|
64
|
+
* a checkbox, and validation outcome is not authorial either — it is a
|
|
65
|
+
* runtime fact emitted by a form library or a `validate()` callback.
|
|
66
|
+
*
|
|
67
|
+
* The vocabulary distinction:
|
|
68
|
+
* - `Evaluation` (this matrix) is **authorial emphasis/valence**.
|
|
69
|
+
* - `State.invalid` (see `STATES`) is the **runtime validation outcome**.
|
|
70
|
+
*
|
|
71
|
+
* This mirrors the Lexicon §10.5 distinction `negative ≠ destructive`:
|
|
72
|
+
* evaluation lives in the author's pen, state lives in the user's data. By
|
|
73
|
+
* keeping the two separate the system avoids the shape where a developer is
|
|
74
|
+
* tempted to write `<TextField evaluation="negative">` to express a
|
|
75
|
+
* validation error — that is a category mistake. The correct expression is
|
|
76
|
+
* `<TextField isInvalid />`, which flips the `invalid` state and lets the
|
|
77
|
+
* single neutral chrome become the canonical validation surface.
|
|
78
|
+
*
|
|
79
|
+
* Adjacent slots (description, icon, validationMessage) may still consume
|
|
80
|
+
* `vars.colors.input.{positive|caution|negative}` directly when they need
|
|
81
|
+
* valence — those are *display* of validation context, not the control
|
|
82
|
+
* itself.
|
|
83
|
+
*
|
|
84
|
+
* Consensus pattern across React Aria (`isInvalid`), Adobe Spectrum
|
|
85
|
+
* (`validationState`), Material UI (`error`), Ant Design (`status`), and
|
|
86
|
+
* shadcn/ui (`aria-invalid`): validation is exposed as boolean state on the
|
|
87
|
+
* control, not as a coloring variant.
|
|
88
|
+
*/
|
|
89
|
+
var ENTITY_EVALUATION = {
|
|
90
|
+
Action: ["primary", "secondary", "accent", "muted", "negative"],
|
|
91
|
+
Input: [],
|
|
92
|
+
Selection: [],
|
|
93
|
+
Collection: ["primary", "muted"],
|
|
94
|
+
Overlay: ["primary", "secondary", "accent", "muted", "negative"],
|
|
95
|
+
Navigation: ["primary", "secondary", "accent", "muted"],
|
|
96
|
+
Disclosure: ["primary", "muted"],
|
|
97
|
+
Feedback: ["primary", "positive", "caution", "negative"],
|
|
98
|
+
Structure: ["primary", "muted"]
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Which composition roles an entity of this kind may play inside a parent
|
|
102
|
+
* composite. `[]` means the entity is a host or leaf: it does not participate
|
|
103
|
+
* in a larger composition as a slot-bearing child.
|
|
104
|
+
*
|
|
105
|
+
* Readmit roles per-entity only when a concrete component exercises the slot.
|
|
106
|
+
*/
|
|
107
|
+
var ENTITY_COMPOSITION = {
|
|
108
|
+
Action: ["primaryAction", "secondaryAction", "dismissAction"],
|
|
109
|
+
Input: ["control", "label", "description", "status", "supporting"],
|
|
110
|
+
Selection: ["control", "selection", "label", "description"],
|
|
111
|
+
Collection: [],
|
|
112
|
+
Overlay: ["heading", "body"],
|
|
113
|
+
Navigation: [],
|
|
114
|
+
Disclosure: [],
|
|
115
|
+
Feedback: ["status"],
|
|
116
|
+
Structure: ["heading", "body", "label", "description", "supporting", "step", "summary", "navigation"]
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Which consequence values are legal for each entity.
|
|
120
|
+
*
|
|
121
|
+
* `Action` is the only entity whose interactions produce authorial effect-
|
|
122
|
+
* on-state today (`committing` submits, `destructive` deletes, `neutral`
|
|
123
|
+
* everything else). Other entities' interactions — input entry, navigation
|
|
124
|
+
* — do not carry the same authorial "what does this do" meta and are
|
|
125
|
+
* intentionally left empty.
|
|
126
|
+
*/
|
|
127
|
+
var ENTITY_CONSEQUENCE = {
|
|
128
|
+
Action: ["neutral", "committing", "destructive"],
|
|
129
|
+
Input: [],
|
|
130
|
+
Selection: [],
|
|
131
|
+
Collection: [],
|
|
132
|
+
Overlay: [],
|
|
133
|
+
Navigation: [],
|
|
134
|
+
Disclosure: [],
|
|
135
|
+
Feedback: [],
|
|
136
|
+
Structure: []
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
140
|
+
exports.COMPOSITION_ROLES = COMPOSITION_ROLES;
|
|
141
|
+
exports.CONSEQUENCES = CONSEQUENCES;
|
|
142
|
+
exports.ENTITIES = ENTITIES;
|
|
143
|
+
exports.ENTITY_COMPOSITION = ENTITY_COMPOSITION;
|
|
144
|
+
exports.ENTITY_CONSEQUENCE = ENTITY_CONSEQUENCE;
|
|
145
|
+
exports.ENTITY_EVALUATION = ENTITY_EVALUATION;
|
|
146
|
+
exports.ENTITY_STRUCTURE = ENTITY_STRUCTURE;
|
|
147
|
+
exports.EVALUATIONS = EVALUATIONS;
|
|
148
|
+
exports.STATES = STATES;
|
|
149
|
+
exports.STATE_PRIORITY = STATE_PRIORITY;
|
|
150
|
+
exports.STRUCTURAL_ROLES = STRUCTURAL_ROLES;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/semantics/taxonomy.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Layer 1 — Semantic Foundation: Vocabulary
|
|
5
|
+
*
|
|
6
|
+
* Values-first: constants are the source of truth.
|
|
7
|
+
* Types are derived from constants via `typeof … [number]`.
|
|
8
|
+
*
|
|
9
|
+
* No imports — this module is the dependency root of the entire system.
|
|
10
|
+
*
|
|
11
|
+
* @see FSL Lexicon §1–7
|
|
12
|
+
* @see ../tokens/CONTRACT.md — AI-facing guide that consumes this vocabulary
|
|
13
|
+
* to tell component authors which `vars.*` paths to use per Entity.
|
|
14
|
+
*/
|
|
15
|
+
declare const ENTITIES: readonly ["Action", "Input", "Selection", "Collection", "Overlay", "Navigation", "Disclosure", "Feedback", "Structure"];
|
|
16
|
+
type Entity = (typeof ENTITIES)[number];
|
|
17
|
+
declare const STRUCTURAL_ROLES: readonly ["root", "control", "surface", "content", "label", "description", "title", "body", "actions", "status", "icon", "indicator", "item", "trigger", "backdrop", "positioner", "closeTrigger", "selectionControl", "leadingAdornment", "trailingAdornment", "validationMessage"];
|
|
18
|
+
type StructuralRole = (typeof STRUCTURAL_ROLES)[number];
|
|
19
|
+
declare const EVALUATIONS: readonly ["primary", "secondary", "accent", "muted", "positive", "caution", "negative"];
|
|
20
|
+
type Evaluation = (typeof EVALUATIONS)[number];
|
|
21
|
+
declare const COMPOSITION_ROLES: readonly ["primaryAction", "secondaryAction", "dismissAction", "heading", "body", "status", "control", "label", "description", "supporting", "selection", "step", "summary", "navigation"];
|
|
22
|
+
type CompositionRole = (typeof COMPOSITION_ROLES)[number];
|
|
23
|
+
declare const CONSEQUENCES: readonly ["neutral", "committing", "destructive"];
|
|
24
|
+
type Consequence = (typeof CONSEQUENCES)[number];
|
|
25
|
+
declare const STATES: readonly ["default", "hover", "active", "focused", "disabled", "selected", "pressed", "checked", "indeterminate", "expanded", "current", "visited", "droptarget", "invalid"];
|
|
26
|
+
type State = (typeof STATES)[number];
|
|
27
|
+
declare const STATE_PRIORITY: readonly [{
|
|
28
|
+
readonly flag: "isDisabled";
|
|
29
|
+
readonly state: "disabled";
|
|
30
|
+
}, {
|
|
31
|
+
readonly flag: "isInvalid";
|
|
32
|
+
readonly state: "invalid";
|
|
33
|
+
}, {
|
|
34
|
+
readonly flag: "isExpanded";
|
|
35
|
+
readonly state: "expanded";
|
|
36
|
+
}, {
|
|
37
|
+
readonly flag: "isIndeterminate";
|
|
38
|
+
readonly state: "indeterminate";
|
|
39
|
+
}, {
|
|
40
|
+
readonly flag: "isSelected";
|
|
41
|
+
readonly state: "checked";
|
|
42
|
+
}, {
|
|
43
|
+
readonly flag: "isFocusVisible";
|
|
44
|
+
readonly state: "focused";
|
|
45
|
+
}, {
|
|
46
|
+
readonly flag: "isPressed";
|
|
47
|
+
readonly state: "active";
|
|
48
|
+
}, {
|
|
49
|
+
readonly flag: "isHovered";
|
|
50
|
+
readonly state: "hover";
|
|
51
|
+
}];
|
|
52
|
+
/** Which structural roles are legal for each entity. */
|
|
53
|
+
declare const ENTITY_STRUCTURE: {
|
|
54
|
+
readonly Action: readonly ["root", "control", "icon", "label"];
|
|
55
|
+
readonly Input: readonly ["root", "control", "label", "description", "leadingAdornment", "trailingAdornment", "validationMessage"];
|
|
56
|
+
readonly Selection: readonly ["root", "control", "label", "indicator", "selectionControl", "item"];
|
|
57
|
+
readonly Collection: readonly ["root", "surface", "content", "item", "title", "actions"];
|
|
58
|
+
readonly Overlay: readonly ["root", "surface", "content", "title", "body", "actions", "backdrop", "positioner", "closeTrigger"];
|
|
59
|
+
readonly Navigation: readonly ["root", "control", "label", "icon", "indicator", "item"];
|
|
60
|
+
readonly Disclosure: readonly ["root", "trigger", "content", "icon", "indicator"];
|
|
61
|
+
readonly Feedback: readonly ["root", "content", "icon", "title", "body", "actions", "status", "closeTrigger"];
|
|
62
|
+
readonly Structure: readonly ["root", "surface", "content", "title", "body", "label", "description", "icon", "actions"];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Which evaluations are legal for each entity.
|
|
66
|
+
*
|
|
67
|
+
* Design note — `Input` and `Selection` carry **no** evaluations. Form
|
|
68
|
+
* controls are data-entry surfaces, not decision hierarchies: there is no
|
|
69
|
+
* authorial choice between `primary`/`secondary`/`muted` for a text field or
|
|
70
|
+
* a checkbox, and validation outcome is not authorial either — it is a
|
|
71
|
+
* runtime fact emitted by a form library or a `validate()` callback.
|
|
72
|
+
*
|
|
73
|
+
* The vocabulary distinction:
|
|
74
|
+
* - `Evaluation` (this matrix) is **authorial emphasis/valence**.
|
|
75
|
+
* - `State.invalid` (see `STATES`) is the **runtime validation outcome**.
|
|
76
|
+
*
|
|
77
|
+
* This mirrors the Lexicon §10.5 distinction `negative ≠ destructive`:
|
|
78
|
+
* evaluation lives in the author's pen, state lives in the user's data. By
|
|
79
|
+
* keeping the two separate the system avoids the shape where a developer is
|
|
80
|
+
* tempted to write `<TextField evaluation="negative">` to express a
|
|
81
|
+
* validation error — that is a category mistake. The correct expression is
|
|
82
|
+
* `<TextField isInvalid />`, which flips the `invalid` state and lets the
|
|
83
|
+
* single neutral chrome become the canonical validation surface.
|
|
84
|
+
*
|
|
85
|
+
* Adjacent slots (description, icon, validationMessage) may still consume
|
|
86
|
+
* `vars.colors.input.{positive|caution|negative}` directly when they need
|
|
87
|
+
* valence — those are *display* of validation context, not the control
|
|
88
|
+
* itself.
|
|
89
|
+
*
|
|
90
|
+
* Consensus pattern across React Aria (`isInvalid`), Adobe Spectrum
|
|
91
|
+
* (`validationState`), Material UI (`error`), Ant Design (`status`), and
|
|
92
|
+
* shadcn/ui (`aria-invalid`): validation is exposed as boolean state on the
|
|
93
|
+
* control, not as a coloring variant.
|
|
94
|
+
*/
|
|
95
|
+
declare const ENTITY_EVALUATION: {
|
|
96
|
+
readonly Action: readonly ["primary", "secondary", "accent", "muted", "negative"];
|
|
97
|
+
readonly Input: readonly [];
|
|
98
|
+
readonly Selection: readonly [];
|
|
99
|
+
readonly Collection: readonly ["primary", "muted"];
|
|
100
|
+
readonly Overlay: readonly ["primary", "secondary", "accent", "muted", "negative"];
|
|
101
|
+
readonly Navigation: readonly ["primary", "secondary", "accent", "muted"];
|
|
102
|
+
readonly Disclosure: readonly ["primary", "muted"];
|
|
103
|
+
readonly Feedback: readonly ["primary", "positive", "caution", "negative"];
|
|
104
|
+
readonly Structure: readonly ["primary", "muted"];
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Which composition roles an entity of this kind may play inside a parent
|
|
108
|
+
* composite. `[]` means the entity is a host or leaf: it does not participate
|
|
109
|
+
* in a larger composition as a slot-bearing child.
|
|
110
|
+
*
|
|
111
|
+
* Readmit roles per-entity only when a concrete component exercises the slot.
|
|
112
|
+
*/
|
|
113
|
+
declare const ENTITY_COMPOSITION: {
|
|
114
|
+
readonly Action: readonly ["primaryAction", "secondaryAction", "dismissAction"];
|
|
115
|
+
readonly Input: readonly ["control", "label", "description", "status", "supporting"];
|
|
116
|
+
readonly Selection: readonly ["control", "selection", "label", "description"];
|
|
117
|
+
readonly Collection: readonly [];
|
|
118
|
+
readonly Overlay: readonly ["heading", "body"];
|
|
119
|
+
readonly Navigation: readonly [];
|
|
120
|
+
readonly Disclosure: readonly [];
|
|
121
|
+
readonly Feedback: readonly ["status"];
|
|
122
|
+
readonly Structure: readonly ["heading", "body", "label", "description", "supporting", "step", "summary", "navigation"];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Which consequence values are legal for each entity.
|
|
126
|
+
*
|
|
127
|
+
* `Action` is the only entity whose interactions produce authorial effect-
|
|
128
|
+
* on-state today (`committing` submits, `destructive` deletes, `neutral`
|
|
129
|
+
* everything else). Other entities' interactions — input entry, navigation
|
|
130
|
+
* — do not carry the same authorial "what does this do" meta and are
|
|
131
|
+
* intentionally left empty.
|
|
132
|
+
*/
|
|
133
|
+
declare const ENTITY_CONSEQUENCE: {
|
|
134
|
+
readonly Action: readonly ["neutral", "committing", "destructive"];
|
|
135
|
+
readonly Input: readonly [];
|
|
136
|
+
readonly Selection: readonly [];
|
|
137
|
+
readonly Collection: readonly [];
|
|
138
|
+
readonly Overlay: readonly [];
|
|
139
|
+
readonly Navigation: readonly [];
|
|
140
|
+
readonly Disclosure: readonly [];
|
|
141
|
+
readonly Feedback: readonly [];
|
|
142
|
+
readonly Structure: readonly [];
|
|
143
|
+
};
|
|
144
|
+
/** Structural roles that are legal for entity E. */
|
|
145
|
+
type StructuresFor<E extends Entity> = (typeof ENTITY_STRUCTURE)[E][number];
|
|
146
|
+
/** Evaluations that are legal for entity E. */
|
|
147
|
+
type EvaluationsFor<E extends Entity> = (typeof ENTITY_EVALUATION)[E][number];
|
|
148
|
+
/** Composition roles that are legal for entity E. */
|
|
149
|
+
type CompositionsFor<E extends Entity> = (typeof ENTITY_COMPOSITION)[E][number];
|
|
150
|
+
/** Consequence values that are legal for entity E. */
|
|
151
|
+
type ConsequencesFor<E extends Entity> = (typeof ENTITY_CONSEQUENCE)[E][number];
|
|
152
|
+
//#endregion
|
|
153
|
+
export { COMPOSITION_ROLES, CONSEQUENCES, CompositionRole, CompositionsFor, Consequence, ConsequencesFor, ENTITIES, ENTITY_COMPOSITION, ENTITY_CONSEQUENCE, ENTITY_EVALUATION, ENTITY_STRUCTURE, EVALUATIONS, Entity, Evaluation, EvaluationsFor, STATES, STATE_PRIORITY, STRUCTURAL_ROLES, State, StructuralRole, StructuresFor };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/semantics/taxonomy.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Layer 1 — Semantic Foundation: Vocabulary
|
|
5
|
+
*
|
|
6
|
+
* Values-first: constants are the source of truth.
|
|
7
|
+
* Types are derived from constants via `typeof … [number]`.
|
|
8
|
+
*
|
|
9
|
+
* No imports — this module is the dependency root of the entire system.
|
|
10
|
+
*
|
|
11
|
+
* @see FSL Lexicon §1–7
|
|
12
|
+
* @see ../tokens/CONTRACT.md — AI-facing guide that consumes this vocabulary
|
|
13
|
+
* to tell component authors which `vars.*` paths to use per Entity.
|
|
14
|
+
*/
|
|
15
|
+
declare const ENTITIES: readonly ["Action", "Input", "Selection", "Collection", "Overlay", "Navigation", "Disclosure", "Feedback", "Structure"];
|
|
16
|
+
type Entity = (typeof ENTITIES)[number];
|
|
17
|
+
declare const STRUCTURAL_ROLES: readonly ["root", "control", "surface", "content", "label", "description", "title", "body", "actions", "status", "icon", "indicator", "item", "trigger", "backdrop", "positioner", "closeTrigger", "selectionControl", "leadingAdornment", "trailingAdornment", "validationMessage"];
|
|
18
|
+
type StructuralRole = (typeof STRUCTURAL_ROLES)[number];
|
|
19
|
+
declare const EVALUATIONS: readonly ["primary", "secondary", "accent", "muted", "positive", "caution", "negative"];
|
|
20
|
+
type Evaluation = (typeof EVALUATIONS)[number];
|
|
21
|
+
declare const COMPOSITION_ROLES: readonly ["primaryAction", "secondaryAction", "dismissAction", "heading", "body", "status", "control", "label", "description", "supporting", "selection", "step", "summary", "navigation"];
|
|
22
|
+
type CompositionRole = (typeof COMPOSITION_ROLES)[number];
|
|
23
|
+
declare const CONSEQUENCES: readonly ["neutral", "committing", "destructive"];
|
|
24
|
+
type Consequence = (typeof CONSEQUENCES)[number];
|
|
25
|
+
declare const STATES: readonly ["default", "hover", "active", "focused", "disabled", "selected", "pressed", "checked", "indeterminate", "expanded", "current", "visited", "droptarget", "invalid"];
|
|
26
|
+
type State = (typeof STATES)[number];
|
|
27
|
+
declare const STATE_PRIORITY: readonly [{
|
|
28
|
+
readonly flag: "isDisabled";
|
|
29
|
+
readonly state: "disabled";
|
|
30
|
+
}, {
|
|
31
|
+
readonly flag: "isInvalid";
|
|
32
|
+
readonly state: "invalid";
|
|
33
|
+
}, {
|
|
34
|
+
readonly flag: "isExpanded";
|
|
35
|
+
readonly state: "expanded";
|
|
36
|
+
}, {
|
|
37
|
+
readonly flag: "isIndeterminate";
|
|
38
|
+
readonly state: "indeterminate";
|
|
39
|
+
}, {
|
|
40
|
+
readonly flag: "isSelected";
|
|
41
|
+
readonly state: "checked";
|
|
42
|
+
}, {
|
|
43
|
+
readonly flag: "isFocusVisible";
|
|
44
|
+
readonly state: "focused";
|
|
45
|
+
}, {
|
|
46
|
+
readonly flag: "isPressed";
|
|
47
|
+
readonly state: "active";
|
|
48
|
+
}, {
|
|
49
|
+
readonly flag: "isHovered";
|
|
50
|
+
readonly state: "hover";
|
|
51
|
+
}];
|
|
52
|
+
/** Which structural roles are legal for each entity. */
|
|
53
|
+
declare const ENTITY_STRUCTURE: {
|
|
54
|
+
readonly Action: readonly ["root", "control", "icon", "label"];
|
|
55
|
+
readonly Input: readonly ["root", "control", "label", "description", "leadingAdornment", "trailingAdornment", "validationMessage"];
|
|
56
|
+
readonly Selection: readonly ["root", "control", "label", "indicator", "selectionControl", "item"];
|
|
57
|
+
readonly Collection: readonly ["root", "surface", "content", "item", "title", "actions"];
|
|
58
|
+
readonly Overlay: readonly ["root", "surface", "content", "title", "body", "actions", "backdrop", "positioner", "closeTrigger"];
|
|
59
|
+
readonly Navigation: readonly ["root", "control", "label", "icon", "indicator", "item"];
|
|
60
|
+
readonly Disclosure: readonly ["root", "trigger", "content", "icon", "indicator"];
|
|
61
|
+
readonly Feedback: readonly ["root", "content", "icon", "title", "body", "actions", "status", "closeTrigger"];
|
|
62
|
+
readonly Structure: readonly ["root", "surface", "content", "title", "body", "label", "description", "icon", "actions"];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Which evaluations are legal for each entity.
|
|
66
|
+
*
|
|
67
|
+
* Design note — `Input` and `Selection` carry **no** evaluations. Form
|
|
68
|
+
* controls are data-entry surfaces, not decision hierarchies: there is no
|
|
69
|
+
* authorial choice between `primary`/`secondary`/`muted` for a text field or
|
|
70
|
+
* a checkbox, and validation outcome is not authorial either — it is a
|
|
71
|
+
* runtime fact emitted by a form library or a `validate()` callback.
|
|
72
|
+
*
|
|
73
|
+
* The vocabulary distinction:
|
|
74
|
+
* - `Evaluation` (this matrix) is **authorial emphasis/valence**.
|
|
75
|
+
* - `State.invalid` (see `STATES`) is the **runtime validation outcome**.
|
|
76
|
+
*
|
|
77
|
+
* This mirrors the Lexicon §10.5 distinction `negative ≠ destructive`:
|
|
78
|
+
* evaluation lives in the author's pen, state lives in the user's data. By
|
|
79
|
+
* keeping the two separate the system avoids the shape where a developer is
|
|
80
|
+
* tempted to write `<TextField evaluation="negative">` to express a
|
|
81
|
+
* validation error — that is a category mistake. The correct expression is
|
|
82
|
+
* `<TextField isInvalid />`, which flips the `invalid` state and lets the
|
|
83
|
+
* single neutral chrome become the canonical validation surface.
|
|
84
|
+
*
|
|
85
|
+
* Adjacent slots (description, icon, validationMessage) may still consume
|
|
86
|
+
* `vars.colors.input.{positive|caution|negative}` directly when they need
|
|
87
|
+
* valence — those are *display* of validation context, not the control
|
|
88
|
+
* itself.
|
|
89
|
+
*
|
|
90
|
+
* Consensus pattern across React Aria (`isInvalid`), Adobe Spectrum
|
|
91
|
+
* (`validationState`), Material UI (`error`), Ant Design (`status`), and
|
|
92
|
+
* shadcn/ui (`aria-invalid`): validation is exposed as boolean state on the
|
|
93
|
+
* control, not as a coloring variant.
|
|
94
|
+
*/
|
|
95
|
+
declare const ENTITY_EVALUATION: {
|
|
96
|
+
readonly Action: readonly ["primary", "secondary", "accent", "muted", "negative"];
|
|
97
|
+
readonly Input: readonly [];
|
|
98
|
+
readonly Selection: readonly [];
|
|
99
|
+
readonly Collection: readonly ["primary", "muted"];
|
|
100
|
+
readonly Overlay: readonly ["primary", "secondary", "accent", "muted", "negative"];
|
|
101
|
+
readonly Navigation: readonly ["primary", "secondary", "accent", "muted"];
|
|
102
|
+
readonly Disclosure: readonly ["primary", "muted"];
|
|
103
|
+
readonly Feedback: readonly ["primary", "positive", "caution", "negative"];
|
|
104
|
+
readonly Structure: readonly ["primary", "muted"];
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Which composition roles an entity of this kind may play inside a parent
|
|
108
|
+
* composite. `[]` means the entity is a host or leaf: it does not participate
|
|
109
|
+
* in a larger composition as a slot-bearing child.
|
|
110
|
+
*
|
|
111
|
+
* Readmit roles per-entity only when a concrete component exercises the slot.
|
|
112
|
+
*/
|
|
113
|
+
declare const ENTITY_COMPOSITION: {
|
|
114
|
+
readonly Action: readonly ["primaryAction", "secondaryAction", "dismissAction"];
|
|
115
|
+
readonly Input: readonly ["control", "label", "description", "status", "supporting"];
|
|
116
|
+
readonly Selection: readonly ["control", "selection", "label", "description"];
|
|
117
|
+
readonly Collection: readonly [];
|
|
118
|
+
readonly Overlay: readonly ["heading", "body"];
|
|
119
|
+
readonly Navigation: readonly [];
|
|
120
|
+
readonly Disclosure: readonly [];
|
|
121
|
+
readonly Feedback: readonly ["status"];
|
|
122
|
+
readonly Structure: readonly ["heading", "body", "label", "description", "supporting", "step", "summary", "navigation"];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Which consequence values are legal for each entity.
|
|
126
|
+
*
|
|
127
|
+
* `Action` is the only entity whose interactions produce authorial effect-
|
|
128
|
+
* on-state today (`committing` submits, `destructive` deletes, `neutral`
|
|
129
|
+
* everything else). Other entities' interactions — input entry, navigation
|
|
130
|
+
* — do not carry the same authorial "what does this do" meta and are
|
|
131
|
+
* intentionally left empty.
|
|
132
|
+
*/
|
|
133
|
+
declare const ENTITY_CONSEQUENCE: {
|
|
134
|
+
readonly Action: readonly ["neutral", "committing", "destructive"];
|
|
135
|
+
readonly Input: readonly [];
|
|
136
|
+
readonly Selection: readonly [];
|
|
137
|
+
readonly Collection: readonly [];
|
|
138
|
+
readonly Overlay: readonly [];
|
|
139
|
+
readonly Navigation: readonly [];
|
|
140
|
+
readonly Disclosure: readonly [];
|
|
141
|
+
readonly Feedback: readonly [];
|
|
142
|
+
readonly Structure: readonly [];
|
|
143
|
+
};
|
|
144
|
+
/** Structural roles that are legal for entity E. */
|
|
145
|
+
type StructuresFor<E extends Entity> = (typeof ENTITY_STRUCTURE)[E][number];
|
|
146
|
+
/** Evaluations that are legal for entity E. */
|
|
147
|
+
type EvaluationsFor<E extends Entity> = (typeof ENTITY_EVALUATION)[E][number];
|
|
148
|
+
/** Composition roles that are legal for entity E. */
|
|
149
|
+
type CompositionsFor<E extends Entity> = (typeof ENTITY_COMPOSITION)[E][number];
|
|
150
|
+
/** Consequence values that are legal for entity E. */
|
|
151
|
+
type ConsequencesFor<E extends Entity> = (typeof ENTITY_CONSEQUENCE)[E][number];
|
|
152
|
+
//#endregion
|
|
153
|
+
export { COMPOSITION_ROLES, CONSEQUENCES, CompositionRole, CompositionsFor, Consequence, ConsequencesFor, ENTITIES, ENTITY_COMPOSITION, ENTITY_CONSEQUENCE, ENTITY_EVALUATION, ENTITY_STRUCTURE, EVALUATIONS, Entity, Evaluation, EvaluationsFor, STATES, STATE_PRIORITY, STRUCTURAL_ROLES, State, StructuralRole, StructuresFor };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
//#region src/semantics/taxonomy.ts
|
|
3
|
+
/**
|
|
4
|
+
* Layer 1 — Semantic Foundation: Vocabulary
|
|
5
|
+
*
|
|
6
|
+
* Values-first: constants are the source of truth.
|
|
7
|
+
* Types are derived from constants via `typeof … [number]`.
|
|
8
|
+
*
|
|
9
|
+
* No imports — this module is the dependency root of the entire system.
|
|
10
|
+
*
|
|
11
|
+
* @see FSL Lexicon §1–7
|
|
12
|
+
* @see ../tokens/CONTRACT.md — AI-facing guide that consumes this vocabulary
|
|
13
|
+
* to tell component authors which `vars.*` paths to use per Entity.
|
|
14
|
+
*/
|
|
15
|
+
var ENTITIES = ["Action", "Input", "Selection", "Collection", "Overlay", "Navigation", "Disclosure", "Feedback", "Structure"];
|
|
16
|
+
var STRUCTURAL_ROLES = ["root", "control", "surface", "content", "label", "description", "title", "body", "actions", "status", "icon", "indicator", "item", "trigger", "backdrop", "positioner", "closeTrigger", "selectionControl", "leadingAdornment", "trailingAdornment", "validationMessage"];
|
|
17
|
+
var EVALUATIONS = ["primary", "secondary", "accent", "muted", "positive", "caution", "negative"];
|
|
18
|
+
var COMPOSITION_ROLES = ["primaryAction", "secondaryAction", "dismissAction", "heading", "body", "status", "control", "label", "description", "supporting", "selection", "step", "summary", "navigation"];
|
|
19
|
+
var CONSEQUENCES = ["neutral", "committing", "destructive"];
|
|
20
|
+
var STATES = ["default", "hover", "active", "focused", "disabled", "selected", "pressed", "checked", "indeterminate", "expanded", "current", "visited", "droptarget", "invalid"];
|
|
21
|
+
var STATE_PRIORITY = [{
|
|
22
|
+
flag: "isDisabled",
|
|
23
|
+
state: "disabled"
|
|
24
|
+
}, {
|
|
25
|
+
flag: "isInvalid",
|
|
26
|
+
state: "invalid"
|
|
27
|
+
}, {
|
|
28
|
+
flag: "isExpanded",
|
|
29
|
+
state: "expanded"
|
|
30
|
+
}, {
|
|
31
|
+
flag: "isIndeterminate",
|
|
32
|
+
state: "indeterminate"
|
|
33
|
+
}, {
|
|
34
|
+
flag: "isSelected",
|
|
35
|
+
state: "checked"
|
|
36
|
+
}, {
|
|
37
|
+
flag: "isFocusVisible",
|
|
38
|
+
state: "focused"
|
|
39
|
+
}, {
|
|
40
|
+
flag: "isPressed",
|
|
41
|
+
state: "active"
|
|
42
|
+
}, {
|
|
43
|
+
flag: "isHovered",
|
|
44
|
+
state: "hover"
|
|
45
|
+
}];
|
|
46
|
+
/** Which structural roles are legal for each entity. */
|
|
47
|
+
var ENTITY_STRUCTURE = {
|
|
48
|
+
Action: ["root", "control", "icon", "label"],
|
|
49
|
+
Input: ["root", "control", "label", "description", "leadingAdornment", "trailingAdornment", "validationMessage"],
|
|
50
|
+
Selection: ["root", "control", "label", "indicator", "selectionControl", "item"],
|
|
51
|
+
Collection: ["root", "surface", "content", "item", "title", "actions"],
|
|
52
|
+
Overlay: ["root", "surface", "content", "title", "body", "actions", "backdrop", "positioner", "closeTrigger"],
|
|
53
|
+
Navigation: ["root", "control", "label", "icon", "indicator", "item"],
|
|
54
|
+
Disclosure: ["root", "trigger", "content", "icon", "indicator"],
|
|
55
|
+
Feedback: ["root", "content", "icon", "title", "body", "actions", "status", "closeTrigger"],
|
|
56
|
+
Structure: ["root", "surface", "content", "title", "body", "label", "description", "icon", "actions"]
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Which evaluations are legal for each entity.
|
|
60
|
+
*
|
|
61
|
+
* Design note — `Input` and `Selection` carry **no** evaluations. Form
|
|
62
|
+
* controls are data-entry surfaces, not decision hierarchies: there is no
|
|
63
|
+
* authorial choice between `primary`/`secondary`/`muted` for a text field or
|
|
64
|
+
* a checkbox, and validation outcome is not authorial either — it is a
|
|
65
|
+
* runtime fact emitted by a form library or a `validate()` callback.
|
|
66
|
+
*
|
|
67
|
+
* The vocabulary distinction:
|
|
68
|
+
* - `Evaluation` (this matrix) is **authorial emphasis/valence**.
|
|
69
|
+
* - `State.invalid` (see `STATES`) is the **runtime validation outcome**.
|
|
70
|
+
*
|
|
71
|
+
* This mirrors the Lexicon §10.5 distinction `negative ≠ destructive`:
|
|
72
|
+
* evaluation lives in the author's pen, state lives in the user's data. By
|
|
73
|
+
* keeping the two separate the system avoids the shape where a developer is
|
|
74
|
+
* tempted to write `<TextField evaluation="negative">` to express a
|
|
75
|
+
* validation error — that is a category mistake. The correct expression is
|
|
76
|
+
* `<TextField isInvalid />`, which flips the `invalid` state and lets the
|
|
77
|
+
* single neutral chrome become the canonical validation surface.
|
|
78
|
+
*
|
|
79
|
+
* Adjacent slots (description, icon, validationMessage) may still consume
|
|
80
|
+
* `vars.colors.input.{positive|caution|negative}` directly when they need
|
|
81
|
+
* valence — those are *display* of validation context, not the control
|
|
82
|
+
* itself.
|
|
83
|
+
*
|
|
84
|
+
* Consensus pattern across React Aria (`isInvalid`), Adobe Spectrum
|
|
85
|
+
* (`validationState`), Material UI (`error`), Ant Design (`status`), and
|
|
86
|
+
* shadcn/ui (`aria-invalid`): validation is exposed as boolean state on the
|
|
87
|
+
* control, not as a coloring variant.
|
|
88
|
+
*/
|
|
89
|
+
var ENTITY_EVALUATION = {
|
|
90
|
+
Action: ["primary", "secondary", "accent", "muted", "negative"],
|
|
91
|
+
Input: [],
|
|
92
|
+
Selection: [],
|
|
93
|
+
Collection: ["primary", "muted"],
|
|
94
|
+
Overlay: ["primary", "secondary", "accent", "muted", "negative"],
|
|
95
|
+
Navigation: ["primary", "secondary", "accent", "muted"],
|
|
96
|
+
Disclosure: ["primary", "muted"],
|
|
97
|
+
Feedback: ["primary", "positive", "caution", "negative"],
|
|
98
|
+
Structure: ["primary", "muted"]
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Which composition roles an entity of this kind may play inside a parent
|
|
102
|
+
* composite. `[]` means the entity is a host or leaf: it does not participate
|
|
103
|
+
* in a larger composition as a slot-bearing child.
|
|
104
|
+
*
|
|
105
|
+
* Readmit roles per-entity only when a concrete component exercises the slot.
|
|
106
|
+
*/
|
|
107
|
+
var ENTITY_COMPOSITION = {
|
|
108
|
+
Action: ["primaryAction", "secondaryAction", "dismissAction"],
|
|
109
|
+
Input: ["control", "label", "description", "status", "supporting"],
|
|
110
|
+
Selection: ["control", "selection", "label", "description"],
|
|
111
|
+
Collection: [],
|
|
112
|
+
Overlay: ["heading", "body"],
|
|
113
|
+
Navigation: [],
|
|
114
|
+
Disclosure: [],
|
|
115
|
+
Feedback: ["status"],
|
|
116
|
+
Structure: ["heading", "body", "label", "description", "supporting", "step", "summary", "navigation"]
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Which consequence values are legal for each entity.
|
|
120
|
+
*
|
|
121
|
+
* `Action` is the only entity whose interactions produce authorial effect-
|
|
122
|
+
* on-state today (`committing` submits, `destructive` deletes, `neutral`
|
|
123
|
+
* everything else). Other entities' interactions — input entry, navigation
|
|
124
|
+
* — do not carry the same authorial "what does this do" meta and are
|
|
125
|
+
* intentionally left empty.
|
|
126
|
+
*/
|
|
127
|
+
var ENTITY_CONSEQUENCE = {
|
|
128
|
+
Action: ["neutral", "committing", "destructive"],
|
|
129
|
+
Input: [],
|
|
130
|
+
Selection: [],
|
|
131
|
+
Collection: [],
|
|
132
|
+
Overlay: [],
|
|
133
|
+
Navigation: [],
|
|
134
|
+
Disclosure: [],
|
|
135
|
+
Feedback: [],
|
|
136
|
+
Structure: []
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
140
|
+
export { COMPOSITION_ROLES, CONSEQUENCES, ENTITIES, ENTITY_COMPOSITION, ENTITY_CONSEQUENCE, ENTITY_EVALUATION, ENTITY_STRUCTURE, EVALUATIONS, STATES, STATE_PRIORITY, STRUCTURAL_ROLES };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
//#region src/tokens/escapeHatch.ts
|
|
3
|
+
/**
|
|
4
|
+
* Composes a `var()` read of a host knob with its required fallback.
|
|
5
|
+
* The fallback is the component's default — a knob without a fallback is a
|
|
6
|
+
* contract violation (enforced by the contract test suite).
|
|
7
|
+
*/
|
|
8
|
+
var fslVar = (knob, fallback) => {
|
|
9
|
+
return `var(${knob}, ${fallback})`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.fslVar = fslVar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
//#region src/tokens/escapeHatch.ts
|
|
3
|
+
/**
|
|
4
|
+
* Composes a `var()` read of a host knob with its required fallback.
|
|
5
|
+
* The fallback is the component's default — a knob without a fallback is a
|
|
6
|
+
* contract violation (enforced by the contract test suite).
|
|
7
|
+
*/
|
|
8
|
+
var fslVar = (knob, fallback) => {
|
|
9
|
+
return `var(${knob}, ${fallback})`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { fslVar };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
let _ttoss_fsl_theme_vars = require("@ttoss/fsl-theme/vars");
|
|
3
|
+
|
|
4
|
+
//#region src/tokens/focusRing.ts
|
|
5
|
+
/**
|
|
6
|
+
* Focus ring resolver — the cross-cutting keyboard-focus outline every
|
|
7
|
+
* interactive component applies per `CONTRACT.md §3`:
|
|
8
|
+
*
|
|
9
|
+
* - always via `outline` (never `border`) so focus cannot layout-shift;
|
|
10
|
+
* - always from the cross-cutting `vars.focus.ring.*` tokens (CONTRACT §1
|
|
11
|
+
* cross-cutting table), never from per-entity color subtrees.
|
|
12
|
+
*
|
|
13
|
+
* Companion to `resolveInteractiveStyle`: that helper owns the state
|
|
14
|
+
* cascade for color dimensions; this one owns the single state-dependent
|
|
15
|
+
* outline. Both exist so components never re-implement state ternaries
|
|
16
|
+
* (structural tokens like radii/spacing stay literal reads by design).
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Returns the `outline` CSS value for the current focus-visible state.
|
|
20
|
+
* Pair with `outlineOffset` at the call site when the component floats the
|
|
21
|
+
* ring off its edge.
|
|
22
|
+
*/
|
|
23
|
+
var focusRingOutline = isFocusVisible => {
|
|
24
|
+
return isFocusVisible ? `${_ttoss_fsl_theme_vars.vars.focus.ring.width} ${_ttoss_fsl_theme_vars.vars.focus.ring.style} ${_ttoss_fsl_theme_vars.vars.focus.ring.color}` : "none";
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.focusRingOutline = focusRingOutline;
|