@nova-design-system/nova-webcomponents 3.16.0 → 3.17.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/dist/cjs/index-93d3b2f8.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/native.cjs.js +1 -1
- package/dist/cjs/nv-button.cjs.entry.js +1 -7
- package/dist/cjs/nv-button.cjs.entry.js.map +1 -1
- package/dist/cjs/nv-split.cjs.entry.js +339 -0
- package/dist/cjs/nv-split.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-stack.cjs.entry.js +1 -1
- package/dist/cjs/nv-table.cjs.entry.js +1 -1
- package/dist/cjs/nv-toggle.cjs.entry.js +2 -2
- package/dist/cjs/nv-togglebutton.cjs.entry.js +1 -1
- package/dist/cjs/nv-togglebuttongroup.cjs.entry.js +1 -1
- package/dist/cjs/nv-tooltip.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/nv-button/nv-button.js +1 -13
- package/dist/collection/components/nv-button/nv-button.js.map +1 -1
- package/dist/collection/components/nv-split/nv-split.docs.js +41 -0
- package/dist/collection/components/nv-split/nv-split.docs.js.map +1 -0
- package/dist/collection/components/nv-split/nv-split.js +549 -0
- package/dist/collection/components/nv-split/nv-split.js.map +1 -0
- package/dist/collection/components/nv-split/styles/nv-split.css +96 -0
- package/dist/collection/components/nv-stack/nv-stack.js +1 -1
- package/dist/collection/components/nv-table/nv-table.js +1 -1
- package/dist/collection/components/nv-toggle/nv-toggle.js +2 -2
- package/dist/collection/components/nv-togglebutton/nv-togglebutton.js +1 -1
- package/dist/collection/components/nv-togglebuttongroup/nv-togglebuttongroup.js +1 -1
- package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
- package/dist/components/nv-breadcrumb.js +1 -1
- package/dist/components/nv-button.js +1 -1
- package/dist/components/nv-dialog.js +2 -2
- package/dist/components/nv-dialogfooter.js +1 -1
- package/dist/components/nv-split.d.ts +11 -0
- package/dist/components/nv-split.js +366 -0
- package/dist/components/nv-split.js.map +1 -0
- package/dist/components/nv-stack.js +1 -1
- package/dist/components/nv-table.js +1 -1
- package/dist/components/nv-toggle.js +2 -2
- package/dist/components/nv-togglebutton.js +1 -1
- package/dist/components/nv-togglebuttongroup.js +1 -1
- package/dist/components/nv-tooltip.js +1 -1
- package/dist/components/{p-9707528d.js → p-6f2b257e.js} +2 -2
- package/dist/components/{p-9707528d.js.map → p-6f2b257e.js.map} +1 -1
- package/dist/components/{p-a1ef5e37.js → p-7b5102c8.js} +2 -2
- package/dist/components/{p-a1ef5e37.js.map → p-7b5102c8.js.map} +1 -1
- package/dist/components/{p-2d64749f.js → p-9e7468e3.js} +3 -9
- package/dist/components/p-9e7468e3.js.map +1 -0
- package/dist/esm/index-dc2723f3.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/native.js +1 -1
- package/dist/esm/nv-button.entry.js +1 -7
- package/dist/esm/nv-button.entry.js.map +1 -1
- package/dist/esm/nv-split.entry.js +335 -0
- package/dist/esm/nv-split.entry.js.map +1 -0
- package/dist/esm/nv-stack.entry.js +1 -1
- package/dist/esm/nv-table.entry.js +1 -1
- package/dist/esm/nv-toggle.entry.js +2 -2
- package/dist/esm/nv-togglebutton.entry.js +1 -1
- package/dist/esm/nv-togglebuttongroup.entry.js +1 -1
- package/dist/esm/nv-tooltip.entry.js +1 -1
- package/dist/native/native.css +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/{p-445221dc.entry.js → p-14e622e1.entry.js} +2 -2
- package/dist/native/p-2364aefa.entry.js +2 -0
- package/dist/native/p-2364aefa.entry.js.map +1 -0
- package/dist/native/{p-44a78545.entry.js → p-52d2c0ae.entry.js} +2 -2
- package/dist/native/{p-a2f58133.entry.js → p-638967bf.entry.js} +2 -2
- package/dist/native/{p-075d231e.entry.js → p-91fab6c2.entry.js} +2 -2
- package/dist/native/{p-d45ee8e5.entry.js → p-a6fc987a.entry.js} +2 -2
- package/dist/native/p-a6fc987a.entry.js.map +1 -0
- package/dist/native/{p-dfb6b65e.entry.js → p-cb0293ec.entry.js} +2 -2
- package/dist/native/{p-b02c896a.entry.js → p-d94bf052.entry.js} +2 -2
- package/dist/types/components/nv-button/nv-button.d.ts +0 -1
- package/dist/types/components/nv-split/nv-split.d.ts +128 -0
- package/dist/types/components/nv-split/nv-split.docs.d.ts +4 -0
- package/dist/types/components.d.ts +107 -0
- package/dist/vscode-data.json +25 -0
- package/hydrate/index.js +363 -15
- package/hydrate/index.mjs +363 -15
- package/package.json +5 -1
- package/dist/components/p-2d64749f.js.map +0 -1
- package/dist/native/p-d45ee8e5.entry.js.map +0 -1
- /package/dist/native/{p-445221dc.entry.js.map → p-14e622e1.entry.js.map} +0 -0
- /package/dist/native/{p-44a78545.entry.js.map → p-52d2c0ae.entry.js.map} +0 -0
- /package/dist/native/{p-a2f58133.entry.js.map → p-638967bf.entry.js.map} +0 -0
- /package/dist/native/{p-075d231e.entry.js.map → p-91fab6c2.entry.js.map} +0 -0
- /package/dist/native/{p-dfb6b65e.entry.js.map → p-cb0293ec.entry.js.map} +0 -0
- /package/dist/native/{p-b02c896a.entry.js.map → p-d94bf052.entry.js.map} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
nv-split {
|
|
2
|
+
display: flex;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
nv-split[direction=horizontal] {
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
}
|
|
10
|
+
nv-split[direction=vertical] {
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
nv-split .nv-split-gutter {
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 10;
|
|
16
|
+
background: transparent;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
flex: 0 0 auto;
|
|
21
|
+
transition: background-color 0.2s ease;
|
|
22
|
+
}
|
|
23
|
+
nv-split .nv-split-gutter::after {
|
|
24
|
+
content: "";
|
|
25
|
+
position: absolute;
|
|
26
|
+
background: var(--nv-color-neutral-400, #ccc);
|
|
27
|
+
border-radius: 2px;
|
|
28
|
+
transition: background-color 0.2s ease;
|
|
29
|
+
}
|
|
30
|
+
nv-split .nv-split-gutter:hover::after {
|
|
31
|
+
background: var(--nv-color-brand-primary, #0066cc);
|
|
32
|
+
}
|
|
33
|
+
nv-split .nv-split-gutter::before {
|
|
34
|
+
content: "";
|
|
35
|
+
position: absolute;
|
|
36
|
+
background-repeat: no-repeat;
|
|
37
|
+
background-position: center;
|
|
38
|
+
opacity: 0.4;
|
|
39
|
+
transition: opacity 0.2s ease;
|
|
40
|
+
pointer-events: none;
|
|
41
|
+
}
|
|
42
|
+
nv-split .nv-split-gutter:hover::before {
|
|
43
|
+
opacity: 0.7;
|
|
44
|
+
}
|
|
45
|
+
nv-split[direction=horizontal] > .nv-split-gutter {
|
|
46
|
+
width: var(--nv-split-gutter-size, 24px);
|
|
47
|
+
top: 0;
|
|
48
|
+
bottom: 0;
|
|
49
|
+
transform: translateX(-50%);
|
|
50
|
+
cursor: col-resize;
|
|
51
|
+
}
|
|
52
|
+
nv-split[direction=horizontal] > .nv-split-gutter::after {
|
|
53
|
+
width: 2px;
|
|
54
|
+
height: 60%;
|
|
55
|
+
left: 50%;
|
|
56
|
+
top: 20%;
|
|
57
|
+
transform: translateX(-50%);
|
|
58
|
+
}
|
|
59
|
+
nv-split[direction=horizontal] > .nv-split-gutter::before {
|
|
60
|
+
width: 16px;
|
|
61
|
+
height: 16px;
|
|
62
|
+
}
|
|
63
|
+
nv-split[direction=vertical] > .nv-split-gutter {
|
|
64
|
+
height: var(--nv-split-gutter-size, 24px);
|
|
65
|
+
left: 0;
|
|
66
|
+
right: 0;
|
|
67
|
+
transform: translateY(-50%);
|
|
68
|
+
cursor: row-resize;
|
|
69
|
+
}
|
|
70
|
+
nv-split[direction=vertical] > .nv-split-gutter::after {
|
|
71
|
+
height: 2px;
|
|
72
|
+
width: 60%;
|
|
73
|
+
top: 50%;
|
|
74
|
+
left: 20%;
|
|
75
|
+
transform: translateY(-50%);
|
|
76
|
+
}
|
|
77
|
+
nv-split[direction=vertical] > .nv-split-gutter::before {
|
|
78
|
+
width: 16px;
|
|
79
|
+
height: 16px;
|
|
80
|
+
}
|
|
81
|
+
nv-split[data-dragging=true] > .nv-split-gutter::after {
|
|
82
|
+
background: var(--nv-color-neutral-500, #9ca3af);
|
|
83
|
+
}
|
|
84
|
+
nv-split > [slot=pane] {
|
|
85
|
+
flex: 1 1 auto;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
min-width: 0;
|
|
88
|
+
min-height: 0;
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
}
|
|
92
|
+
nv-split > [slot=pane] > nv-split {
|
|
93
|
+
flex: 1 1 auto;
|
|
94
|
+
width: 100%;
|
|
95
|
+
height: 100%;
|
|
96
|
+
}
|
|
@@ -18,7 +18,7 @@ export class NvStack {
|
|
|
18
18
|
/****************************************************************************/
|
|
19
19
|
//#region RENDER
|
|
20
20
|
render() {
|
|
21
|
-
return (h(Host, { key: '
|
|
21
|
+
return (h(Host, { key: '5922efd8652a14d73e812e85dd6770101e22fe46', class: clsx(this.fill && 'nv-stack-fill', this.flex && 'nv-stack-flex', this.full && 'w-full', this.gutter && !this.vertical && `gap-x-${this.gutter}`, this.gutter && this.vertical && `gap-y-${this.gutter}`, this.vertical && 'nv-stack-vertical') }, h("slot", { key: '71daf4ee34bd57d785203f98799b6ea7c66ffa3b' })));
|
|
22
22
|
}
|
|
23
23
|
static get is() { return "nv-stack"; }
|
|
24
24
|
static get originalStyleUrls() {
|
|
@@ -59,7 +59,7 @@ export class NvTable {
|
|
|
59
59
|
/****************************************************************************/
|
|
60
60
|
//#region RENDER
|
|
61
61
|
render() {
|
|
62
|
-
return (h(Host, { key: '
|
|
62
|
+
return (h(Host, { key: '16b564cc29e8987d8b3fda3a84c0b19882a733bd' }, h("slot", { key: '1305cbc6d29caa60df55bfa01a39a3417a27ec01' })));
|
|
63
63
|
}
|
|
64
64
|
static get is() { return "nv-table"; }
|
|
65
65
|
static get originalStyleUrls() {
|
|
@@ -60,8 +60,8 @@ export class NvToggle {
|
|
|
60
60
|
/****************************************************************************/
|
|
61
61
|
//#region RENDER
|
|
62
62
|
render() {
|
|
63
|
-
return (h(Host, { key: '
|
|
64
|
-
this.el.querySelector('[slot="description"]')) && (h("div", { key: '
|
|
63
|
+
return (h(Host, { key: '0f440b59ac0c32d9abe9577668d7045081819b49', class: clsx(this.labelPlacement === 'before' && 'label-placement-before') }, h("div", { key: '4289435e34eb31a8e59e00cefcba2e17e98bd03a', class: "input-container" }, h("input", { key: '1b7d05f77fd32cece9eed2e6cf79c7e2e707f64c', type: "checkbox", id: this.inputId, name: this.name, autocomplete: "off", value: this.value, checked: Boolean(this.checked), disabled: this.disabled || this.readonly, readonly: this.readonly })), h("div", { key: '6d78d7e80eb790bbead21bba6108329f9ded3746', class: "text-container" }, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { key: '524a2c2542a45945bddb688c5dff6c9426d58570', htmlFor: this.inputId, class: clsx(this.hideLabel && 'visually-hidden') }, h("slot", { key: '59eda4b826602062620e7167acf3c8de0f77ebef', name: "label" }, this.label))), (this.description ||
|
|
64
|
+
this.el.querySelector('[slot="description"]')) && (h("div", { key: '6e8412879ed60fc6806464432348bd52483e3567', class: "description" }, h("slot", { key: '85a876130569a5a4051e271eaf1cf49593a014a6', name: "description" }, this.description))))));
|
|
65
65
|
}
|
|
66
66
|
static get is() { return "nv-toggle"; }
|
|
67
67
|
static get formAssociated() { return true; }
|
|
@@ -41,7 +41,7 @@ export class NvTogglebutton {
|
|
|
41
41
|
/****************************************************************************/
|
|
42
42
|
//#region RENDER
|
|
43
43
|
render() {
|
|
44
|
-
return (h(Host, { key: '
|
|
44
|
+
return (h(Host, { key: 'b9e37fc1cb34272bca476c7b61db173ab2a9d238', role: "button", tabindex: "0", "aria-pressed": String(this.active), onClick: this.handleClick }, h("slot", { key: 'cf9cf3445fd93873def1f9fa9cbec46c35600025' })));
|
|
45
45
|
}
|
|
46
46
|
static get is() { return "nv-togglebutton"; }
|
|
47
47
|
static get originalStyleUrls() {
|
|
@@ -149,7 +149,7 @@ export class NvTogglebuttongroup {
|
|
|
149
149
|
/****************************************************************************/
|
|
150
150
|
//#region RENDER
|
|
151
151
|
render() {
|
|
152
|
-
return (h(Host, { key: '
|
|
152
|
+
return (h(Host, { key: '7aad0160ae8e093765ba42649293e27d7b93ab75' }, h("slot", { key: '39364122a5e65b1a454bd782a5daacc7edfee8b0' })));
|
|
153
153
|
}
|
|
154
154
|
static get is() { return "nv-togglebuttongroup"; }
|
|
155
155
|
static get originalStyleUrls() {
|
|
@@ -40,7 +40,7 @@ export class NvTooltip {
|
|
|
40
40
|
/****************************************************************************/
|
|
41
41
|
//#region RENDER
|
|
42
42
|
render() {
|
|
43
|
-
return (h(Host, { key: '
|
|
43
|
+
return (h(Host, { key: '5d5facbf2a0487bda4fbae49913a2cb4f69dcf5a' }, h("slot", { key: '91080d347f3473879109f7b0b59b159f5bb5979b' }), h("nv-popover", { key: '876e5e2487d1b2b5182e42909a6edeab5b3e9db2', triggerMode: "hover", hasArrow: true, placement: this.placement, strategy: this.strategy, triggerElement: this.triggerElement, groupName: 'tooltip', enterDelay: this.enterDelay }, h("p", { key: 'e30ce16ed27e41dee7359fb44ccba7a780e72d37', slot: "content" }, this.message), h("slot", { key: '395c75d7f45bab9aaebf979bd75087058b979350', name: "content" }))));
|
|
44
44
|
}
|
|
45
45
|
static get is() { return "nv-tooltip"; }
|
|
46
46
|
static get originalStyleUrls() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, f as forceUpdate, h, d as Host } from './p-5829b9f7.js';
|
|
2
2
|
import { c as clsx } from './p-8a1a6e56.js';
|
|
3
3
|
import { d as defineCustomElement$3 } from './p-63595ea1.js';
|
|
4
|
-
import { d as defineCustomElement$2 } from './p-
|
|
4
|
+
import { d as defineCustomElement$2 } from './p-6f2b257e.js';
|
|
5
5
|
|
|
6
6
|
const nvBreadcrumbCss = "nv-breadcrumb{display:flex;align-items:center;color:var(--components-breadcrumb-text);font-size:var(--font-size-sm);font-style:normal;font-weight:var(--font-weight-medium-emphasis);line-height:var(--line-height-sm)}nv-breadcrumb.visually-hidden{position:absolute;padding:0;border:0;overflow:hidden;white-space:nowrap;width:1px;height:1px;margin:-1px;clip:rect(0, 0, 0, 0)}nv-breadcrumb ul{display:flex;flex-direction:column;gap:var(--spacing-1-5);padding:var(--spacing-1)}nv-breadcrumb ul a,nv-breadcrumb ul button{display:inline-flex;align-self:center;color:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;line-height:inherit;text-decoration:none}nv-breadcrumb ul a:focus,nv-breadcrumb ul a:focus-within,nv-breadcrumb ul button:focus,nv-breadcrumb ul button:focus-within{outline:none}nv-breadcrumb ul a:focus-visible,nv-breadcrumb ul a:has(:focus-visible),nv-breadcrumb ul button:focus-visible,nv-breadcrumb ul button:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 0.5) solid var(--components-breadcrumb-text-hover);outline-offset:calc(var(--focus-outline-offset) * 0.3)}nv-breadcrumb ul a:hover,nv-breadcrumb ul button:hover{text-decoration:underline;color:var(--components-breadcrumb-text-hover)}nv-breadcrumb>a,nv-breadcrumb>button{display:inline-flex;align-self:center;color:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;line-height:inherit;text-decoration:none}nv-breadcrumb>a:focus,nv-breadcrumb>a:focus-within,nv-breadcrumb>button:focus,nv-breadcrumb>button:focus-within{outline:none}nv-breadcrumb>a:focus-visible,nv-breadcrumb>a:has(:focus-visible),nv-breadcrumb>button:focus-visible,nv-breadcrumb>button:has(:focus-visible){outline:calc(var(--focus-outline-stroke) * 0.5) solid var(--components-breadcrumb-text-hover);outline-offset:calc(var(--focus-outline-offset) * 0.3)}nv-breadcrumb>a:hover,nv-breadcrumb>button:hover{text-decoration:underline;color:var(--components-breadcrumb-text-hover)}nv-breadcrumb span[data-scope=separator]{display:inline-flex;padding-left:var(--breadcrumb-padding-y)}";
|
|
7
7
|
const NvBreadcrumbStyle0 = nvBreadcrumbCss;
|
|
@@ -2,8 +2,8 @@ import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-
|
|
|
2
2
|
import { a as addEventListeners, r as removeEventListeners } from './p-d429a343.js';
|
|
3
3
|
import { c as clsx } from './p-8a1a6e56.js';
|
|
4
4
|
import { b as ButtonType } from './p-51602221.js';
|
|
5
|
-
import { d as defineCustomElement$6 } from './p-
|
|
6
|
-
import { d as defineCustomElement$5 } from './p-
|
|
5
|
+
import { d as defineCustomElement$6 } from './p-9e7468e3.js';
|
|
6
|
+
import { d as defineCustomElement$5 } from './p-7b5102c8.js';
|
|
7
7
|
import { d as defineCustomElement$4 } from './p-429e01f3.js';
|
|
8
8
|
import { d as defineCustomElement$3 } from './p-47d499b4.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './p-98429fd7.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface NvSplit extends Components.NvSplit, HTMLElement {}
|
|
4
|
+
export const NvSplit: {
|
|
5
|
+
prototype: NvSplit;
|
|
6
|
+
new (): NvSplit;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-5829b9f7.js';
|
|
2
|
+
|
|
3
|
+
const nvSplitCss = "nv-split{display:flex;width:100%;height:100%;position:relative}nv-split[direction=horizontal]{flex-direction:row}nv-split[direction=vertical]{flex-direction:column}nv-split .nv-split-gutter{position:absolute;z-index:10;background:transparent;display:flex;align-items:center;justify-content:center;flex:0 0 auto;transition:background-color 0.2s ease}nv-split .nv-split-gutter::after{content:\"\";position:absolute;background:var(--nv-color-neutral-400, #ccc);border-radius:2px;transition:background-color 0.2s ease}nv-split .nv-split-gutter:hover::after{background:var(--nv-color-brand-primary, #0066cc)}nv-split .nv-split-gutter::before{content:\"\";position:absolute;background-repeat:no-repeat;background-position:center;opacity:0.4;transition:opacity 0.2s ease;pointer-events:none}nv-split .nv-split-gutter:hover::before{opacity:0.7}nv-split[direction=horizontal]>.nv-split-gutter{width:var(--nv-split-gutter-size, 24px);top:0;bottom:0;transform:translateX(-50%);cursor:col-resize}nv-split[direction=horizontal]>.nv-split-gutter::after{width:2px;height:60%;left:50%;top:20%;transform:translateX(-50%)}nv-split[direction=horizontal]>.nv-split-gutter::before{width:16px;height:16px}nv-split[direction=vertical]>.nv-split-gutter{height:var(--nv-split-gutter-size, 24px);left:0;right:0;transform:translateY(-50%);cursor:row-resize}nv-split[direction=vertical]>.nv-split-gutter::after{height:2px;width:60%;top:50%;left:20%;transform:translateY(-50%)}nv-split[direction=vertical]>.nv-split-gutter::before{width:16px;height:16px}nv-split[data-dragging=true]>.nv-split-gutter::after{background:var(--nv-color-neutral-500, #9ca3af)}nv-split>[slot=pane]{flex:1 1 auto;overflow:hidden;min-width:0;min-height:0;display:flex;flex-direction:column}nv-split>[slot=pane]>nv-split{flex:1 1 auto;width:100%;height:100%}";
|
|
4
|
+
const NvSplitStyle0 = nvSplitCss;
|
|
5
|
+
|
|
6
|
+
const NvSplit$1 = /*@__PURE__*/ proxyCustomElement(class NvSplit extends H {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.sizesChanged = createEvent(this, "sizesChanged", 7);
|
|
11
|
+
/****************************************************************************/
|
|
12
|
+
//#region PROPERTIES
|
|
13
|
+
/**
|
|
14
|
+
* Direction of the split layout.
|
|
15
|
+
* - `horizontal`: panes side by side
|
|
16
|
+
* - `vertical`: panes stacked
|
|
17
|
+
*/
|
|
18
|
+
this.direction = 'horizontal';
|
|
19
|
+
/**
|
|
20
|
+
* Initial sizes of the panes in percentages.
|
|
21
|
+
* Example: `[50, 50]` means two equal panes.
|
|
22
|
+
* Explicitly `reflect: false` (array) for framework compatibility.
|
|
23
|
+
*/
|
|
24
|
+
this.sizes = [];
|
|
25
|
+
/**
|
|
26
|
+
* Width or height of the gutter (in px) depending on the split direction.
|
|
27
|
+
* Default is 24px to meet WCAG 2.2 target size requirements for touch accessibility.
|
|
28
|
+
*/
|
|
29
|
+
this.gutterSize = 24;
|
|
30
|
+
//#endregion
|
|
31
|
+
/****************************************************************************/
|
|
32
|
+
//#region STATE
|
|
33
|
+
this.isDragging = false;
|
|
34
|
+
this.dragIndex = -1;
|
|
35
|
+
this.startPos = 0;
|
|
36
|
+
this.startSizes = [];
|
|
37
|
+
// Handlers stored to be able to detach them
|
|
38
|
+
this.onDocMove = (ev) => this.handleMouseMove(ev);
|
|
39
|
+
this.onDocUp = () => this.stopDragging();
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
/****************************************************************************/
|
|
43
|
+
//#region WATCHERS
|
|
44
|
+
onSizesChanged() {
|
|
45
|
+
// Re-apply sizes if modified from the outside
|
|
46
|
+
this.applySizes();
|
|
47
|
+
}
|
|
48
|
+
onDirectionChanged() {
|
|
49
|
+
// Update the orientation and the cursors of the gutters
|
|
50
|
+
this.ensureGutters();
|
|
51
|
+
this.applySizes();
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
/****************************************************************************/
|
|
55
|
+
//#region LIFECYCLE
|
|
56
|
+
componentDidLoad() {
|
|
57
|
+
// Initialization (once)
|
|
58
|
+
this.ensureGutters();
|
|
59
|
+
this.applySizes();
|
|
60
|
+
this.positionGutters();
|
|
61
|
+
// Observer: reposition gutters when resized (nested or parent split changes)
|
|
62
|
+
this.ro = new ResizeObserver(() => this.positionGutters());
|
|
63
|
+
this.ro.observe(this.el);
|
|
64
|
+
window.addEventListener('resize', () => this.positionGutters());
|
|
65
|
+
}
|
|
66
|
+
disconnectedCallback() {
|
|
67
|
+
var _a;
|
|
68
|
+
// Security cleanup (in case a drag was in progress)
|
|
69
|
+
this.detachDocumentListeners();
|
|
70
|
+
(_a = this.ro) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
71
|
+
this.ro = undefined;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
/****************************************************************************/
|
|
75
|
+
//#region PUBLIC METHODS
|
|
76
|
+
/**
|
|
77
|
+
* Programmatically set pane sizes.
|
|
78
|
+
* @param {Array<number>} sizes Array of pane sizes in percentages.
|
|
79
|
+
* @returns {Promise<void>}
|
|
80
|
+
*/
|
|
81
|
+
async setSizes(sizes) {
|
|
82
|
+
this.sizes = [...sizes];
|
|
83
|
+
this.applySizes();
|
|
84
|
+
this.sizesChanged.emit([...this.sizes]);
|
|
85
|
+
this.positionGutters();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns the current pane sizes.
|
|
89
|
+
* @returns {Promise<number[]>} Array of pane sizes in percentages.
|
|
90
|
+
*/
|
|
91
|
+
async getSizes() {
|
|
92
|
+
return [...this.sizes];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Collapse a specific pane to 0 size.
|
|
96
|
+
* @param {number} index Index of the pane to collapse.
|
|
97
|
+
* @returns {Promise<void>}
|
|
98
|
+
*/
|
|
99
|
+
async collapse(index) {
|
|
100
|
+
const panes = this.getPanes();
|
|
101
|
+
if (index < 0 || index >= panes.length)
|
|
102
|
+
return;
|
|
103
|
+
// Simple strategy: 0% for the index, the rest (100%) for its nearest neighbor
|
|
104
|
+
const next = new Array(panes.length).fill(0);
|
|
105
|
+
const target = index < panes.length - 1 ? index + 1 : index - 1;
|
|
106
|
+
if (target >= 0)
|
|
107
|
+
next[target] = 100;
|
|
108
|
+
this.sizes = next;
|
|
109
|
+
this.applySizes();
|
|
110
|
+
this.sizesChanged.emit([...this.sizes]);
|
|
111
|
+
this.positionGutters();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Destroy the split instance: removes gutters and resets layout state.
|
|
115
|
+
* @returns {Promise<void>}
|
|
116
|
+
*/
|
|
117
|
+
async destroy() {
|
|
118
|
+
var _a;
|
|
119
|
+
this.sizes = [];
|
|
120
|
+
this.isDragging = false;
|
|
121
|
+
this.dragIndex = -1;
|
|
122
|
+
this.removeOwnGutters();
|
|
123
|
+
this.detachDocumentListeners();
|
|
124
|
+
(_a = this.ro) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
/****************************************************************************/
|
|
128
|
+
//#region INTERNAL HELPERS
|
|
129
|
+
/**
|
|
130
|
+
* Returns the panes of the split.
|
|
131
|
+
* @returns {HTMLElement[]} The panes of the split.
|
|
132
|
+
*/
|
|
133
|
+
getPanes() {
|
|
134
|
+
// Only the direct children slot="pane"
|
|
135
|
+
return Array.from(this.el.querySelectorAll(':scope > [slot="pane"]'));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns the own gutters of the split.
|
|
139
|
+
* @returns {HTMLElement[]} The own gutters of the split.
|
|
140
|
+
*/
|
|
141
|
+
getOwnGutters() {
|
|
142
|
+
// Only the direct gutters of THIS instance
|
|
143
|
+
return Array.from(this.el.querySelectorAll(':scope > .nv-split-gutter[data-auto="true"]'));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Removes the own gutters of the split.
|
|
147
|
+
*/
|
|
148
|
+
removeOwnGutters() {
|
|
149
|
+
this.getOwnGutters().forEach(g => g.remove());
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Ensures the gutters of the split.
|
|
153
|
+
*/
|
|
154
|
+
ensureGutters() {
|
|
155
|
+
const panes = this.getPanes();
|
|
156
|
+
// 1) Clean ONLY the old direct gutters of THIS instance
|
|
157
|
+
this.removeOwnGutters();
|
|
158
|
+
if (panes.length <= 1)
|
|
159
|
+
return;
|
|
160
|
+
// 2) Add the gutters (directs) between the panes
|
|
161
|
+
panes.forEach((pane, i) => {
|
|
162
|
+
if (i >= panes.length - 1)
|
|
163
|
+
return;
|
|
164
|
+
const g = document.createElement('div');
|
|
165
|
+
g.className = 'nv-split-gutter';
|
|
166
|
+
g.setAttribute('data-auto', 'true');
|
|
167
|
+
if (this.direction === 'horizontal') {
|
|
168
|
+
g.style.width = `${this.gutterSize}px`;
|
|
169
|
+
g.style.cursor = 'col-resize';
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
g.style.height = `${this.gutterSize}px`;
|
|
173
|
+
g.style.cursor = 'row-resize';
|
|
174
|
+
}
|
|
175
|
+
// Customizable internal slot
|
|
176
|
+
const slotEl = document.createElement('slot');
|
|
177
|
+
slotEl.name = 'gutter';
|
|
178
|
+
g.appendChild(slotEl);
|
|
179
|
+
// Listener drag (index = gutter between pane i and i+1)
|
|
180
|
+
g.addEventListener('mousedown', (ev) => this.startDragging(ev, i));
|
|
181
|
+
// Insert just after the pane
|
|
182
|
+
pane.insertAdjacentElement('afterend', g);
|
|
183
|
+
});
|
|
184
|
+
this.positionGutters();
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Applies the sizes to the panes.
|
|
188
|
+
*/
|
|
189
|
+
applySizes() {
|
|
190
|
+
const panes = this.getPanes();
|
|
191
|
+
const n = panes.length;
|
|
192
|
+
if (n === 0)
|
|
193
|
+
return;
|
|
194
|
+
// Default values if inconsistent
|
|
195
|
+
if (!this.sizes || this.sizes.length !== n) {
|
|
196
|
+
this.sizes = Array(n).fill(100 / n);
|
|
197
|
+
}
|
|
198
|
+
panes.forEach((pane, i) => {
|
|
199
|
+
var _a;
|
|
200
|
+
const size = Math.max(0, (_a = this.sizes[i]) !== null && _a !== void 0 ? _a : 100 / n);
|
|
201
|
+
// Flex-basis via flex shorthand (https://developer.mozilla.org/en-US/docs/Web/CSS/flex)
|
|
202
|
+
pane.style.flex = `0 0 ${size}%`;
|
|
203
|
+
pane.style.minWidth = '0';
|
|
204
|
+
pane.style.minHeight = '0';
|
|
205
|
+
pane.style.overflow = 'hidden'; // let a nv-split child extend
|
|
206
|
+
pane.style.display = 'flex';
|
|
207
|
+
pane.style.flexDirection = 'column';
|
|
208
|
+
});
|
|
209
|
+
this.positionGutters();
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Attaches the document listeners.
|
|
213
|
+
*/
|
|
214
|
+
attachDocumentListeners() {
|
|
215
|
+
document.addEventListener('mousemove', this.onDocMove);
|
|
216
|
+
document.addEventListener('mouseup', this.onDocUp);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Detaches the document listeners.
|
|
220
|
+
*/
|
|
221
|
+
detachDocumentListeners() {
|
|
222
|
+
document.removeEventListener('mousemove', this.onDocMove);
|
|
223
|
+
document.removeEventListener('mouseup', this.onDocUp);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Positions the gutters based on the current sizes of the panes.
|
|
227
|
+
*/
|
|
228
|
+
positionGutters() {
|
|
229
|
+
var _a, _b;
|
|
230
|
+
const panes = this.getPanes();
|
|
231
|
+
const gutters = this.getOwnGutters();
|
|
232
|
+
if (panes.length <= 1 || gutters.length === 0)
|
|
233
|
+
return;
|
|
234
|
+
const horizontal = this.direction === 'horizontal';
|
|
235
|
+
let cumPct = 0;
|
|
236
|
+
for (let i = 0; i < gutters.length; i++) {
|
|
237
|
+
const sizePct = (_b = (_a = this.sizes) === null || _a === void 0 ? void 0 : _a[i]) !== null && _b !== void 0 ? _b : 100 / panes.length;
|
|
238
|
+
cumPct += sizePct;
|
|
239
|
+
const g = gutters[i];
|
|
240
|
+
g.style.position = 'absolute';
|
|
241
|
+
if (horizontal) {
|
|
242
|
+
g.style.left = `${cumPct}%`;
|
|
243
|
+
g.style.top = '0';
|
|
244
|
+
g.style.bottom = '0';
|
|
245
|
+
g.style.height = '100%';
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
g.style.top = `${cumPct}%`;
|
|
249
|
+
g.style.left = '0';
|
|
250
|
+
g.style.right = '0';
|
|
251
|
+
g.style.width = '100%';
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Starts the dragging process.
|
|
257
|
+
* @param {MouseEvent} ev - The mouse event.
|
|
258
|
+
* @param {number} index - The index of the gutter.
|
|
259
|
+
*/
|
|
260
|
+
startDragging(ev, index) {
|
|
261
|
+
this.isDragging = true;
|
|
262
|
+
this.dragIndex = index;
|
|
263
|
+
this.startPos = this.direction === 'horizontal' ? ev.clientX : ev.clientY;
|
|
264
|
+
this.startSizes = [...this.sizes];
|
|
265
|
+
this.attachDocumentListeners();
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Handles the mouse movement during dragging.
|
|
269
|
+
* @param {MouseEvent} ev - The mouse event.
|
|
270
|
+
*/
|
|
271
|
+
handleMouseMove(ev) {
|
|
272
|
+
var _a, _b, _c, _d;
|
|
273
|
+
if (!this.isDragging || this.dragIndex < 0)
|
|
274
|
+
return;
|
|
275
|
+
const panes = this.getPanes();
|
|
276
|
+
if (panes.length < 2)
|
|
277
|
+
return;
|
|
278
|
+
const rect = this.el.getBoundingClientRect();
|
|
279
|
+
// Ensure we never divide by zero if the element has zero width/height
|
|
280
|
+
const rawSize = this.direction === 'horizontal' ? rect.width : rect.height;
|
|
281
|
+
const totalPx = Math.max(rawSize, 1);
|
|
282
|
+
const deltaPx = (this.direction === 'horizontal' ? ev.clientX : ev.clientY) -
|
|
283
|
+
this.startPos;
|
|
284
|
+
const deltaPct = (deltaPx / totalPx) * 100;
|
|
285
|
+
const i = this.dragIndex;
|
|
286
|
+
const j = i + 1;
|
|
287
|
+
let left = this.startSizes[i] + deltaPct;
|
|
288
|
+
let right = this.startSizes[j] - deltaPct;
|
|
289
|
+
// minSizes (px) -> %
|
|
290
|
+
const minLeftPct = (((_b = (_a = this.minSizes) === null || _a === void 0 ? void 0 : _a[i]) !== null && _b !== void 0 ? _b : 0) / totalPx) * 100;
|
|
291
|
+
const minRightPct = (((_d = (_c = this.minSizes) === null || _c === void 0 ? void 0 : _c[j]) !== null && _d !== void 0 ? _d : 0) / totalPx) * 100;
|
|
292
|
+
left = Math.max(left, minLeftPct);
|
|
293
|
+
right = Math.max(right, minRightPct);
|
|
294
|
+
// Keep the sum of the pair i/j constant
|
|
295
|
+
const pairSum = left + right;
|
|
296
|
+
const targetSum = this.startSizes[i] + this.startSizes[j];
|
|
297
|
+
if (Math.abs(pairSum - targetSum) > 0.0001) {
|
|
298
|
+
const k = targetSum / (pairSum || 1);
|
|
299
|
+
left *= k;
|
|
300
|
+
right *= k;
|
|
301
|
+
}
|
|
302
|
+
const next = [...this.startSizes];
|
|
303
|
+
next[i] = left;
|
|
304
|
+
next[j] = right;
|
|
305
|
+
this.sizes = next;
|
|
306
|
+
this.applySizes();
|
|
307
|
+
this.sizesChanged.emit([...this.sizes]);
|
|
308
|
+
this.positionGutters();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Stops the dragging process.
|
|
312
|
+
*/
|
|
313
|
+
stopDragging() {
|
|
314
|
+
if (!this.isDragging)
|
|
315
|
+
return;
|
|
316
|
+
this.isDragging = false;
|
|
317
|
+
this.dragIndex = -1;
|
|
318
|
+
this.detachDocumentListeners();
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
/****************************************************************************/
|
|
322
|
+
//#region RENDER
|
|
323
|
+
render() {
|
|
324
|
+
return (h(Host, { key: 'e3b158ff1b4f665862079d245c219102d8b8ccda', "data-dragging": this.isDragging.toString() }, h("slot", { key: 'baa8105a05bf8446d7a31a23cd5276edb320ea2f', name: "pane" }), h("slot", { key: '44afe4f4a220aff45f802218f2618e9305141a9f', name: "gutter" })));
|
|
325
|
+
}
|
|
326
|
+
get el() { return this; }
|
|
327
|
+
static get watchers() { return {
|
|
328
|
+
"sizes": ["onSizesChanged"],
|
|
329
|
+
"direction": ["onDirectionChanged"]
|
|
330
|
+
}; }
|
|
331
|
+
static get style() { return NvSplitStyle0; }
|
|
332
|
+
}, [4, "nv-split", {
|
|
333
|
+
"direction": [513],
|
|
334
|
+
"sizes": [1040],
|
|
335
|
+
"minSizes": [16],
|
|
336
|
+
"gutterSize": [514, "gutter-size"],
|
|
337
|
+
"isDragging": [32],
|
|
338
|
+
"setSizes": [64],
|
|
339
|
+
"getSizes": [64],
|
|
340
|
+
"collapse": [64],
|
|
341
|
+
"destroy": [64]
|
|
342
|
+
}, undefined, {
|
|
343
|
+
"sizes": ["onSizesChanged"],
|
|
344
|
+
"direction": ["onDirectionChanged"]
|
|
345
|
+
}]);
|
|
346
|
+
function defineCustomElement$1() {
|
|
347
|
+
if (typeof customElements === "undefined") {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const components = ["nv-split"];
|
|
351
|
+
components.forEach(tagName => { switch (tagName) {
|
|
352
|
+
case "nv-split":
|
|
353
|
+
if (!customElements.get(tagName)) {
|
|
354
|
+
customElements.define(tagName, NvSplit$1);
|
|
355
|
+
}
|
|
356
|
+
break;
|
|
357
|
+
} });
|
|
358
|
+
}
|
|
359
|
+
defineCustomElement$1();
|
|
360
|
+
|
|
361
|
+
const NvSplit = NvSplit$1;
|
|
362
|
+
const defineCustomElement = defineCustomElement$1;
|
|
363
|
+
|
|
364
|
+
export { NvSplit, defineCustomElement };
|
|
365
|
+
|
|
366
|
+
//# sourceMappingURL=nv-split.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"nv-split.js","mappings":";;AAAA,MAAM,UAAU,GAAG,8wDAA8wD,CAAC;AAClyD,sBAAe,UAAU;;MCsBZA,SAAO;IALpB;;;;;;;;;;;QAiBW,cAAS,GAA8B,YAAY,CAAC;;;;;;QAQ7D,UAAK,GAAa,EAAE,CAAC;;;;;QAeZ,eAAU,GAAW,EAAE,C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AC;QACf,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;QAEhB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,eAAe,EAAE,CAAC;KACxB;;;;IAKO,YAAY;QAClB,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,uBAAuB,EAAE,CAAC;KAChC;;;;IAMD,MAAM;QACJ,QACE,EAAC,IAAI,sEAAgB,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAC7C,6DAAM,IAAI,EAAC,MAAM,GAAQ,EACzB,6DAAM,IAAI,EAAC,QAAQ,GAAQ,CACtB,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["NvSplit"],"sources":["src/components/nv-split/styles/nv-split.scss?tag=nv-split","src/components/nv-split/nv-split.tsx"],"sourcesContent":["@use './mixins' as *;\n@use './variables' as *;\n\nnv-split {\n display: flex;\n width: 100%;\n height: 100%;\n position: relative;\n\n &[direction='horizontal'] {\n flex-direction: row;\n }\n\n &[direction='vertical'] {\n flex-direction: column;\n }\n\n .nv-split-gutter {\n @include split-gutter-base;\n }\n\n &[direction='horizontal'] > .nv-split-gutter {\n @include split-gutter-horizontal;\n }\n\n &[direction='vertical'] > .nv-split-gutter {\n @include split-gutter-vertical;\n }\n\n &[data-dragging='true'] > .nv-split-gutter::after {\n background: $nv-split-line-active-color;\n }\n\n > [slot='pane'] {\n flex: 1 1 auto;\n overflow: hidden;\n min-width: 0;\n min-height: 0;\n display: flex;\n flex-direction: column;\n }\n\n > [slot='pane'] > nv-split {\n flex: 1 1 auto;\n width: 100%;\n height: 100%;\n }\n}\n","import {\n Component,\n Host,\n h,\n Prop,\n Event,\n EventEmitter,\n Element,\n Method,\n State,\n Watch,\n} from '@stencil/core';\n\n/**\n * The `nv-split` component is an advanced layout container that enables the creation of interactively resizable panels. It provides a flexible solution for dividing available space between multiple interface sections, with precise control over dimensions and constraints for each panel.\n * @slot pane - Content of each split pane. Use multiple `<div slot=\"pane\">` elements.\n * @slot gutter - Optional custom content inside every gutter handle.\n */\n@Component({\n tag: 'nv-split',\n styleUrl: 'styles/nv-split.scss',\n shadow: false,\n})\nexport class NvSplit {\n @Element() el: HTMLNvSplitElement;\n\n /****************************************************************************/\n //#region PROPERTIES\n\n /**\n * Direction of the split layout.\n * - `horizontal`: panes side by side\n * - `vertical`: panes stacked\n */\n @Prop({ reflect: true })\n readonly direction: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Initial sizes of the panes in percentages.\n * Example: `[50, 50]` means two equal panes.\n * Explicitly `reflect: false` (array) for framework compatibility.\n */\n @Prop({ mutable: true, reflect: false })\n sizes: number[] = [];\n\n /**\n * Minimum sizes (in px) for each pane.\n * Example: `[100, 200]` => first pane min 100px, second min 200px.\n * Explicitly `reflect: false` (array) for framework compatibility.\n */\n @Prop({ reflect: false })\n readonly minSizes?: number[];\n\n /**\n * Width or height of the gutter (in px) depending on the split direction.\n * Default is 24px to meet WCAG 2.2 target size requirements for touch accessibility.\n */\n @Prop({ reflect: true })\n readonly gutterSize: number = 24;\n\n //#endregion\n /****************************************************************************/\n //#region STATE\n\n @State()\n private isDragging: boolean = false;\n\n private dragIndex: number = -1;\n private startPos: number = 0;\n private startSizes: number[] = [];\n private ro?: ResizeObserver;\n\n // Handlers stored to be able to detach them\n private onDocMove = (ev: MouseEvent) => this.handleMouseMove(ev);\n private onDocUp = () => this.stopDragging();\n\n //#endregion\n /****************************************************************************/\n //#region EVENTS\n\n /**\n * Emitted when pane sizes are updated (either via dragging or programmatically).\n * @bind sizes\n */\n @Event()\n sizesChanged: EventEmitter<number[]>;\n\n //#endregion\n /****************************************************************************/\n //#region WATCHERS\n\n @Watch('sizes')\n protected onSizesChanged(): void {\n // Re-apply sizes if modified from the outside\n this.applySizes();\n }\n\n @Watch('direction')\n protected onDirectionChanged(): void {\n // Update the orientation and the cursors of the gutters\n this.ensureGutters();\n this.applySizes();\n }\n\n //#endregion\n /****************************************************************************/\n //#region LIFECYCLE\n\n componentDidLoad(): void {\n // Initialization (once)\n this.ensureGutters();\n this.applySizes();\n this.positionGutters();\n\n // Observer: reposition gutters when resized (nested or parent split changes)\n this.ro = new ResizeObserver(() => this.positionGutters());\n this.ro.observe(this.el);\n\n window.addEventListener('resize', () => this.positionGutters());\n }\n\n disconnectedCallback(): void {\n // Security cleanup (in case a drag was in progress)\n this.detachDocumentListeners();\n this.ro?.disconnect();\n this.ro = undefined;\n }\n\n //#endregion\n /****************************************************************************/\n //#region PUBLIC METHODS\n\n /**\n * Programmatically set pane sizes.\n * @param {Array<number>} sizes Array of pane sizes in percentages.\n * @returns {Promise<void>}\n */\n @Method()\n async setSizes(sizes: number[]): Promise<void> {\n this.sizes = [...sizes];\n this.applySizes();\n this.sizesChanged.emit([...this.sizes]);\n this.positionGutters();\n }\n\n /**\n * Returns the current pane sizes.\n * @returns {Promise<number[]>} Array of pane sizes in percentages.\n */\n @Method()\n async getSizes(): Promise<number[]> {\n return [...this.sizes];\n }\n\n /**\n * Collapse a specific pane to 0 size.\n * @param {number} index Index of the pane to collapse.\n * @returns {Promise<void>}\n */\n @Method()\n async collapse(index: number): Promise<void> {\n const panes = this.getPanes();\n if (index < 0 || index >= panes.length) return;\n\n // Simple strategy: 0% for the index, the rest (100%) for its nearest neighbor\n const next = new Array(panes.length).fill(0);\n const target = index < panes.length - 1 ? index + 1 : index - 1;\n if (target >= 0) next[target] = 100;\n\n this.sizes = next;\n this.applySizes();\n this.sizesChanged.emit([...this.sizes]);\n this.positionGutters();\n }\n\n /**\n * Destroy the split instance: removes gutters and resets layout state.\n * @returns {Promise<void>}\n */\n @Method()\n async destroy(): Promise<void> {\n this.sizes = [];\n this.isDragging = false;\n this.dragIndex = -1;\n this.removeOwnGutters();\n this.detachDocumentListeners();\n this.ro?.disconnect();\n }\n\n //#endregion\n /****************************************************************************/\n //#region INTERNAL HELPERS\n\n /**\n * Returns the panes of the split.\n * @returns {HTMLElement[]} The panes of the split.\n */\n private getPanes(): HTMLElement[] {\n // Only the direct children slot=\"pane\"\n return Array.from(\n this.el.querySelectorAll<HTMLElement>(':scope > [slot=\"pane\"]'),\n );\n }\n\n /**\n * Returns the own gutters of the split.\n * @returns {HTMLElement[]} The own gutters of the split.\n */\n private getOwnGutters(): HTMLElement[] {\n // Only the direct gutters of THIS instance\n return Array.from(\n this.el.querySelectorAll<HTMLElement>(\n ':scope > .nv-split-gutter[data-auto=\"true\"]',\n ),\n );\n }\n\n /**\n * Removes the own gutters of the split.\n */\n private removeOwnGutters(): void {\n this.getOwnGutters().forEach(g => g.remove());\n }\n\n /**\n * Ensures the gutters of the split.\n */\n private ensureGutters(): void {\n const panes = this.getPanes();\n\n // 1) Clean ONLY the old direct gutters of THIS instance\n this.removeOwnGutters();\n\n if (panes.length <= 1) return;\n\n // 2) Add the gutters (directs) between the panes\n panes.forEach((pane, i) => {\n if (i >= panes.length - 1) return;\n\n const g = document.createElement('div');\n g.className = 'nv-split-gutter';\n g.setAttribute('data-auto', 'true');\n\n if (this.direction === 'horizontal') {\n g.style.width = `${this.gutterSize}px`;\n g.style.cursor = 'col-resize';\n } else {\n g.style.height = `${this.gutterSize}px`;\n g.style.cursor = 'row-resize';\n }\n\n // Customizable internal slot\n const slotEl = document.createElement('slot');\n slotEl.name = 'gutter';\n g.appendChild(slotEl);\n\n // Listener drag (index = gutter between pane i and i+1)\n g.addEventListener('mousedown', (ev: MouseEvent) =>\n this.startDragging(ev, i),\n );\n\n // Insert just after the pane\n pane.insertAdjacentElement('afterend', g);\n });\n\n this.positionGutters();\n }\n\n /**\n * Applies the sizes to the panes.\n */\n private applySizes(): void {\n const panes = this.getPanes();\n const n = panes.length;\n if (n === 0) return;\n\n // Default values if inconsistent\n if (!this.sizes || this.sizes.length !== n) {\n this.sizes = Array(n).fill(100 / n);\n }\n\n panes.forEach((pane, i) => {\n const size = Math.max(0, this.sizes[i] ?? 100 / n);\n // Flex-basis via flex shorthand (https://developer.mozilla.org/en-US/docs/Web/CSS/flex)\n pane.style.flex = `0 0 ${size}%`;\n pane.style.minWidth = '0';\n pane.style.minHeight = '0';\n pane.style.overflow = 'hidden'; // let a nv-split child extend\n pane.style.display = 'flex';\n pane.style.flexDirection = 'column';\n });\n\n this.positionGutters();\n }\n\n /**\n * Attaches the document listeners.\n */\n private attachDocumentListeners(): void {\n document.addEventListener('mousemove', this.onDocMove);\n document.addEventListener('mouseup', this.onDocUp);\n }\n\n /**\n * Detaches the document listeners.\n */\n private detachDocumentListeners(): void {\n document.removeEventListener('mousemove', this.onDocMove);\n document.removeEventListener('mouseup', this.onDocUp);\n }\n\n /**\n * Positions the gutters based on the current sizes of the panes.\n */\n private positionGutters(): void {\n const panes = this.getPanes();\n const gutters = this.getOwnGutters();\n if (panes.length <= 1 || gutters.length === 0) return;\n\n const horizontal = this.direction === 'horizontal';\n let cumPct = 0;\n\n for (let i = 0; i < gutters.length; i++) {\n const sizePct = this.sizes?.[i] ?? 100 / panes.length;\n cumPct += sizePct;\n\n const g = gutters[i];\n g.style.position = 'absolute';\n\n if (horizontal) {\n g.style.left = `${cumPct}%`;\n g.style.top = '0';\n g.style.bottom = '0';\n g.style.height = '100%';\n } else {\n g.style.top = `${cumPct}%`;\n g.style.left = '0';\n g.style.right = '0';\n g.style.width = '100%';\n }\n }\n }\n\n /**\n * Starts the dragging process.\n * @param {MouseEvent} ev - The mouse event.\n * @param {number} index - The index of the gutter.\n */\n private startDragging(ev: MouseEvent, index: number): void {\n this.isDragging = true;\n this.dragIndex = index;\n this.startPos = this.direction === 'horizontal' ? ev.clientX : ev.clientY;\n this.startSizes = [...this.sizes];\n this.attachDocumentListeners();\n }\n\n /**\n * Handles the mouse movement during dragging.\n * @param {MouseEvent} ev - The mouse event.\n */\n private handleMouseMove(ev: MouseEvent): void {\n if (!this.isDragging || this.dragIndex < 0) return;\n\n const panes = this.getPanes();\n if (panes.length < 2) return;\n\n const rect = this.el.getBoundingClientRect();\n\n // Ensure we never divide by zero if the element has zero width/height\n const rawSize = this.direction === 'horizontal' ? rect.width : rect.height;\n const totalPx = Math.max(rawSize, 1);\n\n const deltaPx =\n (this.direction === 'horizontal' ? ev.clientX : ev.clientY) -\n this.startPos;\n const deltaPct = (deltaPx / totalPx) * 100;\n\n const i = this.dragIndex;\n const j = i + 1;\n\n let left = this.startSizes[i] + deltaPct;\n let right = this.startSizes[j] - deltaPct;\n\n // minSizes (px) -> %\n const minLeftPct = ((this.minSizes?.[i] ?? 0) / totalPx) * 100;\n const minRightPct = ((this.minSizes?.[j] ?? 0) / totalPx) * 100;\n\n left = Math.max(left, minLeftPct);\n right = Math.max(right, minRightPct);\n\n // Keep the sum of the pair i/j constant\n const pairSum = left + right;\n const targetSum = this.startSizes[i] + this.startSizes[j];\n if (Math.abs(pairSum - targetSum) > 0.0001) {\n const k = targetSum / (pairSum || 1);\n left *= k;\n right *= k;\n }\n\n const next = [...this.startSizes];\n next[i] = left;\n next[j] = right;\n\n this.sizes = next;\n this.applySizes();\n this.sizesChanged.emit([...this.sizes]);\n this.positionGutters();\n }\n\n /**\n * Stops the dragging process.\n */\n private stopDragging(): void {\n if (!this.isDragging) return;\n this.isDragging = false;\n this.dragIndex = -1;\n this.detachDocumentListeners();\n }\n\n //#endregion\n /****************************************************************************/\n //#region RENDER\n\n render() {\n return (\n <Host data-dragging={this.isDragging.toString()}>\n <slot name=\"pane\"></slot>\n <slot name=\"gutter\"></slot>\n </Host>\n );\n }\n\n //#endregion\n /****************************************************************************/\n}\n"],"version":3}
|
|
@@ -20,7 +20,7 @@ const NvStack$1 = /*@__PURE__*/ proxyCustomElement(class NvStack extends H {
|
|
|
20
20
|
/****************************************************************************/
|
|
21
21
|
//#region RENDER
|
|
22
22
|
render() {
|
|
23
|
-
return (h(Host, { key: '
|
|
23
|
+
return (h(Host, { key: '5922efd8652a14d73e812e85dd6770101e22fe46', class: clsx(this.fill && 'nv-stack-fill', this.flex && 'nv-stack-flex', this.full && 'w-full', this.gutter && !this.vertical && `gap-x-${this.gutter}`, this.gutter && this.vertical && `gap-y-${this.gutter}`, this.vertical && 'nv-stack-vertical') }, h("slot", { key: '71daf4ee34bd57d785203f98799b6ea7c66ffa3b' })));
|
|
24
24
|
}
|
|
25
25
|
static get style() { return NvStackStyle0; }
|
|
26
26
|
}, [4, "nv-stack", {
|