@lacecms/content 0.1.0-alpha.7 → 0.1.0-rc1

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
@@ -1,4 +1,8 @@
1
+ import type { EmbedProvider } from "./video-embeds.js";
1
2
  import * as v from "valibot";
3
+ export * from "./internal-links.js";
4
+ export * from "./video-embeds.js";
5
+ export * from "./list-query-policy.js";
2
6
  /** A JSON primitive that can be transported between Lace runtimes. */
3
7
  export type JsonPrimitive = boolean | null | number | string;
4
8
  /** A portable JSON value. Field descriptors never retain executable values. */
@@ -26,6 +30,10 @@ export interface CommonFieldOptions<Value> {
26
30
  export interface PlaceholderFieldOptions<Value> extends CommonFieldOptions<Value> {
27
31
  readonly placeholder?: string;
28
32
  }
33
+ /** Provider restrictions on otherwise ordinary safe URL fields. */
34
+ export interface UrlFieldOptions extends PlaceholderFieldOptions<string> {
35
+ readonly embedProviders?: readonly EmbedProvider[];
36
+ }
29
37
  /** String-length constraints supported by text and textarea fields. */
30
38
  export interface StringFieldOptions extends PlaceholderFieldOptions<string> {
31
39
  readonly maxLength?: number;
@@ -43,9 +51,29 @@ export type StringValueFieldOptions = CommonFieldOptions<string>;
43
51
  /** Options supported by a safe Tiptap rich-text field. */
44
52
  export interface RichTextFieldOptions extends PlaceholderFieldOptions<SafeRichTextDocument> {
45
53
  }
54
+ /** Decorative rectangles in a fixed 12 by 12 logical canvas. */
55
+ export interface ChoiceDiagram {
56
+ readonly cells: readonly {
57
+ readonly x: number;
58
+ readonly y: number;
59
+ readonly width: number;
60
+ readonly height: number;
61
+ }[];
62
+ }
63
+ /** Portable select hints; options remain the source of authored values. */
64
+ export interface SelectPresentation {
65
+ readonly control: "cards";
66
+ readonly choices: readonly {
67
+ readonly value: string;
68
+ readonly label: string;
69
+ readonly description?: string;
70
+ readonly diagram?: ChoiceDiagram;
71
+ }[];
72
+ }
46
73
  /** Options supported by select fields. */
47
74
  export interface SelectFieldOptions<Choices extends readonly string[]> extends PlaceholderFieldOptions<NoInfer<Choices[number]>> {
48
75
  readonly options: Choices;
76
+ readonly presentation?: SelectPresentation;
49
77
  }
50
78
  type RequiredFrom<Options> = "required" extends keyof Options ? Options extends {
51
79
  readonly required: infer Required extends boolean;
@@ -82,13 +110,13 @@ export type DateFieldDefinition<Options extends StringValueFieldOptions = String
82
110
  /** A datetime-field descriptor. */
83
111
  export type DatetimeFieldDefinition<Options extends StringValueFieldOptions = StringValueFieldOptions> = CommonDefinition<"datetime", Options>;
84
112
  /** A URL-field descriptor. */
85
- export type UrlFieldDefinition<Options extends PlaceholderFieldOptions<string> = PlaceholderFieldOptions<string>> = CommonDefinition<"url", Options>;
113
+ export type UrlFieldDefinition<Options extends UrlFieldOptions = UrlFieldOptions> = CommonDefinition<"url", Options> & PropertyFrom<Options, "embedProviders">;
86
114
  /** A media-field descriptor that stores a media identifier. */
87
115
  export type MediaFieldDefinition<Options extends StringValueFieldOptions = StringValueFieldOptions> = CommonDefinition<"media", Options>;
88
116
  /** A select-field descriptor. */
89
117
  export type SelectFieldDefinition<Choices extends readonly string[] = readonly string[], Options extends SelectFieldOptions<Choices> = SelectFieldOptions<Choices>> = CommonDefinition<"select", Options> & {
90
118
  readonly options: Choices;
91
- };
119
+ } & PropertyFrom<Options, "presentation">;
92
120
  /** Ordered presentation of immediate sibling fields; never content data. */
93
121
  export interface FormLayout<Key extends string = string> {
94
122
  readonly mode: "sections" | "tabs";
@@ -103,9 +131,46 @@ export interface FormLayout<Key extends string = string> {
103
131
  export declare function normalizeFormLayout<Key extends string>(value: unknown, fields: Readonly<Record<Key, unknown>>, path?: string): FormLayout<Key> | undefined;
104
132
  /** Sibling field order used by rendering and validation summaries. */
105
133
  export declare function formFieldKeys(fields: Readonly<Record<string, unknown>>, layout?: FormLayout): readonly string[];
134
+ /** A sibling rule: its target applies only while `field` holds one of `values`. */
135
+ export interface FieldVisibilityRule<Controller extends string = string, Value extends boolean | string = boolean | string> {
136
+ readonly field: Controller;
137
+ readonly values: readonly Value[];
138
+ }
139
+ type VisibilityControllerValue<Definition> = Definition extends {
140
+ readonly type: "boolean";
141
+ } ? boolean : Definition extends {
142
+ readonly type: "select";
143
+ readonly options: readonly (infer Choice extends string)[];
144
+ } ? Choice : never;
145
+ type VisibilityControllerKey<Fields> = {
146
+ [Key in keyof Fields & string]: [VisibilityControllerValue<Fields[Key]>] extends [never] ? never : Key;
147
+ }[keyof Fields & string];
148
+ type VisibilityRuleFor<Fields, Target extends string> = {
149
+ [Controller in Exclude<VisibilityControllerKey<Fields>, Target>]: FieldVisibilityRule<Controller, VisibilityControllerValue<Fields[Controller]>>;
150
+ }[Exclude<VisibilityControllerKey<Fields>, Target>];
151
+ /** Conditional-field rules of one field-map owner, keyed by target field. */
152
+ export type FieldVisibility<Fields = ModelFieldDefinitions> = string extends keyof Fields ? Readonly<Record<string, FieldVisibilityRule>> : Readonly<{
153
+ [Target in keyof Fields & string]?: VisibilityRuleFor<Fields, Target>;
154
+ }>;
155
+ /** Rejects rule targets outside `Fields` when the rules are part of an inferred input. */
156
+ type FieldVisibilityInput<Fields, Options> = FieldVisibility<Fields> & (Options extends {
157
+ readonly visibility: infer Given;
158
+ } ? {
159
+ readonly [Key in Exclude<keyof Given, keyof Fields>]: never;
160
+ } : unknown);
161
+ /** Validates, detaches and freezes the conditional-field rules of one owner. */
162
+ export declare function normalizeFieldVisibility(value: unknown, fields: Readonly<Record<string, FieldDefinition>>, path?: string): FieldVisibility | undefined;
163
+ /**
164
+ * Whether `target` applies in one normalized object occurrence: a target
165
+ * without a rule is visible; otherwise its controller's value (present or
166
+ * materialized default) must be listed. An absent controller matches nothing.
167
+ */
168
+ export declare function isFieldVisible(visibility: FieldVisibility | undefined, target: string, values: Readonly<Record<string, unknown>>): boolean;
106
169
  /** A finite group of named child descriptors. */
107
170
  export interface GroupFieldDefinition {
108
171
  readonly layout?: FormLayout;
172
+ /** Conditional-field rules over the group's immediate children. */
173
+ readonly visibility?: FieldVisibility;
109
174
  readonly type: "group";
110
175
  readonly fields: ModelFieldDefinitions;
111
176
  readonly required: boolean;
@@ -162,7 +227,9 @@ export type FieldValue<Definition extends FieldDefinition> = Definition extends
162
227
  } ? Choice : never : Definition extends {
163
228
  readonly type: "group";
164
229
  readonly fields: infer Fields extends ModelFieldDefinitions;
165
- } ? string extends keyof Fields ? JsonObject : BlockDataValues<Fields> : Definition extends {
230
+ } ? string extends keyof Fields ? JsonObject : Definition extends {
231
+ readonly visibility: infer Visibility;
232
+ } ? BlockDataValues<Fields, Visibility> : BlockDataValues<Fields> : Definition extends {
166
233
  readonly type: "list";
167
234
  readonly item: infer Item extends ListItemDefinition;
168
235
  } ? readonly FieldValue<Item>[] : string;
@@ -185,7 +252,8 @@ export declare const field: {
185
252
  readonly fields: ModelFieldDefinitions;
186
253
  }>(options: Options & CommonFieldOptions<NoInfer<{ readonly [Key in keyof Options["fields"]]?: DraftFieldValue<Options["fields"][Key]>; }>> & {
187
254
  readonly layout?: FormLayout<keyof Options["fields"] & string>;
188
- }) => CommonDefinition<"group", Options> & PropertyFrom<Options, "layout"> & {
255
+ readonly visibility?: FieldVisibilityInput<Options["fields"], Options>;
256
+ }) => CommonDefinition<"group", Options> & PropertyFrom<Options, "layout"> & PropertyFrom<Options, "visibility"> & {
189
257
  readonly fields: Options["fields"];
190
258
  };
191
259
  /** Define an ordered array of scalar or group values. */
@@ -215,8 +283,8 @@ export declare const field: {
215
283
  readonly select: <const Options extends {
216
284
  readonly options: readonly [string, ...string[]];
217
285
  }>(options: Options & SelectFieldOptions<Options["options"]>) => SelectFieldDefinition<Options["options"], Options & SelectFieldOptions<Options["options"]>>;
218
- /** Define a URL string field; URL protocol validation is added in Session 2B. */
219
- readonly url: <const Options extends PlaceholderFieldOptions<string> = PlaceholderFieldOptions<string>>(options?: Options) => UrlFieldDefinition<Options>;
286
+ /** Define a safe URL field, optionally restricted to supported video providers. */
287
+ readonly url: <const Options extends UrlFieldOptions = UrlFieldOptions>(options?: Options) => UrlFieldDefinition<Options>;
220
288
  /** Define a field holding a media identifier. */
221
289
  readonly media: <const Options extends StringValueFieldOptions = StringValueFieldOptions>(options?: Options) => MediaFieldDefinition<Options>;
222
290
  };
@@ -288,8 +356,10 @@ export declare class ContentValidationError extends Error {
288
356
  readonly issues: readonly ContentValidationIssue[];
289
357
  constructor(issues: readonly ContentValidationIssue[]);
290
358
  }
291
- /** Returns whether a URL is permitted in Lace URL fields and rich-text links. */
359
+ /** Returns whether a URL is permitted as an href, including rich-text links. */
292
360
  export declare function isSafeUrl(value: unknown): value is string;
361
+ /** Ordinary URL fields support safe manual URLs and canonical entry tokens. */
362
+ export declare function isUrlFieldTarget(value: unknown): value is string;
293
363
  /** Validates and returns a closed, safe rich-text document. */
294
364
  export declare function validateRichTextDocument(value: unknown): SafeRichTextDocument;
295
365
  /** A total handler map for every supported field definition. */
@@ -313,7 +383,19 @@ export type ModelFieldValues = JsonObject;
313
383
  /** The validation state of a content snapshot. */
314
384
  export type ContentValidationMode = "draft" | "publish";
315
385
  /** Validates field data for either an incomplete draft or a publish candidate. */
316
- export declare function validateModelFields(definitions: ModelFieldDefinitions, value: unknown, mode: ContentValidationMode, path?: readonly ValidationPathSegment[]): ModelFieldValues;
386
+ export declare function validateModelFields(definitions: ModelFieldDefinitions, value: unknown, mode: ContentValidationMode, path?: readonly ValidationPathSegment[], visibility?: FieldVisibility): ModelFieldValues;
387
+ /**
388
+ * Removes every hidden target from already normalized values, recursively
389
+ * through visible groups and list items, without inserting or reordering.
390
+ */
391
+ export declare function publishedFieldValues(definitions: ModelFieldDefinitions, values: JsonObject, visibility?: FieldVisibility): JsonObject;
392
+ /**
393
+ * Whether an owner or any nested group, including list-item groups, declares
394
+ * conditional-field rules, so its published projection can differ from its values.
395
+ */
396
+ export declare function declaresFieldVisibility(definitions: ModelFieldDefinitions, visibility?: FieldVisibility): boolean;
397
+ /** The published projection of one block's normalized data. */
398
+ export declare function publishedBlockData(definition: BlockMetadata, data: JsonObject): JsonObject;
317
399
  /** Checks already normalized model/block values against one snapshot-wide budget. */
318
400
  export declare function validateSnapshotListBudget(fields: ModelFieldDefinitions, values: JsonObject, blocks: readonly {
319
401
  readonly fields: ModelFieldDefinitions;
@@ -325,6 +407,32 @@ export interface FieldMediaReference {
325
407
  readonly mediaId: string;
326
408
  readonly path: readonly ValidationPathSegment[];
327
409
  }
410
+ /** A declared ordinary URL leaf, relative to its field map. */
411
+ export interface FieldInternalLinkReference {
412
+ readonly targetId: string;
413
+ readonly path: readonly ValidationPathSegment[];
414
+ }
415
+ /** Discover references only in normalized ordinary URL descriptors. */
416
+ export declare function collectFieldInternalLinks(definitions: ModelFieldDefinitions, values: JsonObject): readonly FieldInternalLinkReference[];
417
+ /** A source-scoped reference tuple, ready for persistence and public manifests. */
418
+ export interface InternalLinkReference {
419
+ readonly sourceKey: string;
420
+ readonly area: "fields" | "data";
421
+ readonly pointer: string;
422
+ readonly targetId: string;
423
+ readonly delivered: boolean;
424
+ }
425
+ /** The local manifest location delivered to site consumers. */
426
+ export type PublicInternalLinkReference = Omit<InternalLinkReference, "delivered">;
427
+ /** Collect and bound every declared internal URL in one normalized snapshot. */
428
+ export declare function collectSnapshotInternalLinks(fields: ModelFieldDefinitions, values: JsonObject, blocks: readonly {
429
+ readonly key: string;
430
+ readonly fields: ModelFieldDefinitions;
431
+ readonly data: JsonObject;
432
+ readonly hidden?: boolean;
433
+ /** The block's data rules; links inside hidden targets are not delivered. */
434
+ readonly visibility?: FieldVisibility;
435
+ }[], visibility?: FieldVisibility): readonly InternalLinkReference[];
328
436
  /** Finds declared media leaves only; ordinary strings never become references. */
329
437
  export declare function collectFieldMedia(definitions: ModelFieldDefinitions, values: JsonObject): readonly FieldMediaReference[];
330
438
  /**
@@ -379,6 +487,13 @@ export type BlockMigrations = Readonly<Record<number, BlockMigration>>;
379
487
  export declare const BLOCK_SETTING_FIELD_TYPES: readonly ["boolean", "number", "select", "text"];
380
488
  /** The settings of a block that declares none. */
381
489
  export type NoBlockSettings = Readonly<Record<never, FieldDefinition>>;
490
+ /** Bounded presentation rules over unconditional sibling select settings. */
491
+ export type SettingsVisibility<Key extends string = string> = Readonly<Partial<Record<Key, {
492
+ readonly setting: Key;
493
+ readonly values: readonly string[];
494
+ }>>>;
495
+ /** Validates and detaches settings-only visibility metadata. */
496
+ export declare function normalizeSettingsVisibility<Key extends string>(value: unknown, settings: Readonly<Record<Key, FieldDefinition>>, path?: string): SettingsVisibility<Key> | undefined;
382
497
  /** Input accepted by the portable block-definition DSL. */
383
498
  export interface BlockDefinitionInput<Fields extends ModelFieldDefinitions = ModelFieldDefinitions, Settings extends ModelFieldDefinitions = ModelFieldDefinitions> {
384
499
  readonly defaultValue?: unknown;
@@ -386,6 +501,9 @@ export interface BlockDefinitionInput<Fields extends ModelFieldDefinitions = Mod
386
501
  readonly fields: Fields;
387
502
  readonly layout?: FormLayout<keyof Fields & string>;
388
503
  readonly settingsLayout?: FormLayout<keyof Settings & string>;
504
+ readonly settingsVisibility?: SettingsVisibility<keyof Settings & string>;
505
+ /** Conditional-field rules over block data fields; settings use `settingsVisibility`. */
506
+ readonly visibility?: FieldVisibility<Fields>;
389
507
  readonly label?: string;
390
508
  /** Data and settings migrations from earlier versions, keyed by target version. */
391
509
  readonly migrations?: BlockMigrations;
@@ -394,23 +512,37 @@ export interface BlockDefinitionInput<Fields extends ModelFieldDefinitions = Mod
394
512
  readonly type: string;
395
513
  readonly version: number;
396
514
  }
397
- /** The data shape inferred from a block's field definitions. */
398
- export type BlockDataValues<Fields extends ModelFieldDefinitions> = Readonly<{
399
- [Key in keyof Fields as FieldIsRequired<Fields[Key]> extends true ? Key : never]: FieldValue<Fields[Key]>;
515
+ /**
516
+ * The target keys of an owner's inferred conditional-field rules: keys the
517
+ * inferred rules declare. Keys that are merely permitted (optional, as in a
518
+ * wide `FieldVisibility<Fields>`) are not targets.
519
+ */
520
+ export type FieldVisibilityTargets<Visibility> = [Visibility] extends [undefined] ? never : {
521
+ [Key in keyof NonNullable<Visibility>]-?: {} extends Pick<NonNullable<Visibility>, Key> ? never : Key;
522
+ }[keyof NonNullable<Visibility>];
523
+ /**
524
+ * The data shape inferred from a block's field definitions. Conditional targets
525
+ * named by `Visibility` are optional: they are absent while hidden.
526
+ */
527
+ export type BlockDataValues<Fields extends ModelFieldDefinitions, Visibility = undefined> = Readonly<{
528
+ [Key in keyof Fields as Key extends FieldVisibilityTargets<Visibility> ? never : FieldIsRequired<Fields[Key]> extends true ? Key : never]: FieldValue<Fields[Key]>;
400
529
  } & {
401
- readonly [Key in keyof Fields as FieldIsRequired<Fields[Key]> extends true ? never : Key]?: FieldValue<Fields[Key]>;
530
+ readonly [Key in keyof Fields as Key extends FieldVisibilityTargets<Visibility> ? Key : FieldIsRequired<Fields[Key]> extends true ? never : Key]?: FieldValue<Fields[Key]>;
402
531
  }>;
403
532
  /** The settings record of a block; every setting has a default, so every key is present. */
404
533
  export type BlockSettingsValues<Settings extends ModelFieldDefinitions> = Readonly<{
405
534
  [Key in keyof Settings]: FieldValue<Settings[Key]>;
406
535
  }>;
407
536
  /** A detached JSON-safe representation of a block definition. */
408
- export interface BlockMetadata<Fields extends ModelFieldDefinitions = ModelFieldDefinitions, Settings extends ModelFieldDefinitions = ModelFieldDefinitions> {
409
- readonly defaultValue?: BlockDataValues<Fields>;
537
+ export interface BlockMetadata<Fields extends ModelFieldDefinitions = ModelFieldDefinitions, Settings extends ModelFieldDefinitions = ModelFieldDefinitions, Visibility = undefined> {
538
+ readonly defaultValue?: BlockDataValues<Fields, Visibility>;
410
539
  readonly description?: string;
411
540
  readonly fields: Fields;
412
541
  readonly layout?: FormLayout<keyof Fields & string>;
413
542
  readonly settingsLayout?: FormLayout<keyof Settings & string>;
543
+ readonly settingsVisibility?: SettingsVisibility<keyof Settings & string>;
544
+ /** Conditional-field rules over block data fields. */
545
+ readonly visibility?: FieldVisibility<Fields>;
414
546
  readonly label?: string;
415
547
  /** Declared settings; absent when the block declares none. */
416
548
  readonly settings?: Settings;
@@ -418,13 +550,15 @@ export interface BlockMetadata<Fields extends ModelFieldDefinitions = ModelField
418
550
  readonly version: number;
419
551
  }
420
552
  /** An executable block definition retained only in the runtime projection. */
421
- export interface BlockDefinition<Fields extends ModelFieldDefinitions = ModelFieldDefinitions, Settings extends ModelFieldDefinitions = ModelFieldDefinitions> extends BlockMetadata<Fields, Settings> {
553
+ export interface BlockDefinition<Fields extends ModelFieldDefinitions = ModelFieldDefinitions, Settings extends ModelFieldDefinitions = ModelFieldDefinitions, Visibility = undefined> extends BlockMetadata<Fields, Settings, Visibility> {
422
554
  /** Runtime-only migrations keyed by target version; never part of metadata. */
423
555
  readonly migrations?: BlockMigrations;
424
- readonly validate: (value: unknown, mode: ContentValidationMode) => BlockDataValues<Fields>;
556
+ readonly validate: (value: unknown, mode: ContentValidationMode) => BlockDataValues<Fields, Visibility>;
425
557
  }
426
558
  /** Defines a versioned block using only portable field descriptors. */
427
- export declare function defineBlock<const Fields extends ModelFieldDefinitions, const Settings extends ModelFieldDefinitions = NoBlockSettings>(input: BlockDefinitionInput<Fields, Settings>): BlockDefinition<Fields, Settings>;
559
+ export declare function defineBlock<const Fields extends ModelFieldDefinitions, const Settings extends ModelFieldDefinitions = NoBlockSettings, const Visibility extends FieldVisibility<Fields> | undefined = undefined>(input: BlockDefinitionInput<Fields, Settings> & {
560
+ readonly visibility?: Visibility;
561
+ }): BlockDefinition<Fields, Settings, Visibility>;
428
562
  /** Projects a block definition into detached, JSON-safe metadata. */
429
563
  export declare function toBlockMetadata(definition: BlockDefinition): BlockMetadata;
430
564
  /** A registry of the current executable definition for every allowed block type. */
@@ -471,6 +605,87 @@ export declare function migrateBlockData(definition: BlockDefinition, block: Blo
471
605
  * `image` block's `alt`), then a non-blank media alt, then an empty string.
472
606
  */
473
607
  export declare function effectiveAltText(usageAlt: string | null | undefined, mediaAlt: string | null | undefined): string;
608
+ /** Shared presentation rules for the independent scalar list settings. */
609
+ export declare function listLayoutSettingsVisibility(): SettingsVisibility<"layoutMode" | "layoutWrap" | "layoutPreset">;
610
+ /** Shared scalar settings for one explicitly adopted list, in any block. */
611
+ export declare function listLayoutSettings(): {
612
+ layoutMode: SelectFieldDefinition<readonly ["flex-row", "flex-column", "grid"], {
613
+ readonly options: readonly ["flex-row", "flex-column", "grid"];
614
+ readonly required: true;
615
+ readonly defaultValue: "grid";
616
+ readonly label: "Arrangement";
617
+ readonly presentation: {
618
+ readonly control: "cards";
619
+ readonly choices: readonly [{
620
+ readonly value: "flex-row";
621
+ readonly label: "Horizontal";
622
+ readonly description: "Items flow across rows.";
623
+ readonly diagram: ChoiceDiagram;
624
+ }, {
625
+ readonly value: "flex-column";
626
+ readonly label: "Vertical";
627
+ readonly description: "Items flow down columns. Wrapping needs a height set in site CSS.";
628
+ readonly diagram: ChoiceDiagram;
629
+ }, {
630
+ readonly value: "grid";
631
+ readonly label: "Grid";
632
+ readonly description: "Items use the selected grid preset.";
633
+ readonly diagram: ChoiceDiagram;
634
+ }];
635
+ };
636
+ } & SelectFieldOptions<readonly ["flex-row", "flex-column", "grid"]>>;
637
+ layoutWrap: BooleanFieldDefinition<{
638
+ readonly defaultValue: true;
639
+ readonly label: "Wrap items";
640
+ readonly description: "Applies to horizontal and vertical flex lists. Vertical wrapping requires a height set in site CSS.";
641
+ }>;
642
+ layoutPreset: SelectFieldDefinition<readonly ["auto", "columns-2", "columns-3", "columns-4", "narrow-wide", "wide-narrow", "featured-first"], {
643
+ readonly options: readonly ["auto", "columns-2", "columns-3", "columns-4", "narrow-wide", "wide-narrow", "featured-first"];
644
+ readonly required: true;
645
+ readonly defaultValue: "auto";
646
+ readonly label: "Grid preset";
647
+ readonly description: "Applies when Grid is selected. Schematics show composition; your site controls styling.";
648
+ readonly presentation: {
649
+ readonly control: "cards";
650
+ readonly choices: readonly [{
651
+ readonly value: "auto";
652
+ readonly label: "Auto";
653
+ readonly description: "As many equal columns as fit.";
654
+ readonly diagram: ChoiceDiagram;
655
+ }, {
656
+ readonly value: "columns-2";
657
+ readonly label: "Two columns";
658
+ readonly description: "Two equal columns from 32rem.";
659
+ readonly diagram: ChoiceDiagram;
660
+ }, {
661
+ readonly value: "columns-3";
662
+ readonly label: "Three columns";
663
+ readonly description: "Two from 32rem, three from 48rem.";
664
+ readonly diagram: ChoiceDiagram;
665
+ }, {
666
+ readonly value: "columns-4";
667
+ readonly label: "Four columns";
668
+ readonly description: "Two from 32rem, three from 48rem, four from 64rem.";
669
+ readonly diagram: ChoiceDiagram;
670
+ }, {
671
+ readonly value: "narrow-wide";
672
+ readonly label: "Narrow + wide";
673
+ readonly description: "Alternating 1:2 columns from 32rem.";
674
+ readonly diagram: ChoiceDiagram;
675
+ }, {
676
+ readonly value: "wide-narrow";
677
+ readonly label: "Wide + narrow";
678
+ readonly description: "Alternating 2:1 columns from 32rem.";
679
+ readonly diagram: ChoiceDiagram;
680
+ }, {
681
+ readonly value: "featured-first";
682
+ readonly label: "Featured first";
683
+ readonly description: "First item spans two columns from 32rem.";
684
+ readonly diagram: ChoiceDiagram;
685
+ }];
686
+ };
687
+ } & SelectFieldOptions<readonly ["auto", "columns-2", "columns-3", "columns-4", "narrow-wide", "wide-narrow", "featured-first"]>>;
688
+ };
474
689
  /** Starter blocks implemented exclusively through the public block and field DSL. */
475
690
  export declare const builtInBlocks: {
476
691
  cta: BlockDefinition<{
@@ -490,7 +705,7 @@ export declare const builtInBlocks: {
490
705
  readonly required: true;
491
706
  readonly type: "text";
492
707
  };
493
- }, Readonly<Record<never, FieldDefinition>>>;
708
+ }, Readonly<Record<never, FieldDefinition>>, undefined>;
494
709
  gallery: BlockDefinition<{
495
710
  readonly images: {
496
711
  readonly required: false;
@@ -498,29 +713,180 @@ export declare const builtInBlocks: {
498
713
  } & {
499
714
  readonly defaultValue: readonly [];
500
715
  } & {
501
- readonly label: "Images";
716
+ readonly label: "Images and videos";
502
717
  } & {
503
718
  readonly item: {
504
719
  readonly required: false;
505
720
  readonly type: "group";
721
+ } & {
722
+ readonly visibility: {
723
+ readonly media: {
724
+ readonly field: "kind";
725
+ readonly values: readonly ["image"];
726
+ };
727
+ readonly alt: {
728
+ readonly field: "kind";
729
+ readonly values: readonly ["image"];
730
+ };
731
+ readonly link: {
732
+ readonly field: "kind";
733
+ readonly values: readonly ["image"];
734
+ };
735
+ readonly videoUrl: {
736
+ readonly field: "kind";
737
+ readonly values: readonly ["video"];
738
+ };
739
+ readonly videoTitle: {
740
+ readonly field: "kind";
741
+ readonly values: readonly ["video"];
742
+ };
743
+ readonly playback: {
744
+ readonly field: "kind";
745
+ readonly values: readonly ["video"];
746
+ };
747
+ readonly aspectRatio: {
748
+ readonly field: "kind";
749
+ readonly values: readonly ["video"];
750
+ };
751
+ };
506
752
  } & {
507
753
  readonly fields: {
754
+ readonly kind: SelectFieldDefinition<readonly ["image", "video"], {
755
+ readonly options: readonly ["image", "video"];
756
+ readonly required: true;
757
+ readonly defaultValue: "image";
758
+ readonly label: "Type";
759
+ readonly presentation: {
760
+ readonly control: "cards";
761
+ readonly choices: readonly [{
762
+ readonly value: "image";
763
+ readonly label: "Image";
764
+ readonly description: "A picture from the media library.";
765
+ }, {
766
+ readonly value: "video";
767
+ readonly label: "Video";
768
+ readonly description: "A YouTube or Vimeo video.";
769
+ }];
770
+ };
771
+ } & SelectFieldOptions<readonly ["image", "video"]>>;
772
+ readonly media: MediaFieldDefinition<{
773
+ readonly label: "Image";
774
+ readonly required: true;
775
+ }>;
776
+ readonly videoUrl: UrlFieldDefinition<{
777
+ readonly required: true;
778
+ readonly embedProviders: readonly ["youtube", "vimeo"];
779
+ readonly label: "Video URL";
780
+ readonly description: "Paste a YouTube or Vimeo video link, not iframe code.";
781
+ }>;
508
782
  readonly alt: TextFieldDefinition<{
509
783
  readonly description: "Leave empty to use the media item's alt text.";
510
784
  readonly label: "Alt text";
511
785
  }>;
786
+ readonly videoTitle: TextFieldDefinition<{
787
+ readonly required: true;
788
+ readonly minLength: 1;
789
+ readonly label: "Video title";
790
+ readonly description: "Names the video for visitors using assistive technology.";
791
+ }>;
512
792
  readonly caption: TextFieldDefinition<{
513
- readonly description: "Leave empty to use the media item's caption.";
793
+ readonly description: "An empty image caption uses the media item's caption.";
514
794
  readonly label: "Caption";
515
795
  }>;
516
796
  readonly link: UrlFieldDefinition<{
517
797
  readonly description: "Selecting the image opens this link instead of the full-screen view.";
518
798
  readonly label: "Link";
519
799
  }>;
520
- readonly media: MediaFieldDefinition<{
521
- readonly label: "Image";
800
+ readonly playback: SelectFieldDefinition<readonly ["player", "ambient"], {
801
+ readonly options: readonly ["player", "ambient"];
522
802
  readonly required: true;
523
- }>;
803
+ readonly defaultValue: "player";
804
+ readonly label: "Playback";
805
+ readonly description: "Ambient videos play muted and loop without controls.";
806
+ readonly presentation: {
807
+ readonly control: "cards";
808
+ readonly choices: readonly [{
809
+ readonly value: "player";
810
+ readonly label: "Player";
811
+ readonly description: "Visitors start the video.";
812
+ }, {
813
+ readonly value: "ambient";
814
+ readonly label: "Ambient";
815
+ readonly description: "Muted, looping, no controls; respects reduced motion.";
816
+ }];
817
+ };
818
+ } & SelectFieldOptions<readonly ["player", "ambient"]>>;
819
+ readonly aspectRatio: SelectFieldDefinition<readonly ["16:9", "4:3", "1:1", "4:5", "9:16"], {
820
+ readonly options: readonly ["16:9", "4:3", "1:1", "4:5", "9:16"];
821
+ readonly required: true;
822
+ readonly defaultValue: "16:9";
823
+ readonly label: "Aspect ratio";
824
+ readonly description: "Reserves the video area before the player loads.";
825
+ readonly presentation: {
826
+ readonly control: "cards";
827
+ readonly choices: readonly [{
828
+ readonly value: "16:9";
829
+ readonly label: "16:9";
830
+ readonly description: "Wide landscape.";
831
+ readonly diagram: {
832
+ readonly cells: readonly [{
833
+ readonly x: 0;
834
+ readonly y: 2;
835
+ readonly width: 12;
836
+ readonly height: 7;
837
+ }];
838
+ };
839
+ }, {
840
+ readonly value: "4:3";
841
+ readonly label: "4:3";
842
+ readonly description: "Classic landscape.";
843
+ readonly diagram: {
844
+ readonly cells: readonly [{
845
+ readonly x: 0;
846
+ readonly y: 1;
847
+ readonly width: 12;
848
+ readonly height: 9;
849
+ }];
850
+ };
851
+ }, {
852
+ readonly value: "1:1";
853
+ readonly label: "1:1";
854
+ readonly description: "Square.";
855
+ readonly diagram: {
856
+ readonly cells: readonly [{
857
+ readonly x: 1;
858
+ readonly y: 1;
859
+ readonly width: 9;
860
+ readonly height: 9;
861
+ }];
862
+ };
863
+ }, {
864
+ readonly value: "4:5";
865
+ readonly label: "4:5";
866
+ readonly description: "Portrait.";
867
+ readonly diagram: {
868
+ readonly cells: readonly [{
869
+ readonly x: 2;
870
+ readonly y: 1;
871
+ readonly width: 8;
872
+ readonly height: 10;
873
+ }];
874
+ };
875
+ }, {
876
+ readonly value: "9:16";
877
+ readonly label: "9:16";
878
+ readonly description: "Tall portrait.";
879
+ readonly diagram: {
880
+ readonly cells: readonly [{
881
+ readonly x: 3;
882
+ readonly y: 0;
883
+ readonly width: 6;
884
+ readonly height: 11;
885
+ }];
886
+ };
887
+ }];
888
+ };
889
+ } & SelectFieldOptions<readonly ["16:9", "4:3", "1:1", "4:5", "9:16"]>>;
524
890
  };
525
891
  };
526
892
  } & {
@@ -534,12 +900,88 @@ export declare const builtInBlocks: {
534
900
  readonly label: "Title";
535
901
  }>;
536
902
  }, {
903
+ readonly layoutMode: SelectFieldDefinition<readonly ["flex-row", "flex-column", "grid"], {
904
+ readonly options: readonly ["flex-row", "flex-column", "grid"];
905
+ readonly required: true;
906
+ readonly defaultValue: "grid";
907
+ readonly label: "Arrangement";
908
+ readonly presentation: {
909
+ readonly control: "cards";
910
+ readonly choices: readonly [{
911
+ readonly value: "flex-row";
912
+ readonly label: "Horizontal";
913
+ readonly description: "Items flow across rows.";
914
+ readonly diagram: ChoiceDiagram;
915
+ }, {
916
+ readonly value: "flex-column";
917
+ readonly label: "Vertical";
918
+ readonly description: "Items flow down columns. Wrapping needs a height set in site CSS.";
919
+ readonly diagram: ChoiceDiagram;
920
+ }, {
921
+ readonly value: "grid";
922
+ readonly label: "Grid";
923
+ readonly description: "Items use the selected grid preset.";
924
+ readonly diagram: ChoiceDiagram;
925
+ }];
926
+ };
927
+ } & SelectFieldOptions<readonly ["flex-row", "flex-column", "grid"]>>;
928
+ readonly layoutWrap: BooleanFieldDefinition<{
929
+ readonly defaultValue: true;
930
+ readonly label: "Wrap items";
931
+ readonly description: "Applies to horizontal and vertical flex lists. Vertical wrapping requires a height set in site CSS.";
932
+ }>;
933
+ readonly layoutPreset: SelectFieldDefinition<readonly ["auto", "columns-2", "columns-3", "columns-4", "narrow-wide", "wide-narrow", "featured-first"], {
934
+ readonly options: readonly ["auto", "columns-2", "columns-3", "columns-4", "narrow-wide", "wide-narrow", "featured-first"];
935
+ readonly required: true;
936
+ readonly defaultValue: "auto";
937
+ readonly label: "Grid preset";
938
+ readonly description: "Applies when Grid is selected. Schematics show composition; your site controls styling.";
939
+ readonly presentation: {
940
+ readonly control: "cards";
941
+ readonly choices: readonly [{
942
+ readonly value: "auto";
943
+ readonly label: "Auto";
944
+ readonly description: "As many equal columns as fit.";
945
+ readonly diagram: ChoiceDiagram;
946
+ }, {
947
+ readonly value: "columns-2";
948
+ readonly label: "Two columns";
949
+ readonly description: "Two equal columns from 32rem.";
950
+ readonly diagram: ChoiceDiagram;
951
+ }, {
952
+ readonly value: "columns-3";
953
+ readonly label: "Three columns";
954
+ readonly description: "Two from 32rem, three from 48rem.";
955
+ readonly diagram: ChoiceDiagram;
956
+ }, {
957
+ readonly value: "columns-4";
958
+ readonly label: "Four columns";
959
+ readonly description: "Two from 32rem, three from 48rem, four from 64rem.";
960
+ readonly diagram: ChoiceDiagram;
961
+ }, {
962
+ readonly value: "narrow-wide";
963
+ readonly label: "Narrow + wide";
964
+ readonly description: "Alternating 1:2 columns from 32rem.";
965
+ readonly diagram: ChoiceDiagram;
966
+ }, {
967
+ readonly value: "wide-narrow";
968
+ readonly label: "Wide + narrow";
969
+ readonly description: "Alternating 2:1 columns from 32rem.";
970
+ readonly diagram: ChoiceDiagram;
971
+ }, {
972
+ readonly value: "featured-first";
973
+ readonly label: "Featured first";
974
+ readonly description: "First item spans two columns from 32rem.";
975
+ readonly diagram: ChoiceDiagram;
976
+ }];
977
+ };
978
+ } & SelectFieldOptions<readonly ["auto", "columns-2", "columns-3", "columns-4", "narrow-wide", "wide-narrow", "featured-first"]>>;
537
979
  readonly lightbox: BooleanFieldDefinition<{
538
980
  readonly defaultValue: false;
539
981
  readonly description: "Opens the original image full screen when it is selected.";
540
982
  readonly label: "Open full screen";
541
983
  }>;
542
- }>;
984
+ }, undefined>;
543
985
  hero: BlockDefinition<{
544
986
  readonly body: {
545
987
  readonly required: false;
@@ -565,8 +1007,12 @@ export declare const builtInBlocks: {
565
1007
  readonly required: false;
566
1008
  readonly type: "url";
567
1009
  };
568
- }, Readonly<Record<never, FieldDefinition>>>;
1010
+ }, Readonly<Record<never, FieldDefinition>>, undefined>;
569
1011
  image: BlockDefinition<{
1012
+ readonly media: {
1013
+ readonly required: true;
1014
+ readonly type: "media";
1015
+ };
570
1016
  readonly alt: {
571
1017
  readonly required: false;
572
1018
  readonly type: "text";
@@ -579,17 +1025,37 @@ export declare const builtInBlocks: {
579
1025
  readonly description: "Selecting the image opens this link instead of the full-screen view.";
580
1026
  readonly label: "Link";
581
1027
  }>;
582
- readonly media: {
583
- readonly required: true;
584
- readonly type: "media";
585
- };
586
1028
  }, {
587
1029
  readonly lightbox: BooleanFieldDefinition<{
588
1030
  readonly defaultValue: false;
589
1031
  readonly description: "Opens the original image full screen when it is selected.";
590
1032
  readonly label: "Open full screen";
591
1033
  }>;
592
- }>;
1034
+ }, undefined>;
1035
+ link: BlockDefinition<{
1036
+ readonly label: TextFieldDefinition<{
1037
+ readonly label: "Label";
1038
+ readonly minLength: 1;
1039
+ readonly maxLength: 200;
1040
+ readonly required: true;
1041
+ }>;
1042
+ readonly url: UrlFieldDefinition<{
1043
+ readonly label: "Destination";
1044
+ readonly required: true;
1045
+ }>;
1046
+ }, {
1047
+ readonly appearance: SelectFieldDefinition<readonly ["button", "text"], {
1048
+ readonly label: "Appearance";
1049
+ readonly options: readonly ["button", "text"];
1050
+ readonly defaultValue: "button";
1051
+ readonly required: true;
1052
+ } & SelectFieldOptions<readonly ["button", "text"]>>;
1053
+ readonly newTab: BooleanFieldDefinition<{
1054
+ readonly label: "Open in new tab";
1055
+ readonly defaultValue: false;
1056
+ readonly required: true;
1057
+ }>;
1058
+ }, undefined>;
593
1059
  navigation: BlockDefinition<{
594
1060
  readonly links: {
595
1061
  readonly required: false;
@@ -651,7 +1117,7 @@ export declare const builtInBlocks: {
651
1117
  readonly description: "Read by screen readers, for example Main or On this page.";
652
1118
  readonly label: "Navigation name";
653
1119
  }>;
654
- }, Readonly<Record<never, FieldDefinition>>>;
1120
+ }, Readonly<Record<never, FieldDefinition>>, undefined>;
655
1121
  quote: BlockDefinition<{
656
1122
  readonly attribution: {
657
1123
  readonly required: false;
@@ -661,13 +1127,125 @@ export declare const builtInBlocks: {
661
1127
  readonly required: true;
662
1128
  readonly type: "text";
663
1129
  };
664
- }, Readonly<Record<never, FieldDefinition>>>;
1130
+ }, Readonly<Record<never, FieldDefinition>>, undefined>;
665
1131
  richText: BlockDefinition<{
666
1132
  readonly content: {
667
1133
  readonly required: true;
668
1134
  readonly type: "richText";
669
1135
  };
670
- }, Readonly<Record<never, FieldDefinition>>>;
1136
+ }, Readonly<Record<never, FieldDefinition>>, undefined>;
1137
+ videoEmbed: BlockDefinition<{
1138
+ readonly url: UrlFieldDefinition<{
1139
+ readonly required: true;
1140
+ readonly embedProviders: readonly ["youtube", "vimeo"];
1141
+ readonly label: "Video URL";
1142
+ readonly description: "Paste a YouTube or Vimeo video link, not iframe code.";
1143
+ }>;
1144
+ readonly title: TextFieldDefinition<{
1145
+ readonly required: true;
1146
+ readonly minLength: 1;
1147
+ readonly label: "Title";
1148
+ readonly description: "Names the video for visitors using assistive technology.";
1149
+ }>;
1150
+ readonly poster: MediaFieldDefinition<{
1151
+ readonly label: "Preview image";
1152
+ readonly description: "Optional. Defers player loading until selected in Player mode; stays underneath Ambient playback.";
1153
+ }>;
1154
+ readonly caption: TextFieldDefinition<{
1155
+ readonly label: "Caption";
1156
+ }>;
1157
+ }, {
1158
+ readonly aspectRatio: SelectFieldDefinition<readonly ["16:9", "4:3", "1:1", "4:5", "9:16"], {
1159
+ readonly options: readonly ["16:9", "4:3", "1:1", "4:5", "9:16"];
1160
+ readonly required: true;
1161
+ readonly defaultValue: "16:9";
1162
+ readonly label: "Aspect ratio";
1163
+ readonly description: "Reserves the video area before the player loads.";
1164
+ readonly presentation: {
1165
+ readonly control: "cards";
1166
+ readonly choices: readonly [{
1167
+ readonly value: "16:9";
1168
+ readonly label: "16:9";
1169
+ readonly description: "Wide landscape.";
1170
+ readonly diagram: {
1171
+ readonly cells: readonly [{
1172
+ readonly x: 0;
1173
+ readonly y: 2;
1174
+ readonly width: 12;
1175
+ readonly height: 7;
1176
+ }];
1177
+ };
1178
+ }, {
1179
+ readonly value: "4:3";
1180
+ readonly label: "4:3";
1181
+ readonly description: "Classic landscape.";
1182
+ readonly diagram: {
1183
+ readonly cells: readonly [{
1184
+ readonly x: 0;
1185
+ readonly y: 1;
1186
+ readonly width: 12;
1187
+ readonly height: 9;
1188
+ }];
1189
+ };
1190
+ }, {
1191
+ readonly value: "1:1";
1192
+ readonly label: "1:1";
1193
+ readonly description: "Square.";
1194
+ readonly diagram: {
1195
+ readonly cells: readonly [{
1196
+ readonly x: 1;
1197
+ readonly y: 1;
1198
+ readonly width: 9;
1199
+ readonly height: 9;
1200
+ }];
1201
+ };
1202
+ }, {
1203
+ readonly value: "4:5";
1204
+ readonly label: "4:5";
1205
+ readonly description: "Portrait.";
1206
+ readonly diagram: {
1207
+ readonly cells: readonly [{
1208
+ readonly x: 2;
1209
+ readonly y: 1;
1210
+ readonly width: 8;
1211
+ readonly height: 10;
1212
+ }];
1213
+ };
1214
+ }, {
1215
+ readonly value: "9:16";
1216
+ readonly label: "9:16";
1217
+ readonly description: "Tall portrait.";
1218
+ readonly diagram: {
1219
+ readonly cells: readonly [{
1220
+ readonly x: 3;
1221
+ readonly y: 0;
1222
+ readonly width: 6;
1223
+ readonly height: 11;
1224
+ }];
1225
+ };
1226
+ }];
1227
+ };
1228
+ } & SelectFieldOptions<readonly ["16:9", "4:3", "1:1", "4:5", "9:16"]>>;
1229
+ readonly playback: SelectFieldDefinition<readonly ["player", "ambient"], {
1230
+ readonly options: readonly ["player", "ambient"];
1231
+ readonly required: true;
1232
+ readonly defaultValue: "player";
1233
+ readonly label: "Playback";
1234
+ readonly description: "Ambient videos play muted and loop without controls.";
1235
+ readonly presentation: {
1236
+ readonly control: "cards";
1237
+ readonly choices: readonly [{
1238
+ readonly value: "player";
1239
+ readonly label: "Player";
1240
+ readonly description: "Visitors start the video.";
1241
+ }, {
1242
+ readonly value: "ambient";
1243
+ readonly label: "Ambient";
1244
+ readonly description: "Muted, looping, no controls; respects reduced motion.";
1245
+ }];
1246
+ };
1247
+ } & SelectFieldOptions<readonly ["player", "ambient"]>>;
1248
+ }, undefined>;
671
1249
  };
672
1250
  /** Maximum title length shared by draft, publish, REST, and admin validation. */
673
1251
  export declare const MAX_TITLE_LENGTH = 200;
@@ -710,6 +1288,8 @@ export interface EntryAggregateModel {
710
1288
  readonly blocks: readonly string[];
711
1289
  readonly fields: ModelFieldDefinitions;
712
1290
  readonly kind: ContentModelKind;
1291
+ /** Conditional-field rules over the model's own fields. */
1292
+ readonly visibility?: FieldVisibility;
713
1293
  }
714
1294
  /** One ordered, typed block submitted as part of an entry aggregate. */
715
1295
  export interface EntryAggregateBlock {