@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.
- package/README.md +1 -0
- package/esm/index.es.js +10 -278
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/color.index.d.ts +50 -0
- package/esm/typings/src/_packages/components.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +4 -2
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.d.ts +108 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/interfaces/ChatParticipant.d.ts +3 -1
- package/esm/typings/src/utils/color/$randomColor.d.ts +11 -0
- package/esm/typings/src/utils/color/Color.d.ts +180 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +159 -0
- package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +14 -0
- package/esm/typings/src/utils/color/internal-utils/hslToRgb.d.ts +17 -0
- package/esm/typings/src/utils/color/internal-utils/rgbToHsl.d.ts +17 -0
- package/esm/typings/src/utils/color/operators/ColorTransformer.d.ts +5 -0
- package/esm/typings/src/utils/color/operators/darken.d.ts +9 -0
- package/esm/typings/src/utils/color/operators/furthest.d.ts +16 -0
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +9 -0
- package/esm/typings/src/utils/color/operators/lighten.d.ts +12 -0
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +11 -0
- package/esm/typings/src/utils/color/operators/nearest.d.ts +10 -0
- package/esm/typings/src/utils/color/operators/negative.d.ts +7 -0
- package/esm/typings/src/utils/color/operators/negativeLightness.d.ts +7 -0
- package/esm/typings/src/utils/color/operators/withAlpha.d.ts +9 -0
- package/esm/typings/src/utils/color/utils/areColorsEqual.d.ts +14 -0
- package/esm/typings/src/utils/color/utils/colorDistance.d.ts +21 -0
- package/esm/typings/src/utils/color/utils/colorHue.d.ts +11 -0
- package/esm/typings/src/utils/color/utils/colorHueDistance.d.ts +11 -0
- package/esm/typings/src/utils/color/utils/colorHueDistance.test.d.ts +1 -0
- package/esm/typings/src/utils/color/utils/colorLuminance.d.ts +9 -0
- package/esm/typings/src/utils/color/utils/colorSatulightion.d.ts +7 -0
- package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +9 -0
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +10 -0
- package/esm/typings/src/utils/color/utils/mixColors.d.ts +11 -0
- package/esm/typings/src/utils/take/classes/TakeChain.d.ts +11 -0
- package/esm/typings/src/utils/take/interfaces/ITakeChain.d.ts +12 -0
- package/esm/typings/src/utils/take/interfaces/Takeable.d.ts +7 -0
- package/esm/typings/src/utils/take/take.d.ts +12 -0
- package/esm/typings/src/utils/take/take.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +10 -278
- package/umd/index.umd.js.map +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ColorTransformer } from './ColorTransformer';
|
|
2
|
+
/**
|
|
3
|
+
* Makes color transformer which darker the given color
|
|
4
|
+
*
|
|
5
|
+
* @param amount from 0 to 1
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/color`
|
|
8
|
+
*/
|
|
9
|
+
export declare function darken(amount: number): ColorTransformer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Color } from '../Color';
|
|
2
|
+
import type { ColorTransformer } from './ColorTransformer';
|
|
3
|
+
/**
|
|
4
|
+
* Makes color transformer which finds the furthest color from the given list
|
|
5
|
+
*
|
|
6
|
+
* @param colors array of colors to choose from
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/color`
|
|
9
|
+
*/
|
|
10
|
+
export declare function furthest(...colors: Color[]): ColorTransformer;
|
|
11
|
+
/**
|
|
12
|
+
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
13
|
+
*
|
|
14
|
+
* @public exported from `@promptbook/color`
|
|
15
|
+
*/
|
|
16
|
+
export declare const textColor: ColorTransformer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ColorTransformer } from './ColorTransformer';
|
|
2
|
+
/**
|
|
3
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
4
|
+
*
|
|
5
|
+
* @param amount from 0 to 1
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/color`
|
|
8
|
+
*/
|
|
9
|
+
export declare function grayscale(amount: number): ColorTransformer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ColorTransformer } from './ColorTransformer';
|
|
2
|
+
/**
|
|
3
|
+
* Makes color transformer which lighten the given color
|
|
4
|
+
*
|
|
5
|
+
* @param amount from 0 to 1
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/color`
|
|
8
|
+
*/
|
|
9
|
+
export declare function lighten(amount: number): ColorTransformer;
|
|
10
|
+
/**
|
|
11
|
+
* TODO: Maybe implement by mix+hsl
|
|
12
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Color } from '../Color';
|
|
2
|
+
import type { ColorTransformer } from './ColorTransformer';
|
|
3
|
+
/**
|
|
4
|
+
* Makes color transformer which returns a mix of two colors based on a ratio
|
|
5
|
+
*
|
|
6
|
+
* @param ratio the ratio of the first color to the second color, from 0 to 1
|
|
7
|
+
* @param additionalColor the second color to mix with the first color
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/color`
|
|
10
|
+
*/
|
|
11
|
+
export declare function mixWithColor(ratio: number, additionalColor: Color): ColorTransformer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Color } from '../Color';
|
|
2
|
+
import type { ColorTransformer } from './ColorTransformer';
|
|
3
|
+
/**
|
|
4
|
+
* Makes color transformer which finds the nearest color from the given list
|
|
5
|
+
*
|
|
6
|
+
* @param colors array of colors to choose from
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/color`
|
|
9
|
+
*/
|
|
10
|
+
export declare function nearest(...colors: Color[]): ColorTransformer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ColorTransformer } from './ColorTransformer';
|
|
2
|
+
/**
|
|
3
|
+
* Makes color transformer which sets alpha channel to given color
|
|
4
|
+
*
|
|
5
|
+
* @param alpha number from 0 (transparent) to 1 (opaque)
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/color`
|
|
8
|
+
*/
|
|
9
|
+
export declare function withAlpha(alpha: number): ColorTransformer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Color } from '../Color';
|
|
2
|
+
/**
|
|
3
|
+
* Compares two colors to determine if they are equal based on their RGB values.
|
|
4
|
+
*
|
|
5
|
+
* @param color1 - The first color to compare.
|
|
6
|
+
* @param color2 - The second color to compare.
|
|
7
|
+
* @returns {boolean} True if the colors are equal, false otherwise.
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/color`
|
|
10
|
+
*/
|
|
11
|
+
export declare function areColorsEqual(color1: Color, color2: Color): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* TODO: [🥎] Implement for N colors
|
|
14
|
+
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Color } from '../Color';
|
|
2
|
+
/**
|
|
3
|
+
* Calculates distance between two colors
|
|
4
|
+
*
|
|
5
|
+
* @param color1 first color
|
|
6
|
+
* @param color2 second color
|
|
7
|
+
*
|
|
8
|
+
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
9
|
+
*
|
|
10
|
+
* @public exported from `@promptbook/color`
|
|
11
|
+
*/
|
|
12
|
+
export declare function colorDistance(color1: Color, color2: Color): number;
|
|
13
|
+
/**
|
|
14
|
+
* Calculates distance between two colors without square root
|
|
15
|
+
*
|
|
16
|
+
* @param color1 first color
|
|
17
|
+
* @param color2 second color
|
|
18
|
+
*
|
|
19
|
+
* @public exported from `@promptbook/color`
|
|
20
|
+
*/
|
|
21
|
+
export declare function colorDistanceSquared(color1: Color, color2: Color): number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Color } from '../Color';
|
|
2
|
+
/**
|
|
3
|
+
* Calculates hue of the color
|
|
4
|
+
*
|
|
5
|
+
* @returns hue in degrees <0-360)
|
|
6
|
+
*
|
|
7
|
+
* @see https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/color`
|
|
10
|
+
*/
|
|
11
|
+
export declare function colorHue(color: Color): number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Color } from '../Color';
|
|
2
|
+
/**
|
|
3
|
+
* Calculates hue distance of two colors
|
|
4
|
+
*
|
|
5
|
+
* @returns hue distance in degrees <0-180)
|
|
6
|
+
*
|
|
7
|
+
* @see https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/color`
|
|
10
|
+
*/
|
|
11
|
+
export declare function colorHueDistance(color1: Color, color2: Color): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Color } from "../Color";
|
|
2
|
+
/**
|
|
3
|
+
* Calculates saturation of the color
|
|
4
|
+
*
|
|
5
|
+
* @see https://en.wikipedia.org/wiki/HSL_and_HSV#Saturation
|
|
6
|
+
*
|
|
7
|
+
* @public exported from `@promptbook/color`
|
|
8
|
+
*/
|
|
9
|
+
export declare function colorSaturation(color: Color): number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WithTake } from '../../take/interfaces/ITakeChain';
|
|
2
|
+
import { Color } from '../Color';
|
|
3
|
+
/**
|
|
4
|
+
* Mixes an array of colors and returns the average color
|
|
5
|
+
*
|
|
6
|
+
* @param {...Color} colors - The array of colors to be mixed.
|
|
7
|
+
* @returns {WithTake<Color>} - The mixed color.
|
|
8
|
+
*
|
|
9
|
+
* @public exported from `@promptbook/color`
|
|
10
|
+
*/
|
|
11
|
+
export declare function mixColors(...colors: Array<Color>): WithTake<Color>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ITakeChain } from '../interfaces/ITakeChain';
|
|
2
|
+
import type { Takeable } from '../interfaces/Takeable';
|
|
3
|
+
/**
|
|
4
|
+
* @private util of `@promptbook/color`
|
|
5
|
+
* @de
|
|
6
|
+
*/
|
|
7
|
+
export declare class TakeChain<TValue extends Takeable> implements ITakeChain<TValue> {
|
|
8
|
+
value: TValue;
|
|
9
|
+
constructor(value: TValue);
|
|
10
|
+
then<TResultValue extends Takeable>(callback: (oldValue: TValue) => TResultValue): TResultValue & ITakeChain<TResultValue>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Takeable } from './Takeable';
|
|
2
|
+
/**
|
|
3
|
+
* Represents any value with take chain functionality
|
|
4
|
+
*
|
|
5
|
+
* @private util of `@promptbook/color`
|
|
6
|
+
* @deprecated [🤡] Use some better functional library instead of `TakeChain`
|
|
7
|
+
*/
|
|
8
|
+
export type WithTake<TValue extends Takeable> = TValue & ITakeChain<TValue>;
|
|
9
|
+
export interface ITakeChain<TValue extends Takeable> {
|
|
10
|
+
readonly value: TValue;
|
|
11
|
+
then<TResultValue extends Takeable>(callback: (value: TValue) => TResultValue): WithTake<TResultValue>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WithTake } from './interfaces/ITakeChain';
|
|
2
|
+
import type { Takeable } from './interfaces/Takeable';
|
|
3
|
+
/**
|
|
4
|
+
* A function that takes an initial value and returns a proxy object with chainable methods.
|
|
5
|
+
*
|
|
6
|
+
* @param {*} initialValue - The initial value.
|
|
7
|
+
* @returns {Proxy<WithTake<TValue>>} - A proxy object with a `take` method.
|
|
8
|
+
*
|
|
9
|
+
* @private util of `@promptbook/color`
|
|
10
|
+
* @deprecated [🤡] Use some better functional library instead of `TakeChain`
|
|
11
|
+
*/
|
|
12
|
+
export declare function take<TValue extends Takeable>(initialValue: TValue): WithTake<TValue>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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.100.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.100.0-48`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/templates",
|
|
3
|
-
"version": "0.100.0-
|
|
3
|
+
"version": "0.100.0-49",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"module": "./esm/index.es.js",
|
|
96
96
|
"typings": "./esm/typings/src/_packages/templates.index.d.ts",
|
|
97
97
|
"peerDependencies": {
|
|
98
|
-
"@promptbook/core": "0.100.0-
|
|
98
|
+
"@promptbook/core": "0.100.0-49"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"spacetrim": "0.11.59"
|