@yaks/dom 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +26 -2
- package/_dist/mod.d.ts +136 -0
- package/_dist/mod.d.ts.map +1 -0
- package/deno.json +1 -0
- package/mod.js +514 -0
- package/mod.js.map +1 -0
- package/mod.ts +571 -0
- package/package.json +14 -4
package/mod.js
ADDED
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @yaks/dom: a just-enough DOM for Preact to render against outside a browser
|
|
3
|
+
* (the undom trick): elements are plain objects, every mutation marks the tree
|
|
4
|
+
* dirty, and whoever owns the screen paints on the next microtask. A painter is
|
|
5
|
+
* a small reader of this tree: @yaks/tui paints it to a terminal, @yaks/native
|
|
6
|
+
* to native views, so a kit-built app is one tree on both. `install()` swaps
|
|
7
|
+
* `globalThis.document` for this one and hands back the render root plus the
|
|
8
|
+
* restore, so a process that also holds a browser document (a test suite) keeps
|
|
9
|
+
* its own.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/ let paint = {
|
|
13
|
+
fn: ()=>{}
|
|
14
|
+
};
|
|
15
|
+
/** Register the repaint the next dirty tree asks for. */ export let onPaint = (fn)=>{
|
|
16
|
+
paint.fn = fn;
|
|
17
|
+
};
|
|
18
|
+
// Exported because not every change to the screen is a change to the tree: a
|
|
19
|
+
// scroll and a resize move no nodes and still owe a repaint.
|
|
20
|
+
let dirty = false;
|
|
21
|
+
/** Ask for a repaint; many touches in one turn coalesce into one paint. */ export let touch = ()=>{
|
|
22
|
+
if (dirty) return;
|
|
23
|
+
dirty = true;
|
|
24
|
+
queueMicrotask(()=>{
|
|
25
|
+
dirty = false;
|
|
26
|
+
paint.fn();
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
let none = {
|
|
30
|
+
left: 0,
|
|
31
|
+
top: 0,
|
|
32
|
+
right: 0,
|
|
33
|
+
bottom: 0
|
|
34
|
+
};
|
|
35
|
+
let union = (a, b)=>({
|
|
36
|
+
left: Math.min(a.left, b.left),
|
|
37
|
+
top: Math.min(a.top, b.top),
|
|
38
|
+
right: Math.max(a.right, b.right),
|
|
39
|
+
bottom: Math.max(a.bottom, b.bottom)
|
|
40
|
+
});
|
|
41
|
+
// What the last paint did: the cells each element painted itself, and the
|
|
42
|
+
// elements its sheet hid.
|
|
43
|
+
let placed = new Map();
|
|
44
|
+
let hidden = new Set();
|
|
45
|
+
let revealed;
|
|
46
|
+
let follow = (_href)=>{};
|
|
47
|
+
/** Say how a pressed link is followed: the app's own navigation, since a
|
|
48
|
+
* painter outside a browser has no location to load. */ export let onNavigate = (fn)=>{
|
|
49
|
+
follow = fn;
|
|
50
|
+
};
|
|
51
|
+
/** Record a paint: the screen's lines, each segment's owner the element that
|
|
52
|
+
* painted it, and the elements the sheet hid. Elements measure themselves by
|
|
53
|
+
* it (`getBoundingClientRect`, `checkVisibility`). */ export let place = (lines, hid = new Set())=>{
|
|
54
|
+
placed = new Map();
|
|
55
|
+
hidden = hid;
|
|
56
|
+
lines.forEach((line, top)=>{
|
|
57
|
+
let left = 0;
|
|
58
|
+
for (let { text, owner } of line){
|
|
59
|
+
let cells = {
|
|
60
|
+
left,
|
|
61
|
+
top,
|
|
62
|
+
right: left + text.length,
|
|
63
|
+
bottom: top + 1
|
|
64
|
+
};
|
|
65
|
+
let had = owner && placed.get(owner);
|
|
66
|
+
if (owner && text) placed.set(owner, had ? union(had, cells) : cells);
|
|
67
|
+
left = cells.right;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
/** The base node: parent link, sibling walk, and self-removal. */ export class TNode {
|
|
72
|
+
/** The element this node hangs from, or null when detached. */ parentNode = null;
|
|
73
|
+
/** The node after this one under the same parent. */ get nextSibling() {
|
|
74
|
+
let sibs = this.parentNode?.childNodes;
|
|
75
|
+
return sibs ? sibs[sibs.indexOf(this) + 1] ?? null : null;
|
|
76
|
+
}
|
|
77
|
+
/** Whether it hangs under a screen's root, as a browser's node hangs in
|
|
78
|
+
* its document. */ get isConnected() {
|
|
79
|
+
return this.parentNode?.isConnected ?? this.localName == 'root';
|
|
80
|
+
}
|
|
81
|
+
/** Detach this node from its parent. */ remove() {
|
|
82
|
+
this.parentNode?.removeChild(this);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** A text node; writing `data` dirties the tree. */ export class TText extends TNode {
|
|
86
|
+
/** DOM node type, as Preact expects to read it. */ nodeType = 3;
|
|
87
|
+
text;
|
|
88
|
+
constructor(text){
|
|
89
|
+
super();
|
|
90
|
+
this.text = String(text);
|
|
91
|
+
}
|
|
92
|
+
/** The characters this node holds. */ get data() {
|
|
93
|
+
return this.text;
|
|
94
|
+
}
|
|
95
|
+
set data(v) {
|
|
96
|
+
this.text = String(v);
|
|
97
|
+
touch();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** An element: children, class, attributes, listeners. */ export class TElement extends TNode {
|
|
101
|
+
localName;
|
|
102
|
+
// Preact uses native property presence to normalize event names to lowercase.
|
|
103
|
+
onwheel;
|
|
104
|
+
onclick;
|
|
105
|
+
onmousedown;
|
|
106
|
+
onmouseup;
|
|
107
|
+
onmousemove;
|
|
108
|
+
oninput;
|
|
109
|
+
onchange;
|
|
110
|
+
onkeydown;
|
|
111
|
+
onsubmit;
|
|
112
|
+
onfocus;
|
|
113
|
+
onblur;
|
|
114
|
+
onselect;
|
|
115
|
+
onkeyup;
|
|
116
|
+
ondblclick;
|
|
117
|
+
oncancel;
|
|
118
|
+
selectionStart;
|
|
119
|
+
selectionEnd;
|
|
120
|
+
/** Forms share their value and selection with browser components. */ get value() {
|
|
121
|
+
return this.attr('value') ?? '';
|
|
122
|
+
}
|
|
123
|
+
set value(text) {
|
|
124
|
+
this.setAttribute('value', text);
|
|
125
|
+
}
|
|
126
|
+
/** Whether a check box or radio is on, kept as its attribute, which the
|
|
127
|
+
* painter reads. */ get checked() {
|
|
128
|
+
return this.attrs.has('checked');
|
|
129
|
+
}
|
|
130
|
+
set checked(on) {
|
|
131
|
+
if (on) this.setAttribute('checked', '');
|
|
132
|
+
else this.removeAttribute('checked');
|
|
133
|
+
}
|
|
134
|
+
get ownerDocument() {
|
|
135
|
+
return doc;
|
|
136
|
+
}
|
|
137
|
+
/** Take the focus from whatever held it; the painter shows where it is. */ focus() {
|
|
138
|
+
if (doc.activeElement && doc.activeElement != this) {
|
|
139
|
+
doc.activeElement.blur();
|
|
140
|
+
}
|
|
141
|
+
doc.activeElement = this;
|
|
142
|
+
// Text typed over in place takes the caret at its end, where a browser
|
|
143
|
+
// page puts it (a terminal has no selection to put it by).
|
|
144
|
+
if (this.isContentEditable) {
|
|
145
|
+
this.selectionStart = this.selectionEnd = this.textContent.length;
|
|
146
|
+
}
|
|
147
|
+
if (this.matches('input,textarea') || this.isContentEditable) {
|
|
148
|
+
this.setAttribute('data-caret', this.selectionStart);
|
|
149
|
+
}
|
|
150
|
+
this.dispatchEvent(new Event('focus'));
|
|
151
|
+
this.dispatchEvent(new Event('focusin', {
|
|
152
|
+
bubbles: true
|
|
153
|
+
}));
|
|
154
|
+
touch();
|
|
155
|
+
}
|
|
156
|
+
blur() {
|
|
157
|
+
let held = doc.activeElement == this;
|
|
158
|
+
if (held) doc.activeElement = null;
|
|
159
|
+
this.removeAttribute('data-caret');
|
|
160
|
+
this.dispatchEvent(new Event('blur'));
|
|
161
|
+
if (held) this.dispatchEvent(new Event('focusout', {
|
|
162
|
+
bubbles: true
|
|
163
|
+
}));
|
|
164
|
+
touch();
|
|
165
|
+
}
|
|
166
|
+
/** Press it, as a primary-button click does: a check box flips and a
|
|
167
|
+
* radio turns on (back again when a listener cancels the click, else
|
|
168
|
+
* telling its `input` and `change`), a submit button submits its form, a
|
|
169
|
+
* `details`' summary opens or closes it, and a link no listener took is
|
|
170
|
+
* followed (`onNavigate`). */ click() {
|
|
171
|
+
let mark = this.matches('input') && this.attr('type');
|
|
172
|
+
let was = this.checked;
|
|
173
|
+
let group = mark == 'radio' ? radios(this) : [];
|
|
174
|
+
let on = group.find((r)=>r.checked);
|
|
175
|
+
if (mark == 'checkbox') this.checked = !was;
|
|
176
|
+
if (mark == 'radio') {
|
|
177
|
+
for (let r of group)r.checked = false;
|
|
178
|
+
this.checked = true;
|
|
179
|
+
}
|
|
180
|
+
let e = Object.assign(new Event('click', {
|
|
181
|
+
bubbles: true,
|
|
182
|
+
cancelable: true
|
|
183
|
+
}), {
|
|
184
|
+
button: 0,
|
|
185
|
+
detail: 0,
|
|
186
|
+
metaKey: false,
|
|
187
|
+
ctrlKey: false,
|
|
188
|
+
shiftKey: false,
|
|
189
|
+
altKey: false
|
|
190
|
+
});
|
|
191
|
+
let taken = dispatch(this, e);
|
|
192
|
+
if (mark == 'checkbox' || mark == 'radio') {
|
|
193
|
+
if (!taken) {
|
|
194
|
+
this.checked = was;
|
|
195
|
+
if (on) on.checked = true;
|
|
196
|
+
} else if (this.checked != was) {
|
|
197
|
+
for (let type of [
|
|
198
|
+
'input',
|
|
199
|
+
'change'
|
|
200
|
+
]){
|
|
201
|
+
dispatch(this, new Event(type, {
|
|
202
|
+
bubbles: true
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (!taken) return;
|
|
208
|
+
let details = this.localName == 'summary' && this.parentNode;
|
|
209
|
+
if (details && details.localName == 'details') {
|
|
210
|
+
if (details.hasAttribute('open')) details.removeAttribute('open');
|
|
211
|
+
else details.setAttribute('open', '');
|
|
212
|
+
}
|
|
213
|
+
let form = submits(this) && this.closest('form');
|
|
214
|
+
if (form) {
|
|
215
|
+
dispatch(form, new Event('submit', {
|
|
216
|
+
bubbles: true,
|
|
217
|
+
cancelable: true
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
let href = this.closest('a')?.attr('href') ?? this.attr('data-href');
|
|
221
|
+
if (href) follow(href);
|
|
222
|
+
}
|
|
223
|
+
/** Keep it in sight: the scroll region around it shows it on the next
|
|
224
|
+
* paint, until another element asks. */ scrollIntoView() {
|
|
225
|
+
if (revealed == this) return;
|
|
226
|
+
revealed?.removeAttribute('reveal');
|
|
227
|
+
revealed = this;
|
|
228
|
+
this.setAttribute('reveal', '');
|
|
229
|
+
}
|
|
230
|
+
/** Where the last paint put it, in cells: every cell it or anything inside
|
|
231
|
+
* it painted. Nothing painted, out of a window's sight or hidden, is an
|
|
232
|
+
* empty box at the origin. */ getBoundingClientRect() {
|
|
233
|
+
let at;
|
|
234
|
+
let add = (n)=>{
|
|
235
|
+
let b = placed.get(n);
|
|
236
|
+
if (b) at = at ? union(at, b) : b;
|
|
237
|
+
for (let k of n.childNodes)if (k instanceof TElement) add(k);
|
|
238
|
+
};
|
|
239
|
+
add(this);
|
|
240
|
+
let { left, top, right, bottom } = at ?? none;
|
|
241
|
+
return {
|
|
242
|
+
left,
|
|
243
|
+
top,
|
|
244
|
+
right,
|
|
245
|
+
bottom,
|
|
246
|
+
x: left,
|
|
247
|
+
y: top,
|
|
248
|
+
width: right - left,
|
|
249
|
+
height: bottom - top
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/** Whether it shows: false where the last paint's sheet hid it or what
|
|
253
|
+
* holds it, true out of a window's sight. */ checkVisibility() {
|
|
254
|
+
return !hidden.has(this) && (this.parentNode?.checkVisibility() ?? true);
|
|
255
|
+
}
|
|
256
|
+
setSelectionRange(start, end) {
|
|
257
|
+
this.selectionStart = start;
|
|
258
|
+
this.selectionEnd = end;
|
|
259
|
+
if (doc.activeElement == this) this.setAttribute('data-caret', start);
|
|
260
|
+
}
|
|
261
|
+
/** DOM node type, as Preact expects to read it. */ nodeType;
|
|
262
|
+
/** Children in document order. */ childNodes;
|
|
263
|
+
/** The element children in document order. */ get children() {
|
|
264
|
+
return this.childNodes.filter((node)=>node instanceof TElement);
|
|
265
|
+
}
|
|
266
|
+
/** Present because Preact writes to it, a custom property through
|
|
267
|
+
* `setProperty`; the painter reads none of it. */ style;
|
|
268
|
+
get textContent() {
|
|
269
|
+
return this.childNodes.map((n)=>n instanceof TText ? n.data : n.textContent).join('');
|
|
270
|
+
}
|
|
271
|
+
/** Its children become one text node holding `text`, or none. */ set textContent(text) {
|
|
272
|
+
for (let n of this.childNodes)n.parentNode = null;
|
|
273
|
+
this.childNodes = [];
|
|
274
|
+
if (text) this.appendChild(new TText(text));
|
|
275
|
+
touch();
|
|
276
|
+
}
|
|
277
|
+
getAttribute(k) {
|
|
278
|
+
return this.attr(k.toLowerCase()) ?? null;
|
|
279
|
+
}
|
|
280
|
+
hasAttribute(k) {
|
|
281
|
+
return this.attr(k.toLowerCase()) != null;
|
|
282
|
+
}
|
|
283
|
+
get tagName() {
|
|
284
|
+
return this.localName.toUpperCase();
|
|
285
|
+
}
|
|
286
|
+
get parentElement() {
|
|
287
|
+
return this.parentNode;
|
|
288
|
+
}
|
|
289
|
+
/** `contenteditable`, as a browser's element reads and sets it. */ get contentEditable() {
|
|
290
|
+
return this.attr('contenteditable') ?? 'inherit';
|
|
291
|
+
}
|
|
292
|
+
set contentEditable(v) {
|
|
293
|
+
if (v == 'inherit') this.removeAttribute('contenteditable');
|
|
294
|
+
else this.setAttribute('contenteditable', v);
|
|
295
|
+
}
|
|
296
|
+
/** Whether it is typed into in place: its own `contenteditable`, or its
|
|
297
|
+
* parent's. */ get isContentEditable() {
|
|
298
|
+
let v = this.attr('contenteditable');
|
|
299
|
+
return v == null || v == 'inherit' ? !!this.parentNode?.isContentEditable : v != 'false';
|
|
300
|
+
}
|
|
301
|
+
get href() {
|
|
302
|
+
return this.attr('href') ?? '';
|
|
303
|
+
}
|
|
304
|
+
get target() {
|
|
305
|
+
return this.attr('target') ?? '';
|
|
306
|
+
}
|
|
307
|
+
contains(n) {
|
|
308
|
+
for(; n; n = n.parentNode)if (n == this) return true;
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
matches(selector) {
|
|
312
|
+
return selector.split(',').some((s)=>{
|
|
313
|
+
s = s.trim();
|
|
314
|
+
let m = s.match(/^([\w-]+)?(?:\[([\w-]+)(?:=["']?([^"'\]]+)["']?)?\])?$/);
|
|
315
|
+
if (m && (m[1] || m[2])) {
|
|
316
|
+
return (!m[1] || m[1] == this.localName) && (!m[2] || (m[3] == null ? this.hasAttribute(m[2]) : this.attr(m[2]) == m[3]));
|
|
317
|
+
}
|
|
318
|
+
if (s.startsWith('.')) {
|
|
319
|
+
return this.className.split(' ').includes(s.slice(1));
|
|
320
|
+
}
|
|
321
|
+
if (s.startsWith('#')) return this.attr('id') == s.slice(1);
|
|
322
|
+
return s == '*';
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
closest(selector) {
|
|
326
|
+
return this.matches(selector) ? this : this.parentNode?.closest(selector) ?? null;
|
|
327
|
+
}
|
|
328
|
+
querySelectorAll(selector) {
|
|
329
|
+
return this.childNodes.filter((n)=>n instanceof TElement).flatMap((n)=>{
|
|
330
|
+
let el = n;
|
|
331
|
+
return [
|
|
332
|
+
...el.matches(selector) ? [
|
|
333
|
+
el
|
|
334
|
+
] : [],
|
|
335
|
+
...el.querySelectorAll(selector)
|
|
336
|
+
];
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
querySelector(selector) {
|
|
340
|
+
return this.querySelectorAll(selector)[0] ?? null;
|
|
341
|
+
}
|
|
342
|
+
dispatchEvent(event) {
|
|
343
|
+
return dispatch(this, event);
|
|
344
|
+
}
|
|
345
|
+
attrs;
|
|
346
|
+
handlers;
|
|
347
|
+
listeners;
|
|
348
|
+
constructor(localName){
|
|
349
|
+
super(), this.localName = localName, this.onwheel = null, this.onclick = null, this.onmousedown = null, this.onmouseup = null, this.onmousemove = null, this.oninput = null, this.onchange = null, this.onkeydown = null, this.onsubmit = null, this.onfocus = null, this.onblur = null, this.onselect = null, this.onkeyup = null, this.ondblclick = null, this.oncancel = null, this.selectionStart = 0, this.selectionEnd = 0, this.nodeType = 1, this.childNodes = [], this.style = {
|
|
350
|
+
setProperty (k, v) {
|
|
351
|
+
this[k] = v;
|
|
352
|
+
}
|
|
353
|
+
}, this.attrs = new Map(), this.handlers = new Map(), this.listeners = new Map();
|
|
354
|
+
}
|
|
355
|
+
/** The first child, or null. */ get firstChild() {
|
|
356
|
+
return this.childNodes[0] ?? null;
|
|
357
|
+
}
|
|
358
|
+
/** Read one attribute; undefined when unset. */ attr(k) {
|
|
359
|
+
return this.attrs.get(k);
|
|
360
|
+
}
|
|
361
|
+
/** The names of the attributes it has, as a browser lists them. */ getAttributeNames() {
|
|
362
|
+
return [
|
|
363
|
+
...this.attrs.keys()
|
|
364
|
+
];
|
|
365
|
+
}
|
|
366
|
+
/** The class attribute, as Preact names it. */ get className() {
|
|
367
|
+
return this.attrs.get('class') ?? '';
|
|
368
|
+
}
|
|
369
|
+
set className(v) {
|
|
370
|
+
this.setAttribute('class', v);
|
|
371
|
+
}
|
|
372
|
+
/** Append a child; it is returned, as a browser returns it. */ appendChild(c) {
|
|
373
|
+
return this.insertBefore(c, null);
|
|
374
|
+
}
|
|
375
|
+
/** Insert a child before `ref`, or at the end when ref is null. */ insertBefore(c, ref) {
|
|
376
|
+
c.parentNode?.removeChild(c);
|
|
377
|
+
let i = ref ? this.childNodes.indexOf(ref) : -1;
|
|
378
|
+
this.childNodes.splice(i < 0 ? this.childNodes.length : i, 0, c);
|
|
379
|
+
c.parentNode = this;
|
|
380
|
+
touch();
|
|
381
|
+
return c;
|
|
382
|
+
}
|
|
383
|
+
/** Remove a child. */ removeChild(c) {
|
|
384
|
+
let i = this.childNodes.indexOf(c);
|
|
385
|
+
if (i >= 0) this.childNodes.splice(i, 1);
|
|
386
|
+
c.parentNode = null;
|
|
387
|
+
touch();
|
|
388
|
+
}
|
|
389
|
+
/** Set an attribute; its name lowercased and its value stringified, as an
|
|
390
|
+
* HTML document does (Preact writes `tabIndex`, a selector reads
|
|
391
|
+
* `[tabindex]`). */ setAttribute(k, v) {
|
|
392
|
+
this.attrs.set(k.toLowerCase(), String(v));
|
|
393
|
+
touch();
|
|
394
|
+
}
|
|
395
|
+
/** Remove an attribute. */ removeAttribute(k) {
|
|
396
|
+
this.attrs.delete(k.toLowerCase());
|
|
397
|
+
touch();
|
|
398
|
+
}
|
|
399
|
+
/** Record a listener. Pointer events bubble here; keys go through `screen`. */ addEventListener(t, fn) {
|
|
400
|
+
let set = this.listeners.get(t) ?? new Set();
|
|
401
|
+
set.add(fn);
|
|
402
|
+
this.listeners.set(t, set);
|
|
403
|
+
this.handlers.set(t, (e)=>{
|
|
404
|
+
let consumed = false;
|
|
405
|
+
for (let handler of [
|
|
406
|
+
...this.listeners.get(t) ?? []
|
|
407
|
+
].reverse()){
|
|
408
|
+
if (handler.call(this, e) === true) consumed = true;
|
|
409
|
+
if (e.cancelBubble) break;
|
|
410
|
+
}
|
|
411
|
+
return consumed;
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/** Forget a listener. */ removeEventListener(t, fn) {
|
|
415
|
+
if (fn) this.listeners.get(t)?.delete(fn);
|
|
416
|
+
else this.listeners.delete(t);
|
|
417
|
+
if (!this.listeners.get(t)?.size) this.handlers.delete(t);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// The radios a radio turns off when it turns on: those of its name in its
|
|
421
|
+
// form, or under the same root when it has none.
|
|
422
|
+
let radios = (el)=>{
|
|
423
|
+
let name = el.attr('name');
|
|
424
|
+
if (!name) return [
|
|
425
|
+
el
|
|
426
|
+
];
|
|
427
|
+
let top = el;
|
|
428
|
+
while(top.parentNode && top.localName != 'form')top = top.parentNode;
|
|
429
|
+
return top.querySelectorAll('input').filter((r)=>r.attr('type') == 'radio' && r.attr('name') == name);
|
|
430
|
+
};
|
|
431
|
+
// Whether pressing it submits its form, as a browser's button does.
|
|
432
|
+
let submits = (el)=>el.attr('disabled') == null && (el.localName == 'button' && (el.attr('type') ?? 'submit') == 'submit' || el.matches('input') && el.attr('type') == 'submit');
|
|
433
|
+
/** Deliver DOM events through capture, target, bubble and the host window. */ export let dispatch = (target, event)=>{
|
|
434
|
+
Object.defineProperty(event, 'target', {
|
|
435
|
+
value: target,
|
|
436
|
+
configurable: true
|
|
437
|
+
});
|
|
438
|
+
let path = [];
|
|
439
|
+
for(let n = target; n; n = n.parentNode)path.push(n);
|
|
440
|
+
let call = (node, capture = false)=>{
|
|
441
|
+
Object.defineProperty(event, 'currentTarget', {
|
|
442
|
+
value: node,
|
|
443
|
+
configurable: true
|
|
444
|
+
});
|
|
445
|
+
let handler = node.handlers.get(event.type + (capture ? 'Capture' : ''));
|
|
446
|
+
if (typeof handler == 'function') handler.call(node, event);
|
|
447
|
+
};
|
|
448
|
+
for (let n of [
|
|
449
|
+
...path
|
|
450
|
+
].reverse()){
|
|
451
|
+
call(n, true);
|
|
452
|
+
if (event.cancelBubble) return !event.defaultPrevented;
|
|
453
|
+
}
|
|
454
|
+
for (let n of path){
|
|
455
|
+
call(n);
|
|
456
|
+
if (event.cancelBubble) return !event.defaultPrevented;
|
|
457
|
+
}
|
|
458
|
+
Object.defineProperty(event, 'currentTarget', {
|
|
459
|
+
value: null,
|
|
460
|
+
configurable: true
|
|
461
|
+
});
|
|
462
|
+
globalThis.dispatchEvent(event);
|
|
463
|
+
return !event.defaultPrevented;
|
|
464
|
+
};
|
|
465
|
+
/** The document Preact reaches for globally, over these node types. */ export let doc = {
|
|
466
|
+
createElement: (t)=>new TElement(t),
|
|
467
|
+
createElementNS: (_ns, t)=>new TElement(t),
|
|
468
|
+
createTextNode: (d)=>new TText(d),
|
|
469
|
+
activeElement: null,
|
|
470
|
+
addEventListener: globalThis.addEventListener.bind(globalThis),
|
|
471
|
+
removeEventListener: globalThis.removeEventListener.bind(globalThis),
|
|
472
|
+
getSelection: ()=>null,
|
|
473
|
+
querySelector: (_s)=>null
|
|
474
|
+
};
|
|
475
|
+
/** Install that document, returning a fresh render root and the restore. */ export let install = ()=>{
|
|
476
|
+
let priorElement = Object.getOwnPropertyDescriptor(globalThis, 'Element');
|
|
477
|
+
let priorHtml = Object.getOwnPropertyDescriptor(globalThis, 'HTMLElement');
|
|
478
|
+
Object.defineProperty(globalThis, 'Element', {
|
|
479
|
+
value: TElement,
|
|
480
|
+
configurable: true
|
|
481
|
+
});
|
|
482
|
+
Object.defineProperty(globalThis, 'HTMLElement', {
|
|
483
|
+
value: TElement,
|
|
484
|
+
configurable: true
|
|
485
|
+
});
|
|
486
|
+
let prior = Object.getOwnPropertyDescriptor(globalThis, 'document');
|
|
487
|
+
Object.defineProperty(globalThis, 'document', {
|
|
488
|
+
value: doc,
|
|
489
|
+
configurable: true
|
|
490
|
+
});
|
|
491
|
+
return {
|
|
492
|
+
root: new TElement('root'),
|
|
493
|
+
free: ()=>{
|
|
494
|
+
for (let [name, descriptor] of [
|
|
495
|
+
[
|
|
496
|
+
'Element',
|
|
497
|
+
priorElement
|
|
498
|
+
],
|
|
499
|
+
[
|
|
500
|
+
'HTMLElement',
|
|
501
|
+
priorHtml
|
|
502
|
+
]
|
|
503
|
+
]){
|
|
504
|
+
if (descriptor) Object.defineProperty(globalThis, name, descriptor);
|
|
505
|
+
else Reflect.deleteProperty(globalThis, name);
|
|
506
|
+
}
|
|
507
|
+
if (prior) Object.defineProperty(globalThis, 'document', prior);
|
|
508
|
+
else delete globalThis.document;
|
|
509
|
+
// The tree is gone, and with it whatever held the focus.
|
|
510
|
+
doc.activeElement = null;
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
//# sourceMappingURL=mod.js.map
|
package/mod.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sources":["./mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;CAWC,GAED,IAAI,QAAQ;EAAE,IAAI,KAAO;AAAE;AAE3B,uDAAuD,GACvD,OAAO,IAAI,UAAU,CAAC;EACpB,MAAM,EAAE,GAAG;AACb,EAAC;AAED,6EAA6E;AAC7E,6DAA6D;AAC7D,IAAI,QAAQ;AAEZ,yEAAyE,GACzE,OAAO,I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