mount-observer 0.0.74 → 0.0.76
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/package.json +10 -2
- package/slotkin/getBreadth.js +19 -0
- package/slotkin/getBreadth.ts +21 -0
- package/slotkin/getFrag.js +22 -0
- package/slotkin/getFrag.ts +21 -0
- package/slotkin/wrap.js +2 -2
- package/slotkin/wrap.ts +2 -2
- package/ts-refs/trans-render/dss/types.d.ts +9 -0
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mount-observer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
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.53.2",
|
|
9
9
|
"ssi-server": "0.0.1"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
@@ -65,6 +65,14 @@
|
|
|
65
65
|
"default": "./slotkin/beKindred.js",
|
|
66
66
|
"types": "./slotkin/beKindred.ts"
|
|
67
67
|
},
|
|
68
|
+
"./slotkin/getBreadth.js": {
|
|
69
|
+
"default": "./slotkin/getBreadth.js",
|
|
70
|
+
"types": "./slotkin/getBreadth.ts"
|
|
71
|
+
},
|
|
72
|
+
"./slotkin/getFrag.js": {
|
|
73
|
+
"default": "./slotkin/getFrag.js",
|
|
74
|
+
"types": "./slotkin/getFrag.ts"
|
|
75
|
+
},
|
|
68
76
|
"./slotkin/wrap.js": {
|
|
69
77
|
"default": "./slotkin/wrap.js",
|
|
70
78
|
"types": "./slotkin/wrap.ts"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function getBreadth(innerEl, base) {
|
|
2
|
+
const priors = [];
|
|
3
|
+
let ps = innerEl.previousSibling;
|
|
4
|
+
while (ps !== null && !(ps.nodeType === Node.COMMENT_NODE && ps.data.includes(` ${base} `))) {
|
|
5
|
+
priors.push(ps);
|
|
6
|
+
ps = ps.previousSibling;
|
|
7
|
+
}
|
|
8
|
+
if (ps !== null)
|
|
9
|
+
priors.push(ps);
|
|
10
|
+
const nexts = [];
|
|
11
|
+
let ns = innerEl.nextSibling;
|
|
12
|
+
while (ns !== null && !(ns.nodeType === Node.COMMENT_NODE && ns.data.includes(` /${base} `))) {
|
|
13
|
+
nexts.push(ns);
|
|
14
|
+
ns = ns.nextSibling;
|
|
15
|
+
}
|
|
16
|
+
if (ns !== null)
|
|
17
|
+
nexts.push(ns);
|
|
18
|
+
return [...priors.reverse(), ...nexts];
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getBreadth(
|
|
2
|
+
innerEl: Element,
|
|
3
|
+
base: string,
|
|
4
|
+
){
|
|
5
|
+
const priors: Array<Node> = [];
|
|
6
|
+
let ps = innerEl.previousSibling as Comment | null;
|
|
7
|
+
while(ps !== null && !(ps.nodeType === Node.COMMENT_NODE && (ps as Comment).data.includes( ` ${base} `))){
|
|
8
|
+
priors.push(ps);
|
|
9
|
+
ps = ps.previousSibling as Comment | null;
|
|
10
|
+
}
|
|
11
|
+
if(ps !== null) priors.push(ps);
|
|
12
|
+
const nexts: Array<Node> = [];
|
|
13
|
+
let ns = innerEl.nextSibling as Comment | null;
|
|
14
|
+
while(ns !== null && !(ns.nodeType === Node.COMMENT_NODE && (ns as Comment).data.includes( ` /${base} `))){
|
|
15
|
+
nexts.push(ns);
|
|
16
|
+
ns = ns.nextSibling as Comment | null;
|
|
17
|
+
}
|
|
18
|
+
if(ns !== null) nexts.push(ns);
|
|
19
|
+
return [...priors.reverse(), ...nexts];
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function getFrag(templ, base) {
|
|
2
|
+
let openComment = templ.nextSibling;
|
|
3
|
+
if (openComment === null || openComment.nodeType !== Node.COMMENT_NODE)
|
|
4
|
+
return null;
|
|
5
|
+
if (base !== undefined && !openComment.data.includes(` ${base} `))
|
|
6
|
+
return null;
|
|
7
|
+
if (base === undefined) {
|
|
8
|
+
base = openComment.data.trim().split(' ')[1];
|
|
9
|
+
if (base === undefined)
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const returnArr = [openComment];
|
|
13
|
+
let ns = openComment.nextSibling;
|
|
14
|
+
while (ns !== null && !(ns.nodeType === Node.COMMENT_NODE && ns.data.includes(` /${base} `))) {
|
|
15
|
+
returnArr.push(ns);
|
|
16
|
+
ns = ns.nextSibling;
|
|
17
|
+
}
|
|
18
|
+
if (ns === null)
|
|
19
|
+
return null;
|
|
20
|
+
returnArr.push(ns);
|
|
21
|
+
return returnArr;
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getFrag(
|
|
2
|
+
templ: HTMLTemplateElement,
|
|
3
|
+
base?: string,
|
|
4
|
+
){
|
|
5
|
+
let openComment = templ.nextSibling as Comment | null;
|
|
6
|
+
if(openComment === null || openComment.nodeType !== Node.COMMENT_NODE) return null;
|
|
7
|
+
if(base !== undefined && !openComment.data.includes(` ${base} `)) return null;
|
|
8
|
+
if(base === undefined){
|
|
9
|
+
base = openComment.data.trim().split(' ')[1];
|
|
10
|
+
if(base === undefined) return null;
|
|
11
|
+
}
|
|
12
|
+
const returnArr: Array<Node> = [openComment];
|
|
13
|
+
let ns = openComment.nextSibling;
|
|
14
|
+
while(ns !== null && !(ns.nodeType === Node.COMMENT_NODE && (ns as Comment).data.includes( ` /${base} `))){
|
|
15
|
+
returnArr.push(ns);
|
|
16
|
+
ns = ns.nextSibling;
|
|
17
|
+
}
|
|
18
|
+
if(ns === null) return null;
|
|
19
|
+
returnArr.push(ns);
|
|
20
|
+
return returnArr;
|
|
21
|
+
}
|
package/slotkin/wrap.js
CHANGED
|
@@ -4,9 +4,9 @@ export function wrap(templ, base, force = false) {
|
|
|
4
4
|
if (!wasWrapped) {
|
|
5
5
|
templ[wrapped] = base;
|
|
6
6
|
if (force || templ.content.childElementCount > 1) {
|
|
7
|
-
const start = document.createComment(base);
|
|
7
|
+
const start = document.createComment(` ${base} `);
|
|
8
8
|
templ.content.prepend(start);
|
|
9
|
-
const end = document.createComment(
|
|
9
|
+
const end = document.createComment(` /${base} `);
|
|
10
10
|
templ.content.appendChild(end);
|
|
11
11
|
}
|
|
12
12
|
}
|
package/slotkin/wrap.ts
CHANGED
|
@@ -9,9 +9,9 @@ export function wrap(
|
|
|
9
9
|
if (!wasWrapped) {
|
|
10
10
|
(<any>templ)[wrapped] = base;
|
|
11
11
|
if (force || templ.content.childElementCount > 1) {
|
|
12
|
-
const start = document.createComment(base);
|
|
12
|
+
const start = document.createComment(` ${base} `);
|
|
13
13
|
templ.content.prepend(start);
|
|
14
|
-
const end = document.createComment(
|
|
14
|
+
const end = document.createComment(` /${base} `);
|
|
15
15
|
templ.content.appendChild(end);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -29,6 +29,10 @@ export type DirectionalScopeSigils =
|
|
|
29
29
|
* itemscoped host
|
|
30
30
|
*/
|
|
31
31
|
|'$'
|
|
32
|
+
/**
|
|
33
|
+
* comment scope
|
|
34
|
+
*/
|
|
35
|
+
|'/**/'
|
|
32
36
|
;
|
|
33
37
|
|
|
34
38
|
export type AttrSigils =
|
|
@@ -129,6 +133,11 @@ export interface Specifier {
|
|
|
129
133
|
*/
|
|
130
134
|
modulo?: Modulo;
|
|
131
135
|
|
|
136
|
+
/**
|
|
137
|
+
* is a scope query within comments
|
|
138
|
+
*/
|
|
139
|
+
cmtWrap?: boolean;
|
|
140
|
+
|
|
132
141
|
/**
|
|
133
142
|
* itemscope hierarchy domain specifier
|
|
134
143
|
*/
|