mount-observer 0.0.43 → 0.0.45

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/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.43",
3
+ "version": "0.0.45",
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": {
@@ -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,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,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
+
@@ -74,12 +74,12 @@ export interface AttribMatch{
74
74
  // validator?: (v: any) => boolean;
75
75
  }
76
76
 
77
- export interface WeakDual<T>{
77
+ export interface WeakDual<T extends Object>{
78
78
  weakSet: WeakSet<T>,
79
79
  setWeak: Set<WeakRef<T>>
80
80
  }
81
81
 
82
- export interface IMountObserver {
82
+ export interface IMountObserver extends EventTarget {
83
83
  // readonly mountInit: MountInit,
84
84
  // readonly mountedRefs: WeakRef<Element>[],
85
85
  // readonly dismountedRefs: WeakRef<Element>[],
@@ -1,3 +1,4 @@
1
+ import { IMountObserver } from '../../mount-observer/types';
1
2
  import { Scope} from '../lib/types';
2
3
  import { WrapperConfig } from '../XV/types';
3
4
 
@@ -67,10 +68,10 @@ export interface IPropRegistrar extends IResolvableService{
67
68
  nonDryProps: Set<string>,
68
69
  }
69
70
 
70
- export interface IDefine extends IResolvableService{
71
- custElClass: {new(): HTMLElement};
72
- resolveInstanceSvcs(args: CEArgs, instance: any): Promise<void>;
73
- }
71
+ // export interface IDefine extends IResolvableService{
72
+ // custElClass: {new(): HTMLElement};
73
+ // resolveInstanceSvcs(args: CEArgs, instance: any): Promise<void>;
74
+ // }
74
75
 
75
76
  export interface IPropSvc extends IResolvableService{
76
77
  createPropBag(instance: Element): void;
@@ -113,12 +114,12 @@ export interface INewPropagator {
113
114
 
114
115
 
115
116
 
116
- export interface CEArgs<TProps = any, TActions = TProps, TPropInfo = PropInfo, TAction extends Action<TProps> = Action<TProps>> extends DefineArgs<TProps, TActions, TPropInfo, TAction>{
117
- definer?: IDefine,
118
- servers?: CEServiceClasses
119
- services?: CEServices,
120
- asides?: any
121
- }
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
+ // }
122
123
 
123
124
  export interface DynamicTransform {
124
125
  scope?: Scope,
@@ -186,6 +187,7 @@ export interface OConfig<TProps = any, TActions = TProps, ETProps = TProps>{
186
187
  handlers?: Handlers<ETProps, TActions>;
187
188
  positractions?: Positractions<TProps, TActions>;
188
189
  mainTemplate?: string | HTMLTemplateElement;
190
+ isSleepless?: boolean;
189
191
  }
190
192
 
191
193
  export type Positractions<TProps = any, TActions = TProps> =
@@ -357,6 +359,7 @@ export type roundaboutOptions<TProps = any, TActions = TProps, ETProps = TProps>
357
359
  handlers?: Handlers<ETProps, TActions>,
358
360
  hitch?: Hitches<TProps, TActions>,
359
361
  positractions?: Positractions<TProps>,
362
+ mountObservers?: Set<IMountObserver>
360
363
  }
361
364
 
362
365
  export type PropsToPartialProps<TProps = any> =
@@ -400,7 +403,9 @@ export interface RoundaboutReady{
400
403
  *
401
404
  * https://github.com/whatwg/dom/issues/1296
402
405
  */
403
- readonly disconnectedSignal: AbortSignal
406
+ //readonly disconnectedSignal: AbortSignal
407
+
408
+ RAController: AbortController;
404
409
 
405
410
  /**
406
411
  * During this time, queues/buses continue to perform "bookkeeping"
@@ -410,9 +415,11 @@ export interface RoundaboutReady{
410
415
  */
411
416
  readonly sleep?: number,
412
417
 
413
- async awake(): void;
418
+ awake(): Promise<void>;
419
+
420
+ nudge(): void;
414
421
 
415
- async nudge(): void;
422
+ rock(): void;
416
423
  }
417
424
 
418
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,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];