@difizen/libro-prompt-cell 0.2.28 → 0.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/prompt-cell-contribution.d.ts +4 -1
- package/es/prompt-cell-contribution.d.ts.map +1 -1
- package/es/prompt-cell-contribution.js +10 -1
- package/es/prompt-cell-view.d.ts.map +1 -1
- package/es/prompt-cell-view.js +2 -1
- package/package.json +7 -7
- package/src/prompt-cell-contribution.ts +15 -2
- package/src/prompt-cell-view.tsx +2 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import type { LanguageSpecRegistry } from '@difizen/libro-code-editor';
|
|
2
|
+
import { LanguageSpecContribution } from '@difizen/libro-code-editor';
|
|
1
3
|
import type { CellModel } from '@difizen/libro-core';
|
|
2
4
|
import type { CellMeta, CellOptions } from '@difizen/libro-core';
|
|
3
5
|
import { CellViewContribution, CellModelContribution } from '@difizen/libro-core';
|
|
4
6
|
import { LibroPromptCellModelFactory } from './prompt-cell-protocol.js';
|
|
5
7
|
import { LibroPromptCellView } from './prompt-cell-view.js';
|
|
6
|
-
export declare class PromptCellContribution implements CellModelContribution, CellViewContribution {
|
|
8
|
+
export declare class PromptCellContribution implements CellModelContribution, CellViewContribution, LanguageSpecContribution {
|
|
7
9
|
libroCellModelFactory: LibroPromptCellModelFactory;
|
|
8
10
|
cellMeta: CellMeta;
|
|
9
11
|
canHandle(options: CellOptions, libroType?: string): number;
|
|
10
12
|
createModel(options: CellOptions): Promise<CellModel>;
|
|
11
13
|
view: typeof LibroPromptCellView;
|
|
14
|
+
registerLanguageSpec: (register: LanguageSpecRegistry) => void;
|
|
12
15
|
}
|
|
13
16
|
//# sourceMappingURL=prompt-cell-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-cell-contribution.d.ts","sourceRoot":"","sources":["../src/prompt-cell-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIlF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,
|
|
1
|
+
{"version":3,"file":"prompt-cell-contribution.d.ts","sourceRoot":"","sources":["../src/prompt-cell-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIlF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAGa,sBACX,YAAW,qBAAqB,EAAE,oBAAoB,EAAE,wBAAwB;IAGhF,qBAAqB,EAAE,2BAA2B,CAAC;IAEnD,QAAQ,EAAE,QAAQ,CAKhB;IAEF,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM;IAIrD,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAK3D,IAAI,6BAAuB;IAE3B,oBAAoB,aAAc,oBAAoB,UAOpD;CACH"}
|
|
@@ -11,13 +11,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
11
11
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
12
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
13
13
|
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
14
|
+
import { LanguageSpecContribution } from '@difizen/libro-code-editor';
|
|
14
15
|
import { CellViewContribution, CellModelContribution } from '@difizen/libro-core';
|
|
15
16
|
import { inject } from '@difizen/mana-app';
|
|
16
17
|
import { singleton } from '@difizen/mana-app';
|
|
17
18
|
import { LibroPromptCellModelFactory } from "./prompt-cell-protocol.js";
|
|
18
19
|
import { LibroPromptCellView } from "./prompt-cell-view.js";
|
|
19
20
|
export var PromptCellContribution = (_dec = singleton({
|
|
20
|
-
contrib: [CellModelContribution, CellViewContribution]
|
|
21
|
+
contrib: [CellModelContribution, CellViewContribution, LanguageSpecContribution]
|
|
21
22
|
}), _dec2 = inject(LibroPromptCellModelFactory), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
22
23
|
function PromptCellContribution() {
|
|
23
24
|
_classCallCheck(this, PromptCellContribution);
|
|
@@ -29,6 +30,14 @@ export var PromptCellContribution = (_dec = singleton({
|
|
|
29
30
|
nbformatType: 'code'
|
|
30
31
|
};
|
|
31
32
|
this.view = LibroPromptCellView;
|
|
33
|
+
this.registerLanguageSpec = function (register) {
|
|
34
|
+
register.registerLanguageSpec({
|
|
35
|
+
name: 'Prompt',
|
|
36
|
+
language: 'prompt',
|
|
37
|
+
mime: 'application/vnd.libro.prompt+json',
|
|
38
|
+
ext: []
|
|
39
|
+
});
|
|
40
|
+
};
|
|
32
41
|
}
|
|
33
42
|
_createClass(PromptCellContribution, [{
|
|
34
43
|
key: "canHandle",
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAGhE,OAAO,KAAK,EAEV,SAAS,EACT,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,gBAAgB,EAEhB,eAAe,EAChB,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,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B,SAAS,CAAC,eAAe,IAAI,qBAAqB;IAa5C,YAAY;cAkBF,gBAAgB;IAUvB,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;IAQtD,IAAI,aAGX;IAEF,SAAS,CAAC,WAAW;IAgBZ,KAAK,WAAY,OAAO,UAS/B;IAEO,cAAc,aAGrB;IAEF,aAAa,QAAO,EAAE,CAEpB;IAEF,qBAAqB,cAAe,MAAM;;;MAKxC;IAEa,GAAG;IA4ElB,KAAK,YACM,cAAc,kBAAkB,CAAC,SAAS,CAAC,oBAClC,cAAc,aAAa,KAAK,GAAG,6CAUrD;IAEF,iBAAiB,gDAmBf;IACF,iBAAiB,gDAef;IAEF,iBAAiB,SAAU,UAAU;;;;MAMnC;IAEF,mBAAmB,aACP,cAAc,aAAa,eACxB,MAAM,KAAK,IAAI,UA6B5B;IAEF,0BAA0B,iBAAkB,MAAM,aAQhD;IACF,qBAAqB,UAAW,MAAM,UAEpC;IACF,wBAAwB,UAAW,MAAM,UAEvC;IACF,kBAAkB,UAAW,MAAM,GAAG,SAAS,UAE7C;CACH"}
|
package/es/prompt-cell-view.js
CHANGED
|
@@ -34,6 +34,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
34
34
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
35
35
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
36
36
|
import { CodeEditorManager } from '@difizen/libro-code-editor';
|
|
37
|
+
import { CellUri } from '@difizen/libro-common';
|
|
37
38
|
import { isOutput } from '@difizen/libro-common';
|
|
38
39
|
import { LibroOutputArea } from '@difizen/libro-core';
|
|
39
40
|
import { CellService, LibroExecutableCellView, LibroViewTracker, EditorStatus, LibroContextKey } from '@difizen/libro-core';
|
|
@@ -522,7 +523,7 @@ export var LibroPromptCellView = (_dec = transient(), _dec2 = view('prompt-edito
|
|
|
522
523
|
key: "getEditorOption",
|
|
523
524
|
value: function getEditorOption() {
|
|
524
525
|
var option = {
|
|
525
|
-
uuid:
|
|
526
|
+
uuid: CellUri.from(this.parent.model.id, this.model.id).toString(),
|
|
526
527
|
editorHostId: this.parent.id + this.id,
|
|
527
528
|
model: this.model,
|
|
528
529
|
config: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-prompt-cell",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-code-editor": "^0.2.
|
|
36
|
-
"@difizen/libro-jupyter": "^0.2.
|
|
37
|
-
"@difizen/libro-rendermime": "^0.2.
|
|
38
|
-
"@difizen/libro-codemirror": "^0.2.
|
|
39
|
-
"@difizen/libro-common": "^0.2.
|
|
40
|
-
"@difizen/libro-core": "^0.2.
|
|
35
|
+
"@difizen/libro-code-editor": "^0.2.30",
|
|
36
|
+
"@difizen/libro-jupyter": "^0.2.30",
|
|
37
|
+
"@difizen/libro-rendermime": "^0.2.30",
|
|
38
|
+
"@difizen/libro-codemirror": "^0.2.30",
|
|
39
|
+
"@difizen/libro-common": "^0.2.30",
|
|
40
|
+
"@difizen/libro-core": "^0.2.30",
|
|
41
41
|
"@ant-design/icons": "^5.1.0",
|
|
42
42
|
"@difizen/mana-l10n": "latest",
|
|
43
43
|
"@difizen/mana-app": "latest",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { LanguageSpecRegistry } from '@difizen/libro-code-editor';
|
|
2
|
+
import { LanguageSpecContribution } from '@difizen/libro-code-editor';
|
|
1
3
|
import type { CellModel } from '@difizen/libro-core';
|
|
2
4
|
import type { CellMeta, CellOptions } from '@difizen/libro-core';
|
|
3
5
|
import { CellViewContribution, CellModelContribution } from '@difizen/libro-core';
|
|
@@ -7,9 +9,11 @@ import { singleton } from '@difizen/mana-app';
|
|
|
7
9
|
import { LibroPromptCellModelFactory } from './prompt-cell-protocol.js';
|
|
8
10
|
import { LibroPromptCellView } from './prompt-cell-view.js';
|
|
9
11
|
|
|
10
|
-
@singleton({
|
|
12
|
+
@singleton({
|
|
13
|
+
contrib: [CellModelContribution, CellViewContribution, LanguageSpecContribution],
|
|
14
|
+
})
|
|
11
15
|
export class PromptCellContribution
|
|
12
|
-
implements CellModelContribution, CellViewContribution
|
|
16
|
+
implements CellModelContribution, CellViewContribution, LanguageSpecContribution
|
|
13
17
|
{
|
|
14
18
|
@inject(LibroPromptCellModelFactory)
|
|
15
19
|
libroCellModelFactory: LibroPromptCellModelFactory;
|
|
@@ -31,4 +35,13 @@ export class PromptCellContribution
|
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
view = LibroPromptCellView;
|
|
38
|
+
|
|
39
|
+
registerLanguageSpec = (register: LanguageSpecRegistry) => {
|
|
40
|
+
register.registerLanguageSpec({
|
|
41
|
+
name: 'Prompt',
|
|
42
|
+
language: 'prompt',
|
|
43
|
+
mime: 'application/vnd.libro.prompt+json',
|
|
44
|
+
ext: [],
|
|
45
|
+
});
|
|
46
|
+
};
|
|
34
47
|
}
|
package/src/prompt-cell-view.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
CodeEditorView,
|
|
6
6
|
} from '@difizen/libro-code-editor';
|
|
7
7
|
import type { ICodeCell, IOutput } from '@difizen/libro-common';
|
|
8
|
+
import { CellUri } from '@difizen/libro-common';
|
|
8
9
|
import { isOutput } from '@difizen/libro-common';
|
|
9
10
|
import type {
|
|
10
11
|
IOutputAreaOption,
|
|
@@ -351,7 +352,7 @@ export class LibroPromptCellView extends LibroExecutableCellView {
|
|
|
351
352
|
|
|
352
353
|
protected getEditorOption(): CodeEditorViewOptions {
|
|
353
354
|
const option: CodeEditorViewOptions = {
|
|
354
|
-
uuid:
|
|
355
|
+
uuid: CellUri.from(this.parent.model.id, this.model.id).toString(),
|
|
355
356
|
editorHostId: this.parent.id + this.id,
|
|
356
357
|
model: this.model,
|
|
357
358
|
config: {
|