@nivaro/react 0.2.53 → 0.2.55
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +452 -4
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +252 -2
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/FormWhatsNew.js +60 -0
- package/dist/shared/components/ItemEditForm.js +3968 -3618
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +598 -543
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/TipLayer.js +27 -27
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +80 -67
- package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +382 -320
- package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
- package/dist/shared/components/item-edit/GroupSection.js +786 -639
- package/dist/shared/components/item-edit/HeaderTools.js +59 -56
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +94 -0
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
- package/dist/shared/components/layout-editor/AddPanel.js +226 -151
- package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
- package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
- package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
- package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
- package/dist/shared/components/layout-editor/CollabParts.js +175 -0
- package/dist/shared/components/layout-editor/DesignNode.js +311 -116
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
- package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
- package/dist/shared/components/layout-editor/FindReplace.js +188 -0
- package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
- package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
- package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
- package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
- package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
- package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
- package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
- package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
- package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
- package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
- package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
- package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
- package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
- package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
- package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
- package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
- package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
- package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
- package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
- package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
- package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
- package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
- package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
- package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
- package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
- package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
- package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
- package/dist/shared/components/layout-editor/assist/jump.js +142 -0
- package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
- package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
- package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
- package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
- package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
- package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
- package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
- package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
- package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
- package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
- package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
- package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
- package/dist/shared/components/layout-editor/commands/intents.js +214 -0
- package/dist/shared/components/layout-editor/commands/parse.js +242 -0
- package/dist/shared/components/layout-editor/design-context.js +26 -6
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
- package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
- package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
- package/dist/shared/components/layout-editor/editor-notes.js +78 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
- package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
- package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
- package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
- package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
- package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
- package/dist/shared/components/layout-editor/field-zones.js +116 -0
- package/dist/shared/components/layout-editor/form-map.js +138 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/history-api.js +87 -0
- package/dist/shared/components/layout-editor/inheritance.js +55 -0
- package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
- package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
- package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
- package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
- package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
- package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
- package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
- package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
- package/dist/shared/components/layout-editor/is-typing.js +9 -0
- package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
- package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
- package/dist/shared/components/layout-editor/load-error.js +37 -0
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
- package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
- package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
- package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
- package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
- package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
- package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
- package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
- package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
- package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
- package/dist/shared/components/layout-editor/nav/find.js +20 -0
- package/dist/shared/components/layout-editor/nav/tree.js +142 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
- package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
- package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
- package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
- package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
- package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
- package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
- package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/panel-style.js +8 -7
- package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
- package/dist/shared/components/layout-editor/pin.js +25 -0
- package/dist/shared/components/layout-editor/presence.js +111 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
- package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
- package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
- package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
- package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
- package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
- package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
- package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
- package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
- package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
- package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
- package/dist/shared/components/layout-editor/settings/controls.js +8 -8
- package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
- package/dist/shared/components/layout-editor/shortcuts.js +88 -0
- package/dist/shared/components/layout-editor/show-when.js +35 -0
- package/dist/shared/components/layout-editor/slot-names.js +4 -3
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +403 -0
- package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
- package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
- package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
- package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
- package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
- package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SuggestFormChange.js +143 -0
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/ai-fill.js +37 -0
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +133 -0
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-i18n.js +66 -0
- package/dist/shared/lib/layout-lint.js +490 -0
- package/dist/shared/lib/layout-ops.js +116 -110
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/screenshot.js +54 -28
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/visible-when.js +34 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { applyLayoutOps as y, isCanvasSlot as l, UNGROUPED_KEY as d } from "../../../lib/layout-ops.js";
|
|
2
|
+
const g = 200;
|
|
3
|
+
function u(o, t) {
|
|
4
|
+
if (t === null) return null;
|
|
5
|
+
const r = o.groups.find((a) => a.key === t);
|
|
6
|
+
return { key: t, label: t === d ? "" : (r == null ? void 0 : r.label) ?? "" };
|
|
7
|
+
}
|
|
8
|
+
function i(o, t, r) {
|
|
9
|
+
const a = o.placements.filter((p) => p.group_key === r && !l(p)).sort((p, c) => p.sort - c.sort), e = a.findIndex((p) => p.field === t);
|
|
10
|
+
return e > 0 ? a[e - 1].field : null;
|
|
11
|
+
}
|
|
12
|
+
function f(o, t, r) {
|
|
13
|
+
const a = o.groups.filter((p) => p.parent_key === r).map((p) => ({ key: p.key, sort: p.sort }));
|
|
14
|
+
if (r === null)
|
|
15
|
+
for (const p of o.placements)
|
|
16
|
+
l(p) && a.push({ key: p.field, sort: p.sort });
|
|
17
|
+
a.sort((p, c) => p.sort - c.sort);
|
|
18
|
+
const e = a.findIndex((p) => p.key === t);
|
|
19
|
+
return e > 0 ? u(o, a[e - 1].key) : null;
|
|
20
|
+
}
|
|
21
|
+
function _(o, t) {
|
|
22
|
+
const r = [];
|
|
23
|
+
let a = o;
|
|
24
|
+
for (const e of t) {
|
|
25
|
+
let p;
|
|
26
|
+
try {
|
|
27
|
+
p = y(a, [e]);
|
|
28
|
+
} catch {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
switch (e.op) {
|
|
32
|
+
case "place":
|
|
33
|
+
r.push({
|
|
34
|
+
op: "place",
|
|
35
|
+
field: e.field,
|
|
36
|
+
group: u(a, e.group_key),
|
|
37
|
+
after: i(p, e.field, e.group_key),
|
|
38
|
+
...e.patch ? { patch: e.patch } : {}
|
|
39
|
+
});
|
|
40
|
+
break;
|
|
41
|
+
case "move":
|
|
42
|
+
r.push({
|
|
43
|
+
op: "move",
|
|
44
|
+
field: e.from.field,
|
|
45
|
+
from: u(a, e.from.group_key),
|
|
46
|
+
to: u(a, e.to_group_key),
|
|
47
|
+
after: i(p, e.from.field, e.to_group_key)
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
50
|
+
case "update_placement":
|
|
51
|
+
r.push({
|
|
52
|
+
op: "update_placement",
|
|
53
|
+
field: e.at.field,
|
|
54
|
+
group: u(a, e.at.group_key),
|
|
55
|
+
patch: e.patch
|
|
56
|
+
});
|
|
57
|
+
break;
|
|
58
|
+
case "remove":
|
|
59
|
+
r.push({ op: "remove", field: e.at.field, group: u(a, e.at.group_key) });
|
|
60
|
+
break;
|
|
61
|
+
case "group_create":
|
|
62
|
+
r.push({
|
|
63
|
+
op: "group_create",
|
|
64
|
+
group: { key: e.key, label: e.label },
|
|
65
|
+
group_type: e.group_type,
|
|
66
|
+
parent: u(a, e.parent_key),
|
|
67
|
+
after: f(p, e.key, e.parent_key),
|
|
68
|
+
...e.patch ? { patch: e.patch } : {}
|
|
69
|
+
});
|
|
70
|
+
break;
|
|
71
|
+
case "group_update":
|
|
72
|
+
r.push({ op: "group_update", group: u(a, e.key), patch: e.patch });
|
|
73
|
+
break;
|
|
74
|
+
case "group_move": {
|
|
75
|
+
const c = l({ field: e.key, group_key: null });
|
|
76
|
+
r.push({
|
|
77
|
+
op: "group_move",
|
|
78
|
+
group: c ? { key: e.key, label: "" } : u(a, e.key),
|
|
79
|
+
parent: u(a, e.parent_key),
|
|
80
|
+
after: f(p, e.key, e.parent_key)
|
|
81
|
+
});
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case "group_remove":
|
|
85
|
+
r.push({
|
|
86
|
+
op: "group_remove",
|
|
87
|
+
group: u(a, e.key),
|
|
88
|
+
placements: e.placements
|
|
89
|
+
});
|
|
90
|
+
break;
|
|
91
|
+
case "layout_update":
|
|
92
|
+
r.push({ op: "layout_update", patch: e.patch });
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
a = p;
|
|
96
|
+
}
|
|
97
|
+
return r;
|
|
98
|
+
}
|
|
99
|
+
const n = (o, t) => Object.keys(o).sort().join("\0") === Object.keys(t).sort().join("\0");
|
|
100
|
+
function h(o, t) {
|
|
101
|
+
var a, e;
|
|
102
|
+
const r = o[o.length - 1];
|
|
103
|
+
if (r && r.op === t.op) {
|
|
104
|
+
if (r.op === "update_placement" && t.op === "update_placement" && r.field === t.field && ((a = r.group) == null ? void 0 : a.key) === ((e = t.group) == null ? void 0 : e.key) && n(r.patch, t.patch))
|
|
105
|
+
return [...o.slice(0, -1), t];
|
|
106
|
+
if (r.op === "group_update" && t.op === "group_update" && r.group.key === t.group.key && n(r.patch, t.patch))
|
|
107
|
+
return [...o.slice(0, -1), t];
|
|
108
|
+
if (r.op === "layout_update" && t.op === "layout_update" && n(r.patch, t.patch))
|
|
109
|
+
return [...o.slice(0, -1), t];
|
|
110
|
+
}
|
|
111
|
+
return o.length >= g ? o : [...o, t];
|
|
112
|
+
}
|
|
113
|
+
function s(o, t) {
|
|
114
|
+
var a, e;
|
|
115
|
+
const r = (p) => p === null ? "Ungrouped" : p.label || p.key;
|
|
116
|
+
switch (o.op) {
|
|
117
|
+
case "place":
|
|
118
|
+
return `Add ${t(o.field)} to ${r(o.group)}`;
|
|
119
|
+
case "move":
|
|
120
|
+
return `Move ${t(o.field)}${o.after ? ` after ${t(o.after)}` : " to the top"}${((a = o.from) == null ? void 0 : a.key) !== ((e = o.to) == null ? void 0 : e.key) ? ` in ${r(o.to)}` : ""}`;
|
|
121
|
+
case "update_placement":
|
|
122
|
+
return `Change ${t(o.field)}: ${Object.keys(o.patch).join(", ")}`;
|
|
123
|
+
case "remove":
|
|
124
|
+
return `Remove ${t(o.field)} from ${r(o.group)}`;
|
|
125
|
+
case "group_create":
|
|
126
|
+
return `Add section ${o.group.label}`;
|
|
127
|
+
case "group_update":
|
|
128
|
+
return `Change section ${r(o.group)}: ${Object.keys(o.patch).join(", ")}`;
|
|
129
|
+
case "group_move":
|
|
130
|
+
return `Move ${r(o.group)}`;
|
|
131
|
+
case "group_remove":
|
|
132
|
+
return `Remove section ${r(o.group)}`;
|
|
133
|
+
case "layout_update":
|
|
134
|
+
return `Form settings: ${Object.keys(o.patch).join(", ")}`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
g as MACRO_MAX_STEPS,
|
|
139
|
+
h as appendStep,
|
|
140
|
+
s as describeStep,
|
|
141
|
+
_ as toMacroSteps
|
|
142
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useState as m, useRef as a, useCallback as u, useMemo as y } from "react";
|
|
2
|
+
import { applyLayoutOps as z } from "../../../lib/layout-ops.js";
|
|
3
|
+
import { toMacroSteps as D, appendStep as U } from "./macro-record.js";
|
|
4
|
+
const E = (n) => n.reduce((i, d) => d.steps.reduce(U, i), []);
|
|
5
|
+
function K(n) {
|
|
6
|
+
const [i, d] = m(!1), [w, j] = m([]), [S, x] = m(null), s = a(!1), f = a([]), t = a([]), b = a(n.bundle), M = a(n.bundle);
|
|
7
|
+
M.current !== n.bundle && (M.current = n.bundle, b.current = n.bundle);
|
|
8
|
+
const o = a(n);
|
|
9
|
+
o.current = n;
|
|
10
|
+
const c = u((e) => {
|
|
11
|
+
f.current = e, j(e);
|
|
12
|
+
}, []), k = u(
|
|
13
|
+
(e, r) => {
|
|
14
|
+
const g = b.current;
|
|
15
|
+
if (s.current && g && e.length) {
|
|
16
|
+
const h = D(g, e);
|
|
17
|
+
if (h.length) {
|
|
18
|
+
const O = !!(r != null && r.text), p = f.current, l = p[p.length - 1], R = O && (l != null && l.text) && l.steps.length === 1 && h.length === 1 ? U(l.steps, h[0]) : null;
|
|
19
|
+
c(
|
|
20
|
+
R && R.length === 1 ? [...p.slice(0, -1), { ...l, steps: R }] : [...p, { steps: h, text: O, undoable: (r == null ? void 0 : r.undoable) !== !1 }]
|
|
21
|
+
), t.current = [];
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
b.current = z(g, e);
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
o.current.apply(e, r);
|
|
29
|
+
},
|
|
30
|
+
[c]
|
|
31
|
+
), B = u(() => {
|
|
32
|
+
if (s.current && o.current.canUndo) {
|
|
33
|
+
const e = f.current;
|
|
34
|
+
let r = e.length - 1;
|
|
35
|
+
for (; r >= 0 && !e[r].undoable; ) r--;
|
|
36
|
+
r >= 0 && (t.current = [...t.current, e[r]], c([...e.slice(0, r), ...e.slice(r + 1)]));
|
|
37
|
+
}
|
|
38
|
+
o.current.undo();
|
|
39
|
+
}, [c]), L = u(() => {
|
|
40
|
+
if (s.current && o.current.canRedo && t.current.length) {
|
|
41
|
+
const e = t.current[t.current.length - 1];
|
|
42
|
+
t.current = t.current.slice(0, -1), c([...f.current, e]);
|
|
43
|
+
}
|
|
44
|
+
o.current.redo();
|
|
45
|
+
}, [c]), v = u(
|
|
46
|
+
(e) => {
|
|
47
|
+
s.current = !0, t.current = [], c([]), x(e), d(!0);
|
|
48
|
+
},
|
|
49
|
+
[c]
|
|
50
|
+
), A = u(() => {
|
|
51
|
+
s.current = !1, d(!1);
|
|
52
|
+
}, []), C = u(() => {
|
|
53
|
+
s.current = !1, t.current = [], c([]), x(null), d(!1);
|
|
54
|
+
}, [c]), I = y(() => E(w), [w]), q = y(
|
|
55
|
+
() => ({ recording: i, steps: I, sourceLayoutId: S, start: v, stop: A, clear: C }),
|
|
56
|
+
[i, I, S, v, A, C]
|
|
57
|
+
);
|
|
58
|
+
return { draft: y(
|
|
59
|
+
() => ({ ...n, apply: k, undo: B, redo: L }),
|
|
60
|
+
[n, k, B, L]
|
|
61
|
+
), recorder: q };
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
K as useMacroRecorder
|
|
65
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { UNGROUPED_KEY as E, sortBundleRows as Y, HEADER_GROUP_KEY as j, GROUP_PATCH_KEYS as H, PLACEMENT_PATCH_KEYS as W } from "../../lib/layout-ops.js";
|
|
2
|
+
import { placementTarget as h } from "./bundle-to-active.js";
|
|
3
|
+
import { targetKey as C } from "./design-context.js";
|
|
4
|
+
const D = /* @__PURE__ */ new Set(["id", "collection", "created_at", "updated_at"]);
|
|
5
|
+
function O(n) {
|
|
6
|
+
if (typeof n == "string") {
|
|
7
|
+
const t = n.trim();
|
|
8
|
+
if (t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]"))
|
|
9
|
+
try {
|
|
10
|
+
return JSON.parse(t);
|
|
11
|
+
} catch {
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
return n === "" ? null : n;
|
|
15
|
+
}
|
|
16
|
+
return n === void 0 ? null : n;
|
|
17
|
+
}
|
|
18
|
+
function A(n, t) {
|
|
19
|
+
return JSON.stringify(O(n)) === JSON.stringify(O(t));
|
|
20
|
+
}
|
|
21
|
+
const _ = (n, t) => `${n}\0${t ?? ""}`;
|
|
22
|
+
function K(n, t) {
|
|
23
|
+
var a;
|
|
24
|
+
if (t == null || t === E) return "Ungrouped";
|
|
25
|
+
if (t === j) return "Header";
|
|
26
|
+
const i = n.find((p) => p.key === t);
|
|
27
|
+
return ((a = i == null ? void 0 : i.label) == null ? void 0 : a.trim()) || t;
|
|
28
|
+
}
|
|
29
|
+
const P = (n, t, i) => i.filter(
|
|
30
|
+
(a) => !A(n[a], t[a])
|
|
31
|
+
);
|
|
32
|
+
function $(n, t) {
|
|
33
|
+
const i = [...n].sort((a, p) => a.sort - p.sort);
|
|
34
|
+
for (const a of [...t].sort((p, f) => p.index - f.index))
|
|
35
|
+
i.splice(Math.min(a.index, i.length), 0, a.row);
|
|
36
|
+
return i.map((a, p) => ({ ...a, sort: p }));
|
|
37
|
+
}
|
|
38
|
+
function B(n, t) {
|
|
39
|
+
var G;
|
|
40
|
+
const i = /* @__PURE__ */ new Map(), a = { added: 0, moved: 0, removed: 0, changed: 0 }, p = (e, o) => {
|
|
41
|
+
i.set(C(e), o), a[o.kind]++;
|
|
42
|
+
}, f = new Map(n.groups.map((e) => [e.key, e])), N = new Map(t.groups.map((e) => [e.key, e]));
|
|
43
|
+
for (const e of t.groups) {
|
|
44
|
+
if (e.key === E) continue;
|
|
45
|
+
const o = f.get(e.key);
|
|
46
|
+
if (!o) {
|
|
47
|
+
p({ kind: "group", key: e.key }, { kind: "added" });
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if ((o.parent_key ?? null) !== (e.parent_key ?? null)) {
|
|
51
|
+
p(
|
|
52
|
+
{ kind: "group", key: e.key },
|
|
53
|
+
{
|
|
54
|
+
kind: "moved",
|
|
55
|
+
detail: `from ${o.parent_key ? K(n.groups, o.parent_key) : "the top level"}`
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const s = P(o, e, H);
|
|
61
|
+
s.length && p({ kind: "group", key: e.key }, { kind: "changed", detail: s.join(", ") });
|
|
62
|
+
}
|
|
63
|
+
const w = [];
|
|
64
|
+
for (const e of n.groups)
|
|
65
|
+
e.key === E || N.has(e.key) || (w.push(e), p({ kind: "group", key: e.key }, { kind: "removed" }));
|
|
66
|
+
const R = new Map(n.placements.map((e) => [_(e.field, e.group_key), e])), U = new Set(t.placements.map((e) => _(e.field, e.group_key))), k = /* @__PURE__ */ new Map();
|
|
67
|
+
for (const e of n.placements)
|
|
68
|
+
U.has(_(e.field, e.group_key)) || k.set(e.field, [...k.get(e.field) ?? [], e]);
|
|
69
|
+
for (const e of t.placements) {
|
|
70
|
+
const o = R.get(_(e.field, e.group_key));
|
|
71
|
+
if (o) {
|
|
72
|
+
const c = P(o, e, W);
|
|
73
|
+
c.length && p(h(e), { kind: "changed", detail: c.join(", ") });
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const s = (G = k.get(e.field)) == null ? void 0 : G.shift();
|
|
77
|
+
s ? p(h(e), {
|
|
78
|
+
kind: "moved",
|
|
79
|
+
detail: `from ${K(n.groups, s.group_key)}`
|
|
80
|
+
}) : p(h(e), { kind: "added" });
|
|
81
|
+
}
|
|
82
|
+
const M = [...k.values()].flat();
|
|
83
|
+
for (const e of M) p(h(e), { kind: "removed" });
|
|
84
|
+
let x = t.groups;
|
|
85
|
+
if (w.length) {
|
|
86
|
+
const e = new Set(t.groups.map((r) => r.key)), o = [...w], s = [];
|
|
87
|
+
for (let r = 0; o.length && r < 50; r++)
|
|
88
|
+
for (let l = o.length - 1; l >= 0; l--) {
|
|
89
|
+
const u = o[l];
|
|
90
|
+
if (u.parent_key != null && !e.has(u.parent_key) && o.some((v) => v.key === u.parent_key))
|
|
91
|
+
continue;
|
|
92
|
+
const d = u.parent_key != null && e.has(u.parent_key) ? u.parent_key : null;
|
|
93
|
+
s.push({ ...u, id: void 0, parent_key: d }), e.add(u.key), o.splice(l, 1);
|
|
94
|
+
}
|
|
95
|
+
const c = /* @__PURE__ */ new Map();
|
|
96
|
+
for (const r of [...t.groups, ...s]) {
|
|
97
|
+
const l = r.parent_key ?? "";
|
|
98
|
+
c.set(l, [...c.get(l) ?? [], r]);
|
|
99
|
+
}
|
|
100
|
+
const y = new Set(s.map((r) => r.key));
|
|
101
|
+
x = [];
|
|
102
|
+
for (const r of c.values()) {
|
|
103
|
+
const l = r.filter((d) => !y.has(d.key)), u = r.filter((d) => y.has(d.key)).map((d) => {
|
|
104
|
+
const v = n.groups.filter((g) => {
|
|
105
|
+
var m;
|
|
106
|
+
return (g.parent_key ?? null) === (((m = f.get(d.key)) == null ? void 0 : m.parent_key) ?? null);
|
|
107
|
+
}).sort((g, m) => g.sort - m.sort);
|
|
108
|
+
return {
|
|
109
|
+
row: d,
|
|
110
|
+
index: Math.max(
|
|
111
|
+
0,
|
|
112
|
+
v.findIndex((g) => g.key === d.key)
|
|
113
|
+
)
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
x.push(...$(l, u));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
let S = t.placements;
|
|
120
|
+
if (M.length) {
|
|
121
|
+
const e = /* @__PURE__ */ new Map();
|
|
122
|
+
for (const s of t.placements) {
|
|
123
|
+
const c = s.group_key ?? "";
|
|
124
|
+
e.set(c, [...e.get(c) ?? [], s]);
|
|
125
|
+
}
|
|
126
|
+
const o = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const s of M) {
|
|
128
|
+
const c = s.group_key ?? "", y = n.placements.filter((r) => (r.group_key ?? "") === c).sort((r, l) => r.sort - l.sort).findIndex((r) => r.field === s.field);
|
|
129
|
+
o.set(c, [
|
|
130
|
+
...o.get(c) ?? [],
|
|
131
|
+
{ row: { ...s, id: void 0 }, index: Math.max(0, y) }
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
S = [];
|
|
135
|
+
for (const s of /* @__PURE__ */ new Set([...e.keys(), ...o.keys()]))
|
|
136
|
+
S.push(...$(e.get(s) ?? [], o.get(s) ?? []));
|
|
137
|
+
}
|
|
138
|
+
const T = Object.keys({ ...n.layout, ...t.layout }).filter(
|
|
139
|
+
(e) => !D.has(e) && !A(n.layout[e], t.layout[e])
|
|
140
|
+
);
|
|
141
|
+
return {
|
|
142
|
+
bundle: Y({ ...t, groups: x, placements: S }),
|
|
143
|
+
marks: i,
|
|
144
|
+
counts: a,
|
|
145
|
+
settings: T
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function V(n) {
|
|
149
|
+
const t = ["added", "moved", "removed", "changed"].filter((i) => n.counts[i] > 0).map((i) => `${n.counts[i]} ${i}`);
|
|
150
|
+
return n.settings.length && t.push(`${n.settings.length} form setting${n.settings.length === 1 ? "" : "s"}`), t.length ? t.join(" · ") : null;
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
B as canvasDiff,
|
|
154
|
+
V as diffSummary,
|
|
155
|
+
A as sameValue,
|
|
156
|
+
K as sectionLabel
|
|
157
|
+
};
|