@ixfx/ui 0.37.0 → 0.38.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,8 +1,8 @@
1
1
  import { type ReactiveInitial, type ReactiveNonInitial, type ReactiveWritable } from "@ixfx/rx";
2
- import type { HslRelative } from "@ixfx/visual/colour";
3
- export type ReactiveColour = ReactiveWritable<HslRelative> & {
4
- setHsl: (hsl: HslRelative) => void;
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: HslRelative): ReactiveColour & ReactiveInitial<HslRelative>;
7
- export declare function colour(): ReactiveColour & ReactiveNonInitial<HslRelative>;
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,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG;IAC3D,MAAM,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;CACpC,CAAA;AAED,wBAAgB,MAAM,CAAC,YAAY,EAAE,WAAW,GAAG,cAAc,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;AACjG,wBAAgB,MAAM,IAAI,cAAc,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC"}
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.HslRelative> & Reactive<Colour.HslRelative> & ReactiveWritable<Colour.HslRelative>;
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,MAA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AAC;IAClD,EAAE,EAAE,eAAe,CAAA;CACpB,GAAG,eAAe,CAAC,CAAC,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.toHex(value) : value;
56
+ return (typeof value === `object`) ? Colour.toCssColour(value) : value;
57
57
  },
58
58
  });
59
59
  const rx = transform(input, v => {
60
- return Colour.toHsl(v, true);
60
+ return Colour.HslSpace.fromCssScalar(v, { ensureSafe: true });
61
61
  });
62
62
  return {
63
63
  ...rx,
64
64
  last() {
65
- return Colour.toHsl(input.last(), true);
65
+ return Colour.HslSpace.fromCssScalar(input.last(), { ensureSafe: true });
66
66
  },
67
67
  set(value) {
68
- input.set(Colour.toHex(value));
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.toString(vString);
260
- entries.push([k, Colour.toRgb(vRgb)]);
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
- //const c = Colour.resolve(value, true);
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.parseRgbObject(v);
335
- if (rgb.success) {
336
- hint = `colour`;
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
  }
@@ -3,7 +3,7 @@ import { resolveEl } from "@ixfx/dom";
3
3
  import { getPathsAndData } from "@ixfx/core/records";
4
4
  import * as Rx from "@ixfx/rx";
5
5
  import * as RxFrom from "@ixfx/rx/from";
6
- import { getFromKeys } from "@ixfx/core/maps";
6
+ import { findBySomeKey as mapFindBySomeKey } from "@ixfx/core/maps";
7
7
  import { afterMatch, beforeMatch, stringSegmentsWholeToEnd, stringSegmentsWholeToFirst } from "@ixfx/core/text";
8
8
  import { QueueMutable } from "@ixfx/collections";
9
9
  /**
@@ -565,7 +565,7 @@ export const elements = (source, options) => {
565
565
  });
566
566
  }
567
567
  const findBind = (path) => {
568
- const bind = getFromKeys(binds, stringSegmentsWholeToEnd(path));
568
+ const bind = mapFindBySomeKey(binds, stringSegmentsWholeToEnd(path));
569
569
  if (bind !== undefined)
570
570
  return bind;
571
571
  if (!path.includes(`.`))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixfx/ui",
3
- "version": "0.37.0",
3
+ "version": "0.38.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -14,11 +14,11 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ixfx/core": "^0.37.0",
18
- "@ixfx/collections": "^0.37.0",
19
- "@ixfx/dom": "^0.37.0",
20
- "@ixfx/visual": "^0.37.0",
21
- "@ixfx/rx": "^0.37.0"
17
+ "@ixfx/core": "^0.39.0",
18
+ "@ixfx/collections": "^0.39.0",
19
+ "@ixfx/dom": "^0.39.0",
20
+ "@ixfx/visual": "^0.38.1",
21
+ "@ixfx/rx": "^0.38.1"
22
22
  },
23
23
  "main": "dist/src/index.js"
24
24
  }