@webstudio-is/react-sdk 0.7.0 → 0.7.2
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.d.ts +4 -18
- package/lib/arg-types/utils.d.ts.map +1 -1
- package/lib/arg-types/utils.js +23 -16
- package/lib/component-utils/image.d.ts +107 -0
- package/lib/component-utils/image.d.ts.map +1 -0
- package/lib/component-utils/image.js +198 -0
- package/lib/component-utils/image.test.d.ts +2 -0
- package/lib/component-utils/image.test.d.ts.map +1 -0
- package/lib/component-utils/image.test.js +132 -0
- package/lib/components/body.props.json +104 -1847
- package/lib/components/body.stories.d.ts +2 -2
- package/lib/components/body.stories.d.ts.map +1 -1
- package/lib/components/body.stories.js +0 -5
- package/lib/components/bold.d.ts +2 -2
- package/lib/components/bold.d.ts.map +1 -1
- package/lib/components/bold.props.json +104 -1847
- package/lib/components/bold.stories.d.ts +3 -3
- package/lib/components/bold.stories.d.ts.map +1 -1
- package/lib/components/bold.stories.js +0 -5
- package/lib/components/box.props.json +108 -1899
- package/lib/components/box.stories.d.ts +5 -5
- package/lib/components/box.stories.d.ts.map +1 -1
- package/lib/components/box.stories.js +0 -5
- package/lib/components/button.d.ts +2 -2
- package/lib/components/button.d.ts.map +1 -1
- package/lib/components/button.props.json +117 -2065
- package/lib/components/button.stories.d.ts +3 -3
- package/lib/components/button.stories.d.ts.map +1 -1
- package/lib/components/button.stories.js +0 -5
- package/lib/components/component-type.d.ts +1 -1
- package/lib/components/component-type.d.ts.map +1 -1
- package/lib/components/form.d.ts +2 -2
- package/lib/components/form.d.ts.map +1 -1
- package/lib/components/form.props.json +112 -1991
- package/lib/components/form.stories.d.ts +3 -3
- package/lib/components/form.stories.d.ts.map +1 -1
- package/lib/components/form.stories.js +0 -5
- package/lib/components/heading.props.json +107 -1893
- package/lib/components/heading.stories.d.ts +5 -5
- package/lib/components/heading.stories.d.ts.map +1 -1
- package/lib/components/heading.stories.js +0 -5
- package/lib/components/image-dev.stories.d.ts +36 -0
- package/lib/components/image-dev.stories.d.ts.map +1 -0
- package/lib/components/image-dev.stories.js +102 -0
- package/lib/components/image.d.ts +10 -2
- package/lib/components/image.d.ts.map +1 -1
- package/lib/components/image.js +19 -9
- package/lib/components/image.props.json +140 -2098
- package/lib/components/image.stories.d.ts +11 -3
- package/lib/components/image.stories.d.ts.map +1 -1
- package/lib/components/image.stories.js +0 -5
- package/lib/components/image.ws.d.ts.map +1 -1
- package/lib/components/image.ws.js +15 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +7 -1
- package/lib/components/input.d.ts +2 -2
- package/lib/components/input.d.ts.map +1 -1
- package/lib/components/input.props.json +138 -2474
- package/lib/components/input.stories.d.ts +3 -3
- package/lib/components/input.stories.d.ts.map +1 -1
- package/lib/components/input.stories.js +0 -5
- package/lib/components/italic.d.ts +2 -2
- package/lib/components/italic.d.ts.map +1 -1
- package/lib/components/italic.props.json +104 -1847
- package/lib/components/italic.stories.d.ts +3 -3
- package/lib/components/italic.stories.d.ts.map +1 -1
- package/lib/components/italic.stories.js +0 -5
- package/lib/components/link.d.ts +2 -2
- package/lib/components/link.d.ts.map +1 -1
- package/lib/components/link.props.json +116 -2040
- package/lib/components/link.stories.d.ts +5 -5
- package/lib/components/link.stories.d.ts.map +1 -1
- package/lib/components/link.stories.js +0 -5
- package/lib/components/meta.d.ts +7469 -12
- package/lib/components/meta.d.ts.map +1 -1
- package/lib/components/meta.js +34 -25
- package/lib/components/paragraph.d.ts +2 -2
- package/lib/components/paragraph.d.ts.map +1 -1
- package/lib/components/paragraph.props.json +104 -1847
- package/lib/components/paragraph.stories.d.ts +3 -3
- package/lib/components/paragraph.stories.d.ts.map +1 -1
- package/lib/components/paragraph.stories.js +0 -5
- package/lib/components/span.d.ts +3 -0
- package/lib/components/span.d.ts.map +1 -0
- package/lib/components/span.js +8 -0
- package/lib/components/span.props.json +491 -0
- package/lib/components/span.stories.d.ts +6 -0
- package/lib/components/span.stories.d.ts.map +1 -0
- package/lib/components/span.stories.js +14 -0
- package/lib/components/span.ws.d.ts +5 -0
- package/lib/components/span.ws.d.ts.map +1 -0
- package/lib/components/span.ws.js +14 -0
- package/lib/components/subscript.d.ts +3 -0
- package/lib/components/subscript.d.ts.map +1 -0
- package/lib/components/subscript.js +8 -0
- package/lib/components/subscript.props.json +491 -0
- package/lib/components/subscript.stories.d.ts +6 -0
- package/lib/components/subscript.stories.d.ts.map +1 -0
- package/lib/components/subscript.stories.js +14 -0
- package/lib/components/subscript.ws.d.ts +5 -0
- package/lib/components/subscript.ws.d.ts.map +1 -0
- package/lib/components/subscript.ws.js +14 -0
- package/lib/components/superscript.d.ts +3 -0
- package/lib/components/superscript.d.ts.map +1 -0
- package/lib/components/superscript.js +8 -0
- package/lib/components/superscript.props.json +491 -0
- package/lib/components/superscript.stories.d.ts +6 -0
- package/lib/components/superscript.stories.d.ts.map +1 -0
- package/lib/components/superscript.stories.js +14 -0
- package/lib/components/superscript.ws.d.ts +5 -0
- package/lib/components/superscript.ws.d.ts.map +1 -0
- package/lib/components/superscript.ws.js +14 -0
- package/lib/components/text-block.d.ts +2 -2
- package/lib/components/text-block.d.ts.map +1 -1
- package/lib/components/text-block.props.json +104 -1847
- package/lib/components/text-block.stories.d.ts +3 -3
- package/lib/components/text-block.stories.d.ts.map +1 -1
- package/lib/components/text-block.stories.js +0 -5
- package/lib/css/breakpoints.d.ts +1 -1
- package/lib/css/breakpoints.d.ts.map +1 -1
- package/lib/css/categories.d.ts +2 -2
- package/lib/css/get-browser-style.d.ts +1 -1
- package/lib/css/get-browser-style.d.ts.map +1 -1
- package/lib/css/get-browser-style.js +10 -5
- package/lib/css/index.d.ts +0 -5
- package/lib/css/index.d.ts.map +1 -1
- package/lib/css/index.js +0 -5
- package/lib/db/instance.d.ts +1 -1
- package/lib/db/instance.d.ts.map +1 -1
- package/lib/db/instance.js +2 -2
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -3
- package/lib/pubsub/create.d.ts +1 -0
- package/lib/pubsub/create.d.ts.map +1 -1
- package/lib/pubsub/create.js +8 -0
- package/lib/remix/handle-request.server.d.ts.map +1 -1
- package/lib/remix/handle-request.server.js +1 -2
- package/lib/remix/root.d.ts.map +1 -1
- package/lib/remix/root.js +2 -2
- package/lib/tree/create-elements-tree.d.ts +7 -11
- package/lib/tree/create-elements-tree.d.ts.map +1 -1
- package/lib/tree/create-elements-tree.js +5 -10
- package/lib/tree/root.d.ts +4 -6
- package/lib/tree/root.d.ts.map +1 -1
- package/lib/tree/root.js +1 -23
- package/lib/tree/session-storage-polyfill.d.ts +2 -0
- package/lib/tree/session-storage-polyfill.d.ts.map +1 -0
- package/lib/tree/session-storage-polyfill.js +39 -0
- package/lib/tree/wrapper-component.d.ts +4 -4
- package/lib/tree/wrapper-component.d.ts.map +1 -1
- package/lib/tree/wrapper-component.js +5 -5
- package/package.json +21 -13
- package/lib/css/keyword-values.d.ts +0 -302
- package/lib/css/keyword-values.d.ts.map +0 -1
- package/lib/css/keyword-values.js +0 -6619
- package/lib/css/properties.d.ts +0 -3199
- package/lib/css/properties.d.ts.map +0 -1
- package/lib/css/properties.js +0 -3202
- package/lib/css/schema.d.ts +0 -283
- package/lib/css/schema.d.ts.map +0 -1
- package/lib/css/schema.js +0 -48
- package/lib/css/types.d.ts +0 -6
- package/lib/css/types.d.ts.map +0 -1
- package/lib/css/types.js +0 -2
- package/lib/css/units.d.ts +0 -2
- package/lib/css/units.d.ts.map +0 -1
- package/lib/css/units.js +0 -35
- package/lib/remix/constants.d.ts +0 -2
- package/lib/remix/constants.d.ts.map +0 -1
- package/lib/remix/constants.js +0 -4
- package/lib/remix/insert-critical-css.d.ts +0 -2
- package/lib/remix/insert-critical-css.d.ts.map +0 -1
- package/lib/remix/insert-critical-css.js +0 -9
- package/lib/stitches/index.d.ts +0 -3
- package/lib/stitches/index.d.ts.map +0 -1
- package/lib/stitches/index.js +0 -18
- package/lib/stitches/stitches.d.ts +0 -8
- package/lib/stitches/stitches.d.ts.map +0 -1
- package/lib/stitches/stitches.js +0 -38
- package/lib/stitches/to-css.d.ts +0 -8
- package/lib/stitches/to-css.d.ts.map +0 -1
- package/lib/stitches/to-css.js +0 -52
- package/lib/stitches/to-css.test.d.ts +0 -2
- package/lib/stitches/to-css.test.d.ts.map +0 -1
- package/lib/stitches/to-css.test.js +0 -82
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
-
declare const _default: ComponentMeta<
|
|
3
|
+
declare const _default: ComponentMeta<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
4
4
|
export default _default;
|
|
5
|
-
export declare const TextBlock: ComponentStory<
|
|
5
|
+
export declare const TextBlock: ComponentStory<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>>>;
|
|
6
6
|
//# sourceMappingURL=text-block.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-block.stories.d.ts","sourceRoot":"","sources":["../../src/components/text-block.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"text-block.stories.d.ts","sourceRoot":"","sources":["../../src/components/text-block.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;;AAGtE,wBAG8C;AAM9C,eAAO,MAAM,SAAS,kRAAoB,CAAC"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.TextBlock = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const text_block_1 = require("./text-block");
|
|
9
|
-
const text_block_props_json_1 = __importDefault(require("./text-block.props.json"));
|
|
10
6
|
exports.default = {
|
|
11
7
|
title: "Components/TextBlock",
|
|
12
8
|
component: text_block_1.TextBlock,
|
|
13
|
-
argTypes: text_block_props_json_1.default,
|
|
14
9
|
};
|
|
15
10
|
const Template = (args) => ((0, jsx_runtime_1.jsx)(text_block_1.TextBlock, { ...args }));
|
|
16
11
|
exports.TextBlock = Template.bind({});
|
package/lib/css/breakpoints.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Breakpoint } from "@webstudio-is/css-data";
|
|
2
2
|
export declare type BaseBreakpoint = Pick<Breakpoint, "label" | "minWidth">;
|
|
3
3
|
export declare const initialBreakpoints: Array<BaseBreakpoint>;
|
|
4
4
|
//# sourceMappingURL=breakpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../src/css/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../src/css/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,oBAAY,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;AAEpE,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,cAAc,CAKpD,CAAC"}
|
package/lib/css/categories.d.ts
CHANGED
|
@@ -56,8 +56,6 @@ export declare const categories: {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
export declare const propertyCategoryMap: {
|
|
59
|
-
clip: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
60
|
-
top: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
61
59
|
accentColor: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
62
60
|
alignContent: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
63
61
|
alignItems: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
@@ -142,6 +140,7 @@ export declare const propertyCategoryMap: {
|
|
|
142
140
|
captionSide: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
143
141
|
caretColor: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
144
142
|
clear: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
143
|
+
clip: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
145
144
|
clipPath: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
146
145
|
color: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
147
146
|
colorAdjust: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
@@ -380,6 +379,7 @@ export declare const propertyCategoryMap: {
|
|
|
380
379
|
textTransform: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
381
380
|
textUnderlineOffset: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
382
381
|
textUnderlinePosition: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
382
|
+
top: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
383
383
|
touchAction: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
384
384
|
transform: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
385
385
|
transformBox: "position" | "layout" | "flexChild" | "gridChild" | "spacing" | "size" | "typography" | "backgrounds" | "borders" | "effects" | "other";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-browser-style.d.ts","sourceRoot":"","sources":["../../src/css/get-browser-style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"get-browser-style.d.ts","sourceRoot":"","sources":["../../src/css/get-browser-style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,KAAK,EAGN,MAAM,wBAAwB,CAAC;AA4BhC,eAAO,MAAM,eAAe,aAAc,OAAO,KAAG,KAiBnD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBrowserStyle = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const unitRegex = new RegExp(`${
|
|
4
|
+
const detect_font_1 = require("detect-font");
|
|
5
|
+
const css_data_1 = require("@webstudio-is/css-data");
|
|
6
|
+
const unitRegex = new RegExp(`${css_data_1.units.join("|")}`);
|
|
7
7
|
// @todo use a parser
|
|
8
8
|
const parseValue = (property, value) => {
|
|
9
9
|
const number = parseFloat(value);
|
|
@@ -17,7 +17,7 @@ const parseValue = (property, value) => {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
if (number === 0) {
|
|
20
|
-
return
|
|
20
|
+
return css_data_1.properties[property].initial;
|
|
21
21
|
}
|
|
22
22
|
return {
|
|
23
23
|
type: "unit",
|
|
@@ -31,13 +31,18 @@ const getBrowserStyle = (element) => {
|
|
|
31
31
|
return browserStyle;
|
|
32
32
|
let knownProperty;
|
|
33
33
|
const computedStyle = getComputedStyle(element);
|
|
34
|
-
for (knownProperty in
|
|
34
|
+
for (knownProperty in css_data_1.properties) {
|
|
35
35
|
if (knownProperty in computedStyle === false)
|
|
36
36
|
continue;
|
|
37
37
|
// Typescript doesn't know we can access CSSStyleDeclaration properties by keys
|
|
38
38
|
const computedValue = computedStyle[knownProperty];
|
|
39
39
|
browserStyle[knownProperty] = parseValue(knownProperty, computedValue);
|
|
40
40
|
}
|
|
41
|
+
// We need a single font-family that is actually rendered. Computed style will return a list of potential fonts.
|
|
42
|
+
browserStyle.fontFamily = {
|
|
43
|
+
type: "fontFamily",
|
|
44
|
+
value: [(0, detect_font_1.detectFont)(element)],
|
|
45
|
+
};
|
|
41
46
|
return browserStyle;
|
|
42
47
|
};
|
|
43
48
|
exports.getBrowserStyle = getBrowserStyle;
|
package/lib/css/index.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export * from "./properties";
|
|
2
|
-
export * from "./units";
|
|
3
|
-
export * from "./types";
|
|
4
|
-
export * from "./schema";
|
|
5
1
|
export * from "./get-browser-style";
|
|
6
2
|
export * from "./categories";
|
|
7
|
-
export * from "./keyword-values";
|
|
8
3
|
export * from "./breakpoints";
|
|
9
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/css/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/css/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
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"}
|
package/lib/css/index.js
CHANGED
|
@@ -14,11 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./properties"), exports);
|
|
18
|
-
__exportStar(require("./units"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
|
20
|
-
__exportStar(require("./schema"), exports);
|
|
21
17
|
__exportStar(require("./get-browser-style"), exports);
|
|
22
18
|
__exportStar(require("./categories"), exports);
|
|
23
|
-
__exportStar(require("./keyword-values"), exports);
|
|
24
19
|
__exportStar(require("./breakpoints"), exports);
|
package/lib/db/instance.d.ts
CHANGED
package/lib/db/instance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/db/instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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"}
|
package/lib/db/instance.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Instance = exports.toBaseInstance = void 0;
|
|
4
|
+
const css_data_1 = require("@webstudio-is/css-data");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
|
-
const css_1 = require("../css");
|
|
6
6
|
const toBaseInstance = (instance) => {
|
|
7
7
|
return {
|
|
8
8
|
id: instance.id,
|
|
@@ -15,7 +15,7 @@ exports.Instance = zod_1.z.lazy(() => zod_1.z.object({
|
|
|
15
15
|
id: zod_1.z.string(),
|
|
16
16
|
component: zod_1.z.string(),
|
|
17
17
|
children: zod_1.z.array(zod_1.z.union([exports.Instance, zod_1.z.string()])),
|
|
18
|
-
cssRules: zod_1.z.array(
|
|
18
|
+
cssRules: zod_1.z.array(css_data_1.CssRule),
|
|
19
19
|
})
|
|
20
20
|
// @todo can't figure out how to make component to be z.enum(Object.keys(components))
|
|
21
21
|
);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * from "./css";
|
|
2
2
|
export * from "./tree";
|
|
3
|
-
export * from "./stitches";
|
|
4
3
|
export * as components from "./components";
|
|
5
|
-
export *
|
|
4
|
+
export * from "./components/meta";
|
|
6
5
|
export * from "./user-props";
|
|
7
6
|
export * from "./pubsub";
|
|
8
7
|
export * from "./db";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,
|
|
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"}
|
package/lib/index.js
CHANGED
|
@@ -26,12 +26,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.components = void 0;
|
|
30
30
|
__exportStar(require("./css"), exports);
|
|
31
31
|
__exportStar(require("./tree"), exports);
|
|
32
|
-
__exportStar(require("./stitches"), exports);
|
|
33
32
|
exports.components = __importStar(require("./components"));
|
|
34
|
-
|
|
33
|
+
__exportStar(require("./components/meta"), exports);
|
|
35
34
|
__exportStar(require("./user-props"), exports);
|
|
36
35
|
__exportStar(require("./pubsub"), exports);
|
|
37
36
|
__exportStar(require("./db"), exports);
|
package/lib/pubsub/create.d.ts
CHANGED
|
@@ -24,5 +24,6 @@ export declare const createPubsub: <PublishMap>() => {
|
|
|
24
24
|
* To subscribe a message event on the current window.
|
|
25
25
|
*/
|
|
26
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;
|
|
27
28
|
};
|
|
28
29
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +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;
|
|
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"}
|
package/lib/pubsub/create.js
CHANGED
|
@@ -53,6 +53,14 @@ const createPubsub = () => {
|
|
|
53
53
|
};
|
|
54
54
|
}, [type, onAction]);
|
|
55
55
|
},
|
|
56
|
+
useSubscribeAll(onAction) {
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
emitter.on("*", onAction);
|
|
59
|
+
return () => {
|
|
60
|
+
emitter.off("*", onAction);
|
|
61
|
+
};
|
|
62
|
+
}, [onAction]);
|
|
63
|
+
},
|
|
56
64
|
};
|
|
57
65
|
};
|
|
58
66
|
exports.createPubsub = createPubsub;
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -4,11 +4,10 @@ exports.handleRequest = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const server_1 = require("react-dom/server");
|
|
6
6
|
const react_1 = require("@remix-run/react");
|
|
7
|
-
const insert_critical_css_1 = require("./insert-critical-css");
|
|
8
7
|
const handleRequest = (request, responseStatusCode, responseHeaders, remixContext) => {
|
|
9
8
|
const markup = (0, server_1.renderToString)((0, jsx_runtime_1.jsx)(react_1.RemixServer, { context: remixContext, url: request.url }));
|
|
10
9
|
responseHeaders.set("Content-Type", "text/html");
|
|
11
|
-
return new Response(
|
|
10
|
+
return new Response(`<!DOCTYPE html>${markup}`, {
|
|
12
11
|
status: responseStatusCode,
|
|
13
12
|
headers: responseHeaders,
|
|
14
13
|
});
|
package/lib/remix/root.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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"}
|
package/lib/remix/root.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Root = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("@remix-run/react");
|
|
6
|
-
const
|
|
6
|
+
const remix_utils_1 = require("remix-utils");
|
|
7
7
|
/**
|
|
8
8
|
* We are using Outlet prop from index layout when user renders site from a subdomain.
|
|
9
9
|
*/
|
|
10
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)(
|
|
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
12
|
};
|
|
13
13
|
exports.Root = Root;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
1
2
|
import type { Instance } from "../db";
|
|
2
|
-
import
|
|
3
|
-
import { type WrapperComponentProps } from "./wrapper-component";
|
|
3
|
+
import { WrapperComponent } from "./wrapper-component";
|
|
4
4
|
export declare type ChildrenUpdates = Array<string | {
|
|
5
|
-
id: Instance["id"];
|
|
6
|
-
text: string;
|
|
7
|
-
} | {
|
|
8
|
-
id: Instance["id"];
|
|
9
|
-
text: string;
|
|
5
|
+
id: undefined | Instance["id"];
|
|
10
6
|
component: Instance["component"];
|
|
11
|
-
|
|
7
|
+
children: ChildrenUpdates;
|
|
12
8
|
}>;
|
|
13
9
|
export declare type OnChangeChildren = (change: {
|
|
14
10
|
instanceId: Instance["id"];
|
|
15
11
|
updates: ChildrenUpdates;
|
|
16
12
|
}) => void;
|
|
17
|
-
export declare const createElementsTree: ({
|
|
13
|
+
export declare const createElementsTree: ({ sandbox, instance, Component, onChangeChildren, }: {
|
|
14
|
+
sandbox?: boolean | undefined;
|
|
18
15
|
instance: Instance;
|
|
19
|
-
|
|
20
|
-
Component: (props: WrapperComponentProps) => JSX.Element;
|
|
16
|
+
Component: (props: ComponentProps<typeof WrapperComponent>) => JSX.Element;
|
|
21
17
|
onChangeChildren?: OnChangeChildren | undefined;
|
|
22
18
|
}) => JSX.Element;
|
|
23
19
|
//# sourceMappingURL=create-elements-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-elements-tree.d.ts","sourceRoot":"","sources":["../../src/tree/create-elements-tree.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -3,27 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createElementsTree = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const stitches_1 = require("../stitches");
|
|
7
6
|
const react_2 = require("@remix-run/react");
|
|
8
|
-
const
|
|
7
|
+
const session_storage_polyfill_1 = require("./session-storage-polyfill");
|
|
8
|
+
const createElementsTree = ({ sandbox, instance, Component, onChangeChildren, }) => {
|
|
9
9
|
const children = createInstanceChildrenElements({
|
|
10
10
|
Component,
|
|
11
11
|
children: instance.children,
|
|
12
|
-
breakpoints,
|
|
13
12
|
onChangeChildren,
|
|
14
13
|
});
|
|
15
14
|
const body = createInstanceElement({
|
|
16
15
|
Component,
|
|
17
16
|
instance,
|
|
18
17
|
children: [
|
|
19
|
-
(0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [children, (0, jsx_runtime_1.jsx)(react_2.ScrollRestoration, {}), (0, jsx_runtime_1.jsx)(react_2.Scripts, {})] }, "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"),
|
|
20
19
|
],
|
|
21
|
-
breakpoints,
|
|
22
20
|
});
|
|
23
21
|
return body;
|
|
24
22
|
};
|
|
25
23
|
exports.createElementsTree = createElementsTree;
|
|
26
|
-
const createInstanceChildrenElements = ({ children,
|
|
24
|
+
const createInstanceChildrenElements = ({ children, Component, onChangeChildren, }) => {
|
|
27
25
|
const elements = [];
|
|
28
26
|
for (const child of children) {
|
|
29
27
|
if (typeof child === "string") {
|
|
@@ -32,13 +30,11 @@ const createInstanceChildrenElements = ({ children, breakpoints, Component, onCh
|
|
|
32
30
|
}
|
|
33
31
|
const children = createInstanceChildrenElements({
|
|
34
32
|
children: child.children,
|
|
35
|
-
breakpoints,
|
|
36
33
|
Component,
|
|
37
34
|
onChangeChildren,
|
|
38
35
|
});
|
|
39
36
|
const element = createInstanceElement({
|
|
40
37
|
instance: child,
|
|
41
|
-
breakpoints,
|
|
42
38
|
Component,
|
|
43
39
|
onChangeChildren,
|
|
44
40
|
children,
|
|
@@ -47,11 +43,10 @@ const createInstanceChildrenElements = ({ children, breakpoints, Component, onCh
|
|
|
47
43
|
}
|
|
48
44
|
return elements;
|
|
49
45
|
};
|
|
50
|
-
const createInstanceElement = ({ Component, instance, children = [],
|
|
46
|
+
const createInstanceElement = ({ Component, instance, children = [], onChangeChildren, }) => {
|
|
51
47
|
const props = {
|
|
52
48
|
instance,
|
|
53
49
|
children,
|
|
54
|
-
css: (0, stitches_1.toCss)(instance.cssRules, breakpoints),
|
|
55
50
|
key: instance.id,
|
|
56
51
|
onChangeChildren,
|
|
57
52
|
};
|
package/lib/tree/root.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import type { Tree, InstanceProps } from "../db";
|
|
2
|
-
import
|
|
3
|
-
import { type WrapperComponentProps } from "./wrapper-component";
|
|
2
|
+
import { WrapperComponent } from "./wrapper-component";
|
|
4
3
|
import type { Asset } from "@webstudio-is/asset-uploader";
|
|
4
|
+
import { type ComponentProps } from "react";
|
|
5
|
+
import type { Breakpoint } from "@webstudio-is/css-data";
|
|
5
6
|
export declare type Data = {
|
|
6
7
|
tree: Tree | null;
|
|
7
8
|
breakpoints: Array<Breakpoint>;
|
|
8
9
|
props: Array<InstanceProps>;
|
|
9
10
|
assets: Array<Asset>;
|
|
10
11
|
};
|
|
11
|
-
export declare const useGlobalStyles: ({ assets }: {
|
|
12
|
-
assets: Array<Asset>;
|
|
13
|
-
}) => void;
|
|
14
12
|
declare type RootProps = {
|
|
15
13
|
data: Data;
|
|
16
|
-
Component?: (props:
|
|
14
|
+
Component?: (props: ComponentProps<typeof WrapperComponent>) => JSX.Element;
|
|
17
15
|
};
|
|
18
16
|
export declare const InstanceRoot: ({ data, Component, }: RootProps) => JSX.Element | null;
|
|
19
17
|
export {};
|
package/lib/tree/root.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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"}
|
package/lib/tree/root.js
CHANGED
|
@@ -1,38 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstanceRoot =
|
|
3
|
+
exports.InstanceRoot = void 0;
|
|
4
4
|
const user_props_1 = require("../user-props/");
|
|
5
|
-
const stitches_1 = require("../stitches");
|
|
6
5
|
const create_elements_tree_1 = require("./create-elements-tree");
|
|
7
6
|
const wrapper_component_1 = require("./wrapper-component");
|
|
8
|
-
const fonts_1 = require("@webstudio-is/fonts");
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const useGlobalStyles = ({ assets }) => {
|
|
11
|
-
const ref = (0, react_1.useRef)();
|
|
12
|
-
// This may look weird, but globalCss API doesn't allow us creating global styles with data,
|
|
13
|
-
// so we have to manually ensure calling it only once
|
|
14
|
-
if (ref.current === assets)
|
|
15
|
-
return;
|
|
16
|
-
const fontAssets = assets.filter((asset) => fonts_1.FONT_FORMATS.has(asset.format));
|
|
17
|
-
(0, stitches_1.globalCss)({
|
|
18
|
-
"@font-face": (0, fonts_1.getFontFaces)(fontAssets),
|
|
19
|
-
html: {
|
|
20
|
-
height: "100%",
|
|
21
|
-
},
|
|
22
|
-
})();
|
|
23
|
-
ref.current = assets;
|
|
24
|
-
};
|
|
25
|
-
exports.useGlobalStyles = useGlobalStyles;
|
|
26
7
|
const InstanceRoot = ({ data, Component, }) => {
|
|
27
8
|
if (data.tree === null) {
|
|
28
9
|
throw new Error("Tree is null");
|
|
29
10
|
}
|
|
30
|
-
(0, stitches_1.setBreakpoints)(data.breakpoints);
|
|
31
|
-
(0, exports.useGlobalStyles)({ assets: data.assets });
|
|
32
11
|
(0, user_props_1.useAllUserProps)(data.props);
|
|
33
12
|
return (0, create_elements_tree_1.createElementsTree)({
|
|
34
13
|
instance: data.tree.root,
|
|
35
|
-
breakpoints: data.breakpoints,
|
|
36
14
|
Component: Component ?? wrapper_component_1.WrapperComponent,
|
|
37
15
|
});
|
|
38
16
|
};
|
|
@@ -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"}
|
|
@@ -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;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Instance } from "../db";
|
|
2
|
-
import { type CSS } from "../stitches";
|
|
3
2
|
import type { OnChangeChildren } from "./create-elements-tree";
|
|
4
3
|
export declare const renderWrapperComponentChildren: (children: Array<JSX.Element | string> | undefined) => Array<JSX.Element | string | Array<JSX.Element | string>> | undefined;
|
|
5
|
-
|
|
4
|
+
declare type WrapperComponentProps = {
|
|
6
5
|
instance: Instance;
|
|
7
|
-
css: CSS;
|
|
8
6
|
children: Array<JSX.Element | string>;
|
|
9
7
|
onChangeChildren?: OnChangeChildren;
|
|
10
8
|
};
|
|
11
|
-
export declare const WrapperComponent: ({ instance,
|
|
9
|
+
export declare const WrapperComponent: ({ instance, onChangeChildren, children, ...rest }: WrapperComponentProps) => JSX.Element;
|
|
10
|
+
export declare const idAttribute = "data-ws-id";
|
|
11
|
+
export {};
|
|
12
12
|
//# sourceMappingURL=wrapper-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper-component.d.ts","sourceRoot":"","sources":["../../src/tree/wrapper-component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,
|
|
1
|
+
{"version":3,"file":"wrapper-component.d.ts","sourceRoot":"","sources":["../../src/tree/wrapper-component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAY/D,eAAO,MAAM,8BAA8B,aAC/B,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,SAAS,KAChD,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,GAAG,SAO9D,CAAC;AAEF,aAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,sDAK1B,qBAAqB,gBAOvB,CAAC;AAEF,eAAO,MAAM,WAAW,eAAe,CAAC"}
|
|
@@ -23,12 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.WrapperComponent = exports.renderWrapperComponentChildren = void 0;
|
|
26
|
+
exports.idAttribute = exports.WrapperComponent = exports.renderWrapperComponentChildren = void 0;
|
|
27
27
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
const react_1 = require("react");
|
|
29
29
|
const components = __importStar(require("../components"));
|
|
30
30
|
const use_user_props_1 = require("../user-props/use-user-props");
|
|
31
|
-
const stitches_1 = require("../stitches");
|
|
32
31
|
const renderText = (text) => {
|
|
33
32
|
const lines = text.split("\n");
|
|
34
33
|
return lines.map((line, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [line, index < lines.length - 1 ? (0, jsx_runtime_1.jsx)("br", {}) : null] }, index)));
|
|
@@ -43,11 +42,12 @@ const renderWrapperComponentChildren = (children) => {
|
|
|
43
42
|
});
|
|
44
43
|
};
|
|
45
44
|
exports.renderWrapperComponentChildren = renderWrapperComponentChildren;
|
|
46
|
-
const WrapperComponent = ({ instance,
|
|
45
|
+
const WrapperComponent = ({ instance, onChangeChildren, // prevent it from passing to sdk component
|
|
47
46
|
children, ...rest }) => {
|
|
48
|
-
const className = (0, react_1.useMemo)(() => (0, stitches_1.css)(css)(), [css]);
|
|
49
47
|
const { Component } = components[instance.component];
|
|
50
48
|
const userProps = (0, use_user_props_1.useUserProps)(instance.id);
|
|
51
|
-
|
|
49
|
+
const props = { ...userProps, ...rest, [exports.idAttribute]: instance.id };
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(Component, { ...props, children: (0, exports.renderWrapperComponentChildren)(children) }));
|
|
52
51
|
};
|
|
53
52
|
exports.WrapperComponent = WrapperComponent;
|
|
53
|
+
exports.idAttribute = "data-ws-id";
|