@homie-rocks/studio 0.56.0 → 0.58.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/apps/APPS.md +9 -0
  3. package/apps/apps.ts +19 -1
  4. package/docs/studio-to-studio.md +248 -0
  5. package/docs/toolkit-place-patterns.md +16 -0
  6. package/functions/FUNCTIONS.md +9 -0
  7. package/lib/cloudflare.mjs +3 -0
  8. package/lib/needs-headless.mjs +1 -1
  9. package/lib/studios-keys.mjs +13 -0
  10. package/lib/template-history.json +84 -0
  11. package/netplay/NETPLAY.md +7 -0
  12. package/package.json +1 -1
  13. package/parts/README.md +28 -0
  14. package/parts/catalogue.json +236 -0
  15. package/parts/owner-action-checklist/LICENSE +202 -0
  16. package/parts/owner-action-checklist/NOTICE +3 -0
  17. package/parts/owner-action-checklist/README.md +68 -0
  18. package/parts/owner-action-checklist/part.json +95 -0
  19. package/parts/owner-action-checklist/preview/index.html +16 -0
  20. package/parts/owner-action-checklist/src/handler.mjs +44 -0
  21. package/parts/owner-action-checklist/src/index.mjs +96 -0
  22. package/parts/owner-action-checklist/src/style.css +3 -0
  23. package/parts/owner-action-checklist/tuning.json +3 -0
  24. package/parts/terrain-route-map/LICENSE +202 -0
  25. package/parts/terrain-route-map/NOTICE +3 -0
  26. package/parts/terrain-route-map/README.md +67 -0
  27. package/parts/terrain-route-map/THIRD-PARTY-LICENSE +21 -0
  28. package/parts/terrain-route-map/part.json +133 -0
  29. package/parts/terrain-route-map/preview/demo.js +4127 -0
  30. package/parts/terrain-route-map/preview/heightmap.png +0 -0
  31. package/parts/terrain-route-map/preview/index.html +1 -0
  32. package/parts/terrain-route-map/preview/main.mjs +4 -0
  33. package/parts/terrain-route-map/preview/route.json +1 -0
  34. package/parts/terrain-route-map/src/data.mjs +81 -0
  35. package/parts/terrain-route-map/src/index.mjs +131 -0
  36. package/parts/terrain-route-map/src/style.css +3 -0
  37. package/parts/terrain-route-map/tuning.json +5 -0
  38. package/tools/TOOLS.md +16 -0
  39. package/tools/tools.ts +15 -2
  40. package/worker/booking-availability.mjs +35 -0
  41. package/worker/booking-calendar.mjs +15 -2
  42. package/worker/booking-holds.mjs +2 -2
  43. package/worker/booking-resources.mjs +14 -6
  44. package/worker/build-id.mjs +1 -1
  45. package/worker/business-events.mjs +2 -1
  46. package/worker/mcp-store.mjs +3 -1
  47. package/worker/mcp-tools.mjs +25 -2
  48. package/worker/mcp.mjs +43 -8
  49. package/worker/room.mjs +29 -0
  50. package/worker/routes.mjs +1 -1
  51. package/worker/studios-auth.mjs +71 -0
  52. package/worker/studios-client.mjs +93 -0
  53. package/worker/studios-events.mjs +52 -0
  54. package/worker/studios-keys.mjs +54 -0
  55. package/worker/version.mjs +1 -1
@@ -0,0 +1,96 @@
1
+ /** An action is a server-owned, revisioned proposal; the browser never supplies its consequence. */
2
+ export function validateItems(items) {
3
+ if (!Array.isArray(items) || items.length > 100) throw new Error('Expected at most 100 actions');
4
+ const ids = new Set();
5
+ for (const item of items) {
6
+ for (const key of ['id', 'revision', 'title', 'consequence', 'confirmLabel']) {
7
+ if (typeof item[key] !== 'string' || !item[key].trim() || item[key].length > 1000) throw new Error(`Invalid action ${key}`);
8
+ }
9
+ if (item.irreversible !== undefined && typeof item.irreversible !== 'boolean') throw new Error('Invalid irreversible flag');
10
+ if (ids.has(item.id)) throw new Error('Duplicate action id');
11
+ ids.add(item.id);
12
+ }
13
+ return items;
14
+ }
15
+
16
+ /** Plug in list() and execute({id,revision,operation,key}); reconcile uncertain writes before retrying. */
17
+ export function mountChecklist(root, { list, execute }) {
18
+ let disposed = false, generation = 0;
19
+ const states = new Map(), keys = new Map(), timers = new Set();
20
+ const prefix = `actions-${crypto.randomUUID()}`;
21
+ root.classList.add('owner-checklist');
22
+ const status = document.createElement('p'); status.setAttribute('role', 'status');
23
+ const rows = document.createElement('ul'); root.replaceChildren(status, rows);
24
+ const el = (tag, text) => { const node = document.createElement(tag); node.textContent = text; return node; };
25
+ async function refresh() {
26
+ const current = ++generation;
27
+ status.textContent = 'Loading actions…';
28
+ try {
29
+ const items = validateItems(await list());
30
+ if (disposed || current !== generation) return;
31
+ rows.replaceChildren();
32
+ const pending = new Set(items.map(item => item.id));
33
+ const announce = () => {status.textContent = pending.size ? `${pending.size} actions to review` : 'All caught up.';};
34
+ for (const item of items) {
35
+ const row = el('li', ''); const title = el('h2', item.title);
36
+ const consequence = el('p', item.consequence + (item.irreversible ? ' Irreversible — cannot be undone.' : '')); const note = el('p', 'Pending');
37
+ row.dataset.state = 'pending';
38
+ note.setAttribute('role', 'status');
39
+ const button = el('button', item.confirmLabel); button.type = 'button';
40
+ title.id = `${prefix}-${rows.children.length}-title`;
41
+ consequence.id = `${prefix}-${rows.children.length}-effect`;
42
+ button.setAttribute('aria-describedby', `${title.id} ${consequence.id}`);
43
+ let undoTimer;
44
+ const state = states.get(item.id);
45
+ if (state?.pending) { button.disabled = true; note.textContent = 'Outcome unknown. Refresh to reconcile before acting again.'; }
46
+ async function run(operation, grant) {
47
+ if (grant && Date.now() >= grant.undoExpiresAt) {button.hidden = true; return;}
48
+ if (button.disabled || disposed) return;
49
+ button.disabled = true; row.dataset.state = 'confirming'; button.textContent = operation === 'undo' ? 'Undoing…' : 'Confirming…'; note.textContent = button.textContent;
50
+ const revision = operation === 'undo' ? grant.undoRevision : item.revision;
51
+ const identity = JSON.stringify([item.id, revision, operation]);
52
+ if (!keys.has(identity)) keys.set(identity, crypto.randomUUID());
53
+ const key = keys.get(identity);
54
+ states.set(item.id, {revision: item.revision, key, pending:true});
55
+ try {
56
+ const result = await execute({id: item.id, revision, operation, key, ...(grant ? {token:grant.undoToken} : {})});
57
+ if (disposed) return;
58
+ if (!result || result.ok !== true) throw new Error('Unconfirmed outcome');
59
+ if (operation === 'undo') {clearTimeout(undoTimer); timers.delete(undoTimer);}
60
+ states.delete(item.id);
61
+ row.dataset.state = operation === 'undo' ? 'undone' : 'done';
62
+ pending.delete(item.id);
63
+ note.textContent = `${operation === 'undo' ? 'Undone' : 'Done'} — ${result.message || (operation === 'undo' ? 'Previous state restored.' : item.consequence)}`;
64
+ button.textContent = operation === 'undo' ? 'Undone' : 'Done';
65
+ if (operation === 'undo' && result.pendingItem) {
66
+ const restored = validateItems([result.pendingItem])[0];
67
+ if (restored.id !== item.id || restored.revision === item.revision) throw new Error('Wrong restored action');
68
+ Object.assign(item, restored); pending.add(item.id);
69
+ button.textContent = item.confirmLabel; button.disabled = false; button.hidden = false;
70
+ consequence.textContent = item.consequence + (item.irreversible ? ' Irreversible — cannot be undone.' : '');
71
+ title.textContent = item.title; button.onclick = () => run('confirm');
72
+ }
73
+ if (current === generation) announce();
74
+ if (operation === 'confirm' && typeof result.undoToken === 'string' && typeof result.undoRevision === 'string' && result.undoRevision !== item.revision && Number.isFinite(result.undoExpiresAt) && result.undoExpiresAt > Date.now() && !item.irreversible) {
75
+ button.textContent = 'Undo'; button.disabled = false;
76
+ button.onclick = () => run('undo', result);
77
+ const expire = () => {
78
+ if (Date.now() < result.undoExpiresAt) {schedule(); return;}
79
+ button.hidden = true; button.disabled = true;
80
+ };
81
+ const schedule = () => {const timer = undoTimer = setTimeout(() => {timers.delete(timer); expire();}, Math.min(2147483647, result.undoExpiresAt - Date.now())); timers.add(timer);};
82
+ schedule();
83
+ }
84
+ } catch {
85
+ states.set(item.id, {revision: item.revision, key, pending:false});
86
+ if (!disposed) note.textContent = 'Outcome unknown. Refresh to reconcile before acting again.';
87
+ }
88
+ }
89
+ button.onclick = () => run('confirm'); row.append(title, consequence, button, note); rows.append(row);
90
+ }
91
+ announce();
92
+ } catch { if (!disposed && current === generation) status.textContent = 'Actions could not be loaded. Try refreshing.'; }
93
+ }
94
+ const ready = refresh();
95
+ return {ready, refresh, dispose() { disposed = true; for (const timer of timers) clearTimeout(timer); timers.clear(); root.replaceChildren(); }};
96
+ }
@@ -0,0 +1,3 @@
1
+ .owner-checklist{font:16px/1.5 system-ui;color:var(--checklist-ink,#ecf3f0);max-width:52rem;margin:auto}.owner-checklist ul{list-style:none;padding:0;display:grid;gap:12px}.owner-checklist li{background:var(--checklist-card,#182b2b);border:1px solid #49605e;border-radius:18px;padding:20px;display:grid;grid-template-columns:1fr auto;gap:6px 16px}.owner-checklist h2{font-size:1.15rem;margin:0}.owner-checklist p{margin:0;grid-column:1}.owner-checklist button{grid-column:2;grid-row:1/3;align-self:center;min-height:48px;min-width:88px;border:0;border-radius:12px;padding:12px 18px;background:var(--checklist-accent,#cbef9c);color:#142723;font:600 1rem system-ui;cursor:pointer}.owner-checklist button:disabled{background:#526562;color:#e2e9e7;cursor:default}.owner-checklist button:focus-visible{outline:3px solid white;outline-offset:4px}.owner-checklist [role=status]{font-size:.9rem;color:#b9ccc7}.owner-checklist li [role=status]{grid-column:1/-1}@media(max-width:480px){.owner-checklist li{grid-template-columns:1fr}.owner-checklist button{grid-column:1;grid-row:auto;width:100%;margin-top:8px}}
2
+
3
+ .owner-checklist li[data-state=done]{border-color:#a0c88b}.owner-checklist li[data-state=undone]{border-color:#efcf8c}.owner-checklist li[data-state=confirming]{border-color:#eef5e3}.owner-checklist li [role=status]{font-weight:600}
@@ -0,0 +1,3 @@
1
+ {
2
+ "accent": "#cbef9c"
3
+ }
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,3 @@
1
+ Terrain route map
2
+ Copyright 2026 Ryan Campbell <ryan@ryancampbell.com>
3
+ Homie toolkit
@@ -0,0 +1,67 @@
1
+ # Terrain route map
2
+
3
+ An offline-capable three.js coastal heightfield with a draped route tube, markers,
4
+ text labels, touch orbit/pinch and keyboard/TV camera buttons. No tile service is needed.
5
+
6
+ ## For the AI integrating this part
7
+
8
+ Import `mountTerrainMap` from `@parts/terrain-route-map` and include `src/style.css`.
9
+ Give its root an explicit height (minimum 360 px). Await `mountTerrainMap(root,data,options)`;
10
+ catch load/WebGL failures in your app. Call `dispose()` on navigation to release GPU resources,
11
+ observers and listeners. It returns `command('left'|'right'|'up'|'down'|'in'|'out'|'reset')`,
12
+ `camera`, `renderer`, and `render()` (invalidate after your own camera change).
13
+
14
+ `data` is JSON, illustrated by `preview/route.json`:
15
+
16
+ - `bounds: [minX,minZ,maxX,maxZ]`: finite local planar coordinates, in metres.
17
+ - `heightmap`: same-origin PNG URL, maximum 2048×2048; 128×128 or larger is suitable; the default mesh has 192 segments.
18
+ Red channel 0…255 maps linearly to 0…`height` metres. Row zero is **minZ**, column zero
19
+ is **minX**. No georeferencing, colour-profile elevation interpretation or alpha mask.
20
+ - `height`: positive elevation range; `seaLevel`: water elevation, at least zero, below height.
21
+ - `route: {type:'LineString',coordinates:[[x,z],…]}`: 2…2048 points inside bounds,
22
+ with no consecutive duplicates. This is GeoJSON-like **local coordinates, not longitude/latitude**.
23
+ - `markers: [{coordinates:[x,z],label:'Lookout'}]`: at most 32 text labels, 80 characters each.
24
+
25
+ Route segments are densified and lifted above terrain/water. Keep data within the documented
26
+ budget; excessive total length is refused. The route is a visual guide, not collision or
27
+ navigation geometry. Labels project to screen space with leader lines and greedy collision avoidance. Overflow
28
+ labels are hidden visually but all markers remain in the accessible list. Curate marker density.
29
+ An optional adapter can convert your own geographic data into this format before mounting;
30
+ it must project longitude/latitude, handle attribution and provide its own heightmap.
31
+
32
+ Options: `segments` integer 8…256 (default 192), `pixelRatio` .5…2 (default cap 1.5),
33
+ `quality: 'auto'|'full'|'lite'` (default auto). Smooth vertex normals, sun/hemisphere lighting,
34
+ baked cavity shading, sky and distance haze need no shadow or postprocessing passes.
35
+ Water samples the heightmap for depth colour and animated foam. Instanced highlights flow
36
+ along the elevation-aware tube. A gentle 2.2-second camera introduction stops on interaction.
37
+ Respect reduced motion: no intro, water/flow animation or recurring frames in that mode.
38
+ Rendering pauses offscreen or in hidden documents.
39
+
40
+ Auto quality measures animation frame intervals after the first two seconds. After 90 samples,
41
+ if over 25% exceed 28 ms, it switches once to lite: pixel ratio capped at 1, every second
42
+ terrain grid cell drawn (even segment counts), subdued water highlights. Hidden gaps above
43
+ 250 ms are excluded. `map.quality` exposes the selected mode. This measures combined browser
44
+ frame delivery, not device identity; explicitly choose lite for known low-end devices.
45
+ Lite keeps the shoreline, labels and route. No external tile or other network service is used. Touch drag rotates, pinch zooms; arrows rotate, +/- zoom and Home
46
+ resets while the canvas is focused. Camera buttons work with Tab/Enter or TV focus navigation.
47
+ For TV remote bridges call `command`; this part does not claim a hardware remote protocol.
48
+
49
+ `preview/index.html` is self-contained with its local `demo.js` bundle, PNG and JSON.
50
+ Regenerate through `node scripts/build-shared-parts.mjs`; the bundle includes three.js's
51
+ MIT notice. The source continues to import the toolkit's pinned three.js stack through npm.
52
+
53
+ ## Built from / rights
54
+
55
+ Original reusable map from **Terrain route map**, Homie toolkit; Ryan Campbell.
56
+ Original analytic heightmap and route, no survey data, imagery or third-party parts.
57
+ three.js 0.185.1 (MIT), OrbitControls (MIT). Part source/data Apache-2.0; preserve LICENSE,
58
+ NOTICE, THIRD-PARTY-LICENSE and attribution. See `proof/parts-161/README.md` in the
59
+ repository for measured device-emulation costs and limitations.
60
+
61
+ ### Heightmap security
62
+
63
+ Heightmaps must be PNG files, 2–2048 pixels per axis, served as `image/png`, at most
64
+ 16 MiB compressed. The loader validates the PNG header before decoding. URLs must use
65
+ HTTP(S), have a `.png` pathname, and be same-origin; explicitly trusted CDN origins can
66
+ be passed in `mountTerrainMap` options as `allowedOrigins`. Credentials in URLs and
67
+ redirects are rejected. Keep this allowlist in application code, not imported map data.
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright © 2010-2026 three.js authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,133 @@
1
+ {
2
+ "id": "terrain-route-map",
3
+ "name": "Terrain route map",
4
+ "kind": "environment",
5
+ "version": "1.0.0",
6
+ "summary": "Local heightmap coastline with a draped route tube, markers and touch or TV camera controls.",
7
+ "license": "Apache-2.0",
8
+ "attribution": "Ryan Campbell — Homie toolkit",
9
+ "share": true,
10
+ "tags": [
11
+ "terrain",
12
+ "map",
13
+ "route",
14
+ "heightmap",
15
+ "three",
16
+ "camera"
17
+ ],
18
+ "uses": [
19
+ "app",
20
+ "game"
21
+ ],
22
+ "files": [
23
+ {
24
+ "path": "LICENSE",
25
+ "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30",
26
+ "bytes": 11358
27
+ },
28
+ {
29
+ "path": "NOTICE",
30
+ "sha256": "5f149927ffe3253d38a25acfb7f1a02bd00c4b4a5b36b5e468b0e0b22f9319be",
31
+ "bytes": 85
32
+ },
33
+ {
34
+ "path": "README.md",
35
+ "sha256": "2cddd8172fafb31f126e2d7930a90376797cc169d8f5bcf33efc859ad290c8a4",
36
+ "bytes": 4628
37
+ },
38
+ {
39
+ "path": "THIRD-PARTY-LICENSE",
40
+ "sha256": "8b378ebe60e2fe500158cb0ac71cb5e8b7d92953c2abcc63a0eb90499653b5bc",
41
+ "bytes": 1081,
42
+ "rights": {
43
+ "license": "MIT"
44
+ }
45
+ },
46
+ {
47
+ "path": "preview/demo.js",
48
+ "sha256": "8f0c03e5e84e8eda9175c891afe889a0e86bb8241f0fa58ae67da963a5470544",
49
+ "bytes": 580288,
50
+ "rights": {
51
+ "license": "Apache-2.0 AND MIT"
52
+ }
53
+ },
54
+ {
55
+ "path": "preview/heightmap.png",
56
+ "sha256": "35791172bf7ec80a607e700c1191727383b7158dedc2d02667c5f1fa8da924e1",
57
+ "bytes": 52522
58
+ },
59
+ {
60
+ "path": "preview/index.html",
61
+ "sha256": "9d5ffa3179a2fe2ebc7a1f146fee1a02f2e0fcfe5186512bfdfb9ccccde1b6a5",
62
+ "bytes": 985
63
+ },
64
+ {
65
+ "path": "preview/main.mjs",
66
+ "sha256": "36b7799ed3b0c1dc95aa8ee452638b5ebaf303118421785ee333fb5078f12c44",
67
+ "bytes": 386
68
+ },
69
+ {
70
+ "path": "preview/route.json",
71
+ "sha256": "d505766350b5556c386abb05076d142bf825099c2a2d46135db2a81a4d0a770e",
72
+ "bytes": 321
73
+ },
74
+ {
75
+ "path": "src/data.mjs",
76
+ "sha256": "740608c324ccbe7a75d2d61831f5d266e6c5def7508f03f8c3013508d8c8658c",
77
+ "bytes": 5470
78
+ },
79
+ {
80
+ "path": "src/index.mjs",
81
+ "sha256": "5a17552670519c28a818e6ffa849da930f785f9599af7de75342b43207452ef1",
82
+ "bytes": 13814
83
+ },
84
+ {
85
+ "path": "src/style.css",
86
+ "sha256": "7354c997deec0933674a759e7f1e8027f7126eb59db5166ded82771d25acf7b1",
87
+ "bytes": 1580
88
+ },
89
+ {
90
+ "path": "tuning.json",
91
+ "sha256": "ab68f2f4b6cc5ac13d58519ac0ad6932f88402dc203d90af04313fb72b8452a7",
92
+ "bytes": 64
93
+ }
94
+ ],
95
+ "preview": {
96
+ "page": "preview/index.html",
97
+ "aspect": "4:3",
98
+ "phoneAspect": "2:3"
99
+ },
100
+ "requires": {
101
+ "packages": {
102
+ "three": "0.185.1"
103
+ }
104
+ },
105
+ "physical": {
106
+ "units": "metres",
107
+ "scale": 1,
108
+ "pivot": "origin",
109
+ "collision": null
110
+ },
111
+ "cost": {
112
+ "bytes": 672582
113
+ },
114
+ "provenance": {
115
+ "source": "original",
116
+ "notes": "Original code and example data authored for the Homie toolkit."
117
+ },
118
+ "entry": "src/index.mjs",
119
+ "contract": {
120
+ "inputs": {
121
+ "data": "See README; local LineString, bounds and PNG heightmap"
122
+ },
123
+ "state": {
124
+ "camera": "local"
125
+ },
126
+ "netplay": "local"
127
+ },
128
+ "from": {
129
+ "kind": "app",
130
+ "id": "terrain-route-map",
131
+ "studio": "Homie toolkit"
132
+ }
133
+ }