@floless/app 0.153.0 → 0.155.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/dist/floless-server.cjs +51767 -38222
- package/dist/schemas/revit.model.v1.schema.json +5 -0
- package/dist/schemas/steel.model.v2.schema.json +19 -5
- package/dist/skills/floless-app-new-workflow/SKILL.md +8 -2
- package/dist/skills/floless-app-onboarding/SKILL.md +31 -19
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +20 -11
- package/dist/skills/floless-app-queue/SKILL.md +23 -4
- package/dist/skills/floless-app-steel-model/SKILL.md +23 -2
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +158 -65
- package/dist/skills/floless-app-workflows/SKILL.md +23 -5
- package/dist/skills/floless-app-workflows/references/blender-exec.md +183 -0
- package/dist/skills/floless-app-workflows/references/dev-server-and-run-trace.md +27 -12
- package/dist/templates/blender-construction-sequence.flo +96 -0
- package/dist/web/agents.js +33 -13
- package/dist/web/app.css +331 -34
- package/dist/web/app.js +12 -1
- package/dist/web/aware.js +1167 -137
- package/dist/web/chat-question-card.js +477 -0
- package/dist/web/chat.css +237 -25
- package/dist/web/chat.js +2156 -889
- package/dist/web/commands-shell.js +578 -21
- package/dist/web/commands-steel.js +105 -4
- package/dist/web/guide.js +217 -16
- package/dist/web/index.html +104 -10
- package/dist/web/instructor.js +10 -9
- package/dist/web/left-pane.js +43 -6
- package/dist/web/media-player.js +234 -0
- package/dist/web/model-editor-contract.js +2 -0
- package/dist/web/model-editor-revit-adapter.js +1 -0
- package/dist/web/model-editor-steel-adapter.js +89 -1
- package/dist/web/model-panel-bridge.js +16 -2
- package/dist/web/model-view-query.js +590 -0
- package/dist/web/model-viewport-revit-adapter.js +15 -1
- package/dist/web/model-viewport-toolbar.js +5 -2
- package/dist/web/pages.js +592 -0
- package/dist/web/panels.js +2 -1
- package/dist/web/revit-editor.js +182 -16
- package/dist/web/run-progress.js +193 -0
- package/dist/web/run-strip.js +173 -0
- package/dist/web/steel-3d-core.js +70 -0
- package/dist/web/steel-editor.html +2751 -219
- package/dist/web/steel-frames-core.js +958 -0
- package/dist/web/steel-last-seen.js +315 -0
- package/dist/web/steel-marks-core.js +530 -0
- package/dist/web/steel-model-slim.js +95 -0
- package/dist/web/steel-model-v2-client-validation.js +14 -2
- package/dist/web/steel-model-v2-commands.js +258 -27
- package/dist/web/steel-model-v2-projection.js +78 -18
- package/dist/web/steel-read-confidence.js +11 -2
- package/dist/web/tekla-structural-grid-adapter.js +7 -1
- package/dist/web/tool-updates.js +141 -33
- package/dist/web/workspaces.js +446 -30
- package/package.json +3 -2
package/dist/web/workspaces.js
CHANGED
|
@@ -311,6 +311,9 @@
|
|
|
311
311
|
const $approvalSub = document.getElementById('approval-review-sub');
|
|
312
312
|
const $approvalImpact = document.getElementById('approval-review-impact');
|
|
313
313
|
const $approvalBody = document.getElementById('approval-review-body');
|
|
314
|
+
const $approvalRevisionNote = document.getElementById('approval-revision-note');
|
|
315
|
+
const $approvalRevisionNoteText = document.getElementById('approval-revision-note-text');
|
|
316
|
+
$approvalRevisionNoteText?.addEventListener('input', () => { if (approvalDialogState) approvalDialogState.revisionNoteText = $approvalRevisionNoteText.value; });
|
|
314
317
|
const $approvalCounts = document.getElementById('approval-review-counts');
|
|
315
318
|
const $approvalLive = document.getElementById('approval-review-live');
|
|
316
319
|
const $approvalCancel = document.getElementById('approval-review-cancel');
|
|
@@ -372,6 +375,10 @@
|
|
|
372
375
|
const $revitReassure = document.getElementById('ws-source-reassure');
|
|
373
376
|
let revitSourceState = null;
|
|
374
377
|
let revitActiveOperation = null;
|
|
378
|
+
// The Source card an import leaves ("…It is not approved yet.") stays true only until that model is approved.
|
|
379
|
+
let revitSourceAwaitsApproval = false;
|
|
380
|
+
// Every paint of the Source pane counts, so a late answer can tell that something newer was painted.
|
|
381
|
+
let revitSourcePaints = 0;
|
|
375
382
|
const activeImportPolls = new Set();
|
|
376
383
|
let teklaUploadAbort = null;
|
|
377
384
|
let teklaUploadProjectId = null;
|
|
@@ -743,6 +750,7 @@
|
|
|
743
750
|
{ key: 'model', label: 'Model' },
|
|
744
751
|
{ key: 'exports', label: 'Exports' },
|
|
745
752
|
{ key: 'history', label: 'History' },
|
|
753
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
746
754
|
],
|
|
747
755
|
diff: true, // steel semantic diff expander
|
|
748
756
|
exports: [
|
|
@@ -793,6 +801,7 @@
|
|
|
793
801
|
{ key: 'model', label: 'Traced' }, // reuse the 'model' frame slot; label "Traced"
|
|
794
802
|
{ key: 'exports', label: 'Exports' },
|
|
795
803
|
{ key: 'history', label: 'History' },
|
|
804
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
796
805
|
],
|
|
797
806
|
diff: false,
|
|
798
807
|
exports: [
|
|
@@ -823,6 +832,7 @@
|
|
|
823
832
|
{ key: 'drawings', label: 'Source' },
|
|
824
833
|
{ key: 'model', label: 'Model' },
|
|
825
834
|
{ key: 'history', label: 'History' },
|
|
835
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
826
836
|
],
|
|
827
837
|
diff: false,
|
|
828
838
|
exports: [],
|
|
@@ -850,6 +860,7 @@
|
|
|
850
860
|
{ key: 'drawings', label: 'Source' },
|
|
851
861
|
{ key: 'model', label: 'Model' },
|
|
852
862
|
{ key: 'history', label: 'History' },
|
|
863
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
853
864
|
],
|
|
854
865
|
diff: false,
|
|
855
866
|
exports: [],
|
|
@@ -913,6 +924,7 @@
|
|
|
913
924
|
{ key: 'knowledge', label: 'Knowledge' }, // the client's standards are knowledge, as for every app
|
|
914
925
|
{ key: 'model', label: 'Checker' },
|
|
915
926
|
{ key: 'history', label: 'History' },
|
|
927
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
916
928
|
],
|
|
917
929
|
diff: false,
|
|
918
930
|
exports: [],
|
|
@@ -1299,6 +1311,7 @@
|
|
|
1299
1311
|
const headVersion = approvalHeadVersion(review);
|
|
1300
1312
|
approvalState = { status: 'ready', review, pendingCount: groups.length, headVersion, error: '' };
|
|
1301
1313
|
renderApprovalHeader();
|
|
1314
|
+
settleImportedSourceCard(projectId);
|
|
1302
1315
|
syncWorkspaceGuide();
|
|
1303
1316
|
if (!$wsExports.hidden) paintExports(current.approvedAt);
|
|
1304
1317
|
return review;
|
|
@@ -2436,6 +2449,7 @@
|
|
|
2436
2449
|
tipTruncatedNames();
|
|
2437
2450
|
}
|
|
2438
2451
|
|
|
2452
|
+
let landingPageFocusCommand = null;
|
|
2439
2453
|
function renderLanding() {
|
|
2440
2454
|
syncProjectGroupSearchRoot();
|
|
2441
2455
|
const rootState = window.flolessWorkspaceRoot && window.flolessWorkspaceRoot.current();
|
|
@@ -2533,6 +2547,9 @@
|
|
|
2533
2547
|
+ `</div></div>`;
|
|
2534
2548
|
}
|
|
2535
2549
|
}
|
|
2550
|
+
// Workspace Pages (#2262): Pages made in workspace-wide chats. The slot is always in the markup but
|
|
2551
|
+
// pages.js leaves it EMPTY when there are none, so the landing gains no empty section.
|
|
2552
|
+
if (!rootUnavailable) html += `<section class="ws-pages-group" id="ws-landing-pages" aria-label="Workspace Pages"></section>`;
|
|
2536
2553
|
// Archived ("Trash") section — a collapsed disclosure below the live grid, only when non-empty.
|
|
2537
2554
|
// Demoted rows (muted, no thumb) read as "put away"; each offers Restore + a guarded Delete.
|
|
2538
2555
|
if (archived.length) {
|
|
@@ -2567,6 +2584,9 @@
|
|
|
2567
2584
|
// attention was already on the control they had just pressed and the loss was invisible — the
|
|
2568
2585
|
// apps-changed refresh (#389) is the first caller that fires with NO local action.
|
|
2569
2586
|
const keepFocus = landingFocusKey(document.activeElement);
|
|
2587
|
+
const activePage = document.activeElement?.closest('.pg-row-open, .pg-row-delete');
|
|
2588
|
+
if (activePage && $landing.contains(activePage)) landingPageFocusCommand = activePage.getAttribute('data-command-id');
|
|
2589
|
+
else if (document.activeElement !== document.body) landingPageFocusCommand = null;
|
|
2570
2590
|
const keepScroll = $landing.scrollTop;
|
|
2571
2591
|
const keepArchivedOpen = !!$landing.querySelector('.ws-archived')?.open;
|
|
2572
2592
|
const search = document.activeElement?.id === 'ws-landing-search' ? document.activeElement : null;
|
|
@@ -2584,6 +2604,17 @@
|
|
|
2584
2604
|
if (keepFocus === '#ws-search-clear') $landing.querySelector(keepFocus)?.focus({ focusVisible: true, preventScroll: true });
|
|
2585
2605
|
paintCardThumbs();
|
|
2586
2606
|
tipTruncatedNames();
|
|
2607
|
+
{ const slot = $landing.querySelector('#ws-landing-pages');
|
|
2608
|
+
if (slot && window.flolessPages) window.flolessPages.renderList(slot, 'ws', {
|
|
2609
|
+
hideWhenEmpty: true, label: 'Workspace Pages',
|
|
2610
|
+
headHtml: '<div class="wf-group-label">Workspace Pages</div>',
|
|
2611
|
+
}).then(() => {
|
|
2612
|
+
if (!slot.isConnected) return; // a newer landing paint carries the same pending Page identity
|
|
2613
|
+
if (landingPageFocusCommand && mode === 'workspaces' && !current && document.activeElement === document.body) {
|
|
2614
|
+
[...slot.querySelectorAll('[data-command-id]')].find((el) => el.getAttribute('data-command-id') === landingPageFocusCommand)?.focus({ preventScroll: true });
|
|
2615
|
+
}
|
|
2616
|
+
landingPageFocusCommand = null;
|
|
2617
|
+
}); }
|
|
2587
2618
|
// The first-run tour link, when the empty state rendered one. app.js owns the copy behaviour so
|
|
2588
2619
|
// both entry points to the tour stay identical; a no-op when the button isn't on screen.
|
|
2589
2620
|
wireAskGuide($landing.querySelector('#ws-onb-tour'));
|
|
@@ -4142,6 +4173,8 @@
|
|
|
4142
4173
|
$teklaContinueWithout?.addEventListener('click', () => teklaAsk?.onContinue());
|
|
4143
4174
|
|
|
4144
4175
|
function paintRevitSourceState(title, detail) {
|
|
4176
|
+
revitSourcePaints++;
|
|
4177
|
+
revitSourceAwaitsApproval = false;
|
|
4145
4178
|
if (!$sourcePlaceholder) return;
|
|
4146
4179
|
const titleNode = $sourcePlaceholder.querySelector('.ws-source-title');
|
|
4147
4180
|
const detailNode = $sourcePlaceholder.querySelector('.ws-source-sub');
|
|
@@ -4265,6 +4298,18 @@
|
|
|
4265
4298
|
$sourcePlaceholder?.setAttribute('aria-atomic', 'true');
|
|
4266
4299
|
}
|
|
4267
4300
|
|
|
4301
|
+
/**
|
|
4302
|
+
* Once the model an import left on the Source card is approved with nothing pending, the card rests as it
|
|
4303
|
+
* does when the project is reopened ("Source RVT · <file> · <size>"). The header is the one place approval
|
|
4304
|
+
* is shown, so the card never repeats it, and a later import re-arms it.
|
|
4305
|
+
*/
|
|
4306
|
+
function settleImportedSourceCard(projectId) {
|
|
4307
|
+
if (!revitSourceAwaitsApproval || approvalState.status !== 'ready'
|
|
4308
|
+
|| !approvalState.headVersion || approvalState.pendingCount > 0) return;
|
|
4309
|
+
revitSourceAwaitsApproval = false;
|
|
4310
|
+
void refreshRevitSourceState(projectId, revitSourcePaints);
|
|
4311
|
+
}
|
|
4312
|
+
|
|
4268
4313
|
// Replacement admission needs a fresh generation, but it must not share the painter's
|
|
4269
4314
|
// stale-response guard. A simultaneous project-open refresh can legitimately change the
|
|
4270
4315
|
// displayed operation while this request is in flight; that must not silently discard the
|
|
@@ -4295,13 +4340,16 @@
|
|
|
4295
4340
|
return current?.id === project.id ? response.state : null;
|
|
4296
4341
|
}
|
|
4297
4342
|
|
|
4298
|
-
async function refreshRevitSourceState(projectId = current?.id) {
|
|
4343
|
+
async function refreshRevitSourceState(projectId = current?.id, paintsAtRequest = null) {
|
|
4299
4344
|
if (!projectId || !current || current.id !== projectId || !isModelSourceProject(current)) return null;
|
|
4300
4345
|
const operationAtRequest = revitActiveOperation;
|
|
4346
|
+
// A caller that only tidies the pane passes the paint count it saw: anything painted since (an upload that
|
|
4347
|
+
// has no operation yet, a round trip to another project) is newer than this answer.
|
|
4348
|
+
const paintedSince = () => paintsAtRequest !== null && revitSourcePaints !== paintsAtRequest;
|
|
4301
4349
|
try {
|
|
4302
4350
|
const tekla = isTeklaParserProject(current);
|
|
4303
4351
|
const response = await api(`/api/${tekla ? 'tekla' : 'revit'}-projects/${encodeURIComponent(projectId)}/source-state`);
|
|
4304
|
-
if (!current || current.id !== projectId) return null;
|
|
4352
|
+
if (!current || current.id !== projectId || paintedSince()) return null;
|
|
4305
4353
|
// A project-open status request may finish after a new upload has been admitted.
|
|
4306
4354
|
// Never replace the newer operation with the older source-state response.
|
|
4307
4355
|
if (revitActiveOperation !== operationAtRequest) return null;
|
|
@@ -4335,7 +4383,7 @@
|
|
|
4335
4383
|
}
|
|
4336
4384
|
return response.state;
|
|
4337
4385
|
} catch (error) {
|
|
4338
|
-
if (!current || current.id !== projectId || revitActiveOperation !== operationAtRequest) return null;
|
|
4386
|
+
if (!current || current.id !== projectId || revitActiveOperation !== operationAtRequest || paintedSince()) return null;
|
|
4339
4387
|
paintRevitSourceState(isTeklaParserProject() ? 'Tekla source unavailable' : 'Revit source unavailable', error && error.message || 'Could not read source status.');
|
|
4340
4388
|
paintRevitSourceActions('ready', false);
|
|
4341
4389
|
return null;
|
|
@@ -4616,6 +4664,7 @@
|
|
|
4616
4664
|
if (operation.state === 'ready') {
|
|
4617
4665
|
revitActiveOperation = null;
|
|
4618
4666
|
paintRevitSourceState(tekla ? 'Read-only snapshot ready to review' : 'Model ready to review', 'The model is available on the Model tab. It is not approved yet.');
|
|
4667
|
+
revitSourceAwaitsApproval = true;
|
|
4619
4668
|
paintRevitSourceActions('imported', true);
|
|
4620
4669
|
// A Model tab opened during conversion has already loaded its temporary "unavailable" state.
|
|
4621
4670
|
// Invalidate that frame now: reload immediately when visible, or on the next tab activation.
|
|
@@ -4756,6 +4805,7 @@
|
|
|
4756
4805
|
}
|
|
4757
4806
|
if (!nav.skipLeaveGuard && current && current.id !== p.id && !(await leaveOpenProject(nav.returnFocus))) return STAYED_IN_PROJECT;
|
|
4758
4807
|
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4808
|
+
if (current?.uuid !== p.uuid) revisionNoteEditorGeneration++;
|
|
4759
4809
|
current = p;
|
|
4760
4810
|
// #1890: a new workspace conversation suggests this project's units (the one opened last).
|
|
4761
4811
|
try { localStorage.setItem('floless:last-project', p.id); } catch { /* private mode: no suggestion */ }
|
|
@@ -4791,8 +4841,10 @@
|
|
|
4791
4841
|
configureReadOnlySourceChrome(p);
|
|
4792
4842
|
try {
|
|
4793
4843
|
const session = await fetch('/api/editor/session', { method: 'POST', credentials: 'same-origin' });
|
|
4844
|
+
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4794
4845
|
if (!session.ok) throw new Error(`HTTP ${session.status}`);
|
|
4795
4846
|
} catch (error) {
|
|
4847
|
+
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4796
4848
|
showToast(`Couldn’t start the secure ${isTeklaParserProject(p) ? 'Tekla Parser' : 'Revit'} editor session.`, 'warn');
|
|
4797
4849
|
current = null;
|
|
4798
4850
|
return;
|
|
@@ -4973,10 +5025,13 @@
|
|
|
4973
5025
|
/** What openProject returns when the user chose to stay: callers that open on someone's behalf say so. */
|
|
4974
5026
|
const STAYED_IN_PROJECT = Object.freeze({ stayed: true });
|
|
4975
5027
|
async function leaveProjectToList(returnFocus) {
|
|
5028
|
+
const navToken = ++openNavSeq;
|
|
4976
5029
|
if (!(await leaveOpenProject(returnFocus))) return;
|
|
5030
|
+
if (navToken !== openNavSeq) return;
|
|
4977
5031
|
closeProject();
|
|
4978
5032
|
}
|
|
4979
5033
|
function closeProject() {
|
|
5034
|
+
openNavSeq++;
|
|
4980
5035
|
current = null;
|
|
4981
5036
|
approvalStateGen++;
|
|
4982
5037
|
approvalState = { status: 'unavailable', review: null, pendingCount: 0, headVersion: null, error: '' };
|
|
@@ -5728,6 +5783,7 @@
|
|
|
5728
5783
|
}
|
|
5729
5784
|
|
|
5730
5785
|
function setStep(s) {
|
|
5786
|
+
if (currentStep === 'history' && s !== 'history') revisionNoteEditorGeneration++;
|
|
5731
5787
|
// Keep the tab visually available while the routine open-project check runs, but do not cross
|
|
5732
5788
|
// the model boundary speculatively. The existing request is reused and this destination opens
|
|
5733
5789
|
// automatically if it reports a model; the most recent click wins.
|
|
@@ -5782,6 +5838,21 @@
|
|
|
5782
5838
|
$wsHistory.hidden = !showHistory;
|
|
5783
5839
|
if (showHistory) renderHistory();
|
|
5784
5840
|
else { closeRollbackConfirm(); closeBaseMenu(); } // don't leave a popover open behind a step switch
|
|
5841
|
+
// Pages (#2262) is a shell-rendered pane too: this project's stored, versioned HTML Pages (pages.js).
|
|
5842
|
+
// Queried here, not through a module const, for the same reason as ws-attach-revision above: setStep is
|
|
5843
|
+
// evaluated on its own by workspace-instructor-handoff.test.ts.
|
|
5844
|
+
const showPages = s === 'pages';
|
|
5845
|
+
const $pagesPane = document.getElementById('ws-pages');
|
|
5846
|
+
if ($pagesPane) {
|
|
5847
|
+
$pagesPane.hidden = !showPages;
|
|
5848
|
+
const project = typeof current !== 'undefined' ? current : null;
|
|
5849
|
+
if (showPages && project && window.flolessPages) {
|
|
5850
|
+
window.flolessPages.renderList($pagesPane, `p-${project.id}`, {
|
|
5851
|
+
label: 'Pages in this project',
|
|
5852
|
+
headHtml: '<div class="step-head"><span>Pages</span></div><p class="pg-sub">Saved reports and pages, kept with their versions.</p>',
|
|
5853
|
+
});
|
|
5854
|
+
}
|
|
5855
|
+
}
|
|
5785
5856
|
// Knowledge is a shell-rendered pane too: the project's Knowledge Base (References column).
|
|
5786
5857
|
const showKnowledge = s === 'knowledge';
|
|
5787
5858
|
$wsKnowledge.hidden = !showKnowledge;
|
|
@@ -5844,6 +5915,7 @@
|
|
|
5844
5915
|
if (!st) return;
|
|
5845
5916
|
const changed = st.phase !== phase;
|
|
5846
5917
|
st.phase = phase;
|
|
5918
|
+
if ($approvalRevisionNote) $approvalRevisionNote.hidden = !['ready', 'failed'].includes(phase);
|
|
5847
5919
|
// Recovery may be dismissed, but it must never unlock a second mutation while the durable
|
|
5848
5920
|
// outcome is pending or unreadable. Dismissibility and mutation safety are separate concerns.
|
|
5849
5921
|
const locked = !approvalDismissible(phase) || ['abandoned', 'recovery-close'].includes(phase);
|
|
@@ -5997,7 +6069,9 @@
|
|
|
5997
6069
|
const conflicts = review.moveForward && Array.isArray(review.moveForward.conflicts) ? review.moveForward.conflicts : [];
|
|
5998
6070
|
const conflictDecisions = approvalDialogState.conflicts || {};
|
|
5999
6071
|
$approvalSub.textContent = review.moveForward
|
|
6000
|
-
?
|
|
6072
|
+
? review.moveForward.replacesLatest
|
|
6073
|
+
? `This model will replace v${review.moveForward.toVersion} as the approved version`
|
|
6074
|
+
: `Your changes from v${review.moveForward.fromVersion} will be applied on top of approved v${review.moveForward.toVersion}`
|
|
6001
6075
|
: review.base ? `Compared with approved v${review.base.version}` : 'First approval · full-model baseline';
|
|
6002
6076
|
$approvalImpact.textContent = [review.summary, ...(Array.isArray(review.cautions) ? review.cautions : [])].filter(Boolean).join(' ');
|
|
6003
6077
|
const groupHtml = groups.map((group) => {
|
|
@@ -6064,6 +6138,7 @@
|
|
|
6064
6138
|
const st = approvalDialogState;
|
|
6065
6139
|
if (st && !approvalDismissible(st.phase)) return;
|
|
6066
6140
|
approvalDialogState = null;
|
|
6141
|
+
if ($approvalRevisionNoteText) $approvalRevisionNoteText.value = '';
|
|
6067
6142
|
$approvalModal.classList.remove('show');
|
|
6068
6143
|
$approvalModal.removeAttribute('aria-busy');
|
|
6069
6144
|
// The confirm button outlives this review: a reason it was blocked for must not follow it into
|
|
@@ -6081,12 +6156,17 @@
|
|
|
6081
6156
|
|
|
6082
6157
|
const approvalOperationStoragePrefix = 'floless:approval-operation:v1';
|
|
6083
6158
|
const approvalOperationIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
6084
|
-
const approvalOperationStorageKey = (project) => `${approvalOperationStoragePrefix}:${encodeURIComponent(project.app)
|
|
6159
|
+
const approvalOperationStorageKey = (project) => `${approvalOperationStoragePrefix}:${project.uuid ? encodeURIComponent(project.uuid) : encodeURIComponent(project.app) + '|' + encodeURIComponent(project.id)}`;
|
|
6160
|
+
const approvalOperationMemory = new Map();
|
|
6161
|
+
const approvalOperationVolatile = new Set();
|
|
6162
|
+
const revisionNoteMemory = new Map();
|
|
6163
|
+
const revisionNotePendingKey = (project, n) => `floless:pending-revision-note:v1:${project.uuid}:${n}`;
|
|
6085
6164
|
const approvalDecisionRecord = (value, allowed) => value && typeof value === 'object' && !Array.isArray(value)
|
|
6086
6165
|
&& Object.entries(value).every(([key, decision]) => key.length > 0 && allowed.includes(decision));
|
|
6087
6166
|
function validRememberedApprovalOperation(value, project) {
|
|
6088
6167
|
return !!value && typeof value === 'object' && !Array.isArray(value)
|
|
6089
|
-
&& value.projectId === project.id && value.appId === project.app
|
|
6168
|
+
&& (value.projectUuid ? value.projectUuid === project.uuid : value.projectId === project.id) && value.appId === project.app
|
|
6169
|
+
&& (value.revisionNoteText === undefined || typeof value.revisionNoteText === 'string' && value.revisionNoteText.length <= 2000)
|
|
6090
6170
|
&& typeof value.operationId === 'string' && approvalOperationIdPattern.test(value.operationId)
|
|
6091
6171
|
&& typeof value.operationToken === 'string' && approvalOperationIdPattern.test(value.operationToken)
|
|
6092
6172
|
&& value.operationToken !== value.operationId
|
|
@@ -6105,24 +6185,88 @@
|
|
|
6105
6185
|
&& conflictIds.every((id) => Object.hasOwn(value.conflicts, id));
|
|
6106
6186
|
}
|
|
6107
6187
|
function rememberApprovalOperation(project, value) {
|
|
6188
|
+
const key = approvalOperationStorageKey(project);
|
|
6189
|
+
if (value) approvalOperationMemory.set(key, value); else approvalOperationMemory.delete(key);
|
|
6108
6190
|
try {
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
} catch { /* the server receipt remains authoritative when browser storage is unavailable */ }
|
|
6191
|
+
if (value) { localStorage.setItem(key, JSON.stringify(value)); const saved = localStorage.getItem(key) === JSON.stringify(value); if (saved) approvalOperationVolatile.delete(key); else approvalOperationVolatile.add(key); return saved; }
|
|
6192
|
+
localStorage.removeItem(key); approvalOperationVolatile.delete(key); return localStorage.getItem(key) === null;
|
|
6193
|
+
} catch { approvalOperationVolatile.add(key); return false; }
|
|
6113
6194
|
}
|
|
6114
6195
|
function rememberedApprovalOperation(project) {
|
|
6196
|
+
const key = approvalOperationStorageKey(project);
|
|
6197
|
+
if (approvalOperationVolatile.has(key)) { const value = approvalOperationMemory.get(key); return validRememberedApprovalOperation(value, project) ? value : null; }
|
|
6115
6198
|
try {
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
if (
|
|
6199
|
+
let value = JSON.parse(localStorage.getItem(key) || 'null');
|
|
6200
|
+
// Upgrade recovery for attempts written before storage was keyed by project UUID.
|
|
6201
|
+
if (value === null && project.uuid) {
|
|
6202
|
+
const legacyKey = `${approvalOperationStoragePrefix}:${encodeURIComponent(project.app)}|${encodeURIComponent(project.id)}`;
|
|
6203
|
+
const legacy = JSON.parse(localStorage.getItem(legacyKey) || 'null');
|
|
6204
|
+
if (validRememberedApprovalOperation(legacy, project)) {
|
|
6205
|
+
value = legacy;
|
|
6206
|
+
if (rememberApprovalOperation(project, legacy)) localStorage.removeItem(legacyKey);
|
|
6207
|
+
}
|
|
6208
|
+
}
|
|
6209
|
+
if (validRememberedApprovalOperation(value, project)) { approvalOperationMemory.set(key, value); return value; }
|
|
6119
6210
|
if (value !== null) localStorage.removeItem(key);
|
|
6211
|
+
approvalOperationMemory.delete(key);
|
|
6120
6212
|
return null;
|
|
6121
6213
|
} catch {
|
|
6122
|
-
|
|
6123
|
-
return null;
|
|
6214
|
+
const memory = approvalOperationMemory.get(key);
|
|
6215
|
+
return validRememberedApprovalOperation(memory, project) ? memory : null;
|
|
6124
6216
|
}
|
|
6125
6217
|
}
|
|
6218
|
+
function pendingRevisionNote(project, n) {
|
|
6219
|
+
if (!project.uuid) return null;
|
|
6220
|
+
let value = revisionNoteMemory.get(revisionNotePendingKey(project, n));
|
|
6221
|
+
if (!value) try { value = JSON.parse(localStorage.getItem(revisionNotePendingKey(project, n)) || 'null'); } catch { /* memory still retains this window's text */ }
|
|
6222
|
+
return value && value.projectUuid === project.uuid && Number.isSafeInteger(value.n) && value.n > 0
|
|
6223
|
+
&& typeof value.text === 'string' && typeof value.rowKey === 'string' ? value : null;
|
|
6224
|
+
}
|
|
6225
|
+
function rememberPendingRevisionNote(project, value, n = value?.n) {
|
|
6226
|
+
if (!project.uuid) return false;
|
|
6227
|
+
if (value) revisionNoteMemory.set(revisionNotePendingKey(project, n), value); else revisionNoteMemory.delete(revisionNotePendingKey(project, n));
|
|
6228
|
+
try {
|
|
6229
|
+
const key = revisionNotePendingKey(project, n);
|
|
6230
|
+
if (value) { const text = JSON.stringify(value); localStorage.setItem(key, text); return localStorage.getItem(key) === text; }
|
|
6231
|
+
localStorage.removeItem(key); return localStorage.getItem(key) === null;
|
|
6232
|
+
} catch { return false; }
|
|
6233
|
+
}
|
|
6234
|
+
function clearConfirmedRevisionNoteDraft(project, record) {
|
|
6235
|
+
const key = revisionNotePendingKey(project, record.n);
|
|
6236
|
+
const owns = value => value?.projectUuid === record.projectUuid && value.n === record.n
|
|
6237
|
+
&& value.rowKey === record.rowKey && value.writeId === record.writeId;
|
|
6238
|
+
if (owns(revisionNoteMemory.get(key))) revisionNoteMemory.delete(key);
|
|
6239
|
+
// Another window can replace durable storage while this window retains its own copy.
|
|
6240
|
+
try {
|
|
6241
|
+
const durable = JSON.parse(localStorage.getItem(key) || 'null');
|
|
6242
|
+
if (owns(durable)) localStorage.removeItem(key);
|
|
6243
|
+
} catch { /* Preserve unavailable or unreadable durable storage. */ }
|
|
6244
|
+
}
|
|
6245
|
+
async function savePendingRevisionNote(project, record) {
|
|
6246
|
+
record = { ...record, writeId: crypto.randomUUID() };
|
|
6247
|
+
rememberPendingRevisionNote(project, record);
|
|
6248
|
+
try {
|
|
6249
|
+
await api(`/api/projects/${encodeURIComponent(project.id)}/versions/${record.n}/note`, { method: 'PUT', body: JSON.stringify({
|
|
6250
|
+
text: record.text, expectedRevision: record.expectedRevision, expectedProjectUuid: record.projectUuid, expectedRowKey: record.rowKey, claimedChannel: 'browser',
|
|
6251
|
+
}) });
|
|
6252
|
+
clearConfirmedRevisionNoteDraft(project, record);
|
|
6253
|
+
return true;
|
|
6254
|
+
} catch { return false; }
|
|
6255
|
+
}
|
|
6256
|
+
async function finishApprovalRevisionNote(res, project) {
|
|
6257
|
+
const attempt = rememberedApprovalOperation(project);
|
|
6258
|
+
const text = attempt?.revisionNoteText || '';
|
|
6259
|
+
const n = Number(res?.version?.n), rowKey = res?.version?.approval?.publicationTxn || res?.version?.ts;
|
|
6260
|
+
if (!text.trim()) { rememberApprovalOperation(project, null); return ''; }
|
|
6261
|
+
if (!project.uuid || !Number.isSafeInteger(n) || !rowKey) return 'Version approved. Your note is kept in this window; reopen History to save it.';
|
|
6262
|
+
const record = { projectUuid: project.uuid, operationId: attempt.operationId, n, rowKey, text, expectedRevision: 0 };
|
|
6263
|
+
const durable = rememberPendingRevisionNote(project, record);
|
|
6264
|
+
if (durable) rememberApprovalOperation(project, null);
|
|
6265
|
+
const saved = await savePendingRevisionNote(project, record);
|
|
6266
|
+
if (saved) { rememberApprovalOperation(project, null); return 'Revision note saved.'; }
|
|
6267
|
+
return durable ? 'Version approved. Your note could not be saved. Use Save kept note in History to retry without approving again.'
|
|
6268
|
+
: 'Version approved. Your note is kept in this window; refresh recovery is unavailable. Use Save kept note in History to retry.';
|
|
6269
|
+
}
|
|
6126
6270
|
|
|
6127
6271
|
function ensureApprovalOperationPair(state) {
|
|
6128
6272
|
if (approvalOperationIdPattern.test(state.operationId || '')
|
|
@@ -6136,7 +6280,8 @@
|
|
|
6136
6280
|
}
|
|
6137
6281
|
|
|
6138
6282
|
async function finishApprovalSuccess(res, project) {
|
|
6139
|
-
|
|
6283
|
+
const revisionNoteStatus = await finishApprovalRevisionNote(res, project);
|
|
6284
|
+
if ($approvalRevisionNoteText) $approvalRevisionNoteText.value = '';
|
|
6140
6285
|
if (res && res.approvedAt) project.approvedAt = res.approvedAt;
|
|
6141
6286
|
const n = res && res.version && Number(res.version.n);
|
|
6142
6287
|
if (Number.isInteger(n)) expandDiffOnce = { projectId: project.id, n };
|
|
@@ -6160,7 +6305,7 @@
|
|
|
6160
6305
|
: 'No changes remain pending.';
|
|
6161
6306
|
// The footer described the decision ("…will be approved…"); the decision has happened.
|
|
6162
6307
|
$approvalCounts.textContent = '';
|
|
6163
|
-
$approvalBody.innerHTML = `<div class="approval-notice approval-notice-success"><b>${escapeHtml(headline)}</b> The approved model and compiled workflow are ready.${accepted ? ' The findings stay listed in the Audit tab.' : ''}</div>`;
|
|
6308
|
+
$approvalBody.innerHTML = `<div class="approval-notice approval-notice-success"><b>${escapeHtml(headline)}</b> The approved model and compiled workflow are ready.${revisionNoteStatus ? ' ' + escapeHtml(revisionNoteStatus) : ''}${accepted ? ' The findings stay listed in the Audit tab.' : ''}</div>`;
|
|
6164
6309
|
setApprovalPhase('approved', accepted ? headline : `Approved${Number.isInteger(n) ? ` as v${n}` : ''}`);
|
|
6165
6310
|
$approvalClose.focus();
|
|
6166
6311
|
}
|
|
@@ -6236,6 +6381,7 @@
|
|
|
6236
6381
|
return;
|
|
6237
6382
|
}
|
|
6238
6383
|
const project = current;
|
|
6384
|
+
if (approvalDialogState?.projectId && approvalDialogState.projectId !== project.id && $approvalRevisionNoteText) $approvalRevisionNoteText.value = '';
|
|
6239
6385
|
$approvalModal.classList.add('show');
|
|
6240
6386
|
$approvalImpact.textContent = '';
|
|
6241
6387
|
$approvalCounts.textContent = '';
|
|
@@ -6248,6 +6394,7 @@
|
|
|
6248
6394
|
$approvalDialog.focus();
|
|
6249
6395
|
try {
|
|
6250
6396
|
const remembered = rememberedApprovalOperation(project);
|
|
6397
|
+
if (remembered && $approvalRevisionNoteText) { $approvalRevisionNoteText.value = remembered.revisionNoteText || ''; approvalDialogState.revisionNoteText = $approvalRevisionNoteText.value; }
|
|
6251
6398
|
if (remembered) {
|
|
6252
6399
|
approvalDialogState.operationId = remembered.operationId;
|
|
6253
6400
|
approvalDialogState.operationToken = remembered.operationToken;
|
|
@@ -6312,6 +6459,7 @@
|
|
|
6312
6459
|
approvalState = { status: 'ready', review, pendingCount: Array.isArray(review.groups) ? review.groups.length : 0,
|
|
6313
6460
|
headVersion: approvalHeadVersion(review), error: '' };
|
|
6314
6461
|
renderApprovalHeader();
|
|
6462
|
+
settleImportedSourceCard(project.id);
|
|
6315
6463
|
renderApprovalReview();
|
|
6316
6464
|
if (canRestore) {
|
|
6317
6465
|
approvalDialogState.retryAction = 'approve';
|
|
@@ -6369,11 +6517,20 @@
|
|
|
6369
6517
|
const st = approvalDialogState;
|
|
6370
6518
|
if (!st || $approvalConfirm.disabled || !current || current.id !== st.projectId) return;
|
|
6371
6519
|
const project = current;
|
|
6520
|
+
if (($approvalRevisionNoteText?.value || '').trim().length > 2000) {
|
|
6521
|
+
const shortened = await bridge.formModal({ title: 'Shorten the revision note', sub: 'Keep the note within 2000 characters, or leave it blank to approve without a note.', fields: [{ name: 'note', label: 'Revision note', multiline: true, value: $approvalRevisionNoteText.value, commandId: 'shell.revision-note-text' }], okLabel: 'Continue review' });
|
|
6522
|
+
if (!shortened) return;
|
|
6523
|
+
$approvalRevisionNoteText.value = shortened.note || '';
|
|
6524
|
+
st.revisionNoteText = $approvalRevisionNoteText.value;
|
|
6525
|
+
return confirmApprovalReview();
|
|
6526
|
+
}
|
|
6372
6527
|
st.decisions = approvalReviewDecisions(st.review, st.decisions);
|
|
6373
6528
|
const decisionSnapshot = { decisions: { ...st.decisions }, conflicts: { ...st.conflicts } };
|
|
6374
6529
|
const { operationId, operationToken } = ensureApprovalOperationPair(st);
|
|
6375
|
-
rememberApprovalOperation(project, { projectId: project.id, appId: project.app, operationId, operationToken,
|
|
6530
|
+
const noteDurable = rememberApprovalOperation(project, { projectId: project.id, appId: project.app, operationId, operationToken,
|
|
6531
|
+
projectUuid: project.uuid, revisionNoteText: ($approvalRevisionNoteText?.value || '').trim(),
|
|
6376
6532
|
reviewId: st.review.reviewId, decisions: decisionSnapshot.decisions, conflicts: decisionSnapshot.conflicts });
|
|
6533
|
+
if (!noteDurable && $approvalRevisionNoteText?.value) showToast('Your note is kept in this window; refresh recovery is unavailable.', 'warn');
|
|
6377
6534
|
// #1840: choosing "Approve with N findings accepted" IS the acceptance. It names exactly the
|
|
6378
6535
|
// contract and audit the review served (never a remembered or derived value).
|
|
6379
6536
|
const findings = st.review.importFindings;
|
|
@@ -8785,6 +8942,15 @@
|
|
|
8785
8942
|
* and the lifter brace-matches a declaration. An arrow assigned to a `const` lifts as a fragment
|
|
8786
8943
|
* that does not parse, so the test would fall back to a stub of its own and prove nothing.
|
|
8787
8944
|
*/
|
|
8945
|
+
// #2230: play a turntable right in the card's page. The command id is a literal with the row's name as its
|
|
8946
|
+
// instance (the same carrier rule as the file actions below); the viewpoint rides as data, never a path.
|
|
8947
|
+
function watchButton(row) {
|
|
8948
|
+
const variant = row.key.includes(':') ? row.key.slice(row.key.indexOf(':') + 1) : '';
|
|
8949
|
+
return `<button data-command-id="shell.render-watch#${escapeAttr(row.label)}" data-command-instance-label="${escapeAttr(row.label)}"`
|
|
8950
|
+
+ ` type="button" class="e-link" data-renderwatch="${escapeAttr(variant)}" data-renderwatch-at="${escapeAttr(row.exportedAt || '')}"`
|
|
8951
|
+
+ ` data-renderwatch-label="${escapeAttr(row.label)}" data-tip="Play the turntable here">▶ Watch</button>`;
|
|
8952
|
+
}
|
|
8953
|
+
|
|
8788
8954
|
function fileActionPair(kind, instance) {
|
|
8789
8955
|
return fileActionButton('open', { kind, instance }) + fileActionButton('reveal', { kind, instance });
|
|
8790
8956
|
}
|
|
@@ -9450,13 +9616,16 @@
|
|
|
9450
9616
|
/** The busy line: what it is doing now, which of how many, and how long it has been going. */
|
|
9451
9617
|
function renderBusyText() {
|
|
9452
9618
|
if (!renderProgress) return 'Rendering the approved model';
|
|
9453
|
-
const { stage, viewpoint, index, total, startedAt } = renderProgress;
|
|
9619
|
+
const { stage, viewpoint, index, total, startedAt, frameDone, frameTotal } = renderProgress;
|
|
9454
9620
|
const clock = ` · ${elapsedSince(startedAt)}`;
|
|
9455
9621
|
if (stage === 'preparing') return `Preparing the model${clock}`;
|
|
9456
9622
|
if (stage === 'rendering' || stage === 'rendered') {
|
|
9457
9623
|
const which = viewpoint ? viewpointLabel(viewpoint) : '';
|
|
9458
9624
|
const counter = total > 1 ? ` (${index} of ${total})` : '';
|
|
9459
|
-
|
|
9625
|
+
// #2230: a turntable says which frame Blender is on (blender 0.2.0+), never an invented percentage.
|
|
9626
|
+
const frames = typeof frameDone === 'number' && typeof frameTotal === 'number' && frameTotal > 0
|
|
9627
|
+
? ` · frame ${Math.min(frameDone, frameTotal)} of ${frameTotal}` : '';
|
|
9628
|
+
return `Rendering ${which}${counter}${frames}${clock}`;
|
|
9460
9629
|
}
|
|
9461
9630
|
return `Rendering${clock}`;
|
|
9462
9631
|
}
|
|
@@ -9470,6 +9639,12 @@
|
|
|
9470
9639
|
viewpoint: m.viewpoint || null,
|
|
9471
9640
|
index: m.index || 1,
|
|
9472
9641
|
total: m.total || 1,
|
|
9642
|
+
// A new viewpoint starts its own frame count; a stage update without one keeps the last count only
|
|
9643
|
+
// while it is still the same viewpoint.
|
|
9644
|
+
frameDone: typeof m.frameDone === 'number' ? m.frameDone
|
|
9645
|
+
: renderProgress && renderProgress.viewpoint === (m.viewpoint || null) ? renderProgress.frameDone : undefined,
|
|
9646
|
+
frameTotal: typeof m.frameTotal === 'number' ? m.frameTotal
|
|
9647
|
+
: renderProgress && renderProgress.viewpoint === (m.viewpoint || null) ? renderProgress.frameTotal : undefined,
|
|
9473
9648
|
startedAt: (renderProgress && renderProgress.startedAt) || Date.now(),
|
|
9474
9649
|
};
|
|
9475
9650
|
paintExports(current.approvedAt);
|
|
@@ -9578,6 +9753,7 @@
|
|
|
9578
9753
|
`<div class="e-render-row">` +
|
|
9579
9754
|
`<span class="e-done"><span class="chk">✓</span> ${escapeHtml(row.label)} <span class="t">${escapeHtml(hhmm(row.exportedAt))}</span></span>` +
|
|
9580
9755
|
`<span class="e-links">` +
|
|
9756
|
+
(row.key.startsWith('render-mp4') ? watchButton(row) : '') +
|
|
9581
9757
|
fileActionPair(row.key, row.label) +
|
|
9582
9758
|
`</span>` +
|
|
9583
9759
|
`</div>`).join('');
|
|
@@ -10869,6 +11045,19 @@
|
|
|
10869
11045
|
doExport(exp.dataset.export);
|
|
10870
11046
|
return;
|
|
10871
11047
|
}
|
|
11048
|
+
const watch = e.target.closest('[data-renderwatch]');
|
|
11049
|
+
if (watch && current && window.flolessMediaPlayer) {
|
|
11050
|
+
const q = new URLSearchParams({ project: current.id });
|
|
11051
|
+
if (watch.dataset.renderwatch) q.set('viewpoint', watch.dataset.renderwatch);
|
|
11052
|
+
if (watch.dataset.renderwatchAt) q.set('v', watch.dataset.renderwatchAt); // a re-render is a new URL
|
|
11053
|
+
window.flolessMediaPlayer.open({
|
|
11054
|
+
items: [{ url: `/api/contract/${encodeURIComponent(current.app)}/render-video?${q}`, name: `${watch.dataset.renderwatchLabel || 'Turntable'}.mp4`, kind: 'video' }],
|
|
11055
|
+
sub: 'Turntable of the approved model',
|
|
11056
|
+
loop: true, // a turntable is made to go round
|
|
11057
|
+
unavailable: 'FloLess couldn’t play this turntable — it may have changed since it was rendered. Render it again from this card to make a fresh one.',
|
|
11058
|
+
});
|
|
11059
|
+
return;
|
|
11060
|
+
}
|
|
10872
11061
|
const open = e.target.closest('[data-openfile]');
|
|
10873
11062
|
if (open) { fileAction('/api/open-file', open.dataset.openfile, 'Couldn’t open the file'); return; }
|
|
10874
11063
|
const rev = e.target.closest('[data-reveal]');
|
|
@@ -11928,6 +12117,20 @@
|
|
|
11928
12117
|
return row;
|
|
11929
12118
|
}
|
|
11930
12119
|
|
|
12120
|
+
/**
|
|
12121
|
+
* What a staged `memberRefs` change takes OFF a sheet (#2214). The list is a plain proposal, not an add-only one: a
|
|
12122
|
+
* shorter list from a re-read replaces the whole list, and anything a person placed on the sheet by hand ("Show all
|
|
12123
|
+
* columns here", "Add to this sheet") lives in it. So when ticking the row would remove entries, the row says so in
|
|
12124
|
+
* words and says how to keep them, instead of leaving the loss inside an abbreviated before/after chip.
|
|
12125
|
+
*/
|
|
12126
|
+
function memberRefsRemovalNote(before, after, sheet) {
|
|
12127
|
+
if (!Array.isArray(before) || !Array.isArray(after)) return '';
|
|
12128
|
+
const kept = new Set(after.map(String));
|
|
12129
|
+
const removed = before.filter((id) => !kept.has(String(id))).length;
|
|
12130
|
+
if (!removed) return '';
|
|
12131
|
+
return `This read takes ${removed} ${removed === 1 ? 'member' : 'members'} off ${sheet || 'this sheet'} that ${removed === 1 ? 'was' : 'were'} placed on it. Leave this row unticked to keep ${removed === 1 ? 'it' : 'them'} there.`;
|
|
12132
|
+
}
|
|
12133
|
+
|
|
11931
12134
|
/** Grid sub-values that are ARRAYS OF OBJECTS or MAPS — shown as a count, see `gridDiffRows`. */
|
|
11932
12135
|
const GRID_COUNTED = ['axes', 'lines', 'ends'];
|
|
11933
12136
|
|
|
@@ -12021,7 +12224,13 @@
|
|
|
12021
12224
|
* "Grid" leaves a detailer wondering which one. The fallback keeps an unmapped future field readable
|
|
12022
12225
|
* instead of reintroducing the empty title this dictionary exists to prevent.
|
|
12023
12226
|
*/
|
|
12024
|
-
const ROOT_FIELD = {
|
|
12227
|
+
const ROOT_FIELD = {
|
|
12228
|
+
grid: { badge: 'Grid changed', title: 'Structural grid' },
|
|
12229
|
+
// #2211: where each detail sits on its sheet's picture. A read may only ADD these.
|
|
12230
|
+
detail_bubbles: { badge: 'Anchors added', title: 'Where details sit on the sheet picture' },
|
|
12231
|
+
// #2210: the moment-frame schedule. A read may only ADD frames; a frame a person typed is never touched.
|
|
12232
|
+
moment_frames: { badge: 'Frames added', title: 'Moment frames' },
|
|
12233
|
+
};
|
|
12025
12234
|
// `Object.hasOwn`, NOT `ROOT_FIELD[key] ||`. A plain object inherits `constructor`, `toString`,
|
|
12026
12235
|
// `valueOf` and friends, so the bare lookup returns a truthy inherited value for those keys, the
|
|
12027
12236
|
// fallback never fires, and `rf.badge`/`rf.title` come back `undefined` — an EMPTY badge and an empty
|
|
@@ -12079,8 +12288,82 @@
|
|
|
12079
12288
|
desc.push(conditionalNote);
|
|
12080
12289
|
};
|
|
12081
12290
|
|
|
12291
|
+
/**
|
|
12292
|
+
* MARKS A READ MAY ADD TO A SHEET (#2211): callouts, details and top-of-steel marks. The server puts these in a
|
|
12293
|
+
* `plan-changed` row of their own (never mixed with a cut-level change), and only ever ADDS: what is already on
|
|
12294
|
+
* the sheet, including anything a person drew or corrected by hand, is kept as it is. So the row shows what is
|
|
12295
|
+
* NEW, in the words a detailer uses, instead of a truncated list of JSON.
|
|
12296
|
+
*/
|
|
12297
|
+
const MARK_FIELD_NOUN = {
|
|
12298
|
+
callouts: ['callout', 'callouts'],
|
|
12299
|
+
details: ['detail', 'details'],
|
|
12300
|
+
tos_callouts: ['top-of-steel mark', 'top-of-steel marks'],
|
|
12301
|
+
};
|
|
12302
|
+
const isMarksRow = (p) => !!p && p.kind === 'plan-changed' && Array.isArray(p.fields) && p.fields.length > 0
|
|
12303
|
+
&& p.fields.every((f) => f && Object.hasOwn(MARK_FIELD_NOUN, f.key));
|
|
12304
|
+
const marksBadge = (p) => (p.fields.length === 1 && p.fields[0].key === 'callouts' ? 'Callouts added' : 'Marks added');
|
|
12305
|
+
/** What a mark is called in the list: how it is printed, and where it points. */
|
|
12306
|
+
function markName(key, entry) {
|
|
12307
|
+
if (!entry || typeof entry !== 'object') return '';
|
|
12308
|
+
if (key === 'tos_callouts') {
|
|
12309
|
+
const mm = Number(entry.elevationMm);
|
|
12310
|
+
return `${entry.type || 'TOS'}${Number.isFinite(mm) ? ` at ${reviewElevation(mm)}` : ''}`;
|
|
12311
|
+
}
|
|
12312
|
+
const text = typeof entry.text === 'string' ? entry.text.trim() : '';
|
|
12313
|
+
const sheet = entry.target && typeof entry.target.sheet === 'string' ? entry.target.sheet.trim() : '';
|
|
12314
|
+
return sheet && text && !text.toUpperCase().includes(sheet.toUpperCase()) ? `${text} → ${sheet}` : (text || sheet);
|
|
12315
|
+
}
|
|
12316
|
+
/** "4 new callouts on S-202: 7/S-402 → S-402, A/S-301 → S-301, 3/S-501 → S-501 and 1 more", at most three names. */
|
|
12317
|
+
function markAddedLine(f, label) {
|
|
12318
|
+
const [one, many] = MARK_FIELD_NOUN[f.key];
|
|
12319
|
+
const prior = Array.isArray(f.before) ? f.before.length : 0;
|
|
12320
|
+
const fresh = (Array.isArray(f.after) ? f.after : []).slice(prior);
|
|
12321
|
+
const names = fresh.map((e) => markName(f.key, e)).filter(Boolean);
|
|
12322
|
+
const shown = names.slice(0, 3);
|
|
12323
|
+
const rest = fresh.length - shown.length;
|
|
12324
|
+
const tail = shown.length ? `: ${shown.join(', ')}${rest > 0 ? ` and ${rest} more` : ''}` : '';
|
|
12325
|
+
const line = revEl('div', 'rev-field');
|
|
12326
|
+
line.appendChild(revEl('span', 'rev-field-key', `${fresh.length} new ${fresh.length === 1 ? one : many} on ${label}${tail}`));
|
|
12327
|
+
return line;
|
|
12328
|
+
}
|
|
12329
|
+
/** "2 new frames: grid H (2–3), grid K (5–6)", at most four names. Stored frames come first, so the new ones are the tail. */
|
|
12330
|
+
function framesAddedLine(before, after) {
|
|
12331
|
+
const prior = Array.isArray(before) ? before.length : 0;
|
|
12332
|
+
const fresh = (Array.isArray(after) ? after : []).slice(prior);
|
|
12333
|
+
const names = fresh.map((f) => {
|
|
12334
|
+
if (!f || typeof f !== 'object') return '';
|
|
12335
|
+
const grid = String(f.grid == null ? '' : f.grid).trim();
|
|
12336
|
+
const span = Array.isArray(f.span) && f.span.length === 2 ? ` (${f.span[0]}–${f.span[1]})` : '';
|
|
12337
|
+
return grid ? `grid ${grid}${span}` : '';
|
|
12338
|
+
}).filter(Boolean);
|
|
12339
|
+
const shown = names.slice(0, 4);
|
|
12340
|
+
const rest = fresh.length - shown.length;
|
|
12341
|
+
const line = revEl('div', 'rev-field');
|
|
12342
|
+
line.appendChild(revEl('span', 'rev-field-key', `${fresh.length} new ${fresh.length === 1 ? 'frame' : 'frames'}${shown.length ? `: ${shown.join(', ')}${rest > 0 ? ` and ${rest} more` : ''}` : ''}`));
|
|
12343
|
+
return line;
|
|
12344
|
+
}
|
|
12345
|
+
/** The detail anchors a read adds, counted per sheet: "3 new detail anchors on S-402, S-501". */
|
|
12346
|
+
function bubbleAddedLine(before, after) {
|
|
12347
|
+
const had = before && typeof before === 'object' ? before : {};
|
|
12348
|
+
const perSheet = [];
|
|
12349
|
+
let total = 0;
|
|
12350
|
+
for (const sheet of Object.keys(after && typeof after === 'object' ? after : {})) {
|
|
12351
|
+
const nums = after[sheet] && typeof after[sheet] === 'object' ? Object.keys(after[sheet]) : [];
|
|
12352
|
+
const known = had[sheet] && typeof had[sheet] === 'object' ? had[sheet] : {};
|
|
12353
|
+
const added = nums.filter((n) => !Object.hasOwn(known, n)).length;
|
|
12354
|
+
if (added > 0) { perSheet.push(sheet); total += added; }
|
|
12355
|
+
}
|
|
12356
|
+
const shown = perSheet.slice(0, 3);
|
|
12357
|
+
const rest = perSheet.length - shown.length;
|
|
12358
|
+
const line = revEl('div', 'rev-field');
|
|
12359
|
+
line.appendChild(revEl('span', 'rev-field-key', `${total} new detail ${total === 1 ? 'anchor' : 'anchors'} on ${shown.join(', ')}${rest > 0 ? ` and ${rest} more` : ''}`));
|
|
12360
|
+
return line;
|
|
12361
|
+
}
|
|
12362
|
+
|
|
12082
12363
|
function proposalRow(p, idx, bucket) {
|
|
12083
|
-
|
|
12364
|
+
// A read that only ADDS (marks on a sheet, detail anchors, moment frames) reads as an addition, not as a change.
|
|
12365
|
+
const addsOnly = isMarksRow(p) || (p.kind === 'model-changed' && (p.key === 'detail_bubbles' || p.key === 'moment_frames'));
|
|
12366
|
+
const row = revEl('div', 'rev-row ' + (addsOnly ? 'k-added' : (KIND_CLASS[p.kind] || 'k-changed')));
|
|
12084
12367
|
const id = `rev-${bucket}-${idx}`;
|
|
12085
12368
|
const label = revEl('label', 'rev-check');
|
|
12086
12369
|
const box = document.createElement('input');
|
|
@@ -12103,7 +12386,7 @@
|
|
|
12103
12386
|
// the most consequential row in the modal. Named from the field instead, exactly as every other row
|
|
12104
12387
|
// is named from its subject.
|
|
12105
12388
|
const rf = p.kind === 'model-changed' ? rootField(p.key) : null;
|
|
12106
|
-
head.appendChild(revEl('span', 'rev-kind-badge', rf ? rf.badge : (KIND_LABEL[p.kind] || p.kind)));
|
|
12389
|
+
head.appendChild(revEl('span', 'rev-kind-badge', rf ? rf.badge : (isMarksRow(p) ? marksBadge(p) : (KIND_LABEL[p.kind] || p.kind))));
|
|
12107
12390
|
// A plan proposal is titled by `viewLabel`, which the SERVER computes with `planViewLabels` (#938).
|
|
12108
12391
|
// The rule needs sibling context — a page's name is enough when it carries one view and must be
|
|
12109
12392
|
// disambiguated when it carries several — which a single proposal row does not have, so re-deriving
|
|
@@ -12122,7 +12405,14 @@
|
|
|
12122
12405
|
// across all four kinds, and deliberately left to one follow-up rather than patched asymmetrically
|
|
12123
12406
|
// here.)
|
|
12124
12407
|
const desc = [];
|
|
12125
|
-
if (p
|
|
12408
|
+
if (isMarksRow(p)) {
|
|
12409
|
+
// MARKS ONLY ADD (#2211). Said first and plainly, because the row looks like any other change and a person
|
|
12410
|
+
// deciding quickly should know that ticking it cannot remove or overwrite anything they drew by hand.
|
|
12411
|
+
const fields = revEl('div', 'rev-fields');
|
|
12412
|
+
for (const f of p.fields) fields.appendChild(markAddedLine(f, p.viewLabel || p.sheet || p.viewId || 'this sheet'));
|
|
12413
|
+
desc.push(fields);
|
|
12414
|
+
desc.push(revEl('div', 'rev-row-note', 'Accepting only adds these. Callouts already in the model, including any you added or corrected by hand, stay as they are.'));
|
|
12415
|
+
} else if (p.kind === 'member-changed' || p.kind === 'plan-changed') {
|
|
12126
12416
|
const fields = revEl('div', 'rev-fields');
|
|
12127
12417
|
const notes = [];
|
|
12128
12418
|
let answeredEnds = 0, otherFields = 0;
|
|
@@ -12136,6 +12426,10 @@
|
|
|
12136
12426
|
} else {
|
|
12137
12427
|
fields.appendChild(fieldLine(f.key, f.before, f.after));
|
|
12138
12428
|
otherFields += 1;
|
|
12429
|
+
if (p.kind === 'plan-changed' && f.key === 'memberRefs') {
|
|
12430
|
+
const gone = memberRefsRemovalNote(f.before, f.after, p.viewLabel || p.sheet || p.viewId);
|
|
12431
|
+
if (gone) notes.push(revEl('div', 'rev-row-note', gone));
|
|
12432
|
+
}
|
|
12139
12433
|
}
|
|
12140
12434
|
}
|
|
12141
12435
|
desc.push(fields);
|
|
@@ -12166,6 +12460,18 @@
|
|
|
12166
12460
|
const fields = revEl('div', 'rev-fields');
|
|
12167
12461
|
for (const row of gridDiffRows(obj(p.before) ? p.before : {}, p.after)) fields.appendChild(row);
|
|
12168
12462
|
desc.push(fields);
|
|
12463
|
+
} else if (p.key === 'detail_bubbles') {
|
|
12464
|
+
// #2211: anchors only ever ADD, so show what is new rather than a truncated map.
|
|
12465
|
+
const f = revEl('div', 'rev-fields');
|
|
12466
|
+
f.appendChild(bubbleAddedLine(p.before, p.after));
|
|
12467
|
+
desc.push(f);
|
|
12468
|
+
desc.push(revEl('div', 'rev-row-note', 'These only help find a detail on the picture. Nothing changes on your plans.'));
|
|
12469
|
+
} else if (p.key === 'moment_frames') {
|
|
12470
|
+
// #2210: frames only ever ADD, so show which are new rather than a truncated list.
|
|
12471
|
+
const f = revEl('div', 'rev-fields');
|
|
12472
|
+
f.appendChild(framesAddedLine(p.before, p.after));
|
|
12473
|
+
desc.push(f);
|
|
12474
|
+
desc.push(revEl('div', 'rev-row-note', 'Accepting only adds these; nothing you entered by hand is removed.'));
|
|
12169
12475
|
} else {
|
|
12170
12476
|
// An unmapped root field, or a grid arriving where an object was not — the same single line
|
|
12171
12477
|
// `plan-changed` would draw. Degrades to less detail, never to nothing.
|
|
@@ -12459,14 +12765,21 @@
|
|
|
12459
12765
|
|
|
12460
12766
|
const props = summary.proposals || [];
|
|
12461
12767
|
const binds = summary.bindingProposals || [];
|
|
12462
|
-
const
|
|
12768
|
+
const allIssues = summary.issues || [];
|
|
12769
|
+
// Marks the read found but could not add (#2211) are not REFUSALS by the model rules: they are entries the
|
|
12770
|
+
// server left out (malformed, different from what a person already has, or past the cap), each already
|
|
12771
|
+
// worded for a detailer. They get their own list so "refused" keeps meaning refused.
|
|
12772
|
+
const leftOut = allIssues.filter((it) => /^mark-/.test(String(it && it.code)));
|
|
12773
|
+
const issues = allIssues.filter((it) => !/^mark-/.test(String(it && it.code)));
|
|
12463
12774
|
const body = document.createDocumentFragment();
|
|
12464
12775
|
|
|
12465
12776
|
if (!props.length && !binds.length) {
|
|
12466
12777
|
// No disabled control standing in for an empty state — the group simply is not rendered.
|
|
12467
12778
|
body.appendChild(revEl('div', 'hd-empty', issues.length
|
|
12468
12779
|
? 'Nothing needs your decision — every change this read proposed is listed below as refused.'
|
|
12469
|
-
:
|
|
12780
|
+
: leftOut.length
|
|
12781
|
+
? 'Nothing needs your decision. What this read found is listed below with what was left out and why.'
|
|
12782
|
+
: 'This read found no changes to make — the revised set matches what is already in the model.'));
|
|
12470
12783
|
}
|
|
12471
12784
|
if (props.length) {
|
|
12472
12785
|
const g = group(readOnly ? 'Changes this read proposed' : 'Needs your decision', props.length, 'proposals');
|
|
@@ -12478,12 +12791,26 @@
|
|
|
12478
12791
|
binds.forEach((b, i) => g.appendChild(bindingRow(b, i)));
|
|
12479
12792
|
body.appendChild(g);
|
|
12480
12793
|
}
|
|
12794
|
+
if (leftOut.length) {
|
|
12795
|
+
const det = document.createElement('details');
|
|
12796
|
+
det.className = 'ws-archived rev-issues rev-left-out';
|
|
12797
|
+
if (!props.length && !binds.length && !issues.length) det.open = true;
|
|
12798
|
+
const sum = document.createElement('summary');
|
|
12799
|
+
sum.className = 'ws-archived-summary';
|
|
12800
|
+
sum.appendChild(revEl('span', 'ws-archived-caret', '›'));
|
|
12801
|
+
sum.appendChild(document.createTextNode('Left out of this read '));
|
|
12802
|
+
sum.appendChild(revEl('span', 'ws-archived-count', String(leftOut.length)));
|
|
12803
|
+
det.appendChild(sum);
|
|
12804
|
+
// The message is the whole sentence; the path is a developer address, so it stays out of sight here.
|
|
12805
|
+
for (const it of leftOut) det.appendChild(revEl('div', 'rev-issue', it.message || 'left out'));
|
|
12806
|
+
body.appendChild(det);
|
|
12807
|
+
}
|
|
12481
12808
|
if (issues.length) {
|
|
12482
12809
|
// Collapsed by default with the count in the summary, so it is visible without competing —
|
|
12483
12810
|
// unless it is the only content, in which case there is nothing for it to compete with.
|
|
12484
12811
|
const det = document.createElement('details');
|
|
12485
12812
|
det.className = 'ws-archived rev-issues';
|
|
12486
|
-
if (!props.length && !binds.length) det.open = true;
|
|
12813
|
+
if (!props.length && !binds.length && !leftOut.length) det.open = true;
|
|
12487
12814
|
const sum = document.createElement('summary');
|
|
12488
12815
|
sum.className = 'ws-archived-summary';
|
|
12489
12816
|
sum.appendChild(revEl('span', 'ws-archived-caret', '›'));
|
|
@@ -13331,6 +13658,61 @@
|
|
|
13331
13658
|
return '<div class="hist-change-note" role="note"><strong>Model readiness unavailable.</strong> FloLess could not prove the model is ready for host send from the admitted History evidence.</div>';
|
|
13332
13659
|
}
|
|
13333
13660
|
|
|
13661
|
+
let revisionNoteEditorGeneration = 0;
|
|
13662
|
+
function revisionNoteHtml(row) {
|
|
13663
|
+
if (!row.canAnnotate || !row.rowKey) return '';
|
|
13664
|
+
const note = row.revisionNote;
|
|
13665
|
+
const pending = current && pendingRevisionNote(current, row.n);
|
|
13666
|
+
const text = note?.text || '';
|
|
13667
|
+
return (text ? `<div class="hist-revision-note"><strong>Revision note</strong><br>${escapeHtml(text)}</div>` : '')
|
|
13668
|
+
+ (note ? `<div class="hist-revision-note-meta">Editable annotation · edited ${escapeHtml(histWhen(note.updatedAt))}${note.claimedChannel === 'terminal' ? ' · terminal-written' : ''}</div>` : '')
|
|
13669
|
+
+ `<div class="hist-note-actions"><button type="button" class="btn-mini" data-revision-note="${row.n}" data-command-id="shell.revision-note-edit#v${escapeAttr(String(row.n))}">${text ? 'Edit note' : 'Add note'}</button>`
|
|
13670
|
+
+ (pending?.n === row.n && pending.rowKey === row.rowKey ? `<button type="button" class="btn-mini" data-revision-note-retry="${row.n}" data-command-id="shell.revision-note-retry#v${escapeAttr(String(row.n))}">Save kept note</button><button type="button" class="btn-mini" data-revision-note-discard="${row.n}" data-command-id="shell.revision-note-discard#v${escapeAttr(String(row.n))}">Discard kept note</button>` : '') + '</div>';
|
|
13671
|
+
}
|
|
13672
|
+
async function editRevisionNote(n, kept = false) {
|
|
13673
|
+
const project = current, row = versions.find(row => row.n === n);
|
|
13674
|
+
if (!project?.uuid || !row?.canAnnotate || !row.rowKey) return;
|
|
13675
|
+
const identity = { projectId: project.id, projectUuid: project.uuid, n, rowKey: row.rowKey };
|
|
13676
|
+
const generation = ++revisionNoteEditorGeneration;
|
|
13677
|
+
const pending = pendingRevisionNote(project, n);
|
|
13678
|
+
let draft = kept && pending?.n === n && pending.rowKey === row.rowKey ? pending.text : row.revisionNote?.text || '';
|
|
13679
|
+
let expectedRevision = kept && pending?.n === n ? pending.expectedRevision : row.revisionNote?.revision || 0;
|
|
13680
|
+
let notice = 'Editable annotation; not part of the approval record. Leave blank to clear the note.';
|
|
13681
|
+
while (current?.uuid === identity.projectUuid && generation === revisionNoteEditorGeneration) {
|
|
13682
|
+
const result = await bridge.formModal({ title: `Revision note · v${n}`, sub: 'Describe what changed and why. Approved model content stays unchanged.',
|
|
13683
|
+
fields: [{ name: 'note', label: 'Revision note', multiline: true, value: draft, commandId: 'shell.revision-note-text' }],
|
|
13684
|
+
footnote: notice, okLabel: 'Save note', okCommandId: 'shell.revision-note-save', okCommandInstanceLabel: `version ${n}`, focusInputName: 'note' });
|
|
13685
|
+
if (!result) return;
|
|
13686
|
+
draft = result.note || '';
|
|
13687
|
+
if (draft.trim().length > 2000) { notice = 'Keep the note within 2000 characters. Your full text is still here.'; continue; }
|
|
13688
|
+
// Retain the latest submitted intent before transport. A late failure from an older
|
|
13689
|
+
// request must never replace a newer editor's durable draft.
|
|
13690
|
+
const submitted = { ...identity, text: draft, expectedRevision, writeId: crypto.randomUUID() };
|
|
13691
|
+
rememberPendingRevisionNote(project, submitted);
|
|
13692
|
+
try {
|
|
13693
|
+
await api(`/api/projects/${encodeURIComponent(identity.projectId)}/versions/${n}/note`, { method: 'PUT', body: JSON.stringify({
|
|
13694
|
+
text: draft, expectedRevision, expectedProjectUuid: identity.projectUuid, expectedRowKey: identity.rowKey, claimedChannel: 'browser',
|
|
13695
|
+
}) });
|
|
13696
|
+
clearConfirmedRevisionNoteDraft(project, submitted);
|
|
13697
|
+
if (current?.uuid === identity.projectUuid && generation === revisionNoteEditorGeneration) { showToast('Revision note saved.', 'ok'); await renderHistory(); }
|
|
13698
|
+
return;
|
|
13699
|
+
} catch (error) {
|
|
13700
|
+
// Its submitted draft already survives navigation; only the current editor may reopen.
|
|
13701
|
+
if (current?.uuid !== identity.projectUuid || generation !== revisionNoteEditorGeneration) return;
|
|
13702
|
+
const latest = error?.body?.revisionNote;
|
|
13703
|
+
if (error?.body?.code === 'note-conflict') {
|
|
13704
|
+
expectedRevision = latest?.revision || 0;
|
|
13705
|
+
notice = `The saved note changed. Review the current text below; Save note explicitly replaces it with your text. Current saved note: ${latest?.text || '(blank)'}`;
|
|
13706
|
+
} else if (error?.body?.code === 'revision-note-row-changed' || error?.body?.code === 'project-moved') {
|
|
13707
|
+
showToast('This project or revision changed. Your note is kept; reopen History before saving.', 'warn'); return;
|
|
13708
|
+
} else notice = 'The note could not be saved. Your text is still here; try again or copy it before closing.';
|
|
13709
|
+
}
|
|
13710
|
+
}
|
|
13711
|
+
}
|
|
13712
|
+
window.addEventListener('floless:revision-note-changed', (event) => {
|
|
13713
|
+
if (current?.uuid === event.detail?.projectUuid && !$wsHistory.hidden) renderHistory();
|
|
13714
|
+
});
|
|
13715
|
+
|
|
13334
13716
|
function versionRowHtml(v) {
|
|
13335
13717
|
// Rolling back to the version you're already on is a no-op — omit the button (blank cell), never disable it.
|
|
13336
13718
|
const action = v.current || v.canStartApprovedRevision !== true
|
|
@@ -13352,7 +13734,7 @@
|
|
|
13352
13734
|
`<td class="htime">${escapeHtml(histWhen(v.ts))}</td>` +
|
|
13353
13735
|
`<td><span class="hby">${avatarFor(v.author)}${escapeHtml(v.author)}</span></td>` +
|
|
13354
13736
|
`<td>${gateBadge(v.gate, v.kind, v.n, typeof v.acceptedImportFindingsNote === 'string' ? v.acceptedImportFindingsNote : '')}</td>` +
|
|
13355
|
-
`<td class="change">${changeCellHtml(v, meta)}${diffStatus}</td>` +
|
|
13737
|
+
`<td class="change">${revisionNoteHtml(v)}${changeCellHtml(v, meta)}${diffStatus}</td>` +
|
|
13356
13738
|
`<td>${action}</td></tr>`;
|
|
13357
13739
|
// The disclosure row is always emitted (hidden) so toggling is a pure show/hide + lazy fetch.
|
|
13358
13740
|
const diffRow = meta.canDiff
|
|
@@ -13428,6 +13810,7 @@
|
|
|
13428
13810
|
try {
|
|
13429
13811
|
const r = await api(`/api/projects/${encodeURIComponent(id)}/versions`);
|
|
13430
13812
|
strictHistoryUnavailable = r.historyAvailable === false;
|
|
13813
|
+
if (r.revisionNotesUnavailable) showToast('Revision notes are unavailable. Approved history is unchanged.', 'warn');
|
|
13431
13814
|
rows = Array.isArray(r.versions) ? r.versions : [];
|
|
13432
13815
|
// Absent on an older server → fall back to the descriptor, which is the pre-change behaviour.
|
|
13433
13816
|
nextDiffSupported = typeof r.diffSupported === 'boolean' ? r.diffSupported : !!(wsApp() && wsApp().diff);
|
|
@@ -13540,7 +13923,7 @@
|
|
|
13540
13923
|
: '';
|
|
13541
13924
|
$wsHistory.innerHTML =
|
|
13542
13925
|
HIST_HEAD +
|
|
13543
|
-
'<div class="hist-note"><b>Approved versions</b> are immutable. Starting from an older version creates a new working revision; it never rewrites history.</div>' +
|
|
13926
|
+
'<div class="hist-note"><b>Approved versions</b> are immutable. Revision notes are editable annotations; they do not change approved content. Starting from an older version creates a new working revision; it never rewrites history.</div>' +
|
|
13544
13927
|
working +
|
|
13545
13928
|
// Version/Gate/action are fixed-narrow; When/By auto-size to their nowrap content (fixing them
|
|
13546
13929
|
// wider than the content wastes room and needlessly wraps Change). Change flexes to the rest.
|
|
@@ -14144,6 +14527,12 @@
|
|
|
14144
14527
|
}
|
|
14145
14528
|
|
|
14146
14529
|
$wsHistory.addEventListener('click', (e) => {
|
|
14530
|
+
const note = e.target.closest('[data-revision-note]');
|
|
14531
|
+
if (note) { editRevisionNote(Number(note.dataset.revisionNote)); return; }
|
|
14532
|
+
const retryNote = e.target.closest('[data-revision-note-retry]');
|
|
14533
|
+
if (retryNote) { editRevisionNote(Number(retryNote.dataset.revisionNoteRetry), true); return; }
|
|
14534
|
+
const discardNote = e.target.closest('[data-revision-note-discard]');
|
|
14535
|
+
if (discardNote && current) { rememberPendingRevisionNote(current, null, Number(discardNote.dataset.revisionNoteDiscard)); renderHistory(); return; }
|
|
14147
14536
|
// The no-model empty state's real next step: go read a drawing. Same handler shape as the
|
|
14148
14537
|
// Approve it replaces, so the pane keeps owning its own inline actions.
|
|
14149
14538
|
if (e.target.closest('#hist-go-drawings')) { chooseStep('drawings'); return; }
|
|
@@ -14882,10 +15271,37 @@
|
|
|
14882
15271
|
}
|
|
14883
15272
|
}
|
|
14884
15273
|
|
|
15274
|
+
/** Open the home list when a Page’s unreadable record cannot open its viewer. */
|
|
15275
|
+
async function openPagesHome(home, pageId, beforeFocus) {
|
|
15276
|
+
await setMode('workspaces');
|
|
15277
|
+
if (mode !== 'workspaces') return false;
|
|
15278
|
+
if (home === 'ws') {
|
|
15279
|
+
await leaveProjectToList(null);
|
|
15280
|
+
if (current) return false;
|
|
15281
|
+
// applyMode starts landing loads without awaiting them. Finish the latest load before
|
|
15282
|
+
// focusing a Page, so its later landing repaint cannot remove the focused control.
|
|
15283
|
+
await loadProjects({ quiet: true });
|
|
15284
|
+
if (mode !== 'workspaces' || current) return false;
|
|
15285
|
+
} else if (typeof home === 'string' && home.startsWith('p-')) {
|
|
15286
|
+
const projectId = home.slice(2);
|
|
15287
|
+
const opened = await openProject(projectId, 'pages');
|
|
15288
|
+
if (opened === STAYED_IN_PROJECT || current?.id !== projectId) return false;
|
|
15289
|
+
} else return false;
|
|
15290
|
+
if (mode !== 'workspaces') return false;
|
|
15291
|
+
const container = document.getElementById(home === 'ws' ? 'ws-landing-pages' : 'ws-pages');
|
|
15292
|
+
if (!container || !window.flolessPages) return false;
|
|
15293
|
+
await window.flolessPages.renderList(container, home, { hideWhenEmpty: home === 'ws', label: home === 'ws' ? 'Workspace Pages' : 'Pages in this project' });
|
|
15294
|
+
if (mode !== 'workspaces' || !container.isConnected || (home === 'ws' ? current !== null : current?.id !== home.slice(2))) return false;
|
|
15295
|
+
const carrier = [...container.querySelectorAll('[data-page]')].find((el) => el.dataset.page === pageId);
|
|
15296
|
+
if (carrier && typeof beforeFocus === 'function') beforeFocus();
|
|
15297
|
+
carrier?.focus();
|
|
15298
|
+
return Boolean(carrier);
|
|
15299
|
+
}
|
|
15300
|
+
|
|
14885
15301
|
window.flolessWorkspaces = {
|
|
14886
15302
|
setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
|
|
14887
15303
|
openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, drawingFilterCheckpointSaved,
|
|
14888
|
-
syncWorkspaceReporter, openChatOwner,
|
|
15304
|
+
syncWorkspaceReporter, openChatOwner, openPagesHome,
|
|
14889
15305
|
};
|
|
14890
15306
|
applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
|
|
14891
15307
|
})();
|