@promptbook/pdf 0.101.0-0 → 0.101.0-2

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.
Files changed (38) hide show
  1. package/esm/index.es.js +24 -5
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +12 -0
  4. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +0 -5
  5. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +8 -2
  6. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +8 -0
  7. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  8. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  9. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  10. package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +9 -0
  11. package/esm/typings/src/book-components/icons/ResetIcon.d.ts +6 -0
  12. package/esm/typings/src/book-components/icons/SendIcon.d.ts +8 -0
  13. package/esm/typings/src/book-components/icons/TemplateIcon.d.ts +8 -0
  14. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  15. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -0
  16. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
  17. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
  18. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
  19. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
  20. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  21. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
  22. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  23. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  24. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  25. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  26. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  27. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  28. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  29. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  30. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  31. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  32. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  33. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  34. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  35. package/esm/typings/src/version.d.ts +1 -1
  36. package/package.json +2 -2
  37. package/umd/index.umd.js +29 -9
  38. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -3,9 +3,6 @@ import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
3
  import { SHA256 } from 'crypto-js';
4
4
  import hexEncoder from 'crypto-js/enc-hex';
5
5
  import { basename, join, dirname, isAbsolute } from 'path';
6
- import parserHtml from 'prettier/parser-html';
7
- import parserMarkdown from 'prettier/parser-markdown';
8
- import { format } from 'prettier/standalone';
9
6
  import { randomBytes } from 'crypto';
10
7
  import { Subject } from 'rxjs';
11
8
  import { forTime } from 'waitasecond';
@@ -27,7 +24,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
27
24
  * @generated
28
25
  * @see https://github.com/webgptorg/promptbook
29
26
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.101.0-0';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-2';
31
28
  /**
32
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -640,6 +637,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
640
637
  /**
641
638
  * Removes diacritic marks (accents) from characters in a string.
642
639
  *
640
+ * Note: [🔂] This function is idempotent.
641
+ *
643
642
  * @param input The string containing diacritics to be normalized.
644
643
  * @returns The string with diacritics removed or normalized.
645
644
  * @public exported from `@promptbook/utils`
@@ -708,6 +707,8 @@ function normalizeToKebabCase(text) {
708
707
  /**
709
708
  * Removes emojis from a string and fix whitespaces
710
709
  *
710
+ * Note: [🔂] This function is idempotent.
711
+ *
711
712
  * @param text with emojis
712
713
  * @returns text without emojis
713
714
  * @public exported from `@promptbook/utils`
@@ -780,6 +781,7 @@ function isValidFilePath(filename) {
780
781
  /**
781
782
  * Tests if given string is valid URL.
782
783
  *
784
+ * Note: [🔂] This function is idempotent.
783
785
  * Note: Dataurl are considered perfectly valid.
784
786
  * Note: There are two similar functions:
785
787
  * - `isValidUrl` which tests any URL
@@ -1052,8 +1054,18 @@ function validatePipelineString(pipelineString) {
1052
1054
  * @private withing the package because of HUGE size of prettier dependency
1053
1055
  */
1054
1056
  function prettifyMarkdown(content) {
1057
+ // In browser/Next.js environments, just return the original content
1058
+ // since prettier parsers are not available and would cause bundling issues
1059
+ if (typeof window !== 'undefined') {
1060
+ return content;
1061
+ }
1055
1062
  try {
1056
- return format(content, {
1063
+ // Use dynamic require to avoid static imports that cause bundling issues
1064
+ // This will only work in Node.js environments
1065
+ const prettierStandalone = eval('require')('prettier/standalone');
1066
+ const parserMarkdown = eval('require')('prettier/parser-markdown');
1067
+ const parserHtml = eval('require')('prettier/parser-html');
1068
+ return prettierStandalone.format(content, {
1057
1069
  parser: 'markdown',
1058
1070
  plugins: [parserMarkdown, parserHtml],
1059
1071
  // TODO: DRY - make some import or auto-copy of .prettierrc
@@ -1081,6 +1093,8 @@ function prettifyMarkdown(content) {
1081
1093
  /**
1082
1094
  * Makes first letter of a string uppercase
1083
1095
  *
1096
+ * Note: [🔂] This function is idempotent.
1097
+ *
1084
1098
  * @public exported from `@promptbook/utils`
1085
1099
  */
1086
1100
  function capitalize(word) {
@@ -1410,6 +1424,7 @@ function checkSerializableAsJson(options) {
1410
1424
  /**
1411
1425
  * Creates a deep clone of the given object
1412
1426
  *
1427
+ * Note: [🔂] This function is idempotent.
1413
1428
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
1414
1429
  *
1415
1430
  * @param objectValue The object to clone.
@@ -3319,6 +3334,8 @@ function $getGlobalScope() {
3319
3334
  /**
3320
3335
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
3321
3336
  *
3337
+ * Note: [🔂] This function is idempotent.
3338
+ *
3322
3339
  * @param text The text string to be converted to SCREAMING_CASE format.
3323
3340
  * @returns The normalized text in SCREAMING_CASE format.
3324
3341
  * @example 'HELLO_WORLD'
@@ -3374,6 +3391,8 @@ function normalizeTo_SCREAMING_CASE(text) {
3374
3391
  /**
3375
3392
  * Normalizes a text string to snake_case format.
3376
3393
  *
3394
+ * Note: [🔂] This function is idempotent.
3395
+ *
3377
3396
  * @param text The text string to be converted to snake_case format.
3378
3397
  * @returns The normalized text in snake_case format.
3379
3398
  * @example 'hello_world'