@luminescent/ui 0.7.7 → 0.8.1

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.
@@ -1,9 +1,19 @@
1
- import type { QRL } from '@builder.io/qwik';
1
+ import type { PropsOf, QRL } from '@builder.io/qwik';
2
2
  import type { TextInputRawProps } from './TextInput';
3
3
  export interface ColorInputProps extends Omit<TextInputRawProps, 'onInput$' | 'children'> {
4
- onInput$?: QRL<(color: string, element: HTMLInputElement) => void>;
4
+ onInput$?: QRL<(color: string) => void>;
5
5
  value?: string;
6
6
  presetColors?: string[];
7
7
  preview?: 'left' | 'right' | 'top' | 'bottom' | 'full';
8
+ id: string;
8
9
  }
9
10
  export declare const ColorInput: import("@builder.io/qwik").Component<ColorInputProps>;
11
+ export interface ColorPickerProps extends Omit<PropsOf<'div'>, 'class' | 'onInput$'> {
12
+ class: {
13
+ [key: string]: boolean;
14
+ };
15
+ onInput$?: QRL<(color: string) => void>;
16
+ color: string;
17
+ colors: string[];
18
+ }
19
+ export declare const ColorPickerRaw: import("@builder.io/qwik").Component<ColorPickerProps>;
@@ -1,3 +1,9 @@
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;
1
7
  export type RGBAColor = {
2
8
  r: number;
3
9
  g: number;
@@ -10,26 +16,6 @@ export type HSVAColor = {
10
16
  v: number;
11
17
  a?: number;
12
18
  };
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
19
  export declare function getBrightness(color: RGBAColor): number;
34
20
  export declare function hexNumberToRgb(color: number): {
35
21
  r: number;
@@ -37,7 +23,6 @@ export declare function hexNumberToRgb(color: number): {
37
23
  b: number;
38
24
  };
39
25
  export declare function rgbToHex(color: RGBAColor): string;
40
- export declare const numberToHexString: (color: number) => string;
41
26
  export declare const hexStringToNumber: (color: string) => number;
42
27
  export declare function hsvToRgb(color: HSVAColor): {
43
28
  r: number;
package/package.json CHANGED
@@ -1,62 +1,62 @@
1
- {
2
- "name": "@luminescent/ui",
3
- "version": "0.7.7",
4
- "description": "Luminescent UI library",
5
- "main": "./lib/index.qwik.mjs",
6
- "qwik": "./lib/index.qwik.mjs",
7
- "types": "./lib-types/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./lib/index.qwik.mjs",
11
- "require": "./lib/index.qwik.cjs",
12
- "types": "./lib-types/index.d.ts"
13
- },
14
- "./config": "./src/tailwind.config.js"
15
- },
16
- "files": [
17
- "lib",
18
- "lib-types",
19
- "src/tailwind.config.js"
20
- ],
21
- "engines": {
22
- "node": ">=15.0.0"
23
- },
24
- "license": "AGPL-3.0-or-later",
25
- "private": false,
26
- "type": "module",
27
- "publishConfig": {
28
- "access": "public"
29
- },
30
- "scripts": {
31
- "build": "qwik build",
32
- "build.lib": "vite build --mode lib",
33
- "build.types": "tsc --emitDeclarationOnly",
34
- "dev": "vite --mode ssr",
35
- "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
36
- "lint": "eslint \"src/**/*.ts*\"",
37
- "release": "np",
38
- "start": "vite --open --mode ssr",
39
- "test": "echo \"No test specified\" && exit 0",
40
- "qwik": "qwik"
41
- },
42
- "devDependencies": {
43
- "@anuragroy/tailwindcss-animate": "^1.0.6",
44
- "@builder.io/qwik": "1.4.5",
45
- "@builder.io/qwik-city": "^1.4.5",
46
- "@types/eslint": "^8.56.2",
47
- "@types/node": "^20.11.19",
48
- "@typescript-eslint/eslint-plugin": "^7.0.2",
49
- "@typescript-eslint/parser": "^7.0.2",
50
- "autoprefixer": "^10.4.17",
51
- "chart.js": "^4.4.1",
52
- "eslint": "^8.56.0",
53
- "eslint-plugin-qwik": "latest",
54
- "np": "^9.2.0",
55
- "postcss": "^8.4.35",
56
- "tailwindcss": "3.4.1",
57
- "typescript": "5.3.3",
58
- "undici": "*",
59
- "vite": "^5.1.3",
60
- "vite-tsconfig-paths": "^4.3.1"
61
- }
62
- }
1
+ {
2
+ "name": "@luminescent/ui",
3
+ "version": "0.8.1",
4
+ "description": "Luminescent UI library",
5
+ "main": "./lib/index.qwik.mjs",
6
+ "qwik": "./lib/index.qwik.mjs",
7
+ "types": "./lib-types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./lib/index.qwik.mjs",
11
+ "require": "./lib/index.qwik.cjs",
12
+ "types": "./lib-types/index.d.ts"
13
+ },
14
+ "./config": "./src/tailwind.config.js"
15
+ },
16
+ "files": [
17
+ "lib",
18
+ "lib-types",
19
+ "src/tailwind.config.js"
20
+ ],
21
+ "engines": {
22
+ "node": ">=15.0.0"
23
+ },
24
+ "license": "AGPL-3.0-or-later",
25
+ "private": false,
26
+ "type": "module",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "qwik build",
32
+ "build.lib": "vite build --mode lib",
33
+ "build.types": "tsc --emitDeclarationOnly",
34
+ "dev": "vite --mode ssr",
35
+ "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
36
+ "lint": "eslint \"src/**/*.ts*\"",
37
+ "release": "np",
38
+ "start": "vite --open --mode ssr",
39
+ "test": "echo \"No test specified\" && exit 0",
40
+ "qwik": "qwik"
41
+ },
42
+ "devDependencies": {
43
+ "@anuragroy/tailwindcss-animate": "^1.0.6",
44
+ "@builder.io/qwik": "1.4.5",
45
+ "@builder.io/qwik-city": "^1.4.5",
46
+ "@types/eslint": "^8.56.3",
47
+ "@types/node": "^20.11.20",
48
+ "@typescript-eslint/eslint-plugin": "^7.0.2",
49
+ "@typescript-eslint/parser": "^7.0.2",
50
+ "autoprefixer": "^10.4.17",
51
+ "chart.js": "^4.4.1",
52
+ "eslint": "^8.57.0",
53
+ "eslint-plugin-qwik": "latest",
54
+ "np": "^9.2.0",
55
+ "postcss": "^8.4.35",
56
+ "tailwindcss": "3.4.1",
57
+ "typescript": "5.3.3",
58
+ "undici": "*",
59
+ "vite": "^5.1.4",
60
+ "vite-tsconfig-paths": "^4.3.1"
61
+ }
62
+ }
@@ -1,72 +1,72 @@
1
- function getBlobKeyFrame() {
2
- const translateXPercentages = [0, 19, 38, 57, 76];
3
- const translateYPercentages = [0, 12, 25, 38, 50];
4
- const scaleValues = [0.8, 1, 1.2, 1.4];
5
-
6
- const translateX0Key = Math.floor(Math.random() * 70);
7
- const translateX0 = Math.floor(Math.random() * 70);
8
- translateXPercentages.splice(translateX0Key, 1);
9
- const translateX1Key = Math.floor(Math.random() * translateXPercentages.length);
10
- const translateX1 = translateXPercentages[translateX1Key];
11
- translateXPercentages.splice(translateX1Key, 1);
12
- const translateX2Key = Math.floor(Math.random() * translateXPercentages.length);
13
- const translateX2 = translateXPercentages[translateX2Key];
14
- translateXPercentages.splice(translateX2Key, 1);
15
- const translateX3Key = Math.floor(Math.random() * translateXPercentages.length);
16
- const translateX3 = translateXPercentages[translateX3Key];
17
- translateXPercentages.splice(translateX3Key, 1);
18
-
19
- const translateY0Key = Math.floor(Math.random() * translateYPercentages.length);
20
- const translateY0 = translateYPercentages[translateY0Key];
21
- translateYPercentages.splice(translateY0Key, 1);
22
- const translateY1Key = Math.floor(Math.random() * translateYPercentages.length);
23
- const translateY1 = translateYPercentages[translateY1Key];
24
- translateYPercentages.splice(translateY1Key, 1);
25
- const translateY2Key = Math.floor(Math.random() * translateYPercentages.length);
26
- const translateY2 = translateYPercentages[translateY2Key];
27
- translateYPercentages.splice(translateY2Key, 1);
28
- const translateY3Key = Math.floor(Math.random() * translateYPercentages.length);
29
- const translateY3 = translateYPercentages[translateY3Key];
30
- translateYPercentages.splice(translateY3Key, 1);
31
-
32
- const scale0 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
33
- const scale1 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
34
- const scale2 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
35
- const scale3 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
36
-
37
- const keyframe = {
38
- '0%, 100%': { transform: `translate(${translateX0}cqw, ${translateY0}cqh) scale(${scale0})` },
39
- '25%': { transform: `translate(${translateX1}cqw, ${translateY1}cqh) scale(${scale1})` },
40
- '50%': { transform: `translate(${translateX2}cqw, ${translateY2}cqh) scale(${scale2})` },
41
- '75%': { transform: `translate(${translateX3}cqw, ${translateY3}cqh) scale(${scale3})` },
42
- };
43
-
44
- return keyframe;
45
- }
46
-
47
- module.exports = {
48
- content: ['./node_modules/@luminescent/ui/**/*.{mjs,cjs}'],
49
- theme: {
50
- extend: {
51
- animation: {
52
- blob: 'blob 15s infinite',
53
- blob1: 'blob1 15s infinite',
54
- blob2: 'blob2 15s infinite',
55
- blob3: 'blob3 15s infinite',
56
- blob4: 'blob4 15s infinite',
57
- blob5: 'blob5 15s infinite',
58
- blob6: 'blob6 15s infinite',
59
- float: 'float 6s infinite',
60
- },
61
- keyframes: {
62
- blob: getBlobKeyFrame(),
63
- blob1: getBlobKeyFrame(),
64
- blob2: getBlobKeyFrame(),
65
- blob3: getBlobKeyFrame(),
66
- blob4: getBlobKeyFrame(),
67
- blob5: getBlobKeyFrame(),
68
- blob6: getBlobKeyFrame(),
69
- },
70
- },
71
- },
1
+ function getBlobKeyFrame() {
2
+ const translateXPercentages = [0, 19, 38, 57, 76];
3
+ const translateYPercentages = [0, 12, 25, 38, 50];
4
+ const scaleValues = [0.8, 1, 1.2, 1.4];
5
+
6
+ const translateX0Key = Math.floor(Math.random() * 70);
7
+ const translateX0 = Math.floor(Math.random() * 70);
8
+ translateXPercentages.splice(translateX0Key, 1);
9
+ const translateX1Key = Math.floor(Math.random() * translateXPercentages.length);
10
+ const translateX1 = translateXPercentages[translateX1Key];
11
+ translateXPercentages.splice(translateX1Key, 1);
12
+ const translateX2Key = Math.floor(Math.random() * translateXPercentages.length);
13
+ const translateX2 = translateXPercentages[translateX2Key];
14
+ translateXPercentages.splice(translateX2Key, 1);
15
+ const translateX3Key = Math.floor(Math.random() * translateXPercentages.length);
16
+ const translateX3 = translateXPercentages[translateX3Key];
17
+ translateXPercentages.splice(translateX3Key, 1);
18
+
19
+ const translateY0Key = Math.floor(Math.random() * translateYPercentages.length);
20
+ const translateY0 = translateYPercentages[translateY0Key];
21
+ translateYPercentages.splice(translateY0Key, 1);
22
+ const translateY1Key = Math.floor(Math.random() * translateYPercentages.length);
23
+ const translateY1 = translateYPercentages[translateY1Key];
24
+ translateYPercentages.splice(translateY1Key, 1);
25
+ const translateY2Key = Math.floor(Math.random() * translateYPercentages.length);
26
+ const translateY2 = translateYPercentages[translateY2Key];
27
+ translateYPercentages.splice(translateY2Key, 1);
28
+ const translateY3Key = Math.floor(Math.random() * translateYPercentages.length);
29
+ const translateY3 = translateYPercentages[translateY3Key];
30
+ translateYPercentages.splice(translateY3Key, 1);
31
+
32
+ const scale0 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
33
+ const scale1 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
34
+ const scale2 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
35
+ const scale3 = scaleValues[Math.floor(Math.random() * scaleValues.length)];
36
+
37
+ const keyframe = {
38
+ '0%, 100%': { transform: `translate(${translateX0}cqw, ${translateY0}cqh) scale(${scale0})` },
39
+ '25%': { transform: `translate(${translateX1}cqw, ${translateY1}cqh) scale(${scale1})` },
40
+ '50%': { transform: `translate(${translateX2}cqw, ${translateY2}cqh) scale(${scale2})` },
41
+ '75%': { transform: `translate(${translateX3}cqw, ${translateY3}cqh) scale(${scale3})` },
42
+ };
43
+
44
+ return keyframe;
45
+ }
46
+
47
+ module.exports = {
48
+ content: ['./node_modules/@luminescent/ui/**/*.{mjs,cjs}'],
49
+ theme: {
50
+ extend: {
51
+ animation: {
52
+ blob: 'blob 15s infinite',
53
+ blob1: 'blob1 15s infinite',
54
+ blob2: 'blob2 15s infinite',
55
+ blob3: 'blob3 15s infinite',
56
+ blob4: 'blob4 15s infinite',
57
+ blob5: 'blob5 15s infinite',
58
+ blob6: 'blob6 15s infinite',
59
+ float: 'float 6s infinite',
60
+ },
61
+ keyframes: {
62
+ blob: getBlobKeyFrame(),
63
+ blob1: getBlobKeyFrame(),
64
+ blob2: getBlobKeyFrame(),
65
+ blob3: getBlobKeyFrame(),
66
+ blob4: getBlobKeyFrame(),
67
+ blob5: getBlobKeyFrame(),
68
+ blob6: getBlobKeyFrame(),
69
+ },
70
+ },
71
+ },
72
72
  };
@@ -1,145 +0,0 @@
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 {};
@@ -1,6 +0,0 @@
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;