@openmockup-studio/player 0.0.0-stage → 0.2.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.
@@ -0,0 +1,366 @@
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { A as t, H as n, I as r, L as i, M as a, P as o, W as s, Y as c, f as l, h as u, k as d, p as f, s as p, u as m, v as h, x as g } from "./three-o_76Nw0r.js";
3
+ import { D as _, E as v, a as y, d as b, f as x, i as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k } from "./device-phone-DxWL5LkW.js";
4
+ // ../devices/src/monitor/build.ts
5
+ var A = Math.PI / 180;
6
+ function j() {
7
+ let e = new t({
8
+ color: 328966,
9
+ roughness: .9,
10
+ transparent: !0,
11
+ depthWrite: !1
12
+ });
13
+ return {
14
+ gap: new t({
15
+ color: 394759,
16
+ roughness: .8
17
+ }),
18
+ socket: new t({
19
+ color: 2763309,
20
+ roughness: .6
21
+ }),
22
+ vent: e,
23
+ pad: new t({
24
+ color: 657931,
25
+ roughness: .6
26
+ }),
27
+ cameraHousing: M(855312),
28
+ cameraLens: M(328967),
29
+ cameraWindow: M(724260),
30
+ cameraPupil: M(0)
31
+ };
32
+ }
33
+ function M(e) {
34
+ return new d({
35
+ color: e,
36
+ roughness: .6,
37
+ specularIntensity: 0,
38
+ clearcoat: 1,
39
+ clearcoatRoughness: .02
40
+ });
41
+ }
42
+ function N(e, t) {
43
+ x(e, t), e.frame.anisotropy = 0;
44
+ }
45
+ function P(e, t, n = "high") {
46
+ let r = y[n], i = D(t), a = j();
47
+ N(i, t);
48
+ let o = z(e.vents);
49
+ o ? a.vent.alphaMap = o : a.vent.opacity = .35;
50
+ let s = new g();
51
+ I(e, i, a, s, r);
52
+ let { barrel: c } = e.stand, l = new g();
53
+ l.position.set(0, c.y, c.z), s.add(l);
54
+ let u = new g();
55
+ u.position.set(0, e.hinge.drop, e.hinge.behind), l.add(u);
56
+ let { displayMesh: d, aspect: f } = F(e, i, a, u, r), m = (e) => {
57
+ l.rotation.x = -e * A;
58
+ };
59
+ m(0);
60
+ let h = w(d, f, i);
61
+ return {
62
+ group: s,
63
+ screens: [h],
64
+ bounds: new p().setFromObject(s),
65
+ params: { tilt: {
66
+ min: -5,
67
+ max: 25,
68
+ default: 0,
69
+ unit: "deg",
70
+ label: "Tilt"
71
+ } },
72
+ restsOnFloor: !0,
73
+ setParam(e, t) {
74
+ e === "tilt" && m(t);
75
+ },
76
+ setFinish: (e) => N(i, e),
77
+ setGlare: (e, t) => {
78
+ h.setGlare(e, t);
79
+ for (let e of [
80
+ a.cameraHousing,
81
+ a.cameraLens,
82
+ a.cameraWindow,
83
+ a.cameraPupil
84
+ ]) e.clearcoat = i.glass.clearcoat;
85
+ },
86
+ dispose: () => {
87
+ a.vent.alphaMap?.dispose(), _(s);
88
+ }
89
+ };
90
+ }
91
+ function F(e, t, n, r, a) {
92
+ let { width: s, height: c, depth: u, radius: d, glass: f } = e.panel, p = -f - .03, m = -u, h = [
93
+ [.04, p],
94
+ [.012, p - .012],
95
+ [0, p - .04],
96
+ [0, m + .04],
97
+ [.012, m + .012],
98
+ [.04, m]
99
+ ];
100
+ E(r, O({
101
+ width: s,
102
+ height: c,
103
+ radius: d,
104
+ exponent: 2,
105
+ segments: a.corner,
106
+ profile: h
107
+ }), t.frame), E(r, k(s - .08, c - .08, d - .04, 2, a), n.gap, { z: p }), E(r, C({
108
+ width: s,
109
+ height: c,
110
+ depth: f,
111
+ radius: d,
112
+ edge: .02,
113
+ quality: a
114
+ }), t.glass, { z: -f / 2 });
115
+ let _ = s - 2 * e.bezel, y = _ * e.display.px[1] / e.display.px[0], b = E(r, T(k(_, y, .05, 2, a)), t.display, { z: S }), x = c / 2 - e.cameraFromTop;
116
+ E(r, new l(.22, a.round), n.cameraHousing, {
117
+ y: x,
118
+ z: S * 2
119
+ }), E(r, new l(.17, a.round), n.cameraLens, {
120
+ y: x,
121
+ z: S * 3
122
+ }), E(r, new l(.15, a.round), n.cameraWindow, {
123
+ y: x,
124
+ z: S * 4
125
+ }), E(r, new l(.06, a.round), n.cameraPupil, {
126
+ y: x,
127
+ z: S * 5
128
+ }), E(r, new l(.05, a.round), n.cameraHousing, {
129
+ x: .73,
130
+ y: x,
131
+ z: S * 2
132
+ });
133
+ let { vents: w } = e, D = -w.centre, A = new o(w.length, w.band);
134
+ n.vent.alphaMap && n.vent.alphaMap.repeat.set(w.length / (w.pitch * 2), 1), E(r, A, n.vent, {
135
+ y: c / 2 + S,
136
+ z: D,
137
+ rx: -Math.PI / 2
138
+ }), E(r, A, n.vent, {
139
+ y: -c / 2 - S,
140
+ z: D,
141
+ rx: Math.PI / 2
142
+ });
143
+ let j = new g();
144
+ j.position.z = m, j.rotation.y = Math.PI, r.add(j), E(j, k(s - .08, c - .08, d - .04, 2, a), t.frame), e.branding !== !1 && E(j, v(e.logo.height), t.logo, {
145
+ y: e.logo.raise,
146
+ z: S
147
+ });
148
+ let { power: M } = e;
149
+ E(j, new i(M.radius - .05, M.radius, a.round), n.gap, {
150
+ y: -M.drop,
151
+ z: S
152
+ }), E(j, new l(.54, a.round), n.gap, {
153
+ y: -M.drop,
154
+ z: S
155
+ }), E(j, new l(.36, a.round), n.socket, {
156
+ y: -M.drop,
157
+ z: S * 2
158
+ });
159
+ let { ports: N } = e, P = k(N.width, N.height, N.width / 2, 2, a), F = k(.07, N.height * .62, .035, 2, a);
160
+ for (let e of N.x) E(j, P, n.gap, {
161
+ x: -e,
162
+ y: -N.drop,
163
+ z: S
164
+ }), E(j, F, n.socket, {
165
+ x: -e,
166
+ y: -N.drop,
167
+ z: S * 2
168
+ });
169
+ let { barrel: I } = e.stand, L = e.hinge.behind - u;
170
+ return E(r, C({
171
+ width: I.bracket - .06,
172
+ height: 1.3,
173
+ depth: L + .3,
174
+ radius: .3,
175
+ edge: .05,
176
+ quality: a
177
+ }), t.frame, {
178
+ y: -e.hinge.drop,
179
+ z: m - L / 2 + .15
180
+ }), {
181
+ displayMesh: b,
182
+ aspect: _ / y
183
+ };
184
+ }
185
+ function I(e, t, n, r, i) {
186
+ let a = e.stand, { foot: o } = a, s = o.pad + o.thickness;
187
+ E(r, C({
188
+ width: a.width,
189
+ height: o.depth,
190
+ depth: o.thickness,
191
+ radius: o.radius,
192
+ edge: .06,
193
+ quality: i
194
+ }), t.frame, {
195
+ y: o.pad + o.thickness / 2,
196
+ rx: -Math.PI / 2
197
+ }), E(r, C({
198
+ width: a.width - .38,
199
+ height: o.depth - .46,
200
+ depth: o.pad + .05,
201
+ radius: o.radius - .2,
202
+ edge: .02,
203
+ quality: i
204
+ }), n.pad, {
205
+ y: (o.pad + .05) / 2,
206
+ rx: -Math.PI / 2
207
+ });
208
+ let l = a.lean * A, d = new c(Math.sin(l), Math.cos(l)), f = new c(d.y, -d.x), p = new c(a.backZ, s), m = L(p, d, f, a.sheet, a.fillet.front, a.fillet.back, s, i.corner), g = new h(m, {
209
+ depth: a.width,
210
+ bevelEnabled: !1,
211
+ curveSegments: i.corner
212
+ });
213
+ g.translate(0, 0, -a.width / 2), g.rotateY(-Math.PI / 2), E(r, g, t.frame);
214
+ let _ = new c(a.barrel.z, a.barrel.y).clone().sub(p).dot(d) - 2, v = (a.hole.centreY - s) / Math.cos(l) - 2, y = b(a.width, _, .02, 2, 2);
215
+ y.holes.push(R(a.hole.width, a.hole.length, v - _ / 2));
216
+ let x = new h(y, {
217
+ depth: a.sheet,
218
+ bevelEnabled: !1,
219
+ curveSegments: i.corner
220
+ });
221
+ x.translate(0, _ / 2 + 2, 0);
222
+ let S = E(r, x, t.frame);
223
+ S.rotation.x = l, S.position.set(0, p.y, p.x);
224
+ let { barrel: w } = a, T = (a.width - w.bracket) / 2 - .03, D = new u(w.radius, w.radius, T, i.round, 1);
225
+ D.rotateZ(Math.PI / 2);
226
+ for (let e of [-1, 1]) E(r, D, t.frame, {
227
+ x: e * (a.width / 2 - T / 2),
228
+ y: w.y,
229
+ z: w.z
230
+ });
231
+ let O = new u(w.radius - .02, w.radius - .02, w.bracket, i.round, 1);
232
+ O.rotateZ(Math.PI / 2), E(r, O, t.frame, {
233
+ y: w.y,
234
+ z: w.z
235
+ });
236
+ let k = new u(w.radius - .05, w.radius - .05, a.width - .1, i.round, 1);
237
+ k.rotateZ(Math.PI / 2), E(r, k, n.gap, {
238
+ y: w.y,
239
+ z: w.z
240
+ });
241
+ }
242
+ function L(e, t, r, i, a, o, l, u) {
243
+ let d = (n) => e.clone().addScaledVector(t, n), f = (n) => e.clone().addScaledVector(r, i).addScaledVector(t, n), p = (e, n, i) => {
244
+ let a = r.clone().multiplyScalar(n), o = (l + i - e.y - a.y * i) / t.y, s = e.clone().addScaledVector(t, o).addScaledVector(a, i), d = s.clone().addScaledVector(a, -i), f = new c(s.x, l), p = Math.atan2(d.y - s.y, d.x - s.x), m = Math.atan2(f.y - s.y, f.x - s.x) - p;
245
+ m > Math.PI && (m -= 2 * Math.PI), m < -Math.PI && (m += 2 * Math.PI);
246
+ let h = [];
247
+ for (let e = 0; e <= u; e++) {
248
+ let t = p + m * e / u;
249
+ h.push(new c(s.x + i * Math.cos(t), s.y + i * Math.sin(t)));
250
+ }
251
+ return h;
252
+ }, m = p(f(0), 1, a), h = p(d(0), -1, o), g = l - .25, _ = [
253
+ d(3),
254
+ f(3),
255
+ ...m,
256
+ new c(m[m.length - 1].x, g),
257
+ new c(h[h.length - 1].x, g),
258
+ ...h.slice().reverse()
259
+ ];
260
+ return s.isClockWise(_) && _.reverse(), new n(_);
261
+ }
262
+ function R(e, t, n) {
263
+ let r = e / 2, i = Math.max(0, t / 2 - r), o = new a();
264
+ return o.absarc(0, n + i, r, 0, Math.PI, !1), o.absarc(0, n - i, r, Math.PI, 2 * Math.PI, !1), o.closePath(), o;
265
+ }
266
+ function z(e) {
267
+ if (typeof document > "u") return null;
268
+ let t = Math.round(e.pitch * 2 * 400), n = Math.round(e.band * 400), i = document.createElement("canvas");
269
+ i.width = t, i.height = n;
270
+ let a = i.getContext("2d");
271
+ if (!a) return null;
272
+ a.fillStyle = "#000", a.fillRect(0, 0, t, n), a.fillStyle = "#fff";
273
+ let o = n / e.rows, s = t / 2, c = e.hole / 2 * 400;
274
+ for (let t = 0; t < e.rows; t++) for (let e = -1; e <= 2; e++) a.beginPath(), a.arc(e * s + (t % 2 ? s / 2 : 0), (t + .5) * o, c, 0, Math.PI * 2), a.fill();
275
+ let l = new m(i);
276
+ return l.wrapS = r, l.wrapT = f, l.anisotropy = 8, l;
277
+ }
278
+ // ../devices/src/monitor/finishes.ts
279
+ var B = { silver: {
280
+ label: "Silver",
281
+ frame: "#d3d4d6",
282
+ back: "#d3d4d6",
283
+ frameRoughness: .42,
284
+ backMaterial: "metal"
285
+ } }, V = {
286
+ id: "monitor.studio-display",
287
+ label: "Studio Display",
288
+ finishes: ["silver"],
289
+ panel: {
290
+ width: 62.3,
291
+ height: 36.2,
292
+ depth: 1.97,
293
+ radius: .5,
294
+ glass: .1
295
+ },
296
+ display: {
297
+ px: [5120, 2880],
298
+ ppi: 218
299
+ },
300
+ bezel: 1.37,
301
+ cameraFromTop: .53,
302
+ logo: {
303
+ height: 8.35,
304
+ raise: 5.04
305
+ },
306
+ power: {
307
+ drop: 15.34,
308
+ radius: 1.52
309
+ },
310
+ ports: {
311
+ x: [
312
+ 17.25,
313
+ 18.75,
314
+ 20.25,
315
+ 21.76
316
+ ],
317
+ drop: 15.34,
318
+ width: .31,
319
+ height: .89
320
+ },
321
+ vents: {
322
+ length: 60.9,
323
+ band: .83,
324
+ centre: 1.31,
325
+ hole: .16,
326
+ pitch: .19,
327
+ rows: 5
328
+ },
329
+ stand: {
330
+ width: 15.2,
331
+ foot: {
332
+ depth: 16.8,
333
+ thickness: .56,
334
+ radius: 1.2,
335
+ pad: .1
336
+ },
337
+ sheet: .7,
338
+ lean: 13.1,
339
+ backZ: -6.09,
340
+ fillet: {
341
+ front: 1,
342
+ back: .6
343
+ },
344
+ hole: {
345
+ width: 4,
346
+ length: 6.26,
347
+ centreY: 13.63
348
+ },
349
+ barrel: {
350
+ radius: 1.05,
351
+ y: 20.61,
352
+ z: -.39,
353
+ bracket: 5.34
354
+ }
355
+ },
356
+ hinge: {
357
+ drop: 9.04,
358
+ behind: 3.15
359
+ }
360
+ }, H = { [V.id]: V }, U = /* @__PURE__ */ e({ monitor: () => W }), W = {
361
+ type: "monitor",
362
+ specs: H,
363
+ finishes: B,
364
+ build: P
365
+ };
366
+ export { U as t };