@webstudio-is/sdk 0.269.0 → 0.270.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/index.js +24 -11
- package/lib/types/instances-utils.d.ts +1 -1
- package/lib/types/schema/pages.d.ts +3 -3
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -142,13 +142,20 @@ var DefaultPagePage = z2.string().refine((path) => path !== "", "Can't be empty"
|
|
|
142
142
|
(path) => path !== "/build" && path.startsWith("/build/") === false,
|
|
143
143
|
"/build prefix is reserved for the system"
|
|
144
144
|
).refine((path) => path.length <= 255, "Path can't exceed 255 characters");
|
|
145
|
-
var
|
|
146
|
-
(path) => path
|
|
147
|
-
"Must start with a /
|
|
148
|
-
).refine((path) =>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
145
|
+
var RedirectSourcePath = z2.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine(
|
|
146
|
+
(path) => path.startsWith("/") && path.startsWith("//") === false,
|
|
147
|
+
"Must start with a /"
|
|
148
|
+
).refine((path) => {
|
|
149
|
+
if (/[\\\u0000-\u001f\u007f]/.test(path)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
new URL(path, "https://example.com");
|
|
154
|
+
return true;
|
|
155
|
+
} catch {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
}, "Must be a valid URL path").refine(
|
|
152
159
|
(path) => path !== "/s" && path.startsWith("/s/") === false,
|
|
153
160
|
"/s prefix is reserved for the system"
|
|
154
161
|
).refine(
|
|
@@ -188,7 +195,7 @@ var ProjectNewRedirectPath = z2.string().min(1, "Path is required").refine((data
|
|
|
188
195
|
}
|
|
189
196
|
}, "Must be a valid URL");
|
|
190
197
|
var PageRedirect = z2.object({
|
|
191
|
-
old:
|
|
198
|
+
old: RedirectSourcePath,
|
|
192
199
|
new: ProjectNewRedirectPath,
|
|
193
200
|
status: z2.enum(["301", "302"]).optional()
|
|
194
201
|
});
|
|
@@ -2137,10 +2144,16 @@ var getHtmlTagFromInstance = ({
|
|
|
2137
2144
|
if (instance.component === "XmlNode") {
|
|
2138
2145
|
return;
|
|
2139
2146
|
}
|
|
2147
|
+
if (instance.tag !== void 0) {
|
|
2148
|
+
return instance.tag;
|
|
2149
|
+
}
|
|
2150
|
+
const propTag = htmlTagsByInstanceId === void 0 ? props === void 0 ? void 0 : getHtmlTagsFromProps(props).get(instance.id) : htmlTagsByInstanceId.get(instance.id);
|
|
2151
|
+
if (propTag !== void 0) {
|
|
2152
|
+
return propTag;
|
|
2153
|
+
}
|
|
2140
2154
|
const meta = metas.get(instance.component);
|
|
2141
2155
|
const metaTag = Object.keys(meta?.presetStyle ?? {}).at(0);
|
|
2142
|
-
|
|
2143
|
-
return instance.tag ?? propTag ?? metaTag;
|
|
2156
|
+
return metaTag;
|
|
2144
2157
|
};
|
|
2145
2158
|
var getIndexesWithinAncestors = (metas, instances, rootIds) => {
|
|
2146
2159
|
const ancestors = /* @__PURE__ */ new Set();
|
|
@@ -3471,7 +3484,6 @@ export {
|
|
|
3471
3484
|
InstanceChild,
|
|
3472
3485
|
Instances,
|
|
3473
3486
|
MIME_CATEGORIES,
|
|
3474
|
-
OldPagePath,
|
|
3475
3487
|
PageAuth,
|
|
3476
3488
|
PageId,
|
|
3477
3489
|
PageName,
|
|
@@ -3489,6 +3501,7 @@ export {
|
|
|
3489
3501
|
RESIZABLE_IMAGE_MIME_TYPES,
|
|
3490
3502
|
ROOT_FOLDER_ID,
|
|
3491
3503
|
ROOT_INSTANCE_ID,
|
|
3504
|
+
RedirectSourcePath,
|
|
3492
3505
|
Resource,
|
|
3493
3506
|
ResourceRequest,
|
|
3494
3507
|
Resources,
|
|
@@ -9,7 +9,7 @@ export declare const getHtmlTagsFromProps: (props: Props) => Map<string, string>
|
|
|
9
9
|
export declare const getHtmlTagFromInstance: ({ instance, metas, props, htmlTagsByInstanceId, }: {
|
|
10
10
|
instance: Instance;
|
|
11
11
|
metas: Map<Instance["component"], WsComponentMeta>;
|
|
12
|
-
props
|
|
12
|
+
props?: Props;
|
|
13
13
|
htmlTagsByInstanceId?: Map<Instance["id"], string>;
|
|
14
14
|
}) => string | undefined;
|
|
15
15
|
export type IndexesWithinAncestors = Map<Instance["id"], number>;
|
|
@@ -79,7 +79,7 @@ export declare const PageAuth: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
|
79
79
|
}>]>;
|
|
80
80
|
export type PageAuth = z.infer<typeof PageAuth>;
|
|
81
81
|
export declare const HomePagePath: z.ZodEffects<z.ZodString, "", string>;
|
|
82
|
-
export declare const
|
|
82
|
+
export declare const RedirectSourcePath: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>;
|
|
83
83
|
export declare const PagePath: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>;
|
|
84
84
|
declare const Page: z.ZodObject<{
|
|
85
85
|
path: z.ZodUnion<[z.ZodEffects<z.ZodString, "", string>, z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>]>;
|
|
@@ -509,7 +509,7 @@ declare const ProjectMeta: z.ZodObject<{
|
|
|
509
509
|
export type ProjectMeta = z.infer<typeof ProjectMeta>;
|
|
510
510
|
export declare const ProjectNewRedirectPath: z.ZodEffects<z.ZodString, string, string>;
|
|
511
511
|
export declare const PageRedirect: z.ZodObject<{
|
|
512
|
-
old: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
|
|
512
|
+
old: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>;
|
|
513
513
|
new: z.ZodEffects<z.ZodString, string, string>;
|
|
514
514
|
status: z.ZodOptional<z.ZodEnum<["301", "302"]>>;
|
|
515
515
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -559,7 +559,7 @@ export declare const Pages: z.ZodEffects<z.ZodObject<{
|
|
|
559
559
|
atomicStyles?: boolean | undefined;
|
|
560
560
|
}>>;
|
|
561
561
|
redirects: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
562
|
-
old: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.
|
|
562
|
+
old: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>;
|
|
563
563
|
new: z.ZodEffects<z.ZodString, string, string>;
|
|
564
564
|
status: z.ZodOptional<z.ZodEnum<["301", "302"]>>;
|
|
565
565
|
}, "strip", z.ZodTypeAny, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.270.0",
|
|
4
4
|
"description": "Webstudio project data schema",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -51,16 +51,16 @@
|
|
|
51
51
|
"type-fest": "^4.37.0",
|
|
52
52
|
"warn-once": "^0.1.1",
|
|
53
53
|
"zod": "^3.24.2",
|
|
54
|
-
"@webstudio-is/css-engine": "0.
|
|
55
|
-
"@webstudio-is/fonts": "0.
|
|
56
|
-
"@webstudio-is/
|
|
57
|
-
"@webstudio-is/
|
|
54
|
+
"@webstudio-is/css-engine": "0.270.0",
|
|
55
|
+
"@webstudio-is/fonts": "0.270.0",
|
|
56
|
+
"@webstudio-is/wsauth": "0.270.0",
|
|
57
|
+
"@webstudio-is/icons": "0.270.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"html-tags": "^4.0.0",
|
|
61
61
|
"vitest": "^3.1.2",
|
|
62
|
-
"@webstudio-is/template": "0.
|
|
63
|
-
"@webstudio-is/css-data": "0.
|
|
62
|
+
"@webstudio-is/template": "0.270.0",
|
|
63
|
+
"@webstudio-is/css-data": "0.270.0",
|
|
64
64
|
"@webstudio-is/tsconfig": "1.0.7"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|