@spectrum-web-components/split-view 0.39.3 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -0
- package/custom-elements.json +26 -1
- package/package.json +4 -4
- package/src/SplitView.d.ts +2 -0
- package/src/SplitView.dev.js +26 -3
- package/src/SplitView.dev.js.map +2 -2
- package/src/SplitView.js +9 -6
- package/src/SplitView.js.map +3 -3
- package/src/spectrum-split-view.css.dev.js +157 -66
- package/src/spectrum-split-view.css.dev.js.map +2 -2
- package/src/spectrum-split-view.css.js +157 -66
- package/src/spectrum-split-view.css.js.map +2 -2
- package/src/split-view.css.dev.js +157 -66
- package/src/split-view.css.dev.js.map +2 -2
- package/src/split-view.css.js +157 -66
- package/src/split-view.css.js.map +2 -2
package/README.md
CHANGED
@@ -182,3 +182,7 @@ import { SplitView } from '@spectrum-web-components/split-view';
|
|
182
182
|
</div>
|
183
183
|
</sp-split-view>
|
184
184
|
```
|
185
|
+
|
186
|
+
## Accessibility
|
187
|
+
|
188
|
+
By default, the "separator" element within an `<sp-split-view>` is given the label "Resize the panels". A label is required to surface the interaction correctly to screen readers. You can customize or internationalize this with the `label` attribute.
|
package/custom-elements.json
CHANGED
@@ -32,6 +32,14 @@
|
|
32
32
|
}
|
33
33
|
],
|
34
34
|
"members": [
|
35
|
+
{
|
36
|
+
"kind": "field",
|
37
|
+
"name": "controlledEl",
|
38
|
+
"type": {
|
39
|
+
"text": "HTMLElement | undefined"
|
40
|
+
},
|
41
|
+
"privacy": "public"
|
42
|
+
},
|
35
43
|
{
|
36
44
|
"kind": "field",
|
37
45
|
"name": "vertical",
|
@@ -244,6 +252,15 @@
|
|
244
252
|
"privacy": "private",
|
245
253
|
"readonly": true
|
246
254
|
},
|
255
|
+
{
|
256
|
+
"kind": "field",
|
257
|
+
"name": "controlledElIDApplied",
|
258
|
+
"type": {
|
259
|
+
"text": "boolean"
|
260
|
+
},
|
261
|
+
"privacy": "private",
|
262
|
+
"default": "false"
|
263
|
+
},
|
247
264
|
{
|
248
265
|
"kind": "method",
|
249
266
|
"name": "onContentSlotChange",
|
@@ -252,7 +269,15 @@
|
|
252
269
|
"type": {
|
253
270
|
"text": "void"
|
254
271
|
}
|
255
|
-
}
|
272
|
+
},
|
273
|
+
"parameters": [
|
274
|
+
{
|
275
|
+
"name": "event",
|
276
|
+
"type": {
|
277
|
+
"text": "Event & { target: HTMLSlotElement }"
|
278
|
+
}
|
279
|
+
}
|
280
|
+
]
|
256
281
|
},
|
257
282
|
{
|
258
283
|
"kind": "method",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@spectrum-web-components/split-view",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.40.0",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -61,10 +61,10 @@
|
|
61
61
|
"lit-html"
|
62
62
|
],
|
63
63
|
"dependencies": {
|
64
|
-
"@spectrum-web-components/base": "^0.
|
64
|
+
"@spectrum-web-components/base": "^0.40.0"
|
65
65
|
},
|
66
66
|
"devDependencies": {
|
67
|
-
"@spectrum-css/splitview": "^
|
67
|
+
"@spectrum-css/splitview": "^4.0.5"
|
68
68
|
},
|
69
69
|
"types": "./src/index.d.ts",
|
70
70
|
"customElements": "custom-elements.json",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"./sp-*.js",
|
73
73
|
"./**/*.dev.js"
|
74
74
|
],
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "24d5569a839da94892ecfd125428779587ffb1f5"
|
76
76
|
}
|
package/src/SplitView.d.ts
CHANGED
@@ -7,6 +7,7 @@ import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from
|
|
7
7
|
*/
|
8
8
|
export declare class SplitView extends SpectrumElement {
|
9
9
|
static get styles(): CSSResultArray;
|
10
|
+
controlledEl?: HTMLElement;
|
10
11
|
vertical: boolean;
|
11
12
|
resizable: boolean;
|
12
13
|
collapsible: boolean;
|
@@ -48,6 +49,7 @@ export declare class SplitView extends SpectrumElement {
|
|
48
49
|
**/
|
49
50
|
get splitterSize(): number;
|
50
51
|
protected render(): TemplateResult;
|
52
|
+
private controlledElIDApplied;
|
51
53
|
private onContentSlotChange;
|
52
54
|
private onPointerdown;
|
53
55
|
private onPointermove;
|
package/src/SplitView.dev.js
CHANGED
@@ -21,7 +21,8 @@ import {
|
|
21
21
|
} from "@spectrum-web-components/base/src/directives.js";
|
22
22
|
import {
|
23
23
|
property,
|
24
|
-
query
|
24
|
+
query,
|
25
|
+
state
|
25
26
|
} from "@spectrum-web-components/base/src/decorators.js";
|
26
27
|
import { streamingListener } from "@spectrum-web-components/base/src/streaming-listener.js";
|
27
28
|
import styles from "./split-view.css.js";
|
@@ -46,6 +47,7 @@ export class SplitView extends SpectrumElement {
|
|
46
47
|
this.offset = 0;
|
47
48
|
this.minPos = 0;
|
48
49
|
this.maxPos = DEFAULT_MAX_SIZE;
|
50
|
+
this.controlledElIDApplied = false;
|
49
51
|
const RO = window.ResizeObserver;
|
50
52
|
if (RO) {
|
51
53
|
this.observer = new RO(() => {
|
@@ -83,6 +85,7 @@ export class SplitView extends SpectrumElement {
|
|
83
85
|
return this._splitterSize;
|
84
86
|
}
|
85
87
|
render() {
|
88
|
+
var _a, _b;
|
86
89
|
const splitterClasses = {
|
87
90
|
"is-resized-start": this.splitterPos === this.minPos,
|
88
91
|
"is-resized-end": this.splitterPos && this.splitterPos > this.splitterSize && this.splitterPos === this.maxPos,
|
@@ -92,8 +95,12 @@ export class SplitView extends SpectrumElement {
|
|
92
95
|
this.viewSize - this.splitterSize
|
93
96
|
)
|
94
97
|
};
|
98
|
+
const label = this.label || this.resizable ? "Resize the panels" : void 0;
|
95
99
|
return html`
|
96
100
|
<slot
|
101
|
+
id=${ifDefined(
|
102
|
+
this.resizable ? (_a = this.controlledEl) == null ? void 0 : _a.id : void 0
|
103
|
+
)}
|
97
104
|
@slotchange=${this.onContentSlotChange}
|
98
105
|
style="--spectrum-split-view-first-pane-size: ${this.firstPaneSize}"
|
99
106
|
></slot>
|
@@ -102,7 +109,11 @@ export class SplitView extends SpectrumElement {
|
|
102
109
|
id="splitter"
|
103
110
|
class=${classMap(splitterClasses)}
|
104
111
|
role="separator"
|
105
|
-
aria-
|
112
|
+
aria-controls=${ifDefined(
|
113
|
+
this.resizable ? (_b = this.controlledEl) == null ? void 0 : _b.id : void 0
|
114
|
+
)}
|
115
|
+
aria-label=${ifDefined(label)}
|
116
|
+
aria-orientation=${this.vertical ? "horizontal" : "vertical"}
|
106
117
|
aria-valuenow=${Math.round(
|
107
118
|
parseFloat(this.firstPaneSize) / this.viewSize * 100
|
108
119
|
)}
|
@@ -130,7 +141,16 @@ export class SplitView extends SpectrumElement {
|
|
130
141
|
` : nothing}
|
131
142
|
`;
|
132
143
|
}
|
133
|
-
onContentSlotChange() {
|
144
|
+
onContentSlotChange(event) {
|
145
|
+
if (this.controlledEl && this.controlledElIDApplied) {
|
146
|
+
this.controlledEl.removeAttribute("id");
|
147
|
+
this.controlledElIDApplied = false;
|
148
|
+
}
|
149
|
+
this.controlledEl = event.target.assignedElements()[0];
|
150
|
+
if (this.controlledEl && !this.controlledEl.id) {
|
151
|
+
this.controlledEl.id = `${this.tagName.toLowerCase()}-${crypto.randomUUID().slice(0, 8)}`;
|
152
|
+
this.controlledElIDApplied = true;
|
153
|
+
}
|
134
154
|
this.enoughChildren = this.children.length > 1;
|
135
155
|
this.checkResize();
|
136
156
|
}
|
@@ -299,6 +319,9 @@ export class SplitView extends SpectrumElement {
|
|
299
319
|
}
|
300
320
|
}
|
301
321
|
}
|
322
|
+
__decorateClass([
|
323
|
+
state()
|
324
|
+
], SplitView.prototype, "controlledEl", 2);
|
302
325
|
__decorateClass([
|
303
326
|
property({ type: Boolean, reflect: true })
|
304
327
|
], SplitView.prototype, "vertical", 2);
|
package/src/SplitView.dev.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["SplitView.ts"],
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n LitElement,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\n\nimport { WithSWCResizeObserver } from './types';\n\nimport styles from './split-view.css.js';\n\nconst DEFAULT_MAX_SIZE = 3840;\n\nconst SPLITTERSIZE = 2;\n\nconst ARROW_KEY_CHANGE_VALUE = 10;\n\nconst PAGEUPDOWN_KEY_CHANGE_VALUE = 50;\n\nconst COLLAPSE_THREASHOLD = 50;\n\n/**\n * @element sp-split-view\n *\n * @slot Two sibling elements to be sized by the element attritubes\n * @fires change - Announces the new position of the splitter\n */\nexport class SplitView extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n @property({ type: Boolean, reflect: true })\n public resizable = false;\n\n @property({ type: Boolean, reflect: true })\n public collapsible = false;\n\n /** The minimum size of the primary pane */\n @property({ type: Number, attribute: 'primary-min' })\n public primaryMin = 0;\n\n /** The maximum size of the primary pane */\n @property({ type: Number, attribute: 'primary-max' })\n public primaryMax = DEFAULT_MAX_SIZE;\n\n /**\n * The start size of the primary pane, can be a real pixel number|string, percentage or \"auto\"\n * For example: \"100\", \"120px\", \"75%\" or \"auto\" are valid values\n * @type {number |\u00A0number + \"px\" | number + \"%\" | \"auto\"}\n * @attr\n */\n @property({ type: String, attribute: 'primary-size' })\n public primarySize?: string;\n\n /** The minimum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-min' })\n public secondaryMin = 0;\n\n /** The maximum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-max' })\n public secondaryMax = DEFAULT_MAX_SIZE;\n\n /** The current splitter position of split-view */\n @property({ type: Number, reflect: true, attribute: 'splitter-pos' })\n public splitterPos?: number;\n\n /** The current size of first pane of split-view */\n @property({ type: String, attribute: false })\n private firstPaneSize = 'auto';\n\n @property()\n public label?: string;\n\n @property({ type: Boolean, attribute: false })\n private enoughChildren = false;\n\n @property({ type: Number })\n private viewSize = 0;\n\n @query('slot')\n private paneSlot!: HTMLSlotElement;\n\n @query('#splitter')\n private splitter!: HTMLDivElement;\n\n private offset = 0;\n\n private minPos = 0;\n\n private maxPos = DEFAULT_MAX_SIZE;\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n private rect?: DOMRect;\n\n private _splitterSize?: number;\n\n public constructor() {\n super();\n const RO = (window as unknown as WithSWCResizeObserver).ResizeObserver;\n if (RO) {\n this.observer = new RO(() => {\n this.rect = undefined;\n this.updateMinMax();\n });\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.observer?.observe(this);\n }\n\n public override disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n\n /**\n * @private\n **/\n public get splitterSize(): number {\n if (!this._splitterSize) {\n this._splitterSize =\n (this.splitter &&\n Math.round(\n parseFloat(\n window\n .getComputedStyle(this.splitter)\n .getPropertyValue(\n this.vertical ? 'height' : 'width'\n )\n )\n )) ||\n SPLITTERSIZE;\n }\n return this._splitterSize;\n }\n\n protected override render(): TemplateResult {\n const splitterClasses = {\n 'is-resized-start': this.splitterPos === this.minPos,\n 'is-resized-end': (this.splitterPos &&\n this.splitterPos > this.splitterSize &&\n this.splitterPos === this.maxPos) as boolean,\n 'is-collapsed-start': this.splitterPos === 0,\n 'is-collapsed-end': (this.splitterPos &&\n this.splitterPos >=\n Math.max(\n this.splitterSize,\n this.viewSize - this.splitterSize\n )) as boolean,\n };\n return html`\n <slot\n @slotchange=${this.onContentSlotChange}\n style=\"--spectrum-split-view-first-pane-size: ${this\n .firstPaneSize}\"\n ></slot>\n ${this.enoughChildren\n ? html`\n <div\n id=\"splitter\"\n class=${classMap(splitterClasses)}\n role=\"separator\"\n aria-label=${ifDefined(this.label || undefined)}\n aria-valuenow=${Math.round(\n (parseFloat(this.firstPaneSize) / this.viewSize) *\n 100\n )}\n tabindex=${ifDefined(\n this.resizable ? '0' : undefined\n )}\n @keydown=${this.onKeydown}\n ${streamingListener({\n start: ['pointerdown', this.onPointerdown],\n streamInside: ['pointermove', this.onPointermove],\n end: [\n [\n 'pointerup',\n 'pointercancel',\n 'pointerleave',\n ],\n this.onPointerup,\n ],\n })}\n >\n ${this.resizable\n ? html`\n <div id=\"gripper\"></div>\n `\n : nothing}\n </div>\n `\n : nothing}\n `;\n }\n\n private onContentSlotChange(): void {\n this.enoughChildren = this.children.length > 1;\n this.checkResize();\n }\n\n private onPointerdown(event: PointerEvent): void {\n if (!this.resizable || (event.button && event.button !== 0)) {\n event.preventDefault();\n return;\n }\n this.splitter.setPointerCapture(event.pointerId);\n this.offset = this.getOffset();\n }\n\n private onPointermove(event: PointerEvent): void {\n event.preventDefault();\n let pos =\n this.vertical || this.isLTR\n ? this.getPosition(event) - this.offset\n : this.offset - this.getPosition(event);\n if (this.collapsible && pos < this.minPos - COLLAPSE_THREASHOLD) {\n pos = 0;\n }\n if (this.collapsible && pos > this.maxPos + COLLAPSE_THREASHOLD) {\n pos = this.viewSize - this.splitterSize;\n }\n this.updatePosition(pos);\n }\n\n private onPointerup(event: PointerEvent): void {\n this.splitter.releasePointerCapture(event.pointerId);\n }\n\n private getOffset(): number {\n if (!this.rect) {\n this.rect = this.getBoundingClientRect();\n }\n const offsetX = this.isLTR ? this.rect.left : this.rect.right;\n return this.vertical ? this.rect.top : offsetX;\n }\n\n private getPosition(event: PointerEvent): number {\n return this.vertical ? event.clientY : event.clientX;\n }\n\n private movePosition(event: KeyboardEvent, offset: number): void {\n event.preventDefault();\n if (this.splitterPos !== undefined) {\n this.updatePosition(this.splitterPos + offset);\n }\n }\n\n private onKeydown(event: KeyboardEvent): void {\n if (!this.resizable) {\n return;\n }\n let direction = 0;\n const isLTRorVertical = this.isLTR || this.vertical;\n switch (event.key) {\n case 'Home':\n event.preventDefault();\n this.updatePosition(this.collapsible ? 0 : this.minPos);\n return;\n case 'End':\n event.preventDefault();\n this.updatePosition(\n this.collapsible\n ? this.viewSize - this.splitterSize\n : this.maxPos\n );\n return;\n case 'ArrowLeft':\n direction = isLTRorVertical ? -1 : 1;\n break;\n case 'ArrowRight':\n direction = isLTRorVertical ? 1 : -1;\n break;\n case 'ArrowUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'ArrowDown':\n direction = this.vertical ? 1 : -1;\n break;\n case 'PageUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'PageDown':\n direction = this.vertical ? 1 : -1;\n break;\n }\n if (direction !== 0) {\n const moveBy = event.key.startsWith('Page')\n ? PAGEUPDOWN_KEY_CHANGE_VALUE\n : ARROW_KEY_CHANGE_VALUE;\n this.movePosition(event, moveBy * direction);\n }\n }\n\n private async checkResize(): Promise<void> {\n if (!this.enoughChildren) {\n return;\n }\n this.updateMinMax();\n if (this.splitterPos === undefined) {\n const startPos = await this.calcStartPos();\n this.updatePosition(startPos);\n }\n }\n\n private updateMinMax(): void {\n this.viewSize = this.vertical ? this.offsetHeight : this.offsetWidth;\n this.minPos = Math.max(\n this.primaryMin,\n this.viewSize - this.secondaryMax\n );\n this.maxPos = Math.min(\n this.primaryMax,\n this.viewSize - Math.max(this.secondaryMin, this.splitterSize)\n );\n }\n\n private updatePosition(x: number): void {\n let pos = this.getLimitedPosition(x);\n if (this.collapsible && x <= 0) {\n pos = 0;\n }\n if (\n this.collapsible &&\n x > this.maxPos &&\n x >= this.viewSize - this.splitterSize\n ) {\n pos = this.viewSize - this.splitterSize;\n }\n if (pos !== this.splitterPos) {\n this.splitterPos = pos;\n this.dispatchChangeEvent();\n }\n }\n\n private getLimitedPosition(input: number): number {\n if (input <= this.minPos) {\n return this.minPos;\n }\n if (input >= this.maxPos) {\n return this.maxPos;\n }\n return Math.max(this.minPos, Math.min(this.maxPos, input));\n }\n\n private async calcStartPos(): Promise<number> {\n if (\n this.primarySize !== undefined &&\n /^\\d+(px)?$/.test(this.primarySize)\n ) {\n return parseInt(this.primarySize, 10);\n }\n if (this.primarySize !== undefined && /^\\d+%$/.test(this.primarySize)) {\n return (parseInt(this.primarySize, 10) * this.viewSize) / 100;\n }\n if (this.primarySize === 'auto') {\n this.firstPaneSize = 'auto';\n const nodes = this.paneSlot.assignedNodes({ flatten: true });\n const firstEl = nodes.find(\n (node) => node instanceof HTMLElement\n ) as LitElement;\n if (typeof firstEl.updateComplete !== 'undefined') {\n await firstEl.updateComplete;\n }\n if (firstEl) {\n const size = window\n .getComputedStyle(firstEl)\n .getPropertyValue(this.vertical ? 'height' : 'width');\n const size_i = parseFloat(size);\n if (!isNaN(size_i)) {\n return this.getLimitedPosition(Math.ceil(size_i));\n }\n }\n }\n return this.viewSize / 2;\n }\n\n private dispatchChangeEvent(): void {\n const changeEvent = new Event('change', {\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(changeEvent);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated || changed.has('primarySize')) {\n this.splitterPos = undefined;\n this.checkResize();\n }\n if (\n changed.has('splitterPos') &&\n this.splitterPos !== undefined &&\n this.enoughChildren\n ) {\n this.firstPaneSize = `${Math.round(this.splitterPos)}px`;\n }\n }\n}\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,EAEA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAIlC,OAAO,YAAY;AAEnB,MAAM,mBAAmB;AAEzB,MAAM,eAAe;AAErB,MAAM,yBAAyB;AAE/B,MAAM,8BAA8B;AAEpC,MAAM,sBAAsB;AAQrB,aAAM,kBAAkB,gBAAgB;AAAA,
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n LitElement,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport {\n property,\n query,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\n\nimport { WithSWCResizeObserver } from './types';\n\nimport styles from './split-view.css.js';\n\nconst DEFAULT_MAX_SIZE = 3840;\n\nconst SPLITTERSIZE = 2;\n\nconst ARROW_KEY_CHANGE_VALUE = 10;\n\nconst PAGEUPDOWN_KEY_CHANGE_VALUE = 50;\n\nconst COLLAPSE_THREASHOLD = 50;\n\n/**\n * @element sp-split-view\n *\n * @slot Two sibling elements to be sized by the element attritubes\n * @fires change - Announces the new position of the splitter\n */\nexport class SplitView extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @state()\n public controlledEl?: HTMLElement;\n\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n @property({ type: Boolean, reflect: true })\n public resizable = false;\n\n @property({ type: Boolean, reflect: true })\n public collapsible = false;\n\n /** The minimum size of the primary pane */\n @property({ type: Number, attribute: 'primary-min' })\n public primaryMin = 0;\n\n /** The maximum size of the primary pane */\n @property({ type: Number, attribute: 'primary-max' })\n public primaryMax = DEFAULT_MAX_SIZE;\n\n /**\n * The start size of the primary pane, can be a real pixel number|string, percentage or \"auto\"\n * For example: \"100\", \"120px\", \"75%\" or \"auto\" are valid values\n * @type {number |\u00A0number + \"px\" | number + \"%\" | \"auto\"}\n * @attr\n */\n @property({ type: String, attribute: 'primary-size' })\n public primarySize?: string;\n\n /** The minimum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-min' })\n public secondaryMin = 0;\n\n /** The maximum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-max' })\n public secondaryMax = DEFAULT_MAX_SIZE;\n\n /** The current splitter position of split-view */\n @property({ type: Number, reflect: true, attribute: 'splitter-pos' })\n public splitterPos?: number;\n\n /** The current size of first pane of split-view */\n @property({ type: String, attribute: false })\n private firstPaneSize = 'auto';\n\n @property()\n public label?: string;\n\n @property({ type: Boolean, attribute: false })\n private enoughChildren = false;\n\n @property({ type: Number })\n private viewSize = 0;\n\n @query('slot')\n private paneSlot!: HTMLSlotElement;\n\n @query('#splitter')\n private splitter!: HTMLDivElement;\n\n private offset = 0;\n\n private minPos = 0;\n\n private maxPos = DEFAULT_MAX_SIZE;\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n private rect?: DOMRect;\n\n private _splitterSize?: number;\n\n public constructor() {\n super();\n const RO = (window as unknown as WithSWCResizeObserver).ResizeObserver;\n if (RO) {\n this.observer = new RO(() => {\n this.rect = undefined;\n this.updateMinMax();\n });\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.observer?.observe(this);\n }\n\n public override disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n\n /**\n * @private\n **/\n public get splitterSize(): number {\n if (!this._splitterSize) {\n this._splitterSize =\n (this.splitter &&\n Math.round(\n parseFloat(\n window\n .getComputedStyle(this.splitter)\n .getPropertyValue(\n this.vertical ? 'height' : 'width'\n )\n )\n )) ||\n SPLITTERSIZE;\n }\n return this._splitterSize;\n }\n\n protected override render(): TemplateResult {\n const splitterClasses = {\n 'is-resized-start': this.splitterPos === this.minPos,\n 'is-resized-end': (this.splitterPos &&\n this.splitterPos > this.splitterSize &&\n this.splitterPos === this.maxPos) as boolean,\n 'is-collapsed-start': this.splitterPos === 0,\n 'is-collapsed-end': (this.splitterPos &&\n this.splitterPos >=\n Math.max(\n this.splitterSize,\n this.viewSize - this.splitterSize\n )) as boolean,\n };\n const label =\n this.label || this.resizable ? 'Resize the panels' : undefined;\n\n return html`\n <slot\n id=${ifDefined(\n this.resizable ? this.controlledEl?.id : undefined\n )}\n @slotchange=${this.onContentSlotChange}\n style=\"--spectrum-split-view-first-pane-size: ${this\n .firstPaneSize}\"\n ></slot>\n ${this.enoughChildren\n ? html`\n <div\n id=\"splitter\"\n class=${classMap(splitterClasses)}\n role=\"separator\"\n aria-controls=${ifDefined(\n this.resizable ? this.controlledEl?.id : undefined\n )}\n aria-label=${ifDefined(label)}\n aria-orientation=${this.vertical\n ? 'horizontal'\n : 'vertical'}\n aria-valuenow=${Math.round(\n (parseFloat(this.firstPaneSize) / this.viewSize) *\n 100\n )}\n tabindex=${ifDefined(\n this.resizable ? '0' : undefined\n )}\n @keydown=${this.onKeydown}\n ${streamingListener({\n start: ['pointerdown', this.onPointerdown],\n streamInside: ['pointermove', this.onPointermove],\n end: [\n [\n 'pointerup',\n 'pointercancel',\n 'pointerleave',\n ],\n this.onPointerup,\n ],\n })}\n >\n ${this.resizable\n ? html`\n <div id=\"gripper\"></div>\n `\n : nothing}\n </div>\n `\n : nothing}\n `;\n }\n\n private controlledElIDApplied = false;\n\n private onContentSlotChange(\n event: Event & { target: HTMLSlotElement }\n ): void {\n if (this.controlledEl && this.controlledElIDApplied) {\n this.controlledEl.removeAttribute('id');\n this.controlledElIDApplied = false;\n }\n this.controlledEl = event.target.assignedElements()[0] as HTMLElement;\n if (this.controlledEl && !this.controlledEl.id) {\n this.controlledEl.id = `${this.tagName.toLowerCase()}-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n this.controlledElIDApplied = true;\n }\n this.enoughChildren = this.children.length > 1;\n this.checkResize();\n }\n\n private onPointerdown(event: PointerEvent): void {\n if (!this.resizable || (event.button && event.button !== 0)) {\n event.preventDefault();\n return;\n }\n this.splitter.setPointerCapture(event.pointerId);\n this.offset = this.getOffset();\n }\n\n private onPointermove(event: PointerEvent): void {\n event.preventDefault();\n let pos =\n this.vertical || this.isLTR\n ? this.getPosition(event) - this.offset\n : this.offset - this.getPosition(event);\n if (this.collapsible && pos < this.minPos - COLLAPSE_THREASHOLD) {\n pos = 0;\n }\n if (this.collapsible && pos > this.maxPos + COLLAPSE_THREASHOLD) {\n pos = this.viewSize - this.splitterSize;\n }\n this.updatePosition(pos);\n }\n\n private onPointerup(event: PointerEvent): void {\n this.splitter.releasePointerCapture(event.pointerId);\n }\n\n private getOffset(): number {\n if (!this.rect) {\n this.rect = this.getBoundingClientRect();\n }\n const offsetX = this.isLTR ? this.rect.left : this.rect.right;\n return this.vertical ? this.rect.top : offsetX;\n }\n\n private getPosition(event: PointerEvent): number {\n return this.vertical ? event.clientY : event.clientX;\n }\n\n private movePosition(event: KeyboardEvent, offset: number): void {\n event.preventDefault();\n if (this.splitterPos !== undefined) {\n this.updatePosition(this.splitterPos + offset);\n }\n }\n\n private onKeydown(event: KeyboardEvent): void {\n if (!this.resizable) {\n return;\n }\n let direction = 0;\n const isLTRorVertical = this.isLTR || this.vertical;\n switch (event.key) {\n case 'Home':\n event.preventDefault();\n this.updatePosition(this.collapsible ? 0 : this.minPos);\n return;\n case 'End':\n event.preventDefault();\n this.updatePosition(\n this.collapsible\n ? this.viewSize - this.splitterSize\n : this.maxPos\n );\n return;\n case 'ArrowLeft':\n direction = isLTRorVertical ? -1 : 1;\n break;\n case 'ArrowRight':\n direction = isLTRorVertical ? 1 : -1;\n break;\n case 'ArrowUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'ArrowDown':\n direction = this.vertical ? 1 : -1;\n break;\n case 'PageUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'PageDown':\n direction = this.vertical ? 1 : -1;\n break;\n }\n if (direction !== 0) {\n const moveBy = event.key.startsWith('Page')\n ? PAGEUPDOWN_KEY_CHANGE_VALUE\n : ARROW_KEY_CHANGE_VALUE;\n this.movePosition(event, moveBy * direction);\n }\n }\n\n private async checkResize(): Promise<void> {\n if (!this.enoughChildren) {\n return;\n }\n this.updateMinMax();\n if (this.splitterPos === undefined) {\n const startPos = await this.calcStartPos();\n this.updatePosition(startPos);\n }\n }\n\n private updateMinMax(): void {\n this.viewSize = this.vertical ? this.offsetHeight : this.offsetWidth;\n this.minPos = Math.max(\n this.primaryMin,\n this.viewSize - this.secondaryMax\n );\n this.maxPos = Math.min(\n this.primaryMax,\n this.viewSize - Math.max(this.secondaryMin, this.splitterSize)\n );\n }\n\n private updatePosition(x: number): void {\n let pos = this.getLimitedPosition(x);\n if (this.collapsible && x <= 0) {\n pos = 0;\n }\n if (\n this.collapsible &&\n x > this.maxPos &&\n x >= this.viewSize - this.splitterSize\n ) {\n pos = this.viewSize - this.splitterSize;\n }\n if (pos !== this.splitterPos) {\n this.splitterPos = pos;\n this.dispatchChangeEvent();\n }\n }\n\n private getLimitedPosition(input: number): number {\n if (input <= this.minPos) {\n return this.minPos;\n }\n if (input >= this.maxPos) {\n return this.maxPos;\n }\n return Math.max(this.minPos, Math.min(this.maxPos, input));\n }\n\n private async calcStartPos(): Promise<number> {\n if (\n this.primarySize !== undefined &&\n /^\\d+(px)?$/.test(this.primarySize)\n ) {\n return parseInt(this.primarySize, 10);\n }\n if (this.primarySize !== undefined && /^\\d+%$/.test(this.primarySize)) {\n return (parseInt(this.primarySize, 10) * this.viewSize) / 100;\n }\n if (this.primarySize === 'auto') {\n this.firstPaneSize = 'auto';\n const nodes = this.paneSlot.assignedNodes({ flatten: true });\n const firstEl = nodes.find(\n (node) => node instanceof HTMLElement\n ) as LitElement;\n if (typeof firstEl.updateComplete !== 'undefined') {\n await firstEl.updateComplete;\n }\n if (firstEl) {\n const size = window\n .getComputedStyle(firstEl)\n .getPropertyValue(this.vertical ? 'height' : 'width');\n const size_i = parseFloat(size);\n if (!isNaN(size_i)) {\n return this.getLimitedPosition(Math.ceil(size_i));\n }\n }\n }\n return this.viewSize / 2;\n }\n\n private dispatchChangeEvent(): void {\n const changeEvent = new Event('change', {\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(changeEvent);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated || changed.has('primarySize')) {\n this.splitterPos = undefined;\n this.checkResize();\n }\n if (\n changed.has('splitterPos') &&\n this.splitterPos !== undefined &&\n this.enoughChildren\n ) {\n this.firstPaneSize = `${Math.round(this.splitterPos)}px`;\n }\n }\n}\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,EAEA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,yBAAyB;AAIlC,OAAO,YAAY;AAEnB,MAAM,mBAAmB;AAEzB,MAAM,eAAe;AAErB,MAAM,yBAAyB;AAE/B,MAAM,8BAA8B;AAEpC,MAAM,sBAAsB;AAQrB,aAAM,kBAAkB,gBAAgB;AAAA,EA6EpC,cAAc;AACjB,UAAM;AArEV,SAAO,WAAW;AAGlB,SAAO,YAAY;AAGnB,SAAO,cAAc;AAIrB,SAAO,aAAa;AAIpB,SAAO,aAAa;AAapB,SAAO,eAAe;AAItB,SAAO,eAAe;AAQtB,SAAQ,gBAAgB;AAMxB,SAAQ,iBAAiB;AAGzB,SAAQ,WAAW;AAQnB,SAAQ,SAAS;AAEjB,SAAQ,SAAS;AAEjB,SAAQ,SAAS;AAyHjB,SAAQ,wBAAwB;AA/G5B,UAA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WAAW,MAAM,CAAC;AAAA,GA/CnC,UAgDD;AAGD;AAAA,EADN,SAAS;AAAA,GAlDD,UAmDF;AAGC;AAAA,EADP,SAAS,EAAE,MAAM,SAAS,WAAW,MAAM,CAAC;AAAA,GArDpC,UAsDD;AAGA;AAAA,EADP,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAxDjB,UAyDD;AAGA;AAAA,EADP,MAAM,MAAM;AAAA,GA3DJ,UA4DD;AAGA;AAAA,EADP,MAAM,WAAW;AAAA,GA9DT,UA+DD;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/src/SplitView.js
CHANGED
@@ -1,23 +1,26 @@
|
|
1
|
-
"use strict";var v=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var
|
1
|
+
"use strict";var v=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var s=(l,a,t,e)=>{for(var i=e>1?void 0:e?f(a,t):a,o=l.length-1,h;o>=0;o--)(h=l[o])&&(i=(e?h(a,t,i):h(i))||i);return e&&i&&v(a,t,i),i};import{html as p,nothing as c,SpectrumElement as b}from"@spectrum-web-components/base";import{classMap as P,ifDefined as n}from"@spectrum-web-components/base/src/directives.js";import{property as r,query as u,state as z}from"@spectrum-web-components/base/src/decorators.js";import{streamingListener as y}from"@spectrum-web-components/base/src/streaming-listener.js";import E from"./split-view.css.js";const d=3840,S=2,g=10,M=50,m=50;export class SplitView extends b{constructor(){super();this.vertical=!1;this.resizable=!1;this.collapsible=!1;this.primaryMin=0;this.primaryMax=d;this.secondaryMin=0;this.secondaryMax=d;this.firstPaneSize="auto";this.enoughChildren=!1;this.viewSize=0;this.offset=0;this.minPos=0;this.maxPos=d;this.controlledElIDApplied=!1;const t=window.ResizeObserver;t&&(this.observer=new t(()=>{this.rect=void 0,this.updateMinMax()}))}static get styles(){return[E]}connectedCallback(){var t;super.connectedCallback(),(t=this.observer)==null||t.observe(this)}disconnectedCallback(){var t;(t=this.observer)==null||t.unobserve(this),super.disconnectedCallback()}get splitterSize(){return this._splitterSize||(this._splitterSize=this.splitter&&Math.round(parseFloat(window.getComputedStyle(this.splitter).getPropertyValue(this.vertical?"height":"width")))||S),this._splitterSize}render(){var i,o;const t={"is-resized-start":this.splitterPos===this.minPos,"is-resized-end":this.splitterPos&&this.splitterPos>this.splitterSize&&this.splitterPos===this.maxPos,"is-collapsed-start":this.splitterPos===0,"is-collapsed-end":this.splitterPos&&this.splitterPos>=Math.max(this.splitterSize,this.viewSize-this.splitterSize)},e=this.label||this.resizable?"Resize the panels":void 0;return p`
|
2
2
|
<slot
|
3
|
+
id=${n(this.resizable?(i=this.controlledEl)==null?void 0:i.id:void 0)}
|
3
4
|
@slotchange=${this.onContentSlotChange}
|
4
5
|
style="--spectrum-split-view-first-pane-size: ${this.firstPaneSize}"
|
5
6
|
></slot>
|
6
|
-
${this.enoughChildren?
|
7
|
+
${this.enoughChildren?p`
|
7
8
|
<div
|
8
9
|
id="splitter"
|
9
10
|
class=${P(t)}
|
10
11
|
role="separator"
|
11
|
-
aria-
|
12
|
+
aria-controls=${n(this.resizable?(o=this.controlledEl)==null?void 0:o.id:void 0)}
|
13
|
+
aria-label=${n(e)}
|
14
|
+
aria-orientation=${this.vertical?"horizontal":"vertical"}
|
12
15
|
aria-valuenow=${Math.round(parseFloat(this.firstPaneSize)/this.viewSize*100)}
|
13
|
-
tabindex=${
|
16
|
+
tabindex=${n(this.resizable?"0":void 0)}
|
14
17
|
@keydown=${this.onKeydown}
|
15
18
|
${y({start:["pointerdown",this.onPointerdown],streamInside:["pointermove",this.onPointermove],end:[["pointerup","pointercancel","pointerleave"],this.onPointerup]})}
|
16
19
|
>
|
17
|
-
${this.resizable?
|
20
|
+
${this.resizable?p`
|
18
21
|
<div id="gripper"></div>
|
19
22
|
`:c}
|
20
23
|
</div>
|
21
24
|
`:c}
|
22
|
-
`}onContentSlotChange(){this.enoughChildren=this.children.length>1,this.checkResize()}onPointerdown(t){if(!this.resizable||t.button&&t.button!==0){t.preventDefault();return}this.splitter.setPointerCapture(t.pointerId),this.offset=this.getOffset()}onPointermove(t){t.preventDefault();let e=this.vertical||this.isLTR?this.getPosition(t)-this.offset:this.offset-this.getPosition(t);this.collapsible&&e<this.minPos-m&&(e=0),this.collapsible&&e>this.maxPos+m&&(e=this.viewSize-this.splitterSize),this.updatePosition(e)}onPointerup(t){this.splitter.releasePointerCapture(t.pointerId)}getOffset(){this.rect||(this.rect=this.getBoundingClientRect());const t=this.isLTR?this.rect.left:this.rect.right;return this.vertical?this.rect.top:t}getPosition(t){return this.vertical?t.clientY:t.clientX}movePosition(t,e){t.preventDefault(),this.splitterPos!==void 0&&this.updatePosition(this.splitterPos+e)}onKeydown(t){if(!this.resizable)return;let e=0;const
|
25
|
+
`}onContentSlotChange(t){this.controlledEl&&this.controlledElIDApplied&&(this.controlledEl.removeAttribute("id"),this.controlledElIDApplied=!1),this.controlledEl=t.target.assignedElements()[0],this.controlledEl&&!this.controlledEl.id&&(this.controlledEl.id=`${this.tagName.toLowerCase()}-${crypto.randomUUID().slice(0,8)}`,this.controlledElIDApplied=!0),this.enoughChildren=this.children.length>1,this.checkResize()}onPointerdown(t){if(!this.resizable||t.button&&t.button!==0){t.preventDefault();return}this.splitter.setPointerCapture(t.pointerId),this.offset=this.getOffset()}onPointermove(t){t.preventDefault();let e=this.vertical||this.isLTR?this.getPosition(t)-this.offset:this.offset-this.getPosition(t);this.collapsible&&e<this.minPos-m&&(e=0),this.collapsible&&e>this.maxPos+m&&(e=this.viewSize-this.splitterSize),this.updatePosition(e)}onPointerup(t){this.splitter.releasePointerCapture(t.pointerId)}getOffset(){this.rect||(this.rect=this.getBoundingClientRect());const t=this.isLTR?this.rect.left:this.rect.right;return this.vertical?this.rect.top:t}getPosition(t){return this.vertical?t.clientY:t.clientX}movePosition(t,e){t.preventDefault(),this.splitterPos!==void 0&&this.updatePosition(this.splitterPos+e)}onKeydown(t){if(!this.resizable)return;let e=0;const i=this.isLTR||this.vertical;switch(t.key){case"Home":t.preventDefault(),this.updatePosition(this.collapsible?0:this.minPos);return;case"End":t.preventDefault(),this.updatePosition(this.collapsible?this.viewSize-this.splitterSize:this.maxPos);return;case"ArrowLeft":e=i?-1:1;break;case"ArrowRight":e=i?1:-1;break;case"ArrowUp":e=this.vertical?-1:1;break;case"ArrowDown":e=this.vertical?1:-1;break;case"PageUp":e=this.vertical?-1:1;break;case"PageDown":e=this.vertical?1:-1;break}if(e!==0){const o=t.key.startsWith("Page")?M:g;this.movePosition(t,o*e)}}async checkResize(){if(this.enoughChildren&&(this.updateMinMax(),this.splitterPos===void 0)){const t=await this.calcStartPos();this.updatePosition(t)}}updateMinMax(){this.viewSize=this.vertical?this.offsetHeight:this.offsetWidth,this.minPos=Math.max(this.primaryMin,this.viewSize-this.secondaryMax),this.maxPos=Math.min(this.primaryMax,this.viewSize-Math.max(this.secondaryMin,this.splitterSize))}updatePosition(t){let e=this.getLimitedPosition(t);this.collapsible&&t<=0&&(e=0),this.collapsible&&t>this.maxPos&&t>=this.viewSize-this.splitterSize&&(e=this.viewSize-this.splitterSize),e!==this.splitterPos&&(this.splitterPos=e,this.dispatchChangeEvent())}getLimitedPosition(t){return t<=this.minPos?this.minPos:t>=this.maxPos?this.maxPos:Math.max(this.minPos,Math.min(this.maxPos,t))}async calcStartPos(){if(this.primarySize!==void 0&&/^\d+(px)?$/.test(this.primarySize))return parseInt(this.primarySize,10);if(this.primarySize!==void 0&&/^\d+%$/.test(this.primarySize))return parseInt(this.primarySize,10)*this.viewSize/100;if(this.primarySize==="auto"){this.firstPaneSize="auto";const e=this.paneSlot.assignedNodes({flatten:!0}).find(i=>i instanceof HTMLElement);if(typeof e.updateComplete!="undefined"&&await e.updateComplete,e){const i=window.getComputedStyle(e).getPropertyValue(this.vertical?"height":"width"),o=parseFloat(i);if(!isNaN(o))return this.getLimitedPosition(Math.ceil(o))}}return this.viewSize/2}dispatchChangeEvent(){const t=new Event("change",{bubbles:!0,composed:!0});this.dispatchEvent(t)}willUpdate(t){(!this.hasUpdated||t.has("primarySize"))&&(this.splitterPos=void 0,this.checkResize()),t.has("splitterPos")&&this.splitterPos!==void 0&&this.enoughChildren&&(this.firstPaneSize=`${Math.round(this.splitterPos)}px`)}}s([z()],SplitView.prototype,"controlledEl",2),s([r({type:Boolean,reflect:!0})],SplitView.prototype,"vertical",2),s([r({type:Boolean,reflect:!0})],SplitView.prototype,"resizable",2),s([r({type:Boolean,reflect:!0})],SplitView.prototype,"collapsible",2),s([r({type:Number,attribute:"primary-min"})],SplitView.prototype,"primaryMin",2),s([r({type:Number,attribute:"primary-max"})],SplitView.prototype,"primaryMax",2),s([r({type:String,attribute:"primary-size"})],SplitView.prototype,"primarySize",2),s([r({type:Number,attribute:"secondary-min"})],SplitView.prototype,"secondaryMin",2),s([r({type:Number,attribute:"secondary-max"})],SplitView.prototype,"secondaryMax",2),s([r({type:Number,reflect:!0,attribute:"splitter-pos"})],SplitView.prototype,"splitterPos",2),s([r({type:String,attribute:!1})],SplitView.prototype,"firstPaneSize",2),s([r()],SplitView.prototype,"label",2),s([r({type:Boolean,attribute:!1})],SplitView.prototype,"enoughChildren",2),s([r({type:Number})],SplitView.prototype,"viewSize",2),s([u("slot")],SplitView.prototype,"paneSlot",2),s([u("#splitter")],SplitView.prototype,"splitter",2);
|
23
26
|
//# sourceMappingURL=SplitView.js.map
|
package/src/SplitView.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["SplitView.ts"],
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n LitElement,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\n\nimport { WithSWCResizeObserver } from './types';\n\nimport styles from './split-view.css.js';\n\nconst DEFAULT_MAX_SIZE = 3840;\n\nconst SPLITTERSIZE = 2;\n\nconst ARROW_KEY_CHANGE_VALUE = 10;\n\nconst PAGEUPDOWN_KEY_CHANGE_VALUE = 50;\n\nconst COLLAPSE_THREASHOLD = 50;\n\n/**\n * @element sp-split-view\n *\n * @slot Two sibling elements to be sized by the element attritubes\n * @fires change - Announces the new position of the splitter\n */\nexport class SplitView extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n @property({ type: Boolean, reflect: true })\n public resizable = false;\n\n @property({ type: Boolean, reflect: true })\n public collapsible = false;\n\n /** The minimum size of the primary pane */\n @property({ type: Number, attribute: 'primary-min' })\n public primaryMin = 0;\n\n /** The maximum size of the primary pane */\n @property({ type: Number, attribute: 'primary-max' })\n public primaryMax = DEFAULT_MAX_SIZE;\n\n /**\n * The start size of the primary pane, can be a real pixel number|string, percentage or \"auto\"\n * For example: \"100\", \"120px\", \"75%\" or \"auto\" are valid values\n * @type {number |\u00A0number + \"px\" | number + \"%\" | \"auto\"}\n * @attr\n */\n @property({ type: String, attribute: 'primary-size' })\n public primarySize?: string;\n\n /** The minimum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-min' })\n public secondaryMin = 0;\n\n /** The maximum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-max' })\n public secondaryMax = DEFAULT_MAX_SIZE;\n\n /** The current splitter position of split-view */\n @property({ type: Number, reflect: true, attribute: 'splitter-pos' })\n public splitterPos?: number;\n\n /** The current size of first pane of split-view */\n @property({ type: String, attribute: false })\n private firstPaneSize = 'auto';\n\n @property()\n public label?: string;\n\n @property({ type: Boolean, attribute: false })\n private enoughChildren = false;\n\n @property({ type: Number })\n private viewSize = 0;\n\n @query('slot')\n private paneSlot!: HTMLSlotElement;\n\n @query('#splitter')\n private splitter!: HTMLDivElement;\n\n private offset = 0;\n\n private minPos = 0;\n\n private maxPos = DEFAULT_MAX_SIZE;\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n private rect?: DOMRect;\n\n private _splitterSize?: number;\n\n public constructor() {\n super();\n const RO = (window as unknown as WithSWCResizeObserver).ResizeObserver;\n if (RO) {\n this.observer = new RO(() => {\n this.rect = undefined;\n this.updateMinMax();\n });\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.observer?.observe(this);\n }\n\n public override disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n\n /**\n * @private\n **/\n public get splitterSize(): number {\n if (!this._splitterSize) {\n this._splitterSize =\n (this.splitter &&\n Math.round(\n parseFloat(\n window\n .getComputedStyle(this.splitter)\n .getPropertyValue(\n this.vertical ? 'height' : 'width'\n )\n )\n )) ||\n SPLITTERSIZE;\n }\n return this._splitterSize;\n }\n\n protected override render(): TemplateResult {\n const splitterClasses = {\n 'is-resized-start': this.splitterPos === this.minPos,\n 'is-resized-end': (this.splitterPos &&\n this.splitterPos > this.splitterSize &&\n this.splitterPos === this.maxPos) as boolean,\n 'is-collapsed-start': this.splitterPos === 0,\n 'is-collapsed-end': (this.splitterPos &&\n this.splitterPos >=\n Math.max(\n this.splitterSize,\n this.viewSize - this.splitterSize\n )) as boolean,\n };\n return html`\n <slot\n @slotchange=${this.onContentSlotChange}\n style=\"--spectrum-split-view-first-pane-size: ${this\n .firstPaneSize}\"\n ></slot>\n ${this.enoughChildren\n ? html`\n <div\n id=\"splitter\"\n class=${classMap(splitterClasses)}\n role=\"separator\"\n aria-label=${ifDefined(this.label || undefined)}\n aria-valuenow=${Math.round(\n (parseFloat(this.firstPaneSize) / this.viewSize) *\n 100\n )}\n tabindex=${ifDefined(\n this.resizable ? '0' : undefined\n )}\n @keydown=${this.onKeydown}\n ${streamingListener({\n start: ['pointerdown', this.onPointerdown],\n streamInside: ['pointermove', this.onPointermove],\n end: [\n [\n 'pointerup',\n 'pointercancel',\n 'pointerleave',\n ],\n this.onPointerup,\n ],\n })}\n >\n ${this.resizable\n ? html`\n <div id=\"gripper\"></div>\n `\n : nothing}\n </div>\n `\n : nothing}\n `;\n }\n\n private onContentSlotChange(): void {\n this.enoughChildren = this.children.length > 1;\n this.checkResize();\n }\n\n private onPointerdown(event: PointerEvent): void {\n if (!this.resizable || (event.button && event.button !== 0)) {\n event.preventDefault();\n return;\n }\n this.splitter.setPointerCapture(event.pointerId);\n this.offset = this.getOffset();\n }\n\n private onPointermove(event: PointerEvent): void {\n event.preventDefault();\n let pos =\n this.vertical || this.isLTR\n ? this.getPosition(event) - this.offset\n : this.offset - this.getPosition(event);\n if (this.collapsible && pos < this.minPos - COLLAPSE_THREASHOLD) {\n pos = 0;\n }\n if (this.collapsible && pos > this.maxPos + COLLAPSE_THREASHOLD) {\n pos = this.viewSize - this.splitterSize;\n }\n this.updatePosition(pos);\n }\n\n private onPointerup(event: PointerEvent): void {\n this.splitter.releasePointerCapture(event.pointerId);\n }\n\n private getOffset(): number {\n if (!this.rect) {\n this.rect = this.getBoundingClientRect();\n }\n const offsetX = this.isLTR ? this.rect.left : this.rect.right;\n return this.vertical ? this.rect.top : offsetX;\n }\n\n private getPosition(event: PointerEvent): number {\n return this.vertical ? event.clientY : event.clientX;\n }\n\n private movePosition(event: KeyboardEvent, offset: number): void {\n event.preventDefault();\n if (this.splitterPos !== undefined) {\n this.updatePosition(this.splitterPos + offset);\n }\n }\n\n private onKeydown(event: KeyboardEvent): void {\n if (!this.resizable) {\n return;\n }\n let direction = 0;\n const isLTRorVertical = this.isLTR || this.vertical;\n switch (event.key) {\n case 'Home':\n event.preventDefault();\n this.updatePosition(this.collapsible ? 0 : this.minPos);\n return;\n case 'End':\n event.preventDefault();\n this.updatePosition(\n this.collapsible\n ? this.viewSize - this.splitterSize\n : this.maxPos\n );\n return;\n case 'ArrowLeft':\n direction = isLTRorVertical ? -1 : 1;\n break;\n case 'ArrowRight':\n direction = isLTRorVertical ? 1 : -1;\n break;\n case 'ArrowUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'ArrowDown':\n direction = this.vertical ? 1 : -1;\n break;\n case 'PageUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'PageDown':\n direction = this.vertical ? 1 : -1;\n break;\n }\n if (direction !== 0) {\n const moveBy = event.key.startsWith('Page')\n ? PAGEUPDOWN_KEY_CHANGE_VALUE\n : ARROW_KEY_CHANGE_VALUE;\n this.movePosition(event, moveBy * direction);\n }\n }\n\n private async checkResize(): Promise<void> {\n if (!this.enoughChildren) {\n return;\n }\n this.updateMinMax();\n if (this.splitterPos === undefined) {\n const startPos = await this.calcStartPos();\n this.updatePosition(startPos);\n }\n }\n\n private updateMinMax(): void {\n this.viewSize = this.vertical ? this.offsetHeight : this.offsetWidth;\n this.minPos = Math.max(\n this.primaryMin,\n this.viewSize - this.secondaryMax\n );\n this.maxPos = Math.min(\n this.primaryMax,\n this.viewSize - Math.max(this.secondaryMin, this.splitterSize)\n );\n }\n\n private updatePosition(x: number): void {\n let pos = this.getLimitedPosition(x);\n if (this.collapsible && x <= 0) {\n pos = 0;\n }\n if (\n this.collapsible &&\n x > this.maxPos &&\n x >= this.viewSize - this.splitterSize\n ) {\n pos = this.viewSize - this.splitterSize;\n }\n if (pos !== this.splitterPos) {\n this.splitterPos = pos;\n this.dispatchChangeEvent();\n }\n }\n\n private getLimitedPosition(input: number): number {\n if (input <= this.minPos) {\n return this.minPos;\n }\n if (input >= this.maxPos) {\n return this.maxPos;\n }\n return Math.max(this.minPos, Math.min(this.maxPos, input));\n }\n\n private async calcStartPos(): Promise<number> {\n if (\n this.primarySize !== undefined &&\n /^\\d+(px)?$/.test(this.primarySize)\n ) {\n return parseInt(this.primarySize, 10);\n }\n if (this.primarySize !== undefined && /^\\d+%$/.test(this.primarySize)) {\n return (parseInt(this.primarySize, 10) * this.viewSize) / 100;\n }\n if (this.primarySize === 'auto') {\n this.firstPaneSize = 'auto';\n const nodes = this.paneSlot.assignedNodes({ flatten: true });\n const firstEl = nodes.find(\n (node) => node instanceof HTMLElement\n ) as LitElement;\n if (typeof firstEl.updateComplete !== 'undefined') {\n await firstEl.updateComplete;\n }\n if (firstEl) {\n const size = window\n .getComputedStyle(firstEl)\n .getPropertyValue(this.vertical ? 'height' : 'width');\n const size_i = parseFloat(size);\n if (!isNaN(size_i)) {\n return this.getLimitedPosition(Math.ceil(size_i));\n }\n }\n }\n return this.viewSize / 2;\n }\n\n private dispatchChangeEvent(): void {\n const changeEvent = new Event('change', {\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(changeEvent);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated || changed.has('primarySize')) {\n this.splitterPos = undefined;\n this.checkResize();\n }\n if (\n changed.has('splitterPos') &&\n this.splitterPos !== undefined &&\n this.enoughChildren\n ) {\n this.firstPaneSize = `${Math.round(this.splitterPos)}px`;\n }\n }\n}\n"],
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,EAEA,WAAAC,EAEA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,aAAAC,MACG,kDACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,qBAAAC,MAAyB,0DAIlC,OAAOC,MAAY,sBAEnB,MAAMC,EAAmB,KAEnBC,EAAe,EAEfC,EAAyB,GAEzBC,EAA8B,GAE9BC,EAAsB,GAQrB,aAAM,
|
6
|
-
"names": ["html", "nothing", "SpectrumElement", "classMap", "ifDefined", "property", "query", "streamingListener", "styles", "DEFAULT_MAX_SIZE", "SPLITTERSIZE", "ARROW_KEY_CHANGE_VALUE", "PAGEUPDOWN_KEY_CHANGE_VALUE", "COLLAPSE_THREASHOLD", "RO", "_a", "splitterClasses", "event", "pos", "offsetX", "offset", "direction", "isLTRorVertical", "moveBy", "startPos", "x", "input", "firstEl", "node", "size", "size_i", "changeEvent", "changed", "__decorateClass"]
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n LitElement,\n nothing,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport {\n property,\n query,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { streamingListener } from '@spectrum-web-components/base/src/streaming-listener.js';\n\nimport { WithSWCResizeObserver } from './types';\n\nimport styles from './split-view.css.js';\n\nconst DEFAULT_MAX_SIZE = 3840;\n\nconst SPLITTERSIZE = 2;\n\nconst ARROW_KEY_CHANGE_VALUE = 10;\n\nconst PAGEUPDOWN_KEY_CHANGE_VALUE = 50;\n\nconst COLLAPSE_THREASHOLD = 50;\n\n/**\n * @element sp-split-view\n *\n * @slot Two sibling elements to be sized by the element attritubes\n * @fires change - Announces the new position of the splitter\n */\nexport class SplitView extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @state()\n public controlledEl?: HTMLElement;\n\n @property({ type: Boolean, reflect: true })\n public vertical = false;\n\n @property({ type: Boolean, reflect: true })\n public resizable = false;\n\n @property({ type: Boolean, reflect: true })\n public collapsible = false;\n\n /** The minimum size of the primary pane */\n @property({ type: Number, attribute: 'primary-min' })\n public primaryMin = 0;\n\n /** The maximum size of the primary pane */\n @property({ type: Number, attribute: 'primary-max' })\n public primaryMax = DEFAULT_MAX_SIZE;\n\n /**\n * The start size of the primary pane, can be a real pixel number|string, percentage or \"auto\"\n * For example: \"100\", \"120px\", \"75%\" or \"auto\" are valid values\n * @type {number |\u00A0number + \"px\" | number + \"%\" | \"auto\"}\n * @attr\n */\n @property({ type: String, attribute: 'primary-size' })\n public primarySize?: string;\n\n /** The minimum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-min' })\n public secondaryMin = 0;\n\n /** The maximum size of the secondary pane */\n @property({ type: Number, attribute: 'secondary-max' })\n public secondaryMax = DEFAULT_MAX_SIZE;\n\n /** The current splitter position of split-view */\n @property({ type: Number, reflect: true, attribute: 'splitter-pos' })\n public splitterPos?: number;\n\n /** The current size of first pane of split-view */\n @property({ type: String, attribute: false })\n private firstPaneSize = 'auto';\n\n @property()\n public label?: string;\n\n @property({ type: Boolean, attribute: false })\n private enoughChildren = false;\n\n @property({ type: Number })\n private viewSize = 0;\n\n @query('slot')\n private paneSlot!: HTMLSlotElement;\n\n @query('#splitter')\n private splitter!: HTMLDivElement;\n\n private offset = 0;\n\n private minPos = 0;\n\n private maxPos = DEFAULT_MAX_SIZE;\n\n private observer?: WithSWCResizeObserver['ResizeObserver'];\n\n private rect?: DOMRect;\n\n private _splitterSize?: number;\n\n public constructor() {\n super();\n const RO = (window as unknown as WithSWCResizeObserver).ResizeObserver;\n if (RO) {\n this.observer = new RO(() => {\n this.rect = undefined;\n this.updateMinMax();\n });\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.observer?.observe(this);\n }\n\n public override disconnectedCallback(): void {\n this.observer?.unobserve(this);\n super.disconnectedCallback();\n }\n\n /**\n * @private\n **/\n public get splitterSize(): number {\n if (!this._splitterSize) {\n this._splitterSize =\n (this.splitter &&\n Math.round(\n parseFloat(\n window\n .getComputedStyle(this.splitter)\n .getPropertyValue(\n this.vertical ? 'height' : 'width'\n )\n )\n )) ||\n SPLITTERSIZE;\n }\n return this._splitterSize;\n }\n\n protected override render(): TemplateResult {\n const splitterClasses = {\n 'is-resized-start': this.splitterPos === this.minPos,\n 'is-resized-end': (this.splitterPos &&\n this.splitterPos > this.splitterSize &&\n this.splitterPos === this.maxPos) as boolean,\n 'is-collapsed-start': this.splitterPos === 0,\n 'is-collapsed-end': (this.splitterPos &&\n this.splitterPos >=\n Math.max(\n this.splitterSize,\n this.viewSize - this.splitterSize\n )) as boolean,\n };\n const label =\n this.label || this.resizable ? 'Resize the panels' : undefined;\n\n return html`\n <slot\n id=${ifDefined(\n this.resizable ? this.controlledEl?.id : undefined\n )}\n @slotchange=${this.onContentSlotChange}\n style=\"--spectrum-split-view-first-pane-size: ${this\n .firstPaneSize}\"\n ></slot>\n ${this.enoughChildren\n ? html`\n <div\n id=\"splitter\"\n class=${classMap(splitterClasses)}\n role=\"separator\"\n aria-controls=${ifDefined(\n this.resizable ? this.controlledEl?.id : undefined\n )}\n aria-label=${ifDefined(label)}\n aria-orientation=${this.vertical\n ? 'horizontal'\n : 'vertical'}\n aria-valuenow=${Math.round(\n (parseFloat(this.firstPaneSize) / this.viewSize) *\n 100\n )}\n tabindex=${ifDefined(\n this.resizable ? '0' : undefined\n )}\n @keydown=${this.onKeydown}\n ${streamingListener({\n start: ['pointerdown', this.onPointerdown],\n streamInside: ['pointermove', this.onPointermove],\n end: [\n [\n 'pointerup',\n 'pointercancel',\n 'pointerleave',\n ],\n this.onPointerup,\n ],\n })}\n >\n ${this.resizable\n ? html`\n <div id=\"gripper\"></div>\n `\n : nothing}\n </div>\n `\n : nothing}\n `;\n }\n\n private controlledElIDApplied = false;\n\n private onContentSlotChange(\n event: Event & { target: HTMLSlotElement }\n ): void {\n if (this.controlledEl && this.controlledElIDApplied) {\n this.controlledEl.removeAttribute('id');\n this.controlledElIDApplied = false;\n }\n this.controlledEl = event.target.assignedElements()[0] as HTMLElement;\n if (this.controlledEl && !this.controlledEl.id) {\n this.controlledEl.id = `${this.tagName.toLowerCase()}-${crypto\n .randomUUID()\n .slice(0, 8)}`;\n this.controlledElIDApplied = true;\n }\n this.enoughChildren = this.children.length > 1;\n this.checkResize();\n }\n\n private onPointerdown(event: PointerEvent): void {\n if (!this.resizable || (event.button && event.button !== 0)) {\n event.preventDefault();\n return;\n }\n this.splitter.setPointerCapture(event.pointerId);\n this.offset = this.getOffset();\n }\n\n private onPointermove(event: PointerEvent): void {\n event.preventDefault();\n let pos =\n this.vertical || this.isLTR\n ? this.getPosition(event) - this.offset\n : this.offset - this.getPosition(event);\n if (this.collapsible && pos < this.minPos - COLLAPSE_THREASHOLD) {\n pos = 0;\n }\n if (this.collapsible && pos > this.maxPos + COLLAPSE_THREASHOLD) {\n pos = this.viewSize - this.splitterSize;\n }\n this.updatePosition(pos);\n }\n\n private onPointerup(event: PointerEvent): void {\n this.splitter.releasePointerCapture(event.pointerId);\n }\n\n private getOffset(): number {\n if (!this.rect) {\n this.rect = this.getBoundingClientRect();\n }\n const offsetX = this.isLTR ? this.rect.left : this.rect.right;\n return this.vertical ? this.rect.top : offsetX;\n }\n\n private getPosition(event: PointerEvent): number {\n return this.vertical ? event.clientY : event.clientX;\n }\n\n private movePosition(event: KeyboardEvent, offset: number): void {\n event.preventDefault();\n if (this.splitterPos !== undefined) {\n this.updatePosition(this.splitterPos + offset);\n }\n }\n\n private onKeydown(event: KeyboardEvent): void {\n if (!this.resizable) {\n return;\n }\n let direction = 0;\n const isLTRorVertical = this.isLTR || this.vertical;\n switch (event.key) {\n case 'Home':\n event.preventDefault();\n this.updatePosition(this.collapsible ? 0 : this.minPos);\n return;\n case 'End':\n event.preventDefault();\n this.updatePosition(\n this.collapsible\n ? this.viewSize - this.splitterSize\n : this.maxPos\n );\n return;\n case 'ArrowLeft':\n direction = isLTRorVertical ? -1 : 1;\n break;\n case 'ArrowRight':\n direction = isLTRorVertical ? 1 : -1;\n break;\n case 'ArrowUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'ArrowDown':\n direction = this.vertical ? 1 : -1;\n break;\n case 'PageUp':\n direction = this.vertical ? -1 : 1;\n break;\n case 'PageDown':\n direction = this.vertical ? 1 : -1;\n break;\n }\n if (direction !== 0) {\n const moveBy = event.key.startsWith('Page')\n ? PAGEUPDOWN_KEY_CHANGE_VALUE\n : ARROW_KEY_CHANGE_VALUE;\n this.movePosition(event, moveBy * direction);\n }\n }\n\n private async checkResize(): Promise<void> {\n if (!this.enoughChildren) {\n return;\n }\n this.updateMinMax();\n if (this.splitterPos === undefined) {\n const startPos = await this.calcStartPos();\n this.updatePosition(startPos);\n }\n }\n\n private updateMinMax(): void {\n this.viewSize = this.vertical ? this.offsetHeight : this.offsetWidth;\n this.minPos = Math.max(\n this.primaryMin,\n this.viewSize - this.secondaryMax\n );\n this.maxPos = Math.min(\n this.primaryMax,\n this.viewSize - Math.max(this.secondaryMin, this.splitterSize)\n );\n }\n\n private updatePosition(x: number): void {\n let pos = this.getLimitedPosition(x);\n if (this.collapsible && x <= 0) {\n pos = 0;\n }\n if (\n this.collapsible &&\n x > this.maxPos &&\n x >= this.viewSize - this.splitterSize\n ) {\n pos = this.viewSize - this.splitterSize;\n }\n if (pos !== this.splitterPos) {\n this.splitterPos = pos;\n this.dispatchChangeEvent();\n }\n }\n\n private getLimitedPosition(input: number): number {\n if (input <= this.minPos) {\n return this.minPos;\n }\n if (input >= this.maxPos) {\n return this.maxPos;\n }\n return Math.max(this.minPos, Math.min(this.maxPos, input));\n }\n\n private async calcStartPos(): Promise<number> {\n if (\n this.primarySize !== undefined &&\n /^\\d+(px)?$/.test(this.primarySize)\n ) {\n return parseInt(this.primarySize, 10);\n }\n if (this.primarySize !== undefined && /^\\d+%$/.test(this.primarySize)) {\n return (parseInt(this.primarySize, 10) * this.viewSize) / 100;\n }\n if (this.primarySize === 'auto') {\n this.firstPaneSize = 'auto';\n const nodes = this.paneSlot.assignedNodes({ flatten: true });\n const firstEl = nodes.find(\n (node) => node instanceof HTMLElement\n ) as LitElement;\n if (typeof firstEl.updateComplete !== 'undefined') {\n await firstEl.updateComplete;\n }\n if (firstEl) {\n const size = window\n .getComputedStyle(firstEl)\n .getPropertyValue(this.vertical ? 'height' : 'width');\n const size_i = parseFloat(size);\n if (!isNaN(size_i)) {\n return this.getLimitedPosition(Math.ceil(size_i));\n }\n }\n }\n return this.viewSize / 2;\n }\n\n private dispatchChangeEvent(): void {\n const changeEvent = new Event('change', {\n bubbles: true,\n composed: true,\n });\n this.dispatchEvent(changeEvent);\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated || changed.has('primarySize')) {\n this.splitterPos = undefined;\n this.checkResize();\n }\n if (\n changed.has('splitterPos') &&\n this.splitterPos !== undefined &&\n this.enoughChildren\n ) {\n this.firstPaneSize = `${Math.round(this.splitterPos)}px`;\n }\n }\n}\n"],
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EAEA,WAAAC,EAEA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,aAAAC,MACG,kDACP,OACI,YAAAC,EACA,SAAAC,EACA,SAAAC,MACG,kDACP,OAAS,qBAAAC,MAAyB,0DAIlC,OAAOC,MAAY,sBAEnB,MAAMC,EAAmB,KAEnBC,EAAe,EAEfC,EAAyB,GAEzBC,EAA8B,GAE9BC,EAAsB,GAQrB,aAAM,kBAAkBZ,CAAgB,CA6EpC,aAAc,CACjB,MAAM,EArEV,KAAO,SAAW,GAGlB,KAAO,UAAY,GAGnB,KAAO,YAAc,GAIrB,KAAO,WAAa,EAIpB,KAAO,WAAaQ,EAapB,KAAO,aAAe,EAItB,KAAO,aAAeA,EAQtB,KAAQ,cAAgB,OAMxB,KAAQ,eAAiB,GAGzB,KAAQ,SAAW,EAQnB,KAAQ,OAAS,EAEjB,KAAQ,OAAS,EAEjB,KAAQ,OAASA,EAyHjB,KAAQ,sBAAwB,GA/G5B,MAAMK,EAAM,OAA4C,eACpDA,IACA,KAAK,SAAW,IAAIA,EAAG,IAAM,CACzB,KAAK,KAAO,OACZ,KAAK,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N/B,EAAS,CAAE,KAAM,OAAQ,QAAS,GAAM,UAAW,cAAe,CAAC,GA3C3D,UA4CF,2BAIC+B,EAAA,CADP/B,EAAS,CAAE,KAAM,OAAQ,UAAW,EAAM,CAAC,GA/CnC,UAgDD,6BAGD+B,EAAA,CADN/B,EAAS,GAlDD,UAmDF,qBAGC+B,EAAA,CADP/B,EAAS,CAAE,KAAM,QAAS,UAAW,EAAM,CAAC,GArDpC,UAsDD,8BAGA+B,EAAA,CADP/B,EAAS,CAAE,KAAM,MAAO,CAAC,GAxDjB,UAyDD,wBAGA+B,EAAA,CADP9B,EAAM,MAAM,GA3DJ,UA4DD,wBAGA8B,EAAA,CADP9B,EAAM,WAAW,GA9DT,UA+DD",
|
6
|
+
"names": ["html", "nothing", "SpectrumElement", "classMap", "ifDefined", "property", "query", "state", "streamingListener", "styles", "DEFAULT_MAX_SIZE", "SPLITTERSIZE", "ARROW_KEY_CHANGE_VALUE", "PAGEUPDOWN_KEY_CHANGE_VALUE", "COLLAPSE_THREASHOLD", "RO", "_a", "_b", "splitterClasses", "label", "event", "pos", "offsetX", "offset", "direction", "isLTRorVertical", "moveBy", "startPos", "x", "input", "firstEl", "node", "size", "size_i", "changeEvent", "changed", "__decorateClass"]
|
7
7
|
}
|