@difizen/libro-core 0.0.2-alpha.0
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.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/es/add-cell/index.d.ts +4 -0
- package/es/add-cell/index.d.ts.map +1 -0
- package/es/add-cell/index.js +3 -0
- package/es/add-cell/index.less +38 -0
- package/es/add-cell/libro-add-cell-module.d.ts +3 -0
- package/es/add-cell/libro-add-cell-module.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-module.js +4 -0
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts +12 -0
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-slot-contribution.js +53 -0
- package/es/add-cell/libro-add-cell-view.d.ts +21 -0
- package/es/add-cell/libro-add-cell-view.d.ts.map +1 -0
- package/es/add-cell/libro-add-cell-view.js +129 -0
- package/es/cell/index.d.ts +10 -0
- package/es/cell/index.d.ts.map +1 -0
- package/es/cell/index.js +9 -0
- package/es/cell/libro-cell-contribution.d.ts +13 -0
- package/es/cell/libro-cell-contribution.d.ts.map +1 -0
- package/es/cell/libro-cell-contribution.js +41 -0
- package/es/cell/libro-cell-model.d.ts +19 -0
- package/es/cell/libro-cell-model.d.ts.map +1 -0
- package/es/cell/libro-cell-model.js +103 -0
- package/es/cell/libro-cell-module.d.ts +10 -0
- package/es/cell/libro-cell-module.d.ts.map +1 -0
- package/es/cell/libro-cell-module.js +30 -0
- package/es/cell/libro-cell-protocol.d.ts +42 -0
- package/es/cell/libro-cell-protocol.d.ts.map +1 -0
- package/es/cell/libro-cell-protocol.js +11 -0
- package/es/cell/libro-cell-service.d.ts +28 -0
- package/es/cell/libro-cell-service.d.ts.map +1 -0
- package/es/cell/libro-cell-service.js +242 -0
- package/es/cell/libro-cell-view.d.ts +65 -0
- package/es/cell/libro-cell-view.d.ts.map +1 -0
- package/es/cell/libro-cell-view.js +191 -0
- package/es/cell/libro-edit-cell-view.d.ts +32 -0
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -0
- package/es/cell/libro-edit-cell-view.js +72 -0
- package/es/cell/libro-executable-cell-model.d.ts +14 -0
- package/es/cell/libro-executable-cell-model.d.ts.map +1 -0
- package/es/cell/libro-executable-cell-model.js +7 -0
- package/es/cell/libro-executable-cell-view.d.ts +27 -0
- package/es/cell/libro-executable-cell-view.d.ts.map +1 -0
- package/es/cell/libro-executable-cell-view.js +66 -0
- package/es/cell/libro-markdown-cell-model.d.ts +9 -0
- package/es/cell/libro-markdown-cell-model.d.ts.map +1 -0
- package/es/cell/libro-markdown-cell-model.js +7 -0
- package/es/collapse-service.d.ts +36 -0
- package/es/collapse-service.d.ts.map +1 -0
- package/es/collapse-service.js +55 -0
- package/es/command/document-commands.d.ts +6 -0
- package/es/command/document-commands.d.ts.map +1 -0
- package/es/command/document-commands.js +13 -0
- package/es/command/index.d.ts +7 -0
- package/es/command/index.d.ts.map +1 -0
- package/es/command/index.js +6 -0
- package/es/command/kernel-command.d.ts +5 -0
- package/es/command/kernel-command.d.ts.map +1 -0
- package/es/command/kernel-command.js +39 -0
- package/es/command/libro-command-contribution.d.ts +14 -0
- package/es/command/libro-command-contribution.d.ts.map +1 -0
- package/es/command/libro-command-contribution.js +1751 -0
- package/es/command/libro-command-register.d.ts +22 -0
- package/es/command/libro-command-register.d.ts.map +1 -0
- package/es/command/libro-command-register.js +105 -0
- package/es/command/module.d.ts +3 -0
- package/es/command/module.d.ts.map +1 -0
- package/es/command/module.js +4 -0
- package/es/command/notebook-commands.d.ts +6 -0
- package/es/command/notebook-commands.d.ts.map +1 -0
- package/es/command/notebook-commands.js +468 -0
- package/es/components/cell-protocol.d.ts +20 -0
- package/es/components/cell-protocol.d.ts.map +1 -0
- package/es/components/cell-protocol.js +4 -0
- package/es/components/dnd-cell-item-render.d.ts +12 -0
- package/es/components/dnd-cell-item-render.d.ts.map +1 -0
- package/es/components/dnd-cell-item-render.js +253 -0
- package/es/components/dnd-component/custom-drag-layer.d.ts +9 -0
- package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -0
- package/es/components/dnd-component/custom-drag-layer.js +141 -0
- package/es/components/dnd-component/default-dnd-content.d.ts +10 -0
- package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -0
- package/es/components/dnd-component/default-dnd-content.js +257 -0
- package/es/components/dnd-component/dnd-context.d.ts +3 -0
- package/es/components/dnd-component/dnd-context.d.ts.map +1 -0
- package/es/components/dnd-component/dnd-context.js +20 -0
- package/es/components/dnd-component/dnd-list.d.ts +10 -0
- package/es/components/dnd-component/dnd-list.d.ts.map +1 -0
- package/es/components/dnd-component/dnd-list.js +115 -0
- package/es/components/dnd-component/index.d.ts +5 -0
- package/es/components/dnd-component/index.d.ts.map +1 -0
- package/es/components/dnd-component/index.js +4 -0
- package/es/components/index.d.ts +6 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +5 -0
- package/es/components/libro-component.d.ts +5 -0
- package/es/components/libro-component.d.ts.map +1 -0
- package/es/components/libro-component.js +35 -0
- package/es/components/libro-side-toolbar-menu.d.ts +21 -0
- package/es/components/libro-side-toolbar-menu.d.ts.map +1 -0
- package/es/components/libro-side-toolbar-menu.js +58 -0
- package/es/components/libro-view-header.d.ts +3 -0
- package/es/components/libro-view-header.d.ts.map +1 -0
- package/es/components/libro-view-header.js +37 -0
- package/es/configuration/libro-configuration-contribution.d.ts +5 -0
- package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
- package/es/configuration/libro-configuration-contribution.js +24 -0
- package/es/configuration/libro-configuration.d.ts +10 -0
- package/es/configuration/libro-configuration.d.ts.map +1 -0
- package/es/configuration/libro-configuration.js +81 -0
- package/es/content/index.d.ts +5 -0
- package/es/content/index.d.ts.map +1 -0
- package/es/content/index.js +4 -0
- package/es/content/libro-content-contribution.d.ts +11 -0
- package/es/content/libro-content-contribution.d.ts.map +1 -0
- package/es/content/libro-content-contribution.js +32 -0
- package/es/content/libro-content-module.d.ts +3 -0
- package/es/content/libro-content-module.d.ts.map +1 -0
- package/es/content/libro-content-module.js +5 -0
- package/es/content/libro-content-protocol.d.ts +8 -0
- package/es/content/libro-content-protocol.d.ts.map +1 -0
- package/es/content/libro-content-protocol.js +2 -0
- package/es/content/libro-content-service.d.ts +9 -0
- package/es/content/libro-content-service.d.ts.map +1 -0
- package/es/content/libro-content-service.js +35 -0
- package/es/index.d.ts +20 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +19 -0
- package/es/index.less +682 -0
- package/es/libro-context-key.d.ts +22 -0
- package/es/libro-context-key.d.ts.map +1 -0
- package/es/libro-context-key.js +80 -0
- package/es/libro-keybind-registry.d.ts +5 -0
- package/es/libro-keybind-registry.d.ts.map +1 -0
- package/es/libro-keybind-registry.js +68 -0
- package/es/libro-model.d.ts +129 -0
- package/es/libro-model.d.ts.map +1 -0
- package/es/libro-model.js +803 -0
- package/es/libro-protocol.d.ts +241 -0
- package/es/libro-protocol.d.ts.map +1 -0
- package/es/libro-protocol.js +34 -0
- package/es/libro-service.d.ts +34 -0
- package/es/libro-service.d.ts.map +1 -0
- package/es/libro-service.js +180 -0
- package/es/libro-view-tracker.d.ts +6 -0
- package/es/libro-view-tracker.d.ts.map +1 -0
- package/es/libro-view-tracker.js +13 -0
- package/es/libro-view.d.ts +151 -0
- package/es/libro-view.d.ts.map +1 -0
- package/es/libro-view.js +1963 -0
- package/es/material-from-designer.d.ts +27 -0
- package/es/material-from-designer.d.ts.map +1 -0
- package/es/material-from-designer.js +550 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +55 -0
- package/es/output/index.d.ts +6 -0
- package/es/output/index.d.ts.map +1 -0
- package/es/output/index.js +5 -0
- package/es/output/output-area.d.ts +51 -0
- package/es/output/output-area.d.ts.map +1 -0
- package/es/output/output-area.js +346 -0
- package/es/output/output-contribution.d.ts +11 -0
- package/es/output/output-contribution.d.ts.map +1 -0
- package/es/output/output-contribution.js +31 -0
- package/es/output/output-model.d.ts +27 -0
- package/es/output/output-model.d.ts.map +1 -0
- package/es/output/output-model.js +95 -0
- package/es/output/output-module.d.ts +3 -0
- package/es/output/output-module.d.ts.map +1 -0
- package/es/output/output-module.js +6 -0
- package/es/output/output-protocol.d.ts +130 -0
- package/es/output/output-protocol.d.ts.map +1 -0
- package/es/output/output-protocol.js +18 -0
- package/es/slot/index.d.ts +5 -0
- package/es/slot/index.d.ts.map +1 -0
- package/es/slot/index.js +4 -0
- package/es/slot/libro-slot-manager.d.ts +13 -0
- package/es/slot/libro-slot-manager.d.ts.map +1 -0
- package/es/slot/libro-slot-manager.js +57 -0
- package/es/slot/libro-slot-protocol.d.ts +19 -0
- package/es/slot/libro-slot-protocol.d.ts.map +1 -0
- package/es/slot/libro-slot-protocol.js +5 -0
- package/es/slot/libro-slot-view.d.ts +9 -0
- package/es/slot/libro-slot-view.d.ts.map +1 -0
- package/es/slot/libro-slot-view.js +81 -0
- package/es/slot/module.d.ts +3 -0
- package/es/slot/module.d.ts.map +1 -0
- package/es/slot/module.js +5 -0
- package/es/theme/libro-color-registry.d.ts +6 -0
- package/es/theme/libro-color-registry.d.ts.map +1 -0
- package/es/theme/libro-color-registry.js +494 -0
- package/es/toolbar/change-cell-to-selector.d.ts +5 -0
- package/es/toolbar/change-cell-to-selector.d.ts.map +1 -0
- package/es/toolbar/change-cell-to-selector.js +48 -0
- package/es/toolbar/hide-all-selector.d.ts +5 -0
- package/es/toolbar/hide-all-selector.d.ts.map +1 -0
- package/es/toolbar/hide-all-selector.js +99 -0
- package/es/toolbar/index.d.ts +4 -0
- package/es/toolbar/index.d.ts.map +1 -0
- package/es/toolbar/index.js +3 -0
- package/es/toolbar/index.less +59 -0
- package/es/toolbar/libro-toolbar-protocol.d.ts +4 -0
- package/es/toolbar/libro-toolbar-protocol.d.ts.map +1 -0
- package/es/toolbar/libro-toolbar-protocol.js +1 -0
- package/es/toolbar/libro-toolbar.d.ts +8 -0
- package/es/toolbar/libro-toolbar.d.ts.map +1 -0
- package/es/toolbar/libro-toolbar.js +223 -0
- package/es/toolbar/module.d.ts +3 -0
- package/es/toolbar/module.d.ts.map +1 -0
- package/es/toolbar/module.js +5 -0
- package/es/toolbar/restart-clear-outputs-contribution.d.ts +5 -0
- package/es/toolbar/restart-clear-outputs-contribution.d.ts.map +1 -0
- package/es/toolbar/restart-clear-outputs-contribution.js +23 -0
- package/es/toolbar/restart-clear-outputs-modal.d.ts +6 -0
- package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -0
- package/es/toolbar/restart-clear-outputs-modal.js +30 -0
- package/es/toolbar/save-icon.d.ts +3 -0
- package/es/toolbar/save-icon.d.ts.map +1 -0
- package/es/toolbar/save-icon.js +54 -0
- package/es/toolbar/shutdown-contribution.d.ts +5 -0
- package/es/toolbar/shutdown-contribution.d.ts.map +1 -0
- package/es/toolbar/shutdown-contribution.js +23 -0
- package/es/toolbar/shutdown-modal.d.ts +6 -0
- package/es/toolbar/shutdown-modal.d.ts.map +1 -0
- package/es/toolbar/shutdown-modal.js +30 -0
- package/es/toolbar/side-toolar-more-select.d.ts +4 -0
- package/es/toolbar/side-toolar-more-select.d.ts.map +1 -0
- package/es/toolbar/side-toolar-more-select.js +161 -0
- package/es/typings/index.d.ts +1 -0
- package/package.json +70 -0
- package/src/add-cell/index.less +38 -0
- package/src/add-cell/index.ts +3 -0
- package/src/add-cell/libro-add-cell-module.ts +9 -0
- package/src/add-cell/libro-add-cell-slot-contribution.ts +31 -0
- package/src/add-cell/libro-add-cell-view.tsx +101 -0
- package/src/cell/README.md +14 -0
- package/src/cell/index.ts +9 -0
- package/src/cell/libro-cell-contribution.ts +38 -0
- package/src/cell/libro-cell-model.ts +61 -0
- package/src/cell/libro-cell-module.ts +40 -0
- package/src/cell/libro-cell-protocol.ts +53 -0
- package/src/cell/libro-cell-service.ts +157 -0
- package/src/cell/libro-cell-view.tsx +128 -0
- package/src/cell/libro-edit-cell-view.tsx +60 -0
- package/src/cell/libro-executable-cell-model.ts +32 -0
- package/src/cell/libro-executable-cell-view.ts +74 -0
- package/src/cell/libro-markdown-cell-model.ts +20 -0
- package/src/collapse-service.ts +69 -0
- package/src/command/document-commands.ts +18 -0
- package/src/command/index.ts +6 -0
- package/src/command/kernel-command.ts +41 -0
- package/src/command/libro-command-contribution.ts +1339 -0
- package/src/command/libro-command-register.ts +171 -0
- package/src/command/module.ts +9 -0
- package/src/command/notebook-commands.ts +498 -0
- package/src/components/cell-protocol.ts +22 -0
- package/src/components/dnd-cell-item-render.tsx +308 -0
- package/src/components/dnd-component/custom-drag-layer.tsx +145 -0
- package/src/components/dnd-component/default-dnd-content.tsx +275 -0
- package/src/components/dnd-component/dnd-context.tsx +28 -0
- package/src/components/dnd-component/dnd-list.tsx +116 -0
- package/src/components/dnd-component/index.tsx +4 -0
- package/src/components/index.ts +5 -0
- package/src/components/libro-component.tsx +30 -0
- package/src/components/libro-side-toolbar-menu.tsx +82 -0
- package/src/components/libro-view-header.tsx +33 -0
- package/src/configuration/libro-configuration-contribution.ts +29 -0
- package/src/configuration/libro-configuration.ts +88 -0
- package/src/content/index.ts +4 -0
- package/src/content/libro-content-contribution.ts +17 -0
- package/src/content/libro-content-module.ts +9 -0
- package/src/content/libro-content-protocol.ts +8 -0
- package/src/content/libro-content-service.ts +30 -0
- package/src/index.less +682 -0
- package/src/index.tsx +19 -0
- package/src/libro-context-key.ts +80 -0
- package/src/libro-keybind-registry.ts +43 -0
- package/src/libro-model.ts +614 -0
- package/src/libro-protocol.ts +322 -0
- package/src/libro-service.ts +121 -0
- package/src/libro-view-tracker.ts +9 -0
- package/src/libro-view.tsx +1399 -0
- package/src/material-from-designer.tsx +457 -0
- package/src/module.ts +90 -0
- package/src/output/index.ts +5 -0
- package/src/output/output-area.tsx +255 -0
- package/src/output/output-contribution.ts +18 -0
- package/src/output/output-model.tsx +66 -0
- package/src/output/output-module.ts +10 -0
- package/src/output/output-protocol.ts +164 -0
- package/src/slot/index.ts +4 -0
- package/src/slot/libro-slot-manager.ts +37 -0
- package/src/slot/libro-slot-protocol.ts +28 -0
- package/src/slot/libro-slot-view.tsx +51 -0
- package/src/slot/module.ts +9 -0
- package/src/theme/libro-color-registry.ts +371 -0
- package/src/toolbar/change-cell-to-selector.tsx +58 -0
- package/src/toolbar/hide-all-selector.tsx +126 -0
- package/src/toolbar/index.less +59 -0
- package/src/toolbar/index.ts +3 -0
- package/src/toolbar/libro-toolbar-protocol.ts +4 -0
- package/src/toolbar/libro-toolbar.tsx +192 -0
- package/src/toolbar/module.ts +11 -0
- package/src/toolbar/restart-clear-outputs-contribution.tsx +10 -0
- package/src/toolbar/restart-clear-outputs-modal.tsx +37 -0
- package/src/toolbar/save-icon.tsx +47 -0
- package/src/toolbar/shutdown-contribution.tsx +10 -0
- package/src/toolbar/shutdown-modal.tsx +37 -0
- package/src/toolbar/side-toolar-more-select.tsx +172 -0
- package/src/typings/index.d.ts +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IOutput } from '@difizen/libro-common';
|
|
2
|
+
import type { ViewComponent } from '@difizen/mana-app';
|
|
3
|
+
import type { Contribution } from '@difizen/mana-app';
|
|
4
|
+
import { BaseView } from '@difizen/mana-app';
|
|
5
|
+
import { Emitter } from '@difizen/mana-app';
|
|
6
|
+
import type { CellView } from '../libro-protocol.js';
|
|
7
|
+
import type { BaseOutputArea, BaseOutputView, IOutputAreaOption } from './output-protocol.js';
|
|
8
|
+
import { OutputContribution } from './output-protocol.js';
|
|
9
|
+
export declare class LibroOutputArea extends BaseView implements BaseOutputArea {
|
|
10
|
+
view: ViewComponent;
|
|
11
|
+
cell: CellView;
|
|
12
|
+
outputs: BaseOutputView[];
|
|
13
|
+
outputProvider: Contribution.Provider<OutputContribution>;
|
|
14
|
+
constructor(option: IOutputAreaOption);
|
|
15
|
+
disposed?: boolean | undefined;
|
|
16
|
+
get length(): number;
|
|
17
|
+
protected clearNext: boolean;
|
|
18
|
+
protected lastStream: string;
|
|
19
|
+
protected lastName?: 'stdout' | 'stderr';
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
onUpdateEmitter: Emitter<void>;
|
|
24
|
+
get onUpdate(): import("@difizen/mana-app").Event<void>;
|
|
25
|
+
get(index: number): BaseOutputView;
|
|
26
|
+
protected doCreateOutput(options: IOutput): Promise<BaseOutputView>;
|
|
27
|
+
add: (output: IOutput) => Promise<number>;
|
|
28
|
+
set: (index: number, output: IOutput) => Promise<void>;
|
|
29
|
+
clear(wait?: boolean | undefined): void;
|
|
30
|
+
fromJSON: (values: IOutput[]) => Promise<void>;
|
|
31
|
+
toJSON: () => IOutput[];
|
|
32
|
+
setupCellView(cell: CellView): void;
|
|
33
|
+
protected findProvider(options: IOutput): OutputContribution;
|
|
34
|
+
/**
|
|
35
|
+
* Whether a new value should be consolidated with the previous output.
|
|
36
|
+
*
|
|
37
|
+
* This will only be called if the minimal criteria of both being stream
|
|
38
|
+
* messages of the same type.
|
|
39
|
+
*/
|
|
40
|
+
protected shouldCombine(_options: {
|
|
41
|
+
output: IOutput;
|
|
42
|
+
lastModel: BaseOutputView;
|
|
43
|
+
}): boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare function removeOverwrittenChars(text: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Normalize an output.
|
|
48
|
+
*/
|
|
49
|
+
export declare function normalize(value: string[] | string): string;
|
|
50
|
+
export declare function hasErrorOutput(cell: CellView): boolean;
|
|
51
|
+
//# sourceMappingURL=output-area.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-area.d.ts","sourceRoot":"","sources":["../../src/output/output-area.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAIL,QAAQ,EAKT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAO5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAoB1D,qBAEa,eAAgB,SAAQ,QAAS,YAAW,cAAc;IAC5D,IAAI,EAAE,aAAa,CAAyB;IACrD,IAAI,EAAE,QAAQ,CAAC;IAEf,OAAO,EAAE,cAAc,EAAE,CAAM;IAG/B,cAAc,EAAE,YAAY,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;gBAE1B,MAAM,EAAE,iBAAiB;IAIzD,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/B,IAAI,MAAM,WAET;IAED,SAAS,CAAC,SAAS,UAAS;IAC5B,SAAS,CAAC,UAAU,SAAM;IAE1B,SAAS,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAEzC;;OAEG;IACH,eAAe,gBAAuB;IAEtC,IAAI,QAAQ,4CAEX;IAED,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;IAMlC,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IASnE,GAAG,WAAkB,OAAO,KAAG,QAAQ,MAAM,CAAC,CAwC5C;IACF,GAAG,UAAiB,MAAM,UAAU,OAAO,mBAKzC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS;IAWhC,QAAQ,WAAkB,OAAO,EAAE,mBAQjC;IACF,MAAM,QAAO,OAAO,EAAE,CAEpB;IAEF,aAAa,CAAC,IAAI,EAAE,QAAQ;IAI5B,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB;IAS5D;;;;;OAKG;IAEH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE;QAChC,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,cAAc,CAAC;KAC3B,GAAG,OAAO;CAGZ;AAoCD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;GAEG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,CAK1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAQtD"}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2;
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
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 _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); }
|
|
19
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
+
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); }; }
|
|
21
|
+
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); }
|
|
22
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
+
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; } }
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
+
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; }
|
|
26
|
+
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.'); }
|
|
27
|
+
import { isError, isStream } from '@difizen/libro-common';
|
|
28
|
+
import { ViewOption, getOrigin, ViewRender, BaseView, Priority, useInject, view, ViewInstance } from '@difizen/mana-app';
|
|
29
|
+
import { Emitter } from '@difizen/mana-app';
|
|
30
|
+
import { contrib, inject, transient } from '@difizen/mana-app';
|
|
31
|
+
import { prop } from '@difizen/mana-app';
|
|
32
|
+
import React, { useEffect } from 'react';
|
|
33
|
+
import { v4 } from 'uuid';
|
|
34
|
+
import { ExecutableCellView } from "../cell/index.js";
|
|
35
|
+
import { OutputContribution } from "./output-protocol.js";
|
|
36
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
37
|
+
var LibroOutputAreaRender = /*#__PURE__*/React.forwardRef(function LibroOutputAreaRender(_props, ref) {
|
|
38
|
+
var outputArea = useInject(ViewInstance);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
outputArea.onUpdateEmitter.fire();
|
|
41
|
+
}, [outputArea.onUpdateEmitter, outputArea.outputs]);
|
|
42
|
+
return /*#__PURE__*/_jsx("div", {
|
|
43
|
+
className: "libro-output-area",
|
|
44
|
+
ref: ref,
|
|
45
|
+
children: outputArea.outputs.map(function (output) {
|
|
46
|
+
return /*#__PURE__*/_jsx(ViewRender, {
|
|
47
|
+
view: output
|
|
48
|
+
}, output.id);
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
export var LibroOutputArea = (_dec = transient(), _dec2 = view('libro-output-area'), _dec3 = prop(), _dec4 = contrib(OutputContribution), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
|
|
53
|
+
_inherits(LibroOutputArea, _BaseView);
|
|
54
|
+
var _super = _createSuper(LibroOutputArea);
|
|
55
|
+
function LibroOutputArea(option) {
|
|
56
|
+
var _this;
|
|
57
|
+
_classCallCheck(this, LibroOutputArea);
|
|
58
|
+
_this = _super.call(this);
|
|
59
|
+
_this.view = LibroOutputAreaRender;
|
|
60
|
+
_this.cell = void 0;
|
|
61
|
+
_initializerDefineProperty(_this, "outputs", _descriptor, _assertThisInitialized(_this));
|
|
62
|
+
_initializerDefineProperty(_this, "outputProvider", _descriptor2, _assertThisInitialized(_this));
|
|
63
|
+
_this.disposed = void 0;
|
|
64
|
+
_this.clearNext = false;
|
|
65
|
+
_this.lastStream = '';
|
|
66
|
+
_this.lastName = void 0;
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
_this.onUpdateEmitter = new Emitter();
|
|
71
|
+
_this.add = /*#__PURE__*/function () {
|
|
72
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(output) {
|
|
73
|
+
var index, outputModel;
|
|
74
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
if (!(isStream(output) && _this.lastStream && output.name === _this.lastName && _this.shouldCombine({
|
|
78
|
+
output: output,
|
|
79
|
+
lastModel: _this.outputs[_this.length - 1]
|
|
80
|
+
}))) {
|
|
81
|
+
_context.next = 7;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
// In order to get a list change event, we add the previous
|
|
85
|
+
// text to the current item and replace the previous item.
|
|
86
|
+
// This also replaces the metadata of the last item.
|
|
87
|
+
_this.lastStream += normalize(output.text);
|
|
88
|
+
_this.lastStream = removeOverwrittenChars(_this.lastStream);
|
|
89
|
+
output.text = _this.lastStream;
|
|
90
|
+
index = _this.length - 1;
|
|
91
|
+
_this.set(index, output);
|
|
92
|
+
return _context.abrupt("return", _this.length);
|
|
93
|
+
case 7:
|
|
94
|
+
if (isStream(output)) {
|
|
95
|
+
output.text = removeOverwrittenChars(normalize(output.text));
|
|
96
|
+
}
|
|
97
|
+
outputModel = _this.doCreateOutput(output); // Update the stream information.
|
|
98
|
+
if (isStream(output)) {
|
|
99
|
+
_this.lastStream = normalize(output.text);
|
|
100
|
+
_this.lastName = output.name;
|
|
101
|
+
} else {
|
|
102
|
+
_this.lastStream = '';
|
|
103
|
+
}
|
|
104
|
+
_context.t0 = _this.outputs;
|
|
105
|
+
_context.next = 13;
|
|
106
|
+
return outputModel;
|
|
107
|
+
case 13:
|
|
108
|
+
_context.t1 = _context.sent;
|
|
109
|
+
return _context.abrupt("return", _context.t0.push.call(_context.t0, _context.t1));
|
|
110
|
+
case 15:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context.stop();
|
|
113
|
+
}
|
|
114
|
+
}, _callee);
|
|
115
|
+
}));
|
|
116
|
+
return function (_x) {
|
|
117
|
+
return _ref.apply(this, arguments);
|
|
118
|
+
};
|
|
119
|
+
}();
|
|
120
|
+
_this.set = /*#__PURE__*/function () {
|
|
121
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(index, output) {
|
|
122
|
+
var outputModel, current;
|
|
123
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
124
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
outputModel = _this.doCreateOutput(output);
|
|
127
|
+
current = _this.outputs[index];
|
|
128
|
+
current.dispose();
|
|
129
|
+
_context2.next = 5;
|
|
130
|
+
return outputModel;
|
|
131
|
+
case 5:
|
|
132
|
+
_this.outputs[index] = _context2.sent;
|
|
133
|
+
case 6:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context2.stop();
|
|
136
|
+
}
|
|
137
|
+
}, _callee2);
|
|
138
|
+
}));
|
|
139
|
+
return function (_x2, _x3) {
|
|
140
|
+
return _ref2.apply(this, arguments);
|
|
141
|
+
};
|
|
142
|
+
}();
|
|
143
|
+
_this.fromJSON = /*#__PURE__*/function () {
|
|
144
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(values) {
|
|
145
|
+
var _iterator, _step, value;
|
|
146
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
147
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
148
|
+
case 0:
|
|
149
|
+
if (values) {
|
|
150
|
+
_context3.next = 2;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
return _context3.abrupt("return");
|
|
154
|
+
case 2:
|
|
155
|
+
// this.clear();
|
|
156
|
+
_iterator = _createForOfIteratorHelper(values);
|
|
157
|
+
_context3.prev = 3;
|
|
158
|
+
_iterator.s();
|
|
159
|
+
case 5:
|
|
160
|
+
if ((_step = _iterator.n()).done) {
|
|
161
|
+
_context3.next = 11;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
value = _step.value;
|
|
165
|
+
_context3.next = 9;
|
|
166
|
+
return _this.add(value);
|
|
167
|
+
case 9:
|
|
168
|
+
_context3.next = 5;
|
|
169
|
+
break;
|
|
170
|
+
case 11:
|
|
171
|
+
_context3.next = 16;
|
|
172
|
+
break;
|
|
173
|
+
case 13:
|
|
174
|
+
_context3.prev = 13;
|
|
175
|
+
_context3.t0 = _context3["catch"](3);
|
|
176
|
+
_iterator.e(_context3.t0);
|
|
177
|
+
case 16:
|
|
178
|
+
_context3.prev = 16;
|
|
179
|
+
_iterator.f();
|
|
180
|
+
return _context3.finish(16);
|
|
181
|
+
case 19:
|
|
182
|
+
case "end":
|
|
183
|
+
return _context3.stop();
|
|
184
|
+
}
|
|
185
|
+
}, _callee3, null, [[3, 13, 16, 19]]);
|
|
186
|
+
}));
|
|
187
|
+
return function (_x4) {
|
|
188
|
+
return _ref3.apply(this, arguments);
|
|
189
|
+
};
|
|
190
|
+
}();
|
|
191
|
+
_this.toJSON = function () {
|
|
192
|
+
return _this.outputs.map(function (output) {
|
|
193
|
+
return output.toJSON();
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
_this.cell = option.cell;
|
|
197
|
+
return _this;
|
|
198
|
+
}
|
|
199
|
+
LibroOutputArea = inject(ViewOption)(LibroOutputArea, undefined, 0) || LibroOutputArea;
|
|
200
|
+
_createClass(LibroOutputArea, [{
|
|
201
|
+
key: "length",
|
|
202
|
+
get: function get() {
|
|
203
|
+
return this.outputs.length;
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "onUpdate",
|
|
207
|
+
get: function get() {
|
|
208
|
+
return this.onUpdateEmitter.event;
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
key: "get",
|
|
212
|
+
value: function get(index) {
|
|
213
|
+
if (index >= 0 && index < this.outputs.length) {
|
|
214
|
+
return this.outputs[index];
|
|
215
|
+
}
|
|
216
|
+
throw new Error('index out of range');
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "doCreateOutput",
|
|
220
|
+
value: function doCreateOutput(options) {
|
|
221
|
+
var provider = this.findProvider(options);
|
|
222
|
+
return provider.factory({
|
|
223
|
+
output: _objectSpread({
|
|
224
|
+
_librOutputId: v4()
|
|
225
|
+
}, options),
|
|
226
|
+
trusted: this.cell.model.trusted,
|
|
227
|
+
cell: this.cell
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}, {
|
|
231
|
+
key: "clear",
|
|
232
|
+
value: function clear(wait) {
|
|
233
|
+
this.lastStream = '';
|
|
234
|
+
if (wait) {
|
|
235
|
+
this.clearNext = true;
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this.outputs.forEach(function (output) {
|
|
239
|
+
output.dispose();
|
|
240
|
+
});
|
|
241
|
+
this.outputs = [];
|
|
242
|
+
}
|
|
243
|
+
}, {
|
|
244
|
+
key: "setupCellView",
|
|
245
|
+
value: function setupCellView(cell) {
|
|
246
|
+
this.cell = cell;
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "findProvider",
|
|
250
|
+
value: function findProvider(options) {
|
|
251
|
+
var prioritized = Priority.sortSync(this.outputProvider.getContributions(), function (contribution) {
|
|
252
|
+
return contribution.canHandle(options);
|
|
253
|
+
});
|
|
254
|
+
var sorted = prioritized.map(function (c) {
|
|
255
|
+
return c.value;
|
|
256
|
+
});
|
|
257
|
+
return sorted[0];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Whether a new value should be consolidated with the previous output.
|
|
262
|
+
*
|
|
263
|
+
* This will only be called if the minimal criteria of both being stream
|
|
264
|
+
* messages of the same type.
|
|
265
|
+
*/
|
|
266
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
267
|
+
}, {
|
|
268
|
+
key: "shouldCombine",
|
|
269
|
+
value: function shouldCombine(_options) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
}]);
|
|
273
|
+
return LibroOutputArea;
|
|
274
|
+
}(BaseView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "outputs", [_dec3], {
|
|
275
|
+
configurable: true,
|
|
276
|
+
enumerable: true,
|
|
277
|
+
writable: true,
|
|
278
|
+
initializer: function initializer() {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "outputProvider", [_dec4], {
|
|
282
|
+
configurable: true,
|
|
283
|
+
enumerable: true,
|
|
284
|
+
writable: true,
|
|
285
|
+
initializer: null
|
|
286
|
+
})), _class2)) || _class) || _class);
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Remove characters that are overridden by backspace characters.
|
|
290
|
+
*/
|
|
291
|
+
function fixBackspace(txt) {
|
|
292
|
+
var tmp = txt;
|
|
293
|
+
do {
|
|
294
|
+
// eslint-disable-next-line no-param-reassign
|
|
295
|
+
txt = tmp;
|
|
296
|
+
// Cancel out anything-but-newline followed by backspace
|
|
297
|
+
tmp = txt.replace(/[^\n]\x08/gm, ''); // eslint-disable-line no-control-regex
|
|
298
|
+
} while (tmp.length < txt.length);
|
|
299
|
+
return txt;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Remove chunks that should be overridden by the effect of
|
|
304
|
+
* carriage return characters.
|
|
305
|
+
*/
|
|
306
|
+
function fixCarriageReturn(txt) {
|
|
307
|
+
// eslint-disable-next-line no-param-reassign
|
|
308
|
+
txt = txt.replace(/\r+\n/gm, '\n'); // \r followed by \n --> newline
|
|
309
|
+
while (txt.search(/\r[^$]/g) > -1) {
|
|
310
|
+
var base = txt.match(/^(.*)\r+/m)[1];
|
|
311
|
+
var insert = txt.match(/\r+(.*)$/m)[1];
|
|
312
|
+
insert = insert + base.slice(insert.length, base.length);
|
|
313
|
+
// eslint-disable-next-line no-param-reassign
|
|
314
|
+
txt = txt.replace(/\r+.*$/m, '\r').replace(/^.*\r/m, insert);
|
|
315
|
+
}
|
|
316
|
+
return txt;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/*
|
|
320
|
+
* Remove characters overridden by backspaces and carriage returns
|
|
321
|
+
*/
|
|
322
|
+
export function removeOverwrittenChars(text) {
|
|
323
|
+
return fixCarriageReturn(fixBackspace(text));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Normalize an output.
|
|
328
|
+
*/
|
|
329
|
+
//TODO: output处理
|
|
330
|
+
export function normalize(value) {
|
|
331
|
+
if (Array.isArray(value)) {
|
|
332
|
+
return value.join('');
|
|
333
|
+
}
|
|
334
|
+
return value;
|
|
335
|
+
}
|
|
336
|
+
export function hasErrorOutput(cell) {
|
|
337
|
+
if (!ExecutableCellView.is(cell)) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
if (cell.outputArea && cell.outputArea.length) {
|
|
341
|
+
return !!cell.outputArea.outputs.find(function (output) {
|
|
342
|
+
return isError(getOrigin(output.raw));
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ViewManager } from '@difizen/mana-app';
|
|
2
|
+
import { LibroOutputView } from './output-model.js';
|
|
3
|
+
import type { IOutputOptions } from './output-protocol.js';
|
|
4
|
+
import { OutputContribution } from './output-protocol.js';
|
|
5
|
+
export declare class DefaultOutputContribution implements OutputContribution {
|
|
6
|
+
viewManager: ViewManager;
|
|
7
|
+
constructor(viewManager: ViewManager);
|
|
8
|
+
canHandle: () => number;
|
|
9
|
+
factory(output: IOutputOptions): Promise<LibroOutputView>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=output-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-contribution.d.ts","sourceRoot":"","sources":["../../src/output/output-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,qBACa,yBAA0B,YAAW,kBAAkB;IAClE,WAAW,EAAE,WAAW,CAAC;gBACQ,WAAW,EAAE,WAAW;IAGzD,SAAS,eAAW;IACpB,OAAO,CAAC,MAAM,EAAE,cAAc;CAG/B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _class;
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
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); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
8
|
+
import { ViewManager } from '@difizen/mana-app';
|
|
9
|
+
import { inject, singleton } from '@difizen/mana-app';
|
|
10
|
+
import { LibroOutputView } from "./output-model.js";
|
|
11
|
+
import { OutputContribution } from "./output-protocol.js";
|
|
12
|
+
export var DefaultOutputContribution = (_dec = singleton({
|
|
13
|
+
contrib: OutputContribution
|
|
14
|
+
}), _dec(_class = /*#__PURE__*/function () {
|
|
15
|
+
function DefaultOutputContribution(viewManager) {
|
|
16
|
+
_classCallCheck(this, DefaultOutputContribution);
|
|
17
|
+
this.viewManager = void 0;
|
|
18
|
+
this.canHandle = function () {
|
|
19
|
+
return 1;
|
|
20
|
+
};
|
|
21
|
+
this.viewManager = viewManager;
|
|
22
|
+
}
|
|
23
|
+
DefaultOutputContribution = inject(ViewManager)(DefaultOutputContribution, undefined, 0) || DefaultOutputContribution;
|
|
24
|
+
_createClass(DefaultOutputContribution, [{
|
|
25
|
+
key: "factory",
|
|
26
|
+
value: function factory(output) {
|
|
27
|
+
return this.viewManager.getOrCreateView(LibroOutputView, output);
|
|
28
|
+
}
|
|
29
|
+
}]);
|
|
30
|
+
return DefaultOutputContribution;
|
|
31
|
+
}()) || _class);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IOutput, JSONObject, PartialJSONObject } from '@difizen/libro-common';
|
|
2
|
+
import { BaseView } from '@difizen/mana-app';
|
|
3
|
+
import type { FC } from 'react';
|
|
4
|
+
import type { CellView } from '../libro-protocol.js';
|
|
5
|
+
import type { IOutputOptions } from './output-protocol.js';
|
|
6
|
+
import type { ISetDataOptions, BaseOutputView } from './output-protocol.js';
|
|
7
|
+
export declare class LibroOutputView extends BaseView implements BaseOutputView {
|
|
8
|
+
id: string;
|
|
9
|
+
cell: CellView;
|
|
10
|
+
type: string;
|
|
11
|
+
raw: IOutput;
|
|
12
|
+
data: JSONObject;
|
|
13
|
+
metadata: PartialJSONObject;
|
|
14
|
+
constructor(options: IOutputOptions);
|
|
15
|
+
render: FC<{
|
|
16
|
+
output: BaseOutputView;
|
|
17
|
+
}>;
|
|
18
|
+
trusted: boolean;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
toJSON(): IOutput;
|
|
21
|
+
setData(options: ISetDataOptions): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated use LibroOutputView instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare const LibroOutputModel: typeof LibroOutputView;
|
|
27
|
+
//# sourceMappingURL=output-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-model.d.ts","sourceRoot":"","sources":["../../src/output/output-model.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAA0B,MAAM,mBAAmB,CAAC;AAErE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAS5E,qBAEa,eAAgB,SAAQ,QAAS,YAAW,cAAc;IAC5D,EAAE,SAAQ;IAGnB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,OAAO,CAAC;IAGb,IAAI,EAAE,UAAU,CAAC;IAEjB,QAAQ,EAAE,iBAAiB,CAAC;gBACI,OAAO,EAAE,cAAc;IAUvD,MAAM,EAAE,EAAE,CAAC;QAAE,MAAM,EAAE,cAAc,CAAA;KAAE,CAAC,CAA0B;IAChE,OAAO,EAAE,OAAO,CAAC;IACR,OAAO;IAGhB,MAAM;IAGN,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAQxC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,wBAAkB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3;
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
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); }
|
|
9
|
+
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); }
|
|
10
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11
|
+
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); }; }
|
|
12
|
+
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); }
|
|
13
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
|
+
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; }
|
|
17
|
+
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.'); }
|
|
18
|
+
import { BaseView, prop, view, ViewOption } from '@difizen/mana-app';
|
|
19
|
+
import { inject, transient } from '@difizen/mana-app';
|
|
20
|
+
import { v4 } from 'uuid';
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
var LibroOutputModelRender = function LibroOutputModelRender(props) {
|
|
23
|
+
var output = props.output;
|
|
24
|
+
return /*#__PURE__*/_jsx("div", {
|
|
25
|
+
children: JSON.stringify(output.toJSON(), null, 2)
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export var LibroOutputView = (_dec = transient(), _dec2 = view('libro-output-model'), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_BaseView) {
|
|
29
|
+
_inherits(LibroOutputView, _BaseView);
|
|
30
|
+
var _super = _createSuper(LibroOutputView);
|
|
31
|
+
function LibroOutputView(options) {
|
|
32
|
+
var _this;
|
|
33
|
+
_classCallCheck(this, LibroOutputView);
|
|
34
|
+
_this = _super.call(this);
|
|
35
|
+
_this.id = v4();
|
|
36
|
+
// 增加cell属性,使得通过output可以找到Cell
|
|
37
|
+
_this.cell = void 0;
|
|
38
|
+
_this.type = void 0;
|
|
39
|
+
_initializerDefineProperty(_this, "raw", _descriptor, _assertThisInitialized(_this));
|
|
40
|
+
_initializerDefineProperty(_this, "data", _descriptor2, _assertThisInitialized(_this));
|
|
41
|
+
_initializerDefineProperty(_this, "metadata", _descriptor3, _assertThisInitialized(_this));
|
|
42
|
+
_this.render = LibroOutputModelRender;
|
|
43
|
+
_this.trusted = void 0;
|
|
44
|
+
_this.raw = options.output;
|
|
45
|
+
_this.trusted = options.trusted;
|
|
46
|
+
_this.cell = options.cell;
|
|
47
|
+
_this.type = 'libro-default-output';
|
|
48
|
+
_this.data = {};
|
|
49
|
+
_this.metadata = {};
|
|
50
|
+
return _this;
|
|
51
|
+
}
|
|
52
|
+
LibroOutputView = inject(ViewOption)(LibroOutputView, undefined, 0) || LibroOutputView;
|
|
53
|
+
_createClass(LibroOutputView, [{
|
|
54
|
+
key: "dispose",
|
|
55
|
+
value: function dispose() {
|
|
56
|
+
//
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
key: "toJSON",
|
|
60
|
+
value: function toJSON() {
|
|
61
|
+
return this.raw;
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "setData",
|
|
65
|
+
value: function setData(options) {
|
|
66
|
+
if (options.data) {
|
|
67
|
+
this.data = options.data;
|
|
68
|
+
}
|
|
69
|
+
if (options.metadata) {
|
|
70
|
+
this.metadata = options.metadata;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}]);
|
|
74
|
+
return LibroOutputView;
|
|
75
|
+
}(BaseView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "raw", [_dec3], {
|
|
76
|
+
configurable: true,
|
|
77
|
+
enumerable: true,
|
|
78
|
+
writable: true,
|
|
79
|
+
initializer: null
|
|
80
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "data", [_dec4], {
|
|
81
|
+
configurable: true,
|
|
82
|
+
enumerable: true,
|
|
83
|
+
writable: true,
|
|
84
|
+
initializer: null
|
|
85
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "metadata", [_dec5], {
|
|
86
|
+
configurable: true,
|
|
87
|
+
enumerable: true,
|
|
88
|
+
writable: true,
|
|
89
|
+
initializer: null
|
|
90
|
+
})), _class2)) || _class) || _class);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated use LibroOutputView instead.
|
|
94
|
+
*/
|
|
95
|
+
export var LibroOutputModel = LibroOutputView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-module.d.ts","sourceRoot":"","sources":["../../src/output/output-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAO/C,eAAO,MAAM,YAAY,YAEgD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
2
|
+
import { LibroOutputArea } from "./output-area.js";
|
|
3
|
+
import { DefaultOutputContribution } from "./output-contribution.js";
|
|
4
|
+
import { LibroOutputModel } from "./output-model.js";
|
|
5
|
+
import { OutputContribution } from "./output-protocol.js";
|
|
6
|
+
export var OutputModule = ManaModule.create().contribution(OutputContribution).register(LibroOutputArea, LibroOutputModel, DefaultOutputContribution);
|