@operato/utils 8.1.0 → 9.0.0-beta.10

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.
@@ -0,0 +1,393 @@
1
+ interface CustomElement extends HTMLElement {
2
+ connectedCallback?(): void;
3
+ disconnectedCallback?(): void;
4
+ }
5
+ type Constructor<T = CustomElement> = new (...args: any[]) => T;
6
+ export type GestureEventPinch = CustomEvent<{
7
+ scale: number;
8
+ centerX: number;
9
+ centerY: number;
10
+ }>;
11
+ export type GestureEventDrag = CustomEvent<{
12
+ deltaX: number;
13
+ deltaY: number;
14
+ clientX: number;
15
+ clientY: number;
16
+ end: boolean;
17
+ }>;
18
+ export type GestureEventDoubleTap = CustomEvent<{
19
+ x: number;
20
+ y: number;
21
+ }>;
22
+ export declare function gesture<TBase extends Constructor>(Base: TBase): {
23
+ new (...args: any[]): {
24
+ __pointers: Map<number, {
25
+ x: number;
26
+ y: number;
27
+ }>;
28
+ __lastTapTime: number;
29
+ __lastPinchDistance: number;
30
+ __dragStart: {
31
+ x: number;
32
+ y: number;
33
+ } | null;
34
+ connectedCallback(): void;
35
+ disconnectedCallback(): void;
36
+ handlePointerDown: (e: PointerEvent) => void;
37
+ handlePointerMove: (e: PointerEvent) => void;
38
+ handlePointerUp: (e: PointerEvent) => void;
39
+ handlePinch(): void;
40
+ handleDrag(point: {
41
+ x: number;
42
+ y: number;
43
+ }, end: boolean): void;
44
+ handleTap(point: {
45
+ x: number;
46
+ y: number;
47
+ }): void;
48
+ getDistance(p1: {
49
+ x: number;
50
+ y: number;
51
+ }, p2: {
52
+ x: number;
53
+ y: number;
54
+ }): number;
55
+ addGlobalListeners(): void;
56
+ removeGlobalListeners(): void;
57
+ accessKey: string;
58
+ readonly accessKeyLabel: string;
59
+ autocapitalize: string;
60
+ dir: string;
61
+ draggable: boolean;
62
+ hidden: boolean;
63
+ inert: boolean;
64
+ innerText: string;
65
+ lang: string;
66
+ readonly offsetHeight: number;
67
+ readonly offsetLeft: number;
68
+ readonly offsetParent: Element | null;
69
+ readonly offsetTop: number;
70
+ readonly offsetWidth: number;
71
+ outerText: string;
72
+ popover: string | null;
73
+ spellcheck: boolean;
74
+ title: string;
75
+ translate: boolean;
76
+ writingSuggestions: string;
77
+ attachInternals(): ElementInternals;
78
+ click(): void;
79
+ hidePopover(): void;
80
+ showPopover(): void;
81
+ togglePopover(force?: boolean): boolean;
82
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
83
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
84
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
85
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
86
+ readonly attributes: NamedNodeMap;
87
+ readonly classList: DOMTokenList;
88
+ className: string;
89
+ readonly clientHeight: number;
90
+ readonly clientLeft: number;
91
+ readonly clientTop: number;
92
+ readonly clientWidth: number;
93
+ readonly currentCSSZoom: number;
94
+ id: string;
95
+ innerHTML: string;
96
+ readonly localName: string;
97
+ readonly namespaceURI: string | null;
98
+ onfullscreenchange: ((this: Element, ev: Event) => any) | null;
99
+ onfullscreenerror: ((this: Element, ev: Event) => any) | null;
100
+ outerHTML: string;
101
+ readonly ownerDocument: Document;
102
+ readonly part: DOMTokenList;
103
+ readonly prefix: string | null;
104
+ readonly scrollHeight: number;
105
+ scrollLeft: number;
106
+ scrollTop: number;
107
+ readonly scrollWidth: number;
108
+ readonly shadowRoot: ShadowRoot | null;
109
+ slot: string;
110
+ readonly tagName: string;
111
+ attachShadow(init: ShadowRootInit): ShadowRoot;
112
+ checkVisibility(options?: CheckVisibilityOptions): boolean;
113
+ closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
114
+ closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
115
+ closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
116
+ closest<E extends Element = Element>(selectors: string): E | null;
117
+ computedStyleMap(): StylePropertyMapReadOnly;
118
+ getAttribute(qualifiedName: string): string | null;
119
+ getAttributeNS(namespace: string | null, localName: string): string | null;
120
+ getAttributeNames(): string[];
121
+ getAttributeNode(qualifiedName: string): Attr | null;
122
+ getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
123
+ getBoundingClientRect(): DOMRect;
124
+ getClientRects(): DOMRectList;
125
+ getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
126
+ getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
127
+ getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
128
+ getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
129
+ getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
130
+ getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
131
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
132
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
133
+ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
134
+ getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
135
+ getHTML(options?: GetHTMLOptions): string;
136
+ hasAttribute(qualifiedName: string): boolean;
137
+ hasAttributeNS(namespace: string | null, localName: string): boolean;
138
+ hasAttributes(): boolean;
139
+ hasPointerCapture(pointerId: number): boolean;
140
+ insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
141
+ insertAdjacentHTML(position: InsertPosition, string: string): void;
142
+ insertAdjacentText(where: InsertPosition, data: string): void;
143
+ matches(selectors: string): boolean;
144
+ releasePointerCapture(pointerId: number): void;
145
+ removeAttribute(qualifiedName: string): void;
146
+ removeAttributeNS(namespace: string | null, localName: string): void;
147
+ removeAttributeNode(attr: Attr): Attr;
148
+ requestFullscreen(options?: FullscreenOptions): Promise<void>;
149
+ requestPointerLock(options?: PointerLockOptions): Promise<void>;
150
+ scroll(options?: ScrollToOptions): void;
151
+ scroll(x: number, y: number): void;
152
+ scrollBy(options?: ScrollToOptions): void;
153
+ scrollBy(x: number, y: number): void;
154
+ scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
155
+ scrollTo(options?: ScrollToOptions): void;
156
+ scrollTo(x: number, y: number): void;
157
+ setAttribute(qualifiedName: string, value: string): void;
158
+ setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
159
+ setAttributeNode(attr: Attr): Attr | null;
160
+ setAttributeNodeNS(attr: Attr): Attr | null;
161
+ setHTMLUnsafe(html: string): void;
162
+ setPointerCapture(pointerId: number): void;
163
+ toggleAttribute(qualifiedName: string, force?: boolean): boolean;
164
+ webkitMatchesSelector(selectors: string): boolean;
165
+ readonly baseURI: string;
166
+ readonly childNodes: NodeListOf<ChildNode>;
167
+ readonly firstChild: ChildNode | null;
168
+ readonly isConnected: boolean;
169
+ readonly lastChild: ChildNode | null;
170
+ readonly nextSibling: ChildNode | null;
171
+ readonly nodeName: string;
172
+ readonly nodeType: number;
173
+ nodeValue: string | null;
174
+ readonly parentElement: HTMLElement | null;
175
+ readonly parentNode: ParentNode | null;
176
+ readonly previousSibling: ChildNode | null;
177
+ textContent: string | null;
178
+ appendChild<T extends Node>(node: T): T;
179
+ cloneNode(deep?: boolean): Node;
180
+ compareDocumentPosition(other: Node): number;
181
+ contains(other: Node | null): boolean;
182
+ getRootNode(options?: GetRootNodeOptions): Node;
183
+ hasChildNodes(): boolean;
184
+ insertBefore<T extends Node>(node: T, child: Node | null): T;
185
+ isDefaultNamespace(namespace: string | null): boolean;
186
+ isEqualNode(otherNode: Node | null): boolean;
187
+ isSameNode(otherNode: Node | null): boolean;
188
+ lookupNamespaceURI(prefix: string | null): string | null;
189
+ lookupPrefix(namespace: string | null): string | null;
190
+ normalize(): void;
191
+ removeChild<T extends Node>(child: T): T;
192
+ replaceChild<T extends Node>(node: Node, child: T): T;
193
+ readonly ELEMENT_NODE: 1;
194
+ readonly ATTRIBUTE_NODE: 2;
195
+ readonly TEXT_NODE: 3;
196
+ readonly CDATA_SECTION_NODE: 4;
197
+ readonly ENTITY_REFERENCE_NODE: 5;
198
+ readonly ENTITY_NODE: 6;
199
+ readonly PROCESSING_INSTRUCTION_NODE: 7;
200
+ readonly COMMENT_NODE: 8;
201
+ readonly DOCUMENT_NODE: 9;
202
+ readonly DOCUMENT_TYPE_NODE: 10;
203
+ readonly DOCUMENT_FRAGMENT_NODE: 11;
204
+ readonly NOTATION_NODE: 12;
205
+ readonly DOCUMENT_POSITION_DISCONNECTED: 1;
206
+ readonly DOCUMENT_POSITION_PRECEDING: 2;
207
+ readonly DOCUMENT_POSITION_FOLLOWING: 4;
208
+ readonly DOCUMENT_POSITION_CONTAINS: 8;
209
+ readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
210
+ readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
211
+ dispatchEvent(event: Event): boolean;
212
+ ariaAtomic: string | null;
213
+ ariaAutoComplete: string | null;
214
+ ariaBrailleLabel: string | null;
215
+ ariaBrailleRoleDescription: string | null;
216
+ ariaBusy: string | null;
217
+ ariaChecked: string | null;
218
+ ariaColCount: string | null;
219
+ ariaColIndex: string | null;
220
+ ariaColIndexText: string | null;
221
+ ariaColSpan: string | null;
222
+ ariaCurrent: string | null;
223
+ ariaDescription: string | null;
224
+ ariaDisabled: string | null;
225
+ ariaExpanded: string | null;
226
+ ariaHasPopup: string | null;
227
+ ariaHidden: string | null;
228
+ ariaInvalid: string | null;
229
+ ariaKeyShortcuts: string | null;
230
+ ariaLabel: string | null;
231
+ ariaLevel: string | null;
232
+ ariaLive: string | null;
233
+ ariaModal: string | null;
234
+ ariaMultiLine: string | null;
235
+ ariaMultiSelectable: string | null;
236
+ ariaOrientation: string | null;
237
+ ariaPlaceholder: string | null;
238
+ ariaPosInSet: string | null;
239
+ ariaPressed: string | null;
240
+ ariaReadOnly: string | null;
241
+ ariaRequired: string | null;
242
+ ariaRoleDescription: string | null;
243
+ ariaRowCount: string | null;
244
+ ariaRowIndex: string | null;
245
+ ariaRowIndexText: string | null;
246
+ ariaRowSpan: string | null;
247
+ ariaSelected: string | null;
248
+ ariaSetSize: string | null;
249
+ ariaSort: string | null;
250
+ ariaValueMax: string | null;
251
+ ariaValueMin: string | null;
252
+ ariaValueNow: string | null;
253
+ ariaValueText: string | null;
254
+ role: string | null;
255
+ animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
256
+ getAnimations(options?: GetAnimationsOptions): Animation[];
257
+ after(...nodes: (Node | string)[]): void;
258
+ before(...nodes: (Node | string)[]): void;
259
+ remove(): void;
260
+ replaceWith(...nodes: (Node | string)[]): void;
261
+ readonly nextElementSibling: Element | null;
262
+ readonly previousElementSibling: Element | null;
263
+ readonly childElementCount: number;
264
+ readonly children: HTMLCollection;
265
+ readonly firstElementChild: Element | null;
266
+ readonly lastElementChild: Element | null;
267
+ append(...nodes: (Node | string)[]): void;
268
+ prepend(...nodes: (Node | string)[]): void;
269
+ querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
270
+ querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
271
+ querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
272
+ querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null;
273
+ querySelector<E extends Element = Element>(selectors: string): E | null;
274
+ querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
275
+ querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
276
+ querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
277
+ querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
278
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
279
+ replaceChildren(...nodes: (Node | string)[]): void;
280
+ readonly assignedSlot: HTMLSlotElement | null;
281
+ readonly attributeStyleMap: StylePropertyMap;
282
+ readonly style: CSSStyleDeclaration;
283
+ contentEditable: string;
284
+ enterKeyHint: string;
285
+ inputMode: string;
286
+ readonly isContentEditable: boolean;
287
+ onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
288
+ onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
289
+ onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
290
+ onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
291
+ onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
292
+ onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
293
+ onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
294
+ onbeforetoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
295
+ onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
296
+ oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null;
297
+ oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
298
+ oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null;
299
+ onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
300
+ onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
301
+ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null;
302
+ oncontextlost: ((this: GlobalEventHandlers, ev: Event) => any) | null;
303
+ oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
304
+ oncontextrestored: ((this: GlobalEventHandlers, ev: Event) => any) | null;
305
+ oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
306
+ oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
307
+ oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
308
+ ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
309
+ ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
310
+ ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
311
+ ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
312
+ ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
313
+ ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
314
+ ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
315
+ ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null;
316
+ ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
317
+ onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null;
318
+ onended: ((this: GlobalEventHandlers, ev: Event) => any) | null;
319
+ onerror: OnErrorEventHandler;
320
+ onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;
321
+ onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null;
322
+ ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
323
+ oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null;
324
+ oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null;
325
+ onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
326
+ onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
327
+ onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null;
328
+ onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
329
+ onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
330
+ onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null;
331
+ onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
332
+ onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
333
+ onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
334
+ onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
335
+ onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
336
+ onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
337
+ onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
338
+ onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
339
+ onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
340
+ onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null;
341
+ onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null;
342
+ onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null;
343
+ onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null;
344
+ onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
345
+ onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
346
+ onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
347
+ onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
348
+ onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
349
+ onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
350
+ onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
351
+ onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
352
+ onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
353
+ onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
354
+ onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
355
+ onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
356
+ onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
357
+ onscrollend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
358
+ onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
359
+ onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null;
360
+ onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null;
361
+ onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
362
+ onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
363
+ onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
364
+ onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
365
+ onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null;
366
+ onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null;
367
+ onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
368
+ ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null;
369
+ ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null;
370
+ ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
371
+ ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
372
+ ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
373
+ ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
374
+ ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
375
+ ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
376
+ ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
377
+ ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null;
378
+ onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
379
+ onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null;
380
+ onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
381
+ onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null;
382
+ onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
383
+ onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null;
384
+ onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
385
+ autofocus: boolean;
386
+ readonly dataset: DOMStringMap;
387
+ nonce?: string;
388
+ tabIndex: number;
389
+ blur(): void;
390
+ focus(options?: FocusOptions): void;
391
+ };
392
+ } & TBase;
393
+ export {};
@@ -0,0 +1,154 @@
1
+ export function gesture(Base) {
2
+ return class extends Base {
3
+ constructor() {
4
+ super(...arguments);
5
+ Object.defineProperty(this, "__pointers", {
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true,
9
+ value: new Map()
10
+ });
11
+ Object.defineProperty(this, "__lastTapTime", {
12
+ enumerable: true,
13
+ configurable: true,
14
+ writable: true,
15
+ value: 0
16
+ });
17
+ Object.defineProperty(this, "__lastPinchDistance", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: 0
22
+ });
23
+ Object.defineProperty(this, "__dragStart", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: null
28
+ });
29
+ Object.defineProperty(this, "handlePointerDown", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: (e) => {
34
+ e.preventDefault();
35
+ const point = { x: e.clientX, y: e.clientY };
36
+ this.__pointers.set(e.pointerId, point);
37
+ this.addGlobalListeners();
38
+ }
39
+ });
40
+ Object.defineProperty(this, "handlePointerMove", {
41
+ enumerable: true,
42
+ configurable: true,
43
+ writable: true,
44
+ value: (e) => {
45
+ e.preventDefault();
46
+ const point = { x: e.clientX, y: e.clientY };
47
+ this.__pointers.set(e.pointerId, point);
48
+ if (this.__pointers.size === 2) {
49
+ this.handlePinch();
50
+ }
51
+ else if (this.__pointers.size === 1) {
52
+ this.handleDrag(point, false);
53
+ }
54
+ }
55
+ });
56
+ Object.defineProperty(this, "handlePointerUp", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: (e) => {
61
+ const point = { x: e.clientX, y: e.clientY };
62
+ this.__pointers.delete(e.pointerId);
63
+ if (this.__dragStart) {
64
+ this.handleDrag(point, true);
65
+ }
66
+ if (this.__pointers.size === 0) {
67
+ this.removeGlobalListeners();
68
+ this.__dragStart = null;
69
+ this.__lastPinchDistance = 0;
70
+ this.handleTap(point);
71
+ }
72
+ }
73
+ });
74
+ }
75
+ connectedCallback() {
76
+ if (super.connectedCallback) {
77
+ super.connectedCallback();
78
+ }
79
+ this.addEventListener('pointerdown', this.handlePointerDown);
80
+ }
81
+ disconnectedCallback() {
82
+ if (super.disconnectedCallback) {
83
+ super.disconnectedCallback();
84
+ }
85
+ this.removeEventListener('pointerdown', this.handlePointerDown);
86
+ this.removeGlobalListeners();
87
+ }
88
+ handlePinch() {
89
+ const pointers = Array.from(this.__pointers.values());
90
+ const currentDistance = this.getDistance(pointers[0], pointers[1]);
91
+ if (this.__lastPinchDistance) {
92
+ const scale = currentDistance / this.__lastPinchDistance;
93
+ const center = {
94
+ x: (pointers[0].x + pointers[1].x) / 2,
95
+ y: (pointers[0].y + pointers[1].y) / 2
96
+ };
97
+ this.dispatchEvent(new CustomEvent('pinch', {
98
+ detail: { scale, centerX: center.x, centerY: center.y }
99
+ }));
100
+ }
101
+ this.__lastPinchDistance = currentDistance;
102
+ }
103
+ handleDrag(point, end) {
104
+ if (this.__dragStart) {
105
+ const deltaX = point.x - this.__dragStart.x;
106
+ const deltaY = point.y - this.__dragStart.y;
107
+ this.dispatchEvent(new CustomEvent('drag', {
108
+ detail: { deltaX, deltaY, clientX: point.x, clientY: point.y, end }
109
+ }));
110
+ if (end) {
111
+ this.__dragStart = null;
112
+ }
113
+ else {
114
+ this.__dragStart = point;
115
+ }
116
+ }
117
+ else if (!end && this.__pointers.size === 1) {
118
+ /* dragging을 시작하려면, pointer 개수가 1개인 것을 (지연)확인해야한다. */
119
+ setTimeout(() => {
120
+ if (this.__pointers.size === 1 && !this.__dragStart) {
121
+ this.__dragStart = point;
122
+ }
123
+ }, 30);
124
+ }
125
+ }
126
+ handleTap(point) {
127
+ const currentTime = performance.now();
128
+ const timeSinceLastTap = currentTime - this.__lastTapTime;
129
+ if (timeSinceLastTap < 300) {
130
+ // 300ms is a common double-tap threshold
131
+ this.dispatchEvent(new CustomEvent('doubletap', {
132
+ detail: { x: point.x, y: point.y }
133
+ }));
134
+ }
135
+ this.__lastTapTime = currentTime;
136
+ }
137
+ getDistance(p1, p2) {
138
+ const dx = p1.x - p2.x;
139
+ const dy = p1.y - p2.y;
140
+ return Math.sqrt(dx * dx + dy * dy);
141
+ }
142
+ addGlobalListeners() {
143
+ document.addEventListener('pointermove', this.handlePointerMove);
144
+ document.addEventListener('pointerup', this.handlePointerUp);
145
+ document.addEventListener('pointercancel', this.handlePointerUp);
146
+ }
147
+ removeGlobalListeners() {
148
+ document.removeEventListener('pointermove', this.handlePointerMove);
149
+ document.removeEventListener('pointerup', this.handlePointerUp);
150
+ document.removeEventListener('pointercancel', this.handlePointerUp);
151
+ }
152
+ };
153
+ }
154
+ //# sourceMappingURL=gesture-mixin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gesture-mixin.js","sourceRoot":"","sources":["../../../src/mixins/gesture-mixin.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,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CAAA;YAC7E,QAAQ,CAAC,gBAAgB,CAAC,eAAe,EAAE,IAAI,CAAC,eAAgC,CAAC,CAAA;QACnF,CAAC;QAED,qBAAqB;YACnB,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAkC,CAAC,CAAA;YACpF,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,eAAgC,CAAC,CAAA;YAChF,QAAQ,CAAC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,eAAgC,CAAC,CAAA;QACtF,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["interface CustomElement extends HTMLElement {\n connectedCallback?(): void\n disconnectedCallback?(): void\n}\n\ntype Constructor<T = CustomElement> = new (...args: any[]) => T\n\nexport type GestureEventPinch = CustomEvent<{ scale: number; centerX: number; centerY: number }>\nexport type GestureEventDrag = CustomEvent<{\n deltaX: number\n deltaY: number\n clientX: number\n clientY: number\n end: boolean\n}>\nexport type GestureEventDoubleTap = CustomEvent<{ x: number; y: number }>\n\nexport function gesture<TBase extends Constructor>(Base: TBase) {\n return class extends Base {\n __pointers = new Map<number, { x: number; y: number }>()\n __lastTapTime = 0\n __lastPinchDistance = 0\n __dragStart: { x: number; y: number } | null = null\n\n connectedCallback(): void {\n if (super.connectedCallback) {\n super.connectedCallback()\n }\n this.addEventListener('pointerdown', this.handlePointerDown as EventListener)\n }\n\n disconnectedCallback(): void {\n if (super.disconnectedCallback) {\n super.disconnectedCallback()\n }\n this.removeEventListener('pointerdown', this.handlePointerDown as EventListener)\n this.removeGlobalListeners()\n }\n\n handlePointerDown = (e: PointerEvent) => {\n e.preventDefault()\n const point = { x: e.clientX, y: e.clientY }\n this.__pointers.set(e.pointerId, point)\n\n this.addGlobalListeners()\n }\n\n handlePointerMove = (e: PointerEvent) => {\n e.preventDefault()\n const point = { x: e.clientX, y: e.clientY }\n this.__pointers.set(e.pointerId, point)\n\n if (this.__pointers.size === 2) {\n this.handlePinch()\n } else if (this.__pointers.size === 1) {\n this.handleDrag(point, false)\n }\n }\n\n handlePointerUp = (e: PointerEvent) => {\n const point = { x: e.clientX, y: e.clientY }\n this.__pointers.delete(e.pointerId)\n\n if (this.__dragStart) {\n this.handleDrag(point, true)\n }\n\n if (this.__pointers.size === 0) {\n this.removeGlobalListeners()\n this.__dragStart = null\n this.__lastPinchDistance = 0\n this.handleTap(point)\n }\n }\n\n handlePinch() {\n const pointers = Array.from(this.__pointers.values()) as { x: number; y: number }[]\n const currentDistance = this.getDistance(pointers[0], pointers[1])\n\n if (this.__lastPinchDistance) {\n const scale = currentDistance / this.__lastPinchDistance\n const center = {\n x: (pointers[0].x + pointers[1].x) / 2,\n y: (pointers[0].y + pointers[1].y) / 2\n }\n\n this.dispatchEvent(\n new CustomEvent('pinch', {\n detail: { scale, centerX: center.x, centerY: center.y }\n })\n )\n }\n\n this.__lastPinchDistance = currentDistance\n }\n\n handleDrag(point: { x: number; y: number }, end: boolean) {\n if (this.__dragStart) {\n const deltaX = point.x - this.__dragStart.x\n const deltaY = point.y - this.__dragStart.y\n\n this.dispatchEvent(\n new CustomEvent('drag', {\n detail: { deltaX, deltaY, clientX: point.x, clientY: point.y, end }\n })\n )\n\n if (end) {\n this.__dragStart = null\n } else {\n this.__dragStart = point\n }\n } else if (!end && this.__pointers.size === 1) {\n /* dragging을 시작하려면, pointer 개수가 1개인 것을 (지연)확인해야한다. */\n setTimeout(() => {\n if (this.__pointers.size === 1 && !this.__dragStart) {\n this.__dragStart = point\n }\n }, 30)\n }\n }\n\n handleTap(point: { x: number; y: number }) {\n const currentTime = performance.now()\n const timeSinceLastTap = currentTime - this.__lastTapTime\n\n if (timeSinceLastTap < 300) {\n // 300ms is a common double-tap threshold\n this.dispatchEvent(\n new CustomEvent('doubletap', {\n detail: { x: point.x, y: point.y }\n })\n )\n }\n\n this.__lastTapTime = currentTime\n }\n\n getDistance(p1: { x: number; y: number }, p2: { x: number; y: number }): number {\n const dx = p1.x - p2.x\n const dy = p1.y - p2.y\n return Math.sqrt(dx * dx + dy * dy)\n }\n\n addGlobalListeners() {\n document.addEventListener('pointermove', this.handlePointerMove as EventListener)\n document.addEventListener('pointerup', this.handlePointerUp as EventListener)\n document.addEventListener('pointercancel', this.handlePointerUp as EventListener)\n }\n\n removeGlobalListeners() {\n document.removeEventListener('pointermove', this.handlePointerMove as EventListener)\n document.removeEventListener('pointerup', this.handlePointerUp as EventListener)\n document.removeEventListener('pointercancel', this.handlePointerUp as EventListener)\n }\n }\n}\n"]}
@@ -1 +1,2 @@
1
1
  export { default as InfiniteScrollable } from './infinite-scrollable.js';
2
+ export * from './gesture-mixin.js';
@@ -1,2 +1,3 @@
1
1
  export { default as InfiniteScrollable } from './infinite-scrollable.js';
2
+ export * from './gesture-mixin.js';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mixins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA","sourcesContent":["export { default as InfiniteScrollable } from './infinite-scrollable.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mixins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACxE,cAAc,oBAAoB,CAAA","sourcesContent":["export { default as InfiniteScrollable } from './infinite-scrollable.js'\nexport * from './gesture-mixin.js'\n"]}
@@ -1,4 +1,4 @@
1
- import debounce from 'lodash-es/debounce';
1
+ import debounce from 'lodash-es/debounce.js';
2
2
  /**
3
3
  * A higher-order function that enhances a base class with infinite scrolling functionality.
4
4
  *
@@ -19,30 +19,40 @@ export default function InfiniteScrollable(Base) {
19
19
  * @property {string} totalProp - The property name for the total number of items.
20
20
  * @property {string} pageProp - The property name for the current page number.
21
21
  */
22
- this._infiniteScrollOptions = {
23
- threshold: 20,
24
- limit: 30,
25
- totalProp: '_total',
26
- pageProp: '_page'
27
- };
22
+ Object.defineProperty(this, "_infiniteScrollOptions", {
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true,
26
+ value: {
27
+ threshold: 20,
28
+ limit: 30,
29
+ totalProp: '_total',
30
+ pageProp: '_page'
31
+ }
32
+ });
28
33
  /**
29
34
  * Event handler for the scroll event with debouncing.
30
35
  *
31
36
  * @param {Event} e - The scroll event object.
32
37
  */
33
- this.onScroll = debounce(e => {
34
- //@ts-ignore inheritted class should have scrollTargetEl property
35
- var el = this.scrollTargetEl;
36
- if (!el) {
37
- console.warn('scroll target element is not defined.');
38
- return;
39
- }
40
- var { threshold = 0, limit, totalProp, pageProp } = this._infiniteScrollOptions;
41
- if (this[pageProp] < this[totalProp] / limit &&
42
- el.scrollHeight - el.clientHeight <= el.scrollTop + threshold) {
43
- this.scrollAction();
44
- }
45
- }, 300);
38
+ Object.defineProperty(this, "onScroll", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: debounce(e => {
43
+ //@ts-ignore inheritted class should have scrollTargetEl property
44
+ var el = this.scrollTargetEl;
45
+ if (!el) {
46
+ console.warn('scroll target element is not defined.');
47
+ return;
48
+ }
49
+ var { threshold = 0, limit, totalProp, pageProp } = this._infiniteScrollOptions;
50
+ if (this[pageProp] < this[totalProp] / limit &&
51
+ el.scrollHeight - el.clientHeight <= el.scrollTop + threshold) {
52
+ this.scrollAction();
53
+ }
54
+ }, 300)
55
+ });
46
56
  }
47
57
  // commented due to TS2611 error
48
58
  // get scrollTargetEl(): HTMLElement | null {