@bettercms-ai/types 1.52.0 → 1.53.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/index.d.ts +106 -3
- package/dist/index.js +135 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4007,8 +4007,14 @@ declare function planSections<B>(slots: readonly string[], blocks: readonly B[]
|
|
|
4007
4007
|
* side and stored on the other (kit-facet-table.v3.md, "Carriers" and "Corpus floor").
|
|
4008
4008
|
*/
|
|
4009
4009
|
|
|
4010
|
-
/** Tabs on one screen: a model's `fieldsets kind:"tab"` and a component's prop tabs alike. */
|
|
4010
|
+
/** Tabs on one screen, the V2 target: a model's `fieldsets kind:"tab"` and a component's prop tabs alike. */
|
|
4011
4011
|
declare const TAB_MAX = 8;
|
|
4012
|
+
/**
|
|
4013
|
+
* The model tab bound prod accepts TODAY (src/lib/content/dock-vocabulary.ts TAB_MAX): the
|
|
4014
|
+
* dashboard renders 3 tabs on a model screen. It rises to TAB_MAX when the dashboard renders 8
|
|
4015
|
+
* (facet table row 7, F12). Component prop tabs are at TAB_MAX already.
|
|
4016
|
+
*/
|
|
4017
|
+
declare const TAB_MAX_RENDERABLE_NOW = 3;
|
|
4012
4018
|
/** `ui.control:"segmented"`: the option count it stores. V2's 3 is a render-fit rule, not this. */
|
|
4013
4019
|
declare const SEGMENTED_MIN = 2;
|
|
4014
4020
|
declare const SEGMENTED_MAX = 8;
|
|
@@ -4101,7 +4107,7 @@ type DefSources = Partial<Record<SourcedFacet, SchemaSource>>;
|
|
|
4101
4107
|
*/
|
|
4102
4108
|
declare const mayOverwrite: (stored: SchemaSource | undefined, incoming: SchemaSource) => boolean;
|
|
4103
4109
|
declare const UI_REFUSAL_CODES: {
|
|
4104
|
-
readonly schema: readonly ["facet_unclassified", "excluded_facet", "depth_exceeded", "validation_failed", "hash_mismatch", "shape_kind_mismatch", "block_field_unrenderable"];
|
|
4110
|
+
readonly schema: readonly ["facet_unclassified", "excluded_facet", "depth_exceeded", "validation_failed", "hash_mismatch", "non_finite_number", "shape_kind_mismatch", "block_field_unrenderable", "block_not_accepted", "derived_field", "feature_unknown"];
|
|
4105
4111
|
readonly build: readonly ["peer_missing", "kit_major_unsupported", "compile_error", "nondeterministic", "size_exceeded"];
|
|
4106
4112
|
readonly protocol: readonly ["unsupported", "handshake_timeout", "origin_mismatch", "write_denied"];
|
|
4107
4113
|
readonly runtime: readonly ["crashed", "blank", "csp_violation"];
|
|
@@ -4120,6 +4126,103 @@ type UiRefusal = {
|
|
|
4120
4126
|
/** `schema.depth_exceeded` */
|
|
4121
4127
|
declare const uiRefusalId: (r: UiRefusal) => string;
|
|
4122
4128
|
declare const isUiRefusal: (v: unknown) => v is UiRefusal;
|
|
4129
|
+
/** KEY_RESERVED, the API contract: `derived` (the Layout id prefix), `layout` and `page` (address prefixes). */
|
|
4130
|
+
declare const KEY_RESERVED: ReadonlySet<string>;
|
|
4131
|
+
/** The derive lane's minted-key bound: KEY_RESERVED and `id` (key-rules.ts RESERVED_KEYS). */
|
|
4132
|
+
declare const DERIVE_MINTED_RESERVED: ReadonlySet<string>;
|
|
4133
|
+
/** Keys that reach an object's prototype (safe-keys.ts FORBIDDEN_KEYS): also refused as KEY_RESERVED. */
|
|
4134
|
+
declare const KEY_FORBIDDEN: ReadonlySet<string>;
|
|
4135
|
+
/** A key with this lead is the platform's too (`_type`, `_key`, `_variant`): KEY_RESERVED. */
|
|
4136
|
+
declare const KEY_RESERVED_PREFIX = "_";
|
|
4137
|
+
/** KEY_FORMAT: a stored field key is a letter, then letters, digits, `-` and `_` (key-rules.ts API_KEY). */
|
|
4138
|
+
declare const KEY_FORMAT: RegExp;
|
|
4139
|
+
/** Whether the API refuses a key as KEY_RESERVED (content.ts keyRuleProblem). */
|
|
4140
|
+
declare const isReservedKey: (key: string) => boolean;
|
|
4141
|
+
/** Whether the derive lane may not mint a key (key-rules.ts isReservedKey): the API's words and `id`. */
|
|
4142
|
+
declare const isDeriveReservedKey: (key: string) => boolean;
|
|
4143
|
+
/**
|
|
4144
|
+
* A primitive `array` (`config.itemType`): the item types it may list, the only config keys it may
|
|
4145
|
+
* hold, and the item types an array with `zones` may not name (a list of values holds no rows).
|
|
4146
|
+
* `minItems ≤ maxItems`, and both bound the primitive list only (beside `itemType`).
|
|
4147
|
+
* src/lib/validation/schemas/content.ts ARRAY_ITEM_TYPES / PRIMITIVE_ARRAY_CONFIG_KEYS, in their order.
|
|
4148
|
+
*/
|
|
4149
|
+
declare const PRIMITIVE_ARRAY_RULE: {
|
|
4150
|
+
readonly itemTypes: readonly ["text", "number", "date", "image", "link", "richtext"];
|
|
4151
|
+
readonly configKeys: readonly ["itemType", "minItems", "maxItems", "aliases"];
|
|
4152
|
+
readonly notWithZones: readonly ["image", "link", "richtext"];
|
|
4153
|
+
};
|
|
4123
4154
|
declare function canonicalJson(value: unknown): string;
|
|
4155
|
+
/**
|
|
4156
|
+
* The definition a table's `schema_hash` is taken over: what a dock UI is built against. Names,
|
|
4157
|
+
* slugs and list chrome are not in it. Migration 0503's schema_hash_clear_when_stale triggers clear
|
|
4158
|
+
* the hash when exactly these change.
|
|
4159
|
+
*/
|
|
4160
|
+
declare const SCHEMA_HASH_INPUTS: {
|
|
4161
|
+
readonly components: readonly ["props", "tabs", "v2"];
|
|
4162
|
+
readonly content_models: readonly ["fields", "fieldsets", "v2"];
|
|
4163
|
+
readonly component_variant_groups: readonly ["canonicalInputs", "v2"];
|
|
4164
|
+
};
|
|
4165
|
+
type SchemaHashTable = keyof typeof SCHEMA_HASH_INPUTS;
|
|
4166
|
+
/**
|
|
4167
|
+
* What `canonicalJson` hashes for one definition: exactly its table's inputs, so an unset key and a
|
|
4168
|
+
* cleared one hash alike. `schema_hash` = "v1:" + sha256 hex of `canonicalJson(schemaHashInput(…))`.
|
|
4169
|
+
*/
|
|
4170
|
+
declare function schemaHashInput(table: SchemaHashTable, def: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
4171
|
+
|
|
4172
|
+
/**
|
|
4173
|
+
* The rich-text features vocabulary: every name a field's `config.features` may carry.
|
|
4174
|
+
*
|
|
4175
|
+
* It is the ONE gate. What a field accepts (the sanitiser's elements, the Portable Text schema)
|
|
4176
|
+
* is derived from it by @bettercms-ai/richtext `acceptFor`, never stored beside it. Pure and
|
|
4177
|
+
* dependency-free, so richtext, the kit and the backend validation read the same list and the
|
|
4178
|
+
* same alias rule, and none of them keeps a copy.
|
|
4179
|
+
*/
|
|
4180
|
+
|
|
4181
|
+
/** The always-on inline marks, Lexical-era names kept as written (richtext ALWAYS_ON_FEATURES). */
|
|
4182
|
+
declare const RICHTEXT_MARK_FEATURES: readonly ["bold", "italic", "underline", "strikethrough", "code", "highlight"];
|
|
4183
|
+
/** The toggleable capabilities stored configs already name, in their order (richtext TOGGLEABLE_FEATURES). */
|
|
4184
|
+
declare const RICHTEXT_TOGGLE_FEATURES: readonly ["headings", "blockquote", "horizontalRule", "orderedList", "unorderedList", "checklist", "link", "internalLink", "inlineImage", "videoEmbed", "codeBlock", "table", "columns"];
|
|
4185
|
+
/** One feature per heading level, so a field can allow h2 and h3 without h1. */
|
|
4186
|
+
declare const RICHTEXT_HEADING_FEATURES: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
4187
|
+
/**
|
|
4188
|
+
* The V2 blocks the RT steps build. With `checklist` and `columns` above, these are the nine.
|
|
4189
|
+
* `embed` is the third-party providers (X, CodePen, Figma, Maps, Spotify, Podcasts, audio, Shape);
|
|
4190
|
+
* `videoEmbed` stays the video, so a field can take a video without taking an X post.
|
|
4191
|
+
*/
|
|
4192
|
+
declare const RICHTEXT_BLOCK_FEATURES: readonly ["gallery", "embed", "tableOfContents", "relatedPosts", "authorBio", "footnotes", "button"];
|
|
4193
|
+
/** Every name a stored config may carry, in vocabulary order. */
|
|
4194
|
+
declare const RICHTEXT_FEATURES: readonly ["bold", "italic", "underline", "strikethrough", "code", "highlight", "headings", "blockquote", "horizontalRule", "orderedList", "unorderedList", "checklist", "link", "internalLink", "inlineImage", "videoEmbed", "codeBlock", "table", "columns", "h1", "h2", "h3", "h4", "h5", "h6", "gallery", "embed", "tableOfContents", "relatedPosts", "authorBio", "footnotes", "button"];
|
|
4195
|
+
type RichTextFeature = (typeof RICHTEXT_FEATURES)[number];
|
|
4196
|
+
/**
|
|
4197
|
+
* Legacy names → the canonical features they mean. A read expands them, and a write stores the
|
|
4198
|
+
* expansion, so an alias never outlives the next save. `headings` was one Lexical switch for every
|
|
4199
|
+
* level; the audit (src, MCP, dashboard writers, 2026-10-24) found no other legacy name.
|
|
4200
|
+
*/
|
|
4201
|
+
declare const RICHTEXT_FEATURE_ALIASES: Record<string, readonly RichTextFeature[]>;
|
|
4202
|
+
/**
|
|
4203
|
+
* A stored or submitted feature list in canonical form: aliases expanded (and never returned),
|
|
4204
|
+
* duplicates dropped, VOCABULARY order, so two lists that mean the same thing are equal arrays.
|
|
4205
|
+
* `unknown` keeps each name the vocabulary does not hold, as written and once, so a reader can
|
|
4206
|
+
* log it and a writer can refuse it by name (`richtext.feature_unknown:<name>`).
|
|
4207
|
+
*/
|
|
4208
|
+
declare function normaliseRichTextFeatures(names: readonly string[]): {
|
|
4209
|
+
features: RichTextFeature[];
|
|
4210
|
+
unknown: string[];
|
|
4211
|
+
};
|
|
4212
|
+
/** The elements Prismic exposes (richtext CORE_ELEMENTS, in its order). */
|
|
4213
|
+
declare const RICHTEXT_CORE_ELEMENTS: readonly ["p", "pre", "h1", "h2", "h3", "h4", "h5", "h6", "b", "i", "link", "image", "code", "ul", "ol", "rtl"];
|
|
4214
|
+
/** What the platform does beyond Prismic (richtext ADVANCED_ELEMENTS, in its order). `embed` is the video. */
|
|
4215
|
+
declare const RICHTEXT_ADVANCED_ELEMENTS: readonly ["u", "mark", "s", "checklist", "table", "columns", "embed", "internalLink"];
|
|
4216
|
+
/** One element per new V2 block feature. `providerEmbed` is the `embed` feature's (the name `embed` is the video's). */
|
|
4217
|
+
declare const RICHTEXT_BLOCK_ELEMENTS: readonly ["gallery", "providerEmbed", "tableOfContents", "relatedPosts", "authorBio", "footnotes", "button"];
|
|
4218
|
+
declare const RICHTEXT_ELEMENTS: readonly ["p", "pre", "h1", "h2", "h3", "h4", "h5", "h6", "b", "i", "link", "image", "code", "ul", "ol", "rtl", "u", "mark", "s", "checklist", "table", "columns", "embed", "internalLink", "gallery", "providerEmbed", "tableOfContents", "relatedPosts", "authorBio", "footnotes", "button"];
|
|
4219
|
+
type RichTextElementName = (typeof RICHTEXT_ELEMENTS)[number];
|
|
4220
|
+
/** The rich-text refusals of the UiRefusal `schema` family. */
|
|
4221
|
+
type RichTextRefusalCode = "block_not_accepted" | "derived_field" | "feature_unknown";
|
|
4222
|
+
/**
|
|
4223
|
+
* One rich-text refusal, named the same way everywhere: `message` is `richtext.<code>:<detail>`
|
|
4224
|
+
* (a block's `_type`, a derived key, an unknown feature name), so a caller can show or match it.
|
|
4225
|
+
*/
|
|
4226
|
+
declare const richTextRefusal: (code: RichTextRefusalCode, detail: string) => UiRefusal;
|
|
4124
4227
|
|
|
4125
|
-
export { type AlignToken, type AllowRule, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BLOCK_BINDINGS, BLOCK_FIELD_TYPES, BLOCK_FIELD_TYPES_RENDERABLE_NOW, BODY_SCHEMA_ORIGINS, BREAKPOINTS, BUTTON_ACTIONS, BUTTON_FULL_WIDTH_INVALID, BUTTON_ICONS, BUTTON_ICON_NAMES, BUTTON_LOOK_KEYS, BUTTON_PLACEMENT_KEYS, BUTTON_SIZES, BUTTON_VARIANTS, type BetterCMSErrorCode, type BgToken, type BindingKind, type BlockBinding, type BlockHoverStyle, type BlockStyle, type BlockType, type BodySchema, type BodySchemaOrigin, type ButtonAction, type ButtonBlock, type ButtonIcon, type ButtonLinkCandidate, type ButtonLookKey, type ButtonProps, type ButtonSiteLook, type ButtonSizeName, type ButtonValue, type ButtonVariant, CANVAS_GESTURE_NAMES, CODE_SLOT_PREFIX, COMPONENT_PROP_TYPES, CONTROL_HELP, type CanonicalInputDefinition, type CanvasGesture, type ChoiceOption, type CollectionBlock, type CollectionFilter, type CollectionProps, type ColorToken, type ColumnsBlock, type ColumnsProps, type Component, type ComponentBlock, type ComponentCategory, type ComponentFormPropRef, type ComponentPreview, type ComponentPropDef, type ComponentPropType, type ComponentPropUi, type ComponentProps, type ComponentSubField, type ComponentTab, type ComponentV2, type ComponentVariantGroup, type Content, type ContentBlock, type ContentEntry, type ContentModel, type ContentModelField, type ContentModelFieldType, type ContentModelFieldUi, type ContentModelV2, type ContentPageResult, type ContentResponse, type ContentWidthToken, type ControlKind, type CornerToken, DEPTH_MAX, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, type DeepReadonly, type DefSources, type DeliveredLayout, type DeliveryComponent, type DeliveryEntry, type DeliveryEntrySeo, type DeliveryList, type DeliveryPage, type DerivedLocator, type DockBudget, type DockFieldLike, type DockFieldsetLike, type DockIconName, type DockInputRef, type DockLane, type DockNode, type DockPropGroupLike, type DockScreen, type ElementLike, type ExpandedBinding, FIELD_SIZE_ZOOM, FIELD_STYLE_KEYS, FOOTER_SECTION_ID, type FieldConfig, type FieldSize, type FieldStyle, type FieldStyleKey, type FieldStyles, type Fieldset, type FieldsetKind, type FieldsetUiBefore, type FontSizeToken, type FooterBlock, type FooterColumn, type FooterProps, type Form, type FormBlock, type FormField, type FormProps, type FormSubmission, HELP_CAPS, HELP_MAX, type HeadingBlock, type HeadingProps, IMAGE_ASPECTS, IMAGE_FRAME_RADIUS, type ImageAspect, type ImageBlock, type ImageProps, KIT_CATEGORIES, type KitCategory, LANDMARK_SELECTOR, LAYOUT_SECTION_ICONS, LAYOUT_SECTION_ICON_SET, LINK_RELS, LINK_VALUE_TYPES, LIST_ITEMS_CAP, LOCATOR_PATH, type LandmarkChainElement, type LandmarkElement, type LayoutComponentItem, type LayoutDataDocument, type LayoutFieldDefinition, type LayoutFieldItem, type LayoutFieldType, type LayoutScalarFieldType, type LayoutSection, type LayoutSectionIcon, type LayoutSectionItem, type LayoutStructureDocument, type LayoutZone, type LinkPairSibling, type LinkRel, type LinkValue, type LinkValueType, type LocatorGrammar, MAIN_SELECTOR, type ManagementLayoutCommand, type MediaAsset, type MediaCaptionTrack, type MediaFieldValue, NAVIGATION_SECTION_ID, type NavLink, type NavbarBlock, type NavbarProps, type NumberFieldFormat, type NumberScale, OPTION_DESCRIPTION_MAX, type OpenMode, PAGE_CONTENT_ANCHOR_ID, type Page, type PageLayoutOverrideDataDocument, type PageLayoutOverrideDocument, type PageLayoutOverrideState, type PageLayoutOverrideStructureDocument, type PageLayoutSectionOverride, type PageLayoutSectionStructureOverride, type PageMetaJson, type PageOnlyLayoutSection, type PageSectionPlacement, type PaginatedResult, type Perspective, type PortableTextDocument, type PortableTextNode, type PropGroup, type PropTab, RESPONSIVE_CSS, ROLE_HELP, ROLE_KEYS, type RadiusToken, type ReadButtonValue, type Redirect, type ReservedLayoutSection, type ResolvedLayoutNode, type RichTextBlock, type RichTextProps, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SEGMENTED_MAX, SEGMENTED_MIN, SIDE_SPACE_MIN_PX, SIDE_SPACE_TOKENS, SLOT_CHILD_KEYS, SLOT_ITEMS_CAP, SLOT_MAX_ITEMS, SLOT_SETTINGS_MAX, SLOT_SETTINGS_TYPES, SOURCE_RANK, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type ScaleUnit, type SchemaSource, type SectionBlock, type SectionPlanItem, type SectionProps, type SectionSpaceToken, type ShadowToken, type ShowIf, type ShowIfRule, type SignInInput, type SignUpInput, type SiteSeoDefaults, type SlideItem, type SliderBlock, type SliderProps, type SlotChild, type SlotItem, type SlotShapeOptions, type SlotShapeProblem, type SlotValue, type SourcedFacet, type SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, TABLE_COLUMN_TYPES, TABLE_JSONLD_TYPES, TABLE_LIMITS, TABLE_RESPONSIVE, TAB_MAX, TAG_HEADS, type TabItem, type TableCell, type TableCellObject, type TableCellValue, type TableCheckOptions, type TableColumn, type TableColumnType, type TableFieldOptions, type TableFootnote, type TableGroup, type TableLink, type TableProblem, type TableRef, type TableRefResolved, type TableRow, type TableValue, type TabsBlock, type TabsProps, type TextBlock, type TextProps, type ThemeToken, UI_REFUSAL_CODES, type UiBefore, type UiOrigin, type UiRefusal, type UiRefusalFamily, type V2Placement, type V2Shape, type V2VariantMeta, V2_KEYS, V2_PLACEMENTS, V2_SHAPES, VIDEO_TRANSCRIPT_MAX, VIDEO_VALUE_KEYS, type VariantGroupV2, type VariantInputMapping, type VideoBlock, type VideoProps, type VideoValue, type VisibilityWindow, type WeightToken, type WindowState, type Workspace, type ZoneField, allowRuleOf, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, bodySchemaOf, buttonBlockProps, buttonFullWidthProblem, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonLookValue, buttonSiteLookOf, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, canonicalJson, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, exampleFor, expandBlockBindings, fieldGroupOf, fieldStyleCssText, fieldStyleToCss, formatNumber, formatPropsAttribute, getBlockType, headingPaintCss, hiddenEverywhere, hideOnAttr, imageFrameCss, inWindow, isBlock, isButtonLookValue, isChromeLandmark, isCodeButton, isLinkObject, isRoleKey, isRulePaired, isScriptHref, isSlotChild, isTableValue, isUiRefusal, keyWords, landmarkRegions, linkAnchorOf, linkHref, linkRefOf, linkValueProblem, locatorFor, locatorPath, mayOverwrite, normalizeLinkValue, normalizeTableValue, normalizeWindow, parseNumberText, parsePropsAttribute, pickFieldStyle, placementBindOf, planSections, readButtonValue, readNumberFormat, readPath, regionOf, renderTableHtml, rulePartnerOf, safeCssUrl, sideFloorApplies, sideSpaceCss, slotBindOf, slotChildValues, slotItems, slotPathString, slotShapeProblems, spaceTokenCss, splitButtonStyle, tableCellText, tablePathString, tableRefCells, tableSearchText, tableToMarkdown, tableValueProblems, topFieldKeyOf, uiRefusalId, usesHideOn, videoUrlOf, videoValueProblem, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps, withExample };
|
|
4228
|
+
export { type AlignToken, type AllowRule, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BLOCK_BINDINGS, BLOCK_FIELD_TYPES, BLOCK_FIELD_TYPES_RENDERABLE_NOW, BODY_SCHEMA_ORIGINS, BREAKPOINTS, BUTTON_ACTIONS, BUTTON_FULL_WIDTH_INVALID, BUTTON_ICONS, BUTTON_ICON_NAMES, BUTTON_LOOK_KEYS, BUTTON_PLACEMENT_KEYS, BUTTON_SIZES, BUTTON_VARIANTS, type BetterCMSErrorCode, type BgToken, type BindingKind, type BlockBinding, type BlockHoverStyle, type BlockStyle, type BlockType, type BodySchema, type BodySchemaOrigin, type ButtonAction, type ButtonBlock, type ButtonIcon, type ButtonLinkCandidate, type ButtonLookKey, type ButtonProps, type ButtonSiteLook, type ButtonSizeName, type ButtonValue, type ButtonVariant, CANVAS_GESTURE_NAMES, CODE_SLOT_PREFIX, COMPONENT_PROP_TYPES, CONTROL_HELP, type CanonicalInputDefinition, type CanvasGesture, type ChoiceOption, type CollectionBlock, type CollectionFilter, type CollectionProps, type ColorToken, type ColumnsBlock, type ColumnsProps, type Component, type ComponentBlock, type ComponentCategory, type ComponentFormPropRef, type ComponentPreview, type ComponentPropDef, type ComponentPropType, type ComponentPropUi, type ComponentProps, type ComponentSubField, type ComponentTab, type ComponentV2, type ComponentVariantGroup, type Content, type ContentBlock, type ContentEntry, type ContentModel, type ContentModelField, type ContentModelFieldType, type ContentModelFieldUi, type ContentModelV2, type ContentPageResult, type ContentResponse, type ContentWidthToken, type ControlKind, type CornerToken, DEPTH_MAX, DERIVE_MINTED_RESERVED, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, type DeepReadonly, type DefSources, type DeliveredLayout, type DeliveryComponent, type DeliveryEntry, type DeliveryEntrySeo, type DeliveryList, type DeliveryPage, type DerivedLocator, type DockBudget, type DockFieldLike, type DockFieldsetLike, type DockIconName, type DockInputRef, type DockLane, type DockNode, type DockPropGroupLike, type DockScreen, type ElementLike, type ExpandedBinding, FIELD_SIZE_ZOOM, FIELD_STYLE_KEYS, FOOTER_SECTION_ID, type FieldConfig, type FieldSize, type FieldStyle, type FieldStyleKey, type FieldStyles, type Fieldset, type FieldsetKind, type FieldsetUiBefore, type FontSizeToken, type FooterBlock, type FooterColumn, type FooterProps, type Form, type FormBlock, type FormField, type FormProps, type FormSubmission, HELP_CAPS, HELP_MAX, type HeadingBlock, type HeadingProps, IMAGE_ASPECTS, IMAGE_FRAME_RADIUS, type ImageAspect, type ImageBlock, type ImageProps, KEY_FORBIDDEN, KEY_FORMAT, KEY_RESERVED, KEY_RESERVED_PREFIX, KIT_CATEGORIES, type KitCategory, LANDMARK_SELECTOR, LAYOUT_SECTION_ICONS, LAYOUT_SECTION_ICON_SET, LINK_RELS, LINK_VALUE_TYPES, LIST_ITEMS_CAP, LOCATOR_PATH, type LandmarkChainElement, type LandmarkElement, type LayoutComponentItem, type LayoutDataDocument, type LayoutFieldDefinition, type LayoutFieldItem, type LayoutFieldType, type LayoutScalarFieldType, type LayoutSection, type LayoutSectionIcon, type LayoutSectionItem, type LayoutStructureDocument, type LayoutZone, type LinkPairSibling, type LinkRel, type LinkValue, type LinkValueType, type LocatorGrammar, MAIN_SELECTOR, type ManagementLayoutCommand, type MediaAsset, type MediaCaptionTrack, type MediaFieldValue, NAVIGATION_SECTION_ID, type NavLink, type NavbarBlock, type NavbarProps, type NumberFieldFormat, type NumberScale, OPTION_DESCRIPTION_MAX, type OpenMode, PAGE_CONTENT_ANCHOR_ID, PRIMITIVE_ARRAY_RULE, type Page, type PageLayoutOverrideDataDocument, type PageLayoutOverrideDocument, type PageLayoutOverrideState, type PageLayoutOverrideStructureDocument, type PageLayoutSectionOverride, type PageLayoutSectionStructureOverride, type PageMetaJson, type PageOnlyLayoutSection, type PageSectionPlacement, type PaginatedResult, type Perspective, type PortableTextDocument, type PortableTextNode, type PropGroup, type PropTab, RESPONSIVE_CSS, RICHTEXT_ADVANCED_ELEMENTS, RICHTEXT_BLOCK_ELEMENTS, RICHTEXT_BLOCK_FEATURES, RICHTEXT_CORE_ELEMENTS, RICHTEXT_ELEMENTS, RICHTEXT_FEATURES, RICHTEXT_FEATURE_ALIASES, RICHTEXT_HEADING_FEATURES, RICHTEXT_MARK_FEATURES, RICHTEXT_TOGGLE_FEATURES, ROLE_HELP, ROLE_KEYS, type RadiusToken, type ReadButtonValue, type Redirect, type ReservedLayoutSection, type ResolvedLayoutNode, type RichTextBlock, type RichTextElementName, type RichTextFeature, type RichTextProps, type RichTextRefusalCode, SCHEMA_HASH_INPUTS, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SEGMENTED_MAX, SEGMENTED_MIN, SIDE_SPACE_MIN_PX, SIDE_SPACE_TOKENS, SLOT_CHILD_KEYS, SLOT_ITEMS_CAP, SLOT_MAX_ITEMS, SLOT_SETTINGS_MAX, SLOT_SETTINGS_TYPES, SOURCE_RANK, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type ScaleUnit, type SchemaHashTable, type SchemaSource, type SectionBlock, type SectionPlanItem, type SectionProps, type SectionSpaceToken, type ShadowToken, type ShowIf, type ShowIfRule, type SignInInput, type SignUpInput, type SiteSeoDefaults, type SlideItem, type SliderBlock, type SliderProps, type SlotChild, type SlotItem, type SlotShapeOptions, type SlotShapeProblem, type SlotValue, type SourcedFacet, type SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, TABLE_COLUMN_TYPES, TABLE_JSONLD_TYPES, TABLE_LIMITS, TABLE_RESPONSIVE, TAB_MAX, TAB_MAX_RENDERABLE_NOW, TAG_HEADS, type TabItem, type TableCell, type TableCellObject, type TableCellValue, type TableCheckOptions, type TableColumn, type TableColumnType, type TableFieldOptions, type TableFootnote, type TableGroup, type TableLink, type TableProblem, type TableRef, type TableRefResolved, type TableRow, type TableValue, type TabsBlock, type TabsProps, type TextBlock, type TextProps, type ThemeToken, UI_REFUSAL_CODES, type UiBefore, type UiOrigin, type UiRefusal, type UiRefusalFamily, type V2Placement, type V2Shape, type V2VariantMeta, V2_KEYS, V2_PLACEMENTS, V2_SHAPES, VIDEO_TRANSCRIPT_MAX, VIDEO_VALUE_KEYS, type VariantGroupV2, type VariantInputMapping, type VideoBlock, type VideoProps, type VideoValue, type VisibilityWindow, type WeightToken, type WindowState, type Workspace, type ZoneField, allowRuleOf, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, bodySchemaOf, buttonBlockProps, buttonFullWidthProblem, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonLookValue, buttonSiteLookOf, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, canonicalJson, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, exampleFor, expandBlockBindings, fieldGroupOf, fieldStyleCssText, fieldStyleToCss, formatNumber, formatPropsAttribute, getBlockType, headingPaintCss, hiddenEverywhere, hideOnAttr, imageFrameCss, inWindow, isBlock, isButtonLookValue, isChromeLandmark, isCodeButton, isDeriveReservedKey, isLinkObject, isReservedKey, isRoleKey, isRulePaired, isScriptHref, isSlotChild, isTableValue, isUiRefusal, keyWords, landmarkRegions, linkAnchorOf, linkHref, linkRefOf, linkValueProblem, locatorFor, locatorPath, mayOverwrite, normaliseRichTextFeatures, normalizeLinkValue, normalizeTableValue, normalizeWindow, parseNumberText, parsePropsAttribute, pickFieldStyle, placementBindOf, planSections, readButtonValue, readNumberFormat, readPath, regionOf, renderTableHtml, richTextRefusal, rulePartnerOf, safeCssUrl, schemaHashInput, sideFloorApplies, sideSpaceCss, slotBindOf, slotChildValues, slotItems, slotPathString, slotShapeProblems, spaceTokenCss, splitButtonStyle, tableCellText, tablePathString, tableRefCells, tableSearchText, tableToMarkdown, tableValueProblems, topFieldKeyOf, uiRefusalId, usesHideOn, videoUrlOf, videoValueProblem, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps, withExample };
|
package/dist/index.js
CHANGED
|
@@ -4553,6 +4553,7 @@ function planSections(slots, blocks) {
|
|
|
4553
4553
|
|
|
4554
4554
|
// src/kit-v2.ts
|
|
4555
4555
|
var TAB_MAX = 8;
|
|
4556
|
+
var TAB_MAX_RENDERABLE_NOW = 3;
|
|
4556
4557
|
var SEGMENTED_MIN = 2;
|
|
4557
4558
|
var SEGMENTED_MAX = 8;
|
|
4558
4559
|
var DEPTH_MAX = 10;
|
|
@@ -4652,8 +4653,13 @@ var UI_REFUSAL_CODES = {
|
|
|
4652
4653
|
"depth_exceeded",
|
|
4653
4654
|
"validation_failed",
|
|
4654
4655
|
"hash_mismatch",
|
|
4656
|
+
"non_finite_number",
|
|
4655
4657
|
"shape_kind_mismatch",
|
|
4656
|
-
"block_field_unrenderable"
|
|
4658
|
+
"block_field_unrenderable",
|
|
4659
|
+
// rich text (richtext-features.ts richTextRefusal): `richtext.<code>:<detail>`
|
|
4660
|
+
"block_not_accepted",
|
|
4661
|
+
"derived_field",
|
|
4662
|
+
"feature_unknown"
|
|
4657
4663
|
],
|
|
4658
4664
|
build: ["peer_missing", "kit_major_unsupported", "compile_error", "nondeterministic", "size_exceeded"],
|
|
4659
4665
|
protocol: ["unsupported", "handshake_timeout", "origin_mismatch", "write_denied"],
|
|
@@ -4666,6 +4672,18 @@ var isUiRefusal = (v) => {
|
|
|
4666
4672
|
const { family, code, message } = v;
|
|
4667
4673
|
return typeof family === "string" && Object.hasOwn(UI_REFUSAL_CODES, family) && UI_REFUSAL_CODES[family].includes(code) && typeof message === "string";
|
|
4668
4674
|
};
|
|
4675
|
+
var KEY_RESERVED = /* @__PURE__ */ new Set(["derived", "layout", "page"]);
|
|
4676
|
+
var DERIVE_MINTED_RESERVED = /* @__PURE__ */ new Set([...KEY_RESERVED, "id"]);
|
|
4677
|
+
var KEY_FORBIDDEN = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
4678
|
+
var KEY_RESERVED_PREFIX = "_";
|
|
4679
|
+
var KEY_FORMAT = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
4680
|
+
var isReservedKey = (key) => KEY_FORBIDDEN.has(key) || KEY_RESERVED.has(key) || key.startsWith(KEY_RESERVED_PREFIX);
|
|
4681
|
+
var isDeriveReservedKey = (key) => isReservedKey(key) || DERIVE_MINTED_RESERVED.has(key);
|
|
4682
|
+
var PRIMITIVE_ARRAY_RULE = {
|
|
4683
|
+
itemTypes: ["text", "number", "date", "image", "link", "richtext"],
|
|
4684
|
+
configKeys: ["itemType", "minItems", "maxItems", "aliases"],
|
|
4685
|
+
notWithZones: ["image", "link", "richtext"]
|
|
4686
|
+
};
|
|
4669
4687
|
function canonicalNumber(value) {
|
|
4670
4688
|
if (!Number.isFinite(value)) throw new TypeError("Canonical JSON only supports finite numbers");
|
|
4671
4689
|
if (Object.is(value, -0)) return "0";
|
|
@@ -4692,6 +4710,99 @@ function canonicalJson(value) {
|
|
|
4692
4710
|
}
|
|
4693
4711
|
throw new TypeError(`Unsupported canonical JSON value: ${typeof value}`);
|
|
4694
4712
|
}
|
|
4713
|
+
var SCHEMA_HASH_INPUTS = {
|
|
4714
|
+
components: ["props", "tabs", "v2"],
|
|
4715
|
+
content_models: ["fields", "fieldsets", "v2"],
|
|
4716
|
+
component_variant_groups: ["canonicalInputs", "v2"]
|
|
4717
|
+
};
|
|
4718
|
+
var LIST_INPUTS = /* @__PURE__ */ new Set(["props", "fields", "canonicalInputs"]);
|
|
4719
|
+
function schemaHashInput(table, def) {
|
|
4720
|
+
return Object.fromEntries(SCHEMA_HASH_INPUTS[table].map((k) => [k, def[k] ?? (LIST_INPUTS.has(k) ? [] : null)]));
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
// src/richtext-features.ts
|
|
4724
|
+
var RICHTEXT_MARK_FEATURES = ["bold", "italic", "underline", "strikethrough", "code", "highlight"];
|
|
4725
|
+
var RICHTEXT_TOGGLE_FEATURES = [
|
|
4726
|
+
"headings",
|
|
4727
|
+
"blockquote",
|
|
4728
|
+
"horizontalRule",
|
|
4729
|
+
"orderedList",
|
|
4730
|
+
"unorderedList",
|
|
4731
|
+
"checklist",
|
|
4732
|
+
"link",
|
|
4733
|
+
"internalLink",
|
|
4734
|
+
"inlineImage",
|
|
4735
|
+
"videoEmbed",
|
|
4736
|
+
"codeBlock",
|
|
4737
|
+
"table",
|
|
4738
|
+
"columns"
|
|
4739
|
+
];
|
|
4740
|
+
var RICHTEXT_HEADING_FEATURES = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
4741
|
+
var RICHTEXT_BLOCK_FEATURES = [
|
|
4742
|
+
"gallery",
|
|
4743
|
+
"embed",
|
|
4744
|
+
"tableOfContents",
|
|
4745
|
+
"relatedPosts",
|
|
4746
|
+
"authorBio",
|
|
4747
|
+
"footnotes",
|
|
4748
|
+
"button"
|
|
4749
|
+
];
|
|
4750
|
+
var RICHTEXT_FEATURES = [
|
|
4751
|
+
...RICHTEXT_MARK_FEATURES,
|
|
4752
|
+
...RICHTEXT_TOGGLE_FEATURES,
|
|
4753
|
+
...RICHTEXT_HEADING_FEATURES,
|
|
4754
|
+
...RICHTEXT_BLOCK_FEATURES
|
|
4755
|
+
];
|
|
4756
|
+
var RICHTEXT_FEATURE_ALIASES = {
|
|
4757
|
+
headings: RICHTEXT_HEADING_FEATURES
|
|
4758
|
+
};
|
|
4759
|
+
var KNOWN = new Set(RICHTEXT_FEATURES);
|
|
4760
|
+
var isAlias = (name) => Object.hasOwn(RICHTEXT_FEATURE_ALIASES, name);
|
|
4761
|
+
function normaliseRichTextFeatures(names) {
|
|
4762
|
+
const want = /* @__PURE__ */ new Set();
|
|
4763
|
+
const unknown = [];
|
|
4764
|
+
for (const name of names) {
|
|
4765
|
+
if (isAlias(name)) for (const f of RICHTEXT_FEATURE_ALIASES[name]) want.add(f);
|
|
4766
|
+
else if (KNOWN.has(name)) want.add(name);
|
|
4767
|
+
else if (!unknown.includes(name)) unknown.push(name);
|
|
4768
|
+
}
|
|
4769
|
+
return { features: RICHTEXT_FEATURES.filter((f) => want.has(f) && !isAlias(f)), unknown };
|
|
4770
|
+
}
|
|
4771
|
+
var RICHTEXT_CORE_ELEMENTS = [
|
|
4772
|
+
"p",
|
|
4773
|
+
"pre",
|
|
4774
|
+
"h1",
|
|
4775
|
+
"h2",
|
|
4776
|
+
"h3",
|
|
4777
|
+
"h4",
|
|
4778
|
+
"h5",
|
|
4779
|
+
"h6",
|
|
4780
|
+
"b",
|
|
4781
|
+
"i",
|
|
4782
|
+
"link",
|
|
4783
|
+
"image",
|
|
4784
|
+
"code",
|
|
4785
|
+
"ul",
|
|
4786
|
+
"ol",
|
|
4787
|
+
"rtl"
|
|
4788
|
+
];
|
|
4789
|
+
var RICHTEXT_ADVANCED_ELEMENTS = ["u", "mark", "s", "checklist", "table", "columns", "embed", "internalLink"];
|
|
4790
|
+
var RICHTEXT_BLOCK_ELEMENTS = [
|
|
4791
|
+
"gallery",
|
|
4792
|
+
"providerEmbed",
|
|
4793
|
+
"tableOfContents",
|
|
4794
|
+
"relatedPosts",
|
|
4795
|
+
"authorBio",
|
|
4796
|
+
"footnotes",
|
|
4797
|
+
"button"
|
|
4798
|
+
];
|
|
4799
|
+
var RICHTEXT_ELEMENTS = [...RICHTEXT_CORE_ELEMENTS, ...RICHTEXT_ADVANCED_ELEMENTS, ...RICHTEXT_BLOCK_ELEMENTS];
|
|
4800
|
+
var richTextRefusal = (code, detail) => ({
|
|
4801
|
+
family: "schema",
|
|
4802
|
+
code,
|
|
4803
|
+
detail,
|
|
4804
|
+
message: `richtext.${code}:${detail}`
|
|
4805
|
+
});
|
|
4695
4806
|
export {
|
|
4696
4807
|
BLOCK_BINDINGS,
|
|
4697
4808
|
BLOCK_FIELD_TYPES,
|
|
@@ -4711,6 +4822,7 @@ export {
|
|
|
4711
4822
|
COMPONENT_PROP_TYPES,
|
|
4712
4823
|
CONTROL_HELP,
|
|
4713
4824
|
DEPTH_MAX,
|
|
4825
|
+
DERIVE_MINTED_RESERVED,
|
|
4714
4826
|
DIALOG_SELECTOR,
|
|
4715
4827
|
DOCK_BUDGET,
|
|
4716
4828
|
DOCK_ICON_NAMES,
|
|
@@ -4722,6 +4834,10 @@ export {
|
|
|
4722
4834
|
HELP_MAX,
|
|
4723
4835
|
IMAGE_ASPECTS,
|
|
4724
4836
|
IMAGE_FRAME_RADIUS,
|
|
4837
|
+
KEY_FORBIDDEN,
|
|
4838
|
+
KEY_FORMAT,
|
|
4839
|
+
KEY_RESERVED,
|
|
4840
|
+
KEY_RESERVED_PREFIX,
|
|
4725
4841
|
KIT_CATEGORIES,
|
|
4726
4842
|
LANDMARK_SELECTOR,
|
|
4727
4843
|
LAYOUT_SECTION_ICONS,
|
|
@@ -4734,9 +4850,21 @@ export {
|
|
|
4734
4850
|
NAVIGATION_SECTION_ID,
|
|
4735
4851
|
OPTION_DESCRIPTION_MAX,
|
|
4736
4852
|
PAGE_CONTENT_ANCHOR_ID,
|
|
4853
|
+
PRIMITIVE_ARRAY_RULE,
|
|
4737
4854
|
RESPONSIVE_CSS,
|
|
4855
|
+
RICHTEXT_ADVANCED_ELEMENTS,
|
|
4856
|
+
RICHTEXT_BLOCK_ELEMENTS,
|
|
4857
|
+
RICHTEXT_BLOCK_FEATURES,
|
|
4858
|
+
RICHTEXT_CORE_ELEMENTS,
|
|
4859
|
+
RICHTEXT_ELEMENTS,
|
|
4860
|
+
RICHTEXT_FEATURES,
|
|
4861
|
+
RICHTEXT_FEATURE_ALIASES,
|
|
4862
|
+
RICHTEXT_HEADING_FEATURES,
|
|
4863
|
+
RICHTEXT_MARK_FEATURES,
|
|
4864
|
+
RICHTEXT_TOGGLE_FEATURES,
|
|
4738
4865
|
ROLE_HELP,
|
|
4739
4866
|
ROLE_KEYS,
|
|
4867
|
+
SCHEMA_HASH_INPUTS,
|
|
4740
4868
|
SECTION_DOCTRINE,
|
|
4741
4869
|
SECTION_SPACE_TOKENS,
|
|
4742
4870
|
SEGMENTED_MAX,
|
|
@@ -4756,6 +4884,7 @@ export {
|
|
|
4756
4884
|
TABLE_LIMITS,
|
|
4757
4885
|
TABLE_RESPONSIVE,
|
|
4758
4886
|
TAB_MAX,
|
|
4887
|
+
TAB_MAX_RENDERABLE_NOW,
|
|
4759
4888
|
TAG_HEADS,
|
|
4760
4889
|
UI_REFUSAL_CODES,
|
|
4761
4890
|
V2_KEYS,
|
|
@@ -4803,7 +4932,9 @@ export {
|
|
|
4803
4932
|
isButtonLookValue,
|
|
4804
4933
|
isChromeLandmark,
|
|
4805
4934
|
isCodeButton,
|
|
4935
|
+
isDeriveReservedKey,
|
|
4806
4936
|
isLinkObject,
|
|
4937
|
+
isReservedKey,
|
|
4807
4938
|
isRoleKey,
|
|
4808
4939
|
isRulePaired,
|
|
4809
4940
|
isScriptHref,
|
|
@@ -4819,6 +4950,7 @@ export {
|
|
|
4819
4950
|
locatorFor,
|
|
4820
4951
|
locatorPath,
|
|
4821
4952
|
mayOverwrite,
|
|
4953
|
+
normaliseRichTextFeatures,
|
|
4822
4954
|
normalizeLinkValue,
|
|
4823
4955
|
normalizeTableValue,
|
|
4824
4956
|
normalizeWindow,
|
|
@@ -4832,8 +4964,10 @@ export {
|
|
|
4832
4964
|
readPath,
|
|
4833
4965
|
regionOf,
|
|
4834
4966
|
renderTableHtml,
|
|
4967
|
+
richTextRefusal,
|
|
4835
4968
|
rulePartnerOf,
|
|
4836
4969
|
safeCssUrl,
|
|
4970
|
+
schemaHashInput,
|
|
4837
4971
|
sideFloorApplies,
|
|
4838
4972
|
sideSpaceCss,
|
|
4839
4973
|
slotBindOf,
|