@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
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var J = Object.defineProperty;
|
|
2
|
+
var M = (e, t, i) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var g = (e, t, i) => M(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
4
|
import { useDraggable as _, useDroppable as w } from "@dnd-kit/core";
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { isCanvasSlot as
|
|
7
|
-
import { targetKey as
|
|
8
|
-
import { dndRole as
|
|
9
|
-
const
|
|
5
|
+
import { createContext as P, useContext as S, useId as $, useRef as y, useCallback as R, useEffect as H, useSyncExternalStore as z } from "react";
|
|
6
|
+
import { isCanvasSlot as L } from "../../../lib/layout-ops.js";
|
|
7
|
+
import { targetKey as E } from "../design-context.js";
|
|
8
|
+
import { dndRole as O } from "./collision.js";
|
|
9
|
+
const q = { activeKey: null, overKey: null, side: null, indicator: null };
|
|
10
10
|
class Y {
|
|
11
11
|
constructor() {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
g(this, "bundle", null);
|
|
13
|
+
g(this, "state", q);
|
|
14
14
|
/** Registered element → its pointer activator (dnd-kit's onPointerDown). */
|
|
15
|
-
|
|
15
|
+
g(this, "activators", /* @__PURE__ */ new WeakMap());
|
|
16
16
|
/** Droppable id → registered element (the overlay copies it, the drop line measures it). */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
g(this, "nodes", /* @__PURE__ */ new Map());
|
|
18
|
+
/** A width is being dragged on the canvas (#2701): the column guides show. */
|
|
19
|
+
g(this, "resizing", !1);
|
|
20
|
+
g(this, "subs", /* @__PURE__ */ new Set());
|
|
21
|
+
g(this, "subscribe", (t) => (this.subs.add(t), () => {
|
|
20
22
|
this.subs.delete(t);
|
|
21
23
|
}));
|
|
22
24
|
}
|
|
@@ -24,9 +26,19 @@ class Y {
|
|
|
24
26
|
const i = { ...this.state, ...t }, n = this.state;
|
|
25
27
|
if (!(i.activeKey === n.activeKey && i.overKey === n.overKey && i.side === n.side && JSON.stringify(i.indicator) === JSON.stringify(n.indicator))) {
|
|
26
28
|
this.state = i;
|
|
27
|
-
for (const
|
|
29
|
+
for (const r of this.subs) r();
|
|
28
30
|
}
|
|
29
31
|
}
|
|
32
|
+
setResizing(t) {
|
|
33
|
+
if (this.resizing !== t) {
|
|
34
|
+
this.resizing = t;
|
|
35
|
+
for (const i of this.subs) i();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Column guides (#2701): on while something drags or a width is dragged. */
|
|
39
|
+
guidesOn() {
|
|
40
|
+
return this.state.activeKey !== null || this.resizing;
|
|
41
|
+
}
|
|
30
42
|
/** What one node renders from: a node re-renders only when its slice changes. */
|
|
31
43
|
slice(t) {
|
|
32
44
|
const i = this.state, n = i.overKey === t ? `${i.side}${JSON.stringify(i.indicator)}` : "";
|
|
@@ -37,11 +49,11 @@ class Y {
|
|
|
37
49
|
i && this.nodes.get(t) === i && this.nodes.delete(t), n && this.nodes.set(t, n);
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
|
-
const m =
|
|
52
|
+
const m = P(null), F = {
|
|
41
53
|
draggableProps: () => ({}),
|
|
42
54
|
isDragging: () => !1,
|
|
43
55
|
dropSlot: () => null
|
|
44
|
-
},
|
|
56
|
+
}, x = () => () => {
|
|
45
57
|
};
|
|
46
58
|
function G(e) {
|
|
47
59
|
if (!e) return 0;
|
|
@@ -52,63 +64,63 @@ function G(e) {
|
|
|
52
64
|
return t ? t.getBoundingClientRect().bottom - e.getBoundingClientRect().top : 0;
|
|
53
65
|
}
|
|
54
66
|
function tt(e, t, i = {}) {
|
|
55
|
-
var
|
|
56
|
-
const n = S(m),
|
|
67
|
+
var N, A;
|
|
68
|
+
const n = S(m), r = E(t), c = $(), l = y(null), s = n != null && n.bundle ? O(n.bundle, t) : null, a = !!n && !!s && !i.disabled && e !== F, u = a ? r : `${r}#${c}`, d = s ? {
|
|
57
69
|
target: t,
|
|
58
70
|
role: s,
|
|
59
71
|
headerHeight: s.kind === "group" ? () => G(l.current) : void 0
|
|
60
|
-
} : void 0,
|
|
61
|
-
|
|
62
|
-
(n == null ? void 0 : n.subscribe) ??
|
|
63
|
-
() => (n == null ? void 0 : n.slice(
|
|
72
|
+
} : void 0, o = _({ id: u, data: d, disabled: !a }), h = w({ id: u, data: d, disabled: !a || !!i.noDrop });
|
|
73
|
+
z(
|
|
74
|
+
(n == null ? void 0 : n.subscribe) ?? x,
|
|
75
|
+
() => (n == null ? void 0 : n.slice(r)) ?? "",
|
|
64
76
|
() => ""
|
|
65
77
|
);
|
|
66
|
-
const D = y(
|
|
67
|
-
D.current =
|
|
68
|
-
const { setNodeRef: p, setActivatorNodeRef:
|
|
69
|
-
(
|
|
70
|
-
n == null || n.track(
|
|
71
|
-
|
|
78
|
+
const D = y(o.listeners);
|
|
79
|
+
D.current = o.listeners;
|
|
80
|
+
const { setNodeRef: p, setActivatorNodeRef: v } = o, f = h.setNodeRef, I = R(
|
|
81
|
+
(b) => {
|
|
82
|
+
n == null || n.track(r, l.current, b), l.current = b, p(b), f(b), v(b), b && n && n.activators.set(
|
|
83
|
+
b,
|
|
72
84
|
() => {
|
|
73
85
|
var C;
|
|
74
86
|
return (C = D.current) == null ? void 0 : C.onPointerDown;
|
|
75
87
|
}
|
|
76
88
|
);
|
|
77
89
|
},
|
|
78
|
-
[
|
|
90
|
+
[r, v, p, f, n]
|
|
79
91
|
);
|
|
80
92
|
if (!n)
|
|
81
93
|
return {
|
|
82
94
|
props: e.draggableProps(t, i.disabled ? { disabled: !0 } : void 0),
|
|
83
95
|
dragging: e.isDragging(t),
|
|
84
96
|
slot: e.dropSlot(t),
|
|
85
|
-
indicator: ((
|
|
97
|
+
indicator: ((N = e.dropIndicator) == null ? void 0 : N.call(e, t)) ?? null
|
|
86
98
|
};
|
|
87
|
-
const
|
|
99
|
+
const k = n.state, K = k.overKey === r;
|
|
88
100
|
return {
|
|
89
101
|
// The pointer activator is not spread here: LayoutDndProvider relays
|
|
90
102
|
// pointerdown to it. The keyboard one stays on the node.
|
|
91
|
-
props: a ? { ref:
|
|
92
|
-
dragging:
|
|
93
|
-
slot:
|
|
94
|
-
indicator:
|
|
103
|
+
props: a ? { ref: I, ...o.attributes, onKeyDown: (A = o.listeners) == null ? void 0 : A.onKeyDown } : {},
|
|
104
|
+
dragging: k.activeKey === r,
|
|
105
|
+
slot: K ? k.side : null,
|
|
106
|
+
indicator: K ? k.indicator : null
|
|
95
107
|
};
|
|
96
108
|
}
|
|
97
109
|
function et(e) {
|
|
98
|
-
const t = S(m), i = `body:${e}`, n = t != null && t.bundle ?
|
|
110
|
+
const t = S(m), i = `body:${e}`, n = t != null && t.bundle ? O(t.bundle, { kind: "group", key: e }) : null, r = (n == null ? void 0 : n.kind) === "group" && n.body, c = w({
|
|
99
111
|
id: i,
|
|
100
112
|
data: { target: { kind: "group", key: e }, role: { kind: "body", key: e } },
|
|
101
|
-
disabled: !
|
|
113
|
+
disabled: !r
|
|
102
114
|
});
|
|
103
|
-
|
|
104
|
-
(t == null ? void 0 : t.subscribe) ??
|
|
115
|
+
z(
|
|
116
|
+
(t == null ? void 0 : t.subscribe) ?? x,
|
|
105
117
|
() => (t == null ? void 0 : t.slice(i)) ?? "",
|
|
106
118
|
() => ""
|
|
107
119
|
);
|
|
108
120
|
const l = y(null), s = c.setNodeRef, a = R(
|
|
109
121
|
(d) => {
|
|
110
|
-
const
|
|
111
|
-
t == null || t.track(i, l.current,
|
|
122
|
+
const o = (d == null ? void 0 : d.parentElement) ?? null;
|
|
123
|
+
t == null || t.track(i, l.current, o), l.current = o, s(o), o && getComputedStyle(o).position === "static" && (o.style.position = "relative");
|
|
112
124
|
},
|
|
113
125
|
[i, s, t]
|
|
114
126
|
), u = (t == null ? void 0 : t.state.overKey) === i;
|
|
@@ -118,14 +130,14 @@ function et(e) {
|
|
|
118
130
|
indicator: u ? (t == null ? void 0 : t.state.indicator) ?? null : null
|
|
119
131
|
};
|
|
120
132
|
}
|
|
121
|
-
const
|
|
133
|
+
const B = "__add__";
|
|
122
134
|
function T(e, t) {
|
|
123
|
-
return t === "header" ? { kind: "header" } :
|
|
135
|
+
return t === "header" ? { kind: "header" } : L({ field: e, group_key: null }) ? { kind: "group", key: e, parent: null, body: !1 } : { kind: "item", zone: B };
|
|
124
136
|
}
|
|
125
137
|
const W = 400;
|
|
126
138
|
function nt(e) {
|
|
127
|
-
const t = S(m), i = $(), n = !!t && !!e,
|
|
128
|
-
target:
|
|
139
|
+
const t = S(m), i = $(), n = !!t && !!e, r = { kind: "field", field: (e == null ? void 0 : e.field) ?? i, group_key: B }, c = E(r), l = e ? {
|
|
140
|
+
target: r,
|
|
129
141
|
role: T(e.field, e.to),
|
|
130
142
|
add: {
|
|
131
143
|
field: e.field,
|
|
@@ -133,29 +145,29 @@ function nt(e) {
|
|
|
133
145
|
patch: e.patch,
|
|
134
146
|
onAdded: e.onAdded
|
|
135
147
|
}
|
|
136
|
-
} : void 0, s = _({ id: n ? c : `${c}#${i}`, data: l, disabled: !n }), a = y(null), { setNodeRef: u, setActivatorNodeRef: d } = s,
|
|
137
|
-
(
|
|
138
|
-
t == null || t.track(c, a.current,
|
|
148
|
+
} : void 0, s = _({ id: n ? c : `${c}#${i}`, data: l, disabled: !n }), a = y(null), { setNodeRef: u, setActivatorNodeRef: d } = s, o = R(
|
|
149
|
+
(f) => {
|
|
150
|
+
t == null || t.track(c, a.current, f), a.current = f, u(f), d(f);
|
|
139
151
|
},
|
|
140
152
|
[c, d, u, t]
|
|
141
|
-
),
|
|
142
|
-
|
|
143
|
-
D.current && !s.isDragging && (
|
|
153
|
+
), h = y(0), D = y(!1);
|
|
154
|
+
H(() => {
|
|
155
|
+
D.current && !s.isDragging && (h.current = Date.now()), D.current = s.isDragging;
|
|
144
156
|
}, [s.isDragging]);
|
|
145
|
-
const p = s.isDragging,
|
|
146
|
-
() => p || Date.now() -
|
|
157
|
+
const p = s.isDragging, v = R(
|
|
158
|
+
() => p || Date.now() - h.current < W,
|
|
147
159
|
[p]
|
|
148
160
|
);
|
|
149
161
|
return {
|
|
150
|
-
props: n ? { ref:
|
|
162
|
+
props: n ? { ref: o, ...s.attributes, ...s.listeners } : {},
|
|
151
163
|
dragging: p,
|
|
152
|
-
clickBlocked:
|
|
164
|
+
clickBlocked: v
|
|
153
165
|
};
|
|
154
166
|
}
|
|
155
167
|
export {
|
|
156
168
|
Y as DndStore,
|
|
157
169
|
m as DndStoreContext,
|
|
158
|
-
|
|
170
|
+
q as IDLE,
|
|
159
171
|
F as NO_DND,
|
|
160
172
|
T as addRole,
|
|
161
173
|
nt as useAddDragSource,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useDroppable as d } from "@dnd-kit/core";
|
|
2
|
+
import { useContext as f, useSyncExternalStore as s, useCallback as c } from "react";
|
|
3
|
+
import { UNGROUPED_KEY as u } from "../../../lib/layout-ops.js";
|
|
4
|
+
import { nodeData as b, typedCollision as m, TABLE_FORM_ZONES as y } from "./collision.js";
|
|
5
|
+
import { DndStoreContext as C } from "./node.js";
|
|
6
|
+
const D = "rail-layout:", k = (e) => `${D}${e}`;
|
|
7
|
+
function E(e) {
|
|
8
|
+
const o = e;
|
|
9
|
+
return o && typeof o.railLayoutId == "number" ? o : null;
|
|
10
|
+
}
|
|
11
|
+
function _(e, o) {
|
|
12
|
+
if (!e || !o || o.add || o.target.kind !== "group" || o.role.kind !== "group") return null;
|
|
13
|
+
const t = o.target.key;
|
|
14
|
+
return t === u || y.includes(t) ? null : e.groups.some((r) => r.key === t) ? t : null;
|
|
15
|
+
}
|
|
16
|
+
const R = (e, o) => o.x >= e.left && o.x <= e.right && o.y >= e.top && o.y <= e.bottom;
|
|
17
|
+
function I(e) {
|
|
18
|
+
return (t) => {
|
|
19
|
+
const r = t.pointerCoordinates;
|
|
20
|
+
if (r && e(b(t.active.data.current)))
|
|
21
|
+
for (const n of t.droppableContainers) {
|
|
22
|
+
if (n.disabled || !E(n.data.current)) continue;
|
|
23
|
+
const i = t.droppableRects.get(n.id);
|
|
24
|
+
if (i && R(i, r)) return [{ id: n.id, data: { droppableContainer: n } }];
|
|
25
|
+
}
|
|
26
|
+
return m(t);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const x = { subscribe: () => () => {
|
|
30
|
+
} };
|
|
31
|
+
function K(e, o) {
|
|
32
|
+
const t = f(C), r = k(e), { setNodeRef: n } = d({
|
|
33
|
+
id: r,
|
|
34
|
+
data: { railLayoutId: e },
|
|
35
|
+
disabled: o || !t
|
|
36
|
+
}), i = (t == null ? void 0 : t.subscribe) ?? x.subscribe, l = s(
|
|
37
|
+
i,
|
|
38
|
+
c(() => !!t && t.state.overKey === r, [t, r]),
|
|
39
|
+
() => !1
|
|
40
|
+
), p = s(
|
|
41
|
+
i,
|
|
42
|
+
c(() => {
|
|
43
|
+
const a = t == null ? void 0 : t.state.activeKey;
|
|
44
|
+
return !!a && a.startsWith("group:") && a !== `group:${u}`;
|
|
45
|
+
}, [t]),
|
|
46
|
+
() => !1
|
|
47
|
+
);
|
|
48
|
+
return { ref: n, over: l && !o, armed: p && !o };
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
_ as copyableGroup,
|
|
52
|
+
I as railAwareCollision,
|
|
53
|
+
E as railDropData,
|
|
54
|
+
k as railDropId,
|
|
55
|
+
K as useRailDrop
|
|
56
|
+
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { useState as C, useRef as h, useCallback as y, useEffect as D } from "react";
|
|
2
|
+
const F = "nvr:layout-draft:", k = (e, t) => `${F}${t.toLowerCase()}:${e}`, J = 1200;
|
|
3
|
+
function q(e) {
|
|
4
|
+
const t = e;
|
|
5
|
+
return !!t && typeof t.label == "string" && Array.isArray(t.ops);
|
|
6
|
+
}
|
|
7
|
+
function G(e, t) {
|
|
8
|
+
try {
|
|
9
|
+
const r = window.localStorage.getItem(k(e, t));
|
|
10
|
+
if (!r) return null;
|
|
11
|
+
const n = JSON.parse(r);
|
|
12
|
+
return (n == null ? void 0 : n.v) !== 1 || n.layoutId !== e || typeof n.baseRev != "string" || !Array.isArray(n.steps) || n.steps.length === 0 || !n.steps.every(q) ? null : n;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function L(e) {
|
|
18
|
+
try {
|
|
19
|
+
window.localStorage.setItem(k(e.layoutId, e.userId), JSON.stringify(e));
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function E(e, t) {
|
|
24
|
+
try {
|
|
25
|
+
window.localStorage.removeItem(k(e, t));
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function M(e, t, r) {
|
|
30
|
+
if (!e || e.steps.length === 0) return null;
|
|
31
|
+
const n = Date.parse(e.saved_at);
|
|
32
|
+
return {
|
|
33
|
+
v: 1,
|
|
34
|
+
layoutId: t,
|
|
35
|
+
userId: r,
|
|
36
|
+
baseRev: e.base_rev,
|
|
37
|
+
steps: e.steps,
|
|
38
|
+
at: Number.isFinite(n) ? n : 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function P(e, t) {
|
|
42
|
+
return e ? t ? e.at > t.at ? e : t : e : t;
|
|
43
|
+
}
|
|
44
|
+
function Y(e, t, r, n) {
|
|
45
|
+
var _;
|
|
46
|
+
const [c, w] = C(null), [K, v] = C("idle"), m = h(null), b = h(!1), p = h(!1), a = h(null), u = r ? `${r}:${t}` : null, $ = ((_ = e.bundle) == null ? void 0 : _.rev) ?? null, T = !n || n.settled, R = (n == null ? void 0 : n.draft) ?? null, i = !!n && n.available, o = n == null ? void 0 : n.writer, A = h(o);
|
|
47
|
+
A.current = o;
|
|
48
|
+
const S = y(() => {
|
|
49
|
+
var l;
|
|
50
|
+
const s = a.current;
|
|
51
|
+
s && (clearTimeout(s.timer), a.current = null, (l = A.current) == null || l.write(s.layoutId, { steps: s.steps, baseRev: s.baseRev }).catch(() => {
|
|
52
|
+
}));
|
|
53
|
+
}, []);
|
|
54
|
+
D(() => S, [S]), D(() => {
|
|
55
|
+
if (!u || !r || !$ || !T || m.current === u || (S(), m.current = u, b.current = !1, p.current = !!R, w(null), v(i ? "idle" : "off"), e.unsavedSteps.length > 0)) return;
|
|
56
|
+
const s = G(t, r), l = M(R, t, r), f = P(s, l);
|
|
57
|
+
f && (b.current = !0, w({
|
|
58
|
+
kind: "offer",
|
|
59
|
+
draft: f,
|
|
60
|
+
stale: f.baseRev !== e.baseRev,
|
|
61
|
+
source: f === l ? "server" : "browser"
|
|
62
|
+
}));
|
|
63
|
+
}, [
|
|
64
|
+
u,
|
|
65
|
+
r,
|
|
66
|
+
$,
|
|
67
|
+
t,
|
|
68
|
+
e.unsavedSteps.length,
|
|
69
|
+
e.baseRev,
|
|
70
|
+
T,
|
|
71
|
+
R,
|
|
72
|
+
i,
|
|
73
|
+
S
|
|
74
|
+
]);
|
|
75
|
+
const g = e.unsavedSteps, N = e.status === "saving";
|
|
76
|
+
D(() => {
|
|
77
|
+
if (!(!u || !r || m.current !== u || b.current || N))
|
|
78
|
+
if (a.current && (clearTimeout(a.current.timer), a.current = null), g.length > 0 && e.baseRev) {
|
|
79
|
+
const s = {
|
|
80
|
+
v: 1,
|
|
81
|
+
layoutId: t,
|
|
82
|
+
userId: r,
|
|
83
|
+
baseRev: e.baseRev,
|
|
84
|
+
steps: g.map((f) => ({ label: f.label, ops: f.ops })),
|
|
85
|
+
at: Date.now()
|
|
86
|
+
};
|
|
87
|
+
if (L(s), !o || !i) return;
|
|
88
|
+
v("pending");
|
|
89
|
+
const l = setTimeout(() => {
|
|
90
|
+
a.current = null, o.write(t, { steps: s.steps, baseRev: s.baseRev }).then(() => {
|
|
91
|
+
p.current = !0, v("kept");
|
|
92
|
+
}).catch(() => v("failed"));
|
|
93
|
+
}, J);
|
|
94
|
+
a.current = { timer: l, layoutId: t, steps: s.steps, baseRev: s.baseRev };
|
|
95
|
+
} else g.length === 0 && (E(t, r), o && i && p.current && (p.current = !1, o.clear(t).catch(() => {
|
|
96
|
+
})), i && v("idle"));
|
|
97
|
+
}, [u, r, t, g, N, e.baseRev, c, o, i]);
|
|
98
|
+
const O = e.restore, d = y(() => {
|
|
99
|
+
(c == null ? void 0 : c.kind) === "offer" && (b.current = !1, w(null), O(c.draft.steps));
|
|
100
|
+
}, [c, O]), x = y(() => {
|
|
101
|
+
(c == null ? void 0 : c.kind) === "offer" && r && (E(t, r), o && i && p.current && (p.current = !1, o.clear(t).catch(() => {
|
|
102
|
+
}))), b.current = !1, w(null);
|
|
103
|
+
}, [c, r, t, o, i]);
|
|
104
|
+
return { state: c, recover: d, dismiss: x, sync: K };
|
|
105
|
+
}
|
|
106
|
+
function j(e) {
|
|
107
|
+
const t = "Only you see these changes until you save (⌘S).";
|
|
108
|
+
switch (e) {
|
|
109
|
+
case "kept":
|
|
110
|
+
return `${t} Kept for you on the server: carry on from any browser.`;
|
|
111
|
+
case "pending":
|
|
112
|
+
return `${t} Keeping them for you on the server…`;
|
|
113
|
+
case "failed":
|
|
114
|
+
return `${t} They are kept in this browser; the server copy could not be written.`;
|
|
115
|
+
case "off":
|
|
116
|
+
return `${t} They are kept in this browser.`;
|
|
117
|
+
default:
|
|
118
|
+
return t;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
J as STAGED_SYNC_MS,
|
|
123
|
+
E as clearStoredDraft,
|
|
124
|
+
M as fromServerDraft,
|
|
125
|
+
P as pickDraft,
|
|
126
|
+
G as readStoredDraft,
|
|
127
|
+
j as stagedTip,
|
|
128
|
+
k as storedDraftKey,
|
|
129
|
+
Y as useDraftRecovery,
|
|
130
|
+
L as writeStoredDraft
|
|
131
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { HEADER_GROUP_KEY as p, EDITOR_NOTE_MAX as y } from "../../lib/layout-ops.js";
|
|
2
|
+
import { asObject as s, findPlacement as c, withOverride as d } from "./inspector/model.js";
|
|
3
|
+
const _ = 1e3, g = "__subtitle__";
|
|
4
|
+
function f(t) {
|
|
5
|
+
switch (t.kind) {
|
|
6
|
+
case "field":
|
|
7
|
+
case "slot":
|
|
8
|
+
return { field: t.field, group_key: t.group_key };
|
|
9
|
+
case "header":
|
|
10
|
+
return { field: t.field, group_key: t.field === g ? null : p };
|
|
11
|
+
default:
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function u(t) {
|
|
16
|
+
const e = s(t), n = typeof e.text == "string" ? e.text.trim() : "";
|
|
17
|
+
return n ? {
|
|
18
|
+
text: n,
|
|
19
|
+
by: typeof e.by == "string" ? e.by : null,
|
|
20
|
+
by_name: typeof e.by_name == "string" ? e.by_name : null,
|
|
21
|
+
at: typeof e.at == "string" ? e.at : ""
|
|
22
|
+
} : null;
|
|
23
|
+
}
|
|
24
|
+
function h(t, e) {
|
|
25
|
+
if (e.kind === "group") {
|
|
26
|
+
const r = t.groups.find((i) => i.key === e.key);
|
|
27
|
+
return r ? u(r.editor_note) : null;
|
|
28
|
+
}
|
|
29
|
+
const n = f(e), o = n ? c(t, n.field, n.group_key) : null;
|
|
30
|
+
return o ? u(s(o.overrides).editor_note) : null;
|
|
31
|
+
}
|
|
32
|
+
function E(t) {
|
|
33
|
+
const e = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const n of t.groups) {
|
|
35
|
+
const o = u(n.editor_note);
|
|
36
|
+
o && e.set(`group:${n.key}`, o);
|
|
37
|
+
}
|
|
38
|
+
for (const n of t.placements) {
|
|
39
|
+
const o = u(s(n.overrides).editor_note);
|
|
40
|
+
o && e.set(`${n.field}|${n.group_key ?? ""}`, o);
|
|
41
|
+
}
|
|
42
|
+
return e;
|
|
43
|
+
}
|
|
44
|
+
function T(t) {
|
|
45
|
+
if (t.kind === "group") return `group:${t.key}`;
|
|
46
|
+
const e = f(t);
|
|
47
|
+
return e ? `${e.field}|${e.group_key ?? ""}` : null;
|
|
48
|
+
}
|
|
49
|
+
function m(t, e, n) {
|
|
50
|
+
const o = n ? { ...n, text: n.text.trim().slice(0, _) } : null;
|
|
51
|
+
if (o && !o.text) return m(t, e, null);
|
|
52
|
+
if (e.kind === "group") {
|
|
53
|
+
if (!t.groups.some((a) => a.key === e.key)) return [];
|
|
54
|
+
const l = o ? JSON.stringify(o) : null;
|
|
55
|
+
return l && l.length > y ? [] : [{ op: "group_update", key: e.key, patch: { editor_note: l } }];
|
|
56
|
+
}
|
|
57
|
+
const r = f(e), i = r ? c(t, r.field, r.group_key) : null;
|
|
58
|
+
return !i || !r ? [] : [
|
|
59
|
+
{
|
|
60
|
+
op: "update_placement",
|
|
61
|
+
at: r,
|
|
62
|
+
patch: { overrides: d(i, "editor_note", o ?? void 0) }
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
function v(t) {
|
|
67
|
+
const e = t.at ? new Date(t.at) : null, n = e && !Number.isNaN(e.getTime()) ? e.toLocaleDateString(void 0, { day: "numeric", month: "short", year: "numeric" }) : null;
|
|
68
|
+
return [t.by_name || "An admin", n].filter(Boolean).join(" · ");
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
_ as NOTE_TEXT_MAX,
|
|
72
|
+
v as noteByline,
|
|
73
|
+
T as noteKey,
|
|
74
|
+
h as noteOf,
|
|
75
|
+
m as noteOps,
|
|
76
|
+
E as notesOf,
|
|
77
|
+
u as parseNote
|
|
78
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { Bookmark as R } from "lucide-react";
|
|
3
|
+
import { useState as f } from "react";
|
|
4
|
+
import { toast as N } from "sonner";
|
|
5
|
+
import { entryConfigOf as O, ENTRY_PRESETS_MAX as k, PRESET_PARTS as B, sanitizeEntryConfig as L } from "../../../lib/entry-config.js";
|
|
6
|
+
import { cn as S } from "../../../lib/utils.js";
|
|
7
|
+
import { Popover as j, PopoverTrigger as q, PopoverContent as D } from "../../ui/popover.js";
|
|
8
|
+
import { effectText as m } from "../panel-style.js";
|
|
9
|
+
import { barBtn as F } from "../toolbar-kit.js";
|
|
10
|
+
import { partsSet as P, presetSummary as z, PART_LABEL as K, presetOps as M, capturePreset as W } from "./presets.js";
|
|
11
|
+
function ee({
|
|
12
|
+
bundle: C,
|
|
13
|
+
rows: l,
|
|
14
|
+
apply: h,
|
|
15
|
+
className: E
|
|
16
|
+
}) {
|
|
17
|
+
const [T, i] = f(!1), u = O(C.layout), n = u.presets ?? [], r = l.length === 1 ? l[0] : null, [d, g] = f(""), [c, x] = f([]), b = r ? P(r) : [], w = (e) => {
|
|
18
|
+
i(e), e && (g(""), x(r ? P(r) : []));
|
|
19
|
+
}, y = () => {
|
|
20
|
+
if (!r || !d.trim() || c.length === 0) return;
|
|
21
|
+
const e = W(d, r, c), a = L({ ...u, presets: [...n, e] });
|
|
22
|
+
h([{ op: "layout_update", patch: { entry_config: a } }], {
|
|
23
|
+
label: `Save preset “${e.name}”`
|
|
24
|
+
}), i(!1), N.success(`Saved the preset “${e.name}”`);
|
|
25
|
+
}, A = (e) => {
|
|
26
|
+
const a = n.find(($) => $.id === e);
|
|
27
|
+
if (!a) return;
|
|
28
|
+
const { ops: p, changed: o } = M(a, l);
|
|
29
|
+
if (!o) {
|
|
30
|
+
N.info(`Already set like “${a.name}”`), i(!1);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
h(p, {
|
|
34
|
+
label: `Apply preset “${a.name}” to ${o} ${o === 1 ? "field" : "fields"}`
|
|
35
|
+
}), i(!1);
|
|
36
|
+
}, v = n.length >= k;
|
|
37
|
+
return /* @__PURE__ */ s(j, { open: T, onOpenChange: w, children: [
|
|
38
|
+
/* @__PURE__ */ t(q, { asChild: !0, children: /* @__PURE__ */ s(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
"data-placement-presets": "",
|
|
43
|
+
"data-tip": "Save these settings under a name, or apply a saved bundle",
|
|
44
|
+
className: S(F, E),
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ t(R, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
47
|
+
"Presets",
|
|
48
|
+
n.length > 0 && /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-500 dark:text-muted-foreground", children: n.length })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
) }),
|
|
52
|
+
/* @__PURE__ */ s(
|
|
53
|
+
D,
|
|
54
|
+
{
|
|
55
|
+
side: "left",
|
|
56
|
+
align: "start",
|
|
57
|
+
className: "w-[300px] space-y-3 p-3 text-[12px]",
|
|
58
|
+
"data-presets-popover": "",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
61
|
+
/* @__PURE__ */ s("p", { className: "m-0 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: [
|
|
62
|
+
"Apply to ",
|
|
63
|
+
l.length === 1 ? "this field" : `${l.length} fields`
|
|
64
|
+
] }),
|
|
65
|
+
n.length === 0 ? /* @__PURE__ */ s("p", { className: m, children: [
|
|
66
|
+
"No presets yet.",
|
|
67
|
+
" ",
|
|
68
|
+
r ? "Save this field’s settings below." : "Select one field to save its settings as a preset."
|
|
69
|
+
] }) : /* @__PURE__ */ t("ul", { className: "m-0 max-h-48 list-none space-y-0.5 overflow-y-auto p-0", children: n.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ s(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
type: "button",
|
|
73
|
+
"data-preset-apply": e.id,
|
|
74
|
+
onClick: () => A(e.id),
|
|
75
|
+
className: "flex w-full flex-col rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ t("span", { className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: e.name }),
|
|
78
|
+
/* @__PURE__ */ t("span", { className: S(m, "truncate"), children: z(e) })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
) }, e.id)) })
|
|
82
|
+
] }),
|
|
83
|
+
r && /* @__PURE__ */ s("div", { className: "space-y-2 border-t border-slate-200 pt-3 dark:border-border", children: [
|
|
84
|
+
/* @__PURE__ */ t("p", { className: "m-0 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: "Save this field’s settings" }),
|
|
85
|
+
b.length === 0 ? /* @__PURE__ */ t("p", { className: m, children: "Nothing is set on this field yet: change its width, make it required or add help text first." }) : /* @__PURE__ */ s(_, { children: [
|
|
86
|
+
/* @__PURE__ */ s("fieldset", { className: "m-0 grid grid-cols-2 gap-x-3 gap-y-1 border-0 p-0", children: [
|
|
87
|
+
/* @__PURE__ */ t("legend", { className: "sr-only", children: "What the preset sets" }),
|
|
88
|
+
B.filter((e) => b.includes(e)).map((e) => /* @__PURE__ */ s(
|
|
89
|
+
"label",
|
|
90
|
+
{
|
|
91
|
+
className: "flex items-center gap-1.5 text-slate-700 dark:text-foreground",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ t(
|
|
94
|
+
"input",
|
|
95
|
+
{
|
|
96
|
+
type: "checkbox",
|
|
97
|
+
checked: c.includes(e),
|
|
98
|
+
onChange: (a) => x(
|
|
99
|
+
(p) => a.target.checked ? [...p, e] : p.filter((o) => o !== e)
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
K[e]
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
e
|
|
107
|
+
))
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
"input",
|
|
111
|
+
{
|
|
112
|
+
type: "text",
|
|
113
|
+
"aria-label": "Preset name",
|
|
114
|
+
placeholder: "Name, e.g. Narrow and required",
|
|
115
|
+
maxLength: 60,
|
|
116
|
+
value: d,
|
|
117
|
+
onChange: (e) => g(e.target.value),
|
|
118
|
+
onKeyDown: (e) => {
|
|
119
|
+
e.key === "Enter" && (e.preventDefault(), y());
|
|
120
|
+
},
|
|
121
|
+
className: "h-8 w-full rounded-md border border-slate-200 bg-white px-2 text-[12.5px] outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-background"
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ t(
|
|
125
|
+
"button",
|
|
126
|
+
{
|
|
127
|
+
type: "button",
|
|
128
|
+
"data-preset-save": "",
|
|
129
|
+
disabled: !d.trim() || c.length === 0 || v,
|
|
130
|
+
onClick: y,
|
|
131
|
+
className: "h-7 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white transition-colors hover:bg-[#00b8e0] disabled:opacity-40",
|
|
132
|
+
children: "Save preset"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
v && /* @__PURE__ */ s("p", { className: m, children: [
|
|
136
|
+
"This form holds ",
|
|
137
|
+
k,
|
|
138
|
+
" presets: delete one in Form settings first."
|
|
139
|
+
] })
|
|
140
|
+
] })
|
|
141
|
+
] })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] });
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
ee as PlacementPresets
|
|
149
|
+
};
|