@floless/app 0.145.0 → 0.147.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 +3908 -2460
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +94 -7
- package/dist/skills/floless-app-vectorize/SKILL.md +25 -2
- package/dist/web/app.css +35 -0
- package/dist/web/aware.js +72 -3
- package/dist/web/chat.js +19 -8
- package/dist/web/commands-filter.js +11 -0
- package/dist/web/commands-revit.js +6 -0
- package/dist/web/commands-shell.js +11 -0
- package/dist/web/commands-tekla-parser.js +6 -0
- package/dist/web/filter-ai-context.js +8 -2
- package/dist/web/index.html +11 -0
- package/dist/web/left-pane.js +4 -1
- package/dist/web/model-chat-questions.js +178 -0
- package/dist/web/model-inspector.js +44 -19
- package/dist/web/revit-editor.css +19 -0
- package/dist/web/revit-editor.js +72 -3
- package/dist/web/steel-editor.html +16 -95
- package/dist/web/steel-filter-core.js +88 -0
- package/dist/web/steel-filter.html +232 -1
- package/dist/web/workspaces.js +37 -5
- package/package.json +1 -1
|
@@ -860,3 +860,91 @@ export function coarseCurveNote(coarse, canIdentify) {
|
|
|
860
860
|
: 'Find the value in the Filters panel instead.';
|
|
861
861
|
return { title, body: `${why} ${next}` };
|
|
862
862
|
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* What the Drawing Filter says, BEFORE Save, about whether the current selection can be read at all
|
|
866
|
+
* (#1780), or null when there is nothing to say.
|
|
867
|
+
*
|
|
868
|
+
* `payload` is the `exclusion-preview` reply for the selection on screen. Every selected line on a
|
|
869
|
+
* sheet the read does not model from (details, notes, schedules) has to be NAMED in the read's proof,
|
|
870
|
+
* and the proof has a byte cap, so a selection that ticks every line weight can be one no read can
|
|
871
|
+
* finish. Before this the person learned that only after Save, when the reader had already done its
|
|
872
|
+
* work and stopped to ask them to switch a weight off. On the real set it happened on, the reader
|
|
873
|
+
* named 0.4 pt, which is exactly the `suggestedOff` the server now computes from the same figures.
|
|
874
|
+
*
|
|
875
|
+
* Two levels, and the copy keeps them apart: `impossible` is a proof that no proof fits; `strained`
|
|
876
|
+
* only says the fit depends on the reader finding enough savings, which on that set it did not. So
|
|
877
|
+
* one says "is", the other "may be". Neither refuses anything: Save stays the person's call.
|
|
878
|
+
*
|
|
879
|
+
* `labelOf(dim, value)` renders a value exactly as its facet row does, so the notice and the checkbox
|
|
880
|
+
* it points at name the same thing the same way.
|
|
881
|
+
*
|
|
882
|
+
* Pure, so the wording, both levels and both suggestion shapes are table-tested without a page.
|
|
883
|
+
*/
|
|
884
|
+
/**
|
|
885
|
+
* Whether a failed size check may be dropped SILENTLY (#1780). Only when there is no longer anything
|
|
886
|
+
* to check: the request is gone (404) or no longer waiting for a Filter save. Every other failure — a
|
|
887
|
+
* server error, a network drop, an unreadable reply, a scan the server cannot fold — leaves the
|
|
888
|
+
* question unanswered, and hiding the notice then reads as "this selection fits", which is the exact
|
|
889
|
+
* false negative the notice exists to prevent. Those show `SIZE_CHECK_FAILED_NOTICE` instead.
|
|
890
|
+
*/
|
|
891
|
+
export function sizeCheckFailureIsQuiet(status, code) {
|
|
892
|
+
return status === 404 || code === 'steel-preview-not-pending';
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/** What the Filter says when it could not find out whether the selection fits (see above). */
|
|
896
|
+
export const SIZE_CHECK_FAILED_NOTICE = Object.freeze({
|
|
897
|
+
level: 'unknown',
|
|
898
|
+
title: 'Couldn’t check whether this selection can be read',
|
|
899
|
+
lead: 'FloLess couldn’t work out how large this read’s proof would be. You can still save; if the selection is too large, the read will stop and ask you to switch a line weight off.',
|
|
900
|
+
suggestion: null,
|
|
901
|
+
alternatives: Object.freeze([]),
|
|
902
|
+
alternativesIntro: '',
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
export function proofSizeNotice(payload, labelOf) {
|
|
906
|
+
const budget = payload && payload.proofBudget;
|
|
907
|
+
if (!budget || typeof budget !== 'object') return null;
|
|
908
|
+
const impossible = budget.impossible === true;
|
|
909
|
+
if (!impossible && budget.strained !== true) return null;
|
|
910
|
+
const level = impossible ? 'impossible' : 'strained';
|
|
911
|
+
const count = (n) => (Number.isFinite(n) ? n : 0).toLocaleString('en-US');
|
|
912
|
+
const forced = payload.forcedRows && Number.isFinite(payload.forcedRows.total) ? payload.forcedRows.total : null;
|
|
913
|
+
const capMb = Number.isFinite(budget.capBytes) ? Math.round(budget.capBytes / (1024 * 1024)) : 8;
|
|
914
|
+
const title = impossible ? 'This selection is too large to read' : 'This selection may be too large to read';
|
|
915
|
+
const lead = `Every selected line on a sheet the read doesn’t model from (details, notes, schedules) has to be named in its proof, and a proof can hold ${capMb} MB.`
|
|
916
|
+
+ (forced === null ? '' : ` This selection puts ${count(forced)} ${forced === 1 ? 'line' : 'lines'} there.`);
|
|
917
|
+
const relief = Array.isArray(payload.proofRelief) ? payload.proofRelief.filter((row) => row && typeof row === 'object'
|
|
918
|
+
&& typeof row.dim === 'string' && Number.isFinite(row.forcedLines) && Number.isFinite(row.modelableLines)) : [];
|
|
919
|
+
const named = (row) => ({ dim: row.dim, value: row.value, label: labelOf(row.dim, row.value), forcedLines: row.forcedLines, modelableLines: row.modelableLines });
|
|
920
|
+
const cost = (row) => (row.modelableLines > 0
|
|
921
|
+
? ` It also takes ${count(row.modelableLines)} ${row.modelableLines === 1 ? 'line' : 'lines'} of ${row.label} off the sheets the read models from, so check none of them are steel.`
|
|
922
|
+
: ' No lines on the sheets the read models from use it.');
|
|
923
|
+
const pick = payload.suggestedOff && typeof payload.suggestedOff === 'object'
|
|
924
|
+
? relief.find((row) => row.dim === payload.suggestedOff.dim && row.value === payload.suggestedOff.value) : undefined;
|
|
925
|
+
if (pick) {
|
|
926
|
+
const row = named(pick);
|
|
927
|
+
return {
|
|
928
|
+
level, title, lead,
|
|
929
|
+
suggestion: { ...row, text: `Switching off ${row.label} takes out ${count(row.forcedLines)} of them.${cost(row)}`, action: `Switch off ${row.label}` },
|
|
930
|
+
alternatives: [], alternativesIntro: '',
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
// No single value is enough on its own: offer the ones carrying the most lines there, each as its
|
|
934
|
+
// own action. Never one button for all of them: which values to give up is the person's decision.
|
|
935
|
+
const alternatives = relief.filter((row) => row.forcedLines > 0)
|
|
936
|
+
.sort((a, b) => b.forcedLines - a.forcedLines || a.modelableLines - b.modelableLines)
|
|
937
|
+
.slice(0, 3)
|
|
938
|
+
.map((row) => {
|
|
939
|
+
const r = named(row);
|
|
940
|
+
return { ...r, text: `${r.label}: ${count(r.forcedLines)} there, ${count(r.modelableLines)} on sheets the read models from`, action: `Switch off ${r.label}` };
|
|
941
|
+
});
|
|
942
|
+
return {
|
|
943
|
+
level, title, lead,
|
|
944
|
+
suggestion: null,
|
|
945
|
+
alternatives,
|
|
946
|
+
alternativesIntro: alternatives.length
|
|
947
|
+
? 'No single value is enough on its own. These carry the most lines there:'
|
|
948
|
+
: 'No single value the Filter can switch off is enough. Narrow the selection further before saving.',
|
|
949
|
+
};
|
|
950
|
+
}
|
|
@@ -209,6 +209,21 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
|
|
|
209
209
|
.signoff-notice[hidden]{display:none}
|
|
210
210
|
.signoff-notice b{display:block;color:var(--warn);margin-bottom:2px}
|
|
211
211
|
.signoff-notice p{margin:0;color:var(--text)}
|
|
212
|
+
/* #1780: the same amber rail, reused in the Filters panel to say BEFORE Save that the selection may be
|
|
213
|
+
too large for the read's proof. The panel's own 18px flex gap spaces it, so its bottom margin goes.
|
|
214
|
+
"Impossible" is a proven failure, not a risk, so it takes the page's existing --err on the same
|
|
215
|
+
shape; "strained" keeps --warn. No new colour either way. (The class keeps its `signoff` name: one
|
|
216
|
+
extra consumer does not earn a rename.) */
|
|
217
|
+
#filterSizeNotice{margin:0}
|
|
218
|
+
#filterSizeNotice p + p{margin-top:6px}
|
|
219
|
+
#filterSizeNotice.is-impossible{border-left-color:var(--err)}
|
|
220
|
+
#filterSizeNotice.is-impossible b{color:var(--err)}
|
|
221
|
+
#filterSizeNotice .size-suggest-action{margin-top:8px;font-size:12px;padding:4px 10px}
|
|
222
|
+
#filterSizeNotice ul{list-style:none;margin:6px 0 0;padding:0;display:grid;gap:6px}
|
|
223
|
+
#filterSizeNotice li{display:flex;align-items:center;gap:8px;justify-content:space-between;color:var(--text)}
|
|
224
|
+
#filterSizeNotice li span{min-width:0}
|
|
225
|
+
#filterSizeNotice .acts button{flex:none}
|
|
226
|
+
#filterSizeNotice .size-checking{color:var(--mut)}
|
|
212
227
|
/* The magnitude. It sits ABOVE the list deliberately: the two sentences explain what a wholesale
|
|
213
228
|
dismissal IS, and then this says how big it is — which is the decision. `<b>` for the number is
|
|
214
229
|
the same bold-figure-in-a-muted-sentence idiom #count and .stat already use, so no new treatment.
|
|
@@ -679,6 +694,9 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
679
694
|
<p class="scope" id="filterScope"></p>
|
|
680
695
|
<p id="filterCanvasRule"></p>
|
|
681
696
|
</section>
|
|
697
|
+
<!-- #1780: whether the selection on screen can be read at all, checked by the server BEFORE Save.
|
|
698
|
+
Hidden while there is nothing to say or the check cannot run. A callout, not a titled section. -->
|
|
699
|
+
<div id="filterSizeNotice" class="signoff-notice" role="status" aria-live="polite" aria-atomic="true" hidden></div>
|
|
682
700
|
<section id="modes">
|
|
683
701
|
<h2>Match on</h2>
|
|
684
702
|
<!-- The id sits on the INPUT, not on the wrapping <label>. Instructor's `activate()` (the `?`
|
|
@@ -870,7 +888,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
870
888
|
<script>window.OverlayEscape.mount({ idle: function () { var o = document.getElementById('signoffOverlay'); return !o || o.hidden; } });</script>
|
|
871
889
|
|
|
872
890
|
<script type="module">
|
|
873
|
-
import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, eyedropperHas, eyedropperRemove, countShown, liveOverlayElements, bgRect, textBox, textDraw, textString, applySelToFilter, hasUnsupportedSingleSheetFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, dismissibleFacetValues, switchOffBlockers, FACET_DIMS, FACET_DIM_BY_CONTROL, MODE_ORDER, facetKey, facetRowIndicesFor, NOTE_TEXT, coarseCurveNote } from './steel-filter-core.js';
|
|
891
|
+
import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, eyedropperHas, eyedropperRemove, countShown, liveOverlayElements, bgRect, textBox, textDraw, textString, applySelToFilter, hasUnsupportedSingleSheetFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, dismissibleFacetValues, switchOffBlockers, FACET_DIMS, FACET_DIM_BY_CONTROL, MODE_ORDER, facetKey, facetRowIndicesFor, NOTE_TEXT, coarseCurveNote, proofSizeNotice, sizeCheckFailureIsQuiet, SIZE_CHECK_FAILED_NOTICE } from './steel-filter-core.js';
|
|
874
892
|
import { checkpointStandard } from './checkpoint-standard.js';
|
|
875
893
|
import { filterAiBlockedLayerKeys, filterAiTouchesUnreadLayer, parseFilterAiProposal } from './filter-ai-proposal.js';
|
|
876
894
|
import { readOnlyFilterContext, rankFilterControls, filterViewFingerprint } from './filter-ai-context.js';
|
|
@@ -1637,6 +1655,9 @@ window.__floRevisionCheckpoint = {
|
|
|
1637
1655
|
history.replaceState(null, '', url.pathname + url.search);
|
|
1638
1656
|
if(!dirty) setSaved(revisionRequest && revisionFilterSavedEtag === serverEtag ? 'saved' : '');
|
|
1639
1657
|
syncRequiredSaveCue();
|
|
1658
|
+
// The size notice belongs to the checkpoint it was checked against (#1780): a new request voids
|
|
1659
|
+
// any answer in flight and anything on screen, and asks again for the new one.
|
|
1660
|
+
if(requestChanged) resetSizeCheck();
|
|
1640
1661
|
return true;
|
|
1641
1662
|
},
|
|
1642
1663
|
};
|
|
@@ -2675,6 +2696,216 @@ function apply(){
|
|
|
2675
2696
|
// cleared the halo and rows, and this puts them back on the pick. No re-scroll: the user may be working
|
|
2676
2697
|
// in the very list it would move.
|
|
2677
2698
|
if(eyeEl) openEyedropper(eyeAt.x, eyeAt.y, eyeEl, { rescroll: false });
|
|
2699
|
+
scheduleSizeCheck();
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
/* ── can this selection be read at all? (#1780) ──────────────────────────────────────────────────
|
|
2703
|
+
Every selected line on a sheet the read does not model from has to be named in the read's proof,
|
|
2704
|
+
and the proof has an 8 MB cap. The default selection ticks every line weight, and on a real set
|
|
2705
|
+
that was a selection no read could finish; the person found out only after Save, when the reader
|
|
2706
|
+
stopped and asked them to switch a weight off. So the Filter asks the server's own preflight about
|
|
2707
|
+
the selection ON SCREEN (the same `exclusion-preview` fold the dismissal sign-off uses, and cached
|
|
2708
|
+
with it), and says so here, next to the controls that fix it.
|
|
2709
|
+
|
|
2710
|
+
Advisory: it never disables Save and never changes a tick by itself. Its one action is the click the
|
|
2711
|
+
person would make on the checkbox, offered by name, with what it also takes off the model sheets. */
|
|
2712
|
+
const sizeNoticeEl = document.getElementById('filterSizeNotice');
|
|
2713
|
+
const SIZE_CHECK_DEBOUNCE_MS = 600;
|
|
2714
|
+
let sizeCheckTimer = 0;
|
|
2715
|
+
let sizeCheckSeq = 0; // bumped when the page stops being a checkpoint: an answer in flight is then void
|
|
2716
|
+
let sizeCheckKey = ''; // the selection most recently asked about, so a repaint does not re-ask
|
|
2717
|
+
let sizeCheckWanted = null; // { key, request, body } — the latest selection still owed an answer
|
|
2718
|
+
// At most ONE check in flight. The server's fold is synchronous and cannot be cancelled, so a person
|
|
2719
|
+
// ticking down a list would otherwise queue fold after fold and hold up every other request the page
|
|
2720
|
+
// makes. While one runs, later edits only replace `sizeCheckWanted`; when it lands, the newest
|
|
2721
|
+
// selection is asked about once, and the answer for a superseded one is never painted.
|
|
2722
|
+
let sizeCheckInFlight = false;
|
|
2723
|
+
|
|
2724
|
+
/** The preview body for the selection on screen, without touching `F` (that is Save's job). */
|
|
2725
|
+
function proposedControlsBody(){
|
|
2726
|
+
const proposed = { mode };
|
|
2727
|
+
for(const dim of MODE_ORDER){
|
|
2728
|
+
const control = FACET_DIMS[dim].control;
|
|
2729
|
+
proposed[control] = ((F && F[control]) || []).map(row => ({ ...row }));
|
|
2730
|
+
}
|
|
2731
|
+
applySelToFilter(proposed, sel, mode);
|
|
2732
|
+
const body = { mode, layers: [], thicknesses: [], colors: [] };
|
|
2733
|
+
for(const dim of MODE_ORDER){
|
|
2734
|
+
const d = FACET_DIMS[dim];
|
|
2735
|
+
body[d.control] = proposed[d.control].map(row => ({ [d.rowKey]: row[d.rowKey], on: row.on === true }));
|
|
2736
|
+
}
|
|
2737
|
+
return body;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
function hideSizeNotice(){
|
|
2741
|
+
sizeNoticeEl.hidden = true;
|
|
2742
|
+
sizeNoticeEl.classList.remove('is-impossible');
|
|
2743
|
+
sizeNoticeEl.replaceChildren();
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
/** Void everything about the previous checkpoint's size check, then ask about this one. */
|
|
2747
|
+
function resetSizeCheck(){
|
|
2748
|
+
clearTimeout(sizeCheckTimer);
|
|
2749
|
+
sizeCheckSeq++; sizeCheckKey = ''; sizeCheckWanted = null;
|
|
2750
|
+
hideSizeNotice();
|
|
2751
|
+
scheduleSizeCheck();
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
function scheduleSizeCheck(){
|
|
2755
|
+
if(!revisionRequest || !C || !F || !sel){
|
|
2756
|
+
clearTimeout(sizeCheckTimer); sizeCheckSeq++; sizeCheckKey = ''; sizeCheckWanted = null; hideSizeNotice(); return;
|
|
2757
|
+
}
|
|
2758
|
+
const body = proposedControlsBody();
|
|
2759
|
+
const key = revisionRequest + '\n' + JSON.stringify(body);
|
|
2760
|
+
if(key === sizeCheckKey) return;
|
|
2761
|
+
sizeCheckKey = key;
|
|
2762
|
+
sizeCheckWanted = { key, request: revisionRequest, body };
|
|
2763
|
+
clearTimeout(sizeCheckTimer);
|
|
2764
|
+
// Replacing a notice that is already up: its figures describe the PREVIOUS selection, so they go now,
|
|
2765
|
+
// not when the answer lands. No digits while checking — a stale count read as current is worse than
|
|
2766
|
+
// none (the sign-off total's rule). A first check shows nothing until it has something to say.
|
|
2767
|
+
if(!sizeNoticeEl.hidden){
|
|
2768
|
+
sizeNoticeEl.classList.remove('is-impossible');
|
|
2769
|
+
const p = document.createElement('p'); p.className = 'size-checking';
|
|
2770
|
+
const spinner = document.createElement('span'); spinner.className = 'signoff-spinner'; spinner.setAttribute('aria-hidden', 'true');
|
|
2771
|
+
p.append(spinner, document.createTextNode('Checking whether this selection can be read…'));
|
|
2772
|
+
sizeNoticeEl.replaceChildren(p);
|
|
2773
|
+
}
|
|
2774
|
+
sizeCheckTimer = setTimeout(pumpSizeCheck, SIZE_CHECK_DEBOUNCE_MS);
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
async function pumpSizeCheck(){
|
|
2778
|
+
if(sizeCheckInFlight || !sizeCheckWanted) return;
|
|
2779
|
+
const job = sizeCheckWanted;
|
|
2780
|
+
const seq = sizeCheckSeq;
|
|
2781
|
+
sizeCheckInFlight = true;
|
|
2782
|
+
let notice;
|
|
2783
|
+
try {
|
|
2784
|
+
notice = await runSizeCheck(job);
|
|
2785
|
+
} finally {
|
|
2786
|
+
sizeCheckInFlight = false;
|
|
2787
|
+
}
|
|
2788
|
+
// This page stopped being a checkpoint meanwhile: the answer is void, but a selection asked about
|
|
2789
|
+
// since (the checkpoint came back) is still owed one.
|
|
2790
|
+
if(seq !== sizeCheckSeq){ if(sizeCheckWanted) void pumpSizeCheck(); return; }
|
|
2791
|
+
if(sizeCheckWanted && sizeCheckWanted.key !== job.key){ void pumpSizeCheck(); return; } // superseded
|
|
2792
|
+
sizeCheckWanted = null;
|
|
2793
|
+
// A check that could not answer is not an answer: forget the key so the next repaint of this same
|
|
2794
|
+
// selection asks again, rather than leaving "couldn't check" up until the selection changes.
|
|
2795
|
+
if(notice === SIZE_CHECK_FAILED_NOTICE) sizeCheckKey = '';
|
|
2796
|
+
renderSizeNotice(notice);
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
/** One check. Returns the notice to show, or null when there is nothing to say. Never throws. */
|
|
2800
|
+
async function runSizeCheck(job){
|
|
2801
|
+
let res;
|
|
2802
|
+
try {
|
|
2803
|
+
res = await fetch(`/api/projects/${encodeURIComponent(PROJECT)}/revision-requests/${encodeURIComponent(job.request)}/exclusion-preview`, {
|
|
2804
|
+
method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(job.body),
|
|
2805
|
+
});
|
|
2806
|
+
} catch(error){
|
|
2807
|
+
console.warn('steel-filter: the selection size check could not reach FloLess', error);
|
|
2808
|
+
return SIZE_CHECK_FAILED_NOTICE;
|
|
2809
|
+
}
|
|
2810
|
+
if(!res.ok){
|
|
2811
|
+
let code = null; try { code = (await res.json()).code || null; } catch(_){ code = null; }
|
|
2812
|
+
// Nothing left to check (the read moved on, or is gone): say nothing. Anything else leaves the
|
|
2813
|
+
// question open, and a hidden notice would read as "this fits" — so it says it could not check.
|
|
2814
|
+
if(sizeCheckFailureIsQuiet(res.status, code)) return null;
|
|
2815
|
+
console.warn('steel-filter: the selection size check was refused', res.status, code || '(no code)');
|
|
2816
|
+
return SIZE_CHECK_FAILED_NOTICE;
|
|
2817
|
+
}
|
|
2818
|
+
let payload = null;
|
|
2819
|
+
try { payload = await res.json(); } catch(_){ payload = null; }
|
|
2820
|
+
if(!payload || !payload.proofBudget || typeof payload.proofBudget !== 'object'){
|
|
2821
|
+
console.warn('steel-filter: the selection size check returned no proof budget');
|
|
2822
|
+
return SIZE_CHECK_FAILED_NOTICE;
|
|
2823
|
+
}
|
|
2824
|
+
return proofSizeNotice(payload, sizeValueLabel);
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
/**
|
|
2828
|
+
* A value exactly as its facet row names it — the notice and the checkbox must say the same thing.
|
|
2829
|
+
* The row's own label function, over the row itself: a colour row shows its stored hex, which may be
|
|
2830
|
+
* upper-case while the server's canonical value is lower-case.
|
|
2831
|
+
*/
|
|
2832
|
+
function sizeValueLabel(dim, value){
|
|
2833
|
+
if(dim === 'thickness') return thicknessLabel(value);
|
|
2834
|
+
const control = FACET_DIMS[dim].control;
|
|
2835
|
+
const row = ((F && F[control]) || []).find(r => facetKey(dim, r[FACET_DIMS[dim].rowKey]) === value);
|
|
2836
|
+
return row ? String(row[FACET_DIMS[dim].rowKey]) : String(value);
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
function renderSizeNotice(notice){
|
|
2840
|
+
if(!notice){ hideSizeNotice(); return; }
|
|
2841
|
+
sizeNoticeEl.classList.toggle('is-impossible', notice.level === 'impossible');
|
|
2842
|
+
sizeNoticeEl.dataset.level = notice.level;
|
|
2843
|
+
const title = document.createElement('b'); title.textContent = notice.title;
|
|
2844
|
+
const lead = document.createElement('p'); lead.textContent = notice.lead;
|
|
2845
|
+
const parts = [title, lead];
|
|
2846
|
+
if(notice.suggestion){
|
|
2847
|
+
const s = notice.suggestion;
|
|
2848
|
+
const p = document.createElement('p'); p.textContent = s.text;
|
|
2849
|
+
const act = document.createElement('button');
|
|
2850
|
+
act.type = 'button'; act.className = 'size-suggest-action';
|
|
2851
|
+
act.setAttribute('data-command-id', 'filter.size-switch-off');
|
|
2852
|
+
act.dataset.dim = s.dim; act.dataset.value = String(s.value);
|
|
2853
|
+
act.textContent = s.action;
|
|
2854
|
+
act.onclick = () => switchOffFromNotice(s.dim, s.value);
|
|
2855
|
+
parts.push(p, act);
|
|
2856
|
+
} else {
|
|
2857
|
+
if(notice.alternativesIntro){
|
|
2858
|
+
const intro = document.createElement('p'); intro.textContent = notice.alternativesIntro;
|
|
2859
|
+
parts.push(intro);
|
|
2860
|
+
}
|
|
2861
|
+
if(notice.alternatives.length){
|
|
2862
|
+
const list = document.createElement('ul');
|
|
2863
|
+
for(const alt of notice.alternatives){
|
|
2864
|
+
const li = document.createElement('li');
|
|
2865
|
+
const text = document.createElement('span'); text.textContent = alt.text;
|
|
2866
|
+
const acts = document.createElement('span'); acts.className = 'acts';
|
|
2867
|
+
const act = document.createElement('button');
|
|
2868
|
+
act.type = 'button';
|
|
2869
|
+
act.setAttribute('data-command-id', 'filter.size-switch-off');
|
|
2870
|
+
act.dataset.dim = alt.dim; act.dataset.value = String(alt.value);
|
|
2871
|
+
act.setAttribute('aria-label', alt.action);
|
|
2872
|
+
act.textContent = 'switch off';
|
|
2873
|
+
act.onclick = () => switchOffFromNotice(alt.dim, alt.value);
|
|
2874
|
+
acts.appendChild(act);
|
|
2875
|
+
li.append(text, acts);
|
|
2876
|
+
list.appendChild(li);
|
|
2877
|
+
}
|
|
2878
|
+
parts.push(list);
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
sizeNoticeEl.replaceChildren(...parts);
|
|
2882
|
+
sizeNoticeEl.hidden = false;
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
/** The same edit as unticking the value's own checkbox, then focus lands ON that checkbox. */
|
|
2886
|
+
function switchOffFromNotice(dim, value){
|
|
2887
|
+
if(saveInFlight || !sel || !F) return;
|
|
2888
|
+
const facet = FACET_DIMS[dim] && FACET_DIMS[dim].control;
|
|
2889
|
+
if(!facet) return;
|
|
2890
|
+
const key = facetKey(dim, value);
|
|
2891
|
+
if(key === undefined || !setOf(facet).has(key)) return;
|
|
2892
|
+
setOf(facet).delete(key);
|
|
2893
|
+
syncFacetChecks(); markDirty(); apply();
|
|
2894
|
+
// The button that was clicked has just been replaced, so focus must land somewhere real: the value's
|
|
2895
|
+
// own checkbox, or — when a search in that list hides its row — the first visible control of that
|
|
2896
|
+
// list's search box (the only way a row is hidden is a search in that list), never <body> and never
|
|
2897
|
+
// the list's bulk all/none buttons, which would put a single-value edit's focus on a bulk action.
|
|
2898
|
+
const items = F[facet] || [];
|
|
2899
|
+
const boxes = document.querySelectorAll(`#facet-${facet} .opts input[type=checkbox]`);
|
|
2900
|
+
let target = null;
|
|
2901
|
+
for(let i = 0; i < items.length; i++){
|
|
2902
|
+
if(boxes[i] && facetRowKey(facet, items[i]) === key){ target = boxes[i]; break; }
|
|
2903
|
+
}
|
|
2904
|
+
if(!target || !target.offsetParent){
|
|
2905
|
+
const search = document.querySelector(`#facet-${facet} .facet-search-input`);
|
|
2906
|
+
if(search && search.offsetParent) target = search;
|
|
2907
|
+
}
|
|
2908
|
+
if(target){ target.focus(); target.scrollIntoView({ block: 'nearest' }); }
|
|
2678
2909
|
}
|
|
2679
2910
|
|
|
2680
2911
|
// --- modes + all/none ---
|
package/dist/web/workspaces.js
CHANGED
|
@@ -351,6 +351,9 @@
|
|
|
351
351
|
const $revitOpenModel = document.getElementById('ws-revit-open-model');
|
|
352
352
|
const $revitReplace = document.getElementById('ws-revit-replace');
|
|
353
353
|
const $revitRetry = document.getElementById('ws-revit-retry');
|
|
354
|
+
const $importReport = document.getElementById('ws-import-report');
|
|
355
|
+
/** The failed import the "Report this problem" button would hand to support, or null. */
|
|
356
|
+
let reportImportOperation = null;
|
|
354
357
|
const $revitCancel = document.getElementById('ws-revit-cancel');
|
|
355
358
|
const $revitReassure = document.getElementById('ws-source-reassure');
|
|
356
359
|
let revitSourceState = null;
|
|
@@ -2723,6 +2726,17 @@
|
|
|
2723
2726
|
paintRevitSourceActions('failed', revitSourceState?.canReplace === true, revitActiveOperation?.failure?.retryable !== false);
|
|
2724
2727
|
}
|
|
2725
2728
|
});
|
|
2729
|
+
$importReport?.addEventListener('click', () => {
|
|
2730
|
+
const operation = reportImportOperation;
|
|
2731
|
+
if (!operation || !current) return;
|
|
2732
|
+
const title = $sourcePlaceholder?.querySelector('.ws-source-title')?.textContent || '';
|
|
2733
|
+
window.dispatchEvent(new CustomEvent('floless:report-import-issue', { detail: {
|
|
2734
|
+
importer: isTeklaParserProject(current) ? 'tekla' : 'revit',
|
|
2735
|
+
operationId: operation.operationId,
|
|
2736
|
+
title,
|
|
2737
|
+
returnFocus: $importReport,
|
|
2738
|
+
} }));
|
|
2739
|
+
});
|
|
2726
2740
|
$revitRetry?.addEventListener('click', async () => {
|
|
2727
2741
|
const project = current;
|
|
2728
2742
|
const failedOperationId = revitActiveOperation?.operationId;
|
|
@@ -2735,7 +2749,7 @@
|
|
|
2735
2749
|
pollRevitImport(started.operation.operationId, project.id);
|
|
2736
2750
|
} catch (error) {
|
|
2737
2751
|
paintRevitSourceState('Couldn’t retry the RVT', `${error && error.message || error} The existing model was not changed.`);
|
|
2738
|
-
paintRevitSourceActions('failed', revitSourceState?.canReplace === true, revitActiveOperation?.failure?.retryable !== false);
|
|
2752
|
+
paintRevitSourceActions('failed', revitSourceState?.canReplace === true, revitActiveOperation?.failure?.retryable !== false, revitActiveOperation);
|
|
2739
2753
|
}
|
|
2740
2754
|
});
|
|
2741
2755
|
$revitCancel?.addEventListener('click', async () => {
|
|
@@ -3452,6 +3466,12 @@
|
|
|
3452
3466
|
$revitRetry.dataset.commandId = 'revit.retry-import';
|
|
3453
3467
|
$revitRetry.dataset.tip = 'Try importing the already stored RVT again.';
|
|
3454
3468
|
}
|
|
3469
|
+
if ($importReport) {
|
|
3470
|
+
$importReport.dataset.commandId = tekla ? 'tekla-parser.report-import-failure' : 'revit.report-import-failure';
|
|
3471
|
+
$importReport.dataset.tip = tekla
|
|
3472
|
+
? 'Send this read’s failure details to the FloLess team. You see exactly what is included before sending.'
|
|
3473
|
+
: 'Send this import’s failure details to the FloLess team. You see exactly what is included before sending.';
|
|
3474
|
+
}
|
|
3455
3475
|
$revitCancel.textContent = tekla ? 'Cancel read' : 'Cancel import';
|
|
3456
3476
|
$revitCancel.dataset.commandId = tekla ? 'tekla-parser.cancel-import' : 'revit.cancel-import';
|
|
3457
3477
|
$revitCancel.dataset.tip = tekla
|
|
@@ -3463,14 +3483,26 @@
|
|
|
3463
3483
|
window.__instructor?.notifyChanged();
|
|
3464
3484
|
}
|
|
3465
3485
|
|
|
3466
|
-
|
|
3486
|
+
// #1757: a failed import the person can hand to support. Only a durable failed operation qualifies
|
|
3487
|
+
// (a browser-side admission failure has no record to attach), and not the two kinds whose next step
|
|
3488
|
+
// is not support: access (sign in) and superseded (nothing to do).
|
|
3489
|
+
function reportableImport(operation) {
|
|
3490
|
+
return !!operation && operation.state === 'failed' && typeof operation.operationId === 'string'
|
|
3491
|
+
&& !['access', 'superseded'].includes(operation.failure?.kind);
|
|
3492
|
+
}
|
|
3493
|
+
|
|
3494
|
+
function paintRevitSourceActions(mode, canReplace = true, canRetry = true, failedOperation = null) {
|
|
3467
3495
|
if (!$revitSourceActions) return;
|
|
3468
3496
|
if (isTeklaParserProject()) canRetry = false;
|
|
3469
3497
|
const busy = mode === 'active' || mode === 'uploading';
|
|
3498
|
+
const canReport = mode === 'failed' && reportableImport(failedOperation);
|
|
3499
|
+
reportImportOperation = canReport ? failedOperation : null;
|
|
3470
3500
|
$revitOpenModel.hidden = mode !== 'imported';
|
|
3471
|
-
|
|
3501
|
+
// Report counts toward the row: a failure with no Replace access and no Retry still offers it.
|
|
3502
|
+
$revitSourceActions.hidden = !canReplace && !busy && !(mode === 'failed' && canRetry) && !canReport && mode !== 'imported';
|
|
3472
3503
|
$revitReplace.hidden = busy || !canReplace;
|
|
3473
3504
|
$revitRetry.hidden = mode !== 'failed' || !canRetry;
|
|
3505
|
+
if ($importReport) $importReport.hidden = !canReport;
|
|
3474
3506
|
$revitCancel.hidden = mode !== 'active';
|
|
3475
3507
|
$revitReassure.hidden = !busy;
|
|
3476
3508
|
// This is also the live region: aria-busy would suppress spoken progress.
|
|
@@ -3515,7 +3547,7 @@
|
|
|
3515
3547
|
failure?.message || (tekla
|
|
3516
3548
|
? 'Choose the Tekla model folder or ZIP again to start a new read.'
|
|
3517
3549
|
: 'FloLess could not import this model. Try again or contact support if the problem continues.'));
|
|
3518
|
-
paintRevitSourceActions('failed', response.state.canReplace === true, failure?.retryable !== false);
|
|
3550
|
+
paintRevitSourceActions('failed', response.state.canReplace === true, failure?.retryable !== false, revitActiveOperation);
|
|
3519
3551
|
} else {
|
|
3520
3552
|
const source = response.state.source;
|
|
3521
3553
|
const admissionFailure = tekla ? teklaAdmissionFailures.get(projectId) : null;
|
|
@@ -3815,7 +3847,7 @@
|
|
|
3815
3847
|
failure?.message || (tekla
|
|
3816
3848
|
? 'Choose the Tekla model folder or ZIP again to start a new read.'
|
|
3817
3849
|
: 'FloLess could not import this model. Try again or contact support if the problem continues.'));
|
|
3818
|
-
paintRevitSourceActions('failed', revitSourceState?.canReplace === true, !tekla && failure?.retryable !== false);
|
|
3850
|
+
paintRevitSourceActions('failed', revitSourceState?.canReplace === true, !tekla && failure?.retryable !== false, operation);
|
|
3819
3851
|
await refreshModelPresence(projectId, current.app, true);
|
|
3820
3852
|
await refreshApprovalState(projectId);
|
|
3821
3853
|
if (!tekla && failure?.retryable !== false && !$revitRetry?.hidden) queueMicrotask(() => $revitRetry?.focus());
|