@floless/app 0.128.2 → 0.129.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 +475 -71
- package/dist/web/app.css +0 -1
- package/dist/web/aware.js +52 -6
- package/dist/web/frame-theme.js +60 -0
- package/dist/web/steel-3d-view.js +375 -51
- package/dist/web/steel-editor.html +201 -8
- package/dist/web/steel-filter.html +96 -23
- package/package.json +1 -1
package/dist/web/app.css
CHANGED
|
@@ -2060,7 +2060,6 @@
|
|
|
2060
2060
|
terminal. It is a button rather than an input so it cannot resemble somewhere to answer the
|
|
2061
2061
|
parked question; long commands wrap instead of truncating the one thing the user must recover. */
|
|
2062
2062
|
.req-run-resume { display: flex; flex-direction: column; gap: 4px; }
|
|
2063
|
-
.req-run-resume-label { color: var(--text-muted); font-size: 10.5px; font-weight: 600; }
|
|
2064
2063
|
.req-run-resume-command { appearance: none; width: 100%; min-height: 30px; padding: 6px 8px;
|
|
2065
2064
|
text-align: left; cursor: pointer; color: var(--accent-bright); background: var(--surface-2);
|
|
2066
2065
|
border: 1px solid var(--border-strong); border-radius: 4px; font-family: var(--mono); font-size: 10.5px;
|
package/dist/web/aware.js
CHANGED
|
@@ -5536,7 +5536,32 @@
|
|
|
5536
5536
|
let awareUpgradeInventory = [];
|
|
5537
5537
|
let awareUpgradeReturnFocus = null;
|
|
5538
5538
|
const awareBusy = (status) => status === 'starting' || status === 'running' || status === 'retrying';
|
|
5539
|
-
|
|
5539
|
+
// The map carries the casing only a human knows ("SketchUp", not "Sketchup"). A host AWARE gains
|
|
5540
|
+
// before this map does must still read as a NAME rather than an id, in the sentence and in the
|
|
5541
|
+
// results rows alike — so the fallback title-cases it instead of surfacing raw `archicad`.
|
|
5542
|
+
// It returns '' only when there is no id to show at all; each caller decides what that means
|
|
5543
|
+
// (the sentence counts the row instead, awareHostRows labels it "Unknown bridge").
|
|
5544
|
+
// Splitting on separators rather than capitalising at /\b[a-z]/ is deliberate: that word boundary
|
|
5545
|
+
// is ASCII-only, so it capitalised the letter AFTER an accent (`éco` → `éCo`), and a stray leading
|
|
5546
|
+
// or trailing hyphen survived as a space that then showed up mid-sentence.
|
|
5547
|
+
// Own-property lookup, not `MAP[host]`: a plain object inherits `constructor`, `toString` and
|
|
5548
|
+
// friends, so a host id colliding with one would render "function Object() { [native code] }"
|
|
5549
|
+
// into the sentence. Unreachable while the server validates against its own tuple — but this
|
|
5550
|
+
// fallback's whole job is to survive host ids nobody has thought of yet.
|
|
5551
|
+
const AWARE_HOST_NAMES = { tekla: 'Tekla', revit: 'Revit', sketchup: 'SketchUp', rhino: 'Rhino' };
|
|
5552
|
+
const awareHostLabel = (host) => {
|
|
5553
|
+
if (Object.hasOwn(AWARE_HOST_NAMES, host)) return AWARE_HOST_NAMES[host];
|
|
5554
|
+
// Only a string can be a host id. Stringifying anything else produces "[object Object]" in a
|
|
5555
|
+
// sentence a non-coder reads; the caller counts the row either way, so nothing goes missing.
|
|
5556
|
+
const raw = typeof host === 'string' ? host.trim() : '';
|
|
5557
|
+
const titled = raw.split(/[-_\s]+/).filter(Boolean)
|
|
5558
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
5559
|
+
.join(' ');
|
|
5560
|
+
// An id that is nothing but separators title-cases to '', and the caller drops empty names — so
|
|
5561
|
+
// the bridge would be refreshed without ever being named, the one thing this fallback exists to
|
|
5562
|
+
// prevent. Keep the raw form: ugly beats absent. Only a genuinely empty host yields ''.
|
|
5563
|
+
return titled || raw;
|
|
5564
|
+
};
|
|
5540
5565
|
// "Tekla" / "Tekla and Revit" / "Tekla, Revit, and SketchUp" — inventory order, never alphabetised,
|
|
5541
5566
|
// so it reads the same way the results panel below it lists them.
|
|
5542
5567
|
const awareHostList = (names) => (names.length < 3
|
|
@@ -5544,6 +5569,8 @@
|
|
|
5544
5569
|
: `${names.slice(0, -1).join(', ')}, and ${names[names.length - 1]}`);
|
|
5545
5570
|
/** The bridge inventory an /api/aware/update answer carries, or none when it carries no list. */
|
|
5546
5571
|
const awareInventoryOf = (check) => (Array.isArray(check && check.bridges) ? check.bridges : []);
|
|
5572
|
+
/** Above this many, the sentence states the count instead of naming every host. */
|
|
5573
|
+
const AWARE_MAX_NAMED_BRIDGES = 4;
|
|
5547
5574
|
/**
|
|
5548
5575
|
* Name the bridges THIS computer actually has, instead of reciting a fixed host list.
|
|
5549
5576
|
*
|
|
@@ -5560,12 +5587,27 @@
|
|
|
5560
5587
|
* exists, so it cannot be that snapshot; the results panel below reports what the job actually
|
|
5561
5588
|
* did. Keeping the inventory in step with every poll (see refreshAwareUpdate) is what shrinks
|
|
5562
5589
|
* that window to the gap between the last check and the click.
|
|
5590
|
+
*
|
|
5591
|
+
* Naming them only reads as a sentence while there are FEW. The host list is not fixed — it is
|
|
5592
|
+
* whatever AWARE supports at the time — so past a handful this reciting becomes the same wall of
|
|
5593
|
+
* names the fixed list was, just a personalised one, wrapping the modal and pushing its buttons
|
|
5594
|
+
* down. Beyond the limit it states the count instead; the results panel still lists every host
|
|
5595
|
+
* individually as it updates, so nothing becomes unknowable.
|
|
5563
5596
|
*/
|
|
5564
5597
|
const awareBridgeClause = (inventory) => {
|
|
5565
|
-
const
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5598
|
+
const rows = inventory || [];
|
|
5599
|
+
if (!rows.length) return 'refreshes any bridges installed on this computer';
|
|
5600
|
+
const names = rows.map((row) => awareHostLabel(row.host)).filter(Boolean);
|
|
5601
|
+
// The count is over ROWS, never over names: a row this UI cannot name is still a bridge the job
|
|
5602
|
+
// refreshes, so counting names would quietly under-report it out of existence. One unnameable
|
|
5603
|
+
// row therefore drops the whole sentence to the count rather than listing the rest as if they
|
|
5604
|
+
// were all of them. "your N", not "all N" — N comes from the same check-time inventory as the
|
|
5605
|
+
// names, so it must not make the stronger, execution-time claim that N is everything the job
|
|
5606
|
+
// will touch.
|
|
5607
|
+
if (rows.length > AWARE_MAX_NAMED_BRIDGES || names.length !== rows.length) {
|
|
5608
|
+
return `refreshes your ${rows.length} installed bridge${rows.length === 1 ? '' : 's'}`;
|
|
5609
|
+
}
|
|
5610
|
+
return `refreshes your installed ${awareHostList(names)} bridge${names.length === 1 ? '' : 's'}`;
|
|
5569
5611
|
};
|
|
5570
5612
|
// A registry hiccup leaves `target` empty; "v" + nothing used to render "vthe current release".
|
|
5571
5613
|
const awareVersionLabel = (target) => (target ? `v${target}` : 'the current release');
|
|
@@ -5606,7 +5648,11 @@
|
|
|
5606
5648
|
return `<section class="aware-update-section"><div class="aware-update-section-head">${escapeHtml(title)}</div>`
|
|
5607
5649
|
+ `<div class="aware-update-hosts">${rows.map((row) => {
|
|
5608
5650
|
const host = failed ? row.host : row;
|
|
5609
|
-
|
|
5651
|
+
// A row here is a bridge the job really touched, so it must be visible even when the host
|
|
5652
|
+
// cannot be named. The sentence above can fall back to a count; a row cannot — an empty
|
|
5653
|
+
// name would render as a blank cell above a message with nothing to attach it to.
|
|
5654
|
+
const name = awareHostLabel(host) || 'Unknown bridge';
|
|
5655
|
+
return `<div class="aware-update-host"><div class="aware-update-host-name">${escapeHtml(name)}</div>`
|
|
5610
5656
|
+ (failed
|
|
5611
5657
|
? `<div class="aware-update-host-message">${escapeHtml(row.message)}</div><div class="aware-update-host-code">${escapeHtml(row.code)}</div>`
|
|
5612
5658
|
: '<div class="aware-update-host-message">Up to date</div>')
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mirror the app's light/dark theme into a standalone workspace page.
|
|
3
|
+
*
|
|
4
|
+
* THE BUG THIS FIXES (#602). The shell keeps the active theme as `data-theme` on its own
|
|
5
|
+
* <html> (web/app.js → setTheme). The DRAWINGS and MODEL steps render inside iframes, and an
|
|
6
|
+
* attribute does not cross an iframe boundary — so the Drawing Filter and the Steel editor kept
|
|
7
|
+
* their dark default while the app around them went light.
|
|
8
|
+
*
|
|
9
|
+
* WHAT IS WIRED UP TODAY: steel-filter.html (DRAWINGS) only. The Steel editor (MODEL) and the two
|
|
10
|
+
* vector surfaces have no light palette yet — theirs is a much larger port, because those pages
|
|
11
|
+
* paint chrome and drawing geometry from the same ~250 literals and each one has to be judged
|
|
12
|
+
* against which of the two it is. Loading this script there before that work would set an attribute
|
|
13
|
+
* no rule reads. Tracked separately; until it lands, a light-theme user gets a light DRAWINGS panel
|
|
14
|
+
* and a dark MODEL one.
|
|
15
|
+
*
|
|
16
|
+
* WHY localStorage AND NOT A PARENT→CHILD POKE. The shell already persists the choice under
|
|
17
|
+
* THEME_KEY, and these pages are same-origin with it, so the value is simply readable here. The
|
|
18
|
+
* `storage` event then does the rest: it fires in every OTHER same-origin document the moment the
|
|
19
|
+
* shell writes the key, which is exactly the set of frames that need to react. That buys three
|
|
20
|
+
* things a parent-side `frame.contentDocument.dataset.theme = …` would not:
|
|
21
|
+
* - it survives an iframe reload (workspaces.js re-`src`s these frames on project switch,
|
|
22
|
+
* restore and rename) without a `load` listener to re-apply anything;
|
|
23
|
+
* - it works when one of these pages is opened directly in its own tab, which the editor is;
|
|
24
|
+
* - it needs no change to the shell at all, so the theme cannot half-arrive because a new frame
|
|
25
|
+
* was added and nobody remembered to register it.
|
|
26
|
+
*
|
|
27
|
+
* LOAD IT AS A CLASSIC SCRIPT IN <head> (no `defer`, no `type=module`): both defer execution past
|
|
28
|
+
* parsing, and the attribute must be on <html> before first paint or a light user sees a dark flash.
|
|
29
|
+
*/
|
|
30
|
+
(function () {
|
|
31
|
+
// Must match web/app.js's THEME_KEY. Pinned against drift by frame-theme.test.ts, which reads
|
|
32
|
+
// the literal out of both files — the shell writes this key and these pages only ever read it,
|
|
33
|
+
// so a rename on one side would fail silently rather than loudly.
|
|
34
|
+
var KEY = 'floless-demo-theme-v1';
|
|
35
|
+
|
|
36
|
+
/** The stored theme, or 'dark' — the app's own default (app.js initTheme) — for anything else.
|
|
37
|
+
* localStorage access itself can throw (a privacy mode that disables storage), hence the try. */
|
|
38
|
+
function read() {
|
|
39
|
+
try {
|
|
40
|
+
return window.localStorage.getItem(KEY) === 'light' ? 'light' : 'dark';
|
|
41
|
+
} catch (_) {
|
|
42
|
+
return 'dark';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function apply(theme) {
|
|
47
|
+
document.documentElement.dataset.theme = theme;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
apply(read());
|
|
51
|
+
|
|
52
|
+
// `key === null` is a localStorage.clear() — the whole store went, so re-read rather than
|
|
53
|
+
// ignore it (the answer is then the 'dark' default, which is what the shell would show too).
|
|
54
|
+
window.addEventListener('storage', function (e) {
|
|
55
|
+
if (e.key === KEY || e.key === null) apply(read());
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Exposed for the E2E probe (and any page that wants to read the active theme in script).
|
|
59
|
+
window.FlolessFrameTheme = { KEY: KEY, read: read, apply: apply };
|
|
60
|
+
})();
|