@webstudio-is/react-sdk 0.6.1 → 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 +2 -2
- package/lib/components/component-type.d.ts.map +1 -1
- package/lib/components/component-type.js +2 -2
- 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 +11 -0
- package/lib/components/image.d.ts.map +1 -0
- package/lib/components/image.js +52 -0
- package/lib/components/image.props.json +2578 -0
- package/lib/components/image.stories.d.ts +14 -0
- package/lib/components/image.stories.d.ts.map +1 -0
- package/lib/components/image.stories.js +17 -0
- package/lib/components/image.ws.d.ts +5 -0
- package/lib/components/image.ws.d.ts.map +1 -0
- package/lib/components/image.ws.js +29 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +9 -1
- package/lib/components/index.test.js +1 -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 +4 -0
- package/lib/components/meta.d.ts.map +1 -1
- package/lib/components/meta.js +9 -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 +5 -5
- 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 +2 -2
- package/lib/db/instance.d.ts.map +1 -1
- package/lib/db/instance.js +5 -5
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -2
- 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 +3 -0
- package/lib/remix/handle-request.server.d.ts.map +1 -0
- package/lib/remix/handle-request.server.js +15 -0
- package/lib/remix/index.d.ts +3 -0
- package/lib/remix/index.d.ts.map +1 -0
- package/lib/{canvas → remix}/index.js +2 -1
- package/lib/{canvas/canvas.d.ts → remix/root.d.ts} +1 -1
- package/lib/remix/root.d.ts.map +1 -0
- package/lib/{canvas/canvas.js → 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 +6 -4
- package/lib/tree/root.d.ts.map +1 -1
- package/lib/tree/root.js +1 -10
- 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/lib/user-props/schema.d.ts +3 -2
- package/lib/user-props/schema.d.ts.map +1 -1
- package/lib/user-props/schema.js +3 -3
- package/lib/user-props/types.d.ts +1 -3
- package/lib/user-props/types.d.ts.map +1 -1
- package/lib/user-props/use-user-props.d.ts +1 -1
- package/lib/user-props/use-user-props.d.ts.map +1 -1
- package/package.json +23 -14
- package/lib/canvas/canvas.d.ts.map +0 -1
- package/lib/canvas/index.d.ts +0 -2
- package/lib/canvas/index.d.ts.map +0 -1
- 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 -7372
- 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 -151
- package/lib/css/schema.d.ts.map +0 -1
- package/lib/css/schema.js +0 -38
- package/lib/css/types.d.ts +0 -15
- 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/stitches/critical-css.d.ts +0 -4
- package/lib/stitches/critical-css.d.ts.map +0 -1
- package/lib/stitches/critical-css.js +0 -12
- package/lib/stitches/css.d.ts +0 -9
- package/lib/stitches/css.d.ts.map +0 -1
- package/lib/stitches/css.js +0 -33
- package/lib/stitches/index.d.ts +0 -4
- package/lib/stitches/index.d.ts.map +0 -1
- package/lib/stitches/index.js +0 -19
- 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 -43
- 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 -63
package/lib/css/schema.d.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const UnitSchema: z.ZodUnion<[z.ZodEnum<["ch", "cm", "deg", "dpcm", "dpi", "dppx", "em", "ex", "fr", "grad", "Hz", "in", "kHz", "mm", "ms", "pc", "pt", "px", "Q", "rad", "rem", "s", "turn", "vh", "vmax", "vmin", "vw", "x", "%"]>, z.ZodLiteral<"number">]>;
|
|
3
|
-
export declare const StyleValueSchema: z.ZodUnion<[z.ZodObject<{
|
|
4
|
-
type: z.ZodLiteral<"unit">;
|
|
5
|
-
unit: z.ZodUnion<[z.ZodEnum<["ch", "cm", "deg", "dpcm", "dpi", "dppx", "em", "ex", "fr", "grad", "Hz", "in", "kHz", "mm", "ms", "pc", "pt", "px", "Q", "rad", "rem", "s", "turn", "vh", "vmax", "vmin", "vw", "x", "%"]>, z.ZodLiteral<"number">]>;
|
|
6
|
-
value: z.ZodNumber;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
9
|
-
value: number;
|
|
10
|
-
type: "unit";
|
|
11
|
-
}, {
|
|
12
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
13
|
-
value: number;
|
|
14
|
-
type: "unit";
|
|
15
|
-
}>, z.ZodObject<{
|
|
16
|
-
type: z.ZodLiteral<"keyword">;
|
|
17
|
-
value: z.ZodString;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
value: string;
|
|
20
|
-
type: "keyword";
|
|
21
|
-
}, {
|
|
22
|
-
value: string;
|
|
23
|
-
type: "keyword";
|
|
24
|
-
}>, z.ZodObject<{
|
|
25
|
-
type: z.ZodLiteral<"invalid">;
|
|
26
|
-
value: z.ZodString;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
value: string;
|
|
29
|
-
type: "invalid";
|
|
30
|
-
}, {
|
|
31
|
-
value: string;
|
|
32
|
-
type: "invalid";
|
|
33
|
-
}>]>;
|
|
34
|
-
export declare const StyleSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
35
|
-
type: z.ZodLiteral<"unit">;
|
|
36
|
-
unit: z.ZodUnion<[z.ZodEnum<["ch", "cm", "deg", "dpcm", "dpi", "dppx", "em", "ex", "fr", "grad", "Hz", "in", "kHz", "mm", "ms", "pc", "pt", "px", "Q", "rad", "rem", "s", "turn", "vh", "vmax", "vmin", "vw", "x", "%"]>, z.ZodLiteral<"number">]>;
|
|
37
|
-
value: z.ZodNumber;
|
|
38
|
-
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
40
|
-
value: number;
|
|
41
|
-
type: "unit";
|
|
42
|
-
}, {
|
|
43
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
44
|
-
value: number;
|
|
45
|
-
type: "unit";
|
|
46
|
-
}>, z.ZodObject<{
|
|
47
|
-
type: z.ZodLiteral<"keyword">;
|
|
48
|
-
value: z.ZodString;
|
|
49
|
-
}, "strip", z.ZodTypeAny, {
|
|
50
|
-
value: string;
|
|
51
|
-
type: "keyword";
|
|
52
|
-
}, {
|
|
53
|
-
value: string;
|
|
54
|
-
type: "keyword";
|
|
55
|
-
}>, z.ZodObject<{
|
|
56
|
-
type: z.ZodLiteral<"invalid">;
|
|
57
|
-
value: z.ZodString;
|
|
58
|
-
}, "strip", z.ZodTypeAny, {
|
|
59
|
-
value: string;
|
|
60
|
-
type: "invalid";
|
|
61
|
-
}, {
|
|
62
|
-
value: string;
|
|
63
|
-
type: "invalid";
|
|
64
|
-
}>]>>;
|
|
65
|
-
export declare const CssRuleSchema: z.ZodObject<{
|
|
66
|
-
style: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
67
|
-
type: z.ZodLiteral<"unit">;
|
|
68
|
-
unit: z.ZodUnion<[z.ZodEnum<["ch", "cm", "deg", "dpcm", "dpi", "dppx", "em", "ex", "fr", "grad", "Hz", "in", "kHz", "mm", "ms", "pc", "pt", "px", "Q", "rad", "rem", "s", "turn", "vh", "vmax", "vmin", "vw", "x", "%"]>, z.ZodLiteral<"number">]>;
|
|
69
|
-
value: z.ZodNumber;
|
|
70
|
-
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
72
|
-
value: number;
|
|
73
|
-
type: "unit";
|
|
74
|
-
}, {
|
|
75
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
76
|
-
value: number;
|
|
77
|
-
type: "unit";
|
|
78
|
-
}>, z.ZodObject<{
|
|
79
|
-
type: z.ZodLiteral<"keyword">;
|
|
80
|
-
value: z.ZodString;
|
|
81
|
-
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
value: string;
|
|
83
|
-
type: "keyword";
|
|
84
|
-
}, {
|
|
85
|
-
value: string;
|
|
86
|
-
type: "keyword";
|
|
87
|
-
}>, z.ZodObject<{
|
|
88
|
-
type: z.ZodLiteral<"invalid">;
|
|
89
|
-
value: z.ZodString;
|
|
90
|
-
}, "strip", z.ZodTypeAny, {
|
|
91
|
-
value: string;
|
|
92
|
-
type: "invalid";
|
|
93
|
-
}, {
|
|
94
|
-
value: string;
|
|
95
|
-
type: "invalid";
|
|
96
|
-
}>]>>;
|
|
97
|
-
breakpoint: z.ZodString;
|
|
98
|
-
}, "strip", z.ZodTypeAny, {
|
|
99
|
-
style: Record<string, {
|
|
100
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
101
|
-
value: number;
|
|
102
|
-
type: "unit";
|
|
103
|
-
} | {
|
|
104
|
-
value: string;
|
|
105
|
-
type: "keyword";
|
|
106
|
-
} | {
|
|
107
|
-
value: string;
|
|
108
|
-
type: "invalid";
|
|
109
|
-
}>;
|
|
110
|
-
breakpoint: string;
|
|
111
|
-
}, {
|
|
112
|
-
style: Record<string, {
|
|
113
|
-
unit: "number" | "px" | "%" | "ch" | "cm" | "deg" | "dpcm" | "dpi" | "dppx" | "em" | "ex" | "fr" | "grad" | "Hz" | "in" | "kHz" | "mm" | "ms" | "pc" | "pt" | "Q" | "rad" | "rem" | "s" | "turn" | "vh" | "vmax" | "vmin" | "vw" | "x";
|
|
114
|
-
value: number;
|
|
115
|
-
type: "unit";
|
|
116
|
-
} | {
|
|
117
|
-
value: string;
|
|
118
|
-
type: "keyword";
|
|
119
|
-
} | {
|
|
120
|
-
value: string;
|
|
121
|
-
type: "invalid";
|
|
122
|
-
}>;
|
|
123
|
-
breakpoint: string;
|
|
124
|
-
}>;
|
|
125
|
-
export declare const BreakpointSchema: z.ZodObject<{
|
|
126
|
-
id: z.ZodString;
|
|
127
|
-
label: z.ZodString;
|
|
128
|
-
minWidth: z.ZodNumber;
|
|
129
|
-
}, "strip", z.ZodTypeAny, {
|
|
130
|
-
id: string;
|
|
131
|
-
label: string;
|
|
132
|
-
minWidth: number;
|
|
133
|
-
}, {
|
|
134
|
-
id: string;
|
|
135
|
-
label: string;
|
|
136
|
-
minWidth: number;
|
|
137
|
-
}>;
|
|
138
|
-
export declare const BreakpointsSchema: z.ZodArray<z.ZodObject<{
|
|
139
|
-
id: z.ZodString;
|
|
140
|
-
label: z.ZodString;
|
|
141
|
-
minWidth: z.ZodNumber;
|
|
142
|
-
}, "strip", z.ZodTypeAny, {
|
|
143
|
-
id: string;
|
|
144
|
-
label: string;
|
|
145
|
-
minWidth: number;
|
|
146
|
-
}, {
|
|
147
|
-
id: string;
|
|
148
|
-
label: string;
|
|
149
|
-
minWidth: number;
|
|
150
|
-
}>, "many">;
|
|
151
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/lib/css/schema.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/css/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,UAAU,8OAAgD,CAAC;AAqBxE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI3B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAyC,CAAC;AAElE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;WAA4B,CAAC"}
|
package/lib/css/schema.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BreakpointsSchema = exports.BreakpointSchema = exports.CssRuleSchema = exports.StyleSchema = exports.StyleValueSchema = exports.UnitSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const units_1 = require("./units");
|
|
6
|
-
exports.UnitSchema = zod_1.z.union([zod_1.z.enum(units_1.units), zod_1.z.literal("number")]);
|
|
7
|
-
const UnitValueSchema = zod_1.z.object({
|
|
8
|
-
type: zod_1.z.literal("unit"),
|
|
9
|
-
unit: exports.UnitSchema,
|
|
10
|
-
value: zod_1.z.number(),
|
|
11
|
-
});
|
|
12
|
-
const KeywordValueSchema = zod_1.z.object({
|
|
13
|
-
type: zod_1.z.literal("keyword"),
|
|
14
|
-
// @todo use exact type
|
|
15
|
-
value: zod_1.z.string(),
|
|
16
|
-
});
|
|
17
|
-
// We want to be able to render the invalid value
|
|
18
|
-
// and show it is invalid visually, without saving it to the db
|
|
19
|
-
const InvalidValueSchema = zod_1.z.object({
|
|
20
|
-
type: zod_1.z.literal("invalid"),
|
|
21
|
-
value: zod_1.z.string(),
|
|
22
|
-
});
|
|
23
|
-
exports.StyleValueSchema = zod_1.z.union([
|
|
24
|
-
UnitValueSchema,
|
|
25
|
-
KeywordValueSchema,
|
|
26
|
-
InvalidValueSchema,
|
|
27
|
-
]);
|
|
28
|
-
exports.StyleSchema = zod_1.z.record(zod_1.z.string(), exports.StyleValueSchema);
|
|
29
|
-
exports.CssRuleSchema = zod_1.z.object({
|
|
30
|
-
style: exports.StyleSchema,
|
|
31
|
-
breakpoint: zod_1.z.string(),
|
|
32
|
-
});
|
|
33
|
-
exports.BreakpointSchema = zod_1.z.object({
|
|
34
|
-
id: zod_1.z.string(),
|
|
35
|
-
label: zod_1.z.string(),
|
|
36
|
-
minWidth: zod_1.z.number(),
|
|
37
|
-
});
|
|
38
|
-
exports.BreakpointsSchema = zod_1.z.array(exports.BreakpointSchema);
|
package/lib/css/types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { properties } from "./properties";
|
|
3
|
-
import { BreakpointSchema, CssRuleSchema, StyleValueSchema, UnitSchema } from "./schema";
|
|
4
|
-
declare type Properties = typeof properties;
|
|
5
|
-
export declare type StyleProperty = keyof Properties;
|
|
6
|
-
export declare type AppliesTo = Properties[StyleProperty]["appliesTo"];
|
|
7
|
-
export declare type Style = {
|
|
8
|
-
[property in StyleProperty]?: StyleValue;
|
|
9
|
-
};
|
|
10
|
-
export declare type CssRule = z.infer<typeof CssRuleSchema>;
|
|
11
|
-
export declare type Unit = z.infer<typeof UnitSchema>;
|
|
12
|
-
export declare type StyleValue = z.infer<typeof StyleValueSchema>;
|
|
13
|
-
export declare type Breakpoint = z.infer<typeof BreakpointSchema>;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=types.d.ts.map
|
package/lib/css/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/css/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,aAAK,UAAU,GAAG,OAAO,UAAU,CAAC;AAEpC,oBAAY,aAAa,GAAG,MAAM,UAAU,CAAC;AAE7C,oBAAY,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC;AAE/D,oBAAY,KAAK,GAAG;KACjB,QAAQ,IAAI,aAAa,CAAC,CAAC,EAAE,UAAU;CACzC,CAAC;AAEF,oBAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,oBAAY,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,oBAAY,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,oBAAY,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/lib/css/types.js
DELETED
package/lib/css/units.d.ts
DELETED
package/lib/css/units.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/css/units.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,KAAK,sMA8BR,CAAC"}
|
package/lib/css/units.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.units = void 0;
|
|
4
|
-
// This file was generated by yarn mdn-data
|
|
5
|
-
exports.units = [
|
|
6
|
-
"ch",
|
|
7
|
-
"cm",
|
|
8
|
-
"deg",
|
|
9
|
-
"dpcm",
|
|
10
|
-
"dpi",
|
|
11
|
-
"dppx",
|
|
12
|
-
"em",
|
|
13
|
-
"ex",
|
|
14
|
-
"fr",
|
|
15
|
-
"grad",
|
|
16
|
-
"Hz",
|
|
17
|
-
"in",
|
|
18
|
-
"kHz",
|
|
19
|
-
"mm",
|
|
20
|
-
"ms",
|
|
21
|
-
"pc",
|
|
22
|
-
"pt",
|
|
23
|
-
"px",
|
|
24
|
-
"Q",
|
|
25
|
-
"rad",
|
|
26
|
-
"rem",
|
|
27
|
-
"s",
|
|
28
|
-
"turn",
|
|
29
|
-
"vh",
|
|
30
|
-
"vmax",
|
|
31
|
-
"vmin",
|
|
32
|
-
"vw",
|
|
33
|
-
"x",
|
|
34
|
-
"%"
|
|
35
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"critical-css.d.ts","sourceRoot":"","sources":["../../src/stitches/critical-css.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAIxD,eAAO,MAAM,WAAW,QAAO,WAAW,GAAG,IACsB,CAAC;AAEpE,eAAO,MAAM,iBAAiB,WACpB,MAAM,eACF,wBAAwB,KACnC,MAEF,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insertCriticalCss = exports.CriticalCss = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const css_1 = require("./css");
|
|
6
|
-
const criticalCssMarker = "__critical-css__";
|
|
7
|
-
const CriticalCss = () => typeof document === "undefined" ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: criticalCssMarker }) : null;
|
|
8
|
-
exports.CriticalCss = CriticalCss;
|
|
9
|
-
const insertCriticalCss = (markup, getCssText = css_1.getCssText) => {
|
|
10
|
-
return markup.replace(criticalCssMarker, `<style>${getCssText()}</style>`);
|
|
11
|
-
};
|
|
12
|
-
exports.insertCriticalCss = insertCriticalCss;
|
package/lib/stitches/css.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { globalCss, type CSS, css as createCss } from "@stitches/core";
|
|
2
|
-
import type { Breakpoint } from "../css";
|
|
3
|
-
export declare const getCachedConfig: () => any;
|
|
4
|
-
export declare const css: typeof createCss;
|
|
5
|
-
export { globalCss };
|
|
6
|
-
export { type CSS };
|
|
7
|
-
export declare const getCssText: () => string;
|
|
8
|
-
export declare const setBreakpoints: (breakpoints: Array<Breakpoint>) => void;
|
|
9
|
-
//# sourceMappingURL=css.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/stitches/css.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,KAAK,GAAG,EACR,GAAG,IAAI,SAAS,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQzC,eAAO,MAAM,eAAe,WAK3B,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,OAAO,SAExB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,KAAK,GAAG,EAAE,CAAC;AAEpB,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAC;AAEF,eAAO,MAAM,cAAc,gBAAiB,MAAM,UAAU,CAAC,SAO5D,CAAC"}
|
package/lib/stitches/css.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setBreakpoints = exports.getCssText = exports.globalCss = exports.css = exports.getCachedConfig = void 0;
|
|
4
|
-
const core_1 = require("@stitches/core");
|
|
5
|
-
Object.defineProperty(exports, "globalCss", { enumerable: true, get: function () { return core_1.globalCss; } });
|
|
6
|
-
let media = {};
|
|
7
|
-
// @todo needs fixing
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
let stitches;
|
|
10
|
-
const getCachedConfig = () => {
|
|
11
|
-
if (stitches === undefined) {
|
|
12
|
-
stitches = (0, core_1.createStitches)({ media });
|
|
13
|
-
}
|
|
14
|
-
return stitches;
|
|
15
|
-
};
|
|
16
|
-
exports.getCachedConfig = getCachedConfig;
|
|
17
|
-
const css = (...args) => {
|
|
18
|
-
return (0, exports.getCachedConfig)().css(...args);
|
|
19
|
-
};
|
|
20
|
-
exports.css = css;
|
|
21
|
-
const getCssText = () => {
|
|
22
|
-
return (0, exports.getCachedConfig)().getCssText();
|
|
23
|
-
};
|
|
24
|
-
exports.getCssText = getCssText;
|
|
25
|
-
const setBreakpoints = (breakpoints) => {
|
|
26
|
-
const nextMedia = {};
|
|
27
|
-
for (const breakpoint of breakpoints) {
|
|
28
|
-
nextMedia[breakpoint.id] = `(min-width: ${breakpoint.minWidth}px)`;
|
|
29
|
-
}
|
|
30
|
-
media = nextMedia;
|
|
31
|
-
stitches = undefined;
|
|
32
|
-
};
|
|
33
|
-
exports.setBreakpoints = setBreakpoints;
|
package/lib/stitches/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stitches/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC"}
|
package/lib/stitches/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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);
|
package/lib/stitches/to-css.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/lib/stitches/to-css.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
// If a rule references a breakpoint that was not found in breakpoints,
|
|
22
|
-
// we must have removed the breakpoint and now we fall back to 0.
|
|
23
|
-
const maxWidthA = breakpointsMap[ruleA.breakpoint] ?? 0;
|
|
24
|
-
const maxWidthB = breakpointsMap[ruleB.breakpoint] ?? 0;
|
|
25
|
-
return maxWidthA - maxWidthB;
|
|
26
|
-
});
|
|
27
|
-
for (const cssRule of sortedCssRules) {
|
|
28
|
-
const style = {};
|
|
29
|
-
for (const property in cssRule.style) {
|
|
30
|
-
const value = cssRule.style[property];
|
|
31
|
-
if (value === undefined)
|
|
32
|
-
continue;
|
|
33
|
-
style[property] = (0, exports.toValue)(value);
|
|
34
|
-
}
|
|
35
|
-
if (cssRule.breakpoint in breakpointsMap) {
|
|
36
|
-
css["@" + cssRule.breakpoint] = style;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
Object.assign(css, style);
|
|
40
|
-
}
|
|
41
|
-
return css;
|
|
42
|
-
};
|
|
43
|
-
exports.toCss = toCss;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-css.test.d.ts","sourceRoot":"","sources":["../../src/stitches/to-css.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
});
|