@1agh/maude 1.8.1 → 1.9.0
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/apps/studio/acp/bridge.ts +14 -2
- package/apps/studio/acp/probe.ts +51 -1
- package/apps/studio/api.ts +19 -4
- package/apps/studio/bin/_curl-local.mjs +7 -0
- package/apps/studio/bin/annotate.mjs +16 -7
- package/apps/studio/bin/read-annotations.mjs +62 -4
- package/apps/studio/client/app.jsx +428 -15977
- package/apps/studio/client/dialogs/asset-picker.jsx +331 -0
- package/apps/studio/client/dialogs/command-palette.jsx +112 -0
- package/apps/studio/client/dialogs/export-dialog.jsx +782 -0
- package/apps/studio/client/dialogs/help-modal.jsx +324 -0
- package/apps/studio/client/dialogs/shortcuts-overlay.jsx +144 -0
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +2150 -0
- package/apps/studio/client/hooks/use-git-actions.jsx +236 -0
- package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +297 -0
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +474 -0
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +901 -0
- package/apps/studio/client/hooks/use-project-data.jsx +90 -0
- package/apps/studio/client/hooks/use-shell-core.jsx +1212 -0
- package/apps/studio/client/hooks/use-tabs.jsx +723 -0
- package/apps/studio/client/hooks/use-web-socket.jsx +13 -0
- package/apps/studio/client/inspector/artboard-knobs.jsx +456 -0
- package/apps/studio/client/inspector/color-picker.jsx +196 -0
- package/apps/studio/client/inspector/color.js +92 -0
- package/apps/studio/client/inspector/css-knobs.jsx +1720 -0
- package/apps/studio/client/inspector/css-vocab.jsx +131 -0
- package/apps/studio/client/inspector/ds-tokens.js +90 -0
- package/apps/studio/client/inspector/grid-tracks-editor.jsx +97 -0
- package/apps/studio/client/inspector/inspect-computed.jsx +68 -0
- package/apps/studio/client/inspector/inspector-panel.jsx +769 -0
- package/apps/studio/client/inspector/layers.jsx +322 -0
- package/apps/studio/client/inspector/selection.js +65 -0
- package/apps/studio/client/inspector/token-popover.jsx +301 -0
- package/apps/studio/client/menus/menubar.jsx +856 -0
- package/apps/studio/client/selection-scope.js +40 -0
- package/apps/studio/client/shell/banners.jsx +272 -0
- package/apps/studio/client/shell/collapsed-rail.jsx +23 -0
- package/apps/studio/client/shell/comments-panel.jsx +177 -0
- package/apps/studio/client/shell/constants.js +60 -0
- package/apps/studio/client/shell/dock.jsx +131 -0
- package/apps/studio/client/shell/icons.jsx +370 -0
- package/apps/studio/client/shell/status-bar.jsx +215 -0
- package/apps/studio/client/shell/util.js +332 -0
- package/apps/studio/client/shell/viewport.jsx +254 -0
- package/apps/studio/client/system/system-view.jsx +255 -0
- package/apps/studio/client/tree/tree.jsx +1243 -0
- package/apps/studio/comments-overlay.tsx +6 -4
- package/apps/studio/config.schema.json +5 -0
- package/apps/studio/context.ts +13 -0
- package/apps/studio/dist/client.bundle.js +1337 -1337
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/exporters/_browser-bundles.ts +21 -2
- package/apps/studio/exporters/jobs.ts +75 -15
- package/apps/studio/exporters/scope.ts +15 -12
- package/apps/studio/format.ts +296 -0
- package/apps/studio/http.ts +213 -23
- package/apps/studio/server.ts +118 -29
- package/apps/studio/sync/accepted-link.ts +6 -0
- package/apps/studio/sync/agent.ts +9 -1
- package/apps/studio/sync/cold-start-apply.ts +29 -4
- package/apps/studio/sync/cold-start.ts +78 -0
- package/apps/studio/sync/file-plane.ts +61 -1
- package/apps/studio/sync/format-sync.ts +160 -0
- package/apps/studio/sync/index.ts +134 -10
- package/apps/studio/sync/journal-client.ts +25 -5
- package/apps/studio/sync/migrate-seed.ts +8 -1
- package/apps/studio/sync/status.ts +2 -0
- package/apps/studio/sync/transaction-client.ts +130 -13
- package/apps/studio/ui-prefs.ts +95 -10
- package/apps/studio/whats-new.json +9 -0
- package/apps/studio/ws.ts +19 -4
- package/cli/bin/claude-design-server.mjs +0 -0
- package/package.json +10 -8
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
// hooks/use-palette-and-panels.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { copyShareLink } from '../share-dialog.jsx';
|
|
5
|
+
import { isNativeApp } from '../github.js';
|
|
6
|
+
import { DOCK_PANELS, PANEL_SIDES_DEFAULTS } from '../shell/dock.jsx';
|
|
7
|
+
import { EMPTY_GROUPS, SYSTEM_TAB } from '../shell/constants.js';
|
|
8
|
+
import { openCount } from '../shell/util.js';
|
|
9
|
+
import { Sidebar } from '../tree/tree.jsx';
|
|
10
|
+
import GitPanel from '../panels/GitPanel.jsx';
|
|
11
|
+
import SyncPanel from '../panels/SyncPanel.jsx';
|
|
12
|
+
import { InspectorPanel } from '../inspector/inspector-panel.jsx';
|
|
13
|
+
import { CommentsPanel } from '../shell/comments-panel.jsx';
|
|
14
|
+
|
|
15
|
+
export function usePaletteAndPanels({
|
|
16
|
+
groups, treeLoaded, treeLoadFailures, project, activePath, previewPath, onPreview, selected,
|
|
17
|
+
editScope, layersBusyRef, layersTree, componentMap, wsConnected, syncStatus, cloudLinkedHub,
|
|
18
|
+
setCloudLinkedHub, localProjectName, setLocalProjectName, gitStatus, remoteSync, changesOpen,
|
|
19
|
+
setChangesOpen, syncPanelOpen, setSyncPanelOpen, setDiffTarget, search, setSearch, systemData,
|
|
20
|
+
dragSide, cfg, cellManaged, cloudManaged, savingIsManaged, viewerMode, commentsByFile,
|
|
21
|
+
focusedCommentId, commentsPanelOpen, commentsFilter, setCommentsFilter, cpMode, setCpMode,
|
|
22
|
+
sidebarOpen, showHidden, treeExp, sectionsExpanded, setHelpOpen, setReportBugOpen,
|
|
23
|
+
setShortcutsOpen, setExportDialog, setSettingsOpen, setGenerateOpen, inspectorOpen,
|
|
24
|
+
setInspectorOpen, layersOpen, setLayersOpen, panelSide, layersMode, assistantOpen, inspectorTab,
|
|
25
|
+
setInspectorTab, photoSel, photoRev, openPanelExclusive, togglePanel, openRightPanel,
|
|
26
|
+
toggleRightPanel, whatsNew, postToActiveCanvas, onPhotoEdit, onPhotoRecordEdit, performPhotoUndo,
|
|
27
|
+
onPhotoRemoveBackground, lockedKeys, toggleLockedKey, toggleSection, treeExpansion, toggleTheme,
|
|
28
|
+
gitCommit, gitDiscard, gitPublish, gitGetLatest, gitLoadLog, cloudHistory, gitLoadCloudLog,
|
|
29
|
+
projectHistoryOn, setProjectHistoryOn, projectHistoryRefresh, loadAcceptedLog,
|
|
30
|
+
restoreProjectVersion, dirtyByPath, openTab, openLinkedFile, sharePath, shareShell, shareLinksFor,
|
|
31
|
+
showShare, openSystem, reloadActive, treeRefreshing, refreshTree, createBoard, createVideo,
|
|
32
|
+
deleteBoard, moveCanvasReq, newFolderReq, deleteFolderReq, renameFolderReq, renameCanvasReq,
|
|
33
|
+
duplicateCanvasReq, deleteFileReq, applyOptimisticStyle, recordSourceEdit, reorderLayer,
|
|
34
|
+
detachInstanceShell, resizeArtboardShell, duplicateArtboardShell, setArtboardHugShell,
|
|
35
|
+
setArtboardStyleShell, setArtboardKindShell, setArtboardPrintShell, onReplaceMedia, resolveComment,
|
|
36
|
+
reopenComment, deleteComment, jumpToComment
|
|
37
|
+
}) {
|
|
38
|
+
// ⌘K palette actions — shell-doable only (in-canvas export lives in the iframe).
|
|
39
|
+
// T4 (Plan C) — grouped command set per `.design/ui/Studio.tsx` AB-D.
|
|
40
|
+
// `group` drives the section headers; the list stays a flat array so keyboard
|
|
41
|
+
// nav indexes straight across groups.
|
|
42
|
+
const paletteActions = useMemo(
|
|
43
|
+
() => [
|
|
44
|
+
// ── Canvas ──────────────────────────────────────────────────────────
|
|
45
|
+
{
|
|
46
|
+
id: 'new',
|
|
47
|
+
group: 'Canvas',
|
|
48
|
+
label: 'New canvas…',
|
|
49
|
+
icon: 'plus',
|
|
50
|
+
kbd: 'N',
|
|
51
|
+
run: () => {
|
|
52
|
+
openPanelExclusive('tree');
|
|
53
|
+
setTimeout(
|
|
54
|
+
() => document.querySelector('[aria-label="New blank brief board"]')?.click(),
|
|
55
|
+
60
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'new-video',
|
|
61
|
+
group: 'Canvas',
|
|
62
|
+
label: 'New video…',
|
|
63
|
+
icon: 'plus',
|
|
64
|
+
run: () => createVideo(),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'export',
|
|
68
|
+
group: 'Canvas',
|
|
69
|
+
label: 'Export…',
|
|
70
|
+
icon: 'download',
|
|
71
|
+
kbd: '⇧⌘E',
|
|
72
|
+
run: () => setExportDialog({ mode: 'export' }),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'share-link',
|
|
76
|
+
group: 'Canvas',
|
|
77
|
+
label: 'Copy share link',
|
|
78
|
+
icon: 'link',
|
|
79
|
+
run: () => { const links = shareLinksFor(sharePath); const link = links.web ?? links.app ?? links.local; if (link) copyShareLink(link); },
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'handoff',
|
|
83
|
+
group: 'Canvas',
|
|
84
|
+
label: 'Handoff to production',
|
|
85
|
+
icon: 'external',
|
|
86
|
+
kbd: '⇧⌘H',
|
|
87
|
+
run: () => setExportDialog({ mode: 'handoff' }),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'generate',
|
|
91
|
+
group: 'Canvas',
|
|
92
|
+
label: 'Generate with AI…',
|
|
93
|
+
icon: 'sparkle',
|
|
94
|
+
run: () => setGenerateOpen(true),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'settings',
|
|
98
|
+
group: 'Canvas',
|
|
99
|
+
label: 'Settings…',
|
|
100
|
+
icon: 'sliders',
|
|
101
|
+
kbd: '⌘,',
|
|
102
|
+
run: () => setSettingsOpen(true),
|
|
103
|
+
},
|
|
104
|
+
// ── View ────────────────────────────────────────────────────────────
|
|
105
|
+
{
|
|
106
|
+
id: 'system',
|
|
107
|
+
group: 'View',
|
|
108
|
+
label: 'Open design system view',
|
|
109
|
+
icon: 'sliders',
|
|
110
|
+
kbd: 'S',
|
|
111
|
+
run: () => openSystem(),
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 'comments',
|
|
115
|
+
group: 'View',
|
|
116
|
+
label: 'Toggle comments panel',
|
|
117
|
+
icon: 'resolve',
|
|
118
|
+
kbd: '⌘⇧M',
|
|
119
|
+
run: () => toggleRightPanel('comments'),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'inspector',
|
|
123
|
+
group: 'View',
|
|
124
|
+
label: 'Open inspector',
|
|
125
|
+
icon: 'sliders',
|
|
126
|
+
kbd: '⌘⇧I',
|
|
127
|
+
run: () => openRightPanel('inspector'),
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: 'reload',
|
|
131
|
+
group: 'View',
|
|
132
|
+
label: 'Reload active canvas',
|
|
133
|
+
icon: 'reload',
|
|
134
|
+
kbd: '⌘R',
|
|
135
|
+
run: () => reloadActive(),
|
|
136
|
+
},
|
|
137
|
+
// ── Tools ───────────────────────────────────────────────────────────
|
|
138
|
+
{
|
|
139
|
+
id: 'draw',
|
|
140
|
+
group: 'Tools',
|
|
141
|
+
label: 'Draw a mark with the SVG agent',
|
|
142
|
+
icon: 'pen',
|
|
143
|
+
run: () => {
|
|
144
|
+
// The shell can't invoke Claude — surface the command for the user to
|
|
145
|
+
// paste into Claude Code (clipboard is the honest, useful affordance).
|
|
146
|
+
try {
|
|
147
|
+
navigator.clipboard?.writeText('/design:draw ');
|
|
148
|
+
} catch {}
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 'theme',
|
|
153
|
+
group: 'Tools',
|
|
154
|
+
label: 'Toggle light / dark theme',
|
|
155
|
+
icon: 'sun',
|
|
156
|
+
run: () => toggleTheme(),
|
|
157
|
+
},
|
|
158
|
+
// ── Help ────────────────────────────────────────────────────────────
|
|
159
|
+
{
|
|
160
|
+
id: 'whatsnew',
|
|
161
|
+
group: 'Help',
|
|
162
|
+
label: "What's new in maude",
|
|
163
|
+
icon: 'sparkle',
|
|
164
|
+
run: () => whatsNew.openPanel(),
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: 'shortcuts',
|
|
168
|
+
group: 'Help',
|
|
169
|
+
label: 'Keyboard shortcuts',
|
|
170
|
+
icon: 'help',
|
|
171
|
+
kbd: '?',
|
|
172
|
+
run: () => setShortcutsOpen(true),
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: 'help',
|
|
176
|
+
group: 'Help',
|
|
177
|
+
label: 'Help · commands & flows',
|
|
178
|
+
icon: 'help',
|
|
179
|
+
kbd: 'F1',
|
|
180
|
+
run: () => setHelpOpen(true),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 'report-bug',
|
|
184
|
+
group: 'Help',
|
|
185
|
+
label: 'Report a bug…',
|
|
186
|
+
icon: 'help',
|
|
187
|
+
run: () => setReportBugOpen(true),
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
[openSystem, toggleTheme, reloadActive, whatsNew, createVideo, sharePath, shareShell, cloudLinkedHub, localProjectName, cfg.designRel]
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
// feature-configurable-panel-docking — resolve, for each slot, the panels
|
|
194
|
+
// assigned to it and which one is active (the open one). Layers is only a
|
|
195
|
+
// dockable panel in `separate` mode; Assistant is native-only.
|
|
196
|
+
const panelAvailable = (id) => {
|
|
197
|
+
// The AGENT is genuinely absent for a viewer (it edits; Phase 25 C2).
|
|
198
|
+
//
|
|
199
|
+
// Inspector and Layers are NOT — Cloud Phase 27 C1 reversed that, and this
|
|
200
|
+
// line had been left behind: `viewerHiddenPanels` stopped hiding them in
|
|
201
|
+
// the View menu while this still refused to give them a dock slot, so the
|
|
202
|
+
// menu offered a panel that could never appear. Read-only means cannot
|
|
203
|
+
// CHANGE, not cannot SEE: a reviewer needs structure and measured values,
|
|
204
|
+
// which is the whole reason C1 exists.
|
|
205
|
+
if (viewerMode && id === 'assistant') return false;
|
|
206
|
+
// feature-sync-progress-modal — the Sync panel only exists for a linked
|
|
207
|
+
// project (solo has no hub, so the tab would open onto nothing).
|
|
208
|
+
if (id === 'sync') return !!syncStatus;
|
|
209
|
+
return id === 'assistant' ? isNativeApp() : id === 'layers' ? layersMode === 'separate' : true;
|
|
210
|
+
};
|
|
211
|
+
const idsForSide = (side) =>
|
|
212
|
+
DOCK_PANELS.filter(
|
|
213
|
+
(p) => panelAvailable(p.id) && (panelSide[p.id] || PANEL_SIDES_DEFAULTS[p.id]) === side
|
|
214
|
+
).map((p) => p.id);
|
|
215
|
+
const panelIsOpen = {
|
|
216
|
+
tree: sidebarOpen,
|
|
217
|
+
layers: layersOpen,
|
|
218
|
+
inspector: inspectorOpen,
|
|
219
|
+
comments: commentsPanelOpen,
|
|
220
|
+
changes: changesOpen,
|
|
221
|
+
sync: syncPanelOpen,
|
|
222
|
+
assistant: assistantOpen,
|
|
223
|
+
};
|
|
224
|
+
// Per-shell overrides for the dock tab strip. In a cell the `changes` panel
|
|
225
|
+
// IS the history (the hub commits server-side), so its tab must say so —
|
|
226
|
+
// otherwise the one visible word still promises a working-tree surface that
|
|
227
|
+
// panel no longer has.
|
|
228
|
+
const dockLabels = cfg.cloud ? { changes: 'History' } : null;
|
|
229
|
+
const leftIds = idsForSide('left');
|
|
230
|
+
const rightIds = idsForSide('right');
|
|
231
|
+
const leftActive = leftIds.find((id) => panelIsOpen[id]) || null;
|
|
232
|
+
const rightActive = rightIds.find((id) => panelIsOpen[id]) || null;
|
|
233
|
+
// Cloud Phase 25 C2 — the Assistant edits; a viewer's session never mounts it.
|
|
234
|
+
const leftHostsAssistant =
|
|
235
|
+
isNativeApp() && !viewerMode && (panelSide.assistant || 'right') === 'left';
|
|
236
|
+
const rightHostsAssistant =
|
|
237
|
+
isNativeApp() && !viewerMode && (panelSide.assistant || 'right') === 'right';
|
|
238
|
+
const resizingFor = (id) =>
|
|
239
|
+
(panelSide[id] || PANEL_SIDES_DEFAULTS[id]) === 'left' ? dragSide === 'sb' : dragSide === 'rp';
|
|
240
|
+
const activeCanvasFile =
|
|
241
|
+
activePath && activePath !== SYSTEM_TAB && /\.(tsx|html)$/i.test(activePath) ? activePath : null;
|
|
242
|
+
// Issue #74 — drives the chat panel's "Implement N comments" quick action.
|
|
243
|
+
// Canvas-wide on purpose: the verb operates on every open comment of the
|
|
244
|
+
// active canvas, so it is deliberately NOT scoped to the current selection.
|
|
245
|
+
const activeOpenComments = activeCanvasFile
|
|
246
|
+
? openCount(commentsByFile[activeCanvasFile])
|
|
247
|
+
: 0;
|
|
248
|
+
|
|
249
|
+
// Render a panel body by id (width undefined ⇒ fills the .st-dockslot wrapper,
|
|
250
|
+
// which owns the resizable width). Assistant is handled separately below as an
|
|
251
|
+
// always-mounted ChatPanel so its stream survives a tab switch.
|
|
252
|
+
const renderPanelBody = (id) => {
|
|
253
|
+
// C1 again, the second half of the same gate. The panels MOUNT for a
|
|
254
|
+
// viewer; what they must not do is offer an edit, and that is already
|
|
255
|
+
// handled inside them (`readOnly` is threaded through every control).
|
|
256
|
+
// Refusing to mount was a blunter instrument than the role model asks for.
|
|
257
|
+
|
|
258
|
+
if (id === 'tree')
|
|
259
|
+
return (
|
|
260
|
+
<Sidebar
|
|
261
|
+
cloud={cfg.cloud}
|
|
262
|
+
readOnly={viewerMode}
|
|
263
|
+
// Held back until the remembered disclosure is read, so the first
|
|
264
|
+
// paint is the user's tree rather than an all-closed flash (#124).
|
|
265
|
+
groups={treeExp.ready ? groups : EMPTY_GROUPS}
|
|
266
|
+
activePath={activePath}
|
|
267
|
+
previewPath={previewPath}
|
|
268
|
+
activeDsName={activePath === SYSTEM_TAB ? (systemData?.ds?.name ?? null) : null}
|
|
269
|
+
onOpen={openTab}
|
|
270
|
+
onPreview={onPreview}
|
|
271
|
+
onOpenLinkedFile={openLinkedFile}
|
|
272
|
+
filesReady={treeLoaded}
|
|
273
|
+
treeLoadFailures={treeLoadFailures}
|
|
274
|
+
onShare={showShare}
|
|
275
|
+
onOpenSystem={openSystem}
|
|
276
|
+
wsConnected={wsConnected}
|
|
277
|
+
search={search}
|
|
278
|
+
setSearch={setSearch}
|
|
279
|
+
commentsByFile={commentsByFile}
|
|
280
|
+
showHidden={showHidden}
|
|
281
|
+
sectionsExpanded={sectionsExpanded}
|
|
282
|
+
onToggleSection={toggleSection}
|
|
283
|
+
treeExpansion={treeExpansion}
|
|
284
|
+
onNewBoard={createBoard}
|
|
285
|
+
onDeleteBoard={deleteBoard}
|
|
286
|
+
onMoveCanvas={moveCanvasReq}
|
|
287
|
+
onNewFolder={newFolderReq}
|
|
288
|
+
onDeleteFolder={deleteFolderReq}
|
|
289
|
+
onRenameFolder={renameFolderReq}
|
|
290
|
+
onRenameCanvas={renameCanvasReq}
|
|
291
|
+
onDuplicateCanvas={duplicateCanvasReq}
|
|
292
|
+
onDeleteFile={deleteFileReq}
|
|
293
|
+
onRefresh={refreshTree}
|
|
294
|
+
refreshing={treeRefreshing}
|
|
295
|
+
collapsed={false}
|
|
296
|
+
onCollapse={() => togglePanel('tree')}
|
|
297
|
+
resizing={resizingFor('tree')}
|
|
298
|
+
dirtyByPath={dirtyByPath}
|
|
299
|
+
project={project}
|
|
300
|
+
gitBranch={gitStatus?.branch}
|
|
301
|
+
remoteSync={remoteSync}
|
|
302
|
+
onGetLatest={gitGetLatest}
|
|
303
|
+
canvasKinds={cfg?.canvasKinds}
|
|
304
|
+
syncStatus={syncStatus}
|
|
305
|
+
onLinkedHub={setCloudLinkedHub}
|
|
306
|
+
onLocalProject={setLocalProjectName}
|
|
307
|
+
savingIsManaged={savingIsManaged}
|
|
308
|
+
/>
|
|
309
|
+
);
|
|
310
|
+
if (id === 'changes')
|
|
311
|
+
return (
|
|
312
|
+
<GitPanel
|
|
313
|
+
status={gitStatus && remoteSync ? { ...gitStatus, ...remoteSync } : gitStatus}
|
|
314
|
+
project={project}
|
|
315
|
+
readOnly={!isNativeApp() || viewerMode}
|
|
316
|
+
// A cloud cell commits every edit server-side as it lands, so the
|
|
317
|
+
// working-tree half of this panel describes work that is already
|
|
318
|
+
// saved. `cfg.cloud` is present exactly when the hub runs the
|
|
319
|
+
// workspace agent that owns this project's history, which is the
|
|
320
|
+
// same condition.
|
|
321
|
+
//
|
|
322
|
+
// PRESENTATION, NOT A CONTROL — nothing may come to depend on this.
|
|
323
|
+
// `/_api/git/commit` and `/_api/git/discard` are classified `edit` in
|
|
324
|
+
// the cell's route manifest and stay reachable by any member with a
|
|
325
|
+
// session; withdrawing the buttons removes an offer that would
|
|
326
|
+
// mislead, it does not remove a capability. The real gates are
|
|
327
|
+
// server-side (`projectReadOnly`, the manifest's role matrix), and
|
|
328
|
+
// they are unchanged by this flag.
|
|
329
|
+
historyOnly={cellManaged}
|
|
330
|
+
// DDR-218 (fix 8) — the DESKTOP half of the same withdrawal: a repo
|
|
331
|
+
// linked+credentialed to Maude Cloud is cloud-managed (the cell
|
|
332
|
+
// commits every edit as it lands), so the local Changes surface is
|
|
333
|
+
// the second save mechanism the sync RCA's user was confused by.
|
|
334
|
+
// Live: CloudBar lifts every link change (resolve/attach/detach)
|
|
335
|
+
// into `cloudLinkedHub`. Same presentation-not-a-control rule as
|
|
336
|
+
// `historyOnly` above; Disconnect restores the panel in place.
|
|
337
|
+
cloudManaged={cloudManaged}
|
|
338
|
+
resizing={resizingFor('changes')}
|
|
339
|
+
onClose={() => setChangesOpen(false)}
|
|
340
|
+
onCommit={gitCommit}
|
|
341
|
+
onDiscard={gitDiscard}
|
|
342
|
+
onPublish={gitPublish}
|
|
343
|
+
onGetLatest={gitGetLatest}
|
|
344
|
+
// WHICH HISTORY, decided at the ONE place the posture is named — not
|
|
345
|
+
// inside the panel, which would be a second derivation of the rule
|
|
346
|
+
// `cloud-managed-save-surfaces.test.ts` exists to keep singular.
|
|
347
|
+
loadLog={async (path) => {
|
|
348
|
+
// The project's accepted history when it has one; Git otherwise.
|
|
349
|
+
const accepted = await loadAcceptedLog(path);
|
|
350
|
+
setProjectHistoryOn(accepted !== 'legacy');
|
|
351
|
+
if (accepted !== 'legacy') return accepted;
|
|
352
|
+
return (cloudManaged ? gitLoadCloudLog : gitLoadLog)(path);
|
|
353
|
+
}}
|
|
354
|
+
historySource={projectHistoryOn ? 'project' : cloudManaged ? 'cloud' : 'local'}
|
|
355
|
+
historyRefresh={`${syncStatus?.appliedRevision ?? 0}:${projectHistoryRefresh}`}
|
|
356
|
+
onRestoreVersion={(revision) => restoreProjectVersion(activePath, revision).then((r) => !!r.ok)}
|
|
357
|
+
// Not through a cell's door: every browser editor proposes under the
|
|
358
|
+
// studio's one credential there, so "your own action" is not
|
|
359
|
+
// knowable and the hub refuses the route (studio-manifest.mjs).
|
|
360
|
+
onUndoAction={cellManaged ? undefined : async (actionId) => {
|
|
361
|
+
const r = await fetch('/_api/project/undo', {
|
|
362
|
+
method: 'POST',
|
|
363
|
+
headers: { 'Content-Type': 'application/json' },
|
|
364
|
+
body: JSON.stringify({ actionId }),
|
|
365
|
+
}).catch(() => null);
|
|
366
|
+
const j = r ? await r.json().catch(() => null) : null;
|
|
367
|
+
return !!j?.ok;
|
|
368
|
+
}}
|
|
369
|
+
// What the cloud half of the header names. The cell reports its own
|
|
370
|
+
// project and branch with the log; the hub host is the fallback,
|
|
371
|
+
// because a header that names the LOCAL folder while listing the
|
|
372
|
+
// CLOUD's commits is the confusion this feature exists to end.
|
|
373
|
+
cloudHistory={cloudHistory}
|
|
374
|
+
onOpenCanvas={(p) => openTab(p)}
|
|
375
|
+
onOpenDiff={(file) => setDiffTarget({ file, beforeSha: 'HEAD', conflict: false })}
|
|
376
|
+
activeCanvas={activeCanvasFile}
|
|
377
|
+
onPreviewVersion={(sha) => setDiffTarget({ file: activePath, beforeSha: sha, conflict: false })}
|
|
378
|
+
designRel={(cfg?.designRel || cfg?.designRoot || '.design').replace(/^\/+|\/+$/g, '')}
|
|
379
|
+
/>
|
|
380
|
+
);
|
|
381
|
+
if (id === 'sync')
|
|
382
|
+
return (
|
|
383
|
+
<SyncPanel
|
|
384
|
+
status={syncStatus}
|
|
385
|
+
project={cfg?.cloud?.projectName || project}
|
|
386
|
+
cloud={cfg?.cloud ?? null}
|
|
387
|
+
groupPaths={(groups || []).map((g) => g.path).filter(Boolean)}
|
|
388
|
+
resizing={resizingFor('sync')}
|
|
389
|
+
onClose={() => setSyncPanelOpen(false)}
|
|
390
|
+
/>
|
|
391
|
+
);
|
|
392
|
+
if (id === 'inspector' || id === 'layers')
|
|
393
|
+
return (
|
|
394
|
+
<InspectorPanel
|
|
395
|
+
// Cloud Phase 27 E4 — the parity spec asserts these two panels exist
|
|
396
|
+
// in BOTH shells, so each needs a name a spec can ask for.
|
|
397
|
+
testId={id === 'layers' ? 'layers-panel' : 'inspector-panel'}
|
|
398
|
+
layersOnly={id === 'layers'}
|
|
399
|
+
hideLayersTab={layersMode === 'separate'}
|
|
400
|
+
cpMode={cpMode}
|
|
401
|
+
onSetCpMode={setCpMode}
|
|
402
|
+
selected={selected}
|
|
403
|
+
cfg={cfg}
|
|
404
|
+
tab={id === 'layers' ? 'layers' : inspectorTab}
|
|
405
|
+
onTabChange={setInspectorTab}
|
|
406
|
+
onClose={() => (id === 'layers' ? setLayersOpen(false) : setInspectorOpen(false))}
|
|
407
|
+
onOptimistic={applyOptimisticStyle}
|
|
408
|
+
onRecordEdit={recordSourceEdit}
|
|
409
|
+
onReplaceMedia={onReplaceMedia}
|
|
410
|
+
onResizeArtboard={resizeArtboardShell}
|
|
411
|
+
onSetArtboardHug={setArtboardHugShell}
|
|
412
|
+
onSetArtboardStyle={setArtboardStyleShell}
|
|
413
|
+
onSetArtboardKind={setArtboardKindShell}
|
|
414
|
+
onSetArtboardPrint={setArtboardPrintShell}
|
|
415
|
+
onDuplicateArtboard={duplicateArtboardShell}
|
|
416
|
+
editScope={editScope}
|
|
417
|
+
onUndoRedo={(dir) => postToActiveCanvas({ dgn: dir })}
|
|
418
|
+
photoSel={photoSel}
|
|
419
|
+
photoRev={photoRev}
|
|
420
|
+
onPhotoEdit={onPhotoEdit}
|
|
421
|
+
onPhotoRemoveBackground={onPhotoRemoveBackground}
|
|
422
|
+
onPhotoRecordEdit={onPhotoRecordEdit}
|
|
423
|
+
onPhotoUndoRedo={(dir) => performPhotoUndo(dir === 'redo')}
|
|
424
|
+
layersTree={layersTree}
|
|
425
|
+
componentMap={componentMap}
|
|
426
|
+
lockedKeys={lockedKeys}
|
|
427
|
+
onToggleLock={toggleLockedKey}
|
|
428
|
+
onDetachInstance={detachInstanceShell}
|
|
429
|
+
canvasFile={activePath}
|
|
430
|
+
onSelectLayer={(n) =>
|
|
431
|
+
postToActiveCanvas({
|
|
432
|
+
dgn: 'select-by-id',
|
|
433
|
+
id: n.id,
|
|
434
|
+
artboardId: layersTree?.artboardId,
|
|
435
|
+
index: n.index,
|
|
436
|
+
})
|
|
437
|
+
}
|
|
438
|
+
onHoverLayer={(n) =>
|
|
439
|
+
postToActiveCanvas({
|
|
440
|
+
dgn: 'highlight',
|
|
441
|
+
id: n ? n.id : null,
|
|
442
|
+
artboardId: layersTree?.artboardId,
|
|
443
|
+
index: n ? n.index : 0,
|
|
444
|
+
})
|
|
445
|
+
}
|
|
446
|
+
onReorderLayer={reorderLayer}
|
|
447
|
+
layersBusyRef={layersBusyRef}
|
|
448
|
+
resizing={resizingFor(id)}
|
|
449
|
+
/>
|
|
450
|
+
);
|
|
451
|
+
if (id === 'comments')
|
|
452
|
+
return (
|
|
453
|
+
<CommentsPanel
|
|
454
|
+
commentsByFile={commentsByFile}
|
|
455
|
+
filter={commentsFilter}
|
|
456
|
+
setFilter={setCommentsFilter}
|
|
457
|
+
activePath={activePath}
|
|
458
|
+
focusedId={focusedCommentId}
|
|
459
|
+
onJump={jumpToComment}
|
|
460
|
+
// Cloud Phase 25 C2 — a viewer READS threads; the mutating actions
|
|
461
|
+
// are absent until C3 lands comments on the cell's allowlist.
|
|
462
|
+
onResolve={viewerMode ? undefined : resolveComment}
|
|
463
|
+
onReopen={viewerMode ? undefined : reopenComment}
|
|
464
|
+
onDelete={viewerMode ? undefined : deleteComment}
|
|
465
|
+
resizing={resizingFor('comments')}
|
|
466
|
+
/>
|
|
467
|
+
);
|
|
468
|
+
return null;
|
|
469
|
+
};
|
|
470
|
+
return {
|
|
471
|
+
activeCanvasFile, activeOpenComments, dockLabels, leftActive, leftHostsAssistant, leftIds,
|
|
472
|
+
paletteActions, renderPanelBody, resizingFor, rightActive, rightHostsAssistant, rightIds
|
|
473
|
+
};
|
|
474
|
+
}
|