@floless/app 0.154.0 → 0.155.1
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 +49502 -37986
- package/dist/schemas/steel.model.v2.schema.json +19 -5
- package/dist/skills/floless-app-onboarding/SKILL.md +22 -13
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +12 -8
- 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 +275 -33
- package/dist/web/aware.js +745 -82
- package/dist/web/chat-question-card.js +477 -0
- package/dist/web/chat.css +177 -12
- package/dist/web/chat.js +1537 -717
- package/dist/web/commands-shell.js +424 -7
- package/dist/web/commands-steel.js +105 -4
- package/dist/web/guide.js +4 -3
- package/dist/web/index.html +96 -7
- package/dist/web/instructor.js +10 -9
- package/dist/web/left-pane.js +40 -3
- 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 +181 -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/workspaces.js +416 -26
- 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');
|
|
@@ -747,6 +750,7 @@
|
|
|
747
750
|
{ key: 'model', label: 'Model' },
|
|
748
751
|
{ key: 'exports', label: 'Exports' },
|
|
749
752
|
{ key: 'history', label: 'History' },
|
|
753
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
750
754
|
],
|
|
751
755
|
diff: true, // steel semantic diff expander
|
|
752
756
|
exports: [
|
|
@@ -797,6 +801,7 @@
|
|
|
797
801
|
{ key: 'model', label: 'Traced' }, // reuse the 'model' frame slot; label "Traced"
|
|
798
802
|
{ key: 'exports', label: 'Exports' },
|
|
799
803
|
{ key: 'history', label: 'History' },
|
|
804
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
800
805
|
],
|
|
801
806
|
diff: false,
|
|
802
807
|
exports: [
|
|
@@ -827,6 +832,7 @@
|
|
|
827
832
|
{ key: 'drawings', label: 'Source' },
|
|
828
833
|
{ key: 'model', label: 'Model' },
|
|
829
834
|
{ key: 'history', label: 'History' },
|
|
835
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
830
836
|
],
|
|
831
837
|
diff: false,
|
|
832
838
|
exports: [],
|
|
@@ -854,6 +860,7 @@
|
|
|
854
860
|
{ key: 'drawings', label: 'Source' },
|
|
855
861
|
{ key: 'model', label: 'Model' },
|
|
856
862
|
{ key: 'history', label: 'History' },
|
|
863
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
857
864
|
],
|
|
858
865
|
diff: false,
|
|
859
866
|
exports: [],
|
|
@@ -917,6 +924,7 @@
|
|
|
917
924
|
{ key: 'knowledge', label: 'Knowledge' }, // the client's standards are knowledge, as for every app
|
|
918
925
|
{ key: 'model', label: 'Checker' },
|
|
919
926
|
{ key: 'history', label: 'History' },
|
|
927
|
+
{ key: 'pages', label: 'Pages' }, // #2262: stored, versioned HTML Pages (every app)
|
|
920
928
|
],
|
|
921
929
|
diff: false,
|
|
922
930
|
exports: [],
|
|
@@ -2441,6 +2449,7 @@
|
|
|
2441
2449
|
tipTruncatedNames();
|
|
2442
2450
|
}
|
|
2443
2451
|
|
|
2452
|
+
let landingPageFocusCommand = null;
|
|
2444
2453
|
function renderLanding() {
|
|
2445
2454
|
syncProjectGroupSearchRoot();
|
|
2446
2455
|
const rootState = window.flolessWorkspaceRoot && window.flolessWorkspaceRoot.current();
|
|
@@ -2538,6 +2547,9 @@
|
|
|
2538
2547
|
+ `</div></div>`;
|
|
2539
2548
|
}
|
|
2540
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>`;
|
|
2541
2553
|
// Archived ("Trash") section — a collapsed disclosure below the live grid, only when non-empty.
|
|
2542
2554
|
// Demoted rows (muted, no thumb) read as "put away"; each offers Restore + a guarded Delete.
|
|
2543
2555
|
if (archived.length) {
|
|
@@ -2572,6 +2584,9 @@
|
|
|
2572
2584
|
// attention was already on the control they had just pressed and the loss was invisible — the
|
|
2573
2585
|
// apps-changed refresh (#389) is the first caller that fires with NO local action.
|
|
2574
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;
|
|
2575
2590
|
const keepScroll = $landing.scrollTop;
|
|
2576
2591
|
const keepArchivedOpen = !!$landing.querySelector('.ws-archived')?.open;
|
|
2577
2592
|
const search = document.activeElement?.id === 'ws-landing-search' ? document.activeElement : null;
|
|
@@ -2589,6 +2604,17 @@
|
|
|
2589
2604
|
if (keepFocus === '#ws-search-clear') $landing.querySelector(keepFocus)?.focus({ focusVisible: true, preventScroll: true });
|
|
2590
2605
|
paintCardThumbs();
|
|
2591
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
|
+
}); }
|
|
2592
2618
|
// The first-run tour link, when the empty state rendered one. app.js owns the copy behaviour so
|
|
2593
2619
|
// both entry points to the tour stay identical; a no-op when the button isn't on screen.
|
|
2594
2620
|
wireAskGuide($landing.querySelector('#ws-onb-tour'));
|
|
@@ -4779,6 +4805,7 @@
|
|
|
4779
4805
|
}
|
|
4780
4806
|
if (!nav.skipLeaveGuard && current && current.id !== p.id && !(await leaveOpenProject(nav.returnFocus))) return STAYED_IN_PROJECT;
|
|
4781
4807
|
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4808
|
+
if (current?.uuid !== p.uuid) revisionNoteEditorGeneration++;
|
|
4782
4809
|
current = p;
|
|
4783
4810
|
// #1890: a new workspace conversation suggests this project's units (the one opened last).
|
|
4784
4811
|
try { localStorage.setItem('floless:last-project', p.id); } catch { /* private mode: no suggestion */ }
|
|
@@ -4814,8 +4841,10 @@
|
|
|
4814
4841
|
configureReadOnlySourceChrome(p);
|
|
4815
4842
|
try {
|
|
4816
4843
|
const session = await fetch('/api/editor/session', { method: 'POST', credentials: 'same-origin' });
|
|
4844
|
+
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4817
4845
|
if (!session.ok) throw new Error(`HTTP ${session.status}`);
|
|
4818
4846
|
} catch (error) {
|
|
4847
|
+
if (navToken !== openNavSeq) return STAYED_IN_PROJECT;
|
|
4819
4848
|
showToast(`Couldn’t start the secure ${isTeklaParserProject(p) ? 'Tekla Parser' : 'Revit'} editor session.`, 'warn');
|
|
4820
4849
|
current = null;
|
|
4821
4850
|
return;
|
|
@@ -4996,10 +5025,13 @@
|
|
|
4996
5025
|
/** What openProject returns when the user chose to stay: callers that open on someone's behalf say so. */
|
|
4997
5026
|
const STAYED_IN_PROJECT = Object.freeze({ stayed: true });
|
|
4998
5027
|
async function leaveProjectToList(returnFocus) {
|
|
5028
|
+
const navToken = ++openNavSeq;
|
|
4999
5029
|
if (!(await leaveOpenProject(returnFocus))) return;
|
|
5030
|
+
if (navToken !== openNavSeq) return;
|
|
5000
5031
|
closeProject();
|
|
5001
5032
|
}
|
|
5002
5033
|
function closeProject() {
|
|
5034
|
+
openNavSeq++;
|
|
5003
5035
|
current = null;
|
|
5004
5036
|
approvalStateGen++;
|
|
5005
5037
|
approvalState = { status: 'unavailable', review: null, pendingCount: 0, headVersion: null, error: '' };
|
|
@@ -5751,6 +5783,7 @@
|
|
|
5751
5783
|
}
|
|
5752
5784
|
|
|
5753
5785
|
function setStep(s) {
|
|
5786
|
+
if (currentStep === 'history' && s !== 'history') revisionNoteEditorGeneration++;
|
|
5754
5787
|
// Keep the tab visually available while the routine open-project check runs, but do not cross
|
|
5755
5788
|
// the model boundary speculatively. The existing request is reused and this destination opens
|
|
5756
5789
|
// automatically if it reports a model; the most recent click wins.
|
|
@@ -5805,6 +5838,21 @@
|
|
|
5805
5838
|
$wsHistory.hidden = !showHistory;
|
|
5806
5839
|
if (showHistory) renderHistory();
|
|
5807
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
|
+
}
|
|
5808
5856
|
// Knowledge is a shell-rendered pane too: the project's Knowledge Base (References column).
|
|
5809
5857
|
const showKnowledge = s === 'knowledge';
|
|
5810
5858
|
$wsKnowledge.hidden = !showKnowledge;
|
|
@@ -5867,6 +5915,7 @@
|
|
|
5867
5915
|
if (!st) return;
|
|
5868
5916
|
const changed = st.phase !== phase;
|
|
5869
5917
|
st.phase = phase;
|
|
5918
|
+
if ($approvalRevisionNote) $approvalRevisionNote.hidden = !['ready', 'failed'].includes(phase);
|
|
5870
5919
|
// Recovery may be dismissed, but it must never unlock a second mutation while the durable
|
|
5871
5920
|
// outcome is pending or unreadable. Dismissibility and mutation safety are separate concerns.
|
|
5872
5921
|
const locked = !approvalDismissible(phase) || ['abandoned', 'recovery-close'].includes(phase);
|
|
@@ -6089,6 +6138,7 @@
|
|
|
6089
6138
|
const st = approvalDialogState;
|
|
6090
6139
|
if (st && !approvalDismissible(st.phase)) return;
|
|
6091
6140
|
approvalDialogState = null;
|
|
6141
|
+
if ($approvalRevisionNoteText) $approvalRevisionNoteText.value = '';
|
|
6092
6142
|
$approvalModal.classList.remove('show');
|
|
6093
6143
|
$approvalModal.removeAttribute('aria-busy');
|
|
6094
6144
|
// The confirm button outlives this review: a reason it was blocked for must not follow it into
|
|
@@ -6106,12 +6156,17 @@
|
|
|
6106
6156
|
|
|
6107
6157
|
const approvalOperationStoragePrefix = 'floless:approval-operation:v1';
|
|
6108
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;
|
|
6109
|
-
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}`;
|
|
6110
6164
|
const approvalDecisionRecord = (value, allowed) => value && typeof value === 'object' && !Array.isArray(value)
|
|
6111
6165
|
&& Object.entries(value).every(([key, decision]) => key.length > 0 && allowed.includes(decision));
|
|
6112
6166
|
function validRememberedApprovalOperation(value, project) {
|
|
6113
6167
|
return !!value && typeof value === 'object' && !Array.isArray(value)
|
|
6114
|
-
&& 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)
|
|
6115
6170
|
&& typeof value.operationId === 'string' && approvalOperationIdPattern.test(value.operationId)
|
|
6116
6171
|
&& typeof value.operationToken === 'string' && approvalOperationIdPattern.test(value.operationToken)
|
|
6117
6172
|
&& value.operationToken !== value.operationId
|
|
@@ -6130,24 +6185,88 @@
|
|
|
6130
6185
|
&& conflictIds.every((id) => Object.hasOwn(value.conflicts, id));
|
|
6131
6186
|
}
|
|
6132
6187
|
function rememberApprovalOperation(project, value) {
|
|
6188
|
+
const key = approvalOperationStorageKey(project);
|
|
6189
|
+
if (value) approvalOperationMemory.set(key, value); else approvalOperationMemory.delete(key);
|
|
6133
6190
|
try {
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
} 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; }
|
|
6138
6194
|
}
|
|
6139
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; }
|
|
6140
6198
|
try {
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
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; }
|
|
6144
6210
|
if (value !== null) localStorage.removeItem(key);
|
|
6211
|
+
approvalOperationMemory.delete(key);
|
|
6145
6212
|
return null;
|
|
6146
6213
|
} catch {
|
|
6147
|
-
|
|
6148
|
-
return null;
|
|
6214
|
+
const memory = approvalOperationMemory.get(key);
|
|
6215
|
+
return validRememberedApprovalOperation(memory, project) ? memory : null;
|
|
6149
6216
|
}
|
|
6150
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
|
+
}
|
|
6151
6270
|
|
|
6152
6271
|
function ensureApprovalOperationPair(state) {
|
|
6153
6272
|
if (approvalOperationIdPattern.test(state.operationId || '')
|
|
@@ -6161,7 +6280,8 @@
|
|
|
6161
6280
|
}
|
|
6162
6281
|
|
|
6163
6282
|
async function finishApprovalSuccess(res, project) {
|
|
6164
|
-
|
|
6283
|
+
const revisionNoteStatus = await finishApprovalRevisionNote(res, project);
|
|
6284
|
+
if ($approvalRevisionNoteText) $approvalRevisionNoteText.value = '';
|
|
6165
6285
|
if (res && res.approvedAt) project.approvedAt = res.approvedAt;
|
|
6166
6286
|
const n = res && res.version && Number(res.version.n);
|
|
6167
6287
|
if (Number.isInteger(n)) expandDiffOnce = { projectId: project.id, n };
|
|
@@ -6185,7 +6305,7 @@
|
|
|
6185
6305
|
: 'No changes remain pending.';
|
|
6186
6306
|
// The footer described the decision ("…will be approved…"); the decision has happened.
|
|
6187
6307
|
$approvalCounts.textContent = '';
|
|
6188
|
-
$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>`;
|
|
6189
6309
|
setApprovalPhase('approved', accepted ? headline : `Approved${Number.isInteger(n) ? ` as v${n}` : ''}`);
|
|
6190
6310
|
$approvalClose.focus();
|
|
6191
6311
|
}
|
|
@@ -6261,6 +6381,7 @@
|
|
|
6261
6381
|
return;
|
|
6262
6382
|
}
|
|
6263
6383
|
const project = current;
|
|
6384
|
+
if (approvalDialogState?.projectId && approvalDialogState.projectId !== project.id && $approvalRevisionNoteText) $approvalRevisionNoteText.value = '';
|
|
6264
6385
|
$approvalModal.classList.add('show');
|
|
6265
6386
|
$approvalImpact.textContent = '';
|
|
6266
6387
|
$approvalCounts.textContent = '';
|
|
@@ -6273,6 +6394,7 @@
|
|
|
6273
6394
|
$approvalDialog.focus();
|
|
6274
6395
|
try {
|
|
6275
6396
|
const remembered = rememberedApprovalOperation(project);
|
|
6397
|
+
if (remembered && $approvalRevisionNoteText) { $approvalRevisionNoteText.value = remembered.revisionNoteText || ''; approvalDialogState.revisionNoteText = $approvalRevisionNoteText.value; }
|
|
6276
6398
|
if (remembered) {
|
|
6277
6399
|
approvalDialogState.operationId = remembered.operationId;
|
|
6278
6400
|
approvalDialogState.operationToken = remembered.operationToken;
|
|
@@ -6395,11 +6517,20 @@
|
|
|
6395
6517
|
const st = approvalDialogState;
|
|
6396
6518
|
if (!st || $approvalConfirm.disabled || !current || current.id !== st.projectId) return;
|
|
6397
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
|
+
}
|
|
6398
6527
|
st.decisions = approvalReviewDecisions(st.review, st.decisions);
|
|
6399
6528
|
const decisionSnapshot = { decisions: { ...st.decisions }, conflicts: { ...st.conflicts } };
|
|
6400
6529
|
const { operationId, operationToken } = ensureApprovalOperationPair(st);
|
|
6401
|
-
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(),
|
|
6402
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');
|
|
6403
6534
|
// #1840: choosing "Approve with N findings accepted" IS the acceptance. It names exactly the
|
|
6404
6535
|
// contract and audit the review served (never a remembered or derived value).
|
|
6405
6536
|
const findings = st.review.importFindings;
|
|
@@ -8811,6 +8942,15 @@
|
|
|
8811
8942
|
* and the lifter brace-matches a declaration. An arrow assigned to a `const` lifts as a fragment
|
|
8812
8943
|
* that does not parse, so the test would fall back to a stub of its own and prove nothing.
|
|
8813
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
|
+
|
|
8814
8954
|
function fileActionPair(kind, instance) {
|
|
8815
8955
|
return fileActionButton('open', { kind, instance }) + fileActionButton('reveal', { kind, instance });
|
|
8816
8956
|
}
|
|
@@ -9476,13 +9616,16 @@
|
|
|
9476
9616
|
/** The busy line: what it is doing now, which of how many, and how long it has been going. */
|
|
9477
9617
|
function renderBusyText() {
|
|
9478
9618
|
if (!renderProgress) return 'Rendering the approved model';
|
|
9479
|
-
const { stage, viewpoint, index, total, startedAt } = renderProgress;
|
|
9619
|
+
const { stage, viewpoint, index, total, startedAt, frameDone, frameTotal } = renderProgress;
|
|
9480
9620
|
const clock = ` · ${elapsedSince(startedAt)}`;
|
|
9481
9621
|
if (stage === 'preparing') return `Preparing the model${clock}`;
|
|
9482
9622
|
if (stage === 'rendering' || stage === 'rendered') {
|
|
9483
9623
|
const which = viewpoint ? viewpointLabel(viewpoint) : '';
|
|
9484
9624
|
const counter = total > 1 ? ` (${index} of ${total})` : '';
|
|
9485
|
-
|
|
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}`;
|
|
9486
9629
|
}
|
|
9487
9630
|
return `Rendering${clock}`;
|
|
9488
9631
|
}
|
|
@@ -9496,6 +9639,12 @@
|
|
|
9496
9639
|
viewpoint: m.viewpoint || null,
|
|
9497
9640
|
index: m.index || 1,
|
|
9498
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,
|
|
9499
9648
|
startedAt: (renderProgress && renderProgress.startedAt) || Date.now(),
|
|
9500
9649
|
};
|
|
9501
9650
|
paintExports(current.approvedAt);
|
|
@@ -9604,6 +9753,7 @@
|
|
|
9604
9753
|
`<div class="e-render-row">` +
|
|
9605
9754
|
`<span class="e-done"><span class="chk">✓</span> ${escapeHtml(row.label)} <span class="t">${escapeHtml(hhmm(row.exportedAt))}</span></span>` +
|
|
9606
9755
|
`<span class="e-links">` +
|
|
9756
|
+
(row.key.startsWith('render-mp4') ? watchButton(row) : '') +
|
|
9607
9757
|
fileActionPair(row.key, row.label) +
|
|
9608
9758
|
`</span>` +
|
|
9609
9759
|
`</div>`).join('');
|
|
@@ -10895,6 +11045,19 @@
|
|
|
10895
11045
|
doExport(exp.dataset.export);
|
|
10896
11046
|
return;
|
|
10897
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
|
+
}
|
|
10898
11061
|
const open = e.target.closest('[data-openfile]');
|
|
10899
11062
|
if (open) { fileAction('/api/open-file', open.dataset.openfile, 'Couldn’t open the file'); return; }
|
|
10900
11063
|
const rev = e.target.closest('[data-reveal]');
|
|
@@ -11954,6 +12117,20 @@
|
|
|
11954
12117
|
return row;
|
|
11955
12118
|
}
|
|
11956
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
|
+
|
|
11957
12134
|
/** Grid sub-values that are ARRAYS OF OBJECTS or MAPS — shown as a count, see `gridDiffRows`. */
|
|
11958
12135
|
const GRID_COUNTED = ['axes', 'lines', 'ends'];
|
|
11959
12136
|
|
|
@@ -12047,7 +12224,13 @@
|
|
|
12047
12224
|
* "Grid" leaves a detailer wondering which one. The fallback keeps an unmapped future field readable
|
|
12048
12225
|
* instead of reintroducing the empty title this dictionary exists to prevent.
|
|
12049
12226
|
*/
|
|
12050
|
-
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
|
+
};
|
|
12051
12234
|
// `Object.hasOwn`, NOT `ROOT_FIELD[key] ||`. A plain object inherits `constructor`, `toString`,
|
|
12052
12235
|
// `valueOf` and friends, so the bare lookup returns a truthy inherited value for those keys, the
|
|
12053
12236
|
// fallback never fires, and `rf.badge`/`rf.title` come back `undefined` — an EMPTY badge and an empty
|
|
@@ -12105,8 +12288,82 @@
|
|
|
12105
12288
|
desc.push(conditionalNote);
|
|
12106
12289
|
};
|
|
12107
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
|
+
|
|
12108
12363
|
function proposalRow(p, idx, bucket) {
|
|
12109
|
-
|
|
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')));
|
|
12110
12367
|
const id = `rev-${bucket}-${idx}`;
|
|
12111
12368
|
const label = revEl('label', 'rev-check');
|
|
12112
12369
|
const box = document.createElement('input');
|
|
@@ -12129,7 +12386,7 @@
|
|
|
12129
12386
|
// the most consequential row in the modal. Named from the field instead, exactly as every other row
|
|
12130
12387
|
// is named from its subject.
|
|
12131
12388
|
const rf = p.kind === 'model-changed' ? rootField(p.key) : null;
|
|
12132
|
-
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))));
|
|
12133
12390
|
// A plan proposal is titled by `viewLabel`, which the SERVER computes with `planViewLabels` (#938).
|
|
12134
12391
|
// The rule needs sibling context — a page's name is enough when it carries one view and must be
|
|
12135
12392
|
// disambiguated when it carries several — which a single proposal row does not have, so re-deriving
|
|
@@ -12148,7 +12405,14 @@
|
|
|
12148
12405
|
// across all four kinds, and deliberately left to one follow-up rather than patched asymmetrically
|
|
12149
12406
|
// here.)
|
|
12150
12407
|
const desc = [];
|
|
12151
|
-
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') {
|
|
12152
12416
|
const fields = revEl('div', 'rev-fields');
|
|
12153
12417
|
const notes = [];
|
|
12154
12418
|
let answeredEnds = 0, otherFields = 0;
|
|
@@ -12162,6 +12426,10 @@
|
|
|
12162
12426
|
} else {
|
|
12163
12427
|
fields.appendChild(fieldLine(f.key, f.before, f.after));
|
|
12164
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
|
+
}
|
|
12165
12433
|
}
|
|
12166
12434
|
}
|
|
12167
12435
|
desc.push(fields);
|
|
@@ -12192,6 +12460,18 @@
|
|
|
12192
12460
|
const fields = revEl('div', 'rev-fields');
|
|
12193
12461
|
for (const row of gridDiffRows(obj(p.before) ? p.before : {}, p.after)) fields.appendChild(row);
|
|
12194
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.'));
|
|
12195
12475
|
} else {
|
|
12196
12476
|
// An unmapped root field, or a grid arriving where an object was not — the same single line
|
|
12197
12477
|
// `plan-changed` would draw. Degrades to less detail, never to nothing.
|
|
@@ -12485,14 +12765,21 @@
|
|
|
12485
12765
|
|
|
12486
12766
|
const props = summary.proposals || [];
|
|
12487
12767
|
const binds = summary.bindingProposals || [];
|
|
12488
|
-
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)));
|
|
12489
12774
|
const body = document.createDocumentFragment();
|
|
12490
12775
|
|
|
12491
12776
|
if (!props.length && !binds.length) {
|
|
12492
12777
|
// No disabled control standing in for an empty state — the group simply is not rendered.
|
|
12493
12778
|
body.appendChild(revEl('div', 'hd-empty', issues.length
|
|
12494
12779
|
? 'Nothing needs your decision — every change this read proposed is listed below as refused.'
|
|
12495
|
-
:
|
|
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.'));
|
|
12496
12783
|
}
|
|
12497
12784
|
if (props.length) {
|
|
12498
12785
|
const g = group(readOnly ? 'Changes this read proposed' : 'Needs your decision', props.length, 'proposals');
|
|
@@ -12504,12 +12791,26 @@
|
|
|
12504
12791
|
binds.forEach((b, i) => g.appendChild(bindingRow(b, i)));
|
|
12505
12792
|
body.appendChild(g);
|
|
12506
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
|
+
}
|
|
12507
12808
|
if (issues.length) {
|
|
12508
12809
|
// Collapsed by default with the count in the summary, so it is visible without competing —
|
|
12509
12810
|
// unless it is the only content, in which case there is nothing for it to compete with.
|
|
12510
12811
|
const det = document.createElement('details');
|
|
12511
12812
|
det.className = 'ws-archived rev-issues';
|
|
12512
|
-
if (!props.length && !binds.length) det.open = true;
|
|
12813
|
+
if (!props.length && !binds.length && !leftOut.length) det.open = true;
|
|
12513
12814
|
const sum = document.createElement('summary');
|
|
12514
12815
|
sum.className = 'ws-archived-summary';
|
|
12515
12816
|
sum.appendChild(revEl('span', 'ws-archived-caret', '›'));
|
|
@@ -13357,6 +13658,61 @@
|
|
|
13357
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>';
|
|
13358
13659
|
}
|
|
13359
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
|
+
|
|
13360
13716
|
function versionRowHtml(v) {
|
|
13361
13717
|
// Rolling back to the version you're already on is a no-op — omit the button (blank cell), never disable it.
|
|
13362
13718
|
const action = v.current || v.canStartApprovedRevision !== true
|
|
@@ -13378,7 +13734,7 @@
|
|
|
13378
13734
|
`<td class="htime">${escapeHtml(histWhen(v.ts))}</td>` +
|
|
13379
13735
|
`<td><span class="hby">${avatarFor(v.author)}${escapeHtml(v.author)}</span></td>` +
|
|
13380
13736
|
`<td>${gateBadge(v.gate, v.kind, v.n, typeof v.acceptedImportFindingsNote === 'string' ? v.acceptedImportFindingsNote : '')}</td>` +
|
|
13381
|
-
`<td class="change">${changeCellHtml(v, meta)}${diffStatus}</td>` +
|
|
13737
|
+
`<td class="change">${revisionNoteHtml(v)}${changeCellHtml(v, meta)}${diffStatus}</td>` +
|
|
13382
13738
|
`<td>${action}</td></tr>`;
|
|
13383
13739
|
// The disclosure row is always emitted (hidden) so toggling is a pure show/hide + lazy fetch.
|
|
13384
13740
|
const diffRow = meta.canDiff
|
|
@@ -13454,6 +13810,7 @@
|
|
|
13454
13810
|
try {
|
|
13455
13811
|
const r = await api(`/api/projects/${encodeURIComponent(id)}/versions`);
|
|
13456
13812
|
strictHistoryUnavailable = r.historyAvailable === false;
|
|
13813
|
+
if (r.revisionNotesUnavailable) showToast('Revision notes are unavailable. Approved history is unchanged.', 'warn');
|
|
13457
13814
|
rows = Array.isArray(r.versions) ? r.versions : [];
|
|
13458
13815
|
// Absent on an older server → fall back to the descriptor, which is the pre-change behaviour.
|
|
13459
13816
|
nextDiffSupported = typeof r.diffSupported === 'boolean' ? r.diffSupported : !!(wsApp() && wsApp().diff);
|
|
@@ -13566,7 +13923,7 @@
|
|
|
13566
13923
|
: '';
|
|
13567
13924
|
$wsHistory.innerHTML =
|
|
13568
13925
|
HIST_HEAD +
|
|
13569
|
-
'<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>' +
|
|
13570
13927
|
working +
|
|
13571
13928
|
// Version/Gate/action are fixed-narrow; When/By auto-size to their nowrap content (fixing them
|
|
13572
13929
|
// wider than the content wastes room and needlessly wraps Change). Change flexes to the rest.
|
|
@@ -14170,6 +14527,12 @@
|
|
|
14170
14527
|
}
|
|
14171
14528
|
|
|
14172
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; }
|
|
14173
14536
|
// The no-model empty state's real next step: go read a drawing. Same handler shape as the
|
|
14174
14537
|
// Approve it replaces, so the pane keeps owning its own inline actions.
|
|
14175
14538
|
if (e.target.closest('#hist-go-drawings')) { chooseStep('drawings'); return; }
|
|
@@ -14908,10 +15271,37 @@
|
|
|
14908
15271
|
}
|
|
14909
15272
|
}
|
|
14910
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
|
+
|
|
14911
15301
|
window.flolessWorkspaces = {
|
|
14912
15302
|
setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind,
|
|
14913
15303
|
openHistory: wsOpenHistory, openKnowledgePage, openKnowledgeStep, drawingFilterCheckpointSaved,
|
|
14914
|
-
syncWorkspaceReporter, openChatOwner,
|
|
15304
|
+
syncWorkspaceReporter, openChatOwner, openPagesHome,
|
|
14915
15305
|
};
|
|
14916
15306
|
applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
|
|
14917
15307
|
})();
|