@threelight/ui 0.2.0-alpha.0 → 0.3.0-alpha.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/README.md CHANGED
@@ -1,170 +1,111 @@
1
1
  # @threelight/ui
2
2
 
3
- Framework-neutral governed UI primitives for readable HTML/CSS interfaces.
4
-
5
- This package is an early alpha for the ThreeLight UI grammar. It publishes CSS
6
- primitives, safe default theme tokens, examples, and typed registry metadata.
3
+ Short-class CSS, role tokens, and metadata for service UI systems.
7
4
 
8
5
  ```bash
9
6
  pnpm add @threelight/ui@alpha
10
7
  ```
11
8
 
12
- ```ts
13
- import "@threelight/ui/base.css"
14
- ```
15
-
16
- Import this once from the application entrypoint or global stylesheet entry
17
- before project-specific override CSS:
9
+ Import the CSS once:
18
10
 
19
11
  ```ts
20
- import "@threelight/ui/base.css"
21
- import "./app.css"
12
+ import '@threelight/ui/base.css'
22
13
  ```
23
14
 
24
- ThreeLight uses low-specificity selectors and cascade layers, so application CSS
25
- loaded later can intentionally override project-specific details.
26
-
27
- ## Applying The Styles
28
-
29
- Importing the CSS loads ThreeLight styles globally, but primitives only apply
30
- inside an explicit `data-tl-root` scope. This keeps existing project CSS from
31
- being changed by import alone.
32
-
33
- Apply ThreeLight to the whole app by putting the root attributes on `body`:
15
+ Opt a subtree into ThreeLight:
34
16
 
35
17
  ```html
36
18
  <body data-tl-root data-tl-theme="default" data-tl-mode="light">
37
- <main class="tl-section tl-stack">
38
- <h1 class="tl-display">Project archive</h1>
39
- <p class="tl-body">Readable governed UI primitives.</p>
40
- </main>
19
+ <button class="tl-button" data-tl-variant="solid" data-tl-tone="primary">
20
+ Deploy
21
+ </button>
41
22
  </body>
42
23
  ```
43
24
 
44
- Apply ThreeLight to only one area by putting the root attributes on a subtree:
25
+ ## Contract
45
26
 
46
- ```html
47
- <body>
48
- <main>
49
- <section data-tl-root data-tl-theme="default" data-tl-mode="dark">
50
- <article class="tl-card tl-stack" data-tl-tone="info">
51
- <h2 class="tl-heading">Scoped preview</h2>
52
- <p class="tl-body">Only this subtree uses ThreeLight primitives.</p>
53
- </article>
54
- </section>
55
- </main>
56
- </body>
57
- ```
58
-
59
- `tl-*` classes outside `data-tl-root` are intentionally not styled.
60
-
61
- ## Overriding Styles
27
+ This alpha reset intentionally removes the old layer-prefixed contract. Public
28
+ classes are short and component-shaped:
62
29
 
63
- Prefer overriding `--tl-*` tokens when customizing theme color, border, focus,
64
- or component role values. Token overrides keep primitive structure, spacing, and
65
- readability defaults intact:
66
-
67
- ```css
68
- [data-tl-root][data-tl-theme="studio"][data-tl-mode="light"] {
69
- --tl-primary-fill: #55ffff;
70
- --tl-primary-on-fill: #061010;
71
- --tl-primary-border: #27757c;
72
- }
30
+ ```text
31
+ tl-button
32
+ tl-table
33
+ tl-app-shell
34
+ tl-button__icon
35
+ tl-table__cell
73
36
  ```
74
37
 
75
- Directly overriding `.tl-*` classes is allowed, but it can intentionally replace
76
- primitive structure. For example, later app CSS such as `.my-page .tl-button {
77
- padding: 0; border: 0; }` will change how that button renders.
78
-
79
- ## Primitive Contract
38
+ Variants, tone, size, density, and state are data attributes:
80
39
 
81
- ThreeLight UI exposes opt-in, framework-neutral HTML/CSS primitives. Compose
82
- with `tl-*` classes and namespaced `data-tl-*` attributes.
40
+ ```html
41
+ <button
42
+ class="tl-button"
43
+ data-tl-variant="soft"
44
+ data-tl-tone="danger"
45
+ data-tl-size="sm"
46
+ >
47
+ Delete
48
+ </button>
49
+ ```
83
50
 
84
- - Layout: `tl-section`, `tl-stack`, `tl-cluster`, `tl-grid`
85
- - Surface: `tl-surface`, `tl-card`, `tl-panel`
86
- - Text: `tl-display`, `tl-heading`, `tl-body`, `tl-caption`, `tl-meta`, `tl-label`, `tl-action-text`, `tl-metric`, `tl-code`
87
- - Action/status: `tl-button`, `tl-badge`, `tl-alert`
88
- - Form: `tl-field`, `tl-input`, `tl-help`
51
+ Metadata exported from the package records each item as `core` or `candidate`.
52
+ Candidate components are public during alpha but may change as service templates
53
+ are reviewed.
89
54
 
90
- Supported tones are `neutral`, `primary`, `info`, `success`, `warning`, and
91
- `danger`. Omit `data-tl-tone` for neutral behavior.
55
+ ## P0 Surface
92
56
 
93
- Primitives keep body and input text at 16px or larger, keep helper and caption
94
- text at the 14px readable floor, and expose spacing overrides through CSS custom
95
- properties such as `--tl-gap`, `--tl-grid-min`, and `--tl-surface-padding`.
57
+ Core:
96
58
 
97
- ## Theme Contract
59
+ - `tl-button`, `tl-icon-button`, `tl-badge`, `tl-alert`
60
+ - `tl-card`, `tl-panel`, `tl-field`, `tl-input`, `tl-select`, `tl-switch`
61
+ - `tl-tabs`, `tl-table`, `tl-code-block`
62
+ - `tl-stack`, `tl-cluster`, `tl-grid`, `tl-heading`, `tl-text`, `tl-caption`
98
63
 
99
- ThreeLight UI separates theme family, mode, and semantic tone.
64
+ Candidate:
100
65
 
101
- ```html
102
- <body data-tl-root data-tl-theme="default" data-tl-mode="light">
103
- <article class="tl-card" data-tl-tone="warning">
104
- ...
105
- </article>
106
- </body>
107
- ```
66
+ - `tl-app-shell`, `tl-side-nav`, `tl-top-bar`, `tl-toolbar`
67
+ - `tl-filter-bar`, `tl-metric-card`, `tl-metric-group`, `tl-data-panel`
68
+ - `tl-settings-section`, `tl-stepper`, `tl-choice-card`, `tl-empty-state`
69
+ - `tl-toast`, `tl-toast-region`, `tl-docs-shell`
108
70
 
109
- - `data-tl-root` opts an app or subtree into ThreeLight theme variables.
110
- - `data-tl-theme` selects palette family, initially `default`.
111
- - `data-tl-mode` selects lightness mode, initially `light` or `dark`.
112
- - `data-tl-tone` expresses component meaning and stays stable across themes.
71
+ ## Tokens
113
72
 
114
- Theme tokens are role-centric. Prefer `content` roles over text-only roles:
73
+ Public tokens are role-based:
115
74
 
116
75
  ```text
117
- --tl-canvas
118
- --tl-surface
119
- --tl-layer
120
- --tl-content-primary
121
- --tl-content-secondary
122
- --tl-content-subtle
123
- --tl-border-subtle
124
- --tl-border-strong
125
- --tl-focus
76
+ --tl-color-canvas
77
+ --tl-color-surface
78
+ --tl-color-content-primary
79
+ --tl-color-border-subtle
80
+ --tl-color-primary-fill
81
+ --tl-radius-control
82
+ --tl-radius-card
83
+ --tl-shadow-card
84
+ --tl-density-compact
85
+ --tl-motion-duration-base
126
86
  ```
127
87
 
128
- Theme and mode changes swap token values behind each role. Consumers should not
129
- rewrite a component from `warning` to another tone unless the component meaning
130
- changes.
88
+ Override tokens at `[data-tl-root]` after importing `base.css`.
131
89
 
132
- ## Registry Metadata
133
-
134
- The package exports readonly registry metadata for adapters and migration tools:
90
+ ## Metadata
135
91
 
136
92
  ```ts
137
93
  import {
94
+ componentContracts,
95
+ componentClasses,
138
96
  primitiveClasses,
139
- semanticTokenNames,
140
- themeAttributes,
141
- themeFamilies,
142
- themeModes,
97
+ tokenNames,
143
98
  toneNames,
144
- } from "@threelight/ui"
99
+ variantNames,
100
+ } from '@threelight/ui'
145
101
  ```
146
102
 
147
- Use these exports to avoid hard-coding the public `tl-*`, `data-tl-*`, tone, and
148
- token contract in downstream packages.
149
-
150
- ## Status
151
-
152
- `@threelight/ui` is experimental. Public APIs may change before the first stable
153
- release.
103
+ Use metadata for docs, adapters, migration tools, and guards instead of
104
+ hard-coding class names.
154
105
 
155
106
  ## Publishing
156
107
 
157
- Publish alpha releases from the repository root with the scripted command. The
158
- script runs package publish with an explicit `alpha` dist-tag.
159
-
160
108
  ```bash
161
109
  pnpm release:ui:alpha
162
- ```
163
-
164
- Check the published dist-tags with:
165
-
166
- ```bash
167
110
  pnpm release:ui:tags
168
111
  ```
169
-
170
- The tag check contacts the npm registry, so it requires network access.