colorsort-js 3.0.0 → 3.0.2

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/README.md CHANGED
@@ -11,9 +11,8 @@ npm i colorsort-js
11
11
  ## Usage
12
12
 
13
13
  ```javascript
14
- import { auto } from 'colorsort-js'
14
+ import { auto, multiAuto } from 'colorsort-js'
15
15
  import DATA from 'colorsort-js/trained.json' with { type: 'json' }
16
- import { multiAuto } from './auto-sort'
17
16
 
18
17
  const colors = ['#000000', '#fff000', '#000fff']
19
18
 
package/dist/colorsort.js CHANGED
@@ -5133,7 +5133,7 @@ function pl(t) {
5133
5133
  e.length / t.length,
5134
5134
  // ...hueDeltaMags.slice(0, 4),
5135
5135
  // ...chromaMags.slice(0, 4),
5136
- ...s.slice(0, 1)
5136
+ ...s.length ? s.slice(0, 1) : [0]
5137
5137
  ];
5138
5138
  return {
5139
5139
  type: R,
@@ -5406,12 +5406,13 @@ function Tl(t, e) {
5406
5406
  }
5407
5407
  const Dl = 15;
5408
5408
  function Gl(t, e, n = Dl) {
5409
- return Vo(t, e).slice(0, n).map((o) => {
5410
- const s = Wo.find((a) => a.mid === o)?.fn(t), i = Z0(t);
5409
+ return Vo(t, e).slice(0, n).map((o, s) => {
5410
+ const i = Wo.find((c) => c.mid === o)?.fn(t), a = Z0(i);
5411
5411
  return {
5412
- sorted: s,
5412
+ sorted: i,
5413
5413
  mid: o,
5414
- metrics: i
5414
+ index: s,
5415
+ metrics: a
5415
5416
  };
5416
5417
  }).sort((o, s) => o.metrics.avgAngleChange - s.metrics.avgAngleChange);
5417
5418
  }