@promptbook/remote-client 0.103.0-15 → 0.103.0-17
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/esm/index.es.js +43 -14
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/padBookContent.d.ts +10 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +29 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +2 -0
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
- package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +2 -2
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
- package/esm/typings/src/config.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +43 -14
- package/umd/index.umd.js.map +1 -1
|
@@ -51,11 +51,40 @@ export type BookEditorProps = {
|
|
|
51
51
|
* @default false
|
|
52
52
|
*/
|
|
53
53
|
readonly isReadonly?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Optional translations for the component
|
|
56
|
+
*/
|
|
57
|
+
readonly translations?: {
|
|
58
|
+
/**
|
|
59
|
+
* Message to show when trying to edit a readonly editor
|
|
60
|
+
*
|
|
61
|
+
* @default "You cannot edit this book"
|
|
62
|
+
*/
|
|
63
|
+
readonly readonlyMessage?: string;
|
|
64
|
+
};
|
|
54
65
|
/**
|
|
55
66
|
* If true, shows the download button in the action bar.
|
|
56
67
|
* By default, the download button is shown.
|
|
57
68
|
*/
|
|
58
69
|
readonly isDownloadButtonShown?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* If true, shows the about button in the action bar.
|
|
72
|
+
* By default, the about button is shown.
|
|
73
|
+
*/
|
|
74
|
+
readonly isAboutButtonShown?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* If defined, the editor will be synced with other editors with the same sync configuration.
|
|
77
|
+
*/
|
|
78
|
+
readonly sync?: {
|
|
79
|
+
/**
|
|
80
|
+
* The URL of the y-websocket server.
|
|
81
|
+
*/
|
|
82
|
+
readonly serverUrl: string;
|
|
83
|
+
/**
|
|
84
|
+
* The name of the room to join.
|
|
85
|
+
*/
|
|
86
|
+
readonly roomName: string;
|
|
87
|
+
};
|
|
59
88
|
};
|
|
60
89
|
/**
|
|
61
90
|
* Renders a book editor
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
type DropdownProps = {
|
|
3
|
+
actions: Array<{
|
|
4
|
+
icon: JSX.Element;
|
|
5
|
+
name: string;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @@@
|
|
11
|
+
*
|
|
12
|
+
* @private internal subcomponent used by various components
|
|
13
|
+
*/
|
|
14
|
+
export declare function Dropdown({ actions }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
|
-
* @private internal subcomponent
|
|
4
|
+
* @private internal subcomponent used by various components
|
|
5
5
|
*/
|
|
6
6
|
export declare function Modal({ children, onClose, className, }: {
|
|
7
7
|
children: ReactNode;
|
|
@@ -9,5 +9,5 @@ export declare function Modal({ children, onClose, className, }: {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
}): import("react").ReactPortal;
|
|
11
11
|
/**
|
|
12
|
-
* TODO: !!!! Use this also for feedback modal in Chat component -Make modals DRY
|
|
12
|
+
* TODO: !!!! Use this also for feedback modal in Chat component - Make modals DRY
|
|
13
13
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @@@
|
|
4
|
+
*
|
|
5
|
+
* @private internal subcomponent used by various components
|
|
6
|
+
*/
|
|
7
|
+
export declare function MenuIcon(props: SVGProps<SVGSVGElement> & {
|
|
8
|
+
size?: number;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: !!! Mark all components to not be used outside of browser
|
|
12
|
+
*/
|
|
@@ -53,6 +53,7 @@ export declare const PROMPTBOOK_COLOR: import("./utils/take/interfaces/ITakeChai
|
|
|
53
53
|
*/
|
|
54
54
|
export declare const PROMPTBOOK_SYNTAX_COLORS: {
|
|
55
55
|
readonly TITLE: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
56
|
+
readonly LINE: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
56
57
|
readonly COMMITMENT: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
57
58
|
readonly PARAMETER: import("./utils/take/interfaces/ITakeChain").WithTake<Color>;
|
|
58
59
|
};
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.103.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.103.0-16`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/remote-client",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-17",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"module": "./esm/index.es.js",
|
|
101
101
|
"typings": "./esm/typings/src/_packages/remote-client.index.d.ts",
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@promptbook/core": "0.103.0-
|
|
103
|
+
"@promptbook/core": "0.103.0-17"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-17';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1056,17 +1056,6 @@
|
|
|
1056
1056
|
* TODO: Maybe implement by mix+hsl
|
|
1057
1057
|
*/
|
|
1058
1058
|
|
|
1059
|
-
/**
|
|
1060
|
-
* Makes color transformer which darker the given color
|
|
1061
|
-
*
|
|
1062
|
-
* @param amount from 0 to 1
|
|
1063
|
-
*
|
|
1064
|
-
* @public exported from `@promptbook/color`
|
|
1065
|
-
*/
|
|
1066
|
-
function darken(amount) {
|
|
1067
|
-
return lighten(-amount);
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
1059
|
/**
|
|
1071
1060
|
* Calculates distance between two colors
|
|
1072
1061
|
*
|
|
@@ -1241,7 +1230,8 @@
|
|
|
1241
1230
|
* @public exported from `@promptbook/core`
|
|
1242
1231
|
*/
|
|
1243
1232
|
({
|
|
1244
|
-
TITLE:
|
|
1233
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
1234
|
+
LINE: Color.fromHex('#DA0F78'),
|
|
1245
1235
|
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
1246
1236
|
PARAMETER: Color.fromHex('#8e44ad'),
|
|
1247
1237
|
});
|
|
@@ -5589,6 +5579,44 @@
|
|
|
5589
5579
|
const SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
5590
5580
|
// <- TODO: [🏥] DRY
|
|
5591
5581
|
|
|
5582
|
+
/**
|
|
5583
|
+
* @private constant for `padBookContent`
|
|
5584
|
+
*/
|
|
5585
|
+
const PADDING_LINES = 5;
|
|
5586
|
+
/**
|
|
5587
|
+
* A function that adds padding to the book content
|
|
5588
|
+
*
|
|
5589
|
+
* @private utility function
|
|
5590
|
+
*/
|
|
5591
|
+
function padBookContent(content) {
|
|
5592
|
+
if (!content) {
|
|
5593
|
+
return '\n'.repeat(PADDING_LINES);
|
|
5594
|
+
}
|
|
5595
|
+
const lines = content.split('\n');
|
|
5596
|
+
let trailingEmptyLines = 0;
|
|
5597
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
5598
|
+
const line = lines[i];
|
|
5599
|
+
if (line === undefined) {
|
|
5600
|
+
// Note: This should not happen in reality, but it's here to satisfy TypeScript's noUncheckedIndexedAccess option
|
|
5601
|
+
continue;
|
|
5602
|
+
}
|
|
5603
|
+
if (line.trim() === '') {
|
|
5604
|
+
trailingEmptyLines++;
|
|
5605
|
+
}
|
|
5606
|
+
else {
|
|
5607
|
+
break;
|
|
5608
|
+
}
|
|
5609
|
+
}
|
|
5610
|
+
if (trailingEmptyLines >= PADDING_LINES) {
|
|
5611
|
+
return content;
|
|
5612
|
+
}
|
|
5613
|
+
const linesToAdd = PADDING_LINES - trailingEmptyLines;
|
|
5614
|
+
return (content + '\n'.repeat(linesToAdd));
|
|
5615
|
+
}
|
|
5616
|
+
/**
|
|
5617
|
+
* TODO: [🧠] Maybe export
|
|
5618
|
+
*/
|
|
5619
|
+
|
|
5592
5620
|
/**
|
|
5593
5621
|
* Removes Markdown (or HTML) comments
|
|
5594
5622
|
*
|
|
@@ -5634,6 +5662,7 @@
|
|
|
5634
5662
|
if (!isFlatPipeline(pipelineString)) {
|
|
5635
5663
|
return pipelineString;
|
|
5636
5664
|
}
|
|
5665
|
+
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
5637
5666
|
const pipelineStringLines = pipelineString.split('\n');
|
|
5638
5667
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
5639
5668
|
let returnStatement;
|
|
@@ -5668,7 +5697,7 @@
|
|
|
5668
5697
|
${returnStatement}
|
|
5669
5698
|
`));
|
|
5670
5699
|
// <- TODO: Maybe use book` notation
|
|
5671
|
-
return pipelineString;
|
|
5700
|
+
return padBookContent(pipelineString);
|
|
5672
5701
|
}
|
|
5673
5702
|
/**
|
|
5674
5703
|
* TODO: Unit test
|