@nubisco/cms-vue 1.0.0 → 1.2.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/dist/cms-vue.css +2 -0
- package/dist/index.d.ts +363 -4
- package/dist/index.js +453 -4
- package/package.json +17 -7
- package/dist/contract/content.d.ts +0 -119
- package/dist/contract/content.js +0 -11
- package/dist/contract/index.d.ts +0 -3
- package/dist/contract/index.js +0 -3
- package/dist/contract/logic.d.ts +0 -88
- package/dist/contract/logic.js +0 -63
- package/dist/evaluate.d.ts +0 -15
- package/dist/evaluate.js +0 -26
- package/dist/graph.d.ts +0 -45
- package/dist/graph.js +0 -130
- package/dist/resolve.d.ts +0 -10
- package/dist/resolve.js +0 -25
package/dist/index.js
CHANGED
|
@@ -1,4 +1,453 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, inject as s, normalizeClass as c, openBlock as l, provide as u, ref as d, renderList as f, renderSlot as p, resolveDynamicComponent as m, toDisplayString as h, unref as g, withCtx as _, withKeys as v, withModifiers as y } from "vue";
|
|
2
|
+
//#region src/contract/logic.ts
|
|
3
|
+
var b = [
|
|
4
|
+
{
|
|
5
|
+
id: "featureFlag",
|
|
6
|
+
label: "Feature flag",
|
|
7
|
+
valueType: "boolean",
|
|
8
|
+
params: { flag: {
|
|
9
|
+
type: "text",
|
|
10
|
+
label: "Flag key",
|
|
11
|
+
required: !0
|
|
12
|
+
} },
|
|
13
|
+
resolveAt: "build"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "environment",
|
|
17
|
+
label: "Environment",
|
|
18
|
+
valueType: "enum",
|
|
19
|
+
enumValues: ["staging", "production"],
|
|
20
|
+
resolveAt: "build"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "locale",
|
|
24
|
+
label: "Locale",
|
|
25
|
+
valueType: "enum",
|
|
26
|
+
enumValues: [
|
|
27
|
+
"en",
|
|
28
|
+
"pt",
|
|
29
|
+
"es",
|
|
30
|
+
"fr"
|
|
31
|
+
],
|
|
32
|
+
resolveAt: "build"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "schedule",
|
|
36
|
+
label: "Schedule window",
|
|
37
|
+
valueType: "date",
|
|
38
|
+
params: {
|
|
39
|
+
from: {
|
|
40
|
+
type: "date",
|
|
41
|
+
label: "From"
|
|
42
|
+
},
|
|
43
|
+
to: {
|
|
44
|
+
type: "date",
|
|
45
|
+
label: "To"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
resolveAt: "build"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "auth",
|
|
52
|
+
label: "Signed in",
|
|
53
|
+
valueType: "boolean",
|
|
54
|
+
resolveAt: "request"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "region",
|
|
58
|
+
label: "Region",
|
|
59
|
+
valueType: "enum",
|
|
60
|
+
enumValues: [
|
|
61
|
+
"EU",
|
|
62
|
+
"NA",
|
|
63
|
+
"SA",
|
|
64
|
+
"AS",
|
|
65
|
+
"AF",
|
|
66
|
+
"OC"
|
|
67
|
+
],
|
|
68
|
+
resolveAt: "request"
|
|
69
|
+
}
|
|
70
|
+
], x = {
|
|
71
|
+
featureFlag: {
|
|
72
|
+
label: "Feature flag",
|
|
73
|
+
color: "#6e6bd6",
|
|
74
|
+
category: "input",
|
|
75
|
+
ports: [{
|
|
76
|
+
id: "out",
|
|
77
|
+
label: "on",
|
|
78
|
+
type: "output"
|
|
79
|
+
}],
|
|
80
|
+
param: "flag"
|
|
81
|
+
},
|
|
82
|
+
environment: {
|
|
83
|
+
label: "Environment",
|
|
84
|
+
color: "#b9781e",
|
|
85
|
+
category: "input",
|
|
86
|
+
ports: [{
|
|
87
|
+
id: "out",
|
|
88
|
+
label: "is",
|
|
89
|
+
type: "output"
|
|
90
|
+
}],
|
|
91
|
+
param: "environment"
|
|
92
|
+
},
|
|
93
|
+
auth: {
|
|
94
|
+
label: "Signed in",
|
|
95
|
+
color: "#2c9560",
|
|
96
|
+
category: "input",
|
|
97
|
+
ports: [{
|
|
98
|
+
id: "out",
|
|
99
|
+
label: "yes",
|
|
100
|
+
type: "output"
|
|
101
|
+
}]
|
|
102
|
+
},
|
|
103
|
+
region: {
|
|
104
|
+
label: "Region",
|
|
105
|
+
color: "#3a86c8",
|
|
106
|
+
category: "input",
|
|
107
|
+
ports: [{
|
|
108
|
+
id: "out",
|
|
109
|
+
label: "in",
|
|
110
|
+
type: "output"
|
|
111
|
+
}],
|
|
112
|
+
param: "region"
|
|
113
|
+
},
|
|
114
|
+
and: {
|
|
115
|
+
label: "AND",
|
|
116
|
+
color: "#5a5a6a",
|
|
117
|
+
category: "gate",
|
|
118
|
+
ports: [
|
|
119
|
+
{
|
|
120
|
+
id: "a",
|
|
121
|
+
label: "a",
|
|
122
|
+
type: "input"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "b",
|
|
126
|
+
label: "b",
|
|
127
|
+
type: "input"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "out",
|
|
131
|
+
label: "out",
|
|
132
|
+
type: "output"
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
or: {
|
|
137
|
+
label: "OR",
|
|
138
|
+
color: "#5a5a6a",
|
|
139
|
+
category: "gate",
|
|
140
|
+
ports: [
|
|
141
|
+
{
|
|
142
|
+
id: "a",
|
|
143
|
+
label: "a",
|
|
144
|
+
type: "input"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "b",
|
|
148
|
+
label: "b",
|
|
149
|
+
type: "input"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "out",
|
|
153
|
+
label: "out",
|
|
154
|
+
type: "output"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
not: {
|
|
159
|
+
label: "NOT",
|
|
160
|
+
color: "#5a5a6a",
|
|
161
|
+
category: "gate",
|
|
162
|
+
ports: [{
|
|
163
|
+
id: "in",
|
|
164
|
+
label: "in",
|
|
165
|
+
type: "input"
|
|
166
|
+
}, {
|
|
167
|
+
id: "out",
|
|
168
|
+
label: "out",
|
|
169
|
+
type: "output"
|
|
170
|
+
}]
|
|
171
|
+
},
|
|
172
|
+
visible: {
|
|
173
|
+
label: "Visible",
|
|
174
|
+
color: "#c0392b",
|
|
175
|
+
category: "output",
|
|
176
|
+
ports: [{
|
|
177
|
+
id: "in",
|
|
178
|
+
label: "show",
|
|
179
|
+
type: "input"
|
|
180
|
+
}]
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
function S(e) {
|
|
184
|
+
return e.nodes.map((e) => {
|
|
185
|
+
let t = x[e.kind], n = e.param ? `${t.label}: ${e.param}` : t.label;
|
|
186
|
+
return {
|
|
187
|
+
id: e.id,
|
|
188
|
+
x: e.x,
|
|
189
|
+
y: e.y,
|
|
190
|
+
width: 160,
|
|
191
|
+
height: 52 + t.ports.length * 8,
|
|
192
|
+
paint: {
|
|
193
|
+
title: n,
|
|
194
|
+
color: t.color,
|
|
195
|
+
category: t.category,
|
|
196
|
+
ports: t.ports
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function C(e, t) {
|
|
202
|
+
let n = {}, r = (t, n) => e.connections.find((e) => e.toNode === t && e.toPort === n)?.fromNode, i = (e, t) => {
|
|
203
|
+
let n = r(e, t);
|
|
204
|
+
return n ? a(n) : !1;
|
|
205
|
+
};
|
|
206
|
+
function a(r) {
|
|
207
|
+
if (r in n) return n[r];
|
|
208
|
+
n[r] = !1;
|
|
209
|
+
let a = e.nodes.find((e) => e.id === r);
|
|
210
|
+
if (!a) return !1;
|
|
211
|
+
let o = !1;
|
|
212
|
+
switch (a.kind) {
|
|
213
|
+
case "featureFlag":
|
|
214
|
+
o = t.featureFlag?.({ flag: a.param ?? "" }, void 0, void 0) ?? !1;
|
|
215
|
+
break;
|
|
216
|
+
case "environment":
|
|
217
|
+
o = t.environment?.(void 0, "is", a.param ?? "staging") ?? !1;
|
|
218
|
+
break;
|
|
219
|
+
case "auth":
|
|
220
|
+
o = t.auth?.(void 0, void 0, void 0) ?? !1;
|
|
221
|
+
break;
|
|
222
|
+
case "region":
|
|
223
|
+
o = t.region?.(void 0, "in", [a.param ?? ""]) ?? !1;
|
|
224
|
+
break;
|
|
225
|
+
case "and":
|
|
226
|
+
o = i(r, "a") && i(r, "b");
|
|
227
|
+
break;
|
|
228
|
+
case "or":
|
|
229
|
+
o = i(r, "a") || i(r, "b");
|
|
230
|
+
break;
|
|
231
|
+
case "not":
|
|
232
|
+
o = !i(r, "in");
|
|
233
|
+
break;
|
|
234
|
+
case "visible": o = i(r, "in");
|
|
235
|
+
}
|
|
236
|
+
return n[r] = o, o;
|
|
237
|
+
}
|
|
238
|
+
let o = e.nodes.find((e) => e.kind === "visible"), s = {};
|
|
239
|
+
for (let t of e.nodes) s[t.id] = a(t.id);
|
|
240
|
+
return {
|
|
241
|
+
visible: o ? a(o.id) : !1,
|
|
242
|
+
nodeOut: s
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/evaluate.ts
|
|
247
|
+
function w(e, t, n) {
|
|
248
|
+
if (!e || e.kind === "always") return !0;
|
|
249
|
+
switch (e.kind) {
|
|
250
|
+
case "simple": {
|
|
251
|
+
let n = t[e.input];
|
|
252
|
+
return n ? n(e.params, e.op, e.value) : !1;
|
|
253
|
+
}
|
|
254
|
+
case "all": return e.of.every((e) => w(e, t, n));
|
|
255
|
+
case "any": return e.of.some((e) => w(e, t, n));
|
|
256
|
+
case "not": return !w(e.of, t, n);
|
|
257
|
+
case "graph": {
|
|
258
|
+
let r = n?.[e.graphId];
|
|
259
|
+
return !r || C(r, t).visible;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/resolve.ts
|
|
265
|
+
function T(e) {
|
|
266
|
+
return typeof e == "object" && !!e && "$t" in e;
|
|
267
|
+
}
|
|
268
|
+
function E(e) {
|
|
269
|
+
return typeof e == "object" && !!e && "src" in e;
|
|
270
|
+
}
|
|
271
|
+
function D(e) {
|
|
272
|
+
return typeof e == "object" && !!e && "href" in e;
|
|
273
|
+
}
|
|
274
|
+
function O(e, t) {
|
|
275
|
+
return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : T(e) ? t[e.$t] ?? e.$t : "";
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/context.ts
|
|
279
|
+
var k = Symbol("cms-context");
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/useField.ts
|
|
282
|
+
function A() {
|
|
283
|
+
let e = s(k, {
|
|
284
|
+
messages: {},
|
|
285
|
+
editing: !1,
|
|
286
|
+
setText: () => {}
|
|
287
|
+
});
|
|
288
|
+
return { t: (t) => O(t, e.messages) };
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/CmsText.vue?vue&type=script&setup=true&lang.ts
|
|
292
|
+
var j = [
|
|
293
|
+
"data-cms-block",
|
|
294
|
+
"data-cms-field",
|
|
295
|
+
"onKeydown"
|
|
296
|
+
], M = { key: 1 }, N = /*@__PURE__*/ o({
|
|
297
|
+
__name: "CmsText",
|
|
298
|
+
props: {
|
|
299
|
+
block: {},
|
|
300
|
+
field: {}
|
|
301
|
+
},
|
|
302
|
+
setup(e) {
|
|
303
|
+
let n = e, r = s(k, {
|
|
304
|
+
messages: {},
|
|
305
|
+
editing: !1,
|
|
306
|
+
setText: () => {}
|
|
307
|
+
}), a = t(() => n.block.fields[n.field]), o = t(() => O(a.value, r.messages)), c = d(null);
|
|
308
|
+
function u() {
|
|
309
|
+
let e = c.value?.innerText.trim() ?? "";
|
|
310
|
+
e !== o.value && r.setText(n.block, n.field, a.value, e), c.value?.blur();
|
|
311
|
+
}
|
|
312
|
+
return (t, n) => g(r).editing ? (l(), i("span", {
|
|
313
|
+
key: 0,
|
|
314
|
+
ref_key: "el",
|
|
315
|
+
ref: c,
|
|
316
|
+
class: "cms-text cms-text--editing",
|
|
317
|
+
"data-cms-block": e.block.id,
|
|
318
|
+
"data-cms-field": e.field,
|
|
319
|
+
contenteditable: "plaintext-only",
|
|
320
|
+
role: "textbox",
|
|
321
|
+
tabindex: "0",
|
|
322
|
+
onBlur: u,
|
|
323
|
+
onKeydown: v(y(u, ["prevent"]), ["enter"])
|
|
324
|
+
}, h(o.value), 41, j)) : (l(), i("span", M, h(o.value), 1));
|
|
325
|
+
}
|
|
326
|
+
}), P = (e, t) => {
|
|
327
|
+
let n = e.__vccOpts || e;
|
|
328
|
+
for (let [e, r] of t) n[e] = r;
|
|
329
|
+
return n;
|
|
330
|
+
}, F = /*#__PURE__*/ P(N, [["__scopeId", "data-v-57962fd1"]]), I = { class: "bf__type" }, L = {
|
|
331
|
+
key: 0,
|
|
332
|
+
class: "bf__badge"
|
|
333
|
+
}, R = ["disabled"], z = ["disabled"], B = { class: "bf__body" }, V = /*#__PURE__*/ P(/* @__PURE__ */ o({
|
|
334
|
+
__name: "BlockFrame",
|
|
335
|
+
props: {
|
|
336
|
+
label: {},
|
|
337
|
+
hidden: { type: Boolean },
|
|
338
|
+
isFirst: { type: Boolean },
|
|
339
|
+
isLast: { type: Boolean },
|
|
340
|
+
selected: { type: Boolean }
|
|
341
|
+
},
|
|
342
|
+
emits: [
|
|
343
|
+
"up",
|
|
344
|
+
"down",
|
|
345
|
+
"select"
|
|
346
|
+
],
|
|
347
|
+
setup(e) {
|
|
348
|
+
return (t, n) => (l(), i("div", { class: c(["bf", {
|
|
349
|
+
"bf--dim": e.hidden,
|
|
350
|
+
"bf--selected": e.selected
|
|
351
|
+
}]) }, [a("div", {
|
|
352
|
+
class: "bf__bar",
|
|
353
|
+
onClick: n[2] ||= (e) => t.$emit("select")
|
|
354
|
+
}, [
|
|
355
|
+
n[3] ||= a("span", {
|
|
356
|
+
class: "bf__grip",
|
|
357
|
+
"aria-hidden": "true"
|
|
358
|
+
}, "⠿", -1),
|
|
359
|
+
a("span", I, h(e.label), 1),
|
|
360
|
+
e.hidden ? (l(), i("span", L, "hidden by condition")) : r("", !0),
|
|
361
|
+
n[4] ||= a("span", { class: "bf__spacer" }, null, -1),
|
|
362
|
+
a("button", {
|
|
363
|
+
class: "bf__btn",
|
|
364
|
+
type: "button",
|
|
365
|
+
disabled: e.isFirst,
|
|
366
|
+
title: "Move up",
|
|
367
|
+
onClick: n[0] ||= y((e) => t.$emit("up"), ["stop"])
|
|
368
|
+
}, " ↑ ", 8, R),
|
|
369
|
+
a("button", {
|
|
370
|
+
class: "bf__btn",
|
|
371
|
+
type: "button",
|
|
372
|
+
disabled: e.isLast,
|
|
373
|
+
title: "Move down",
|
|
374
|
+
onClick: n[1] ||= y((e) => t.$emit("down"), ["stop"])
|
|
375
|
+
}, " ↓ ", 8, z)
|
|
376
|
+
]), a("div", B, [p(t.$slots, "default", {}, void 0, !0)])], 2));
|
|
377
|
+
}
|
|
378
|
+
}), [["__scopeId", "data-v-22d52899"]]), H = { class: "cms-zone" }, U = {
|
|
379
|
+
key: 1,
|
|
380
|
+
class: "cms-zone__missing"
|
|
381
|
+
}, W = {
|
|
382
|
+
key: 1,
|
|
383
|
+
class: "cms-zone__missing"
|
|
384
|
+
}, G = /*#__PURE__*/ P(/* @__PURE__ */ o({
|
|
385
|
+
__name: "CmsZone",
|
|
386
|
+
props: {
|
|
387
|
+
zone: {},
|
|
388
|
+
registry: {},
|
|
389
|
+
messages: {},
|
|
390
|
+
env: {},
|
|
391
|
+
editing: { type: Boolean },
|
|
392
|
+
selectedId: {},
|
|
393
|
+
graphs: {},
|
|
394
|
+
setText: { type: Function }
|
|
395
|
+
},
|
|
396
|
+
emits: ["select"],
|
|
397
|
+
setup(r, { emit: a }) {
|
|
398
|
+
let o = r, s = a;
|
|
399
|
+
u(k, {
|
|
400
|
+
get messages() {
|
|
401
|
+
return o.messages;
|
|
402
|
+
},
|
|
403
|
+
get editing() {
|
|
404
|
+
return o.editing ?? !1;
|
|
405
|
+
},
|
|
406
|
+
setText: (e, t, n, r) => o.setText?.(e, t, n, r)
|
|
407
|
+
});
|
|
408
|
+
function c(e) {
|
|
409
|
+
return w(e.when, o.env, o.graphs);
|
|
410
|
+
}
|
|
411
|
+
let d = t(() => o.zone.blocks.filter(c));
|
|
412
|
+
function p(e) {
|
|
413
|
+
return e.type + (e.variation ? ` · ${e.variation}` : "");
|
|
414
|
+
}
|
|
415
|
+
function g(e, t) {
|
|
416
|
+
let n = o.zone.blocks;
|
|
417
|
+
if (t < 0 || t >= n.length) return;
|
|
418
|
+
let [r] = n.splice(e, 1);
|
|
419
|
+
n.splice(t, 0, r);
|
|
420
|
+
}
|
|
421
|
+
return (t, a) => (l(), i("div", H, [r.editing ? (l(!0), i(e, { key: 0 }, f(r.zone.blocks, (e, t) => (l(), n(V, {
|
|
422
|
+
key: e.id,
|
|
423
|
+
label: p(e),
|
|
424
|
+
hidden: !c(e),
|
|
425
|
+
"is-first": t === 0,
|
|
426
|
+
"is-last": t === r.zone.blocks.length - 1,
|
|
427
|
+
selected: e.id === r.selectedId,
|
|
428
|
+
onUp: (e) => g(t, t - 1),
|
|
429
|
+
onDown: (e) => g(t, t + 1),
|
|
430
|
+
onSelect: (t) => s("select", e.id)
|
|
431
|
+
}, {
|
|
432
|
+
default: _(() => [r.registry[e.type] ? (l(), n(m(r.registry[e.type]), {
|
|
433
|
+
key: 0,
|
|
434
|
+
block: e
|
|
435
|
+
}, null, 8, ["block"])) : (l(), i("div", U, "Unknown block type: " + h(e.type), 1))]),
|
|
436
|
+
_: 2
|
|
437
|
+
}, 1032, [
|
|
438
|
+
"label",
|
|
439
|
+
"hidden",
|
|
440
|
+
"is-first",
|
|
441
|
+
"is-last",
|
|
442
|
+
"selected",
|
|
443
|
+
"onUp",
|
|
444
|
+
"onDown",
|
|
445
|
+
"onSelect"
|
|
446
|
+
]))), 128)) : (l(!0), i(e, { key: 1 }, f(d.value, (t) => (l(), i(e, { key: t.id }, [r.registry[t.type] ? (l(), n(m(r.registry[t.type]), {
|
|
447
|
+
key: 0,
|
|
448
|
+
block: t
|
|
449
|
+
}, null, 8, ["block"])) : (l(), i("div", W, "Unknown block type: " + h(t.type), 1))], 64))), 128))]));
|
|
450
|
+
}
|
|
451
|
+
}), [["__scopeId", "data-v-b1bd4d10"]]);
|
|
452
|
+
//#endregion
|
|
453
|
+
export { k as CMS_CONTEXT, b as CORE_LOGIC_INPUTS, F as CmsText, G as CmsZone, x as NODE_SPECS, w as evaluate, C as evaluateGraph, E as isImage, D as isLink, T as isTRef, O as text, S as toCards, A as useField };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubisco/cms-vue",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Nubisco CMS content contract
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Nubisco CMS content contract, evaluator, and Vue render kit.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -10,26 +10,36 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"packageManager": "pnpm@10.33.0",
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
|
+
"module": "./dist/index.js",
|
|
13
14
|
"types": "./dist/index.d.ts",
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
16
17
|
"types": "./dist/index.d.ts",
|
|
17
18
|
"default": "./dist/index.js"
|
|
18
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./style.css": "./dist/cms-vue.css"
|
|
19
21
|
},
|
|
20
22
|
"files": [
|
|
21
23
|
"dist"
|
|
22
24
|
],
|
|
23
25
|
"scripts": {
|
|
24
|
-
"build": "
|
|
25
|
-
"types:check": "tsc --noEmit"
|
|
26
|
-
|
|
26
|
+
"build": "vite build",
|
|
27
|
+
"types:check": "vue-tsc --noEmit"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"vue": "^3.4.0"
|
|
27
31
|
},
|
|
28
32
|
"devDependencies": {
|
|
29
33
|
"@semantic-release/changelog": "^6.0.3",
|
|
30
34
|
"@semantic-release/git": "^10.0.1",
|
|
35
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
36
|
+
"sass-embedded": "^1.102.0",
|
|
31
37
|
"semantic-release": "^25.0.3",
|
|
32
|
-
"typescript": "^5.9.3"
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vite": "^8.0.2",
|
|
40
|
+
"vite-plugin-dts": "^4.5.4",
|
|
41
|
+
"vue": "^3.5.30",
|
|
42
|
+
"vue-tsc": "^3.2.6"
|
|
33
43
|
},
|
|
34
44
|
"publishConfig": {
|
|
35
45
|
"access": "public"
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Content contract: the framework-agnostic shape of Nubisco CMS content.
|
|
3
|
-
*
|
|
4
|
-
* This is the crown jewel of the system. The CMS edits documents of this shape,
|
|
5
|
-
* and any renderer (Vue first, others later) is just a function from these types
|
|
6
|
-
* to a rendered page. Nothing here mentions Vue on purpose.
|
|
7
|
-
*
|
|
8
|
-
* Vocabulary: Fields (primitives) compose into Blocks (placeable units), which
|
|
9
|
-
* are ordered inside Zones on a Page.
|
|
10
|
-
*/
|
|
11
|
-
export type FieldType = 'text' | 'richtext' | 'number' | 'boolean' | 'image' | 'link' | 'color' | 'date' | 'select';
|
|
12
|
-
/** A field's schema: what a Block declares it accepts. */
|
|
13
|
-
export interface FieldSchema {
|
|
14
|
-
type: FieldType;
|
|
15
|
-
/** Editor-facing label. */
|
|
16
|
-
label: string;
|
|
17
|
-
help?: string;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Whether the value is per-locale. Text/richtext default to true and are
|
|
21
|
-
* stored by reference (see TRef) so Verba owns the translations. Media,
|
|
22
|
-
* numbers, and booleans default to false.
|
|
23
|
-
*/
|
|
24
|
-
localized?: boolean;
|
|
25
|
-
/** Allowed values for `select`. */
|
|
26
|
-
options?: string[];
|
|
27
|
-
default?: unknown;
|
|
28
|
-
/** Max length for text, or max value for number. */
|
|
29
|
-
max?: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* A reference to an i18n key. Localized strings are never inlined into content;
|
|
33
|
-
* they resolve from Verba / the site's locale JSON at render time. This keeps
|
|
34
|
-
* Verba authoritative and the content documents small, and it matches how the
|
|
35
|
-
* existing sites already use vue-i18n keys.
|
|
36
|
-
*/
|
|
37
|
-
export interface TRef {
|
|
38
|
-
$t: string;
|
|
39
|
-
}
|
|
40
|
-
export interface ImageValue {
|
|
41
|
-
src: string;
|
|
42
|
-
alt?: TRef;
|
|
43
|
-
/** Intrinsic size, when known, to avoid layout shift. */
|
|
44
|
-
w?: number;
|
|
45
|
-
h?: number;
|
|
46
|
-
}
|
|
47
|
-
export interface LinkValue {
|
|
48
|
-
href: string;
|
|
49
|
-
label?: TRef;
|
|
50
|
-
external?: boolean;
|
|
51
|
-
}
|
|
52
|
-
export type FieldValue = TRef | string | number | boolean | ImageValue | LinkValue;
|
|
53
|
-
export type BlockKind =
|
|
54
|
-
/** Fields only, assembled in the CMS. No app code required. */
|
|
55
|
-
'composed'
|
|
56
|
-
/** Backed by an app component (anything with behavior, e.g. a form). */
|
|
57
|
-
| 'coded';
|
|
58
|
-
export type BlockCategory = 'content' | 'media' | 'form' | 'layout';
|
|
59
|
-
export interface BlockVariation {
|
|
60
|
-
id: string;
|
|
61
|
-
label: string;
|
|
62
|
-
/** Field values this variation presets (a footer subscribe vs a hero one). */
|
|
63
|
-
presets?: Record<string, FieldValue>;
|
|
64
|
-
}
|
|
65
|
-
/** A named region inside a composed block that nests other blocks. */
|
|
66
|
-
export interface SlotSchema {
|
|
67
|
-
label: string;
|
|
68
|
-
/** Block types allowed in this slot. Omit to allow any. */
|
|
69
|
-
allow?: string[];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* A block type definition, registered once. The editor catalog, the inspector
|
|
73
|
-
* fields, validation, and serialization all derive from this, mirroring how the
|
|
74
|
-
* NubiscoUI Blueprint system derives everything from a NodeDefinition.
|
|
75
|
-
*
|
|
76
|
-
* Coded blocks map `type` to a real component through a per-framework registry
|
|
77
|
-
* that lives in the renderer package, not in this contract.
|
|
78
|
-
*/
|
|
79
|
-
export interface BlockDefinition {
|
|
80
|
-
type: string;
|
|
81
|
-
label: string;
|
|
82
|
-
kind: BlockKind;
|
|
83
|
-
category?: BlockCategory;
|
|
84
|
-
icon?: string;
|
|
85
|
-
fields: Record<string, FieldSchema>;
|
|
86
|
-
variations?: BlockVariation[];
|
|
87
|
-
slots?: Record<string, SlotSchema>;
|
|
88
|
-
}
|
|
89
|
-
/** A block as it appears in a content document. */
|
|
90
|
-
export interface BlockInstance {
|
|
91
|
-
/** Stable id: survives reorder, used for deep links and in-place edit targeting. */
|
|
92
|
-
id: string;
|
|
93
|
-
type: string;
|
|
94
|
-
variation?: string;
|
|
95
|
-
fields: Record<string, FieldValue>;
|
|
96
|
-
/** Visibility logic. Absent means always visible. */
|
|
97
|
-
when?: import('./logic').Condition;
|
|
98
|
-
/** Nested blocks for composed blocks with slots. */
|
|
99
|
-
slots?: Record<string, BlockInstance[]>;
|
|
100
|
-
}
|
|
101
|
-
/** An ordered list of blocks. Array order is render order and reorder order. */
|
|
102
|
-
export interface Zone {
|
|
103
|
-
blocks: BlockInstance[];
|
|
104
|
-
}
|
|
105
|
-
export interface PageDocument {
|
|
106
|
-
route: string;
|
|
107
|
-
meta?: {
|
|
108
|
-
title?: TRef;
|
|
109
|
-
description?: TRef;
|
|
110
|
-
/** Page renders its own newsletter, so the footer one is suppressed. */
|
|
111
|
-
ownNewsletter?: boolean;
|
|
112
|
-
};
|
|
113
|
-
/** Named zones, usually just `main`. */
|
|
114
|
-
zones: Record<string, Zone>;
|
|
115
|
-
/** Whole-page gate, e.g. a product feature flag. */
|
|
116
|
-
when?: import('./logic').Condition;
|
|
117
|
-
/** Logic graphs referenced by block/page conditions via { kind: 'graph', graphId }. */
|
|
118
|
-
graphs?: Record<string, import('./logic').LogicGraph>;
|
|
119
|
-
}
|
package/dist/contract/content.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Content contract: the framework-agnostic shape of Nubisco CMS content.
|
|
3
|
-
*
|
|
4
|
-
* This is the crown jewel of the system. The CMS edits documents of this shape,
|
|
5
|
-
* and any renderer (Vue first, others later) is just a function from these types
|
|
6
|
-
* to a rendered page. Nothing here mentions Vue on purpose.
|
|
7
|
-
*
|
|
8
|
-
* Vocabulary: Fields (primitives) compose into Blocks (placeable units), which
|
|
9
|
-
* are ordered inside Zones on a Page.
|
|
10
|
-
*/
|
|
11
|
-
export {};
|
package/dist/contract/index.d.ts
DELETED
package/dist/contract/index.js
DELETED