mount-observer 0.0.90 → 0.0.92
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/MountObserver.js +5 -4
- package/MountObserver.ts +5 -4
- package/package.json +2 -2
- package/refid/hostish.js +17 -0
- package/refid/hostish.ts +18 -0
- package/ts-refs/trans-render/dss/types.d.ts +3 -0
package/MountObserver.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RootMutObs } from './RootMutObs.js';
|
|
2
2
|
import { bindish, bindishIt } from './bindish.js';
|
|
3
|
+
import 'refid/hostish.js';
|
|
3
4
|
export const guid = '5Pv6bHOVH0ae07opRZ8N/g';
|
|
4
5
|
export const wasItemReffed = Symbol.for('8aA6xB8+PkScmivaslBk5Q');
|
|
5
6
|
export const mutationObserverLookup = new WeakMap();
|
|
@@ -503,12 +504,12 @@ export class MountObserver extends EventTarget {
|
|
|
503
504
|
//getting into a catch-22 scenario frequently, blocking the code for resuming.
|
|
504
505
|
//This was observed with per-each package, demo/ScopeScript.html, clicking refresh a few times
|
|
505
506
|
//one will see the inconsistent behavior if await is added below.
|
|
506
|
-
const
|
|
507
|
-
if (
|
|
507
|
+
const idGenerators = Array.from(within.querySelectorAll('[-id]'));
|
|
508
|
+
if (idGenerators[0]) {
|
|
508
509
|
const { genIds } = await import('./refid/genIds.js');
|
|
509
|
-
for (const el of
|
|
510
|
+
for (const el of idGenerators) {
|
|
510
511
|
genIds(el);
|
|
511
|
-
el.removeAttribute('
|
|
512
|
+
el.removeAttribute('-id');
|
|
512
513
|
}
|
|
513
514
|
}
|
|
514
515
|
bindish(within, within, { assigner: this.#mountInit.assigner });
|
package/MountObserver.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {MountInit, IMountObserver, AddMutationEventListener,
|
|
|
9
9
|
} from './ts-refs/mount-observer/types';
|
|
10
10
|
import {RootMutObs} from './RootMutObs.js';
|
|
11
11
|
import {bindish, bindishIt} from './bindish.js';
|
|
12
|
+
import 'refid/hostish.js';
|
|
12
13
|
export {MOSE} from './ts-refs/mount-observer/types';
|
|
13
14
|
export const guid = '5Pv6bHOVH0ae07opRZ8N/g';
|
|
14
15
|
export const wasItemReffed = Symbol.for('8aA6xB8+PkScmivaslBk5Q');
|
|
@@ -533,12 +534,12 @@ export class MountObserver extends EventTarget implements IMountObserver{
|
|
|
533
534
|
//getting into a catch-22 scenario frequently, blocking the code for resuming.
|
|
534
535
|
//This was observed with per-each package, demo/ScopeScript.html, clicking refresh a few times
|
|
535
536
|
//one will see the inconsistent behavior if await is added below.
|
|
536
|
-
const
|
|
537
|
-
if(
|
|
537
|
+
const idGenerators = Array.from((within as DocumentFragment).querySelectorAll('[-id]'))
|
|
538
|
+
if(idGenerators[0]){
|
|
538
539
|
const {genIds} = await import('./refid/genIds.js');
|
|
539
|
-
for(const el of
|
|
540
|
+
for(const el of idGenerators){
|
|
540
541
|
genIds(el);
|
|
541
|
-
el.removeAttribute('
|
|
542
|
+
el.removeAttribute('-id');
|
|
542
543
|
}
|
|
543
544
|
}
|
|
544
545
|
bindish(within as DocumentFragment, within, {assigner: this.#mountInit.assigner});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mount-observer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.92",
|
|
4
4
|
"description": "Observe and act on css matches.",
|
|
5
5
|
"main": "MountObserver.js",
|
|
6
6
|
"module": "MountObserver.js",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@playwright/test": "1.
|
|
8
|
+
"@playwright/test": "1.55.0",
|
|
9
9
|
"ssi-server": "0.0.1"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
package/refid/hostish.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Element.prototype.hostish = async function () {
|
|
3
|
+
const closest = this.closest('[itemscope]');
|
|
4
|
+
if (closest === null)
|
|
5
|
+
return this.getRootNode().host;
|
|
6
|
+
const { localName } = closest;
|
|
7
|
+
if (localName.includes('-')) {
|
|
8
|
+
await customElements.whenDefined(localName);
|
|
9
|
+
return closest;
|
|
10
|
+
}
|
|
11
|
+
const itemScopeAttr = closest.getAttribute('itemscope');
|
|
12
|
+
if (itemScopeAttr) {
|
|
13
|
+
const { waitForIsh } = await import('mount-observer/waitForIsh.js');
|
|
14
|
+
return await waitForIsh(closest);
|
|
15
|
+
}
|
|
16
|
+
return this.getRootNode().host;
|
|
17
|
+
};
|
package/refid/hostish.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface Element{
|
|
2
|
+
hostish(): Promise<any>
|
|
3
|
+
}
|
|
4
|
+
Element.prototype.hostish = async function(){
|
|
5
|
+
const closest = this.closest('[itemscope]') as HTMLElement;
|
|
6
|
+
if(closest === null) return (<any>this.getRootNode()).host;
|
|
7
|
+
const {localName} = closest;
|
|
8
|
+
if(localName.includes('-')){
|
|
9
|
+
await customElements.whenDefined(localName);
|
|
10
|
+
return closest;
|
|
11
|
+
}
|
|
12
|
+
const itemScopeAttr = closest.getAttribute('itemscope');
|
|
13
|
+
if(itemScopeAttr){
|
|
14
|
+
const {waitForIsh} = await import('mount-observer/waitForIsh.js');
|
|
15
|
+
return await waitForIsh(closest);
|
|
16
|
+
}
|
|
17
|
+
return (<any>this.getRootNode()).host;
|
|
18
|
+
}
|
|
@@ -155,10 +155,13 @@ export interface Specifier {
|
|
|
155
155
|
|
|
156
156
|
export interface IPE {
|
|
157
157
|
id?: string,
|
|
158
|
+
prop?: string,
|
|
158
159
|
path?: SubPropPath,
|
|
159
160
|
evtName?: string,
|
|
160
161
|
as?: asOptions,
|
|
161
162
|
constVal?: any;
|
|
163
|
+
enhKey?: string;
|
|
164
|
+
ish?: boolean;
|
|
162
165
|
}
|
|
163
166
|
|
|
164
167
|
export type Modulo = 'aria-rowindex' | 'aria-colindex' | 'aria-rowindextext'
|