@wirestate/lit 0.7.0-experimental.1 → 0.7.0-experimental.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/CHANGELOG.md +8 -2
- package/README.md +49 -31
- package/cjs/development/index.js +326 -241
- package/cjs/development/index.js.map +1 -1
- package/cjs/production/index.js +1 -1
- package/cjs/production/index.js.map +1 -1
- package/esm/development/commands/on-command-controller.js +4 -4
- package/esm/development/commands/on-command-controller.js.map +1 -1
- package/esm/development/consumption/injection.js +7 -7
- package/esm/development/consumption/injection.js.map +1 -1
- package/esm/development/consumption/use-container.js +40 -0
- package/esm/development/consumption/use-container.js.map +1 -0
- package/esm/development/consumption/use-injection.js +4 -4
- package/esm/development/consumption/use-injection.js.map +1 -1
- package/esm/development/consumption/use-scope.js +44 -0
- package/esm/development/consumption/use-scope.js.map +1 -0
- package/esm/development/context/container-context.js +17 -0
- package/esm/development/context/container-context.js.map +1 -0
- package/esm/development/events/on-event-controller.js +4 -4
- package/esm/development/events/on-event-controller.js.map +1 -1
- package/esm/development/index.js +9 -7
- package/esm/development/index.js.map +1 -1
- package/esm/development/provision/container-provide.js +68 -0
- package/esm/development/provision/container-provide.js.map +1 -0
- package/esm/development/provision/container-provider.js +74 -0
- package/esm/development/provision/container-provider.js.map +1 -0
- package/esm/development/provision/sub-container-provide.js +56 -0
- package/esm/development/provision/sub-container-provide.js.map +1 -0
- package/esm/development/provision/sub-container-provider.js +93 -0
- package/esm/development/provision/sub-container-provider.js.map +1 -0
- package/esm/development/provision/use-container-provision.js +44 -0
- package/esm/development/provision/use-container-provision.js.map +1 -0
- package/esm/development/provision/use-sub-container-provider.js +34 -0
- package/esm/development/provision/use-sub-container-provider.js.map +1 -0
- package/esm/development/queries/on-query-controller.js +4 -4
- package/esm/development/queries/on-query-controller.js.map +1 -1
- package/esm/production/commands/on-command-controller.js +1 -1
- package/esm/production/commands/on-command-controller.js.map +1 -1
- package/esm/production/consumption/injection.js +1 -1
- package/esm/production/consumption/injection.js.map +1 -1
- package/esm/production/consumption/use-container.js +1 -0
- package/esm/production/consumption/use-container.js.map +1 -0
- package/esm/production/consumption/use-injection.js +1 -1
- package/esm/production/consumption/use-injection.js.map +1 -1
- package/esm/production/consumption/use-scope.js +1 -0
- package/esm/production/consumption/use-scope.js.map +1 -0
- package/esm/production/context/container-context.js +1 -0
- package/esm/production/context/container-context.js.map +1 -0
- package/esm/production/events/on-event-controller.js +1 -1
- package/esm/production/events/on-event-controller.js.map +1 -1
- package/esm/production/index.js +1 -1
- package/esm/production/provision/container-provide.js +1 -0
- package/esm/production/provision/container-provide.js.map +1 -0
- package/esm/production/provision/container-provider.js +1 -0
- package/esm/production/provision/container-provider.js.map +1 -0
- package/esm/production/provision/sub-container-provide.js +1 -0
- package/esm/production/provision/sub-container-provide.js.map +1 -0
- package/esm/production/provision/sub-container-provider.js +1 -0
- package/esm/production/provision/sub-container-provider.js.map +1 -0
- package/esm/production/provision/use-container-provision.js +1 -0
- package/esm/production/provision/use-container-provision.js.map +1 -0
- package/esm/production/provision/use-sub-container-provider.js +1 -0
- package/esm/production/provision/use-sub-container-provider.js.map +1 -0
- package/esm/production/queries/on-query-controller.js +1 -1
- package/esm/production/queries/on-query-controller.js.map +1 -1
- package/index.d.ts +271 -176
- package/package.json +2 -2
- package/esm/development/context/ioc-context.js +0 -17
- package/esm/development/context/ioc-context.js.map +0 -1
- package/esm/development/provision/injectables-provide.js +0 -47
- package/esm/development/provision/injectables-provide.js.map +0 -1
- package/esm/development/provision/injectables-provider-controller.js +0 -123
- package/esm/development/provision/injectables-provider-controller.js.map +0 -1
- package/esm/development/provision/ioc-provide.js +0 -58
- package/esm/development/provision/ioc-provide.js.map +0 -1
- package/esm/development/provision/ioc-provider-controller.js +0 -75
- package/esm/development/provision/ioc-provider-controller.js.map +0 -1
- package/esm/development/provision/use-injectables-provider.js +0 -27
- package/esm/development/provision/use-injectables-provider.js.map +0 -1
- package/esm/development/provision/use-ioc-provision.js +0 -27
- package/esm/development/provision/use-ioc-provision.js.map +0 -1
- package/esm/production/context/ioc-context.js +0 -1
- package/esm/production/context/ioc-context.js.map +0 -1
- package/esm/production/provision/injectables-provide.js +0 -1
- package/esm/production/provision/injectables-provide.js.map +0 -1
- package/esm/production/provision/injectables-provider-controller.js +0 -1
- package/esm/production/provision/injectables-provider-controller.js.map +0 -1
- package/esm/production/provision/ioc-provide.js +0 -1
- package/esm/production/provision/ioc-provide.js.map +0 -1
- package/esm/production/provision/ioc-provider-controller.js +0 -1
- package/esm/production/provision/ioc-provider-controller.js.map +0 -1
- package/esm/production/provision/use-injectables-provider.js +0 -1
- package/esm/production/provision/use-injectables-provider.js.map +0 -1
- package/esm/production/provision/use-ioc-provision.js +0 -1
- package/esm/production/provision/use-ioc-provision.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { __extends, __assign } from 'tslib';
|
|
2
|
+
import { ContextProvider } from '@lit/context';
|
|
3
|
+
import { WirestateError, createContainer } from '@wirestate/core';
|
|
4
|
+
import { ContainerContext } from '../context/container-context.js';
|
|
5
|
+
import { ERROR_CODE_INVALID_ARGUMENTS } from '../error/error-code.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Provider that exposes an IoC container context to the host element and its children.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The provider supports two modes:
|
|
12
|
+
*
|
|
13
|
+
* - External mode: `container` is an existing {@link Container}. The
|
|
14
|
+
* provider passes it through context and does not alter its lifecycle.
|
|
15
|
+
* - Managed mode: `options` is {@link CreateContainerOptions}. The provider
|
|
16
|
+
* creates a container during construction without eager activation,
|
|
17
|
+
* activates configured entries when the host connects, disposes the
|
|
18
|
+
* container when the host disconnects, and recreates it on reconnect.
|
|
19
|
+
*
|
|
20
|
+
* @group Provision
|
|
21
|
+
*/
|
|
22
|
+
var ContainerProvider = /** @class */function (_super) {
|
|
23
|
+
__extends(ContainerProvider, _super);
|
|
24
|
+
/**
|
|
25
|
+
* @param host - The host element.
|
|
26
|
+
* @param options - Provisioning options.
|
|
27
|
+
* @param options.container - External container instance to provide.
|
|
28
|
+
* @param options.options - Managed container creation options.
|
|
29
|
+
*/
|
|
30
|
+
function ContainerProvider(host, options) {
|
|
31
|
+
var _this = this;
|
|
32
|
+
if (!options.container && !options.options) {
|
|
33
|
+
throw new WirestateError(ERROR_CODE_INVALID_ARGUMENTS, "ContainerProvider requires a valid container instance or creation options.");
|
|
34
|
+
} else if (options.container && options.options) {
|
|
35
|
+
throw new WirestateError(ERROR_CODE_INVALID_ARGUMENTS, "ContainerProvider requires only container or valid options object to be provided.");
|
|
36
|
+
}
|
|
37
|
+
_this = _super.call(this, host, {
|
|
38
|
+
context: ContainerContext,
|
|
39
|
+
initialValue: options.container ? options.container : createContainer(__assign(__assign({}, options.options), {
|
|
40
|
+
activate: []
|
|
41
|
+
}))
|
|
42
|
+
}) || this;
|
|
43
|
+
_this.destroyed = false;
|
|
44
|
+
_this.options = options.options;
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
ContainerProvider.prototype.hostConnected = function () {
|
|
48
|
+
var _a;
|
|
49
|
+
if (this.options) {
|
|
50
|
+
if (this.destroyed) {
|
|
51
|
+
this.value = createContainer(this.options);
|
|
52
|
+
this.destroyed = false;
|
|
53
|
+
} else {
|
|
54
|
+
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.activate) {
|
|
55
|
+
for (var _i = 0, _b = this.options.activate; _i < _b.length; _i++) {
|
|
56
|
+
var entry = _b[_i];
|
|
57
|
+
this.value.get(entry);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_super.prototype.hostConnected.call(this);
|
|
63
|
+
};
|
|
64
|
+
ContainerProvider.prototype.hostDisconnected = function () {
|
|
65
|
+
if (this.options) {
|
|
66
|
+
this.value.unbindAll();
|
|
67
|
+
this.destroyed = true;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return ContainerProvider;
|
|
71
|
+
}(ContextProvider);
|
|
72
|
+
|
|
73
|
+
export { ContainerProvider };
|
|
74
|
+
//# sourceMappingURL=container-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-provider.js","sources":["../../../../../../../../src/wirestate-lit/provision/container-provider.ts"],"sourcesContent":[null],"names":["ContainerProvider","_super","__extends","host","options","_this","container","WirestateError","ERROR_CODE_INVALID_ARGUMENTS","call","context","ContainerContext","initialValue","createContainer","activate","destroyed","prototype","hostConnected","value","_a","_i","_b","length","entry","get","hostDisconnected","unbindAll","ContextProvider"],"mappings":";;;;;;AAyCA;;;;;;;;;;;;;;AAcG;AACH,IAAAA,iBAAA,gBAAA,UAAAC,MAAA,EAAA;AACUC,EAAAA,SAAA,CAAAF,iBAAA,EAAAC,MAAA,CAAA;AAOR;;;;;AAKG;AACH,EAAA,SAAAD,iBAAAA,CAAmBG,IAAO,EAAEC,OAAiC,EAAA;IAA7D,IAAAC,KAAA,GAAA,IAAA;IACE,IAAI,CAACD,OAAO,CAACE,SAAS,IAAI,CAACF,OAAO,CAACA,OAAO,EAAE;AAC1C,MAAA,MAAM,IAAIG,cAAc,CACtBC,4BAA4B,EAC5B,4EAA4E,CAC7E;IACH,CAAC,MAAM,IAAIJ,OAAO,CAACE,SAAS,IAAIF,OAAO,CAACA,OAAO,EAAE;AAC/C,MAAA,MAAM,IAAIG,cAAc,CACtBC,4BAA4B,EAC5B,mFAAmF,CACpF;AACH,IAAA;IAEAH,KAAA,GAAAJ,MAAK,CAAAQ,IAAA,CAAA,IAAA,EAACN,IAAI,EAAE;AACVO,MAAAA,OAAO,EAAEC,gBAAgB;MACzBC,YAAY,EAAER,OAAO,CAACE,SAAS,GAAGF,OAAO,CAACE,SAAS,GAAGO,eAAe,uBAAMT,OAAO,CAACA,OAAO,CAAA,EAAA;AAAEU,QAAAA,QAAQ,EAAE;AAAE,OAAA,CAAA;KACzG,CAAC,IAAA,IAAA;IAxBMT,KAAA,CAAAU,SAAS,GAAY,KAAK;AA0BlCV,IAAAA,KAAI,CAACD,OAAO,GAAGA,OAAO,CAACA,OAAO;;AAQhC,EAAA;AAEOJ,EAAAA,iBAAA,CAAAgB,SAAA,CAAAC,aAAa,GAApB,YAAA;;IACE,IAAI,IAAI,CAACb,OAAO,EAAE;MAChB,IAAI,IAAI,CAACW,SAAS,EAAE;QAKlB,IAAI,CAACG,KAAK,GAAGL,eAAe,CAAC,IAAI,CAACT,OAAO,CAAC;QAC1C,IAAI,CAACW,SAAS,GAAG,KAAK;AACxB,MAAA,CAAC,MAAM;QACL,IAAI,MAAA,IAAI,CAACX,OAAO,MAAA,IAAA,IAAAe,EAAA,KAAA,MAAA,GAAA,MAAA,GAAAA,EAAA,CAAEL,QAAQ,EAAE;UAK1B,KAAoB,IAAAM,EAAA,GAAA,CAAqB,EAArBC,EAAA,GAAA,IAAI,CAACjB,OAAO,CAACU,QAAQ,EAArBM,EAAA,GAAAC,EAAA,CAAAC,MAAqB,EAArBF,EAAA,EAAqB,EAAE;AAAtC,YAAA,IAAMG,KAAK,GAAAF,EAAA,CAAAD,EAAA,CAAA;AACd,YAAA,IAAI,CAACF,KAAK,CAACM,GAAG,CAACD,KAAK,CAAC;AACvB,UAAA;AACF,QAAA;AACF,MAAA;AACF,IAAA;IAEAtB,MAAA,CAAAe,SAAK,CAACC,aAAa,CAAAR,IAAA,CAAA,IAAA,CAAE;EACvB,CAAC;AAEMT,EAAAA,iBAAA,CAAAgB,SAAA,CAAAS,gBAAgB,GAAvB,YAAA;IACE,IAAI,IAAI,CAACrB,OAAO,EAAE;AAKhB,MAAA,IAAI,CAACc,KAAK,CAACQ,SAAS,EAAE;MACtB,IAAI,CAACX,SAAS,GAAG,IAAI;AACvB,IAAA;EACF,CAAC;AACH,EAAA,OAAAf,iBAAC;AAAD,CA7EA,CACU2B,eAAe;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { SubContainerProvider } from './sub-container-provider.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decorator that provides a managed child container derived from the nearest
|
|
5
|
+
* parent container context.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The child container is created from the current parent context when the host
|
|
9
|
+
* connects, destroyed when it disconnects, and recreated when the parent
|
|
10
|
+
* container changes.
|
|
11
|
+
*
|
|
12
|
+
* @group Provision
|
|
13
|
+
*
|
|
14
|
+
* @param options - Provisioning options.
|
|
15
|
+
* @param options.options - Child-container creation options.
|
|
16
|
+
* @returns An instance of {@link SubContainerProviderDecorator}.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* class MyComponent extends LitElement {
|
|
21
|
+
* @subContainerProvide({
|
|
22
|
+
* options: {
|
|
23
|
+
* entries: [AuthService, UserService],
|
|
24
|
+
* activate: [AuthService],
|
|
25
|
+
* },
|
|
26
|
+
* })
|
|
27
|
+
* public containerProvider!: SubContainerProvider<MyComponent>;
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function subContainerProvide(options) {
|
|
32
|
+
return function (protoOrTarget, nameOrContext) {
|
|
33
|
+
if (typeof nameOrContext === "object") {
|
|
34
|
+
// Standard decorators:
|
|
35
|
+
nameOrContext.addInitializer(function () {
|
|
36
|
+
protoOrTarget.set.call(this, new SubContainerProvider(this, options));
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
var provider_1;
|
|
40
|
+
protoOrTarget.constructor.addInitializer(function (element) {
|
|
41
|
+
provider_1 = new SubContainerProvider(element, options);
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
get: function () {
|
|
45
|
+
return provider_1;
|
|
46
|
+
},
|
|
47
|
+
set: function () {},
|
|
48
|
+
configurable: true,
|
|
49
|
+
enumerable: true
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { subContainerProvide };
|
|
56
|
+
//# sourceMappingURL=sub-container-provide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-container-provide.js","sources":["../../../../../../../../src/wirestate-lit/provision/sub-container-provide.ts"],"sourcesContent":[null],"names":["subContainerProvide","options","protoOrTarget","nameOrContext","addInitializer","set","call","SubContainerProvider","provider_1","constructor","element","get","configurable","enumerable"],"mappings":";;AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAUA,mBAAmBA,CACjCC,OAAoC,EAAA;AAEpC,EAAA,OAAQ,UACNC,aAAmG,EACnGC,aAAkH,EAAA;AAElH,IAAA,IAAI,OAAOA,aAAa,KAAK,QAAQ,EAAE;AACrC;MACAA,aAAa,CAACC,cAAc,CAAC,YAAA;AAC3BF,QAAAA,aAAa,CAACG,GAAG,CAACC,IAAI,CAAC,IAAI,EAAE,IAAIC,oBAAoB,CAAC,IAAuB,EAAEN,OAAO,CAAC,CAAC;AAC1F,MAAA,CAAC,CAAC;AACJ,IAAA,CAAC,MAAM;AACL,MAAA,IAAIO,UAAwC;AAE3CN,MAAAA,aAAa,CAACO,WAAsC,CAACL,cAAc,CAAC,UAACM,OAAwB,EAAA;AAC5FF,QAAAA,UAAQ,GAAG,IAAID,oBAAoB,CAACG,OAAY,EAAET,OAAO,CAAC;AAC5D,MAAA,CAAC,CAAC;MAEF,OAAO;QACLU,GAAG,EAAA,YAAA;AACD,UAAA,OAAOH,UAAmC;QAC5C,CAAC;AACDH,QAAAA,GAAG,eAAU,CAAC;AACdO,QAAAA,YAAY,EAAE,IAAI;AAClBC,QAAAA,UAAU,EAAE;OACb;AACH,IAAA;EACF,CAAC;AACH;;;;"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __extends, __assign } from 'tslib';
|
|
2
|
+
import { ContextConsumer, ContextProvider } from '@lit/context';
|
|
3
|
+
import { createContainer } from '@wirestate/core';
|
|
4
|
+
import { ContainerContext } from '../context/container-context.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Provider that exposes a managed child container for the host element's lifetime.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* The provider always owns a child container derived from the nearest parent
|
|
11
|
+
* {@link ContainerContext}. When connected, it creates a child container using
|
|
12
|
+
* the latest parent context, provides it to descendants, destroys it when the
|
|
13
|
+
* host disconnects, and replaces it whenever the parent container changes.
|
|
14
|
+
*
|
|
15
|
+
* @group Provision
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* class MyComponent extends LitElement {
|
|
20
|
+
* private container = new SubContainerProvider(this, {
|
|
21
|
+
* options: {
|
|
22
|
+
* entries: [AuthService, UserService],
|
|
23
|
+
* activate: [AuthService],
|
|
24
|
+
* seeds: [[AuthService, { role: "admin" }]],
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
var SubContainerProvider = /** @class */function (_super) {
|
|
31
|
+
__extends(SubContainerProvider, _super);
|
|
32
|
+
/**
|
|
33
|
+
* @param host - The host element.
|
|
34
|
+
* @param options - Provisioning options, including child entries, eager activations, and seeds.
|
|
35
|
+
*/
|
|
36
|
+
function SubContainerProvider(host, options) {
|
|
37
|
+
var _this = _super.call(this, host, {
|
|
38
|
+
context: ContainerContext
|
|
39
|
+
}) || this;
|
|
40
|
+
_this.parent = null;
|
|
41
|
+
_this.destroyed = true;
|
|
42
|
+
_this.options = options.options;
|
|
43
|
+
_this.consumer = new ContextConsumer(host, {
|
|
44
|
+
context: ContainerContext,
|
|
45
|
+
subscribe: true,
|
|
46
|
+
callback: function (context) {
|
|
47
|
+
var previousParent = _this.parent;
|
|
48
|
+
_this.parent = context;
|
|
49
|
+
if (host.isConnected) {
|
|
50
|
+
if (_this.destroyed || !_this.value || previousParent !== context) {
|
|
51
|
+
_this.destroyContainer();
|
|
52
|
+
_this.createContainer();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
SubContainerProvider.prototype.hostConnected = function () {
|
|
60
|
+
if (this.parent && (this.destroyed || !this.value)) {
|
|
61
|
+
this.destroyContainer();
|
|
62
|
+
this.createContainer();
|
|
63
|
+
}
|
|
64
|
+
_super.prototype.hostConnected.call(this);
|
|
65
|
+
};
|
|
66
|
+
SubContainerProvider.prototype.hostDisconnected = function () {
|
|
67
|
+
this.destroyContainer();
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Replaces the currently provided child container with a new one derived
|
|
71
|
+
* from the latest parent context.
|
|
72
|
+
*/
|
|
73
|
+
SubContainerProvider.prototype.createContainer = function () {
|
|
74
|
+
var container = createContainer(__assign(__assign({}, this.options), {
|
|
75
|
+
parent: this.parent
|
|
76
|
+
}));
|
|
77
|
+
this.destroyed = false;
|
|
78
|
+
this.value = container;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Destroys the currently provided child container.
|
|
82
|
+
*/
|
|
83
|
+
SubContainerProvider.prototype.destroyContainer = function () {
|
|
84
|
+
if (this.value && !this.destroyed) {
|
|
85
|
+
this.value.unbindAll();
|
|
86
|
+
this.destroyed = true;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return SubContainerProvider;
|
|
90
|
+
}(ContextProvider);
|
|
91
|
+
|
|
92
|
+
export { SubContainerProvider };
|
|
93
|
+
//# sourceMappingURL=sub-container-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-container-provider.js","sources":["../../../../../../../../src/wirestate-lit/provision/sub-container-provider.ts"],"sourcesContent":[null],"names":["SubContainerProvider","_super","__extends","host","options","_this","call","context","ContainerContext","parent","destroyed","consumer","ContextConsumer","subscribe","callback","previousParent","isConnected","value","destroyContainer","createContainer","prototype","hostConnected","hostDisconnected","container","__assign","unbindAll","ContextProvider"],"mappings":";;;;;AAkDA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AACH,IAAAA,oBAAA,gBAAA,UAAAC,MAAA,EAAA;AACUC,EAAAA,SAAA,CAAAF,oBAAA,EAAAC,MAAA,CAAA;AASR;;;AAGG;AACH,EAAA,SAAAD,oBAAAA,CAAmBG,IAAO,EAAEC,OAAoC,EAAA;IAC9D,IAAAC,KAAA,GAAAJ,MAAK,CAAAK,IAAA,CAAA,IAAA,EAACH,IAAI,EAAE;AACVI,MAAAA,OAAO,EAAEC;KACV,CAAC,IAAA,IAAA;IAVMH,KAAA,CAAAI,MAAM,GAAqB,IAAI;IAC/BJ,KAAA,CAAAK,SAAS,GAAY,IAAI;AAajCL,IAAAA,KAAI,CAACD,OAAO,GAAGA,OAAO,CAACA,OAAO;AAE9BC,IAAAA,KAAI,CAACM,QAAQ,GAAG,IAAIC,eAAe,CAACT,IAAI,EAAE;AACxCI,MAAAA,OAAO,EAAEC,gBAAgB;AACzBK,MAAAA,SAAS,EAAE,IAAI;AACfC,MAAAA,QAAQ,EAAE,UAACP,OAAkB,EAAA;AAC3B,QAAA,IAAMQ,cAAc,GAAqBV,KAAI,CAACI,MAAM;QAEpDJ,KAAI,CAACI,MAAM,GAAGF,OAAO;QAErB,IAAIJ,IAAI,CAACa,WAAW,EAAE;AAMpB,UAAA,IAAIX,KAAI,CAACK,SAAS,IAAI,CAACL,KAAI,CAACY,KAAK,IAAIF,cAAc,KAAKR,OAAO,EAAE;YAC/DF,KAAI,CAACa,gBAAgB,EAAE;YACvBb,KAAI,CAACc,eAAe,EAAE;AACxB,UAAA;AACF,QAAA;AAMF,MAAA;AACD,KAAA,CAAC;;AACJ,EAAA;AAEOnB,EAAAA,oBAAA,CAAAoB,SAAA,CAAAC,aAAa,GAApB,YAAA;AAOE,IAAA,IAAI,IAAI,CAACZ,MAAM,KAAK,IAAI,CAACC,SAAS,IAAI,CAAC,IAAI,CAACO,KAAK,CAAC,EAAE;MAClD,IAAI,CAACC,gBAAgB,EAAE;MACvB,IAAI,CAACC,eAAe,EAAE;AACxB,IAAA;IAEAlB,MAAA,CAAAmB,SAAK,CAACC,aAAa,CAAAf,IAAA,CAAA,IAAA,CAAE;EACvB,CAAC;AAEMN,EAAAA,oBAAA,CAAAoB,SAAA,CAAAE,gBAAgB,GAAvB,YAAA;IAOE,IAAI,CAACJ,gBAAgB,EAAE;EACzB,CAAC;AAED;;;AAGG;AACOlB,EAAAA,oBAAA,CAAAoB,SAAA,CAAAD,eAAe,GAAzB,YAAA;AACE,IAAA,IAAMI,SAAS,GAAcJ,eAAe,CAAAK,QAAA,CAAAA,QAAA,CAAA,EAAA,EACvC,IAAI,CAACpB,OAAO,CAAA,EAAA;MACfK,MAAM,EAAE,IAAI,CAACA;OACb;IAQF,IAAI,CAACC,SAAS,GAAG,KAAK;IACtB,IAAI,CAACO,KAAK,GAAGM,SAAS;EACxB,CAAC;AAED;;AAEG;AACOvB,EAAAA,oBAAA,CAAAoB,SAAA,CAAAF,gBAAgB,GAA1B,YAAA;IACE,IAAI,IAAI,CAACD,KAAK,IAAI,CAAC,IAAI,CAACP,SAAS,EAAE;AAMjC,MAAA,IAAI,CAACO,KAAK,CAACQ,SAAS,EAAE;MACtB,IAAI,CAACf,SAAS,GAAG,IAAI;AACvB,IAAA;EACF,CAAC;AACH,EAAA,OAAAV,oBAAC;AAAD,CA9GA,CACU0B,eAAe;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ContainerProvider } from './container-provider.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook that provides a container to the host element and its children.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Pass `container` to expose an external `Container` without taking
|
|
8
|
+
* ownership. Pass `options` to create a managed container during
|
|
9
|
+
* construction, activate configured entries on connect, destroy it on
|
|
10
|
+
* disconnect, and recreate it on reconnect.
|
|
11
|
+
*
|
|
12
|
+
* @group Provision
|
|
13
|
+
*
|
|
14
|
+
* @param host - The host element.
|
|
15
|
+
* @param options - Provisioning options.
|
|
16
|
+
* @param options.container - External container instance to provide.
|
|
17
|
+
* @param options.options - Managed container creation options.
|
|
18
|
+
* @returns An instance of {@link ContainerProvider}.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* class MyRootElement extends LitElement {
|
|
23
|
+
* private containerProvider: ContainerProvider = useContainerProvision(this, {
|
|
24
|
+
* options: {
|
|
25
|
+
* entries: [LoggerService],
|
|
26
|
+
* activate: [LoggerService],
|
|
27
|
+
* },
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* class MyRootElement extends LitElement {
|
|
35
|
+
* private containerProvider: ContainerProvider = useContainerProvision(this, { container: container });
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function useContainerProvision(host, options) {
|
|
40
|
+
return new ContainerProvider(host, options);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { useContainerProvision };
|
|
44
|
+
//# sourceMappingURL=use-container-provision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-container-provision.js","sources":["../../../../../../../../src/wirestate-lit/provision/use-container-provision.ts"],"sourcesContent":[null],"names":["useContainerProvision","host","options","ContainerProvider"],"mappings":";;AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;AACG,SAAUA,qBAAqBA,CACnCC,IAAO,EACPC,OAAqC,EAAA;AAErC,EAAA,OAAO,IAAIC,iBAAiB,CAACF,IAAI,EAAEC,OAAO,CAAC;AAC7C;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SubContainerProvider } from './sub-container-provider.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook that provides a managed child container for the host element's lifetime.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* The child container is derived from the current parent
|
|
8
|
+
* {@link ContainerContext}, recreated when that parent context changes, and
|
|
9
|
+
* destroyed when the host disconnects.
|
|
10
|
+
*
|
|
11
|
+
* @group Provision
|
|
12
|
+
*
|
|
13
|
+
* @param host - The host element.
|
|
14
|
+
* @param options - Provisioning options.
|
|
15
|
+
* @param options.options - Child-container creation options.
|
|
16
|
+
* @returns An instance of {@link SubContainerProvider}.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* class MyComponent extends LitElement {
|
|
21
|
+
* private containerProvider: SubContainerProvider = useSubContainerProvider(this, {
|
|
22
|
+
* options: {
|
|
23
|
+
* entries: [AuthService, UserService],
|
|
24
|
+
* },
|
|
25
|
+
* });
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
function useSubContainerProvider(host, options) {
|
|
30
|
+
return new SubContainerProvider(host, options);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { useSubContainerProvider };
|
|
34
|
+
//# sourceMappingURL=use-sub-container-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sub-container-provider.js","sources":["../../../../../../../../src/wirestate-lit/provision/use-sub-container-provider.ts"],"sourcesContent":[null],"names":["useSubContainerProvider","host","options","SubContainerProvider"],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,SAAUA,uBAAuBA,CACrCC,IAAO,EACPC,OAAoC,EAAA;AAEpC,EAAA,OAAO,IAAIC,oBAAoB,CAAIF,IAAI,EAAEC,OAAO,CAAC;AACnD;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextConsumer } from '@lit/context';
|
|
2
2
|
import { QueryBus } from '@wirestate/core';
|
|
3
|
-
import {
|
|
3
|
+
import { ContainerContext } from '../context/container-context.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Reactive controller that registers a query handler on the {@link QueryBus} for the host element's lifetime.
|
|
@@ -25,10 +25,10 @@ var OnQueryController = /** @class */function () {
|
|
|
25
25
|
this.type = type;
|
|
26
26
|
this.handler = handler;
|
|
27
27
|
new ContextConsumer(host, {
|
|
28
|
-
context:
|
|
28
|
+
context: ContainerContext,
|
|
29
29
|
subscribe: true,
|
|
30
|
-
callback: function (
|
|
31
|
-
_this.bus =
|
|
30
|
+
callback: function (container) {
|
|
31
|
+
_this.bus = container.get(QueryBus);
|
|
32
32
|
if (host.isConnected) {
|
|
33
33
|
_this.reregister();
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-query-controller.js","sources":["../../../../../../../../src/wirestate-lit/queries/on-query-controller.ts"],"sourcesContent":[null],"names":["OnQueryController","host","type","handler","_this","bus","unregister","addController","ContextConsumer","context","
|
|
1
|
+
{"version":3,"file":"on-query-controller.js","sources":["../../../../../../../../src/wirestate-lit/queries/on-query-controller.ts"],"sourcesContent":[null],"names":["OnQueryController","host","type","handler","_this","bus","unregister","addController","ContextConsumer","context","ContainerContext","subscribe","callback","container","get","QueryBus","isConnected","reregister","prototype","hostConnected","hostDisconnected","cleanup","register","_a","call"],"mappings":";;;;AAUA;;;;;;;;AAQG;AACH,IAAAA,iBAAA,gBAAA,YAAA;AAOE;;;;AAIG;AACH,EAAA,SAAAA,iBAAAA,CAAmBC,IAAqB,EAAEC,IAAe,EAAEC,OAA2B,EAAA;IAAtF,IAAAC,KAAA,GAAA,IAAA;IAXQ,IAAA,CAAAC,GAAG,GAAuB,IAAI;IAC9B,IAAA,CAAAC,UAAU,GAA8B,IAAI;AAWlDL,IAAAA,IAAI,CAACM,aAAa,CAAC,IAAI,CAAC;IAExB,IAAI,CAACL,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,OAAO,GAAGA,OAAO;IAItB,IAAIK,eAAe,CAACP,IAAI,EAAE;AACxBQ,MAAAA,OAAO,EAAEC,gBAAgB;AACzBC,MAAAA,SAAS,EAAE,IAAI;AACfC,MAAAA,QAAQ,EAAE,UAACC,SAAS,EAAA;QAClBT,KAAI,CAACC,GAAG,GAAGQ,SAAS,CAACC,GAAG,CAACC,QAAQ,CAAC;QAElC,IAAId,IAAI,CAACe,WAAW,EAAE;UACpBZ,KAAI,CAACa,UAAU,EAAE;AACnB,QAAA;AACF,MAAA;AACD,KAAA,CAAC;AACJ,EAAA;AAEOjB,EAAAA,iBAAA,CAAAkB,SAAA,CAAAC,aAAa,GAApB,YAAA;IAEE,IAAI,CAACF,UAAU,EAAE;EACnB,CAAC;AAEMjB,EAAAA,iBAAA,CAAAkB,SAAA,CAAAE,gBAAgB,GAAvB,YAAA;IAEE,IAAI,CAACC,OAAO,EAAE;EAChB,CAAC;AAEOrB,EAAAA,iBAAA,CAAAkB,SAAA,CAAAD,UAAU,GAAlB,YAAA;IACE,IAAI,CAACI,OAAO,EAAE;IAEd,IAAI,IAAI,CAAChB,GAAG,EAAE;AAEZ,MAAA,IAAI,CAACC,UAAU,GAAG,IAAI,CAACD,GAAG,CAACiB,QAAQ,CAAC,IAAI,CAACpB,IAAI,EAAE,IAAI,CAACC,OAAO,CAAC;AAC9D,IAAA;EACF,CAAC;AAEOH,EAAAA,iBAAA,CAAAkB,SAAA,CAAAG,OAAO,GAAf,YAAA;;IACE,CAAAE,EAAA,GAAA,IAAI,CAACjB,UAAU,MAAA,IAAA,IAAAiB,EAAA,KAAA,MAAA,GAAA,MAAA,GAAAA,EAAA,CAAAC,IAAA,CAAA,IAAA,CAAI;IACnB,IAAI,CAAClB,UAAU,GAAG,IAAI;EACxB,CAAC;AACH,EAAA,OAAAN,iBAAC;AAAD,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContextConsumer as t}from"@lit/context";import{CommandBus as e}from"@wirestate/core";import{
|
|
1
|
+
import{ContextConsumer as t}from"@lit/context";import{CommandBus as e}from"@wirestate/core";import{ContainerContext as r}from"../context/container-context.js";var i=function(){function i(i,n,s){var o=this;this.bus=null,this.unregister=null,i.addController(this),this.type=n,this.handler=s,new t(i,{context:r,subscribe:!0,callback:function(t){o.bus=t.get(e),i.isConnected&&o.reregister()}})}return i.prototype.hostConnected=function(){this.reregister()},i.prototype.hostDisconnected=function(){this.cleanup()},i.prototype.reregister=function(){this.cleanup(),this.bus&&(this.unregister=this.bus.register(this.type,this.handler))},i.prototype.cleanup=function(){var t;null===(t=this.unregister)||void 0===t||t.call(this),this.unregister=null},i}();export{i as OnCommandController};//# sourceMappingURL=on-command-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-command-controller.js","sources":["../../../../../../../../src/wirestate-lit/commands/on-command-controller.ts"],"sourcesContent":[null],"names":["ContextConsumer","CommandBus","
|
|
1
|
+
{"version":3,"file":"on-command-controller.js","sources":["../../../../../../../../src/wirestate-lit/commands/on-command-controller.ts"],"sourcesContent":[null],"names":["ContextConsumer","CommandBus","ContainerContext","OnCommandController","host","type","handler","_this","this","bus","unregister","addController","context","subscribe","callback","container","get","isConnected","reregister","prototype","hostConnected","hostDisconnected","cleanup","register","_a","call"],"mappings":"0BAUAA,MAAA,oCAAAC,MAAA,6CAAAC,MAAA,kCASA,IAAAC,EAAA,WAYE,SAAAA,EAAmBC,EAAuBC,EAAmBC,GAA7D,IAAAC,EAAAC,KAXQA,KAAAC,IAA4B,KAC5BD,KAAAE,WAA0C,KAahDN,EAAKO,cAAcH,MAEnBA,KAAKH,KAAOA,EACZG,KAAKF,QAAUA,EAEf,IAAIN,EAAgBI,EAAM,CACxBQ,QAASV,EACTW,WAAW,EACXC,SAAU,SAACC,GACTR,EAAKE,IAAMM,EAAUC,IAAIf,GAErBG,EAAKa,aACPV,EAAKW,YAET,GAEJ,CA2BF,OAzBSf,EAAAgB,UAAAC,cAAP,WAEEZ,KAAKU,YACP,EAEOf,EAAAgB,UAAAE,iBAAP,WAEEb,KAAKc,SACP,EAEQnB,EAAAgB,UAAAD,WAAR,WACEV,KAAKc,UAEDd,KAAKC,MAEPD,KAAKE,WAAaF,KAAKC,IAAIc,SAASf,KAAKH,KAAMG,KAAKF,SAExD,EAEQH,EAAAgB,UAAAG,QAAR,iBAGiB,QAAfE,EAAAhB,KAAKE,kBAAU,IAAAc,GAAAA,EAAAC,KAAAjB,MACfA,KAAKE,WAAa,IACpB,EACFP,CAAA,CA1DA,UA0DCA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContextConsumer as t}from"@lit/context";import{
|
|
1
|
+
import{ContextConsumer as t}from"@lit/context";import{ContainerContext as n}from"../context/container-context.js";function c(c){var i="object"==typeof c&&null!==c&&"injectionId"in c?c:{injectionId:c};return function(c,o){var e=i.injectionId,r=i.once;"object"==typeof o?o.addInitializer((function(){var i=this;new t(this,{context:n,callback:function(t){c.set.call(i,t.get(e))},subscribe:!r})})):c.constructor.addInitializer((function(c){new t(c,{context:n,callback:function(t){c[o]=t.get(e)},subscribe:!r})}))}}export{c as injection};//# sourceMappingURL=injection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injection.js","sources":["../../../../../../../../src/wirestate-lit/consumption/injection.ts"],"sourcesContent":[null],"names":["ContextConsumer","
|
|
1
|
+
{"version":3,"file":"injection.js","sources":["../../../../../../../../src/wirestate-lit/consumption/injection.ts"],"sourcesContent":[null],"names":["ContextConsumer","ContainerContext","injection","optionsOrInjectionId","options","injectionId","protoOrTarget","nameOrContext","once","addInitializer","_this","this","context","callback","container","set","call","get","subscribe","constructor","element"],"mappings":"0BAgDAA,MAAA,0CAAAC,MAAA,kCAgCM,SAAUC,EAAaC,GAC3B,IAAMC,EAC4B,iBAAzBD,GAA8D,OAAzBA,GAAiC,gBAAiBA,EAC1FA,EACA,CAAEE,YAAaF,GAErB,OAAQ,SACNG,EACAC,GAEQ,IAAAF,EAAsBD,EAAOC,YAAhBG,EAASJ,EAAOI,KAGR,iBAAlBD,EACTA,EAAcE,gBAAe,WAAA,IAAAC,EAAAC,KAC3B,IAAIX,EAAgBW,KAAM,CACxBC,QAASX,EACTY,SAAU,SAACC,GACTR,EAAcS,IAAIC,KAAKN,EAAMI,EAAUG,IAAIZ,GAC7C,EACAa,WAAYV,GAEhB,IAGCF,EAAca,YAAuCV,gBAAe,SAACW,GACpE,IAAIpB,EAAgBoB,EAAS,CAC3BR,QAASX,EACTY,SAAU,SAACC,GACRM,EAAsBb,GAAiBO,EAAUG,IAAIZ,EACxD,EACAa,WAAYV,GAEhB,GAEJ,CACF,QAAAN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ContextConsumer as t}from"@lit/context";import{ContainerContext as n}from"../context/container-context.js";function o(o){var e={value:null};return new t(o,{context:n,callback:function(t){e.value=t}}),e}export{o as useContainer};//# sourceMappingURL=use-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-container.js","sources":["../../../../../../../../src/wirestate-lit/consumption/use-container.ts"],"sourcesContent":[null],"names":["ContextConsumer","ContainerContext","useContainer","host","current","value","context","callback","container"],"mappings":"0BAqBAA,MAAA,0CAAAC,MAAA,kCAsBM,SAAUC,EAA6DC,GAK3E,IAAMC,EAA6B,CAAEC,MAAO,MAS5C,OAPA,IAAIL,EAAgBG,EAAM,CACxBG,QAASL,EACTM,SAAU,SAACC,GACTJ,EAAQC,MAAQG,CAClB,IAGKJ,CACT,QAAAF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContextConsumer as n}from"@lit/context";import{
|
|
1
|
+
import{ContextConsumer as n}from"@lit/context";import{ContainerContext as t}from"../context/container-context.js";function e(e,o){var c="object"==typeof o&&null!==o&&"injectionId"in o?o:{injectionId:o},i=c.once,r=c.injectionId,l={value:c.value,injectionId:r};return new n(e,{context:t,subscribe:!i,callback:function(n){l.value=n.get(r)}}),l}export{e as useInjection};//# sourceMappingURL=use-injection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-injection.js","sources":["../../../../../../../../src/wirestate-lit/consumption/use-injection.ts"],"sourcesContent":[null],"names":["ContextConsumer","
|
|
1
|
+
{"version":3,"file":"use-injection.js","sources":["../../../../../../../../src/wirestate-lit/consumption/use-injection.ts"],"sourcesContent":[null],"names":["ContextConsumer","ContainerContext","useInjection","host","optionsOrInjectionId","options","injectionId","once","current","value","context","subscribe","callback","container","get"],"mappings":"0BAkDAA,MAAA,0CAAAC,MAAA,kCA+BM,SAAUC,EACdC,EACAC,GAEA,IAAMC,EAC4B,iBAAzBD,GAA8D,OAAzBA,GAAiC,gBAAiBA,EAC1FA,EACA,CAAEE,YAAaF,GAEbG,EAA6BF,EAAOE,KAA9BD,EAAuBD,EAAOC,YAQtCE,EAAgC,CAAEC,MARHJ,QAQiCC,YAAWA,GAUjF,OARA,IAAIN,EAAgBG,EAAM,CACxBO,QAAST,EACTU,WAAYJ,EACZK,SAAU,SAACC,GACTL,EAAQC,MAAQI,EAAUC,IAAIR,EAChC,IAGKE,CACT,QAAAN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ContextConsumer as t}from"@lit/context";import{WireScope as o}from"@wirestate/core";import{ContainerContext as e}from"../context/container-context.js";function n(n){var r={value:void 0,injectionId:o};return new t(n,{context:e,subscribe:!0,callback:function(t){r.value=t.get(o)}}),r}export{n as useScope};//# sourceMappingURL=use-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scope.js","sources":["../../../../../../../../src/wirestate-lit/consumption/use-scope.ts"],"sourcesContent":[null],"names":["ContextConsumer","WireScope","ContainerContext","useScope","host","current","value","undefined","injectionId","context","subscribe","callback","container","get"],"mappings":"0BAkBAA,MAAA,mCAAAC,MAAA,6CAAAC,MAAA,kCAuBM,SAAUC,EAAyDC,GAMvE,IAAMC,EAAwC,CAAEC,WAAOC,EAAmCC,YAAaP,GAUvG,OARA,IAAID,EAAgBI,EAAM,CACxBK,QAASP,EACTQ,WAAW,EACXC,SAAU,SAACC,GACTP,EAAQC,MAAQM,EAAUC,IAAIZ,EAChC,IAGKI,CACT,QAAAF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as t}from"@lit/context";var o=Symbol("ContainerContext"),r=t(o);export{o as CONTAINER_KEY,r as ContainerContext};//# sourceMappingURL=container-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-context.js","sources":["../../../../../../../../src/wirestate-lit/context/container-context.ts"],"sourcesContent":[null],"names":["createContext","CONTAINER_KEY","Symbol","ContainerContext"],"mappings":"wBAGAA,MAAA,mBAKaC,EAA+BC,OAAO,oBAOtCC,EAAmBH,EAAyBC,UAAaA,mBAAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContextConsumer as t}from"@lit/context";import{EventBus as s}from"@wirestate/core";import{
|
|
1
|
+
import{ContextConsumer as t}from"@lit/context";import{EventBus as s}from"@wirestate/core";import{ContainerContext as i}from"../context/container-context.js";var e=function(){function e(e,n,r){var u=this;this.bus=null,this.unsubscriber=null,e.addController(this),this.types=n,this.handler=r,new t(e,{context:i,subscribe:!0,callback:function(t){u.bus=t.get(s),e.isConnected&&u.resubscribe()}})}return e.prototype.hostConnected=function(){this.resubscribe()},e.prototype.hostDisconnected=function(){this.cleanup()},e.prototype.resubscribe=function(){var t=this;this.cleanup(),this.bus&&(null===this.types?this.unsubscriber=this.bus.subscribe(this.handler):this.unsubscriber=this.bus.subscribe((function(s){t.types.includes(s.type)&&t.handler(s)})))},e.prototype.cleanup=function(){var t;null===(t=this.unsubscriber)||void 0===t||t.call(this),this.unsubscriber=null},e}();export{e as OnEventController};//# sourceMappingURL=on-event-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-event-controller.js","sources":["../../../../../../../../src/wirestate-lit/events/on-event-controller.ts"],"sourcesContent":[null],"names":["ContextConsumer","EventBus","
|
|
1
|
+
{"version":3,"file":"on-event-controller.js","sources":["../../../../../../../../src/wirestate-lit/events/on-event-controller.ts"],"sourcesContent":[null],"names":["ContextConsumer","EventBus","ContainerContext","OnEventController","host","types","handler","_this","this","bus","unsubscriber","addController","context","subscribe","callback","container","get","isConnected","resubscribe","prototype","hostConnected","hostDisconnected","cleanup","event","includes","type","_a","call"],"mappings":"0BAUAA,MAAA,kCAAAC,MAAA,6CAAAC,MAAA,kCASA,IAAAC,EAAA,WAYE,SAAAA,EAAmBC,EAAuBC,EAA2CC,GAArF,IAAAC,EAAAC,KAXQA,KAAAC,IAA0B,KAC1BD,KAAAE,aAA4C,KAalDN,EAAKO,cAAcH,MAEnBA,KAAKH,MAAQA,EACbG,KAAKF,QAAUA,EAEf,IAAIN,EAAgBI,EAAM,CACxBQ,QAASV,EACTW,WAAW,EACXC,SAAU,SAACC,GACTR,EAAKE,IAAMM,EAAUC,IAAIf,GAErBG,EAAKa,aACPV,EAAKW,aAET,GAEJ,CAoCF,OAlCSf,EAAAgB,UAAAC,cAAP,WAEEZ,KAAKU,aACP,EAEOf,EAAAgB,UAAAE,iBAAP,WAEEb,KAAKc,SACP,EAEQnB,EAAAgB,UAAAD,YAAR,WAAA,IAAAX,EAAAC,KACEA,KAAKc,UAEDd,KAAKC,MAGY,OAAfD,KAAKH,MACPG,KAAKE,aAAeF,KAAKC,IAAII,UAAUL,KAAKF,SAE5CE,KAAKE,aAAeF,KAAKC,IAAII,WAAU,SAACU,GACjChB,EAAKF,MAAmCmB,SAASD,EAAME,OAC1DlB,EAAKD,QAAQiB,EAEjB,IAGN,EAEQpB,EAAAgB,UAAAG,QAAR,iBAGmB,QAAjBI,EAAAlB,KAAKE,oBAAY,IAAAgB,GAAAA,EAAAC,KAAAnB,MACjBA,KAAKE,aAAe,IACtB,EACFP,CAAA,CAnEA,UAmECA"}
|
package/esm/production/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{injection}from"./consumption/injection.js";export{useInjection}from"./consumption/use-injection.js";export{onCommand}from"./commands/on-command.js";export{OnCommandController}from"./commands/on-command-controller.js";export{useOnCommand}from"./commands/use-on-command.js";export{onEvent}from"./events/on-event.js";export{OnEventController}from"./events/on-event-controller.js";export{useOnEvents}from"./events/use-on-events.js";export{onQuery}from"./queries/on-query.js";export{OnQueryController}from"./queries/on-query-controller.js";export{useOnQuery}from"./queries/use-on-query.js";export{
|
|
1
|
+
export{injection}from"./consumption/injection.js";export{useContainer}from"./consumption/use-container.js";export{useInjection}from"./consumption/use-injection.js";export{useScope}from"./consumption/use-scope.js";export{onCommand}from"./commands/on-command.js";export{OnCommandController}from"./commands/on-command-controller.js";export{useOnCommand}from"./commands/use-on-command.js";export{onEvent}from"./events/on-event.js";export{OnEventController}from"./events/on-event-controller.js";export{useOnEvents}from"./events/use-on-events.js";export{onQuery}from"./queries/on-query.js";export{OnQueryController}from"./queries/on-query-controller.js";export{useOnQuery}from"./queries/use-on-query.js";export{ContainerContext}from"./context/container-context.js";export{ContainerProvider}from"./provision/container-provider.js";export{SubContainerProvider}from"./provision/sub-container-provider.js";export{containerProvide}from"./provision/container-provide.js";export{subContainerProvide}from"./provision/sub-container-provide.js";export{useContainerProvision}from"./provision/use-container-provision.js";export{useSubContainerProvider}from"./provision/use-sub-container-provider.js";//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ContainerProvider as n}from"./container-provider.js";function t(t){return function(e,i){var r;if("object"!=typeof i)return e.constructor.addInitializer((function(e){r=new n(e,t)})),{get:function(){return r},set:function(){},configurable:!0,enumerable:!0};i.addInitializer((function(){e.set.call(this,new n(this,t))}))}}export{t as containerProvide};//# sourceMappingURL=container-provide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-provide.js","sources":["../../../../../../../../src/wirestate-lit/provision/container-provide.ts"],"sourcesContent":[null],"names":["ContainerProvider","containerProvide","options","protoOrTarget","nameOrContext","controller_1","constructor","addInitializer","element","get","set","configurable","enumerable","call","this"],"mappings":"4BA2BAA,MAAA,0BAwCM,SAAUC,EACdC,GAEA,OAAQ,SACNC,EACAC,GAQE,IAAIC,EANN,GAA6B,iBAAlBD,EAYT,OAJCD,EAAcG,YAAuCC,gBAAe,SAACC,GACpEH,EAAa,IAAIL,EAAkBQ,EAAcN,EACnD,IAEO,CACLO,IAAG,WACD,OAAOJ,CACT,EACAK,eAAa,EACbC,cAAc,EACdC,YAAY,GAhBdR,EAAcG,gBAAe,WAC3BJ,EAAcO,IAAIG,KAAKC,KAAM,IAAId,EAAkBc,KAAsBZ,GAC3E,GAiBJ,CACF,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__extends as t,__assign as o}from"tslib";import{ContextProvider as i}from"@lit/context";import{WirestateError as e,createContainer as n}from"@wirestate/core";import{ContainerContext as r}from"../context/container-context.js";import{ERROR_CODE_INVALID_ARGUMENTS as s}from"../error/error-code.js";var a=function(i){function a(t,a){var c=this;if(!a.container&&!a.options)throw new e(s,"ContainerProvider requires a valid container instance or creation options.");if(a.container&&a.options)throw new e(s,"ContainerProvider requires only container or valid options object to be provided.");return(c=i.call(this,t,{context:r,initialValue:a.container?a.container:n(o(o({},a.options),{activate:[]}))})||this).destroyed=!1,c.options=a.options,c}return t(a,i),a.prototype.hostConnected=function(){var t;if(this.options)if(this.destroyed)this.value=n(this.options),this.destroyed=!1;else if(null===(t=this.options)||void 0===t?void 0:t.activate)for(var o=0,e=this.options.activate;o<e.length;o++){var r=e[o];this.value.get(r)}i.prototype.hostConnected.call(this)},a.prototype.hostDisconnected=function(){this.options&&(this.value.unbindAll(),this.destroyed=!0)},a}(i);export{a as ContainerProvider};//# sourceMappingURL=container-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-provider.js","sources":["../../../../../../../../src/wirestate-lit/provision/container-provider.ts"],"sourcesContent":[null],"names":["__extends","__assign","ContextProvider","WirestateError","createContainer","ContainerContext","ERROR_CODE_INVALID_ARGUMENTS","ContainerProvider","_super","host","options","_this","this","container","call","context","initialValue","activate","destroyed","prototype","hostConnected","value","_a","_i","_b","length","entry","get","hostDisconnected","unbindAll"],"mappings":"oBAyCAA,cAAAC,MAAA,kCAAAC,MAAA,wCAAAC,qBAAAC,MAAA,6CAAAC,MAAA,yEAAAC,MAAA,yBAeA,IAAAC,EAAA,SAAAC,GAcE,SAAAD,EAAmBE,EAASC,GAA5B,IAAAC,EAAAC,KACE,IAAKF,EAAQG,YAAcH,EAAQA,QACjC,MAAM,IAAIP,EACRG,EACA,8EAEG,GAAII,EAAQG,WAAaH,EAAQA,QACtC,MAAM,IAAIP,EACRG,EACA,4FAIJK,EAAAH,EAAKM,KAAAF,KAACH,EAAM,CACVM,QAASV,EACTW,aAAcN,EAAQG,UAAYH,EAAQG,UAAYT,SAAqBM,EAAQA,SAAO,CAAEO,SAAU,SACtGL,MAxBMM,WAAqB,EA0B7BP,EAAKD,QAAUA,EAAQA,SAQzB,CAqCF,OA5EUV,EAAAO,EAAAC,GAyCDD,EAAAY,UAAAC,cAAP,iBACE,GAAIR,KAAKF,QACP,GAAIE,KAAKM,UAKPN,KAAKS,MAAQjB,EAAgBQ,KAAKF,SAClCE,KAAKM,WAAY,OAEjB,GAAgB,UAAZN,KAAKF,eAAO,IAAAY,OAAA,EAAAA,EAAEL,SAKhB,IAAoB,IAAAM,EAAA,EAAAC,EAAAZ,KAAKF,QAAQO,SAAbM,EAAAC,EAAAC,OAAAF,IAAuB,CAAtC,IAAMG,EAAKF,EAAAD,GACdX,KAAKS,MAAMM,IAAID,EACjB,CAKNlB,EAAAW,UAAMC,cAAaN,KAAAF,KACrB,EAEOL,EAAAY,UAAAS,iBAAP,WACMhB,KAAKF,UAKPE,KAAKS,MAAMQ,YACXjB,KAAKM,WAAY,EAErB,EACFX,CAAA,CA7EA,CACUL,UAAeK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SubContainerProvider as n}from"./sub-container-provider.js";function t(t){return function(e,i){var r;if("object"!=typeof i)return e.constructor.addInitializer((function(e){r=new n(e,t)})),{get:function(){return r},set:function(){},configurable:!0,enumerable:!0};i.addInitializer((function(){e.set.call(this,new n(this,t))}))}}export{t as subContainerProvide};//# sourceMappingURL=sub-container-provide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-container-provide.js","sources":["../../../../../../../../src/wirestate-lit/provision/sub-container-provide.ts"],"sourcesContent":[null],"names":["SubContainerProvider","subContainerProvide","options","protoOrTarget","nameOrContext","provider_1","constructor","addInitializer","element","get","set","configurable","enumerable","call","this"],"mappings":"+BA2BAA,MAAA,8BA4BM,SAAUC,EACdC,GAEA,OAAQ,SACNC,EACAC,GAQE,IAAIC,EANN,GAA6B,iBAAlBD,EAYT,OAJCD,EAAcG,YAAuCC,gBAAe,SAACC,GACpEH,EAAW,IAAIL,EAAqBQ,EAAcN,EACpD,IAEO,CACLO,IAAG,WACD,OAAOJ,CACT,EACAK,eAAa,EACbC,cAAc,EACdC,YAAY,GAhBdR,EAAcG,gBAAe,WAC3BJ,EAAcO,IAAIG,KAAKC,KAAM,IAAId,EAAqBc,KAAyBZ,GACjF,GAiBJ,CACF,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__extends as t,__assign as e}from"tslib";import{ContextConsumer as o,ContextProvider as n}from"@lit/context";import{createContainer as r}from"@wirestate/core";import{ContainerContext as i}from"../context/container-context.js";var s=function(n){function s(t,e){var r=n.call(this,t,{context:i})||this;return r.parent=null,r.destroyed=!0,r.options=e.options,r.consumer=new o(t,{context:i,subscribe:!0,callback:function(e){var o=r.parent;r.parent=e,t.isConnected&&(!r.destroyed&&r.value&&o===e||(r.destroyContainer(),r.createContainer()))}}),r}return t(s,n),s.prototype.hostConnected=function(){!this.parent||!this.destroyed&&this.value||(this.destroyContainer(),this.createContainer()),n.prototype.hostConnected.call(this)},s.prototype.hostDisconnected=function(){this.destroyContainer()},s.prototype.createContainer=function(){var t=r(e(e({},this.options),{parent:this.parent}));this.destroyed=!1,this.value=t},s.prototype.destroyContainer=function(){this.value&&!this.destroyed&&(this.value.unbindAll(),this.destroyed=!0)},s}(n);export{s as SubContainerProvider};//# sourceMappingURL=sub-container-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-container-provider.js","sources":["../../../../../../../../src/wirestate-lit/provision/sub-container-provider.ts"],"sourcesContent":[null],"names":["__extends","__assign","ContextConsumer","ContextProvider","createContainer","ContainerContext","SubContainerProvider","_super","host","options","_this","call","this","context","parent","destroyed","consumer","subscribe","callback","previousParent","isConnected","value","destroyContainer","prototype","hostConnected","hostDisconnected","container","unbindAll"],"mappings":"oBAkDAA,cAAAC,MAAA,kCAAAC,qBAAAC,MAAA,yCAAAC,MAAA,6CAAAC,MAAA,kCAwBA,IAAAC,EAAA,SAAAC,GAcE,SAAAD,EAAmBE,EAASC,GAC1B,IAAAC,EAAAH,EAAKI,KAAAC,KAACJ,EAAM,CACVK,QAASR,KACTO,YAVMF,EAAAI,OAA2B,KAC3BJ,EAAAK,WAAqB,EAa7BL,EAAKD,QAAUA,EAAQA,QAEvBC,EAAKM,SAAW,IAAId,EAAgBM,EAAM,CACxCK,QAASR,EACTY,WAAW,EACXC,SAAU,SAACL,GACT,IAAMM,EAAmCT,EAAKI,OAE9CJ,EAAKI,OAASD,EAEVL,EAAKY,eAMHV,EAAKK,WAAcL,EAAKW,OAASF,IAAmBN,IACtDH,EAAKY,mBACLZ,EAAKN,mBAQX,KAEJ,CA6DF,OA7GUJ,EAAAM,EAAAC,GAkDDD,EAAAiB,UAAAC,cAAP,YAOMZ,KAAKE,SAAWF,KAAKG,WAAcH,KAAKS,QAC1CT,KAAKU,mBACLV,KAAKR,mBAGPG,EAAAgB,UAAMC,cAAab,KAAAC,KACrB,EAEON,EAAAiB,UAAAE,iBAAP,WAOEb,KAAKU,kBACP,EAMUhB,EAAAiB,UAAAnB,gBAAV,WACE,IAAMsB,EAAuBtB,EAAeH,EAAAA,EAAA,GACvCW,KAAKH,SAAO,CACfK,OAAQF,KAAKE,UASfF,KAAKG,WAAY,EACjBH,KAAKS,MAAQK,CACf,EAKUpB,EAAAiB,UAAAD,iBAAV,WACMV,KAAKS,QAAUT,KAAKG,YAMtBH,KAAKS,MAAMM,YACXf,KAAKG,WAAY,EAErB,EACFT,CAAA,CA9GA,CACUH,UAAeG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ContainerProvider as r}from"./container-provider.js";function n(n,o){return new r(n,o)}export{n as useContainerProvision};//# sourceMappingURL=use-container-provision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-container-provision.js","sources":["../../../../../../../../src/wirestate-lit/provision/use-container-provision.ts"],"sourcesContent":[null],"names":["ContainerProvider","useContainerProvision","host","options"],"mappings":"4BAWAA,MAAA,0BAoCM,SAAUC,EACdC,EACAC,GAEA,OAAO,IAAIH,EAAkBE,EAAMC,EACrC,QAAAF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SubContainerProvider as r}from"./sub-container-provider.js";function n(n,o){return new r(n,o)}export{n as useSubContainerProvider};//# sourceMappingURL=use-sub-container-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sub-container-provider.js","sources":["../../../../../../../../src/wirestate-lit/provision/use-sub-container-provider.ts"],"sourcesContent":[null],"names":["SubContainerProvider","useSubContainerProvider","host","options"],"mappings":"+BAIAA,MAAA,8BA0BM,SAAUC,EACdC,EACAC,GAEA,OAAO,IAAIH,EAAwBE,EAAMC,EAC3C,QAAAF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContextConsumer as t}from"@lit/context";import{QueryBus as e}from"@wirestate/core";import{
|
|
1
|
+
import{ContextConsumer as t}from"@lit/context";import{QueryBus as e}from"@wirestate/core";import{ContainerContext as r}from"../context/container-context.js";var i=function(){function i(i,n,s){var o=this;this.bus=null,this.unregister=null,i.addController(this),this.type=n,this.handler=s,new t(i,{context:r,subscribe:!0,callback:function(t){o.bus=t.get(e),i.isConnected&&o.reregister()}})}return i.prototype.hostConnected=function(){this.reregister()},i.prototype.hostDisconnected=function(){this.cleanup()},i.prototype.reregister=function(){this.cleanup(),this.bus&&(this.unregister=this.bus.register(this.type,this.handler))},i.prototype.cleanup=function(){var t;null===(t=this.unregister)||void 0===t||t.call(this),this.unregister=null},i}();export{i as OnQueryController};//# sourceMappingURL=on-query-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-query-controller.js","sources":["../../../../../../../../src/wirestate-lit/queries/on-query-controller.ts"],"sourcesContent":[null],"names":["ContextConsumer","QueryBus","
|
|
1
|
+
{"version":3,"file":"on-query-controller.js","sources":["../../../../../../../../src/wirestate-lit/queries/on-query-controller.ts"],"sourcesContent":[null],"names":["ContextConsumer","QueryBus","ContainerContext","OnQueryController","host","type","handler","_this","this","bus","unregister","addController","context","subscribe","callback","container","get","isConnected","reregister","prototype","hostConnected","hostDisconnected","cleanup","register","_a","call"],"mappings":"0BAUAA,MAAA,kCAAAC,MAAA,6CAAAC,MAAA,kCASA,IAAAC,EAAA,WAYE,SAAAA,EAAmBC,EAAuBC,EAAiBC,GAA3D,IAAAC,EAAAC,KAXQA,KAAAC,IAA0B,KAC1BD,KAAAE,WAAwC,KAW9CN,EAAKO,cAAcH,MAEnBA,KAAKH,KAAOA,EACZG,KAAKF,QAAUA,EAIf,IAAIN,EAAgBI,EAAM,CACxBQ,QAASV,EACTW,WAAW,EACXC,SAAU,SAACC,GACTR,EAAKE,IAAMM,EAAUC,IAAIf,GAErBG,EAAKa,aACPV,EAAKW,YAET,GAEJ,CAyBF,OAvBSf,EAAAgB,UAAAC,cAAP,WAEEZ,KAAKU,YACP,EAEOf,EAAAgB,UAAAE,iBAAP,WAEEb,KAAKc,SACP,EAEQnB,EAAAgB,UAAAD,WAAR,WACEV,KAAKc,UAEDd,KAAKC,MAEPD,KAAKE,WAAaF,KAAKC,IAAIc,SAASf,KAAKH,KAAMG,KAAKF,SAExD,EAEQH,EAAAgB,UAAAG,QAAR,iBACiB,QAAfE,EAAAhB,KAAKE,kBAAU,IAAAc,GAAAA,EAAAC,KAAAjB,MACfA,KAAKE,WAAa,IACpB,EACFP,CAAA,CAxDA,UAwDCA"}
|