@tomorrowevening/hermes 0.1.41 → 0.1.43

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 (97) hide show
  1. package/dist/core/Application.cjs +1 -0
  2. package/dist/core/remote/BaseRemote.cjs +1 -0
  3. package/dist/core/remote/RemoteTheatre.cjs +1 -0
  4. package/dist/core/remote/RemoteTheatre.js +31 -29
  5. package/dist/core/remote/RemoteThree.cjs +1 -0
  6. package/dist/core/remote/RemoteThree.js +4 -3
  7. package/dist/core/types.cjs +1 -0
  8. package/dist/editor/Editor.cjs +1 -0
  9. package/dist/editor/HermesApp.cjs +1 -0
  10. package/dist/editor/ThreeEditor.cjs +1 -0
  11. package/dist/editor/components/Draggable.cjs +1 -0
  12. package/dist/editor/components/DraggableItem.cjs +1 -0
  13. package/dist/editor/components/Dropdown.cjs +1 -0
  14. package/dist/editor/components/DropdownItem.cjs +1 -0
  15. package/dist/editor/components/NavButton.cjs +1 -0
  16. package/dist/editor/components/content.cjs +1 -0
  17. package/dist/editor/components/icons/CloseIcon.cjs +1 -0
  18. package/dist/editor/components/icons/DragIcon.cjs +3 -0
  19. package/dist/editor/index.cjs +1 -0
  20. package/dist/editor/index.js +65 -0
  21. package/dist/editor/multiView/CameraWindow.cjs +1 -0
  22. package/dist/editor/multiView/DepthNodeMaterial.cjs +1 -0
  23. package/dist/editor/multiView/InfiniteGridHelper.cjs +1 -0
  24. package/dist/editor/multiView/InfiniteGridHelperGPU.cjs +1 -0
  25. package/dist/editor/multiView/InfiniteGridMaterial.cjs +78 -0
  26. package/dist/editor/multiView/InfiniteGridNodeMaterial.cjs +1 -0
  27. package/dist/editor/multiView/MultiView.cjs +1 -0
  28. package/dist/editor/multiView/Toggle.cjs +1 -0
  29. package/dist/editor/multiView/UVMaterial.cjs +41 -0
  30. package/dist/editor/multiView/UVNodeMaterial.cjs +1 -0
  31. package/dist/editor/sidePanel/Accordion.cjs +1 -0
  32. package/dist/editor/sidePanel/ChildObject.cjs +1 -0
  33. package/dist/editor/sidePanel/ContainerObject.cjs +1 -0
  34. package/dist/editor/sidePanel/DebugData.cjs +1 -0
  35. package/dist/editor/sidePanel/SidePanel.cjs +1 -0
  36. package/dist/editor/sidePanel/inspector/InspectGrid3.cjs +1 -0
  37. package/dist/editor/sidePanel/inspector/InspectGrid4.cjs +1 -0
  38. package/dist/editor/sidePanel/inspector/InspectImage.cjs +1 -0
  39. package/dist/editor/sidePanel/inspector/InspectNumber.cjs +1 -0
  40. package/dist/editor/sidePanel/inspector/InspectVector2.cjs +1 -0
  41. package/dist/editor/sidePanel/inspector/Inspector.cjs +1 -0
  42. package/dist/editor/sidePanel/inspector/InspectorField.cjs +2 -0
  43. package/dist/editor/sidePanel/inspector/InspectorGroup.cjs +1 -0
  44. package/dist/editor/sidePanel/inspector/utils/DragNumber.cjs +1 -0
  45. package/dist/editor/sidePanel/inspector/utils/InspectAnimation.cjs +1 -0
  46. package/dist/editor/sidePanel/inspector/utils/InspectCamera.cjs +1 -0
  47. package/dist/editor/sidePanel/inspector/utils/InspectLight.cjs +1 -0
  48. package/dist/editor/sidePanel/inspector/utils/InspectMaterial.cjs +1 -0
  49. package/dist/editor/sidePanel/inspector/utils/InspectTransform.cjs +1 -0
  50. package/dist/editor/sidePanel/utils.cjs +1 -0
  51. package/dist/editor/sidePanel/utils.js +95 -88
  52. package/dist/editor/tools/Transform.cjs +1 -0
  53. package/dist/editor/tools/splineEditor/Spline.cjs +1 -0
  54. package/dist/editor/tools/splineEditor/index.cjs +1 -0
  55. package/dist/editor/utils.cjs +1 -0
  56. package/dist/index.cjs +1 -0
  57. package/dist/index.js +67 -119
  58. package/dist/utils/ImageSequenceCapturer.cjs +13 -0
  59. package/dist/utils/detectSettings.cjs +1 -0
  60. package/dist/utils/math.cjs +1 -0
  61. package/dist/utils/post.cjs +1 -0
  62. package/dist/utils/theatre.cjs +1 -0
  63. package/dist/utils/three.cjs +1 -0
  64. package/dist/utils/threeDispose.cjs +1 -0
  65. package/dist/utils/threeDispose.js +40 -0
  66. package/dist/utils/threeEditorDebug.cjs +1 -0
  67. package/dist/utils/threeEditorDebug.js +69 -0
  68. package/dist/webworkers/EventHandling.cjs +1 -0
  69. package/dist/webworkers/ProxyManager.cjs +1 -0
  70. package/package.json +23 -7
  71. package/types/editor/index.d.ts +26 -0
  72. package/types/editor/sidePanel/utils.d.ts +7 -0
  73. package/types/index.d.ts +0 -24
  74. package/types/utils/threeDispose.d.ts +4 -0
  75. package/types/utils/threeEditorDebug.d.ts +17 -0
  76. package/dist/ThreeEditor-jkqfXLb4.js +0 -111
  77. package/dist/ThreeEditor-lbW0auGy.css +0 -1
  78. package/dist/hermes.cjs.js +0 -133
  79. package/dist/images/android-chrome-192x192.png +0 -0
  80. package/dist/images/android-chrome-512x512.png +0 -0
  81. package/dist/images/apple-touch-icon.png +0 -0
  82. package/dist/images/favicon-16x16.png +0 -0
  83. package/dist/images/favicon-32x32.png +0 -0
  84. package/dist/images/favicon.ico +0 -0
  85. package/dist/images/milkyWay/dark-s_nx.jpg +0 -0
  86. package/dist/images/milkyWay/dark-s_ny.jpg +0 -0
  87. package/dist/images/milkyWay/dark-s_nz.jpg +0 -0
  88. package/dist/images/milkyWay/dark-s_px.jpg +0 -0
  89. package/dist/images/milkyWay/dark-s_py.jpg +0 -0
  90. package/dist/images/milkyWay/dark-s_pz.jpg +0 -0
  91. package/dist/images/site.webmanifest +0 -1
  92. package/dist/images/uv_grid_opengl.jpg +0 -0
  93. package/dist/index-C92ji5gy.css +0 -1
  94. package/dist/index-DZmiM5y-.js +0 -10226
  95. package/dist/index.html +0 -17
  96. package/dist/json/animation.json +0 -235
  97. package/dist/models/Flair.fbx +0 -0
package/dist/index.js CHANGED
@@ -1,125 +1,73 @@
1
1
  import { defaultTheatreCallback as t, noop as a } from "./core/types.js";
2
- import { capitalize as l, colorToHex as p, copyToClipboard as f, isColor as m, randomID as s } from "./editor/utils.js";
3
- import { detectMaxFrameRate as i, detectSettings as n } from "./utils/detectSettings.js";
4
- import { ImageSequenceCapturer as u } from "./utils/ImageSequenceCapturer.js";
5
- import { clamp as M, cubicBezier as b, damp as T, distance as h, getAngle as g, map as C, mix as O, normalize as j, rgbaToHex as I, roundTo as y } from "./utils/math.js";
6
- import { animateObjectMaterial as G, animateObjectTransform as B, applyObjectMaterial as D, customizeTheatreElements as P, getObjectMaterialObject as S, getObjectMaterialProps as H, useStudio as A } from "./utils/theatre.js";
7
- import { ExportTexture as R, anchorGeometry as U, anchorGeometryTL as k, createMask as v, dispose as w, disposeMaterial as z, disposeTexture as V, hierarchyUUID as L, orthoCamera as q, parseModelLite as F, renderToTexture as W, resetThreeObjects as J, setMaterialBlendAdd as K, setMaterialBlendMultiply as Q, setMaterialBlendNormal as X, setMaterialBlendScreen as Y, supportsOffscreenCanvas as Z, totalThreeObjects as _, triangle as $, updateCameraOrtho as ee, updateCameraOrtho16x9 as re, useMask as te } from "./utils/three.js";
8
- import { clearComposerGroups as oe, generateCubemap as le, inspectComposer as pe, inspectComposerPass as fe } from "./utils/post.js";
9
- import { ElementProxy as se, WebworkerEventHandlers as de } from "./webworkers/EventHandling.js";
10
- import { ElementProxyReceiver as ne, ProxyManager as xe } from "./webworkers/ProxyManager.js";
11
- import { default as ce } from "./core/Application.js";
12
- import { default as be } from "./core/remote/BaseRemote.js";
13
- import { default as he } from "./core/remote/RemoteTheatre.js";
14
- import { default as Ce } from "./core/remote/RemoteThree.js";
15
- import { default as je } from "./editor/components/NavButton.js";
16
- import { default as ye } from "./editor/components/DraggableItem.js";
17
- import { default as Ge } from "./editor/components/Draggable.js";
18
- import { default as De } from "./editor/components/DropdownItem.js";
19
- import { default as Se } from "./editor/components/Dropdown.js";
20
- import { default as Ae } from "./editor/sidePanel/SidePanel.js";
21
- import { default as Re } from "./editor/sidePanel/Accordion.js";
22
- import { default as ke } from "./editor/sidePanel/ChildObject.js";
23
- import { default as we } from "./editor/sidePanel/ContainerObject.js";
24
- import { default as Ve } from "./editor/sidePanel/inspector/Inspector.js";
25
- import { default as qe } from "./editor/multiView/MultiView.js";
26
- import { default as We } from "./editor/Editor.js";
27
- import { default as Ke } from "./editor/ThreeEditor.js";
28
- import { default as Xe } from "./editor/HermesApp.js";
29
- import { default as Ze } from "./editor/tools/Transform.js";
30
- import { default as $e } from "./editor/tools/splineEditor/Spline.js";
31
- import { default as rr } from "./editor/tools/splineEditor/index.js";
32
- import { default as ar } from "./editor/multiView/InfiniteGridMaterial.js";
33
- import { default as lr } from "./editor/multiView/InfiniteGridNodeMaterial.js";
34
- import { default as fr } from "./editor/multiView/InfiniteGridHelper.js";
35
- import { default as sr } from "./editor/multiView/InfiniteGridHelperGPU.js";
36
- import { default as ir } from "./editor/multiView/DepthNodeMaterial.js";
37
- import { default as xr } from "./editor/multiView/UVMaterial.js";
38
- import { default as cr } from "./editor/multiView/UVNodeMaterial.js";
2
+ import { detectMaxFrameRate as s, detectSettings as p } from "./utils/detectSettings.js";
3
+ import { ImageSequenceCapturer as l } from "./utils/ImageSequenceCapturer.js";
4
+ import { clamp as n, cubicBezier as c, damp as d, distance as x, getAngle as f, map as u, mix as M, normalize as T, rgbaToHex as b, roundTo as h } from "./utils/math.js";
5
+ import { animateObjectMaterial as g, animateObjectTransform as C, applyObjectMaterial as j, customizeTheatreElements as y, getObjectMaterialObject as B, getObjectMaterialProps as E, useStudio as P } from "./utils/theatre.js";
6
+ import { ExportTexture as k, anchorGeometry as A, anchorGeometryTL as S, createMask as v, dispose as z, disposeMaterial as G, disposeTexture as H, hierarchyUUID as I, orthoCamera as L, parseModelLite as U, renderToTexture as q, resetThreeObjects as w, setMaterialBlendAdd as D, setMaterialBlendMultiply as F, setMaterialBlendNormal as N, setMaterialBlendScreen as W, supportsOffscreenCanvas as J, totalThreeObjects as K, triangle as Q, updateCameraOrtho as V, updateCameraOrtho16x9 as X, useMask as Y } from "./utils/three.js";
7
+ import { clearComposerGroups as _, generateCubemap as $, inspectComposer as ee, inspectComposerPass as re } from "./utils/post.js";
8
+ import { ElementProxy as ae, WebworkerEventHandlers as oe } from "./webworkers/EventHandling.js";
9
+ import { ElementProxyReceiver as pe, ProxyManager as me } from "./webworkers/ProxyManager.js";
10
+ import { default as ie } from "./core/Application.js";
11
+ import { default as ce } from "./core/remote/BaseRemote.js";
12
+ import { default as xe } from "./core/remote/RemoteTheatre.js";
13
+ import { default as ue } from "./core/remote/RemoteThree.js";
14
+ import { default as Te } from "./editor/HermesApp.js";
39
15
  export {
40
- Re as Accordion,
41
- ce as Application,
42
- be as BaseRemote,
43
- ke as ChildObject,
44
- we as ContainerObject,
45
- ir as DepthNodeMaterial,
46
- Ge as Draggable,
47
- ye as DraggableItem,
48
- Se as Dropdown,
49
- De as DropdownItem,
50
- We as Editor,
51
- se as ElementProxy,
52
- ne as ElementProxyReceiver,
53
- R as ExportTexture,
54
- Xe as HermesApp,
55
- u as ImageSequenceCapturer,
56
- fr as InfiniteGridHelper,
57
- sr as InfiniteGridHelperGPU,
58
- ar as InfiniteGridMaterial,
59
- lr as InfiniteGridNodeMaterial,
60
- Ve as Inspector,
61
- qe as MultiView,
62
- je as NavButton,
63
- xe as ProxyManager,
64
- he as RemoteTheatre,
65
- Ce as RemoteThree,
66
- Ae as SidePanel,
67
- $e as Spline,
68
- rr as SplineEditor,
69
- Ke as ThreeEditor,
70
- Ze as Transform,
71
- xr as UVMaterial,
72
- cr as UVNodeMaterial,
73
- de as WebworkerEventHandlers,
74
- U as anchorGeometry,
75
- k as anchorGeometryTL,
76
- G as animateObjectMaterial,
77
- B as animateObjectTransform,
78
- D as applyObjectMaterial,
79
- l as capitalize,
80
- M as clamp,
81
- oe as clearComposerGroups,
82
- p as colorToHex,
83
- f as copyToClipboard,
16
+ ie as Application,
17
+ ce as BaseRemote,
18
+ ae as ElementProxy,
19
+ pe as ElementProxyReceiver,
20
+ k as ExportTexture,
21
+ Te as HermesApp,
22
+ l as ImageSequenceCapturer,
23
+ me as ProxyManager,
24
+ xe as RemoteTheatre,
25
+ ue as RemoteThree,
26
+ oe as WebworkerEventHandlers,
27
+ A as anchorGeometry,
28
+ S as anchorGeometryTL,
29
+ g as animateObjectMaterial,
30
+ C as animateObjectTransform,
31
+ j as applyObjectMaterial,
32
+ n as clamp,
33
+ _ as clearComposerGroups,
84
34
  v as createMask,
85
- b as cubicBezier,
86
- P as customizeTheatreElements,
87
- T as damp,
35
+ c as cubicBezier,
36
+ y as customizeTheatreElements,
37
+ d as damp,
88
38
  t as defaultTheatreCallback,
89
- i as detectMaxFrameRate,
90
- n as detectSettings,
91
- w as dispose,
92
- z as disposeMaterial,
93
- V as disposeTexture,
94
- h as distance,
95
- le as generateCubemap,
96
- g as getAngle,
97
- S as getObjectMaterialObject,
98
- H as getObjectMaterialProps,
99
- L as hierarchyUUID,
100
- pe as inspectComposer,
101
- fe as inspectComposerPass,
102
- m as isColor,
103
- C as map,
104
- O as mix,
39
+ s as detectMaxFrameRate,
40
+ p as detectSettings,
41
+ z as dispose,
42
+ G as disposeMaterial,
43
+ H as disposeTexture,
44
+ x as distance,
45
+ $ as generateCubemap,
46
+ f as getAngle,
47
+ B as getObjectMaterialObject,
48
+ E as getObjectMaterialProps,
49
+ I as hierarchyUUID,
50
+ ee as inspectComposer,
51
+ re as inspectComposerPass,
52
+ u as map,
53
+ M as mix,
105
54
  a as noop,
106
- j as normalize,
107
- q as orthoCamera,
108
- F as parseModelLite,
109
- s as randomID,
110
- W as renderToTexture,
111
- J as resetThreeObjects,
112
- I as rgbaToHex,
113
- y as roundTo,
114
- K as setMaterialBlendAdd,
115
- Q as setMaterialBlendMultiply,
116
- X as setMaterialBlendNormal,
117
- Y as setMaterialBlendScreen,
118
- Z as supportsOffscreenCanvas,
119
- _ as totalThreeObjects,
120
- $ as triangle,
121
- ee as updateCameraOrtho,
122
- re as updateCameraOrtho16x9,
123
- te as useMask,
124
- A as useStudio
55
+ T as normalize,
56
+ L as orthoCamera,
57
+ U as parseModelLite,
58
+ q as renderToTexture,
59
+ w as resetThreeObjects,
60
+ b as rgbaToHex,
61
+ h as roundTo,
62
+ D as setMaterialBlendAdd,
63
+ F as setMaterialBlendMultiply,
64
+ N as setMaterialBlendNormal,
65
+ W as setMaterialBlendScreen,
66
+ J as supportsOffscreenCanvas,
67
+ K as totalThreeObjects,
68
+ Q as triangle,
69
+ V as updateCameraOrtho,
70
+ X as updateCameraOrtho16x9,
71
+ Y as useMask,
72
+ P as useStudio
125
73
  };
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=`
2
+ self.onmessage = async ({ data }) => {
3
+ if (data.type !== 'encode') return;
4
+ const { bitmap, index, format, quality } = data;
5
+ const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
6
+ const ctx = canvas.getContext('2d');
7
+ ctx.drawImage(bitmap, 0, 0);
8
+ bitmap.close();
9
+ const mime = format === 'jpeg' ? 'image/jpeg' : format === 'webp' ? 'image/webp' : 'image/png';
10
+ const blob = await canvas.convertToBlob({ type: mime, quality });
11
+ self.postMessage({ type: 'encoded', index, blob });
12
+ };
13
+ `;class h{worker;source;transfer;ctx;opts;_capturing=!1;_captured=0;_encoded=0;_pending=0;_lastFrameTime=-1/0;frames=new Map;constructor(s,t={}){this.source=s,this.transfer=document.createElement("canvas"),this.transfer.width=s.width,this.transfer.height=s.height,this.ctx=this.transfer.getContext("2d",{willReadFrequently:!0}),this.opts={format:t.format??"png",quality:t.quality??.92,prefix:t.prefix??"frame",padLength:t.padLength??5,maxQueue:t.maxQueue??32,fps:t.fps??30,onProgress:t.onProgress??(()=>{}),onError:t.onError??(e=>console.error("[ImageSequenceCapturer]",e))};const a=new Blob([c],{type:"application/javascript"}),r=URL.createObjectURL(a);this.worker=new Worker(r),URL.revokeObjectURL(r),this.worker.onmessage=({data:e})=>{e.type==="encoded"&&(this.frames.set(e.index,e.blob),this._pending--,this._encoded++,this.opts.onProgress(this._captured,this._encoded))},this.worker.onerror=e=>this.opts.onError(new Error(e.message))}get isCapturing(){return this._capturing}get framesCaptured(){return this._captured}get framesEncoded(){return this._encoded}get isIdle(){return this._pending===0}resize(){this.transfer.width=this.source.width,this.transfer.height=this.source.height}start(){this._capturing=!0,this._captured=0,this._encoded=0,this._pending=0,this._lastFrameTime=-1/0,this.frames.clear()}stop(){this._capturing=!1}captureFrame(){if(!this._capturing||this._pending>=this.opts.maxQueue)return!1;const s=performance.now();if(s-this._lastFrameTime<1e3/this.opts.fps)return!1;this._lastFrameTime=s,this.ctx.drawImage(this.source,0,0);const t=this._captured++;return this._pending++,createImageBitmap(this.transfer).then(a=>{this.worker.postMessage({type:"encode",bitmap:a,index:t,format:this.opts.format,quality:this.opts.quality},[a])}).catch(a=>{this._pending--,this.opts.onError(a)}),!0}flush(){return new Promise(s=>{const t=()=>this._pending===0?s():setTimeout(t,16);t()})}async download(){await this.flush();const s=this.opts.format==="jpeg"?"jpg":this.opts.format,a=[...this.frames.entries()].sort(([r],[e])=>r-e).map(([r,e])=>({name:`${this.opts.prefix}_${String(r).padStart(this.opts.padLength,"0")}.${s}`,blob:e}));if("showDirectoryPicker"in window)try{const r=await window.showDirectoryPicker({mode:"readwrite",startIn:"downloads"});await Promise.all(a.map(async({name:e,blob:i})=>{const n=await(await r.getFileHandle(e,{create:!0})).createWritable();await n.write(i),await n.close()}));return}catch(r){if(r.name==="AbortError")return}for(const{name:r,blob:e}of a){const i=URL.createObjectURL(e);Object.assign(document.createElement("a"),{href:i,download:r}).click(),URL.revokeObjectURL(i),await new Promise(n=>setTimeout(n,50))}}reset(){this._capturing=!1,this._captured=0,this._encoded=0,this._pending=0,this.frames.clear()}destroy(){this.reset(),this.worker.terminate()}}exports.ImageSequenceCapturer=h;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("detect-gpu");function f(s){let n=0;const i=performance.now();function e(){n++;const t=performance.now();if(t-i>=100){const o=n/((t-i)/1e3),c=Math.round(o/30)*30;s(c)}else requestAnimationFrame(e)}requestAnimationFrame(e)}function m(s=!1,n=!1){return new Promise(i=>{u.getGPUTier().then(e=>{let t=!1;const o=document.createElement("canvas"),c=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);if(t="transferControlToOffscreen"in o,c){const a=navigator.userAgent.match(/version\/(\d+)/i);t=(a?parseInt(a[1]):0)>=17}const r={dpr:devicePixelRatio,fps:30,width:innerWidth,height:innerHeight,mobile:e.isMobile!==void 0?e.isMobile:!1,supportOffScreenCanvas:t,supportWebGPU:!!navigator.gpu,quality:"Low",dev:s,editor:n};e.tier===3?r.quality="High":e.tier===2&&(r.quality="Medium"),f(a=>{r.fps=a,i(r)})})})}exports.detectMaxFrameRate=f;exports.detectSettings=m;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function B(n,t,r){return Math.min(t,Math.max(n,r))}function b(n,t,r){return(r-n)/(t-n)}function x(n,t,r){return n*(1-r)+t*r}function j(n,t,r,o,c){return x(r,o,b(n,t,c))}function q(n,t){const r=n-t;return Math.sqrt(r*r)}function C(n,t,r,o){return x(n,t,1-Math.exp(-r*o))}function D(n,t=1){return Number(n.toFixed(t))}function E(n,t,r,o){return Math.atan2(o-t,r-n)}function G(n,t,r,o){return n===t&&r===o}function I(n,t,r,o){return 1/(3*t*n*n+2*r*n+o)}function L(n,t,r,o,c){return t*(n*n*n)+r*(n*n)+o*n+c}function N(n,t,r,o,c){const u=n*n;return t*(u*n)+r*u+o*n+c}function O(n,t,r,o,c){if(n<=0)return 0;if(n>=1)return 1;if(G(t,r,o,c))return n;const u=0,i=0,s=t,f=r,l=o,d=c,p=1,y=1,h=p-3*l+3*s-u,M=3*l-6*s+3*u,g=3*s-3*u,F=u,$=y-3*d+3*f-i,z=3*d-6*f+3*i,H=3*f-3*i,S=i;let e=n;for(let T=0;T<5;T++){const A=L(e,h,M,g,F);let m=I(e,h,M,g);m===1/0&&(m=n),e-=(A-n)*m,e=Math.min(Math.max(e,0),1)}return N(e,$,z,H,S)}const a=n=>Math.round(Math.min(1,Math.max(0,n))*255).toString(16).padStart(2,"0");function P({r:n,g:t,b:r,a:o=1}){const c=`#${a(n)}${a(t)}${a(r)}`;return o<1?`${c}${a(o)}`:c}exports.clamp=B;exports.cubicBezier=O;exports.damp=C;exports.distance=q;exports.getAngle=E;exports.map=j;exports.mix=x;exports.normalize=b;exports.rgbaToHex=P;exports.roundTo=D;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("three"),g=require("./three.cjs");let b=[];function x(s,n,a=!0){g.ExportTexture.renderer=n.renderer;const r=[];r.push({type:"boolean",prop:"Enabled",value:s.enabled});let f=(u,e)=>{console.log("Default Handle Pass:",u,e)};if(s.name==="EffectPass")s.effects.forEach(u=>{u.uniforms.size>0&&u.uniforms.forEach((e,o)=>{if(o==="map")return;const t=`${u.name.replace("Effect","")} ${o}`;if(e.value===null&&a)r.push({prop:o,title:t,type:"image",value:{offset:[0,0],repeat:[1,1],src:""}});else if(e.value.isTexture&&a){const p=e.value,i=g.ExportTexture.renderToBlob(p);r.push({prop:o,title:t,type:"image",value:{offset:[p.offset.x,p.offset.y],repeat:[p.repeat.x,p.repeat.y],src:i}})}else typeof e.value=="number"?r.push({prop:o,title:t,type:"number",value:e.value,step:.01}):typeof e.value=="string"?r.push({prop:o,title:t,type:"string",value:e.value}):typeof e.value=="boolean"&&r.push({prop:o,title:t,type:"boolean",value:e.value})})}),f=(u,e)=>{s.effects.forEach(o=>{o.uniforms.size>0&&o.uniforms.forEach((t,p)=>{p===u&&(t.value=e)})})};else if(s.name==="ShaderPass"){const u=s.fullscreenMaterial;for(const e in u.uniforms){if(e==="inputBuffer"||e==="map")continue;const o=u.uniforms[e],t=`${u.name.replace("Material","")} ${e}`;if(o.value===null&&a)r.push({title:t,prop:e,type:"image",value:{offset:[0,0],repeat:[1,1],src:""}});else if(o.value.isTexture&&a){const p=o.value,i=g.ExportTexture.renderToBlob(p);r.push({title:t,prop:e,type:"image",value:{offset:[p.offset.x,p.offset.y],repeat:[p.repeat.x,p.repeat.y],src:i}})}else typeof o.value=="number"?r.push({title:t,prop:e,type:"number",value:o.value,step:.01}):typeof o.value=="string"?r.push({title:t,prop:e,type:"string",value:o.value}):typeof o.value=="boolean"&&r.push({title:t,prop:e,type:"boolean",value:o.value})}f=(e,o)=>{const t=u.uniforms[e];t.value=o}}else return;const l=`${s.name}: ${s.scene.name}`;n.addGroup({title:l,items:r,onUpdate:(u,e)=>{u==="Enabled"?s.enabled=e:f(u,e)}}),b.push(l)}function E(s,n){s.passes.forEach(a=>{x(a,n)})}function P(s){b.forEach(n=>{s.removeGroup(n)}),b=[]}function C(s,n,a,r=1024){return new Promise(f=>{const l=n.aspect,u=n.fov,e=n.rotation.clone(),o=a.outputBuffer;n.aspect=1,n.fov=90,n.updateProjectionMatrix();const t=new y.WebGLRenderTarget(r,r,{format:y.RGBAFormat,depthBuffer:!0,stencilBuffer:!1});a.outputBuffer=t,c(s,t,n,"nx",a,r).then(()=>{c(s,t,n,"ny",a,r).then(()=>{c(s,t,n,"nz",a,r).then(()=>{c(s,t,n,"px",a,r).then(()=>{c(s,t,n,"py",a,r).then(()=>{c(s,t,n,"pz",a,r).then(()=>{n.aspect=l,n.fov=u,n.rotation.copy(e),n.updateMatrixWorld(),n.updateProjectionMatrix(),a.outputBuffer=o,t.dispose(),f()})})})})})})})}function c(s,n,a,r,f,l){return new Promise(u=>{const e=Math.PI/2;switch(r){case"nx":a.rotation.set(0,-e,0);break;case"ny":a.rotation.set(-e,0,Math.PI);break;case"nz":a.rotation.set(0,0,0);break;case"px":a.rotation.set(0,e,0);break;case"py":a.rotation.set(e,0,Math.PI);break;case"pz":a.rotation.set(0,Math.PI,0);break}a.updateMatrixWorld(),f.render();const o=new Uint8Array(l*l*4);s.readRenderTargetPixels(n,0,0,l,l,o);const t=document.createElement("canvas");t.width=t.height=l;const p=t.getContext("2d"),i=p.createImageData(l,l);i.data.set(o),p.putImageData(i,0,0);const d=document.createElement("canvas");d.width=d.height=l;const h=d.getContext("2d");h.translate(0,l),h.scale(1,-1),h.drawImage(t,0,0);const m=d.toDataURL("image/png"),v=document.createElement("a");v.href=m,v.download=`${a.name}_${r}.png`,document.body.appendChild(v),v.click(),v.remove(),u()})}exports.clearComposerGroups=P;exports.generateCubemap=C;exports.inspectComposer=E;exports.inspectComposerPass=x;
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.create;var b=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var A=(n,i,e,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of M(i))!v.call(n,t)&&t!==e&&b(n,t,{get:()=>i[t],enumerable:!(s=O(i,t))||s.enumerable});return n};var E=(n,i,e)=>(e=n!=null?g(w(n)):{},A(i||!n||!n.__esModule?b(e,"default",{value:n,enumerable:!0}):e,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@tomorrowevening/theatre-core"),y=require("react");let u;function P(){const[n,i]=y.useState(u);return y.useEffect(()=>{u||import("@tomorrowevening/theatre-studio").then(e=>{u=e.default,u.initialize(),u.ui.hide(),i(u)})},[]),n}async function T(){for(;!document.getElementById("theatrejs-studio-root");)await new Promise(s=>setTimeout(s,100));const n=document.getElementById("theatrejs-studio-root");if(n===null||n.shadowRoot===null)return;const i=n.shadowRoot.getElementById("pointer-root");if(i===null)return;const e=i.children[0];if(e!==null){try{const t=e.children[1].children[1];t.parentElement?.removeChild(t)}catch{}try{const s=e.children[3];s.style.top="0",s.style.right="300px"}catch{}}}function k(n,i,e,s){s.sheetObject(n,i,{transform:{position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x,y:e.rotation.y,z:e.rotation.z},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},visible:e.visible}},t=>{const a=t.transform;e.position.copy(a.position),e.rotation.copy(a.rotation),e.scale.copy(a.scale),e.visible=a.visible})}const z=["allowOverride","alphaHash","alphaTest","alphaToCoverage","blendAlpha","blendColor","blendDst","blendDstAlpha","blendEquation","blendEquationAlpha","blendSrc","blendSrcAlpha","blending","clipIntersection","clipShadows","clipping","clippingPlanes","colorWrite","combine","defaultAttributeValues","defines","depthFunc","depthTest","depthWrite","dithering","extensions","fog","forceSinglePass","fragmentShader","glslVersion","id","index0AttributeName","index1AttributeName","index2AttributeName","index3AttributeName","index4AttributeName","isMaterial","lights","linewidth","name","needsUpdate","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","precision","premultipliedAlpha","shadowSide","side","stencilFail","stencilFunc","stencilFuncMask","stencilRef","stencilWrite","stencilWriteMask","stencilZFail","stencilZPass","toneMapped","transparent","type","uniformsGroups","uniformsNeedUpdate","userData","uuid","version","vertexColors","vertexShader","visible","wireframe","wireframeLinewidth","wireframeLinecap","wireframeLinejoin"];function f(n){const i=typeof n;if(n===null||n.isTexture)return"texture";if(i==="boolean")return"boolean";if(i==="number")return"number";if(i==="string")return"string";if(i==="object"){if(n.isColor)return"color";if(n.isVector2)return"vector2";if(n.isVector3)return"vector3";if(n.isVector4)return"vector4";if(n.isMatrix2)return"matrix2";if(n.isMatrix3)return"matrix3";if(n.isMatrix4)return"matrix4";if(n.isEuler)return"euler";if(Array.isArray(n))return"array"}return"object"}function d(n){const i=[];for(const s in n){const t=z.find(o=>o===s),a=s.indexOf("_")===0||s.indexOf("is")===0;if(!(t||a))if(s==="uniforms"){const o=n.uniforms;for(const c in o){const p=o[c].value,m=f(p);m==="array"||m==="object"||i.push({name:`uniforms.${c}.value`,type:m,value:p})}}else{const o=f(n[s]);i.push({name:s,type:o,value:n[s]})}}return i.filter(s=>s.type!=="array"&&s.type!=="object"&&s.type!=="texture")}function h(n){const i={},e={nudgeMultiplier:.01};return n.forEach(s=>{let t=s.value;switch(s.type){case"color":t=r.types.rgba({r:t.r,g:t.g,b:t.b,a:1});break;case"number":t=r.types.number(t,e);break;case"euler":case"vector3":t={x:r.types.number(t.x,e),y:r.types.number(t.y,e),z:r.types.number(t.z,e)};break;case"vector2":t={x:r.types.number(t.x,e),y:r.types.number(t.y,e)};break;case"vector4":t={x:r.types.number(t.x,e),y:r.types.number(t.y,e),z:r.types.number(t.z,e),w:r.types.number(t.w,e)};break;case"matrix2":t={0:r.types.number(t.elements[0],e),1:r.types.number(t.elements[1],e),2:r.types.number(t.elements[2],e),3:r.types.number(t.elements[3],e)};break;case"matrix3":t={0:r.types.number(t.elements[0],e),1:r.types.number(t.elements[1],e),2:r.types.number(t.elements[2],e),3:r.types.number(t.elements[3],e),4:r.types.number(t.elements[4],e),5:r.types.number(t.elements[5],e),6:r.types.number(t.elements[6],e),7:r.types.number(t.elements[7],e),8:r.types.number(t.elements[8],e)};break;case"matrix4":t={0:r.types.number(t.elements[0],e),1:r.types.number(t.elements[1],e),2:r.types.number(t.elements[2],e),3:r.types.number(t.elements[3],e),4:r.types.number(t.elements[4],e),5:r.types.number(t.elements[5],e),6:r.types.number(t.elements[6],e),7:r.types.number(t.elements[7],e),8:r.types.number(t.elements[8],e),9:r.types.number(t.elements[9],e),10:r.types.number(t.elements[10],e),11:r.types.number(t.elements[11],e),12:r.types.number(t.elements[12],e),13:r.types.number(t.elements[13],e),14:r.types.number(t.elements[14],e),15:r.types.number(t.elements[15],e)};break}if(s.name.includes(".")){const a=s.name.split(".");let l=i;for(let o=0;o<a.length-1;o++){const c=a[o];l[c]||(l[c]={}),l=l[c]}l[a[a.length-1]]=t}else i[s.name]=t}),i}function x(n,i,e){i.forEach(s=>{if(n[s.name]!==void 0)switch(s.type){case"boolean":case"number":n[s.name]=e.material[s.name];break;case"color":case"euler":case"matrix2":case"matrix3":case"matrix4":case"vector2":case"vector3":case"vector4":n[s.name].copy(e.material[s.name]);break}})}function S(n,i,e,s){if(!e.isMaterial)return;const t=d(e),a=h(t);s.sheetObject(n,i,{material:a},l=>{x(e,t,l)})}exports.animateObjectMaterial=S;exports.animateObjectTransform=k;exports.applyObjectMaterial=x;exports.customizeTheatreElements=T;exports.getObjectMaterialObject=h;exports.getObjectMaterialProps=d;exports.useStudio=P;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("three"),c=new n.BufferGeometry;c.setAttribute("position",new n.Float32BufferAttribute([-.5,-.5,0,1.5,-.5,0,-.5,1.5,0],3));c.setAttribute("normal",new n.Float32BufferAttribute([0,0,1,0,0,1],3));c.setAttribute("uv",new n.Float32BufferAttribute([0,0,2,0,0,2],2));const A=new n.OrthographicCamera(-.5,.5,.5,-.5,0,100),l=e=>{e?.dispose()},u=e=>{if(e)if(Array.isArray(e))e.forEach(t=>u(t));else{for(const t in e){const i=e[t];i!==null&&i instanceof n.Texture&&l(i)}if(e.isShaderMaterial===!0){const t=e;for(const i in t.uniforms){const s=t.uniforms[i];s.value!==null&&s.value instanceof n.Texture&&l(s.value)}}e.dispose()}},d=e=>{if(e){for(;e.children.length>0;){const t=e.children[0];t.type==="Audio"?(t.pause(),t.parent&&t.parent.remove(t)):d(t)}if(e.parent&&e.parent.remove(e),e.isMesh){const t=e;t.geometry?.dispose(),u(t.material)}e.dispose!==void 0&&e.dispose()}};exports.totalThreeObjects=0;const g=()=>{exports.totalThreeObjects=0},h=e=>{if(!e)return;let t=e.name.replaceAll(" ","").replaceAll("/",".");if(t.length===0&&(t=`obj_${exports.totalThreeObjects}`,exports.totalThreeObjects++),e.parent!==null&&e.parent.uuid.length>0&&(t=`${e.parent.uuid}.${t}`),e.uuid=t,e.isMesh!==void 0){const i=e;if(Array.isArray(i.material))i.material.forEach((s,r)=>{s.uuid=`${t}.material.${r}`});else{const s=i.material;s.uuid=`${t}.material`}}e.children.forEach(i=>h(i))};class m{static renderer;static canvas;static context=null;static scene=null;static camera=null;static material=null;static inited=!1;static width=100;static height=100;static init(){this.inited||(this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.context=this.canvas.getContext("2d"),this.inited=!0)}static renderToBlob(t){this.init();const i=t.repeat.clone(),s=t.offset.clone();if(t.repeat.set(1,1),t.offset.set(0,0),this.context!==null){this.context.clearRect(0,0,this.width,this.height);const r=t.image;if(r!=null&&r.width>0){this.canvas.title=t.sourceFile;const a=this.canvas.width/r.width,o=this.renderToCanvas(t);this.context.drawImage(o,0,0,r.width*a,r.height*a)}}return t.repeat.copy(i),t.offset.copy(s),this.canvas.toDataURL("image/png")}static renderToCanvas(t){if(this.material===null){this.camera=new n.OrthographicCamera(-.5,.5,.5,-.5,0,100),this.scene=new n.Scene,this.material=new n.MeshBasicMaterial;const i=new n.BufferGeometry;i.setAttribute("position",new n.Float32BufferAttribute([-.5,-.5,0,1.5,-.5,0,-.5,1.5,0],3)),i.setAttribute("normal",new n.Float32BufferAttribute([0,0,1,0,0,1],3)),i.setAttribute("uv",new n.Float32BufferAttribute([0,0,2,0,0,2],2));const s=new n.Mesh(i,this.material);this.scene.add(s)}if(t.isRenderTargetTexture)this.material.map=t,this.renderer.render(this.scene,this.camera);else{const i=this.renderer.outputColorSpace,s=t.colorSpace;this.renderer.outputColorSpace=n.LinearSRGBColorSpace,t.colorSpace=n.LinearSRGBColorSpace,this.material.map=t,this.renderer.render(this.scene,this.camera),this.renderer.outputColorSpace=i,t.colorSpace=s}return this.renderer.domElement}}function O(e){return new Promise(t=>{const i=new n.ObjectLoader;i.parseAsync(e.scene).then(s=>{const r=new n.AnimationMixer(s);if(e.animations.length>0){const o=e.animations.map(S=>n.AnimationClip.parse(S));r.clipAction(o[0]).play(),r.getRoot().animations=e.animations,r.getRoot().mixer=r}const a=[];e.cameras&&e.cameras.length>0&&e.cameras.forEach(o=>{const p=i.parse(o);a.push(p)}),t({animations:e.animations,model:s,mixer:r,cameras:a})})})}const M=(e,t,i,s)=>{e.setRenderTarget(s),e.clear(),e.render(t,i)};function f(e,t,i,s){e.applyMatrix4(new n.Matrix4().makeTranslation(t,-i,-s))}function v(e){e.computeBoundingBox();const t=e.boundingBox,i=(t.max.x-t.min.x)/2,s=(t.max.y-t.min.y)/2;f(e,i,s,0)}function F(e,t,i){e.left=t/-2,e.right=t/2,e.top=i/2,e.bottom=i/-2,e.position.x=t/2,e.position.y=i/-2,e.updateProjectionMatrix()}function y(e,t,i){const s=1.7777777777777777,r=t/i;let a=t,o=i;r>s?a=i*s:o=t/s,e.left=a/-2,e.right=a/2,e.top=o/2,e.bottom=o/-2,e.updateProjectionMatrix()}function b(){let t="transferControlToOffscreen"in document.createElement("canvas");if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)){const s=navigator.userAgent.match(/version\/(\d+)/i);t=(s?parseInt(s[1]):0)>=17}return t}function T(e,t,i=!0,s=!1){e.renderOrder=-t;const r=e.material;Array.isArray(r)?r.forEach(a=>{a.colorWrite=i,a.depthWrite=s,a.stencilWrite=!0,a.stencilRef=t,a.stencilFunc=n.AlwaysStencilFunc,a.stencilFail=n.ReplaceStencilOp,a.stencilZFail=n.ReplaceStencilOp,a.stencilZPass=n.ReplaceStencilOp}):(r.colorWrite=i,r.depthWrite=s,r.stencilWrite=!0,r.stencilRef=t,r.stencilFunc=n.AlwaysStencilFunc,r.stencilFail=n.ReplaceStencilOp,r.stencilZFail=n.ReplaceStencilOp,r.stencilZPass=n.ReplaceStencilOp)}function w(e,t,i=!1){const s=e.material;Array.isArray(s)?s.forEach(r=>{r.stencilWrite=!0,r.stencilRef=t,r.stencilFunc=i?n.NotEqualStencilFunc:n.EqualStencilFunc,r.stencilFail=n.KeepStencilOp,r.stencilZFail=n.KeepStencilOp,r.stencilZPass=n.KeepStencilOp}):(s.stencilWrite=!0,s.stencilRef=t,s.stencilFunc=i?n.NotEqualStencilFunc:n.EqualStencilFunc,s.stencilFail=n.KeepStencilOp,s.stencilZFail=n.KeepStencilOp,s.stencilZPass=n.KeepStencilOp)}function B(e){e.blending=n.NormalBlending,e.blendEquation=n.AddEquation,e.blendSrc=n.SrcAlphaFactor,e.blendDst=n.OneMinusSrcAlphaFactor,e.needsUpdate=!0}function C(e){e.blending=n.CustomBlending,e.blendEquation=n.AddEquation,e.blendSrc=n.SrcAlphaFactor,e.blendDst=n.OneFactor,e.needsUpdate=!0}function x(e){e.blending=n.CustomBlending,e.blendEquation=n.AddEquation,e.blendSrc=n.DstColorFactor,e.blendDst=n.OneMinusSrcAlphaFactor,e.needsUpdate=!0}function E(e){e.blending=n.CustomBlending,e.blendEquation=n.AddEquation,e.blendSrc=n.OneMinusDstColorFactor,e.blendDst=n.OneFactor,e.needsUpdate=!0}exports.ExportTexture=m;exports.anchorGeometry=f;exports.anchorGeometryTL=v;exports.createMask=T;exports.dispose=d;exports.disposeMaterial=u;exports.disposeTexture=l;exports.hierarchyUUID=h;exports.orthoCamera=A;exports.parseModelLite=O;exports.renderToTexture=M;exports.resetThreeObjects=g;exports.setMaterialBlendAdd=C;exports.setMaterialBlendMultiply=x;exports.setMaterialBlendNormal=B;exports.setMaterialBlendScreen=E;exports.supportsOffscreenCanvas=b;exports.triangle=c;exports.updateCameraOrtho=F;exports.updateCameraOrtho16x9=y;exports.useMask=w;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("three"),r=e=>{e?.dispose()},n=e=>{if(e){if(Array.isArray(e)){e.forEach(s=>n(s));return}for(const s in e){const i=e[s];i instanceof t.Texture&&r(i)}if(e.isShaderMaterial===!0){const s=e;for(const i in s.uniforms){const o=s.uniforms[i];o?.value instanceof t.Texture&&r(o.value)}}e.dispose()}},f=e=>{if(e){for(;e.children.length>0;){const s=e.children[0];s.type==="Audio"?(s.pause(),s.parent&&s.parent.remove(s)):f(s)}if(e.parent&&e.parent.remove(e),e.isMesh){const s=e;s.geometry?.dispose(),n(s.material)}typeof e.dispose=="function"&&e.dispose()}};exports.dispose=f;exports.disposeMaterial=n;exports.disposeTexture=r;
@@ -0,0 +1,40 @@
1
+ import { Texture as r } from "three";
2
+ const o = (s) => {
3
+ s?.dispose();
4
+ }, f = (s) => {
5
+ if (s) {
6
+ if (Array.isArray(s)) {
7
+ s.forEach((i) => f(i));
8
+ return;
9
+ }
10
+ for (const i in s) {
11
+ const e = s[i];
12
+ e instanceof r && o(e);
13
+ }
14
+ if (s.isShaderMaterial === !0) {
15
+ const i = s;
16
+ for (const e in i.uniforms) {
17
+ const n = i.uniforms[e];
18
+ n?.value instanceof r && o(n.value);
19
+ }
20
+ }
21
+ s.dispose();
22
+ }
23
+ }, p = (s) => {
24
+ if (s) {
25
+ for (; s.children.length > 0; ) {
26
+ const i = s.children[0];
27
+ i.type === "Audio" ? (i.pause(), i.parent && i.parent.remove(i)) : p(i);
28
+ }
29
+ if (s.parent && s.parent.remove(s), s.isMesh) {
30
+ const i = s;
31
+ i.geometry?.dispose(), f(i.material);
32
+ }
33
+ typeof s.dispose == "function" && s.dispose();
34
+ }
35
+ };
36
+ export {
37
+ p as dispose,
38
+ f as disposeMaterial,
39
+ o as disposeTexture
40
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("three");let n=0;const o=()=>{n=0},h=i=>{if(!i)return;let e=i.name.replaceAll(" ","").replaceAll("/",".");if(e.length===0&&(e=`obj_${n}`,n++),i.parent!==null&&i.parent.uuid.length>0&&(e=`${i.parent.uuid}.${e}`),i.uuid=e,i.isMesh!==void 0){const t=i;if(Array.isArray(t.material))t.material.forEach((r,s)=>{r.uuid=`${e}.material.${s}`});else{const r=t.material;r.uuid=`${e}.material`}}i.children.forEach(t=>h(t))};class d{static renderer;static canvas;static context=null;static scene=null;static camera=null;static material=null;static inited=!1;static width=100;static height=100;static init(){this.inited||(this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.context=this.canvas.getContext("2d"),this.inited=!0)}static renderToBlob(e){this.init();const t=e.repeat.clone(),r=e.offset.clone();if(e.repeat.set(1,1),e.offset.set(0,0),this.context!==null){this.context.clearRect(0,0,this.width,this.height);const s=e.image;if(s!=null&&s.width>0){this.canvas.title=e.sourceFile;const c=this.canvas.width/s.width,l=this.renderToCanvas(e);this.context.drawImage(l,0,0,s.width*c,s.height*c)}}return e.repeat.copy(t),e.offset.copy(r),this.canvas.toDataURL("image/png")}static renderToCanvas(e){if(this.material===null){this.camera=new a.OrthographicCamera(-.5,.5,.5,-.5,0,100),this.scene=new a.Scene,this.material=new a.MeshBasicMaterial;const t=new a.BufferGeometry;t.setAttribute("position",new a.Float32BufferAttribute([-.5,-.5,0,1.5,-.5,0,-.5,1.5,0],3)),t.setAttribute("normal",new a.Float32BufferAttribute([0,0,1,0,0,1],3)),t.setAttribute("uv",new a.Float32BufferAttribute([0,0,2,0,0,2],2));const r=new a.Mesh(t,this.material);this.scene.add(r)}if(e.isRenderTargetTexture)this.material.map=e,this.renderer.render(this.scene,this.camera);else{const t=this.renderer.outputColorSpace,r=e.colorSpace;this.renderer.outputColorSpace=a.LinearSRGBColorSpace,e.colorSpace=a.LinearSRGBColorSpace,this.material.map=e,this.renderer.render(this.scene,this.camera),this.renderer.outputColorSpace=t,e.colorSpace=r}return this.renderer.domElement}}exports.ExportTexture=d;exports.hierarchyUUID=h;exports.resetThreeObjects=o;
@@ -0,0 +1,69 @@
1
+ import { OrthographicCamera as o, Scene as d, MeshBasicMaterial as m, BufferGeometry as p, Float32BufferAttribute as r, Mesh as u, LinearSRGBColorSpace as h } from "three";
2
+ let n = 0;
3
+ const g = () => {
4
+ n = 0;
5
+ }, f = (i) => {
6
+ if (!i) return;
7
+ let e = i.name.replaceAll(" ", "").replaceAll("/", ".");
8
+ if (e.length === 0 && (e = `obj_${n}`, n++), i.parent !== null && i.parent.uuid.length > 0 && (e = `${i.parent.uuid}.${e}`), i.uuid = e, i.isMesh !== void 0) {
9
+ const t = i;
10
+ if (Array.isArray(t.material))
11
+ t.material.forEach((a, s) => {
12
+ a.uuid = `${e}.material.${s}`;
13
+ });
14
+ else {
15
+ const a = t.material;
16
+ a.uuid = `${e}.material`;
17
+ }
18
+ }
19
+ i.children.forEach((t) => f(t));
20
+ };
21
+ class v {
22
+ static renderer;
23
+ static canvas;
24
+ static context = null;
25
+ static scene = null;
26
+ static camera = null;
27
+ static material = null;
28
+ static inited = !1;
29
+ static width = 100;
30
+ static height = 100;
31
+ static init() {
32
+ this.inited || (this.canvas = document.createElement("canvas"), this.canvas.width = this.width, this.canvas.height = this.height, this.context = this.canvas.getContext("2d"), this.inited = !0);
33
+ }
34
+ static renderToBlob(e) {
35
+ this.init();
36
+ const t = e.repeat.clone(), a = e.offset.clone();
37
+ if (e.repeat.set(1, 1), e.offset.set(0, 0), this.context !== null) {
38
+ this.context.clearRect(0, 0, this.width, this.height);
39
+ const s = e.image;
40
+ if (s != null && s.width > 0) {
41
+ this.canvas.title = e.sourceFile;
42
+ const c = this.canvas.width / s.width, l = this.renderToCanvas(e);
43
+ this.context.drawImage(l, 0, 0, s.width * c, s.height * c);
44
+ }
45
+ }
46
+ return e.repeat.copy(t), e.offset.copy(a), this.canvas.toDataURL("image/png");
47
+ }
48
+ static renderToCanvas(e) {
49
+ if (this.material === null) {
50
+ this.camera = new o(-0.5, 0.5, 0.5, -0.5, 0, 100), this.scene = new d(), this.material = new m();
51
+ const t = new p();
52
+ t.setAttribute("position", new r([-0.5, -0.5, 0, 1.5, -0.5, 0, -0.5, 1.5, 0], 3)), t.setAttribute("normal", new r([0, 0, 1, 0, 0, 1], 3)), t.setAttribute("uv", new r([0, 0, 2, 0, 0, 2], 2));
53
+ const a = new u(t, this.material);
54
+ this.scene.add(a);
55
+ }
56
+ if (e.isRenderTargetTexture)
57
+ this.material.map = e, this.renderer.render(this.scene, this.camera);
58
+ else {
59
+ const t = this.renderer.outputColorSpace, a = e.colorSpace;
60
+ this.renderer.outputColorSpace = h, e.colorSpace = h, this.material.map = e, this.renderer.render(this.scene, this.camera), this.renderer.outputColorSpace = t, e.colorSpace = a;
61
+ }
62
+ return this.renderer.domElement;
63
+ }
64
+ }
65
+ export {
66
+ v as ExportTexture,
67
+ f as hierarchyUUID,
68
+ g as resetThreeObjects
69
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=a(["ctrlKey","metaKey","shiftKey","button","pointerId","pointerType","clientX","clientY","pageX","pageY"]),p=a(["clientX","clientY","deltaX","deltaY","deltaMode"]),y=a(["ctrlKey","metaKey","shiftKey","keyCode"]);function h(e,n){e.preventDefault(),p(e,n)}function f(e){e.preventDefault()}function m(e,n,t){for(const r of n)t[r]=e[r]}function a(e){return function(t,r){const o={type:t.type};m(t,e,o),r(o)}}function c(e,n){const t=[],r={type:e.type,touches:t};for(let o=0;o<e.touches.length;++o){const i=e.touches[o];t.push({pageX:i.pageX,pageY:i.pageY})}n(r)}const v={37:!0,38:!0,39:!0,40:!0};function w(e,n){const{keyCode:t}=e;v[t]&&(e.preventDefault(),y(e,n))}const g={contextmenu:f,mousedown:s,mousemove:s,mouseup:s,pointerdown:s,pointermove:s,pointerup:s,touchstart:c,touchmove:c,touchend:c,wheel:h,keydown:w};let E=0;class H{id;worker;constructor(n,t,r){this.id=E++,this.worker=t;const o=d=>{this.worker.postMessage({type:"event",id:this.id,data:d})};t.postMessage({type:"makeProxy",id:this.id});for(const[d,l]of Object.entries(r))n.addEventListener(d,u=>{l(u,o)});function i(){o({type:"resize",left:0,top:0,width:innerWidth,height:innerHeight})}window.addEventListener("resize",i),i()}}exports.ElementProxy=H;exports.WebworkerEventHandlers=g;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("three"),e=require("../core/types.cjs");class i extends n.EventDispatcher{style={};left=0;top=0;width=0;height=0;ownerDocument=void 0;constructor(){super(),this.ownerDocument=this}get clientWidth(){return this.width}set clientWidth(t){this.width=t}get clientHeight(){return this.height}set clientHeight(t){this.height=t}setPointerCapture(){}releasePointerCapture(){}getBoundingClientRect(){return{x:this.left,y:this.top,left:this.left,top:this.top,width:this.width,height:this.height,right:this.left+this.width,bottom:this.top+this.height,toJSON:()=>({})}}handleEvent(t){if(t.type==="size"){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height;return}t.preventDefault=e.noop,t.stopPropagation=e.noop,this.dispatchEvent(t)}focus(){}getRootNode(){return this}}class o{targets={};constructor(){this.handleEvent=this.handleEvent.bind(this)}makeProxy(t){const{id:s}=t,r=new i;this.targets[s]=r}getProxy(t){return this.targets[t]}handleEvent(t){this.targets[t.id]?.handleEvent(t.data)}}exports.ElementProxyReceiver=i;exports.ProxyManager=o;
package/package.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "author": "Colin Duffy <http://tomorrowevening.com/>",
4
4
  "description": "An extendable set of Web Tools controlled via a separate window for non-intereference with content.",
5
5
  "license": "GPL-3.0-or-later",
6
- "main": "./dist/hermes.cjs.js",
6
+ "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "type": "module",
10
10
  "sideEffects": ["**/*.css"],
11
- "version": "0.1.41",
11
+ "version": "0.1.43",
12
12
  "homepage": "https://github.com/tomorrowevening/hermes#readme",
13
13
  "bugs": {
14
14
  "url": "https://github.com/tomorrowevening/hermes/issues"
@@ -22,15 +22,31 @@
22
22
  "files": [
23
23
  "dist",
24
24
  "types/**/*.d.ts",
25
- "!public/images",
26
- "!public/json",
27
- "!public/models"
25
+ "!dist/images/**",
26
+ "!dist/json/**",
27
+ "!dist/models/**",
28
+ "!dist/index-*.js",
29
+ "!dist/index-*.css",
30
+ "!dist/ThreeEditor-*.js",
31
+ "!dist/ThreeEditor-*.css",
32
+ "!dist/index.css",
33
+ "!dist/index.html"
28
34
  ],
29
35
  "exports": {
30
36
  ".": {
31
37
  "types": "./types/index.d.ts",
32
38
  "import": "./dist/index.js",
33
- "require": "./dist/hermes.cjs.js"
39
+ "require": "./dist/index.cjs"
40
+ },
41
+ "./editor": {
42
+ "types": "./types/editor/index.d.ts",
43
+ "import": "./dist/editor/index.js",
44
+ "require": "./dist/editor/index.cjs"
45
+ },
46
+ "./editor/*": {
47
+ "types": "./types/editor/*.d.ts",
48
+ "import": "./dist/editor/*.js",
49
+ "require": "./dist/editor/*.cjs"
34
50
  },
35
51
  "./hermes.css": "./dist/hermes.css"
36
52
  },
@@ -40,7 +56,7 @@
40
56
  },
41
57
  "scripts": {
42
58
  "server": "node server/index.mjs",
43
- "clean": "rimraf dist types",
59
+ "clean": "rimraf dist types example-dist",
44
60
  "dev": "vite",
45
61
  "declare": "tsc --declaration --emitDeclarationOnly --declarationDir types",
46
62
  "buildLib": "yarn declare && vite build",
@@ -0,0 +1,26 @@
1
+ export * from './sidePanel/utils';
2
+ export * from './utils';
3
+ export { default as NavButton } from './components/NavButton';
4
+ export { default as DraggableItem } from './components/DraggableItem';
5
+ export { default as Draggable } from './components/Draggable';
6
+ export { default as DropdownItem } from './components/DropdownItem';
7
+ export { default as Dropdown } from './components/Dropdown';
8
+ export { default as SidePanel } from './sidePanel/SidePanel';
9
+ export { default as Accordion } from './sidePanel/Accordion';
10
+ export { default as ChildObject } from './sidePanel/ChildObject';
11
+ export { default as ContainerObject } from './sidePanel/ContainerObject';
12
+ export { default as Inspector } from './sidePanel/inspector/Inspector';
13
+ export { default as MultiView } from './multiView/MultiView';
14
+ export { default as Editor } from './Editor';
15
+ export { default as ThreeEditor } from './ThreeEditor';
16
+ export { default as HermesApp } from './HermesApp';
17
+ export { default as Transform } from './tools/Transform';
18
+ export { default as Spline } from './tools/splineEditor/Spline';
19
+ export { default as SplineEditor } from './tools/splineEditor';
20
+ export { default as InfiniteGridMaterial } from './multiView/InfiniteGridMaterial';
21
+ export { default as InfiniteGridNodeMaterial } from './multiView/InfiniteGridNodeMaterial';
22
+ export { default as InfiniteGridHelper } from './multiView/InfiniteGridHelper';
23
+ export { default as InfiniteGridHelperGPU } from './multiView/InfiniteGridHelperGPU';
24
+ export { default as DepthNodeMaterial } from './multiView/DepthNodeMaterial';
25
+ export { default as UVMaterial } from './multiView/UVMaterial';
26
+ export { default as UVNodeMaterial } from './multiView/UVNodeMaterial';
@@ -7,3 +7,10 @@ export declare function stripObject(obj: Object3D): RemoteObject;
7
7
  export declare function getSubItem(child: any, key: string): any;
8
8
  export declare function setItemProps(child: any, key: string, value: any): void;
9
9
  export declare function textureFromSrc(imgSource: string): Promise<Texture>;
10
+ export declare const EDITOR_UTILS: {
11
+ stripObject: typeof stripObject;
12
+ stripScene: typeof stripScene;
13
+ getSubItem: typeof getSubItem;
14
+ setItemProps: typeof setItemProps;
15
+ textureFromSrc: typeof textureFromSrc;
16
+ };
package/types/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './core/types';
2
- export * from './editor/utils';
3
2
  export * from './utils/detectSettings';
4
3
  export * from './utils/ImageSequenceCapturer';
5
4
  export * from './utils/math';
@@ -13,27 +12,4 @@ export { default as Application } from './core/Application';
13
12
  export { default as BaseRemote } from './core/remote/BaseRemote';
14
13
  export { default as RemoteTheatre } from './core/remote/RemoteTheatre';
15
14
  export { default as RemoteThree } from './core/remote/RemoteThree';
16
- export { default as NavButton } from './editor/components/NavButton';
17
- export { default as DraggableItem } from './editor/components/DraggableItem';
18
- export { default as Draggable } from './editor/components/Draggable';
19
- export { default as DropdownItem } from './editor/components/DropdownItem';
20
- export { default as Dropdown } from './editor/components/Dropdown';
21
- export { default as SidePanel } from './editor/sidePanel/SidePanel';
22
- export { default as Accordion } from './editor/sidePanel/Accordion';
23
- export { default as ChildObject } from './editor/sidePanel/ChildObject';
24
- export { default as ContainerObject } from './editor/sidePanel/ContainerObject';
25
- export { default as Inspector } from './editor/sidePanel/inspector/Inspector';
26
- export { default as MultiView } from './editor/multiView/MultiView';
27
- export { default as Editor } from './editor/Editor';
28
- export { default as ThreeEditor } from './editor/ThreeEditor';
29
15
  export { default as HermesApp } from './editor/HermesApp';
30
- export { default as Transform } from './editor/tools/Transform';
31
- export { default as Spline } from './editor/tools/splineEditor/Spline';
32
- export { default as SplineEditor } from './editor/tools/splineEditor';
33
- export { default as InfiniteGridMaterial } from './editor/multiView/InfiniteGridMaterial';
34
- export { default as InfiniteGridNodeMaterial } from './editor/multiView/InfiniteGridNodeMaterial';
35
- export { default as InfiniteGridHelper } from './editor/multiView/InfiniteGridHelper';
36
- export { default as InfiniteGridHelperGPU } from './editor/multiView/InfiniteGridHelperGPU';
37
- export { default as DepthNodeMaterial } from './editor/multiView/DepthNodeMaterial';
38
- export { default as UVMaterial } from './editor/multiView/UVMaterial';
39
- export { default as UVNodeMaterial } from './editor/multiView/UVNodeMaterial';
@@ -0,0 +1,4 @@
1
+ import { Material, Object3D, Texture } from 'three';
2
+ export declare const disposeTexture: (texture?: Texture) => void;
3
+ export declare const disposeMaterial: (material?: Material | Material[]) => void;
4
+ export declare const dispose: (object: Object3D) => void;
@@ -0,0 +1,17 @@
1
+ import { Object3D, Texture, WebGLRenderer } from 'three';
2
+ export declare const resetThreeObjects: () => void;
3
+ export declare const hierarchyUUID: (object: Object3D) => void;
4
+ export declare class ExportTexture {
5
+ static renderer: WebGLRenderer;
6
+ private static canvas;
7
+ private static context;
8
+ private static scene;
9
+ private static camera;
10
+ private static material;
11
+ private static inited;
12
+ private static width;
13
+ private static height;
14
+ private static init;
15
+ static renderToBlob(texture: Texture): string;
16
+ private static renderToCanvas;
17
+ }