@webstudio-is/react-sdk 0.57.0 → 0.58.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.
Files changed (141) hide show
  1. package/lib/app/custom-components/shared/remix-link.js +5 -1
  2. package/lib/cjs/app/custom-components/shared/remix-link.js +5 -1
  3. package/lib/cjs/components/link.js +4 -1
  4. package/lib/cjs/props.js +19 -5
  5. package/lib/components/link.js +4 -1
  6. package/lib/props.js +19 -5
  7. package/lib/types/app/custom-components/image.d.ts +6 -0
  8. package/lib/types/app/custom-components/index.d.ts +26 -0
  9. package/lib/types/app/custom-components/link-block.d.ts +6 -0
  10. package/lib/types/app/custom-components/link.d.ts +6 -0
  11. package/lib/types/app/custom-components/rich-text-link.d.ts +6 -0
  12. package/lib/types/app/custom-components/shared/remix-link.d.ts +10 -0
  13. package/lib/types/app/handle-request.server.d.ts +2 -0
  14. package/lib/types/app/index.d.ts +3 -0
  15. package/lib/types/app/params.d.ts +6 -0
  16. package/lib/types/app/root.d.ts +8 -0
  17. package/lib/types/components/__generated__/blockquote.props.d.ts +2 -0
  18. package/lib/types/components/__generated__/body.props.d.ts +2 -0
  19. package/lib/types/components/__generated__/bold.props.d.ts +2 -0
  20. package/lib/types/components/__generated__/box.props.d.ts +2 -0
  21. package/lib/types/components/__generated__/button.props.d.ts +2 -0
  22. package/lib/types/components/__generated__/code.props.d.ts +2 -0
  23. package/lib/types/components/__generated__/form.props.d.ts +2 -0
  24. package/lib/types/components/__generated__/fragment.props.d.ts +2 -0
  25. package/lib/types/components/__generated__/heading.props.d.ts +2 -0
  26. package/lib/types/components/__generated__/image.props.d.ts +2 -0
  27. package/lib/types/components/__generated__/input.props.d.ts +2 -0
  28. package/lib/types/components/__generated__/italic.props.d.ts +2 -0
  29. package/lib/types/components/__generated__/link-block.props.d.ts +2 -0
  30. package/lib/types/components/__generated__/link.props.d.ts +2 -0
  31. package/lib/types/components/__generated__/list-item.props.d.ts +2 -0
  32. package/lib/types/components/__generated__/list.props.d.ts +2 -0
  33. package/lib/types/components/__generated__/paragraph.props.d.ts +2 -0
  34. package/lib/types/components/__generated__/rich-text-link.props.d.ts +2 -0
  35. package/lib/types/components/__generated__/separator.props.d.ts +2 -0
  36. package/lib/types/components/__generated__/slot.props.d.ts +2 -0
  37. package/lib/types/components/__generated__/span.props.d.ts +2 -0
  38. package/lib/types/components/__generated__/subscript.props.d.ts +2 -0
  39. package/lib/types/components/__generated__/superscript.props.d.ts +2 -0
  40. package/lib/types/components/__generated__/text-block.props.d.ts +2 -0
  41. package/lib/types/components/blockquote.d.ts +3 -0
  42. package/lib/types/components/blockquote.stories.d.ts +5 -0
  43. package/lib/types/components/blockquote.ws.d.ts +3 -0
  44. package/lib/types/components/body.d.ts +3 -0
  45. package/lib/types/components/body.stories.d.ts +6 -0
  46. package/lib/types/components/body.ws.d.ts +3 -0
  47. package/lib/types/components/bold.d.ts +3 -0
  48. package/lib/types/components/bold.stories.d.ts +5 -0
  49. package/lib/types/components/bold.ws.d.ts +3 -0
  50. package/lib/types/components/box.d.ts +7 -0
  51. package/lib/types/components/box.stories.d.ts +9 -0
  52. package/lib/types/components/box.ws.d.ts +3 -0
  53. package/lib/types/components/button.d.ts +7 -0
  54. package/lib/types/components/button.stories.d.ts +9 -0
  55. package/lib/types/components/button.ws.d.ts +3 -0
  56. package/lib/types/components/code.d.ts +9 -0
  57. package/lib/types/components/code.stories.d.ts +11 -0
  58. package/lib/types/components/code.ws.d.ts +3 -0
  59. package/lib/types/components/component-meta.d.ts +610 -0
  60. package/lib/types/components/components-utils.d.ts +34 -0
  61. package/lib/types/components/components.d.ts +31 -0
  62. package/lib/types/components/form.d.ts +3 -0
  63. package/lib/types/components/form.stories.d.ts +5 -0
  64. package/lib/types/components/form.ws.d.ts +3 -0
  65. package/lib/types/components/fragment.d.ts +6 -0
  66. package/lib/types/components/fragment.ws.d.ts +3 -0
  67. package/lib/types/components/heading.d.ts +7 -0
  68. package/lib/types/components/heading.stories.d.ts +9 -0
  69. package/lib/types/components/heading.ws.d.ts +3 -0
  70. package/lib/types/components/image.d.ts +3 -0
  71. package/lib/types/components/image.stories.d.ts +5 -0
  72. package/lib/types/components/image.ws.d.ts +3 -0
  73. package/lib/types/components/index.d.ts +17 -0
  74. package/lib/types/components/input.d.ts +3 -0
  75. package/lib/types/components/input.stories.d.ts +5 -0
  76. package/lib/types/components/input.ws.d.ts +3 -0
  77. package/lib/types/components/italic.d.ts +3 -0
  78. package/lib/types/components/italic.stories.d.ts +5 -0
  79. package/lib/types/components/italic.ws.d.ts +3 -0
  80. package/lib/types/components/link-block.d.ts +3 -0
  81. package/lib/types/components/link-block.stories.d.ts +13 -0
  82. package/lib/types/components/link-block.ws.d.ts +3 -0
  83. package/lib/types/components/link.d.ts +9 -0
  84. package/lib/types/components/link.stories.d.ts +13 -0
  85. package/lib/types/components/link.ws.d.ts +3 -0
  86. package/lib/types/components/list-item.d.ts +3 -0
  87. package/lib/types/components/list-item.stories.d.ts +5 -0
  88. package/lib/types/components/list-item.ws.d.ts +3 -0
  89. package/lib/types/components/list.d.ts +9 -0
  90. package/lib/types/components/list.stories.d.ts +9 -0
  91. package/lib/types/components/list.ws.d.ts +3 -0
  92. package/lib/types/components/paragraph.d.ts +3 -0
  93. package/lib/types/components/paragraph.stories.d.ts +5 -0
  94. package/lib/types/components/paragraph.ws.d.ts +3 -0
  95. package/lib/types/components/rich-text-link.d.ts +2 -0
  96. package/lib/types/components/rich-text-link.stories.d.ts +13 -0
  97. package/lib/types/components/rich-text-link.ws.d.ts +3 -0
  98. package/lib/types/components/separator.d.ts +3 -0
  99. package/lib/types/components/separator.stories.d.ts +5 -0
  100. package/lib/types/components/separator.ws.d.ts +3 -0
  101. package/lib/types/components/slot.d.ts +6 -0
  102. package/lib/types/components/slot.stories.d.ts +9 -0
  103. package/lib/types/components/slot.ws.d.ts +3 -0
  104. package/lib/types/components/span.d.ts +3 -0
  105. package/lib/types/components/span.stories.d.ts +5 -0
  106. package/lib/types/components/span.ws.d.ts +3 -0
  107. package/lib/types/components/subscript.d.ts +3 -0
  108. package/lib/types/components/subscript.stories.d.ts +5 -0
  109. package/lib/types/components/subscript.ws.d.ts +3 -0
  110. package/lib/types/components/superscript.d.ts +3 -0
  111. package/lib/types/components/superscript.stories.d.ts +5 -0
  112. package/lib/types/components/superscript.ws.d.ts +3 -0
  113. package/lib/types/components/text-block.d.ts +3 -0
  114. package/lib/types/components/text-block.stories.d.ts +5 -0
  115. package/lib/types/components/text-block.ws.d.ts +3 -0
  116. package/lib/types/context.d.ts +9 -0
  117. package/lib/types/css/css.d.ts +52 -0
  118. package/lib/types/css/get-browser-style.d.ts +2 -0
  119. package/lib/types/css/global-rules.d.ts +43 -0
  120. package/lib/types/css/index.d.ts +4 -0
  121. package/lib/types/css/normalize-type-check.d.ts +1 -0
  122. package/lib/types/css/normalize.d.ts +2429 -0
  123. package/lib/types/css/presets.d.ts +38 -0
  124. package/lib/types/css/style-rules.d.ts +202 -0
  125. package/lib/types/css/style-rules.test.d.ts +1 -0
  126. package/lib/types/index.d.ts +9 -0
  127. package/lib/types/props.d.ts +158 -0
  128. package/lib/types/props.test.d.ts +1 -0
  129. package/lib/types/pubsub/create.d.ts +28 -0
  130. package/lib/types/pubsub/index.d.ts +1 -0
  131. package/lib/types/pubsub/raf-queue.d.ts +1 -0
  132. package/lib/types/tree/create-elements-tree.d.ts +29 -0
  133. package/lib/types/tree/index.d.ts +3 -0
  134. package/lib/types/tree/root.d.ts +25 -0
  135. package/lib/types/tree/session-storage-polyfill.d.ts +2 -0
  136. package/lib/types/tree/webstudio-component.d.ts +15 -0
  137. package/package.json +14 -14
  138. package/src/app/custom-components/shared/remix-link.tsx +5 -1
  139. package/src/components/link.tsx +5 -1
  140. package/src/props.test.ts +36 -1
  141. package/src/props.ts +33 -6
@@ -0,0 +1,38 @@
1
+ export declare const borders: {
2
+ readonly borderTopColor: {
3
+ readonly type: "keyword";
4
+ readonly value: "currentColor";
5
+ };
6
+ readonly borderRightColor: {
7
+ readonly type: "keyword";
8
+ readonly value: "currentColor";
9
+ };
10
+ readonly borderBottomColor: {
11
+ readonly type: "keyword";
12
+ readonly value: "currentColor";
13
+ };
14
+ readonly borderLeftColor: {
15
+ readonly type: "keyword";
16
+ readonly value: "currentColor";
17
+ };
18
+ readonly borderTopWidth: {
19
+ readonly type: "unit";
20
+ readonly value: 1;
21
+ readonly unit: "px";
22
+ };
23
+ readonly borderRightWidth: {
24
+ readonly type: "unit";
25
+ readonly value: 1;
26
+ readonly unit: "px";
27
+ };
28
+ readonly borderBottomWidth: {
29
+ readonly type: "unit";
30
+ readonly value: 1;
31
+ readonly unit: "px";
32
+ };
33
+ readonly borderLeftWidth: {
34
+ readonly type: "unit";
35
+ readonly value: 1;
36
+ readonly unit: "px";
37
+ };
38
+ };
@@ -0,0 +1,202 @@
1
+ import type { Style } from "@webstudio-is/css-data";
2
+ type StyleRule = {
3
+ instanceId: string;
4
+ breakpointId: string;
5
+ state: undefined | string;
6
+ style: Style;
7
+ };
8
+ /**
9
+ * Merge styles from different style sources
10
+ * and group by instance and breakpoint
11
+ */
12
+ export declare const getStyleRules: (styles: Map<string, {
13
+ state?: string | undefined;
14
+ value: {
15
+ type: "unit";
16
+ value: number;
17
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
18
+ } | {
19
+ type: "keyword";
20
+ value: string;
21
+ } | {
22
+ hidden?: boolean | undefined;
23
+ type: "unparsed";
24
+ value: string;
25
+ } | {
26
+ type: "fontFamily";
27
+ value: string[];
28
+ } | {
29
+ type: "rgb";
30
+ alpha: number;
31
+ r: number;
32
+ g: number;
33
+ b: number;
34
+ } | {
35
+ hidden?: boolean | undefined;
36
+ type: "image";
37
+ value: {
38
+ type: "asset";
39
+ value: string;
40
+ } | {
41
+ type: "url";
42
+ url: string;
43
+ };
44
+ } | {
45
+ type: "invalid";
46
+ value: string;
47
+ } | {
48
+ type: "unset";
49
+ value: "";
50
+ } | {
51
+ type: "tuple";
52
+ value: ({
53
+ type: "unit";
54
+ value: number;
55
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
56
+ } | {
57
+ type: "keyword";
58
+ value: string;
59
+ } | {
60
+ hidden?: boolean | undefined;
61
+ type: "unparsed";
62
+ value: string;
63
+ })[];
64
+ } | {
65
+ type: "layers";
66
+ value: ({
67
+ type: "unit";
68
+ value: number;
69
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
70
+ } | {
71
+ type: "keyword";
72
+ value: string;
73
+ } | {
74
+ hidden?: boolean | undefined;
75
+ type: "unparsed";
76
+ value: string;
77
+ } | {
78
+ hidden?: boolean | undefined;
79
+ type: "image";
80
+ value: {
81
+ type: "asset";
82
+ value: string;
83
+ } | {
84
+ type: "url";
85
+ url: string;
86
+ };
87
+ } | {
88
+ type: "invalid";
89
+ value: string;
90
+ } | {
91
+ type: "tuple";
92
+ value: ({
93
+ type: "unit";
94
+ value: number;
95
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
96
+ } | {
97
+ type: "keyword";
98
+ value: string;
99
+ } | {
100
+ hidden?: boolean | undefined;
101
+ type: "unparsed";
102
+ value: string;
103
+ })[];
104
+ })[];
105
+ } | {
106
+ type: "var";
107
+ value: string;
108
+ fallbacks: ({
109
+ type: "unit";
110
+ value: number;
111
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
112
+ } | {
113
+ type: "keyword";
114
+ value: string;
115
+ } | {
116
+ hidden?: boolean | undefined;
117
+ type: "unparsed";
118
+ value: string;
119
+ } | {
120
+ type: "fontFamily";
121
+ value: string[];
122
+ } | {
123
+ type: "rgb";
124
+ alpha: number;
125
+ r: number;
126
+ g: number;
127
+ b: number;
128
+ } | {
129
+ hidden?: boolean | undefined;
130
+ type: "image";
131
+ value: {
132
+ type: "asset";
133
+ value: string;
134
+ } | {
135
+ type: "url";
136
+ url: string;
137
+ };
138
+ } | {
139
+ type: "tuple";
140
+ value: ({
141
+ type: "unit";
142
+ value: number;
143
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
144
+ } | {
145
+ type: "keyword";
146
+ value: string;
147
+ } | {
148
+ hidden?: boolean | undefined;
149
+ type: "unparsed";
150
+ value: string;
151
+ })[];
152
+ } | {
153
+ type: "layers";
154
+ value: ({
155
+ type: "unit";
156
+ value: number;
157
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
158
+ } | {
159
+ type: "keyword";
160
+ value: string;
161
+ } | {
162
+ hidden?: boolean | undefined;
163
+ type: "unparsed";
164
+ value: string;
165
+ } | {
166
+ hidden?: boolean | undefined;
167
+ type: "image";
168
+ value: {
169
+ type: "asset";
170
+ value: string;
171
+ } | {
172
+ type: "url";
173
+ url: string;
174
+ };
175
+ } | {
176
+ type: "invalid";
177
+ value: string;
178
+ } | {
179
+ type: "tuple";
180
+ value: ({
181
+ type: "unit";
182
+ value: number;
183
+ unit: "number" | "x" | "s" | "%" | "px" | "dppx" | "deg" | "grad" | "rad" | "turn" | "db" | "fr" | "hz" | "khz" | "cm" | "mm" | "q" | "in" | "pt" | "pc" | "em" | "rem" | "ex" | "rex" | "cap" | "rcap" | "ch" | "rch" | "ic" | "ric" | "lh" | "rlh" | "vw" | "svw" | "lvw" | "dvw" | "vh" | "svh" | "lvh" | "dvh" | "vi" | "svi" | "lvi" | "dvi" | "vb" | "svb" | "lvb" | "dvb" | "vmin" | "svmin" | "lvmin" | "dvmin" | "vmax" | "svmax" | "lvmax" | "dvmax" | "cqw" | "cqh" | "cqi" | "cqb" | "cqmin" | "cqmax" | "dpi" | "dpcm" | "st" | "ms";
184
+ } | {
185
+ type: "keyword";
186
+ value: string;
187
+ } | {
188
+ hidden?: boolean | undefined;
189
+ type: "unparsed";
190
+ value: string;
191
+ })[];
192
+ })[];
193
+ })[];
194
+ };
195
+ styleSourceId: string;
196
+ breakpointId: string;
197
+ property: "filter" | "float" | "fontFamily" | "width" | "height" | "color" | "left" | "right" | "top" | "bottom" | "contain" | "clip" | "content" | `--${string}` | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "alignTracks" | "animationComposition" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "animationTimeline" | "appearance" | "aspectRatio" | "backdropFilter" | "backfaceVisibility" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockOverflow" | "blockSize" | "borderBlockColor" | "borderBlockStyle" | "borderBlockWidth" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInlineColor" | "borderInlineStyle" | "borderInlineWidth" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderSpacing" | "borderStartEndRadius" | "borderStartStartRadius" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "boxDecorationBreak" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "caretShape" | "clear" | "clipPath" | "printColorAdjust" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "containIntrinsicBlockSize" | "containIntrinsicHeight" | "containIntrinsicInlineSize" | "containIntrinsicWidth" | "contentVisibility" | "counterIncrement" | "counterReset" | "counterSet" | "cursor" | "direction" | "display" | "emptyCells" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFeatureSettings" | "fontKerning" | "fontLanguageOverride" | "fontOpticalSizing" | "fontVariationSettings" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontSynthesis" | "fontVariant" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontWeight" | "forcedColorAdjust" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumnEnd" | "gridColumnStart" | "gridRowEnd" | "gridRowStart" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "hangingPunctuation" | "hyphenateCharacter" | "hyphens" | "imageOrientation" | "imageRendering" | "imageResolution" | "initialLetter" | "initialLetterAlign" | "inlineSize" | "inputSecurity" | "insetBlockEnd" | "insetBlockStart" | "insetInlineEnd" | "insetInlineStart" | "isolation" | "justifyContent" | "justifyItems" | "justifySelf" | "justifyTracks" | "letterSpacing" | "lineBreak" | "lineClamp" | "lineHeight" | "lineHeightStep" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "marginTrim" | "maskBorderMode" | "maskBorderOutset" | "maskBorderRepeat" | "maskBorderSlice" | "maskBorderSource" | "maskBorderWidth" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "masonryAutoFlow" | "mathDepth" | "mathShift" | "mathStyle" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxLines" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetAnchor" | "offsetDistance" | "offsetPath" | "offsetPosition" | "offsetRotate" | "opacity" | "order" | "orphans" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflow" | "overflowAnchor" | "overflowBlock" | "overflowClipMargin" | "overflowInline" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "paintOrder" | "perspective" | "perspectiveOrigin" | "pointerEvents" | "position" | "quotes" | "resize" | "rotate" | "rowGap" | "rubyAlign" | "rubyMerge" | "rubyPosition" | "scale" | "scrollbarColor" | "scrollbarGutter" | "scrollbarWidth" | "scrollBehavior" | "scrollMarginBlockStart" | "scrollMarginBlockEnd" | "scrollMarginBottom" | "scrollMarginInlineStart" | "scrollMarginInlineEnd" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPaddingBlockStart" | "scrollPaddingBlockEnd" | "scrollPaddingBottom" | "scrollPaddingInlineStart" | "scrollPaddingInlineEnd" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollTimelineAxis" | "scrollTimelineName" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkip" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textJustify" | "textOrientation" | "textOverflow" | "textRendering" | "textShadow" | "textSizeAdjust" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transform" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "translate" | "unicodeBidi" | "userSelect" | "verticalAlign" | "visibility" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordSpacing" | "wordWrap" | "writingMode" | "zIndex";
198
+ }>, styleSourceSelections: Map<string, {
199
+ values: string[];
200
+ instanceId: string;
201
+ }>) => StyleRule[];
202
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export * from "./css";
2
+ export * from "./tree";
3
+ export * from "./components";
4
+ export * from "./pubsub";
5
+ export * from "./app";
6
+ export * from "./components/components";
7
+ export * from "./components/components-utils";
8
+ export { customComponents, customComponentMetas, customComponentPropsMetas, } from "./app/custom-components";
9
+ export { type WsComponentPropsMeta, type WsComponentMeta, componentCategories, } from "./components/component-meta";
@@ -0,0 +1,158 @@
1
+ import type { Instance, Page, Prop } from "@webstudio-is/project-build";
2
+ import type { Asset, Assets } from "@webstudio-is/asset-uploader";
3
+ export type PropsByInstanceId = Map<Instance["id"], Prop[]>;
4
+ export type Pages = Map<Page["id"], Page>;
5
+ export declare const getPropsByInstanceId: (props: Map<string, {
6
+ required?: boolean | undefined;
7
+ name: string;
8
+ type: "number";
9
+ value: number;
10
+ id: string;
11
+ instanceId: string;
12
+ } | {
13
+ required?: boolean | undefined;
14
+ name: string;
15
+ type: "string";
16
+ value: string;
17
+ id: string;
18
+ instanceId: string;
19
+ } | {
20
+ required?: boolean | undefined;
21
+ name: string;
22
+ type: "boolean";
23
+ value: boolean;
24
+ id: string;
25
+ instanceId: string;
26
+ } | {
27
+ required?: boolean | undefined;
28
+ name: string;
29
+ type: "asset";
30
+ value: string;
31
+ id: string;
32
+ instanceId: string;
33
+ } | {
34
+ required?: boolean | undefined;
35
+ name: string;
36
+ type: "page";
37
+ value: string | {
38
+ instanceId: string;
39
+ pageId: string;
40
+ };
41
+ id: string;
42
+ instanceId: string;
43
+ } | {
44
+ required?: boolean | undefined;
45
+ name: string;
46
+ type: "string[]";
47
+ value: string[];
48
+ id: string;
49
+ instanceId: string;
50
+ }>) => PropsByInstanceId;
51
+ export declare const useInstanceProps: (instanceId: Instance["id"]) => Record<string, string | number | boolean | string[] | {
52
+ instanceId: string;
53
+ pageId: string;
54
+ }>;
55
+ export declare const usePropAsset: (instanceId: Instance["id"], name: string) => {
56
+ name: string;
57
+ type: "font";
58
+ format: "ttf" | "woff" | "woff2" | "otf";
59
+ id: string;
60
+ projectId: string;
61
+ size: number;
62
+ description: string | null;
63
+ location: "FS" | "REMOTE";
64
+ createdAt: string;
65
+ meta: {
66
+ style: "normal" | "italic" | "oblique";
67
+ weight: number;
68
+ family: string;
69
+ } | {
70
+ variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
71
+ name: string;
72
+ min: number;
73
+ default: number;
74
+ max: number;
75
+ }>>;
76
+ family: string;
77
+ };
78
+ } | {
79
+ name: string;
80
+ type: "image";
81
+ format: string;
82
+ id: string;
83
+ projectId: string;
84
+ size: number;
85
+ description: string | null;
86
+ location: "FS" | "REMOTE";
87
+ createdAt: string;
88
+ meta: {
89
+ width: number;
90
+ height: number;
91
+ };
92
+ } | undefined;
93
+ export declare const resolveUrlProp: (instanceId: Instance["id"], name: string, { props, pages, assets, }: {
94
+ props: PropsByInstanceId;
95
+ pages: Pages;
96
+ assets: Map<string, {
97
+ name: string;
98
+ type: "font";
99
+ format: "ttf" | "woff" | "woff2" | "otf";
100
+ id: string;
101
+ projectId: string;
102
+ size: number;
103
+ description: string | null;
104
+ location: "FS" | "REMOTE";
105
+ createdAt: string;
106
+ meta: {
107
+ style: "normal" | "italic" | "oblique";
108
+ weight: number;
109
+ family: string;
110
+ } | {
111
+ variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
112
+ name: string;
113
+ min: number;
114
+ default: number;
115
+ max: number;
116
+ }>>;
117
+ family: string;
118
+ };
119
+ } | {
120
+ name: string;
121
+ type: "image";
122
+ format: string;
123
+ id: string;
124
+ projectId: string;
125
+ size: number;
126
+ description: string | null;
127
+ location: "FS" | "REMOTE";
128
+ createdAt: string;
129
+ meta: {
130
+ width: number;
131
+ height: number;
132
+ };
133
+ } | undefined>;
134
+ }) => {
135
+ type: "page";
136
+ page: Page;
137
+ instanceId?: string | undefined;
138
+ hash?: string | undefined;
139
+ } | {
140
+ type: "asset";
141
+ asset: Asset;
142
+ } | {
143
+ type: "string";
144
+ url: string;
145
+ } | undefined;
146
+ export declare const usePropUrl: (instanceId: Instance["id"], name: string) => {
147
+ type: "page";
148
+ page: Page;
149
+ instanceId?: string | undefined;
150
+ hash?: string | undefined;
151
+ } | {
152
+ type: "asset";
153
+ asset: Asset;
154
+ } | {
155
+ type: "string";
156
+ url: string;
157
+ } | undefined;
158
+ export declare const getInstanceIdFromComponentProps: (props: Record<string, unknown>) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ export declare const createPubsub: <PublishMap>() => {
3
+ /**
4
+ * To publish a postMessage event on the current window and parent window from the iframe.
5
+ */
6
+ publish<Type extends keyof PublishMap>(action: undefined extends PublishMap[Type] ? {
7
+ type: Type;
8
+ payload?: PublishMap[Type] | undefined;
9
+ } : {
10
+ type: Type;
11
+ payload: PublishMap[Type];
12
+ }): void;
13
+ /**
14
+ * To publish a postMessage event on the iframe and parent window from the parent window.
15
+ */
16
+ usePublish(): readonly [<Type_1 extends keyof PublishMap>(action: undefined extends PublishMap[Type_1] ? {
17
+ type: Type_1;
18
+ payload?: PublishMap[Type_1] | undefined;
19
+ } : {
20
+ type: Type_1;
21
+ payload: PublishMap[Type_1];
22
+ }) => void, import("react").MutableRefObject<HTMLIFrameElement | null>];
23
+ /**
24
+ * To subscribe a message event on the current window.
25
+ */
26
+ useSubscribe<Type_2 extends keyof PublishMap>(type: Type_2, onAction: (payload: PublishMap[Type_2]) => void): void;
27
+ subscribe<Type_3 extends keyof PublishMap>(type: Type_3, onAction: (payload: PublishMap[Type_3]) => void): import("nanoevents").Unsubscribe;
28
+ };
@@ -0,0 +1 @@
1
+ export * from "./create";
@@ -0,0 +1 @@
1
+ export declare const batchUpdate: (update: () => void) => void;
@@ -0,0 +1,29 @@
1
+ import { type ComponentProps } from "react";
2
+ import type { ReadableAtom } from "nanostores";
3
+ import type { Assets } from "@webstudio-is/asset-uploader";
4
+ import type { Instance, Instances } from "@webstudio-is/project-build";
5
+ import type { GetComponent } from "../components/components-utils";
6
+ import type { Pages, PropsByInstanceId } from "../props";
7
+ import type { WebstudioComponent } from "./webstudio-component";
8
+ export declare const createElementsTree: ({ instances, rootInstanceId, sandbox, propsByInstanceIdStore, assetsStore, pagesStore, Component, getComponent, }: {
9
+ instances: Map<string, {
10
+ label?: string | undefined;
11
+ type: "instance";
12
+ id: string;
13
+ component: string;
14
+ children: ({
15
+ type: "text";
16
+ value: string;
17
+ } | {
18
+ type: "id";
19
+ value: string;
20
+ })[];
21
+ }>;
22
+ rootInstanceId: Instance["id"];
23
+ sandbox?: boolean | undefined;
24
+ propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;
25
+ assetsStore: ReadableAtom<Assets>;
26
+ pagesStore: ReadableAtom<Pages>;
27
+ Component: (props: ComponentProps<typeof WebstudioComponent>) => JSX.Element;
28
+ getComponent: GetComponent;
29
+ }) => JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ export * from "./create-elements-tree";
2
+ export * from "./root";
3
+ export * from "./webstudio-component";
@@ -0,0 +1,25 @@
1
+ import type { ComponentProps } from "react";
2
+ import type { Build, Page } from "@webstudio-is/project-build";
3
+ import type { Asset } from "@webstudio-is/asset-uploader";
4
+ import { WebstudioComponent } from "./webstudio-component";
5
+ import { registerComponents } from "../components";
6
+ import { type Params } from "../app/params";
7
+ import type { GetComponent } from "../components/components-utils";
8
+ export type Data = {
9
+ page: Page;
10
+ pages: Array<Page>;
11
+ build: Build;
12
+ assets: Array<Asset>;
13
+ params?: Params;
14
+ };
15
+ export type RootPropsData = Omit<Data, "build"> & {
16
+ build: Pick<Data["build"], "instances" | "props">;
17
+ };
18
+ type RootProps = {
19
+ data: RootPropsData;
20
+ Component?: (props: ComponentProps<typeof WebstudioComponent>) => JSX.Element;
21
+ customComponents?: Parameters<typeof registerComponents>[0];
22
+ getComponent: GetComponent;
23
+ };
24
+ export declare const InstanceRoot: ({ data, Component, customComponents, getComponent, }: RootProps) => JSX.Element | null;
25
+ export {};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const SessionStoragePolyfill: () => JSX.Element;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import type { Instance } from "@webstudio-is/project-build";
3
+ import type { GetComponent } from "../components/components-utils";
4
+ export declare const renderWebstudioComponentChildren: (children: Array<JSX.Element | string> | undefined) => Array<JSX.Element | string | Array<JSX.Element | string>> | undefined;
5
+ type WebstudioComponentProps = {
6
+ instance: Instance;
7
+ instanceSelector: Instance["id"][];
8
+ children: Array<JSX.Element | string>;
9
+ getComponent: GetComponent;
10
+ };
11
+ export declare const WebstudioComponent: ({ instance, instanceSelector, children, getComponent, ...rest }: WebstudioComponentProps) => JSX.Element;
12
+ export declare const idAttribute = "data-ws-id";
13
+ export declare const componentAttribute = "data-ws-component";
14
+ export declare const collapsedAttribute = "data-ws-collapsed";
15
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -20,10 +20,10 @@
20
20
  "react-dom": "^18.2.0",
21
21
  "typescript": "5.0.3",
22
22
  "zod": "^3.19.1",
23
- "@webstudio-is/jest-config": "^1.0.4",
23
+ "@webstudio-is/jest-config": "^1.0.5",
24
24
  "@webstudio-is/scripts": "^0.0.0",
25
25
  "@webstudio-is/storybook-config": "^0.0.0",
26
- "@webstudio-is/tsconfig": "^1.0.4"
26
+ "@webstudio-is/tsconfig": "^1.0.5"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@remix-run/react": "1.9.0",
@@ -38,16 +38,16 @@
38
38
  "html-tags": "^3.2.0",
39
39
  "nanoevents": "^7.0.1",
40
40
  "nanostores": "^0.7.1",
41
- "@webstudio-is/asset-uploader": "^0.57.0",
42
- "@webstudio-is/css-data": "^0.57.0",
43
- "@webstudio-is/css-engine": "^0.57.0",
44
- "@webstudio-is/css-vars": "^0.57.0",
45
- "@webstudio-is/fonts": "^0.57.0",
46
- "@webstudio-is/generate-arg-types": "^0.57.0",
47
- "@webstudio-is/icons": "^0.57.0",
48
- "@webstudio-is/prisma-client": "^0.57.0",
49
- "@webstudio-is/image": "^0.57.0",
50
- "@webstudio-is/project-build": "^0.57.0"
41
+ "@webstudio-is/asset-uploader": "^0.58.0",
42
+ "@webstudio-is/css-data": "^0.58.0",
43
+ "@webstudio-is/css-engine": "^0.58.0",
44
+ "@webstudio-is/css-vars": "^0.58.0",
45
+ "@webstudio-is/fonts": "^0.58.0",
46
+ "@webstudio-is/generate-arg-types": "^0.58.0",
47
+ "@webstudio-is/icons": "^0.58.0",
48
+ "@webstudio-is/image": "^0.58.0",
49
+ "@webstudio-is/prisma-client": "^0.58.0",
50
+ "@webstudio-is/project-build": "^0.58.0"
51
51
  },
52
52
  "exports": {
53
53
  ".": {
@@ -69,7 +69,7 @@
69
69
  "dev": "build-package --watch",
70
70
  "build": "build-package",
71
71
  "build:args": "generate-arg-types './src/components/*.tsx !./src/**/*.stories.tsx !./src/**/*.ws.tsx' && prettier --write \"**/*.props.ts\"",
72
- "dts": "tsc",
72
+ "dts": "tsc --declarationDir lib/types",
73
73
  "typecheck": "tsc --noEmit --emitDeclarationOnly false",
74
74
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
75
75
  "lint": "eslint ./src --ext .ts,.tsx --max-warnings 0",
@@ -12,7 +12,11 @@ export const wrapLinkComponent = (BaseLink: LinkComponent) => {
12
12
  const href = usePropUrl(getInstanceIdFromComponentProps(props), "href");
13
13
 
14
14
  if (href?.type === "page") {
15
- return <RemixLink {...props} to={href.page.path} ref={ref} />;
15
+ let to = href.page.path;
16
+ if (href.hash !== undefined) {
17
+ to += `#${href.hash}`;
18
+ }
19
+ return <RemixLink {...props} to={to} ref={ref} />;
16
20
  }
17
21
 
18
22
  return <BaseLink {...props} ref={ref} />;
@@ -19,10 +19,14 @@ export const Link = forwardRef<HTMLAnchorElement, Props>((props, ref) => {
19
19
 
20
20
  const { assetBaseUrl } = getParams();
21
21
 
22
- let url: string | undefined;
22
+ let url = "#";
23
+
23
24
  switch (href?.type) {
24
25
  case "page":
25
26
  url = href.page.path;
27
+ if (href.hash !== undefined) {
28
+ url += `#${href.hash}`;
29
+ }
26
30
  break;
27
31
  case "asset":
28
32
  url = `${assetBaseUrl}${href.asset.name}`;