@webstudio-is/sdk 0.0.0-021f2d4

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 (44) hide show
  1. package/LICENSE +661 -0
  2. package/lib/__generated__/normalize.css.js +505 -0
  3. package/lib/core-templates.js +223 -0
  4. package/lib/index.js +1784 -0
  5. package/lib/runtime.js +101 -0
  6. package/lib/types/__generated__/normalize.css.d.ts +57 -0
  7. package/lib/types/core-metas.d.ts +748 -0
  8. package/lib/types/core-templates.d.ts +6 -0
  9. package/lib/types/expression.d.ts +58 -0
  10. package/lib/types/expression.test.d.ts +1 -0
  11. package/lib/types/form-fields.d.ts +8 -0
  12. package/lib/types/index.d.ts +23 -0
  13. package/lib/types/instances-utils.d.ts +5 -0
  14. package/lib/types/instances-utils.test.d.ts +1 -0
  15. package/lib/types/page-meta-generator.d.ts +24 -0
  16. package/lib/types/page-meta-generator.test.d.ts +1 -0
  17. package/lib/types/page-utils.d.ts +24 -0
  18. package/lib/types/page-utils.test.d.ts +1 -0
  19. package/lib/types/resource-loader.d.ts +30 -0
  20. package/lib/types/resource-loader.test.d.ts +1 -0
  21. package/lib/types/resources-generator.d.ts +22 -0
  22. package/lib/types/resources-generator.test.d.ts +1 -0
  23. package/lib/types/runtime.d.ts +3 -0
  24. package/lib/types/schema/assets.d.ts +527 -0
  25. package/lib/types/schema/breakpoints.d.ts +56 -0
  26. package/lib/types/schema/component-meta.d.ts +2118 -0
  27. package/lib/types/schema/data-sources.d.ts +303 -0
  28. package/lib/types/schema/deployment.d.ts +41 -0
  29. package/lib/types/schema/embed-template.d.ts +2250 -0
  30. package/lib/types/schema/instances.d.ts +417 -0
  31. package/lib/types/schema/pages.d.ts +675 -0
  32. package/lib/types/schema/prop-meta.d.ts +434 -0
  33. package/lib/types/schema/props.d.ts +549 -0
  34. package/lib/types/schema/resources.d.ts +121 -0
  35. package/lib/types/schema/style-source-selections.d.ts +23 -0
  36. package/lib/types/schema/style-sources.d.ts +62 -0
  37. package/lib/types/schema/styles.d.ts +2629 -0
  38. package/lib/types/schema/webstudio.d.ts +2374 -0
  39. package/lib/types/scope.d.ts +16 -0
  40. package/lib/types/scope.test.d.ts +1 -0
  41. package/lib/types/to-string.d.ts +2 -0
  42. package/lib/types/url-pattern.d.ts +2 -0
  43. package/lib/types/url-pattern.test.d.ts +1 -0
  44. package/package.json +60 -0
@@ -0,0 +1,223 @@
1
+ // src/core-templates.tsx
2
+ import {
3
+ $,
4
+ css,
5
+ expression,
6
+ Parameter,
7
+ ws
8
+ } from "@webstudio-is/template";
9
+
10
+ // src/core-metas.ts
11
+ import {
12
+ ContentBlockIcon,
13
+ ListViewIcon,
14
+ PaintBrushIcon,
15
+ SettingsIcon,
16
+ AddTemplateInstanceIcon
17
+ } from "@webstudio-is/icons/svg";
18
+
19
+ // src/__generated__/normalize.css.ts
20
+ var html = [
21
+ { property: "display", value: { type: "keyword", value: "grid" } },
22
+ { property: "minHeight", value: { type: "unit", unit: "%", value: 100 } },
23
+ {
24
+ property: "fontFamily",
25
+ value: { type: "fontFamily", value: ["Arial", "Roboto", "sans-serif"] }
26
+ },
27
+ { property: "fontSize", value: { type: "unit", unit: "px", value: 16 } },
28
+ {
29
+ property: "lineHeight",
30
+ value: { type: "unit", unit: "number", value: 1.2 }
31
+ },
32
+ {
33
+ property: "whiteSpaceCollapse",
34
+ value: { type: "keyword", value: "preserve" }
35
+ }
36
+ ];
37
+
38
+ // src/core-metas.ts
39
+ var rootComponent = "ws:root";
40
+ var rootMeta = {
41
+ type: "container",
42
+ label: "Global Root",
43
+ icon: SettingsIcon,
44
+ presetStyle: {
45
+ html
46
+ }
47
+ };
48
+ var rootPropsMeta = {
49
+ props: {}
50
+ };
51
+ var collectionComponent = "ws:collection";
52
+ var collectionMeta = {
53
+ type: "container",
54
+ label: "Collection",
55
+ icon: ListViewIcon
56
+ };
57
+ var collectionPropsMeta = {
58
+ props: {
59
+ data: {
60
+ required: true,
61
+ control: "json",
62
+ type: "json"
63
+ }
64
+ },
65
+ initialProps: ["data"]
66
+ };
67
+ var descendantComponent = "ws:descendant";
68
+ var descendantMeta = {
69
+ type: "control",
70
+ label: "Descendant",
71
+ icon: PaintBrushIcon,
72
+ // @todo infer possible presets
73
+ presetStyle: {},
74
+ constraints: {
75
+ relation: "parent",
76
+ component: { $in: ["HtmlEmbed", "MarkdownEmbed"] }
77
+ }
78
+ };
79
+ var descendantPropsMeta = {
80
+ props: {
81
+ selector: {
82
+ required: true,
83
+ type: "string",
84
+ control: "select",
85
+ options: [
86
+ " p",
87
+ " h1",
88
+ " h2",
89
+ " h3",
90
+ " h4",
91
+ " h5",
92
+ " h6",
93
+ " :where(strong, b)",
94
+ " :where(em, i)",
95
+ " a",
96
+ " img",
97
+ " blockquote",
98
+ " code",
99
+ " :where(ul, ol)",
100
+ " li",
101
+ " hr"
102
+ ]
103
+ }
104
+ },
105
+ initialProps: ["selector"]
106
+ };
107
+ var blockComponent = "ws:block";
108
+ var blockTemplateComponent = "ws:block-template";
109
+ var blockTemplateMeta = {
110
+ type: "container",
111
+ icon: AddTemplateInstanceIcon,
112
+ constraints: {
113
+ relation: "parent",
114
+ component: { $eq: blockComponent }
115
+ }
116
+ };
117
+ var blockTemplatePropsMeta = {
118
+ props: {}
119
+ };
120
+ var blockMeta = {
121
+ type: "container",
122
+ label: "Content Block",
123
+ icon: ContentBlockIcon,
124
+ constraints: [
125
+ {
126
+ relation: "ancestor",
127
+ component: { $nin: [collectionComponent, blockComponent] }
128
+ },
129
+ {
130
+ relation: "child",
131
+ component: { $eq: blockTemplateComponent }
132
+ }
133
+ ]
134
+ };
135
+ var blockPropsMeta = {
136
+ props: {}
137
+ };
138
+ var coreMetas = {
139
+ [rootComponent]: rootMeta,
140
+ [collectionComponent]: collectionMeta,
141
+ [descendantComponent]: descendantMeta,
142
+ [blockComponent]: blockMeta,
143
+ [blockTemplateComponent]: blockTemplateMeta
144
+ };
145
+ var corePropsMetas = {
146
+ [rootComponent]: rootPropsMeta,
147
+ [collectionComponent]: collectionPropsMeta,
148
+ [descendantComponent]: descendantPropsMeta,
149
+ [blockComponent]: blockPropsMeta,
150
+ [blockTemplateComponent]: blockTemplatePropsMeta
151
+ };
152
+
153
+ // src/core-templates.tsx
154
+ import { jsx, jsxs } from "react/jsx-runtime";
155
+ var collectionItem = new Parameter("collectionItem");
156
+ var collectionMeta2 = {
157
+ category: "data",
158
+ order: 2,
159
+ template: /* @__PURE__ */ jsx(
160
+ ws.collection,
161
+ {
162
+ data: ["Collection Item 1", "Collection Item 2", "Collection Item 3"],
163
+ item: collectionItem,
164
+ children: /* @__PURE__ */ jsx($.Box, { children: /* @__PURE__ */ jsx($.Text, { children: expression`${collectionItem}` }) })
165
+ }
166
+ )
167
+ };
168
+ var descendantMeta2 = {
169
+ category: "internal",
170
+ template: /* @__PURE__ */ jsx(ws.descendant, { selector: " p" })
171
+ };
172
+ var BlockTemplate = ws["block-template"];
173
+ var blockMeta2 = {
174
+ category: "typography",
175
+ template: /* @__PURE__ */ jsxs(ws.block, { children: [
176
+ /* @__PURE__ */ jsxs(BlockTemplate, { "ws:label": "Templates", children: [
177
+ /* @__PURE__ */ jsx($.Paragraph, {}),
178
+ /* @__PURE__ */ jsx($.Heading, { "ws:label": "Heading 1", tag: "h1" }),
179
+ /* @__PURE__ */ jsx($.Heading, { "ws:label": "Heading 2", tag: "h2" }),
180
+ /* @__PURE__ */ jsx($.Heading, { "ws:label": "Heading 3", tag: "h3" }),
181
+ /* @__PURE__ */ jsx($.Heading, { "ws:label": "Heading 4", tag: "h4" }),
182
+ /* @__PURE__ */ jsx($.Heading, { "ws:label": "Heading 5", tag: "h5" }),
183
+ /* @__PURE__ */ jsx($.Heading, { "ws:label": "Heading 6", tag: "h6" }),
184
+ /* @__PURE__ */ jsx($.List, { "ws:label": "List (Unordered)", children: /* @__PURE__ */ jsx($.ListItem, {}) }),
185
+ /* @__PURE__ */ jsx($.List, { "ws:label": "List (Ordered)", ordered: true, children: /* @__PURE__ */ jsx($.ListItem, {}) }),
186
+ /* @__PURE__ */ jsx($.Link, {}),
187
+ /* @__PURE__ */ jsx(
188
+ $.Image,
189
+ {
190
+ "ws:style": css`
191
+ margin-right: auto;
192
+ margin-left: auto;
193
+ width: 100%;
194
+ height: auto;
195
+ `
196
+ }
197
+ ),
198
+ /* @__PURE__ */ jsx($.Separator, {}),
199
+ /* @__PURE__ */ jsx($.Blockquote, {}),
200
+ /* @__PURE__ */ jsx($.HtmlEmbed, {}),
201
+ /* @__PURE__ */ jsx($.CodeText, {})
202
+ ] }),
203
+ /* @__PURE__ */ jsxs($.Paragraph, { children: [
204
+ "The Content Block component designates regions on the page where pre-styled instances can be inserted in",
205
+ " ",
206
+ /* @__PURE__ */ jsx($.RichTextLink, { href: "https://wstd.us/content-block", children: "Content mode" }),
207
+ "."
208
+ ] }),
209
+ /* @__PURE__ */ jsxs($.List, { children: [
210
+ /* @__PURE__ */ jsx($.ListItem, { children: "In Content mode, you can edit any direct child instances that were pre-added to the Content Block, as well as add new instances predefined in Templates." }),
211
+ /* @__PURE__ */ jsx($.ListItem, { children: "To predefine instances for insertion in Content mode, switch to Design mode and add them to the Templates container." }),
212
+ /* @__PURE__ */ jsx($.ListItem, { children: "To insert predefined instances in Content mode, click the + button while hovering over the Content Block on the canvas and choose an instance from the list." })
213
+ ] })
214
+ ] })
215
+ };
216
+ var coreTemplates = {
217
+ [collectionComponent]: collectionMeta2,
218
+ [descendantComponent]: descendantMeta2,
219
+ [blockComponent]: blockMeta2
220
+ };
221
+ export {
222
+ coreTemplates
223
+ };