@middag-io/react 0.34.0 → 0.35.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/README.md CHANGED
@@ -172,7 +172,8 @@ src/
172
172
  lib/ # Generic utilities and hooks
173
173
  assets/ # Fonts, lottie animations
174
174
  index.ts # Barrel export
175
- mock/ # Dev playground (standalone SPA, no server needed)
175
+ demo/ # FREE demo harness (standalone SPA, Community only — `npm run dev`)
176
+ packages/react-demo/mock/ # PRO demo (host-sim + premium blocks — `npm run dev:pro`)
176
177
  scripts/ # Tooling (sync, doctor)
177
178
  .githooks/ # Git hooks (pre-commit, commit-msg, pre-push)
178
179
  .changeset/ # Changesets config for automated versioning
@@ -200,8 +201,11 @@ Extensions implement `ExtensionPage` (extends `PageContract`) for licensed featu
200
201
  # Check environment
201
202
  npm run doctor
202
203
 
203
- # Mock build -- standalone SPA, no server needed
204
- npm run dev # http://localhost:5174
204
+ # FREE demo harness -- standalone SPA, Community engine only, no server needed
205
+ npm run dev # http://localhost:5173
206
+
207
+ # PRO demo -- host-sim shells + premium blocks (packages/react-demo)
208
+ npm run dev:pro # http://localhost:5174
205
209
 
206
210
  # Typecheck
207
211
  npm run typecheck
@@ -234,9 +238,24 @@ npm run build -- --watch # rebuild dist-lib on change; reload the brow
234
238
  `.scaffold-free/` is throwaway. `:local` always regenerates from scratch; plain
235
239
  `dev:scaffold-free` reuses an existing scaffold (pass `-- --fresh` to wipe it).
236
240
 
237
- ### Host switching (mock only)
241
+ ### FREE demo vs PRO demo
242
+
243
+ There are two in-repo demos, plus the scaffold dogfood above. All three are dev-time
244
+ tools — none of them is the production runtime (hosts render via Inertia, not these SPAs).
245
+
246
+ | Demo | Command | Source | Depends on PRO? |
247
+ |---------------------|-------------------|-----------------------|--------------------------------------|
248
+ | FREE demo harness | `npm run dev` | `demo/` | No — Community engine (`src/`) only |
249
+ | PRO demo | `npm run dev:pro` | `packages/react-demo` | Yes — `@middag-io/react-pro` + mocks |
250
+
251
+ The FREE harness consumes the engine from `src/` via Vite aliases (instant HMR), mocks
252
+ `@inertiajs/*` with self-contained adapters in `demo/adapters/`, and renders Community
253
+ `PageContract`s only. It never imports `@middag-io/react-pro` and needs no GitHub
254
+ Packages auth — it is the demo that ships with the public repo after the FREE/PRO split.
255
+
256
+ ### Host switching (PRO demo only)
238
257
 
239
- The mock build includes a host switcher (M/W button in sidebar footer) to preview the UI inside Moodle Boost header or WordPress admin chrome.
258
+ The PRO demo build includes a host switcher (M/W button in sidebar footer) to preview the UI inside Moodle Boost header or WordPress admin chrome.
240
259
 
241
260
  ### ReUI component examples
242
261
 
@@ -297,7 +316,8 @@ The package includes a CLI for bootstrapping and maintaining the UI layer in con
297
316
  | Command | Description |
298
317
  |-------------------------------------------|-----------------------------------------------|
299
318
  | `npm run doctor` | Validate development environment |
300
- | `npm run dev` | Dev server with hot reload (mock SPA) |
319
+ | `npm run dev` | FREE demo harness (`demo/`, Community only) |
320
+ | `npm run dev:pro` | PRO demo (react-demo: host-sim + premium) |
301
321
  | `npm run dev:scaffold-free` | Run the FREE scaffold output (public npm lib) |
302
322
  | `npm run dev:scaffold-free:local` | FREE scaffold linked to your local built lib |
303
323
  | `npm run build` | Build ESM lib to `dist-lib/` |
@@ -0,0 +1,136 @@
1
+ /*
2
+ * Tailwind THEME CONTRACT — compile-time utility→token mapping (E1.8).
3
+ *
4
+ * Single source of truth for how Tailwind utility classes resolve to the
5
+ * MIDDAG runtime tokens (tokens.css / theme-bridge.css). Imported by TWO
6
+ * Tailwind entries:
7
+ *
8
+ * 1. src/tailwind.css — the engine's shipped stylesheet
9
+ * (@middag-io/react/style.css), which also emits the runtime tokens.
10
+ * 2. the react-pro style.css entry — the PRO utilities layer
11
+ * (@middag-io/react-pro/style.css), compiled ONLY from react-pro
12
+ * sources. It re-uses this mapping so a PRO `bg-background`/`p-4`
13
+ * compiles to the exact same declaration the engine emits — never to
14
+ * Tailwind defaults (which would win the cascade and break tokens).
15
+ *
16
+ * The engine build copies this file to dist-lib/ and exports it as
17
+ * `@middag-io/react/tailwind-theme.css` so the post-split PRO repo can
18
+ * import the contract from the published package.
19
+ *
20
+ * Runtime var definitions do NOT belong here — only @theme mappings and
21
+ * variants. The engine stylesheet is the one that ships the tokens.
22
+ */
23
+
24
+ @custom-variant dark (&:is(.dark *));
25
+
26
+ @theme {
27
+ --color-background: var(--background);
28
+ --color-foreground: var(--foreground);
29
+ --color-primary: var(--middag-brand, var(--primary));
30
+ --color-primary-foreground: var(--primary-foreground);
31
+ --color-destructive: var(--destructive);
32
+ --color-destructive-foreground: var(--destructive-foreground);
33
+ --color-success: var(--success);
34
+ --color-success-foreground: var(--success-foreground);
35
+ --color-warning: var(--warning);
36
+ --color-warning-foreground: var(--warning-foreground);
37
+ --color-info: var(--info);
38
+ --color-info-foreground: var(--info-foreground);
39
+ --color-muted: var(--muted);
40
+ --color-muted-foreground: var(--muted-foreground);
41
+ --color-accent: var(--accent);
42
+ --color-accent-foreground: var(--accent-foreground);
43
+ --color-border: var(--border);
44
+ --color-input: var(--input);
45
+ --color-ring: var(--ring);
46
+ --color-card: var(--card);
47
+ --color-card-foreground: var(--card-foreground);
48
+ --color-popover: var(--popover);
49
+ --color-popover-foreground: var(--popover-foreground);
50
+ --color-secondary: var(--secondary);
51
+ --color-secondary-foreground: var(--secondary-foreground);
52
+
53
+ /* ── Semantic color variants (subtle/muted) ── */
54
+ --color-primary-subtle: var(--primary-subtle);
55
+ --color-primary-muted: var(--primary-muted);
56
+ --color-destructive-subtle: var(--destructive-subtle);
57
+ --color-destructive-muted: var(--destructive-muted);
58
+ --color-success-subtle: var(--success-subtle);
59
+ --color-success-muted: var(--success-muted);
60
+ --color-warning-subtle: var(--warning-subtle);
61
+ --color-warning-muted: var(--warning-muted);
62
+ --color-info-subtle: var(--info-subtle);
63
+ --color-info-muted: var(--info-muted);
64
+
65
+ /* ── Chart colors ── */
66
+ --color-chart-1: var(--chart-1);
67
+ --color-chart-2: var(--chart-2);
68
+ --color-chart-3: var(--chart-3);
69
+ --color-chart-4: var(--chart-4);
70
+ --color-chart-5: var(--chart-5);
71
+
72
+ --color-sidebar: var(--sidebar);
73
+ --color-sidebar-foreground: var(--sidebar-foreground);
74
+ --color-sidebar-primary: var(--sidebar-primary);
75
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
76
+ --color-sidebar-accent: var(--sidebar-accent);
77
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
78
+ --color-sidebar-hover: var(--sidebar-hover);
79
+ --color-sidebar-border: var(--sidebar-border);
80
+ --color-sidebar-ring: var(--ring);
81
+
82
+ --color-invert: var(--invert);
83
+ --color-invert-foreground: var(--invert-foreground);
84
+
85
+ --font-sans: var(--font-sans);
86
+ --font-mono: var(--font-mono);
87
+
88
+ --radius-sm: calc(var(--radius) - 4px);
89
+ --radius-md: calc(var(--radius) - 2px);
90
+ --radius-lg: var(--radius);
91
+ --radius-xl: calc(var(--radius) + 4px);
92
+ --radius-2xl: calc(var(--radius) + 6px);
93
+
94
+ /* ── Spacing scale as Tailwind spacing ── */
95
+ --spacing-0: var(--space-0);
96
+ --spacing-0\.5: var(--space-0\.5);
97
+ --spacing-1: var(--space-1);
98
+ --spacing-1\.5: var(--space-1\.5);
99
+ --spacing-2: var(--space-2);
100
+ --spacing-3: var(--space-3);
101
+ --spacing-4: var(--space-4);
102
+ --spacing-5: var(--space-5);
103
+ --spacing-6: var(--space-6);
104
+ --spacing-8: var(--space-8);
105
+ --spacing-10: var(--space-10);
106
+ --spacing-12: var(--space-12);
107
+ --spacing-16: var(--space-16);
108
+ --spacing-20: var(--space-20);
109
+
110
+ /* ── Component sizing ── */
111
+ --size-button-sm: var(--size-button-sm);
112
+ --size-button-md: var(--size-button-md);
113
+ --size-button-lg: var(--size-button-lg);
114
+ --size-sidebar-item: var(--size-sidebar-item);
115
+ --size-table-row: var(--size-table-row);
116
+
117
+ /* ── Shadow tokens ── */
118
+ --shadow-xs: var(--shadow-xs);
119
+ --shadow-sm: var(--shadow-sm);
120
+ --shadow-md: var(--shadow-md);
121
+ --shadow-lg: var(--shadow-lg);
122
+ --shadow-xl: var(--shadow-xl);
123
+ --shadow-2xl: var(--shadow-2xl);
124
+ }
125
+
126
+ @theme inline {
127
+ --color-destructive-foreground: var(--destructive-foreground);
128
+ --color-success: var(--success);
129
+ --color-success-foreground: var(--success-foreground);
130
+ --color-info: var(--info);
131
+ --color-info-foreground: var(--info-foreground);
132
+ --color-warning: var(--warning);
133
+ --color-warning-foreground: var(--warning-foreground);
134
+ --color-invert: var(--invert);
135
+ --color-invert-foreground: var(--invert-foreground);
136
+ }