@limetech/lime-web-components 5.23.1 → 5.24.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.
package/dist/es5/index.js CHANGED
@@ -24,3 +24,4 @@ tslib_1.__exportStar(require("./application"), exports);
24
24
  tslib_1.__exportStar(require("./userpreferences"), exports);
25
25
  tslib_1.__exportStar(require("./datetimeformatter"), exports);
26
26
  tslib_1.__exportStar(require("./conditionregistry"), exports);
27
+ tslib_1.__exportStar(require("./view"), exports);
@@ -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("./registry"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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 = 'viewFactoryRegistry';
5
+ platform_1.PlatformServiceName.ViewFactoryRegistry = SERVICE_NAME;
package/dist/index.d.ts CHANGED
@@ -43,4 +43,5 @@ export * from './application';
43
43
  export * from './userpreferences';
44
44
  export * from './datetimeformatter';
45
45
  export * from './conditionregistry';
46
+ export * from './view';
46
47
  //# 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,UAAU,CAAC;AACzB,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,cAAc,UAAU,CAAC;AACzB,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;AACpC,cAAc,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -43,3 +43,4 @@ export * from './application';
43
43
  export * from './userpreferences';
44
44
  export * from './datetimeformatter';
45
45
  export * from './conditionregistry';
46
+ export * from './view';
@@ -0,0 +1,3 @@
1
+ export * from './registry';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './registry';
2
+ export * from './types';
@@ -0,0 +1,64 @@
1
+ import { LimeWebComponentContext } from '../core';
2
+ import { LimeObject } from '../limeobject';
3
+ /**
4
+ * Registry for view factories
5
+ *
6
+ * A view factory is used to create a view for a {@link LimeObject}.
7
+ * Multiple factories can be registered for the same view type, and when that
8
+ * is done the factory returned from {@link ViewFactoryRegistry.getFactory} will
9
+ * invoke each one in the order that they were added, using the return value
10
+ * from each factory as input for the next factory in the chain.
11
+ *
12
+ * @example Registering a view factory
13
+ * ```ts
14
+ * const factory = (
15
+ * limeobject: LimeObject,
16
+ * context: LimeWebComponentContext,
17
+ * view?: ListItem
18
+ * ): ListItem => {
19
+ * return {
20
+ * ...view,
21
+ * icon: 'dog',
22
+ * };
23
+ * };
24
+ * registry.registerFactory('list', factory);
25
+ * ```
26
+ *
27
+ * @example Using a factory to create a view
28
+ * ```ts
29
+ * const createListItem = registry.getFactory('list');
30
+ * const listItem = createListItem(limeobject, context);
31
+ * ```
32
+ *
33
+ * @alpha
34
+ * @group Views
35
+ */
36
+ export interface ViewFactoryRegistry {
37
+ /**
38
+ * Get a factory for the given view type
39
+ *
40
+ * @param type - the type of view to get a factory for
41
+ * @returns a factory for the given view type
42
+ */
43
+ getFactory<T = unknown>(type: string): ViewFactory<T> | undefined;
44
+ /**
45
+ * Register a factory for a given view type
46
+ *
47
+ * @param type - the type of view to get a factory for
48
+ * @param factory - factory function to create a view of the specific type
49
+ */
50
+ registerFactory<T = unknown>(type: string, factory: ViewFactory<T>): void;
51
+ }
52
+ /**
53
+ * Factory to create a view for a {@link LimeObject}
54
+ *
55
+ * @param limeobject - the limeobject to create a view for
56
+ * @param context - the context of the web component rendering the view
57
+ * @param view - the view as it was created by the previous factory, or
58
+ * `undefined` if this is the first factory in the chain
59
+ *
60
+ * @alpha
61
+ * @group Views
62
+ */
63
+ export type ViewFactory<T = unknown> = (limeobject: LimeObject, context: LimeWebComponentContext, view?: T) => T | undefined;
64
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/view/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;;OAKG;IACH,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAElE;;;;;OAKG;IACH,eAAe,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAC7E;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,uBAAuB,EAChC,IAAI,CAAC,EAAE,CAAC,KACP,CAAC,GAAG,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ViewFactoryRegistry } from './registry';
2
+ declare const SERVICE_NAME = "viewFactoryRegistry";
3
+ declare module '../core/platform' {
4
+ interface PlatformServiceNameType {
5
+ /**
6
+ * @alpha
7
+ * @see {@link ViewFactoryRegistry}
8
+ */
9
+ ViewFactoryRegistry: typeof SERVICE_NAME;
10
+ }
11
+ interface LimeWebComponentPlatform {
12
+ /**
13
+ * @alpha
14
+ */
15
+ get(name: PlatformServiceNameType['ViewFactoryRegistry']): ViewFactoryRegistry;
16
+ }
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/view/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,QAAA,MAAM,YAAY,wBAAwB,CAAC;AAI3C,OAAO,QAAQ,kBAAkB,CAAC;IAC9B,UAAU,uBAAuB;QAC7B;;;WAGG;QACH,mBAAmB,EAAE,OAAO,YAAY,CAAC;KAC5C;IAED,UAAU,wBAAwB;QAC9B;;WAEG;QACH,GAAG,CACC,IAAI,EAAE,uBAAuB,CAAC,qBAAqB,CAAC,GACrD,mBAAmB,CAAC;KAC1B;CACJ"}
@@ -0,0 +1,3 @@
1
+ import { PlatformServiceName } from '../core/platform';
2
+ const SERVICE_NAME = 'viewFactoryRegistry';
3
+ PlatformServiceName.ViewFactoryRegistry = SERVICE_NAME;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-web-components",
3
- "version": "5.23.1",
3
+ "version": "5.24.0",
4
4
  "description": "Lime Web Components",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -9,7 +9,8 @@
9
9
  "types": "dist/index.d.ts",
10
10
  "files": [
11
11
  "dist/",
12
- "testing"
12
+ "testing",
13
+ "CHANGELOG.md"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsc && tsc -p tsconfig.es5.json",
@@ -35,13 +36,13 @@
35
36
  },
36
37
  "devDependencies": {
37
38
  "@commitlint/config-conventional": "^16.2.4",
38
- "@microsoft/api-extractor": "^7.38.5",
39
+ "@microsoft/api-extractor": "^7.39.1",
39
40
  "@types/jest": "^27.5.0",
40
41
  "@typescript-eslint/eslint-plugin": "^5.62.0",
41
42
  "@typescript-eslint/parser": "^5.62.0",
42
43
  "commitizen": "^4.3.0",
43
44
  "cz-conventional-changelog": "^3.3.0",
44
- "eslint": "^8.55.0",
45
+ "eslint": "^8.56.0",
45
46
  "eslint-config-prettier": "^8.10.0",
46
47
  "eslint-plugin-ban": "^1.6.0",
47
48
  "eslint-plugin-prefer-arrow": "^1.2.3",