@vertexvis/ui 0.1.1 → 0.1.2-canary.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/dist/components/auto-resize-textarea.js +157 -0
- package/dist/components/color-swatch.js +124 -0
- package/dist/components/dom.js +13 -0
- package/dist/components/expandable.js +100 -0
- package/dist/components/icon-button.js +63 -0
- package/dist/components/icon-helper.js +722 -0
- package/dist/components/icon.js +43 -0
- package/dist/components/index.d.ts +71 -0
- package/dist/components/index.js +52 -0
- package/dist/components/index2.js +89 -0
- package/dist/components/menu.js +89 -0
- package/dist/components/popover.js +1737 -0
- package/dist/components/result-list.js +565 -0
- package/dist/components/slots.js +26 -0
- package/dist/components/text-field.js +171 -0
- package/dist/components/tooltip.js +360 -0
- package/dist/components/tslib.es6.js +65 -0
- package/dist/components/vertex-auto-resize-textarea.d.ts +11 -0
- package/dist/components/vertex-auto-resize-textarea.js +6 -0
- package/dist/components/vertex-avatar-group.d.ts +11 -0
- package/dist/components/vertex-avatar-group.js +34 -0
- package/dist/components/vertex-avatar.d.ts +11 -0
- package/dist/components/vertex-avatar.js +68 -0
- package/dist/components/vertex-badge.d.ts +11 -0
- package/dist/components/vertex-badge.js +43 -0
- package/dist/components/vertex-banner.d.ts +11 -0
- package/dist/components/vertex-banner.js +141 -0
- package/dist/components/vertex-button.d.ts +11 -0
- package/dist/components/vertex-button.js +96 -0
- package/dist/components/vertex-card-group.d.ts +11 -0
- package/dist/components/vertex-card-group.js +51 -0
- package/dist/components/vertex-card.d.ts +11 -0
- package/dist/components/vertex-card.js +49 -0
- package/dist/components/vertex-chip.d.ts +11 -0
- package/dist/components/vertex-chip.js +45 -0
- package/dist/components/vertex-click-to-edit-textfield.d.ts +11 -0
- package/dist/components/vertex-click-to-edit-textfield.js +156 -0
- package/dist/components/vertex-collapsible.d.ts +11 -0
- package/dist/components/vertex-collapsible.js +63 -0
- package/dist/components/vertex-color-circle-picker.d.ts +11 -0
- package/dist/components/vertex-color-circle-picker.js +104 -0
- package/dist/components/vertex-color-picker.d.ts +11 -0
- package/dist/components/vertex-color-picker.js +75 -0
- package/dist/components/vertex-color-swatch.d.ts +11 -0
- package/dist/components/vertex-color-swatch.js +6 -0
- package/dist/components/vertex-context-menu.d.ts +11 -0
- package/dist/components/vertex-context-menu.js +125 -0
- package/dist/components/vertex-dialog.d.ts +11 -0
- package/dist/components/vertex-dialog.js +263 -0
- package/dist/components/vertex-draggable-popover.d.ts +11 -0
- package/dist/components/vertex-draggable-popover.js +119 -0
- package/dist/components/vertex-dropdown-menu.d.ts +11 -0
- package/dist/components/vertex-dropdown-menu.js +64 -0
- package/dist/components/vertex-expandable.d.ts +11 -0
- package/dist/components/vertex-expandable.js +6 -0
- package/dist/components/vertex-help-tooltip.d.ts +11 -0
- package/dist/components/vertex-help-tooltip.js +67 -0
- package/dist/components/vertex-icon-button.d.ts +11 -0
- package/dist/components/vertex-icon-button.js +6 -0
- package/dist/components/vertex-icon.d.ts +11 -0
- package/dist/components/vertex-icon.js +6 -0
- package/dist/components/vertex-logo-loading.d.ts +11 -0
- package/dist/components/vertex-logo-loading.js +34 -0
- package/dist/components/vertex-menu-divider.d.ts +11 -0
- package/dist/components/vertex-menu-divider.js +34 -0
- package/dist/components/vertex-menu-item.d.ts +11 -0
- package/dist/components/vertex-menu-item.js +44 -0
- package/dist/components/vertex-menu.d.ts +11 -0
- package/dist/components/vertex-menu.js +6 -0
- package/dist/components/vertex-popover.d.ts +11 -0
- package/dist/components/vertex-popover.js +6 -0
- package/dist/components/vertex-radio-group.d.ts +11 -0
- package/dist/components/vertex-radio-group.js +88 -0
- package/dist/components/vertex-radio.d.ts +11 -0
- package/dist/components/vertex-radio.js +56 -0
- package/dist/components/vertex-resizable.d.ts +11 -0
- package/dist/components/vertex-resizable.js +445 -0
- package/dist/components/vertex-result-list.d.ts +11 -0
- package/dist/components/vertex-result-list.js +6 -0
- package/dist/components/vertex-search-bar.d.ts +11 -0
- package/dist/components/vertex-search-bar.js +568 -0
- package/dist/components/vertex-select.d.ts +11 -0
- package/dist/components/vertex-select.js +200 -0
- package/dist/components/vertex-slider.d.ts +11 -0
- package/dist/components/vertex-slider.js +81 -0
- package/dist/components/vertex-spinner.d.ts +11 -0
- package/dist/components/vertex-spinner.js +49 -0
- package/dist/components/vertex-tab.d.ts +11 -0
- package/dist/components/vertex-tab.js +46 -0
- package/dist/components/vertex-tabs.d.ts +11 -0
- package/dist/components/vertex-tabs.js +133 -0
- package/dist/components/vertex-textfield.d.ts +11 -0
- package/dist/components/vertex-textfield.js +6 -0
- package/dist/components/vertex-toast.d.ts +11 -0
- package/dist/components/vertex-toast.js +127 -0
- package/dist/components/vertex-toggle.d.ts +11 -0
- package/dist/components/vertex-toggle.js +67 -0
- package/dist/components/vertex-tooltip.d.ts +11 -0
- package/dist/components/vertex-tooltip.js +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host, readTask } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as classnames } from './index2.js';
|
|
3
|
+
|
|
4
|
+
const resizableCss = ":host{--hover-shadow-color:var(--vertex-ui-blue-500);--vertical-handle-size:1rem;--vertical-handle-offset:-0.9rem;--horizontal-handle-size:1rem;--horizontal-handle-offset:-0.9rem;--side-direction-handle-z-index:var(--vertex-ui-popover-layer);--corner-handle-z-index:var(--vertex-ui-context-menu-layer)}:host(:not([dimensions-computed=\"\"])){position:absolute;display:none}.container{position:relative;height:100%;width:100%}.container.hidden{position:absolute;visibility:hidden}.shadow{pointer-events:none;position:absolute;width:100%;height:100%;z-index:var(--vertex-ui-popover-layer)}.shadow.hovered-location-left{box-shadow:inset 1px 0 0 var(--hover-shadow-color)}.shadow.hovered-location-right{box-shadow:inset -1px 0 0 var(--hover-shadow-color)}.shadow.hovered-location-top{box-shadow:inset 0 1px 0 var(--hover-shadow-color)}.shadow.hovered-location-bottom{box-shadow:inset 0 -1px 0 var(--hover-shadow-color)}.shadow.hovered-location-bottom-left{box-shadow:inset 1px -1px 0 var(--hover-shadow-color)}.shadow.hovered-location-bottom-right{box-shadow:inset -1px -1px 0 var(--hover-shadow-color)}.shadow.hovered-location-top-left{box-shadow:inset 1px 1px 0 var(--hover-shadow-color)}.shadow.hovered-location-top-right{box-shadow:inset -1px 1px 0 var(--hover-shadow-color)}.handle{position:absolute;visibility:hidden;z-index:var(--side-direction-handle-z-index)}.corner-handle{z-index:var(--corner-handle-z-index)}.left-handle.horizontal-direction-left,.left-handle.horizontal-direction-both{visibility:visible;left:var(--horizontal-handle-offset);top:0;height:100%;width:var(--horizontal-handle-size);cursor:col-resize}.right-handle.horizontal-direction-right,.right-handle.horizontal-direction-both{visibility:visible;right:var(--horizontal-handle-offset);top:0;height:100%;width:var(--horizontal-handle-size);cursor:col-resize}.bottom-handle.vertical-direction-bottom,.bottom-handle.vertical-direction-both{visibility:visible;left:0;bottom:var(--vertical-handle-offset);height:var(--vertical-handle-size);width:100%;cursor:row-resize}.top-handle.vertical-direction-top,.top-handle.vertical-direction-both{visibility:visible;left:0;top:var(--vertical-handle-offset);height:var(--vertical-handle-size);width:100%;cursor:row-resize}.bottom-right-handle.vertical-direction-bottom.horizontal-direction-right,.bottom-right-handle.vertical-direction-both.horizontal-direction-right,.bottom-right-handle.vertical-direction-bottom.horizontal-direction-both,.bottom-right-handle.vertical-direction-both.horizontal-direction-both{visibility:visible;right:var(--horizontal-handle-offset);bottom:var(--vertical-handle-offset);height:var(--vertical-handle-size);width:var(--horizontal-handle-size);cursor:nwse-resize}.bottom-left-handle.vertical-direction-bottom.horizontal-direction-left,.bottom-left-handle.vertical-direction-both.horizontal-direction-left,.bottom-left-handle.vertical-direction-bottom.horizontal-direction-both,.bottom-left-handle.vertical-direction-both.horizontal-direction-both{visibility:visible;left:var(--horizontal-handle-offset);bottom:var(--vertical-handle-offset);height:var(--vertical-handle-size);width:var(--horizontal-handle-size);cursor:nesw-resize}.top-right-handle.vertical-direction-top.horizontal-direction-right,.top-right-handle.vertical-direction-both.horizontal-direction-right,.top-right-handle.vertical-direction-top.horizontal-direction-both,.top-right-handle.vertical-direction-both.horizontal-direction-both{visibility:visible;right:var(--horizontal-handle-offset);top:var(--vertical-handle-offset);height:var(--vertical-handle-size);width:var(--horizontal-handle-size);cursor:nesw-resize}.top-left-handle.vertical-direction-top.horizontal-direction-left,.top-left-handle.vertical-direction-both.horizontal-direction-left,.top-left-handle.vertical-direction-top.horizontal-direction-both,.top-left-handle.vertical-direction-both.horizontal-direction-both{visibility:visible;left:var(--horizontal-handle-offset);top:var(--vertical-handle-offset);height:var(--vertical-handle-size);width:var(--horizontal-handle-size);cursor:nwse-resize}";
|
|
5
|
+
|
|
6
|
+
const WINDOW_RESIZE_DEBOUNCE_THRESHOLD = 200;
|
|
7
|
+
const Resizable = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.resizeStart = createEvent(this, "resizeStart", 7);
|
|
13
|
+
this.resizeEnd = createEvent(this, "resizeEnd", 7);
|
|
14
|
+
this.containerTop = 0;
|
|
15
|
+
this.containerLeft = 0;
|
|
16
|
+
this.horizontalDirection = 'both';
|
|
17
|
+
this.verticalDirection = 'both';
|
|
18
|
+
this.initialHorizontalScale = undefined;
|
|
19
|
+
this.initialVerticalScale = undefined;
|
|
20
|
+
this.initializeWithOffset = false;
|
|
21
|
+
this.parentSelector = undefined;
|
|
22
|
+
this.verticalSiblingSelector = undefined;
|
|
23
|
+
this.horizontalSiblingSelector = undefined;
|
|
24
|
+
this.contentSelector = undefined;
|
|
25
|
+
this.position = 'relative';
|
|
26
|
+
this.dimensionsComputed = false;
|
|
27
|
+
this.width = -1;
|
|
28
|
+
this.minWidth = undefined;
|
|
29
|
+
this.maxWidth = undefined;
|
|
30
|
+
this.height = -1;
|
|
31
|
+
this.minHeight = undefined;
|
|
32
|
+
this.maxHeight = undefined;
|
|
33
|
+
this.left = 0;
|
|
34
|
+
this.top = 0;
|
|
35
|
+
this.hoveredLocation = undefined;
|
|
36
|
+
this.dragStartLocation = undefined;
|
|
37
|
+
this.handleDrag = this.handleDrag.bind(this);
|
|
38
|
+
this.handleDragBottom = this.handleDragBottom.bind(this);
|
|
39
|
+
this.handleDragTop = this.handleDragTop.bind(this);
|
|
40
|
+
this.handleDragLeft = this.handleDragLeft.bind(this);
|
|
41
|
+
this.handleDragRight = this.handleDragRight.bind(this);
|
|
42
|
+
this.handleWindowPointerUp = this.handleWindowPointerUp.bind(this);
|
|
43
|
+
this.recomputeDimensions = this.recomputeDimensions.bind(this);
|
|
44
|
+
this.mutationObserver = new MutationObserver(this.recomputeDimensions);
|
|
45
|
+
this.resizeObserver = new ResizeObserver(this.recomputeDimensions);
|
|
46
|
+
}
|
|
47
|
+
componentDidLoad() {
|
|
48
|
+
this.computeDimensions();
|
|
49
|
+
window.addEventListener('resize', this.recomputeDimensions);
|
|
50
|
+
this.mutationObserver.observe(this.hostElement, {
|
|
51
|
+
attributes: true,
|
|
52
|
+
attributeFilter: ['class'],
|
|
53
|
+
});
|
|
54
|
+
if (this.parentSelector != null) {
|
|
55
|
+
const parent = document.querySelector(this.parentSelector);
|
|
56
|
+
if (parent != null) {
|
|
57
|
+
this.resizeObserver.observe(parent);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
this.resizeObserver.observe(this.hostElement);
|
|
61
|
+
}
|
|
62
|
+
disconnectedCallback() {
|
|
63
|
+
this.dimensionsComputed = false;
|
|
64
|
+
window.removeEventListener('resize', this.recomputeDimensions);
|
|
65
|
+
this.mutationObserver.disconnect();
|
|
66
|
+
this.resizeObserver.disconnect();
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
const width = this.width < 0 || this.horizontalDirection === 'none'
|
|
70
|
+
? '100%'
|
|
71
|
+
: `${this.width}px`;
|
|
72
|
+
const height = this.height < 0 || this.verticalDirection === 'none'
|
|
73
|
+
? '100%'
|
|
74
|
+
: `${this.height}px`;
|
|
75
|
+
return (h(Host, { style: {
|
|
76
|
+
width,
|
|
77
|
+
height,
|
|
78
|
+
left: this.position === 'relative' ? `${this.left}px` : undefined,
|
|
79
|
+
top: this.position === 'relative' ? `${this.top}px` : undefined,
|
|
80
|
+
} }, h("div", { class: classnames('container', {
|
|
81
|
+
hidden: this.width <= 0 && this.height <= 0,
|
|
82
|
+
}) }, h("div", { class: classnames('shadow', `hovered-location-${this.dragStartLocation || this.hoveredLocation}`) }), h("div", { class: classnames('handle', 'left-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'left'), onPointerEnter: () => this.handlePointerEnter('left'), onPointerLeave: () => this.handlePointerLeave('left') }), h("div", { class: classnames('handle', 'right-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'right'), onPointerEnter: () => this.handlePointerEnter('right'), onPointerLeave: () => this.handlePointerLeave('right') }), h("div", { class: classnames('handle', 'top-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'top'), onPointerEnter: () => this.handlePointerEnter('top'), onPointerLeave: () => this.handlePointerLeave('top') }), h("div", { class: classnames('handle', 'bottom-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'bottom'), onPointerEnter: () => this.handlePointerEnter('bottom'), onPointerLeave: () => this.handlePointerLeave('bottom') }), h("div", { class: classnames('handle', 'bottom-right-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'bottom-right'), onPointerEnter: () => this.handlePointerEnter('bottom-right'), onPointerLeave: () => this.handlePointerLeave('bottom-right') }), h("div", { class: classnames('handle', 'bottom-left-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'bottom-left'), onPointerEnter: () => this.handlePointerEnter('bottom-left'), onPointerLeave: () => this.handlePointerLeave('bottom-left') }), h("div", { class: classnames('handle', 'top-right-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'top-right'), onPointerEnter: () => this.handlePointerEnter('top-right'), onPointerLeave: () => this.handlePointerLeave('top-right') }), h("div", { class: classnames('handle', 'top-left-handle', `horizontal-direction-${this.horizontalDirection}`, `vertical-direction-${this.verticalDirection}`), onPointerDown: (e) => this.handlePointerDown(e, 'top-left'), onPointerEnter: () => this.handlePointerEnter('top-left'), onPointerLeave: () => this.handlePointerLeave('top-left') }), h("slot", null))));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @private
|
|
86
|
+
*
|
|
87
|
+
* Used for internals or testing.
|
|
88
|
+
*/
|
|
89
|
+
async updateDimensions(bounds, isRecompute = false) {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
const { host, slotted, parent, minWidth, maxWidth, minHeight, maxHeight } = bounds;
|
|
92
|
+
// Calculate the horizontal bounds of the component, where baseMaxWidth is the
|
|
93
|
+
// maximum width of the container and this.maxWidth is the maximum width of the
|
|
94
|
+
// component when taking siblings into account
|
|
95
|
+
const baseMaxWidth = this.fromComputedStyle(maxWidth, (parent === null || parent === void 0 ? void 0 : parent.width) || host.width || slotted.width);
|
|
96
|
+
this.maxWidth =
|
|
97
|
+
baseMaxWidth != null
|
|
98
|
+
? baseMaxWidth -
|
|
99
|
+
this.getSiblingMinWidth((parent === null || parent === void 0 ? void 0 : parent.width) || host.width || slotted.width)
|
|
100
|
+
: undefined;
|
|
101
|
+
this.minWidth = this.fromComputedStyle(minWidth, (parent === null || parent === void 0 ? void 0 : parent.width) || host.width || slotted.width);
|
|
102
|
+
// Calculate the vertical bounds of the component, where baseMaxHeight is the
|
|
103
|
+
// maximum height of the container and this.maxHeight is the maximum height of
|
|
104
|
+
// the component when taking siblings into account
|
|
105
|
+
const baseMaxHeight = this.fromComputedStyle(maxHeight, (parent === null || parent === void 0 ? void 0 : parent.height) || host.height || slotted.height);
|
|
106
|
+
this.maxHeight =
|
|
107
|
+
baseMaxHeight != null
|
|
108
|
+
? baseMaxHeight -
|
|
109
|
+
this.getSiblingMinHeight((parent === null || parent === void 0 ? void 0 : parent.height) || host.height || slotted.height)
|
|
110
|
+
: undefined;
|
|
111
|
+
this.minHeight = this.fromComputedStyle(minHeight, (parent === null || parent === void 0 ? void 0 : parent.height) || host.height || slotted.height);
|
|
112
|
+
// Initialize the component's height and width if it was previously hidden
|
|
113
|
+
if (!isRecompute || this.height <= 0) {
|
|
114
|
+
const initialWidth = this.maxWidth != null && this.initialHorizontalScale != null
|
|
115
|
+
? this.maxWidth * this.initialHorizontalScale
|
|
116
|
+
: this.minWidth;
|
|
117
|
+
const initialHeight = this.maxHeight != null && this.initialVerticalScale != null
|
|
118
|
+
? this.maxHeight * this.initialVerticalScale
|
|
119
|
+
: this.minHeight;
|
|
120
|
+
this.width = initialWidth || slotted.width || this.width;
|
|
121
|
+
this.height = initialHeight || slotted.height || this.height;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.height = this.toBoundedValue(this.height, this.minHeight || 0, this.maxHeight);
|
|
125
|
+
this.width = this.toBoundedValue(this.width, this.minWidth || 0, this.maxWidth);
|
|
126
|
+
}
|
|
127
|
+
this.containerTop = (_a = parent === null || parent === void 0 ? void 0 : parent.top) !== null && _a !== void 0 ? _a : host.top;
|
|
128
|
+
this.containerLeft = (_b = parent === null || parent === void 0 ? void 0 : parent.left) !== null && _b !== void 0 ? _b : host.left;
|
|
129
|
+
// this.left and this.top are only used internally, and in the case of absolute positioning, we only update
|
|
130
|
+
// the width/height, so we want to reset left & top to 0 to take into consideration the difference between
|
|
131
|
+
// it's parent container to the left/top position.
|
|
132
|
+
this.top =
|
|
133
|
+
baseMaxHeight != null &&
|
|
134
|
+
this.initializeWithOffset &&
|
|
135
|
+
this.position !== 'absolute'
|
|
136
|
+
? baseMaxHeight - this.height
|
|
137
|
+
: 0;
|
|
138
|
+
this.left =
|
|
139
|
+
baseMaxWidth != null &&
|
|
140
|
+
this.initializeWithOffset &&
|
|
141
|
+
this.position !== 'absolute'
|
|
142
|
+
? baseMaxWidth - this.width
|
|
143
|
+
: 0;
|
|
144
|
+
}
|
|
145
|
+
computeDimensions() {
|
|
146
|
+
readTask(() => {
|
|
147
|
+
var _a;
|
|
148
|
+
const slotted = this.getSlottedElement();
|
|
149
|
+
if (typeof window !== 'undefined' && slotted != null) {
|
|
150
|
+
const computedStyles = window.getComputedStyle(this.hostElement);
|
|
151
|
+
this.updateDimensions({
|
|
152
|
+
host: this.hostElement.getBoundingClientRect(),
|
|
153
|
+
slotted: slotted.getBoundingClientRect(),
|
|
154
|
+
parent: this.parentSelector != null
|
|
155
|
+
? (_a = document
|
|
156
|
+
.querySelector(this.parentSelector)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()
|
|
157
|
+
: undefined,
|
|
158
|
+
minWidth: computedStyles.minWidth,
|
|
159
|
+
maxWidth: computedStyles.maxWidth,
|
|
160
|
+
minHeight: computedStyles.minHeight,
|
|
161
|
+
maxHeight: computedStyles.maxHeight,
|
|
162
|
+
});
|
|
163
|
+
this.dimensionsComputed = true;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
recomputeDimensions() {
|
|
168
|
+
if (this.resizeTimeout != null) {
|
|
169
|
+
clearTimeout(this.resizeTimeout);
|
|
170
|
+
this.resizeTimeout = undefined;
|
|
171
|
+
}
|
|
172
|
+
this.resizeTimeout = setTimeout(() => {
|
|
173
|
+
this.resizeTimeout = undefined;
|
|
174
|
+
readTask(() => {
|
|
175
|
+
var _a;
|
|
176
|
+
const slotted = this.getSlottedElement();
|
|
177
|
+
if (typeof window !== 'undefined' && slotted != null) {
|
|
178
|
+
const computedStyles = window.getComputedStyle(this.hostElement);
|
|
179
|
+
this.updateDimensions({
|
|
180
|
+
host: this.hostElement.getBoundingClientRect(),
|
|
181
|
+
slotted: slotted.getBoundingClientRect(),
|
|
182
|
+
parent: this.parentSelector != null
|
|
183
|
+
? (_a = document
|
|
184
|
+
.querySelector(this.parentSelector)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()
|
|
185
|
+
: undefined,
|
|
186
|
+
minWidth: computedStyles.minWidth,
|
|
187
|
+
maxWidth: computedStyles.maxWidth,
|
|
188
|
+
minHeight: computedStyles.minHeight,
|
|
189
|
+
maxHeight: computedStyles.maxHeight,
|
|
190
|
+
}, true);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}, WINDOW_RESIZE_DEBOUNCE_THRESHOLD);
|
|
194
|
+
}
|
|
195
|
+
handlePointerEnter(location) {
|
|
196
|
+
this.hoveredLocation = location;
|
|
197
|
+
}
|
|
198
|
+
handlePointerLeave(location) {
|
|
199
|
+
if (location === this.hoveredLocation) {
|
|
200
|
+
this.hoveredLocation = undefined;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
handlePointerDown(e, location) {
|
|
204
|
+
this.setStartPosition(e, location);
|
|
205
|
+
this.emitResizeStart(location);
|
|
206
|
+
window.addEventListener('pointermove', this.handleDrag);
|
|
207
|
+
window.addEventListener('pointerup', this.handleWindowPointerUp);
|
|
208
|
+
}
|
|
209
|
+
handleDrag(e) {
|
|
210
|
+
if (this.lastPointerPosition != null) {
|
|
211
|
+
const difference = {
|
|
212
|
+
x: this.lastPointerPosition.x - e.clientX,
|
|
213
|
+
y: this.lastPointerPosition.y - e.clientY,
|
|
214
|
+
};
|
|
215
|
+
this.lastPointerPosition = { x: e.clientX, y: e.clientY };
|
|
216
|
+
switch (this.dragStartLocation) {
|
|
217
|
+
case 'bottom':
|
|
218
|
+
this.ifValidDragBottom(e, difference, this.handleDragBottom);
|
|
219
|
+
break;
|
|
220
|
+
case 'top':
|
|
221
|
+
this.ifValidDragTop(e, difference, this.handleDragTop);
|
|
222
|
+
break;
|
|
223
|
+
case 'right':
|
|
224
|
+
this.ifValidDragRight(e, difference, this.handleDragRight);
|
|
225
|
+
break;
|
|
226
|
+
case 'left':
|
|
227
|
+
this.ifValidDragLeft(e, difference, this.handleDragLeft);
|
|
228
|
+
break;
|
|
229
|
+
case 'bottom-right':
|
|
230
|
+
this.ifValidDragBottom(e, difference, this.handleDragBottom);
|
|
231
|
+
this.ifValidDragRight(e, difference, this.handleDragRight);
|
|
232
|
+
break;
|
|
233
|
+
case 'bottom-left':
|
|
234
|
+
this.ifValidDragBottom(e, difference, this.handleDragBottom);
|
|
235
|
+
this.ifValidDragLeft(e, difference, this.handleDragLeft);
|
|
236
|
+
break;
|
|
237
|
+
case 'top-right':
|
|
238
|
+
this.ifValidDragTop(e, difference, this.handleDragTop);
|
|
239
|
+
this.ifValidDragRight(e, difference, this.handleDragRight);
|
|
240
|
+
break;
|
|
241
|
+
case 'top-left':
|
|
242
|
+
this.ifValidDragTop(e, difference, this.handleDragTop);
|
|
243
|
+
this.ifValidDragLeft(e, difference, this.handleDragLeft);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
handleWindowPointerUp() {
|
|
249
|
+
if (this.dragStartLocation != null) {
|
|
250
|
+
this.emitResizeEnd(this.dragStartLocation);
|
|
251
|
+
}
|
|
252
|
+
this.lastPointerPosition = undefined;
|
|
253
|
+
this.dragStartLocation = undefined;
|
|
254
|
+
window.removeEventListener('pointermove', this.handleDrag);
|
|
255
|
+
window.removeEventListener('pointerup', this.handleWindowPointerUp);
|
|
256
|
+
}
|
|
257
|
+
ifValidDragTop(e, difference, fn) {
|
|
258
|
+
const isReducingSize = difference.y < 0;
|
|
259
|
+
const isValid = isReducingSize
|
|
260
|
+
? e.clientY - this.containerTop > this.top
|
|
261
|
+
: e.clientY - this.containerTop <= this.top;
|
|
262
|
+
if (isValid) {
|
|
263
|
+
fn(difference);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
ifValidDragBottom(e, difference, fn) {
|
|
267
|
+
const isReducingSize = difference.y > 0;
|
|
268
|
+
const isValid = isReducingSize
|
|
269
|
+
? e.clientY < this.top + this.containerTop + this.height
|
|
270
|
+
: e.clientY >= this.top + this.containerTop + this.height;
|
|
271
|
+
if (isValid) {
|
|
272
|
+
fn(difference);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
ifValidDragLeft(e, difference, fn) {
|
|
276
|
+
const isReducingSize = difference.x < 0;
|
|
277
|
+
const isValid = isReducingSize
|
|
278
|
+
? e.clientX - this.containerLeft > this.left
|
|
279
|
+
: e.clientX - this.containerLeft <= this.left;
|
|
280
|
+
if (isValid) {
|
|
281
|
+
fn(difference);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
ifValidDragRight(e, difference, fn) {
|
|
285
|
+
const isReducingSize = difference.x > 0;
|
|
286
|
+
const isValid = isReducingSize
|
|
287
|
+
? e.clientX < this.left + this.containerLeft + this.width
|
|
288
|
+
: e.clientX >= this.left + this.containerLeft + this.width;
|
|
289
|
+
if (isValid) {
|
|
290
|
+
fn(difference);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
handleDragTop(difference) {
|
|
294
|
+
const initialHeight = this.height;
|
|
295
|
+
this.height = this.toBoundedValue(this.height + difference.y, this.minHeight || 0, this.maxHeight);
|
|
296
|
+
const heightDifference = this.height - initialHeight;
|
|
297
|
+
this.top -= heightDifference;
|
|
298
|
+
}
|
|
299
|
+
handleDragBottom(difference) {
|
|
300
|
+
this.height = this.toBoundedValue(this.height - difference.y, this.minHeight || 0, this.maxHeight);
|
|
301
|
+
}
|
|
302
|
+
handleDragLeft(difference) {
|
|
303
|
+
const initialWidth = this.width;
|
|
304
|
+
this.width = this.toBoundedValue(this.width + difference.x, this.minWidth || 0, this.maxWidth);
|
|
305
|
+
const widthDifference = this.width - initialWidth;
|
|
306
|
+
this.left -= widthDifference;
|
|
307
|
+
}
|
|
308
|
+
handleDragRight(difference) {
|
|
309
|
+
this.width = this.toBoundedValue(this.width - difference.x, this.minWidth || 0, this.maxWidth);
|
|
310
|
+
}
|
|
311
|
+
setStartPosition(e, location) {
|
|
312
|
+
e.stopPropagation();
|
|
313
|
+
e.preventDefault();
|
|
314
|
+
this.lastPointerPosition = { x: e.clientX, y: e.clientY };
|
|
315
|
+
this.dragStartLocation = location;
|
|
316
|
+
}
|
|
317
|
+
getSlottedElement() {
|
|
318
|
+
var _a, _b, _c;
|
|
319
|
+
if (this.contentSelector != null) {
|
|
320
|
+
return (((_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(this.contentSelector)) ||
|
|
321
|
+
this.hostElement.querySelector(this.contentSelector) ||
|
|
322
|
+
undefined);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
const contentSlot = ((_b = this.hostElement.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('slot')) || undefined;
|
|
326
|
+
if (((_c = contentSlot === null || contentSlot === void 0 ? void 0 : contentSlot.assignedElements) === null || _c === void 0 ? void 0 : _c.call(contentSlot).length) || 0 > 0) {
|
|
327
|
+
return contentSlot === null || contentSlot === void 0 ? void 0 : contentSlot.assignedElements()[0];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
getMinBounds() {
|
|
332
|
+
const boundedMinHeight = this.minHeight != null ? this.height - this.minHeight : this.height;
|
|
333
|
+
const boundedMinWidth = this.minWidth != null ? this.width - this.minWidth : this.width;
|
|
334
|
+
return {
|
|
335
|
+
x: boundedMinWidth,
|
|
336
|
+
y: boundedMinHeight,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
fromComputedStyle(value, base) {
|
|
340
|
+
const parsed = parseFloat(value);
|
|
341
|
+
if (isNaN(parsed) || parsed <= 0) {
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
else if (value.includes('%')) {
|
|
345
|
+
return (parsed / 100) * base;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
return parsed;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
toBoundedValue(value, min, max) {
|
|
352
|
+
return Math.max(Math.min(value, max !== null && max !== void 0 ? max : value), min);
|
|
353
|
+
}
|
|
354
|
+
getSiblingMinWidth(base) {
|
|
355
|
+
var _a;
|
|
356
|
+
const sibling = this.horizontalSiblingSelector != null
|
|
357
|
+
? document.querySelector(this.horizontalSiblingSelector)
|
|
358
|
+
: undefined;
|
|
359
|
+
if (typeof window !== 'undefined' && sibling) {
|
|
360
|
+
const siblingComputedStyles = window.getComputedStyle(sibling);
|
|
361
|
+
return (_a = this.fromComputedStyle(siblingComputedStyles.minWidth, base)) !== null && _a !== void 0 ? _a : 0;
|
|
362
|
+
}
|
|
363
|
+
return 0;
|
|
364
|
+
}
|
|
365
|
+
getSiblingMinHeight(base) {
|
|
366
|
+
var _a;
|
|
367
|
+
const sibling = this.verticalSiblingSelector != null
|
|
368
|
+
? document.querySelector(this.verticalSiblingSelector)
|
|
369
|
+
: undefined;
|
|
370
|
+
if (typeof window !== 'undefined' && sibling) {
|
|
371
|
+
const siblingComputedStyles = window.getComputedStyle(sibling);
|
|
372
|
+
return (_a = this.fromComputedStyle(siblingComputedStyles.minHeight, base)) !== null && _a !== void 0 ? _a : 0;
|
|
373
|
+
}
|
|
374
|
+
return 0;
|
|
375
|
+
}
|
|
376
|
+
emitResizeStart(location) {
|
|
377
|
+
readTask(() => {
|
|
378
|
+
this.resizeStart.emit(this.computeResizeEventDetails(location));
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
emitResizeEnd(location) {
|
|
382
|
+
readTask(() => {
|
|
383
|
+
this.resizeEnd.emit(this.computeResizeEventDetails(location));
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
computeResizeEventDetails(location) {
|
|
387
|
+
var _a, _b, _c, _d, _e;
|
|
388
|
+
const parentBounds = this.parentSelector != null
|
|
389
|
+
? (_a = document.querySelector(this.parentSelector)) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()
|
|
390
|
+
: undefined;
|
|
391
|
+
return {
|
|
392
|
+
location,
|
|
393
|
+
width: this.width,
|
|
394
|
+
height: this.height,
|
|
395
|
+
widthPercentage: this.width /
|
|
396
|
+
((_c = (_b = this.maxWidth) !== null && _b !== void 0 ? _b : parentBounds === null || parentBounds === void 0 ? void 0 : parentBounds.width) !== null && _c !== void 0 ? _c : window.innerWidth),
|
|
397
|
+
heightPercentage: this.height /
|
|
398
|
+
((_e = (_d = this.maxHeight) !== null && _d !== void 0 ? _d : parentBounds === null || parentBounds === void 0 ? void 0 : parentBounds.height) !== null && _e !== void 0 ? _e : window.innerHeight),
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
get hostElement() { return this; }
|
|
402
|
+
static get style() { return resizableCss; }
|
|
403
|
+
}, [1, "vertex-resizable", {
|
|
404
|
+
"horizontalDirection": [1, "horizontal-direction"],
|
|
405
|
+
"verticalDirection": [1, "vertical-direction"],
|
|
406
|
+
"initialHorizontalScale": [2, "initial-horizontal-scale"],
|
|
407
|
+
"initialVerticalScale": [2, "initial-vertical-scale"],
|
|
408
|
+
"initializeWithOffset": [4, "initialize-with-offset"],
|
|
409
|
+
"parentSelector": [1, "parent-selector"],
|
|
410
|
+
"verticalSiblingSelector": [1, "vertical-sibling-selector"],
|
|
411
|
+
"horizontalSiblingSelector": [1, "horizontal-sibling-selector"],
|
|
412
|
+
"contentSelector": [1, "content-selector"],
|
|
413
|
+
"position": [1],
|
|
414
|
+
"dimensionsComputed": [1540, "dimensions-computed"],
|
|
415
|
+
"width": [32],
|
|
416
|
+
"minWidth": [32],
|
|
417
|
+
"maxWidth": [32],
|
|
418
|
+
"height": [32],
|
|
419
|
+
"minHeight": [32],
|
|
420
|
+
"maxHeight": [32],
|
|
421
|
+
"left": [32],
|
|
422
|
+
"top": [32],
|
|
423
|
+
"hoveredLocation": [32],
|
|
424
|
+
"dragStartLocation": [32],
|
|
425
|
+
"updateDimensions": [64]
|
|
426
|
+
}]);
|
|
427
|
+
function defineCustomElement$1() {
|
|
428
|
+
if (typeof customElements === "undefined") {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const components = ["vertex-resizable"];
|
|
432
|
+
components.forEach(tagName => { switch (tagName) {
|
|
433
|
+
case "vertex-resizable":
|
|
434
|
+
if (!customElements.get(tagName)) {
|
|
435
|
+
customElements.define(tagName, Resizable);
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
} });
|
|
439
|
+
}
|
|
440
|
+
defineCustomElement$1();
|
|
441
|
+
|
|
442
|
+
const VertexResizable = Resizable;
|
|
443
|
+
const defineCustomElement = defineCustomElement$1;
|
|
444
|
+
|
|
445
|
+
export { Resizable as R, VertexResizable, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexResultList extends Components.VertexResultList, HTMLElement {}
|
|
4
|
+
export const VertexResultList: {
|
|
5
|
+
prototype: VertexResultList;
|
|
6
|
+
new (): VertexResultList;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface VertexSearchBar extends Components.VertexSearchBar, HTMLElement {}
|
|
4
|
+
export const VertexSearchBar: {
|
|
5
|
+
prototype: VertexSearchBar;
|
|
6
|
+
new (): VertexSearchBar;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|