@iyulab/components 0.1.3 → 0.1.5
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 +18 -15
- package/LICENSE +20 -20
- package/README.md +33 -33
- package/dist/assets/icons/arrow-clockwise.svg.js +1 -1
- package/dist/assets/icons/arrow-down.svg.js +1 -1
- package/dist/assets/icons/arrow-up.svg.js +1 -1
- package/dist/assets/icons/ban.svg.js +1 -1
- package/dist/assets/icons/check-circle-fill.svg.js +1 -1
- package/dist/assets/icons/check-lg.svg.js +1 -1
- package/dist/assets/icons/chevron-down.svg.js +1 -1
- package/dist/assets/icons/chevron-left.svg.js +1 -1
- package/dist/assets/icons/chevron-right.svg.js +1 -1
- package/dist/assets/icons/chevron-up.svg.js +1 -1
- package/dist/assets/icons/copy.svg.js +1 -1
- package/dist/assets/icons/dash-lg.svg.js +1 -1
- package/dist/assets/icons/exclamation-circle-fill.svg.js +1 -1
- package/dist/assets/icons/exclamation-triangle-fill.svg.js +1 -1
- package/dist/assets/icons/info-circle-fill.svg.js +1 -1
- package/dist/assets/icons/layout-sidebar.svg.js +1 -1
- package/dist/assets/icons/lightbulb-fill.svg.js +1 -1
- package/dist/assets/icons/lightbulb-off.svg.js +1 -1
- package/dist/assets/icons/lightbulb.svg.js +1 -1
- package/dist/assets/icons/mic-fill.svg.js +1 -1
- package/dist/assets/icons/mic-mute-fill.svg.js +1 -1
- package/dist/assets/icons/paperclip.svg.js +1 -1
- package/dist/assets/icons/pencil-square.svg.js +1 -1
- package/dist/assets/icons/plus-lg.svg.js +1 -1
- package/dist/assets/icons/search.svg.js +1 -1
- package/dist/assets/icons/speedometer.svg.js +1 -1
- package/dist/assets/icons/x-lg.svg.js +1 -1
- package/dist/assets/styles/dark.css +129 -125
- package/dist/assets/styles/dark.css.js +1 -1
- package/dist/assets/styles/light.css +129 -126
- package/dist/assets/styles/light.css.js +1 -1
- package/dist/components/BaseElement.styles.js +2 -3
- package/dist/components/alert/Alert.d.ts +8 -4
- package/dist/components/alert/Alert.js +24 -15
- package/dist/components/alert/Alert.styles.js +32 -39
- package/dist/components/alert/index.js +5 -0
- package/dist/components/button/Button.js +4 -2
- package/dist/components/button/Button.styles.js +13 -20
- package/dist/components/button/index.js +5 -0
- package/dist/components/context-menu/index.js +5 -0
- package/dist/components/copy-button/CopyButton.d.ts +7 -3
- package/dist/components/copy-button/CopyButton.js +69 -0
- package/dist/components/copy-button/CopyButton.styles.js +17 -0
- package/dist/components/copy-button/index.js +5 -0
- package/dist/components/dialog/index.js +5 -0
- package/dist/components/divider/Divider.d.ts +25 -0
- package/dist/components/divider/Divider.js +89 -0
- package/dist/components/{split-panel/Splitter.styles.js → divider/Divider.styles.js} +25 -13
- package/dist/components/divider/index.d.ts +7 -0
- package/dist/components/divider/index.js +5 -0
- package/dist/components/form/Form.d.ts +3 -1
- package/dist/components/form/Form.js +3 -1
- package/dist/components/form/Form.styles.js +1 -0
- package/dist/components/form/index.js +5 -0
- package/dist/components/icon/Icon.d.ts +6 -16
- package/dist/components/icon/Icon.js +17 -40
- package/dist/components/icon/Icon.styles.js +1 -1
- package/dist/components/icon/index.js +5 -0
- package/dist/components/icon-button/IconButton.d.ts +3 -3
- package/dist/components/icon-button/IconButton.js +6 -6
- package/dist/components/icon-button/IconButton.styles.js +14 -29
- package/dist/components/icon-button/index.js +5 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/input/Input.d.ts +14 -13
- package/dist/components/input/Input.js +56 -55
- package/dist/components/input/Input.styles.js +52 -54
- package/dist/components/input/index.js +5 -0
- package/dist/components/menu/index.js +5 -0
- package/dist/components/progress-bar/ProgressBar.d.ts +2 -2
- package/dist/components/progress-bar/ProgressBar.js +2 -2
- package/dist/components/progress-bar/ProgressBar.styles.js +10 -10
- package/dist/components/progress-bar/index.js +5 -0
- package/dist/components/progress-ring/ProgressRing.d.ts +2 -2
- package/dist/components/progress-ring/ProgressRing.js +9 -6
- package/dist/components/progress-ring/ProgressRing.styles.js +8 -9
- package/dist/components/progress-ring/index.js +5 -0
- package/dist/components/spinner/Spinner.styles.js +5 -3
- package/dist/components/spinner/index.js +5 -0
- package/dist/components/split-panel/SplitPanel.d.ts +8 -12
- package/dist/components/split-panel/SplitPanel.js +64 -91
- package/dist/components/split-panel/SplitPanel.styles.js +16 -1
- package/dist/components/split-panel/index.js +5 -0
- package/dist/components/tooltip/Tooltip.d.ts +8 -12
- package/dist/components/tooltip/Tooltip.js +39 -38
- package/dist/components/tooltip/Tooltip.styles.js +5 -5
- package/dist/components/tooltip/index.js +5 -0
- package/dist/components/tree/Tree.d.ts +2 -14
- package/dist/components/tree/Tree.js +9 -49
- package/dist/components/tree/Tree.styles.js +5 -5
- package/dist/components/tree/index.js +5 -0
- package/dist/components/tree-item/TreeItem.d.ts +10 -29
- package/dist/components/tree-item/TreeItem.js +63 -95
- package/dist/components/tree-item/TreeItem.styles.js +10 -41
- package/dist/components/tree-item/index.js +5 -0
- package/dist/index.js +25 -5
- package/dist/integrations/react/UDivider.d.ts +8 -0
- package/dist/integrations/react/UDivider.js +10 -0
- package/dist/integrations/react/index.d.ts +1 -1
- package/dist/integrations/react/index.js +1 -1
- package/dist/internals/index.d.ts +0 -1
- package/dist/utilities/decorators.js +2 -0
- package/dist/utilities/icons.d.ts +46 -0
- package/dist/{internals → utilities}/icons.js +74 -2
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/notifier.d.ts +17 -7
- package/dist/utilities/notifier.js +51 -41
- package/dist/utilities/theme.d.ts +15 -20
- package/dist/utilities/theme.js +36 -29
- package/package.json +59 -58
- package/dist/components/panel/Panel.d.ts +0 -10
- package/dist/components/panel/Panel.js +0 -21
- package/dist/components/panel/Panel.styles.js +0 -12
- package/dist/components/panel/index.d.ts +0 -7
- package/dist/components/split-panel/SplitPanel.types.d.ts +0 -2
- package/dist/components/split-panel/Splitter.d.ts +0 -17
- package/dist/components/split-panel/Splitter.js +0 -45
- package/dist/components/split-panel/Splitter.styles.d.ts +0 -1
- package/dist/integrations/react/UPanel.d.ts +0 -8
- package/dist/integrations/react/UPanel.js +0 -10
- package/dist/internals/icons.d.ts +0 -6
- /package/dist/components/{panel/Panel.styles.d.ts → divider/Divider.styles.d.ts} +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
3
|
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
--progress-value: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
:host {
|
|
5
9
|
position: relative;
|
|
6
10
|
display: block;
|
|
7
11
|
width: 100%;
|
|
8
|
-
height:
|
|
12
|
+
height: 1em;
|
|
9
13
|
border-radius: 9999px;
|
|
10
14
|
background-color: var(--u-neutral-200);
|
|
11
15
|
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
12
16
|
overflow: hidden;
|
|
13
|
-
|
|
14
|
-
--progress-value: 0;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
.indicator {
|
|
18
20
|
position: absolute;
|
|
19
21
|
inset: 0 0 0 0;
|
|
20
22
|
display: block;
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
23
|
border-radius: inherit;
|
|
24
24
|
background-color: var(--u-blue-600);
|
|
25
25
|
transform-origin: left center;
|
|
@@ -47,14 +47,14 @@ const styles = css`
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.content {
|
|
50
|
-
position:
|
|
51
|
-
z-index:
|
|
50
|
+
position: absolute;
|
|
51
|
+
z-index: 100;
|
|
52
52
|
display: flex;
|
|
53
|
+
inset: 0 0 0 0;
|
|
53
54
|
align-items: center;
|
|
54
55
|
justify-content: center;
|
|
55
|
-
font-size:
|
|
56
|
-
line-height:
|
|
57
|
-
color: var(--u-neutral-800);
|
|
56
|
+
font-size: 0.5em;
|
|
57
|
+
line-height: 1em;
|
|
58
58
|
white-space: nowrap;
|
|
59
59
|
user-select: none;
|
|
60
60
|
pointer-events: none;
|
|
@@ -9,8 +9,8 @@ export type ProgressRingVariant = 'smooth' | 'blocks' | 'ticks';
|
|
|
9
9
|
export declare class ProgressRing extends BaseElement {
|
|
10
10
|
static styles: import('lit').CSSResultGroup[];
|
|
11
11
|
static dependencies: Record<string, typeof BaseElement>;
|
|
12
|
-
progress: number;
|
|
13
12
|
dasharray: string;
|
|
13
|
+
progress: number;
|
|
14
14
|
/** 진행 표시기의 스타일 변형을 설정합니다. */
|
|
15
15
|
variant: ProgressRingVariant;
|
|
16
16
|
/** 진행 표시기의 최소값을 설정합니다. */
|
|
@@ -24,7 +24,7 @@ export declare class ProgressRing extends BaseElement {
|
|
|
24
24
|
/**
|
|
25
25
|
* 진행 상태를 0과 1 사이의 값으로 반환합니다.
|
|
26
26
|
*/
|
|
27
|
-
private
|
|
27
|
+
private updateProgressState;
|
|
28
28
|
/**
|
|
29
29
|
* variant에 따라 dasharray 값을 반환합니다.
|
|
30
30
|
* [dash-length] [gap-length] or [dash-length] 형식
|
|
@@ -16,8 +16,8 @@ const PATH_LENGTH = 100;
|
|
|
16
16
|
class ProgressRing extends BaseElement {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
-
this.progress = 0;
|
|
20
19
|
this.dasharray = PATH_LENGTH.toString();
|
|
20
|
+
this.progress = 0;
|
|
21
21
|
this.variant = "smooth";
|
|
22
22
|
this.minValue = 0;
|
|
23
23
|
this.maxValue = 100;
|
|
@@ -35,7 +35,7 @@ class ProgressRing extends BaseElement {
|
|
|
35
35
|
this.updateDashArray();
|
|
36
36
|
}
|
|
37
37
|
if (changedProperties.has("minValue") || changedProperties.has("maxValue") || changedProperties.has("value")) {
|
|
38
|
-
this.
|
|
38
|
+
this.updateProgressState();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
@@ -48,6 +48,7 @@ class ProgressRing extends BaseElement {
|
|
|
48
48
|
stroke="white"
|
|
49
49
|
stroke-dasharray="${PATH_LENGTH}"
|
|
50
50
|
stroke-dashoffset="${PATH_LENGTH * (1 - this.progress)}"
|
|
51
|
+
stroke-linecap=${this.variant === "smooth" ? "round" : "butt"}
|
|
51
52
|
></circle>
|
|
52
53
|
</mask>
|
|
53
54
|
</defs>
|
|
@@ -64,13 +65,15 @@ class ProgressRing extends BaseElement {
|
|
|
64
65
|
mask="url(#progress-mask)"
|
|
65
66
|
></circle>
|
|
66
67
|
</svg>
|
|
67
|
-
<div class="label" part="label"
|
|
68
|
+
<div class="label" part="label">
|
|
69
|
+
${Math.round(this.progress * 100)} %
|
|
70
|
+
</div>
|
|
68
71
|
`;
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
71
74
|
* 진행 상태를 0과 1 사이의 값으로 반환합니다.
|
|
72
75
|
*/
|
|
73
|
-
|
|
76
|
+
updateProgressState() {
|
|
74
77
|
const range = this.maxValue - this.minValue;
|
|
75
78
|
const clampedValue = Math.max(this.minValue, Math.min(this.maxValue, this.value));
|
|
76
79
|
this.progress = range === 0 ? 0 : (clampedValue - this.minValue) / range;
|
|
@@ -91,10 +94,10 @@ class ProgressRing extends BaseElement {
|
|
|
91
94
|
}
|
|
92
95
|
__decorateClass([
|
|
93
96
|
state()
|
|
94
|
-
], ProgressRing.prototype, "
|
|
97
|
+
], ProgressRing.prototype, "dasharray");
|
|
95
98
|
__decorateClass([
|
|
96
99
|
state()
|
|
97
|
-
], ProgressRing.prototype, "
|
|
100
|
+
], ProgressRing.prototype, "progress");
|
|
98
101
|
__decorateClass([
|
|
99
102
|
property({ type: String, reflect: true })
|
|
100
103
|
], ProgressRing.prototype, "variant");
|
|
@@ -2,20 +2,19 @@ import { css } from 'lit';
|
|
|
2
2
|
|
|
3
3
|
const styles = css`
|
|
4
4
|
:host {
|
|
5
|
-
position: relative;
|
|
6
|
-
display: inline-flex;
|
|
7
|
-
font-size: inherit;
|
|
8
|
-
|
|
9
5
|
--track-width: 0.25em;
|
|
10
6
|
--track-color: var(--u-neutral-200, #e5e7eb);
|
|
11
7
|
--indicator-color: var(--u-blue-600, #3b82f6);
|
|
12
8
|
}
|
|
13
|
-
|
|
14
|
-
:host
|
|
15
|
-
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
font-size: inherit;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
.progress-ring {
|
|
17
|
+
position: relative;
|
|
19
18
|
width: 6em;
|
|
20
19
|
height: 6em;
|
|
21
20
|
transform: rotate(-90deg); /* 0%가 위에서 시작하도록 회전 */
|
|
@@ -39,12 +38,12 @@ const styles = css`
|
|
|
39
38
|
/* 라벨 중앙 숫자 */
|
|
40
39
|
.label {
|
|
41
40
|
position: absolute;
|
|
42
|
-
inset: 0;
|
|
41
|
+
inset: 0 0 0 0;
|
|
43
42
|
display: flex;
|
|
44
43
|
align-items: center;
|
|
45
44
|
justify-content: center;
|
|
46
45
|
font-weight: 600;
|
|
47
|
-
font-size:
|
|
46
|
+
font-size: 1em;
|
|
48
47
|
color: var(--indicator-color);
|
|
49
48
|
pointer-events: none;
|
|
50
49
|
}
|
|
@@ -2,14 +2,16 @@ import { css } from 'lit';
|
|
|
2
2
|
|
|
3
3
|
const styles = css`
|
|
4
4
|
:host {
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
font-size: inherit;
|
|
7
|
-
|
|
8
5
|
--track-width: 0.125em;
|
|
9
6
|
--track-color: var(--u-neutral-200, #e5e7eb);
|
|
10
7
|
--indicator-color: var(--u-neutral-800, #1f2937);
|
|
11
8
|
}
|
|
12
9
|
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
font-size: inherit;
|
|
13
|
+
}
|
|
14
|
+
|
|
13
15
|
.spinner {
|
|
14
16
|
flex: 1 1 auto;
|
|
15
17
|
width: 1em;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseElement } from '../BaseElement.js';
|
|
2
|
-
import { PanelOrientation } from './SplitPanel.types.js';
|
|
3
2
|
/**
|
|
4
3
|
* SplitPanel 컴포넌트는 화면을 여러 개의 패널로 분할하여 표시합니다.
|
|
5
4
|
*/
|
|
@@ -7,20 +6,17 @@ export declare class SplitPanel extends BaseElement {
|
|
|
7
6
|
static styles: import('lit').CSSResultGroup[];
|
|
8
7
|
static dependencies: Record<string, typeof BaseElement>;
|
|
9
8
|
private panels;
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private totalSize;
|
|
14
|
-
private startPosition;
|
|
15
|
-
private startRatio;
|
|
9
|
+
private dividers;
|
|
10
|
+
private panelSizes;
|
|
11
|
+
private panelAdjustSizes;
|
|
16
12
|
/** 분할 방향을 설정합니다. 'horizontal'은 좌우 분할, 'vertical'은 상하 분할입니다. */
|
|
17
|
-
orientation:
|
|
13
|
+
orientation: 'horizontal' | 'vertical';
|
|
18
14
|
/** 초기 패널 크기 비율을 설정합니다. (예: [30, 70]은 첫 번째 패널이 30%, 두 번째 패널이 70%를 차지) */
|
|
19
|
-
|
|
15
|
+
initialRatio: number[];
|
|
20
16
|
disconnectedCallback(): void;
|
|
21
17
|
render(): import('lit-html').TemplateResult<1>;
|
|
18
|
+
private getDividerSize;
|
|
22
19
|
private handleSlotChange;
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
private handleMouseUp;
|
|
20
|
+
/** 디바이더 드래그 이벤트 핸들러 */
|
|
21
|
+
private handleDividerMove;
|
|
26
22
|
}
|
|
@@ -2,8 +2,7 @@ import { html } from 'lit';
|
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
3
|
import { arrayAttributeConverter } from '../../internals/attribute-converters.js';
|
|
4
4
|
import { BaseElement } from '../BaseElement.js';
|
|
5
|
-
import {
|
|
6
|
-
import { Splitter } from './Splitter.js';
|
|
5
|
+
import { Divider } from '../divider/Divider.js';
|
|
7
6
|
import { styles } from './SplitPanel.styles.js';
|
|
8
7
|
|
|
9
8
|
var __defProp = Object.defineProperty;
|
|
@@ -19,98 +18,73 @@ class SplitPanel extends BaseElement {
|
|
|
19
18
|
constructor() {
|
|
20
19
|
super(...arguments);
|
|
21
20
|
this.panels = [];
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.totalSize = 0;
|
|
26
|
-
this.startPosition = 0;
|
|
27
|
-
this.startRatio = [];
|
|
21
|
+
this.dividers = [];
|
|
22
|
+
this.panelSizes = [];
|
|
23
|
+
this.panelAdjustSizes = [];
|
|
28
24
|
this.orientation = "horizontal";
|
|
29
|
-
this.
|
|
25
|
+
this.initialRatio = [];
|
|
30
26
|
this.handleSlotChange = async (e) => {
|
|
31
27
|
const slot = e.target;
|
|
32
|
-
const
|
|
33
|
-
const panels =
|
|
28
|
+
const children = slot.assignedElements({ flatten: true });
|
|
29
|
+
const panels = children.filter((el) => el instanceof HTMLElement);
|
|
34
30
|
if (this.panels.length === panels.length && this.panels.every((p, i) => p === panels[i])) {
|
|
35
31
|
return;
|
|
36
32
|
}
|
|
37
|
-
this.splitters.forEach((splitter) => splitter.remove());
|
|
38
|
-
this.splitters = [];
|
|
39
33
|
this.panels = panels;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
splitter.orientation = this.orientation;
|
|
46
|
-
splitter.addEventListener("mousedown", this.handleMouseDown);
|
|
47
|
-
this.splitters.push(splitter);
|
|
48
|
-
panel.after(splitter);
|
|
49
|
-
});
|
|
50
|
-
if (this.ratio.length === panels.length) {
|
|
51
|
-
const totalRatio = this.ratio.reduce((sum, r) => sum + r, 0);
|
|
52
|
-
panels.forEach((panel, i) => {
|
|
53
|
-
const panelRatio = this.ratio[i] / totalRatio * 100;
|
|
54
|
-
panel.style.flex = `${panelRatio} 1 0%`;
|
|
55
|
-
});
|
|
56
|
-
return;
|
|
34
|
+
this.dividers.forEach((divider) => divider.remove());
|
|
35
|
+
this.dividers = [];
|
|
36
|
+
if (this.initialRatio.length === panels.length) {
|
|
37
|
+
const totalRatio = this.initialRatio.reduce((sum, r) => sum + r, 0);
|
|
38
|
+
this.panelSizes = this.initialRatio.map((r) => r / totalRatio * 100);
|
|
57
39
|
} else {
|
|
58
|
-
panels.
|
|
59
|
-
|
|
60
|
-
});
|
|
40
|
+
const equalRatio = 100 / panels.length;
|
|
41
|
+
this.panelSizes = panels.map(() => equalRatio);
|
|
61
42
|
}
|
|
43
|
+
this.panelAdjustSizes = panels.map(() => 0);
|
|
44
|
+
const property2 = this.orientation === "horizontal" ? "width" : "height";
|
|
45
|
+
const dividerSize = this.getDividerSize();
|
|
46
|
+
panels.forEach((panel, index) => {
|
|
47
|
+
const ratio = this.panelSizes[index];
|
|
48
|
+
panel.style.flex = "none";
|
|
49
|
+
panel.style[property2] = index === 0 || index === panels.length - 1 ? `calc(${ratio}% - ${dividerSize / 2}px)` : `calc(${ratio}% - ${dividerSize}px)`;
|
|
50
|
+
if (index === panels.length - 1) return;
|
|
51
|
+
const divider = new Divider();
|
|
52
|
+
divider.orientation = this.orientation;
|
|
53
|
+
divider.draggable = true;
|
|
54
|
+
divider.addEventListener("u-move", this.handleDividerMove);
|
|
55
|
+
this.dividers.push(divider);
|
|
56
|
+
panel.after(divider);
|
|
57
|
+
});
|
|
62
58
|
this.requestUpdate();
|
|
63
59
|
await this.updateComplete;
|
|
64
60
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const currentPosition = this.orientation === "horizontal" ? e.clientX : e.clientY;
|
|
90
|
-
const deltaPixels = currentPosition - this.startPosition;
|
|
91
|
-
const splitterIndex = this.splitters.indexOf(this.currentSplitter);
|
|
92
|
-
if (splitterIndex === -1) return;
|
|
93
|
-
const prevPanel = this.panels[splitterIndex];
|
|
94
|
-
const nextPanel = this.panels[splitterIndex + 1];
|
|
95
|
-
if (!prevPanel || !nextPanel) return;
|
|
96
|
-
const deltaRatio = deltaPixels / this.totalSize * 100;
|
|
97
|
-
const prevRatio = this.startRatio[splitterIndex] + deltaRatio;
|
|
98
|
-
const nextRatio = this.startRatio[splitterIndex + 1] - deltaRatio;
|
|
99
|
-
if (prevRatio < 0 || nextRatio < 0) return;
|
|
100
|
-
prevPanel.style.flex = `${prevRatio} 1 0%`;
|
|
101
|
-
nextPanel.style.flex = `${nextRatio} 1 0%`;
|
|
102
|
-
};
|
|
103
|
-
this.handleMouseUp = (_e) => {
|
|
104
|
-
if (!this.isDragging) return;
|
|
105
|
-
this.isDragging = false;
|
|
106
|
-
if (this.currentSplitter) {
|
|
107
|
-
this.currentSplitter.dragging = false;
|
|
108
|
-
this.currentSplitter = null;
|
|
61
|
+
/** 디바이더 드래그 이벤트 핸들러 */
|
|
62
|
+
this.handleDividerMove = (event) => {
|
|
63
|
+
const divider = event.target;
|
|
64
|
+
const delta = event.detail.delta;
|
|
65
|
+
const index = this.dividers.indexOf(divider);
|
|
66
|
+
if (index === -1) return;
|
|
67
|
+
const prevPanel = this.panels[index];
|
|
68
|
+
const nextPanel = this.panels[index + 1];
|
|
69
|
+
const property2 = this.orientation === "horizontal" ? "width" : "height";
|
|
70
|
+
const prevPanelSize = this.panelSizes[index];
|
|
71
|
+
const nextPanelSize = this.panelSizes[index + 1];
|
|
72
|
+
const prevAdjSize = this.panelAdjustSizes[index] || 0;
|
|
73
|
+
const nextAdjSize = this.panelAdjustSizes[index + 1] || 0;
|
|
74
|
+
if (delta === 0) return;
|
|
75
|
+
if (delta > 0) {
|
|
76
|
+
const prevNewAdjSize = prevAdjSize + delta;
|
|
77
|
+
const nextNewAdjSize = nextAdjSize - delta;
|
|
78
|
+
this.panelAdjustSizes[index] = prevNewAdjSize;
|
|
79
|
+
this.panelAdjustSizes[index + 1] = nextNewAdjSize;
|
|
80
|
+
} else {
|
|
81
|
+
const prevNewAdjSize = prevAdjSize + delta;
|
|
82
|
+
const nextNewAdjSize = nextAdjSize - delta;
|
|
83
|
+
this.panelAdjustSizes[index] = prevNewAdjSize;
|
|
84
|
+
this.panelAdjustSizes[index + 1] = nextNewAdjSize;
|
|
109
85
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
document.body.style.userSelect = "";
|
|
113
|
-
document.body.style.cursor = "";
|
|
86
|
+
prevPanel.style[property2] = `calc(${prevPanelSize}% - ${this.getDividerSize() / 2}px + ${this.panelAdjustSizes[index]}px)`;
|
|
87
|
+
nextPanel.style[property2] = `calc(${nextPanelSize}% - ${this.getDividerSize() / 2}px + ${this.panelAdjustSizes[index + 1]}px)`;
|
|
114
88
|
};
|
|
115
89
|
}
|
|
116
90
|
static {
|
|
@@ -118,17 +92,11 @@ class SplitPanel extends BaseElement {
|
|
|
118
92
|
}
|
|
119
93
|
static {
|
|
120
94
|
this.dependencies = {
|
|
121
|
-
"u-
|
|
122
|
-
"u-splitter": Splitter
|
|
95
|
+
"u-divider": Divider
|
|
123
96
|
};
|
|
124
97
|
}
|
|
125
98
|
disconnectedCallback() {
|
|
126
|
-
|
|
127
|
-
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
128
|
-
this.splitters.forEach((splitter) => {
|
|
129
|
-
splitter.removeEventListener("mousedown", this.handleMouseDown);
|
|
130
|
-
splitter.remove();
|
|
131
|
-
});
|
|
99
|
+
this.dividers.forEach((divider) => divider.remove());
|
|
132
100
|
super.disconnectedCallback();
|
|
133
101
|
}
|
|
134
102
|
render() {
|
|
@@ -136,12 +104,17 @@ class SplitPanel extends BaseElement {
|
|
|
136
104
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
137
105
|
`;
|
|
138
106
|
}
|
|
107
|
+
// Get divider size from CSS variable
|
|
108
|
+
getDividerSize() {
|
|
109
|
+
const sizeStr = getComputedStyle(this).getPropertyValue("--divider-size").trim();
|
|
110
|
+
return parseFloat(sizeStr) || 2;
|
|
111
|
+
}
|
|
139
112
|
}
|
|
140
113
|
__decorateClass([
|
|
141
114
|
property({ type: String, reflect: true })
|
|
142
115
|
], SplitPanel.prototype, "orientation");
|
|
143
116
|
__decorateClass([
|
|
144
|
-
property({ type: Array, converter: arrayAttributeConverter(parseFloat) })
|
|
145
|
-
], SplitPanel.prototype, "
|
|
117
|
+
property({ type: Array, attribute: "initial-ratio", converter: arrayAttributeConverter(parseFloat) })
|
|
118
|
+
], SplitPanel.prototype, "initialRatio");
|
|
146
119
|
|
|
147
120
|
export { SplitPanel };
|
|
@@ -3,17 +3,32 @@ import { css } from 'lit';
|
|
|
3
3
|
const styles = css`
|
|
4
4
|
:host {
|
|
5
5
|
position: relative;
|
|
6
|
-
display:
|
|
6
|
+
display: block;
|
|
7
7
|
width: 100%;
|
|
8
8
|
height: 100%;
|
|
9
9
|
overflow: hidden;
|
|
10
|
+
|
|
11
|
+
--divider-size: 2px;
|
|
12
|
+
--divider-color: var(--u-neutral-200, #d1d5db);
|
|
13
|
+
--divider-handle-size: 4px;
|
|
14
|
+
--divider-handle-color: var(--u-blue-500, #3b82f6);
|
|
10
15
|
}
|
|
11
16
|
:host([orientation="horizontal"]) {
|
|
17
|
+
display: flex;
|
|
12
18
|
flex-direction: row;
|
|
13
19
|
}
|
|
14
20
|
:host([orientation="vertical"]) {
|
|
21
|
+
display: flex;
|
|
15
22
|
flex-direction: column;
|
|
16
23
|
}
|
|
24
|
+
|
|
25
|
+
::slotted(u-divider) {
|
|
26
|
+
background-color: var(--divider-color, var(--u-neutral-200, #d1d5db));
|
|
27
|
+
|
|
28
|
+
--divider-size: var(--divider-size, 2px);
|
|
29
|
+
--handler-size: var(--divider-handle-size, 4px);
|
|
30
|
+
--handler-color: var(--divider-handle-color, var(--u-blue-500, #3b82f6));
|
|
31
|
+
}
|
|
17
32
|
`;
|
|
18
33
|
|
|
19
34
|
export { styles };
|
|
@@ -7,38 +7,34 @@ import { BaseElement } from '../BaseElement.js';
|
|
|
7
7
|
export declare class Tooltip extends BaseElement {
|
|
8
8
|
static styles: import('lit').CSSResultGroup[];
|
|
9
9
|
static dependencies: Record<string, typeof BaseElement>;
|
|
10
|
-
/** 슬롯이 비어있는지 여부를 나타냅니다. */
|
|
11
|
-
private isSlotEmpty;
|
|
12
10
|
/** 툴팁이 연결될 대상 엘리먼트입니다. 지정하지 않으면 부모 엘리먼트가 대상이 됩니다. */
|
|
13
11
|
triggers: HTMLElement[];
|
|
14
12
|
/** 트리거 셀렉터 문자열입니다. 이 속성을 사용하여 트리거 엘리먼트를 지정할 수 있습니다. */
|
|
15
13
|
triggerSelectors?: string;
|
|
16
|
-
/** 현재 툴팁이 열려있는지 여부를 나타냅니다. */
|
|
17
|
-
open: boolean;
|
|
18
14
|
/** 'fixed' 위치에서 포지션을 계산할지 여부를 설정합니다. 기본값은 false입니다. */
|
|
19
15
|
hoist: boolean;
|
|
20
16
|
/** 툴팁이 나타날 위치를 설정합니다. */
|
|
21
17
|
placement?: Placement;
|
|
22
18
|
/** 툴팁의 위치에서 대상 엘리먼트까지의 거리를 픽셀단위로 설정합니다. 기본값은 8입니다. */
|
|
23
19
|
distance: number;
|
|
20
|
+
/** 툴팁의 표시 딜레이 시간을 밀리초 단위로 설정합니다. 기본값은 0입니다. */
|
|
21
|
+
delay: number;
|
|
22
|
+
constructor();
|
|
24
23
|
connectedCallback(): void;
|
|
25
24
|
disconnectedCallback(): void;
|
|
26
25
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
26
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
27
27
|
render(): import('lit-html').TemplateResult<1>;
|
|
28
28
|
/** 툴팁을 표시합니다. */
|
|
29
|
-
show: (
|
|
29
|
+
show: (event: Event) => Promise<void>;
|
|
30
30
|
/** 툴팁을 숨깁니다. */
|
|
31
|
-
hide: (
|
|
31
|
+
hide: (event: Event) => Promise<void>;
|
|
32
32
|
/** 대상 엘리먼트에 툴팁 이벤트를 바인딩 합니다. */
|
|
33
33
|
private attachTriggers;
|
|
34
34
|
/** 대상 엘리먼트에 바인딩된 툴팁 이벤트를 제거합니다. */
|
|
35
35
|
private detachTriggers;
|
|
36
36
|
/**
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
private getTransformOrigin;
|
|
40
|
-
/**
|
|
41
|
-
* slot에 콘텐츠가 존재하는지 확인합니다.
|
|
37
|
+
* 툴팁이 나타날 위치에 따라 transform-origin 값을 반환합니다.
|
|
42
38
|
*/
|
|
43
|
-
private
|
|
39
|
+
private getTransformOrigin;
|
|
44
40
|
}
|