@limetech/lime-web-components 4.48.2 → 4.49.1-alpha.4
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 +145 -1
- package/README.md +1 -1
- package/dist/application/decorators/application.d.ts +8 -0
- package/dist/application/decorators/application.js +18 -0
- package/dist/application/decorators/index.d.ts +3 -0
- package/dist/application/decorators/index.js +3 -0
- package/dist/application/decorators/session.d.ts +8 -0
- package/dist/application/decorators/session.js +18 -0
- package/dist/application/decorators/user.d.ts +8 -0
- package/dist/application/decorators/user.js +18 -0
- package/dist/application/index.d.ts +4 -0
- package/dist/application/index.js +4 -0
- package/dist/application/session.d.ts +67 -0
- package/dist/application/session.js +1 -0
- package/dist/application/types.d.ts +14 -0
- package/dist/application/types.js +3 -0
- package/dist/application/user.d.ts +59 -0
- package/dist/application/user.js +1 -0
- package/dist/commandbus/commandbus.d.ts +112 -0
- package/dist/commandbus/commandbus.js +63 -0
- package/dist/commandbus/index.d.ts +2 -0
- package/dist/commandbus/index.js +2 -0
- package/dist/commandbus/types.d.ts +14 -0
- package/dist/commandbus/types.js +3 -0
- package/dist/config/decorator.d.ts +14 -0
- package/dist/config/decorator.js +14 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +3 -0
- package/dist/config/repository.d.ts +17 -0
- package/dist/config/repository.js +1 -0
- package/dist/config/types.d.ts +14 -0
- package/dist/config/types.js +3 -0
- package/dist/core/context.d.ts +17 -0
- package/dist/core/context.js +1 -0
- package/dist/core/decorators/factory.d.ts +29 -0
- package/dist/core/decorators/factory.js +243 -0
- package/dist/core/decorators/factory.spec.d.ts +1 -0
- package/dist/core/decorators/factory.spec.js +337 -0
- package/dist/core/decorators/index.d.ts +1 -0
- package/dist/core/decorators/index.js +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +6 -0
- package/dist/core/lime-web-component.d.ts +15 -0
- package/dist/core/lime-web-component.js +1 -0
- package/dist/core/platform.d.ts +38 -0
- package/dist/core/platform.js +6 -0
- package/dist/core/plugin-loader.d.ts +28 -0
- package/dist/core/plugin-loader.js +1 -0
- package/dist/core/state.d.ts +39 -0
- package/dist/core/state.js +1 -0
- package/dist/device/decorator.d.ts +16 -0
- package/dist/device/decorator.js +16 -0
- package/dist/device/device.d.ts +21 -0
- package/dist/device/device.js +1 -0
- package/dist/device/index.d.ts +3 -0
- package/dist/device/index.js +3 -0
- package/dist/device/types.d.ts +14 -0
- package/dist/device/types.js +3 -0
- package/dist/dialog/dialog.d.ts +41 -0
- package/dist/dialog/dialog.js +1 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +2 -0
- package/dist/dialog/types.d.ts +14 -0
- package/dist/dialog/types.js +3 -0
- package/dist/es5/application/decorators/application.js +18 -0
- package/dist/es5/application/decorators/index.js +6 -0
- package/dist/es5/application/decorators/session.js +18 -0
- package/dist/es5/application/decorators/user.js +18 -0
- package/dist/es5/application/index.js +7 -0
- package/dist/es5/application/session.js +2 -0
- package/dist/es5/application/types.js +5 -0
- package/dist/es5/application/user.js +2 -0
- package/dist/es5/commandbus/commandbus.js +31 -0
- package/dist/es5/commandbus/index.js +5 -0
- package/dist/es5/commandbus/types.js +5 -0
- package/dist/es5/config/decorator.js +12 -0
- package/dist/es5/config/index.js +6 -0
- package/dist/es5/config/repository.js +2 -0
- package/dist/es5/config/types.js +5 -0
- package/dist/es5/core/context.js +2 -0
- package/dist/es5/core/decorators/factory.js +213 -0
- package/dist/es5/core/decorators/factory.spec.js +495 -0
- package/dist/es5/core/decorators/index.js +2 -0
- package/dist/es5/core/index.js +9 -0
- package/dist/es5/core/lime-web-component.js +2 -0
- package/dist/es5/core/platform.js +6 -0
- package/dist/es5/core/plugin-loader.js +2 -0
- package/dist/es5/core/state.js +2 -0
- package/dist/es5/device/decorator.js +13 -0
- package/dist/es5/device/device.js +2 -0
- package/dist/es5/device/index.js +6 -0
- package/dist/es5/device/types.js +5 -0
- package/dist/es5/dialog/dialog.js +2 -0
- package/dist/es5/dialog/index.js +5 -0
- package/dist/es5/dialog/types.js +5 -0
- package/dist/es5/eventdispatcher/eventdispatcher.js +2 -0
- package/dist/es5/eventdispatcher/index.js +5 -0
- package/dist/es5/eventdispatcher/types.js +5 -0
- package/dist/es5/filter/decorator.js +13 -0
- package/dist/es5/filter/index.js +6 -0
- package/dist/es5/filter/repository.js +2 -0
- package/dist/es5/filter/types.js +5 -0
- package/dist/es5/http/http.js +2 -0
- package/dist/es5/http/index.js +5 -0
- package/dist/es5/http/types.js +5 -0
- package/dist/es5/index.js +22 -0
- package/dist/es5/keybindings/index.js +5 -0
- package/dist/es5/keybindings/registry.js +2 -0
- package/dist/es5/keybindings/types.js +5 -0
- package/dist/es5/limeobject/commands/bulk-create-dialog.js +17 -0
- package/dist/es5/limeobject/commands/create-dialog.js +17 -0
- package/dist/es5/limeobject/commands/delete-object.js +16 -0
- package/dist/es5/limeobject/commands/index.js +8 -0
- package/dist/es5/limeobject/commands/object-access.js +16 -0
- package/dist/es5/limeobject/commands/save-object.js +17 -0
- package/dist/es5/limeobject/decorator.js +38 -0
- package/dist/es5/limeobject/error.js +2 -0
- package/dist/es5/limeobject/index.js +9 -0
- package/dist/es5/limeobject/limeobject.js +2 -0
- package/dist/es5/limeobject/repository.js +2 -0
- package/dist/es5/limeobject/types.js +5 -0
- package/dist/es5/limetype/acl.js +2 -0
- package/dist/es5/limetype/decorator.js +28 -0
- package/dist/es5/limetype/index.js +8 -0
- package/dist/es5/limetype/limetype.js +2 -0
- package/dist/es5/limetype/property.js +40 -0
- package/dist/es5/limetype/types.js +5 -0
- package/dist/es5/navigator/decorator.js +13 -0
- package/dist/es5/navigator/index.js +6 -0
- package/dist/es5/navigator/navigator.js +2 -0
- package/dist/es5/navigator/types.js +5 -0
- package/dist/es5/notifications/index.js +5 -0
- package/dist/es5/notifications/notifications.js +2 -0
- package/dist/es5/notifications/types.js +5 -0
- package/dist/es5/query/index.js +6 -0
- package/dist/es5/query/query.js +17 -0
- package/dist/es5/query/service.js +2 -0
- package/dist/es5/query/types.js +5 -0
- package/dist/es5/routeregistry/index.js +5 -0
- package/dist/es5/routeregistry/registry.js +2 -0
- package/dist/es5/routeregistry/types.js +5 -0
- package/dist/es5/task/index.js +5 -0
- package/dist/es5/task/repository.js +17 -0
- package/dist/es5/task/types.js +5 -0
- package/dist/es5/testing/component-testing.js +102 -0
- package/dist/es5/testing/index.js +10 -0
- package/dist/es5/testing/limeobjects/company.js +660 -0
- package/dist/es5/testing/limeobjects/coworker.js +110 -0
- package/dist/es5/testing/limeobjects/deal.js +447 -0
- package/dist/es5/testing/limeobjects/document.js +82 -0
- package/dist/es5/testing/limeobjects/index.js +55 -0
- package/dist/es5/testing/limeobjects/person.js +1162 -0
- package/dist/es5/testing/limetypes/campaign.js +486 -0
- package/dist/es5/testing/limetypes/company.js +621 -0
- package/dist/es5/testing/limetypes/consent.js +237 -0
- package/dist/es5/testing/limetypes/consenttype.js +194 -0
- package/dist/es5/testing/limetypes/coworker.js +579 -0
- package/dist/es5/testing/limetypes/deal.js +422 -0
- package/dist/es5/testing/limetypes/document.js +343 -0
- package/dist/es5/testing/limetypes/helpdesk.js +426 -0
- package/dist/es5/testing/limetypes/helpdesktype.js +142 -0
- package/dist/es5/testing/limetypes/history.js +349 -0
- package/dist/es5/testing/limetypes/index.js +69 -0
- package/dist/es5/testing/limetypes/infotiles.js +514 -0
- package/dist/es5/testing/limetypes/localize.js +287 -0
- package/dist/es5/testing/limetypes/mailing.js +218 -0
- package/dist/es5/testing/limetypes/office.js +388 -0
- package/dist/es5/testing/limetypes/participant.js +195 -0
- package/dist/es5/testing/limetypes/person.js +535 -0
- package/dist/es5/testing/limetypes/recipient.js +175 -0
- package/dist/es5/testing/limetypes/solutionimprovement.js +353 -0
- package/dist/es5/testing/limetypes/successplan.js +215 -0
- package/dist/es5/testing/limetypes/target.js +181 -0
- package/dist/es5/testing/limetypes/todo.js +429 -0
- package/dist/es5/testing/platform/index.js +53 -0
- package/dist/es5/testing/platform/platform.spec.js +44 -0
- package/dist/es5/translator/index.js +5 -0
- package/dist/es5/translator/translator.js +2 -0
- package/dist/es5/translator/types.js +5 -0
- package/dist/es5/userdata/decorator.js +13 -0
- package/dist/es5/userdata/index.js +6 -0
- package/dist/es5/userdata/repository.js +2 -0
- package/dist/es5/userdata/types.js +5 -0
- package/dist/eventdispatcher/eventdispatcher.d.ts +26 -0
- package/dist/eventdispatcher/eventdispatcher.js +1 -0
- package/dist/eventdispatcher/index.d.ts +2 -0
- package/dist/eventdispatcher/index.js +2 -0
- package/dist/eventdispatcher/types.d.ts +14 -0
- package/dist/eventdispatcher/types.js +3 -0
- package/dist/filter/decorator.d.ts +15 -0
- package/dist/filter/decorator.js +14 -0
- package/dist/filter/index.d.ts +3 -0
- package/dist/filter/index.js +3 -0
- package/dist/filter/repository.d.ts +18 -0
- package/dist/filter/repository.js +1 -0
- package/dist/filter/types.d.ts +14 -0
- package/dist/filter/types.js +3 -0
- package/dist/http/http.d.ts +72 -0
- package/dist/http/http.js +1 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +2 -0
- package/dist/http/types.d.ts +14 -0
- package/dist/http/types.js +3 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/keybindings/index.d.ts +2 -0
- package/dist/keybindings/index.js +2 -0
- package/dist/keybindings/registry.d.ts +79 -0
- package/dist/keybindings/registry.js +1 -0
- package/dist/keybindings/types.d.ts +17 -0
- package/dist/keybindings/types.js +3 -0
- package/dist/limeobject/commands/bulk-create-dialog.d.ts +49 -0
- package/dist/limeobject/commands/bulk-create-dialog.js +48 -0
- package/dist/limeobject/commands/create-dialog.d.ts +28 -0
- package/dist/limeobject/commands/create-dialog.js +26 -0
- package/dist/limeobject/commands/delete-object.d.ts +10 -0
- package/dist/limeobject/commands/delete-object.js +15 -0
- package/dist/limeobject/commands/index.d.ts +5 -0
- package/dist/limeobject/commands/index.js +5 -0
- package/dist/limeobject/commands/object-access.d.ts +10 -0
- package/dist/limeobject/commands/object-access.js +15 -0
- package/dist/limeobject/commands/save-object.d.ts +16 -0
- package/dist/limeobject/commands/save-object.js +21 -0
- package/dist/limeobject/decorator.d.ts +32 -0
- package/dist/limeobject/decorator.js +42 -0
- package/dist/limeobject/error.d.ts +4 -0
- package/dist/limeobject/error.js +1 -0
- package/dist/limeobject/index.d.ts +6 -0
- package/dist/limeobject/index.js +6 -0
- package/dist/limeobject/limeobject.d.ts +43 -0
- package/dist/limeobject/limeobject.js +1 -0
- package/dist/limeobject/repository.d.ts +113 -0
- package/dist/limeobject/repository.js +1 -0
- package/dist/limeobject/types.d.ts +14 -0
- package/dist/limeobject/types.js +3 -0
- package/dist/limetype/acl.d.ts +6 -0
- package/dist/limetype/acl.js +1 -0
- package/dist/limetype/decorator.d.ts +21 -0
- package/dist/limetype/decorator.js +32 -0
- package/dist/limetype/index.d.ts +5 -0
- package/dist/limetype/index.js +5 -0
- package/dist/limetype/limetype.d.ts +25 -0
- package/dist/limetype/limetype.js +1 -0
- package/dist/limetype/property.d.ts +32 -0
- package/dist/limetype/property.js +32 -0
- package/dist/limetype/types.d.ts +14 -0
- package/dist/limetype/types.js +3 -0
- package/dist/navigator/decorator.d.ts +18 -0
- package/dist/navigator/decorator.js +15 -0
- package/dist/navigator/index.d.ts +3 -0
- package/dist/navigator/index.js +3 -0
- package/dist/navigator/navigator.d.ts +158 -0
- package/dist/navigator/navigator.js +1 -0
- package/dist/navigator/types.d.ts +17 -0
- package/dist/navigator/types.js +3 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/notifications.d.ts +101 -0
- package/dist/notifications/notifications.js +1 -0
- package/dist/notifications/types.d.ts +14 -0
- package/dist/notifications/types.js +3 -0
- package/dist/query/index.d.ts +3 -0
- package/dist/query/index.js +3 -0
- package/dist/query/query.d.ts +46 -0
- package/dist/query/query.js +14 -0
- package/dist/query/service.d.ts +12 -0
- package/dist/query/service.js +1 -0
- package/dist/query/types.d.ts +14 -0
- package/dist/query/types.js +3 -0
- package/dist/routeregistry/index.d.ts +2 -0
- package/dist/routeregistry/index.js +2 -0
- package/dist/routeregistry/registry.d.ts +92 -0
- package/dist/routeregistry/registry.js +1 -0
- package/dist/routeregistry/types.d.ts +17 -0
- package/dist/routeregistry/types.js +3 -0
- package/dist/task/index.d.ts +2 -0
- package/dist/task/index.js +2 -0
- package/dist/task/repository.d.ts +82 -0
- package/dist/task/repository.js +49 -0
- package/dist/task/types.d.ts +14 -0
- package/dist/task/types.js +3 -0
- package/dist/testing/component-testing.d.ts +53 -0
- package/dist/testing/component-testing.js +162 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/limeobjects/company.d.ts +55 -0
- package/dist/testing/limeobjects/company.js +656 -0
- package/dist/testing/limeobjects/coworker.d.ts +22 -0
- package/dist/testing/limeobjects/coworker.js +106 -0
- package/dist/testing/limeobjects/deal.d.ts +41 -0
- package/dist/testing/limeobjects/deal.js +443 -0
- package/dist/testing/limeobjects/document.d.ts +20 -0
- package/dist/testing/limeobjects/document.js +78 -0
- package/dist/testing/limeobjects/index.d.ts +177 -0
- package/dist/testing/limeobjects/index.js +50 -0
- package/dist/testing/limeobjects/person.d.ts +20 -0
- package/dist/testing/limeobjects/person.js +1158 -0
- package/dist/testing/limetypes/campaign.d.ts +417 -0
- package/dist/testing/limetypes/campaign.js +477 -0
- package/dist/testing/limetypes/company.d.ts +591 -0
- package/dist/testing/limetypes/company.js +614 -0
- package/dist/testing/limetypes/consent.d.ts +199 -0
- package/dist/testing/limetypes/consent.js +232 -0
- package/dist/testing/limetypes/consenttype.d.ts +188 -0
- package/dist/testing/limetypes/consenttype.js +189 -0
- package/dist/testing/limetypes/coworker.d.ts +563 -0
- package/dist/testing/limetypes/coworker.js +564 -0
- package/dist/testing/limetypes/deal.d.ts +391 -0
- package/dist/testing/limetypes/deal.js +419 -0
- package/dist/testing/limetypes/document.d.ts +309 -0
- package/dist/testing/limetypes/document.js +332 -0
- package/dist/testing/limetypes/helpdesk.d.ts +394 -0
- package/dist/testing/limetypes/helpdesk.js +417 -0
- package/dist/testing/limetypes/helpdesktype.d.ts +136 -0
- package/dist/testing/limetypes/helpdesktype.js +137 -0
- package/dist/testing/limetypes/history.d.ts +308 -0
- package/dist/testing/limetypes/history.js +346 -0
- package/dist/testing/limetypes/index.d.ts +5 -0
- package/dist/testing/limetypes/index.js +63 -0
- package/dist/testing/limetypes/infotiles.d.ts +387 -0
- package/dist/testing/limetypes/infotiles.js +509 -0
- package/dist/testing/limetypes/localize.d.ts +283 -0
- package/dist/testing/limetypes/localize.js +284 -0
- package/dist/testing/limetypes/mailing.d.ts +212 -0
- package/dist/testing/limetypes/mailing.js +213 -0
- package/dist/testing/limetypes/office.d.ts +384 -0
- package/dist/testing/limetypes/office.js +385 -0
- package/dist/testing/limetypes/participant.d.ts +165 -0
- package/dist/testing/limetypes/participant.js +188 -0
- package/dist/testing/limetypes/person.d.ts +472 -0
- package/dist/testing/limetypes/person.js +530 -0
- package/dist/testing/limetypes/recipient.d.ts +147 -0
- package/dist/testing/limetypes/recipient.js +170 -0
- package/dist/testing/limetypes/solutionimprovement.d.ts +302 -0
- package/dist/testing/limetypes/solutionimprovement.js +344 -0
- package/dist/testing/limetypes/successplan.d.ts +209 -0
- package/dist/testing/limetypes/successplan.js +210 -0
- package/dist/testing/limetypes/target.d.ts +160 -0
- package/dist/testing/limetypes/target.js +178 -0
- package/dist/testing/limetypes/todo.d.ts +386 -0
- package/dist/testing/limetypes/todo.js +426 -0
- package/dist/testing/platform/index.d.ts +8 -0
- package/dist/testing/platform/index.js +61 -0
- package/dist/testing/platform/platform.spec.d.ts +1 -0
- package/dist/testing/platform/platform.spec.js +41 -0
- package/dist/translator/index.d.ts +2 -0
- package/dist/translator/index.js +2 -0
- package/dist/translator/translator.d.ts +13 -0
- package/dist/translator/translator.js +1 -0
- package/dist/translator/types.d.ts +14 -0
- package/dist/translator/types.js +3 -0
- package/dist/userdata/decorator.d.ts +17 -0
- package/dist/userdata/decorator.js +14 -0
- package/dist/userdata/index.d.ts +3 -0
- package/dist/userdata/index.js +3 -0
- package/dist/userdata/repository.d.ts +29 -0
- package/dist/userdata/repository.js +1 -0
- package/dist/userdata/types.d.ts +14 -0
- package/dist/userdata/types.js +3 -0
- package/package.json +11 -6
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStateDecorator = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var core_1 = require("@stencil/core");
|
|
6
|
+
var rxjs_1 = require("rxjs");
|
|
7
|
+
function defaultOptionFactory(options) {
|
|
8
|
+
return options;
|
|
9
|
+
}
|
|
10
|
+
function createStateDecorator(options, config) {
|
|
11
|
+
return function (target, property) {
|
|
12
|
+
var properties = getComponentProperties(target, property, options, config);
|
|
13
|
+
if (properties.length === 1) {
|
|
14
|
+
extendLifecycleMethods(target, properties);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.createStateDecorator = createStateDecorator;
|
|
19
|
+
var componentProperties = new WeakMap();
|
|
20
|
+
var contexts = new WeakMap();
|
|
21
|
+
var contextObservables = new WeakMap();
|
|
22
|
+
var componentSubscriptions = new WeakMap();
|
|
23
|
+
var connectedComponents = new WeakMap();
|
|
24
|
+
function getComponentProperties(component, property, options, config) {
|
|
25
|
+
var properties = componentProperties.get(component);
|
|
26
|
+
if (!properties) {
|
|
27
|
+
properties = [];
|
|
28
|
+
componentProperties.set(component, properties);
|
|
29
|
+
}
|
|
30
|
+
properties.push({
|
|
31
|
+
options: options,
|
|
32
|
+
name: property,
|
|
33
|
+
optionFactory: config.optionFactory || defaultOptionFactory,
|
|
34
|
+
service: {
|
|
35
|
+
name: config.name,
|
|
36
|
+
method: config.method || 'subscribe',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
return properties;
|
|
40
|
+
}
|
|
41
|
+
function extendLifecycleMethods(component, properties) {
|
|
42
|
+
component.connectedCallback = createConnectedCallback(component.connectedCallback, properties);
|
|
43
|
+
component.componentWillLoad = createComponentWillLoad(component.componentWillLoad, properties);
|
|
44
|
+
component.componentWillUpdate = createComponentWillUpdate(component.componentWillUpdate);
|
|
45
|
+
component.componentDidUnload = createDisconnectedCallback(component.componentDidUnload);
|
|
46
|
+
component.disconnectedCallback = createDisconnectedCallback(component.disconnectedCallback);
|
|
47
|
+
}
|
|
48
|
+
function createConnectedCallback(original, properties) {
|
|
49
|
+
return function () {
|
|
50
|
+
var args = [];
|
|
51
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
52
|
+
args[_i] = arguments[_i];
|
|
53
|
+
}
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var observable;
|
|
56
|
+
var _this = this;
|
|
57
|
+
return tslib_1.__generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
connectedComponents.set(this, true);
|
|
61
|
+
componentSubscriptions.set(this, []);
|
|
62
|
+
return [4, ensureLimeProps(this)];
|
|
63
|
+
case 1:
|
|
64
|
+
_a.sent();
|
|
65
|
+
observable = new rxjs_1.BehaviorSubject(this.context);
|
|
66
|
+
contexts.set(this, this.context);
|
|
67
|
+
contextObservables.set(this, observable);
|
|
68
|
+
properties.forEach(function (property) {
|
|
69
|
+
property.options = property.optionFactory(property.options, _this);
|
|
70
|
+
if (isContextAware(property.options)) {
|
|
71
|
+
property.options.context = observable;
|
|
72
|
+
}
|
|
73
|
+
subscribe(_this, property);
|
|
74
|
+
});
|
|
75
|
+
if (original) {
|
|
76
|
+
return [2, original.apply(this, args)];
|
|
77
|
+
}
|
|
78
|
+
return [2];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function createComponentWillLoad(original, properties) {
|
|
85
|
+
return function () {
|
|
86
|
+
var args = [];
|
|
87
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
88
|
+
args[_i] = arguments[_i];
|
|
89
|
+
}
|
|
90
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
91
|
+
var connectedCallback;
|
|
92
|
+
return tslib_1.__generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
if (!(connectedComponents.get(this) === true)) return [3, 2];
|
|
96
|
+
return [4, ensureLimeProps(this)];
|
|
97
|
+
case 1:
|
|
98
|
+
_a.sent();
|
|
99
|
+
if (original) {
|
|
100
|
+
return [2, original.apply(this, args)];
|
|
101
|
+
}
|
|
102
|
+
return [2];
|
|
103
|
+
case 2:
|
|
104
|
+
connectedCallback = createConnectedCallback(original, properties);
|
|
105
|
+
return [2, connectedCallback.apply(this, args)];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function createComponentWillUpdate(original) {
|
|
112
|
+
return function () {
|
|
113
|
+
var args = [];
|
|
114
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
115
|
+
args[_i] = arguments[_i];
|
|
116
|
+
}
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var context, observable;
|
|
119
|
+
return tslib_1.__generator(this, function (_a) {
|
|
120
|
+
context = contexts.get(this);
|
|
121
|
+
if (context !== this.context) {
|
|
122
|
+
contexts.set(this, this.context);
|
|
123
|
+
observable = contextObservables.get(this);
|
|
124
|
+
observable.next(this.context);
|
|
125
|
+
}
|
|
126
|
+
if (original) {
|
|
127
|
+
return [2, original.apply(this, args)];
|
|
128
|
+
}
|
|
129
|
+
return [2];
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function createDisconnectedCallback(original) {
|
|
135
|
+
return function () {
|
|
136
|
+
var args = [];
|
|
137
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
138
|
+
args[_i] = arguments[_i];
|
|
139
|
+
}
|
|
140
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var result;
|
|
142
|
+
return tslib_1.__generator(this, function (_a) {
|
|
143
|
+
if (original) {
|
|
144
|
+
result = original.apply(this, args);
|
|
145
|
+
}
|
|
146
|
+
unsubscribeAll(this);
|
|
147
|
+
return [2, result];
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function isContextAware(options) {
|
|
153
|
+
return 'context' in options;
|
|
154
|
+
}
|
|
155
|
+
function ensureLimeProps(target) {
|
|
156
|
+
var promises = [];
|
|
157
|
+
if (!target.platform) {
|
|
158
|
+
promises.push(waitForProp(target, 'platform'));
|
|
159
|
+
}
|
|
160
|
+
if (!target.context) {
|
|
161
|
+
promises.push(waitForProp(target, 'context'));
|
|
162
|
+
}
|
|
163
|
+
if (!promises.length) {
|
|
164
|
+
return Promise.resolve();
|
|
165
|
+
}
|
|
166
|
+
return Promise.all(promises);
|
|
167
|
+
}
|
|
168
|
+
function waitForProp(target, property) {
|
|
169
|
+
var element = (0, core_1.getElement)(target);
|
|
170
|
+
return new Promise(function (resolve) {
|
|
171
|
+
Object.defineProperty(element, property, {
|
|
172
|
+
set: function (value) {
|
|
173
|
+
delete element[property];
|
|
174
|
+
element[property] = value;
|
|
175
|
+
resolve();
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function subscribe(component, property) {
|
|
181
|
+
var subscription = createSubscription(component, property);
|
|
182
|
+
var subscriptions = componentSubscriptions.get(component);
|
|
183
|
+
subscriptions.push(subscription);
|
|
184
|
+
}
|
|
185
|
+
function unsubscribeAll(component) {
|
|
186
|
+
var subscriptions = componentSubscriptions.get(component);
|
|
187
|
+
subscriptions.forEach(function (unsubscribe) { return unsubscribe(); });
|
|
188
|
+
componentSubscriptions.set(component, []);
|
|
189
|
+
}
|
|
190
|
+
function mapState(instance, property) {
|
|
191
|
+
return function (state) {
|
|
192
|
+
instance[property] = state;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function createSubscription(component, property) {
|
|
196
|
+
var myOptions = tslib_1.__assign({}, property.options);
|
|
197
|
+
bindFunctions(myOptions, component);
|
|
198
|
+
var name = property.service.name;
|
|
199
|
+
var platform = component.platform;
|
|
200
|
+
if (!platform.has(name)) {
|
|
201
|
+
throw new Error("Service ".concat(name, " does not exist"));
|
|
202
|
+
}
|
|
203
|
+
var service = platform.get(name);
|
|
204
|
+
return service[property.service.method](mapState(component, property.name), myOptions);
|
|
205
|
+
}
|
|
206
|
+
function bindFunctions(options, scope) {
|
|
207
|
+
if (options.filter) {
|
|
208
|
+
options.filter = options.filter.map(function (func) { return func.bind(scope); });
|
|
209
|
+
}
|
|
210
|
+
if (options.map) {
|
|
211
|
+
options.map = options.map.map(function (func) { return func.bind(scope); });
|
|
212
|
+
}
|
|
213
|
+
}
|