@shop-on/theme-contract 0.4.0 → 0.6.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/ai-files.d.ts +18 -0
- package/dist/ai-files.js +47 -0
- package/dist/block-allowlist.d.ts +27 -0
- package/dist/block-allowlist.js +21 -0
- package/dist/closest-scope.d.ts +51 -0
- package/dist/closest-scope.js +66 -0
- package/dist/document.d.ts +13 -0
- package/dist/document.js +19 -5
- package/dist/editor-tools/apply.d.ts +85 -0
- package/dist/editor-tools/apply.js +544 -0
- package/dist/editor-tools/args.d.ts +153 -0
- package/dist/editor-tools/args.js +145 -0
- package/dist/editor-tools/coerce.d.ts +43 -0
- package/dist/editor-tools/coerce.js +200 -0
- package/dist/editor-tools/digest.d.ts +75 -0
- package/dist/editor-tools/digest.js +99 -0
- package/dist/editor-tools/index.d.ts +21 -0
- package/dist/editor-tools/index.js +24 -0
- package/dist/editor-tools/recipes.d.ts +122 -0
- package/dist/editor-tools/recipes.js +192 -0
- package/dist/fonts.d.ts +9 -0
- package/dist/fonts.js +11 -0
- package/dist/google-fonts.generated.d.ts +7 -0
- package/dist/google-fonts.generated.js +753 -0
- package/dist/index.d.ts +15 -6
- package/dist/index.js +15 -6
- package/dist/link-url.d.ts +9 -0
- package/dist/link-url.js +33 -0
- package/dist/metafield-binding.d.ts +89 -9
- package/dist/metafield-binding.js +254 -43
- package/dist/ops.d.ts +85 -0
- package/dist/ops.js +442 -0
- package/dist/richtext.d.ts +23 -0
- package/dist/richtext.js +115 -1
- package/dist/schemas.d.ts +329 -0
- package/dist/schemas.js +62 -8
- package/dist/section-scope.d.ts +17 -0
- package/dist/section-scope.js +22 -0
- package/dist/store-path.d.ts +9 -0
- package/dist/store-path.js +13 -1
- package/dist/template-limits.d.ts +34 -0
- package/dist/template-limits.js +71 -0
- package/dist/video-url.d.ts +10 -0
- package/dist/video-url.js +36 -0
- package/package.json +8 -1
package/dist/schemas.d.ts
CHANGED
|
@@ -19,6 +19,30 @@ export declare const SettingBinding: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
19
19
|
source: z.ZodLiteral<"collection_attribute">;
|
|
20
20
|
attribute: z.ZodString;
|
|
21
21
|
settingType: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
source: z.ZodLiteral<"collection_metafield">;
|
|
24
|
+
namespace: z.ZodString;
|
|
25
|
+
key: z.ZodString;
|
|
26
|
+
field: z.ZodOptional<z.ZodString>;
|
|
27
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
+
source: z.ZodLiteral<"page_metafield">;
|
|
30
|
+
namespace: z.ZodString;
|
|
31
|
+
key: z.ZodString;
|
|
32
|
+
field: z.ZodOptional<z.ZodString>;
|
|
33
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
source: z.ZodLiteral<"blog_metafield">;
|
|
36
|
+
namespace: z.ZodString;
|
|
37
|
+
key: z.ZodString;
|
|
38
|
+
field: z.ZodOptional<z.ZodString>;
|
|
39
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
source: z.ZodLiteral<"article_metafield">;
|
|
42
|
+
namespace: z.ZodString;
|
|
43
|
+
key: z.ZodString;
|
|
44
|
+
field: z.ZodOptional<z.ZodString>;
|
|
45
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
22
46
|
}, z.core.$strip>, z.ZodObject<{
|
|
23
47
|
source: z.ZodLiteral<"page_attribute">;
|
|
24
48
|
attribute: z.ZodString;
|
|
@@ -28,8 +52,55 @@ export declare const SettingBinding: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
28
52
|
}, z.core.$strip>, z.ZodObject<{
|
|
29
53
|
source: z.ZodLiteral<"article_attribute">;
|
|
30
54
|
attribute: z.ZodString;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
source: z.ZodLiteral<"closest_product_metafield">;
|
|
57
|
+
namespace: z.ZodString;
|
|
58
|
+
key: z.ZodString;
|
|
59
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
source: z.ZodLiteral<"closest_product_attribute">;
|
|
62
|
+
attribute: z.ZodString;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
source: z.ZodLiteral<"closest_collection_attribute">;
|
|
65
|
+
attribute: z.ZodString;
|
|
66
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
68
|
+
source: z.ZodLiteral<"closest_page_attribute">;
|
|
69
|
+
attribute: z.ZodString;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
source: z.ZodLiteral<"closest_blog_attribute">;
|
|
72
|
+
attribute: z.ZodString;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
source: z.ZodLiteral<"closest_article_attribute">;
|
|
75
|
+
attribute: z.ZodString;
|
|
31
76
|
}, z.core.$strip>], "source">;
|
|
32
77
|
export type SettingBinding = z.infer<typeof SettingBinding>;
|
|
78
|
+
export declare const ClosestResource: z.ZodEnum<{
|
|
79
|
+
article: "article";
|
|
80
|
+
blog: "blog";
|
|
81
|
+
collection: "collection";
|
|
82
|
+
page: "page";
|
|
83
|
+
product: "product";
|
|
84
|
+
}>;
|
|
85
|
+
export type ClosestResource = z.infer<typeof ClosestResource>;
|
|
86
|
+
export declare const CLOSEST_RESOURCES: ("article" | "blog" | "collection" | "page" | "product")[];
|
|
87
|
+
export declare const ProviderDecl: z.ZodObject<{
|
|
88
|
+
from: z.ZodString;
|
|
89
|
+
each: z.ZodArray<z.ZodString>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export declare const THEME_FED = "$theme";
|
|
92
|
+
export type ProviderDecl = z.infer<typeof ProviderDecl>;
|
|
93
|
+
export declare const Provides: z.ZodRecord<z.ZodEnum<{
|
|
94
|
+
article: "article";
|
|
95
|
+
blog: "blog";
|
|
96
|
+
collection: "collection";
|
|
97
|
+
page: "page";
|
|
98
|
+
product: "product";
|
|
99
|
+
}> & z.core.$partial, z.ZodObject<{
|
|
100
|
+
from: z.ZodString;
|
|
101
|
+
each: z.ZodArray<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
export type Provides = z.infer<typeof Provides>;
|
|
33
104
|
export declare const SettingBindings: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
105
|
source: z.ZodLiteral<"product_metafield">;
|
|
35
106
|
namespace: z.ZodString;
|
|
@@ -48,6 +119,30 @@ export declare const SettingBindings: z.ZodRecord<z.ZodString, z.ZodDiscriminate
|
|
|
48
119
|
source: z.ZodLiteral<"collection_attribute">;
|
|
49
120
|
attribute: z.ZodString;
|
|
50
121
|
settingType: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
source: z.ZodLiteral<"collection_metafield">;
|
|
124
|
+
namespace: z.ZodString;
|
|
125
|
+
key: z.ZodString;
|
|
126
|
+
field: z.ZodOptional<z.ZodString>;
|
|
127
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
source: z.ZodLiteral<"page_metafield">;
|
|
130
|
+
namespace: z.ZodString;
|
|
131
|
+
key: z.ZodString;
|
|
132
|
+
field: z.ZodOptional<z.ZodString>;
|
|
133
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
source: z.ZodLiteral<"blog_metafield">;
|
|
136
|
+
namespace: z.ZodString;
|
|
137
|
+
key: z.ZodString;
|
|
138
|
+
field: z.ZodOptional<z.ZodString>;
|
|
139
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
141
|
+
source: z.ZodLiteral<"article_metafield">;
|
|
142
|
+
namespace: z.ZodString;
|
|
143
|
+
key: z.ZodString;
|
|
144
|
+
field: z.ZodOptional<z.ZodString>;
|
|
145
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
51
146
|
}, z.core.$strip>, z.ZodObject<{
|
|
52
147
|
source: z.ZodLiteral<"page_attribute">;
|
|
53
148
|
attribute: z.ZodString;
|
|
@@ -57,6 +152,27 @@ export declare const SettingBindings: z.ZodRecord<z.ZodString, z.ZodDiscriminate
|
|
|
57
152
|
}, z.core.$strip>, z.ZodObject<{
|
|
58
153
|
source: z.ZodLiteral<"article_attribute">;
|
|
59
154
|
attribute: z.ZodString;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
source: z.ZodLiteral<"closest_product_metafield">;
|
|
157
|
+
namespace: z.ZodString;
|
|
158
|
+
key: z.ZodString;
|
|
159
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
source: z.ZodLiteral<"closest_product_attribute">;
|
|
162
|
+
attribute: z.ZodString;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
source: z.ZodLiteral<"closest_collection_attribute">;
|
|
165
|
+
attribute: z.ZodString;
|
|
166
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
168
|
+
source: z.ZodLiteral<"closest_page_attribute">;
|
|
169
|
+
attribute: z.ZodString;
|
|
170
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
171
|
+
source: z.ZodLiteral<"closest_blog_attribute">;
|
|
172
|
+
attribute: z.ZodString;
|
|
173
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
174
|
+
source: z.ZodLiteral<"closest_article_attribute">;
|
|
175
|
+
attribute: z.ZodString;
|
|
60
176
|
}, z.core.$strip>], "source">>;
|
|
61
177
|
export type SettingBindings = z.infer<typeof SettingBindings>;
|
|
62
178
|
export declare const SchemaSetting: z.ZodObject<{
|
|
@@ -237,6 +353,16 @@ export declare const SectionSchema: z.ZodObject<{
|
|
|
237
353
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
238
354
|
blocks: z.ZodOptional<z.ZodArray<z.ZodType<BlockDefinition, unknown, z.core.$ZodTypeInternals<BlockDefinition, unknown>>>>;
|
|
239
355
|
}, z.core.$loose>>>;
|
|
356
|
+
provides: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
357
|
+
article: "article";
|
|
358
|
+
blog: "blog";
|
|
359
|
+
collection: "collection";
|
|
360
|
+
page: "page";
|
|
361
|
+
product: "product";
|
|
362
|
+
}> & z.core.$partial, z.ZodObject<{
|
|
363
|
+
from: z.ZodString;
|
|
364
|
+
each: z.ZodArray<z.ZodString>;
|
|
365
|
+
}, z.core.$strip>>>;
|
|
240
366
|
}, z.core.$loose>;
|
|
241
367
|
export type SectionSchema = z.infer<typeof SectionSchema>;
|
|
242
368
|
export declare const BlockSchema: z.ZodObject<{
|
|
@@ -270,6 +396,16 @@ export declare const BlockSchema: z.ZodObject<{
|
|
|
270
396
|
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
271
397
|
blocks: z.ZodOptional<z.ZodArray<z.ZodType<BlockDefinition, unknown, z.core.$ZodTypeInternals<BlockDefinition, unknown>>>>;
|
|
272
398
|
}, z.core.$loose>>>;
|
|
399
|
+
provides: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
400
|
+
article: "article";
|
|
401
|
+
blog: "blog";
|
|
402
|
+
collection: "collection";
|
|
403
|
+
page: "page";
|
|
404
|
+
product: "product";
|
|
405
|
+
}> & z.core.$partial, z.ZodObject<{
|
|
406
|
+
from: z.ZodString;
|
|
407
|
+
each: z.ZodArray<z.ZodString>;
|
|
408
|
+
}, z.core.$strip>>>;
|
|
273
409
|
}, z.core.$loose>;
|
|
274
410
|
export type BlockSchema = z.infer<typeof BlockSchema>;
|
|
275
411
|
export type TemplateBlock = {
|
|
@@ -283,7 +419,20 @@ export type TemplateBlock = {
|
|
|
283
419
|
custom_css?: string;
|
|
284
420
|
blocks?: Record<string, TemplateBlock>;
|
|
285
421
|
block_order?: string[];
|
|
422
|
+
source?: "app";
|
|
423
|
+
appId?: string;
|
|
424
|
+
tag?: string;
|
|
425
|
+
scriptUrl?: string;
|
|
426
|
+
closestSettings?: Record<string, Record<string, unknown>>;
|
|
286
427
|
};
|
|
428
|
+
/** A `$theme` list's per-item values for a batch of its items: block-id path
|
|
429
|
+
* below the provider (the `each` id first, joined with `/`) → item handle →
|
|
430
|
+
* settings. `resolveListOverlays` (@shop-on/theme-loader) builds it,
|
|
431
|
+
* `withClosestOverlays` (@shop-on/theme-react) merges it into
|
|
432
|
+
* `closestSettings`. Strings only: a closest source binds string sinks alone
|
|
433
|
+
* (text, textarea, inline_richtext, richtext, color, url), which is also what
|
|
434
|
+
* lets a server fn return it. */
|
|
435
|
+
export type ClosestOverlays = Record<string, Record<string, Record<string, string>>>;
|
|
287
436
|
export declare const TemplateBlock: z.ZodType<TemplateBlock>;
|
|
288
437
|
export declare const TemplateSection: z.ZodObject<{
|
|
289
438
|
type: z.ZodString;
|
|
@@ -306,6 +455,30 @@ export declare const TemplateSection: z.ZodObject<{
|
|
|
306
455
|
source: z.ZodLiteral<"collection_attribute">;
|
|
307
456
|
attribute: z.ZodString;
|
|
308
457
|
settingType: z.ZodOptional<z.ZodString>;
|
|
458
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
459
|
+
source: z.ZodLiteral<"collection_metafield">;
|
|
460
|
+
namespace: z.ZodString;
|
|
461
|
+
key: z.ZodString;
|
|
462
|
+
field: z.ZodOptional<z.ZodString>;
|
|
463
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
464
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
465
|
+
source: z.ZodLiteral<"page_metafield">;
|
|
466
|
+
namespace: z.ZodString;
|
|
467
|
+
key: z.ZodString;
|
|
468
|
+
field: z.ZodOptional<z.ZodString>;
|
|
469
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
470
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
471
|
+
source: z.ZodLiteral<"blog_metafield">;
|
|
472
|
+
namespace: z.ZodString;
|
|
473
|
+
key: z.ZodString;
|
|
474
|
+
field: z.ZodOptional<z.ZodString>;
|
|
475
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
476
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
477
|
+
source: z.ZodLiteral<"article_metafield">;
|
|
478
|
+
namespace: z.ZodString;
|
|
479
|
+
key: z.ZodString;
|
|
480
|
+
field: z.ZodOptional<z.ZodString>;
|
|
481
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
309
482
|
}, z.core.$strip>, z.ZodObject<{
|
|
310
483
|
source: z.ZodLiteral<"page_attribute">;
|
|
311
484
|
attribute: z.ZodString;
|
|
@@ -315,6 +488,27 @@ export declare const TemplateSection: z.ZodObject<{
|
|
|
315
488
|
}, z.core.$strip>, z.ZodObject<{
|
|
316
489
|
source: z.ZodLiteral<"article_attribute">;
|
|
317
490
|
attribute: z.ZodString;
|
|
491
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
492
|
+
source: z.ZodLiteral<"closest_product_metafield">;
|
|
493
|
+
namespace: z.ZodString;
|
|
494
|
+
key: z.ZodString;
|
|
495
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
496
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
497
|
+
source: z.ZodLiteral<"closest_product_attribute">;
|
|
498
|
+
attribute: z.ZodString;
|
|
499
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
500
|
+
source: z.ZodLiteral<"closest_collection_attribute">;
|
|
501
|
+
attribute: z.ZodString;
|
|
502
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
503
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
504
|
+
source: z.ZodLiteral<"closest_page_attribute">;
|
|
505
|
+
attribute: z.ZodString;
|
|
506
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
507
|
+
source: z.ZodLiteral<"closest_blog_attribute">;
|
|
508
|
+
attribute: z.ZodString;
|
|
509
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
510
|
+
source: z.ZodLiteral<"closest_article_attribute">;
|
|
511
|
+
attribute: z.ZodString;
|
|
318
512
|
}, z.core.$strip>], "source">>>;
|
|
319
513
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
320
514
|
customName: z.ZodOptional<z.ZodString>;
|
|
@@ -352,6 +546,30 @@ export declare const Template: z.ZodObject<{
|
|
|
352
546
|
source: z.ZodLiteral<"collection_attribute">;
|
|
353
547
|
attribute: z.ZodString;
|
|
354
548
|
settingType: z.ZodOptional<z.ZodString>;
|
|
549
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
550
|
+
source: z.ZodLiteral<"collection_metafield">;
|
|
551
|
+
namespace: z.ZodString;
|
|
552
|
+
key: z.ZodString;
|
|
553
|
+
field: z.ZodOptional<z.ZodString>;
|
|
554
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
555
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
556
|
+
source: z.ZodLiteral<"page_metafield">;
|
|
557
|
+
namespace: z.ZodString;
|
|
558
|
+
key: z.ZodString;
|
|
559
|
+
field: z.ZodOptional<z.ZodString>;
|
|
560
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
561
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
562
|
+
source: z.ZodLiteral<"blog_metafield">;
|
|
563
|
+
namespace: z.ZodString;
|
|
564
|
+
key: z.ZodString;
|
|
565
|
+
field: z.ZodOptional<z.ZodString>;
|
|
566
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
567
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
568
|
+
source: z.ZodLiteral<"article_metafield">;
|
|
569
|
+
namespace: z.ZodString;
|
|
570
|
+
key: z.ZodString;
|
|
571
|
+
field: z.ZodOptional<z.ZodString>;
|
|
572
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
355
573
|
}, z.core.$strip>, z.ZodObject<{
|
|
356
574
|
source: z.ZodLiteral<"page_attribute">;
|
|
357
575
|
attribute: z.ZodString;
|
|
@@ -361,6 +579,27 @@ export declare const Template: z.ZodObject<{
|
|
|
361
579
|
}, z.core.$strip>, z.ZodObject<{
|
|
362
580
|
source: z.ZodLiteral<"article_attribute">;
|
|
363
581
|
attribute: z.ZodString;
|
|
582
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
583
|
+
source: z.ZodLiteral<"closest_product_metafield">;
|
|
584
|
+
namespace: z.ZodString;
|
|
585
|
+
key: z.ZodString;
|
|
586
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
587
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
588
|
+
source: z.ZodLiteral<"closest_product_attribute">;
|
|
589
|
+
attribute: z.ZodString;
|
|
590
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
591
|
+
source: z.ZodLiteral<"closest_collection_attribute">;
|
|
592
|
+
attribute: z.ZodString;
|
|
593
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
594
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
595
|
+
source: z.ZodLiteral<"closest_page_attribute">;
|
|
596
|
+
attribute: z.ZodString;
|
|
597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
598
|
+
source: z.ZodLiteral<"closest_blog_attribute">;
|
|
599
|
+
attribute: z.ZodString;
|
|
600
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
601
|
+
source: z.ZodLiteral<"closest_article_attribute">;
|
|
602
|
+
attribute: z.ZodString;
|
|
364
603
|
}, z.core.$strip>], "source">>>;
|
|
365
604
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
366
605
|
customName: z.ZodOptional<z.ZodString>;
|
|
@@ -397,6 +636,30 @@ export declare const Template: z.ZodObject<{
|
|
|
397
636
|
source: z.ZodLiteral<"collection_attribute">;
|
|
398
637
|
attribute: z.ZodString;
|
|
399
638
|
settingType: z.ZodOptional<z.ZodString>;
|
|
639
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
640
|
+
source: z.ZodLiteral<"collection_metafield">;
|
|
641
|
+
namespace: z.ZodString;
|
|
642
|
+
key: z.ZodString;
|
|
643
|
+
field: z.ZodOptional<z.ZodString>;
|
|
644
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
645
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
646
|
+
source: z.ZodLiteral<"page_metafield">;
|
|
647
|
+
namespace: z.ZodString;
|
|
648
|
+
key: z.ZodString;
|
|
649
|
+
field: z.ZodOptional<z.ZodString>;
|
|
650
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
651
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
652
|
+
source: z.ZodLiteral<"blog_metafield">;
|
|
653
|
+
namespace: z.ZodString;
|
|
654
|
+
key: z.ZodString;
|
|
655
|
+
field: z.ZodOptional<z.ZodString>;
|
|
656
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
657
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
658
|
+
source: z.ZodLiteral<"article_metafield">;
|
|
659
|
+
namespace: z.ZodString;
|
|
660
|
+
key: z.ZodString;
|
|
661
|
+
field: z.ZodOptional<z.ZodString>;
|
|
662
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
400
663
|
}, z.core.$strip>, z.ZodObject<{
|
|
401
664
|
source: z.ZodLiteral<"page_attribute">;
|
|
402
665
|
attribute: z.ZodString;
|
|
@@ -406,6 +669,27 @@ export declare const Template: z.ZodObject<{
|
|
|
406
669
|
}, z.core.$strip>, z.ZodObject<{
|
|
407
670
|
source: z.ZodLiteral<"article_attribute">;
|
|
408
671
|
attribute: z.ZodString;
|
|
672
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
673
|
+
source: z.ZodLiteral<"closest_product_metafield">;
|
|
674
|
+
namespace: z.ZodString;
|
|
675
|
+
key: z.ZodString;
|
|
676
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
677
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
678
|
+
source: z.ZodLiteral<"closest_product_attribute">;
|
|
679
|
+
attribute: z.ZodString;
|
|
680
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
681
|
+
source: z.ZodLiteral<"closest_collection_attribute">;
|
|
682
|
+
attribute: z.ZodString;
|
|
683
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
684
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
685
|
+
source: z.ZodLiteral<"closest_page_attribute">;
|
|
686
|
+
attribute: z.ZodString;
|
|
687
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
688
|
+
source: z.ZodLiteral<"closest_blog_attribute">;
|
|
689
|
+
attribute: z.ZodString;
|
|
690
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
691
|
+
source: z.ZodLiteral<"closest_article_attribute">;
|
|
692
|
+
attribute: z.ZodString;
|
|
409
693
|
}, z.core.$strip>], "source">>>;
|
|
410
694
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
411
695
|
customName: z.ZodOptional<z.ZodString>;
|
|
@@ -445,6 +729,30 @@ export declare const SectionGroup: z.ZodObject<{
|
|
|
445
729
|
source: z.ZodLiteral<"collection_attribute">;
|
|
446
730
|
attribute: z.ZodString;
|
|
447
731
|
settingType: z.ZodOptional<z.ZodString>;
|
|
732
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
733
|
+
source: z.ZodLiteral<"collection_metafield">;
|
|
734
|
+
namespace: z.ZodString;
|
|
735
|
+
key: z.ZodString;
|
|
736
|
+
field: z.ZodOptional<z.ZodString>;
|
|
737
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
738
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
739
|
+
source: z.ZodLiteral<"page_metafield">;
|
|
740
|
+
namespace: z.ZodString;
|
|
741
|
+
key: z.ZodString;
|
|
742
|
+
field: z.ZodOptional<z.ZodString>;
|
|
743
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
744
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
745
|
+
source: z.ZodLiteral<"blog_metafield">;
|
|
746
|
+
namespace: z.ZodString;
|
|
747
|
+
key: z.ZodString;
|
|
748
|
+
field: z.ZodOptional<z.ZodString>;
|
|
749
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
750
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
751
|
+
source: z.ZodLiteral<"article_metafield">;
|
|
752
|
+
namespace: z.ZodString;
|
|
753
|
+
key: z.ZodString;
|
|
754
|
+
field: z.ZodOptional<z.ZodString>;
|
|
755
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
448
756
|
}, z.core.$strip>, z.ZodObject<{
|
|
449
757
|
source: z.ZodLiteral<"page_attribute">;
|
|
450
758
|
attribute: z.ZodString;
|
|
@@ -454,6 +762,27 @@ export declare const SectionGroup: z.ZodObject<{
|
|
|
454
762
|
}, z.core.$strip>, z.ZodObject<{
|
|
455
763
|
source: z.ZodLiteral<"article_attribute">;
|
|
456
764
|
attribute: z.ZodString;
|
|
765
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
766
|
+
source: z.ZodLiteral<"closest_product_metafield">;
|
|
767
|
+
namespace: z.ZodString;
|
|
768
|
+
key: z.ZodString;
|
|
769
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
770
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
771
|
+
source: z.ZodLiteral<"closest_product_attribute">;
|
|
772
|
+
attribute: z.ZodString;
|
|
773
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
774
|
+
source: z.ZodLiteral<"closest_collection_attribute">;
|
|
775
|
+
attribute: z.ZodString;
|
|
776
|
+
settingType: z.ZodOptional<z.ZodString>;
|
|
777
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
778
|
+
source: z.ZodLiteral<"closest_page_attribute">;
|
|
779
|
+
attribute: z.ZodString;
|
|
780
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
781
|
+
source: z.ZodLiteral<"closest_blog_attribute">;
|
|
782
|
+
attribute: z.ZodString;
|
|
783
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
784
|
+
source: z.ZodLiteral<"closest_article_attribute">;
|
|
785
|
+
attribute: z.ZodString;
|
|
457
786
|
}, z.core.$strip>], "source">>>;
|
|
458
787
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
459
788
|
customName: z.ZodOptional<z.ZodString>;
|
package/dist/schemas.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/schemas.ts
|
|
3
|
-
|
|
4
|
-
z.object({
|
|
5
|
-
source: z.literal(
|
|
3
|
+
function resourceMetafieldArm(source) {
|
|
4
|
+
return z.object({
|
|
5
|
+
source: z.literal(source),
|
|
6
6
|
namespace: z.string(),
|
|
7
7
|
key: z.string(),
|
|
8
8
|
field: z.string().optional(),
|
|
9
9
|
settingType: z.string().optional()
|
|
10
|
-
})
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const SettingBinding = z.discriminatedUnion("source", [
|
|
13
|
+
resourceMetafieldArm("product_metafield"),
|
|
11
14
|
z.object({
|
|
12
15
|
source: z.literal("product_attribute"),
|
|
13
16
|
attribute: z.string()
|
|
@@ -23,6 +26,10 @@ const SettingBinding = z.discriminatedUnion("source", [
|
|
|
23
26
|
attribute: z.string(),
|
|
24
27
|
settingType: z.string().optional()
|
|
25
28
|
}),
|
|
29
|
+
resourceMetafieldArm("collection_metafield"),
|
|
30
|
+
resourceMetafieldArm("page_metafield"),
|
|
31
|
+
resourceMetafieldArm("blog_metafield"),
|
|
32
|
+
resourceMetafieldArm("article_metafield"),
|
|
26
33
|
z.object({
|
|
27
34
|
source: z.literal("page_attribute"),
|
|
28
35
|
attribute: z.string()
|
|
@@ -34,8 +41,49 @@ const SettingBinding = z.discriminatedUnion("source", [
|
|
|
34
41
|
z.object({
|
|
35
42
|
source: z.literal("article_attribute"),
|
|
36
43
|
attribute: z.string()
|
|
44
|
+
}),
|
|
45
|
+
z.object({
|
|
46
|
+
source: z.literal("closest_product_metafield"),
|
|
47
|
+
namespace: z.string(),
|
|
48
|
+
key: z.string(),
|
|
49
|
+
settingType: z.string().optional()
|
|
50
|
+
}),
|
|
51
|
+
z.object({
|
|
52
|
+
source: z.literal("closest_product_attribute"),
|
|
53
|
+
attribute: z.string()
|
|
54
|
+
}),
|
|
55
|
+
z.object({
|
|
56
|
+
source: z.literal("closest_collection_attribute"),
|
|
57
|
+
attribute: z.string(),
|
|
58
|
+
settingType: z.string().optional()
|
|
59
|
+
}),
|
|
60
|
+
z.object({
|
|
61
|
+
source: z.literal("closest_page_attribute"),
|
|
62
|
+
attribute: z.string()
|
|
63
|
+
}),
|
|
64
|
+
z.object({
|
|
65
|
+
source: z.literal("closest_blog_attribute"),
|
|
66
|
+
attribute: z.string()
|
|
67
|
+
}),
|
|
68
|
+
z.object({
|
|
69
|
+
source: z.literal("closest_article_attribute"),
|
|
70
|
+
attribute: z.string()
|
|
37
71
|
})
|
|
38
72
|
]);
|
|
73
|
+
const ClosestResource = z.enum([
|
|
74
|
+
"product",
|
|
75
|
+
"collection",
|
|
76
|
+
"page",
|
|
77
|
+
"blog",
|
|
78
|
+
"article"
|
|
79
|
+
]);
|
|
80
|
+
const CLOSEST_RESOURCES = ClosestResource.options;
|
|
81
|
+
const ProviderDecl = z.object({
|
|
82
|
+
from: z.string(),
|
|
83
|
+
each: z.array(z.string())
|
|
84
|
+
});
|
|
85
|
+
const THEME_FED = "$theme";
|
|
86
|
+
const Provides = z.partialRecord(ClosestResource, ProviderDecl);
|
|
39
87
|
const SettingBindings = z.record(z.string(), SettingBinding);
|
|
40
88
|
const SchemaSetting = z.object({
|
|
41
89
|
type: z.string(),
|
|
@@ -96,7 +144,8 @@ const SectionSchema = z.object({
|
|
|
96
144
|
settings: z.array(SchemaSetting).default([]),
|
|
97
145
|
blocks: z.array(BlockDefinition).default([]),
|
|
98
146
|
max_blocks: z.number().optional(),
|
|
99
|
-
presets: z.array(SectionPreset).optional()
|
|
147
|
+
presets: z.array(SectionPreset).optional(),
|
|
148
|
+
provides: Provides.optional()
|
|
100
149
|
}).passthrough();
|
|
101
150
|
const BlockSchema = z.object({
|
|
102
151
|
name: z.string().optional(),
|
|
@@ -104,7 +153,8 @@ const BlockSchema = z.object({
|
|
|
104
153
|
blocks: z.array(BlockDefinition).optional(),
|
|
105
154
|
max_blocks: z.number().optional(),
|
|
106
155
|
previewable: z.boolean().optional(),
|
|
107
|
-
presets: z.array(SectionPreset).optional()
|
|
156
|
+
presets: z.array(SectionPreset).optional(),
|
|
157
|
+
provides: Provides.optional()
|
|
108
158
|
}).passthrough();
|
|
109
159
|
const TemplateBlock = z.lazy(() => z.object({
|
|
110
160
|
type: z.string(),
|
|
@@ -115,7 +165,11 @@ const TemplateBlock = z.lazy(() => z.object({
|
|
|
115
165
|
customName: z.string().optional(),
|
|
116
166
|
custom_css: z.string().optional(),
|
|
117
167
|
blocks: z.record(z.string(), TemplateBlock).optional(),
|
|
118
|
-
block_order: z.array(z.string()).optional()
|
|
168
|
+
block_order: z.array(z.string()).optional(),
|
|
169
|
+
source: z.literal("app").optional(),
|
|
170
|
+
appId: z.string().optional(),
|
|
171
|
+
tag: z.string().optional(),
|
|
172
|
+
scriptUrl: z.string().optional()
|
|
119
173
|
}).passthrough());
|
|
120
174
|
const TemplateSection = z.object({
|
|
121
175
|
type: z.string(),
|
|
@@ -151,4 +205,4 @@ const SectionGroup = z.object({
|
|
|
151
205
|
order: z.array(z.string()).default([])
|
|
152
206
|
}).passthrough();
|
|
153
207
|
//#endregion
|
|
154
|
-
export { BlockDefinition, BlockSchema, SchemaSetting, SectionGroup, SectionPreset, SectionSchema, SettingBinding, SettingBindings, SettingsData, SettingsSchema, SettingsSchemaSection, Template, TemplateBlock, TemplateSection };
|
|
208
|
+
export { BlockDefinition, BlockSchema, CLOSEST_RESOURCES, ClosestResource, ProviderDecl, Provides, SchemaSetting, SectionGroup, SectionPreset, SectionSchema, SettingBinding, SettingBindings, SettingsData, SettingsSchema, SettingsSchemaSection, THEME_FED, Template, TemplateBlock, TemplateSection };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/section-scope.d.ts
|
|
2
|
+
type SectionPlacement = {
|
|
3
|
+
enabled_on?: {
|
|
4
|
+
groups?: string[];
|
|
5
|
+
templates?: string[];
|
|
6
|
+
};
|
|
7
|
+
disabled_on?: {
|
|
8
|
+
groups?: string[];
|
|
9
|
+
templates?: string[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare function templateMatches(pattern: string, id: string): boolean;
|
|
13
|
+
export declare function isSectionEnabledOnTemplate(schema: SectionPlacement, templateId: string): boolean;
|
|
14
|
+
export declare function isSectionAddableInGroup(schema: SectionPlacement, groupType: string): boolean;
|
|
15
|
+
export declare function isSectionAllowedInGroup(schema: SectionPlacement, groupType: string): boolean;
|
|
16
|
+
//#endregion
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/section-scope.ts
|
|
2
|
+
function templateMatches(pattern, id) {
|
|
3
|
+
return pattern.endsWith(".*") ? id.startsWith(pattern.slice(0, -1)) : pattern === id;
|
|
4
|
+
}
|
|
5
|
+
function isSectionEnabledOnTemplate(schema, templateId) {
|
|
6
|
+
if (schema.enabled_on?.groups?.length) return false;
|
|
7
|
+
if (schema.disabled_on?.templates?.includes("*")) return false;
|
|
8
|
+
if (schema.enabled_on?.templates?.length) return schema.enabled_on.templates.some((pattern) => templateMatches(pattern, templateId));
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
function isSectionAddableInGroup(schema, groupType) {
|
|
12
|
+
return schema.enabled_on?.groups?.includes(groupType) ?? false;
|
|
13
|
+
}
|
|
14
|
+
function isSectionAllowedInGroup(schema, groupType) {
|
|
15
|
+
const disabledGroups = schema.disabled_on?.groups;
|
|
16
|
+
if (disabledGroups?.includes("*") || disabledGroups?.includes(groupType)) return false;
|
|
17
|
+
if (schema.enabled_on?.groups?.length) return schema.enabled_on.groups.includes(groupType);
|
|
18
|
+
if (schema.enabled_on?.templates?.length) return false;
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { isSectionAddableInGroup, isSectionAllowedInGroup, isSectionEnabledOnTemplate, templateMatches };
|
package/dist/store-path.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
//#region src/store-path.d.ts
|
|
2
2
|
export declare const STORE_SLUG_RE: RegExp;
|
|
3
3
|
export declare const INSTALL_ID_RE: RegExp;
|
|
4
|
+
/** Hash field marking an orchestrator draft hash as seeded, so an install with
|
|
5
|
+
* zero templates or groups still has the key. Never a template id or group type. */
|
|
6
|
+
export declare const DRAFT_SEEDED_KEY = "__seeded";
|
|
7
|
+
/**
|
|
8
|
+
* True unless `id` is safe as one file name under a config dir (template,
|
|
9
|
+
* section group, layout). It is joined into a disk path, so `..` and
|
|
10
|
+
* separators must never pass.
|
|
11
|
+
*/
|
|
12
|
+
export declare function invalidTemplateId(id: string | undefined): boolean;
|
|
4
13
|
//#endregion
|
package/dist/store-path.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
//#region src/store-path.ts
|
|
2
2
|
const STORE_SLUG_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
3
3
|
const INSTALL_ID_RE = /^[a-z0-9_-]{4,32}$/;
|
|
4
|
+
/** Hash field marking an orchestrator draft hash as seeded, so an install with
|
|
5
|
+
* zero templates or groups still has the key. Never a template id or group type. */
|
|
6
|
+
const DRAFT_SEEDED_KEY = "__seeded";
|
|
7
|
+
const TEMPLATE_ID_RE = /^[A-Za-z0-9_.-]+$/;
|
|
8
|
+
/**
|
|
9
|
+
* True unless `id` is safe as one file name under a config dir (template,
|
|
10
|
+
* section group, layout). It is joined into a disk path, so `..` and
|
|
11
|
+
* separators must never pass.
|
|
12
|
+
*/
|
|
13
|
+
function invalidTemplateId(id) {
|
|
14
|
+
return !id || !TEMPLATE_ID_RE.test(id) || /[/\\]|\.\./.test(id);
|
|
15
|
+
}
|
|
4
16
|
//#endregion
|
|
5
|
-
export { INSTALL_ID_RE, STORE_SLUG_RE };
|
|
17
|
+
export { DRAFT_SEEDED_KEY, INSTALL_ID_RE, STORE_SLUG_RE, invalidTemplateId };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/template-limits.d.ts
|
|
2
|
+
export declare const MAX_SECTIONS_PER_TEMPLATE = 25;
|
|
3
|
+
export declare const MAX_BLOCKS_PER_TEMPLATE = 1250;
|
|
4
|
+
export declare const MAX_BLOCK_NESTING_DEPTH = 8;
|
|
5
|
+
/** One template or section group, as compact JSON. The largest a shipped
|
|
6
|
+
* theme has is ~60 KB; a template at the block cap is ~250–500 KB. */
|
|
7
|
+
export declare const MAX_ENTRY_BYTES: number;
|
|
8
|
+
/** The blocks under `node` (a section or a block), at every depth. */
|
|
9
|
+
export declare function countNestedBlocks(node: unknown): number;
|
|
10
|
+
/** A template's or section group's sections (its `order`, as the editor
|
|
11
|
+
* counts them) and its blocks across every section. Both are
|
|
12
|
+
* `{sections, order}` documents. */
|
|
13
|
+
export declare function templateCounts(entry: unknown): {
|
|
14
|
+
sections: number;
|
|
15
|
+
blocks: number;
|
|
16
|
+
};
|
|
17
|
+
/** The deepest block level in a template or section group, as the editor
|
|
18
|
+
* counts it against `MAX_BLOCK_NESTING_DEPTH`: a block directly in a section
|
|
19
|
+
* is level 1, a section with no blocks is 0. */
|
|
20
|
+
export declare function maxBlockDepth(entry: unknown): number;
|
|
21
|
+
export declare function countBlocksInBlock(block: unknown): number;
|
|
22
|
+
/** 1-indexed depth of the deepest descendant within `block` (the block itself
|
|
23
|
+
* counts as 1). Prices a subtree about to be inserted against the nesting cap. */
|
|
24
|
+
export declare function maxDepthOfBlock(block: {
|
|
25
|
+
blocks?: Record<string, unknown>;
|
|
26
|
+
}): number;
|
|
27
|
+
export declare function maxDepthOfBlockSchema(blockType: string, blockSchemas: readonly {
|
|
28
|
+
type?: string;
|
|
29
|
+
blocks?: {
|
|
30
|
+
type: string;
|
|
31
|
+
static?: boolean;
|
|
32
|
+
}[];
|
|
33
|
+
}[], remaining?: number): number;
|
|
34
|
+
//#endregion
|