@bettercms-ai/types 1.50.2 → 1.51.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 +77 -5
- package/dist/index.js +157 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -574,7 +574,7 @@ type ZoneField = ContentModelField;
|
|
|
574
574
|
* wording improves), a person in the dashboard (`human`) or an agent over the API (`agent`). Only
|
|
575
575
|
* `auto` text is ever replaced. Server-owned: a client's copy is ignored.
|
|
576
576
|
*/
|
|
577
|
-
type HelpSource = "auto" | "human" | "agent";
|
|
577
|
+
type HelpSource = "auto" | "site" | "human" | "agent";
|
|
578
578
|
|
|
579
579
|
/**
|
|
580
580
|
* Page — a published content page within a workspace.
|
|
@@ -1860,7 +1860,7 @@ interface LayoutFieldDefinition {
|
|
|
1860
1860
|
/** Shown to editors under the field. */
|
|
1861
1861
|
helpText?: string;
|
|
1862
1862
|
/** Server-owned: who wrote `helpText`. */
|
|
1863
|
-
helpSource?: "auto" | "human" | "agent";
|
|
1863
|
+
helpSource?: "auto" | "site" | "human" | "agent";
|
|
1864
1864
|
/** `true`: no route the last release inspected renders this field — hidden, never deleted. `false`: a person keeps it shown. */
|
|
1865
1865
|
stale?: boolean;
|
|
1866
1866
|
/** false: a page may not override this value; the Global value renders on every page. Absent = true. */
|
|
@@ -2361,7 +2361,7 @@ interface ComponentPropDef {
|
|
|
2361
2361
|
/** Hint shown under the control, muted. */
|
|
2362
2362
|
helpText?: string;
|
|
2363
2363
|
/** Server-owned: who wrote `helpText`. */
|
|
2364
|
-
helpSource?: "auto" | "human" | "agent";
|
|
2364
|
+
helpSource?: "auto" | "site" | "human" | "agent";
|
|
2365
2365
|
/** Ghost text inside a text-ish control. */
|
|
2366
2366
|
placeholder?: string;
|
|
2367
2367
|
/**
|
|
@@ -2540,7 +2540,7 @@ interface ComponentSubField {
|
|
|
2540
2540
|
/** The same editor hints as the prop above, one level down. @see ComponentPropDef */
|
|
2541
2541
|
required?: boolean;
|
|
2542
2542
|
helpText?: string;
|
|
2543
|
-
helpSource?: "auto" | "human" | "agent";
|
|
2543
|
+
helpSource?: "auto" | "site" | "human" | "agent";
|
|
2544
2544
|
placeholder?: string;
|
|
2545
2545
|
options?: Array<string | ChoiceOption>;
|
|
2546
2546
|
/** The V2 editor keys, one level down. `showIf` names SIBLING sub-fields. @see ComponentPropDef */
|
|
@@ -2785,6 +2785,53 @@ declare function slotShapeProblems(value: unknown, opts?: SlotShapeOptions): Slo
|
|
|
2785
2785
|
/** `rows[2]._key`-style path text for a problem path. */
|
|
2786
2786
|
declare const slotPathString: (path: Array<string | number>) => string;
|
|
2787
2787
|
|
|
2788
|
+
/**
|
|
2789
|
+
* What the dock says under a field, as data both sides read: the backend's generator
|
|
2790
|
+
* (src/lib/content/help-text.ts) writes the role sentence and the control's how-to into the
|
|
2791
|
+
* stored `helpText`; the dashboard adds a list column's example per row ({@link exampleFor}),
|
|
2792
|
+
* because the example depends on WHICH row is open and a stored line has one value for all rows.
|
|
2793
|
+
*
|
|
2794
|
+
* A field's help, joined with single spaces, at most {@link HELP_MAX} characters (two dock lines):
|
|
2795
|
+
* 1. a role sentence (@see ROLE_HELP), or the site's own words where the markup has them;
|
|
2796
|
+
* 2. the control's how-to (@see CONTROL_HELP), only where the canvas has the gesture it names;
|
|
2797
|
+
* 3. for a column of a list, `e.g. "<value>"` from the nearest OTHER row.
|
|
2798
|
+
*
|
|
2799
|
+
* Pure. No DOM, no I/O.
|
|
2800
|
+
*/
|
|
2801
|
+
/** Two dock lines at 12px in a ~250px column. */
|
|
2802
|
+
declare const HELP_MAX = 160;
|
|
2803
|
+
/**
|
|
2804
|
+
* What one role holds, said once: the role words a structural key ends in (@see ROLE_KEYS in
|
|
2805
|
+
* sections.ts, and the server's ROLE_VOCABULARY), plus the words a band's shape and a list give.
|
|
2806
|
+
* Never the label again, never writing advice.
|
|
2807
|
+
*/
|
|
2808
|
+
declare const ROLE_HELP: Readonly<Record<string, string>>;
|
|
2809
|
+
/**
|
|
2810
|
+
* The canvas gestures a how-to may name, each one a control the Visual Editor draws:
|
|
2811
|
+
* rows.reorder — a selected row's grip (dashboard canvas/dnd/RowGrip.tsx);
|
|
2812
|
+
* image.replace — a click on a picture opens its popover (CanvasImagePopover.tsx);
|
|
2813
|
+
* link.popover — a click on a button or link opens its editor (CanvasButtonPopover.tsx);
|
|
2814
|
+
* text.inline — a click on copy puts the caret in it (canvasInlineText.ts).
|
|
2815
|
+
* The dashboard exports the same names beside those components (CANVAS_GESTURES) and its test
|
|
2816
|
+
* fails when one is missing.
|
|
2817
|
+
*/
|
|
2818
|
+
declare const CANVAS_GESTURE_NAMES: readonly ["rows.reorder", "image.replace", "link.popover", "text.inline"];
|
|
2819
|
+
type CanvasGesture = (typeof CANVAS_GESTURE_NAMES)[number];
|
|
2820
|
+
/** A control kind the canvas can also edit. A kind with no gesture (an icon, a switch) has no how-to. */
|
|
2821
|
+
type ControlKind = "rows" | "image" | "link" | "text";
|
|
2822
|
+
declare const CONTROL_HELP: Readonly<Record<ControlKind, {
|
|
2823
|
+
text: string;
|
|
2824
|
+
gesture: CanvasGesture;
|
|
2825
|
+
}>>;
|
|
2826
|
+
/**
|
|
2827
|
+
* `e.g. "<value>"` for column `column` of row `i`: the nearest OTHER row's value (i-1, then i+1,
|
|
2828
|
+
* then further out), the first non-empty one that differs from row i's own. When none differs, or
|
|
2829
|
+
* there is one row, row i's own value. Undefined when the column holds no quotable words.
|
|
2830
|
+
*/
|
|
2831
|
+
declare function exampleFor(column: string, rows: readonly unknown[], i: number): string | undefined;
|
|
2832
|
+
/** A stored line with its row's example after it: one space between, the example dropped rather than run past {@link HELP_MAX}. */
|
|
2833
|
+
declare function withExample(help: string | undefined, example: string | undefined): string | undefined;
|
|
2834
|
+
|
|
2788
2835
|
/**
|
|
2789
2836
|
* The dock's click budget, as ONE pure function both ends read (V9): the backend's next-steps
|
|
2790
2837
|
* rules call it on live data, and the dashboard's reach test measures its RENDERED dock against the
|
|
@@ -2954,6 +3001,31 @@ declare function derivedPairs(candidates: readonly ButtonLinkCandidate[]): Map<n
|
|
|
2954
3001
|
/** Every unambiguous pair in one sibling list, as `[textIndex, linkIndex]`, in list order. */
|
|
2955
3002
|
declare function buttonLinkPairs(candidates: readonly ButtonLinkCandidate[]): Array<[number, number]>;
|
|
2956
3003
|
|
|
3004
|
+
/**
|
|
3005
|
+
* THE link-label rule, pure: which sibling a text LABEL links with by its name alone. A label that pairs
|
|
3006
|
+
* is one link to the author (the dashboard's `linkLabelHref`: a click opens the Link popover over both
|
|
3007
|
+
* values); one that does not is plain text, unless the owner names its partner (`config.linkHref`, the
|
|
3008
|
+
* editable plan's `link-pair` answer).
|
|
3009
|
+
*
|
|
3010
|
+
* 1. `<key>` pairs with `<key>-href` (the annotator's spelling).
|
|
3011
|
+
* 2. `label` pairs with `label-href`, `href`, `url` or `link`, first found (a nav or footer row).
|
|
3012
|
+
* 3. The partner must be link-typed (`link`, `url`).
|
|
3013
|
+
*
|
|
3014
|
+
* The plan asks only about the pairs this rule misses. Its twin is the dashboard's `linkLabelHref`
|
|
3015
|
+
* (src/features/live-preview/identity/controlAt.ts), proven against one fixture on both sides
|
|
3016
|
+
* (`__tests__/fixtures/link-pairs.json`).
|
|
3017
|
+
*/
|
|
3018
|
+
/** A sibling as either side spells it: a stored field (`key`) or a V2 schema field (`name`). */
|
|
3019
|
+
interface LinkPairSibling {
|
|
3020
|
+
name?: string;
|
|
3021
|
+
key?: string;
|
|
3022
|
+
type?: string;
|
|
3023
|
+
}
|
|
3024
|
+
/** The sibling the rule pairs `labelKey` with, or null. PURE. */
|
|
3025
|
+
declare function rulePartnerOf(labelKey: string, siblings: readonly LinkPairSibling[]): string | null;
|
|
3026
|
+
/** Does the rule pair `labelKey` with a link-typed sibling by name? PURE. */
|
|
3027
|
+
declare const isRulePaired: (labelKey: string, siblings: readonly LinkPairSibling[]) => boolean;
|
|
3028
|
+
|
|
2957
3029
|
/**
|
|
2958
3030
|
* The V2 video value (DESIGN.md §6.2, §8.15): a pasted provider link or a file URL, as a bare
|
|
2959
3031
|
* string or as `{ url, poster?, autoplay?, loop?, transcript? }`.
|
|
@@ -3929,4 +4001,4 @@ type SectionPlanItem<B> = {
|
|
|
3929
4001
|
*/
|
|
3930
4002
|
declare function planSections<B>(slots: readonly string[], blocks: readonly B[] | null | undefined): SectionPlanItem<B>[];
|
|
3931
4003
|
|
|
3932
|
-
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, 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, CODE_SLOT_PREFIX, COMPONENT_PROP_TYPES, type CanonicalInputDefinition, 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 ComponentVariantGroup, type Content, type ContentBlock, type ContentEntry, type ContentModel, type ContentModelField, type ContentModelFieldType, type ContentModelFieldUi, type ContentPageResult, type ContentResponse, type ContentWidthToken, type CornerToken, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, type DeepReadonly, 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, type HeadingBlock, type HeadingProps, IMAGE_ASPECTS, IMAGE_FRAME_RADIUS, type ImageAspect, type ImageBlock, type ImageProps, 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 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_KEYS, type RadiusToken, type ReadButtonValue, type Redirect, type ReservedLayoutSection, type ResolvedLayoutNode, type RichTextBlock, type RichTextProps, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SIDE_SPACE_MIN_PX, SIDE_SPACE_TOKENS, SLOT_CHILD_KEYS, SLOT_ITEMS_CAP, SLOT_MAX_ITEMS, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type ScaleUnit, 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 SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, TABLE_COLUMN_TYPES, TABLE_JSONLD_TYPES, TABLE_LIMITS, TABLE_RESPONSIVE, 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, type UiBefore, type UiOrigin, VIDEO_TRANSCRIPT_MAX, VIDEO_VALUE_KEYS, 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, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, expandBlockBindings, fieldGroupOf, fieldStyleCssText, fieldStyleToCss, formatNumber, formatPropsAttribute, getBlockType, headingPaintCss, hiddenEverywhere, hideOnAttr, imageFrameCss, inWindow, isBlock, isButtonLookValue, isChromeLandmark, isCodeButton, isLinkObject, isRoleKey, isScriptHref, isSlotChild, isTableValue, keyWords, landmarkRegions, linkAnchorOf, linkHref, linkRefOf, linkValueProblem, locatorFor, locatorPath, normalizeLinkValue, normalizeTableValue, normalizeWindow, parseNumberText, parsePropsAttribute, pickFieldStyle, placementBindOf, planSections, readButtonValue, readNumberFormat, readPath, regionOf, renderTableHtml, safeCssUrl, sideFloorApplies, sideSpaceCss, slotBindOf, slotChildValues, slotItems, slotPathString, slotShapeProblems, spaceTokenCss, splitButtonStyle, tableCellText, tablePathString, tableRefCells, tableSearchText, tableToMarkdown, tableValueProblems, topFieldKeyOf, usesHideOn, videoUrlOf, videoValueProblem, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps };
|
|
4004
|
+
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, 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 ComponentVariantGroup, type Content, type ContentBlock, type ContentEntry, type ContentModel, type ContentModelField, type ContentModelFieldType, type ContentModelFieldUi, type ContentPageResult, type ContentResponse, type ContentWidthToken, type ControlKind, type CornerToken, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, type DeepReadonly, 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_MAX, type HeadingBlock, type HeadingProps, IMAGE_ASPECTS, IMAGE_FRAME_RADIUS, type ImageAspect, type ImageBlock, type ImageProps, 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, SIDE_SPACE_MIN_PX, SIDE_SPACE_TOKENS, SLOT_CHILD_KEYS, SLOT_ITEMS_CAP, SLOT_MAX_ITEMS, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type ScaleUnit, 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 SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, TABLE_COLUMN_TYPES, TABLE_JSONLD_TYPES, TABLE_LIMITS, TABLE_RESPONSIVE, 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, type UiBefore, type UiOrigin, VIDEO_TRANSCRIPT_MAX, VIDEO_VALUE_KEYS, 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, 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, keyWords, landmarkRegions, linkAnchorOf, linkHref, linkRefOf, linkValueProblem, locatorFor, locatorPath, 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, usesHideOn, videoUrlOf, videoValueProblem, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps, withExample };
|
package/dist/index.js
CHANGED
|
@@ -3159,6 +3159,138 @@ var DOCK_ICON_NAMES = [
|
|
|
3159
3159
|
];
|
|
3160
3160
|
var DOCK_ICON_NAME_SET = new Set(DOCK_ICON_NAMES);
|
|
3161
3161
|
|
|
3162
|
+
// src/help-catalog.ts
|
|
3163
|
+
var HELP_MAX = 160;
|
|
3164
|
+
var ROLE_HELP = {
|
|
3165
|
+
// A top-level field's role in its section.
|
|
3166
|
+
headline: "The page's main heading, one per page.",
|
|
3167
|
+
heading: "The heading of this section.",
|
|
3168
|
+
subheading: "Shown under the heading.",
|
|
3169
|
+
eyebrow: "Short label shown above the heading.",
|
|
3170
|
+
intro: "Shown under the heading. One or two sentences.",
|
|
3171
|
+
paragraph: "A paragraph of text.",
|
|
3172
|
+
text: "Text shown on the page.",
|
|
3173
|
+
"primary-button": "The main call to action.",
|
|
3174
|
+
"secondary-button": "The second call to action.",
|
|
3175
|
+
button: "Its text, where it goes and how it looks.",
|
|
3176
|
+
"button-label": "Text on the button. Two to four words works best.",
|
|
3177
|
+
link: "Text of this link. Say where it leads.",
|
|
3178
|
+
"home-link": "Takes visitors back to the home page.",
|
|
3179
|
+
destination: "Pick a page or paste a full URL.",
|
|
3180
|
+
image: "An image shown on the page.",
|
|
3181
|
+
icon: "Optional icon before the label.",
|
|
3182
|
+
logo: "An SVG or transparent PNG works best.",
|
|
3183
|
+
"background-image": "Text sits on top of it, so a calm image works best.",
|
|
3184
|
+
"video-poster": "Shown before the video plays.",
|
|
3185
|
+
video: "Paste a link or upload an MP4.",
|
|
3186
|
+
embed: "Paste the link the other site gives you to share it.",
|
|
3187
|
+
audio: "Paste a link or upload an audio file.",
|
|
3188
|
+
body: "Headings, paragraphs, lists and links, edited as one.",
|
|
3189
|
+
content: "Headings, paragraphs, lists and links, edited as one.",
|
|
3190
|
+
copyright: "Shown at the bottom of every page.",
|
|
3191
|
+
email: "An email address, such as name@example.com.",
|
|
3192
|
+
phone: "A phone number, with its country code.",
|
|
3193
|
+
price: "Whole number, no currency symbol.",
|
|
3194
|
+
percentage: "A number with its % sign.",
|
|
3195
|
+
number: "A figure shown on the page.",
|
|
3196
|
+
date: "A date, written as it should appear.",
|
|
3197
|
+
"stat-value": "A figure shown large, such as 70k+.",
|
|
3198
|
+
"stat-label": "What the figure counts.",
|
|
3199
|
+
quote: "Without quote marks.",
|
|
3200
|
+
attribution: "Who said it.",
|
|
3201
|
+
caption: "Shown under the image.",
|
|
3202
|
+
label: "A short label.",
|
|
3203
|
+
summary: "Shown in lists and previews.",
|
|
3204
|
+
address: "The postal address, as it should appear.",
|
|
3205
|
+
code: "Shown exactly as written.",
|
|
3206
|
+
term: "The word or phrase being explained.",
|
|
3207
|
+
definition: "What the term means.",
|
|
3208
|
+
"table-heading": "Heading of a table column.",
|
|
3209
|
+
"table-cell": "One cell of the table.",
|
|
3210
|
+
"list-item": "One item of the list.",
|
|
3211
|
+
list: "One item per row.",
|
|
3212
|
+
links: "One link per row.",
|
|
3213
|
+
band: "All the text of this section, edited as one.",
|
|
3214
|
+
// A column's role in its row.
|
|
3215
|
+
title: "The title of this item.",
|
|
3216
|
+
subtitle: "Shown under the title.",
|
|
3217
|
+
description: "One line under the name.",
|
|
3218
|
+
value: "The value shown for this item.",
|
|
3219
|
+
// What a band's shape calls an element.
|
|
3220
|
+
"plan-name": "Short name of this plan, shown at the top of its card.",
|
|
3221
|
+
cents: "Digits after the decimal point.",
|
|
3222
|
+
"billing-period": "How often the price is charged.",
|
|
3223
|
+
// The parts of a plan's price object.
|
|
3224
|
+
amount: "Whole number, no currency symbol.",
|
|
3225
|
+
period: "How often the price is charged.",
|
|
3226
|
+
badge: "Optional. Two or three words that make this plan stand out.",
|
|
3227
|
+
features: "One feature per row.",
|
|
3228
|
+
question: "One question, as a customer would ask it.",
|
|
3229
|
+
answer: "Shown when the question is opened.",
|
|
3230
|
+
author: "The person's full name.",
|
|
3231
|
+
role: "Their job title and company.",
|
|
3232
|
+
// What an attribute is, by what carries it.
|
|
3233
|
+
tooltip: "Shown when the pointer rests on it.",
|
|
3234
|
+
placeholder: "Shown in the empty input.",
|
|
3235
|
+
"image-description": "Read by screen readers, not shown on the page.",
|
|
3236
|
+
"counter-target": "The number the counter runs up to.",
|
|
3237
|
+
attribute: "A setting of this element, not shown as text.",
|
|
3238
|
+
"navigation-label": "Read by screen readers, not shown on the page.",
|
|
3239
|
+
"link-label": "Read by screen readers, not shown on the page.",
|
|
3240
|
+
"image-label": "Read by screen readers, not shown on the page.",
|
|
3241
|
+
"field-label": "Read by screen readers, not shown on the page.",
|
|
3242
|
+
"header-label": "Read by screen readers, not shown on the page.",
|
|
3243
|
+
"footer-label": "Read by screen readers, not shown on the page.",
|
|
3244
|
+
"aside-label": "Read by screen readers, not shown on the page.",
|
|
3245
|
+
"section-label": "Read by screen readers, not shown on the page.",
|
|
3246
|
+
"heading-label": "Read by screen readers, not shown on the page.",
|
|
3247
|
+
// What a list's rows are.
|
|
3248
|
+
plans: "One plan per card.",
|
|
3249
|
+
questions: "One question and its answer per row.",
|
|
3250
|
+
quotes: "One quote per row, with who said it.",
|
|
3251
|
+
testimonials: "One quote per row, with who said it.",
|
|
3252
|
+
stats: "One figure per row, with what it counts.",
|
|
3253
|
+
logos: "One logo per row.",
|
|
3254
|
+
cards: "One card per row.",
|
|
3255
|
+
items: "One item per row."
|
|
3256
|
+
};
|
|
3257
|
+
var CANVAS_GESTURE_NAMES = ["rows.reorder", "image.replace", "link.popover", "text.inline"];
|
|
3258
|
+
var CONTROL_HELP = {
|
|
3259
|
+
rows: { text: "Drag to reorder. You can also drag rows on the canvas.", gesture: "rows.reorder" },
|
|
3260
|
+
image: { text: "You can also click it on the canvas to replace it.", gesture: "image.replace" },
|
|
3261
|
+
link: { text: "Click it on the canvas to change where it goes.", gesture: "link.popover" },
|
|
3262
|
+
text: { text: "You can also edit it on the canvas.", gesture: "text.inline" }
|
|
3263
|
+
};
|
|
3264
|
+
var EXAMPLE_MAX = 40;
|
|
3265
|
+
function sayOf(value) {
|
|
3266
|
+
if (typeof value === "number") return String(value);
|
|
3267
|
+
const v = value;
|
|
3268
|
+
const raw = typeof value === "string" ? value : typeof v?.html === "string" ? v.html : typeof v?.label === "string" ? v.label : typeof v?.text === "string" ? v.text : "";
|
|
3269
|
+
return raw.replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/\s+/g, " ").trim();
|
|
3270
|
+
}
|
|
3271
|
+
var quotable = (s) => s !== "" && s.length <= EXAMPLE_MAX && !s.includes('"');
|
|
3272
|
+
function exampleFor(column, rows, i) {
|
|
3273
|
+
const at = (j) => {
|
|
3274
|
+
const row = rows[j];
|
|
3275
|
+
return row && typeof row === "object" ? sayOf(row[column]) : "";
|
|
3276
|
+
};
|
|
3277
|
+
const own2 = at(i);
|
|
3278
|
+
for (let d = 1; d < rows.length; d += 1) {
|
|
3279
|
+
for (const j of [i - d, i + d]) {
|
|
3280
|
+
if (j < 0 || j >= rows.length) continue;
|
|
3281
|
+
const v = at(j);
|
|
3282
|
+
if (v !== own2 && quotable(v)) return `e.g. "${v}"`;
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
return quotable(own2) ? `e.g. "${own2}"` : void 0;
|
|
3286
|
+
}
|
|
3287
|
+
function withExample(help, example) {
|
|
3288
|
+
if (!example) return help;
|
|
3289
|
+
if (!help) return example;
|
|
3290
|
+
const joined = `${help} ${example}`;
|
|
3291
|
+
return joined.length <= HELP_MAX ? joined : help;
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3162
3294
|
// src/dock-budget.ts
|
|
3163
3295
|
var DOCK_BUDGET = { ungrouped: 8, group: 12, depth: 3, activations: 2 };
|
|
3164
3296
|
function listItems(f) {
|
|
@@ -3408,6 +3540,19 @@ function buttonLinkPairs(candidates) {
|
|
|
3408
3540
|
return [...proposals.values()].filter(([t, l]) => !ambiguous.has(t) && !ambiguous.has(l) && uses.get(t) === 1 && uses.get(l) === 1).sort((a, b) => Math.min(...a) - Math.min(...b));
|
|
3409
3541
|
}
|
|
3410
3542
|
|
|
3543
|
+
// src/link-pairs.ts
|
|
3544
|
+
var LINK_TYPES2 = /* @__PURE__ */ new Set(["link", "url"]);
|
|
3545
|
+
var nameOf = (s) => s.name ?? s.key;
|
|
3546
|
+
function rulePartnerOf(labelKey, siblings) {
|
|
3547
|
+
const names = labelKey === "label" ? ["label-href", "href", "url", "link"] : [`${labelKey}-href`];
|
|
3548
|
+
for (const n of names) {
|
|
3549
|
+
const s = siblings.find((f) => nameOf(f) === n);
|
|
3550
|
+
if (s && LINK_TYPES2.has(s.type ?? "")) return n;
|
|
3551
|
+
}
|
|
3552
|
+
return null;
|
|
3553
|
+
}
|
|
3554
|
+
var isRulePaired = (labelKey, siblings) => rulePartnerOf(labelKey, siblings) !== null;
|
|
3555
|
+
|
|
3411
3556
|
// src/button-look.ts
|
|
3412
3557
|
import { ICON_MARKUP, iconSvg } from "@bettercms-ai/icons/markup";
|
|
3413
3558
|
|
|
@@ -4340,7 +4485,9 @@ var ROLE_KEYS = /* @__PURE__ */ new Set([
|
|
|
4340
4485
|
"tooltip",
|
|
4341
4486
|
"placeholder",
|
|
4342
4487
|
"image-description",
|
|
4343
|
-
"counter-target"
|
|
4488
|
+
"counter-target",
|
|
4489
|
+
"amount",
|
|
4490
|
+
"period"
|
|
4344
4491
|
]);
|
|
4345
4492
|
var ROLE_TAILS = /(?:-label)?(?:-[a-z])?(?:-\d+)?(?:-href)?$/;
|
|
4346
4493
|
function isRoleKey(key) {
|
|
@@ -4415,8 +4562,10 @@ export {
|
|
|
4415
4562
|
BUTTON_PLACEMENT_KEYS,
|
|
4416
4563
|
BUTTON_SIZES,
|
|
4417
4564
|
BUTTON_VARIANTS,
|
|
4565
|
+
CANVAS_GESTURE_NAMES,
|
|
4418
4566
|
CODE_SLOT_PREFIX,
|
|
4419
4567
|
COMPONENT_PROP_TYPES,
|
|
4568
|
+
CONTROL_HELP,
|
|
4420
4569
|
DIALOG_SELECTOR,
|
|
4421
4570
|
DOCK_BUDGET,
|
|
4422
4571
|
DOCK_ICON_NAMES,
|
|
@@ -4424,6 +4573,7 @@ export {
|
|
|
4424
4573
|
FIELD_SIZE_ZOOM,
|
|
4425
4574
|
FIELD_STYLE_KEYS,
|
|
4426
4575
|
FOOTER_SECTION_ID,
|
|
4576
|
+
HELP_MAX,
|
|
4427
4577
|
IMAGE_ASPECTS,
|
|
4428
4578
|
IMAGE_FRAME_RADIUS,
|
|
4429
4579
|
LANDMARK_SELECTOR,
|
|
@@ -4438,6 +4588,7 @@ export {
|
|
|
4438
4588
|
OPTION_DESCRIPTION_MAX,
|
|
4439
4589
|
PAGE_CONTENT_ANCHOR_ID,
|
|
4440
4590
|
RESPONSIVE_CSS,
|
|
4591
|
+
ROLE_HELP,
|
|
4441
4592
|
ROLE_KEYS,
|
|
4442
4593
|
SECTION_DOCTRINE,
|
|
4443
4594
|
SECTION_SPACE_TOKENS,
|
|
@@ -4477,6 +4628,7 @@ export {
|
|
|
4477
4628
|
derivedPairs,
|
|
4478
4629
|
dockBudget,
|
|
4479
4630
|
dockScreens,
|
|
4631
|
+
exampleFor,
|
|
4480
4632
|
expandBlockBindings,
|
|
4481
4633
|
fieldGroupOf,
|
|
4482
4634
|
fieldStyleCssText,
|
|
@@ -4495,6 +4647,7 @@ export {
|
|
|
4495
4647
|
isCodeButton,
|
|
4496
4648
|
isLinkObject,
|
|
4497
4649
|
isRoleKey,
|
|
4650
|
+
isRulePaired,
|
|
4498
4651
|
isScriptHref,
|
|
4499
4652
|
isSlotChild,
|
|
4500
4653
|
isTableValue,
|
|
@@ -4519,6 +4672,7 @@ export {
|
|
|
4519
4672
|
readPath,
|
|
4520
4673
|
regionOf,
|
|
4521
4674
|
renderTableHtml,
|
|
4675
|
+
rulePartnerOf,
|
|
4522
4676
|
safeCssUrl,
|
|
4523
4677
|
sideFloorApplies,
|
|
4524
4678
|
sideSpaceCss,
|
|
@@ -4543,6 +4697,7 @@ export {
|
|
|
4543
4697
|
visibleDeliveredLayout,
|
|
4544
4698
|
visibleLayoutStructure,
|
|
4545
4699
|
windowState,
|
|
4546
|
-
withButtonLookProps
|
|
4700
|
+
withButtonLookProps,
|
|
4701
|
+
withExample
|
|
4547
4702
|
};
|
|
4548
4703
|
//# sourceMappingURL=index.js.map
|