@niscorp/nova 0.2.0 → 0.2.2
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/CHANGELOG.md +61 -0
- package/README.md +56 -13
- package/SHELL_DOCS.md +13 -4
- package/dist/adapters/dom/components/index.cjs +4 -51
- package/dist/adapters/dom/components/index.cjs.map +1 -1
- package/dist/adapters/dom/index.cjs +22 -686
- package/dist/adapters/dom/index.cjs.map +1 -1
- package/dist/adapters/dom/index.js +2 -2
- package/dist/adapters/dom/server.cjs +14 -411
- package/dist/adapters/dom/server.cjs.map +1 -1
- package/dist/adapters/dom/server.js +2 -2
- package/dist/adapters/react/components/index.cjs +87 -562
- package/dist/adapters/react/components/index.cjs.map +1 -1
- package/dist/adapters/react/components/index.d.cts +2 -2
- package/dist/adapters/react/components/index.d.ts +2 -2
- package/dist/adapters/react/components/index.js +3 -3
- package/dist/adapters/react/index.cjs +97 -1815
- package/dist/adapters/react/index.cjs.map +1 -1
- package/dist/adapters/react/index.js +3 -3
- package/dist/adapters/tty/components/index.cjs +3 -44
- package/dist/adapters/tty/components/index.cjs.map +1 -1
- package/dist/adapters/tty/index.cjs +13 -5
- package/dist/adapters/tty/index.cjs.map +1 -1
- package/dist/adapters/tty/index.js +1 -1
- package/dist/adapters/vue/components/index.cjs +88 -639
- package/dist/adapters/vue/components/index.cjs.map +1 -1
- package/dist/adapters/vue/components/index.d.cts +10 -10
- package/dist/adapters/vue/components/index.d.ts +10 -10
- package/dist/adapters/vue/components/index.js +3 -3
- package/dist/adapters/vue/index.cjs +96 -962
- package/dist/adapters/vue/index.cjs.map +1 -1
- package/dist/adapters/vue/index.js +4 -4
- package/dist/agent/index.cjs +13 -151
- package/dist/agent/index.cjs.map +1 -1
- package/dist/chunk-3IPM5QBT.cjs +436 -0
- package/dist/chunk-3IPM5QBT.cjs.map +1 -0
- package/dist/chunk-5AF72LOE.cjs +97 -0
- package/dist/chunk-5AF72LOE.cjs.map +1 -0
- package/dist/chunk-5YQIAS4V.cjs +184 -0
- package/dist/chunk-5YQIAS4V.cjs.map +1 -0
- package/dist/chunk-D4PUWBN6.cjs +72 -0
- package/dist/chunk-D4PUWBN6.cjs.map +1 -0
- package/dist/{chunk-RYIIIXDX.js → chunk-DU2VIJAF.js} +57 -15
- package/dist/chunk-DU2VIJAF.js.map +1 -0
- package/dist/{chunk-VU6NNCEJ.js → chunk-F2H7WP6R.js} +4 -4
- package/dist/{chunk-VU6NNCEJ.js.map → chunk-F2H7WP6R.js.map} +1 -1
- package/dist/chunk-FSUMCJAR.cjs +646 -0
- package/dist/chunk-FSUMCJAR.cjs.map +1 -0
- package/dist/{chunk-QXQCPH33.js → chunk-G4LSLLGI.js} +4 -4
- package/dist/{chunk-QXQCPH33.js.map → chunk-G4LSLLGI.js.map} +1 -1
- package/dist/chunk-GV7UC3SS.cjs +33 -0
- package/dist/chunk-GV7UC3SS.cjs.map +1 -0
- package/dist/chunk-IZ2UU5UL.cjs +808 -0
- package/dist/chunk-IZ2UU5UL.cjs.map +1 -0
- package/dist/chunk-KOYRJXTI.cjs +123 -0
- package/dist/chunk-KOYRJXTI.cjs.map +1 -0
- package/dist/chunk-KW34ZKF5.cjs +12 -0
- package/dist/chunk-KW34ZKF5.cjs.map +1 -0
- package/dist/chunk-OE527MXF.cjs +49 -0
- package/dist/chunk-OE527MXF.cjs.map +1 -0
- package/dist/chunk-OO247V4J.cjs +2117 -0
- package/dist/chunk-OO247V4J.cjs.map +1 -0
- package/dist/chunk-PMKWYOOX.cjs +64 -0
- package/dist/chunk-PMKWYOOX.cjs.map +1 -0
- package/dist/chunk-PNQY6OFB.cjs +132 -0
- package/dist/chunk-PNQY6OFB.cjs.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/{chunk-MHW5VEIM.js → chunk-SVNK5NIK.js} +3 -3
- package/dist/{chunk-MHW5VEIM.js.map → chunk-SVNK5NIK.js.map} +1 -1
- package/dist/chunk-TMLNVU5W.cjs +318 -0
- package/dist/chunk-TMLNVU5W.cjs.map +1 -0
- package/dist/chunk-TRJYDVWK.cjs +623 -0
- package/dist/chunk-TRJYDVWK.cjs.map +1 -0
- package/dist/chunk-UGG7MCX4.cjs +34 -0
- package/dist/chunk-UGG7MCX4.cjs.map +1 -0
- package/dist/{chunk-UDCXGDLQ.js → chunk-VOD5JA4D.js} +3 -3
- package/dist/{chunk-UDCXGDLQ.js.map → chunk-VOD5JA4D.js.map} +1 -1
- package/dist/chunk-WGPFR7MN.cjs +808 -0
- package/dist/chunk-WGPFR7MN.cjs.map +1 -0
- package/dist/chunk-WGZZKCJQ.cjs +157 -0
- package/dist/chunk-WGZZKCJQ.cjs.map +1 -0
- package/dist/chunk-XQTI4Q4I.js +178 -0
- package/dist/chunk-XQTI4Q4I.js.map +1 -0
- package/dist/devtools/index.cjs +13 -697
- package/dist/devtools/index.cjs.map +1 -1
- package/dist/document/index.cjs +56 -301
- package/dist/document/index.cjs.map +1 -1
- package/dist/examples/index.cjs +1161 -0
- package/dist/examples/index.cjs.map +1 -0
- package/dist/examples/index.d.cts +63 -0
- package/dist/examples/index.d.ts +63 -0
- package/dist/examples/index.js +1158 -0
- package/dist/examples/index.js.map +1 -0
- package/dist/i18n/index.cjs +44 -292
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.js +2 -176
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +335 -3911
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -1
- package/dist/migrations/index.cjs +7 -590
- package/dist/migrations/index.cjs.map +1 -1
- package/dist/reflect/index.cjs +85 -994
- package/dist/reflect/index.cjs.map +1 -1
- package/package.json +19 -8
- package/dist/chunk-RYIIIXDX.js.map +0 -1
- package/dist/{primitive-props-CGoJvmcH.d.cts → primitive-props-Cl5jiC8g.d.cts} +5 -5
- package/dist/{primitive-props-CGoJvmcH.d.ts → primitive-props-Cl5jiC8g.d.ts} +5 -5
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5AF72LOE_cjs = require('./chunk-5AF72LOE.cjs');
|
|
4
|
+
var chunkOO247V4J_cjs = require('./chunk-OO247V4J.cjs');
|
|
5
|
+
var chunkPNQY6OFB_cjs = require('./chunk-PNQY6OFB.cjs');
|
|
6
|
+
var chunkIZ2UU5UL_cjs = require('./chunk-IZ2UU5UL.cjs');
|
|
7
|
+
var vue = require('vue');
|
|
8
|
+
|
|
9
|
+
var px = (value) => `${value ?? 0}px`;
|
|
10
|
+
var ALIGN_MAP = {
|
|
11
|
+
start: "flex-start",
|
|
12
|
+
center: "center",
|
|
13
|
+
end: "flex-end",
|
|
14
|
+
stretch: "stretch"
|
|
15
|
+
};
|
|
16
|
+
var JUSTIFY_MAP = {
|
|
17
|
+
start: "flex-start",
|
|
18
|
+
center: "center",
|
|
19
|
+
end: "flex-end",
|
|
20
|
+
between: "space-between",
|
|
21
|
+
around: "space-around"
|
|
22
|
+
};
|
|
23
|
+
var Stack = Object.assign(
|
|
24
|
+
vue.defineComponent(
|
|
25
|
+
(props, { slots }) => () => vue.h(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
style: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
flexDirection: props.direction ?? "column",
|
|
31
|
+
gap: px(props.gap),
|
|
32
|
+
alignItems: ALIGN_MAP[props.align ?? "stretch"],
|
|
33
|
+
justifyContent: JUSTIFY_MAP[props.justify ?? "start"],
|
|
34
|
+
padding: px(props.padding),
|
|
35
|
+
flexWrap: props.wrap === true ? "wrap" : "nowrap"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
slots.default?.()
|
|
39
|
+
),
|
|
40
|
+
{ name: "NovaStack", props: ["direction", "gap", "align", "justify", "padding", "wrap"], inheritAttrs: false }
|
|
41
|
+
),
|
|
42
|
+
{ meta: { description: "Flex container that arranges children in a row or column.", propsSchema: chunk5AF72LOE_cjs.StackPropsSchema } }
|
|
43
|
+
);
|
|
44
|
+
var Box = Object.assign(
|
|
45
|
+
vue.defineComponent(
|
|
46
|
+
(props, { slots }) => () => vue.h(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
style: {
|
|
50
|
+
padding: px(props.padding),
|
|
51
|
+
background: props.background ?? "transparent",
|
|
52
|
+
border: props.border === true ? "1px solid #e5e7eb" : "none",
|
|
53
|
+
borderRadius: px(props.radius)
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
slots.default?.()
|
|
57
|
+
),
|
|
58
|
+
{ name: "NovaBox", props: ["padding", "background", "border", "radius"], inheritAttrs: false }
|
|
59
|
+
),
|
|
60
|
+
{
|
|
61
|
+
meta: {
|
|
62
|
+
description: "Generic container with basic styling props. Use Stack for layout, Box for visual wrapping.",
|
|
63
|
+
propsSchema: chunk5AF72LOE_cjs.BoxPropsSchema
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
var SIZE_MAP = {
|
|
68
|
+
sm: "12px",
|
|
69
|
+
md: "14px",
|
|
70
|
+
lg: "16px",
|
|
71
|
+
xl: "20px",
|
|
72
|
+
"2xl": "24px"
|
|
73
|
+
};
|
|
74
|
+
var WEIGHT_MAP = {
|
|
75
|
+
normal: 400,
|
|
76
|
+
medium: 500,
|
|
77
|
+
bold: 700
|
|
78
|
+
};
|
|
79
|
+
var Text = Object.assign(
|
|
80
|
+
vue.defineComponent(
|
|
81
|
+
(props, { slots }) => () => vue.h(
|
|
82
|
+
props.as ?? "span",
|
|
83
|
+
{
|
|
84
|
+
style: {
|
|
85
|
+
fontSize: SIZE_MAP[props.size ?? "md"],
|
|
86
|
+
fontWeight: WEIGHT_MAP[props.weight ?? "normal"],
|
|
87
|
+
color: props.color ?? "inherit"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
slots.default?.()
|
|
91
|
+
),
|
|
92
|
+
{ name: "NovaText", props: ["as", "size", "weight", "color"], inheritAttrs: false }
|
|
93
|
+
),
|
|
94
|
+
{ meta: { description: "Text element with semantic typography props.", propsSchema: chunk5AF72LOE_cjs.TextPropsSchema } }
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// src/adapters/vue/context.ts
|
|
98
|
+
var NovaRenderKey = /* @__PURE__ */ Symbol.for("@niscorp/nova/adapters/vue:render");
|
|
99
|
+
var NovaShellKey = /* @__PURE__ */ Symbol.for("@niscorp/nova/adapters/vue:shell");
|
|
100
|
+
|
|
101
|
+
// src/adapters/vue/composables/context.ts
|
|
102
|
+
var renderContext = (caller) => {
|
|
103
|
+
const ctx = vue.inject(NovaRenderKey, void 0);
|
|
104
|
+
if (ctx === void 0) throw new Error(`${caller} must be used inside <NovaRenderProvider>`);
|
|
105
|
+
return ctx;
|
|
106
|
+
};
|
|
107
|
+
var useNovaDispatch = () => {
|
|
108
|
+
const ctx = renderContext("useNovaDispatch");
|
|
109
|
+
return (event) => ctx.dispatch(event);
|
|
110
|
+
};
|
|
111
|
+
var useNovaPublish = () => {
|
|
112
|
+
const ctx = renderContext("useNovaPublish");
|
|
113
|
+
return (channel, payload) => ctx.publish(channel, payload);
|
|
114
|
+
};
|
|
115
|
+
var useNovaRegistry = () => renderContext("useNovaRegistry").registry;
|
|
116
|
+
var useSlotWrapper = () => vue.inject(NovaRenderKey, void 0)?.slotWrapper;
|
|
117
|
+
var useShellSource = () => {
|
|
118
|
+
const source = vue.inject(NovaShellKey, void 0);
|
|
119
|
+
if (source === void 0) throw new Error("useShell must be used inside <NovaShellProvider>");
|
|
120
|
+
return source;
|
|
121
|
+
};
|
|
122
|
+
var useShell = () => useShellSource().shell;
|
|
123
|
+
|
|
124
|
+
// src/adapters/vue/components/controls.ts
|
|
125
|
+
var BASE_STYLE = {
|
|
126
|
+
borderRadius: "6px",
|
|
127
|
+
fontSize: "14px",
|
|
128
|
+
fontWeight: 500,
|
|
129
|
+
transition: "background-color 100ms"
|
|
130
|
+
};
|
|
131
|
+
var buttonStyle = (variant, isDisabled, isHovered, isActive) => {
|
|
132
|
+
const cursor = isDisabled ? "not-allowed" : "pointer";
|
|
133
|
+
if (variant === "primary") {
|
|
134
|
+
return {
|
|
135
|
+
...BASE_STYLE,
|
|
136
|
+
padding: "8px 16px",
|
|
137
|
+
border: "none",
|
|
138
|
+
color: "#ffffff",
|
|
139
|
+
cursor,
|
|
140
|
+
background: isDisabled ? "#93c5fd" : isActive ? "#1e40af" : isHovered ? "#1d4ed8" : "#2563eb"
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
if (variant === "secondary") {
|
|
144
|
+
return {
|
|
145
|
+
...BASE_STYLE,
|
|
146
|
+
padding: "8px 16px",
|
|
147
|
+
border: `1px solid ${isDisabled ? "#e5e7eb" : isHovered ? "#9ca3af" : "#d1d5db"}`,
|
|
148
|
+
color: isDisabled ? "#9ca3af" : "#1f2937",
|
|
149
|
+
cursor,
|
|
150
|
+
background: isDisabled ? "#ffffff" : isActive ? "#e5e7eb" : isHovered ? "#f3f4f6" : "#ffffff"
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
...BASE_STYLE,
|
|
155
|
+
padding: "8px 12px",
|
|
156
|
+
border: "none",
|
|
157
|
+
color: isDisabled ? "#93c5fd" : "#2563eb",
|
|
158
|
+
cursor,
|
|
159
|
+
background: isDisabled ? "transparent" : isActive ? "#dbeafe" : isHovered ? "#eff6ff" : "transparent"
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
var Button = Object.assign(
|
|
163
|
+
vue.defineComponent(
|
|
164
|
+
(props, { slots }) => {
|
|
165
|
+
const dispatch = useNovaDispatch();
|
|
166
|
+
const isHovered = vue.shallowRef(false);
|
|
167
|
+
const isActive = vue.shallowRef(false);
|
|
168
|
+
const onClick = () => {
|
|
169
|
+
if (props.disabled === true) return;
|
|
170
|
+
if (props.novaRef === void 0) return;
|
|
171
|
+
dispatch({ type: "ui:click", ref: props.novaRef });
|
|
172
|
+
};
|
|
173
|
+
return () => {
|
|
174
|
+
const isDisabled = props.disabled ?? false;
|
|
175
|
+
return vue.h(
|
|
176
|
+
"button",
|
|
177
|
+
{
|
|
178
|
+
type: "button",
|
|
179
|
+
disabled: isDisabled,
|
|
180
|
+
style: buttonStyle(props.variant ?? "primary", isDisabled, isHovered.value, isActive.value),
|
|
181
|
+
onClick,
|
|
182
|
+
onMouseenter: () => isHovered.value = true,
|
|
183
|
+
onMouseleave: () => {
|
|
184
|
+
isHovered.value = false;
|
|
185
|
+
isActive.value = false;
|
|
186
|
+
},
|
|
187
|
+
onMousedown: () => isActive.value = true,
|
|
188
|
+
onMouseup: () => isActive.value = false
|
|
189
|
+
},
|
|
190
|
+
props.label ?? slots.default?.()
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
},
|
|
194
|
+
{ name: "NovaButton", props: ["label", "variant", "disabled", "novaRef"], inheritAttrs: false }
|
|
195
|
+
),
|
|
196
|
+
{ meta: { description: "Clickable button. Click events fire as `ui:click` with the layout node's ref.", propsSchema: chunk5AF72LOE_cjs.ButtonPropsSchema } }
|
|
197
|
+
);
|
|
198
|
+
var inputStyle = (isDisabled, isFocused, isHovered) => ({
|
|
199
|
+
padding: "8px 12px",
|
|
200
|
+
border: `1px solid ${isDisabled ? "#d1d5db" : isFocused ? "#2563eb" : isHovered ? "#9ca3af" : "#d1d5db"}`,
|
|
201
|
+
borderRadius: "6px",
|
|
202
|
+
fontSize: "14px",
|
|
203
|
+
background: isDisabled ? "#f9fafb" : "#ffffff",
|
|
204
|
+
color: isDisabled ? "#9ca3af" : "inherit",
|
|
205
|
+
cursor: isDisabled ? "not-allowed" : "text",
|
|
206
|
+
minWidth: "240px",
|
|
207
|
+
outline: "none",
|
|
208
|
+
boxShadow: isFocused ? "0 0 0 3px rgba(37, 99, 235, 0.15)" : "none",
|
|
209
|
+
transition: "border-color 150ms, box-shadow 150ms"
|
|
210
|
+
});
|
|
211
|
+
var Input = Object.assign(
|
|
212
|
+
vue.defineComponent(
|
|
213
|
+
(props) => {
|
|
214
|
+
const dispatch = useNovaDispatch();
|
|
215
|
+
const isHovered = vue.shallowRef(false);
|
|
216
|
+
const draft = vue.shallowRef(null);
|
|
217
|
+
let timer;
|
|
218
|
+
const clearPending = () => {
|
|
219
|
+
if (timer !== void 0) {
|
|
220
|
+
clearTimeout(timer);
|
|
221
|
+
timer = void 0;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
vue.onBeforeUnmount(clearPending);
|
|
225
|
+
const fire = (next) => {
|
|
226
|
+
if (props.novaModel === void 0) return;
|
|
227
|
+
dispatch({ type: "ui:model", ref: props.novaModel.ref, payload: next });
|
|
228
|
+
};
|
|
229
|
+
const onInput = (event) => {
|
|
230
|
+
const target = event.target;
|
|
231
|
+
if (!(target instanceof HTMLInputElement)) return;
|
|
232
|
+
const next = target.value;
|
|
233
|
+
draft.value = next;
|
|
234
|
+
const debounceMs = props.debounce ?? 0;
|
|
235
|
+
if (debounceMs > 0) {
|
|
236
|
+
clearPending();
|
|
237
|
+
timer = setTimeout(() => {
|
|
238
|
+
timer = void 0;
|
|
239
|
+
fire(next);
|
|
240
|
+
}, debounceMs);
|
|
241
|
+
} else {
|
|
242
|
+
fire(next);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const onFocus = () => {
|
|
246
|
+
draft.value = props.value ?? "";
|
|
247
|
+
};
|
|
248
|
+
const onBlur = () => {
|
|
249
|
+
const pending = draft.value;
|
|
250
|
+
if (timer !== void 0 && pending !== null) {
|
|
251
|
+
clearPending();
|
|
252
|
+
fire(pending);
|
|
253
|
+
}
|
|
254
|
+
draft.value = null;
|
|
255
|
+
};
|
|
256
|
+
return () => {
|
|
257
|
+
const isDisabled = props.disabled ?? false;
|
|
258
|
+
return vue.h("input", {
|
|
259
|
+
type: props.type ?? "text",
|
|
260
|
+
placeholder: props.placeholder,
|
|
261
|
+
disabled: isDisabled,
|
|
262
|
+
value: draft.value ?? props.value ?? "",
|
|
263
|
+
onInput,
|
|
264
|
+
onFocus,
|
|
265
|
+
onBlur,
|
|
266
|
+
onMouseenter: () => isHovered.value = true,
|
|
267
|
+
onMouseleave: () => isHovered.value = false,
|
|
268
|
+
style: inputStyle(isDisabled, draft.value !== null, isHovered.value)
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: "NovaInput",
|
|
274
|
+
props: ["type", "placeholder", "disabled", "value", "debounce", "novaModel"],
|
|
275
|
+
inheritAttrs: false
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
{ meta: { description: "Text input bound to data via the `model` field on the layout node.", propsSchema: chunk5AF72LOE_cjs.InputPropsSchema } }
|
|
279
|
+
);
|
|
280
|
+
var HEADER_BUTTON_STYLE = {
|
|
281
|
+
border: "none",
|
|
282
|
+
background: "none",
|
|
283
|
+
color: "#6b7280",
|
|
284
|
+
cursor: "pointer",
|
|
285
|
+
fontSize: "13px",
|
|
286
|
+
lineHeight: 1,
|
|
287
|
+
padding: "2px"
|
|
288
|
+
};
|
|
289
|
+
var Panel = Object.assign(
|
|
290
|
+
vue.defineComponent(
|
|
291
|
+
(props, { slots }) => {
|
|
292
|
+
const dispatch = useNovaDispatch();
|
|
293
|
+
const headerButton = (ref, glyph) => vue.h("button", { type: "button", style: HEADER_BUTTON_STYLE, onClick: () => dispatch({ type: "ui:click", ref }) }, glyph);
|
|
294
|
+
return () => vue.h(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
style: {
|
|
298
|
+
border: "1px solid #d8dae0",
|
|
299
|
+
borderRadius: "10px",
|
|
300
|
+
background: "#fff",
|
|
301
|
+
boxShadow: "0 1px 3px rgba(0,0,0,.06)",
|
|
302
|
+
padding: "12px"
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
[
|
|
306
|
+
props.title === void 0 ? null : vue.h("div", { style: { display: "flex", alignItems: "center", gap: "6px", fontWeight: 600, fontSize: "13px", marginBottom: "8px" } }, [
|
|
307
|
+
props.backRef === void 0 ? null : headerButton(props.backRef, "\u2190"),
|
|
308
|
+
vue.h("span", { style: { flex: 1 } }, props.title),
|
|
309
|
+
props.closeRef === void 0 ? null : headerButton(props.closeRef, "\u2715")
|
|
310
|
+
]),
|
|
311
|
+
slots.default?.()
|
|
312
|
+
]
|
|
313
|
+
);
|
|
314
|
+
},
|
|
315
|
+
{ name: "NovaPanel", props: ["title", "backRef", "closeRef"], inheritAttrs: false }
|
|
316
|
+
),
|
|
317
|
+
{
|
|
318
|
+
meta: {
|
|
319
|
+
description: "A framed, elevated surface with an optional title; `closeRef` adds a header \u2715.",
|
|
320
|
+
propsSchema: chunk5AF72LOE_cjs.PanelPropsSchema
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
var entriesOf = (value) => Array.isArray(value) ? value.map((item, index) => [String(index), item]) : Object.entries(value);
|
|
325
|
+
var jsonNode = (value, name, key) => {
|
|
326
|
+
if (value !== null && typeof value === "object") {
|
|
327
|
+
const entries = entriesOf(value);
|
|
328
|
+
const shape = Array.isArray(value) ? `[${entries.length}]` : `{${entries.length}}`;
|
|
329
|
+
return vue.h("details", { key }, [
|
|
330
|
+
vue.h("summary", { style: { cursor: "pointer", color: "#6b7280" } }, name === void 0 ? shape : `${name} ${shape}`),
|
|
331
|
+
vue.h(
|
|
332
|
+
"div",
|
|
333
|
+
{ style: { paddingLeft: "13px", borderLeft: "1px solid #d8dae0", marginLeft: "3px" } },
|
|
334
|
+
entries.map(([childKey, child]) => jsonNode(child, childKey, childKey))
|
|
335
|
+
)
|
|
336
|
+
]);
|
|
337
|
+
}
|
|
338
|
+
const text = name === void 0 ? JSON.stringify(value) : `${name}: ${JSON.stringify(value)}`;
|
|
339
|
+
return vue.h("div", { key, style: { whiteSpace: "pre-wrap", wordBreak: "break-word" } }, text);
|
|
340
|
+
};
|
|
341
|
+
var JsonTree = Object.assign(
|
|
342
|
+
vue.defineComponent(
|
|
343
|
+
(props) => () => vue.h(
|
|
344
|
+
"div",
|
|
345
|
+
{ style: { fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fontSize: "12px", lineHeight: 1.5 } },
|
|
346
|
+
[jsonNode(props.value, props.label)]
|
|
347
|
+
),
|
|
348
|
+
{ name: "NovaJsonTree", props: ["value", "label"], inheritAttrs: false }
|
|
349
|
+
),
|
|
350
|
+
{ meta: { description: "A collapsible view of any JSON value.", propsSchema: chunk5AF72LOE_cjs.JsonTreePropsSchema } }
|
|
351
|
+
);
|
|
352
|
+
var bindShell = (binding) => {
|
|
353
|
+
const source = useShellSource();
|
|
354
|
+
const value = vue.shallowRef(binding.read(source.shell, binding.key()));
|
|
355
|
+
vue.watch(
|
|
356
|
+
() => [source.shell, binding.key()],
|
|
357
|
+
([shell, key], _previous, onCleanup) => {
|
|
358
|
+
const refresh = () => {
|
|
359
|
+
value.value = binding.read(shell, key);
|
|
360
|
+
};
|
|
361
|
+
refresh();
|
|
362
|
+
onCleanup(binding.subscribe(shell, key, refresh));
|
|
363
|
+
},
|
|
364
|
+
{ immediate: true }
|
|
365
|
+
);
|
|
366
|
+
return value;
|
|
367
|
+
};
|
|
368
|
+
var EMPTY = [];
|
|
369
|
+
var subscribeState = (shell, _key, notify) => shell.onStateChange(() => notify());
|
|
370
|
+
var useCanvasRenderTree = (canvasId) => bindShell({
|
|
371
|
+
key: () => vue.toValue(canvasId),
|
|
372
|
+
read: (shell, id) => id === void 0 || id === "" ? EMPTY : shell.getCanvasRenderTree(id),
|
|
373
|
+
subscribe: subscribeState
|
|
374
|
+
});
|
|
375
|
+
var useShellRenderTree = () => bindShell({ key: () => void 0, read: (shell) => shell.getShellRenderTree(), subscribe: subscribeState });
|
|
376
|
+
var useShellState = () => bindShell({ key: () => void 0, read: (shell) => shell.getState(), subscribe: subscribeState });
|
|
377
|
+
var useCanvas = (canvasId) => bindShell({
|
|
378
|
+
key: () => vue.toValue(canvasId),
|
|
379
|
+
read: (shell, id) => shell.getCanvasState(id),
|
|
380
|
+
subscribe: (shell, id, notify) => shell.onCanvasChange(id, () => notify())
|
|
381
|
+
});
|
|
382
|
+
var subscribeRuntime = (listen) => (shell, instanceId, notify) => {
|
|
383
|
+
let current = shell.getRuntime(instanceId);
|
|
384
|
+
let offRuntime = current === void 0 ? void 0 : listen(current, notify);
|
|
385
|
+
const offState = shell.onStateChange(() => {
|
|
386
|
+
const next = shell.getRuntime(instanceId);
|
|
387
|
+
if (next !== current) {
|
|
388
|
+
offRuntime?.();
|
|
389
|
+
current = next;
|
|
390
|
+
offRuntime = current === void 0 ? void 0 : listen(current, notify);
|
|
391
|
+
}
|
|
392
|
+
notify();
|
|
393
|
+
});
|
|
394
|
+
return () => {
|
|
395
|
+
offRuntime?.();
|
|
396
|
+
offState();
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
var onData = subscribeRuntime((runtime, notify) => runtime.onDataChange(() => notify()));
|
|
400
|
+
var onStatus = subscribeRuntime((runtime, notify) => runtime.onStatusChange(() => notify()));
|
|
401
|
+
var useActionData = (instanceId) => bindShell({ key: () => vue.toValue(instanceId), read: (shell, id) => shell.getRuntime(id)?.getData(), subscribe: onData });
|
|
402
|
+
var useActionStatus = (instanceId) => bindShell({ key: () => vue.toValue(instanceId), read: (shell, id) => shell.getRuntime(id)?.instance.status, subscribe: onStatus });
|
|
403
|
+
var useRenderTree = (instanceId) => {
|
|
404
|
+
let cache;
|
|
405
|
+
return bindShell({
|
|
406
|
+
key: () => vue.toValue(instanceId),
|
|
407
|
+
read: (shell, id) => {
|
|
408
|
+
const runtime = shell.getRuntime(id);
|
|
409
|
+
if (runtime === void 0) {
|
|
410
|
+
cache = void 0;
|
|
411
|
+
return EMPTY;
|
|
412
|
+
}
|
|
413
|
+
const data = runtime.getData();
|
|
414
|
+
const phrases = shell.getPhrases();
|
|
415
|
+
if (cache !== void 0 && cache.data === data && cache.phrases === phrases) return cache.tree;
|
|
416
|
+
const tree = runtime.render();
|
|
417
|
+
cache = { data, phrases, tree };
|
|
418
|
+
return tree;
|
|
419
|
+
},
|
|
420
|
+
subscribe: onData
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
var ErrorMarker = vue.defineComponent(
|
|
424
|
+
(props) => () => vue.h("span", { "data-nova-error": props.code, role: "alert" }, `[${props.code}] ${props.message}`),
|
|
425
|
+
{ name: "NovaErrorMarker", props: ["code", "message"] }
|
|
426
|
+
);
|
|
427
|
+
var ShellHeadKey = /* @__PURE__ */ Symbol.for("@niscorp/nova/adapters/vue:head");
|
|
428
|
+
var HeadMark = vue.defineComponent(
|
|
429
|
+
() => {
|
|
430
|
+
const head = vue.inject(ShellHeadKey, void 0);
|
|
431
|
+
vue.onMounted(() => {
|
|
432
|
+
if (head === void 0) return;
|
|
433
|
+
vue.watch(
|
|
434
|
+
head,
|
|
435
|
+
(current, _previous, onCleanup) => {
|
|
436
|
+
current.enter();
|
|
437
|
+
onCleanup(current.leave);
|
|
438
|
+
},
|
|
439
|
+
{ immediate: true }
|
|
440
|
+
);
|
|
441
|
+
});
|
|
442
|
+
return () => null;
|
|
443
|
+
},
|
|
444
|
+
{ name: "NovaHeadMark" }
|
|
445
|
+
);
|
|
446
|
+
var provideShellHead = (shell) => {
|
|
447
|
+
let held = shell();
|
|
448
|
+
const head = vue.shallowRef(chunk5AF72LOE_cjs.createShellHead(held));
|
|
449
|
+
vue.provide(ShellHeadKey, head);
|
|
450
|
+
vue.onMounted(() => {
|
|
451
|
+
vue.watch(
|
|
452
|
+
shell,
|
|
453
|
+
(next, _previous, onCleanup) => {
|
|
454
|
+
if (next !== held) {
|
|
455
|
+
held = next;
|
|
456
|
+
head.value = chunk5AF72LOE_cjs.createShellHead(next);
|
|
457
|
+
}
|
|
458
|
+
onCleanup(head.value.watch());
|
|
459
|
+
},
|
|
460
|
+
{ immediate: true }
|
|
461
|
+
);
|
|
462
|
+
});
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// src/adapters/vue/types.ts
|
|
466
|
+
var isNovaComponent = (value) => typeof value === "function" || typeof value === "object" && value !== null;
|
|
467
|
+
|
|
468
|
+
// src/adapters/vue/render-node.ts
|
|
469
|
+
var childViews = (children) => children.map((child, i) => vue.h(RenderNodeView, { node: child, key: chunkIZ2UU5UL_cjs.renderNodeKey(child, i) }));
|
|
470
|
+
var renderNode = (ctx, node) => {
|
|
471
|
+
if (node.type === "text") return vue.createTextVNode(node.value);
|
|
472
|
+
if (node.type === "fragment") return vue.h(RenderTree, { nodes: node.children });
|
|
473
|
+
if (node.type === "error") return vue.h(ErrorMarker, { code: node.code, message: node.message });
|
|
474
|
+
if (chunkPNQY6OFB_cjs.isHeadNode(node)) return vue.h(HeadMark);
|
|
475
|
+
const registered = ctx.registry.get(node.name)?.component;
|
|
476
|
+
const component = isNovaComponent(registered) ? registered : ctx.fallback;
|
|
477
|
+
if (component === void 0) return vue.h(ErrorMarker, { code: "COMPONENT_NOT_FOUND", message: node.name });
|
|
478
|
+
const props = { ...node.props };
|
|
479
|
+
if (node.model !== void 0) props[chunkIZ2UU5UL_cjs.NOVA_MODEL_PROP] = { ref: node.model.ref, path: node.model.path };
|
|
480
|
+
if (node.ref !== void 0) props[chunkIZ2UU5UL_cjs.NOVA_REF_PROP] = node.ref;
|
|
481
|
+
const { children } = node;
|
|
482
|
+
if (children.length === 0) return vue.h(component, props);
|
|
483
|
+
if (!children.some(chunkPNQY6OFB_cjs.isHeadNode)) return vue.h(component, props, { default: () => childViews(children) });
|
|
484
|
+
const shown = children.filter((child) => !chunkPNQY6OFB_cjs.isHeadNode(child));
|
|
485
|
+
return vue.h(vue.Fragment, [
|
|
486
|
+
shown.length === 0 ? vue.h(component, props) : vue.h(component, props, { default: () => childViews(shown) }),
|
|
487
|
+
...children.filter(chunkPNQY6OFB_cjs.isHeadNode).map((_head, i) => vue.h(HeadMark, { key: `head:${i}` }))
|
|
488
|
+
]);
|
|
489
|
+
};
|
|
490
|
+
var RenderNodeView = vue.defineComponent(
|
|
491
|
+
(props) => {
|
|
492
|
+
const ctx = vue.inject(NovaRenderKey, void 0);
|
|
493
|
+
if (ctx === void 0) throw new Error("RenderNodeView must be used inside <NovaRenderProvider>");
|
|
494
|
+
return () => renderNode(ctx, props.node);
|
|
495
|
+
},
|
|
496
|
+
{ name: "NovaRenderNode", props: ["node"] }
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
// src/adapters/vue/render-tree.ts
|
|
500
|
+
var RenderTree = vue.defineComponent(
|
|
501
|
+
(props) => () => props.nodes.map((node, i) => vue.h(RenderNodeView, { node, key: chunkIZ2UU5UL_cjs.renderNodeKey(node, i) })),
|
|
502
|
+
{ name: "NovaRenderTree", props: ["nodes"] }
|
|
503
|
+
);
|
|
504
|
+
|
|
505
|
+
// src/adapters/vue/components/slots.ts
|
|
506
|
+
var CanvasSlot = Object.assign(
|
|
507
|
+
vue.defineComponent(
|
|
508
|
+
(props) => {
|
|
509
|
+
const tree = useCanvasRenderTree(() => props.canvasId);
|
|
510
|
+
return () => props.canvasId === void 0 || props.canvasId === "" ? null : vue.h(RenderTree, { nodes: tree.value });
|
|
511
|
+
},
|
|
512
|
+
{ name: "NovaCanvasSlot", props: ["canvasId"], inheritAttrs: false }
|
|
513
|
+
),
|
|
514
|
+
{
|
|
515
|
+
meta: {
|
|
516
|
+
description: "Renders a canvas by id, recursing into its actionLayout.",
|
|
517
|
+
propsSchema: chunk5AF72LOE_cjs.CanvasSlotPropsSchema
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
var InstanceScope = vue.defineComponent(
|
|
522
|
+
(props, { slots }) => {
|
|
523
|
+
const parent = vue.inject(NovaRenderKey, void 0);
|
|
524
|
+
if (parent !== void 0) {
|
|
525
|
+
const scoped = {
|
|
526
|
+
get registry() {
|
|
527
|
+
return parent.registry;
|
|
528
|
+
},
|
|
529
|
+
get dispatch() {
|
|
530
|
+
return chunkOO247V4J_cjs.scopeDispatch(parent.dispatch, props.instanceId);
|
|
531
|
+
},
|
|
532
|
+
get publish() {
|
|
533
|
+
return parent.publish;
|
|
534
|
+
},
|
|
535
|
+
get slotWrapper() {
|
|
536
|
+
return parent.slotWrapper;
|
|
537
|
+
},
|
|
538
|
+
get fallback() {
|
|
539
|
+
return parent.fallback;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
vue.provide(NovaRenderKey, scoped);
|
|
543
|
+
}
|
|
544
|
+
return () => slots.default?.();
|
|
545
|
+
},
|
|
546
|
+
{ name: "NovaInstanceScope", props: ["instanceId"] }
|
|
547
|
+
);
|
|
548
|
+
var ActionSlot = Object.assign(
|
|
549
|
+
vue.defineComponent(
|
|
550
|
+
(props) => {
|
|
551
|
+
const source = useShellSource();
|
|
552
|
+
const ctx = vue.inject(NovaRenderKey, void 0);
|
|
553
|
+
const tree = useRenderTree(() => props.instanceId ?? "");
|
|
554
|
+
return () => {
|
|
555
|
+
const instanceId = props.instanceId;
|
|
556
|
+
const hasInstance = instanceId !== void 0 && instanceId !== "";
|
|
557
|
+
const content = hasInstance && tree.value.length > 0 ? vue.h(InstanceScope, { instanceId }, { default: () => vue.h(RenderTree, { nodes: tree.value }) }) : null;
|
|
558
|
+
const Wrapper = ctx?.slotWrapper;
|
|
559
|
+
if (Wrapper === void 0) return content;
|
|
560
|
+
const runtime = hasInstance ? source.shell.getRuntime(instanceId) : void 0;
|
|
561
|
+
return vue.h(
|
|
562
|
+
Wrapper,
|
|
563
|
+
{ canvasId: runtime?.instance.canvasId, instanceId: hasInstance ? instanceId : void 0, action: runtime?.definition },
|
|
564
|
+
{ default: () => content }
|
|
565
|
+
);
|
|
566
|
+
};
|
|
567
|
+
},
|
|
568
|
+
{ name: "NovaActionSlot", props: ["instanceId"], inheritAttrs: false }
|
|
569
|
+
),
|
|
570
|
+
{
|
|
571
|
+
meta: {
|
|
572
|
+
description: "Renders an action instance by id. Used inside a canvas actionLayout.",
|
|
573
|
+
propsSchema: chunk5AF72LOE_cjs.ActionSlotPropsSchema
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
);
|
|
577
|
+
|
|
578
|
+
// src/adapters/vue/components/index.ts
|
|
579
|
+
var registerNovaVueComponents = (registry) => {
|
|
580
|
+
registry.registerAll({
|
|
581
|
+
Stack,
|
|
582
|
+
Text,
|
|
583
|
+
Input,
|
|
584
|
+
Button,
|
|
585
|
+
Box,
|
|
586
|
+
Panel,
|
|
587
|
+
JsonTree,
|
|
588
|
+
CanvasSlot,
|
|
589
|
+
ActionSlot
|
|
590
|
+
});
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
exports.ActionSlot = ActionSlot;
|
|
594
|
+
exports.Box = Box;
|
|
595
|
+
exports.Button = Button;
|
|
596
|
+
exports.CanvasSlot = CanvasSlot;
|
|
597
|
+
exports.ErrorMarker = ErrorMarker;
|
|
598
|
+
exports.Input = Input;
|
|
599
|
+
exports.JsonTree = JsonTree;
|
|
600
|
+
exports.NovaRenderKey = NovaRenderKey;
|
|
601
|
+
exports.NovaShellKey = NovaShellKey;
|
|
602
|
+
exports.Panel = Panel;
|
|
603
|
+
exports.RenderNodeView = RenderNodeView;
|
|
604
|
+
exports.RenderTree = RenderTree;
|
|
605
|
+
exports.Stack = Stack;
|
|
606
|
+
exports.Text = Text;
|
|
607
|
+
exports.isNovaComponent = isNovaComponent;
|
|
608
|
+
exports.provideShellHead = provideShellHead;
|
|
609
|
+
exports.registerNovaVueComponents = registerNovaVueComponents;
|
|
610
|
+
exports.useActionData = useActionData;
|
|
611
|
+
exports.useActionStatus = useActionStatus;
|
|
612
|
+
exports.useCanvas = useCanvas;
|
|
613
|
+
exports.useCanvasRenderTree = useCanvasRenderTree;
|
|
614
|
+
exports.useNovaDispatch = useNovaDispatch;
|
|
615
|
+
exports.useNovaPublish = useNovaPublish;
|
|
616
|
+
exports.useNovaRegistry = useNovaRegistry;
|
|
617
|
+
exports.useRenderTree = useRenderTree;
|
|
618
|
+
exports.useShell = useShell;
|
|
619
|
+
exports.useShellRenderTree = useShellRenderTree;
|
|
620
|
+
exports.useShellState = useShellState;
|
|
621
|
+
exports.useSlotWrapper = useSlotWrapper;
|
|
622
|
+
//# sourceMappingURL=chunk-TRJYDVWK.cjs.map
|
|
623
|
+
//# sourceMappingURL=chunk-TRJYDVWK.cjs.map
|