@thi.ng/color 5.8.15 → 5.8.17

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.
Files changed (3) hide show
  1. package/defcolor.js +9 -1
  2. package/int/int.js +3 -1
  3. package/package.json +15 -15
package/defcolor.js CHANGED
@@ -106,7 +106,15 @@ const defColor = (spec) => {
106
106
  const res = new $Color(...args);
107
107
  return mode !== spec.mode ? convert(res, src, spec.mode, mode) : res.set(src);
108
108
  };
109
- const factory = (src, ...args) => src == null ? new $Color() : isString(src) ? factory(parseCss(src), ...args) : isArrayLike(src) ? isString(src.mode) ? fromColor(src, src.mode, args) : new $Color(src, ...args) : implementsFunction(src, "deref") ? fromColor(src.deref(), src.mode, args) : isNumber(src) ? args.length && args.every(isNumber) ? new $Color(...__ensureArgs([src, ...args])) : fromColor(intArgb32Srgb([], src), "srgb", args) : illegalArgs(`can't create a ${spec.mode} color from: ${src}`);
109
+ const factory = (src, ...args) => src == null ? new $Color() : isString(src) ? factory(parseCss(src), ...args) : isArrayLike(src) ? isString(src.mode) ? fromColor(src, src.mode, args) : new $Color(src, ...args) : implementsFunction(src, "deref") ? fromColor(src.deref(), src.mode, args) : isNumber(src) ? args.length && args.every(isNumber) ? new $Color(
110
+ ...__ensureArgs([src, ...args])
111
+ ) : fromColor(
112
+ intArgb32Srgb([], src),
113
+ "srgb",
114
+ args
115
+ ) : illegalArgs(
116
+ `can't create a ${spec.mode} color from: ${src}`
117
+ );
110
118
  factory.class = $Color;
111
119
  factory.range = [min, max];
112
120
  factory.random = (rnd, buf, idx, stride) => new $Color(buf, idx, stride).randomize(rnd);
package/int/int.js CHANGED
@@ -137,7 +137,9 @@ class ABGR extends Int32 {
137
137
  }
138
138
  declareIndex(ABGR.prototype, "value", 0);
139
139
  const __defInt = (ctor, fromSrgb) => {
140
- const factory = (src, ...args) => src == null ? new ctor() : isNumber(src) ? args.length && args.every(isNumber) ? new ctor([srgbIntArgb32([src, ...args])]) : new ctor([src], ...args) : isString(src) ? factory(parseCss(src)) : isArrayLike(src) ? isString(src.mode) ? new ctor([fromSrgb(srgb(src))], ...args) : new ctor(src, ...args) : implementsFunction(src, "deref") ? new ctor([fromSrgb(srgb(src))], ...args) : illegalArgs(`can't create a ARGB32 color from: ${src}`);
140
+ const factory = (src, ...args) => src == null ? new ctor() : isNumber(src) ? args.length && args.every(isNumber) ? new ctor([srgbIntArgb32([src, ...args])]) : new ctor([src], ...args) : isString(src) ? factory(parseCss(src)) : isArrayLike(src) ? isString(src.mode) ? new ctor([fromSrgb(srgb(src))], ...args) : new ctor(src, ...args) : implementsFunction(src, "deref") ? new ctor([fromSrgb(srgb(src))], ...args) : illegalArgs(
141
+ `can't create a ARGB32 color from: ${src}`
142
+ );
141
143
  factory.class = ctor;
142
144
  factory.range = [[0], [4294967295]];
143
145
  factory.random = (rnd = SYSTEM, buf, idx, stride) => new ctor(buf, idx, stride).set([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/color",
3
- "version": "5.8.15",
3
+ "version": "5.8.17",
4
4
  "description": "Array-based color types, CSS parsing, conversions, transformations, declarative theme generation, gradients, presets",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -44,19 +44,19 @@
44
44
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
45
45
  },
46
46
  "dependencies": {
47
- "@thi.ng/api": "^8.12.16",
48
- "@thi.ng/arrays": "^2.14.12",
49
- "@thi.ng/binary": "^3.6.5",
50
- "@thi.ng/checks": "^3.8.6",
51
- "@thi.ng/compare": "^2.5.4",
52
- "@thi.ng/compose": "^3.0.53",
53
- "@thi.ng/defmulti": "^3.0.93",
54
- "@thi.ng/errors": "^2.6.5",
55
- "@thi.ng/math": "^5.15.5",
56
- "@thi.ng/random": "^4.1.41",
57
- "@thi.ng/strings": "^3.10.0",
58
- "@thi.ng/transducers": "^9.6.28",
59
- "@thi.ng/vectors": "^8.6.23"
47
+ "@thi.ng/api": "^8.12.17",
48
+ "@thi.ng/arrays": "^2.14.13",
49
+ "@thi.ng/binary": "^3.6.6",
50
+ "@thi.ng/checks": "^3.8.7",
51
+ "@thi.ng/compare": "^2.5.5",
52
+ "@thi.ng/compose": "^3.0.54",
53
+ "@thi.ng/defmulti": "^3.0.94",
54
+ "@thi.ng/errors": "^2.6.6",
55
+ "@thi.ng/math": "^5.15.6",
56
+ "@thi.ng/random": "^4.1.42",
57
+ "@thi.ng/strings": "^3.10.1",
58
+ "@thi.ng/transducers": "^9.6.30",
59
+ "@thi.ng/vectors": "^8.6.24"
60
60
  },
61
61
  "devDependencies": {
62
62
  "esbuild": "^0.27.2",
@@ -447,5 +447,5 @@
447
447
  "vectors"
448
448
  ]
449
449
  },
450
- "gitHead": "7a21075f27ba00b28a6eb77e70918a4c7f4e6e68\n"
450
+ "gitHead": "1107498d31504dc63d1a457b5def387d7a134f69\n"
451
451
  }