@floless/app 0.138.2 → 0.139.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/autostart.mjs +6 -2
- package/desktop-access-production-manifest.mjs +7 -0
- package/dist/floless-server.cjs +157207 -70887
- package/dist/schemas/model.continuation.v1.schema.json +19 -0
- package/dist/schemas/model.continuation.v2.schema.json +19 -0
- package/dist/schemas/model.query-response.v1.schema.json +95 -0
- package/dist/schemas/model.query-response.v2.schema.json +80 -0
- package/dist/schemas/model.query.v1.schema.json +87 -0
- package/dist/schemas/model.query.v2.schema.json +87 -0
- package/dist/schemas/model.snap-candidate.v1.schema.json +48 -0
- package/dist/schemas/model.snap-constraint.v1.schema.json +18 -0
- package/dist/schemas/model.snap-query.v1.schema.json +24 -0
- package/dist/schemas/model.snap-result.v1.schema.json +33 -0
- package/dist/schemas/model.snapshot.v1.schema.json +136 -0
- package/dist/schemas/revit.model.v1.schema.json +24 -0
- package/dist/schemas/steel.model.v2.schema.json +45 -6
- package/dist/skills/floless-app-approval/SKILL.md +19 -5
- package/dist/skills/floless-app-bridge/SKILL.md +19 -6
- package/dist/skills/floless-app-knowledge/SKILL.md +22 -1
- package/dist/skills/floless-app-new-workflow/SKILL.md +31 -27
- package/dist/skills/floless-app-new-workflow/references/build-and-verify.md +13 -12
- package/dist/skills/floless-app-onboarding/SKILL.md +3 -3
- package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +16 -9
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -2
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +95 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +142 -21
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +19 -0
- package/dist/skills/floless-app-tweak-contract/SKILL.md +42 -8
- package/dist/skills/floless-app-vectorize/SKILL.md +19 -6
- package/dist/skills/floless-app-workflows/SKILL.md +30 -3
- package/dist/skills/floless-app-workflows/references/workspace-data.md +77 -4
- package/dist/templates/floless-workspace-model-report.flo +77 -0
- package/dist/templates/revit-model.flo +111 -0
- package/dist/web/app.css +415 -177
- package/dist/web/app.js +302 -51
- package/dist/web/aware.js +1357 -1032
- package/dist/web/chat.css +692 -0
- package/dist/web/chat.js +2651 -0
- package/dist/web/commands-revit.js +42 -0
- package/dist/web/commands-shell.js +531 -70
- package/dist/web/commands-steel.js +344 -146
- package/dist/web/commands.js +1 -1
- package/dist/web/index.html +283 -77
- package/dist/web/instructor.js +217 -36
- package/dist/web/left-pane.js +636 -0
- package/dist/web/model-artifact-loader.js +75 -0
- package/dist/web/model-authoring-gestures.js +141 -0
- package/dist/web/model-cad-tools.js +20 -0
- package/dist/web/model-clip-gesture.js +148 -0
- package/dist/web/model-clip-list.js +156 -0
- package/dist/web/model-clip-session.js +274 -0
- package/dist/web/model-clip-three-overlay.js +295 -0
- package/dist/web/model-clip-three-preview.js +59 -0
- package/dist/web/model-editor-contract.js +519 -0
- package/dist/web/model-editor-revit-adapter.js +139 -0
- package/dist/web/model-editor-shell.js +271 -0
- package/dist/web/model-editor-state-recovery.js +44 -0
- package/dist/web/model-editor-steel-adapter.js +415 -0
- package/dist/web/model-editor.css +268 -0
- package/dist/web/model-frame.js +192 -0
- package/dist/web/model-inspector.js +128 -0
- package/dist/web/model-measure.js +390 -0
- package/dist/web/model-navigation-controls.js +246 -0
- package/dist/web/model-orientation-overlay.js +217 -0
- package/dist/web/model-panel-bridge.js +230 -0
- package/dist/web/model-pointer-dock.js +164 -0
- package/dist/web/model-revit-module.js +83 -0
- package/dist/web/model-selection-coordinator.js +151 -0
- package/dist/web/model-selection-tools.js +290 -0
- package/dist/web/model-snap-contract.js +267 -0
- package/dist/web/model-snapping.js +497 -0
- package/dist/web/model-spatial-panel.js +294 -0
- package/dist/web/model-spatial-tools.js +249 -0
- package/dist/web/model-tree.js +47 -0
- package/dist/web/model-viewport-lighting.js +166 -0
- package/dist/web/model-viewport-revit-adapter.js +1224 -0
- package/dist/web/model-viewport-state.js +505 -0
- package/dist/web/model-viewport-steel-adapter.js +150 -0
- package/dist/web/model-viewport-toolbar.js +516 -0
- package/dist/web/model-viewport.js +717 -0
- package/dist/web/panels.js +8 -15
- package/dist/web/renderers.js +3 -0
- package/dist/web/revit-editor.css +35 -0
- package/dist/web/revit-editor.html +74 -0
- package/dist/web/revit-editor.js +845 -0
- package/dist/web/steel-3d-core.js +16 -44
- package/dist/web/steel-3d-view.js +1384 -633
- package/dist/web/steel-canvas-guidance.js +3 -1
- package/dist/web/steel-editor.html +2145 -1255
- package/dist/web/steel-filter.html +5 -1
- package/dist/web/steel-model-v2-commands.js +80 -3
- package/dist/web/steel-split-view.js +5 -39
- package/dist/web/steel-view-generation.js +107 -17
- package/dist/web/vector-3d.html +12 -0
- package/dist/web/workspaces.js +2154 -283
- package/distribution-profile-active.mjs +2 -0
- package/distribution-profile-production.mjs +47 -0
- package/distribution-profile-shared.mjs +8 -0
- package/distribution-profile.mjs +18 -0
- package/distribution-resource-inventory.mjs +81 -0
- package/launch.mjs +18 -10
- package/log.mjs +2 -1
- package/managed-runtime-policy.mjs +104 -0
- package/model-reader-policy-active.mjs +7 -0
- package/network-policy-active.mjs +6 -0
- package/package.json +17 -2
- package/post-update-marker.mjs +3 -1
- package/rvt-production-uat-authority.mjs +60 -0
- package/teardown.mjs +4 -3
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export const MODEL_LIGHTING_SCHEMA = 'floless.model-lighting/v2';
|
|
2
|
+
export const MODEL_LIGHTING_DEFAULTS = Object.freeze({
|
|
3
|
+
schema: MODEL_LIGHTING_SCHEMA,
|
|
4
|
+
sunlight: true,
|
|
5
|
+
sunBrightness: 1,
|
|
6
|
+
azimuth: 35,
|
|
7
|
+
altitude: 35,
|
|
8
|
+
ambientBrightness: 1,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export function modelLightingDefaults(overrides = {}) {
|
|
12
|
+
return normalizeModelLighting({ ...MODEL_LIGHTING_DEFAULTS, ...overrides });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const clamp = (value, min, max, fallback) => {
|
|
16
|
+
const number = typeof value === 'number' ? value : NaN;
|
|
17
|
+
return Number.isFinite(number) ? Math.min(max, Math.max(min, number)) : fallback;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @param {any} value @param {any} defaults */
|
|
21
|
+
export function normalizeModelLighting(value = {}, defaults = MODEL_LIGHTING_DEFAULTS) {
|
|
22
|
+
return Object.freeze({
|
|
23
|
+
schema: MODEL_LIGHTING_SCHEMA,
|
|
24
|
+
sunlight: typeof value.sunlight === 'boolean' ? value.sunlight : defaults.sunlight !== false,
|
|
25
|
+
sunBrightness: clamp(value.sunBrightness, 0, 2, defaults.sunBrightness),
|
|
26
|
+
azimuth: clamp(value.azimuth, 0, 359, defaults.azimuth),
|
|
27
|
+
altitude: clamp(value.altitude, 0, 90, defaults.altitude),
|
|
28
|
+
ambientBrightness: clamp(value.ambientBrightness, 0.25, 2, defaults.ambientBrightness),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function modelShadowsEnabled({ displayMode, hasEnvironment, sunlight } = {}) {
|
|
33
|
+
return displayMode === 'shadowed' && hasEnvironment === true && sunlight !== false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @param {{shadowsEnabled?: boolean, opacity?: number, excluded?: boolean}} options */
|
|
37
|
+
export function modelMeshCastsShadow({ shadowsEnabled, opacity = 1, excluded = false } = {}) {
|
|
38
|
+
return shadowsEnabled === true && excluded !== true && Number(opacity) >= 0.95;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const MODEL_LIGHTING_PROFILES = Object.freeze({
|
|
42
|
+
revit: MODEL_LIGHTING_DEFAULTS,
|
|
43
|
+
// This is the exact spherical direction of Steel master's established key vector [0.6, -1, 1.2].
|
|
44
|
+
// Keeping the derived angles here lets both the renderer and shared panel use that same baseline.
|
|
45
|
+
steel: modelLightingDefaults({ azimuth: 149.03624346792648, altitude: 45.81862253888889 }),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export function modelSunDirection(value) {
|
|
49
|
+
const state = normalizeModelLighting(value);
|
|
50
|
+
const azimuth = state.azimuth * Math.PI / 180;
|
|
51
|
+
const altitude = state.altitude * Math.PI / 180;
|
|
52
|
+
const horizontal = Math.cos(altitude);
|
|
53
|
+
return Object.freeze([
|
|
54
|
+
Math.sin(azimuth) * horizontal,
|
|
55
|
+
Math.cos(azimuth) * horizontal,
|
|
56
|
+
Math.sin(altitude),
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const storageKey = (profile) => `floless:model-lighting:${MODEL_LIGHTING_SCHEMA}:${profile}`;
|
|
61
|
+
const readPreference = (storage, profile, defaults) => {
|
|
62
|
+
try {
|
|
63
|
+
const parsed = JSON.parse(storage?.getItem(storageKey(profile)) || 'null');
|
|
64
|
+
return parsed?.schema === MODEL_LIGHTING_SCHEMA ? normalizeModelLighting(parsed, defaults) : defaults;
|
|
65
|
+
} catch (_) { return defaults; }
|
|
66
|
+
};
|
|
67
|
+
const writePreference = (storage, profile, state) => {
|
|
68
|
+
try { storage?.setItem(storageKey(profile), JSON.stringify(state)); } catch (_) {}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** @param {{trigger: any, anchor?: any, target: {setLighting: (value: any) => any}, profile?: string, storage?: Storage, documentRef?: any, windowRef?: any, defaults?: any}} options */
|
|
72
|
+
export function mountModelLightingPanel({
|
|
73
|
+
trigger, anchor = null, target, profile, storage = globalThis.localStorage,
|
|
74
|
+
documentRef = globalThis.document, windowRef = globalThis, defaults = null,
|
|
75
|
+
} = {}) {
|
|
76
|
+
if (!trigger) throw new Error('mountModelLightingPanel: trigger is required');
|
|
77
|
+
if (!target || typeof target.setLighting !== 'function') throw new Error('mountModelLightingPanel: target.setLighting is required');
|
|
78
|
+
const resetState = normalizeModelLighting(defaults || MODEL_LIGHTING_PROFILES[profile] || MODEL_LIGHTING_DEFAULTS);
|
|
79
|
+
let state = readPreference(storage, profile || 'model', resetState);
|
|
80
|
+
let open = false;
|
|
81
|
+
const panel = documentRef.createElement('section');
|
|
82
|
+
panel.className = 'model-lighting-panel';
|
|
83
|
+
panel.hidden = true;
|
|
84
|
+
panel.setAttribute('role', 'dialog');
|
|
85
|
+
panel.setAttribute('aria-modal', 'false');
|
|
86
|
+
panel.setAttribute('aria-label', 'Lighting settings');
|
|
87
|
+
panel.innerHTML = `
|
|
88
|
+
<div class="model-lighting-head"><strong>Lighting</strong><button type="button" class="model-lighting-close" data-tip="Close lighting settings" aria-label="Close lighting settings">×</button></div>
|
|
89
|
+
<p class="model-lighting-copy">Turn sunlight off for even, shadow-free shading. Changes apply as you move each control.</p>
|
|
90
|
+
<button type="button" class="model-lighting-switch" role="switch" aria-checked="true"><span>Sunlight</span><span class="model-lighting-switch-track" aria-hidden="true"><span></span></span></button>
|
|
91
|
+
<label class="model-lighting-field"><span>Sun brightness <output data-value="sunBrightness"></output></span><input name="sunBrightness" type="range" min="0" max="2" step="0.05"></label>
|
|
92
|
+
<label class="model-lighting-field"><span>Azimuth <output data-value="azimuth"></output></span><input name="azimuth" type="range" min="0" max="359" step="1"></label>
|
|
93
|
+
<label class="model-lighting-field"><span>Altitude <output data-value="altitude"></output></span><input name="altitude" type="range" min="0" max="90" step="1"></label>
|
|
94
|
+
<label class="model-lighting-field"><span>Ambient light <output data-value="ambientBrightness"></output></span><input name="ambientBrightness" type="range" min="0.25" max="2" step="0.05"></label>
|
|
95
|
+
<div class="model-lighting-foot"><button type="button" class="model-lighting-reset">Reset</button></div>`;
|
|
96
|
+
documentRef.body.append(panel);
|
|
97
|
+
const sunlight = panel.querySelector('.model-lighting-switch');
|
|
98
|
+
const fields = Object.fromEntries([...panel.querySelectorAll('input[type="range"]')].map((input) => [input.name, input]));
|
|
99
|
+
const format = (name, value) => name === 'azimuth' || name === 'altitude' ? `${Math.round(value)}°` : `${Math.round(value * 100)}%`;
|
|
100
|
+
const paint = () => {
|
|
101
|
+
sunlight.setAttribute('aria-checked', String(state.sunlight));
|
|
102
|
+
sunlight.classList.toggle('on', state.sunlight);
|
|
103
|
+
for (const [name, input] of Object.entries(fields)) {
|
|
104
|
+
input.value = String(state[name]);
|
|
105
|
+
input.disabled = !state.sunlight && name !== 'ambientBrightness';
|
|
106
|
+
panel.querySelector(`[data-value="${name}"]`).textContent = format(name, state[name]);
|
|
107
|
+
}
|
|
108
|
+
trigger.setAttribute('aria-pressed', String(open));
|
|
109
|
+
};
|
|
110
|
+
const apply = (patch, persist = true) => {
|
|
111
|
+
state = normalizeModelLighting({ ...state, ...patch }, resetState);
|
|
112
|
+
target.setLighting(state);
|
|
113
|
+
if (persist) writePreference(storage, profile || 'model', state);
|
|
114
|
+
paint();
|
|
115
|
+
};
|
|
116
|
+
const menu = trigger.closest('.m3dmenu');
|
|
117
|
+
const focusAnchor = anchor || trigger;
|
|
118
|
+
const position = (rect = null) => {
|
|
119
|
+
rect ||= focusAnchor.getBoundingClientRect();
|
|
120
|
+
const width = Math.min(320, Math.max(260, windowRef.innerWidth - 24));
|
|
121
|
+
const left = Math.min(windowRef.innerWidth - width - 12, Math.max(12, rect.left));
|
|
122
|
+
const top = Math.min(windowRef.innerHeight - panel.offsetHeight - 12, rect.bottom + 8);
|
|
123
|
+
panel.style.left = `${left}px`; panel.style.top = `${Math.max(12, top)}px`; panel.style.width = `${width}px`;
|
|
124
|
+
};
|
|
125
|
+
const close = (restoreFocus = false) => {
|
|
126
|
+
if (!open) return; open = false; panel.hidden = true; trigger.setAttribute('aria-pressed', 'false');
|
|
127
|
+
if (restoreFocus) focusAnchor.focus();
|
|
128
|
+
};
|
|
129
|
+
const show = () => {
|
|
130
|
+
const anchorRect = focusAnchor.getBoundingClientRect();
|
|
131
|
+
if (menu) { menu.classList.remove('open'); focusAnchor.setAttribute('aria-expanded', 'false'); }
|
|
132
|
+
open = true; panel.hidden = false; paint(); position(anchorRect);
|
|
133
|
+
panel.querySelector('.model-lighting-switch').focus();
|
|
134
|
+
};
|
|
135
|
+
const toggle = () => open ? close() : show();
|
|
136
|
+
const onTrigger = (event) => { event.preventDefault(); event.stopPropagation(); toggle(); };
|
|
137
|
+
const onDocument = (event) => { if (open && !panel.contains(event.target) && event.target !== trigger) close(); };
|
|
138
|
+
const onKey = (event) => { if (event.key === 'Escape' && open) { event.preventDefault(); event.stopPropagation(); close(true); } };
|
|
139
|
+
const onPanelKey = (event) => { if (event.key === 'Escape') onKey(event); else event.stopPropagation(); };
|
|
140
|
+
trigger.setAttribute('aria-haspopup', 'dialog');
|
|
141
|
+
trigger.addEventListener('click', onTrigger);
|
|
142
|
+
documentRef.addEventListener('mousedown', onDocument, true);
|
|
143
|
+
documentRef.addEventListener('keydown', onKey, true);
|
|
144
|
+
const onResize = () => { if (open) position(); };
|
|
145
|
+
windowRef.addEventListener('resize', onResize);
|
|
146
|
+
panel.addEventListener('keydown', onPanelKey);
|
|
147
|
+
sunlight.addEventListener('click', () => apply({ sunlight: !state.sunlight }));
|
|
148
|
+
for (const input of Object.values(fields)) input.addEventListener('input', () => apply({ [input.name]: Number(input.value) }));
|
|
149
|
+
panel.querySelector('.model-lighting-close').addEventListener('click', () => close(true));
|
|
150
|
+
panel.querySelector('.model-lighting-reset').addEventListener('click', () => apply(resetState));
|
|
151
|
+
apply(state, false);
|
|
152
|
+
return Object.freeze({
|
|
153
|
+
open: show, close: () => close(true), toggle,
|
|
154
|
+
state: () => ({ ...state }),
|
|
155
|
+
isOpen: () => open,
|
|
156
|
+
destroy() {
|
|
157
|
+
close();
|
|
158
|
+
trigger.removeEventListener('click', onTrigger);
|
|
159
|
+
documentRef.removeEventListener('mousedown', onDocument, true);
|
|
160
|
+
documentRef.removeEventListener('keydown', onKey, true);
|
|
161
|
+
windowRef.removeEventListener('resize', onResize);
|
|
162
|
+
panel.removeEventListener('keydown', onPanelKey);
|
|
163
|
+
panel.remove();
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
}
|