@vizij/render 0.0.6 → 0.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.
- package/LICENSE +201 -0
- package/dist/index.d.mts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +192 -67
- package/dist/index.mjs +174 -76
- package/package.json +24 -25
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
// src/vizij.tsx
|
|
2
|
-
import {
|
|
3
|
-
Suspense,
|
|
4
|
-
memo as memo6,
|
|
5
|
-
useContext as useContext3,
|
|
6
|
-
useEffect as useEffect6
|
|
7
|
-
} from "react";
|
|
2
|
+
import { Suspense, memo as memo6, useContext as useContext3, useEffect as useEffect7 } from "react";
|
|
8
3
|
import { ErrorBoundary } from "react-error-boundary";
|
|
9
|
-
import {
|
|
10
|
-
Object3D as Object3D4,
|
|
11
|
-
SRGBColorSpace,
|
|
12
|
-
NoToneMapping
|
|
13
|
-
} from "three";
|
|
4
|
+
import { Object3D as Object3D4, SRGBColorSpace, NoToneMapping } from "three";
|
|
14
5
|
import { Canvas, useThree } from "@react-three/fiber";
|
|
15
6
|
import { Line as Line3, OrthographicCamera, Text } from "@react-three/drei";
|
|
16
|
-
import { useShallow as
|
|
7
|
+
import { useShallow as useShallow7 } from "zustand/react/shallow";
|
|
17
8
|
|
|
18
9
|
// src/renderables/renderable.tsx
|
|
19
10
|
import { memo as memo5, useMemo as useMemo5 } from "react";
|
|
@@ -35,13 +26,7 @@ function useVizijStore(selector) {
|
|
|
35
26
|
}
|
|
36
27
|
|
|
37
28
|
// src/renderables/group.tsx
|
|
38
|
-
import {
|
|
39
|
-
memo,
|
|
40
|
-
useCallback,
|
|
41
|
-
useEffect as useEffect2,
|
|
42
|
-
useRef,
|
|
43
|
-
useMemo
|
|
44
|
-
} from "react";
|
|
29
|
+
import { memo, useCallback, useEffect as useEffect2, useRef, useMemo } from "react";
|
|
45
30
|
import * as THREE from "three";
|
|
46
31
|
import { useShallow } from "zustand/react/shallow";
|
|
47
32
|
import {
|
|
@@ -138,7 +123,7 @@ function InnerRenderedGroup({
|
|
|
138
123
|
namespace,
|
|
139
124
|
chain
|
|
140
125
|
}) {
|
|
141
|
-
const ref = useRef();
|
|
126
|
+
const ref = useRef(null);
|
|
142
127
|
const group = useVizijStore(useShallow((state) => state.world[id]));
|
|
143
128
|
const refIsNull = !group.refs[namespace]?.current;
|
|
144
129
|
const animatables = useVizijStore(useShallow((state) => state.animatables));
|
|
@@ -249,13 +234,7 @@ function InnerRenderedGroup({
|
|
|
249
234
|
var RenderedGroup = memo(InnerRenderedGroup);
|
|
250
235
|
|
|
251
236
|
// src/renderables/ellipse.tsx
|
|
252
|
-
import {
|
|
253
|
-
memo as memo2,
|
|
254
|
-
useCallback as useCallback2,
|
|
255
|
-
useEffect as useEffect3,
|
|
256
|
-
useRef as useRef2,
|
|
257
|
-
useMemo as useMemo2
|
|
258
|
-
} from "react";
|
|
237
|
+
import { memo as memo2, useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useMemo as useMemo2 } from "react";
|
|
259
238
|
import { useShallow as useShallow2 } from "zustand/react/shallow";
|
|
260
239
|
import {
|
|
261
240
|
instanceOfRawNumber as instanceOfRawNumber2,
|
|
@@ -272,9 +251,11 @@ function InnerRenderedEllipse({
|
|
|
272
251
|
namespace,
|
|
273
252
|
chain
|
|
274
253
|
}) {
|
|
275
|
-
const ellipseRef = useRef2();
|
|
276
|
-
const materialRef = useRef2(
|
|
277
|
-
|
|
254
|
+
const ellipseRef = useRef2(null);
|
|
255
|
+
const materialRef = useRef2(
|
|
256
|
+
null
|
|
257
|
+
);
|
|
258
|
+
const lineRef = useRef2(null);
|
|
278
259
|
const strokeOffsetRef = useRef2(0);
|
|
279
260
|
const strokeWidthRef = useRef2(0);
|
|
280
261
|
const onElementClick = useVizijStore(
|
|
@@ -547,13 +528,7 @@ var showLine = (ellipse) => {
|
|
|
547
528
|
};
|
|
548
529
|
|
|
549
530
|
// src/renderables/rectangle.tsx
|
|
550
|
-
import {
|
|
551
|
-
memo as memo3,
|
|
552
|
-
useCallback as useCallback3,
|
|
553
|
-
useEffect as useEffect4,
|
|
554
|
-
useRef as useRef3,
|
|
555
|
-
useMemo as useMemo3
|
|
556
|
-
} from "react";
|
|
531
|
+
import { memo as memo3, useCallback as useCallback3, useEffect as useEffect4, useRef as useRef3, useMemo as useMemo3 } from "react";
|
|
557
532
|
import { useShallow as useShallow3 } from "zustand/react/shallow";
|
|
558
533
|
import {
|
|
559
534
|
instanceOfRawNumber as instanceOfRawNumber3,
|
|
@@ -570,9 +545,11 @@ function InnerRenderedRectangle({
|
|
|
570
545
|
namespace,
|
|
571
546
|
chain
|
|
572
547
|
}) {
|
|
573
|
-
const rectangleRef = useRef3();
|
|
574
|
-
const materialRef = useRef3(
|
|
575
|
-
|
|
548
|
+
const rectangleRef = useRef3(null);
|
|
549
|
+
const materialRef = useRef3(
|
|
550
|
+
null
|
|
551
|
+
);
|
|
552
|
+
const lineRef = useRef3(null);
|
|
576
553
|
const strokeOffsetRef = useRef3(0);
|
|
577
554
|
const strokeWidthRef = useRef3(0);
|
|
578
555
|
const onElementClick = useVizijStore(
|
|
@@ -846,13 +823,7 @@ var showLine2 = (rectangle) => {
|
|
|
846
823
|
};
|
|
847
824
|
|
|
848
825
|
// src/renderables/shape.tsx
|
|
849
|
-
import {
|
|
850
|
-
memo as memo4,
|
|
851
|
-
useCallback as useCallback4,
|
|
852
|
-
useRef as useRef4,
|
|
853
|
-
useMemo as useMemo4,
|
|
854
|
-
useEffect as useEffect5
|
|
855
|
-
} from "react";
|
|
826
|
+
import { memo as memo4, useCallback as useCallback4, useRef as useRef4, useMemo as useMemo4, useEffect as useEffect5 } from "react";
|
|
856
827
|
import * as THREE2 from "three";
|
|
857
828
|
import { useShallow as useShallow4 } from "zustand/react/shallow";
|
|
858
829
|
import {
|
|
@@ -869,8 +840,8 @@ function InnerRenderedShape({
|
|
|
869
840
|
namespace,
|
|
870
841
|
chain
|
|
871
842
|
}) {
|
|
872
|
-
const refGroup = useRef4();
|
|
873
|
-
const ref = useRef4();
|
|
843
|
+
const refGroup = useRef4(null);
|
|
844
|
+
const ref = useRef4(null);
|
|
874
845
|
const shape = useVizijStore(useShallow4((state) => state.world[id]));
|
|
875
846
|
const refs = useVizijStore(
|
|
876
847
|
useShallow4((state) => state.world[id].refs)
|
|
@@ -911,7 +882,7 @@ function InnerRenderedShape({
|
|
|
911
882
|
}),
|
|
912
883
|
[shape, animatableValues, selectionData]
|
|
913
884
|
);
|
|
914
|
-
const material = useRef4();
|
|
885
|
+
const material = useRef4(null);
|
|
915
886
|
const morphTargetSettings = useMemo4(() => {
|
|
916
887
|
if (shape.morphTargets) {
|
|
917
888
|
const dictionary = shape.morphTargets.reduce(
|
|
@@ -1557,6 +1528,19 @@ var VizijSlice = (set, get) => ({
|
|
|
1557
1528
|
})
|
|
1558
1529
|
);
|
|
1559
1530
|
},
|
|
1531
|
+
setValues: (writes = []) => {
|
|
1532
|
+
if (writes.length === 0) {
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
set(
|
|
1536
|
+
produce((state) => {
|
|
1537
|
+
writes.forEach(({ id, namespace, value }) => {
|
|
1538
|
+
const lookupId = getLookup2(namespace, id);
|
|
1539
|
+
state.values.set(lookupId, value);
|
|
1540
|
+
});
|
|
1541
|
+
})
|
|
1542
|
+
);
|
|
1543
|
+
},
|
|
1560
1544
|
setWorldElementName: (id, value) => {
|
|
1561
1545
|
set(
|
|
1562
1546
|
produce((state) => {
|
|
@@ -1751,8 +1735,117 @@ var createVizijStore = (initial) => create()(
|
|
|
1751
1735
|
}))
|
|
1752
1736
|
);
|
|
1753
1737
|
|
|
1738
|
+
// src/effects/selection-glow-effect.tsx
|
|
1739
|
+
import { Fragment as Fragment4, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5 } from "react";
|
|
1740
|
+
import { useFrame } from "@react-three/fiber";
|
|
1741
|
+
import { useShallow as useShallow6 } from "zustand/react/shallow";
|
|
1742
|
+
import {
|
|
1743
|
+
AdditiveBlending,
|
|
1744
|
+
Color,
|
|
1745
|
+
EdgesGeometry,
|
|
1746
|
+
LineBasicMaterial,
|
|
1747
|
+
Matrix4,
|
|
1748
|
+
Quaternion,
|
|
1749
|
+
Vector3
|
|
1750
|
+
} from "three";
|
|
1751
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1752
|
+
function SelectionGlowEffect({
|
|
1753
|
+
enabled = false,
|
|
1754
|
+
color = "#ff1010ff",
|
|
1755
|
+
opacity = 0.9,
|
|
1756
|
+
thresholdAngle = 2
|
|
1757
|
+
}) {
|
|
1758
|
+
const selections = useVizijStore(
|
|
1759
|
+
useShallow6(
|
|
1760
|
+
(state) => enabled ? state.elementSelection ?? [] : []
|
|
1761
|
+
)
|
|
1762
|
+
);
|
|
1763
|
+
if (!enabled || selections.length === 0) {
|
|
1764
|
+
return null;
|
|
1765
|
+
}
|
|
1766
|
+
return /* @__PURE__ */ jsx6(Fragment4, { children: selections.map((selection) => /* @__PURE__ */ jsx6(
|
|
1767
|
+
SelectionOutline,
|
|
1768
|
+
{
|
|
1769
|
+
selection,
|
|
1770
|
+
color: selection.color ?? color,
|
|
1771
|
+
opacity,
|
|
1772
|
+
thresholdAngle
|
|
1773
|
+
},
|
|
1774
|
+
`${selection.namespace}:${selection.id}`
|
|
1775
|
+
)) });
|
|
1776
|
+
}
|
|
1777
|
+
function SelectionOutline({
|
|
1778
|
+
selection,
|
|
1779
|
+
color,
|
|
1780
|
+
opacity,
|
|
1781
|
+
thresholdAngle
|
|
1782
|
+
}) {
|
|
1783
|
+
const target = useVizijStore(
|
|
1784
|
+
useShallow6((state) => {
|
|
1785
|
+
const entry = state.world[selection.id];
|
|
1786
|
+
const ref = entry?.refs?.[selection.namespace];
|
|
1787
|
+
const geometry = entry?.geometry ?? null;
|
|
1788
|
+
return { ref, geometry };
|
|
1789
|
+
})
|
|
1790
|
+
);
|
|
1791
|
+
const sourceRef = target.ref;
|
|
1792
|
+
const edgesGeometry = useMemo6(() => {
|
|
1793
|
+
if (!target.geometry) return null;
|
|
1794
|
+
const edges = new EdgesGeometry(target.geometry, thresholdAngle);
|
|
1795
|
+
return edges;
|
|
1796
|
+
}, [target.geometry, thresholdAngle]);
|
|
1797
|
+
useEffect6(() => () => edgesGeometry?.dispose(), [edgesGeometry]);
|
|
1798
|
+
const material = useMemo6(() => {
|
|
1799
|
+
const mat = new LineBasicMaterial({
|
|
1800
|
+
color: new Color(color),
|
|
1801
|
+
transparent: true,
|
|
1802
|
+
opacity,
|
|
1803
|
+
blending: AdditiveBlending,
|
|
1804
|
+
depthTest: false,
|
|
1805
|
+
depthWrite: false,
|
|
1806
|
+
toneMapped: false
|
|
1807
|
+
});
|
|
1808
|
+
return mat;
|
|
1809
|
+
}, [color, opacity]);
|
|
1810
|
+
useEffect6(() => () => material.dispose(), [material]);
|
|
1811
|
+
const lineRef = useRef5(null);
|
|
1812
|
+
useFrame(() => {
|
|
1813
|
+
const source = sourceRef?.current;
|
|
1814
|
+
const line = lineRef.current;
|
|
1815
|
+
if (!source || !line) return;
|
|
1816
|
+
copyWorldTransform(source, line);
|
|
1817
|
+
line.visible = source.visible;
|
|
1818
|
+
});
|
|
1819
|
+
if (!sourceRef || !edgesGeometry) {
|
|
1820
|
+
return null;
|
|
1821
|
+
}
|
|
1822
|
+
return /* @__PURE__ */ jsx6(
|
|
1823
|
+
"lineSegments",
|
|
1824
|
+
{
|
|
1825
|
+
ref: lineRef,
|
|
1826
|
+
geometry: edgesGeometry,
|
|
1827
|
+
material,
|
|
1828
|
+
frustumCulled: false,
|
|
1829
|
+
renderOrder: 1e3
|
|
1830
|
+
}
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
var tempMatrix = new Matrix4();
|
|
1834
|
+
var tempPosition = new Vector3();
|
|
1835
|
+
var tempQuaternion = new Quaternion();
|
|
1836
|
+
var tempScale = new Vector3();
|
|
1837
|
+
function copyWorldTransform(source, target) {
|
|
1838
|
+
source.updateWorldMatrix(true, false);
|
|
1839
|
+
tempMatrix.copy(source.matrixWorld);
|
|
1840
|
+
tempMatrix.decompose(tempPosition, tempQuaternion, tempScale);
|
|
1841
|
+
target.position.copy(tempPosition);
|
|
1842
|
+
target.quaternion.copy(tempQuaternion);
|
|
1843
|
+
target.scale.copy(tempScale);
|
|
1844
|
+
target.updateMatrix();
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1754
1847
|
// src/vizij.tsx
|
|
1755
|
-
import { Fragment as
|
|
1848
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1756
1849
|
Object3D4.DEFAULT_UP.set(0, 0, 1);
|
|
1757
1850
|
function Vizij({
|
|
1758
1851
|
style,
|
|
@@ -1760,11 +1853,12 @@ function Vizij({
|
|
|
1760
1853
|
rootId,
|
|
1761
1854
|
namespace = "default",
|
|
1762
1855
|
showSafeArea = false,
|
|
1856
|
+
showSelectionGlow = false,
|
|
1763
1857
|
onPointerMissed
|
|
1764
1858
|
}) {
|
|
1765
1859
|
const ctx = useContext3(VizijContext);
|
|
1766
1860
|
if (ctx) {
|
|
1767
|
-
return /* @__PURE__ */
|
|
1861
|
+
return /* @__PURE__ */ jsx7(
|
|
1768
1862
|
Canvas,
|
|
1769
1863
|
{
|
|
1770
1864
|
shadows: false,
|
|
@@ -1776,18 +1870,19 @@ function Vizij({
|
|
|
1776
1870
|
toneMapping: NoToneMapping,
|
|
1777
1871
|
antialias: true
|
|
1778
1872
|
},
|
|
1779
|
-
children: /* @__PURE__ */
|
|
1873
|
+
children: /* @__PURE__ */ jsx7(
|
|
1780
1874
|
MemoizedInnerVizij,
|
|
1781
1875
|
{
|
|
1782
1876
|
rootId,
|
|
1783
1877
|
namespace,
|
|
1784
|
-
showSafeArea
|
|
1878
|
+
showSafeArea,
|
|
1879
|
+
showSelectionGlow
|
|
1785
1880
|
}
|
|
1786
1881
|
)
|
|
1787
1882
|
}
|
|
1788
1883
|
);
|
|
1789
1884
|
} else {
|
|
1790
|
-
return /* @__PURE__ */
|
|
1885
|
+
return /* @__PURE__ */ jsx7(VizijContext.Provider, { value: useDefaultVizijStore, children: /* @__PURE__ */ jsx7(
|
|
1791
1886
|
Canvas,
|
|
1792
1887
|
{
|
|
1793
1888
|
style,
|
|
@@ -1798,12 +1893,13 @@ function Vizij({
|
|
|
1798
1893
|
toneMapping: NoToneMapping,
|
|
1799
1894
|
antialias: true
|
|
1800
1895
|
},
|
|
1801
|
-
children: /* @__PURE__ */
|
|
1896
|
+
children: /* @__PURE__ */ jsx7(
|
|
1802
1897
|
MemoizedInnerVizij,
|
|
1803
1898
|
{
|
|
1804
1899
|
rootId,
|
|
1805
1900
|
namespace,
|
|
1806
|
-
showSafeArea
|
|
1901
|
+
showSafeArea,
|
|
1902
|
+
showSelectionGlow
|
|
1807
1903
|
}
|
|
1808
1904
|
)
|
|
1809
1905
|
}
|
|
@@ -1814,15 +1910,16 @@ function InnerVizij({
|
|
|
1814
1910
|
rootId,
|
|
1815
1911
|
namespace = "default",
|
|
1816
1912
|
container,
|
|
1817
|
-
showSafeArea
|
|
1913
|
+
showSafeArea,
|
|
1914
|
+
showSelectionGlow
|
|
1818
1915
|
}) {
|
|
1819
1916
|
const sceneParentSizing = container ? {
|
|
1820
1917
|
width: container.width * container.resolution,
|
|
1821
1918
|
height: container.height * container.resolution
|
|
1822
1919
|
} : void 0;
|
|
1823
|
-
return /* @__PURE__ */ jsxs4(
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ jsxs4(Fragment5, { children: [
|
|
1921
|
+
/* @__PURE__ */ jsx7("ambientLight", { intensity: Math.PI / 2 }),
|
|
1922
|
+
/* @__PURE__ */ jsx7(
|
|
1826
1923
|
OrthographicCamera,
|
|
1827
1924
|
{
|
|
1828
1925
|
makeDefault: true,
|
|
@@ -1831,7 +1928,7 @@ function InnerVizij({
|
|
|
1831
1928
|
far: 101
|
|
1832
1929
|
}
|
|
1833
1930
|
),
|
|
1834
|
-
/* @__PURE__ */
|
|
1931
|
+
/* @__PURE__ */ jsx7(Suspense, { fallback: null, children: /* @__PURE__ */ jsx7(
|
|
1835
1932
|
World,
|
|
1836
1933
|
{
|
|
1837
1934
|
rootId,
|
|
@@ -1839,7 +1936,8 @@ function InnerVizij({
|
|
|
1839
1936
|
parentSizing: sceneParentSizing
|
|
1840
1937
|
}
|
|
1841
1938
|
) }),
|
|
1842
|
-
|
|
1939
|
+
showSelectionGlow && /* @__PURE__ */ jsx7(SelectionGlowEffect, { enabled: true }),
|
|
1940
|
+
showSafeArea && /* @__PURE__ */ jsx7(SafeAreaRenderer, { rootId })
|
|
1843
1941
|
] });
|
|
1844
1942
|
}
|
|
1845
1943
|
var MemoizedInnerVizij = memo6(InnerVizij);
|
|
@@ -1849,7 +1947,7 @@ function InnerWorld({
|
|
|
1849
1947
|
parentSizing
|
|
1850
1948
|
}) {
|
|
1851
1949
|
const [present, rootBounds] = useVizijStore(
|
|
1852
|
-
|
|
1950
|
+
useShallow7((state) => {
|
|
1853
1951
|
const group = state.world[rootId];
|
|
1854
1952
|
const bounds = group?.rootBounds ?? defaultRootBounds;
|
|
1855
1953
|
return [group !== void 0, bounds];
|
|
@@ -1859,7 +1957,7 @@ function InnerWorld({
|
|
|
1859
1957
|
camera: state.camera,
|
|
1860
1958
|
size: state.size
|
|
1861
1959
|
}));
|
|
1862
|
-
|
|
1960
|
+
useEffect7(() => {
|
|
1863
1961
|
const width = rootBounds.size.x;
|
|
1864
1962
|
const height = rootBounds.size.y;
|
|
1865
1963
|
if (camera && parentSizing === void 0 && camera.isOrthographicCamera) {
|
|
@@ -1888,8 +1986,8 @@ function InnerWorld({
|
|
|
1888
1986
|
}
|
|
1889
1987
|
}, [rootBounds, camera, parentSizing, size]);
|
|
1890
1988
|
return /* @__PURE__ */ jsxs4(ErrorBoundary, { fallback: null, children: [
|
|
1891
|
-
present && /* @__PURE__ */
|
|
1892
|
-
!present && /* @__PURE__ */
|
|
1989
|
+
present && /* @__PURE__ */ jsx7(Renderable, { id: rootId, namespace, chain: [] }),
|
|
1990
|
+
!present && /* @__PURE__ */ jsx7(
|
|
1893
1991
|
Text,
|
|
1894
1992
|
{
|
|
1895
1993
|
position: [0, 0, 0],
|
|
@@ -1912,7 +2010,7 @@ function SafeAreaRenderer({ rootId }) {
|
|
|
1912
2010
|
const right = rootBounds.center.x + rootBounds.size.x / 2;
|
|
1913
2011
|
const top = rootBounds.center.y + rootBounds.size.y / 2;
|
|
1914
2012
|
const bottom = rootBounds.center.y - rootBounds.size.y / 2;
|
|
1915
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ jsx7(
|
|
1916
2014
|
Line3,
|
|
1917
2015
|
{
|
|
1918
2016
|
points: [
|
|
@@ -1943,11 +2041,11 @@ var ShapeMaterial = /* @__PURE__ */ ((ShapeMaterial2) => {
|
|
|
1943
2041
|
})(ShapeMaterial || {});
|
|
1944
2042
|
|
|
1945
2043
|
// src/hooks/use-vizij-store-subscription.ts
|
|
1946
|
-
import { useContext as useContext4, useEffect as
|
|
2044
|
+
import { useContext as useContext4, useEffect as useEffect8 } from "react";
|
|
1947
2045
|
function useVizijStoreSubscription(selector, listener) {
|
|
1948
2046
|
const store = useContext4(VizijContext);
|
|
1949
2047
|
if (!store) throw new Error("Missing VizijProvider in the tree");
|
|
1950
|
-
|
|
2048
|
+
useEffect8(() => {
|
|
1951
2049
|
const initialValue = selector(store.getState());
|
|
1952
2050
|
listener(initialValue);
|
|
1953
2051
|
return store.subscribe(selector, listener);
|
|
@@ -2013,9 +2111,7 @@ function namespaceArrayToRefs(namespaces) {
|
|
|
2013
2111
|
}
|
|
2014
2112
|
|
|
2015
2113
|
// src/functions/gltf-loading/import-mesh.ts
|
|
2016
|
-
import {
|
|
2017
|
-
Object3D as Object3D5
|
|
2018
|
-
} from "three";
|
|
2114
|
+
import { Object3D as Object3D5 } from "three";
|
|
2019
2115
|
|
|
2020
2116
|
// src/functions/gltf-loading/import-geometry.ts
|
|
2021
2117
|
function sanitizeMorphKey(name, fallbackIndex, used) {
|
|
@@ -2055,7 +2151,7 @@ function importGeometry(geometry, mesh) {
|
|
|
2055
2151
|
type: "number",
|
|
2056
2152
|
default: mesh.morphTargetInfluences?.[index] ?? 0,
|
|
2057
2153
|
constraints: {
|
|
2058
|
-
min:
|
|
2154
|
+
min: -1,
|
|
2059
2155
|
max: 1
|
|
2060
2156
|
},
|
|
2061
2157
|
pub: {
|
|
@@ -2589,9 +2685,10 @@ function deriveRootBounds(group) {
|
|
|
2589
2685
|
}
|
|
2590
2686
|
|
|
2591
2687
|
// src/functions/vizij-bundle.ts
|
|
2688
|
+
import { cloneDeepSafe } from "@vizij/utils";
|
|
2592
2689
|
var BUNDLE_KEYS = ["VIZIJ_bundle"];
|
|
2593
2690
|
function cloneBundle(value) {
|
|
2594
|
-
return
|
|
2691
|
+
return cloneDeepSafe(value);
|
|
2595
2692
|
}
|
|
2596
2693
|
function readExtensionValue(extensionContainer) {
|
|
2597
2694
|
for (const key of BUNDLE_KEYS) {
|
|
@@ -2689,6 +2786,7 @@ function applyVizijBundle(object, bundle) {
|
|
|
2689
2786
|
}
|
|
2690
2787
|
|
|
2691
2788
|
// src/functions/gltf-loading/extract-animations.ts
|
|
2789
|
+
import { cloneDeepSafe as cloneDeepSafe2 } from "@vizij/utils";
|
|
2692
2790
|
var CHANNEL_PATH_TO_TRACK_PROPERTY = {
|
|
2693
2791
|
translation: "position",
|
|
2694
2792
|
rotation: "quaternion",
|
|
@@ -2704,7 +2802,7 @@ function clonePlainObject(value) {
|
|
|
2704
2802
|
if (!value) {
|
|
2705
2803
|
return void 0;
|
|
2706
2804
|
}
|
|
2707
|
-
return
|
|
2805
|
+
return cloneDeepSafe2(value);
|
|
2708
2806
|
}
|
|
2709
2807
|
function inferValueSize(valueType) {
|
|
2710
2808
|
switch (valueType) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizij/render",
|
|
3
3
|
"description": "Higher-level visualization and interaction components for robot and ai faces.",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -23,23 +23,8 @@
|
|
|
23
23
|
"dist",
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsup src/index.tsx --format esm,cjs --dts src/index.tsx --external react,react-dom,three,@react-three/fiber,@react-three/drei,zustand",
|
|
28
|
-
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts src/index.tsx --external react,react-dom,three,@react-three/fiber,@react-three/drei,zustand",
|
|
29
|
-
"typecheck": "tsc --noEmit",
|
|
30
|
-
"lint": "pnpm --filter \"$npm_package_name\" exec eslint --ext .js,.jsx,.ts,.tsx -- .",
|
|
31
|
-
"lint:fix": "pnpm --filter \"$npm_package_name\" exec eslint --ext .js,.jsx,.ts,.tsx --fix -- .",
|
|
32
|
-
"prettier:check": "prettier --check .",
|
|
33
|
-
"prettier:write": "prettier --write .",
|
|
34
|
-
"test": "node --loader ./tests/node-ts-loader.mjs --test tests/*.node-test.mjs",
|
|
35
|
-
"clean": "rm -rf dist .turbo coverage tsconfig.tsbuildinfo",
|
|
36
|
-
"reset": "rm -rf node_modules",
|
|
37
|
-
"reset:hard": "pnpm run reset && rm -f pnpm-lock.yaml package-lock.json yarn.lock",
|
|
38
|
-
"size": "size-limit",
|
|
39
|
-
"prepack": "pnpm run build && pnpm run test && pnpm run typecheck && pnpm run lint && pnpm run size"
|
|
40
|
-
},
|
|
41
26
|
"dependencies": {
|
|
42
|
-
"@vizij/utils": "
|
|
27
|
+
"@vizij/utils": "0.1.0",
|
|
43
28
|
"clsx": "^2.1.1",
|
|
44
29
|
"deep-equal": "^2.2.3",
|
|
45
30
|
"immer": "^10.0.3",
|
|
@@ -48,8 +33,8 @@
|
|
|
48
33
|
"three-stdlib": "^2.35.13"
|
|
49
34
|
},
|
|
50
35
|
"peerDependencies": {
|
|
51
|
-
"@react-three/drei": "^
|
|
52
|
-
"@react-three/fiber": "^
|
|
36
|
+
"@react-three/drei": "^10.7.7",
|
|
37
|
+
"@react-three/fiber": "^9.5.0",
|
|
53
38
|
"react": ">=18",
|
|
54
39
|
"react-dom": ">=18",
|
|
55
40
|
"tailwindcss": "^4.1.3",
|
|
@@ -57,15 +42,15 @@
|
|
|
57
42
|
"zustand": "^5.0.2"
|
|
58
43
|
},
|
|
59
44
|
"devDependencies": {
|
|
60
|
-
"@react-three/drei": "^
|
|
61
|
-
"@react-three/fiber": "^
|
|
45
|
+
"@react-three/drei": "^10.7.7",
|
|
46
|
+
"@react-three/fiber": "^9.5.0",
|
|
62
47
|
"@types/deep-equal": "^1.0.4",
|
|
63
48
|
"@types/lodash": "^4.17.4",
|
|
64
|
-
"@types/react": "^
|
|
49
|
+
"@types/react": "^19.2.7",
|
|
65
50
|
"@types/three": "^0.170.0",
|
|
66
51
|
"@size-limit/file": "^11.2.0",
|
|
67
|
-
"react": "^
|
|
68
|
-
"react-dom": "^
|
|
52
|
+
"react": "^19.2.3",
|
|
53
|
+
"react-dom": "^19.2.3",
|
|
69
54
|
"size-limit": "^11.1.7",
|
|
70
55
|
"three": "^0.170.0",
|
|
71
56
|
"zustand": "^5.0.2",
|
|
@@ -82,5 +67,19 @@
|
|
|
82
67
|
],
|
|
83
68
|
"publishConfig": {
|
|
84
69
|
"access": "public"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsup src/index.tsx --format esm,cjs --dts src/index.tsx --external react,react-dom,three,@react-three/fiber,@react-three/drei,zustand",
|
|
73
|
+
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts src/index.tsx --external react,react-dom,three,@react-three/fiber,@react-three/drei,zustand",
|
|
74
|
+
"typecheck": "tsc --noEmit",
|
|
75
|
+
"lint": "pnpm --filter \"$npm_package_name\" exec eslint --ext .js,.jsx,.ts,.tsx -- .",
|
|
76
|
+
"lint:fix": "pnpm --filter \"$npm_package_name\" exec eslint --ext .js,.jsx,.ts,.tsx --fix -- .",
|
|
77
|
+
"prettier:check": "prettier --check .",
|
|
78
|
+
"prettier:write": "prettier --write .",
|
|
79
|
+
"test": "node --loader ./tests/node-ts-loader.mjs --test tests/*.node-test.mjs",
|
|
80
|
+
"clean": "rm -rf dist .turbo coverage tsconfig.tsbuildinfo",
|
|
81
|
+
"reset": "rm -rf node_modules",
|
|
82
|
+
"reset:hard": "pnpm run reset && rm -f pnpm-lock.yaml package-lock.json yarn.lock",
|
|
83
|
+
"size": "size-limit"
|
|
85
84
|
}
|
|
86
|
-
}
|
|
85
|
+
}
|