@difizen/libro-jupyter 0.2.19 → 0.2.21

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.
@@ -21,8 +21,8 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
21
21
  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; } }
22
22
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
23
23
  import { CellEditorMemo, LibroCodeCellView } from '@difizen/libro-code-cell';
24
+ import { getCellURI } from '@difizen/libro-common';
24
25
  import { KernelError } from '@difizen/libro-kernel';
25
- import { getCellURI } from '@difizen/libro-language-client';
26
26
  import { transient } from '@difizen/mana-app';
27
27
  import { view, ViewInstance } from '@difizen/mana-app';
28
28
  import { getOrigin, useInject } from '@difizen/mana-app';
@@ -165,7 +165,7 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
165
165
  key: "getEditorOption",
166
166
  value: function getEditorOption() {
167
167
  var options = _get(_getPrototypeOf(JupyterCodeCellView.prototype), "getEditorOption", this).call(this);
168
- var uri = getCellURI(this.parent.model, this.model);
168
+ var uri = getCellURI(this.parent.model.filePath, this.model.id);
169
169
  return _objectSpread(_objectSpread({}, options), {}, {
170
170
  uuid: uri.toString(),
171
171
  tooltipProvider: this.tooltipProvider,
@@ -0,0 +1,6 @@
1
+ import type { ColorRegistry } from '@difizen/mana-app';
2
+ import { ColorContribution } from '@difizen/mana-app';
3
+ export declare class FileColorContribution implements ColorContribution {
4
+ registerColors(colors: ColorRegistry): void;
5
+ }
6
+ //# sourceMappingURL=file-color-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-color-registry.d.ts","sourceRoot":"","sources":["../../src/file/file-color-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAS,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,qBACa,qBAAsB,YAAW,iBAAiB;IAC7D,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;CAqB5C"}
@@ -0,0 +1,47 @@
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, _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
+ import { Color, ColorContribution } from '@difizen/mana-app';
9
+ import { singleton } from '@difizen/mana-app';
10
+ export var FileColorContribution = (_dec = singleton({
11
+ contrib: ColorContribution
12
+ }), _dec(_class = /*#__PURE__*/function () {
13
+ function FileColorContribution() {
14
+ _classCallCheck(this, FileColorContribution);
15
+ }
16
+ _createClass(FileColorContribution, [{
17
+ key: "registerColors",
18
+ value: function registerColors(colors) {
19
+ // common
20
+ colors.register(
21
+ // #region antd variable
22
+ {
23
+ id: 'libro.file.label.text',
24
+ defaults: {
25
+ dark: '#F8F8FB',
26
+ light: Color.rgba(0, 0, 0, 0.85)
27
+ },
28
+ description: ''
29
+ }, {
30
+ id: 'libro.file.text',
31
+ defaults: {
32
+ dark: '#E3E4E6',
33
+ light: Color.rgba(0, 0, 0, 0.65)
34
+ },
35
+ description: ''
36
+ }, {
37
+ id: 'libro.file.type.border',
38
+ defaults: {
39
+ dark: '#3B3C42',
40
+ light: Color.rgba(0, 10, 26, 0.1)
41
+ },
42
+ description: ''
43
+ });
44
+ }
45
+ }]);
46
+ return FileColorContribution;
47
+ }()) || _class);
@@ -1 +1 @@
1
- {"version":3,"file":"file-create-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-create-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnE,OAAO,cAAc,CAAC;AAWtB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhE,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CAkK5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,CAAC"}
1
+ {"version":3,"file":"file-create-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-create-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnE,OAAO,cAAc,CAAC;AAWtB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhE,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CA4K5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,CAAC"}
@@ -8,9 +8,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { ThemeService } from '@difizen/mana-app';
11
12
  import { CommandRegistry } from '@difizen/mana-app';
12
13
  import { URI, useInject, ViewManager } from '@difizen/mana-app';
13
- import { Col, Form, message, Row, Input, Modal } from 'antd';
14
+ import { Col, Form, message, Row, Input, Modal, ConfigProvider, theme } from 'antd';
14
15
  import { useEffect, useRef, useState } from 'react';
15
16
  import "./index.less";
16
17
  import { FileView, JSONIcon, JupyterFileService, MoreIcon, NotebookIcon, PythonIcon } from "./index.js";
@@ -32,6 +33,7 @@ export var FileCreateModalComponent = function FileCreateModalComponent(_ref) {
32
33
  fileView = _useState4[0],
33
34
  setFileView = _useState4[1];
34
35
  var inputRef = useRef(null);
36
+ var themeService = useInject(ThemeService);
35
37
  var _Form$useForm = Form.useForm(),
36
38
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
37
39
  form = _Form$useForm2[0];
@@ -118,123 +120,128 @@ export var FileCreateModalComponent = function FileCreateModalComponent(_ref) {
118
120
  });
119
121
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
120
122
  });
121
- return /*#__PURE__*/_jsxs(Modal, {
122
- title: "\u65B0\u5EFA\u6587\u4EF6",
123
- open: visible,
124
- onCancel: close,
125
- width: 788,
126
- cancelText: "\u53D6\u6D88",
127
- okText: "\u786E\u5B9A",
128
- onOk: function onOk() {
129
- form.submit();
123
+ return /*#__PURE__*/_jsx(ConfigProvider, {
124
+ theme: {
125
+ algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
130
126
  },
131
- keyboard: true,
132
- wrapClassName: "libro-create-file-modal",
133
- children: [/*#__PURE__*/_jsxs("div", {
134
- className: "libro-create-file-path-container",
135
- children: [/*#__PURE__*/_jsx("div", {
127
+ children: /*#__PURE__*/_jsxs(Modal, {
128
+ title: "\u65B0\u5EFA\u6587\u4EF6",
129
+ open: visible,
130
+ onCancel: close,
131
+ width: 788,
132
+ cancelText: "\u53D6\u6D88",
133
+ okText: "\u786E\u5B9A",
134
+ onOk: function onOk() {
135
+ form.submit();
136
+ },
137
+ keyboard: true,
138
+ wrapClassName: "libro-create-file-modal",
139
+ children: [/*#__PURE__*/_jsxs("div", {
140
+ className: "libro-create-file-path-container",
141
+ children: [/*#__PURE__*/_jsx("div", {
142
+ className: "libro-create-file-des",
143
+ children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
144
+ }), /*#__PURE__*/_jsx("span", {
145
+ className: "libro-create-file-path",
146
+ children: data === null || data === void 0 ? void 0 : data.path
147
+ })]
148
+ }), /*#__PURE__*/_jsx("div", {
136
149
  className: "libro-create-file-des",
137
- children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
138
- }), /*#__PURE__*/_jsx("span", {
139
- className: "libro-create-file-path",
140
- children: data === null || data === void 0 ? void 0 : data.path
141
- })]
142
- }), /*#__PURE__*/_jsx("div", {
143
- className: "libro-create-file-des",
144
- children: "\u6587\u4EF6\u7C7B\u578B\uFF1A"
145
- }), /*#__PURE__*/_jsxs(Row, {
146
- children: [/*#__PURE__*/_jsx(Col, {
147
- className: "gutter-row",
148
- style: {
149
- paddingLeft: 'unset',
150
- paddingRight: '16px'
151
- },
152
- children: /*#__PURE__*/_jsxs("div", {
153
- className: "libro-create-file-type ".concat(fileType === '.ipynb' ? 'active' : ''),
154
- onClick: function onClick() {
155
- var _inputRef$current2;
156
- setFileType('.ipynb');
157
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
150
+ children: "\u6587\u4EF6\u7C7B\u578B\uFF1A"
151
+ }), /*#__PURE__*/_jsxs(Row, {
152
+ children: [/*#__PURE__*/_jsx(Col, {
153
+ className: "gutter-row",
154
+ style: {
155
+ paddingLeft: 'unset',
156
+ paddingRight: '16px'
158
157
  },
159
- children: [/*#__PURE__*/_jsx(NotebookIcon, {}), /*#__PURE__*/_jsx("span", {
160
- className: "libro-create-file-type-text",
161
- children: "Notebook"
162
- })]
163
- })
164
- }), /*#__PURE__*/_jsx(Col, {
165
- className: "gutter-row",
166
- style: {
167
- paddingLeft: 'unset',
168
- paddingRight: '16px'
169
- },
170
- children: /*#__PURE__*/_jsxs("div", {
171
- className: "libro-create-file-type ".concat(fileType === '.py' ? 'active' : ''),
172
- onClick: function onClick() {
173
- var _inputRef$current3;
174
- setFileType('.py');
175
- (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
158
+ children: /*#__PURE__*/_jsxs("div", {
159
+ className: "libro-create-file-type ".concat(fileType === '.ipynb' ? 'active' : ''),
160
+ onClick: function onClick() {
161
+ var _inputRef$current2;
162
+ setFileType('.ipynb');
163
+ (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
164
+ },
165
+ children: [/*#__PURE__*/_jsx(NotebookIcon, {}), /*#__PURE__*/_jsx("span", {
166
+ className: "libro-create-file-type-text",
167
+ children: "Notebook"
168
+ })]
169
+ })
170
+ }), /*#__PURE__*/_jsx(Col, {
171
+ className: "gutter-row",
172
+ style: {
173
+ paddingLeft: 'unset',
174
+ paddingRight: '16px'
176
175
  },
177
- children: [/*#__PURE__*/_jsx(PythonIcon, {}), /*#__PURE__*/_jsx("span", {
178
- className: "libro-create-file-type-text",
179
- children: "Python"
180
- })]
181
- })
182
- }), /*#__PURE__*/_jsx(Col, {
183
- className: "gutter-row",
184
- style: {
185
- paddingLeft: 'unset',
186
- paddingRight: '16px'
187
- },
188
- children: /*#__PURE__*/_jsxs("div", {
189
- className: "libro-create-file-type ".concat(fileType === '.json' ? 'active' : ''),
190
- onClick: function onClick() {
191
- var _inputRef$current4;
192
- setFileType('.json');
193
- (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.focus();
176
+ children: /*#__PURE__*/_jsxs("div", {
177
+ className: "libro-create-file-type ".concat(fileType === '.py' ? 'active' : ''),
178
+ onClick: function onClick() {
179
+ var _inputRef$current3;
180
+ setFileType('.py');
181
+ (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
182
+ },
183
+ children: [/*#__PURE__*/_jsx(PythonIcon, {}), /*#__PURE__*/_jsx("span", {
184
+ className: "libro-create-file-type-text",
185
+ children: "Python"
186
+ })]
187
+ })
188
+ }), /*#__PURE__*/_jsx(Col, {
189
+ className: "gutter-row",
190
+ style: {
191
+ paddingLeft: 'unset',
192
+ paddingRight: '16px'
194
193
  },
195
- children: [/*#__PURE__*/_jsx(JSONIcon, {}), /*#__PURE__*/_jsx("span", {
196
- className: "libro-create-file-type-text",
197
- children: "JSON"
198
- })]
199
- })
200
- }), /*#__PURE__*/_jsx(Col, {
201
- className: "gutter-row",
202
- style: {
203
- paddingLeft: 'unset',
204
- paddingRight: '16px'
205
- },
206
- children: /*#__PURE__*/_jsxs("div", {
207
- className: "libro-create-file-type ".concat(fileType === undefined ? 'active' : ''),
208
- onClick: function onClick() {
209
- var _inputRef$current5;
210
- setFileType(undefined);
211
- (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.focus();
194
+ children: /*#__PURE__*/_jsxs("div", {
195
+ className: "libro-create-file-type ".concat(fileType === '.json' ? 'active' : ''),
196
+ onClick: function onClick() {
197
+ var _inputRef$current4;
198
+ setFileType('.json');
199
+ (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.focus();
200
+ },
201
+ children: [/*#__PURE__*/_jsx(JSONIcon, {}), /*#__PURE__*/_jsx("span", {
202
+ className: "libro-create-file-type-text",
203
+ children: "JSON"
204
+ })]
205
+ })
206
+ }), /*#__PURE__*/_jsx(Col, {
207
+ className: "gutter-row",
208
+ style: {
209
+ paddingLeft: 'unset',
210
+ paddingRight: '16px'
212
211
  },
213
- children: [/*#__PURE__*/_jsx(MoreIcon, {}), /*#__PURE__*/_jsx("span", {
214
- className: "libro-create-file-type-text",
215
- children: "\u5176\u4ED6"
216
- })]
212
+ children: /*#__PURE__*/_jsxs("div", {
213
+ className: "libro-create-file-type ".concat(fileType === undefined ? 'active' : ''),
214
+ onClick: function onClick() {
215
+ var _inputRef$current5;
216
+ setFileType(undefined);
217
+ (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.focus();
218
+ },
219
+ children: [/*#__PURE__*/_jsx(MoreIcon, {}), /*#__PURE__*/_jsx("span", {
220
+ className: "libro-create-file-type-text",
221
+ children: "\u5176\u4ED6"
222
+ })]
223
+ })
224
+ })]
225
+ }), /*#__PURE__*/_jsx(Form, {
226
+ layout: "vertical",
227
+ autoComplete: "off",
228
+ form: form,
229
+ onFinish: onFinish,
230
+ className: "libro-create-file-form",
231
+ children: /*#__PURE__*/_jsx(Form.Item, {
232
+ name: "fileName",
233
+ label: "\u6587\u4EF6\u540D\u79F0",
234
+ rules: [{
235
+ required: true,
236
+ validator: validateFileName
237
+ }],
238
+ children: /*#__PURE__*/_jsx(Input, {
239
+ addonAfter: fileType || '',
240
+ ref: inputRef
241
+ })
217
242
  })
218
243
  })]
219
- }), /*#__PURE__*/_jsx(Form, {
220
- layout: "vertical",
221
- autoComplete: "off",
222
- form: form,
223
- onFinish: onFinish,
224
- className: "libro-create-file-form",
225
- children: /*#__PURE__*/_jsx(Form.Item, {
226
- name: "fileName",
227
- label: "\u6587\u4EF6\u540D\u79F0",
228
- rules: [{
229
- required: true,
230
- validator: validateFileName
231
- }],
232
- children: /*#__PURE__*/_jsx(Input, {
233
- addonAfter: fileType || '',
234
- ref: inputRef
235
- })
236
- })
237
- })]
244
+ })
238
245
  });
239
246
  };
240
247
  export var FileCreateModal = {
@@ -1 +1 @@
1
- {"version":3,"file":"file-createdir-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-createdir-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAUnE,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAChD,cAAc,CAAC,0BAA0B,CAAC,CAqF3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,0BAA0B,CAGpE,CAAC"}
1
+ {"version":3,"file":"file-createdir-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-createdir-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAWnE,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAChD,cAAc,CAAC,0BAA0B,CAAC,CA+F3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,0BAA0B,CAGpE,CAAC"}
@@ -8,10 +8,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { ThemeService } from '@difizen/mana-app';
11
12
  import { URI } from '@difizen/mana-app';
12
13
  import { ViewManager } from '@difizen/mana-app';
13
14
  import { useInject } from '@difizen/mana-app';
14
- import { Form, message, Input, Modal } from 'antd';
15
+ import { Form, message, Input, Modal, ConfigProvider, theme } from 'antd';
15
16
  import { useEffect, useRef, useState } from 'react';
16
17
  import { JupyterFileService } from "./file-service.js";
17
18
  import { FileView } from "./file-view/index.js";
@@ -24,6 +25,7 @@ export var FileCreateDirModalComponent = function FileCreateDirModalComponent(_r
24
25
  data = _ref.data;
25
26
  var fileService = useInject(JupyterFileService);
26
27
  var viewManager = useInject(ViewManager);
28
+ var themeService = useInject(ThemeService);
27
29
  var inputRef = useRef(null);
28
30
  var _useState = useState(),
29
31
  _useState2 = _slicedToArray(_useState, 2),
@@ -106,60 +108,65 @@ export var FileCreateDirModalComponent = function FileCreateDirModalComponent(_r
106
108
  });
107
109
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
108
110
  });
109
- return /*#__PURE__*/_jsxs(Modal, {
110
- title: "\u65B0\u5EFA\u6587\u4EF6\u5939",
111
- open: visible,
112
- onCancel: close,
113
- cancelText: "\u53D6\u6D88",
114
- okText: "\u786E\u5B9A",
115
- onOk: function onOk() {
116
- form.submit();
111
+ return /*#__PURE__*/_jsx(ConfigProvider, {
112
+ theme: {
113
+ algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
117
114
  },
118
- keyboard: true,
119
- wrapClassName: "libro-create-dir-modal",
120
- width: 524,
121
- children: [/*#__PURE__*/_jsx("div", {
122
- className: "libro-create-file-des",
123
- children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
124
- }), /*#__PURE__*/_jsx("span", {
125
- className: "libro-create-file-path",
126
- children: data === null || data === void 0 ? void 0 : data.path
127
- }), /*#__PURE__*/_jsx(Form, {
128
- layout: "vertical",
129
- autoComplete: "off",
130
- form: form,
131
- onFinish: onFinish,
132
- className: "libro-create-dir-file-form",
133
- children: /*#__PURE__*/_jsx(Form.Item, {
134
- name: "dirName",
135
- label: "\u6587\u4EF6\u5939\u540D\u79F0",
136
- rules: [{
137
- required: true,
138
- validator: validateDirName
139
- }],
140
- children: /*#__PURE__*/_jsx(Input, {
141
- ref: inputRef,
142
- onKeyDown: ( /*#__PURE__*/function () {
143
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
144
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
145
- while (1) switch (_context3.prev = _context3.next) {
146
- case 0:
147
- if (e.keyCode === 13) {
148
- form.submit();
149
- }
150
- case 1:
151
- case "end":
152
- return _context3.stop();
153
- }
154
- }, _callee3);
155
- }));
156
- return function (_x5) {
157
- return _ref4.apply(this, arguments);
158
- };
159
- }())
115
+ children: /*#__PURE__*/_jsxs(Modal, {
116
+ title: "\u65B0\u5EFA\u6587\u4EF6\u5939",
117
+ open: visible,
118
+ onCancel: close,
119
+ cancelText: "\u53D6\u6D88",
120
+ okText: "\u786E\u5B9A",
121
+ onOk: function onOk() {
122
+ form.submit();
123
+ },
124
+ keyboard: true,
125
+ wrapClassName: "libro-create-dir-modal",
126
+ width: 524,
127
+ children: [/*#__PURE__*/_jsx("div", {
128
+ className: "libro-create-file-des",
129
+ children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
130
+ }), /*#__PURE__*/_jsx("span", {
131
+ className: "libro-create-file-path",
132
+ children: data === null || data === void 0 ? void 0 : data.path
133
+ }), /*#__PURE__*/_jsx(Form, {
134
+ layout: "vertical",
135
+ autoComplete: "off",
136
+ form: form,
137
+ onFinish: onFinish,
138
+ className: "libro-create-dir-file-form",
139
+ children: /*#__PURE__*/_jsx(Form.Item, {
140
+ name: "dirName",
141
+ label: "\u6587\u4EF6\u5939\u540D\u79F0",
142
+ rules: [{
143
+ required: true,
144
+ validator: validateDirName
145
+ }],
146
+ children: /*#__PURE__*/_jsx(Input, {
147
+ ref: inputRef,
148
+ onKeyDown: ( /*#__PURE__*/function () {
149
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
150
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
151
+ while (1) switch (_context3.prev = _context3.next) {
152
+ case 0:
153
+ if (e.keyCode === 13) {
154
+ form.submit();
155
+ }
156
+ case 1:
157
+ case "end":
158
+ return _context3.stop();
159
+ }
160
+ }, _callee3);
161
+ }));
162
+ return function (_x5) {
163
+ return _ref4.apply(this, arguments);
164
+ };
165
+ }())
166
+ })
160
167
  })
161
- })
162
- })]
168
+ })]
169
+ })
163
170
  });
164
171
  };
165
172
  export var FileDirCreateModal = {
@@ -1 +1 @@
1
- {"version":3,"file":"file-rename-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-rename-modal.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAOxE,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CAmF5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,CAAC"}
1
+ {"version":3,"file":"file-rename-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-rename-modal.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAOxE,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CA6F5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,CAAC"}
@@ -8,8 +8,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { useInject, ViewManager } from '@difizen/mana-app';
12
- import { Form, message, Input, Modal } from 'antd';
11
+ import { ThemeService, useInject, ViewManager } from '@difizen/mana-app';
12
+ import { Form, message, Input, Modal, theme, ConfigProvider } from 'antd';
13
13
  import { useEffect, useRef, useState } from 'react';
14
14
  import { JupyterFileService } from "./file-service.js";
15
15
  import { FileView } from "./file-view/index.js";
@@ -29,6 +29,7 @@ export var FileRenameModalComponent = function FileRenameModalComponent(_ref) {
29
29
  _useState2 = _slicedToArray(_useState, 2),
30
30
  fileView = _useState2[0],
31
31
  setFileView = _useState2[1];
32
+ var themeService = useInject(ThemeService);
32
33
  useEffect(function () {
33
34
  var _inputRef$current;
34
35
  viewManager.getOrCreateView(FileView).then(function (view) {
@@ -102,48 +103,53 @@ export var FileRenameModalComponent = function FileRenameModalComponent(_ref) {
102
103
  return _ref3.apply(this, arguments);
103
104
  };
104
105
  }();
105
- return /*#__PURE__*/_jsx(Modal, {
106
- title: "\u6587\u4EF6\u91CD\u547D\u540D",
107
- open: visible,
108
- onCancel: close,
109
- onOk: function onOk() {
110
- form.submit();
106
+ return /*#__PURE__*/_jsx(ConfigProvider, {
107
+ theme: {
108
+ algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
111
109
  },
112
- wrapClassName: "libro-rename-file-modal",
113
- children: /*#__PURE__*/_jsx(Form, {
114
- layout: "vertical",
115
- autoComplete: "off",
116
- form: form,
117
- onFinish: onFinish,
118
- className: "libro-rename-file-form",
119
- children: /*#__PURE__*/_jsx(Form.Item, {
120
- name: "rename",
121
- label: "\u6587\u4EF6/\u6587\u4EF6\u5939\u540D\u79F0",
122
- rules: [{
123
- required: true,
124
- validator: validateRename
125
- }],
126
- initialValue: data === null || data === void 0 ? void 0 : data.fileName,
127
- children: /*#__PURE__*/_jsx(Input, {
128
- ref: inputRef,
129
- onKeyDown: ( /*#__PURE__*/function () {
130
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
131
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
132
- while (1) switch (_context3.prev = _context3.next) {
133
- case 0:
134
- if (e.keyCode === 13) {
135
- form.submit();
136
- }
137
- case 1:
138
- case "end":
139
- return _context3.stop();
140
- }
141
- }, _callee3);
142
- }));
143
- return function (_x5) {
144
- return _ref4.apply(this, arguments);
145
- };
146
- }())
110
+ children: /*#__PURE__*/_jsx(Modal, {
111
+ title: "\u6587\u4EF6\u91CD\u547D\u540D",
112
+ open: visible,
113
+ onCancel: close,
114
+ onOk: function onOk() {
115
+ form.submit();
116
+ },
117
+ wrapClassName: "libro-rename-file-modal",
118
+ children: /*#__PURE__*/_jsx(Form, {
119
+ layout: "vertical",
120
+ autoComplete: "off",
121
+ form: form,
122
+ onFinish: onFinish,
123
+ className: "libro-rename-file-form",
124
+ children: /*#__PURE__*/_jsx(Form.Item, {
125
+ name: "rename",
126
+ label: "\u6587\u4EF6/\u6587\u4EF6\u5939\u540D\u79F0",
127
+ rules: [{
128
+ required: true,
129
+ validator: validateRename
130
+ }],
131
+ initialValue: data === null || data === void 0 ? void 0 : data.fileName,
132
+ children: /*#__PURE__*/_jsx(Input, {
133
+ ref: inputRef,
134
+ onKeyDown: ( /*#__PURE__*/function () {
135
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
136
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
137
+ while (1) switch (_context3.prev = _context3.next) {
138
+ case 0:
139
+ if (e.keyCode === 13) {
140
+ form.submit();
141
+ }
142
+ case 1:
143
+ case "end":
144
+ return _context3.stop();
145
+ }
146
+ }, _callee3);
147
+ }));
148
+ return function (_x5) {
149
+ return _ref4.apply(this, arguments);
150
+ };
151
+ }())
152
+ })
147
153
  })
148
154
  })
149
155
  })