@webstudio-is/react-sdk 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/lib/arg-types/utils.d.ts +6 -0
- package/lib/arg-types/utils.d.ts.map +1 -0
- package/lib/arg-types/utils.js +80 -0
- package/lib/components/bold.d.ts +3 -0
- package/lib/components/bold.d.ts.map +1 -0
- package/lib/components/bold.js +8 -0
- package/lib/components/bold.props.json +2204 -0
- package/lib/components/bold.stories.d.ts +6 -0
- package/lib/components/bold.stories.d.ts.map +1 -0
- package/lib/components/bold.stories.js +19 -0
- package/lib/components/box.d.ts +3 -0
- package/lib/components/box.d.ts.map +1 -0
- package/lib/components/box.js +8 -0
- package/lib/components/box.props.json +2204 -0
- package/lib/components/box.stories.d.ts +6 -0
- package/lib/components/box.stories.d.ts.map +1 -0
- package/lib/components/box.stories.js +17 -0
- package/lib/components/button.d.ts +6 -0
- package/lib/components/button.d.ts.map +1 -0
- package/lib/components/button.js +11 -0
- package/lib/components/button.props.json +2461 -0
- package/lib/components/button.stories.d.ts +6 -0
- package/lib/components/button.stories.d.ts.map +1 -0
- package/lib/components/button.stories.js +19 -0
- package/lib/components/form.d.ts +3 -0
- package/lib/components/form.d.ts.map +1 -0
- package/lib/components/form.js +8 -0
- package/lib/components/form.props.json +2380 -0
- package/lib/components/form.stories.d.ts +6 -0
- package/lib/components/form.stories.d.ts.map +1 -0
- package/lib/components/form.stories.js +17 -0
- package/lib/components/heading.d.ts +8 -0
- package/lib/components/heading.d.ts.map +1 -0
- package/lib/components/heading.js +12 -0
- package/lib/components/heading.props.json +2246 -0
- package/lib/components/heading.stories.d.ts +10 -0
- package/lib/components/heading.stories.d.ts.map +1 -0
- package/lib/components/heading.stories.js +19 -0
- package/lib/components/index.d.ts +11 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +26 -0
- package/lib/components/input.d.ts +3 -0
- package/lib/components/input.d.ts.map +1 -0
- package/lib/components/input.js +8 -0
- package/lib/components/input.props.json +2955 -0
- package/lib/components/input.stories.d.ts +6 -0
- package/lib/components/input.stories.d.ts.map +1 -0
- package/lib/components/input.stories.js +17 -0
- package/lib/components/italic.d.ts +3 -0
- package/lib/components/italic.d.ts.map +1 -0
- package/lib/components/italic.js +8 -0
- package/lib/components/italic.props.json +2204 -0
- package/lib/components/italic.stories.d.ts +6 -0
- package/lib/components/italic.stories.d.ts.map +1 -0
- package/lib/components/italic.stories.js +19 -0
- package/lib/components/link.d.ts +8 -0
- package/lib/components/link.d.ts.map +1 -0
- package/lib/components/link.js +8 -0
- package/lib/components/link.props.json +2441 -0
- package/lib/components/link.stories.d.ts +6 -0
- package/lib/components/link.stories.d.ts.map +1 -0
- package/lib/components/link.stories.js +19 -0
- package/lib/components/meta.d.ts +11 -0
- package/lib/components/meta.d.ts.map +1 -0
- package/lib/components/meta.js +26 -0
- package/lib/components/paragraph.d.ts +3 -0
- package/lib/components/paragraph.d.ts.map +1 -0
- package/lib/components/paragraph.js +8 -0
- package/lib/components/paragraph.props.json +2204 -0
- package/lib/components/paragraph.stories.d.ts +6 -0
- package/lib/components/paragraph.stories.d.ts.map +1 -0
- package/lib/components/paragraph.stories.js +19 -0
- package/lib/components/text-block.d.ts +3 -0
- package/lib/components/text-block.d.ts.map +1 -0
- package/lib/components/text-block.js +8 -0
- package/lib/components/text-block.props.json +2204 -0
- package/lib/components/text-block.stories.d.ts +6 -0
- package/lib/components/text-block.stories.d.ts.map +1 -0
- package/lib/components/text-block.stories.js +19 -0
- package/lib/css/breakpoints.d.ts +4 -0
- package/lib/css/breakpoints.d.ts.map +1 -0
- package/lib/css/breakpoints.js +9 -0
- package/lib/css/categories.d.ts +408 -0
- package/lib/css/categories.d.ts.map +1 -0
- package/lib/css/categories.js +229 -0
- package/lib/css/get-browser-style.d.ts +3 -0
- package/lib/css/get-browser-style.d.ts.map +1 -0
- package/lib/css/get-browser-style.js +43 -0
- package/lib/css/index.d.ts +9 -0
- package/lib/css/index.d.ts.map +1 -0
- package/lib/css/index.js +24 -0
- package/lib/css/keyword-values.d.ts +302 -0
- package/lib/css/keyword-values.d.ts.map +1 -0
- package/lib/css/keyword-values.js +6619 -0
- package/lib/css/properties.d.ts +3197 -0
- package/lib/css/properties.d.ts.map +1 -0
- package/lib/css/properties.js +3200 -0
- package/lib/css/schema.d.ts +151 -0
- package/lib/css/schema.d.ts.map +1 -0
- package/lib/css/schema.js +38 -0
- package/lib/css/types.d.ts +15 -0
- package/lib/css/types.d.ts.map +1 -0
- package/lib/css/types.js +2 -0
- package/lib/css/units.d.ts +2 -0
- package/lib/css/units.d.ts.map +1 -0
- package/lib/css/units.js +35 -0
- package/lib/db/index.d.ts +3 -0
- package/lib/db/index.d.ts.map +1 -0
- package/lib/db/index.js +18 -0
- package/lib/db/instance.d.ts +11 -0
- package/lib/db/instance.d.ts.map +1 -0
- package/lib/db/instance.js +13 -0
- package/lib/db/types.d.ts +12 -0
- package/lib/db/types.d.ts.map +1 -0
- package/lib/db/types.js +2 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +37 -0
- package/lib/prisma.server.d.ts +3 -0
- package/lib/prisma.server.d.ts.map +1 -0
- package/lib/prisma.server.js +8 -0
- package/lib/pubsub/index.d.ts +3 -0
- package/lib/pubsub/index.d.ts.map +1 -0
- package/lib/pubsub/index.js +18 -0
- package/lib/pubsub/publish.d.ts +17 -0
- package/lib/pubsub/publish.d.ts.map +1 -0
- package/lib/pubsub/publish.js +27 -0
- package/lib/pubsub/subscribe.d.ts +8 -0
- package/lib/pubsub/subscribe.d.ts.map +1 -0
- package/lib/pubsub/subscribe.js +31 -0
- package/lib/stitches/critical-css.d.ts +4 -0
- package/lib/stitches/critical-css.d.ts.map +1 -0
- package/lib/stitches/critical-css.js +12 -0
- package/lib/stitches/css.d.ts +9 -0
- package/lib/stitches/css.d.ts.map +1 -0
- package/lib/stitches/css.js +32 -0
- package/lib/stitches/index.d.ts +4 -0
- package/lib/stitches/index.d.ts.map +1 -0
- package/lib/stitches/index.js +19 -0
- package/lib/stitches/to-css.d.ts +8 -0
- package/lib/stitches/to-css.d.ts.map +1 -0
- package/lib/stitches/to-css.js +44 -0
- package/lib/stitches/to-css.test.d.ts +2 -0
- package/lib/stitches/to-css.test.d.ts.map +1 -0
- package/lib/stitches/to-css.test.js +63 -0
- package/lib/tree/create-elements-tree.d.ts +23 -0
- package/lib/tree/create-elements-tree.d.ts.map +1 -0
- package/lib/tree/create-elements-tree.js +28 -0
- package/lib/tree/index.d.ts +4 -0
- package/lib/tree/index.d.ts.map +1 -0
- package/lib/tree/index.js +19 -0
- package/lib/tree/root.d.ts +16 -0
- package/lib/tree/root.d.ts.map +1 -0
- package/lib/tree/root.js +26 -0
- package/lib/tree/wrapper-component.d.ts +12 -0
- package/lib/tree/wrapper-component.d.ts.map +1 -0
- package/lib/tree/wrapper-component.js +53 -0
- package/lib/user-props/all-user-props.d.ts +8 -0
- package/lib/user-props/all-user-props.d.ts.map +1 -0
- package/lib/user-props/all-user-props.js +20 -0
- package/lib/user-props/index.d.ts +5 -0
- package/lib/user-props/index.d.ts.map +1 -0
- package/lib/user-props/index.js +20 -0
- package/lib/user-props/schema.d.ts +34 -0
- package/lib/user-props/schema.d.ts.map +1 -0
- package/lib/user-props/schema.js +11 -0
- package/lib/user-props/types.d.ts +15 -0
- package/lib/user-props/types.d.ts.map +1 -0
- package/lib/user-props/types.js +2 -0
- package/lib/user-props/use-user-props.d.ts +12 -0
- package/lib/user-props/use-user-props.d.ts.map +1 -0
- package/lib/user-props/use-user-props.js +33 -0
- package/package.json +78 -0
- package/prisma/schema.prisma +71 -0
|
@@ -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("./to-css"), exports);
|
|
18
|
+
__exportStar(require("./css"), exports);
|
|
19
|
+
__exportStar(require("./critical-css"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CSS } from "./css";
|
|
2
|
+
import type { StyleValue, CssRule, Breakpoint } from "../css";
|
|
3
|
+
export declare const toValue: (value: StyleValue) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Convert instance cssRules to a stitches CSS object.
|
|
6
|
+
*/
|
|
7
|
+
export declare const toCss: (cssRules: Array<CssRule>, breakpoints: Array<Breakpoint>) => CSS;
|
|
8
|
+
//# sourceMappingURL=to-css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-css.d.ts","sourceRoot":"","sources":["../../src/stitches/to-css.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAiB,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE7E,eAAO,MAAM,OAAO,UAAW,UAAU,KAAG,MAK3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,aACN,MAAM,OAAO,CAAC,eACX,MAAM,UAAU,CAAC,KAC7B,GAgCF,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCss = exports.toValue = void 0;
|
|
4
|
+
const toValue = (value) => {
|
|
5
|
+
if (value.type === "unit") {
|
|
6
|
+
return value.value + (value.unit === "number" ? "" : value.unit);
|
|
7
|
+
}
|
|
8
|
+
return value.value;
|
|
9
|
+
};
|
|
10
|
+
exports.toValue = toValue;
|
|
11
|
+
/**
|
|
12
|
+
* Convert instance cssRules to a stitches CSS object.
|
|
13
|
+
*/
|
|
14
|
+
const toCss = (cssRules, breakpoints) => {
|
|
15
|
+
const css = {};
|
|
16
|
+
const breakpointsMap = {};
|
|
17
|
+
for (const breakpoint of breakpoints) {
|
|
18
|
+
breakpointsMap[breakpoint.id] = breakpoint.minWidth;
|
|
19
|
+
}
|
|
20
|
+
const sortedCssRules = [...cssRules].sort((ruleA, ruleB) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
// If a rule references a breakpoint that was not found in breakpoints,
|
|
23
|
+
// we must have removed the breakpoint and now we fall back to 0.
|
|
24
|
+
const maxWidthA = (_a = breakpointsMap[ruleA.breakpoint]) !== null && _a !== void 0 ? _a : 0;
|
|
25
|
+
const maxWidthB = (_b = breakpointsMap[ruleB.breakpoint]) !== null && _b !== void 0 ? _b : 0;
|
|
26
|
+
return maxWidthA - maxWidthB;
|
|
27
|
+
});
|
|
28
|
+
for (const cssRule of sortedCssRules) {
|
|
29
|
+
const style = {};
|
|
30
|
+
for (const property in cssRule.style) {
|
|
31
|
+
const value = cssRule.style[property];
|
|
32
|
+
if (value === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
style[property] = (0, exports.toValue)(value);
|
|
35
|
+
}
|
|
36
|
+
if (cssRule.breakpoint in breakpointsMap) {
|
|
37
|
+
css["@" + cssRule.breakpoint] = style;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
Object.assign(css, style);
|
|
41
|
+
}
|
|
42
|
+
return css;
|
|
43
|
+
};
|
|
44
|
+
exports.toCss = toCss;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-css.test.d.ts","sourceRoot":"","sources":["../../src/stitches/to-css.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const css_1 = require("../css");
|
|
4
|
+
const to_css_1 = require("./to-css");
|
|
5
|
+
const breakpoints = css_1.initialBreakpoints.map((breakpoint, index) => ({
|
|
6
|
+
...breakpoint,
|
|
7
|
+
id: String(index),
|
|
8
|
+
projectId: "projectId",
|
|
9
|
+
}));
|
|
10
|
+
describe("Convert WS CSS rules to stitches", () => {
|
|
11
|
+
test("basic", () => {
|
|
12
|
+
const cssRules = [
|
|
13
|
+
{
|
|
14
|
+
style: {
|
|
15
|
+
color: {
|
|
16
|
+
type: "keyword",
|
|
17
|
+
value: "red",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
breakpoint: "0",
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
const stitchesCss = (0, to_css_1.toCss)(cssRules, breakpoints);
|
|
24
|
+
expect(stitchesCss).toEqual({
|
|
25
|
+
"@0": {
|
|
26
|
+
color: "red",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
test("sort order based on maxWidth in breakpoints", () => {
|
|
31
|
+
const cssRules = [
|
|
32
|
+
{
|
|
33
|
+
style: {
|
|
34
|
+
color: {
|
|
35
|
+
type: "keyword",
|
|
36
|
+
value: "green",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
breakpoint: "2",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
style: {
|
|
43
|
+
color: {
|
|
44
|
+
type: "keyword",
|
|
45
|
+
value: "blue",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
breakpoint: "0",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
style: {
|
|
52
|
+
color: {
|
|
53
|
+
type: "keyword",
|
|
54
|
+
value: "red",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
breakpoint: "1",
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
const stitchesCss = (0, to_css_1.toCss)(cssRules, breakpoints);
|
|
61
|
+
expect(Object.keys(stitchesCss)).toStrictEqual(["@0", "@1", "@2"]);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Instance } from "../db";
|
|
2
|
+
import type { Breakpoint } from "../css";
|
|
3
|
+
import { type WrapperComponentProps } from "./wrapper-component";
|
|
4
|
+
export declare type ChildrenUpdates = Array<string | {
|
|
5
|
+
id: Instance["id"];
|
|
6
|
+
text: string;
|
|
7
|
+
} | {
|
|
8
|
+
id: Instance["id"];
|
|
9
|
+
text: string;
|
|
10
|
+
component: Instance["component"];
|
|
11
|
+
createInstance: true;
|
|
12
|
+
}>;
|
|
13
|
+
export declare type OnChangeChildren = (change: {
|
|
14
|
+
instanceId: Instance["id"];
|
|
15
|
+
updates: ChildrenUpdates;
|
|
16
|
+
}) => void;
|
|
17
|
+
export declare const createElementsTree: ({ instance, breakpoints, Component, onChangeChildren, }: {
|
|
18
|
+
instance: Instance;
|
|
19
|
+
breakpoints: Array<Breakpoint>;
|
|
20
|
+
Component: (props: WrapperComponentProps) => JSX.Element;
|
|
21
|
+
onChangeChildren?: OnChangeChildren | undefined;
|
|
22
|
+
}) => JSX.Element;
|
|
23
|
+
//# 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":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,oBAAY,eAAe,GAAG,KAAK,CAC/B,MAAM,GAEN;IAAE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAEpC;IACE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,cAAc,EAAE,IAAI,CAAC;CACtB,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;cAMnB,QAAQ;iBACL,MAAM,UAAU,CAAC;uBACX,qBAAqB,KAAK,WAAW;;MAEtD,WAwBH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 stitches_1 = require("../stitches");
|
|
6
|
+
const createElementsTree = ({ instance, breakpoints, Component, onChangeChildren, }) => {
|
|
7
|
+
const children = [];
|
|
8
|
+
for (const child of instance.children) {
|
|
9
|
+
const element = typeof child === "string"
|
|
10
|
+
? child
|
|
11
|
+
: (0, exports.createElementsTree)({
|
|
12
|
+
instance: child,
|
|
13
|
+
breakpoints,
|
|
14
|
+
Component,
|
|
15
|
+
onChangeChildren,
|
|
16
|
+
});
|
|
17
|
+
children.push(element);
|
|
18
|
+
}
|
|
19
|
+
const props = {
|
|
20
|
+
instance,
|
|
21
|
+
children,
|
|
22
|
+
css: (0, stitches_1.toCss)(instance.cssRules, breakpoints),
|
|
23
|
+
key: instance.id,
|
|
24
|
+
onChangeChildren,
|
|
25
|
+
};
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(Component, { ...props });
|
|
27
|
+
};
|
|
28
|
+
exports.createElementsTree = createElementsTree;
|
|
@@ -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,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,16 @@
|
|
|
1
|
+
import type { Tree, InstanceProps } from "../db";
|
|
2
|
+
import type { Breakpoint } from "../css";
|
|
3
|
+
import { type WrapperComponentProps } from "./wrapper-component";
|
|
4
|
+
export declare type Data = {
|
|
5
|
+
tree: Tree | null;
|
|
6
|
+
breakpoints: Array<Breakpoint>;
|
|
7
|
+
props: Array<InstanceProps>;
|
|
8
|
+
};
|
|
9
|
+
export declare const globalStyles: () => string;
|
|
10
|
+
declare type RootProps = {
|
|
11
|
+
data: Data;
|
|
12
|
+
Component?: (props: WrapperComponentProps) => JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export declare const Root: ({ data, Component }: RootProps) => JSX.Element | null;
|
|
15
|
+
export {};
|
|
16
|
+
//# 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;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAE7B,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;CAC7B,CAAC;AAEF,eAAO,MAAM,YAAY,cAIvB,CAAC;AAEH,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,GAAG,CAAC,OAAO,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,IAAI,wBAAyB,SAAS,KAAG,WAAW,GAAG,IAYnE,CAAC"}
|
package/lib/tree/root.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Root = exports.globalStyles = void 0;
|
|
4
|
+
const user_props_1 = require("../user-props/");
|
|
5
|
+
const stitches_1 = require("../stitches");
|
|
6
|
+
const create_elements_tree_1 = require("./create-elements-tree");
|
|
7
|
+
const wrapper_component_1 = require("./wrapper-component");
|
|
8
|
+
exports.globalStyles = (0, stitches_1.globalCss)({
|
|
9
|
+
body: {
|
|
10
|
+
margin: 0,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
const Root = ({ data, Component }) => {
|
|
14
|
+
if (data.tree === null) {
|
|
15
|
+
throw new Error("Tree is null");
|
|
16
|
+
}
|
|
17
|
+
(0, stitches_1.setBreakpoints)(data.breakpoints);
|
|
18
|
+
(0, exports.globalStyles)();
|
|
19
|
+
(0, user_props_1.useAllUserProps)(data.props);
|
|
20
|
+
return (0, create_elements_tree_1.createElementsTree)({
|
|
21
|
+
instance: data.tree.root,
|
|
22
|
+
breakpoints: data.breakpoints,
|
|
23
|
+
Component: Component !== null && Component !== void 0 ? Component : wrapper_component_1.WrapperComponent,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.Root = Root;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Instance } from "../db";
|
|
2
|
+
import { type CSS } from "../stitches";
|
|
3
|
+
import type { OnChangeChildren } from "./create-elements-tree";
|
|
4
|
+
export declare const renderWrapperComponentChildren: (children: Array<JSX.Element | string> | undefined) => Array<JSX.Element | string | Array<JSX.Element | string>> | undefined;
|
|
5
|
+
export declare type WrapperComponentProps = {
|
|
6
|
+
instance: Instance;
|
|
7
|
+
css: CSS;
|
|
8
|
+
children: Array<JSX.Element | string>;
|
|
9
|
+
onChangeChildren?: OnChangeChildren;
|
|
10
|
+
};
|
|
11
|
+
export declare const WrapperComponent: ({ instance, css, onChangeChildren, children, ...rest }: WrapperComponentProps) => JSX.Element;
|
|
12
|
+
//# sourceMappingURL=wrapper-component.d.ts.map
|
|
@@ -0,0 +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,EAAE,KAAK,GAAG,EAAoB,MAAM,aAAa,CAAC;AACzD,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,oBAAY,qBAAqB,GAAG;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,GAAG,EAAE,GAAG,CAAC;IACT,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,gBAAgB,2DAM1B,qBAAqB,gBASvB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.WrapperComponent = exports.renderWrapperComponentChildren = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const react_1 = require("react");
|
|
29
|
+
const components = __importStar(require("../components"));
|
|
30
|
+
const use_user_props_1 = require("../user-props/use-user-props");
|
|
31
|
+
const stitches_1 = require("../stitches");
|
|
32
|
+
const renderText = (text) => {
|
|
33
|
+
const lines = text.split("\n");
|
|
34
|
+
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)));
|
|
35
|
+
};
|
|
36
|
+
const renderWrapperComponentChildren = (children) => {
|
|
37
|
+
// Some elements like input can't have children
|
|
38
|
+
// @todo needs to be made impossible to drag element into input
|
|
39
|
+
if (children === undefined || children.length === 0)
|
|
40
|
+
return;
|
|
41
|
+
return children.map((child) => {
|
|
42
|
+
return typeof child === "string" ? renderText(child) : child;
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
exports.renderWrapperComponentChildren = renderWrapperComponentChildren;
|
|
46
|
+
const WrapperComponent = ({ instance, css, onChangeChildren, // prevent it from passing to primitives
|
|
47
|
+
children, ...rest }) => {
|
|
48
|
+
const className = (0, react_1.useMemo)(() => (0, stitches_1.css)(css)(), [css]);
|
|
49
|
+
const Component = components[instance.component];
|
|
50
|
+
const userProps = (0, use_user_props_1.useUserProps)(instance.id);
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(Component, { ...userProps, ...rest, id: instance.id, className: className, children: (0, exports.renderWrapperComponentChildren)(children) }));
|
|
52
|
+
};
|
|
53
|
+
exports.WrapperComponent = WrapperComponent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react-nano-state" />
|
|
2
|
+
import type { InstanceProps, Instance } from "../db";
|
|
3
|
+
export declare type AllUserProps = {
|
|
4
|
+
[id: Instance["id"]]: InstanceProps;
|
|
5
|
+
};
|
|
6
|
+
export declare const allUserPropsContainer: import("react-nano-state").ValueContainer<AllUserProps>;
|
|
7
|
+
export declare const useAllUserProps: (initialUserProps?: Array<InstanceProps>) => [AllUserProps, import("react-nano-state").Dispatch<AllUserProps>];
|
|
8
|
+
//# sourceMappingURL=all-user-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-user-props.d.ts","sourceRoot":"","sources":["../../src/user-props/all-user-props.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,oBAAY,YAAY,GAAG;IAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,aAAa,CAAA;CAAE,CAAC;AAEnE,eAAO,MAAM,qBAAqB,yDAAyC,CAAC;AAE5E,eAAO,MAAM,eAAe,sBAAuB,MAAM,aAAa,CAAC,sEAWtE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAllUserProps = exports.allUserPropsContainer = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_nano_state_1 = require("react-nano-state");
|
|
6
|
+
exports.allUserPropsContainer = (0, react_nano_state_1.createValueContainer)({});
|
|
7
|
+
const useAllUserProps = (initialUserProps) => {
|
|
8
|
+
(0, react_1.useMemo)(() => {
|
|
9
|
+
if (initialUserProps === undefined)
|
|
10
|
+
return;
|
|
11
|
+
const propsMap = {};
|
|
12
|
+
for (const props of initialUserProps) {
|
|
13
|
+
propsMap[props.instanceId] = props;
|
|
14
|
+
}
|
|
15
|
+
//We don't need to trigger rerender when setting the initial value
|
|
16
|
+
exports.allUserPropsContainer.value = propsMap;
|
|
17
|
+
}, []);
|
|
18
|
+
return (0, react_nano_state_1.useValue)(exports.allUserPropsContainer);
|
|
19
|
+
};
|
|
20
|
+
exports.useAllUserProps = useAllUserProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/user-props/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./all-user-props"), exports);
|
|
18
|
+
__exportStar(require("./use-user-props"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./schema"), exports);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const UserPropSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
prop: z.ZodString;
|
|
5
|
+
value: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
6
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
required?: boolean | undefined;
|
|
9
|
+
value: string | boolean;
|
|
10
|
+
id: string;
|
|
11
|
+
prop: string;
|
|
12
|
+
}, {
|
|
13
|
+
required?: boolean | undefined;
|
|
14
|
+
value: string | boolean;
|
|
15
|
+
id: string;
|
|
16
|
+
prop: string;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const UserPropsSchema: z.ZodArray<z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
prop: z.ZodString;
|
|
21
|
+
value: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
22
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
required?: boolean | undefined;
|
|
25
|
+
value: string | boolean;
|
|
26
|
+
id: string;
|
|
27
|
+
prop: string;
|
|
28
|
+
}, {
|
|
29
|
+
required?: boolean | undefined;
|
|
30
|
+
value: string | boolean;
|
|
31
|
+
id: string;
|
|
32
|
+
prop: string;
|
|
33
|
+
}>, "many">;
|
|
34
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/user-props/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKzB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;WAA0B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserPropsSchema = exports.UserPropSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.UserPropSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string(),
|
|
7
|
+
prop: zod_1.z.string(),
|
|
8
|
+
value: zod_1.z.union([zod_1.z.string(), zod_1.z.boolean()]),
|
|
9
|
+
required: zod_1.z.optional(zod_1.z.boolean()),
|
|
10
|
+
});
|
|
11
|
+
exports.UserPropsSchema = zod_1.z.array(exports.UserPropSchema);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { InstanceProps, Instance } from "../db";
|
|
3
|
+
import { UserPropSchema } from "./schema";
|
|
4
|
+
export declare type UserProp = z.infer<typeof UserPropSchema>;
|
|
5
|
+
export declare type UserPropsUpdates = {
|
|
6
|
+
treeId: InstanceProps["treeId"];
|
|
7
|
+
propsId: InstanceProps["id"];
|
|
8
|
+
instanceId: Instance["id"];
|
|
9
|
+
updates: Array<UserProp>;
|
|
10
|
+
};
|
|
11
|
+
export declare type DeleteProp = {
|
|
12
|
+
instanceId: Instance["id"];
|
|
13
|
+
propId: UserProp["id"];
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/user-props/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,oBAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,oBAAY,gBAAgB,GAAG;IAC7B,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC1B,CAAC;AAEF,oBAAY,UAAU,GAAG;IACvB,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Instance } from "../db";
|
|
2
|
+
import { type UserProp } from "./types";
|
|
3
|
+
declare type UserProps = {
|
|
4
|
+
[prop: UserProp["prop"]]: UserProp["value"];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* User props mapped in prop:value format,
|
|
8
|
+
* up to date with props panel.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useUserProps: (instanceId: Instance["id"]) => UserProps;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=use-user-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-user-props.d.ts","sourceRoot":"","sources":["../../src/user-props/use-user-props.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,aAAK,SAAS,GAAG;IAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,YAAY,eAAgB,QAAQ,CAAC,IAAI,CAAC,cAuBtD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUserProps = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const all_user_props_1 = require("./all-user-props");
|
|
6
|
+
/**
|
|
7
|
+
* User props mapped in prop:value format,
|
|
8
|
+
* up to date with props panel.
|
|
9
|
+
*/
|
|
10
|
+
const useUserProps = (instanceId) => {
|
|
11
|
+
const [allUserProps, setAllUserProps] = (0, all_user_props_1.useAllUserProps)();
|
|
12
|
+
const propsData = allUserProps[instanceId];
|
|
13
|
+
const initialUserProps = (0, react_1.useMemo)(() => {
|
|
14
|
+
if (propsData === undefined)
|
|
15
|
+
return {};
|
|
16
|
+
return propsData.props.reduce((props, { prop, value }) => {
|
|
17
|
+
props[prop] = value;
|
|
18
|
+
return props;
|
|
19
|
+
}, {});
|
|
20
|
+
}, [propsData]);
|
|
21
|
+
const [props, setProps] = (0, react_1.useState)(initialUserProps);
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
if (propsData == undefined)
|
|
24
|
+
return;
|
|
25
|
+
const nextProps = {};
|
|
26
|
+
for (const prop of propsData.props) {
|
|
27
|
+
nextProps[prop.prop] = prop.value;
|
|
28
|
+
}
|
|
29
|
+
setProps(nextProps);
|
|
30
|
+
}, [propsData]);
|
|
31
|
+
return props;
|
|
32
|
+
};
|
|
33
|
+
exports.useUserProps = useUserProps;
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webstudio-is/react-sdk",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Webstudio JavaScript / TypeScript API",
|
|
5
|
+
"author": "Webstudio <github@webstudio.is>",
|
|
6
|
+
"homepage": "https://webstudio.is",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "tsup src/index.ts --format esm,cjs --watch --out-dir=lib",
|
|
9
|
+
"build": "yarn build:mdn-data && yarn build:args && yarn build:lib",
|
|
10
|
+
"build:mdn-data": "node --experimental-loader esbuild-node-loader ./bin/mdn-data.ts ./src/css",
|
|
11
|
+
"build:args": "node --experimental-loader esbuild-node-loader ./bin/generate-arg-types.ts './src/components/*.tsx !./src/**/*.stories.tsx'",
|
|
12
|
+
"build:prisma": "prisma format && prisma generate",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"build:lib": "rm -fr lib && tsc",
|
|
15
|
+
"postinstall": "prisma generate",
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"checks": "yarn typecheck && yarn test",
|
|
18
|
+
"prepublishOnly": "yarn checks && yarn build:lib",
|
|
19
|
+
"storybook:run": "start-storybook -p 6006",
|
|
20
|
+
"storybook:build": "build-storybook"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@babel/core": "^7.17.12",
|
|
24
|
+
"@remix-run/react": "^1.2.3",
|
|
25
|
+
"@remix-run/server-runtime": "^1.2.3",
|
|
26
|
+
"@storybook/addon-actions": "^6.5.6",
|
|
27
|
+
"@storybook/addon-essentials": "^6.5.6",
|
|
28
|
+
"@storybook/addon-interactions": "^6.5.6",
|
|
29
|
+
"@storybook/addon-links": "^6.5.6",
|
|
30
|
+
"@storybook/builder-webpack4": "^6.5.6",
|
|
31
|
+
"@storybook/manager-webpack4": "^6.5.6",
|
|
32
|
+
"@storybook/react": "^6.5.6",
|
|
33
|
+
"@storybook/testing-library": "^0.0.11",
|
|
34
|
+
"@types/css-tree": "^1.0.7",
|
|
35
|
+
"@types/fs-extra": "^9.0.13",
|
|
36
|
+
"@types/node": "^17.0.21",
|
|
37
|
+
"babel-loader": "^8.2.5",
|
|
38
|
+
"camelcase": "^6.3.0",
|
|
39
|
+
"css-tree": "^2.1.0",
|
|
40
|
+
"esbuild": "^0.14.25",
|
|
41
|
+
"esbuild-node-externals": "^1.4.1",
|
|
42
|
+
"esbuild-node-loader": "^0.8.0",
|
|
43
|
+
"@webstudio-is/jest-config": "*",
|
|
44
|
+
"mdn-data": "2.0.23",
|
|
45
|
+
"react": "^17.0.2",
|
|
46
|
+
"react-docgen-typescript": "^2.2.2",
|
|
47
|
+
"react-dom": "^17.0.2",
|
|
48
|
+
"tsup": "^6.1.3",
|
|
49
|
+
"typescript": "^4.6.2"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@remix-run/react": "^1.2.3",
|
|
53
|
+
"@remix-run/server-runtime": "^1.2.3",
|
|
54
|
+
"@storybook/react": "^6.5.6",
|
|
55
|
+
"react": "^17.0.2",
|
|
56
|
+
"react-dom": "^17.0.2"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@prisma/client": "^3.10.0",
|
|
60
|
+
"@stitches/core": "^1.2.7",
|
|
61
|
+
"immer": "^9.0.12",
|
|
62
|
+
"mitt": "^3.0.0",
|
|
63
|
+
"prisma": "^3.10.0",
|
|
64
|
+
"react-nano-state": "^0.4.0",
|
|
65
|
+
"@webstudio-is/jest-config": "*",
|
|
66
|
+
"zod": "^3.17.3"
|
|
67
|
+
},
|
|
68
|
+
"main": "lib/index.js",
|
|
69
|
+
"types": "lib/index.d.ts",
|
|
70
|
+
"files": [
|
|
71
|
+
"lib/*",
|
|
72
|
+
"README.md",
|
|
73
|
+
"!*.test.*",
|
|
74
|
+
"prisma/*"
|
|
75
|
+
],
|
|
76
|
+
"license": "MIT",
|
|
77
|
+
"private": false
|
|
78
|
+
}
|