@pebble-software/bonsai 0.2.0 → 0.3.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 +33 -6
- package/dist/chunks/builder.meta-B7Y9M7Ab.js.map +1 -1
- package/dist/chunks/{create-renderer-C4nV9RV6.js → create-renderer-kgClEYyp.js} +55 -55
- package/dist/chunks/create-renderer-kgClEYyp.js.map +1 -0
- package/dist/chunks/{render-shared-Cwb527d4.js → render-shared-CrG0OFhJ.js} +2 -2
- package/dist/chunks/render-shared-CrG0OFhJ.js.map +1 -0
- package/dist/classes.d.ts +33 -0
- package/dist/classes.js +18 -0
- package/dist/classes.js.map +1 -0
- package/dist/classes.json +1 -0
- package/dist/core.js +3 -3
- package/dist/index.css +8 -0
- package/dist/index.js +244 -189
- package/dist/index.js.map +1 -1
- package/dist/lib/ast/class-names.d.ts +13 -0
- package/dist/lib/registry/json-schema-to-zod.d.ts +2 -2
- package/dist/library/schemas/src/bonsai.schema.d.ts +1 -2
- package/dist/presets/signature.js +1 -1
- package/dist/styles/css/theme.css +8 -0
- package/package.json +8 -4
- package/dist/chunks/create-renderer-C4nV9RV6.js.map +0 -1
- package/dist/chunks/render-shared-Cwb527d4.js.map +0 -1
- package/dist/components/ui/alert-dialog.d.ts +0 -23
- package/dist/components/ui/breadcrumb.d.ts +0 -10
- package/dist/components/ui/combobox.d.ts +0 -31
- package/dist/components/ui/command.d.ts +0 -23
- package/dist/components/ui/dialog.d.ts +0 -23
- package/dist/components/ui/drawer.d.ts +0 -22
- package/dist/components/ui/dropdown-menu.d.ts +0 -29
- package/dist/components/ui/form.d.ts +0 -24
- package/dist/components/ui/popover.d.ts +0 -9
- package/dist/components/ui/scroll-area.d.ts +0 -13
- package/dist/components/ui/sidebar.d.ts +0 -70
- package/dist/components/ui/toast.d.ts +0 -46
- package/dist/components/ui/tooltip.d.ts +0 -15
- package/dist/hooks/haptics.d.ts +0 -8
- package/dist/hooks/use-mobile.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { u as
|
|
3
|
-
import
|
|
4
|
-
import { createErrorMap as
|
|
5
|
-
import { a as
|
|
6
|
-
import { c as
|
|
7
|
-
import { u as
|
|
8
|
-
import { calendarPreset as
|
|
9
|
-
import { signaturePreset as
|
|
10
|
-
import { COMPONENT as
|
|
1
|
+
import { c as C } from "./chunks/create-renderer-kgClEYyp.js";
|
|
2
|
+
import { u as Re } from "./chunks/create-renderer-kgClEYyp.js";
|
|
3
|
+
import $, { z as e } from "zod";
|
|
4
|
+
import { createErrorMap as B } from "zod-validation-error";
|
|
5
|
+
import { a as m, P as U } from "./chunks/builder.meta-B7Y9M7Ab.js";
|
|
6
|
+
import { c as q, a as N, d as I, e as R, f as M, b as E } from "./chunks/render-shared-CrG0OFhJ.js";
|
|
7
|
+
import { u as ze } from "./chunks/render-shared-CrG0OFhJ.js";
|
|
8
|
+
import { calendarPreset as T } from "./presets/calendar.js";
|
|
9
|
+
import { signaturePreset as z } from "./presets/signature.js";
|
|
10
|
+
import { COMPONENT as k } from "./constants.js";
|
|
11
|
+
import { c as F } from "./chunks/index-CD5pykpk.js";
|
|
11
12
|
const c = e.string().length(24).meta({
|
|
12
13
|
description: "MongoDB ObjectId (24-character hex string)",
|
|
13
14
|
example: "67e091ab2c4d3f22001a2b3c"
|
|
@@ -98,7 +99,7 @@ e.object({
|
|
|
98
99
|
role: e.string().min(2).meta({ description: "Updated role", example: "viewer" }),
|
|
99
100
|
permissions: e.string().min(1).meta({ description: "Updated permission set", example: '{"templates":"r"}' })
|
|
100
101
|
}).strict().meta({ description: "Update an organization user's role or permissions" });
|
|
101
|
-
const
|
|
102
|
+
const O = e.looseObject({
|
|
102
103
|
version: e.number().int().positive().meta({ description: "Builder document format version" })
|
|
103
104
|
}).meta({ description: "Builder source document the config was compiled from (editor-only)" });
|
|
104
105
|
e.object({
|
|
@@ -108,7 +109,7 @@ e.object({
|
|
|
108
109
|
name: e.string().min(1).meta({ description: "Template name (unique within the organization)", example: "Neural_NDA_v3" }),
|
|
109
110
|
description: e.string().default("").meta({ description: "Human-readable description of the template's purpose", example: "Standard non-disclosure agreement with neural implant data clause" }),
|
|
110
111
|
config: e.any().meta({ description: "The Bonsai component tree defining the template layout and fields" }),
|
|
111
|
-
source:
|
|
112
|
+
source: O.optional(),
|
|
112
113
|
header: e.string().optional().meta({ description: "A small Bonsai component tree used for page headers in PDF rendering output" }),
|
|
113
114
|
footer: e.string().optional().meta({ description: "A small Bonsai component tree used for page footers in PDF rendering output" }),
|
|
114
115
|
contentHash: e.string().optional().meta({ description: "SHA-256 hash of the serialized config, used for deduplication", example: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1" }),
|
|
@@ -127,22 +128,22 @@ e.object({
|
|
|
127
128
|
ou: c.meta({ description: "OrganizationUser ID of the user creating the template" }),
|
|
128
129
|
name: e.string().min(1).meta({ description: "Template name (must be unique within the organization)", example: "Neural_NDA_v3" }),
|
|
129
130
|
description: e.string().optional().meta({ description: "Optional description of the template's purpose", example: "Standard NDA with neural implant clause" }),
|
|
130
|
-
config:
|
|
131
|
-
source:
|
|
131
|
+
config: m.meta({ description: "The Bonsai component tree that defines the template layout" }),
|
|
132
|
+
source: O.optional(),
|
|
132
133
|
pdf: e.object({
|
|
133
|
-
header:
|
|
134
|
-
footer:
|
|
134
|
+
header: m.optional().meta({ description: "PDF header Bonsai component tree" }),
|
|
135
|
+
footer: m.optional().meta({ description: "PDF footer Bonsai component tree" })
|
|
135
136
|
}).optional(),
|
|
136
137
|
tags: e.array(e.string()).optional().meta({ description: "Tags for organizing and filtering templates", example: ["nda", "legal"] })
|
|
137
138
|
}).strict().meta({ description: "Create a new reusable signature template" });
|
|
138
139
|
e.object({
|
|
139
140
|
name: e.string().min(1).optional().meta({ description: "New template name (must be unique within the organization)" }),
|
|
140
141
|
description: e.string().optional().meta({ description: "New description" }),
|
|
141
|
-
config:
|
|
142
|
-
source:
|
|
142
|
+
config: m.optional().meta({ description: "Replacement Bonsai component tree; CSS and content hash are recomputed" }),
|
|
143
|
+
source: O.optional(),
|
|
143
144
|
pdf: e.object({
|
|
144
|
-
header:
|
|
145
|
-
footer:
|
|
145
|
+
header: m.optional().meta({ description: "PDF header Bonsai component tree" }),
|
|
146
|
+
footer: m.optional().meta({ description: "PDF footer Bonsai component tree" })
|
|
146
147
|
}).optional(),
|
|
147
148
|
tags: e.array(e.string()).optional().meta({ description: "Replacement tags" })
|
|
148
149
|
}).strict().refine((t) => Object.keys(t).length > 0, { message: "Provide at least one field to update" }).meta({ description: "Update an existing template" });
|
|
@@ -157,7 +158,7 @@ e.object({
|
|
|
157
158
|
name: e.string().meta({ description: "Template name", example: "Neural_NDA_v3" }),
|
|
158
159
|
contentHash: e.string().optional().meta({ description: "SHA-256 hash of the config, useful for deduplication" })
|
|
159
160
|
}).strict().meta({ description: "Created template summary" });
|
|
160
|
-
const
|
|
161
|
+
const _ = e.enum([
|
|
161
162
|
"pending",
|
|
162
163
|
"captured",
|
|
163
164
|
"completed",
|
|
@@ -181,7 +182,7 @@ e.object({
|
|
|
181
182
|
header: e.any().meta({ description: "Snapshot of the (small) Bonsai component tree config used for the output PDF page header rendering", readOnly: !0 }),
|
|
182
183
|
footer: e.any().meta({ description: "Snapshot of the (small) Bonsai component tree config used for the output PDF page footer rendering", readOnly: !0 }),
|
|
183
184
|
css: e.string().meta({ description: "Tailwind CSS generated from the template at the time of form creation", readOnly: !0 }),
|
|
184
|
-
status:
|
|
185
|
+
status: _.meta({ description: "Current lifecycle status of the form request", example: "pending" }),
|
|
185
186
|
organization: c.meta({ description: "Organization that owns this form request", readOnly: !0 }),
|
|
186
187
|
createdAt: d.meta({ description: "When the form request was created", readOnly: !0 }),
|
|
187
188
|
updatedAt: d.meta({ description: "When the form request was last updated", readOnly: !0 })
|
|
@@ -191,7 +192,7 @@ e.object({
|
|
|
191
192
|
e.object({
|
|
192
193
|
name: e.string().min(1).meta({ description: "Recipient's display name (used in the email greeting and form header)", example: "Razor Jack" }),
|
|
193
194
|
email: e.string().email().meta({ description: "Recipient email address where the signature link will be sent", example: "jack@datahaven.net" }),
|
|
194
|
-
template: e.union([
|
|
195
|
+
template: e.union([m, e.string()]).meta({
|
|
195
196
|
description: "Either an inline Bonsai component tree config, or a saved template MongoDB ObjectId to use as the form layout"
|
|
196
197
|
}),
|
|
197
198
|
expiry: e.coerce.date().optional().meta({ description: "When the signature request link expires (ISO 8601 date)", example: "2077-12-25T23:59:59Z" }),
|
|
@@ -201,8 +202,8 @@ e.object({
|
|
|
201
202
|
metadata: e.any().optional().meta({ description: "Arbitrary metadata to associate with the form request", example: { department: "Legal", priority: "high" } }),
|
|
202
203
|
data: e.any().optional().meta({ description: "Pre-filled form field data to populate the form on load", example: { full_name: "Razor Jack", badge_id: "RJ-7741" } }),
|
|
203
204
|
pdf: e.union([e.boolean(), e.object({
|
|
204
|
-
header: e.union([
|
|
205
|
-
footer: e.union([
|
|
205
|
+
header: e.union([m, e.string()]).optional().meta({ description: "A (small) Bonsai component tree config used for the output PDF page header rendering" }),
|
|
206
|
+
footer: e.union([m, e.string()]).optional().meta({ description: "A (small) Bonsai component tree config used for the output PDF page footer rendering" })
|
|
206
207
|
})]).optional().meta({ description: "PDF file config object (header||footer) or `true/false` boolean to trigger PDF file generation after form capture" })
|
|
207
208
|
}).strict().meta({ description: "Create a new signature request targeting a recipient" });
|
|
208
209
|
e.object({
|
|
@@ -285,7 +286,7 @@ e.object({
|
|
|
285
286
|
e.object({
|
|
286
287
|
token: e.string().meta({ description: "New JWT access token (1 hour expiry)", example: "eyJhbGciOiJIUzI1NiIs...c012" })
|
|
287
288
|
}).strict().meta({ description: "New JWT access token" });
|
|
288
|
-
const
|
|
289
|
+
const W = e.enum([
|
|
289
290
|
"application/pdf",
|
|
290
291
|
"image/png",
|
|
291
292
|
"image/jpeg",
|
|
@@ -299,10 +300,10 @@ e.object({
|
|
|
299
300
|
e.object({
|
|
300
301
|
downloadUrl: e.string().url().meta({ description: "Pre-signed GCS download URL", example: "https://storage.googleapis.com/bonsai-secure/f1e2d3...X-Goog-Signature=def456" }),
|
|
301
302
|
filename: e.string().meta({ description: "Original filename (for Content-Disposition)", example: "signed_nda_razorjack.pdf" }),
|
|
302
|
-
mimeType:
|
|
303
|
+
mimeType: W.meta({ description: "MIME type (for Content-Type)", example: "application/pdf" }),
|
|
303
304
|
size: e.number().int().meta({ description: "File size in bytes", example: 245760 })
|
|
304
305
|
}).strict().meta({ description: "Signed download URL for secure file access" });
|
|
305
|
-
const
|
|
306
|
+
const H = e.enum([
|
|
306
307
|
"pending",
|
|
307
308
|
"generating",
|
|
308
309
|
"completed",
|
|
@@ -321,7 +322,7 @@ e.object({
|
|
|
321
322
|
header: e.any().meta({ description: "Snapshot of the (small) Bonsai component tree config used for the output PDF page header rendering" }),
|
|
322
323
|
footer: e.any().meta({ description: "Snapshot of the (small) Bonsai component tree config used for the output PDF page footer rendering" }),
|
|
323
324
|
css: e.string().meta({ description: "Tailwind CSS generated from the template at the time of PDF generation request", readOnly: !0 }),
|
|
324
|
-
status:
|
|
325
|
+
status: H.meta({ description: "Current lifecycle status of the PDF request", example: "pending" }),
|
|
325
326
|
organization: c.meta({ description: "Organization that owns this PDF request", readOnly: !0 }),
|
|
326
327
|
createdAt: d.meta({ description: "When the PDF request was created", readOnly: !0 }),
|
|
327
328
|
updatedAt: d.meta({ description: "When the PDF request was last updated", readOnly: !0 })
|
|
@@ -329,42 +330,90 @@ e.object({
|
|
|
329
330
|
description: "A PDF request used to trigger the generation of a custom PDF file. Tracks the full lifecycle and alerts sends results via webhook."
|
|
330
331
|
});
|
|
331
332
|
e.object({
|
|
332
|
-
template: e.union([
|
|
333
|
+
template: e.union([m, e.string()]).meta({
|
|
333
334
|
description: "Either an inline Bonsai component tree config, or a saved template MongoDB ObjectId to use as the PDF content layout"
|
|
334
335
|
}),
|
|
335
336
|
webhooks: e.array(e.string()).min(1).meta({ description: "Array of webhook ObjectIds to notify on form lifecycle events", example: ["67e091ab2c4d3f22001a2b3c"] }),
|
|
336
337
|
metadata: e.any().optional().meta({ description: "Arbitrary metadata to associate with the PDF request", example: { department: "Legal", priority: "high" } }),
|
|
337
338
|
data: e.any().optional().meta({ description: "Pre-filled template field data to populate the PDF with", example: { full_name: "Razor Jack", badge_id: "RJ-7741" } }),
|
|
338
|
-
header: e.union([
|
|
339
|
-
footer: e.union([
|
|
339
|
+
header: e.union([m, e.string()]).optional().meta({ description: "A (small) Bonsai component tree config used for the output PDF page header rendering" }),
|
|
340
|
+
footer: e.union([m, e.string()]).optional().meta({ description: "A (small) Bonsai component tree config used for the output PDF page footer rendering" })
|
|
340
341
|
}).strict().meta({ description: "Create a new PDF request to generate a PDF file from a Bonsai template" });
|
|
341
342
|
e.object({
|
|
342
343
|
pdfId: e.string().meta({ description: "MongoDB ObjectId of the newly created PDF request (this is NOT the rendered pdf file - a file ID is returned after async pdf generation via webhook)", example: "67e091ab2c4d3f22001a2b3c", readOnly: !0 })
|
|
343
344
|
}).strict().meta({ description: "Created form request identifier" });
|
|
344
|
-
|
|
345
|
-
customError:
|
|
345
|
+
$.config({
|
|
346
|
+
customError: B()
|
|
346
347
|
});
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
...
|
|
350
|
-
...
|
|
351
|
-
},
|
|
352
|
-
...
|
|
353
|
-
...
|
|
354
|
-
...
|
|
355
|
-
},
|
|
356
|
-
components:
|
|
357
|
-
controlledInputs:
|
|
358
|
-
}),
|
|
359
|
-
...
|
|
348
|
+
const L = {
|
|
349
|
+
...q,
|
|
350
|
+
...T.components,
|
|
351
|
+
...z.components
|
|
352
|
+
}, J = {
|
|
353
|
+
...N,
|
|
354
|
+
...T.controlledInputs,
|
|
355
|
+
...z.controlledInputs
|
|
356
|
+
}, P = M(E, {
|
|
357
|
+
components: L,
|
|
358
|
+
controlledInputs: J
|
|
359
|
+
}), V = I({
|
|
360
|
+
...P,
|
|
360
361
|
components: Object.fromEntries(
|
|
361
|
-
Object.entries(
|
|
362
|
+
Object.entries(P.components).map(([t, i]) => [
|
|
362
363
|
t,
|
|
363
|
-
|
|
364
|
+
R({ ...i, propsSchema: U[t]?.argsSchema })
|
|
364
365
|
])
|
|
365
366
|
)
|
|
366
|
-
});
|
|
367
|
-
function
|
|
367
|
+
}), G = 1024, j = (t) => t.split(/\s+/).filter(Boolean);
|
|
368
|
+
function y(t, i) {
|
|
369
|
+
return t && i ? [.../* @__PURE__ */ new Set([...t, ...i])] : null;
|
|
370
|
+
}
|
|
371
|
+
function Z(t, i) {
|
|
372
|
+
return !t || !i || t.length * i.length > G ? null : [...new Set(t.flatMap((n) => i.map((r) => n + r)))];
|
|
373
|
+
}
|
|
374
|
+
function h(t, i) {
|
|
375
|
+
const n = t;
|
|
376
|
+
switch (n.type) {
|
|
377
|
+
case "Literal": {
|
|
378
|
+
const r = n.value == null || typeof n.value == "boolean" ? "" : String(n.value);
|
|
379
|
+
return i.push(r), [r];
|
|
380
|
+
}
|
|
381
|
+
case "ConditionalExpression":
|
|
382
|
+
return y(
|
|
383
|
+
h(n.consequent, i),
|
|
384
|
+
h(n.alternate, i)
|
|
385
|
+
);
|
|
386
|
+
case "BinaryExpression":
|
|
387
|
+
switch (n.operator) {
|
|
388
|
+
// A falsy left side renders no class, so only the right side is a result.
|
|
389
|
+
case "&&":
|
|
390
|
+
return y([""], h(n.right, i));
|
|
391
|
+
case "||":
|
|
392
|
+
case "??":
|
|
393
|
+
return y(h(n.left, i), h(n.right, i));
|
|
394
|
+
case "+":
|
|
395
|
+
return Z(h(n.left, i), h(n.right, i));
|
|
396
|
+
default:
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
default:
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function K(t) {
|
|
404
|
+
const i = F(t)?.ast;
|
|
405
|
+
if (!i) return null;
|
|
406
|
+
const n = [], r = h(i, n);
|
|
407
|
+
if (!r)
|
|
408
|
+
return "must evaluate to classes written in string literals (e.g. a ternary between class strings), not to data or a computed value";
|
|
409
|
+
const a = new Set(n.flatMap(j));
|
|
410
|
+
for (const o of r)
|
|
411
|
+
for (const s of j(o))
|
|
412
|
+
if (!a.has(s))
|
|
413
|
+
return `builds "${s}" by joining strings; write each class whole inside one string literal`;
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
function X(t, i) {
|
|
368
417
|
if (!t)
|
|
369
418
|
return { action: "render", reason: "no-pin" };
|
|
370
419
|
if (t.id !== i.id)
|
|
@@ -373,89 +422,95 @@ function H(t, i) {
|
|
|
373
422
|
reason: "id-mismatch",
|
|
374
423
|
error: `Template is pinned to registry "${t.id}", but rendering registry is "${i.id}" — this is a different component library, not a version skew.`
|
|
375
424
|
};
|
|
376
|
-
const n = t.version === i.version,
|
|
377
|
-
return n &&
|
|
425
|
+
const n = t.version === i.version, r = t.manifestHash == null || i.manifestHash == null || t.manifestHash === i.manifestHash;
|
|
426
|
+
return n && r ? { action: "render", reason: "match" } : {
|
|
378
427
|
action: "render",
|
|
379
428
|
reason: "version-skew",
|
|
380
429
|
warning: n ? `Template is pinned to registry "${t.id}"@"${t.version}" (manifest ${t.manifestHash}), but the resolved manifest is now ${i.manifestHash}. Re-pin on next save.` : `Template is pinned to registry "${t.id}"@"${t.version}", but rendering registry is "${t.id}"@"${i.version}". Re-pin on next save.`
|
|
381
430
|
};
|
|
382
431
|
}
|
|
383
|
-
const
|
|
384
|
-
function
|
|
432
|
+
const Q = [k.EACH, k.IF];
|
|
433
|
+
function Y(t, i) {
|
|
385
434
|
return t.capabilities ? i === "pdf" ? t.capabilities.includes("pdf") : t.capabilities.includes("ssr") : !0;
|
|
386
435
|
}
|
|
387
|
-
function
|
|
436
|
+
function w(t, i, n, r, a) {
|
|
388
437
|
if (t == null || typeof t == "string") return;
|
|
389
|
-
const
|
|
390
|
-
if (!
|
|
438
|
+
const o = t.type;
|
|
439
|
+
if (!o) {
|
|
391
440
|
a.push({ path: i, message: "Node is missing a required `type` field" });
|
|
392
441
|
return;
|
|
393
442
|
}
|
|
394
|
-
if (
|
|
443
|
+
if (Q.includes(o)) {
|
|
395
444
|
(t.children ?? []).forEach(
|
|
396
|
-
(
|
|
445
|
+
(p, u) => w(p, `${i}.children[${u}]`, n, r, a)
|
|
397
446
|
);
|
|
398
447
|
return;
|
|
399
448
|
}
|
|
400
|
-
const s = n.components[
|
|
449
|
+
const s = n.components[o];
|
|
401
450
|
if (!s) {
|
|
402
451
|
a.push({
|
|
403
452
|
path: i,
|
|
404
|
-
componentType:
|
|
405
|
-
message: `Unknown component type "${
|
|
453
|
+
componentType: o,
|
|
454
|
+
message: `Unknown component type "${o}" in registry "${n.id}"@"${n.version}"`
|
|
406
455
|
});
|
|
407
456
|
return;
|
|
408
457
|
}
|
|
409
|
-
if (
|
|
458
|
+
if (Y(s, r) || a.push({
|
|
410
459
|
path: i,
|
|
411
|
-
componentType:
|
|
412
|
-
message: `Component "${
|
|
460
|
+
componentType: o,
|
|
461
|
+
message: `Component "${o}" in registry "${n.id}"@"${n.version}" does not support "${r}" rendering`
|
|
413
462
|
}), s.propsSchema) {
|
|
414
|
-
const
|
|
415
|
-
if (!
|
|
416
|
-
for (const
|
|
417
|
-
const
|
|
418
|
-
a.push({ path:
|
|
463
|
+
const p = s.propsSchema.safeParse(t.args);
|
|
464
|
+
if (!p.success)
|
|
465
|
+
for (const u of p.error.issues) {
|
|
466
|
+
const b = u.path.length ? `${i}.args.${u.path.join(".")}` : `${i}.args`;
|
|
467
|
+
a.push({ path: b, componentType: o, message: u.message });
|
|
419
468
|
}
|
|
420
469
|
}
|
|
421
470
|
t.args?.onClick !== void 0 && s.capabilities && !s.capabilities.includes("events") && a.push({
|
|
422
471
|
path: `${i}.args.onClick`,
|
|
423
|
-
componentType:
|
|
424
|
-
message: `Component "${
|
|
472
|
+
componentType: o,
|
|
473
|
+
message: `Component "${o}" in registry "${n.id}"@"${n.version}" does not accept onClick`
|
|
474
|
+
});
|
|
475
|
+
const l = K(t.args?.className);
|
|
476
|
+
l && a.push({
|
|
477
|
+
path: `${i}.args.className`,
|
|
478
|
+
componentType: o,
|
|
479
|
+
message: `className ${l}`
|
|
425
480
|
}), (t.children?.length ?? 0) > 0 && (s.capabilities && !s.capabilities.includes("children") && a.push({
|
|
426
481
|
path: i,
|
|
427
|
-
componentType:
|
|
428
|
-
message: `Component "${
|
|
482
|
+
componentType: o,
|
|
483
|
+
message: `Component "${o}" in registry "${n.id}"@"${n.version}" does not accept children`
|
|
429
484
|
}), (t.children ?? []).forEach(
|
|
430
|
-
(
|
|
485
|
+
(p, u) => w(p, `${i}.children[${u}]`, n, r, a)
|
|
431
486
|
));
|
|
432
487
|
}
|
|
433
|
-
function
|
|
434
|
-
const
|
|
488
|
+
function xe(t, i, n = {}) {
|
|
489
|
+
const r = [], a = [];
|
|
435
490
|
if (n.pin) {
|
|
436
|
-
const
|
|
437
|
-
if (
|
|
438
|
-
return
|
|
439
|
-
|
|
491
|
+
const o = X(n.pin, i);
|
|
492
|
+
if (o.action === "fail")
|
|
493
|
+
return r.push({ path: "root", message: o.error }), { valid: !1, errors: r, warnings: a };
|
|
494
|
+
o.reason === "version-skew" && a.push(o.warning);
|
|
440
495
|
}
|
|
441
|
-
return
|
|
496
|
+
return w(t, "root", i, n.mode ?? "web", r), { valid: r.length === 0, errors: r, warnings: a };
|
|
442
497
|
}
|
|
443
|
-
const
|
|
498
|
+
const ee = e.string().refine((t) => t.startsWith("{{") && t.endsWith("}}"), {
|
|
444
499
|
message: 'Expected a value of the declared type, or a "{{binding}}" expression'
|
|
445
500
|
});
|
|
446
|
-
function
|
|
447
|
-
const n = (a) => i.allowBindings ? e.union([
|
|
501
|
+
function x(t, i = {}) {
|
|
502
|
+
const n = (a) => i.allowBindings ? e.union([ee, a]) : a;
|
|
448
503
|
if ("const" in t)
|
|
449
504
|
return n(e.literal(t.const));
|
|
450
505
|
if (Array.isArray(t.enum)) {
|
|
451
506
|
const a = t.enum;
|
|
452
507
|
if (a.length === 0)
|
|
453
508
|
throw new Error("jsonSchemaToZod: enum must have at least one value");
|
|
454
|
-
const [
|
|
455
|
-
return n(s.reduce((l,
|
|
509
|
+
const [o, ...s] = a;
|
|
510
|
+
return n(s.reduce((l, f) => e.union([l, e.literal(f)]), e.literal(o)));
|
|
456
511
|
}
|
|
457
|
-
const
|
|
458
|
-
switch (
|
|
512
|
+
const r = t.type;
|
|
513
|
+
switch (r) {
|
|
459
514
|
case "string": {
|
|
460
515
|
let a = e.string();
|
|
461
516
|
return typeof t.minLength == "number" && (a = a.min(t.minLength)), typeof t.maxLength == "number" && (a = a.max(t.maxLength)), typeof t.pattern == "string" && (a = a.regex(new RegExp(t.pattern))), n(a);
|
|
@@ -463,19 +518,19 @@ function y(t, i = {}) {
|
|
|
463
518
|
case "number":
|
|
464
519
|
case "integer": {
|
|
465
520
|
let a = e.number();
|
|
466
|
-
return
|
|
521
|
+
return r === "integer" && (a = a.int()), typeof t.minimum == "number" && (a = a.min(t.minimum)), typeof t.maximum == "number" && (a = a.max(t.maximum)), n(a);
|
|
467
522
|
}
|
|
468
523
|
case "boolean":
|
|
469
524
|
return n(e.boolean());
|
|
470
525
|
case "array": {
|
|
471
|
-
const a = t.items ?
|
|
526
|
+
const a = t.items ? x(t.items, i) : e.unknown();
|
|
472
527
|
return n(e.array(a));
|
|
473
528
|
}
|
|
474
529
|
case "object": {
|
|
475
|
-
const a = t.properties ?? {},
|
|
476
|
-
for (const [
|
|
477
|
-
const
|
|
478
|
-
s[
|
|
530
|
+
const a = t.properties ?? {}, o = new Set(t.required ?? []), s = {};
|
|
531
|
+
for (const [f, p] of Object.entries(a)) {
|
|
532
|
+
const u = x(p, i);
|
|
533
|
+
s[f] = o.has(f) ? u : u.optional();
|
|
479
534
|
}
|
|
480
535
|
let l = e.object(s);
|
|
481
536
|
return t.additionalProperties === !1 && (l = l.strict()), l;
|
|
@@ -484,20 +539,20 @@ function y(t, i = {}) {
|
|
|
484
539
|
return e.unknown();
|
|
485
540
|
}
|
|
486
541
|
}
|
|
487
|
-
const
|
|
542
|
+
const te = e.object({
|
|
488
543
|
valueProp: e.string().min(1),
|
|
489
544
|
changeProp: e.string().min(1),
|
|
490
545
|
extract: e.string().min(1)
|
|
491
|
-
}).strict(),
|
|
546
|
+
}).strict(), ie = e.object({
|
|
492
547
|
name: e.string().min(1),
|
|
493
548
|
canonicalName: e.string().min(1).optional(),
|
|
494
549
|
// Case A: a key resolved against `base`'s exports, never a module path to import.
|
|
495
550
|
entry: e.string().min(1),
|
|
496
551
|
propsSchema: e.record(e.string(), e.unknown()).optional(),
|
|
497
552
|
capabilities: e.array(e.enum(["children", "bindings", "events", "formField", "ssr", "pdf"])).optional(),
|
|
498
|
-
controlled:
|
|
553
|
+
controlled: te.optional(),
|
|
499
554
|
css: e.array(e.string()).optional()
|
|
500
|
-
}).strict(),
|
|
555
|
+
}).strict(), D = e.object({
|
|
501
556
|
$schema: e.string().optional(),
|
|
502
557
|
id: e.string().min(1),
|
|
503
558
|
namespace: e.string().min(1).optional(),
|
|
@@ -506,12 +561,12 @@ const G = e.object({
|
|
|
506
561
|
name: e.literal("bonsai"),
|
|
507
562
|
api: e.string().min(1)
|
|
508
563
|
}).strict(),
|
|
509
|
-
components: e.array(
|
|
564
|
+
components: e.array(ie).min(1),
|
|
510
565
|
integrity: e.object({
|
|
511
566
|
algorithm: e.literal("sha256"),
|
|
512
567
|
manifestHash: e.string().min(1)
|
|
513
568
|
}).strict().optional()
|
|
514
|
-
}).strict(),
|
|
569
|
+
}).strict(), ne = "1", S = {
|
|
515
570
|
identity: (t) => t,
|
|
516
571
|
targetValue: (t) => t?.target?.value,
|
|
517
572
|
targetChecked: (t) => t?.target?.checked,
|
|
@@ -522,72 +577,72 @@ class g extends Error {
|
|
|
522
577
|
super(i), this.name = "ManifestLoadError";
|
|
523
578
|
}
|
|
524
579
|
}
|
|
525
|
-
function
|
|
526
|
-
return t ? i ? e.any().superRefine((n,
|
|
580
|
+
function ae(t, i) {
|
|
581
|
+
return t ? i ? e.any().superRefine((n, r) => {
|
|
527
582
|
const a = t.safeParse(n);
|
|
528
583
|
if (!a.success)
|
|
529
584
|
for (const s of a.error.issues)
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
if (!
|
|
533
|
-
for (const s of
|
|
534
|
-
|
|
585
|
+
r.addIssue({ code: "custom", message: s.message, path: s.path });
|
|
586
|
+
const o = i.safeParse(n);
|
|
587
|
+
if (!o.success)
|
|
588
|
+
for (const s of o.error.issues)
|
|
589
|
+
r.addIssue({ code: "custom", message: s.message, path: s.path });
|
|
535
590
|
}) : t : i;
|
|
536
591
|
}
|
|
537
|
-
async function
|
|
592
|
+
async function re(t) {
|
|
538
593
|
const i = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", i);
|
|
539
594
|
return `sha256:${Array.from(new Uint8Array(n)).map((a) => a.toString(16).padStart(2, "0")).join("")}`;
|
|
540
595
|
}
|
|
541
|
-
function
|
|
542
|
-
const i =
|
|
596
|
+
function oe(t) {
|
|
597
|
+
const i = S[t];
|
|
543
598
|
if (!i)
|
|
544
599
|
throw new g(
|
|
545
|
-
`Registry manifest: unknown extractor "${t}" — must be one of: ${Object.keys(
|
|
600
|
+
`Registry manifest: unknown extractor "${t}" — must be one of: ${Object.keys(S).join(", ")}`
|
|
546
601
|
);
|
|
547
602
|
return i;
|
|
548
603
|
}
|
|
549
|
-
function
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
604
|
+
function se(t, i, n) {
|
|
605
|
+
const r = i.components[t.entry];
|
|
606
|
+
if (!r)
|
|
552
607
|
throw new g(
|
|
553
608
|
`Registry manifest "${n}": component "${t.name}" resolves entry "${t.entry}", which is not exported by base registry "${i.id}"@"${i.version}"`
|
|
554
609
|
);
|
|
555
|
-
const a = t.propsSchema ?
|
|
610
|
+
const a = t.propsSchema ? x(t.propsSchema) : void 0, o = t.controlled ? {
|
|
556
611
|
valueProp: t.controlled.valueProp,
|
|
557
612
|
changeProp: t.controlled.changeProp,
|
|
558
|
-
extract:
|
|
559
|
-
} :
|
|
613
|
+
extract: oe(t.controlled.extract)
|
|
614
|
+
} : r.controlled;
|
|
560
615
|
return [
|
|
561
616
|
t.canonicalName ?? t.name,
|
|
562
|
-
|
|
563
|
-
component:
|
|
564
|
-
propsSchema:
|
|
565
|
-
capabilities: t.capabilities ??
|
|
566
|
-
controlled:
|
|
567
|
-
assets: t.css ? { css: t.css } :
|
|
617
|
+
R({
|
|
618
|
+
component: r.component,
|
|
619
|
+
propsSchema: ae(r.propsSchema, a),
|
|
620
|
+
capabilities: t.capabilities ?? r.capabilities,
|
|
621
|
+
controlled: o,
|
|
622
|
+
assets: t.css ? { css: t.css } : r.assets
|
|
568
623
|
})
|
|
569
624
|
];
|
|
570
625
|
}
|
|
571
|
-
function
|
|
572
|
-
const n =
|
|
573
|
-
if (n.engine.api !==
|
|
626
|
+
function ce(t, i) {
|
|
627
|
+
const n = D.parse(t), r = i.engineApi ?? ne;
|
|
628
|
+
if (n.engine.api !== r)
|
|
574
629
|
throw new g(
|
|
575
|
-
`Registry manifest "${n.id}" targets engine.api "${n.engine.api}", but this build supports "${
|
|
630
|
+
`Registry manifest "${n.id}" targets engine.api "${n.engine.api}", but this build supports "${r}"`
|
|
576
631
|
);
|
|
577
632
|
const a = i.maxComponents ?? 500;
|
|
578
633
|
if (n.components.length > a)
|
|
579
634
|
throw new g(
|
|
580
635
|
`Registry manifest "${n.id}" declares ${n.components.length} components, exceeding the limit of ${a}`
|
|
581
636
|
);
|
|
582
|
-
const
|
|
583
|
-
if (i.rawManifestSize != null && i.rawManifestSize >
|
|
637
|
+
const o = i.maxManifestBytes ?? 5 * 1024 * 1024;
|
|
638
|
+
if (i.rawManifestSize != null && i.rawManifestSize > o)
|
|
584
639
|
throw new g(
|
|
585
|
-
`Registry manifest "${n.id}" is ${i.rawManifestSize} bytes, exceeding the limit of ${
|
|
640
|
+
`Registry manifest "${n.id}" is ${i.rawManifestSize} bytes, exceeding the limit of ${o}`
|
|
586
641
|
);
|
|
587
642
|
const s = Object.fromEntries(
|
|
588
|
-
n.components.map((l) =>
|
|
643
|
+
n.components.map((l) => se(l, i.base, n.id))
|
|
589
644
|
);
|
|
590
|
-
return
|
|
645
|
+
return I({
|
|
591
646
|
id: n.id,
|
|
592
647
|
version: n.version,
|
|
593
648
|
namespace: n.namespace,
|
|
@@ -596,11 +651,11 @@ function te(t, i) {
|
|
|
596
651
|
components: s
|
|
597
652
|
});
|
|
598
653
|
}
|
|
599
|
-
const
|
|
600
|
-
function
|
|
601
|
-
|
|
654
|
+
const v = /* @__PURE__ */ new Map();
|
|
655
|
+
function ve() {
|
|
656
|
+
v.clear();
|
|
602
657
|
}
|
|
603
|
-
function
|
|
658
|
+
function de(t, i) {
|
|
604
659
|
if (!t.integrity)
|
|
605
660
|
throw new g(
|
|
606
661
|
`Registry manifest "${t.id}" has no integrity block — a manifest hash is required before use`
|
|
@@ -610,7 +665,7 @@ function ie(t, i) {
|
|
|
610
665
|
`Registry manifest "${t.id}" failed its integrity check: expected "${t.integrity.manifestHash}", computed "${i}"`
|
|
611
666
|
);
|
|
612
667
|
}
|
|
613
|
-
async function
|
|
668
|
+
async function Oe(t, i) {
|
|
614
669
|
let n;
|
|
615
670
|
if (typeof t == "string") {
|
|
616
671
|
const p = new URL(t);
|
|
@@ -618,86 +673,86 @@ async function ge(t, i) {
|
|
|
618
673
|
throw new g(
|
|
619
674
|
`Registry manifest origin "${p.origin}" is not in the allowed origins list`
|
|
620
675
|
);
|
|
621
|
-
const
|
|
622
|
-
if (!
|
|
676
|
+
const b = await (i.fetchImpl ?? fetch)(t);
|
|
677
|
+
if (!b.ok)
|
|
623
678
|
throw new g(
|
|
624
|
-
`Registry manifest fetch failed: ${t} responded ${
|
|
679
|
+
`Registry manifest fetch failed: ${t} responded ${b.status}`
|
|
625
680
|
);
|
|
626
|
-
n = await
|
|
681
|
+
n = await b.text();
|
|
627
682
|
} else
|
|
628
683
|
n = JSON.stringify(t);
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
const l =
|
|
684
|
+
const r = D.parse(JSON.parse(n)), { integrity: a, ...o } = r, s = await re(JSON.stringify(o));
|
|
685
|
+
de(r, s);
|
|
686
|
+
const l = v.get(s);
|
|
632
687
|
if (l) return l;
|
|
633
|
-
const
|
|
634
|
-
return
|
|
688
|
+
const f = ce(r, { ...i, rawManifestSize: n.length, manifestHash: s });
|
|
689
|
+
return v.set(s, f), f;
|
|
635
690
|
}
|
|
636
|
-
function
|
|
637
|
-
const n = { ...t?.properties ?? {}, ...i?.properties ?? {} },
|
|
638
|
-
return { type: "object", properties: n, required:
|
|
691
|
+
function ke(t, i) {
|
|
692
|
+
const n = { ...t?.properties ?? {}, ...i?.properties ?? {} }, r = [.../* @__PURE__ */ new Set([...t?.required ?? [], ...i?.required ?? []])];
|
|
693
|
+
return { type: "object", properties: n, required: r };
|
|
639
694
|
}
|
|
640
|
-
function
|
|
641
|
-
const n = new Map(t.map((
|
|
642
|
-
for (const [
|
|
643
|
-
const l = n.get(
|
|
644
|
-
l === void 0 ? a.push(`${
|
|
695
|
+
function le(t, i) {
|
|
696
|
+
const n = new Map(t.map((o) => [o.url, o.registryHash])), r = new Map(i.map((o) => [o.url, o.registryHash])), a = [];
|
|
697
|
+
for (const [o, s] of r) {
|
|
698
|
+
const l = n.get(o);
|
|
699
|
+
l === void 0 ? a.push(`${o} is configured but missing from the artifact`) : l !== s && a.push(`${o}: artifact has ${l}, pebble-kit.json records ${s}`);
|
|
645
700
|
}
|
|
646
|
-
for (const
|
|
647
|
-
|
|
701
|
+
for (const o of n.keys())
|
|
702
|
+
r.has(o) || a.push(`${o} is in the artifact but no longer configured`);
|
|
648
703
|
return a.length > 0 ? a.join("; ") : void 0;
|
|
649
704
|
}
|
|
650
|
-
function
|
|
705
|
+
function A(t) {
|
|
651
706
|
const i = /(\d+)\.\d+\.\d+/.exec(t);
|
|
652
707
|
return i ? Number(i[1]) : void 0;
|
|
653
708
|
}
|
|
654
|
-
function
|
|
655
|
-
const i = [], n =
|
|
709
|
+
function Pe(t) {
|
|
710
|
+
const i = [], n = le(t.artifactRegistries, t.configRegistries);
|
|
656
711
|
if (n && i.push({
|
|
657
712
|
check: "stale-artifact",
|
|
658
713
|
level: "fail",
|
|
659
714
|
message: `bonsai.generated.json is out of date with pebble-kit.json (${n}) — run "pebble-kit generate"`
|
|
660
715
|
}), t.artifactBaseUiVersion !== t.installedBaseUiVersion) {
|
|
661
|
-
const
|
|
716
|
+
const r = A(t.artifactBaseUiVersion), a = A(t.installedBaseUiVersion), o = r !== void 0 && a !== void 0 && r !== a;
|
|
662
717
|
i.push({
|
|
663
718
|
check: "baseui-drift",
|
|
664
|
-
level:
|
|
719
|
+
level: o ? "fail" : "warn",
|
|
665
720
|
message: `generated artifact's baseline was built against @base-ui/react ${t.artifactBaseUiVersion}, but ${t.installedBaseUiVersion} is installed`
|
|
666
721
|
});
|
|
667
722
|
}
|
|
668
723
|
return i;
|
|
669
724
|
}
|
|
670
|
-
function
|
|
725
|
+
function je(t) {
|
|
671
726
|
const i = t.filter((n) => n.level === "fail");
|
|
672
727
|
if (i.length > 0)
|
|
673
728
|
throw new Error(i.map((n) => n.message).join("; "));
|
|
674
729
|
}
|
|
675
|
-
const { Bonsai:
|
|
730
|
+
const { Bonsai: Se } = C({ registry: V });
|
|
676
731
|
export {
|
|
677
|
-
|
|
678
|
-
|
|
732
|
+
Se as Bonsai,
|
|
733
|
+
S as EXTRACTOR_ALLOWLIST,
|
|
679
734
|
g as ManifestLoadError,
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
735
|
+
D as RegistryManifestSchema,
|
|
736
|
+
je as assertNoFailingDrift,
|
|
737
|
+
Pe as checkArtifactDrift,
|
|
738
|
+
ve as clearManifestCache,
|
|
739
|
+
L as componentMap,
|
|
740
|
+
ae as composePropsSchema,
|
|
741
|
+
re as computeManifestHash,
|
|
742
|
+
J as controlledInputMap,
|
|
743
|
+
E as coreRegistry,
|
|
744
|
+
C as createBonsaiRenderer,
|
|
745
|
+
I as defineBonsaiRegistry,
|
|
746
|
+
R as defineComponent,
|
|
747
|
+
M as extendRegistry,
|
|
748
|
+
x as jsonSchemaToZod,
|
|
749
|
+
Oe as loadRegistryManifest,
|
|
750
|
+
ke as mergeGeneratedWithOverrides,
|
|
751
|
+
V as pebbleRegistry,
|
|
752
|
+
ce as resolveManifest,
|
|
753
|
+
X as resolveRegistryPin,
|
|
754
|
+
ze as useBonsaiRenderMode,
|
|
755
|
+
Re as useUpdateData,
|
|
756
|
+
xe as validateTemplate
|
|
702
757
|
};
|
|
703
758
|
//# sourceMappingURL=index.js.map
|