@webstudio-is/react-sdk 0.7.0 → 0.7.1
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 +1 -8
- package/lib/arg-types/utils.d.ts.map +1 -1
- package/lib/arg-types/utils.js +18 -7
- 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 +8 -37
- package/lib/components/bold.props.json +8 -37
- package/lib/components/box.props.json +9 -40
- package/lib/components/button.props.json +10 -45
- package/lib/components/component-type.d.ts +1 -1
- package/lib/components/component-type.d.ts.map +1 -1
- package/lib/components/form.props.json +8 -37
- package/lib/components/heading.props.json +10 -48
- 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 +60 -15
- package/lib/components/image.stories.d.ts +10 -2
- package/lib/components/image.stories.d.ts.map +1 -1
- 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.props.json +9 -46
- package/lib/components/italic.props.json +8 -37
- package/lib/components/link.d.ts +1 -1
- package/lib/components/link.props.json +9 -40
- package/lib/components/link.stories.d.ts +2 -2
- package/lib/components/meta.d.ts +3 -0
- package/lib/components/meta.d.ts.map +1 -1
- package/lib/components/meta.js +7 -1
- package/lib/components/paragraph.props.json +8 -37
- 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 +2205 -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 +19 -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 +2205 -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 +19 -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 +2205 -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 +19 -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.props.json +8 -37
- 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 +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- 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 +20 -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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
declare const _default: ComponentMeta<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "key" | keyof import("react").HTMLAttributes<HTMLElement>> & import("react").RefAttributes<HTMLElement>>>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Superscript: ComponentStory<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "key" | keyof import("react").HTMLAttributes<HTMLElement>> & import("react").RefAttributes<HTMLElement>>>;
|
|
6
|
+
//# sourceMappingURL=superscript.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superscript.stories.d.ts","sourceRoot":"","sources":["../../src/components/superscript.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;;AAItE,wBAIgD;AAMhD,eAAO,MAAM,WAAW,sQAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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.Superscript = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const superscript_1 = require("./superscript");
|
|
9
|
+
const superscript_props_json_1 = __importDefault(require("./superscript.props.json"));
|
|
10
|
+
exports.default = {
|
|
11
|
+
title: "Components/Superscript",
|
|
12
|
+
component: superscript_1.Superscript,
|
|
13
|
+
argTypes: superscript_props_json_1.default,
|
|
14
|
+
};
|
|
15
|
+
const Template = (args) => ((0, jsx_runtime_1.jsx)(superscript_1.Superscript, { ...args }));
|
|
16
|
+
exports.Superscript = Template.bind({});
|
|
17
|
+
exports.Superscript.args = {
|
|
18
|
+
children: "some superscript text",
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superscript.ws.d.ts","sourceRoot":"","sources":["../../src/components/superscript.ws.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,QAAA,MAAM,IAAI,EAAE,eAAe,CAAC,OAAO,WAAW,CAQ7C,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const icons_1 = require("@webstudio-is/icons");
|
|
4
|
+
const superscript_1 = require("./superscript");
|
|
5
|
+
const meta = {
|
|
6
|
+
Icon: icons_1.SuperscriptIcon,
|
|
7
|
+
Component: superscript_1.Superscript,
|
|
8
|
+
canAcceptChildren: false,
|
|
9
|
+
isContentEditable: false,
|
|
10
|
+
label: "Superscript Text",
|
|
11
|
+
isInlineOnly: true,
|
|
12
|
+
isListed: false,
|
|
13
|
+
};
|
|
14
|
+
exports.default = meta;
|
|
@@ -447,10 +447,7 @@
|
|
|
447
447
|
"control": {
|
|
448
448
|
"type": "radio"
|
|
449
449
|
},
|
|
450
|
-
"options": [
|
|
451
|
-
"yes",
|
|
452
|
-
"no"
|
|
453
|
-
]
|
|
450
|
+
"options": ["yes", "no"]
|
|
454
451
|
},
|
|
455
452
|
"radioGroup": {
|
|
456
453
|
"defaultValue": null,
|
|
@@ -739,6 +736,7 @@
|
|
|
739
736
|
}
|
|
740
737
|
},
|
|
741
738
|
"color": {
|
|
739
|
+
"defaultValue": null,
|
|
742
740
|
"description": "",
|
|
743
741
|
"name": "color",
|
|
744
742
|
"parent": {
|
|
@@ -943,10 +941,7 @@
|
|
|
943
941
|
"control": {
|
|
944
942
|
"type": "radio"
|
|
945
943
|
},
|
|
946
|
-
"options": [
|
|
947
|
-
"on",
|
|
948
|
-
"off"
|
|
949
|
-
]
|
|
944
|
+
"options": ["on", "off"]
|
|
950
945
|
},
|
|
951
946
|
"inputMode": {
|
|
952
947
|
"defaultValue": null,
|
|
@@ -1109,12 +1104,7 @@
|
|
|
1109
1104
|
"control": {
|
|
1110
1105
|
"type": "radio"
|
|
1111
1106
|
},
|
|
1112
|
-
"options": [
|
|
1113
|
-
"list",
|
|
1114
|
-
"none",
|
|
1115
|
-
"inline",
|
|
1116
|
-
"both"
|
|
1117
|
-
]
|
|
1107
|
+
"options": ["list", "none", "inline", "both"]
|
|
1118
1108
|
},
|
|
1119
1109
|
"aria-busy": {
|
|
1120
1110
|
"defaultValue": null,
|
|
@@ -1378,14 +1368,7 @@
|
|
|
1378
1368
|
"control": {
|
|
1379
1369
|
"type": "select"
|
|
1380
1370
|
},
|
|
1381
|
-
"options": [
|
|
1382
|
-
"link",
|
|
1383
|
-
"none",
|
|
1384
|
-
"copy",
|
|
1385
|
-
"execute",
|
|
1386
|
-
"move",
|
|
1387
|
-
"popup"
|
|
1388
|
-
]
|
|
1371
|
+
"options": ["link", "none", "copy", "execute", "move", "popup"]
|
|
1389
1372
|
},
|
|
1390
1373
|
"aria-errormessage": {
|
|
1391
1374
|
"defaultValue": null,
|
|
@@ -1662,11 +1645,7 @@
|
|
|
1662
1645
|
"control": {
|
|
1663
1646
|
"type": "radio"
|
|
1664
1647
|
},
|
|
1665
|
-
"options": [
|
|
1666
|
-
"off",
|
|
1667
|
-
"assertive",
|
|
1668
|
-
"polite"
|
|
1669
|
-
]
|
|
1648
|
+
"options": ["off", "assertive", "polite"]
|
|
1670
1649
|
},
|
|
1671
1650
|
"aria-modal": {
|
|
1672
1651
|
"defaultValue": null,
|
|
@@ -1764,10 +1743,7 @@
|
|
|
1764
1743
|
"control": {
|
|
1765
1744
|
"type": "radio"
|
|
1766
1745
|
},
|
|
1767
|
-
"options": [
|
|
1768
|
-
"horizontal",
|
|
1769
|
-
"vertical"
|
|
1770
|
-
]
|
|
1746
|
+
"options": ["horizontal", "vertical"]
|
|
1771
1747
|
},
|
|
1772
1748
|
"aria-owns": {
|
|
1773
1749
|
"defaultValue": null,
|
|
@@ -2136,12 +2112,7 @@
|
|
|
2136
2112
|
"control": {
|
|
2137
2113
|
"type": "radio"
|
|
2138
2114
|
},
|
|
2139
|
-
"options": [
|
|
2140
|
-
"none",
|
|
2141
|
-
"ascending",
|
|
2142
|
-
"descending",
|
|
2143
|
-
"other"
|
|
2144
|
-
]
|
|
2115
|
+
"options": ["none", "ascending", "descending", "other"]
|
|
2145
2116
|
},
|
|
2146
2117
|
"aria-valuemax": {
|
|
2147
2118
|
"defaultValue": null,
|
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
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,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.componentsMeta = 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
|
exports.componentsMeta = __importStar(require("./components/meta"));
|
|
35
34
|
__exportStar(require("./user-props"), 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"}
|