mechanica 1.0.22 → 1.0.24
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/bin/bin.js +0 -0
- package/bin/compile.js +4 -6
- package/dist/editor.js +4 -6
- package/dist/editor.js.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/dist/{schemaAliases-BChQHL5h.js → schemaAliases-t4X-kaIk.js} +3 -104
- package/dist/schemaAliases-t4X-kaIk.js.map +1 -0
- package/package.json +2 -1
- package/dist/schemaAliases-BChQHL5h.js.map +0 -1
package/bin/bin.js
CHANGED
|
File without changes
|
package/bin/compile.js
CHANGED
|
@@ -53,10 +53,7 @@ const walkTree = (blocks, callback) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const walkSchema = (obj, schema, callback) => {
|
|
56
|
-
if (schema.type === "object" && schema.properties) {
|
|
57
|
-
if (!obj) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
56
|
+
if (schema.type === "object" && schema.properties && obj) {
|
|
60
57
|
for (let [key, childSchema] of Object.entries(schema.properties)) {
|
|
61
58
|
const isRequired = schema.required.includes(key);
|
|
62
59
|
callback(obj[key], childSchema, key, obj, isRequired);
|
|
@@ -65,7 +62,7 @@ const walkSchema = (obj, schema, callback) => {
|
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
|
-
if (schema.type === "array" && schema.items) {
|
|
65
|
+
if (schema.type === "array" && schema.items && obj) {
|
|
69
66
|
for (let value of obj) {
|
|
70
67
|
callback(value, schema.items);
|
|
71
68
|
if (schema.items.type === "array" || schema.items.type === "object") {
|
|
@@ -150,7 +147,7 @@ async function* generateProject(options) {
|
|
|
150
147
|
const schema = options.blocksMap.get(block.blockId);
|
|
151
148
|
walkSchema(block.data, schema.props, (val, schema2, key, parent) => {
|
|
152
149
|
if (!val) return;
|
|
153
|
-
if (schema2.format === "image") {
|
|
150
|
+
if (schema2.format === "image" || schema2.format === "file") {
|
|
154
151
|
if (val.src) {
|
|
155
152
|
val.src = options.onFile(val.src);
|
|
156
153
|
}
|
|
@@ -288,6 +285,7 @@ const registerAliases = (registerCallback) => {
|
|
|
288
285
|
registerAlias$1("file", { type: "object", format: "file", properties: { src: "string" } });
|
|
289
286
|
registerAlias$1("color", { type: "string", format: "color" });
|
|
290
287
|
registerAlias$1("smartLink", { type: "object", format: "smartLink", properties: { url: "string", title: "string", external: "boolean" } });
|
|
288
|
+
registerAlias$1("multiselect", { type: "array", format: "multiselect", items: "string" });
|
|
291
289
|
registerAlias$1("richText", {
|
|
292
290
|
type: "array",
|
|
293
291
|
format: "richText",
|
package/dist/editor.js
CHANGED
|
@@ -2,8 +2,9 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { defineComponent, ref, watch, createElementBlock, openBlock, normalizeStyle, createElementVNode, reactive, computed, shallowRef, onMounted, onBeforeUnmount, triggerRef, inject, normalizeClass, createCommentVNode, renderSlot, createVNode, createTextVNode, toDisplayString, Transition, withCtx, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, toValue as toValue$1, getCurrentInstance, nextTick, unref, createBlock, createSlots, withDirectives, vModelText, vModelDynamic, Fragment, renderList, h, TransitionGroup, useSlots, Teleport, mergeProps, withModifiers, mergeModels, useModel, createStaticVNode, resolveDynamicComponent, resolveComponent, vShow, shallowReactive, vModelCheckbox, isProxy, toRaw, normalizeProps, guardReactiveProps, provide, createApp } from "vue";
|
|
5
|
-
import { p as passDefaultValue, d as defaultImageSrc, g as getDefaultValue, r as registerAliases
|
|
5
|
+
import { p as passDefaultValue, d as defaultImageSrc, g as getDefaultValue, r as registerAliases } from "./schemaAliases-t4X-kaIk.js";
|
|
6
6
|
import { blocksList as blocksList$1, addUpdateListener } from "virtual:builder-blocks";
|
|
7
|
+
import { registerAlias, unfoldSchema } from "compact-json-schema";
|
|
7
8
|
const _sfc_main$S = /* @__PURE__ */ defineComponent({
|
|
8
9
|
__name: "HoverFrame",
|
|
9
10
|
props: {
|
|
@@ -1445,10 +1446,7 @@ const walkTree = (blocks, callback) => {
|
|
|
1445
1446
|
}
|
|
1446
1447
|
};
|
|
1447
1448
|
const walkSchema = (obj, schema, callback) => {
|
|
1448
|
-
if (schema.type === "object" && schema.properties) {
|
|
1449
|
-
if (!obj) {
|
|
1450
|
-
return;
|
|
1451
|
-
}
|
|
1449
|
+
if (schema.type === "object" && schema.properties && obj) {
|
|
1452
1450
|
for (let [key, childSchema] of Object.entries(schema.properties)) {
|
|
1453
1451
|
const isRequired = schema.required.includes(key);
|
|
1454
1452
|
callback(obj[key], childSchema, key, obj, isRequired);
|
|
@@ -1457,7 +1455,7 @@ const walkSchema = (obj, schema, callback) => {
|
|
|
1457
1455
|
}
|
|
1458
1456
|
}
|
|
1459
1457
|
}
|
|
1460
|
-
if (schema.type === "array" && schema.items) {
|
|
1458
|
+
if (schema.type === "array" && schema.items && obj) {
|
|
1461
1459
|
for (let value of obj) {
|
|
1462
1460
|
callback(value, schema.items);
|
|
1463
1461
|
if (schema.items.type === "array" || schema.items.type === "object") {
|