@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.js
CHANGED
|
@@ -55,12 +55,12 @@ __export(index_exports, {
|
|
|
55
55
|
module.exports = __toCommonJS(index_exports);
|
|
56
56
|
|
|
57
57
|
// src/vizij.tsx
|
|
58
|
-
var
|
|
58
|
+
var import_react11 = require("react");
|
|
59
59
|
var import_react_error_boundary = require("react-error-boundary");
|
|
60
|
-
var
|
|
61
|
-
var
|
|
60
|
+
var import_three2 = require("three");
|
|
61
|
+
var import_fiber2 = require("@react-three/fiber");
|
|
62
62
|
var import_drei3 = require("@react-three/drei");
|
|
63
|
-
var
|
|
63
|
+
var import_shallow8 = require("zustand/react/shallow");
|
|
64
64
|
|
|
65
65
|
// src/renderables/renderable.tsx
|
|
66
66
|
var import_react8 = require("react");
|
|
@@ -174,7 +174,7 @@ function InnerRenderedGroup({
|
|
|
174
174
|
namespace,
|
|
175
175
|
chain
|
|
176
176
|
}) {
|
|
177
|
-
const ref = (0, import_react4.useRef)();
|
|
177
|
+
const ref = (0, import_react4.useRef)(null);
|
|
178
178
|
const group = useVizijStore((0, import_shallow2.useShallow)((state) => state.world[id]));
|
|
179
179
|
const refIsNull = !group.refs[namespace]?.current;
|
|
180
180
|
const animatables = useVizijStore((0, import_shallow2.useShallow)((state) => state.animatables));
|
|
@@ -295,9 +295,11 @@ function InnerRenderedEllipse({
|
|
|
295
295
|
namespace,
|
|
296
296
|
chain
|
|
297
297
|
}) {
|
|
298
|
-
const ellipseRef = (0, import_react5.useRef)();
|
|
299
|
-
const materialRef = (0, import_react5.useRef)(
|
|
300
|
-
|
|
298
|
+
const ellipseRef = (0, import_react5.useRef)(null);
|
|
299
|
+
const materialRef = (0, import_react5.useRef)(
|
|
300
|
+
null
|
|
301
|
+
);
|
|
302
|
+
const lineRef = (0, import_react5.useRef)(null);
|
|
301
303
|
const strokeOffsetRef = (0, import_react5.useRef)(0);
|
|
302
304
|
const strokeWidthRef = (0, import_react5.useRef)(0);
|
|
303
305
|
const onElementClick = useVizijStore(
|
|
@@ -580,9 +582,11 @@ function InnerRenderedRectangle({
|
|
|
580
582
|
namespace,
|
|
581
583
|
chain
|
|
582
584
|
}) {
|
|
583
|
-
const rectangleRef = (0, import_react6.useRef)();
|
|
584
|
-
const materialRef = (0, import_react6.useRef)(
|
|
585
|
-
|
|
585
|
+
const rectangleRef = (0, import_react6.useRef)(null);
|
|
586
|
+
const materialRef = (0, import_react6.useRef)(
|
|
587
|
+
null
|
|
588
|
+
);
|
|
589
|
+
const lineRef = (0, import_react6.useRef)(null);
|
|
586
590
|
const strokeOffsetRef = (0, import_react6.useRef)(0);
|
|
587
591
|
const strokeWidthRef = (0, import_react6.useRef)(0);
|
|
588
592
|
const onElementClick = useVizijStore(
|
|
@@ -867,8 +871,8 @@ function InnerRenderedShape({
|
|
|
867
871
|
namespace,
|
|
868
872
|
chain
|
|
869
873
|
}) {
|
|
870
|
-
const refGroup = (0, import_react7.useRef)();
|
|
871
|
-
const ref = (0, import_react7.useRef)();
|
|
874
|
+
const refGroup = (0, import_react7.useRef)(null);
|
|
875
|
+
const ref = (0, import_react7.useRef)(null);
|
|
872
876
|
const shape = useVizijStore((0, import_shallow5.useShallow)((state) => state.world[id]));
|
|
873
877
|
const refs = useVizijStore(
|
|
874
878
|
(0, import_shallow5.useShallow)((state) => state.world[id].refs)
|
|
@@ -909,7 +913,7 @@ function InnerRenderedShape({
|
|
|
909
913
|
}),
|
|
910
914
|
[shape, animatableValues, selectionData]
|
|
911
915
|
);
|
|
912
|
-
const material = (0, import_react7.useRef)();
|
|
916
|
+
const material = (0, import_react7.useRef)(null);
|
|
913
917
|
const morphTargetSettings = (0, import_react7.useMemo)(() => {
|
|
914
918
|
if (shape.morphTargets) {
|
|
915
919
|
const dictionary = shape.morphTargets.reduce(
|
|
@@ -1555,6 +1559,19 @@ var VizijSlice = (set, get) => ({
|
|
|
1555
1559
|
})
|
|
1556
1560
|
);
|
|
1557
1561
|
},
|
|
1562
|
+
setValues: (writes = []) => {
|
|
1563
|
+
if (writes.length === 0) {
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
set(
|
|
1567
|
+
(0, import_immer.produce)((state) => {
|
|
1568
|
+
writes.forEach(({ id, namespace, value }) => {
|
|
1569
|
+
const lookupId = (0, import_utils6.getLookup)(namespace, id);
|
|
1570
|
+
state.values.set(lookupId, value);
|
|
1571
|
+
});
|
|
1572
|
+
})
|
|
1573
|
+
);
|
|
1574
|
+
},
|
|
1558
1575
|
setWorldElementName: (id, value) => {
|
|
1559
1576
|
set(
|
|
1560
1577
|
(0, import_immer.produce)((state) => {
|
|
@@ -1749,59 +1766,163 @@ var createVizijStore = (initial) => (0, import_zustand2.create)()(
|
|
|
1749
1766
|
}))
|
|
1750
1767
|
);
|
|
1751
1768
|
|
|
1752
|
-
// src/
|
|
1769
|
+
// src/effects/selection-glow-effect.tsx
|
|
1770
|
+
var import_react10 = require("react");
|
|
1771
|
+
var import_fiber = require("@react-three/fiber");
|
|
1772
|
+
var import_shallow7 = require("zustand/react/shallow");
|
|
1773
|
+
var import_three = require("three");
|
|
1753
1774
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1754
|
-
|
|
1775
|
+
function SelectionGlowEffect({
|
|
1776
|
+
enabled = false,
|
|
1777
|
+
color = "#ff1010ff",
|
|
1778
|
+
opacity = 0.9,
|
|
1779
|
+
thresholdAngle = 2
|
|
1780
|
+
}) {
|
|
1781
|
+
const selections = useVizijStore(
|
|
1782
|
+
(0, import_shallow7.useShallow)(
|
|
1783
|
+
(state) => enabled ? state.elementSelection ?? [] : []
|
|
1784
|
+
)
|
|
1785
|
+
);
|
|
1786
|
+
if (!enabled || selections.length === 0) {
|
|
1787
|
+
return null;
|
|
1788
|
+
}
|
|
1789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react10.Fragment, { children: selections.map((selection) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1790
|
+
SelectionOutline,
|
|
1791
|
+
{
|
|
1792
|
+
selection,
|
|
1793
|
+
color: selection.color ?? color,
|
|
1794
|
+
opacity,
|
|
1795
|
+
thresholdAngle
|
|
1796
|
+
},
|
|
1797
|
+
`${selection.namespace}:${selection.id}`
|
|
1798
|
+
)) });
|
|
1799
|
+
}
|
|
1800
|
+
function SelectionOutline({
|
|
1801
|
+
selection,
|
|
1802
|
+
color,
|
|
1803
|
+
opacity,
|
|
1804
|
+
thresholdAngle
|
|
1805
|
+
}) {
|
|
1806
|
+
const target = useVizijStore(
|
|
1807
|
+
(0, import_shallow7.useShallow)((state) => {
|
|
1808
|
+
const entry = state.world[selection.id];
|
|
1809
|
+
const ref = entry?.refs?.[selection.namespace];
|
|
1810
|
+
const geometry = entry?.geometry ?? null;
|
|
1811
|
+
return { ref, geometry };
|
|
1812
|
+
})
|
|
1813
|
+
);
|
|
1814
|
+
const sourceRef = target.ref;
|
|
1815
|
+
const edgesGeometry = (0, import_react10.useMemo)(() => {
|
|
1816
|
+
if (!target.geometry) return null;
|
|
1817
|
+
const edges = new import_three.EdgesGeometry(target.geometry, thresholdAngle);
|
|
1818
|
+
return edges;
|
|
1819
|
+
}, [target.geometry, thresholdAngle]);
|
|
1820
|
+
(0, import_react10.useEffect)(() => () => edgesGeometry?.dispose(), [edgesGeometry]);
|
|
1821
|
+
const material = (0, import_react10.useMemo)(() => {
|
|
1822
|
+
const mat = new import_three.LineBasicMaterial({
|
|
1823
|
+
color: new import_three.Color(color),
|
|
1824
|
+
transparent: true,
|
|
1825
|
+
opacity,
|
|
1826
|
+
blending: import_three.AdditiveBlending,
|
|
1827
|
+
depthTest: false,
|
|
1828
|
+
depthWrite: false,
|
|
1829
|
+
toneMapped: false
|
|
1830
|
+
});
|
|
1831
|
+
return mat;
|
|
1832
|
+
}, [color, opacity]);
|
|
1833
|
+
(0, import_react10.useEffect)(() => () => material.dispose(), [material]);
|
|
1834
|
+
const lineRef = (0, import_react10.useRef)(null);
|
|
1835
|
+
(0, import_fiber.useFrame)(() => {
|
|
1836
|
+
const source = sourceRef?.current;
|
|
1837
|
+
const line = lineRef.current;
|
|
1838
|
+
if (!source || !line) return;
|
|
1839
|
+
copyWorldTransform(source, line);
|
|
1840
|
+
line.visible = source.visible;
|
|
1841
|
+
});
|
|
1842
|
+
if (!sourceRef || !edgesGeometry) {
|
|
1843
|
+
return null;
|
|
1844
|
+
}
|
|
1845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1846
|
+
"lineSegments",
|
|
1847
|
+
{
|
|
1848
|
+
ref: lineRef,
|
|
1849
|
+
geometry: edgesGeometry,
|
|
1850
|
+
material,
|
|
1851
|
+
frustumCulled: false,
|
|
1852
|
+
renderOrder: 1e3
|
|
1853
|
+
}
|
|
1854
|
+
);
|
|
1855
|
+
}
|
|
1856
|
+
var tempMatrix = new import_three.Matrix4();
|
|
1857
|
+
var tempPosition = new import_three.Vector3();
|
|
1858
|
+
var tempQuaternion = new import_three.Quaternion();
|
|
1859
|
+
var tempScale = new import_three.Vector3();
|
|
1860
|
+
function copyWorldTransform(source, target) {
|
|
1861
|
+
source.updateWorldMatrix(true, false);
|
|
1862
|
+
tempMatrix.copy(source.matrixWorld);
|
|
1863
|
+
tempMatrix.decompose(tempPosition, tempQuaternion, tempScale);
|
|
1864
|
+
target.position.copy(tempPosition);
|
|
1865
|
+
target.quaternion.copy(tempQuaternion);
|
|
1866
|
+
target.scale.copy(tempScale);
|
|
1867
|
+
target.updateMatrix();
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
// src/vizij.tsx
|
|
1871
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1872
|
+
import_three2.Object3D.DEFAULT_UP.set(0, 0, 1);
|
|
1755
1873
|
function Vizij({
|
|
1756
1874
|
style,
|
|
1757
1875
|
className,
|
|
1758
1876
|
rootId,
|
|
1759
1877
|
namespace = "default",
|
|
1760
1878
|
showSafeArea = false,
|
|
1879
|
+
showSelectionGlow = false,
|
|
1761
1880
|
onPointerMissed
|
|
1762
1881
|
}) {
|
|
1763
|
-
const ctx = (0,
|
|
1882
|
+
const ctx = (0, import_react11.useContext)(VizijContext);
|
|
1764
1883
|
if (ctx) {
|
|
1765
|
-
return /* @__PURE__ */ (0,
|
|
1766
|
-
|
|
1884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1885
|
+
import_fiber2.Canvas,
|
|
1767
1886
|
{
|
|
1768
1887
|
shadows: false,
|
|
1769
1888
|
style,
|
|
1770
1889
|
className,
|
|
1771
1890
|
onPointerMissed,
|
|
1772
1891
|
gl: {
|
|
1773
|
-
outputColorSpace:
|
|
1774
|
-
toneMapping:
|
|
1892
|
+
outputColorSpace: import_three2.SRGBColorSpace,
|
|
1893
|
+
toneMapping: import_three2.NoToneMapping,
|
|
1775
1894
|
antialias: true
|
|
1776
1895
|
},
|
|
1777
|
-
children: /* @__PURE__ */ (0,
|
|
1896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1778
1897
|
MemoizedInnerVizij,
|
|
1779
1898
|
{
|
|
1780
1899
|
rootId,
|
|
1781
1900
|
namespace,
|
|
1782
|
-
showSafeArea
|
|
1901
|
+
showSafeArea,
|
|
1902
|
+
showSelectionGlow
|
|
1783
1903
|
}
|
|
1784
1904
|
)
|
|
1785
1905
|
}
|
|
1786
1906
|
);
|
|
1787
1907
|
} else {
|
|
1788
|
-
return /* @__PURE__ */ (0,
|
|
1789
|
-
|
|
1908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(VizijContext.Provider, { value: useDefaultVizijStore, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1909
|
+
import_fiber2.Canvas,
|
|
1790
1910
|
{
|
|
1791
1911
|
style,
|
|
1792
1912
|
className,
|
|
1793
1913
|
onPointerMissed,
|
|
1794
1914
|
gl: {
|
|
1795
|
-
outputColorSpace:
|
|
1796
|
-
toneMapping:
|
|
1915
|
+
outputColorSpace: import_three2.SRGBColorSpace,
|
|
1916
|
+
toneMapping: import_three2.NoToneMapping,
|
|
1797
1917
|
antialias: true
|
|
1798
1918
|
},
|
|
1799
|
-
children: /* @__PURE__ */ (0,
|
|
1919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1800
1920
|
MemoizedInnerVizij,
|
|
1801
1921
|
{
|
|
1802
1922
|
rootId,
|
|
1803
1923
|
namespace,
|
|
1804
|
-
showSafeArea
|
|
1924
|
+
showSafeArea,
|
|
1925
|
+
showSelectionGlow
|
|
1805
1926
|
}
|
|
1806
1927
|
)
|
|
1807
1928
|
}
|
|
@@ -1812,15 +1933,16 @@ function InnerVizij({
|
|
|
1812
1933
|
rootId,
|
|
1813
1934
|
namespace = "default",
|
|
1814
1935
|
container,
|
|
1815
|
-
showSafeArea
|
|
1936
|
+
showSafeArea,
|
|
1937
|
+
showSelectionGlow
|
|
1816
1938
|
}) {
|
|
1817
1939
|
const sceneParentSizing = container ? {
|
|
1818
1940
|
width: container.width * container.resolution,
|
|
1819
1941
|
height: container.height * container.resolution
|
|
1820
1942
|
} : void 0;
|
|
1821
|
-
return /* @__PURE__ */ (0,
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ambientLight", { intensity: Math.PI / 2 }),
|
|
1945
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1824
1946
|
import_drei3.OrthographicCamera,
|
|
1825
1947
|
{
|
|
1826
1948
|
makeDefault: true,
|
|
@@ -1829,7 +1951,7 @@ function InnerVizij({
|
|
|
1829
1951
|
far: 101
|
|
1830
1952
|
}
|
|
1831
1953
|
),
|
|
1832
|
-
/* @__PURE__ */ (0,
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1833
1955
|
World,
|
|
1834
1956
|
{
|
|
1835
1957
|
rootId,
|
|
@@ -1837,27 +1959,28 @@ function InnerVizij({
|
|
|
1837
1959
|
parentSizing: sceneParentSizing
|
|
1838
1960
|
}
|
|
1839
1961
|
) }),
|
|
1840
|
-
|
|
1962
|
+
showSelectionGlow && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SelectionGlowEffect, { enabled: true }),
|
|
1963
|
+
showSafeArea && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SafeAreaRenderer, { rootId })
|
|
1841
1964
|
] });
|
|
1842
1965
|
}
|
|
1843
|
-
var MemoizedInnerVizij = (0,
|
|
1966
|
+
var MemoizedInnerVizij = (0, import_react11.memo)(InnerVizij);
|
|
1844
1967
|
function InnerWorld({
|
|
1845
1968
|
rootId,
|
|
1846
1969
|
namespace = "default",
|
|
1847
1970
|
parentSizing
|
|
1848
1971
|
}) {
|
|
1849
1972
|
const [present, rootBounds] = useVizijStore(
|
|
1850
|
-
(0,
|
|
1973
|
+
(0, import_shallow8.useShallow)((state) => {
|
|
1851
1974
|
const group = state.world[rootId];
|
|
1852
1975
|
const bounds = group?.rootBounds ?? defaultRootBounds;
|
|
1853
1976
|
return [group !== void 0, bounds];
|
|
1854
1977
|
})
|
|
1855
1978
|
);
|
|
1856
|
-
const { camera, size } = (0,
|
|
1979
|
+
const { camera, size } = (0, import_fiber2.useThree)((state) => ({
|
|
1857
1980
|
camera: state.camera,
|
|
1858
1981
|
size: state.size
|
|
1859
1982
|
}));
|
|
1860
|
-
(0,
|
|
1983
|
+
(0, import_react11.useEffect)(() => {
|
|
1861
1984
|
const width = rootBounds.size.x;
|
|
1862
1985
|
const height = rootBounds.size.y;
|
|
1863
1986
|
if (camera && parentSizing === void 0 && camera.isOrthographicCamera) {
|
|
@@ -1885,9 +2008,9 @@ function InnerWorld({
|
|
|
1885
2008
|
camera.updateProjectionMatrix();
|
|
1886
2009
|
}
|
|
1887
2010
|
}, [rootBounds, camera, parentSizing, size]);
|
|
1888
|
-
return /* @__PURE__ */ (0,
|
|
1889
|
-
present && /* @__PURE__ */ (0,
|
|
1890
|
-
!present && /* @__PURE__ */ (0,
|
|
2011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_error_boundary.ErrorBoundary, { fallback: null, children: [
|
|
2012
|
+
present && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Renderable, { id: rootId, namespace, chain: [] }),
|
|
2013
|
+
!present && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1891
2014
|
import_drei3.Text,
|
|
1892
2015
|
{
|
|
1893
2016
|
position: [0, 0, 0],
|
|
@@ -1900,7 +2023,7 @@ function InnerWorld({
|
|
|
1900
2023
|
)
|
|
1901
2024
|
] });
|
|
1902
2025
|
}
|
|
1903
|
-
var World = (0,
|
|
2026
|
+
var World = (0, import_react11.memo)(InnerWorld);
|
|
1904
2027
|
function SafeAreaRenderer({ rootId }) {
|
|
1905
2028
|
const rootBounds = useVizijStore((state) => {
|
|
1906
2029
|
const group = state.world[rootId];
|
|
@@ -1910,7 +2033,7 @@ function SafeAreaRenderer({ rootId }) {
|
|
|
1910
2033
|
const right = rootBounds.center.x + rootBounds.size.x / 2;
|
|
1911
2034
|
const top = rootBounds.center.y + rootBounds.size.y / 2;
|
|
1912
2035
|
const bottom = rootBounds.center.y - rootBounds.size.y / 2;
|
|
1913
|
-
return /* @__PURE__ */ (0,
|
|
2036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1914
2037
|
import_drei3.Line,
|
|
1915
2038
|
{
|
|
1916
2039
|
points: [
|
|
@@ -1941,11 +2064,11 @@ var ShapeMaterial = /* @__PURE__ */ ((ShapeMaterial2) => {
|
|
|
1941
2064
|
})(ShapeMaterial || {});
|
|
1942
2065
|
|
|
1943
2066
|
// src/hooks/use-vizij-store-subscription.ts
|
|
1944
|
-
var
|
|
2067
|
+
var import_react12 = require("react");
|
|
1945
2068
|
function useVizijStoreSubscription(selector, listener) {
|
|
1946
|
-
const store = (0,
|
|
2069
|
+
const store = (0, import_react12.useContext)(VizijContext);
|
|
1947
2070
|
if (!store) throw new Error("Missing VizijProvider in the tree");
|
|
1948
|
-
(0,
|
|
2071
|
+
(0, import_react12.useEffect)(() => {
|
|
1949
2072
|
const initialValue = selector(store.getState());
|
|
1950
2073
|
listener(initialValue);
|
|
1951
2074
|
return store.subscribe(selector, listener);
|
|
@@ -1953,17 +2076,17 @@ function useVizijStoreSubscription(selector, listener) {
|
|
|
1953
2076
|
}
|
|
1954
2077
|
|
|
1955
2078
|
// src/hooks/use-vizij-store-setter.ts
|
|
1956
|
-
var
|
|
2079
|
+
var import_react13 = require("react");
|
|
1957
2080
|
function useVizijStoreSetter() {
|
|
1958
|
-
const store = (0,
|
|
2081
|
+
const store = (0, import_react13.useContext)(VizijContext);
|
|
1959
2082
|
if (!store) throw new Error("Missing VizijProvider in the tree");
|
|
1960
2083
|
return store.setState;
|
|
1961
2084
|
}
|
|
1962
2085
|
|
|
1963
2086
|
// src/hooks/use-vizij-store-getter.ts
|
|
1964
|
-
var
|
|
2087
|
+
var import_react14 = require("react");
|
|
1965
2088
|
function useVizijStoreGetter() {
|
|
1966
|
-
const store = (0,
|
|
2089
|
+
const store = (0, import_react14.useContext)(VizijContext);
|
|
1967
2090
|
if (!store) throw new Error("Missing VizijProvider in the tree");
|
|
1968
2091
|
return store.getState;
|
|
1969
2092
|
}
|
|
@@ -1973,7 +2096,7 @@ var THREE5 = __toESM(require("three"));
|
|
|
1973
2096
|
var import_three_stdlib = require("three-stdlib");
|
|
1974
2097
|
|
|
1975
2098
|
// src/functions/gltf-loading/traverse-three.ts
|
|
1976
|
-
var
|
|
2099
|
+
var import_react16 = require("react");
|
|
1977
2100
|
var THREE4 = __toESM(require("three"));
|
|
1978
2101
|
|
|
1979
2102
|
// src/functions/gltf-loading/map-features.ts
|
|
@@ -1999,19 +2122,19 @@ function mapFeatures(features) {
|
|
|
1999
2122
|
}
|
|
2000
2123
|
|
|
2001
2124
|
// src/functions/gltf-loading/import-scene.ts
|
|
2002
|
-
var
|
|
2125
|
+
var import_three5 = require("three");
|
|
2003
2126
|
|
|
2004
2127
|
// src/functions/gltf-loading/import-group.ts
|
|
2005
|
-
var
|
|
2128
|
+
var import_three4 = require("three");
|
|
2006
2129
|
|
|
2007
2130
|
// src/functions/util.ts
|
|
2008
|
-
var
|
|
2131
|
+
var import_react15 = require("react");
|
|
2009
2132
|
function namespaceArrayToRefs(namespaces) {
|
|
2010
|
-
return namespaces.reduce((acc, ns) => ({ ...acc, [ns]: (0,
|
|
2133
|
+
return namespaces.reduce((acc, ns) => ({ ...acc, [ns]: (0, import_react15.createRef)() }), {});
|
|
2011
2134
|
}
|
|
2012
2135
|
|
|
2013
2136
|
// src/functions/gltf-loading/import-mesh.ts
|
|
2014
|
-
var
|
|
2137
|
+
var import_three3 = require("three");
|
|
2015
2138
|
|
|
2016
2139
|
// src/functions/gltf-loading/import-geometry.ts
|
|
2017
2140
|
function sanitizeMorphKey(name, fallbackIndex, used) {
|
|
@@ -2051,7 +2174,7 @@ function importGeometry(geometry, mesh) {
|
|
|
2051
2174
|
type: "number",
|
|
2052
2175
|
default: mesh.morphTargetInfluences?.[index] ?? 0,
|
|
2053
2176
|
constraints: {
|
|
2054
|
-
min:
|
|
2177
|
+
min: -1,
|
|
2055
2178
|
max: 1
|
|
2056
2179
|
},
|
|
2057
2180
|
pub: {
|
|
@@ -2067,7 +2190,7 @@ function importGeometry(geometry, mesh) {
|
|
|
2067
2190
|
}
|
|
2068
2191
|
|
|
2069
2192
|
// src/functions/gltf-loading/import-mesh.ts
|
|
2070
|
-
|
|
2193
|
+
import_three3.Object3D.DEFAULT_UP.set(0, 0, 1);
|
|
2071
2194
|
function importMesh(mesh, namespaces, colorLookup) {
|
|
2072
2195
|
let world = {};
|
|
2073
2196
|
let animatables = {};
|
|
@@ -2226,7 +2349,7 @@ function getShapeMaterial(mesh, useEmissive) {
|
|
|
2226
2349
|
}
|
|
2227
2350
|
|
|
2228
2351
|
// src/functions/gltf-loading/import-group.ts
|
|
2229
|
-
|
|
2352
|
+
import_three4.Object3D.DEFAULT_UP.set(0, 0, 1);
|
|
2230
2353
|
function importGroup(group, namespaces, colorLookup, rootBounds) {
|
|
2231
2354
|
let world = {};
|
|
2232
2355
|
let animatables = {};
|
|
@@ -2314,7 +2437,7 @@ function importGroup(group, namespaces, colorLookup, rootBounds) {
|
|
|
2314
2437
|
}
|
|
2315
2438
|
|
|
2316
2439
|
// src/functions/gltf-loading/import-scene.ts
|
|
2317
|
-
|
|
2440
|
+
import_three5.Object3D.DEFAULT_UP.set(0, 0, 1);
|
|
2318
2441
|
function importScene(scene, namespaces, rootBounds) {
|
|
2319
2442
|
let world = {};
|
|
2320
2443
|
let animatables = {};
|
|
@@ -2356,7 +2479,7 @@ function traverseThree(group, namespaces, aggressiveImport = false, rootBounds)
|
|
|
2356
2479
|
loadedData = {
|
|
2357
2480
|
...data,
|
|
2358
2481
|
refs: namespaces.reduce(
|
|
2359
|
-
(acc, ns) => ({ ...acc, [ns]: (0,
|
|
2482
|
+
(acc, ns) => ({ ...acc, [ns]: (0, import_react16.createRef)() }),
|
|
2360
2483
|
{}
|
|
2361
2484
|
)
|
|
2362
2485
|
};
|
|
@@ -2371,7 +2494,7 @@ function traverseThree(group, namespaces, aggressiveImport = false, rootBounds)
|
|
|
2371
2494
|
...data,
|
|
2372
2495
|
geometry: child.geometry,
|
|
2373
2496
|
refs: namespaces.reduce(
|
|
2374
|
-
(acc, ns) => ({ ...acc, [ns]: (0,
|
|
2497
|
+
(acc, ns) => ({ ...acc, [ns]: (0, import_react16.createRef)() }),
|
|
2375
2498
|
{}
|
|
2376
2499
|
)
|
|
2377
2500
|
};
|
|
@@ -2385,7 +2508,7 @@ function traverseThree(group, namespaces, aggressiveImport = false, rootBounds)
|
|
|
2385
2508
|
loadedData = {
|
|
2386
2509
|
...data,
|
|
2387
2510
|
refs: namespaces.reduce(
|
|
2388
|
-
(acc, ns) => ({ ...acc, [ns]: (0,
|
|
2511
|
+
(acc, ns) => ({ ...acc, [ns]: (0, import_react16.createRef)() }),
|
|
2389
2512
|
{}
|
|
2390
2513
|
)
|
|
2391
2514
|
};
|
|
@@ -2399,7 +2522,7 @@ function traverseThree(group, namespaces, aggressiveImport = false, rootBounds)
|
|
|
2399
2522
|
loadedData = {
|
|
2400
2523
|
...data,
|
|
2401
2524
|
refs: namespaces.reduce(
|
|
2402
|
-
(acc, ns) => ({ ...acc, [ns]: (0,
|
|
2525
|
+
(acc, ns) => ({ ...acc, [ns]: (0, import_react16.createRef)() }),
|
|
2403
2526
|
{}
|
|
2404
2527
|
)
|
|
2405
2528
|
};
|
|
@@ -2585,9 +2708,10 @@ function deriveRootBounds(group) {
|
|
|
2585
2708
|
}
|
|
2586
2709
|
|
|
2587
2710
|
// src/functions/vizij-bundle.ts
|
|
2711
|
+
var import_utils7 = require("@vizij/utils");
|
|
2588
2712
|
var BUNDLE_KEYS = ["VIZIJ_bundle"];
|
|
2589
2713
|
function cloneBundle(value) {
|
|
2590
|
-
return
|
|
2714
|
+
return (0, import_utils7.cloneDeepSafe)(value);
|
|
2591
2715
|
}
|
|
2592
2716
|
function readExtensionValue(extensionContainer) {
|
|
2593
2717
|
for (const key of BUNDLE_KEYS) {
|
|
@@ -2685,6 +2809,7 @@ function applyVizijBundle(object, bundle) {
|
|
|
2685
2809
|
}
|
|
2686
2810
|
|
|
2687
2811
|
// src/functions/gltf-loading/extract-animations.ts
|
|
2812
|
+
var import_utils8 = require("@vizij/utils");
|
|
2688
2813
|
var CHANNEL_PATH_TO_TRACK_PROPERTY = {
|
|
2689
2814
|
translation: "position",
|
|
2690
2815
|
rotation: "quaternion",
|
|
@@ -2700,7 +2825,7 @@ function clonePlainObject(value) {
|
|
|
2700
2825
|
if (!value) {
|
|
2701
2826
|
return void 0;
|
|
2702
2827
|
}
|
|
2703
|
-
return
|
|
2828
|
+
return (0, import_utils8.cloneDeepSafe)(value);
|
|
2704
2829
|
}
|
|
2705
2830
|
function inferValueSize(valueType) {
|
|
2706
2831
|
switch (valueType) {
|