@webstudio-is/react-sdk 0.7.2 → 0.7.3
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/arg-types/utils.js +3 -8
- package/lib/cjs/arg-types/utils.cjs +88 -0
- package/lib/cjs/arg-types/utils.d.ts +10 -0
- package/lib/cjs/arg-types/utils.d.ts.map +1 -0
- package/lib/cjs/components/body.cjs +8 -0
- package/lib/cjs/components/body.d.ts +3 -0
- package/lib/cjs/components/body.d.ts.map +1 -0
- package/lib/cjs/components/body.props.json +491 -0
- package/lib/cjs/components/body.stories.cjs +11 -0
- package/lib/cjs/components/body.stories.d.ts +7 -0
- package/lib/cjs/components/body.stories.d.ts.map +1 -0
- package/lib/cjs/components/body.ws.cjs +64 -0
- package/lib/cjs/components/body.ws.d.ts +5 -0
- package/lib/cjs/components/body.ws.d.ts.map +1 -0
- package/lib/cjs/components/bold.cjs +8 -0
- package/lib/cjs/components/bold.d.ts +3 -0
- package/lib/cjs/components/bold.d.ts.map +1 -0
- package/lib/cjs/components/bold.props.json +491 -0
- package/lib/cjs/components/bold.stories.cjs +14 -0
- package/lib/cjs/components/bold.stories.d.ts +6 -0
- package/lib/cjs/components/bold.stories.d.ts.map +1 -0
- package/lib/cjs/components/bold.ws.cjs +14 -0
- package/lib/cjs/components/bold.ws.d.ts +5 -0
- package/lib/cjs/components/bold.ws.d.ts.map +1 -0
- package/lib/cjs/components/box.cjs +9 -0
- package/lib/cjs/components/box.d.ts +8 -0
- package/lib/cjs/components/box.d.ts.map +1 -0
- package/lib/cjs/components/box.props.json +508 -0
- package/lib/cjs/components/box.stories.cjs +12 -0
- package/lib/cjs/components/box.stories.d.ts +10 -0
- package/lib/cjs/components/box.stories.d.ts.map +1 -0
- package/lib/cjs/components/box.ws.cjs +21 -0
- package/lib/cjs/components/box.ws.d.ts +5 -0
- package/lib/cjs/components/box.ws.d.ts.map +1 -0
- package/lib/cjs/components/button.cjs +11 -0
- package/lib/cjs/components/button.d.ts +3 -0
- package/lib/cjs/components/button.d.ts.map +1 -0
- package/lib/cjs/components/button.props.json +547 -0
- package/lib/cjs/components/button.stories.cjs +14 -0
- package/lib/cjs/components/button.stories.d.ts +6 -0
- package/lib/cjs/components/button.stories.d.ts.map +1 -0
- package/lib/cjs/components/button.ws.cjs +15 -0
- package/lib/cjs/components/button.ws.d.ts +5 -0
- package/lib/cjs/components/button.ws.d.ts.map +1 -0
- package/lib/cjs/components/component-type.cjs +28 -0
- package/lib/cjs/components/component-type.d.ts +17 -0
- package/lib/cjs/components/component-type.d.ts.map +1 -0
- package/lib/cjs/components/form.cjs +8 -0
- package/lib/cjs/components/form.d.ts +3 -0
- package/lib/cjs/components/form.d.ts.map +1 -0
- package/lib/cjs/components/form.props.json +531 -0
- package/lib/cjs/components/form.stories.cjs +12 -0
- package/lib/cjs/components/form.stories.d.ts +6 -0
- package/lib/cjs/components/form.stories.d.ts.map +1 -0
- package/lib/cjs/components/form.ws.cjs +26 -0
- package/lib/cjs/components/form.ws.d.ts +5 -0
- package/lib/cjs/components/form.ws.d.ts.map +1 -0
- package/lib/cjs/components/heading.cjs +9 -0
- package/lib/cjs/components/heading.d.ts +8 -0
- package/lib/cjs/components/heading.d.ts.map +1 -0
- package/lib/cjs/components/heading.props.json +497 -0
- package/lib/cjs/components/heading.stories.cjs +14 -0
- package/lib/cjs/components/heading.stories.d.ts +10 -0
- package/lib/cjs/components/heading.stories.d.ts.map +1 -0
- package/lib/cjs/components/heading.ws.cjs +15 -0
- package/lib/cjs/components/heading.ws.d.ts +5 -0
- package/lib/cjs/components/heading.ws.d.ts.map +1 -0
- package/lib/cjs/components/image.cjs +40 -0
- package/lib/cjs/components/image.d.ts +3 -0
- package/lib/cjs/components/image.d.ts.map +1 -0
- package/lib/cjs/components/image.props.json +575 -0
- package/lib/cjs/components/image.stories.cjs +12 -0
- package/lib/cjs/components/image.stories.d.ts +6 -0
- package/lib/cjs/components/image.stories.d.ts.map +1 -0
- package/lib/cjs/components/image.ws.cjs +29 -0
- package/lib/cjs/components/image.ws.d.ts +5 -0
- package/lib/cjs/components/image.ws.d.ts.map +1 -0
- package/lib/cjs/components/index.cjs +36 -0
- package/lib/cjs/components/index.d.ts +16 -0
- package/lib/cjs/components/index.d.ts.map +1 -0
- package/lib/cjs/components/index.test.cjs +33 -0
- package/lib/cjs/components/index.test.d.ts +2 -0
- package/lib/cjs/components/index.test.d.ts.map +1 -0
- package/lib/cjs/components/input.cjs +8 -0
- package/lib/cjs/components/input.d.ts +3 -0
- package/lib/cjs/components/input.d.ts.map +1 -0
- package/lib/cjs/components/input.props.json +657 -0
- package/lib/cjs/components/input.stories.cjs +12 -0
- package/lib/cjs/components/input.stories.d.ts +6 -0
- package/lib/cjs/components/input.stories.d.ts.map +1 -0
- package/lib/cjs/components/input.ws.cjs +14 -0
- package/lib/cjs/components/input.ws.d.ts +5 -0
- package/lib/cjs/components/input.ws.d.ts.map +1 -0
- package/lib/cjs/components/italic.cjs +8 -0
- package/lib/cjs/components/italic.d.ts +3 -0
- package/lib/cjs/components/italic.d.ts.map +1 -0
- package/lib/cjs/components/italic.props.json +491 -0
- package/lib/cjs/components/italic.stories.cjs +14 -0
- package/lib/cjs/components/italic.stories.d.ts +6 -0
- package/lib/cjs/components/italic.stories.d.ts.map +1 -0
- package/lib/cjs/components/italic.ws.cjs +14 -0
- package/lib/cjs/components/italic.ws.d.ts +5 -0
- package/lib/cjs/components/italic.ws.d.ts.map +1 -0
- package/lib/cjs/components/link.cjs +8 -0
- package/lib/cjs/components/link.d.ts +8 -0
- package/lib/cjs/components/link.d.ts.map +1 -0
- package/lib/cjs/components/link.props.json +547 -0
- package/lib/cjs/components/link.stories.cjs +14 -0
- package/lib/cjs/components/link.stories.d.ts +10 -0
- package/lib/cjs/components/link.stories.d.ts.map +1 -0
- package/lib/cjs/components/link.ws.cjs +27 -0
- package/lib/cjs/components/link.ws.d.ts +5 -0
- package/lib/cjs/components/link.ws.d.ts.map +1 -0
- package/lib/cjs/components/meta.cjs +40 -0
- package/lib/cjs/components/meta.d.ts +7479 -0
- package/lib/cjs/components/meta.d.ts.map +1 -0
- package/lib/cjs/components/paragraph.cjs +8 -0
- package/lib/cjs/components/paragraph.d.ts +3 -0
- package/lib/cjs/components/paragraph.d.ts.map +1 -0
- package/lib/cjs/components/paragraph.props.json +491 -0
- package/lib/cjs/components/paragraph.stories.cjs +14 -0
- package/lib/cjs/components/paragraph.stories.d.ts +6 -0
- package/lib/cjs/components/paragraph.stories.d.ts.map +1 -0
- package/lib/cjs/components/paragraph.ws.cjs +15 -0
- package/lib/cjs/components/paragraph.ws.d.ts +5 -0
- package/lib/cjs/components/paragraph.ws.d.ts.map +1 -0
- package/lib/cjs/components/span.cjs +8 -0
- package/lib/cjs/components/span.d.ts +3 -0
- package/lib/cjs/components/span.d.ts.map +1 -0
- package/lib/cjs/components/span.props.json +491 -0
- package/lib/cjs/components/span.stories.cjs +14 -0
- package/lib/cjs/components/span.stories.d.ts +6 -0
- package/lib/cjs/components/span.stories.d.ts.map +1 -0
- package/lib/cjs/components/span.ws.cjs +14 -0
- package/lib/cjs/components/span.ws.d.ts +5 -0
- package/lib/cjs/components/span.ws.d.ts.map +1 -0
- package/lib/cjs/components/subscript.cjs +8 -0
- package/lib/cjs/components/subscript.d.ts +3 -0
- package/lib/cjs/components/subscript.d.ts.map +1 -0
- package/lib/cjs/components/subscript.props.json +491 -0
- package/lib/cjs/components/subscript.stories.cjs +14 -0
- package/lib/cjs/components/subscript.stories.d.ts +6 -0
- package/lib/cjs/components/subscript.stories.d.ts.map +1 -0
- package/lib/cjs/components/subscript.ws.cjs +14 -0
- package/lib/cjs/components/subscript.ws.d.ts +5 -0
- package/lib/cjs/components/subscript.ws.d.ts.map +1 -0
- package/lib/cjs/components/superscript.cjs +8 -0
- package/lib/cjs/components/superscript.d.ts +3 -0
- package/lib/cjs/components/superscript.d.ts.map +1 -0
- package/lib/cjs/components/superscript.props.json +491 -0
- package/lib/cjs/components/superscript.stories.cjs +14 -0
- package/lib/cjs/components/superscript.stories.d.ts +6 -0
- package/lib/cjs/components/superscript.stories.d.ts.map +1 -0
- package/lib/cjs/components/superscript.ws.cjs +14 -0
- package/lib/cjs/components/superscript.ws.d.ts +5 -0
- package/lib/cjs/components/superscript.ws.d.ts.map +1 -0
- package/lib/cjs/components/text-block.cjs +8 -0
- package/lib/cjs/components/text-block.d.ts +3 -0
- package/lib/cjs/components/text-block.d.ts.map +1 -0
- package/lib/cjs/components/text-block.props.json +491 -0
- package/lib/cjs/components/text-block.stories.cjs +14 -0
- package/lib/cjs/components/text-block.stories.d.ts +6 -0
- package/lib/cjs/components/text-block.stories.d.ts.map +1 -0
- package/lib/cjs/components/text-block.ws.cjs +23 -0
- package/lib/cjs/components/text-block.ws.d.ts +5 -0
- package/lib/cjs/components/text-block.ws.d.ts.map +1 -0
- package/lib/cjs/css/breakpoints.cjs +9 -0
- package/lib/cjs/css/breakpoints.d.ts +4 -0
- package/lib/cjs/css/breakpoints.d.ts.map +1 -0
- package/lib/cjs/css/categories.cjs +229 -0
- package/lib/cjs/css/categories.d.ts +408 -0
- package/lib/cjs/css/categories.d.ts.map +1 -0
- package/lib/cjs/css/get-browser-style.cjs +48 -0
- package/lib/cjs/css/get-browser-style.d.ts +3 -0
- package/lib/cjs/css/get-browser-style.d.ts.map +1 -0
- package/lib/cjs/css/index.cjs +19 -0
- package/lib/cjs/css/index.d.ts +4 -0
- package/lib/cjs/css/index.d.ts.map +1 -0
- package/lib/cjs/db/index.cjs +18 -0
- package/lib/cjs/db/index.d.ts +3 -0
- package/lib/cjs/db/index.d.ts.map +1 -0
- package/lib/cjs/db/instance.cjs +21 -0
- package/lib/cjs/db/instance.d.ts +14 -0
- package/lib/cjs/db/instance.d.ts.map +1 -0
- package/lib/cjs/db/types.cjs +2 -0
- package/lib/cjs/db/types.d.ts +17 -0
- package/lib/cjs/db/types.d.ts.map +1 -0
- package/lib/cjs/index.cjs +37 -0
- package/lib/cjs/index.d.ts +9 -0
- package/lib/cjs/index.d.ts.map +1 -0
- package/lib/cjs/pubsub/create.cjs +66 -0
- package/lib/cjs/pubsub/create.d.ts +29 -0
- package/lib/cjs/pubsub/create.d.ts.map +1 -0
- package/lib/cjs/pubsub/index.cjs +17 -0
- package/lib/cjs/pubsub/index.d.ts +2 -0
- package/lib/cjs/pubsub/index.d.ts.map +1 -0
- package/lib/cjs/remix/handle-request.server.cjs +15 -0
- package/lib/cjs/remix/handle-request.server.d.ts +3 -0
- package/lib/cjs/remix/handle-request.server.d.ts.map +1 -0
- package/lib/cjs/remix/index.cjs +18 -0
- package/lib/cjs/remix/index.d.ts +3 -0
- package/lib/cjs/remix/index.d.ts.map +1 -0
- package/lib/cjs/remix/root.cjs +13 -0
- package/lib/cjs/remix/root.d.ts +8 -0
- package/lib/cjs/remix/root.d.ts.map +1 -0
- package/lib/cjs/tree/create-elements-tree.cjs +54 -0
- package/lib/cjs/tree/create-elements-tree.d.ts +19 -0
- package/lib/cjs/tree/create-elements-tree.d.ts.map +1 -0
- package/lib/cjs/tree/index.cjs +19 -0
- package/lib/cjs/tree/index.d.ts +4 -0
- package/lib/cjs/tree/index.d.ts.map +1 -0
- package/lib/cjs/tree/root.cjs +17 -0
- package/lib/cjs/tree/root.d.ts +18 -0
- package/lib/cjs/tree/root.d.ts.map +1 -0
- package/lib/cjs/tree/session-storage-polyfill.cjs +39 -0
- package/lib/cjs/tree/session-storage-polyfill.d.ts +2 -0
- package/lib/cjs/tree/session-storage-polyfill.d.ts.map +1 -0
- package/lib/cjs/tree/wrapper-component.cjs +53 -0
- package/lib/cjs/tree/wrapper-component.d.ts +12 -0
- package/lib/cjs/tree/wrapper-component.d.ts.map +1 -0
- package/lib/cjs/user-props/all-user-props.cjs +21 -0
- package/lib/cjs/user-props/all-user-props.d.ts +8 -0
- package/lib/cjs/user-props/all-user-props.d.ts.map +1 -0
- package/lib/cjs/user-props/index.cjs +20 -0
- package/lib/cjs/user-props/index.d.ts +5 -0
- package/lib/cjs/user-props/index.d.ts.map +1 -0
- package/lib/cjs/user-props/schema.cjs +33 -0
- package/lib/cjs/user-props/schema.d.ts +72 -0
- package/lib/cjs/user-props/schema.d.ts.map +1 -0
- package/lib/cjs/user-props/types.cjs +2 -0
- package/lib/cjs/user-props/types.d.ts +13 -0
- package/lib/cjs/user-props/types.d.ts.map +1 -0
- package/lib/cjs/user-props/use-user-props.cjs +33 -0
- package/lib/cjs/user-props/use-user-props.d.ts +12 -0
- package/lib/cjs/user-props/use-user-props.d.ts.map +1 -0
- package/lib/components/body.js +4 -7
- package/lib/components/body.stories.js +5 -9
- package/lib/components/body.ws.js +5 -7
- package/lib/components/bold.js +4 -7
- package/lib/components/bold.stories.js +7 -10
- package/lib/components/bold.ws.js +5 -7
- package/lib/components/box.js +4 -7
- package/lib/components/box.stories.js +7 -10
- package/lib/components/box.ws.js +5 -7
- package/lib/components/button.js +5 -8
- package/lib/components/button.stories.js +7 -10
- package/lib/components/button.ws.js +5 -7
- package/lib/components/component-type.js +11 -14
- package/lib/components/form.js +4 -7
- package/lib/components/form.stories.js +7 -10
- package/lib/components/form.ws.js +5 -7
- package/lib/components/heading.js +4 -7
- package/lib/components/heading.stories.js +7 -10
- package/lib/components/heading.ws.js +5 -7
- package/lib/components/image.d.ts +2 -10
- package/lib/components/image.d.ts.map +1 -1
- package/lib/components/image.js +6 -21
- package/lib/components/image.stories.d.ts +2 -10
- package/lib/components/image.stories.d.ts.map +1 -1
- package/lib/components/image.stories.js +7 -10
- package/lib/components/image.ws.js +5 -7
- package/lib/components/index.js +15 -36
- package/lib/components/index.test.js +3 -28
- package/lib/components/input.js +4 -7
- package/lib/components/input.stories.js +7 -10
- package/lib/components/input.ws.js +5 -7
- package/lib/components/italic.js +4 -7
- package/lib/components/italic.stories.js +7 -10
- package/lib/components/italic.ws.js +5 -7
- package/lib/components/link.js +4 -7
- package/lib/components/link.stories.js +7 -10
- package/lib/components/link.ws.js +5 -7
- package/lib/components/meta.d.ts +13 -4
- package/lib/components/meta.d.ts.map +1 -1
- package/lib/components/meta.js +32 -37
- package/lib/components/paragraph.js +4 -7
- package/lib/components/paragraph.stories.js +7 -10
- package/lib/components/paragraph.ws.js +5 -7
- package/lib/components/span.js +4 -7
- package/lib/components/span.stories.js +7 -10
- package/lib/components/span.ws.js +5 -7
- package/lib/components/subscript.js +4 -7
- package/lib/components/subscript.stories.js +7 -10
- package/lib/components/subscript.ws.js +5 -7
- package/lib/components/superscript.js +4 -7
- package/lib/components/superscript.stories.js +7 -10
- package/lib/components/superscript.ws.js +5 -7
- package/lib/components/text-block.js +4 -7
- package/lib/components/text-block.stories.js +7 -10
- package/lib/components/text-block.ws.js +5 -7
- package/lib/css/breakpoints.js +1 -4
- package/lib/css/categories.js +5 -8
- package/lib/css/get-browser-style.js +7 -11
- package/lib/css/index.js +3 -19
- package/lib/db/index.js +2 -18
- package/lib/db/instance.js +8 -12
- package/lib/db/types.d.ts +6 -0
- package/lib/db/types.d.ts.map +1 -1
- package/lib/db/types.js +1 -2
- package/lib/index.js +8 -37
- package/lib/pubsub/create.js +8 -15
- package/lib/pubsub/index.js +1 -17
- package/lib/remix/handle-request.server.js +5 -9
- package/lib/remix/index.js +2 -18
- package/lib/remix/root.js +5 -9
- package/lib/tree/create-elements-tree.js +7 -11
- package/lib/tree/index.js +3 -19
- package/lib/tree/root.js +7 -11
- package/lib/tree/session-storage-polyfill.js +2 -6
- package/lib/tree/wrapper-component.js +11 -39
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/user-props/all-user-props.js +7 -11
- package/lib/user-props/index.js +4 -20
- package/lib/user-props/schema.d.ts +41 -4
- package/lib/user-props/schema.d.ts.map +1 -1
- package/lib/user-props/schema.js +29 -10
- package/lib/user-props/types.js +1 -2
- package/lib/user-props/use-user-props.d.ts.map +1 -1
- package/lib/user-props/use-user-props.js +7 -11
- package/package.json +14 -9
- package/lib/component-utils/image.d.ts +0 -107
- package/lib/component-utils/image.d.ts.map +0 -1
- package/lib/component-utils/image.js +0 -198
- package/lib/component-utils/image.test.d.ts +0 -2
- package/lib/component-utils/image.test.d.ts.map +0 -1
- package/lib/component-utils/image.test.js +0 -132
- package/lib/components/image-dev.stories.d.ts +0 -36
- package/lib/components/image-dev.stories.d.ts.map +0 -1
- package/lib/components/image-dev.stories.js +0 -102
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-browser-style"), exports);
|
|
18
|
+
__exportStar(require("./categories"), exports);
|
|
19
|
+
__exportStar(require("./breakpoints"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/css/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./instance"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/db/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Instance = exports.toBaseInstance = void 0;
|
|
4
|
+
const css_data_1 = require("@webstudio-is/css-data");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const toBaseInstance = (instance) => {
|
|
7
|
+
return {
|
|
8
|
+
id: instance.id,
|
|
9
|
+
component: instance.component,
|
|
10
|
+
cssRules: instance.cssRules,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
exports.toBaseInstance = toBaseInstance;
|
|
14
|
+
exports.Instance = zod_1.z.lazy(() => zod_1.z.object({
|
|
15
|
+
id: zod_1.z.string(),
|
|
16
|
+
component: zod_1.z.string(),
|
|
17
|
+
children: zod_1.z.array(zod_1.z.union([exports.Instance, zod_1.z.string()])),
|
|
18
|
+
cssRules: zod_1.z.array(css_data_1.CssRule),
|
|
19
|
+
})
|
|
20
|
+
// @todo can't figure out how to make component to be z.enum(Object.keys(components))
|
|
21
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CssRule } from "@webstudio-is/css-data";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as components from "../components";
|
|
4
|
+
export declare type BaseInstance = {
|
|
5
|
+
id: string;
|
|
6
|
+
component: keyof typeof components;
|
|
7
|
+
cssRules: Array<CssRule>;
|
|
8
|
+
};
|
|
9
|
+
export declare type Instance = BaseInstance & {
|
|
10
|
+
children: Array<Instance | string>;
|
|
11
|
+
};
|
|
12
|
+
export declare const toBaseInstance: (instance: Instance) => BaseInstance;
|
|
13
|
+
export declare const Instance: z.ZodType<Instance, z.ZodTypeDef, Instance>;
|
|
14
|
+
//# sourceMappingURL=instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../../src/db/instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAI5C,oBAAY,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,OAAO,UAAU,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;CAC1B,CAAC;AAEF,oBAAY,QAAQ,GAAG,YAAY,GAAG;IACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,cAAc,aAAc,QAAQ,KAAG,YAMnD,CAAC;AAEF,eAAO,MAAM,QAAQ,6CASG,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InstanceProps as DbInstanceProps } from "@webstudio-is/prisma-client";
|
|
2
|
+
import type { UserProp } from "../user-props";
|
|
3
|
+
import type { Instance } from "./instance";
|
|
4
|
+
export declare type Tree = {
|
|
5
|
+
id: string;
|
|
6
|
+
root: Instance;
|
|
7
|
+
};
|
|
8
|
+
export declare type Props = {
|
|
9
|
+
props: string;
|
|
10
|
+
id: string;
|
|
11
|
+
instanceId: string;
|
|
12
|
+
treeId: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type InstanceProps = Omit<DbInstanceProps, "props"> & {
|
|
15
|
+
props: Array<UserProp>;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/db/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,oBAAY,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,oBAAY,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,oBAAY,aAAa,GAAG,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,GAAG;IAC3D,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.components = void 0;
|
|
30
|
+
__exportStar(require("./css"), exports);
|
|
31
|
+
__exportStar(require("./tree"), exports);
|
|
32
|
+
exports.components = __importStar(require("./components"));
|
|
33
|
+
__exportStar(require("./components/meta"), exports);
|
|
34
|
+
__exportStar(require("./user-props"), exports);
|
|
35
|
+
__exportStar(require("./pubsub"), exports);
|
|
36
|
+
__exportStar(require("./db"), exports);
|
|
37
|
+
__exportStar(require("./remix"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./css";
|
|
2
|
+
export * from "./tree";
|
|
3
|
+
export * as components from "./components";
|
|
4
|
+
export * from "./components/meta";
|
|
5
|
+
export * from "./user-props";
|
|
6
|
+
export * from "./pubsub";
|
|
7
|
+
export * from "./db";
|
|
8
|
+
export * from "./remix";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createPubsub = void 0;
|
|
7
|
+
const mitt_1 = __importDefault(require("mitt"));
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const createPubsub = () => {
|
|
10
|
+
// `mitt` has a somewhat annoying overload for `*` type that makes it hard to wrap in a generic context
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
const emitter = (0, mitt_1.default)();
|
|
13
|
+
if (typeof window === "object") {
|
|
14
|
+
window.addEventListener("message", (event) => {
|
|
15
|
+
// @todo this has no type safety built in, could be anything from any source.
|
|
16
|
+
// we could potentially maintain a list of valid event types at runtime
|
|
17
|
+
// at the very least we could add a brand property or something to our events
|
|
18
|
+
if (typeof event.data?.type === "string") {
|
|
19
|
+
emitter.emit(event.data.type, event.data.payload);
|
|
20
|
+
}
|
|
21
|
+
}, false);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
/**
|
|
25
|
+
* To publish a postMessage event on the current window and parent window from the iframe.
|
|
26
|
+
*/
|
|
27
|
+
publish(action) {
|
|
28
|
+
window.parent.postMessage(action, "*");
|
|
29
|
+
window.postMessage(action, "*");
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* To publish a postMessage event on the iframe and parent window from the parent window.
|
|
33
|
+
*/
|
|
34
|
+
usePublish() {
|
|
35
|
+
const iframeRef = (0, react_1.useRef)(null);
|
|
36
|
+
const publishCallback = (0, react_1.useCallback)((action) => {
|
|
37
|
+
const element = iframeRef.current;
|
|
38
|
+
if (element?.contentWindow == null)
|
|
39
|
+
return;
|
|
40
|
+
element.contentWindow.postMessage(action, "*");
|
|
41
|
+
window.postMessage(action, "*");
|
|
42
|
+
}, [iframeRef]);
|
|
43
|
+
return [publishCallback, iframeRef];
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* To subscribe a message event on the current window.
|
|
47
|
+
*/
|
|
48
|
+
useSubscribe(type, onAction) {
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
50
|
+
emitter.on(type, onAction);
|
|
51
|
+
return () => {
|
|
52
|
+
emitter.off(type, onAction);
|
|
53
|
+
};
|
|
54
|
+
}, [type, onAction]);
|
|
55
|
+
},
|
|
56
|
+
useSubscribeAll(onAction) {
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
emitter.on("*", onAction);
|
|
59
|
+
return () => {
|
|
60
|
+
emitter.off("*", onAction);
|
|
61
|
+
};
|
|
62
|
+
}, [onAction]);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.createPubsub = createPubsub;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
useSubscribeAll(onAction: <Type_3 extends keyof PublishMap>(type: Type_3, payload: PublishMap[Type_3]) => void): void;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/pubsub/create.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,YAAY;IA0BrB;;OAEG;;;;;;;;IAMH;;OAEG;;;;;;;;IAeH;;OAEG;2GAGwC,IAAI;8GAcxC,IAAI;CAUd,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pubsub/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleRequest = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const server_1 = require("react-dom/server");
|
|
6
|
+
const react_1 = require("@remix-run/react");
|
|
7
|
+
const handleRequest = (request, responseStatusCode, responseHeaders, remixContext) => {
|
|
8
|
+
const markup = (0, server_1.renderToString)((0, jsx_runtime_1.jsx)(react_1.RemixServer, { context: remixContext, url: request.url }));
|
|
9
|
+
responseHeaders.set("Content-Type", "text/html");
|
|
10
|
+
return new Response(`<!DOCTYPE html>${markup}`, {
|
|
11
|
+
status: responseStatusCode,
|
|
12
|
+
headers: responseHeaders,
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
exports.handleRequest = handleRequest;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-request.server.d.ts","sourceRoot":"","sources":["../../../src/remix/handle-request.server.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,eAAO,MAAM,aAAa,YACf,OAAO,sBACI,MAAM,mBACT,OAAO,gBACV,YAAY,aAY3B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./root"), exports);
|
|
18
|
+
__exportStar(require("./handle-request.server"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/remix/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Root = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@remix-run/react");
|
|
6
|
+
const remix_utils_1 = require("remix-utils");
|
|
7
|
+
/**
|
|
8
|
+
* We are using Outlet prop from index layout when user renders site from a subdomain.
|
|
9
|
+
*/
|
|
10
|
+
const Root = ({ Outlet = react_1.Outlet, }) => {
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("html", { lang: "en", children: [(0, jsx_runtime_1.jsxs)("head", { children: [(0, jsx_runtime_1.jsx)("meta", { charSet: "utf-8" }), (0, jsx_runtime_1.jsx)("meta", { name: "viewport", content: "width=device-width,initial-scale=1" }), (0, jsx_runtime_1.jsx)("link", { rel: "icon", href: "/favicon.ico", type: "image/x-icon" }), (0, jsx_runtime_1.jsx)("link", { rel: "shortcut icon", href: "/favicon.ico", type: "image/x-icon" }), (0, jsx_runtime_1.jsx)(react_1.Meta, {}), (0, jsx_runtime_1.jsx)(remix_utils_1.DynamicLinks, {}), (0, jsx_runtime_1.jsx)(react_1.Links, {})] }), (0, jsx_runtime_1.jsx)(Outlet, {})] }));
|
|
12
|
+
};
|
|
13
|
+
exports.Root = Root;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Outlet as DefaultOutlet } from "@remix-run/react";
|
|
2
|
+
/**
|
|
3
|
+
* We are using Outlet prop from index layout when user renders site from a subdomain.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Root: ({ Outlet, }: {
|
|
6
|
+
Outlet: typeof DefaultOutlet;
|
|
7
|
+
}) => JSX.Element;
|
|
8
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/remix/root.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGxE;;GAEG;AACH,eAAO,MAAM,IAAI;YAGP,oBAAoB;iBAiB7B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createElementsTree = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_2 = require("@remix-run/react");
|
|
7
|
+
const session_storage_polyfill_1 = require("./session-storage-polyfill");
|
|
8
|
+
const createElementsTree = ({ sandbox, instance, Component, onChangeChildren, }) => {
|
|
9
|
+
const children = createInstanceChildrenElements({
|
|
10
|
+
Component,
|
|
11
|
+
children: instance.children,
|
|
12
|
+
onChangeChildren,
|
|
13
|
+
});
|
|
14
|
+
const body = createInstanceElement({
|
|
15
|
+
Component,
|
|
16
|
+
instance,
|
|
17
|
+
children: [
|
|
18
|
+
(0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [children, sandbox && (0, jsx_runtime_1.jsx)(session_storage_polyfill_1.SessionStoragePolyfill, {}), (0, jsx_runtime_1.jsx)(react_2.ScrollRestoration, {}), (0, jsx_runtime_1.jsx)(react_2.Scripts, {})] }, "children"),
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
return body;
|
|
22
|
+
};
|
|
23
|
+
exports.createElementsTree = createElementsTree;
|
|
24
|
+
const createInstanceChildrenElements = ({ children, Component, onChangeChildren, }) => {
|
|
25
|
+
const elements = [];
|
|
26
|
+
for (const child of children) {
|
|
27
|
+
if (typeof child === "string") {
|
|
28
|
+
elements.push(child);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const children = createInstanceChildrenElements({
|
|
32
|
+
children: child.children,
|
|
33
|
+
Component,
|
|
34
|
+
onChangeChildren,
|
|
35
|
+
});
|
|
36
|
+
const element = createInstanceElement({
|
|
37
|
+
instance: child,
|
|
38
|
+
Component,
|
|
39
|
+
onChangeChildren,
|
|
40
|
+
children,
|
|
41
|
+
});
|
|
42
|
+
elements.push(element);
|
|
43
|
+
}
|
|
44
|
+
return elements;
|
|
45
|
+
};
|
|
46
|
+
const createInstanceElement = ({ Component, instance, children = [], onChangeChildren, }) => {
|
|
47
|
+
const props = {
|
|
48
|
+
instance,
|
|
49
|
+
children,
|
|
50
|
+
key: instance.id,
|
|
51
|
+
onChangeChildren,
|
|
52
|
+
};
|
|
53
|
+
return (0, jsx_runtime_1.jsx)(Component, { ...props });
|
|
54
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import type { Instance } from "../db";
|
|
3
|
+
import { WrapperComponent } from "./wrapper-component";
|
|
4
|
+
export declare type ChildrenUpdates = Array<string | {
|
|
5
|
+
id: undefined | Instance["id"];
|
|
6
|
+
component: Instance["component"];
|
|
7
|
+
children: ChildrenUpdates;
|
|
8
|
+
}>;
|
|
9
|
+
export declare type OnChangeChildren = (change: {
|
|
10
|
+
instanceId: Instance["id"];
|
|
11
|
+
updates: ChildrenUpdates;
|
|
12
|
+
}) => void;
|
|
13
|
+
export declare const createElementsTree: ({ sandbox, instance, Component, onChangeChildren, }: {
|
|
14
|
+
sandbox?: boolean | undefined;
|
|
15
|
+
instance: Instance;
|
|
16
|
+
Component: (props: ComponentProps<typeof WrapperComponent>) => JSX.Element;
|
|
17
|
+
onChangeChildren?: OnChangeChildren | undefined;
|
|
18
|
+
}) => JSX.Element;
|
|
19
|
+
//# sourceMappingURL=create-elements-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-elements-tree.d.ts","sourceRoot":"","sources":["../../../src/tree/create-elements-tree.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD,oBAAY,eAAe,GAAG,KAAK,CAC/B,MAAM,GACN;IACE,EAAE,EAAE,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/B,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,QAAQ,EAAE,eAAe,CAAC;CAC3B,CACJ,CAAC;AAEF,oBAAY,gBAAgB,GAAG,CAAC,MAAM,EAAE;IACtC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,eAAe,CAAC;CAC1B,KAAK,IAAI,CAAC;AAEX,eAAO,MAAM,kBAAkB;;cAOnB,QAAQ;uBACC,eAAe,uBAAuB,CAAC,KAAK,WAAW;;iBAqB3E,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-elements-tree"), exports);
|
|
18
|
+
__exportStar(require("./root"), exports);
|
|
19
|
+
__exportStar(require("./wrapper-component"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tree/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstanceRoot = void 0;
|
|
4
|
+
const user_props_1 = require("../user-props/");
|
|
5
|
+
const create_elements_tree_1 = require("./create-elements-tree");
|
|
6
|
+
const wrapper_component_1 = require("./wrapper-component");
|
|
7
|
+
const InstanceRoot = ({ data, Component, }) => {
|
|
8
|
+
if (data.tree === null) {
|
|
9
|
+
throw new Error("Tree is null");
|
|
10
|
+
}
|
|
11
|
+
(0, user_props_1.useAllUserProps)(data.props);
|
|
12
|
+
return (0, create_elements_tree_1.createElementsTree)({
|
|
13
|
+
instance: data.tree.root,
|
|
14
|
+
Component: Component ?? wrapper_component_1.WrapperComponent,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.InstanceRoot = InstanceRoot;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Tree, InstanceProps } from "../db";
|
|
2
|
+
import { WrapperComponent } from "./wrapper-component";
|
|
3
|
+
import type { Asset } from "@webstudio-is/asset-uploader";
|
|
4
|
+
import { type ComponentProps } from "react";
|
|
5
|
+
import type { Breakpoint } from "@webstudio-is/css-data";
|
|
6
|
+
export declare type Data = {
|
|
7
|
+
tree: Tree | null;
|
|
8
|
+
breakpoints: Array<Breakpoint>;
|
|
9
|
+
props: Array<InstanceProps>;
|
|
10
|
+
assets: Array<Asset>;
|
|
11
|
+
};
|
|
12
|
+
declare type RootProps = {
|
|
13
|
+
data: Data;
|
|
14
|
+
Component?: (props: ComponentProps<typeof WrapperComponent>) => JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export declare const InstanceRoot: ({ data, Component, }: RootProps) => JSX.Element | null;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/tree/root.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,oBAAY,IAAI,GAAG;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;CACtB,CAAC;AAEF,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC;CAC7E,CAAC;AAEF,eAAO,MAAM,YAAY,yBAGtB,SAAS,KAAG,WAAW,GAAG,IAS5B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionStoragePolyfill = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// This is a temporary work around for https://github.com/remix-run/remix/issues/3659
|
|
6
|
+
// The code is based on this discussion https://bugs.chromium.org/p/chromium/issues/detail?id=357625
|
|
7
|
+
const polyfill = function () {
|
|
8
|
+
try {
|
|
9
|
+
const key = "__session_storage_availability_test__";
|
|
10
|
+
sessionStorage.setItem(key, "test"); // test
|
|
11
|
+
sessionStorage.removeItem(key); // cleanup
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
alert('It looks like you have disabled cookies in your browser. Webstudio designer may not work properly.\n\nTo enable cookies, go to "Setting" > "Privacy and security" > "Cookies and other site data", and make sure neither "Block all cookies" nor "Block third-party cookies" are selected.\n\nRead more at https://support.google.com/chrome/answer/95647');
|
|
15
|
+
const data = new Map();
|
|
16
|
+
Object.defineProperty(window, "sessionStorage", {
|
|
17
|
+
value: {
|
|
18
|
+
setItem: (key, val) => {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.warn(`Session storage is unavailable due to Error "${error.message}". A polyfill is used to set value of "${key}". The value will be lost when the page is reloaded.`);
|
|
21
|
+
data.set(key, String(val));
|
|
22
|
+
},
|
|
23
|
+
getItem: (key) => {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.warn(`Session storage is unavailable due to Error "${error.message}". A polyfill is used to get value of "${key}". The value will be undefined if the page was reloaded after it was set.`);
|
|
26
|
+
return data.get(key);
|
|
27
|
+
},
|
|
28
|
+
removeItem: (key) => {
|
|
29
|
+
data.delete(key);
|
|
30
|
+
},
|
|
31
|
+
clear: () => {
|
|
32
|
+
data.clear();
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}.toString();
|
|
38
|
+
const SessionStoragePolyfill = () => ((0, jsx_runtime_1.jsx)("script", { dangerouslySetInnerHTML: { __html: `(${polyfill})()` }, suppressHydrationWarning: true }));
|
|
39
|
+
exports.SessionStoragePolyfill = SessionStoragePolyfill;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-storage-polyfill.d.ts","sourceRoot":"","sources":["../../../src/tree/session-storage-polyfill.tsx"],"names":[],"mappings":"AA4CA,eAAO,MAAM,sBAAsB,mBAKlC,CAAC"}
|