@reforma/components 0.1.5 → 0.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/dist/Scrollable/Scrollable.d.ts +1 -2
- package/dist/Scrollable/Scrollable.d.ts.map +1 -1
- package/dist/Scrollable/Scrollable.js +45 -38
- package/dist/Scrollable/Scrollable.js.map +1 -1
- package/dist/Scrollable/useScrollChrome.d.ts +1 -2
- package/dist/Scrollable/useScrollChrome.d.ts.map +1 -1
- package/dist/Scrollable/useScrollChrome.js +125 -110
- package/dist/Scrollable/useScrollChrome.js.map +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.d.ts +2 -1
- package/dist/chat/ComposerBanner/ComposerBanner.d.ts.map +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.js +37 -29
- package/dist/chat/ComposerBanner/ComposerBanner.js.map +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.module.css +1 -1
- package/dist/chat/ComposerBanner/ComposerBanner.module.css.js +5 -3
- package/dist/chat/ComposerBanner/ComposerBanner.module.css.js.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.d.ts.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.js +89 -90
- package/dist/chat/Tool/agent/AgentTool.js.map +1 -1
- package/dist/chat/Tool/edit/EditTool.js +1 -1
- package/dist/chat/Tool/edit/EditTool.js.map +1 -1
- package/dist/node_modules/zod/v4/classic/errors.js +38 -0
- package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.js +21 -0
- package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +822 -0
- package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/api.js +561 -0
- package/dist/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.js +262 -0
- package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/zod/v4/core/core.js +97 -0
- package/dist/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.js +35 -0
- package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.js +79 -0
- package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +308 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/memoizer.js +203 -0
- package/dist/node_modules/zod/v4/core/memoizer.js.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.js +113 -0
- package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.js +59 -0
- package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.js +41 -0
- package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.js +1104 -0
- package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js +380 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
- package/dist/node_modules/zod/v4/core/util.js +465 -0
- package/dist/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.js +9 -0
- package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/zod/v4/locales/en.js +97 -0
- package/dist/node_modules/zod/v4/locales/en.js.map +1 -0
- package/dist/openui/actions.d.ts +16 -0
- package/dist/openui/actions.d.ts.map +1 -0
- package/dist/openui/actions.js +58 -0
- package/dist/openui/actions.js.map +1 -0
- package/dist/openui/components/controls.d.ts +34 -0
- package/dist/openui/components/controls.d.ts.map +1 -0
- package/dist/openui/components/controls.js +40 -0
- package/dist/openui/components/controls.js.map +1 -0
- package/dist/openui/components/layout.d.ts +74 -0
- package/dist/openui/components/layout.d.ts.map +1 -0
- package/dist/openui/components/layout.js +154 -0
- package/dist/openui/components/layout.js.map +1 -0
- package/dist/openui/components/list.d.ts +17 -0
- package/dist/openui/components/list.d.ts.map +1 -0
- package/dist/openui/components/list.js +96 -0
- package/dist/openui/components/list.js.map +1 -0
- package/dist/openui/components/svg.d.ts +100 -0
- package/dist/openui/components/svg.d.ts.map +1 -0
- package/dist/openui/components/svg.js +246 -0
- package/dist/openui/components/svg.js.map +1 -0
- package/dist/openui/components/table.d.ts +6 -0
- package/dist/openui/components/table.d.ts.map +1 -0
- package/dist/openui/components/table.js +54 -0
- package/dist/openui/components/table.js.map +1 -0
- package/dist/openui/components/text.d.ts +89 -0
- package/dist/openui/components/text.d.ts.map +1 -0
- package/dist/openui/components/text.js +181 -0
- package/dist/openui/components/text.js.map +1 -0
- package/dist/openui/functions/colors.d.ts +12 -0
- package/dist/openui/functions/colors.d.ts.map +1 -0
- package/dist/openui/functions/colors.js +32 -0
- package/dist/openui/functions/colors.js.map +1 -0
- package/dist/openui/functions/data.d.ts +170 -0
- package/dist/openui/functions/data.d.ts.map +1 -0
- package/dist/openui/functions/data.js +308 -0
- package/dist/openui/functions/data.js.map +1 -0
- package/dist/openui/functions/dates.d.ts +57 -0
- package/dist/openui/functions/dates.d.ts.map +1 -0
- package/dist/openui/functions/dates.js +184 -0
- package/dist/openui/functions/dates.js.map +1 -0
- package/dist/openui/functions/index.d.ts +136 -0
- package/dist/openui/functions/index.d.ts.map +1 -0
- package/dist/openui/functions/index.js +11 -0
- package/dist/openui/functions/index.js.map +1 -0
- package/dist/openui/functions/lists.d.ts +102 -0
- package/dist/openui/functions/lists.d.ts.map +1 -0
- package/dist/openui/functions/lists.js +305 -0
- package/dist/openui/functions/lists.js.map +1 -0
- package/dist/openui/functions/numbers.d.ts +72 -0
- package/dist/openui/functions/numbers.d.ts.map +1 -0
- package/dist/openui/functions/numbers.js +201 -0
- package/dist/openui/functions/numbers.js.map +1 -0
- package/dist/openui/functions/shared.d.ts +28 -0
- package/dist/openui/functions/shared.d.ts.map +1 -0
- package/dist/openui/functions/shared.js +69 -0
- package/dist/openui/functions/shared.js.map +1 -0
- package/dist/openui/functions/text.d.ts +97 -0
- package/dist/openui/functions/text.d.ts.map +1 -0
- package/dist/openui/functions/text.js +223 -0
- package/dist/openui/functions/text.js.map +1 -0
- package/dist/openui/index.d.ts +5 -0
- package/dist/openui/index.d.ts.map +1 -0
- package/dist/openui/index.js +14 -0
- package/dist/openui/index.js.map +1 -0
- package/dist/openui/library.d.ts +8 -0
- package/dist/openui/library.d.ts.map +1 -0
- package/dist/openui/library.js +37 -0
- package/dist/openui/library.js.map +1 -0
- package/dist/openui/schema.d.ts +36 -0
- package/dist/openui/schema.d.ts.map +1 -0
- package/dist/openui/schema.js +24 -0
- package/dist/openui/schema.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { defineFunction as i } from "@openuidev/react-lang";
|
|
2
|
+
import { read as $, MAX_ITEMS as d, list as b } from "./shared.js";
|
|
3
|
+
import { string as e, object as o, number as u, enum as w, union as x, array as S, any as f } from "../../node_modules/zod/v4/classic/schemas.js";
|
|
4
|
+
const h = "en-US";
|
|
5
|
+
function g(t) {
|
|
6
|
+
const r = (t ?? "USD").toUpperCase();
|
|
7
|
+
return /^[A-Z]{3}$/.test(r) ? r : "USD";
|
|
8
|
+
}
|
|
9
|
+
function l(t, r) {
|
|
10
|
+
try {
|
|
11
|
+
return t.toLocaleString(h, r);
|
|
12
|
+
} catch {
|
|
13
|
+
return t.toLocaleString(h, {
|
|
14
|
+
...r,
|
|
15
|
+
currency: "USD"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const D = i({
|
|
20
|
+
name: "Format",
|
|
21
|
+
description: 'Number as text: "number" 12,345.6, "currency" $12,345.68 (currency is a code like "EUR"), "percent" 45 -> 45%, "compact" 1.2M ($1.2M with a currency)',
|
|
22
|
+
params: o({
|
|
23
|
+
value: u(),
|
|
24
|
+
kind: w(["number", "currency", "percent", "compact"]).optional(),
|
|
25
|
+
decimals: u().optional(),
|
|
26
|
+
currency: e().optional()
|
|
27
|
+
}),
|
|
28
|
+
returns: e(),
|
|
29
|
+
fn: ({
|
|
30
|
+
value: t,
|
|
31
|
+
kind: r = "number",
|
|
32
|
+
decimals: a,
|
|
33
|
+
currency: n
|
|
34
|
+
}) => {
|
|
35
|
+
if (!Number.isFinite(t)) throw new Error("value is not a finite number");
|
|
36
|
+
const c = a === void 0 ? void 0 : Math.min(Math.max(Math.trunc(a), 0), 10), s = (p, m = 0) => c === void 0 ? {
|
|
37
|
+
minimumFractionDigits: m,
|
|
38
|
+
maximumFractionDigits: p
|
|
39
|
+
} : {
|
|
40
|
+
minimumFractionDigits: m && c,
|
|
41
|
+
maximumFractionDigits: c
|
|
42
|
+
};
|
|
43
|
+
switch (r) {
|
|
44
|
+
case "currency":
|
|
45
|
+
return l(t, {
|
|
46
|
+
style: "currency",
|
|
47
|
+
currency: g(n),
|
|
48
|
+
...s(2, 2)
|
|
49
|
+
});
|
|
50
|
+
case "percent":
|
|
51
|
+
return `${l(t, s(1))}%`;
|
|
52
|
+
case "compact":
|
|
53
|
+
return l(t, {
|
|
54
|
+
notation: "compact",
|
|
55
|
+
...s(1),
|
|
56
|
+
...n ? {
|
|
57
|
+
style: "currency",
|
|
58
|
+
currency: g(n)
|
|
59
|
+
} : {}
|
|
60
|
+
});
|
|
61
|
+
default:
|
|
62
|
+
return l(t, s(2));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}), M = i({
|
|
66
|
+
name: "Join",
|
|
67
|
+
description: 'Joins the items (or their field) into text with sep (default ", "), skipping nulls',
|
|
68
|
+
params: o({
|
|
69
|
+
list: b(),
|
|
70
|
+
sep: e().optional(),
|
|
71
|
+
field: e().optional()
|
|
72
|
+
}),
|
|
73
|
+
returns: e(),
|
|
74
|
+
fn: ({
|
|
75
|
+
list: t,
|
|
76
|
+
sep: r = ", ",
|
|
77
|
+
field: a = ""
|
|
78
|
+
}) => t.map((n) => $(n, a)).filter((n) => n != null).map((n) => typeof n == "object" ? JSON.stringify(n) : String(n)).join(r)
|
|
79
|
+
}), F = i({
|
|
80
|
+
name: "Plural",
|
|
81
|
+
description: 'Count and word: @Plural(1, "guest") is "1 guest", 3 gives "3 guests"; plural defaults to word + "s"',
|
|
82
|
+
params: o({
|
|
83
|
+
n: u(),
|
|
84
|
+
word: e(),
|
|
85
|
+
plural: e().optional()
|
|
86
|
+
}),
|
|
87
|
+
returns: e(),
|
|
88
|
+
fn: ({
|
|
89
|
+
n: t,
|
|
90
|
+
word: r,
|
|
91
|
+
plural: a
|
|
92
|
+
}) => `${l(t, {
|
|
93
|
+
maximumFractionDigits: 2
|
|
94
|
+
})} ${Math.abs(t) === 1 ? r : a ?? `${r}s`}`
|
|
95
|
+
}), U = i({
|
|
96
|
+
name: "Pad",
|
|
97
|
+
description: 'Pads the start of value to length with char (default "0"), e.g. 7 -> "07"',
|
|
98
|
+
params: o({
|
|
99
|
+
value: x([e(), u()]),
|
|
100
|
+
length: u(),
|
|
101
|
+
char: e().optional()
|
|
102
|
+
}),
|
|
103
|
+
returns: e(),
|
|
104
|
+
fn: ({
|
|
105
|
+
value: t,
|
|
106
|
+
length: r,
|
|
107
|
+
char: a = "0"
|
|
108
|
+
}) => String(t).padStart(Math.min(Math.trunc(r), 1e3), a || "0")
|
|
109
|
+
}), k = i({
|
|
110
|
+
name: "Upper",
|
|
111
|
+
description: "Text in upper case",
|
|
112
|
+
params: o({
|
|
113
|
+
text: e()
|
|
114
|
+
}),
|
|
115
|
+
returns: e(),
|
|
116
|
+
fn: ({
|
|
117
|
+
text: t
|
|
118
|
+
}) => t.toUpperCase()
|
|
119
|
+
}), C = i({
|
|
120
|
+
name: "Lower",
|
|
121
|
+
description: "Text in lower case",
|
|
122
|
+
params: o({
|
|
123
|
+
text: e()
|
|
124
|
+
}),
|
|
125
|
+
returns: e(),
|
|
126
|
+
fn: ({
|
|
127
|
+
text: t
|
|
128
|
+
}) => t.toLowerCase()
|
|
129
|
+
}), L = i({
|
|
130
|
+
name: "Trim",
|
|
131
|
+
description: "Text without spaces at the start and end",
|
|
132
|
+
params: o({
|
|
133
|
+
text: e()
|
|
134
|
+
}),
|
|
135
|
+
returns: e(),
|
|
136
|
+
fn: ({
|
|
137
|
+
text: t
|
|
138
|
+
}) => t.trim()
|
|
139
|
+
}), N = i({
|
|
140
|
+
name: "Capitalize",
|
|
141
|
+
description: 'Each word with a capital first letter, e.g. "new york" is "New York"',
|
|
142
|
+
params: o({
|
|
143
|
+
text: e()
|
|
144
|
+
}),
|
|
145
|
+
returns: e(),
|
|
146
|
+
fn: ({
|
|
147
|
+
text: t
|
|
148
|
+
}) => t.replace(new RegExp('(^|[\\s\\-(/"])(\\p{L})', "gu"), (r, a, n) => a + n.toUpperCase())
|
|
149
|
+
}), E = i({
|
|
150
|
+
name: "Split",
|
|
151
|
+
description: 'List of the parts of text between sep (default ","), each trimmed, empty parts dropped, e.g. @Split("a, b,,c") is ["a", "b", "c"]',
|
|
152
|
+
params: o({
|
|
153
|
+
text: e(),
|
|
154
|
+
sep: e().optional()
|
|
155
|
+
}),
|
|
156
|
+
returns: S(e()),
|
|
157
|
+
fn: ({
|
|
158
|
+
text: t,
|
|
159
|
+
sep: r = ","
|
|
160
|
+
}) => {
|
|
161
|
+
const a = t.split(r === "" ? "" : r).map((n) => n.trim()).filter((n) => n !== "");
|
|
162
|
+
if (a.length > d) throw new Error(`more than ${d} items`);
|
|
163
|
+
return a;
|
|
164
|
+
}
|
|
165
|
+
}), T = i({
|
|
166
|
+
name: "Replace",
|
|
167
|
+
description: "Text with every find replaced by replacement",
|
|
168
|
+
params: o({
|
|
169
|
+
text: e(),
|
|
170
|
+
find: e(),
|
|
171
|
+
replacement: e()
|
|
172
|
+
}),
|
|
173
|
+
returns: e(),
|
|
174
|
+
fn: ({
|
|
175
|
+
text: t,
|
|
176
|
+
find: r,
|
|
177
|
+
replacement: a
|
|
178
|
+
}) => r === "" ? t : t.split(r).join(a)
|
|
179
|
+
}), P = i({
|
|
180
|
+
name: "Duration",
|
|
181
|
+
description: 'Seconds as text: "short" 1h 20m, 4m 05s, 45s (default); "clock" 1:20:00, 4:05',
|
|
182
|
+
params: o({
|
|
183
|
+
seconds: u(),
|
|
184
|
+
style: w(["short", "clock"]).optional()
|
|
185
|
+
}),
|
|
186
|
+
returns: e(),
|
|
187
|
+
fn: ({
|
|
188
|
+
seconds: t,
|
|
189
|
+
style: r = "short"
|
|
190
|
+
}) => {
|
|
191
|
+
if (!Number.isFinite(t)) throw new Error("seconds is not a finite number");
|
|
192
|
+
const a = t < 0 ? "-" : "", n = Math.round(Math.abs(t)), [c, s, p] = [Math.floor(n / 3600), Math.floor(n % 3600 / 60), n % 60], m = (y) => String(y).padStart(2, "0");
|
|
193
|
+
return r === "clock" ? a + (c ? `${c}:${m(s)}:${m(p)}` : `${s}:${m(p)}`) : c ? `${a}${c}h${s ? ` ${s}m` : ""}` : s ? `${a}${s}m${p ? ` ${m(p)}s` : ""}` : `${a}${p}s`;
|
|
194
|
+
}
|
|
195
|
+
}), j = i({
|
|
196
|
+
name: "Default",
|
|
197
|
+
description: 'value, or fallback when value is null, "" or not a number, e.g. an empty number input: @Default($weight, 0)',
|
|
198
|
+
params: o({
|
|
199
|
+
value: f().optional(),
|
|
200
|
+
fallback: f()
|
|
201
|
+
}),
|
|
202
|
+
returns: f(),
|
|
203
|
+
fn: ({
|
|
204
|
+
value: t,
|
|
205
|
+
fallback: r
|
|
206
|
+
}) => t == null || t === "" || typeof t == "number" && Number.isNaN(t) ? r : t
|
|
207
|
+
}), _ = [D, M, F, U, k, C, L, N, E, T, P, j];
|
|
208
|
+
export {
|
|
209
|
+
N as Capitalize,
|
|
210
|
+
j as Default,
|
|
211
|
+
P as Duration,
|
|
212
|
+
D as Format,
|
|
213
|
+
M as Join,
|
|
214
|
+
C as Lower,
|
|
215
|
+
U as Pad,
|
|
216
|
+
F as Plural,
|
|
217
|
+
T as Replace,
|
|
218
|
+
E as Split,
|
|
219
|
+
L as Trim,
|
|
220
|
+
k as Upper,
|
|
221
|
+
_ as textFunctions
|
|
222
|
+
};
|
|
223
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sources":["../../../src/openui/functions/text.ts"],"sourcesContent":["import { defineFunction } from \"@openuidev/react-lang\";\nimport { z } from \"zod/v4\";\nimport { list, MAX_ITEMS, read } from \"./shared\";\n\nconst LOCALE = \"en-US\";\n\nfunction currencyCode(code: string | undefined): string {\n const upper = (code ?? \"USD\").toUpperCase();\n return /^[A-Z]{3}$/.test(upper) ? upper : \"USD\";\n}\n\n/** Formats with Intl; an unknown currency code falls back to USD instead of throwing. */\nfunction format(value: number, options: Intl.NumberFormatOptions): string {\n try {\n return value.toLocaleString(LOCALE, options);\n } catch {\n return value.toLocaleString(LOCALE, { ...options, currency: \"USD\" });\n }\n}\n\nexport const Format = defineFunction({\n name: \"Format\",\n description:\n 'Number as text: \"number\" 12,345.6, \"currency\" $12,345.68 (currency is a code like \"EUR\"), \"percent\" 45 -> 45%, \"compact\" 1.2M ($1.2M with a currency)',\n params: z.object({\n value: z.number(),\n kind: z.enum([\"number\", \"currency\", \"percent\", \"compact\"]).optional(),\n decimals: z.number().optional(),\n currency: z.string().optional(),\n }),\n returns: z.string(),\n fn: ({ value, kind = \"number\", decimals, currency }) => {\n if (!Number.isFinite(value)) throw new Error(\"value is not a finite number\");\n const d = decimals === undefined ? undefined : Math.min(Math.max(Math.trunc(decimals), 0), 10);\n // decimals caps the digits; only currency pads to it, so 600 never reads \"600.0\".\n const digits = (fallbackMax: number, fallbackMin = 0) =>\n d === undefined\n ? { minimumFractionDigits: fallbackMin, maximumFractionDigits: fallbackMax }\n : { minimumFractionDigits: fallbackMin && d, maximumFractionDigits: d };\n switch (kind) {\n case \"currency\":\n return format(value, { style: \"currency\", currency: currencyCode(currency), ...digits(2, 2) });\n case \"percent\":\n return `${format(value, digits(1))}%`;\n case \"compact\":\n return format(value, {\n notation: \"compact\",\n ...digits(1),\n ...(currency ? { style: \"currency\", currency: currencyCode(currency) } : {}),\n });\n default:\n return format(value, digits(2));\n }\n },\n});\n\nexport const Join = defineFunction({\n name: \"Join\",\n description: 'Joins the items (or their field) into text with sep (default \", \"), skipping nulls',\n params: z.object({ list: list(), sep: z.string().optional(), field: z.string().optional() }),\n returns: z.string(),\n fn: ({ list, sep = \", \", field = \"\" }) =>\n list\n .map((item) => read(item, field))\n .filter((v) => v != null)\n .map((v) => (typeof v === \"object\" ? JSON.stringify(v) : String(v)))\n .join(sep),\n});\n\nexport const Plural = defineFunction({\n name: \"Plural\",\n description: 'Count and word: @Plural(1, \"guest\") is \"1 guest\", 3 gives \"3 guests\"; plural defaults to word + \"s\"',\n params: z.object({ n: z.number(), word: z.string(), plural: z.string().optional() }),\n returns: z.string(),\n fn: ({ n, word, plural }) => `${format(n, { maximumFractionDigits: 2 })} ${Math.abs(n) === 1 ? word : (plural ?? `${word}s`)}`,\n});\n\nexport const Pad = defineFunction({\n name: \"Pad\",\n description: 'Pads the start of value to length with char (default \"0\"), e.g. 7 -> \"07\"',\n params: z.object({ value: z.union([z.string(), z.number()]), length: z.number(), char: z.string().optional() }),\n returns: z.string(),\n fn: ({ value, length, char = \"0\" }) => String(value).padStart(Math.min(Math.trunc(length), 1000), char || \"0\"),\n});\n\nexport const Upper = defineFunction({\n name: \"Upper\",\n description: \"Text in upper case\",\n params: z.object({ text: z.string() }),\n returns: z.string(),\n fn: ({ text }) => text.toUpperCase(),\n});\n\nexport const Lower = defineFunction({\n name: \"Lower\",\n description: \"Text in lower case\",\n params: z.object({ text: z.string() }),\n returns: z.string(),\n fn: ({ text }) => text.toLowerCase(),\n});\n\nexport const Trim = defineFunction({\n name: \"Trim\",\n description: \"Text without spaces at the start and end\",\n params: z.object({ text: z.string() }),\n returns: z.string(),\n fn: ({ text }) => text.trim(),\n});\n\nexport const Capitalize = defineFunction({\n name: \"Capitalize\",\n description: 'Each word with a capital first letter, e.g. \"new york\" is \"New York\"',\n params: z.object({ text: z.string() }),\n returns: z.string(),\n fn: ({ text }) => text.replace(/(^|[\\s\\-(/\"])(\\p{L})/gu, (_, before: string, letter: string) => before + letter.toUpperCase()),\n});\n\nexport const Split = defineFunction({\n name: \"Split\",\n description: 'List of the parts of text between sep (default \",\"), each trimmed, empty parts dropped, e.g. @Split(\"a, b,,c\") is [\"a\", \"b\", \"c\"]',\n params: z.object({ text: z.string(), sep: z.string().optional() }),\n returns: z.array(z.string()),\n fn: ({ text, sep = \",\" }) => {\n const parts = text.split(sep === \"\" ? \"\" : sep).map((p) => p.trim()).filter((p) => p !== \"\");\n if (parts.length > MAX_ITEMS) throw new Error(`more than ${MAX_ITEMS} items`);\n return parts;\n },\n});\n\nexport const Replace = defineFunction({\n name: \"Replace\",\n description: \"Text with every find replaced by replacement\",\n params: z.object({ text: z.string(), find: z.string(), replacement: z.string() }),\n returns: z.string(),\n fn: ({ text, find, replacement }) => (find === \"\" ? text : text.split(find).join(replacement)),\n});\n\nexport const Duration = defineFunction({\n name: \"Duration\",\n description: 'Seconds as text: \"short\" 1h 20m, 4m 05s, 45s (default); \"clock\" 1:20:00, 4:05',\n params: z.object({ seconds: z.number(), style: z.enum([\"short\", \"clock\"]).optional() }),\n returns: z.string(),\n fn: ({ seconds, style = \"short\" }) => {\n if (!Number.isFinite(seconds)) throw new Error(\"seconds is not a finite number\");\n const sign = seconds < 0 ? \"-\" : \"\";\n const total = Math.round(Math.abs(seconds));\n const [h, m, s] = [Math.floor(total / 3600), Math.floor((total % 3600) / 60), total % 60];\n const two = (n: number) => String(n).padStart(2, \"0\");\n if (style === \"clock\") return sign + (h ? `${h}:${two(m)}:${two(s)}` : `${m}:${two(s)}`);\n if (h) return `${sign}${h}h${m ? ` ${m}m` : \"\"}`;\n if (m) return `${sign}${m}m${s ? ` ${two(s)}s` : \"\"}`;\n return `${sign}${s}s`;\n },\n});\n\nexport const Default = defineFunction({\n name: \"Default\",\n description: 'value, or fallback when value is null, \"\" or not a number, e.g. an empty number input: @Default($weight, 0)',\n params: z.object({ value: z.any().optional(), fallback: z.any() }),\n returns: z.any(),\n fn: ({ value, fallback }) =>\n value == null || value === \"\" || (typeof value === \"number\" && Number.isNaN(value)) ? fallback : value,\n});\n\nexport const textFunctions = [Format, Join, Plural, Pad, Upper, Lower, Trim, Capitalize, Split, Replace, Duration, Default];\n"],"names":["LOCALE","currencyCode","code","upper","format","value","options","Format","defineFunction","z.object","z.number","z.enum","z.string","kind","decimals","currency","d","digits","fallbackMax","fallbackMin","Join","list","sep","field","item","read","v","Plural","n","word","plural","Pad","z.union","length","char","Upper","text","Lower","Trim","Capitalize","_","before","letter","Split","z.array","parts","p","MAX_ITEMS","Replace","find","replacement","Duration","seconds","style","sign","total","h","m","s","two","Default","z.any","fallback","textFunctions"],"mappings":";;;AAGA,MAAMA,IAAS;AACf,SAASC,EAAaC,GAAM;AAC1B,QAAMC,KAASD,KAAQ,OAAO,YAAA;AAC9B,SAAO,aAAa,KAAKC,CAAK,IAAIA,IAAQ;AAC5C;AAGA,SAASC,EAAOC,GAAOC,GAAS;AAC9B,MAAI;AACF,WAAOD,EAAM,eAAeL,GAAQM,CAAO;AAAA,EAC7C,QAAQ;AACN,WAAOD,EAAM,eAAeL,GAAQ;AAAA,MAClC,GAAGM;AAAA,MACH,UAAU;AAAA,IAAA,CACX;AAAA,EACH;AACF;AACO,MAAMC,IAASC,EAAe;AAAA,EACnC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,QAAQC,EAAS;AAAA,IACf,OAAOC,EAAE;AAAA,IACT,MAAMC,EAAO,CAAC,UAAU,YAAY,WAAW,SAAS,CAAC,EAAE,SAAA;AAAA,IAC3D,UAAUD,EAAE,EAAS,SAAA;AAAA,IACrB,UAAUE,EAAE,EAAS,SAAA;AAAA,EAAS,CAC/B;AAAA,EACD,SAASA,EAAE;AAAA,EACX,IAAI,CAAC;AAAA,IACH,OAAA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;AAC1C,WAAIyB,MAAU,UAAgBC,KAAQE,IAAI,GAAGA,CAAC,IAAIG,EAAIF,CAAC,CAAC,IAAIE,EAAID,CAAC,CAAC,KAAK,GAAGD,CAAC,IAAIE,EAAID,CAAC,CAAC,MACjFF,IAAU,GAAGF,CAAI,GAAGE,CAAC,IAAIC,IAAI,IAAIA,CAAC,MAAM,EAAE,KAC1CA,IAAU,GAAGH,CAAI,GAAGG,CAAC,IAAIC,IAAI,IAAIC,EAAID,CAAC,CAAC,MAAM,EAAE,KAC5C,GAAGJ,CAAI,GAAGI,CAAC;AAAA,EACpB;AACF,CAAC,GACYE,IAAUpD,EAAe;AAAA,EACpC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,QAAQC,EAAS;AAAA,IACf,OAAOoD,EAAE,EAAM,SAAA;AAAA,IACf,UAAUA,EAAE;AAAA,EAAI,CACjB;AAAA,EACD,SAASA,EAAE;AAAA,EACX,IAAI,CAAC;AAAA,IACH,OAAAxD;AAAA,IACA,UAAAyD;AAAA,EAAA,MACIzD,KAAS,QAAQA,MAAU,MAAM,OAAOA,KAAU,YAAY,OAAO,MAAMA,CAAK,IAAIyD,IAAWzD;AACvG,CAAC,GACY0D,IAAgB,CAACxD,GAAQa,GAAMO,GAAQI,GAAKI,GAAOE,GAAOC,GAAMC,GAAYI,GAAOK,GAASG,GAAUS,CAAO;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { actions, CopyToClipboard, runLibraryAction, toAssistantUserText } from './actions';
|
|
2
|
+
export { library, library as openUiLibrary } from './library';
|
|
3
|
+
export { BuiltinActionType, Renderer } from '@openuidev/react-lang';
|
|
4
|
+
export type { ActionEvent, PromptOptions } from '@openuidev/react-lang';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/openui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEpE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CopyToClipboard as i, actions as t, runLibraryAction as e, toAssistantUserText as a } from "./actions.js";
|
|
2
|
+
import { library as p, library as s } from "./library.js";
|
|
3
|
+
import { BuiltinActionType as b, Renderer as l } from "@openuidev/react-lang";
|
|
4
|
+
export {
|
|
5
|
+
b as BuiltinActionType,
|
|
6
|
+
i as CopyToClipboard,
|
|
7
|
+
l as Renderer,
|
|
8
|
+
t as actions,
|
|
9
|
+
p as library,
|
|
10
|
+
s as openUiLibrary,
|
|
11
|
+
e as runLibraryAction,
|
|
12
|
+
a as toAssistantUserText
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan OpenUI library: OpenUI Lang primitives rendered with Reforma components
|
|
3
|
+
* and design tokens — not the Intelligent UI visual kit.
|
|
4
|
+
*/
|
|
5
|
+
export declare const library: Required<import("@openuidev/react-lang").Library<import("@openuidev/lang-core").DefinedAction<import("zod/v4").ZodObject<{
|
|
6
|
+
text: import("zod/v4").ZodString;
|
|
7
|
+
}, import("zod/v4/core").$strip>, "CopyToClipboard">>>;
|
|
8
|
+
//# sourceMappingURL=library.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/openui/library.ts"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,eAAO,MAAM,OAAO;;sDAsDlB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createLibrary as o } from "@openuidev/react-lang";
|
|
2
|
+
import { actions as e } from "./actions.js";
|
|
3
|
+
import { Button as t } from "./components/controls.js";
|
|
4
|
+
import { Col as r, Row as n, BoxLayout as a, Grid as i, Card as m, Divider as s, Spacer as p } from "./components/layout.js";
|
|
5
|
+
import { List as l, ListItem as c } from "./components/list.js";
|
|
6
|
+
import { svgComponents as d } from "./components/svg.js";
|
|
7
|
+
import { Table as f } from "./components/table.js";
|
|
8
|
+
import { Title as u, Text as g, Caption as L, Label as C, Badge as x, Link as T, Markdown as v } from "./components/text.js";
|
|
9
|
+
import { functions as b } from "./functions/index.js";
|
|
10
|
+
const h = o({
|
|
11
|
+
root: "Col",
|
|
12
|
+
components: [r, n, a, i, m, s, p, u, g, L, C, x, T, l, c, v, t, f, ...d],
|
|
13
|
+
functions: b,
|
|
14
|
+
actions: e,
|
|
15
|
+
componentGroups: [{
|
|
16
|
+
name: "Layout",
|
|
17
|
+
components: ["Col", "Row", "Box", "Grid", "Card", "Divider", "Spacer"],
|
|
18
|
+
notes: ["Leave root Col gap unset. gap/padding are 4px steps. Card soft = filled; outline = bordered.", "Colors: ink, muted, primary, success, warning, danger, surface."]
|
|
19
|
+
}, {
|
|
20
|
+
name: "Text",
|
|
21
|
+
components: ["Title", "Text", "Caption", "Label", "Badge", "Link", "List", "ListItem", "Markdown"]
|
|
22
|
+
}, {
|
|
23
|
+
name: "Inputs",
|
|
24
|
+
components: ["Button"]
|
|
25
|
+
}, {
|
|
26
|
+
name: "Data",
|
|
27
|
+
components: ["Table"]
|
|
28
|
+
}, {
|
|
29
|
+
name: "Drawing",
|
|
30
|
+
components: ["Svg", "G", "Circle", "Rect", "Line", "Path", "Polygon", "SvgText"],
|
|
31
|
+
notes: ["Spread steps across the viewBox. Done: fill ink|primary + SvgText surface. Future: fill surface + SvgText surface; labels muted."]
|
|
32
|
+
}]
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
h as library
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=library.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.js","sources":["../../src/openui/library.ts"],"sourcesContent":["import { createLibrary } from '@openuidev/react-lang';\n\nimport { actions } from './actions';\nimport { Button } from './components/controls';\nimport {\n BoxLayout,\n Card,\n Col,\n Divider,\n Grid,\n Row,\n Spacer,\n} from './components/layout';\nimport { List, ListItem } from './components/list';\nimport { svgComponents } from './components/svg';\nimport { Table } from './components/table';\nimport {\n Badge,\n Caption,\n Label,\n Link,\n Markdown,\n Text,\n Title,\n} from './components/text';\nimport { functions } from './functions';\n\n/**\n * Plan OpenUI library: OpenUI Lang primitives rendered with Reforma components\n * and design tokens — not the Intelligent UI visual kit.\n */\nexport const library = createLibrary({\n root: 'Col',\n components: [\n Col,\n Row,\n BoxLayout,\n Grid,\n Card,\n Divider,\n Spacer,\n Title,\n Text,\n Caption,\n Label,\n Badge,\n Link,\n List,\n ListItem,\n Markdown,\n Button,\n Table,\n ...svgComponents,\n ],\n functions,\n actions,\n componentGroups: [\n {\n name: 'Layout',\n components: ['Col', 'Row', 'Box', 'Grid', 'Card', 'Divider', 'Spacer'],\n notes: [\n 'Leave root Col gap unset. gap/padding are 4px steps. Card soft = filled; outline = bordered.',\n 'Colors: ink, muted, primary, success, warning, danger, surface.',\n ],\n },\n {\n name: 'Text',\n components: ['Title', 'Text', 'Caption', 'Label', 'Badge', 'Link', 'List', 'ListItem', 'Markdown'],\n },\n {\n name: 'Inputs',\n components: ['Button'],\n },\n {\n name: 'Data',\n components: ['Table'],\n },\n {\n name: 'Drawing',\n components: ['Svg', 'G', 'Circle', 'Rect', 'Line', 'Path', 'Polygon', 'SvgText'],\n notes: [\n 'Spread steps across the viewBox. Done: fill ink|primary + SvgText surface. Future: fill surface + SvgText surface; labels muted.',\n ],\n },\n ],\n});\n"],"names":["library","createLibrary","Col","Row","BoxLayout","Grid","Card","Divider","Spacer","Title","Text","Caption","Label","Badge","Link","List","ListItem","Markdown","Button","Table","svgComponents","functions","actions"],"mappings":";;;;;;;;;AAcO,MAAMA,IAAUC,EAAc;AAAA,EACnC,MAAM;AAAA,EACN,YAAY,CAACC,GAAKC,GAAKC,GAAWC,GAAMC,GAAMC,GAASC,GAAQC,GAAOC,GAAMC,GAASC,GAAOC,GAAOC,GAAMC,GAAMC,GAAUC,GAAUC,GAAQC,GAAO,GAAGC,CAAa;AAAA,EAClK,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAiB,CAAC;AAAA,IAChB,MAAM;AAAA,IACN,YAAY,CAAC,OAAO,OAAO,OAAO,QAAQ,QAAQ,WAAW,QAAQ;AAAA,IACrE,OAAO,CAAC,gGAAgG,iEAAiE;AAAA,EAAA,GACxK;AAAA,IACD,MAAM;AAAA,IACN,YAAY,CAAC,SAAS,QAAQ,WAAW,SAAS,SAAS,QAAQ,QAAQ,YAAY,UAAU;AAAA,EAAA,GAChG;AAAA,IACD,MAAM;AAAA,IACN,YAAY,CAAC,QAAQ;AAAA,EAAA,GACpB;AAAA,IACD,MAAM;AAAA,IACN,YAAY,CAAC,OAAO;AAAA,EAAA,GACnB;AAAA,IACD,MAAM;AAAA,IACN,YAAY,CAAC,OAAO,KAAK,UAAU,QAAQ,QAAQ,QAAQ,WAAW,SAAS;AAAA,IAC/E,OAAO,CAAC,kIAAkI;AAAA,EAAA,CAC3I;AACH,CAAC;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/** OpenUI child nodes — strings or component trees; Renderer resolves via renderNode. */
|
|
3
|
+
export declare const children: z.ZodAny;
|
|
4
|
+
export declare const align: z.ZodEnum<{
|
|
5
|
+
center: "center";
|
|
6
|
+
end: "end";
|
|
7
|
+
start: "start";
|
|
8
|
+
stretch: "stretch";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const justify: z.ZodEnum<{
|
|
11
|
+
between: "between";
|
|
12
|
+
center: "center";
|
|
13
|
+
end: "end";
|
|
14
|
+
start: "start";
|
|
15
|
+
}>;
|
|
16
|
+
/** Semantic / token color names the model may pass (mapped to Reforma tokens). */
|
|
17
|
+
export declare const colorName: z.ZodEnum<{
|
|
18
|
+
danger: "danger";
|
|
19
|
+
faint: "faint";
|
|
20
|
+
info: "info";
|
|
21
|
+
ink: "ink";
|
|
22
|
+
muted: "muted";
|
|
23
|
+
primary: "primary";
|
|
24
|
+
success: "success";
|
|
25
|
+
surface: "surface";
|
|
26
|
+
warning: "warning";
|
|
27
|
+
}>;
|
|
28
|
+
export type ColorName = z.infer<typeof colorName>;
|
|
29
|
+
/**
|
|
30
|
+
* OpenUI gap is 4px steps → Reforma spacing, biased for **content** (plans),
|
|
31
|
+
* not editor-chrome density. Step 1 ≈ xs (4px), step 4 ≈ lg (12px).
|
|
32
|
+
*/
|
|
33
|
+
export declare function gapToken(gap: number | undefined): 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | undefined;
|
|
34
|
+
export declare function flexAlign(value: string | undefined): 'start' | 'center' | 'end' | 'stretch' | undefined;
|
|
35
|
+
export declare function flexJustify(value: string | undefined): 'start' | 'center' | 'end' | 'between' | undefined;
|
|
36
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/openui/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,yFAAyF;AACzF,eAAO,MAAM,QAAQ,UAAU,CAAC;AAEhC,eAAO,MAAM,KAAK;;;;;EAAgD,CAAC;AACnE,eAAO,MAAM,OAAO;;;;;EAAgD,CAAC;AAErE,kFAAkF;AAClF,eAAO,MAAM,SAAS;;;;;;;;;;EAUpB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,CA0B9G;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,CAMvG;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,CAMzG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { enum as r, any as t } from "../node_modules/zod/v4/classic/schemas.js";
|
|
2
|
+
const i = t(), f = r(["start", "center", "end", "stretch"]), s = r(["start", "center", "end", "between"]), c = r(["ink", "muted", "faint", "surface", "info", "success", "warning", "danger", "primary"]);
|
|
3
|
+
function o(n) {
|
|
4
|
+
if (!(n == null || n <= 0))
|
|
5
|
+
return n <= 1 ? "xs" : n <= 2 ? "sm" : n <= 3 ? "md" : n <= 5 ? "lg" : n <= 7 ? "xl" : "xxl";
|
|
6
|
+
}
|
|
7
|
+
function u(n) {
|
|
8
|
+
if (n === "start" || n === "center" || n === "end" || n === "stretch")
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function d(n) {
|
|
12
|
+
if (n === "start" || n === "center" || n === "end" || n === "between")
|
|
13
|
+
return n;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
f as align,
|
|
17
|
+
i as children,
|
|
18
|
+
c as colorName,
|
|
19
|
+
u as flexAlign,
|
|
20
|
+
d as flexJustify,
|
|
21
|
+
o as gapToken,
|
|
22
|
+
s as justify
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sources":["../../src/openui/schema.ts"],"sourcesContent":["import { z } from 'zod/v4';\n\n/** OpenUI child nodes — strings or component trees; Renderer resolves via renderNode. */\nexport const children = z.any();\n\nexport const align = z.enum(['start', 'center', 'end', 'stretch']);\nexport const justify = z.enum(['start', 'center', 'end', 'between']);\n\n/** Semantic / token color names the model may pass (mapped to Reforma tokens). */\nexport const colorName = z.enum([\n 'ink',\n 'muted',\n 'faint',\n 'surface',\n 'info',\n 'success',\n 'warning',\n 'danger',\n 'primary',\n]);\n\nexport type ColorName = z.infer<typeof colorName>;\n\n/**\n * OpenUI gap is 4px steps → Reforma spacing, biased for **content** (plans),\n * not editor-chrome density. Step 1 ≈ xs (4px), step 4 ≈ lg (12px).\n */\nexport function gapToken(gap: number | undefined): 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | undefined {\n if (gap == null || gap <= 0) {\n return undefined;\n }\n\n if (gap <= 1) {\n return 'xs';\n }\n\n if (gap <= 2) {\n return 'sm';\n }\n\n if (gap <= 3) {\n return 'md';\n }\n\n if (gap <= 5) {\n return 'lg';\n }\n\n if (gap <= 7) {\n return 'xl';\n }\n\n return 'xxl';\n}\n\nexport function flexAlign(value: string | undefined): 'start' | 'center' | 'end' | 'stretch' | undefined {\n if (value === 'start' || value === 'center' || value === 'end' || value === 'stretch') {\n return value;\n }\n\n return undefined;\n}\n\nexport function flexJustify(value: string | undefined): 'start' | 'center' | 'end' | 'between' | undefined {\n if (value === 'start' || value === 'center' || value === 'end' || value === 'between') {\n return value;\n }\n\n return undefined;\n}\n"],"names":["children","z.any","align","z.enum","justify","colorName","gapToken","gap","flexAlign","value","flexJustify"],"mappings":";AAGO,MAAMA,IAAWC,EAAE,GACbC,IAAQC,EAAO,CAAC,SAAS,UAAU,OAAO,SAAS,CAAC,GACpDC,IAAUD,EAAO,CAAC,SAAS,UAAU,OAAO,SAAS,CAAC,GAGtDE,IAAYF,EAAO,CAAC,OAAO,SAAS,SAAS,WAAW,QAAQ,WAAW,WAAW,UAAU,SAAS,CAAC;AAKhH,SAASG,EAASC,GAAK;AAC5B,MAAI,EAAAA,KAAO,QAAQA,KAAO;AAG1B,WAAIA,KAAO,IACF,OAELA,KAAO,IACF,OAELA,KAAO,IACF,OAELA,KAAO,IACF,OAELA,KAAO,IACF,OAEF;AACT;AACO,SAASC,EAAUC,GAAO;AAC/B,MAAIA,MAAU,WAAWA,MAAU,YAAYA,MAAU,SAASA,MAAU;AAC1E,WAAOA;AAGX;AACO,SAASC,EAAYD,GAAO;AACjC,MAAIA,MAAU,WAAWA,MAAU,YAAYA,MAAU,SAASA,MAAU;AAC1E,WAAOA;AAGX;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@reforma/components",
|
|
3
3
|
"description": "A components library for Reforma",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.2.0",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"author": "Reforma, Inc. <dev@reforma.ai>",
|
|
8
8
|
"repository": {
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@codemirror/lang-json": "^6",
|
|
65
65
|
"@codemirror/lang-markdown": "^6.5.2",
|
|
66
66
|
"@dnd-kit/react": "0.5.0",
|
|
67
|
+
"@openuidev/react-lang": "^1.0.1",
|
|
67
68
|
"@react-aria/dnd": "^3.11.6",
|
|
68
69
|
"@react-stately/utils": "^3.11.0",
|
|
69
70
|
"@reforma/constants": "workspace:*",
|
|
@@ -108,7 +109,8 @@
|
|
|
108
109
|
"react-resizable-panels": "^4.7.5",
|
|
109
110
|
"react-shiki": "^0.9.1",
|
|
110
111
|
"react-stately": "^3.46.0",
|
|
111
|
-
"streamdown": "2.5.0"
|
|
112
|
+
"streamdown": "2.5.0",
|
|
113
|
+
"zod": "^4.4.3"
|
|
112
114
|
},
|
|
113
115
|
"devDependencies": {
|
|
114
116
|
"@babel/preset-react": "^7.26.3",
|