@difizen/libro-output 1.0.2 → 1.0.4
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/display-data-output/display-data-output-model.d.ts.map +1 -1
- package/es/display-data-output/display-data-output-model.js +1 -1
- package/es/error-output/error-output-model.d.ts.map +1 -1
- package/es/error-output/error-output-model.js +1 -2
- package/es/index.less +6 -6
- package/es/stream-output/stream-output-model.d.ts.map +1 -1
- package/es/stream-output/stream-output-model.js +20 -5
- package/package.json +4 -4
- package/src/display-data-output/display-data-output-model.tsx +1 -1
- package/src/error-output/error-output-model.tsx +1 -3
- package/src/index.less +6 -6
- package/src/stream-output/stream-output-model.tsx +15 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display-data-output-model.d.ts","sourceRoot":"","sources":["../../src/display-data-output/display-data-output-model.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"display-data-output-model.d.ts","sourceRoot":"","sources":["../../src/display-data-output/display-data-output-model.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAWvF,OAAO,eAAe,CAAC;AAmBvB,qBAEa,sBAAuB,SAAQ,eAAgB,YAAW,cAAc;IACvD,kBAAkB,EAAE,mBAAmB,CAAC;IACpE,aAAa,CAAC,EAAE,gBAAgB,CAAC;gBACD,OAAO,EAAE,cAAc;IAQvD,gBAAgB;IAUP,IAAI,2FAAgC;IACpC,MAAM;;;;;;;;;;;;;IAgBN,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;CAMxC"}
|
|
@@ -17,12 +17,12 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
17
17
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
18
18
|
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; }
|
|
19
19
|
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.'); }
|
|
20
|
+
import { getBundleOptions } from '@difizen/libro-common';
|
|
20
21
|
import { LibroOutputView } from '@difizen/libro-core';
|
|
21
22
|
import { RenderMimeRegistry } from '@difizen/libro-rendermime';
|
|
22
23
|
import { getOrigin, useInject, view, ViewInstance, ViewOption } from '@difizen/libro-common/app';
|
|
23
24
|
import { inject, transient } from '@difizen/libro-common/app';
|
|
24
25
|
import { forwardRef } from 'react';
|
|
25
|
-
import { getBundleOptions } from "../output-utils.js";
|
|
26
26
|
import "../index.less";
|
|
27
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
28
|
var DisplayDataOutputModelRender = /*#__PURE__*/forwardRef(function DisplayDataOutputModelRender(_props, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-output-model.d.ts","sourceRoot":"","sources":["../../src/error-output/error-output-model.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAc1E,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"error-output-model.d.ts","sourceRoot":"","sources":["../../src/error-output/error-output-model.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAc1E,OAAO,eAAe,CAAC;AAqDvB,qBAEa,gBAAiB,SAAQ,eAAgB,YAAW,cAAc;gBAC7C,OAAO,EAAE,cAAc;IAO9C,IAAI,2FAA0B;IAC9B,MAAM;;;;;;IASf,eAAe,UAAS;CACzB"}
|
|
@@ -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 { defaultSanitizer } from '@difizen/libro-common';
|
|
18
|
+
import { defaultSanitizer, getBundleOptions } from '@difizen/libro-common';
|
|
19
19
|
import { LibroOutputView } from '@difizen/libro-core';
|
|
20
20
|
import { RenderMimeRegistry, renderText } from '@difizen/libro-rendermime';
|
|
21
21
|
import { inject, transient } from '@difizen/libro-common/app';
|
|
@@ -23,7 +23,6 @@ import { getOrigin, prop, useInject, view, ViewInstance, ViewOption } from '@dif
|
|
|
23
23
|
import { Button } from 'antd';
|
|
24
24
|
import { forwardRef, createRef, useEffect } from 'react';
|
|
25
25
|
import "../index.less";
|
|
26
|
-
import { getBundleOptions } from "../output-utils.js";
|
|
27
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
28
|
var ErrorOutputModelRender = /*#__PURE__*/forwardRef(function ErrorOutputModelRender(_props, ref) {
|
package/es/index.less
CHANGED
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
* Code font variables are used for typography of code and other monospaces content.
|
|
160
160
|
*/
|
|
161
161
|
|
|
162
|
-
--jp-code-font-size:
|
|
162
|
+
--jp-code-font-size: 13px;
|
|
163
163
|
--jp-code-line-height: 1.3077; /* 17px for 13px base */
|
|
164
164
|
--jp-code-padding: 5px; /* 5px for 13px base, codemirror highlighting needs integer px value */
|
|
165
165
|
--jp-code-font-family-default: menlo-regular, consolas, 'DejaVu Sans Mono', monospace;
|
|
@@ -444,7 +444,7 @@
|
|
|
444
444
|
|---------------------------------------------------------------------------- */
|
|
445
445
|
|
|
446
446
|
.libro-html-common-render {
|
|
447
|
-
color: var(--
|
|
447
|
+
color: var(--mana-libro-text-default-color);
|
|
448
448
|
font-family: var(--jp-content-font-family);
|
|
449
449
|
font-size: var(--jp-content-font-size1);
|
|
450
450
|
line-height: var(--jp-content-line-height);
|
|
@@ -589,7 +589,7 @@
|
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
.libro-html-common-render hr {
|
|
592
|
-
color: var(--
|
|
592
|
+
color: var(--mana-libro-text-default-color);
|
|
593
593
|
background-color: var(--jp-border-color1);
|
|
594
594
|
margin-top: 1em;
|
|
595
595
|
margin-bottom: 1em;
|
|
@@ -622,7 +622,7 @@
|
|
|
622
622
|
border-collapse: collapse;
|
|
623
623
|
border-spacing: 0;
|
|
624
624
|
border: none;
|
|
625
|
-
color: var(--
|
|
625
|
+
color: var(--mana-libro-text-default-color);
|
|
626
626
|
font-size: var(--jp-ui-font-size1);
|
|
627
627
|
table-layout: fixed;
|
|
628
628
|
// margin-left: auto;
|
|
@@ -666,11 +666,11 @@
|
|
|
666
666
|
}
|
|
667
667
|
|
|
668
668
|
.libro-html-common-render tbody tr:nth-child(even) {
|
|
669
|
-
background: var(--
|
|
669
|
+
background: var(--mana-libro-menu-hover-color);
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
.libro-html-common-render tbody tr:hover {
|
|
673
|
-
background: var(--
|
|
673
|
+
background: var(--mana-libro-menu-hover-color);
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
.libro-html-common-render p {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-output-model.d.ts","sourceRoot":"","sources":["../../src/stream-output/stream-output-model.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"stream-output-model.d.ts","sourceRoot":"","sources":["../../src/stream-output/stream-output-model.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGvF,OAAO,eAAe,CAAC;AA2BvB,qBAEa,iBAAkB,SAAQ,eAAgB,YAAW,cAAc;IAClD,kBAAkB,EAAE,mBAAmB,CAAC;IACpE,aAAa,CAAC,EAAE,gBAAgB,CAAC;gBAED,OAAO,EAAE,cAAc;IAQvD,gBAAgB;IASP,IAAI,2FAA2B;IAC/B,MAAM;;;;;;;;;CAOhB"}
|
|
@@ -15,23 +15,38 @@ 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
|
-
|
|
19
|
-
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
22
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
+
import { getBundleOptions } from '@difizen/libro-common';
|
|
20
25
|
import { inject, transient } from '@difizen/libro-common/app';
|
|
21
26
|
import { getOrigin, useInject, view, ViewInstance, ViewOption } from '@difizen/libro-common/app';
|
|
22
|
-
import {
|
|
27
|
+
import { LibroOutputView } from '@difizen/libro-core';
|
|
28
|
+
import { RenderMimeRegistry } from '@difizen/libro-rendermime';
|
|
29
|
+
import { forwardRef, useEffect, useState } from 'react';
|
|
23
30
|
import "../index.less";
|
|
24
|
-
import { getBundleOptions } from "../output-utils.js";
|
|
25
31
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
32
|
var StreamOutputModelRender = /*#__PURE__*/forwardRef(function StreamOutputModelRender(_props, ref) {
|
|
27
33
|
var output = useInject(ViewInstance);
|
|
28
34
|
var model = getOrigin(output);
|
|
35
|
+
var _useState = useState(new Date().getTime().toString()),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
refreshKey = _useState2[0],
|
|
38
|
+
setRefreshKey = _useState2[1];
|
|
29
39
|
var factory = model.getRenderFactory();
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
model.onUpdate(function () {
|
|
42
|
+
setRefreshKey(new Date().getTime().toString());
|
|
43
|
+
});
|
|
44
|
+
});
|
|
30
45
|
if (factory) {
|
|
31
46
|
var OutputRender = factory.render;
|
|
32
47
|
var children = /*#__PURE__*/_jsx(OutputRender, {
|
|
33
48
|
model: model
|
|
34
|
-
});
|
|
49
|
+
}, refreshKey);
|
|
35
50
|
return /*#__PURE__*/_jsx("div", {
|
|
36
51
|
ref: ref,
|
|
37
52
|
className: 'libro-stream-container',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-output",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-common": "^1.0.
|
|
36
|
-
"@difizen/libro-core": "^1.0.
|
|
37
|
-
"@difizen/libro-rendermime": "^1.0.
|
|
35
|
+
"@difizen/libro-common": "^1.0.4",
|
|
36
|
+
"@difizen/libro-core": "^1.0.4",
|
|
37
|
+
"@difizen/libro-rendermime": "^1.0.4",
|
|
38
38
|
"markdown-it": "^13.0.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { JSONObject } from '@difizen/libro-common';
|
|
2
|
+
import { getBundleOptions } from '@difizen/libro-common';
|
|
2
3
|
import { LibroOutputView } from '@difizen/libro-core';
|
|
3
4
|
import type { BaseOutputView, IOutputOptions } from '@difizen/libro-core';
|
|
4
5
|
import { RenderMimeRegistry } from '@difizen/libro-rendermime';
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
import { inject, transient } from '@difizen/libro-common/app';
|
|
14
15
|
import { forwardRef } from 'react';
|
|
15
16
|
|
|
16
|
-
import { getBundleOptions } from '../output-utils.js';
|
|
17
17
|
import '../index.less';
|
|
18
18
|
|
|
19
19
|
const DisplayDataOutputModelRender = forwardRef<HTMLDivElement>(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultSanitizer } from '@difizen/libro-common';
|
|
1
|
+
import { defaultSanitizer, getBundleOptions } from '@difizen/libro-common';
|
|
2
2
|
import type { IError, JSONObject } from '@difizen/libro-common';
|
|
3
3
|
import { LibroOutputView } from '@difizen/libro-core';
|
|
4
4
|
import type { BaseOutputView, IOutputOptions } from '@difizen/libro-core';
|
|
@@ -17,8 +17,6 @@ import { Button } from 'antd';
|
|
|
17
17
|
import { forwardRef, createRef, useEffect } from 'react';
|
|
18
18
|
import '../index.less';
|
|
19
19
|
|
|
20
|
-
import { getBundleOptions } from '../output-utils.js';
|
|
21
|
-
|
|
22
20
|
const ErrorOutputModelRender = forwardRef<HTMLDivElement>(
|
|
23
21
|
function ErrorOutputModelRender(_props, ref) {
|
|
24
22
|
const output = useInject<ErrorOutputModel>(ViewInstance);
|
package/src/index.less
CHANGED
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
* Code font variables are used for typography of code and other monospaces content.
|
|
160
160
|
*/
|
|
161
161
|
|
|
162
|
-
--jp-code-font-size:
|
|
162
|
+
--jp-code-font-size: 13px;
|
|
163
163
|
--jp-code-line-height: 1.3077; /* 17px for 13px base */
|
|
164
164
|
--jp-code-padding: 5px; /* 5px for 13px base, codemirror highlighting needs integer px value */
|
|
165
165
|
--jp-code-font-family-default: menlo-regular, consolas, 'DejaVu Sans Mono', monospace;
|
|
@@ -444,7 +444,7 @@
|
|
|
444
444
|
|---------------------------------------------------------------------------- */
|
|
445
445
|
|
|
446
446
|
.libro-html-common-render {
|
|
447
|
-
color: var(--
|
|
447
|
+
color: var(--mana-libro-text-default-color);
|
|
448
448
|
font-family: var(--jp-content-font-family);
|
|
449
449
|
font-size: var(--jp-content-font-size1);
|
|
450
450
|
line-height: var(--jp-content-line-height);
|
|
@@ -589,7 +589,7 @@
|
|
|
589
589
|
}
|
|
590
590
|
|
|
591
591
|
.libro-html-common-render hr {
|
|
592
|
-
color: var(--
|
|
592
|
+
color: var(--mana-libro-text-default-color);
|
|
593
593
|
background-color: var(--jp-border-color1);
|
|
594
594
|
margin-top: 1em;
|
|
595
595
|
margin-bottom: 1em;
|
|
@@ -622,7 +622,7 @@
|
|
|
622
622
|
border-collapse: collapse;
|
|
623
623
|
border-spacing: 0;
|
|
624
624
|
border: none;
|
|
625
|
-
color: var(--
|
|
625
|
+
color: var(--mana-libro-text-default-color);
|
|
626
626
|
font-size: var(--jp-ui-font-size1);
|
|
627
627
|
table-layout: fixed;
|
|
628
628
|
// margin-left: auto;
|
|
@@ -666,11 +666,11 @@
|
|
|
666
666
|
}
|
|
667
667
|
|
|
668
668
|
.libro-html-common-render tbody tr:nth-child(even) {
|
|
669
|
-
background: var(--
|
|
669
|
+
background: var(--mana-libro-menu-hover-color);
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
.libro-html-common-render tbody tr:hover {
|
|
673
|
-
background: var(--
|
|
673
|
+
background: var(--mana-libro-menu-hover-color);
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
.libro-html-common-render p {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { JSONObject } from '@difizen/libro-common';
|
|
2
|
-
import {
|
|
3
|
-
import type { BaseOutputView, IOutputOptions } from '@difizen/libro-core';
|
|
4
|
-
import { RenderMimeRegistry } from '@difizen/libro-rendermime';
|
|
5
|
-
import type { IRenderMimeRegistry, IRendererFactory } from '@difizen/libro-rendermime';
|
|
2
|
+
import { getBundleOptions } from '@difizen/libro-common';
|
|
6
3
|
import { inject, transient } from '@difizen/libro-common/app';
|
|
7
4
|
import {
|
|
8
5
|
getOrigin,
|
|
@@ -11,20 +8,29 @@ import {
|
|
|
11
8
|
ViewInstance,
|
|
12
9
|
ViewOption,
|
|
13
10
|
} from '@difizen/libro-common/app';
|
|
14
|
-
import {
|
|
11
|
+
import { LibroOutputView } from '@difizen/libro-core';
|
|
12
|
+
import type { BaseOutputView, IOutputOptions } from '@difizen/libro-core';
|
|
13
|
+
import { RenderMimeRegistry } from '@difizen/libro-rendermime';
|
|
14
|
+
import type { IRenderMimeRegistry, IRendererFactory } from '@difizen/libro-rendermime';
|
|
15
|
+
import { forwardRef, useEffect, useState } from 'react';
|
|
15
16
|
|
|
16
17
|
import '../index.less';
|
|
17
18
|
|
|
18
|
-
import { getBundleOptions } from '../output-utils.js';
|
|
19
|
-
|
|
20
19
|
const StreamOutputModelRender = forwardRef<HTMLDivElement>(
|
|
21
20
|
function StreamOutputModelRender(_props, ref) {
|
|
22
21
|
const output = useInject<StreamOutputModel>(ViewInstance);
|
|
23
22
|
const model = getOrigin(output);
|
|
23
|
+
const [refreshKey, setRefreshKey] = useState(new Date().getTime().toString());
|
|
24
24
|
const factory = model.getRenderFactory();
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
model.onUpdate(() => {
|
|
28
|
+
setRefreshKey(new Date().getTime().toString());
|
|
29
|
+
});
|
|
30
|
+
});
|
|
25
31
|
if (factory) {
|
|
26
32
|
const OutputRender = factory.render;
|
|
27
|
-
const children = <OutputRender model={model} />;
|
|
33
|
+
const children = <OutputRender model={model} key={refreshKey} />;
|
|
28
34
|
return (
|
|
29
35
|
<div ref={ref} className={'libro-stream-container'}>
|
|
30
36
|
{children}
|
|
@@ -48,6 +54,7 @@ export class StreamOutputModel extends LibroOutputView implements BaseOutputView
|
|
|
48
54
|
this.data = data as JSONObject;
|
|
49
55
|
this.metadata = metadata;
|
|
50
56
|
}
|
|
57
|
+
|
|
51
58
|
getRenderFactory() {
|
|
52
59
|
const renderMimeType = this.renderMimeRegistry.preferredMimeType(this);
|
|
53
60
|
if (renderMimeType) {
|