@webstudio-is/react-sdk 0.185.0 → 0.191.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/lib/index.js +212 -121
- package/lib/runtime.js +8 -12
- package/lib/types/components/component-meta.d.ts +1112 -449
- package/lib/types/components/components-utils.d.ts +2 -1
- package/lib/types/core-components.d.ts +298 -1
- package/lib/types/embed-template.d.ts +724 -215
- package/lib/types/hook.d.ts +9 -23
- package/lib/types/index.d.ts +0 -1
- package/package.json +10 -12
- package/lib/types/tree/create-elements-tree.d.ts +0 -26
- package/lib/types/tree/index.d.ts +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { componentAttribute, idAttribute } from "../props";
|
|
1
|
+
import { componentAttribute, idAttribute, selectorIdAttribute } from "../props";
|
|
2
2
|
export type AnyComponent = React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & WebstudioComponentSystemProps & React.RefAttributes<HTMLElement>>;
|
|
3
3
|
export type Components = Map<string, AnyComponent>;
|
|
4
4
|
export type WebstudioComponentSystemProps = {
|
|
5
5
|
[componentAttribute]: string;
|
|
6
6
|
[idAttribute]: string;
|
|
7
|
+
[selectorIdAttribute]: string;
|
|
7
8
|
};
|
|
@@ -3,10 +3,15 @@ export declare const rootComponent = "ws:root";
|
|
|
3
3
|
export declare const portalComponent = "Slot";
|
|
4
4
|
export declare const collectionComponent = "ws:collection";
|
|
5
5
|
export declare const descendantComponent = "ws:descendant";
|
|
6
|
+
export declare const blockTemplateComponent = "ws:block-template";
|
|
7
|
+
export declare const blockTemplateMeta: WsComponentMeta;
|
|
8
|
+
export declare const blockComponent = "ws:block";
|
|
6
9
|
export declare const coreMetas: {
|
|
7
10
|
"ws:root": WsComponentMeta;
|
|
8
11
|
"ws:collection": WsComponentMeta;
|
|
9
12
|
"ws:descendant": WsComponentMeta;
|
|
13
|
+
"ws:block": WsComponentMeta;
|
|
14
|
+
"ws:block-template": WsComponentMeta;
|
|
10
15
|
};
|
|
11
16
|
export declare const corePropsMetas: {
|
|
12
17
|
"ws:root": {
|
|
@@ -447,5 +452,297 @@ export declare const corePropsMetas: {
|
|
|
447
452
|
}>;
|
|
448
453
|
initialProps?: string[] | undefined;
|
|
449
454
|
};
|
|
455
|
+
"ws:block": {
|
|
456
|
+
props: Record<string, {
|
|
457
|
+
type: "number";
|
|
458
|
+
required: boolean;
|
|
459
|
+
control: "number";
|
|
460
|
+
defaultValue?: number | undefined;
|
|
461
|
+
label?: string | undefined;
|
|
462
|
+
description?: string | undefined;
|
|
463
|
+
} | {
|
|
464
|
+
type: "number";
|
|
465
|
+
required: boolean;
|
|
466
|
+
control: "range";
|
|
467
|
+
defaultValue?: number | undefined;
|
|
468
|
+
label?: string | undefined;
|
|
469
|
+
description?: string | undefined;
|
|
470
|
+
} | {
|
|
471
|
+
type: "string";
|
|
472
|
+
required: boolean;
|
|
473
|
+
control: "text";
|
|
474
|
+
defaultValue?: string | undefined;
|
|
475
|
+
rows?: number | undefined;
|
|
476
|
+
label?: string | undefined;
|
|
477
|
+
description?: string | undefined;
|
|
478
|
+
} | {
|
|
479
|
+
type: "string";
|
|
480
|
+
required: boolean;
|
|
481
|
+
language: "html" | "markdown";
|
|
482
|
+
control: "code";
|
|
483
|
+
defaultValue?: string | undefined;
|
|
484
|
+
label?: string | undefined;
|
|
485
|
+
description?: string | undefined;
|
|
486
|
+
} | {
|
|
487
|
+
type: "string";
|
|
488
|
+
required: boolean;
|
|
489
|
+
control: "codetext";
|
|
490
|
+
defaultValue?: string | undefined;
|
|
491
|
+
label?: string | undefined;
|
|
492
|
+
description?: string | undefined;
|
|
493
|
+
} | {
|
|
494
|
+
type: "string";
|
|
495
|
+
required: boolean;
|
|
496
|
+
control: "color";
|
|
497
|
+
defaultValue?: string | undefined;
|
|
498
|
+
label?: string | undefined;
|
|
499
|
+
description?: string | undefined;
|
|
500
|
+
} | {
|
|
501
|
+
type: "boolean";
|
|
502
|
+
required: boolean;
|
|
503
|
+
control: "boolean";
|
|
504
|
+
defaultValue?: boolean | undefined;
|
|
505
|
+
label?: string | undefined;
|
|
506
|
+
description?: string | undefined;
|
|
507
|
+
} | {
|
|
508
|
+
options: string[];
|
|
509
|
+
type: "string";
|
|
510
|
+
required: boolean;
|
|
511
|
+
control: "radio";
|
|
512
|
+
defaultValue?: string | undefined;
|
|
513
|
+
label?: string | undefined;
|
|
514
|
+
description?: string | undefined;
|
|
515
|
+
} | {
|
|
516
|
+
options: string[];
|
|
517
|
+
type: "string";
|
|
518
|
+
required: boolean;
|
|
519
|
+
control: "inline-radio";
|
|
520
|
+
defaultValue?: string | undefined;
|
|
521
|
+
label?: string | undefined;
|
|
522
|
+
description?: string | undefined;
|
|
523
|
+
} | {
|
|
524
|
+
options: string[];
|
|
525
|
+
type: "string";
|
|
526
|
+
required: boolean;
|
|
527
|
+
control: "select";
|
|
528
|
+
defaultValue?: string | undefined;
|
|
529
|
+
label?: string | undefined;
|
|
530
|
+
description?: string | undefined;
|
|
531
|
+
} | {
|
|
532
|
+
options: string[];
|
|
533
|
+
type: "string[]";
|
|
534
|
+
required: boolean;
|
|
535
|
+
control: "check";
|
|
536
|
+
defaultValue?: string[] | undefined;
|
|
537
|
+
label?: string | undefined;
|
|
538
|
+
description?: string | undefined;
|
|
539
|
+
} | {
|
|
540
|
+
options: string[];
|
|
541
|
+
type: "string[]";
|
|
542
|
+
required: boolean;
|
|
543
|
+
control: "inline-check";
|
|
544
|
+
defaultValue?: string[] | undefined;
|
|
545
|
+
label?: string | undefined;
|
|
546
|
+
description?: string | undefined;
|
|
547
|
+
} | {
|
|
548
|
+
options: string[];
|
|
549
|
+
type: "string[]";
|
|
550
|
+
required: boolean;
|
|
551
|
+
control: "multi-select";
|
|
552
|
+
defaultValue?: string[] | undefined;
|
|
553
|
+
label?: string | undefined;
|
|
554
|
+
description?: string | undefined;
|
|
555
|
+
} | {
|
|
556
|
+
type: "string";
|
|
557
|
+
required: boolean;
|
|
558
|
+
control: "file";
|
|
559
|
+
defaultValue?: string | undefined;
|
|
560
|
+
accept?: string | undefined;
|
|
561
|
+
label?: string | undefined;
|
|
562
|
+
description?: string | undefined;
|
|
563
|
+
} | {
|
|
564
|
+
type: "string";
|
|
565
|
+
required: boolean;
|
|
566
|
+
control: "url";
|
|
567
|
+
defaultValue?: string | undefined;
|
|
568
|
+
label?: string | undefined;
|
|
569
|
+
description?: string | undefined;
|
|
570
|
+
} | {
|
|
571
|
+
type: "json";
|
|
572
|
+
required: boolean;
|
|
573
|
+
control: "json";
|
|
574
|
+
defaultValue?: unknown;
|
|
575
|
+
label?: string | undefined;
|
|
576
|
+
description?: string | undefined;
|
|
577
|
+
} | {
|
|
578
|
+
type: "string";
|
|
579
|
+
required: boolean;
|
|
580
|
+
control: "date";
|
|
581
|
+
defaultValue?: string | undefined;
|
|
582
|
+
label?: string | undefined;
|
|
583
|
+
description?: string | undefined;
|
|
584
|
+
} | {
|
|
585
|
+
type: "action";
|
|
586
|
+
required: boolean;
|
|
587
|
+
control: "action";
|
|
588
|
+
defaultValue?: undefined;
|
|
589
|
+
label?: string | undefined;
|
|
590
|
+
description?: string | undefined;
|
|
591
|
+
} | {
|
|
592
|
+
type: "string";
|
|
593
|
+
required: boolean;
|
|
594
|
+
control: "textContent";
|
|
595
|
+
defaultValue?: string | undefined;
|
|
596
|
+
label?: string | undefined;
|
|
597
|
+
description?: string | undefined;
|
|
598
|
+
}>;
|
|
599
|
+
initialProps?: string[] | undefined;
|
|
600
|
+
};
|
|
601
|
+
"ws:block-template": {
|
|
602
|
+
props: Record<string, {
|
|
603
|
+
type: "number";
|
|
604
|
+
required: boolean;
|
|
605
|
+
control: "number";
|
|
606
|
+
defaultValue?: number | undefined;
|
|
607
|
+
label?: string | undefined;
|
|
608
|
+
description?: string | undefined;
|
|
609
|
+
} | {
|
|
610
|
+
type: "number";
|
|
611
|
+
required: boolean;
|
|
612
|
+
control: "range";
|
|
613
|
+
defaultValue?: number | undefined;
|
|
614
|
+
label?: string | undefined;
|
|
615
|
+
description?: string | undefined;
|
|
616
|
+
} | {
|
|
617
|
+
type: "string";
|
|
618
|
+
required: boolean;
|
|
619
|
+
control: "text";
|
|
620
|
+
defaultValue?: string | undefined;
|
|
621
|
+
rows?: number | undefined;
|
|
622
|
+
label?: string | undefined;
|
|
623
|
+
description?: string | undefined;
|
|
624
|
+
} | {
|
|
625
|
+
type: "string";
|
|
626
|
+
required: boolean;
|
|
627
|
+
language: "html" | "markdown";
|
|
628
|
+
control: "code";
|
|
629
|
+
defaultValue?: string | undefined;
|
|
630
|
+
label?: string | undefined;
|
|
631
|
+
description?: string | undefined;
|
|
632
|
+
} | {
|
|
633
|
+
type: "string";
|
|
634
|
+
required: boolean;
|
|
635
|
+
control: "codetext";
|
|
636
|
+
defaultValue?: string | undefined;
|
|
637
|
+
label?: string | undefined;
|
|
638
|
+
description?: string | undefined;
|
|
639
|
+
} | {
|
|
640
|
+
type: "string";
|
|
641
|
+
required: boolean;
|
|
642
|
+
control: "color";
|
|
643
|
+
defaultValue?: string | undefined;
|
|
644
|
+
label?: string | undefined;
|
|
645
|
+
description?: string | undefined;
|
|
646
|
+
} | {
|
|
647
|
+
type: "boolean";
|
|
648
|
+
required: boolean;
|
|
649
|
+
control: "boolean";
|
|
650
|
+
defaultValue?: boolean | undefined;
|
|
651
|
+
label?: string | undefined;
|
|
652
|
+
description?: string | undefined;
|
|
653
|
+
} | {
|
|
654
|
+
options: string[];
|
|
655
|
+
type: "string";
|
|
656
|
+
required: boolean;
|
|
657
|
+
control: "radio";
|
|
658
|
+
defaultValue?: string | undefined;
|
|
659
|
+
label?: string | undefined;
|
|
660
|
+
description?: string | undefined;
|
|
661
|
+
} | {
|
|
662
|
+
options: string[];
|
|
663
|
+
type: "string";
|
|
664
|
+
required: boolean;
|
|
665
|
+
control: "inline-radio";
|
|
666
|
+
defaultValue?: string | undefined;
|
|
667
|
+
label?: string | undefined;
|
|
668
|
+
description?: string | undefined;
|
|
669
|
+
} | {
|
|
670
|
+
options: string[];
|
|
671
|
+
type: "string";
|
|
672
|
+
required: boolean;
|
|
673
|
+
control: "select";
|
|
674
|
+
defaultValue?: string | undefined;
|
|
675
|
+
label?: string | undefined;
|
|
676
|
+
description?: string | undefined;
|
|
677
|
+
} | {
|
|
678
|
+
options: string[];
|
|
679
|
+
type: "string[]";
|
|
680
|
+
required: boolean;
|
|
681
|
+
control: "check";
|
|
682
|
+
defaultValue?: string[] | undefined;
|
|
683
|
+
label?: string | undefined;
|
|
684
|
+
description?: string | undefined;
|
|
685
|
+
} | {
|
|
686
|
+
options: string[];
|
|
687
|
+
type: "string[]";
|
|
688
|
+
required: boolean;
|
|
689
|
+
control: "inline-check";
|
|
690
|
+
defaultValue?: string[] | undefined;
|
|
691
|
+
label?: string | undefined;
|
|
692
|
+
description?: string | undefined;
|
|
693
|
+
} | {
|
|
694
|
+
options: string[];
|
|
695
|
+
type: "string[]";
|
|
696
|
+
required: boolean;
|
|
697
|
+
control: "multi-select";
|
|
698
|
+
defaultValue?: string[] | undefined;
|
|
699
|
+
label?: string | undefined;
|
|
700
|
+
description?: string | undefined;
|
|
701
|
+
} | {
|
|
702
|
+
type: "string";
|
|
703
|
+
required: boolean;
|
|
704
|
+
control: "file";
|
|
705
|
+
defaultValue?: string | undefined;
|
|
706
|
+
accept?: string | undefined;
|
|
707
|
+
label?: string | undefined;
|
|
708
|
+
description?: string | undefined;
|
|
709
|
+
} | {
|
|
710
|
+
type: "string";
|
|
711
|
+
required: boolean;
|
|
712
|
+
control: "url";
|
|
713
|
+
defaultValue?: string | undefined;
|
|
714
|
+
label?: string | undefined;
|
|
715
|
+
description?: string | undefined;
|
|
716
|
+
} | {
|
|
717
|
+
type: "json";
|
|
718
|
+
required: boolean;
|
|
719
|
+
control: "json";
|
|
720
|
+
defaultValue?: unknown;
|
|
721
|
+
label?: string | undefined;
|
|
722
|
+
description?: string | undefined;
|
|
723
|
+
} | {
|
|
724
|
+
type: "string";
|
|
725
|
+
required: boolean;
|
|
726
|
+
control: "date";
|
|
727
|
+
defaultValue?: string | undefined;
|
|
728
|
+
label?: string | undefined;
|
|
729
|
+
description?: string | undefined;
|
|
730
|
+
} | {
|
|
731
|
+
type: "action";
|
|
732
|
+
required: boolean;
|
|
733
|
+
control: "action";
|
|
734
|
+
defaultValue?: undefined;
|
|
735
|
+
label?: string | undefined;
|
|
736
|
+
description?: string | undefined;
|
|
737
|
+
} | {
|
|
738
|
+
type: "string";
|
|
739
|
+
required: boolean;
|
|
740
|
+
control: "textContent";
|
|
741
|
+
defaultValue?: string | undefined;
|
|
742
|
+
label?: string | undefined;
|
|
743
|
+
description?: string | undefined;
|
|
744
|
+
}>;
|
|
745
|
+
initialProps?: string[] | undefined;
|
|
746
|
+
};
|
|
450
747
|
};
|
|
451
|
-
export declare const isCoreComponent: (component: string) => component is "ws:root" | "ws:collection" | "ws:descendant";
|
|
748
|
+
export declare const isCoreComponent: (component: string) => component is "ws:root" | "ws:collection" | "ws:descendant" | "ws:block-template" | "ws:block";
|