@ixfx/ui 0.36.0 → 0.38.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.
- package/LICENSE +21 -0
- package/dist/src/rx/colour.d.ts +5 -5
- package/dist/src/rx/colour.d.ts.map +1 -1
- package/dist/src/rx/dom-source.d.ts +1 -1
- package/dist/src/rx/dom-source.d.ts.map +1 -1
- package/dist/src/rx/dom-source.js +13 -12
- package/package.json +23 -31
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021-2024 Clint Heyer
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/dist/src/rx/colour.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { type ReactiveInitial, type ReactiveNonInitial, type ReactiveWritable } from "@ixfx/rx";
|
2
|
-
import type {
|
3
|
-
export type ReactiveColour = ReactiveWritable<
|
4
|
-
setHsl: (hsl:
|
2
|
+
import type { HslScalar } from "@ixfx/visual/colour";
|
3
|
+
export type ReactiveColour = ReactiveWritable<HslScalar> & {
|
4
|
+
setHsl: (hsl: HslScalar) => void;
|
5
5
|
};
|
6
|
-
export declare function colour(initialValue:
|
7
|
-
export declare function colour(): ReactiveColour & ReactiveNonInitial<
|
6
|
+
export declare function colour(initialValue: HslScalar): ReactiveColour & ReactiveInitial<HslScalar>;
|
7
|
+
export declare function colour(): ReactiveColour & ReactiveNonInitial<HslScalar>;
|
8
8
|
//# sourceMappingURL=colour.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"colour.d.ts","sourceRoot":"","sources":["../../../src/rx/colour.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5G,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"colour.d.ts","sourceRoot":"","sources":["../../../src/rx/colour.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,SAAS,CAAC,GAAG;IACzD,MAAM,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC;CAClC,CAAA;AAED,wBAAgB,MAAM,CAAC,YAAY,EAAE,SAAS,GAAG,cAAc,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAC7F,wBAAgB,MAAM,IAAI,cAAc,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC"}
|
@@ -14,7 +14,7 @@ import { Colour } from "@ixfx/visual";
|
|
14
14
|
* @returns
|
15
15
|
*/
|
16
16
|
export declare function domNumberInputValue(targetOrQuery: HTMLInputElement | string, options?: Partial<DomNumberInputValueOptions>): ReactiveInitial<number> & ReactiveWritable<number>;
|
17
|
-
export declare function domHslInputValue(targetOrQuery: HTMLInputElement | string, options?: Partial<DomValueOptions>): ReactiveInitial<Colour.
|
17
|
+
export declare function domHslInputValue(targetOrQuery: HTMLInputElement | string, options?: Partial<DomValueOptions>): ReactiveInitial<Colour.HslScalar> & Reactive<Colour.HslScalar> & ReactiveWritable<Colour.HslScalar>;
|
18
18
|
/**
|
19
19
|
* A stream of values when the a HTMLInputElement changes. Eg a <input type="range">
|
20
20
|
* ```js
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dom-source.d.ts","sourceRoot":"","sources":["../../../src/rx/dom-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIlG,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,gBAAgB,GAAG,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAoCnL;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,gBAAgB,GAAG,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,eAAe,CAAM,GAAG,eAAe,CAAC,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"dom-source.d.ts","sourceRoot":"","sources":["../../../src/rx/dom-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE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,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAiK3C"}
|
@@ -53,19 +53,19 @@ export function domHslInputValue(targetOrQuery, options = {}) {
|
|
53
53
|
const input = domInputValue(targetOrQuery, {
|
54
54
|
...options,
|
55
55
|
upstreamFilter: (value) => {
|
56
|
-
return (typeof value === `object`) ? Colour.
|
56
|
+
return (typeof value === `object`) ? Colour.toCssColour(value) : value;
|
57
57
|
},
|
58
58
|
});
|
59
59
|
const rx = transform(input, v => {
|
60
|
-
return Colour.
|
60
|
+
return Colour.HslSpace.fromCssScalar(v, { ensureSafe: true });
|
61
61
|
});
|
62
62
|
return {
|
63
63
|
...rx,
|
64
64
|
last() {
|
65
|
-
return Colour.
|
65
|
+
return Colour.HslSpace.fromCssScalar(input.last(), { ensureSafe: true });
|
66
66
|
},
|
67
67
|
set(value) {
|
68
|
-
input.set(Colour.
|
68
|
+
input.set(Colour.HslSpace.toCssString(value));
|
69
69
|
},
|
70
70
|
};
|
71
71
|
}
|
@@ -256,8 +256,8 @@ export function domForm(formElOrQuery, options = {}) {
|
|
256
256
|
entries.push([k, vBool]);
|
257
257
|
}
|
258
258
|
else if (typeHint === `colour`) {
|
259
|
-
const vRgb = Colour.
|
260
|
-
entries.push([k, Colour.
|
259
|
+
const vRgb = Colour.toCssColour(vString);
|
260
|
+
entries.push([k, Colour.SrgbSpace.fromCss8bit(vRgb)]);
|
261
261
|
}
|
262
262
|
else {
|
263
263
|
entries.push([k, v.toString()]);
|
@@ -304,8 +304,7 @@ export function domForm(formElOrQuery, options = {}) {
|
|
304
304
|
if (el.type === `color`) {
|
305
305
|
if (typeof value === `object`) {
|
306
306
|
// Try to parse colour if value is an object
|
307
|
-
|
308
|
-
value = Colour.toHex(value);
|
307
|
+
value = Colour.toCssColour(value);
|
309
308
|
}
|
310
309
|
}
|
311
310
|
else if (el.type === `checkbox`) {
|
@@ -331,10 +330,12 @@ export function domForm(formElOrQuery, options = {}) {
|
|
331
330
|
if (!hint) {
|
332
331
|
hint = typeof v;
|
333
332
|
if (hint === `object`) {
|
334
|
-
const rgb = Colour.
|
335
|
-
|
336
|
-
|
337
|
-
|
333
|
+
const rgb = Colour.toColour(v);
|
334
|
+
hint = `colour`;
|
335
|
+
// const rgb = Colour.toColour(v);
|
336
|
+
// if (rgb.success) {
|
337
|
+
// hint = `colour`;
|
338
|
+
// }
|
338
339
|
}
|
339
340
|
typeHints.set(name, hint);
|
340
341
|
}
|
package/package.json
CHANGED
@@ -1,32 +1,24 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
"exports": {
|
26
|
-
".": {
|
27
|
-
"types": "./dist/src/index.d.ts",
|
28
|
-
"import": "./dist/src/index.js"
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
2
|
+
"name": "@ixfx/ui",
|
3
|
+
"version": "0.38.0",
|
4
|
+
"license": "MIT",
|
5
|
+
"type": "module",
|
6
|
+
"sideEffects": false,
|
7
|
+
"files": [
|
8
|
+
"dist/"
|
9
|
+
],
|
10
|
+
"exports": {
|
11
|
+
".": {
|
12
|
+
"types": "./dist/src/index.d.ts",
|
13
|
+
"import": "./dist/src/index.js"
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"dependencies": {
|
17
|
+
"@ixfx/core": "^0.38.0",
|
18
|
+
"@ixfx/collections": "^0.38.0",
|
19
|
+
"@ixfx/rx": "^0.38.0",
|
20
|
+
"@ixfx/dom": "^0.38.0",
|
21
|
+
"@ixfx/visual": "^0.38.0"
|
22
|
+
},
|
23
|
+
"main": "dist/src/index.js"
|
24
|
+
}
|