mount-observer 0.0.93 → 0.0.94

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.93",
3
+ "version": "0.0.94",
4
4
  "description": "Observe and act on css matches.",
5
5
  "main": "MountObserver.js",
6
6
  "module": "MountObserver.js",
@@ -57,6 +57,10 @@
57
57
  "default": "./refid/getAdjRefs.js",
58
58
  "types": "./refid/getAdjRefs.ts"
59
59
  },
60
+ "./refid/getCount.js": {
61
+ "default": "./refid/getCount.js",
62
+ "types": "./refid/getCount.ts"
63
+ },
60
64
  "./refid/joinMatching.js": {
61
65
  "default": "./refid/joinMatching.js",
62
66
  "types": "./refid/joinMatching.ts"
package/refid/hostish.js CHANGED
@@ -4,14 +4,14 @@ Element.prototype.hostish = async function () {
4
4
  if (closest === null)
5
5
  return this.getRootNode().host;
6
6
  const { localName } = closest;
7
- if (localName.includes('-')) {
8
- await customElements.whenDefined(localName);
9
- return closest;
10
- }
11
7
  const itemScopeAttr = closest.getAttribute('itemscope');
12
8
  if (itemScopeAttr) {
13
9
  const { waitForIsh } = await import('mount-observer/waitForIsh.js');
14
10
  return await waitForIsh(closest);
15
11
  }
12
+ if (localName.includes('-')) {
13
+ await customElements.whenDefined(localName);
14
+ return closest;
15
+ }
16
16
  return this.getRootNode().host;
17
17
  };
package/refid/hostish.ts CHANGED
@@ -5,14 +5,15 @@ Element.prototype.hostish = async function(){
5
5
  const closest = this.closest('[itemscope]') as HTMLElement;
6
6
  if(closest === null) return (<any>this.getRootNode()).host;
7
7
  const {localName} = closest;
8
- if(localName.includes('-')){
9
- await customElements.whenDefined(localName);
10
- return closest;
11
- }
12
8
  const itemScopeAttr = closest.getAttribute('itemscope');
13
9
  if(itemScopeAttr){
14
10
  const {waitForIsh} = await import('mount-observer/waitForIsh.js');
15
11
  return await waitForIsh(closest);
16
12
  }
13
+ if(localName.includes('-')){
14
+ await customElements.whenDefined(localName);
15
+ return closest;
16
+ }
17
+
17
18
  return (<any>this.getRootNode()).host;
18
19
  }
@@ -6,6 +6,10 @@ import {BEAllProps, EMC, IEnhancement} from '../trans-render/be/types';
6
6
  //import { Propagator } from "../trans-render/froop/PropSvc";
7
7
  import {IPE, Specifier} from '../trans-render/dss/types';
8
8
 
9
+ export interface Element{
10
+ hostish(): Promise<any>
11
+ }
12
+
9
13
  export interface EndUserProps extends IEnhancement<HTMLTemplateElement>{
10
14
  lhs?: any,
11
15
  rhs?: any,
@@ -1,55 +1,14 @@
1
1
  import { Scope } from '../lib/types'
2
2
  import { CSSQuery } from '../types';
3
3
 
4
- export type DSS = string;
4
+ export type ID = `#${string}`;
5
+ export type Host = `:host()`;
6
+ export type Hostish = ``;
7
+ export type Target = ID | Host | Hostish;
5
8
 
6
- export type DirectionalScopeSigils =
7
- /**
8
- * upward direction, non recursive
9
- */
10
- |'^'
11
- /**
12
- * downward direction, next element siblings only
13
- */
14
- |'Y'
15
- /**
16
- * IdRef query
17
- *
18
- */
19
- |'?'
20
- /**
21
- * self
22
- */
23
- |'.'
24
- /**
25
- * modulo
26
- */
27
- |'%'
28
- /**
29
- * itemscoped host
30
- */
31
- |'$'
32
- /**
33
- * comment scope
34
- */
35
- |'/**/'
36
- ;
37
-
38
- export type AttrSigils =
39
- /**
40
- * Reference to self / local element
41
- */
42
- '$0' |
43
- /**
44
- * Reference by ID
45
- */
46
- '#' | '@' | '-' | '|' | '%';
47
-
48
- export type ElementSigils = '/' | '~';
49
-
50
- export type ScopeSigils = '';
51
-
52
- export type Sigils = AttrSigils | ElementSigils | ScopeSigils;
9
+ export type MindReadProp = ``;
10
+ export type PropPath = `?.${string}`;
11
+ export type ConstVal = `\`${string}\``;
53
12
 
54
13
  export type asOptions =
55
14
  | 'number'
@@ -60,100 +19,19 @@ export type asOptions =
60
19
  | 'urlpattern'
61
20
  | 'boolean|number'
62
21
  ;
22
+ export type MindReadType = ``;
23
+ export type TypeQualifier = `as ${asOptions}`;
63
24
 
64
- export interface $copeDetail{
65
- ceName?: string,
66
- itemProp?: string,
67
- }
68
-
69
- export interface $ScopeHierarchy {
70
- home: Element;
71
- satellites?: Array<Element>;
72
- }
73
-
74
- // deprecated
75
- export interface Specifier {
76
- /** Directional Scope Sigil */
77
- dss?: DirectionalScopeSigils,
78
- /**
79
- * recursive
80
- */
81
- rec?: boolean,
82
- /**
83
- * root node fallback
84
- */
85
- rnf?: boolean,
86
- /**
87
- * include siblings in scope search
88
- */
89
- isiss?: boolean,
90
- scopeS?: CSSSelector,
91
- elS?: CSSSelector,
92
- el?: string,
93
- idRefS?: string,
94
- s?: Sigils,
95
-
96
- /**
97
- * Inferred prop name
98
- * This should be the last token word of the DSS expression
99
- */
100
- prop?: InferredPropName,
101
- path?: SubPropPath;
102
- /**
103
- * Event Name
104
- */
105
- evt?: EventName;
106
-
107
- /**
108
- * RoundAbout Prop events to listen for
109
- */
110
- raps?: Array<string>;
25
+ export type ValExpression = `${PropPath | ConstVal | MindReadProp}${TypeQualifier | MindReadType}`;
111
26
 
112
- ms?: MarkerString;
113
- self?: boolean;
114
- /**
115
- * must have a dash in the localName
116
- * wait for whenDefined in find
117
- */
118
- host?: boolean;
119
- /**
120
- * host prop
121
- */
122
- hp?: string;
123
- /**
124
- * host prop fallback
125
- */
126
- hpf?: string;
127
-
128
- as?: asOptions
129
-
130
- /**
131
- * is a scope query within the aria-[row|col|row]index[text]
132
- */
133
- isModulo?: boolean;
134
- /**
135
- * Specify which aria-[?]index to use
136
- */
137
- modulo?: Modulo;
27
+ export type MindReadEvent = ``;
138
28
 
139
- /**
140
- * is a scope query within comments
141
- */
142
- cmtWrap?: boolean;
29
+ export type EvtName = `::${string}`;
143
30
 
144
- /**
145
- * itemscope hierarchy domain specifier
146
- */
147
- is$cope?: boolean;
31
+ export type DSS = `${Target}${ValExpression}${EvtName}`;
148
32
 
149
- $copeDetail?: $copeDetail;
150
-
151
- constVal?: any;
152
33
 
153
- enhBase?: string;
154
- }
155
-
156
- export interface IPE {
34
+ export interface Specifier {
157
35
  id?: string,
158
36
  prop?: string,
159
37
  path?: SubPropPath,
@@ -162,11 +40,11 @@ export interface IPE {
162
40
  constVal?: any;
163
41
  enhKey?: string;
164
42
  ish?: boolean;
43
+ //element to observe must be a shadowed custom element host.
44
+ host?: boolean;
165
45
  }
166
46
 
167
- export type Modulo = 'aria-rowindex' | 'aria-colindex' | 'aria-rowindextext'
168
47
 
169
- export type InferredPropName = string;
170
48
 
171
49
  /**
172
50
  * can contain dot (.) for sub property access and pipes (|) for method invocations
@@ -175,44 +53,3 @@ export type SubPropPath = string;
175
53
 
176
54
  export type EventName = string;
177
55
 
178
- export type CSSSelector = string;
179
-
180
- /**
181
- * starts with a dash, typically all kebab case
182
- * inferred prop name will be camel cased based on this.
183
- */
184
- export type MarkerString = string;
185
-
186
- /**
187
- * PIP stands for Partner in Prop (for now) -- supports bi-directional data flow to property
188
- * IP stands for In Prop (for now) -- Data only Flow only goes in
189
- * OP s
190
- */
191
-
192
- export interface GetPIPOptions{
193
- //name of event to listen for for when the prop being monitored for changes
194
- evtName?: string,
195
- isRoundAboutReady?: boolean;
196
- prop?: string,
197
- sota?: string,
198
- }
199
-
200
- /**
201
- * Partner In Prop
202
- */
203
- export interface PIP<TProp = any, TElement = Element> extends EventListenerObject{
204
- readonly propagator: EventTarget;
205
- async getValue(el: TElement): Promise<TProp | undefined>;
206
- async setValue(el: TElement, val: TProp);
207
- async hydrate(el: TElement);
208
- syncVal(el: TElement);
209
- disconnect();
210
- toString(nv: TProp): string;
211
- readonly outEvtName: string;
212
- }
213
-
214
-
215
-
216
- export interface HasIshList {
217
- ishList: Array<any>;
218
- }
@@ -25,13 +25,11 @@ export interface ElO {
25
25
  export interface RegExpExt<TStatementGroup = any>{
26
26
  regExp: RegExp | string,
27
27
  defaultVals: Partial<TStatementGroup>,
28
- // deprecated
29
28
  dssKeys?: [string, string][],
30
- // deprecated
31
29
  dssArrayKeys?: [string, string][],
32
30
  statementPartParser?: StatementPartParser,
33
- ipeKeys?: [string, string][];
34
- ipeArrayKeys?: [string, string][];
31
+ //ipeKeys?: [string, string][];
32
+ // ipeArrayKeys?: [string, string][];
35
33
  }
36
34
 
37
35
  export interface StatementPartParser {