@nivaro/react 0.3.35 → 0.3.37
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/components/slots/CommentsSlot.js +44 -36
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -4
- package/dist/shared/components/AgentBadge.js +26 -0
- package/dist/shared/components/AgentQuestionsCard.js +198 -0
- package/dist/shared/components/ItemEditForm.js +3329 -3263
- package/dist/shared/components/McpConnectionScope.js +480 -0
- package/dist/shared/components/MyWorkView.js +223 -208
- package/dist/shared/components/RecordReadView.js +620 -572
- package/dist/shared/components/chat/ChatPanel.js +683 -671
- package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
- package/dist/shared/components/imports/ImportConsole.js +106 -104
- package/dist/shared/components/imports/RunDetailSheet.js +11 -10
- package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
- package/dist/shared/components/item-edit/FormTour.js +279 -0
- package/dist/shared/components/item-edit/GroupSection.js +377 -360
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +80 -63
- package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
- package/dist/shared/components/item-edit/form-density.js +36 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
- package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
- package/dist/shared/components/layout-editor/AddPanel.js +349 -192
- package/dist/shared/components/layout-editor/DesignNode.js +146 -131
- package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
- package/dist/shared/components/layout-editor/EditorTopBar.js +268 -206
- package/dist/shared/components/layout-editor/LayoutEditor.js +810 -731
- package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
- package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
- package/dist/shared/components/layout-editor/add-target.js +54 -43
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +379 -185
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +96 -0
- package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
- package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
- package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
- package/dist/shared/components/layout-editor/dnd/node.js +115 -105
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +4 -4
- package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +58 -0
- package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
- package/dist/shared/components/layout-editor/even-row.js +86 -0
- package/dist/shared/components/layout-editor/field-list.js +99 -0
- package/dist/shared/components/layout-editor/format-painter.js +102 -0
- package/dist/shared/components/layout-editor/grid-guides.js +15 -13
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
- package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
- package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
- package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
- package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
- package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
- package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
- package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
- package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
- package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
- package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
- package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
- package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
- package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
- package/dist/shared/components/layout-editor/panel-frame.js +1 -1
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
- package/dist/shared/components/layout-editor/pin.js +37 -19
- package/dist/shared/components/layout-editor/place-clip.js +257 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +149 -118
- package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
- package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
- package/dist/shared/components/layout-editor/removed-log.js +151 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
- package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
- package/dist/shared/components/layout-editor/revert-element.js +140 -0
- package/dist/shared/components/layout-editor/section-structure.js +193 -170
- package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
- package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
- package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
- package/dist/shared/components/layout-editor/shortcuts.js +21 -16
- package/dist/shared/components/layout-editor/structure-ops.js +221 -195
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
- package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
- package/dist/shared/components/panels/CommentPanel.js +47 -45
- package/dist/shared/components/panels/RevisionsPanel.js +66 -64
- package/dist/shared/components/panels/TaskPanel.js +395 -332
- package/dist/shared/components/profile/AgentsPanel.js +196 -147
- package/dist/shared/components/profile/ConnectionRollback.js +329 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
- package/dist/shared/lib/entry-config.js +22 -22
- package/dist/shared/lib/form-usage-beacon.js +91 -55
- package/dist/shared/lib/layout-lint.js +530 -284
- package/dist/shared/lib/layout-resolve.js +58 -44
- package/package.json +1 -1
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { useQuery as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useNivaroClient as
|
|
4
|
-
import { get as
|
|
5
|
-
import { mergeInherited as
|
|
6
|
-
const
|
|
1
|
+
import { useQuery as y, useQueryClient as g, useMutation as m } from "@tanstack/react-query";
|
|
2
|
+
import { useMemo as p } from "react";
|
|
3
|
+
import { useNivaroClient as i } from "../../../context.js";
|
|
4
|
+
import { get as f, patch as h } from "../../../lib/commands.js";
|
|
5
|
+
import { mergeInherited as k, lintLayout as q, layoutHealth as T, EMPTY_LINT_CONTEXT as x } from "../../../lib/layout-lint.js";
|
|
6
|
+
const o = {
|
|
7
7
|
context: (t) => ["layout-editor", "lint-context", t],
|
|
8
8
|
health: (t) => ["layout-editor", "health", t],
|
|
9
|
-
coverage: (t) => ["layout-editor", "coverage", t]
|
|
9
|
+
coverage: (t) => ["layout-editor", "coverage", t],
|
|
10
|
+
style: ["layout-editor", "lint-style"]
|
|
10
11
|
};
|
|
11
|
-
function
|
|
12
|
+
function l(t) {
|
|
12
13
|
if (!t || typeof t != "object") return null;
|
|
13
14
|
const e = t.data;
|
|
14
15
|
return e && typeof e == "object" ? e : t;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
queryKey:
|
|
17
|
+
function L(t, e = !0) {
|
|
18
|
+
const r = i();
|
|
19
|
+
return y({
|
|
20
|
+
queryKey: o.context(t),
|
|
20
21
|
queryFn: async () => {
|
|
21
|
-
const
|
|
22
|
-
await
|
|
22
|
+
const n = l(
|
|
23
|
+
await r.request(f("/collection-layouts/lint-context", { collection: t }))
|
|
23
24
|
);
|
|
24
25
|
return {
|
|
25
|
-
fields: (
|
|
26
|
-
roles: (
|
|
27
|
-
requirements: (
|
|
26
|
+
fields: (n == null ? void 0 : n.fields) ?? [],
|
|
27
|
+
roles: (n == null ? void 0 : n.roles) ?? [],
|
|
28
|
+
requirements: (n == null ? void 0 : n.requirements) ?? [],
|
|
29
|
+
style: (n == null ? void 0 : n.style) ?? null
|
|
28
30
|
};
|
|
29
31
|
},
|
|
30
32
|
enabled: e,
|
|
@@ -32,21 +34,56 @@ function h(t, e = !0) {
|
|
|
32
34
|
retry: !1
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
const { data:
|
|
37
|
-
return
|
|
37
|
+
function Q(t, e, r = null) {
|
|
38
|
+
const { data: n, isSuccess: u, isError: s } = L(t, !!e);
|
|
39
|
+
return p(() => {
|
|
38
40
|
if (!e) return { findings: [], health: null, ready: !1 };
|
|
39
|
-
const
|
|
40
|
-
return { findings:
|
|
41
|
-
}, [e,
|
|
41
|
+
const _ = n ?? x, a = k(e, r), c = q(a, _);
|
|
42
|
+
return { findings: c, health: T(a, c), ready: u || s };
|
|
43
|
+
}, [e, r, n, u, s]);
|
|
42
44
|
}
|
|
43
|
-
function
|
|
45
|
+
function C(t) {
|
|
44
46
|
const e = t.target;
|
|
45
47
|
return e.kind === "group" ? { kind: "group", key: e.key } : e.kind !== "field" ? null : e.group_key === "__header__" ? { kind: "header", field: e.field } : /^__.*__$/.test(e.field) ? { kind: "slot", field: e.field, group_key: e.group_key } : { kind: "field", field: e.field, group_key: e.group_key };
|
|
46
48
|
}
|
|
49
|
+
const d = {
|
|
50
|
+
off: [],
|
|
51
|
+
max_label_length: null,
|
|
52
|
+
jargon: [],
|
|
53
|
+
allow_words: []
|
|
54
|
+
};
|
|
55
|
+
function M(t = !0) {
|
|
56
|
+
const e = i();
|
|
57
|
+
return y({
|
|
58
|
+
queryKey: o.style,
|
|
59
|
+
queryFn: async () => ({
|
|
60
|
+
...d,
|
|
61
|
+
...l(
|
|
62
|
+
await e.request(f("/collection-layouts/lint-style"))
|
|
63
|
+
) ?? {}
|
|
64
|
+
}),
|
|
65
|
+
enabled: t,
|
|
66
|
+
staleTime: 6e4,
|
|
67
|
+
retry: !1
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function N() {
|
|
71
|
+
const t = i(), e = g();
|
|
72
|
+
return m({
|
|
73
|
+
mutationFn: async (r) => l(
|
|
74
|
+
await t.request(h("/collection-layouts/lint-style", r))
|
|
75
|
+
) ?? d,
|
|
76
|
+
onSuccess: (r) => {
|
|
77
|
+
e.setQueryData(o.style, r), e.invalidateQueries({ queryKey: ["layout-editor", "lint-context"] }), e.invalidateQueries({ queryKey: ["layout-editor", "health"] });
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
47
81
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
82
|
+
d as EMPTY_LINT_STYLE,
|
|
83
|
+
C as findingDesignTarget,
|
|
84
|
+
o as lintKeys,
|
|
85
|
+
Q as useLayoutLint,
|
|
86
|
+
L as useLintContext,
|
|
87
|
+
M as useLintStyle,
|
|
88
|
+
N as useSaveLintStyle
|
|
52
89
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e, Fragment as p } from "react/jsx-runtime";
|
|
2
|
-
import { Search as s, ListTree as i, ZoomOut as
|
|
2
|
+
import { Search as s, ListTree as i, ZoomOut as m, ChevronsUpDown as d, ChevronsDownUp as h, Keyboard as u } from "lucide-react";
|
|
3
3
|
import { Popover as l, PopoverContent as r } from "../../ui/popover.js";
|
|
4
4
|
import { keyLabels as b } from "../shortcuts.js";
|
|
5
5
|
import { ToolButton as n } from "../toolbar-kit.js";
|
|
6
6
|
import { FindPanel as C } from "./FindPanel.js";
|
|
7
7
|
import { ShortcutSheet as f } from "./ShortcutSheet.js";
|
|
8
|
+
import { ZoomRow as g } from "./ZoomControls.js";
|
|
8
9
|
const t = (o) => b(o).join("");
|
|
9
|
-
function
|
|
10
|
+
function S({ find: o }) {
|
|
10
11
|
return /* @__PURE__ */ a(l, { open: o.open, onOpenChange: o.onOpenChange, children: [
|
|
11
12
|
/* @__PURE__ */ e(
|
|
12
13
|
n,
|
|
@@ -33,7 +34,7 @@ function F({ find: o }) {
|
|
|
33
34
|
)
|
|
34
35
|
] });
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function T({ outline: o }) {
|
|
37
38
|
return o ? /* @__PURE__ */ e(
|
|
38
39
|
n,
|
|
39
40
|
{
|
|
@@ -47,13 +48,14 @@ function N({ outline: o }) {
|
|
|
47
48
|
}
|
|
48
49
|
) : null;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function A({ view: o }) {
|
|
51
52
|
return o ? /* @__PURE__ */ a(p, { children: [
|
|
53
|
+
o.zoom && /* @__PURE__ */ e(g, { zoom: o.zoom }),
|
|
52
54
|
/* @__PURE__ */ e(
|
|
53
55
|
n,
|
|
54
56
|
{
|
|
55
57
|
label: "Compact canvas",
|
|
56
|
-
icon: /* @__PURE__ */ e(
|
|
58
|
+
icon: /* @__PURE__ */ e(m, { className: "h-4 w-4" }),
|
|
57
59
|
hint: "Smaller spacing and inputs, here only",
|
|
58
60
|
checked: o.compact,
|
|
59
61
|
onClick: () => o.onCompact(!o.compact),
|
|
@@ -64,7 +66,7 @@ function S({ view: o }) {
|
|
|
64
66
|
n,
|
|
65
67
|
{
|
|
66
68
|
label: "Expand all",
|
|
67
|
-
icon: /* @__PURE__ */ e(
|
|
69
|
+
icon: /* @__PURE__ */ e(d, { className: "h-4 w-4" }),
|
|
68
70
|
hint: "Every step and tab shown",
|
|
69
71
|
onClick: o.onExpandAll,
|
|
70
72
|
data: { "data-editor-expand-all": "" }
|
|
@@ -74,14 +76,14 @@ function S({ view: o }) {
|
|
|
74
76
|
n,
|
|
75
77
|
{
|
|
76
78
|
label: "Collapse all",
|
|
77
|
-
icon: /* @__PURE__ */ e(
|
|
79
|
+
icon: /* @__PURE__ */ e(h, { className: "h-4 w-4" }),
|
|
78
80
|
onClick: o.onCollapseAll,
|
|
79
81
|
data: { "data-editor-collapse-all": "" }
|
|
80
82
|
}
|
|
81
83
|
)
|
|
82
84
|
] }) : null;
|
|
83
85
|
}
|
|
84
|
-
function
|
|
86
|
+
function P({ shortcuts: o }) {
|
|
85
87
|
return /* @__PURE__ */ a(l, { open: o.open, onOpenChange: o.onOpenChange, children: [
|
|
86
88
|
/* @__PURE__ */ e(
|
|
87
89
|
n,
|
|
@@ -107,8 +109,8 @@ function T({ shortcuts: o }) {
|
|
|
107
109
|
] });
|
|
108
110
|
}
|
|
109
111
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
S as FindTool,
|
|
113
|
+
T as OutlineTool,
|
|
114
|
+
P as ShortcutsTool,
|
|
115
|
+
A as ViewTools
|
|
114
116
|
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t, Fragment as h } from "react/jsx-runtime";
|
|
2
|
+
import { Maximize2 as d, Minus as x, Plus as b } from "lucide-react";
|
|
3
|
+
import { createPortal as f } from "react-dom";
|
|
4
|
+
import { cn as v } from "../../../lib/utils.js";
|
|
5
|
+
import { useBarMenu as g } from "../toolbar-kit.js";
|
|
6
|
+
import { ZOOM_STEP as r, ZOOM_MAX as c, ZOOM_MIN as u } from "./view-prefs.js";
|
|
7
|
+
const o = (e) => `${Math.round(e * 100)}%`, i = "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 disabled:pointer-events-none disabled:opacity-40 dark:text-muted-foreground dark:hover:text-foreground", s = "inline-flex h-6 shrink-0 items-center gap-1 rounded px-1.5 text-[12px] font-medium text-slate-700 transition-colors hover:bg-muted dark:text-foreground";
|
|
8
|
+
function m({ zoom: e }) {
|
|
9
|
+
return /* @__PURE__ */ a(h, { children: [
|
|
10
|
+
/* @__PURE__ */ t(
|
|
11
|
+
"button",
|
|
12
|
+
{
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-label": "Zoom out",
|
|
15
|
+
"data-tip": "Zoom out",
|
|
16
|
+
"data-zoom-out": "",
|
|
17
|
+
disabled: e.value <= u,
|
|
18
|
+
onClick: () => e.onChange(e.value - r * 2),
|
|
19
|
+
className: i,
|
|
20
|
+
children: /* @__PURE__ */ t(x, { className: "h-3.5 w-3.5" })
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ t(
|
|
24
|
+
"button",
|
|
25
|
+
{
|
|
26
|
+
type: "button",
|
|
27
|
+
"aria-label": "Zoom in",
|
|
28
|
+
"data-tip": "Zoom in",
|
|
29
|
+
"data-zoom-in": "",
|
|
30
|
+
disabled: e.value >= c,
|
|
31
|
+
onClick: () => e.onChange(e.value + r * 2),
|
|
32
|
+
className: i,
|
|
33
|
+
children: /* @__PURE__ */ t(b, { className: "h-3.5 w-3.5" })
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
function M({ zoom: e }) {
|
|
39
|
+
const n = g(), l = /* @__PURE__ */ a(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
"data-editor-zoom": "",
|
|
43
|
+
className: "flex shrink-0 flex-col gap-1.5 rounded-md px-2 py-1.5 text-[12.5px] text-slate-700 dark:text-foreground",
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-2", children: [
|
|
46
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-slate-900 dark:text-foreground", children: "Zoom" }),
|
|
47
|
+
/* @__PURE__ */ t(
|
|
48
|
+
"span",
|
|
49
|
+
{
|
|
50
|
+
"data-zoom-value": "",
|
|
51
|
+
className: "tabular-nums text-[12px] text-slate-500 dark:text-muted-foreground",
|
|
52
|
+
children: o(e.value)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
|
|
57
|
+
/* @__PURE__ */ t(m, { zoom: e }),
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
"input",
|
|
60
|
+
{
|
|
61
|
+
type: "range",
|
|
62
|
+
"aria-label": "Canvas zoom",
|
|
63
|
+
"aria-valuetext": o(e.value),
|
|
64
|
+
"data-zoom-slider": "",
|
|
65
|
+
min: u,
|
|
66
|
+
max: c,
|
|
67
|
+
step: r,
|
|
68
|
+
value: e.value,
|
|
69
|
+
onChange: (p) => e.onChange(Number(p.target.value)),
|
|
70
|
+
className: "h-1.5 min-w-0 flex-1 cursor-pointer accent-nvr-cyan"
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
|
|
75
|
+
/* @__PURE__ */ a(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
"data-zoom-fit": "",
|
|
80
|
+
"data-tip": "Fit the form’s width to the canvas",
|
|
81
|
+
onClick: e.onFit,
|
|
82
|
+
className: s,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ t(d, { className: "h-3 w-3" }),
|
|
85
|
+
"Fit to screen"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ t(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
"data-zoom-reset": "",
|
|
94
|
+
disabled: e.value === 1,
|
|
95
|
+
onClick: () => e.onChange(1),
|
|
96
|
+
className: v(s, "disabled:pointer-events-none disabled:opacity-40"),
|
|
97
|
+
children: "100%"
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
return n ? !n.open || !n.list ? null : f(l, n.list) : l;
|
|
105
|
+
}
|
|
106
|
+
function F({ zoom: e }) {
|
|
107
|
+
return e.value === 1 ? null : /* @__PURE__ */ a(
|
|
108
|
+
"fieldset",
|
|
109
|
+
{
|
|
110
|
+
"data-zoom-chip": "",
|
|
111
|
+
"aria-label": "Canvas zoom",
|
|
112
|
+
className: "sticky bottom-3 z-30 -mt-10 mb-3 mr-3 flex h-7 min-w-0 items-center gap-0.5 self-end rounded-md border border-slate-200 bg-white px-1 shadow-sm dark:border-border dark:bg-card",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ t(m, { zoom: e }),
|
|
115
|
+
/* @__PURE__ */ t("span", { className: "min-w-[3ch] px-1 text-center text-[12px] tabular-nums text-slate-700 dark:text-foreground", children: o(e.value) }),
|
|
116
|
+
/* @__PURE__ */ t(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
type: "button",
|
|
120
|
+
"aria-label": "Fit to screen",
|
|
121
|
+
"data-tip": "Fit the form’s width to the canvas",
|
|
122
|
+
onClick: e.onFit,
|
|
123
|
+
className: i,
|
|
124
|
+
children: /* @__PURE__ */ t(d, { className: "h-3 w-3" })
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ t(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
type: "button",
|
|
131
|
+
"data-zoom-chip-reset": "",
|
|
132
|
+
"data-tip": "Back to 100%",
|
|
133
|
+
onClick: () => e.onChange(1),
|
|
134
|
+
className: s,
|
|
135
|
+
children: "100%"
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
F as ZoomChip,
|
|
144
|
+
M as ZoomRow
|
|
145
|
+
};
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { toast as
|
|
3
|
-
import { targetKey as
|
|
4
|
-
import { isTyping as
|
|
5
|
-
import { buildOutline as
|
|
6
|
-
import { useViewPref as A } from "./view-prefs.js";
|
|
7
|
-
function
|
|
1
|
+
import { useState as a, useRef as C, useMemo as S, useCallback as y, useEffect as j } from "react";
|
|
2
|
+
import { toast as B } from "sonner";
|
|
3
|
+
import { targetKey as G } from "../design-context.js";
|
|
4
|
+
import { isTyping as J } from "../is-typing.js";
|
|
5
|
+
import { buildOutline as Q } from "./tree.js";
|
|
6
|
+
import { useViewPref as A, useCanvasZoom as U } from "./view-prefs.js";
|
|
7
|
+
function W(l, s, f, d) {
|
|
8
8
|
let r = 0;
|
|
9
9
|
const c = () => {
|
|
10
10
|
const i = document.querySelector(
|
|
11
|
-
`[data-layout-editor] [data-editor-canvas] [data-design-target="${CSS.escape(
|
|
11
|
+
`[data-layout-editor] [data-editor-canvas] [data-design-target="${CSS.escape(l)}"]`
|
|
12
12
|
);
|
|
13
13
|
if (i) return f(i);
|
|
14
14
|
r++, d(r), r < s && window.setTimeout(c, 120);
|
|
15
15
|
};
|
|
16
16
|
requestAnimationFrame(c);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
bodyRef:
|
|
18
|
+
function re({
|
|
19
|
+
bodyRef: l,
|
|
20
20
|
bundle: s,
|
|
21
21
|
parent: f,
|
|
22
22
|
fields: d,
|
|
23
23
|
onSelect: r,
|
|
24
24
|
showHidden: c,
|
|
25
25
|
setShowHidden: i,
|
|
26
|
-
canvasShown:
|
|
26
|
+
canvasShown: h
|
|
27
27
|
}) {
|
|
28
|
-
const [_, b] =
|
|
28
|
+
const [_, b] = a(null), [L, x] = a(null), [D, m] = a(!1), [H, M] = a(0), [P, k] = a(!1), [R, T] = A("outline"), [V, Z] = A("compact"), [z, I] = U(), p = C(0), K = C(c);
|
|
29
29
|
K.current = c;
|
|
30
30
|
const q = S(() => {
|
|
31
31
|
const t = new Map(d.map((e) => [e.field, e.label ?? null]));
|
|
32
32
|
return (e) => t.get(e);
|
|
33
33
|
}, [d]), E = S(
|
|
34
|
-
() => s ?
|
|
34
|
+
() => s ? Q(s, f, q) : [],
|
|
35
35
|
[s, f, q]
|
|
36
|
-
),
|
|
36
|
+
), v = y(
|
|
37
37
|
(t, e) => {
|
|
38
|
-
if (r(t, e),
|
|
38
|
+
if (r(t, e), p.current += 1, x({ target: t, seq: p.current }), !h) return;
|
|
39
39
|
const n = (t.kind === "field" || t.kind === "slot" && t.group_key !== null) && t.field !== "__subtitle__";
|
|
40
40
|
let g = !1;
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
W(
|
|
42
|
+
G(t),
|
|
43
43
|
14,
|
|
44
44
|
(o) => {
|
|
45
45
|
var u;
|
|
46
46
|
(u = o.scrollIntoView) == null || u.call(o, { block: "center" }), e != null && e.focus && o.focus({ preventScroll: !0 });
|
|
47
47
|
},
|
|
48
48
|
(o) => {
|
|
49
|
-
o === 4 && n && !K.current && !g && (g = !0, i(!0),
|
|
49
|
+
o === 4 && n && !K.current && !g && (g = !0, i(!0), B.info("Show hidden is on: what you picked is hidden on this form"));
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
},
|
|
53
|
-
[r, i,
|
|
54
|
-
),
|
|
55
|
-
|
|
53
|
+
[r, i, h]
|
|
54
|
+
), w = C(!1), N = y((t) => {
|
|
55
|
+
w.current && (w.current = !1, t.preventDefault());
|
|
56
56
|
}, []), $ = y(
|
|
57
57
|
(t) => {
|
|
58
|
-
t.node.target && (
|
|
58
|
+
t.node.target && (w.current = !0, m(!1), v(t.node.target, { focus: !0 }));
|
|
59
59
|
},
|
|
60
|
-
[
|
|
60
|
+
[v]
|
|
61
61
|
), F = y((t) => {
|
|
62
|
-
|
|
62
|
+
p.current += 1, b({ open: t, seq: p.current });
|
|
63
63
|
}, []);
|
|
64
64
|
return j(() => {
|
|
65
65
|
const t = (e) => {
|
|
66
66
|
var o, u;
|
|
67
67
|
const n = e.target instanceof HTMLElement ? e.target : null;
|
|
68
|
-
if (!(!(!n || n === document.body || n === document.documentElement || (o =
|
|
68
|
+
if (!(!(!n || n === document.body || n === document.documentElement || (o = l.current) != null && o.contains(n) || (u = n.closest) != null && u.call(n, "[data-radix-popper-content-wrapper]")) || e.defaultPrevented)) {
|
|
69
69
|
if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && e.key.toLowerCase() === "f") {
|
|
70
|
-
e.preventDefault(), k(!1),
|
|
70
|
+
e.preventDefault(), k(!1), m(!0), M((O) => O + 1);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey && !
|
|
73
|
+
e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey && !J(n) && (e.preventDefault(), m(!1), k((O) => !O));
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
77
|
-
}, [
|
|
77
|
+
}, [l]), {
|
|
78
78
|
nodes: E,
|
|
79
79
|
fold: _,
|
|
80
80
|
reveal: L,
|
|
81
|
-
selectAndReveal:
|
|
81
|
+
selectAndReveal: v,
|
|
82
82
|
expandAll: () => F(!0),
|
|
83
83
|
collapseAll: () => F(!1),
|
|
84
84
|
find: {
|
|
85
85
|
open: D,
|
|
86
|
-
onOpenChange:
|
|
86
|
+
onOpenChange: m,
|
|
87
87
|
nodes: E,
|
|
88
88
|
onPick: $,
|
|
89
89
|
focusSeq: H,
|
|
@@ -93,9 +93,11 @@ function te({
|
|
|
93
93
|
outlineOpen: R,
|
|
94
94
|
setOutlineOpen: T,
|
|
95
95
|
compact: V,
|
|
96
|
-
setCompact:
|
|
96
|
+
setCompact: Z,
|
|
97
|
+
zoom: z,
|
|
98
|
+
setZoom: I
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
export {
|
|
100
|
-
|
|
102
|
+
re as useEditorNav
|
|
101
103
|
};
|
|
@@ -1,34 +1,119 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
const
|
|
1
|
+
import { useState as m, useCallback as S, useSyncExternalStore as y } from "react";
|
|
2
|
+
const a = {
|
|
3
3
|
compact: "nvr_layout_editor_compact",
|
|
4
4
|
outline: "nvr_layout_editor_outline"
|
|
5
5
|
};
|
|
6
|
-
function
|
|
6
|
+
function M(t) {
|
|
7
7
|
try {
|
|
8
|
-
return localStorage.getItem(
|
|
8
|
+
return localStorage.getItem(a[t]) === "1";
|
|
9
9
|
} catch {
|
|
10
10
|
return !1;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function h(t, e) {
|
|
14
14
|
try {
|
|
15
|
-
e ? localStorage.setItem(
|
|
15
|
+
e ? localStorage.setItem(a[t], "1") : localStorage.removeItem(a[t]);
|
|
16
16
|
} catch {
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const [e,
|
|
19
|
+
function N(t) {
|
|
20
|
+
const [e, n] = m(() => M(t)), o = S(
|
|
21
21
|
(r) => {
|
|
22
|
-
|
|
22
|
+
n(r), h(t, r);
|
|
23
23
|
},
|
|
24
24
|
[t]
|
|
25
25
|
);
|
|
26
|
-
return [e,
|
|
26
|
+
return [e, o];
|
|
27
|
+
}
|
|
28
|
+
const g = 0.8, u = "nvr_layout_editor_zoom", O = 0.3, w = 1.5, i = 0.05;
|
|
29
|
+
function f(t) {
|
|
30
|
+
if (!Number.isFinite(t) || t <= 0) return 1;
|
|
31
|
+
const e = Math.round(t / i) * i;
|
|
32
|
+
return Math.round(Math.min(w, Math.max(O, e)) * 100) / 100;
|
|
33
|
+
}
|
|
34
|
+
function v() {
|
|
35
|
+
try {
|
|
36
|
+
const t = localStorage.getItem(u);
|
|
37
|
+
return t == null ? 1 : f(Number(t));
|
|
38
|
+
} catch {
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function E() {
|
|
43
|
+
const [t, e] = m(v), n = S((o) => {
|
|
44
|
+
const r = f(o);
|
|
45
|
+
e(r);
|
|
46
|
+
try {
|
|
47
|
+
r === 1 ? localStorage.removeItem(u) : localStorage.setItem(u, String(r));
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
}, []);
|
|
51
|
+
return [t, n];
|
|
52
|
+
}
|
|
53
|
+
function b(t, e) {
|
|
54
|
+
return Math.round(t * (e ? g : 1) * 1e3) / 1e3;
|
|
55
|
+
}
|
|
56
|
+
function A(t, e, n) {
|
|
57
|
+
if (!e || e <= 0 || !t || t <= 0) return 1;
|
|
58
|
+
const o = n ? g : 1, r = Math.floor(t / e / o * 1e3 / (i * 1e3)) * i;
|
|
59
|
+
return f(Math.min(1, r));
|
|
60
|
+
}
|
|
61
|
+
const s = "nvr_layout_editor_pinned_settings", d = 60;
|
|
62
|
+
let c = null;
|
|
63
|
+
const l = /* @__PURE__ */ new Set();
|
|
64
|
+
function _() {
|
|
65
|
+
if (c) return c;
|
|
66
|
+
let t = [];
|
|
67
|
+
try {
|
|
68
|
+
const e = localStorage.getItem(s), n = e ? JSON.parse(e) : [];
|
|
69
|
+
Array.isArray(n) && (t = [...new Set(n.filter((o) => typeof o == "string" && !!o))].slice(
|
|
70
|
+
0,
|
|
71
|
+
d
|
|
72
|
+
));
|
|
73
|
+
} catch {
|
|
74
|
+
t = [];
|
|
75
|
+
}
|
|
76
|
+
return c = t, t;
|
|
77
|
+
}
|
|
78
|
+
function I(t) {
|
|
79
|
+
c = t.slice(0, d);
|
|
80
|
+
try {
|
|
81
|
+
c.length ? localStorage.setItem(s, JSON.stringify(c)) : localStorage.removeItem(s);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
for (const e of l) e();
|
|
85
|
+
}
|
|
86
|
+
function C(t) {
|
|
87
|
+
const e = _();
|
|
88
|
+
I(e.includes(t) ? e.filter((n) => n !== t) : [...e, t]);
|
|
89
|
+
}
|
|
90
|
+
function P(t) {
|
|
91
|
+
l.add(t);
|
|
92
|
+
const e = (n) => {
|
|
93
|
+
n.key === s && (c = null, t());
|
|
94
|
+
};
|
|
95
|
+
return window.addEventListener("storage", e), () => {
|
|
96
|
+
l.delete(t), window.removeEventListener("storage", e);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const Z = [];
|
|
100
|
+
function x() {
|
|
101
|
+
return y(P, _, () => Z);
|
|
27
102
|
}
|
|
28
|
-
const m = 0.8;
|
|
29
103
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
104
|
+
g as COMPACT_ZOOM,
|
|
105
|
+
d as PINS_MAX,
|
|
106
|
+
w as ZOOM_MAX,
|
|
107
|
+
O as ZOOM_MIN,
|
|
108
|
+
i as ZOOM_STEP,
|
|
109
|
+
f as clampZoom,
|
|
110
|
+
b as effectiveZoom,
|
|
111
|
+
A as fitZoom,
|
|
112
|
+
M as readViewPref,
|
|
113
|
+
v as readZoom,
|
|
114
|
+
C as togglePinnedSetting,
|
|
115
|
+
E as useCanvasZoom,
|
|
116
|
+
x as usePinnedSettings,
|
|
117
|
+
N as useViewPref,
|
|
118
|
+
h as writeViewPref
|
|
34
119
|
};
|