@nice2dev/ui-3d 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/cjs/core/i18n.js +3 -3
  2. package/dist/cjs/dance/DanceBridge.js +13 -13
  3. package/dist/cjs/dance/DanceScoreEngine.js +8 -8
  4. package/dist/cjs/dance/PoseDetector.js +20 -20
  5. package/dist/cjs/material/NiceMaterialEditor.js +19 -19
  6. package/dist/cjs/model/ModelEditorLeftPanel.js +5 -5
  7. package/dist/cjs/model/ModelEditorMenuBar.js +6 -6
  8. package/dist/cjs/model/ModelEditorRightPanel.js +19 -19
  9. package/dist/cjs/model/ModelEditorSubComponents.js +10 -10
  10. package/dist/cjs/model/ModelEditorTimeline.js +6 -6
  11. package/dist/cjs/model/ModelEditorToolbar.js +4 -4
  12. package/dist/cjs/model/ModelEditorViewport.js +2 -2
  13. package/dist/cjs/model/ModelViewer.js +14 -14
  14. package/dist/cjs/model/NiceArmatureEditor.js +18 -18
  15. package/dist/cjs/model/NiceMorphTargetEditor.js +18 -18
  16. package/dist/cjs/model/NiceOctree.js +16 -16
  17. package/dist/cjs/model/NicePhysicsSimulation.js +24 -24
  18. package/dist/cjs/model/NiceProceduralGeometry.js +8 -8
  19. package/dist/cjs/model/NiceTerrainEditor.js +19 -19
  20. package/dist/cjs/model/NiceWeightPainter.js +14 -14
  21. package/dist/cjs/model/NiceXRPreview.js +18 -18
  22. package/dist/cjs/model/useModelEditor.js +127 -127
  23. package/dist/cjs/model/useModelViewer.js +61 -61
  24. package/dist/cjs/particle/NiceParticleEditor.js +11 -11
  25. package/dist/cjs/rendering/NiceCascadedShadows.js +12 -12
  26. package/dist/cjs/rendering/NiceRenderExport.js +5 -5
  27. package/dist/cjs/rendering/NiceSSAO.js +18 -18
  28. package/dist/cjs/rendering/NiceSSR.js +14 -14
  29. package/dist/cjs/rendering/NiceWebGPURenderer.js +21 -21
  30. package/dist/cjs/ui/dist/NiceButton-D9l39Rs7.js +598 -0
  31. package/dist/cjs/ui/dist/NiceButton-D9l39Rs7.js.map +1 -0
  32. package/dist/cjs/ui/dist/NiceErrorBoundary-niMx1aSJ.js +647 -0
  33. package/dist/cjs/ui/dist/NiceErrorBoundary-niMx1aSJ.js.map +1 -0
  34. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5048 -0
  35. package/dist/cjs/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js.map +1 -0
  36. package/dist/cjs/ui/dist/NicePinCodeInput-CrMfdxxc.js +13081 -0
  37. package/dist/cjs/ui/dist/NicePinCodeInput-CrMfdxxc.js.map +1 -0
  38. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6054 -0
  39. package/dist/cjs/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js.map +1 -0
  40. package/dist/cjs/ui/dist/NiceToggle-CaY1u82g.js +280 -0
  41. package/dist/cjs/ui/dist/NiceToggle-CaY1u82g.js.map +1 -0
  42. package/dist/cjs/ui/dist/NiceWindow-SiCaREbq.js +806 -0
  43. package/dist/cjs/ui/dist/NiceWindow-SiCaREbq.js.map +1 -0
  44. package/dist/cjs/ui/dist/charts-Bx_kNBsE.js +3508 -0
  45. package/dist/cjs/ui/dist/charts-Bx_kNBsE.js.map +1 -0
  46. package/dist/cjs/ui/dist/core-BpghV7Ls.js +10249 -0
  47. package/dist/cjs/ui/dist/core-BpghV7Ls.js.map +1 -0
  48. package/dist/cjs/ui/dist/index-CIl98Vbm.js +40039 -0
  49. package/dist/cjs/ui/dist/index-CIl98Vbm.js.map +1 -0
  50. package/dist/cjs/uv/NiceUVEditor.js +24 -24
  51. package/dist/esm/model/ModelEditorLeftPanel.js +4 -4
  52. package/dist/esm/model/ModelEditorMenuBar.js +4 -4
  53. package/dist/esm/model/ModelEditorRightPanel.js +5 -5
  54. package/dist/esm/model/ModelEditorSubComponents.js +2 -2
  55. package/dist/esm/model/ModelEditorTimeline.js +5 -5
  56. package/dist/esm/model/ModelEditorToolbar.js +3 -3
  57. package/dist/esm/model/ModelEditorViewport.js +2 -2
  58. package/dist/esm/model/ModelViewer.js +2 -2
  59. package/dist/esm/ui/dist/NiceButton-D9l39Rs7.js +593 -0
  60. package/dist/esm/ui/dist/NiceButton-D9l39Rs7.js.map +1 -0
  61. package/dist/esm/ui/dist/NiceErrorBoundary-niMx1aSJ.js +637 -0
  62. package/dist/esm/ui/dist/NiceErrorBoundary-niMx1aSJ.js.map +1 -0
  63. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5007 -0
  64. package/dist/esm/ui/dist/NiceModuleLifecyclePanel-I_TXRiiY.js.map +1 -0
  65. package/dist/esm/ui/dist/NicePinCodeInput-CrMfdxxc.js +13011 -0
  66. package/dist/esm/ui/dist/NicePinCodeInput-CrMfdxxc.js.map +1 -0
  67. package/dist/esm/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6037 -0
  68. package/dist/esm/ui/dist/NiceSavedQueryPanel-CUAsdOjJ.js.map +1 -0
  69. package/dist/esm/ui/dist/NiceToggle-CaY1u82g.js +276 -0
  70. package/dist/esm/ui/dist/NiceToggle-CaY1u82g.js.map +1 -0
  71. package/dist/esm/ui/dist/NiceWindow-SiCaREbq.js +795 -0
  72. package/dist/esm/ui/dist/NiceWindow-SiCaREbq.js.map +1 -0
  73. package/dist/esm/ui/dist/charts-Bx_kNBsE.js +3483 -0
  74. package/dist/esm/ui/dist/charts-Bx_kNBsE.js.map +1 -0
  75. package/dist/esm/ui/dist/core-BpghV7Ls.js +10071 -0
  76. package/dist/esm/ui/dist/core-BpghV7Ls.js.map +1 -0
  77. package/dist/esm/ui/dist/index-CIl98Vbm.js +39917 -0
  78. package/dist/esm/ui/dist/index-CIl98Vbm.js.map +1 -0
  79. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var we = require('react');
5
+ var ke = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -45,21 +45,21 @@ function computeAABB(object) {
45
45
  let bodyIdCounter = 0;
46
46
  let jointIdCounter = 0;
47
47
  function usePhysicsSimulation(scene, onSimulationStep) {
48
- const [worldConfig, setWorldConfigState] = we.useState({
48
+ const [worldConfig, setWorldConfigState] = ke.useState({
49
49
  gravity: new THREE__namespace.Vector3(0, -9.81, 0),
50
50
  timestep: 1 / 60,
51
51
  maxSubsteps: 4,
52
52
  });
53
- const [bodies, setBodies] = we.useState([]);
54
- const [joints, setJoints] = we.useState([]);
55
- const [isRunning, setIsRunning] = we.useState(false);
56
- const [debugDraw, setDebugDraw] = we.useState(false);
57
- const internalBodies = we.useRef(new Map());
58
- const debugGroup = we.useRef(new THREE__namespace.Group());
59
- const animFrameId = we.useRef(0);
60
- const lastTime = we.useRef(0);
53
+ const [bodies, setBodies] = ke.useState([]);
54
+ const [joints, setJoints] = ke.useState([]);
55
+ const [isRunning, setIsRunning] = ke.useState(false);
56
+ const [debugDraw, setDebugDraw] = ke.useState(false);
57
+ const internalBodies = ke.useRef(new Map());
58
+ const debugGroup = ke.useRef(new THREE__namespace.Group());
59
+ const animFrameId = ke.useRef(0);
60
+ const lastTime = ke.useRef(0);
61
61
  // Debug wireframe colliders
62
- we.useEffect(() => {
62
+ ke.useEffect(() => {
63
63
  if (!scene)
64
64
  return;
65
65
  debugGroup.current.name = '__physics_debug__';
@@ -70,10 +70,10 @@ function usePhysicsSimulation(scene, onSimulationStep) {
70
70
  scene.remove(debugGroup.current);
71
71
  };
72
72
  }, [scene, debugDraw]);
73
- const setWorldConfig = we.useCallback((partial) => {
73
+ const setWorldConfig = ke.useCallback((partial) => {
74
74
  setWorldConfigState((prev) => ({ ...prev, ...partial }));
75
75
  }, []);
76
- const addBody = we.useCallback((object) => {
76
+ const addBody = ke.useCallback((object) => {
77
77
  const id = `phys_${++bodyIdCounter}`;
78
78
  const desc = {
79
79
  id,
@@ -105,7 +105,7 @@ function usePhysicsSimulation(scene, onSimulationStep) {
105
105
  }
106
106
  return desc;
107
107
  }, [debugDraw]);
108
- const removeBody = we.useCallback((id) => {
108
+ const removeBody = ke.useCallback((id) => {
109
109
  internalBodies.current.delete(id);
110
110
  setBodies((prev) => prev.filter((b) => b.id !== id));
111
111
  // Remove debug wireframe
@@ -113,23 +113,23 @@ function usePhysicsSimulation(scene, onSimulationStep) {
113
113
  if (debugObj)
114
114
  debugGroup.current.remove(debugObj);
115
115
  }, []);
116
- const updateBody = we.useCallback((id, partial) => {
116
+ const updateBody = ke.useCallback((id, partial) => {
117
117
  const internal = internalBodies.current.get(id);
118
118
  if (internal) {
119
119
  Object.assign(internal.desc, partial);
120
120
  }
121
121
  setBodies((prev) => prev.map((b) => (b.id === id ? { ...b, ...partial } : b)));
122
122
  }, []);
123
- const addJoint = we.useCallback((joint) => {
123
+ const addJoint = ke.useCallback((joint) => {
124
124
  const id = `joint_${++jointIdCounter}`;
125
125
  setJoints((prev) => [...prev, { ...joint, id }]);
126
126
  }, []);
127
- const removeJoint = we.useCallback((id) => {
127
+ const removeJoint = ke.useCallback((id) => {
128
128
  setJoints((prev) => prev.filter((j) => j.id !== id));
129
129
  }, []);
130
- const getBodyForObject = we.useCallback((objectName) => bodies.find((b) => b.objectName === objectName), [bodies]);
130
+ const getBodyForObject = ke.useCallback((objectName) => bodies.find((b) => b.objectName === objectName), [bodies]);
131
131
  // Simplified physics step (Euler integration with collision detection)
132
- const simulationStep = we.useCallback((dt) => {
132
+ const simulationStep = ke.useCallback((dt) => {
133
133
  const gravity = worldConfig.gravity;
134
134
  internalBodies.current.forEach((body) => {
135
135
  if (body.desc.bodyType !== 'dynamic')
@@ -196,7 +196,7 @@ function usePhysicsSimulation(scene, onSimulationStep) {
196
196
  onSimulationStep === null || onSimulationStep === void 0 ? void 0 : onSimulationStep(dt);
197
197
  }, [worldConfig.gravity, onSimulationStep]);
198
198
  // Animation loop
199
- we.useEffect(() => {
199
+ ke.useEffect(() => {
200
200
  if (!isRunning)
201
201
  return;
202
202
  lastTime.current = performance.now();
@@ -213,12 +213,12 @@ function usePhysicsSimulation(scene, onSimulationStep) {
213
213
  animFrameId.current = requestAnimationFrame(loop);
214
214
  return () => cancelAnimationFrame(animFrameId.current);
215
215
  }, [isRunning, simulationStep, worldConfig.timestep, worldConfig.maxSubsteps]);
216
- const play = we.useCallback(() => setIsRunning(true), []);
217
- const pause = we.useCallback(() => setIsRunning(false), []);
218
- const step = we.useCallback(() => {
216
+ const play = ke.useCallback(() => setIsRunning(true), []);
217
+ const pause = ke.useCallback(() => setIsRunning(false), []);
218
+ const step = ke.useCallback(() => {
219
219
  simulationStep(worldConfig.timestep);
220
220
  }, [simulationStep, worldConfig.timestep]);
221
- const reset = we.useCallback(() => {
221
+ const reset = ke.useCallback(() => {
222
222
  setIsRunning(false);
223
223
  internalBodies.current.forEach((body) => {
224
224
  body.object.position.copy(body.initialPosition);
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var we = require('react');
5
+ var ke = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -213,13 +213,13 @@ const DEFAULT_PIPE = {
213
213
  };
214
214
  const DEFAULT_GEAR = { innerRadius: 0.5, outerRadius: 2, teeth: 12, toothDepth: 0.3, thickness: 0.4 };
215
215
  function useProceduralGeometry(scene, onGenerated) {
216
- const [type, setType] = we.useState('tree');
217
- const [treeParams, setTreeParams] = we.useState(DEFAULT_TREE);
218
- const [rockParams, setRockParams] = we.useState(DEFAULT_ROCK);
219
- const [buildingParams, setBuildingParams] = we.useState(DEFAULT_BUILDING);
220
- const [pipeParams, setPipeParams] = we.useState(DEFAULT_PIPE);
221
- const [gearParams, setGearParams] = we.useState(DEFAULT_GEAR);
222
- const generate = we.useCallback(() => {
216
+ const [type, setType] = ke.useState('tree');
217
+ const [treeParams, setTreeParams] = ke.useState(DEFAULT_TREE);
218
+ const [rockParams, setRockParams] = ke.useState(DEFAULT_ROCK);
219
+ const [buildingParams, setBuildingParams] = ke.useState(DEFAULT_BUILDING);
220
+ const [pipeParams, setPipeParams] = ke.useState(DEFAULT_PIPE);
221
+ const [gearParams, setGearParams] = ke.useState(DEFAULT_GEAR);
222
+ const generate = ke.useCallback(() => {
223
223
  if (!scene)
224
224
  return;
225
225
  let result;
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var we = require('react');
5
+ var ke = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -42,25 +42,25 @@ function fractalNoise(x, z, octaves, persistence, lacunarity, rng) {
42
42
  }
43
43
  /* ── Hook ── */
44
44
  function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 100, segments: 128, maxHeight: 20 }, onTerrainChange) {
45
- const [brush, setBrushState] = we.useState({
45
+ const [brush, setBrushState] = ke.useState({
46
46
  mode: 'raise',
47
47
  radius: 5,
48
48
  strength: 0.3,
49
49
  falloff: 'smooth',
50
50
  });
51
- const [isPainting, setIsPainting] = we.useState(false);
52
- const [textureLayers, setTextureLayers] = we.useState([
51
+ const [isPainting, setIsPainting] = ke.useState(false);
52
+ const [textureLayers, setTextureLayers] = ke.useState([
53
53
  { name: 'Grass', texture: null, scale: 10 },
54
54
  { name: 'Rock', texture: null, scale: 8 },
55
55
  { name: 'Sand', texture: null, scale: 12 },
56
56
  { name: 'Snow', texture: null, scale: 10 },
57
57
  ]);
58
- const [activeTextureLayer, setActiveTextureLayer] = we.useState(0);
59
- const terrainRef = we.useRef(null);
60
- const splatMapRef = we.useRef(null);
61
- const raycaster = we.useRef(new THREE__namespace.Raycaster());
58
+ const [activeTextureLayer, setActiveTextureLayer] = ke.useState(0);
59
+ const terrainRef = ke.useRef(null);
60
+ const splatMapRef = ke.useRef(null);
61
+ const raycaster = ke.useRef(new THREE__namespace.Raycaster());
62
62
  // Create terrain mesh
63
- we.useEffect(() => {
63
+ ke.useEffect(() => {
64
64
  if (!scene)
65
65
  return;
66
66
  const geometry = new THREE__namespace.PlaneGeometry(config.width, config.depth, config.segments, config.segments);
@@ -90,10 +90,10 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
90
90
  material.dispose();
91
91
  };
92
92
  }, [scene, config.width, config.depth, config.segments]);
93
- const setBrush = we.useCallback((partial) => {
93
+ const setBrush = ke.useCallback((partial) => {
94
94
  setBrushState((prev) => ({ ...prev, ...partial }));
95
95
  }, []);
96
- const applyBrushAtPoint = we.useCallback((point) => {
96
+ const applyBrushAtPoint = ke.useCallback((point) => {
97
97
  const mesh = terrainRef.current;
98
98
  if (!mesh)
99
99
  return;
@@ -185,7 +185,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
185
185
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
186
186
  }, [brush, config.segments, activeTextureLayer, onTerrainChange]);
187
187
  // Mouse handling
188
- we.useEffect(() => {
188
+ ke.useEffect(() => {
189
189
  if (!canvas || !camera || !isPainting)
190
190
  return;
191
191
  const onPointerMove = (e) => {
@@ -203,7 +203,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
203
203
  canvas.addEventListener('pointermove', onPointerMove);
204
204
  return () => canvas.removeEventListener('pointermove', onPointerMove);
205
205
  }, [canvas, camera, isPainting, applyBrushAtPoint]);
206
- const generateFlat = we.useCallback(() => {
206
+ const generateFlat = ke.useCallback(() => {
207
207
  const mesh = terrainRef.current;
208
208
  if (!mesh)
209
209
  return;
@@ -215,7 +215,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
215
215
  mesh.geometry.computeVertexNormals();
216
216
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
217
217
  }, [onTerrainChange]);
218
- const generateNoise = we.useCallback((octaves = 6, persistence = 0.5, lacunarity = 2.0) => {
218
+ const generateNoise = ke.useCallback((octaves = 6, persistence = 0.5, lacunarity = 2.0) => {
219
219
  const mesh = terrainRef.current;
220
220
  if (!mesh)
221
221
  return;
@@ -230,7 +230,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
230
230
  mesh.geometry.computeVertexNormals();
231
231
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
232
232
  }, [config, onTerrainChange]);
233
- const importHeightmap = we.useCallback((image) => {
233
+ const importHeightmap = ke.useCallback((image) => {
234
234
  const mesh = terrainRef.current;
235
235
  if (!mesh)
236
236
  return;
@@ -257,7 +257,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
257
257
  mesh.geometry.computeVertexNormals();
258
258
  onTerrainChange === null || onTerrainChange === void 0 ? void 0 : onTerrainChange(mesh);
259
259
  }, [config, onTerrainChange]);
260
- const exportHeightmap = we.useCallback(() => {
260
+ const exportHeightmap = ke.useCallback(() => {
261
261
  const mesh = terrainRef.current;
262
262
  if (!mesh)
263
263
  return null;
@@ -290,7 +290,7 @@ function useTerrainEditor(scene, camera, canvas, config = { width: 100, depth: 1
290
290
  ctx.putImageData(imageData, 0, 0);
291
291
  return exportCanvas;
292
292
  }, [config.segments]);
293
- const setTextureLayer = we.useCallback((index, partial) => {
293
+ const setTextureLayer = ke.useCallback((index, partial) => {
294
294
  setTextureLayers((prev) => prev.map((l, i) => (i === index ? { ...l, ...partial } : l)));
295
295
  }, []);
296
296
  return {
@@ -320,8 +320,8 @@ const NiceTerrainEditor = ({ scene, camera, canvas, config: configProp, onTerrai
320
320
  ...configProp,
321
321
  };
322
322
  const { brush, setBrush, isPainting, startPainting, stopPainting, generateFlat, generateNoise, exportHeightmap, textureLayers, setTextureLayer, activeTextureLayer, setActiveTextureLayer, } = useTerrainEditor(scene, camera, canvas, config, onTerrainChange);
323
- const [noiseOctaves, setNoiseOctaves] = we.useState(6);
324
- const [noisePersistence, setNoisePersistence] = we.useState(0.5);
323
+ const [noiseOctaves, setNoiseOctaves] = ke.useState(6);
324
+ const [noisePersistence, setNoisePersistence] = ke.useState(0.5);
325
325
  return (jsxRuntime.jsxs("div", { className: `nice-terrain-editor ${className}`, style: { display: 'grid', gap: 8, fontSize: 13 }, children: [jsxRuntime.jsx("strong", { children: "Terrain Editor" }), jsxRuntime.jsxs("fieldset", { style: { border: '1px solid var(--border, #e2e8f0)', borderRadius: 6, padding: 4, display: 'flex', flexWrap: 'wrap', gap: 2 }, children: [jsxRuntime.jsx("legend", { style: { fontSize: 11 }, children: "Brush" }), ['raise', 'lower', 'flatten', 'smooth', 'noise', 'paint'].map((m) => (jsxRuntime.jsx("button", { type: "button", onClick: () => setBrush({ mode: m }), style: {
326
326
  padding: '3px 6px', fontSize: 11, cursor: 'pointer', borderRadius: 4,
327
327
  border: '1px solid var(--border, #e2e8f0)',
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var we = require('react');
5
+ var ke = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -42,22 +42,22 @@ function getFalloff(distance, radius, type) {
42
42
  /* ── Hook ── */
43
43
  function useWeightPainter(skinnedMesh, scene, camera, canvas, onWeightsChange) {
44
44
  var _a, _b;
45
- const [brush, setBrushState] = we.useState({
45
+ const [brush, setBrushState] = ke.useState({
46
46
  radius: 0.5,
47
47
  strength: 0.5,
48
48
  falloff: 'smooth',
49
49
  mode: 'add',
50
50
  });
51
- const [isPainting, setIsPainting] = we.useState(false);
52
- const [activeBoneIndex, setActiveBoneIndex] = we.useState(0);
53
- const [showHeatMap, setShowHeatMap] = we.useState(true);
54
- const raycaster = we.useRef(new THREE__namespace.Raycaster());
55
- const heatMapMaterial = we.useRef(null);
56
- const originalMaterial = we.useRef(null);
51
+ const [isPainting, setIsPainting] = ke.useState(false);
52
+ const [activeBoneIndex, setActiveBoneIndex] = ke.useState(0);
53
+ const [showHeatMap, setShowHeatMap] = ke.useState(true);
54
+ const raycaster = ke.useRef(new THREE__namespace.Raycaster());
55
+ const heatMapMaterial = ke.useRef(null);
56
+ const originalMaterial = ke.useRef(null);
57
57
  // Get bone names from skeleton
58
58
  const boneNames = (_b = (_a = skinnedMesh === null || skinnedMesh === void 0 ? void 0 : skinnedMesh.skeleton) === null || _a === void 0 ? void 0 : _a.bones.map((b, i) => b.name || `Bone ${i}`)) !== null && _b !== void 0 ? _b : [];
59
59
  // Create heat map overlay material
60
- we.useEffect(() => {
60
+ ke.useEffect(() => {
61
61
  if (!skinnedMesh || !showHeatMap)
62
62
  return;
63
63
  originalMaterial.current = skinnedMesh.material;
@@ -91,10 +91,10 @@ function useWeightPainter(skinnedMesh, scene, camera, canvas, onWeightsChange) {
91
91
  mat.dispose();
92
92
  };
93
93
  }, [skinnedMesh, showHeatMap, activeBoneIndex]);
94
- const setBrush = we.useCallback((partial) => {
94
+ const setBrush = ke.useCallback((partial) => {
95
95
  setBrushState((prev) => ({ ...prev, ...partial }));
96
96
  }, []);
97
- const paintAtPoint = we.useCallback((point) => {
97
+ const paintAtPoint = ke.useCallback((point) => {
98
98
  if (!skinnedMesh)
99
99
  return;
100
100
  const geometry = skinnedMesh.geometry;
@@ -168,7 +168,7 @@ function useWeightPainter(skinnedMesh, scene, camera, canvas, onWeightsChange) {
168
168
  onWeightsChange === null || onWeightsChange === void 0 ? void 0 : onWeightsChange(skinnedMesh);
169
169
  }, [skinnedMesh, brush, activeBoneIndex, showHeatMap, onWeightsChange]);
170
170
  // Mouse event handlers
171
- we.useEffect(() => {
171
+ ke.useEffect(() => {
172
172
  if (!canvas || !camera || !isPainting || !skinnedMesh)
173
173
  return;
174
174
  const onMouseMove = (e) => {
@@ -183,7 +183,7 @@ function useWeightPainter(skinnedMesh, scene, camera, canvas, onWeightsChange) {
183
183
  canvas.addEventListener('mousemove', onMouseMove);
184
184
  return () => canvas.removeEventListener('mousemove', onMouseMove);
185
185
  }, [canvas, camera, isPainting, skinnedMesh, paintAtPoint]);
186
- const normalizeWeights = we.useCallback(() => {
186
+ const normalizeWeights = ke.useCallback(() => {
187
187
  if (!skinnedMesh)
188
188
  return;
189
189
  const skinWeightAttr = skinnedMesh.geometry.attributes.skinWeight;
@@ -238,7 +238,7 @@ function updateHeatMapColors(mesh, boneIndex, colors) {
238
238
  /* ── Component ── */
239
239
  const NiceWeightPainter = ({ skinnedMesh, activeBoneIndex: initialBoneIndex, scene, camera, canvas, onWeightsChange, className = '', }) => {
240
240
  const { brush, setBrush, isPainting, activeBoneIndex, setActiveBoneIndex, boneNames, startPainting, stopPainting, normalizeWeights, showHeatMap, setShowHeatMap, } = useWeightPainter(skinnedMesh, scene, camera, canvas, onWeightsChange);
241
- we.useEffect(() => {
241
+ ke.useEffect(() => {
242
242
  setActiveBoneIndex(initialBoneIndex);
243
243
  }, [initialBoneIndex, setActiveBoneIndex]);
244
244
  return (jsxRuntime.jsxs("div", { className: `nice-weight-painter ${className}`, style: { display: 'grid', gap: 8, fontSize: 13 }, children: [jsxRuntime.jsxs("label", { children: ["Bone:", jsxRuntime.jsx("select", { value: activeBoneIndex, onChange: (e) => setActiveBoneIndex(parseInt(e.target.value, 10)), style: { marginLeft: 8, width: '100%' }, children: boneNames.map((name, i) => (jsxRuntime.jsx("option", { value: i, children: name }, i))) })] }), jsxRuntime.jsxs("fieldset", { style: { display: 'flex', gap: 4, border: '1px solid var(--border, #e2e8f0)', borderRadius: 6, padding: 4 }, children: [jsxRuntime.jsx("legend", { style: { fontSize: 11 }, children: "Mode" }), ['add', 'subtract', 'smooth', 'blur'].map((mode) => (jsxRuntime.jsx("button", { type: "button", onClick: () => setBrush({ mode }), style: {
@@ -2,7 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var THREE = require('three');
5
- var we = require('react');
5
+ var ke = require('react');
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -25,19 +25,19 @@ var THREE__namespace = /*#__PURE__*/_interopNamespaceDefault(THREE);
25
25
 
26
26
  /* ── Hook ── */
27
27
  function useXRPreview(renderer, scene, camera, onSessionStart, onSessionEnd) {
28
- const [isSupported, setIsSupported] = we.useState(false);
29
- const [isSessionActive, setIsSessionActive] = we.useState(false);
30
- const [mode, setMode] = we.useState('vr');
31
- const [controllers, setControllers] = we.useState([]);
32
- const [teleportEnabled, setTeleportEnabled] = we.useState(true);
33
- const [hitTestResult, setHitTestResult] = we.useState(null);
34
- const controllerGripsRef = we.useRef([]);
35
- const controllerRaysRef = we.useRef([]);
36
- const teleportMarkerRef = we.useRef(null);
37
- const hitTestSourceRef = we.useRef(null);
38
- const cameraGroupRef = we.useRef(new THREE__namespace.Group());
28
+ const [isSupported, setIsSupported] = ke.useState(false);
29
+ const [isSessionActive, setIsSessionActive] = ke.useState(false);
30
+ const [mode, setMode] = ke.useState('vr');
31
+ const [controllers, setControllers] = ke.useState([]);
32
+ const [teleportEnabled, setTeleportEnabled] = ke.useState(true);
33
+ const [hitTestResult, setHitTestResult] = ke.useState(null);
34
+ const controllerGripsRef = ke.useRef([]);
35
+ const controllerRaysRef = ke.useRef([]);
36
+ const teleportMarkerRef = ke.useRef(null);
37
+ const hitTestSourceRef = ke.useRef(null);
38
+ const cameraGroupRef = ke.useRef(new THREE__namespace.Group());
39
39
  // Check WebXR support
40
- we.useEffect(() => {
40
+ ke.useEffect(() => {
41
41
  if ('xr' in navigator) {
42
42
  const xr = navigator.xr;
43
43
  xr.isSessionSupported('immersive-vr').then((vr) => {
@@ -52,7 +52,7 @@ function useXRPreview(renderer, scene, camera, onSessionStart, onSessionEnd) {
52
52
  }
53
53
  }, []);
54
54
  // Setup camera rig
55
- we.useEffect(() => {
55
+ ke.useEffect(() => {
56
56
  if (!scene || !camera)
57
57
  return;
58
58
  cameraGroupRef.current.name = '__xr_camera_rig__';
@@ -63,7 +63,7 @@ function useXRPreview(renderer, scene, camera, onSessionStart, onSessionEnd) {
63
63
  scene.remove(cameraGroupRef.current);
64
64
  };
65
65
  }, [scene, camera]);
66
- const setupControllers = we.useCallback(() => {
66
+ const setupControllers = ke.useCallback(() => {
67
67
  if (!renderer || !scene)
68
68
  return;
69
69
  for (let i = 0; i < 2; i++) {
@@ -134,7 +134,7 @@ function useXRPreview(renderer, scene, camera, onSessionStart, onSessionEnd) {
134
134
  { hand: 'right', position: new THREE__namespace.Vector3(), rotation: new THREE__namespace.Quaternion(), isSelecting: false, isSqueezing: false, gamepad: null },
135
135
  ]);
136
136
  }, [renderer, scene, teleportEnabled]);
137
- const startSession = we.useCallback(async () => {
137
+ const startSession = ke.useCallback(async () => {
138
138
  if (!renderer || !isSupported)
139
139
  return;
140
140
  const xr = navigator.xr;
@@ -222,7 +222,7 @@ function useXRPreview(renderer, scene, camera, onSessionStart, onSessionEnd) {
222
222
  console.warn('Failed to start XR session:', err);
223
223
  }
224
224
  }, [renderer, isSupported, mode, setupControllers, onSessionStart, onSessionEnd, scene, camera, teleportEnabled]);
225
- const endSession = we.useCallback(() => {
225
+ const endSession = ke.useCallback(() => {
226
226
  if (!renderer)
227
227
  return;
228
228
  const session = renderer.xr.getSession();
@@ -244,7 +244,7 @@ function useXRPreview(renderer, scene, camera, onSessionStart, onSessionEnd) {
244
244
  /* ── Component ── */
245
245
  const NiceXRPreview = ({ renderer, scene, camera, mode: initialMode, onSessionStart, onSessionEnd, className = '', }) => {
246
246
  const { isSupported, isSessionActive, mode, setMode, startSession, endSession, controllers, teleportEnabled, setTeleportEnabled, hitTestResult, } = useXRPreview(renderer, scene, camera, onSessionStart, onSessionEnd);
247
- we.useEffect(() => {
247
+ ke.useEffect(() => {
248
248
  if (initialMode)
249
249
  setMode(initialMode);
250
250
  }, [initialMode, setMode]);