@nanoporetech-digital/components 2.1.3 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +1 -1
- package/dist/cjs/index-cb62df44.js +5 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-components.cjs.js +1 -1
- package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-date-input.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-details.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-file-upload.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-global-search-results.cjs.entry.js +36 -26
- package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-icon-button.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-menu-drawer.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-rating.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-split-pane.cjs.entry.js +278 -0
- package/dist/cjs/nano-split-pane.cjs.entry.js.map +1 -0
- package/dist/cjs/nano-tab-group.cjs.entry.js +1 -0
- package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js +1 -1
- package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/accordion/accordion.js +1 -1
- package/dist/collection/components/alert/alert.js +1 -1
- package/dist/collection/components/algolia/algolia-filter.js +2 -2
- package/dist/collection/components/algolia/algolia-input.js +5 -5
- package/dist/collection/components/algolia/algolia-results.js +1 -1
- package/dist/collection/components/algolia/algolia.js +6 -6
- package/dist/collection/components/checkbox/checkbox-group.js +2 -2
- package/dist/collection/components/checkbox/checkbox.js +3 -3
- package/dist/collection/components/datalist/datalist.css +1 -1
- package/dist/collection/components/datalist/datalist.js +1 -1
- package/dist/collection/components/date-input/date-input.js +7 -7
- package/dist/collection/components/date-picker/date-picker.js +5 -5
- package/dist/collection/components/details/details.js +1 -1
- package/dist/collection/components/dialog/dialog.js +1 -1
- package/dist/collection/components/file-upload/file-upload.js +4 -4
- package/dist/collection/components/global-nav/global-nav.js +4 -4
- package/dist/collection/components/global-search-results/global-search-results.css +21 -0
- package/dist/collection/components/global-search-results/global-search-results.js +35 -25
- package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
- package/dist/collection/components/grid/grid-item.js +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/input/input.js +5 -5
- package/dist/collection/components/nav-item/nav-item.js +4 -4
- package/dist/collection/components/range/range.js +4 -4
- package/dist/collection/components/resize-observe/resize-observe.js +1 -1
- package/dist/collection/components/select/select.js +7 -7
- package/dist/collection/components/slides/slides.js +7 -7
- package/dist/collection/components/split-pane/split-pane.css +104 -0
- package/dist/collection/components/split-pane/split-pane.js +464 -0
- package/dist/collection/components/split-pane/split-pane.js.map +1 -0
- package/dist/collection/components/tabs/tab-group.js +3 -2
- package/dist/collection/components/tabs/tab-group.js.map +1 -1
- package/dist/collection/components/tabs/tab.js +1 -1
- package/dist/collection/components/tabs/tab.js.map +1 -1
- package/dist/collection/utils/drag.js +21 -0
- package/dist/collection/utils/drag.js.map +1 -0
- package/dist/components/datalist.js.map +1 -1
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/menu.js.map +1 -1
- package/dist/components/nano-alert.js.map +1 -1
- package/dist/components/nano-checkbox.js.map +1 -1
- package/dist/components/nano-date-input.js.map +1 -1
- package/dist/components/nano-details.js.map +1 -1
- package/dist/components/nano-dialog.js.map +1 -1
- package/dist/components/nano-file-upload.js.map +1 -1
- package/dist/components/nano-global-nav.js.map +1 -1
- package/dist/components/nano-global-search-results.js +36 -26
- package/dist/components/nano-global-search-results.js.map +1 -1
- package/dist/components/nano-hero.js.map +1 -1
- package/dist/components/nano-menu-drawer.js.map +1 -1
- package/dist/components/nano-rating.js.map +1 -1
- package/dist/components/nano-split-pane.d.ts +11 -0
- package/dist/components/nano-split-pane.js +308 -0
- package/dist/components/nano-split-pane.js.map +1 -0
- package/dist/components/nano-tab-group.js +1 -0
- package/dist/components/nano-tab-group.js.map +1 -1
- package/dist/components/nano-tab.js +1 -1
- package/dist/components/nano-tab.js.map +1 -1
- package/dist/components/option.js.map +1 -1
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +310 -31
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/index-5f8d16e7.js +5 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nano-alert.entry.js.map +1 -1
- package/dist/esm/nano-checkbox.entry.js.map +1 -1
- package/dist/esm/nano-components.js +1 -1
- package/dist/esm/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm/nano-date-input.entry.js.map +1 -1
- package/dist/esm/nano-details.entry.js.map +1 -1
- package/dist/esm/nano-dialog.entry.js.map +1 -1
- package/dist/esm/nano-file-upload.entry.js.map +1 -1
- package/dist/esm/nano-global-nav.entry.js.map +1 -1
- package/dist/esm/nano-global-search-results.entry.js +36 -26
- package/dist/esm/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm/nano-hero.entry.js.map +1 -1
- package/dist/esm/nano-icon-button.entry.js.map +1 -1
- package/dist/esm/nano-menu-drawer.entry.js.map +1 -1
- package/dist/esm/nano-rating.entry.js.map +1 -1
- package/dist/esm/nano-split-pane.entry.js +274 -0
- package/dist/esm/nano-split-pane.entry.js.map +1 -0
- package/dist/esm/nano-tab-group.entry.js +1 -0
- package/dist/esm/nano-tab-group.entry.js.map +1 -1
- package/dist/esm/nano-tab.entry.js +1 -1
- package/dist/esm/nano-tab.entry.js.map +1 -1
- package/dist/esm-es5/index-5f8d16e7.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/nano-alert.entry.js.map +1 -1
- package/dist/esm-es5/nano-checkbox.entry.js.map +1 -1
- package/dist/esm-es5/nano-components.js +1 -1
- package/dist/esm-es5/nano-components.js.map +1 -1
- package/dist/esm-es5/nano-datalist_3.entry.js.map +1 -1
- package/dist/esm-es5/nano-date-input.entry.js.map +1 -1
- package/dist/esm-es5/nano-details.entry.js.map +1 -1
- package/dist/esm-es5/nano-dialog.entry.js.map +1 -1
- package/dist/esm-es5/nano-file-upload.entry.js.map +1 -1
- package/dist/esm-es5/nano-global-nav.entry.js.map +1 -1
- package/dist/esm-es5/nano-global-search-results.entry.js +1 -1
- package/dist/esm-es5/nano-global-search-results.entry.js.map +1 -1
- package/dist/esm-es5/nano-hero.entry.js.map +1 -1
- package/dist/esm-es5/nano-icon-button.entry.js.map +1 -1
- package/dist/esm-es5/nano-menu-drawer.entry.js.map +1 -1
- package/dist/esm-es5/nano-rating.entry.js.map +1 -1
- package/dist/esm-es5/nano-split-pane.entry.js +5 -0
- package/dist/esm-es5/nano-split-pane.entry.js.map +1 -0
- package/dist/esm-es5/nano-tab-group.entry.js +1 -1
- package/dist/esm-es5/nano-tab-group.entry.js.map +1 -1
- package/dist/esm-es5/nano-tab.entry.js +2 -2
- package/dist/esm-es5/nano-tab.entry.js.map +1 -1
- package/dist/nano-components/nano-components.css +1 -1
- package/dist/nano-components/nano-components.esm.js +1 -1
- package/dist/nano-components/nano-components.esm.js.map +1 -1
- package/dist/nano-components/{p-e35eac75.entry.js → p-08b43111.entry.js} +2 -2
- package/dist/nano-components/p-08b43111.entry.js.map +1 -0
- package/dist/nano-components/p-090f22a9.system.entry.js.map +1 -1
- package/dist/nano-components/p-096682d9.system.js +1 -1
- package/dist/nano-components/p-096682d9.system.js.map +1 -1
- package/dist/nano-components/{p-e6f8f9f7.system.entry.js → p-1238f0fc.system.entry.js} +2 -2
- package/dist/nano-components/p-1238f0fc.system.entry.js.map +1 -0
- package/dist/nano-components/p-1e974cad.entry.js.map +1 -1
- package/dist/nano-components/p-1ec44caf.entry.js.map +1 -1
- package/dist/nano-components/p-1f99d776.entry.js +5 -0
- package/dist/nano-components/p-1f99d776.entry.js.map +1 -0
- package/dist/nano-components/p-20db18f3.entry.js.map +1 -1
- package/dist/nano-components/p-3456db01.entry.js.map +1 -1
- package/dist/nano-components/p-3ad1d5aa.system.entry.js.map +1 -1
- package/dist/nano-components/{p-3cf35ac4.system.entry.js → p-3f736fa2.system.entry.js} +2 -2
- package/dist/nano-components/p-3f736fa2.system.entry.js.map +1 -0
- package/dist/nano-components/p-4429caac.system.entry.js.map +1 -1
- package/dist/nano-components/p-531d5275.system.entry.js.map +1 -1
- package/dist/nano-components/p-56ba0d63.entry.js.map +1 -1
- package/dist/nano-components/p-58419bed.system.entry.js.map +1 -1
- package/dist/nano-components/p-5a476bba.system.entry.js.map +1 -1
- package/dist/nano-components/p-6afdb510.system.entry.js +5 -0
- package/dist/nano-components/p-6afdb510.system.entry.js.map +1 -0
- package/dist/nano-components/p-71c26ace.entry.js.map +1 -1
- package/dist/nano-components/p-730f60ea.entry.js.map +1 -1
- package/dist/nano-components/p-7d2e2685.entry.js.map +1 -1
- package/dist/nano-components/p-8a8f893b.system.entry.js.map +1 -1
- package/dist/nano-components/p-93448bcd.system.entry.js.map +1 -1
- package/dist/nano-components/p-94593617.system.entry.js.map +1 -1
- package/dist/nano-components/p-9ca5e023.system.entry.js +5 -0
- package/dist/nano-components/p-9ca5e023.system.entry.js.map +1 -0
- package/dist/nano-components/{p-bbe6b7af.entry.js → p-ad0715d1.entry.js} +2 -2
- package/dist/nano-components/p-ad0715d1.entry.js.map +1 -0
- package/dist/nano-components/p-b59d2bd5.entry.js.map +1 -1
- package/dist/nano-components/p-c0ddb4c3.entry.js.map +1 -1
- package/dist/nano-components/p-d6569144.entry.js.map +1 -1
- package/dist/nano-components/p-d9f2dda5.entry.js +5 -0
- package/dist/nano-components/p-d9f2dda5.entry.js.map +1 -0
- package/dist/nano-components/p-e11bd40d.entry.js.map +1 -1
- package/dist/nano-components/p-e15be516.system.entry.js.map +1 -1
- package/dist/nano-components/p-ef4e0912.system.entry.js.map +1 -1
- package/dist/nano-components/p-f2e7d2f9.system.entry.js.map +1 -1
- package/dist/themes/london-calling.css +1 -1
- package/dist/themes/london-calling.css.map +1 -1
- package/dist/themes/nanopore.css +1 -1
- package/dist/themes/nanopore.css.map +1 -1
- package/dist/types/components/split-pane/split-pane.d.ts +74 -0
- package/dist/types/components.d.ts +85 -0
- package/dist/types/utils/drag.d.ts +1 -0
- package/docs-json.json +294 -2
- package/docs-vscode.json +49 -0
- package/package.json +8 -6
- package/dist/nano-components/p-05844b46.system.entry.js +0 -5
- package/dist/nano-components/p-05844b46.system.entry.js.map +0 -1
- package/dist/nano-components/p-3cf35ac4.system.entry.js.map +0 -1
- package/dist/nano-components/p-bbe6b7af.entry.js.map +0 -1
- package/dist/nano-components/p-e35eac75.entry.js.map +0 -1
- package/dist/nano-components/p-e6f8f9f7.system.entry.js.map +0 -1
- package/dist/nano-components/p-fea32549.entry.js +0 -5
- package/dist/nano-components/p-fea32549.entry.js.map +0 -1
@@ -0,0 +1,464 @@
|
|
1
|
+
/*!
|
2
|
+
* Web Components for Nanopore digital Web Apps
|
3
|
+
*/
|
4
|
+
import { Prop, Component, Watch, Event, Element, Host, h, } from '@stencil/core';
|
5
|
+
import { clamp, raf, debounce } from '../../utils';
|
6
|
+
import { drag } from '../../utils/drag';
|
7
|
+
/**
|
8
|
+
* Split panes display two adjacent panels, allowing the user to reposition them.
|
9
|
+
*
|
10
|
+
* @part start - The start panel.
|
11
|
+
* @part end - The end panel.
|
12
|
+
* @part panel - Targets both the start and end panels.
|
13
|
+
* @part divider - The divider that separates the start and end panels.
|
14
|
+
*
|
15
|
+
* @slot start - The start panel.
|
16
|
+
* @slot end - The end panel.
|
17
|
+
* @slot handle - An optional handle to render at the center of the divider.
|
18
|
+
*/
|
19
|
+
export class SplitPane {
|
20
|
+
constructor() {
|
21
|
+
this.isAnimating = false;
|
22
|
+
this.didLoad = false;
|
23
|
+
this._shouldAnimate = true;
|
24
|
+
/** Draws the split panel in a vertical orientation with the start and end panels stacked. */
|
25
|
+
this.vertical = false;
|
26
|
+
/** Disables resizing. Note that the position may still change as a result of resizing the host element. */
|
27
|
+
this.disabled = false;
|
28
|
+
/** How close the divider must be to a snap point until snapping occurs. */
|
29
|
+
this.snapThreshold = 12;
|
30
|
+
/** When changing `position` via property, the pane will animate into position. Make `animationDuration` 0 to disable. */
|
31
|
+
this.animationDuration = 0.6;
|
32
|
+
// Event handlers
|
33
|
+
this.handleDrag = (e) => {
|
34
|
+
if (this.disabled) {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
// Prevent text selection when dragging
|
38
|
+
e.preventDefault();
|
39
|
+
drag(this.host, (x, y) => {
|
40
|
+
let newPositionInPixels = this.vertical ? y : x;
|
41
|
+
this.nanoDragging.emit(newPositionInPixels);
|
42
|
+
// Flip for end panels
|
43
|
+
if (this.primary === 'end') {
|
44
|
+
newPositionInPixels = this.size - newPositionInPixels;
|
45
|
+
}
|
46
|
+
// Check snap points
|
47
|
+
if (this.snap) {
|
48
|
+
const snaps = this.snap.split(' ');
|
49
|
+
snaps.forEach((value) => {
|
50
|
+
let snapPoint;
|
51
|
+
if (value.endsWith('%')) {
|
52
|
+
snapPoint = this.size * (parseFloat(value) / 100);
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
snapPoint = parseFloat(value);
|
56
|
+
}
|
57
|
+
if (newPositionInPixels >= snapPoint - this.snapThreshold &&
|
58
|
+
newPositionInPixels <= snapPoint + this.snapThreshold) {
|
59
|
+
newPositionInPixels = snapPoint;
|
60
|
+
}
|
61
|
+
});
|
62
|
+
}
|
63
|
+
this.shouldAnimate = false;
|
64
|
+
this.position = clamp(this.pixelsToPercentage(newPositionInPixels), 0, 100);
|
65
|
+
raf(() => (this.shouldAnimate = true));
|
66
|
+
});
|
67
|
+
};
|
68
|
+
this.handleKeyDown = (event) => {
|
69
|
+
if (this.disabled) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
if ([
|
73
|
+
'ArrowLeft',
|
74
|
+
'ArrowRight',
|
75
|
+
'ArrowUp',
|
76
|
+
'ArrowDown',
|
77
|
+
'Home',
|
78
|
+
'End',
|
79
|
+
].includes(event.key)) {
|
80
|
+
let newPosition = this.position;
|
81
|
+
const incr = (event.shiftKey ? 10 : 1) * (this.primary === 'end' ? -1 : 1);
|
82
|
+
event.preventDefault();
|
83
|
+
if ((event.key === 'ArrowLeft' && !this.vertical) ||
|
84
|
+
(event.key === 'ArrowUp' && this.vertical)) {
|
85
|
+
newPosition -= incr;
|
86
|
+
}
|
87
|
+
if ((event.key === 'ArrowRight' && !this.vertical) ||
|
88
|
+
(event.key === 'ArrowDown' && this.vertical)) {
|
89
|
+
newPosition += incr;
|
90
|
+
}
|
91
|
+
if (event.key === 'Home') {
|
92
|
+
newPosition = this.primary === 'end' ? 100 : 0;
|
93
|
+
}
|
94
|
+
if (event.key === 'End') {
|
95
|
+
newPosition = this.primary === 'end' ? 0 : 100;
|
96
|
+
}
|
97
|
+
this.shouldAnimate = false;
|
98
|
+
this.position = clamp(newPosition, 0, 100);
|
99
|
+
raf(() => (this.shouldAnimate = true));
|
100
|
+
}
|
101
|
+
};
|
102
|
+
this.handleResize = () => {
|
103
|
+
if (!this.didLoad || this.isAnimating)
|
104
|
+
return;
|
105
|
+
// Resize when a primary panel is set
|
106
|
+
if (this.primary) {
|
107
|
+
this.shouldAnimate = false;
|
108
|
+
this.position = this.pixelsToPercentage(this.cachedPositionInPixels);
|
109
|
+
raf(() => (this.shouldAnimate = true));
|
110
|
+
}
|
111
|
+
};
|
112
|
+
this.handlePositionChange = debounce(this.handlePositionChange.bind(this), 100);
|
113
|
+
}
|
114
|
+
get size() {
|
115
|
+
const { width, height } = this.host.getBoundingClientRect();
|
116
|
+
return this.vertical ? height : width;
|
117
|
+
}
|
118
|
+
get shouldAnimate() {
|
119
|
+
return this.didLoad && this._shouldAnimate;
|
120
|
+
}
|
121
|
+
set shouldAnimate(sa) {
|
122
|
+
this._shouldAnimate = sa;
|
123
|
+
}
|
124
|
+
/**
|
125
|
+
* The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the
|
126
|
+
* container's initial size.
|
127
|
+
*/
|
128
|
+
get position() {
|
129
|
+
return this._position;
|
130
|
+
}
|
131
|
+
set position(pos) {
|
132
|
+
// override too high / low
|
133
|
+
pos = Math.min(Math.max(pos, 0), 100);
|
134
|
+
if (isNaN(pos) || pos === this._position)
|
135
|
+
return;
|
136
|
+
if (this.shouldAnimate &&
|
137
|
+
this.animationDuration > 0 &&
|
138
|
+
!isNaN(this.position)) {
|
139
|
+
this.animatePosition(pos);
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
this._position = pos;
|
143
|
+
}
|
144
|
+
// eslint-disable-next-line @stencil/no-unused-watch
|
145
|
+
handlePositionChange() {
|
146
|
+
this.cachedPositionInPixels = this.percentageToPixels(this.position);
|
147
|
+
this.positionInPixels = this.percentageToPixels(this.position);
|
148
|
+
this.nanoReposition.emit();
|
149
|
+
}
|
150
|
+
handlePositionInPixelsChange() {
|
151
|
+
this.position = this.pixelsToPercentage(this.positionInPixels);
|
152
|
+
}
|
153
|
+
// Private logic
|
154
|
+
animatePosition(end) {
|
155
|
+
if (this.isAnimating)
|
156
|
+
return;
|
157
|
+
const duration = this.animationDuration; // seconds
|
158
|
+
const fps = 60;
|
159
|
+
const start = this.position;
|
160
|
+
const distance = end - start;
|
161
|
+
let position = start;
|
162
|
+
let time = 0;
|
163
|
+
function easeInOutQuad(t, s, e, d) {
|
164
|
+
if ((t /= d / 2) < 1)
|
165
|
+
return (e / 2) * t * t + s;
|
166
|
+
else
|
167
|
+
return (-e / 2) * (--t * (t - 2) - 1) + s;
|
168
|
+
}
|
169
|
+
const go = () => {
|
170
|
+
time += 1 / fps;
|
171
|
+
position = easeInOutQuad(time, start, distance, duration);
|
172
|
+
if ((end > start && position >= end) ||
|
173
|
+
(end < start && position <= end)) {
|
174
|
+
this.position = end;
|
175
|
+
this.shouldAnimate = true;
|
176
|
+
this.isAnimating = false;
|
177
|
+
return;
|
178
|
+
}
|
179
|
+
this.position = position;
|
180
|
+
raf(go);
|
181
|
+
};
|
182
|
+
this.shouldAnimate = false;
|
183
|
+
this.isAnimating = true;
|
184
|
+
raf(go);
|
185
|
+
}
|
186
|
+
percentageToPixels(value) {
|
187
|
+
return this.size * (value / 100);
|
188
|
+
}
|
189
|
+
pixelsToPercentage(value) {
|
190
|
+
return (value / this.size) * 100;
|
191
|
+
}
|
192
|
+
attachRO() {
|
193
|
+
this.detachRO();
|
194
|
+
this.ro = new ResizeObserver(() => this.handleResize());
|
195
|
+
this.ro.observe(this.host);
|
196
|
+
}
|
197
|
+
detachRO() {
|
198
|
+
if (!this.ro)
|
199
|
+
return;
|
200
|
+
this.ro.unobserve(this.host);
|
201
|
+
this.ro = undefined;
|
202
|
+
}
|
203
|
+
componentDidLoad() {
|
204
|
+
if (this.positionInPixels)
|
205
|
+
this.handlePositionInPixelsChange();
|
206
|
+
setTimeout(() => (this.didLoad = true));
|
207
|
+
}
|
208
|
+
connectedCallback() {
|
209
|
+
this.cachedPositionInPixels = this.percentageToPixels(this.position);
|
210
|
+
this.attachRO();
|
211
|
+
}
|
212
|
+
disconnectedCallback() {
|
213
|
+
this.detachRO();
|
214
|
+
}
|
215
|
+
componentDidRender() {
|
216
|
+
// bit hacky ... because we use getter / setter for position, there's a render *before* `position` is passed in via attribute
|
217
|
+
// if we set a default position in the class, this causes the divider to jump (from default to user set position)
|
218
|
+
// so - wait a render, see if there's a position passed in via attribute, *then* set default if not
|
219
|
+
raf(() => {
|
220
|
+
if (typeof this.position === 'undefined') {
|
221
|
+
this.position = 50;
|
222
|
+
}
|
223
|
+
});
|
224
|
+
}
|
225
|
+
render() {
|
226
|
+
if (typeof this.position === 'undefined')
|
227
|
+
return;
|
228
|
+
const styles = {};
|
229
|
+
const gridTemplate = this.vertical
|
230
|
+
? 'gridTemplateRows'
|
231
|
+
: 'gridTemplateColumns';
|
232
|
+
const primary = `
|
233
|
+
clamp(
|
234
|
+
0%,
|
235
|
+
clamp(
|
236
|
+
var(--min),
|
237
|
+
${this.position}% - var(--divider-width) / 2,
|
238
|
+
var(--max)
|
239
|
+
),
|
240
|
+
calc(100% - var(--divider-width))
|
241
|
+
)
|
242
|
+
`;
|
243
|
+
const secondary = 'auto';
|
244
|
+
if (this.primary === 'end') {
|
245
|
+
styles[gridTemplate] = `${secondary} var(--divider-width) ${primary}`;
|
246
|
+
}
|
247
|
+
else {
|
248
|
+
styles[gridTemplate] = `${primary} var(--divider-width) ${secondary}`;
|
249
|
+
}
|
250
|
+
return (h(Host, { style: styles },
|
251
|
+
h("div", { part: "panel start", class: "start" },
|
252
|
+
h("slot", { name: "start" })),
|
253
|
+
h("div", { part: "divider", class: "divider", tabindex: this.disabled ? undefined : '0', role: "separator", "aria-label": "Resize", onKeyDown: this.handleKeyDown, onMouseDown: this.handleDrag, onTouchStart: this.handleDrag },
|
254
|
+
h("slot", { name: "handle" }, !this.disabled && this.vertical ? (h("nano-icon", { slot: "handle", name: "solid/grip-lines" })) : (h("nano-icon", { slot: "handle", name: "solid/grip-lines-vertical" })))),
|
255
|
+
h("div", { part: "panel end", class: "end" },
|
256
|
+
h("slot", { name: "end" }))));
|
257
|
+
}
|
258
|
+
static get is() { return "nano-split-pane"; }
|
259
|
+
static get encapsulation() { return "shadow"; }
|
260
|
+
static get originalStyleUrls() { return {
|
261
|
+
"$": ["split-pane.scss"]
|
262
|
+
}; }
|
263
|
+
static get styleUrls() { return {
|
264
|
+
"$": ["split-pane.css"]
|
265
|
+
}; }
|
266
|
+
static get properties() { return {
|
267
|
+
"position": {
|
268
|
+
"type": "number",
|
269
|
+
"mutable": false,
|
270
|
+
"complexType": {
|
271
|
+
"original": "number",
|
272
|
+
"resolved": "number",
|
273
|
+
"references": {}
|
274
|
+
},
|
275
|
+
"required": false,
|
276
|
+
"optional": false,
|
277
|
+
"docs": {
|
278
|
+
"tags": [],
|
279
|
+
"text": "The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the\ncontainer's initial size."
|
280
|
+
},
|
281
|
+
"getter": true,
|
282
|
+
"setter": true,
|
283
|
+
"attribute": "position",
|
284
|
+
"reflect": false
|
285
|
+
},
|
286
|
+
"positionInPixels": {
|
287
|
+
"type": "number",
|
288
|
+
"mutable": true,
|
289
|
+
"complexType": {
|
290
|
+
"original": "number",
|
291
|
+
"resolved": "number",
|
292
|
+
"references": {}
|
293
|
+
},
|
294
|
+
"required": false,
|
295
|
+
"optional": false,
|
296
|
+
"docs": {
|
297
|
+
"tags": [],
|
298
|
+
"text": "The current position of the divider from the primary panel's edge in pixels."
|
299
|
+
},
|
300
|
+
"getter": false,
|
301
|
+
"setter": false,
|
302
|
+
"attribute": "position-in-pixels",
|
303
|
+
"reflect": false
|
304
|
+
},
|
305
|
+
"vertical": {
|
306
|
+
"type": "boolean",
|
307
|
+
"mutable": false,
|
308
|
+
"complexType": {
|
309
|
+
"original": "boolean",
|
310
|
+
"resolved": "boolean",
|
311
|
+
"references": {}
|
312
|
+
},
|
313
|
+
"required": false,
|
314
|
+
"optional": false,
|
315
|
+
"docs": {
|
316
|
+
"tags": [],
|
317
|
+
"text": "Draws the split panel in a vertical orientation with the start and end panels stacked."
|
318
|
+
},
|
319
|
+
"getter": false,
|
320
|
+
"setter": false,
|
321
|
+
"attribute": "vertical",
|
322
|
+
"reflect": true,
|
323
|
+
"defaultValue": "false"
|
324
|
+
},
|
325
|
+
"disabled": {
|
326
|
+
"type": "boolean",
|
327
|
+
"mutable": false,
|
328
|
+
"complexType": {
|
329
|
+
"original": "boolean",
|
330
|
+
"resolved": "boolean",
|
331
|
+
"references": {}
|
332
|
+
},
|
333
|
+
"required": false,
|
334
|
+
"optional": false,
|
335
|
+
"docs": {
|
336
|
+
"tags": [],
|
337
|
+
"text": "Disables resizing. Note that the position may still change as a result of resizing the host element."
|
338
|
+
},
|
339
|
+
"getter": false,
|
340
|
+
"setter": false,
|
341
|
+
"attribute": "disabled",
|
342
|
+
"reflect": true,
|
343
|
+
"defaultValue": "false"
|
344
|
+
},
|
345
|
+
"primary": {
|
346
|
+
"type": "string",
|
347
|
+
"mutable": false,
|
348
|
+
"complexType": {
|
349
|
+
"original": "'start' | 'end'",
|
350
|
+
"resolved": "\"end\" | \"start\"",
|
351
|
+
"references": {}
|
352
|
+
},
|
353
|
+
"required": false,
|
354
|
+
"optional": true,
|
355
|
+
"docs": {
|
356
|
+
"tags": [],
|
357
|
+
"text": "If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a\nprimary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the\nhost element is resized."
|
358
|
+
},
|
359
|
+
"getter": false,
|
360
|
+
"setter": false,
|
361
|
+
"attribute": "primary",
|
362
|
+
"reflect": false
|
363
|
+
},
|
364
|
+
"snap": {
|
365
|
+
"type": "string",
|
366
|
+
"mutable": false,
|
367
|
+
"complexType": {
|
368
|
+
"original": "string",
|
369
|
+
"resolved": "string",
|
370
|
+
"references": {}
|
371
|
+
},
|
372
|
+
"required": false,
|
373
|
+
"optional": true,
|
374
|
+
"docs": {
|
375
|
+
"tags": [],
|
376
|
+
"text": "One or more space-separated values at which the divider should snap. Values can be in pixels or percentages, e.g.\n`\"100px 50%\"`."
|
377
|
+
},
|
378
|
+
"getter": false,
|
379
|
+
"setter": false,
|
380
|
+
"attribute": "snap",
|
381
|
+
"reflect": false
|
382
|
+
},
|
383
|
+
"snapThreshold": {
|
384
|
+
"type": "number",
|
385
|
+
"mutable": false,
|
386
|
+
"complexType": {
|
387
|
+
"original": "number",
|
388
|
+
"resolved": "number",
|
389
|
+
"references": {}
|
390
|
+
},
|
391
|
+
"required": false,
|
392
|
+
"optional": false,
|
393
|
+
"docs": {
|
394
|
+
"tags": [],
|
395
|
+
"text": "How close the divider must be to a snap point until snapping occurs."
|
396
|
+
},
|
397
|
+
"getter": false,
|
398
|
+
"setter": false,
|
399
|
+
"attribute": "snap-threshold",
|
400
|
+
"reflect": false,
|
401
|
+
"defaultValue": "12"
|
402
|
+
},
|
403
|
+
"animationDuration": {
|
404
|
+
"type": "number",
|
405
|
+
"mutable": false,
|
406
|
+
"complexType": {
|
407
|
+
"original": "number",
|
408
|
+
"resolved": "number",
|
409
|
+
"references": {}
|
410
|
+
},
|
411
|
+
"required": false,
|
412
|
+
"optional": false,
|
413
|
+
"docs": {
|
414
|
+
"tags": [],
|
415
|
+
"text": "When changing `position` via property, the pane will animate into position. Make `animationDuration` 0 to disable."
|
416
|
+
},
|
417
|
+
"getter": false,
|
418
|
+
"setter": false,
|
419
|
+
"attribute": "animation-duration",
|
420
|
+
"reflect": false,
|
421
|
+
"defaultValue": "0.6"
|
422
|
+
}
|
423
|
+
}; }
|
424
|
+
static get events() { return [{
|
425
|
+
"method": "nanoReposition",
|
426
|
+
"name": "nanoReposition",
|
427
|
+
"bubbles": true,
|
428
|
+
"cancelable": true,
|
429
|
+
"composed": true,
|
430
|
+
"docs": {
|
431
|
+
"tags": [],
|
432
|
+
"text": "Emitted when the divider's position changes."
|
433
|
+
},
|
434
|
+
"complexType": {
|
435
|
+
"original": "any",
|
436
|
+
"resolved": "any",
|
437
|
+
"references": {}
|
438
|
+
}
|
439
|
+
}, {
|
440
|
+
"method": "nanoDragging",
|
441
|
+
"name": "nanoDragging",
|
442
|
+
"bubbles": true,
|
443
|
+
"cancelable": true,
|
444
|
+
"composed": true,
|
445
|
+
"docs": {
|
446
|
+
"tags": [],
|
447
|
+
"text": "Emitted when the divider is being dragged."
|
448
|
+
},
|
449
|
+
"complexType": {
|
450
|
+
"original": "number",
|
451
|
+
"resolved": "number",
|
452
|
+
"references": {}
|
453
|
+
}
|
454
|
+
}]; }
|
455
|
+
static get elementRef() { return "host"; }
|
456
|
+
static get watchers() { return [{
|
457
|
+
"propName": "position",
|
458
|
+
"methodName": "handlePositionChange"
|
459
|
+
}, {
|
460
|
+
"propName": "positionInPixels",
|
461
|
+
"methodName": "handlePositionInPixelsChange"
|
462
|
+
}]; }
|
463
|
+
}
|
464
|
+
//# sourceMappingURL=split-pane.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"split-pane.js","sourceRoot":"","sources":["../../../src/components/split-pane/split-pane.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,KAAK,EACL,KAAK,EAGL,OAAO,EACP,IAAI,EACJ,CAAC,GACF,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;;;;;;GAWG;AAMH,MAAM,OAAO,SAAS;EAoBpB;IAhBQ,gBAAW,GAAG,KAAK,CAAC;IACpB,YAAO,GAAG,KAAK,CAAC;IAahB,mBAAc,GAAY,IAAI,CAAC;IAoDvC,6FAA6F;IACpE,aAAQ,GAAG,KAAK,CAAC;IAE1C,2GAA2G;IAClF,aAAQ,GAAG,KAAK,CAAC;IAe1C,2EAA2E;IACnE,kBAAa,GAAG,EAAE,CAAC;IAE3B,yHAAyH;IACjH,sBAAiB,GAAG,GAAG,CAAC;IAoEhC,iBAAiB;IAET,eAAU,GAAG,CAAC,CAAQ,EAAE,EAAE;MAChC,IAAI,IAAI,CAAC,QAAQ,EAAE;QACjB,OAAO;OACR;MAED,uCAAuC;MACvC,CAAC,CAAC,cAAc,EAAE,CAAC;MAEnB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACvB,IAAI,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhD,IAAI,CAAC,YAAY,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Prop,\n Component,\n Watch,\n Event,\n EventEmitter,\n ComponentInterface,\n Element,\n Host,\n h,\n} from '@stencil/core';\nimport { clamp, raf, debounce } from '../../utils';\nimport { drag } from '../../utils/drag';\n\n/**\n * Split panes display two adjacent panels, allowing the user to reposition them.\n *\n * @part start - The start panel.\n * @part end - The end panel.\n * @part panel - Targets both the start and end panels.\n * @part divider - The divider that separates the start and end panels.\n *\n * @slot start - The start panel.\n * @slot end - The end panel.\n * @slot handle - An optional handle to render at the center of the divider.\n */\n@Component({\n tag: 'nano-split-pane',\n styleUrl: 'split-pane.scss',\n shadow: true,\n})\nexport class SplitPane implements ComponentInterface {\n @Element() host: HTMLNanoSplitPaneElement;\n private cachedPositionInPixels: number;\n private ro: ResizeObserver;\n private isAnimating = false;\n private didLoad = false;\n\n private get size() {\n const { width, height } = this.host.getBoundingClientRect();\n return this.vertical ? height : width;\n }\n\n private get shouldAnimate() {\n return this.didLoad && this._shouldAnimate;\n }\n private set shouldAnimate(sa: boolean) {\n this._shouldAnimate = sa;\n }\n private _shouldAnimate: boolean = true;\n\n constructor() {\n this.handlePositionChange = debounce(\n this.handlePositionChange.bind(this),\n 100\n );\n }\n\n /**\n * The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the\n * container's initial size.\n */\n @Prop()\n get position() {\n return this._position;\n }\n set position(pos: number) {\n // override too high / low\n pos = Math.min(Math.max(pos, 0), 100);\n if (isNaN(pos) || pos === this._position) return;\n\n if (\n this.shouldAnimate &&\n this.animationDuration > 0 &&\n !isNaN(this.position)\n ) {\n this.animatePosition(pos);\n return;\n }\n this._position = pos;\n }\n private _position: number;\n\n // eslint-disable-next-line @stencil/no-unused-watch\n @Watch('position')\n handlePositionChange() {\n this.cachedPositionInPixels = this.percentageToPixels(this.position);\n this.positionInPixels = this.percentageToPixels(this.position);\n this.nanoReposition.emit();\n }\n\n /**\n * The current position of the divider from the primary panel's edge in pixels.\n */\n @Prop({ mutable: true }) positionInPixels: number;\n\n @Watch('positionInPixels')\n handlePositionInPixelsChange() {\n this.position = this.pixelsToPercentage(this.positionInPixels);\n }\n\n /** Draws the split panel in a vertical orientation with the start and end panels stacked. */\n @Prop({ reflect: true }) vertical = false;\n\n /** Disables resizing. Note that the position may still change as a result of resizing the host element. */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a\n * primary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the\n * host element is resized.\n */\n @Prop() primary?: 'start' | 'end';\n\n /**\n * One or more space-separated values at which the divider should snap. Values can be in pixels or percentages, e.g.\n * `\"100px 50%\"`.\n */\n @Prop() snap?: string;\n\n /** How close the divider must be to a snap point until snapping occurs. */\n @Prop() snapThreshold = 12;\n\n /** When changing `position` via property, the pane will animate into position. Make `animationDuration` 0 to disable. */\n @Prop() animationDuration = 0.6;\n\n /** Emitted when the divider's position changes. */\n @Event() nanoReposition: EventEmitter;\n\n /** Emitted when the divider is being dragged. */\n @Event() nanoDragging: EventEmitter<number>;\n\n // Private logic\n\n private animatePosition(end: number) {\n if (this.isAnimating) return;\n\n const duration = this.animationDuration; // seconds\n const fps = 60;\n const start = this.position;\n const distance = end - start;\n\n let position = start;\n let time = 0;\n\n function easeInOutQuad(t: number, s: number, e: number, d: number) {\n if ((t /= d / 2) < 1) return (e / 2) * t * t + s;\n else return (-e / 2) * (--t * (t - 2) - 1) + s;\n }\n\n const go = () => {\n time += 1 / fps;\n position = easeInOutQuad(time, start, distance, duration);\n\n if (\n (end > start && position >= end) ||\n (end < start && position <= end)\n ) {\n this.position = end;\n this.shouldAnimate = true;\n this.isAnimating = false;\n return;\n }\n this.position = position;\n raf(go);\n };\n\n this.shouldAnimate = false;\n this.isAnimating = true;\n raf(go);\n }\n\n private percentageToPixels(value: number) {\n return this.size * (value / 100);\n }\n\n private pixelsToPercentage(value: number) {\n return (value / this.size) * 100;\n }\n\n private attachRO() {\n this.detachRO();\n this.ro = new ResizeObserver(() => this.handleResize());\n this.ro.observe(this.host);\n }\n\n private detachRO() {\n if (!this.ro) return;\n this.ro.unobserve(this.host);\n this.ro = undefined;\n }\n\n // Event handlers\n\n private handleDrag = (e: Event) => {\n if (this.disabled) {\n return;\n }\n\n // Prevent text selection when dragging\n e.preventDefault();\n\n drag(this.host, (x, y) => {\n let newPositionInPixels = this.vertical ? y : x;\n\n this.nanoDragging.emit(newPositionInPixels);\n\n // Flip for end panels\n if (this.primary === 'end') {\n newPositionInPixels = this.size - newPositionInPixels;\n }\n\n // Check snap points\n if (this.snap) {\n const snaps = this.snap.split(' ');\n\n snaps.forEach((value) => {\n let snapPoint: number;\n\n if (value.endsWith('%')) {\n snapPoint = this.size * (parseFloat(value) / 100);\n } else {\n snapPoint = parseFloat(value);\n }\n\n if (\n newPositionInPixels >= snapPoint - this.snapThreshold &&\n newPositionInPixels <= snapPoint + this.snapThreshold\n ) {\n newPositionInPixels = snapPoint;\n }\n });\n }\n this.shouldAnimate = false;\n this.position = clamp(\n this.pixelsToPercentage(newPositionInPixels),\n 0,\n 100\n );\n raf(() => (this.shouldAnimate = true));\n });\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) {\n return;\n }\n\n if (\n [\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n ].includes(event.key)\n ) {\n let newPosition = this.position;\n const incr =\n (event.shiftKey ? 10 : 1) * (this.primary === 'end' ? -1 : 1);\n\n event.preventDefault();\n\n if (\n (event.key === 'ArrowLeft' && !this.vertical) ||\n (event.key === 'ArrowUp' && this.vertical)\n ) {\n newPosition -= incr;\n }\n\n if (\n (event.key === 'ArrowRight' && !this.vertical) ||\n (event.key === 'ArrowDown' && this.vertical)\n ) {\n newPosition += incr;\n }\n\n if (event.key === 'Home') {\n newPosition = this.primary === 'end' ? 100 : 0;\n }\n\n if (event.key === 'End') {\n newPosition = this.primary === 'end' ? 0 : 100;\n }\n\n this.shouldAnimate = false;\n\n this.position = clamp(newPosition, 0, 100);\n raf(() => (this.shouldAnimate = true));\n }\n };\n\n private handleResize = () => {\n if (!this.didLoad || this.isAnimating) return;\n\n // Resize when a primary panel is set\n if (this.primary) {\n this.shouldAnimate = false;\n this.position = this.pixelsToPercentage(this.cachedPositionInPixels);\n raf(() => (this.shouldAnimate = true));\n }\n };\n\n componentDidLoad(): void {\n if (this.positionInPixels) this.handlePositionInPixelsChange();\n setTimeout(() => (this.didLoad = true));\n }\n\n connectedCallback() {\n this.cachedPositionInPixels = this.percentageToPixels(this.position);\n this.attachRO();\n }\n\n disconnectedCallback() {\n this.detachRO();\n }\n\n componentDidRender(): void {\n // bit hacky ... because we use getter / setter for position, there's a render *before* `position` is passed in via attribute\n // if we set a default position in the class, this causes the divider to jump (from default to user set position)\n // so - wait a render, see if there's a position passed in via attribute, *then* set default if not\n raf(() => {\n if (typeof this.position === 'undefined') {\n this.position = 50;\n }\n });\n }\n\n render() {\n if (typeof this.position === 'undefined') return;\n const styles: { gridTemplateRows?: string; gridTemplateColumns?: string } =\n {};\n const gridTemplate = this.vertical\n ? 'gridTemplateRows'\n : 'gridTemplateColumns';\n const primary = `\n clamp(\n 0%,\n clamp(\n var(--min),\n ${this.position}% - var(--divider-width) / 2,\n var(--max)\n ),\n calc(100% - var(--divider-width))\n )\n `;\n const secondary = 'auto';\n\n if (this.primary === 'end') {\n styles[gridTemplate] = `${secondary} var(--divider-width) ${primary}`;\n } else {\n styles[gridTemplate] = `${primary} var(--divider-width) ${secondary}`;\n }\n\n return (\n <Host style={styles}>\n <div part=\"panel start\" class=\"start\">\n <slot name=\"start\"></slot>\n </div>\n <div\n part=\"divider\"\n class=\"divider\"\n tabindex={this.disabled ? undefined : '0'}\n role=\"separator\"\n aria-label=\"Resize\"\n onKeyDown={this.handleKeyDown}\n onMouseDown={this.handleDrag}\n onTouchStart={this.handleDrag}\n >\n <slot name=\"handle\">\n {!this.disabled && this.vertical ? (\n <nano-icon slot=\"handle\" name=\"solid/grip-lines\" />\n ) : (\n <nano-icon slot=\"handle\" name=\"solid/grip-lines-vertical\" />\n )}\n </slot>\n </div>\n <div part=\"panel end\" class=\"end\">\n <slot name=\"end\"></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
|
@@ -394,6 +394,7 @@ export class TabGroup {
|
|
394
394
|
setTimeout(() => {
|
395
395
|
this.updateScrollControls();
|
396
396
|
this.syncActiveTabIndicator();
|
397
|
+
scrollIntoView(this.activeTab, this.nav, 'horizontal', 'center');
|
397
398
|
}, 500);
|
398
399
|
});
|
399
400
|
this.resizeObserver.observe(this.nav);
|
@@ -501,7 +502,7 @@ export class TabGroup {
|
|
501
502
|
"references": {
|
502
503
|
"Color": {
|
503
504
|
"location": "import",
|
504
|
-
"path": "/builds/
|
505
|
+
"path": "/builds/oyGwf-FZ/0/Digital/nano-components/packages/components/src/interface.d.ts"
|
505
506
|
}
|
506
507
|
}
|
507
508
|
},
|
@@ -544,7 +545,7 @@ export class TabGroup {
|
|
544
545
|
"references": {
|
545
546
|
"StorageMethods": {
|
546
547
|
"location": "import",
|
547
|
-
"path": "/builds/
|
548
|
+
"path": "/builds/oyGwf-FZ/0/Digital/nano-components/packages/components/src/utils/store/component-store.ts"
|
548
549
|
}
|
549
550
|
}
|
550
551
|
},
|