@storyblok/live-preview 0.1.7 → 0.2.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.cts CHANGED
@@ -1,10 +1,1184 @@
1
1
  import StoryblokBridge, { BridgeParams, BridgeParams as BridgeParams$1 } from "@storyblok/preview-bridge";
2
2
 
3
- //#region src/editable.d.ts
4
- interface Blok {
3
+ //#region src/generated/capi/_internal.gen.d.ts
4
+ type CapiStory = ({
5
+ version?: 'draft';
6
+ } & DraftStory) | ({
7
+ version?: 'published';
8
+ } & PublishedStory);
9
+ type DraftStory = {
10
+ name: string;
11
+ /**
12
+ * Creation timestamp (format is ISO 8601 standard in UTC).
13
+ */
14
+ created_at: string;
15
+ /**
16
+ * Latest update timestamp (format is ISO 8601 standard in UTC).
17
+ */
18
+ updated_at?: string | null;
19
+ /**
20
+ * Latest publication timestamp (format is ISO 8601 standard in UTC).
21
+ */
22
+ published_at: string | null;
23
+ alternates: Array<StoryAlternate>;
24
+ id: number;
25
+ uuid: string;
26
+ /**
27
+ * Dynamic component data rendered by Storyblok, structure varies by component.
28
+ */
29
+ content: {
30
+ _uid?: string;
31
+ component?: string;
32
+ [key: string]: unknown | string | undefined;
33
+ };
34
+ slug: string;
35
+ full_slug: string;
36
+ default_full_slug: string | null;
37
+ sort_by_date: string | null;
38
+ position: number;
39
+ tag_list: Array<string>;
40
+ is_startpage: boolean;
41
+ parent_id: number;
42
+ /**
43
+ * Custom metadata for the story.
44
+ */
45
+ meta_data: {
46
+ [key: string]: unknown;
47
+ } | null;
48
+ group_id: string;
49
+ first_published_at: string | null;
50
+ release_id: number | null;
51
+ lang: string;
52
+ path: string | null;
53
+ translated_slugs: Array<{
54
+ path: string;
55
+ name: string | null;
56
+ lang: string;
57
+ published: string | null;
58
+ }> | null;
59
+ };
60
+ type PublishedStory = {
61
+ name: string;
62
+ /**
63
+ * Creation timestamp (format is ISO 8601 standard in UTC).
64
+ */
65
+ created_at: string;
66
+ /**
67
+ * Latest update timestamp (format is ISO 8601 standard in UTC).
68
+ */
69
+ updated_at?: string | null;
70
+ /**
71
+ * Latest publication timestamp (format is ISO 8601 standard in UTC).
72
+ */
73
+ published_at: string | null;
74
+ id: number;
75
+ uuid: string;
76
+ /**
77
+ * Dynamic component data rendered by Storyblok, structure varies by component.
78
+ */
79
+ content: {
80
+ _uid?: string;
81
+ component?: string;
82
+ [key: string]: unknown | string | undefined;
83
+ };
84
+ slug: string;
85
+ full_slug: string;
86
+ sort_by_date: string | null;
87
+ position: number;
88
+ tag_list: Array<string>;
89
+ is_startpage: boolean;
90
+ parent_id: number;
91
+ /**
92
+ * Custom metadata for the story.
93
+ */
94
+ meta_data: {
95
+ [key: string]: unknown;
96
+ } | null;
97
+ group_id: string;
98
+ first_published_at: string | null;
99
+ release_id?: number | null;
100
+ lang: string;
101
+ path: string | null;
102
+ alternates: Array<StoryAlternate>;
103
+ default_full_slug: string | null;
104
+ translated_slugs: Array<{
105
+ path: string;
106
+ name: string | null;
107
+ lang: string;
108
+ published: string | null;
109
+ }> | null;
110
+ };
111
+ type StoryAlternate = {
112
+ id: number;
113
+ name: string;
114
+ slug: string;
115
+ published: boolean | null;
116
+ full_slug: string;
117
+ is_folder: boolean;
118
+ parent_id: number;
119
+ };
120
+ //#endregion
121
+ //#region src/generated/mapi/_internal.gen.d.ts
122
+ type Component = {
123
+ /**
124
+ * Unique identifier for the component
125
+ */
126
+ readonly id: number;
127
+ /**
128
+ * Technical name of the component.
129
+ */
130
+ name: string;
131
+ /**
132
+ * Human-readable display name
133
+ */
134
+ display_name?: string | null;
135
+ /**
136
+ * Component description
137
+ */
138
+ description?: string | null;
139
+ /**
140
+ * Creation timestamp (format is ISO 8601 standard in UTC).
141
+ */
142
+ readonly created_at: string;
143
+ /**
144
+ * Latest update timestamp (format is ISO 8601 standard in UTC).
145
+ */
146
+ updated_at: string;
147
+ /**
148
+ * Component field schema definition
149
+ */
150
+ schema: {
151
+ [key: string]: {
152
+ type?: 'bloks' | 'text' | 'textarea' | 'richtext' | 'markdown' | 'number' | 'datetime' | 'boolean' | 'options' | 'option' | 'asset' | 'multiasset' | 'multilink' | 'table' | 'section' | 'commerce' | 'custom' | 'image' | 'file' | 'tab' | 'link' | 'group';
153
+ /**
154
+ * Field ID
155
+ */
156
+ id?: string;
157
+ [key: string]: unknown | 'bloks' | 'text' | 'textarea' | 'richtext' | 'markdown' | 'number' | 'datetime' | 'boolean' | 'options' | 'option' | 'asset' | 'multiasset' | 'multilink' | 'table' | 'section' | 'commerce' | 'custom' | 'image' | 'file' | 'tab' | 'link' | 'group' | string | undefined;
158
+ };
159
+ };
160
+ /**
161
+ * Component image URL
162
+ */
163
+ image?: string | null;
164
+ /**
165
+ * Field used for preview.
166
+ */
167
+ preview_field?: string | null;
168
+ /**
169
+ * Whether this component can be used as a root component.
170
+ */
171
+ is_root: boolean;
172
+ /**
173
+ * Preview template HTML.
174
+ */
175
+ preview_tmpl?: string | null;
176
+ /**
177
+ * Whether this component can be nested inside other components.
178
+ */
179
+ is_nestable: boolean;
180
+ /**
181
+ * All presets associated with this component.
182
+ */
183
+ all_presets?: Array<{
184
+ /**
185
+ * Preset ID
186
+ */
187
+ id?: number;
188
+ /**
189
+ * Preset name
190
+ */
191
+ name?: string;
192
+ /**
193
+ * Preset schema
194
+ */
195
+ preset?: {
196
+ [key: string]: unknown;
197
+ };
198
+ /**
199
+ * ID of the component this preset belongs to
200
+ */
201
+ component_id?: number;
202
+ /**
203
+ * Image URL for the preset preview
204
+ */
205
+ image?: string | null;
206
+ /**
207
+ * Icon name for the preset
208
+ */
209
+ icon?: string | null;
210
+ /**
211
+ * Color for the preset display
212
+ */
213
+ color?: string | null;
214
+ /**
215
+ * Description of the preset
216
+ */
217
+ description?: string | null;
218
+ }>;
219
+ /**
220
+ * Default preset ID.
221
+ */
222
+ preset_id?: number | null;
223
+ /**
224
+ * Display name if available, otherwise technical name.
225
+ */
226
+ real_name?: string;
227
+ /**
228
+ * UUID of the component group this component belongs to.
229
+ */
230
+ component_group_uuid?: string | null;
231
+ /**
232
+ * Component color for UI display
233
+ */
234
+ color?: string | null;
235
+ /**
236
+ * Component icon name
237
+ */
238
+ icon?: string | null;
239
+ internal_tags_list?: Array<{
240
+ /**
241
+ * ID
242
+ */
243
+ id?: number;
244
+ /**
245
+ * Name
246
+ */
247
+ name?: string;
248
+ }>;
249
+ /**
250
+ * List of internal tag IDs
251
+ */
252
+ internal_tag_ids?: Array<string>;
253
+ /**
254
+ * Content Type Asset preview.
255
+ */
256
+ content_type_asset_preview?: string | null;
257
+ /**
258
+ * Component metadata.
259
+ */
260
+ metadata?: {
261
+ [key: string]: unknown;
262
+ } | null;
263
+ };
264
+ //#endregion
265
+ //#region src/generated/overlay/_internal.gen.d.ts
266
+ /**
267
+ * A component schema field. Discriminated by the literal `type` enum on each variant.
268
+ */
269
+ type Field = TextFieldRoot | TextareaFieldRoot | RichtextFieldRoot | MarkdownFieldRoot | NumberFieldRoot | DatetimeFieldRoot | BooleanFieldRoot | OptionFieldRoot | OptionsFieldRoot | AssetFieldRoot | MultiassetFieldRoot | MultilinkFieldRoot | BloksFieldRoot | TableFieldRoot | SectionFieldRoot | TabFieldRoot | CustomFieldRoot;
270
+ type AssetFieldValue = AssetFieldValueRoot;
271
+ type BlockContentBase = BlockContentRoot;
272
+ type MultilinkFieldValue = MultilinkFieldValueRoot;
273
+ type PluginFieldValue = PluginFieldValueRoot;
274
+ type RichtextFieldValue = RichtextFieldValueRoot;
275
+ type TableFieldValue = TableFieldValueRoot;
276
+ type TextFieldRoot = BaseFieldRoot & ValueFieldRoot & {
277
+ /**
278
+ * Field type discriminant
279
+ */
280
+ type: 'text';
281
+ /**
282
+ * Maximum length of the input string
283
+ */
284
+ max_length?: number;
285
+ /**
286
+ * Maximum length for text fields (legacy alias for max_length)
287
+ */
288
+ maxlength?: number;
289
+ /**
290
+ * Minimum length for text fields
291
+ */
292
+ minlength?: number;
293
+ /**
294
+ * Field size (small, medium, large)
295
+ */
296
+ size?: string;
297
+ /**
298
+ * Whether to enable right-to-left text direction
299
+ */
300
+ rtl?: boolean;
301
+ };
302
+ type TextareaFieldRoot = BaseFieldRoot & ValueFieldRoot & {
303
+ /**
304
+ * Field type discriminant
305
+ */
306
+ type: 'textarea';
307
+ /**
308
+ * Maximum length of the input string
309
+ */
310
+ max_length?: number;
311
+ /**
312
+ * Maximum length for text fields (legacy alias for max_length)
313
+ */
314
+ maxlength?: number;
315
+ /**
316
+ * Minimum length for text fields
317
+ */
318
+ minlength?: number;
319
+ /**
320
+ * Field size (small, medium, large)
321
+ */
322
+ size?: string;
323
+ /**
324
+ * Whether to enable right-to-left text direction
325
+ */
326
+ rtl?: boolean;
327
+ /**
328
+ * Whether rich text is enabled
329
+ */
330
+ rich_text?: boolean;
331
+ /**
332
+ * Whether markdown is enabled
333
+ */
334
+ markdown?: boolean;
335
+ };
336
+ type RichtextFieldRoot = BaseFieldRoot & ValueFieldRoot & {
337
+ /**
338
+ * Field type discriminant
339
+ */
340
+ type: 'richtext';
341
+ /**
342
+ * Whether to allow toolbar customization
343
+ */
344
+ customize_toolbar?: boolean;
345
+ /**
346
+ * Array of enabled toolbar elements
347
+ */
348
+ toolbar?: Array<'ai-complete' | 'ai-shorten' | 'ai-extend' | 'ai-rephrase' | 'ai-summarize' | 'ai-simplify' | 'ai-tone' | 'ai-emoji' | 'ai-translate' | 'ai-tldr' | 'ai-spelling' | 'blok' | 'ltr' | 'rtl' | 'export' | 'import' | 'bold' | 'list' | 'inlinecode' | 'code' | 'color' | 'copy' | 'cut' | 'emoji' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'highlight' | 'unset' | 'hrule' | 'image' | 'italic' | 'link' | 'anchor' | 'olist' | 'paragraph' | 'paste-action' | 'paste' | 'quote' | 'redo' | 'strike' | 'subscript' | 'superscript' | 'underline' | 'undo' | 'align-left' | 'align-center' | 'align-right' | 'align-justify'>;
349
+ /**
350
+ * Custom CSS styles for the richtext field
351
+ */
352
+ style_options?: Array<{
353
+ _uid?: string;
354
+ name?: string;
355
+ value?: string;
356
+ }>;
357
+ /**
358
+ * Restriction type for component selection (groups, tags, or empty for specific blocks)
359
+ */
360
+ restrict_type?: string;
361
+ /**
362
+ * Whether to restrict which components can be inserted
363
+ */
364
+ restrict_components?: boolean;
365
+ /**
366
+ * List of allowed component names
367
+ */
368
+ component_whitelist?: Array<string>;
369
+ /**
370
+ * List of denied component names
371
+ */
372
+ component_denylist?: Array<string>;
373
+ /**
374
+ * List of allowed tag IDs for component filtering
375
+ */
376
+ component_tag_whitelist?: Array<number>;
377
+ /**
378
+ * List of denied tag IDs for component filtering
379
+ */
380
+ component_tag_denylist?: Array<number>;
381
+ /**
382
+ * List of allowed component group UUIDs
383
+ */
384
+ component_group_whitelist?: Array<string>;
385
+ /**
386
+ * List of denied component group UUIDs
387
+ */
388
+ component_group_denylist?: Array<string>;
389
+ /**
390
+ * Whether to allow links to open in a new tab
391
+ */
392
+ allow_target_blank?: boolean;
393
+ /**
394
+ * Whether to allow custom link attributes
395
+ */
396
+ allow_custom_attributes?: boolean;
397
+ };
398
+ type MarkdownFieldRoot = BaseFieldRoot & ValueFieldRoot & {
399
+ /**
400
+ * Field type discriminant
401
+ */
402
+ type: 'markdown';
403
+ /**
404
+ * Whether to display markdown as rich text
405
+ */
406
+ rich_markdown?: boolean;
407
+ /**
408
+ * Whether to enable right-to-left text direction
409
+ */
410
+ rtl?: boolean;
411
+ /**
412
+ * Whether to enable a customized toolbar
413
+ */
414
+ customize_toolbar?: boolean;
415
+ /**
416
+ * Array of enabled toolbar elements
417
+ */
418
+ toolbar?: Array<'bold' | 'italic' | 'inlinecode' | 'code' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'list' | 'olist' | 'quote' | 'hrule' | 'link' | 'image' | 'paragraph' | 'help' | 'toggle-richtext' | 'auto' | 'ltr' | 'rtl'>;
419
+ /**
420
+ * Whether to allow empty paragraphs
421
+ */
422
+ allow_multiline?: boolean;
423
+ /**
424
+ * Maximum length of the input string
425
+ */
426
+ max_length?: number;
427
+ };
428
+ type NumberFieldRoot = BaseFieldRoot & ValueFieldRoot & {
429
+ /**
430
+ * Field type discriminant
431
+ */
432
+ type: 'number';
433
+ /**
434
+ * Minimum value allowed
435
+ */
436
+ min_value?: number;
437
+ /**
438
+ * Maximum value allowed
439
+ */
440
+ max_value?: number;
441
+ /**
442
+ * Number of decimal places
443
+ */
444
+ decimals?: number;
445
+ /**
446
+ * Step size for the number input
447
+ */
448
+ steps?: number;
449
+ };
450
+ type DatetimeFieldRoot = BaseFieldRoot & ValueFieldRoot & {
451
+ /**
452
+ * Field type discriminant
453
+ */
454
+ type: 'datetime';
455
+ /**
456
+ * Whether to disable time selection (date-only mode)
457
+ */
458
+ disable_time?: boolean;
459
+ };
460
+ type BooleanFieldRoot = BaseFieldRoot & ValueFieldRoot & {
461
+ /**
462
+ * Field type discriminant
463
+ */
464
+ type: 'boolean';
465
+ /**
466
+ * Whether to display the label next to the toggle
467
+ */
468
+ inline_label?: boolean;
469
+ };
470
+ type OptionFieldRoot = BaseFieldRoot & ValueFieldRoot & {
471
+ /**
472
+ * Field type discriminant
473
+ */
474
+ type: 'option';
475
+ /**
476
+ * Array of selectable options
477
+ */
478
+ options?: Array<{
479
+ _uid?: string;
480
+ name?: string;
481
+ value?: string;
482
+ }>;
483
+ /**
484
+ * Source of the options (undefined=self, internal_stories, internal_languages, external, internal)
485
+ */
486
+ source?: string;
487
+ /**
488
+ * Datasource slug when source is internal
489
+ */
490
+ datasource_slug?: string;
491
+ /**
492
+ * External datasource JSON URL when source is external
493
+ */
494
+ external_datasource?: string;
495
+ /**
496
+ * Path of allowed stories folder when source is internal_stories
497
+ */
498
+ folder_slug?: string;
499
+ /**
500
+ * Allowed content type blocks when source is internal_stories
501
+ */
502
+ filter_content_type?: Array<string>;
503
+ /**
504
+ * Whether to exclude the empty option
505
+ */
506
+ exclude_empty_option?: boolean;
507
+ /**
508
+ * Whether to include an empty option
509
+ */
510
+ include_empty_option?: boolean;
511
+ /**
512
+ * Whether to use UUID for the option value
513
+ */
514
+ use_uuid?: boolean;
515
+ /**
516
+ * Display appearance (link or card) when source is internal_stories
517
+ */
518
+ entry_appearance?: string;
519
+ /**
520
+ * Whether to allow advanced search in a modal when source is internal_stories
521
+ */
522
+ allow_advanced_search?: boolean;
523
+ /**
524
+ * Maximum number of selectable options
525
+ */
526
+ max_options?: string;
527
+ /**
528
+ * Minimum number of selectable options
529
+ */
530
+ min_options?: string;
531
+ /**
532
+ * Whether multiple values are allowed
533
+ */
534
+ multiple?: boolean;
535
+ };
536
+ type OptionsFieldRoot = BaseFieldRoot & ValueFieldRoot & {
537
+ /**
538
+ * Field type discriminant
539
+ */
540
+ type: 'options';
541
+ /**
542
+ * Array of selectable options
543
+ */
544
+ options?: Array<{
545
+ _uid?: string;
546
+ name?: string;
547
+ value?: string;
548
+ }>;
549
+ /**
550
+ * Source of the options (undefined=self, internal_stories, internal_languages, external, internal)
551
+ */
552
+ source?: string;
553
+ /**
554
+ * Datasource slug when source is internal
555
+ */
556
+ datasource_slug?: string;
557
+ /**
558
+ * External datasource JSON URL when source is external
559
+ */
560
+ external_datasource?: string;
561
+ /**
562
+ * Path of allowed stories folder when source is internal_stories
563
+ */
564
+ folder_slug?: string;
565
+ /**
566
+ * Allowed content type blocks when source is internal_stories
567
+ */
568
+ filter_content_type?: Array<string>;
569
+ /**
570
+ * Whether to use UUID for the option values
571
+ */
572
+ use_uuid?: boolean;
573
+ /**
574
+ * Whether this Multi-Options field is a References field
575
+ */
576
+ is_reference_type?: boolean;
577
+ /**
578
+ * Display appearance (link or card) when source is internal_stories
579
+ */
580
+ entry_appearance?: string;
581
+ /**
582
+ * Whether to allow advanced search in a modal when source is internal_stories
583
+ */
584
+ allow_advanced_search?: boolean;
585
+ /**
586
+ * Maximum number of selectable options
587
+ */
588
+ max_options?: string;
589
+ /**
590
+ * Minimum number of selectable options
591
+ */
592
+ min_options?: string;
593
+ /**
594
+ * Whether multiple values are allowed
595
+ */
596
+ multiple?: boolean;
597
+ };
598
+ type AssetFieldRoot = BaseFieldRoot & ValueFieldRoot & {
599
+ /**
600
+ * Field type discriminant
601
+ */
602
+ type: 'asset';
603
+ /**
604
+ * Allowed file types (images, videos, audios, texts)
605
+ */
606
+ filetypes?: Array<string>;
607
+ /**
608
+ * Numeric ID of the allowed asset folder
609
+ */
610
+ asset_folder_id?: number;
611
+ /**
612
+ * Whether to allow external URLs
613
+ */
614
+ allow_external_url?: boolean;
615
+ /**
616
+ * Field height in pixels
617
+ */
618
+ height?: number;
619
+ /**
620
+ * Field width in pixels
621
+ */
622
+ width?: number;
623
+ /**
624
+ * Whether to restrict assets
625
+ */
626
+ restrict_assets?: boolean;
627
+ /**
628
+ * List of allowed asset types
629
+ */
630
+ asset_whitelist?: Array<string>;
631
+ };
632
+ type MultiassetFieldRoot = BaseFieldRoot & ValueFieldRoot & {
633
+ /**
634
+ * Field type discriminant
635
+ */
636
+ type: 'multiasset';
637
+ /**
638
+ * Allowed file types (images, videos, audios, texts)
639
+ */
640
+ filetypes?: Array<string>;
641
+ /**
642
+ * Numeric ID of the allowed asset folder
643
+ */
644
+ asset_folder_id?: number;
645
+ /**
646
+ * Whether to allow external URLs
647
+ */
648
+ allow_external_url?: boolean;
649
+ /**
650
+ * Field height in pixels
651
+ */
652
+ height?: number;
653
+ /**
654
+ * Field width in pixels
655
+ */
656
+ width?: number;
657
+ /**
658
+ * Whether to restrict assets
659
+ */
660
+ restrict_assets?: boolean;
661
+ /**
662
+ * List of allowed asset types
663
+ */
664
+ asset_whitelist?: Array<string>;
665
+ /**
666
+ * Maximum number of entries
667
+ */
668
+ maximum_entries?: number;
669
+ /**
670
+ * Minimum number of entries
671
+ */
672
+ minimum_entries?: number;
673
+ };
674
+ type MultilinkFieldRoot = BaseFieldRoot & ValueFieldRoot & {
675
+ /**
676
+ * Field type discriminant
677
+ */
678
+ type: 'multilink';
679
+ /**
680
+ * Whether to restrict linkable content types
681
+ */
682
+ restrict_content_types?: boolean;
683
+ /**
684
+ * List of allowed content type blocks for internal links
685
+ */
686
+ component_whitelist?: Array<string>;
687
+ /**
688
+ * Whether to allow opening links in a new tab
689
+ */
690
+ allow_target_blank?: boolean;
691
+ /**
692
+ * Whether to allow setting custom link attributes
693
+ */
694
+ allow_custom_attributes?: boolean;
695
+ /**
696
+ * Whether to restrict to a specific folder
697
+ */
698
+ force_link_scope?: boolean;
699
+ /**
700
+ * Path of the allowed folder when force_link_scope is true
701
+ */
702
+ link_scope?: string;
703
+ /**
704
+ * Whether to allow defining an anchor ID for internal links
705
+ */
706
+ show_anchor?: boolean;
707
+ /**
708
+ * Whether to allow specifying an email address
709
+ */
710
+ email_link_type?: boolean;
711
+ /**
712
+ * Whether to allow specifying an asset URL
713
+ */
714
+ asset_link_type?: boolean;
715
+ };
716
+ type BloksFieldRoot = BaseFieldRoot & ValueFieldRoot & {
717
+ /**
718
+ * Field type discriminant
719
+ */
720
+ type: 'bloks';
721
+ /**
722
+ * Restriction type for component selection (groups, tags, or empty for specific blocks)
723
+ */
724
+ restrict_type?: string;
725
+ /**
726
+ * Whether to restrict which components can be inserted
727
+ */
728
+ restrict_components?: boolean;
729
+ /**
730
+ * List of allowed component names
731
+ */
732
+ component_whitelist?: Array<string>;
733
+ /**
734
+ * List of denied component names
735
+ */
736
+ component_denylist?: Array<string>;
737
+ /**
738
+ * List of allowed tag IDs for component filtering
739
+ */
740
+ component_tag_whitelist?: Array<number>;
741
+ /**
742
+ * List of denied tag IDs for component filtering
743
+ */
744
+ component_tag_denylist?: Array<number>;
745
+ /**
746
+ * List of allowed component group UUIDs
747
+ */
748
+ component_group_whitelist?: Array<string>;
749
+ /**
750
+ * List of denied component group UUIDs
751
+ */
752
+ component_group_denylist?: Array<string>;
753
+ /**
754
+ * Minimum number of bloks
755
+ */
756
+ minimum?: number;
757
+ /**
758
+ * Maximum number of bloks
759
+ */
760
+ maximum?: number;
761
+ /**
762
+ * Maximum number of entries
763
+ */
764
+ maximum_entries?: number;
765
+ /**
766
+ * Minimum number of entries
767
+ */
768
+ minimum_entries?: number;
769
+ };
770
+ type TableFieldRoot = BaseFieldRoot & ValueFieldRoot & {
771
+ /**
772
+ * Field type discriminant
773
+ */
774
+ type: 'table';
775
+ };
776
+ type SectionFieldRoot = BaseFieldRoot & {
777
+ /**
778
+ * Field type discriminant
779
+ */
780
+ type: 'section';
781
+ /**
782
+ * Field keys that belong to this section
783
+ */
784
+ keys?: Array<string>;
785
+ /**
786
+ * Fieldset configuration
787
+ */
788
+ fieldset?: {
789
+ /**
790
+ * Fieldset title
791
+ */
792
+ title?: string;
793
+ /**
794
+ * Fieldset description
795
+ */
796
+ description?: string;
797
+ /**
798
+ * Whether the fieldset is collapsible
799
+ */
800
+ collapsible?: boolean;
801
+ /**
802
+ * Whether the fieldset is collapsed by default
803
+ */
804
+ collapsed?: boolean;
805
+ };
806
+ };
807
+ type TabFieldRoot = BaseFieldRoot & {
808
+ /**
809
+ * Field type discriminant
810
+ */
811
+ type: 'tab';
812
+ /**
813
+ * Field keys that belong to this tab
814
+ */
815
+ keys?: Array<string>;
816
+ };
817
+ type CustomFieldRoot = BaseFieldRoot & ValueFieldRoot & {
818
+ /**
819
+ * Field type discriminant
820
+ */
821
+ type: 'custom';
822
+ /**
823
+ * Technical name of the field plugin
824
+ */
825
+ field_type?: string;
826
+ /**
827
+ * Plugin-specific options
828
+ */
829
+ options?: Array<{
830
+ name?: string;
831
+ value?: string;
832
+ }>;
833
+ /**
834
+ * Comma-separated list of required field names in the plugin
835
+ */
836
+ required_fields?: string;
837
+ /**
838
+ * Source for plugin-provided options (`self` or `internal` for datasource)
839
+ */
840
+ source?: 'self' | 'internal';
841
+ /**
842
+ * Slug of the internal datasource when `source` is `internal`
843
+ */
844
+ datasource_slug?: string;
845
+ /**
846
+ * URL to an external datasource when `source` is set accordingly
847
+ */
848
+ external_datasource?: string;
849
+ };
850
+ /**
851
+ * Asset field type - single asset (image, video, audio, or document)
852
+ */
853
+ type AssetFieldValueRoot = {
854
+ /**
855
+ * Identifies this as an asset field
856
+ */
857
+ fieldtype: 'asset';
858
+ /**
859
+ * Numeric ID of the asset
860
+ */
861
+ id: number | null;
862
+ /**
863
+ * Alternative text for the asset
864
+ */
865
+ alt: string | null;
866
+ /**
867
+ * Name of the asset
868
+ */
869
+ name?: string;
870
+ /**
871
+ * Focal point coordinates for cropping (format "123x456:789x1011")
872
+ */
873
+ focus?: string | null;
874
+ /**
875
+ * Title of the asset
876
+ */
877
+ title?: string | null;
878
+ /**
879
+ * Source attribution for the asset
880
+ */
881
+ source?: string | null;
882
+ /**
883
+ * URL to the asset file
884
+ */
885
+ filename: string;
886
+ /**
887
+ * Copyright information
888
+ */
889
+ copyright?: string | null;
890
+ /**
891
+ * Additional metadata for the asset
892
+ */
893
+ meta_data?: {
894
+ [key: string]: unknown;
895
+ };
896
+ /**
897
+ * Whether the asset is hosted externally
898
+ */
899
+ is_external_url?: boolean;
900
+ };
901
+ /**
902
+ * Content object representing a component instance. Contains a _uid, a component technical name, and dynamic fields whose values depend on the component's schema field types (text, textarea, richtext, markdown, number, datetime, boolean, option, options, asset, multiasset, multilink, bloks, table, section, custom/plugin).
903
+ */
904
+ type BlockContentRoot = {
905
+ /**
906
+ * Unique identifier for this component instance
907
+ */
908
+ _uid: string;
909
+ /**
910
+ * Technical name of the component (content type or nestable block)
911
+ */
912
+ component: string;
913
+ /**
914
+ * Storyblok editor markup string for inline editing (present in draft/preview mode)
915
+ */
916
+ _editable?: string;
917
+ [key: string]: string | number | boolean | Array<string | AssetFieldValueRoot | BlockContentRoot> | AssetFieldValueRoot | MultilinkFieldValueRoot | TableFieldValueRoot | RichtextFieldValueRoot | PluginFieldValueRoot | string | undefined;
918
+ };
919
+ /**
920
+ * Multilink field type - link to internal stories, external URLs, emails, etc.
921
+ */
922
+ type MultilinkFieldValueRoot = {
923
+ /**
924
+ * Identifies this as a multilink field
925
+ */
926
+ fieldtype: 'multilink';
927
+ /**
928
+ * UUID of the linked story (for internal links)
929
+ */
930
+ id: string;
931
+ /**
932
+ * URL for external links or email addresses
933
+ */
934
+ url: string;
935
+ /**
936
+ * Type of link
937
+ */
938
+ linktype: 'story' | 'url' | 'email' | 'asset';
939
+ /**
940
+ * Cached URL path for the linked story
941
+ */
942
+ cached_url: string;
943
+ /**
944
+ * Anchor/fragment identifier for the link
945
+ */
946
+ anchor?: string | null;
947
+ /**
948
+ * Link target attribute
949
+ */
950
+ target?: '_self' | '_blank' | null;
951
+ };
952
+ /**
953
+ * Plugin/Custom field type - field plugin with custom structure
954
+ */
955
+ type PluginFieldValueRoot = {
956
+ /**
957
+ * Technical name of the field plugin
958
+ */
959
+ plugin: string;
960
+ /**
961
+ * Unique identifier for this plugin field instance
962
+ */
963
+ _uid?: string;
964
+ [key: string]: unknown | string | undefined;
965
+ };
966
+ /**
967
+ * Richtext field type - structured rich text document (ProseMirror format)
968
+ */
969
+ type RichtextFieldValueRoot = {
970
+ /**
971
+ * Root node type for richtext documents
972
+ */
973
+ type: 'doc';
974
+ /**
975
+ * Array of richtext nodes (paragraphs, headings, lists, bloks, etc.)
976
+ */
977
+ content?: Array<{
978
+ [key: string]: unknown;
979
+ }>;
980
+ };
981
+ /**
982
+ * Table field type - structured table data
983
+ */
984
+ type TableFieldValueRoot = {
985
+ /**
986
+ * Table header cells
987
+ */
988
+ thead: Array<{
989
+ _uid: string;
990
+ component: '_table_head';
991
+ /**
992
+ * Header cell content
993
+ */
994
+ value?: string;
995
+ }>;
996
+ /**
997
+ * Table body rows
998
+ */
999
+ tbody: Array<{
1000
+ _uid: string;
1001
+ component: '_table_row';
1002
+ /**
1003
+ * Cells in this row
1004
+ */
1005
+ body?: Array<{
1006
+ _uid: string;
1007
+ component: '_table_col';
1008
+ /**
1009
+ * Cell content
1010
+ */
1011
+ value?: string;
1012
+ }>;
1013
+ }>;
1014
+ };
1015
+ /**
1016
+ * Universal identity and display properties shared by every field type
1017
+ */
1018
+ type BaseFieldRoot = {
1019
+ /**
1020
+ * Field type discriminant
1021
+ */
1022
+ type?: string;
1023
+ /**
1024
+ * The ID of the field
1025
+ */
1026
+ id?: string;
1027
+ /**
1028
+ * Human-readable display name
1029
+ */
1030
+ display_name?: string;
1031
+ /**
1032
+ * Field description displayed in the editor
1033
+ */
1034
+ description?: string;
1035
+ /**
1036
+ * Whether to display the description as a tooltip
1037
+ */
1038
+ tooltip?: boolean;
1039
+ /**
1040
+ * Position of the field within the block
1041
+ */
1042
+ pos?: number;
1043
+ /**
1044
+ * Conditions set on the field for conditional visibility
1045
+ */
1046
+ conditional_settings?: Array<{
1047
+ [key: string]: unknown;
1048
+ }>;
1049
+ };
1050
+ /**
1051
+ * Properties shared by content-bearing fields (i.e. fields that hold a value).
1052
+ * Layout-only field types like `section` and `tab` do not include these.
1053
+ *
1054
+ */
1055
+ type ValueFieldRoot = {
1056
+ /**
1057
+ * Whether the field is required
1058
+ */
1059
+ required?: boolean;
1060
+ /**
1061
+ * Regular expression for validation
1062
+ */
1063
+ regex?: string;
1064
+ /**
1065
+ * Default value for the field (can be escaped JSON)
1066
+ */
1067
+ default_value?: string;
1068
+ /**
1069
+ * Whether the field is translatable
1070
+ */
1071
+ translatable?: boolean;
1072
+ /**
1073
+ * Exclude the field from translation exports
1074
+ */
1075
+ no_translate?: boolean;
1076
+ /**
1077
+ * Exclude the field from AI translations
1078
+ */
1079
+ exclude_from_ai_translation?: boolean;
1080
+ /**
1081
+ * Exclude the field when merging (Dimensions App)
1082
+ */
1083
+ exclude_from_merge?: boolean;
1084
+ /**
1085
+ * Exclude the field when overwriting (Dimensions App)
1086
+ */
1087
+ exclude_from_overwrite?: boolean;
1088
+ /**
1089
+ * Overwrite the field when merging (Dimensions App)
1090
+ */
1091
+ force_merge?: boolean;
1092
+ };
1093
+ //#endregion
1094
+ //#region src/generated/types/_utils.d.ts
1095
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
1096
+ /** Replaces the keys of `T` that also appear in `U` with the definitions from `U`. */
1097
+ type Override<T, U> = Prettify<Omit<T, keyof U> & U>;
1098
+ //#endregion
1099
+ //#region src/generated/types/block.d.ts
1100
+ /** Wire form: the MAPI object map keyed by field name. This is what `defineBlock` returns. */
1101
+ type BlockSchema = Record<string, Field & {
1102
+ required?: boolean;
1103
+ }>;
1104
+ /** A Storyblok block. */
1105
+ type Block<TName extends string = string, TBlockSchema extends BlockSchema = BlockSchema, TIsRoot extends boolean = boolean, TIsNestable extends boolean = boolean, TComponentGroupUuid extends string | null = string | null> = Override<Component, {
1106
+ name: TName;
1107
+ schema: TBlockSchema;
1108
+ is_root?: TIsRoot;
1109
+ is_nestable?: TIsNestable;
1110
+ component_group_uuid?: TComponentGroupUuid;
1111
+ }>;
1112
+ /**
1113
+ * A root {@link Block} (`is_root: true`). Given a union of blocks, narrows to
1114
+ * its root members; with no argument it is the generic root-block type.
1115
+ */
1116
+ type RootBlock<T extends Block = Block & {
1117
+ is_root: true;
1118
+ }> = Extract<T, {
1119
+ is_root: true;
1120
+ }>;
1121
+ //#endregion
1122
+ //#region src/generated/types/field.d.ts
1123
+ /**
1124
+ * Registry of all blocks in the space, used to resolve nested `bloks` fields.
1125
+ * A `Block` union resolves nested content against the registry; `NoBlocks`
1126
+ * (the default) leaves it loose (`BlockContentBase`).
1127
+ */
1128
+ type NoBlocks$1 = false;
1129
+ /** True when `T` is the un-narrowed base `Block` (i.e. no specific block was supplied). */
1130
+ type IsBaseBlock<T> = [Block] extends [T] ? true : false;
1131
+ type RequiredFieldKeys<T> = { [K in keyof T]: T[K] extends {
1132
+ required: true;
1133
+ } ? K : never }[keyof T];
1134
+ type OptionalFieldKeys<T> = Exclude<keyof T, RequiredFieldKeys<T>>;
1135
+ /**
1136
+ * Content object for a single block instance as returned by the Storyblok
1137
+ * Content Delivery API. Without a `TBlock` argument, this is the loose
1138
+ * runtime shape (any block, `_editable` optional). With a schema-typed
1139
+ * `TBlock`, fields are narrowed per the block's schema.
1140
+ */
1141
+ type BlockContent<TBlock extends Block = Block, TBlocks = NoBlocks$1> = IsBaseBlock<TBlock> extends true ? BlockContentBase : TBlock extends any ? Prettify<{
1142
+ _uid: string;
1143
+ component: TBlock['name'];
5
1144
  _editable?: string;
1145
+ } & { [K in RequiredFieldKeys<TBlock['schema']>]: FieldValue<NonNullable<TBlock['schema'][K]>, TBlocks> } & { [K in OptionalFieldKeys<TBlock['schema']>]?: FieldValue<NonNullable<TBlock['schema'][K]>, TBlocks> | null }> : never;
1146
+ interface FieldTypeValueMap {
1147
+ text: string;
1148
+ textarea: string;
1149
+ richtext: RichtextFieldValue;
1150
+ markdown: string;
1151
+ number: number;
1152
+ datetime: string;
1153
+ boolean: boolean;
1154
+ option: string;
1155
+ options: string[];
1156
+ asset: AssetFieldValue;
1157
+ multiasset: AssetFieldValue[];
1158
+ multilink: MultilinkFieldValue;
1159
+ bloks: BlockContentBase[];
1160
+ table: TableFieldValue;
1161
+ section: never;
1162
+ tab: never;
1163
+ custom: PluginFieldValue;
6
1164
  }
7
- declare function storyblokEditable(blok?: Blok): {
1165
+ type IsNestable<T> = T extends {
1166
+ is_nestable: false;
1167
+ } ? false : T extends {
1168
+ is_nestable: true;
1169
+ } ? true : true;
1170
+ type ApplyWhitelist<TField, TBlocks> = TField extends {
1171
+ component_whitelist: ReadonlyArray<infer TWhitelisted extends string>;
1172
+ } ? Extract<TBlocks, {
1173
+ name: TWhitelisted;
1174
+ }> : TBlocks extends any ? IsNestable<TBlocks> extends true ? TBlocks : never : never;
1175
+ /** Resolves a field definition to its runtime content value type (read). */
1176
+ type FieldValue<TField extends Field = Field, TBlocks = NoBlocks$1> = Prettify<TField extends {
1177
+ type: 'bloks';
1178
+ } ? [TBlocks] extends [never] ? BlockContentBase[] : [TBlocks] extends [Block] ? BlockContent<ApplyWhitelist<TField, TBlocks>, TBlocks>[] : BlockContentBase[] : FieldTypeValueMap[TField['type']]>;
1179
+ //#endregion
1180
+ //#region src/editable.d.ts
1181
+ declare function storyblokEditable(block?: Pick<BlockContent, '_editable'>): {
8
1182
  'data-blok-c'?: undefined;
9
1183
  'data-blok-uid'?: undefined;
10
1184
  } | {
@@ -12,6 +1186,18 @@ declare function storyblokEditable(blok?: Blok): {
12
1186
  'data-blok-uid': string;
13
1187
  };
14
1188
  //#endregion
1189
+ //#region src/generated/types/story.d.ts
1190
+ /**
1191
+ * Registry of all blocks, threaded through to resolve nested `bloks` fields.
1192
+ * `NoBlocks` (the default) leaves nested content loose (`BlockContentBase`).
1193
+ */
1194
+ type NoBlocks = false;
1195
+ type CapiStoryWithSchemaContent<TBlock extends RootBlock = RootBlock, TBlocks = NoBlocks> = Override<CapiStory, {
1196
+ content: BlockContent<TBlock, TBlocks>;
1197
+ }>;
1198
+ /** A Storyblok CDN (CAPI) story. */
1199
+ type Story<TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = Prettify<[TBlockOrBlocks] extends [RootBlock] ? CapiStoryWithSchemaContent<TBlockOrBlocks, TBlocks> : TBlocks extends NoBlocks ? CapiStoryWithSchemaContent<Extract<TBlockOrBlocks, RootBlock>, TBlockOrBlocks> : never>;
1200
+ //#endregion
15
1201
  //#region src/loadStoryblokBridge.d.ts
16
1202
  /**
17
1203
  * Get or create a StoryblokBridge instance.
@@ -21,115 +1207,21 @@ declare function storyblokEditable(blok?: Blok): {
21
1207
  */
22
1208
  declare function loadStoryblokBridge(config?: BridgeParams$1): Promise<StoryblokBridge>;
23
1209
  //#endregion
24
- //#region ../js-client/dist/index.d.mts
25
- interface ISbComponentType<T extends string> {
26
- _uid?: string;
27
- component?: T;
28
- _editable?: string;
29
- }
30
- interface PreviewToken {
31
- token: string;
32
- timestamp: string;
33
- }
34
- interface LocalizedPath {
35
- path: string;
36
- name: string | null;
37
- lang: string;
38
- published: boolean;
39
- }
40
- interface ISbStoryData<Content = ISbComponentType<string> & {
41
- [index: string]: any;
42
- }> extends ISbMultipleStoriesData {
43
- alternates: ISbAlternateObject[];
44
- breadcrumbs?: ISbLinkURLObject[];
45
- content: Content;
46
- created_at: string;
47
- deleted_at?: string;
48
- default_full_slug?: string | null;
49
- default_root?: string;
50
- disable_fe_editor?: boolean;
51
- favourite_for_user_ids?: number[] | null;
52
- first_published_at?: string | null;
53
- full_slug: string;
54
- group_id: string;
55
- id: number;
56
- imported_at?: string;
57
- is_folder?: boolean;
58
- is_startpage?: boolean;
59
- lang: string;
60
- last_author?: {
61
- id: number;
62
- userid: string;
63
- };
64
- last_author_id?: number;
65
- localized_paths?: LocalizedPath[] | null;
66
- meta_data: any;
67
- name: string;
68
- parent?: ISbStoryData;
69
- parent_id: number | null;
70
- path?: string;
71
- pinned?: '1' | boolean;
72
- position: number;
73
- preview_token?: PreviewToken;
74
- published?: boolean;
75
- published_at: string | null;
76
- release_id?: number | null;
77
- scheduled_date?: string | null;
78
- slug: string;
79
- sort_by_date: string | null;
80
- tag_list: string[];
81
- translated_slugs?: {
82
- path: string;
83
- name: string | null;
84
- lang: ISbStoryData['lang'];
85
- published: boolean;
86
- }[] | null;
87
- unpublished_changes?: boolean;
88
- updated_at?: string;
89
- uuid: string;
90
- }
91
- interface ISbMultipleStoriesData {
92
- by_ids?: string;
93
- by_uuids?: string;
94
- contain_component?: string;
95
- excluding_ids?: string;
96
- filter_query?: any;
97
- folder_only?: boolean;
98
- full_slug?: string;
99
- in_release?: string;
100
- in_trash?: boolean;
101
- is_published?: boolean;
102
- in_workflow_stages?: string;
103
- page?: number;
104
- pinned?: '1' | boolean;
105
- search?: string;
106
- sort_by?: string;
107
- starts_with?: string;
108
- story_only?: boolean;
109
- text_search?: string;
110
- with_parent?: number;
111
- with_slug?: string;
112
- with_tag?: string;
113
- }
114
- interface ISbAlternateObject {
115
- id: number;
116
- name: string;
117
- slug: string;
118
- published: boolean;
119
- full_slug: string;
120
- is_folder: boolean;
121
- parent_id: number;
122
- }
123
- interface ISbLinkURLObject {
124
- id: number;
125
- name: string;
126
- slug: string;
127
- full_slug: string;
128
- url: string;
129
- uuid: string;
130
- }
131
- //#endregion
132
1210
  //#region src/onStoryblokEditorEvent.d.ts
1211
+ /**
1212
+ * The story payload delivered by the Visual Editor `input` event.
1213
+ *
1214
+ * The Preview Bridge streams a story whose full runtime shape is not
1215
+ * guaranteed to match the CDN API. Only `id`, `uuid`, and `content` are
1216
+ * relied upon here — their types are sourced from the supplied {@link Story}
1217
+ * generic — while every other field is left as `unknown` rather than
1218
+ * over-promising a fully typed CDN story.
1219
+ *
1220
+ * @typeParam TStory - The schema-aware {@link Story} to source field types from.
1221
+ */
1222
+ type LivePreviewStory<TStory extends Story = Story> = Prettify<Pick<TStory, 'id'> & Partial<Pick<TStory, 'uuid' | 'content'>> & {
1223
+ [key: string]: unknown;
1224
+ }>;
133
1225
  /**
134
1226
  * Registers a callback for Storyblok Visual Editor live preview updates.
135
1227
  *
@@ -144,7 +1236,7 @@ interface ISbLinkURLObject {
144
1236
  * Multiple listeners can be registered simultaneously. Each call returns
145
1237
  * a cleanup function that removes the registered listener.
146
1238
  *
147
- * @typeParam T - The Storyblok component schema type.
1239
+ * @typeParam TStory - The schema-aware {@link Story} type to type the payload against.
148
1240
  *
149
1241
  * @param callback
150
1242
  * Callback executed when the Visual Editor sends an `input` event.
@@ -166,7 +1258,7 @@ interface ISbLinkURLObject {
166
1258
  * cleanup()
167
1259
  * ```
168
1260
  */
169
- declare function onStoryblokEditorEvent<T extends ISbComponentType<string> = ISbComponentType<string>>(callback: (story: ISbStoryData<T>) => void, bridgeOptions?: BridgeParams$1): Promise<() => void>;
1261
+ declare function onStoryblokEditorEvent<TStory extends Story = Story>(callback: (story: LivePreviewStory<TStory>) => void, bridgeOptions?: BridgeParams$1): Promise<() => void>;
170
1262
  //#endregion
171
1263
  //#region src/utils/isInEditor.d.ts
172
1264
  /**
@@ -210,5 +1302,5 @@ interface StoryblokValidationOptions {
210
1302
  */
211
1303
  declare function isInEditor(url: URL, options?: StoryblokValidationOptions): boolean;
212
1304
  //#endregion
213
- export { type BridgeParams, type ISbComponentType, type ISbStoryData, isInEditor, loadStoryblokBridge, onStoryblokEditorEvent, storyblokEditable };
1305
+ export { type Block, type BlockContent, type BridgeParams, type LivePreviewStory, type Story, isInEditor, loadStoryblokBridge, onStoryblokEditorEvent, storyblokEditable };
214
1306
  //# sourceMappingURL=index.d.cts.map