@floless/app 0.121.0 → 0.123.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.
@@ -145,13 +145,13 @@
145
145
  * previous version was stale within one PR, twice.
146
146
  */
147
147
 
148
- const FT_MM = 304.8;
149
148
  const IN_MM = 25.4;
150
149
 
151
150
  import { dispatchV2ProjectionCommand } from './steel-model-v2-commands.js';
151
+ import { mmPerPx } from './grid-core.js';
152
152
 
153
- /** Display-pixel scale for one plan, identical to the adapter's `scaleOf`. Change one, change both. */
154
- const scaleOf = (plan) => FT_MM / (plan && plan.pt_per_ft > 0 ? plan.pt_per_ft : 1);
153
+ /** Display-pixel scale for one plan — the shared `mmPerPx`, not a fourth copy to keep in lock-step. */
154
+ const scaleOf = (plan) => mmPerPx(plan && plan.pt_per_ft);
155
155
 
156
156
  /** Kill float noise before it persists into `wp` — the same r6 the three inline call sites applied. */
157
157
  const r6 = (n) => Math.round(n * 1e6) / 1e6;
@@ -191,7 +191,7 @@ export function deepFreezeProjection(value) {
191
191
  * World-mm offsets → one plan's display-pixel offsets, with dz in INCHES. Order is preserved because
192
192
  * copy order is offset-major and therefore observable in the stored contract.
193
193
  *
194
- * Y IS NEGATED: display Y grows down, world Y grows up the plan — the inverse of the adapter's
194
+ * Y IS NEGATED: display Y grows down, world Y grows up the plan — the inverse of `steel-3d-core`'s
195
195
  * `dispToMm`. A ROUNDED inverse, not an exact one: `r6` quantises to 6dp, so a round trip lands within
196
196
  * ~1e-5 mm rather than exactly. The tests assert the quantised values rather than pretending otherwise,
197
197
  * because the quantisation is the pre-existing behaviour being preserved.
@@ -6,9 +6,8 @@
6
6
  * control to a world point. Nothing here infers a view kind or substitutes missing registration data.
7
7
  */
8
8
 
9
- import { parseSpacings, labelsFor } from './grid-core.js';
9
+ import { parseSpacings, labelsFor, mmPerPx } from './grid-core.js';
10
10
 
11
- const FT_MM = 304.8;
12
11
  const ROUND = 1e9;
13
12
  const clean = (n) => {
14
13
  const q = Math.round(n * ROUND) / ROUND;
@@ -100,10 +99,13 @@ export function planTransform(plan) {
100
99
  const registrationGrid = plan.modelGrid || plan.grid;
101
100
  const world0 = plan.datum_ref ? gridIntersection(registrationGrid, plan.datum_ref, plan) : [0, 0];
102
101
  const world1 = gridIntersection(registrationGrid, plan.control2_ref, plan);
103
- const mmPerPx = FT_MM / ptPerFt;
102
+ // The shared plan scale. Its zero/negative fallback is unreachable here — the guard above already
103
+ // refused any sheet whose `pt_per_ft` is not a positive finite number — so this is the same value
104
+ // the inline `FT_MM / ptPerFt` produced, from the one implementation.
105
+ const scale = mmPerPx(ptPerFt);
104
106
  const local1 = [
105
- (plan.control2_at[0] - plan.datum_at[0]) * mmPerPx,
106
- (plan.datum_at[1] - plan.control2_at[1]) * mmPerPx,
107
+ (plan.control2_at[0] - plan.datum_at[0]) * scale,
108
+ (plan.datum_at[1] - plan.control2_at[1]) * scale,
107
109
  ];
108
110
  const worldDelta = [world1[0] - world0[0], world1[1] - world0[1]];
109
111
  const localLen = Math.hypot(local1[0], local1[1]);
@@ -118,7 +120,7 @@ export function planTransform(plan) {
118
120
  if (![c, s, fitScale, world0[0], world0[1]].every(Number.isFinite)) {
119
121
  return refuse('registration-invalid', `sheet "${plan.sheet || '?'}" has a non-finite registration transform`, plan);
120
122
  }
121
- return { datumPx: plan.datum_at, world0, mmPerPx, fitScale, rotation, c, s };
123
+ return { datumPx: plan.datum_at, world0, mmPerPx: scale, fitScale, rotation, c, s };
122
124
  }
123
125
 
124
126
  /** Canonical world-mm work point → this plan's display px. */
@@ -8,8 +8,6 @@
8
8
  */
9
9
  import { parseLen, fmtLen } from './grid-core.js';
10
10
 
11
- export const DEFAULT_CUT_MM = 24 * 25.4;
12
-
13
11
  /**
14
12
  * Display modes a saved view may carry. Must stay a superset of the 3D toolbar's `#m3dMode`
15
13
  * buttons in steel-editor.html — a mode the dropdown offers but this list omits is silently
@@ -1468,72 +1468,16 @@
1468
1468
  });
1469
1469
 
1470
1470
  // ── Approve (per-project) ───────────────────────────────────────────────────
1471
- // Shared by the header ✓ Approve and the Exports-tab gate link ("Approve this version"), so the
1472
- // sign-off is one flow. On success it stamps current.approvedAt (server returns it) so the
1473
- // Exports gate unlocks without a reload.
1474
- async function legacyApproveProject() {
1475
- if (!current) return;
1476
- // The flag, not the attribute — `aria-disabled` is advisory and the button stays clickable BY
1477
- // DESIGN (that is what keeps its data-tip reachable), so this is the check that actually holds.
1478
- // Without it the header button still fires the 404 that #490 is about. Say what to do instead
1479
- // rather than reporting the failure: the user has no model, and that is the only useful sentence.
1480
- // RE-PROBE before refusing, never refuse from the cache. A stale `false` here is far worse than
1481
- // the 404 it replaced: it blocks a legitimate sign-off while confidently telling the user to read a
1482
- // drawing they have already read — and stale IS reachable, because a model can appear without this
1483
- // pane hearing about it (an AI read landing while Drawings is open, a staged review confirmed
1484
- // elsewhere, the editor's first autosave). One request at click time removes the whole class.
1485
- if (!exportsHasModel) {
1486
- const stillNone = !(await projectHasContract(current.id, current.app));
1487
- if (!current) return; // closed during the probe
1488
- applyModelPresence(!stillNone); // correct the cache either way — the header was lying too
1489
- if (stillNone) {
1490
- showToast(`There’s no model to approve yet — read a drawing on ${stepLabel('drawings')} first.`, 'warn');
1491
- return;
1492
- }
1493
- }
1494
- const approvingProject = current;
1495
- const btn = document.getElementById('ws-approve');
1496
- // Unreachable today (#ws-approve is static markup), but approveProject is driven from THREE
1497
- // controls — a silent return would turn all three into dead clicks if the header were ever renamed.
1498
- if (!btn) {
1499
- console.error('[workspaces] #ws-approve is missing — Approve cannot run');
1500
- showToast('Couldn’t start Approve — reload the page.', 'warn');
1501
- return;
1502
- }
1503
- btn.disabled = true;
1504
- const prev = btn.textContent;
1505
- btn.textContent = '◆ Approving…';
1506
- try {
1507
- // Flush the editor's debounced autosave FIRST (same-origin iframe) so Approve bakes the
1508
- // LATEST edits, not a stale contract — a user can edit then hit Approve before the ~debounce
1509
- // fires. flushContract() PUTs the live contract and resolves; a save failure aborts the bake.
1510
- const win = frames.model && frames.model.contentWindow;
1511
- if (win && typeof win.flushContract === 'function') await win.flushContract();
1512
- throw new Error('Legacy one-click approval is disabled; use Review and approve.');
1513
- // Kept only so this retired branch remains parseable while its surrounding historical comments
1514
- // are removed in a later cleanup; execution cannot cross the throw above.
1515
- const res = null;
1516
- if (res && res.approvedAt) approvingProject.approvedAt = res.approvedAt; // unlock exports
1517
- const stillOpen = current && current.id === approvingProject.id;
1518
- if (stillOpen && !$wsHistory.hidden && res && res.version && Number.isInteger(Number(res.version.n))) {
1519
- expandDiffOnce = { projectId: approvingProject.id, n: Number(res.version.n) };
1520
- }
1521
- showToast(`Approved — "${approvingProject.name}" is baked into ${projectAppName(approvingProject)}`, 'ok');
1522
- track('workspace_project_approved', { app: approvingProject.app }); // a successful sign-off
1523
- // First Approve for this app calms the "✦ Start here" beacon (the document-archetype
1524
- // analog of a workflow's first Run); ticks the Review + Approve guide rows.
1525
- if (bridge.markWorkspaceApproved && wsDescOf(approvingProject)?.docGuide) {
1526
- bridge.markWorkspaceApproved(approvingProject.app);
1527
- }
1528
- if (stillOpen) {
1529
- syncWorkspaceGuide();
1530
- if (!$wsExports.hidden) renderExports(); // reflect the unlocked gate immediately if it's open
1531
- if (!$wsHistory.hidden) await renderHistory(); // reflect it, clear the banner, and open the new version's comparison
1532
- }
1533
- } catch (err) {
1534
- showToast('Approve failed: ' + (err && err.message || err), 'warn');
1535
- } finally { btn.disabled = false; btn.textContent = prev; }
1536
- }
1471
+ // One sign-off flow behind FOUR controls, all of which call approveProject(): the header
1472
+ // #ws-approve ("Review & approve"), the Exports pending-changes banner ([data-review-changes]),
1473
+ // the Exports gate link #ws-exports-approve ("Approve this version"), and History's
1474
+ // #hist-approve ("Review changes").
1475
+ //
1476
+ // What unlocks the Exports gate without a reload is the confirm's refreshApprovalState() +
1477
+ // renderExports(), which re-read the server's approval state and export sources — NOT the
1478
+ // `approvedAt` stamp. The gate is `exportSourcesState.status === 'ready' && an explicit source`
1479
+ // (paintExports), and it never reads approvedAt: that field is compatibility metadata only, as
1480
+ // the approvalState declaration above says.
1537
1481
  const approvalDecisionLabel = (decision) => decision === 'approve' ? 'Approve this change' : 'Leave pending';
1538
1482
 
1539
1483
  function renderApprovalReview() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.121.0",
3
+ "version": "0.123.0",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {
@@ -31,6 +31,7 @@
31
31
  "verify:no-title": "node build/verify-no-title.mjs",
32
32
  "verify:no-native-select": "node build/verify-no-native-select.mjs",
33
33
  "verify:scrollbars": "node build/verify-scrollbars.mjs",
34
+ "verify:native-controls": "node build/verify-native-controls.mjs",
34
35
  "verify:display-sync": "node build/verify-display-sync.mjs",
35
36
  "verify:view-modes": "node build/verify-view-modes.mjs",
36
37
  "verify:gateway": "node build/verify-contract-gateway.mjs",