@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.
- package/README.md +70 -16
- package/esm/index.es.js +4036 -1950
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +18 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +6 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +41 -3
- package/esm/typings/src/book-2.0/agent-source/parseParameters.d.ts +13 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +59 -0
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +45 -0
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +46 -0
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +47 -0
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +62 -0
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +46 -0
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +8 -2
- package/esm/typings/src/book-2.0/commitments/index.d.ts +7 -3
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/MockedChat.d.ts +46 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +3 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +10 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +3 -0
- package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +0 -5
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +28 -2
- package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +8 -0
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
- package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/ResetIcon.d.ts +6 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/TemplateIcon.d.ts +8 -0
- package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +2 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
- package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
- package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
- package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
- package/esm/typings/src/utils/parseNumber.d.ts +1 -0
- package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
- package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
- package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +4 -2
- package/umd/index.umd.js +4418 -2329
- 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
|
-
|
|
51
|
+
Reusable React components for the Promptbook ecosystem, providing a comprehensive set of UI components for building promptbook-powered applications.
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
## π― Purpose and Motivation
|
|
54
54
|
|
|
55
|
-
|
|
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
|
-
##
|
|
57
|
+
## π§ High-Level Functionality
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
This package provides a complete set of React components for promptbook applications:
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
67
|
+
## β¨ Key Features
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
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,
|
|
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**:
|