@promptbook/templates 0.100.0-47 → 0.100.0-49

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 (45) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +10 -278
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/color.index.d.ts +50 -0
  5. package/esm/typings/src/_packages/components.index.d.ts +6 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  7. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +4 -2
  8. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.d.ts +108 -0
  9. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.test.d.ts +1 -0
  10. package/esm/typings/src/book-components/Chat/interfaces/ChatParticipant.d.ts +3 -1
  11. package/esm/typings/src/utils/color/$randomColor.d.ts +11 -0
  12. package/esm/typings/src/utils/color/Color.d.ts +180 -0
  13. package/esm/typings/src/utils/color/css-colors.d.ts +159 -0
  14. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +14 -0
  15. package/esm/typings/src/utils/color/internal-utils/hslToRgb.d.ts +17 -0
  16. package/esm/typings/src/utils/color/internal-utils/rgbToHsl.d.ts +17 -0
  17. package/esm/typings/src/utils/color/operators/ColorTransformer.d.ts +5 -0
  18. package/esm/typings/src/utils/color/operators/darken.d.ts +9 -0
  19. package/esm/typings/src/utils/color/operators/furthest.d.ts +16 -0
  20. package/esm/typings/src/utils/color/operators/grayscale.d.ts +9 -0
  21. package/esm/typings/src/utils/color/operators/lighten.d.ts +12 -0
  22. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +11 -0
  23. package/esm/typings/src/utils/color/operators/nearest.d.ts +10 -0
  24. package/esm/typings/src/utils/color/operators/negative.d.ts +7 -0
  25. package/esm/typings/src/utils/color/operators/negativeLightness.d.ts +7 -0
  26. package/esm/typings/src/utils/color/operators/withAlpha.d.ts +9 -0
  27. package/esm/typings/src/utils/color/utils/areColorsEqual.d.ts +14 -0
  28. package/esm/typings/src/utils/color/utils/colorDistance.d.ts +21 -0
  29. package/esm/typings/src/utils/color/utils/colorHue.d.ts +11 -0
  30. package/esm/typings/src/utils/color/utils/colorHueDistance.d.ts +11 -0
  31. package/esm/typings/src/utils/color/utils/colorHueDistance.test.d.ts +1 -0
  32. package/esm/typings/src/utils/color/utils/colorLuminance.d.ts +9 -0
  33. package/esm/typings/src/utils/color/utils/colorSatulightion.d.ts +7 -0
  34. package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +9 -0
  35. package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +10 -0
  36. package/esm/typings/src/utils/color/utils/mixColors.d.ts +11 -0
  37. package/esm/typings/src/utils/take/classes/TakeChain.d.ts +11 -0
  38. package/esm/typings/src/utils/take/interfaces/ITakeChain.d.ts +12 -0
  39. package/esm/typings/src/utils/take/interfaces/Takeable.d.ts +7 -0
  40. package/esm/typings/src/utils/take/take.d.ts +12 -0
  41. package/esm/typings/src/utils/take/take.test.d.ts +1 -0
  42. package/esm/typings/src/version.d.ts +1 -1
  43. package/package.json +2 -2
  44. package/umd/index.umd.js +10 -278
  45. package/umd/index.umd.js.map +1 -1
@@ -0,0 +1,50 @@
1
+ import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version';
2
+ import { $randomColor } from '../utils/color/$randomColor';
3
+ import { Color } from '../utils/color/Color';
4
+ import { CSS_COLORS } from '../utils/color/css-colors';
5
+ import type { ColorTransformer } from '../utils/color/operators/ColorTransformer';
6
+ import { darken } from '../utils/color/operators/darken';
7
+ import { furthest } from '../utils/color/operators/furthest';
8
+ import { textColor } from '../utils/color/operators/furthest';
9
+ import { grayscale } from '../utils/color/operators/grayscale';
10
+ import { lighten } from '../utils/color/operators/lighten';
11
+ import { mixWithColor } from '../utils/color/operators/mixWithColor';
12
+ import { nearest } from '../utils/color/operators/nearest';
13
+ import { negative } from '../utils/color/operators/negative';
14
+ import { negativeLightness } from '../utils/color/operators/negativeLightness';
15
+ import { withAlpha } from '../utils/color/operators/withAlpha';
16
+ import { areColorsEqual } from '../utils/color/utils/areColorsEqual';
17
+ import { colorDistance } from '../utils/color/utils/colorDistance';
18
+ import { colorDistanceSquared } from '../utils/color/utils/colorDistance';
19
+ import { colorHue } from '../utils/color/utils/colorHue';
20
+ import { colorHueDistance } from '../utils/color/utils/colorHueDistance';
21
+ import { colorLuminance } from '../utils/color/utils/colorLuminance';
22
+ import { colorSatulightion } from '../utils/color/utils/colorSatulightion';
23
+ import { colorSaturation } from '../utils/color/utils/colorSaturation';
24
+ import { colorToDataUrl } from '../utils/color/utils/colorToDataUrl';
25
+ import { mixColors } from '../utils/color/utils/mixColors';
26
+ export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
27
+ export { $randomColor };
28
+ export { Color };
29
+ export { CSS_COLORS };
30
+ export type { ColorTransformer };
31
+ export { darken };
32
+ export { furthest };
33
+ export { textColor };
34
+ export { grayscale };
35
+ export { lighten };
36
+ export { mixWithColor };
37
+ export { nearest };
38
+ export { negative };
39
+ export { negativeLightness };
40
+ export { withAlpha };
41
+ export { areColorsEqual };
42
+ export { colorDistance };
43
+ export { colorDistanceSquared };
44
+ export { colorHue };
45
+ export { colorHueDistance };
46
+ export { colorLuminance };
47
+ export { colorSatulightion };
48
+ export { colorSaturation };
49
+ export { colorToDataUrl };
50
+ export { mixColors };
@@ -10,9 +10,12 @@ import { AvatarProfileFromSource } from '../book-components/AvatarProfile/Avatar
10
10
  import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
11
11
  import { BookEditor } from '../book-components/BookEditor/BookEditor';
12
12
  import { DEFAULT_BOOK_FONT_CLASS } from '../book-components/BookEditor/config';
13
+ import type { ChatProps } from '../book-components/Chat/Chat/Chat';
13
14
  import { Chat } from '../book-components/Chat/Chat/Chat';
14
15
  import type { ChatMessage } from '../book-components/Chat/interfaces/ChatMessage';
15
16
  import type { ChatParticipant } from '../book-components/Chat/interfaces/ChatParticipant';
17
+ import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChat';
18
+ import { LlmChat } from '../book-components/Chat/LlmChat/LlmChat';
16
19
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
17
20
  export type { AvatarChipProps };
18
21
  export { AvatarChip };
@@ -25,6 +28,9 @@ export { AvatarProfileFromSource };
25
28
  export type { BookEditorProps };
26
29
  export { BookEditor };
27
30
  export { DEFAULT_BOOK_FONT_CLASS };
31
+ export type { ChatProps };
28
32
  export { Chat };
29
33
  export type { ChatMessage };
30
34
  export type { ChatParticipant };
35
+ export type { LlmChatProps };
36
+ export { LlmChat };
@@ -16,8 +16,10 @@ import type { AvatarChipFromSourceProps } from '../book-components/AvatarProfile
16
16
  import type { AvatarProfileProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfile';
17
17
  import type { AvatarProfileFromSourceProps } from '../book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource';
18
18
  import type { BookEditorProps } from '../book-components/BookEditor/BookEditor';
19
+ import type { ChatProps } from '../book-components/Chat/Chat/Chat';
19
20
  import type { ChatMessage } from '../book-components/Chat/interfaces/ChatMessage';
20
21
  import type { ChatParticipant } from '../book-components/Chat/interfaces/ChatParticipant';
22
+ import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChat';
21
23
  import type { PipelineCollection } from '../collection/PipelineCollection';
22
24
  import type { Command } from '../commands/_common/types/Command';
23
25
  import type { CommandParser } from '../commands/_common/types/CommandParser';
@@ -303,6 +305,7 @@ import type { number_gigabytes } from '../types/typeAliases';
303
305
  import type { number_terabytes } from '../types/typeAliases';
304
306
  import type { Registered } from '../utils/$Register';
305
307
  import type { Registration } from '../utils/$Register';
308
+ import type { ColorTransformer } from '../utils/color/operators/ColorTransformer';
306
309
  import type { PipelineEditableSerialized } from '../utils/editable/types/PipelineEditableSerialized';
307
310
  import type { ExecCommandOptions } from '../utils/execCommand/ExecCommandOptions';
308
311
  import type { ExecCommandOptionsAdvanced } from '../utils/execCommand/ExecCommandOptions';
@@ -322,6 +325,7 @@ import type { really_any } from '../utils/organization/really_any';
322
325
  import type { TODO_any } from '../utils/organization/TODO_any';
323
326
  import type { CheckSerializableAsJsonOptions } from '../utils/serialization/checkSerializableAsJson';
324
327
  import type { ExportJsonOptions } from '../utils/serialization/exportJson';
328
+ import type { ITakeChain } from '../utils/take/interfaces/ITakeChain';
325
329
  import type { string_promptbook_version } from '../version';
326
330
  export type { AgentBasicInformation };
327
331
  export type { string_book };
@@ -341,8 +345,10 @@ export type { AvatarChipFromSourceProps };
341
345
  export type { AvatarProfileProps };
342
346
  export type { AvatarProfileFromSourceProps };
343
347
  export type { BookEditorProps };
348
+ export type { ChatProps };
344
349
  export type { ChatMessage };
345
350
  export type { ChatParticipant };
351
+ export type { LlmChatProps };
346
352
  export type { PipelineCollection };
347
353
  export type { Command };
348
354
  export type { CommandParser };
@@ -628,6 +634,7 @@ export type { number_gigabytes };
628
634
  export type { number_terabytes };
629
635
  export type { Registered };
630
636
  export type { Registration };
637
+ export type { ColorTransformer };
631
638
  export type { PipelineEditableSerialized };
632
639
  export type { ExecCommandOptions };
633
640
  export type { ExecCommandOptionsAdvanced };
@@ -647,4 +654,5 @@ export type { really_any };
647
654
  export type { TODO_any };
648
655
  export type { CheckSerializableAsJsonOptions };
649
656
  export type { ExportJsonOptions };
657
+ export type { ITakeChain };
650
658
  export type { string_promptbook_version };
@@ -7,7 +7,10 @@ import type { ChatParticipant } from '../interfaces/ChatParticipant';
7
7
  * @private util of `<Chat />`
8
8
  */
9
9
  export declare const LOADING_INTERACTIVE_IMAGE = "Loading...";
10
- interface ChatProps {
10
+ /**
11
+ * @public exported from `@promptbook/components`
12
+ */
13
+ export interface ChatProps {
11
14
  /**
12
15
  * Optional callback to create a new agent from the template.
13
16
  * If provided, renders the [Use this template] button.
@@ -125,4 +128,3 @@ interface ChatProps {
125
128
  * @public exported from `@promptbook/components`
126
129
  */
127
130
  export declare function Chat(props: ChatProps): import("react/jsx-runtime").JSX.Element;
128
- export {};
@@ -0,0 +1,108 @@
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+ import type { Promisable } from 'type-fest';
3
+ import type { LlmExecutionTools } from '../../../execution/LlmExecutionTools';
4
+ import type { ChatMessage } from '../interfaces/ChatMessage';
5
+ import type { ChatParticipant } from '../interfaces/ChatParticipant';
6
+ /**
7
+ * Props for LlmChat component, derived from ChatProps but with LLM-specific modifications
8
+ *
9
+ * @public exported from `@promptbook/components`
10
+ */
11
+ export interface LlmChatProps {
12
+ /**
13
+ * LLM execution tools for chatting with the model
14
+ */
15
+ readonly llmTools: LlmExecutionTools;
16
+ /**
17
+ * Called when the chat state changes (messages, participants, etc.)
18
+ */
19
+ onChange?(messages: ReadonlyArray<ChatMessage>, participants: ReadonlyArray<ChatParticipant>): void;
20
+ /**
21
+ * Optional callback, when set, button for resetting chat will be shown
22
+ */
23
+ onReset?(): Promisable<void>;
24
+ /**
25
+ * Determines whether the voice recognition button is rendered
26
+ */
27
+ readonly isVoiceRecognitionButtonShown?: boolean;
28
+ /**
29
+ * The language code to use for voice recognition
30
+ */
31
+ readonly voiceLanguage?: string;
32
+ /**
33
+ * Optional placeholder message for the textarea
34
+ *
35
+ * @default "Write a message"
36
+ */
37
+ readonly placeholderMessageContent?: string;
38
+ /**
39
+ * Optional preset message in chat
40
+ */
41
+ readonly defaultMessage?: string;
42
+ /**
43
+ * Content to be shown inside the chat bar in head
44
+ * If not provided, the chat bar will not be rendered
45
+ */
46
+ readonly children?: ReactNode;
47
+ /**
48
+ * Optional CSS class name which will be added to root <div/> element
49
+ */
50
+ readonly className?: string;
51
+ /**
52
+ * Optional CSS style which will be added to root <div/> element
53
+ */
54
+ readonly style?: CSSProperties;
55
+ /**
56
+ * Voice call props - when provided, voice call button will be shown
57
+ */
58
+ readonly voiceCallProps?: {
59
+ selectedModel: string;
60
+ providerClients: Map<string, unknown>;
61
+ currentPersonaContent?: string;
62
+ onVoiceMessage?: (content: string, isVoiceCall: boolean) => void;
63
+ onAssistantVoiceResponse?: (content: string, isVoiceCall: boolean) => void;
64
+ onVoiceCallStateChange?: (isVoiceCalling: boolean) => void;
65
+ };
66
+ /**
67
+ * Indicates whether a voice call is currently active
68
+ */
69
+ readonly isVoiceCalling?: boolean;
70
+ /**
71
+ * Whether experimental features are enabled (required for voice calling)
72
+ */
73
+ readonly isExperimental?: boolean;
74
+ /**
75
+ * Whether the save button is enabled and shown
76
+ */
77
+ readonly isSaveButtonEnabled?: boolean;
78
+ /**
79
+ * Optional markdown header to include at the top of exported files.
80
+ * Example: "## Discussion Topic\n\nSome topic here"
81
+ */
82
+ readonly exportHeaderMarkdown?: string;
83
+ /**
84
+ * Optional callback to create a new agent from the template.
85
+ * If provided, renders the [Use this template] button.
86
+ */
87
+ onUseTemplate?(): void;
88
+ }
89
+ /**
90
+ * LlmChat component that provides chat functionality with LLM integration
91
+ *
92
+ * This component internally manages messages, participants, and task progress,
93
+ * and uses the provided LLM tools to generate responses via callChatModel.
94
+ *
95
+ * Note: There are multiple chat components:
96
+ * - <Chat/> renders chat as it is without any logic
97
+ * - <SimpleChat/> with callback function after each message 🔵->🟢->🔵->🟢->🔵->🟢->...
98
+ * - <WorkerChat/> with continuously running worker function on background which binds on dialogues queue 🔵->🟢->🔵->🟢->🔵->🟢->...
99
+ * - <SignalChat/> fully controlled by signal that is passed in 🔵->🟢->🟢->🟢->🔵->🟢->...
100
+ * - <LlmChat/> connected to LLM Execution Tools of Promptbook
101
+ * - <AgentChat/> direct OpenAI API integration with streaming responses and model selection
102
+ * - <ChatbotMiniapp/> Fully working chatbot miniapp created from book
103
+ * - <AssistantChatPage/> page for assistant chat with welcome message and avatar
104
+ * - <ModelAwareChat/> wrapper around <Chat/> that provides model-aware avatars
105
+ *
106
+ * @public exported from `@promptbook/components`
107
+ */
108
+ export declare function LlmChat(props: LlmChatProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,8 @@
1
+ import type { string_color } from '../../../types/typeAliases';
1
2
  import type { string_name } from '../../../types/typeAliases';
2
3
  import type { string_person_fullname } from '../../../types/typeAliases';
3
4
  import type { string_url_image } from '../../../types/typeAliases';
5
+ import { Color } from '../../../utils/color/Color';
4
6
  /**
5
7
  * A participant in the chat
6
8
  *
@@ -26,5 +28,5 @@ export type ChatParticipant = {
26
28
  /**
27
29
  * Color associated with the participant
28
30
  */
29
- color: string;
31
+ color: string_color | Color;
30
32
  };
@@ -0,0 +1,11 @@
1
+ import { Color } from './Color';
2
+ /**
3
+ * Creates a random color
4
+ *
5
+ * @public exported from `@promptbook/color`
6
+ */
7
+ export declare function $randomColor(): Color;
8
+ /**
9
+ * TODO: !! Use Internally Color.fromValues
10
+ * TODO: !! randomColorWithAlpha
11
+ */
@@ -0,0 +1,180 @@
1
+ import type { string_color } from '../../types/typeAliases';
2
+ import type { string_url_image } from '../../types/typeAliases';
3
+ import type { WithTake } from '../take/interfaces/ITakeChain';
4
+ import { CSS_COLORS } from './css-colors';
5
+ /**
6
+ * Color object represents an RGB color with alpha channel
7
+ *
8
+ * Note: There is no fromObject/toObject because the most logical way to serialize color is as a hex string (#009edd)
9
+ *
10
+ * @public exported from `@promptbook/color`
11
+ */
12
+ export declare class Color {
13
+ readonly red: number;
14
+ readonly green: number;
15
+ readonly blue: number;
16
+ readonly alpha: number;
17
+ /**
18
+ * Creates a new Color instance from miscellaneous formats
19
+ * - It can receive Color instance and just return the same instance
20
+ * - It can receive color in string format for example `#009edd`, `rgb(0,158,221)`, `rgb(0%,62%,86.7%)`, `hsl(197.1,100%,43.3%)`
21
+ *
22
+ * Note: This is not including fromImage because detecting color from an image is heavy task which requires async stuff and we cannot safely determine with overloading if return value will be a promise
23
+ *
24
+ * @param color
25
+ * @returns Color object
26
+ */
27
+ static from(color: string_color | Color): WithTake<Color>;
28
+ /**
29
+ * Creates a new Color instance from miscellaneous string formats
30
+ *
31
+ * @param color as a string for example `#009edd`, `rgb(0,158,221)`, `rgb(0%,62%,86.7%)`, `hsl(197.1,100%,43.3%)`, `red`, `darkgrey`,...
32
+ * @returns Color object
33
+ */
34
+ static fromString(color: string_color): WithTake<Color>;
35
+ /**
36
+ * Gets common color
37
+ *
38
+ * @param key as a css string like `midnightblue`
39
+ * @returns Color object
40
+ */
41
+ static get(key: keyof typeof CSS_COLORS): WithTake<Color>;
42
+ /**
43
+ * Creates a new Color instance from average color of given image
44
+ *
45
+ * @param image as a source for example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdjYJh39z8ABJgCe/ZvAS4AAAAASUVORK5CYII=`
46
+ * @returns Color object
47
+ */
48
+ static fromImage(image: string_url_image): Promise<Color>;
49
+ /**
50
+ * Creates a new Color instance from color in hex format
51
+ *
52
+ * @param color in hex for example `#009edd`, `009edd`, `#555`,...
53
+ * @returns Color object
54
+ */
55
+ static fromHex(hex: string_color): WithTake<Color>;
56
+ /**
57
+ * Creates a new Color instance from color in hex format with 3 color digits (without alpha channel)
58
+ *
59
+ * @param color in hex for example `09d`
60
+ * @returns Color object
61
+ */
62
+ private static fromHex3;
63
+ /**
64
+ * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
65
+ *
66
+ * @param color in hex for example `009edd`
67
+ * @returns Color object
68
+ */
69
+ private static fromHex6;
70
+ /**
71
+ * Creates a new Color instance from color in hex format with 8 color digits (with alpha channel)
72
+ *
73
+ * @param color in hex for example `009edd`
74
+ * @returns Color object
75
+ */
76
+ private static fromHex8;
77
+ /**
78
+ * Creates a new Color instance from color in hsl format
79
+ *
80
+ * @param color as a hsl for example `hsl(197.1,100%,43.3%)`
81
+ * @returns Color object
82
+ */
83
+ static fromHsl(hsl: string_color): WithTake<Color>;
84
+ /**
85
+ * Creates a new Color instance from color in rgb format
86
+ *
87
+ * @param color as a rgb for example `rgb(0,158,221)`, `rgb(0%,62%,86.7%)`
88
+ * @returns Color object
89
+ */
90
+ static fromRgbString(rgb: string_color): WithTake<Color>;
91
+ /**
92
+ * Creates a new Color instance from color in rbga format
93
+ *
94
+ * @param color as a rgba for example `rgba(0,158,221,0.5)`, `rgb(0%,62%,86.7%,50%)`
95
+ * @returns Color object
96
+ */
97
+ static fromRgbaString(rgba: string_color): WithTake<Color>;
98
+ /**
99
+ * Creates a new Color for color channels values
100
+ *
101
+ * @param red number from 0 to 255
102
+ * @param green number from 0 to 255
103
+ * @param blue number from 0 to 255
104
+ * @param alpha number from 0 (transparent) to 255 (opaque = default)
105
+ * @returns Color object
106
+ */
107
+ static fromValues(red: number, green: number, blue: number, alpha?: number): WithTake<Color>;
108
+ /**
109
+ * Checks if the given value is a valid Color object.
110
+ *
111
+ * @param {unknown} value - The value to check.
112
+ * @return {value is WithTake<Color>} Returns true if the value is a valid Color object, false otherwise.
113
+ */
114
+ static isColor(value: unknown): value is WithTake<Color>;
115
+ /**
116
+ * Creates new Color object
117
+ *
118
+ * Note: Consider using one of static methods like `from` or `fromString`
119
+ *
120
+ * @param red number from 0 to 255
121
+ * @param green number from 0 to 255
122
+ * @param blue number from 0 to 255
123
+ * @param alpha number from 0 (transparent) to 255 (opaque)
124
+ */
125
+ private constructor();
126
+ /**
127
+ * Shortcut for `red` property
128
+ * Number from 0 to 255
129
+ * @alias red
130
+ */
131
+ get r(): number;
132
+ /**
133
+ * Shortcut for `green` property
134
+ * Number from 0 to 255
135
+ * @alias green
136
+ */
137
+ get g(): number;
138
+ /**
139
+ * Shortcut for `blue` property
140
+ * Number from 0 to 255
141
+ * @alias blue
142
+ */
143
+ get b(): number;
144
+ /**
145
+ * Shortcut for `alpha` property
146
+ * Number from 0 (transparent) to 255 (opaque)
147
+ * @alias alpha
148
+ */
149
+ get a(): number;
150
+ /**
151
+ * Shortcut for `alpha` property
152
+ * Number from 0 (transparent) to 255 (opaque)
153
+ * @alias alpha
154
+ */
155
+ get opacity(): number;
156
+ /**
157
+ * Shortcut for 1-`alpha` property
158
+ */
159
+ get transparency(): number;
160
+ clone(): WithTake<Color>;
161
+ toString(): string_color;
162
+ toHex(): string_color;
163
+ toRgb(): string_color;
164
+ toHsl(): string_color;
165
+ }
166
+ /**
167
+ * TODO: For each method a corresponding static method should be created
168
+ * Like clone can be done by color.clone() OR Color.clone(color)
169
+ * TODO: Probably as an independent LIB OR add to LIB xyzt (ask @roseckyj)
170
+ * TODO: !! Transfer back to Collboard (whole directory)
171
+ * TODO: Maybe [🏌️‍♂️] change ACRY toString => (toHex) toRgb when there will be toRgb and toRgba united
172
+ * TODO: Convert getters to methods - getters only for values
173
+ * TODO: Write tests
174
+ * TODO: Getters for alpha, opacity, transparency, r, b, g, h, s, l, a,...
175
+ * TODO: [0] Should be fromRgbString and fromRgbaString one or two functions + one or two regex
176
+ * TODO: Use rgb, rgba, hsl for testing and parsing with the same regex
177
+ * TODO: Regex for rgb, rgba, hsl does not support all options like deg, rad, turn,...
178
+ * TODO: Convolution matrix
179
+ * TODO: Maybe connect with textures
180
+ */
@@ -0,0 +1,159 @@
1
+ /**
2
+ * 🎨 List of all 140 color names which are supported by CSS
3
+ *
4
+ * @public exported from `@promptbook/color`
5
+ */
6
+ export declare const CSS_COLORS: {
7
+ readonly transparent: "rgba(0,0,0,0)";
8
+ readonly aliceblue: "#f0f8ff";
9
+ readonly antiquewhite: "#faebd7";
10
+ readonly aqua: "#00ffff";
11
+ readonly aquamarine: "#7fffd4";
12
+ readonly azure: "#f0ffff";
13
+ readonly beige: "#f5f5dc";
14
+ readonly bisque: "#ffe4c4";
15
+ readonly black: "#000000";
16
+ readonly blanchedalmond: "#ffebcd";
17
+ readonly blue: "#0000ff";
18
+ readonly blueviolet: "#8a2be2";
19
+ readonly brown: "#a52a2a";
20
+ readonly burlywood: "#deb887";
21
+ readonly cadetblue: "#5f9ea0";
22
+ readonly chartreuse: "#7fff00";
23
+ readonly chocolate: "#d2691e";
24
+ readonly coral: "#ff7f50";
25
+ readonly cornflowerblue: "#6495ed";
26
+ readonly cornsilk: "#fff8dc";
27
+ readonly crimson: "#dc143c";
28
+ readonly cyan: "#00ffff";
29
+ readonly darkblue: "#00008b";
30
+ readonly darkcyan: "#008b8b";
31
+ readonly darkgoldenrod: "#b8860b";
32
+ readonly darkgray: "#a9a9a9";
33
+ readonly darkgrey: "#a9a9a9";
34
+ readonly darkgreen: "#006400";
35
+ readonly darkkhaki: "#bdb76b";
36
+ readonly darkmagenta: "#8b008b";
37
+ readonly darkolivegreen: "#556b2f";
38
+ readonly darkorange: "#ff8c00";
39
+ readonly darkorchid: "#9932cc";
40
+ readonly darkred: "#8b0000";
41
+ readonly darksalmon: "#e9967a";
42
+ readonly darkseagreen: "#8fbc8f";
43
+ readonly darkslateblue: "#483d8b";
44
+ readonly darkslategray: "#2f4f4f";
45
+ readonly darkslategrey: "#2f4f4f";
46
+ readonly darkturquoise: "#00ced1";
47
+ readonly darkviolet: "#9400d3";
48
+ readonly deeppink: "#ff1493";
49
+ readonly deepskyblue: "#00bfff";
50
+ readonly dimgray: "#696969";
51
+ readonly dimgrey: "#696969";
52
+ readonly dodgerblue: "#1e90ff";
53
+ readonly firebrick: "#b22222";
54
+ readonly floralwhite: "#fffaf0";
55
+ readonly forestgreen: "#228b22";
56
+ readonly fuchsia: "#ff00ff";
57
+ readonly gainsboro: "#dcdcdc";
58
+ readonly ghostwhite: "#f8f8ff";
59
+ readonly gold: "#ffd700";
60
+ readonly goldenrod: "#daa520";
61
+ readonly gray: "#808080";
62
+ readonly grey: "#808080";
63
+ readonly green: "#008000";
64
+ readonly greenyellow: "#adff2f";
65
+ readonly honeydew: "#f0fff0";
66
+ readonly hotpink: "#ff69b4";
67
+ readonly indianred: "#cd5c5c";
68
+ readonly indigo: "#4b0082";
69
+ readonly ivory: "#fffff0";
70
+ readonly khaki: "#f0e68c";
71
+ readonly lavender: "#e6e6fa";
72
+ readonly lavenderblush: "#fff0f5";
73
+ readonly lawngreen: "#7cfc00";
74
+ readonly lemonchiffon: "#fffacd";
75
+ readonly lightblue: "#add8e6";
76
+ readonly lightcoral: "#f08080";
77
+ readonly lightcyan: "#e0ffff";
78
+ readonly lightgoldenrodyellow: "#fafad2";
79
+ readonly lightgray: "#d3d3d3";
80
+ readonly lightgrey: "#d3d3d3";
81
+ readonly lightgreen: "#90ee90";
82
+ readonly lightpink: "#ffb6c1";
83
+ readonly lightsalmon: "#ffa07a";
84
+ readonly lightseagreen: "#20b2aa";
85
+ readonly lightskyblue: "#87cefa";
86
+ readonly lightslategray: "#778899";
87
+ readonly lightslategrey: "#778899";
88
+ readonly lightsteelblue: "#b0c4de";
89
+ readonly lightyellow: "#ffffe0";
90
+ readonly lime: "#00ff00";
91
+ readonly limegreen: "#32cd32";
92
+ readonly linen: "#faf0e6";
93
+ readonly magenta: "#ff00ff";
94
+ readonly maroon: "#800000";
95
+ readonly mediumaquamarine: "#66cdaa";
96
+ readonly mediumblue: "#0000cd";
97
+ readonly mediumorchid: "#ba55d3";
98
+ readonly mediumpurple: "#9370db";
99
+ readonly mediumseagreen: "#3cb371";
100
+ readonly mediumslateblue: "#7b68ee";
101
+ readonly mediumspringgreen: "#00fa9a";
102
+ readonly mediumturquoise: "#48d1cc";
103
+ readonly mediumvioletred: "#c71585";
104
+ readonly midnightblue: "#191970";
105
+ readonly mintcream: "#f5fffa";
106
+ readonly mistyrose: "#ffe4e1";
107
+ readonly moccasin: "#ffe4b5";
108
+ readonly navajowhite: "#ffdead";
109
+ readonly navy: "#000080";
110
+ readonly oldlace: "#fdf5e6";
111
+ readonly olive: "#808000";
112
+ readonly olivedrab: "#6b8e23";
113
+ readonly orange: "#ffa500";
114
+ readonly orangered: "#ff4500";
115
+ readonly orchid: "#da70d6";
116
+ readonly palegoldenrod: "#eee8aa";
117
+ readonly palegreen: "#98fb98";
118
+ readonly paleturquoise: "#afeeee";
119
+ readonly palevioletred: "#db7093";
120
+ readonly papayawhip: "#ffefd5";
121
+ readonly peachpuff: "#ffdab9";
122
+ readonly peru: "#cd853f";
123
+ readonly pink: "#ffc0cb";
124
+ readonly plum: "#dda0dd";
125
+ readonly powderblue: "#b0e0e6";
126
+ readonly purple: "#800080";
127
+ readonly rebeccapurple: "#663399";
128
+ readonly red: "#ff0000";
129
+ readonly rosybrown: "#bc8f8f";
130
+ readonly royalblue: "#4169e1";
131
+ readonly saddlebrown: "#8b4513";
132
+ readonly salmon: "#fa8072";
133
+ readonly sandybrown: "#f4a460";
134
+ readonly seagreen: "#2e8b57";
135
+ readonly seashell: "#fff5ee";
136
+ readonly sienna: "#a0522d";
137
+ readonly silver: "#c0c0c0";
138
+ readonly skyblue: "#87ceeb";
139
+ readonly slateblue: "#6a5acd";
140
+ readonly slategray: "#708090";
141
+ readonly slategrey: "#708090";
142
+ readonly snow: "#fffafa";
143
+ readonly springgreen: "#00ff7f";
144
+ readonly steelblue: "#4682b4";
145
+ readonly tan: "#d2b48c";
146
+ readonly teal: "#008080";
147
+ readonly thistle: "#d8bfd8";
148
+ readonly tomato: "#ff6347";
149
+ readonly turquoise: "#40e0d0";
150
+ readonly violet: "#ee82ee";
151
+ readonly wheat: "#f5deb3";
152
+ readonly white: "#ffffff";
153
+ readonly whitesmoke: "#f5f5f5";
154
+ readonly yellow: "#ffff00";
155
+ readonly yellowgreen: "#9acd32";
156
+ };
157
+ /**
158
+ * Note: [💞] Ignore a discrepancy between file name and entity name
159
+ */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Validates that a channel value is a valid number within the range of 0 to 255.
3
+ * Throws an error if the value is not valid.
4
+ *
5
+ * @param channelName - The name of the channel being validated.
6
+ * @param value - The value of the channel to validate.
7
+ * @throws Will throw an error if the value is not a valid channel number.
8
+ *
9
+ * @private util of `@promptbook/color`
10
+ */
11
+ export declare function checkChannelValue(channelName: string, value: number): asserts value is number;
12
+ /**
13
+ * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
14
+ */
@@ -0,0 +1,17 @@
1
+ import type { number_integer } from '../../../types/typeAliases';
2
+ import type { number_percent } from '../../../types/typeAliases';
3
+ import type { number_positive } from '../../../types/typeAliases';
4
+ /**
5
+ * Converts HSL values to RGB values
6
+ *
7
+ * @param hue [0-1]
8
+ * @param saturation [0-1]
9
+ * @param lightness [0-1]
10
+ * @returns [red, green, blue] [0-255]
11
+ *
12
+ * @private util of `@promptbook/color`
13
+ */
14
+ export declare function hslToRgb(hue: number_percent, saturation: number_percent, lightness: number_percent): readonly [number_positive & number_integer, number_positive & number_integer, number_positive & number_integer];
15
+ /**
16
+ * TODO: Properly name all used internal variables
17
+ */
@@ -0,0 +1,17 @@
1
+ import type { number_integer } from '../../../types/typeAliases';
2
+ import type { number_percent } from '../../../types/typeAliases';
3
+ import type { number_positive } from '../../../types/typeAliases';
4
+ /**
5
+ * Converts RGB values to HSL values
6
+ *
7
+ * @param red [0-255]
8
+ * @param green [0-255]
9
+ * @param blue [0-255]
10
+ * @returns [hue, saturation, lightness] [0-1]
11
+ *
12
+ * @private util of `@promptbook/color`
13
+ */
14
+ export declare function rgbToHsl(red: number_positive & number_integer, green: number_positive & number_integer, blue: number_positive & number_integer): readonly [number_percent, number_percent, number_percent];
15
+ /**
16
+ * TODO: Properly name all used internal variables
17
+ */