@limetech/lime-web-components 5.14.0 → 5.16.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.
@@ -0,0 +1,75 @@
1
+ import { LimeObject } from '../limeobject';
2
+ /**
3
+ * This interface defines callbacks intended to be registered to the {@link Condition} registry
4
+ *
5
+ * @alpha
6
+ * @group Conditions
7
+ */
8
+ export type Condition<T = unknown> = {
9
+ /**
10
+ * The condition type, describing what to evaluate the condition for, for example "limeobject"
11
+ */
12
+ type: string;
13
+ evaluate: (subject: T, params: any) => boolean;
14
+ id: string;
15
+ };
16
+ /**
17
+ * A condition to evaluate for a {@link LimeObject}
18
+ *
19
+ * @alpha
20
+ * @group Conditions
21
+ */
22
+ export type LimeObjectCondition = Condition<LimeObject> & {
23
+ type: 'limeobject';
24
+ };
25
+ /**
26
+ * Check if condition expects a lime object to be passed when it is evaluated
27
+ *
28
+ * @alpha
29
+ * @group Conditions
30
+ */
31
+ export declare function isLimeObjectCondition(condition: Condition): condition is Condition<LimeObject>;
32
+ /**
33
+ * Service for adding and retrieving, and checking {@link Condition}s to and from the condition registry
34
+ *
35
+ * @alpha
36
+ * @group Conditions
37
+ */
38
+ export interface ConditionRegistry {
39
+ /**
40
+ * Add a {@link Condition} to the registry
41
+ *
42
+ * @param condition - the condition to pass to the registry
43
+ * @throws error if the id already exists in the registry
44
+ */
45
+ addCondition(condition: Condition): any;
46
+ /**
47
+ * Remove a {@link Condition} from the registry
48
+ *
49
+ * @param condition - the condition to remove
50
+ * @throws error if the id does not exist in the registry
51
+ */
52
+ removeCondition(condition: Condition): any;
53
+ /**
54
+ * Checks if a {@link Condition} exists on the registry
55
+ *
56
+ * @param id - id of the condition
57
+ * @returns true if it exists, false otherwise
58
+ */
59
+ hasCondition(id: string): boolean;
60
+ /**
61
+ * Gets all {@link Condition}s
62
+ *
63
+ * @returns a list of all existing conditions
64
+ */
65
+ getConditions(): Condition[];
66
+ /**
67
+ * Gets a {@link Condition} by id
68
+ *
69
+ * @param id - id of the condition
70
+ * @throws error if no condition was found with the specified id
71
+ * @returns the condition with the specified id
72
+ */
73
+ getCondition(id: string): Condition;
74
+ }
75
+ //# sourceMappingURL=conditionregistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditionregistry.d.ts","sourceRoot":"","sources":["../../src/conditionregistry/conditionregistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAWb,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC;IAK/C,EAAE,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,SAAS,GACrB,SAAS,IAAI,SAAS,CAAC,UAAU,CAAC,CAEpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,OAAE;IAEnC;;;;;OAKG;IACH,eAAe,CAAC,SAAS,EAAE,SAAS,OAAE;IAEtC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAElC;;;;OAIG;IACH,aAAa,IAAI,SAAS,EAAE,CAAC;IAE7B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check if condition expects a lime object to be passed when it is evaluated
3
+ *
4
+ * @alpha
5
+ * @group Conditions
6
+ */
7
+ export function isLimeObjectCondition(condition) {
8
+ return condition.type === 'limeobject';
9
+ }
@@ -0,0 +1,3 @@
1
+ export * from './conditionregistry';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionregistry/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './conditionregistry';
2
+ export * from './types';
@@ -0,0 +1,15 @@
1
+ import { ConditionRegistry as Service } from './conditionregistry';
2
+ declare const SERVICE_NAME = "conditionRegistry";
3
+ declare module '../core/platform' {
4
+ interface PlatformServiceNameType {
5
+ /**
6
+ * @see {@link Service | ConditionRegistry}
7
+ */
8
+ ConditionRegistry: typeof SERVICE_NAME;
9
+ }
10
+ interface LimeWebComponentPlatform {
11
+ get(name: PlatformServiceNameType['ConditionRegistry']): Service;
12
+ }
13
+ }
14
+ export {};
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/conditionregistry/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnE,QAAA,MAAM,YAAY,sBAAsB,CAAC;AAIzC,OAAO,QAAQ,kBAAkB,CAAC;IAC9B,UAAU,uBAAuB;QAC7B;;WAEG;QACH,iBAAiB,EAAE,OAAO,YAAY,CAAC;KAC1C;IACD,UAAU,wBAAwB;QAC9B,GAAG,CAAC,IAAI,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC;KACpE;CACJ"}
@@ -0,0 +1,3 @@
1
+ import { PlatformServiceName } from '../core/platform';
2
+ const SERVICE_NAME = 'conditionRegistry';
3
+ PlatformServiceName.ConditionRegistry = SERVICE_NAME;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isLimeObjectCondition = void 0;
4
+ function isLimeObjectCondition(condition) {
5
+ return condition.type === 'limeobject';
6
+ }
7
+ exports.isLimeObjectCondition = isLimeObjectCondition;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./conditionregistry"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var platform_1 = require("../core/platform");
4
+ var SERVICE_NAME = 'conditionRegistry';
5
+ platform_1.PlatformServiceName.ConditionRegistry = SERVICE_NAME;
package/dist/es5/index.js CHANGED
@@ -22,3 +22,4 @@ tslib_1.__exportStar(require("./userdata"), exports);
22
22
  tslib_1.__exportStar(require("./application"), exports);
23
23
  tslib_1.__exportStar(require("./userpreferences"), exports);
24
24
  tslib_1.__exportStar(require("./datetimeformatter"), exports);
25
+ tslib_1.__exportStar(require("./conditionregistry"), exports);
package/dist/index.d.ts CHANGED
@@ -41,4 +41,5 @@ export * from './userdata';
41
41
  export * from './application';
42
42
  export * from './userpreferences';
43
43
  export * from './datetimeformatter';
44
+ export * from './conditionregistry';
44
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -41,3 +41,4 @@ export * from './userdata';
41
41
  export * from './application';
42
42
  export * from './userpreferences';
43
43
  export * from './datetimeformatter';
44
+ export * from './conditionregistry';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-web-components",
3
- "version": "5.14.0",
3
+ "version": "5.16.0",
4
4
  "description": "Lime Web Components",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -35,13 +35,13 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@commitlint/config-conventional": "^16.2.4",
38
- "@microsoft/api-extractor": "^7.36.4",
38
+ "@microsoft/api-extractor": "^7.38.0",
39
39
  "@types/jest": "^27.5.0",
40
40
  "@typescript-eslint/eslint-plugin": "^5.62.0",
41
41
  "@typescript-eslint/parser": "^5.62.0",
42
42
  "commitizen": "^4.3.0",
43
43
  "cz-conventional-changelog": "^3.3.0",
44
- "eslint": "^8.49.0",
44
+ "eslint": "^8.50.0",
45
45
  "eslint-config-prettier": "^8.10.0",
46
46
  "eslint-plugin-ban": "^1.6.0",
47
47
  "eslint-plugin-prefer-arrow": "^1.2.3",