@promptbook/openai 0.103.0-18 → 0.103.0-20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,15 @@
1
1
  import type { CSSProperties } from 'react';
2
2
  import type { Promisable } from 'type-fest';
3
- import type { string_book } from '../../book-2.0/agent-source/string_book';
4
- import type { string_knowledge_source_content } from '../../types/typeAliases';
3
+ import { type string_book } from '../../book-2.0/agent-source/string_book';
4
+ import type { number_percent, number_positive, string_css_value, string_knowledge_source_content } from '../../types/typeAliases';
5
+ /**
6
+ * Default height of the book editor
7
+ *
8
+ * Note: This height is computed based on the number of lines in the default book + padding multiplied by an estimated line height.
9
+ *
10
+ * @public exported from `@promptbook/components`
11
+ */
12
+ export declare const DEFAULT_BOOK_EDITOR_HEIGHT: number;
5
13
  /**
6
14
  * Props of `BookEditor`
7
15
  *
@@ -20,6 +28,22 @@ export type BookEditorProps = {
20
28
  * Optional CSS style which will be added to root <div/> element
21
29
  */
22
30
  readonly style?: CSSProperties;
31
+ /**
32
+ * Height of the `BookEditor` component
33
+ *
34
+ * - You can use any valid CSS value, e.g., `500px`, `100%`, `50vh`, etc.
35
+ * - If not set, the default height is `DEFAULT_BOOK_EDITOR_HEIGHT`.
36
+ * - If set to `null`, the height should be controlled entirely via `className` or `style`, otherwise the editor will have zero height.
37
+ *
38
+ * @default `DEFAULT_BOOK_EDITOR_HEIGHT`
39
+ */
40
+ readonly height?: string_css_value | null;
41
+ /**
42
+ * Zoom level of the editor
43
+ *
44
+ * @default 1 (100%)
45
+ */
46
+ readonly zoom?: number_percent & number_positive;
23
47
  /**
24
48
  * The book which is being edited.
25
49
  */
@@ -40,11 +64,6 @@ export type BookEditorProps = {
40
64
  * If true, disables border radius making the editor have sharp corners
41
65
  */
42
66
  readonly isBorderRadiusDisabled?: boolean;
43
- /**
44
- * If true, shows the footer with book title and version information.
45
- * By default, the footer is hidden.
46
- */
47
- readonly isFooterShown?: boolean;
48
67
  /**
49
68
  * If true, the editor is in read-only mode
50
69
  *
@@ -323,7 +323,7 @@ export type string_css_property = string;
323
323
  *
324
324
  * For example `13px`
325
325
  */
326
- export type string_css_value = string;
326
+ export type string_css_value = string | number;
327
327
  /**
328
328
  * Semantic helper
329
329
  *
@@ -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-17`).
18
+ * It follows semantic versioning (e.g., `0.103.0-19`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.103.0-18",
3
+ "version": "0.103.0-20",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -102,7 +102,7 @@
102
102
  "module": "./esm/index.es.js",
103
103
  "typings": "./esm/typings/src/_packages/openai.index.d.ts",
104
104
  "peerDependencies": {
105
- "@promptbook/core": "0.103.0-18"
105
+ "@promptbook/core": "0.103.0-20"
106
106
  },
107
107
  "dependencies": {
108
108
  "bottleneck": "^2.19.5",
package/umd/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-18';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-20';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1163,7 +1163,7 @@
1163
1163
  */
1164
1164
  ({
1165
1165
  TITLE: Color.fromHex('#244EA8'),
1166
- LINE: Color.fromHex('#DA0F78'),
1166
+ LINE: Color.fromHex('#eeeeee'),
1167
1167
  COMMITMENT: Color.fromHex('#DA0F78'),
1168
1168
  PARAMETER: Color.fromHex('#8e44ad'),
1169
1169
  });
@@ -1846,10 +1846,13 @@
1846
1846
  * @public exported from `@promptbook/utils`
1847
1847
  */
1848
1848
  function countLines(text) {
1849
+ if (text === '') {
1850
+ return 0;
1851
+ }
1849
1852
  text = text.replace('\r\n', '\n');
1850
1853
  text = text.replace('\r', '\n');
1851
1854
  const lines = text.split('\n');
1852
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
1855
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
1853
1856
  }
1854
1857
  /**
1855
1858
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...