@limrun/ui 0.21.0 → 0.22.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.
Files changed (46) hide show
  1. package/README.md +36 -8
  2. package/dist/BufferGeometryUtils-B2-bJqFj.js +1 -0
  3. package/dist/BufferGeometryUtils-BcXIkYhS.mjs +64 -0
  4. package/dist/{GLTFLoader-D4AITfgZ.mjs → GLTFLoader-BQvr_TBF.mjs} +138 -137
  5. package/dist/GLTFLoader-CsxjkQ8a.js +1 -0
  6. package/dist/components/device-stage.d.ts +61 -0
  7. package/dist/components/device-view.d.ts +29 -0
  8. package/dist/components/duo-frame.d.ts +5 -1
  9. package/dist/components/duo-model.d.ts +2 -1
  10. package/dist/components/macbook-frame.d.ts +30 -0
  11. package/dist/components/macbook-geometry.d.ts +77 -0
  12. package/dist/components/model-source.d.ts +8 -0
  13. package/dist/components/remote-control.d.ts +40 -1
  14. package/dist/components/studio-environment.d.ts +6 -0
  15. package/dist/core/mac-pointer.d.ts +56 -0
  16. package/dist/{core-CRIachT9.mjs → core-nbvkIrvp.mjs} +24 -24
  17. package/dist/core.js +12 -12
  18. package/dist/duo-frame-B04_gIge.js +11 -0
  19. package/dist/duo-frame-CyoWZakh.mjs +748 -0
  20. package/dist/duo-model-BYgtCaCR.mjs +4 -0
  21. package/dist/duo-model-CDWgmLRF.js +1 -0
  22. package/dist/duo-model.d.ts +2 -0
  23. package/dist/duo-view-BHwnQmx_.js +1 -0
  24. package/dist/{duo-view-BeqYIqfQ.mjs → duo-view-DJEQ3Q74.mjs} +84 -86
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.css +1 -1
  27. package/dist/index.js +32 -25
  28. package/dist/lite.cjs +1 -1
  29. package/dist/lite.js +2 -2
  30. package/dist/macbook-frame-Be0dCliH.js +3 -0
  31. package/dist/macbook-frame-DzwIHHCA.mjs +344 -0
  32. package/dist/macbook-model-BiMxLpmf.mjs +4 -0
  33. package/dist/macbook-model-BpUdvtlU.js +1 -0
  34. package/dist/macbook-model.d.ts +2 -0
  35. package/dist/meshopt_decoder.module-C4Z_evpr.mjs +217 -0
  36. package/dist/meshopt_decoder.module-DxJdu6ez.js +1 -0
  37. package/dist/{duo-frame-D1JK_cRk.mjs → model-source-BAZAKTcr.mjs} +6184 -6894
  38. package/dist/model-source-DbYJQWkh.js +4049 -0
  39. package/dist/remote-control-Db6ssV0S.js +1 -0
  40. package/dist/remote-control-PGtDEDgm.mjs +1746 -0
  41. package/package.json +1 -1
  42. package/dist/GLTFLoader-C25N9Y4j.js +0 -1
  43. package/dist/duo-frame-B1NXSk6a.js +0 -4059
  44. package/dist/duo-view-PsR5b045.js +0 -1
  45. package/dist/remote-control-DNr0Pyrx.js +0 -1
  46. package/dist/remote-control-rdm3mDtI.mjs +0 -1299
package/README.md CHANGED
@@ -10,12 +10,34 @@ See [examples](../../examples/) to see how it can be used.
10
10
 
11
11
  `@limrun/ui` bundles Limrun's device frames and boot logos as inline images, about
12
12
  600 KB. Embeds that render the bare screen can import `@limrun/ui/lite` instead: the same
13
- `RemoteControl` API without any artwork, so `showFrame` has nothing to draw and the boot
13
+ `RemoteControl` API without any artwork, so `showFrame` has no phone frame to draw and the boot
14
14
  logo is omitted. Pass your own images through the `assets` prop if you want frames back.
15
15
 
16
16
  `onConnectionStateChange` reports `connecting`, `connected`, `reconnecting`, `failed`, and
17
17
  `terminated` so a host can show status text without tracking the retry logic.
18
18
 
19
+ ## MacBook frame
20
+
21
+ A macOS guest streams inside a MacBook Pro. The default entry draws it with an image rendered from a
22
+ 3D model, with the stream in the screen's opening; `@limrun/ui/lite` draws a plainer one in CSS.
23
+ Neither draws it when `showFrame` is false.
24
+
25
+ A 2D and 3D switch above the MacBook turns it into a 3D model, like the iPhone Duo's, with the
26
+ stream on its screen. The 3D MacBook opens its lid when it appears; set `animateLid={false}` to show
27
+ it open from the start. The default entry bundles the 3D model, about 1.5 MB, in a chunk of its own.
28
+ Your bundler splits it out with three.js, and a browser downloads them only when a viewer picks 3D,
29
+ so the 2D stream's first frame never waits for them. The lite entry has no model and draws a
30
+ simpler built-in MacBook in 3D.
31
+
32
+ To serve the model yourself, or another prepared one, pass its URL as `macbookModelUrl`.
33
+ `scripts/prepare-macbook-model.mjs` makes one from the source model and lists the nodes the 3D
34
+ MacBook expects, and `scripts/render-macbook-frame.ts` renders the 2D image from it.
35
+
36
+ The MacBook Pro image and model come from
37
+ [macbook pro M3 16 inch 2024](https://sketchfab.com/3d-models/8e34fc2b303144f78490007d91ff57c4) by
38
+ jackbaeten, licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Its wallpaper
39
+ and lettering are removed, its lid is posed on its hinge, and its textures and meshes are compressed.
40
+
19
41
  ## Reconnecting
20
42
 
21
43
  `RemoteControl` and `createDeviceStream` automatically retry a dropped session by
@@ -139,7 +161,7 @@ This package is not part of generated SDK, hence you need to publish it manually
139
161
  `RemoteControl` discovers native Duo support and starts in 2D with native video
140
162
  inside a silver Duo frame, including its hinge spine and physical buttons.
141
163
  Both modes share the fold, hinge-angle and rotation toolbar. No model prop is required. Select **3D**
142
- to load the interactive frame and its model on demand. Returning to **2D** releases
164
+ to load the interactive frame and its bundled model on demand. Returning to **2D** releases
143
165
  the renderer and its graphics resources without reconnecting the simulator.
144
166
 
145
167
  ```tsx
@@ -180,14 +202,20 @@ accessibility inspection and the existing recording API do not follow the
180
202
  inner display. Use `screenshotDisplay` and `tapDisplay` from the TypeScript
181
203
  iOS client for explicit display automation.
182
204
 
183
- ### Optional Duo appearance
205
+ ### Duo appearance
206
+
207
+ The default entry bundles a Star White Duo appearance, about 1.4 MB, in a chunk of its own. A browser
208
+ downloads it only when a viewer picks 3D, so the 2D stream never waits for it. The lite entry has
209
+ no appearance and draws the built-in body. Live simulator screens, hinge control and input work
210
+ either way, and a failed load keeps the built-in body and reports the error.
184
211
 
185
- `duoModelUrl` replaces the rigid body with a host-supplied GLB. The host provides
186
- and licenses the asset; no third-party model is bundled with this package.
187
- Live simulator screens, hinge control and input remain active. A failed load keeps
188
- the built-in frame available and reports the error.
212
+ The original model and textures are by Apple, and Apple and the respective owners retain their
213
+ rights. The conversion and folding geometry come from
214
+ [jal-co/iphone-duo](https://github.com/jal-co/iphone-duo/blob/3674f3343d20a72fd6c7277bdd5cfeffc9216f7d/THIRD_PARTY.md)
215
+ at commit `3674f33`, whose MIT code license does not cover the asset. Limrun optimized the
216
+ geometry, removed embedded textures, adjusted materials and added screen and button metadata.
189
217
 
190
- The prepared model must contain `folding-half` and `stationary-half` groups with
218
+ `duoModelUrl` replaces the bundled appearance with a GLB you serve. The prepared model must contain `folding-half` and `stationary-half` groups with
191
219
  flat mesh children measured in centimeters. Inner display surfaces lie in the
192
220
  XY plane, centered at the hinge with positive Z facing the inner display.
193
221
  Material names `inner-screen` and `cover-screen` identify surfaces replaced by live
@@ -0,0 +1 @@
1
+ "use strict";const r=require("./model-source-DbYJQWkh.js");function I(n,a){if(a===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(a===r.TriangleFanDrawMode||a===r.TriangleStripDrawMode){let o=n.getIndex();if(o===null){const e=[],m=n.getAttribute("position");if(m!==void 0){for(let c=0;c<m.count;c++)e.push(c);n.setIndex(e),o=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const f=o.count-2,t=[];if(a===r.TriangleFanDrawMode)for(let e=1;e<=f;e++)t.push(o.getX(0)),t.push(o.getX(e)),t.push(o.getX(e+1));else for(let e=0;e<f;e++)e%2===0?(t.push(o.getX(e)),t.push(o.getX(e+1)),t.push(o.getX(e+2))):(t.push(o.getX(e+2)),t.push(o.getX(e+1)),t.push(o.getX(e)));t.length/3!==f&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const u=n.clone();return u.setIndex(t),u.clearGroups(),u}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",a),n}function N(n,a=Math.PI/3){const o=Math.cos(a),f=(1+1e-10)*100,t=[new r.Vector3,new r.Vector3,new r.Vector3],u=new r.Vector3,e=new r.Vector3,m=new r.Vector3,c=new r.Vector3;function D(s){const p=~~(s.x*f),i=~~(s.y*f),w=~~(s.z*f);return`${p},${i},${w}`}const T=n.index?n.toNonIndexed():n,l=T.attributes.position,V={};for(let s=0,p=l.count/3;s<p;s++){const i=3*s,w=t[0].fromBufferAttribute(l,i+0),b=t[1].fromBufferAttribute(l,i+1),A=t[2].fromBufferAttribute(l,i+2);u.subVectors(A,b),e.subVectors(w,b);const d=new r.Vector3().crossVectors(u,e).normalize();for(let g=0;g<3;g++){const x=t[g],h=D(x);h in V||(V[h]=[]),V[h].push(d)}}const E=new Float32Array(l.count*3),M=new r.BufferAttribute(E,3,!1);for(let s=0,p=l.count/3;s<p;s++){const i=3*s,w=t[0].fromBufferAttribute(l,i+0),b=t[1].fromBufferAttribute(l,i+1),A=t[2].fromBufferAttribute(l,i+2);u.subVectors(A,b),e.subVectors(w,b),m.crossVectors(u,e).normalize();for(let d=0;d<3;d++){const g=t[d],x=D(g),h=V[x];c.set(0,0,0);for(let B=0,G=h.length;B<G;B++){const X=h[B];m.dot(X)>o&&c.add(X)}c.normalize(),M.setXYZ(i+d,c.x,c.y,c.z)}}return T.setAttribute("normal",M),T}exports.toCreasedNormals=N;exports.toTrianglesDrawMode=I;
@@ -0,0 +1,64 @@
1
+ import { d as u, j as U, k as z, m as G, n as N } from "./model-source-BAZAKTcr.mjs";
2
+ function y(n, l) {
3
+ if (l === z)
4
+ return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), n;
5
+ if (l === G || l === N) {
6
+ let o = n.getIndex();
7
+ if (o === null) {
8
+ const t = [], h = n.getAttribute("position");
9
+ if (h !== void 0) {
10
+ for (let s = 0; s < h.count; s++)
11
+ t.push(s);
12
+ n.setIndex(t), o = n.getIndex();
13
+ } else
14
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), n;
15
+ }
16
+ const f = o.count - 2, e = [];
17
+ if (l === G)
18
+ for (let t = 1; t <= f; t++)
19
+ e.push(o.getX(0)), e.push(o.getX(t)), e.push(o.getX(t + 1));
20
+ else
21
+ for (let t = 0; t < f; t++)
22
+ t % 2 === 0 ? (e.push(o.getX(t)), e.push(o.getX(t + 1)), e.push(o.getX(t + 2))) : (e.push(o.getX(t + 2)), e.push(o.getX(t + 1)), e.push(o.getX(t)));
23
+ e.length / 3 !== f && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
24
+ const a = n.clone();
25
+ return a.setIndex(e), a.clearGroups(), a;
26
+ } else
27
+ return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", l), n;
28
+ }
29
+ function H(n, l = Math.PI / 3) {
30
+ const o = Math.cos(l), f = (1 + 1e-10) * 100, e = [new u(), new u(), new u()], a = new u(), t = new u(), h = new u(), s = new u();
31
+ function X(r) {
32
+ const d = ~~(r.x * f), i = ~~(r.y * f), b = ~~(r.z * f);
33
+ return `${d},${i},${b}`;
34
+ }
35
+ const A = n.index ? n.toNonIndexed() : n, c = A.attributes.position, x = {};
36
+ for (let r = 0, d = c.count / 3; r < d; r++) {
37
+ const i = 3 * r, b = e[0].fromBufferAttribute(c, i + 0), w = e[1].fromBufferAttribute(c, i + 1), T = e[2].fromBufferAttribute(c, i + 2);
38
+ a.subVectors(T, w), t.subVectors(b, w);
39
+ const p = new u().crossVectors(a, t).normalize();
40
+ for (let g = 0; g < 3; g++) {
41
+ const B = e[g], m = X(B);
42
+ m in x || (x[m] = []), x[m].push(p);
43
+ }
44
+ }
45
+ const M = new Float32Array(c.count * 3), D = new U(M, 3, !1);
46
+ for (let r = 0, d = c.count / 3; r < d; r++) {
47
+ const i = 3 * r, b = e[0].fromBufferAttribute(c, i + 0), w = e[1].fromBufferAttribute(c, i + 1), T = e[2].fromBufferAttribute(c, i + 2);
48
+ a.subVectors(T, w), t.subVectors(b, w), h.crossVectors(a, t).normalize();
49
+ for (let p = 0; p < 3; p++) {
50
+ const g = e[p], B = X(g), m = x[B];
51
+ s.set(0, 0, 0);
52
+ for (let V = 0, I = m.length; V < I; V++) {
53
+ const E = m[V];
54
+ h.dot(E) > o && s.add(E);
55
+ }
56
+ s.normalize(), D.setXYZ(i + p, s.x, s.y, s.z);
57
+ }
58
+ }
59
+ return A.setAttribute("normal", D), A;
60
+ }
61
+ export {
62
+ H as a,
63
+ y as t
64
+ };