@celljs/widget 3.8.0 → 4.0.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.
Files changed (54) hide show
  1. package/esm/browser/annotation/index.d.ts +1 -0
  2. package/esm/browser/annotation/index.js +2 -0
  3. package/esm/browser/annotation/index.js.map +1 -0
  4. package/esm/browser/annotation/widget.d.ts +9 -0
  5. package/esm/browser/annotation/widget.js +26 -0
  6. package/esm/browser/annotation/widget.js.map +1 -0
  7. package/esm/browser/index.d.ts +5 -0
  8. package/esm/browser/index.js +6 -0
  9. package/esm/browser/index.js.map +1 -0
  10. package/esm/browser/keyboard/index.d.ts +1 -0
  11. package/esm/browser/keyboard/index.js +2 -0
  12. package/esm/browser/keyboard/index.js.map +1 -0
  13. package/esm/browser/keyboard/keys.d.ts +253 -0
  14. package/esm/browser/keyboard/keys.js +616 -0
  15. package/esm/browser/keyboard/keys.js.map +1 -0
  16. package/esm/browser/locale/index.d.ts +2 -0
  17. package/esm/browser/locale/index.js +3 -0
  18. package/esm/browser/locale/index.js.map +1 -0
  19. package/esm/browser/locale/locale-manager.d.ts +13 -0
  20. package/esm/browser/locale/locale-manager.js +68 -0
  21. package/esm/browser/locale/locale-manager.js.map +1 -0
  22. package/esm/browser/locale/locale-protocol.d.ts +15 -0
  23. package/esm/browser/locale/locale-protocol.js +3 -0
  24. package/esm/browser/locale/locale-protocol.js.map +1 -0
  25. package/esm/browser/module.d.ts +2 -0
  26. package/esm/browser/module.js +3 -0
  27. package/esm/browser/module.js.map +1 -0
  28. package/esm/browser/theme/index.d.ts +2 -0
  29. package/esm/browser/theme/index.js +3 -0
  30. package/esm/browser/theme/index.js.map +1 -0
  31. package/esm/browser/theme/theme-manager.d.ts +13 -0
  32. package/esm/browser/theme/theme-manager.js +69 -0
  33. package/esm/browser/theme/theme-manager.js.map +1 -0
  34. package/esm/browser/theme/theme-protocol.d.ts +18 -0
  35. package/esm/browser/theme/theme-protocol.js +4 -0
  36. package/esm/browser/theme/theme-protocol.js.map +1 -0
  37. package/esm/browser/widget/index.d.ts +4 -0
  38. package/esm/browser/widget/index.js +5 -0
  39. package/esm/browser/widget/index.js.map +1 -0
  40. package/esm/browser/widget/widget-factory.d.ts +9 -0
  41. package/esm/browser/widget/widget-factory.js +43 -0
  42. package/esm/browser/widget/widget-factory.js.map +1 -0
  43. package/esm/browser/widget/widget-manager.d.ts +14 -0
  44. package/esm/browser/widget/widget-manager.js +77 -0
  45. package/esm/browser/widget/widget-manager.js.map +1 -0
  46. package/esm/browser/widget/widget-protocol.d.ts +37 -0
  47. package/esm/browser/widget/widget-protocol.js +9 -0
  48. package/esm/browser/widget/widget-protocol.js.map +1 -0
  49. package/esm/browser/widget/widget-util.d.ts +5 -0
  50. package/esm/browser/widget/widget-util.js +25 -0
  51. package/esm/browser/widget/widget-util.js.map +1 -0
  52. package/esm/package.json +3 -0
  53. package/package.json +56 -6
  54. package/cell.yml +0 -3
@@ -0,0 +1,3 @@
1
+ export * from './locale-protocol.js';
2
+ export * from './locale-manager.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/locale/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { LocaleManager, Locale } from './locale-protocol.js';
2
+ import { BehaviorSubject } from 'rxjs';
3
+ export declare class LocaleManagerImpl implements LocaleManager {
4
+ protected readonly langStorageKey = "cell:lang";
5
+ protected readonly localesForConfig: {
6
+ [lang: string]: Locale;
7
+ };
8
+ protected readonly locales: Locale[];
9
+ protected prioritized: Locale[];
10
+ currentSubject: BehaviorSubject<Locale | undefined>;
11
+ init(): void;
12
+ get(): Promise<Locale[]>;
13
+ }
@@ -0,0 +1,68 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { LocaleManager, Locale } from './locale-protocol.js';
11
+ import { Component, Value, Autowired, Optional, Prioritizeable, PostConstruct } from '@celljs/core';
12
+ import { BehaviorSubject } from 'rxjs';
13
+ let LocaleManagerImpl = class LocaleManagerImpl {
14
+ constructor() {
15
+ this.langStorageKey = 'cell:lang';
16
+ this.currentSubject = new BehaviorSubject(undefined);
17
+ }
18
+ init() {
19
+ (async () => {
20
+ const locales = await this.get();
21
+ const lang = localStorage.getItem(this.langStorageKey) || navigator.language;
22
+ if (locales.length) {
23
+ this.currentSubject.next(locales.find(l => l.lang === lang) || locales[0]);
24
+ }
25
+ this.currentSubject.subscribe(locale => {
26
+ if (locale) {
27
+ localStorage.setItem(this.langStorageKey, locale.lang);
28
+ }
29
+ else {
30
+ localStorage.removeItem(this.langStorageKey);
31
+ }
32
+ });
33
+ })();
34
+ }
35
+ async get() {
36
+ if (!this.prioritized) {
37
+ const config = this.localesForConfig || {};
38
+ const parsedLacalesForConfig = Object.keys(config).map(lang => {
39
+ const locale = { ...config[lang] };
40
+ locale.lang = lang;
41
+ locale.priority = locale.priority || 500;
42
+ return locale;
43
+ });
44
+ this.prioritized = Prioritizeable.prioritizeAllSync([...parsedLacalesForConfig, ...this.locales]).map(p => p.value);
45
+ }
46
+ return this.prioritized;
47
+ }
48
+ };
49
+ __decorate([
50
+ Value('cell.locales'),
51
+ __metadata("design:type", Object)
52
+ ], LocaleManagerImpl.prototype, "localesForConfig", void 0);
53
+ __decorate([
54
+ Autowired(Locale),
55
+ Optional(),
56
+ __metadata("design:type", Array)
57
+ ], LocaleManagerImpl.prototype, "locales", void 0);
58
+ __decorate([
59
+ PostConstruct(),
60
+ __metadata("design:type", Function),
61
+ __metadata("design:paramtypes", []),
62
+ __metadata("design:returntype", void 0)
63
+ ], LocaleManagerImpl.prototype, "init", null);
64
+ LocaleManagerImpl = __decorate([
65
+ Component(LocaleManager)
66
+ ], LocaleManagerImpl);
67
+ export { LocaleManagerImpl };
68
+ //# sourceMappingURL=locale-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-manager.js","sourceRoot":"","sources":["../../../src/browser/locale/locale-manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAGhC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAAvB;QAEgB,mBAAc,GAAG,WAAW,CAAC;QAUhD,mBAAc,GAAG,IAAI,eAAe,CAAqB,SAAS,CAAC,CAAC;IAoCxE,CAAC;IAjCG,IAAI;QACA,CAAC,KAAK,IAAI,EAAE;YACR,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YACjC,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC;YAC7E,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACjB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,OAAO,CAA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;IADC,aAAa,EAAE;;;;6CAiBf;AA/BQ,iBAAiB;IAD7B,SAAS,CAAC,aAAa,CAAC;GACZ,iBAAiB,CAgD7B"}
@@ -0,0 +1,15 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ export declare const Locale: unique symbol;
3
+ export declare const LocaleManager: unique symbol;
4
+ export interface Locale {
5
+ lang: string;
6
+ priority: number;
7
+ label?: string;
8
+ messages: {
9
+ [key: string]: string;
10
+ };
11
+ }
12
+ export interface LocaleManager {
13
+ currentSubject: BehaviorSubject<Locale | undefined>;
14
+ get(): Promise<Locale[]>;
15
+ }
@@ -0,0 +1,3 @@
1
+ export const Locale = Symbol('Locale');
2
+ export const LocaleManager = Symbol('LocaleManager');
3
+ //# sourceMappingURL=locale-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale-protocol.js","sourceRoot":"","sources":["../../../src/browser/locale/locale-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ declare const _default: import("inversify").interfaces.ContainerModule;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { autoBind } from '@celljs/core';
2
+ export default autoBind();
3
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/browser/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,eAAe,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './theme-protocol.js';
2
+ export * from './theme-manager.js';
@@ -0,0 +1,3 @@
1
+ export * from './theme-protocol.js';
2
+ export * from './theme-manager.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Theme, ThemeManager } from './theme-protocol.js';
2
+ import { BehaviorSubject } from 'rxjs';
3
+ export declare class ThemeManagerImpl<T> implements ThemeManager<T> {
4
+ protected readonly themeStorageKey = "cell:theme";
5
+ protected readonly themesForConfig: {
6
+ [id: string]: Theme<T>;
7
+ };
8
+ protected readonly themes: Theme<T>[];
9
+ protected prioritized: Theme<T>[];
10
+ currentSubject: BehaviorSubject<Theme<T> | undefined>;
11
+ init(): void;
12
+ get(): Promise<Theme<T>[]>;
13
+ }
@@ -0,0 +1,69 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Theme, ThemeManager, DEFAULT_THEME } from './theme-protocol.js';
11
+ import { Component, Value, Autowired, Optional, Prioritizeable, PostConstruct } from '@celljs/core';
12
+ import { BehaviorSubject } from 'rxjs';
13
+ let ThemeManagerImpl = class ThemeManagerImpl {
14
+ constructor() {
15
+ this.themeStorageKey = 'cell:theme';
16
+ this.currentSubject = new BehaviorSubject(undefined);
17
+ }
18
+ init() {
19
+ const themeStr = localStorage.getItem(this.themeStorageKey);
20
+ if (themeStr) {
21
+ this.currentSubject.next(JSON.parse(themeStr));
22
+ }
23
+ else {
24
+ if (this.themesForConfig) {
25
+ this.currentSubject.next(this.themesForConfig[DEFAULT_THEME]);
26
+ }
27
+ }
28
+ this.currentSubject.subscribe(theme => {
29
+ if (theme) {
30
+ localStorage.setItem(this.themeStorageKey, JSON.stringify(theme));
31
+ }
32
+ else {
33
+ localStorage.removeItem(this.themeStorageKey);
34
+ }
35
+ });
36
+ }
37
+ async get() {
38
+ if (!this.prioritized) {
39
+ const parsedThemesForConfig = Object.keys(this.themesForConfig || {}).map(id => {
40
+ const theme = { ...this.themesForConfig[id] };
41
+ theme.id = id;
42
+ theme.priority = theme.priority || 500;
43
+ return theme;
44
+ });
45
+ this.prioritized = Prioritizeable.prioritizeAllSync([...parsedThemesForConfig, ...this.themes]).map(p => p.value);
46
+ }
47
+ return this.prioritized;
48
+ }
49
+ };
50
+ __decorate([
51
+ Value('cell.themes'),
52
+ __metadata("design:type", Object)
53
+ ], ThemeManagerImpl.prototype, "themesForConfig", void 0);
54
+ __decorate([
55
+ Autowired(Theme),
56
+ Optional(),
57
+ __metadata("design:type", Array)
58
+ ], ThemeManagerImpl.prototype, "themes", void 0);
59
+ __decorate([
60
+ PostConstruct(),
61
+ __metadata("design:type", Function),
62
+ __metadata("design:paramtypes", []),
63
+ __metadata("design:returntype", void 0)
64
+ ], ThemeManagerImpl.prototype, "init", null);
65
+ ThemeManagerImpl = __decorate([
66
+ Component(ThemeManager)
67
+ ], ThemeManagerImpl);
68
+ export { ThemeManagerImpl };
69
+ //# sourceMappingURL=theme-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-manager.js","sourceRoot":"","sources":["../../../src/browser/theme/theme-manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpG,OA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AAC;gBACd,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC;gBACvC,OAAO,KAAK,CAAC;YACjB,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAE,GAAG,qBAAqB,EAAE,GAAG,IAAI,CAAC,MAAM,CAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACxH,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;CAEJ,CAAA;AA1CsB;IADlB,KAAK,CAAC,aAAa,CAAC;;yDAC0C;AAG5C;IADlB,SAAS,CAAC,KAAK,CAAC;IAAE,QAAQ,EAAE;;gDACS;AAOtC;IADC,aAAa,EAAE;;;;4CAiBf;AA/BQ,gBAAgB;IAD5B,SAAS,CAAC,YAAY,CAAC;GACX,gBAAgB,CA+C5B"}
@@ -0,0 +1,18 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ export declare const Theme: unique symbol;
3
+ export declare const ThemeManager: unique symbol;
4
+ export declare const DEFAULT_THEME = "default";
5
+ export interface Theme<T> {
6
+ id: string;
7
+ label: string;
8
+ color: string;
9
+ priority: number;
10
+ props: T;
11
+ metadata: {
12
+ [key: string]: any;
13
+ };
14
+ }
15
+ export interface ThemeManager<T> {
16
+ currentSubject: BehaviorSubject<Theme<T> | undefined>;
17
+ get(): Promise<Theme<T>[]>;
18
+ }
@@ -0,0 +1,4 @@
1
+ export const Theme = Symbol('Theme');
2
+ export const ThemeManager = Symbol('ThemeManager');
3
+ export const DEFAULT_THEME = 'default';
4
+ //# sourceMappingURL=theme-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-protocol.js","sourceRoot":"","sources":["../../../src/browser/theme/theme-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { WidgetFactory, WidgetModel, WidgetManager, WidgetType } from './widget-protocol.js';
2
+ export * from './widget-manager.js';
3
+ export * from './widget-factory.js';
4
+ export * from './widget-util.js';
@@ -0,0 +1,5 @@
1
+ export { WidgetFactory, WidgetModel, WidgetManager, WidgetType } from './widget-protocol.js';
2
+ export * from './widget-manager.js';
3
+ export * from './widget-factory.js';
4
+ export * from './widget-util.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/widget/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1F,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { WidgetModel, WidgetFactory, Widget } from './widget-protocol.js';
2
+ import { ExpressionHandler } from '@celljs/core';
3
+ export declare abstract class AbstractWidgetFactory<T> implements WidgetFactory<T> {
4
+ protected readonly expressionHandler: ExpressionHandler;
5
+ priority: number;
6
+ create(widgetModel: WidgetModel): Promise<Widget<T>>;
7
+ support(widgetModel: WidgetModel): Promise<boolean>;
8
+ protected abstract doRender(widgetModel: WidgetModel, children: Widget<T>[]): Promise<T>;
9
+ }
@@ -0,0 +1,43 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { WidgetUtil } from './widget-util.js';
11
+ import { Autowired, ExpressionHandler, Injectable } from '@celljs/core';
12
+ let AbstractWidgetFactory = class AbstractWidgetFactory {
13
+ constructor() {
14
+ this.priority = 500;
15
+ }
16
+ async create(widgetModel) {
17
+ const { children = [] } = widgetModel;
18
+ return {
19
+ id: widgetModel.id,
20
+ visible: widgetModel.visible,
21
+ area: widgetModel.area,
22
+ priority: widgetModel.priority,
23
+ render: async () => {
24
+ if (widgetModel.props) {
25
+ this.expressionHandler.handle(widgetModel.props);
26
+ }
27
+ return this.doRender(widgetModel, await Promise.all(children.map(c => WidgetUtil.create(c))));
28
+ }
29
+ };
30
+ }
31
+ async support(widgetModel) {
32
+ return this.constructor.name.startsWith(widgetModel.type);
33
+ }
34
+ };
35
+ __decorate([
36
+ Autowired(ExpressionHandler),
37
+ __metadata("design:type", Object)
38
+ ], AbstractWidgetFactory.prototype, "expressionHandler", void 0);
39
+ AbstractWidgetFactory = __decorate([
40
+ Injectable()
41
+ ], AbstractWidgetFactory);
42
+ export { AbstractWidgetFactory };
43
+ //# sourceMappingURL=widget-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-factory.js","sourceRoot":"","sources":["../../../src/browser/widget/widget-factory.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGjE,IAAe,qBAAqB,GAApC,MAAe,qBAAqB;IAApC;QAKH,aAAQ,GAAG,GAAG,CAAC;IAyBnB,CAAC;IAvBG,KAAK,CAAC,MAAM,CAAC,WAAwB;QACjC,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,WAAW,CAAC;QAEtC,OAAO;YACH,EAAE,EAAE,WAAW,CAAC,EAAE;YAClB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,MAAM,EAAE,KAAK,IAAI,EAAE;gBACf,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;oBACpB,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;gBACrD,CAAC;gBACD,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrG,CAAC;SACJ,CAAC;IACN,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,WAAwB;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;CAIJ,CAAA;AA3BsB;IADlB,SAAS,CAAC,iBAAiB,CAAC;;gEAC2B;AAHtC,qBAAqB;IAD1C,UAAU,EAAE;GACS,qBAAqB,CA8B1C"}
@@ -0,0 +1,14 @@
1
+ import { WidgetManager, WidgetModel, Widget } from './widget-protocol.js';
2
+ export declare class WidgetManagerImpl<T> implements WidgetManager<T> {
3
+ protected readonly widgets: Widget<T>[];
4
+ protected readonly widgetModels: WidgetModel[];
5
+ protected readonly widgetModelsForConfig: {
6
+ [id: string]: WidgetModel;
7
+ };
8
+ protected prioritized: Map<string, Widget<T>[]>;
9
+ constructor(widgets: Widget<T>[], widgetModels: WidgetModel[], widgetModelsForConfig: {
10
+ [id: string]: WidgetModel;
11
+ });
12
+ render(area: string): Promise<T[]>;
13
+ get(area: string): Promise<Widget<T>[]>;
14
+ }
@@ -0,0 +1,77 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Component, Autowired, Prioritizeable, Value, Optional } from '@celljs/core';
14
+ import { WidgetManager, WidgetModel, Widget } from './widget-protocol.js';
15
+ import { WidgetUtil } from './widget-util.js';
16
+ let WidgetManagerImpl = class WidgetManagerImpl {
17
+ constructor(widgets, widgetModels, widgetModelsForConfig) {
18
+ this.widgets = widgets;
19
+ this.widgetModels = widgetModels;
20
+ this.widgetModelsForConfig = widgetModelsForConfig;
21
+ }
22
+ async render(area) {
23
+ const widgets = await this.get(area);
24
+ return Promise.all(widgets.map(w => w.render()));
25
+ }
26
+ async get(area) {
27
+ if (!this.prioritized) {
28
+ const result = new Map();
29
+ const config = { ...this.widgetModelsForConfig };
30
+ this.widgets.forEach(w => {
31
+ const c = config[w.id];
32
+ if (config) {
33
+ w.area = c.area;
34
+ w.priority = c.priority === undefined ? w.priority : c.priority;
35
+ w.visible = c.visible === undefined ? w.visible : c.visible;
36
+ delete config[w.id];
37
+ }
38
+ });
39
+ const parsedWdigets = await Promise.all(this.widgetModels.map(w => {
40
+ const c = config[w.id];
41
+ delete config[w.id];
42
+ return WidgetUtil.create({ ...w, ...c });
43
+ }));
44
+ const parsedWidgetsForConfig = await Promise.all((Object.keys(config).map(id => {
45
+ const widgetModel = { ...config[id] };
46
+ widgetModel.id = id;
47
+ widgetModel.priority = widgetModel.priority || 500;
48
+ widgetModel.visible = widgetModel.visible === false ? false : true;
49
+ return WidgetUtil.create(widgetModel);
50
+ })));
51
+ for (const widget of [...this.widgets, ...parsedWdigets, ...parsedWidgetsForConfig]) {
52
+ if (!result.has(widget.area)) {
53
+ result.set(widget.area, []);
54
+ }
55
+ if (widget.visible) {
56
+ result.get(widget.area).push(widget);
57
+ }
58
+ }
59
+ for (const [a, ws] of result.entries()) {
60
+ result.set(a, Prioritizeable.prioritizeAllSync(ws).map(c => c.value));
61
+ }
62
+ this.prioritized = result;
63
+ }
64
+ return this.prioritized.get(area) || [];
65
+ }
66
+ };
67
+ WidgetManagerImpl = __decorate([
68
+ Component(WidgetManager),
69
+ __param(0, Autowired(Widget)),
70
+ __param(0, Optional()),
71
+ __param(1, Autowired(WidgetModel)),
72
+ __param(1, Optional()),
73
+ __param(2, Value('cell.widget.widgets')),
74
+ __metadata("design:paramtypes", [Array, Array, Object])
75
+ ], WidgetManagerImpl);
76
+ export { WidgetManagerImpl };
77
+ //# sourceMappingURL=widget-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-manager.js","sourceRoot":"","sources":["../../../src/browser/widget/widget-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGpC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAI1B,YACsD,OAAoB,EACf,YAA2B,EACjC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,EAAE,CAAE,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;gBACvC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1E,CAAC;YACD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;CAEJ,CAAA;AA1DY,iBAAiB;IAD7B,SAAS,CAAC,aAAa,CAAC;IAMhB,WAAA,SAAS,CAAC,MAAM,CAAC,CAAA;IAAE,WAAA,QAAQ,EAAE,CAAA;IAC7B,WAAA,SAAS,CAAC,WAAW,CAAC,CAAA;IAAE,WAAA,QAAQ,EAAE,CAAA;IAClC,WAAA,KAAK,CAAC,qBAAqB,CAAC,CAAA;;GAPxB,iBAAiB,CA0D7B"}
@@ -0,0 +1,37 @@
1
+ export declare const Widget: unique symbol;
2
+ export declare const WidgetModel: unique symbol;
3
+ export declare const WidgetFactory: unique symbol;
4
+ export declare const WidgetManager: unique symbol;
5
+ export declare enum WidgetType {
6
+ Decorator = "Decorator"
7
+ }
8
+ export interface Widget<T> {
9
+ id: string;
10
+ priority: number;
11
+ area?: string;
12
+ visible: boolean;
13
+ render(): Promise<T>;
14
+ }
15
+ export interface WidgetModel {
16
+ id: string;
17
+ type: string;
18
+ priority: number;
19
+ visible: boolean;
20
+ area?: string;
21
+ props?: {
22
+ [key: string]: any;
23
+ };
24
+ matedata?: {
25
+ [key: string]: any;
26
+ };
27
+ children?: WidgetModel[];
28
+ }
29
+ export interface WidgetFactory<T> {
30
+ priority: number;
31
+ create(widgetModel: WidgetModel): Promise<Widget<T>>;
32
+ support(widgetModel: WidgetModel): Promise<boolean>;
33
+ }
34
+ export interface WidgetManager<T> {
35
+ get(area: string): Promise<Widget<T>[]>;
36
+ render(area: string): Promise<T[]>;
37
+ }
@@ -0,0 +1,9 @@
1
+ export const Widget = Symbol('Widget');
2
+ export const WidgetModel = Symbol('WidgetModel');
3
+ export const WidgetFactory = Symbol('WidgetFactory');
4
+ export const WidgetManager = Symbol('WidgetManager');
5
+ export var WidgetType;
6
+ (function (WidgetType) {
7
+ WidgetType["Decorator"] = "Decorator";
8
+ })(WidgetType || (WidgetType = {}));
9
+ //# sourceMappingURL=widget-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-protocol.js","sourceRoot":"","sources":["../../../src/browser/widget/widget-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAErD,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IAClB,qCAAuB,CAAA;AAC3B,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB"}
@@ -0,0 +1,5 @@
1
+ import { WidgetModel, Widget } from './widget-protocol.js';
2
+ export declare namespace WidgetUtil {
3
+ function create<T>(widgetModel: WidgetModel): Promise<Widget<T>>;
4
+ function render<T>(widgetModel: WidgetModel): Promise<T>;
5
+ }
@@ -0,0 +1,25 @@
1
+ import { ContainerUtil, Prioritizeable } from '@celljs/core';
2
+ import { WidgetFactory } from './widget-protocol.js';
3
+ let widgetFactories;
4
+ export var WidgetUtil;
5
+ (function (WidgetUtil) {
6
+ async function create(widgetModel) {
7
+ if (!widgetFactories) {
8
+ widgetFactories = Prioritizeable.prioritizeAllSync(ContainerUtil.getAll(WidgetFactory)).map(p => p.value);
9
+ }
10
+ for (const factory of widgetFactories) {
11
+ if (await factory.support(widgetModel)) {
12
+ const widget = await factory.create(widgetModel);
13
+ return widget;
14
+ }
15
+ }
16
+ throw new Error(`WidgetModel {id: ${widgetModel.id}, type: ${widgetModel.type}} there is no matching widget factory.`);
17
+ }
18
+ WidgetUtil.create = create;
19
+ async function render(widgetModel) {
20
+ const widget = await WidgetUtil.create(widgetModel);
21
+ return widget.render();
22
+ }
23
+ WidgetUtil.render = render;
24
+ })(WidgetUtil || (WidgetUtil = {}));
25
+ //# sourceMappingURL=widget-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-util.js","sourceRoot":"","sources":["../../../src/browser/widget/widget-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAe,aAAa,EAAU,MAAM,mBAAmB,CAAC;AAEvE,IAAI,eAAqC,CAAC;AAE1C,MAAM,KAAW,UAAU,CAoB1B;AApBD,WAAiB,UAAU;IAChB,KAAK,UAAU,MAAM,CAAI,WAAwB;QACpD,IAAI,CAAC,eAAe,EAAE,CAAC;YACnB,eAAe,GAAG,cAAc,CAAC,iBAAiB,CAAC,aAAa,CAAC,MAAM,CAAmB,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAChI,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;YACpC,IAAI,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACrC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBACjD,OAAO,MAAM,CAAC;YAClB,CAAC;QACL,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,WAAW,CAAC,EAAE,WAAW,WAAW,CAAC,IAAI,wCAAwC,CAAC,CAAC;IAC3H,CAAC;IAZqB,WAAA,MAAM,SAY3B,CAAA;IAEM,KAAK,UAAU,MAAM,CAAI,WAAwB;QACpD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAAI,WAAW,CAAC,CAAC;QACvD,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAHqB,WAAA,MAAM,SAG3B,CAAA;AAEL,CAAC,EApBgB,UAAU,KAAV,UAAU,QAoB1B"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/widget",
3
- "version": "3.8.0",
3
+ "version": "4.0.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "cell-component"
@@ -18,21 +18,71 @@
18
18
  "typings": "lib/browser/index.d.ts",
19
19
  "files": [
20
20
  "lib",
21
- "src",
22
- "cell.yml"
21
+ "esm",
22
+ "src"
23
23
  ],
24
24
  "scripts": {
25
- "build": "tsc -b",
26
- "clean": "rm -rf lib *.tsbuildinfo",
25
+ "build": "tsc -b && bun ../../scripts/build-esm.ts",
26
+ "clean": "rm -rf lib esm *.tsbuildinfo",
27
27
  "test": "bun test --preload reflect-metadata ./lib",
28
28
  "watch": "tsc -b -w --preserveWatchOutput"
29
29
  },
30
30
  "dependencies": {
31
- "@celljs/core": "3.8.0",
31
+ "@celljs/core": "4.0.0",
32
32
  "rxjs": "^6.6.0",
33
33
  "tslib": "^2.8.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
37
+ },
38
+ "exports": {
39
+ ".": {
40
+ "import": "./esm/browser/index.js",
41
+ "default": "./lib/browser/index.js"
42
+ },
43
+ "./package.json": "./package.json",
44
+ "./lib/browser": {
45
+ "import": "./esm/browser/index.js",
46
+ "default": "./lib/browser/index.js"
47
+ },
48
+ "./lib/browser/annotation": {
49
+ "import": "./esm/browser/annotation/index.js",
50
+ "default": "./lib/browser/annotation/index.js"
51
+ },
52
+ "./lib/browser/keyboard": {
53
+ "import": "./esm/browser/keyboard/index.js",
54
+ "default": "./lib/browser/keyboard/index.js"
55
+ },
56
+ "./lib/browser/locale": {
57
+ "import": "./esm/browser/locale/index.js",
58
+ "default": "./lib/browser/locale/index.js"
59
+ },
60
+ "./lib/browser/theme": {
61
+ "import": "./esm/browser/theme/index.js",
62
+ "default": "./lib/browser/theme/index.js"
63
+ },
64
+ "./lib/browser/widget": {
65
+ "import": "./esm/browser/widget/index.js",
66
+ "default": "./lib/browser/widget/index.js"
67
+ },
68
+ "./lib/*.js": {
69
+ "import": "./esm/*.js",
70
+ "default": "./lib/*.js"
71
+ },
72
+ "./lib/*": {
73
+ "import": "./esm/*.js",
74
+ "default": "./lib/*.js"
75
+ },
76
+ "./*": "./*"
77
+ },
78
+ "cell": {
79
+ "modules": {
80
+ "frontend": [
81
+ "lib/browser/module"
82
+ ]
83
+ },
84
+ "targets": [
85
+ "frontend"
86
+ ]
37
87
  }
38
88
  }
package/cell.yml DELETED
@@ -1,3 +0,0 @@
1
- targets:
2
- - frontend
3
- - backend