@iyulab/components 0.1.10 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/assets/icons/arrow-repeat.svg.js +3 -0
- package/dist/assets/icons/box-arrow-up-right.svg.js +3 -0
- package/dist/assets/icons/file-earmark.svg.js +3 -0
- package/dist/assets/icons/flag.svg.js +3 -0
- package/dist/assets/icons/globe.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-down-fill.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-down.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-up-fill.svg.js +3 -0
- package/dist/assets/icons/hand-thumbs-up.svg.js +3 -0
- package/dist/assets/icons/share.svg.js +3 -0
- package/dist/assets/icons/stop-circle.svg.js +3 -0
- package/dist/assets/icons/tools.svg.js +3 -0
- package/dist/components/FloatingElement.d.ts +13 -5
- package/dist/components/FloatingElement.js +32 -15
- package/dist/components/FloatingElement.styles.js +0 -4
- package/dist/components/button/UButton.component.d.ts +7 -0
- package/dist/components/button/UButton.component.js +20 -1
- package/dist/components/button/UButton.styles.js +51 -8
- package/dist/components/dialog/UDialog.component.d.ts +2 -0
- package/dist/components/dialog/UDialog.component.js +14 -9
- package/dist/components/divider/UDivider.component.d.ts +3 -18
- package/dist/components/divider/UDivider.component.js +3 -62
- package/dist/components/divider/UDivider.styles.js +11 -43
- package/dist/components/drawer/UDrawer.component.d.ts +2 -0
- package/dist/components/drawer/UDrawer.component.js +14 -9
- package/dist/components/form/UForm.component.js +3 -3
- package/dist/components/icon/UIcon.component.d.ts +4 -1
- package/dist/components/icon/UIcon.component.js +2 -2
- package/dist/components/menu/UMenu.component.d.ts +4 -7
- package/dist/components/menu/UMenu.component.js +94 -83
- package/dist/components/menu/UMenu.styles.js +1 -1
- package/dist/components/menu-item/UMenuItem.component.d.ts +10 -4
- package/dist/components/menu-item/UMenuItem.component.js +37 -26
- package/dist/components/menu-item/UMenuItem.styles.js +4 -4
- package/dist/components/split-panel/USplitPanel.component.d.ts +22 -8
- package/dist/components/split-panel/USplitPanel.component.js +121 -75
- package/dist/components/split-panel/USplitPanel.styles.js +30 -0
- package/dist/components/tag/UTag.component.d.ts +23 -0
- package/dist/components/tag/UTag.component.js +72 -0
- package/dist/components/tag/UTag.d.ts +8 -0
- package/dist/components/tag/UTag.js +5 -0
- package/dist/components/tag/UTag.styles.js +83 -0
- package/dist/components/tooltip/UTooltip.component.d.ts +8 -0
- package/dist/components/tooltip/UTooltip.component.js +59 -17
- package/dist/components/tooltip/UTooltip.styles.js +15 -0
- package/dist/components/tree-item/UTreeItem.component.d.ts +16 -8
- package/dist/components/tree-item/UTreeItem.component.js +69 -31
- package/dist/components/tree-item/UTreeItem.styles.js +8 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -4
- package/dist/react-components/UTag.d.ts +8 -0
- package/dist/react-components/UTag.js +10 -0
- package/dist/react-components/index.d.ts +1 -1
- package/dist/react-components/index.js +1 -1
- package/dist/utilities/{icons.d.ts → IconRegistry.d.ts} +20 -26
- package/dist/utilities/{icons.js → IconRegistry.js} +29 -20
- package/dist/utilities/{notifier.d.ts → Notifier.d.ts} +8 -13
- package/dist/utilities/{notifier.js → Notifier.js} +8 -10
- package/dist/utilities/{theme.d.ts → Theme.d.ts} +14 -20
- package/dist/utilities/{theme.js → Theme.js} +39 -35
- package/dist/{internals/attribute-converters.d.ts → utilities/converters.d.ts} +1 -1
- package/dist/{internals/attribute-converters.js → utilities/converters.js} +2 -2
- package/dist/{internals/node-helpers.js → utilities/elements.js} +6 -5
- package/package.json +7 -7
- package/dist/assets/icons/arrow-clockwise.svg.js +0 -3
- package/dist/assets/icons/speedometer.svg.js +0 -3
- package/dist/components/icon-button/UIconButton.component.d.ts +0 -20
- package/dist/components/icon-button/UIconButton.component.js +0 -59
- package/dist/components/icon-button/UIconButton.d.ts +0 -7
- package/dist/components/icon-button/UIconButton.js +0 -5
- package/dist/components/icon-button/UIconButton.styles.js +0 -54
- package/dist/internals/react-wrapper.d.ts +0 -21
- package/dist/react-components/UIconButton.d.ts +0 -8
- package/dist/react-components/UIconButton.js +0 -10
- /package/dist/components/{icon-button/UIconButton.styles.d.ts → tag/UTag.styles.d.ts} +0 -0
- /package/dist/{internals/node-helpers.d.ts → utilities/elements.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 (2026-01-16)
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
- **Utilities**: Refactored utility class architecture to static-only pattern
|
|
7
|
+
- `IconRegistry`: Changed from singleton instance to static class (use `IconRegistry.register()` instead of `icons.register()`)
|
|
8
|
+
- `Notifier`: Changed from singleton instance to static class (use `Notifier.toast()` instead of `notifier.toast()`)
|
|
9
|
+
- `Theme`: Changed from singleton instance to static class (use `Theme.init()` instead of `theme.init()`)
|
|
10
|
+
- **IconButton**: Removed `UIconButton` component (use `UButton` with icon slot instead)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
- **UTag**: Added new Tag component for displaying labels, categories, and status
|
|
14
|
+
- Supports variants: `default`, `info`, `success`, `warning`, `danger`
|
|
15
|
+
- Removable tag functionality with smooth animation
|
|
16
|
+
- Prefix/suffix slots for custom content
|
|
17
|
+
- **UButton**: Added `variant` property with support for `default`, `borderless`, and `link` styles
|
|
18
|
+
- **UTooltip**: Added `interactive` property for keeping tooltip open when hovering over it
|
|
19
|
+
- **Icons**: Added new icon assets
|
|
20
|
+
- `arrow-repeat`, `box-arrow-up-right`, `file-earmark`, `flag`, `globe`
|
|
21
|
+
- `hand-thumbs-up`, `hand-thumbs-up-fill`, `hand-thumbs-down`, `hand-thumbs-down-fill`
|
|
22
|
+
- `share`, `stop-circle`, `tools`
|
|
23
|
+
- **Utilities**: Added new utility functions
|
|
24
|
+
- `converters.ts`: `arrayAttrConverter()` for array attribute conversion
|
|
25
|
+
- `elements.ts`: DOM helper functions (`getParentElement`, `querySelectorWithin`, `querySelectorAllWithin`)
|
|
26
|
+
|
|
27
|
+
### Improvements
|
|
28
|
+
- **FloatingElement**: Enhanced positioning and anchor management logic
|
|
29
|
+
- **UButton**: Improved click event handling for disabled and loading states
|
|
30
|
+
- **UDialog/UDrawer**: Updated to use improved modal element patterns
|
|
31
|
+
- **UMenu**: Refactored submenu handling and dropdown logic
|
|
32
|
+
- **IconRegistry**: Reorganized and improved icon loading architecture
|
|
33
|
+
- **Utilities**: Moved internal utilities to public utilities directory
|
|
34
|
+
- `internals/attribute-converters.ts` → `utilities/converters.ts`
|
|
35
|
+
- `internals/node-helpers.ts` → `utilities/elements.ts`
|
|
36
|
+
- `utilities/icons.ts` → `utilities/IconRegistry.ts`
|
|
37
|
+
|
|
38
|
+
## 0.1.11 (2026-01-06)
|
|
39
|
+
|
|
40
|
+
### Fixes
|
|
41
|
+
- Fixed d.ts generation error for `Theme` class by exporting the class
|
|
42
|
+
|
|
43
|
+
### Features
|
|
44
|
+
- **UTreeItem**: Added `loading` property with spinner indicator
|
|
45
|
+
- **UTreeItem**: Added MutationObserver for dynamic child loading support
|
|
46
|
+
- **UMenuItem**: Added `loading` property with spinner indicator
|
|
47
|
+
|
|
48
|
+
### Improvements
|
|
49
|
+
- **UDivider**: Simplified component (removed movable functionality)
|
|
50
|
+
- **USplitPanel**: Completely rewritten with native splitter implementation
|
|
51
|
+
- **UMenu/UMenuItem**: Refactored submenu handling logic
|
|
52
|
+
- **UTreeItem**: Improved children slot handling with `processChildren` method
|
|
53
|
+
- **UTreeItem**: Changed indent styling to use CSS custom property (`--indent-level`)
|
|
54
|
+
|
|
3
55
|
## 0.1.10 (2025-12-19)
|
|
4
56
|
- Fixed circular dependency issue between `UMenu` and `UMenuItem`
|
|
5
57
|
- Changed `UMenuItem` to use tagName check instead of `instanceof` for submenu detection
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const arrowRepeat = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41m-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9\"/>\n <path fill-rule=\"evenodd\" d=\"M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5 5 0 0 0 8 3M3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { arrowRepeat as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const boxArrowUpRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5\"/>\n <path fill-rule=\"evenodd\" d=\"M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { boxArrowUpRight as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const fileEarmark = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { fileEarmark as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const flag = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M14.778.085A.5.5 0 0 1 15 .5V8a.5.5 0 0 1-.314.464L14.5 8l.186.464-.003.001-.006.003-.023.009a12 12 0 0 1-.397.15c-.264.095-.631.223-1.047.35-.816.252-1.879.523-2.71.523-.847 0-1.548-.28-2.158-.525l-.028-.01C7.68 8.71 7.14 8.5 6.5 8.5c-.7 0-1.638.23-2.437.477A20 20 0 0 0 3 9.342V15.5a.5.5 0 0 1-1 0V.5a.5.5 0 0 1 1 0v.282c.226-.079.496-.17.79-.26C4.606.272 5.67 0 6.5 0c.84 0 1.524.277 2.121.519l.043.018C9.286.788 9.828 1 10.5 1c.7 0 1.638-.23 2.437-.477a20 20 0 0 0 1.349-.476l.019-.007.004-.002h.001M14 1.221c-.22.078-.48.167-.766.255-.81.252-1.872.523-2.734.523-.886 0-1.592-.286-2.203-.534l-.008-.003C7.662 1.21 7.139 1 6.5 1c-.669 0-1.606.229-2.415.478A21 21 0 0 0 3 1.845v6.433c.22-.078.48-.167.766-.255C4.576 7.77 5.638 7.5 6.5 7.5c.847 0 1.548.28 2.158.525l.028.01C9.32 8.29 9.86 8.5 10.5 8.5c.668 0 1.606-.229 2.415-.478A21 21 0 0 0 14 7.655V1.222z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { flag as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const globe = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8m7.5-6.923c-.67.204-1.335.82-1.887 1.855A8 8 0 0 0 5.145 4H7.5zM4.09 4a9.3 9.3 0 0 1 .64-1.539 7 7 0 0 1 .597-.933A7.03 7.03 0 0 0 2.255 4zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a7 7 0 0 0-.656 2.5zM4.847 5a12.5 12.5 0 0 0-.338 2.5H7.5V5zM8.5 5v2.5h2.99a12.5 12.5 0 0 0-.337-2.5zM4.51 8.5a12.5 12.5 0 0 0 .337 2.5H7.5V8.5zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5zM5.145 12q.208.58.468 1.068c.552 1.035 1.218 1.65 1.887 1.855V12zm.182 2.472a7 7 0 0 1-.597-.933A9.3 9.3 0 0 1 4.09 12H2.255a7 7 0 0 0 3.072 2.472M3.82 11a13.7 13.7 0 0 1-.312-2.5h-2.49c.062.89.291 1.733.656 2.5zm6.853 3.472A7 7 0 0 0 13.745 12H11.91a9.3 9.3 0 0 1-.64 1.539 7 7 0 0 1-.597.933M8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855q.26-.487.468-1.068zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.7 13.7 0 0 1-.312 2.5m2.802-3.5a7 7 0 0 0-.656-2.5H12.18c.174.782.282 1.623.312 2.5zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7 7 0 0 0-3.072-2.472c.218.284.418.598.597.933M10.855 4a8 8 0 0 0-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { globe as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const handThumbsDownFill = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M6.956 14.534c.065.936.952 1.659 1.908 1.42l.261-.065a1.38 1.38 0 0 0 1.012-.965c.22-.816.533-2.512.062-4.51q.205.03.443.051c.713.065 1.669.071 2.516-.211.518-.173.994-.68 1.2-1.272a1.9 1.9 0 0 0-.234-1.734c.058-.118.103-.242.138-.362.077-.27.113-.568.113-.856 0-.29-.036-.586-.113-.857a2 2 0 0 0-.16-.403c.169-.387.107-.82-.003-1.149a3.2 3.2 0 0 0-.488-.9c.054-.153.076-.313.076-.465a1.86 1.86 0 0 0-.253-.912C13.1.757 12.437.28 11.5.28H8c-.605 0-1.07.08-1.466.217a4.8 4.8 0 0 0-.97.485l-.048.029c-.504.308-.999.61-2.068.723C2.682 1.815 2 2.434 2 3.279v4c0 .851.685 1.433 1.357 1.616.849.232 1.574.787 2.132 1.41.56.626.914 1.28 1.039 1.638.199.575.356 1.54.428 2.591\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { handThumbsDownFill as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const handThumbsDown = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8.864 15.674c-.956.24-1.843-.484-1.908-1.42-.072-1.05-.23-2.015-.428-2.59-.125-.36-.479-1.012-1.04-1.638-.557-.624-1.282-1.179-2.131-1.41C2.685 8.432 2 7.85 2 7V3c0-.845.682-1.464 1.448-1.546 1.07-.113 1.564-.415 2.068-.723l.048-.029c.272-.166.578-.349.97-.484C6.931.08 7.395 0 8 0h3.5c.937 0 1.599.478 1.934 1.064.164.287.254.607.254.913 0 .152-.023.312-.077.464.201.262.38.577.488.9.11.33.172.762.004 1.15.069.13.12.268.159.403.077.27.113.567.113.856s-.036.586-.113.856c-.035.12-.08.244-.138.363.394.571.418 1.2.234 1.733-.206.592-.682 1.1-1.2 1.272-.847.283-1.803.276-2.516.211a10 10 0 0 1-.443-.05 9.36 9.36 0 0 1-.062 4.51c-.138.508-.55.848-1.012.964zM11.5 1H8c-.51 0-.863.068-1.14.163-.281.097-.506.229-.776.393l-.04.025c-.555.338-1.198.73-2.49.868-.333.035-.554.29-.554.55V7c0 .255.226.543.62.65 1.095.3 1.977.997 2.614 1.709.635.71 1.064 1.475 1.238 1.977.243.7.407 1.768.482 2.85.025.362.36.595.667.518l.262-.065c.16-.04.258-.144.288-.255a8.34 8.34 0 0 0-.145-4.726.5.5 0 0 1 .595-.643h.003l.014.004.058.013a9 9 0 0 0 1.036.157c.663.06 1.457.054 2.11-.163.175-.059.45-.301.57-.651.107-.308.087-.67-.266-1.021L12.793 7l.353-.354c.043-.042.105-.14.154-.315.048-.167.075-.37.075-.581s-.027-.414-.075-.581c-.05-.174-.111-.273-.154-.315l-.353-.354.353-.354c.047-.047.109-.176.005-.488a2.2 2.2 0 0 0-.505-.804l-.353-.354.353-.354c.006-.005.041-.05.041-.17a.9.9 0 0 0-.121-.415C12.4 1.272 12.063 1 11.5 1\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { handThumbsDown as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const handThumbsUpFill = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M6.956 1.745C7.021.81 7.908.087 8.864.325l.261.066c.463.116.874.456 1.012.965.22.816.533 2.511.062 4.51a10 10 0 0 1 .443-.051c.713-.065 1.669-.072 2.516.21.518.173.994.681 1.2 1.273.184.532.16 1.162-.234 1.733q.086.18.138.363c.077.27.113.567.113.856s-.036.586-.113.856c-.039.135-.09.273-.16.404.169.387.107.819-.003 1.148a3.2 3.2 0 0 1-.488.901c.054.152.076.312.076.465 0 .305-.089.625-.253.912C13.1 15.522 12.437 16 11.5 16H8c-.605 0-1.07-.081-1.466-.218a4.8 4.8 0 0 1-.97-.484l-.048-.03c-.504-.307-.999-.609-2.068-.722C2.682 14.464 2 13.846 2 13V9c0-.85.685-1.432 1.357-1.615.849-.232 1.574-.787 2.132-1.41.56-.627.914-1.28 1.039-1.639.199-.575.356-1.539.428-2.59z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { handThumbsUpFill as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const handThumbsUp = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8.864.046C7.908-.193 7.02.53 6.956 1.466c-.072 1.051-.23 2.016-.428 2.59-.125.36-.479 1.013-1.04 1.639-.557.623-1.282 1.178-2.131 1.41C2.685 7.288 2 7.87 2 8.72v4.001c0 .845.682 1.464 1.448 1.545 1.07.114 1.564.415 2.068.723l.048.03c.272.165.578.348.97.484.397.136.861.217 1.466.217h3.5c.937 0 1.599-.477 1.934-1.064a1.86 1.86 0 0 0 .254-.912c0-.152-.023-.312-.077-.464.201-.263.38-.578.488-.901.11-.33.172-.762.004-1.149.069-.13.12-.269.159-.403.077-.27.113-.568.113-.857 0-.288-.036-.585-.113-.856a2 2 0 0 0-.138-.362 1.9 1.9 0 0 0 .234-1.734c-.206-.592-.682-1.1-1.2-1.272-.847-.282-1.803-.276-2.516-.211a10 10 0 0 0-.443.05 9.4 9.4 0 0 0-.062-4.509A1.38 1.38 0 0 0 9.125.111zM11.5 14.721H8c-.51 0-.863-.069-1.14-.164-.281-.097-.506-.228-.776-.393l-.04-.024c-.555-.339-1.198-.731-2.49-.868-.333-.036-.554-.29-.554-.55V8.72c0-.254.226-.543.62-.65 1.095-.3 1.977-.996 2.614-1.708.635-.71 1.064-1.475 1.238-1.978.243-.7.407-1.768.482-2.85.025-.362.36-.594.667-.518l.262.066c.16.04.258.143.288.255a8.34 8.34 0 0 1-.145 4.725.5.5 0 0 0 .595.644l.003-.001.014-.003.058-.014a9 9 0 0 1 1.036-.157c.663-.06 1.457-.054 2.11.164.175.058.45.3.57.65.107.308.087.67-.266 1.022l-.353.353.353.354c.043.043.105.141.154.315.048.167.075.37.075.581 0 .212-.027.414-.075.582-.05.174-.111.272-.154.315l-.353.353.353.354c.047.047.109.177.005.488a2.2 2.2 0 0 1-.505.805l-.353.353.353.354c.006.005.041.05.041.17a.9.9 0 0 1-.121.416c-.165.288-.503.56-1.066.56z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { handThumbsUp as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const share = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M13.5 1a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3M11 2.5a2.5 2.5 0 1 1 .603 1.628l-6.718 3.12a2.5 2.5 0 0 1 0 1.504l6.718 3.12a2.5 2.5 0 1 1-.488.876l-6.718-3.12a2.5 2.5 0 1 1 0-3.256l6.718-3.12A2.5 2.5 0 0 1 11 2.5m-8.5 4a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m11 5.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { share as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const stopCircle = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16\"/>\n <path d=\"M5 6.5A1.5 1.5 0 0 1 6.5 5h3A1.5 1.5 0 0 1 11 6.5v3A1.5 1.5 0 0 1 9.5 11h-3A1.5 1.5 0 0 1 5 9.5z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { stopCircle as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const tools = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M1 0 0 1l2.2 3.081a1 1 0 0 0 .815.419h.07a1 1 0 0 1 .708.293l2.675 2.675-2.617 2.654A3.003 3.003 0 0 0 0 13a3 3 0 1 0 5.878-.851l2.654-2.617.968.968-.305.914a1 1 0 0 0 .242 1.023l3.27 3.27a.997.997 0 0 0 1.414 0l1.586-1.586a.997.997 0 0 0 0-1.414l-3.27-3.27a1 1 0 0 0-1.023-.242L10.5 9.5l-.96-.96 2.68-2.643A3.005 3.005 0 0 0 16 3q0-.405-.102-.777l-2.14 2.141L12 4l-.364-1.757L13.777.102a3 3 0 0 0-3.675 3.68L7.462 6.46 4.793 3.793a1 1 0 0 1-.293-.707v-.071a1 1 0 0 0-.419-.814zm9.646 10.646a.5.5 0 0 1 .708 0l2.914 2.915a.5.5 0 0 1-.707.707l-2.915-2.914a.5.5 0 0 1 0-.708M3 11l.471.242.529.026.287.445.445.287.026.529L5 13l-.242.471-.026.529-.445.287-.287.445-.529.026L3 15l-.471-.242L2 14.732l-.287-.445L1.268 14l-.026-.529L1 13l.242-.471.026-.529.445-.287.287-.445.529-.026z\"/>\n</svg>";
|
|
2
|
+
|
|
3
|
+
export { tools as default };
|
|
@@ -18,9 +18,13 @@ export declare class FloatingElement extends BaseElement {
|
|
|
18
18
|
private rafId;
|
|
19
19
|
private cleanup;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 엘리먼트가 떠 있는 동안의 대상 엘리먼트 입니다.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
target?: HTMLElement | VirtualElement;
|
|
24
|
+
/**
|
|
25
|
+
* 연결될 대상 엘리먼트 입니다. 지정하지 않으면 부모 엘리먼트가 포함됩니다.
|
|
26
|
+
*/
|
|
27
|
+
anchors?: HTMLElement[];
|
|
24
28
|
/**
|
|
25
29
|
* 앵커 엘리먼트를 찾기 위한 CSS 선택자입니다. querySelector를 사용하여 DOM에서 대상을 검색합니다.
|
|
26
30
|
*
|
|
@@ -72,13 +76,17 @@ export declare class FloatingElement extends BaseElement {
|
|
|
72
76
|
disconnectedCallback(): void;
|
|
73
77
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
74
78
|
protected updated(changedProperties: PropertyValues): void;
|
|
79
|
+
/**
|
|
80
|
+
* for 속성에 따라 element를 기준으로 앵커 엘리먼트를 탐색하여 anchors로 설정합니다.
|
|
81
|
+
*/
|
|
82
|
+
scan(element: Element): void;
|
|
75
83
|
/**
|
|
76
84
|
* 현재 엘리먼트를 표시합니다.
|
|
77
85
|
*
|
|
78
|
-
* @param
|
|
86
|
+
* @param target - 위치 계산에 사용할 타겟 엘리먼트입니다.
|
|
79
87
|
* @param auto - 표시 후 자동 위치 업데이트 활성화 여부입니다. 기본값은 true 입니다.
|
|
80
88
|
*/
|
|
81
|
-
show(
|
|
89
|
+
show(target: Element | VirtualElement, auto?: boolean): Promise<void>;
|
|
82
90
|
/**
|
|
83
91
|
* 현재 엘리먼트를 숨깁니다.
|
|
84
92
|
*/
|
|
@@ -86,7 +94,7 @@ export declare class FloatingElement extends BaseElement {
|
|
|
86
94
|
/**
|
|
87
95
|
* `floating-ui` 를 이용하여 위치를 계산하고 style 을 적용합니다.
|
|
88
96
|
*
|
|
89
|
-
* @param target - 위치 계산에 사용할
|
|
97
|
+
* @param target - 위치 계산에 사용할 타겟 엘리먼트입니다.
|
|
90
98
|
*/
|
|
91
99
|
protected reposition(target: Element | VirtualElement): Promise<void>;
|
|
92
100
|
/** 표시 상태 변경 이벤트를 발생시킵니다. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { state, property } from 'lit/decorators.js';
|
|
2
2
|
import { autoUpdate, computePosition, offset, shift, flip, autoPlacement } from '@floating-ui/dom';
|
|
3
|
-
import { getParentElement,
|
|
3
|
+
import { getParentElement, querySelectorAllWithin } from '../utilities/elements.js';
|
|
4
4
|
import { BaseElement } from './BaseElement.js';
|
|
5
5
|
import { styles } from './FloatingElement.styles.js';
|
|
6
6
|
|
|
@@ -36,7 +36,10 @@ class FloatingElement extends BaseElement {
|
|
|
36
36
|
}
|
|
37
37
|
connectedCallback() {
|
|
38
38
|
super.connectedCallback();
|
|
39
|
-
this.
|
|
39
|
+
if (!this.anchors || this.anchors.length === 0) {
|
|
40
|
+
const parent = getParentElement(this);
|
|
41
|
+
this.anchors = parent ? [parent] : [];
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
disconnectedCallback() {
|
|
42
45
|
if (this.rafId !== null) cancelAnimationFrame(this.rafId);
|
|
@@ -48,35 +51,45 @@ class FloatingElement extends BaseElement {
|
|
|
48
51
|
willUpdate(changedProperties) {
|
|
49
52
|
super.willUpdate(changedProperties);
|
|
50
53
|
if (changedProperties.has("for")) {
|
|
51
|
-
|
|
52
|
-
this.anchor = founded || void 0;
|
|
54
|
+
this.scan(this);
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
updated(changedProperties) {
|
|
56
58
|
super.updated(changedProperties);
|
|
57
59
|
if (changedProperties.has("visible")) {
|
|
58
|
-
this.toggleAttribute("inert", !this.visible);
|
|
59
60
|
this.toggleAttribute("aria-hidden", !this.visible);
|
|
61
|
+
this.toggleAttribute("inert", !this.visible);
|
|
60
62
|
this.updateVisibleState(this.visible);
|
|
61
63
|
}
|
|
62
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* for 속성에 따라 element를 기준으로 앵커 엘리먼트를 탐색하여 anchors로 설정합니다.
|
|
67
|
+
*/
|
|
68
|
+
scan(element) {
|
|
69
|
+
if (this.for) {
|
|
70
|
+
const anchors = querySelectorAllWithin(element, this.for);
|
|
71
|
+
this.anchors = Array.from(anchors);
|
|
72
|
+
} else {
|
|
73
|
+
const parent = getParentElement(this);
|
|
74
|
+
this.anchors = parent ? [parent] : [];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
63
77
|
/**
|
|
64
78
|
* 현재 엘리먼트를 표시합니다.
|
|
65
79
|
*
|
|
66
|
-
* @param
|
|
80
|
+
* @param target - 위치 계산에 사용할 타겟 엘리먼트입니다.
|
|
67
81
|
* @param auto - 표시 후 자동 위치 업데이트 활성화 여부입니다. 기본값은 true 입니다.
|
|
68
82
|
*/
|
|
69
|
-
async show(
|
|
70
|
-
anchor ||= this.anchor;
|
|
71
|
-
if (!anchor) return;
|
|
83
|
+
async show(target, auto = true) {
|
|
72
84
|
await this.updateComplete;
|
|
73
|
-
await this.reposition(
|
|
85
|
+
await this.reposition(target);
|
|
74
86
|
if (auto === true) {
|
|
75
|
-
this.cleanup = autoUpdate(
|
|
76
|
-
this.reposition(
|
|
87
|
+
this.cleanup = autoUpdate(target, this, () => {
|
|
88
|
+
this.reposition(target);
|
|
77
89
|
});
|
|
78
90
|
}
|
|
79
91
|
this.scheduleVisible(true);
|
|
92
|
+
this.target = target;
|
|
80
93
|
}
|
|
81
94
|
/**
|
|
82
95
|
* 현재 엘리먼트를 숨깁니다.
|
|
@@ -86,11 +99,12 @@ class FloatingElement extends BaseElement {
|
|
|
86
99
|
if (this.cleanup !== null) this.cleanup();
|
|
87
100
|
this.cleanup = null;
|
|
88
101
|
this.scheduleVisible(false);
|
|
102
|
+
this.target = void 0;
|
|
89
103
|
}
|
|
90
104
|
/**
|
|
91
105
|
* `floating-ui` 를 이용하여 위치를 계산하고 style 을 적용합니다.
|
|
92
106
|
*
|
|
93
|
-
* @param target - 위치 계산에 사용할
|
|
107
|
+
* @param target - 위치 계산에 사용할 타겟 엘리먼트입니다.
|
|
94
108
|
*/
|
|
95
109
|
async reposition(target) {
|
|
96
110
|
const position = await computePosition(target, this, {
|
|
@@ -152,9 +166,12 @@ class FloatingElement extends BaseElement {
|
|
|
152
166
|
}
|
|
153
167
|
__decorateClass([
|
|
154
168
|
state()
|
|
155
|
-
], FloatingElement.prototype, "
|
|
169
|
+
], FloatingElement.prototype, "target");
|
|
156
170
|
__decorateClass([
|
|
157
|
-
|
|
171
|
+
state()
|
|
172
|
+
], FloatingElement.prototype, "anchors");
|
|
173
|
+
__decorateClass([
|
|
174
|
+
property({ type: String, reflect: true })
|
|
158
175
|
], FloatingElement.prototype, "for");
|
|
159
176
|
__decorateClass([
|
|
160
177
|
property({ type: Boolean, reflect: true })
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseElement } from '../BaseElement.js';
|
|
2
|
+
export type ButtonVariant = "default" | "borderless" | "link";
|
|
2
3
|
/**
|
|
3
4
|
* Button 컴포넌트는 클릭 가능한 버튼을 나타내며, 로딩 상태와 툴팁 기능을 지원합니다.
|
|
4
5
|
* @slot - 버튼 내부에 표시할 콘텐츠를 삽입합니다.
|
|
@@ -8,9 +9,15 @@ import { BaseElement } from '../BaseElement.js';
|
|
|
8
9
|
export declare class UButton extends BaseElement {
|
|
9
10
|
static styles: import('lit').CSSResultGroup[];
|
|
10
11
|
static dependencies: Record<string, typeof BaseElement>;
|
|
12
|
+
/** 버튼의 스타일 변형을 설정합니다. */
|
|
13
|
+
variant: ButtonVariant;
|
|
11
14
|
/** 버튼이 비활성화 상태인지 여부를 설정합니다. 비활성화된 버튼은 클릭할 수 없습니다. */
|
|
12
15
|
disabled: boolean;
|
|
13
16
|
/** 버튼이 로딩 상태인지 여부를 설정합니다. 로딩 중에는 버튼이 비활성화되고 스피너가 표시됩니다. */
|
|
14
17
|
loading: boolean;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
15
20
|
render(): import('lit-html').TemplateResult<1>;
|
|
21
|
+
/** 클릭 이벤트 컨트롤 */
|
|
22
|
+
private handleClick;
|
|
16
23
|
}
|
|
@@ -16,8 +16,16 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
16
16
|
class UButton extends BaseElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
+
this.variant = "default";
|
|
19
20
|
this.disabled = false;
|
|
20
21
|
this.loading = false;
|
|
22
|
+
/** 클릭 이벤트 컨트롤 */
|
|
23
|
+
this.handleClick = (e) => {
|
|
24
|
+
if (this.disabled || this.loading) {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
e.stopImmediatePropagation();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
21
29
|
}
|
|
22
30
|
static {
|
|
23
31
|
this.styles = [super.styles, styles];
|
|
@@ -27,6 +35,14 @@ class UButton extends BaseElement {
|
|
|
27
35
|
"u-spinner": USpinner
|
|
28
36
|
};
|
|
29
37
|
}
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
this.addEventListener("click", this.handleClick);
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
this.removeEventListener("click", this.handleClick);
|
|
44
|
+
super.disconnectedCallback();
|
|
45
|
+
}
|
|
30
46
|
render() {
|
|
31
47
|
return html`
|
|
32
48
|
<button part="base"
|
|
@@ -36,13 +52,16 @@ class UButton extends BaseElement {
|
|
|
36
52
|
<slot name="suffix"></slot>
|
|
37
53
|
</button>
|
|
38
54
|
|
|
39
|
-
<div class="
|
|
55
|
+
<div class="mask" part="mask"
|
|
40
56
|
?hidden=${!this.loading}>
|
|
41
57
|
<u-spinner></u-spinner>
|
|
42
58
|
</div>
|
|
43
59
|
`;
|
|
44
60
|
}
|
|
45
61
|
}
|
|
62
|
+
__decorateClass([
|
|
63
|
+
property({ type: String, reflect: true })
|
|
64
|
+
], UButton.prototype, "variant");
|
|
46
65
|
__decorateClass([
|
|
47
66
|
property({ type: Boolean, reflect: true })
|
|
48
67
|
], UButton.prototype, "disabled");
|
|
@@ -8,7 +8,7 @@ const styles = css`
|
|
|
8
8
|
font-size: 14px;
|
|
9
9
|
font-weight: 500;
|
|
10
10
|
line-height: 1.5;
|
|
11
|
-
padding: 0.5em
|
|
11
|
+
padding: 0.5em;
|
|
12
12
|
border: 1px solid var(--u-border-color);
|
|
13
13
|
border-radius: 6px;
|
|
14
14
|
background-color: var(--u-bg-color);
|
|
@@ -18,19 +18,57 @@ const styles = css`
|
|
|
18
18
|
user-select: none;
|
|
19
19
|
cursor: pointer;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
/* Style variants */
|
|
23
|
+
:host([variant="default"]) {
|
|
24
|
+
color: var(--u-txt-color);
|
|
25
|
+
border-color: var(--u-border-color);
|
|
26
|
+
background-color: var(--u-bg-color);
|
|
27
|
+
}
|
|
28
|
+
:host([variant="default"]:hover) {
|
|
23
29
|
background-color: var(--u-bg-color-hover);
|
|
24
30
|
}
|
|
25
|
-
:host(:active) {
|
|
26
|
-
color: var(--u-
|
|
31
|
+
:host([variant="default"]:active) {
|
|
32
|
+
background-color: var(--u-bg-color-active);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([variant="borderless"]) {
|
|
36
|
+
color: var(--u-txt-color);
|
|
37
|
+
border-color: transparent;
|
|
38
|
+
background-color: transparent;
|
|
39
|
+
}
|
|
40
|
+
:host([variant="borderless"]:hover) {
|
|
41
|
+
background-color: var(--u-bg-color-hover);
|
|
42
|
+
}
|
|
43
|
+
:host([variant="borderless"]:active) {
|
|
27
44
|
background-color: var(--u-bg-color-active);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([variant="link"]) {
|
|
48
|
+
color: var(--u-txt-color);
|
|
49
|
+
border-color: transparent;
|
|
50
|
+
background-color: transparent;
|
|
51
|
+
}
|
|
52
|
+
:host([variant="link"]:hover) {
|
|
53
|
+
color: var(--u-blue-500, #3b82f6);
|
|
54
|
+
}
|
|
55
|
+
:host([variant="link"]:active) {
|
|
56
|
+
color: var(--u-blue-600, #2563eb);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host(:active) {
|
|
28
60
|
transform: translateY(1px);
|
|
29
61
|
}
|
|
30
|
-
|
|
62
|
+
|
|
31
63
|
:host([disabled]) {
|
|
32
64
|
color: var(--u-txt-color-disabled);
|
|
33
|
-
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
}
|
|
67
|
+
:host([loading]) {
|
|
68
|
+
cursor: wait;
|
|
69
|
+
}
|
|
70
|
+
:host([loading]) button {
|
|
71
|
+
visibility: hidden;
|
|
34
72
|
}
|
|
35
73
|
|
|
36
74
|
button {
|
|
@@ -52,6 +90,10 @@ const styles = css`
|
|
|
52
90
|
display: inline-flex;
|
|
53
91
|
justify-content: center;
|
|
54
92
|
}
|
|
93
|
+
::slotted(*) {
|
|
94
|
+
color: inherit;
|
|
95
|
+
font-size: inherit;
|
|
96
|
+
}
|
|
55
97
|
/* 슬롯에 내용이 있을 때 gap 적용 */
|
|
56
98
|
::slotted([slot="prefix"]) {
|
|
57
99
|
margin-right: 0.5em;
|
|
@@ -60,7 +102,7 @@ const styles = css`
|
|
|
60
102
|
margin-left: 0.5em;
|
|
61
103
|
}
|
|
62
104
|
|
|
63
|
-
.
|
|
105
|
+
.mask {
|
|
64
106
|
position: absolute;
|
|
65
107
|
z-index: 100;
|
|
66
108
|
top: 0;
|
|
@@ -76,6 +118,7 @@ const styles = css`
|
|
|
76
118
|
font-size: inherit;
|
|
77
119
|
border-radius: inherit;
|
|
78
120
|
background-color: inherit;
|
|
121
|
+
pointer-events: none;
|
|
79
122
|
}
|
|
80
123
|
`;
|
|
81
124
|
|
|
@@ -7,6 +7,8 @@ import { ModalElement } from '../ModalElement.js';
|
|
|
7
7
|
export declare class UDialog extends ModalElement {
|
|
8
8
|
static styles: import('lit').CSSResultGroup[];
|
|
9
9
|
static dependencies: Record<string, typeof BaseElement>;
|
|
10
|
+
/** 헤드리스 모드 여부 */
|
|
11
|
+
headless: boolean;
|
|
10
12
|
/** 타이틀 텍스트 */
|
|
11
13
|
heading: string;
|
|
12
14
|
render(): import('lit-html').TemplateResult<1>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { html } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { ModalElement } from '../ModalElement.js';
|
|
4
|
-
import {
|
|
4
|
+
import { UIcon } from '../icon/UIcon.component.js';
|
|
5
|
+
import { UButton } from '../button/UButton.component.js';
|
|
5
6
|
import { styles } from './UDialog.styles.js';
|
|
6
7
|
|
|
7
8
|
var __defProp = Object.defineProperty;
|
|
@@ -16,6 +17,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
16
17
|
class UDialog extends ModalElement {
|
|
17
18
|
constructor() {
|
|
18
19
|
super(...arguments);
|
|
20
|
+
this.headless = false;
|
|
19
21
|
this.heading = "";
|
|
20
22
|
}
|
|
21
23
|
static {
|
|
@@ -23,22 +25,22 @@ class UDialog extends ModalElement {
|
|
|
23
25
|
}
|
|
24
26
|
static {
|
|
25
27
|
this.dependencies = {
|
|
26
|
-
"u-icon
|
|
28
|
+
"u-icon": UIcon,
|
|
29
|
+
"u-button": UButton
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
render() {
|
|
30
33
|
return html`
|
|
31
34
|
<div class="dialog" part="base" ?open=${this.open}>
|
|
32
|
-
<div class="header" part="header" ?hidden=${
|
|
35
|
+
<div class="header" part="header" ?hidden=${this.headless}>
|
|
33
36
|
<span class="title" part="title">
|
|
34
37
|
${this.heading}
|
|
35
38
|
</span>
|
|
36
|
-
<u-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
name="x-lg"
|
|
40
|
-
|
|
41
|
-
></u-icon-button>
|
|
39
|
+
<u-button class="close-btn" part="close-btn"
|
|
40
|
+
variant="link"
|
|
41
|
+
@click=${() => this.hide()}>
|
|
42
|
+
<u-icon lib="internal" name="x-lg"></u-icon>
|
|
43
|
+
</u-button>
|
|
42
44
|
</div>
|
|
43
45
|
|
|
44
46
|
<div class="content" part="content" scrollable>
|
|
@@ -58,6 +60,9 @@ class UDialog extends ModalElement {
|
|
|
58
60
|
}, 500);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
63
|
+
__decorateClass([
|
|
64
|
+
property({ type: Boolean, reflect: true })
|
|
65
|
+
], UDialog.prototype, "headless");
|
|
61
66
|
__decorateClass([
|
|
62
67
|
property({ type: String })
|
|
63
68
|
], UDialog.prototype, "heading");
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import { nothing } from 'lit';
|
|
2
1
|
import { BaseElement } from '../BaseElement.js';
|
|
3
2
|
/**
|
|
4
|
-
* Divider 컴포넌트는 엘리먼트 사이에
|
|
3
|
+
* Divider 컴포넌트는 엘리먼트 사이에 구분선을 제공합니다.
|
|
5
4
|
*/
|
|
6
5
|
export declare class UDivider extends BaseElement {
|
|
7
6
|
static styles: import('lit').CSSResultGroup[];
|
|
8
7
|
static dependencies: Record<string, typeof BaseElement>;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
/** 분할선이 움직이는지 여부를 나타냅니다. */
|
|
12
|
-
moving: boolean;
|
|
13
|
-
/** 분할 방향을 설정합니다. */
|
|
14
|
-
orientation: 'horizontal' | 'vertical';
|
|
15
|
-
/** 분할선을 움직일 수 있는지 여부를 설정합니다. */
|
|
16
|
-
movable: boolean;
|
|
17
|
-
disconnectedCallback(): void;
|
|
18
|
-
render(): typeof nothing | import('lit-html').TemplateResult<1>;
|
|
19
|
-
/** 마우스 다운 이벤트 핸들러 */
|
|
20
|
-
private handleMousedown;
|
|
21
|
-
/** 마우스 무브 이벤트 핸들러 */
|
|
22
|
-
private handleMousemove;
|
|
23
|
-
/** 마우스 업 이벤트 핸들러 */
|
|
24
|
-
private handleMouseup;
|
|
8
|
+
/** 수직 방향 여부를 설정합니다. (기본값: 수평) */
|
|
9
|
+
vertical: boolean;
|
|
25
10
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { state, property } from 'lit/decorators.js';
|
|
1
|
+
import { property } from 'lit/decorators.js';
|
|
3
2
|
import { BaseElement } from '../BaseElement.js';
|
|
4
3
|
import { styles } from './UDivider.styles.js';
|
|
5
4
|
|
|
@@ -15,41 +14,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
15
14
|
class UDivider extends BaseElement {
|
|
16
15
|
constructor() {
|
|
17
16
|
super(...arguments);
|
|
18
|
-
|
|
19
|
-
this.prevPointerPosition = 0;
|
|
20
|
-
this.moving = false;
|
|
21
|
-
this.orientation = "horizontal";
|
|
22
|
-
this.movable = false;
|
|
23
|
-
/** 마우스 다운 이벤트 핸들러 */
|
|
24
|
-
this.handleMousedown = (e) => {
|
|
25
|
-
e.preventDefault();
|
|
26
|
-
this.moving = true;
|
|
27
|
-
this.prevPointerPosition = this.orientation === "horizontal" ? e.clientX : e.clientY;
|
|
28
|
-
this.emit("u-movestart");
|
|
29
|
-
document.addEventListener("mousemove", this.handleMousemove);
|
|
30
|
-
document.addEventListener("mouseup", this.handleMouseup);
|
|
31
|
-
document.body.style.userSelect = "none";
|
|
32
|
-
document.body.style.cursor = this.orientation === "horizontal" ? "col-resize" : "row-resize";
|
|
33
|
-
};
|
|
34
|
-
/** 마우스 무브 이벤트 핸들러 */
|
|
35
|
-
this.handleMousemove = (e) => {
|
|
36
|
-
if (!this.moving) return;
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
const currentPointerPosition = this.orientation === "horizontal" ? e.clientX : e.clientY;
|
|
39
|
-
const delta = currentPointerPosition - this.prevPointerPosition;
|
|
40
|
-
this.emit("u-move", { delta });
|
|
41
|
-
this.prevPointerPosition = currentPointerPosition;
|
|
42
|
-
};
|
|
43
|
-
/** 마우스 업 이벤트 핸들러 */
|
|
44
|
-
this.handleMouseup = (_) => {
|
|
45
|
-
if (!this.moving) return;
|
|
46
|
-
this.moving = false;
|
|
47
|
-
this.emit("u-moveend");
|
|
48
|
-
document.removeEventListener("mousemove", this.handleMousemove);
|
|
49
|
-
document.removeEventListener("mouseup", this.handleMouseup);
|
|
50
|
-
document.body.style.userSelect = "";
|
|
51
|
-
document.body.style.cursor = "";
|
|
52
|
-
};
|
|
17
|
+
this.vertical = false;
|
|
53
18
|
}
|
|
54
19
|
static {
|
|
55
20
|
this.styles = [super.styles, styles];
|
|
@@ -57,33 +22,9 @@ class UDivider extends BaseElement {
|
|
|
57
22
|
static {
|
|
58
23
|
this.dependencies = {};
|
|
59
24
|
}
|
|
60
|
-
disconnectedCallback() {
|
|
61
|
-
super.disconnectedCallback();
|
|
62
|
-
document.removeEventListener("mousemove", this.handleMousemove);
|
|
63
|
-
document.removeEventListener("mouseup", this.handleMouseup);
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
if (this.movable) {
|
|
67
|
-
return html`
|
|
68
|
-
<div class="handler" part="handler"
|
|
69
|
-
?moving=${this.moving}
|
|
70
|
-
orientation=${this.orientation}
|
|
71
|
-
@mousedown=${this.handleMousedown}
|
|
72
|
-
></div>
|
|
73
|
-
`;
|
|
74
|
-
} else {
|
|
75
|
-
return nothing;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
25
|
}
|
|
79
|
-
__decorateClass([
|
|
80
|
-
state()
|
|
81
|
-
], UDivider.prototype, "moving");
|
|
82
|
-
__decorateClass([
|
|
83
|
-
property({ type: String, reflect: true })
|
|
84
|
-
], UDivider.prototype, "orientation");
|
|
85
26
|
__decorateClass([
|
|
86
27
|
property({ type: Boolean, reflect: true })
|
|
87
|
-
], UDivider.prototype, "
|
|
28
|
+
], UDivider.prototype, "vertical");
|
|
88
29
|
|
|
89
30
|
export { UDivider };
|