@difizen/libro-jupyter 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/es/add-between-cell/add-between-cell.js +1 -1
  2. package/es/cell/jupyter-code-cell-view.d.ts +3 -1
  3. package/es/cell/jupyter-code-cell-view.d.ts.map +1 -1
  4. package/es/cell/jupyter-code-cell-view.js +12 -5
  5. package/es/command/command-contribution.d.ts.map +1 -1
  6. package/es/command/command-contribution.js +5 -5
  7. package/es/components/icons.js +1 -1
  8. package/es/contents/content-contribution.js +1 -1
  9. package/es/contents/save-content-contribution.d.ts +10 -0
  10. package/es/contents/save-content-contribution.d.ts.map +1 -0
  11. package/es/contents/save-content-contribution.js +110 -0
  12. package/es/file/file-create-modal.d.ts.map +1 -1
  13. package/es/file/file-create-modal.js +16 -5
  14. package/es/file/file-service.js +1 -1
  15. package/es/file/index.d.ts +1 -0
  16. package/es/file/index.d.ts.map +1 -1
  17. package/es/file/index.js +2 -1
  18. package/es/index.d.ts +1 -0
  19. package/es/index.d.ts.map +1 -1
  20. package/es/index.js +2 -1
  21. package/es/keybind-instructions/index.less +9 -9
  22. package/es/keybind-instructions/keybind-instructions-view.d.ts +2 -2
  23. package/es/keybind-instructions/keybind-instructions-view.d.ts.map +1 -1
  24. package/es/keybind-instructions/keybind-instructions-view.js +69 -63
  25. package/es/libro-jupyter-model.d.ts +2 -4
  26. package/es/libro-jupyter-model.d.ts.map +1 -1
  27. package/es/libro-jupyter-model.js +35 -120
  28. package/es/libro-jupyter-workspace.d.ts +18 -0
  29. package/es/libro-jupyter-workspace.d.ts.map +1 -0
  30. package/es/libro-jupyter-workspace.js +108 -0
  31. package/es/module.d.ts.map +1 -1
  32. package/es/module.js +5 -2
  33. package/es/output/libro-jupyter-outputarea.d.ts.map +1 -1
  34. package/es/output/libro-jupyter-outputarea.js +60 -56
  35. package/es/toolbar/save-file-error.d.ts.map +1 -1
  36. package/es/toolbar/save-file-error.js +20 -13
  37. package/es/widget/box/contribution.d.ts +10 -0
  38. package/es/widget/box/contribution.d.ts.map +1 -0
  39. package/es/widget/box/contribution.js +48 -0
  40. package/es/widget/box/index.d.ts +3 -0
  41. package/es/widget/box/index.d.ts.map +1 -0
  42. package/es/widget/box/index.js +2 -0
  43. package/es/widget/box/index.less +3 -0
  44. package/es/widget/box/view.d.ts +19 -0
  45. package/es/widget/box/view.d.ts.map +1 -0
  46. package/es/widget/box/view.js +114 -0
  47. package/es/widget/comm.d.ts +65 -0
  48. package/es/widget/comm.d.ts.map +1 -0
  49. package/es/widget/comm.js +153 -0
  50. package/es/widget/index.d.ts +10 -0
  51. package/es/widget/index.d.ts.map +1 -0
  52. package/es/widget/index.js +9 -0
  53. package/es/widget/index.less +7 -0
  54. package/es/widget/instance-progress/contribution.d.ts +10 -0
  55. package/es/widget/instance-progress/contribution.d.ts.map +1 -0
  56. package/es/widget/instance-progress/contribution.js +39 -0
  57. package/es/widget/instance-progress/index.d.ts +3 -0
  58. package/es/widget/instance-progress/index.d.ts.map +1 -0
  59. package/es/widget/instance-progress/index.js +2 -0
  60. package/es/widget/instance-progress/view.d.ts +30 -0
  61. package/es/widget/instance-progress/view.d.ts.map +1 -0
  62. package/es/widget/instance-progress/view.js +180 -0
  63. package/es/widget/libro-widgets.d.ts +84 -0
  64. package/es/widget/libro-widgets.d.ts.map +1 -0
  65. package/es/widget/libro-widgets.js +307 -0
  66. package/es/widget/module.d.ts +4 -0
  67. package/es/widget/module.d.ts.map +1 -0
  68. package/es/widget/module.js +38 -0
  69. package/es/widget/progress/contribution.d.ts +10 -0
  70. package/es/widget/progress/contribution.d.ts.map +1 -0
  71. package/es/widget/progress/contribution.js +39 -0
  72. package/es/widget/progress/index.d.ts +3 -0
  73. package/es/widget/progress/index.d.ts.map +1 -0
  74. package/es/widget/progress/index.js +2 -0
  75. package/es/widget/progress/progressBar.d.ts +15 -0
  76. package/es/widget/progress/progressBar.d.ts.map +1 -0
  77. package/es/widget/progress/progressBar.js +20 -0
  78. package/es/widget/progress/view.d.ts +19 -0
  79. package/es/widget/progress/view.d.ts.map +1 -0
  80. package/es/widget/progress/view.js +74 -0
  81. package/es/widget/protocol.d.ts +193 -0
  82. package/es/widget/protocol.d.ts.map +1 -0
  83. package/es/widget/protocol.js +33 -0
  84. package/es/widget/utils.d.ts +27 -0
  85. package/es/widget/utils.d.ts.map +1 -0
  86. package/es/widget/utils.js +59 -0
  87. package/es/widget/version.d.ts +3 -0
  88. package/es/widget/version.d.ts.map +1 -0
  89. package/es/widget/version.js +2 -0
  90. package/es/widget/widget-manager.d.ts +19 -0
  91. package/es/widget/widget-manager.d.ts.map +1 -0
  92. package/es/widget/widget-manager.js +77 -0
  93. package/es/widget/widget-render.d.ts +7 -0
  94. package/es/widget/widget-render.d.ts.map +1 -0
  95. package/es/widget/widget-render.js +46 -0
  96. package/es/widget/widget-rendermime-contribution.d.ts +16 -0
  97. package/es/widget/widget-rendermime-contribution.d.ts.map +1 -0
  98. package/es/widget/widget-rendermime-contribution.js +50 -0
  99. package/es/widget/widget-view-contribution.d.ts +10 -0
  100. package/es/widget/widget-view-contribution.d.ts.map +1 -0
  101. package/es/widget/widget-view-contribution.js +36 -0
  102. package/es/widget/widget-view.d.ts +71 -0
  103. package/es/widget/widget-view.d.ts.map +1 -0
  104. package/es/widget/widget-view.js +273 -0
  105. package/package.json +18 -18
  106. package/src/add-between-cell/add-between-cell.tsx +1 -1
  107. package/src/cell/jupyter-code-cell-view.tsx +14 -6
  108. package/src/command/command-contribution.ts +11 -10
  109. package/src/components/icons.tsx +1 -1
  110. package/src/contents/content-contribution.ts +1 -1
  111. package/src/contents/save-content-contribution.ts +67 -0
  112. package/src/file/file-create-modal.tsx +10 -1
  113. package/src/file/file-service.ts +1 -1
  114. package/src/file/index.ts +1 -0
  115. package/src/index.ts +1 -0
  116. package/src/keybind-instructions/index.less +9 -9
  117. package/src/keybind-instructions/keybind-instructions-view.tsx +72 -62
  118. package/src/libro-jupyter-model.ts +1 -69
  119. package/src/libro-jupyter-workspace.ts +49 -0
  120. package/src/module.ts +6 -0
  121. package/src/output/libro-jupyter-outputarea.tsx +56 -49
  122. package/src/toolbar/save-file-error.tsx +25 -15
  123. package/src/widget/box/contribution.ts +29 -0
  124. package/src/widget/box/index.less +3 -0
  125. package/src/widget/box/index.ts +2 -0
  126. package/src/widget/box/view.tsx +112 -0
  127. package/src/widget/comm.ts +152 -0
  128. package/src/widget/index.less +7 -0
  129. package/src/widget/index.ts +9 -0
  130. package/src/widget/instance-progress/contribution.ts +20 -0
  131. package/src/widget/instance-progress/index.ts +2 -0
  132. package/src/widget/instance-progress/view.tsx +155 -0
  133. package/src/widget/libro-widgets.ts +223 -0
  134. package/src/widget/module.ts +73 -0
  135. package/src/widget/progress/contribution.ts +24 -0
  136. package/src/widget/progress/index.ts +2 -0
  137. package/src/widget/progress/progressBar.tsx +29 -0
  138. package/src/widget/progress/view.tsx +70 -0
  139. package/src/widget/protocol.ts +255 -0
  140. package/src/widget/utils.ts +67 -0
  141. package/src/widget/version.ts +2 -0
  142. package/src/widget/widget-manager.ts +45 -0
  143. package/src/widget/widget-render.tsx +52 -0
  144. package/src/widget/widget-rendermime-contribution.ts +36 -0
  145. package/src/widget/widget-view-contribution.ts +14 -0
  146. package/src/widget/widget-view.tsx +259 -0
@@ -0,0 +1,108 @@
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, _descriptor2;
3
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ 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 }); }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ 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); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ 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); }
15
+ 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); }
16
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
17
+ 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); }; }
18
+ 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); }
19
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
+ 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; } }
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
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
+ 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 { URL } from '@difizen/libro-common';
25
+ import { BaseWorkspaceService, ILibroWorkspaceService } from '@difizen/libro-core';
26
+ import { ServerConnection, ServerManager } from '@difizen/libro-kernel';
27
+ import { ApplicationContribution } from '@difizen/mana-app';
28
+ import { URI } from '@difizen/mana-app';
29
+ import { inject, singleton } from '@difizen/mana-app';
30
+ export var JupyterWorkspaceService = (_dec = singleton({
31
+ contrib: [ILibroWorkspaceService, ApplicationContribution]
32
+ }), _dec2 = inject(ServerConnection), _dec3 = inject(ServerManager), _dec(_class = (_class2 = /*#__PURE__*/function (_BaseWorkspaceService) {
33
+ _inherits(JupyterWorkspaceService, _BaseWorkspaceService);
34
+ var _super = _createSuper(JupyterWorkspaceService);
35
+ function JupyterWorkspaceService() {
36
+ var _this;
37
+ _classCallCheck(this, JupyterWorkspaceService);
38
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39
+ args[_key] = arguments[_key];
40
+ }
41
+ _this = _super.call.apply(_super, [this].concat(args));
42
+ _initializerDefineProperty(_this, "serverConnection", _descriptor, _assertThisInitialized(_this));
43
+ _initializerDefineProperty(_this, "serverManager", _descriptor2, _assertThisInitialized(_this));
44
+ _this.workspaceData = void 0;
45
+ return _this;
46
+ }
47
+ _createClass(JupyterWorkspaceService, [{
48
+ key: "onViewStart",
49
+ value: function onViewStart() {
50
+ var _this2 = this;
51
+ this.serverManager.ready.then(function () {
52
+ var settings = _objectSpread({}, _this2.serverConnection.settings);
53
+ var url = URL.join(settings.baseUrl, '/libro/api/workspace');
54
+ return _this2.serverConnection.makeRequest(url, {});
55
+ }).then( /*#__PURE__*/function () {
56
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
57
+ var data;
58
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
59
+ while (1) switch (_context.prev = _context.next) {
60
+ case 0:
61
+ _context.next = 2;
62
+ return res.json();
63
+ case 2:
64
+ data = _context.sent;
65
+ _this2.workspaceData = data;
66
+ _this2.deferred.resolve();
67
+ return _context.abrupt("return");
68
+ case 6:
69
+ case "end":
70
+ return _context.stop();
71
+ }
72
+ }, _callee);
73
+ }));
74
+ return function (_x) {
75
+ return _ref.apply(this, arguments);
76
+ };
77
+ }()).catch(function () {
78
+ return;
79
+ });
80
+ }
81
+ }, {
82
+ key: "workspaceRoot",
83
+ get: function get() {
84
+ return new URI(this.workspaceData.rootUri);
85
+ }
86
+ }, {
87
+ key: "notebooks",
88
+ get: function get() {
89
+ return [];
90
+ }
91
+ }, {
92
+ key: "files",
93
+ get: function get() {
94
+ return [];
95
+ }
96
+ }]);
97
+ return JupyterWorkspaceService;
98
+ }(BaseWorkspaceService), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "serverConnection", [_dec2], {
99
+ configurable: true,
100
+ enumerable: true,
101
+ writable: true,
102
+ initializer: null
103
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "serverManager", [_dec3], {
104
+ configurable: true,
105
+ enumerable: true,
106
+ writable: true,
107
+ initializer: null
108
+ })), _class2)) || _class);
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA8B/C,eAAO,MAAM,kBAAkB,YAuD5B,CAAC"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAiC/C,eAAO,MAAM,kBAAkB,YA0D5B,CAAC"}
package/es/module.js CHANGED
@@ -16,6 +16,7 @@ import { LibroJupyterCommandContribution, LibroJupyterKeybindingContribution } f
16
16
  import { CellExecutionTip, CellInputBottomBlank } from "./components/index.js";
17
17
  import { ConfigAppContribution, LibroJupyterSettingContribution } from "./config/index.js";
18
18
  import { LibroJupyterContentContribution } from "./contents/index.js";
19
+ import { LibroJupyterContentSaveContribution } from "./contents/save-content-contribution.js";
19
20
  import { LibroJupyterFileModule } from "./file/index.js";
20
21
  import { KeybindInstructionsModule } from "./keybind-instructions/index.js";
21
22
  import { LibroJupyterFileService } from "./libro-jupyter-file-service.js";
@@ -23,11 +24,13 @@ import { LibroJupyterModel } from "./libro-jupyter-model.js";
23
24
  import { KernelStatusAndSelectorProvider } from "./libro-jupyter-protocol.js";
24
25
  import { JupyterServerLaunchManager } from "./libro-jupyter-server-launch-manager.js";
25
26
  import { LibroJupyterView } from "./libro-jupyter-view.js";
27
+ import { JupyterWorkspaceService } from "./libro-jupyter-workspace.js";
26
28
  import { LibroJupyterOutputArea } from "./output/index.js";
27
29
  import { PlotlyModule } from "./rendermime/index.js";
28
30
  import { LibroJupyterColorContribution } from "./theme/index.js";
29
31
  import { KernelStatusSelector, LibroJupyterToolbarContribution, SaveFileErrorContribution } from "./toolbar/index.js";
30
- export var LibroJupyterModule = ManaModule.create().register(LibroJupyterFileService, LibroJupyterCommandContribution, LibroJupyterKeybindingContribution, LibroJupyterToolbarContribution, ConfigAppContribution, SaveFileErrorContribution, LibroKeybindRegistry, LibroJupyterContentContribution, LibroJupyterOutputArea, LibroJupyterColorContribution, LibroJupyterSettingContribution, JupyterServerLaunchManager, LibroJupyterView, {
32
+ import { WidgetModule } from "./widget/index.js";
33
+ export var LibroJupyterModule = ManaModule.create().register(JupyterWorkspaceService, LibroJupyterFileService, LibroJupyterCommandContribution, LibroJupyterKeybindingContribution, LibroJupyterToolbarContribution, ConfigAppContribution, SaveFileErrorContribution, LibroKeybindRegistry, LibroJupyterContentContribution, LibroJupyterContentSaveContribution, LibroJupyterOutputArea, LibroJupyterColorContribution, LibroJupyterSettingContribution, JupyterServerLaunchManager, LibroJupyterView, {
31
34
  token: CellExecutionTimeProvider,
32
35
  useValue: CellExecutionTip
33
36
  }, {
@@ -47,4 +50,4 @@ export var LibroJupyterModule = ManaModule.create().register(LibroJupyterFileSer
47
50
  useClass: JupyterCodeCellView
48
51
  }).dependOn(LibroModule, CodeCellModule, MarkdownCellModule, RawCellModule, StreamOutputModule, ErrorOutputModule, DisplayDataOutputModule, LibroToolbarModule, LibroKernelManageModule, LibroSearchModule, SearchCodeCellModule, LibroAddCellModule, LibroE2EditorModule, CodeMirrorEditorModule,
49
52
  // custom module
50
- LibroBetweenCellModule, KeybindInstructionsModule, PlotlyModule, LibroJupyterFileModule, LibroLanguageClientModule);
53
+ LibroBetweenCellModule, KeybindInstructionsModule, PlotlyModule, LibroJupyterFileModule, LibroLanguageClientModule, WidgetModule);
@@ -1 +1 @@
1
- {"version":3,"file":"libro-jupyter-outputarea.d.ts","sourceRoot":"","sources":["../../src/output/libro-jupyter-outputarea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EAEvB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAWtD,qBAEa,sBAAuB,SAAQ,eAAe;IACjD,IAAI,EAAE,uBAAuB,CAAC;IACtC,SAAS,CAAC,YAAY,wBAA+B;gBAErB,MAAM,EAAE,iBAAiB;IAKzD,SAAS;IA6DA,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;CAIjD"}
1
+ {"version":3,"file":"libro-jupyter-outputarea.d.ts","sourceRoot":"","sources":["../../src/output/libro-jupyter-outputarea.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EAEvB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAatD,qBAEa,sBAAuB,SAAQ,eAAe;IACjD,IAAI,EAAE,uBAAuB,CAAC;IACtC,SAAS,CAAC,YAAY,wBAA+B;gBAErB,MAAM,EAAE,iBAAiB;IAKzD,SAAS;IAgEA,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;CAMjD"}
@@ -21,7 +21,7 @@ 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 { LibroOutputArea } from '@difizen/libro-core';
24
- import { isDisplayDataMsg, isErrorMsg, isExecuteReplyMsg, isExecuteResultMsg, isStreamMsg, isUpdateDisplayDataMsg } from '@difizen/libro-kernel';
24
+ import { isClearOutputMsg, isDisplayDataMsg, isErrorMsg, isExecuteInputMsg, isExecuteReplyMsg, isExecuteResultMsg, isStreamMsg, isUpdateDisplayDataMsg } from '@difizen/libro-kernel';
25
25
  import { inject, transient, view, ViewOption } from '@difizen/mana-app';
26
26
  export var LibroJupyterOutputArea = (_dec = transient(), _dec2 = view('libro-output-area'), _dec(_class = _dec2(_class = /*#__PURE__*/function (_LibroOutputArea) {
27
27
  _inherits(LibroJupyterOutputArea, _LibroOutputArea);
@@ -43,65 +43,67 @@ export var LibroJupyterOutputArea = (_dec = transient(), _dec2 = view('libro-out
43
43
  cellModel.msgChangeEmitter.event(function (msg) {
44
44
  var transientMsg = msg.content.transient || {};
45
45
  var displayId = transientMsg['display_id'];
46
- if (msg.header.msg_type !== 'status') {
47
- if (msg.header.msg_type === 'execute_input') {
48
- cellModel.executeCount = msg.content.execution_count;
49
- }
50
- if (isDisplayDataMsg(msg) || isStreamMsg(msg) || isErrorMsg(msg) || isExecuteResultMsg(msg)) {
51
- var output = _objectSpread(_objectSpread({}, msg.content), {}, {
52
- output_type: msg.header.msg_type
53
- });
54
- _this2.add(output);
55
- }
56
- if (isUpdateDisplayDataMsg(msg)) {
57
- var _output = _objectSpread(_objectSpread({}, msg.content), {}, {
58
- output_type: 'display_data'
59
- });
60
- var targets = _this2.displayIdMap.get(displayId);
61
- if (targets) {
62
- var _iterator = _createForOfIteratorHelper(targets),
63
- _step;
64
- try {
65
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
66
- var index = _step.value;
67
- _this2.set(index, _output);
68
- }
69
- } catch (err) {
70
- _iterator.e(err);
71
- } finally {
72
- _iterator.f();
46
+ if (isExecuteInputMsg(msg)) {
47
+ cellModel.executeCount = msg.content.execution_count;
48
+ }
49
+ if (isDisplayDataMsg(msg) || isStreamMsg(msg) || isErrorMsg(msg) || isExecuteResultMsg(msg)) {
50
+ var output = _objectSpread(_objectSpread({}, msg.content), {}, {
51
+ output_type: msg.header.msg_type
52
+ });
53
+ _this2.add(output);
54
+ }
55
+ if (isUpdateDisplayDataMsg(msg)) {
56
+ var _output = _objectSpread(_objectSpread({}, msg.content), {}, {
57
+ output_type: 'display_data'
58
+ });
59
+ var targets = _this2.displayIdMap.get(displayId);
60
+ if (targets) {
61
+ var _iterator = _createForOfIteratorHelper(targets),
62
+ _step;
63
+ try {
64
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
65
+ var index = _step.value;
66
+ _this2.set(index, _output);
73
67
  }
68
+ } catch (err) {
69
+ _iterator.e(err);
70
+ } finally {
71
+ _iterator.f();
74
72
  }
75
73
  }
76
- if (displayId && isDisplayDataMsg(msg)) {
77
- var _targets = _this2.displayIdMap.get(displayId) || [];
78
- _targets.push(_this2.outputs.length);
79
- _this2.displayIdMap.set(displayId, _targets);
74
+ }
75
+ if (displayId && isDisplayDataMsg(msg)) {
76
+ var _targets = _this2.displayIdMap.get(displayId) || [];
77
+ _targets.push(_this2.outputs.length);
78
+ _this2.displayIdMap.set(displayId, _targets);
79
+ }
80
+ //Handle an execute reply message.
81
+ if (isExecuteReplyMsg(msg)) {
82
+ var content = msg.content;
83
+ if (content.status !== 'ok') {
84
+ return;
85
+ }
86
+ var payload = content && content.payload;
87
+ if (!payload || !payload.length) {
88
+ return;
80
89
  }
81
- //Handle an execute reply message.
82
- if (isExecuteReplyMsg(msg)) {
83
- var content = msg.content;
84
- if (content.status !== 'ok') {
85
- return;
86
- }
87
- var payload = content && content.payload;
88
- if (!payload || !payload.length) {
89
- return;
90
- }
91
- var pages = payload.filter(function (i) {
92
- return i.source === 'page';
93
- });
94
- if (!pages.length) {
95
- return;
96
- }
97
- var page = JSON.parse(JSON.stringify(pages[0]));
98
- var _output2 = {
99
- output_type: 'display_data',
100
- data: page.data,
101
- metadata: {}
102
- };
103
- _this2.add(_output2);
90
+ var pages = payload.filter(function (i) {
91
+ return i.source === 'page';
92
+ });
93
+ if (!pages.length) {
94
+ return;
104
95
  }
96
+ var page = JSON.parse(JSON.stringify(pages[0]));
97
+ var _output2 = {
98
+ output_type: 'display_data',
99
+ data: page.data,
100
+ metadata: {}
101
+ };
102
+ _this2.add(_output2);
103
+ }
104
+ if (isClearOutputMsg(msg)) {
105
+ var wait = msg.content.wait;
106
+ _this2.clear(wait);
105
107
  }
106
108
  });
107
109
  }
@@ -115,7 +117,9 @@ export var LibroJupyterOutputArea = (_dec = transient(), _dec2 = view('libro-out
115
117
  key: "clear",
116
118
  value: function clear(wait) {
117
119
  _get(_getPrototypeOf(LibroJupyterOutputArea.prototype), "clear", this).call(this, wait);
118
- this.displayIdMap.clear();
120
+ if (!wait) {
121
+ this.displayIdMap.clear();
122
+ }
119
123
  }
120
124
  }]);
121
125
  return LibroJupyterOutputArea;
@@ -1 +1 @@
1
- {"version":3,"file":"save-file-error.d.ts","sourceRoot":"","sources":["../../src/toolbar/save-file-error.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnE,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAsBjE,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAGhC,CAAC"}
1
+ {"version":3,"file":"save-file-error.d.ts","sourceRoot":"","sources":["../../src/toolbar/save-file-error.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnE,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CA+BjE,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAGhC,CAAC"}
@@ -1,23 +1,30 @@
1
+ import { ThemeService } from '@difizen/mana-app';
1
2
  import { useInject, ViewInstance } from '@difizen/mana-app';
2
- import { Modal } from 'antd';
3
+ import { ConfigProvider, Modal, theme } from 'antd';
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
4
5
  export var SaveFileModalComponent = function SaveFileModalComponent(_ref) {
5
6
  var visible = _ref.visible,
6
7
  close = _ref.close;
7
8
  var libroView = useInject(ViewInstance);
8
- return /*#__PURE__*/_jsx(Modal, {
9
- title: "File Save Error",
10
- open: visible,
11
- onOk: function onOk() {
12
- return close();
9
+ var themeService = useInject(ThemeService);
10
+ return /*#__PURE__*/_jsx(ConfigProvider, {
11
+ theme: {
12
+ algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
13
13
  },
14
- onCancel: function onCancel() {
15
- return close();
16
- },
17
- width: '400px',
18
- centered: true,
19
- children: /*#__PURE__*/_jsx("p", {
20
- children: "File Save Error for: \"".concat(libroView && libroView.model ? libroView.model.currentFileContents.name : '', "\"")
14
+ children: /*#__PURE__*/_jsx(Modal, {
15
+ title: "File Save Error",
16
+ open: visible,
17
+ onOk: function onOk() {
18
+ return close();
19
+ },
20
+ onCancel: function onCancel() {
21
+ return close();
22
+ },
23
+ width: '400px',
24
+ centered: true,
25
+ children: /*#__PURE__*/_jsx("p", {
26
+ children: "File Save Error for: \"".concat(libroView && libroView.model ? libroView.model.currentFileContents.name : '', "\"")
27
+ })
21
28
  })
22
29
  });
23
30
  };
@@ -0,0 +1,10 @@
1
+ import { ViewManager } from '@difizen/mana-app';
2
+ import type { IWidgetViewProps } from '../protocol.js';
3
+ import { WidgetViewContribution } from '../protocol.js';
4
+ import { VBoxWidget } from './view.js';
5
+ export declare class VBoxWidgetContribution implements WidgetViewContribution {
6
+ viewManager: ViewManager;
7
+ canHandle: (attributes: any) => 1 | 100;
8
+ factory(props: IWidgetViewProps): Promise<VBoxWidget>;
9
+ }
10
+ //# sourceMappingURL=contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contribution.d.ts","sourceRoot":"","sources":["../../../src/widget/box/contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,qBACa,sBAAuB,YAAW,sBAAsB;IAC9C,WAAW,EAAE,WAAW,CAAC;IAC9C,SAAS,eAAgB,GAAG,aAc1B;IACF,OAAO,CAAC,KAAK,EAAE,gBAAgB;CAGhC"}
@@ -0,0 +1,48 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _dec, _dec2, _class, _class2, _descriptor;
3
+ function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
10
+ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
11
+ import { ViewManager, inject, singleton } from '@difizen/mana-app';
12
+ import { WidgetViewContribution } from "../protocol.js";
13
+ import { VBoxWidget } from "./view.js";
14
+ export var VBoxWidgetContribution = (_dec = singleton({
15
+ contrib: WidgetViewContribution
16
+ }), _dec2 = inject(ViewManager), _dec(_class = (_class2 = /*#__PURE__*/function () {
17
+ function VBoxWidgetContribution() {
18
+ _classCallCheck(this, VBoxWidgetContribution);
19
+ _initializerDefineProperty(this, "viewManager", _descriptor, this);
20
+ this.canHandle = function (attributes) {
21
+ if (attributes._model_name === 'VBoxModel') {
22
+ return 100;
23
+ }
24
+ if (attributes.__view_name === 'VBoxView') {
25
+ return 100;
26
+ }
27
+ if (attributes._model_name === 'HBoxModel') {
28
+ return 100;
29
+ }
30
+ if (attributes.__view_name === 'HBoxView') {
31
+ return 100;
32
+ }
33
+ return 1;
34
+ };
35
+ }
36
+ _createClass(VBoxWidgetContribution, [{
37
+ key: "factory",
38
+ value: function factory(props) {
39
+ return this.viewManager.getOrCreateView(VBoxWidget, props);
40
+ }
41
+ }]);
42
+ return VBoxWidgetContribution;
43
+ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "viewManager", [_dec2], {
44
+ configurable: true,
45
+ enumerable: true,
46
+ writable: true,
47
+ initializer: null
48
+ })), _class2)) || _class);
@@ -0,0 +1,3 @@
1
+ export * from './contribution.js';
2
+ export * from './view.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/widget/box/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./contribution.js";
2
+ export * from "./view.js";
@@ -0,0 +1,3 @@
1
+ .libro-widget-hbox {
2
+ display: flex;
3
+ }
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import { LibroContextKey } from '@difizen/libro-core';
3
+ import type { IWidgetViewProps, WidgetState } from '../protocol.js';
4
+ import { WidgetView } from '../widget-view.js';
5
+ import './index.less';
6
+ export declare const LibroWidgetBoxComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
7
+ interface BoxState extends WidgetState {
8
+ children: string[];
9
+ box_style?: string;
10
+ }
11
+ export declare class VBoxWidget extends WidgetView {
12
+ view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
13
+ state: BoxState;
14
+ constructor(props: IWidgetViewProps, libroContextKey: LibroContextKey);
15
+ protected initialize(props: IWidgetViewProps): void;
16
+ getCls: () => "" | "libro-widget-hbox" | "libro-widget-vbox";
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/widget/box/view.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AActD,OAAO,KAAK,EAAY,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,cAAc,CAAC;AAmCtB,eAAO,MAAM,uBAAuB,0FAiBnC,CAAC;AAEF,UAAU,QAAS,SAAQ,WAAW;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAEa,UAAW,SAAQ,UAAU;IAC/B,IAAI,2FAA2B;IAG/B,KAAK,EAAE,QAAQ,CAGtB;gBAGoB,KAAK,EAAE,gBAAgB,EAClB,eAAe,EAAE,eAAe;IAM3D,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAKnD,MAAM,uDAQJ;CACH"}
@@ -0,0 +1,114 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ 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 }); }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ 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); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
11
+ 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); }
12
+ 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); }
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ 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); }; }
15
+ 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); }
16
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
17
+ 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; } }
18
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
19
+ 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; }
20
+ 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.'); }
21
+ import { LibroContextKey } from '@difizen/libro-core';
22
+ import { view, transient, useInject, ViewInstance, prop, inject, ViewOption, ViewRender, getOrigin } from '@difizen/mana-app';
23
+ import { forwardRef } from 'react';
24
+ import { defaultWidgetState } from "../protocol.js";
25
+ import { WidgetView } from "../widget-view.js";
26
+ import "./index.less";
27
+ import { jsx as _jsx } from "react/jsx-runtime";
28
+ var WidgetRender = function WidgetRender(props) {
29
+ var widgets = props.widgets,
30
+ modelId = props.modelId,
31
+ cell = props.cell;
32
+ if (!widgets) {
33
+ return null;
34
+ }
35
+ var widgetView;
36
+ try {
37
+ widgetView = widgets.getModel(modelId);
38
+ } catch (ex) {
39
+ //
40
+ }
41
+ if (!widgetView) {
42
+ return null;
43
+ }
44
+ if (cell) {
45
+ widgetView.setCell(getOrigin(cell));
46
+ }
47
+ if (widgetView.isCommClosed) {
48
+ return null;
49
+ }
50
+ return /*#__PURE__*/_jsx("div", {
51
+ className: "libro-widget-render-container",
52
+ children: /*#__PURE__*/_jsx("div", {
53
+ className: "libro-widget-render",
54
+ children: /*#__PURE__*/_jsx(ViewRender, {
55
+ view: widgetView
56
+ })
57
+ })
58
+ });
59
+ };
60
+ export var LibroWidgetBoxComponent = /*#__PURE__*/forwardRef(function LibroWidgetBoxComponent(props, ref) {
61
+ var widget = useInject(ViewInstance);
62
+ return /*#__PURE__*/_jsx("div", {
63
+ className: "libro-widget-box ".concat(widget.getCls()),
64
+ ref: ref,
65
+ children: widget.state.children.map(function (modelId) {
66
+ return /*#__PURE__*/_jsx(WidgetRender, {
67
+ cell: widget.cell,
68
+ widgets: widget.widgets,
69
+ modelId: modelId
70
+ }, modelId);
71
+ })
72
+ });
73
+ });
74
+ export var VBoxWidget = (_dec = transient(), _dec2 = view('libro-widget-box-view'), _dec3 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_WidgetView) {
75
+ _inherits(VBoxWidget, _WidgetView);
76
+ var _super = _createSuper(VBoxWidget);
77
+ function VBoxWidget(props, libroContextKey) {
78
+ var _this;
79
+ _classCallCheck(this, VBoxWidget);
80
+ _this = _super.call(this, props, libroContextKey);
81
+ _this.view = LibroWidgetBoxComponent;
82
+ _initializerDefineProperty(_this, "state", _descriptor, _assertThisInitialized(_this));
83
+ _this.getCls = function () {
84
+ if (_this.model_name === 'HBoxModel') {
85
+ return 'libro-widget-hbox';
86
+ }
87
+ if (_this.model_name === 'VBoxModel') {
88
+ return 'libro-widget-vbox';
89
+ }
90
+ return '';
91
+ };
92
+ _this.initialize(props);
93
+ return _this;
94
+ }
95
+ VBoxWidget = inject(LibroContextKey)(VBoxWidget, undefined, 1) || VBoxWidget;
96
+ VBoxWidget = inject(ViewOption)(VBoxWidget, undefined, 0) || VBoxWidget;
97
+ _createClass(VBoxWidget, [{
98
+ key: "initialize",
99
+ value: function initialize(props) {
100
+ var attributes = props.attributes;
101
+ this.setState(attributes);
102
+ }
103
+ }]);
104
+ return VBoxWidget;
105
+ }(WidgetView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "state", [_dec3], {
106
+ configurable: true,
107
+ enumerable: true,
108
+ writable: true,
109
+ initializer: function initializer() {
110
+ return _objectSpread(_objectSpread({}, defaultWidgetState), {}, {
111
+ children: []
112
+ });
113
+ }
114
+ })), _class2)) || _class) || _class);