mount-observer 0.0.98 → 0.0.100
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mount-observer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"description": "Observe and act on css matches.",
|
|
5
5
|
"main": "MountObserver.js",
|
|
6
6
|
"module": "MountObserver.js",
|
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
"default": "./refid/joinMatching.js",
|
|
70
70
|
"types": "./refid/joinMatching.ts"
|
|
71
71
|
},
|
|
72
|
+
"./refid/nudge.js": {
|
|
73
|
+
"default": "./refid/nudge.js",
|
|
74
|
+
"types": "./refid/nudge.ts"
|
|
75
|
+
},
|
|
72
76
|
"./refid/refs.js": {
|
|
73
77
|
"default": "./refid/refs.js",
|
|
74
78
|
"types": "./refid/refs.ts"
|
package/refid/genIds.js
CHANGED
|
@@ -20,7 +20,10 @@ export function genIds(enhancedElement) {
|
|
|
20
20
|
// if(parentElement === null) throw 404;
|
|
21
21
|
const scopeFragment = (enhancedElement.closest(scopeMatches) || enhancedElement.getRootNode());
|
|
22
22
|
//first find all elements with attribute #
|
|
23
|
-
const
|
|
23
|
+
const hashTest = '[\\#]';
|
|
24
|
+
const hashIds = Array.from(scopeFragment.querySelectorAll(hashTest)).filter(x => inScope(scopeFragment, x));
|
|
25
|
+
if (scopeFragment instanceof Element && scopeFragment.matches(hashTest))
|
|
26
|
+
hashIds.push(scopeFragment);
|
|
24
27
|
const uniqueCheck = new Set();
|
|
25
28
|
for (const hi of hashIds) {
|
|
26
29
|
if (!(hi instanceof HTMLElement))
|
|
@@ -38,7 +41,10 @@ export function genIds(enhancedElement) {
|
|
|
38
41
|
hi.removeAttribute('#');
|
|
39
42
|
}
|
|
40
43
|
//now find all elements with attribute @
|
|
41
|
-
const
|
|
44
|
+
const nameTest = '[name]:not([name=""])[\\@]';
|
|
45
|
+
const names = Array.from(scopeFragment.querySelectorAll(nameTest)).filter(x => inScope(scopeFragment, x));
|
|
46
|
+
if (scopeFragment instanceof Element && scopeFragment.matches(nameTest))
|
|
47
|
+
names.push(scopeFragment);
|
|
42
48
|
for (const nameEl of names) {
|
|
43
49
|
if (!(nameEl instanceof HTMLElement))
|
|
44
50
|
continue;
|
|
@@ -55,7 +61,10 @@ export function genIds(enhancedElement) {
|
|
|
55
61
|
nameEl.removeAttribute('@');
|
|
56
62
|
}
|
|
57
63
|
//now find all elements with attribute |
|
|
58
|
-
const
|
|
64
|
+
const itemScopeTest = '[itemprop]:not([itemprop=""])[\\|]';
|
|
65
|
+
const itemprops = Array.from(scopeFragment.querySelectorAll(itemScopeTest)).filter(x => inScope(scopeFragment, x));
|
|
66
|
+
if (scopeFragment instanceof Element && scopeFragment.matches(itemScopeTest))
|
|
67
|
+
itemprops.push(scopeFragment);
|
|
59
68
|
for (const itempropEl of itemprops) {
|
|
60
69
|
if (!(itempropEl instanceof HTMLElement))
|
|
61
70
|
continue;
|
|
@@ -71,7 +80,10 @@ export function genIds(enhancedElement) {
|
|
|
71
80
|
itempropEl.dataset.id = `{{${sideEffects}${val}}}`;
|
|
72
81
|
itempropEl.removeAttribute('|');
|
|
73
82
|
}
|
|
74
|
-
const
|
|
83
|
+
const dataIdTest = '[data-id^="{{"][data-id$="}}"]';
|
|
84
|
+
const dataIds = Array.from(scopeFragment.querySelectorAll(dataIdTest)).filter(x => inScope(scopeFragment, x));
|
|
85
|
+
if (scopeFragment instanceof Element && scopeFragment.matches(dataIdTest))
|
|
86
|
+
dataIds.push(scopeFragment);
|
|
75
87
|
const ids = [];
|
|
76
88
|
for (const di of dataIds) {
|
|
77
89
|
if (!(di instanceof HTMLElement))
|
package/refid/genIds.ts
CHANGED
|
@@ -22,7 +22,9 @@ export function genIds(enhancedElement: Element){
|
|
|
22
22
|
const scopeFragment = (enhancedElement.closest(scopeMatches) || enhancedElement.getRootNode()) as DocumentFragment | Element;
|
|
23
23
|
|
|
24
24
|
//first find all elements with attribute #
|
|
25
|
-
const
|
|
25
|
+
const hashTest = '[\\#]';
|
|
26
|
+
const hashIds = Array.from(scopeFragment.querySelectorAll(hashTest)).filter(x => inScope(scopeFragment, x));
|
|
27
|
+
if(scopeFragment instanceof Element && scopeFragment.matches(hashTest)) hashIds.push(scopeFragment);
|
|
26
28
|
const uniqueCheck = new Set();
|
|
27
29
|
for(const hi of hashIds){
|
|
28
30
|
if(!(hi instanceof HTMLElement)) continue;
|
|
@@ -39,7 +41,9 @@ export function genIds(enhancedElement: Element){
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
//now find all elements with attribute @
|
|
42
|
-
const
|
|
44
|
+
const nameTest = '[name]:not([name=""])[\\@]';
|
|
45
|
+
const names = Array.from(scopeFragment.querySelectorAll(nameTest)).filter(x => inScope(scopeFragment, x));
|
|
46
|
+
if(scopeFragment instanceof Element && scopeFragment.matches(nameTest)) names.push(scopeFragment);
|
|
43
47
|
for(const nameEl of names){
|
|
44
48
|
if(!(nameEl instanceof HTMLElement)) continue;
|
|
45
49
|
const val = nameEl.getAttribute('name');
|
|
@@ -55,7 +59,9 @@ export function genIds(enhancedElement: Element){
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
//now find all elements with attribute |
|
|
58
|
-
const
|
|
62
|
+
const itemScopeTest = '[itemprop]:not([itemprop=""])[\\|]';
|
|
63
|
+
const itemprops = Array.from(scopeFragment.querySelectorAll(itemScopeTest)).filter(x => inScope(scopeFragment, x));
|
|
64
|
+
if(scopeFragment instanceof Element && scopeFragment.matches(itemScopeTest)) itemprops.push(scopeFragment);
|
|
59
65
|
for(const itempropEl of itemprops){
|
|
60
66
|
if(!(itempropEl instanceof HTMLElement)) continue;
|
|
61
67
|
const val = itempropEl.getAttribute('itemprop');
|
|
@@ -69,8 +75,9 @@ export function genIds(enhancedElement: Element){
|
|
|
69
75
|
itempropEl.dataset.id = `{{${sideEffects}${val}}}`;
|
|
70
76
|
itempropEl.removeAttribute('|');
|
|
71
77
|
}
|
|
72
|
-
|
|
73
|
-
const dataIds = Array.from(scopeFragment.querySelectorAll(
|
|
78
|
+
const dataIdTest = '[data-id^="{{"][data-id$="}}"]';
|
|
79
|
+
const dataIds = Array.from(scopeFragment.querySelectorAll(dataIdTest)).filter(x => inScope(scopeFragment, x));
|
|
80
|
+
if(scopeFragment instanceof Element && scopeFragment.matches(dataIdTest)) dataIds.push(scopeFragment);
|
|
74
81
|
const ids: Array<string> = [];
|
|
75
82
|
for(const di of dataIds){
|
|
76
83
|
if(!(di instanceof HTMLElement)) continue;
|
|
@@ -83,6 +90,7 @@ export function genIds(enhancedElement: Element){
|
|
|
83
90
|
ids.push(id);
|
|
84
91
|
}
|
|
85
92
|
if(ids.length === 0) return;
|
|
93
|
+
|
|
86
94
|
const allChildren = Array.from(scopeFragment.querySelectorAll('*')).filter(x => inScope(scopeFragment, x));
|
|
87
95
|
if(scopeFragment instanceof Element) allChildren.push(scopeFragment);
|
|
88
96
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps} from '../trans-render/be/types';
|
|
2
|
+
import { Specifier } from '../trans-render/dss/types';
|
|
3
|
+
|
|
4
|
+
export interface EndUserProps extends IEnhancement{}
|
|
5
|
+
|
|
6
|
+
export interface AP extends EndUserProps{
|
|
7
|
+
parsedStatements: Array<IncParameters>,
|
|
8
|
+
rawStatements: Array<string>,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type AllProps = AP;
|
|
12
|
+
|
|
13
|
+
export type PAP = Partial<AP>;
|
|
14
|
+
|
|
15
|
+
export type ProPAP = Promise<PAP>
|
|
16
|
+
|
|
17
|
+
export type BAP = AP & BEAllProps;
|
|
18
|
+
|
|
19
|
+
export interface Actions{
|
|
20
|
+
hydrate(self: BAP & BEAllProps): ProPAP;
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IncParameters {
|
|
25
|
+
targetSpecifier: Specifier,
|
|
26
|
+
sourceSpecifier: Specifier,
|
|
27
|
+
localEventType?: string,
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps} from '../trans-render/be/types';
|
|
2
|
+
import { Specifier } from '../trans-render/dss/types';
|
|
3
|
+
|
|
4
|
+
export interface EndUserProps extends IEnhancement{
|
|
5
|
+
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AP extends EndUserProps{
|
|
9
|
+
parsedStatements: Array<InvokingParameters>,
|
|
10
|
+
rawStatements: Array<string>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type AllProps = AP;
|
|
14
|
+
|
|
15
|
+
export type PAP = Partial<AP>;
|
|
16
|
+
|
|
17
|
+
export type ProPAP = Promise<PAP>
|
|
18
|
+
|
|
19
|
+
export type BAP = AP & BEAllProps;
|
|
20
|
+
|
|
21
|
+
export interface Actions{
|
|
22
|
+
hydrate(self: this): ProPAP;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface InvokingParameters {
|
|
26
|
+
remoteSpecifier: Specifier,
|
|
27
|
+
localEventType?: string,
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {IEnhancement, BEAllProps} from '../trans-render/be/types';
|
|
2
|
+
import { Specifier } from '../trans-render/dss/types';
|
|
3
|
+
|
|
4
|
+
export interface EndUserProps extends IEnhancement{}
|
|
5
|
+
|
|
6
|
+
export interface AP extends EndUserProps{
|
|
7
|
+
parsedStatements: Array<TogglingParameters>,
|
|
8
|
+
rawStatements: Array<string>,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type AllProps = AP;
|
|
12
|
+
|
|
13
|
+
export type PAP = Partial<AP>;
|
|
14
|
+
|
|
15
|
+
export type ProPAP = Promise<PAP>
|
|
16
|
+
|
|
17
|
+
export type BAP = AP & BEAllProps;
|
|
18
|
+
|
|
19
|
+
export interface Actions{
|
|
20
|
+
hydrate(self: BAP & BEAllProps): ProPAP;
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TogglingParameters {
|
|
25
|
+
remoteSpecifier: Specifier,
|
|
26
|
+
localEventType?: string,
|
|
27
|
+
}
|
|
@@ -5,6 +5,8 @@ export type Target = ID | Host | Hostish;
|
|
|
5
5
|
|
|
6
6
|
export type MindReadProp = ``;
|
|
7
7
|
export type PropPath = `?.${string}`;
|
|
8
|
+
|
|
9
|
+
export type Prop = string;
|
|
8
10
|
export type ConstVal = `\`${string}\``;
|
|
9
11
|
|
|
10
12
|
export type asOptions =
|
|
@@ -19,7 +21,7 @@ export type asOptions =
|
|
|
19
21
|
export type MindReadType = ``;
|
|
20
22
|
export type TypeQualifier = `-as-${asOptions}`;
|
|
21
23
|
|
|
22
|
-
export type ValExpression = `${PropPath | ConstVal | MindReadProp}${TypeQualifier | MindReadType}`;
|
|
24
|
+
export type ValExpression = `${Prop | PropPath | ConstVal | MindReadProp}${TypeQualifier | MindReadType}`;
|
|
23
25
|
|
|
24
26
|
export type MindReadEvent = ``;
|
|
25
27
|
|