@aivex/ui 1.2.0-dev.48 → 1.2.0-dev.49
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/README.md +25 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/comment.cjs +1 -5
- package/dist/comment.js +4 -316
- package/dist/components/Avatar/Avatar.cjs +2 -0
- package/dist/components/Avatar/Avatar.cjs.map +1 -0
- package/dist/components/Avatar/Avatar.js +105 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Badge/Badge.cjs +2 -0
- package/dist/components/Badge/Badge.cjs.map +1 -0
- package/dist/components/Badge/Badge.js +232 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/BreadCrumb/BreadCrumb.cjs +2 -0
- package/dist/components/BreadCrumb/BreadCrumb.cjs.map +1 -0
- package/dist/components/BreadCrumb/BreadCrumb.d.ts +3 -1
- package/dist/components/BreadCrumb/BreadCrumb.js +100 -0
- package/dist/components/BreadCrumb/BreadCrumb.js.map +1 -0
- package/dist/components/Button/Button.cjs +2 -0
- package/dist/components/Button/Button.cjs.map +1 -0
- package/dist/components/Button/Button.js +123 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Calendar/Calendar.cjs +2 -0
- package/dist/components/Calendar/Calendar.cjs.map +1 -0
- package/dist/components/Calendar/Calendar.js +103 -0
- package/dist/components/Calendar/Calendar.js.map +1 -0
- package/dist/components/Calendar/date.cjs +2 -0
- package/dist/components/Calendar/date.cjs.map +1 -0
- package/dist/components/Calendar/date.js +33 -0
- package/dist/components/Calendar/date.js.map +1 -0
- package/dist/components/Card/Card.cjs +2 -0
- package/dist/components/Card/Card.cjs.map +1 -0
- package/dist/components/Card/Card.d.ts +6 -2
- package/dist/components/Card/Card.js +30 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.cjs +2 -0
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/Checkbox/Checkbox.js +59 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/ChipsCheckbox.cjs +2 -0
- package/dist/components/Checkbox/ChipsCheckbox.cjs.map +1 -0
- package/dist/components/Checkbox/ChipsCheckbox.d.ts +5 -3
- package/dist/components/Checkbox/ChipsCheckbox.js +45 -0
- package/dist/components/Checkbox/ChipsCheckbox.js.map +1 -0
- package/dist/components/Coachmark/Coachmark.cjs +2 -0
- package/dist/components/Coachmark/Coachmark.cjs.map +1 -0
- package/dist/components/Coachmark/Coachmark.d.ts +3 -1
- package/dist/components/Coachmark/Coachmark.js +102 -0
- package/dist/components/Coachmark/Coachmark.js.map +1 -0
- package/dist/components/Comment/CommentInput.cjs +2 -0
- package/dist/components/Comment/CommentInput.cjs.map +1 -0
- package/dist/components/Comment/CommentInput.js +75 -0
- package/dist/components/Comment/CommentInput.js.map +1 -0
- package/dist/components/Comment/CommentPin.cjs +2 -0
- package/dist/components/Comment/CommentPin.cjs.map +1 -0
- package/dist/components/Comment/CommentPin.js +31 -0
- package/dist/components/Comment/CommentPin.js.map +1 -0
- package/dist/components/Comment/MentionInput.cjs +2 -0
- package/dist/components/Comment/MentionInput.cjs.map +1 -0
- package/dist/components/Comment/MentionInput.js +78 -0
- package/dist/components/Comment/MentionInput.js.map +1 -0
- package/dist/components/Comment/MentionList.cjs +2 -0
- package/dist/components/Comment/MentionList.cjs.map +1 -0
- package/dist/components/Comment/MentionList.d.ts +6 -1
- package/dist/components/Comment/MentionList.js +97 -0
- package/dist/components/Comment/MentionList.js.map +1 -0
- package/dist/components/Comment/mentionContent.cjs +5 -0
- package/dist/components/Comment/mentionContent.cjs.map +1 -0
- package/dist/components/Comment/mentionContent.js +40 -0
- package/dist/components/Comment/mentionContent.js.map +1 -0
- package/dist/components/Comment/useMentionSuggestion.cjs +2 -0
- package/dist/components/Comment/useMentionSuggestion.cjs.map +1 -0
- package/dist/components/Comment/useMentionSuggestion.js +68 -0
- package/dist/components/Comment/useMentionSuggestion.js.map +1 -0
- package/dist/components/DataGrid/DataGrid.cjs +2 -0
- package/dist/components/DataGrid/DataGrid.cjs.map +1 -0
- package/dist/components/DataGrid/DataGrid.js +187 -0
- package/dist/components/DataGrid/DataGrid.js.map +1 -0
- package/dist/components/DataGrid/DataGridColumnSettings.cjs +2 -0
- package/dist/components/DataGrid/DataGridColumnSettings.cjs.map +1 -0
- package/dist/components/DataGrid/DataGridColumnSettings.d.ts +6 -1
- package/dist/components/DataGrid/DataGridColumnSettings.js +186 -0
- package/dist/components/DataGrid/DataGridColumnSettings.js.map +1 -0
- package/dist/components/DataGrid/DataGridPrimitives.cjs +2 -0
- package/dist/components/DataGrid/DataGridPrimitives.cjs.map +1 -0
- package/dist/components/DataGrid/DataGridPrimitives.js +137 -0
- package/dist/components/DataGrid/DataGridPrimitives.js.map +1 -0
- package/dist/components/DataGrid/DataGridRows.cjs +2 -0
- package/dist/components/DataGrid/DataGridRows.cjs.map +1 -0
- package/dist/components/DataGrid/DataGridRows.js +108 -0
- package/dist/components/DataGrid/DataGridRows.js.map +1 -0
- package/dist/components/DataGrid/index.js +6 -0
- package/dist/components/Dialog/Dialog.cjs +2 -0
- package/dist/components/Dialog/Dialog.cjs.map +1 -0
- package/dist/components/Dialog/Dialog.js +97 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Divider/Divider.cjs +2 -0
- package/dist/components/Divider/Divider.cjs.map +1 -0
- package/dist/components/Divider/Divider.js +58 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/DraggableScroll/DraggableScroll.cjs +2 -0
- package/dist/components/DraggableScroll/DraggableScroll.cjs.map +1 -0
- package/dist/components/DraggableScroll/DraggableScroll.js +45 -0
- package/dist/components/DraggableScroll/DraggableScroll.js.map +1 -0
- package/dist/components/Drawer/Drawer.cjs +2 -0
- package/dist/components/Drawer/Drawer.cjs.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +8 -1
- package/dist/components/Drawer/Drawer.js +44 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Field/Field.cjs +2 -0
- package/dist/components/Field/Field.cjs.map +1 -0
- package/dist/components/Field/Field.js +90 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/FilterModal/FilterModal.cjs +2 -0
- package/dist/components/FilterModal/FilterModal.cjs.map +1 -0
- package/dist/components/FilterModal/FilterModal.js +119 -0
- package/dist/components/FilterModal/FilterModal.js.map +1 -0
- package/dist/components/Icon/index.cjs +2 -0
- package/dist/components/Icon/index.cjs.map +1 -0
- package/dist/components/Icon/index.d.ts +1982 -284
- package/dist/components/Icon/index.js +4415 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Icon/svgA11y.cjs +2 -0
- package/dist/components/Icon/svgA11y.cjs.map +1 -0
- package/dist/components/Icon/svgA11y.d.ts +10 -0
- package/dist/components/Icon/svgA11y.js +9 -0
- package/dist/components/Icon/svgA11y.js.map +1 -0
- package/dist/components/Icon/uniqueSvgIds.cjs +2 -0
- package/dist/components/Icon/uniqueSvgIds.cjs.map +1 -0
- package/dist/components/Icon/uniqueSvgIds.d.ts +8 -0
- package/dist/components/Icon/uniqueSvgIds.js +42 -0
- package/dist/components/Icon/uniqueSvgIds.js.map +1 -0
- package/dist/components/IconButton/IconButton.cjs +2 -0
- package/dist/components/IconButton/IconButton.cjs.map +1 -0
- package/dist/components/IconButton/IconButton.js +70 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/InputBase/InputBase.cjs +2 -0
- package/dist/components/InputBase/InputBase.cjs.map +1 -0
- package/dist/components/InputBase/InputBase.js +87 -0
- package/dist/components/InputBase/InputBase.js.map +1 -0
- package/dist/components/InputBase/useInputState.cjs +2 -0
- package/dist/components/InputBase/useInputState.cjs.map +1 -0
- package/dist/components/InputBase/useInputState.d.ts +19 -0
- package/dist/components/InputBase/useInputState.js +25 -0
- package/dist/components/InputBase/useInputState.js.map +1 -0
- package/dist/components/InteractionLayer/InteractionLayer.cjs +2 -0
- package/dist/components/InteractionLayer/InteractionLayer.cjs.map +1 -0
- package/dist/components/InteractionLayer/InteractionLayer.js +17 -0
- package/dist/components/InteractionLayer/InteractionLayer.js.map +1 -0
- package/dist/components/Logo/index.cjs +2 -0
- package/dist/components/Logo/index.cjs.map +1 -0
- package/dist/components/Logo/index.d.ts +42 -12
- package/dist/components/Logo/index.js +1464 -0
- package/dist/components/Logo/index.js.map +1 -0
- package/dist/components/Menu/Menu.cjs +2 -0
- package/dist/components/Menu/Menu.cjs.map +1 -0
- package/dist/components/Menu/Menu.js +194 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Messagebox/Messagebox.cjs +2 -0
- package/dist/components/Messagebox/Messagebox.cjs.map +1 -0
- package/dist/components/Messagebox/Messagebox.d.ts +9 -3
- package/dist/components/Messagebox/Messagebox.js +84 -0
- package/dist/components/Messagebox/Messagebox.js.map +1 -0
- package/dist/components/Messagebox/index.d.ts +1 -1
- package/dist/components/Modal/Modal.cjs +2 -0
- package/dist/components/Modal/Modal.cjs.map +1 -0
- package/dist/components/Modal/Modal.js +196 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/ModalBase.cjs +2 -0
- package/dist/components/Modal/ModalBase.cjs.map +1 -0
- package/dist/components/Modal/ModalBase.js +32 -0
- package/dist/components/Modal/ModalBase.js.map +1 -0
- package/dist/components/Nav/Nav.cjs +2 -0
- package/dist/components/Nav/Nav.cjs.map +1 -0
- package/dist/components/Nav/Nav.js +73 -0
- package/dist/components/Nav/Nav.js.map +1 -0
- package/dist/components/Overlay/Overlay.cjs +2 -0
- package/dist/components/Overlay/Overlay.cjs.map +1 -0
- package/dist/components/Overlay/Overlay.d.ts +12 -4
- package/dist/components/Overlay/Overlay.js +24 -0
- package/dist/components/Overlay/Overlay.js.map +1 -0
- package/dist/components/Overlay/index.d.ts +1 -1
- package/dist/components/Pagination/Pagination.cjs +2 -0
- package/dist/components/Pagination/Pagination.cjs.map +1 -0
- package/dist/components/Pagination/Pagination.d.ts +3 -2
- package/dist/components/Pagination/Pagination.js +113 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Panel/Panel.cjs +2 -0
- package/dist/components/Panel/Panel.cjs.map +1 -0
- package/dist/components/Panel/Panel.js +55 -0
- package/dist/components/Panel/Panel.js.map +1 -0
- package/dist/components/Popover/Popover.cjs +2 -0
- package/dist/components/Popover/Popover.cjs.map +1 -0
- package/dist/components/Popover/Popover.d.ts +9 -2
- package/dist/components/Popover/Popover.js +75 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.cjs +2 -0
- package/dist/components/ProgressBar/ProgressBar.cjs.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.js +41 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/Radio/Radio.cjs +2 -0
- package/dist/components/Radio/Radio.cjs.map +1 -0
- package/dist/components/Radio/Radio.js +52 -0
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.cjs +2 -0
- package/dist/components/ScrollArea/ScrollArea.cjs.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.js +42 -0
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/components/Segmented/Segmented.cjs +2 -0
- package/dist/components/Segmented/Segmented.cjs.map +1 -0
- package/dist/components/Segmented/Segmented.js +61 -0
- package/dist/components/Segmented/Segmented.js.map +1 -0
- package/dist/components/SelectBox/SelectBox.cjs +2 -0
- package/dist/components/SelectBox/SelectBox.cjs.map +1 -0
- package/dist/components/SelectBox/SelectBox.d.ts +6 -2
- package/dist/components/SelectBox/SelectBox.js +72 -0
- package/dist/components/SelectBox/SelectBox.js.map +1 -0
- package/dist/components/SelectButton/SelectButton.cjs +2 -0
- package/dist/components/SelectButton/SelectButton.cjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.js +43 -0
- package/dist/components/SelectButton/SelectButton.js.map +1 -0
- package/dist/components/ShapeEditor/ShapeEditor.cjs +2 -0
- package/dist/components/ShapeEditor/ShapeEditor.cjs.map +1 -0
- package/dist/components/ShapeEditor/ShapeEditor.d.ts +1 -1
- package/dist/components/ShapeEditor/ShapeEditor.js +585 -0
- package/dist/components/ShapeEditor/ShapeEditor.js.map +1 -0
- package/dist/components/ShapeEditor/ShapeViewer.cjs +2 -0
- package/dist/components/ShapeEditor/ShapeViewer.cjs.map +1 -0
- package/dist/components/ShapeEditor/ShapeViewer.js +299 -0
- package/dist/components/ShapeEditor/ShapeViewer.js.map +1 -0
- package/dist/components/ShapeEditor/_components/AssistantOverlay.cjs +2 -0
- package/dist/components/ShapeEditor/_components/AssistantOverlay.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/AssistantOverlay.js +64 -0
- package/dist/components/ShapeEditor/_components/AssistantOverlay.js.map +1 -0
- package/dist/components/ShapeEditor/_components/ContextMenu.cjs +2 -0
- package/dist/components/ShapeEditor/_components/ContextMenu.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/ContextMenu.js +67 -0
- package/dist/components/ShapeEditor/_components/ContextMenu.js.map +1 -0
- package/dist/components/ShapeEditor/_components/CursorGuide.cjs +2 -0
- package/dist/components/ShapeEditor/_components/CursorGuide.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/CursorGuide.js +56 -0
- package/dist/components/ShapeEditor/_components/CursorGuide.js.map +1 -0
- package/dist/components/ShapeEditor/_components/ImageStateOverlay.cjs +2 -0
- package/dist/components/ShapeEditor/_components/ImageStateOverlay.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/ImageStateOverlay.js +90 -0
- package/dist/components/ShapeEditor/_components/ImageStateOverlay.js.map +1 -0
- package/dist/components/ShapeEditor/_components/Minimap.cjs +2 -0
- package/dist/components/ShapeEditor/_components/Minimap.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/Minimap.d.ts +1 -2
- package/dist/components/ShapeEditor/_components/Minimap.js +175 -0
- package/dist/components/ShapeEditor/_components/Minimap.js.map +1 -0
- package/dist/components/ShapeEditor/_components/MinimapShape.cjs +2 -0
- package/dist/components/ShapeEditor/_components/MinimapShape.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/MinimapShape.js +55 -0
- package/dist/components/ShapeEditor/_components/MinimapShape.js.map +1 -0
- package/dist/components/ShapeEditor/_components/RegionOverlay.cjs +2 -0
- package/dist/components/ShapeEditor/_components/RegionOverlay.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/RegionOverlay.js +59 -0
- package/dist/components/ShapeEditor/_components/RegionOverlay.js.map +1 -0
- package/dist/components/ShapeEditor/_components/SelectionInfo.cjs +2 -0
- package/dist/components/ShapeEditor/_components/SelectionInfo.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/SelectionInfo.js +115 -0
- package/dist/components/ShapeEditor/_components/SelectionInfo.js.map +1 -0
- package/dist/components/ShapeEditor/_components/SettingsPanel.cjs +2 -0
- package/dist/components/ShapeEditor/_components/SettingsPanel.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/SettingsPanel.d.ts +2 -4
- package/dist/components/ShapeEditor/_components/SettingsPanel.js +167 -0
- package/dist/components/ShapeEditor/_components/SettingsPanel.js.map +1 -0
- package/dist/components/ShapeEditor/_constants.cjs +2 -0
- package/dist/components/ShapeEditor/_constants.cjs.map +1 -0
- package/dist/components/ShapeEditor/_constants.js +7 -0
- package/dist/components/ShapeEditor/_constants.js.map +1 -0
- package/dist/components/ShapeEditor/_model/brush.cjs +2 -0
- package/dist/components/ShapeEditor/_model/brush.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/brush.js +27 -0
- package/dist/components/ShapeEditor/_model/brush.js.map +1 -0
- package/dist/components/ShapeEditor/_model/clipboard.cjs +2 -0
- package/dist/components/ShapeEditor/_model/clipboard.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/clipboard.js +85 -0
- package/dist/components/ShapeEditor/_model/clipboard.js.map +1 -0
- package/dist/components/ShapeEditor/_model/cursors.cjs +2 -0
- package/dist/components/ShapeEditor/_model/cursors.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/cursors.js +52 -0
- package/dist/components/ShapeEditor/_model/cursors.js.map +1 -0
- package/dist/components/ShapeEditor/_model/geometry.cjs +2 -0
- package/dist/components/ShapeEditor/_model/geometry.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/geometry.js +431 -0
- package/dist/components/ShapeEditor/_model/geometry.js.map +1 -0
- package/dist/components/ShapeEditor/_model/imageDiagnosis.cjs +2 -0
- package/dist/components/ShapeEditor/_model/imageDiagnosis.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/imageDiagnosis.d.ts +2 -0
- package/dist/components/ShapeEditor/_model/imageDiagnosis.js +138 -0
- package/dist/components/ShapeEditor/_model/imageDiagnosis.js.map +1 -0
- package/dist/components/ShapeEditor/_model/imageLoad.cjs +2 -0
- package/dist/components/ShapeEditor/_model/imageLoad.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/imageLoad.js +68 -0
- package/dist/components/ShapeEditor/_model/imageLoad.js.map +1 -0
- package/dist/components/ShapeEditor/_model/imageTiles.cjs +2 -0
- package/dist/components/ShapeEditor/_model/imageTiles.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/imageTiles.js +28 -0
- package/dist/components/ShapeEditor/_model/imageTiles.js.map +1 -0
- package/dist/components/ShapeEditor/_model/keymap.cjs +2 -0
- package/dist/components/ShapeEditor/_model/keymap.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/keymap.js +75 -0
- package/dist/components/ShapeEditor/_model/keymap.js.map +1 -0
- package/dist/components/ShapeEditor/_model/overlays.cjs +2 -0
- package/dist/components/ShapeEditor/_model/overlays.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/overlays.d.ts +0 -4
- package/dist/components/ShapeEditor/_model/overlays.js +186 -0
- package/dist/components/ShapeEditor/_model/overlays.js.map +1 -0
- package/dist/components/ShapeEditor/_model/pinIcon.cjs +2 -0
- package/dist/components/ShapeEditor/_model/pinIcon.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/pinIcon.js +10 -0
- package/dist/components/ShapeEditor/_model/pinIcon.js.map +1 -0
- package/dist/components/ShapeEditor/_model/polygonFill.cjs +2 -0
- package/dist/components/ShapeEditor/_model/polygonFill.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/polygonFill.js +12 -0
- package/dist/components/ShapeEditor/_model/polygonFill.js.map +1 -0
- package/dist/components/ShapeEditor/_model/props.d.ts +8 -491
- package/dist/components/ShapeEditor/_model/scalarMask.cjs +2 -0
- package/dist/components/ShapeEditor/_model/scalarMask.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/scalarMask.js +188 -0
- package/dist/components/ShapeEditor/_model/scalarMask.js.map +1 -0
- package/dist/components/ShapeEditor/_model/shapeHitTest.cjs +2 -0
- package/dist/components/ShapeEditor/_model/shapeHitTest.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/shapeHitTest.d.ts +5 -0
- package/dist/components/ShapeEditor/_model/shapeHitTest.js +38 -0
- package/dist/components/ShapeEditor/_model/shapeHitTest.js.map +1 -0
- package/dist/components/ShapeEditor/_model/shapeRenderStyle.cjs +2 -0
- package/dist/components/ShapeEditor/_model/shapeRenderStyle.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/shapeRenderStyle.js +19 -0
- package/dist/components/ShapeEditor/_model/shapeRenderStyle.js.map +1 -0
- package/dist/components/ShapeEditor/_model/strings.cjs +2 -0
- package/dist/components/ShapeEditor/_model/strings.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/strings.js +92 -0
- package/dist/components/ShapeEditor/_model/strings.js.map +1 -0
- package/dist/components/ShapeEditor/_model/tools.cjs +2 -0
- package/dist/components/ShapeEditor/_model/tools.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/tools.js +19 -0
- package/dist/components/ShapeEditor/_model/tools.js.map +1 -0
- package/dist/components/ShapeEditor/_model/types/assistant.d.ts +35 -0
- package/dist/components/ShapeEditor/_model/types/handle.d.ts +98 -0
- package/dist/components/ShapeEditor/_model/types/props.d.ts +367 -0
- package/dist/components/ShapeEditor/_model/viewSettings.cjs +2 -0
- package/dist/components/ShapeEditor/_model/viewSettings.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/viewSettings.d.ts +2 -0
- package/dist/components/ShapeEditor/_model/viewSettings.js +57 -0
- package/dist/components/ShapeEditor/_model/viewSettings.js.map +1 -0
- package/dist/components/ShapeEditor/_model/viewerPatch.cjs +2 -0
- package/dist/components/ShapeEditor/_model/viewerPatch.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/viewerPatch.js +57 -0
- package/dist/components/ShapeEditor/_model/viewerPatch.js.map +1 -0
- package/dist/components/ShapeEditor/_model/viewport.cjs +2 -0
- package/dist/components/ShapeEditor/_model/viewport.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/viewport.d.ts +9 -1
- package/dist/components/ShapeEditor/_model/viewport.js +79 -0
- package/dist/components/ShapeEditor/_model/viewport.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/PixiRenderer.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/PixiRenderer.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/PixiRenderer.d.ts +13 -75
- package/dist/components/ShapeEditor/_renderers/PixiRenderer.js +305 -0
- package/dist/components/ShapeEditor/_renderers/PixiRenderer.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/imageLayer.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/imageLayer.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/imageLayer.d.ts +35 -0
- package/dist/components/ShapeEditor/_renderers/imageLayer.js +59 -0
- package/dist/components/ShapeEditor/_renderers/imageLayer.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/overlayLayer.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/overlayLayer.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/overlayLayer.d.ts +36 -0
- package/dist/components/ShapeEditor/_renderers/overlayLayer.js +65 -0
- package/dist/components/ShapeEditor/_renderers/overlayLayer.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/previewLayer.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/previewLayer.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/previewLayer.d.ts +32 -0
- package/dist/components/ShapeEditor/_renderers/previewLayer.js +109 -0
- package/dist/components/ShapeEditor/_renderers/previewLayer.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/shapeLayer.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/shapeLayer.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/shapeLayer.d.ts +49 -0
- package/dist/components/ShapeEditor/_renderers/shapeLayer.js +94 -0
- package/dist/components/ShapeEditor/_renderers/shapeLayer.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/shapePainter.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/shapePainter.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/shapePainter.d.ts +27 -0
- package/dist/components/ShapeEditor/_renderers/shapePainter.js +166 -0
- package/dist/components/ShapeEditor/_renderers/shapePainter.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/transformDriver.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/transformDriver.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/transformDriver.js +94 -0
- package/dist/components/ShapeEditor/_renderers/transformDriver.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/transformSession.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/transformSession.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/transformSession.js +135 -0
- package/dist/components/ShapeEditor/_renderers/transformSession.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/transformerLayer.cjs +2 -0
- package/dist/components/ShapeEditor/_renderers/transformerLayer.cjs.map +1 -0
- package/dist/components/ShapeEditor/_renderers/transformerLayer.d.ts +69 -0
- package/dist/components/ShapeEditor/_renderers/transformerLayer.js +248 -0
- package/dist/components/ShapeEditor/_renderers/transformerLayer.js.map +1 -0
- package/dist/components/ShapeEditor/_renderers/types.d.ts +2 -7
- package/dist/components/ShapeEditor/_state/buildContextMenuItems.cjs +2 -0
- package/dist/components/ShapeEditor/_state/buildContextMenuItems.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/buildContextMenuItems.js +118 -0
- package/dist/components/ShapeEditor/_state/buildContextMenuItems.js.map +1 -0
- package/dist/components/ShapeEditor/_state/buildHotkeyActions.cjs +2 -0
- package/dist/components/ShapeEditor/_state/buildHotkeyActions.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/buildHotkeyActions.js +86 -0
- package/dist/components/ShapeEditor/_state/buildHotkeyActions.js.map +1 -0
- package/dist/components/ShapeEditor/_state/createInteractionController.cjs +2 -0
- package/dist/components/ShapeEditor/_state/createInteractionController.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/createInteractionController.js +396 -0
- package/dist/components/ShapeEditor/_state/createInteractionController.js.map +1 -0
- package/dist/components/ShapeEditor/_state/drawSessionState.cjs +2 -0
- package/dist/components/ShapeEditor/_state/drawSessionState.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/drawSessionState.js +21 -0
- package/dist/components/ShapeEditor/_state/drawSessionState.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useAssistant.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useAssistant.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useAssistant.js +171 -0
- package/dist/components/ShapeEditor/_state/useAssistant.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useDrawSession.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useDrawSession.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useDrawSession.js +352 -0
- package/dist/components/ShapeEditor/_state/useDrawSession.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorDocument.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useEditorDocument.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorDocument.js +143 -0
- package/dist/components/ShapeEditor/_state/useEditorDocument.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorHandle.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useEditorHandle.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorHandle.d.ts +34 -0
- package/dist/components/ShapeEditor/_state/useEditorHandle.js +95 -0
- package/dist/components/ShapeEditor/_state/useEditorHandle.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorHotkeys.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useEditorHotkeys.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorHotkeys.js +44 -0
- package/dist/components/ShapeEditor/_state/useEditorHotkeys.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorView.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useEditorView.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useEditorView.d.ts +15 -0
- package/dist/components/ShapeEditor/_state/useEditorView.js +45 -0
- package/dist/components/ShapeEditor/_state/useEditorView.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.d.ts +2 -2
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.js +125 -0
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useLatestRef.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useLatestRef.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useLatestRef.js +13 -0
- package/dist/components/ShapeEditor/_state/useLatestRef.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useMinimapNavigation.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useMinimapNavigation.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useMinimapNavigation.js +118 -0
- package/dist/components/ShapeEditor/_state/useMinimapNavigation.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useMinimapSync.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useMinimapSync.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useMinimapSync.js +69 -0
- package/dist/components/ShapeEditor/_state/useMinimapSync.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useSelectionActions.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useSelectionActions.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useSelectionActions.js +151 -0
- package/dist/components/ShapeEditor/_state/useSelectionActions.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useSelectionInfoOverlay.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useSelectionInfoOverlay.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useSelectionInfoOverlay.js +64 -0
- package/dist/components/ShapeEditor/_state/useSelectionInfoOverlay.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useSelectionModel.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useSelectionModel.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useSelectionModel.d.ts +24 -0
- package/dist/components/ShapeEditor/_state/useSelectionModel.js +58 -0
- package/dist/components/ShapeEditor/_state/useSelectionModel.js.map +1 -0
- package/dist/components/ShapeEditor/_state/useViewportControls.cjs +2 -0
- package/dist/components/ShapeEditor/_state/useViewportControls.cjs.map +1 -0
- package/dist/components/ShapeEditor/_state/useViewportControls.js +79 -0
- package/dist/components/ShapeEditor/_state/useViewportControls.js.map +1 -0
- package/dist/components/ShapeEditor/index.d.ts +0 -1
- package/dist/components/Shortcut/Shortcut.cjs +2 -0
- package/dist/components/Shortcut/Shortcut.cjs.map +1 -0
- package/dist/components/Shortcut/Shortcut.js +22 -0
- package/dist/components/Shortcut/Shortcut.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.cjs +2 -0
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +17 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Slider/Slider.cjs +2 -0
- package/dist/components/Slider/Slider.cjs.map +1 -0
- package/dist/components/Slider/Slider.js +69 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Spinner/Spinner.cjs +2 -0
- package/dist/components/Spinner/Spinner.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.js +27 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Switch/Switch.cjs +2 -0
- package/dist/components/Switch/Switch.cjs.map +1 -0
- package/dist/components/Switch/Switch.js +45 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Tab/Tab.cjs +2 -0
- package/dist/components/Tab/Tab.cjs.map +1 -0
- package/dist/components/Tab/Tab.js +39 -0
- package/dist/components/Tab/Tab.js.map +1 -0
- package/dist/components/Tag/Tag.cjs +2 -0
- package/dist/components/Tag/Tag.cjs.map +1 -0
- package/dist/components/Tag/Tag.d.ts +6 -3
- package/dist/components/Tag/Tag.js +60 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Tag/index.d.ts +1 -1
- package/dist/components/Tagbox/Tagbox.cjs +2 -0
- package/dist/components/Tagbox/Tagbox.cjs.map +1 -0
- package/dist/components/Tagbox/Tagbox.d.ts +5 -3
- package/dist/components/Tagbox/Tagbox.js +85 -0
- package/dist/components/Tagbox/Tagbox.js.map +1 -0
- package/dist/components/Textarea/Textarea.cjs +2 -0
- package/dist/components/Textarea/Textarea.cjs.map +1 -0
- package/dist/components/Textarea/Textarea.js +55 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Textbox/Textbox.cjs +2 -0
- package/dist/components/Textbox/Textbox.cjs.map +1 -0
- package/dist/components/Textbox/Textbox.d.ts +9 -4
- package/dist/components/Textbox/Textbox.js +59 -0
- package/dist/components/Textbox/Textbox.js.map +1 -0
- package/dist/components/Textbox/index.d.ts +1 -1
- package/dist/components/Toast/Toast.cjs +2 -0
- package/dist/components/Toast/Toast.cjs.map +1 -0
- package/dist/components/Toast/Toast.d.ts +7 -3
- package/dist/components/Toast/Toast.js +81 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/ToggleButton/ToggleButton.cjs +2 -0
- package/dist/components/ToggleButton/ToggleButton.cjs.map +1 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +5 -2
- package/dist/components/ToggleButton/ToggleButton.js +117 -0
- package/dist/components/ToggleButton/ToggleButton.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.cjs +2 -0
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +51 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Typography/Typography.cjs +2 -0
- package/dist/components/Typography/Typography.cjs.map +1 -0
- package/dist/components/Typography/Typography.js +59 -0
- package/dist/components/Typography/Typography.js.map +1 -0
- package/dist/components/UploadArea/UploadArea.cjs +2 -0
- package/dist/components/UploadArea/UploadArea.cjs.map +1 -0
- package/dist/components/UploadArea/UploadArea.js +100 -0
- package/dist/components/UploadArea/UploadArea.js.map +1 -0
- package/dist/fonts.css +4 -0
- package/dist/index.cjs +1 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +57 -4614
- package/dist/shape-editor.cjs +1 -2
- package/dist/shape-editor.js +7 -6202
- package/dist/styles.css +3 -1
- package/dist/tokens/tokens.css +18 -2
- package/dist/utils/keyboard.cjs +2 -0
- package/dist/utils/keyboard.cjs.map +1 -0
- package/dist/utils/keyboard.js +14 -0
- package/dist/utils/keyboard.js.map +1 -0
- package/dist/utils/useControllableState.cjs +2 -0
- package/dist/utils/useControllableState.cjs.map +1 -0
- package/dist/utils/useControllableState.d.ts +17 -0
- package/dist/utils/useControllableState.js +13 -0
- package/dist/utils/useControllableState.js.map +1 -0
- package/dist/utils/useModalAutoFocus.cjs +2 -0
- package/dist/utils/useModalAutoFocus.cjs.map +1 -0
- package/dist/utils/useModalAutoFocus.d.ts +7 -1
- package/dist/utils/useModalAutoFocus.js +22 -0
- package/dist/utils/useModalAutoFocus.js.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/package.json +6 -2
- package/dist/Button-CNdJSINB.js +0 -7065
- package/dist/Button-CNdJSINB.js.map +0 -1
- package/dist/Button-DI8Fzb0u.cjs +0 -2
- package/dist/Button-DI8Fzb0u.cjs.map +0 -1
- package/dist/IconButton-CQyt0J6s.js +0 -209
- package/dist/IconButton-CQyt0J6s.js.map +0 -1
- package/dist/IconButton-bfbqZDue.cjs +0 -2
- package/dist/IconButton-bfbqZDue.cjs.map +0 -1
- package/dist/comment.cjs.map +0 -1
- package/dist/comment.js.map +0 -1
- package/dist/components/Calendar/Calendar.test.d.ts +0 -1
- package/dist/components/Calendar/date.test.d.ts +0 -1
- package/dist/components/Chips/index.d.ts +0 -19
- package/dist/components/Comment/mentionContent.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/clipboard.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/cursors.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/geometry.evenodd-audit.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/geometry.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/imageDiagnosis.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/imageLoad.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/overlays.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/shapeHitTest.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/viewSettings.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_model/viewerPatch.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_renderers/transformDriver.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_renderers/transformSession.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_state/createInteractionController.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_state/editorActions.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.test.d.ts +0 -1
- package/dist/components/Table/Table.d.ts +0 -71
- package/dist/components/Table/index.d.ts +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keyboard-BPY-Ro06.cjs +0 -2
- package/dist/keyboard-BPY-Ro06.cjs.map +0 -1
- package/dist/keyboard-DvUDhDqH.js +0 -408
- package/dist/keyboard-DvUDhDqH.js.map +0 -1
- package/dist/shape-editor.cjs.map +0 -1
- package/dist/shape-editor.js.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { EditorShape, Point } from "../geometry";
|
|
2
|
+
import type { RegionMask } from "../overlays";
|
|
3
|
+
import type { BrushScalarMode } from "../tools";
|
|
4
|
+
export type DrawSessionKind = "none" | "brush" | "polygon" | "path";
|
|
5
|
+
export interface DrawSessionChange {
|
|
6
|
+
active: boolean;
|
|
7
|
+
kind: DrawSessionKind;
|
|
8
|
+
canUndo: boolean;
|
|
9
|
+
canRedo: boolean;
|
|
10
|
+
brush?: {
|
|
11
|
+
mode: BrushScalarMode;
|
|
12
|
+
editing: boolean;
|
|
13
|
+
editTargetIds: string[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 호스트가 에디터에 명령을 보내는 창구. 모든 변경은 에디터 히스토리에 쌓여 undo 가능.
|
|
18
|
+
*/
|
|
19
|
+
export interface ShapeEditorHandle<TMeta = unknown> {
|
|
20
|
+
/**
|
|
21
|
+
* 드래그·드로잉 중 고빈도 오버레이 프리뷰 — regionMask prop(React 왕복)을 우회해
|
|
22
|
+
* 렌더러에 즉시 반영한다(같은 프레임 보장). null이면 prop 기반 오버레이로 복귀.
|
|
23
|
+
* 문서 상태의 진실은 여전히 regionMask prop — 커밋 후 prop 갱신이 이 값을 덮어쓴다.
|
|
24
|
+
*/
|
|
25
|
+
previewRegionMask: (regionMask: RegionMask | null) => void;
|
|
26
|
+
/** 문서 undo. 그리기 세션이 있으면 `undoSession`이 우선. */
|
|
27
|
+
undo: () => void;
|
|
28
|
+
/** 문서 redo. 그리기 세션이 있으면 `redoSession`이 우선. */
|
|
29
|
+
redo: () => void;
|
|
30
|
+
canUndo: () => boolean;
|
|
31
|
+
canRedo: () => boolean;
|
|
32
|
+
/** 그리기 세션(붓·폴리곤·패스) 내 undo — 세션 없으면 false. */
|
|
33
|
+
undoSession: () => boolean;
|
|
34
|
+
redoSession: () => boolean;
|
|
35
|
+
canUndoSession: () => boolean;
|
|
36
|
+
canRedoSession: () => boolean;
|
|
37
|
+
hasDraftSession: () => boolean;
|
|
38
|
+
/** Esc — 그리기 세션 취소. */
|
|
39
|
+
cancelDraftSession: () => void;
|
|
40
|
+
/** Enter — 그리기 세션 확정(붓·폴리곤). */
|
|
41
|
+
commitDraftSession: () => boolean;
|
|
42
|
+
setSelection: (ids: string[]) => void;
|
|
43
|
+
/** 호스트發 생성(예: 레이블 어시스턴트 결과). locked면 적용 없이 onLockedInteraction. */
|
|
44
|
+
createShapes: (shapes: EditorShape<TMeta>[]) => void;
|
|
45
|
+
/** 호스트發 수정(예: 선택 라벨의 클래스/색 변경). locked면 적용 없이 onLockedInteraction. */
|
|
46
|
+
updateShapes: (shapes: EditorShape<TMeta>[]) => void;
|
|
47
|
+
/** locked면 적용 없이 onLockedInteraction. */
|
|
48
|
+
deleteShapes: (ids: string[]) => void;
|
|
49
|
+
getShapes: () => EditorShape<TMeta>[];
|
|
50
|
+
/** 전체 선택. */
|
|
51
|
+
selectAll: () => void;
|
|
52
|
+
/** 선택 해제. */
|
|
53
|
+
clearSelection: () => void;
|
|
54
|
+
/** 선택 도형 삭제. */
|
|
55
|
+
deleteSelection: () => void;
|
|
56
|
+
/** 선택 도형을 시스템 클립보드에 복사. 사용할 수 없으면 같은 탭 메모리로 대체한다. */
|
|
57
|
+
copySelection: () => void;
|
|
58
|
+
/** 시스템/메모리 클립보드 도형 붙여넣기. 좌표 지정 시 중심을 맞추고, 미지정 시 캐스케이드. */
|
|
59
|
+
paste: (at?: Point) => void;
|
|
60
|
+
/** 선택 도형 복제. */
|
|
61
|
+
duplicate: () => void;
|
|
62
|
+
/** 선택 도형 맨 앞으로. */
|
|
63
|
+
bringToFront: () => void;
|
|
64
|
+
/** 선택 도형 맨 뒤로. */
|
|
65
|
+
sendToBack: () => void;
|
|
66
|
+
/** 줌: 이미지 전체 맞춤. */
|
|
67
|
+
zoomFit: () => void;
|
|
68
|
+
/** 줌: 100%. */
|
|
69
|
+
zoom100: () => void;
|
|
70
|
+
/** 줌: 화면 중심 기준 확대/축소(호스트 줌 버튼용). */
|
|
71
|
+
zoomIn: () => void;
|
|
72
|
+
zoomOut: () => void;
|
|
73
|
+
/** 줌: 선택 영역 맞춤(애니메이션). */
|
|
74
|
+
zoomToSelection: () => void;
|
|
75
|
+
/** 줌: 지정 도형(레이블)으로 이동(애니메이션, 기존 Editor `handleZoomTo`). */
|
|
76
|
+
zoomToShapes: (ids: string[], duration?: number) => void;
|
|
77
|
+
/** 줌: bbox로 이동(애니메이션). */
|
|
78
|
+
zoomToBounds: (bounds: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
width: number;
|
|
82
|
+
height: number;
|
|
83
|
+
}, duration?: number) => void;
|
|
84
|
+
/** 붓 도구 전용 명령 묶음(도구 특화라 네임스페이스로 분리). */
|
|
85
|
+
brush: {
|
|
86
|
+
/** 서브모드 — 그리기/지우기. */
|
|
87
|
+
setScalarMode: (mode: BrushScalarMode) => void;
|
|
88
|
+
getScalarMode: () => BrushScalarMode;
|
|
89
|
+
/** 붓 스트로크가 누적 중인지. */
|
|
90
|
+
hasSession: () => boolean;
|
|
91
|
+
/** Enter — 마스크를 폴리곤(들)로 확정. */
|
|
92
|
+
commit: () => boolean;
|
|
93
|
+
/** Esc — 붓 세션 취소. */
|
|
94
|
+
cancel: () => void;
|
|
95
|
+
/** 선택 도형을 베이스 마스크로 붓 편집 시작. 붓 도구일 때만. */
|
|
96
|
+
beginEditFromSelection: () => boolean;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ShapeEditor의 공개 계약(props).
|
|
3
|
+
*
|
|
4
|
+
* 에디터가 **자기 도형 문서와 undo/redo 히스토리를 소유**한다(tldraw/Excalidraw 식).
|
|
5
|
+
* 전역 zustand 스토어가 아니라 컴포넌트 로컬 상태라 멀티 인스턴스 안전. 호스트는
|
|
6
|
+
* `initialShapes`로 시드하고, 변경은 이벤트로 받아 영속화하며, 호스트發 수정은
|
|
7
|
+
* 명령형 핸들(ShapeEditorHandle)로 요청한다.
|
|
8
|
+
*
|
|
9
|
+
* 클래스/라벨 개념은 없다 — 색은 style, 분류는 meta(불투명), 새 도형 스타일/메타는
|
|
10
|
+
* draftStyle/draftMeta로 호스트가 주입한다. id는 에디터가 클라이언트 생성한다.
|
|
11
|
+
*/
|
|
12
|
+
import type { ReactNode, Ref } from "react";
|
|
13
|
+
import type { EditorShape, Point, ShapeInteraction, ShapeStyle } from "../geometry";
|
|
14
|
+
import type { EditorImageDiagnosis } from "../imageDiagnosis";
|
|
15
|
+
import type { KeymapOverrides } from "../keymap";
|
|
16
|
+
import type { RegionMask } from "../overlays";
|
|
17
|
+
import type { EditorStringsOverride } from "../strings";
|
|
18
|
+
import type { Tool } from "../tools";
|
|
19
|
+
import type { ViewSettingItemKey, ViewSettings } from "../viewSettings";
|
|
20
|
+
import type { EditorAssistant } from "./assistant";
|
|
21
|
+
import type { DrawSessionChange, ShapeEditorHandle } from "./handle";
|
|
22
|
+
export interface EditorOverlayMarker<TMeta = unknown> {
|
|
23
|
+
id: string;
|
|
24
|
+
point: Point;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
selected?: boolean;
|
|
27
|
+
meta?: TMeta;
|
|
28
|
+
/**
|
|
29
|
+
* 앵커점을 마커 콘텐츠의 어디에 맞출지. "center"(기본)=중앙, "topLeft"=좌상단 원점.
|
|
30
|
+
* 코멘트 핀처럼 특정 모서리(뾰족한 끝)로 위치를 가리켜야 하는 마커는 "topLeft"를 쓰고
|
|
31
|
+
* 콘텐츠에서 오프셋으로 원하는 모서리를 원점에 맞춘다. 확대/축소 시에도 그 점이 고정된다.
|
|
32
|
+
*/
|
|
33
|
+
anchor?: "center" | "topLeft";
|
|
34
|
+
}
|
|
35
|
+
/** 우클릭 컨텍스트 메뉴 항목(도메인 무관). */
|
|
36
|
+
export type ContextMenuItem = {
|
|
37
|
+
/** 기본 항목 식별자(예: "delete"). 호스트는 라벨 문자열 대신 이걸로 필터링한다. */
|
|
38
|
+
id?: string;
|
|
39
|
+
label: string;
|
|
40
|
+
onClick: () => void;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
danger?: boolean;
|
|
43
|
+
shortcut?: string;
|
|
44
|
+
/** 라벨 왼쪽에 표시할 아이콘(예: AI 어시스트 항목의 마법봉). */
|
|
45
|
+
icon?: ReactNode;
|
|
46
|
+
} | {
|
|
47
|
+
separator: true;
|
|
48
|
+
};
|
|
49
|
+
export interface EditorPointerEvent {
|
|
50
|
+
pointerId?: number;
|
|
51
|
+
button?: number;
|
|
52
|
+
shiftKey?: boolean;
|
|
53
|
+
altKey?: boolean;
|
|
54
|
+
ctrlKey?: boolean;
|
|
55
|
+
metaKey?: boolean;
|
|
56
|
+
global?: Point;
|
|
57
|
+
insideCanvas?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface EditorCanvasViewport {
|
|
60
|
+
scale: number;
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
}
|
|
64
|
+
export interface EditorExternalToolContext {
|
|
65
|
+
point: Point;
|
|
66
|
+
targetId?: string | null;
|
|
67
|
+
event: EditorPointerEvent;
|
|
68
|
+
readOnly?: boolean;
|
|
69
|
+
viewport: EditorCanvasViewport;
|
|
70
|
+
}
|
|
71
|
+
export interface EditorExternalTool {
|
|
72
|
+
id: string;
|
|
73
|
+
cursor?: string;
|
|
74
|
+
onPointerDown?: (ctx: EditorExternalToolContext) => void;
|
|
75
|
+
onPointerMove?: (ctx: EditorExternalToolContext) => void;
|
|
76
|
+
onPointerUp?: (ctx: EditorExternalToolContext) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Esc 처리. false를 반환하면 "취소할 것이 없었다"는 뜻으로 Esc 사슬이 계속
|
|
79
|
+
* 진행된다(선택 해제 → 툴 SELECT 복귀 등). void/true는 소비로 간주.
|
|
80
|
+
*/
|
|
81
|
+
onCancel?: () => boolean | void;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 선택 도형의 동적 정보(에디터 계산). 표시 텍스트는 호스트가 formatSelectionInfo로 결정.
|
|
85
|
+
* 좌표/크기는 이미지 픽셀 단위(뷰포트 줌과 무관).
|
|
86
|
+
*/
|
|
87
|
+
export interface EditorSelectionInfo<TMeta = unknown> {
|
|
88
|
+
shape: EditorShape<TMeta>;
|
|
89
|
+
/** bbox 좌상단 x (이미지 px). */
|
|
90
|
+
x: number;
|
|
91
|
+
/** bbox 좌상단 y (이미지 px). */
|
|
92
|
+
y: number;
|
|
93
|
+
/** bbox 너비 (이미지 px). */
|
|
94
|
+
width: number;
|
|
95
|
+
/** bbox 높이 (이미지 px). */
|
|
96
|
+
height: number;
|
|
97
|
+
}
|
|
98
|
+
/** 편집 문서(시드 계약). id 변경=문서 전환, 같은 id의 URL 변경=화질 스왑. */
|
|
99
|
+
export interface ShapeEditorDocument<TMeta = unknown> {
|
|
100
|
+
/**
|
|
101
|
+
* 문서 identity — 전환/스왑 판정의 유일한 기준. URL은 identity가 아니다
|
|
102
|
+
* (다른 문서가 같은 URL을, 같은 문서가 다른 URL을 가질 수 있음).
|
|
103
|
+
*/
|
|
104
|
+
id: string;
|
|
105
|
+
/** 시드 이미지 URL. 빈 값 = 이미지 없는 문서(도형은 시드, 표시는 이미지 로드까지 보류). */
|
|
106
|
+
imageUrl: string;
|
|
107
|
+
/**
|
|
108
|
+
* 실제로 렌더할 URL(화질 스왑). 바꿔도 문서는 리셋되지 않는다.
|
|
109
|
+
* imageUrl과 픽셀 크기가 다르면 coordinateSize로 좌표계를 고정할 것.
|
|
110
|
+
*/
|
|
111
|
+
displayImageUrl?: string;
|
|
112
|
+
/**
|
|
113
|
+
* 도형 좌표계 크기(원본 픽셀). 지정하면 표시 이미지(썸네일 등)를 이 크기로 늘려
|
|
114
|
+
* 그린다 — 이미지 파일 크기와 좌표계가 다를 때(ShapeViewer coordinateSize와 동일
|
|
115
|
+
* 의미). displayImageUrl과 함께 쓰면 화질 변형 간 픽셀 크기가 달라도 좌표계가
|
|
116
|
+
* 고정된다. 미지정 시 로드된 이미지의 실제 픽셀 크기.
|
|
117
|
+
*
|
|
118
|
+
* imageSize: 좌표공간 안에서 이미지가 차지하는 크기(원점 기준). 이미지가
|
|
119
|
+
* 좌표공간의 일부만 덮는 경우에 지정 — 예: 여러 해상도가 원점을 공유하는
|
|
120
|
+
* 좌표계에서 좌표공간은 최대 해상도, 이미지는 선택 해상도. 미지정 시
|
|
121
|
+
* 좌표공간 전체로 늘려 그린다.
|
|
122
|
+
*/
|
|
123
|
+
coordinateSize?: {
|
|
124
|
+
width: number;
|
|
125
|
+
height: number;
|
|
126
|
+
imageSize?: {
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/** 초기 도형(시드). 이후 문서는 에디터가 소유. */
|
|
132
|
+
initialShapes?: EditorShape<TMeta>[];
|
|
133
|
+
/**
|
|
134
|
+
* 시드 시 1회 적용할 초기 선택(도형 id) — 이후 선택은 에디터 소유라 같은
|
|
135
|
+
* 문서에서 값·데이터가 바뀌어도 되돌리지 않는다. 없는 id는 걸러진다.
|
|
136
|
+
*/
|
|
137
|
+
initialSelectedIds?: string[];
|
|
138
|
+
}
|
|
139
|
+
/** 미니맵 패널이 붙는 뷰어 모서리. */
|
|
140
|
+
export type MinimapPosition = "bottom-left" | "bottom-right" | "top-left" | "top-right";
|
|
141
|
+
export interface ShapeEditorProps<TMeta = unknown, TMarkerMeta = unknown> {
|
|
142
|
+
/** 편집 문서(시드 계약). null = 문서 없음(시드 대기) — 센티널 값 대신 null로. */
|
|
143
|
+
document: ShapeEditorDocument<TMeta> | null;
|
|
144
|
+
/**
|
|
145
|
+
* 시스템 클립보드 공유 범위. 같은 값의 에디터끼리만 도형을 붙여넣을 수 있다.
|
|
146
|
+
* 프로젝트처럼 meta의 의미가 같은 범위의 안정적인 식별자를 전달한다.
|
|
147
|
+
* 미지정 시 현재 문서(identity) 안에서만 공유한다.
|
|
148
|
+
*/
|
|
149
|
+
clipboardScope?: string;
|
|
150
|
+
/**
|
|
151
|
+
* 이미지 로딩/에러 상태 오버레이 커스텀. 미지정 시 기본 스피너/에러 메시지.
|
|
152
|
+
* error일 때 diagnosis에 원인 분류·기술 근거가 실린다(진단 실패 시 null).
|
|
153
|
+
*/
|
|
154
|
+
renderImageState?: (status: "loading" | "error" | "missing", diagnosis?: EditorImageDiagnosis | null) => ReactNode;
|
|
155
|
+
/**
|
|
156
|
+
* true면 이미지를 반투명 검정으로 덮는다(레이블은 위에 밝게). 도메인 무관 —
|
|
157
|
+
* 호스트가 "라벨링 완료/잠금" 등 상태에서 켠다(기존 Editor의 isLabelingCompleted 딤).
|
|
158
|
+
*/
|
|
159
|
+
dimmed?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* 렌더 시점 도형 상호작용 오버라이드(도메인 무관). 문서를 바꾸지 않고(undo 안전)
|
|
162
|
+
* 표시/선택/편집 가능 여부를 동적으로 덮어쓴다 — 호스트의 가시성 토글(숨김),
|
|
163
|
+
* 임계값 필터(보이되 비활성) 등에 쓴다. null/undefined면 원본 유지.
|
|
164
|
+
* 새로 생성되는 도형에도 즉시 적용된다(id 목록이 아니라 판정 함수라서).
|
|
165
|
+
*/
|
|
166
|
+
overrideShapeInteraction?: (shape: EditorShape<TMeta>) => Partial<ShapeInteraction> | null | undefined;
|
|
167
|
+
/** 선택 도형 id. 제공하면 selection은 호스트가 소유하는 controlled 모드로 동작한다. */
|
|
168
|
+
selectedIds?: string[];
|
|
169
|
+
/**
|
|
170
|
+
* true면 SELECT 도구의 빈 공간 드래그 마퀴(범위 선택)를 끈다 — 클릭 단건 선택만.
|
|
171
|
+
* 빈 공간 클릭 시 선택 해제는 그대로 동작한다. 단건 선택만 허용하는 뷰어형
|
|
172
|
+
* 호스트(검수 상세 등)에서 켠다.
|
|
173
|
+
*/
|
|
174
|
+
disableMarquee?: boolean;
|
|
175
|
+
activeTool: Tool;
|
|
176
|
+
/** 없으면 그리기 비활성. */
|
|
177
|
+
draftStyle?: ShapeStyle;
|
|
178
|
+
draftMeta?: TMeta;
|
|
179
|
+
readOnly?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* 편집 잠금. true면 문서를 바꾸는 상호작용(그리기/이동/편집/어시스트)을 막고,
|
|
182
|
+
* 편집 시도(그리기 도구·도형 드래그·정점 편집 진입·방향키·삭제·복제·붙여넣기·
|
|
183
|
+
* 잘라내기·핸들의 createShapes/updateShapes/deleteShapes)에는 `onLockedInteraction`을
|
|
184
|
+
* 호출한다. 그 밖의 변경 경로(실행 취소, 겹침 순서, 핸들의 선택 기반 액션 등)는
|
|
185
|
+
* 알림 없이 막는다. 클릭 선택·마퀴·복사·팬·우클릭메뉴·외부도구(코멘트)는 허용.
|
|
186
|
+
* 도메인 무관 — 호스트가 "라벨링 완료" 등에서 켠다.
|
|
187
|
+
*/
|
|
188
|
+
locked?: boolean;
|
|
189
|
+
/** locked 상태에서 편집을 시도했을 때(호스트가 확인 모달 등을 띄운다). */
|
|
190
|
+
onLockedInteraction?: () => void;
|
|
191
|
+
/**
|
|
192
|
+
* 그리기 도구가 활성인데 `draftStyle`이 없어 그리기를 시작할 수 없을 때 호출.
|
|
193
|
+
* 도메인 무관 — 에디터는 "그릴 값이 없다"는 사실만 알리고, 그 의미(예: 호스트가
|
|
194
|
+
* 스타일을 만들 수단을 안내)는 호스트가 해석한다. 없으면 기존처럼 무시된다.
|
|
195
|
+
*/
|
|
196
|
+
onDrawAttemptWithoutDraft?: () => void;
|
|
197
|
+
/**
|
|
198
|
+
* Esc 처리 사슬(어시스트 취소 → 그리기 취소 → 선택 해제)이 전부 해당 없을 때 호출.
|
|
199
|
+
* 호스트가 "툴을 SELECT로 복귀 → 그래도 idle이면 에디터 닫기" 같은 후속 동작을
|
|
200
|
+
* 잇는 데 쓴다(기존 Editor의 Esc 사슬 꼬리).
|
|
201
|
+
*/
|
|
202
|
+
onIdleEscape?: () => void;
|
|
203
|
+
/**
|
|
204
|
+
* 문서 밖 장식 도형(예: 다른 해상도 가이드 사각형). 도형 레이어에 렌더만 되고
|
|
205
|
+
* 선택·undo 히스토리·히트테스트·getShapes()에서 완전히 제외된다 — 스타일 변경
|
|
206
|
+
* (hover 강조 등)은 prop 교체로 반영되며 히스토리에 쌓이지 않는다.
|
|
207
|
+
* z순서는 style.zIndex로 제어한다(음수면 문서 도형 아래).
|
|
208
|
+
*/
|
|
209
|
+
decorationShapes?: EditorShape<TMeta>[];
|
|
210
|
+
/** 이미지 위 가림 효과. 제품 의미는 호스트가 해석하고 에디터는 순수 영역만 렌더링한다. */
|
|
211
|
+
regionMask?: RegionMask;
|
|
212
|
+
overlayMarkers?: EditorOverlayMarker<TMarkerMeta>[];
|
|
213
|
+
renderOverlayMarker?: (marker: EditorOverlayMarker<TMarkerMeta>) => ReactNode;
|
|
214
|
+
onOverlayMarkerClick?: (marker: EditorOverlayMarker<TMarkerMeta>) => void;
|
|
215
|
+
renderImageOverlay?: (props: {
|
|
216
|
+
image: {
|
|
217
|
+
w: number;
|
|
218
|
+
h: number;
|
|
219
|
+
};
|
|
220
|
+
viewport: EditorCanvasViewport;
|
|
221
|
+
}) => ReactNode;
|
|
222
|
+
externalTools?: EditorExternalTool[];
|
|
223
|
+
/**
|
|
224
|
+
* AI 어시스트(SAM 식). 제공하면 ASSISTANT_POLYGON/ASSISTANT_POINT 도구가 동작한다.
|
|
225
|
+
* 에디터가 프롬프트를 모아 infer로 넘기고, 결과 폴리곤을 프리뷰→Enter로 커밋한다
|
|
226
|
+
* (draftStyle/draftMeta 적용). Esc로 취소.
|
|
227
|
+
*/
|
|
228
|
+
assistant?: EditorAssistant;
|
|
229
|
+
/**
|
|
230
|
+
* 선택 도형 위에 표시할 라벨(예: 클래스명). 반환하면 색 점 + 텍스트 배지가 뜬다.
|
|
231
|
+
* 도메인 무관 — meta 해석은 호스트.
|
|
232
|
+
*/
|
|
233
|
+
getSelectionLabel?: (shape: EditorShape<TMeta>) => string | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* 선택 라벨 배지에서 도형 색을 나타내는 색 점을 숨긴다. 기본 false(표시).
|
|
236
|
+
* 클래스 색이 도메인상 의미가 없는 호스트에서 사용.
|
|
237
|
+
*/
|
|
238
|
+
hideSelectionLabelDot?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* 선택 도형 아래 표시할 정보 텍스트. 에디터가 계산한 픽셀 데이터(info)를 받아
|
|
241
|
+
* 프로덕트별 템플릿으로 포맷한다. 미지정 시 기본값 `W x H px`. 빈 문자열이면 숨김.
|
|
242
|
+
* 점 도형은 표시하지 않는다.
|
|
243
|
+
*/
|
|
244
|
+
formatSelectionInfo?: (info: EditorSelectionInfo<TMeta>) => string;
|
|
245
|
+
/**
|
|
246
|
+
* 보기 설정 초깃값(밝기/대비/픽셀화/선 두께/가이드·ROI 표시/줌 유지/휠 줌).
|
|
247
|
+
* 마운트 시 seed로만 쓰이고 이후엔 에디터 내부 설정 팝오버가 소유한다(uncontrolled).
|
|
248
|
+
* 지정하지 않은 키는 DEFAULT_VIEW_SETTINGS를 따른다.
|
|
249
|
+
* 숫자 값은 VIEW_SETTING_RANGES로 클램프된다(예: brightness 2 → 1.5).
|
|
250
|
+
*/
|
|
251
|
+
defaultViewSettings?: Partial<ViewSettings>;
|
|
252
|
+
/**
|
|
253
|
+
* 보기 설정 외부 동기화(선택). 여기 지정한 키의 값이 바뀌면 에디터 내부 설정에
|
|
254
|
+
* 반영된다(호스트 설정 UI → 에디터 방향). 에디터 내부 변경은 onViewSettingsChange로
|
|
255
|
+
* 나간다. 미지정 키는 계속 에디터 내부 소유.
|
|
256
|
+
* 여기 값도 VIEW_SETTING_RANGES로 클램프되므로, 범위 밖 저장값을 그대로 넘겨도
|
|
257
|
+
* 에디터는 범위 안 값으로 동작한다(호스트 저장값은 다음 설정 변경 시 교정된다).
|
|
258
|
+
*/
|
|
259
|
+
viewSettings?: Partial<ViewSettings>;
|
|
260
|
+
/**
|
|
261
|
+
* 미니맵 패널(축소맵+줌바+설정 버튼) 표시 여부(기본 true).
|
|
262
|
+
* 읽기전용 프리뷰 등 크롬이 부담스러운 콜사이트에서 끈다.
|
|
263
|
+
*/
|
|
264
|
+
showMinimap?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* 미니맵 패널이 붙는 모서리(기본 "bottom-left"). 위쪽 모서리에서는 줌 바가
|
|
267
|
+
* 위에 고정되고 축소맵이 아래로 펼쳐진다.
|
|
268
|
+
*/
|
|
269
|
+
minimapPosition?: MinimapPosition;
|
|
270
|
+
/** 미니맵 패널의 보기설정(기어) 버튼 표시 여부(기본 true). */
|
|
271
|
+
showViewSettings?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* 우클릭 컨텍스트 메뉴 항목 커스터마이즈. 에디터 기본 항목(defaults: 복제/삭제/
|
|
274
|
+
* z-순서/전체선택 등, readOnly에서는 복사/선택/확대)을 받아 가공(추가·제거·재배열)해
|
|
275
|
+
* 반환한다. 도메인 액션(예: 클래스 변경)을 끼워 넣는 확장 지점. 미지정 시 기본 항목 그대로.
|
|
276
|
+
*/
|
|
277
|
+
getContextMenuItems?: (defaults: ContextMenuItem[], ctx: {
|
|
278
|
+
selectedIds: string[];
|
|
279
|
+
readOnly: boolean;
|
|
280
|
+
}) => ContextMenuItem[];
|
|
281
|
+
/**
|
|
282
|
+
* UI 문자열 부분 재정의(컨텍스트 메뉴/보기설정/미니맵/이미지 로딩·에러).
|
|
283
|
+
* 기본값은 한국어(DEFAULT_EDITOR_STRINGS). 호스트가 번역 값을 만들어 주입한다.
|
|
284
|
+
*/
|
|
285
|
+
strings?: EditorStringsOverride;
|
|
286
|
+
/**
|
|
287
|
+
* 보기 설정 팝오버의 항목 구성(표시 여부·순서). 제품마다 노출 범위가 다르다 —
|
|
288
|
+
* 예: 아이브데이터는 단순화 강도·픽셀화를 감춘다(6547:201301).
|
|
289
|
+
* 미지정 시 전 항목(기존 순서).
|
|
290
|
+
*/
|
|
291
|
+
viewSettingItems?: ViewSettingItemKey[];
|
|
292
|
+
/**
|
|
293
|
+
* 합치기(우클릭 메뉴) 허용 판정. 선택된 닫힌 도형 2개 이상일 때 호출되며,
|
|
294
|
+
* false면 항목이 비활성화된다. 도메인 제약(예: 같은 클래스끼리만) 주입용.
|
|
295
|
+
* 미지정 시 항상 허용. 결과 도형의 style/meta는 첫 도형을 따른다.
|
|
296
|
+
*/
|
|
297
|
+
canMergeSelection?: (shapes: EditorShape<TMeta>[]) => boolean;
|
|
298
|
+
/**
|
|
299
|
+
* 보기 설정이 에디터 내부(설정 팝오버/단축키)에서 바뀔 때 전체 스냅샷으로 호출.
|
|
300
|
+
* 호스트가 영속화하거나 외부 설정 UI와 동기화하는 데 쓴다.
|
|
301
|
+
*/
|
|
302
|
+
onViewSettingsChange?: (settings: ViewSettings) => void;
|
|
303
|
+
/** 붓 도구 반경(이미지 px, 기본 20). */
|
|
304
|
+
brushSize?: number;
|
|
305
|
+
/**
|
|
306
|
+
* 단축키 재정의. 액션→조합키("mod+shift+z" 등, 배열 가능). 미지정 액션은 기본값,
|
|
307
|
+
* null이면 비활성. 툴 전환 액션은 onActiveToolChange로 발생한다.
|
|
308
|
+
* (방향키 넛지·Space 팬은 고정.)
|
|
309
|
+
*/
|
|
310
|
+
keymap?: KeymapOverrides;
|
|
311
|
+
/**
|
|
312
|
+
* 특정 레이블/영역으로 애니메이션 줌(기존 Editor `zoomBound`).
|
|
313
|
+
* handleRef.zoomToBounds(즉시 명령)와 달리 **이미지 로드(ready) 이후**에 1회 실행을
|
|
314
|
+
* 보장하는 선언적 원샷 — 딥링크(코멘트/상세 진입)처럼 마운트 시점에 목표가 정해지는
|
|
315
|
+
* 경우에 쓴다. 상호작용 중 즉시 줌은 handleRef의 zoomToBounds/zoomToShapes를 쓸 것.
|
|
316
|
+
*/
|
|
317
|
+
zoomBound?: {
|
|
318
|
+
x: number;
|
|
319
|
+
y: number;
|
|
320
|
+
width: number;
|
|
321
|
+
height: number;
|
|
322
|
+
};
|
|
323
|
+
/** zoomBound·zoomToShapes 애니메이션 길이(ms, 기본 300). */
|
|
324
|
+
zoomAnimationDuration?: number;
|
|
325
|
+
/** 에디터 내부에서 활성 도구가 바뀔 때(예: 그리기 완료 후 자동 복귀) 발생. */
|
|
326
|
+
onActiveToolChange?: (tool: Tool) => void;
|
|
327
|
+
onSelectionChange?: (ids: string[]) => void;
|
|
328
|
+
/**
|
|
329
|
+
* 폴리곤/라인 정점 편집모드 진입/해제 통지(더블클릭 진입, 툴·선택 변경 시 해제).
|
|
330
|
+
* 호스트가 편집모드용 안내 툴바 등을 띄우는 데 쓴다(도메인 무관).
|
|
331
|
+
*/
|
|
332
|
+
onEditingChange?: (editingId: string | null) => void;
|
|
333
|
+
/**
|
|
334
|
+
* 도형이 에디터 문서에 커밋된 뒤 발생하는 후행 이벤트.
|
|
335
|
+
* undo/redo 시에도 현재 문서 기준의 역연산 이벤트로 발생한다.
|
|
336
|
+
*/
|
|
337
|
+
onShapesCreated?: (shapes: EditorShape<TMeta>[]) => void;
|
|
338
|
+
/**
|
|
339
|
+
* 도형 변경이 에디터 문서에 커밋된 뒤 발생하는 후행 이벤트.
|
|
340
|
+
* undo/redo 시에도 현재 문서 기준의 역연산 이벤트로 발생한다.
|
|
341
|
+
*/
|
|
342
|
+
onShapesUpdated?: (shapes: EditorShape<TMeta>[]) => void;
|
|
343
|
+
/**
|
|
344
|
+
* 도형 삭제가 에디터 문서에 커밋된 뒤 발생하는 후행 이벤트.
|
|
345
|
+
* undo/redo 시에도 현재 문서 기준의 역연산 이벤트로 발생한다.
|
|
346
|
+
*/
|
|
347
|
+
onShapesDeleted?: (ids: string[]) => void;
|
|
348
|
+
onViewportChange?: (viewport: EditorCanvasViewport) => void;
|
|
349
|
+
/** 이동·리사이즈·정점 편집 중인 도형 좌표. 문서 커밋 전 시각 동기화용이다. */
|
|
350
|
+
onShapesTransformPreview?: (updates: {
|
|
351
|
+
id: string;
|
|
352
|
+
points: Point[];
|
|
353
|
+
}[]) => void;
|
|
354
|
+
/**
|
|
355
|
+
* 그리는 중인 임시 도형. ROI 등 호스트 전용 실시간 오버레이 동기화에 사용한다.
|
|
356
|
+
* 자유선 PATH는 커밋 결과와 동일하게 POLYGON 타입으로 전달된다.
|
|
357
|
+
*/
|
|
358
|
+
onDraftShapeChange?: (shape: Pick<EditorShape<TMeta>, "type" | "points" | "meta"> | null) => void;
|
|
359
|
+
/**
|
|
360
|
+
* 그리기 세션(붓·폴리곤·패스)의 제어 상태가 바뀔 때 발생한다.
|
|
361
|
+
* 정점·커서 좌표 변화는 포함하지 않으므로, 임시 도형 좌표가 필요한 호스트는
|
|
362
|
+
* onDraftShapeChange를 사용한다.
|
|
363
|
+
*/
|
|
364
|
+
onDrawSessionChange?: (session: DrawSessionChange) => void;
|
|
365
|
+
/** 호스트發 수정/undo·redo/선택 제어용 명령형 핸들. */
|
|
366
|
+
handleRef?: Ref<ShapeEditorHandle<TMeta>>;
|
|
367
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";var e={brightness:1,contrast:1,showCursorGuide:!1,imageSmoothing:!0,strokeSize:2,simplifyStrength:1.5,showRegionMask:!0,keepZoomOnImageChange:!1,wheelZoom:!0,zoomSensitivity:1},t={brightness:{min:.5,max:1.5,step:.05},contrast:{min:.5,max:1.5,step:.05},strokeSize:{min:1,max:10,step:.5},simplifyStrength:{min:.5,max:5,step:.5},zoomSensitivity:{min:.2,max:3,step:.1}},n=Object.keys(t);function r(r){let i={};for(let a of n){let n=r[a];if(n===void 0)continue;let{min:o,max:s}=t[a],c=Number.isFinite(n)?Math.min(s,Math.max(o,n)):e[a];c!==n&&(i[a]=c)}return Object.keys(i).length?{...r,...i}:r}exports.DEFAULT_VIEW_SETTINGS=e,exports.VIEW_SETTING_RANGES=t,exports.clampViewSettings=r;
|
|
2
|
+
//# sourceMappingURL=viewSettings.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewSettings.cjs","names":[],"sources":["../../../../src/components/ShapeEditor/_model/viewSettings.ts"],"sourcesContent":["/** 에디터-로컬 보기/조작 환경설정(도메인 무관). props는 초기값(default)으로만 받는다. */\nexport interface ViewSettings {\n brightness: number;\n contrast: number;\n showCursorGuide: boolean;\n imageSmoothing: boolean;\n strokeSize: number;\n /** 자유선/붓→폴리곤 단순화 강도(RDP epsilon, 이미지 px). 높을수록 점이 적어짐. */\n simplifyStrength: number;\n showRegionMask: boolean;\n keepZoomOnImageChange: boolean;\n wheelZoom: boolean;\n /** 휠/핀치 확대·축소 민감도 배율(1 = 기본). 마우스별 휠 이벤트 밀도 차이 보정용. */\n zoomSensitivity: number;\n}\n\nexport const DEFAULT_VIEW_SETTINGS: ViewSettings = {\n brightness: 1,\n contrast: 1,\n showCursorGuide: false,\n imageSmoothing: true,\n strokeSize: 2,\n simplifyStrength: 1.5,\n showRegionMask: true,\n keepZoomOnImageChange: false,\n wheelZoom: true,\n zoomSensitivity: 1,\n};\n\n/** 숫자형 보기 설정의 허용 범위 — 슬라이더와 클램프가 공유하는 단일 출처. */\nexport interface ViewSettingRange {\n min: number;\n max: number;\n step: number;\n}\n\n/**\n * 밝기/대비는 0에 가까우면 완전 검정·평면 회색이 되어 이미지가 사라지고,\n * 너무 높으면 화이트아웃된다. 사진을 계속 식별할 수 있는 구간으로 묶는다.\n */\nexport const VIEW_SETTING_RANGES = {\n brightness: { min: 0.5, max: 1.5, step: 0.05 },\n contrast: { min: 0.5, max: 1.5, step: 0.05 },\n strokeSize: { min: 1, max: 10, step: 0.5 },\n simplifyStrength: { min: 0.5, max: 5, step: 0.5 },\n zoomSensitivity: { min: 0.2, max: 3, step: 0.1 },\n} as const satisfies Partial<Record<keyof ViewSettings, ViewSettingRange>>;\n\ntype RangedKey = keyof typeof VIEW_SETTING_RANGES;\n\nconst RANGED_KEYS = Object.keys(VIEW_SETTING_RANGES) as RangedKey[];\n\n/**\n * 범위 밖 값을 허용 구간 안으로 되돌린다(구버전 저장값 마이그레이션 겸용).\n * NaN/Infinity는 기본값으로 되살린다. 지정되지 않은(undefined) 키는 만들어내지 않으므로\n * 부분 패치에도 그대로 쓸 수 있다. 고칠 게 없으면 새 객체를 만들지 않고 입력을 그대로 반환한다.\n */\nexport function clampViewSettings<T extends Partial<ViewSettings>>(settings: T): T {\n const fixes: Partial<Record<RangedKey, number>> = {};\n for (const key of RANGED_KEYS) {\n const value = settings[key];\n if (value === undefined) continue;\n const { min, max } = VIEW_SETTING_RANGES[key];\n const fixed = Number.isFinite(value)\n ? Math.min(max, Math.max(min, value as number))\n : DEFAULT_VIEW_SETTINGS[key];\n if (fixed !== value) fixes[key] = fixed;\n }\n return Object.keys(fixes).length ? { ...settings, ...fixes } : settings;\n}\n\n/** 보기 설정 항목 키 — 슬라이더 5종 + 토글 5종. */\nexport type ViewSettingItemKey =\n | \"brightness\"\n | \"contrast\"\n | \"strokeSize\"\n | \"simplifyStrength\"\n | \"zoomSensitivity\"\n | \"pixelation\"\n | \"cursorGuide\"\n | \"regionMask\"\n | \"keepZoomOnImageChange\"\n | \"wheelZoom\";\n"],"mappings":"aAgBA,IAAa,EAAsC,CACjD,WAAY,EACZ,SAAU,EACV,gBAAiB,GACjB,eAAgB,GAChB,WAAY,EACZ,iBAAkB,IAClB,eAAgB,GAChB,sBAAuB,GACvB,UAAW,GACX,gBAAiB,EAClB,CAaY,EAAsB,CACjC,WAAY,CAAE,IAAK,GAAK,IAAK,IAAK,KAAM,IAAM,CAC9C,SAAU,CAAE,IAAK,GAAK,IAAK,IAAK,KAAM,IAAM,CAC5C,WAAY,CAAE,IAAK,EAAG,IAAK,GAAI,KAAM,GAAK,CAC1C,iBAAkB,CAAE,IAAK,GAAK,IAAK,EAAG,KAAM,GAAK,CACjD,gBAAiB,CAAE,IAAK,GAAK,IAAK,EAAG,KAAM,GAAK,CACjD,CAIK,EAAc,OAAO,KAAK,EAAoB,CAOpD,SAAgB,EAAmD,EAAgB,CACjF,IAAM,EAA4C,EAAE,CACpD,IAAK,IAAM,KAAO,EAAa,CAC7B,IAAM,EAAQ,EAAS,GACvB,GAAI,IAAU,IAAA,GAAW,SACzB,GAAM,CAAE,MAAK,OAAQ,EAAoB,GACnC,EAAQ,OAAO,SAAS,EAAM,CAChC,KAAK,IAAI,EAAK,KAAK,IAAI,EAAK,EAAgB,CAAC,CAC7C,EAAsB,GACtB,IAAU,IAAO,EAAM,GAAO,GAEpC,OAAO,OAAO,KAAK,EAAM,CAAC,OAAS,CAAE,GAAG,EAAU,GAAG,EAAO,CAAG"}
|
|
@@ -57,3 +57,5 @@ export declare const VIEW_SETTING_RANGES: {
|
|
|
57
57
|
* 부분 패치에도 그대로 쓸 수 있다. 고칠 게 없으면 새 객체를 만들지 않고 입력을 그대로 반환한다.
|
|
58
58
|
*/
|
|
59
59
|
export declare function clampViewSettings<T extends Partial<ViewSettings>>(settings: T): T;
|
|
60
|
+
/** 보기 설정 항목 키 — 슬라이더 5종 + 토글 5종. */
|
|
61
|
+
export type ViewSettingItemKey = "brightness" | "contrast" | "strokeSize" | "simplifyStrength" | "zoomSensitivity" | "pixelation" | "cursorGuide" | "regionMask" | "keepZoomOnImageChange" | "wheelZoom";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/ShapeEditor/_model/viewSettings.ts
|
|
3
|
+
var e = {
|
|
4
|
+
brightness: 1,
|
|
5
|
+
contrast: 1,
|
|
6
|
+
showCursorGuide: !1,
|
|
7
|
+
imageSmoothing: !0,
|
|
8
|
+
strokeSize: 2,
|
|
9
|
+
simplifyStrength: 1.5,
|
|
10
|
+
showRegionMask: !0,
|
|
11
|
+
keepZoomOnImageChange: !1,
|
|
12
|
+
wheelZoom: !0,
|
|
13
|
+
zoomSensitivity: 1
|
|
14
|
+
}, t = {
|
|
15
|
+
brightness: {
|
|
16
|
+
min: .5,
|
|
17
|
+
max: 1.5,
|
|
18
|
+
step: .05
|
|
19
|
+
},
|
|
20
|
+
contrast: {
|
|
21
|
+
min: .5,
|
|
22
|
+
max: 1.5,
|
|
23
|
+
step: .05
|
|
24
|
+
},
|
|
25
|
+
strokeSize: {
|
|
26
|
+
min: 1,
|
|
27
|
+
max: 10,
|
|
28
|
+
step: .5
|
|
29
|
+
},
|
|
30
|
+
simplifyStrength: {
|
|
31
|
+
min: .5,
|
|
32
|
+
max: 5,
|
|
33
|
+
step: .5
|
|
34
|
+
},
|
|
35
|
+
zoomSensitivity: {
|
|
36
|
+
min: .2,
|
|
37
|
+
max: 3,
|
|
38
|
+
step: .1
|
|
39
|
+
}
|
|
40
|
+
}, n = Object.keys(t);
|
|
41
|
+
function r(r) {
|
|
42
|
+
let i = {};
|
|
43
|
+
for (let a of n) {
|
|
44
|
+
let n = r[a];
|
|
45
|
+
if (n === void 0) continue;
|
|
46
|
+
let { min: o, max: s } = t[a], c = Number.isFinite(n) ? Math.min(s, Math.max(o, n)) : e[a];
|
|
47
|
+
c !== n && (i[a] = c);
|
|
48
|
+
}
|
|
49
|
+
return Object.keys(i).length ? {
|
|
50
|
+
...r,
|
|
51
|
+
...i
|
|
52
|
+
} : r;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { e as DEFAULT_VIEW_SETTINGS, t as VIEW_SETTING_RANGES, r as clampViewSettings };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=viewSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewSettings.js","names":[],"sources":["../../../../src/components/ShapeEditor/_model/viewSettings.ts"],"sourcesContent":["/** 에디터-로컬 보기/조작 환경설정(도메인 무관). props는 초기값(default)으로만 받는다. */\nexport interface ViewSettings {\n brightness: number;\n contrast: number;\n showCursorGuide: boolean;\n imageSmoothing: boolean;\n strokeSize: number;\n /** 자유선/붓→폴리곤 단순화 강도(RDP epsilon, 이미지 px). 높을수록 점이 적어짐. */\n simplifyStrength: number;\n showRegionMask: boolean;\n keepZoomOnImageChange: boolean;\n wheelZoom: boolean;\n /** 휠/핀치 확대·축소 민감도 배율(1 = 기본). 마우스별 휠 이벤트 밀도 차이 보정용. */\n zoomSensitivity: number;\n}\n\nexport const DEFAULT_VIEW_SETTINGS: ViewSettings = {\n brightness: 1,\n contrast: 1,\n showCursorGuide: false,\n imageSmoothing: true,\n strokeSize: 2,\n simplifyStrength: 1.5,\n showRegionMask: true,\n keepZoomOnImageChange: false,\n wheelZoom: true,\n zoomSensitivity: 1,\n};\n\n/** 숫자형 보기 설정의 허용 범위 — 슬라이더와 클램프가 공유하는 단일 출처. */\nexport interface ViewSettingRange {\n min: number;\n max: number;\n step: number;\n}\n\n/**\n * 밝기/대비는 0에 가까우면 완전 검정·평면 회색이 되어 이미지가 사라지고,\n * 너무 높으면 화이트아웃된다. 사진을 계속 식별할 수 있는 구간으로 묶는다.\n */\nexport const VIEW_SETTING_RANGES = {\n brightness: { min: 0.5, max: 1.5, step: 0.05 },\n contrast: { min: 0.5, max: 1.5, step: 0.05 },\n strokeSize: { min: 1, max: 10, step: 0.5 },\n simplifyStrength: { min: 0.5, max: 5, step: 0.5 },\n zoomSensitivity: { min: 0.2, max: 3, step: 0.1 },\n} as const satisfies Partial<Record<keyof ViewSettings, ViewSettingRange>>;\n\ntype RangedKey = keyof typeof VIEW_SETTING_RANGES;\n\nconst RANGED_KEYS = Object.keys(VIEW_SETTING_RANGES) as RangedKey[];\n\n/**\n * 범위 밖 값을 허용 구간 안으로 되돌린다(구버전 저장값 마이그레이션 겸용).\n * NaN/Infinity는 기본값으로 되살린다. 지정되지 않은(undefined) 키는 만들어내지 않으므로\n * 부분 패치에도 그대로 쓸 수 있다. 고칠 게 없으면 새 객체를 만들지 않고 입력을 그대로 반환한다.\n */\nexport function clampViewSettings<T extends Partial<ViewSettings>>(settings: T): T {\n const fixes: Partial<Record<RangedKey, number>> = {};\n for (const key of RANGED_KEYS) {\n const value = settings[key];\n if (value === undefined) continue;\n const { min, max } = VIEW_SETTING_RANGES[key];\n const fixed = Number.isFinite(value)\n ? Math.min(max, Math.max(min, value as number))\n : DEFAULT_VIEW_SETTINGS[key];\n if (fixed !== value) fixes[key] = fixed;\n }\n return Object.keys(fixes).length ? { ...settings, ...fixes } : settings;\n}\n\n/** 보기 설정 항목 키 — 슬라이더 5종 + 토글 5종. */\nexport type ViewSettingItemKey =\n | \"brightness\"\n | \"contrast\"\n | \"strokeSize\"\n | \"simplifyStrength\"\n | \"zoomSensitivity\"\n | \"pixelation\"\n | \"cursorGuide\"\n | \"regionMask\"\n | \"keepZoomOnImageChange\"\n | \"wheelZoom\";\n"],"mappings":";;AAgBA,IAAa,IAAsC;CACjD,YAAY;CACZ,UAAU;CACV,iBAAiB;CACjB,gBAAgB;CAChB,YAAY;CACZ,kBAAkB;CAClB,gBAAgB;CAChB,uBAAuB;CACvB,WAAW;CACX,iBAAiB;CAClB,EAaY,IAAsB;CACjC,YAAY;EAAE,KAAK;EAAK,KAAK;EAAK,MAAM;EAAM;CAC9C,UAAU;EAAE,KAAK;EAAK,KAAK;EAAK,MAAM;EAAM;CAC5C,YAAY;EAAE,KAAK;EAAG,KAAK;EAAI,MAAM;EAAK;CAC1C,kBAAkB;EAAE,KAAK;EAAK,KAAK;EAAG,MAAM;EAAK;CACjD,iBAAiB;EAAE,KAAK;EAAK,KAAK;EAAG,MAAM;EAAK;CACjD,EAIK,IAAc,OAAO,KAAK,EAAoB;AAOpD,SAAgB,EAAmD,GAAgB;CACjF,IAAM,IAA4C,EAAE;AACpD,MAAK,IAAM,KAAO,GAAa;EAC7B,IAAM,IAAQ,EAAS;AACvB,MAAI,MAAU,KAAA,EAAW;EACzB,IAAM,EAAE,QAAK,WAAQ,EAAoB,IACnC,IAAQ,OAAO,SAAS,EAAM,GAChC,KAAK,IAAI,GAAK,KAAK,IAAI,GAAK,EAAgB,CAAC,GAC7C,EAAsB;AAC1B,EAAI,MAAU,MAAO,EAAM,KAAO;;AAEpC,QAAO,OAAO,KAAK,EAAM,CAAC,SAAS;EAAE,GAAG;EAAU,GAAG;EAAO,GAAG"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";const e=require(`./geometry.cjs`);function t({viewport:t,image:n,focusPoints:r,zoomPadding:i,focusFit:a}){let o=Math.min(t.width/n.width,t.height/n.height);if(!r?.length)return{scale:o,offsetX:(t.width-n.width*o)/2,offsetY:(t.height-n.height*o)/2};let s=e.getBBox(r),c=Math.max(s.maxX-s.minX,50),l=Math.max(s.maxY-s.minY,50),u=Math.min(c,l)*i,d=Math.min(t.width/(c+u*2),t.height/(l+u*2));a===`cover`&&(d=Math.max(d,Math.max(t.width/n.width,t.height/n.height)));let f=t.width/2-(s.minX+s.maxX)/2*d,p=t.height/2-(s.minY+s.maxY)/2*d;return a===`cover`&&(f=Math.min(0,Math.max(f,t.width-n.width*d)),p=Math.min(0,Math.max(p,t.height-n.height*d))),{scale:d,offsetX:f,offsetY:p}}function n(e,t,n){let r=Math.max(0,-e.offsetX/e.scale),i=Math.max(0,-e.offsetY/e.scale),a=Math.min(n.width,(t.width-e.offsetX)/e.scale),o=Math.min(n.height,(t.height-e.offsetY)/e.scale);return a<=r||o<=i?null:{x:r,y:i,width:a-r,height:o-i}}function r({visible:e,image:t,natural:n,density:r}){let i=n.width/t.width,a=n.height/t.height,o=Math.max(0,Math.floor(e.x*i)),s=Math.max(0,Math.floor(e.y*a)),c=Math.min(n.width,Math.ceil((e.x+e.width)*i))-o,l=Math.min(n.height,Math.ceil((e.y+e.height)*a))-s,u={x:o/i,y:s/a,width:c/i,height:l/a};return{source:{x:o,y:s,width:c,height:l},rect:u,outputWidth:Math.max(1,Math.min(c,Math.ceil(u.width*r))),outputHeight:Math.max(1,Math.min(l,Math.ceil(u.height*r)))}}function i(e,t,n){let r=1e-6;if(!(e.rect.x<=t.x+r&&e.rect.y<=t.y+r&&e.rect.x+e.rect.width>=t.x+t.width-r&&e.rect.y+e.rect.height>=t.y+t.height-r))return!1;let i=Math.min(n.density,n.natural.width/n.image.width),a=Math.min(n.density,n.natural.height/n.image.height);return e.outputWidth/e.rect.width>=i*.99&&e.outputHeight/e.rect.height>=a*.99}exports.computeViewerTransform=t,exports.getVisibleImageRect=n,exports.patchCovers=i,exports.planImagePatch=r;
|
|
2
|
+
//# sourceMappingURL=viewerPatch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewerPatch.cjs","names":[],"sources":["../../../../src/components/ShapeEditor/_model/viewerPatch.ts"],"sourcesContent":["import { getBBox, type Point } from \"./geometry\";\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport interface Rect extends Size {\n x: number;\n y: number;\n}\n\n/** 이미지 좌표계 → 컨테이너 CSS px 변환(`screen = coord * scale + offset`). */\nexport interface ViewerTransform {\n scale: number;\n offsetX: number;\n offsetY: number;\n}\n\nexport function computeViewerTransform({\n viewport,\n image,\n focusPoints,\n zoomPadding,\n focusFit,\n}: {\n viewport: Size;\n image: Size;\n focusPoints?: Point[];\n zoomPadding: number;\n focusFit: \"contain\" | \"cover\";\n}): ViewerTransform {\n const fitScale = Math.min(viewport.width / image.width, viewport.height / image.height);\n if (!focusPoints?.length) {\n return {\n scale: fitScale,\n offsetX: (viewport.width - image.width * fitScale) / 2,\n offsetY: (viewport.height - image.height * fitScale) / 2,\n };\n }\n const bounds = getBBox(focusPoints);\n const width = Math.max(bounds.maxX - bounds.minX, 50);\n const height = Math.max(bounds.maxY - bounds.minY, 50);\n const padding = Math.min(width, height) * zoomPadding;\n let scale = Math.min(\n viewport.width / (width + padding * 2),\n viewport.height / (height + padding * 2),\n );\n if (focusFit === \"cover\") {\n scale = Math.max(scale, Math.max(viewport.width / image.width, viewport.height / image.height));\n }\n let offsetX = viewport.width / 2 - ((bounds.minX + bounds.maxX) / 2) * scale;\n let offsetY = viewport.height / 2 - ((bounds.minY + bounds.maxY) / 2) * scale;\n if (focusFit === \"cover\") {\n offsetX = Math.min(0, Math.max(offsetX, viewport.width - image.width * scale));\n offsetY = Math.min(0, Math.max(offsetY, viewport.height - image.height * scale));\n }\n return { scale, offsetX, offsetY };\n}\n\n/** 컨테이너에 보이는 이미지 영역(좌표계 단위, 이미지 경계로 클램프). 보이는 부분이 없으면 null. */\nexport function getVisibleImageRect(\n transform: ViewerTransform,\n viewport: Size,\n image: Size,\n): Rect | null {\n const left = Math.max(0, -transform.offsetX / transform.scale);\n const top = Math.max(0, -transform.offsetY / transform.scale);\n const right = Math.min(image.width, (viewport.width - transform.offsetX) / transform.scale);\n const bottom = Math.min(image.height, (viewport.height - transform.offsetY) / transform.scale);\n if (right <= left || bottom <= top) return null;\n return { x: left, y: top, width: right - left, height: bottom - top };\n}\n\n/**\n * 보이는 영역만 잘라 화면 해상도로 줄인 패치 계획. 원본 픽셀 경계로 정렬하고,\n * 원본보다 확대된 화면에서는 원본 해상도에서 멈춘다(업스케일은 그리기 단계가 한다).\n * `density`는 화면이 요구하는 좌표 1단위당 기기 픽셀 수.\n */\nexport function planImagePatch({\n visible,\n image,\n natural,\n density,\n}: {\n visible: Rect;\n image: Size;\n natural: Size;\n density: number;\n}) {\n const ratioX = natural.width / image.width;\n const ratioY = natural.height / image.height;\n const sourceX = Math.max(0, Math.floor(visible.x * ratioX));\n const sourceY = Math.max(0, Math.floor(visible.y * ratioY));\n const sourceWidth =\n Math.min(natural.width, Math.ceil((visible.x + visible.width) * ratioX)) - sourceX;\n const sourceHeight =\n Math.min(natural.height, Math.ceil((visible.y + visible.height) * ratioY)) - sourceY;\n const rect = {\n x: sourceX / ratioX,\n y: sourceY / ratioY,\n width: sourceWidth / ratioX,\n height: sourceHeight / ratioY,\n };\n return {\n source: { x: sourceX, y: sourceY, width: sourceWidth, height: sourceHeight },\n rect,\n outputWidth: Math.max(1, Math.min(sourceWidth, Math.ceil(rect.width * density))),\n outputHeight: Math.max(1, Math.min(sourceHeight, Math.ceil(rect.height * density))),\n };\n}\n\n/** 기존 패치가 지금 보이는 영역을 요구 해상도 이상으로 덮는지 — 덮으면 원본을 다시 디코딩할 필요가 없다. */\nexport function patchCovers(\n patch: { rect: Rect; outputWidth: number; outputHeight: number },\n visible: Rect,\n required: { density: number; natural: Size; image: Size },\n): boolean {\n const epsilon = 1e-6;\n const contains =\n patch.rect.x <= visible.x + epsilon &&\n patch.rect.y <= visible.y + epsilon &&\n patch.rect.x + patch.rect.width >= visible.x + visible.width - epsilon &&\n patch.rect.y + patch.rect.height >= visible.y + visible.height - epsilon;\n if (!contains) return false;\n // 원본 해상도가 상한 — 이미 원본 그대로 잘라 둔 패치는 더 확대돼도 다시 만들 이유가 없다.\n const needX = Math.min(required.density, required.natural.width / required.image.width);\n const needY = Math.min(required.density, required.natural.height / required.image.height);\n return (\n patch.outputWidth / patch.rect.width >= needX * 0.99 &&\n patch.outputHeight / patch.rect.height >= needY * 0.99\n );\n}\n"],"mappings":"+CAmBA,SAAgB,EAAuB,CACrC,WACA,QACA,cACA,cACA,YAOkB,CAClB,IAAM,EAAW,KAAK,IAAI,EAAS,MAAQ,EAAM,MAAO,EAAS,OAAS,EAAM,OAAO,CACvF,GAAI,CAAC,GAAa,OAChB,MAAO,CACL,MAAO,EACP,SAAU,EAAS,MAAQ,EAAM,MAAQ,GAAY,EACrD,SAAU,EAAS,OAAS,EAAM,OAAS,GAAY,EACxD,CAEH,IAAM,EAAS,EAAA,QAAQ,EAAY,CAC7B,EAAQ,KAAK,IAAI,EAAO,KAAO,EAAO,KAAM,GAAG,CAC/C,EAAS,KAAK,IAAI,EAAO,KAAO,EAAO,KAAM,GAAG,CAChD,EAAU,KAAK,IAAI,EAAO,EAAO,CAAG,EACtC,EAAQ,KAAK,IACf,EAAS,OAAS,EAAQ,EAAU,GACpC,EAAS,QAAU,EAAS,EAAU,GACvC,CACG,IAAa,UACf,EAAQ,KAAK,IAAI,EAAO,KAAK,IAAI,EAAS,MAAQ,EAAM,MAAO,EAAS,OAAS,EAAM,OAAO,CAAC,EAEjG,IAAI,EAAU,EAAS,MAAQ,GAAM,EAAO,KAAO,EAAO,MAAQ,EAAK,EACnE,EAAU,EAAS,OAAS,GAAM,EAAO,KAAO,EAAO,MAAQ,EAAK,EAKxE,OAJI,IAAa,UACf,EAAU,KAAK,IAAI,EAAG,KAAK,IAAI,EAAS,EAAS,MAAQ,EAAM,MAAQ,EAAM,CAAC,CAC9E,EAAU,KAAK,IAAI,EAAG,KAAK,IAAI,EAAS,EAAS,OAAS,EAAM,OAAS,EAAM,CAAC,EAE3E,CAAE,QAAO,UAAS,UAAS,CAIpC,SAAgB,EACd,EACA,EACA,EACa,CACb,IAAM,EAAO,KAAK,IAAI,EAAG,CAAC,EAAU,QAAU,EAAU,MAAM,CACxD,EAAM,KAAK,IAAI,EAAG,CAAC,EAAU,QAAU,EAAU,MAAM,CACvD,EAAQ,KAAK,IAAI,EAAM,OAAQ,EAAS,MAAQ,EAAU,SAAW,EAAU,MAAM,CACrF,EAAS,KAAK,IAAI,EAAM,QAAS,EAAS,OAAS,EAAU,SAAW,EAAU,MAAM,CAE9F,OADI,GAAS,GAAQ,GAAU,EAAY,KACpC,CAAE,EAAG,EAAM,EAAG,EAAK,MAAO,EAAQ,EAAM,OAAQ,EAAS,EAAK,CAQvE,SAAgB,EAAe,CAC7B,UACA,QACA,UACA,WAMC,CACD,IAAM,EAAS,EAAQ,MAAQ,EAAM,MAC/B,EAAS,EAAQ,OAAS,EAAM,OAChC,EAAU,KAAK,IAAI,EAAG,KAAK,MAAM,EAAQ,EAAI,EAAO,CAAC,CACrD,EAAU,KAAK,IAAI,EAAG,KAAK,MAAM,EAAQ,EAAI,EAAO,CAAC,CACrD,EACJ,KAAK,IAAI,EAAQ,MAAO,KAAK,MAAM,EAAQ,EAAI,EAAQ,OAAS,EAAO,CAAC,CAAG,EACvE,EACJ,KAAK,IAAI,EAAQ,OAAQ,KAAK,MAAM,EAAQ,EAAI,EAAQ,QAAU,EAAO,CAAC,CAAG,EACzE,EAAO,CACX,EAAG,EAAU,EACb,EAAG,EAAU,EACb,MAAO,EAAc,EACrB,OAAQ,EAAe,EACxB,CACD,MAAO,CACL,OAAQ,CAAE,EAAG,EAAS,EAAG,EAAS,MAAO,EAAa,OAAQ,EAAc,CAC5E,OACA,YAAa,KAAK,IAAI,EAAG,KAAK,IAAI,EAAa,KAAK,KAAK,EAAK,MAAQ,EAAQ,CAAC,CAAC,CAChF,aAAc,KAAK,IAAI,EAAG,KAAK,IAAI,EAAc,KAAK,KAAK,EAAK,OAAS,EAAQ,CAAC,CAAC,CACpF,CAIH,SAAgB,EACd,EACA,EACA,EACS,CACT,IAAM,EAAU,KAMhB,GAAI,EAJF,EAAM,KAAK,GAAK,EAAQ,EAAI,GAC5B,EAAM,KAAK,GAAK,EAAQ,EAAI,GAC5B,EAAM,KAAK,EAAI,EAAM,KAAK,OAAS,EAAQ,EAAI,EAAQ,MAAQ,GAC/D,EAAM,KAAK,EAAI,EAAM,KAAK,QAAU,EAAQ,EAAI,EAAQ,OAAS,GACpD,MAAO,GAEtB,IAAM,EAAQ,KAAK,IAAI,EAAS,QAAS,EAAS,QAAQ,MAAQ,EAAS,MAAM,MAAM,CACjF,EAAQ,KAAK,IAAI,EAAS,QAAS,EAAS,QAAQ,OAAS,EAAS,MAAM,OAAO,CACzF,OACE,EAAM,YAAc,EAAM,KAAK,OAAS,EAAQ,KAChD,EAAM,aAAe,EAAM,KAAK,QAAU,EAAQ"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getBBox as e } from "./geometry.js";
|
|
3
|
+
//#region src/components/ShapeEditor/_model/viewerPatch.ts
|
|
4
|
+
function t({ viewport: t, image: n, focusPoints: r, zoomPadding: i, focusFit: a }) {
|
|
5
|
+
let o = Math.min(t.width / n.width, t.height / n.height);
|
|
6
|
+
if (!r?.length) return {
|
|
7
|
+
scale: o,
|
|
8
|
+
offsetX: (t.width - n.width * o) / 2,
|
|
9
|
+
offsetY: (t.height - n.height * o) / 2
|
|
10
|
+
};
|
|
11
|
+
let s = e(r), c = Math.max(s.maxX - s.minX, 50), l = Math.max(s.maxY - s.minY, 50), u = Math.min(c, l) * i, d = Math.min(t.width / (c + u * 2), t.height / (l + u * 2));
|
|
12
|
+
a === "cover" && (d = Math.max(d, Math.max(t.width / n.width, t.height / n.height)));
|
|
13
|
+
let f = t.width / 2 - (s.minX + s.maxX) / 2 * d, p = t.height / 2 - (s.minY + s.maxY) / 2 * d;
|
|
14
|
+
return a === "cover" && (f = Math.min(0, Math.max(f, t.width - n.width * d)), p = Math.min(0, Math.max(p, t.height - n.height * d))), {
|
|
15
|
+
scale: d,
|
|
16
|
+
offsetX: f,
|
|
17
|
+
offsetY: p
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function n(e, t, n) {
|
|
21
|
+
let r = Math.max(0, -e.offsetX / e.scale), i = Math.max(0, -e.offsetY / e.scale), a = Math.min(n.width, (t.width - e.offsetX) / e.scale), o = Math.min(n.height, (t.height - e.offsetY) / e.scale);
|
|
22
|
+
return a <= r || o <= i ? null : {
|
|
23
|
+
x: r,
|
|
24
|
+
y: i,
|
|
25
|
+
width: a - r,
|
|
26
|
+
height: o - i
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function r({ visible: e, image: t, natural: n, density: r }) {
|
|
30
|
+
let i = n.width / t.width, a = n.height / t.height, o = Math.max(0, Math.floor(e.x * i)), s = Math.max(0, Math.floor(e.y * a)), c = Math.min(n.width, Math.ceil((e.x + e.width) * i)) - o, l = Math.min(n.height, Math.ceil((e.y + e.height) * a)) - s, u = {
|
|
31
|
+
x: o / i,
|
|
32
|
+
y: s / a,
|
|
33
|
+
width: c / i,
|
|
34
|
+
height: l / a
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
source: {
|
|
38
|
+
x: o,
|
|
39
|
+
y: s,
|
|
40
|
+
width: c,
|
|
41
|
+
height: l
|
|
42
|
+
},
|
|
43
|
+
rect: u,
|
|
44
|
+
outputWidth: Math.max(1, Math.min(c, Math.ceil(u.width * r))),
|
|
45
|
+
outputHeight: Math.max(1, Math.min(l, Math.ceil(u.height * r)))
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function i(e, t, n) {
|
|
49
|
+
let r = 1e-6;
|
|
50
|
+
if (!(e.rect.x <= t.x + r && e.rect.y <= t.y + r && e.rect.x + e.rect.width >= t.x + t.width - r && e.rect.y + e.rect.height >= t.y + t.height - r)) return !1;
|
|
51
|
+
let i = Math.min(n.density, n.natural.width / n.image.width), a = Math.min(n.density, n.natural.height / n.image.height);
|
|
52
|
+
return e.outputWidth / e.rect.width >= i * .99 && e.outputHeight / e.rect.height >= a * .99;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { t as computeViewerTransform, n as getVisibleImageRect, i as patchCovers, r as planImagePatch };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=viewerPatch.js.map
|