@aivex/ui 1.2.0-dev.6 → 1.2.0-dev.60
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 +195 -1
- package/dist/DESIGN.md +241 -0
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/comment.cjs +1 -114
- package/dist/comment.js +4 -13623
- package/dist/components/Accordion/Accordion.cjs +2 -0
- package/dist/components/Accordion/Accordion.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.d.cts +111 -0
- package/dist/components/Accordion/Accordion.d.ts +111 -0
- package/dist/components/Accordion/Accordion.js +75 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/index.d.cts +2 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.cjs +2 -0
- package/dist/components/Avatar/Avatar.cjs.map +1 -0
- package/dist/components/Avatar/Avatar.d.cts +42 -0
- package/dist/components/Avatar/Avatar.d.ts +26 -4
- package/dist/components/Avatar/Avatar.js +107 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.cts +2 -0
- package/dist/components/Avatar/index.d.ts +2 -2
- package/dist/components/Badge/Badge.cjs +2 -0
- package/dist/components/Badge/Badge.cjs.map +1 -0
- package/dist/components/Badge/Badge.d.cts +93 -0
- package/dist/components/Badge/Badge.d.ts +66 -1
- package/dist/components/Badge/Badge.js +232 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/index.d.cts +2 -0
- package/dist/components/Badge/index.d.ts +2 -2
- package/dist/components/BreadCrumb/BreadCrumb.cjs +2 -0
- package/dist/components/BreadCrumb/BreadCrumb.cjs.map +1 -0
- package/dist/components/BreadCrumb/BreadCrumb.d.cts +57 -0
- package/dist/components/BreadCrumb/BreadCrumb.d.ts +34 -2
- package/dist/components/BreadCrumb/BreadCrumb.js +98 -0
- package/dist/components/BreadCrumb/BreadCrumb.js.map +1 -0
- package/dist/components/BreadCrumb/index.d.cts +2 -0
- package/dist/components/BreadCrumb/index.d.ts +2 -2
- package/dist/components/Button/Button.cjs +2 -0
- package/dist/components/Button/Button.cjs.map +1 -0
- package/dist/components/Button/Button.d.cts +51 -0
- package/dist/components/Button/Button.d.ts +33 -2
- package/dist/components/Button/Button.js +127 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/index.d.cts +2 -0
- package/dist/components/Button/index.d.ts +2 -2
- package/dist/components/Calendar/Calendar.cjs +2 -0
- package/dist/components/Calendar/Calendar.cjs.map +1 -0
- package/dist/components/Calendar/Calendar.d.cts +81 -0
- package/dist/components/Calendar/Calendar.d.ts +81 -0
- package/dist/components/Calendar/Calendar.js +150 -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.d.cts +35 -0
- package/dist/components/Calendar/date.d.ts +35 -0
- package/dist/components/Calendar/date.js +54 -0
- package/dist/components/Calendar/date.js.map +1 -0
- package/dist/components/Calendar/index.d.cts +2 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Card/Card.cjs +2 -0
- package/dist/components/Card/Card.cjs.map +1 -0
- package/dist/components/Card/Card.d.cts +47 -0
- package/dist/components/Card/Card.d.ts +38 -6
- package/dist/components/Card/Card.js +33 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/index.d.cts +2 -0
- package/dist/components/Card/index.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.cjs +2 -0
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.cts +36 -0
- package/dist/components/Checkbox/Checkbox.d.ts +30 -7
- package/dist/components/Checkbox/Checkbox.js +49 -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.cts +26 -0
- package/dist/components/Checkbox/ChipsCheckbox.d.ts +24 -5
- package/dist/components/Checkbox/ChipsCheckbox.js +27 -0
- package/dist/components/Checkbox/ChipsCheckbox.js.map +1 -0
- package/dist/components/Checkbox/index.d.cts +4 -0
- package/dist/components/Checkbox/index.d.ts +4 -4
- package/dist/components/Coachmark/Coachmark.cjs +2 -0
- package/dist/components/Coachmark/Coachmark.cjs.map +1 -0
- package/dist/components/Coachmark/Coachmark.d.cts +92 -0
- package/dist/components/Coachmark/Coachmark.d.ts +58 -20
- package/dist/components/Coachmark/Coachmark.js +110 -0
- package/dist/components/Coachmark/Coachmark.js.map +1 -0
- package/dist/components/Coachmark/index.d.cts +2 -0
- package/dist/components/Coachmark/index.d.ts +2 -2
- package/dist/components/Comment/CommentInput.cjs +2 -0
- package/dist/components/Comment/CommentInput.cjs.map +1 -0
- package/dist/components/Comment/CommentInput.d.cts +75 -0
- package/dist/components/Comment/CommentInput.d.ts +51 -6
- package/dist/components/Comment/CommentInput.js +76 -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.d.cts +48 -0
- package/dist/components/Comment/CommentPin.d.ts +35 -4
- package/dist/components/Comment/CommentPin.js +40 -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.d.cts +45 -0
- package/dist/components/Comment/MentionInput.d.ts +19 -4
- package/dist/components/Comment/MentionInput.js +93 -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.cts +19 -0
- package/dist/components/Comment/MentionList.d.ts +9 -4
- package/dist/components/Comment/MentionList.js +97 -0
- package/dist/components/Comment/MentionList.js.map +1 -0
- package/dist/components/Comment/index.d.cts +4 -0
- package/dist/components/Comment/index.d.ts +4 -4
- package/dist/components/Comment/mentionContent.cjs +5 -0
- package/dist/components/Comment/mentionContent.cjs.map +1 -0
- package/dist/components/Comment/mentionContent.d.cts +5 -0
- package/dist/components/Comment/mentionContent.d.ts +5 -0
- package/dist/components/Comment/mentionContent.js +40 -0
- package/dist/components/Comment/mentionContent.js.map +1 -0
- package/dist/components/Comment/types.d.cts +16 -0
- package/dist/components/Comment/types.d.ts +6 -2
- package/dist/components/Comment/useMentionSuggestion.cjs +2 -0
- package/dist/components/Comment/useMentionSuggestion.cjs.map +1 -0
- package/dist/components/Comment/useMentionSuggestion.d.cts +19 -0
- package/dist/components/Comment/useMentionSuggestion.d.ts +6 -2
- package/dist/components/Comment/useMentionSuggestion.js +78 -0
- package/dist/components/Comment/useMentionSuggestion.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenu.cjs +2 -0
- package/dist/components/ContextMenu/ContextMenu.cjs.map +1 -0
- package/dist/components/ContextMenu/ContextMenu.d.cts +72 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +72 -0
- package/dist/components/ContextMenu/ContextMenu.js +56 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/components/ContextMenu/index.d.cts +2 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/DataGrid/DataGrid.cjs +2 -0
- package/dist/components/DataGrid/DataGrid.cjs.map +1 -0
- package/dist/components/DataGrid/DataGrid.d.cts +136 -0
- package/dist/components/DataGrid/DataGrid.d.ts +114 -70
- package/dist/components/DataGrid/DataGrid.js +188 -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.cts +41 -0
- package/dist/components/DataGrid/DataGridColumnSettings.d.ts +41 -0
- package/dist/components/DataGrid/DataGridColumnSettings.js +199 -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.d.cts +165 -0
- package/dist/components/DataGrid/DataGridPrimitives.d.ts +165 -0
- package/dist/components/DataGrid/DataGridPrimitives.js +141 -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.d.cts +66 -0
- package/dist/components/DataGrid/DataGridRows.d.ts +66 -0
- package/dist/components/DataGrid/DataGridRows.js +108 -0
- package/dist/components/DataGrid/DataGridRows.js.map +1 -0
- package/dist/components/DataGrid/index.d.cts +8 -0
- package/dist/components/DataGrid/index.d.ts +6 -2
- 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.d.cts +77 -0
- package/dist/components/Dialog/Dialog.d.ts +63 -6
- package/dist/components/Dialog/Dialog.js +109 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/index.d.cts +2 -0
- package/dist/components/Dialog/index.d.ts +2 -2
- package/dist/components/Divider/Divider.cjs +2 -0
- package/dist/components/Divider/Divider.cjs.map +1 -0
- package/dist/components/Divider/Divider.d.cts +30 -0
- package/dist/components/Divider/Divider.d.ts +19 -0
- package/dist/components/Divider/Divider.js +58 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.cts +2 -0
- package/dist/components/Divider/index.d.ts +2 -2
- package/dist/components/DraggableScroll/DraggableScroll.cjs +2 -0
- package/dist/components/DraggableScroll/DraggableScroll.cjs.map +1 -0
- package/dist/components/DraggableScroll/DraggableScroll.d.cts +47 -0
- package/dist/components/DraggableScroll/DraggableScroll.d.ts +38 -2
- package/dist/components/DraggableScroll/DraggableScroll.js +45 -0
- package/dist/components/DraggableScroll/DraggableScroll.js.map +1 -0
- package/dist/components/DraggableScroll/index.d.cts +2 -0
- package/dist/components/DraggableScroll/index.d.ts +2 -2
- package/dist/components/Drawer/Drawer.cjs +2 -0
- package/dist/components/Drawer/Drawer.cjs.map +1 -0
- package/dist/components/Drawer/Drawer.d.cts +161 -0
- package/dist/components/Drawer/Drawer.d.ts +161 -0
- package/dist/components/Drawer/Drawer.js +110 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Drawer/index.d.cts +2 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.cjs +2 -0
- package/dist/components/EmptyState/EmptyState.cjs.map +1 -0
- package/dist/components/EmptyState/EmptyState.d.cts +61 -0
- package/dist/components/EmptyState/EmptyState.d.ts +61 -0
- package/dist/components/EmptyState/EmptyState.js +50 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/EmptyState/index.d.cts +2 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/Field/Field.cjs +2 -0
- package/dist/components/Field/Field.cjs.map +1 -0
- package/dist/components/Field/Field.d.cts +111 -0
- package/dist/components/Field/Field.d.ts +85 -20
- package/dist/components/Field/Field.js +78 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/Field/FieldStateContext.cjs +2 -0
- package/dist/components/Field/FieldStateContext.cjs.map +1 -0
- package/dist/components/Field/FieldStateContext.d.cts +12 -0
- package/dist/components/Field/FieldStateContext.d.ts +12 -0
- package/dist/components/Field/FieldStateContext.js +14 -0
- package/dist/components/Field/FieldStateContext.js.map +1 -0
- package/dist/components/Field/index.d.cts +1 -0
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/FilterModal/FilterModal.cjs +2 -0
- package/dist/components/FilterModal/FilterModal.cjs.map +1 -0
- package/dist/components/FilterModal/FilterModal.d.cts +83 -0
- package/dist/components/FilterModal/FilterModal.d.ts +52 -1
- package/dist/components/FilterModal/FilterModal.js +120 -0
- package/dist/components/FilterModal/FilterModal.js.map +1 -0
- package/dist/components/FilterModal/index.d.cts +2 -0
- package/dist/components/FilterModal/index.d.ts +2 -2
- package/dist/components/HoverCard/HoverCard.cjs +2 -0
- package/dist/components/HoverCard/HoverCard.cjs.map +1 -0
- package/dist/components/HoverCard/HoverCard.d.cts +61 -0
- package/dist/components/HoverCard/HoverCard.d.ts +61 -0
- package/dist/components/HoverCard/HoverCard.js +44 -0
- package/dist/components/HoverCard/HoverCard.js.map +1 -0
- package/dist/components/HoverCard/index.d.cts +2 -0
- package/dist/components/HoverCard/index.d.ts +2 -0
- package/dist/components/Icon/index.cjs +2 -0
- package/dist/components/Icon/index.cjs.map +1 -0
- package/dist/components/Icon/index.d.cts +2105 -0
- package/dist/components/Icon/index.d.ts +2093 -275
- package/dist/components/Icon/index.js +4490 -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.cts +10 -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.cts +8 -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.d.cts +46 -0
- package/dist/components/IconButton/IconButton.d.ts +33 -4
- package/dist/components/IconButton/IconButton.js +74 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/index.d.cts +2 -0
- package/dist/components/IconButton/index.d.ts +2 -2
- package/dist/components/Illustration/Illustration.cjs +2 -0
- package/dist/components/Illustration/Illustration.cjs.map +1 -0
- package/dist/components/Illustration/Illustration.d.cts +37 -0
- package/dist/components/Illustration/Illustration.d.ts +37 -0
- package/dist/components/Illustration/Illustration.js +40 -0
- package/dist/components/Illustration/Illustration.js.map +1 -0
- package/dist/components/Illustration/assets/box-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/box-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/box-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/box-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/box-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/box-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/box-light.webp.js +7 -0
- package/dist/components/Illustration/assets/box-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/equipment-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/equipment-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/equipment-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/equipment-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/equipment-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/equipment-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/equipment-light.webp.js +7 -0
- package/dist/components/Illustration/assets/equipment-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/failed-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/failed-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/failed-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/failed-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/failed-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/failed-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/failed-light.webp.js +7 -0
- package/dist/components/Illustration/assets/failed-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/file-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/file-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/file-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/file-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/file-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/file-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/file-light.webp.js +7 -0
- package/dist/components/Illustration/assets/file-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/images-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/images-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/images-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/images-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/images-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/images-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/images-light.webp.js +7 -0
- package/dist/components/Illustration/assets/images-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/letter-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/letter-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/letter-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/letter-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/letter-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/letter-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/letter-light.webp.js +7 -0
- package/dist/components/Illustration/assets/letter-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/message-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/message-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/message-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/message-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/message-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/message-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/message-light.webp.js +7 -0
- package/dist/components/Illustration/assets/message-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/network-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/network-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/network-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/network-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/network-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/network-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/network-light.webp.js +7 -0
- package/dist/components/Illustration/assets/network-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/no-data-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/no-data-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/no-data-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/no-data-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/no-data-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/no-data-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/no-data-light.webp.js +7 -0
- package/dist/components/Illustration/assets/no-data-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/paper-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/paper-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/paper-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/paper-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/paper-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/paper-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/paper-light.webp.js +7 -0
- package/dist/components/Illustration/assets/paper-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/success-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/success-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/success-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/success-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/success-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/success-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/success-light.webp.js +7 -0
- package/dist/components/Illustration/assets/success-light.webp.js.map +1 -0
- package/dist/components/Illustration/assets/warning-dark.webp.cjs +2 -0
- package/dist/components/Illustration/assets/warning-dark.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/warning-dark.webp.js +7 -0
- package/dist/components/Illustration/assets/warning-dark.webp.js.map +1 -0
- package/dist/components/Illustration/assets/warning-light.webp.cjs +2 -0
- package/dist/components/Illustration/assets/warning-light.webp.cjs.map +1 -0
- package/dist/components/Illustration/assets/warning-light.webp.js +7 -0
- package/dist/components/Illustration/assets/warning-light.webp.js.map +1 -0
- package/dist/components/Illustration/illustrations.cjs +2 -0
- package/dist/components/Illustration/illustrations.cjs.map +1 -0
- package/dist/components/Illustration/illustrations.d.cts +81 -0
- package/dist/components/Illustration/illustrations.d.ts +81 -0
- package/dist/components/Illustration/illustrations.js +104 -0
- package/dist/components/Illustration/illustrations.js.map +1 -0
- package/dist/components/Illustration/index.d.cts +1 -0
- package/dist/components/Illustration/index.d.ts +1 -0
- package/dist/components/InputBase/InputBase.cjs +2 -0
- package/dist/components/InputBase/InputBase.cjs.map +1 -0
- package/dist/components/InputBase/InputBase.d.cts +59 -0
- package/dist/components/InputBase/InputBase.d.ts +35 -7
- package/dist/components/InputBase/InputBase.js +87 -0
- package/dist/components/InputBase/InputBase.js.map +1 -0
- package/dist/components/InputBase/index.d.cts +1 -0
- package/dist/components/InputBase/index.d.ts +1 -1
- package/dist/components/InputBase/useInputState.cjs +2 -0
- package/dist/components/InputBase/useInputState.cjs.map +1 -0
- package/dist/components/InputBase/useInputState.d.cts +19 -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.d.cts +43 -0
- package/dist/components/InteractionLayer/InteractionLayer.d.ts +34 -0
- package/dist/components/InteractionLayer/InteractionLayer.js +17 -0
- package/dist/components/InteractionLayer/InteractionLayer.js.map +1 -0
- package/dist/components/InteractionLayer/index.d.cts +1 -0
- package/dist/components/InteractionLayer/index.d.ts +1 -1
- package/dist/components/Logo/index.cjs +2 -0
- package/dist/components/Logo/index.cjs.map +1 -0
- package/dist/components/Logo/index.d.cts +92 -0
- package/dist/components/Logo/index.d.ts +88 -13
- package/dist/components/Logo/index.js +1949 -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.d.cts +183 -0
- package/dist/components/Menu/Menu.d.ts +126 -27
- package/dist/components/Menu/Menu.js +216 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/index.d.cts +2 -0
- package/dist/components/Menu/index.d.ts +2 -2
- package/dist/components/Messagebox/Messagebox.cjs +2 -0
- package/dist/components/Messagebox/Messagebox.cjs.map +1 -0
- package/dist/components/Messagebox/Messagebox.d.cts +50 -0
- package/dist/components/Messagebox/Messagebox.d.ts +39 -3
- package/dist/components/Messagebox/Messagebox.js +84 -0
- package/dist/components/Messagebox/Messagebox.js.map +1 -0
- package/dist/components/Messagebox/index.d.cts +2 -0
- package/dist/components/Messagebox/index.d.ts +2 -2
- package/dist/components/Modal/Modal.cjs +2 -0
- package/dist/components/Modal/Modal.cjs.map +1 -0
- package/dist/components/Modal/Modal.d.cts +161 -0
- package/dist/components/Modal/Modal.d.ts +131 -7
- package/dist/components/Modal/Modal.js +195 -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.d.cts +80 -0
- package/dist/components/Modal/ModalBase.d.ts +80 -0
- package/dist/components/Modal/ModalBase.js +44 -0
- package/dist/components/Modal/ModalBase.js.map +1 -0
- package/dist/components/Modal/index.d.cts +4 -0
- package/dist/components/Modal/index.d.ts +4 -2
- package/dist/components/Nav/Nav.cjs +2 -0
- package/dist/components/Nav/Nav.cjs.map +1 -0
- package/dist/components/Nav/Nav.d.cts +69 -0
- package/dist/components/Nav/Nav.d.ts +46 -0
- package/dist/components/Nav/Nav.js +73 -0
- package/dist/components/Nav/Nav.js.map +1 -0
- package/dist/components/Nav/index.d.cts +2 -0
- package/dist/components/Nav/index.d.ts +2 -2
- package/dist/components/NumberField/NumberField.cjs +2 -0
- package/dist/components/NumberField/NumberField.cjs.map +1 -0
- package/dist/components/NumberField/NumberField.d.cts +79 -0
- package/dist/components/NumberField/NumberField.d.ts +79 -0
- package/dist/components/NumberField/NumberField.js +65 -0
- package/dist/components/NumberField/NumberField.js.map +1 -0
- package/dist/components/NumberField/index.d.cts +2 -0
- package/dist/components/NumberField/index.d.ts +2 -0
- package/dist/components/Overlay/Overlay.cjs +2 -0
- package/dist/components/Overlay/Overlay.cjs.map +1 -0
- package/dist/components/Overlay/Overlay.d.cts +36 -0
- package/dist/components/Overlay/Overlay.d.ts +30 -4
- package/dist/components/Overlay/Overlay.js +24 -0
- package/dist/components/Overlay/Overlay.js.map +1 -0
- package/dist/components/Overlay/index.d.cts +2 -0
- package/dist/components/Overlay/index.d.ts +2 -2
- package/dist/components/Pagination/Pagination.cjs +2 -0
- package/dist/components/Pagination/Pagination.cjs.map +1 -0
- package/dist/components/Pagination/Pagination.d.cts +68 -0
- package/dist/components/Pagination/Pagination.d.ts +45 -2
- package/dist/components/Pagination/Pagination.js +127 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/index.d.cts +2 -0
- package/dist/components/Pagination/index.d.ts +2 -2
- package/dist/components/Panel/Panel.cjs +2 -0
- package/dist/components/Panel/Panel.cjs.map +1 -0
- package/dist/components/Panel/Panel.d.cts +124 -0
- package/dist/components/Panel/Panel.d.ts +119 -8
- package/dist/components/Panel/Panel.js +92 -0
- package/dist/components/Panel/Panel.js.map +1 -0
- package/dist/components/Panel/index.d.cts +2 -0
- package/dist/components/Panel/index.d.ts +2 -2
- package/dist/components/Popover/Popover.cjs +2 -0
- package/dist/components/Popover/Popover.cjs.map +1 -0
- package/dist/components/Popover/Popover.d.cts +100 -0
- package/dist/components/Popover/Popover.d.ts +67 -14
- package/dist/components/Popover/Popover.js +79 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/index.d.cts +2 -0
- package/dist/components/Popover/index.d.ts +2 -2
- package/dist/components/ProgressBar/ProgressBar.cjs +2 -0
- package/dist/components/ProgressBar/ProgressBar.cjs.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.cts +45 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +32 -0
- package/dist/components/ProgressBar/ProgressBar.js +41 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressBar/index.d.cts +2 -0
- package/dist/components/ProgressBar/index.d.ts +2 -2
- package/dist/components/Radio/Radio.cjs +2 -0
- package/dist/components/Radio/Radio.cjs.map +1 -0
- package/dist/components/Radio/Radio.d.cts +61 -0
- package/dist/components/Radio/Radio.d.ts +56 -6
- package/dist/components/Radio/Radio.js +62 -0
- package/dist/components/Radio/Radio.js.map +1 -0
- package/dist/components/Radio/index.d.cts +2 -0
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/ScrollArea/ScrollArea.cjs +2 -0
- package/dist/components/ScrollArea/ScrollArea.cjs.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.d.cts +59 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +51 -6
- package/dist/components/ScrollArea/ScrollArea.js +62 -0
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/components/ScrollArea/index.d.cts +2 -0
- package/dist/components/ScrollArea/index.d.ts +2 -2
- package/dist/components/Segmented/Segmented.cjs +2 -0
- package/dist/components/Segmented/Segmented.cjs.map +1 -0
- package/dist/components/Segmented/Segmented.d.cts +56 -0
- package/dist/components/Segmented/Segmented.d.ts +45 -4
- package/dist/components/Segmented/Segmented.js +61 -0
- package/dist/components/Segmented/Segmented.js.map +1 -0
- package/dist/components/Segmented/index.d.cts +2 -0
- package/dist/components/Segmented/index.d.ts +2 -2
- package/dist/components/SelectBox/SelectBox.cjs +2 -0
- package/dist/components/SelectBox/SelectBox.cjs.map +1 -0
- package/dist/components/SelectBox/SelectBox.d.cts +93 -0
- package/dist/components/SelectBox/SelectBox.d.ts +62 -5
- package/dist/components/SelectBox/SelectBox.js +85 -0
- package/dist/components/SelectBox/SelectBox.js.map +1 -0
- package/dist/components/SelectBox/index.d.cts +2 -0
- package/dist/components/SelectBox/index.d.ts +2 -2
- package/dist/components/SelectButton/SelectButton.cjs +2 -0
- package/dist/components/SelectButton/SelectButton.cjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.d.cts +57 -0
- package/dist/components/SelectButton/SelectButton.d.ts +57 -0
- package/dist/components/SelectButton/SelectButton.js +43 -0
- package/dist/components/SelectButton/SelectButton.js.map +1 -0
- package/dist/components/SelectButton/index.d.cts +2 -0
- package/dist/components/SelectButton/index.d.ts +2 -0
- package/dist/components/ShapeEditor/ShapeEditor.cjs +2 -0
- package/dist/components/ShapeEditor/ShapeEditor.cjs.map +1 -0
- package/dist/components/ShapeEditor/ShapeEditor.d.cts +40 -0
- package/dist/components/ShapeEditor/ShapeEditor.d.ts +38 -7
- package/dist/components/ShapeEditor/ShapeEditor.js +564 -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.d.cts +92 -0
- package/dist/components/ShapeEditor/ShapeViewer.d.ts +57 -7
- package/dist/components/ShapeEditor/ShapeViewer.js +303 -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.d.cts +17 -0
- package/dist/components/ShapeEditor/_components/AssistantOverlay.d.ts +2 -2
- 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.d.cts +13 -0
- package/dist/components/ShapeEditor/_components/ContextMenu.d.ts +3 -3
- 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.d.cts +8 -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.d.cts +17 -0
- package/dist/components/ShapeEditor/_components/ImageStateOverlay.d.ts +9 -3
- package/dist/components/ShapeEditor/_components/ImageStateOverlay.js +101 -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.cts +46 -0
- package/dist/components/ShapeEditor/_components/Minimap.d.ts +17 -16
- package/dist/components/ShapeEditor/_components/Minimap.js +172 -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.d.cts +6 -0
- package/dist/components/ShapeEditor/_components/MinimapShape.d.ts +3 -3
- package/dist/components/ShapeEditor/_components/MinimapShape.js +55 -0
- package/dist/components/ShapeEditor/_components/MinimapShape.js.map +1 -0
- package/dist/components/ShapeEditor/_components/OverlayMarkers.cjs +2 -0
- package/dist/components/ShapeEditor/_components/OverlayMarkers.cjs.map +1 -0
- package/dist/components/ShapeEditor/_components/OverlayMarkers.d.cts +16 -0
- package/dist/components/ShapeEditor/_components/OverlayMarkers.d.ts +16 -0
- package/dist/components/ShapeEditor/_components/OverlayMarkers.js +41 -0
- package/dist/components/ShapeEditor/_components/OverlayMarkers.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.d.cts +21 -0
- package/dist/components/ShapeEditor/_components/RegionOverlay.d.ts +1 -1
- 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.d.cts +20 -0
- package/dist/components/ShapeEditor/_components/SelectionInfo.d.ts +10 -3
- 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.cts +28 -0
- package/dist/components/ShapeEditor/_components/SettingsPanel.d.ts +18 -5
- 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.d.cts +15 -0
- package/dist/components/ShapeEditor/_constants.d.ts +7 -25
- 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.d.cts +3 -0
- package/dist/components/ShapeEditor/_model/brush.d.ts +1 -1
- 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.d.cts +22 -0
- package/dist/components/ShapeEditor/_model/clipboard.d.ts +22 -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.d.cts +23 -0
- package/dist/components/ShapeEditor/_model/cursors.d.ts +7 -2
- 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.d.cts +182 -0
- package/dist/components/ShapeEditor/_model/geometry.d.ts +54 -2
- 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.cts +38 -0
- package/dist/components/ShapeEditor/_model/imageDiagnosis.d.ts +38 -0
- package/dist/components/ShapeEditor/_model/imageDiagnosis.js +358 -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.d.cts +29 -0
- package/dist/components/ShapeEditor/_model/imageLoad.d.ts +29 -0
- package/dist/components/ShapeEditor/_model/imageLoad.js +88 -0
- package/dist/components/ShapeEditor/_model/imageLoad.js.map +1 -0
- package/dist/components/ShapeEditor/_model/imageSignature.cjs +2 -0
- package/dist/components/ShapeEditor/_model/imageSignature.cjs.map +1 -0
- package/dist/components/ShapeEditor/_model/imageSignature.d.cts +18 -0
- package/dist/components/ShapeEditor/_model/imageSignature.d.ts +18 -0
- package/dist/components/ShapeEditor/_model/imageSignature.js +196 -0
- package/dist/components/ShapeEditor/_model/imageSignature.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.d.cts +11 -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.d.cts +17 -0
- package/dist/components/ShapeEditor/_model/keymap.d.ts +2 -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.cts +108 -0
- package/dist/components/ShapeEditor/_model/overlays.d.ts +11 -25
- 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.d.cts +13 -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.d.cts +2 -0
- package/dist/components/ShapeEditor/_model/polygonFill.d.ts +2 -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.cts +13 -0
- package/dist/components/ShapeEditor/_model/props.d.ts +11 -443
- 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.d.cts +21 -0
- package/dist/components/ShapeEditor/_model/scalarMask.d.ts +1 -1
- 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.cts +14 -0
- package/dist/components/ShapeEditor/_model/shapeHitTest.d.ts +14 -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.d.cts +16 -0
- package/dist/components/ShapeEditor/_model/shapeRenderStyle.d.ts +1 -1
- 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.d.cts +62 -0
- package/dist/components/ShapeEditor/_model/strings.d.ts +10 -1
- package/dist/components/ShapeEditor/_model/strings.js +130 -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.d.cts +29 -0
- package/dist/components/ShapeEditor/_model/tools.d.ts +4 -2
- 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.cts +37 -0
- package/dist/components/ShapeEditor/_model/types/assistant.d.ts +37 -0
- package/dist/components/ShapeEditor/_model/types/handle.d.cts +124 -0
- package/dist/components/ShapeEditor/_model/types/handle.d.ts +124 -0
- package/dist/components/ShapeEditor/_model/types/props.d.cts +432 -0
- package/dist/components/ShapeEditor/_model/types/props.d.ts +432 -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.cts +73 -0
- package/dist/components/ShapeEditor/_model/viewSettings.d.ts +60 -2
- 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.d.cts +60 -0
- package/dist/components/ShapeEditor/_model/viewerPatch.d.ts +60 -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.cts +36 -0
- package/dist/components/ShapeEditor/_model/viewport.d.ts +10 -2
- 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.cts +121 -0
- package/dist/components/ShapeEditor/_renderers/PixiRenderer.d.ts +28 -76
- 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.cts +35 -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.cts +36 -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.cts +34 -0
- package/dist/components/ShapeEditor/_renderers/previewLayer.d.ts +34 -0
- package/dist/components/ShapeEditor/_renderers/previewLayer.js +112 -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.cts +49 -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.cts +27 -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.d.cts +55 -0
- package/dist/components/ShapeEditor/_renderers/transformDriver.d.ts +55 -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.d.cts +74 -0
- package/dist/components/ShapeEditor/_renderers/transformSession.d.ts +11 -5
- 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.cts +69 -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.cts +129 -0
- package/dist/components/ShapeEditor/_renderers/types.d.ts +50 -27
- 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.d.cts +26 -0
- package/dist/components/ShapeEditor/_state/buildContextMenuItems.d.ts +26 -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.d.cts +42 -0
- package/dist/components/ShapeEditor/_state/buildHotkeyActions.d.ts +42 -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.d.cts +73 -0
- package/dist/components/ShapeEditor/_state/createInteractionController.d.ts +30 -11
- package/dist/components/ShapeEditor/_state/createInteractionController.js +398 -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.d.cts +6 -0
- package/dist/components/ShapeEditor/_state/drawSessionState.d.ts +2 -2
- 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.d.cts +49 -0
- package/dist/components/ShapeEditor/_state/useAssistant.d.ts +4 -3
- package/dist/components/ShapeEditor/_state/useAssistant.js +178 -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.d.cts +64 -0
- package/dist/components/ShapeEditor/_state/useDrawSession.d.ts +9 -6
- package/dist/components/ShapeEditor/_state/useDrawSession.js +372 -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.d.cts +30 -0
- package/dist/components/ShapeEditor/_state/useEditorDocument.d.ts +8 -1
- package/dist/components/ShapeEditor/_state/useEditorDocument.js +173 -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.cts +34 -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.d.cts +25 -0
- package/dist/components/ShapeEditor/_state/useEditorHotkeys.d.ts +5 -5
- 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.cts +15 -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.cts +89 -0
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.d.ts +48 -17
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.js +126 -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.d.cts +7 -0
- package/dist/components/ShapeEditor/_state/useLatestRef.d.ts +7 -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.d.cts +27 -0
- package/dist/components/ShapeEditor/_state/useMinimapNavigation.d.ts +1 -1
- 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.d.cts +26 -0
- package/dist/components/ShapeEditor/_state/useMinimapSync.d.ts +6 -4
- 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.d.cts +31 -0
- package/dist/components/ShapeEditor/_state/useSelectionActions.d.ts +9 -6
- 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.d.cts +32 -0
- package/dist/components/ShapeEditor/_state/useSelectionInfoOverlay.d.ts +32 -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.cts +24 -0
- package/dist/components/ShapeEditor/_state/useSelectionModel.d.ts +24 -0
- package/dist/components/ShapeEditor/_state/useSelectionModel.js +65 -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.d.cts +23 -0
- package/dist/components/ShapeEditor/_state/useViewportControls.d.ts +3 -3
- 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.cts +13 -0
- package/dist/components/ShapeEditor/index.d.ts +13 -8
- package/dist/components/Shortcut/Shortcut.cjs +2 -0
- package/dist/components/Shortcut/Shortcut.cjs.map +1 -0
- package/dist/components/Shortcut/Shortcut.d.cts +24 -0
- package/dist/components/Shortcut/Shortcut.d.ts +16 -0
- package/dist/components/Shortcut/Shortcut.js +22 -0
- package/dist/components/Shortcut/Shortcut.js.map +1 -0
- package/dist/components/Shortcut/index.d.cts +2 -0
- package/dist/components/Shortcut/index.d.ts +2 -2
- package/dist/components/Skeleton/Skeleton.cjs +2 -0
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.cts +26 -0
- package/dist/components/Skeleton/Skeleton.d.ts +21 -2
- package/dist/components/Skeleton/Skeleton.js +20 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/index.d.cts +2 -0
- package/dist/components/Skeleton/index.d.ts +2 -2
- package/dist/components/Slider/Slider.cjs +2 -0
- package/dist/components/Slider/Slider.cjs.map +1 -0
- package/dist/components/Slider/Slider.d.cts +58 -0
- package/dist/components/Slider/Slider.d.ts +52 -5
- package/dist/components/Slider/Slider.js +78 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Slider/index.d.cts +2 -0
- package/dist/components/Slider/index.d.ts +2 -2
- package/dist/components/Spinner/Spinner.cjs +2 -0
- package/dist/components/Spinner/Spinner.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.d.cts +32 -0
- package/dist/components/Spinner/Spinner.d.ts +32 -0
- package/dist/components/Spinner/Spinner.js +27 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/index.d.cts +2 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Switch/Switch.cjs +2 -0
- package/dist/components/Switch/Switch.cjs.map +1 -0
- package/dist/components/Switch/Switch.d.cts +31 -0
- package/dist/components/Switch/Switch.d.ts +22 -3
- package/dist/components/Switch/Switch.js +48 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/index.d.cts +2 -0
- package/dist/components/Switch/index.d.ts +2 -2
- package/dist/components/Tab/Tab.cjs +2 -0
- package/dist/components/Tab/Tab.cjs.map +1 -0
- package/dist/components/Tab/Tab.d.cts +76 -0
- package/dist/components/Tab/Tab.d.ts +70 -13
- package/dist/components/Tab/Tab.js +43 -0
- package/dist/components/Tab/Tab.js.map +1 -0
- package/dist/components/Tab/index.d.cts +2 -0
- package/dist/components/Tab/index.d.ts +2 -2
- package/dist/components/Tag/Tag.cjs +2 -0
- package/dist/components/Tag/Tag.cjs.map +1 -0
- package/dist/components/Tag/Tag.d.cts +50 -0
- package/dist/components/Tag/Tag.d.ts +37 -3
- package/dist/components/Tag/Tag.js +60 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Tag/index.d.cts +2 -0
- package/dist/components/Tag/index.d.ts +2 -2
- package/dist/components/Tagbox/Tagbox.cjs +2 -0
- package/dist/components/Tagbox/Tagbox.cjs.map +1 -0
- package/dist/components/Tagbox/Tagbox.d.cts +65 -0
- package/dist/components/Tagbox/Tagbox.d.ts +48 -8
- package/dist/components/Tagbox/Tagbox.js +89 -0
- package/dist/components/Tagbox/Tagbox.js.map +1 -0
- package/dist/components/Tagbox/index.d.cts +2 -0
- package/dist/components/Tagbox/index.d.ts +2 -2
- package/dist/components/Textarea/Textarea.cjs +2 -0
- package/dist/components/Textarea/Textarea.cjs.map +1 -0
- package/dist/components/Textarea/Textarea.d.cts +49 -0
- package/dist/components/Textarea/Textarea.d.ts +36 -6
- package/dist/components/Textarea/Textarea.js +60 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Textarea/index.d.cts +2 -0
- package/dist/components/Textarea/index.d.ts +2 -2
- package/dist/components/Textbox/Textbox.cjs +2 -0
- package/dist/components/Textbox/Textbox.cjs.map +1 -0
- package/dist/components/Textbox/Textbox.d.cts +47 -0
- package/dist/components/Textbox/Textbox.d.ts +36 -8
- package/dist/components/Textbox/Textbox.js +61 -0
- package/dist/components/Textbox/Textbox.js.map +1 -0
- package/dist/components/Textbox/index.d.cts +2 -0
- package/dist/components/Textbox/index.d.ts +2 -2
- package/dist/components/Toast/Toast.cjs +2 -0
- package/dist/components/Toast/Toast.cjs.map +1 -0
- package/dist/components/Toast/Toast.d.cts +100 -0
- package/dist/components/Toast/Toast.d.ts +88 -5
- package/dist/components/Toast/Toast.js +82 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/index.d.cts +2 -0
- package/dist/components/Toast/index.d.ts +2 -2
- package/dist/components/ToggleButton/ToggleButton.cjs +2 -0
- package/dist/components/ToggleButton/ToggleButton.cjs.map +1 -0
- package/dist/components/ToggleButton/ToggleButton.d.cts +41 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +26 -2
- package/dist/components/ToggleButton/ToggleButton.js +117 -0
- package/dist/components/ToggleButton/ToggleButton.js.map +1 -0
- package/dist/components/ToggleButton/index.d.cts +2 -0
- package/dist/components/ToggleButton/index.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.cjs +2 -0
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.cts +40 -0
- package/dist/components/Tooltip/Tooltip.d.ts +28 -1
- package/dist/components/Tooltip/Tooltip.js +62 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/index.d.cts +2 -0
- package/dist/components/Tooltip/index.d.ts +2 -2
- package/dist/components/TruncatedText/TruncatedText.cjs +2 -0
- package/dist/components/TruncatedText/TruncatedText.cjs.map +1 -0
- package/dist/components/TruncatedText/TruncatedText.d.cts +44 -0
- package/dist/components/TruncatedText/TruncatedText.d.ts +44 -0
- package/dist/components/TruncatedText/TruncatedText.js +84 -0
- package/dist/components/TruncatedText/TruncatedText.js.map +1 -0
- package/dist/components/TruncatedText/index.d.cts +2 -0
- package/dist/components/TruncatedText/index.d.ts +2 -0
- package/dist/components/Typography/Typography.cjs +2 -0
- package/dist/components/Typography/Typography.cjs.map +1 -0
- package/dist/components/Typography/Typography.d.cts +33 -0
- package/dist/components/Typography/Typography.d.ts +21 -0
- package/dist/components/Typography/Typography.js +59 -0
- package/dist/components/Typography/Typography.js.map +1 -0
- package/dist/components/Typography/index.d.cts +2 -0
- package/dist/components/Typography/index.d.ts +2 -2
- package/dist/components/UploadArea/UploadArea.cjs +2 -0
- package/dist/components/UploadArea/UploadArea.cjs.map +1 -0
- package/dist/components/UploadArea/UploadArea.d.cts +82 -0
- package/dist/components/UploadArea/UploadArea.d.ts +66 -1
- package/dist/components/UploadArea/UploadArea.js +121 -0
- package/dist/components/UploadArea/UploadArea.js.map +1 -0
- package/dist/components/UploadArea/index.d.cts +2 -0
- package/dist/components/UploadArea/index.d.ts +2 -2
- package/dist/fonts.css +4 -0
- package/dist/illustration.cjs +1 -0
- package/dist/illustration.js +3 -0
- package/dist/index.cjs +1 -15
- package/dist/index.d.cts +57 -0
- package/dist/index.d.ts +57 -49
- package/dist/index.js +64 -8751
- package/dist/llms-full.txt +6596 -0
- package/dist/llms.txt +123 -0
- package/dist/shape-editor.cjs +1 -1
- package/dist/shape-editor.cjs.map +1 -1
- package/dist/shape-editor.js +10 -5732
- package/dist/shape-editor.js.map +1 -1
- package/dist/styles.css +5 -2
- package/dist/tailwind.css +434 -0
- package/dist/tokens/tokens.css +629 -611
- package/dist/utils/PortalEventBoundary.cjs +2 -0
- package/dist/utils/PortalEventBoundary.cjs.map +1 -0
- package/dist/utils/PortalEventBoundary.d.cts +13 -0
- package/dist/utils/PortalEventBoundary.d.ts +13 -0
- package/dist/utils/PortalEventBoundary.js +12 -0
- package/dist/utils/PortalEventBoundary.js.map +1 -0
- package/dist/utils/Primitive.cjs +2 -0
- package/dist/utils/Primitive.cjs.map +1 -0
- package/dist/utils/Primitive.d.cts +9 -0
- package/dist/utils/Primitive.d.ts +9 -0
- package/dist/utils/Primitive.js +15 -0
- package/dist/utils/Primitive.js.map +1 -0
- package/dist/utils/cn.d.cts +12 -0
- package/dist/utils/cn.d.ts +10 -0
- package/dist/utils/dataAttributes.d.cts +7 -0
- package/dist/utils/dataAttributes.d.ts +7 -0
- package/dist/utils/keyboard.cjs +2 -0
- package/dist/utils/keyboard.cjs.map +1 -0
- package/dist/utils/keyboard.d.cts +3 -0
- package/dist/utils/keyboard.d.ts +3 -0
- package/dist/utils/keyboard.js +14 -0
- package/dist/utils/keyboard.js.map +1 -0
- package/dist/utils/popupArrow.cjs +2 -0
- package/dist/utils/popupArrow.cjs.map +1 -0
- package/dist/utils/popupArrow.d.cts +14 -0
- package/dist/utils/popupArrow.d.ts +14 -0
- package/dist/utils/popupArrow.js +26 -0
- package/dist/utils/popupArrow.js.map +1 -0
- package/dist/utils/popupPositioning.cjs +2 -0
- package/dist/utils/popupPositioning.cjs.map +1 -0
- package/dist/utils/popupPositioning.d.cts +11 -0
- package/dist/utils/popupPositioning.d.ts +11 -0
- package/dist/utils/popupPositioning.js +25 -0
- package/dist/utils/popupPositioning.js.map +1 -0
- package/dist/utils/sheet.cjs +2 -0
- package/dist/utils/sheet.cjs.map +1 -0
- package/dist/utils/sheet.d.cts +17 -0
- package/dist/utils/sheet.d.ts +17 -0
- package/dist/utils/sheet.js +7 -0
- package/dist/utils/sheet.js.map +1 -0
- package/dist/utils/useComposedRefs.cjs +2 -0
- package/dist/utils/useComposedRefs.cjs.map +1 -0
- package/dist/utils/useComposedRefs.d.cts +6 -0
- package/dist/utils/useComposedRefs.d.ts +6 -0
- package/dist/utils/useComposedRefs.js +22 -0
- package/dist/utils/useComposedRefs.js.map +1 -0
- package/dist/utils/useControllableState.cjs +2 -0
- package/dist/utils/useControllableState.cjs.map +1 -0
- package/dist/utils/useControllableState.d.cts +17 -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/useModalFocus.cjs +2 -0
- package/dist/utils/useModalFocus.cjs.map +1 -0
- package/dist/utils/useModalFocus.d.cts +31 -0
- package/dist/utils/useModalFocus.d.ts +31 -0
- package/dist/utils/useModalFocus.js +28 -0
- package/dist/utils/useModalFocus.js.map +1 -0
- package/dist/utils/useResizableWidth.cjs +2 -0
- package/dist/utils/useResizableWidth.cjs.map +1 -0
- package/dist/utils/useResizableWidth.d.cts +30 -0
- package/dist/utils/useResizableWidth.d.ts +30 -0
- package/dist/utils/useResizableWidth.js +32 -0
- package/dist/utils/useResizableWidth.js.map +1 -0
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.js +59 -0
- package/dist/utils.js.map +1 -0
- package/package.json +68 -28
- package/dist/Button-C_GP2mJ-.cjs +0 -2
- package/dist/Button-C_GP2mJ-.cjs.map +0 -1
- package/dist/Button-CzqDPqUT.js +0 -8600
- package/dist/Button-CzqDPqUT.js.map +0 -1
- package/dist/IconButton-B-MspnYP.cjs +0 -2
- package/dist/IconButton-B-MspnYP.cjs.map +0 -1
- package/dist/IconButton-DTGSfJme.js +0 -560
- package/dist/IconButton-DTGSfJme.js.map +0 -1
- package/dist/Switch-B2irM7Pp.js +0 -2656
- package/dist/Switch-B2irM7Pp.js.map +0 -1
- package/dist/Switch-CMKBdqkX.cjs +0 -42
- package/dist/Switch-CMKBdqkX.cjs.map +0 -1
- package/dist/comment.cjs.map +0 -1
- package/dist/comment.js.map +0 -1
- package/dist/components/Chips/index.d.ts +0 -19
- package/dist/components/DatePicker/Calendar.d.ts +0 -27
- package/dist/components/DatePicker/DatePicker.d.ts +0 -119
- package/dist/components/DatePicker/date.d.ts +0 -24
- package/dist/components/DatePicker/index.d.ts +0 -4
- package/dist/components/ShapeEditor/_model/imageFetch.d.ts +0 -9
- package/dist/components/ShapeEditor/_model/konva.d.ts +0 -4
- package/dist/components/ShapeEditor/_model/overlays.test.d.ts +0 -1
- package/dist/components/ShapeEditor/_renderers/KonvaRenderer.d.ts +0 -124
- package/dist/components/Table/Table.d.ts +0 -61
- package/dist/components/Table/index.d.ts +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawSessionState.cjs","names":[],"sources":["../../../../src/components/ShapeEditor/_state/drawSessionState.ts"],"sourcesContent":["import type { Point } from \"../_model/geometry\";\nimport type { ScalarStroke } from \"../_model/scalarMask\";\n\nexport function cloneScalarStrokes(strokes: ScalarStroke[]): ScalarStroke[] {\n return strokes.map((stroke) => ({\n mode: stroke.mode,\n points: stroke.points.map((point) => ({ ...point })),\n }));\n}\n\nexport function scalarStrokesEqual(a: ScalarStroke[], b: ScalarStroke[]) {\n return (\n a.length === b.length &&\n a.every(\n (stroke, i) =>\n stroke.mode === b[i].mode &&\n stroke.points.length === b[i].points.length &&\n stroke.points.every((p, j) => p.x === b[i].points[j].x && p.y === b[i].points[j].y),\n )\n );\n}\n\nexport function clonePoints(points: Point[]): Point[] {\n return points.map((p) => ({ ...p }));\n}\n\nexport function pointsEqual(a: Point[], b: Point[]) {\n return a.length === b.length && a.every((p, i) => p.x === b[i].x && p.y === b[i].y);\n}\n"],"mappings":"aAGA,SAAgB,EAAmB,EAAyC,CAC1E,OAAO,EAAQ,IAAK,IAAY,CAC9B,KAAM,EAAO,KACb,OAAQ,EAAO,OAAO,IAAK,IAAW,CAAE,GAAG,EAAO,EAAE,CACrD,EAAE,CAGL,SAAgB,EAAmB,EAAmB,EAAmB,CACvE,OACE,EAAE,SAAW,EAAE,QACf,EAAE,OACC,EAAQ,IACP,EAAO,OAAS,EAAE,GAAG,MACrB,EAAO,OAAO,SAAW,EAAE,GAAG,OAAO,QACrC,EAAO,OAAO,OAAO,EAAG,IAAM,EAAE,IAAM,EAAE,GAAG,OAAO,GAAG,GAAK,EAAE,IAAM,EAAE,GAAG,OAAO,GAAG,EAAE,CACtF,CAIL,SAAgB,EAAY,EAA0B,CACpD,OAAO,EAAO,IAAK,IAAO,CAAE,GAAG,EAAG,EAAE,CAGtC,SAAgB,EAAY,EAAY,EAAY,CAClD,OAAO,EAAE,SAAW,EAAE,QAAU,EAAE,OAAO,EAAG,IAAM,EAAE,IAAM,EAAE,GAAG,GAAK,EAAE,IAAM,EAAE,GAAG,EAAE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Point } from "../_model/geometry.cjs";
|
|
2
|
+
import type { ScalarStroke } from "../_model/scalarMask.cjs";
|
|
3
|
+
export declare function cloneScalarStrokes(strokes: ScalarStroke[]): ScalarStroke[];
|
|
4
|
+
export declare function scalarStrokesEqual(a: ScalarStroke[], b: ScalarStroke[]): boolean;
|
|
5
|
+
export declare function clonePoints(points: Point[]): Point[];
|
|
6
|
+
export declare function pointsEqual(a: Point[], b: Point[]): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Point } from "../_model/geometry";
|
|
2
|
-
import type { ScalarStroke } from "../_model/scalarMask";
|
|
1
|
+
import type { Point } from "../_model/geometry.js";
|
|
2
|
+
import type { ScalarStroke } from "../_model/scalarMask.js";
|
|
3
3
|
export declare function cloneScalarStrokes(strokes: ScalarStroke[]): ScalarStroke[];
|
|
4
4
|
export declare function scalarStrokesEqual(a: ScalarStroke[], b: ScalarStroke[]): boolean;
|
|
5
5
|
export declare function clonePoints(points: Point[]): Point[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/ShapeEditor/_state/drawSessionState.ts
|
|
3
|
+
function e(e) {
|
|
4
|
+
return e.map((e) => ({
|
|
5
|
+
mode: e.mode,
|
|
6
|
+
points: e.points.map((e) => ({ ...e }))
|
|
7
|
+
}));
|
|
8
|
+
}
|
|
9
|
+
function t(e, t) {
|
|
10
|
+
return e.length === t.length && e.every((e, n) => e.mode === t[n].mode && e.points.length === t[n].points.length && e.points.every((e, r) => e.x === t[n].points[r].x && e.y === t[n].points[r].y));
|
|
11
|
+
}
|
|
12
|
+
function n(e) {
|
|
13
|
+
return e.map((e) => ({ ...e }));
|
|
14
|
+
}
|
|
15
|
+
function r(e, t) {
|
|
16
|
+
return e.length === t.length && e.every((e, n) => e.x === t[n].x && e.y === t[n].y);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as clonePoints, e as cloneScalarStrokes, r as pointsEqual, t as scalarStrokesEqual };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=drawSessionState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawSessionState.js","names":[],"sources":["../../../../src/components/ShapeEditor/_state/drawSessionState.ts"],"sourcesContent":["import type { Point } from \"../_model/geometry\";\nimport type { ScalarStroke } from \"../_model/scalarMask\";\n\nexport function cloneScalarStrokes(strokes: ScalarStroke[]): ScalarStroke[] {\n return strokes.map((stroke) => ({\n mode: stroke.mode,\n points: stroke.points.map((point) => ({ ...point })),\n }));\n}\n\nexport function scalarStrokesEqual(a: ScalarStroke[], b: ScalarStroke[]) {\n return (\n a.length === b.length &&\n a.every(\n (stroke, i) =>\n stroke.mode === b[i].mode &&\n stroke.points.length === b[i].points.length &&\n stroke.points.every((p, j) => p.x === b[i].points[j].x && p.y === b[i].points[j].y),\n )\n );\n}\n\nexport function clonePoints(points: Point[]): Point[] {\n return points.map((p) => ({ ...p }));\n}\n\nexport function pointsEqual(a: Point[], b: Point[]) {\n return a.length === b.length && a.every((p, i) => p.x === b[i].x && p.y === b[i].y);\n}\n"],"mappings":";;AAGA,SAAgB,EAAmB,GAAyC;AAC1E,QAAO,EAAQ,KAAK,OAAY;EAC9B,MAAM,EAAO;EACb,QAAQ,EAAO,OAAO,KAAK,OAAW,EAAE,GAAG,GAAO,EAAE;EACrD,EAAE;;AAGL,SAAgB,EAAmB,GAAmB,GAAmB;AACvE,QACE,EAAE,WAAW,EAAE,UACf,EAAE,OACC,GAAQ,MACP,EAAO,SAAS,EAAE,GAAG,QACrB,EAAO,OAAO,WAAW,EAAE,GAAG,OAAO,UACrC,EAAO,OAAO,OAAO,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,GAAG,EAAE,CACtF;;AAIL,SAAgB,EAAY,GAA0B;AACpD,QAAO,EAAO,KAAK,OAAO,EAAE,GAAG,GAAG,EAAE;;AAGtC,SAAgB,EAAY,GAAY,GAAY;AAClD,QAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../_model/geometry.cjs`);let t=require(`react`);function n({docRef:n,draftRef:r,draftMeta:i,changeSelection:a,assistantRef:o}){let[s,c]=(0,t.useState)(`idle`),[l,u]=(0,t.useState)([]),[d,f]=(0,t.useState)([]),p=(0,t.useRef)([]),m=(0,t.useRef)([]),h=(0,t.useRef)([]),g=(0,t.useRef)(`idle`),_=(0,t.useRef)(0),v=(0,t.useRef)(null),y=(0,t.useRef)(null),b=(0,t.useRef)(0),x=(0,t.useCallback)(e=>{p.current=e(p.current),f(p.current)},[]),S=(0,t.useCallback)(e=>{g.current=e,c(e)},[]),C=(0,t.useCallback)((t,n,r)=>{let a=o.current?.rectResult===`rotatedRect`;return t.map(t=>{if(n===`rect`&&a)return{id:e.generateId(),type:e.SHAPE_TYPE.ROTATED_RECTANGLE,points:e.minAreaRect(t),style:r,meta:i};if(n===`rect`){let n=e.getBBox(t);return{id:e.generateId(),type:e.SHAPE_TYPE.RECTANGLE,points:[{x:n.minX,y:n.minY},{x:n.maxX,y:n.maxY}],style:r,meta:i}}return{id:e.generateId(),type:e.SHAPE_TYPE.POLYGON,points:t,style:r,meta:i}})},[i,o]),w=(0,t.useCallback)(()=>{_.current++,m.current=[],h.current=[],v.current=null,y.current=null,u([]),S(`idle`)},[S]),T=(0,t.useCallback)(()=>{b.current++,x(()=>[]),w()},[w,x]);(0,t.useEffect)(()=>()=>{b.current++,_.current++},[]);let E=(0,t.useCallback)(()=>{b.current++,x(()=>[]);let e=y.current;e?n.current.update([e]):h.current.length&&n.current.remove(h.current),w()},[n,w,x]),D=(0,t.useCallback)(e=>{let t=h.current;if(!e.length){t.length&&(n.current.remove(t),h.current=[]);return}if(t.length===e.length){let r=n.current.getShapes(),i=e.map((e,n)=>{let i=r.find(e=>e.id===t[n]);return i?{...i,points:e}:null}).filter(e=>!!e);i.length&&n.current.update(i);return}v.current=null,y.current=null,t.length&&n.current.remove(t);let i=r.current;if(!i)return;let o=C(e,`polygon`,i);o?.length&&(n.current.create(o),h.current=o.map(e=>e.id),a(h.current))},[n,r,a,C]),O=(0,t.useCallback)(async()=>{let e=o.current?.infer;if(!e)return;let t={kind:`points`,points:m.current,base:v.current??void 0},n=++_.current;S(`loading`);let r=[];try{r=(await e(t)??[]).filter(e=>e.length>=3)}catch{r=[]}n===_.current&&(D(r),S(`ready`))},[o,D,S]),k=(0,t.useCallback)((e,t)=>{m.current=[...m.current,{x:e.x,y:e.y,positive:t}],u([{x:e.x,y:e.y,positive:t}]),O()},[O]),A=(0,t.useCallback)(e=>{w();let t=[{x:e.x,y:e.y,positive:!0}];m.current=t,u(t),O()},[w,O]),j=(0,t.useCallback)((e,t,n)=>{(h.current.length!==1||h.current[0]!==e.id)&&(w(),h.current=[e.id],v.current=e.points,y.current=e),m.current=[...m.current,{x:t.x,y:t.y,positive:n}],u([{x:t.x,y:t.y,positive:n}]),O()},[w,O]);return{status:s,points:l,boxes:d,beginBox:(0,t.useCallback)((e,t=`polygon`)=>{let i=o.current?.infer,s=r.current;if(!i||!s)return;let c=b.current;x(t=>[...t,e]),(async()=>{let r=[];try{r=(await i({kind:`box`,box:e})??[]).filter(e=>e.length>=3)}catch{r=[]}if(x(t=>t.filter(t=>t!==e)),c!==b.current)return;let o=C(r,t,s);o?.length&&(n.current.create(o),a(o.map(e=>e.id)))})()},[o,r,C,a,n,x]),addPoint:k,newPolygon:A,refineShape:j,finalize:w,discard:T,cancel:E,isActive:(0,t.useCallback)(()=>g.current===`loading`||m.current.length>0||p.current.length>0||h.current.length>0,[])}}exports.useAssistant=n;
|
|
2
|
+
//# sourceMappingURL=useAssistant.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAssistant.cjs","names":[],"sources":["../../../../src/components/ShapeEditor/_state/useAssistant.ts"],"sourcesContent":["import { type RefObject, useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n type EditorShape,\n generateId,\n getBBox,\n minAreaRect,\n type Point,\n SHAPE_TYPE,\n type ShapeStyle,\n} from \"../_model/geometry\";\nimport type { AssistantPrompt, EditorAssistant } from \"../_model/props\";\nimport type { EditorDocument } from \"./useEditorDocument\";\n\nexport type AssistantStatus = \"idle\" | \"loading\" | \"ready\";\n\ninterface UseAssistantParams<TMeta> {\n docRef: RefObject<EditorDocument<TMeta>>;\n draftRef: RefObject<ShapeStyle | undefined>;\n draftMeta: TMeta | undefined;\n changeSelection: (ids: string[]) => void;\n assistantRef: RefObject<EditorAssistant | undefined>;\n}\n\ntype Box = { x: number; y: number; width: number; height: number };\n\n/**\n * AI 어시스트 세션(SAM 식). 프롬프트 수집(박스/포인트)·호스트 infer 호출·**즉시 커밋**.\n * 옵스 에디터와 동일하게 추론 결과를 프리뷰 없이 바로 도형으로 만든다.\n *\n * 두 갈래의 수명 주기(옵스 파리티):\n * - **박스 프롬프트(ASSISTANT_POLYGON/RECT)**: 드래그마다 **병렬 독립 요청** —\n * 앞 요청이 진행 중이어도 새 드래그가 그것을 취소하지 않고 각자 완료 시 커밋된다.\n * 커밋된 결과는 확정(Esc로 지워지지 않음 — 일반 undo/삭제로 다룬다).\n * - **포인트 프롬프트(마법봉)**: 단일 세션. 클릭=이전 세션 확정+새 세션, Alt+클릭=\n * 같은 도형 제자리 refine. Esc=세션 취소(이번 세션 생성분 제거 + 진행 중 응답 폐기).\n */\nexport function useAssistant<TMeta>({\n docRef,\n draftRef,\n draftMeta,\n changeSelection,\n assistantRef,\n}: UseAssistantParams<TMeta>) {\n const [status, setStatus] = useState<AssistantStatus>(\"idle\");\n const [points, setPoints] = useState<{ x: number; y: number; positive: boolean }[]>([]);\n // 진행 중인 박스 프롬프트들(병렬). shimmer 표시 + isActive 판단용.\n const [pendingBoxes, setPendingBoxes] = useState<Box[]>([]);\n const pendingBoxesRef = useRef<Box[]>([]);\n\n const pointsRef = useRef<{ x: number; y: number; positive: boolean }[]>([]);\n const committedRef = useRef<string[]>([]); // 포인트 세션이 만든 도형 id.\n const statusRef = useRef<AssistantStatus>(\"idle\");\n const tokenRef = useRef(0); // 포인트 세션 최신 요청 토큰(stale 폐기).\n // 기존 도형 refine 세션: base(원본 좌표)를 프롬프트에 실어 보내고, Esc 시 원복한다.\n const baseRef = useRef<Point[] | null>(null);\n const originalShapeRef = useRef<EditorShape<TMeta> | null>(null);\n const boxEpochRef = useRef(0); // 박스 요청 세대 — cancel 시 증가, 이후 응답 폐기.\n\n const mutatePending = useCallback((updater: (list: Box[]) => Box[]) => {\n pendingBoxesRef.current = updater(pendingBoxesRef.current);\n setPendingBoxes(pendingBoxesRef.current);\n }, []);\n\n const setStatusBoth = useCallback((s: AssistantStatus) => {\n statusRef.current = s;\n setStatus(s);\n }, []);\n\n /**\n * 결과 폴리곤(들) → 커밋 도형. rect면 바운딩(축정렬 / rotatedRect면 최소회전) 사각형.\n * style은 호출부가 스냅샷해 넘긴다 — 박스 요청은 드래그 시점 클래스 스타일을\n * 캡처해서, 추론 중 클래스를 바꿔도 결과가 어긋나지 않게 한다(레거시 파리티).\n */\n const buildShapes = useCallback(\n (\n polys: Point[][],\n resultShape: \"polygon\" | \"rect\",\n style: ShapeStyle,\n ): EditorShape<TMeta>[] | null => {\n const rotated = assistantRef.current?.rectResult === \"rotatedRect\";\n return polys.map((pts) => {\n if (resultShape === \"rect\" && rotated)\n return {\n id: generateId(),\n type: SHAPE_TYPE.ROTATED_RECTANGLE,\n points: minAreaRect(pts),\n style,\n meta: draftMeta,\n };\n if (resultShape === \"rect\") {\n const b = getBBox(pts);\n return {\n id: generateId(),\n type: SHAPE_TYPE.RECTANGLE,\n points: [\n { x: b.minX, y: b.minY },\n { x: b.maxX, y: b.maxY },\n ],\n style,\n meta: draftMeta,\n };\n }\n return {\n id: generateId(),\n type: SHAPE_TYPE.POLYGON,\n points: pts,\n style,\n meta: draftMeta,\n };\n });\n },\n [draftMeta, assistantRef],\n );\n\n // 확정: 포인트 세션이 만든 도형은 문서에 남기고 세션만 정리. 박스 요청엔 영향 없음.\n const finalize = useCallback(() => {\n tokenRef.current++;\n pointsRef.current = [];\n committedRef.current = [];\n baseRef.current = null;\n originalShapeRef.current = null;\n setPoints([]);\n setStatusBoth(\"idle\");\n }, [setStatusBoth]);\n\n /**\n * 문서 전환: 세션을 확정하고 진행 중인 박스 요청 응답도 버린다 — 이전 문서 좌표의\n * 결과가 새 문서에 생성되지 않게. 이미 커밋된 도형은 이전 문서와 함께 사라진다.\n */\n const discard = useCallback(() => {\n boxEpochRef.current++;\n mutatePending(() => []);\n finalize();\n }, [finalize, mutatePending]);\n\n // 언마운트 후 도착한 응답이 버려진 문서에 도형을 만들고 호스트 콜백을 부르지 않게 한다.\n useEffect(\n () => () => {\n boxEpochRef.current++;\n tokenRef.current++;\n },\n [],\n );\n\n /**\n * 취소(Esc): 포인트 세션 생성분 제거 + 진행 중인 박스/포인트 응답 폐기.\n * 이미 커밋된 박스 결과는 유지한다(옵스와 동일 — 일반 삭제/undo로 다룬다).\n */\n const cancel = useCallback(() => {\n boxEpochRef.current++;\n mutatePending(() => []);\n const original = originalShapeRef.current;\n if (original) {\n // 기존 도형 refine 세션 — 생성분 삭제가 아니라 원본 좌표 복원.\n docRef.current.update([original]);\n } else if (committedRef.current.length) {\n docRef.current.remove(committedRef.current);\n }\n finalize();\n }, [docRef, finalize, mutatePending]);\n\n // ── 포인트 세션(마법봉) — 단일 세션, 제자리 refine ──\n\n const applyResult = useCallback(\n (polys: Point[][]) => {\n const ids = committedRef.current;\n if (!polys.length) {\n if (ids.length) {\n docRef.current.remove(ids);\n committedRef.current = [];\n }\n return;\n }\n if (ids.length === polys.length) {\n // 같은 개수 → 제자리 갱신(refine).\n const shapes = docRef.current.getShapes();\n const updates = polys\n .map((pts, i) => {\n const prev = shapes.find((s) => s.id === ids[i]);\n return prev ? { ...prev, points: pts } : null;\n })\n .filter((s): s is EditorShape<TMeta> => !!s);\n if (updates.length) docRef.current.update(updates);\n return;\n }\n // 개수가 달라짐 → 이전 것 제거 후 새로 생성(포인트 세션 결과는 항상 폴리곤).\n // refine 대상이 대체되므로 원복 스냅샷은 무효화한다.\n baseRef.current = null;\n originalShapeRef.current = null;\n if (ids.length) docRef.current.remove(ids);\n const style = draftRef.current;\n if (!style) return;\n const created = buildShapes(polys, \"polygon\", style);\n if (!created?.length) return;\n docRef.current.create(created);\n committedRef.current = created.map((s) => s.id);\n changeSelection(committedRef.current);\n },\n [docRef, draftRef, changeSelection, buildShapes],\n );\n\n const runInfer = useCallback(async () => {\n const infer = assistantRef.current?.infer;\n if (!infer) return;\n const prompt: AssistantPrompt = {\n kind: \"points\",\n points: pointsRef.current,\n base: baseRef.current ?? undefined,\n };\n const token = ++tokenRef.current;\n setStatusBoth(\"loading\");\n let polys: Point[][] = [];\n try {\n const result = await infer(prompt);\n polys = (result ?? []).filter((p) => p.length >= 3);\n } catch {\n polys = [];\n }\n if (token !== tokenRef.current) return; // stale — 더 최신 요청/취소.\n applyResult(polys);\n setStatusBoth(\"ready\");\n }, [assistantRef, applyResult, setStatusBoth]);\n\n const addPoint = useCallback(\n (p: Point, positive: boolean) => {\n // 누적 포인트(pointsRef)는 추론 프롬프트용으로 전부 유지하되, 화면 마커(setPoints)는\n // 이번에 찍은 점만 표시한다(옵스식 — 진행 중인 그 점만 보이고 끝나면 사라짐).\n pointsRef.current = [...pointsRef.current, { x: p.x, y: p.y, positive }];\n setPoints([{ x: p.x, y: p.y, positive }]);\n runInfer();\n },\n [runInfer],\n );\n\n // 옵스식 마법봉: 그냥 클릭 → 이전 세션 확정 후 그 점 기반 새 폴리곤 생성.\n const newPolygon = useCallback(\n (p: Point) => {\n finalize();\n const next = [{ x: p.x, y: p.y, positive: true }];\n pointsRef.current = next;\n setPoints(next);\n runInfer();\n },\n [finalize, runInfer],\n );\n\n /**\n * 기존 도형을 지정 지점으로 refine(우클릭 메뉴 \"이 지점 포함/제외\").\n * 같은 도형이면 세션을 이어 포인트를 누적하고, 다른 도형이면 새 refine 세션을\n * 시작한다(원본 좌표를 base로 프롬프트에 실어 제자리 갱신, Esc=원복).\n */\n const refineShape = useCallback(\n (shape: EditorShape<TMeta>, p: Point, positive: boolean) => {\n if (committedRef.current.length !== 1 || committedRef.current[0] !== shape.id) {\n finalize();\n committedRef.current = [shape.id];\n baseRef.current = shape.points;\n originalShapeRef.current = shape;\n }\n pointsRef.current = [...pointsRef.current, { x: p.x, y: p.y, positive }];\n setPoints([{ x: p.x, y: p.y, positive }]);\n runInfer();\n },\n [finalize, runInfer],\n );\n\n // ── 박스 프롬프트 — 병렬 독립 요청(옵스식: 연속 드래그가 서로를 취소하지 않음) ──\n\n const beginBox = useCallback(\n (b: Box, resultShape: \"polygon\" | \"rect\" = \"polygon\") => {\n const infer = assistantRef.current?.infer;\n const style = draftRef.current; // 드래그 시점 클래스 스타일 스냅샷.\n if (!infer || !style) return;\n const epoch = boxEpochRef.current;\n mutatePending((list) => [...list, b]);\n void (async () => {\n let polys: Point[][] = [];\n try {\n const result = await infer({ kind: \"box\", box: b });\n polys = (result ?? []).filter((p) => p.length >= 3);\n } catch {\n polys = [];\n }\n mutatePending((list) => list.filter((x) => x !== b));\n if (epoch !== boxEpochRef.current) return; // 취소됨 — 결과 폐기.\n const created = buildShapes(polys, resultShape, style);\n if (!created?.length) return;\n docRef.current.create(created);\n changeSelection(created.map((s) => s.id));\n })();\n },\n [assistantRef, draftRef, buildShapes, changeSelection, docRef, mutatePending],\n );\n\n const isActive = useCallback(\n () =>\n statusRef.current === \"loading\" ||\n pointsRef.current.length > 0 ||\n pendingBoxesRef.current.length > 0 ||\n committedRef.current.length > 0,\n [],\n );\n\n return {\n status,\n points,\n /** 진행 중인 박스 프롬프트들(병렬). 오버레이 shimmer 표시용. */\n boxes: pendingBoxes,\n beginBox,\n addPoint,\n newPolygon,\n refineShape,\n finalize,\n discard,\n cancel,\n isActive,\n };\n}\n\nexport type AssistantSession<TMeta> = ReturnType<typeof useAssistant<TMeta>>;\n"],"mappings":"iIAoCA,SAAgB,EAAoB,CAClC,SACA,WACA,YACA,kBACA,gBAC4B,CAC5B,GAAM,CAAC,EAAQ,IAAA,EAAA,EAAA,UAAuC,OAAO,CACvD,CAAC,EAAQ,IAAA,EAAA,EAAA,UAAqE,EAAE,CAAC,CAEjF,CAAC,EAAc,IAAA,EAAA,EAAA,UAAmC,EAAE,CAAC,CACrD,GAAA,EAAA,EAAA,QAAgC,EAAE,CAAC,CAEnC,GAAA,EAAA,EAAA,QAAkE,EAAE,CAAC,CACrE,GAAA,EAAA,EAAA,QAAgC,EAAE,CAAC,CACnC,GAAA,EAAA,EAAA,QAAoC,OAAO,CAC3C,GAAA,EAAA,EAAA,QAAkB,EAAE,CAEpB,GAAA,EAAA,EAAA,QAAiC,KAAK,CACtC,GAAA,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CAAC,EAAU,EAAS,CACrB,CAuCD,MAAO,CACL,SACA,SAEA,MAAO,EACP,UAAA,EAAA,EAAA,cAvCC,EAAQ,EAAkC,YAAc,CACvD,IAAM,EAAQ,EAAa,SAAS,MAC9B,EAAQ,EAAS,QACvB,GAAI,CAAC,GAAS,CAAC,EAAO,OACtB,IAAM,EAAQ,EAAY,QAC1B,EAAe,GAAS,CAAC,GAAG,EAAM,EAAE,CAAC,EAC/B,SAAY,CAChB,IAAI,EAAmB,EAAE,CACzB,GAAI,CAEF,GADe,MAAM,EAAM,CAAE,KAAM,MAAO,IAAK,EAAG,CAAC,EAChC,EAAE,EAAE,OAAQ,GAAM,EAAE,QAAU,EAAE,MAC7C,CACN,EAAQ,EAAE,CAGZ,GADA,EAAe,GAAS,EAAK,OAAQ,GAAM,IAAM,EAAE,CAAC,CAChD,IAAU,EAAY,QAAS,OACnC,IAAM,EAAU,EAAY,EAAO,EAAa,EAAM,CACjD,GAAS,SACd,EAAO,QAAQ,OAAO,EAAQ,CAC9B,EAAgB,EAAQ,IAAK,GAAM,EAAE,GAAG,CAAC,KACvC,EAEN,CAAC,EAAc,EAAU,EAAa,EAAiB,EAAQ,EAAc,CAC9E,CAiBC,WACA,aACA,cACA,WACA,UACA,SACA,UAAA,EAAA,EAAA,iBAnBE,EAAU,UAAY,WACtB,EAAU,QAAQ,OAAS,GAC3B,EAAgB,QAAQ,OAAS,GACjC,EAAa,QAAQ,OAAS,EAChC,EAAE,CACH,CAeA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import { type EditorShape, type Point, type ShapeStyle } from "../_model/geometry.cjs";
|
|
3
|
+
import type { EditorAssistant } from "../_model/props.cjs";
|
|
4
|
+
import type { EditorDocument } from "./useEditorDocument.cjs";
|
|
5
|
+
export type AssistantStatus = "idle" | "loading" | "ready";
|
|
6
|
+
interface UseAssistantParams<TMeta> {
|
|
7
|
+
docRef: RefObject<EditorDocument<TMeta>>;
|
|
8
|
+
draftRef: RefObject<ShapeStyle | undefined>;
|
|
9
|
+
draftMeta: TMeta | undefined;
|
|
10
|
+
changeSelection: (ids: string[]) => void;
|
|
11
|
+
assistantRef: RefObject<EditorAssistant | undefined>;
|
|
12
|
+
}
|
|
13
|
+
type Box = {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* AI 어시스트 세션(SAM 식). 프롬프트 수집(박스/포인트)·호스트 infer 호출·**즉시 커밋**.
|
|
21
|
+
* 옵스 에디터와 동일하게 추론 결과를 프리뷰 없이 바로 도형으로 만든다.
|
|
22
|
+
*
|
|
23
|
+
* 두 갈래의 수명 주기(옵스 파리티):
|
|
24
|
+
* - **박스 프롬프트(ASSISTANT_POLYGON/RECT)**: 드래그마다 **병렬 독립 요청** —
|
|
25
|
+
* 앞 요청이 진행 중이어도 새 드래그가 그것을 취소하지 않고 각자 완료 시 커밋된다.
|
|
26
|
+
* 커밋된 결과는 확정(Esc로 지워지지 않음 — 일반 undo/삭제로 다룬다).
|
|
27
|
+
* - **포인트 프롬프트(마법봉)**: 단일 세션. 클릭=이전 세션 확정+새 세션, Alt+클릭=
|
|
28
|
+
* 같은 도형 제자리 refine. Esc=세션 취소(이번 세션 생성분 제거 + 진행 중 응답 폐기).
|
|
29
|
+
*/
|
|
30
|
+
export declare function useAssistant<TMeta>({ docRef, draftRef, draftMeta, changeSelection, assistantRef, }: UseAssistantParams<TMeta>): {
|
|
31
|
+
status: AssistantStatus;
|
|
32
|
+
points: {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
positive: boolean;
|
|
36
|
+
}[];
|
|
37
|
+
/** 진행 중인 박스 프롬프트들(병렬). 오버레이 shimmer 표시용. */
|
|
38
|
+
boxes: Box[];
|
|
39
|
+
beginBox: (b: Box, resultShape?: "polygon" | "rect") => void;
|
|
40
|
+
addPoint: (p: Point, positive: boolean) => void;
|
|
41
|
+
newPolygon: (p: Point) => void;
|
|
42
|
+
refineShape: (shape: EditorShape<TMeta>, p: Point, positive: boolean) => void;
|
|
43
|
+
finalize: () => void;
|
|
44
|
+
discard: () => void;
|
|
45
|
+
cancel: () => void;
|
|
46
|
+
isActive: () => boolean;
|
|
47
|
+
};
|
|
48
|
+
export type AssistantSession<TMeta> = ReturnType<typeof useAssistant<TMeta>>;
|
|
49
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
-
import { type EditorShape, type Point, type ShapeStyle } from "../_model/geometry";
|
|
3
|
-
import type { EditorAssistant } from "../_model/props";
|
|
4
|
-
import type { EditorDocument } from "./useEditorDocument";
|
|
2
|
+
import { type EditorShape, type Point, type ShapeStyle } from "../_model/geometry.js";
|
|
3
|
+
import type { EditorAssistant } from "../_model/props.js";
|
|
4
|
+
import type { EditorDocument } from "./useEditorDocument.js";
|
|
5
5
|
export type AssistantStatus = "idle" | "loading" | "ready";
|
|
6
6
|
interface UseAssistantParams<TMeta> {
|
|
7
7
|
docRef: RefObject<EditorDocument<TMeta>>;
|
|
@@ -41,6 +41,7 @@ export declare function useAssistant<TMeta>({ docRef, draftRef, draftMeta, chang
|
|
|
41
41
|
newPolygon: (p: Point) => void;
|
|
42
42
|
refineShape: (shape: EditorShape<TMeta>, p: Point, positive: boolean) => void;
|
|
43
43
|
finalize: () => void;
|
|
44
|
+
discard: () => void;
|
|
44
45
|
cancel: () => void;
|
|
45
46
|
isActive: () => boolean;
|
|
46
47
|
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SHAPE_TYPE as e, generateId as t, getBBox as n, minAreaRect as r } from "../_model/geometry.js";
|
|
3
|
+
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
4
|
+
//#region src/components/ShapeEditor/_state/useAssistant.ts
|
|
5
|
+
function c({ docRef: c, draftRef: l, draftMeta: u, changeSelection: d, assistantRef: f }) {
|
|
6
|
+
let [p, m] = s("idle"), [h, g] = s([]), [_, v] = s([]), y = o([]), b = o([]), x = o([]), S = o("idle"), C = o(0), w = o(null), T = o(null), E = o(0), D = i((e) => {
|
|
7
|
+
y.current = e(y.current), v(y.current);
|
|
8
|
+
}, []), O = i((e) => {
|
|
9
|
+
S.current = e, m(e);
|
|
10
|
+
}, []), k = i((i, a, o) => {
|
|
11
|
+
let s = f.current?.rectResult === "rotatedRect";
|
|
12
|
+
return i.map((i) => {
|
|
13
|
+
if (a === "rect" && s) return {
|
|
14
|
+
id: t(),
|
|
15
|
+
type: e.ROTATED_RECTANGLE,
|
|
16
|
+
points: r(i),
|
|
17
|
+
style: o,
|
|
18
|
+
meta: u
|
|
19
|
+
};
|
|
20
|
+
if (a === "rect") {
|
|
21
|
+
let r = n(i);
|
|
22
|
+
return {
|
|
23
|
+
id: t(),
|
|
24
|
+
type: e.RECTANGLE,
|
|
25
|
+
points: [{
|
|
26
|
+
x: r.minX,
|
|
27
|
+
y: r.minY
|
|
28
|
+
}, {
|
|
29
|
+
x: r.maxX,
|
|
30
|
+
y: r.maxY
|
|
31
|
+
}],
|
|
32
|
+
style: o,
|
|
33
|
+
meta: u
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
id: t(),
|
|
38
|
+
type: e.POLYGON,
|
|
39
|
+
points: i,
|
|
40
|
+
style: o,
|
|
41
|
+
meta: u
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}, [u, f]), A = i(() => {
|
|
45
|
+
C.current++, b.current = [], x.current = [], w.current = null, T.current = null, g([]), O("idle");
|
|
46
|
+
}, [O]), j = i(() => {
|
|
47
|
+
E.current++, D(() => []), A();
|
|
48
|
+
}, [A, D]);
|
|
49
|
+
a(() => () => {
|
|
50
|
+
E.current++, C.current++;
|
|
51
|
+
}, []);
|
|
52
|
+
let M = i(() => {
|
|
53
|
+
E.current++, D(() => []);
|
|
54
|
+
let e = T.current;
|
|
55
|
+
e ? c.current.update([e]) : x.current.length && c.current.remove(x.current), A();
|
|
56
|
+
}, [
|
|
57
|
+
c,
|
|
58
|
+
A,
|
|
59
|
+
D
|
|
60
|
+
]), N = i((e) => {
|
|
61
|
+
let t = x.current;
|
|
62
|
+
if (!e.length) {
|
|
63
|
+
t.length && (c.current.remove(t), x.current = []);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (t.length === e.length) {
|
|
67
|
+
let n = c.current.getShapes(), r = e.map((e, r) => {
|
|
68
|
+
let i = n.find((e) => e.id === t[r]);
|
|
69
|
+
return i ? {
|
|
70
|
+
...i,
|
|
71
|
+
points: e
|
|
72
|
+
} : null;
|
|
73
|
+
}).filter((e) => !!e);
|
|
74
|
+
r.length && c.current.update(r);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
w.current = null, T.current = null, t.length && c.current.remove(t);
|
|
78
|
+
let n = l.current;
|
|
79
|
+
if (!n) return;
|
|
80
|
+
let r = k(e, "polygon", n);
|
|
81
|
+
r?.length && (c.current.create(r), x.current = r.map((e) => e.id), d(x.current));
|
|
82
|
+
}, [
|
|
83
|
+
c,
|
|
84
|
+
l,
|
|
85
|
+
d,
|
|
86
|
+
k
|
|
87
|
+
]), P = i(async () => {
|
|
88
|
+
let e = f.current?.infer;
|
|
89
|
+
if (!e) return;
|
|
90
|
+
let t = {
|
|
91
|
+
kind: "points",
|
|
92
|
+
points: b.current,
|
|
93
|
+
base: w.current ?? void 0
|
|
94
|
+
}, n = ++C.current;
|
|
95
|
+
O("loading");
|
|
96
|
+
let r = [];
|
|
97
|
+
try {
|
|
98
|
+
r = (await e(t) ?? []).filter((e) => e.length >= 3);
|
|
99
|
+
} catch {
|
|
100
|
+
r = [];
|
|
101
|
+
}
|
|
102
|
+
n === C.current && (N(r), O("ready"));
|
|
103
|
+
}, [
|
|
104
|
+
f,
|
|
105
|
+
N,
|
|
106
|
+
O
|
|
107
|
+
]), F = i((e, t) => {
|
|
108
|
+
b.current = [...b.current, {
|
|
109
|
+
x: e.x,
|
|
110
|
+
y: e.y,
|
|
111
|
+
positive: t
|
|
112
|
+
}], g([{
|
|
113
|
+
x: e.x,
|
|
114
|
+
y: e.y,
|
|
115
|
+
positive: t
|
|
116
|
+
}]), P();
|
|
117
|
+
}, [P]), I = i((e) => {
|
|
118
|
+
A();
|
|
119
|
+
let t = [{
|
|
120
|
+
x: e.x,
|
|
121
|
+
y: e.y,
|
|
122
|
+
positive: !0
|
|
123
|
+
}];
|
|
124
|
+
b.current = t, g(t), P();
|
|
125
|
+
}, [A, P]), L = i((e, t, n) => {
|
|
126
|
+
(x.current.length !== 1 || x.current[0] !== e.id) && (A(), x.current = [e.id], w.current = e.points, T.current = e), b.current = [...b.current, {
|
|
127
|
+
x: t.x,
|
|
128
|
+
y: t.y,
|
|
129
|
+
positive: n
|
|
130
|
+
}], g([{
|
|
131
|
+
x: t.x,
|
|
132
|
+
y: t.y,
|
|
133
|
+
positive: n
|
|
134
|
+
}]), P();
|
|
135
|
+
}, [A, P]);
|
|
136
|
+
return {
|
|
137
|
+
status: p,
|
|
138
|
+
points: h,
|
|
139
|
+
boxes: _,
|
|
140
|
+
beginBox: i((e, t = "polygon") => {
|
|
141
|
+
let n = f.current?.infer, r = l.current;
|
|
142
|
+
if (!n || !r) return;
|
|
143
|
+
let i = E.current;
|
|
144
|
+
D((t) => [...t, e]), (async () => {
|
|
145
|
+
let a = [];
|
|
146
|
+
try {
|
|
147
|
+
a = (await n({
|
|
148
|
+
kind: "box",
|
|
149
|
+
box: e
|
|
150
|
+
}) ?? []).filter((e) => e.length >= 3);
|
|
151
|
+
} catch {
|
|
152
|
+
a = [];
|
|
153
|
+
}
|
|
154
|
+
if (D((t) => t.filter((t) => t !== e)), i !== E.current) return;
|
|
155
|
+
let o = k(a, t, r);
|
|
156
|
+
o?.length && (c.current.create(o), d(o.map((e) => e.id)));
|
|
157
|
+
})();
|
|
158
|
+
}, [
|
|
159
|
+
f,
|
|
160
|
+
l,
|
|
161
|
+
k,
|
|
162
|
+
d,
|
|
163
|
+
c,
|
|
164
|
+
D
|
|
165
|
+
]),
|
|
166
|
+
addPoint: F,
|
|
167
|
+
newPolygon: I,
|
|
168
|
+
refineShape: L,
|
|
169
|
+
finalize: A,
|
|
170
|
+
discard: j,
|
|
171
|
+
cancel: M,
|
|
172
|
+
isActive: i(() => S.current === "loading" || b.current.length > 0 || y.current.length > 0 || x.current.length > 0, [])
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
export { c as useAssistant };
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=useAssistant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAssistant.js","names":[],"sources":["../../../../src/components/ShapeEditor/_state/useAssistant.ts"],"sourcesContent":["import { type RefObject, useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n type EditorShape,\n generateId,\n getBBox,\n minAreaRect,\n type Point,\n SHAPE_TYPE,\n type ShapeStyle,\n} from \"../_model/geometry\";\nimport type { AssistantPrompt, EditorAssistant } from \"../_model/props\";\nimport type { EditorDocument } from \"./useEditorDocument\";\n\nexport type AssistantStatus = \"idle\" | \"loading\" | \"ready\";\n\ninterface UseAssistantParams<TMeta> {\n docRef: RefObject<EditorDocument<TMeta>>;\n draftRef: RefObject<ShapeStyle | undefined>;\n draftMeta: TMeta | undefined;\n changeSelection: (ids: string[]) => void;\n assistantRef: RefObject<EditorAssistant | undefined>;\n}\n\ntype Box = { x: number; y: number; width: number; height: number };\n\n/**\n * AI 어시스트 세션(SAM 식). 프롬프트 수집(박스/포인트)·호스트 infer 호출·**즉시 커밋**.\n * 옵스 에디터와 동일하게 추론 결과를 프리뷰 없이 바로 도형으로 만든다.\n *\n * 두 갈래의 수명 주기(옵스 파리티):\n * - **박스 프롬프트(ASSISTANT_POLYGON/RECT)**: 드래그마다 **병렬 독립 요청** —\n * 앞 요청이 진행 중이어도 새 드래그가 그것을 취소하지 않고 각자 완료 시 커밋된다.\n * 커밋된 결과는 확정(Esc로 지워지지 않음 — 일반 undo/삭제로 다룬다).\n * - **포인트 프롬프트(마법봉)**: 단일 세션. 클릭=이전 세션 확정+새 세션, Alt+클릭=\n * 같은 도형 제자리 refine. Esc=세션 취소(이번 세션 생성분 제거 + 진행 중 응답 폐기).\n */\nexport function useAssistant<TMeta>({\n docRef,\n draftRef,\n draftMeta,\n changeSelection,\n assistantRef,\n}: UseAssistantParams<TMeta>) {\n const [status, setStatus] = useState<AssistantStatus>(\"idle\");\n const [points, setPoints] = useState<{ x: number; y: number; positive: boolean }[]>([]);\n // 진행 중인 박스 프롬프트들(병렬). shimmer 표시 + isActive 판단용.\n const [pendingBoxes, setPendingBoxes] = useState<Box[]>([]);\n const pendingBoxesRef = useRef<Box[]>([]);\n\n const pointsRef = useRef<{ x: number; y: number; positive: boolean }[]>([]);\n const committedRef = useRef<string[]>([]); // 포인트 세션이 만든 도형 id.\n const statusRef = useRef<AssistantStatus>(\"idle\");\n const tokenRef = useRef(0); // 포인트 세션 최신 요청 토큰(stale 폐기).\n // 기존 도형 refine 세션: base(원본 좌표)를 프롬프트에 실어 보내고, Esc 시 원복한다.\n const baseRef = useRef<Point[] | null>(null);\n const originalShapeRef = useRef<EditorShape<TMeta> | null>(null);\n const boxEpochRef = useRef(0); // 박스 요청 세대 — cancel 시 증가, 이후 응답 폐기.\n\n const mutatePending = useCallback((updater: (list: Box[]) => Box[]) => {\n pendingBoxesRef.current = updater(pendingBoxesRef.current);\n setPendingBoxes(pendingBoxesRef.current);\n }, []);\n\n const setStatusBoth = useCallback((s: AssistantStatus) => {\n statusRef.current = s;\n setStatus(s);\n }, []);\n\n /**\n * 결과 폴리곤(들) → 커밋 도형. rect면 바운딩(축정렬 / rotatedRect면 최소회전) 사각형.\n * style은 호출부가 스냅샷해 넘긴다 — 박스 요청은 드래그 시점 클래스 스타일을\n * 캡처해서, 추론 중 클래스를 바꿔도 결과가 어긋나지 않게 한다(레거시 파리티).\n */\n const buildShapes = useCallback(\n (\n polys: Point[][],\n resultShape: \"polygon\" | \"rect\",\n style: ShapeStyle,\n ): EditorShape<TMeta>[] | null => {\n const rotated = assistantRef.current?.rectResult === \"rotatedRect\";\n return polys.map((pts) => {\n if (resultShape === \"rect\" && rotated)\n return {\n id: generateId(),\n type: SHAPE_TYPE.ROTATED_RECTANGLE,\n points: minAreaRect(pts),\n style,\n meta: draftMeta,\n };\n if (resultShape === \"rect\") {\n const b = getBBox(pts);\n return {\n id: generateId(),\n type: SHAPE_TYPE.RECTANGLE,\n points: [\n { x: b.minX, y: b.minY },\n { x: b.maxX, y: b.maxY },\n ],\n style,\n meta: draftMeta,\n };\n }\n return {\n id: generateId(),\n type: SHAPE_TYPE.POLYGON,\n points: pts,\n style,\n meta: draftMeta,\n };\n });\n },\n [draftMeta, assistantRef],\n );\n\n // 확정: 포인트 세션이 만든 도형은 문서에 남기고 세션만 정리. 박스 요청엔 영향 없음.\n const finalize = useCallback(() => {\n tokenRef.current++;\n pointsRef.current = [];\n committedRef.current = [];\n baseRef.current = null;\n originalShapeRef.current = null;\n setPoints([]);\n setStatusBoth(\"idle\");\n }, [setStatusBoth]);\n\n /**\n * 문서 전환: 세션을 확정하고 진행 중인 박스 요청 응답도 버린다 — 이전 문서 좌표의\n * 결과가 새 문서에 생성되지 않게. 이미 커밋된 도형은 이전 문서와 함께 사라진다.\n */\n const discard = useCallback(() => {\n boxEpochRef.current++;\n mutatePending(() => []);\n finalize();\n }, [finalize, mutatePending]);\n\n // 언마운트 후 도착한 응답이 버려진 문서에 도형을 만들고 호스트 콜백을 부르지 않게 한다.\n useEffect(\n () => () => {\n boxEpochRef.current++;\n tokenRef.current++;\n },\n [],\n );\n\n /**\n * 취소(Esc): 포인트 세션 생성분 제거 + 진행 중인 박스/포인트 응답 폐기.\n * 이미 커밋된 박스 결과는 유지한다(옵스와 동일 — 일반 삭제/undo로 다룬다).\n */\n const cancel = useCallback(() => {\n boxEpochRef.current++;\n mutatePending(() => []);\n const original = originalShapeRef.current;\n if (original) {\n // 기존 도형 refine 세션 — 생성분 삭제가 아니라 원본 좌표 복원.\n docRef.current.update([original]);\n } else if (committedRef.current.length) {\n docRef.current.remove(committedRef.current);\n }\n finalize();\n }, [docRef, finalize, mutatePending]);\n\n // ── 포인트 세션(마법봉) — 단일 세션, 제자리 refine ──\n\n const applyResult = useCallback(\n (polys: Point[][]) => {\n const ids = committedRef.current;\n if (!polys.length) {\n if (ids.length) {\n docRef.current.remove(ids);\n committedRef.current = [];\n }\n return;\n }\n if (ids.length === polys.length) {\n // 같은 개수 → 제자리 갱신(refine).\n const shapes = docRef.current.getShapes();\n const updates = polys\n .map((pts, i) => {\n const prev = shapes.find((s) => s.id === ids[i]);\n return prev ? { ...prev, points: pts } : null;\n })\n .filter((s): s is EditorShape<TMeta> => !!s);\n if (updates.length) docRef.current.update(updates);\n return;\n }\n // 개수가 달라짐 → 이전 것 제거 후 새로 생성(포인트 세션 결과는 항상 폴리곤).\n // refine 대상이 대체되므로 원복 스냅샷은 무효화한다.\n baseRef.current = null;\n originalShapeRef.current = null;\n if (ids.length) docRef.current.remove(ids);\n const style = draftRef.current;\n if (!style) return;\n const created = buildShapes(polys, \"polygon\", style);\n if (!created?.length) return;\n docRef.current.create(created);\n committedRef.current = created.map((s) => s.id);\n changeSelection(committedRef.current);\n },\n [docRef, draftRef, changeSelection, buildShapes],\n );\n\n const runInfer = useCallback(async () => {\n const infer = assistantRef.current?.infer;\n if (!infer) return;\n const prompt: AssistantPrompt = {\n kind: \"points\",\n points: pointsRef.current,\n base: baseRef.current ?? undefined,\n };\n const token = ++tokenRef.current;\n setStatusBoth(\"loading\");\n let polys: Point[][] = [];\n try {\n const result = await infer(prompt);\n polys = (result ?? []).filter((p) => p.length >= 3);\n } catch {\n polys = [];\n }\n if (token !== tokenRef.current) return; // stale — 더 최신 요청/취소.\n applyResult(polys);\n setStatusBoth(\"ready\");\n }, [assistantRef, applyResult, setStatusBoth]);\n\n const addPoint = useCallback(\n (p: Point, positive: boolean) => {\n // 누적 포인트(pointsRef)는 추론 프롬프트용으로 전부 유지하되, 화면 마커(setPoints)는\n // 이번에 찍은 점만 표시한다(옵스식 — 진행 중인 그 점만 보이고 끝나면 사라짐).\n pointsRef.current = [...pointsRef.current, { x: p.x, y: p.y, positive }];\n setPoints([{ x: p.x, y: p.y, positive }]);\n runInfer();\n },\n [runInfer],\n );\n\n // 옵스식 마법봉: 그냥 클릭 → 이전 세션 확정 후 그 점 기반 새 폴리곤 생성.\n const newPolygon = useCallback(\n (p: Point) => {\n finalize();\n const next = [{ x: p.x, y: p.y, positive: true }];\n pointsRef.current = next;\n setPoints(next);\n runInfer();\n },\n [finalize, runInfer],\n );\n\n /**\n * 기존 도형을 지정 지점으로 refine(우클릭 메뉴 \"이 지점 포함/제외\").\n * 같은 도형이면 세션을 이어 포인트를 누적하고, 다른 도형이면 새 refine 세션을\n * 시작한다(원본 좌표를 base로 프롬프트에 실어 제자리 갱신, Esc=원복).\n */\n const refineShape = useCallback(\n (shape: EditorShape<TMeta>, p: Point, positive: boolean) => {\n if (committedRef.current.length !== 1 || committedRef.current[0] !== shape.id) {\n finalize();\n committedRef.current = [shape.id];\n baseRef.current = shape.points;\n originalShapeRef.current = shape;\n }\n pointsRef.current = [...pointsRef.current, { x: p.x, y: p.y, positive }];\n setPoints([{ x: p.x, y: p.y, positive }]);\n runInfer();\n },\n [finalize, runInfer],\n );\n\n // ── 박스 프롬프트 — 병렬 독립 요청(옵스식: 연속 드래그가 서로를 취소하지 않음) ──\n\n const beginBox = useCallback(\n (b: Box, resultShape: \"polygon\" | \"rect\" = \"polygon\") => {\n const infer = assistantRef.current?.infer;\n const style = draftRef.current; // 드래그 시점 클래스 스타일 스냅샷.\n if (!infer || !style) return;\n const epoch = boxEpochRef.current;\n mutatePending((list) => [...list, b]);\n void (async () => {\n let polys: Point[][] = [];\n try {\n const result = await infer({ kind: \"box\", box: b });\n polys = (result ?? []).filter((p) => p.length >= 3);\n } catch {\n polys = [];\n }\n mutatePending((list) => list.filter((x) => x !== b));\n if (epoch !== boxEpochRef.current) return; // 취소됨 — 결과 폐기.\n const created = buildShapes(polys, resultShape, style);\n if (!created?.length) return;\n docRef.current.create(created);\n changeSelection(created.map((s) => s.id));\n })();\n },\n [assistantRef, draftRef, buildShapes, changeSelection, docRef, mutatePending],\n );\n\n const isActive = useCallback(\n () =>\n statusRef.current === \"loading\" ||\n pointsRef.current.length > 0 ||\n pendingBoxesRef.current.length > 0 ||\n committedRef.current.length > 0,\n [],\n );\n\n return {\n status,\n points,\n /** 진행 중인 박스 프롬프트들(병렬). 오버레이 shimmer 표시용. */\n boxes: pendingBoxes,\n beginBox,\n addPoint,\n newPolygon,\n refineShape,\n finalize,\n discard,\n cancel,\n isActive,\n };\n}\n\nexport type AssistantSession<TMeta> = ReturnType<typeof useAssistant<TMeta>>;\n"],"mappings":";;;;AAoCA,SAAgB,EAAoB,EAClC,WACA,aACA,cACA,oBACA,mBAC4B;CAC5B,IAAM,CAAC,GAAQ,KAAa,EAA0B,OAAO,EACvD,CAAC,GAAQ,KAAa,EAAwD,EAAE,CAAC,EAEjF,CAAC,GAAc,KAAmB,EAAgB,EAAE,CAAC,EACrD,IAAkB,EAAc,EAAE,CAAC,EAEnC,IAAY,EAAsD,EAAE,CAAC,EACrE,IAAe,EAAiB,EAAE,CAAC,EACnC,IAAY,EAAwB,OAAO,EAC3C,IAAW,EAAO,EAAE,EAEpB,IAAU,EAAuB,KAAK,EACtC,IAAmB,EAAkC,KAAK,EAC1D,IAAc,EAAO,EAAE,EAEvB,IAAgB,GAAa,MAAoC;AAErE,EADA,EAAgB,UAAU,EAAQ,EAAgB,QAAQ,EAC1D,EAAgB,EAAgB,QAAQ;IACvC,EAAE,CAAC,EAEA,IAAgB,GAAa,MAAuB;AAExD,EADA,EAAU,UAAU,GACpB,EAAU,EAAE;IACX,EAAE,CAAC,EAOA,IAAc,GAEhB,GACA,GACA,MACgC;EAChC,IAAM,IAA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N,SAAQ,EAAE;;AAGZ,QADA,GAAe,MAAS,EAAK,QAAQ,MAAM,MAAM,EAAE,CAAC,EAChD,MAAU,EAAY,QAAS;IACnC,IAAM,IAAU,EAAY,GAAO,GAAa,EAAM;AACjD,OAAS,WACd,EAAO,QAAQ,OAAO,EAAQ,EAC9B,EAAgB,EAAQ,KAAK,MAAM,EAAE,GAAG,CAAC;OACvC;KAEN;GAAC;GAAc;GAAU;GAAa;GAAiB;GAAQ;GAAc,CAC9E;EAiBC;EACA;EACA;EACA;EACA;EACA;EACA,UArBe,QAEb,EAAU,YAAY,aACtB,EAAU,QAAQ,SAAS,KAC3B,EAAgB,QAAQ,SAAS,KACjC,EAAa,QAAQ,SAAS,GAChC,EAAE,CACH;EAeA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../_model/geometry.cjs`),t=require(`../_model/tools.cjs`),n=require(`../_model/brush.cjs`),r=require(`../_model/scalarMask.cjs`),i=require(`./drawSessionState.cjs`),a=require(`./useLatestRef.cjs`);let o=require(`react`);var s=10;function c(e,t){if(e.active!==t.active||e.kind!==t.kind||e.canUndo!==t.canUndo||e.canRedo!==t.canRedo)return!1;let n=e.brush,r=t.brush;return!n||!r?n===r:n.mode===r.mode&&n.editing===r.editing&&n.editTargetIds.length===r.editTargetIds.length&&n.editTargetIds.every((e,t)=>e===r.editTargetIds[t])}function l({toolRef:l,selRef:u,docRef:d,readOnlyRef:f,draftRef:p,brushSizeRef:m,simplifyEpsilonRef:h,draftMeta:g,engineRef:_,onDrawSessionChange:ee,onDraftShapeChange:te,changeSelection:v,createShape:ne,onDrawAttemptWithoutDraft:re}){let ie=a.useLatestRef(ee),y=a.useLatestRef(te),ae=a.useLatestRef(g),b=a.useLatestRef(ne),x=a.useLatestRef(re),S=(0,o.useCallback)(()=>p.current?!0:(x.current?.(),!1),[p]),C=(0,o.useRef)(null),w=(0,o.useRef)([]),T=(0,o.useRef)(null),E=(0,o.useRef)(new Set),D=(0,o.useRef)([[]]),O=(0,o.useRef)(0),k=(0,o.useRef)(null),A=(0,o.useRef)([]),j=(0,o.useRef)([]),M=(0,o.useRef)([]),N=(0,o.useRef)([[]]),P=(0,o.useRef)(0),F=(0,o.useRef)(`draw`),I=(0,o.useCallback)(()=>F.current===`erase`?`erase`:`add`,[]),L=(0,o.useCallback)(()=>M.current.length>0||A.current.length>0||l.current===t.TOOL.BRUSH&&w.current.length>0,[l]),R=(0,o.useCallback)(()=>{let e=l.current;return e===t.TOOL.BRUSH&&L()?`brush`:e===t.TOOL.POLYGON&&w.current.length>0?`polygon`:e===t.TOOL.PATH&&w.current.length>0?`path`:`none`},[L,l]),z=(0,o.useCallback)(()=>{let e=l.current;return e===t.TOOL.BRUSH?w.current.length>0||P.current>0:e===t.TOOL.POLYGON||e===t.TOOL.PATH?O.current>0:!1},[l]),B=(0,o.useCallback)(()=>{let e=l.current;return e===t.TOOL.BRUSH?w.current.length===0&&P.current<N.current.length-1:e===t.TOOL.POLYGON||e===t.TOOL.PATH?O.current<D.current.length-1:!1},[l]),oe=(0,o.useCallback)(()=>R()!==`none`,[R]),se=(0,o.useCallback)(()=>F.current,[]),V=(0,o.useCallback)(()=>{let e=R(),t={active:e!==`none`,kind:e,canUndo:z(),canRedo:B(),brush:e===`brush`?{mode:F.current,editing:M.current.length>0,editTargetIds:[...M.current]}:void 0},n=C.current;n&&c(n,t)||(C.current=t,ie.current?.(t))},[B,z,R]),H=(0,o.useCallback)(()=>{N.current=[[]],P.current=0},[]),U=(0,o.useCallback)(()=>{let n=_.current;if(!n)return;let a=l.current;if(a===t.TOOL.BRUSH){let e=[...A.current];if(w.current.length&&e.push({points:w.current,mode:I()}),!e.length&&!j.current.length){n.clearPreview();return}let t=r.buildScalarMaskRaster(e,m.current,j.current);if(!t){n.clearPreview();return}let i=p.current?.color??`#00e5ff`;n.previewScalarMask(t,i);return}let o=w.current;if(!o.length){n.clearPreview(),k.current&&(k.current=null,y.current?.(null));return}let s={...p.current,color:p.current?.color??`#00e5ff`},c=Array.from(E.current),u=a!==t.TOOL.PATH;if(n.previewPoly(o,T.current,s,!1,c,u),a===t.TOOL.POLYGON||a===t.TOOL.PATH){let t=y.current;t&&o!==k.current&&(k.current=o,t({type:e.SHAPE_TYPE.POLYGON,points:i.clonePoints(o),meta:ae.current}))}},[m,I,p,_,l]),W=(0,o.useCallback)(e=>{let t=i.cloneScalarStrokes(e),n=N.current,r=P.current,a=n[r];a&&i.scalarStrokesEqual(a,t)||(N.current=[...n.slice(0,r+1),t],P.current+=1,V())},[V]),G=(0,o.useCallback)(e=>{let t=D.current,n=O.current,r=t[n];r&&i.pointsEqual(r,e)||(D.current=[...t.slice(0,n+1),i.clonePoints(e)],O.current+=1)},[]),K=(0,o.useCallback)(()=>{w.current=[],A.current=[],j.current=[],M.current=[],T.current=null,E.current=new Set,D.current=[[]],O.current=0,k.current=null,H(),_.current?.clearPreview(),y.current?.(null),V()},[_,V,H]),q=(0,o.useCallback)((e,t)=>{w.current=e,E.current=new Set(Array.from(E.current).filter(t=>t>=0&&t<e.length)),t&&G(e),U(),V()},[V,G,U]),ce=(0,o.useCallback)(()=>i.clonePoints(w.current),[]),le=(0,o.useCallback)(()=>w.current.length>0,[]),ue=(0,o.useCallback)((n,r)=>{if(l.current!==t.TOOL.POLYGON)return!1;let i=w.current;if(i.length<3)return!1;let a=i[0];return Math.hypot(n.x-a.x,n.y-a.y)>r?!1:S()?(b.current(e.SHAPE_TYPE.POLYGON,i),K(),!0):!0},[S,K,l]),de=(0,o.useCallback)(e=>{let t=w.current;return e<0||e>=t.length?!1:(q(t.filter((t,n)=>n!==e),!0),!0)},[q]),fe=(0,o.useCallback)((e,t)=>{let n=w.current;if(e<0||e>=n.length)return null;let r=new Set(E.current);return t?r.has(e)?r.delete(e):r.add(e):r.has(e)||(r.clear(),r.add(e)),E.current=r,T.current=null,U(),V(),{base:i.clonePoints(n),indices:Array.from(r)}},[V,U]),pe=(0,o.useCallback)(e=>{E.current=new Set,T.current=e,q([...w.current,e],!0)},[q]),me=(0,o.useCallback)(e=>{T.current=null,E.current=new Set,w.current=[{...e}],U(),V()},[V,U]),he=(0,o.useCallback)((e,t)=>{let n=w.current[w.current.length-1];return n&&Math.hypot(e.x-n.x,e.y-n.y)<t?!1:(w.current=[...w.current,{...e}],T.current=null,U(),V(),!0)},[V,U]),ge=(0,o.useCallback)((e,t,n,r)=>{let i=new Set(t);w.current=e.map((e,t)=>i.has(t)?{x:e.x+n,y:e.y+r}:{...e}),T.current=null,U(),V()},[V,U]),_e=(0,o.useCallback)(e=>{e&&(G(w.current),U(),V())},[V,G,U]),ve=(0,o.useCallback)(e=>{T.current=e?{...e}:null,U()},[U]),J=(0,o.useCallback)(()=>w.current.length>0?(w.current=[],U(),V(),!0):P.current<=0?!1:(--P.current,A.current=i.cloneScalarStrokes(N.current[P.current]),U(),V(),!0),[V,U]),Y=(0,o.useCallback)(()=>w.current.length>0||P.current>=N.current.length-1?!1:(P.current+=1,A.current=i.cloneScalarStrokes(N.current[P.current]),U(),V(),!0),[V,U]),X=(0,o.useCallback)(()=>O.current<=0?!1:(--O.current,w.current=i.clonePoints(D.current[O.current]),E.current=new Set,U(),V(),!0),[V,U]),Z=(0,o.useCallback)(()=>O.current>=D.current.length-1?!1:(O.current+=1,w.current=i.clonePoints(D.current[O.current]),E.current=new Set,U(),V(),!0),[V,U]),ye=(0,o.useCallback)(()=>{let e=l.current;return e===t.TOOL.BRUSH?J():e===t.TOOL.POLYGON||e===t.TOOL.PATH?X():!1},[l,J,X]),be=(0,o.useCallback)(()=>{let e=l.current;return e===t.TOOL.BRUSH?Y():e===t.TOOL.POLYGON||e===t.TOOL.PATH?Z():!1},[Y,Z,l]),Q=(0,o.useCallback)(()=>{let t=u.current;if(!t.length)return M.current.length>0;let n=d.current.getShapes().filter(n=>t.includes(n.id)&&e.isShapeEditable(n)),i=r.shapesToFilledPolygons(n);return i.length?(M.current=n.map(e=>e.id),j.current=i,!0):(M.current=[],j.current=[],!1)},[d,u]),xe=(0,o.useCallback)(()=>{let n=M.current;if(!n.length)return;let i=d.current.getShapes().filter(t=>n.includes(t.id)&&e.isShapeEditable(t)),a=i.length?r.shapesToFilledPolygons(i):[];M.current=a.length?i.map(e=>e.id):[],j.current=a,l.current===t.TOOL.BRUSH&&U(),V()},[d,V,U,l]),$=(0,o.useCallback)(()=>{if(f.current)return!1;let t=[...A.current];w.current.length&&t.push({points:i.clonePoints(w.current),mode:I()});let n=M.current,a=n.length?d.current.getShapes().filter(t=>n.includes(t.id)&&e.isShapeEditable(t)):[],o=a.length?r.shapesToFilledPolygons(a):[];if(!t.length&&!o.length)return n.length&&K(),!1;let s=r.buildScalarMaskRaster(t,m.current,o);if(!s)return K(),!1;let c=r.scalarMaskToPolygons(s,h.current);if(a.length){if(!c.length)return d.current.remove(a.map(e=>e.id)),K(),v([]),!0;c.sort((e,t)=>r.polygonArea(t)-r.polygonArea(e));let t=[],n=[],i=[];for(let r=0;r<c.length;r++){let o=c[r];if(r<a.length){let n=a[r];t.push({...n,type:e.SHAPE_TYPE.POLYGON,points:o}),i.push(n.id)}else{let t=a[0],r=e.generateId();n.push({...t,id:r,type:e.SHAPE_TYPE.POLYGON,points:o}),i.push(r)}}let o=a.slice(c.length).map(e=>e.id);return d.current.commit({update:t,create:n,remove:o}),K(),v(i),!0}if(!c.length)return K(),!1;let l=p.current;if(!l)return x.current?.(),!1;let u=c.map(t=>({id:e.generateId(),type:e.SHAPE_TYPE.POLYGON,points:t,style:l,meta:g}));return d.current.create(u),v(u.map(e=>e.id)),K(),!0},[m,I,v,d,g,p,f,K,h]),Se=(0,o.useCallback)(()=>{let n=l.current;if(n===t.TOOL.BRUSH)return $();let r=w.current;return n===t.TOOL.POLYGON&&r.length>=3&&S()?(b.current(e.SHAPE_TYPE.POLYGON,r),K(),!0):!1},[$,S,K,l]),Ce=(0,o.useCallback)(()=>{let r=w.current;if(l.current===t.TOOL.PATH&&r.length>=3){let t=n.simplifyPath(r,h.current);t.length>=3&&S()&&b.current(e.SHAPE_TYPE.POLYGON,t)}K()},[S,K,h,l]),we=(0,o.useCallback)(e=>{F.current=e,V(),U()},[V,U]),Te=(0,o.useCallback)(()=>{if(f.current||l.current!==t.TOOL.BRUSH)return!1;A.current=[],w.current=[],H();let e=Q();return V(),U(),e},[V,f,U,H,Q,l]),Ee=(0,o.useCallback)(()=>{let e=E.current;if(!e.size)return!1;let t=w.current.filter((t,n)=>!e.has(n));return E.current=new Set,q(t,!0),!0},[q]),De=(0,o.useCallback)(e=>{let t=_.current,n=w.current;if(!t||!n.length)return-1;let r=s/(t.viewport.scale||1);for(let t=n.length-1;t>=0;t--){let i=n[t];if(Math.hypot(e.x-i.x,e.y-i.y)<=r)return t}return-1},[_]),Oe=(0,o.useCallback)(()=>{w.current.length>=1&&(A.current.push({points:i.clonePoints(w.current),mode:I()}),w.current=[],W(A.current)),U(),V()},[I,V,W,U]);return{reset:K,undoSession:ye,redoSession:be,canUndoSession:z,canRedoSession:B,hasDraftSession:oe,hasDraftPoints:le,commitDraftSession:Se,completeFreehandStroke:Ce,setBrushScalarMode:we,getBrushScalarMode:se,hasBrushSession:L,commitBrush:$,syncBrushTargets:xe,cancelBrush:(0,o.useCallback)(()=>{l.current===t.TOOL.BRUSH&&K()},[K,l]),beginBrushEditFromSelection:Te,deleteDraftSelectedPoints:Ee,hitDraftPoint:De,getDraftPointsSnapshot:ce,tryClosePolygon:ue,removeDraftPoint:de,selectDraftPointForDrag:fe,appendPolygonPoint:pe,beginStroke:me,appendStrokePoint:he,moveDraftPoints:ge,commitDraftPointDrag:_e,setDraftCursor:ve,finishScalarStroke:Oe,handleToolChange:(0,o.useCallback)((e,n)=>{if(n){K(),F.current=`draw`;return}if(e!==t.TOOL.BRUSH){K(),F.current=`draw`;return}F.current=`draw`,A.current=[],w.current=[],H(),Q(),V(),U()},[V,U,K,H,Q]),handleBrushSelectionChange:(0,o.useCallback)((e,n)=>{if(!(l.current!==t.TOOL.BRUSH||n)){if(!e.length){V();return}[...e].sort().join(`,`)!==[...M.current].sort().join(`,`)&&(A.current.length||w.current.length||(A.current=[],w.current=[],H(),Q(),V(),U()))}},[V,U,H,Q,l])}}exports.useDrawSession=l;
|
|
2
|
+
//# sourceMappingURL=useDrawSession.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDrawSession.cjs","names":[],"sources":["../../../../src/components/ShapeEditor/_state/useDrawSession.ts"],"sourcesContent":["import { type RefObject, useCallback, useRef } from \"react\";\nimport { simplifyPath } from \"../_model/brush\";\nimport {\n type EditorShape,\n generateId,\n isShapeEditable,\n type Point,\n SHAPE_TYPE,\n type ShapeStyle,\n} from \"../_model/geometry\";\nimport type { DrawSessionChange, DrawSessionKind } from \"../_model/props\";\nimport {\n buildScalarMaskRaster,\n polygonArea,\n type ScalarStroke,\n scalarMaskToPolygons,\n shapesToFilledPolygons,\n} from \"../_model/scalarMask\";\nimport { type BrushScalarMode, TOOL, type Tool } from \"../_model/tools\";\nimport type { EditorRenderer } from \"../_renderers/types\";\nimport {\n clonePoints,\n cloneScalarStrokes,\n pointsEqual,\n scalarStrokesEqual,\n} from \"./drawSessionState\";\nimport type { useEditorDocument } from \"./useEditorDocument\";\nimport { useLatestRef } from \"./useLatestRef\";\n\nconst DRAFT_POINT_HIT_RADIUS = 10;\n\ntype DocApi<TMeta> = ReturnType<typeof useEditorDocument<TMeta>>;\n\nfunction isSameDrawSession(a: DrawSessionChange, b: DrawSessionChange): boolean {\n if (\n a.active !== b.active ||\n a.kind !== b.kind ||\n a.canUndo !== b.canUndo ||\n a.canRedo !== b.canRedo\n ) {\n return false;\n }\n const aBrush = a.brush;\n const bBrush = b.brush;\n if (!aBrush || !bBrush) return aBrush === bBrush;\n return (\n aBrush.mode === bBrush.mode &&\n aBrush.editing === bBrush.editing &&\n aBrush.editTargetIds.length === bBrush.editTargetIds.length &&\n aBrush.editTargetIds.every((id, index) => id === bBrush.editTargetIds[index])\n );\n}\n\n/** useDrawSession가 반환하는 그리기 세션 핸들. */\nexport type DrawSession<TMeta> = ReturnType<typeof useDrawSession<TMeta>>;\n\ninterface UseDrawSessionParams<TMeta> {\n toolRef: RefObject<Tool>;\n selRef: RefObject<string[]>;\n docRef: RefObject<DocApi<TMeta>>;\n readOnlyRef: RefObject<boolean | undefined>;\n draftRef: RefObject<ShapeStyle | undefined>;\n brushSizeRef: RefObject<number>;\n /** 자유선/붓→폴리곤 단순화 강도(RDP epsilon). */\n simplifyEpsilonRef: RefObject<number>;\n draftMeta: TMeta | undefined;\n engineRef: RefObject<EditorRenderer | null>;\n onDrawSessionChange?: (session: DrawSessionChange) => void;\n onDraftShapeChange?: (shape: Pick<EditorShape<TMeta>, \"type\" | \"points\" | \"meta\"> | null) => void;\n changeSelection: (ids: string[]) => void;\n createShape: (type: EditorShape<TMeta>[\"type\"], points: Point[]) => void;\n /** 확정하려는데 draft 스타일이 없을 때(그리는 도중 호스트가 해제) 호출. 초안은 남긴다. */\n onDrawAttemptWithoutDraft?: () => void;\n}\n\nexport function useDrawSession<TMeta>({\n toolRef,\n selRef,\n docRef,\n readOnlyRef,\n draftRef,\n brushSizeRef,\n simplifyEpsilonRef,\n draftMeta,\n engineRef,\n onDrawSessionChange,\n onDraftShapeChange,\n changeSelection,\n createShape,\n onDrawAttemptWithoutDraft,\n}: UseDrawSessionParams<TMeta>) {\n const onDrawSessionChangeRef = useLatestRef(onDrawSessionChange);\n const onDraftShapeChangeRef = useLatestRef(onDraftShapeChange);\n const draftMetaRef = useLatestRef(draftMeta);\n const createShapeRef = useLatestRef(createShape);\n const onDrawAttemptWithoutDraftRef = useLatestRef(onDrawAttemptWithoutDraft);\n // 확정 직전 draft 스타일 확인. 없으면 호스트에 알리고 false — 호출부는 초안을 버리지 않아\n // 호스트가 스타일을 다시 정하면 같은 초안을 이어서 확정할 수 있다.\n const ensureDraftStyle = useCallback(() => {\n if (draftRef.current) return true;\n onDrawAttemptWithoutDraftRef.current?.();\n return false;\n }, [draftRef]);\n const lastNotifiedDrawSessionRef = useRef<DrawSessionChange | null>(null);\n\n const draftPathRef = useRef<Point[]>([]);\n const draftCursorRef = useRef<Point | null>(null);\n const draftSelectedPointIndicesRef = useRef<Set<number>>(new Set());\n const draftHistoryRef = useRef<Point[][]>([[]]);\n const draftHistoryIndexRef = useRef(0);\n const lastNotifiedDraftPathRef = useRef<Point[] | null>(null);\n\n const scalarStrokesRef = useRef<ScalarStroke[]>([]);\n const scalarBasePolygonsRef = useRef<Point[][]>([]);\n const scalarEditTargetIdsRef = useRef<string[]>([]);\n const scalarHistoryRef = useRef<ScalarStroke[][]>([[]]);\n const scalarHistoryIndexRef = useRef(0);\n const brushScalarModeRef = useRef<BrushScalarMode>(\"draw\");\n\n // 아래 조회 함수들은 ref만 읽으므로 마운트당 1회 생성해 명령형 핸들·history 메모가\n // 매 렌더 재생성되지 않게 한다.\n const brushStrokeMode = useCallback(\n (): ScalarStroke[\"mode\"] => (brushScalarModeRef.current === \"erase\" ? \"erase\" : \"add\"),\n [],\n );\n\n const getBrushSessionActive = useCallback(\n () =>\n scalarEditTargetIdsRef.current.length > 0 ||\n scalarStrokesRef.current.length > 0 ||\n (toolRef.current === TOOL.BRUSH && draftPathRef.current.length > 0),\n [toolRef],\n );\n\n const getDrawSessionKind = useCallback((): DrawSessionKind => {\n const tool = toolRef.current;\n if (tool === TOOL.BRUSH && getBrushSessionActive()) return \"brush\";\n if (tool === TOOL.POLYGON && draftPathRef.current.length > 0) {\n return \"polygon\";\n }\n if (tool === TOOL.PATH && draftPathRef.current.length > 0) return \"path\";\n return \"none\";\n }, [getBrushSessionActive, toolRef]);\n\n const canUndoSession = useCallback(() => {\n const tool = toolRef.current;\n if (tool === TOOL.BRUSH) {\n return draftPathRef.current.length > 0 || scalarHistoryIndexRef.current > 0;\n }\n if (tool === TOOL.POLYGON || tool === TOOL.PATH) {\n return draftHistoryIndexRef.current > 0;\n }\n return false;\n }, [toolRef]);\n\n const canRedoSession = useCallback(() => {\n const tool = toolRef.current;\n if (tool === TOOL.BRUSH) {\n return (\n draftPathRef.current.length === 0 &&\n scalarHistoryIndexRef.current < scalarHistoryRef.current.length - 1\n );\n }\n if (tool === TOOL.POLYGON || tool === TOOL.PATH) {\n return draftHistoryIndexRef.current < draftHistoryRef.current.length - 1;\n }\n return false;\n }, [toolRef]);\n\n const hasDraftSession = useCallback(() => getDrawSessionKind() !== \"none\", [getDrawSessionKind]);\n\n const getBrushScalarMode = useCallback(() => brushScalarModeRef.current, []);\n\n const notifyDrawSession = useCallback(() => {\n const kind = getDrawSessionKind();\n const next: DrawSessionChange = {\n active: kind !== \"none\",\n kind,\n canUndo: canUndoSession(),\n canRedo: canRedoSession(),\n brush:\n kind === \"brush\"\n ? {\n mode: brushScalarModeRef.current,\n editing: scalarEditTargetIdsRef.current.length > 0,\n editTargetIds: [...scalarEditTargetIdsRef.current],\n }\n : undefined,\n };\n const previous = lastNotifiedDrawSessionRef.current;\n if (previous && isSameDrawSession(previous, next)) return;\n lastNotifiedDrawSessionRef.current = next;\n onDrawSessionChangeRef.current?.(next);\n }, [canRedoSession, canUndoSession, getDrawSessionKind]);\n\n const resetScalarHistory = useCallback(() => {\n scalarHistoryRef.current = [[]];\n scalarHistoryIndexRef.current = 0;\n }, []);\n\n const renderPreview = useCallback(() => {\n const eng = engineRef.current;\n if (!eng) return;\n const tool = toolRef.current;\n if (tool === TOOL.BRUSH) {\n const strokes: ScalarStroke[] = [...scalarStrokesRef.current];\n if (draftPathRef.current.length) {\n strokes.push({\n points: draftPathRef.current,\n mode: brushStrokeMode(),\n });\n }\n if (!strokes.length && !scalarBasePolygonsRef.current.length) {\n eng.clearPreview();\n return;\n }\n const raster = buildScalarMaskRaster(\n strokes,\n brushSizeRef.current,\n scalarBasePolygonsRef.current,\n );\n if (!raster) {\n eng.clearPreview();\n return;\n }\n const color = draftRef.current?.color ?? \"#00e5ff\";\n eng.previewScalarMask(raster, color);\n return;\n }\n const points = draftPathRef.current;\n if (!points.length) {\n eng.clearPreview();\n if (lastNotifiedDraftPathRef.current) {\n lastNotifiedDraftPathRef.current = null;\n onDraftShapeChangeRef.current?.(null);\n }\n return;\n }\n const style = {\n ...draftRef.current,\n color: draftRef.current?.color ?? \"#00e5ff\",\n };\n const selected = Array.from(draftSelectedPointIndicesRef.current);\n // PATH(자유선/펜)은 정점을 찍는 방식이 아니므로 그리는 중 점을 숨기고 선만 보여준다.\n const showVertices = tool !== TOOL.PATH;\n eng.previewPoly(points, draftCursorRef.current, style, false, selected, showVertices);\n if (tool === TOOL.POLYGON || tool === TOOL.PATH) {\n const onDraftShapeChange = onDraftShapeChangeRef.current;\n if (onDraftShapeChange && points !== lastNotifiedDraftPathRef.current) {\n lastNotifiedDraftPathRef.current = points;\n onDraftShapeChange({\n // PATH도 커밋 시 단순화된 POLYGON이 되므로 동일한 도형 타입으로 통지한다.\n type: SHAPE_TYPE.POLYGON,\n points: clonePoints(points),\n meta: draftMetaRef.current,\n });\n }\n }\n }, [brushSizeRef, brushStrokeMode, draftRef, engineRef, toolRef]);\n\n const pushScalarHistory = useCallback(\n (strokes: ScalarStroke[]) => {\n const snapshot = cloneScalarStrokes(strokes);\n const history = scalarHistoryRef.current;\n const index = scalarHistoryIndexRef.current;\n const last = history[index];\n if (last && scalarStrokesEqual(last, snapshot)) return;\n scalarHistoryRef.current = [...history.slice(0, index + 1), snapshot];\n scalarHistoryIndexRef.current += 1;\n notifyDrawSession();\n },\n [notifyDrawSession],\n );\n\n const pushDraftHistory = useCallback((points: Point[]) => {\n const history = draftHistoryRef.current;\n const index = draftHistoryIndexRef.current;\n const last = history[index];\n if (last && pointsEqual(last, points)) return;\n draftHistoryRef.current = [...history.slice(0, index + 1), clonePoints(points)];\n draftHistoryIndexRef.current += 1;\n }, []);\n\n const reset = useCallback(() => {\n draftPathRef.current = [];\n scalarStrokesRef.current = [];\n scalarBasePolygonsRef.current = [];\n scalarEditTargetIdsRef.current = [];\n draftCursorRef.current = null;\n draftSelectedPointIndicesRef.current = new Set();\n draftHistoryRef.current = [[]];\n draftHistoryIndexRef.current = 0;\n lastNotifiedDraftPathRef.current = null;\n resetScalarHistory();\n engineRef.current?.clearPreview();\n onDraftShapeChangeRef.current?.(null);\n notifyDrawSession();\n }, [engineRef, notifyDrawSession, resetScalarHistory]);\n\n const setDraftPath = useCallback(\n (points: Point[], commitHistory: boolean) => {\n draftPathRef.current = points;\n const validIndices = new Set(\n Array.from(draftSelectedPointIndicesRef.current).filter(\n (index) => index >= 0 && index < points.length,\n ),\n );\n draftSelectedPointIndicesRef.current = validIndices;\n if (commitHistory) pushDraftHistory(points);\n renderPreview();\n notifyDrawSession();\n },\n [notifyDrawSession, pushDraftHistory, renderPreview],\n );\n\n const getDraftPointsSnapshot = useCallback(() => clonePoints(draftPathRef.current), []);\n\n const hasDraftPoints = useCallback(() => draftPathRef.current.length > 0, []);\n\n const tryClosePolygon = useCallback(\n (p: Point, closeRadius: number) => {\n if (toolRef.current !== TOOL.POLYGON) return false;\n const points = draftPathRef.current;\n if (points.length < 3) return false;\n const first = points[0];\n if (Math.hypot(p.x - first.x, p.y - first.y) > closeRadius) {\n return false;\n }\n // 닫기 클릭은 소비하되(점을 더 찍지 않음) 스타일이 없으면 초안을 유지한다.\n if (!ensureDraftStyle()) return true;\n createShapeRef.current(SHAPE_TYPE.POLYGON, points);\n reset();\n return true;\n },\n [ensureDraftStyle, reset, toolRef],\n );\n\n const removeDraftPoint = useCallback(\n (index: number) => {\n const points = draftPathRef.current;\n if (index < 0 || index >= points.length) return false;\n setDraftPath(\n points.filter((_, pointIndex) => pointIndex !== index),\n true,\n );\n return true;\n },\n [setDraftPath],\n );\n\n const selectDraftPointForDrag = useCallback(\n (index: number, additive: boolean) => {\n const points = draftPathRef.current;\n if (index < 0 || index >= points.length) return null;\n const selected = new Set(draftSelectedPointIndicesRef.current);\n if (additive) {\n if (selected.has(index)) selected.delete(index);\n else selected.add(index);\n } else if (!selected.has(index)) {\n selected.clear();\n selected.add(index);\n }\n draftSelectedPointIndicesRef.current = selected;\n draftCursorRef.current = null;\n renderPreview();\n notifyDrawSession();\n return {\n base: clonePoints(points),\n indices: Array.from(selected),\n };\n },\n [notifyDrawSession, renderPreview],\n );\n\n const appendPolygonPoint = useCallback(\n (p: Point) => {\n draftSelectedPointIndicesRef.current = new Set();\n draftCursorRef.current = p;\n setDraftPath([...draftPathRef.current, p], true);\n },\n [setDraftPath],\n );\n\n const beginStroke = useCallback(\n (p: Point) => {\n draftCursorRef.current = null;\n draftSelectedPointIndicesRef.current = new Set();\n draftPathRef.current = [{ ...p }];\n renderPreview();\n notifyDrawSession();\n },\n [notifyDrawSession, renderPreview],\n );\n\n const appendStrokePoint = useCallback(\n (p: Point, step: number) => {\n const last = draftPathRef.current[draftPathRef.current.length - 1];\n if (last && Math.hypot(p.x - last.x, p.y - last.y) < step) return false;\n draftPathRef.current = [...draftPathRef.current, { ...p }];\n draftCursorRef.current = null;\n renderPreview();\n notifyDrawSession();\n return true;\n },\n [notifyDrawSession, renderPreview],\n );\n\n const moveDraftPoints = useCallback(\n (base: Point[], indices: number[], dx: number, dy: number) => {\n const moving = new Set(indices);\n draftPathRef.current = base.map((point, index) =>\n moving.has(index) ? { x: point.x + dx, y: point.y + dy } : { ...point },\n );\n draftCursorRef.current = null;\n renderPreview();\n notifyDrawSession();\n },\n [notifyDrawSession, renderPreview],\n );\n\n const commitDraftPointDrag = useCallback(\n (moved: boolean) => {\n if (moved) {\n pushDraftHistory(draftPathRef.current);\n renderPreview();\n notifyDrawSession();\n }\n },\n [notifyDrawSession, pushDraftHistory, renderPreview],\n );\n\n const setDraftCursor = useCallback(\n (p: Point | null) => {\n draftCursorRef.current = p ? { ...p } : null;\n renderPreview();\n },\n [renderPreview],\n );\n\n const undoBrush = useCallback(() => {\n if (draftPathRef.current.length > 0) {\n draftPathRef.current = [];\n renderPreview();\n notifyDrawSession();\n return true;\n }\n if (scalarHistoryIndexRef.current <= 0) return false;\n scalarHistoryIndexRef.current -= 1;\n scalarStrokesRef.current = cloneScalarStrokes(\n scalarHistoryRef.current[scalarHistoryIndexRef.current],\n );\n renderPreview();\n notifyDrawSession();\n return true;\n }, [notifyDrawSession, renderPreview]);\n\n const redoBrush = useCallback(() => {\n if (draftPathRef.current.length > 0) return false;\n if (scalarHistoryIndexRef.current >= scalarHistoryRef.current.length - 1) {\n return false;\n }\n scalarHistoryIndexRef.current += 1;\n scalarStrokesRef.current = cloneScalarStrokes(\n scalarHistoryRef.current[scalarHistoryIndexRef.current],\n );\n renderPreview();\n notifyDrawSession();\n return true;\n }, [notifyDrawSession, renderPreview]);\n\n const undoPolygon = useCallback(() => {\n if (draftHistoryIndexRef.current <= 0) return false;\n draftHistoryIndexRef.current -= 1;\n draftPathRef.current = clonePoints(draftHistoryRef.current[draftHistoryIndexRef.current]);\n draftSelectedPointIndicesRef.current = new Set();\n renderPreview();\n notifyDrawSession();\n return true;\n }, [notifyDrawSession, renderPreview]);\n\n const redoPolygon = useCallback(() => {\n if (draftHistoryIndexRef.current >= draftHistoryRef.current.length - 1) {\n return false;\n }\n draftHistoryIndexRef.current += 1;\n draftPathRef.current = clonePoints(draftHistoryRef.current[draftHistoryIndexRef.current]);\n draftSelectedPointIndicesRef.current = new Set();\n renderPreview();\n notifyDrawSession();\n return true;\n }, [notifyDrawSession, renderPreview]);\n\n const undoSession = useCallback(() => {\n const tool = toolRef.current;\n if (tool === TOOL.BRUSH) return undoBrush();\n if (tool === TOOL.POLYGON || tool === TOOL.PATH) return undoPolygon();\n return false;\n }, [toolRef, undoBrush, undoPolygon]);\n\n const redoSession = useCallback(() => {\n const tool = toolRef.current;\n if (tool === TOOL.BRUSH) return redoBrush();\n if (tool === TOOL.POLYGON || tool === TOOL.PATH) return redoPolygon();\n return false;\n }, [redoBrush, redoPolygon, toolRef]);\n\n const seedBrushEditFromSelection = useCallback(() => {\n const ids = selRef.current;\n if (!ids.length) {\n return scalarEditTargetIdsRef.current.length > 0;\n }\n const shapes = docRef.current\n .getShapes()\n .filter((shape) => ids.includes(shape.id) && isShapeEditable(shape));\n const polygons = shapesToFilledPolygons(shapes);\n if (!polygons.length) {\n scalarEditTargetIdsRef.current = [];\n scalarBasePolygonsRef.current = [];\n return false;\n }\n scalarEditTargetIdsRef.current = shapes.map((shape) => shape.id);\n scalarBasePolygonsRef.current = polygons;\n return true;\n }, [docRef, selRef]);\n\n /**\n * 붓 세션 중 문서가 바뀌면(호스트 수정·삭제) 편집 대상과 미리보기 base를 문서에 다시\n * 맞춘다 — 화면에 보던 결과와 commitBrush가 커밋 시점 문서로 만드는 결과가 같게.\n * 대상이 모두 사라지면 대상 없는 세션(칠한 스트로크는 유지 → 새 도형 경로)이 된다.\n */\n const syncBrushTargets = useCallback(() => {\n const ids = scalarEditTargetIdsRef.current;\n if (!ids.length) return;\n const shapes = docRef.current\n .getShapes()\n .filter((shape) => ids.includes(shape.id) && isShapeEditable(shape));\n const polygons = shapes.length ? shapesToFilledPolygons(shapes) : [];\n scalarEditTargetIdsRef.current = polygons.length ? shapes.map((shape) => shape.id) : [];\n scalarBasePolygonsRef.current = polygons;\n if (toolRef.current === TOOL.BRUSH) renderPreview();\n notifyDrawSession();\n }, [docRef, notifyDrawSession, renderPreview, toolRef]);\n\n const commitBrush = useCallback(() => {\n if (readOnlyRef.current) return false;\n const strokes: ScalarStroke[] = [...scalarStrokesRef.current];\n if (draftPathRef.current.length) {\n strokes.push({\n points: clonePoints(draftPathRef.current),\n mode: brushStrokeMode(),\n });\n }\n // 편집 대상은 커밋 시점 문서에서 다시 읽는다 — 시드 뒤 undo·호스트 삭제로 사라졌거나\n // 바뀐 도형을 옛 스냅샷으로 칠하거나, 템플릿 없이 조각을 만들지 않게.\n const editTargetIds = scalarEditTargetIdsRef.current;\n const targets = editTargetIds.length\n ? docRef.current\n .getShapes()\n .filter((shape) => editTargetIds.includes(shape.id) && isShapeEditable(shape))\n : [];\n const basePolygons = targets.length ? shapesToFilledPolygons(targets) : [];\n if (!strokes.length && !basePolygons.length) {\n if (editTargetIds.length) reset();\n return false;\n }\n\n const raster = buildScalarMaskRaster(strokes, brushSizeRef.current, basePolygons);\n if (!raster) {\n reset();\n return false;\n }\n const polygons = scalarMaskToPolygons(raster, simplifyEpsilonRef.current);\n\n if (targets.length) {\n if (!polygons.length) {\n docRef.current.remove(targets.map((shape) => shape.id));\n reset();\n changeSelection([]);\n return true;\n }\n polygons.sort((a, b) => polygonArea(b) - polygonArea(a));\n const updates: EditorShape<TMeta>[] = [];\n const creates: EditorShape<TMeta>[] = [];\n const nextSelection: string[] = [];\n for (let i = 0; i < polygons.length; i++) {\n const points = polygons[i];\n if (i < targets.length) {\n const shape = targets[i];\n updates.push({ ...shape, type: SHAPE_TYPE.POLYGON, points });\n nextSelection.push(shape.id);\n } else {\n const template = targets[0];\n const id = generateId();\n creates.push({\n ...template,\n id,\n type: SHAPE_TYPE.POLYGON,\n points,\n });\n nextSelection.push(id);\n }\n }\n const deleteIds = targets.slice(polygons.length).map((shape) => shape.id);\n // 한 번의 붓 편집은 undo 한 번에 되돌아가야 한다.\n docRef.current.commit({ update: updates, create: creates, remove: deleteIds });\n reset();\n changeSelection(nextSelection);\n return true;\n }\n\n if (!polygons.length) {\n reset();\n return false;\n }\n const style = draftRef.current;\n if (!style) {\n // 칠한 스트로크는 남긴다 — 스타일을 다시 정하면 그대로 이어서 확정한다.\n onDrawAttemptWithoutDraftRef.current?.();\n return false;\n }\n const shapes: EditorShape<TMeta>[] = polygons.map((points) => ({\n id: generateId(),\n type: SHAPE_TYPE.POLYGON,\n points,\n style,\n meta: draftMeta,\n }));\n docRef.current.create(shapes);\n changeSelection(shapes.map((shape) => shape.id));\n reset();\n return true;\n }, [\n brushSizeRef,\n brushStrokeMode,\n changeSelection,\n docRef,\n draftMeta,\n draftRef,\n readOnlyRef,\n reset,\n simplifyEpsilonRef,\n ]);\n\n const commitDraftSession = useCallback(() => {\n const tool = toolRef.current;\n if (tool === TOOL.BRUSH) return commitBrush();\n const points = draftPathRef.current;\n if (tool === TOOL.POLYGON && points.length >= 3) {\n if (!ensureDraftStyle()) return false;\n createShapeRef.current(SHAPE_TYPE.POLYGON, points);\n reset();\n return true;\n }\n return false;\n }, [commitBrush, ensureDraftStyle, reset, toolRef]);\n\n const completeFreehandStroke = useCallback(() => {\n const points = draftPathRef.current;\n if (toolRef.current === TOOL.PATH && points.length >= 3) {\n const simplified = simplifyPath(points, simplifyEpsilonRef.current);\n // 자유선은 손을 떼면 끝나는 한 획이라 이어 갈 초안이 없다 — 알리고 비운다.\n if (simplified.length >= 3 && ensureDraftStyle()) {\n createShapeRef.current(SHAPE_TYPE.POLYGON, simplified);\n }\n }\n reset();\n }, [ensureDraftStyle, reset, simplifyEpsilonRef, toolRef]);\n\n const setBrushScalarMode = useCallback(\n (mode: BrushScalarMode) => {\n brushScalarModeRef.current = mode;\n notifyDrawSession();\n renderPreview();\n },\n [notifyDrawSession, renderPreview],\n );\n\n const beginBrushEditFromSelection = useCallback(() => {\n if (readOnlyRef.current || toolRef.current !== TOOL.BRUSH) return false;\n scalarStrokesRef.current = [];\n draftPathRef.current = [];\n resetScalarHistory();\n const ok = seedBrushEditFromSelection();\n notifyDrawSession();\n renderPreview();\n return ok;\n }, [\n notifyDrawSession,\n readOnlyRef,\n renderPreview,\n resetScalarHistory,\n seedBrushEditFromSelection,\n toolRef,\n ]);\n\n const deleteDraftSelectedPoints = useCallback(() => {\n const selected = draftSelectedPointIndicesRef.current;\n if (!selected.size) return false;\n const next = draftPathRef.current.filter((_, i) => !selected.has(i));\n draftSelectedPointIndicesRef.current = new Set();\n setDraftPath(next, true);\n return true;\n }, [setDraftPath]);\n\n const hitDraftPoint = useCallback(\n (p: Point) => {\n const eng = engineRef.current;\n const points = draftPathRef.current;\n if (!eng || !points.length) return -1;\n const hitRadius = DRAFT_POINT_HIT_RADIUS / (eng.viewport.scale || 1);\n for (let i = points.length - 1; i >= 0; i--) {\n const point = points[i];\n if (Math.hypot(p.x - point.x, p.y - point.y) <= hitRadius) return i;\n }\n return -1;\n },\n [engineRef],\n );\n\n const finishScalarStroke = useCallback(() => {\n if (draftPathRef.current.length >= 1) {\n scalarStrokesRef.current.push({\n points: clonePoints(draftPathRef.current),\n mode: brushStrokeMode(),\n });\n draftPathRef.current = [];\n pushScalarHistory(scalarStrokesRef.current);\n }\n renderPreview();\n notifyDrawSession();\n }, [brushStrokeMode, notifyDrawSession, pushScalarHistory, renderPreview]);\n\n const cancelBrush = useCallback(() => {\n if (toolRef.current !== TOOL.BRUSH) return;\n reset();\n }, [reset, toolRef]);\n\n const handleToolChange = useCallback(\n (tool: Tool, isExternalTool: boolean) => {\n if (isExternalTool) {\n reset();\n brushScalarModeRef.current = \"draw\";\n return;\n }\n if (tool !== TOOL.BRUSH) {\n reset();\n brushScalarModeRef.current = \"draw\";\n return;\n }\n brushScalarModeRef.current = \"draw\";\n scalarStrokesRef.current = [];\n draftPathRef.current = [];\n resetScalarHistory();\n seedBrushEditFromSelection();\n notifyDrawSession();\n renderPreview();\n },\n [notifyDrawSession, renderPreview, reset, resetScalarHistory, seedBrushEditFromSelection],\n );\n\n const handleBrushSelectionChange = useCallback(\n (selectedIds: string[], readOnly: boolean | undefined) => {\n if (toolRef.current !== TOOL.BRUSH || readOnly) return;\n if (!selectedIds.length) {\n notifyDrawSession();\n return;\n }\n const nextKey = [...selectedIds].sort().join(\",\");\n const editKey = [...scalarEditTargetIdsRef.current].sort().join(\",\");\n if (nextKey === editKey) return;\n if (scalarStrokesRef.current.length || draftPathRef.current.length) {\n return;\n }\n scalarStrokesRef.current = [];\n draftPathRef.current = [];\n resetScalarHistory();\n seedBrushEditFromSelection();\n notifyDrawSession();\n renderPreview();\n },\n [notifyDrawSession, renderPreview, resetScalarHistory, seedBrushEditFromSelection, toolRef],\n );\n\n return {\n reset,\n undoSession,\n redoSession,\n canUndoSession,\n canRedoSession,\n hasDraftSession,\n hasDraftPoints,\n commitDraftSession,\n completeFreehandStroke,\n setBrushScalarMode,\n getBrushScalarMode,\n hasBrushSession: getBrushSessionActive,\n commitBrush,\n syncBrushTargets,\n cancelBrush,\n beginBrushEditFromSelection,\n deleteDraftSelectedPoints,\n hitDraftPoint,\n getDraftPointsSnapshot,\n tryClosePolygon,\n removeDraftPoint,\n selectDraftPointForDrag,\n appendPolygonPoint,\n beginStroke,\n appendStrokePoint,\n moveDraftPoints,\n commitDraftPointDrag,\n setDraftCursor,\n finishScalarStroke,\n handleToolChange,\n handleBrushSelectionChange,\n };\n}\n"],"mappings":"6SA6BA,IAAM,EAAyB,GAI/B,SAAS,EAAkB,EAAsB,EAA+B,CAC9E,GACE,EAAE,SAAW,EAAE,QACf,EAAE,OAAS,EAAE,MACb,EAAE,UAAY,EAAE,SAChB,EAAE,UAAY,EAAE,QAEhB,MAAO,GAET,IAAM,EAAS,EAAE,MACX,EAAS,EAAE,MAEjB,MADI,CAAC,GAAU,CAAC,EAAe,IAAW,EAExC,EAAO,OAAS,EAAO,MACvB,EAAO,UAAY,EAAO,SAC1B,EAAO,cAAc,SAAW,EAAO,cAAc,QACrD,EAAO,cAAc,OAAO,EAAI,IAAU,IAAO,EAAO,cAAc,GAAO,CA0BjF,SAAgB,EAAsB,CACpC,UACA,SACA,SACA,cACA,WACA,eACA,qBACA,YACA,YACA,uBACA,sBACA,kBACA,eACA,8BAC8B,CAC9B,IAAM,GAAyB,EAAA,aAAa,GAAoB,CAC1D,EAAwB,EAAA,aAAa,GAAmB,CACxD,GAAe,EAAA,aAAa,EAAU,CACtC,EAAiB,EAAA,aAAa,GAAY,CAC1C,EAA+B,EAAA,aAAa,GAA0B,CAGtE,GAAA,EAAA,EAAA,iBACA,EAAS,QAAgB,IAC7B,EAA6B,WAAW,CACjC,IACN,CAAC,EAAS,CAAC,CACR,GAAA,EAAA,EAAA,QAA8D,KAAK,CAEnE,GAAA,EAAA,EAAA,QAA+B,EAAE,CAAC,CAClC,GAAA,EAAA,EAAA,QAAsC,KAAK,CAC3C,GAAA,EAAA,EAAA,QAAmD,IAAI,IAAM,CAC7D,GAAA,EAAA,EAAA,QAAoC,CAAC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nB,GAAe,EAEjB,CAAC,EAAmB,EAAe,EAAO,EAAoB,EAA2B,CAC1F,CAwDC,4BAAA,EAAA,EAAA,cArDC,EAAuB,IAAkC,CACpD,OAAQ,UAAY,EAAA,KAAK,OAAS,GACtC,IAAI,CAAC,EAAY,OAAQ,CACvB,GAAmB,CACnB,OAEc,CAAC,GAAG,EAAY,CAAC,MAAM,CAAC,KAAK,IAAI,GACjC,CAAC,GAAG,EAAuB,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,GAEhE,EAAiB,QAAQ,QAAU,EAAa,QAAQ,SAG5D,EAAiB,QAAU,EAAE,CAC7B,EAAa,QAAU,EAAE,CACzB,GAAoB,CACpB,GAA4B,CAC5B,GAAmB,CACnB,GAAe,KAEjB,CAAC,EAAmB,EAAe,EAAoB,EAA4B,EAAQ,CAC5F,CAkCA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import { type EditorShape, type Point, type ShapeStyle } from "../_model/geometry.cjs";
|
|
3
|
+
import type { DrawSessionChange } from "../_model/props.cjs";
|
|
4
|
+
import { type BrushScalarMode, type Tool } from "../_model/tools.cjs";
|
|
5
|
+
import type { EditorRenderer } from "../_renderers/types.cjs";
|
|
6
|
+
import type { useEditorDocument } from "./useEditorDocument.cjs";
|
|
7
|
+
type DocApi<TMeta> = ReturnType<typeof useEditorDocument<TMeta>>;
|
|
8
|
+
/** useDrawSession가 반환하는 그리기 세션 핸들. */
|
|
9
|
+
export type DrawSession<TMeta> = ReturnType<typeof useDrawSession<TMeta>>;
|
|
10
|
+
interface UseDrawSessionParams<TMeta> {
|
|
11
|
+
toolRef: RefObject<Tool>;
|
|
12
|
+
selRef: RefObject<string[]>;
|
|
13
|
+
docRef: RefObject<DocApi<TMeta>>;
|
|
14
|
+
readOnlyRef: RefObject<boolean | undefined>;
|
|
15
|
+
draftRef: RefObject<ShapeStyle | undefined>;
|
|
16
|
+
brushSizeRef: RefObject<number>;
|
|
17
|
+
/** 자유선/붓→폴리곤 단순화 강도(RDP epsilon). */
|
|
18
|
+
simplifyEpsilonRef: RefObject<number>;
|
|
19
|
+
draftMeta: TMeta | undefined;
|
|
20
|
+
engineRef: RefObject<EditorRenderer | null>;
|
|
21
|
+
onDrawSessionChange?: (session: DrawSessionChange) => void;
|
|
22
|
+
onDraftShapeChange?: (shape: Pick<EditorShape<TMeta>, "type" | "points" | "meta"> | null) => void;
|
|
23
|
+
changeSelection: (ids: string[]) => void;
|
|
24
|
+
createShape: (type: EditorShape<TMeta>["type"], points: Point[]) => void;
|
|
25
|
+
/** 확정하려는데 draft 스타일이 없을 때(그리는 도중 호스트가 해제) 호출. 초안은 남긴다. */
|
|
26
|
+
onDrawAttemptWithoutDraft?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function useDrawSession<TMeta>({ toolRef, selRef, docRef, readOnlyRef, draftRef, brushSizeRef, simplifyEpsilonRef, draftMeta, engineRef, onDrawSessionChange, onDraftShapeChange, changeSelection, createShape, onDrawAttemptWithoutDraft, }: UseDrawSessionParams<TMeta>): {
|
|
29
|
+
reset: () => void;
|
|
30
|
+
undoSession: () => boolean;
|
|
31
|
+
redoSession: () => boolean;
|
|
32
|
+
canUndoSession: () => boolean;
|
|
33
|
+
canRedoSession: () => boolean;
|
|
34
|
+
hasDraftSession: () => boolean;
|
|
35
|
+
hasDraftPoints: () => boolean;
|
|
36
|
+
commitDraftSession: () => boolean;
|
|
37
|
+
completeFreehandStroke: () => void;
|
|
38
|
+
setBrushScalarMode: (mode: BrushScalarMode) => void;
|
|
39
|
+
getBrushScalarMode: () => BrushScalarMode;
|
|
40
|
+
hasBrushSession: () => boolean;
|
|
41
|
+
commitBrush: () => boolean;
|
|
42
|
+
syncBrushTargets: () => void;
|
|
43
|
+
cancelBrush: () => void;
|
|
44
|
+
beginBrushEditFromSelection: () => boolean;
|
|
45
|
+
deleteDraftSelectedPoints: () => boolean;
|
|
46
|
+
hitDraftPoint: (p: Point) => number;
|
|
47
|
+
getDraftPointsSnapshot: () => Point[];
|
|
48
|
+
tryClosePolygon: (p: Point, closeRadius: number) => boolean;
|
|
49
|
+
removeDraftPoint: (index: number) => boolean;
|
|
50
|
+
selectDraftPointForDrag: (index: number, additive: boolean) => {
|
|
51
|
+
base: Point[];
|
|
52
|
+
indices: number[];
|
|
53
|
+
} | null;
|
|
54
|
+
appendPolygonPoint: (p: Point) => void;
|
|
55
|
+
beginStroke: (p: Point) => void;
|
|
56
|
+
appendStrokePoint: (p: Point, step: number) => boolean;
|
|
57
|
+
moveDraftPoints: (base: Point[], indices: number[], dx: number, dy: number) => void;
|
|
58
|
+
commitDraftPointDrag: (moved: boolean) => void;
|
|
59
|
+
setDraftCursor: (p: Point | null) => void;
|
|
60
|
+
finishScalarStroke: () => void;
|
|
61
|
+
handleToolChange: (tool: Tool, isExternalTool: boolean) => void;
|
|
62
|
+
handleBrushSelectionChange: (selectedIds: string[], readOnly: boolean | undefined) => void;
|
|
63
|
+
};
|
|
64
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
-
import { type EditorShape, type Point, type ShapeStyle } from "../_model/geometry";
|
|
3
|
-
import type { DrawSessionChange } from "../_model/props";
|
|
4
|
-
import { type BrushScalarMode, type Tool } from "../_model/tools";
|
|
5
|
-
import type { EditorRenderer } from "../_renderers/types";
|
|
6
|
-
import type { useEditorDocument } from "./useEditorDocument";
|
|
2
|
+
import { type EditorShape, type Point, type ShapeStyle } from "../_model/geometry.js";
|
|
3
|
+
import type { DrawSessionChange } from "../_model/props.js";
|
|
4
|
+
import { type BrushScalarMode, type Tool } from "../_model/tools.js";
|
|
5
|
+
import type { EditorRenderer } from "../_renderers/types.js";
|
|
6
|
+
import type { useEditorDocument } from "./useEditorDocument.js";
|
|
7
7
|
type DocApi<TMeta> = ReturnType<typeof useEditorDocument<TMeta>>;
|
|
8
8
|
/** useDrawSession가 반환하는 그리기 세션 핸들. */
|
|
9
9
|
export type DrawSession<TMeta> = ReturnType<typeof useDrawSession<TMeta>>;
|
|
@@ -22,8 +22,10 @@ interface UseDrawSessionParams<TMeta> {
|
|
|
22
22
|
onDraftShapeChange?: (shape: Pick<EditorShape<TMeta>, "type" | "points" | "meta"> | null) => void;
|
|
23
23
|
changeSelection: (ids: string[]) => void;
|
|
24
24
|
createShape: (type: EditorShape<TMeta>["type"], points: Point[]) => void;
|
|
25
|
+
/** 확정하려는데 draft 스타일이 없을 때(그리는 도중 호스트가 해제) 호출. 초안은 남긴다. */
|
|
26
|
+
onDrawAttemptWithoutDraft?: () => void;
|
|
25
27
|
}
|
|
26
|
-
export declare function useDrawSession<TMeta>({ toolRef, selRef, docRef, readOnlyRef, draftRef, brushSizeRef, simplifyEpsilonRef, draftMeta, engineRef, onDrawSessionChange, onDraftShapeChange, changeSelection, createShape, }: UseDrawSessionParams<TMeta>): {
|
|
28
|
+
export declare function useDrawSession<TMeta>({ toolRef, selRef, docRef, readOnlyRef, draftRef, brushSizeRef, simplifyEpsilonRef, draftMeta, engineRef, onDrawSessionChange, onDraftShapeChange, changeSelection, createShape, onDrawAttemptWithoutDraft, }: UseDrawSessionParams<TMeta>): {
|
|
27
29
|
reset: () => void;
|
|
28
30
|
undoSession: () => boolean;
|
|
29
31
|
redoSession: () => boolean;
|
|
@@ -37,6 +39,7 @@ export declare function useDrawSession<TMeta>({ toolRef, selRef, docRef, readOnl
|
|
|
37
39
|
getBrushScalarMode: () => BrushScalarMode;
|
|
38
40
|
hasBrushSession: () => boolean;
|
|
39
41
|
commitBrush: () => boolean;
|
|
42
|
+
syncBrushTargets: () => void;
|
|
40
43
|
cancelBrush: () => void;
|
|
41
44
|
beginBrushEditFromSelection: () => boolean;
|
|
42
45
|
deleteDraftSelectedPoints: () => boolean;
|