@pebble-software/bonsai 0.0.6 → 0.0.8
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/index.d.ts +26 -3
- package/dist/index.js +1176 -1657
- package/package.json +1 -4
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare interface BonsaiProps {
|
|
|
13
13
|
template: Config;
|
|
14
14
|
data?: any;
|
|
15
15
|
status?: "pending" | "captured" | "completed" | "error" | "revoked";
|
|
16
|
-
render?:
|
|
16
|
+
render?: RenderMode;
|
|
17
17
|
registry?: BonsaiRegistry;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -37,7 +37,6 @@ declare enum COMPONENT {
|
|
|
37
37
|
OL = "ol",
|
|
38
38
|
UL = "ul",
|
|
39
39
|
LI = "li",
|
|
40
|
-
MAP = "map",
|
|
41
40
|
DIV = "div",
|
|
42
41
|
SPAN = "span",
|
|
43
42
|
ACCORDION = "accordion",
|
|
@@ -156,7 +155,29 @@ export declare const EXTRACTOR_ALLOWLIST: Record<string, (eventOrValue: unknown)
|
|
|
156
155
|
*/
|
|
157
156
|
export declare type JsonSchema = Record<string, unknown>;
|
|
158
157
|
|
|
159
|
-
export declare function jsonSchemaToZod(schema: JsonSchema): z.ZodType<unknown>;
|
|
158
|
+
export declare function jsonSchemaToZod(schema: JsonSchema, options?: JsonSchemaToZodOptions): z.ZodType<unknown>;
|
|
159
|
+
|
|
160
|
+
declare interface JsonSchemaToZodOptions {
|
|
161
|
+
/**
|
|
162
|
+
* Accept a `"{{expression}}"` binding anywhere a typed value is declared.
|
|
163
|
+
*
|
|
164
|
+
* A template author writes `checked: "{{form.agree}}"` and the binding is resolved at
|
|
165
|
+
* render time, long after validation runs — so a schema saying `{"type":"boolean"}`
|
|
166
|
+
* rejects a template that would render perfectly. The hand-rolled registry has always
|
|
167
|
+
* worked around this by declaring `z.union([z.string(), z.boolean()])` by hand on every
|
|
168
|
+
* affected prop. This is that convention made available to manifests whose schemas were
|
|
169
|
+
* machine-derived from component sources and so cannot hand-write it.
|
|
170
|
+
*
|
|
171
|
+
* Opt-in rather than automatic: `bonsai.generated.json` doubles as an LLM tool
|
|
172
|
+
* definition, and a prop that reads "boolean" there is worth keeping precise.
|
|
173
|
+
*
|
|
174
|
+
* Narrower than the hand-rolled convention on purpose — only binding-*shaped* strings
|
|
175
|
+
* are admitted, not every string. `{"type":"string","minLength":1}` therefore still
|
|
176
|
+
* rejects `""`, and an `enum` still rejects a value outside it, both of which a blanket
|
|
177
|
+
* `z.string()` union would silently discard.
|
|
178
|
+
*/
|
|
179
|
+
allowBindings?: boolean;
|
|
180
|
+
}
|
|
160
181
|
|
|
161
182
|
export declare interface LoadManifestOptions extends ResolveManifestOptions {
|
|
162
183
|
allowedOrigins?: string[];
|
|
@@ -282,6 +303,8 @@ export declare interface RegistryValidationResult {
|
|
|
282
303
|
warnings: string[];
|
|
283
304
|
}
|
|
284
305
|
|
|
306
|
+
declare type RenderMode = "web" | "pdf" | "preview";
|
|
307
|
+
|
|
285
308
|
export declare function resolveManifest(manifest: RegistryManifest, options: ResolveManifestOptions): BonsaiRegistry;
|
|
286
309
|
|
|
287
310
|
export declare interface ResolveManifestOptions {
|