@luminescent/ui 0.1.2 → 0.2.0

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.
@@ -4,6 +4,7 @@ interface ColorInputProps extends Omit<TextInputRawProps, 'onInput$'> {
4
4
  onInput$?: QRL<(color: string, element: HTMLInputElement) => void>;
5
5
  value?: string;
6
6
  label?: string;
7
+ presetColors?: string[];
7
8
  }
8
9
  export declare const ColorInput: import("@builder.io/qwik").Component<ColorInputProps>;
9
10
  export {};
@@ -0,0 +1,50 @@
1
+ export type RGBAColor = {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a?: number;
6
+ };
7
+ export type HSVAColor = {
8
+ h: number;
9
+ s: number;
10
+ v: number;
11
+ a?: number;
12
+ };
13
+ export declare class Color {
14
+ private _rgba;
15
+ private _hsva;
16
+ private _hexNumber;
17
+ private _brightness;
18
+ private _hexString;
19
+ private _isDark;
20
+ private _isLight;
21
+ constructor(color: number | string);
22
+ fromHex(color?: number | string): void;
23
+ fromHsv(color: HSVAColor): void;
24
+ private _updateBrightness;
25
+ get rgb(): RGBAColor;
26
+ get hsv(): HSVAColor;
27
+ get hex(): number;
28
+ get hexString(): string;
29
+ get brightness(): number;
30
+ get isDark(): boolean;
31
+ get isLight(): boolean;
32
+ }
33
+ export declare function hexNumberToRgb(color: number): {
34
+ r: number;
35
+ g: number;
36
+ b: number;
37
+ };
38
+ export declare function rgbToHex(color: RGBAColor): string;
39
+ export declare const numberToHexString: (color: number) => string;
40
+ export declare const hexStringToNumber: (color: string) => number;
41
+ export declare function hsvToRgb(color: HSVAColor): {
42
+ r: number;
43
+ g: number;
44
+ b: number;
45
+ };
46
+ export declare function rgbToHsv(color: RGBAColor): {
47
+ h: number;
48
+ s: number;
49
+ v: number;
50
+ };
@@ -0,0 +1,145 @@
1
+ import { Color } from './color';
2
+ type ColorPickerOptions = {
3
+ window?: Window;
4
+ el?: HTMLElement | string;
5
+ background?: string | number;
6
+ widthUnits?: string;
7
+ heightUnits?: string;
8
+ width?: number;
9
+ height?: number;
10
+ color?: string | number;
11
+ colors?: string[] | number[];
12
+ };
13
+ export declare class ColorPicker {
14
+ private _window;
15
+ private _document;
16
+ private _widthUnits;
17
+ private _heightUnits;
18
+ private _huePosition;
19
+ private _hueHeight;
20
+ private _maxHue;
21
+ _inputIsNumber: boolean;
22
+ private _saturationWidth;
23
+ private _isChoosing;
24
+ private _callbacks;
25
+ width: number;
26
+ height: number;
27
+ hue: number;
28
+ position: {
29
+ x: number;
30
+ y: number;
31
+ };
32
+ color: Color;
33
+ backgroundColor: Color;
34
+ hueColor: Color;
35
+ $el: HTMLElement;
36
+ $saturation: HTMLElement;
37
+ $hue: HTMLElement;
38
+ $sbSelector: HTMLElement;
39
+ $hSelector: HTMLElement;
40
+ $colors?: HTMLElement;
41
+ constructor(options?: ColorPickerOptions);
42
+ /**
43
+ * Add the ColorPicker instance to a DOM element.
44
+ * @param {HTMLElement} el
45
+ * @return {ColorPicker} Returns itself for chaining purpose
46
+ */
47
+ appendTo(el: HTMLElement | string): this;
48
+ /**
49
+ * Removes picker from its parent and kill all listeners.
50
+ * Call this method for proper destroy.
51
+ */
52
+ remove(): void;
53
+ /**
54
+ * Manually set the current color of the picker. This is the method
55
+ * used on instantiation to convert `color` option to actual color for
56
+ * the picker. Param can be a hexadecimal number or an hex String.
57
+ * @param {String|Number} color hex color desired
58
+ * @return {ColorPicker} Returns itself for chaining purpose
59
+ */
60
+ setColor(color: string | number): this;
61
+ /**
62
+ * Set size of the color picker for a given width and height. Note that
63
+ * a padding of 5px will be added if you chose to use the background option
64
+ * of the constructor.
65
+ * @param {Number} width
66
+ * @param {Number} height
67
+ * @return {ColorPicker} Returns itself for chaining purpose
68
+ */
69
+ setSize(width: number, height: number): this;
70
+ /**
71
+ * Set the background color of the picker. It also adds a 5px padding
72
+ * for design purpose.
73
+ * @param {String|Number} color hex color desired for background
74
+ * @return {ColorPicker} Returns itself for chaining purpose
75
+ */
76
+ setBackgroundColor(color: string | number): this;
77
+ /**
78
+ * Removes background of the picker if previously set. It's no use
79
+ * calling this method if you didn't set the background option on start
80
+ * or if you didn't call setBackgroundColor previously.
81
+ */
82
+ setNoBackground(): this;
83
+ /**
84
+ * Registers callback to the update event of the picker.
85
+ * picker inherits from [component/emitter](https://github.com/component/emitter)
86
+ * so you could do the same thing by calling `colorPicker.on('update');`
87
+ * @param {Function} callback
88
+ * @return {ColorPicker} Returns itself for chaining purpose
89
+ */
90
+ onChange(callback: Function): this;
91
+ /**
92
+ * Is true when mouse is down and user is currently choosing a color.
93
+ */
94
+ get isChoosing(): boolean;
95
+ /**
96
+ * Main color getter, will return a formatted color string depending on input
97
+ * or a number depending on the last setColor call.
98
+ * @return {Number|String}
99
+ */
100
+ getColor(): string | number;
101
+ /**
102
+ * Returns color as css hex string (ex: '#FF0000').
103
+ * @return {String}
104
+ */
105
+ getHexString(): string;
106
+ /**
107
+ * Returns color as number (ex: 0xFF0000).
108
+ * @return {Number}
109
+ */
110
+ getHexNumber(): number;
111
+ /**
112
+ * Returns color as {r: 1, g: 0, b: 0} object.
113
+ * @return {Object}
114
+ */
115
+ getRGB(): import("./color").RGBAColor;
116
+ /**
117
+ * Returns color as {h: 100, s: 1, v: 1} object.
118
+ * @return {Object}
119
+ */
120
+ getHSV(): import("./color").HSVAColor;
121
+ /**
122
+ * Returns true if color is perceived as dark
123
+ * @return {Boolean}
124
+ */
125
+ isDark(): boolean;
126
+ /**
127
+ * Returns true if color is perceived as light
128
+ * @return {Boolean}
129
+ */
130
+ isLight(): boolean;
131
+ private _moveSelectorTo;
132
+ private _updateColorFromPosition;
133
+ private _moveHueTo;
134
+ private _updateHueFromPosition;
135
+ private _updateHue;
136
+ private _updateColor;
137
+ private _triggerChange;
138
+ private _onSaturationMouseDown;
139
+ private _onSaturationMouseMove;
140
+ private _onSaturationMouseUp;
141
+ private _onHueMouseDown;
142
+ private _onHueMouseMove;
143
+ private _onHueMouseUp;
144
+ }
145
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const clamp: (value: number, min: number, max: number) => number;
2
+ export declare function getMousePosition(e: MouseEvent | TouchEvent): {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ export declare const pad2: (c: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luminescent/ui",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Luminescent UI library",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",
@@ -41,7 +41,7 @@
41
41
  "@builder.io/qwik": "1.4.5",
42
42
  "@builder.io/qwik-city": "^1.4.5",
43
43
  "@types/eslint": "^8.56.2",
44
- "@types/node": "^20.11.17",
44
+ "@types/node": "^20.11.19",
45
45
  "@typescript-eslint/eslint-plugin": "^7.0.1",
46
46
  "@typescript-eslint/parser": "^7.0.1",
47
47
  "autoprefixer": "^10.4.17",
@@ -51,11 +51,10 @@
51
51
  "np": "^9.2.0",
52
52
  "postcss": "^8.4.35",
53
53
  "qwik-ionicons": "^1.0.5",
54
- "simple-color-picker": "^1.0.5",
55
54
  "tailwindcss": "3.4.1",
56
55
  "typescript": "5.3.3",
57
56
  "undici": "*",
58
- "vite": "^5.1.1",
57
+ "vite": "^5.1.3",
59
58
  "vite-tsconfig-paths": "^4.3.1"
60
59
  }
61
60
  }
@@ -1,8 +0,0 @@
1
- import type { IconProps } from '../logos/IconProps';
2
- interface loadingIconProps extends IconProps {
3
- class?: {
4
- [key: string]: boolean;
5
- };
6
- }
7
- export declare const LoadingIcon: import("@builder.io/qwik").Component<loadingIconProps>;
8
- export {};