@difizen/libro-raw-cell 0.2.29 → 0.2.31

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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-raw-cell",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
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.29",
36
- "@difizen/libro-common": "^0.2.29",
37
- "@difizen/libro-core": "^0.2.29",
35
+ "@difizen/libro-code-editor": "^0.2.31",
36
+ "@difizen/libro-common": "^0.2.31",
37
+ "@difizen/libro-core": "^0.2.31",
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
  }