@difizen/libro-widget 0.1.32 → 0.1.34

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 (119) hide show
  1. package/es/index.d.ts +3 -4
  2. package/es/index.d.ts.map +1 -1
  3. package/es/index.js +3 -4
  4. package/es/module.d.ts +3 -0
  5. package/es/module.d.ts.map +1 -0
  6. package/es/module.js +5 -0
  7. package/es/slider/contribution.d.ts +10 -0
  8. package/es/slider/contribution.d.ts.map +1 -0
  9. package/es/{widgets/instances-progress-widget-view-contribution.js → slider/contribution.js} +15 -9
  10. package/es/slider/index.d.ts +3 -0
  11. package/es/slider/index.d.ts.map +1 -0
  12. package/es/slider/index.js +2 -0
  13. package/es/slider/index.less +3 -0
  14. package/es/slider/view.d.ts +23 -0
  15. package/es/slider/view.d.ts.map +1 -0
  16. package/es/{widgets/progress-widget-view.js → slider/view.js} +62 -68
  17. package/es/text/contribution.d.ts +10 -0
  18. package/es/text/contribution.d.ts.map +1 -0
  19. package/es/{widgets/text-widget-view-contribution.js → text/contribution.js} +3 -3
  20. package/es/text/index.d.ts +3 -0
  21. package/es/text/index.d.ts.map +1 -0
  22. package/es/text/index.js +2 -0
  23. package/es/{widgets/text-widget-view.d.ts → text/view.d.ts} +5 -6
  24. package/es/text/view.d.ts.map +1 -0
  25. package/es/{widgets/text-widget-view.js → text/view.js} +11 -12
  26. package/package.json +6 -5
  27. package/src/index.spec.ts +2 -3
  28. package/src/index.ts +3 -4
  29. package/src/module.ts +15 -0
  30. package/src/slider/contribution.ts +25 -0
  31. package/src/slider/index.less +3 -0
  32. package/src/slider/index.ts +2 -0
  33. package/src/slider/view.tsx +92 -0
  34. package/src/{widgets/text-widget-view-contribution.ts → text/contribution.ts} +4 -5
  35. package/src/text/index.ts +2 -0
  36. package/src/{widgets/text-widget-view.tsx → text/view.tsx} +7 -10
  37. package/es/base/comm.d.ts +0 -65
  38. package/es/base/comm.d.ts.map +0 -1
  39. package/es/base/comm.js +0 -151
  40. package/es/base/index.d.ts +0 -7
  41. package/es/base/index.d.ts.map +0 -1
  42. package/es/base/index.js +0 -6
  43. package/es/base/libro-widgets.d.ts +0 -79
  44. package/es/base/libro-widgets.d.ts.map +0 -1
  45. package/es/base/libro-widgets.js +0 -286
  46. package/es/base/protocal.d.ts +0 -171
  47. package/es/base/protocal.d.ts.map +0 -1
  48. package/es/base/protocal.js +0 -21
  49. package/es/base/utils.d.ts +0 -27
  50. package/es/base/utils.d.ts.map +0 -1
  51. package/es/base/utils.js +0 -59
  52. package/es/base/version.d.ts +0 -3
  53. package/es/base/version.d.ts.map +0 -1
  54. package/es/base/version.js +0 -2
  55. package/es/base/widget-manager.d.ts +0 -18
  56. package/es/base/widget-manager.d.ts.map +0 -1
  57. package/es/base/widget-manager.js +0 -68
  58. package/es/base/widget-view-contribution.d.ts +0 -10
  59. package/es/base/widget-view-contribution.d.ts.map +0 -1
  60. package/es/base/widget-view-contribution.js +0 -36
  61. package/es/base/widget-view.d.ts +0 -52
  62. package/es/base/widget-view.d.ts.map +0 -1
  63. package/es/base/widget-view.js +0 -137
  64. package/es/components/index.d.ts +0 -3
  65. package/es/components/index.d.ts.map +0 -1
  66. package/es/components/index.js +0 -2
  67. package/es/components/progressBar.d.ts +0 -15
  68. package/es/components/progressBar.d.ts.map +0 -1
  69. package/es/components/progressBar.js +0 -20
  70. package/es/components/progressCircle.d.ts +0 -11
  71. package/es/components/progressCircle.d.ts.map +0 -1
  72. package/es/components/progressCircle.js +0 -16
  73. package/es/widget-module.d.ts +0 -3
  74. package/es/widget-module.d.ts.map +0 -1
  75. package/es/widget-module.js +0 -39
  76. package/es/widgets/hbox-widget-view-contribution.d.ts +0 -10
  77. package/es/widgets/hbox-widget-view-contribution.d.ts.map +0 -1
  78. package/es/widgets/hbox-widget-view-contribution.js +0 -39
  79. package/es/widgets/hbox-widget-view.d.ts +0 -17
  80. package/es/widgets/hbox-widget-view.d.ts.map +0 -1
  81. package/es/widgets/hbox-widget-view.js +0 -69
  82. package/es/widgets/index.d.ts +0 -9
  83. package/es/widgets/index.d.ts.map +0 -1
  84. package/es/widgets/index.js +0 -8
  85. package/es/widgets/index.less +0 -3
  86. package/es/widgets/instances-progress-widget-view-contribution.d.ts +0 -10
  87. package/es/widgets/instances-progress-widget-view-contribution.d.ts.map +0 -1
  88. package/es/widgets/instances-progress-widget-view.d.ts +0 -31
  89. package/es/widgets/instances-progress-widget-view.d.ts.map +0 -1
  90. package/es/widgets/instances-progress-widget-view.js +0 -181
  91. package/es/widgets/progress-widget-view-contribution.d.ts +0 -10
  92. package/es/widgets/progress-widget-view-contribution.d.ts.map +0 -1
  93. package/es/widgets/progress-widget-view-contribution.js +0 -39
  94. package/es/widgets/progress-widget-view.d.ts +0 -25
  95. package/es/widgets/progress-widget-view.d.ts.map +0 -1
  96. package/es/widgets/text-widget-view-contribution.d.ts +0 -10
  97. package/es/widgets/text-widget-view-contribution.d.ts.map +0 -1
  98. package/es/widgets/text-widget-view.d.ts.map +0 -1
  99. package/src/base/comm.ts +0 -152
  100. package/src/base/index.ts +0 -6
  101. package/src/base/libro-widgets.ts +0 -207
  102. package/src/base/protocal.ts +0 -218
  103. package/src/base/utils.ts +0 -67
  104. package/src/base/version.ts +0 -2
  105. package/src/base/widget-manager.ts +0 -41
  106. package/src/base/widget-view-contribution.ts +0 -14
  107. package/src/base/widget-view.tsx +0 -146
  108. package/src/components/index.ts +0 -3
  109. package/src/components/progressBar.tsx +0 -29
  110. package/src/components/progressCircle.tsx +0 -18
  111. package/src/widget-module.ts +0 -68
  112. package/src/widgets/hbox-widget-view-contribution.ts +0 -20
  113. package/src/widgets/hbox-widget-view.tsx +0 -64
  114. package/src/widgets/index.less +0 -3
  115. package/src/widgets/index.ts +0 -8
  116. package/src/widgets/instances-progress-widget-view-contribution.ts +0 -20
  117. package/src/widgets/instances-progress-widget-view.tsx +0 -160
  118. package/src/widgets/progress-widget-view-contribution.ts +0 -24
  119. package/src/widgets/progress-widget-view.tsx +0 -85
@@ -1,68 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
3
- function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
4
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
10
- function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
11
- import { LibroService } from '@difizen/libro-core';
12
- import { KernelConnection, LibroKernelManager } from '@difizen/libro-kernel';
13
- import { inject, prop, singleton, ApplicationContribution } from '@difizen/mana-app';
14
- import { LibroWidgetsFactory } from "./protocal.js";
15
- export var LibroWidgetManager = (_dec = singleton({
16
- contrib: ApplicationContribution
17
- }), _dec2 = inject(LibroWidgetsFactory), _dec3 = inject(LibroKernelManager), _dec4 = inject(LibroService), _dec5 = prop(), _dec(_class = (_class2 = /*#__PURE__*/_createClass(function LibroWidgetManager() {
18
- var _this = this;
19
- _classCallCheck(this, LibroWidgetManager);
20
- _initializerDefineProperty(this, "widgetsFactory", _descriptor, this);
21
- _initializerDefineProperty(this, "kernelManager", _descriptor2, this);
22
- _initializerDefineProperty(this, "libroService", _descriptor3, this);
23
- this.initialize = function () {
24
- _this.kernelManager.onConnectToKernel(function (kc) {
25
- if (kc instanceof KernelConnection) {
26
- _this.getOrCreateWidgets(kc);
27
- }
28
- });
29
- };
30
- this.getOrCreateWidgets = function (kc) {
31
- var widgets = _this.widgets.get(kc.id);
32
- if (widgets) {
33
- return widgets;
34
- }
35
- var newWidgets = _this.widgetsFactory({
36
- kc: kc,
37
- id: kc.id
38
- });
39
- _this.widgets.set(kc.id, newWidgets);
40
- return newWidgets;
41
- };
42
- /**
43
- * Dictionary of model ids and model instance promises
44
- */
45
- _initializerDefineProperty(this, "widgets", _descriptor4, this);
46
- }), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "widgetsFactory", [_dec2], {
47
- configurable: true,
48
- enumerable: true,
49
- writable: true,
50
- initializer: null
51
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "kernelManager", [_dec3], {
52
- configurable: true,
53
- enumerable: true,
54
- writable: true,
55
- initializer: null
56
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "libroService", [_dec4], {
57
- configurable: true,
58
- enumerable: true,
59
- writable: true,
60
- initializer: null
61
- }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "widgets", [_dec5], {
62
- configurable: true,
63
- enumerable: true,
64
- writable: true,
65
- initializer: function initializer() {
66
- return new Map();
67
- }
68
- })), _class2)) || _class);
@@ -1,10 +0,0 @@
1
- import { ViewManager } from '@difizen/mana-app';
2
- import type { IWidgetViewProps } from './protocal.js';
3
- import { WidgetViewContribution } from './protocal.js';
4
- import { WidgetView } from './widget-view.js';
5
- export declare class DefaultWidgetViewContribution implements WidgetViewContribution {
6
- viewManager: ViewManager;
7
- canHandle: () => number;
8
- factory(props: IWidgetViewProps): Promise<WidgetView>;
9
- }
10
- //# sourceMappingURL=widget-view-contribution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget-view-contribution.d.ts","sourceRoot":"","sources":["../../src/base/widget-view-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,qBACa,6BAA8B,YAAW,sBAAsB;IACrD,WAAW,EAAE,WAAW,CAAC;IAC9C,SAAS,eAAW;IACpB,OAAO,CAAC,KAAK,EAAE,gBAAgB;CAGhC"}
@@ -1,36 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _dec, _dec2, _class, _class2, _descriptor;
3
- function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
10
- function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
11
- import { ViewManager, inject, singleton } from '@difizen/mana-app';
12
- import { WidgetViewContribution } from "./protocal.js";
13
- import { WidgetView } from "./widget-view.js";
14
- export var DefaultWidgetViewContribution = (_dec = singleton({
15
- contrib: WidgetViewContribution
16
- }), _dec2 = inject(ViewManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
17
- function DefaultWidgetViewContribution() {
18
- _classCallCheck(this, DefaultWidgetViewContribution);
19
- _initializerDefineProperty(this, "viewManager", _descriptor, this);
20
- this.canHandle = function () {
21
- return 1;
22
- };
23
- }
24
- _createClass(DefaultWidgetViewContribution, [{
25
- key: "factory",
26
- value: function factory(props) {
27
- return this.viewManager.getOrCreateView(WidgetView, props);
28
- }
29
- }]);
30
- return DefaultWidgetViewContribution;
31
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "viewManager", [_dec2], {
32
- configurable: true,
33
- enumerable: true,
34
- writable: true,
35
- initializer: null
36
- })), _class2)) || _class);
@@ -1,52 +0,0 @@
1
- /// <reference types="react" resolution-mode="require"/>
2
- import type { JSONValue } from '@difizen/libro-common';
3
- import { LibroContextKey } from '@difizen/libro-core';
4
- import type { KernelMessage } from '@difizen/libro-kernel';
5
- import { BaseView } from '@difizen/mana-app';
6
- import type { ViewComponent } from '@difizen/mana-app';
7
- import type { IWidgetViewProps } from './protocal.js';
8
- import type { Dict, IWidgets, IWidgetView, IClassicComm, ICallbacks } from './protocal.js';
9
- export declare const LibroWidgetComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
10
- export declare class WidgetView extends BaseView implements IWidgetView {
11
- view: ViewComponent;
12
- libroContextKey: LibroContextKey;
13
- disableCommandMode: boolean;
14
- constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey);
15
- onViewMount(): void;
16
- initialize(props: IWidgetViewProps): void;
17
- /**
18
- * Handle incoming comm msg.
19
- */
20
- handleCommMsg(msg: KernelMessage.ICommMsgMsg): Promise<void>;
21
- handleCommClosed: () => void;
22
- /**
23
- * Handle when a widget is updated from the backend.
24
- *
25
- * This function is meant for internal use only. Values set here will not be propagated on a sync.
26
- */
27
- set_state(state: Dict<unknown>): void;
28
- /**
29
- * Serialize the model. See the deserialization function at the top of this file
30
- * and the kernel-side serializer/deserializer.
31
- */
32
- toJSON(): string;
33
- /**
34
- * Send a custom msg over the comm.
35
- */
36
- send: (data: JSONValue, callbacks?: ICallbacks, buffers?: ArrayBuffer[] | ArrayBufferView[]) => void;
37
- comm: IClassicComm;
38
- libroWidgets: IWidgets;
39
- model_id: string;
40
- state_change: Promise<any>;
41
- name: string;
42
- module: string;
43
- isCommClosed: boolean;
44
- model_module: string;
45
- model_name: string;
46
- model_module_version: string;
47
- view_module: string;
48
- view_name: string | null;
49
- view_module_version: string;
50
- view_count: number | null;
51
- }
52
- //# sourceMappingURL=widget-view.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget-view.d.ts","sourceRoot":"","sources":["../../src/base/widget-view.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAuC,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAEV,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,UAAU,EACX,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,oBAAoB,0FAIhC,CAAC;AAEF,qBAEa,UAAW,SAAQ,QAAS,YAAW,WAAW;IACpD,IAAI,EAAE,aAAa,CAAwB;IACpD,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,UAAQ;gBAEJ,KAAK,EAAE,gBAAgB,EAClB,eAAe,EAAE,eAAe;IAOlD,WAAW;IAepB,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IA2BzC;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE,aAAa,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAa5D,gBAAgB,aAEd;IACF;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI;IAIrC;;;OAGG;IACH,MAAM,IAAI,MAAM;IAIhB;;OAEG;IACH,IAAI,SACI,SAAS,cACH,UAAU,YACZ,WAAW,EAAE,GAAG,eAAe,EAAE,UAK3C;IAEF,IAAI,EAAE,YAAY,CAAC;IACnB,YAAY,EAAE,QAAQ,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,UAAS;IAErB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
@@ -1,137 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _dec, _dec2, _class;
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
- import { LibroContextKey } from '@difizen/libro-core';
16
- import { inject, transient, ViewOption, view, BaseView } from '@difizen/mana-app';
17
- import { forwardRef } from 'react';
18
- import { assign } from "./utils.js";
19
- import { Fragment as _Fragment } from "react/jsx-runtime";
20
- import { jsx as _jsx } from "react/jsx-runtime";
21
- export var LibroWidgetComponent = /*#__PURE__*/forwardRef(function LibroWidgetComponent() {
22
- return /*#__PURE__*/_jsx(_Fragment, {});
23
- });
24
- export var WidgetView = (_dec = transient(), _dec2 = view('libro-widget-view'), _dec(_class = _dec2(_class = /*#__PURE__*/function (_BaseView) {
25
- _inherits(WidgetView, _BaseView);
26
- var _super = _createSuper(WidgetView);
27
- function WidgetView(props, libroContextKey) {
28
- var _this;
29
- _classCallCheck(this, WidgetView);
30
- _this = _super.call(this);
31
- _this.view = LibroWidgetComponent;
32
- _this.disableCommandMode = true;
33
- _this.handleCommClosed = function () {
34
- _this.isCommClosed = true;
35
- };
36
- /**
37
- * Send a custom msg over the comm.
38
- */
39
- _this.send = function (data, callbacks, buffers) {
40
- if (_this.comm !== undefined) {
41
- _this.comm.send(data, callbacks, {}, buffers);
42
- }
43
- };
44
- _this.isCommClosed = false;
45
- _this.initialize(props);
46
- _this.libroContextKey = libroContextKey;
47
- return _this;
48
- }
49
- WidgetView = inject(LibroContextKey)(WidgetView, undefined, 1) || WidgetView;
50
- WidgetView = inject(ViewOption)(WidgetView, undefined, 0) || WidgetView;
51
- _createClass(WidgetView, [{
52
- key: "onViewMount",
53
- value: function onViewMount() {
54
- var _this2 = this;
55
- if (this.container && this.container.current && this.disableCommandMode) {
56
- this.container.current.addEventListener('focusin', function () {
57
- _this2.libroContextKey.disableCommandMode();
58
- });
59
- this.container.current.addEventListener('blur', function (e) {
60
- var _this2$container;
61
- if ((_this2$container = _this2.container) !== null && _this2$container !== void 0 && (_this2$container = _this2$container.current) !== null && _this2$container !== void 0 && _this2$container.contains(e.relatedTarget)) {
62
- _this2.libroContextKey.disableCommandMode();
63
- } else {
64
- _this2.libroContextKey.enableCommandMode();
65
- }
66
- });
67
- }
68
- }
69
- }, {
70
- key: "initialize",
71
- value: function initialize(props) {
72
- this.model_module = props.attributes._model_module;
73
- this.model_name = props.attributes._model_name;
74
- this.model_module_version = props.attributes._model_module_version;
75
- this.view_module = props.attributes._view_module;
76
- this.view_name = props.attributes._view_name;
77
- this.view_module_version = props.attributes._view_module_version;
78
- this.view_count = props.attributes._view_count;
79
-
80
- // Attributes should be initialized here, since user initialization may depend on it
81
- // this.libroWidgets = props.options.libroWidgets;
82
- var comm = props.options.comm;
83
- if (comm) {
84
- // Remember comm associated with the model.
85
- this.comm = comm;
86
-
87
- // Hook comm messages up to model.
88
- comm.on_close(this.handleCommClosed.bind(this));
89
- comm.on_msg(this.handleCommMsg.bind(this));
90
- } else {
91
- this.isCommClosed = false;
92
- }
93
- this.model_id = props.options.model_id;
94
- this.state_change = Promise.resolve();
95
- }
96
-
97
- /**
98
- * Handle incoming comm msg.
99
- */
100
- }, {
101
- key: "handleCommMsg",
102
- value: function handleCommMsg(msg) {
103
- var data = msg.content.data;
104
- var method = data.method;
105
- switch (method) {
106
- case 'update':
107
- case 'echo_update':
108
- // eslint-disable-next-line no-case-declarations
109
- var state = data.state;
110
- this.set_state(state);
111
- }
112
- return Promise.resolve();
113
- }
114
- }, {
115
- key: "set_state",
116
- value:
117
- /**
118
- * Handle when a widget is updated from the backend.
119
- *
120
- * This function is meant for internal use only. Values set here will not be propagated on a sync.
121
- */
122
- function set_state(state) {
123
- assign(this, state);
124
- }
125
-
126
- /**
127
- * Serialize the model. See the deserialization function at the top of this file
128
- * and the kernel-side serializer/deserializer.
129
- */
130
- }, {
131
- key: "toJSON",
132
- value: function toJSON() {
133
- return "IPY_MODEL_".concat(this.model_id);
134
- }
135
- }]);
136
- return WidgetView;
137
- }(BaseView)) || _class) || _class);
@@ -1,3 +0,0 @@
1
- export * from './progressBar.js';
2
- export * from './progressCircle.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,qBAAqB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./progressBar.js";
2
- export * from "./progressCircle.js";
@@ -1,15 +0,0 @@
1
- /**
2
- * Props for the ProgressBar.
3
- */
4
- export interface IProgressBarProps {
5
- /**
6
- * The current progress percentage, from 0 to 100
7
- */
8
- percent: number;
9
- /**
10
- * Width of progress bar in pixel.
11
- */
12
- width?: number;
13
- }
14
- export declare function ProgressBar(props: IProgressBarProps): import("react/jsx-runtime").JSX.Element;
15
- //# sourceMappingURL=progressBar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"progressBar.d.ts","sourceRoot":"","sources":["../../src/components/progressBar.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,2CAYnD"}
@@ -1,20 +0,0 @@
1
- import { Progress } from 'antd';
2
-
3
- /**
4
- * Props for the ProgressBar.
5
- */
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- import { Fragment as _Fragment } from "react/jsx-runtime";
8
- export function ProgressBar(props) {
9
- return /*#__PURE__*/_jsx(_Fragment, {
10
- children: /*#__PURE__*/_jsx(Progress, {
11
- strokeLinecap: "butt",
12
- percent: props.percent,
13
- strokeWidth: 18,
14
- showInfo: false,
15
- style: {
16
- width: '200px'
17
- }
18
- })
19
- });
20
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Props for the ProgressBar.
3
- */
4
- export interface IProgressCircleProps {
5
- /**
6
- * The current progress percentage, from 0 to 100
7
- */
8
- percent: number;
9
- }
10
- export declare function ProgressCircle(props: IProgressCircleProps): import("react/jsx-runtime").JSX.Element;
11
- //# sourceMappingURL=progressCircle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"progressCircle.d.ts","sourceRoot":"","sources":["../../src/components/progressCircle.tsx"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,oBAAoB,2CAMzD"}
@@ -1,16 +0,0 @@
1
- import { Progress } from 'antd';
2
- /**
3
- * Props for the ProgressBar.
4
- */
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- import { Fragment as _Fragment } from "react/jsx-runtime";
7
- import { jsxs as _jsxs } from "react/jsx-runtime";
8
- export function ProgressCircle(props) {
9
- return /*#__PURE__*/_jsxs(_Fragment, {
10
- children: [/*#__PURE__*/_jsx(Progress, {
11
- strokeLinecap: "butt",
12
- type: "circle",
13
- percent: props.percent
14
- }), ";"]
15
- });
16
- }
@@ -1,3 +0,0 @@
1
- import { ManaModule } from '@difizen/mana-app';
2
- export declare const WidgetModule: ManaModule;
3
- //# sourceMappingURL=widget-module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget-module.d.ts","sourceRoot":"","sources":["../src/widget-module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAuB/C,eAAO,MAAM,YAAY,YA2CW,CAAC"}
@@ -1,39 +0,0 @@
1
- import { LibroKernelManageModule } from '@difizen/libro-kernel';
2
- import { ManaModule } from '@difizen/mana-app';
3
- import { Comm } from "./base/comm.js";
4
- import { WidgetsOption, LibroWidgetCommFactory, WidgetCommOption, LibroWidgets, LibroWidgetsFactory, WidgetView, WidgetViewContribution } from "./base/index.js";
5
- import { LibroWidgetManager } from "./base/widget-manager.js";
6
- import { DefaultWidgetViewContribution } from "./base/widget-view-contribution.js";
7
- import { HBoxModelContribution } from "./widgets/hbox-widget-view-contribution.js";
8
- import { HBoxWidget } from "./widgets/hbox-widget-view.js";
9
- import { ProgressWidget } from "./widgets/index.js";
10
- import { InstancesProgressWidgetViewContribution } from "./widgets/instances-progress-widget-view-contribution.js";
11
- import { InstancesProgressWidget } from "./widgets/instances-progress-widget-view.js";
12
- import { ProgressWidgetViewContribution } from "./widgets/progress-widget-view-contribution.js";
13
- import { TextModelContribution } from "./widgets/text-widget-view-contribution.js";
14
- import { LibroTextWidget } from "./widgets/text-widget-view.js";
15
- export var WidgetModule = ManaModule.create().contribution(WidgetViewContribution).register(Comm, {
16
- token: LibroWidgetCommFactory,
17
- useFactory: function useFactory(ctx) {
18
- return function (options) {
19
- var child = ctx.container.createChild();
20
- child.register({
21
- token: WidgetCommOption,
22
- useValue: options
23
- });
24
- return child.get(Comm);
25
- };
26
- }
27
- }, LibroWidgets, {
28
- token: LibroWidgetsFactory,
29
- useFactory: function useFactory(ctx) {
30
- return function (options) {
31
- var child = ctx.container.createChild();
32
- child.register({
33
- token: WidgetsOption,
34
- useValue: options
35
- });
36
- return child.get(LibroWidgets);
37
- };
38
- }
39
- }, LibroWidgetManager, WidgetView, ProgressWidget, DefaultWidgetViewContribution, ProgressWidgetViewContribution, InstancesProgressWidgetViewContribution, InstancesProgressWidget, HBoxModelContribution, HBoxWidget, LibroTextWidget, TextModelContribution).dependOn(LibroKernelManageModule);
@@ -1,10 +0,0 @@
1
- import { ViewManager } from '@difizen/mana-app';
2
- import type { IWidgetViewProps } from '../base/protocal.js';
3
- import { WidgetViewContribution } from '../base/protocal.js';
4
- import { HBoxWidget } from './hbox-widget-view.js';
5
- export declare class HBoxModelContribution implements WidgetViewContribution {
6
- viewManager: ViewManager;
7
- canHandle: (attributes: any) => 1 | 100;
8
- factory(props: IWidgetViewProps): Promise<HBoxWidget>;
9
- }
10
- //# sourceMappingURL=hbox-widget-view-contribution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hbox-widget-view-contribution.d.ts","sourceRoot":"","sources":["../../src/widgets/hbox-widget-view-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,qBACa,qBAAsB,YAAW,sBAAsB;IAC7C,WAAW,EAAE,WAAW,CAAC;IAC9C,SAAS,eAAgB,GAAG,aAK1B;IACF,OAAO,CAAC,KAAK,EAAE,gBAAgB;CAGhC"}
@@ -1,39 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _dec, _dec2, _class, _class2, _descriptor;
3
- function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
10
- function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
11
- import { ViewManager, inject, singleton } from '@difizen/mana-app';
12
- import { WidgetViewContribution } from "../base/protocal.js";
13
- import { HBoxWidget } from "./hbox-widget-view.js";
14
- export var HBoxModelContribution = (_dec = singleton({
15
- contrib: WidgetViewContribution
16
- }), _dec2 = inject(ViewManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
17
- function HBoxModelContribution() {
18
- _classCallCheck(this, HBoxModelContribution);
19
- _initializerDefineProperty(this, "viewManager", _descriptor, this);
20
- this.canHandle = function (attributes) {
21
- if (attributes._model_name === 'HBoxModel') {
22
- return 100;
23
- }
24
- return 1;
25
- };
26
- }
27
- _createClass(HBoxModelContribution, [{
28
- key: "factory",
29
- value: function factory(props) {
30
- return this.viewManager.getOrCreateView(HBoxWidget, props);
31
- }
32
- }]);
33
- return HBoxModelContribution;
34
- }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "viewManager", [_dec2], {
35
- configurable: true,
36
- enumerable: true,
37
- writable: true,
38
- initializer: null
39
- })), _class2)) || _class);
@@ -1,17 +0,0 @@
1
- /// <reference types="react" resolution-mode="require"/>
2
- import { LibroContextKey } from '@difizen/libro-core';
3
- import { LibroWidgets } from '../base/libro-widgets.js';
4
- import type { IWidgetViewProps } from '../base/protocal.js';
5
- import { WidgetView } from '../base/widget-view.js';
6
- import './index.less';
7
- export declare const HBoxWidgetComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
8
- export declare class HBoxWidget extends WidgetView {
9
- view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
10
- children: string[];
11
- layout: string;
12
- box_style: string;
13
- libroWidgets: LibroWidgets;
14
- constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey, libroWidgets: LibroWidgets);
15
- get_child_model(): WidgetView[];
16
- }
17
- //# sourceMappingURL=hbox-widget-view.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hbox-widget-view.d.ts","sourceRoot":"","sources":["../../src/widgets/hbox-widget-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAYtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,cAAc,CAAC;AAEtB,eAAO,MAAM,mBAAmB,0FAe/B,CAAC;AACF,qBAEa,UAAW,SAAQ,UAAU;IAC/B,IAAI,2FAAuB;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IACT,YAAY,EAAE,YAAY,CAAC;gBAEd,KAAK,EAAE,gBAAgB,EAClB,eAAe,EAAE,eAAe,EACnC,YAAY,EAAE,YAAY;IAUlD,eAAe,IAAI,UAAU,EAAE;CAShC"}
@@ -1,69 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _dec, _dec2, _class;
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
- import { LibroContextKey } from '@difizen/libro-core';
16
- import { view, ViewOption, ViewRender, transient, useInject, ViewInstance, inject } from '@difizen/mana-app';
17
- import { forwardRef } from 'react';
18
- import { LibroWidgets } from "../base/libro-widgets.js";
19
- import { WidgetView } from "../base/widget-view.js";
20
- import "./index.less";
21
- import { jsx as _jsx } from "react/jsx-runtime";
22
- export var HBoxWidgetComponent = /*#__PURE__*/forwardRef(function HBoxWidgetComponent() {
23
- var widgetView = useInject(ViewInstance);
24
- if (widgetView.isCommClosed) {
25
- return null;
26
- }
27
- var hboxChildrenWidget = widgetView.get_child_model();
28
- return /*#__PURE__*/_jsx("div", {
29
- className: "libro-hbox-widget",
30
- children: hboxChildrenWidget.map(function (childrenWidgets) {
31
- return /*#__PURE__*/_jsx(ViewRender, {
32
- view: childrenWidgets
33
- }, childrenWidgets.id);
34
- })
35
- });
36
- });
37
- export var HBoxWidget = (_dec = transient(), _dec2 = view('libro-hbox-widget-view'), _dec(_class = _dec2(_class = /*#__PURE__*/function (_WidgetView) {
38
- _inherits(HBoxWidget, _WidgetView);
39
- var _super = _createSuper(HBoxWidget);
40
- function HBoxWidget(props, libroContextKey, libroWidgets) {
41
- var _this;
42
- _classCallCheck(this, HBoxWidget);
43
- _this = _super.call(this, props, libroContextKey);
44
- _this.view = HBoxWidgetComponent;
45
- _this.box_style = props.attributes.bar_style;
46
- _this.layout = props.attributes.layout;
47
- _this.children = props.attributes.children;
48
- _this.libroContextKey = libroContextKey;
49
- _this.libroWidgets = libroWidgets;
50
- return _this;
51
- }
52
- HBoxWidget = inject(LibroWidgets)(HBoxWidget, undefined, 2) || HBoxWidget;
53
- HBoxWidget = inject(LibroContextKey)(HBoxWidget, undefined, 1) || HBoxWidget;
54
- HBoxWidget = inject(ViewOption)(HBoxWidget, undefined, 0) || HBoxWidget;
55
- _createClass(HBoxWidget, [{
56
- key: "get_child_model",
57
- value: function get_child_model() {
58
- var _this2 = this;
59
- var childrenWidgets = [];
60
- this.children.forEach(function (child) {
61
- if (_this2.libroWidgets.hasModel(child.substring(10))) {
62
- childrenWidgets.push(_this2.libroWidgets.getModel(child.substring(10)));
63
- }
64
- });
65
- return childrenWidgets;
66
- }
67
- }]);
68
- return HBoxWidget;
69
- }(WidgetView)) || _class) || _class);
@@ -1,9 +0,0 @@
1
- export * from './hbox-widget-view.js';
2
- export * from './hbox-widget-view-contribution.js';
3
- export * from './instances-progress-widget-view.js';
4
- export * from './instances-progress-widget-view-contribution.js';
5
- export * from './progress-widget-view.js';
6
- export * from './progress-widget-view-contribution.js';
7
- export * from './text-widget-view.js';
8
- export * from './text-widget-view-contribution.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kDAAkD,CAAC;AACjE,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC;AACvD,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC"}