@usethrottle/builder-schema 0.1.0 → 0.1.2
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/__tests__/fixtures/parity/01-hero-boxed.json +68 -0
- package/__tests__/fixtures/parity/02-full-bleed-image-hero.json +61 -0
- package/__tests__/fixtures/parity/03-two-columns-50-50.json +66 -0
- package/__tests__/fixtures/parity/04-three-columns-phone-widths.json +87 -0
- package/__tests__/fixtures/parity/05-four-columns-tablet-two-by-two.json +108 -0
- package/__tests__/fixtures/parity/06-inner-section-in-column.json +101 -0
- package/__tests__/fixtures/parity/07-hidden-on-phone.json +47 -0
- package/__tests__/fixtures/parity/08-device-specific-text-and-size.json +46 -0
- package/__tests__/fixtures/parity/09-every-basic-widget.json +100 -0
- package/__tests__/fixtures/parity/10-header-part.json +87 -0
- package/__tests__/fixtures/parity/11-footer-part.json +105 -0
- package/__tests__/fixtures/parity/12-announcement-bar.json +34 -0
- package/__tests__/fixtures/parity/13-product-slot-context.json +69 -0
- package/__tests__/fixtures/parity/14-published-snapshot-with-assets-and-custom-widget.json +84 -0
- package/__tests__/fixtures/parity/15-empty-document.json +4 -0
- package/__tests__/fixtures/parity/16-product-grid-and-featured.json +140 -0
- package/__tests__/fixtures/parity/17-collection-shelf-and-categories.json +153 -0
- package/__tests__/fixtures/parity/18-search-switches-and-greeting.json +80 -0
- package/__tests__/fixtures/parity/19-shop-slot-context.json +42 -0
- package/dist/index.cjs +240 -225
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +240 -225
- package/package.json +8 -3
package/dist/index.d.cts
CHANGED
|
@@ -3619,9 +3619,17 @@ declare const BASIC_WIDGET_DEFINITIONS: WidgetDefinition[];
|
|
|
3619
3619
|
|
|
3620
3620
|
/** Where a document lives. A part or slot may refuse some widgets. */
|
|
3621
3621
|
type DocumentKind = 'page' | 'part:header' | 'part:footer' | 'slot';
|
|
3622
|
+
/** What a slot point hands to the widgets in its document (`SlotPoint.context` of a pack). */
|
|
3623
|
+
type SlotContext = 'product' | 'listing' | 'none';
|
|
3622
3624
|
type OpContext = {
|
|
3623
3625
|
registry: WidgetRegistry;
|
|
3624
3626
|
documentKind: DocumentKind;
|
|
3627
|
+
/**
|
|
3628
|
+
* For a slot document: the context its slot key gives (`product.below` gives
|
|
3629
|
+
* `product`, `shop.below` gives `listing`). A `context.*` binding must name it.
|
|
3630
|
+
* Left out, a context binding is not checked against the slot.
|
|
3631
|
+
*/
|
|
3632
|
+
slotContext?: SlotContext;
|
|
3625
3633
|
/** Data source ids the merchant has enabled (a source is also known to the registry). */
|
|
3626
3634
|
enabledSources: ReadonlySet<string>;
|
|
3627
3635
|
};
|
|
@@ -4089,4 +4097,4 @@ type ValidateCustomWidgetResult = {
|
|
|
4089
4097
|
*/
|
|
4090
4098
|
declare function validateCustomWidget(def: unknown, registry: WidgetRegistry): ValidateCustomWidgetResult;
|
|
4091
4099
|
|
|
4092
|
-
export { AGENT_MAX_OPS, ALLOWED_ATTRS, ALLOWED_ELEMENTS, ALLOWED_ROLES, ANCHOR_RE, type AllowedElement, type AnyNode, type ApplyResult, type AttrPart, BASIC_WIDGET_DEFINITIONS, BIDI_CONTROL_RE, BREAKPOINTS, CATALOG_STRING_KEYS, CLASS_TOKEN_RE, COLOR_VALUE_RE, COMMON_SETTING_KEYS, COMMON_WIDGET_SETTINGS, CSS_CONTROLS, CURRENT_SCHEMA_VERSION, type CatalogStringKey, type ColumnNode, type ColumnProps, type CompositeDefinition, type CustomWidgetDefinition, type CustomWidgetSnapshot, DATA_ATTR_RE, DATA_RESULT_TYPES, type DataBinding, type DataInputDefinition, type DataResultType, type DataSourceDescriptor, type DocOp, type DocOpDevice, type DocumentKind, EACH_ITERATION_CAP, type EachNode, type ElementAttr, type ElementNode, type FieldSpec, type Filter, type FrozenAsset, ISSUE_CODES, type IconName, type IfNode, type InnerColumnNode, type InnerSectionNode, type Issue, type IssueCode, LIMITS, LOCALE_TAG_RE, type LocalizedText, MAX_ISSUES, MAX_TEMPLATE_WEIGHT, type MenuItem, type MenuTarget, NODE_ID_RE, type NodeId, type OpContext, type OutputNode, type Overrides, PREVIEW_WIDTHS, type PageDocument, type ParentId, type ParseTemplateResult, type PathSegment, type Placement, type PlacementCode, RESERVED_CLASS_PREFIXES, RESERVED_DATA_PREFIX, type ResponsiveDevice, SAFE_HREF, SETTING_CONTROLS, SETTING_TABS, SITE_ASSET_PATHS, SITE_FONTS, SITE_FONT_FAMILIES, SITE_SETTINGS_SCHEMA_VERSION, SITE_STRING_DEFAULTS, SITE_STRING_KEYS, SITE_STRING_NAMESPACES, SPACING_TOKENS, type SafeUrlKind, type SanitizeCssResult, type SectionNode, type SectionProps, type SettingField, type SettingValue, type SiteFont, type SiteFontCategory, type SiteFontFamily, type SitePalette, type SiteSettings, type SiteSettingsInput, type SiteStringKey, TEMPLATE_FILTERS, THROTTLE_PK_RE, type TemplateAst, type TemplateContext, type TemplateDefinition, type TemplateFilterName, type TemplateNode, type TextNode, type UnlessNode, type UpgradeResult, VOID_ELEMENTS, type ValidateCustomWidgetResult, WIDGET_GROUPS, WIDGET_TYPE_RE, type WidgetDefinition, type WidgetMigration, type WidgetNode, type WidgetRegistry, type WidgetType, agentDocOpSchema, agentDocOpsSchema, applyOps, assetIdSchema, canPlace, capIssues, checkLimits, checkTopLevel, checkWidgetPart, colorValueSchema, columnPropsSchema, createRegistry, customWidgetSnapshotSchema, dataBindingSchema, dataSourceDescriptorSchema, defaultSiteSettings, docOpSchema, emptyDocument, fieldSpecSchema, formatPath, frozenAssetSchema, innerSectionNodeSchema, invertOps, isReservedClass, isSettingValue, localeTagSchema, localizedTextSchema, makeIssue, menuItemSchema, menuTargetSchema, newNodeId, nodeIdSchema, pageDocumentSchema, parseTemplate, resolveColumnProps, resolveColumnWidths, resolveResponsive, safeUrl, sanitizeWidgetCss, sectionNodeSchema, sectionPropsSchema, settingFieldSchema, settingValueSchema, siteSettingsSchema, spacingValueSchema, templateWeight, upgradeDocument, upgradeNodes, utf8Length, validateCustomWidget, validateDocument, validateSettingValue, validateTemplate, validateWidgetProps, walkNodes, widgetDefinitionSchema, widgetNodeSchema, wrapColumnRows, zodIssues };
|
|
4100
|
+
export { AGENT_MAX_OPS, ALLOWED_ATTRS, ALLOWED_ELEMENTS, ALLOWED_ROLES, ANCHOR_RE, type AllowedElement, type AnyNode, type ApplyResult, type AttrPart, BASIC_WIDGET_DEFINITIONS, BIDI_CONTROL_RE, BREAKPOINTS, CATALOG_STRING_KEYS, CLASS_TOKEN_RE, COLOR_VALUE_RE, COMMON_SETTING_KEYS, COMMON_WIDGET_SETTINGS, CSS_CONTROLS, CURRENT_SCHEMA_VERSION, type CatalogStringKey, type ColumnNode, type ColumnProps, type CompositeDefinition, type CustomWidgetDefinition, type CustomWidgetSnapshot, DATA_ATTR_RE, DATA_RESULT_TYPES, type DataBinding, type DataInputDefinition, type DataResultType, type DataSourceDescriptor, type DocOp, type DocOpDevice, type DocumentKind, EACH_ITERATION_CAP, type EachNode, type ElementAttr, type ElementNode, type FieldSpec, type Filter, type FrozenAsset, ISSUE_CODES, type IconName, type IfNode, type InnerColumnNode, type InnerSectionNode, type Issue, type IssueCode, LIMITS, LOCALE_TAG_RE, type LocalizedText, MAX_ISSUES, MAX_TEMPLATE_WEIGHT, type MenuItem, type MenuTarget, NODE_ID_RE, type NodeId, type OpContext, type OutputNode, type Overrides, PREVIEW_WIDTHS, type PageDocument, type ParentId, type ParseTemplateResult, type PathSegment, type Placement, type PlacementCode, RESERVED_CLASS_PREFIXES, RESERVED_DATA_PREFIX, type ResponsiveDevice, SAFE_HREF, SETTING_CONTROLS, SETTING_TABS, SITE_ASSET_PATHS, SITE_FONTS, SITE_FONT_FAMILIES, SITE_SETTINGS_SCHEMA_VERSION, SITE_STRING_DEFAULTS, SITE_STRING_KEYS, SITE_STRING_NAMESPACES, SPACING_TOKENS, type SafeUrlKind, type SanitizeCssResult, type SectionNode, type SectionProps, type SettingField, type SettingValue, type SiteFont, type SiteFontCategory, type SiteFontFamily, type SitePalette, type SiteSettings, type SiteSettingsInput, type SiteStringKey, type SlotContext, TEMPLATE_FILTERS, THROTTLE_PK_RE, type TemplateAst, type TemplateContext, type TemplateDefinition, type TemplateFilterName, type TemplateNode, type TextNode, type UnlessNode, type UpgradeResult, VOID_ELEMENTS, type ValidateCustomWidgetResult, WIDGET_GROUPS, WIDGET_TYPE_RE, type WidgetDefinition, type WidgetMigration, type WidgetNode, type WidgetRegistry, type WidgetType, agentDocOpSchema, agentDocOpsSchema, applyOps, assetIdSchema, canPlace, capIssues, checkLimits, checkTopLevel, checkWidgetPart, colorValueSchema, columnPropsSchema, createRegistry, customWidgetSnapshotSchema, dataBindingSchema, dataSourceDescriptorSchema, defaultSiteSettings, docOpSchema, emptyDocument, fieldSpecSchema, formatPath, frozenAssetSchema, innerSectionNodeSchema, invertOps, isReservedClass, isSettingValue, localeTagSchema, localizedTextSchema, makeIssue, menuItemSchema, menuTargetSchema, newNodeId, nodeIdSchema, pageDocumentSchema, parseTemplate, resolveColumnProps, resolveColumnWidths, resolveResponsive, safeUrl, sanitizeWidgetCss, sectionNodeSchema, sectionPropsSchema, settingFieldSchema, settingValueSchema, siteSettingsSchema, spacingValueSchema, templateWeight, upgradeDocument, upgradeNodes, utf8Length, validateCustomWidget, validateDocument, validateSettingValue, validateTemplate, validateWidgetProps, walkNodes, widgetDefinitionSchema, widgetNodeSchema, wrapColumnRows, zodIssues };
|
package/dist/index.d.ts
CHANGED
|
@@ -3619,9 +3619,17 @@ declare const BASIC_WIDGET_DEFINITIONS: WidgetDefinition[];
|
|
|
3619
3619
|
|
|
3620
3620
|
/** Where a document lives. A part or slot may refuse some widgets. */
|
|
3621
3621
|
type DocumentKind = 'page' | 'part:header' | 'part:footer' | 'slot';
|
|
3622
|
+
/** What a slot point hands to the widgets in its document (`SlotPoint.context` of a pack). */
|
|
3623
|
+
type SlotContext = 'product' | 'listing' | 'none';
|
|
3622
3624
|
type OpContext = {
|
|
3623
3625
|
registry: WidgetRegistry;
|
|
3624
3626
|
documentKind: DocumentKind;
|
|
3627
|
+
/**
|
|
3628
|
+
* For a slot document: the context its slot key gives (`product.below` gives
|
|
3629
|
+
* `product`, `shop.below` gives `listing`). A `context.*` binding must name it.
|
|
3630
|
+
* Left out, a context binding is not checked against the slot.
|
|
3631
|
+
*/
|
|
3632
|
+
slotContext?: SlotContext;
|
|
3625
3633
|
/** Data source ids the merchant has enabled (a source is also known to the registry). */
|
|
3626
3634
|
enabledSources: ReadonlySet<string>;
|
|
3627
3635
|
};
|
|
@@ -4089,4 +4097,4 @@ type ValidateCustomWidgetResult = {
|
|
|
4089
4097
|
*/
|
|
4090
4098
|
declare function validateCustomWidget(def: unknown, registry: WidgetRegistry): ValidateCustomWidgetResult;
|
|
4091
4099
|
|
|
4092
|
-
export { AGENT_MAX_OPS, ALLOWED_ATTRS, ALLOWED_ELEMENTS, ALLOWED_ROLES, ANCHOR_RE, type AllowedElement, type AnyNode, type ApplyResult, type AttrPart, BASIC_WIDGET_DEFINITIONS, BIDI_CONTROL_RE, BREAKPOINTS, CATALOG_STRING_KEYS, CLASS_TOKEN_RE, COLOR_VALUE_RE, COMMON_SETTING_KEYS, COMMON_WIDGET_SETTINGS, CSS_CONTROLS, CURRENT_SCHEMA_VERSION, type CatalogStringKey, type ColumnNode, type ColumnProps, type CompositeDefinition, type CustomWidgetDefinition, type CustomWidgetSnapshot, DATA_ATTR_RE, DATA_RESULT_TYPES, type DataBinding, type DataInputDefinition, type DataResultType, type DataSourceDescriptor, type DocOp, type DocOpDevice, type DocumentKind, EACH_ITERATION_CAP, type EachNode, type ElementAttr, type ElementNode, type FieldSpec, type Filter, type FrozenAsset, ISSUE_CODES, type IconName, type IfNode, type InnerColumnNode, type InnerSectionNode, type Issue, type IssueCode, LIMITS, LOCALE_TAG_RE, type LocalizedText, MAX_ISSUES, MAX_TEMPLATE_WEIGHT, type MenuItem, type MenuTarget, NODE_ID_RE, type NodeId, type OpContext, type OutputNode, type Overrides, PREVIEW_WIDTHS, type PageDocument, type ParentId, type ParseTemplateResult, type PathSegment, type Placement, type PlacementCode, RESERVED_CLASS_PREFIXES, RESERVED_DATA_PREFIX, type ResponsiveDevice, SAFE_HREF, SETTING_CONTROLS, SETTING_TABS, SITE_ASSET_PATHS, SITE_FONTS, SITE_FONT_FAMILIES, SITE_SETTINGS_SCHEMA_VERSION, SITE_STRING_DEFAULTS, SITE_STRING_KEYS, SITE_STRING_NAMESPACES, SPACING_TOKENS, type SafeUrlKind, type SanitizeCssResult, type SectionNode, type SectionProps, type SettingField, type SettingValue, type SiteFont, type SiteFontCategory, type SiteFontFamily, type SitePalette, type SiteSettings, type SiteSettingsInput, type SiteStringKey, TEMPLATE_FILTERS, THROTTLE_PK_RE, type TemplateAst, type TemplateContext, type TemplateDefinition, type TemplateFilterName, type TemplateNode, type TextNode, type UnlessNode, type UpgradeResult, VOID_ELEMENTS, type ValidateCustomWidgetResult, WIDGET_GROUPS, WIDGET_TYPE_RE, type WidgetDefinition, type WidgetMigration, type WidgetNode, type WidgetRegistry, type WidgetType, agentDocOpSchema, agentDocOpsSchema, applyOps, assetIdSchema, canPlace, capIssues, checkLimits, checkTopLevel, checkWidgetPart, colorValueSchema, columnPropsSchema, createRegistry, customWidgetSnapshotSchema, dataBindingSchema, dataSourceDescriptorSchema, defaultSiteSettings, docOpSchema, emptyDocument, fieldSpecSchema, formatPath, frozenAssetSchema, innerSectionNodeSchema, invertOps, isReservedClass, isSettingValue, localeTagSchema, localizedTextSchema, makeIssue, menuItemSchema, menuTargetSchema, newNodeId, nodeIdSchema, pageDocumentSchema, parseTemplate, resolveColumnProps, resolveColumnWidths, resolveResponsive, safeUrl, sanitizeWidgetCss, sectionNodeSchema, sectionPropsSchema, settingFieldSchema, settingValueSchema, siteSettingsSchema, spacingValueSchema, templateWeight, upgradeDocument, upgradeNodes, utf8Length, validateCustomWidget, validateDocument, validateSettingValue, validateTemplate, validateWidgetProps, walkNodes, widgetDefinitionSchema, widgetNodeSchema, wrapColumnRows, zodIssues };
|
|
4100
|
+
export { AGENT_MAX_OPS, ALLOWED_ATTRS, ALLOWED_ELEMENTS, ALLOWED_ROLES, ANCHOR_RE, type AllowedElement, type AnyNode, type ApplyResult, type AttrPart, BASIC_WIDGET_DEFINITIONS, BIDI_CONTROL_RE, BREAKPOINTS, CATALOG_STRING_KEYS, CLASS_TOKEN_RE, COLOR_VALUE_RE, COMMON_SETTING_KEYS, COMMON_WIDGET_SETTINGS, CSS_CONTROLS, CURRENT_SCHEMA_VERSION, type CatalogStringKey, type ColumnNode, type ColumnProps, type CompositeDefinition, type CustomWidgetDefinition, type CustomWidgetSnapshot, DATA_ATTR_RE, DATA_RESULT_TYPES, type DataBinding, type DataInputDefinition, type DataResultType, type DataSourceDescriptor, type DocOp, type DocOpDevice, type DocumentKind, EACH_ITERATION_CAP, type EachNode, type ElementAttr, type ElementNode, type FieldSpec, type Filter, type FrozenAsset, ISSUE_CODES, type IconName, type IfNode, type InnerColumnNode, type InnerSectionNode, type Issue, type IssueCode, LIMITS, LOCALE_TAG_RE, type LocalizedText, MAX_ISSUES, MAX_TEMPLATE_WEIGHT, type MenuItem, type MenuTarget, NODE_ID_RE, type NodeId, type OpContext, type OutputNode, type Overrides, PREVIEW_WIDTHS, type PageDocument, type ParentId, type ParseTemplateResult, type PathSegment, type Placement, type PlacementCode, RESERVED_CLASS_PREFIXES, RESERVED_DATA_PREFIX, type ResponsiveDevice, SAFE_HREF, SETTING_CONTROLS, SETTING_TABS, SITE_ASSET_PATHS, SITE_FONTS, SITE_FONT_FAMILIES, SITE_SETTINGS_SCHEMA_VERSION, SITE_STRING_DEFAULTS, SITE_STRING_KEYS, SITE_STRING_NAMESPACES, SPACING_TOKENS, type SafeUrlKind, type SanitizeCssResult, type SectionNode, type SectionProps, type SettingField, type SettingValue, type SiteFont, type SiteFontCategory, type SiteFontFamily, type SitePalette, type SiteSettings, type SiteSettingsInput, type SiteStringKey, type SlotContext, TEMPLATE_FILTERS, THROTTLE_PK_RE, type TemplateAst, type TemplateContext, type TemplateDefinition, type TemplateFilterName, type TemplateNode, type TextNode, type UnlessNode, type UpgradeResult, VOID_ELEMENTS, type ValidateCustomWidgetResult, WIDGET_GROUPS, WIDGET_TYPE_RE, type WidgetDefinition, type WidgetMigration, type WidgetNode, type WidgetRegistry, type WidgetType, agentDocOpSchema, agentDocOpsSchema, applyOps, assetIdSchema, canPlace, capIssues, checkLimits, checkTopLevel, checkWidgetPart, colorValueSchema, columnPropsSchema, createRegistry, customWidgetSnapshotSchema, dataBindingSchema, dataSourceDescriptorSchema, defaultSiteSettings, docOpSchema, emptyDocument, fieldSpecSchema, formatPath, frozenAssetSchema, innerSectionNodeSchema, invertOps, isReservedClass, isSettingValue, localeTagSchema, localizedTextSchema, makeIssue, menuItemSchema, menuTargetSchema, newNodeId, nodeIdSchema, pageDocumentSchema, parseTemplate, resolveColumnProps, resolveColumnWidths, resolveResponsive, safeUrl, sanitizeWidgetCss, sectionNodeSchema, sectionPropsSchema, settingFieldSchema, settingValueSchema, siteSettingsSchema, spacingValueSchema, templateWeight, upgradeDocument, upgradeNodes, utf8Length, validateCustomWidget, validateDocument, validateSettingValue, validateTemplate, validateWidgetProps, walkNodes, widgetDefinitionSchema, widgetNodeSchema, wrapColumnRows, zodIssues };
|