@moshevents/tokens 0.1.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 ADDED
@@ -0,0 +1,87 @@
1
+ # mosh-tokens
2
+
3
+ **Single source of truth for the Mosh Design System.** Edit tokens in one place
4
+ (`tokens.json`), regenerate, and every platform consumes the same values.
5
+
6
+ ```
7
+ tokens.json ← the ONLY file you hand-edit (colors, surfaces, type, spacing, radii, …)
8
+ build.mjs ← dependency-free generator (run with plain node)
9
+ dist/ → npm package @moshevents/tokens (web/admin)
10
+ tokens.css → website (Next.js): CSS custom properties
11
+ theme.css → admin (Tailwind v4): an @theme block, mapped into Tailwind namespaces
12
+ Sources/MoshTokens/ → SwiftPM package MoshTokens (iOS)
13
+ MoshTokens.swift → UIColor / SwiftUI Color + CGFloat / UIFont.Weight constants
14
+ Package.swift ← SwiftPM manifest
15
+ showcase/ → the human-facing bundle synced to the claude.ai "Mosh Design System"
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ npm run build # regenerate dist/ from tokens.json
22
+ npm run check # build + fail if dist/ is out of date (use in CI)
23
+ ```
24
+
25
+ No install required — `build.mjs` has zero dependencies and runs on Node ≥ 18.
26
+ Commit the regenerated `dist/` so every output is reviewable in diffs.
27
+
28
+ ## Consuming as a package (the supported path)
29
+
30
+ **Web / admin — `@moshevents/tokens` (public on npmjs).** No `.npmrc`, no token — just install:
31
+
32
+ ```bash
33
+ npm i @moshevents/tokens
34
+ ```
35
+
36
+ Then import the CSS once:
37
+
38
+ ```css
39
+ /* website */ @import "@moshevents/tokens/tokens.css";
40
+ /* admin (Tailwind v4) */ @import "@moshevents/tokens/theme.css";
41
+ ```
42
+
43
+ `npm update @moshevents/tokens` pulls new token values — no vendored copy to sync.
44
+
45
+ **iOS — SwiftPM `MoshTokens`.** Xcode → Add Package Dependencies →
46
+ `https://github.com/moshorg/mosh-tokens`, pin a version, then:
47
+
48
+ ```swift
49
+ import MoshTokens
50
+ view.backgroundColor = MoshColor.brand
51
+ label.font = .systemFont(ofSize: MoshFontSize.textBase, weight: MoshWeight.semibold)
52
+ ```
53
+
54
+ SwiftPM resolves straight from the git tag — no registry/publish needed.
55
+
56
+ ## Releasing
57
+
58
+ Publishing is **Trusted Publishing (OIDC)** — no token or secret. One-time setup:
59
+
60
+ 1. Create the `moshevents` org on npmjs (claims the `@moshevents` scope).
61
+ 2. **First publish manually** (Trusted Publishing is configured on an existing package):
62
+ `npm login && npm publish` from this repo.
63
+ 3. On npmjs → the package → **Settings → Trusted Publisher** → add GitHub Actions:
64
+ repo `moshorg/mosh-tokens`, workflow `publish.yml`.
65
+
66
+ After that, bump `version` and cut a **GitHub Release** (or run the `Publish` workflow) — it
67
+ publishes to npmjs via OIDC, with provenance, no secret. The same tag is what iOS pins to.
68
+
69
+ ## Designer / human-facing view
70
+
71
+ The browsable showcase lives in the **claude.ai "Mosh Design System" project**
72
+ (`projectId 8d424b74-…`), kept in sync via the `/design-sync` skill. That hosted project
73
+ is where a designer views the palette, type scale, and — as we add them — component
74
+ galleries, without checking out code. `tokens.json` is the machine source; the claude.ai
75
+ project is the rendered view of the same values. **One source, two audiences.**
76
+
77
+ ## Notes / open decisions
78
+
79
+ - **Dark-only today.** Every token is a single dark-mode value (matches web). iOS supports
80
+ light + dark; when we wire iOS fully (Phase 3), either add light/dark variants to the
81
+ schema (`{ "$value": { "light": …, "dark": … } }`) or commit iOS to dark-only.
82
+ - **iOS dimension conversion** is `px → pt` 1:1 and `rem × 16`; revisit if the iOS type
83
+ scale should differ from web.
84
+ - **Gradients/shadows** generate for web (CSS) and admin (Tailwind) but are omitted from
85
+ Swift for now — iOS expresses these per-component; revisit in Phase 3 if needed.
86
+ - Swap `build.mjs` for **Style Dictionary** later if you want its plugin ecosystem;
87
+ `tokens.json` stays the source either way.
package/dist/theme.css ADDED
@@ -0,0 +1,94 @@
1
+ /* AUTO-GENERATED from tokens.json by build.mjs — do not edit by hand. */
2
+ /* Mosh Design System — Tailwind v4 theme (admin). Import once: @import "./theme.css";
3
+ Names are mapped into Tailwind namespaces so utilities generate
4
+ (bg-brand, text-text-primary, p-4, rounded-pill, shadow-glow-brand, ...). */
5
+ @theme {
6
+ --color-brand: #ff2929;
7
+ --color-brand-bright: #ff4d4d;
8
+ --color-brand-light: #ff6b6b;
9
+ --color-brand-soft: #ff3d3d;
10
+ --color-brand-deep: #b30000;
11
+ --color-accent-deep: #b30000;
12
+ --color-bg: #000000;
13
+ --color-surface-0: #0a0a0a;
14
+ --color-surface-1: #121212;
15
+ --color-surface-2: #151515;
16
+ --color-surface-3: #1a1a1a;
17
+ --color-surface-4: #1f1f1f;
18
+ --color-surface-5: #252525;
19
+ --color-surface-6: #2a2a2a;
20
+ --color-surface-7: #3a3a3a;
21
+ --color-text-primary: #ffffff;
22
+ --color-text-secondary: #cccccc;
23
+ --color-text-tertiary: #aaaaaa;
24
+ --color-text-muted: #888888;
25
+ --color-text-faint: #666666;
26
+ --color-text-disabled: #555555;
27
+ --color-border-subtle: rgba(255, 255, 255, 0.06);
28
+ --color-border-default: rgba(255, 255, 255, 0.10);
29
+ --color-border-strong: rgba(255, 255, 255, 0.15);
30
+ --color-border-brand: rgba(255, 41, 41, 0.50);
31
+ --color-fill-ghost: rgba(255, 255, 255, 0.04);
32
+ --color-fill-hover: rgba(255, 255, 255, 0.08);
33
+ --color-fill-active: rgba(255, 255, 255, 0.12);
34
+ --color-scrim: rgba(0, 0, 0, 0.50);
35
+ --color-scrim-strong: rgba(0, 0, 0, 0.70);
36
+ --color-success: #22c55e;
37
+ --color-success-bright: #4ade80;
38
+ --color-danger: #ef4444;
39
+ --color-danger-bright: #f87171;
40
+ --color-warning: #facc15;
41
+ --color-warning-orange: #f97316;
42
+ --gradient-brand: linear-gradient(135deg, #ff2929, #b30000);
43
+ --gradient-red: linear-gradient(to top, #ff3d3d, #ff4d4d);
44
+ --gradient-warm: linear-gradient(135deg, #ff6b6b, #ff2929);
45
+ --gradient-surface: linear-gradient(145deg, #2a2a2a, #1a1a1a);
46
+ --gradient-shimmer: linear-gradient(90deg, transparent, #ff4d4d, transparent);
47
+ --radius-xs: 4px;
48
+ --radius-sm: 6px;
49
+ --radius-md: 8px;
50
+ --radius-lg: 10px;
51
+ --radius-xl: 12px;
52
+ --radius-2xl: 16px;
53
+ --radius-pill: 999px;
54
+ --radius-circle: 50%;
55
+ --spacing-1: 4px;
56
+ --spacing-2: 8px;
57
+ --spacing-3: 12px;
58
+ --spacing-4: 16px;
59
+ --spacing-5: 20px;
60
+ --spacing-6: 24px;
61
+ --spacing-8: 32px;
62
+ --spacing-10: 40px;
63
+ --spacing-12: 48px;
64
+ --font-sans: var(--font-geist-sans, "Geist"), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
65
+ --font-mono: var(--font-geist-mono, "Geist Mono"), ui-monospace, SFMono-Regular, Menlo, monospace;
66
+ --text-xs: 0.7rem;
67
+ --text-sm: 0.8rem;
68
+ --text-base: 0.85rem;
69
+ --text-md: 0.9rem;
70
+ --text-lg: 1rem;
71
+ --text-xl: 1.1rem;
72
+ --text-2xl: 1.25rem;
73
+ --text-3xl: 1.5rem;
74
+ --text-4xl: 1.75rem;
75
+ --text-5xl: 2.5rem;
76
+ --font-weight-light: 300;
77
+ --font-weight-regular: 400;
78
+ --font-weight-medium: 500;
79
+ --font-weight-semibold: 600;
80
+ --font-weight-bold: 700;
81
+ --font-weight-black: 900;
82
+ --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
83
+ --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
84
+ --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
85
+ --shadow-glow-brand: 0 0 20px rgba(255, 41, 41, 0.5), 0 0 40px rgba(255, 41, 41, 0.2);
86
+ --shadow-glow-brand-soft: 0 0 24px rgba(255, 77, 77, 0.3);
87
+ }
88
+
89
+ /* Channel vars (rgba(var(--…), <alpha>)) — outside @theme on purpose. */
90
+ :root {
91
+ --color-brand-rgb: 255, 41, 41;
92
+ --color-danger-rgb: 239, 68, 68;
93
+ --color-danger-bright-rgb: 248, 113, 113;
94
+ }
@@ -0,0 +1,88 @@
1
+ /* AUTO-GENERATED from tokens.json by build.mjs — do not edit by hand. */
2
+ /* Mosh Design System — CSS custom properties (website). */
3
+ :root {
4
+ --color-brand: #ff2929; /* primary brand red */
5
+ --color-brand-bright: #ff4d4d; /* brighter accent / hover */
6
+ --color-brand-light: #ff6b6b; /* light red, best for text on dark */
7
+ --color-brand-soft: #ff3d3d;
8
+ --color-brand-deep: #b30000; /* pressed / deep */
9
+ --color-accent-deep: #b30000; /* secondary accent, pairs with red */
10
+ --color-brand-rgb: 255, 41, 41; /* brand red channels — for rgba(var(--color-brand-rgb), <alpha>) */
11
+ --color-bg: #000000; /* app background */
12
+ --surface-0: #0a0a0a;
13
+ --surface-1: #121212;
14
+ --surface-2: #151515;
15
+ --surface-3: #1a1a1a;
16
+ --surface-4: #1f1f1f;
17
+ --surface-5: #252525;
18
+ --surface-6: #2a2a2a;
19
+ --surface-7: #3a3a3a;
20
+ --text-primary: #ffffff;
21
+ --text-secondary: #cccccc;
22
+ --text-tertiary: #aaaaaa;
23
+ --text-muted: #888888;
24
+ --text-faint: #666666;
25
+ --text-disabled: #555555;
26
+ --border-subtle: rgba(255, 255, 255, 0.06);
27
+ --border-default: rgba(255, 255, 255, 0.10);
28
+ --border-strong: rgba(255, 255, 255, 0.15);
29
+ --border-brand: rgba(255, 41, 41, 0.50);
30
+ --fill-ghost: rgba(255, 255, 255, 0.04);
31
+ --fill-hover: rgba(255, 255, 255, 0.08);
32
+ --fill-active: rgba(255, 255, 255, 0.12);
33
+ --scrim: rgba(0, 0, 0, 0.50);
34
+ --scrim-strong: rgba(0, 0, 0, 0.70);
35
+ --color-success: #22c55e;
36
+ --color-success-bright: #4ade80;
37
+ --color-danger: #ef4444;
38
+ --color-danger-bright: #f87171;
39
+ --color-danger-rgb: 239, 68, 68; /* danger channels — for rgba(var(--color-danger-rgb), <alpha>) */
40
+ --color-danger-bright-rgb: 248, 113, 113; /* danger-bright channels */
41
+ --color-warning: #facc15;
42
+ --color-warning-orange: #f97316;
43
+ --gradient-brand: linear-gradient(135deg, #ff2929, #b30000); /* red → deep red */
44
+ --gradient-red: linear-gradient(to top, #ff3d3d, #ff4d4d);
45
+ --gradient-warm: linear-gradient(135deg, #ff6b6b, #ff2929);
46
+ --gradient-surface: linear-gradient(145deg, #2a2a2a, #1a1a1a);
47
+ --gradient-shimmer: linear-gradient(90deg, transparent, #ff4d4d, transparent);
48
+ --radius-xs: 4px;
49
+ --radius-sm: 6px;
50
+ --radius-md: 8px;
51
+ --radius-lg: 10px;
52
+ --radius-xl: 12px;
53
+ --radius-2xl: 16px;
54
+ --radius-pill: 999px; /* buttons/badges are pill-shaped */
55
+ --radius-circle: 50%;
56
+ --space-1: 4px;
57
+ --space-2: 8px;
58
+ --space-3: 12px;
59
+ --space-4: 16px;
60
+ --space-5: 20px;
61
+ --space-6: 24px;
62
+ --space-8: 32px;
63
+ --space-10: 40px;
64
+ --space-12: 48px;
65
+ --font-sans: var(--font-geist-sans, "Geist"), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
66
+ --font-mono: var(--font-geist-mono, "Geist Mono"), ui-monospace, SFMono-Regular, Menlo, monospace;
67
+ --text-xs: 0.7rem;
68
+ --text-sm: 0.8rem;
69
+ --text-base: 0.85rem; /* most common body size */
70
+ --text-md: 0.9rem;
71
+ --text-lg: 1rem;
72
+ --text-xl: 1.1rem;
73
+ --text-2xl: 1.25rem;
74
+ --text-3xl: 1.5rem;
75
+ --text-4xl: 1.75rem;
76
+ --text-5xl: 2.5rem;
77
+ --weight-light: 300;
78
+ --weight-regular: 400;
79
+ --weight-medium: 500;
80
+ --weight-semibold: 600; /* most common UI weight */
81
+ --weight-bold: 700;
82
+ --weight-black: 900;
83
+ --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
84
+ --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
85
+ --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
86
+ --glow-brand: 0 0 20px rgba(255, 41, 41, 0.5), 0 0 40px rgba(255, 41, 41, 0.2); /* signature red glow — primary actions */
87
+ --glow-brand-soft: 0 0 24px rgba(255, 77, 77, 0.3);
88
+ }
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@moshevents/tokens",
3
+ "version": "0.1.0",
4
+ "description": "Mosh Design System — design tokens (CSS variables + Tailwind theme) for web/admin; iOS consumes the SwiftPM target.",
5
+ "type": "module",
6
+ "files": [
7
+ "dist/tokens.css",
8
+ "dist/theme.css"
9
+ ],
10
+ "exports": {
11
+ "./tokens.css": "./dist/tokens.css",
12
+ "./theme.css": "./dist/theme.css"
13
+ },
14
+ "scripts": {
15
+ "build": "node build.mjs",
16
+ "prepublishOnly": "node build.mjs",
17
+ "check": "node build.mjs && git --no-pager diff --exit-code dist Sources || (echo '\\noutputs are stale — run npm run build and commit' && exit 1)"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/moshorg/mosh-tokens.git"
25
+ }
26
+ }