@bettercms-ai/types 1.38.0 → 1.40.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/README.md +18 -18
- package/dist/index.d.ts +192 -12
- package/dist/index.js +137 -2
- package/dist/index.js.map +1 -1
- package/package.json +34 -34
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# @bettercms-ai/types
|
|
2
|
-
|
|
3
|
-
Pure TypeScript type definitions for BetterCMS.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @bettercms-ai/types --registry=https://npm.pkg.github.com/
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import type { Workspace, Page, ContentBlock } from "@bettercms-ai/types"
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## License
|
|
18
|
-
Private - bettercms.ai
|
|
1
|
+
# @bettercms-ai/types
|
|
2
|
+
|
|
3
|
+
Pure TypeScript type definitions for BetterCMS.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @bettercms-ai/types --registry=https://npm.pkg.github.com/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { Workspace, Page, ContentBlock } from "@bettercms-ai/types"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## License
|
|
18
|
+
Private - bettercms.ai
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface ContentModel {
|
|
|
48
48
|
* by the API but normalized to `array` + zones on write, so stored/delivered
|
|
49
49
|
* content never contains them.
|
|
50
50
|
*/
|
|
51
|
-
type ContentModelFieldType = "text" | "richtext" | "document" | "image" | "boolean" | "number" | "select" | "reference" | "multi-reference" | "multiReference" | "array" | "date" | "datetime" | "longtext" | "slug" | "email" | "phone" | "link" | "color" | "json" | "file" | "component-ref" | "modular" | "sections" | "location" | "button";
|
|
51
|
+
type ContentModelFieldType = "text" | "richtext" | "document" | "image" | "boolean" | "number" | "select" | "reference" | "multi-reference" | "multiReference" | "array" | "date" | "datetime" | "longtext" | "slug" | "email" | "phone" | "link" | "color" | "json" | "file" | "component-ref" | "modular" | "sections" | "location" | "button" | "multiselect" | "icon";
|
|
52
52
|
type ContentModelKind = "model" | "block";
|
|
53
53
|
/**
|
|
54
54
|
* How a fieldset renders in the dock. ABSENT ≡ today's flat list (V2): a legacy `{id, name}`
|
|
@@ -315,9 +315,10 @@ interface ContentModelFieldUi {
|
|
|
315
315
|
/**
|
|
316
316
|
* Which editor control a LEAF renders with. ABSENT ≡ the type's default (a dropdown for a
|
|
317
317
|
* `select`, a plain input for a `number`). `segmented` is valid on a single-choice `select`;
|
|
318
|
-
* `slider` on a `number` whose config.min < config.max
|
|
318
|
+
* `slider` on a `number` whose config.min < config.max; `rating` on a `number` with numeric
|
|
319
|
+
* config.min, max and step (stars).
|
|
319
320
|
*/
|
|
320
|
-
control?: "segmented" | "slider";
|
|
321
|
+
control?: "segmented" | "slider" | "rating";
|
|
321
322
|
/** The branch row's icon. Nesting fields only. */
|
|
322
323
|
icon?: DockIconName;
|
|
323
324
|
/** What one item is called ("Slide", "Member"), 1–24 chars. Nesting fields only. */
|
|
@@ -545,6 +546,11 @@ interface BlockStyle {
|
|
|
545
546
|
bgImage?: string;
|
|
546
547
|
/** A button's look while the pointer is over it. Only the paint changes; unset keys keep the rest. */
|
|
547
548
|
hover?: BlockHoverStyle;
|
|
549
|
+
/**
|
|
550
|
+
* Breakpoints the block is hidden on (`display:none` there only; the block stays in the HTML).
|
|
551
|
+
* Never all three: a block hidden everywhere is a delete. Bands: see `BREAKPOINTS`.
|
|
552
|
+
*/
|
|
553
|
+
hideOn?: Array<"mobile" | "tablet" | "desktop">;
|
|
548
554
|
}
|
|
549
555
|
/** The paint a button swaps to on hover: fill, text colour, and the all-round border. */
|
|
550
556
|
interface BlockHoverStyle {
|
|
@@ -553,6 +559,47 @@ interface BlockHoverStyle {
|
|
|
553
559
|
textColor?: ColorToken;
|
|
554
560
|
border?: boolean;
|
|
555
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* Both bounds are INSTANTS: ISO 8601 with an offset, stored normalized to UTC seconds
|
|
564
|
+
* (`2026-11-27T00:00:00Z`). Shown from `from` (inclusive) until `until` (exclusive); a missing
|
|
565
|
+
* bound is open. An absent or null window is always shown.
|
|
566
|
+
*/
|
|
567
|
+
interface VisibilityWindow {
|
|
568
|
+
from?: string;
|
|
569
|
+
until?: string;
|
|
570
|
+
}
|
|
571
|
+
type WindowState = "live" | "pending" | "expired";
|
|
572
|
+
/**
|
|
573
|
+
* A written window, normalized for storage, or the code it is refused with. null, undefined and
|
|
574
|
+
* an object with neither bound are all "no window". UTC at seconds precision makes the stored
|
|
575
|
+
* strings sort in time order, which the due scan (`list_due_window_projects`) relies on.
|
|
576
|
+
*/
|
|
577
|
+
declare function normalizeWindow(value: unknown): {
|
|
578
|
+
window: VisibilityWindow | null;
|
|
579
|
+
} | {
|
|
580
|
+
error: "invalid_window" | "window_inverted";
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* Where `now` falls in a block's or Section's `window`. THE one reading of a window: every
|
|
584
|
+
* renderer, the delivery lanes and the in-place publish decide through it (or `inWindow`).
|
|
585
|
+
*
|
|
586
|
+
* `now` is an argument, never read from a clock here, so one request compares every block
|
|
587
|
+
* against the same instant. Bounds are compared as instants, so a stored offset cannot shift
|
|
588
|
+
* one. A bound that does not parse is read as open: a hand-edited row shows rather than vanishes.
|
|
589
|
+
*/
|
|
590
|
+
declare function windowState(item: unknown, now: Date | number): WindowState;
|
|
591
|
+
/** Is the block or Section shown at `now`? No window is always shown. */
|
|
592
|
+
declare const inWindow: (item: unknown, now: Date | number) => boolean;
|
|
593
|
+
/**
|
|
594
|
+
* The blocks shown at `now`: every block outside its window removed, at any depth (a section's
|
|
595
|
+
* children, columns, slides, tab panels). What a published lane renders, collects from and
|
|
596
|
+
* delivers.
|
|
597
|
+
*
|
|
598
|
+
* Returns the SAME array when nothing is removed, so a tree with no window costs one walk and
|
|
599
|
+
* every consumer downstream is handed exactly what it was handed before windows existed.
|
|
600
|
+
* Non-array input is returned as it came.
|
|
601
|
+
*/
|
|
602
|
+
declare function visibleBlocks<T>(blocks: T, now: Date | number): T;
|
|
556
603
|
interface HeadingProps {
|
|
557
604
|
text: string;
|
|
558
605
|
level?: 1 | 2 | 3;
|
|
@@ -563,6 +610,8 @@ interface HeadingBlock {
|
|
|
563
610
|
style?: BlockStyle;
|
|
564
611
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
565
612
|
label?: string;
|
|
613
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
614
|
+
window?: VisibilityWindow;
|
|
566
615
|
props: HeadingProps;
|
|
567
616
|
}
|
|
568
617
|
interface TextProps {
|
|
@@ -576,6 +625,8 @@ interface TextBlock {
|
|
|
576
625
|
style?: BlockStyle;
|
|
577
626
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
578
627
|
label?: string;
|
|
628
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
629
|
+
window?: VisibilityWindow;
|
|
579
630
|
props: TextProps;
|
|
580
631
|
}
|
|
581
632
|
/**
|
|
@@ -646,6 +697,8 @@ interface RichTextBlock {
|
|
|
646
697
|
style?: BlockStyle;
|
|
647
698
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
648
699
|
label?: string;
|
|
700
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
701
|
+
window?: VisibilityWindow;
|
|
649
702
|
props: RichTextProps;
|
|
650
703
|
}
|
|
651
704
|
interface ImageProps {
|
|
@@ -661,6 +714,8 @@ interface ImageBlock {
|
|
|
661
714
|
style?: BlockStyle;
|
|
662
715
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
663
716
|
label?: string;
|
|
717
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
718
|
+
window?: VisibilityWindow;
|
|
664
719
|
props: ImageProps;
|
|
665
720
|
}
|
|
666
721
|
interface ButtonProps {
|
|
@@ -687,6 +742,8 @@ interface ButtonBlock {
|
|
|
687
742
|
style?: BlockStyle;
|
|
688
743
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
689
744
|
label?: string;
|
|
745
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
746
|
+
window?: VisibilityWindow;
|
|
690
747
|
props: ButtonProps;
|
|
691
748
|
}
|
|
692
749
|
interface SpacerProps {
|
|
@@ -698,6 +755,8 @@ interface SpacerBlock {
|
|
|
698
755
|
style?: BlockStyle;
|
|
699
756
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
700
757
|
label?: string;
|
|
758
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
759
|
+
window?: VisibilityWindow;
|
|
701
760
|
props: SpacerProps;
|
|
702
761
|
}
|
|
703
762
|
interface ColumnsProps {
|
|
@@ -710,6 +769,8 @@ interface ColumnsBlock {
|
|
|
710
769
|
style?: BlockStyle;
|
|
711
770
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
712
771
|
label?: string;
|
|
772
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
773
|
+
window?: VisibilityWindow;
|
|
713
774
|
props: ColumnsProps;
|
|
714
775
|
}
|
|
715
776
|
interface VideoProps {
|
|
@@ -730,6 +791,8 @@ interface VideoBlock {
|
|
|
730
791
|
style?: BlockStyle;
|
|
731
792
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
732
793
|
label?: string;
|
|
794
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
795
|
+
window?: VisibilityWindow;
|
|
733
796
|
props: VideoProps;
|
|
734
797
|
}
|
|
735
798
|
interface FormProps {
|
|
@@ -741,6 +804,8 @@ interface FormBlock {
|
|
|
741
804
|
style?: BlockStyle;
|
|
742
805
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
743
806
|
label?: string;
|
|
807
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
808
|
+
window?: VisibilityWindow;
|
|
744
809
|
props: FormProps;
|
|
745
810
|
}
|
|
746
811
|
interface SectionProps {
|
|
@@ -755,6 +820,8 @@ interface SectionBlock {
|
|
|
755
820
|
style?: BlockStyle;
|
|
756
821
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
757
822
|
label?: string;
|
|
823
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
824
|
+
window?: VisibilityWindow;
|
|
758
825
|
props: SectionProps;
|
|
759
826
|
}
|
|
760
827
|
interface NavLink {
|
|
@@ -781,6 +848,8 @@ interface NavbarBlock {
|
|
|
781
848
|
style?: BlockStyle;
|
|
782
849
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
783
850
|
label?: string;
|
|
851
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
852
|
+
window?: VisibilityWindow;
|
|
784
853
|
props: NavbarProps;
|
|
785
854
|
}
|
|
786
855
|
interface FooterColumn {
|
|
@@ -797,6 +866,8 @@ interface FooterBlock {
|
|
|
797
866
|
style?: BlockStyle;
|
|
798
867
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
799
868
|
label?: string;
|
|
869
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
870
|
+
window?: VisibilityWindow;
|
|
800
871
|
props: FooterProps;
|
|
801
872
|
}
|
|
802
873
|
interface SlideItem {
|
|
@@ -815,6 +886,8 @@ interface SliderBlock {
|
|
|
815
886
|
style?: BlockStyle;
|
|
816
887
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
817
888
|
label?: string;
|
|
889
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
890
|
+
window?: VisibilityWindow;
|
|
818
891
|
props: SliderProps;
|
|
819
892
|
}
|
|
820
893
|
interface TabItem {
|
|
@@ -831,6 +904,8 @@ interface TabsBlock {
|
|
|
831
904
|
style?: BlockStyle;
|
|
832
905
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
833
906
|
label?: string;
|
|
907
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
908
|
+
window?: VisibilityWindow;
|
|
834
909
|
props: TabsProps;
|
|
835
910
|
}
|
|
836
911
|
interface ComponentProps {
|
|
@@ -868,6 +943,8 @@ interface ComponentBlock {
|
|
|
868
943
|
style?: BlockStyle;
|
|
869
944
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
870
945
|
label?: string;
|
|
946
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
947
|
+
window?: VisibilityWindow;
|
|
871
948
|
props: ComponentProps;
|
|
872
949
|
}
|
|
873
950
|
interface CollectionProps {
|
|
@@ -913,6 +990,8 @@ interface CollectionBlock {
|
|
|
913
990
|
style?: BlockStyle;
|
|
914
991
|
/** Editor-facing display name for this block's dock card. Not rendered. */
|
|
915
992
|
label?: string;
|
|
993
|
+
/** Shown only inside this window. Absent = always. @see VisibilityWindow */
|
|
994
|
+
window?: VisibilityWindow;
|
|
916
995
|
props: CollectionProps;
|
|
917
996
|
}
|
|
918
997
|
type ContentBlock = CollectionBlock | HeadingBlock | TextBlock | RichTextBlock | ImageBlock | ButtonBlock | SpacerBlock | ColumnsBlock | VideoBlock | FormBlock | SectionBlock | NavbarBlock | FooterBlock | SliderBlock | TabsBlock | ComponentBlock;
|
|
@@ -1108,6 +1187,30 @@ declare function componentInstanceAddresses(instanceBlockId: string, props: read
|
|
|
1108
1187
|
* render-page.ts. Unknown tokens are dropped — closed set, no arbitrary CSS.
|
|
1109
1188
|
*/
|
|
1110
1189
|
|
|
1190
|
+
/**
|
|
1191
|
+
* Where a block's `hideOn` bands start and end: mobile at most 767px, tablet 768-1023px, desktop
|
|
1192
|
+
* 1024px and up (the dock's 390 / 810 / 1280 canvases fall one in each band). A site's CSS
|
|
1193
|
+
* carries these numbers, so changing one shifts every published site's media queries.
|
|
1194
|
+
*/
|
|
1195
|
+
declare const BREAKPOINTS: {
|
|
1196
|
+
readonly mobile: 767;
|
|
1197
|
+
readonly tablet: 1023;
|
|
1198
|
+
};
|
|
1199
|
+
/**
|
|
1200
|
+
* The ONE stylesheet behind `data-bcms-hide="mobile tablet"`. `!important` because a block's own
|
|
1201
|
+
* inline `display` (`fullHeight` writes `display:flex`) would otherwise beat it. `display:none`
|
|
1202
|
+
* also takes the block out of the accessibility tree at that width. Hosted pages inline it in
|
|
1203
|
+
* the head, `<BcmsBlocks>` emits it when a block uses `hideOn`, and a site that renders its own
|
|
1204
|
+
* markup puts it in its global CSS.
|
|
1205
|
+
*/
|
|
1206
|
+
declare const RESPONSIVE_CSS: string;
|
|
1207
|
+
/**
|
|
1208
|
+
* The `data-bcms-hide` value for a block style (`"mobile tablet"`), or "" when it hides nowhere.
|
|
1209
|
+
* Closed set, fixed order, so a hand-edited row cannot put anything else into an attribute.
|
|
1210
|
+
*/
|
|
1211
|
+
declare function hideOnAttr(style: unknown): string;
|
|
1212
|
+
/** True when any block in the tree hides somewhere; lets a lane skip `RESPONSIVE_CSS` when unused. */
|
|
1213
|
+
declare function usesHideOn(blocks: unknown): boolean;
|
|
1111
1214
|
/**
|
|
1112
1215
|
* 🔴 The ONE place a free-form string is allowed near CSS: `bgImage` is author-supplied, so it is
|
|
1113
1216
|
* rejected — never escaped — unless it is an http(s) or root-relative url with nothing that could
|
|
@@ -1162,7 +1265,7 @@ declare function headingPaintCss(style: BlockStyle | undefined, opts?: {
|
|
|
1162
1265
|
* painted a box BEHIND the anchor, which kept its variant's own fill. 🔴 Twin of `PLACEMENT_KEYS`
|
|
1163
1266
|
* in src/lib/sites/render-page.ts; src/__tests__/sites/block-style-parity.test.ts pins the two.
|
|
1164
1267
|
*/
|
|
1165
|
-
declare const BUTTON_PLACEMENT_KEYS: readonly ["align", "contentAlign", "contentWidth", "marginTop", "marginBottom", "fullHeight", "spaceTop", "spaceBottom"];
|
|
1268
|
+
declare const BUTTON_PLACEMENT_KEYS: readonly ["align", "contentAlign", "contentWidth", "marginTop", "marginBottom", "fullHeight", "spaceTop", "spaceBottom", "hideOn"];
|
|
1166
1269
|
/**
|
|
1167
1270
|
* A button's style split in two: `placement` (the keys its wrapper keeps — feed it to
|
|
1168
1271
|
* `blockStyleToCss` / `blockStyleToInnerCss` exactly like any block's style) and `paint`, the
|
|
@@ -1177,14 +1280,25 @@ declare function splitButtonStyle(style: BlockStyle | undefined): {
|
|
|
1177
1280
|
};
|
|
1178
1281
|
/**
|
|
1179
1282
|
* The style keys a PAGE FIELD takes (`pages.field_styles`, keyed by field path): its width and
|
|
1180
|
-
* placement, the space above and below it,
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1283
|
+
* placement, the space above and below it, its text alignment, font size and weight, and `size` — a
|
|
1284
|
+
* whole element's Small / Large (a button's). Every key but `size` is a `BlockStyle` key, so it
|
|
1285
|
+
* keeps the token set and the CSS table it already has — a field never gets a second scale.
|
|
1286
|
+
* 🔴 Twin: `FIELD_STYLE_KEYS` in the dashboard's fieldStyle.ts.
|
|
1183
1287
|
*/
|
|
1184
|
-
declare const FIELD_STYLE_KEYS: readonly ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight"];
|
|
1288
|
+
declare const FIELD_STYLE_KEYS: readonly ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight", "size"];
|
|
1185
1289
|
type FieldStyleKey = (typeof FIELD_STYLE_KEYS)[number];
|
|
1290
|
+
/** A field element's Small / Large. Medium is UNSET — no "md" token is ever stored. */
|
|
1291
|
+
type FieldSize = "sm" | "lg";
|
|
1292
|
+
/**
|
|
1293
|
+
* `size` → the element's `zoom`, which scales the WHOLE element (padding, font, icon, border) — what
|
|
1294
|
+
* Small / Large mean for a button whose CSS the site wrote. Any other value (`md` included) paints
|
|
1295
|
+
* nothing. 🔴 Inlined in the convert helper (`STYLE_SIZE_ZOOM`), parity-tested against this table.
|
|
1296
|
+
*/
|
|
1297
|
+
declare const FIELD_SIZE_ZOOM: Readonly<Record<FieldSize, string>>;
|
|
1186
1298
|
/** One field's style. */
|
|
1187
|
-
type FieldStyle = Pick<BlockStyle, FieldStyleKey
|
|
1299
|
+
type FieldStyle = Pick<BlockStyle, Exclude<FieldStyleKey, "size">> & {
|
|
1300
|
+
size?: FieldSize;
|
|
1301
|
+
};
|
|
1188
1302
|
/** A page's field styles, keyed by field path (the `data-bcms-field` address). */
|
|
1189
1303
|
type FieldStyles = Record<string, FieldStyle>;
|
|
1190
1304
|
/** Only the field keys of `style` (an empty object for none). */
|
|
@@ -1193,7 +1307,9 @@ declare function pickFieldStyle(style: BlockStyle | Record<string, unknown> | nu
|
|
|
1193
1307
|
* A field's declarations, for its OWN element (`fieldAttrs`). Spacing, alignment, size and weight are
|
|
1194
1308
|
* `blockStyleToCss`'s. The width is `blockStyleToInnerCss`'s column, drawn on the element itself —
|
|
1195
1309
|
* a field has no wrapper to nest a column in — so its placement becomes left/right margins, and
|
|
1196
|
-
* the vertical margins the spacing set stay. `
|
|
1310
|
+
* the vertical margins the spacing set stay. `size` (`FIELD_SIZE_ZOOM`) is LAST, so a style without
|
|
1311
|
+
* it keeps the exact declarations, in the exact order, it always had. `undefined` when nothing
|
|
1312
|
+
* applies (no `style` at all).
|
|
1197
1313
|
*/
|
|
1198
1314
|
declare function fieldStyleToCss(style: BlockStyle | Record<string, unknown> | null | undefined): Record<string, string | number> | undefined;
|
|
1199
1315
|
/**
|
|
@@ -1253,6 +1369,10 @@ interface LayoutFieldDefinition {
|
|
|
1253
1369
|
helpSource?: "auto" | "human" | "agent";
|
|
1254
1370
|
/** `true`: no route the last release inspected renders this field — hidden, never deleted. `false`: a person keeps it shown. */
|
|
1255
1371
|
stale?: boolean;
|
|
1372
|
+
/** false: a page may not override this value; the Global value renders on every page. Absent = true. */
|
|
1373
|
+
overridable?: boolean;
|
|
1374
|
+
/** Shown where the page editor would have offered the field. Required when overridable is false. */
|
|
1375
|
+
lockReason?: string;
|
|
1256
1376
|
}
|
|
1257
1377
|
/** The canonical public input contract all variants in a group implement. */
|
|
1258
1378
|
type CanonicalInputDefinition = LayoutFieldDefinition;
|
|
@@ -1316,6 +1436,11 @@ interface LayoutSection {
|
|
|
1316
1436
|
locale?: string;
|
|
1317
1437
|
/** The stable id of the base Section this variant replaces on routes in `locale`. */
|
|
1318
1438
|
variantOf?: string;
|
|
1439
|
+
/**
|
|
1440
|
+
* When the Section is shown (an announcement bar, a seasonal band). Absent = always. It is the
|
|
1441
|
+
* SLOT's: a locale variant shows when its base does, whatever the variant's own row says.
|
|
1442
|
+
*/
|
|
1443
|
+
window?: VisibilityWindow;
|
|
1319
1444
|
}
|
|
1320
1445
|
interface LayoutStructureDocument {
|
|
1321
1446
|
version: 1;
|
|
@@ -1453,6 +1578,7 @@ type ManagementLayoutCommand = {
|
|
|
1453
1578
|
name: string;
|
|
1454
1579
|
icon: LayoutSectionIcon;
|
|
1455
1580
|
zone: "before_page" | "after_page";
|
|
1581
|
+
window?: VisibilityWindow;
|
|
1456
1582
|
} | {
|
|
1457
1583
|
type: "restore-section";
|
|
1458
1584
|
section: LayoutSection;
|
|
@@ -1469,6 +1595,7 @@ type ManagementLayoutCommand = {
|
|
|
1469
1595
|
zone?: LayoutZone;
|
|
1470
1596
|
orderKey?: string;
|
|
1471
1597
|
description?: string;
|
|
1598
|
+
window?: VisibilityWindow | null;
|
|
1472
1599
|
} | {
|
|
1473
1600
|
type: "remove-section";
|
|
1474
1601
|
sectionId: string;
|
|
@@ -1542,6 +1669,8 @@ interface DeliveredLayout {
|
|
|
1542
1669
|
*/
|
|
1543
1670
|
locale?: string;
|
|
1544
1671
|
variantOf?: string;
|
|
1672
|
+
/** Present only on a Section that has one. A published read never delivers a Section outside it. */
|
|
1673
|
+
window?: VisibilityWindow;
|
|
1545
1674
|
fields: Record<string, unknown>;
|
|
1546
1675
|
items: Array<{
|
|
1547
1676
|
id: string;
|
|
@@ -1575,6 +1704,19 @@ interface DeliveredLayout {
|
|
|
1575
1704
|
}>;
|
|
1576
1705
|
}>;
|
|
1577
1706
|
}
|
|
1707
|
+
/**
|
|
1708
|
+
* A Layout structure as a visitor is served it at `now`: every Section outside its window
|
|
1709
|
+
* removed, and with a removed base its locale variants (a variant only ever renders in its base's
|
|
1710
|
+
* slot). The same document when nothing is removed, and anything that is not one as it came.
|
|
1711
|
+
*/
|
|
1712
|
+
declare function visibleLayoutStructure<T>(structure: T, now: Date | number): T;
|
|
1713
|
+
/**
|
|
1714
|
+
* A delivered Layout as a visitor is served it at `now`: the nodes whose Section is outside its
|
|
1715
|
+
* window removed, with their `sections` entries and any variant delivered beside a removed base.
|
|
1716
|
+
* Applied AFTER any cache, so a cached Layout never serves a Section past its boundary. The same
|
|
1717
|
+
* object when nothing is removed.
|
|
1718
|
+
*/
|
|
1719
|
+
declare function visibleDeliveredLayout<T extends DeliveredLayout | null | undefined>(layout: T, now: Date | number): T;
|
|
1578
1720
|
|
|
1579
1721
|
/**
|
|
1580
1722
|
* Component — a reusable, Webflow-style block tree (a "symbol").
|
|
@@ -1660,6 +1802,11 @@ interface ComponentPropDef {
|
|
|
1660
1802
|
* `{ componentId, overrides }` and its `target.path` is `props`, so filling a slot writes
|
|
1661
1803
|
* that object over an empty `component` block's props.
|
|
1662
1804
|
*
|
|
1805
|
+
* With `config.multiple` it holds a LIST of them and targets a container's child list
|
|
1806
|
+
* (`props.children` on a `section`, `props.columns.<n>` on a `columns`): the resolver writes
|
|
1807
|
+
* one `component` block per item there, so every renderer draws them as ordinary children.
|
|
1808
|
+
* @see slotItems
|
|
1809
|
+
*
|
|
1663
1810
|
* On a PAGE a slot fill is a LIVE reference; a published ENTRY freezes it (resolveDeep).
|
|
1664
1811
|
*/
|
|
1665
1812
|
/**
|
|
@@ -1716,6 +1863,11 @@ interface ComponentPropDef {
|
|
|
1716
1863
|
config?: {
|
|
1717
1864
|
/** `slot` — a pick allowlist. */
|
|
1718
1865
|
componentIds?: string[];
|
|
1866
|
+
/** `slot` — the value is a list of instances, not one. @see slotItems */
|
|
1867
|
+
multiple?: boolean;
|
|
1868
|
+
/** `slot` with `multiple` — bounds on the list. `maxItems` defaults to {@link SLOT_MAX_ITEMS}. */
|
|
1869
|
+
minItems?: number;
|
|
1870
|
+
maxItems?: number;
|
|
1719
1871
|
/**
|
|
1720
1872
|
* `select` / `multiselect` — the choices. Required, and a default must be one of them. `{ label, value }`
|
|
1721
1873
|
* when the stored value is not what an author should read (a component id, for instance).
|
|
@@ -1801,6 +1953,34 @@ interface ComponentSubField {
|
|
|
1801
1953
|
options?: string[];
|
|
1802
1954
|
} & Record<string, unknown>;
|
|
1803
1955
|
}
|
|
1956
|
+
/** The value a `slot` prop holds — the draft half of a `component-ref`, deliberately. */
|
|
1957
|
+
interface SlotValue {
|
|
1958
|
+
componentId: string;
|
|
1959
|
+
overrides?: Record<string, unknown>;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* One child of a `multiple` slot: a {@link SlotValue} that may also carry the two placement keys a
|
|
1963
|
+
* `component` block has. The child block is built with them, so it hides per breakpoint and
|
|
1964
|
+
* shows inside its window exactly as a block placed by hand does.
|
|
1965
|
+
*/
|
|
1966
|
+
interface SlotItem extends SlotValue {
|
|
1967
|
+
style?: BlockStyle;
|
|
1968
|
+
window?: VisibilityWindow;
|
|
1969
|
+
}
|
|
1970
|
+
/** How many children a `multiple` slot holds when its prop sets no `config.maxItems`. */
|
|
1971
|
+
declare const SLOT_MAX_ITEMS = 12;
|
|
1972
|
+
/** The most `config.maxItems` may ask for: one placement never expands into more blocks than this. */
|
|
1973
|
+
declare const SLOT_ITEMS_CAP = 50;
|
|
1974
|
+
/**
|
|
1975
|
+
* A slot value as a list of its instances, whichever shape it was stored in: `[]` for nothing,
|
|
1976
|
+
* one item for a single `{ componentId, overrides }`, the array's own items for a `multiple`
|
|
1977
|
+
* slot. An item with no `componentId` names no component and is left out.
|
|
1978
|
+
*
|
|
1979
|
+
* THE one reading of a slot value. A walker that tests `value.componentId` alone sees a
|
|
1980
|
+
* `multiple` slot as empty, and for a "where used" answer or a delete guard that is a component
|
|
1981
|
+
* removed from under the pages that hold it.
|
|
1982
|
+
*/
|
|
1983
|
+
declare function slotItems(value: unknown): SlotItem[];
|
|
1804
1984
|
/**
|
|
1805
1985
|
* A component is a DRAFT until published; only the published copy reaches a visitor.
|
|
1806
1986
|
* Mirrors pages and entries. See migration 0186_component_draft_live_split.sql.
|
|
@@ -2294,7 +2474,7 @@ type FormStatus = "draft" | "published";
|
|
|
2294
2474
|
interface FormField {
|
|
2295
2475
|
key: string;
|
|
2296
2476
|
label: string;
|
|
2297
|
-
type: "text" | "email" | "textarea" | "select" | "checkbox" | "checkboxes" | "radio" | "number" | "phone" | "date" | "url" | "consent" | "hidden";
|
|
2477
|
+
type: "text" | "email" | "textarea" | "select" | "checkbox" | "checkboxes" | "radio" | "number" | "phone" | "date" | "url" | "consent" | "hidden" | "step";
|
|
2298
2478
|
placeholder?: string;
|
|
2299
2479
|
helpText?: string;
|
|
2300
2480
|
required?: boolean;
|
|
@@ -2680,4 +2860,4 @@ declare function regionOf<E extends {
|
|
|
2680
2860
|
el: E;
|
|
2681
2861
|
}[], el: unknown): string | null;
|
|
2682
2862
|
|
|
2683
|
-
export { type AlignToken, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BLOCK_BINDINGS, 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 ButtonBlock, type ButtonIcon, type ButtonLinkCandidate, type ButtonLookKey, type ButtonProps, type ButtonSizeName, type ButtonValue, type ButtonVariant, COMPONENT_PROP_TYPES, type CanonicalInputDefinition, type CollectionBlock, type CollectionFilter, type CollectionProps, type ColorToken, type ColumnsBlock, type ColumnsProps, type Component, type ComponentBlock, type ComponentCategory, type ComponentFormPropRef, type ComponentPropDef, type ComponentPropType, type ComponentPropUi, type ComponentProps, type ComponentSubField, 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_STYLE_KEYS, FOOTER_SECTION_ID, type FieldConfig, 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, type ImageBlock, type ImageProps, LANDMARK_SELECTOR, LAYOUT_SECTION_ICONS, LAYOUT_SECTION_ICON_SET, LINK_RELS, 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 LocatorGrammar, MAIN_SELECTOR, type ManagementLayoutCommand, type MediaAsset, type MediaCaptionTrack, type MediaFieldValue, NAVIGATION_SECTION_ID, type NavLink, type NavbarBlock, type NavbarProps, 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 RadiusToken, type ReadButtonValue, type Redirect, type ReservedLayoutSection, type ResolvedLayoutNode, type RichTextBlock, type RichTextProps, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type SectionBlock, type SectionProps, type SectionSpaceToken, type ShadowToken, type ShowIf, type ShowIfRule, type SignInInput, type SignUpInput, type SiteSeoDefaults, type SlideItem, type SliderBlock, type SliderProps, type SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, type TabItem, type TabsBlock, type TabsProps, type TextBlock, type TextProps, type ThemeToken, type UiBefore, type UiOrigin, type VariantInputMapping, type VideoBlock, type VideoProps, type WeightToken, type Workspace, type ZoneField, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, buttonBlockProps, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, expandBlockBindings, fieldStyleCssText, fieldStyleToCss, formatPropsAttribute, getBlockType, headingPaintCss, isBlock, isChromeLandmark, keyWords, landmarkRegions, locatorFor, parsePropsAttribute, pickFieldStyle, readButtonValue, readPath, regionOf, safeCssUrl, spaceTokenCss, splitButtonStyle, withButtonLookProps };
|
|
2863
|
+
export { type AlignToken, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BLOCK_BINDINGS, BREAKPOINTS, 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 ButtonBlock, type ButtonIcon, type ButtonLinkCandidate, type ButtonLookKey, type ButtonProps, type ButtonSizeName, type ButtonValue, type ButtonVariant, COMPONENT_PROP_TYPES, type CanonicalInputDefinition, type CollectionBlock, type CollectionFilter, type CollectionProps, type ColorToken, type ColumnsBlock, type ColumnsProps, type Component, type ComponentBlock, type ComponentCategory, type ComponentFormPropRef, type ComponentPropDef, type ComponentPropType, type ComponentPropUi, type ComponentProps, type ComponentSubField, 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, type ImageBlock, type ImageProps, LANDMARK_SELECTOR, LAYOUT_SECTION_ICONS, LAYOUT_SECTION_ICON_SET, LINK_RELS, 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 LocatorGrammar, MAIN_SELECTOR, type ManagementLayoutCommand, type MediaAsset, type MediaCaptionTrack, type MediaFieldValue, NAVIGATION_SECTION_ID, type NavLink, type NavbarBlock, type NavbarProps, 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, RESPONSIVE_CSS, type RadiusToken, type ReadButtonValue, type Redirect, type ReservedLayoutSection, type ResolvedLayoutNode, type RichTextBlock, type RichTextProps, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SLOT_ITEMS_CAP, SLOT_MAX_ITEMS, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type SectionBlock, type SectionProps, type SectionSpaceToken, type ShadowToken, type ShowIf, type ShowIfRule, type SignInInput, type SignUpInput, type SiteSeoDefaults, type SlideItem, type SliderBlock, type SliderProps, type SlotItem, type SlotValue, type SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, type TabItem, type TabsBlock, type TabsProps, type TextBlock, type TextProps, type ThemeToken, type UiBefore, type UiOrigin, type VariantInputMapping, type VideoBlock, type VideoProps, type VisibilityWindow, type WeightToken, type WindowState, type Workspace, type ZoneField, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, buttonBlockProps, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, expandBlockBindings, fieldStyleCssText, fieldStyleToCss, formatPropsAttribute, getBlockType, headingPaintCss, hideOnAttr, inWindow, isBlock, isChromeLandmark, keyWords, landmarkRegions, locatorFor, normalizeWindow, parsePropsAttribute, pickFieldStyle, readButtonValue, readPath, regionOf, safeCssUrl, slotItems, spaceTokenCss, splitButtonStyle, usesHideOn, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps };
|