@nivaro/react 0.3.36 → 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.
Files changed (102) hide show
  1. package/dist/components/slots/CommentsSlot.js +44 -36
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +9 -1
  5. package/dist/shared/components/AgentBadge.js +26 -0
  6. package/dist/shared/components/AgentQuestionsCard.js +198 -0
  7. package/dist/shared/components/ItemEditForm.js +3329 -3263
  8. package/dist/shared/components/McpConnectionScope.js +480 -0
  9. package/dist/shared/components/MyWorkView.js +223 -208
  10. package/dist/shared/components/RecordReadView.js +620 -575
  11. package/dist/shared/components/chat/ChatPanel.js +683 -671
  12. package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
  13. package/dist/shared/components/imports/ImportConsole.js +106 -104
  14. package/dist/shared/components/imports/RunDetailSheet.js +11 -10
  15. package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
  16. package/dist/shared/components/item-edit/FormTour.js +279 -0
  17. package/dist/shared/components/item-edit/GroupSection.js +377 -360
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
  19. package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
  20. package/dist/shared/components/item-edit/form-density.js +36 -0
  21. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
  22. package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
  23. package/dist/shared/components/layout-editor/AddPanel.js +349 -192
  24. package/dist/shared/components/layout-editor/DesignNode.js +126 -112
  25. package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
  26. package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
  27. package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
  28. package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
  29. package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
  30. package/dist/shared/components/layout-editor/add-target.js +54 -43
  31. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
  32. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
  33. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
  34. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
  35. package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
  36. package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
  37. package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
  38. package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
  39. package/dist/shared/components/layout-editor/dnd/node.js +115 -105
  40. package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
  41. package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
  42. package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
  43. package/dist/shared/components/layout-editor/even-row.js +86 -0
  44. package/dist/shared/components/layout-editor/field-list.js +99 -0
  45. package/dist/shared/components/layout-editor/format-painter.js +102 -0
  46. package/dist/shared/components/layout-editor/grid-guides.js +15 -13
  47. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
  48. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
  49. package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
  50. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
  51. package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
  52. package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
  53. package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
  54. package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
  55. package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
  56. package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
  57. package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
  58. package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
  59. package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
  60. package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
  61. package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
  62. package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
  63. package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
  64. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
  65. package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
  66. package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
  67. package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
  68. package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
  69. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  70. package/dist/shared/components/layout-editor/pin.js +37 -19
  71. package/dist/shared/components/layout-editor/place-clip.js +257 -0
  72. package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
  73. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
  74. package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
  75. package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
  76. package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
  77. package/dist/shared/components/layout-editor/removed-log.js +151 -0
  78. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
  79. package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
  80. package/dist/shared/components/layout-editor/revert-element.js +140 -0
  81. package/dist/shared/components/layout-editor/section-structure.js +193 -170
  82. package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
  83. package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
  84. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
  85. package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
  86. package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
  87. package/dist/shared/components/layout-editor/shortcuts.js +21 -16
  88. package/dist/shared/components/layout-editor/structure-ops.js +221 -195
  89. package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
  90. package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
  91. package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
  92. package/dist/shared/components/panels/CommentPanel.js +47 -45
  93. package/dist/shared/components/panels/RevisionsPanel.js +66 -64
  94. package/dist/shared/components/panels/TaskPanel.js +395 -332
  95. package/dist/shared/components/profile/AgentsPanel.js +196 -147
  96. package/dist/shared/components/profile/ConnectionRollback.js +329 -0
  97. package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
  98. package/dist/shared/lib/entry-config.js +22 -22
  99. package/dist/shared/lib/form-usage-beacon.js +91 -55
  100. package/dist/shared/lib/layout-lint.js +530 -284
  101. package/dist/shared/lib/layout-resolve.js +58 -44
  102. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- const p = 3, u = 50, E = 16, A = 20, g = 200, l = [
1
+ const u = 3, p = 50, E = 16, A = 20, g = 200, a = [
2
2
  "slate",
3
3
  "blue",
4
4
  "cyan",
@@ -7,15 +7,15 @@ const p = 3, u = 50, E = 16, A = 20, g = 200, l = [
7
7
  "orange",
8
8
  "rose",
9
9
  "violet"
10
- ], a = ["width", "required", "help", "placeholder", "input", "lock"], o = (e) => !!e && typeof e == "object" && !Array.isArray(e), _ = /^[A-Za-z_][A-Za-z0-9_.]*$/;
10
+ ], l = ["width", "required", "help", "placeholder", "input", "lock"], o = (e) => !!e && typeof e == "object" && !Array.isArray(e), _ = /^[A-Za-z_][A-Za-z0-9_.]*$/;
11
11
  function f(e) {
12
12
  if (!o(e)) return null;
13
- const t = typeof e.name == "string" ? e.name.replace(/\s+/g, " ").trim().slice(0, 60) : "", s = typeof e.id == "string" ? e.id.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 40) : "";
14
- if (!t || !s) return null;
13
+ const t = typeof e.name == "string" ? e.name.replace(/\s+/g, " ").trim().slice(0, 60) : "", n = typeof e.id == "string" ? e.id.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 40) : "";
14
+ if (!t || !n) return null;
15
15
  const r = (Array.isArray(e.parts) ? e.parts : []).filter(
16
- (c) => a.includes(c)
17
- ), n = { id: s, name: t, parts: [...new Set(r)] };
18
- return (e.col_span === null || typeof e.col_span == "number") && (n.col_span = e.col_span === null ? null : Math.min(12, Math.max(1, Math.round(e.col_span)))), o(e.overrides) && (n.overrides = e.overrides), (e.lock_conditions === null || typeof e.lock_conditions == "string") && (n.lock_conditions = e.lock_conditions), n;
16
+ (c) => l.includes(c)
17
+ ), s = { id: n, name: t, parts: [...new Set(r)] };
18
+ return (e.col_span === null || typeof e.col_span == "number") && (s.col_span = e.col_span === null ? null : Math.min(12, Math.max(1, Math.round(e.col_span)))), o(e.overrides) && (s.overrides = e.overrides), (e.lock_conditions === null || typeof e.lock_conditions == "string") && (s.lock_conditions = e.lock_conditions), s;
19
19
  }
20
20
  function d(e) {
21
21
  let t = e;
@@ -26,30 +26,30 @@ function d(e) {
26
26
  return null;
27
27
  }
28
28
  if (!o(t)) return null;
29
- const s = {};
30
- if (t.focus_first === !0 && (s.focus_first = !0), t.enter_next === !0 && (s.enter_next = !0), t.adaptive === !0 && (s.adaptive = !0), t.glossary === !1 && (s.glossary = !1), typeof t.adaptive_threshold == "number" && Number.isFinite(t.adaptive_threshold)) {
29
+ const n = {};
30
+ if (t.focus_first === !0 && (n.focus_first = !0), t.enter_next === !0 && (n.enter_next = !0), t.adaptive === !0 && (n.adaptive = !0), t.glossary === !1 && (n.glossary = !1), t.density === "compact" && (n.density = "compact"), t.tour === !0 && (n.tour = !0), typeof t.adaptive_threshold == "number" && Number.isFinite(t.adaptive_threshold)) {
31
31
  const r = Math.min(50, Math.max(1, Math.round(t.adaptive_threshold)));
32
- r !== 3 && (s.adaptive_threshold = r);
32
+ r !== 3 && (n.adaptive_threshold = r);
33
33
  }
34
34
  if (Array.isArray(t.tab_order)) {
35
35
  const r = [
36
- ...new Set(t.tab_order.filter((n) => typeof n == "string" && _.test(n)))
36
+ ...new Set(t.tab_order.filter((s) => typeof s == "string" && _.test(s)))
37
37
  ].slice(0, 200);
38
- r.length && (s.tab_order = r);
38
+ r.length && (n.tab_order = r);
39
39
  }
40
40
  if (o(t.badge)) {
41
- const r = typeof t.badge.tag == "string" ? t.badge.tag.replace(/\s+/g, " ").trim().slice(0, 16) : "", n = l.includes(t.badge.color) ? t.badge.color : "slate";
42
- r && (s.badge = { tag: r, color: n });
41
+ const r = typeof t.badge.tag == "string" ? t.badge.tag.replace(/\s+/g, " ").trim().slice(0, 16) : "", s = a.includes(t.badge.color) ? t.badge.color : "slate";
42
+ r && (n.badge = { tag: r, color: s });
43
43
  }
44
44
  if (Array.isArray(t.presets)) {
45
- const r = /* @__PURE__ */ new Set(), n = [];
45
+ const r = /* @__PURE__ */ new Set(), s = [];
46
46
  for (const c of t.presets) {
47
47
  const i = f(c);
48
- if (i && !r.has(i.id) && (r.add(i.id), n.push(i)), n.length >= 20) break;
48
+ if (i && !r.has(i.id) && (r.add(i.id), s.push(i)), s.length >= 20) break;
49
49
  }
50
- n.length && (s.presets = n);
50
+ s.length && (n.presets = s);
51
51
  }
52
- return Object.keys(s).length ? s : null;
52
+ return Object.keys(n).length ? n : null;
53
53
  }
54
54
  function T(e) {
55
55
  return d(e == null ? void 0 : e.entry_config) ?? {};
@@ -58,13 +58,13 @@ function h(e, t) {
58
58
  return e < (t.adaptive_threshold ?? 3);
59
59
  }
60
60
  export {
61
- l as BADGE_COLORS,
61
+ a as BADGE_COLORS,
62
62
  E as ENTRY_BADGE_TAG_MAX,
63
63
  A as ENTRY_PRESETS_MAX,
64
64
  g as ENTRY_TAB_ORDER_MAX,
65
- p as ENTRY_THRESHOLD_DEFAULT,
66
- u as ENTRY_THRESHOLD_MAX,
67
- a as PRESET_PARTS,
65
+ u as ENTRY_THRESHOLD_DEFAULT,
66
+ p as ENTRY_THRESHOLD_MAX,
67
+ l as PRESET_PARTS,
68
68
  T as entryConfigOf,
69
69
  h as isBeginner,
70
70
  d as sanitizeEntryConfig
@@ -1,21 +1,21 @@
1
- var S = Object.defineProperty;
2
- var w = (t, e, n) => e in t ? S(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var i = (t, e, n) => w(t, typeof e != "symbol" ? e + "" : e, n);
4
- const r = [];
5
- let h = null, a = null, d = !1;
6
- const p = 20, v = 15e3;
7
- function l() {
8
- if (a && (clearTimeout(a), a = null), !h || r.length === 0) return;
1
+ var w = Object.defineProperty;
2
+ var g = (t, e, n) => e in t ? w(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var o = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n);
4
+ const l = [];
5
+ let h = null, c = null, p = !1;
6
+ const v = 20, m = 15e3;
7
+ function a() {
8
+ if (c && (clearTimeout(c), c = null), !h || l.length === 0) return;
9
9
  const { apiBase: t, authHeaders: e, credentials: n } = h;
10
- for (; r.length; ) {
11
- const s = JSON.stringify({ events: r.splice(0, p) });
10
+ for (; l.length; ) {
11
+ const i = JSON.stringify({ events: l.splice(0, v) });
12
12
  try {
13
- const o = `${t}/layout-usage/beacon`;
14
- !(Object.keys(e).length > 0) && typeof navigator < "u" && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(o, new Blob([s], { type: "application/json" })) || fetch(o, {
13
+ const s = `${t}/layout-usage/beacon`;
14
+ !(Object.keys(e).length > 0) && typeof navigator < "u" && typeof navigator.sendBeacon == "function" && navigator.sendBeacon(s, new Blob([i], { type: "application/json" })) || fetch(s, {
15
15
  method: "POST",
16
16
  credentials: n,
17
17
  headers: { "Content-Type": "application/json", ...e },
18
- body: s,
18
+ body: i,
19
19
  keepalive: !0
20
20
  }).catch(() => {
21
21
  });
@@ -23,20 +23,20 @@ function l() {
23
23
  }
24
24
  }
25
25
  }
26
- function g() {
27
- d || typeof window > "u" || (d = !0, window.addEventListener("pagehide", l), document.addEventListener("visibilitychange", () => {
28
- document.visibilityState === "hidden" && l();
26
+ function y() {
27
+ p || typeof window > "u" || (p = !0, window.addEventListener("pagehide", a), document.addEventListener("visibilitychange", () => {
28
+ document.visibilityState === "hidden" && a();
29
29
  }));
30
30
  }
31
- function _(t, e) {
32
- h = e, r.push(t), g(), r.length >= p ? l() : a || (a = setTimeout(l, v));
31
+ function O(t, e) {
32
+ h = e, l.push(t), y(), l.length >= v ? a() : c || (c = setTimeout(a, m));
33
33
  }
34
- class k {
35
- constructor(e, n, s = !0) {
36
- i(this, "steps", {});
37
- i(this, "current");
38
- i(this, "since");
39
- this.current = e, this.since = s ? n : null;
34
+ class _ {
35
+ constructor(e, n, i = !0) {
36
+ o(this, "steps", {});
37
+ o(this, "current");
38
+ o(this, "since");
39
+ this.current = e, this.since = i ? n : null;
40
40
  }
41
41
  settle(e) {
42
42
  if (this.since == null) return;
@@ -58,53 +58,88 @@ class k {
58
58
  /** The time so far in this chunk, without starting afresh. */
59
59
  peek(e) {
60
60
  const n = this.since == null ? 0 : Math.max(0, e - this.since);
61
- return Object.values(this.steps).reduce((s, o) => s + o, 0) + n;
61
+ return Object.values(this.steps).reduce((i, s) => i + s, 0) + n;
62
62
  }
63
63
  /** The time so far, and start counting afresh (the clock keeps running). */
64
64
  take(e) {
65
65
  this.settle(e);
66
66
  const n = this.steps;
67
- return this.steps = {}, { steps: n, total: Object.values(n).reduce((s, o) => s + o, 0) };
67
+ return this.steps = {}, { steps: n, total: Object.values(n).reduce((i, s) => i + s, 0) };
68
68
  }
69
69
  }
70
- const m = 400, y = 3e3;
71
- function B(t) {
72
- if (!t.saved && !t.openSent && t.elapsed < m || !t.saved && t.openSent && t.total <= 0) return null;
73
- const e = {
70
+ class A {
71
+ constructor() {
72
+ o(this, "tries", 0);
73
+ o(this, "fields", {});
74
+ }
75
+ note(e, n) {
76
+ const i = Object.keys(e).filter((s) => /^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(s));
77
+ if (i.length !== 0) {
78
+ this.tries++;
79
+ for (const s of i.slice(0, 60)) {
80
+ this.fields[s] || (this.fields[s] = { required: 0, invalid: 0 });
81
+ const d = this.fields[s], u = e[s] ?? "";
82
+ n === "required" || n == null && (u === "This field is required" || /^At least one .+ is required$/.test(u)) ? d.required++ : d.invalid++;
83
+ }
84
+ }
85
+ }
86
+ /** What to send, and start counting afresh; null when nothing was refused. */
87
+ take() {
88
+ if (this.tries === 0) return null;
89
+ const e = { tries: this.tries, fields: this.fields };
90
+ return this.tries = 0, this.fields = {}, e;
91
+ }
92
+ /** Put an unsent chunk back (the event was not sent). */
93
+ restore(e) {
94
+ if (e) {
95
+ this.tries += e.tries;
96
+ for (const [n, i] of Object.entries(e.fields)) {
97
+ this.fields[n] || (this.fields[n] = { required: 0, invalid: 0 });
98
+ const s = this.fields[n];
99
+ s.required += i.required, s.invalid += i.invalid;
100
+ }
101
+ }
102
+ }
103
+ }
104
+ const b = 400, M = 3e3;
105
+ function T(t) {
106
+ const e = t.refused && t.refused.tries > 0 ? t.refused : null;
107
+ if (!t.saved && !e && !t.openSent && t.elapsed < b || !t.saved && !e && t.openSent && t.total <= 0) return null;
108
+ const n = {
74
109
  layout_id: t.layoutId,
75
110
  collection: t.collection,
76
111
  item: t.item,
77
112
  open: !t.openSent,
78
113
  saved: t.saved,
79
- abandoned_step: t.final && t.item == null && !t.saved && t.elapsed >= y ? t.step : null,
114
+ abandoned_step: t.final && t.item == null && !t.saved && t.elapsed >= M ? t.step : null,
80
115
  steps: t.steps
81
116
  };
82
- return t.sections && (t.sections.shown.length || t.sections.opened.length) && (e.sections = t.sections), t.saved && t.saveMs != null && t.saveMs > 0 && (e.save_ms = Math.round(t.saveMs)), e;
117
+ return t.sections && (t.sections.shown.length || t.sections.opened.length) && (n.sections = t.sections), t.saved && t.saveMs != null && t.saveMs > 0 && (n.save_ms = Math.round(t.saveMs)), e && (n.refused = e), n;
83
118
  }
84
- const u = /* @__PURE__ */ new Set(), c = [], f = 5e3;
85
- function N(t) {
119
+ const f = /* @__PURE__ */ new Set(), r = [], S = 5e3;
120
+ function j(t) {
86
121
  const e = Date.now();
87
- for (c.push({ ...t, at: e }); c.length > 200 || c[0] && e - c[0].at > f; )
88
- c.shift();
89
- for (const n of u)
122
+ for (r.push({ ...t, at: e }); r.length > 200 || r[0] && e - r[0].at > S; )
123
+ r.shift();
124
+ for (const n of f)
90
125
  try {
91
126
  n(t);
92
127
  } catch {
93
128
  }
94
129
  }
95
- function T(t) {
130
+ function B(t) {
96
131
  const e = Date.now();
97
- for (const n of c) n.kind === "shown" && e - n.at <= f && t(n);
98
- return u.add(t), () => {
99
- u.delete(t);
132
+ for (const n of r) n.kind === "shown" && e - n.at <= S && t(n);
133
+ return f.add(t), () => {
134
+ f.delete(t);
100
135
  };
101
136
  }
102
- class j {
137
+ class N {
103
138
  constructor() {
104
- i(this, "shown", /* @__PURE__ */ new Set());
105
- i(this, "opened", /* @__PURE__ */ new Set());
106
- i(this, "sentShown", /* @__PURE__ */ new Set());
107
- i(this, "sentOpened", /* @__PURE__ */ new Set());
139
+ o(this, "shown", /* @__PURE__ */ new Set());
140
+ o(this, "opened", /* @__PURE__ */ new Set());
141
+ o(this, "sentShown", /* @__PURE__ */ new Set());
142
+ o(this, "sentOpened", /* @__PURE__ */ new Set());
108
143
  }
109
144
  note(e, n) {
110
145
  e === "opened" ? (this.shown.add(n), this.opened.add(n)) : this.shown.add(n);
@@ -121,13 +156,14 @@ class j {
121
156
  }
122
157
  }
123
158
  export {
124
- y as MIN_ABANDON_MS,
125
- m as MIN_SESSION_MS,
126
- j as SectionTally,
127
- k as StepClock,
128
- l as flushFormUsage,
129
- T as onSectionUse,
130
- _ as queueFormUsage,
131
- N as reportSectionUse,
132
- B as sessionEvent
159
+ M as MIN_ABANDON_MS,
160
+ b as MIN_SESSION_MS,
161
+ A as RefusalTally,
162
+ N as SectionTally,
163
+ _ as StepClock,
164
+ a as flushFormUsage,
165
+ B as onSectionUse,
166
+ O as queueFormUsage,
167
+ j as reportSectionUse,
168
+ T as sessionEvent
133
169
  };