@tensor_1/tokens 2.0.0 → 2.2.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 +50 -0
- package/build/css/components.css +12 -3
- package/build/css/styles.css +68 -4
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @tensor_1/tokens
|
|
2
|
+
|
|
3
|
+
UIx v2 design tokens — the **`--uix-*` contract** (colors, typography, spacing, radii, motion, light/dark) for the house products. One [DTCG](https://www.designtokens.org/) source generates **CSS variables**, a **Tailwind theme**, and **typed TS constants**.
|
|
4
|
+
|
|
5
|
+
> Stack-neutral. Drop the CSS into any project (HTML, React, Vue, Tailwind, server-rendered). The `--uix-*` names *are* the contract — override values, never names.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i @tensor_1/tokens
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
**Tailwind / shadcn:**
|
|
16
|
+
```css
|
|
17
|
+
@import "@tensor_1/tokens/css"; /* the --uix-* contract (light + dark) */
|
|
18
|
+
@import "@tensor_1/tokens/themes/tensor"; /* a product brand */
|
|
19
|
+
@import "@tensor_1/tokens/tailwind"; /* @theme — bg-uix-accent, rounded-uix-md, … */
|
|
20
|
+
@import "tailwindcss";
|
|
21
|
+
```
|
|
22
|
+
(Tailwind v3: `presets: [require('@tensor_1/tokens/tailwind/preset')]`.)
|
|
23
|
+
|
|
24
|
+
**Plain CSS:** link `@tensor_1/tokens/css`, then a product theme.
|
|
25
|
+
|
|
26
|
+
**TS / ECharts / React Native:**
|
|
27
|
+
```ts
|
|
28
|
+
import { cssVar, light, dark, num } from "@tensor_1/tokens/ts";
|
|
29
|
+
```
|
|
30
|
+
`cssVar` in the browser (respects brand + dark); `light` / `dark` / `num` for non-DOM (SSR, RN, server-rendered charts).
|
|
31
|
+
|
|
32
|
+
## Brand a project
|
|
33
|
+
|
|
34
|
+
Override the write-only brand slots; `accent` / `link` / `ring` / `brand-muted` re-chain automatically:
|
|
35
|
+
```css
|
|
36
|
+
:root { --uix-brand: #16A34A; --uix-brand-fg: #FFFFFF; }
|
|
37
|
+
:root:where(.dark,[data-theme="dark"]) { --uix-brand: #22C55E; }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Exports
|
|
41
|
+
|
|
42
|
+
| Subpath | What |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `./css` | the `--uix-*` contract (`:root` light, dark selector) |
|
|
45
|
+
| `./styles` | component CSS (use with the tokens + a theme) |
|
|
46
|
+
| `./tailwind` · `./tailwind/preset` | Tailwind v4 `@theme` / v3 preset |
|
|
47
|
+
| `./ts` | typed `cssVar` / `light` / `dark` / `num` |
|
|
48
|
+
| `./themes/{tensor,posx,shopx,mission-control}` | per-product brand |
|
|
49
|
+
|
|
50
|
+
Source of truth: `tokens/*.json` (DTCG) → [Style Dictionary](https://styledictionary.com). Part of the **[UIx v2 styleguide](https://github.com/COx-ORG-H/UIx)**.
|
package/build/css/components.css
CHANGED
|
@@ -23,6 +23,14 @@
|
|
|
23
23
|
.uix-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--uix-space-2)); }
|
|
24
24
|
|
|
25
25
|
.uix-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
26
|
+
|
|
27
|
+
/* elevation — apply the surface shadow tokens as a utility (cards/panels,
|
|
28
|
+
floating popovers/menus/dialogs, pressed/active pills). In dark mode
|
|
29
|
+
--uix-shadow-sm resolves to the inset top highlight, so elevated surfaces
|
|
30
|
+
keep their lift cue without a heavy drop shadow. */
|
|
31
|
+
.uix-elevated { box-shadow: var(--uix-shadow-sm); }
|
|
32
|
+
.uix-elevated-popover { box-shadow: var(--uix-shadow-popover); }
|
|
33
|
+
.uix-elevated-pill { box-shadow: var(--uix-shadow-sm); }
|
|
26
34
|
}
|
|
27
35
|
/* uix motion — shared keyframes, enter/exit helpers, and the reduced-motion guard.
|
|
28
36
|
Components reference these tokens/keyframes; overlays pair the helpers with @starting-style. */
|
|
@@ -1023,9 +1031,10 @@
|
|
|
1023
1031
|
}
|
|
1024
1032
|
/* uix image lightbox — native <dialog>, click a thumbnail to enlarge. Depends only on --uix-* tokens. */
|
|
1025
1033
|
@layer uix.components {
|
|
1026
|
-
/* margin:auto centers the modal <dialog> in the viewport
|
|
1027
|
-
|
|
1028
|
-
|
|
1034
|
+
/* margin:auto centers the modal <dialog> in the viewport. Set explicitly (not
|
|
1035
|
+
left to the UA default) so centering is robust regardless of any consumer
|
|
1036
|
+
reset — base.css scopes its margin reset to typographic/form elements and
|
|
1037
|
+
deliberately leaves <dialog> alone. Matches .uix-dialog. */
|
|
1029
1038
|
.uix-lightbox { margin: auto; border: 0; background: transparent; padding: 0; max-width: 92vw; max-height: 92vh; box-shadow: var(--uix-shadow-overlay); overflow: visible; }
|
|
1030
1039
|
/* A definite width is required: an SVG with a viewBox but no intrinsic width/height collapses to
|
|
1031
1040
|
0×0 under width:auto, which then shrink-wraps the fit-content <dialog> to nothing (nothing shows
|
package/build/css/styles.css
CHANGED
|
@@ -201,7 +201,17 @@
|
|
|
201
201
|
/* Fonts load via the Google Fonts <link> in index.html (Inter + IBM Plex Sans + IBM Plex Mono). */
|
|
202
202
|
@layer uix.base {
|
|
203
203
|
*, *::before, *::after { box-sizing: border-box; }
|
|
204
|
-
|
|
204
|
+
/* Zero default UA margins on the elements that actually carry them — NOT a
|
|
205
|
+
bare `* { margin: 0 }`. The universal form lives in the `uix.base` layer,
|
|
206
|
+
which a Tailwind consumer orders ABOVE its own `utilities`, so a bare `*`
|
|
207
|
+
reset silently beat every margin utility (`mb-2`, `mt-4`, `space-y-*`) on
|
|
208
|
+
arbitrary layout elements (divs/sections) — the "no spacing between
|
|
209
|
+
components" bug. Scoping to typographic/default-margin elements (the same
|
|
210
|
+
set Tailwind's own preflight resets) keeps the standalone styleguide's
|
|
211
|
+
vertical rhythm while leaving layout elements free for consumer margins. */
|
|
212
|
+
body, h1, h2, h3, h4, h5, h6, p, blockquote, figure, figcaption,
|
|
213
|
+
dl, dd, ol, ul, menu, fieldset, hr, pre,
|
|
214
|
+
button, input, optgroup, select, textarea { margin: 0; }
|
|
205
215
|
|
|
206
216
|
html { -webkit-text-size-adjust: 100%; }
|
|
207
217
|
/* default theme follows the OS until JS sets data-theme */
|
|
@@ -272,6 +282,14 @@
|
|
|
272
282
|
.uix-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--uix-space-2)); }
|
|
273
283
|
|
|
274
284
|
.uix-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
285
|
+
|
|
286
|
+
/* elevation — apply the surface shadow tokens as a utility (cards/panels,
|
|
287
|
+
floating popovers/menus/dialogs, pressed/active pills). In dark mode
|
|
288
|
+
--uix-shadow-sm resolves to the inset top highlight, so elevated surfaces
|
|
289
|
+
keep their lift cue without a heavy drop shadow. */
|
|
290
|
+
.uix-elevated { box-shadow: var(--uix-shadow-sm); }
|
|
291
|
+
.uix-elevated-popover { box-shadow: var(--uix-shadow-popover); }
|
|
292
|
+
.uix-elevated-pill { box-shadow: var(--uix-shadow-sm); }
|
|
275
293
|
}
|
|
276
294
|
/* uix motion — shared keyframes, enter/exit helpers, and the reduced-motion guard.
|
|
277
295
|
Components reference these tokens/keyframes; overlays pair the helpers with @starting-style. */
|
|
@@ -924,6 +942,51 @@
|
|
|
924
942
|
.uix-dl dt { color: var(--uix-text-muted); font-size: var(--uix-text-meta); }
|
|
925
943
|
.uix-dl dd { color: var(--uix-text); font-size: var(--uix-text-body); margin: 0; }
|
|
926
944
|
}
|
|
945
|
+
/* uix typography utilities — class-based application of the --uix-text-* scale.
|
|
946
|
+
A `<span class="uix-text-h3">` reads identically to an `<h3>`; consumers reach
|
|
947
|
+
for these instead of re-deriving the scale inline. (House products migrating
|
|
948
|
+
off bespoke `type-*` classes map 1:1 onto these — same sizes/leading/weights.)
|
|
949
|
+
Depends only on --uix-* tokens. */
|
|
950
|
+
@layer uix.components {
|
|
951
|
+
.uix-text-display {
|
|
952
|
+
font-size: var(--uix-text-display); line-height: var(--uix-leading-display);
|
|
953
|
+
font-weight: 400; letter-spacing: var(--uix-tracking-tight); color: var(--uix-text);
|
|
954
|
+
}
|
|
955
|
+
.uix-text-h1 {
|
|
956
|
+
font-size: var(--uix-text-display); line-height: var(--uix-leading-display);
|
|
957
|
+
font-weight: 400; letter-spacing: var(--uix-tracking-tight); color: var(--uix-text);
|
|
958
|
+
}
|
|
959
|
+
.uix-text-h2 {
|
|
960
|
+
font-size: var(--uix-text-h2); line-height: var(--uix-leading-h2);
|
|
961
|
+
font-weight: 400; letter-spacing: -0.01em; color: var(--uix-text);
|
|
962
|
+
}
|
|
963
|
+
.uix-text-h3 {
|
|
964
|
+
font-size: var(--uix-text-h3); line-height: var(--uix-leading-h3);
|
|
965
|
+
font-weight: 700; color: var(--uix-text);
|
|
966
|
+
}
|
|
967
|
+
.uix-text-body {
|
|
968
|
+
font-size: var(--uix-text-body); line-height: var(--uix-leading-body);
|
|
969
|
+
font-weight: 400; color: var(--uix-text);
|
|
970
|
+
}
|
|
971
|
+
.uix-text-body-hushed {
|
|
972
|
+
font-size: var(--uix-text-body); line-height: var(--uix-leading-body);
|
|
973
|
+
font-weight: 400; color: var(--uix-text-hushed);
|
|
974
|
+
}
|
|
975
|
+
.uix-text-meta {
|
|
976
|
+
font-size: var(--uix-text-meta); line-height: var(--uix-leading-meta);
|
|
977
|
+
font-weight: 400; color: var(--uix-text-hushed);
|
|
978
|
+
}
|
|
979
|
+
.uix-text-eyebrow {
|
|
980
|
+
font-size: var(--uix-text-eyebrow); line-height: var(--uix-leading-eyebrow);
|
|
981
|
+
font-weight: 700; letter-spacing: var(--uix-tracking-eyebrow);
|
|
982
|
+
text-transform: uppercase; color: var(--uix-text-hushed);
|
|
983
|
+
}
|
|
984
|
+
.uix-text-data-hero {
|
|
985
|
+
font-size: var(--uix-text-data-hero); line-height: 1.1;
|
|
986
|
+
font-weight: 400; letter-spacing: -0.01em; color: var(--uix-text);
|
|
987
|
+
font-variant-numeric: tabular-nums;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
927
990
|
/* uix avatar / avatar-group / user-chip — depends only on --uix-* tokens. */
|
|
928
991
|
@layer uix.components {
|
|
929
992
|
.uix-avatar {
|
|
@@ -1272,9 +1335,10 @@
|
|
|
1272
1335
|
}
|
|
1273
1336
|
/* uix image lightbox — native <dialog>, click a thumbnail to enlarge. Depends only on --uix-* tokens. */
|
|
1274
1337
|
@layer uix.components {
|
|
1275
|
-
/* margin:auto centers the modal <dialog> in the viewport
|
|
1276
|
-
|
|
1277
|
-
|
|
1338
|
+
/* margin:auto centers the modal <dialog> in the viewport. Set explicitly (not
|
|
1339
|
+
left to the UA default) so centering is robust regardless of any consumer
|
|
1340
|
+
reset — base.css scopes its margin reset to typographic/form elements and
|
|
1341
|
+
deliberately leaves <dialog> alone. Matches .uix-dialog. */
|
|
1278
1342
|
.uix-lightbox { margin: auto; border: 0; background: transparent; padding: 0; max-width: 92vw; max-height: 92vh; box-shadow: var(--uix-shadow-overlay); overflow: visible; }
|
|
1279
1343
|
/* A definite width is required: an SVG with a viewBox but no intrinsic width/height collapses to
|
|
1280
1344
|
0×0 under width:auto, which then shrink-wraps the fit-content <dialog> to nothing (nothing shows
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tensor_1/tokens",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "UIx v2 design tokens — the --uix-* contract for house products (Tensor, POSx, SHOPx). One DTCG source -> CSS variables, Tailwind theme, and typed TS constants.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
"./css": "./build/css/tokens.css",
|
|
22
22
|
"./styles": "./build/css/components.css",
|
|
23
|
+
"./bundle": "./build/css/styles.css",
|
|
23
24
|
"./tailwind": "./build/tailwind/theme.css",
|
|
24
25
|
"./tailwind/preset": "./build/tailwind/preset.cjs",
|
|
25
26
|
"./ts": {
|