@ddd-qc/lit-happ 0.18.2 → 0.19.0
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from "lit";
|
|
2
2
|
import { Cell } from "@ddd-qc/cell-proxy";
|
|
3
|
+
import { DnaViewModel } from "../DnaViewModel";
|
|
3
4
|
export declare const cellContext: {
|
|
4
5
|
__context__: Cell;
|
|
5
6
|
};
|
|
@@ -8,7 +9,9 @@ export declare const cellContext: {
|
|
|
8
9
|
*/
|
|
9
10
|
export declare class CellContext extends LitElement {
|
|
10
11
|
cell: Cell;
|
|
11
|
-
|
|
12
|
+
dvm: DnaViewModel;
|
|
13
|
+
private _cellProvider;
|
|
14
|
+
private _dnaProvider?;
|
|
12
15
|
private _initialized;
|
|
13
16
|
/** */
|
|
14
17
|
firstUpdated(): void;
|
|
@@ -11,26 +11,37 @@ let CellContext = class CellContext extends LitElement {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
/* create a provider controller */
|
|
14
|
-
/*@state()*/ this.
|
|
14
|
+
/*@state()*/ this._cellProvider = new ContextProvider(this, cellContext, this.cell);
|
|
15
15
|
this._initialized = false;
|
|
16
16
|
}
|
|
17
17
|
/** */
|
|
18
18
|
firstUpdated() {
|
|
19
|
+
/** Cell */
|
|
19
20
|
if (!this.cell)
|
|
20
21
|
throw Error('"cell" property not defined in <cell-context>');
|
|
21
22
|
//this._provider = new ContextProvider(this, cellContext, this.cell);
|
|
22
|
-
this.
|
|
23
|
+
this._cellProvider.setValue(this.cell);
|
|
23
24
|
this._initialized = true;
|
|
24
25
|
console.log(`\t Cell context set to "${this.cell.name}"`);
|
|
26
|
+
/** DVM */
|
|
27
|
+
if (this.dvm) {
|
|
28
|
+
this._dnaProvider = new ContextProvider(this, this.dvm.getContext(), this.dvm);
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
/** Set provider to cell */
|
|
27
32
|
willUpdate(changedProperties) {
|
|
28
33
|
//console.log("<cell-context>.willUpdate()", changedProperties)
|
|
29
34
|
if (changedProperties.has("cell")) {
|
|
30
35
|
//console.log("<cell-context>.willUpdate() changed installed cell", this.cell.name)
|
|
31
|
-
this.
|
|
36
|
+
this._cellProvider.setValue(this.cell);
|
|
32
37
|
console.log(`\t Cell context changed to "${this.cell.name}"`);
|
|
33
38
|
}
|
|
39
|
+
if (changedProperties.has("dvm")) {
|
|
40
|
+
this._dnaProvider = undefined;
|
|
41
|
+
if (this.dvm) {
|
|
42
|
+
this._dnaProvider = new ContextProvider(this, this.dvm.getContext(), this.dvm);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
34
45
|
}
|
|
35
46
|
/** */
|
|
36
47
|
render() {
|
|
@@ -43,6 +54,9 @@ let CellContext = class CellContext extends LitElement {
|
|
|
43
54
|
__decorate([
|
|
44
55
|
property({ type: Object })
|
|
45
56
|
], CellContext.prototype, "cell", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: Object })
|
|
59
|
+
], CellContext.prototype, "dvm", void 0);
|
|
46
60
|
__decorate([
|
|
47
61
|
state()
|
|
48
62
|
], CellContext.prototype, "_initialized", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-context.js","sourceRoot":"","sources":["../../src/elements/cell-context.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAC,UAAU,EAAE,IAAI,EAAiB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"cell-context.js","sourceRoot":"","sources":["../../src/elements/cell-context.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AACjE,OAAO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,CAAC,IAAI,GAAG,CAAC,CAAA;SAC9D;QAED,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAChC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;YAC9B,IAAI,IAAI,CAAC,GAAG,EAAE;gBACZ,IAAI,CAAC,YAAY,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;aAChF;SACF;IACH,CAAC;IAGD,MAAM;IACN,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,OAAO,IAAI,CAAA,EAAE,CAAC;SACf;QACD,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF,CAAA;AAxDC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACb;AAGZ;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;wCACP;AAQT;IAAR,KAAK,EAAE;iDAA8B;AAd3B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA2DvB;SA3DY,WAAW","sourcesContent":["import {ContextProvider, createContext} from '@lit-labs/context';\nimport {LitElement, html, PropertyValues} from \"lit\";\nimport {property, state, customElement} from \"lit/decorators.js\";\nimport {Cell} from \"@ddd-qc/cell-proxy\";\nimport {DnaViewModel} from \"../DnaViewModel\";\n\nexport const cellContext = createContext<Cell>('lit-happ/cell');\n//export const cellContext = createContext<Cell>('lit-happ/cell/default');\n\n\n/**\n *\n */\n@customElement(\"cell-context\")\nexport class CellContext extends LitElement {\n\n @property({type: Object})\n cell!: Cell;\n\n @property({type: Object})\n dvm: DnaViewModel;\n\n /* create a provider controller */\n /*@state()*/ private _cellProvider = new ContextProvider(this, cellContext, this.cell);\n\n private _dnaProvider?;\n\n\n @state() private _initialized = false;\n\n\n\n /** */\n firstUpdated() {\n /** Cell */\n if (!this.cell) throw Error('\"cell\" property not defined in <cell-context>')\n //this._provider = new ContextProvider(this, cellContext, this.cell);\n this._cellProvider.setValue(this.cell);\n this._initialized = true;\n console.log(`\\t Cell context set to \"${this.cell.name}\"`)\n\n /** DVM */\n if (this.dvm) {\n this._dnaProvider = new ContextProvider(this, this.dvm.getContext(), this.dvm);\n }\n }\n\n\n /** Set provider to cell */\n protected willUpdate(changedProperties: PropertyValues<this>) {\n //console.log(\"<cell-context>.willUpdate()\", changedProperties)\n if (changedProperties.has(\"cell\")) {\n //console.log(\"<cell-context>.willUpdate() changed installed cell\", this.cell.name)\n this._cellProvider.setValue(this.cell);\n console.log(`\\t Cell context changed to \"${this.cell.name}\"`)\n }\n\n if (changedProperties.has(\"dvm\")) {\n this._dnaProvider = undefined;\n if (this.dvm) {\n this._dnaProvider = new ContextProvider(this, this.dvm.getContext(), this.dvm);\n }\n }\n }\n\n\n /** */\n render() {\n if (!this._initialized) {\n return html``;\n }\n return html`<slot></slot>`;\n }\n}\n"]}
|