mount-observer 0.0.44 → 0.0.46

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 CHANGED
@@ -58,17 +58,21 @@ export class MountObserver extends EventTarget {
58
58
  return this.#calculatedSelector;
59
59
  }
60
60
  async composeFragment(fragment, level) {
61
- const bis = fragment.querySelectorAll(inclTemplQry);
61
+ const bis = fragment.querySelectorAll(`${inclTemplQry},${itemscopeQry}`);
62
62
  for (const bi of bis) {
63
63
  await this.#compose(bi, level);
64
64
  }
65
65
  }
66
66
  async #compose(el, level) {
67
- if (!el.hasAttribute('src')) {
68
- return;
67
+ if (el.hasAttribute('src')) {
68
+ const { compose } = await import('./compose.js');
69
+ await compose(this, el, level);
70
+ }
71
+ const itemscope = el.getAttribute('itemscope');
72
+ if (itemscope && itemscope.includes('-')) {
73
+ const { Newish } = await import('./Newish.js');
74
+ new Newish(el, itemscope, this.#mountInit.assigner);
69
75
  }
70
- const { compose } = await import('./compose.js');
71
- await compose(this, el, level);
72
76
  }
73
77
  #templLookUp = new Map();
74
78
  findByID(id, fragment) {
@@ -393,7 +397,7 @@ export class MountObserver extends EventTarget {
393
397
  return returnSet;
394
398
  }
395
399
  async #filterAndMount(els, checkMatch, initializing) {
396
- const { whereSatisfies, whereInstanceOf } = this.#mountInit;
400
+ const { whereSatisfies, whereInstanceOf, assigner } = this.#mountInit;
397
401
  const match = await this.#selector();
398
402
  const elsToMount = els.filter(x => {
399
403
  if (checkMatch) {
@@ -414,6 +418,10 @@ export class MountObserver extends EventTarget {
414
418
  if (elToMount.matches(inclTemplQry)) {
415
419
  await this.#compose(elToMount, 0);
416
420
  }
421
+ if (elToMount.matches(itemscopeQry)) {
422
+ const { Newish } = await import('./Newish.js');
423
+ new Newish(elToMount, elToMount.getAttribute('itemscope'), assigner);
424
+ }
417
425
  }
418
426
  this.#mount(elsToMount, initializing);
419
427
  }
@@ -425,6 +433,7 @@ export class MountObserver extends EventTarget {
425
433
  }
426
434
  const refCountErr = 'mount-observer ref count mismatch';
427
435
  export const inclTemplQry = 'template[src^="#"]:not([hidden])';
436
+ export const itemscopeQry = '[itemscope~="-"]';
428
437
  // https://github.com/webcomponents-cg/community-protocols/issues/12#issuecomment-872415080
429
438
  /**
430
439
  * The `mutation-event` event represents something that happened.
package/MountObserver.ts CHANGED
@@ -69,18 +69,23 @@ export class MountObserver extends EventTarget implements IMountObserver{
69
69
  }
70
70
 
71
71
  async composeFragment(fragment: DocumentFragment, level: number){
72
- const bis = fragment.querySelectorAll(inclTemplQry) as NodeListOf<HTMLTemplateElement>;
72
+ const bis = fragment.querySelectorAll(`${inclTemplQry},${itemscopeQry}`) as NodeListOf<HTMLTemplateElement>;
73
73
  for(const bi of bis){
74
74
  await this.#compose(bi, level);
75
75
  }
76
76
  }
77
77
 
78
+
78
79
  async #compose(el: HTMLTemplateElement, level: number){
79
- if(!el.hasAttribute('src')){
80
- return;
80
+ if(el.hasAttribute('src')){
81
+ const {compose} = await import('./compose.js');
82
+ await compose(this, el, level);
83
+ }
84
+ const itemscope = el.getAttribute('itemscope');
85
+ if(itemscope && itemscope.includes('-')){
86
+ const {Newish} = await import('./Newish.js');
87
+ new Newish(el, itemscope, this.#mountInit.assigner);
81
88
  }
82
- const {compose} = await import('./compose.js');
83
- await compose(this, el, level);
84
89
  }
85
90
  #templLookUp: Map<string, HTMLElement> = new Map();
86
91
  findByID(id: string, fragment: DocumentFragment): HTMLElement | null{
@@ -410,7 +415,7 @@ export class MountObserver extends EventTarget implements IMountObserver{
410
415
  }
411
416
 
412
417
  async #filterAndMount(els: Array<Element>, checkMatch: boolean, initializing: boolean){
413
- const {whereSatisfies, whereInstanceOf} = this.#mountInit;
418
+ const {whereSatisfies, whereInstanceOf, assigner} = this.#mountInit;
414
419
  const match = await this.#selector();
415
420
  const elsToMount = els.filter(x => {
416
421
  if(checkMatch){
@@ -428,6 +433,10 @@ export class MountObserver extends EventTarget implements IMountObserver{
428
433
  if(elToMount.matches(inclTemplQry)){
429
434
  await this.#compose(elToMount as HTMLTemplateElement, 0)
430
435
  }
436
+ if(elToMount.matches(itemscopeQry)){
437
+ const {Newish} = await import('./Newish.js');
438
+ new Newish(elToMount, elToMount.getAttribute('itemscope')!, assigner);
439
+ }
431
440
  }
432
441
  this.#mount(elsToMount, initializing);
433
442
  }
@@ -444,6 +453,7 @@ export class MountObserver extends EventTarget implements IMountObserver{
444
453
 
445
454
  const refCountErr = 'mount-observer ref count mismatch';
446
455
  export const inclTemplQry = 'template[src^="#"]:not([hidden])';
456
+ export const itemscopeQry = '[itemscope~="-"]';
447
457
  export interface MountObserver extends IMountObserver{}
448
458
 
449
459
  // https://github.com/webcomponents-cg/community-protocols/issues/12#issuecomment-872415080
package/Newish.js ADDED
@@ -0,0 +1,70 @@
1
+ export { waitForEvent } from './waitForEvent.js';
2
+ export class Newish extends EventTarget {
3
+ queue = [];
4
+ isResolved = false;
5
+ #ce;
6
+ #assigner = undefined;
7
+ constructor(enhancedElement, itemscope, assigner) {
8
+ super();
9
+ this.#assigner = assigner;
10
+ this.#do(enhancedElement, itemscope);
11
+ }
12
+ async #do(enhancedElement, itemscope) {
13
+ //if(Object.hasOwn(enhancedElement, 'host')) return;
14
+ await customElements.whenDefined(itemscope);
15
+ const initPropVals = enhancedElement['ish'];
16
+ //check to make sure it didn't already get attached while waiting
17
+ if (initPropVals === undefined || customElements.getName(initPropVals.constructor) !== itemscope) {
18
+ if (enhancedElement instanceof HTMLElement) {
19
+ if (enhancedElement.dataset.ish) {
20
+ const parsedHostProps = JSON.parse(enhancedElement.dataset.ish);
21
+ this.queue.push(parsedHostProps);
22
+ }
23
+ }
24
+ if (initPropVals !== undefined)
25
+ this.queue.push(initPropVals);
26
+ const ce = document.createElement(itemscope);
27
+ if ('attachedCallback' in ce && typeof ce.attachedCallback === 'function') {
28
+ await ce.attachedCallback(enhancedElement);
29
+ }
30
+ this.#ce = ce;
31
+ const self = this;
32
+ Object.defineProperty(enhancedElement, 'ish', {
33
+ get() {
34
+ return self.#ce;
35
+ },
36
+ set(nv) {
37
+ self.queue.push(nv);
38
+ self.#assignGingerly();
39
+ },
40
+ enumerable: true,
41
+ configurable: true,
42
+ });
43
+ this.#assignGingerly();
44
+ }
45
+ this.isResolved = true;
46
+ this.dispatchEvent(new Event('resolved'));
47
+ }
48
+ async #assignGingerly() {
49
+ let ce = this.#ce;
50
+ if (ce === undefined) {
51
+ throw 500;
52
+ }
53
+ //const {assignGingerly} = await import('../lib/assignGingerly.js');
54
+ while (this.queue.length > 0) {
55
+ const fi = this.queue.shift();
56
+ //TODO: Provide support for a virtual slice of a very large list
57
+ if (Array.isArray(fi)) {
58
+ ce.$ = fi;
59
+ }
60
+ else {
61
+ if (this.#assigner !== undefined) {
62
+ await this.#assigner(ce, fi);
63
+ }
64
+ else {
65
+ Object.assign(ce, fi);
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
package/Newish.ts ADDED
@@ -0,0 +1,74 @@
1
+ export {waitForEvent} from './waitForEvent.js';
2
+ export class Newish extends EventTarget{
3
+ queue: Array<any> = [];
4
+ isResolved = false;
5
+ #ce: HTMLElement | undefined;
6
+
7
+ #assigner: undefined | ((target: any, source: any) => Promise<void>) = undefined;
8
+
9
+ constructor(enhancedElement: Element, itemscope: string, assigner?: (target: any, source: any) => Promise<void>){
10
+ super();
11
+ this.#assigner = assigner;
12
+ this.#do(enhancedElement, itemscope);
13
+ }
14
+
15
+ async #do(enhancedElement: Element, itemscope: string){
16
+ //if(Object.hasOwn(enhancedElement, 'host')) return;
17
+ await customElements.whenDefined(itemscope);
18
+ const initPropVals = (<any>enhancedElement)['ish'];
19
+ //check to make sure it didn't already get attached while waiting
20
+ if(initPropVals === undefined || customElements.getName(initPropVals.constructor) !== itemscope){
21
+ if(enhancedElement instanceof HTMLElement){
22
+ if(enhancedElement.dataset.ish){
23
+ const parsedHostProps = JSON.parse(enhancedElement.dataset.ish);
24
+ this.queue.push(parsedHostProps);
25
+ }
26
+ }
27
+ if(initPropVals !== undefined) this.queue.push(initPropVals);
28
+ const ce = document.createElement(itemscope);
29
+ if('attachedCallback' in ce && typeof ce.attachedCallback === 'function'){
30
+ await ce.attachedCallback(enhancedElement)
31
+ }
32
+ this.#ce = ce;
33
+ const self = this;
34
+ Object.defineProperty(enhancedElement, 'ish', {
35
+ get(){
36
+ return self.#ce;
37
+ },
38
+ set(nv: any){
39
+ self.queue.push(nv);
40
+ self.#assignGingerly();
41
+ },
42
+ enumerable: true,
43
+ configurable: true,
44
+ });
45
+ this.#assignGingerly();
46
+ }
47
+
48
+ this.isResolved = true;
49
+ this.dispatchEvent(new Event('resolved'));
50
+ }
51
+
52
+ async #assignGingerly(){
53
+ let ce = this.#ce!;
54
+ if(ce === undefined){
55
+ throw 500;
56
+ }
57
+ //const {assignGingerly} = await import('../lib/assignGingerly.js');
58
+ while(this.queue.length > 0 ){
59
+ const fi = this.queue.shift();
60
+ //TODO: Provide support for a virtual slice of a very large list
61
+ if(Array.isArray(fi)){
62
+ (<any>ce).$ = fi;
63
+ }else{
64
+ if(this.#assigner !== undefined){
65
+ await this.#assigner(ce, fi);
66
+ }else{
67
+ Object.assign(ce, fi);
68
+ }
69
+ }
70
+
71
+ }
72
+ }
73
+
74
+ }
package/compose.js CHANGED
@@ -70,6 +70,7 @@ export async function compose(self, el, level) {
70
70
  }
71
71
  slot.removeAttribute('slot');
72
72
  }
73
+ el.dispatchEvent(new LoadEvent(clone));
73
74
  }
74
75
  if (level === 0) {
75
76
  const refs = [];
@@ -98,9 +99,11 @@ export async function compose(self, el, level) {
98
99
  el.after(clone);
99
100
  }
100
101
  }
101
- if (level === 0) {
102
- el.dispatchEvent(new LoadEvent(clone));
103
- }
102
+ //moving the code down here broke be-inclusive Example2.html (but maybe it caused something else to work, so will need to revisit)
103
+ //check to make sure the progresive loading of css-charts works as before.
104
+ // if(level === 0){
105
+ // el.dispatchEvent(new LoadEvent(clone));
106
+ // }
104
107
  if (!cloneStashed) {
105
108
  if (level !== 0 || (slots.length === 0 && el.attributes.length === 0))
106
109
  el.remove();
package/compose.ts CHANGED
@@ -77,7 +77,7 @@ export async function compose(
77
77
  }
78
78
  slot.removeAttribute('slot');
79
79
  }
80
-
80
+ el.dispatchEvent(new LoadEvent(clone));
81
81
  }
82
82
  if(level === 0){
83
83
  const refs: Array<WeakRef<Element>> = [];
@@ -85,6 +85,7 @@ export async function compose(
85
85
  refs.push(new WeakRef(child));
86
86
  }
87
87
  (<any>el)[childRefsKey] = refs;
88
+
88
89
  }
89
90
  //if template has itemscope attribute, assume want to do some data binding before instantiating into
90
91
  //DOM fragment.
@@ -102,9 +103,11 @@ export async function compose(
102
103
  el.after(clone);
103
104
  }
104
105
  }
105
- if(level === 0){
106
- el.dispatchEvent(new LoadEvent(clone));
107
- }
106
+ //moving the code down here broke be-inclusive Example2.html (but maybe it caused something else to work, so will need to revisit)
107
+ //check to make sure the progresive loading of css-charts works as before.
108
+ // if(level === 0){
109
+ // el.dispatchEvent(new LoadEvent(clone));
110
+ // }
108
111
 
109
112
  if(!cloneStashed){
110
113
  if(level !== 0 || (slots.length === 0 && el.attributes.length === 0)) el.remove();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "mount-observer",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
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.50.0",
8
+ "@playwright/test": "1.51.1",
9
9
  "ssi-server": "0.0.1"
10
10
  },
11
11
  "exports": {
@@ -17,6 +17,10 @@
17
17
  "default": "./MountObserver.js",
18
18
  "types": "./MountObserver.ts"
19
19
  },
20
+ "./Newish.js": {
21
+ "default": "./Newish.js",
22
+ "types": "./Newish.ts"
23
+ },
20
24
  "./Synthesizer.js": {
21
25
  "default": "./Synthesizer.js",
22
26
  "types": "./Synthesizer.ts"
@@ -24,6 +28,10 @@
24
28
  "./compose.js": {
25
29
  "default": "./compose.js",
26
30
  "types": "./compose.ts"
31
+ },
32
+ "./waitForEvent.js": {
33
+ "default": "./waitForEvent.js",
34
+ "types": "./waitForEvent.ts"
27
35
  }
28
36
  },
29
37
  "files": [
@@ -3,6 +3,7 @@ import {IEnhancement, BEAllProps} from '../trans-render/be/types';
3
3
  export interface EndUserProps extends IEnhancement{
4
4
  eventName: string, //TODO
5
5
  }
6
+
6
7
  export interface AllProps extends EndUserProps{}
7
8
 
8
9
  export type AP = AllProps;
@@ -27,5 +27,6 @@ export interface BEConfig<TProps = any, TActions = TProps, ETProps = TProps>{
27
27
  handlers?: Handlers<ETProps, TActions>;
28
28
  positractions?: Positractions<TProps, TActions>;
29
29
  watchedBranches?: Set<number>;
30
+ isSleepless?: boolean;
30
31
  }
31
32
 
@@ -0,0 +1,27 @@
1
+ import {IEnhancement, BEAllProps} from '../trans-render/be/types';
2
+ import {StringWithAutocompleteOptions} from '../trans-render/types';
3
+
4
+ export interface EndUserProps extends IEnhancement{
5
+ duration: number,
6
+ attr: StringWithAutocompleteOptions<
7
+ |'value'
8
+ |'textContent'
9
+ |'innerHTML'
10
+ |'shadowRoot'
11
+ >,
12
+ css: string,
13
+ }
14
+
15
+ export interface AllProps extends EndUserProps{}
16
+
17
+ export type AP = AllProps;
18
+
19
+ export type PAP = Partial<AP>;
20
+
21
+ export type ProPAP = Promise<PAP>;
22
+
23
+ export type BAP = AP & BEAllProps;
24
+
25
+ export interface Actions{
26
+ hydrate(self: BAP): ProPAP;
27
+ }
@@ -0,0 +1,28 @@
1
+ import {IEnhancement, BEAllProps} from '../trans-render/be/types';
2
+ import { XForm } from "../trans-render/types";
3
+
4
+ export interface EndUserProps<TProps, TMethods, TElement = {}> extends IEnhancement<HTMLTemplateElement>{
5
+ of: string,
6
+ xform: XForm<TProps, TMethods, TElement>,
7
+ initModel?: TProps & TMethods,
8
+ slotMap?: any,
9
+ }
10
+
11
+ export interface AllProps<TProps, TMethods, TElement = {}> extends EndUserProps<TProps, TMethods, TElement>{
12
+ isParsed?: boolean,
13
+ model?: TProps & TMethods,
14
+ }
15
+
16
+ export type AP = AllProps<any, any, any>;
17
+
18
+ export type PAP = Partial<AP>;
19
+
20
+ export type ProPAP = Promise<PAP>;
21
+
22
+ export type BAP = AP & BEAllProps;
23
+
24
+
25
+ export interface Actions{
26
+ onInitModel(self: BAP): ProPAP;
27
+ startWeaving(self: BAP): ProPAP;
28
+ }
@@ -0,0 +1,26 @@
1
+ import {IEnhancement, BEAllProps} from '../trans-render/be/types';
2
+ import {AllProps as XPAsAllProps} from '../xp-as/types';
3
+
4
+ export interface EndUserProps extends IEnhancement{
5
+ xpAsAttr: string;
6
+ }
7
+
8
+ export interface AllProps extends EndUserProps{
9
+ }
10
+
11
+ export type AP = AllProps;
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): ProPAP;
21
+ }
22
+
23
+ export interface Factor{
24
+ NameOfProp: string,
25
+ xpAs: XPAsAllProps,
26
+ }
@@ -46,8 +46,16 @@ export interface ObservingParameters{
46
46
  punt: boolean,
47
47
  mappings?: Array<AndIfThen>,
48
48
  aggKey: StringWithAutocompleteOptions<aggKeys>,
49
+ interpolatingExpr: string,
49
50
  JSExpr: string,
50
51
  ONExpr: string,
52
+ action:
53
+ | 'set'
54
+ | 'toggle'
55
+ | 'increment'
56
+ | 'decrement'
57
+ | 'set-class'
58
+ | 'set-part'
51
59
  //aggregateRemoteVals?: 'Union' | 'Conjunction' | 'ObjectAssign' | 'Sum' | 'Product' | 'ArrayPush'
52
60
  }
53
61
 
@@ -0,0 +1,38 @@
1
+ import { ITransformer } from "../trans-render/types";
2
+
3
+ export interface EndUserProps {
4
+ chartType: 'area' | 'bar' | 'column' | 'line' | 'pie',
5
+ showLabels: boolean,
6
+ showPrimaryAxis: boolean,
7
+ showDataAxes: boolean,
8
+ hideData: boolean,
9
+ show2SecondaryAxes: boolean,
10
+ }
11
+
12
+ export interface AllProps extends EndUserProps{
13
+ $slot: HTMLSlotElement,
14
+ slotChangeCount: number,
15
+ data: Array<DataItem>,
16
+ isArea: boolean,
17
+ isBar: boolean,
18
+ isColumn: boolean,
19
+ isLine: boolean,
20
+ isPie: boolean,
21
+ }
22
+
23
+ export interface DataItem {
24
+ key: string,
25
+ value: number,
26
+ scaledVal: number,
27
+ start: number,
28
+ end: number,
29
+ }
30
+
31
+ export type PAP = Partial<AllProps>;
32
+
33
+ export type ProPAP = Promise<PAP>;
34
+
35
+ export interface Actions {
36
+ extractData(self: AllProps): ProPAP;
37
+ classify(self: AllProps): PAP;
38
+ }
@@ -0,0 +1,13 @@
1
+ import {AllProps as BaseAllProps, EndUserProps as BaseEndUserProps, Actions as BaseActions} from '../css-charts/types';
2
+ import {EChartsOption} from 'echarts';
3
+ export interface EndUserProps extends BaseEndUserProps {
4
+ options: EChartsOption;
5
+ }
6
+
7
+ export interface AllProps extends EndUserProps, BaseAllProps {
8
+ }
9
+
10
+ export interface Actions extends BaseActions {
11
+ hydrateECharts(self: AllProps): Promise<void>;
12
+ }
13
+
@@ -24,7 +24,8 @@ export interface MountInit extends JSONSerializableMountInit{
24
24
  readonly withTargetShadowRoot?: ShadowRoot,
25
25
  readonly whereInstanceOf?: Array<{new(): Element}>,
26
26
  readonly whereSatisfies?: PipelineProcessor<boolean>,
27
- readonly do?: MountObserverCallbacks
27
+ readonly do?: MountObserverCallbacks,
28
+ readonly assigner?: (target: any, source: any) => Promise<void>,
28
29
  // /**
29
30
  // * Purpose -- there are scenarios where we may only want to affect changes that occur after the initial
30
31
  // * server rendering, so we only want to mount elements that appear
@@ -74,7 +75,7 @@ export interface AttribMatch{
74
75
  // validator?: (v: any) => boolean;
75
76
  }
76
77
 
77
- export interface WeakDual<T>{
78
+ export interface WeakDual<T extends Object>{
78
79
  weakSet: WeakSet<T>,
79
80
  setWeak: Set<WeakRef<T>>
80
81
  }
@@ -72,6 +72,14 @@ export interface ASMROptions<TProp = any>{
72
72
  export interface SetOptions<TProp = any> extends ASMROptions<TProp>{
73
73
  valToDisplay?: (v: TProp) => string;
74
74
  allowUnsafe?: boolean;
75
+ action?:
76
+ |'set'
77
+ |'toggle'
78
+ |'increment'
79
+ |'decrement'
80
+ |'set-class'
81
+ |'set-part'
82
+ ;
75
83
  }
76
84
 
77
85
  export interface AbsOptions<TProp = any> {
@@ -25,6 +25,10 @@ export type DirectionalScopeSigils =
25
25
  * modulo
26
26
  */
27
27
  |'%'
28
+ /**
29
+ * itemscoped host
30
+ */
31
+ |'$'
28
32
  ;
29
33
 
30
34
  export type AttrSigils =
@@ -51,6 +55,16 @@ export type asOptions =
51
55
  | 'boolean|number'
52
56
  ;
53
57
 
58
+ export interface $copeDetail{
59
+ ceName?: string,
60
+ itemProp?: string,
61
+ }
62
+
63
+ export interface $ScopeHierarchy {
64
+ home: Element;
65
+ satellites?: Array<Element>;
66
+ }
67
+
54
68
  export interface Specifier {
55
69
  /** Directional Scope Sigil */
56
70
  dss?: DirectionalScopeSigils,
@@ -106,9 +120,21 @@ export interface Specifier {
106
120
 
107
121
  as?: asOptions
108
122
 
109
-
123
+ /**
124
+ * is a scope query within the aria-[row|col|row]index[text]
125
+ */
110
126
  isModulo?: boolean;
127
+ /**
128
+ * Specify which aria-[?]index to use
129
+ */
111
130
  modulo?: Modulo;
131
+
132
+ /**
133
+ * itemscope hierarchy domain specifier
134
+ */
135
+ is$cope?: boolean;
136
+
137
+ $copeDetail?: $copeDetail
112
138
  }
113
139
 
114
140
  export type Modulo = 'aria-rowindex' | 'aria-colindex' | 'aria-rowindextext'
@@ -126,7 +152,7 @@ export type CSSSelector = string;
126
152
 
127
153
  /**
128
154
  * starts with a dash, typically all kebab case
129
- * inferrered prop name will be camel cased based on this.
155
+ * inferred prop name will be camel cased based on this.
130
156
  */
131
157
  export type MarkerString = string;
132
158
 
@@ -156,4 +182,8 @@ export interface PIP<TProp = any, TElement = Element> extends EventListenerObjec
156
182
  disconnect();
157
183
  toString(nv: TProp): string;
158
184
  readonly outEvtName: string;
185
+ }
186
+
187
+ export interface HasIshList extends HTMLElement{
188
+ ishList: Array<any>;
159
189
  }
@@ -68,10 +68,10 @@ export interface IPropRegistrar extends IResolvableService{
68
68
  nonDryProps: Set<string>,
69
69
  }
70
70
 
71
- export interface IDefine extends IResolvableService{
72
- custElClass: {new(): HTMLElement};
73
- resolveInstanceSvcs(args: CEArgs, instance: any): Promise<void>;
74
- }
71
+ // export interface IDefine extends IResolvableService{
72
+ // custElClass: {new(): HTMLElement};
73
+ // resolveInstanceSvcs(args: CEArgs, instance: any): Promise<void>;
74
+ // }
75
75
 
76
76
  export interface IPropSvc extends IResolvableService{
77
77
  createPropBag(instance: Element): void;
@@ -114,12 +114,12 @@ export interface INewPropagator {
114
114
 
115
115
 
116
116
 
117
- export interface CEArgs<TProps = any, TActions = TProps, TPropInfo = PropInfo, TAction extends Action<TProps> = Action<TProps>> extends DefineArgs<TProps, TActions, TPropInfo, TAction>{
118
- definer?: IDefine,
119
- servers?: CEServiceClasses
120
- services?: CEServices,
121
- asides?: any
122
- }
117
+ // export interface CEArgs<TProps = any, TActions = TProps, TPropInfo = PropInfo, TAction extends Action<TProps> = Action<TProps>> extends DefineArgs<TProps, TActions, TPropInfo, TAction>{
118
+ // definer?: IDefine,
119
+ // servers?: CEServiceClasses
120
+ // services?: CEServices,
121
+ // asides?: any
122
+ // }
123
123
 
124
124
  export interface DynamicTransform {
125
125
  scope?: Scope,
@@ -319,7 +319,7 @@ export interface PropInfo{
319
319
  ip?: boolean;
320
320
  }
321
321
 
322
- export type ConstString = String;
322
+ export type ConstString = string;
323
323
 
324
324
  export type NameOfProp = string;
325
325
 
@@ -349,7 +349,7 @@ export type Checks<TProps = any, TActions = TProps> =
349
349
  Partial<{[key in keyof TActions & string]: SetLogicOps<TProps>}>
350
350
 
351
351
  export type roundaboutOptions<TProps = any, TActions = TProps, ETProps = TProps> = {
352
- vm?: TProps & TActions & RoundaboutReady | WeakRef<TProps & TActions & RoundaboutReady>,
352
+ vm?: TProps & TActions & RoundaboutReady,
353
353
  //for enhanced elements, pass in the container, referenced via $0.
354
354
  container?: EventTarget,
355
355
  propagate?: keyof TProps & string | Array<keyof TProps & string>,
@@ -403,7 +403,9 @@ export interface RoundaboutReady{
403
403
  *
404
404
  * https://github.com/whatwg/dom/issues/1296
405
405
  */
406
- readonly disconnectedSignal: AbortSignal
406
+ //readonly disconnectedSignal: AbortSignal
407
+
408
+ RAController: AbortController;
407
409
 
408
410
  /**
409
411
  * During this time, queues/buses continue to perform "bookkeeping"
@@ -413,11 +415,11 @@ export interface RoundaboutReady{
413
415
  */
414
416
  readonly sleep?: number,
415
417
 
416
- async awake(): void;
418
+ awake(): Promise<void>;
417
419
 
418
- async nudge(): void;
420
+ nudge(): void;
419
421
 
420
- async rock(): void;
422
+ rock(): void;
421
423
  }
422
424
 
423
425
 
@@ -1,4 +1,4 @@
1
- import { MountContext, PipelineStage } from "mount-observer/types";
1
+ import { MountContext, PipelineStage } from "../mount-observer/types";
2
2
  import { ConvertOptions, Scope } from "./lib/types";
3
3
  import { EMC} from './be/types';
4
4
 
@@ -458,6 +458,11 @@ export interface TransRenderMethods{
458
458
  import {OConfig} from './froop/types';
459
459
  export interface MntCfg<TProps = any, TActions = TProps, ETProps = TProps> extends OConfig<TProps, TActions, ETProps>{
460
460
  mainTemplate: string | HTMLTemplateElement,
461
+ /**
462
+ * Only set to true if shadow dom is used and the light children play a critical role as far as
463
+ * progressive enhancement.
464
+ */
465
+ appendOnClone?: boolean,
461
466
  /**
462
467
  * transform within ShadowRoot if applicable
463
468
  */
@@ -0,0 +1,20 @@
1
+ import {IEnhancement, BEAllProps} from '../trans-render/be/types';
2
+
3
+ export interface EndUserProps extends IEnhancement{
4
+ }
5
+
6
+ export interface AllProps extends EndUserProps{
7
+ props: EventTarget;
8
+ }
9
+
10
+ export type AP = AllProps;
11
+
12
+ export type PAP = Partial<AP>;
13
+
14
+ export type ProPAP = Promise<PAP>;
15
+
16
+ export type BAP = AP & BEAllProps;
17
+
18
+ export interface Actions {
19
+
20
+ }
@@ -0,0 +1,193 @@
1
+ //import {SimpleWCInfo} from 'may-it-be/SimpleWCInfo';
2
+
3
+ declare interface WeakRef<S>{}
4
+
5
+ export interface SelectedElement {
6
+ label: string;
7
+ values: any[];
8
+ index: number;
9
+ }
10
+
11
+ export interface SelectedElementEventDetail {
12
+ value: SelectedElement
13
+ }
14
+
15
+ export interface XtalFrappeChartEventNameMap {
16
+ 'selected-element-changed': SelectedElementEventDetail;
17
+ }
18
+
19
+ export interface IAddDataPointParams {
20
+ label: string;
21
+ valueFromEachDataset: number[];
22
+ index?: number;
23
+ }
24
+
25
+ export interface XtalFrappeChartProps{
26
+ /**
27
+ * Data to be displayed in chart (JSON string for attribute)
28
+ */
29
+ data: HeatMapData | TabularData;
30
+ selectedElement: object,
31
+ value: object,
32
+ mainTemplate: HTMLTemplateElement | string,
33
+ clonedTemplate: DocumentFragment | undefined,
34
+ target: HTMLDivElement,
35
+ //refs: any,
36
+
37
+ /**
38
+ * Add new data point to chart
39
+ *
40
+ */
41
+ newDataPoint: IAddDataPointParams;
42
+
43
+ /**
44
+ * Remove data point from chart
45
+ */
46
+ staleDataPoint: number;
47
+
48
+ /**
49
+ * Title of chart
50
+ */
51
+ chartTitle: string;
52
+
53
+ /**
54
+ * Height of chart
55
+ */
56
+ height: number;
57
+
58
+ /**
59
+ * Colors to be used in chart
60
+ */
61
+ colors: string[];
62
+
63
+ /**
64
+ * Type of chart to be displayed
65
+ */
66
+ type: ChartType;
67
+
68
+ /**
69
+ * Whether or not chart is navigable
70
+ */
71
+ isNavigable: boolean;
72
+
73
+ toolTipOptions: any;
74
+
75
+ isC: boolean;
76
+
77
+ chartContainerPart: WeakRef<HTMLDivElement>[];
78
+
79
+ }
80
+
81
+ export interface AllProps extends XtalFrappeChartProps{}
82
+
83
+
84
+ export interface XtalFrappeChartActions{
85
+ createChart(self: XtalFrappeChartProps): void;
86
+ handleDataSelect(e: Event): void;
87
+ }
88
+ export type ChartType = 'axis-mixed' | 'bar' | 'line' | 'scatter' | 'pie' | 'percentage';
89
+
90
+ export interface ChartOptions{
91
+ data?: HeatMapData | TabularData,
92
+ title?: string,
93
+ height?: number,
94
+ colors?: string[],
95
+ type?: ChartType,
96
+ toolTipOptions: any,
97
+ isNavigable: boolean,
98
+
99
+ }
100
+
101
+ export interface ChartData{
102
+ tooltipOptions: TooltipOptions,
103
+ valuesOverPoints: OneOrZero,
104
+ }
105
+
106
+ export interface HeatMapData extends ChartData{
107
+ dataPoints: {[key: string]: number},
108
+ start: Date,
109
+ end: Date
110
+ }
111
+ //type TabularDataChartTypes = 'bar' | 'line';
112
+ export interface DataSet{
113
+ name?: string,
114
+ values: number[]
115
+ }
116
+ export interface TabularData extends ChartData{
117
+ //type?: TabularDataChartTypes,
118
+ labels?: string[],
119
+ datasets?: any[],
120
+ yMarkers?: Marker[],
121
+ yRegions?: Region[],
122
+ }
123
+
124
+ export interface BarOptions{
125
+ spaceRatio: number,
126
+ }
127
+
128
+ export type OneOrZero = 0 | 1;
129
+
130
+ export interface LineOptions{
131
+ dotSize: number,
132
+ regionFill: OneOrZero,
133
+ hideDots: OneOrZero,
134
+ hideLine: OneOrZero
135
+ heatLine: OneOrZero,
136
+
137
+ }
138
+
139
+ export type AxisMode = 'span' | 'tick'
140
+
141
+ export interface AxisOptions{
142
+ xAxisMode?: AxisMode,
143
+ xIsSeries?: boolean,
144
+ }
145
+
146
+ export interface BarChartData extends TabularData{
147
+ barOptions?: BarOptions,
148
+ axisOptions?: AxisOptions
149
+ }
150
+ export interface LineChartData extends TabularData{
151
+ axisOptions?: AxisOptions,
152
+ lineOptions?: LineOptions
153
+ }
154
+
155
+ export type LeftRight = 'left' | 'right';
156
+
157
+ export interface MarkerOptions{
158
+ labelPos?: LeftRight
159
+ }
160
+
161
+ export interface Marker{
162
+ label?: string,
163
+ value?: number,
164
+ options?: MarkerOptions
165
+ }
166
+
167
+ export interface RegionOptions{
168
+ labelPos?: LeftRight
169
+ }
170
+
171
+ export interface Region{
172
+ label?: string,
173
+ start?: number,
174
+ end?: number,
175
+ options?: RegionOptions,
176
+ }
177
+
178
+ export interface TooltipOptions{
179
+ formatTooltipX: (d: any) => string,
180
+ formatTooltipY: (d: any) => string,
181
+ }
182
+
183
+ /**
184
+ * Web component wrapper around the cool Frappe chart (https://frappe.io/charts) library.
185
+ */
186
+ export abstract class XtalFrappeChartInfo{ //implements SimpleWCInfo<XtalFrappeChartProps>{
187
+ src: './xtal-frappe-chart.js';
188
+ tagName: 'xtal-frappe-chart';
189
+ props: XtalFrappeChartProps;
190
+ methods: XtalFrappeChartActions;
191
+ }
192
+
193
+ export type Package = [XtalFrappeChartInfo];
@@ -0,0 +1,12 @@
1
+ export function waitForEvent(et, eventName, failureEventName) {
2
+ return new Promise((resolved, rejected) => {
3
+ et.addEventListener(eventName, e => {
4
+ resolved(e);
5
+ }, { once: true });
6
+ if (failureEventName !== undefined) {
7
+ et.addEventListener(failureEventName, e => {
8
+ rejected(e);
9
+ }, { once: true });
10
+ }
11
+ });
12
+ }
@@ -0,0 +1,13 @@
1
+ export function waitForEvent<TEvent extends Event = Event>(et: EventTarget, eventName: string, failureEventName?: string): Promise<TEvent>{
2
+ return new Promise((resolved, rejected) => {
3
+ et.addEventListener(eventName, e => {
4
+ resolved(e as TEvent);
5
+ }, {once: true});
6
+ if(failureEventName !== undefined){
7
+ et.addEventListener(failureEventName, e => {
8
+ rejected(e as TEvent);
9
+ }, {once: true});
10
+ }
11
+
12
+ })
13
+ }