incajs 0.0.21 → 0.0.22
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/README.md +1 -1
- package/dist/callbacks.d.mts +7 -7
- package/dist/chunks/hooks-TbLjfN0c.js +417 -0
- package/dist/chunks/rendererCore-BUNTDvYu.js +110 -0
- package/dist/document.d.mts +11 -0
- package/dist/element/eventHandlers.d.mts +1 -1
- package/dist/element/handle.d.mts +14 -4
- package/dist/element/types.d.mts +21 -4
- package/dist/eventTarget.d.mts +5 -4
- package/dist/events.d.mts +47 -15
- package/dist/index.d.mts +2 -2
- package/dist/index.js +1 -3
- package/dist/native.d.mts +9 -4
- package/dist/rendererCore.d.mts +1 -1
- package/dist/rendererCore.js +3 -4
- package/dist/types.d.mts +54 -15
- package/dist/vue/nodeOps.d.mts +1 -1
- package/dist/vue.js +55 -56
- package/dist/window.d.mts +8 -8
- package/package.json +1 -1
- package/dist/chunks/handle-DdYIkUcm.js +0 -215
- package/dist/chunks/hooks-D1NFQN8Q.js +0 -205
- package/dist/chunks/rendererCore-NnTAUL80.js +0 -110
package/dist/events.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventTargetId } from './native.mts';
|
|
1
2
|
import { EventLike, EventListenerOrObject, ListenerOptions, NodeId } from './types.mts';
|
|
2
3
|
/**
|
|
3
4
|
* @returns the `eventId` of the newest event any registered listener has
|
|
@@ -6,13 +7,14 @@ import { EventLike, EventListenerOrObject, ListenerOptions, NodeId } from './typ
|
|
|
6
7
|
*/
|
|
7
8
|
export declare function latestEventId(): number;
|
|
8
9
|
/**
|
|
9
|
-
* Registers `listener` for `event` on
|
|
10
|
-
* for the same
|
|
11
|
-
* registration keeps its other options.
|
|
10
|
+
* Registers `listener` for `event` on the target (node, document or window).
|
|
11
|
+
* Registering the same listener for the same target, event and `capture`
|
|
12
|
+
* again changes nothing, and the first registration keeps its other options.
|
|
13
|
+
* A `null` listener is ignored.
|
|
12
14
|
*
|
|
13
15
|
* Any event name is accepted, and it fires when the host dispatches that name.
|
|
14
16
|
* `IncaEventMap` gives the event type of each name the host dispatches.
|
|
15
|
-
* @param
|
|
17
|
+
* @param target - the event target (node id, "$document" or "$window")
|
|
16
18
|
* @param event - the event name (e.g. `"click"`)
|
|
17
19
|
* @param listener - a function, called with the event's `currentTarget` as
|
|
18
20
|
* `this`, or an object whose `handleEvent` method is called with the object
|
|
@@ -20,31 +22,33 @@ export declare function latestEventId(): number;
|
|
|
20
22
|
* @param options - `capture` listens while the event travels down to the
|
|
21
23
|
* target, `passive` ignores `preventDefault()` calls in `listener`, and
|
|
22
24
|
* `once` removes the listener before it first runs
|
|
23
|
-
* @throws TypeError when `
|
|
24
|
-
* @throws TypeError when
|
|
25
|
+
* @throws TypeError when `target` is malformed or is an unknown target tag
|
|
26
|
+
* @throws TypeError when a node target names no node
|
|
25
27
|
* @throws RangeError when the host has issued its last callback id
|
|
26
28
|
*/
|
|
27
|
-
export declare function addEventListener(
|
|
29
|
+
export declare function addEventListener(target: EventTargetId, event: string, listener: EventListenerOrObject<never, never> | null, options?: ListenerOptions): void;
|
|
28
30
|
/**
|
|
29
31
|
* Drops the registration {@link addEventListener} made for `listener` on
|
|
30
|
-
*
|
|
31
|
-
* @param
|
|
32
|
+
* the target with the same `event` and `capture`. A no-op if there is none.
|
|
33
|
+
* @param target - the event target (node, document or window)
|
|
32
34
|
* @param event - the event name
|
|
33
35
|
* @param listener - the listener that was registered
|
|
34
36
|
* @param options - `capture` of the registration to drop
|
|
35
37
|
*/
|
|
36
|
-
export declare function removeEventListener(
|
|
38
|
+
export declare function removeEventListener(target: EventTargetId, event: string, listener: EventListenerOrObject<never, never> | null, options?: Pick<ListenerOptions, "capture">): void;
|
|
37
39
|
/**
|
|
38
|
-
* Dispatches `event` at
|
|
39
|
-
*
|
|
40
|
+
* Dispatches `event` at a target along its path. Dispatching at an element
|
|
41
|
+
* reaches its ancestors, `document` and `window`. Dispatching at `document`
|
|
42
|
+
* reaches `window`, and dispatching at `window` reaches only `window`.
|
|
43
|
+
* @param target - the target to dispatch at (node id, "$document" or "$window")
|
|
40
44
|
* @param event - the event to dispatch
|
|
41
45
|
* @returns `false` when a listener canceled a cancelable event, else `true`
|
|
42
|
-
* @throws TypeError when `
|
|
43
|
-
* @throws TypeError when `
|
|
46
|
+
* @throws TypeError when `target` is malformed or is an unknown target tag
|
|
47
|
+
* @throws TypeError when `target` is a node id that names no node
|
|
44
48
|
* @throws TypeError when `event` is not an event built with an event constructor
|
|
45
49
|
* @throws DOMException named `InvalidStateError` when `event` is being dispatched
|
|
46
50
|
*/
|
|
47
|
-
export declare function dispatchEvent(
|
|
51
|
+
export declare function dispatchEvent(target: EventTargetId, event: EventLike): boolean;
|
|
48
52
|
/**
|
|
49
53
|
* Fires an untrusted `click` at `nodeId`. A disabled `button` and a node whose
|
|
50
54
|
* own click is still running ignore the call.
|
|
@@ -71,3 +75,31 @@ export declare function focus(nodeId: NodeId, preventScroll?: boolean): void;
|
|
|
71
75
|
* @param nodeId - the node to unfocus
|
|
72
76
|
*/
|
|
73
77
|
export declare function blur(nodeId: NodeId): void;
|
|
78
|
+
/**
|
|
79
|
+
* Captures the mouse pointer for `nodeId` while a button is held. The pointer events and the
|
|
80
|
+
* mouse events that follow go to the node until the last button is released, and
|
|
81
|
+
* `gotpointercapture` fires before the next pointer event. With no button held the call does
|
|
82
|
+
* nothing.
|
|
83
|
+
* @param nodeId - the node to capture the pointer for
|
|
84
|
+
* @param pointerId - the pointer to capture; only `1`, the mouse, exists
|
|
85
|
+
* @throws DOMException named `NotFoundError` when `pointerId` is not `1`
|
|
86
|
+
* @throws DOMException named `InvalidStateError` when `nodeId` names no node or a node outside
|
|
87
|
+
* the mounted tree
|
|
88
|
+
*/
|
|
89
|
+
export declare function setPointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
90
|
+
/**
|
|
91
|
+
* Releases the pointer capture `nodeId` requested. `lostpointercapture` fires before the next
|
|
92
|
+
* pointer event. The call does nothing for a node that has no capture.
|
|
93
|
+
* @param nodeId - the node that holds the capture
|
|
94
|
+
* @param pointerId - the pointer to release; only `1`, the mouse, exists
|
|
95
|
+
* @throws DOMException named `NotFoundError` when `pointerId` is not `1`
|
|
96
|
+
*/
|
|
97
|
+
export declare function releasePointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
98
|
+
/**
|
|
99
|
+
* Whether `nodeId` requested the pointer capture and has not released it.
|
|
100
|
+
* @param nodeId - the node to ask about
|
|
101
|
+
* @param pointerId - the pointer to ask about
|
|
102
|
+
* @returns `false` for a pointer other than `1`, for a node outside the mounted tree and for a
|
|
103
|
+
* node that holds no capture
|
|
104
|
+
*/
|
|
105
|
+
export declare function hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { document } from './document.mts';
|
|
2
2
|
export { window } from './window.mts';
|
|
3
3
|
export type { RectLike, RectValues } from './element/geometry.mts';
|
|
4
4
|
export type { ScrollIntoViewOptions, ScrollOptions } from './element/scroll.mts';
|
|
5
5
|
export type { IncaElement, IncaNode } from './element/types.mts';
|
|
6
|
-
export type { AttributeValue, CallbackId, EventLike, EventListener, EventListenerObject, EventListenerOrObject, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaKeyboardEvent, IncaMouseEvent, IncaPointerEvent, IncaUIEvent, IncaWheelEvent, ListenerOptions, NodeId, StyleProps, TagName, } from './types.mts';
|
|
6
|
+
export type { AttributeValue, CallbackId, EventLike, EventListener, EventListenerObject, EventListenerOrObject, IncaDocument, IncaEvent, IncaEventMap, IncaEventTarget, IncaFocusEvent, IncaKeyboardEvent, IncaMouseEvent, IncaPointerEvent, IncaUIEvent, IncaWheelEvent, IncaWindow, ListenerOptions, NodeId, StyleProps, TagName, } from './types.mts';
|
package/dist/index.js
CHANGED
package/dist/native.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AttributeValue, CallbackId, EventLike, NodeId, ScrollAlignment } from './types.mts';
|
|
2
|
+
/** What a listener or a dispatch names: a node id, or the tag of `document` or `window`. */
|
|
3
|
+
export type EventTargetId = NodeId | "$document" | "$window";
|
|
2
4
|
/**
|
|
3
5
|
* The host-injected object every wrapper in this package forwards to. Not part of the public
|
|
4
6
|
* surface.
|
|
@@ -14,8 +16,8 @@ interface IncaNative {
|
|
|
14
16
|
removeAttribute(nodeId: NodeId, key: string): void;
|
|
15
17
|
setStyle(nodeId: NodeId, key: string, value: AttributeValue): void;
|
|
16
18
|
removeStyle(nodeId: NodeId, key: string): void;
|
|
17
|
-
addEventListener(
|
|
18
|
-
removeEventListener(
|
|
19
|
+
addEventListener(target: EventTargetId, event: string, capture?: boolean, passive?: boolean): CallbackId;
|
|
20
|
+
removeEventListener(target: EventTargetId, event: string, callbackId: CallbackId): boolean;
|
|
19
21
|
destroyNode(nodeId: NodeId): CallbackId[];
|
|
20
22
|
holdNode(nodeId: NodeId): void;
|
|
21
23
|
releaseNode(nodeId: NodeId): void;
|
|
@@ -26,8 +28,11 @@ interface IncaNative {
|
|
|
26
28
|
scrollOf(nodeId: NodeId): readonly [number, number, number, number] | null;
|
|
27
29
|
scrollNode(nodeId: NodeId, left: number | null, top: number | null): void;
|
|
28
30
|
scrollIntoViewNode(nodeId: NodeId, block: ScrollAlignment, inline: ScrollAlignment): void;
|
|
29
|
-
dispatchEvent(
|
|
31
|
+
dispatchEvent(target: EventTargetId, event: EventLike): boolean;
|
|
30
32
|
click(nodeId: NodeId): void;
|
|
33
|
+
setPointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
34
|
+
releasePointerCapture(nodeId: NodeId, pointerId: number): void;
|
|
35
|
+
hasPointerCapture(nodeId: NodeId, pointerId: number): boolean;
|
|
31
36
|
}
|
|
32
37
|
/** What the host calls: it passes the event object as the first argument. */
|
|
33
38
|
export type HostCallback = (...args: unknown[]) => void;
|
|
@@ -35,7 +40,7 @@ declare global {
|
|
|
35
40
|
var __inca_native__: IncaNative;
|
|
36
41
|
var __inca_callbacks__: Record<CallbackId, HostCallback>;
|
|
37
42
|
var __inca_released__: (nodeIds: NodeId[], callbackIds: CallbackId[]) => void;
|
|
38
|
-
var __inca_targets__: (
|
|
43
|
+
var __inca_targets__: (targets: EventTargetId[]) => unknown[];
|
|
39
44
|
}
|
|
40
45
|
export declare function native(): IncaNative;
|
|
41
46
|
export {};
|
package/dist/rendererCore.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ export { createEventTarget } from './eventTarget.mts';
|
|
|
2
2
|
export { window } from './window.mts';
|
|
3
3
|
export { addEventListener, removeEventListener, latestEventId, focus, blur, dispatchEvent, click, } from './events.mts';
|
|
4
4
|
export { focusedNode, appendChild, createNode, destroyNode, holdNode, releaseNode, insertBefore, removeChild, rootNodeId, setAttribute, getAttribute, layoutOf, scrollOf, scrollNode, scrollIntoViewNode, removeAttribute, setStyle, removeStyle, } from './tree.mts';
|
|
5
|
-
export { createIncaElement } from './element/handle.mts';
|
|
5
|
+
export { createIncaElement, rootElement } from './element/handle.mts';
|
|
6
6
|
export { isDestroyed } from './element/lifecycle.mts';
|
|
7
7
|
export { createCommentNode, createElementNode, createTextNode, insert, nextSibling, parentNode, remove, setElementText, setText, } from './element/shadowTree.mts';
|
|
8
8
|
export type * from './types.mts';
|
package/dist/rendererCore.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, u as c } from "./chunks/rendererCore-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { I as addEventListener, D as appendChild, p as blur, l as click, i as createCommentNode, o as createElementNode, _ as createEventTarget, R as createIncaElement, A as createNode, n as createTextNode, C as destroyNode, F as dispatchEvent, m as focus, g as focusedNode, O as getAttribute, j as holdNode, e as insert, v as insertBefore, w as isDestroyed, d as latestEventId, T as layoutOf, a as nextSibling, s as parentNode, N as releaseNode, f as releaseWhenCollected, t as remove, y as removeAttribute, b as removeChild, u as removeEventListener, k as removeStyle, E as rootNodeId, S as scrollIntoViewNode, x as scrollNode, h as scrollOf, P as setAttribute, r as setElementText, L as setStyle, c as setText, M as window };
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, u as c } from "./chunks/rendererCore-BUNTDvYu.js";
|
|
2
|
+
import { A as l, C as u, D as d, E as f, N as p, O as m, S as h, T as g, _, a as v, b as y, c as b, d as x, f as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, o as A, p as j, r as M, s as N, t as P, u as F, v as I, w as L, x as R, y as z } from "./chunks/hooks-TbLjfN0c.js";
|
|
3
|
+
export { L as addEventListener, v as appendChild, g as blur, f as click, i as createCommentNode, o as createElementNode, u as createEventTarget, M as createIncaElement, A as createNode, n as createTextNode, N as destroyNode, d as dispatchEvent, m as focus, b as focusedNode, O as getAttribute, F as holdNode, e as insert, x as insertBefore, E as isDestroyed, D as latestEventId, S as layoutOf, a as nextSibling, s as parentNode, j as releaseNode, p as releaseWhenCollected, t as remove, k as removeAttribute, w as removeChild, l as removeEventListener, C as removeStyle, T as rootElement, _ as rootNodeId, I as scrollIntoViewNode, z as scrollNode, y as scrollOf, R as setAttribute, r as setElementText, h as setStyle, c as setText, P as window };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventHandlers, IncaElement } from './element/types.mts';
|
|
1
2
|
/**
|
|
2
3
|
* Stable handle to a node in the native retained tree, returned by `createNode`
|
|
3
4
|
* and used in every later call that touches that node.
|
|
@@ -120,7 +121,10 @@ export interface EventLike {
|
|
|
120
121
|
* How a listener registered via `addEventListener` takes part in an event.
|
|
121
122
|
*/
|
|
122
123
|
export interface ListenerOptions {
|
|
123
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Listen while the event travels from `window` down to the target. The default listens while it
|
|
126
|
+
* travels back up.
|
|
127
|
+
*/
|
|
124
128
|
capture?: boolean;
|
|
125
129
|
/** `preventDefault()` calls inside the listener are ignored. */
|
|
126
130
|
passive?: boolean;
|
|
@@ -129,7 +133,7 @@ export interface ListenerOptions {
|
|
|
129
133
|
}
|
|
130
134
|
/**
|
|
131
135
|
* The listener methods of an object that receives events, such as the
|
|
132
|
-
* `window`
|
|
136
|
+
* `window` and `document` exports and a template `ref`. A registration is identified by the
|
|
133
137
|
* event name, the listener and `capture`. `removeEventListener` takes the
|
|
134
138
|
* same listener that `addEventListener` received.
|
|
135
139
|
*/
|
|
@@ -164,6 +168,18 @@ export interface IncaEventTarget {
|
|
|
164
168
|
*/
|
|
165
169
|
dispatchEvent(event: EventLike): boolean;
|
|
166
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* The event target between the elements and `window`.
|
|
173
|
+
*/
|
|
174
|
+
export interface IncaDocument extends IncaEventTarget, EventHandlers<IncaDocument> {
|
|
175
|
+
/** The element that has focus, or `null` when no element has focus. */
|
|
176
|
+
readonly activeElement: IncaElement | null;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The event target at the top of every event path.
|
|
180
|
+
*/
|
|
181
|
+
export interface IncaWindow extends IncaEventTarget, EventHandlers<IncaWindow> {
|
|
182
|
+
}
|
|
167
183
|
/**
|
|
168
184
|
* The fields every event carries. {@link IncaEventMap} gives the event type of
|
|
169
185
|
* each name the host dispatches, and a listener for any other name receives
|
|
@@ -184,16 +200,17 @@ export interface IncaEvent {
|
|
|
184
200
|
/** `3`, the {@link IncaEvent.eventPhase} on an ancestor while the event travels up. */
|
|
185
201
|
readonly BUBBLING_PHASE: 3;
|
|
186
202
|
/**
|
|
187
|
-
* The element the event is about
|
|
188
|
-
*
|
|
189
|
-
* press and the release for `click`, `dblclick` and `auxclick`, and the
|
|
190
|
-
*
|
|
203
|
+
* The element the event is about. It is the deepest element under the pointer for pointer
|
|
204
|
+
* events (the capturing element while the pointer is captured), the nearest common ancestor of
|
|
205
|
+
* the press and the release for `click`, `dblclick` and `auxclick`, and the focused element for
|
|
206
|
+
* key events. With no such element it is the mount container's element. A script dispatch at
|
|
207
|
+
* `document` or `window` gives that object.
|
|
191
208
|
*/
|
|
192
209
|
readonly target: IncaEventTarget;
|
|
193
210
|
/** The same object as {@link IncaEvent.target}. */
|
|
194
211
|
readonly srcElement: IncaEventTarget;
|
|
195
212
|
/**
|
|
196
|
-
* The element or `window` whose listener is running, and `null` once the
|
|
213
|
+
* The element, `document` or `window` whose listener is running, and `null` once the
|
|
197
214
|
* event has been handled. A listener function runs with it as `this`.
|
|
198
215
|
*/
|
|
199
216
|
readonly currentTarget: IncaEventTarget | null;
|
|
@@ -234,8 +251,8 @@ export interface IncaEvent {
|
|
|
234
251
|
/** Cancels the event when it is cancelable and the listener is not passive. */
|
|
235
252
|
preventDefault(): void;
|
|
236
253
|
/**
|
|
237
|
-
* `target` and its ancestors,
|
|
238
|
-
* the event has been handled.
|
|
254
|
+
* `target` and its ancestors, then `document` and `window`, and an empty
|
|
255
|
+
* array once the event has been handled.
|
|
239
256
|
*/
|
|
240
257
|
composedPath(): IncaEventTarget[];
|
|
241
258
|
/**
|
|
@@ -260,7 +277,8 @@ export interface IncaUIEvent extends IncaEvent {
|
|
|
260
277
|
* On the events the host dispatches: for `mousedown`, `mouseup`, `click`,
|
|
261
278
|
* `dblclick`, `auxclick` and `contextmenu`, `button + 1`. For `wheel`, `0`.
|
|
262
279
|
* For the other mouse events, the lowest held button plus 1, or `0` with no
|
|
263
|
-
* button held. For
|
|
280
|
+
* button held. For the pointer events, `button + 1`, so `0` when `button` is `-1`. For a
|
|
281
|
+
* keyboard event, `keyCode`. For a focus event, `0`.
|
|
264
282
|
*/
|
|
265
283
|
readonly which: number;
|
|
266
284
|
}
|
|
@@ -296,7 +314,10 @@ export interface IncaMouseEvent extends IncaUIEvent {
|
|
|
296
314
|
readonly movementX: number;
|
|
297
315
|
/** On the events the host dispatches, the pointer's travel since the previous `mousemove`, and `0` on other events. */
|
|
298
316
|
readonly movementY: number;
|
|
299
|
-
/**
|
|
317
|
+
/**
|
|
318
|
+
* The button the event is about: `0` left, `1` middle, `2` right, `3` back, `4` forward. `-1` on
|
|
319
|
+
* a pointer event that is about no button.
|
|
320
|
+
*/
|
|
300
321
|
readonly button: number;
|
|
301
322
|
/** Every button held, as a bitmask: `1` left, `2` right, `4` middle, `8` back, `16` forward. */
|
|
302
323
|
readonly buttons: number;
|
|
@@ -316,17 +337,26 @@ export interface IncaMouseEvent extends IncaUIEvent {
|
|
|
316
337
|
*/
|
|
317
338
|
getModifierState(key: string): boolean;
|
|
318
339
|
}
|
|
319
|
-
/**
|
|
340
|
+
/**
|
|
341
|
+
* The event object of the `pointer*` events, `gotpointercapture`, `lostpointercapture`, `click`,
|
|
342
|
+
* `auxclick` and `contextmenu`.
|
|
343
|
+
*/
|
|
320
344
|
export interface IncaPointerEvent extends IncaMouseEvent {
|
|
321
|
-
/**
|
|
345
|
+
/**
|
|
346
|
+
* On the events the host dispatches, `1` for the mouse and for the `contextmenu` of a key, and
|
|
347
|
+
* `-1` for the click of a key.
|
|
348
|
+
*/
|
|
322
349
|
readonly pointerId: number;
|
|
323
350
|
readonly width: number;
|
|
324
351
|
readonly height: number;
|
|
325
|
-
/** On the events the host dispatches, `0.5` while a button is held, else `0`. */
|
|
352
|
+
/** On the pointer events the host dispatches, `0.5` while a button is held, else `0`. */
|
|
326
353
|
readonly pressure: number;
|
|
327
354
|
/** On the events the host dispatches, `"mouse"`, or `""` for the click of a key. */
|
|
328
355
|
readonly pointerType: string;
|
|
329
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* On the events the host dispatches, `true` on the pointer events and `false` on `click`,
|
|
358
|
+
* `auxclick` and `contextmenu`.
|
|
359
|
+
*/
|
|
330
360
|
readonly isPrimary: boolean;
|
|
331
361
|
}
|
|
332
362
|
/** The event object of `wheel`. */
|
|
@@ -382,8 +412,10 @@ export interface IncaEventMap {
|
|
|
382
412
|
focus: IncaFocusEvent;
|
|
383
413
|
focusin: IncaFocusEvent;
|
|
384
414
|
focusout: IncaFocusEvent;
|
|
415
|
+
gotpointercapture: IncaPointerEvent;
|
|
385
416
|
keydown: IncaKeyboardEvent;
|
|
386
417
|
keyup: IncaKeyboardEvent;
|
|
418
|
+
lostpointercapture: IncaPointerEvent;
|
|
387
419
|
mousedown: IncaMouseEvent;
|
|
388
420
|
mouseenter: IncaMouseEvent;
|
|
389
421
|
mouseleave: IncaMouseEvent;
|
|
@@ -391,6 +423,13 @@ export interface IncaEventMap {
|
|
|
391
423
|
mouseout: IncaMouseEvent;
|
|
392
424
|
mouseover: IncaMouseEvent;
|
|
393
425
|
mouseup: IncaMouseEvent;
|
|
426
|
+
pointerdown: IncaPointerEvent;
|
|
427
|
+
pointerenter: IncaPointerEvent;
|
|
428
|
+
pointerleave: IncaPointerEvent;
|
|
429
|
+
pointermove: IncaPointerEvent;
|
|
430
|
+
pointerout: IncaPointerEvent;
|
|
431
|
+
pointerover: IncaPointerEvent;
|
|
432
|
+
pointerup: IncaPointerEvent;
|
|
394
433
|
scroll: IncaEvent;
|
|
395
434
|
wheel: IncaWheelEvent;
|
|
396
435
|
}
|
package/dist/vue/nodeOps.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { IncaCore, IncaElement, IncaNode } from '../rendererCore.mts';
|
|
|
3
3
|
/**
|
|
4
4
|
* Marks `handle` so that Vue's `reactive()` and `ref()` keep the object itself.
|
|
5
5
|
* A template ref then holds the same object the application receives from
|
|
6
|
-
* `activeElement
|
|
6
|
+
* `document.activeElement`.
|
|
7
7
|
* @param handle - the node handle to mark
|
|
8
8
|
* @returns `handle`
|
|
9
9
|
*/
|
package/dist/vue.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { t as e } from "./chunks/rendererCore-
|
|
2
|
-
import {
|
|
3
|
-
import { n } from "
|
|
4
|
-
import { ErrorCodes as r, callWithAsyncErrorHandling as i, createRenderer as a, warn as o } from "@vue/runtime-core";
|
|
1
|
+
import { t as e } from "./chunks/rendererCore-BUNTDvYu.js";
|
|
2
|
+
import { i as t } from "./chunks/hooks-TbLjfN0c.js";
|
|
3
|
+
import { ErrorCodes as n, callWithAsyncErrorHandling as r, createRenderer as i, warn as a } from "@vue/runtime-core";
|
|
5
4
|
//#region src/vue/nodeOps.mts
|
|
6
|
-
function
|
|
5
|
+
function o(e) {
|
|
7
6
|
return Object.defineProperty(e, "__v_skip", { value: !0 }), e;
|
|
8
7
|
}
|
|
9
|
-
function
|
|
8
|
+
function s(e) {
|
|
10
9
|
return {
|
|
11
|
-
createElement: (t) =>
|
|
12
|
-
createText: (t) =>
|
|
13
|
-
createComment: (t) =>
|
|
10
|
+
createElement: (t) => o(e.createElementNode(t)),
|
|
11
|
+
createText: (t) => o(e.createTextNode(t)),
|
|
12
|
+
createComment: (t) => o(e.createCommentNode()),
|
|
14
13
|
setText: (t, n) => e.setText(t, n),
|
|
15
14
|
setElementText: (t, n) => e.setElementText(t, n),
|
|
16
15
|
insert: (t, n, r) => e.insert(t, n, r),
|
|
@@ -19,7 +18,7 @@ function c(e) {
|
|
|
19
18
|
nextSibling: e.nextSibling
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
|
-
function
|
|
21
|
+
function c(e, t) {
|
|
23
22
|
let n = (t) => (e.holdNode(t.__node_id), e.releaseWhenCollected(t), t), { createElement: r, createText: i } = t;
|
|
24
23
|
return {
|
|
25
24
|
createElement: (e) => n(r(e)),
|
|
@@ -28,30 +27,30 @@ function l(e, t) {
|
|
|
28
27
|
}
|
|
29
28
|
//#endregion
|
|
30
29
|
//#region src/vue/patchProp.mts
|
|
31
|
-
var
|
|
32
|
-
function
|
|
30
|
+
var l = (e) => /^on[^a-z]/.test(e), u = (e) => /^on[a-z]/.test(e), d = /(?:Once|Passive|Capture)$/, f = /^on:?(?:Once|Passive|Capture)$/, p = (e) => e.replace(/\B([A-Z])/g, "-$1").toLowerCase();
|
|
31
|
+
function m(e) {
|
|
33
32
|
let t = e, n = {
|
|
34
33
|
event: "",
|
|
35
34
|
once: !1,
|
|
36
35
|
capture: !1,
|
|
37
36
|
passive: !1
|
|
38
37
|
}, r;
|
|
39
|
-
for (; (r = t.match(
|
|
40
|
-
return n.event = t[2] === ":" ? t.slice(3) :
|
|
38
|
+
for (; (r = t.match(d)) && !f.test(t);) t = t.slice(0, -r[0].length), r[0] === "Once" ? n.once = !0 : r[0] === "Capture" ? n.capture = !0 : n.passive = !0;
|
|
39
|
+
return n.event = t[2] === ":" ? t.slice(3) : p(t.slice(2)), n;
|
|
41
40
|
}
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
let r = typeof n == "object" && n ? n : {}, i =
|
|
45
|
-
i ||
|
|
41
|
+
var h = (e) => typeof e == "string" || typeof e == "number", g = /* @__PURE__ */ new WeakMap();
|
|
42
|
+
function _(e, t, n) {
|
|
43
|
+
let r = typeof n == "object" && n ? n : {}, i = g.get(t);
|
|
44
|
+
i || g.set(t, i = /* @__PURE__ */ new Map());
|
|
46
45
|
let a = !1;
|
|
47
|
-
for (let n of i.keys())
|
|
48
|
-
for (let [n, o] of Object.entries(r))
|
|
46
|
+
for (let n of i.keys()) h(r[n]) || (e.removeStyle(t.__node_id, n), i.delete(n), a = !0);
|
|
47
|
+
for (let [n, o] of Object.entries(r)) h(o) && (a || i.get(n) !== o) && (e.setStyle(t.__node_id, n, o), i.set(n, o));
|
|
49
48
|
}
|
|
50
|
-
function
|
|
51
|
-
return e ? typeof e == "function" ? [e] : Array.isArray(e) ? e.slice() : (
|
|
49
|
+
function v(e, t) {
|
|
50
|
+
return e ? typeof e == "function" ? [e] : Array.isArray(e) ? e.slice() : (a(`Wrong type passed as event handler to ${t} - did you forget @ or : in front of your prop?
|
|
52
51
|
Expected function or array of functions, received type ${typeof e}.`), []) : null;
|
|
53
52
|
}
|
|
54
|
-
function
|
|
53
|
+
function y(e, t) {
|
|
55
54
|
let n = e[0];
|
|
56
55
|
if (typeof n != "object" || !n) return t(() => !1);
|
|
57
56
|
let r = n.stopImmediatePropagation;
|
|
@@ -68,12 +67,12 @@ function b(e, t) {
|
|
|
68
67
|
i ? n.stopImmediatePropagation = r : delete n.stopImmediatePropagation;
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
|
-
var
|
|
72
|
-
function
|
|
70
|
+
var b = /* @__PURE__ */ new WeakMap(), x = ({ event: e, capture: t, passive: n }) => `${e}:${t === !0}:${n === !0}`;
|
|
71
|
+
function S(e, t, n, r) {
|
|
73
72
|
let i = Array.from(r.slots.values()).some((e) => !e.fired);
|
|
74
|
-
i && !r.registered && !e.isDestroyed(t) ? (e.addEventListener(t.__node_id, r.event, r.dispatcher, r.options), r.registered = !0) : !i && r.registered && (r.registered = !1, e.removeEventListener(t.__node_id, r.event, r.dispatcher, r.options)), r.slots.size === 0 &&
|
|
73
|
+
i && !r.registered && !e.isDestroyed(t) ? (e.addEventListener(t.__node_id, r.event, r.dispatcher, r.options), r.registered = !0) : !i && r.registered && (r.registered = !1, e.removeEventListener(t.__node_id, r.event, r.dispatcher, r.options)), r.slots.size === 0 && b.get(t)?.delete(n);
|
|
75
74
|
}
|
|
76
|
-
function
|
|
75
|
+
function C(e, t, i, { event: a, capture: o, passive: s }) {
|
|
77
76
|
let c = {
|
|
78
77
|
event: a,
|
|
79
78
|
options: {
|
|
@@ -84,16 +83,16 @@ function w(e, t, n, { event: a, capture: o, passive: s }) {
|
|
|
84
83
|
registered: !1,
|
|
85
84
|
dispatcher: (...a) => {
|
|
86
85
|
let o = [], s = a[0]?.eventId;
|
|
87
|
-
|
|
86
|
+
y(a, (l) => {
|
|
88
87
|
for (let u of Array.from(c.slots.keys())) {
|
|
89
88
|
if (l()) break;
|
|
90
89
|
let d = c.slots.get(u);
|
|
91
90
|
if (d && !d.fired && !(typeof s == "number" && d.attachedAt >= s)) {
|
|
92
|
-
d.once && (d.fired = !0,
|
|
91
|
+
d.once && (d.fired = !0, S(e, t, i, c));
|
|
93
92
|
for (let e of d.handlers) {
|
|
94
93
|
if (l()) break;
|
|
95
94
|
if (e) try {
|
|
96
|
-
|
|
95
|
+
r(e, d.instance, n.NATIVE_EVENT_HANDLER, a);
|
|
97
96
|
} catch (e) {
|
|
98
97
|
o.push(e);
|
|
99
98
|
}
|
|
@@ -107,20 +106,20 @@ function w(e, t, n, { event: a, capture: o, passive: s }) {
|
|
|
107
106
|
};
|
|
108
107
|
return c;
|
|
109
108
|
}
|
|
110
|
-
function
|
|
111
|
-
let i =
|
|
112
|
-
a?.slots.delete(r) &&
|
|
109
|
+
function w(e, t, n, r) {
|
|
110
|
+
let i = x(n), a = b.get(t)?.get(i);
|
|
111
|
+
a?.slots.delete(r) && S(e, t, i, a);
|
|
113
112
|
}
|
|
114
|
-
function
|
|
115
|
-
let a =
|
|
113
|
+
function T(e, t, n, r, i) {
|
|
114
|
+
let a = m(n), o = v(r, n);
|
|
116
115
|
if (!o) {
|
|
117
|
-
|
|
116
|
+
w(e, t, a, n);
|
|
118
117
|
return;
|
|
119
118
|
}
|
|
120
|
-
let s =
|
|
121
|
-
c ||
|
|
119
|
+
let s = x(a), c = b.get(t);
|
|
120
|
+
c || b.set(t, c = /* @__PURE__ */ new Map());
|
|
122
121
|
let l = c.get(s);
|
|
123
|
-
l || c.set(s, l =
|
|
122
|
+
l || c.set(s, l = C(e, t, s, a));
|
|
124
123
|
let u = l.slots.get(n);
|
|
125
124
|
if (u) u.handlers = o, u.instance = i;
|
|
126
125
|
else {
|
|
@@ -132,13 +131,13 @@ function E(e, t, n, r, i) {
|
|
|
132
131
|
fired: !1
|
|
133
132
|
});
|
|
134
133
|
try {
|
|
135
|
-
|
|
134
|
+
S(e, t, s, l);
|
|
136
135
|
} catch (e) {
|
|
137
136
|
throw l.slots.delete(n), l.slots.size === 0 && c.delete(s), e;
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
|
-
var
|
|
140
|
+
var E = /* @__PURE__ */ new Set([
|
|
142
141
|
"disabled",
|
|
143
142
|
"hidden",
|
|
144
143
|
"inert",
|
|
@@ -150,30 +149,30 @@ var D = /* @__PURE__ */ new Set([
|
|
|
150
149
|
"novalidate",
|
|
151
150
|
"readonly"
|
|
152
151
|
]);
|
|
153
|
-
function
|
|
152
|
+
function D(e) {
|
|
154
153
|
return (t, n, r, i, a, o) => {
|
|
155
|
-
n.startsWith("onUpdate:") || (n === "style" ?
|
|
154
|
+
n.startsWith("onUpdate:") || (n === "style" ? _(e, t, i) : l(n) ? T(e, t, n, i, o ?? null) : u(n) && n in t ? typeof i == "string" ? (Reflect.set(t, n, null), e.setAttribute(t.__node_id, n, i)) : Reflect.set(t, n, i) : E.has(n) && !i && i !== "" ? e.removeAttribute(t.__node_id, n) : typeof i == "string" || typeof i == "number" || typeof i == "boolean" ? e.setAttribute(t.__node_id, n, i) : i == null ? e.removeAttribute(t.__node_id, n) : e.setAttribute(t.__node_id, n, String(i)));
|
|
156
155
|
};
|
|
157
156
|
}
|
|
158
157
|
//#endregion
|
|
159
158
|
//#region src/vue/createApp.mts
|
|
160
|
-
var
|
|
161
|
-
function
|
|
162
|
-
let
|
|
163
|
-
...
|
|
164
|
-
patchProp:
|
|
165
|
-
},
|
|
166
|
-
Object.assign(
|
|
167
|
-
let
|
|
168
|
-
return Object.assign(
|
|
159
|
+
var O = /* @__PURE__ */ new Set();
|
|
160
|
+
function k(n, r) {
|
|
161
|
+
let a = {
|
|
162
|
+
...s(e),
|
|
163
|
+
patchProp: D(e)
|
|
164
|
+
}, l = i(a);
|
|
165
|
+
Object.assign(a, c(e, a));
|
|
166
|
+
let u = l.createApp(n, r), d = u.mount.bind(u), f = u.unmount.bind(u);
|
|
167
|
+
return Object.assign(u, {
|
|
169
168
|
mount: (e) => {
|
|
170
|
-
let
|
|
171
|
-
return
|
|
169
|
+
let n = d(e ?? o(t()));
|
|
170
|
+
return O.add(u), n;
|
|
172
171
|
},
|
|
173
172
|
unmount: () => {
|
|
174
|
-
|
|
173
|
+
f(), O.delete(u);
|
|
175
174
|
}
|
|
176
175
|
});
|
|
177
176
|
}
|
|
178
177
|
//#endregion
|
|
179
|
-
export {
|
|
178
|
+
export { k as createIncaApp };
|
package/dist/window.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IncaWindow } from './types.mts';
|
|
2
2
|
/**
|
|
3
|
-
* The event target at the top of the app
|
|
4
|
-
* Bubble listeners on it run for every bubbling event, and capture
|
|
5
|
-
* run for every event dispatched in the app, including events that
|
|
6
|
-
* bubble.
|
|
7
|
-
* `
|
|
3
|
+
* The event target at the top of the app, after `document`. Every event path
|
|
4
|
+
* ends at it. Bubble listeners on it run for every bubbling event, and capture
|
|
5
|
+
* listeners run for every event dispatched in the app, including events that
|
|
6
|
+
* do not bubble. A key event reaches it through the mount container and
|
|
7
|
+
* `document`. A `wheel` listener is passive unless its options say
|
|
8
8
|
* `passive: false`.
|
|
9
9
|
*
|
|
10
10
|
* It has the listener methods `addEventListener`, `removeEventListener` and
|
|
11
|
-
* `dispatchEvent`.
|
|
11
|
+
* `dispatchEvent`, and the event handler properties such as `onkeydown`.
|
|
12
12
|
*/
|
|
13
|
-
export declare const window:
|
|
13
|
+
export declare const window: IncaWindow;
|