@difizen/libro-lab 0.1.4 → 0.1.5

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 (60) hide show
  1. package/es/image-viewer/index.d.ts +3 -0
  2. package/es/image-viewer/index.d.ts.map +1 -0
  3. package/es/image-viewer/index.js +2 -0
  4. package/es/image-viewer/index.less +3 -0
  5. package/es/image-viewer/module.d.ts +3 -0
  6. package/es/image-viewer/module.d.ts.map +1 -0
  7. package/es/image-viewer/module.js +4 -0
  8. package/es/image-viewer/open-handler.d.ts +11 -0
  9. package/es/image-viewer/open-handler.d.ts.map +1 -0
  10. package/es/image-viewer/open-handler.js +106 -0
  11. package/es/image-viewer/protocol.d.ts +10 -0
  12. package/es/image-viewer/protocol.d.ts.map +1 -0
  13. package/es/image-viewer/protocol.js +27 -0
  14. package/es/image-viewer/viewer.d.ts +29 -0
  15. package/es/image-viewer/viewer.d.ts.map +1 -0
  16. package/es/image-viewer/viewer.js +185 -0
  17. package/es/index.d.ts +10 -0
  18. package/es/index.d.ts.map +1 -1
  19. package/es/index.js +11 -1
  20. package/es/layout/brand/{index.d.ts → brand.d.ts} +1 -1
  21. package/es/layout/brand/{index.d.ts.map → brand.d.ts.map} +1 -1
  22. package/es/layout/index.d.ts +8 -0
  23. package/es/layout/index.d.ts.map +1 -1
  24. package/es/layout/index.js +9 -1
  25. package/es/layout/layout.d.ts +1 -1
  26. package/es/layout/layout.d.ts.map +1 -1
  27. package/es/layout/layout.js +2 -2
  28. package/es/layout/module.js +1 -1
  29. package/es/menu/index.d.ts +5 -0
  30. package/es/menu/index.d.ts.map +1 -0
  31. package/es/menu/index.js +4 -0
  32. package/es/module.d.ts.map +1 -1
  33. package/es/module.js +2 -1
  34. package/es/toc/index.d.ts +3 -0
  35. package/es/toc/index.d.ts.map +1 -0
  36. package/es/toc/index.js +2 -0
  37. package/es/welcome/index.d.ts +2 -12
  38. package/es/welcome/index.d.ts.map +1 -1
  39. package/es/welcome/index.js +2 -70
  40. package/es/welcome/welcome-view.d.ts +13 -0
  41. package/es/welcome/welcome-view.d.ts.map +1 -0
  42. package/es/welcome/welcome-view.js +70 -0
  43. package/package.json +12 -9
  44. package/src/image-viewer/index.less +3 -0
  45. package/src/image-viewer/index.ts +2 -0
  46. package/src/image-viewer/module.ts +9 -0
  47. package/src/image-viewer/open-handler.ts +47 -0
  48. package/src/image-viewer/protocol.ts +43 -0
  49. package/src/image-viewer/viewer.tsx +131 -0
  50. package/src/index.ts +10 -0
  51. package/src/layout/index.tsx +8 -0
  52. package/src/layout/layout.tsx +3 -3
  53. package/src/layout/module.ts +1 -1
  54. package/src/menu/index.ts +4 -0
  55. package/src/module.tsx +2 -0
  56. package/src/toc/index.ts +2 -0
  57. package/src/welcome/index.ts +2 -0
  58. /package/es/layout/brand/{index.js → brand.js} +0 -0
  59. /package/src/layout/brand/{index.tsx → brand.tsx} +0 -0
  60. /package/src/welcome/{index.tsx → welcome-view.tsx} +0 -0
@@ -0,0 +1,3 @@
1
+ export * from './module.js';
2
+ export * from './viewer.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/image-viewer/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./module.js";
2
+ export * from "./viewer.js";
@@ -0,0 +1,3 @@
1
+ .libro-lab-image-viewer {
2
+ background: var(--mana-color-bg-container);
3
+ }
@@ -0,0 +1,3 @@
1
+ import { ManaModule } from '@difizen/mana-app';
2
+ export declare const ImageViewerModule: ManaModule;
3
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/image-viewer/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,eAAO,MAAM,iBAAiB,YAG7B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ManaModule } from '@difizen/mana-app';
2
+ import { ImageViewerOpenHandler } from "./open-handler.js";
3
+ import { NavigatableImageViewerView } from "./viewer.js";
4
+ export var ImageViewerModule = ManaModule.create('ImageViewerModule').register(NavigatableImageViewerView, ImageViewerOpenHandler);
@@ -0,0 +1,11 @@
1
+ import type { URI, ViewOpenHandlerOptions } from '@difizen/mana-app';
2
+ import { ConfigurationService } from '@difizen/mana-app';
3
+ import { NavigatableViewOpenHandler, Priority } from '@difizen/mana-app';
4
+ import type { NavigatableImageViewerView } from './viewer.js';
5
+ export declare class ImageViewerOpenHandler extends NavigatableViewOpenHandler<NavigatableImageViewerView> {
6
+ protected configurationService: ConfigurationService;
7
+ id: string;
8
+ canHandle(uri: URI, _options?: ViewOpenHandlerOptions): 100 | Priority.IDLE;
9
+ open(uri: URI, options?: ViewOpenHandlerOptions): Promise<NavigatableImageViewerView>;
10
+ }
11
+ //# sourceMappingURL=open-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"open-handler.d.ts","sourceRoot":"","sources":["../../src/image-viewer/open-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAU,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,0BAA0B,EAG1B,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9D,qBACa,sBAAuB,SAAQ,0BAA0B,CAAC,0BAA0B,CAAC;IAClE,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAEnF,EAAE,SAAuC;IAGzC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,sBAAsB;IAUtC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,sBAA2B;CAenE"}
@@ -0,0 +1,106 @@
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 _excluded = ["viewOptions"];
3
+ var _dec, _dec2, _class, _class2, _descriptor;
4
+ 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; }
5
+ 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; }
6
+ 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; }
7
+ 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; }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ 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); } }
11
+ 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); }); }; }
12
+ 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 }); }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ 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); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
19
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
20
+ 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); }
21
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
+ 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); }; }
23
+ 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); }
24
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25
+ 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; } }
26
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
27
+ 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; }
28
+ 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.'); }
29
+ import { LibroJupyterConfiguration } from '@difizen/libro-jupyter';
30
+ import { ConfigurationService, inject } from '@difizen/mana-app';
31
+ import { NavigatableViewOpenHandler, OpenHandler, singleton, Priority } from '@difizen/mana-app';
32
+ import { imageExtToTypes } from "./protocol.js";
33
+ import { NavigatableImageViewerViewFactoryId } from "./viewer.js";
34
+ export var ImageViewerOpenHandler = (_dec = singleton({
35
+ contrib: OpenHandler
36
+ }), _dec2 = inject(ConfigurationService), _dec(_class = (_class2 = /*#__PURE__*/function (_NavigatableViewOpenH) {
37
+ _inherits(ImageViewerOpenHandler, _NavigatableViewOpenH);
38
+ var _super = _createSuper(ImageViewerOpenHandler);
39
+ function ImageViewerOpenHandler() {
40
+ var _this;
41
+ _classCallCheck(this, ImageViewerOpenHandler);
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
44
+ }
45
+ _this = _super.call.apply(_super, [this].concat(args));
46
+ _initializerDefineProperty(_this, "configurationService", _descriptor, _assertThisInitialized(_this));
47
+ _this.id = NavigatableImageViewerViewFactoryId;
48
+ return _this;
49
+ }
50
+ _createClass(ImageViewerOpenHandler, [{
51
+ key: "canHandle",
52
+ value:
53
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
54
+ function canHandle(uri, _options) {
55
+ if (uri.scheme === 'file') {
56
+ var ext = uri.path.ext;
57
+ if (imageExtToTypes.has(ext)) {
58
+ return 100;
59
+ }
60
+ }
61
+ return Priority.IDLE;
62
+ }
63
+ }, {
64
+ key: "open",
65
+ value: function () {
66
+ var _open = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(uri) {
67
+ var options,
68
+ viewOptions,
69
+ extra,
70
+ slot,
71
+ _args = arguments;
72
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
73
+ while (1) switch (_context.prev = _context.next) {
74
+ case 0:
75
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
76
+ viewOptions = options.viewOptions, extra = _objectWithoutProperties(options, _excluded);
77
+ _context.next = 4;
78
+ return this.configurationService.get(LibroJupyterConfiguration['OpenSlot']);
79
+ case 4:
80
+ slot = _context.sent;
81
+ return _context.abrupt("return", _get(_getPrototypeOf(ImageViewerOpenHandler.prototype), "open", this).call(this, uri, _objectSpread({
82
+ slot: slot,
83
+ viewOptions: _objectSpread({
84
+ path: uri.path.toString()
85
+ }, viewOptions),
86
+ reveal: true
87
+ }, extra)));
88
+ case 6:
89
+ case "end":
90
+ return _context.stop();
91
+ }
92
+ }, _callee, this);
93
+ }));
94
+ function open(_x) {
95
+ return _open.apply(this, arguments);
96
+ }
97
+ return open;
98
+ }()
99
+ }]);
100
+ return ImageViewerOpenHandler;
101
+ }(NavigatableViewOpenHandler), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "configurationService", [_dec2], {
102
+ configurable: true,
103
+ enumerable: true,
104
+ writable: true,
105
+ initializer: null
106
+ })), _class2)) || _class);
@@ -0,0 +1,10 @@
1
+ import type { ContentsFileFormat } from '@difizen/libro-kernel';
2
+ interface ImageFormat {
3
+ name: string;
4
+ extensions: string[];
5
+ format: ContentsFileFormat;
6
+ }
7
+ export declare const imageFileTypes: ImageFormat[];
8
+ export declare const imageExtToTypes: Map<string, ImageFormat>;
9
+ export {};
10
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/image-viewer/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,EAAE,WAAW,EA0BvC,CAAC;AAEF,eAAO,MAAM,eAAe,0BAAiC,CAAC"}
@@ -0,0 +1,27 @@
1
+ export var imageFileTypes = [{
2
+ name: 'jpeg',
3
+ extensions: ['.jpg', '.jpeg'],
4
+ format: 'base64'
5
+ }, {
6
+ name: 'gif',
7
+ extensions: ['.gif'],
8
+ format: 'base64'
9
+ }, {
10
+ name: 'png',
11
+ extensions: ['.png'],
12
+ format: 'base64'
13
+ }, {
14
+ name: 'bmp',
15
+ extensions: ['.bmp'],
16
+ format: 'base64'
17
+ }, {
18
+ name: 'webp',
19
+ extensions: ['.webp'],
20
+ format: 'base64'
21
+ }];
22
+ export var imageExtToTypes = new Map();
23
+ imageFileTypes.forEach(function (imageType) {
24
+ imageType.extensions.forEach(function (ext) {
25
+ imageExtToTypes.set(ext, imageType);
26
+ });
27
+ });
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import { ContentsManager } from '@difizen/libro-kernel';
3
+ import type { NavigatableView } from '@difizen/mana-app';
4
+ import { DisposableCollection } from '@difizen/mana-app';
5
+ import { BaseView, LabelProvider, Deferred, URI, CommandRegistry } from '@difizen/mana-app';
6
+ import './index.less';
7
+ import 'viewerjs/dist/viewer.css';
8
+ export declare function ImageViewer(): import("react/jsx-runtime").JSX.Element | null;
9
+ export declare const NavigatableImageViewerComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
10
+ export declare const NavigatableImageViewerViewFactoryId = "navigatable-image-viewer-view-factory";
11
+ export declare class NavigatableImageViewerView extends BaseView implements NavigatableView {
12
+ commandRegistry: CommandRegistry;
13
+ contentsManager: ContentsManager;
14
+ protected readonly toDisposeOnAutoSave: DisposableCollection;
15
+ view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<HTMLDivElement>>;
16
+ codeRef: import("react").RefObject<HTMLDivElement>;
17
+ filePath?: string;
18
+ content?: string;
19
+ protected defer: Deferred<void>;
20
+ get ready(): Promise<void>;
21
+ constructor(options: {
22
+ path: string;
23
+ }, labelProvider: LabelProvider);
24
+ getFileContent: () => Promise<void>;
25
+ onViewMount(): Promise<void>;
26
+ getResourceUri(): URI | undefined;
27
+ createMoveToUri(resourceUri: URI): URI | undefined;
28
+ }
29
+ //# sourceMappingURL=viewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewer.d.ts","sourceRoot":"","sources":["../../src/image-viewer/viewer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,QAAQ,EAER,aAAa,EASb,QAAQ,EACR,GAAG,EACH,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,cAAc,CAAC;AACtB,OAAO,0BAA0B,CAAC;AAElC,wBAAgB,WAAW,mDA8B1B;AAED,eAAO,MAAM,+BAA+B,0FAY3C,CAAC;AAEF,eAAO,MAAM,mCAAmC,0CACP,CAAC;AAC1C,qBAEa,0BAA2B,SAAQ,QAAS,YAAW,eAAe;IACxD,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,eAAe,CAAC;IAE1D,SAAS,CAAC,QAAQ,CAAC,mBAAmB,uBAA8B;IAE3D,IAAI,2FAAmC;IAEhD,OAAO,4CAA+B;IAE9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,KAAK,iBAAwB;IAEvC,IAAI,KAAK,kBAER;gBAGqB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EACtB,aAAa,EAAE,aAAa;IAYrD,cAAc,sBAQZ;IAEa,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C,cAAc,IAAI,GAAG,GAAG,SAAS;IAIjC,eAAe,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS;CAInD"}
@@ -0,0 +1,185 @@
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, _dec4, _dec5, _dec6, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
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 _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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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 { ContentsManager } from '@difizen/libro-kernel';
22
+ import { DisposableCollection } from '@difizen/mana-app';
23
+ import { BaseView, inject, LabelProvider, prop, transient, URI as VScodeURI, URIIconReference, useInject, view, ViewInstance, ViewOption, Deferred, URI, CommandRegistry } from '@difizen/mana-app';
24
+ import { Spin } from 'antd';
25
+ import { createRef, forwardRef, useEffect, useRef } from 'react';
26
+ import Viewer from 'viewerjs';
27
+ import "./index.less";
28
+ import 'viewerjs/dist/viewer.css';
29
+ import { jsx as _jsx } from "react/jsx-runtime";
30
+ export function ImageViewer() {
31
+ var instance = useInject(ViewInstance);
32
+ var ref = useRef(null);
33
+ var content = instance.content;
34
+ useEffect(function () {
35
+ if (ref && ref.current) {
36
+ new Viewer(ref.current, {
37
+ toolbar: {
38
+ prev: 0,
39
+ next: 0,
40
+ zoomIn: 4,
41
+ zoomOut: 4,
42
+ oneToOne: 4,
43
+ reset: 4,
44
+ play: {
45
+ show: 4,
46
+ size: 'large'
47
+ },
48
+ rotateLeft: 4,
49
+ rotateRight: 4,
50
+ flipHorizontal: 4,
51
+ flipVertical: 4
52
+ }
53
+ });
54
+ }
55
+ }, [content, ref]);
56
+ if (!content) {
57
+ return null;
58
+ }
59
+ return /*#__PURE__*/_jsx("img", {
60
+ ref: ref,
61
+ src: "data:image/png;base64,".concat(content)
62
+ });
63
+ }
64
+ export var NavigatableImageViewerComponent = /*#__PURE__*/forwardRef(function LibroEditorComponent(props, ref) {
65
+ var instance = useInject(ViewInstance);
66
+ var content = instance.content;
67
+ return /*#__PURE__*/_jsx(Spin, {
68
+ spinning: !content,
69
+ children: /*#__PURE__*/_jsx("div", {
70
+ className: "libro-lab-image-viewer",
71
+ ref: ref,
72
+ children: content && /*#__PURE__*/_jsx(ImageViewer, {})
73
+ })
74
+ });
75
+ });
76
+ export var NavigatableImageViewerViewFactoryId = 'navigatable-image-viewer-view-factory';
77
+ export var NavigatableImageViewerView = (_dec = transient(), _dec2 = view(NavigatableImageViewerViewFactoryId), _dec3 = inject(CommandRegistry), _dec4 = inject(ContentsManager), _dec5 = prop(), _dec6 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
78
+ _inherits(NavigatableImageViewerView, _BaseView);
79
+ var _super = _createSuper(NavigatableImageViewerView);
80
+ function NavigatableImageViewerView(options, labelProvider) {
81
+ var _this;
82
+ _classCallCheck(this, NavigatableImageViewerView);
83
+ _this = _super.call(this);
84
+ _initializerDefineProperty(_this, "commandRegistry", _descriptor, _assertThisInitialized(_this));
85
+ _initializerDefineProperty(_this, "contentsManager", _descriptor2, _assertThisInitialized(_this));
86
+ _this.toDisposeOnAutoSave = new DisposableCollection();
87
+ _this.view = NavigatableImageViewerComponent;
88
+ _this.codeRef = /*#__PURE__*/createRef();
89
+ _initializerDefineProperty(_this, "filePath", _descriptor3, _assertThisInitialized(_this));
90
+ _initializerDefineProperty(_this, "content", _descriptor4, _assertThisInitialized(_this));
91
+ _this.defer = new Deferred();
92
+ _this.getFileContent = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
93
+ var content;
94
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
95
+ while (1) switch (_context.prev = _context.next) {
96
+ case 0:
97
+ if (!_this.filePath) {
98
+ _context.next = 5;
99
+ break;
100
+ }
101
+ _context.next = 3;
102
+ return _this.contentsManager.get(_this.filePath, {
103
+ content: true,
104
+ format: 'base64'
105
+ });
106
+ case 3:
107
+ content = _context.sent;
108
+ _this.content = content.content;
109
+ case 5:
110
+ case "end":
111
+ return _context.stop();
112
+ }
113
+ }, _callee);
114
+ }));
115
+ _this.filePath = options.path;
116
+ _this.title.caption = options.path;
117
+ var uri = new URI(options.path);
118
+ var uriRef = URIIconReference.create('file', new VScodeURI(options.path));
119
+ var iconClass = labelProvider.getIcon(uriRef);
120
+ _this.title.icon = /*#__PURE__*/_jsx("div", {
121
+ className: iconClass
122
+ });
123
+ _this.title.label = uri.displayName;
124
+ return _this;
125
+ }
126
+ NavigatableImageViewerView = inject(LabelProvider)(NavigatableImageViewerView, undefined, 1) || NavigatableImageViewerView;
127
+ NavigatableImageViewerView = inject(ViewOption)(NavigatableImageViewerView, undefined, 0) || NavigatableImageViewerView;
128
+ _createClass(NavigatableImageViewerView, [{
129
+ key: "ready",
130
+ get: function get() {
131
+ return this.defer.promise;
132
+ }
133
+ }, {
134
+ key: "onViewMount",
135
+ value: function () {
136
+ var _onViewMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
137
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
138
+ while (1) switch (_context2.prev = _context2.next) {
139
+ case 0:
140
+ this.getFileContent();
141
+ case 1:
142
+ case "end":
143
+ return _context2.stop();
144
+ }
145
+ }, _callee2, this);
146
+ }));
147
+ function onViewMount() {
148
+ return _onViewMount.apply(this, arguments);
149
+ }
150
+ return onViewMount;
151
+ }()
152
+ }, {
153
+ key: "getResourceUri",
154
+ value: function getResourceUri() {
155
+ return new URI(this.filePath);
156
+ }
157
+ }, {
158
+ key: "createMoveToUri",
159
+ value: function createMoveToUri(resourceUri) {
160
+ this.filePath = resourceUri.path.toString();
161
+ return resourceUri;
162
+ }
163
+ }]);
164
+ return NavigatableImageViewerView;
165
+ }(BaseView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "commandRegistry", [_dec3], {
166
+ configurable: true,
167
+ enumerable: true,
168
+ writable: true,
169
+ initializer: null
170
+ }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "contentsManager", [_dec4], {
171
+ configurable: true,
172
+ enumerable: true,
173
+ writable: true,
174
+ initializer: null
175
+ }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "filePath", [_dec5], {
176
+ configurable: true,
177
+ enumerable: true,
178
+ writable: true,
179
+ initializer: null
180
+ }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "content", [_dec6], {
181
+ configurable: true,
182
+ enumerable: true,
183
+ writable: true,
184
+ initializer: null
185
+ })), _class2)) || _class) || _class);
package/es/index.d.ts CHANGED
@@ -1,2 +1,12 @@
1
1
  export * from './module.js';
2
+ export * from './lab-app.js';
3
+ export * from './github-link/index.js';
4
+ export * from './config/index.js';
5
+ export * from './layout/index.js';
6
+ export * from './menu/index.js';
7
+ export * from './toc/index.js';
8
+ export * from './welcome/index.js';
9
+ export * from './kernel-manager/index.js';
10
+ export * from './common/index.js';
11
+ export * from './image-viewer/index.js';
2
12
  //# sourceMappingURL=index.d.ts.map
package/es/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
package/es/index.js CHANGED
@@ -1 +1,11 @@
1
- export * from "./module.js";
1
+ export * from "./module.js";
2
+ export * from "./lab-app.js";
3
+ export * from "./github-link/index.js";
4
+ export * from "./config/index.js";
5
+ export * from "./layout/index.js";
6
+ export * from "./menu/index.js";
7
+ export * from "./toc/index.js";
8
+ export * from "./welcome/index.js";
9
+ export * from "./kernel-manager/index.js";
10
+ export * from "./common/index.js";
11
+ export * from "./image-viewer/index.js";
@@ -5,4 +5,4 @@ export declare const Brand: React.ForwardRefExoticComponent<any>;
5
5
  export declare class BrandView extends BaseView {
6
6
  view: React.ForwardRefExoticComponent<any>;
7
7
  }
8
- //# sourceMappingURL=index.d.ts.map
8
+ //# sourceMappingURL=brand.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layout/brand/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,cAAc,CAAC;AAEtB,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,yBAAyB,CAAC,GAAG,CAStD,CAAC;AAEF,qBAEa,SAAU,SAAQ,QAAQ;IAC5B,IAAI,uCAAS;CACvB"}
1
+ {"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../../src/layout/brand/brand.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,cAAc,CAAC;AAEtB,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,yBAAyB,CAAC,GAAG,CAStD,CAAC;AAEF,qBAEa,SAAU,SAAQ,QAAQ;IAC5B,IAAI,uCAAS;CACvB"}
@@ -1,5 +1,13 @@
1
1
  export * from './protocol.js';
2
2
  export * from './module.js';
3
3
  export * from './layout.js';
4
+ export * from './layout-service.js';
5
+ export * from './saveable-tab-view.js';
4
6
  export * from './footer/footer-view.js';
7
+ export * from './footer/status-footer-view.js';
8
+ export * from './footer/current-file-footer-view.js';
9
+ export * from './brand/brand.js';
10
+ export * from './main.js';
11
+ export * from './container.js';
12
+ export * from './content-bottom-tab-view.js';
5
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC"}
@@ -1,4 +1,12 @@
1
1
  export * from "./protocol.js";
2
2
  export * from "./module.js";
3
3
  export * from "./layout.js";
4
- export * from "./footer/footer-view.js";
4
+ export * from "./layout-service.js";
5
+ export * from "./saveable-tab-view.js";
6
+ export * from "./footer/footer-view.js";
7
+ export * from "./footer/status-footer-view.js";
8
+ export * from "./footer/current-file-footer-view.js";
9
+ export * from "./brand/brand.js";
10
+ export * from "./main.js";
11
+ export * from "./container.js";
12
+ export * from "./content-bottom-tab-view.js";
@@ -2,7 +2,7 @@
2
2
  import { BaseView } from '@difizen/mana-app';
3
3
  import './index.less';
4
4
  import { LayoutService } from './layout-service.js';
5
- export declare const LibroLabLayoutContainerComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
5
+ export declare const LibroLabLayoutComponent: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
6
6
  export declare class LibroLabLayoutView extends BaseView {
7
7
  view: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
8
8
  layoutService: LayoutService;
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/layout/layout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,eAAO,MAAM,gCAAgC,mFA8B5C,CAAC;AAEF,qBAEa,kBAAmB,SAAQ,QAAQ;IACrC,IAAI,oFAAoC;IAE1B,aAAa,EAAE,aAAa,CAAC;IAEpD,UAAU,IAAI,MAAM;IAIpB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAQrC"}
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/layout/layout.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAO7C,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,eAAO,MAAM,uBAAuB,mFA8BnC,CAAC;AAEF,qBAEa,kBAAmB,SAAQ,QAAQ;IACrC,IAAI,oFAA2B;IAEjB,aAAa,EAAE,aAAa,CAAC;IAEpD,UAAU,IAAI,MAAM;IAIpB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAQrC"}
@@ -29,7 +29,7 @@ import { LayoutService } from "./layout-service.js";
29
29
  import { LibroLabLayoutSlots } from "./protocol.js";
30
30
  import { jsx as _jsx } from "react/jsx-runtime";
31
31
  import { jsxs as _jsxs } from "react/jsx-runtime";
32
- export var LibroLabLayoutContainerComponent = /*#__PURE__*/forwardRef(function LibroLabLayoutContainerComponent() {
32
+ export var LibroLabLayoutComponent = /*#__PURE__*/forwardRef(function LibroLabLayoutComponent() {
33
33
  var layoutService = useInject(LayoutService);
34
34
  return /*#__PURE__*/_jsx("div", {
35
35
  className: "libro-lab-layout",
@@ -68,7 +68,7 @@ export var LibroLabLayoutView = (_dec = singleton(), _dec2 = view('libro-lab-lay
68
68
  args[_key] = arguments[_key];
69
69
  }
70
70
  _this = _super.call.apply(_super, [this].concat(args));
71
- _this.view = LibroLabLayoutContainerComponent;
71
+ _this.view = LibroLabLayoutComponent;
72
72
  _initializerDefineProperty(_this, "layoutService", _descriptor, _assertThisInitialized(_this));
73
73
  return _this;
74
74
  }
@@ -1,5 +1,5 @@
1
1
  import { createSlotPreference, FlexSlotView, HeaderArea, HeaderView, ManaModule } from '@difizen/mana-app';
2
- import { BrandView } from "./brand/index.js";
2
+ import { BrandView } from "./brand/brand.js";
3
3
  import { LibroLabLayoutContainerView } from "./container.js";
4
4
  import { ContentBottomTabView } from "./content-bottom-tab-view.js";
5
5
  import { LibroLabCurrentFileFooterView } from "./footer/current-file-footer-view.js";
@@ -0,0 +1,5 @@
1
+ export * from './menu-bar-view.js';
2
+ export * from './menu-command.js';
3
+ export * from './menu-contribution.js';
4
+ export * from './module.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./menu-bar-view.js";
2
+ export * from "./menu-command.js";
3
+ export * from "./menu-contribution.js";
4
+ export * from "./module.js";
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EAMX,MAAM,mBAAmB,CAAC;AAa3B,OAAO,cAAc,CAAC;AAMtB,eAAO,MAAM,cAAc,YAuExB,CAAC"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EAMX,MAAM,mBAAmB,CAAC;AAc3B,OAAO,cAAc,CAAC;AAMtB,eAAO,MAAM,cAAc,YAwExB,CAAC"}