@webstudio-is/sdk 0.269.0 → 0.271.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 +26 -11
- package/lib/schema.js +902 -0
- package/lib/types/instances-utils.d.ts +1 -1
- package/lib/types/page-utils.d.ts +1 -1
- package/lib/types/schema/pages.d.ts +49 -50
- package/lib/types/schema.d.ts +11 -0
- package/package.json +13 -8
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,7 @@ export {
|
|
|
3471
3484
|
InstanceChild,
|
|
3472
3485
|
Instances,
|
|
3473
3486
|
MIME_CATEGORIES,
|
|
3474
|
-
|
|
3487
|
+
Page,
|
|
3475
3488
|
PageAuth,
|
|
3476
3489
|
PageId,
|
|
3477
3490
|
PageName,
|
|
@@ -3481,6 +3494,7 @@ export {
|
|
|
3481
3494
|
PageTitle,
|
|
3482
3495
|
Pages,
|
|
3483
3496
|
PresetStyleDecl,
|
|
3497
|
+
ProjectMeta,
|
|
3484
3498
|
ProjectNewRedirectPath,
|
|
3485
3499
|
Prop,
|
|
3486
3500
|
PropMeta,
|
|
@@ -3489,6 +3503,7 @@ export {
|
|
|
3489
3503
|
RESIZABLE_IMAGE_MIME_TYPES,
|
|
3490
3504
|
ROOT_FOLDER_ID,
|
|
3491
3505
|
ROOT_INSTANCE_ID,
|
|
3506
|
+
RedirectSourcePath,
|
|
3492
3507
|
Resource,
|
|
3493
3508
|
ResourceRequest,
|
|
3494
3509
|
Resources,
|