@webstudio-is/react-sdk 0.67.0 → 0.69.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/cjs/components/__generated__/image.props.js +6 -3
- package/lib/cjs/components/__generated__/text-block.props.js +7 -0
- package/lib/cjs/components/blockquote.ws.js +9 -2
- package/lib/cjs/components/box.ws.js +2 -1
- package/lib/cjs/components/button.ws.js +3 -1
- package/lib/cjs/components/checkbox-field.ws.js +12 -6
- package/lib/cjs/components/checkbox.ws.js +1 -0
- package/lib/cjs/components/code-text.ws.js +8 -1
- package/lib/cjs/components/component-meta.js +6 -3
- package/lib/cjs/components/components-utils.js +0 -28
- package/lib/cjs/components/form.ws.js +32 -25
- package/lib/cjs/components/fragment.ws.js +2 -1
- package/lib/cjs/components/heading.ws.js +10 -3
- package/lib/cjs/components/html-embed.ws.js +3 -1
- package/lib/cjs/components/image.js +27 -19
- package/lib/cjs/components/image.ws.js +4 -2
- package/lib/cjs/components/index.js +1 -29
- package/lib/cjs/components/input.ws.js +1 -0
- package/lib/cjs/components/label.ws.js +8 -1
- package/lib/cjs/components/link-block.ws.js +2 -1
- package/lib/cjs/components/link.ws.js +8 -1
- package/lib/cjs/components/list-item.ws.js +11 -4
- package/lib/cjs/components/list.ws.js +2 -2
- package/lib/cjs/components/paragraph.ws.js +10 -3
- package/lib/cjs/components/radio-button-field.ws.js +12 -6
- package/lib/cjs/components/radio-button.ws.js +1 -0
- package/lib/cjs/components/rich-text-link.ws.js +1 -1
- package/lib/cjs/components/separator.ws.js +1 -1
- package/lib/cjs/components/slot.ws.js +3 -1
- package/lib/cjs/components/text-block.js +5 -2
- package/lib/cjs/components/text-block.ws.js +11 -3
- package/lib/cjs/components/textarea.ws.js +1 -0
- package/lib/cjs/embed-template.js +2 -1
- package/lib/cjs/index.js +4 -5
- package/lib/cjs/tree/create-elements-tree.js +8 -8
- package/lib/cjs/tree/root.js +2 -6
- package/lib/cjs/tree/webstudio-component.js +2 -2
- package/lib/components/__generated__/image.props.js +6 -3
- package/lib/components/__generated__/text-block.props.js +7 -0
- package/lib/components/blockquote.ws.js +9 -2
- package/lib/components/box.ws.js +2 -1
- package/lib/components/button.ws.js +3 -1
- package/lib/components/checkbox-field.ws.js +12 -6
- package/lib/components/checkbox.ws.js +1 -0
- package/lib/components/code-text.ws.js +8 -1
- package/lib/components/component-meta.js +6 -3
- package/lib/components/components-utils.js +0 -14
- package/lib/components/form.ws.js +32 -25
- package/lib/components/fragment.ws.js +2 -1
- package/lib/components/heading.ws.js +10 -3
- package/lib/components/html-embed.ws.js +3 -1
- package/lib/components/image.js +34 -20
- package/lib/components/image.ws.js +4 -2
- package/lib/components/index.js +1 -29
- package/lib/components/input.ws.js +1 -0
- package/lib/components/label.ws.js +8 -1
- package/lib/components/link-block.ws.js +2 -1
- package/lib/components/link.ws.js +8 -1
- package/lib/components/list-item.ws.js +11 -4
- package/lib/components/list.ws.js +2 -2
- package/lib/components/paragraph.ws.js +10 -3
- package/lib/components/radio-button-field.ws.js +12 -6
- package/lib/components/radio-button.ws.js +1 -0
- package/lib/components/rich-text-link.ws.js +1 -1
- package/lib/components/separator.ws.js +1 -1
- package/lib/components/slot.ws.js +3 -1
- package/lib/components/text-block.js +9 -3
- package/lib/components/text-block.ws.js +11 -3
- package/lib/components/textarea.ws.js +1 -0
- package/lib/embed-template.js +2 -1
- package/lib/index.js +4 -9
- package/lib/tree/create-elements-tree.js +8 -8
- package/lib/tree/root.js +2 -6
- package/lib/tree/webstudio-component.js +2 -2
- package/lib/types/components/component-meta.d.ts +363 -1356
- package/lib/types/components/components-utils.d.ts +2 -17
- package/lib/types/components/image.d.ts +5 -1
- package/lib/types/components/image.stories.d.ts +10 -2
- package/lib/types/components/index.d.ts +0 -15
- package/lib/types/components/text-block.d.ts +6 -2
- package/lib/types/components/text-block.stories.d.ts +6 -2
- package/lib/types/css/css.d.ts +14 -4
- package/lib/types/css/global-rules.d.ts +14 -4
- package/lib/types/css/normalize.d.ts +611 -611
- package/lib/types/css/style-rules.d.ts +2 -187
- package/lib/types/embed-template.d.ts +543 -167
- package/lib/types/index.d.ts +2 -2
- package/lib/types/props.d.ts +44 -18
- package/lib/types/tree/create-elements-tree.d.ts +4 -4
- package/lib/types/tree/root.d.ts +3 -5
- package/lib/types/tree/webstudio-component.d.ts +3 -3
- package/package.json +25 -14
- package/src/components/__generated__/image.props.ts +5 -2
- package/src/components/__generated__/text-block.props.ts +7 -0
- package/src/components/blockquote.ws.tsx +9 -2
- package/src/components/box.tsx +1 -1
- package/src/components/box.ws.ts +1 -0
- package/src/components/button.ws.tsx +2 -0
- package/src/components/checkbox-field.ws.tsx +12 -6
- package/src/components/checkbox.ws.tsx +1 -0
- package/src/components/code-text.ws.tsx +8 -1
- package/src/components/component-meta.ts +6 -3
- package/src/components/components-utils.ts +2 -31
- package/src/components/form.ws.tsx +32 -25
- package/src/components/fragment.ws.ts +1 -0
- package/src/components/heading.tsx +1 -1
- package/src/components/heading.ws.tsx +9 -2
- package/src/components/html-embed.ws.ts +2 -0
- package/src/components/image.tsx +54 -26
- package/src/components/image.ws.tsx +5 -1
- package/src/components/index.ts +0 -48
- package/src/components/input.ws.tsx +1 -0
- package/src/components/label.ws.tsx +8 -1
- package/src/components/link-block.ws.tsx +1 -0
- package/src/components/link.ws.tsx +8 -1
- package/src/components/list-item.ws.tsx +10 -3
- package/src/components/list.ws.tsx +2 -2
- package/src/components/paragraph.ws.tsx +9 -2
- package/src/components/radio-button-field.ws.tsx +12 -6
- package/src/components/radio-button.ws.tsx +1 -0
- package/src/components/rich-text-link.ws.tsx +1 -1
- package/src/components/separator.ws.tsx +1 -1
- package/src/components/slot.ws.ts +2 -0
- package/src/components/text-block.tsx +16 -5
- package/src/components/text-block.ws.tsx +10 -2
- package/src/components/textarea.ws.tsx +1 -0
- package/src/embed-template.ts +11 -3
- package/src/index.ts +2 -5
- package/src/props.test.ts +0 -1
- package/src/tree/create-elements-tree.tsx +12 -12
- package/src/tree/root.ts +4 -9
- package/src/tree/webstudio-component.tsx +4 -4
- package/lib/app/custom-components/__generated__/form.props.js +0 -411
- package/lib/app/custom-components/__generated__/image.props.js +0 -442
- package/lib/app/custom-components/__generated__/link-block.props.js +0 -432
- package/lib/app/custom-components/__generated__/link.props.js +0 -432
- package/lib/app/custom-components/__generated__/rich-text-link.props.js +0 -432
- package/lib/app/custom-components/form.js +0 -65
- package/lib/app/custom-components/form.ws.js +0 -81
- package/lib/app/custom-components/image.js +0 -40
- package/lib/app/custom-components/index.js +0 -29
- package/lib/app/custom-components/link-block.js +0 -6
- package/lib/app/custom-components/link.js +0 -6
- package/lib/app/custom-components/rich-text-link.js +0 -6
- package/lib/app/custom-components/shared/remix-link.js +0 -22
- package/lib/cjs/app/custom-components/__generated__/form.props.js +0 -431
- package/lib/cjs/app/custom-components/__generated__/image.props.js +0 -462
- package/lib/cjs/app/custom-components/__generated__/link-block.props.js +0 -452
- package/lib/cjs/app/custom-components/__generated__/link.props.js +0 -452
- package/lib/cjs/app/custom-components/__generated__/rich-text-link.props.js +0 -452
- package/lib/cjs/app/custom-components/form.js +0 -81
- package/lib/cjs/app/custom-components/form.ws.js +0 -101
- package/lib/cjs/app/custom-components/image.js +0 -54
- package/lib/cjs/app/custom-components/index.js +0 -49
- package/lib/cjs/app/custom-components/link-block.js +0 -26
- package/lib/cjs/app/custom-components/link.js +0 -26
- package/lib/cjs/app/custom-components/rich-text-link.js +0 -26
- package/lib/cjs/app/custom-components/shared/remix-link.js +0 -42
- package/lib/types/app/custom-components/__generated__/form.props.d.ts +0 -2
- package/lib/types/app/custom-components/__generated__/image.props.d.ts +0 -2
- package/lib/types/app/custom-components/__generated__/link-block.props.d.ts +0 -2
- package/lib/types/app/custom-components/__generated__/link.props.d.ts +0 -2
- package/lib/types/app/custom-components/__generated__/rich-text-link.props.d.ts +0 -2
- package/lib/types/app/custom-components/form.d.ts +0 -5
- package/lib/types/app/custom-components/form.ws.d.ts +0 -3
- package/lib/types/app/custom-components/image.d.ts +0 -6
- package/lib/types/app/custom-components/index.d.ts +0 -31
- package/lib/types/app/custom-components/link-block.d.ts +0 -6
- package/lib/types/app/custom-components/link.d.ts +0 -6
- package/lib/types/app/custom-components/rich-text-link.d.ts +0 -6
- package/lib/types/app/custom-components/shared/remix-link.d.ts +0 -10
- package/src/app/custom-components/__generated__/form.props.ts +0 -456
- package/src/app/custom-components/__generated__/image.props.ts +0 -487
- package/src/app/custom-components/__generated__/link-block.props.ts +0 -477
- package/src/app/custom-components/__generated__/link.props.ts +0 -477
- package/src/app/custom-components/__generated__/rich-text-link.props.ts +0 -477
- package/src/app/custom-components/form.tsx +0 -111
- package/src/app/custom-components/form.ws.tsx +0 -86
- package/src/app/custom-components/image.tsx +0 -55
- package/src/app/custom-components/index.ts +0 -28
- package/src/app/custom-components/link-block.tsx +0 -4
- package/src/app/custom-components/link.tsx +0 -4
- package/src/app/custom-components/rich-text-link.tsx +0 -4
- package/src/app/custom-components/shared/remix-link.tsx +0 -28
|
@@ -25,7 +25,7 @@ const props = {
|
|
|
25
25
|
slot: { required: false, control: "text", type: "string" },
|
|
26
26
|
style: { required: false, control: "text", type: "string" },
|
|
27
27
|
title: { required: false, control: "text", type: "string" },
|
|
28
|
-
alt: { required: false, control: "text", type: "string"
|
|
28
|
+
alt: { required: false, control: "text", type: "string" },
|
|
29
29
|
crossOrigin: {
|
|
30
30
|
required: false,
|
|
31
31
|
control: "radio",
|
|
@@ -62,7 +62,7 @@ const props = {
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
sizes: { required: false, control: "text", type: "string" },
|
|
65
|
-
src: { required: false, control: "text", type: "string"
|
|
65
|
+
src: { required: false, control: "text", type: "string" },
|
|
66
66
|
srcSet: { required: false, control: "text", type: "string" },
|
|
67
67
|
useMap: { required: false, control: "text", type: "string" },
|
|
68
68
|
width: { required: false, control: "number", type: "number" },
|
|
@@ -455,5 +455,8 @@ const props = {
|
|
|
455
455
|
required: false,
|
|
456
456
|
control: "text",
|
|
457
457
|
type: "string"
|
|
458
|
-
}
|
|
458
|
+
},
|
|
459
|
+
quality: { required: false, control: "number", type: "number" },
|
|
460
|
+
loader: { required: true, control: "text", type: "string" },
|
|
461
|
+
optimize: { required: false, control: "boolean", type: "boolean" }
|
|
459
462
|
};
|
|
@@ -74,13 +74,20 @@ const presetStyle = {
|
|
|
74
74
|
]
|
|
75
75
|
};
|
|
76
76
|
const meta = {
|
|
77
|
-
category: "
|
|
77
|
+
category: "text",
|
|
78
78
|
type: "rich-text",
|
|
79
79
|
label: "Blockquote",
|
|
80
80
|
icon: import_svg.BlockquoteIcon,
|
|
81
81
|
states: import_component_meta.defaultStates,
|
|
82
82
|
presetStyle,
|
|
83
|
-
|
|
83
|
+
template: [
|
|
84
|
+
{
|
|
85
|
+
type: "instance",
|
|
86
|
+
component: "Blockquote",
|
|
87
|
+
children: [{ type: "text", value: "Blockquote you can edit" }]
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
order: 3
|
|
84
91
|
};
|
|
85
92
|
const propsMeta = {
|
|
86
93
|
props: import_blockquote.props
|
|
@@ -32,6 +32,7 @@ const presetStyle = {
|
|
|
32
32
|
const meta = {
|
|
33
33
|
category: "forms",
|
|
34
34
|
type: "container",
|
|
35
|
+
invalidAncestors: ["Button"],
|
|
35
36
|
label: "Button",
|
|
36
37
|
icon: import_svg.ButtonElementIcon,
|
|
37
38
|
presetStyle,
|
|
@@ -39,7 +40,8 @@ const meta = {
|
|
|
39
40
|
...import_component_meta.defaultStates,
|
|
40
41
|
{ selector: ":disabled", label: "Disabled" },
|
|
41
42
|
{ selector: ":enabled", label: "Enabled" }
|
|
42
|
-
]
|
|
43
|
+
],
|
|
44
|
+
order: 1
|
|
43
45
|
};
|
|
44
46
|
const propsMeta = {
|
|
45
47
|
props: import_button.props,
|
|
@@ -39,14 +39,20 @@ const meta = {
|
|
|
39
39
|
icon: import_svg.CheckboxCheckedIcon,
|
|
40
40
|
states: import_component_meta.defaultStates,
|
|
41
41
|
presetStyle,
|
|
42
|
-
|
|
43
|
-
{ type: "instance", component: "Checkbox", props: [], children: [] },
|
|
42
|
+
template: [
|
|
44
43
|
{
|
|
45
44
|
type: "instance",
|
|
46
|
-
component: "
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
component: "CheckboxField",
|
|
46
|
+
children: [
|
|
47
|
+
{ type: "instance", component: "Checkbox", children: [] },
|
|
48
|
+
{
|
|
49
|
+
type: "instance",
|
|
50
|
+
component: "TextBlock",
|
|
51
|
+
label: "Checkbox Label",
|
|
52
|
+
props: [],
|
|
53
|
+
children: [{ type: "text", value: "Checkbox" }]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
50
56
|
}
|
|
51
57
|
]
|
|
52
58
|
};
|
|
@@ -59,7 +59,14 @@ const meta = {
|
|
|
59
59
|
icon: import_svg.CodeTextIcon,
|
|
60
60
|
states: import_component_meta.defaultStates,
|
|
61
61
|
presetStyle,
|
|
62
|
-
|
|
62
|
+
template: [
|
|
63
|
+
{
|
|
64
|
+
type: "instance",
|
|
65
|
+
component: "CodeText",
|
|
66
|
+
children: [{ type: "text", value: "Code you can edit" }]
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
order: 8
|
|
63
70
|
};
|
|
64
71
|
const propsMeta = {
|
|
65
72
|
props: import_code_text2.props,
|
|
@@ -33,7 +33,7 @@ const WsComponentPropsMeta = import_zod.z.object({
|
|
|
33
33
|
});
|
|
34
34
|
const componentCategories = [
|
|
35
35
|
"general",
|
|
36
|
-
"
|
|
36
|
+
"text",
|
|
37
37
|
"media",
|
|
38
38
|
"forms"
|
|
39
39
|
];
|
|
@@ -64,10 +64,13 @@ const WsComponentMeta = import_zod.z.object({
|
|
|
64
64
|
"rich-text",
|
|
65
65
|
"rich-text-child"
|
|
66
66
|
]),
|
|
67
|
-
|
|
67
|
+
requiredAncestors: import_zod.z.optional(import_zod.z.array(import_zod.z.string())),
|
|
68
|
+
invalidAncestors: import_zod.z.optional(import_zod.z.array(import_zod.z.string())),
|
|
69
|
+
stylable: import_zod.z.optional(import_zod.z.boolean()),
|
|
68
70
|
label: import_zod.z.string(),
|
|
69
71
|
icon: import_zod.z.string(),
|
|
70
72
|
presetStyle: import_zod.z.optional(import_zod.z.record(import_zod.z.string(), import_embed_template.EmbedTemplateStyleDecl)),
|
|
71
73
|
states: import_zod.z.optional(import_zod.z.array(ComponentState)),
|
|
72
|
-
|
|
74
|
+
template: import_zod.z.optional(import_embed_template.WsEmbedTemplate),
|
|
75
|
+
order: import_zod.z.number().optional()
|
|
73
76
|
});
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
6
|
var __copyProps = (to, from, except, desc) => {
|
|
13
7
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
8
|
for (let key of __getOwnPropNames(from))
|
|
@@ -17,28 +11,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
11
|
}
|
|
18
12
|
return to;
|
|
19
13
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
15
|
var components_utils_exports = {};
|
|
30
|
-
__export(components_utils_exports, {
|
|
31
|
-
createGetComponent: () => createGetComponent,
|
|
32
|
-
getComponent: () => getComponent
|
|
33
|
-
});
|
|
34
16
|
module.exports = __toCommonJS(components_utils_exports);
|
|
35
|
-
var components = __toESM(require("./components"), 1);
|
|
36
|
-
var import_index = require("./index");
|
|
37
|
-
const getComponent = (name) => {
|
|
38
|
-
return import_index.registeredComponents != null && name in import_index.registeredComponents ? import_index.registeredComponents[name] : components[name];
|
|
39
|
-
};
|
|
40
|
-
const createGetComponent = (comps) => {
|
|
41
|
-
return (name) => {
|
|
42
|
-
return import_index.registeredComponents != null && name in import_index.registeredComponents ? import_index.registeredComponents[name] : comps[name];
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -39,33 +39,40 @@ const meta = {
|
|
|
39
39
|
icon: import_svg.FormIcon,
|
|
40
40
|
states: import_component_meta.defaultStates,
|
|
41
41
|
presetStyle,
|
|
42
|
-
|
|
42
|
+
order: 0,
|
|
43
|
+
template: [
|
|
43
44
|
{
|
|
44
45
|
type: "instance",
|
|
45
|
-
component: "
|
|
46
|
-
children: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
component: "Form",
|
|
47
|
+
children: [
|
|
48
|
+
{
|
|
49
|
+
type: "instance",
|
|
50
|
+
component: "Label",
|
|
51
|
+
children: [{ type: "text", value: "Name" }]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "instance",
|
|
55
|
+
component: "Input",
|
|
56
|
+
props: [{ type: "string", name: "name", value: "name" }],
|
|
57
|
+
children: []
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: "instance",
|
|
61
|
+
component: "Label",
|
|
62
|
+
children: [{ type: "text", value: "Email" }]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: "instance",
|
|
66
|
+
component: "Input",
|
|
67
|
+
props: [{ type: "string", name: "name", value: "email" }],
|
|
68
|
+
children: []
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: "instance",
|
|
72
|
+
component: "Button",
|
|
73
|
+
children: [{ type: "text", value: "Submit" }]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
69
76
|
}
|
|
70
77
|
]
|
|
71
78
|
};
|
|
@@ -35,13 +35,20 @@ const presetStyle = {
|
|
|
35
35
|
h6: import_normalize.h6
|
|
36
36
|
};
|
|
37
37
|
const meta = {
|
|
38
|
-
category: "
|
|
38
|
+
category: "text",
|
|
39
39
|
type: "rich-text",
|
|
40
40
|
label: "Heading",
|
|
41
41
|
icon: import_svg.HeadingIcon,
|
|
42
|
-
children: [{ type: "text", value: "Heading you can edit" }],
|
|
43
42
|
states: import_component_meta.defaultStates,
|
|
44
|
-
presetStyle
|
|
43
|
+
presetStyle,
|
|
44
|
+
template: [
|
|
45
|
+
{
|
|
46
|
+
type: "instance",
|
|
47
|
+
component: "Heading",
|
|
48
|
+
children: [{ type: "text", value: "Heading you can edit" }]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
order: 1
|
|
45
52
|
};
|
|
46
53
|
const propsMeta = {
|
|
47
54
|
props: import_heading.props,
|
|
@@ -24,26 +24,10 @@ __export(image_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(image_exports);
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
var import_react = require("react");
|
|
27
|
+
var import_image = require("@webstudio-is/image");
|
|
28
|
+
var import_props = require("../props");
|
|
29
|
+
var import_params = require("../app/params");
|
|
27
30
|
const defaultTag = "img";
|
|
28
|
-
const Image = (0, import_react.forwardRef)(
|
|
29
|
-
(imageProps, ref) => {
|
|
30
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
31
|
-
"img",
|
|
32
|
-
{
|
|
33
|
-
...imageProps,
|
|
34
|
-
src: imageProps.src || imagePlaceholderSvg,
|
|
35
|
-
ref
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
Image.defaultProps = {
|
|
41
|
-
src: "",
|
|
42
|
-
width: "",
|
|
43
|
-
height: "",
|
|
44
|
-
alt: ""
|
|
45
|
-
};
|
|
46
|
-
Image.displayName = "Image";
|
|
47
31
|
const imagePlaceholderSvg = `data:image/svg+xml;base64,${btoa(`<svg
|
|
48
32
|
width="140"
|
|
49
33
|
height="140"
|
|
@@ -67,3 +51,27 @@ const imagePlaceholderSvg = `data:image/svg+xml;base64,${btoa(`<svg
|
|
|
67
51
|
fill="#A2A2A2"
|
|
68
52
|
/>
|
|
69
53
|
</svg>`)}`;
|
|
54
|
+
const Image = (0, import_react.forwardRef)(
|
|
55
|
+
(props, ref) => {
|
|
56
|
+
const asset = (0, import_props.usePropAsset)((0, import_props.getInstanceIdFromComponentProps)(props), "src");
|
|
57
|
+
const loader = (0, import_react.useMemo)(() => {
|
|
58
|
+
const params = (0, import_params.getParams)();
|
|
59
|
+
return (0, import_image.createImageLoader)({ imageBaseUrl: params.imageBaseUrl });
|
|
60
|
+
}, []);
|
|
61
|
+
const src = asset?.name ?? props.src;
|
|
62
|
+
if (asset == null || loader == null) {
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { ...props, src: src || imagePlaceholderSvg, ref }, src);
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
import_image.Image,
|
|
67
|
+
{
|
|
68
|
+
...props,
|
|
69
|
+
loader,
|
|
70
|
+
src,
|
|
71
|
+
ref
|
|
72
|
+
},
|
|
73
|
+
src
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
Image.displayName = "Image";
|
|
@@ -48,11 +48,13 @@ const meta = {
|
|
|
48
48
|
label: "Image",
|
|
49
49
|
icon: import_svg.ImageIcon,
|
|
50
50
|
states: import_component_meta.defaultStates,
|
|
51
|
-
presetStyle
|
|
51
|
+
presetStyle,
|
|
52
|
+
order: 0
|
|
52
53
|
};
|
|
54
|
+
const { loader, ...publicProps } = import_image.props;
|
|
53
55
|
const propsMeta = {
|
|
54
56
|
props: {
|
|
55
|
-
...
|
|
57
|
+
...publicProps,
|
|
56
58
|
src: {
|
|
57
59
|
type: "string",
|
|
58
60
|
control: "file",
|
|
@@ -18,13 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var components_exports = {};
|
|
20
20
|
__export(components_exports, {
|
|
21
|
-
canAcceptComponent: () => canAcceptComponent,
|
|
22
21
|
defaultMetas: () => defaultMetas,
|
|
23
|
-
defaultPropsMetas: () => defaultPropsMetas
|
|
24
|
-
getComponentMeta: () => getComponentMeta,
|
|
25
|
-
registerComponentMetas: () => registerComponentMetas,
|
|
26
|
-
registerComponents: () => registerComponents,
|
|
27
|
-
registeredComponents: () => registeredComponents
|
|
22
|
+
defaultPropsMetas: () => defaultPropsMetas
|
|
28
23
|
});
|
|
29
24
|
module.exports = __toCommonJS(components_exports);
|
|
30
25
|
var import_slot = require("./slot.ws");
|
|
@@ -128,17 +123,6 @@ const defaultMetas = {
|
|
|
128
123
|
CheckboxField: import_checkbox_field.meta,
|
|
129
124
|
Checkbox: import_checkbox.meta
|
|
130
125
|
};
|
|
131
|
-
let currentMetas = defaultMetas;
|
|
132
|
-
const getComponentMeta = (name) => {
|
|
133
|
-
return currentMetas[name];
|
|
134
|
-
};
|
|
135
|
-
const registerComponentMetas = (overrides) => {
|
|
136
|
-
const result = {};
|
|
137
|
-
for (const name of Object.keys(defaultMetas)) {
|
|
138
|
-
result[name] = { ...defaultMetas[name], ...overrides[name] };
|
|
139
|
-
}
|
|
140
|
-
currentMetas = result;
|
|
141
|
-
};
|
|
142
126
|
const defaultPropsMetas = {
|
|
143
127
|
Slot: import_slot2.propsMeta,
|
|
144
128
|
Fragment: import_fragment2.propsMeta,
|
|
@@ -174,15 +158,3 @@ const defaultPropsMetas = {
|
|
|
174
158
|
CheckboxField: import_checkbox_field2.propsMeta,
|
|
175
159
|
Checkbox: import_checkbox2.propsMeta
|
|
176
160
|
};
|
|
177
|
-
let registeredComponents;
|
|
178
|
-
const registerComponents = (components) => {
|
|
179
|
-
registeredComponents = components;
|
|
180
|
-
};
|
|
181
|
-
const canAcceptComponent = (parentComponent, childComponent) => {
|
|
182
|
-
const parentMeta = getComponentMeta(parentComponent);
|
|
183
|
-
const childMeta = getComponentMeta(childComponent);
|
|
184
|
-
if (parentMeta?.type !== "container" || childMeta === void 0) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
return childMeta.acceptedParents === void 0 || childMeta.acceptedParents.includes(parentComponent);
|
|
188
|
-
};
|
|
@@ -39,7 +39,14 @@ const meta = {
|
|
|
39
39
|
icon: import_svg.TextBlockIcon,
|
|
40
40
|
states: import_component_meta.defaultStates,
|
|
41
41
|
presetStyle,
|
|
42
|
-
|
|
42
|
+
order: 2,
|
|
43
|
+
template: [
|
|
44
|
+
{
|
|
45
|
+
type: "instance",
|
|
46
|
+
component: "Label",
|
|
47
|
+
children: [{ type: "text", value: "Form Label" }]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
43
50
|
};
|
|
44
51
|
const propsMeta = {
|
|
45
52
|
props: {
|
|
@@ -45,6 +45,7 @@ const meta = {
|
|
|
45
45
|
label: "Link Text",
|
|
46
46
|
icon: import_svg.LinkIcon,
|
|
47
47
|
presetStyle,
|
|
48
|
+
order: 1,
|
|
48
49
|
states: [
|
|
49
50
|
...import_component_meta.defaultStates,
|
|
50
51
|
{
|
|
@@ -57,7 +58,13 @@ const meta = {
|
|
|
57
58
|
label: "Current page"
|
|
58
59
|
}
|
|
59
60
|
],
|
|
60
|
-
|
|
61
|
+
template: [
|
|
62
|
+
{
|
|
63
|
+
type: "instance",
|
|
64
|
+
component: "Link",
|
|
65
|
+
children: [{ type: "text", value: "Link text you can edit" }]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
61
68
|
};
|
|
62
69
|
const propsMeta = {
|
|
63
70
|
props: {
|
|
@@ -30,14 +30,21 @@ const presetStyle = {
|
|
|
30
30
|
li: import_normalize.li
|
|
31
31
|
};
|
|
32
32
|
const meta = {
|
|
33
|
-
category: "
|
|
33
|
+
category: "general",
|
|
34
34
|
type: "rich-text",
|
|
35
|
-
|
|
35
|
+
requiredAncestors: ["List"],
|
|
36
36
|
label: "List Item",
|
|
37
37
|
icon: import_svg.ListItemIcon,
|
|
38
|
-
children: [{ type: "text", value: "List Item you can edit" }],
|
|
39
38
|
states: import_component_meta.defaultStates,
|
|
40
|
-
presetStyle
|
|
39
|
+
presetStyle,
|
|
40
|
+
template: [
|
|
41
|
+
{
|
|
42
|
+
type: "instance",
|
|
43
|
+
component: "ListItem",
|
|
44
|
+
children: [{ type: "text", value: "List Item you can edit" }]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
order: 4
|
|
41
48
|
};
|
|
42
49
|
const propsMeta = {
|
|
43
50
|
props: import_list_item.props
|
|
@@ -59,13 +59,13 @@ const presetStyle = {
|
|
|
59
59
|
]
|
|
60
60
|
};
|
|
61
61
|
const meta = {
|
|
62
|
-
category: "
|
|
62
|
+
category: "general",
|
|
63
63
|
type: "container",
|
|
64
64
|
label: "List",
|
|
65
65
|
icon: import_svg.ListIcon,
|
|
66
66
|
states: import_component_meta.defaultStates,
|
|
67
67
|
presetStyle,
|
|
68
|
-
|
|
68
|
+
order: 3
|
|
69
69
|
};
|
|
70
70
|
const propsMeta = {
|
|
71
71
|
props: import_list.props,
|
|
@@ -30,13 +30,20 @@ const presetStyle = {
|
|
|
30
30
|
p: import_normalize.p
|
|
31
31
|
};
|
|
32
32
|
const meta = {
|
|
33
|
-
category: "
|
|
33
|
+
category: "text",
|
|
34
34
|
type: "rich-text",
|
|
35
35
|
label: "Paragraph",
|
|
36
36
|
icon: import_svg.TextAlignLeftIcon,
|
|
37
|
-
children: [{ type: "text", value: "Pragraph you can edit" }],
|
|
38
37
|
states: import_component_meta.defaultStates,
|
|
39
|
-
presetStyle
|
|
38
|
+
presetStyle,
|
|
39
|
+
template: [
|
|
40
|
+
{
|
|
41
|
+
type: "instance",
|
|
42
|
+
component: "Paragraph",
|
|
43
|
+
children: [{ type: "text", value: "Pragraph you can edit" }]
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
order: 2
|
|
40
47
|
};
|
|
41
48
|
const propsMeta = {
|
|
42
49
|
props: import_paragraph.props
|
|
@@ -39,14 +39,20 @@ const meta = {
|
|
|
39
39
|
icon: import_svg.RadioCheckedIcon,
|
|
40
40
|
states: import_component_meta.defaultStates,
|
|
41
41
|
presetStyle,
|
|
42
|
-
|
|
43
|
-
{ type: "instance", component: "RadioButton", props: [], children: [] },
|
|
42
|
+
template: [
|
|
44
43
|
{
|
|
45
44
|
type: "instance",
|
|
46
|
-
component: "
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
component: "RadioButtonField",
|
|
46
|
+
children: [
|
|
47
|
+
{ type: "instance", component: "RadioButton", props: [], children: [] },
|
|
48
|
+
{
|
|
49
|
+
type: "instance",
|
|
50
|
+
component: "TextBlock",
|
|
51
|
+
label: "Radio Label",
|
|
52
|
+
props: [],
|
|
53
|
+
children: [{ type: "text", value: "Radio" }]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
50
56
|
}
|
|
51
57
|
]
|
|
52
58
|
};
|