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