@ddd-qc/lit-happ 0.17.1 → 0.17.2
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/dist/DnaElement.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement } from "lit";
|
|
3
3
|
import { property, state } from "lit/decorators.js";
|
|
4
|
-
import { ContextConsumer,
|
|
4
|
+
import { ContextConsumer, consume, createContext } from "@lit-labs/context";
|
|
5
5
|
import { CellMixin } from "@ddd-qc/cell-proxy";
|
|
6
6
|
import { cellContext } from "./elements/cell-context";
|
|
7
7
|
import { RoleMixin } from "./roleMixin";
|
|
@@ -65,7 +65,7 @@ __decorate([
|
|
|
65
65
|
state()
|
|
66
66
|
], DnaElement.prototype, "_dvm", void 0);
|
|
67
67
|
__decorate([
|
|
68
|
-
|
|
68
|
+
consume({ context: cellContext, subscribe: true }),
|
|
69
69
|
property({ type: Object, attribute: false })
|
|
70
70
|
], DnaElement.prototype, "_cell_via_context", void 0);
|
|
71
71
|
__decorate([
|
package/dist/DnaElement.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnaElement.js","sourceRoot":"","sources":["../src/DnaElement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAiB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"DnaElement.js","sourceRoot":"","sources":["../src/DnaElement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAiB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,eAAe,EAAE,OAAO,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAE1E,O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C3B,CAAC;IAGD;;;OAGG;IACO,KAAK,CAAC,UAAU,CAAC,MAAW,EAAE,MAAY;QAClD,iDAAiD;IACnD,CAAC;IAGD,MAAM;IACN,YAAY,CAAC,iBAAuC;QAClD,IAAI,iBAAiB,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE;YAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;SACrC;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;QACD,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAGD,MAAM;IACI,UAAU,CAAC,iBAAuC;QAC1D,IAAI,iBAAiB,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE;YAC9C,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;CACF;AAlEU;IAAR,KAAK,EAAE;wCAAsB;AAI9B;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC;IACjD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAC,CAAC;qDAClB;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAC,CAAC;+CAC3D","sourcesContent":["import {LitElement, PropertyValues} from \"lit\";\nimport {property, state} from \"lit/decorators.js\";\nimport {ContextConsumer, consume, createContext} from \"@lit-labs/context\";\nimport {DnaViewModel} from \"./DnaViewModel\";\nimport {BaseRoleName, Cell, CellMixin} from \"@ddd-qc/cell-proxy\";\nimport {cellContext} from \"./elements/cell-context\";\nimport {RoleMixin} from \"./roleMixin\";\n\n/**\n * A LitElement that is bound to a specific DnaViewModel, e.g. a View for the ViewModel\n */\nexport class DnaElement<P, DVM extends DnaViewModel> extends CellMixin(RoleMixin(LitElement)) {\n\n /** if BaseRoleName is not provided, subclass must call requestDvm() in its Ctor */\n constructor(baseRoleName?: BaseRoleName) {\n super();\n if (baseRoleName) {\n this.baseRoleName = baseRoleName;\n }\n }\n\n /** Provided by Context depending on BaseRoleName */\n @state() protected _dvm!: DVM;\n\n @consume({ context: cellContext, subscribe: true})\n @property({type: Object, attribute: false})\n _cell_via_context!: Cell;\n\n @property({type: Object, attribute: false, hasChanged: (_v, _old) => true})\n perspective!: P;\n\n\n /** -- Methods -- */\n\n /** */\n protected requestDvm() {\n /** Consume Context based on given dnaHash */\n if (!this._cell_via_context) {\n console.error(\"No Cell info found via context in a DnaElement for role:\", this.baseRoleName)\n return;\n }\n const contextType = createContext<DVM>('dvm/'+ this.cell.name);\n console.log(`\\t\\t Requesting context \"${contextType}\"`)\n /*const consumer =*/ new ContextConsumer(\n this,\n contextType,\n async (value: DVM, dispose?: () => void): Promise<void> => {\n console.log(`\\t\\t Received value for context \"${contextType}\"`)\n await this.dvmUpdated(value, this._dvm);\n if (this._dvm) {\n this._dvm.unsubscribe(this);\n }\n this._dvm = value;\n this._dvm.subscribe(this, 'perspective');\n },\n false, // true will call twice at init\n );\n //console.log({consumer})\n }\n\n\n /**\n * To be overriden by subclasses\n * Example: Have a subclass unsubscribe to oldDvm's zvms and subscribe to the new ones\n */\n protected async dvmUpdated(newDvm: DVM, oldDvm?: DVM): Promise<void> {\n //console.log(`\\t\\t Default dvmUpdated() called`)\n }\n\n\n /** */\n shouldUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"_cell_via_context\")) {\n this._cell = this._cell_via_context;\n }\n if (!this._dvm) {\n this.requestDvm();\n }\n return !!this._dvm;\n }\n\n\n /** */\n protected willUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has(\"_cell_via_context\")) {\n this.requestDvm();\n }\n }\n}\n"]}
|
package/dist/ZomeElement.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement } from "lit";
|
|
3
3
|
import { property, state } from "lit/decorators.js";
|
|
4
|
-
import {
|
|
4
|
+
import { consume, ContextConsumer, createContext } from "@lit-labs/context";
|
|
5
5
|
import { cellContext } from "./elements/cell-context";
|
|
6
6
|
import { CellMixin } from "@ddd-qc/cell-proxy";
|
|
7
7
|
/**
|
|
@@ -58,7 +58,7 @@ export class ZomeElement extends CellMixin(LitElement) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
__decorate([
|
|
61
|
-
|
|
61
|
+
consume({ context: cellContext, subscribe: true }),
|
|
62
62
|
property({ type: Object, attribute: false })
|
|
63
63
|
], ZomeElement.prototype, "_cell_via_context", void 0);
|
|
64
64
|
__decorate([
|
package/dist/ZomeElement.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZomeElement.js","sourceRoot":"","sources":["../src/ZomeElement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAiB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"ZomeElement.js","sourceRoot":"","sources":["../src/ZomeElement.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAiB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAO,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAGnD;;GAEG;AACH,MAAM,OAAO,WAA0C,SAAQ,SAAS,CAAC,UAAU,CAAC;IAElF,YAA4B,eAAyB;QACnD,KAAK,EAAE,C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GD,MAAM;IACN,YAAY,CAAC,iBAAuC;QAClD,mFAAmF;QACnF,IAAI,iBAAiB,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE;YAC9C,mEAAmE;YACnE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC;YACpC,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;SACd;QACD,yCAAyC;QACzC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;QACD,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CAWF;AAtEC;IAFC,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC;IACjD,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAC,CAAC;sDAClB;AAMhB;IAAR,KAAK,EAAE;yCAAsB;AAG9B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAC,CAAC;gDAC3D","sourcesContent":["import {LitElement, PropertyValues} from \"lit\";\nimport {property, state} from \"lit/decorators.js\";\nimport {consume, ContextConsumer, createContext} from \"@lit-labs/context\";\nimport {ZomeName} from \"@holochain/client\";\nimport {cellContext} from \"./elements/cell-context\";\nimport { ZomeViewModel } from \"./ZomeViewModel\";\nimport {Cell, CellMixin} from \"@ddd-qc/cell-proxy\";\n\n\n/**\n * LitElement that is bound to a specific ZomeViewModel, e.g. a View for the ViewModel\n */\nexport class ZomeElement<P, ZVM extends ZomeViewModel> extends CellMixin(LitElement) {\n\n constructor(public readonly defaultZomeName: ZomeName) {\n super();\n // const nameAttr = this.getAttribute(\"zomeName\");\n // if (nameAttr) {\n // this.zomeName = nameAttr;\n // }\n }\n\n @consume({ context: cellContext, subscribe: true})\n @property({type: Object, attribute: false})\n _cell_via_context!: Cell;\n\n protected _zomeName!: ZomeName;\n get zomeName(): ZomeName {return this._zomeName};\n\n /** Provided by Context depending on cellData.dnaHash */\n @state() protected _zvm!: ZVM;\n\n @property({type: Object, attribute: false, hasChanged: (_v, _old) => true})\n perspective!: P;\n\n\n /** -- Methods -- */\n\n /** Request zvm from Context based on current CellId */\n private requestZvm() {\n if (!this._cell_via_context) {\n throw Error(`Context \"${cellContext}\" not found from ZomeElement \"${this.constructor.name}\"`)\n }\n const contextType = createContext<ZVM>('zvm/'+ this.defaultZomeName + '/' + this.cell.dnaHash)\n console.log(`\\t\\t Requesting context \"${contextType}\"`)\n /*const consumer =*/ new ContextConsumer(\n this,\n contextType,\n async (value: ZVM, dispose?: () => void): Promise<void> => {\n console.log(`\\t\\t Received value for context \"${contextType}\"`)\n await this.zvmUpdated(value, this._zvm);\n if (this._zvm) {\n this._zvm.unsubscribe(this);\n }\n this._zvm = value;\n this._zomeName = this._zvm.zomeName;\n this._zvm.subscribe(this, 'perspective');\n },\n false, // true will call twice at init\n );\n }\n\n\n /** Subclass can override this to get notified when a new ZVM has been received */\n protected async zvmUpdated(newZvm: ZVM, oldZvm?: ZVM): Promise<void> {\n //console.log(`\\t\\t Default zvmUpdated() called`)\n }\n\n\n /** */\n shouldUpdate(changedProperties: PropertyValues<this>) {\n //console.log(\"ZomeElement.shouldUpdate() start\", !!this._zvm, this.installedCell);\n if (changedProperties.has(\"_cell_via_context\")) {\n //console.log(\"ZomeElement.shouldUpdate()\", this._cell_via_context)\n this._cell = this._cell_via_context;\n this.requestZvm();\n return false;\n }\n /** RequestZvm on first \"shouldUpdate\" */\n if (!this._zvm) {\n this.requestZvm();\n }\n return !!this._zvm;\n }\n\n\n // /** Request ZVM if cell changed */\n // protected willUpdate(changedProperties: PropertyValues<this>) {\n // //console.log(\"ZomeElement.willUpdate()\", changedProperties)\n // if (changedProperties.has(\"_cell_via_context\")) {\n // this.requestZvm();\n // }\n // }\n\n}\n\n"]}
|
|
@@ -3,6 +3,7 @@ import { ContextProvider, createContext } from '@lit-labs/context';
|
|
|
3
3
|
import { LitElement, html } from "lit";
|
|
4
4
|
import { property, state, customElement } from "lit/decorators.js";
|
|
5
5
|
export const cellContext = createContext('lit-happ/cell');
|
|
6
|
+
//export const cellContext = createContext<Cell>('lit-happ/cell/default');
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
8
9
|
*/
|
|
@@ -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;AAGjE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAO,eAAe,CAAC,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,EAAC,UAAU,EAAE,IAAI,EAAiB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGjE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAO,eAAe,CAAC,CAAC;AAChE,0EAA0E;AAG1E;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAKL,kCAAkC;QAClC,YAAY,CAAS,cAAS,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAElE,iBAAY,GAAG,KAAK,CAAC;IA8BxC,CAAC;IA5BC,MAAM;IACN,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,KAAK,CAAC,+CAA+C,CAAC,CAAA;QAC5E,qEAAqE;QACrE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;IAC3D,CAAC;IAGD,2BAA2B;IACjB,UAAU,CAAC,iBAAuC;QAC1D,+DAA+D;QAC/D,IAAI,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACjC,mFAAmF;YACnF,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;SAC9D;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;AAnCC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACb;AAKH;IAAR,KAAK,EAAE;iDAA8B;AAR3B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAsCvB;SAtCY,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\";\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 /* create a provider controller */\n /*@state()*/ private _provider = new ContextProvider(this, cellContext, this.cell);\n\n @state() private _initialized = false;\n\n /** */\n firstUpdated() {\n if (!this.cell) throw Error('\"cell\" property not defined in <cell-context>')\n //this._provider = new ContextProvider(this, cellContext, this.cell);\n this._provider.setValue(this.cell);\n this._initialized = true;\n console.log(`\\t Cell context set to \"${this.cell.name}\"`)\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._provider.setValue(this.cell);\n console.log(`\\t Cell context changed to \"${this.cell.name}\"`)\n }\n }\n\n\n /** */\n render() {\n if (!this._initialized) {\n return html``;\n }\n return html`<slot></slot>`;\n }\n}\n"]}
|