@difizen/libro-lab 1.0.2 → 1.0.3
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/libro-lab-view.d.ts +11 -0
- package/es/libro-lab-view.d.ts.map +1 -0
- package/es/libro-lab-view.js +64 -0
- package/es/module.d.ts.map +1 -1
- package/es/module.js +2 -1
- package/package.json +14 -14
- package/src/libro-lab-view.tsx +48 -0
- package/src/module.tsx +2 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NotebookOption } from '@difizen/libro-core';
|
|
2
|
+
import { VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
3
|
+
import { CollapseServiceFactory, NotebookService } from '@difizen/libro-core';
|
|
4
|
+
import { LibroJupyterView } from '@difizen/libro-jupyter';
|
|
5
|
+
import { OpenerService } from '@difizen/mana-app';
|
|
6
|
+
export declare class LibroLabView extends LibroJupyterView {
|
|
7
|
+
protected openService: OpenerService;
|
|
8
|
+
constructor(options: NotebookOption, collapseServiceFactory: CollapseServiceFactory, notebookService: NotebookService, virtualizedManagerHelper: VirtualizedManagerHelper);
|
|
9
|
+
onViewMount: () => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=libro-lab-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libro-lab-view.d.ts","sourceRoot":"","sources":["../src/libro-lab-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAyB,MAAM,mBAAmB,CAAC;AAGzE,qBAEa,YAAa,SAAQ,gBAAgB;IACzB,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC;gBAGtC,OAAO,EAAE,cAAc,EACX,sBAAsB,EAAE,sBAAsB,EACrD,eAAe,EAAE,eAAe,EAEzD,wBAAwB,EAAE,wBAAwB;IAQ3C,WAAW,aAmBlB;CACH"}
|
|
@@ -0,0 +1,64 @@
|
|
|
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, _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 _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 _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); }
|
|
10
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11
|
+
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); }; }
|
|
12
|
+
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); }
|
|
13
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
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
|
+
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
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
19
|
+
|
|
20
|
+
import { VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
21
|
+
import { CollapseServiceFactory, NotebookService } from '@difizen/libro-core';
|
|
22
|
+
import { notebookViewFactoryId } from '@difizen/libro-core';
|
|
23
|
+
import { LibroJupyterView } from '@difizen/libro-jupyter';
|
|
24
|
+
import { OpenerService, URI, view, ViewOption } from '@difizen/mana-app';
|
|
25
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
26
|
+
export var LibroLabView = (_dec = transient(), _dec2 = view(notebookViewFactoryId), _dec3 = inject(OpenerService), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_LibroJupyterView) {
|
|
27
|
+
_inherits(LibroLabView, _LibroJupyterView);
|
|
28
|
+
var _super = _createSuper(LibroLabView);
|
|
29
|
+
function LibroLabView(options, collapseServiceFactory, notebookService, virtualizedManagerHelper) {
|
|
30
|
+
var _this;
|
|
31
|
+
_classCallCheck(this, LibroLabView);
|
|
32
|
+
_this = _super.call(this, options, collapseServiceFactory, notebookService, virtualizedManagerHelper);
|
|
33
|
+
_initializerDefineProperty(_this, "openService", _descriptor, _assertThisInitialized(_this));
|
|
34
|
+
_this.onViewMount = function () {
|
|
35
|
+
_this.libroService.active = _assertThisInitialized(_this);
|
|
36
|
+
_this.libroSlotManager.setup(_assertThisInitialized(_this));
|
|
37
|
+
if (_this.libroViewTracker.isEnabledSpmReporter) {
|
|
38
|
+
_this.libroViewTracker.getOrCreateTrackers({
|
|
39
|
+
id: _this.options.modelId || _this.options.id
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (_this.model.isInitialized && (_this.model.cells.length > 30 || (_this.model.options['fileSize'] || 0) / (1024 * 1024) >= 5)) {
|
|
43
|
+
_this.addLargeFileWarning();
|
|
44
|
+
}
|
|
45
|
+
_this.onOutputRenderTab(function (e) {
|
|
46
|
+
// console.log('🚀 ~ LibroLabView ~ this.onOutputRenderTab ~ e:', e);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var uri = new URI(options['resource']);
|
|
50
|
+
_this.uri = uri;
|
|
51
|
+
_this.title.label = uri.displayName;
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
LibroLabView = inject(VirtualizedManagerHelper)(LibroLabView, undefined, 3) || LibroLabView;
|
|
55
|
+
LibroLabView = inject(NotebookService)(LibroLabView, undefined, 2) || LibroLabView;
|
|
56
|
+
LibroLabView = inject(CollapseServiceFactory)(LibroLabView, undefined, 1) || LibroLabView;
|
|
57
|
+
LibroLabView = inject(ViewOption)(LibroLabView, undefined, 0) || LibroLabView;
|
|
58
|
+
return _createClass(LibroLabView);
|
|
59
|
+
}(LibroJupyterView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "openService", [_dec3], {
|
|
60
|
+
configurable: true,
|
|
61
|
+
enumerable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
initializer: null
|
|
64
|
+
})), _class2)) || _class) || _class);
|
package/es/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EAKX,MAAM,2BAA2B,CAAC;AA4BnC,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EAKX,MAAM,2BAA2B,CAAC;AA4BnC,OAAO,cAAc,CAAC;AAOtB,eAAO,MAAM,cAAc,YAkGxB,CAAC"}
|
package/es/module.js
CHANGED
|
@@ -25,13 +25,14 @@ import { LibroLabLayoutModule, LibroLabLayoutSlots, LibroLabLayoutView } from ".
|
|
|
25
25
|
import { SaveableTabView } from "./layout/saveable-tab-view.js";
|
|
26
26
|
import "./index.less";
|
|
27
27
|
import { LibroLabSideTabView } from "./layout/side-tab-view.js";
|
|
28
|
+
import { LibroLabView } from "./libro-lab-view.js";
|
|
28
29
|
import { LibroLabTocModule } from "./toc/module.js";
|
|
29
30
|
import { EntryPointView } from "./welcome/entry-point-view.js";
|
|
30
31
|
import { WelcomeView } from "./welcome/index.js";
|
|
31
32
|
export var LibroLabModule = ManaModule.create().preload(function () {
|
|
32
33
|
l10n.loadLangBundles(langBundles);
|
|
33
34
|
return Promise.resolve();
|
|
34
|
-
}).register(LibroLabApp, LibroLabLayoutView, GithubLinkView, LabConfigAppContribution, LibroLabSideTabView, LabColorContribution, LangSwitcherView, createViewPreference({
|
|
35
|
+
}).register(LibroLabApp, LibroLabLayoutView, GithubLinkView, LibroLabView, LabConfigAppContribution, LibroLabSideTabView, LabColorContribution, LangSwitcherView, createViewPreference({
|
|
35
36
|
view: GithubLinkView,
|
|
36
37
|
slot: HeaderArea.right,
|
|
37
38
|
openOptions: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-lab",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@ant-design/icons": "^5.1.0",
|
|
37
|
-
"@difizen/libro-core": "^1.0.
|
|
38
|
-
"@difizen/libro-jupyter": "^1.0.
|
|
39
|
-
"@difizen/libro-kernel": "^1.0.
|
|
40
|
-
"@difizen/libro-prompt-cell": "^1.0.
|
|
41
|
-
"@difizen/libro-sql-cell": "^1.0.
|
|
42
|
-
"@difizen/libro-terminal": "^1.0.
|
|
43
|
-
"@difizen/libro-toc": "^1.0.
|
|
44
|
-
"@difizen/libro-app": "^1.0.
|
|
45
|
-
"@difizen/libro-cofine-editor-core": "^1.0.
|
|
46
|
-
"@difizen/libro-language-client": "^1.0.
|
|
47
|
-
"@difizen/libro-widget": "^1.0.
|
|
48
|
-
"@difizen/libro-l10n": "^1.0.
|
|
49
|
-
"@difizen/libro-common": "^1.0.
|
|
37
|
+
"@difizen/libro-core": "^1.0.3",
|
|
38
|
+
"@difizen/libro-jupyter": "^1.0.3",
|
|
39
|
+
"@difizen/libro-kernel": "^1.0.3",
|
|
40
|
+
"@difizen/libro-prompt-cell": "^1.0.3",
|
|
41
|
+
"@difizen/libro-sql-cell": "^1.0.3",
|
|
42
|
+
"@difizen/libro-terminal": "^1.0.3",
|
|
43
|
+
"@difizen/libro-toc": "^1.0.3",
|
|
44
|
+
"@difizen/libro-app": "^1.0.3",
|
|
45
|
+
"@difizen/libro-cofine-editor-core": "^1.0.3",
|
|
46
|
+
"@difizen/libro-language-client": "^1.0.3",
|
|
47
|
+
"@difizen/libro-widget": "^1.0.3",
|
|
48
|
+
"@difizen/libro-l10n": "^1.0.3",
|
|
49
|
+
"@difizen/libro-common": "^1.0.3",
|
|
50
50
|
"classnames": "^2.3.2",
|
|
51
51
|
"uuid": "^9.0.0",
|
|
52
52
|
"viewerjs": "^1.11.6"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import type { NotebookOption } from '@difizen/libro-core';
|
|
3
|
+
import { VirtualizedManagerHelper } from '@difizen/libro-core';
|
|
4
|
+
import { CollapseServiceFactory, NotebookService } from '@difizen/libro-core';
|
|
5
|
+
import { notebookViewFactoryId } from '@difizen/libro-core';
|
|
6
|
+
import { LibroJupyterView } from '@difizen/libro-jupyter';
|
|
7
|
+
import { OpenerService, URI, view, ViewOption } from '@difizen/mana-app';
|
|
8
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
9
|
+
|
|
10
|
+
@transient()
|
|
11
|
+
@view(notebookViewFactoryId)
|
|
12
|
+
export class LibroLabView extends LibroJupyterView {
|
|
13
|
+
@inject(OpenerService) protected openService: OpenerService;
|
|
14
|
+
|
|
15
|
+
constructor(
|
|
16
|
+
@inject(ViewOption) options: NotebookOption,
|
|
17
|
+
@inject(CollapseServiceFactory) collapseServiceFactory: CollapseServiceFactory,
|
|
18
|
+
@inject(NotebookService) notebookService: NotebookService,
|
|
19
|
+
@inject(VirtualizedManagerHelper)
|
|
20
|
+
virtualizedManagerHelper: VirtualizedManagerHelper,
|
|
21
|
+
) {
|
|
22
|
+
super(options, collapseServiceFactory, notebookService, virtualizedManagerHelper);
|
|
23
|
+
const uri = new URI(options['resource']);
|
|
24
|
+
this.uri = uri;
|
|
25
|
+
this.title.label = uri.displayName;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
override onViewMount = () => {
|
|
29
|
+
this.libroService.active = this;
|
|
30
|
+
this.libroSlotManager.setup(this);
|
|
31
|
+
|
|
32
|
+
if (this.libroViewTracker.isEnabledSpmReporter) {
|
|
33
|
+
this.libroViewTracker.getOrCreateTrackers({
|
|
34
|
+
id: this.options.modelId || this.options.id,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (
|
|
38
|
+
this.model.isInitialized &&
|
|
39
|
+
(this.model.cells.length > 30 ||
|
|
40
|
+
(this.model.options['fileSize'] || 0) / (1024 * 1024) >= 5)
|
|
41
|
+
) {
|
|
42
|
+
this.addLargeFileWarning();
|
|
43
|
+
}
|
|
44
|
+
this.onOutputRenderTab((e) => {
|
|
45
|
+
// console.log('🚀 ~ LibroLabView ~ this.onOutputRenderTab ~ e:', e);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
}
|
package/src/module.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
import { SaveableTabView } from './layout/saveable-tab-view.js';
|
|
37
37
|
import './index.less';
|
|
38
38
|
import { LibroLabSideTabView } from './layout/side-tab-view.js';
|
|
39
|
+
import { LibroLabView } from './libro-lab-view.js';
|
|
39
40
|
import { LibroLabTocModule } from './toc/module.js';
|
|
40
41
|
import { EntryPointView } from './welcome/entry-point-view.js';
|
|
41
42
|
import { WelcomeView } from './welcome/index.js';
|
|
@@ -50,6 +51,7 @@ export const LibroLabModule = ManaModule.create()
|
|
|
50
51
|
LibroLabApp,
|
|
51
52
|
LibroLabLayoutView,
|
|
52
53
|
GithubLinkView,
|
|
54
|
+
LibroLabView,
|
|
53
55
|
LabConfigAppContribution,
|
|
54
56
|
LibroLabSideTabView,
|
|
55
57
|
LabColorContribution,
|