@difizen/libro-prompt-cell 0.1.1 → 0.1.3
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/es/index.less +1 -1
- package/es/libro-formatter-prompt-magic-contribution.d.ts +25 -0
- package/es/libro-formatter-prompt-magic-contribution.d.ts.map +1 -0
- package/es/libro-formatter-prompt-magic-contribution.js +57 -0
- package/es/libro-llm-render.d.ts.map +1 -1
- package/es/libro-llm-render.js +6 -2
- package/es/module.d.ts.map +1 -1
- package/es/module.js +3 -1
- package/es/prompt-cell-model.d.ts +0 -1
- package/es/prompt-cell-model.d.ts.map +1 -1
- package/es/prompt-cell-model.js +10 -26
- package/es/prompt-cell-view.d.ts +5 -3
- package/es/prompt-cell-view.d.ts.map +1 -1
- package/es/prompt-cell-view.js +109 -79
- package/es/prompt-output-render.d.ts.map +1 -1
- package/es/prompt-output-render.js +117 -10
- package/package.json +7 -7
- package/src/index.less +1 -1
- package/src/libro-formatter-prompt-magic-contribution.ts +63 -0
- package/src/libro-llm-render.tsx +2 -1
- package/src/module.ts +4 -1
- package/src/prompt-cell-model.ts +7 -25
- package/src/prompt-cell-view.tsx +55 -41
- package/src/prompt-output-render.tsx +51 -8
package/es/index.less
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DefaultEncodedFormatter } from '@difizen/libro-jupyter';
|
|
2
|
+
import { DefaultDecodedFormatter, FormatterContribution } from '@difizen/libro-jupyter';
|
|
3
|
+
export interface PromptDecodedFormatter extends DefaultDecodedFormatter {
|
|
4
|
+
modelType?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class FormatterPromptMagicContribution implements FormatterContribution<PromptDecodedFormatter> {
|
|
7
|
+
formatter: string;
|
|
8
|
+
formatterOptions?: object;
|
|
9
|
+
canHandle: (libroFormatter: string) => 1 | 100;
|
|
10
|
+
encode: (source: PromptDecodedFormatter) => {
|
|
11
|
+
source: string;
|
|
12
|
+
metadata: {
|
|
13
|
+
libroFormatter: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
decode: (formatterValue: DefaultEncodedFormatter) => {
|
|
17
|
+
value: any;
|
|
18
|
+
modelType: any;
|
|
19
|
+
} | {
|
|
20
|
+
value: string;
|
|
21
|
+
modelType?: undefined;
|
|
22
|
+
};
|
|
23
|
+
validate: (source: PromptDecodedFormatter) => source is PromptDecodedFormatter;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=libro-formatter-prompt-magic-contribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libro-formatter-prompt-magic-contribution.d.ts","sourceRoot":"","sources":["../src/libro-formatter-prompt-magic-contribution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAEL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBACa,gCACX,YAAW,qBAAqB,CAAC,sBAAsB,CAAC;IAExD,SAAS,SAA4B;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,mBAAoB,MAAM,aAKjC;IAEF,MAAM,WAAY,sBAAsB;;;;;MAYtC;IAEF,MAAM,mBAAoB,uBAAuB;;;;;;MAgB/C;IAEF,QAAQ,WAAY,sBAAsB,sCAExC;CACH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _class;
|
|
3
|
+
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); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
9
|
+
|
|
10
|
+
import { concatMultilineString, DefaultDecodedFormatter, FormatterContribution } from '@difizen/libro-jupyter';
|
|
11
|
+
import { singleton } from '@difizen/mana-app';
|
|
12
|
+
export var FormatterPromptMagicContribution = (_dec = singleton({
|
|
13
|
+
contrib: FormatterContribution
|
|
14
|
+
}), _dec(_class = /*#__PURE__*/_createClass(function FormatterPromptMagicContribution() {
|
|
15
|
+
var _this = this;
|
|
16
|
+
_classCallCheck(this, FormatterPromptMagicContribution);
|
|
17
|
+
this.formatter = 'formatter-prompt-magic';
|
|
18
|
+
this.formatterOptions = void 0;
|
|
19
|
+
this.canHandle = function (libroFormatter) {
|
|
20
|
+
if (libroFormatter === _this.formatter) {
|
|
21
|
+
return 100;
|
|
22
|
+
}
|
|
23
|
+
return 1;
|
|
24
|
+
};
|
|
25
|
+
this.encode = function (source) {
|
|
26
|
+
var promptObj = {
|
|
27
|
+
model_name: source.modelType || 'CodeGPT',
|
|
28
|
+
prompt: source.value
|
|
29
|
+
};
|
|
30
|
+
var encodeValue = "%%prompt \n".concat(JSON.stringify(promptObj));
|
|
31
|
+
return {
|
|
32
|
+
source: encodeValue,
|
|
33
|
+
metadata: {
|
|
34
|
+
libroFormatter: _this.formatter
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
this.decode = function (formatterValue) {
|
|
39
|
+
var value = concatMultilineString(formatterValue.source);
|
|
40
|
+
if (value.startsWith('%%prompt \n')) {
|
|
41
|
+
var run = value.split('%%prompt \n')[1];
|
|
42
|
+
var runValue = JSON.parse(run);
|
|
43
|
+
var codeValue = runValue.prompt;
|
|
44
|
+
var modelType = runValue.model_name;
|
|
45
|
+
return {
|
|
46
|
+
value: codeValue,
|
|
47
|
+
modelType: modelType
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
value: ''
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
this.validate = function (source) {
|
|
55
|
+
return DefaultDecodedFormatter.is(source) && 'modelType' in source;
|
|
56
|
+
};
|
|
57
|
+
})) || _class);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-llm-render.d.ts","sourceRoot":"","sources":["../src/libro-llm-render.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,iCAAiC,CAAC;AAEzC,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-llm-render.d.ts","sourceRoot":"","sources":["../src/libro-llm-render.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,iCAAiC,CAAC;AAEzC,OAAO,cAAc,CAAC;AAiBtB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAqCrD,CAAC;AACF,eAAO,MAAM,kBAAkB;UAtCe,MAAM;EAsCE,CAAC"}
|
package/es/libro-llm-render.js
CHANGED
|
@@ -29,7 +29,10 @@ marked.use(markedKatex({
|
|
|
29
29
|
language: language
|
|
30
30
|
}).value;
|
|
31
31
|
}
|
|
32
|
-
})
|
|
32
|
+
}), {
|
|
33
|
+
headerIds: false,
|
|
34
|
+
mangle: false
|
|
35
|
+
});
|
|
33
36
|
export var LibroLLMRender = function LibroLLMRender(props) {
|
|
34
37
|
var data = props.data;
|
|
35
38
|
var renderMarkdownRef = useRef(null);
|
|
@@ -57,7 +60,8 @@ export var LibroLLMRender = function LibroLLMRender(props) {
|
|
|
57
60
|
(_hljsElement$parentNo = hljsElement.parentNode) === null || _hljsElement$parentNo === void 0 || _hljsElement$parentNo.insertBefore(newElement, hljsElement.nextSibling);
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
|
-
}, [data
|
|
63
|
+
}, [data]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
64
|
+
|
|
61
65
|
return /*#__PURE__*/_jsx("div", {
|
|
62
66
|
className: "libro-llm-output-render",
|
|
63
67
|
ref: renderMarkdownRef,
|
package/es/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAW/C,eAAO,MAAM,qBAAqB,YAwB2B,CAAC"}
|
package/es/module.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { CellOptions, LibroModule, OutputModule } from '@difizen/libro-core';
|
|
2
2
|
import { LibroRenderMimeModule } from '@difizen/libro-rendermime';
|
|
3
3
|
import { ManaModule } from '@difizen/mana-app';
|
|
4
|
+
import { FormatterPromptMagicContribution } from "./libro-formatter-prompt-magic-contribution.js";
|
|
5
|
+
import { LibroPromptCellCommandContribution } from "./prompt-cell-command-contribution.js";
|
|
4
6
|
import { PromptCellContribution } from "./prompt-cell-contribution.js";
|
|
5
7
|
import { LibroPromptCellModel } from "./prompt-cell-model.js";
|
|
6
8
|
import { LibroPromptOutputArea } from "./prompt-cell-output-area.js";
|
|
7
9
|
import { LibroPromptCellModelFactory } from "./prompt-cell-protocol.js";
|
|
8
10
|
import { LibroPromptCellView } from "./prompt-cell-view.js";
|
|
9
11
|
import { LibroPromptOutputMimeTypeContribution } from "./prompt-output-rendermime-contribution.js";
|
|
10
|
-
export var LibroPromptCellModule = ManaModule.create().register(PromptCellContribution, LibroPromptCellView, LibroPromptCellModel, LibroPromptOutputArea, LibroPromptOutputMimeTypeContribution, {
|
|
12
|
+
export var LibroPromptCellModule = ManaModule.create().register(PromptCellContribution, LibroPromptCellView, LibroPromptCellModel, LibroPromptOutputArea, LibroPromptOutputMimeTypeContribution, LibroPromptCellCommandContribution, FormatterPromptMagicContribution, {
|
|
11
13
|
token: LibroPromptCellModelFactory,
|
|
12
14
|
useFactory: function useFactory(ctx) {
|
|
13
15
|
return function (options) {
|
|
@@ -24,7 +24,6 @@ export declare class LibroPromptCellModel extends LibroCellModel implements Exec
|
|
|
24
24
|
get msgChange(): ManaEvent<any>;
|
|
25
25
|
viewManager: ViewManager;
|
|
26
26
|
constructor(options: CellOptions, viewManager: ViewManager);
|
|
27
|
-
fromSource(source: string): void;
|
|
28
27
|
toJSON(): Omit<ICodeCell, 'outputs'>;
|
|
29
28
|
clearExecution(): void;
|
|
30
29
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cell-model.d.ts","sourceRoot":"","sources":["../src/prompt-cell-model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt-cell-model.d.ts","sourceRoot":"","sources":["../src/prompt-cell-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,c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|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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; }
|
|
3
6
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
4
7
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
8
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -17,7 +20,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
17
20
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
18
21
|
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; }
|
|
19
22
|
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.'); }
|
|
20
|
-
import { concatMultilineString } from '@difizen/libro-common';
|
|
21
23
|
import { LibroCellModel } from '@difizen/libro-core';
|
|
22
24
|
import { CellOptions } from '@difizen/libro-core';
|
|
23
25
|
import { Emitter } from '@difizen/mana-app';
|
|
@@ -29,7 +31,7 @@ export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = p
|
|
|
29
31
|
_inherits(LibroPromptCellModel, _LibroCellModel);
|
|
30
32
|
var _super = _createSuper(LibroPromptCellModel);
|
|
31
33
|
function LibroPromptCellModel(options, viewManager) {
|
|
32
|
-
var _options$cell
|
|
34
|
+
var _options$cell;
|
|
33
35
|
var _this;
|
|
34
36
|
_classCallCheck(this, LibroPromptCellModel);
|
|
35
37
|
_this = _super.call(this, options);
|
|
@@ -51,9 +53,11 @@ export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = p
|
|
|
51
53
|
_this.executeCount = options.cell.execution_count || null;
|
|
52
54
|
_this.hasOutputHidden = false;
|
|
53
55
|
_this.hasOutputsScrolled = false;
|
|
54
|
-
_this.
|
|
55
|
-
_this.
|
|
56
|
-
_this.
|
|
56
|
+
_this.libroFormatType = 'formatter-prompt-magic';
|
|
57
|
+
_this.mimeType = 'application/vnd.libro.prompt+json';
|
|
58
|
+
_this.metadata = _objectSpread(_objectSpread({}, options === null || options === void 0 || (_options$cell = options.cell) === null || _options$cell === void 0 ? void 0 : _options$cell.metadata), {}, {
|
|
59
|
+
libroFormatter: _this.libroFormatType
|
|
60
|
+
});
|
|
57
61
|
return _this;
|
|
58
62
|
}
|
|
59
63
|
LibroPromptCellModel = inject(ViewManager)(LibroPromptCellModel, undefined, 1) || LibroPromptCellModel;
|
|
@@ -63,33 +67,13 @@ export var LibroPromptCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = p
|
|
|
63
67
|
get: function get() {
|
|
64
68
|
return this.msgChangeEmitter.event;
|
|
65
69
|
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "fromSource",
|
|
68
|
-
value: function fromSource(source) {
|
|
69
|
-
try {
|
|
70
|
-
var run = source.split('%%prompt \n')[1];
|
|
71
|
-
var runValue = JSON.parse(run);
|
|
72
|
-
this.value = runValue.prompt;
|
|
73
|
-
this.modelType = runValue.model_name;
|
|
74
|
-
} catch (_unused) {
|
|
75
|
-
(function () {
|
|
76
|
-
//
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
70
|
}, {
|
|
81
71
|
key: "toJSON",
|
|
82
72
|
value: function toJSON() {
|
|
83
|
-
// const outputs = this.outputArea?.toJSON() ?? this.outputs;
|
|
84
|
-
var promptObj = {
|
|
85
|
-
model_name: this.modelType || 'CodeGPT',
|
|
86
|
-
prompt: this.value
|
|
87
|
-
};
|
|
88
|
-
var encodeValue = "%%prompt \n".concat(JSON.stringify(promptObj));
|
|
89
73
|
return {
|
|
90
74
|
id: this.id,
|
|
91
75
|
cell_type: this.type,
|
|
92
|
-
source:
|
|
76
|
+
source: this.source,
|
|
93
77
|
metadata: this.metadata,
|
|
94
78
|
execution_count: this.executeCount
|
|
95
79
|
// outputs: this.outputs,
|
package/es/prompt-cell-view.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CodeEditorView } from '@difizen/libro-code-editor';
|
|
1
|
+
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
2
|
+
import type { CodeEditorViewOptions, IRange, CodeEditorView } from '@difizen/libro-code-editor';
|
|
3
3
|
import type { IOutput } from '@difizen/libro-common';
|
|
4
4
|
import type { LibroCell, CellViewOptions } from '@difizen/libro-core';
|
|
5
5
|
import { CellService, LibroExecutableCellView, LibroOutputArea, LibroViewTracker } from '@difizen/libro-core';
|
|
@@ -21,6 +21,7 @@ export declare class LibroPromptCellView extends LibroExecutableCellView {
|
|
|
21
21
|
model: LibroPromptCellModel;
|
|
22
22
|
modelSelection: IModelSelectionItem[];
|
|
23
23
|
viewManager: ViewManager;
|
|
24
|
+
codeEditorManager: CodeEditorManager;
|
|
24
25
|
outputs: IOutput[];
|
|
25
26
|
libroViewTracker: LibroViewTracker;
|
|
26
27
|
editorView?: CodeEditorView;
|
|
@@ -28,12 +29,13 @@ export declare class LibroPromptCellView extends LibroExecutableCellView {
|
|
|
28
29
|
get outputAreaReady(): Promise<LibroOutputArea>;
|
|
29
30
|
protected editorViewReadyDeferred: Deferred<void>;
|
|
30
31
|
get editorReady(): Promise<void>;
|
|
31
|
-
constructor(options: CellViewOptions, cellService: CellService, viewManager: ViewManager, libroViewTracker: LibroViewTracker);
|
|
32
|
+
constructor(options: CellViewOptions, cellService: CellService, viewManager: ViewManager, libroViewTracker: LibroViewTracker, codeEditorManager: CodeEditorManager);
|
|
32
33
|
outputWatch(): void;
|
|
33
34
|
toJSON(): LibroCell;
|
|
34
35
|
onViewMount(): void;
|
|
35
36
|
protected getEditorOption(): CodeEditorViewOptions;
|
|
36
37
|
createEditor(): Promise<void>;
|
|
38
|
+
protected afterEditorReady(): Promise<void>;
|
|
37
39
|
shouldEnterEditorMode(e: React.FocusEvent<HTMLElement>): boolean;
|
|
38
40
|
blur: () => void;
|
|
39
41
|
focus: (toEdit: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cell-view.d.ts","sourceRoot":"","sources":["../src/prompt-cell-view.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"prompt-cell-view.d.ts","sourceRoot":"","sources":["../src/prompt-cell-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EACV,qBAAqB,EACrB,MAAM,EACN,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EAEV,SAAS,EACT,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAQL,WAAW,EAIZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAYD,eAAO,MAAM,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