@bettercms-ai/types 1.66.0 → 1.67.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 CHANGED
@@ -3544,6 +3544,16 @@ declare function tableRefCells(value: unknown): Array<{
3544
3544
  }>;
3545
3545
  /** The words a cell says (Markdown, search, screen readers). Booleans say their words, never a tick. */
3546
3546
  declare function tableCellText(col: TableColumn, row: TableRow | undefined, c: unknown): string;
3547
+ /**
3548
+ * The few rules every rendered table needs wherever it lands (a hosted page, a prop's `props.html`,
3549
+ * a code site): screen-reader-only words, the scroll region, cell padding. Scoped to `.bt-table`
3550
+ * and carried in the figure, so a page without a table ships none of it.
3551
+ *
3552
+ * GAP-124: the scroll region is `position:relative`, so it is the containing block of every
3553
+ * absolutely placed `.bt-sr` inside it. Without that a hidden "Included" in a column scrolled out of
3554
+ * view laid out against the page, not the region, and pushed a 375px page 152px sideways.
3555
+ */
3556
+ declare const TABLE_CSS: string;
3547
3557
  /**
3548
3558
  * The table as semantic HTML (published form: no editing marks): `<figure class="bt-table">` ›
3549
3559
  * `<table>` with caption, column-group headers, `<thead>`, one `<tbody>` per row group, `<tfoot>`,
@@ -3628,10 +3638,13 @@ interface MediaFieldValue {
3628
3638
  * entries an author bio and related posts point at, resolved by the server (one query, at
3629
3639
  * html-cache build) so every renderer draws the same thing and none of them fetches.
3630
3640
  */
3631
- /** A related post as a reader sees it. `url` is the final href (from the collection's route). */
3641
+ /**
3642
+ * A related post as a reader sees it. `url` is the final href (from the collection's route); absent when the
3643
+ * post has no public page (a collection with no detail route), and the card is drawn without a link.
3644
+ */
3632
3645
  interface ResolvedPost {
3633
3646
  title: string;
3634
- url: string;
3647
+ url?: string;
3635
3648
  cover?: string;
3636
3649
  category?: string;
3637
3650
  }
@@ -3866,7 +3879,7 @@ type FormStatus = "draft" | "published";
3866
3879
  interface FormField {
3867
3880
  key: string;
3868
3881
  label: string;
3869
- type: "text" | "email" | "textarea" | "select" | "checkbox" | "checkboxes" | "radio" | "number" | "phone" | "date" | "url" | "consent" | "hidden" | "step";
3882
+ type: "text" | "email" | "textarea" | "select" | "checkbox" | "checkboxes" | "radio" | "number" | "phone" | "date" | "url" | "consent" | "hidden" | "file" | "step";
3870
3883
  placeholder?: string;
3871
3884
  helpText?: string;
3872
3885
  required?: boolean;
@@ -3898,6 +3911,12 @@ type FormFieldValidation = {
3898
3911
  phoneFormat?: "any" | "e164";
3899
3912
  /** `text` | `textarea` | `url` — anchored regex, compiled and length-capped at save time. */
3900
3913
  pattern?: string;
3914
+ /** `file` — accepted extensions, lowercase, no dot. Unset = FORM_UPLOAD_DEFAULT_ACCEPT. */
3915
+ accept?: string[];
3916
+ /** `file` — files per field. Unset = 1. Capped by the site's plan when it applies. */
3917
+ maxFiles?: number;
3918
+ /** `file` — per-file cap in MB. Only a plan that may configure upload limits can set it. */
3919
+ maxSizeMb?: number;
3901
3920
  };
3902
3921
  /**
3903
3922
  * Per-field PRESENTATION options. Currently only the phone field's country picker.
@@ -3939,6 +3958,78 @@ interface FormSubmission {
3939
3958
  userAgent?: string;
3940
3959
  }
3941
3960
 
3961
+ /**
3962
+ * The `file` form field's platform limits and type vocabulary: one statement of them, read by
3963
+ * the save route, the upload route, the submit check and every renderer.
3964
+ *
3965
+ * A field's own `validation.maxSizeMb` / `maxFiles` are a REQUEST. What applies is computed by
3966
+ * the server from the site's current plan each time (`formUploadLimits`), so a stored number
3967
+ * never outlives the plan that allowed it.
3968
+ */
3969
+ declare const FORM_UPLOAD: {
3970
+ /** Per-file cap on every plan, in MB. */
3971
+ readonly maxSizeMb: 10;
3972
+ /** The most a site whose plan may configure the cap can raise it to, in MB. */
3973
+ readonly maxSizeMbCeiling: 25;
3974
+ /** Files per field on every plan. */
3975
+ readonly maxFiles: 5;
3976
+ /** Files per field where the plan may configure limits. */
3977
+ readonly maxFilesCeiling: 10;
3978
+ };
3979
+ /** Named groups of extensions the builder offers. A field stores extensions, never a preset name. */
3980
+ declare const FORM_UPLOAD_PRESETS: {
3981
+ readonly images: readonly ["jpg", "jpeg", "png", "gif", "webp", "heic"];
3982
+ readonly pdf: readonly ["pdf"];
3983
+ readonly documents: readonly ["doc", "docx", "odt", "rtf", "txt"];
3984
+ readonly spreadsheets: readonly ["xls", "xlsx", "ods", "csv"];
3985
+ readonly archives: readonly ["zip"];
3986
+ };
3987
+ /** What a file field accepts when its owner names nothing: every preset except archives. */
3988
+ declare const FORM_UPLOAD_DEFAULT_ACCEPT: readonly string[];
3989
+ /**
3990
+ * Extensions no file field accepts, whatever its `accept` says: programs, installers, scripts,
3991
+ * shortcuts, disk images, macro-carrying documents and pages a browser would run.
3992
+ */
3993
+ declare const FORM_UPLOAD_REFUSED_EXTENSIONS: readonly string[];
3994
+ /** Is this extension one no field may accept? */
3995
+ declare function isRefusedUploadExtension(ext: string): boolean;
3996
+ /** A file name's extension: lowercase, no dot, "" when it has none. */
3997
+ declare function fileExtension(name: string): string;
3998
+ /**
3999
+ * The extensions a field accepts: its own list, lowercased, without dots and without anything
4000
+ * refused, or the default when nothing is left. Renderers build their `accept` attribute from it.
4001
+ */
4002
+ declare function formUploadAccept(accept: readonly string[] | undefined): string[];
4003
+ /**
4004
+ * The limits that APPLY to a file field. `configurable` is whether the site's plan may set its
4005
+ * own limits; without it the field's `maxSizeMb` is ignored and `maxFiles` stops at the base cap.
4006
+ */
4007
+ declare function formUploadLimits(rules: {
4008
+ maxFiles?: number;
4009
+ maxSizeMb?: number;
4010
+ } | undefined, configurable: boolean): {
4011
+ maxFiles: number;
4012
+ maxSizeMb: number;
4013
+ };
4014
+ /**
4015
+ * What a renderer checks a chosen file against BEFORE uploading it: the field as delivered, with
4016
+ * the platform's defaults and ceilings. A courtesy, never the rule. A site's plan may hold the
4017
+ * field to less (the upload route then refuses with the limit that applies, and that refusal is
4018
+ * what the visitor is shown); this must never be MORE strict than the server, or a file the
4019
+ * site's plan allows would be blocked in the browser.
4020
+ */
4021
+ declare function fileFieldLimits(field: {
4022
+ validation?: {
4023
+ accept?: string[];
4024
+ maxFiles?: number;
4025
+ maxSizeMb?: number;
4026
+ };
4027
+ }): {
4028
+ accept: string[];
4029
+ maxFiles: number;
4030
+ maxSizeMb: number;
4031
+ };
4032
+
3942
4033
  /**
3943
4034
  * Redirect — a server-side redirect managed in the CMS.
3944
4035
  */
@@ -4887,4 +4978,4 @@ declare function iconValueProblem(v: unknown, knownName: (name: string) => boole
4887
4978
  */
4888
4979
  declare function iconHtml(v: unknown, className?: string): string;
4889
4980
 
4890
- export { type AlignToken, type AllowRule, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ApproveDockUiInput, type ApproveDockUiOutput, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BG_TOKENS, 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 BodiesState, type BodyDeclaration, 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, CATEGORY_ID_MAX, CATEGORY_ORDER, CODE_SLOT_PREFIX, COMPONENT_GATE_CODES, COMPONENT_PROP_TYPES, CONTENT_WIDTH_TOKENS, 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 ComponentCategoryId, type ComponentEmbedNode, type ComponentFormPropRef, type ComponentGateCode, 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, DEFAULT_ICON_SOURCES, DEFAULT_VARIANT, DEPTH_MAX, DERIVE_MINTED_RESERVED, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, DOCK_UI_IMPORTS, DOCK_UI_LIMITS, DOCK_UI_NAME, type DeclaredSlot, 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 DockUiBuildReceipt, type DockUiKind, type DockUiOrigin, type DockUiScope, type DockUiSource, type DockUiStatus, type DockUiVersion, EMBED_LEDGER_OUTCOMES, EMBED_REASONS, type ElementLike, type EmbedCapability, type EmbedCard, type EmbedLedgerOutcome, type EmbedMarker, type EmbedMarkerMatch, type EmbedNotRenderedWarning, type EmbedReason, type ExpandedBinding, FIELD_SIZE_ZOOM, FIELD_STYLE_KEYS, FOOTER_SECTION_ID, FRAME_REFUSALS, 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_LINE_MAX, HELP_MAX, HELP_WRITE_MAX, type HeadingBlock, type HeadingProps, ICON_LABEL_MAX, ICON_SOURCES, IMAGE_ASPECTS, IMAGE_FRAME_RADIUS, type IconFieldOptions, type IconObjectValue, type IconSource, type IconSrc, type IconValue, 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, LIST_PREVIEW_SLOTS, LOCATOR_PATH, type LandmarkChainElement, type LandmarkElement, type LayoutComponentItem, type LayoutDataDocument, type LayoutFieldDefinition, type LayoutFieldItem, type LayoutFieldType, type LayoutScalarFieldType, type LayoutSection, type LayoutSectionDesign, type LayoutSectionIcon, type LayoutSectionItem, type LayoutStructureDocument, type LayoutZone, type LibraryIconValue, type LinkPairSibling, type LinkRel, type LinkValue, type LinkValueType, type ListDockUiInput, type ListDockUiOutput, 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, OPEN_MODES, OPEN_MODE_TYPES, OPTION_DESCRIPTION_MAX, type OpenMode, PAGE_CONTENT_ANCHOR_ID, PRIMITIVE_ARRAY_RULE, type PackIconValue, 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, type PublishDockUiInput, type PublishDockUiOutput, REFERENCE_CREATE_REFUSAL_CODES, 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_KEYS, type RadiusToken, type ReadButtonValue, type Redirect, type ReferenceCreateCapability, type ReferenceCreateRefusal, type ReferenceCreateRefusalCode, type ReferenceCreateResult, type ReferenceCreatedOption, type ReservedLayoutSection, type ResolvedAuthor, type ResolvedIconOptions, type ResolvedLayoutNode, type ResolvedPost, type RichTextBlock, type RichTextElementName, type RichTextEmbeds, type RichTextFeature, type RichTextProps, type RichTextRefusalCode, type RichTextResolved, SCHEMA_HASH_INPUTS, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SEGMENTED_MAX, SEGMENTED_MIN, SHOW_IF_SCOPES, 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, THEME_TOKENS, 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_PROTOCOLS, UI_REFUSAL_CODES, UI_REFUSAL_IDS, type UiBefore, type UiManifestEntry, type UiManifestV2, type UiOrigin, type UiProtocol, type UiRefusal, type UiRefusalFamily, type UiRefusalId, type UploadIconValue, type V2Placement, type V2Shape, type V2VariantMeta, V2_KEYS, V2_PLACEMENTS, V2_SHAPES, VARIANT_PROP_KEY, VIDEO_TRANSCRIPT_MAX, VIDEO_VALUE_KEYS, type ValidateDockUiInput, type ValidateDockUiOutput, type VariantGroupV2, type VariantInputMapping, type VideoBlock, type VideoProps, type VideoValue, type VisibilityWindow, WIDTH_FIT_FAIL_KINDS, type WeightToken, type WidthFitFailKind, type WidthFitResult, type WindowState, type Workspace, type WriteDockUiInput, type WriteDockUiOutput, type ZoneField, allowRuleOf, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, bodySchemaOf, buttonBlockProps, buttonFullWidthProblem, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonLookValue, buttonSiteLookOf, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, canonicalJson, compactIcon, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, dockUiMerkleKey, embedAddress, embedMarkerHtml, embedVisible, evaluateShowIf, exampleFor, expandBlockBindings, fieldGroupOf, fieldStyleCssText, fieldStyleToCss, formatNumber, formatPropsAttribute, getBlockType, headingPaintCss, hiddenEverywhere, hideOnAttr, iconHtml, iconIdentity, iconSrc, iconValueProblem, imageFrameCss, inWindow, isBlock, isButtonLookValue, isChromeLandmark, isCodeButton, isComponentGateCode, isDeriveReservedKey, isDockUiImportAllowed, isEmbedReason, isIconObjectForm, isLinkObject, isReservedKey, isRoleKey, isRulePaired, isScriptHref, isSlotChild, isTableValue, isUiRefusal, isVariantVisible, keyWords, landmarkRegions, linkAnchorOf, linkHref, linkRefOf, linkValueProblem, locatorFor, locatorPath, mayOverwrite, normaliseRichTextFeatures, normalizeIcon, normalizeLinkValue, normalizeTableValue, normalizeWindow, parseEmbedMarkers, parseNumberText, parsePropsAttribute, pickFieldStyle, placementBindOf, planSections, readButtonValue, readNumberFormat, readPath, referenceCreateRefusal, regionOf, renderTableHtml, resolveIconOptions, richTextRefusal, rulePartnerOf, safeCssUrl, schemaHashInput, sideFloorApplies, sideSpaceCss, slotBindOf, slotChildValues, slotItems, slotPathString, slotShapeProblems, slugify, spaceTokenCss, splitButtonStyle, tableCellText, tablePathString, tableRefCells, tableSearchText, tableToMarkdown, tableValueProblems, topFieldKeyOf, uiRefusalId, usesHideOn, variantOptionsFromUnion, variantOptionsOf, variantPropOf, videoUrlOf, videoValueProblem, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps, withExample, withIconLabel };
4981
+ export { type AlignToken, type AllowRule, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ApproveDockUiInput, type ApproveDockUiOutput, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BG_TOKENS, 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 BodiesState, type BodyDeclaration, 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, CATEGORY_ID_MAX, CATEGORY_ORDER, CODE_SLOT_PREFIX, COMPONENT_GATE_CODES, COMPONENT_PROP_TYPES, CONTENT_WIDTH_TOKENS, 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 ComponentCategoryId, type ComponentEmbedNode, type ComponentFormPropRef, type ComponentGateCode, 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, DEFAULT_ICON_SOURCES, DEFAULT_VARIANT, DEPTH_MAX, DERIVE_MINTED_RESERVED, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, DOCK_UI_IMPORTS, DOCK_UI_LIMITS, DOCK_UI_NAME, type DeclaredSlot, 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 DockUiBuildReceipt, type DockUiKind, type DockUiOrigin, type DockUiScope, type DockUiSource, type DockUiStatus, type DockUiVersion, EMBED_LEDGER_OUTCOMES, EMBED_REASONS, type ElementLike, type EmbedCapability, type EmbedCard, type EmbedLedgerOutcome, type EmbedMarker, type EmbedMarkerMatch, type EmbedNotRenderedWarning, type EmbedReason, type ExpandedBinding, FIELD_SIZE_ZOOM, FIELD_STYLE_KEYS, FOOTER_SECTION_ID, FORM_UPLOAD, FORM_UPLOAD_DEFAULT_ACCEPT, FORM_UPLOAD_PRESETS, FORM_UPLOAD_REFUSED_EXTENSIONS, FRAME_REFUSALS, 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_LINE_MAX, HELP_MAX, HELP_WRITE_MAX, type HeadingBlock, type HeadingProps, ICON_LABEL_MAX, ICON_SOURCES, IMAGE_ASPECTS, IMAGE_FRAME_RADIUS, type IconFieldOptions, type IconObjectValue, type IconSource, type IconSrc, type IconValue, 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, LIST_PREVIEW_SLOTS, LOCATOR_PATH, type LandmarkChainElement, type LandmarkElement, type LayoutComponentItem, type LayoutDataDocument, type LayoutFieldDefinition, type LayoutFieldItem, type LayoutFieldType, type LayoutScalarFieldType, type LayoutSection, type LayoutSectionDesign, type LayoutSectionIcon, type LayoutSectionItem, type LayoutStructureDocument, type LayoutZone, type LibraryIconValue, type LinkPairSibling, type LinkRel, type LinkValue, type LinkValueType, type ListDockUiInput, type ListDockUiOutput, 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, OPEN_MODES, OPEN_MODE_TYPES, OPTION_DESCRIPTION_MAX, type OpenMode, PAGE_CONTENT_ANCHOR_ID, PRIMITIVE_ARRAY_RULE, type PackIconValue, 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, type PublishDockUiInput, type PublishDockUiOutput, REFERENCE_CREATE_REFUSAL_CODES, 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_KEYS, type RadiusToken, type ReadButtonValue, type Redirect, type ReferenceCreateCapability, type ReferenceCreateRefusal, type ReferenceCreateRefusalCode, type ReferenceCreateResult, type ReferenceCreatedOption, type ReservedLayoutSection, type ResolvedAuthor, type ResolvedIconOptions, type ResolvedLayoutNode, type ResolvedPost, type RichTextBlock, type RichTextElementName, type RichTextEmbeds, type RichTextFeature, type RichTextProps, type RichTextRefusalCode, type RichTextResolved, SCHEMA_HASH_INPUTS, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SEGMENTED_MAX, SEGMENTED_MIN, SHOW_IF_SCOPES, 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_CSS, TABLE_JSONLD_TYPES, TABLE_LIMITS, TABLE_RESPONSIVE, TAB_MAX, TAB_MAX_RENDERABLE_NOW, TAG_HEADS, THEME_TOKENS, 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_PROTOCOLS, UI_REFUSAL_CODES, UI_REFUSAL_IDS, type UiBefore, type UiManifestEntry, type UiManifestV2, type UiOrigin, type UiProtocol, type UiRefusal, type UiRefusalFamily, type UiRefusalId, type UploadIconValue, type V2Placement, type V2Shape, type V2VariantMeta, V2_KEYS, V2_PLACEMENTS, V2_SHAPES, VARIANT_PROP_KEY, VIDEO_TRANSCRIPT_MAX, VIDEO_VALUE_KEYS, type ValidateDockUiInput, type ValidateDockUiOutput, type VariantGroupV2, type VariantInputMapping, type VideoBlock, type VideoProps, type VideoValue, type VisibilityWindow, WIDTH_FIT_FAIL_KINDS, type WeightToken, type WidthFitFailKind, type WidthFitResult, type WindowState, type Workspace, type WriteDockUiInput, type WriteDockUiOutput, type ZoneField, allowRuleOf, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, bodySchemaOf, buttonBlockProps, buttonFullWidthProblem, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonLookValue, buttonSiteLookOf, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, canonicalJson, compactIcon, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, dockUiMerkleKey, embedAddress, embedMarkerHtml, embedVisible, evaluateShowIf, exampleFor, expandBlockBindings, fieldGroupOf, fieldStyleCssText, fieldStyleToCss, fileExtension, fileFieldLimits, formUploadAccept, formUploadLimits, formatNumber, formatPropsAttribute, getBlockType, headingPaintCss, hiddenEverywhere, hideOnAttr, iconHtml, iconIdentity, iconSrc, iconValueProblem, imageFrameCss, inWindow, isBlock, isButtonLookValue, isChromeLandmark, isCodeButton, isComponentGateCode, isDeriveReservedKey, isDockUiImportAllowed, isEmbedReason, isIconObjectForm, isLinkObject, isRefusedUploadExtension, isReservedKey, isRoleKey, isRulePaired, isScriptHref, isSlotChild, isTableValue, isUiRefusal, isVariantVisible, keyWords, landmarkRegions, linkAnchorOf, linkHref, linkRefOf, linkValueProblem, locatorFor, locatorPath, mayOverwrite, normaliseRichTextFeatures, normalizeIcon, normalizeLinkValue, normalizeTableValue, normalizeWindow, parseEmbedMarkers, parseNumberText, parsePropsAttribute, pickFieldStyle, placementBindOf, planSections, readButtonValue, readNumberFormat, readPath, referenceCreateRefusal, regionOf, renderTableHtml, resolveIconOptions, richTextRefusal, rulePartnerOf, safeCssUrl, schemaHashInput, sideFloorApplies, sideSpaceCss, slotBindOf, slotChildValues, slotItems, slotPathString, slotShapeProblems, slugify, spaceTokenCss, splitButtonStyle, tableCellText, tablePathString, tableRefCells, tableSearchText, tableToMarkdown, tableValueProblems, topFieldKeyOf, uiRefusalId, usesHideOn, variantOptionsFromUnion, variantOptionsOf, variantPropOf, videoUrlOf, videoValueProblem, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps, withExample, withIconLabel };
package/dist/index.js CHANGED
@@ -280,6 +280,12 @@ function componentInstanceAddresses(instanceBlockId, props, owner) {
280
280
  if (!prop?.key || !prop.target?.blockId) continue;
281
281
  const from = componentPropTargetKey(prop);
282
282
  if (!out.has(from)) out.set(from, `${instance}__overrides.${prop.key}`);
283
+ if (prop.target.path === "props") {
284
+ const text2 = `${prop.target.blockId}__text`;
285
+ const href = `${prop.target.blockId}__href`;
286
+ if (!out.has(text2)) out.set(text2, `${instance}__overrides.${prop.key}.label`);
287
+ if (!out.has(href)) out.set(href, `${instance}__overrides.${prop.key}.href`);
288
+ }
283
289
  }
284
290
  return out;
285
291
  }
@@ -4087,7 +4093,7 @@ function cellHtml(t, col, row, c, fn, asHeader) {
4087
4093
  }
4088
4094
  return { inner: inner + sup, align: alignOf(col, type) };
4089
4095
  }
4090
- var TABLE_CSS = '.bt-table .bt-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.bt-table .bt-scroll{overflow-x:auto}.bt-table table{border-collapse:collapse;width:100%}.bt-table th,.bt-table td{padding:8px 12px;border-bottom:1px solid #e5e5e5;text-align:start;vertical-align:top}.bt-table [data-align="end"]{text-align:end}.bt-table [data-align="center"]{text-align:center}.bt-table caption{text-align:start;font-weight:600;padding-bottom:8px}.bt-table .bt-notes{font-size:.9em;margin-top:8px}';
4096
+ var TABLE_CSS = '.bt-table .bt-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.bt-table .bt-scroll{overflow-x:auto;position:relative}.bt-table table{border-collapse:collapse;width:100%}.bt-table th,.bt-table td{padding:8px 12px;border-bottom:1px solid #e5e5e5;text-align:start;vertical-align:top}.bt-table [data-align="end"]{text-align:end}.bt-table [data-align="center"]{text-align:center}.bt-table caption{text-align:start;font-weight:600;padding-bottom:8px}.bt-table .bt-notes{font-size:.9em;margin-top:8px}';
4091
4097
  function renderTableHtml(input) {
4092
4098
  const t = readTable(input);
4093
4099
  const id = (t.id ?? "tbl").replace(/[^\w-]/g, "") || "tbl";
@@ -4233,6 +4239,145 @@ function tableSearchText(input) {
4233
4239
  // src/content-model.ts
4234
4240
  var OPTION_DESCRIPTION_MAX = 140;
4235
4241
 
4242
+ // src/form-upload.ts
4243
+ var FORM_UPLOAD = {
4244
+ /** Per-file cap on every plan, in MB. */
4245
+ maxSizeMb: 10,
4246
+ /** The most a site whose plan may configure the cap can raise it to, in MB. */
4247
+ maxSizeMbCeiling: 25,
4248
+ /** Files per field on every plan. */
4249
+ maxFiles: 5,
4250
+ /** Files per field where the plan may configure limits. */
4251
+ maxFilesCeiling: 10
4252
+ };
4253
+ var FORM_UPLOAD_PRESETS = {
4254
+ images: ["jpg", "jpeg", "png", "gif", "webp", "heic"],
4255
+ pdf: ["pdf"],
4256
+ documents: ["doc", "docx", "odt", "rtf", "txt"],
4257
+ spreadsheets: ["xls", "xlsx", "ods", "csv"],
4258
+ archives: ["zip"]
4259
+ };
4260
+ var FORM_UPLOAD_DEFAULT_ACCEPT = [
4261
+ ...FORM_UPLOAD_PRESETS.images,
4262
+ ...FORM_UPLOAD_PRESETS.pdf,
4263
+ ...FORM_UPLOAD_PRESETS.documents,
4264
+ ...FORM_UPLOAD_PRESETS.spreadsheets
4265
+ ];
4266
+ var FORM_UPLOAD_REFUSED_EXTENSIONS = [
4267
+ "exe",
4268
+ "msi",
4269
+ "msp",
4270
+ "mst",
4271
+ "bat",
4272
+ "cmd",
4273
+ "com",
4274
+ "scr",
4275
+ "pif",
4276
+ "cpl",
4277
+ "dll",
4278
+ "sys",
4279
+ "drv",
4280
+ "vbs",
4281
+ "vbe",
4282
+ "js",
4283
+ "jse",
4284
+ "mjs",
4285
+ "cjs",
4286
+ "wsf",
4287
+ "wsh",
4288
+ "ps1",
4289
+ "psm1",
4290
+ "psd1",
4291
+ "hta",
4292
+ "sh",
4293
+ "bash",
4294
+ "zsh",
4295
+ "csh",
4296
+ "ksh",
4297
+ "fish",
4298
+ "command",
4299
+ "action",
4300
+ "workflow",
4301
+ "jar",
4302
+ "class",
4303
+ "app",
4304
+ "dmg",
4305
+ "pkg",
4306
+ "deb",
4307
+ "rpm",
4308
+ "apk",
4309
+ "ipa",
4310
+ "appx",
4311
+ "msix",
4312
+ "lnk",
4313
+ "url",
4314
+ "scf",
4315
+ "reg",
4316
+ "inf",
4317
+ "ins",
4318
+ "chm",
4319
+ "gadget",
4320
+ "html",
4321
+ "htm",
4322
+ "xhtml",
4323
+ "shtml",
4324
+ "svg",
4325
+ "php",
4326
+ "phtml",
4327
+ "asp",
4328
+ "aspx",
4329
+ "jsp",
4330
+ "cgi",
4331
+ "py",
4332
+ "rb",
4333
+ "pl",
4334
+ "iso",
4335
+ "img",
4336
+ "vhd",
4337
+ "vhdx",
4338
+ "bin",
4339
+ "elf",
4340
+ "so",
4341
+ "dylib",
4342
+ "docm",
4343
+ "xlsm",
4344
+ "pptm",
4345
+ "dotm",
4346
+ "xltm",
4347
+ "xlam",
4348
+ "xll",
4349
+ "mht",
4350
+ "mhtml",
4351
+ "msc",
4352
+ "scpt",
4353
+ "vb",
4354
+ "ws",
4355
+ "jnlp",
4356
+ "swf"
4357
+ ];
4358
+ function isRefusedUploadExtension(ext) {
4359
+ return FORM_UPLOAD_REFUSED_EXTENSIONS.includes(ext.toLowerCase());
4360
+ }
4361
+ function fileExtension(name) {
4362
+ const base = name.slice(Math.max(name.lastIndexOf("/"), name.lastIndexOf("\\")) + 1);
4363
+ const dot = base.lastIndexOf(".");
4364
+ return dot <= 0 || dot === base.length - 1 ? "" : base.slice(dot + 1).toLowerCase();
4365
+ }
4366
+ function formUploadAccept(accept) {
4367
+ const own2 = [...new Set((accept ?? []).map((e) => e.trim().replace(/^\./, "").toLowerCase()))].filter((e) => e && !isRefusedUploadExtension(e));
4368
+ return own2.length ? own2 : [...FORM_UPLOAD_DEFAULT_ACCEPT];
4369
+ }
4370
+ function formUploadLimits(rules, configurable) {
4371
+ const files = Math.max(1, Math.floor(rules?.maxFiles ?? 1));
4372
+ return {
4373
+ maxFiles: Math.min(files, configurable ? FORM_UPLOAD.maxFilesCeiling : FORM_UPLOAD.maxFiles),
4374
+ maxSizeMb: configurable ? Math.min(Math.max(1, rules?.maxSizeMb ?? FORM_UPLOAD.maxSizeMb), FORM_UPLOAD.maxSizeMbCeiling) : FORM_UPLOAD.maxSizeMb
4375
+ };
4376
+ }
4377
+ function fileFieldLimits(field) {
4378
+ return { ...formUploadLimits(field.validation, true), accept: formUploadAccept(field.validation?.accept) };
4379
+ }
4380
+
4236
4381
  // src/locator.ts
4237
4382
  var LANDMARK_SELECTOR = "header,nav,footer";
4238
4383
  var LANDMARK_TAGS = /* @__PURE__ */ new Set(["HEADER", "NAV", "FOOTER"]);
@@ -5012,6 +5157,10 @@ export {
5012
5157
  FIELD_SIZE_ZOOM,
5013
5158
  FIELD_STYLE_KEYS,
5014
5159
  FOOTER_SECTION_ID,
5160
+ FORM_UPLOAD,
5161
+ FORM_UPLOAD_DEFAULT_ACCEPT,
5162
+ FORM_UPLOAD_PRESETS,
5163
+ FORM_UPLOAD_REFUSED_EXTENSIONS,
5015
5164
  FRAME_REFUSALS,
5016
5165
  HELP_CAPS,
5017
5166
  HELP_LINE_MAX,
@@ -5071,6 +5220,7 @@ export {
5071
5220
  SPACE_BOTTOM_TOKENS,
5072
5221
  SPACE_STEP_TOKENS,
5073
5222
  TABLE_COLUMN_TYPES,
5223
+ TABLE_CSS,
5074
5224
  TABLE_JSONLD_TYPES,
5075
5225
  TABLE_LIMITS,
5076
5226
  TABLE_RESPONSIVE,
@@ -5122,6 +5272,10 @@ export {
5122
5272
  fieldGroupOf,
5123
5273
  fieldStyleCssText,
5124
5274
  fieldStyleToCss,
5275
+ fileExtension,
5276
+ fileFieldLimits,
5277
+ formUploadAccept,
5278
+ formUploadLimits,
5125
5279
  formatNumber,
5126
5280
  formatPropsAttribute,
5127
5281
  getBlockType,
@@ -5144,6 +5298,7 @@ export {
5144
5298
  isEmbedReason,
5145
5299
  isIconObjectForm,
5146
5300
  isLinkObject,
5301
+ isRefusedUploadExtension,
5147
5302
  isReservedKey,
5148
5303
  isRoleKey,
5149
5304
  isRulePaired,