mechanica 2.0.0-alpha.0 → 2.0.0-alpha.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/dist/chunks/{page-assets-DnDUQegn.js → page-assets-D0cofAGb.js} +2 -2
- package/dist/chunks/{preview-uxnrJ5vY.js → preview-B17SIZrO.js} +1 -1
- package/dist/cli.js +0 -0
- package/dist/editor.css +69 -69
- package/dist/editor.js +6 -6
- package/dist/index.js +2 -2
- package/dist/plugin.js +2 -2
- package/dist/types/cli/export.d.ts +1 -1
- package/dist/types/core/create-mechanica.d.ts +1 -1
- package/dist/types/core/data-registry.d.ts +1 -1
- package/dist/types/core/define-mechanica-app.d.ts +1 -1
- package/dist/types/core/field-types.d.ts +1 -1
- package/dist/types/core/link.d.ts +1 -1
- package/dist/types/core/load-blocks.d.ts +1 -1
- package/dist/types/core/preview.d.ts +1 -1
- package/dist/types/core/render-blocks.d.ts +1 -1
- package/dist/types/core/router.d.ts +1 -1
- package/dist/types/core/state.d.ts +1 -1
- package/dist/types/core/use-page-data.d.ts +1 -1
- package/dist/types/editor/fields/registry.d.ts +1 -1
- package/dist/types/editor/lib/block-meta.d.ts +1 -1
- package/dist/types/editor/lib/bridge.d.ts +1 -1
- package/dist/types/editor/lib/content-tree.d.ts +1 -1
- package/dist/types/editor/lib/store.d.ts +1 -1
- package/dist/types/vite/dev/page-state.d.ts +2 -2
- package/dist/types/vite/dev/pages-store.d.ts +2 -2
- package/dist/types/vite/dev/query-dev.d.ts +1 -1
- package/dist/types/vite/rich-text-codec.d.ts +1 -1
- package/package.json +2 -2
- package/src/cli/export.ts +0 -0
- package/src/core/create-mechanica.ts +1 -1
- package/src/core/data-registry.ts +1 -1
- package/src/core/define-data.ts +1 -1
- package/src/core/define-mechanica-app.ts +1 -1
- package/src/core/field-types.ts +1 -1
- package/src/core/link.ts +1 -1
- package/src/core/load-blocks.ts +1 -1
- package/src/core/preview.ts +1 -1
- package/src/core/render-blocks.ts +1 -1
- package/src/core/router.ts +1 -1
- package/src/core/state.ts +1 -1
- package/src/core/use-page-data.ts +1 -1
- package/src/editor/EditorApp.vue +1 -1
- package/src/editor/components/BlockPalette.vue +1 -1
- package/src/editor/components/BlockPreview.vue +1 -1
- package/src/editor/components/DataSettings.vue +1 -1
- package/src/editor/components/HierarchyTree.vue +1 -1
- package/src/editor/editor.ts +1 -1
- package/src/editor/fields/registry.ts +1 -1
- package/src/editor/lib/block-meta.ts +1 -1
- package/src/editor/lib/block-preview.ts +1 -1
- package/src/editor/lib/bridge.ts +1 -1
- package/src/editor/lib/content-tree.ts +1 -1
- package/src/editor/lib/store.ts +1 -1
- package/src/editor/props-panel/ArrayField.vue +1 -1
- package/src/vite/dev/page-state.ts +1 -1
- package/src/vite/dev/pages-store.ts +2 -2
- package/src/vite/dev/preview.ts +1 -1
- package/src/vite/dev/query-dev.ts +1 -1
- package/src/vite/plugin.ts +1 -1
- package/src/vite/rich-text-codec.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { dirname, join, parse, relative } from "node:path";
|
|
2
|
-
import { migrateContent, passDefaultValue, walkTree } from "
|
|
2
|
+
import { migrateContent, passDefaultValue, walkTree } from "mechanica-shared";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { parsePage, serializePage } from "
|
|
5
|
+
import { parsePage, serializePage } from "mechanica-shared/page-format";
|
|
6
6
|
import { unfoldSchema } from "compact-json-schema";
|
|
7
7
|
import { blocksToMarkdown, markdownToBlocks } from "vuewrite/markdown";
|
|
8
8
|
//#region src/vite/entries.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createApp, defineComponent, h, inject, shallowReactive, shallowRef } from "vue";
|
|
2
|
-
import { buildPreviewData, walkTree } from "
|
|
2
|
+
import { buildPreviewData, walkTree } from "mechanica-shared";
|
|
3
3
|
import { unfoldSchema } from "compact-json-schema";
|
|
4
4
|
//#region src/core/state.ts
|
|
5
5
|
/** Vue injection key for the {@link MechanicaContext}. */
|
package/dist/cli.js
CHANGED
|
Binary file
|
package/dist/editor.css
CHANGED
|
@@ -1015,12 +1015,12 @@ from {
|
|
|
1015
1015
|
height: 1px;
|
|
1016
1016
|
margin: 4px 6px;
|
|
1017
1017
|
background: var(--mech-border);
|
|
1018
|
-
}.mech-data[data-v-
|
|
1018
|
+
}.mech-data[data-v-4fc6dde5] {
|
|
1019
1019
|
display: flex;
|
|
1020
1020
|
gap: 20px;
|
|
1021
1021
|
min-height: 320px;
|
|
1022
1022
|
}
|
|
1023
|
-
.mech-data__rail[data-v-
|
|
1023
|
+
.mech-data__rail[data-v-4fc6dde5] {
|
|
1024
1024
|
flex: none;
|
|
1025
1025
|
width: 178px;
|
|
1026
1026
|
display: flex;
|
|
@@ -1029,7 +1029,7 @@ from {
|
|
|
1029
1029
|
padding-right: 14px;
|
|
1030
1030
|
border-right: 1px solid var(--mech-border);
|
|
1031
1031
|
}
|
|
1032
|
-
.mech-data__entry[data-v-
|
|
1032
|
+
.mech-data__entry[data-v-4fc6dde5] {
|
|
1033
1033
|
display: flex;
|
|
1034
1034
|
align-items: center;
|
|
1035
1035
|
justify-content: space-between;
|
|
@@ -1045,21 +1045,21 @@ from {
|
|
|
1045
1045
|
color: var(--mech-fg-alt);
|
|
1046
1046
|
transition: background 0.12s, color 0.12s;
|
|
1047
1047
|
}
|
|
1048
|
-
.mech-data__entry[data-v-
|
|
1048
|
+
.mech-data__entry[data-v-4fc6dde5]:hover {
|
|
1049
1049
|
background: var(--mech-hover);
|
|
1050
1050
|
}
|
|
1051
|
-
.mech-data__entry.is-active[data-v-
|
|
1051
|
+
.mech-data__entry.is-active[data-v-4fc6dde5] {
|
|
1052
1052
|
background: var(--mech-accent-soft);
|
|
1053
1053
|
color: var(--mech-fg);
|
|
1054
1054
|
}
|
|
1055
|
-
.mech-data__entry-name[data-v-
|
|
1055
|
+
.mech-data__entry-name[data-v-4fc6dde5] {
|
|
1056
1056
|
font-size: 13px;
|
|
1057
1057
|
font-weight: 500;
|
|
1058
1058
|
overflow: hidden;
|
|
1059
1059
|
text-overflow: ellipsis;
|
|
1060
1060
|
white-space: nowrap;
|
|
1061
1061
|
}
|
|
1062
|
-
.mech-data__entry-scope[data-v-
|
|
1062
|
+
.mech-data__entry-scope[data-v-4fc6dde5] {
|
|
1063
1063
|
flex: none;
|
|
1064
1064
|
font-size: 9.5px;
|
|
1065
1065
|
font-weight: 700;
|
|
@@ -1067,35 +1067,35 @@ from {
|
|
|
1067
1067
|
text-transform: uppercase;
|
|
1068
1068
|
color: var(--mech-muted);
|
|
1069
1069
|
}
|
|
1070
|
-
.mech-data__entry-scope.is-page[data-v-
|
|
1070
|
+
.mech-data__entry-scope.is-page[data-v-4fc6dde5] {
|
|
1071
1071
|
color: var(--mech-accent);
|
|
1072
1072
|
}
|
|
1073
|
-
.mech-data__pane[data-v-
|
|
1073
|
+
.mech-data__pane[data-v-4fc6dde5] {
|
|
1074
1074
|
flex: 1;
|
|
1075
1075
|
min-width: 0;
|
|
1076
1076
|
display: flex;
|
|
1077
1077
|
flex-direction: column;
|
|
1078
1078
|
gap: 14px;
|
|
1079
1079
|
}
|
|
1080
|
-
.mech-data__head[data-v-
|
|
1080
|
+
.mech-data__head[data-v-4fc6dde5] {
|
|
1081
1081
|
display: flex;
|
|
1082
1082
|
align-items: center;
|
|
1083
1083
|
justify-content: space-between;
|
|
1084
1084
|
gap: 12px;
|
|
1085
1085
|
}
|
|
1086
|
-
.mech-data__title[data-v-
|
|
1086
|
+
.mech-data__title[data-v-4fc6dde5] {
|
|
1087
1087
|
margin: 0;
|
|
1088
1088
|
font-size: 15px;
|
|
1089
1089
|
font-weight: 600;
|
|
1090
1090
|
}
|
|
1091
|
-
.mech-data__switch[data-v-
|
|
1091
|
+
.mech-data__switch[data-v-4fc6dde5] {
|
|
1092
1092
|
display: inline-flex;
|
|
1093
1093
|
gap: 2px;
|
|
1094
1094
|
padding: 3px;
|
|
1095
1095
|
background: var(--mech-field-bg);
|
|
1096
1096
|
border-radius: var(--mech-radius);
|
|
1097
1097
|
}
|
|
1098
|
-
.mech-data__seg[data-v-
|
|
1098
|
+
.mech-data__seg[data-v-4fc6dde5] {
|
|
1099
1099
|
padding: 5px 12px;
|
|
1100
1100
|
border: none;
|
|
1101
1101
|
background: none;
|
|
@@ -1107,31 +1107,31 @@ from {
|
|
|
1107
1107
|
cursor: pointer;
|
|
1108
1108
|
transition: background 0.12s, color 0.12s, box-shadow 0.12s;
|
|
1109
1109
|
}
|
|
1110
|
-
.mech-data__seg[data-v-
|
|
1110
|
+
.mech-data__seg[data-v-4fc6dde5]:hover {
|
|
1111
1111
|
color: var(--mech-fg);
|
|
1112
1112
|
}
|
|
1113
|
-
.mech-data__seg.is-active[data-v-
|
|
1113
|
+
.mech-data__seg.is-active[data-v-4fc6dde5] {
|
|
1114
1114
|
background: var(--mech-bg);
|
|
1115
1115
|
color: var(--mech-fg);
|
|
1116
1116
|
box-shadow: var(--mech-shadow-pop);
|
|
1117
1117
|
}
|
|
1118
|
-
.mech-data__note[data-v-
|
|
1118
|
+
.mech-data__note[data-v-4fc6dde5] {
|
|
1119
1119
|
margin: 0;
|
|
1120
1120
|
font-size: 12.5px;
|
|
1121
1121
|
color: var(--mech-muted);
|
|
1122
1122
|
}
|
|
1123
|
-
.mech-data__note strong[data-v-
|
|
1123
|
+
.mech-data__note strong[data-v-4fc6dde5] {
|
|
1124
1124
|
font-weight: 600;
|
|
1125
1125
|
color: var(--mech-fg-alt);
|
|
1126
1126
|
}
|
|
1127
|
-
.mech-data__note.is-warn[data-v-
|
|
1127
|
+
.mech-data__note.is-warn[data-v-4fc6dde5] {
|
|
1128
1128
|
padding: 9px 12px;
|
|
1129
1129
|
border-radius: var(--mech-radius-sm);
|
|
1130
1130
|
background: #fdf4e7;
|
|
1131
1131
|
color: #92580e;
|
|
1132
1132
|
border: 1px solid #f4d9a8;
|
|
1133
1133
|
}
|
|
1134
|
-
.mech-data__note.is-warn strong[data-v-
|
|
1134
|
+
.mech-data__note.is-warn strong[data-v-4fc6dde5] {
|
|
1135
1135
|
color: #7a4708;
|
|
1136
1136
|
}.mech-quick[data-v-7275376a] {
|
|
1137
1137
|
display: flex;
|
|
@@ -1229,15 +1229,15 @@ from {
|
|
|
1229
1229
|
text-align: center;
|
|
1230
1230
|
font-size: 12.5px;
|
|
1231
1231
|
color: var(--mech-muted);
|
|
1232
|
-
}.mech-tree[data-v-
|
|
1232
|
+
}.mech-tree[data-v-7f344e80] {
|
|
1233
1233
|
list-style: none;
|
|
1234
1234
|
margin: 0;
|
|
1235
1235
|
padding: 0;
|
|
1236
1236
|
}
|
|
1237
|
-
.mech-tree__node[data-v-
|
|
1237
|
+
.mech-tree__node[data-v-7f344e80] {
|
|
1238
1238
|
position: relative;
|
|
1239
1239
|
}
|
|
1240
|
-
.mech-tree__node.is-expanded[data-v-
|
|
1240
|
+
.mech-tree__node.is-expanded[data-v-7f344e80]::before {
|
|
1241
1241
|
content: "";
|
|
1242
1242
|
position: absolute;
|
|
1243
1243
|
top: 30px;
|
|
@@ -1247,10 +1247,10 @@ from {
|
|
|
1247
1247
|
background: var(--mech-border);
|
|
1248
1248
|
pointer-events: none;
|
|
1249
1249
|
}
|
|
1250
|
-
.mech-tree__node.is-expanded[data-v-
|
|
1250
|
+
.mech-tree__node.is-expanded[data-v-7f344e80]:has(> .mech-tree__row.is-selected)::before {
|
|
1251
1251
|
background: color-mix(in srgb, var(--mech-accent) 45%, transparent);
|
|
1252
1252
|
}
|
|
1253
|
-
.mech-tree__row[data-v-
|
|
1253
|
+
.mech-tree__row[data-v-7f344e80] {
|
|
1254
1254
|
position: relative;
|
|
1255
1255
|
display: flex;
|
|
1256
1256
|
align-items: center;
|
|
@@ -1265,14 +1265,14 @@ from {
|
|
|
1265
1265
|
color: var(--mech-fg-alt);
|
|
1266
1266
|
transition: background 0.1s;
|
|
1267
1267
|
}
|
|
1268
|
-
.mech-tree__row.is-hover[data-v-
|
|
1268
|
+
.mech-tree__row.is-hover[data-v-7f344e80] {
|
|
1269
1269
|
background: var(--mech-hover);
|
|
1270
1270
|
}
|
|
1271
|
-
.mech-tree__row.is-selected[data-v-
|
|
1271
|
+
.mech-tree__row.is-selected[data-v-7f344e80] {
|
|
1272
1272
|
background: var(--mech-accent-soft);
|
|
1273
1273
|
color: var(--mech-accent);
|
|
1274
1274
|
}
|
|
1275
|
-
.mech-tree__row.is-drop-before[data-v-
|
|
1275
|
+
.mech-tree__row.is-drop-before[data-v-7f344e80]::after, .mech-tree__row.is-drop-after[data-v-7f344e80]::after {
|
|
1276
1276
|
content: "";
|
|
1277
1277
|
position: absolute;
|
|
1278
1278
|
left: calc(var(--depth, 0) * 16px + 4px + var(--slot-pad, 0px));
|
|
@@ -1282,23 +1282,23 @@ from {
|
|
|
1282
1282
|
border-radius: 1px;
|
|
1283
1283
|
pointer-events: none;
|
|
1284
1284
|
}
|
|
1285
|
-
.mech-tree__row.is-drop-before[data-v-
|
|
1285
|
+
.mech-tree__row.is-drop-before[data-v-7f344e80]::after {
|
|
1286
1286
|
top: -1px;
|
|
1287
1287
|
}
|
|
1288
|
-
.mech-tree__row.is-drop-after[data-v-
|
|
1288
|
+
.mech-tree__row.is-drop-after[data-v-7f344e80]::after {
|
|
1289
1289
|
bottom: -1px;
|
|
1290
1290
|
}
|
|
1291
|
-
.mech-tree__row.is-drop-inside[data-v-
|
|
1291
|
+
.mech-tree__row.is-drop-inside[data-v-7f344e80] {
|
|
1292
1292
|
background: var(--mech-accent-soft);
|
|
1293
1293
|
color: var(--mech-accent);
|
|
1294
1294
|
}
|
|
1295
|
-
.mech-tree__row.is-drop-outline[data-v-
|
|
1295
|
+
.mech-tree__row.is-drop-outline[data-v-7f344e80] {
|
|
1296
1296
|
box-shadow: inset 0 0 0 1.5px var(--mech-accent);
|
|
1297
1297
|
}
|
|
1298
|
-
.mech-tree__row.is-drop-within[data-v-
|
|
1298
|
+
.mech-tree__row.is-drop-within[data-v-7f344e80] {
|
|
1299
1299
|
background: var(--mech-accent-soft);
|
|
1300
1300
|
}
|
|
1301
|
-
.mech-tree__toggle[data-v-
|
|
1301
|
+
.mech-tree__toggle[data-v-7f344e80] {
|
|
1302
1302
|
flex: none;
|
|
1303
1303
|
display: inline-flex;
|
|
1304
1304
|
align-items: center;
|
|
@@ -1313,24 +1313,24 @@ from {
|
|
|
1313
1313
|
color: var(--mech-muted);
|
|
1314
1314
|
cursor: pointer;
|
|
1315
1315
|
}
|
|
1316
|
-
.mech-tree__toggle .vicon[data-v-
|
|
1316
|
+
.mech-tree__toggle .vicon[data-v-7f344e80] {
|
|
1317
1317
|
width: 13px;
|
|
1318
1318
|
height: 13px;
|
|
1319
1319
|
transition: transform 0.14s ease;
|
|
1320
1320
|
}
|
|
1321
|
-
.mech-tree__toggle.is-collapsed .vicon[data-v-
|
|
1321
|
+
.mech-tree__toggle.is-collapsed .vicon[data-v-7f344e80] {
|
|
1322
1322
|
transform: rotate(-90deg);
|
|
1323
1323
|
}
|
|
1324
|
-
.mech-tree__toggle[data-v-
|
|
1324
|
+
.mech-tree__toggle[data-v-7f344e80]:hover {
|
|
1325
1325
|
color: var(--mech-fg);
|
|
1326
1326
|
}
|
|
1327
|
-
.mech-tree__icon[data-v-
|
|
1327
|
+
.mech-tree__icon[data-v-7f344e80] {
|
|
1328
1328
|
flex: none;
|
|
1329
1329
|
width: 15px;
|
|
1330
1330
|
height: 15px;
|
|
1331
1331
|
color: var(--mech-muted);
|
|
1332
1332
|
}
|
|
1333
|
-
.mech-tree__label[data-v-
|
|
1333
|
+
.mech-tree__label[data-v-7f344e80] {
|
|
1334
1334
|
flex: 1 1 auto;
|
|
1335
1335
|
min-width: 0;
|
|
1336
1336
|
overflow: hidden;
|
|
@@ -1339,32 +1339,32 @@ from {
|
|
|
1339
1339
|
font-size: 12.5px;
|
|
1340
1340
|
font-weight: 500;
|
|
1341
1341
|
}
|
|
1342
|
-
.mech-tree__slot-badge[data-v-
|
|
1342
|
+
.mech-tree__slot-badge[data-v-7f344e80] {
|
|
1343
1343
|
flex: none;
|
|
1344
1344
|
display: inline-flex;
|
|
1345
1345
|
align-items: center;
|
|
1346
1346
|
color: var(--mech-placeholder);
|
|
1347
1347
|
}
|
|
1348
|
-
.mech-tree__slot-badge .vicon[data-v-
|
|
1348
|
+
.mech-tree__slot-badge .vicon[data-v-7f344e80] {
|
|
1349
1349
|
width: 13px;
|
|
1350
1350
|
height: 13px;
|
|
1351
1351
|
}
|
|
1352
|
-
.mech-tree__row:hover .mech-tree__slot-badge[data-v-
|
|
1352
|
+
.mech-tree__row:hover .mech-tree__slot-badge[data-v-7f344e80] {
|
|
1353
1353
|
color: var(--mech-muted);
|
|
1354
1354
|
}
|
|
1355
|
-
.mech-tree__row.is-selected .mech-tree__icon[data-v-
|
|
1356
|
-
.mech-tree__row.is-selected .mech-tree__toggle[data-v-
|
|
1357
|
-
.mech-tree__row.is-selected .mech-tree__slot-badge[data-v-
|
|
1355
|
+
.mech-tree__row.is-selected .mech-tree__icon[data-v-7f344e80],
|
|
1356
|
+
.mech-tree__row.is-selected .mech-tree__toggle[data-v-7f344e80],
|
|
1357
|
+
.mech-tree__row.is-selected .mech-tree__slot-badge[data-v-7f344e80] {
|
|
1358
1358
|
color: var(--mech-accent);
|
|
1359
1359
|
}
|
|
1360
|
-
.mech-tree__root-drop[data-v-
|
|
1360
|
+
.mech-tree__root-drop[data-v-7f344e80] {
|
|
1361
1361
|
height: 2px;
|
|
1362
1362
|
margin: 3px 6px 0 4px;
|
|
1363
1363
|
background: var(--mech-accent);
|
|
1364
1364
|
border-radius: 1px;
|
|
1365
1365
|
list-style: none;
|
|
1366
1366
|
}
|
|
1367
|
-
.mech-tree__slot[data-v-
|
|
1367
|
+
.mech-tree__slot[data-v-7f344e80] {
|
|
1368
1368
|
display: flex;
|
|
1369
1369
|
align-items: center;
|
|
1370
1370
|
gap: 5px;
|
|
@@ -1374,33 +1374,33 @@ from {
|
|
|
1374
1374
|
border-radius: var(--mech-radius-sm);
|
|
1375
1375
|
color: var(--mech-muted);
|
|
1376
1376
|
}
|
|
1377
|
-
.mech-tree__slot[data-v-
|
|
1377
|
+
.mech-tree__slot[data-v-7f344e80]:hover {
|
|
1378
1378
|
background: var(--mech-hover);
|
|
1379
1379
|
}
|
|
1380
|
-
.mech-tree__slot.is-drop-target[data-v-
|
|
1380
|
+
.mech-tree__slot.is-drop-target[data-v-7f344e80] {
|
|
1381
1381
|
background: var(--mech-accent-soft);
|
|
1382
1382
|
color: var(--mech-accent);
|
|
1383
1383
|
}
|
|
1384
|
-
.mech-tree__slot.is-drop-target .mech-tree__slot-tick[data-v-
|
|
1384
|
+
.mech-tree__slot.is-drop-target .mech-tree__slot-tick[data-v-7f344e80] {
|
|
1385
1385
|
border-color: var(--mech-accent);
|
|
1386
1386
|
}
|
|
1387
|
-
.mech-tree__slot.is-drop-outline[data-v-
|
|
1387
|
+
.mech-tree__slot.is-drop-outline[data-v-7f344e80] {
|
|
1388
1388
|
box-shadow: inset 0 0 0 1.5px var(--mech-accent);
|
|
1389
1389
|
}
|
|
1390
|
-
.mech-tree__slot-tick[data-v-
|
|
1390
|
+
.mech-tree__slot-tick[data-v-7f344e80] {
|
|
1391
1391
|
flex: none;
|
|
1392
1392
|
width: 5px;
|
|
1393
1393
|
height: 5px;
|
|
1394
1394
|
border-radius: 1px;
|
|
1395
1395
|
border: 1.5px solid var(--mech-border-strong);
|
|
1396
1396
|
}
|
|
1397
|
-
.mech-tree__slot-name[data-v-
|
|
1397
|
+
.mech-tree__slot-name[data-v-7f344e80] {
|
|
1398
1398
|
font-size: 9.5px;
|
|
1399
1399
|
font-weight: 600;
|
|
1400
1400
|
text-transform: uppercase;
|
|
1401
1401
|
letter-spacing: 0.04em;
|
|
1402
1402
|
}
|
|
1403
|
-
.mech-tree__slot-empty[data-v-
|
|
1403
|
+
.mech-tree__slot-empty[data-v-7f344e80] {
|
|
1404
1404
|
display: inline-flex;
|
|
1405
1405
|
align-items: center;
|
|
1406
1406
|
margin: 1px 0 3px calc(var(--depth, 0) * 16px + 4px + var(--slot-pad, 0px));
|
|
@@ -1412,7 +1412,7 @@ from {
|
|
|
1412
1412
|
text-transform: uppercase;
|
|
1413
1413
|
letter-spacing: 0.05em;
|
|
1414
1414
|
color: var(--mech-placeholder);
|
|
1415
|
-
}.mech-bp[data-v-
|
|
1415
|
+
}.mech-bp[data-v-09be33b1] {
|
|
1416
1416
|
position: fixed;
|
|
1417
1417
|
top: 0;
|
|
1418
1418
|
left: 0;
|
|
@@ -1426,7 +1426,7 @@ from {
|
|
|
1426
1426
|
font-family: var(--mech-font);
|
|
1427
1427
|
color: var(--mech-fg);
|
|
1428
1428
|
}
|
|
1429
|
-
.mech-bp__fallback[data-v-
|
|
1429
|
+
.mech-bp__fallback[data-v-09be33b1] {
|
|
1430
1430
|
position: absolute;
|
|
1431
1431
|
inset: 0;
|
|
1432
1432
|
display: flex;
|
|
@@ -1436,26 +1436,26 @@ from {
|
|
|
1436
1436
|
gap: 8px;
|
|
1437
1437
|
color: var(--mech-muted);
|
|
1438
1438
|
}
|
|
1439
|
-
.mech-bp__fallback .vicon[data-v-
|
|
1439
|
+
.mech-bp__fallback .vicon[data-v-09be33b1] {
|
|
1440
1440
|
width: 26px;
|
|
1441
1441
|
height: 26px;
|
|
1442
1442
|
}
|
|
1443
|
-
.mech-bp__mono[data-v-
|
|
1443
|
+
.mech-bp__mono[data-v-09be33b1] {
|
|
1444
1444
|
font-size: 24px;
|
|
1445
1445
|
font-weight: 600;
|
|
1446
1446
|
}
|
|
1447
|
-
.mech-bp__name[data-v-
|
|
1447
|
+
.mech-bp__name[data-v-09be33b1] {
|
|
1448
1448
|
font-size: 12.5px;
|
|
1449
1449
|
font-weight: 500;
|
|
1450
|
-
}.mech-palette[data-v-
|
|
1450
|
+
}.mech-palette[data-v-d30ec3c2] {
|
|
1451
1451
|
display: flex;
|
|
1452
1452
|
flex-direction: column;
|
|
1453
1453
|
gap: 14px;
|
|
1454
1454
|
}
|
|
1455
|
-
.mech-palette__search[data-v-
|
|
1455
|
+
.mech-palette__search[data-v-d30ec3c2] {
|
|
1456
1456
|
margin-bottom: 2px;
|
|
1457
1457
|
}
|
|
1458
|
-
.mech-palette__group-title[data-v-
|
|
1458
|
+
.mech-palette__group-title[data-v-d30ec3c2] {
|
|
1459
1459
|
font-size: 11px;
|
|
1460
1460
|
font-weight: 600;
|
|
1461
1461
|
text-transform: uppercase;
|
|
@@ -1463,12 +1463,12 @@ from {
|
|
|
1463
1463
|
color: var(--mech-muted);
|
|
1464
1464
|
margin-bottom: 8px;
|
|
1465
1465
|
}
|
|
1466
|
-
.mech-palette__grid[data-v-
|
|
1466
|
+
.mech-palette__grid[data-v-d30ec3c2] {
|
|
1467
1467
|
display: grid;
|
|
1468
1468
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1469
1469
|
gap: 8px;
|
|
1470
1470
|
}
|
|
1471
|
-
.mech-palette__item[data-v-
|
|
1471
|
+
.mech-palette__item[data-v-d30ec3c2] {
|
|
1472
1472
|
display: flex;
|
|
1473
1473
|
flex-direction: column;
|
|
1474
1474
|
align-items: stretch;
|
|
@@ -1485,11 +1485,11 @@ from {
|
|
|
1485
1485
|
touch-action: none;
|
|
1486
1486
|
transition: background 0.12s, border-color 0.12s;
|
|
1487
1487
|
}
|
|
1488
|
-
.mech-palette__item[data-v-
|
|
1488
|
+
.mech-palette__item[data-v-d30ec3c2]:hover {
|
|
1489
1489
|
background: var(--mech-hover);
|
|
1490
1490
|
border-color: var(--mech-border-strong);
|
|
1491
1491
|
}
|
|
1492
|
-
.mech-palette__thumb[data-v-
|
|
1492
|
+
.mech-palette__thumb[data-v-d30ec3c2] {
|
|
1493
1493
|
position: relative;
|
|
1494
1494
|
display: flex;
|
|
1495
1495
|
align-items: center;
|
|
@@ -1502,11 +1502,11 @@ from {
|
|
|
1502
1502
|
font-weight: 600;
|
|
1503
1503
|
overflow: hidden;
|
|
1504
1504
|
}
|
|
1505
|
-
.mech-palette__thumb .vicon[data-v-
|
|
1505
|
+
.mech-palette__thumb .vicon[data-v-d30ec3c2] {
|
|
1506
1506
|
width: 20px;
|
|
1507
1507
|
height: 20px;
|
|
1508
1508
|
}
|
|
1509
|
-
.mech-palette__thumb-img[data-v-
|
|
1509
|
+
.mech-palette__thumb-img[data-v-d30ec3c2] {
|
|
1510
1510
|
position: absolute;
|
|
1511
1511
|
inset: 0;
|
|
1512
1512
|
width: 100%;
|
|
@@ -1514,7 +1514,7 @@ from {
|
|
|
1514
1514
|
object-fit: cover;
|
|
1515
1515
|
object-position: top;
|
|
1516
1516
|
}
|
|
1517
|
-
.mech-palette__name[data-v-
|
|
1517
|
+
.mech-palette__name[data-v-d30ec3c2] {
|
|
1518
1518
|
font-size: 12.5px;
|
|
1519
1519
|
font-weight: 500;
|
|
1520
1520
|
line-height: 1.2;
|
|
@@ -1522,7 +1522,7 @@ from {
|
|
|
1522
1522
|
overflow: hidden;
|
|
1523
1523
|
text-overflow: ellipsis;
|
|
1524
1524
|
}
|
|
1525
|
-
.mech-palette__scoped[data-v-
|
|
1525
|
+
.mech-palette__scoped[data-v-d30ec3c2] {
|
|
1526
1526
|
margin: 0;
|
|
1527
1527
|
font-size: 11.5px;
|
|
1528
1528
|
color: var(--mech-muted);
|
package/dist/editor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './editor.css';
|
|
2
|
-
import { a as getDataEntries, c as pushStateUpdate, d as createRouter, m as mechanicaKey, r as renderBlocks, t as buildPreviewContent } from "./chunks/preview-
|
|
2
|
+
import { a as getDataEntries, c as pushStateUpdate, d as createRouter, m as mechanicaKey, r as renderBlocks, t as buildPreviewContent } from "./chunks/preview-B17SIZrO.js";
|
|
3
3
|
import { a as useDialog, i as dialogKey, n as VDialog_default, o as _plugin_vue_export_helper_default, r as createDialogStore, s as VIcon_default, t as ImagePickerDialog_default } from "./chunks/ImagePickerDialog-DZyxrbfv.js";
|
|
4
4
|
import { Fragment, Teleport, Transition, TransitionGroup, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, inject, markRaw, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onErrorCaptured, onMounted, onScopeDispose, openBlock, provide, reactive, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, unref, useTemplateRef, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
5
|
-
import { getDefaultValue, registerFieldSchemas } from "
|
|
5
|
+
import { getDefaultValue, registerFieldSchemas } from "mechanica-shared";
|
|
6
6
|
import { unfoldSchema } from "compact-json-schema";
|
|
7
7
|
import { blocksList } from "virtual:mechanica/blocks";
|
|
8
8
|
import { widgetsList } from "virtual:mechanica/widgets";
|
|
@@ -3053,7 +3053,7 @@ var DataSettings_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
3053
3053
|
])) : (openBlock(), createElementBlock("p", _hoisted_9$4, "This page has no editable data."))]);
|
|
3054
3054
|
};
|
|
3055
3055
|
}
|
|
3056
|
-
}), [["__scopeId", "data-v-
|
|
3056
|
+
}), [["__scopeId", "data-v-4fc6dde5"]]);
|
|
3057
3057
|
//#endregion
|
|
3058
3058
|
//#region src/editor/dialogs/DataDialog.vue
|
|
3059
3059
|
var DataDialog_default = /* @__PURE__ */ defineComponent({
|
|
@@ -3523,7 +3523,7 @@ var HierarchyTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
|
|
|
3523
3523
|
}), 128)), __props.depth === 0 && rootDrop.value ? (openBlock(), createElementBlock("li", _hoisted_9$3)) : createCommentVNode("", true)], 14, _hoisted_1$9);
|
|
3524
3524
|
};
|
|
3525
3525
|
}
|
|
3526
|
-
}), [["__scopeId", "data-v-
|
|
3526
|
+
}), [["__scopeId", "data-v-7f344e80"]]);
|
|
3527
3527
|
//#endregion
|
|
3528
3528
|
//#region src/editor/lib/block-preview.ts
|
|
3529
3529
|
/**
|
|
@@ -3652,7 +3652,7 @@ var BlockPreview_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
3652
3652
|
}, null, 8, ["name"])) : (openBlock(), createElementBlock("span", _hoisted_2$6, toDisplayString(monogram.value), 1)), createElementVNode("span", _hoisted_3$5, toDisplayString(__props.block.name), 1)])) : createCommentVNode("", true)], 4)]);
|
|
3653
3653
|
};
|
|
3654
3654
|
}
|
|
3655
|
-
}), [["__scopeId", "data-v-
|
|
3655
|
+
}), [["__scopeId", "data-v-09be33b1"]]);
|
|
3656
3656
|
//#endregion
|
|
3657
3657
|
//#region src/editor/components/BlockPalette.vue?vue&type=script&setup=true&lang.ts
|
|
3658
3658
|
var _hoisted_1$7 = { class: "mech-palette" };
|
|
@@ -3800,7 +3800,7 @@ var BlockPalette_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
|
|
|
3800
3800
|
]);
|
|
3801
3801
|
};
|
|
3802
3802
|
}
|
|
3803
|
-
}), [["__scopeId", "data-v-
|
|
3803
|
+
}), [["__scopeId", "data-v-d30ec3c2"]]);
|
|
3804
3804
|
//#endregion
|
|
3805
3805
|
//#region src/editor/components/BlockSettings.vue?vue&type=script&setup=true&lang.ts
|
|
3806
3806
|
var _hoisted_1$6 = { class: "mech-settings" };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as getDataEntries, d as createRouter, f as useRoute, i as clearDataEntries, l as loadBlocks, m as mechanicaKey, n as mountPreviewApp, o as registerDataEntry, p as useRouter, r as renderBlocks, s as createMechanica, t as buildPreviewContent, u as usedBlockIds } from "./chunks/preview-
|
|
1
|
+
import { a as getDataEntries, d as createRouter, f as useRoute, i as clearDataEntries, l as loadBlocks, m as mechanicaKey, n as mountPreviewApp, o as registerDataEntry, p as useRouter, r as renderBlocks, s as createMechanica, t as buildPreviewContent, u as usedBlockIds } from "./chunks/preview-B17SIZrO.js";
|
|
2
2
|
import { computed, createApp, createSSRApp, defineComponent, h, inject, isReactive, onServerPrefetch, reactive, shallowReactive } from "vue";
|
|
3
|
-
import { passDefaultValue } from "
|
|
3
|
+
import { passDefaultValue } from "mechanica-shared";
|
|
4
4
|
import { unfoldSchema } from "compact-json-schema";
|
|
5
5
|
//#region src/core/define-mechanica-app.ts
|
|
6
6
|
/**
|
package/dist/plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as savePage, D as generateClientEntry, E as wasRecentlyMutated, O as generatePreviewEntry, S as renamePage, T as setPageCodec, _ as listPages, a as folderOf, b as pageVersion, c as readFolderData, d as PageExistsError, f as createPage, g as listFolders, h as fillContentDefaults, i as toBlockMeta, k as generateSsrEntry, m as duplicatePage, o as mergeFolderData, p as deletePage, r as buildRichTextCodec, s as mergeSiteData, t as BLOCKS_MANIFEST_FILE, u as readSiteData, v as movePage, w as setPageBlocks, x as readPage, y as pageUrlOf } from "./chunks/page-assets-
|
|
1
|
+
import { C as savePage, D as generateClientEntry, E as wasRecentlyMutated, O as generatePreviewEntry, S as renamePage, T as setPageCodec, _ as listPages, a as folderOf, b as pageVersion, c as readFolderData, d as PageExistsError, f as createPage, g as listFolders, h as fillContentDefaults, i as toBlockMeta, k as generateSsrEntry, m as duplicatePage, o as mergeFolderData, p as deletePage, r as buildRichTextCodec, s as mergeSiteData, t as BLOCKS_MANIFEST_FILE, u as readSiteData, v as movePage, w as setPageBlocks, x as readPage, y as pageUrlOf } from "./chunks/page-assets-D0cofAGb.js";
|
|
2
2
|
import { join, parse, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { parseVueRequest } from "@vitejs/plugin-vue";
|
|
4
|
-
import { passDataToHTML, resolveQueryKey, serializeState } from "
|
|
4
|
+
import { passDataToHTML, resolveQueryKey, serializeState } from "mechanica-shared";
|
|
5
5
|
import { babelParse, parse as parse$1 } from "@vue/compiler-sfc";
|
|
6
6
|
import { walk } from "estree-walker";
|
|
7
7
|
import MagicString from "magic-string";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RenderResult } from '
|
|
1
|
+
import { type RenderResult } from 'mechanica-shared';
|
|
2
2
|
import { type BlockComponent } from '../editor/lib/block-meta';
|
|
3
3
|
/** An already-built SSR bundle (`dist/ssr.js`) exposes these. */
|
|
4
4
|
export interface SsrBundle {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Plugin } from 'vue';
|
|
2
|
-
import type { State } from '
|
|
2
|
+
import type { State } from 'mechanica-shared';
|
|
3
3
|
import { type BlocksMap, type MechanicaMode, type QueryResolver } from './state';
|
|
4
4
|
import { type BlockLoaders } from './load-blocks';
|
|
5
5
|
export interface CreateMechanicaOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type App, type Component } from 'vue';
|
|
2
|
-
import type { State } from '
|
|
2
|
+
import type { State } from 'mechanica-shared';
|
|
3
3
|
import type { BlockLoaders } from './load-blocks';
|
|
4
4
|
import type { BlocksMap, MechanicaMode, QueryResolver } from './state';
|
|
5
5
|
export interface MechanicaAppDefinition {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type half of the built-in field registry: teaches compact-json-schema (and
|
|
3
3
|
* therefore `defineBlock`) what each custom format resolves to in TypeScript.
|
|
4
|
-
* The runtime half lives in
|
|
4
|
+
* The runtime half lives in `mechanica-shared` (`builtinFields`).
|
|
5
5
|
*/
|
|
6
6
|
declare module 'compact-json-schema' {
|
|
7
7
|
interface SchemaTypesMap {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
|
-
import { type ContentBlock } from '
|
|
2
|
+
import { type ContentBlock } from 'mechanica-shared';
|
|
3
3
|
import type { BlocksMap } from './state';
|
|
4
4
|
/** A dynamic import of one block SFC, from `virtual:mechanica/blocks` (build). */
|
|
5
5
|
export type BlockLoader = () => Promise<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type App } from 'vue';
|
|
2
|
-
import { type ContentBlock } from '
|
|
2
|
+
import { type ContentBlock } from 'mechanica-shared';
|
|
3
3
|
import type { BlocksMap } from './state';
|
|
4
4
|
/** The payload the dev preview route injects as `window.__MECHANICA_PREVIEW__`. */
|
|
5
5
|
export interface BlockPreviewRequest {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type VNode } from 'vue';
|
|
2
|
-
import type { ContentBlock } from '
|
|
2
|
+
import type { ContentBlock } from 'mechanica-shared';
|
|
3
3
|
import type { BlocksMap } from './state';
|
|
4
4
|
/**
|
|
5
5
|
* Render a content tree into Vue VNodes, resolving each block by id from
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ShallowRef } from 'vue';
|
|
2
|
-
import type { ContentBlock, State } from '
|
|
2
|
+
import type { ContentBlock, State } from 'mechanica-shared';
|
|
3
3
|
import { type MechanicaMode } from './state';
|
|
4
4
|
/** Minimal client router surface used by `<Link>`, `useRouter` and `useRoute`. */
|
|
5
5
|
export interface MechanicaRouter {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component, InjectionKey, ShallowRef } from 'vue';
|
|
2
|
-
import type { ContentBlock, PageMeta } from '
|
|
2
|
+
import type { ContentBlock, PageMeta } from 'mechanica-shared';
|
|
3
3
|
import type { MechanicaRouter } from './router';
|
|
4
4
|
/** Block components keyed by their `blockId`. */
|
|
5
5
|
export type BlocksMap = Map<string, Component>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
|
-
import { type FieldType as FieldSchema } from '
|
|
2
|
+
import { type FieldType as FieldSchema } from 'mechanica-shared';
|
|
3
3
|
/** Map a field name (format or type) to its editor component. */
|
|
4
4
|
export declare function registerFieldEditor(name: string, component: Component): void;
|
|
5
5
|
/** A full field-type definition: schema alias + default + editor component. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContentBlock, PageMeta } from '
|
|
1
|
+
import type { ContentBlock, PageMeta } from 'mechanica-shared';
|
|
2
2
|
/** Versioned message type for editor → runtime state updates. */
|
|
3
3
|
declare const MESSAGE_TYPE = "mechanica:update-state";
|
|
4
4
|
declare const PROTOCOL_VERSION = 1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type InjectionKey } from 'vue';
|
|
2
|
-
import { type Block, type ContentBlock, type DataEntry, type DataScope, type State } from '
|
|
2
|
+
import { type Block, type ContentBlock, type DataEntry, type DataScope, type State } from 'mechanica-shared';
|
|
3
3
|
import { type DropPosition } from './content-tree';
|
|
4
4
|
import { type BlockComponent } from './block-meta';
|
|
5
5
|
/** The editable, undo-able slice of state (content + the three data scope buckets). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PageMeta } from '
|
|
1
|
+
import type { PageMeta } from 'mechanica-shared';
|
|
2
2
|
/**
|
|
3
3
|
* The dev state for a page: effective data resolved site < folder < page, plus
|
|
4
4
|
* the scope buckets the editor edits, and the page's on-disk version for
|
|
@@ -11,7 +11,7 @@ import type { PageMeta } from '@mechanica/shared';
|
|
|
11
11
|
* variant edits (and saves to) the real page.
|
|
12
12
|
*/
|
|
13
13
|
export declare function buildPageState(mechDir: string, urlPath: string): {
|
|
14
|
-
content: import("
|
|
14
|
+
content: import("mechanica-shared").ContentBlock[];
|
|
15
15
|
data: {
|
|
16
16
|
[x: string]: unknown;
|
|
17
17
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Block, type ContentBlock } from '
|
|
2
|
-
import { type PageDoc, type RichTextCodec } from '
|
|
1
|
+
import { type Block, type ContentBlock } from 'mechanica-shared';
|
|
2
|
+
import { type PageDoc, type RichTextCodec } from 'mechanica-shared/page-format';
|
|
3
3
|
/** Shape of a page file under `<mech>/pages` (the parsed `.page.md` document). */
|
|
4
4
|
export type PageFile = PageDoc;
|
|
5
5
|
/** Configure the codec used to (de)serialize rich-text fields. Dev server only. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type QueryContext, type QuerySource } from '
|
|
1
|
+
import { type QueryContext, type QuerySource } from 'mechanica-shared';
|
|
2
2
|
/**
|
|
3
3
|
* The dev server's {@link QuerySource}: pages come live from the `.mech`
|
|
4
4
|
* store; `useFetch` URLs are fetched server-side (no CORS, matching how the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mechanica",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
4
|
"description": "Build Vue 3 websites with a visual block editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"prepublishOnly": "bun run build"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"
|
|
62
|
+
"mechanica-shared": "2.0.0-alpha.0",
|
|
63
63
|
"@vue/compiler-sfc": "^3.5.38",
|
|
64
64
|
"compact-json-schema": "^0.1.5",
|
|
65
65
|
"estree-walker": "^3.0.3",
|
package/src/cli/export.ts
CHANGED
|
Binary file
|
package/src/core/define-data.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inject, isReactive, shallowReactive } from 'vue'
|
|
2
2
|
import { unfoldSchema, type SchemaItem, type SchemaType } from 'compact-json-schema'
|
|
3
|
-
import { passDefaultValue } from '
|
|
3
|
+
import { passDefaultValue } from 'mechanica-shared'
|
|
4
4
|
import { mechanicaKey } from './state'
|
|
5
5
|
import { registerDataEntry } from './data-registry'
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createApp, createSSRApp, type App, type Component } from 'vue'
|
|
2
|
-
import type { State } from '
|
|
2
|
+
import type { State } from 'mechanica-shared'
|
|
3
3
|
import { createMechanica } from './create-mechanica'
|
|
4
4
|
import type { BlockLoaders } from './load-blocks'
|
|
5
5
|
import type { BlocksMap, MechanicaMode, QueryResolver } from './state'
|
package/src/core/field-types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type half of the built-in field registry: teaches compact-json-schema (and
|
|
3
3
|
* therefore `defineBlock`) what each custom format resolves to in TypeScript.
|
|
4
|
-
* The runtime half lives in
|
|
4
|
+
* The runtime half lives in `mechanica-shared` (`builtinFields`).
|
|
5
5
|
*/
|
|
6
6
|
declare module 'compact-json-schema' {
|
|
7
7
|
interface SchemaTypesMap {
|
package/src/core/link.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, defineComponent, h, inject, type PropType } from 'vue'
|
|
2
|
-
import type { PageLink } from '
|
|
2
|
+
import type { PageLink } from 'mechanica-shared'
|
|
3
3
|
import { mechanicaKey } from './state'
|
|
4
4
|
|
|
5
5
|
/** A string path, or a `smartLink`-shaped target. */
|
package/src/core/load-blocks.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from 'vue'
|
|
2
|
-
import { walkTree, type ContentBlock } from '
|
|
2
|
+
import { walkTree, type ContentBlock } from 'mechanica-shared'
|
|
3
3
|
import type { BlocksMap } from './state'
|
|
4
4
|
|
|
5
5
|
/** A dynamic import of one block SFC, from `virtual:mechanica/blocks` (build). */
|
package/src/core/preview.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createApp, defineComponent, h, type App, type Component } from 'vue'
|
|
2
2
|
import { unfoldSchema } from 'compact-json-schema'
|
|
3
|
-
import { buildPreviewData, type ContentBlock } from '
|
|
3
|
+
import { buildPreviewData, type ContentBlock } from 'mechanica-shared'
|
|
4
4
|
import { createMechanica } from './create-mechanica'
|
|
5
5
|
import { renderBlocks } from './render-blocks'
|
|
6
6
|
import type { BlocksMap } from './state'
|
package/src/core/router.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inject, shallowReactive, type ShallowRef } from 'vue'
|
|
2
|
-
import type { ContentBlock, State } from '
|
|
2
|
+
import type { ContentBlock, State } from 'mechanica-shared'
|
|
3
3
|
import { mechanicaKey, type MechanicaMode } from './state'
|
|
4
4
|
|
|
5
5
|
/** Minimal client router surface used by `<Link>`, `useRouter` and `useRoute`. */
|
package/src/core/state.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component, InjectionKey, ShallowRef } from 'vue'
|
|
2
|
-
import type { ContentBlock, PageMeta } from '
|
|
2
|
+
import type { ContentBlock, PageMeta } from 'mechanica-shared'
|
|
3
3
|
import type { MechanicaRouter } from './router'
|
|
4
4
|
|
|
5
5
|
/** Block components keyed by their `blockId`. */
|
package/src/editor/EditorApp.vue
CHANGED
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
|
|
153
153
|
<script setup lang="ts">
|
|
154
154
|
import { computed, nextTick, provide, ref, watch, onScopeDispose, type ShallowRef } from 'vue'
|
|
155
|
-
import type { DataEntry, State } from '
|
|
155
|
+
import type { DataEntry, State } from 'mechanica-shared'
|
|
156
156
|
import { createEditorStore, editorStoreKey } from './lib/store'
|
|
157
157
|
import { createDragController, dragKey } from './lib/drag-controller'
|
|
158
158
|
import { createHistory } from './lib/history'
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<script setup lang="ts">
|
|
58
58
|
import { computed, inject, onBeforeUnmount, ref } from 'vue'
|
|
59
59
|
import { useSearch } from 'vuesix'
|
|
60
|
-
import type { Block } from '
|
|
60
|
+
import type { Block } from 'mechanica-shared'
|
|
61
61
|
import type { BlocksMap } from '../../core/state'
|
|
62
62
|
import { editorStoreKey } from '../lib/store'
|
|
63
63
|
import { dragKey } from '../lib/drag-controller'
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
18
|
-
import type { Block } from '
|
|
18
|
+
import type { Block } from 'mechanica-shared'
|
|
19
19
|
import type { BlocksMap } from '../../core/state'
|
|
20
20
|
import { mountBlockPreview, type BlockPreviewHandle } from '../lib/block-preview'
|
|
21
21
|
import VIcon from './VIcon.vue'
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
<script setup lang="ts">
|
|
75
75
|
import { computed, inject, ref } from 'vue'
|
|
76
|
-
import type { DataScope } from '
|
|
76
|
+
import type { DataScope } from 'mechanica-shared'
|
|
77
77
|
import { editorStoreKey } from '../lib/store'
|
|
78
78
|
import SchemaForm from '../props-panel/SchemaForm.vue'
|
|
79
79
|
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
|
|
131
131
|
<script setup lang="ts">
|
|
132
132
|
import { computed, inject, nextTick } from 'vue'
|
|
133
|
-
import type { ContentBlock } from '
|
|
133
|
+
import type { ContentBlock } from 'mechanica-shared'
|
|
134
134
|
import { editorStoreKey } from '../lib/store'
|
|
135
135
|
import { dragKey } from '../lib/drag-controller'
|
|
136
136
|
import { contextMenuKey, type ContextMenuItem } from '../lib/context-menu'
|
package/src/editor/editor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createApp, shallowRef } from 'vue'
|
|
2
2
|
import { blocksList } from 'virtual:mechanica/blocks'
|
|
3
3
|
import { widgetsList } from 'virtual:mechanica/widgets'
|
|
4
|
-
import { registerFieldSchemas, type State } from '
|
|
4
|
+
import { registerFieldSchemas, type State } from 'mechanica-shared'
|
|
5
5
|
import { getDataEntries } from '../core/data-registry'
|
|
6
6
|
import { registerBuiltinFieldEditors } from './fields/builtin'
|
|
7
7
|
import { registerRichTextWidgets } from './fields/richtext/widgets'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unfoldSchema } from 'compact-json-schema'
|
|
2
|
-
import { getDefaultValue, type Block, type ContentBlock } from '
|
|
2
|
+
import { getDefaultValue, type Block, type ContentBlock } from 'mechanica-shared'
|
|
3
3
|
import { humanize } from '../props-panel/humanize'
|
|
4
4
|
import { uid } from './content-tree'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createApp, defineComponent, onErrorCaptured, ref, shallowRef } from 'vue'
|
|
2
|
-
import type { ContentBlock } from '
|
|
2
|
+
import type { ContentBlock } from 'mechanica-shared'
|
|
3
3
|
import { mechanicaKey, type BlocksMap, type MechanicaContext } from '../../core/state'
|
|
4
4
|
import { createRouter } from '../../core/router'
|
|
5
5
|
import { buildPreviewContent } from '../../core/preview'
|
package/src/editor/lib/bridge.ts
CHANGED
package/src/editor/lib/store.ts
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
|
|
57
57
|
<script setup lang="ts">
|
|
58
58
|
import { computed, ref } from 'vue'
|
|
59
|
-
import { getDefaultValue } from '
|
|
59
|
+
import { getDefaultValue } from 'mechanica-shared'
|
|
60
60
|
import SchemaForm from './SchemaForm.vue'
|
|
61
61
|
import VCollapse from './VCollapse.vue'
|
|
62
62
|
import FieldControl from '../fields/FieldControl.vue'
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
walkTree,
|
|
8
8
|
type Block,
|
|
9
9
|
type ContentBlock,
|
|
10
|
-
} from '
|
|
11
|
-
import { parsePage, serializePage, type PageDoc, type RichTextCodec } from '
|
|
10
|
+
} from 'mechanica-shared'
|
|
11
|
+
import { parsePage, serializePage, type PageDoc, type RichTextCodec } from 'mechanica-shared/page-format'
|
|
12
12
|
import { writeFileAtomic, markMutated } from './fs-utils'
|
|
13
13
|
|
|
14
14
|
/** Shape of a page file under `<mech>/pages` (the parsed `.page.md` document). */
|
package/src/vite/dev/preview.ts
CHANGED
package/src/vite/plugin.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join, relative } from 'node:path'
|
|
2
2
|
import type { Plugin } from 'vite'
|
|
3
3
|
import { parseVueRequest } from '@vitejs/plugin-vue'
|
|
4
|
-
import { passDataToHTML, serializeState } from '
|
|
4
|
+
import { passDataToHTML, serializeState } from 'mechanica-shared'
|
|
5
5
|
import { compileBlock } from '../compiler/compile-block'
|
|
6
6
|
import { collectBlocks, collectBlocksLazy } from './collect-blocks'
|
|
7
7
|
import { collectWidgets } from './collect-widgets'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { blocksToMarkdown, markdownToBlocks, type Block } from 'vuewrite/markdown'
|
|
2
|
-
import type { RichTextCodec } from '
|
|
2
|
+
import type { RichTextCodec } from 'mechanica-shared/page-format'
|
|
3
3
|
|
|
4
4
|
/** Just the bits of a compiled block component the codec needs. */
|
|
5
5
|
interface BlockLike {
|