@promptbook/components 0.101.0-0 β†’ 0.101.0-10

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 (61) hide show
  1. package/README.md +70 -16
  2. package/esm/index.es.js +4036 -1950
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +18 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +6 -0
  7. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
  8. package/esm/typings/src/book-2.0/agent-source/parseParameters.d.ts +13 -0
  9. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +8 -2
  10. package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +59 -0
  11. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +8 -2
  12. package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +45 -0
  13. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
  14. package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +46 -0
  15. package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +47 -0
  16. package/esm/typings/src/book-2.0/commitments/META/META.d.ts +62 -0
  17. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +8 -2
  18. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +8 -2
  19. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +8 -2
  20. package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +46 -0
  21. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +8 -2
  22. package/esm/typings/src/book-2.0/commitments/index.d.ts +7 -3
  23. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +46 -0
  24. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
  25. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +10 -0
  26. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +3 -0
  27. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +0 -5
  28. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +28 -2
  29. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +8 -0
  30. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  31. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  32. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  33. package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +9 -0
  34. package/esm/typings/src/book-components/icons/ResetIcon.d.ts +6 -0
  35. package/esm/typings/src/book-components/icons/SendIcon.d.ts +8 -0
  36. package/esm/typings/src/book-components/icons/TemplateIcon.d.ts +8 -0
  37. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  38. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +2 -0
  39. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
  40. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
  41. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
  42. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
  43. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  44. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
  45. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  46. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  47. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  48. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  49. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  50. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  51. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  52. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  53. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  54. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  55. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  56. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  57. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  58. package/esm/typings/src/version.d.ts +1 -1
  59. package/package.json +4 -2
  60. package/umd/index.umd.js +4418 -2329
  61. package/umd/index.umd.js.map +1 -1
package/README.md CHANGED
@@ -48,29 +48,34 @@ npm i ptbk
48
48
  npm install @promptbook/components
49
49
  ```
50
50
 
51
- # `@promptbook/components`
51
+ Reusable React components for the Promptbook ecosystem, providing a comprehensive set of UI components for building promptbook-powered applications.
52
52
 
53
- Reusable React components for the Promptbook ecosystem.
53
+ ## 🎯 Purpose and Motivation
54
54
 
55
- This first release ships the `<BookEditor />` component β€” a styled, client-side book editor with inline highlighting of Promptbook commitment types (PERSONA, KNOWLEDGE, STYLE, …).
55
+ The components package provides ready-to-use React components that integrate seamlessly with the Promptbook ecosystem. It eliminates the need to build UI components from scratch when creating promptbook-powered applications, offering everything from book editors to chat interfaces and avatar components.
56
56
 
57
- ## Install
57
+ ## πŸ”§ High-Level Functionality
58
58
 
59
- Install this package (and React if you don’t have it yet):
59
+ This package provides a complete set of React components for promptbook applications:
60
60
 
61
- ```bash
62
- npm i @promptbook/components
63
- # peer/runtime dependencies you almost certainly already have in your app:
64
- npm i react react-dom
65
- ```
61
+ - **Book Editor**: Styled editor with syntax highlighting for promptbook commitment types
62
+ - **Chat Components**: Full-featured chat interfaces for LLM interactions
63
+ - **Avatar Components**: Profile and chip components for user representation
64
+ - **Icon Library**: Consistent iconography for promptbook applications
65
+ - **Markdown Rendering**: Utilities for rendering markdown content in chat contexts
66
66
 
67
- TypeScript projects (recommended dev types):
67
+ ## ✨ Key Features
68
68
 
69
- ```bash
70
- npm i -D @types/react @types/react-dom
71
- ```
69
+ - 🎨 **Styled Components** - Pre-styled components that work out of the box
70
+ - πŸ’¬ **Chat Interface** - Complete chat UI with LLM integration support
71
+ - ✏️ **Book Editor** - Syntax-highlighted editor for promptbook files
72
+ - πŸ‘€ **Avatar System** - Flexible avatar components with profile support
73
+ - 🎯 **TypeScript Support** - Full TypeScript definitions for all components
74
+ - πŸ“± **Responsive Design** - Components work across different screen sizes
75
+ - πŸ”§ **Customizable** - Easy to customize with CSS classes and props
76
+ - ⚑ **Performance Optimized** - Efficient rendering and minimal bundle size
72
77
 
73
- ## Usage
78
+ ## Example Usage
74
79
 
75
80
  ### Next.js (App Router)
76
81
 
@@ -125,7 +130,7 @@ interface BookEditorProps {
125
130
  onChange?: (value: string) => void;
126
131
 
127
132
  // Explicit list of commitment keywords to highlight (case-insensitive).
128
- // If omitted, a default set (PERSONA, KNOWLEDGE, STYLE, RULE, RULES, SAMPLE, EXAMPLE, FORMAT, MODEL, ACTION, META IMAGE, META LINK, NOTE, EXPECT, SCENARIO, SCENARIOS, BEHAVIOUR, BEHAVIOURS, AVOID, AVOIDANCE, GOAL, GOALS, CONTEXT) is used.
133
+ // If omitted, a default set (PERSONA, KNOWLEDGE, MEMORY, STYLE, RULE, RULES, SAMPLE, EXAMPLE, FORMAT, MODEL, ACTION, META IMAGE, META LINK, NOTE, GOAL, MESSAGE, SCENARIO, DELETE, CANCEL, DISCARD, REMOVE, EXPECT, SCENARIOS, BEHAVIOUR, BEHAVIOURS, AVOID, AVOIDANCE, GOALS, CONTEXT) is used.
129
134
  commitmentTypes?: string[];
130
135
  }
131
136
  ```
@@ -141,6 +146,55 @@ The component comes with built-in styles. You can pass your own `className` and
141
146
  - Bundles: ESM and UMD
142
147
 
143
148
 
149
+
150
+ ## πŸ“¦ Exported Entities
151
+
152
+ ### Version Information
153
+
154
+ - `BOOK_LANGUAGE_VERSION` - Current book language version
155
+ - `PROMPTBOOK_ENGINE_VERSION` - Current engine version
156
+
157
+ ### Avatar Components
158
+
159
+ - `AvatarChip` - Compact avatar display component
160
+ - `AvatarChipProps` - Props interface for AvatarChip (type)
161
+ - `AvatarChipFromSource` - Avatar chip with source-based loading
162
+ - `AvatarChipFromSourceProps` - Props interface for AvatarChipFromSource (type)
163
+ - `AvatarProfile` - Full avatar profile component
164
+ - `AvatarProfileProps` - Props interface for AvatarProfile (type)
165
+ - `AvatarProfileFromSource` - Avatar profile with source-based loading
166
+ - `AvatarProfileFromSourceProps` - Props interface for AvatarProfileFromSource (type)
167
+
168
+ ### Book Editor Components
169
+
170
+ - `BookEditor` - Main book editor component with syntax highlighting
171
+ - `BookEditorProps` - Props interface for BookEditor (type)
172
+ - `DEFAULT_BOOK_FONT_CLASS` - Default font class for book editor
173
+
174
+ ### Chat Components
175
+
176
+ - `Chat` - Basic chat interface component
177
+ - `ChatProps` - Props interface for Chat component (type)
178
+ - `LlmChat` - Enhanced chat component with LLM integration
179
+ - `LlmChatProps` - Props interface for LlmChat component (type)
180
+
181
+ ### Chat Types and Utilities
182
+
183
+ - `ChatMessage` - Type definition for chat messages (type)
184
+ - `ChatParticipant` - Type definition for chat participants (type)
185
+ - `renderMarkdown` - Utility function for rendering markdown content
186
+ - `isMarkdownContent` - Utility to check if content is markdown
187
+
188
+ ### Icon Components
189
+
190
+ - `ArrowIcon` - Arrow icon component
191
+ - `ResetIcon` - Reset/refresh icon component
192
+ - `SendIcon` - Send message icon component
193
+ - `TemplateIcon` - Template/document icon component
194
+
195
+ > πŸ’‘ This package provides React components for promptbook applications. For the core functionality, see [@promptbook/core](#-packages) or install all packages with `npm i ptbk`
196
+
197
+
144
198
  ---
145
199
 
146
200
  Rest of the documentation is common for **entire promptbook ecosystem**: