@almadar/ui 6.56.0 → 6.57.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.
Files changed (59) hide show
  1. package/dist/{ArbitraryClassCompiler-DvzdeHxc.d.ts → ArbitraryClassCompiler-tChQ3nVq.d.ts} +15 -1
  2. package/dist/{FileTree-DUi7e7Z8.d.ts → FileTree-BSfgp-HH.d.ts} +29 -2
  3. package/dist/Typography-LZTP72Y4.js +5 -0
  4. package/dist/{UISlotRenderer-QTHFT6Z4.js → UISlotRenderer-NCGDIXN4.js} +8 -8
  5. package/dist/avl/index.cjs +4832 -4212
  6. package/dist/avl/index.d.ts +74 -5
  7. package/dist/avl/index.js +68 -711
  8. package/dist/{avl-schema-parser-C0wnAp5x.d.ts → avl-schema-parser-CH1QoZw1.d.ts} +1 -1
  9. package/dist/{chunk-HCSJHRC4.js → chunk-4ZGXIW3B.js} +1 -1
  10. package/dist/{chunk-RNY5LJXJ.js → chunk-723MJUU3.js} +1 -1
  11. package/dist/{chunk-6EV3OEBQ.js → chunk-CHNC4UYE.js} +3 -2
  12. package/dist/{chunk-SGJHVPHC.js → chunk-GZGDBS4S.js} +2 -2
  13. package/dist/{chunk-Y53Q55H5.js → chunk-HA7CJWQX.js} +1123 -1121
  14. package/dist/{chunk-JRW33U35.js → chunk-I5QOYW2Z.js} +1 -1
  15. package/dist/{chunk-KQXXO42S.js → chunk-KJGVLXEN.js} +78 -1
  16. package/dist/{chunk-HRCR53OW.js → chunk-LZRW6GXG.js} +18 -3
  17. package/dist/{chunk-2LFBQ4IS.js → chunk-MZIDOJMD.js} +2 -2
  18. package/dist/{chunk-QGH4NAQO.js → chunk-N7JIG57B.js} +9 -4
  19. package/dist/{chunk-XZKGRSIO.js → chunk-PYJ2UQWM.js} +2487 -1156
  20. package/dist/{chunk-FQM37C56.js → chunk-RHP5WL55.js} +61 -55
  21. package/dist/chunk-YYYHH5BA.js +2519 -0
  22. package/dist/{cn-ClXGlIOY.d.ts → cn-DIql5232.d.ts} +152 -24
  23. package/dist/components/index.cjs +6876 -3072
  24. package/dist/components/index.d.ts +45 -94
  25. package/dist/components/index.js +14 -16
  26. package/dist/context/index.cjs +23 -0
  27. package/dist/context/index.d.ts +2 -2
  28. package/dist/context/index.js +20 -1
  29. package/dist/hooks/index.cjs +2544 -7
  30. package/dist/hooks/index.d.ts +4 -1
  31. package/dist/hooks/index.js +7 -6
  32. package/dist/lib/drawable/three/index.cjs +22 -6
  33. package/dist/lib/drawable/three/index.d.ts +1 -1
  34. package/dist/lib/drawable/three/index.js +7 -7
  35. package/dist/lib/index.cjs +18 -3
  36. package/dist/lib/index.d.ts +1 -1
  37. package/dist/lib/index.js +4 -5
  38. package/dist/locales/index.cjs +54 -9
  39. package/dist/locales/index.js +2 -2489
  40. package/dist/providers/index.cjs +4035 -2382
  41. package/dist/providers/index.d.ts +2 -2
  42. package/dist/providers/index.js +25 -14
  43. package/dist/runtime/index.cjs +4092 -2447
  44. package/dist/runtime/index.d.ts +0 -13
  45. package/dist/runtime/index.js +11 -10
  46. package/dist/ssr/index.cjs +23 -6
  47. package/dist/ssr/index.js +23 -6
  48. package/dist/{useEventBus-JUAH3EFW.js → useEventBus-SWRN475O.js} +1 -1
  49. package/locales/ar.json +18 -3
  50. package/locales/en.json +18 -3
  51. package/locales/sl.json +18 -3
  52. package/package.json +6 -6
  53. package/tailwind-preset.cjs +3 -0
  54. package/themes/_fonts.css +1 -1
  55. package/themes/_presets.css +1 -0
  56. package/themes/kflow.css +299 -0
  57. package/dist/Typography-7PDT62PG.js +0 -5
  58. package/dist/chunk-F4ZTPKZL.js +0 -284
  59. package/dist/chunk-OKWD7LPO.js +0 -80
@@ -0,0 +1,299 @@
1
+ /**
2
+ * GENERATED — do not edit by hand.
3
+ * Source: packages/almadar-core/themes/kflow.json
4
+ * Regenerate: node tools/almadar-pattern-sync/dist/index.js themes (or `almadar-sync themes`)
5
+ */
6
+
7
+ [data-theme="kflow-light"] {
8
+ --color-primary: #4f46e5;
9
+ --color-primary-hover: #4338ca;
10
+ --color-primary-foreground: #ffffff;
11
+ --color-secondary: #eef0fb;
12
+ --color-secondary-hover: #e0e4f7;
13
+ --color-secondary-foreground: #1e1b4b;
14
+ --color-accent: #0e7490;
15
+ --color-accent-foreground: #ffffff;
16
+ --color-muted: #eef1f8;
17
+ --color-muted-foreground: #535d75;
18
+ --color-background: #f7f8fc;
19
+ --color-foreground: #0b1026;
20
+ --color-card: #ffffff;
21
+ --color-card-foreground: #0b1026;
22
+ --color-surface: #f0f2fa;
23
+ --color-border: #e1e5f1;
24
+ --color-input: #c9d0e3;
25
+ --color-ring: #4f46e5;
26
+ --color-error: #dc2626;
27
+ --color-error-foreground: #ffffff;
28
+ --color-success: #047857;
29
+ --color-success-foreground: #ffffff;
30
+ --color-warning: #b45309;
31
+ --color-warning-foreground: #ffffff;
32
+ --color-info: #0369a1;
33
+ --color-info-foreground: #ffffff;
34
+ --color-scrim: rgba(11, 16, 38, 0.55);
35
+ --color-series-1: #0891b2;
36
+ --color-series-2: #c026d3;
37
+ --color-series-3: #65a30d;
38
+ --color-series-4: #ea580c;
39
+ --color-series-5: #db2777;
40
+ --color-series-6: #2563eb;
41
+ --color-series-7: #854d0e;
42
+ --color-series-8: #0d9488;
43
+ --color-diagram-ink: #0b1026;
44
+ --color-diagram-label: #475069;
45
+ --color-diagram-guide: #94a0bd;
46
+ --color-diagram-axis: #2f3754;
47
+ --color-diagram-grid: #e1e5f1;
48
+ --color-diagram-highlight: #4f46e5;
49
+ --color-diagram-fill: #e0e7ff;
50
+ --radius-none: 0px;
51
+ --radius-sm: 8px;
52
+ --radius-md: 12px;
53
+ --radius-lg: 16px;
54
+ --radius-xl: 22px;
55
+ --radius-full: 9999px;
56
+ --border-width: 1px;
57
+ --border-width-thin: 1px;
58
+ --border-width-thick: 2px;
59
+ --icon-color: currentColor;
60
+ --transition-fast: 120ms;
61
+ --transition-normal: 200ms;
62
+ --transition-slow: 320ms;
63
+ --transition-timing: cubic-bezier(0.2, 0, 0, 1);
64
+ --hover-scale: 1.0;
65
+ --hover-translate-y: -2px;
66
+ --hover-translate-x: 0;
67
+ --active-scale: 0.98;
68
+ --active-translate-y: 0;
69
+ --focus-ring-width: 2px;
70
+ --focus-ring-offset: 2px;
71
+ --focus-ring-color: #4f46e5;
72
+ --font-family: "Plus Jakarta Sans", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
73
+ --letter-spacing: -0.005em;
74
+ --line-height: 1.6;
75
+ --shadow-main: 0 8px 24px -8px rgba(79, 70, 229, 0.20), 0 2px 6px rgba(8, 145, 178, 0.08);
76
+ --shadow-sm: 0 2px 8px -2px rgba(79, 70, 229, 0.16);
77
+ --shadow-lg: 0 24px 48px -12px rgba(79, 70, 229, 0.28), 0 6px 16px rgba(8, 145, 178, 0.10);
78
+ --shadow-inner: inset 0 1px 2px rgba(79, 70, 229, 0.10);
79
+ --shadow-none: none;
80
+ --shadow-hover: 0 14px 32px -10px rgba(79, 70, 229, 0.32), 0 4px 10px rgba(16, 185, 129, 0.10);
81
+ --shadow-active: 0 2px 6px -2px rgba(79, 70, 229, 0.24);
82
+ --font-family-display: "Fraunces", "IBM Plex Sans Arabic", Georgia, serif;
83
+ --font-family-body: "Plus Jakarta Sans", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
84
+ --font-family-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
85
+ --heading-weight: 600;
86
+ --heading-transform: none;
87
+ --heading-tracking: -0.02em;
88
+ --heading-style: normal;
89
+ --heading-shadow: none;
90
+ --duration-instant: 0ms;
91
+ --duration-fast: 120ms;
92
+ --duration-normal: 200ms;
93
+ --duration-slow: 320ms;
94
+ --duration-dramatic: 640ms;
95
+ --easing-linear: linear;
96
+ --easing-standard: cubic-bezier(0.2, 0, 0, 1);
97
+ --easing-emphasized: cubic-bezier(0.22, 0.61, 0.36, 1);
98
+ --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
99
+ --motion-modal-enter-from-transform: translateY(12px) scale(0.98);
100
+ --motion-modal-exit-to-transform: scale(0.98);
101
+ --motion-popover-enter-from-transform: scale(0.97);
102
+ --motion-popover-exit-to-transform: scale(0.97);
103
+ --motion-toast-enter-from-transform: translateY(-12px);
104
+ --motion-toast-exit-to-transform: translateY(-12px);
105
+ --motion-page-enter-from-transform: translateY(10px);
106
+ --icon-family: lucide;
107
+ --icon-stroke-width: 1.75;
108
+ --icon-default-size: 16px;
109
+ --elevation-card: var(--shadow-main);
110
+ --elevation-popover: var(--shadow-lg);
111
+ --elevation-dialog: var(--shadow-lg);
112
+ --elevation-toast: var(--shadow-main);
113
+ --elevation-interactive: var(--shadow-sm);
114
+ --elevation-pressed: var(--shadow-inner);
115
+ --radius-container: 16px;
116
+ --radius-interactive: 12px;
117
+ --radius-pill: 9999px;
118
+ --border-hairline: 1px;
119
+ --border-standard: 1px;
120
+ --border-heavy: 2px;
121
+ --corner-shape: superellipse(1.5);
122
+ --corner-shape-pill: superellipse(1.5);
123
+ --border-style: solid;
124
+ --border-style-interactive: solid;
125
+ --surface-card-image: linear-gradient(135deg, rgba(99, 102, 241, 0.07) 0%, rgba(34, 211, 238, 0.05) 55%, rgba(16, 185, 129, 0.06) 100%);
126
+ --diagram-stroke-thin: 1px;
127
+ --diagram-stroke-normal: 2px;
128
+ --diagram-stroke-bold: 3px;
129
+ --diagram-line-cap: round;
130
+ --diagram-line-join: round;
131
+ --diagram-dash: 6 4;
132
+ --diagram-dot: 1 5;
133
+ --diagram-fill-style: tint;
134
+ --diagram-fill-opacity: 0.2;
135
+ --diagram-roughness: 0;
136
+ --diagram-glow: 2;
137
+ --diagram-shadow: 0 4px 14px rgba(79, 70, 229, 0.22);
138
+ --diagram-marker: triangle;
139
+ --diagram-label-font: body;
140
+ --diagram-label-size: sm;
141
+ --diagram-label-weight: 500;
142
+ --diagram-label-case: none;
143
+ --diagram-corner: 8px;
144
+ --material-roughness: 0.25;
145
+ --material-metalness: 0.15;
146
+ --material-flat: 0;
147
+ --material-outline: 0;
148
+ --light-ambient: 0.5;
149
+ --light-key: 1.15;
150
+ --light-key-color: #eef2ff;
151
+ --scene-fog: 0.05;
152
+ }
153
+
154
+ [data-theme="kflow-dark"] {
155
+ --color-primary: #818cf8;
156
+ --color-primary-hover: #a5b4fc;
157
+ --color-primary-foreground: #0b1026;
158
+ --color-secondary: #161d40;
159
+ --color-secondary-hover: #1f2852;
160
+ --color-secondary-foreground: #e6e9f5;
161
+ --color-accent: #22d3ee;
162
+ --color-accent-foreground: #04131a;
163
+ --color-muted: #141b3a;
164
+ --color-muted-foreground: #9aa4c0;
165
+ --color-background: #070b1a;
166
+ --color-foreground: #e6e9f5;
167
+ --color-card: #0e1430;
168
+ --color-card-foreground: #e6e9f5;
169
+ --color-surface: #121a3a;
170
+ --color-border: #222b52;
171
+ --color-input: #2e3866;
172
+ --color-ring: #818cf8;
173
+ --color-error: #f87171;
174
+ --color-error-foreground: #000000;
175
+ --color-success: #34d399;
176
+ --color-success-foreground: #022c22;
177
+ --color-warning: #fbbf24;
178
+ --color-warning-foreground: #000000;
179
+ --color-info: #38bdf8;
180
+ --color-info-foreground: #000000;
181
+ --color-scrim: rgba(0, 0, 0, 0.7);
182
+ --color-series-1: #22d3ee;
183
+ --color-series-2: #e879f9;
184
+ --color-series-3: #a3e635;
185
+ --color-series-4: #fb923c;
186
+ --color-series-5: #f472b6;
187
+ --color-series-6: #60a5fa;
188
+ --color-series-7: #fef08a;
189
+ --color-series-8: #2dd4bf;
190
+ --color-diagram-ink: #e6e9f5;
191
+ --color-diagram-label: #9aa4c0;
192
+ --color-diagram-guide: #5d6890;
193
+ --color-diagram-axis: #c7cde3;
194
+ --color-diagram-grid: #222b52;
195
+ --color-diagram-highlight: #818cf8;
196
+ --color-diagram-fill: #232c63;
197
+ --radius-none: 0px;
198
+ --radius-sm: 8px;
199
+ --radius-md: 12px;
200
+ --radius-lg: 16px;
201
+ --radius-xl: 22px;
202
+ --radius-full: 9999px;
203
+ --border-width: 1px;
204
+ --border-width-thin: 1px;
205
+ --border-width-thick: 2px;
206
+ --icon-color: currentColor;
207
+ --transition-fast: 120ms;
208
+ --transition-normal: 200ms;
209
+ --transition-slow: 320ms;
210
+ --transition-timing: cubic-bezier(0.2, 0, 0, 1);
211
+ --hover-scale: 1.0;
212
+ --hover-translate-y: -2px;
213
+ --hover-translate-x: 0;
214
+ --active-scale: 0.98;
215
+ --active-translate-y: 0;
216
+ --focus-ring-width: 2px;
217
+ --focus-ring-offset: 2px;
218
+ --focus-ring-color: #818cf8;
219
+ --font-family: "Plus Jakarta Sans", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
220
+ --letter-spacing: -0.005em;
221
+ --line-height: 1.6;
222
+ --shadow-main: 0 8px 28px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(129, 140, 248, 0.08);
223
+ --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
224
+ --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, 0.7), 0 0 32px -8px rgba(99, 102, 241, 0.25);
225
+ --shadow-inner: inset 0 1px 2px rgba(0, 0, 0, 0.4);
226
+ --shadow-none: none;
227
+ --shadow-hover: 0 14px 36px -10px rgba(99, 102, 241, 0.35);
228
+ --shadow-active: 0 2px 6px -2px rgba(0, 0, 0, 0.5);
229
+ --font-family-display: "Fraunces", "IBM Plex Sans Arabic", Georgia, serif;
230
+ --font-family-body: "Plus Jakarta Sans", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
231
+ --font-family-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
232
+ --heading-weight: 600;
233
+ --heading-transform: none;
234
+ --heading-tracking: -0.02em;
235
+ --heading-style: normal;
236
+ --heading-shadow: none;
237
+ --duration-instant: 0ms;
238
+ --duration-fast: 120ms;
239
+ --duration-normal: 200ms;
240
+ --duration-slow: 320ms;
241
+ --duration-dramatic: 640ms;
242
+ --easing-linear: linear;
243
+ --easing-standard: cubic-bezier(0.2, 0, 0, 1);
244
+ --easing-emphasized: cubic-bezier(0.22, 0.61, 0.36, 1);
245
+ --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
246
+ --motion-modal-enter-from-transform: translateY(12px) scale(0.98);
247
+ --motion-modal-exit-to-transform: scale(0.98);
248
+ --motion-popover-enter-from-transform: scale(0.97);
249
+ --motion-popover-exit-to-transform: scale(0.97);
250
+ --motion-toast-enter-from-transform: translateY(-12px);
251
+ --motion-toast-exit-to-transform: translateY(-12px);
252
+ --motion-page-enter-from-transform: translateY(10px);
253
+ --icon-family: lucide;
254
+ --icon-stroke-width: 1.75;
255
+ --icon-default-size: 16px;
256
+ --elevation-card: var(--shadow-main);
257
+ --elevation-popover: var(--shadow-lg);
258
+ --elevation-dialog: var(--shadow-lg);
259
+ --elevation-toast: var(--shadow-main);
260
+ --elevation-interactive: var(--shadow-sm);
261
+ --elevation-pressed: var(--shadow-inner);
262
+ --radius-container: 16px;
263
+ --radius-interactive: 12px;
264
+ --radius-pill: 9999px;
265
+ --border-hairline: 1px;
266
+ --border-standard: 1px;
267
+ --border-heavy: 2px;
268
+ --corner-shape: superellipse(1.5);
269
+ --corner-shape-pill: superellipse(1.5);
270
+ --border-style: solid;
271
+ --border-style-interactive: solid;
272
+ --surface-card-image: linear-gradient(135deg, rgba(129, 140, 248, 0.10) 0%, rgba(34, 211, 238, 0.06) 55%, rgba(52, 211, 153, 0.07) 100%);
273
+ --diagram-stroke-thin: 1px;
274
+ --diagram-stroke-normal: 2px;
275
+ --diagram-stroke-bold: 3px;
276
+ --diagram-line-cap: round;
277
+ --diagram-line-join: round;
278
+ --diagram-dash: 6 4;
279
+ --diagram-dot: 1 5;
280
+ --diagram-fill-style: tint;
281
+ --diagram-fill-opacity: 0.2;
282
+ --diagram-roughness: 0;
283
+ --diagram-glow: 2;
284
+ --diagram-shadow: 0 4px 14px rgba(79, 70, 229, 0.22);
285
+ --diagram-marker: triangle;
286
+ --diagram-label-font: body;
287
+ --diagram-label-size: sm;
288
+ --diagram-label-weight: 500;
289
+ --diagram-label-case: none;
290
+ --diagram-corner: 8px;
291
+ --material-roughness: 0.25;
292
+ --material-metalness: 0.15;
293
+ --material-flat: 0;
294
+ --material-outline: 0;
295
+ --light-ambient: 0.5;
296
+ --light-key: 1.15;
297
+ --light-key-color: #eef2ff;
298
+ --scene-fog: 0.05;
299
+ }
@@ -1,5 +0,0 @@
1
- export { Typography } from './chunk-HCSJHRC4.js';
2
- import './chunk-64WACXM7.js';
3
- import './chunk-RNY5LJXJ.js';
4
- import './chunk-HRCR53OW.js';
5
- import './chunk-QPXIAUJD.js';
@@ -1,284 +0,0 @@
1
- import { Icon, Button, Switch, Input } from './chunk-XZKGRSIO.js';
2
- import { VStack, HStack } from './chunk-Y53Q55H5.js';
3
- import { Typography } from './chunk-HCSJHRC4.js';
4
- import { cn } from './chunk-64WACXM7.js';
5
- import React from 'react';
6
- import { useTranslate } from '@almadar/ui/hooks';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
-
9
- var isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
10
- var isArr = (v) => Array.isArray(v);
11
- function kindOf(v) {
12
- if (v === null) return "null";
13
- if (isArr(v)) return "array";
14
- if (isObj(v)) return "object";
15
- if (typeof v === "number") return "number";
16
- if (typeof v === "boolean") return "boolean";
17
- return "string";
18
- }
19
- var TYPE_LABEL_KEY = {
20
- string: "jsonTree.type.text",
21
- number: "jsonTree.type.number",
22
- boolean: "jsonTree.type.boolean"
23
- };
24
- var TYPE_LABEL_SYMBOL = {
25
- object: "{}",
26
- array: "[]",
27
- null: "\u2014"
28
- };
29
- function typeLabel(kind, t) {
30
- if (kind === "object" || kind === "array" || kind === "null") return TYPE_LABEL_SYMBOL[kind];
31
- return t(TYPE_LABEL_KEY[kind] ?? "");
32
- }
33
- var KIND_OPTIONS = ["string", "number", "boolean", "object", "array"];
34
- function emptyOf(kind) {
35
- switch (kind) {
36
- case "object":
37
- return {};
38
- case "array":
39
- return [];
40
- case "number":
41
- return 0;
42
- case "boolean":
43
- return false;
44
- case "null":
45
- return null;
46
- default:
47
- return "";
48
- }
49
- }
50
- function templateFrom(arr) {
51
- if (arr.length === 0) return "";
52
- const first = arr[0];
53
- if (isObj(first)) {
54
- const blank = {};
55
- for (const k of Object.keys(first)) blank[k] = isObj(first[k]) ? {} : isArr(first[k]) ? [] : first[k];
56
- return blank;
57
- }
58
- if (isArr(first)) return [];
59
- return emptyOf(kindOf(first));
60
- }
61
- function ScalarControl({
62
- value,
63
- onChange
64
- }) {
65
- if (typeof value === "boolean") {
66
- return /* @__PURE__ */ jsx(Switch, { checked: value, onChange: (c) => onChange(c) });
67
- }
68
- const numeric = typeof value === "number";
69
- const initial = value === null ? "" : String(value);
70
- const [draft, setDraft] = React.useState(initial);
71
- React.useEffect(() => setDraft(initial), [initial]);
72
- const commit = () => {
73
- if (numeric) {
74
- const n = draft.trim() === "" ? 0 : Number(draft);
75
- onChange(Number.isNaN(n) ? 0 : n);
76
- } else {
77
- onChange(draft);
78
- }
79
- };
80
- return /* @__PURE__ */ jsx(
81
- Input,
82
- {
83
- inputType: numeric ? "number" : "text",
84
- value: draft,
85
- placeholder: value === null ? "null" : void 0,
86
- onChange: (e) => setDraft(e.target.value),
87
- onBlur: commit,
88
- onKeyDown: (e) => {
89
- if (e.key === "Enter") commit();
90
- }
91
- }
92
- );
93
- }
94
- function KindSelect({
95
- kind,
96
- onChange
97
- }) {
98
- const { t } = useTranslate();
99
- return /* @__PURE__ */ jsx(
100
- "select",
101
- {
102
- value: kind === "null" ? "string" : kind,
103
- onChange: (e) => onChange(e.target.value),
104
- "aria-label": t("jsonTree.valueType"),
105
- className: cn(
106
- "h-6 rounded-interactive bg-muted text-muted-foreground text-[10px] font-mono px-1",
107
- "border-[length:var(--border-width-thin)] border-border",
108
- "hover:bg-card focus:outline-none focus:ring-1 focus:ring-ring"
109
- ),
110
- children: KIND_OPTIONS.map((k) => /* @__PURE__ */ jsx("option", { value: k, children: typeLabel(k, t) }, k))
111
- }
112
- );
113
- }
114
- function ValueNode({
115
- value,
116
- onChange,
117
- depth,
118
- readonly
119
- }) {
120
- const kind = kindOf(value);
121
- if (kind === "object" || kind === "array") {
122
- return /* @__PURE__ */ jsx(ContainerNode, { value, onChange, depth, readonly });
123
- }
124
- if (readonly) {
125
- return /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-mono text-foreground", children: value === null ? "null" : String(value) });
126
- }
127
- return /* @__PURE__ */ jsx(ScalarControl, { value, onChange });
128
- }
129
- function Row({
130
- rowKey,
131
- isArrayItem,
132
- value,
133
- depth,
134
- onValue,
135
- onRenameKey,
136
- onChangeKind,
137
- onRemove,
138
- readonly
139
- }) {
140
- const { t } = useTranslate();
141
- const [keyDraft, setKeyDraft] = React.useState(rowKey);
142
- React.useEffect(() => setKeyDraft(rowKey), [rowKey]);
143
- const container = isObj(value) || isArr(value);
144
- return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "group w-max min-w-full", children: [
145
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", className: "py-0.5 w-max", children: [
146
- readonly ? /* @__PURE__ */ jsx("span", { className: cn(
147
- "h-6 rounded-interactive bg-muted text-muted-foreground text-[10px] font-mono px-1 flex items-center",
148
- "border-[length:var(--border-width-thin)] border-border"
149
- ), children: typeLabel(kindOf(value), t) }) : /* @__PURE__ */ jsx(KindSelect, { kind: kindOf(value), onChange: onChangeKind }),
150
- isArrayItem ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "w-6 shrink-0 font-mono", children: rowKey }) : readonly ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "w-20 shrink-0 font-mono truncate", children: rowKey }) : /* @__PURE__ */ jsx("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ jsx(
151
- Input,
152
- {
153
- inputType: "text",
154
- value: keyDraft,
155
- onChange: (e) => setKeyDraft(e.target.value),
156
- onBlur: () => keyDraft !== rowKey && onRenameKey(keyDraft),
157
- onKeyDown: (e) => {
158
- if (e.key === "Enter" && keyDraft !== rowKey) onRenameKey(keyDraft);
159
- },
160
- className: "font-mono"
161
- }
162
- ) }),
163
- !container && /* @__PURE__ */ jsx("div", { className: "w-48 shrink-0", children: /* @__PURE__ */ jsx(ValueNode, { value, onChange: onValue, depth: depth + 1, readonly }) }),
164
- !readonly && /* @__PURE__ */ jsx(
165
- Button,
166
- {
167
- variant: "ghost",
168
- size: "sm",
169
- icon: "x",
170
- onClick: onRemove,
171
- "aria-label": t("common.remove"),
172
- className: "shrink-0 text-muted-foreground hover:text-error"
173
- }
174
- )
175
- ] }),
176
- container && /* @__PURE__ */ jsx("div", { className: "pl-2", children: /* @__PURE__ */ jsx(ValueNode, { value, onChange: onValue, depth: depth + 1, readonly }) })
177
- ] });
178
- }
179
- function ContainerNode({
180
- value,
181
- onChange,
182
- depth,
183
- readonly
184
- }) {
185
- const { t } = useTranslate();
186
- const [open, setOpen] = React.useState(depth < 2);
187
- const array = isArr(value);
188
- const entries = array ? value.map((v, i) => [String(i), v]) : Object.entries(value);
189
- const setObjValue = (key, next) => {
190
- onChange({ ...value, [key]: next });
191
- };
192
- const renameKey = (oldKey, newKey) => {
193
- if (!newKey || newKey === oldKey) return;
194
- const out = {};
195
- for (const [k, v] of Object.entries(value)) out[k === oldKey ? newKey : k] = v;
196
- onChange(out);
197
- };
198
- const removeObjKey = (key) => {
199
- const out = {};
200
- for (const [k, v] of Object.entries(value)) if (k !== key) out[k] = v;
201
- onChange(out);
202
- };
203
- const changeObjKind = (key, k) => setObjValue(key, emptyOf(k));
204
- const setArrValue = (idx, next) => {
205
- const copy = [...value];
206
- copy[idx] = next;
207
- onChange(copy);
208
- };
209
- const removeArrIdx = (idx) => onChange(value.filter((_, i) => i !== idx));
210
- const changeArrKind = (idx, k) => setArrValue(idx, emptyOf(k));
211
- const add = () => {
212
- if (array) {
213
- onChange([...value, templateFrom(value)]);
214
- } else {
215
- const obj = value;
216
- let key = "key";
217
- let n = 1;
218
- while (key in obj) {
219
- key = `key${n}`;
220
- n += 1;
221
- }
222
- onChange({ ...obj, [key]: "" });
223
- }
224
- };
225
- const summaryKey = array ? entries.length === 1 ? "jsonTree.itemCountOne" : "jsonTree.itemCountOther" : entries.length === 1 ? "jsonTree.fieldCountOne" : "jsonTree.fieldCountOther";
226
- const summary = t(summaryKey, { count: entries.length });
227
- return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: "w-full", children: [
228
- /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: /* @__PURE__ */ jsxs(
229
- "button",
230
- {
231
- type: "button",
232
- onClick: () => setOpen((o) => !o),
233
- className: "flex items-center gap-1 text-muted-foreground hover:text-foreground",
234
- "aria-label": open ? t("jsonTree.collapse") : t("jsonTree.expand"),
235
- children: [
236
- /* @__PURE__ */ jsx(Icon, { name: open ? "chevron-down" : "chevron-right", size: "sm" }),
237
- /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: array ? "[ ]" : "{ }" }),
238
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: summary })
239
- ]
240
- }
241
- ) }),
242
- open && /* @__PURE__ */ jsxs(
243
- VStack,
244
- {
245
- gap: "none",
246
- className: cn("ml-1.5 pl-1.5 w-max min-w-full border-l-[length:var(--border-width-thin)] border-border"),
247
- children: [
248
- entries.map(([k, v], idx) => /* @__PURE__ */ jsx(
249
- Row,
250
- {
251
- rowKey: k,
252
- isArrayItem: array,
253
- value: v,
254
- depth,
255
- onValue: (next) => array ? setArrValue(idx, next) : setObjValue(k, next),
256
- onRenameKey: (nk) => renameKey(k, nk),
257
- onChangeKind: (kind) => array ? changeArrKind(idx, kind) : changeObjKind(k, kind),
258
- onRemove: () => array ? removeArrIdx(idx) : removeObjKey(k),
259
- readonly
260
- },
261
- array ? idx : k
262
- )),
263
- !readonly && /* @__PURE__ */ jsx(
264
- Button,
265
- {
266
- variant: "ghost",
267
- size: "sm",
268
- icon: "plus",
269
- label: array ? t("jsonTree.addItem") : t("jsonTree.addField"),
270
- onClick: add,
271
- className: "self-start text-muted-foreground"
272
- }
273
- )
274
- ]
275
- }
276
- )
277
- ] });
278
- }
279
- var JsonTreeEditor = ({ value, onChange, className, readonly }) => {
280
- const root = value ?? "";
281
- return /* @__PURE__ */ jsx("div", { className: cn("w-full overflow-x-auto rounded-container bg-card/40 p-2 border-[length:var(--border-width-thin)] border-border", className), children: /* @__PURE__ */ jsx(ValueNode, { value: root, onChange, depth: 0, readonly }) });
282
- };
283
-
284
- export { JsonTreeEditor };
@@ -1,80 +0,0 @@
1
- import { parseMarkdownWithCodeBlocks } from './chunk-KQXXO42S.js';
2
-
3
- // lib/parseLessonSegments.ts
4
- function extractTagContent(content, tagName) {
5
- const closedTagRegex = new RegExp(`<${tagName}>([\\s\\S]*?)<\\/${tagName}>`, "i");
6
- const closedMatch = content.match(closedTagRegex);
7
- if (closedMatch) {
8
- return { content: closedMatch[1].trim(), fullMatch: closedMatch[0] };
9
- }
10
- const unclosedTagRegex = new RegExp(
11
- `<${tagName}>([\\s\\S]*?)(?=<(?:activate|connect|reflect|bloom|prq|question|answer|visualize)|\\n\\n#|$)`,
12
- "i"
13
- );
14
- const unclosedMatch = content.match(unclosedTagRegex);
15
- if (unclosedMatch) {
16
- return { content: unclosedMatch[1].trim(), fullMatch: unclosedMatch[0] };
17
- }
18
- return null;
19
- }
20
- function parseLessonSegments(lesson) {
21
- if (!lesson) return [];
22
- let content = lesson.replace(/<prq>[\s\S]*?<\/prq>/gi, "").trim();
23
- const segments = [];
24
- const activateResult = extractTagContent(content, "activate");
25
- if (activateResult) {
26
- segments.push({ type: "activate", question: activateResult.content });
27
- content = content.replace(activateResult.fullMatch, "").trim();
28
- }
29
- const connectResult = extractTagContent(content, "connect");
30
- if (connectResult) {
31
- segments.push({ type: "connect", content: connectResult.content });
32
- content = content.replace(connectResult.fullMatch, "").trim();
33
- }
34
- const tagRegex = new RegExp(
35
- '(?<reflect><reflect>(?<reflectClosed>[\\s\\S]*?)<\\/reflect>)|(?<reflectUnclosed><reflect>(?<reflectOpen>[\\s\\S]*?)(?=<(?:activate|connect|reflect|bloom|prq|question|answer|visualize)|\\n\\n#|$))|(?<bloom><bloom\\s+level="(?<bloomLevel>remember|understand|apply|analyze|evaluate|create)">(?<bloomClosed>[\\s\\S]*?)<\\/bloom>)|(?<bloomUnclosed><bloom\\s+level="(?<bloomLevelUn>remember|understand|apply|analyze|evaluate|create)">(?<bloomOpen>[\\s\\S]*?)(?=<(?:activate|connect|reflect|bloom|prq|question|answer|visualize)|\\n\\n#|$))|(?<quiz><question>(?<quizQuestion>[\\s\\S]*?)<\\/question>\\s*<answer>(?<quizAnswer>[\\s\\S]*?)<\\/answer>)|(?<visualize><visualize\\s+type="(?<vizType>algorithms|math|physics|biology|chemistry|probability)"\\s+description="(?<vizDesc>[^"]*?)"\\s*\\/?>)',
36
- "gi"
37
- );
38
- let lastIndex = 0;
39
- let match;
40
- while ((match = tagRegex.exec(content)) !== null) {
41
- const before = content.slice(lastIndex, match.index);
42
- if (before.trim()) {
43
- segments.push(...parseMarkdownWithCodeBlocks(before));
44
- }
45
- const g = match.groups ?? {};
46
- if (g.reflect || g.reflectUnclosed) {
47
- const prompt = (g.reflectClosed ?? g.reflectOpen ?? "").trim();
48
- if (prompt) segments.push({ type: "reflect", prompt });
49
- } else if (g.bloom || g.bloomUnclosed) {
50
- const level = g.bloomLevel ?? g.bloomLevelUn;
51
- const bloomContent = g.bloomClosed ?? g.bloomOpen ?? "";
52
- if (level && bloomContent) {
53
- const qMatch = bloomContent.match(/<question>([\s\S]*?)<\/question>/i);
54
- const aMatch = bloomContent.match(/<answer>([\s\S]*?)<\/answer>/i);
55
- if (qMatch && aMatch) {
56
- segments.push({ type: "bloom", level, question: qMatch[1].trim(), answer: aMatch[1].trim() });
57
- } else if (qMatch) {
58
- segments.push({ type: "bloom", level, question: qMatch[1].trim(), answer: "(Answer not provided)" });
59
- } else {
60
- const clean = bloomContent.replace(/^\*\*Question\s*\d*:?\*\*\s*/i, "").replace(/^\*\*Q\d*:?\*\*\s*/i, "").trim();
61
- if (clean) segments.push({ type: "bloom", level, question: clean, answer: "(See answers section below)" });
62
- }
63
- }
64
- } else if (g.quiz) {
65
- segments.push({ type: "quiz", question: g.quizQuestion.trim(), answer: g.quizAnswer.trim() });
66
- } else if (g.visualize) {
67
- segments.push({
68
- type: "visualization",
69
- visualizationType: g.vizType,
70
- description: g.vizDesc ?? ""
71
- });
72
- }
73
- lastIndex = tagRegex.lastIndex;
74
- }
75
- const remaining = content.slice(lastIndex);
76
- if (remaining.trim()) segments.push(...parseMarkdownWithCodeBlocks(remaining));
77
- return segments;
78
- }
79
-
80
- export { parseLessonSegments };