@difizen/libro-output 0.3.43 → 0.3.44

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 +1 @@
1
- {"version":3,"file":"display-data-output-contribution.d.ts","sourceRoot":"","sources":["../../src/display-data-output/display-data-output-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAGL,WAAW,EACX,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAOxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAW/D,qBACa,6BAA8B,YAAW,kBAAkB;IACjD,WAAW,EAAE,WAAW,CAAC;IAChB,oBAAoB,EAAE,oBAAoB,CAAC;IAC7C,kBAAkB,EAAE,kBAAkB,CAAC;IAEnE,SAAS,WAAY,OAAO,aAQ1B;IAEI,OAAO,CAAC,MAAM,EAAE,cAAc;YAMtB,mBAAmB;YA2DnB,wBAAwB;CA8CvC"}
1
+ {"version":3,"file":"display-data-output-contribution.d.ts","sourceRoot":"","sources":["../../src/display-data-output/display-data-output-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAGL,WAAW,EACX,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAOxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAW/D,qBACa,6BAA8B,YAAW,kBAAkB;IACjD,WAAW,EAAE,WAAW,CAAC;IAChB,oBAAoB,EAAE,oBAAoB,CAAC;IAC7C,kBAAkB,EAAE,kBAAkB,CAAC;IAEnE,SAAS,WAAY,OAAO,aAQ1B;IAEI,OAAO,CAAC,MAAM,EAAE,cAAc;YAetB,mBAAmB;YA2DnB,wBAAwB;CA8CvC"}
@@ -54,7 +54,15 @@ export var DisplayDataOutputContribution = (_dec = singleton({
54
54
  return this.preprocessImageData(output);
55
55
  case 2:
56
56
  processedOutput = _context.sent;
57
- return _context.abrupt("return", this.viewManager.getOrCreateView(DisplayDataOutputModel, processedOutput));
57
+ return _context.abrupt("return", this.viewManager.getOrCreateView(DisplayDataOutputModel, Object.assign(processedOutput, {
58
+ toJSON: function toJSON() {
59
+ return {
60
+ cellId: processedOutput.cell.id,
61
+ type: processedOutput.output.output_type,
62
+ keys: Object.keys(processedOutput.output.data || {})
63
+ };
64
+ }
65
+ })));
58
66
  case 4:
59
67
  case "end":
60
68
  return _context.stop();
@@ -1 +1 @@
1
- {"version":3,"file":"stream-output-contribution.d.ts","sourceRoot":"","sources":["../../src/stream-output/stream-output-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,qBACa,wBAAyB,YAAW,kBAAkB;IAC5C,WAAW,EAAE,WAAW,CAAC;IAC9C,SAAS,WAAY,OAAO,aAK1B;IACF,OAAO,CAAC,MAAM,EAAE,cAAc;CAG/B"}
1
+ {"version":3,"file":"stream-output-contribution.d.ts","sourceRoot":"","sources":["../../src/stream-output/stream-output-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,qBACa,wBAAyB,YAAW,kBAAkB;IAC5C,WAAW,EAAE,WAAW,CAAC;IAC9C,SAAS,WAAY,OAAO,aAK1B;IACF,OAAO,CAAC,MAAM,EAAE,cAAc;CAgB/B"}
@@ -28,7 +28,16 @@ export var StreamOutputContribution = (_dec = singleton({
28
28
  _createClass(StreamOutputContribution, [{
29
29
  key: "factory",
30
30
  value: function factory(output) {
31
- return this.viewManager.getOrCreateView(StreamOutputModel, output);
31
+ return this.viewManager.getOrCreateView(StreamOutputModel, Object.assign(output, {
32
+ toJSON: function toJSON() {
33
+ return {
34
+ cellId: output.cell.id,
35
+ type: output.output.output_type,
36
+ name: output.output.name,
37
+ length: typeof output.output.text === 'string' ? output.output.text.length : 0
38
+ };
39
+ }
40
+ }));
32
41
  }
33
42
  }]);
34
43
  return StreamOutputContribution;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-output",
3
- "version": "0.3.43",
3
+ "version": "0.3.44",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -32,9 +32,9 @@
32
32
  "src"
33
33
  ],
34
34
  "dependencies": {
35
- "@difizen/libro-common": "^0.3.43",
36
- "@difizen/libro-core": "^0.3.43",
37
- "@difizen/libro-rendermime": "^0.3.43",
35
+ "@difizen/libro-common": "^0.3.44",
36
+ "@difizen/libro-core": "^0.3.44",
37
+ "@difizen/libro-rendermime": "^0.3.44",
38
38
  "@difizen/mana-app": "latest",
39
39
  "@difizen/mana-l10n": "^0.1.32",
40
40
  "markdown-it": "^13.0.1"
@@ -46,7 +46,16 @@ export class DisplayDataOutputContribution implements OutputContribution {
46
46
  async factory(output: IOutputOptions) {
47
47
  // 在构造模型之前预处理图片数据
48
48
  const processedOutput = await this.preprocessImageData(output);
49
- return this.viewManager.getOrCreateView(DisplayDataOutputModel, processedOutput);
49
+ return this.viewManager.getOrCreateView(
50
+ DisplayDataOutputModel,
51
+ Object.assign(processedOutput, {
52
+ toJSON: () => ({
53
+ cellId: processedOutput.cell.id,
54
+ type: processedOutput.output.output_type,
55
+ keys: Object.keys((processedOutput.output as any).data || {}),
56
+ }),
57
+ }),
58
+ );
50
59
  }
51
60
 
52
61
  private async preprocessImageData(options: IOutputOptions): Promise<IOutputOptions> {
@@ -16,6 +16,19 @@ export class StreamOutputContribution implements OutputContribution {
16
16
  return 1;
17
17
  };
18
18
  factory(output: IOutputOptions) {
19
- return this.viewManager.getOrCreateView(StreamOutputModel, output);
19
+ return this.viewManager.getOrCreateView(
20
+ StreamOutputModel,
21
+ Object.assign(output, {
22
+ toJSON: () => ({
23
+ cellId: output.cell.id,
24
+ type: output.output.output_type,
25
+ name: (output.output as any).name,
26
+ length:
27
+ typeof (output.output as any).text === 'string'
28
+ ? (output.output as any).text.length
29
+ : 0,
30
+ }),
31
+ }),
32
+ );
20
33
  }
21
34
  }