@vincentt-xr/sdk 2.0.0-alpha.0 → 2.0.0-alpha.2
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/GROUNDING.md +1813 -27
- package/dist/{DebuggerUI-CEfdddkZ.cjs → DebuggerUI-B45_Gb9d.cjs} +1 -1
- package/dist/{DebuggerUI-Dgop6Q6o.js → DebuggerUI-Cq28c18s.js} +1 -1
- package/dist/FaceMeshRenderer-6t8OsQhK.js +1195 -0
- package/dist/FaceMeshRenderer-lQLhYIW-.cjs +155 -0
- package/dist/FaceRetouch-CDrL0pXg.js +551 -0
- package/dist/FaceRetouch-DtNl8-4e.cjs +134 -0
- package/dist/audio/AudioEngine.d.ts +3 -1
- package/dist/audio/AudioPlayer.d.ts +29 -0
- package/dist/audio/AudioPlayerLogic.d.ts +4 -0
- package/dist/audio/index.d.ts +2 -0
- package/dist/components/Axes/index.d.ts +6 -0
- package/dist/components/FaceMesh/FaceMeshRenderer.d.ts +17 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +22 -1
- package/dist/components/FaceMesh/canonical/FaceMeshMaterial.d.ts +25 -0
- package/dist/components/FaceMesh/canonical/assets.d.ts +3 -0
- package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +9 -0
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +2 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +2 -0
- package/dist/components/FaceMesh/deform.d.ts +3 -0
- package/dist/components/FaceMesh/index.d.ts +5 -0
- package/dist/components/FaceMesh/material/defaults.d.ts +74 -0
- package/dist/components/FaceMesh/material/index.d.ts +1 -0
- package/dist/components/FaceMesh/material/options.d.ts +5 -1
- package/dist/components/FaceMesh/material/support.d.ts +7 -2
- package/dist/components/FaceMesh/material/textures.d.ts +4 -0
- package/dist/components/FaceMesh/material/types.d.ts +4 -2
- package/dist/components/FaceRetouch/Background.d.ts +9 -5
- package/dist/components/FaceRetouch/FaceRetouch.d.ts +47 -0
- package/dist/components/FaceRetouch/index.d.ts +2 -6
- package/dist/components/FaceRetouch/landmarkMask.d.ts +4 -6
- package/dist/components/FaceRetouch/useFaceRetouchMask.d.ts +4 -7
- package/dist/components/FaceTracker/index.d.ts +5 -3
- package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +15 -0
- package/dist/components/FaceWarp3D/defaults.d.ts +37 -0
- package/dist/components/FaceWarp3D/index.d.ts +3 -0
- package/dist/components/FaceWarp3D/warp.d.ts +13 -0
- package/dist/components/HandJoints2D/index.d.ts +6 -0
- package/dist/components/HandTracker/index.d.ts +2 -2
- package/dist/components/HandTracking2D/HandVisual.d.ts +12 -0
- package/dist/components/HandTracking2D/index.d.ts +5 -0
- package/dist/components/HandTracking2DController/index.d.ts +5 -0
- package/dist/components/HandTracking3D/index.d.ts +6 -0
- package/dist/components/LightObject/index.d.ts +20 -0
- package/dist/components/LookAt/index.d.ts +23 -0
- package/dist/components/MeshRenderer/index.d.ts +58 -0
- package/dist/components/PerspectiveCamera/index.d.ts +2 -8
- package/dist/components/PinToMesh/index.d.ts +47 -0
- package/dist/components/RenderGroupLayer/index.d.ts +6 -0
- package/dist/components/SceneObjectRenderer/index.d.ts +16 -0
- package/dist/components/Screen2D/ScreenTransformFrame.d.ts +11 -0
- package/dist/components/Screen2D/ScreenTransformHelpers.d.ts +19 -0
- package/dist/components/Screen2D/ScreenTransformInteraction.d.ts +18 -0
- package/dist/components/Screen2D/index.d.ts +5 -0
- package/dist/components/ScreenGlass/defaults.d.ts +3 -0
- package/dist/components/ScreenGlass/index.d.ts +5 -0
- package/dist/components/ScreenGlass/shaders.d.ts +2 -0
- package/dist/components/ScreenGlass/types.d.ts +10 -0
- package/dist/components/ScreenGradient/defaults.d.ts +5 -0
- package/dist/components/ScreenGradient/index.d.ts +5 -0
- package/dist/components/ScreenGradient/shaders.d.ts +2 -0
- package/dist/components/ScreenGradient/types.d.ts +19 -0
- package/dist/components/ScreenImage/ScreenImage.d.ts +4 -0
- package/dist/components/ScreenImage/components/DynamicTextureSync.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageFrame.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageTransformFrame.d.ts +9 -0
- package/dist/components/ScreenImage/fit.d.ts +52 -0
- package/dist/components/ScreenImage/index.d.ts +8 -0
- package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +9 -0
- package/dist/components/ScreenImage/materials/ScreenImageMatcap.d.ts +3 -0
- package/dist/components/ScreenImage/source.d.ts +16 -0
- package/dist/components/ScreenImage/types.d.ts +37 -0
- package/dist/components/ScreenImage/utils/ScreenImageConstants.d.ts +9 -0
- package/dist/components/ScreenImage/utils/ScreenImageHelpers.d.ts +4 -0
- package/dist/components/ScreenShape/geometry.d.ts +5 -0
- package/dist/components/ScreenShape/index.d.ts +5 -0
- package/dist/components/ScreenShape/types.d.ts +41 -0
- package/dist/components/ScreenSpaceUI/ScreenTransformGuide.d.ts +15 -0
- package/dist/components/ScreenSpaceUI/ScreenTransformOverlayGuide.d.ts +9 -0
- package/dist/components/ScreenSpaceUI/index.d.ts +2 -0
- package/dist/components/ScreenText/components/ScreenTextBody.d.ts +2 -0
- package/dist/components/ScreenText/components/ScreenTextTransformFrame.d.ts +9 -0
- package/dist/components/ScreenText/constants.d.ts +5 -0
- package/dist/components/ScreenText/index.d.ts +6 -0
- package/dist/components/ScreenText/types.d.ts +31 -0
- package/dist/components/ScreenText/utils/ScreenTextHelpers.d.ts +14 -0
- package/dist/components/ScreenText/utils/ScreenTextMappings.d.ts +17 -0
- package/dist/components/SequentialRenderPasses/index.d.ts +6 -0
- package/dist/components/TextLabel/TextLabel.d.ts +5 -0
- package/dist/components/TextLabel/alignment.d.ts +4 -0
- package/dist/components/TextLabel/bend.d.ts +9 -0
- package/dist/components/TextLabel/canvas/buildTextLabelTexture.d.ts +4 -0
- package/dist/components/TextLabel/canvas/canvasTypography.d.ts +13 -0
- package/dist/components/TextLabel/canvas/drawBackground.d.ts +21 -0
- package/dist/components/TextLabel/canvas/drawEffects.d.ts +34 -0
- package/dist/components/TextLabel/canvas/drawText.d.ts +19 -0
- package/dist/components/TextLabel/components/TextLabelMesh.d.ts +13 -0
- package/dist/components/TextLabel/constants.d.ts +2 -0
- package/dist/components/TextLabel/hooks/useTextLabelTexture.d.ts +7 -0
- package/dist/components/TextLabel/index.d.ts +2 -62
- package/dist/components/TextLabel/layout/measurement.d.ts +8 -0
- package/dist/components/TextLabel/layout/resolveTextLayout.d.ts +25 -0
- package/dist/components/TextLabel/layout/wrapText.d.ts +6 -0
- package/dist/components/TextLabel/types.d.ts +227 -0
- package/dist/components/TrackingAnchor/index.d.ts +18 -2
- package/dist/components/Transform3D/index.d.ts +30 -0
- package/dist/components/XRMediaSurface/index.d.ts +6 -6
- package/dist/components/XRScene/index.d.ts +14 -3
- package/dist/components/XRViewport/XRViewport.d.ts +11 -0
- package/dist/components/XRViewport/components/HiddenMedia.d.ts +7 -0
- package/dist/components/XRViewport/components/MediaAssetPicker.d.ts +8 -0
- package/dist/components/XRViewport/components/MediaControlStack.d.ts +13 -0
- package/dist/components/XRViewport/components/XRViewportLayers.d.ts +30 -0
- package/dist/components/XRViewport/constants.d.ts +24 -0
- package/dist/components/XRViewport/contexts.d.ts +6 -0
- package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +13 -0
- package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +16 -0
- package/dist/components/XRViewport/hooks/useViewportMediaTexture.d.ts +10 -0
- package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +41 -0
- package/dist/components/XRViewport/hooks/useViewportRenderState.d.ts +47 -0
- package/dist/components/XRViewport/index.d.ts +3 -101
- package/dist/components/XRViewport/layout.d.ts +16 -0
- package/dist/components/XRViewport/slots.d.ts +16 -0
- package/dist/components/XRViewport/types.d.ts +89 -0
- package/dist/components/XRViewport/useViewportSize.d.ts +3 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/contexts-BKvTIayr.cjs +1 -0
- package/dist/contexts-Bk5zz_VR.js +214 -0
- package/dist/debug-ui/component-editor/index.d.ts +19 -0
- package/dist/debug-ui/default-setting/index.d.ts +37 -0
- package/dist/debug-ui/default-setting.cjs +21 -0
- package/dist/debug-ui/default-setting.js +777 -0
- package/dist/debug-ui/face-mesh-renderer-settings/index.d.ts +8 -0
- package/dist/debug-ui/face-retouch/index.d.ts +11 -0
- package/dist/debug-ui/face-warp-3d/index.d.ts +6 -0
- package/dist/debug-ui/hand-joints-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d-controller/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-3d/index.d.ts +6 -0
- package/dist/debug-ui/hierarchy-panel/index.d.ts +29 -0
- package/dist/debug-ui/index.d.ts +46 -0
- package/dist/debug-ui/layer-panel/index.d.ts +18 -0
- package/dist/debug-ui/media-source/MediaSourceSwitcher.d.ts +10 -0
- package/dist/debug-ui/media-source/index.d.ts +6 -0
- package/dist/debug-ui/media-source/media-preset.d.ts +9 -0
- package/dist/debug-ui/media-source/session.d.ts +12 -0
- package/dist/debug-ui/media-source.cjs +1 -0
- package/dist/debug-ui/media-source.js +9 -0
- package/dist/debug-ui/mesh-renderer-settings/index.d.ts +6 -0
- package/dist/debug-ui/object-inspector-panel/index.d.ts +25 -0
- package/dist/debug-ui/pin-to-mesh-settings/index.d.ts +10 -0
- package/dist/debug-ui/scene-editor/context.d.ts +38 -0
- package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +9 -0
- package/dist/debug-ui/scene-editor/index.d.ts +11 -0
- package/dist/debug-ui/scene-editor/inspector-panel.d.ts +7 -0
- package/dist/debug-ui/scene-editor/store-utils.d.ts +2 -0
- package/dist/debug-ui/scene-editor/viewport-toolbar.d.ts +4 -0
- package/dist/debug-ui/scene-editor/viewport.d.ts +21 -0
- package/dist/debug-ui/screen-glass-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-gradient-settings/GradientStopsEditor.d.ts +5 -0
- package/dist/debug-ui/screen-gradient-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-gradient-settings/styles.d.ts +3 -0
- package/dist/debug-ui/screen-image-settings/index.d.ts +9 -0
- package/dist/debug-ui/screen-shape-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-text-settings/NumberField.d.ts +9 -0
- package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +3 -0
- package/dist/debug-ui/screen-text-settings/controls/NestedSection.d.ts +7 -0
- package/dist/debug-ui/screen-text-settings/controls/Section.d.ts +8 -0
- package/dist/debug-ui/screen-text-settings/controls/icons.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/index.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/BackgroundSection.d.ts +8 -0
- package/dist/debug-ui/screen-text-settings/sections/ContentSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/EffectsSection.d.ts +25 -0
- package/dist/debug-ui/screen-text-settings/sections/StyleSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/TransformSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundFillControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundSizeControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundStrokeControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/types.d.ts +7 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/BendEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/EffectChrome.d.ts +21 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/GlowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/InnerShadowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/OutlineEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/ShadowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/types.d.ts +14 -0
- package/dist/debug-ui/screen-text-settings/settings.d.ts +90 -0
- package/dist/debug-ui/screen-text-settings/styles.d.ts +26 -0
- package/dist/debug-ui/screen-text-settings/transform.d.ts +6 -0
- package/dist/debug-ui/screen-text-settings/types.d.ts +9 -0
- package/dist/debug-ui/settings-panel/index.d.ts +38 -0
- package/dist/debug-ui/shared/MaterialSection.d.ts +13 -0
- package/dist/debug-ui/shared/ScreenTransformSection.d.ts +32 -0
- package/dist/debug-ui/transform-3d-settings/index.d.ts +11 -0
- package/dist/debug-ui.cjs +10 -0
- package/dist/debug-ui.js +8861 -0
- package/dist/drawNormalizedCrop-B-7zU-Xw.cjs +1 -0
- package/dist/drawNormalizedCrop-CRdIDyl1.js +44 -0
- package/dist/entries/all.d.ts +1 -0
- package/dist/entries/core.d.ts +55 -4
- package/dist/entries/face-effects.d.ts +12 -8
- package/dist/entries/internal.d.ts +1 -1
- package/dist/entries/low-level.d.ts +21 -4
- package/dist/entries/scene-object.d.ts +10 -0
- package/dist/entries/tracking.d.ts +25 -2
- package/dist/face-action/index.d.ts +34 -0
- package/dist/face-attribute-expression/index.d.ts +10 -0
- package/dist/face-effects.cjs +1 -252
- package/dist/face-effects.js +1404 -2613
- package/dist/face-info/blendshapes.d.ts +3 -0
- package/dist/face-info/derive.d.ts +8 -0
- package/dist/face-info/drawFaceCrop.d.ts +10 -0
- package/dist/face-info/getFaceInfo.d.ts +8 -0
- package/dist/face-info/index.d.ts +8 -0
- package/dist/face-info/landmarks.d.ts +21 -0
- package/dist/face-info/types.d.ts +52 -0
- package/dist/getFaceInfo-CyPAKh3h.cjs +1 -0
- package/dist/getFaceInfo-hUKMLFcr.js +118 -0
- package/dist/hand/handJoints2d.d.ts +49 -0
- package/dist/hand/handTracking2d.d.ts +33 -0
- package/dist/hand/handTracking2dController.d.ts +65 -0
- package/dist/hand/handTracking3d.d.ts +52 -0
- package/dist/hooks/faceResults.d.ts +1 -1
- package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
- package/dist/hooks/useFaceAction.d.ts +3 -0
- package/dist/hooks/useFaceAttributeExpression.d.ts +16 -0
- package/dist/hooks/useFaceDetection.d.ts +18 -0
- package/dist/hooks/useFaceInfo.d.ts +7 -0
- package/dist/hooks/useFaceInfos.d.ts +15 -0
- package/dist/hooks/useFaceResultReader.d.ts +10 -0
- package/dist/hooks/useFrameCapture.d.ts +18 -0
- package/dist/hooks/useMediaRecorder.d.ts +14 -2
- package/dist/hooks/useOwnedTexture.d.ts +6 -0
- package/dist/hooks/useTrackerContext.d.ts +2 -2
- package/dist/hooks/useXRSession/facade.d.ts +3 -0
- package/dist/hooks/useXRSession/registry.d.ts +9 -0
- package/dist/index-82aENaRq.cjs +1 -0
- package/dist/{index-BD-JWMjE.js → index-BgQAX8rs.js} +198 -134
- package/dist/index-CEc1CAmB.cjs +1 -0
- package/dist/index-CTHeBQOs.js +178 -0
- package/dist/index-D4bLzBr6.cjs +1 -0
- package/dist/index-DSpzjuqd.cjs +1 -0
- package/dist/index-Di70KWuY.js +2049 -0
- package/dist/index-DzEzkBIH.cjs +17 -0
- package/dist/{index-CYMj26Ej.js → index-JygePOwo.js} +565 -498
- package/dist/index-UC0Ux38E.js +111 -0
- package/dist/{internal-KOKJDxCG.js → internal-DuMPpcbp.js} +86 -80
- package/dist/internal-i2JkM85N.cjs +1 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +959 -632
- package/dist/main.cjs +1 -1
- package/dist/main.js +556 -455
- package/dist/material/MaterialFill.d.ts +20 -0
- package/dist/material/MeshMaterial.d.ts +14 -0
- package/dist/material/index.d.ts +2 -0
- package/dist/models/Body/index.d.ts +1 -1
- package/dist/models/Face/index.d.ts +1 -0
- package/dist/models/Face/rotation.d.ts +3 -0
- package/dist/models/Hand/HandTracking.d.ts +2 -0
- package/dist/render/layerStack.d.ts +29 -0
- package/dist/render/renderGroups.d.ts +47 -0
- package/dist/render/renderPasses.d.ts +18 -0
- package/dist/renderGroups-C9QJrAXu.js +152 -0
- package/dist/renderGroups-Dvm1J4lW.cjs +1 -0
- package/dist/renderLayers-lDtL0_43.cjs +1 -0
- package/dist/renderLayers-zrK2pv5O.js +13 -0
- package/dist/renderPasses-CT5iBwtg.cjs +21 -0
- package/dist/renderPasses-CjgG_6kQ.js +1500 -0
- package/dist/scene-object/index.d.ts +146 -0
- package/dist/scene-object/runtimeRegistry.d.ts +14 -0
- package/dist/scene-object.cjs +1 -0
- package/dist/scene-object.js +40 -0
- package/dist/screen-image/screenImagePresets.d.ts +13 -0
- package/dist/screen-image/screenImageSettings.d.ts +57 -0
- package/dist/screen-text/screenTextPresets.d.ts +6 -0
- package/dist/screen-text/screenTextSettings.d.ts +147 -0
- package/dist/screen2d/coordinates.d.ts +87 -0
- package/dist/screen2d/index.d.ts +7 -0
- package/dist/screen2d/material-runtime.d.ts +32 -0
- package/dist/screen2d/screenTransform.d.ts +47 -0
- package/dist/screen2d/smoothing.d.ts +5 -0
- package/dist/screen2d/texture.d.ts +10 -0
- package/dist/screen2d/transform.d.ts +25 -0
- package/dist/screen2d/types.d.ts +90 -0
- package/dist/{selectors-Bub0o3qy.cjs → selectors-2QvO5RYY.cjs} +1 -1
- package/dist/{selectors-BHO6TnoC.js → selectors-Dw3C-gSk.js} +5 -5
- package/dist/services/MetricsCollector/index.d.ts +7 -1
- package/dist/services/MetricsCollector/utils.d.ts +1 -1
- package/dist/session-BChR4TgK.cjs +31 -0
- package/dist/session-C1StwN0f.js +363 -0
- package/dist/texture/animatedTexture.d.ts +61 -0
- package/dist/texture/animationMath.d.ts +8 -0
- package/dist/texture/sourceResolver.d.ts +30 -0
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +582 -298
- package/dist/types/face.d.ts +1 -13
- package/dist/types/hand-tracking.d.ts +8 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/nodes.d.ts +4 -1
- package/dist/types/session.d.ts +2 -0
- package/dist/types/tracking.d.ts +8 -2
- package/dist/types/util-types.d.ts +1 -1
- package/dist/useFaceInfo-C-WfMlYp.cjs +1 -0
- package/dist/useFaceInfo-CwsHZedC.js +62 -0
- package/dist/useFaceResults-CkFc1egZ.js +19 -0
- package/dist/useFaceResults-VcFdOUFV.cjs +1 -0
- package/dist/utils/drawNormalizedCrop.d.ts +22 -0
- package/dist/utils/integrity.d.ts +4 -25
- package/dist/utils/landmarkBounds.d.ts +1 -1
- package/dist/utils/logger.d.ts +2 -2
- package/dist/x-Co8jPhP0.js +127 -0
- package/dist/x-KC8E4Gaj.cjs +41 -0
- package/docs/MIGRATION_GUIDE.md +589 -0
- package/docs/SDK_DOCUMENTATION.md +1155 -0
- package/docs/api/audio.mdx +36 -0
- package/docs/api/behavior-components.mdx +164 -0
- package/docs/api/capture-recording.mdx +103 -0
- package/docs/api/debug-ui-scene-editor.mdx +249 -0
- package/docs/api/face-actions.mdx +104 -0
- package/docs/api/face-attribute-expression.mdx +87 -0
- package/docs/api/face-binding-anchors.mdx +53 -0
- package/docs/api/face-effects.mdx +19 -0
- package/docs/api/face-info.mdx +112 -0
- package/docs/api/face-mesh.mdx +98 -0
- package/docs/api/face-painting.mdx +33 -0
- package/docs/api/face-retouching.mdx +73 -0
- package/docs/api/material-render-state.mdx +132 -0
- package/docs/api/runtime-3d.mdx +311 -0
- package/docs/api/scene-object-store.mdx +213 -0
- package/docs/api/screen-image.mdx +41 -0
- package/docs/api/screen-shape.mdx +64 -0
- package/docs/api/screen-space-coordinates.mdx +41 -0
- package/docs/api/screen-text.mdx +39 -0
- package/docs/api/texture-sources.mdx +55 -0
- package/docs/api/trackers.mdx +46 -0
- package/docs/docs.json +70 -0
- package/docs/examples/scene-object-recipes.mdx +194 -0
- package/docs/guides/harness-debug-ui.mdx +139 -0
- package/docs/inspector/hierarchy-panel.mdx +51 -0
- package/docs/inspector/object-inspector-panel.mdx +51 -0
- package/docs/introduction.mdx +121 -0
- package/docs/scene-objects/overview.mdx +127 -0
- package/docs/scene-objects/render-groups.mdx +77 -0
- package/docs/scene-objects/runtime-rendering.mdx +75 -0
- package/docs/texture-api-consumer.md +58 -0
- package/package.json +55 -7
- package/dist/components/FaceRetouch/retouchRegions.d.ts +0 -23
- package/dist/components/FaceRetouch/useFaceRetouchRegions.d.ts +0 -12
- package/dist/index-B5J4gzn2.cjs +0 -1
- package/dist/index-BVBVg96G.cjs +0 -1
- package/dist/index-DtwHElmG.js +0 -157
- package/dist/index-PtFmD6B8.cjs +0 -1
- package/dist/internal-DH5d1Xnq.cjs +0 -1
- package/dist/modules/XRClient/index.d.ts +0 -9
- package/dist/modules/index.d.ts +0 -1
- package/dist/services/ApiService.d.ts +0 -12
- package/dist/types/client.d.ts +0 -3
- package/dist/useFaceResults-cpsSmKKc.js +0 -81
- package/dist/useFaceResults-hVUJYSEY.cjs +0 -1
|
@@ -0,0 +1,1500 @@
|
|
|
1
|
+
import { u as Ee, S as ze, a as Pe, D as Re } from "./index-CTHeBQOs.js";
|
|
2
|
+
import { useThree as xe, useFrame as Oe } from "@react-three/fiber";
|
|
3
|
+
import { useRef as W, useState as De, useCallback as U, useEffect as k, useMemo as G, createElement as Le } from "react";
|
|
4
|
+
import * as ce from "three";
|
|
5
|
+
import { Vector2 as K, Vector3 as z, Box3 as Ae, Matrix4 as B, Quaternion as Y, Euler as H, MathUtils as L, Color as Ce } from "three";
|
|
6
|
+
import { e as Fe } from "./index-JygePOwo.js";
|
|
7
|
+
import { D as _e } from "./index-UC0Ux38E.js";
|
|
8
|
+
import { w as Ie, x as je, M as We, a as Ge, A as Ne } from "./FaceMeshRenderer-6t8OsQhK.js";
|
|
9
|
+
import { jsxs as O, jsx as u } from "react/jsx-runtime";
|
|
10
|
+
import { Line as Ue } from "@react-three/drei";
|
|
11
|
+
const he = {
|
|
12
|
+
move: "grab",
|
|
13
|
+
pivot: "all-scroll",
|
|
14
|
+
rotateTopLeft: "alias",
|
|
15
|
+
rotateTopRight: "alias",
|
|
16
|
+
rotateBottomLeft: "alias",
|
|
17
|
+
rotateBottomRight: "alias",
|
|
18
|
+
top: "ns-resize",
|
|
19
|
+
bottom: "ns-resize",
|
|
20
|
+
left: "ew-resize",
|
|
21
|
+
right: "ew-resize",
|
|
22
|
+
topLeft: "nwse-resize",
|
|
23
|
+
bottomRight: "nwse-resize",
|
|
24
|
+
topRight: "nesw-resize",
|
|
25
|
+
bottomLeft: "nesw-resize"
|
|
26
|
+
}, ke = ({
|
|
27
|
+
color: e = "#22d3ee",
|
|
28
|
+
controlScale: t = [1, 1, 1],
|
|
29
|
+
handleColor: o = "#ffffff",
|
|
30
|
+
onHandlePointerDown: n,
|
|
31
|
+
opacity: i = 0.9,
|
|
32
|
+
pivot: r = [0.5, 0.5],
|
|
33
|
+
pivotScale: a = t,
|
|
34
|
+
renderOrder: s,
|
|
35
|
+
showSideHandles: l = !0,
|
|
36
|
+
thickness: d = 4e-3
|
|
37
|
+
}) => {
|
|
38
|
+
const f = /* @__PURE__ */ u(
|
|
39
|
+
"meshBasicMaterial",
|
|
40
|
+
{
|
|
41
|
+
color: e,
|
|
42
|
+
transparent: !0,
|
|
43
|
+
opacity: i,
|
|
44
|
+
depthTest: !1,
|
|
45
|
+
depthWrite: !1,
|
|
46
|
+
toneMapped: !1
|
|
47
|
+
}
|
|
48
|
+
), y = /* @__PURE__ */ u(
|
|
49
|
+
"meshBasicMaterial",
|
|
50
|
+
{
|
|
51
|
+
color: o,
|
|
52
|
+
transparent: !0,
|
|
53
|
+
opacity: 1,
|
|
54
|
+
depthTest: !1,
|
|
55
|
+
depthWrite: !1,
|
|
56
|
+
toneMapped: !1
|
|
57
|
+
}
|
|
58
|
+
), w = Math.max(d * 7, 0.028), b = Math.max(d * 7, 0.03), M = Math.max(d * 8, 0.032), h = 0.04, c = 0.06, x = 0.08, g = 0.1, p = s ?? 0, C = [
|
|
59
|
+
["topLeft", -0.5, 0.5],
|
|
60
|
+
["topRight", 0.5, 0.5],
|
|
61
|
+
["bottomLeft", -0.5, -0.5],
|
|
62
|
+
["bottomRight", 0.5, -0.5],
|
|
63
|
+
...l ? [
|
|
64
|
+
["top", 0, 0.5],
|
|
65
|
+
["bottom", 0, -0.5],
|
|
66
|
+
["left", -0.5, 0],
|
|
67
|
+
["right", 0.5, 0]
|
|
68
|
+
] : []
|
|
69
|
+
], E = [
|
|
70
|
+
["rotateTopLeft", -0.56, 0.56, 0],
|
|
71
|
+
["rotateTopRight", 0.56, 0.56, -Math.PI / 2],
|
|
72
|
+
["rotateBottomRight", 0.56, -0.56, Math.PI],
|
|
73
|
+
["rotateBottomLeft", -0.56, -0.56, Math.PI / 2]
|
|
74
|
+
], S = (m) => n ? (R) => {
|
|
75
|
+
R.stopPropagation(), document.body.style.cursor = m === "move" ? "grabbing" : he[m], n(m, R);
|
|
76
|
+
} : void 0, v = (m) => {
|
|
77
|
+
n && (document.body.style.cursor = he[m]);
|
|
78
|
+
}, P = () => {
|
|
79
|
+
n && (document.body.style.cursor = "");
|
|
80
|
+
}, T = [r[0] - 0.5, r[1] - 0.5, g];
|
|
81
|
+
return /* @__PURE__ */ O("group", { renderOrder: p, children: [
|
|
82
|
+
/* @__PURE__ */ O("mesh", { position: [0, 0.5, h], scale: [1, d, 1], renderOrder: p, children: [
|
|
83
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
84
|
+
f
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ O("mesh", { position: [0, -0.5, h], scale: [1, d, 1], renderOrder: p, children: [
|
|
87
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
88
|
+
f
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ O("mesh", { position: [-0.5, 0, h], scale: [d, 1, 1], renderOrder: p, children: [
|
|
91
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
92
|
+
f
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ O("mesh", { position: [0.5, 0, h], scale: [d, 1, 1], renderOrder: p, children: [
|
|
95
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
96
|
+
f
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ O(
|
|
99
|
+
"mesh",
|
|
100
|
+
{
|
|
101
|
+
position: [0, 0, c],
|
|
102
|
+
renderOrder: p + 1,
|
|
103
|
+
onPointerDown: S("move"),
|
|
104
|
+
onPointerOver: () => v("move"),
|
|
105
|
+
onPointerOut: P,
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
108
|
+
/* @__PURE__ */ u("meshBasicMaterial", { transparent: !0, opacity: 0, depthTest: !1, depthWrite: !1 })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
C.map(([m, R, F]) => /* @__PURE__ */ O(
|
|
113
|
+
"mesh",
|
|
114
|
+
{
|
|
115
|
+
position: [R, F, x],
|
|
116
|
+
scale: [w * t[0], w * t[1], t[2]],
|
|
117
|
+
renderOrder: p + 2,
|
|
118
|
+
onPointerDown: S(m),
|
|
119
|
+
onPointerOver: () => v(m),
|
|
120
|
+
onPointerOut: P,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
123
|
+
y
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
m
|
|
127
|
+
)),
|
|
128
|
+
E.map(([m, R, F, V]) => /* @__PURE__ */ u(
|
|
129
|
+
"group",
|
|
130
|
+
{
|
|
131
|
+
position: [R, F, x + 0.01],
|
|
132
|
+
rotation: [0, 0, V],
|
|
133
|
+
scale: [M * t[0], M * t[1], t[2]],
|
|
134
|
+
renderOrder: p + 3,
|
|
135
|
+
onPointerDown: S(m),
|
|
136
|
+
onPointerOver: () => v(m),
|
|
137
|
+
onPointerOut: P,
|
|
138
|
+
children: /* @__PURE__ */ O("mesh", { renderOrder: p + 3, children: [
|
|
139
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1.9, 1.9] }),
|
|
140
|
+
/* @__PURE__ */ u("meshBasicMaterial", { transparent: !0, opacity: 0, depthTest: !1, depthWrite: !1 })
|
|
141
|
+
] })
|
|
142
|
+
},
|
|
143
|
+
m
|
|
144
|
+
)),
|
|
145
|
+
/* @__PURE__ */ u(
|
|
146
|
+
"group",
|
|
147
|
+
{
|
|
148
|
+
position: T,
|
|
149
|
+
scale: [b * a[0], b * a[1], a[2]],
|
|
150
|
+
renderOrder: p + 5,
|
|
151
|
+
onPointerDown: S("pivot"),
|
|
152
|
+
onPointerOver: () => v("pivot"),
|
|
153
|
+
onPointerOut: P,
|
|
154
|
+
children: /* @__PURE__ */ O("group", { rotation: [0, 0, Math.PI / 4], children: [
|
|
155
|
+
/* @__PURE__ */ O("mesh", { scale: [1.8, 1.8, 1], renderOrder: p + 5, children: [
|
|
156
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
157
|
+
/* @__PURE__ */ u("meshBasicMaterial", { transparent: !0, opacity: 0, depthTest: !1, depthWrite: !1 })
|
|
158
|
+
] }),
|
|
159
|
+
/* @__PURE__ */ O("mesh", { position: [0, 0, 2e-3], renderOrder: p + 6, children: [
|
|
160
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
161
|
+
y
|
|
162
|
+
] }),
|
|
163
|
+
/* @__PURE__ */ O("mesh", { scale: [0.62, 0.62, 1], position: [0, 0, 4e-3], renderOrder: p + 7, children: [
|
|
164
|
+
/* @__PURE__ */ u("planeGeometry", { args: [1, 1] }),
|
|
165
|
+
/* @__PURE__ */ u(
|
|
166
|
+
"meshBasicMaterial",
|
|
167
|
+
{
|
|
168
|
+
color: "#111827",
|
|
169
|
+
transparent: !0,
|
|
170
|
+
opacity: 1,
|
|
171
|
+
depthTest: !1,
|
|
172
|
+
depthWrite: !1,
|
|
173
|
+
toneMapped: !1
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
] })
|
|
177
|
+
] })
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] });
|
|
181
|
+
}, A = {
|
|
182
|
+
width: 720,
|
|
183
|
+
height: 1280
|
|
184
|
+
}, q = 32, Xe = 0.5, j = {
|
|
185
|
+
enabled: !0,
|
|
186
|
+
position: { x: 0, y: 0 },
|
|
187
|
+
size: { width: 680, height: 1230 },
|
|
188
|
+
pivot: [0.5, 0.5],
|
|
189
|
+
rotation: 0,
|
|
190
|
+
scale2D: { x: 1, y: 1 },
|
|
191
|
+
referencePixelsPerUnit: q,
|
|
192
|
+
renderOrder: 999,
|
|
193
|
+
overlay: !0,
|
|
194
|
+
visible: !0,
|
|
195
|
+
showTransformGuides: !1
|
|
196
|
+
}, Be = Math.PI / 180, ue = (e, t) => t <= 0 ? e : Math.round(e / t) * t, pe = ({
|
|
197
|
+
transform: e,
|
|
198
|
+
parentSize: t,
|
|
199
|
+
root: o = A,
|
|
200
|
+
snapIncrement: n = Xe
|
|
201
|
+
}) => {
|
|
202
|
+
const r = Math.min(t.width / o.width, t.height / o.height) * (q / e.referencePixelsPerUnit), a = e.size.width * e.scale2D.x * r, s = e.size.height * e.scale2D.y * r, l = ue(e.position.x, n) * r, d = ue(e.position.y, n) * r, f = (e.pivot[0] - 0.5) * a, y = (e.pivot[1] - 0.5) * s;
|
|
203
|
+
return {
|
|
204
|
+
center: [l - f, d - y, 0],
|
|
205
|
+
size: [a, s, 1],
|
|
206
|
+
rotation: [0, 0, e.rotation * Be],
|
|
207
|
+
pivotOffset: [f / Math.max(a, 1e-6), y / Math.max(s, 1e-6), 0],
|
|
208
|
+
aspect: a > 0 && s > 0 ? Math.abs(a / s) : 1
|
|
209
|
+
};
|
|
210
|
+
}, Ye = (e) => ({
|
|
211
|
+
...j,
|
|
212
|
+
...e,
|
|
213
|
+
position: { ...j.position, ...e == null ? void 0 : e.position },
|
|
214
|
+
size: { ...j.size, ...e == null ? void 0 : e.size },
|
|
215
|
+
scale2D: { ...j.scale2D, ...e == null ? void 0 : e.scale2D }
|
|
216
|
+
}), _ = (e) => Math.round(e * 2) / 2, me = (e) => Math.min(1, Math.max(0, e)), te = {
|
|
217
|
+
move: "grab",
|
|
218
|
+
pivot: "all-scroll",
|
|
219
|
+
rotateTopLeft: "alias",
|
|
220
|
+
rotateTopRight: "alias",
|
|
221
|
+
rotateBottomLeft: "alias",
|
|
222
|
+
rotateBottomRight: "alias",
|
|
223
|
+
top: "ns-resize",
|
|
224
|
+
bottom: "ns-resize",
|
|
225
|
+
left: "ew-resize",
|
|
226
|
+
right: "ew-resize",
|
|
227
|
+
topLeft: "nwse-resize",
|
|
228
|
+
bottomRight: "nwse-resize",
|
|
229
|
+
topRight: "nesw-resize",
|
|
230
|
+
bottomLeft: "nesw-resize"
|
|
231
|
+
}, $e = [
|
|
232
|
+
["topLeft", 0, 0],
|
|
233
|
+
["top", 0.5, 0],
|
|
234
|
+
["topRight", 1, 0],
|
|
235
|
+
["right", 1, 0.5],
|
|
236
|
+
["bottomRight", 1, 1],
|
|
237
|
+
["bottom", 0.5, 1],
|
|
238
|
+
["bottomLeft", 0, 1],
|
|
239
|
+
["left", 0, 0.5]
|
|
240
|
+
], He = [
|
|
241
|
+
["rotateTopLeft", -0.03, -0.03],
|
|
242
|
+
["rotateTopRight", 1.03, -0.03],
|
|
243
|
+
["rotateBottomRight", 1.03, 1.03],
|
|
244
|
+
["rotateBottomLeft", -0.03, 1.03]
|
|
245
|
+
], qe = (e, t) => {
|
|
246
|
+
const o = pe({
|
|
247
|
+
transform: t,
|
|
248
|
+
parentSize: { width: e.width, height: e.height }
|
|
249
|
+
}), n = Math.min(
|
|
250
|
+
e.width / A.width,
|
|
251
|
+
e.height / A.height
|
|
252
|
+
) * (q / Math.max(t.referencePixelsPerUnit, 1e-6)) || 1, i = A.width * n, r = A.height * n, a = e.left + (e.width - i) / 2, s = e.top + (e.height - r) / 2, l = a + i / 2, d = s + r / 2, f = o.size[0], y = o.size[1], w = l + o.center[0], b = d - o.center[1];
|
|
253
|
+
return {
|
|
254
|
+
centerX: w,
|
|
255
|
+
centerY: b,
|
|
256
|
+
height: y,
|
|
257
|
+
left: w - f / 2,
|
|
258
|
+
scale: n,
|
|
259
|
+
top: b - y / 2,
|
|
260
|
+
width: f
|
|
261
|
+
};
|
|
262
|
+
}, Ve = (e, t, o, n) => {
|
|
263
|
+
const i = A.width * n, r = A.height * n, a = o.left + (o.width - i) / 2, s = o.top + (o.height - r) / 2;
|
|
264
|
+
return {
|
|
265
|
+
x: (e - (a + i / 2)) / n,
|
|
266
|
+
y: (s + r / 2 - t) / n
|
|
267
|
+
};
|
|
268
|
+
}, Ke = ({
|
|
269
|
+
color: e = "#38bdf8",
|
|
270
|
+
handleColor: t = "#ffffff",
|
|
271
|
+
onChange: o,
|
|
272
|
+
transform: n
|
|
273
|
+
}) => {
|
|
274
|
+
const i = W(o);
|
|
275
|
+
i.current = o;
|
|
276
|
+
const { gl: r } = xe(), [a, s] = De(null), l = W(null), d = W(null), f = U(() => {
|
|
277
|
+
s(r.domElement.getBoundingClientRect());
|
|
278
|
+
}, [r.domElement]);
|
|
279
|
+
k(() => (f(), window.addEventListener("resize", f), window.addEventListener("scroll", f, !0), () => {
|
|
280
|
+
window.removeEventListener("resize", f), window.removeEventListener("scroll", f, !0);
|
|
281
|
+
}), [f]);
|
|
282
|
+
const y = G(
|
|
283
|
+
() => a ? qe(a, n) : null,
|
|
284
|
+
[a, n]
|
|
285
|
+
), w = U((h) => {
|
|
286
|
+
const c = l.current, x = i.current;
|
|
287
|
+
if (!c || !x) return;
|
|
288
|
+
const g = (h.clientX - c.startX) / c.scale, p = -(h.clientY - c.startY) / c.scale, C = {
|
|
289
|
+
x: c.startPointerDesign.x + g,
|
|
290
|
+
y: c.startPointerDesign.y + p
|
|
291
|
+
}, E = {
|
|
292
|
+
...c.startTransform,
|
|
293
|
+
position: { ...c.startTransform.position },
|
|
294
|
+
size: { ...c.startTransform.size },
|
|
295
|
+
pivot: [...c.startTransform.pivot]
|
|
296
|
+
};
|
|
297
|
+
if (c.handle === "move")
|
|
298
|
+
E.position = {
|
|
299
|
+
x: _(c.startTransform.position.x + g),
|
|
300
|
+
y: _(c.startTransform.position.y + p)
|
|
301
|
+
};
|
|
302
|
+
else if (c.handle === "pivot") {
|
|
303
|
+
const S = Math.max(
|
|
304
|
+
1,
|
|
305
|
+
c.startTransform.size.width * c.startTransform.scale2D.x
|
|
306
|
+
), v = Math.max(
|
|
307
|
+
1,
|
|
308
|
+
c.startTransform.size.height * c.startTransform.scale2D.y
|
|
309
|
+
), P = me(c.startTransform.pivot[0] + g / S), T = me(c.startTransform.pivot[1] + p / v);
|
|
310
|
+
E.pivot = [_(P * 1e3) / 1e3, _(T * 1e3) / 1e3], E.position = {
|
|
311
|
+
x: _(
|
|
312
|
+
c.startTransform.position.x + (E.pivot[0] - c.startTransform.pivot[0]) * S
|
|
313
|
+
),
|
|
314
|
+
y: _(
|
|
315
|
+
c.startTransform.position.y + (E.pivot[1] - c.startTransform.pivot[1]) * v
|
|
316
|
+
)
|
|
317
|
+
};
|
|
318
|
+
} else if (c.handle.startsWith("rotate")) {
|
|
319
|
+
const S = Math.atan2(
|
|
320
|
+
c.startPointerDesign.y - c.startTransform.position.y,
|
|
321
|
+
c.startPointerDesign.x - c.startTransform.position.x
|
|
322
|
+
), v = Math.atan2(
|
|
323
|
+
C.y - c.startTransform.position.y,
|
|
324
|
+
C.x - c.startTransform.position.x
|
|
325
|
+
);
|
|
326
|
+
E.rotation = _(
|
|
327
|
+
c.startTransform.rotation + (v - S) * 180 / Math.PI
|
|
328
|
+
);
|
|
329
|
+
} else {
|
|
330
|
+
const S = c.handle === "left" || c.handle.endsWith("Left"), v = c.handle === "right" || c.handle.endsWith("Right"), P = c.handle === "top" || c.handle.startsWith("top"), T = c.handle === "bottom" || c.handle.startsWith("bottom"), m = v ? g * 2 : S ? -g * 2 : 0, R = P ? p * 2 : T ? -p * 2 : 0;
|
|
331
|
+
E.size = {
|
|
332
|
+
width: Math.max(1, _(c.startTransform.size.width + m)),
|
|
333
|
+
height: Math.max(1, _(c.startTransform.size.height + R))
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
x(E);
|
|
337
|
+
}, []), b = U(() => {
|
|
338
|
+
l.current = null, document.body.style.cursor = "", window.removeEventListener("pointermove", w), window.removeEventListener("pointerup", b);
|
|
339
|
+
}, [w]);
|
|
340
|
+
k(() => b, [b]);
|
|
341
|
+
const M = U(
|
|
342
|
+
(h, c) => {
|
|
343
|
+
!a || !y || !o || (c.preventDefault(), document.body.style.cursor = h === "move" ? "grabbing" : te[h], l.current = {
|
|
344
|
+
handle: h,
|
|
345
|
+
startX: c.clientX,
|
|
346
|
+
startY: c.clientY,
|
|
347
|
+
startPointerDesign: Ve(c.clientX, c.clientY, a, y.scale),
|
|
348
|
+
startTransform: n,
|
|
349
|
+
scale: y.scale
|
|
350
|
+
}, window.addEventListener("pointermove", w), window.addEventListener("pointerup", b));
|
|
351
|
+
},
|
|
352
|
+
[a, y, o, b, n, w]
|
|
353
|
+
);
|
|
354
|
+
return k(() => {
|
|
355
|
+
if (typeof document > "u") return;
|
|
356
|
+
const h = document.createElement("div");
|
|
357
|
+
return document.body.appendChild(h), d.current = h, () => {
|
|
358
|
+
h.remove(), d.current = null;
|
|
359
|
+
};
|
|
360
|
+
}, []), k(() => {
|
|
361
|
+
const h = d.current;
|
|
362
|
+
if (!h || (h.replaceChildren(), !y))
|
|
363
|
+
return;
|
|
364
|
+
const c = 12, x = 12, g = document.createElement("div");
|
|
365
|
+
Object.assign(g.style, {
|
|
366
|
+
position: "fixed",
|
|
367
|
+
inset: "0",
|
|
368
|
+
zIndex: "19999",
|
|
369
|
+
pointerEvents: "none"
|
|
370
|
+
});
|
|
371
|
+
const p = document.createElement("div");
|
|
372
|
+
Object.assign(p.style, {
|
|
373
|
+
position: "absolute",
|
|
374
|
+
left: `${y.left}px`,
|
|
375
|
+
top: `${y.top}px`,
|
|
376
|
+
width: `${y.width}px`,
|
|
377
|
+
height: `${y.height}px`,
|
|
378
|
+
border: `1px solid ${e}`,
|
|
379
|
+
boxSizing: "border-box",
|
|
380
|
+
transform: `rotate(${-n.rotation}deg)`,
|
|
381
|
+
transformOrigin: `${n.pivot[0] * 100}% ${(1 - n.pivot[1]) * 100}%`,
|
|
382
|
+
pointerEvents: o ? "auto" : "none",
|
|
383
|
+
cursor: te.move
|
|
384
|
+
}), p.addEventListener("pointerdown", (S) => M("move", S));
|
|
385
|
+
const C = (S, v, P, T, m = "translate(-50%, -50%)") => {
|
|
386
|
+
const R = document.createElement("div");
|
|
387
|
+
return Object.assign(R.style, {
|
|
388
|
+
position: "absolute",
|
|
389
|
+
left: `${v * 100}%`,
|
|
390
|
+
top: `${P * 100}%`,
|
|
391
|
+
width: `${T}px`,
|
|
392
|
+
height: `${T}px`,
|
|
393
|
+
cursor: te[S],
|
|
394
|
+
transform: m,
|
|
395
|
+
pointerEvents: "auto"
|
|
396
|
+
}), R.addEventListener("pointerdown", (F) => {
|
|
397
|
+
F.stopPropagation(), M(S, F);
|
|
398
|
+
}), R;
|
|
399
|
+
};
|
|
400
|
+
for (const [S, v, P] of $e) {
|
|
401
|
+
const T = C(S, v, P, c);
|
|
402
|
+
T.style.background = t, p.appendChild(T);
|
|
403
|
+
}
|
|
404
|
+
for (const [S, v, P] of He)
|
|
405
|
+
p.appendChild(C(S, v, P, 26));
|
|
406
|
+
const E = C(
|
|
407
|
+
"pivot",
|
|
408
|
+
n.pivot[0],
|
|
409
|
+
1 - n.pivot[1],
|
|
410
|
+
x,
|
|
411
|
+
"translate(-50%, -50%) rotate(45deg)"
|
|
412
|
+
);
|
|
413
|
+
return Object.assign(E.style, {
|
|
414
|
+
border: "2px solid #ffffff",
|
|
415
|
+
background: "#111827",
|
|
416
|
+
boxSizing: "border-box"
|
|
417
|
+
}), p.appendChild(E), g.appendChild(p), h.appendChild(g), () => {
|
|
418
|
+
h.replaceChildren();
|
|
419
|
+
};
|
|
420
|
+
}, [e, t, y, o, M, n]), null;
|
|
421
|
+
}, Q = {
|
|
422
|
+
// Pinning is opt-in. A serialized scene must never move an object until
|
|
423
|
+
// the author explicitly enables the component and chooses a target.
|
|
424
|
+
enabled: !1,
|
|
425
|
+
targetObjectId: null,
|
|
426
|
+
orientation: "none",
|
|
427
|
+
uv: { x: 0.5, y: 0.5 },
|
|
428
|
+
vertexNormal: !1,
|
|
429
|
+
offsetSpace: "local",
|
|
430
|
+
offsetPosition: { x: 0, y: 0, z: 0 },
|
|
431
|
+
offsetRotation: { x: 0, y: 0, z: 0 }
|
|
432
|
+
}, Qe = (e, t, o, n) => {
|
|
433
|
+
const i = o.clone().sub(t), r = n.clone().sub(t), a = e.clone().sub(t), s = i.x * r.y - r.x * i.y;
|
|
434
|
+
if (Math.abs(s) < 1e-8) return null;
|
|
435
|
+
const l = (a.x * r.y - r.x * a.y) / s, d = (i.x * a.y - a.x * i.y) / s, f = 1 - l - d;
|
|
436
|
+
return f >= -1e-5 && l >= -1e-5 && d >= -1e-5 ? [f, l, d] : null;
|
|
437
|
+
}, Ze = (e, t, o = !1) => {
|
|
438
|
+
const n = new K(t.x, t.y), i = new K(), r = new K(), a = new K(), s = new z(), l = new z(), d = new z(), f = new z(), y = new z(), w = new z();
|
|
439
|
+
let b = null;
|
|
440
|
+
if (e.traverse((h) => {
|
|
441
|
+
var v, P;
|
|
442
|
+
if (b || !h.isMesh) return;
|
|
443
|
+
const c = h, x = c.geometry, g = (v = x == null ? void 0 : x.attributes) == null ? void 0 : v.position, p = (P = x == null ? void 0 : x.attributes) == null ? void 0 : P.uv;
|
|
444
|
+
if (!g || !p) return;
|
|
445
|
+
const C = x.attributes.normal, E = x.index, S = (T) => (E == null ? void 0 : E.getX(T)) ?? T;
|
|
446
|
+
for (let T = 0; T < (E ? E.count : g.count); T += 3) {
|
|
447
|
+
const m = [S(T), S(T + 1), S(T + 2)];
|
|
448
|
+
i.set(p.getX(m[0]), p.getY(m[0])), r.set(p.getX(m[1]), p.getY(m[1])), a.set(p.getX(m[2]), p.getY(m[2]));
|
|
449
|
+
const R = Qe(n, i, r, a);
|
|
450
|
+
if (R) {
|
|
451
|
+
s.set(0, 0, 0), l.set(0, 0, 0), m.forEach((F, V) => {
|
|
452
|
+
d.fromBufferAttribute(g, F), s.addScaledVector(d, R[V]), C && o && l.addScaledVector(d.fromBufferAttribute(C, F), R[V]);
|
|
453
|
+
}), o || (f.fromBufferAttribute(g, m[0]), y.fromBufferAttribute(g, m[1]), w.fromBufferAttribute(g, m[2]), l.copy(y.sub(f).cross(w.sub(f)).normalize())), b = {
|
|
454
|
+
mesh: c,
|
|
455
|
+
localPosition: s.clone(),
|
|
456
|
+
localNormal: l.clone().normalize()
|
|
457
|
+
};
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}), b) return b;
|
|
462
|
+
const M = new Ae().setFromObject(e);
|
|
463
|
+
return {
|
|
464
|
+
mesh: e,
|
|
465
|
+
localPosition: e.worldToLocal(M.getCenter(new z())),
|
|
466
|
+
localNormal: new z(0, 1, 0)
|
|
467
|
+
};
|
|
468
|
+
}, Je = (e) => ({
|
|
469
|
+
position: e.mesh.localToWorld(e.localPosition.clone()),
|
|
470
|
+
normal: e.localNormal.clone().transformDirection(e.mesh.matrixWorld).normalize()
|
|
471
|
+
}), X = (e, t = 0) => Number.isFinite(e) ? e : t, oe = new z(), ne = new z(), ye = new B(), re = new Y(), ie = new Y(), et = new z(0, 1, 0), tt = (e) => {
|
|
472
|
+
e.position.set(0, 0, 0), e.quaternion.identity();
|
|
473
|
+
}, ot = ({ settings: e, source: t, surface: o }) => {
|
|
474
|
+
e.orientation === "positionAndDirection" ? (ye.lookAt(o.position, o.position.clone().add(o.normal), et), re.setFromRotationMatrix(ye)) : re.identity(), t.quaternion.copy(re), ne.set(
|
|
475
|
+
X(e.offsetPosition.x),
|
|
476
|
+
X(e.offsetPosition.y),
|
|
477
|
+
X(e.offsetPosition.z)
|
|
478
|
+
), e.offsetSpace === "local" && ne.applyQuaternion(t.quaternion), oe.copy(o.position).add(ne), t.parent && t.parent.worldToLocal(oe), t.position.copy(oe), ie.setFromEuler(
|
|
479
|
+
new H(
|
|
480
|
+
X(e.offsetRotation.x) * Math.PI / 180,
|
|
481
|
+
X(e.offsetRotation.y) * Math.PI / 180,
|
|
482
|
+
X(e.offsetRotation.z) * Math.PI / 180
|
|
483
|
+
)
|
|
484
|
+
), e.offsetSpace === "local" ? t.quaternion.multiply(ie) : t.quaternion.premultiply(ie);
|
|
485
|
+
}, oo = ({ target: e, settings: t, children: o }) => {
|
|
486
|
+
const n = Fe(), i = W(null), r = W(null), a = () => {
|
|
487
|
+
i.current && tt(i.current);
|
|
488
|
+
};
|
|
489
|
+
return k(() => {
|
|
490
|
+
r.current = null;
|
|
491
|
+
}, [t.targetObjectId]), k(() => {
|
|
492
|
+
t.enabled || a();
|
|
493
|
+
}, [t.enabled]), Oe(() => {
|
|
494
|
+
const s = e ?? n(t.targetObjectId);
|
|
495
|
+
if (!t.enabled || !s || !i.current) {
|
|
496
|
+
(!t.enabled || !s) && a();
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
const l = `${t.uv.x}:${t.uv.y}:${t.vertexNormal ? "vertex" : "face"}`;
|
|
500
|
+
(!r.current || r.current.target !== s || r.current.key !== l) && (r.current = {
|
|
501
|
+
key: l,
|
|
502
|
+
target: s,
|
|
503
|
+
surface: Ze(s, t.uv, t.vertexNormal)
|
|
504
|
+
}), s.updateWorldMatrix(!0, !0);
|
|
505
|
+
const d = Je(r.current.surface);
|
|
506
|
+
ot({ source: i.current, surface: d, settings: t });
|
|
507
|
+
}), Le("group", { ref: i }, o);
|
|
508
|
+
}, I = (e) => Math.round(e * 2) / 2, ge = (e) => Math.min(1, Math.max(0, e));
|
|
509
|
+
function nt(e) {
|
|
510
|
+
return Math.min(
|
|
511
|
+
e.width / A.width,
|
|
512
|
+
e.height / A.height
|
|
513
|
+
) || 1;
|
|
514
|
+
}
|
|
515
|
+
function rt({
|
|
516
|
+
resolved: e,
|
|
517
|
+
transform: t
|
|
518
|
+
}) {
|
|
519
|
+
return e.size[0] / Math.max(Math.abs(t.size.width * t.scale2D.x), 1e-6) || 1;
|
|
520
|
+
}
|
|
521
|
+
function it({
|
|
522
|
+
parent: e,
|
|
523
|
+
resolved: t,
|
|
524
|
+
transform: o
|
|
525
|
+
}) {
|
|
526
|
+
const r = 16 * ((Math.min(
|
|
527
|
+
e.width / A.width,
|
|
528
|
+
e.height / A.height
|
|
529
|
+
) || 1) * (q / Math.max(o.referencePixelsPerUnit, 1e-6))), a = 0.028;
|
|
530
|
+
return [
|
|
531
|
+
r / Math.max(Math.abs(t.size[0]) * a, 1e-6),
|
|
532
|
+
r / Math.max(Math.abs(t.size[1]) * a, 1e-6),
|
|
533
|
+
1
|
|
534
|
+
];
|
|
535
|
+
}
|
|
536
|
+
function st({
|
|
537
|
+
drag: e,
|
|
538
|
+
clientX: t,
|
|
539
|
+
clientY: o,
|
|
540
|
+
designScale: n
|
|
541
|
+
}) {
|
|
542
|
+
const i = (t - e.startX) / n, r = -(o - e.startY) / n, a = {
|
|
543
|
+
x: e.startPointerDesign.x + i,
|
|
544
|
+
y: e.startPointerDesign.y + r
|
|
545
|
+
}, s = {
|
|
546
|
+
...e.startTransform,
|
|
547
|
+
position: { ...e.startTransform.position },
|
|
548
|
+
size: { ...e.startTransform.size },
|
|
549
|
+
pivot: [...e.startTransform.pivot]
|
|
550
|
+
};
|
|
551
|
+
if (e.handle === "move")
|
|
552
|
+
return s.position = {
|
|
553
|
+
x: I(e.startTransform.position.x + i),
|
|
554
|
+
y: I(e.startTransform.position.y + r)
|
|
555
|
+
}, s;
|
|
556
|
+
if (e.handle === "pivot") {
|
|
557
|
+
const M = Math.max(
|
|
558
|
+
1,
|
|
559
|
+
e.startTransform.size.width * e.startTransform.scale2D.x
|
|
560
|
+
), h = Math.max(
|
|
561
|
+
1,
|
|
562
|
+
e.startTransform.size.height * e.startTransform.scale2D.y
|
|
563
|
+
), c = ge(e.startTransform.pivot[0] + i / M), x = ge(e.startTransform.pivot[1] + r / h);
|
|
564
|
+
return s.pivot = [I(c * 1e3) / 1e3, I(x * 1e3) / 1e3], s.position = {
|
|
565
|
+
x: I(
|
|
566
|
+
e.startTransform.position.x + (s.pivot[0] - e.startTransform.pivot[0]) * M
|
|
567
|
+
),
|
|
568
|
+
y: I(
|
|
569
|
+
e.startTransform.position.y + (s.pivot[1] - e.startTransform.pivot[1]) * h
|
|
570
|
+
)
|
|
571
|
+
}, s;
|
|
572
|
+
}
|
|
573
|
+
if (e.handle.startsWith("rotate")) {
|
|
574
|
+
const M = Math.atan2(
|
|
575
|
+
e.startPointerDesign.y - e.startTransform.position.y,
|
|
576
|
+
e.startPointerDesign.x - e.startTransform.position.x
|
|
577
|
+
), h = Math.atan2(
|
|
578
|
+
a.y - e.startTransform.position.y,
|
|
579
|
+
a.x - e.startTransform.position.x
|
|
580
|
+
);
|
|
581
|
+
return s.rotation = I(
|
|
582
|
+
e.startTransform.rotation + (h - M) * 180 / Math.PI
|
|
583
|
+
), s;
|
|
584
|
+
}
|
|
585
|
+
const l = e.handle === "left" || e.handle.endsWith("Left"), d = e.handle === "right" || e.handle.endsWith("Right"), f = e.handle === "top" || e.handle.startsWith("top"), y = e.handle === "bottom" || e.handle.startsWith("bottom"), w = d ? i * 2 : l ? -i * 2 : 0, b = f ? r * 2 : y ? -r * 2 : 0;
|
|
586
|
+
return s.size = {
|
|
587
|
+
width: Math.max(1, I(e.startTransform.size.width + w)),
|
|
588
|
+
height: Math.max(1, I(e.startTransform.size.height + b))
|
|
589
|
+
}, s;
|
|
590
|
+
}
|
|
591
|
+
function at({
|
|
592
|
+
transform: e,
|
|
593
|
+
guideLayer: t,
|
|
594
|
+
guideColor: o,
|
|
595
|
+
onChange: n,
|
|
596
|
+
children: i
|
|
597
|
+
}) {
|
|
598
|
+
const r = Ee(), { size: a } = xe(), s = W(n);
|
|
599
|
+
s.current = n;
|
|
600
|
+
const l = W(null), d = G(
|
|
601
|
+
() => pe({ transform: e, parentSize: r }),
|
|
602
|
+
[r, e]
|
|
603
|
+
), f = nt(a), y = W(f);
|
|
604
|
+
y.current = f;
|
|
605
|
+
const w = rt({ resolved: d, transform: e }), b = U((x) => {
|
|
606
|
+
const g = l.current, p = s.current;
|
|
607
|
+
!g || !p || p(
|
|
608
|
+
st({
|
|
609
|
+
drag: g,
|
|
610
|
+
clientX: x.clientX,
|
|
611
|
+
clientY: x.clientY,
|
|
612
|
+
designScale: y.current
|
|
613
|
+
})
|
|
614
|
+
);
|
|
615
|
+
}, []), M = U(() => {
|
|
616
|
+
l.current = null, document.body.style.cursor = "", window.removeEventListener("pointermove", b), window.removeEventListener("pointerup", M);
|
|
617
|
+
}, [b]);
|
|
618
|
+
k(() => M, [M]);
|
|
619
|
+
const h = U(
|
|
620
|
+
(x, g) => {
|
|
621
|
+
n && (l.current = {
|
|
622
|
+
handle: x,
|
|
623
|
+
startX: g.nativeEvent.clientX,
|
|
624
|
+
startY: g.nativeEvent.clientY,
|
|
625
|
+
startPointerDesign: {
|
|
626
|
+
x: g.point.x / w,
|
|
627
|
+
y: g.point.y / w
|
|
628
|
+
},
|
|
629
|
+
startTransform: e
|
|
630
|
+
}, window.addEventListener("pointermove", b), window.addEventListener("pointerup", M));
|
|
631
|
+
},
|
|
632
|
+
[n, M, e, w, b]
|
|
633
|
+
), c = G(
|
|
634
|
+
() => it({ parent: r, resolved: d, transform: e }),
|
|
635
|
+
[r, d, e]
|
|
636
|
+
);
|
|
637
|
+
return /* @__PURE__ */ u(
|
|
638
|
+
"group",
|
|
639
|
+
{
|
|
640
|
+
position: [
|
|
641
|
+
d.center[0] + (e.pivot[0] - 0.5) * d.size[0],
|
|
642
|
+
d.center[1] + (e.pivot[1] - 0.5) * d.size[1],
|
|
643
|
+
0
|
|
644
|
+
],
|
|
645
|
+
rotation: d.rotation,
|
|
646
|
+
children: /* @__PURE__ */ u(
|
|
647
|
+
"group",
|
|
648
|
+
{
|
|
649
|
+
position: [
|
|
650
|
+
(0.5 - e.pivot[0]) * d.size[0],
|
|
651
|
+
(0.5 - e.pivot[1]) * d.size[1],
|
|
652
|
+
0
|
|
653
|
+
],
|
|
654
|
+
scale: d.size,
|
|
655
|
+
children: /* @__PURE__ */ O(ze.Provider, { value: d.aspect, children: [
|
|
656
|
+
i,
|
|
657
|
+
e.showTransformGuides && t === "scene" ? /* @__PURE__ */ u(
|
|
658
|
+
ke,
|
|
659
|
+
{
|
|
660
|
+
color: o,
|
|
661
|
+
controlScale: c,
|
|
662
|
+
onHandlePointerDown: n ? h : void 0,
|
|
663
|
+
pivot: e.pivot,
|
|
664
|
+
pivotScale: c,
|
|
665
|
+
renderOrder: e.renderOrder + 1
|
|
666
|
+
}
|
|
667
|
+
) : null,
|
|
668
|
+
e.showTransformGuides && t === "overlay" ? /* @__PURE__ */ u(
|
|
669
|
+
Ke,
|
|
670
|
+
{
|
|
671
|
+
color: o,
|
|
672
|
+
onChange: n,
|
|
673
|
+
transform: e
|
|
674
|
+
}
|
|
675
|
+
) : null
|
|
676
|
+
] })
|
|
677
|
+
}
|
|
678
|
+
)
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
const $ = {
|
|
683
|
+
tint: "#dff6ff",
|
|
684
|
+
opacity: 0.28,
|
|
685
|
+
frost: 0.35,
|
|
686
|
+
highlight: 0.55
|
|
687
|
+
}, ve = (e) => ({
|
|
688
|
+
...$,
|
|
689
|
+
...e,
|
|
690
|
+
opacity: L.clamp((e == null ? void 0 : e.opacity) ?? $.opacity, 0, 1),
|
|
691
|
+
frost: L.clamp((e == null ? void 0 : e.frost) ?? $.frost, 0, 1),
|
|
692
|
+
highlight: L.clamp((e == null ? void 0 : e.highlight) ?? $.highlight, 0, 1)
|
|
693
|
+
}), ct = `
|
|
694
|
+
varying vec2 vPosition;
|
|
695
|
+
void main() {
|
|
696
|
+
vPosition = position.xy;
|
|
697
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
698
|
+
}
|
|
699
|
+
`, lt = `
|
|
700
|
+
uniform vec3 tint;
|
|
701
|
+
uniform float opacity;
|
|
702
|
+
uniform float frost;
|
|
703
|
+
uniform float highlight;
|
|
704
|
+
varying vec2 vPosition;
|
|
705
|
+
|
|
706
|
+
void main() {
|
|
707
|
+
float grain = fract(sin(dot(vPosition * 997.0, vec2(12.9898, 78.233))) * 43758.5453);
|
|
708
|
+
float sheen = smoothstep(0.15, 0.85, 1.0 - (vPosition.x + vPosition.y + 1.0) * 0.5);
|
|
709
|
+
vec3 frosted = mix(tint, vec3(1.0), frost * (0.18 + grain * 0.08));
|
|
710
|
+
vec3 color = mix(frosted, vec3(1.0), sheen * highlight * 0.32);
|
|
711
|
+
gl_FragColor = vec4(color, opacity);
|
|
712
|
+
}
|
|
713
|
+
`, dt = ({ opacity: e = 1, value: t }) => {
|
|
714
|
+
const o = G(() => {
|
|
715
|
+
const n = ve(t);
|
|
716
|
+
return {
|
|
717
|
+
tint: { value: new Ce(n.tint) },
|
|
718
|
+
opacity: { value: n.opacity * e },
|
|
719
|
+
frost: { value: n.frost },
|
|
720
|
+
highlight: { value: n.highlight }
|
|
721
|
+
};
|
|
722
|
+
}, [e, t]);
|
|
723
|
+
return /* @__PURE__ */ u(
|
|
724
|
+
"shaderMaterial",
|
|
725
|
+
{
|
|
726
|
+
uniforms: o,
|
|
727
|
+
vertexShader: ct,
|
|
728
|
+
fragmentShader: lt,
|
|
729
|
+
transparent: !0,
|
|
730
|
+
depthTest: !1,
|
|
731
|
+
depthWrite: !1,
|
|
732
|
+
toneMapped: !1
|
|
733
|
+
}
|
|
734
|
+
);
|
|
735
|
+
}, se = (e, t = 1) => Array.from({ length: e }, (o, n) => {
|
|
736
|
+
const i = n % 2 ? t * 0.5 : 0.5, r = -Math.PI / 2 + n / e * Math.PI * 2;
|
|
737
|
+
return [Math.cos(r) * i, Math.sin(r) * i, 0];
|
|
738
|
+
}), pt = (e) => {
|
|
739
|
+
switch (e.kind) {
|
|
740
|
+
case "line":
|
|
741
|
+
return [
|
|
742
|
+
[e.lineStart.x - 0.5, 0.5 - e.lineStart.y, 0],
|
|
743
|
+
[e.lineEnd.x - 0.5, 0.5 - e.lineEnd.y, 0]
|
|
744
|
+
];
|
|
745
|
+
case "polygon":
|
|
746
|
+
return se(Math.max(3, Math.round(e.sides)));
|
|
747
|
+
case "star":
|
|
748
|
+
return se(
|
|
749
|
+
Math.max(3, Math.round(e.sides)) * 2,
|
|
750
|
+
ce.MathUtils.clamp(e.innerRadiusRatio, 0.05, 0.95)
|
|
751
|
+
);
|
|
752
|
+
case "rectangle":
|
|
753
|
+
return [
|
|
754
|
+
[-0.5, -0.5, 0],
|
|
755
|
+
[0.5, -0.5, 0],
|
|
756
|
+
[0.5, 0.5, 0],
|
|
757
|
+
[-0.5, 0.5, 0]
|
|
758
|
+
];
|
|
759
|
+
case "roundedRectangle": {
|
|
760
|
+
const t = ce.MathUtils.clamp(e.cornerRadius, 0, 0.5), o = [];
|
|
761
|
+
return [
|
|
762
|
+
[0.5 - t, 0.5 - t, 0],
|
|
763
|
+
[-0.5 + t, 0.5 - t, Math.PI / 2],
|
|
764
|
+
[-0.5 + t, -0.5 + t, Math.PI],
|
|
765
|
+
[0.5 - t, -0.5 + t, Math.PI * 1.5]
|
|
766
|
+
].forEach(([i, r, a]) => {
|
|
767
|
+
for (let s = 0; s <= 6; s += 1) {
|
|
768
|
+
const l = a + s / 6 * (Math.PI / 2);
|
|
769
|
+
o.push([i + Math.cos(l) * t, r + Math.sin(l) * t, 0]);
|
|
770
|
+
}
|
|
771
|
+
}), o;
|
|
772
|
+
}
|
|
773
|
+
case "circle":
|
|
774
|
+
case "ellipse":
|
|
775
|
+
default:
|
|
776
|
+
return se(64);
|
|
777
|
+
}
|
|
778
|
+
}, ft = (e) => {
|
|
779
|
+
const t = new ce.Shape();
|
|
780
|
+
return e.forEach(([o, n], i) => i ? t.lineTo(o, n) : t.moveTo(o, n)), t.closePath(), t;
|
|
781
|
+
}, Z = {
|
|
782
|
+
kind: "rectangle",
|
|
783
|
+
fillColor: "#38bdf8",
|
|
784
|
+
fillOpacity: 1,
|
|
785
|
+
fillMode: "solid",
|
|
786
|
+
gradient: Ie,
|
|
787
|
+
glass: $,
|
|
788
|
+
strokeColor: "#ffffff",
|
|
789
|
+
strokeOpacity: 1,
|
|
790
|
+
strokeWidth: 3,
|
|
791
|
+
cornerRadius: 0.15,
|
|
792
|
+
sides: 5,
|
|
793
|
+
innerRadiusRatio: 0.45,
|
|
794
|
+
dashed: !1,
|
|
795
|
+
lineStart: { x: 0.1, y: 0.5 },
|
|
796
|
+
lineEnd: { x: 0.9, y: 0.5 }
|
|
797
|
+
}, ht = (e) => {
|
|
798
|
+
const t = {
|
|
799
|
+
...Z,
|
|
800
|
+
...e,
|
|
801
|
+
lineStart: { ...Z.lineStart, ...e == null ? void 0 : e.lineStart },
|
|
802
|
+
lineEnd: { ...Z.lineEnd, ...e == null ? void 0 : e.lineEnd },
|
|
803
|
+
gradient: je(e == null ? void 0 : e.gradient),
|
|
804
|
+
glass: ve(e == null ? void 0 : e.glass)
|
|
805
|
+
}, o = (n, i) => Number.isFinite(n) ? n : i;
|
|
806
|
+
return {
|
|
807
|
+
...t,
|
|
808
|
+
fillOpacity: L.clamp(o(t.fillOpacity, 1), 0, 1),
|
|
809
|
+
strokeOpacity: L.clamp(o(t.strokeOpacity, 1), 0, 1),
|
|
810
|
+
strokeWidth: Math.max(0, o(t.strokeWidth, 0)),
|
|
811
|
+
cornerRadius: L.clamp(o(t.cornerRadius, 0), 0, 0.5),
|
|
812
|
+
sides: L.clamp(Math.round(o(t.sides, 5)), 3, 12),
|
|
813
|
+
innerRadiusRatio: L.clamp(o(t.innerRadiusRatio, 0.45), 0.05, 0.95),
|
|
814
|
+
lineStart: {
|
|
815
|
+
x: L.clamp(o(t.lineStart.x, 0.1), 0, 1),
|
|
816
|
+
y: L.clamp(o(t.lineStart.y, 0.5), 0, 1)
|
|
817
|
+
},
|
|
818
|
+
lineEnd: {
|
|
819
|
+
x: L.clamp(o(t.lineEnd.x, 0.9), 0, 1),
|
|
820
|
+
y: L.clamp(o(t.lineEnd.y, 0.5), 0, 1)
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
}, ut = ({
|
|
824
|
+
name: e,
|
|
825
|
+
renderOrder: t,
|
|
826
|
+
settings: o,
|
|
827
|
+
visible: n
|
|
828
|
+
}) => {
|
|
829
|
+
const i = Pe(), r = G(() => pt(o), [o]), a = G(() => ft(r), [r]), l = ["circle", "polygon", "star"].includes(o.kind) ? [Math.min(1, 1 / i), Math.min(1, i), 1] : [1, 1, 1], f = o.kind !== "line" ? [...r, r[0]] : r;
|
|
830
|
+
return /* @__PURE__ */ O("group", { name: e, visible: n, scale: l, children: [
|
|
831
|
+
o.kind !== "line" && o.fillOpacity > 0 ? /* @__PURE__ */ O("mesh", { renderOrder: t, children: [
|
|
832
|
+
/* @__PURE__ */ u("shapeGeometry", { args: [a] }),
|
|
833
|
+
o.fillMode === "glass" ? /* @__PURE__ */ u(dt, { value: o.glass, opacity: o.fillOpacity }) : /* @__PURE__ */ u(
|
|
834
|
+
We,
|
|
835
|
+
{
|
|
836
|
+
settings: {
|
|
837
|
+
source: o.fillMode,
|
|
838
|
+
color: o.fillColor,
|
|
839
|
+
opacity: o.fillOpacity,
|
|
840
|
+
gradient: o.gradient
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
)
|
|
844
|
+
] }) : null,
|
|
845
|
+
o.strokeWidth > 0 && o.strokeOpacity > 0 ? /* @__PURE__ */ u(
|
|
846
|
+
Ue,
|
|
847
|
+
{
|
|
848
|
+
points: f,
|
|
849
|
+
color: o.strokeColor,
|
|
850
|
+
lineWidth: o.strokeWidth,
|
|
851
|
+
opacity: o.strokeOpacity,
|
|
852
|
+
transparent: o.strokeOpacity < 1,
|
|
853
|
+
dashed: o.dashed,
|
|
854
|
+
dashSize: 0.05,
|
|
855
|
+
gapSize: 0.03,
|
|
856
|
+
depthTest: !1,
|
|
857
|
+
depthWrite: !1,
|
|
858
|
+
renderOrder: t + 1
|
|
859
|
+
}
|
|
860
|
+
) : null
|
|
861
|
+
] });
|
|
862
|
+
}, no = ({
|
|
863
|
+
name: e,
|
|
864
|
+
onScreenTransformChange: t,
|
|
865
|
+
renderOrder: o,
|
|
866
|
+
settings: n,
|
|
867
|
+
transform: i,
|
|
868
|
+
transformGuideLayer: r = "scene",
|
|
869
|
+
visible: a = !0
|
|
870
|
+
}) => {
|
|
871
|
+
const s = G(() => ht(n), [n]), l = G(
|
|
872
|
+
() => Ye(i ?? j),
|
|
873
|
+
[i]
|
|
874
|
+
);
|
|
875
|
+
return l.enabled ? /* @__PURE__ */ u(
|
|
876
|
+
at,
|
|
877
|
+
{
|
|
878
|
+
transform: l,
|
|
879
|
+
guideLayer: r,
|
|
880
|
+
guideColor: "#38bdf8",
|
|
881
|
+
onChange: t,
|
|
882
|
+
children: /* @__PURE__ */ u(
|
|
883
|
+
ut,
|
|
884
|
+
{
|
|
885
|
+
name: e,
|
|
886
|
+
settings: s,
|
|
887
|
+
visible: a && l.visible,
|
|
888
|
+
renderOrder: o ?? l.renderOrder
|
|
889
|
+
}
|
|
890
|
+
)
|
|
891
|
+
}
|
|
892
|
+
) : null;
|
|
893
|
+
};
|
|
894
|
+
function ro(e) {
|
|
895
|
+
const { screenSpaceUI: t, screenImage: o } = e, { image: n, transformation: i } = o, r = n.src.trim();
|
|
896
|
+
return {
|
|
897
|
+
shouldRender: t.enabled && o.enabled && i.enabled,
|
|
898
|
+
props: {
|
|
899
|
+
source: n.sourceKind === "image" && r.length > 0 ? { kind: "image", src: r } : { kind: "default" },
|
|
900
|
+
transform: o.screenTransform,
|
|
901
|
+
coordinateSpace: i.coordinateSpace,
|
|
902
|
+
canvasSize: i.canvasSize,
|
|
903
|
+
position: [i.position.x, i.position.y],
|
|
904
|
+
size: [i.size.width, i.size.height],
|
|
905
|
+
rotation: i.rotation,
|
|
906
|
+
pivot: i.pivot,
|
|
907
|
+
stretchMode: n.stretchMode,
|
|
908
|
+
materialType: n.materialType,
|
|
909
|
+
blendMode: n.blendMode,
|
|
910
|
+
opacity: n.opacity,
|
|
911
|
+
color: n.color,
|
|
912
|
+
flipX: n.flipX,
|
|
913
|
+
flipY: n.flipY,
|
|
914
|
+
renderOrder: i.renderOrder,
|
|
915
|
+
transparent: n.transparent,
|
|
916
|
+
alphaTest: n.alphaTest,
|
|
917
|
+
overlay: i.overlay,
|
|
918
|
+
visible: i.visible
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
const fe = {
|
|
923
|
+
enabled: !0,
|
|
924
|
+
preset: "placeholder",
|
|
925
|
+
transformation: {
|
|
926
|
+
enabled: !0,
|
|
927
|
+
showFitGuides: !1,
|
|
928
|
+
coordinateSpace: "canvas",
|
|
929
|
+
canvasSize: { width: 720, height: 1280 },
|
|
930
|
+
position: { x: 0, y: 0 },
|
|
931
|
+
size: { width: 680, height: 1230 },
|
|
932
|
+
rotation: 0,
|
|
933
|
+
pivot: [0.5, 0.5],
|
|
934
|
+
renderOrder: 999,
|
|
935
|
+
overlay: !0,
|
|
936
|
+
visible: !0
|
|
937
|
+
},
|
|
938
|
+
screenTransform: {
|
|
939
|
+
...j,
|
|
940
|
+
renderOrder: 999
|
|
941
|
+
},
|
|
942
|
+
image: {
|
|
943
|
+
sourceKind: "default",
|
|
944
|
+
src: "",
|
|
945
|
+
stretchMode: "fit",
|
|
946
|
+
materialType: "unlit",
|
|
947
|
+
blendMode: "normal",
|
|
948
|
+
opacity: 1,
|
|
949
|
+
color: "#ffffff",
|
|
950
|
+
flipX: !1,
|
|
951
|
+
flipY: !1,
|
|
952
|
+
transparent: !0,
|
|
953
|
+
alphaTest: 0
|
|
954
|
+
}
|
|
955
|
+
}, io = {
|
|
956
|
+
screenImage: fe,
|
|
957
|
+
screenSpaceUI: {
|
|
958
|
+
enabled: !0
|
|
959
|
+
}
|
|
960
|
+
}, mt = (e) => e * Math.PI / 180;
|
|
961
|
+
function yt(e) {
|
|
962
|
+
if (!e) return;
|
|
963
|
+
const t = e.offset ?? 0, o = mt(e.angle ?? -45);
|
|
964
|
+
return {
|
|
965
|
+
color: e.color,
|
|
966
|
+
opacity: e.opacity,
|
|
967
|
+
blur: (e.feather ?? 0) * 100,
|
|
968
|
+
offsetX: Math.cos(o) * t,
|
|
969
|
+
offsetY: Math.sin(o) * t
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
function so(e) {
|
|
973
|
+
const { screenSpaceUI: t, screenText: o } = e, { content: n, layout: i, style: r, transformation: a } = o, s = r.background;
|
|
974
|
+
return {
|
|
975
|
+
shouldRender: t.enabled && o.enabled && a.enabled,
|
|
976
|
+
props: {
|
|
977
|
+
text: n.text,
|
|
978
|
+
screenTransform: o.screenTransform,
|
|
979
|
+
coordinateSpace: a.coordinateSpace,
|
|
980
|
+
canvasSize: a.canvasSize,
|
|
981
|
+
position: [a.position.x, a.position.y],
|
|
982
|
+
size: [a.size.width, a.size.height],
|
|
983
|
+
rotation: a.rotation,
|
|
984
|
+
pivot: a.pivot,
|
|
985
|
+
renderOrder: a.renderOrder,
|
|
986
|
+
overlay: a.overlay,
|
|
987
|
+
visible: a.visible,
|
|
988
|
+
showTransformGuides: a.showTransformGuides,
|
|
989
|
+
fontSize: r.fontSize,
|
|
990
|
+
fontFamily: r.fontFamily,
|
|
991
|
+
fontWeight: r.fontWeight,
|
|
992
|
+
fontStyle: r.fontStyle,
|
|
993
|
+
underline: r.underline,
|
|
994
|
+
strikethrough: r.strikethrough,
|
|
995
|
+
letterSpacing: r.letterSpacing,
|
|
996
|
+
lineSpacing: r.lineSpacing,
|
|
997
|
+
color: r.color,
|
|
998
|
+
opacity: r.opacity,
|
|
999
|
+
outlineEnabled: r.outlineEnabled,
|
|
1000
|
+
strokeLayers: r.strokeLayers,
|
|
1001
|
+
shadowEnabled: r.shadowEnabled,
|
|
1002
|
+
shadowLayers: r.shadowLayers,
|
|
1003
|
+
innerShadow: r.innerShadowEnabled ? yt(r.innerShadow) : void 0,
|
|
1004
|
+
glow: r.glowEnabled ? r.glow : void 0,
|
|
1005
|
+
bend: r.bendEnabled ? r.bend : void 0,
|
|
1006
|
+
bgColor: s.enabled ? s.color : "transparent",
|
|
1007
|
+
bgOpacity: s.opacity,
|
|
1008
|
+
bgFit: s.fit,
|
|
1009
|
+
bgAutoSize: s.autoSize,
|
|
1010
|
+
bgFillMode: s.fillMode,
|
|
1011
|
+
bgWidth: s.width,
|
|
1012
|
+
bgHeight: s.height,
|
|
1013
|
+
bgGradientStops: s.gradientStops,
|
|
1014
|
+
bgTextureUrl: s.textureUrl,
|
|
1015
|
+
bgTextureFit: s.textureFit,
|
|
1016
|
+
bgTextureFlipX: s.textureFlipX,
|
|
1017
|
+
bgTextureFlipY: s.textureFlipY,
|
|
1018
|
+
padding: s.padding,
|
|
1019
|
+
borderColor: s.borderEnabled ? s.borderColor : void 0,
|
|
1020
|
+
borderWidth: s.borderEnabled ? s.borderWidth : 0,
|
|
1021
|
+
borderRadius: s.borderRadius,
|
|
1022
|
+
textAlign: i.textAlign,
|
|
1023
|
+
verticalAlign: i.verticalAlign,
|
|
1024
|
+
overflow: i.overflow,
|
|
1025
|
+
resizeToFit: i.resizeToFit,
|
|
1026
|
+
minFontSize: i.minFontSize
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
const gt = {
|
|
1031
|
+
color: "#000000",
|
|
1032
|
+
blur: 0,
|
|
1033
|
+
offsetX: 7.071,
|
|
1034
|
+
offsetY: -7.071,
|
|
1035
|
+
opacity: 1,
|
|
1036
|
+
offset: 10,
|
|
1037
|
+
angle: -45,
|
|
1038
|
+
feather: 0
|
|
1039
|
+
}, St = {
|
|
1040
|
+
screenText: {
|
|
1041
|
+
enabled: !0,
|
|
1042
|
+
content: {
|
|
1043
|
+
text: "Hello from Vincentt"
|
|
1044
|
+
},
|
|
1045
|
+
layout: {
|
|
1046
|
+
textAlign: "center",
|
|
1047
|
+
verticalAlign: "center",
|
|
1048
|
+
overflow: "clip",
|
|
1049
|
+
resizeToFit: !1,
|
|
1050
|
+
minFontSize: 32
|
|
1051
|
+
},
|
|
1052
|
+
style: {
|
|
1053
|
+
fontSize: 72,
|
|
1054
|
+
fontFamily: '"Space Grotesk", sans-serif',
|
|
1055
|
+
fontWeight: 400,
|
|
1056
|
+
bold: !1,
|
|
1057
|
+
fontStyle: "normal",
|
|
1058
|
+
underline: !1,
|
|
1059
|
+
strikethrough: !1,
|
|
1060
|
+
letterSpacing: 0,
|
|
1061
|
+
lineSpacing: 0.3,
|
|
1062
|
+
color: "#ffffff",
|
|
1063
|
+
opacity: 1,
|
|
1064
|
+
aspect: 3,
|
|
1065
|
+
outlineEnabled: !0,
|
|
1066
|
+
shadowEnabled: !1,
|
|
1067
|
+
innerShadowEnabled: !1,
|
|
1068
|
+
innerShadow: {
|
|
1069
|
+
color: "#000000",
|
|
1070
|
+
opacity: 1,
|
|
1071
|
+
offset: 10,
|
|
1072
|
+
angle: -45,
|
|
1073
|
+
feather: 0
|
|
1074
|
+
},
|
|
1075
|
+
glowEnabled: !1,
|
|
1076
|
+
glow: {
|
|
1077
|
+
color: "#ffffff",
|
|
1078
|
+
style: "outward",
|
|
1079
|
+
intensity: 0.5,
|
|
1080
|
+
range: 0.5,
|
|
1081
|
+
horizontalAngle: 0,
|
|
1082
|
+
verticalAngle: 0
|
|
1083
|
+
},
|
|
1084
|
+
bendEnabled: !1,
|
|
1085
|
+
bend: {
|
|
1086
|
+
preset: "arc",
|
|
1087
|
+
strength: 100
|
|
1088
|
+
},
|
|
1089
|
+
background: {
|
|
1090
|
+
enabled: !1,
|
|
1091
|
+
autoSize: !0,
|
|
1092
|
+
fit: "text",
|
|
1093
|
+
fillMode: "solid",
|
|
1094
|
+
color: "#14286e",
|
|
1095
|
+
opacity: 1,
|
|
1096
|
+
borderRadius: 32,
|
|
1097
|
+
padding: 0,
|
|
1098
|
+
width: 540,
|
|
1099
|
+
height: 220,
|
|
1100
|
+
borderEnabled: !1,
|
|
1101
|
+
borderWidth: 0,
|
|
1102
|
+
borderColor: "#ffffff",
|
|
1103
|
+
gradientStops: [
|
|
1104
|
+
{ color: "#14286e", position: 0 },
|
|
1105
|
+
{ color: "#3657d6", position: 0.5 },
|
|
1106
|
+
{ color: "#8ab4ff", position: 1 }
|
|
1107
|
+
],
|
|
1108
|
+
textureUrl: "",
|
|
1109
|
+
textureFit: "cover",
|
|
1110
|
+
textureFlipX: !1,
|
|
1111
|
+
textureFlipY: !1
|
|
1112
|
+
},
|
|
1113
|
+
strokeLayers: [{ color: "#0f172a", width: 12, opacity: 1 }],
|
|
1114
|
+
shadowLayers: [gt]
|
|
1115
|
+
},
|
|
1116
|
+
screenTransform: {
|
|
1117
|
+
...j,
|
|
1118
|
+
renderOrder: 1e3
|
|
1119
|
+
},
|
|
1120
|
+
transformation: {
|
|
1121
|
+
enabled: !0,
|
|
1122
|
+
showTransformGuides: !1,
|
|
1123
|
+
coordinateSpace: "canvas",
|
|
1124
|
+
canvasSize: { width: 720, height: 1280 },
|
|
1125
|
+
position: { x: 0, y: 0 },
|
|
1126
|
+
size: { width: 680, height: 1230 },
|
|
1127
|
+
rotation: 0,
|
|
1128
|
+
pivot: [0.5, 0.5],
|
|
1129
|
+
renderOrder: 1e3,
|
|
1130
|
+
overlay: !0,
|
|
1131
|
+
visible: !0
|
|
1132
|
+
},
|
|
1133
|
+
textArtPreset: "clean"
|
|
1134
|
+
},
|
|
1135
|
+
screenImage: fe,
|
|
1136
|
+
screenSpaceUI: {
|
|
1137
|
+
enabled: !0
|
|
1138
|
+
}
|
|
1139
|
+
}, Te = (e) => {
|
|
1140
|
+
const t = typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
1141
|
+
return `${e}_${t}`;
|
|
1142
|
+
}, bt = () => Te("obj"), xt = () => Te("cmp"), N = (e) => typeof structuredClone == "function" ? structuredClone(e) : JSON.parse(JSON.stringify(e)), vt = () => N(Ne), Tt = () => N(j), wt = () => N(fe), Mt = () => N(St.screenText), Et = () => N(Z), zt = () => N(Re), Pt = () => N(Ge), Rt = () => ({
|
|
1143
|
+
type: "standard",
|
|
1144
|
+
color: "#ffffff",
|
|
1145
|
+
opacity: 1,
|
|
1146
|
+
wireframe: !1,
|
|
1147
|
+
roughness: 0.42,
|
|
1148
|
+
metalness: 0.08
|
|
1149
|
+
}), Ot = () => ({
|
|
1150
|
+
flipX: !1,
|
|
1151
|
+
flipY: !1
|
|
1152
|
+
}), Dt = () => ({
|
|
1153
|
+
enabled: !0,
|
|
1154
|
+
type: "directional",
|
|
1155
|
+
color: "#ffffff",
|
|
1156
|
+
intensity: 2.2,
|
|
1157
|
+
castShadow: !0,
|
|
1158
|
+
distance: 10,
|
|
1159
|
+
angle: Math.PI / 6,
|
|
1160
|
+
penumbra: 0.2,
|
|
1161
|
+
decay: 2,
|
|
1162
|
+
showHelper: !1
|
|
1163
|
+
}), Lt = () => ({
|
|
1164
|
+
enabled: !1,
|
|
1165
|
+
targetObjectId: null,
|
|
1166
|
+
mode: "point",
|
|
1167
|
+
inheritChildren: !1,
|
|
1168
|
+
offsetRotation: { x: 0, y: 0, z: 0 }
|
|
1169
|
+
}), At = () => ({
|
|
1170
|
+
...Q,
|
|
1171
|
+
uv: { ...Q.uv },
|
|
1172
|
+
offsetPosition: { ...Q.offsetPosition },
|
|
1173
|
+
offsetRotation: { ...Q.offsetRotation }
|
|
1174
|
+
}), Ct = () => N(_e), Ft = {
|
|
1175
|
+
Transform: vt,
|
|
1176
|
+
ScreenTransform: Tt,
|
|
1177
|
+
ScreenImage: wt,
|
|
1178
|
+
ScreenText: Mt,
|
|
1179
|
+
ScreenShape: Et,
|
|
1180
|
+
MeshRenderer: zt,
|
|
1181
|
+
FaceMeshRenderer: Pt,
|
|
1182
|
+
Material: Rt,
|
|
1183
|
+
Texture: Ot,
|
|
1184
|
+
Light: Dt,
|
|
1185
|
+
LookAt: Lt,
|
|
1186
|
+
PinToMesh: At,
|
|
1187
|
+
TrackingAnchor: Ct
|
|
1188
|
+
}, ao = ({
|
|
1189
|
+
componentIds: e = [],
|
|
1190
|
+
enabled: t = !0,
|
|
1191
|
+
id: o = bt(),
|
|
1192
|
+
parentObjectId: n = null,
|
|
1193
|
+
childObjectIds: i = [],
|
|
1194
|
+
renderGroupId: r,
|
|
1195
|
+
layerId: a,
|
|
1196
|
+
name: s
|
|
1197
|
+
}) => ({
|
|
1198
|
+
id: o,
|
|
1199
|
+
name: s,
|
|
1200
|
+
enabled: t,
|
|
1201
|
+
parentObjectId: n,
|
|
1202
|
+
childObjectIds: i,
|
|
1203
|
+
layerId: a,
|
|
1204
|
+
renderGroupId: r ?? a,
|
|
1205
|
+
componentIds: e
|
|
1206
|
+
}), co = (e, t) => ({
|
|
1207
|
+
id: xt(),
|
|
1208
|
+
objectId: t,
|
|
1209
|
+
type: e,
|
|
1210
|
+
enabled: !0,
|
|
1211
|
+
settings: Ft[e]()
|
|
1212
|
+
}), ee = (e, t) => {
|
|
1213
|
+
const o = e.objects[t];
|
|
1214
|
+
return o ? o.componentIds.map((n) => e.components[n]).filter((n) => !!n) : [];
|
|
1215
|
+
}, lo = () => {
|
|
1216
|
+
let e = null, t = null, o = null, n = [];
|
|
1217
|
+
return (i, r) => {
|
|
1218
|
+
const a = i.objects[r];
|
|
1219
|
+
if (!a)
|
|
1220
|
+
return e = i, t = r, o = null, n = [], n;
|
|
1221
|
+
const s = a.componentIds;
|
|
1222
|
+
return e === i && t === r && o === s && n.length === s.length && n.every((d) => i.components[d.id] === d) || (e = i, t = r, o = s, n = ee(i, r)), n;
|
|
1223
|
+
};
|
|
1224
|
+
}, po = (e, t) => {
|
|
1225
|
+
const o = e.objects[t.objectId];
|
|
1226
|
+
return o ? {
|
|
1227
|
+
...e,
|
|
1228
|
+
objects: {
|
|
1229
|
+
...e.objects,
|
|
1230
|
+
[o.id]: {
|
|
1231
|
+
...o,
|
|
1232
|
+
componentIds: [...o.componentIds, t.id]
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1235
|
+
components: {
|
|
1236
|
+
...e.components,
|
|
1237
|
+
[t.id]: t
|
|
1238
|
+
}
|
|
1239
|
+
} : e;
|
|
1240
|
+
}, fo = (e, t, o, n) => {
|
|
1241
|
+
const i = e.objects[t];
|
|
1242
|
+
if (!i || i.componentIds.indexOf(o) < 0) return e;
|
|
1243
|
+
const a = i.componentIds.filter((s) => s !== o);
|
|
1244
|
+
return a.splice(Math.max(0, Math.min(n, a.length)), 0, o), {
|
|
1245
|
+
...e,
|
|
1246
|
+
objects: {
|
|
1247
|
+
...e.objects,
|
|
1248
|
+
[t]: { ...i, componentIds: a }
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
}, ho = (e, t, o) => {
|
|
1252
|
+
const n = e.objects[t];
|
|
1253
|
+
if (!n) return e;
|
|
1254
|
+
const i = { ...e.components };
|
|
1255
|
+
return delete i[o], {
|
|
1256
|
+
...e,
|
|
1257
|
+
objects: {
|
|
1258
|
+
...e.objects,
|
|
1259
|
+
[t]: {
|
|
1260
|
+
...n,
|
|
1261
|
+
componentIds: n.componentIds.filter((r) => r !== o)
|
|
1262
|
+
}
|
|
1263
|
+
},
|
|
1264
|
+
components: i
|
|
1265
|
+
};
|
|
1266
|
+
}, Se = (e, t) => e.components[t.id] ? {
|
|
1267
|
+
...e,
|
|
1268
|
+
components: {
|
|
1269
|
+
...e.components,
|
|
1270
|
+
[t.id]: t
|
|
1271
|
+
}
|
|
1272
|
+
} : e, _t = (e, t) => e.objects[t.id] ? {
|
|
1273
|
+
...e,
|
|
1274
|
+
objects: {
|
|
1275
|
+
...e.objects,
|
|
1276
|
+
[t.id]: t
|
|
1277
|
+
}
|
|
1278
|
+
} : e, It = (e, t) => {
|
|
1279
|
+
const o = e.objects[t], n = (o == null ? void 0 : o.childObjectIds) ?? [], i = Object.values(e.objects).filter((a) => a.parentObjectId === t).map((a) => a.id);
|
|
1280
|
+
return [.../* @__PURE__ */ new Set([...n, ...i])].map((a) => e.objects[a]).filter((a) => !!a);
|
|
1281
|
+
}, jt = (e, t, o) => {
|
|
1282
|
+
var r;
|
|
1283
|
+
let n = o;
|
|
1284
|
+
const i = /* @__PURE__ */ new Set();
|
|
1285
|
+
for (; n; ) {
|
|
1286
|
+
if (n === t || i.has(n)) return !0;
|
|
1287
|
+
i.add(n), n = ((r = e.objects[n]) == null ? void 0 : r.parentObjectId) ?? null;
|
|
1288
|
+
}
|
|
1289
|
+
return !1;
|
|
1290
|
+
}, be = (e, t) => {
|
|
1291
|
+
const o = new Set(ee(e, t).map((n) => n.type));
|
|
1292
|
+
return o.has("Transform") ? "3d" : o.has("ScreenTransform") ? "2d" : null;
|
|
1293
|
+
}, Wt = (e, t, o, n) => {
|
|
1294
|
+
const i = e.objects[t];
|
|
1295
|
+
if (!i || o !== null && !e.objects[o]) return e;
|
|
1296
|
+
if (o !== null) {
|
|
1297
|
+
const s = be(e, t), l = be(e, o);
|
|
1298
|
+
if (s && l && s !== l) return e;
|
|
1299
|
+
}
|
|
1300
|
+
if (jt(e, t, o)) return e;
|
|
1301
|
+
const r = i.parentObjectId ?? null;
|
|
1302
|
+
if (r === o && o === null) return e;
|
|
1303
|
+
const a = { ...e.objects };
|
|
1304
|
+
if (r && a[r]) {
|
|
1305
|
+
const s = a[r];
|
|
1306
|
+
a[r] = {
|
|
1307
|
+
...s,
|
|
1308
|
+
childObjectIds: (s.childObjectIds ?? []).filter((l) => l !== t)
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
if (a[t] = { ...i, parentObjectId: o }, o) {
|
|
1312
|
+
const s = a[o], l = (s.childObjectIds ?? []).filter((d) => d !== t);
|
|
1313
|
+
l.splice(
|
|
1314
|
+
Math.max(0, Math.min(n ?? l.length, l.length)),
|
|
1315
|
+
0,
|
|
1316
|
+
t
|
|
1317
|
+
), a[o] = { ...s, childObjectIds: l };
|
|
1318
|
+
}
|
|
1319
|
+
return { ...e, objects: a };
|
|
1320
|
+
}, ae = Math.PI / 180, J = 180 / Math.PI, D = (e) => Number(e.toFixed(4)), Gt = (e) => (e == null ? void 0 : e.type) === "Transform", we = (e, t) => ee(e, t).find(Gt) ?? null, Nt = (e) => (e == null ? void 0 : e.type) === "ScreenTransform", Me = (e, t) => ee(e, t).find(Nt) ?? null, Ut = (e) => new B().compose(
|
|
1321
|
+
new z(e.position.x, e.position.y, e.position.z),
|
|
1322
|
+
new Y().setFromEuler(
|
|
1323
|
+
new H(
|
|
1324
|
+
e.rotation.x * ae,
|
|
1325
|
+
e.rotation.y * ae,
|
|
1326
|
+
e.rotation.z * ae
|
|
1327
|
+
)
|
|
1328
|
+
),
|
|
1329
|
+
new z(e.scale.x, e.scale.y, e.scale.z)
|
|
1330
|
+
), kt = (e, t) => {
|
|
1331
|
+
const o = we(e, t);
|
|
1332
|
+
return o ? Ut(o.settings) : new B();
|
|
1333
|
+
}, le = (e, t) => {
|
|
1334
|
+
const o = e.objects[t], n = kt(e, t);
|
|
1335
|
+
return !(o != null && o.parentObjectId) || !e.objects[o.parentObjectId] ? n : le(e, o.parentObjectId).multiply(n);
|
|
1336
|
+
}, Xt = (e) => {
|
|
1337
|
+
const t = pe({
|
|
1338
|
+
transform: e,
|
|
1339
|
+
parentSize: A,
|
|
1340
|
+
snapIncrement: 0
|
|
1341
|
+
});
|
|
1342
|
+
return new B().compose(
|
|
1343
|
+
new z(...t.center),
|
|
1344
|
+
new Y().setFromEuler(new H(...t.rotation)),
|
|
1345
|
+
new z(...t.size)
|
|
1346
|
+
);
|
|
1347
|
+
}, de = (e, t) => {
|
|
1348
|
+
var r;
|
|
1349
|
+
const o = Me(e, t), n = o ? Xt(o.settings) : new B(), i = (r = e.objects[t]) == null ? void 0 : r.parentObjectId;
|
|
1350
|
+
return !i || !e.objects[i] ? n : de(e, i).multiply(n);
|
|
1351
|
+
}, Bt = (e, t) => {
|
|
1352
|
+
const o = new z(), n = new Y(), i = new z();
|
|
1353
|
+
e.decompose(o, n, i);
|
|
1354
|
+
const r = new H().setFromQuaternion(n);
|
|
1355
|
+
return {
|
|
1356
|
+
...t,
|
|
1357
|
+
position: {
|
|
1358
|
+
x: D(o.x),
|
|
1359
|
+
y: D(o.y),
|
|
1360
|
+
z: D(o.z)
|
|
1361
|
+
},
|
|
1362
|
+
rotation: {
|
|
1363
|
+
x: D(r.x * J),
|
|
1364
|
+
y: D(r.y * J),
|
|
1365
|
+
z: D(r.z * J)
|
|
1366
|
+
},
|
|
1367
|
+
scale: {
|
|
1368
|
+
x: D(i.x),
|
|
1369
|
+
y: D(i.y),
|
|
1370
|
+
z: D(i.z)
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
}, Yt = (e, t) => {
|
|
1374
|
+
const o = new z(), n = new Y(), i = new z();
|
|
1375
|
+
e.decompose(o, n, i);
|
|
1376
|
+
const r = new H().setFromQuaternion(n), a = q / t.referencePixelsPerUnit, s = Math.abs(i.x), l = Math.abs(i.y), d = (t.pivot[0] - 0.5) * s, f = (t.pivot[1] - 0.5) * l;
|
|
1377
|
+
return {
|
|
1378
|
+
...t,
|
|
1379
|
+
position: {
|
|
1380
|
+
x: D((o.x + d) / a),
|
|
1381
|
+
y: D((o.y + f) / a)
|
|
1382
|
+
},
|
|
1383
|
+
rotation: D(r.z * J),
|
|
1384
|
+
scale2D: {
|
|
1385
|
+
x: D(s / (t.size.width * a)),
|
|
1386
|
+
y: D(l / (t.size.height * a))
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
}, uo = (e, t, o, n) => {
|
|
1390
|
+
const i = we(e, t), r = Me(e, t), a = i ? le(e, t) : r ? de(e, t) : null, s = Wt(e, t, o, n);
|
|
1391
|
+
if (s === e || !a) return s;
|
|
1392
|
+
const d = (o ? i ? le(s, o) : de(s, o) : new B()).clone().invert().multiply(a);
|
|
1393
|
+
return r ? Se(s, {
|
|
1394
|
+
...r,
|
|
1395
|
+
settings: Yt(d, r.settings)
|
|
1396
|
+
}) : i ? Se(s, {
|
|
1397
|
+
...i,
|
|
1398
|
+
settings: Bt(d, i.settings)
|
|
1399
|
+
}) : s;
|
|
1400
|
+
}, mo = (e, t, o) => {
|
|
1401
|
+
const n = e.objects[t];
|
|
1402
|
+
return n ? _t(e, { ...n, enabled: o }) : e;
|
|
1403
|
+
}, yo = (e, t) => {
|
|
1404
|
+
const o = e.objects[t];
|
|
1405
|
+
if (!o) return e;
|
|
1406
|
+
const n = It(e, t).map((s) => s.id), i = { ...e.objects };
|
|
1407
|
+
delete i[t];
|
|
1408
|
+
const r = Object.fromEntries(
|
|
1409
|
+
Object.entries(i).map(([s, l]) => [
|
|
1410
|
+
s,
|
|
1411
|
+
n.includes(s) || l.parentObjectId === t ? { ...l, parentObjectId: null } : {
|
|
1412
|
+
...l,
|
|
1413
|
+
childObjectIds: (l.childObjectIds ?? []).filter(
|
|
1414
|
+
(d) => d !== t
|
|
1415
|
+
)
|
|
1416
|
+
}
|
|
1417
|
+
])
|
|
1418
|
+
), a = { ...e.components };
|
|
1419
|
+
for (const s of o.componentIds)
|
|
1420
|
+
delete a[s];
|
|
1421
|
+
return { ...e, objects: r, components: a };
|
|
1422
|
+
}, $t = 30, go = 31, So = (e, t = 1) => {
|
|
1423
|
+
const o = t + e;
|
|
1424
|
+
if (o < 1 || o > $t)
|
|
1425
|
+
throw new RangeError(`Render-group layer ${o} is outside the supported range 1-30.`);
|
|
1426
|
+
return o;
|
|
1427
|
+
}, bo = ({
|
|
1428
|
+
renderer: e,
|
|
1429
|
+
scene: t,
|
|
1430
|
+
camera: o,
|
|
1431
|
+
layers: n,
|
|
1432
|
+
includeDefaultLayer: i = !0
|
|
1433
|
+
}) => {
|
|
1434
|
+
const r = o.layers.mask, a = e.autoClear;
|
|
1435
|
+
try {
|
|
1436
|
+
if (e.autoClear = !1, e.clear(!0, !0, !0), n.length === 0) {
|
|
1437
|
+
o.layers.set(0), e.render(t, o);
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
n.forEach((s, l) => {
|
|
1441
|
+
o.layers.set(s), i && s !== 0 && o.layers.enable(0), l > 0 && e.clearDepth(), e.render(t, o);
|
|
1442
|
+
});
|
|
1443
|
+
} finally {
|
|
1444
|
+
o.layers.mask = r, e.autoClear = a;
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
export {
|
|
1448
|
+
mo as A,
|
|
1449
|
+
So as B,
|
|
1450
|
+
ve as C,
|
|
1451
|
+
$ as D,
|
|
1452
|
+
no as E,
|
|
1453
|
+
Z as F,
|
|
1454
|
+
ht as G,
|
|
1455
|
+
go as H,
|
|
1456
|
+
bo as I,
|
|
1457
|
+
fe as J,
|
|
1458
|
+
io as K,
|
|
1459
|
+
ro as L,
|
|
1460
|
+
$t as M,
|
|
1461
|
+
St as N,
|
|
1462
|
+
gt as O,
|
|
1463
|
+
oo as P,
|
|
1464
|
+
yt as Q,
|
|
1465
|
+
so as R,
|
|
1466
|
+
dt as S,
|
|
1467
|
+
Xe as T,
|
|
1468
|
+
q as U,
|
|
1469
|
+
j as V,
|
|
1470
|
+
A as W,
|
|
1471
|
+
Ye as X,
|
|
1472
|
+
pe as Y,
|
|
1473
|
+
at as Z,
|
|
1474
|
+
po as a,
|
|
1475
|
+
co as b,
|
|
1476
|
+
Ft as c,
|
|
1477
|
+
Pt as d,
|
|
1478
|
+
Rt as e,
|
|
1479
|
+
zt as f,
|
|
1480
|
+
wt as g,
|
|
1481
|
+
Mt as h,
|
|
1482
|
+
Et as i,
|
|
1483
|
+
Tt as j,
|
|
1484
|
+
Ot as k,
|
|
1485
|
+
vt as l,
|
|
1486
|
+
xt as m,
|
|
1487
|
+
Te as n,
|
|
1488
|
+
ao as o,
|
|
1489
|
+
bt as p,
|
|
1490
|
+
lo as q,
|
|
1491
|
+
yo as r,
|
|
1492
|
+
ee as s,
|
|
1493
|
+
It as t,
|
|
1494
|
+
fo as u,
|
|
1495
|
+
ho as v,
|
|
1496
|
+
Se as w,
|
|
1497
|
+
_t as x,
|
|
1498
|
+
Wt as y,
|
|
1499
|
+
uo as z
|
|
1500
|
+
};
|