@iyulab/components 0.1.2 → 0.1.4
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 -11
- 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 +125 -125
- package/dist/assets/styles/dark.css.js +1 -1
- package/dist/assets/styles/light.css +126 -126
- package/dist/assets/styles/light.css.js +1 -1
- package/dist/components/BaseElement.styles.js +0 -1
- 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} +20 -10
- package/dist/components/divider/index.d.ts +7 -0
- package/dist/components/icon/Icon.d.ts +3 -7
- package/dist/components/icon/Icon.js +8 -15
- package/dist/components/index.d.ts +4 -0
- package/dist/components/panel/Panel.d.ts +0 -1
- package/dist/components/panel/Panel.js +0 -4
- package/dist/components/progress-bar/ProgressBar.d.ts +27 -0
- package/dist/components/progress-bar/ProgressBar.js +99 -0
- package/dist/components/progress-bar/ProgressBar.styles.d.ts +1 -0
- package/dist/components/progress-bar/ProgressBar.styles.js +73 -0
- package/dist/components/progress-bar/index.d.ts +7 -0
- package/dist/components/progress-ring/ProgressRing.d.ts +3 -1
- package/dist/components/progress-ring/ProgressRing.js +18 -15
- package/dist/components/split-panel/SplitPanel.d.ts +8 -12
- package/dist/components/split-panel/SplitPanel.js +63 -88
- package/dist/components/split-panel/SplitPanel.styles.js +16 -1
- package/dist/components/tooltip/Tooltip.d.ts +8 -12
- package/dist/components/tooltip/Tooltip.js +39 -38
- package/dist/components/tooltip/Tooltip.styles.js +4 -4
- package/dist/components/tree/Tree.d.ts +37 -0
- package/dist/components/tree/Tree.js +131 -0
- package/dist/components/tree/Tree.styles.d.ts +1 -0
- package/dist/components/tree/Tree.styles.js +26 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree-item/TreeItem.d.ts +33 -0
- package/dist/components/tree-item/TreeItem.js +131 -0
- package/dist/components/tree-item/TreeItem.styles.d.ts +1 -0
- package/dist/components/tree-item/TreeItem.styles.js +66 -0
- package/dist/components/tree-item/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/integrations/react/UDivider.d.ts +8 -0
- package/dist/integrations/react/UDivider.js +10 -0
- package/dist/integrations/react/UProgressBar.d.ts +8 -0
- package/dist/integrations/react/UProgressBar.js +10 -0
- package/dist/integrations/react/UTree.d.ts +8 -0
- package/dist/integrations/react/UTree.js +10 -0
- package/dist/integrations/react/UTreeItem.d.ts +8 -0
- package/dist/integrations/react/UTreeItem.js +10 -0
- package/dist/integrations/react/index.d.ts +4 -0
- package/dist/integrations/react/index.js +4 -0
- package/dist/internals/icon-helpers.d.ts +32 -0
- package/dist/internals/{icons.js → icon-helpers.js} +10 -4
- package/dist/internals/index.d.ts +1 -1
- package/dist/utilities/theme.js +18 -15
- package/package.json +57 -57
- 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/internals/icons.d.ts +0 -6
- /package/dist/components/{split-panel/Splitter.styles.d.ts → divider/Divider.styles.d.ts} +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { query, state, property } from 'lit/decorators.js';
|
|
3
|
+
import { BaseElement } from '../BaseElement.js';
|
|
4
|
+
import { styles } from './ProgressBar.styles.js';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = void 0 ;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (decorator(target, key, result) ) || result;
|
|
12
|
+
if (result) __defProp(target, key, result);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
class ProgressBar extends BaseElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.progressState = "turned-on";
|
|
19
|
+
this.progress = 0;
|
|
20
|
+
this.indeterminate = false;
|
|
21
|
+
this.minValue = 0;
|
|
22
|
+
this.maxValue = 100;
|
|
23
|
+
this.value = 0;
|
|
24
|
+
}
|
|
25
|
+
static {
|
|
26
|
+
this.styles = [super.styles, styles];
|
|
27
|
+
}
|
|
28
|
+
static {
|
|
29
|
+
this.dependencies = {};
|
|
30
|
+
}
|
|
31
|
+
willUpdate(changedProperties) {
|
|
32
|
+
super.willUpdate(changedProperties);
|
|
33
|
+
if (changedProperties.has("indeterminate")) {
|
|
34
|
+
this.progressState = this.indeterminate ? "indeterminate" : "turned-on";
|
|
35
|
+
}
|
|
36
|
+
if (changedProperties.has("minValue") || changedProperties.has("maxValue") || changedProperties.has("value")) {
|
|
37
|
+
this.updateProgress();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
return html`
|
|
42
|
+
<div class="indicator" part="indicator"
|
|
43
|
+
state=${this.progressState}
|
|
44
|
+
></div>
|
|
45
|
+
<div class="content" part="content">
|
|
46
|
+
<slot></slot>
|
|
47
|
+
</div>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
/** 내부 진행 상태 업데이트 */
|
|
51
|
+
async updateProgress() {
|
|
52
|
+
await this.updateComplete;
|
|
53
|
+
if (this.indeterminate) return;
|
|
54
|
+
const range = this.maxValue - this.minValue;
|
|
55
|
+
const clampedValue = Math.max(this.minValue, Math.min(this.maxValue, this.value));
|
|
56
|
+
const progress = range === 0 ? 0 : (clampedValue - this.minValue) / range;
|
|
57
|
+
if (isNaN(progress)) return;
|
|
58
|
+
if (this.progress <= 0 || progress < this.progress) {
|
|
59
|
+
this.progressState = "turned-on";
|
|
60
|
+
await this.updateComplete;
|
|
61
|
+
this.progressState = "determinate";
|
|
62
|
+
}
|
|
63
|
+
if (this.progressState === "determinate") {
|
|
64
|
+
this.indicatorEl.style.setProperty("--progress-value", progress.toString());
|
|
65
|
+
}
|
|
66
|
+
if (progress >= 1) {
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
this.progressState = "turned-off";
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
this.progressState = "turned-on";
|
|
71
|
+
}, 500);
|
|
72
|
+
}, 300);
|
|
73
|
+
}
|
|
74
|
+
this.progress = progress;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
__decorateClass([
|
|
78
|
+
query(".indicator")
|
|
79
|
+
], ProgressBar.prototype, "indicatorEl");
|
|
80
|
+
__decorateClass([
|
|
81
|
+
state()
|
|
82
|
+
], ProgressBar.prototype, "progressState");
|
|
83
|
+
__decorateClass([
|
|
84
|
+
state()
|
|
85
|
+
], ProgressBar.prototype, "progress");
|
|
86
|
+
__decorateClass([
|
|
87
|
+
property({ type: Boolean, reflect: true })
|
|
88
|
+
], ProgressBar.prototype, "indeterminate");
|
|
89
|
+
__decorateClass([
|
|
90
|
+
property({ type: Number })
|
|
91
|
+
], ProgressBar.prototype, "minValue");
|
|
92
|
+
__decorateClass([
|
|
93
|
+
property({ type: Number })
|
|
94
|
+
], ProgressBar.prototype, "maxValue");
|
|
95
|
+
__decorateClass([
|
|
96
|
+
property({ type: Number })
|
|
97
|
+
], ProgressBar.prototype, "value");
|
|
98
|
+
|
|
99
|
+
export { ProgressBar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: block;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 12px;
|
|
9
|
+
border-radius: 9999px;
|
|
10
|
+
background-color: var(--u-neutral-200);
|
|
11
|
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
|
|
14
|
+
--progress-value: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.indicator {
|
|
18
|
+
position: absolute;
|
|
19
|
+
inset: 0 0 0 0;
|
|
20
|
+
display: block;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
border-radius: inherit;
|
|
24
|
+
background-color: var(--u-blue-600);
|
|
25
|
+
transform-origin: left center;
|
|
26
|
+
will-change: transform, opacity;
|
|
27
|
+
}
|
|
28
|
+
.indicator[state="turned-on"] {
|
|
29
|
+
opacity: 0;
|
|
30
|
+
transform: scaleX(0);
|
|
31
|
+
transition: none;
|
|
32
|
+
}
|
|
33
|
+
.indicator[state="turned-off"] {
|
|
34
|
+
opacity: 0;
|
|
35
|
+
transform: scaleX(1);
|
|
36
|
+
transition: transform 0.3s ease, opacity 0.5s ease;
|
|
37
|
+
}
|
|
38
|
+
.indicator[state="determinate"] {
|
|
39
|
+
opacity: 1;
|
|
40
|
+
transform: scaleX(var(--progress-value));
|
|
41
|
+
transition: transform 0.3s ease;
|
|
42
|
+
}
|
|
43
|
+
.indicator[state="indeterminate"] {
|
|
44
|
+
opacity: 1;
|
|
45
|
+
transform: scaleX(1);
|
|
46
|
+
animation: indeterminate 1.5s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.content {
|
|
50
|
+
position: relative;
|
|
51
|
+
z-index: 1;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
font-size: 8px;
|
|
56
|
+
line-height: 12px;
|
|
57
|
+
color: var(--u-neutral-800);
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
user-select: none;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes indeterminate {
|
|
64
|
+
0% {
|
|
65
|
+
transform: translateX(-100%);
|
|
66
|
+
}
|
|
67
|
+
100% {
|
|
68
|
+
transform: translateX(100%);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export { styles };
|
|
@@ -21,7 +21,9 @@ export declare class ProgressRing extends BaseElement {
|
|
|
21
21
|
value: number;
|
|
22
22
|
protected willUpdate(changedProperties: PropertyValues): void;
|
|
23
23
|
render(): import('lit-html').TemplateResult<1>;
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* 진행 상태를 0과 1 사이의 값으로 반환합니다.
|
|
26
|
+
*/
|
|
25
27
|
private updateProgress;
|
|
26
28
|
/**
|
|
27
29
|
* variant에 따라 dasharray 값을 반환합니다.
|
|
@@ -32,10 +32,10 @@ class ProgressRing extends BaseElement {
|
|
|
32
32
|
willUpdate(changedProperties) {
|
|
33
33
|
super.willUpdate(changedProperties);
|
|
34
34
|
if (changedProperties.has("variant")) {
|
|
35
|
-
this.
|
|
35
|
+
this.updateDashArray();
|
|
36
36
|
}
|
|
37
37
|
if (changedProperties.has("minValue") || changedProperties.has("maxValue") || changedProperties.has("value")) {
|
|
38
|
-
this.
|
|
38
|
+
this.updateProgress();
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
@@ -64,27 +64,30 @@ class ProgressRing extends BaseElement {
|
|
|
64
64
|
mask="url(#progress-mask)"
|
|
65
65
|
></circle>
|
|
66
66
|
</svg>
|
|
67
|
-
<div class="label" part="label"
|
|
67
|
+
<div class="label" part="label">
|
|
68
|
+
${Math.round(this.progress * 100)}%
|
|
69
|
+
</div>
|
|
68
70
|
`;
|
|
69
71
|
}
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
/**
|
|
73
|
+
* 진행 상태를 0과 1 사이의 값으로 반환합니다.
|
|
74
|
+
*/
|
|
75
|
+
updateProgress() {
|
|
76
|
+
const range = this.maxValue - this.minValue;
|
|
77
|
+
const clampedValue = Math.max(this.minValue, Math.min(this.maxValue, this.value));
|
|
78
|
+
this.progress = range === 0 ? 0 : (clampedValue - this.minValue) / range;
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
81
|
* variant에 따라 dasharray 값을 반환합니다.
|
|
79
82
|
* [dash-length] [gap-length] or [dash-length] 형식
|
|
80
83
|
*/
|
|
81
|
-
updateDashArray(
|
|
82
|
-
if (variant === "ticks") {
|
|
83
|
-
|
|
84
|
-
} else if (variant === "blocks") {
|
|
85
|
-
|
|
84
|
+
updateDashArray() {
|
|
85
|
+
if (this.variant === "ticks") {
|
|
86
|
+
this.dasharray = "1 1";
|
|
87
|
+
} else if (this.variant === "blocks") {
|
|
88
|
+
this.dasharray = "8 2";
|
|
86
89
|
} else {
|
|
87
|
-
|
|
90
|
+
this.dasharray = PATH_LENGTH.toString();
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
}
|
|
@@ -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 handleDividerDrag;
|
|
26
22
|
}
|
|
@@ -2,8 +2,8 @@ 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 { Divider } from '../divider/Divider.js';
|
|
5
6
|
import { Panel } from '../panel/Panel.js';
|
|
6
|
-
import { Splitter } from './Splitter.js';
|
|
7
7
|
import { styles } from './SplitPanel.styles.js';
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -19,14 +19,11 @@ class SplitPanel extends BaseElement {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
21
|
this.panels = [];
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.totalSize = 0;
|
|
26
|
-
this.startPosition = 0;
|
|
27
|
-
this.startRatio = [];
|
|
22
|
+
this.dividers = [];
|
|
23
|
+
this.panelSizes = [];
|
|
24
|
+
this.panelAdjustSizes = [];
|
|
28
25
|
this.orientation = "horizontal";
|
|
29
|
-
this.
|
|
26
|
+
this.initialRatio = [];
|
|
30
27
|
this.handleSlotChange = async (e) => {
|
|
31
28
|
const slot = e.target;
|
|
32
29
|
const childrens = slot.assignedElements({ flatten: true });
|
|
@@ -34,83 +31,61 @@ class SplitPanel extends BaseElement {
|
|
|
34
31
|
if (this.panels.length === panels.length && this.panels.every((p, i) => p === panels[i])) {
|
|
35
32
|
return;
|
|
36
33
|
}
|
|
37
|
-
this.splitters.forEach((splitter) => splitter.remove());
|
|
38
|
-
this.splitters = [];
|
|
39
34
|
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;
|
|
35
|
+
this.dividers.forEach((divider) => divider.remove());
|
|
36
|
+
this.dividers = [];
|
|
37
|
+
if (this.initialRatio.length === panels.length) {
|
|
38
|
+
const totalRatio = this.initialRatio.reduce((sum, r) => sum + r, 0);
|
|
39
|
+
this.panelSizes = this.initialRatio.map((r) => r / totalRatio * 100);
|
|
57
40
|
} else {
|
|
58
|
-
panels.
|
|
59
|
-
|
|
60
|
-
});
|
|
41
|
+
const equalRatio = 100 / panels.length;
|
|
42
|
+
this.panelSizes = panels.map(() => equalRatio);
|
|
61
43
|
}
|
|
44
|
+
this.panelAdjustSizes = panels.map(() => 0);
|
|
45
|
+
const property2 = this.orientation === "horizontal" ? "width" : "height";
|
|
46
|
+
const dividerSize = this.getDividerSize();
|
|
47
|
+
panels.forEach((panel, index) => {
|
|
48
|
+
const ratio = this.panelSizes[index];
|
|
49
|
+
panel.style.flex = "none";
|
|
50
|
+
panel.style[property2] = index === 0 || index === panels.length - 1 ? `calc(${ratio}% - ${dividerSize / 2}px)` : `calc(${ratio}% - ${dividerSize}px)`;
|
|
51
|
+
if (index === panels.length - 1) return;
|
|
52
|
+
const divider = new Divider();
|
|
53
|
+
divider.orientation = this.orientation;
|
|
54
|
+
divider.draggable = true;
|
|
55
|
+
divider.addEventListener("u-drag", this.handleDividerDrag);
|
|
56
|
+
this.dividers.push(divider);
|
|
57
|
+
panel.after(divider);
|
|
58
|
+
});
|
|
62
59
|
this.requestUpdate();
|
|
63
60
|
await this.updateComplete;
|
|
64
61
|
};
|
|
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;
|
|
62
|
+
/** 디바이더 드래그 이벤트 핸들러 */
|
|
63
|
+
this.handleDividerDrag = (event) => {
|
|
64
|
+
const divider = event.target;
|
|
65
|
+
const delta = event.detail.delta;
|
|
66
|
+
const index = this.dividers.indexOf(divider);
|
|
67
|
+
if (index === -1) return;
|
|
68
|
+
const prevPanel = this.panels[index];
|
|
69
|
+
const nextPanel = this.panels[index + 1];
|
|
70
|
+
const property2 = this.orientation === "horizontal" ? "width" : "height";
|
|
71
|
+
const prevPanelSize = this.panelSizes[index];
|
|
72
|
+
const nextPanelSize = this.panelSizes[index + 1];
|
|
73
|
+
const prevAdjSize = this.panelAdjustSizes[index] || 0;
|
|
74
|
+
const nextAdjSize = this.panelAdjustSizes[index + 1] || 0;
|
|
75
|
+
if (delta === 0) return;
|
|
76
|
+
if (delta > 0) {
|
|
77
|
+
const prevNewAdjSize = prevAdjSize + delta;
|
|
78
|
+
const nextNewAdjSize = nextAdjSize - delta;
|
|
79
|
+
this.panelAdjustSizes[index] = prevNewAdjSize;
|
|
80
|
+
this.panelAdjustSizes[index + 1] = nextNewAdjSize;
|
|
81
|
+
} else {
|
|
82
|
+
const prevNewAdjSize = prevAdjSize + delta;
|
|
83
|
+
const nextNewAdjSize = nextAdjSize - delta;
|
|
84
|
+
this.panelAdjustSizes[index] = prevNewAdjSize;
|
|
85
|
+
this.panelAdjustSizes[index + 1] = nextNewAdjSize;
|
|
109
86
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
document.body.style.userSelect = "";
|
|
113
|
-
document.body.style.cursor = "";
|
|
87
|
+
prevPanel.style[property2] = `calc(${prevPanelSize}% - ${this.getDividerSize() / 2}px + ${this.panelAdjustSizes[index]}px)`;
|
|
88
|
+
nextPanel.style[property2] = `calc(${nextPanelSize}% - ${this.getDividerSize() / 2}px + ${this.panelAdjustSizes[index + 1]}px)`;
|
|
114
89
|
};
|
|
115
90
|
}
|
|
116
91
|
static {
|
|
@@ -118,17 +93,12 @@ class SplitPanel extends BaseElement {
|
|
|
118
93
|
}
|
|
119
94
|
static {
|
|
120
95
|
this.dependencies = {
|
|
121
|
-
"u-
|
|
122
|
-
"u-
|
|
96
|
+
"u-divider": Divider,
|
|
97
|
+
"u-panel": Panel
|
|
123
98
|
};
|
|
124
99
|
}
|
|
125
100
|
disconnectedCallback() {
|
|
126
|
-
|
|
127
|
-
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
128
|
-
this.splitters.forEach((splitter) => {
|
|
129
|
-
splitter.removeEventListener("mousedown", this.handleMouseDown);
|
|
130
|
-
splitter.remove();
|
|
131
|
-
});
|
|
101
|
+
this.dividers.forEach((divider) => divider.remove());
|
|
132
102
|
super.disconnectedCallback();
|
|
133
103
|
}
|
|
134
104
|
render() {
|
|
@@ -136,12 +106,17 @@ class SplitPanel extends BaseElement {
|
|
|
136
106
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
137
107
|
`;
|
|
138
108
|
}
|
|
109
|
+
// Get divider size from CSS variable
|
|
110
|
+
getDividerSize() {
|
|
111
|
+
const sizeStr = getComputedStyle(this).getPropertyValue("--divider-size").trim();
|
|
112
|
+
return parseFloat(sizeStr) || 2;
|
|
113
|
+
}
|
|
139
114
|
}
|
|
140
115
|
__decorateClass([
|
|
141
116
|
property({ type: String, reflect: true })
|
|
142
117
|
], SplitPanel.prototype, "orientation");
|
|
143
118
|
__decorateClass([
|
|
144
|
-
property({ type: Array, converter: arrayAttributeConverter(parseFloat) })
|
|
145
|
-
], SplitPanel.prototype, "
|
|
119
|
+
property({ type: Array, attribute: "initial-ratio", converter: arrayAttributeConverter(parseFloat) })
|
|
120
|
+
], SplitPanel.prototype, "initialRatio");
|
|
146
121
|
|
|
147
122
|
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;
|
|
25
|
+
protected willUpdate(changedProperties: PropertyValues): void;
|
|
26
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
|
}
|