@nice2dev/ui-graphics 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/animation/AnimatedPerson.js +69 -63
- package/dist/cjs/animation/AnimatedPerson.js.map +1 -1
- package/dist/cjs/animation/AnimationEditor.js +27 -20
- package/dist/cjs/animation/AnimationEditor.js.map +1 -1
- package/dist/cjs/animation/Audience.js +17 -11
- package/dist/cjs/animation/Audience.js.map +1 -1
- package/dist/cjs/animation/BodyRenderer.js +7 -7
- package/dist/cjs/animation/BodyRenderer.js.map +1 -1
- package/dist/cjs/animation/animationHelper.js +83 -52
- package/dist/cjs/animation/animationHelper.js.map +1 -1
- package/dist/cjs/animation/characterTypes.js +171 -30
- package/dist/cjs/animation/characterTypes.js.map +1 -1
- package/dist/cjs/animation/choreoDSL.js +114 -62
- package/dist/cjs/animation/choreoDSL.js.map +1 -1
- package/dist/cjs/animation/karaokeIntegration.js +10 -11
- package/dist/cjs/animation/karaokeIntegration.js.map +1 -1
- package/dist/cjs/animation/lottieExport.js +15 -9
- package/dist/cjs/animation/lottieExport.js.map +1 -1
- package/dist/cjs/animation/motionPath.js +125 -30
- package/dist/cjs/animation/motionPath.js.map +1 -1
- package/dist/cjs/animation/physics.js +157 -57
- package/dist/cjs/animation/physics.js.map +1 -1
- package/dist/cjs/animation/rig/RigPlayer.js +7 -6
- package/dist/cjs/animation/rig/RigPlayer.js.map +1 -1
- package/dist/cjs/animation/rig/RiggedBody.js +7 -7
- package/dist/cjs/animation/rig/RiggedBody.js.map +1 -1
- package/dist/cjs/animation/rig/choreoRigBridge.js +52 -29
- package/dist/cjs/animation/rig/choreoRigBridge.js.map +1 -1
- package/dist/cjs/animation/rig/poseOps.js +6 -3
- package/dist/cjs/animation/rig/poseOps.js.map +1 -1
- package/dist/cjs/animation/shapes/arms.js +7 -6
- package/dist/cjs/animation/shapes/arms.js.map +1 -1
- package/dist/cjs/animation/shapes/eyes.js +31 -18
- package/dist/cjs/animation/shapes/eyes.js.map +1 -1
- package/dist/cjs/animation/shapes/hair.js +39 -23
- package/dist/cjs/animation/shapes/hair.js.map +1 -1
- package/dist/cjs/animation/shapes/heads.js +47 -29
- package/dist/cjs/animation/shapes/heads.js.map +1 -1
- package/dist/cjs/animation/shapes/headwear.js +26 -14
- package/dist/cjs/animation/shapes/headwear.js.map +1 -1
- package/dist/cjs/animation/shapes/legs.js +7 -6
- package/dist/cjs/animation/shapes/legs.js.map +1 -1
- package/dist/cjs/animation/shapes/mouths.js +28 -18
- package/dist/cjs/animation/shapes/mouths.js.map +1 -1
- package/dist/cjs/animation/shapes/noses.js +18 -9
- package/dist/cjs/animation/shapes/noses.js.map +1 -1
- package/dist/cjs/animation/shapes/outfits.js +25 -14
- package/dist/cjs/animation/shapes/outfits.js.map +1 -1
- package/dist/cjs/animation/shapes/torsos.js +5 -4
- package/dist/cjs/animation/shapes/torsos.js.map +1 -1
- package/dist/cjs/animation/spineExport.js +33 -26
- package/dist/cjs/animation/spineExport.js.map +1 -1
- package/dist/cjs/core/LocalUI.js +16 -16
- package/dist/cjs/core/LocalUI.js.map +1 -1
- package/dist/cjs/core/NiceBrushEngine.js +205 -69
- package/dist/cjs/core/NiceBrushEngine.js.map +1 -1
- package/dist/cjs/core/collaboration.js +35 -21
- package/dist/cjs/core/collaboration.js.map +1 -1
- package/dist/cjs/core/colorBlindness.js +64 -24
- package/dist/cjs/core/colorBlindness.js.map +1 -1
- package/dist/cjs/core/dragDrop.js +34 -26
- package/dist/cjs/core/dragDrop.js.map +1 -1
- package/dist/cjs/core/fixes.js +26 -14
- package/dist/cjs/core/fixes.js.map +1 -1
- package/dist/cjs/core/gridGuides.js +24 -16
- package/dist/cjs/core/gridGuides.js.map +1 -1
- package/dist/cjs/core/historyVisual.js +42 -23
- package/dist/cjs/core/historyVisual.js.map +1 -1
- package/dist/cjs/core/integrations.js +65 -48
- package/dist/cjs/core/integrations.js.map +1 -1
- package/dist/cjs/core/minimap.js +40 -24
- package/dist/cjs/core/minimap.js.map +1 -1
- package/dist/cjs/core/plugins.js +10 -6
- package/dist/cjs/core/plugins.js.map +1 -1
- package/dist/cjs/core/rtl.js +32 -27
- package/dist/cjs/core/rtl.js.map +1 -1
- package/dist/cjs/core/shortcuts.js +77 -39
- package/dist/cjs/core/shortcuts.js.map +1 -1
- package/dist/cjs/core/theme.js +68 -61
- package/dist/cjs/core/theme.js.map +1 -1
- package/dist/cjs/core/yjsCollaboration.js +61 -28
- package/dist/cjs/core/yjsCollaboration.js.map +1 -1
- package/dist/cjs/font/NiceFontEditor.js +160 -57
- package/dist/cjs/font/NiceFontEditor.js.map +1 -1
- package/dist/cjs/font/fontFormatUtils.js +37 -24
- package/dist/cjs/font/fontFormatUtils.js.map +1 -1
- package/dist/cjs/game/GameAsset2dEditor.js +73 -60
- package/dist/cjs/game/GameAsset2dEditor.js.map +1 -1
- package/dist/cjs/game/gameAssetUtils.js +18 -13
- package/dist/cjs/game/gameAssetUtils.js.map +1 -1
- package/dist/cjs/game/useGameAssetEditor.js +160 -143
- package/dist/cjs/game/useGameAssetEditor.js.map +1 -1
- package/dist/cjs/icon/NiceIconEditor.js +329 -106
- package/dist/cjs/icon/NiceIconEditor.js.map +1 -1
- package/dist/cjs/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js +572 -0
- package/dist/cjs/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NiceForm-CKoJA6NG.js +4979 -0
- package/dist/cjs/packages/ui/dist/NiceForm-CKoJA6NG.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NiceModal-1QX7NhyH.js +98 -0
- package/dist/cjs/packages/ui/dist/NiceModal-1QX7NhyH.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5244 -0
- package/dist/cjs/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NicePagination-DbE-uOkl.js +174 -0
- package/dist/cjs/packages/ui/dist/NicePagination-DbE-uOkl.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js +10459 -0
- package/dist/cjs/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6313 -0
- package/dist/cjs/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NiceTabs-DzLHzwuA.js +1639 -0
- package/dist/cjs/packages/ui/dist/NiceTabs-DzLHzwuA.js.map +1 -0
- package/dist/cjs/packages/ui/dist/NiceWindow-DeC83yfE.js +807 -0
- package/dist/cjs/packages/ui/dist/NiceWindow-DeC83yfE.js.map +1 -0
- package/dist/cjs/packages/ui/dist/charts-BAS21jkC.js +3833 -0
- package/dist/cjs/packages/ui/dist/charts-BAS21jkC.js.map +1 -0
- package/dist/cjs/packages/ui/dist/core-Da43q-pO.js +11683 -0
- package/dist/cjs/packages/ui/dist/core-Da43q-pO.js.map +1 -0
- package/dist/cjs/packages/ui/dist/index-pAuGTbuB.js +28876 -0
- package/dist/cjs/packages/ui/dist/index-pAuGTbuB.js.map +1 -0
- package/dist/cjs/photo/FilterThumb.js +7 -5
- package/dist/cjs/photo/FilterThumb.js.map +1 -1
- package/dist/cjs/photo/NiceAITools.js +78 -32
- package/dist/cjs/photo/NiceAITools.js.map +1 -1
- package/dist/cjs/photo/PhotoEditor.js +4 -4
- package/dist/cjs/photo/PhotoEditor.js.map +1 -1
- package/dist/cjs/photo/PhotoEditorCanvas.js +56 -22
- package/dist/cjs/photo/PhotoEditorCanvas.js.map +1 -1
- package/dist/cjs/photo/PhotoEditorLeftPanel.js +106 -48
- package/dist/cjs/photo/PhotoEditorLeftPanel.js.map +1 -1
- package/dist/cjs/photo/PhotoEditorToolbar.js +2 -2
- package/dist/cjs/photo/PhotoEditorToolbar.js.map +1 -1
- package/dist/cjs/photo/photoEditorActions.js +27 -18
- package/dist/cjs/photo/photoEditorActions.js.map +1 -1
- package/dist/cjs/photo/photoFilters.js +316 -81
- package/dist/cjs/photo/photoFilters.js.map +1 -1
- package/dist/cjs/photo/photoOverlays.js +521 -165
- package/dist/cjs/photo/photoOverlays.js.map +1 -1
- package/dist/cjs/photo/photoSelection.js +69 -35
- package/dist/cjs/photo/photoSelection.js.map +1 -1
- package/dist/cjs/photo/usePhotoEditor.js +203 -97
- package/dist/cjs/photo/usePhotoEditor.js.map +1 -1
- package/dist/cjs/pixel/HSVPicker.js +32 -19
- package/dist/cjs/pixel/HSVPicker.js.map +1 -1
- package/dist/cjs/pixel/PixelEditor.js +25 -14
- package/dist/cjs/pixel/PixelEditor.js.map +1 -1
- package/dist/cjs/pixel/PixelEditorCanvas.js +2 -2
- package/dist/cjs/pixel/PixelEditorCanvas.js.map +1 -1
- package/dist/cjs/pixel/PixelEditorMenuBar.js +3 -3
- package/dist/cjs/pixel/PixelEditorMenuBar.js.map +1 -1
- package/dist/cjs/pixel/PixelEditorRightPanel.js +28 -8
- package/dist/cjs/pixel/PixelEditorRightPanel.js.map +1 -1
- package/dist/cjs/pixel/PixelEditorStatusBar.js +2 -2
- package/dist/cjs/pixel/PixelEditorStatusBar.js.map +1 -1
- package/dist/cjs/pixel/PixelEditorTimeline.js +3 -4
- package/dist/cjs/pixel/PixelEditorTimeline.js.map +1 -1
- package/dist/cjs/pixel/PixelEditorToolbar.js +3 -3
- package/dist/cjs/pixel/PixelEditorToolbar.js.map +1 -1
- package/dist/cjs/pixel/SpriteGeneratorPanel.js +136 -54
- package/dist/cjs/pixel/SpriteGeneratorPanel.js.map +1 -1
- package/dist/cjs/pixel/asepriteFormat.js +122 -38
- package/dist/cjs/pixel/asepriteFormat.js.map +1 -1
- package/dist/cjs/pixel/characterGeneratorPresets.js +208 -54
- package/dist/cjs/pixel/characterGeneratorPresets.js.map +1 -1
- package/dist/cjs/pixel/pixelEditorExports.js +42 -35
- package/dist/cjs/pixel/pixelEditorExports.js.map +1 -1
- package/dist/cjs/pixel/pixelEditorTypes.js +67 -33
- package/dist/cjs/pixel/pixelEditorTypes.js.map +1 -1
- package/dist/cjs/pixel/pixelEditorUtils.js +62 -38
- package/dist/cjs/pixel/pixelEditorUtils.js.map +1 -1
- package/dist/cjs/pixel/spriteGeneratorCore.js +47 -24
- package/dist/cjs/pixel/spriteGeneratorCore.js.map +1 -1
- package/dist/cjs/pixel/usePixelEditor.js +475 -213
- package/dist/cjs/pixel/usePixelEditor.js.map +1 -1
- package/dist/cjs/texture/Nice3DTexturePainter.js +201 -71
- package/dist/cjs/texture/Nice3DTexturePainter.js.map +1 -1
- package/dist/cjs/ui/NiceUIDesigner.js +280 -91
- package/dist/cjs/ui/NiceUIDesigner.js.map +1 -1
- package/dist/cjs/vector/NiceSvgToCode.js +96 -34
- package/dist/cjs/vector/NiceSvgToCode.js.map +1 -1
- package/dist/cjs/vector/VectorEditor.js +14 -13
- package/dist/cjs/vector/VectorEditor.js.map +1 -1
- package/dist/cjs/vector/VectorEditorMenuBar.js +7 -6
- package/dist/cjs/vector/VectorEditorMenuBar.js.map +1 -1
- package/dist/cjs/vector/VectorEditorRightPanel.js +87 -32
- package/dist/cjs/vector/VectorEditorRightPanel.js.map +1 -1
- package/dist/cjs/vector/VectorEditorShapeRenderer.js +17 -15
- package/dist/cjs/vector/VectorEditorShapeRenderer.js.map +1 -1
- package/dist/cjs/vector/VectorEditorStatusBar.js.map +1 -1
- package/dist/cjs/vector/useVectorEditor.js +312 -122
- package/dist/cjs/vector/useVectorEditor.js.map +1 -1
- package/dist/cjs/vector/vectorBooleanOps.js +60 -42
- package/dist/cjs/vector/vectorBooleanOps.js.map +1 -1
- package/dist/cjs/vector/vectorEditorExport.js +40 -34
- package/dist/cjs/vector/vectorEditorExport.js.map +1 -1
- package/dist/cjs/vector/vectorGradients.js +41 -40
- package/dist/cjs/vector/vectorGradients.js.map +1 -1
- package/dist/esm/animation/AnimatedPerson.js +69 -63
- package/dist/esm/animation/AnimatedPerson.js.map +1 -1
- package/dist/esm/animation/AnimationEditor.js +27 -20
- package/dist/esm/animation/AnimationEditor.js.map +1 -1
- package/dist/esm/animation/Audience.js +17 -11
- package/dist/esm/animation/Audience.js.map +1 -1
- package/dist/esm/animation/BodyRenderer.js +7 -7
- package/dist/esm/animation/BodyRenderer.js.map +1 -1
- package/dist/esm/animation/animationHelper.js +83 -52
- package/dist/esm/animation/animationHelper.js.map +1 -1
- package/dist/esm/animation/characterTypes.js +171 -30
- package/dist/esm/animation/characterTypes.js.map +1 -1
- package/dist/esm/animation/choreoDSL.js +114 -62
- package/dist/esm/animation/choreoDSL.js.map +1 -1
- package/dist/esm/animation/karaokeIntegration.js +10 -11
- package/dist/esm/animation/karaokeIntegration.js.map +1 -1
- package/dist/esm/animation/lottieExport.js +15 -9
- package/dist/esm/animation/lottieExport.js.map +1 -1
- package/dist/esm/animation/motionPath.js +125 -30
- package/dist/esm/animation/motionPath.js.map +1 -1
- package/dist/esm/animation/physics.js +157 -57
- package/dist/esm/animation/physics.js.map +1 -1
- package/dist/esm/animation/rig/RigPlayer.js +7 -6
- package/dist/esm/animation/rig/RigPlayer.js.map +1 -1
- package/dist/esm/animation/rig/RiggedBody.js +7 -7
- package/dist/esm/animation/rig/RiggedBody.js.map +1 -1
- package/dist/esm/animation/rig/choreoRigBridge.js +52 -29
- package/dist/esm/animation/rig/choreoRigBridge.js.map +1 -1
- package/dist/esm/animation/rig/poseOps.js +6 -3
- package/dist/esm/animation/rig/poseOps.js.map +1 -1
- package/dist/esm/animation/shapes/arms.js +7 -6
- package/dist/esm/animation/shapes/arms.js.map +1 -1
- package/dist/esm/animation/shapes/eyes.js +31 -18
- package/dist/esm/animation/shapes/eyes.js.map +1 -1
- package/dist/esm/animation/shapes/hair.js +39 -23
- package/dist/esm/animation/shapes/hair.js.map +1 -1
- package/dist/esm/animation/shapes/heads.js +47 -29
- package/dist/esm/animation/shapes/heads.js.map +1 -1
- package/dist/esm/animation/shapes/headwear.js +26 -14
- package/dist/esm/animation/shapes/headwear.js.map +1 -1
- package/dist/esm/animation/shapes/legs.js +7 -6
- package/dist/esm/animation/shapes/legs.js.map +1 -1
- package/dist/esm/animation/shapes/mouths.js +28 -18
- package/dist/esm/animation/shapes/mouths.js.map +1 -1
- package/dist/esm/animation/shapes/noses.js +18 -9
- package/dist/esm/animation/shapes/noses.js.map +1 -1
- package/dist/esm/animation/shapes/outfits.js +25 -14
- package/dist/esm/animation/shapes/outfits.js.map +1 -1
- package/dist/esm/animation/shapes/torsos.js +5 -4
- package/dist/esm/animation/shapes/torsos.js.map +1 -1
- package/dist/esm/animation/spineExport.js +33 -26
- package/dist/esm/animation/spineExport.js.map +1 -1
- package/dist/esm/core/LocalUI.js +16 -16
- package/dist/esm/core/LocalUI.js.map +1 -1
- package/dist/esm/core/NiceBrushEngine.js +205 -69
- package/dist/esm/core/NiceBrushEngine.js.map +1 -1
- package/dist/esm/core/collaboration.js +35 -21
- package/dist/esm/core/collaboration.js.map +1 -1
- package/dist/esm/core/colorBlindness.js +64 -24
- package/dist/esm/core/colorBlindness.js.map +1 -1
- package/dist/esm/core/dragDrop.js +34 -26
- package/dist/esm/core/dragDrop.js.map +1 -1
- package/dist/esm/core/fixes.js +26 -14
- package/dist/esm/core/fixes.js.map +1 -1
- package/dist/esm/core/gridGuides.js +24 -16
- package/dist/esm/core/gridGuides.js.map +1 -1
- package/dist/esm/core/historyVisual.js +42 -23
- package/dist/esm/core/historyVisual.js.map +1 -1
- package/dist/esm/core/integrations.js +65 -48
- package/dist/esm/core/integrations.js.map +1 -1
- package/dist/esm/core/minimap.js +40 -24
- package/dist/esm/core/minimap.js.map +1 -1
- package/dist/esm/core/plugins.js +10 -6
- package/dist/esm/core/plugins.js.map +1 -1
- package/dist/esm/core/rtl.js +32 -27
- package/dist/esm/core/rtl.js.map +1 -1
- package/dist/esm/core/shortcuts.js +77 -39
- package/dist/esm/core/shortcuts.js.map +1 -1
- package/dist/esm/core/theme.js +68 -61
- package/dist/esm/core/theme.js.map +1 -1
- package/dist/esm/core/yjsCollaboration.js +61 -28
- package/dist/esm/core/yjsCollaboration.js.map +1 -1
- package/dist/esm/font/NiceFontEditor.js +160 -57
- package/dist/esm/font/NiceFontEditor.js.map +1 -1
- package/dist/esm/font/fontFormatUtils.js +37 -24
- package/dist/esm/font/fontFormatUtils.js.map +1 -1
- package/dist/esm/game/GameAsset2dEditor.js +73 -60
- package/dist/esm/game/GameAsset2dEditor.js.map +1 -1
- package/dist/esm/game/gameAssetUtils.js +18 -13
- package/dist/esm/game/gameAssetUtils.js.map +1 -1
- package/dist/esm/game/useGameAssetEditor.js +160 -143
- package/dist/esm/game/useGameAssetEditor.js.map +1 -1
- package/dist/esm/icon/NiceIconEditor.js +329 -106
- package/dist/esm/icon/NiceIconEditor.js.map +1 -1
- package/dist/esm/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js +563 -0
- package/dist/esm/packages/ui/dist/NiceErrorBoundary-D75yr_WE.js.map +1 -0
- package/dist/esm/packages/ui/dist/NiceForm-CKoJA6NG.js +4960 -0
- package/dist/esm/packages/ui/dist/NiceForm-CKoJA6NG.js.map +1 -0
- package/dist/esm/packages/ui/dist/NiceModal-1QX7NhyH.js +96 -0
- package/dist/esm/packages/ui/dist/NiceModal-1QX7NhyH.js.map +1 -0
- package/dist/esm/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5201 -0
- package/dist/esm/packages/ui/dist/NiceModuleLifecyclePanel-CMrPbSw9.js.map +1 -0
- package/dist/esm/packages/ui/dist/NicePagination-DbE-uOkl.js +172 -0
- package/dist/esm/packages/ui/dist/NicePagination-DbE-uOkl.js.map +1 -0
- package/dist/esm/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js +10408 -0
- package/dist/esm/packages/ui/dist/NicePinCodeInput-B8cI8zu8.js.map +1 -0
- package/dist/esm/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6296 -0
- package/dist/esm/packages/ui/dist/NiceSavedQueryPanel-CZ5bYOe_.js.map +1 -0
- package/dist/esm/packages/ui/dist/NiceTabs-DzLHzwuA.js +1630 -0
- package/dist/esm/packages/ui/dist/NiceTabs-DzLHzwuA.js.map +1 -0
- package/dist/esm/packages/ui/dist/NiceWindow-DeC83yfE.js +796 -0
- package/dist/esm/packages/ui/dist/NiceWindow-DeC83yfE.js.map +1 -0
- package/dist/esm/packages/ui/dist/charts-BAS21jkC.js +3809 -0
- package/dist/esm/packages/ui/dist/charts-BAS21jkC.js.map +1 -0
- package/dist/esm/packages/ui/dist/core-Da43q-pO.js +11502 -0
- package/dist/esm/packages/ui/dist/core-Da43q-pO.js.map +1 -0
- package/dist/esm/packages/ui/dist/index-pAuGTbuB.js +28792 -0
- package/dist/esm/packages/ui/dist/index-pAuGTbuB.js.map +1 -0
- package/dist/esm/photo/FilterThumb.js +7 -5
- package/dist/esm/photo/FilterThumb.js.map +1 -1
- package/dist/esm/photo/NiceAITools.js +78 -32
- package/dist/esm/photo/NiceAITools.js.map +1 -1
- package/dist/esm/photo/PhotoEditor.js +4 -4
- package/dist/esm/photo/PhotoEditor.js.map +1 -1
- package/dist/esm/photo/PhotoEditorCanvas.js +56 -22
- package/dist/esm/photo/PhotoEditorCanvas.js.map +1 -1
- package/dist/esm/photo/PhotoEditorLeftPanel.js +106 -48
- package/dist/esm/photo/PhotoEditorLeftPanel.js.map +1 -1
- package/dist/esm/photo/PhotoEditorToolbar.js +2 -2
- package/dist/esm/photo/PhotoEditorToolbar.js.map +1 -1
- package/dist/esm/photo/photoEditorActions.js +27 -18
- package/dist/esm/photo/photoEditorActions.js.map +1 -1
- package/dist/esm/photo/photoFilters.js +316 -81
- package/dist/esm/photo/photoFilters.js.map +1 -1
- package/dist/esm/photo/photoOverlays.js +521 -165
- package/dist/esm/photo/photoOverlays.js.map +1 -1
- package/dist/esm/photo/photoSelection.js +69 -35
- package/dist/esm/photo/photoSelection.js.map +1 -1
- package/dist/esm/photo/usePhotoEditor.js +203 -97
- package/dist/esm/photo/usePhotoEditor.js.map +1 -1
- package/dist/esm/pixel/HSVPicker.js +32 -19
- package/dist/esm/pixel/HSVPicker.js.map +1 -1
- package/dist/esm/pixel/PixelEditor.js +25 -14
- package/dist/esm/pixel/PixelEditor.js.map +1 -1
- package/dist/esm/pixel/PixelEditorCanvas.js +2 -2
- package/dist/esm/pixel/PixelEditorCanvas.js.map +1 -1
- package/dist/esm/pixel/PixelEditorMenuBar.js +3 -3
- package/dist/esm/pixel/PixelEditorMenuBar.js.map +1 -1
- package/dist/esm/pixel/PixelEditorRightPanel.js +28 -8
- package/dist/esm/pixel/PixelEditorRightPanel.js.map +1 -1
- package/dist/esm/pixel/PixelEditorStatusBar.js +2 -2
- package/dist/esm/pixel/PixelEditorStatusBar.js.map +1 -1
- package/dist/esm/pixel/PixelEditorTimeline.js +3 -4
- package/dist/esm/pixel/PixelEditorTimeline.js.map +1 -1
- package/dist/esm/pixel/PixelEditorToolbar.js +3 -3
- package/dist/esm/pixel/PixelEditorToolbar.js.map +1 -1
- package/dist/esm/pixel/SpriteGeneratorPanel.js +136 -54
- package/dist/esm/pixel/SpriteGeneratorPanel.js.map +1 -1
- package/dist/esm/pixel/asepriteFormat.js +122 -38
- package/dist/esm/pixel/asepriteFormat.js.map +1 -1
- package/dist/esm/pixel/characterGeneratorPresets.js +208 -54
- package/dist/esm/pixel/characterGeneratorPresets.js.map +1 -1
- package/dist/esm/pixel/pixelEditorExports.js +42 -35
- package/dist/esm/pixel/pixelEditorExports.js.map +1 -1
- package/dist/esm/pixel/pixelEditorTypes.js +67 -33
- package/dist/esm/pixel/pixelEditorTypes.js.map +1 -1
- package/dist/esm/pixel/pixelEditorUtils.js +62 -38
- package/dist/esm/pixel/pixelEditorUtils.js.map +1 -1
- package/dist/esm/pixel/spriteGeneratorCore.js +47 -24
- package/dist/esm/pixel/spriteGeneratorCore.js.map +1 -1
- package/dist/esm/pixel/usePixelEditor.js +475 -213
- package/dist/esm/pixel/usePixelEditor.js.map +1 -1
- package/dist/esm/texture/Nice3DTexturePainter.js +201 -71
- package/dist/esm/texture/Nice3DTexturePainter.js.map +1 -1
- package/dist/esm/ui/NiceUIDesigner.js +280 -91
- package/dist/esm/ui/NiceUIDesigner.js.map +1 -1
- package/dist/esm/vector/NiceSvgToCode.js +96 -34
- package/dist/esm/vector/NiceSvgToCode.js.map +1 -1
- package/dist/esm/vector/VectorEditor.js +14 -13
- package/dist/esm/vector/VectorEditor.js.map +1 -1
- package/dist/esm/vector/VectorEditorMenuBar.js +7 -6
- package/dist/esm/vector/VectorEditorMenuBar.js.map +1 -1
- package/dist/esm/vector/VectorEditorRightPanel.js +87 -32
- package/dist/esm/vector/VectorEditorRightPanel.js.map +1 -1
- package/dist/esm/vector/VectorEditorShapeRenderer.js +17 -15
- package/dist/esm/vector/VectorEditorShapeRenderer.js.map +1 -1
- package/dist/esm/vector/VectorEditorStatusBar.js.map +1 -1
- package/dist/esm/vector/useVectorEditor.js +312 -122
- package/dist/esm/vector/useVectorEditor.js.map +1 -1
- package/dist/esm/vector/vectorBooleanOps.js +60 -42
- package/dist/esm/vector/vectorBooleanOps.js.map +1 -1
- package/dist/esm/vector/vectorEditorExport.js +40 -34
- package/dist/esm/vector/vectorEditorExport.js.map +1 -1
- package/dist/esm/vector/vectorGradients.js +41 -40
- package/dist/esm/vector/vectorGradients.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,56 +5,140 @@ var React = require('react');
|
|
|
5
5
|
|
|
6
6
|
// ── Component Palette ───────────────────────────────────────────
|
|
7
7
|
const COMPONENT_DEFS = [
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
{
|
|
9
|
+
type: 'Container',
|
|
10
|
+
label: 'Container',
|
|
11
|
+
icon: '📦',
|
|
12
|
+
defaultProps: {},
|
|
13
|
+
defaultStyle: { padding: 16, display: 'flex', flexDirection: 'column', gap: 8 },
|
|
14
|
+
allowChildren: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'Row',
|
|
18
|
+
label: 'Row',
|
|
19
|
+
icon: '↔️',
|
|
20
|
+
defaultProps: {},
|
|
21
|
+
defaultStyle: { display: 'flex', flexDirection: 'row', gap: 8, alignItems: 'center' },
|
|
22
|
+
allowChildren: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'Column',
|
|
26
|
+
label: 'Column',
|
|
27
|
+
icon: '↕️',
|
|
28
|
+
defaultProps: {},
|
|
29
|
+
defaultStyle: { display: 'flex', flexDirection: 'column', gap: 8 },
|
|
30
|
+
allowChildren: true,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'Text',
|
|
34
|
+
label: 'Text',
|
|
35
|
+
icon: '📝',
|
|
36
|
+
defaultProps: { text: 'Text content' },
|
|
37
|
+
defaultStyle: { fontSize: 14 },
|
|
38
|
+
allowChildren: false,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'Heading',
|
|
42
|
+
label: 'Heading',
|
|
43
|
+
icon: '🔤',
|
|
44
|
+
defaultProps: { text: 'Heading', level: 2 },
|
|
45
|
+
defaultStyle: { fontSize: 24, fontWeight: 'bold' },
|
|
46
|
+
allowChildren: false,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'Button',
|
|
50
|
+
label: 'Button',
|
|
51
|
+
icon: '🔘',
|
|
52
|
+
defaultProps: { text: 'Click me', variant: 'primary' },
|
|
53
|
+
defaultStyle: { padding: '8px 16px', borderRadius: 4, cursor: 'pointer' },
|
|
54
|
+
allowChildren: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'TextInput',
|
|
58
|
+
label: 'Input',
|
|
59
|
+
icon: '✏️',
|
|
60
|
+
defaultProps: { placeholder: 'Enter text...' },
|
|
61
|
+
defaultStyle: { padding: 8, border: '1px solid #ccc', borderRadius: 4 },
|
|
62
|
+
allowChildren: false,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'Image',
|
|
66
|
+
label: 'Image',
|
|
67
|
+
icon: '🖼️',
|
|
68
|
+
defaultProps: { src: '', alt: 'Image' },
|
|
69
|
+
defaultStyle: { width: 200, height: 150, objectFit: 'cover' },
|
|
70
|
+
allowChildren: false,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'Spacer',
|
|
74
|
+
label: 'Spacer',
|
|
75
|
+
icon: '⬜',
|
|
76
|
+
defaultProps: {},
|
|
77
|
+
defaultStyle: { height: 16 },
|
|
78
|
+
allowChildren: false,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'Divider',
|
|
82
|
+
label: 'Divider',
|
|
83
|
+
icon: '➖',
|
|
84
|
+
defaultProps: {},
|
|
85
|
+
defaultStyle: { height: 1, background: '#dee2e6', width: '100%' },
|
|
86
|
+
allowChildren: false,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'Card',
|
|
90
|
+
label: 'Card',
|
|
91
|
+
icon: '🗂️',
|
|
92
|
+
defaultProps: {},
|
|
93
|
+
defaultStyle: { padding: 16, border: '1px solid #dee2e6', borderRadius: 8, background: '#fff' },
|
|
94
|
+
allowChildren: true,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'List',
|
|
98
|
+
label: 'List',
|
|
99
|
+
icon: '📋',
|
|
100
|
+
defaultProps: { items: ['Item 1', 'Item 2', 'Item 3'] },
|
|
101
|
+
defaultStyle: { listStyleType: 'disc', paddingLeft: 20 },
|
|
102
|
+
allowChildren: false,
|
|
103
|
+
},
|
|
20
104
|
];
|
|
21
105
|
// ── Code Generation ─────────────────────────────────────────────
|
|
22
106
|
function nodeToJsx(node, indent = 2) {
|
|
23
107
|
var _a, _b, _c;
|
|
24
|
-
const pad =
|
|
108
|
+
const pad = ' '.repeat(indent);
|
|
25
109
|
const styleStr = Object.entries(node.style)
|
|
26
|
-
.map(([k, v]) => `${k}: ${typeof v ===
|
|
27
|
-
.join(
|
|
110
|
+
.map(([k, v]) => `${k}: ${typeof v === 'string' ? `"${v}"` : v}`)
|
|
111
|
+
.join(', ');
|
|
28
112
|
switch (node.type) {
|
|
29
|
-
case
|
|
113
|
+
case 'Text':
|
|
30
114
|
return `${pad}<p style={{ ${styleStr} }}>${node.props.text}</p>`;
|
|
31
|
-
case
|
|
115
|
+
case 'Heading':
|
|
32
116
|
return `${pad}<h${(_a = node.props.level) !== null && _a !== void 0 ? _a : 2} style={{ ${styleStr} }}>${node.props.text}</h${(_b = node.props.level) !== null && _b !== void 0 ? _b : 2}>`;
|
|
33
|
-
case
|
|
117
|
+
case 'Button':
|
|
34
118
|
return `${pad}<button style={{ ${styleStr} }}>${node.props.text}</button>`;
|
|
35
|
-
case
|
|
119
|
+
case 'TextInput':
|
|
36
120
|
return `${pad}<input placeholder="${node.props.placeholder}" style={{ ${styleStr} }} />`;
|
|
37
|
-
case
|
|
121
|
+
case 'Image':
|
|
38
122
|
return `${pad}<img src="${node.props.src}" alt="${node.props.alt}" style={{ ${styleStr} }} />`;
|
|
39
|
-
case
|
|
123
|
+
case 'Spacer':
|
|
40
124
|
return `${pad}<div style={{ ${styleStr} }} />`;
|
|
41
|
-
case
|
|
125
|
+
case 'Divider':
|
|
42
126
|
return `${pad}<hr style={{ ${styleStr} }} />`;
|
|
43
|
-
case
|
|
127
|
+
case 'List':
|
|
44
128
|
const items = (_c = node.props.items) !== null && _c !== void 0 ? _c : [];
|
|
45
|
-
return `${pad}<ul style={{ ${styleStr} }}>\n${items.map((i) => `${pad} <li>${i}</li>`).join(
|
|
129
|
+
return `${pad}<ul style={{ ${styleStr} }}>\n${items.map((i) => `${pad} <li>${i}</li>`).join('\n')}\n${pad}</ul>`;
|
|
46
130
|
default: {
|
|
47
|
-
const Tag = node.type ===
|
|
131
|
+
const Tag = node.type === 'Card' ? 'div' : 'div';
|
|
48
132
|
if (node.children.length === 0) {
|
|
49
133
|
return `${pad}<${Tag} style={{ ${styleStr} }} />`;
|
|
50
134
|
}
|
|
51
|
-
const kids = node.children.map((c) => nodeToJsx(c, indent + 2)).join(
|
|
135
|
+
const kids = node.children.map((c) => nodeToJsx(c, indent + 2)).join('\n');
|
|
52
136
|
return `${pad}<${Tag} style={{ ${styleStr} }}>\n${kids}\n${pad}</${Tag}>`;
|
|
53
137
|
}
|
|
54
138
|
}
|
|
55
139
|
}
|
|
56
|
-
function exportToReact(tree, componentName =
|
|
57
|
-
const body = tree.map((n) => nodeToJsx(n, 4)).join(
|
|
140
|
+
function exportToReact(tree, componentName = 'MyComponent') {
|
|
141
|
+
const body = tree.map((n) => nodeToJsx(n, 4)).join('\n');
|
|
58
142
|
return `import React from "react";\n\nexport const ${componentName}: React.FC = () => {\n return (\n <div>\n${body}\n </div>\n );\n};\n`;
|
|
59
143
|
}
|
|
60
144
|
// ── Hook ────────────────────────────────────────────────────────
|
|
@@ -66,29 +150,33 @@ function useUIDesigner() {
|
|
|
66
150
|
const pushHistory = React.useCallback((newTree) => {
|
|
67
151
|
const next = historyRef.current.slice(0, historyIdx + 1);
|
|
68
152
|
next.push(JSON.parse(JSON.stringify(newTree)));
|
|
69
|
-
if (next.length > 40)
|
|
153
|
+
if (next.length > 40) {
|
|
70
154
|
next.shift();
|
|
155
|
+
}
|
|
71
156
|
historyRef.current = next;
|
|
72
157
|
setHistoryIdx(next.length - 1);
|
|
73
158
|
}, [historyIdx]);
|
|
74
159
|
const undo = React.useCallback(() => {
|
|
75
|
-
if (historyIdx <= 0)
|
|
160
|
+
if (historyIdx <= 0) {
|
|
76
161
|
return;
|
|
162
|
+
}
|
|
77
163
|
const newIdx = historyIdx - 1;
|
|
78
164
|
setHistoryIdx(newIdx);
|
|
79
165
|
setTree(JSON.parse(JSON.stringify(historyRef.current[newIdx])));
|
|
80
166
|
}, [historyIdx]);
|
|
81
167
|
const redo = React.useCallback(() => {
|
|
82
|
-
if (historyIdx >= historyRef.current.length - 1)
|
|
168
|
+
if (historyIdx >= historyRef.current.length - 1) {
|
|
83
169
|
return;
|
|
170
|
+
}
|
|
84
171
|
const newIdx = historyIdx + 1;
|
|
85
172
|
setHistoryIdx(newIdx);
|
|
86
173
|
setTree(JSON.parse(JSON.stringify(historyRef.current[newIdx])));
|
|
87
174
|
}, [historyIdx]);
|
|
88
175
|
const addNode = React.useCallback((type, parentId) => {
|
|
89
176
|
const def = COMPONENT_DEFS.find((d) => d.type === type);
|
|
90
|
-
if (!def)
|
|
177
|
+
if (!def) {
|
|
91
178
|
return;
|
|
179
|
+
}
|
|
92
180
|
const node = {
|
|
93
181
|
id: `node-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
94
182
|
type,
|
|
@@ -111,8 +199,9 @@ function useUIDesigner() {
|
|
|
111
199
|
const newTree = removeFromTree(tree, id);
|
|
112
200
|
setTree(newTree);
|
|
113
201
|
pushHistory(newTree);
|
|
114
|
-
if (selectedId === id)
|
|
202
|
+
if (selectedId === id) {
|
|
115
203
|
setSelectedId(null);
|
|
204
|
+
}
|
|
116
205
|
}, [tree, selectedId, pushHistory]);
|
|
117
206
|
const updateNode = React.useCallback((id, updates) => {
|
|
118
207
|
const newTree = updateInTree(tree, id, updates);
|
|
@@ -122,8 +211,9 @@ function useUIDesigner() {
|
|
|
122
211
|
const moveNode = React.useCallback((id, newParentId, index) => {
|
|
123
212
|
// Find the node, remove it from current position, insert at new position
|
|
124
213
|
const node = findInTree(tree, id);
|
|
125
|
-
if (!node)
|
|
214
|
+
if (!node) {
|
|
126
215
|
return;
|
|
216
|
+
}
|
|
127
217
|
let newTree = removeFromTree(tree, id);
|
|
128
218
|
if (newParentId) {
|
|
129
219
|
newTree = addToParent(newTree, newParentId, node, index);
|
|
@@ -140,11 +230,17 @@ function useUIDesigner() {
|
|
|
140
230
|
pushHistory(newTree);
|
|
141
231
|
}, [tree, pushHistory]);
|
|
142
232
|
return {
|
|
143
|
-
tree,
|
|
144
|
-
|
|
145
|
-
|
|
233
|
+
tree,
|
|
234
|
+
setTree,
|
|
235
|
+
selectedId,
|
|
236
|
+
setSelectedId,
|
|
237
|
+
addNode,
|
|
238
|
+
removeNode,
|
|
239
|
+
updateNode,
|
|
240
|
+
moveNode,
|
|
146
241
|
exportCode: () => exportToReact(tree),
|
|
147
|
-
undo,
|
|
242
|
+
undo,
|
|
243
|
+
redo,
|
|
148
244
|
canUndo: historyIdx > 0,
|
|
149
245
|
canRedo: historyIdx < historyRef.current.length - 1,
|
|
150
246
|
};
|
|
@@ -171,11 +267,13 @@ function removeFromTree(nodes, id) {
|
|
|
171
267
|
}
|
|
172
268
|
function findInTree(nodes, id) {
|
|
173
269
|
for (const n of nodes) {
|
|
174
|
-
if (n.id === id)
|
|
270
|
+
if (n.id === id) {
|
|
175
271
|
return n;
|
|
272
|
+
}
|
|
176
273
|
const found = findInTree(n.children, id);
|
|
177
|
-
if (found)
|
|
274
|
+
if (found) {
|
|
178
275
|
return found;
|
|
276
|
+
}
|
|
179
277
|
}
|
|
180
278
|
return null;
|
|
181
279
|
}
|
|
@@ -193,10 +291,10 @@ function updateInTree(nodes, id, updates) {
|
|
|
193
291
|
}
|
|
194
292
|
// ── Component ───────────────────────────────────────────────────
|
|
195
293
|
/** Visual drag & drop UI builder that generates React code. */
|
|
196
|
-
const NiceUIDesigner = ({ onChange, onExport, className =
|
|
294
|
+
const NiceUIDesigner = ({ onChange, onExport, className = '', }) => {
|
|
197
295
|
var _a, _b, _c, _d, _e, _f;
|
|
198
296
|
const designer = useUIDesigner();
|
|
199
|
-
const [breakpoint, setBreakpoint] = React.useState(
|
|
297
|
+
const [breakpoint, setBreakpoint] = React.useState('desktop');
|
|
200
298
|
const [dragType, setDragType] = React.useState(null);
|
|
201
299
|
const [showCode, setShowCode] = React.useState(false);
|
|
202
300
|
React.useEffect(() => {
|
|
@@ -205,30 +303,40 @@ const NiceUIDesigner = ({ onChange, onExport, className = "", }) => {
|
|
|
205
303
|
// Keyboard shortcuts
|
|
206
304
|
React.useEffect(() => {
|
|
207
305
|
const handler = (e) => {
|
|
208
|
-
if (e.ctrlKey && e.key ===
|
|
306
|
+
if (e.ctrlKey && e.key === 'z') {
|
|
209
307
|
e.preventDefault();
|
|
210
308
|
designer.undo();
|
|
211
309
|
}
|
|
212
|
-
if (e.ctrlKey && e.key ===
|
|
310
|
+
if (e.ctrlKey && e.key === 'y') {
|
|
213
311
|
e.preventDefault();
|
|
214
312
|
designer.redo();
|
|
215
313
|
}
|
|
216
|
-
if (e.key ===
|
|
314
|
+
if (e.key === 'Delete' && designer.selectedId) {
|
|
217
315
|
designer.removeNode(designer.selectedId);
|
|
218
316
|
}
|
|
219
317
|
};
|
|
220
|
-
window.addEventListener(
|
|
221
|
-
return () => window.removeEventListener(
|
|
318
|
+
window.addEventListener('keydown', handler);
|
|
319
|
+
return () => window.removeEventListener('keydown', handler);
|
|
222
320
|
}, [designer]);
|
|
223
|
-
const canvasWidth = breakpoint ===
|
|
321
|
+
const canvasWidth = breakpoint === 'mobile' ? 375 : breakpoint === 'tablet' ? 768 : '100%';
|
|
224
322
|
const selectedNode = designer.selectedId ? findInTree(designer.tree, designer.selectedId) : null;
|
|
225
323
|
const btnStyle = (active) => ({
|
|
226
|
-
padding:
|
|
227
|
-
|
|
324
|
+
padding: '4px 8px',
|
|
325
|
+
border: 'none',
|
|
326
|
+
borderRadius: 3,
|
|
327
|
+
cursor: 'pointer',
|
|
328
|
+
fontSize: 11,
|
|
329
|
+
background: active ? '#339af0' : '#2c2e33',
|
|
330
|
+
color: active ? '#fff' : '#c1c2c5',
|
|
228
331
|
});
|
|
229
332
|
const fieldStyle = {
|
|
230
|
-
width:
|
|
231
|
-
|
|
333
|
+
width: '100%',
|
|
334
|
+
padding: '2px 4px',
|
|
335
|
+
background: '#2c2e33',
|
|
336
|
+
color: '#c1c2c5',
|
|
337
|
+
border: '1px solid #373a40',
|
|
338
|
+
borderRadius: 3,
|
|
339
|
+
fontSize: 10,
|
|
232
340
|
};
|
|
233
341
|
const handleDrop = (e, parentId) => {
|
|
234
342
|
e.preventDefault();
|
|
@@ -246,56 +354,137 @@ const NiceUIDesigner = ({ onChange, onExport, className = "", }) => {
|
|
|
246
354
|
var _a, _b, _c, _d;
|
|
247
355
|
const isSelected = designer.selectedId === node.id;
|
|
248
356
|
const def = COMPONENT_DEFS.find((d) => d.type === node.type);
|
|
249
|
-
return (jsxRuntime.jsxs("div", { onClick: (e) => {
|
|
357
|
+
return (jsxRuntime.jsxs("div", { onClick: (e) => {
|
|
358
|
+
e.stopPropagation();
|
|
359
|
+
designer.setSelectedId(node.id);
|
|
360
|
+
}, onDrop: (e) => ((def === null || def === void 0 ? void 0 : def.allowChildren) ? handleDrop(e, node.id) : undefined), onDragOver: (def === null || def === void 0 ? void 0 : def.allowChildren) ? handleDragOver : undefined, style: {
|
|
250
361
|
...node.style,
|
|
251
|
-
outline: isSelected ?
|
|
362
|
+
outline: isSelected ? '2px solid #339af0' : '1px dashed rgba(0,0,0,0.1)',
|
|
252
363
|
outlineOffset: 1,
|
|
253
364
|
minHeight: 24,
|
|
254
|
-
position:
|
|
255
|
-
cursor:
|
|
256
|
-
}, children: [node.type ===
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
365
|
+
position: 'relative',
|
|
366
|
+
cursor: 'pointer',
|
|
367
|
+
}, children: [node.type === 'Text' || node.type === 'Heading' ? (String((_a = node.props.text) !== null && _a !== void 0 ? _a : '')) : node.type === 'Button' ? (jsxRuntime.jsx("button", { style: { pointerEvents: 'none' }, children: String((_b = node.props.text) !== null && _b !== void 0 ? _b : 'Button') })) : node.type === 'TextInput' ? (jsxRuntime.jsx("input", { placeholder: String((_c = node.props.placeholder) !== null && _c !== void 0 ? _c : ''), readOnly: true, style: { pointerEvents: 'none', ...node.style } })) : node.type === 'Image' ? (jsxRuntime.jsx("div", { style: {
|
|
368
|
+
width: '100%',
|
|
369
|
+
height: '100%',
|
|
370
|
+
background: '#e9ecef',
|
|
371
|
+
display: 'flex',
|
|
372
|
+
alignItems: 'center',
|
|
373
|
+
justifyContent: 'center',
|
|
374
|
+
color: '#868e96',
|
|
375
|
+
fontSize: 11,
|
|
376
|
+
}, children: "\uD83D\uDDBC\uFE0F Image" })) : node.type === 'List' ? (jsxRuntime.jsx("ul", { style: { margin: 0, ...node.style }, children: ((_d = node.props.items) !== null && _d !== void 0 ? _d : []).map((item, i) => (jsxRuntime.jsx("li", { children: item }, i))) })) : node.type === 'Divider' ? (jsxRuntime.jsx("hr", { style: { margin: 0, border: 'none', borderTop: '1px solid #dee2e6', width: '100%' } })) : (node.children.map((c) => renderNode(c, depth + 1))), isSelected && (jsxRuntime.jsx("div", { style: {
|
|
377
|
+
position: 'absolute',
|
|
378
|
+
top: -12,
|
|
379
|
+
left: 0,
|
|
380
|
+
fontSize: 9,
|
|
381
|
+
background: '#339af0',
|
|
382
|
+
color: '#fff',
|
|
383
|
+
padding: '0 4px',
|
|
384
|
+
borderRadius: '2px 2px 0 0',
|
|
385
|
+
}, children: node.type }))] }, node.id));
|
|
269
386
|
};
|
|
270
387
|
const renderTreeItem = (node, depth = 0) => {
|
|
271
388
|
const def = COMPONENT_DEFS.find((d) => d.type === node.type);
|
|
272
389
|
return (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("div", { onClick: () => designer.setSelectedId(node.id), style: {
|
|
273
|
-
padding:
|
|
274
|
-
|
|
275
|
-
|
|
390
|
+
padding: '2px 4px',
|
|
391
|
+
paddingLeft: 4 + depth * 12,
|
|
392
|
+
fontSize: 10,
|
|
393
|
+
cursor: 'pointer',
|
|
394
|
+
display: 'flex',
|
|
395
|
+
alignItems: 'center',
|
|
396
|
+
gap: 4,
|
|
397
|
+
background: designer.selectedId === node.id ? 'rgba(51,154,240,0.2)' : 'transparent',
|
|
276
398
|
borderRadius: 2,
|
|
277
|
-
}, children: [jsxRuntime.jsx("span", { children: def === null || def === void 0 ? void 0 : def.icon }), jsxRuntime.jsxs("span", { style: { flex: 1, overflow:
|
|
399
|
+
}, children: [jsxRuntime.jsx("span", { children: def === null || def === void 0 ? void 0 : def.icon }), jsxRuntime.jsxs("span", { style: { flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: [node.type, node.props.text ? `: ${String(node.props.text).slice(0, 15)}` : ''] })] }), node.children.map((c) => renderTreeItem(c, depth + 1))] }, node.id));
|
|
278
400
|
};
|
|
279
|
-
return (jsxRuntime.jsxs("div", { className: `nice-ui-designer ${className}`, style: {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
401
|
+
return (jsxRuntime.jsxs("div", { className: `nice-ui-designer ${className}`, style: {
|
|
402
|
+
display: 'flex',
|
|
403
|
+
gap: 8,
|
|
404
|
+
height: '100%',
|
|
405
|
+
background: '#1a1b1e',
|
|
406
|
+
color: '#c1c2c5',
|
|
407
|
+
padding: 8,
|
|
408
|
+
borderRadius: 8,
|
|
409
|
+
}, children: [jsxRuntime.jsxs("div", { style: { width: 160, display: 'flex', flexDirection: 'column', gap: 8, fontSize: 11 }, children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { style: { fontSize: 12, display: 'block', marginBottom: 4 }, children: "Components" }), jsxRuntime.jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 2 }, children: COMPONENT_DEFS.map((def) => (jsxRuntime.jsxs("button", { draggable: true, onDragStart: () => setDragType(def.type), onDragEnd: () => setDragType(null), onClick: () => { var _a; return designer.addNode(def.type, (_a = designer.selectedId) !== null && _a !== void 0 ? _a : undefined); }, style: {
|
|
410
|
+
display: 'flex',
|
|
411
|
+
alignItems: 'center',
|
|
412
|
+
gap: 4,
|
|
413
|
+
padding: '4px 6px',
|
|
414
|
+
background: '#2c2e33',
|
|
415
|
+
border: 'none',
|
|
416
|
+
borderRadius: 3,
|
|
417
|
+
color: '#c1c2c5',
|
|
418
|
+
cursor: 'grab',
|
|
419
|
+
textAlign: 'left',
|
|
420
|
+
fontSize: 11,
|
|
421
|
+
}, children: [def.icon, " ", def.label] }, def.type))) })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { style: { fontSize: 12, display: 'block', marginBottom: 4 }, children: "Tree" }), jsxRuntime.jsx("div", { style: { maxHeight: 200, overflowY: 'auto' }, children: designer.tree.length === 0 ? (jsxRuntime.jsx("div", { style: { color: '#5c5f66', padding: 4 }, children: "Empty" })) : (designer.tree.map((n) => renderTreeItem(n))) })] })] }), jsxRuntime.jsxs("div", { style: { flex: 1, display: 'flex', flexDirection: 'column', gap: 4 }, children: [jsxRuntime.jsxs("div", { style: { display: 'flex', gap: 4, alignItems: 'center', fontSize: 11 }, children: [jsxRuntime.jsx("button", { onClick: () => designer.undo(), disabled: !designer.canUndo, style: { ...btnStyle(false), opacity: designer.canUndo ? 1 : 0.4 }, title: "Undo (Ctrl+Z)", children: "\u21A9" }), jsxRuntime.jsx("button", { onClick: () => designer.redo(), disabled: !designer.canRedo, style: { ...btnStyle(false), opacity: designer.canRedo ? 1 : 0.4 }, title: "Redo (Ctrl+Y)", children: "\u21AA" }), jsxRuntime.jsx("div", { style: { width: 1, height: 16, background: '#373a40' } }), jsxRuntime.jsx("button", { onClick: () => setBreakpoint('desktop'), style: btnStyle(breakpoint === 'desktop'), children: "\uD83D\uDDA5 Desktop" }), jsxRuntime.jsx("button", { onClick: () => setBreakpoint('tablet'), style: btnStyle(breakpoint === 'tablet'), children: "\uD83D\uDCF1 Tablet" }), jsxRuntime.jsx("button", { onClick: () => setBreakpoint('mobile'), style: btnStyle(breakpoint === 'mobile'), children: "\uD83D\uDCF2 Mobile" }), jsxRuntime.jsx("div", { style: { flex: 1 } }), designer.selectedId && (jsxRuntime.jsx("button", { onClick: () => designer.removeNode(designer.selectedId), style: { ...btnStyle(false), color: '#ff6b6b' }, children: "\uD83D\uDDD1 Delete" })), jsxRuntime.jsxs("button", { onClick: () => setShowCode((v) => !v), style: btnStyle(showCode), children: ['</>', " Code"] }), jsxRuntime.jsx("button", { onClick: () => onExport === null || onExport === void 0 ? void 0 : onExport(designer.exportCode()), style: {
|
|
422
|
+
padding: '4px 8px',
|
|
423
|
+
background: '#228be6',
|
|
424
|
+
color: '#fff',
|
|
425
|
+
border: 'none',
|
|
426
|
+
borderRadius: 3,
|
|
427
|
+
cursor: 'pointer',
|
|
428
|
+
fontSize: 11,
|
|
429
|
+
}, children: "Export" })] }), showCode ? (jsxRuntime.jsx("pre", { style: {
|
|
430
|
+
flex: 1,
|
|
431
|
+
background: '#141517',
|
|
432
|
+
borderRadius: 6,
|
|
433
|
+
padding: 12,
|
|
434
|
+
margin: 0,
|
|
435
|
+
overflow: 'auto',
|
|
436
|
+
fontSize: 11,
|
|
437
|
+
color: '#a6e3a1',
|
|
438
|
+
fontFamily: 'monospace',
|
|
439
|
+
}, children: designer.exportCode() })) : (jsxRuntime.jsx("div", { style: {
|
|
440
|
+
flex: 1,
|
|
441
|
+
background: '#fff',
|
|
442
|
+
borderRadius: 6,
|
|
443
|
+
padding: 16,
|
|
444
|
+
overflow: 'auto',
|
|
445
|
+
color: '#212529',
|
|
446
|
+
maxWidth: canvasWidth,
|
|
447
|
+
margin: breakpoint !== 'desktop' ? '0 auto' : undefined,
|
|
448
|
+
border: breakpoint !== 'desktop' ? '1px solid #373a40' : undefined,
|
|
449
|
+
transition: 'max-width 0.2s',
|
|
450
|
+
}, onDrop: (e) => handleDrop(e), onDragOver: handleDragOver, children: designer.tree.length === 0 ? (jsxRuntime.jsx("div", { style: { textAlign: 'center', padding: 40, color: '#868e96' }, children: "Drag or click a component to add it" })) : (designer.tree.map((n) => renderNode(n))) }))] }), jsxRuntime.jsxs("div", { style: {
|
|
451
|
+
width: 200,
|
|
452
|
+
fontSize: 11,
|
|
453
|
+
display: 'flex',
|
|
454
|
+
flexDirection: 'column',
|
|
455
|
+
gap: 4,
|
|
456
|
+
overflowY: 'auto',
|
|
457
|
+
}, children: [jsxRuntime.jsx("strong", { style: { fontSize: 12 }, children: "Properties" }), selectedNode ? (jsxRuntime.jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 6 }, children: [jsxRuntime.jsxs("div", { style: { color: '#868e96' }, children: [(_a = COMPONENT_DEFS.find((d) => d.type === selectedNode.type)) === null || _a === void 0 ? void 0 : _a.icon, " ", selectedNode.type] }), selectedNode.props.text !== undefined && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "Text" }), jsxRuntime.jsx("input", { value: String(selectedNode.props.text), onChange: (e) => designer.updateNode(selectedNode.id, { props: { text: e.target.value } }), style: fieldStyle })] })), selectedNode.props.placeholder !== undefined && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "Placeholder" }), jsxRuntime.jsx("input", { value: String(selectedNode.props.placeholder), onChange: (e) => designer.updateNode(selectedNode.id, { props: { placeholder: e.target.value } }), style: fieldStyle })] })), selectedNode.props.level !== undefined && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "Heading Level" }), jsxRuntime.jsx("select", { value: Number(selectedNode.props.level), onChange: (e) => designer.updateNode(selectedNode.id, {
|
|
458
|
+
props: { level: Number(e.target.value) },
|
|
459
|
+
}), style: fieldStyle, children: [1, 2, 3, 4, 5, 6].map((v) => (jsxRuntime.jsxs("option", { value: v, children: ["H", v] }, v))) })] })), selectedNode.props.variant !== undefined && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "Variant" }), jsxRuntime.jsx("select", { value: String(selectedNode.props.variant), onChange: (e) => designer.updateNode(selectedNode.id, { props: { variant: e.target.value } }), style: fieldStyle, children: ['primary', 'secondary', 'outline', 'ghost'].map((v) => (jsxRuntime.jsx("option", { value: v, children: v }, v))) })] })), selectedNode.props.src !== undefined && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "Image URL" }), jsxRuntime.jsx("input", { value: String(selectedNode.props.src), onChange: (e) => designer.updateNode(selectedNode.id, { props: { src: e.target.value } }), style: fieldStyle })] })), selectedNode.props.alt !== undefined && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("label", { children: "Alt Text" }), jsxRuntime.jsx("input", { value: String(selectedNode.props.alt), onChange: (e) => designer.updateNode(selectedNode.id, { props: { alt: e.target.value } }), style: fieldStyle })] })), jsxRuntime.jsx("hr", { style: { border: 'none', borderTop: '1px solid #373a40', margin: '4px 0' } }), jsxRuntime.jsx("strong", { style: { color: '#868e96' }, children: "Style" }), ['padding', 'margin', 'gap', 'borderRadius'].map((prop) => (jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: prop }), jsxRuntime.jsx("input", { type: "number", value: typeof selectedNode.style[prop] === 'number'
|
|
460
|
+
? selectedNode.style[prop]
|
|
461
|
+
: 0, onChange: (e) => designer.updateNode(selectedNode.id, {
|
|
462
|
+
style: { [prop]: Number(e.target.value) },
|
|
463
|
+
}), style: { ...fieldStyle, width: 50 } })] }, prop))), jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "fontSize" }), jsxRuntime.jsx("input", { type: "number", value: typeof selectedNode.style.fontSize === 'number' ? selectedNode.style.fontSize : 14, onChange: (e) => designer.updateNode(selectedNode.id, {
|
|
464
|
+
style: { fontSize: Number(e.target.value) },
|
|
465
|
+
}), style: { ...fieldStyle, width: 50 } })] }), jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "color" }), jsxRuntime.jsx("input", { type: "color", value: typeof selectedNode.style.color === 'string'
|
|
466
|
+
? selectedNode.style.color
|
|
467
|
+
: '#000000', onChange: (e) => designer.updateNode(selectedNode.id, { style: { color: e.target.value } }), style: { width: 24, height: 20, border: 'none', cursor: 'pointer' } })] }), jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "bgColor" }), jsxRuntime.jsx("input", { type: "color", value: typeof selectedNode.style.background === 'string'
|
|
468
|
+
? selectedNode.style.background
|
|
469
|
+
: '#ffffff', onChange: (e) => designer.updateNode(selectedNode.id, { style: { background: e.target.value } }), style: { width: 24, height: 20, border: 'none', cursor: 'pointer' } })] }), selectedNode.style.display === 'flex' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "direction" }), jsxRuntime.jsxs("select", { value: (_b = selectedNode.style.flexDirection) !== null && _b !== void 0 ? _b : 'column', onChange: (e) => designer.updateNode(selectedNode.id, {
|
|
470
|
+
style: {
|
|
471
|
+
flexDirection: e.target.value,
|
|
472
|
+
},
|
|
473
|
+
}), style: { ...fieldStyle, width: 80 }, children: [jsxRuntime.jsx("option", { value: "row", children: "row" }), jsxRuntime.jsx("option", { value: "column", children: "column" })] })] }), jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "align" }), jsxRuntime.jsx("select", { value: (_c = selectedNode.style.alignItems) !== null && _c !== void 0 ? _c : 'stretch', onChange: (e) => designer.updateNode(selectedNode.id, {
|
|
474
|
+
style: { alignItems: e.target.value },
|
|
475
|
+
}), style: { ...fieldStyle, width: 80 }, children: ['stretch', 'center', 'flex-start', 'flex-end'].map((v) => (jsxRuntime.jsx("option", { value: v, children: v }, v))) })] }), jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "justify" }), jsxRuntime.jsx("select", { value: (_d = selectedNode.style.justifyContent) !== null && _d !== void 0 ? _d : 'flex-start', onChange: (e) => designer.updateNode(selectedNode.id, {
|
|
476
|
+
style: { justifyContent: e.target.value },
|
|
477
|
+
}), style: { ...fieldStyle, width: 80 }, children: ['flex-start', 'center', 'flex-end', 'space-between', 'space-around'].map((v) => (jsxRuntime.jsx("option", { value: v, children: v }, v))) })] })] })), jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "width" }), jsxRuntime.jsx("input", { value: (_e = selectedNode.style.width) !== null && _e !== void 0 ? _e : '', placeholder: "auto", onChange: (e) => {
|
|
293
478
|
const v = e.target.value;
|
|
294
|
-
designer.updateNode(selectedNode.id, {
|
|
295
|
-
|
|
479
|
+
designer.updateNode(selectedNode.id, {
|
|
480
|
+
style: { width: isNaN(Number(v)) ? v : Number(v) },
|
|
481
|
+
});
|
|
482
|
+
}, style: { ...fieldStyle, width: 60 } })] }), jsxRuntime.jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [jsxRuntime.jsx("label", { style: { minWidth: 60 }, children: "height" }), jsxRuntime.jsx("input", { value: (_f = selectedNode.style.height) !== null && _f !== void 0 ? _f : '', placeholder: "auto", onChange: (e) => {
|
|
296
483
|
const v = e.target.value;
|
|
297
|
-
designer.updateNode(selectedNode.id, {
|
|
298
|
-
|
|
484
|
+
designer.updateNode(selectedNode.id, {
|
|
485
|
+
style: { height: isNaN(Number(v)) ? v : Number(v) },
|
|
486
|
+
});
|
|
487
|
+
}, style: { ...fieldStyle, width: 60 } })] })] })) : (jsxRuntime.jsx("div", { style: { color: '#5c5f66', padding: 8, textAlign: 'center' }, children: "Select an element" }))] })] }));
|
|
299
488
|
};
|
|
300
489
|
|
|
301
490
|
exports.NiceUIDesigner = NiceUIDesigner;
|