@difizen/libro-raw-cell 0.2.28 → 0.2.30

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.
@@ -1,12 +1,15 @@
1
+ import type { LanguageSpecRegistry } from '@difizen/libro-code-editor';
2
+ import { LanguageSpecContribution } from '@difizen/libro-code-editor';
1
3
  import type { CellMeta, CellModel, CellOptions } from '@difizen/libro-core';
2
4
  import { CellModelContribution, CellViewContribution } from '@difizen/libro-core';
3
5
  import { RawCellModelFactory } from './raw-cell-protocol.js';
4
6
  import { LibroRawCellView } from './raw-cell-view.js';
5
- export declare class RawCellContribution implements CellModelContribution, CellViewContribution {
7
+ export declare class RawCellContribution implements CellModelContribution, CellViewContribution, LanguageSpecContribution {
6
8
  libroCellModelFactory: RawCellModelFactory;
7
9
  cellMeta: CellMeta;
8
10
  canHandle(options: CellOptions): number;
9
11
  createModel(options: CellOptions): Promise<CellModel>;
10
12
  view: typeof LibroRawCellView;
13
+ registerLanguageSpec: (register: LanguageSpecRegistry) => void;
11
14
  }
12
15
  //# sourceMappingURL=raw-cell-contribution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"raw-cell-contribution.d.ts","sourceRoot":"","sources":["../src/raw-cell-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBACa,mBACX,YAAW,qBAAqB,EAAE,oBAAoB;IAEzB,qBAAqB,EAAE,mBAAmB,CAAC;IAExE,QAAQ,EAAE,QAAQ,CAIhB;IAEF,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM;IAIjC,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAK3D,IAAI,0BAAoB;CACzB"}
1
+ {"version":3,"file":"raw-cell-contribution.d.ts","sourceRoot":"","sources":["../src/raw-cell-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,qBAGa,mBACX,YAAW,qBAAqB,EAAE,oBAAoB,EAAE,wBAAwB;IAEnD,qBAAqB,EAAE,mBAAmB,CAAC;IAExE,QAAQ,EAAE,QAAQ,CAIhB;IAEF,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM;IAIjC,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAK3D,IAAI,0BAAoB;IAExB,oBAAoB,aAAc,oBAAoB,UAOpD;CACH"}
@@ -11,12 +11,13 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
11
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
12
  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; }
13
13
  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.'); }
14
+ import { LanguageSpecContribution } from '@difizen/libro-code-editor';
14
15
  import { CellModelContribution, CellViewContribution } from '@difizen/libro-core';
15
16
  import { inject, singleton } from '@difizen/mana-app';
16
17
  import { RawCellModelFactory } from "./raw-cell-protocol.js";
17
18
  import { LibroRawCellView } from "./raw-cell-view.js";
18
19
  export var RawCellContribution = (_dec = singleton({
19
- contrib: [CellModelContribution, CellViewContribution]
20
+ contrib: [CellModelContribution, CellViewContribution, LanguageSpecContribution]
20
21
  }), _dec2 = inject(RawCellModelFactory), _dec(_class = (_class2 = /*#__PURE__*/function () {
21
22
  function RawCellContribution() {
22
23
  _classCallCheck(this, RawCellContribution);
@@ -27,6 +28,14 @@ export var RawCellContribution = (_dec = singleton({
27
28
  order: 'e'
28
29
  };
29
30
  this.view = LibroRawCellView;
31
+ this.registerLanguageSpec = function (register) {
32
+ register.registerLanguageSpec({
33
+ name: 'Plain Text',
34
+ language: 'plaintext',
35
+ ext: ['.txt'],
36
+ mime: 'text/plain'
37
+ });
38
+ };
30
39
  }
31
40
  _createClass(RawCellContribution, [{
32
41
  key: "canHandle",
@@ -1 +1 @@
1
- {"version":3,"file":"raw-cell-view.d.ts","sourceRoot":"","sources":["../src/raw-cell-view.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAA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;AAE3B,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAyB7D,qBAEa,gBAAiB,SAAQ,mBAAmB;IAC9B,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IACrE,KAAK,EAAE,iBAAiB,CAAC;IACxB,IAAI,uEAA2B;IAExC,WAAW,EAAE,WAAW,CAAC;IAEzB,iBAAiB,EAAE,iBAAiB,CAAC;IAGrC,UAAU,CAAC,EAAE,cAAc,CAAC;gBAGN,OAAO,EAAE,eAAe,EACvB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EAClB,iBAAiB,EAAE,iBAAiB;IAQxD,WAAW;IAQpB,SAAS,CAAC,eAAe,IAAI,qBAAqB;IAkB5C,YAAY;cASF,gBAAgB;IAMvB,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;IAQtD,IAAI,aAEX;IAEF,SAAS,CAAC,WAAW;IAgBZ,KAAK,WAAY,OAAO,UAS/B;CACH"}
@@ -22,6 +22,7 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decor
22
22
  /* eslint-disable @typescript-eslint/parameter-properties */
23
23
 
24
24
  import { CodeEditorManager } from '@difizen/libro-code-editor';
25
+ import { CellUri } from '@difizen/libro-common';
25
26
  import { CellService, LibroEditorCellView, LibroContextKey } from '@difizen/libro-core';
26
27
  import { getOrigin, prop, useInject, watch } from '@difizen/mana-app';
27
28
  import { view, ViewInstance, ViewManager, ViewOption, ViewRender } from '@difizen/mana-app';
@@ -103,7 +104,7 @@ export var LibroRawCellView = (_dec = transient(), _dec2 = view('raw-cell-view')
103
104
  key: "getEditorOption",
104
105
  value: function getEditorOption() {
105
106
  var option = {
106
- uuid: "".concat(this.parent.model.id, "-").concat(this.model.id),
107
+ uuid: CellUri.from(this.parent.model.id, this.model.id).toString(),
107
108
  editorHostId: this.parent.id + this.id,
108
109
  model: this.model,
109
110
  config: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-raw-cell",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -32,9 +32,9 @@
32
32
  "src"
33
33
  ],
34
34
  "dependencies": {
35
- "@difizen/libro-code-editor": "^0.2.28",
36
- "@difizen/libro-common": "^0.2.28",
37
- "@difizen/libro-core": "^0.2.28",
35
+ "@difizen/libro-code-editor": "^0.2.30",
36
+ "@difizen/libro-common": "^0.2.30",
37
+ "@difizen/libro-core": "^0.2.30",
38
38
  "@difizen/mana-app": "latest"
39
39
  },
40
40
  "peerDependencies": {
@@ -1,3 +1,5 @@
1
+ import type { LanguageSpecRegistry } from '@difizen/libro-code-editor';
2
+ import { LanguageSpecContribution } from '@difizen/libro-code-editor';
1
3
  import type { CellMeta, CellModel, CellOptions } from '@difizen/libro-core';
2
4
  import { CellModelContribution, CellViewContribution } from '@difizen/libro-core';
3
5
  import { inject, singleton } from '@difizen/mana-app';
@@ -5,9 +7,11 @@ import { inject, singleton } from '@difizen/mana-app';
5
7
  import { RawCellModelFactory } from './raw-cell-protocol.js';
6
8
  import { LibroRawCellView } from './raw-cell-view.js';
7
9
 
8
- @singleton({ contrib: [CellModelContribution, CellViewContribution] })
10
+ @singleton({
11
+ contrib: [CellModelContribution, CellViewContribution, LanguageSpecContribution],
12
+ })
9
13
  export class RawCellContribution
10
- implements CellModelContribution, CellViewContribution
14
+ implements CellModelContribution, CellViewContribution, LanguageSpecContribution
11
15
  {
12
16
  @inject(RawCellModelFactory) libroCellModelFactory: RawCellModelFactory;
13
17
 
@@ -27,4 +31,13 @@ export class RawCellContribution
27
31
  }
28
32
 
29
33
  view = LibroRawCellView;
34
+
35
+ registerLanguageSpec = (register: LanguageSpecRegistry) => {
36
+ register.registerLanguageSpec({
37
+ name: 'Plain Text',
38
+ language: 'plaintext',
39
+ ext: ['.txt'],
40
+ mime: 'text/plain',
41
+ });
42
+ };
30
43
  }
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable @typescript-eslint/parameter-properties */
3
3
  import type { CodeEditorViewOptions, CodeEditorView } from '@difizen/libro-code-editor';
4
4
  import { CodeEditorManager } from '@difizen/libro-code-editor';
5
+ import { CellUri } from '@difizen/libro-common';
5
6
  import type { CellViewOptions } from '@difizen/libro-core';
6
7
  import { CellService, LibroEditorCellView, LibroContextKey } from '@difizen/libro-core';
7
8
  import { getOrigin, prop, useInject, watch } from '@difizen/mana-app';
@@ -76,7 +77,7 @@ export class LibroRawCellView extends LibroEditorCellView {
76
77
 
77
78
  protected getEditorOption(): CodeEditorViewOptions {
78
79
  const option: CodeEditorViewOptions = {
79
- uuid: `${this.parent.model.id}-${this.model.id}`,
80
+ uuid: CellUri.from(this.parent.model.id, this.model.id).toString(),
80
81
  editorHostId: this.parent.id + this.id,
81
82
  model: this.model,
82
83
  config: {