@webstudio-is/react-sdk 0.91.0 → 0.93.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/lib/app/index.js +1 -0
- package/lib/app/root.js +2 -4
- package/lib/component-renderer.js +3 -5
- package/lib/components/component-meta.js +6 -11
- package/lib/components/components-utils.js +1 -0
- package/lib/context.js +2 -4
- package/lib/css/css.js +4 -9
- package/lib/css/global-rules.js +3 -5
- package/lib/css/index.js +1 -0
- package/lib/css/normalize-type-check.js +1 -0
- package/lib/css/normalize.js +48 -96
- package/lib/css/presets.js +3 -6
- package/lib/css/style-rules.js +3 -6
- package/{src/css/style-rules.test.ts → lib/css/style-rules.test.js} +23 -28
- package/lib/embed-template.js +7 -22
- package/{src/embed-template.test.ts → lib/embed-template.test.js} +165 -176
- package/lib/expression.js +11 -22
- package/{src/expression.test.ts → lib/expression.test.js} +55 -83
- package/lib/generator.js +2 -4
- package/{src/generator.test.ts → lib/generator.test.js} +28 -31
- package/lib/hook.js +2 -4
- package/{src/hook.test.ts → lib/hook.test.js} +4 -4
- package/lib/index.js +9 -31
- package/lib/instance-utils.js +2 -4
- package/{src/instance-utils.test.ts → lib/instance-utils.test.js} +19 -43
- package/lib/prop-meta.js +150 -0
- package/lib/props.js +8 -16
- package/{src/props.test.ts → lib/props.test.js} +39 -68
- package/lib/pubsub/create.js +2 -4
- package/lib/pubsub/index.js +1 -0
- package/lib/pubsub/raf-queue.js +2 -4
- package/lib/tree/create-elements-tree.js +2 -4
- package/lib/tree/index.js +1 -0
- package/lib/tree/root.js +2 -5
- package/lib/tree/webstudio-component.js +10 -20
- package/lib/types/component-renderer.d.ts +1 -1
- package/lib/types/components/component-meta.d.ts +526 -526
- package/lib/types/context.d.ts +1 -2
- package/lib/types/css/css.d.ts +22 -23
- package/lib/types/css/global-rules.d.ts +19 -19
- package/lib/types/css/normalize.d.ts +2444 -2444
- package/lib/types/css/style-rules.d.ts +2 -2
- package/lib/types/embed-template.d.ts +648 -648
- package/lib/types/generator.d.ts +1 -1
- package/lib/types/hook.d.ts +3 -3
- package/lib/types/index.d.ts +1 -0
- package/lib/types/instance-utils.d.ts +3 -3
- package/lib/types/prop-meta.d.ts +396 -0
- package/lib/types/props.d.ts +52 -53
- package/lib/types/tree/create-elements-tree.d.ts +3 -4
- package/lib/types/tree/root.d.ts +8 -8
- package/lib/types/tree/webstudio-component.d.ts +1 -1
- package/package.json +14 -22
- package/lib/cjs/app/index.js +0 -18
- package/lib/cjs/app/root.js +0 -40
- package/lib/cjs/component-renderer.js +0 -143
- package/lib/cjs/components/component-meta.js +0 -87
- package/lib/cjs/components/components-utils.js +0 -17
- package/lib/cjs/context.js +0 -43
- package/lib/cjs/css/css.js +0 -84
- package/lib/cjs/css/global-rules.js +0 -37
- package/lib/cjs/css/index.js +0 -20
- package/lib/cjs/css/normalize-type-check.js +0 -26
- package/lib/cjs/css/normalize.js +0 -349
- package/lib/cjs/css/presets.js +0 -48
- package/lib/cjs/css/style-rules.js +0 -86
- package/lib/cjs/embed-template.js +0 -368
- package/lib/cjs/expression.js +0 -371
- package/lib/cjs/generator.js +0 -128
- package/lib/cjs/hook.js +0 -34
- package/lib/cjs/index.js +0 -59
- package/lib/cjs/instance-utils.js +0 -65
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/props.js +0 -204
- package/lib/cjs/pubsub/create.js +0 -78
- package/lib/cjs/pubsub/index.js +0 -18
- package/lib/cjs/pubsub/raf-queue.js +0 -42
- package/lib/cjs/tree/create-elements-tree.js +0 -152
- package/lib/cjs/tree/index.js +0 -20
- package/lib/cjs/tree/root.js +0 -100
- package/lib/cjs/tree/webstudio-component.js +0 -91
- package/src/app/index.ts +0 -1
- package/src/app/root.tsx +0 -25
- package/src/component-renderer.tsx +0 -146
- package/src/components/component-meta.ts +0 -86
- package/src/components/components-utils.ts +0 -13
- package/src/context.tsx +0 -73
- package/src/css/css.ts +0 -88
- package/src/css/global-rules.ts +0 -26
- package/src/css/index.ts +0 -3
- package/src/css/normalize-type-check.ts +0 -13
- package/src/css/normalize.ts +0 -507
- package/src/css/presets.ts +0 -27
- package/src/css/style-rules.ts +0 -101
- package/src/embed-template.ts +0 -438
- package/src/expression.ts +0 -401
- package/src/generator.ts +0 -147
- package/src/hook.ts +0 -52
- package/src/index.ts +0 -39
- package/src/instance-utils.ts +0 -65
- package/src/props.ts +0 -231
- package/src/pubsub/create.ts +0 -77
- package/src/pubsub/index.ts +0 -1
- package/src/pubsub/raf-queue.ts +0 -25
- package/src/tree/create-elements-tree.tsx +0 -186
- package/src/tree/index.ts +0 -3
- package/src/tree/root.ts +0 -131
- package/src/tree/webstudio-component.tsx +0 -97
package/lib/types/context.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ReadableAtom } from "nanostores";
|
|
3
|
-
import type { Assets } from "@webstudio-is/
|
|
4
|
-
import type { DataSource, Instance, Prop } from "@webstudio-is/project-build";
|
|
3
|
+
import type { DataSource, Instance, Prop, Assets } from "@webstudio-is/sdk";
|
|
5
4
|
import type { Pages, PropsByInstanceId } from "./props";
|
|
6
5
|
import type { IndexesWithinAncestors } from "./instance-utils";
|
|
7
6
|
export type Params = {
|
package/lib/types/css/css.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { type TransformValue } from "@webstudio-is/css-engine";
|
|
2
|
-
import type { Asset } from "@webstudio-is/
|
|
3
|
-
import type { Build } from "@webstudio-is/project-build";
|
|
2
|
+
import type { Asset, Breakpoint, Instance, StyleDecl, StyleDeclKey, StyleSourceSelection } from "@webstudio-is/sdk";
|
|
4
3
|
import type { WsComponentMeta } from "../components/component-meta";
|
|
5
4
|
type Data = {
|
|
6
5
|
assets: Asset[];
|
|
7
|
-
breakpoints
|
|
8
|
-
styles
|
|
9
|
-
styleSourceSelections
|
|
6
|
+
breakpoints: [Breakpoint["id"], Breakpoint][];
|
|
7
|
+
styles: [StyleDeclKey, StyleDecl][];
|
|
8
|
+
styleSourceSelections: [Instance["id"], StyleSourceSelection][];
|
|
10
9
|
componentMetas: Map<string, WsComponentMeta>;
|
|
11
10
|
};
|
|
12
11
|
type CssOptions = {
|
|
@@ -14,51 +13,51 @@ type CssOptions = {
|
|
|
14
13
|
};
|
|
15
14
|
export declare const createImageValueTransformer: (assets: Map<string, {
|
|
16
15
|
type: "font";
|
|
17
|
-
id: string;
|
|
18
16
|
name: string;
|
|
17
|
+
format: "ttf" | "woff" | "woff2" | "otf";
|
|
19
18
|
meta: ({
|
|
20
|
-
weight: number;
|
|
21
|
-
style: "normal" | "italic" | "oblique";
|
|
22
19
|
family: string;
|
|
20
|
+
style: "normal" | "italic" | "oblique";
|
|
21
|
+
weight: number;
|
|
23
22
|
} | {
|
|
23
|
+
family: string;
|
|
24
24
|
variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
|
|
25
|
-
min: number;
|
|
26
|
-
max: number;
|
|
27
25
|
name: string;
|
|
26
|
+
min: number;
|
|
28
27
|
default: number;
|
|
28
|
+
max: number;
|
|
29
29
|
}>>;
|
|
30
|
-
family: string;
|
|
31
30
|
}) & ({
|
|
32
|
-
weight: number;
|
|
33
|
-
style: "normal" | "italic" | "oblique";
|
|
34
31
|
family: string;
|
|
32
|
+
style: "normal" | "italic" | "oblique";
|
|
33
|
+
weight: number;
|
|
35
34
|
} | {
|
|
35
|
+
family: string;
|
|
36
36
|
variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
|
|
37
|
-
min: number;
|
|
38
|
-
max: number;
|
|
39
37
|
name: string;
|
|
38
|
+
min: number;
|
|
40
39
|
default: number;
|
|
40
|
+
max: number;
|
|
41
41
|
}>>;
|
|
42
|
-
family: string;
|
|
43
42
|
} | undefined);
|
|
43
|
+
id: string;
|
|
44
|
+
projectId: string;
|
|
44
45
|
size: number;
|
|
45
46
|
description: string | null;
|
|
46
|
-
format: "ttf" | "woff" | "woff2" | "otf";
|
|
47
|
-
projectId: string;
|
|
48
47
|
createdAt: string;
|
|
49
48
|
} | {
|
|
50
49
|
type: "image";
|
|
51
|
-
id: string;
|
|
52
50
|
name: string;
|
|
51
|
+
format: string;
|
|
53
52
|
meta: {
|
|
54
|
-
height: number;
|
|
55
53
|
width: number;
|
|
54
|
+
height: number;
|
|
56
55
|
};
|
|
56
|
+
id: string;
|
|
57
|
+
projectId: string;
|
|
57
58
|
size: number;
|
|
58
59
|
description: string | null;
|
|
59
|
-
format: string;
|
|
60
|
-
projectId: string;
|
|
61
60
|
createdAt: string;
|
|
62
|
-
}
|
|
61
|
+
}>, options: CssOptions) => TransformValue;
|
|
63
62
|
export declare const generateCssText: (data: Data, options: CssOptions) => string;
|
|
64
63
|
export {};
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import type { CssEngine } from "@webstudio-is/css-engine";
|
|
2
|
-
import type { Assets } from "@webstudio-is/
|
|
2
|
+
import type { Assets } from "@webstudio-is/sdk";
|
|
3
3
|
export declare const addGlobalRules: (engine: CssEngine, { assets, assetBaseUrl }: {
|
|
4
4
|
assets: Map<string, {
|
|
5
5
|
type: "font";
|
|
6
|
-
id: string;
|
|
7
6
|
name: string;
|
|
7
|
+
format: "ttf" | "woff" | "woff2" | "otf";
|
|
8
8
|
meta: ({
|
|
9
|
-
weight: number;
|
|
10
|
-
style: "normal" | "italic" | "oblique";
|
|
11
9
|
family: string;
|
|
10
|
+
style: "normal" | "italic" | "oblique";
|
|
11
|
+
weight: number;
|
|
12
12
|
} | {
|
|
13
|
+
family: string;
|
|
13
14
|
variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
|
|
14
|
-
min: number;
|
|
15
|
-
max: number;
|
|
16
15
|
name: string;
|
|
16
|
+
min: number;
|
|
17
17
|
default: number;
|
|
18
|
+
max: number;
|
|
18
19
|
}>>;
|
|
19
|
-
family: string;
|
|
20
20
|
}) & ({
|
|
21
|
-
weight: number;
|
|
22
|
-
style: "normal" | "italic" | "oblique";
|
|
23
21
|
family: string;
|
|
22
|
+
style: "normal" | "italic" | "oblique";
|
|
23
|
+
weight: number;
|
|
24
24
|
} | {
|
|
25
|
+
family: string;
|
|
25
26
|
variationAxes: Partial<Record<"wght" | "wdth" | "slnt" | "opsz" | "ital" | "GRAD" | "XTRA" | "XOPQ" | "YOPQ" | "YTLC" | "YTUC" | "YTAS" | "YTDE" | "YTFI", {
|
|
26
|
-
min: number;
|
|
27
|
-
max: number;
|
|
28
27
|
name: string;
|
|
28
|
+
min: number;
|
|
29
29
|
default: number;
|
|
30
|
+
max: number;
|
|
30
31
|
}>>;
|
|
31
|
-
family: string;
|
|
32
32
|
} | undefined);
|
|
33
|
+
id: string;
|
|
34
|
+
projectId: string;
|
|
33
35
|
size: number;
|
|
34
36
|
description: string | null;
|
|
35
|
-
format: "ttf" | "woff" | "woff2" | "otf";
|
|
36
|
-
projectId: string;
|
|
37
37
|
createdAt: string;
|
|
38
38
|
} | {
|
|
39
39
|
type: "image";
|
|
40
|
-
id: string;
|
|
41
40
|
name: string;
|
|
41
|
+
format: string;
|
|
42
42
|
meta: {
|
|
43
|
-
height: number;
|
|
44
43
|
width: number;
|
|
44
|
+
height: number;
|
|
45
45
|
};
|
|
46
|
+
id: string;
|
|
47
|
+
projectId: string;
|
|
46
48
|
size: number;
|
|
47
49
|
description: string | null;
|
|
48
|
-
format: string;
|
|
49
|
-
projectId: string;
|
|
50
50
|
createdAt: string;
|
|
51
|
-
}
|
|
51
|
+
}>;
|
|
52
52
|
assetBaseUrl: string;
|
|
53
53
|
}) => void;
|