@cas-smartdesign/splitter 0.1.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/LICENSE +8 -0
- package/dist/docs/doc.css +1 -0
- package/dist/docs/doc.mjs +295 -0
- package/dist/docs/index.html +24 -0
- package/dist/splitter-with-externals.js +164 -0
- package/dist/splitter-with-externals.js.map +7 -0
- package/dist/splitter.d.ts +53 -0
- package/dist/splitter.mjs +177 -0
- package/dist/splitter.mjs.map +1 -0
- package/npm-third-party-licenses.json +192 -0
- package/package.json +33 -0
- package/readme.md +72 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class Splitter extends LitElement {
|
|
3
|
+
static readonly ID = "sd-splitter";
|
|
4
|
+
ratio: [number, number];
|
|
5
|
+
private _root;
|
|
6
|
+
private _leftPane;
|
|
7
|
+
private _leftSlot;
|
|
8
|
+
private _rightSlot;
|
|
9
|
+
private _splitterSlot;
|
|
10
|
+
private _defaultSplitter;
|
|
11
|
+
private _leftSlotted?;
|
|
12
|
+
private _rightSlotted?;
|
|
13
|
+
private _customSplitter?;
|
|
14
|
+
private _customSplitterCleanup?;
|
|
15
|
+
_hovering: boolean;
|
|
16
|
+
_dragging: boolean;
|
|
17
|
+
private _resizeObserver;
|
|
18
|
+
private _startX;
|
|
19
|
+
private _startLeftWidth;
|
|
20
|
+
constructor();
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
private _onLeftSlotChange;
|
|
24
|
+
private _onRightSlotChange;
|
|
25
|
+
private _onSplitterSlotChange;
|
|
26
|
+
private _assignSlotted;
|
|
27
|
+
private _enterDragArea;
|
|
28
|
+
private _leaveDragArea;
|
|
29
|
+
private _handleResize;
|
|
30
|
+
private _startDrag;
|
|
31
|
+
private _doDrag;
|
|
32
|
+
private _endDrag;
|
|
33
|
+
private _preventContextMenu;
|
|
34
|
+
private _recomputeRatio;
|
|
35
|
+
private _getAvailableWidth;
|
|
36
|
+
private _getSplitter;
|
|
37
|
+
private _getMinMaxWidth;
|
|
38
|
+
private _setRatio;
|
|
39
|
+
render(): import("lit").TemplateResult<1>;
|
|
40
|
+
static get styles(): import("lit").CSSResult[];
|
|
41
|
+
}
|
|
42
|
+
export declare class SplitterResizedEvent extends Event {
|
|
43
|
+
readonly ratio: [number, number];
|
|
44
|
+
constructor(ratio: [number, number]);
|
|
45
|
+
}
|
|
46
|
+
declare global {
|
|
47
|
+
interface HTMLElementTagNameMap {
|
|
48
|
+
"sd-splitter": Splitter;
|
|
49
|
+
}
|
|
50
|
+
interface HTMLElementEventMap {
|
|
51
|
+
"sd-splitter-resized": SplitterResizedEvent;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { LitElement as m, html as c, css as S, unsafeCSS as y } from "lit";
|
|
2
|
+
import { property as w, query as n, state as h } from "lit/decorators.js";
|
|
3
|
+
import { classMap as b } from "lit/directives/class-map.js";
|
|
4
|
+
import { styleMap as p } from "lit/directives/style-map.js";
|
|
5
|
+
const x = ":host{display:block;--sd-splitter-gap: 0px;--sd-splitter-cursor: ew-resize;--sd-splitter-width: 0px;--sd-splitter-color: transparent;--sd-splitter-handle-width: 5px;--sd-splitter-handle-color: #1467ba}#root{display:flex;height:100%;width:100%;justify-content:space-between;gap:var(--sd-splitter-gap)}.pane{overflow:hidden}::slotted([slot=left]),::slotted([slot=right]){width:100%;height:100%}::slotted([slot=splitter]){flex:none;touch-action:none}#default-splitter{flex:none;touch-action:none;width:var(--sd-splitter-width);position:relative;background-color:var(--sd-splitter-color)}#default-splitter-handle{position:absolute;top:0;left:calc((var(--sd-splitter-width) - var(--sd-splitter-handle-width)) / 2);right:0;bottom:0;width:var(--sd-splitter-handle-width);background-color:var(--sd-splitter-handle-color);opacity:0;transition:opacity .2s}#default-splitter-drag-area{position:absolute;top:0;left:-3px;width:calc(var(--sd-splitter-handle-width) + 6px);bottom:0}#default-splitter-handle.hover,#default-splitter-handle.drag{opacity:1}#default-splitter-handle.hover{transition-delay:.5s}#default-splitter-handle.drag{transition:none}";
|
|
6
|
+
var C = Object.defineProperty, D = Object.getOwnPropertyDescriptor, r = (d, t, e, s) => {
|
|
7
|
+
for (var o = s > 1 ? void 0 : s ? D(t, e) : t, l = d.length - 1, a; l >= 0; l--)
|
|
8
|
+
(a = d[l]) && (o = (s ? a(t, e, o) : a(o)) || o);
|
|
9
|
+
return s && o && C(t, e, o), o;
|
|
10
|
+
};
|
|
11
|
+
const g = class g extends m {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(), this.ratio = [1, 1], this._hovering = !1, this._dragging = !1, this._startX = 0, this._startLeftWidth = 0, this._onLeftSlotChange = () => {
|
|
14
|
+
this._assignSlotted("left", this._leftSlot, (t) => {
|
|
15
|
+
this._leftSlotted = t;
|
|
16
|
+
});
|
|
17
|
+
}, this._onRightSlotChange = () => {
|
|
18
|
+
this._assignSlotted("right", this._rightSlot, (t) => {
|
|
19
|
+
this._rightSlotted = t;
|
|
20
|
+
});
|
|
21
|
+
}, this._onSplitterSlotChange = () => {
|
|
22
|
+
if (this._customSplitterCleanup && (this._customSplitterCleanup(), this._customSplitterCleanup = void 0), this._assignSlotted("splitter", this._splitterSlot, (t) => {
|
|
23
|
+
this._customSplitter = t;
|
|
24
|
+
}), this._customSplitter) {
|
|
25
|
+
const t = this._customSplitter.querySelector(".sd-splitter-drag-area") || this._customSplitter;
|
|
26
|
+
t.addEventListener("pointerenter", this._enterDragArea), t.addEventListener("pointerleave", this._leaveDragArea), t.addEventListener("pointerdown", this._startDrag), this._customSplitterCleanup = () => {
|
|
27
|
+
t.removeEventListener("pointerenter", this._enterDragArea), t.removeEventListener("pointerleave", this._leaveDragArea), t.removeEventListener("pointerdown", this._startDrag);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}, this._enterDragArea = () => {
|
|
31
|
+
this._hovering = !0, this.setAttribute("hovering", "");
|
|
32
|
+
}, this._leaveDragArea = () => {
|
|
33
|
+
this._hovering = !1, this._dragging || this.removeAttribute("hovering");
|
|
34
|
+
}, this._startDrag = (t) => {
|
|
35
|
+
this._dragging = !0, this.setAttribute("dragging", ""), this._startX = t.clientX, this._startLeftWidth = this._leftPane.offsetWidth, window.addEventListener("pointermove", this._doDrag), window.addEventListener("pointerup", this._endDrag), window.addEventListener("contextmenu", this._preventContextMenu), window.document.body.style.cursor = getComputedStyle(this).getPropertyValue("--sd-splitter-cursor"), t.preventDefault();
|
|
36
|
+
}, this._doDrag = (t) => {
|
|
37
|
+
if (!this._dragging)
|
|
38
|
+
return;
|
|
39
|
+
const e = t.clientX - this._startX;
|
|
40
|
+
this._recomputeRatio(this._startLeftWidth + e);
|
|
41
|
+
}, this._endDrag = () => {
|
|
42
|
+
this._dragging = !1, this.removeAttribute("dragging"), this._hovering || this.removeAttribute("hovering"), window.removeEventListener("pointermove", this._doDrag), window.removeEventListener("pointerup", this._endDrag), window.removeEventListener("contextmenu", this._preventContextMenu), window.document.body.style.removeProperty("cursor");
|
|
43
|
+
}, this._preventContextMenu = (t) => {
|
|
44
|
+
t.preventDefault();
|
|
45
|
+
}, this._resizeObserver = new ResizeObserver(() => {
|
|
46
|
+
this._handleResize();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
super.connectedCallback(), this._resizeObserver.observe(this);
|
|
51
|
+
}
|
|
52
|
+
disconnectedCallback() {
|
|
53
|
+
super.disconnectedCallback(), this._resizeObserver.unobserve(this);
|
|
54
|
+
}
|
|
55
|
+
_assignSlotted(t, e, s) {
|
|
56
|
+
e.assignedElements().length > 1 && console.warn(`At most one element can be assigned to slot '${t}' in sd-splitter.`), s(e.assignedElements()[0]);
|
|
57
|
+
}
|
|
58
|
+
_handleResize() {
|
|
59
|
+
!this._leftSlotted || !this._rightSlotted || this._recomputeRatio(this._leftPane.offsetWidth);
|
|
60
|
+
}
|
|
61
|
+
_recomputeRatio(t) {
|
|
62
|
+
const e = this._getAvailableWidth();
|
|
63
|
+
if (e <= 0)
|
|
64
|
+
return;
|
|
65
|
+
const [s, o] = this._getMinMaxWidth(this._leftSlot), [l, a] = this._getMinMaxWidth(this._rightSlot), u = Math.max(s, e - a), v = Math.min(o, e - l), _ = Math.max(u, Math.min(t, v)), f = e - _;
|
|
66
|
+
this._setRatio(_, f);
|
|
67
|
+
}
|
|
68
|
+
_getAvailableWidth() {
|
|
69
|
+
const t = parseFloat(getComputedStyle(this._root).getPropertyValue("gap")) || 0;
|
|
70
|
+
return this.offsetWidth - this._getSplitter().offsetWidth - 2 * t;
|
|
71
|
+
}
|
|
72
|
+
_getSplitter() {
|
|
73
|
+
return this._customSplitter || this._defaultSplitter;
|
|
74
|
+
}
|
|
75
|
+
_getMinMaxWidth(t) {
|
|
76
|
+
const e = getComputedStyle(t.assignedElements()[0]);
|
|
77
|
+
return [parseFloat(e.minWidth) || 0, parseFloat(e.maxWidth) || 1 / 0];
|
|
78
|
+
}
|
|
79
|
+
_setRatio(t, e) {
|
|
80
|
+
const s = t + e;
|
|
81
|
+
if (s === 0)
|
|
82
|
+
return [0.5, 0.5];
|
|
83
|
+
this.ratio = [t / s, e / s], this.dispatchEvent(new L(this.ratio));
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
if (!this._leftSlotted || !this._rightSlotted)
|
|
87
|
+
return c`
|
|
88
|
+
<div id="root">
|
|
89
|
+
<slot name="left" @slotchange=${this._onLeftSlotChange} ?hidden=${!this._leftSlotted}></slot>
|
|
90
|
+
<slot name="splitter" @slotchange=${this._onSplitterSlotChange} ?hidden=${!0}></slot>
|
|
91
|
+
<slot name="right" @slotchange=${this._onRightSlotChange} ?hidden=${!this._rightSlotted}></slot>
|
|
92
|
+
</div>
|
|
93
|
+
`;
|
|
94
|
+
const [t, e] = this.ratio, s = this._hovering ? getComputedStyle(this).getPropertyValue("--sd-splitter-cursor") : "inherit";
|
|
95
|
+
return c`
|
|
96
|
+
<div id="root" style=${p({ cursor: s })}>
|
|
97
|
+
<div id="left" class="pane" style=${p({ flex: t + " " + t + " 0" })}>
|
|
98
|
+
<slot name="left" @slotchange=${this._onLeftSlotChange}></slot>
|
|
99
|
+
</div>
|
|
100
|
+
<slot name="splitter" @slotchange=${this._onSplitterSlotChange}>
|
|
101
|
+
<div id="default-splitter">
|
|
102
|
+
<div
|
|
103
|
+
id="default-splitter-handle"
|
|
104
|
+
class=${b({ hover: this._hovering, drag: this._dragging })}
|
|
105
|
+
>
|
|
106
|
+
<div
|
|
107
|
+
id="default-splitter-drag-area"
|
|
108
|
+
@pointerenter=${this._enterDragArea}
|
|
109
|
+
@pointerleave=${this._leaveDragArea}
|
|
110
|
+
@pointerdown=${this._startDrag}
|
|
111
|
+
></div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</slot>
|
|
115
|
+
<div id="right" class="pane" style=${p({ flex: e + " " + e + " 0" })}>
|
|
116
|
+
<slot name="right" @slotchange=${this._onRightSlotChange}></slot>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
static get styles() {
|
|
122
|
+
return [
|
|
123
|
+
S`
|
|
124
|
+
${y(x)}
|
|
125
|
+
`
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
g.ID = "sd-splitter";
|
|
130
|
+
let i = g;
|
|
131
|
+
r([
|
|
132
|
+
w({ type: Array, reflect: !0 })
|
|
133
|
+
], i.prototype, "ratio", 2);
|
|
134
|
+
r([
|
|
135
|
+
n("#root", !0)
|
|
136
|
+
], i.prototype, "_root", 2);
|
|
137
|
+
r([
|
|
138
|
+
n("#left")
|
|
139
|
+
], i.prototype, "_leftPane", 2);
|
|
140
|
+
r([
|
|
141
|
+
n('slot[name="left"]')
|
|
142
|
+
], i.prototype, "_leftSlot", 2);
|
|
143
|
+
r([
|
|
144
|
+
n('slot[name="right"]')
|
|
145
|
+
], i.prototype, "_rightSlot", 2);
|
|
146
|
+
r([
|
|
147
|
+
n('slot[name="splitter"]')
|
|
148
|
+
], i.prototype, "_splitterSlot", 2);
|
|
149
|
+
r([
|
|
150
|
+
n("#default-splitter")
|
|
151
|
+
], i.prototype, "_defaultSplitter", 2);
|
|
152
|
+
r([
|
|
153
|
+
h()
|
|
154
|
+
], i.prototype, "_leftSlotted", 2);
|
|
155
|
+
r([
|
|
156
|
+
h()
|
|
157
|
+
], i.prototype, "_rightSlotted", 2);
|
|
158
|
+
r([
|
|
159
|
+
h()
|
|
160
|
+
], i.prototype, "_customSplitter", 2);
|
|
161
|
+
r([
|
|
162
|
+
h()
|
|
163
|
+
], i.prototype, "_hovering", 2);
|
|
164
|
+
r([
|
|
165
|
+
h()
|
|
166
|
+
], i.prototype, "_dragging", 2);
|
|
167
|
+
customElements.get(i.ID) || customElements.define(i.ID, i);
|
|
168
|
+
class L extends Event {
|
|
169
|
+
constructor(t) {
|
|
170
|
+
super("sd-splitter-resized", { bubbles: !0, composed: !0 }), this.ratio = t;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
export {
|
|
174
|
+
i as Splitter,
|
|
175
|
+
L as SplitterResizedEvent
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=splitter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitter.mjs","sources":["../splitter.ts"],"sourcesContent":["import { LitElement, html, css, unsafeCSS } from \"lit\";\nimport { customElement, property, query, queryAssignedElements, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { styleMap } from \"lit/directives/style-map.js\";\nimport style from \"./style.scss?inline\";\n\nexport class Splitter extends LitElement {\n public static readonly ID = \"sd-splitter\";\n\n @property({ type: Array, reflect: true })\n ratio: [number, number] = [1, 1];\n\n @query(\"#root\", true)\n private _root: HTMLElement;\n @query(\"#left\")\n private _leftPane: HTMLElement;\n @query('slot[name=\"left\"]')\n private _leftSlot: HTMLSlotElement;\n @query('slot[name=\"right\"]')\n private _rightSlot: HTMLSlotElement;\n @query('slot[name=\"splitter\"]')\n private _splitterSlot: HTMLSlotElement;\n @query(\"#default-splitter\")\n private _defaultSplitter: HTMLElement;\n\n @state()\n private _leftSlotted?: HTMLElement;\n @state()\n private _rightSlotted?: HTMLElement;\n @state()\n private _customSplitter?: HTMLElement;\n private _customSplitterCleanup?: () => void;\n\n @state()\n _hovering: boolean = false;\n @state()\n _dragging: boolean = false;\n\n private _resizeObserver: ResizeObserver;\n private _startX = 0;\n private _startLeftWidth = 0;\n\n constructor() {\n super();\n this._resizeObserver = new ResizeObserver(() => {\n this._handleResize();\n });\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._resizeObserver.observe(this);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this._resizeObserver.unobserve(this);\n }\n\n private _onLeftSlotChange = () => {\n this._assignSlotted(\"left\", this._leftSlot, (element) => {\n this._leftSlotted = element;\n });\n };\n\n private _onRightSlotChange = () => {\n this._assignSlotted(\"right\", this._rightSlot, (element) => {\n this._rightSlotted = element;\n });\n };\n\n private _onSplitterSlotChange = () => {\n if (this._customSplitterCleanup) {\n this._customSplitterCleanup();\n this._customSplitterCleanup = undefined;\n }\n this._assignSlotted(\"splitter\", this._splitterSlot, (element) => {\n this._customSplitter = element;\n });\n if (this._customSplitter) {\n const dragArea = this._customSplitter.querySelector(\".sd-splitter-drag-area\") || this._customSplitter;\n dragArea.addEventListener(\"pointerenter\", this._enterDragArea);\n dragArea.addEventListener(\"pointerleave\", this._leaveDragArea);\n dragArea.addEventListener(\"pointerdown\", this._startDrag);\n this._customSplitterCleanup = () => {\n dragArea.removeEventListener(\"pointerenter\", this._enterDragArea);\n dragArea.removeEventListener(\"pointerleave\", this._leaveDragArea);\n dragArea.removeEventListener(\"pointerdown\", this._startDrag);\n };\n }\n };\n\n private _assignSlotted(slotName: string, slot: HTMLSlotElement, assignment: (HTMLElement) => void) {\n const numAssignedElements = slot.assignedElements().length;\n if (numAssignedElements > 1) {\n console.warn(`At most one element can be assigned to slot '${slotName}' in sd-splitter.`);\n }\n assignment(slot.assignedElements()[0] as HTMLElement);\n }\n\n private _enterDragArea = () => {\n this._hovering = true;\n this.setAttribute(\"hovering\", \"\");\n };\n\n private _leaveDragArea = () => {\n this._hovering = false;\n if (!this._dragging) {\n this.removeAttribute(\"hovering\");\n }\n };\n\n private _handleResize() {\n if (!this._leftSlotted || !this._rightSlotted) {\n return;\n }\n this._recomputeRatio(this._leftPane.offsetWidth);\n }\n\n private _startDrag = (e: PointerEvent) => {\n this._dragging = true;\n this.setAttribute(\"dragging\", \"\");\n this._startX = e.clientX;\n this._startLeftWidth = this._leftPane.offsetWidth;\n window.addEventListener(\"pointermove\", this._doDrag);\n window.addEventListener(\"pointerup\", this._endDrag);\n window.addEventListener(\"contextmenu\", this._preventContextMenu);\n window.document.body.style.cursor = getComputedStyle(this).getPropertyValue(\"--sd-splitter-cursor\");\n e.preventDefault();\n };\n\n private _doDrag = (e: PointerEvent) => {\n if (!this._dragging) {\n return;\n }\n const deltaX = e.clientX - this._startX;\n this._recomputeRatio(this._startLeftWidth + deltaX);\n };\n\n private _endDrag = () => {\n this._dragging = false;\n this.removeAttribute(\"dragging\");\n if (!this._hovering) {\n this.removeAttribute(\"hovering\");\n }\n window.removeEventListener(\"pointermove\", this._doDrag);\n window.removeEventListener(\"pointerup\", this._endDrag);\n window.removeEventListener(\"contextmenu\", this._preventContextMenu);\n window.document.body.style.removeProperty(\"cursor\");\n };\n\n private _preventContextMenu = (e: PointerEvent) => {\n e.preventDefault();\n };\n\n private _recomputeRatio(leftWidth: number) {\n const availableWidth = this._getAvailableWidth();\n if (availableWidth <= 0) {\n return;\n }\n const [minLeft, maxLeft] = this._getMinMaxWidth(this._leftSlot);\n const [minRight, maxRight] = this._getMinMaxWidth(this._rightSlot);\n const effectiveMinLeft = Math.max(minLeft, availableWidth - maxRight);\n const effectiveMaxLeft = Math.min(maxLeft, availableWidth - minRight);\n const newLeftWidth = Math.max(effectiveMinLeft, Math.min(leftWidth, effectiveMaxLeft));\n const newRightWidth = availableWidth - newLeftWidth;\n this._setRatio(newLeftWidth, newRightWidth);\n }\n\n private _getAvailableWidth(): number {\n const gap = parseFloat(getComputedStyle(this._root).getPropertyValue(\"gap\")) || 0;\n return this.offsetWidth - this._getSplitter().offsetWidth - 2 * gap;\n }\n\n private _getSplitter(): HTMLElement {\n return this._customSplitter || this._defaultSplitter;\n }\n\n private _getMinMaxWidth(slot: HTMLSlotElement): [number, number] {\n const style = getComputedStyle(slot.assignedElements()[0]);\n return [parseFloat(style.minWidth) || 0, parseFloat(style.maxWidth) || Infinity];\n }\n\n private _setRatio(leftWidth: number, rightWidth: number) {\n const sum = leftWidth + rightWidth;\n if (sum === 0) {\n return [0.5, 0.5];\n }\n this.ratio = [leftWidth / sum, rightWidth / sum];\n this.dispatchEvent(new SplitterResizedEvent(this.ratio));\n }\n\n render() {\n if (!this._leftSlotted || !this._rightSlotted) {\n return html`\n <div id=\"root\">\n <slot name=\"left\" @slotchange=${this._onLeftSlotChange} ?hidden=${!this._leftSlotted}></slot>\n <slot name=\"splitter\" @slotchange=${this._onSplitterSlotChange} ?hidden=${true}></slot>\n <slot name=\"right\" @slotchange=${this._onRightSlotChange} ?hidden=${!this._rightSlotted}></slot>\n </div>\n `;\n }\n const [leftRatio, rightRatio] = this.ratio;\n const cursor = this._hovering ? getComputedStyle(this).getPropertyValue(\"--sd-splitter-cursor\") : \"inherit\";\n return html`\n <div id=\"root\" style=${styleMap({ cursor })}>\n <div id=\"left\" class=\"pane\" style=${styleMap({ flex: leftRatio + \" \" + leftRatio + \" 0\" })}>\n <slot name=\"left\" @slotchange=${this._onLeftSlotChange}></slot>\n </div>\n <slot name=\"splitter\" @slotchange=${this._onSplitterSlotChange}>\n <div id=\"default-splitter\">\n <div\n id=\"default-splitter-handle\"\n class=${classMap({ hover: this._hovering, drag: this._dragging })}\n >\n <div\n id=\"default-splitter-drag-area\"\n @pointerenter=${this._enterDragArea}\n @pointerleave=${this._leaveDragArea}\n @pointerdown=${this._startDrag}\n ></div>\n </div>\n </div>\n </slot>\n <div id=\"right\" class=\"pane\" style=${styleMap({ flex: rightRatio + \" \" + rightRatio + \" 0\" })}>\n <slot name=\"right\" @slotchange=${this._onRightSlotChange}></slot>\n </div>\n </div>\n `;\n }\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n}\n\nif (!customElements.get(Splitter.ID)) {\n customElements.define(Splitter.ID, Splitter);\n}\n\nexport class SplitterResizedEvent extends Event {\n readonly ratio: [number, number];\n constructor(ratio: [number, number]) {\n super(\"sd-splitter-resized\", { bubbles: true, composed: true });\n this.ratio = ratio;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"sd-splitter\": Splitter;\n }\n interface HTMLElementEventMap {\n \"sd-splitter-resized\": SplitterResizedEvent;\n }\n}\n"],"names":["_Splitter","LitElement","element","dragArea","e","deltaX","slotName","slot","assignment","leftWidth","availableWidth","minLeft","maxLeft","minRight","maxRight","effectiveMinLeft","effectiveMaxLeft","newLeftWidth","newRightWidth","gap","style","rightWidth","sum","SplitterResizedEvent","html","leftRatio","rightRatio","cursor","styleMap","classMap","css","unsafeCSS","Splitter","__decorateClass","property","query","state","ratio"],"mappings":";;;;;;;;;;AAMO,MAAMA,IAAN,MAAMA,UAAiBC,EAAW;AAAA,EAoCrC,cAAc;AACJ,aAjCgB,KAAA,QAAA,CAAC,GAAG,CAAC,GAwBV,KAAA,YAAA,IAEA,KAAA,YAAA,IAGrB,KAAQ,UAAU,GAClB,KAAQ,kBAAkB,GAmB1B,KAAQ,oBAAoB,MAAM;AAC9B,WAAK,eAAe,QAAQ,KAAK,WAAW,CAACC,MAAY;AACrD,aAAK,eAAeA;AAAA,MAAA,CACvB;AAAA,IAAA,GAGL,KAAQ,qBAAqB,MAAM;AAC/B,WAAK,eAAe,SAAS,KAAK,YAAY,CAACA,MAAY;AACvD,aAAK,gBAAg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AAM,mBAAmB;AAAA,GAhBjBH,EAiBD,WAAA,oBAAA,CAAA;AAGAC,EAAA;AAAA,EADPG,EAAM;AAAA,GAnBEJ,EAoBD,WAAA,gBAAA,CAAA;AAEAC,EAAA;AAAA,EADPG,EAAM;AAAA,GArBEJ,EAsBD,WAAA,iBAAA,CAAA;AAEAC,EAAA;AAAA,EADPG,EAAM;AAAA,GAvBEJ,EAwBD,WAAA,mBAAA,CAAA;AAIRC,EAAA;AAAA,EADCG,EAAM;AAAA,GA3BEJ,EA4BT,WAAA,aAAA,CAAA;AAEAC,EAAA;AAAA,EADCG,EAAM;AAAA,GA7BEJ,EA8BT,WAAA,aAAA,CAAA;AA4MC,eAAe,IAAIA,EAAS,EAAE,KAChB,eAAA,OAAOA,EAAS,IAAIA,CAAQ;AAGxC,MAAMT,UAA6B,MAAM;AAAA,EAE5C,YAAYc,GAAyB;AACjC,UAAM,uBAAuB,EAAE,SAAS,IAAM,UAAU,IAAM,GAC9D,KAAK,QAAQA;AAAA,EACjB;AACJ;"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@cypress/vite-dev-server@5.0.7": {
|
|
3
|
+
"licenses": "MIT",
|
|
4
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
5
|
+
"licenseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
|
|
6
|
+
},
|
|
7
|
+
"@rollup/plugin-node-resolve@15.2.3": {
|
|
8
|
+
"licenses": "MIT",
|
|
9
|
+
"repository": "https://github.com/rollup/plugins",
|
|
10
|
+
"licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
|
|
11
|
+
},
|
|
12
|
+
"@types/node@20.10.6": {
|
|
13
|
+
"licenses": "MIT",
|
|
14
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
15
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
16
|
+
},
|
|
17
|
+
"@types/postcss-prefix-selector@1.16.3": {
|
|
18
|
+
"licenses": "MIT",
|
|
19
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
20
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
21
|
+
},
|
|
22
|
+
"@typescript-eslint/eslint-plugin@6.17.0": {
|
|
23
|
+
"licenses": "MIT",
|
|
24
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
25
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
26
|
+
},
|
|
27
|
+
"@typescript-eslint/parser@6.17.0": {
|
|
28
|
+
"licenses": "BSD-2-Clause",
|
|
29
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
30
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
31
|
+
},
|
|
32
|
+
"@vitest/coverage-v8@1.1.1": {
|
|
33
|
+
"licenses": "MIT",
|
|
34
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
35
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
36
|
+
},
|
|
37
|
+
"@vitest/ui@1.1.1": {
|
|
38
|
+
"licenses": "MIT",
|
|
39
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
40
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
41
|
+
},
|
|
42
|
+
"axe-core@4.8.3": {
|
|
43
|
+
"licenses": "MPL-2.0",
|
|
44
|
+
"repository": "https://github.com/dequelabs/axe-core",
|
|
45
|
+
"licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
|
|
46
|
+
},
|
|
47
|
+
"cypress-axe@1.5.0": {
|
|
48
|
+
"licenses": "MIT",
|
|
49
|
+
"repository": "https://github.com/component-driven/cypress-axe",
|
|
50
|
+
"licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
|
|
51
|
+
},
|
|
52
|
+
"cypress-real-events@1.13.0": {
|
|
53
|
+
"licenses": "MIT",
|
|
54
|
+
"repository": "https://github.com/dmtrKovalenko/cypress-real-events",
|
|
55
|
+
"licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
|
|
56
|
+
},
|
|
57
|
+
"cypress@13.6.2": {
|
|
58
|
+
"licenses": "MIT",
|
|
59
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
60
|
+
"licenseUrl": "https://cypress.io"
|
|
61
|
+
},
|
|
62
|
+
"esbuild@0.19.11": {
|
|
63
|
+
"licenses": "MIT",
|
|
64
|
+
"repository": "https://github.com/evanw/esbuild",
|
|
65
|
+
"licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
|
|
66
|
+
},
|
|
67
|
+
"eslint-config-google@0.14.0": {
|
|
68
|
+
"licenses": "Apache-2.0",
|
|
69
|
+
"repository": "https://github.com/google/eslint-config-google",
|
|
70
|
+
"licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
|
|
71
|
+
},
|
|
72
|
+
"eslint-config-prettier@9.1.0": {
|
|
73
|
+
"licenses": "MIT",
|
|
74
|
+
"repository": "https://github.com/prettier/eslint-config-prettier",
|
|
75
|
+
"licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
|
|
76
|
+
},
|
|
77
|
+
"eslint@8.56.0": {
|
|
78
|
+
"licenses": "MIT",
|
|
79
|
+
"repository": "https://github.com/eslint/eslint",
|
|
80
|
+
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
81
|
+
},
|
|
82
|
+
"github-markdown-css@5.5.0": {
|
|
83
|
+
"licenses": "MIT",
|
|
84
|
+
"repository": "https://github.com/sindresorhus/github-markdown-css",
|
|
85
|
+
"licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
|
|
86
|
+
},
|
|
87
|
+
"highlight.js@11.9.0": {
|
|
88
|
+
"licenses": "BSD-3-Clause",
|
|
89
|
+
"repository": "https://github.com/highlightjs/highlight.js",
|
|
90
|
+
"licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
|
|
91
|
+
},
|
|
92
|
+
"junit-report-builder@3.1.0": {
|
|
93
|
+
"licenses": "MIT",
|
|
94
|
+
"repository": "https://github.com/davidparsson/junit-report-builder",
|
|
95
|
+
"licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
|
|
96
|
+
},
|
|
97
|
+
"lint-staged@15.2.0": {
|
|
98
|
+
"licenses": "MIT",
|
|
99
|
+
"repository": "https://github.com/okonet/lint-staged",
|
|
100
|
+
"licenseUrl": "https://github.com/okonet/lint-staged/raw/HEAD/LICENSE"
|
|
101
|
+
},
|
|
102
|
+
"lit@2.8.0": {
|
|
103
|
+
"licenses": "BSD-3-Clause",
|
|
104
|
+
"repository": "https://github.com/lit/lit",
|
|
105
|
+
"licenseUrl": "https://github.com/lit/lit/raw/HEAD/LICENSE"
|
|
106
|
+
},
|
|
107
|
+
"marked@11.1.1": {
|
|
108
|
+
"licenses": "MIT",
|
|
109
|
+
"repository": "https://github.com/markedjs/marked",
|
|
110
|
+
"licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
|
|
111
|
+
},
|
|
112
|
+
"postcss-prefix-selector@1.16.0": {
|
|
113
|
+
"licenses": "MIT",
|
|
114
|
+
"repository": "https://github.com/RadValentin/postcss-prefix-selector",
|
|
115
|
+
"licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
|
|
116
|
+
},
|
|
117
|
+
"postcss@8.4.32": {
|
|
118
|
+
"licenses": "MIT",
|
|
119
|
+
"repository": "https://github.com/postcss/postcss",
|
|
120
|
+
"licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
|
|
121
|
+
},
|
|
122
|
+
"prettier@3.1.1": {
|
|
123
|
+
"licenses": "MIT",
|
|
124
|
+
"repository": "https://github.com/prettier/prettier",
|
|
125
|
+
"licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
|
|
126
|
+
},
|
|
127
|
+
"resolve-pkg@2.0.0": {
|
|
128
|
+
"licenses": "MIT",
|
|
129
|
+
"repository": "https://github.com/sindresorhus/resolve-pkg",
|
|
130
|
+
"licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
|
|
131
|
+
},
|
|
132
|
+
"sass@1.69.6": {
|
|
133
|
+
"licenses": "MIT",
|
|
134
|
+
"repository": "https://github.com/sass/dart-sass",
|
|
135
|
+
"licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
|
|
136
|
+
},
|
|
137
|
+
"stylelint-config-recommended-scss@14.0.0": {
|
|
138
|
+
"licenses": "MIT",
|
|
139
|
+
"repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
|
|
140
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
|
|
141
|
+
},
|
|
142
|
+
"stylelint-config-standard@36.0.0": {
|
|
143
|
+
"licenses": "MIT",
|
|
144
|
+
"repository": "https://github.com/stylelint/stylelint-config-standard",
|
|
145
|
+
"licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
|
|
146
|
+
},
|
|
147
|
+
"stylelint-scss@6.0.0": {
|
|
148
|
+
"licenses": "MIT",
|
|
149
|
+
"repository": "https://github.com/stylelint-scss/stylelint-scss",
|
|
150
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
|
|
151
|
+
},
|
|
152
|
+
"stylelint@16.1.0": {
|
|
153
|
+
"licenses": "MIT",
|
|
154
|
+
"repository": "https://github.com/stylelint/stylelint",
|
|
155
|
+
"licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
|
|
156
|
+
},
|
|
157
|
+
"tsup@8.0.1": {
|
|
158
|
+
"licenses": "MIT",
|
|
159
|
+
"repository": "https://github.com/egoist/tsup",
|
|
160
|
+
"licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
|
|
161
|
+
},
|
|
162
|
+
"turbo@1.11.2": {
|
|
163
|
+
"licenses": "MPL-2.0",
|
|
164
|
+
"repository": "https://github.com/vercel/turbo",
|
|
165
|
+
"licenseUrl": "https://github.com/vercel/turbo/raw/HEAD/LICENSE"
|
|
166
|
+
},
|
|
167
|
+
"typescript@5.3.3": {
|
|
168
|
+
"licenses": "Apache-2.0",
|
|
169
|
+
"repository": "https://github.com/Microsoft/TypeScript",
|
|
170
|
+
"licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
|
|
171
|
+
},
|
|
172
|
+
"vite-tsconfig-paths@4.2.3": {
|
|
173
|
+
"licenses": "MIT",
|
|
174
|
+
"repository": "https://github.com/aleclarson/vite-tsconfig-paths",
|
|
175
|
+
"licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
|
|
176
|
+
},
|
|
177
|
+
"vite@5.0.10": {
|
|
178
|
+
"licenses": "MIT",
|
|
179
|
+
"repository": "https://github.com/vitejs/vite",
|
|
180
|
+
"licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
|
|
181
|
+
},
|
|
182
|
+
"vitest@1.1.1": {
|
|
183
|
+
"licenses": "MIT",
|
|
184
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
185
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
|
|
186
|
+
},
|
|
187
|
+
"yargs@17.7.2": {
|
|
188
|
+
"licenses": "MIT",
|
|
189
|
+
"repository": "https://github.com/yargs/yargs",
|
|
190
|
+
"licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
|
|
191
|
+
}
|
|
192
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cas-smartdesign/splitter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A draggable splitter layout for displaying two panels side by side",
|
|
5
|
+
"main": "dist/splitter-with-externals.js",
|
|
6
|
+
"module": "dist/splitter.mjs",
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
8
|
+
"types": "dist/splitter.d.ts",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"lit": "^2.8.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@cas-smartdesign/license-generator": "^1.6.3",
|
|
14
|
+
"@cas-smartdesign/element-preview": "^0.2.2"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"npm-third-party-licenses.json"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"registry": "https://registry.npmjs.org/",
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"version": "pnpm version",
|
|
26
|
+
"generate-declaration": "tsc -p tsconfig.types.json",
|
|
27
|
+
"build:no-license": "vite build && pnpm generate-declaration && vite build --mode documentation",
|
|
28
|
+
"build": "pnpm generate-license && pnpm build:no-license",
|
|
29
|
+
"watch": "vite build --watch",
|
|
30
|
+
"dev": "vite",
|
|
31
|
+
"generate-license": "sd-license-generator --r ../../"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @cas-smartdesign/splitter
|
|
2
|
+
|
|
3
|
+
A draggable splitter layout for displaying 2 panels side by side.
|
|
4
|
+
|
|
5
|
+
An initial ratio can be configured but the user is able to move the
|
|
6
|
+
splitter and therefore resize the panels.
|
|
7
|
+
|
|
8
|
+
The splitter takes the `min-width` and `max-width` CSS styles on the
|
|
9
|
+
slotted elements into account but might not be able to uphold all size
|
|
10
|
+
restrictions at the same time.
|
|
11
|
+
|
|
12
|
+
## Slots
|
|
13
|
+
|
|
14
|
+
- `left`
|
|
15
|
+
- The left panel.
|
|
16
|
+
- Supports at most one assigned element.
|
|
17
|
+
- `right`
|
|
18
|
+
- The right panel.
|
|
19
|
+
- Supports at most one assigned element.
|
|
20
|
+
- `splitter`
|
|
21
|
+
- Can be used to assigned a custom splitter element.
|
|
22
|
+
- Supports at most one assigned element.
|
|
23
|
+
- The assigned splitter element should have a fixed width.
|
|
24
|
+
- The assigned splitter element can contain an element with the class `sd-splitter-drag-area`.
|
|
25
|
+
This element is then used for dragging the splitter.
|
|
26
|
+
If there is no such element, then the entire splitter element serves as the drag area.
|
|
27
|
+
|
|
28
|
+
## Attributes
|
|
29
|
+
|
|
30
|
+
- `ratio` **_[number, number] (default=[1, 1])_**
|
|
31
|
+
- A tuple of 2 numbers defining the width ratio of the 2 panels.
|
|
32
|
+
This attribute is kept in sync with the actual ratio by the
|
|
33
|
+
component implementation.
|
|
34
|
+
- `hovering` **_boolean_ (default=false)**
|
|
35
|
+
- Read-only attribute to indicate when the cursor is hovering over the splitter's drag area.
|
|
36
|
+
- Useful for styling custom splitters.
|
|
37
|
+
- `dragging` **_boolean_ (default=false)**
|
|
38
|
+
- Read-only attribute to indicate when the splitter is being dragged.
|
|
39
|
+
- Useful for styling custom splitters.
|
|
40
|
+
|
|
41
|
+
## Properties
|
|
42
|
+
|
|
43
|
+
- `ratio`
|
|
44
|
+
- Reflects the corresponding attribute.
|
|
45
|
+
|
|
46
|
+
## CSS Custom Properties
|
|
47
|
+
|
|
48
|
+
The following custom properties are always considered:
|
|
49
|
+
|
|
50
|
+
- `--sd-splitter-gap`
|
|
51
|
+
- Additional gap separating the splitter from the left and right panels (default: 0px).
|
|
52
|
+
- `--sd-splitter-cursor`
|
|
53
|
+
- The cursor to display when the user interacts with the splitter (default: ew-resize).
|
|
54
|
+
|
|
55
|
+
The following custom properties only affect the default splitter (i.e., when the `splitter` slot is not assigned):
|
|
56
|
+
|
|
57
|
+
- `--sd-splitter-width`
|
|
58
|
+
- The visible width of the splitter between the 2 panels (default: 0px).
|
|
59
|
+
- `--sd-splitter-color`
|
|
60
|
+
- The splitter color in case its width is set to a non-zero value (default: transparent).
|
|
61
|
+
- `--sd-splitter-handle-width`
|
|
62
|
+
- The width of the handle which the user has to drag for moving the splitter (default: 5px).
|
|
63
|
+
- `--sd-splitter-handle-color`
|
|
64
|
+
- The color of the handle when the user interacts with it, i.e., during hover and drag (default: #1467ba).
|
|
65
|
+
|
|
66
|
+
## Custom events
|
|
67
|
+
|
|
68
|
+
- `sd-splitter-resized`
|
|
69
|
+
- Fired when the ratio is changed / updated. This is generally the case when
|
|
70
|
+
1. The component is rendered for the 1st time.
|
|
71
|
+
2. The size of the overall splitter layout changes.
|
|
72
|
+
3. The user drags the splitter.
|