@vizij/render 0.0.3 → 0.0.4

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.
package/dist/index.mjs CHANGED
@@ -1,11 +1,19 @@
1
- // src/controllers/controller.tsx
2
- import { memo } from "react";
3
- import { useShallow } from "zustand/react/shallow";
4
- import { clsx } from "clsx";
1
+ // src/vizij.tsx
5
2
  import {
6
- getLookup
7
- } from "@vizij/utils";
8
- import { ColorPickerPopover, SliderNumberField, Size } from "@semio/ui";
3
+ Suspense,
4
+ memo as memo6,
5
+ useContext as useContext3,
6
+ useEffect as useEffect6
7
+ } from "react";
8
+ import { ErrorBoundary } from "react-error-boundary";
9
+ import { Object3D as Object3D4 } from "three";
10
+ import { Canvas, useThree } from "@react-three/fiber";
11
+ import { Line as Line3, OrthographicCamera, Text } from "@react-three/drei";
12
+ import { useShallow as useShallow6 } from "zustand/react/shallow";
13
+
14
+ // src/renderables/renderable.tsx
15
+ import { memo as memo5, useMemo as useMemo5 } from "react";
16
+ import { useShallow as useShallow5 } from "zustand/react/shallow";
9
17
 
10
18
  // src/hooks/use-vizij-store.ts
11
19
  import { useContext } from "react";
@@ -22,218 +30,16 @@ function useVizijStore(selector) {
22
30
  return useStore(store, selector);
23
31
  }
24
32
 
25
- // src/controllers/controller.tsx
26
- import { jsx } from "react/jsx-runtime";
27
- function InnerController({
28
- animatableId,
29
- namespace,
30
- subfield,
31
- className
32
- }) {
33
- const setValue = useVizijStore(useShallow((state) => state.setValue));
34
- const animatable = useVizijStore(
35
- useShallow((state) => state.animatables[animatableId])
36
- );
37
- const lookupId = getLookup(namespace ?? "default", animatableId);
38
- const rawValue = useVizijStore(
39
- useShallow((state) => state.values.get(lookupId))
40
- );
41
- if (animatable.type === "number") {
42
- return /* @__PURE__ */ jsx("div", { className: clsx("flex flex-col w-full", className), children: /* @__PURE__ */ jsx(
43
- SliderNumberField,
44
- {
45
- size: Size.Sm,
46
- value: rawValue ?? animatable.default,
47
- onChange: (v) => {
48
- setValue(animatableId, namespace ?? "default", v);
49
- },
50
- min: animatable.constraints.min,
51
- max: animatable.constraints.max
52
- }
53
- ) });
54
- } else if (animatable.type === "vector3" && !subfield) {
55
- return /* @__PURE__ */ jsx("div", { className: clsx("flex flex-col gap-2", className), children: ["x", "y", "z"].map((axis) => {
56
- return /* @__PURE__ */ jsx(
57
- InnerController,
58
- {
59
- animatableId,
60
- namespace,
61
- subfield: axis
62
- },
63
- axis
64
- );
65
- }) });
66
- } else if (animatable.type === "vector2" && !subfield) {
67
- return /* @__PURE__ */ jsx("div", { className: clsx("flex flex-col gap-2", className), children: ["x", "y"].map((axis) => {
68
- return /* @__PURE__ */ jsx(
69
- InnerController,
70
- {
71
- animatableId,
72
- namespace,
73
- subfield: axis
74
- },
75
- axis
76
- );
77
- }) });
78
- } else if (animatable.type === "euler" && !subfield) {
79
- return /* @__PURE__ */ jsx("div", { className: clsx("flex flex-col gap-2", className), children: ["x", "y", "z"].map((axis) => {
80
- return /* @__PURE__ */ jsx(
81
- InnerController,
82
- {
83
- animatableId,
84
- namespace,
85
- subfield: axis
86
- },
87
- axis
88
- );
89
- }) });
90
- } else if (animatable.type === "rgb" && !subfield) {
91
- return /* @__PURE__ */ jsx("div", { className: clsx("flex flex-col gap-2", className), children: /* @__PURE__ */ jsx(
92
- ColorPickerPopover,
93
- {
94
- value: rawValue ? convertRGBRange(rawValue, "255") : convertRGBRange(animatable.default, "255"),
95
- onChange: (v) => {
96
- setValue(
97
- animatableId,
98
- namespace ?? "default",
99
- convertRGBRange(v, "1")
100
- );
101
- }
102
- }
103
- ) });
104
- } else if (animatable.type === "vector3" && subfield && ["x", "y", "z"].includes(subfield)) {
105
- const axis = subfield;
106
- const currentVec = rawValue ?? animatable.default;
107
- return /* @__PURE__ */ jsx(
108
- SliderNumberField,
109
- {
110
- label: axis,
111
- size: Size.Sm,
112
- value: currentVec[axis],
113
- onChange: (v) => {
114
- setValue(animatableId, namespace ?? "default", {
115
- ...currentVec,
116
- [axis]: v
117
- });
118
- },
119
- min: animatable.constraints.min?.[vectorIndexLookup[axis]] ?? void 0,
120
- max: animatable.constraints.max?.[vectorIndexLookup[axis]] ?? void 0
121
- }
122
- );
123
- } else if (animatable.type === "vector2" && subfield && ["x", "y"].includes(subfield)) {
124
- const axis = subfield;
125
- const currentVec = rawValue ?? animatable.default;
126
- return /* @__PURE__ */ jsx(
127
- SliderNumberField,
128
- {
129
- label: axis,
130
- size: Size.Sm,
131
- value: currentVec[axis],
132
- onChange: (v) => {
133
- setValue(animatableId, namespace ?? "default", {
134
- ...currentVec,
135
- [axis]: v
136
- });
137
- },
138
- min: animatable.constraints.min?.[vectorIndexLookup[axis]] ?? void 0,
139
- max: animatable.constraints.max?.[vectorIndexLookup[axis]] ?? void 0
140
- }
141
- );
142
- } else if (animatable.type === "euler" && subfield && ["x", "y", "z"].includes(subfield)) {
143
- const axis = subfield;
144
- const currentVec = rawValue ?? animatable.default;
145
- return /* @__PURE__ */ jsx(
146
- SliderNumberField,
147
- {
148
- label: axis,
149
- size: Size.Sm,
150
- value: currentVec[axis],
151
- onChange: (v) => {
152
- setValue(animatableId, namespace ?? "default", {
153
- ...currentVec,
154
- [axis]: v
155
- });
156
- },
157
- min: animatable.constraints.min?.[vectorIndexLookup[axis]] ?? void 0,
158
- max: animatable.constraints.max?.[vectorIndexLookup[axis]] ?? void 0
159
- }
160
- );
161
- } else if (animatable.type === "rgb" && subfield && ["r", "g", "b"].includes(subfield)) {
162
- const axis = subfield;
163
- const currentVec = rawValue ?? animatable.default;
164
- return /* @__PURE__ */ jsx(
165
- SliderNumberField,
166
- {
167
- label: axis,
168
- size: Size.Sm,
169
- value: currentVec[axis],
170
- strictText: true,
171
- strictSlider: true,
172
- onChange: (v) => {
173
- setValue(animatableId, namespace ?? "default", {
174
- ...currentVec,
175
- [axis]: v
176
- });
177
- },
178
- min: animatable.constraints.min?.[vectorIndexLookup[axis]] ?? void 0,
179
- max: animatable.constraints.max?.[vectorIndexLookup[axis]] ?? void 0
180
- }
181
- );
182
- }
183
- }
184
- var Controller = memo(InnerController);
185
- var vectorIndexLookup = {
186
- x: 0,
187
- y: 1,
188
- z: 2,
189
- r: 0,
190
- g: 1,
191
- b: 2
192
- };
193
- var convertRGBRange = (color, to) => {
194
- if (to === "255") {
195
- return {
196
- r: color.r * 255,
197
- g: color.g * 255,
198
- b: color.b * 255
199
- };
200
- } else if (to === "1") {
201
- return {
202
- r: color.r / 255,
203
- g: color.g / 255,
204
- b: color.b / 255
205
- };
206
- }
207
- return color;
208
- };
209
-
210
- // src/vizij.tsx
211
- import {
212
- Suspense,
213
- memo as memo7,
214
- useContext as useContext3,
215
- useEffect as useEffect6
216
- } from "react";
217
- import { ErrorBoundary } from "react-error-boundary";
218
- import { Object3D as Object3D4 } from "three";
219
- import { Canvas, useThree } from "@react-three/fiber";
220
- import { Line as Line3, OrthographicCamera, Text } from "@react-three/drei";
221
- import { useShallow as useShallow7 } from "zustand/react/shallow";
222
-
223
- // src/renderables/renderable.tsx
224
- import { memo as memo6, useMemo as useMemo5 } from "react";
225
- import { useShallow as useShallow6 } from "zustand/react/shallow";
226
-
227
33
  // src/renderables/group.tsx
228
34
  import {
229
- memo as memo2,
35
+ memo,
230
36
  useCallback,
231
37
  useEffect as useEffect2,
232
38
  useRef,
233
39
  useMemo
234
40
  } from "react";
235
41
  import * as THREE from "three";
236
- import { useShallow as useShallow2 } from "zustand/react/shallow";
42
+ import { useShallow } from "zustand/react/shallow";
237
43
  import {
238
44
  instanceOfRawEuler,
239
45
  instanceOfRawNumber,
@@ -244,7 +50,7 @@ import {
244
50
  // src/hooks/use-features.ts
245
51
  import { useEffect, useContext as useContext2 } from "react";
246
52
  import { shallow } from "zustand/shallow";
247
- import { getLookup as getLookup2 } from "@vizij/utils";
53
+ import { getLookup } from "@vizij/utils";
248
54
  function useFeatures(namespace, features, callbacks, debugInfo) {
249
55
  const store = useContext2(VizijContext);
250
56
  if (!store) throw new Error("Missing VizijProvider in the tree");
@@ -274,7 +80,7 @@ function useFeatures(namespace, features, callbacks, debugInfo) {
274
80
  }
275
81
  };
276
82
  const defaultValue = animatableValueInfo.default;
277
- const lookupKey = getLookup2(namespace, animatableValueInfo.id);
83
+ const lookupKey = getLookup(namespace, animatableValueInfo.id);
278
84
  const unsubscribe = store.subscribe(
279
85
  (state) => state.values.get(lookupKey) ?? defaultValue,
280
86
  cb,
@@ -321,7 +127,7 @@ function createStoredRenderable(data, animatableValues) {
321
127
  }
322
128
 
323
129
  // src/renderables/group.tsx
324
- import { jsx as jsx2 } from "react/jsx-runtime";
130
+ import { jsx } from "react/jsx-runtime";
325
131
  THREE.Object3D.DEFAULT_UP.set(0, 0, 1);
326
132
  function InnerRenderedGroup({
327
133
  id,
@@ -329,11 +135,11 @@ function InnerRenderedGroup({
329
135
  chain
330
136
  }) {
331
137
  const ref = useRef();
332
- const group = useVizijStore(useShallow2((state) => state.world[id]));
138
+ const group = useVizijStore(useShallow((state) => state.world[id]));
333
139
  const refIsNull = !group.refs[namespace]?.current;
334
- const animatables = useVizijStore(useShallow2((state) => state.animatables));
140
+ const animatables = useVizijStore(useShallow((state) => state.animatables));
335
141
  const setHoveredElement = useVizijStore(
336
- useShallow2((state) => state.setHoveredElement)
142
+ useShallow((state) => state.setHoveredElement)
337
143
  );
338
144
  const animatableValues = useMemo(() => {
339
145
  const av = {};
@@ -386,7 +192,7 @@ function InnerRenderedGroup({
386
192
  }
387
193
  });
388
194
  const setReference = useVizijStore(
389
- useShallow2((state) => state.setReference)
195
+ useShallow((state) => state.setReference)
390
196
  );
391
197
  useEffect2(() => {
392
198
  if (ref.current && refIsNull) {
@@ -416,7 +222,7 @@ function InnerRenderedGroup({
416
222
  },
417
223
  [setHoveredElement]
418
224
  );
419
- return /* @__PURE__ */ jsx2(
225
+ return /* @__PURE__ */ jsx(
420
226
  "group",
421
227
  {
422
228
  ref,
@@ -424,7 +230,7 @@ function InnerRenderedGroup({
424
230
  userData,
425
231
  onPointerOver: handlePointerOver,
426
232
  onPointerOut: handlePointerOut,
427
- children: group.children.map((child) => /* @__PURE__ */ jsx2(
233
+ children: group.children.map((child) => /* @__PURE__ */ jsx(
428
234
  Renderable,
429
235
  {
430
236
  id: child,
@@ -436,17 +242,17 @@ function InnerRenderedGroup({
436
242
  }
437
243
  );
438
244
  }
439
- var RenderedGroup = memo2(InnerRenderedGroup);
245
+ var RenderedGroup = memo(InnerRenderedGroup);
440
246
 
441
247
  // src/renderables/ellipse.tsx
442
248
  import {
443
- memo as memo3,
249
+ memo as memo2,
444
250
  useCallback as useCallback2,
445
251
  useEffect as useEffect3,
446
252
  useRef as useRef2,
447
253
  useMemo as useMemo2
448
254
  } from "react";
449
- import { useShallow as useShallow3 } from "zustand/react/shallow";
255
+ import { useShallow as useShallow2 } from "zustand/react/shallow";
450
256
  import {
451
257
  instanceOfRawNumber as instanceOfRawNumber2,
452
258
  instanceOfRawVector2 as instanceOfRawVector22,
@@ -456,7 +262,7 @@ import {
456
262
  instanceOfRawHSL
457
263
  } from "@vizij/utils";
458
264
  import { Circle, Line } from "@react-three/drei";
459
- import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
265
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
460
266
  function InnerRenderedEllipse({
461
267
  id,
462
268
  namespace,
@@ -468,16 +274,16 @@ function InnerRenderedEllipse({
468
274
  const strokeOffsetRef = useRef2(0);
469
275
  const strokeWidthRef = useRef2(0);
470
276
  const onElementClick = useVizijStore(
471
- useShallow3((state) => state.onElementClick)
277
+ useShallow2((state) => state.onElementClick)
472
278
  );
473
279
  const setHoveredElement = useVizijStore(
474
- useShallow3((state) => state.setHoveredElement)
280
+ useShallow2((state) => state.setHoveredElement)
475
281
  );
476
282
  const ellipse = useVizijStore(
477
- useShallow3((state) => state.world[id])
283
+ useShallow2((state) => state.world[id])
478
284
  );
479
285
  const refIsNull = !ellipse.refs[namespace]?.current;
480
- const animatables = useVizijStore(useShallow3((state) => state.animatables));
286
+ const animatables = useVizijStore(useShallow2((state) => state.animatables));
481
287
  const animatableValues = useMemo2(() => {
482
288
  const av = {};
483
289
  Object.values(ellipse.features).forEach((feat) => {
@@ -664,7 +470,7 @@ function InnerRenderedEllipse({
664
470
  }
665
471
  });
666
472
  const setReference = useVizijStore(
667
- useShallow3((state) => state.setReference)
473
+ useShallow2((state) => state.setReference)
668
474
  );
669
475
  const points = useMemo2(() => {
670
476
  const n = 600;
@@ -697,7 +503,7 @@ function InnerRenderedEllipse({
697
503
  [setHoveredElement]
698
504
  );
699
505
  return /* @__PURE__ */ jsxs(Fragment, { children: [
700
- /* @__PURE__ */ jsx3(
506
+ /* @__PURE__ */ jsx2(
701
507
  Circle,
702
508
  {
703
509
  ref: ellipseRef,
@@ -708,10 +514,10 @@ function InnerRenderedEllipse({
708
514
  onClick: (e) => {
709
515
  onElementClick({ id, type: "ellipse", namespace }, [...chain, id], e);
710
516
  },
711
- children: /* @__PURE__ */ jsx3("meshStandardMaterial", { attach: "material", ref: materialRef })
517
+ children: /* @__PURE__ */ jsx2("meshStandardMaterial", { attach: "material", ref: materialRef })
712
518
  }
713
519
  ),
714
- showLine(ellipse) && /* @__PURE__ */ jsx3(
520
+ showLine(ellipse) && /* @__PURE__ */ jsx2(
715
521
  Line,
716
522
  {
717
523
  ref: lineRef,
@@ -722,7 +528,7 @@ function InnerRenderedEllipse({
722
528
  )
723
529
  ] });
724
530
  }
725
- var RenderedEllipse = memo3(InnerRenderedEllipse);
531
+ var RenderedEllipse = memo2(InnerRenderedEllipse);
726
532
  var showLine = (ellipse) => {
727
533
  if ("strokeOpacity" in ellipse.features) {
728
534
  return true;
@@ -738,13 +544,13 @@ var showLine = (ellipse) => {
738
544
 
739
545
  // src/renderables/rectangle.tsx
740
546
  import {
741
- memo as memo4,
547
+ memo as memo3,
742
548
  useCallback as useCallback3,
743
549
  useEffect as useEffect4,
744
550
  useRef as useRef3,
745
551
  useMemo as useMemo3
746
552
  } from "react";
747
- import { useShallow as useShallow4 } from "zustand/react/shallow";
553
+ import { useShallow as useShallow3 } from "zustand/react/shallow";
748
554
  import {
749
555
  instanceOfRawNumber as instanceOfRawNumber3,
750
556
  instanceOfRawVector2 as instanceOfRawVector23,
@@ -754,7 +560,7 @@ import {
754
560
  instanceOfRawHSL as instanceOfRawHSL2
755
561
  } from "@vizij/utils";
756
562
  import { Plane, Line as Line2 } from "@react-three/drei";
757
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
563
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
758
564
  function InnerRenderedRectangle({
759
565
  id,
760
566
  namespace,
@@ -766,16 +572,16 @@ function InnerRenderedRectangle({
766
572
  const strokeOffsetRef = useRef3(0);
767
573
  const strokeWidthRef = useRef3(0);
768
574
  const onElementClick = useVizijStore(
769
- useShallow4((state) => state.onElementClick)
575
+ useShallow3((state) => state.onElementClick)
770
576
  );
771
577
  const setHoveredElement = useVizijStore(
772
- useShallow4((state) => state.setHoveredElement)
578
+ useShallow3((state) => state.setHoveredElement)
773
579
  );
774
580
  const rectangle = useVizijStore(
775
- useShallow4((state) => state.world[id])
581
+ useShallow3((state) => state.world[id])
776
582
  );
777
583
  const refIsNull = !rectangle.refs[namespace]?.current;
778
- const animatables = useVizijStore(useShallow4((state) => state.animatables));
584
+ const animatables = useVizijStore(useShallow3((state) => state.animatables));
779
585
  const animatableValues = useMemo3(() => {
780
586
  const av = {};
781
587
  Object.values(rectangle.features).forEach((feat) => {
@@ -962,7 +768,7 @@ function InnerRenderedRectangle({
962
768
  }
963
769
  });
964
770
  const setReference = useVizijStore(
965
- useShallow4((state) => state.setReference)
771
+ useShallow3((state) => state.setReference)
966
772
  );
967
773
  const points = useMemo3(() => {
968
774
  return [
@@ -992,7 +798,7 @@ function InnerRenderedRectangle({
992
798
  [setHoveredElement]
993
799
  );
994
800
  return /* @__PURE__ */ jsxs2(Fragment2, { children: [
995
- /* @__PURE__ */ jsx4(
801
+ /* @__PURE__ */ jsx3(
996
802
  Plane,
997
803
  {
998
804
  ref: rectangleRef,
@@ -1007,10 +813,10 @@ function InnerRenderedRectangle({
1007
813
  e
1008
814
  );
1009
815
  },
1010
- children: /* @__PURE__ */ jsx4("meshStandardMaterial", { attach: "material", ref: materialRef })
816
+ children: /* @__PURE__ */ jsx3("meshStandardMaterial", { attach: "material", ref: materialRef })
1011
817
  }
1012
818
  ),
1013
- showLine2(rectangle) && /* @__PURE__ */ jsx4(
819
+ showLine2(rectangle) && /* @__PURE__ */ jsx3(
1014
820
  Line2,
1015
821
  {
1016
822
  ref: lineRef,
@@ -1021,7 +827,7 @@ function InnerRenderedRectangle({
1021
827
  )
1022
828
  ] });
1023
829
  }
1024
- var RenderedRectangle = memo4(InnerRenderedRectangle);
830
+ var RenderedRectangle = memo3(InnerRenderedRectangle);
1025
831
  var showLine2 = (rectangle) => {
1026
832
  if ("strokeOpacity" in rectangle.features) {
1027
833
  return true;
@@ -1037,14 +843,14 @@ var showLine2 = (rectangle) => {
1037
843
 
1038
844
  // src/renderables/shape.tsx
1039
845
  import {
1040
- memo as memo5,
846
+ memo as memo4,
1041
847
  useCallback as useCallback4,
1042
848
  useRef as useRef4,
1043
849
  useMemo as useMemo4,
1044
850
  useEffect as useEffect5
1045
851
  } from "react";
1046
852
  import * as THREE2 from "three";
1047
- import { useShallow as useShallow5 } from "zustand/react/shallow";
853
+ import { useShallow as useShallow4 } from "zustand/react/shallow";
1048
854
  import {
1049
855
  instanceOfRawEuler as instanceOfRawEuler4,
1050
856
  instanceOfRawHSL as instanceOfRawHSL3,
@@ -1052,7 +858,7 @@ import {
1052
858
  instanceOfRawRGB as instanceOfRawRGB3,
1053
859
  instanceOfRawVector3 as instanceOfRawVector34
1054
860
  } from "@vizij/utils";
1055
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
861
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1056
862
  THREE2.Object3D.DEFAULT_UP.set(0, 0, 1);
1057
863
  function InnerRenderedShape({
1058
864
  id,
@@ -1061,12 +867,12 @@ function InnerRenderedShape({
1061
867
  }) {
1062
868
  const refGroup = useRef4();
1063
869
  const ref = useRef4();
1064
- const shape = useVizijStore(useShallow5((state) => state.world[id]));
870
+ const shape = useVizijStore(useShallow4((state) => state.world[id]));
1065
871
  const refs = useVizijStore(
1066
- useShallow5((state) => state.world[id].refs)
872
+ useShallow4((state) => state.world[id].refs)
1067
873
  );
1068
874
  const refIsNull = !refs[namespace]?.current;
1069
- const animatables = useVizijStore(useShallow5((state) => state.animatables));
875
+ const animatables = useVizijStore(useShallow4((state) => state.animatables));
1070
876
  const animatableValues = useMemo4(() => {
1071
877
  const av = {};
1072
878
  Object.values(shape.features).forEach((feat) => {
@@ -1197,12 +1003,12 @@ function InnerRenderedShape({
1197
1003
  },
1198
1004
  shape
1199
1005
  );
1200
- const setReference = useVizijStore(useShallow5((state) => state.setReference));
1006
+ const setReference = useVizijStore(useShallow4((state) => state.setReference));
1201
1007
  const onElementClick = useVizijStore(
1202
- useShallow5((state) => state.onElementClick)
1008
+ useShallow4((state) => state.onElementClick)
1203
1009
  );
1204
1010
  const setHoveredElement = useVizijStore(
1205
- useShallow5((state) => state.setHoveredElement)
1011
+ useShallow4((state) => state.setHoveredElement)
1206
1012
  );
1207
1013
  useEffect5(() => {
1208
1014
  if (ref.current && refIsNull) setReference(shape.id, namespace, ref);
@@ -1254,7 +1060,7 @@ function InnerRenderedShape({
1254
1060
  onElementClick({ id, type: "shape", namespace }, [...chain, id], e);
1255
1061
  },
1256
1062
  children: [
1257
- shape.material === "basic" && /* @__PURE__ */ jsx5(
1063
+ shape.material === "basic" && /* @__PURE__ */ jsx4(
1258
1064
  "meshBasicMaterial",
1259
1065
  {
1260
1066
  attach: "material",
@@ -1262,7 +1068,7 @@ function InnerRenderedShape({
1262
1068
  side: THREE2.DoubleSide
1263
1069
  }
1264
1070
  ),
1265
- shape.material === "lambert" && /* @__PURE__ */ jsx5(
1071
+ shape.material === "lambert" && /* @__PURE__ */ jsx4(
1266
1072
  "meshLambertMaterial",
1267
1073
  {
1268
1074
  attach: "material",
@@ -1270,7 +1076,7 @@ function InnerRenderedShape({
1270
1076
  side: THREE2.DoubleSide
1271
1077
  }
1272
1078
  ),
1273
- shape.material === "phong" && /* @__PURE__ */ jsx5(
1079
+ shape.material === "phong" && /* @__PURE__ */ jsx4(
1274
1080
  "meshPhongMaterial",
1275
1081
  {
1276
1082
  attach: "material",
@@ -1278,7 +1084,7 @@ function InnerRenderedShape({
1278
1084
  side: THREE2.DoubleSide
1279
1085
  }
1280
1086
  ),
1281
- shape.material === "standard" && /* @__PURE__ */ jsx5(
1087
+ shape.material === "standard" && /* @__PURE__ */ jsx4(
1282
1088
  "meshStandardMaterial",
1283
1089
  {
1284
1090
  attach: "material",
@@ -1286,7 +1092,7 @@ function InnerRenderedShape({
1286
1092
  side: THREE2.DoubleSide
1287
1093
  }
1288
1094
  ),
1289
- shape.material === "normal" && /* @__PURE__ */ jsx5(
1095
+ shape.material === "normal" && /* @__PURE__ */ jsx4(
1290
1096
  "meshNormalMaterial",
1291
1097
  {
1292
1098
  attach: "material",
@@ -1294,7 +1100,7 @@ function InnerRenderedShape({
1294
1100
  side: THREE2.DoubleSide
1295
1101
  }
1296
1102
  ),
1297
- shape.children?.map((child) => /* @__PURE__ */ jsx5(
1103
+ shape.children?.map((child) => /* @__PURE__ */ jsx4(
1298
1104
  Renderable,
1299
1105
  {
1300
1106
  id: child,
@@ -1307,7 +1113,7 @@ function InnerRenderedShape({
1307
1113
  }
1308
1114
  );
1309
1115
  }
1310
- var RenderedShape = memo5(InnerRenderedShape);
1116
+ var RenderedShape = memo4(InnerRenderedShape);
1311
1117
  var MATERIAL_FEATURE_KEYS = [
1312
1118
  "color",
1313
1119
  "opacity",
@@ -1355,14 +1161,14 @@ function extractMaterialName(name) {
1355
1161
  }
1356
1162
 
1357
1163
  // src/renderables/renderable.tsx
1358
- import { Fragment as Fragment3, jsx as jsx6 } from "react/jsx-runtime";
1164
+ import { Fragment as Fragment3, jsx as jsx5 } from "react/jsx-runtime";
1359
1165
  function InnerRenderable({
1360
1166
  id,
1361
1167
  namespace,
1362
1168
  chain
1363
1169
  }) {
1364
- const type = useVizijStore(useShallow6((state) => state.world[id].type));
1365
- const refs = useVizijStore(useShallow6((state) => state.world[id].refs));
1170
+ const type = useVizijStore(useShallow5((state) => state.world[id].type));
1171
+ const refs = useVizijStore(useShallow5((state) => state.world[id].refs));
1366
1172
  const resolvedNamespaces = useMemo5(() => {
1367
1173
  let namespaces = [namespace];
1368
1174
  if (namespace in refs) {
@@ -1375,10 +1181,10 @@ function InnerRenderable({
1375
1181
  if (resolvedNamespaces.length === 0) {
1376
1182
  return null;
1377
1183
  }
1378
- return /* @__PURE__ */ jsx6(Fragment3, { children: resolvedNamespaces.map((ns) => {
1184
+ return /* @__PURE__ */ jsx5(Fragment3, { children: resolvedNamespaces.map((ns) => {
1379
1185
  switch (type) {
1380
1186
  case "group":
1381
- return /* @__PURE__ */ jsx6(
1187
+ return /* @__PURE__ */ jsx5(
1382
1188
  RenderedGroup,
1383
1189
  {
1384
1190
  id,
@@ -1388,7 +1194,7 @@ function InnerRenderable({
1388
1194
  `${ns}.${id}`
1389
1195
  );
1390
1196
  case "ellipse":
1391
- return /* @__PURE__ */ jsx6(
1197
+ return /* @__PURE__ */ jsx5(
1392
1198
  RenderedEllipse,
1393
1199
  {
1394
1200
  id,
@@ -1398,7 +1204,7 @@ function InnerRenderable({
1398
1204
  `${ns}.${id}`
1399
1205
  );
1400
1206
  case "rectangle":
1401
- return /* @__PURE__ */ jsx6(
1207
+ return /* @__PURE__ */ jsx5(
1402
1208
  RenderedRectangle,
1403
1209
  {
1404
1210
  id,
@@ -1408,7 +1214,7 @@ function InnerRenderable({
1408
1214
  `${ns}.${id}`
1409
1215
  );
1410
1216
  case "shape":
1411
- return /* @__PURE__ */ jsx6(
1217
+ return /* @__PURE__ */ jsx5(
1412
1218
  RenderedShape,
1413
1219
  {
1414
1220
  id,
@@ -1422,14 +1228,14 @@ function InnerRenderable({
1422
1228
  }
1423
1229
  }) });
1424
1230
  }
1425
- var Renderable = memo6(InnerRenderable);
1231
+ var Renderable = memo5(InnerRenderable);
1426
1232
 
1427
1233
  // src/store.ts
1428
1234
  import { create } from "zustand";
1429
1235
  import { subscribeWithSelector } from "zustand/middleware";
1430
1236
  import { produce, enableMapSet } from "immer";
1431
1237
  import * as THREE3 from "three";
1432
- import { getLookup as getLookup3 } from "@vizij/utils";
1238
+ import { getLookup as getLookup2 } from "@vizij/utils";
1433
1239
 
1434
1240
  // src/actions/create-new-element.ts
1435
1241
  import { createRef } from "react";
@@ -1725,7 +1531,7 @@ var VizijSlice = (set, get) => ({
1725
1531
  setValue: (id, namespace, value) => {
1726
1532
  set(
1727
1533
  produce((state) => {
1728
- const lookupId = getLookup3(namespace, id);
1534
+ const lookupId = getLookup2(namespace, id);
1729
1535
  if (typeof value === "function") {
1730
1536
  const current = state.values.get(lookupId);
1731
1537
  if (current !== void 0) {
@@ -1872,8 +1678,8 @@ var VizijSlice = (set, get) => ({
1872
1678
  setSlot: (parentId, parentNamespace, childId, childNamespace) => {
1873
1679
  set(
1874
1680
  produce((state) => {
1875
- const parentLookupId = getLookup3(parentNamespace, parentId);
1876
- const childLookupId = getLookup3(childNamespace, childId);
1681
+ const parentLookupId = getLookup2(parentNamespace, parentId);
1682
+ const childLookupId = getLookup2(childNamespace, childId);
1877
1683
  state.slotConfig[parentLookupId] = childLookupId;
1878
1684
  })
1879
1685
  );
@@ -1892,7 +1698,7 @@ var VizijSlice = (set, get) => ({
1892
1698
  clearSlot: (parentId, parentNamespace) => {
1893
1699
  set(
1894
1700
  produce((state) => {
1895
- const parentLookupId = getLookup3(parentNamespace, parentId);
1701
+ const parentLookupId = getLookup2(parentNamespace, parentId);
1896
1702
  delete state.slotConfig[parentLookupId];
1897
1703
  })
1898
1704
  );
@@ -1942,7 +1748,7 @@ var createVizijStore = (initial) => create()(
1942
1748
  );
1943
1749
 
1944
1750
  // src/vizij.tsx
1945
- import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
1751
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1946
1752
  Object3D4.DEFAULT_UP.set(0, 0, 1);
1947
1753
  function Vizij({
1948
1754
  style,
@@ -1954,14 +1760,14 @@ function Vizij({
1954
1760
  }) {
1955
1761
  const ctx = useContext3(VizijContext);
1956
1762
  if (ctx) {
1957
- return /* @__PURE__ */ jsx7(
1763
+ return /* @__PURE__ */ jsx6(
1958
1764
  Canvas,
1959
1765
  {
1960
1766
  shadows: false,
1961
1767
  style,
1962
1768
  className,
1963
1769
  onPointerMissed,
1964
- children: /* @__PURE__ */ jsx7(
1770
+ children: /* @__PURE__ */ jsx6(
1965
1771
  MemoizedInnerVizij,
1966
1772
  {
1967
1773
  rootId,
@@ -1972,13 +1778,13 @@ function Vizij({
1972
1778
  }
1973
1779
  );
1974
1780
  } else {
1975
- return /* @__PURE__ */ jsx7(VizijContext.Provider, { value: useDefaultVizijStore, children: /* @__PURE__ */ jsx7(
1781
+ return /* @__PURE__ */ jsx6(VizijContext.Provider, { value: useDefaultVizijStore, children: /* @__PURE__ */ jsx6(
1976
1782
  Canvas,
1977
1783
  {
1978
1784
  style,
1979
1785
  className,
1980
1786
  onPointerMissed,
1981
- children: /* @__PURE__ */ jsx7(
1787
+ children: /* @__PURE__ */ jsx6(
1982
1788
  MemoizedInnerVizij,
1983
1789
  {
1984
1790
  rootId,
@@ -2001,8 +1807,8 @@ function InnerVizij({
2001
1807
  height: container.height * container.resolution
2002
1808
  } : void 0;
2003
1809
  return /* @__PURE__ */ jsxs4(Fragment4, { children: [
2004
- /* @__PURE__ */ jsx7("ambientLight", { intensity: Math.PI / 2 }),
2005
- /* @__PURE__ */ jsx7(
1810
+ /* @__PURE__ */ jsx6("ambientLight", { intensity: Math.PI / 2 }),
1811
+ /* @__PURE__ */ jsx6(
2006
1812
  OrthographicCamera,
2007
1813
  {
2008
1814
  makeDefault: true,
@@ -2011,7 +1817,7 @@ function InnerVizij({
2011
1817
  far: 101
2012
1818
  }
2013
1819
  ),
2014
- /* @__PURE__ */ jsx7(Suspense, { fallback: null, children: /* @__PURE__ */ jsx7(
1820
+ /* @__PURE__ */ jsx6(Suspense, { fallback: null, children: /* @__PURE__ */ jsx6(
2015
1821
  World,
2016
1822
  {
2017
1823
  rootId,
@@ -2019,17 +1825,17 @@ function InnerVizij({
2019
1825
  parentSizing: sceneParentSizing
2020
1826
  }
2021
1827
  ) }),
2022
- showSafeArea && /* @__PURE__ */ jsx7(SafeAreaRenderer, { rootId })
1828
+ showSafeArea && /* @__PURE__ */ jsx6(SafeAreaRenderer, { rootId })
2023
1829
  ] });
2024
1830
  }
2025
- var MemoizedInnerVizij = memo7(InnerVizij);
1831
+ var MemoizedInnerVizij = memo6(InnerVizij);
2026
1832
  function InnerWorld({
2027
1833
  rootId,
2028
1834
  namespace = "default",
2029
1835
  parentSizing
2030
1836
  }) {
2031
1837
  const [present, rootBounds] = useVizijStore(
2032
- useShallow7((state) => {
1838
+ useShallow6((state) => {
2033
1839
  const group = state.world[rootId];
2034
1840
  const bounds = group?.rootBounds ?? defaultRootBounds;
2035
1841
  return [group !== void 0, bounds];
@@ -2068,8 +1874,8 @@ function InnerWorld({
2068
1874
  }
2069
1875
  }, [rootBounds, camera, parentSizing, size]);
2070
1876
  return /* @__PURE__ */ jsxs4(ErrorBoundary, { fallback: null, children: [
2071
- present && /* @__PURE__ */ jsx7(Renderable, { id: rootId, namespace, chain: [] }),
2072
- !present && /* @__PURE__ */ jsx7(
1877
+ present && /* @__PURE__ */ jsx6(Renderable, { id: rootId, namespace, chain: [] }),
1878
+ !present && /* @__PURE__ */ jsx6(
2073
1879
  Text,
2074
1880
  {
2075
1881
  position: [0, 0, 0],
@@ -2082,7 +1888,7 @@ function InnerWorld({
2082
1888
  )
2083
1889
  ] });
2084
1890
  }
2085
- var World = memo7(InnerWorld);
1891
+ var World = memo6(InnerWorld);
2086
1892
  function SafeAreaRenderer({ rootId }) {
2087
1893
  const rootBounds = useVizijStore((state) => {
2088
1894
  const group = state.world[rootId];
@@ -2092,7 +1898,7 @@ function SafeAreaRenderer({ rootId }) {
2092
1898
  const right = rootBounds.center.x + rootBounds.size.x / 2;
2093
1899
  const top = rootBounds.center.y + rootBounds.size.y / 2;
2094
1900
  const bottom = rootBounds.center.y - rootBounds.size.y / 2;
2095
- return /* @__PURE__ */ jsx7(
1901
+ return /* @__PURE__ */ jsx6(
2096
1902
  Line3,
2097
1903
  {
2098
1904
  points: [
@@ -3098,7 +2904,6 @@ function exportScene(data, fileNameOrOptions = "scene.glb") {
3098
2904
  }
3099
2905
  }
3100
2906
  export {
3101
- Controller,
3102
2907
  EmptyModelError,
3103
2908
  InnerVizij,
3104
2909
  ShapeMaterial,