@needle-tools/engine 5.0.0 → 5.1.0-experimental.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 (181) hide show
  1. package/components.needle.json +1 -1
  2. package/dist/generateMeshBVH.worker-DT9A2Hrc.js +1 -0
  3. package/dist/gltf-progressive-3BwW4ETO.min.js +10 -0
  4. package/dist/gltf-progressive-ByD1UX0A.umd.cjs +10 -0
  5. package/dist/{gltf-progressive-Cl167Vjx.js → gltf-progressive-DwWaVr0o.js} +412 -394
  6. package/dist/gltf-progressive.worker-DpfUjn1n.js +3 -0
  7. package/dist/{materialx-qPScBWhj.min.js → materialx-9KHBidZa.min.js} +1 -1
  8. package/dist/{materialx-4ApD6Vz5.js → materialx-BBDu8W5P.js} +1 -1
  9. package/dist/{materialx-D0XUnhBY.umd.cjs → materialx-hLP3E8AA.umd.cjs} +2 -2
  10. package/dist/{needle-engine.bundle-CoEvMwYM.min.js → needle-engine.bundle-BiCxyTBE.min.js} +110 -110
  11. package/dist/{needle-engine.bundle-BAYLGumK.umd.cjs → needle-engine.bundle-CaHKqc30.umd.cjs} +123 -123
  12. package/dist/{needle-engine.bundle-BDIyvCV6.js → needle-engine.bundle-JZXX6OjM.js} +2143 -2088
  13. package/dist/needle-engine.d.ts +102 -44
  14. package/dist/needle-engine.js +480 -476
  15. package/dist/needle-engine.min.js +1 -1
  16. package/dist/needle-engine.umd.cjs +1 -1
  17. package/dist/{postprocessing-B_9sKVU7.min.js → postprocessing-BZfyAdCY.min.js} +1 -1
  18. package/dist/{postprocessing-WDc9WwI3.js → postprocessing-CXlA3QA6.js} +1 -1
  19. package/dist/{postprocessing-B2wb6pzI.umd.cjs → postprocessing-Dwy7Hz_T.umd.cjs} +38 -38
  20. package/dist/three-examples.js +4760 -3641
  21. package/dist/three-examples.min.js +17 -35
  22. package/dist/three-examples.umd.cjs +16 -34
  23. package/dist/three.js +48533 -28562
  24. package/dist/three.min.js +716 -502
  25. package/dist/three.umd.cjs +720 -506
  26. package/dist/vendor-Bf43L3CE.min.js +1116 -0
  27. package/dist/{vendor-CntUvmJu.umd.cjs → vendor-BlyEaMTL.umd.cjs} +31 -31
  28. package/dist/{vendor-vHLk8sXu.js → vendor-D-7l5gB0.js} +2562 -2556
  29. package/lib/engine/engine_animation.js +1 -1
  30. package/lib/engine/engine_animation.js.map +1 -1
  31. package/lib/engine/engine_audio.js.map +1 -1
  32. package/lib/engine/engine_context.js +3 -6
  33. package/lib/engine/engine_context.js.map +1 -1
  34. package/lib/engine/engine_create_objects.js +0 -1
  35. package/lib/engine/engine_create_objects.js.map +1 -1
  36. package/lib/engine/engine_element.d.ts +113 -0
  37. package/lib/engine/engine_element.js +833 -0
  38. package/lib/engine/engine_element.js.map +1 -0
  39. package/lib/engine/engine_element_attributes.d.ts +72 -0
  40. package/lib/engine/engine_element_attributes.js +2 -0
  41. package/lib/engine/engine_element_attributes.js.map +1 -0
  42. package/lib/engine/engine_element_extras.d.ts +6 -0
  43. package/lib/engine/engine_element_extras.js +14 -0
  44. package/lib/engine/engine_element_extras.js.map +1 -0
  45. package/lib/engine/engine_element_loading.d.ts +44 -0
  46. package/lib/engine/engine_element_loading.js +350 -0
  47. package/lib/engine/engine_element_loading.js.map +1 -0
  48. package/lib/engine/engine_element_overlay.d.ts +21 -0
  49. package/lib/engine/engine_element_overlay.js +167 -0
  50. package/lib/engine/engine_element_overlay.js.map +1 -0
  51. package/lib/engine/engine_license.js.map +1 -1
  52. package/lib/engine/engine_pmrem.js +2 -2
  53. package/lib/engine/engine_pmrem.js.map +1 -1
  54. package/lib/engine/engine_scenetools.d.ts +62 -0
  55. package/lib/engine/engine_scenetools.js +337 -0
  56. package/lib/engine/engine_scenetools.js.map +1 -0
  57. package/lib/engine/engine_test_utils.d.ts +39 -0
  58. package/lib/engine/engine_test_utils.js +84 -0
  59. package/lib/engine/engine_test_utils.js.map +1 -0
  60. package/lib/engine/engine_three_utils.js.map +1 -1
  61. package/lib/engine/engine_time.js +4 -3
  62. package/lib/engine/engine_time.js.map +1 -1
  63. package/lib/engine/engine_ui.d.ts +25 -0
  64. package/lib/engine/engine_ui.dummy_canvas.d.ts +2 -0
  65. package/lib/engine/engine_ui.dummy_canvas.js +55 -0
  66. package/lib/engine/engine_ui.dummy_canvas.js.map +1 -0
  67. package/lib/engine/engine_ui.js +168 -0
  68. package/lib/engine/engine_ui.js.map +1 -0
  69. package/lib/engine/extensions/NEEDLE_lightmaps.js +2 -2
  70. package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -1
  71. package/lib/engine/extensions/NEEDLE_pmrem.d.ts +1 -1
  72. package/lib/engine/webcomponents/icons.js +3 -2
  73. package/lib/engine/webcomponents/icons.js.map +1 -1
  74. package/lib/engine/webcomponents/needle-engine.attributes.d.ts +69 -0
  75. package/lib/engine/webcomponents/needle-engine.attributes.js +2 -0
  76. package/lib/engine/webcomponents/needle-engine.attributes.js.map +1 -0
  77. package/lib/engine-components/AudioSource.js +1 -1
  78. package/lib/engine-components/AudioSource.js.map +1 -1
  79. package/lib/engine-components/Light.d.ts +3 -0
  80. package/lib/engine-components/Light.js +39 -31
  81. package/lib/engine-components/Light.js.map +1 -1
  82. package/lib/engine-components/OrbitControls.js +2 -1
  83. package/lib/engine-components/OrbitControls.js.map +1 -1
  84. package/lib/engine-components/SpriteRenderer.d.ts +1 -1
  85. package/lib/engine-components/VideoPlayer.d.ts +1 -1
  86. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
  87. package/lib/engine-components/export/usdz/extensions/Animation.js +1 -0
  88. package/lib/engine-components/export/usdz/extensions/Animation.js.map +1 -1
  89. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  90. package/lib/engine-components/particlesystem/ParticleSystem.d.ts +1 -1
  91. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  92. package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
  93. package/lib/engine-components/ui/BaseUIComponent_Uikit.d.ts +54 -0
  94. package/lib/engine-components/ui/BaseUIComponent_Uikit.js +114 -0
  95. package/lib/engine-components/ui/BaseUIComponent_Uikit.js.map +1 -0
  96. package/lib/engine-components/ui/BaseUikitComponent.d.ts +54 -0
  97. package/lib/engine-components/ui/BaseUikitComponent.js +114 -0
  98. package/lib/engine-components/ui/BaseUikitComponent.js.map +1 -0
  99. package/lib/engine-components/ui/Button.legacy.d.ts +68 -0
  100. package/lib/engine-components/ui/Button.legacy.js +320 -0
  101. package/lib/engine-components/ui/Button.legacy.js.map +1 -0
  102. package/lib/engine-components/ui/ButtonUikit.d.ts +51 -0
  103. package/lib/engine-components/ui/ButtonUikit.js +187 -0
  104. package/lib/engine-components/ui/ButtonUikit.js.map +1 -0
  105. package/lib/engine-components/ui/Canvas.js +2 -2
  106. package/lib/engine-components/ui/Canvas.js.map +1 -1
  107. package/lib/engine-components/ui/Canvas.legacy.d.ts +76 -0
  108. package/lib/engine-components/ui/Canvas.legacy.js +409 -0
  109. package/lib/engine-components/ui/Canvas.legacy.js.map +1 -0
  110. package/lib/engine-components/ui/CanvasUikit.d.ts +68 -0
  111. package/lib/engine-components/ui/CanvasUikit.js +289 -0
  112. package/lib/engine-components/ui/CanvasUikit.js.map +1 -0
  113. package/lib/engine-components/ui/Graphic.d.ts +3 -3
  114. package/lib/engine-components/ui/Graphic.js +6 -2
  115. package/lib/engine-components/ui/Graphic.js.map +1 -1
  116. package/lib/engine-components/ui/Graphic.legacy.d.ts +55 -0
  117. package/lib/engine-components/ui/Graphic.legacy.js +268 -0
  118. package/lib/engine-components/ui/Graphic.legacy.js.map +1 -0
  119. package/lib/engine-components/ui/GraphicUikit.d.ts +21 -0
  120. package/lib/engine-components/ui/GraphicUikit.js +65 -0
  121. package/lib/engine-components/ui/GraphicUikit.js.map +1 -0
  122. package/lib/engine-components/ui/Image.js.map +1 -1
  123. package/lib/engine-components/ui/Image.legacy.d.ts +39 -0
  124. package/lib/engine-components/ui/Image.legacy.js +121 -0
  125. package/lib/engine-components/ui/Image.legacy.js.map +1 -0
  126. package/lib/engine-components/ui/ImageUikit.d.ts +22 -0
  127. package/lib/engine-components/ui/ImageUikit.js +97 -0
  128. package/lib/engine-components/ui/ImageUikit.js.map +1 -0
  129. package/lib/engine-components/ui/RenderMode.d.ts +14 -0
  130. package/lib/engine-components/ui/RenderMode.js +16 -0
  131. package/lib/engine-components/ui/RenderMode.js.map +1 -0
  132. package/lib/engine-components/ui/Text.d.ts +64 -11
  133. package/lib/engine-components/ui/Text.js +154 -45
  134. package/lib/engine-components/ui/Text.js.map +1 -1
  135. package/lib/engine-components/ui/Text.legacy.d.ts +81 -0
  136. package/lib/engine-components/ui/Text.legacy.js +548 -0
  137. package/lib/engine-components/ui/Text.legacy.js.map +1 -0
  138. package/lib/engine-components/ui/TextUikit.d.ts +42 -0
  139. package/lib/engine-components/ui/TextUikit.js +164 -0
  140. package/lib/engine-components/ui/TextUikit.js.map +1 -0
  141. package/lib/engine-components/ui/index.d.ts +1 -0
  142. package/lib/engine-components/ui/index.js +1 -0
  143. package/lib/engine-components/ui/index.js.map +1 -1
  144. package/lib/engine-components/webxr/WebARCameraBackground.d.ts +1 -1
  145. package/lib/include/three/EXT_mesh_gpu_instancing_exporter.d.ts +6 -0
  146. package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js +46 -0
  147. package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js.map +1 -0
  148. package/package.json +5 -5
  149. package/plugins/common/buildinfo.d.ts +6 -0
  150. package/plugins/vite/ai.d.ts +7 -8
  151. package/plugins/vite/ai.js +95 -20
  152. package/plugins/vite/alias.js +6 -0
  153. package/plugins/vite/dependencies.js +7 -0
  154. package/src/engine/engine_animation.ts +1 -1
  155. package/src/engine/engine_audio.ts +1 -1
  156. package/src/engine/engine_context.ts +3 -6
  157. package/src/engine/engine_create_objects.ts +0 -1
  158. package/src/engine/engine_license.ts +0 -2
  159. package/src/engine/engine_pmrem.ts +3 -3
  160. package/src/engine/engine_three_utils.ts +2 -2
  161. package/src/engine/engine_time.ts +4 -3
  162. package/src/engine/extensions/NEEDLE_lightmaps.ts +3 -3
  163. package/src/engine/webcomponents/icons.ts +3 -2
  164. package/src/engine-components/AudioSource.ts +1 -1
  165. package/src/engine-components/Light.ts +39 -31
  166. package/src/engine-components/OrbitControls.ts +2 -2
  167. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2 -2
  168. package/src/engine-components/export/usdz/extensions/Animation.ts +6 -5
  169. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +1 -1
  170. package/src/engine-components/postprocessing/PostProcessingHandler.ts +3 -3
  171. package/src/engine-components/timeline/TimelineTracks.ts +2 -2
  172. package/src/engine-components/ui/Canvas.ts +2 -2
  173. package/src/engine-components/ui/Graphic.ts +7 -3
  174. package/src/engine-components/ui/Image.ts +1 -1
  175. package/src/engine-components/ui/Text.ts +170 -52
  176. package/src/engine-components/ui/index.ts +2 -1
  177. package/dist/generateMeshBVH.worker-DiCnZlf3.js +0 -21
  178. package/dist/gltf-progressive-BryRjllq.min.js +0 -10
  179. package/dist/gltf-progressive-DJBMx-zB.umd.cjs +0 -10
  180. package/dist/gltf-progressive.worker-BqODMeeW.js +0 -23
  181. package/dist/vendor-DPbfJJ4d.min.js +0 -1116
@@ -0,0 +1,114 @@
1
+ import { Container } from "@pmndrs/uikit";
2
+ import { Behaviour, GameObject } from "../Component.js";
3
+ import { Canvas } from "./Canvas.js";
4
+ /**
5
+ * Base class for all uikit-based UI components in needle-engine.
6
+ * This provides the foundation for creating UI elements using pmndrs/uikit.
7
+ *
8
+ * @category User Interface
9
+ * @group Components
10
+ */
11
+ export class BaseUIComponent extends Behaviour {
12
+ /** The underlying uikit Container */
13
+ uikitElement = null;
14
+ _canvas = undefined;
15
+ _parentUikitComponent = undefined;
16
+ /**
17
+ * Get the parent Canvas component
18
+ */
19
+ get canvas() {
20
+ if (this._canvas === undefined) {
21
+ this._canvas = GameObject.getComponentInParent(this.gameObject, Canvas);
22
+ }
23
+ return this._canvas;
24
+ }
25
+ /**
26
+ * Get the parent uikit component
27
+ */
28
+ get parentUikitComponent() {
29
+ if (this._parentUikitComponent === undefined) {
30
+ const searchFrom = this.gameObject.parent;
31
+ this._parentUikitComponent = searchFrom ? GameObject.getComponentInParent(searchFrom, BaseUIComponent) : null;
32
+ }
33
+ return this._parentUikitComponent;
34
+ }
35
+ awake() {
36
+ // Reset cached references
37
+ this._canvas = undefined;
38
+ this._parentUikitComponent = undefined;
39
+ }
40
+ onEnable() {
41
+ super.onEnable();
42
+ this.createUikitElement();
43
+ this.addToParent();
44
+ }
45
+ onDisable() {
46
+ super.onDisable();
47
+ this.removeFromParent();
48
+ }
49
+ /**
50
+ * Create the uikit element for this component.
51
+ * Override this to create custom uikit elements.
52
+ */
53
+ createUikitElement() {
54
+ if (this.uikitElement)
55
+ return;
56
+ const properties = this.getUikitProperties();
57
+ this.uikitElement = new Container(properties);
58
+ this.uikitElement.name = this.name || this.constructor.name;
59
+ }
60
+ /**
61
+ * Get the properties to pass to the uikit element constructor.
62
+ * Override this to customize the uikit element properties.
63
+ */
64
+ getUikitProperties() {
65
+ return {};
66
+ }
67
+ /**
68
+ * Update the uikit element properties.
69
+ * Call this after changing properties to apply them to the uikit element.
70
+ */
71
+ updateUikitProperties(properties) {
72
+ if (this.uikitElement) {
73
+ this.uikitElement.setProperties(properties);
74
+ }
75
+ }
76
+ /**
77
+ * Add this component's uikit element to its parent
78
+ */
79
+ addToParent() {
80
+ if (!this.uikitElement)
81
+ return;
82
+ // Try to find parent uikit component
83
+ const parent = this.parentUikitComponent;
84
+ if (parent?.uikitElement) {
85
+ parent.uikitElement.add(this.uikitElement);
86
+ return;
87
+ }
88
+ // Try to add to canvas root
89
+ const canvas = this.canvas;
90
+ if (canvas?.uikitRoot) {
91
+ canvas.uikitRoot.add(this.uikitElement);
92
+ return;
93
+ }
94
+ console.warn(`BaseUIComponent "${this.name}": No parent uikit element or canvas found. Make sure this component is a child of a Canvas.`);
95
+ }
96
+ /**
97
+ * Remove this component's uikit element from its parent
98
+ */
99
+ removeFromParent() {
100
+ if (this.uikitElement) {
101
+ this.uikitElement.removeFromParent();
102
+ }
103
+ }
104
+ /**
105
+ * Called when the component is destroyed
106
+ */
107
+ onDestroy() {
108
+ if (this.uikitElement) {
109
+ this.uikitElement.removeFromParent();
110
+ this.uikitElement = null;
111
+ }
112
+ }
113
+ }
114
+ //# sourceMappingURL=BaseUIComponent_Uikit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseUIComponent_Uikit.js","sourceRoot":"","sources":["../../../src/engine-components/ui/BaseUIComponent_Uikit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA4B,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAE1C,qCAAqC;IAC3B,YAAY,GAAqB,IAAI,CAAC;IAExC,OAAO,GAAmB,SAAS,CAAC;IACpC,qBAAqB,GAA4B,SAAS,CAAC;IAEnE;;OAEG;IACH,IAAc,MAAM;QAChB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC5B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;SAC3E;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAc,oBAAoB;QAC9B,IAAI,IAAI,CAAC,qBAAqB,KAAK,SAAS,EAAE;YAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAC1C,IAAI,CAAC,qBAAqB,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC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B;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,MAAM,EAAE,SAAS,EAAE;YACnB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACxC,OAAO;SACV;QAED,OAAO,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,IAAI,8FAA8F,CAAC,CAAC;IAC9I,CAAC;IAED;;OAEG;IACK,gBAAgB;QACpB,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC;SACxC;IACL,CAAC;IAED;;OAEG;IACH,SAAS;QACL,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC;YACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC5B;IACL,CAAC;CACJ"}
@@ -0,0 +1,54 @@
1
+ import { Container, type ContainerProperties } from "@pmndrs/uikit";
2
+ import { Behaviour } from "../Component.js";
3
+ import { CanvasUikit } from "./CanvasUikit.js";
4
+ /**
5
+ * Base class for all uikit-based UI components in needle-engine.
6
+ * This provides the foundation for creating UI elements using pmndrs/uikit.
7
+ *
8
+ * @category User Interface
9
+ * @group Components
10
+ */
11
+ export declare class BaseUikitComponent extends Behaviour {
12
+ /** The underlying uikit Container */
13
+ protected uikitElement: Container | null;
14
+ private _canvas?;
15
+ private _parentUikitComponent?;
16
+ /**
17
+ * Get the parent Canvas component
18
+ */
19
+ protected get canvas(): CanvasUikit | null;
20
+ /**
21
+ * Get the parent uikit component
22
+ */
23
+ protected get parentUikitComponent(): BaseUikitComponent | null;
24
+ awake(): void;
25
+ onEnable(): void;
26
+ onDisable(): void;
27
+ /**
28
+ * Create the uikit element for this component.
29
+ * Override this to create custom uikit elements.
30
+ */
31
+ protected createUikitElement(): void;
32
+ /**
33
+ * Get the properties to pass to the uikit element constructor.
34
+ * Override this to customize the uikit element properties.
35
+ */
36
+ protected getUikitProperties(): ContainerProperties;
37
+ /**
38
+ * Update the uikit element properties.
39
+ * Call this after changing properties to apply them to the uikit element.
40
+ */
41
+ protected updateUikitProperties(properties: Partial<ContainerProperties>): void;
42
+ /**
43
+ * Add this component's uikit element to its parent
44
+ */
45
+ private addToParent;
46
+ /**
47
+ * Remove this component's uikit element from its parent
48
+ */
49
+ private removeFromParent;
50
+ /**
51
+ * Called when the component is destroyed
52
+ */
53
+ onDestroy(): void;
54
+ }
@@ -0,0 +1,114 @@
1
+ import { Container } from "@pmndrs/uikit";
2
+ import { Behaviour, GameObject } from "../Component.js";
3
+ import { CanvasUikit } from "./CanvasUikit.js";
4
+ /**
5
+ * Base class for all uikit-based UI components in needle-engine.
6
+ * This provides the foundation for creating UI elements using pmndrs/uikit.
7
+ *
8
+ * @category User Interface
9
+ * @group Components
10
+ */
11
+ export class BaseUikitComponent extends Behaviour {
12
+ /** The underlying uikit Container */
13
+ uikitElement = null;
14
+ _canvas = undefined;
15
+ _parentUikitComponent = undefined;
16
+ /**
17
+ * Get the parent Canvas component
18
+ */
19
+ get canvas() {
20
+ if (this._canvas === undefined) {
21
+ this._canvas = GameObject.getComponentInParent(this.gameObject, CanvasUikit);
22
+ }
23
+ return this._canvas;
24
+ }
25
+ /**
26
+ * Get the parent uikit component
27
+ */
28
+ get parentUikitComponent() {
29
+ if (this._parentUikitComponent === undefined) {
30
+ const searchFrom = this.gameObject.parent;
31
+ this._parentUikitComponent = searchFrom ? GameObject.getComponentInParent(searchFrom, BaseUikitComponent) : null;
32
+ }
33
+ return this._parentUikitComponent;
34
+ }
35
+ awake() {
36
+ // Reset cached references
37
+ this._canvas = undefined;
38
+ this._parentUikitComponent = undefined;
39
+ }
40
+ onEnable() {
41
+ super.onEnable();
42
+ this.createUikitElement();
43
+ this.addToParent();
44
+ }
45
+ onDisable() {
46
+ super.onDisable();
47
+ this.removeFromParent();
48
+ }
49
+ /**
50
+ * Create the uikit element for this component.
51
+ * Override this to create custom uikit elements.
52
+ */
53
+ createUikitElement() {
54
+ if (this.uikitElement)
55
+ return;
56
+ const properties = this.getUikitProperties();
57
+ this.uikitElement = new Container(properties);
58
+ this.uikitElement.name = this.name || this.constructor.name;
59
+ }
60
+ /**
61
+ * Get the properties to pass to the uikit element constructor.
62
+ * Override this to customize the uikit element properties.
63
+ */
64
+ getUikitProperties() {
65
+ return {};
66
+ }
67
+ /**
68
+ * Update the uikit element properties.
69
+ * Call this after changing properties to apply them to the uikit element.
70
+ */
71
+ updateUikitProperties(properties) {
72
+ if (this.uikitElement) {
73
+ this.uikitElement.setProperties(properties);
74
+ }
75
+ }
76
+ /**
77
+ * Add this component's uikit element to its parent
78
+ */
79
+ addToParent() {
80
+ if (!this.uikitElement)
81
+ return;
82
+ // Try to find parent uikit component
83
+ const parent = this.parentUikitComponent;
84
+ if (parent?.uikitElement) {
85
+ parent.uikitElement.add(this.uikitElement);
86
+ return;
87
+ }
88
+ // Try to add to canvas root
89
+ const canvas = this.canvas;
90
+ if (canvas?.uikitRoot) {
91
+ canvas.uikitRoot.add(this.uikitElement);
92
+ return;
93
+ }
94
+ console.warn(`BaseUikitComponent "${this.name}": No parent uikit element or canvas found. Make sure this component is a child of a CanvasUikit.`);
95
+ }
96
+ /**
97
+ * Remove this component's uikit element from its parent
98
+ */
99
+ removeFromParent() {
100
+ if (this.uikitElement) {
101
+ this.uikitElement.removeFromParent();
102
+ }
103
+ }
104
+ /**
105
+ * Called when the component is destroyed
106
+ */
107
+ onDestroy() {
108
+ if (this.uikitElement) {
109
+ this.uikitElement.removeFromParent();
110
+ this.uikitElement = null;
111
+ }
112
+ }
113
+ }
114
+ //# sourceMappingURL=BaseUikitComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseUikitComponent.js","sourceRoot":"","sources":["../../../src/engine-components/ui/BaseUikitComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA4B,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAE,SAA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YAAY,CAAC,gBAAgB,EAAE,CAAC;YACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC5B;IACL,CAAC;CACJ"}
@@ -0,0 +1,68 @@
1
+ import { RGBAColor } from "../../engine/js-extensions/index.js";
2
+ import { Animator } from "../Animator.js";
3
+ import { Behaviour } from "../Component.js";
4
+ import { EventList } from "../EventList.js";
5
+ import type { IPointerEventHandler, PointerEventData } from "./PointerEvents.js";
6
+ export declare enum Transition {
7
+ None = 0,
8
+ ColorTint = 1,
9
+ SpriteSwap = 2,
10
+ Animation = 3
11
+ }
12
+ declare class ButtonColors {
13
+ colorMultiplier: 1;
14
+ disabledColor: RGBAColor;
15
+ fadeDuration: number;
16
+ highlightedColor: RGBAColor;
17
+ normalColor: RGBAColor;
18
+ pressedColor: RGBAColor;
19
+ selectedColor: RGBAColor;
20
+ }
21
+ declare class AnimationTriggers {
22
+ disabledTrigger: string;
23
+ highlightedTrigger: string;
24
+ normalTrigger: string;
25
+ pressedTrigger: string;
26
+ selectedTrigger: string;
27
+ }
28
+ /**
29
+ * Button is a UI component that can be clicked by the user to perform an action.
30
+ * It supports different visual states such as normal, highlighted, pressed, and disabled.
31
+ * You can customize the button's appearance using colors or animations for each state.
32
+ * @summary UI Button that can be clicked to perform actions
33
+ * @category User Interface
34
+ * @group Components
35
+ */
36
+ export declare class Button extends Behaviour implements IPointerEventHandler {
37
+ /**
38
+ * Invokes the onClick event
39
+ */
40
+ click(): void;
41
+ onClick: EventList<void>;
42
+ private _isHovered;
43
+ onPointerEnter(evt: PointerEventData): void;
44
+ onPointerExit(): void;
45
+ onPointerDown(_: any): void;
46
+ onPointerUp(_: any): void;
47
+ onPointerClick(args: PointerEventData): void;
48
+ colors?: ButtonColors;
49
+ transition?: Transition;
50
+ animationTriggers?: AnimationTriggers;
51
+ animator?: Animator;
52
+ set interactable(value: boolean);
53
+ get interactable(): boolean;
54
+ private _interactable;
55
+ private set_interactable;
56
+ awake(): void;
57
+ start(): void;
58
+ onEnable(): void;
59
+ onDestroy(): void;
60
+ private _requestedAnimatorTrigger?;
61
+ private setAnimatorTriggerAtEndOfFrame;
62
+ private _isInit;
63
+ private _image?;
64
+ private init;
65
+ private stateSetup;
66
+ private getFinalColor;
67
+ }
68
+ export {};
@@ -0,0 +1,320 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { showBalloonMessage } from "../../engine/debug/index.js";
8
+ import { Gizmos } from "../../engine/engine_gizmos.js";
9
+ import { PointerType } from "../../engine/engine_input.js";
10
+ import { serializable } from "../../engine/engine_serialization_decorator.js";
11
+ import { getParam } from "../../engine/engine_utils.js";
12
+ import { RGBAColor } from "../../engine/js-extensions/index.js";
13
+ import { Animator } from "../Animator.js";
14
+ import { Behaviour, GameObject } from "../Component.js";
15
+ import { EventList } from "../EventList.js";
16
+ import { Image } from "./Image.js";
17
+ import { GraphicRaycaster, Raycaster } from "./Raycaster.js";
18
+ const debug = getParam("debugbutton");
19
+ /// <summary>
20
+ ///Transition mode for a Selectable.
21
+ /// </summary>
22
+ export var Transition;
23
+ (function (Transition) {
24
+ /// <summary>
25
+ /// No Transition.
26
+ /// </summary>
27
+ Transition[Transition["None"] = 0] = "None";
28
+ /// <summary>
29
+ /// Use an color tint transition.
30
+ /// </summary>
31
+ Transition[Transition["ColorTint"] = 1] = "ColorTint";
32
+ /// <summary>
33
+ /// Use a sprite swap transition.
34
+ /// </summary>
35
+ Transition[Transition["SpriteSwap"] = 2] = "SpriteSwap";
36
+ /// <summary>
37
+ /// Use an animation transition.
38
+ /// </summary>
39
+ Transition[Transition["Animation"] = 3] = "Animation";
40
+ })(Transition || (Transition = {}));
41
+ class ButtonColors {
42
+ colorMultiplier;
43
+ disabledColor;
44
+ fadeDuration;
45
+ highlightedColor;
46
+ normalColor;
47
+ pressedColor;
48
+ selectedColor;
49
+ }
50
+ __decorate([
51
+ serializable()
52
+ ], ButtonColors.prototype, "colorMultiplier", void 0);
53
+ __decorate([
54
+ serializable(RGBAColor)
55
+ ], ButtonColors.prototype, "disabledColor", void 0);
56
+ __decorate([
57
+ serializable()
58
+ ], ButtonColors.prototype, "fadeDuration", void 0);
59
+ __decorate([
60
+ serializable(RGBAColor)
61
+ ], ButtonColors.prototype, "highlightedColor", void 0);
62
+ __decorate([
63
+ serializable(RGBAColor)
64
+ ], ButtonColors.prototype, "normalColor", void 0);
65
+ __decorate([
66
+ serializable(RGBAColor)
67
+ ], ButtonColors.prototype, "pressedColor", void 0);
68
+ __decorate([
69
+ serializable(RGBAColor)
70
+ ], ButtonColors.prototype, "selectedColor", void 0);
71
+ class AnimationTriggers {
72
+ disabledTrigger;
73
+ highlightedTrigger;
74
+ normalTrigger;
75
+ pressedTrigger;
76
+ selectedTrigger;
77
+ }
78
+ /**
79
+ * Button is a UI component that can be clicked by the user to perform an action.
80
+ * It supports different visual states such as normal, highlighted, pressed, and disabled.
81
+ * You can customize the button's appearance using colors or animations for each state.
82
+ * @summary UI Button that can be clicked to perform actions
83
+ * @category User Interface
84
+ * @group Components
85
+ */
86
+ export class Button extends Behaviour {
87
+ /**
88
+ * Invokes the onClick event
89
+ */
90
+ click() {
91
+ this.onClick?.invoke();
92
+ }
93
+ onClick = new EventList();
94
+ _isHovered = 0;
95
+ onPointerEnter(evt) {
96
+ const canSetCursor = evt.event.pointerType === "mouse" && evt.button === 0;
97
+ if (canSetCursor)
98
+ this._isHovered += 1;
99
+ if (debug)
100
+ console.warn("Button Enter", canSetCursor, this._isHovered, this.animationTriggers?.highlightedTrigger, this.animator);
101
+ if (!this.interactable)
102
+ return;
103
+ if (this.transition == Transition.Animation && this.animationTriggers && this.animator) {
104
+ this.animator.setTrigger(this.animationTriggers.highlightedTrigger);
105
+ }
106
+ else if (this.transition === Transition.ColorTint && this.colors) {
107
+ this._image?.setState("hovered");
108
+ }
109
+ if (canSetCursor)
110
+ this.context.input.setCursor("pointer");
111
+ }
112
+ onPointerExit() {
113
+ this._isHovered -= 1;
114
+ if (this._isHovered < 0)
115
+ this._isHovered = 0;
116
+ if (debug)
117
+ console.log("Button Exit", this._isHovered, this.animationTriggers?.highlightedTrigger, this.animator);
118
+ if (!this.interactable)
119
+ return;
120
+ if (this._isHovered > 0)
121
+ return;
122
+ this._isHovered = 0;
123
+ if (this.transition == Transition.Animation && this.animationTriggers && this.animator) {
124
+ this.animator.setTrigger(this.animationTriggers.normalTrigger);
125
+ }
126
+ else if (this.transition === Transition.ColorTint && this.colors) {
127
+ this._image?.setState("normal");
128
+ }
129
+ this.context.input.unsetCursor("pointer");
130
+ }
131
+ onPointerDown(_) {
132
+ if (debug)
133
+ console.log("Button Down", this.animationTriggers?.highlightedTrigger, this.animator);
134
+ if (!this.interactable)
135
+ return;
136
+ if (this.transition == Transition.Animation && this.animationTriggers && this.animator) {
137
+ this.animator.setTrigger(this.animationTriggers.pressedTrigger);
138
+ }
139
+ else if (this.transition === Transition.ColorTint && this.colors) {
140
+ this._image?.setState("pressed");
141
+ }
142
+ }
143
+ onPointerUp(_) {
144
+ if (debug)
145
+ console.warn("Button Up", this.animationTriggers?.highlightedTrigger, this.animator, this._isHovered);
146
+ if (!this.interactable)
147
+ return;
148
+ if (this.transition == Transition.Animation && this.animationTriggers && this.animator) {
149
+ this.animator.setTrigger(this._isHovered ? this.animationTriggers.highlightedTrigger : this.animationTriggers.normalTrigger);
150
+ }
151
+ else if (this.transition === Transition.ColorTint && this.colors) {
152
+ this._image?.setState(this._isHovered ? "hovered" : "normal");
153
+ }
154
+ }
155
+ onPointerClick(args) {
156
+ if (!this.interactable)
157
+ return;
158
+ if (args.button !== 0 && args.event.pointerType === PointerType.Mouse)
159
+ return;
160
+ // Button clicks should only run with left mouse button while using mouse
161
+ if (debug) {
162
+ console.warn("Button Click", this.onClick);
163
+ showBalloonMessage("CLICKED button " + this.name + " at " + this.context.time.frameCount);
164
+ }
165
+ // TODO: we can not *always* use the event right now because the hotspot sample is relying on onPointerClick on a parent object
166
+ // and it's not using the button
167
+ if (this.onClick && this.onClick.listenerCount > 0) {
168
+ this.onClick.invoke();
169
+ args.use();
170
+ // debug clicks for WebXR
171
+ if (debug) {
172
+ const pos = this.gameObject.worldPosition;
173
+ pos.add(this.gameObject.worldUp.multiplyScalar(1 + Math.random() * .5));
174
+ Gizmos.DrawLabel(pos, "CLICK:" + Date.now(), .1, 1 + Math.random() * .5);
175
+ }
176
+ }
177
+ }
178
+ colors;
179
+ transition;
180
+ animationTriggers;
181
+ animator;
182
+ // @serializable(Image)
183
+ // image? : Image;
184
+ set interactable(value) {
185
+ this._interactable = value;
186
+ if (this._image) {
187
+ this._image.setInteractable(value);
188
+ if (value)
189
+ this._image.setState("normal");
190
+ else
191
+ this._image.setState("disabled");
192
+ }
193
+ }
194
+ get interactable() { return this._interactable; }
195
+ _interactable = true;
196
+ set_interactable(value) {
197
+ this.interactable = value;
198
+ }
199
+ awake() {
200
+ super.awake();
201
+ if (debug)
202
+ console.log(this);
203
+ this._isInit = false;
204
+ this.init();
205
+ }
206
+ start() {
207
+ this._image?.setInteractable(this.interactable);
208
+ if (!this.gameObject.getComponentInParent(Raycaster)) {
209
+ this.gameObject.addComponent(GraphicRaycaster);
210
+ }
211
+ }
212
+ onEnable() {
213
+ super.onEnable();
214
+ }
215
+ onDestroy() {
216
+ if (this._isHovered)
217
+ this.context.input.unsetCursor("pointer");
218
+ }
219
+ _requestedAnimatorTrigger;
220
+ *setAnimatorTriggerAtEndOfFrame(requestedTriggerId) {
221
+ this._requestedAnimatorTrigger = requestedTriggerId;
222
+ yield;
223
+ yield;
224
+ if (this._requestedAnimatorTrigger == requestedTriggerId) {
225
+ this.animator?.setTrigger(requestedTriggerId);
226
+ }
227
+ }
228
+ _isInit = false;
229
+ _image;
230
+ init() {
231
+ if (this._isInit)
232
+ return;
233
+ this._isInit = true;
234
+ this._image = GameObject.getComponent(this.gameObject, Image);
235
+ if (this._image) {
236
+ this.stateSetup(this._image);
237
+ if (this.interactable)
238
+ this._image.setState("normal");
239
+ else
240
+ this._image.setState("disabled");
241
+ }
242
+ }
243
+ stateSetup(image) {
244
+ image.setInteractable(this.interactable);
245
+ // @marwie : If this piece of code could be moved to the SimpleStateBehavior instanciation location,
246
+ // Its setup could be eased :
247
+ // @see https://github.com/felixmariotto/three-mesh-ui/blob/7.1.x/examples/ex__keyboard.js#L407
248
+ const normal = this.getFinalColor(image.color, this.colors?.normalColor);
249
+ const normalState = {
250
+ state: "normal",
251
+ attributes: {
252
+ backgroundColor: normal,
253
+ backgroundOpacity: normal.alpha,
254
+ },
255
+ };
256
+ image.setupState(normalState);
257
+ const hover = this.getFinalColor(image.color, this.colors?.highlightedColor);
258
+ const hoverState = {
259
+ state: "hovered",
260
+ attributes: {
261
+ backgroundColor: hover,
262
+ backgroundOpacity: hover.alpha,
263
+ },
264
+ };
265
+ image.setupState(hoverState);
266
+ const pressed = this.getFinalColor(image.color, this.colors?.pressedColor);
267
+ const pressedState = {
268
+ state: "pressed",
269
+ attributes: {
270
+ backgroundColor: pressed,
271
+ backgroundOpacity: pressed.alpha,
272
+ }
273
+ };
274
+ image.setupState(pressedState);
275
+ const selected = this.getFinalColor(image.color, this.colors?.selectedColor);
276
+ const selectedState = {
277
+ state: "selected",
278
+ attributes: {
279
+ backgroundColor: selected,
280
+ backgroundOpacity: selected.alpha,
281
+ }
282
+ };
283
+ image.setupState(selectedState);
284
+ const disabled = this.getFinalColor(image.color, this.colors?.disabledColor);
285
+ const disabledState = {
286
+ state: "disabled",
287
+ attributes: {
288
+ backgroundColor: disabled,
289
+ // @marwie, this disabled alpha property doesn't seem to have the opacity requested in unity
290
+ backgroundOpacity: disabled.alpha
291
+ }
292
+ };
293
+ image.setupState(disabledState);
294
+ }
295
+ getFinalColor(col, col2) {
296
+ if (col2) {
297
+ return col.clone().multiply(col2).convertLinearToSRGB();
298
+ }
299
+ return col.clone().convertLinearToSRGB();
300
+ }
301
+ }
302
+ __decorate([
303
+ serializable(EventList)
304
+ ], Button.prototype, "onClick", void 0);
305
+ __decorate([
306
+ serializable(ButtonColors)
307
+ ], Button.prototype, "colors", void 0);
308
+ __decorate([
309
+ serializable()
310
+ ], Button.prototype, "transition", void 0);
311
+ __decorate([
312
+ serializable(AnimationTriggers)
313
+ ], Button.prototype, "animationTriggers", void 0);
314
+ __decorate([
315
+ serializable(Animator)
316
+ ], Button.prototype, "animator", void 0);
317
+ __decorate([
318
+ serializable()
319
+ ], Button.prototype, "interactable", null);
320
+ //# sourceMappingURL=Button.legacy.js.map