@difizen/libro-widget 0.1.29 → 0.1.31
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/es/base/widget-view.d.ts +3 -3
- package/es/base/widget-view.js +7 -7
- package/es/widgets/hbox-widget-view.d.ts +3 -3
- package/es/widgets/hbox-widget-view.d.ts.map +1 -1
- package/es/widgets/hbox-widget-view.js +6 -6
- package/es/widgets/instances-progress-widget-view.d.ts +2 -2
- package/es/widgets/instances-progress-widget-view.js +4 -4
- package/es/widgets/progress-widget-view.d.ts +2 -2
- package/es/widgets/progress-widget-view.js +4 -4
- package/es/widgets/text-widget-view.d.ts +2 -2
- package/es/widgets/text-widget-view.js +4 -4
- package/package.json +5 -5
- package/src/base/widget-view.tsx +7 -7
- package/src/widgets/hbox-widget-view.tsx +5 -5
- package/src/widgets/instances-progress-widget-view.tsx +3 -3
- package/src/widgets/progress-widget-view.tsx +3 -3
- package/src/widgets/text-widget-view.tsx +3 -3
package/es/base/widget-view.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
2
|
import type { JSONValue } from '@difizen/libro-common';
|
|
3
|
-
import {
|
|
3
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
4
4
|
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
5
5
|
import { BaseView } from '@difizen/mana-app';
|
|
6
6
|
import type { ViewComponent } from '@difizen/mana-app';
|
|
@@ -9,9 +9,9 @@ import type { Dict, IWidgets, IWidgetView, IClassicComm, ICallbacks } from './pr
|
|
|
9
9
|
export declare const LibroWidgetComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
10
10
|
export declare class WidgetView extends BaseView implements IWidgetView {
|
|
11
11
|
view: ViewComponent;
|
|
12
|
-
|
|
12
|
+
libroContextKey: LibroContextKey;
|
|
13
13
|
disableCommandMode: boolean;
|
|
14
|
-
constructor(props: IWidgetViewProps,
|
|
14
|
+
constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey);
|
|
15
15
|
onViewMount(): void;
|
|
16
16
|
initialize(props: IWidgetViewProps): void;
|
|
17
17
|
/**
|
package/es/base/widget-view.js
CHANGED
|
@@ -12,7 +12,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
12
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
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
14
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
-
import {
|
|
15
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
16
16
|
import { inject, transient, ViewOption, view, BaseView } from '@difizen/mana-app';
|
|
17
17
|
import { forwardRef } from 'react';
|
|
18
18
|
import { assign } from "./utils.js";
|
|
@@ -24,7 +24,7 @@ export var LibroWidgetComponent = /*#__PURE__*/forwardRef(function LibroWidgetCo
|
|
|
24
24
|
export var WidgetView = (_dec = transient(), _dec2 = view('libro-widget-view'), _dec(_class = _dec2(_class = /*#__PURE__*/function (_BaseView) {
|
|
25
25
|
_inherits(WidgetView, _BaseView);
|
|
26
26
|
var _super = _createSuper(WidgetView);
|
|
27
|
-
function WidgetView(props,
|
|
27
|
+
function WidgetView(props, libroContextKey) {
|
|
28
28
|
var _this;
|
|
29
29
|
_classCallCheck(this, WidgetView);
|
|
30
30
|
_this = _super.call(this);
|
|
@@ -43,10 +43,10 @@ export var WidgetView = (_dec = transient(), _dec2 = view('libro-widget-view'),
|
|
|
43
43
|
};
|
|
44
44
|
_this.isCommClosed = false;
|
|
45
45
|
_this.initialize(props);
|
|
46
|
-
_this.
|
|
46
|
+
_this.libroContextKey = libroContextKey;
|
|
47
47
|
return _this;
|
|
48
48
|
}
|
|
49
|
-
WidgetView = inject(
|
|
49
|
+
WidgetView = inject(LibroContextKey)(WidgetView, undefined, 1) || WidgetView;
|
|
50
50
|
WidgetView = inject(ViewOption)(WidgetView, undefined, 0) || WidgetView;
|
|
51
51
|
_createClass(WidgetView, [{
|
|
52
52
|
key: "onViewMount",
|
|
@@ -54,14 +54,14 @@ export var WidgetView = (_dec = transient(), _dec2 = view('libro-widget-view'),
|
|
|
54
54
|
var _this2 = this;
|
|
55
55
|
if (this.container && this.container.current && this.disableCommandMode) {
|
|
56
56
|
this.container.current.addEventListener('focusin', function () {
|
|
57
|
-
_this2.
|
|
57
|
+
_this2.libroContextKey.disableCommandMode();
|
|
58
58
|
});
|
|
59
59
|
this.container.current.addEventListener('blur', function (e) {
|
|
60
60
|
var _this2$container;
|
|
61
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.
|
|
62
|
+
_this2.libroContextKey.disableCommandMode();
|
|
63
63
|
} else {
|
|
64
|
-
_this2.
|
|
64
|
+
_this2.libroContextKey.enableCommandMode();
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
3
|
+
import { LibroWidgets } from '../base/libro-widgets.js';
|
|
2
4
|
import type { IWidgetViewProps } from '../base/protocal.js';
|
|
3
5
|
import { WidgetView } from '../base/widget-view.js';
|
|
4
6
|
import './index.less';
|
|
5
|
-
import { LibroWidgets } from '../base/libro-widgets.js';
|
|
6
|
-
import { LirboContextKey } from '@difizen/libro-core';
|
|
7
7
|
export declare const HBoxWidgetComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export declare class HBoxWidget extends WidgetView {
|
|
9
9
|
view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -11,7 +11,7 @@ export declare class HBoxWidget extends WidgetView {
|
|
|
11
11
|
layout: string;
|
|
12
12
|
box_style: string;
|
|
13
13
|
libroWidgets: LibroWidgets;
|
|
14
|
-
constructor(props: IWidgetViewProps,
|
|
14
|
+
constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey, libroWidgets: LibroWidgets);
|
|
15
15
|
get_child_model(): WidgetView[];
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=hbox-widget-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hbox-widget-view.d.ts","sourceRoot":"","sources":["../../src/widgets/hbox-widget-view.tsx"],"names":[],"mappings":";
|
|
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"}
|
|
@@ -12,12 +12,12 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
12
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
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
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';
|
|
15
16
|
import { view, ViewOption, ViewRender, transient, useInject, ViewInstance, inject } from '@difizen/mana-app';
|
|
16
17
|
import { forwardRef } from 'react';
|
|
18
|
+
import { LibroWidgets } from "../base/libro-widgets.js";
|
|
17
19
|
import { WidgetView } from "../base/widget-view.js";
|
|
18
20
|
import "./index.less";
|
|
19
|
-
import { LibroWidgets } from "../base/libro-widgets.js";
|
|
20
|
-
import { LirboContextKey } from '@difizen/libro-core';
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
export var HBoxWidgetComponent = /*#__PURE__*/forwardRef(function HBoxWidgetComponent() {
|
|
23
23
|
var widgetView = useInject(ViewInstance);
|
|
@@ -37,20 +37,20 @@ export var HBoxWidgetComponent = /*#__PURE__*/forwardRef(function HBoxWidgetComp
|
|
|
37
37
|
export var HBoxWidget = (_dec = transient(), _dec2 = view('libro-hbox-widget-view'), _dec(_class = _dec2(_class = /*#__PURE__*/function (_WidgetView) {
|
|
38
38
|
_inherits(HBoxWidget, _WidgetView);
|
|
39
39
|
var _super = _createSuper(HBoxWidget);
|
|
40
|
-
function HBoxWidget(props,
|
|
40
|
+
function HBoxWidget(props, libroContextKey, libroWidgets) {
|
|
41
41
|
var _this;
|
|
42
42
|
_classCallCheck(this, HBoxWidget);
|
|
43
|
-
_this = _super.call(this, props,
|
|
43
|
+
_this = _super.call(this, props, libroContextKey);
|
|
44
44
|
_this.view = HBoxWidgetComponent;
|
|
45
45
|
_this.box_style = props.attributes.bar_style;
|
|
46
46
|
_this.layout = props.attributes.layout;
|
|
47
47
|
_this.children = props.attributes.children;
|
|
48
|
-
_this.
|
|
48
|
+
_this.libroContextKey = libroContextKey;
|
|
49
49
|
_this.libroWidgets = libroWidgets;
|
|
50
50
|
return _this;
|
|
51
51
|
}
|
|
52
52
|
HBoxWidget = inject(LibroWidgets)(HBoxWidget, undefined, 2) || HBoxWidget;
|
|
53
|
-
HBoxWidget = inject(
|
|
53
|
+
HBoxWidget = inject(LibroContextKey)(HBoxWidget, undefined, 1) || HBoxWidget;
|
|
54
54
|
HBoxWidget = inject(ViewOption)(HBoxWidget, undefined, 0) || HBoxWidget;
|
|
55
55
|
_createClass(HBoxWidget, [{
|
|
56
56
|
key: "get_child_model",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
-
import {
|
|
2
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
3
3
|
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
4
4
|
import type { InstancesRecords, ProgressItem } from '../base/protocal.js';
|
|
5
5
|
import type { IWidgetViewProps } from '../base/protocal.js';
|
|
@@ -21,7 +21,7 @@ export declare class InstancesProgressWidget extends WidgetView {
|
|
|
21
21
|
instanceRecords: InstancesRecords;
|
|
22
22
|
modalVisible: boolean;
|
|
23
23
|
modalProgressItemKey: string;
|
|
24
|
-
constructor(props: IWidgetViewProps,
|
|
24
|
+
constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey);
|
|
25
25
|
updateRecords(progressKey: string): void;
|
|
26
26
|
/**
|
|
27
27
|
* Handle incoming comm msg.
|
|
@@ -21,7 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
21
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
22
|
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; }
|
|
23
23
|
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.'); }
|
|
24
|
-
import {
|
|
24
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
25
25
|
import { useInject, view, ViewInstance, ViewOption, transient, inject, prop } from '@difizen/mana-app';
|
|
26
26
|
import { forwardRef } from 'react';
|
|
27
27
|
import { WidgetView } from "../base/widget-view.js";
|
|
@@ -60,10 +60,10 @@ export var LibroInstancesProgressWidgetViewComponent = /*#__PURE__*/forwardRef(f
|
|
|
60
60
|
export var InstancesProgressWidget = (_dec = transient(), _dec2 = view('libro-widget-instances-progress-view'), _dec3 = prop(), _dec4 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_WidgetView) {
|
|
61
61
|
_inherits(InstancesProgressWidget, _WidgetView);
|
|
62
62
|
var _super = _createSuper(InstancesProgressWidget);
|
|
63
|
-
function InstancesProgressWidget(props,
|
|
63
|
+
function InstancesProgressWidget(props, libroContextKey) {
|
|
64
64
|
var _this;
|
|
65
65
|
_classCallCheck(this, InstancesProgressWidget);
|
|
66
|
-
_this = _super.call(this, props,
|
|
66
|
+
_this = _super.call(this, props, libroContextKey);
|
|
67
67
|
_this.view = LibroInstancesProgressWidgetViewComponent;
|
|
68
68
|
_initializerDefineProperty(_this, "prefix", _descriptor, _assertThisInitialized(_this));
|
|
69
69
|
_initializerDefineProperty(_this, "suffix", _descriptor2, _assertThisInitialized(_this));
|
|
@@ -77,7 +77,7 @@ export var InstancesProgressWidget = (_dec = transient(), _dec2 = view('libro-wi
|
|
|
77
77
|
_this.suffix = props.attributes.suffix;
|
|
78
78
|
return _this;
|
|
79
79
|
}
|
|
80
|
-
InstancesProgressWidget = inject(
|
|
80
|
+
InstancesProgressWidget = inject(LibroContextKey)(InstancesProgressWidget, undefined, 1) || InstancesProgressWidget;
|
|
81
81
|
InstancesProgressWidget = inject(ViewOption)(InstancesProgressWidget, undefined, 0) || InstancesProgressWidget;
|
|
82
82
|
_createClass(InstancesProgressWidget, [{
|
|
83
83
|
key: "updateRecords",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
-
import {
|
|
2
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
3
3
|
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
4
4
|
import type { IWidgetViewProps } from '../base/protocal.js';
|
|
5
5
|
import { WidgetView } from '../base/widget-view.js';
|
|
@@ -16,7 +16,7 @@ export declare class ProgressWidget extends WidgetView {
|
|
|
16
16
|
orientation: string;
|
|
17
17
|
style: string;
|
|
18
18
|
value: number;
|
|
19
|
-
constructor(props: IWidgetViewProps,
|
|
19
|
+
constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey);
|
|
20
20
|
/**
|
|
21
21
|
* Handle incoming comm msg.
|
|
22
22
|
*/
|
|
@@ -15,7 +15,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
15
15
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
16
|
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; }
|
|
17
17
|
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.'); }
|
|
18
|
-
import {
|
|
18
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
19
19
|
import { view, ViewOption, transient, useInject, ViewInstance, inject, prop } from '@difizen/mana-app';
|
|
20
20
|
import { forwardRef } from 'react';
|
|
21
21
|
import { WidgetView } from "../base/widget-view.js";
|
|
@@ -42,10 +42,10 @@ export var LibroProgressWidgetComponent = /*#__PURE__*/forwardRef(function Libro
|
|
|
42
42
|
export var ProgressWidget = (_dec = transient(), _dec2 = view('libro-widget-progress-view'), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_WidgetView) {
|
|
43
43
|
_inherits(ProgressWidget, _WidgetView);
|
|
44
44
|
var _super = _createSuper(ProgressWidget);
|
|
45
|
-
function ProgressWidget(props,
|
|
45
|
+
function ProgressWidget(props, libroContextKey) {
|
|
46
46
|
var _this;
|
|
47
47
|
_classCallCheck(this, ProgressWidget);
|
|
48
|
-
_this = _super.call(this, props,
|
|
48
|
+
_this = _super.call(this, props, libroContextKey);
|
|
49
49
|
_this.view = LibroProgressWidgetComponent;
|
|
50
50
|
_initializerDefineProperty(_this, "max", _descriptor, _assertThisInitialized(_this));
|
|
51
51
|
_initializerDefineProperty(_this, "min", _descriptor2, _assertThisInitialized(_this));
|
|
@@ -64,7 +64,7 @@ export var ProgressWidget = (_dec = transient(), _dec2 = view('libro-widget-prog
|
|
|
64
64
|
/**
|
|
65
65
|
* Handle incoming comm msg.
|
|
66
66
|
*/
|
|
67
|
-
ProgressWidget = inject(
|
|
67
|
+
ProgressWidget = inject(LibroContextKey)(ProgressWidget, undefined, 1) || ProgressWidget;
|
|
68
68
|
ProgressWidget = inject(ViewOption)(ProgressWidget, undefined, 0) || ProgressWidget;
|
|
69
69
|
_createClass(ProgressWidget, [{
|
|
70
70
|
key: "handleCommMsg",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
-
import {
|
|
2
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
3
3
|
import type { IWidgetViewProps } from '../base/protocal.js';
|
|
4
4
|
import { WidgetView } from '../base/widget-view.js';
|
|
5
5
|
import './index.less';
|
|
@@ -14,6 +14,6 @@ export declare class LibroTextWidget extends WidgetView {
|
|
|
14
14
|
style: string;
|
|
15
15
|
placeholder: string;
|
|
16
16
|
value: number;
|
|
17
|
-
constructor(props: IWidgetViewProps,
|
|
17
|
+
constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey);
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=text-widget-view.d.ts.map
|
|
@@ -15,7 +15,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
15
15
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
16
|
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; }
|
|
17
17
|
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.'); }
|
|
18
|
-
import {
|
|
18
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
19
19
|
import { view, ViewOption, transient, useInject, ViewInstance, inject, prop } from '@difizen/mana-app';
|
|
20
20
|
import { Input } from 'antd';
|
|
21
21
|
import { forwardRef } from 'react';
|
|
@@ -64,10 +64,10 @@ export var LibroTextWidgetComponent = /*#__PURE__*/forwardRef(function LibroText
|
|
|
64
64
|
export var LibroTextWidget = (_dec = transient(), _dec2 = view('libro-widget-text-view'), _dec3 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_WidgetView) {
|
|
65
65
|
_inherits(LibroTextWidget, _WidgetView);
|
|
66
66
|
var _super = _createSuper(LibroTextWidget);
|
|
67
|
-
function LibroTextWidget(props,
|
|
67
|
+
function LibroTextWidget(props, libroContextKey) {
|
|
68
68
|
var _this;
|
|
69
69
|
_classCallCheck(this, LibroTextWidget);
|
|
70
|
-
_this = _super.call(this, props,
|
|
70
|
+
_this = _super.call(this, props, libroContextKey);
|
|
71
71
|
_this.view = LibroTextWidgetComponent;
|
|
72
72
|
_initializerDefineProperty(_this, "value", _descriptor, _assertThisInitialized(_this));
|
|
73
73
|
_this.bar_style = props.attributes.bar_style;
|
|
@@ -80,7 +80,7 @@ export var LibroTextWidget = (_dec = transient(), _dec2 = view('libro-widget-tex
|
|
|
80
80
|
_this.placeholder = props.attributes.placeholder;
|
|
81
81
|
return _this;
|
|
82
82
|
}
|
|
83
|
-
LibroTextWidget = inject(
|
|
83
|
+
LibroTextWidget = inject(LibroContextKey)(LibroTextWidget, undefined, 1) || LibroTextWidget;
|
|
84
84
|
LibroTextWidget = inject(ViewOption)(LibroTextWidget, undefined, 0) || LibroTextWidget;
|
|
85
85
|
return _createClass(LibroTextWidget);
|
|
86
86
|
}(WidgetView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "value", [_dec3], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-widget",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro"
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"src"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@difizen/libro-core": "^0.1.
|
|
35
|
-
"@difizen/libro-common": "^0.1.
|
|
36
|
-
"@difizen/libro-kernel": "^0.1.
|
|
37
|
-
"@difizen/libro-rendermime": "^0.1.
|
|
34
|
+
"@difizen/libro-core": "^0.1.31",
|
|
35
|
+
"@difizen/libro-common": "^0.1.31",
|
|
36
|
+
"@difizen/libro-kernel": "^0.1.31",
|
|
37
|
+
"@difizen/libro-rendermime": "^0.1.31",
|
|
38
38
|
"@difizen/mana-app": "latest"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
package/src/base/widget-view.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JSONValue } from '@difizen/libro-common';
|
|
2
|
-
import {
|
|
2
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
3
3
|
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
4
4
|
import { inject, transient, ViewOption, view, BaseView } from '@difizen/mana-app';
|
|
5
5
|
import type { ViewComponent } from '@difizen/mana-app';
|
|
@@ -26,27 +26,27 @@ export const LibroWidgetComponent = forwardRef<HTMLDivElement>(
|
|
|
26
26
|
@view('libro-widget-view')
|
|
27
27
|
export class WidgetView extends BaseView implements IWidgetView {
|
|
28
28
|
override view: ViewComponent = LibroWidgetComponent;
|
|
29
|
-
|
|
29
|
+
libroContextKey: LibroContextKey;
|
|
30
30
|
disableCommandMode = true;
|
|
31
31
|
constructor(
|
|
32
32
|
@inject(ViewOption) props: IWidgetViewProps,
|
|
33
|
-
@inject(
|
|
33
|
+
@inject(LibroContextKey) libroContextKey: LibroContextKey,
|
|
34
34
|
) {
|
|
35
35
|
super();
|
|
36
36
|
this.initialize(props);
|
|
37
|
-
this.
|
|
37
|
+
this.libroContextKey = libroContextKey;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
override onViewMount() {
|
|
41
41
|
if (this.container && this.container.current && this.disableCommandMode) {
|
|
42
42
|
this.container.current.addEventListener('focusin', () => {
|
|
43
|
-
this.
|
|
43
|
+
this.libroContextKey.disableCommandMode();
|
|
44
44
|
});
|
|
45
45
|
this.container.current.addEventListener('blur', (e) => {
|
|
46
46
|
if (this.container?.current?.contains(e.relatedTarget as Node)) {
|
|
47
|
-
this.
|
|
47
|
+
this.libroContextKey.disableCommandMode();
|
|
48
48
|
} else {
|
|
49
|
-
this.
|
|
49
|
+
this.libroContextKey.enableCommandMode();
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
1
2
|
import {
|
|
2
3
|
view,
|
|
3
4
|
ViewOption,
|
|
@@ -9,11 +10,10 @@ import {
|
|
|
9
10
|
} from '@difizen/mana-app';
|
|
10
11
|
import { forwardRef } from 'react';
|
|
11
12
|
|
|
13
|
+
import { LibroWidgets } from '../base/libro-widgets.js';
|
|
12
14
|
import type { IWidgetViewProps } from '../base/protocal.js';
|
|
13
15
|
import { WidgetView } from '../base/widget-view.js';
|
|
14
16
|
import './index.less';
|
|
15
|
-
import { LibroWidgets } from '../base/libro-widgets.js';
|
|
16
|
-
import { LirboContextKey } from '@difizen/libro-core';
|
|
17
17
|
|
|
18
18
|
export const HBoxWidgetComponent = forwardRef<HTMLDivElement>(
|
|
19
19
|
function HBoxWidgetComponent() {
|
|
@@ -41,14 +41,14 @@ export class HBoxWidget extends WidgetView {
|
|
|
41
41
|
override libroWidgets: LibroWidgets;
|
|
42
42
|
constructor(
|
|
43
43
|
@inject(ViewOption) props: IWidgetViewProps,
|
|
44
|
-
@inject(
|
|
44
|
+
@inject(LibroContextKey) libroContextKey: LibroContextKey,
|
|
45
45
|
@inject(LibroWidgets) libroWidgets: LibroWidgets,
|
|
46
46
|
) {
|
|
47
|
-
super(props,
|
|
47
|
+
super(props, libroContextKey);
|
|
48
48
|
this.box_style = props.attributes.bar_style;
|
|
49
49
|
this.layout = props.attributes.layout;
|
|
50
50
|
this.children = props.attributes.children;
|
|
51
|
-
this.
|
|
51
|
+
this.libroContextKey = libroContextKey;
|
|
52
52
|
this.libroWidgets = libroWidgets;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
2
2
|
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
3
3
|
import {
|
|
4
4
|
useInject,
|
|
@@ -70,9 +70,9 @@ export class InstancesProgressWidget extends WidgetView {
|
|
|
70
70
|
modalProgressItemKey = '';
|
|
71
71
|
constructor(
|
|
72
72
|
@inject(ViewOption) props: IWidgetViewProps,
|
|
73
|
-
@inject(
|
|
73
|
+
@inject(LibroContextKey) libroContextKey: LibroContextKey,
|
|
74
74
|
) {
|
|
75
|
-
super(props,
|
|
75
|
+
super(props, libroContextKey);
|
|
76
76
|
this.prefix = props.attributes.prefix;
|
|
77
77
|
this.suffix = props.attributes.suffix;
|
|
78
78
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
2
2
|
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
3
3
|
import {
|
|
4
4
|
view,
|
|
@@ -51,9 +51,9 @@ export class ProgressWidget extends WidgetView {
|
|
|
51
51
|
value: number;
|
|
52
52
|
constructor(
|
|
53
53
|
@inject(ViewOption) props: IWidgetViewProps,
|
|
54
|
-
@inject(
|
|
54
|
+
@inject(LibroContextKey) libroContextKey: LibroContextKey,
|
|
55
55
|
) {
|
|
56
|
-
super(props,
|
|
56
|
+
super(props, libroContextKey);
|
|
57
57
|
this.bar_style = props.attributes.bar_style;
|
|
58
58
|
this.description = props.attributes.description;
|
|
59
59
|
this.description_tooltip = props.attributes.description_tooltip;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LibroContextKey } from '@difizen/libro-core';
|
|
2
2
|
import {
|
|
3
3
|
view,
|
|
4
4
|
ViewOption,
|
|
@@ -68,9 +68,9 @@ export class LibroTextWidget extends WidgetView {
|
|
|
68
68
|
value: number;
|
|
69
69
|
constructor(
|
|
70
70
|
@inject(ViewOption) props: IWidgetViewProps,
|
|
71
|
-
@inject(
|
|
71
|
+
@inject(LibroContextKey) libroContextKey: LibroContextKey,
|
|
72
72
|
) {
|
|
73
|
-
super(props,
|
|
73
|
+
super(props, libroContextKey);
|
|
74
74
|
this.bar_style = props.attributes.bar_style;
|
|
75
75
|
this.description = props.attributes.description;
|
|
76
76
|
this.description_tooltip = props.attributes.description_tooltip;
|