@inf-monkeys-tech/monkeys-design 0.4.55 → 0.4.56
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 +29 -5
- package/dist/{LandingPage-CR5KyIwR.d.mts → LandingPage-D7FF9gnM.d.mts} +3 -3
- package/dist/{LandingPage-CR5KyIwR.d.ts → LandingPage-D7FF9gnM.d.ts} +3 -3
- package/dist/components/base/index.d.mts +3 -3
- package/dist/components/base/index.d.ts +3 -3
- package/dist/components/base/index.js +7229 -2042
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +7215 -2052
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/data-explorer/index.d.mts +1 -1
- package/dist/components/data-explorer/index.d.ts +1 -1
- package/dist/components/data-explorer/index.js +166 -10
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs +167 -11
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/components/layout/index.d.mts +1 -1
- package/dist/components/layout/index.d.ts +1 -1
- package/dist/components/layout/index.js +769 -1603
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +772 -1607
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/components/login/index.d.mts +29 -29
- package/dist/components/login/index.d.ts +29 -29
- package/dist/components/toast/index.d.mts +2 -6
- package/dist/components/toast/index.d.ts +2 -6
- package/dist/components/toast/index.js +173 -11
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/toast/index.mjs +174 -12
- package/dist/components/toast/index.mjs.map +1 -1
- package/dist/components/toolbar/index.js +231 -21
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/toolbar/index.mjs +231 -21
- package/dist/components/toolbar/index.mjs.map +1 -1
- package/dist/components/workbench/index.d.mts +6 -6
- package/dist/components/workbench/index.d.ts +6 -6
- package/dist/components/workbench/index.js +2281 -1030
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +2282 -1031
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/icons/oauth/index.d.mts +5 -5
- package/dist/icons/oauth/index.d.ts +5 -5
- package/dist/index.d.mts +12 -8
- package/dist/index.d.ts +12 -8
- package/dist/index.js +7911 -4772
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7874 -4773
- package/dist/index.mjs.map +1 -1
- package/dist/locale/index.d.mts +236 -0
- package/dist/locale/index.d.ts +236 -0
- package/dist/locale/index.js +338 -0
- package/dist/locale/index.js.map +1 -0
- package/dist/locale/index.mjs +332 -0
- package/dist/locale/index.mjs.map +1 -0
- package/dist/palette/index.js +259 -2748
- package/dist/palette/index.js.map +1 -1
- package/dist/palette/index.mjs +255 -2748
- package/dist/palette/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +51 -0
- package/dist/provider/index.d.ts +51 -0
- package/dist/provider/index.js +2688 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/provider/index.mjs +2677 -0
- package/dist/provider/index.mjs.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/theme-CJlW1TtA.d.mts +142 -0
- package/dist/{theme-CUATVszl.d.mts → theme-CplaoMqT.d.mts} +2 -2
- package/dist/{theme-BuvXrHFY.d.ts → theme-DPVX8CfK.d.ts} +2 -2
- package/dist/theme-r7GYhlCk.d.ts +142 -0
- package/dist/theme-system/index.d.mts +5 -92
- package/dist/theme-system/index.d.ts +5 -92
- package/dist/theme-system/index.js +295 -4329
- package/dist/theme-system/index.js.map +1 -1
- package/dist/theme-system/index.mjs +183 -4221
- package/dist/theme-system/index.mjs.map +1 -1
- package/dist/themes/artist/index.d.mts +3 -3
- package/dist/themes/artist/index.d.ts +3 -3
- package/dist/themes/bsd/index.d.mts +3 -3
- package/dist/themes/bsd/index.d.ts +3 -3
- package/dist/themes/concept/index.d.mts +2 -2
- package/dist/themes/concept/index.d.ts +2 -2
- package/dist/themes/default/index.d.mts +3 -3
- package/dist/themes/default/index.d.ts +3 -3
- package/dist/types-BkWanMMW.d.mts +159 -0
- package/dist/types-BkWanMMW.d.ts +159 -0
- package/dist/types-DpRjPpxY.d.mts +93 -0
- package/dist/{types-CL6yBAmi.d.mts → types-DvHvN4RJ.d.mts} +514 -10
- package/dist/{types-CL6yBAmi.d.ts → types-DvHvN4RJ.d.ts} +514 -10
- package/dist/types-vkJZUngT.d.ts +93 -0
- package/package.json +52 -4
- package/dist/theme-CPXLKeLc.d.mts +0 -101
- package/dist/theme-Chdxsqt1.d.ts +0 -101
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import '@radix-ui/react-context-menu';
|
|
4
|
-
import 'react-dom';
|
|
5
|
-
import '@radix-ui/react-dropdown-menu';
|
|
6
|
-
import '@dnd-kit/core';
|
|
7
|
-
import '@dnd-kit/sortable';
|
|
8
|
-
import '@dnd-kit/utilities';
|
|
1
|
+
import chroma2 from 'chroma-js';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
9
3
|
|
|
10
4
|
var __create = Object.create;
|
|
11
5
|
var __defProp = Object.defineProperty;
|
|
@@ -724,7 +718,7 @@ var require_lodash = __commonJS({
|
|
|
724
718
|
}
|
|
725
719
|
var runInContext = (function runInContext2(context) {
|
|
726
720
|
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
|
|
727
|
-
var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp,
|
|
721
|
+
var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String = context.String, TypeError2 = context.TypeError;
|
|
728
722
|
var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
|
|
729
723
|
var coreJsData = context["__core-js_shared__"];
|
|
730
724
|
var funcToString = funcProto.toString;
|
|
@@ -751,10 +745,10 @@ var require_lodash = __commonJS({
|
|
|
751
745
|
})();
|
|
752
746
|
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
|
753
747
|
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
|
|
754
|
-
var DataView = getNative(context, "DataView"),
|
|
748
|
+
var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
|
|
755
749
|
var metaMap = WeakMap && new WeakMap();
|
|
756
750
|
var realNames = {};
|
|
757
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(
|
|
751
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
|
|
758
752
|
var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
|
|
759
753
|
function lodash(value) {
|
|
760
754
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
@@ -999,7 +993,7 @@ var require_lodash = __commonJS({
|
|
|
999
993
|
this.size = 0;
|
|
1000
994
|
this.__data__ = {
|
|
1001
995
|
"hash": new Hash(),
|
|
1002
|
-
"map": new (
|
|
996
|
+
"map": new (Map || ListCache)(),
|
|
1003
997
|
"string": new Hash()
|
|
1004
998
|
};
|
|
1005
999
|
}
|
|
@@ -1064,7 +1058,7 @@ var require_lodash = __commonJS({
|
|
|
1064
1058
|
var data = this.__data__;
|
|
1065
1059
|
if (data instanceof ListCache) {
|
|
1066
1060
|
var pairs = data.__data__;
|
|
1067
|
-
if (!
|
|
1061
|
+
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
1068
1062
|
pairs.push([key, value]);
|
|
1069
1063
|
this.size = ++data.size;
|
|
1070
1064
|
return this;
|
|
@@ -1081,7 +1075,7 @@ var require_lodash = __commonJS({
|
|
|
1081
1075
|
Stack.prototype.has = stackHas;
|
|
1082
1076
|
Stack.prototype.set = stackSet;
|
|
1083
1077
|
function arrayLikeKeys(value, inherited) {
|
|
1084
|
-
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length,
|
|
1078
|
+
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String) : [], length = result2.length;
|
|
1085
1079
|
for (var key in value) {
|
|
1086
1080
|
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1087
1081
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -2828,7 +2822,7 @@ var require_lodash = __commonJS({
|
|
|
2828
2822
|
return result2;
|
|
2829
2823
|
};
|
|
2830
2824
|
var getTag = baseGetTag;
|
|
2831
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag ||
|
|
2825
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
2832
2826
|
getTag = function(value) {
|
|
2833
2827
|
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
|
|
2834
2828
|
if (ctorString) {
|
|
@@ -4182,7 +4176,7 @@ var require_lodash = __commonJS({
|
|
|
4182
4176
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
4183
4177
|
return baseIsMatch(object, source, getMatchData(source), customizer);
|
|
4184
4178
|
}
|
|
4185
|
-
function
|
|
4179
|
+
function isNaN(value) {
|
|
4186
4180
|
return isNumber(value) && value != +value;
|
|
4187
4181
|
}
|
|
4188
4182
|
function isNative(value) {
|
|
@@ -4255,8 +4249,8 @@ var require_lodash = __commonJS({
|
|
|
4255
4249
|
}
|
|
4256
4250
|
value = toNumber(value);
|
|
4257
4251
|
if (value === INFINITY || value === -INFINITY) {
|
|
4258
|
-
var
|
|
4259
|
-
return
|
|
4252
|
+
var sign = value < 0 ? -1 : 1;
|
|
4253
|
+
return sign * MAX_INTEGER;
|
|
4260
4254
|
}
|
|
4261
4255
|
return value === value ? value : 0;
|
|
4262
4256
|
}
|
|
@@ -4550,7 +4544,7 @@ var require_lodash = __commonJS({
|
|
|
4550
4544
|
number = toNumber(number);
|
|
4551
4545
|
return baseInRange(number, start, end);
|
|
4552
4546
|
}
|
|
4553
|
-
function
|
|
4547
|
+
function random(lower, upper, floating) {
|
|
4554
4548
|
if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
|
|
4555
4549
|
upper = floating = undefined2;
|
|
4556
4550
|
}
|
|
@@ -5010,8 +5004,8 @@ var require_lodash = __commonJS({
|
|
|
5010
5004
|
var divide = createMathOperation(function(dividend, divisor) {
|
|
5011
5005
|
return dividend / divisor;
|
|
5012
5006
|
}, 1);
|
|
5013
|
-
var
|
|
5014
|
-
function
|
|
5007
|
+
var floor = createRound("floor");
|
|
5008
|
+
function max(array) {
|
|
5015
5009
|
return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2;
|
|
5016
5010
|
}
|
|
5017
5011
|
function maxBy(array, iteratee2) {
|
|
@@ -5023,16 +5017,16 @@ var require_lodash = __commonJS({
|
|
|
5023
5017
|
function meanBy(array, iteratee2) {
|
|
5024
5018
|
return baseMean(array, getIteratee(iteratee2, 2));
|
|
5025
5019
|
}
|
|
5026
|
-
function
|
|
5020
|
+
function min(array) {
|
|
5027
5021
|
return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2;
|
|
5028
5022
|
}
|
|
5029
5023
|
function minBy(array, iteratee2) {
|
|
5030
5024
|
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
|
|
5031
5025
|
}
|
|
5032
|
-
var
|
|
5026
|
+
var multiply = createMathOperation(function(multiplier, multiplicand) {
|
|
5033
5027
|
return multiplier * multiplicand;
|
|
5034
5028
|
}, 1);
|
|
5035
|
-
var
|
|
5029
|
+
var round = createRound("round");
|
|
5036
5030
|
var subtract = createMathOperation(function(minuend, subtrahend) {
|
|
5037
5031
|
return minuend - subtrahend;
|
|
5038
5032
|
}, 0);
|
|
@@ -5221,7 +5215,7 @@ var require_lodash = __commonJS({
|
|
|
5221
5215
|
lodash.findLast = findLast;
|
|
5222
5216
|
lodash.findLastIndex = findLastIndex;
|
|
5223
5217
|
lodash.findLastKey = findLastKey;
|
|
5224
|
-
lodash.floor =
|
|
5218
|
+
lodash.floor = floor;
|
|
5225
5219
|
lodash.forEach = forEach;
|
|
5226
5220
|
lodash.forEachRight = forEachRight;
|
|
5227
5221
|
lodash.forIn = forIn;
|
|
@@ -5259,7 +5253,7 @@ var require_lodash = __commonJS({
|
|
|
5259
5253
|
lodash.isMap = isMap;
|
|
5260
5254
|
lodash.isMatch = isMatch;
|
|
5261
5255
|
lodash.isMatchWith = isMatchWith;
|
|
5262
|
-
lodash.isNaN =
|
|
5256
|
+
lodash.isNaN = isNaN;
|
|
5263
5257
|
lodash.isNative = isNative;
|
|
5264
5258
|
lodash.isNil = isNil;
|
|
5265
5259
|
lodash.isNull = isNull;
|
|
@@ -5284,18 +5278,18 @@ var require_lodash = __commonJS({
|
|
|
5284
5278
|
lodash.lowerFirst = lowerFirst;
|
|
5285
5279
|
lodash.lt = lt;
|
|
5286
5280
|
lodash.lte = lte;
|
|
5287
|
-
lodash.max =
|
|
5281
|
+
lodash.max = max;
|
|
5288
5282
|
lodash.maxBy = maxBy;
|
|
5289
5283
|
lodash.mean = mean;
|
|
5290
5284
|
lodash.meanBy = meanBy;
|
|
5291
|
-
lodash.min =
|
|
5285
|
+
lodash.min = min;
|
|
5292
5286
|
lodash.minBy = minBy;
|
|
5293
5287
|
lodash.stubArray = stubArray;
|
|
5294
5288
|
lodash.stubFalse = stubFalse;
|
|
5295
5289
|
lodash.stubObject = stubObject;
|
|
5296
5290
|
lodash.stubString = stubString;
|
|
5297
5291
|
lodash.stubTrue = stubTrue;
|
|
5298
|
-
lodash.multiply =
|
|
5292
|
+
lodash.multiply = multiply;
|
|
5299
5293
|
lodash.nth = nth;
|
|
5300
5294
|
lodash.noConflict = noConflict;
|
|
5301
5295
|
lodash.noop = noop;
|
|
@@ -5304,13 +5298,13 @@ var require_lodash = __commonJS({
|
|
|
5304
5298
|
lodash.padEnd = padEnd;
|
|
5305
5299
|
lodash.padStart = padStart;
|
|
5306
5300
|
lodash.parseInt = parseInt2;
|
|
5307
|
-
lodash.random =
|
|
5301
|
+
lodash.random = random;
|
|
5308
5302
|
lodash.reduce = reduce;
|
|
5309
5303
|
lodash.reduceRight = reduceRight;
|
|
5310
5304
|
lodash.repeat = repeat;
|
|
5311
5305
|
lodash.replace = replace;
|
|
5312
5306
|
lodash.result = result;
|
|
5313
|
-
lodash.round =
|
|
5307
|
+
lodash.round = round;
|
|
5314
5308
|
lodash.runInContext = runInContext2;
|
|
5315
5309
|
lodash.sample = sample;
|
|
5316
5310
|
lodash.size = size;
|
|
@@ -5533,2506 +5527,13 @@ var require_lodash = __commonJS({
|
|
|
5533
5527
|
}
|
|
5534
5528
|
});
|
|
5535
5529
|
|
|
5536
|
-
// node_modules/chroma-js/src/utils/limit.js
|
|
5537
|
-
var limit_default = (x, low = 0, high = 1) => {
|
|
5538
|
-
return min(max(low, x), high);
|
|
5539
|
-
};
|
|
5540
|
-
|
|
5541
|
-
// node_modules/chroma-js/src/utils/clip_rgb.js
|
|
5542
|
-
var clip_rgb_default = (rgb2) => {
|
|
5543
|
-
rgb2._clipped = false;
|
|
5544
|
-
rgb2._unclipped = rgb2.slice(0);
|
|
5545
|
-
for (let i = 0; i <= 3; i++) {
|
|
5546
|
-
if (i < 3) {
|
|
5547
|
-
if (rgb2[i] < 0 || rgb2[i] > 255) rgb2._clipped = true;
|
|
5548
|
-
rgb2[i] = limit_default(rgb2[i], 0, 255);
|
|
5549
|
-
} else if (i === 3) {
|
|
5550
|
-
rgb2[i] = limit_default(rgb2[i], 0, 1);
|
|
5551
|
-
}
|
|
5552
|
-
}
|
|
5553
|
-
return rgb2;
|
|
5554
|
-
};
|
|
5555
|
-
|
|
5556
|
-
// node_modules/chroma-js/src/utils/type.js
|
|
5557
|
-
var classToType = {};
|
|
5558
|
-
for (let name of [
|
|
5559
|
-
"Boolean",
|
|
5560
|
-
"Number",
|
|
5561
|
-
"String",
|
|
5562
|
-
"Function",
|
|
5563
|
-
"Array",
|
|
5564
|
-
"Date",
|
|
5565
|
-
"RegExp",
|
|
5566
|
-
"Undefined",
|
|
5567
|
-
"Null"
|
|
5568
|
-
]) {
|
|
5569
|
-
classToType[`[object ${name}]`] = name.toLowerCase();
|
|
5570
|
-
}
|
|
5571
|
-
function type_default(obj) {
|
|
5572
|
-
return classToType[Object.prototype.toString.call(obj)] || "object";
|
|
5573
|
-
}
|
|
5574
|
-
|
|
5575
|
-
// node_modules/chroma-js/src/utils/unpack.js
|
|
5576
|
-
var unpack_default = (args, keyOrder = null) => {
|
|
5577
|
-
if (args.length >= 3) return Array.prototype.slice.call(args);
|
|
5578
|
-
if (type_default(args[0]) == "object" && keyOrder) {
|
|
5579
|
-
return keyOrder.split("").filter((k) => args[0][k] !== void 0).map((k) => args[0][k]);
|
|
5580
|
-
}
|
|
5581
|
-
return args[0];
|
|
5582
|
-
};
|
|
5583
|
-
|
|
5584
|
-
// node_modules/chroma-js/src/utils/last.js
|
|
5585
|
-
var last_default = (args) => {
|
|
5586
|
-
if (args.length < 2) return null;
|
|
5587
|
-
const l = args.length - 1;
|
|
5588
|
-
if (type_default(args[l]) == "string") return args[l].toLowerCase();
|
|
5589
|
-
return null;
|
|
5590
|
-
};
|
|
5591
|
-
|
|
5592
|
-
// node_modules/chroma-js/src/utils/index.js
|
|
5593
|
-
var { PI, min, max } = Math;
|
|
5594
|
-
var TWOPI = PI * 2;
|
|
5595
|
-
var PITHIRD = PI / 3;
|
|
5596
|
-
var DEG2RAD = PI / 180;
|
|
5597
|
-
var RAD2DEG = 180 / PI;
|
|
5598
|
-
|
|
5599
|
-
// node_modules/chroma-js/src/io/input.js
|
|
5600
|
-
var input_default = {
|
|
5601
|
-
format: {},
|
|
5602
|
-
autodetect: []
|
|
5603
|
-
};
|
|
5604
|
-
|
|
5605
|
-
// node_modules/chroma-js/src/Color.js
|
|
5606
|
-
var Color = class {
|
|
5607
|
-
constructor(...args) {
|
|
5608
|
-
const me = this;
|
|
5609
|
-
if (type_default(args[0]) === "object" && args[0].constructor && args[0].constructor === this.constructor) {
|
|
5610
|
-
return args[0];
|
|
5611
|
-
}
|
|
5612
|
-
let mode = last_default(args);
|
|
5613
|
-
let autodetect = false;
|
|
5614
|
-
if (!mode) {
|
|
5615
|
-
autodetect = true;
|
|
5616
|
-
if (!input_default.sorted) {
|
|
5617
|
-
input_default.autodetect = input_default.autodetect.sort((a, b) => b.p - a.p);
|
|
5618
|
-
input_default.sorted = true;
|
|
5619
|
-
}
|
|
5620
|
-
for (let chk of input_default.autodetect) {
|
|
5621
|
-
mode = chk.test(...args);
|
|
5622
|
-
if (mode) break;
|
|
5623
|
-
}
|
|
5624
|
-
}
|
|
5625
|
-
if (input_default.format[mode]) {
|
|
5626
|
-
const rgb2 = input_default.format[mode].apply(
|
|
5627
|
-
null,
|
|
5628
|
-
autodetect ? args : args.slice(0, -1)
|
|
5629
|
-
);
|
|
5630
|
-
me._rgb = clip_rgb_default(rgb2);
|
|
5631
|
-
} else {
|
|
5632
|
-
throw new Error("unknown format: " + args);
|
|
5633
|
-
}
|
|
5634
|
-
if (me._rgb.length === 3) me._rgb.push(1);
|
|
5635
|
-
}
|
|
5636
|
-
toString() {
|
|
5637
|
-
if (type_default(this.hex) == "function") return this.hex();
|
|
5638
|
-
return `[${this._rgb.join(",")}]`;
|
|
5639
|
-
}
|
|
5640
|
-
};
|
|
5641
|
-
var Color_default = Color;
|
|
5642
|
-
|
|
5643
|
-
// node_modules/chroma-js/src/version.js
|
|
5644
|
-
var version = "2.6.0";
|
|
5645
|
-
|
|
5646
|
-
// node_modules/chroma-js/src/chroma.js
|
|
5647
|
-
var chroma = (...args) => {
|
|
5648
|
-
return new chroma.Color(...args);
|
|
5649
|
-
};
|
|
5650
|
-
chroma.Color = Color_default;
|
|
5651
|
-
chroma.version = version;
|
|
5652
|
-
var chroma_default = chroma;
|
|
5653
|
-
|
|
5654
|
-
// node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js
|
|
5655
|
-
var cmyk2rgb = (...args) => {
|
|
5656
|
-
args = unpack_default(args, "cmyk");
|
|
5657
|
-
const [c, m, y, k] = args;
|
|
5658
|
-
const alpha = args.length > 4 ? args[4] : 1;
|
|
5659
|
-
if (k === 1) return [0, 0, 0, alpha];
|
|
5660
|
-
return [
|
|
5661
|
-
c >= 1 ? 0 : 255 * (1 - c) * (1 - k),
|
|
5662
|
-
// r
|
|
5663
|
-
m >= 1 ? 0 : 255 * (1 - m) * (1 - k),
|
|
5664
|
-
// g
|
|
5665
|
-
y >= 1 ? 0 : 255 * (1 - y) * (1 - k),
|
|
5666
|
-
// b
|
|
5667
|
-
alpha
|
|
5668
|
-
];
|
|
5669
|
-
};
|
|
5670
|
-
var cmyk2rgb_default = cmyk2rgb;
|
|
5671
|
-
|
|
5672
|
-
// node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js
|
|
5673
|
-
var { max: max2 } = Math;
|
|
5674
|
-
var rgb2cmyk = (...args) => {
|
|
5675
|
-
let [r, g, b] = unpack_default(args, "rgb");
|
|
5676
|
-
r = r / 255;
|
|
5677
|
-
g = g / 255;
|
|
5678
|
-
b = b / 255;
|
|
5679
|
-
const k = 1 - max2(r, max2(g, b));
|
|
5680
|
-
const f = k < 1 ? 1 / (1 - k) : 0;
|
|
5681
|
-
const c = (1 - r - k) * f;
|
|
5682
|
-
const m = (1 - g - k) * f;
|
|
5683
|
-
const y = (1 - b - k) * f;
|
|
5684
|
-
return [c, m, y, k];
|
|
5685
|
-
};
|
|
5686
|
-
var rgb2cmyk_default = rgb2cmyk;
|
|
5687
|
-
|
|
5688
|
-
// node_modules/chroma-js/src/io/cmyk/index.js
|
|
5689
|
-
Color_default.prototype.cmyk = function() {
|
|
5690
|
-
return rgb2cmyk_default(this._rgb);
|
|
5691
|
-
};
|
|
5692
|
-
chroma_default.cmyk = (...args) => new Color_default(...args, "cmyk");
|
|
5693
|
-
input_default.format.cmyk = cmyk2rgb_default;
|
|
5694
|
-
input_default.autodetect.push({
|
|
5695
|
-
p: 2,
|
|
5696
|
-
test: (...args) => {
|
|
5697
|
-
args = unpack_default(args, "cmyk");
|
|
5698
|
-
if (type_default(args) === "array" && args.length === 4) {
|
|
5699
|
-
return "cmyk";
|
|
5700
|
-
}
|
|
5701
|
-
}
|
|
5702
|
-
});
|
|
5703
|
-
|
|
5704
|
-
// node_modules/chroma-js/src/io/css/hsl2css.js
|
|
5705
|
-
var rnd = (a) => Math.round(a * 100) / 100;
|
|
5706
|
-
var hsl2css = (...args) => {
|
|
5707
|
-
const hsla = unpack_default(args, "hsla");
|
|
5708
|
-
let mode = last_default(args) || "lsa";
|
|
5709
|
-
hsla[0] = rnd(hsla[0] || 0);
|
|
5710
|
-
hsla[1] = rnd(hsla[1] * 100) + "%";
|
|
5711
|
-
hsla[2] = rnd(hsla[2] * 100) + "%";
|
|
5712
|
-
if (mode === "hsla" || hsla.length > 3 && hsla[3] < 1) {
|
|
5713
|
-
hsla[3] = hsla.length > 3 ? hsla[3] : 1;
|
|
5714
|
-
mode = "hsla";
|
|
5715
|
-
} else {
|
|
5716
|
-
hsla.length = 3;
|
|
5717
|
-
}
|
|
5718
|
-
return `${mode}(${hsla.join(",")})`;
|
|
5719
|
-
};
|
|
5720
|
-
var hsl2css_default = hsl2css;
|
|
5721
|
-
|
|
5722
|
-
// node_modules/chroma-js/src/io/hsl/rgb2hsl.js
|
|
5723
|
-
var rgb2hsl = (...args) => {
|
|
5724
|
-
args = unpack_default(args, "rgba");
|
|
5725
|
-
let [r, g, b] = args;
|
|
5726
|
-
r /= 255;
|
|
5727
|
-
g /= 255;
|
|
5728
|
-
b /= 255;
|
|
5729
|
-
const minRgb = min(r, g, b);
|
|
5730
|
-
const maxRgb = max(r, g, b);
|
|
5731
|
-
const l = (maxRgb + minRgb) / 2;
|
|
5732
|
-
let s, h;
|
|
5733
|
-
if (maxRgb === minRgb) {
|
|
5734
|
-
s = 0;
|
|
5735
|
-
h = Number.NaN;
|
|
5736
|
-
} else {
|
|
5737
|
-
s = l < 0.5 ? (maxRgb - minRgb) / (maxRgb + minRgb) : (maxRgb - minRgb) / (2 - maxRgb - minRgb);
|
|
5738
|
-
}
|
|
5739
|
-
if (r == maxRgb) h = (g - b) / (maxRgb - minRgb);
|
|
5740
|
-
else if (g == maxRgb) h = 2 + (b - r) / (maxRgb - minRgb);
|
|
5741
|
-
else if (b == maxRgb) h = 4 + (r - g) / (maxRgb - minRgb);
|
|
5742
|
-
h *= 60;
|
|
5743
|
-
if (h < 0) h += 360;
|
|
5744
|
-
if (args.length > 3 && args[3] !== void 0) return [h, s, l, args[3]];
|
|
5745
|
-
return [h, s, l];
|
|
5746
|
-
};
|
|
5747
|
-
var rgb2hsl_default = rgb2hsl;
|
|
5748
|
-
|
|
5749
|
-
// node_modules/chroma-js/src/io/css/rgb2css.js
|
|
5750
|
-
var { round } = Math;
|
|
5751
|
-
var rgb2css = (...args) => {
|
|
5752
|
-
const rgba = unpack_default(args, "rgba");
|
|
5753
|
-
let mode = last_default(args) || "rgb";
|
|
5754
|
-
if (mode.substr(0, 3) == "hsl") {
|
|
5755
|
-
return hsl2css_default(rgb2hsl_default(rgba), mode);
|
|
5756
|
-
}
|
|
5757
|
-
rgba[0] = round(rgba[0]);
|
|
5758
|
-
rgba[1] = round(rgba[1]);
|
|
5759
|
-
rgba[2] = round(rgba[2]);
|
|
5760
|
-
if (mode === "rgba" || rgba.length > 3 && rgba[3] < 1) {
|
|
5761
|
-
rgba[3] = rgba.length > 3 ? rgba[3] : 1;
|
|
5762
|
-
mode = "rgba";
|
|
5763
|
-
}
|
|
5764
|
-
return `${mode}(${rgba.slice(0, mode === "rgb" ? 3 : 4).join(",")})`;
|
|
5765
|
-
};
|
|
5766
|
-
var rgb2css_default = rgb2css;
|
|
5767
|
-
|
|
5768
|
-
// node_modules/chroma-js/src/io/hsl/hsl2rgb.js
|
|
5769
|
-
var { round: round2 } = Math;
|
|
5770
|
-
var hsl2rgb = (...args) => {
|
|
5771
|
-
args = unpack_default(args, "hsl");
|
|
5772
|
-
const [h, s, l] = args;
|
|
5773
|
-
let r, g, b;
|
|
5774
|
-
if (s === 0) {
|
|
5775
|
-
r = g = b = l * 255;
|
|
5776
|
-
} else {
|
|
5777
|
-
const t3 = [0, 0, 0];
|
|
5778
|
-
const c = [0, 0, 0];
|
|
5779
|
-
const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
5780
|
-
const t1 = 2 * l - t2;
|
|
5781
|
-
const h_ = h / 360;
|
|
5782
|
-
t3[0] = h_ + 1 / 3;
|
|
5783
|
-
t3[1] = h_;
|
|
5784
|
-
t3[2] = h_ - 1 / 3;
|
|
5785
|
-
for (let i = 0; i < 3; i++) {
|
|
5786
|
-
if (t3[i] < 0) t3[i] += 1;
|
|
5787
|
-
if (t3[i] > 1) t3[i] -= 1;
|
|
5788
|
-
if (6 * t3[i] < 1) c[i] = t1 + (t2 - t1) * 6 * t3[i];
|
|
5789
|
-
else if (2 * t3[i] < 1) c[i] = t2;
|
|
5790
|
-
else if (3 * t3[i] < 2) c[i] = t1 + (t2 - t1) * (2 / 3 - t3[i]) * 6;
|
|
5791
|
-
else c[i] = t1;
|
|
5792
|
-
}
|
|
5793
|
-
[r, g, b] = [round2(c[0] * 255), round2(c[1] * 255), round2(c[2] * 255)];
|
|
5794
|
-
}
|
|
5795
|
-
if (args.length > 3) {
|
|
5796
|
-
return [r, g, b, args[3]];
|
|
5797
|
-
}
|
|
5798
|
-
return [r, g, b, 1];
|
|
5799
|
-
};
|
|
5800
|
-
var hsl2rgb_default = hsl2rgb;
|
|
5801
|
-
|
|
5802
|
-
// node_modules/chroma-js/src/io/css/css2rgb.js
|
|
5803
|
-
var RE_RGB = /^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/;
|
|
5804
|
-
var RE_RGBA = /^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/;
|
|
5805
|
-
var RE_RGB_PCT = /^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
|
|
5806
|
-
var RE_RGBA_PCT = /^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
|
|
5807
|
-
var RE_HSL = /^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
|
|
5808
|
-
var RE_HSLA = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
|
|
5809
|
-
var { round: round3 } = Math;
|
|
5810
|
-
var css2rgb = (css) => {
|
|
5811
|
-
css = css.toLowerCase().trim();
|
|
5812
|
-
let m;
|
|
5813
|
-
if (input_default.format.named) {
|
|
5814
|
-
try {
|
|
5815
|
-
return input_default.format.named(css);
|
|
5816
|
-
} catch (e) {
|
|
5817
|
-
}
|
|
5818
|
-
}
|
|
5819
|
-
if (m = css.match(RE_RGB)) {
|
|
5820
|
-
const rgb2 = m.slice(1, 4);
|
|
5821
|
-
for (let i = 0; i < 3; i++) {
|
|
5822
|
-
rgb2[i] = +rgb2[i];
|
|
5823
|
-
}
|
|
5824
|
-
rgb2[3] = 1;
|
|
5825
|
-
return rgb2;
|
|
5826
|
-
}
|
|
5827
|
-
if (m = css.match(RE_RGBA)) {
|
|
5828
|
-
const rgb2 = m.slice(1, 5);
|
|
5829
|
-
for (let i = 0; i < 4; i++) {
|
|
5830
|
-
rgb2[i] = +rgb2[i];
|
|
5831
|
-
}
|
|
5832
|
-
return rgb2;
|
|
5833
|
-
}
|
|
5834
|
-
if (m = css.match(RE_RGB_PCT)) {
|
|
5835
|
-
const rgb2 = m.slice(1, 4);
|
|
5836
|
-
for (let i = 0; i < 3; i++) {
|
|
5837
|
-
rgb2[i] = round3(rgb2[i] * 2.55);
|
|
5838
|
-
}
|
|
5839
|
-
rgb2[3] = 1;
|
|
5840
|
-
return rgb2;
|
|
5841
|
-
}
|
|
5842
|
-
if (m = css.match(RE_RGBA_PCT)) {
|
|
5843
|
-
const rgb2 = m.slice(1, 5);
|
|
5844
|
-
for (let i = 0; i < 3; i++) {
|
|
5845
|
-
rgb2[i] = round3(rgb2[i] * 2.55);
|
|
5846
|
-
}
|
|
5847
|
-
rgb2[3] = +rgb2[3];
|
|
5848
|
-
return rgb2;
|
|
5849
|
-
}
|
|
5850
|
-
if (m = css.match(RE_HSL)) {
|
|
5851
|
-
const hsl2 = m.slice(1, 4);
|
|
5852
|
-
hsl2[1] *= 0.01;
|
|
5853
|
-
hsl2[2] *= 0.01;
|
|
5854
|
-
const rgb2 = hsl2rgb_default(hsl2);
|
|
5855
|
-
rgb2[3] = 1;
|
|
5856
|
-
return rgb2;
|
|
5857
|
-
}
|
|
5858
|
-
if (m = css.match(RE_HSLA)) {
|
|
5859
|
-
const hsl2 = m.slice(1, 4);
|
|
5860
|
-
hsl2[1] *= 0.01;
|
|
5861
|
-
hsl2[2] *= 0.01;
|
|
5862
|
-
const rgb2 = hsl2rgb_default(hsl2);
|
|
5863
|
-
rgb2[3] = +m[4];
|
|
5864
|
-
return rgb2;
|
|
5865
|
-
}
|
|
5866
|
-
};
|
|
5867
|
-
css2rgb.test = (s) => {
|
|
5868
|
-
return RE_RGB.test(s) || RE_RGBA.test(s) || RE_RGB_PCT.test(s) || RE_RGBA_PCT.test(s) || RE_HSL.test(s) || RE_HSLA.test(s);
|
|
5869
|
-
};
|
|
5870
|
-
var css2rgb_default = css2rgb;
|
|
5871
|
-
|
|
5872
|
-
// node_modules/chroma-js/src/io/css/index.js
|
|
5873
|
-
Color_default.prototype.css = function(mode) {
|
|
5874
|
-
return rgb2css_default(this._rgb, mode);
|
|
5875
|
-
};
|
|
5876
|
-
chroma_default.css = (...args) => new Color_default(...args, "css");
|
|
5877
|
-
input_default.format.css = css2rgb_default;
|
|
5878
|
-
input_default.autodetect.push({
|
|
5879
|
-
p: 5,
|
|
5880
|
-
test: (h, ...rest) => {
|
|
5881
|
-
if (!rest.length && type_default(h) === "string" && css2rgb_default.test(h)) {
|
|
5882
|
-
return "css";
|
|
5883
|
-
}
|
|
5884
|
-
}
|
|
5885
|
-
});
|
|
5886
|
-
|
|
5887
|
-
// node_modules/chroma-js/src/io/gl/index.js
|
|
5888
|
-
input_default.format.gl = (...args) => {
|
|
5889
|
-
const rgb2 = unpack_default(args, "rgba");
|
|
5890
|
-
rgb2[0] *= 255;
|
|
5891
|
-
rgb2[1] *= 255;
|
|
5892
|
-
rgb2[2] *= 255;
|
|
5893
|
-
return rgb2;
|
|
5894
|
-
};
|
|
5895
|
-
chroma_default.gl = (...args) => new Color_default(...args, "gl");
|
|
5896
|
-
Color_default.prototype.gl = function() {
|
|
5897
|
-
const rgb2 = this._rgb;
|
|
5898
|
-
return [rgb2[0] / 255, rgb2[1] / 255, rgb2[2] / 255, rgb2[3]];
|
|
5899
|
-
};
|
|
5900
|
-
|
|
5901
|
-
// node_modules/chroma-js/src/io/hcg/hcg2rgb.js
|
|
5902
|
-
var { floor } = Math;
|
|
5903
|
-
var hcg2rgb = (...args) => {
|
|
5904
|
-
args = unpack_default(args, "hcg");
|
|
5905
|
-
let [h, c, _g] = args;
|
|
5906
|
-
let r, g, b;
|
|
5907
|
-
_g = _g * 255;
|
|
5908
|
-
const _c = c * 255;
|
|
5909
|
-
if (c === 0) {
|
|
5910
|
-
r = g = b = _g;
|
|
5911
|
-
} else {
|
|
5912
|
-
if (h === 360) h = 0;
|
|
5913
|
-
if (h > 360) h -= 360;
|
|
5914
|
-
if (h < 0) h += 360;
|
|
5915
|
-
h /= 60;
|
|
5916
|
-
const i = floor(h);
|
|
5917
|
-
const f = h - i;
|
|
5918
|
-
const p = _g * (1 - c);
|
|
5919
|
-
const q = p + _c * (1 - f);
|
|
5920
|
-
const t = p + _c * f;
|
|
5921
|
-
const v = p + _c;
|
|
5922
|
-
switch (i) {
|
|
5923
|
-
case 0:
|
|
5924
|
-
[r, g, b] = [v, t, p];
|
|
5925
|
-
break;
|
|
5926
|
-
case 1:
|
|
5927
|
-
[r, g, b] = [q, v, p];
|
|
5928
|
-
break;
|
|
5929
|
-
case 2:
|
|
5930
|
-
[r, g, b] = [p, v, t];
|
|
5931
|
-
break;
|
|
5932
|
-
case 3:
|
|
5933
|
-
[r, g, b] = [p, q, v];
|
|
5934
|
-
break;
|
|
5935
|
-
case 4:
|
|
5936
|
-
[r, g, b] = [t, p, v];
|
|
5937
|
-
break;
|
|
5938
|
-
case 5:
|
|
5939
|
-
[r, g, b] = [v, p, q];
|
|
5940
|
-
break;
|
|
5941
|
-
}
|
|
5942
|
-
}
|
|
5943
|
-
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
5944
|
-
};
|
|
5945
|
-
var hcg2rgb_default = hcg2rgb;
|
|
5946
|
-
|
|
5947
|
-
// node_modules/chroma-js/src/io/hcg/rgb2hcg.js
|
|
5948
|
-
var rgb2hcg = (...args) => {
|
|
5949
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
5950
|
-
const minRgb = min(r, g, b);
|
|
5951
|
-
const maxRgb = max(r, g, b);
|
|
5952
|
-
const delta2 = maxRgb - minRgb;
|
|
5953
|
-
const c = delta2 * 100 / 255;
|
|
5954
|
-
const _g = minRgb / (255 - delta2) * 100;
|
|
5955
|
-
let h;
|
|
5956
|
-
if (delta2 === 0) {
|
|
5957
|
-
h = Number.NaN;
|
|
5958
|
-
} else {
|
|
5959
|
-
if (r === maxRgb) h = (g - b) / delta2;
|
|
5960
|
-
if (g === maxRgb) h = 2 + (b - r) / delta2;
|
|
5961
|
-
if (b === maxRgb) h = 4 + (r - g) / delta2;
|
|
5962
|
-
h *= 60;
|
|
5963
|
-
if (h < 0) h += 360;
|
|
5964
|
-
}
|
|
5965
|
-
return [h, c, _g];
|
|
5966
|
-
};
|
|
5967
|
-
var rgb2hcg_default = rgb2hcg;
|
|
5968
|
-
|
|
5969
|
-
// node_modules/chroma-js/src/io/hcg/index.js
|
|
5970
|
-
Color_default.prototype.hcg = function() {
|
|
5971
|
-
return rgb2hcg_default(this._rgb);
|
|
5972
|
-
};
|
|
5973
|
-
chroma_default.hcg = (...args) => new Color_default(...args, "hcg");
|
|
5974
|
-
input_default.format.hcg = hcg2rgb_default;
|
|
5975
|
-
input_default.autodetect.push({
|
|
5976
|
-
p: 1,
|
|
5977
|
-
test: (...args) => {
|
|
5978
|
-
args = unpack_default(args, "hcg");
|
|
5979
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
5980
|
-
return "hcg";
|
|
5981
|
-
}
|
|
5982
|
-
}
|
|
5983
|
-
});
|
|
5984
|
-
|
|
5985
|
-
// node_modules/chroma-js/src/io/hex/hex2rgb.js
|
|
5986
|
-
var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
5987
|
-
var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;
|
|
5988
|
-
var hex2rgb = (hex) => {
|
|
5989
|
-
if (hex.match(RE_HEX)) {
|
|
5990
|
-
if (hex.length === 4 || hex.length === 7) {
|
|
5991
|
-
hex = hex.substr(1);
|
|
5992
|
-
}
|
|
5993
|
-
if (hex.length === 3) {
|
|
5994
|
-
hex = hex.split("");
|
|
5995
|
-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
5996
|
-
}
|
|
5997
|
-
const u = parseInt(hex, 16);
|
|
5998
|
-
const r = u >> 16;
|
|
5999
|
-
const g = u >> 8 & 255;
|
|
6000
|
-
const b = u & 255;
|
|
6001
|
-
return [r, g, b, 1];
|
|
6002
|
-
}
|
|
6003
|
-
if (hex.match(RE_HEXA)) {
|
|
6004
|
-
if (hex.length === 5 || hex.length === 9) {
|
|
6005
|
-
hex = hex.substr(1);
|
|
6006
|
-
}
|
|
6007
|
-
if (hex.length === 4) {
|
|
6008
|
-
hex = hex.split("");
|
|
6009
|
-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
|
|
6010
|
-
}
|
|
6011
|
-
const u = parseInt(hex, 16);
|
|
6012
|
-
const r = u >> 24 & 255;
|
|
6013
|
-
const g = u >> 16 & 255;
|
|
6014
|
-
const b = u >> 8 & 255;
|
|
6015
|
-
const a = Math.round((u & 255) / 255 * 100) / 100;
|
|
6016
|
-
return [r, g, b, a];
|
|
6017
|
-
}
|
|
6018
|
-
throw new Error(`unknown hex color: ${hex}`);
|
|
6019
|
-
};
|
|
6020
|
-
var hex2rgb_default = hex2rgb;
|
|
6021
|
-
|
|
6022
|
-
// node_modules/chroma-js/src/io/hex/rgb2hex.js
|
|
6023
|
-
var { round: round4 } = Math;
|
|
6024
|
-
var rgb2hex = (...args) => {
|
|
6025
|
-
let [r, g, b, a] = unpack_default(args, "rgba");
|
|
6026
|
-
let mode = last_default(args) || "auto";
|
|
6027
|
-
if (a === void 0) a = 1;
|
|
6028
|
-
if (mode === "auto") {
|
|
6029
|
-
mode = a < 1 ? "rgba" : "rgb";
|
|
6030
|
-
}
|
|
6031
|
-
r = round4(r);
|
|
6032
|
-
g = round4(g);
|
|
6033
|
-
b = round4(b);
|
|
6034
|
-
const u = r << 16 | g << 8 | b;
|
|
6035
|
-
let str = "000000" + u.toString(16);
|
|
6036
|
-
str = str.substr(str.length - 6);
|
|
6037
|
-
let hxa = "0" + round4(a * 255).toString(16);
|
|
6038
|
-
hxa = hxa.substr(hxa.length - 2);
|
|
6039
|
-
switch (mode.toLowerCase()) {
|
|
6040
|
-
case "rgba":
|
|
6041
|
-
return `#${str}${hxa}`;
|
|
6042
|
-
case "argb":
|
|
6043
|
-
return `#${hxa}${str}`;
|
|
6044
|
-
default:
|
|
6045
|
-
return `#${str}`;
|
|
6046
|
-
}
|
|
6047
|
-
};
|
|
6048
|
-
var rgb2hex_default = rgb2hex;
|
|
6049
|
-
|
|
6050
|
-
// node_modules/chroma-js/src/io/hex/index.js
|
|
6051
|
-
Color_default.prototype.hex = function(mode) {
|
|
6052
|
-
return rgb2hex_default(this._rgb, mode);
|
|
6053
|
-
};
|
|
6054
|
-
chroma_default.hex = (...args) => new Color_default(...args, "hex");
|
|
6055
|
-
input_default.format.hex = hex2rgb_default;
|
|
6056
|
-
input_default.autodetect.push({
|
|
6057
|
-
p: 4,
|
|
6058
|
-
test: (h, ...rest) => {
|
|
6059
|
-
if (!rest.length && type_default(h) === "string" && [3, 4, 5, 6, 7, 8, 9].indexOf(h.length) >= 0) {
|
|
6060
|
-
return "hex";
|
|
6061
|
-
}
|
|
6062
|
-
}
|
|
6063
|
-
});
|
|
6064
|
-
|
|
6065
|
-
// node_modules/chroma-js/src/io/hsi/hsi2rgb.js
|
|
6066
|
-
var { cos } = Math;
|
|
6067
|
-
var hsi2rgb = (...args) => {
|
|
6068
|
-
args = unpack_default(args, "hsi");
|
|
6069
|
-
let [h, s, i] = args;
|
|
6070
|
-
let r, g, b;
|
|
6071
|
-
if (isNaN(h)) h = 0;
|
|
6072
|
-
if (isNaN(s)) s = 0;
|
|
6073
|
-
if (h > 360) h -= 360;
|
|
6074
|
-
if (h < 0) h += 360;
|
|
6075
|
-
h /= 360;
|
|
6076
|
-
if (h < 1 / 3) {
|
|
6077
|
-
b = (1 - s) / 3;
|
|
6078
|
-
r = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
|
|
6079
|
-
g = 1 - (b + r);
|
|
6080
|
-
} else if (h < 2 / 3) {
|
|
6081
|
-
h -= 1 / 3;
|
|
6082
|
-
r = (1 - s) / 3;
|
|
6083
|
-
g = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
|
|
6084
|
-
b = 1 - (r + g);
|
|
6085
|
-
} else {
|
|
6086
|
-
h -= 2 / 3;
|
|
6087
|
-
g = (1 - s) / 3;
|
|
6088
|
-
b = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
|
|
6089
|
-
r = 1 - (g + b);
|
|
6090
|
-
}
|
|
6091
|
-
r = limit_default(i * r * 3);
|
|
6092
|
-
g = limit_default(i * g * 3);
|
|
6093
|
-
b = limit_default(i * b * 3);
|
|
6094
|
-
return [r * 255, g * 255, b * 255, args.length > 3 ? args[3] : 1];
|
|
6095
|
-
};
|
|
6096
|
-
var hsi2rgb_default = hsi2rgb;
|
|
6097
|
-
|
|
6098
|
-
// node_modules/chroma-js/src/io/hsi/rgb2hsi.js
|
|
6099
|
-
var { min: min2, sqrt, acos } = Math;
|
|
6100
|
-
var rgb2hsi = (...args) => {
|
|
6101
|
-
let [r, g, b] = unpack_default(args, "rgb");
|
|
6102
|
-
r /= 255;
|
|
6103
|
-
g /= 255;
|
|
6104
|
-
b /= 255;
|
|
6105
|
-
let h;
|
|
6106
|
-
const min_ = min2(r, g, b);
|
|
6107
|
-
const i = (r + g + b) / 3;
|
|
6108
|
-
const s = i > 0 ? 1 - min_ / i : 0;
|
|
6109
|
-
if (s === 0) {
|
|
6110
|
-
h = NaN;
|
|
6111
|
-
} else {
|
|
6112
|
-
h = (r - g + (r - b)) / 2;
|
|
6113
|
-
h /= sqrt((r - g) * (r - g) + (r - b) * (g - b));
|
|
6114
|
-
h = acos(h);
|
|
6115
|
-
if (b > g) {
|
|
6116
|
-
h = TWOPI - h;
|
|
6117
|
-
}
|
|
6118
|
-
h /= TWOPI;
|
|
6119
|
-
}
|
|
6120
|
-
return [h * 360, s, i];
|
|
6121
|
-
};
|
|
6122
|
-
var rgb2hsi_default = rgb2hsi;
|
|
6123
|
-
|
|
6124
|
-
// node_modules/chroma-js/src/io/hsi/index.js
|
|
6125
|
-
Color_default.prototype.hsi = function() {
|
|
6126
|
-
return rgb2hsi_default(this._rgb);
|
|
6127
|
-
};
|
|
6128
|
-
chroma_default.hsi = (...args) => new Color_default(...args, "hsi");
|
|
6129
|
-
input_default.format.hsi = hsi2rgb_default;
|
|
6130
|
-
input_default.autodetect.push({
|
|
6131
|
-
p: 2,
|
|
6132
|
-
test: (...args) => {
|
|
6133
|
-
args = unpack_default(args, "hsi");
|
|
6134
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
6135
|
-
return "hsi";
|
|
6136
|
-
}
|
|
6137
|
-
}
|
|
6138
|
-
});
|
|
6139
|
-
|
|
6140
|
-
// node_modules/chroma-js/src/io/hsl/index.js
|
|
6141
|
-
Color_default.prototype.hsl = function() {
|
|
6142
|
-
return rgb2hsl_default(this._rgb);
|
|
6143
|
-
};
|
|
6144
|
-
chroma_default.hsl = (...args) => new Color_default(...args, "hsl");
|
|
6145
|
-
input_default.format.hsl = hsl2rgb_default;
|
|
6146
|
-
input_default.autodetect.push({
|
|
6147
|
-
p: 2,
|
|
6148
|
-
test: (...args) => {
|
|
6149
|
-
args = unpack_default(args, "hsl");
|
|
6150
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
6151
|
-
return "hsl";
|
|
6152
|
-
}
|
|
6153
|
-
}
|
|
6154
|
-
});
|
|
6155
|
-
|
|
6156
|
-
// node_modules/chroma-js/src/io/hsv/hsv2rgb.js
|
|
6157
|
-
var { floor: floor2 } = Math;
|
|
6158
|
-
var hsv2rgb = (...args) => {
|
|
6159
|
-
args = unpack_default(args, "hsv");
|
|
6160
|
-
let [h, s, v] = args;
|
|
6161
|
-
let r, g, b;
|
|
6162
|
-
v *= 255;
|
|
6163
|
-
if (s === 0) {
|
|
6164
|
-
r = g = b = v;
|
|
6165
|
-
} else {
|
|
6166
|
-
if (h === 360) h = 0;
|
|
6167
|
-
if (h > 360) h -= 360;
|
|
6168
|
-
if (h < 0) h += 360;
|
|
6169
|
-
h /= 60;
|
|
6170
|
-
const i = floor2(h);
|
|
6171
|
-
const f = h - i;
|
|
6172
|
-
const p = v * (1 - s);
|
|
6173
|
-
const q = v * (1 - s * f);
|
|
6174
|
-
const t = v * (1 - s * (1 - f));
|
|
6175
|
-
switch (i) {
|
|
6176
|
-
case 0:
|
|
6177
|
-
[r, g, b] = [v, t, p];
|
|
6178
|
-
break;
|
|
6179
|
-
case 1:
|
|
6180
|
-
[r, g, b] = [q, v, p];
|
|
6181
|
-
break;
|
|
6182
|
-
case 2:
|
|
6183
|
-
[r, g, b] = [p, v, t];
|
|
6184
|
-
break;
|
|
6185
|
-
case 3:
|
|
6186
|
-
[r, g, b] = [p, q, v];
|
|
6187
|
-
break;
|
|
6188
|
-
case 4:
|
|
6189
|
-
[r, g, b] = [t, p, v];
|
|
6190
|
-
break;
|
|
6191
|
-
case 5:
|
|
6192
|
-
[r, g, b] = [v, p, q];
|
|
6193
|
-
break;
|
|
6194
|
-
}
|
|
6195
|
-
}
|
|
6196
|
-
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
6197
|
-
};
|
|
6198
|
-
var hsv2rgb_default = hsv2rgb;
|
|
6199
|
-
|
|
6200
|
-
// node_modules/chroma-js/src/io/hsv/rgb2hsv.js
|
|
6201
|
-
var { min: min3, max: max3 } = Math;
|
|
6202
|
-
var rgb2hsl2 = (...args) => {
|
|
6203
|
-
args = unpack_default(args, "rgb");
|
|
6204
|
-
let [r, g, b] = args;
|
|
6205
|
-
const min_ = min3(r, g, b);
|
|
6206
|
-
const max_ = max3(r, g, b);
|
|
6207
|
-
const delta2 = max_ - min_;
|
|
6208
|
-
let h, s, v;
|
|
6209
|
-
v = max_ / 255;
|
|
6210
|
-
if (max_ === 0) {
|
|
6211
|
-
h = Number.NaN;
|
|
6212
|
-
s = 0;
|
|
6213
|
-
} else {
|
|
6214
|
-
s = delta2 / max_;
|
|
6215
|
-
if (r === max_) h = (g - b) / delta2;
|
|
6216
|
-
if (g === max_) h = 2 + (b - r) / delta2;
|
|
6217
|
-
if (b === max_) h = 4 + (r - g) / delta2;
|
|
6218
|
-
h *= 60;
|
|
6219
|
-
if (h < 0) h += 360;
|
|
6220
|
-
}
|
|
6221
|
-
return [h, s, v];
|
|
6222
|
-
};
|
|
6223
|
-
var rgb2hsv_default = rgb2hsl2;
|
|
6224
|
-
|
|
6225
|
-
// node_modules/chroma-js/src/io/hsv/index.js
|
|
6226
|
-
Color_default.prototype.hsv = function() {
|
|
6227
|
-
return rgb2hsv_default(this._rgb);
|
|
6228
|
-
};
|
|
6229
|
-
chroma_default.hsv = (...args) => new Color_default(...args, "hsv");
|
|
6230
|
-
input_default.format.hsv = hsv2rgb_default;
|
|
6231
|
-
input_default.autodetect.push({
|
|
6232
|
-
p: 2,
|
|
6233
|
-
test: (...args) => {
|
|
6234
|
-
args = unpack_default(args, "hsv");
|
|
6235
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
6236
|
-
return "hsv";
|
|
6237
|
-
}
|
|
6238
|
-
}
|
|
6239
|
-
});
|
|
6240
|
-
|
|
6241
|
-
// node_modules/chroma-js/src/io/lab/lab-constants.js
|
|
6242
|
-
var lab_constants_default = {
|
|
6243
|
-
// Corresponds roughly to RGB brighter/darker
|
|
6244
|
-
Kn: 18,
|
|
6245
|
-
// D65 standard referent
|
|
6246
|
-
Xn: 0.95047,
|
|
6247
|
-
Yn: 1,
|
|
6248
|
-
Zn: 1.08883,
|
|
6249
|
-
t0: 0.137931034,
|
|
6250
|
-
// 4 / 29
|
|
6251
|
-
t1: 0.206896552,
|
|
6252
|
-
// 6 / 29
|
|
6253
|
-
t2: 0.12841855,
|
|
6254
|
-
// 3 * t1 * t1
|
|
6255
|
-
t3: 8856452e-9
|
|
6256
|
-
// t1 * t1 * t1
|
|
6257
|
-
};
|
|
6258
|
-
|
|
6259
|
-
// node_modules/chroma-js/src/io/lab/lab2rgb.js
|
|
6260
|
-
var { pow } = Math;
|
|
6261
|
-
var lab2rgb = (...args) => {
|
|
6262
|
-
args = unpack_default(args, "lab");
|
|
6263
|
-
const [l, a, b] = args;
|
|
6264
|
-
let x, y, z, r, g, b_;
|
|
6265
|
-
y = (l + 16) / 116;
|
|
6266
|
-
x = isNaN(a) ? y : y + a / 500;
|
|
6267
|
-
z = isNaN(b) ? y : y - b / 200;
|
|
6268
|
-
y = lab_constants_default.Yn * lab_xyz(y);
|
|
6269
|
-
x = lab_constants_default.Xn * lab_xyz(x);
|
|
6270
|
-
z = lab_constants_default.Zn * lab_xyz(z);
|
|
6271
|
-
r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z);
|
|
6272
|
-
g = xyz_rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z);
|
|
6273
|
-
b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);
|
|
6274
|
-
return [r, g, b_, args.length > 3 ? args[3] : 1];
|
|
6275
|
-
};
|
|
6276
|
-
var xyz_rgb = (r) => {
|
|
6277
|
-
return 255 * (r <= 304e-5 ? 12.92 * r : 1.055 * pow(r, 1 / 2.4) - 0.055);
|
|
6278
|
-
};
|
|
6279
|
-
var lab_xyz = (t) => {
|
|
6280
|
-
return t > lab_constants_default.t1 ? t * t * t : lab_constants_default.t2 * (t - lab_constants_default.t0);
|
|
6281
|
-
};
|
|
6282
|
-
var lab2rgb_default = lab2rgb;
|
|
6283
|
-
|
|
6284
|
-
// node_modules/chroma-js/src/io/lab/rgb2lab.js
|
|
6285
|
-
var { pow: pow2 } = Math;
|
|
6286
|
-
var rgb2lab = (...args) => {
|
|
6287
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
6288
|
-
const [x, y, z] = rgb2xyz(r, g, b);
|
|
6289
|
-
const l = 116 * y - 16;
|
|
6290
|
-
return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)];
|
|
6291
|
-
};
|
|
6292
|
-
var rgb_xyz = (r) => {
|
|
6293
|
-
if ((r /= 255) <= 0.04045) return r / 12.92;
|
|
6294
|
-
return pow2((r + 0.055) / 1.055, 2.4);
|
|
6295
|
-
};
|
|
6296
|
-
var xyz_lab = (t) => {
|
|
6297
|
-
if (t > lab_constants_default.t3) return pow2(t, 1 / 3);
|
|
6298
|
-
return t / lab_constants_default.t2 + lab_constants_default.t0;
|
|
6299
|
-
};
|
|
6300
|
-
var rgb2xyz = (r, g, b) => {
|
|
6301
|
-
r = rgb_xyz(r);
|
|
6302
|
-
g = rgb_xyz(g);
|
|
6303
|
-
b = rgb_xyz(b);
|
|
6304
|
-
const x = xyz_lab(
|
|
6305
|
-
(0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / lab_constants_default.Xn
|
|
6306
|
-
);
|
|
6307
|
-
const y = xyz_lab(
|
|
6308
|
-
(0.2126729 * r + 0.7151522 * g + 0.072175 * b) / lab_constants_default.Yn
|
|
6309
|
-
);
|
|
6310
|
-
const z = xyz_lab(
|
|
6311
|
-
(0.0193339 * r + 0.119192 * g + 0.9503041 * b) / lab_constants_default.Zn
|
|
6312
|
-
);
|
|
6313
|
-
return [x, y, z];
|
|
6314
|
-
};
|
|
6315
|
-
var rgb2lab_default = rgb2lab;
|
|
6316
|
-
|
|
6317
|
-
// node_modules/chroma-js/src/io/lab/index.js
|
|
6318
|
-
Color_default.prototype.lab = function() {
|
|
6319
|
-
return rgb2lab_default(this._rgb);
|
|
6320
|
-
};
|
|
6321
|
-
chroma_default.lab = (...args) => new Color_default(...args, "lab");
|
|
6322
|
-
input_default.format.lab = lab2rgb_default;
|
|
6323
|
-
input_default.autodetect.push({
|
|
6324
|
-
p: 2,
|
|
6325
|
-
test: (...args) => {
|
|
6326
|
-
args = unpack_default(args, "lab");
|
|
6327
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
6328
|
-
return "lab";
|
|
6329
|
-
}
|
|
6330
|
-
}
|
|
6331
|
-
});
|
|
6332
|
-
|
|
6333
|
-
// node_modules/chroma-js/src/io/lch/lch2lab.js
|
|
6334
|
-
var { sin, cos: cos2 } = Math;
|
|
6335
|
-
var lch2lab = (...args) => {
|
|
6336
|
-
let [l, c, h] = unpack_default(args, "lch");
|
|
6337
|
-
if (isNaN(h)) h = 0;
|
|
6338
|
-
h = h * DEG2RAD;
|
|
6339
|
-
return [l, cos2(h) * c, sin(h) * c];
|
|
6340
|
-
};
|
|
6341
|
-
var lch2lab_default = lch2lab;
|
|
6342
|
-
|
|
6343
|
-
// node_modules/chroma-js/src/io/lch/lch2rgb.js
|
|
6344
|
-
var lch2rgb = (...args) => {
|
|
6345
|
-
args = unpack_default(args, "lch");
|
|
6346
|
-
const [l, c, h] = args;
|
|
6347
|
-
const [L, a, b_] = lch2lab_default(l, c, h);
|
|
6348
|
-
const [r, g, b] = lab2rgb_default(L, a, b_);
|
|
6349
|
-
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
6350
|
-
};
|
|
6351
|
-
var lch2rgb_default = lch2rgb;
|
|
6352
|
-
|
|
6353
|
-
// node_modules/chroma-js/src/io/lch/hcl2rgb.js
|
|
6354
|
-
var hcl2rgb = (...args) => {
|
|
6355
|
-
const hcl = unpack_default(args, "hcl").reverse();
|
|
6356
|
-
return lch2rgb_default(...hcl);
|
|
6357
|
-
};
|
|
6358
|
-
var hcl2rgb_default = hcl2rgb;
|
|
6359
|
-
|
|
6360
|
-
// node_modules/chroma-js/src/io/lch/lab2lch.js
|
|
6361
|
-
var { sqrt: sqrt2, atan2, round: round5 } = Math;
|
|
6362
|
-
var lab2lch = (...args) => {
|
|
6363
|
-
const [l, a, b] = unpack_default(args, "lab");
|
|
6364
|
-
const c = sqrt2(a * a + b * b);
|
|
6365
|
-
let h = (atan2(b, a) * RAD2DEG + 360) % 360;
|
|
6366
|
-
if (round5(c * 1e4) === 0) h = Number.NaN;
|
|
6367
|
-
return [l, c, h];
|
|
6368
|
-
};
|
|
6369
|
-
var lab2lch_default = lab2lch;
|
|
6370
|
-
|
|
6371
|
-
// node_modules/chroma-js/src/io/lch/rgb2lch.js
|
|
6372
|
-
var rgb2lch = (...args) => {
|
|
6373
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
6374
|
-
const [l, a, b_] = rgb2lab_default(r, g, b);
|
|
6375
|
-
return lab2lch_default(l, a, b_);
|
|
6376
|
-
};
|
|
6377
|
-
var rgb2lch_default = rgb2lch;
|
|
6378
|
-
|
|
6379
|
-
// node_modules/chroma-js/src/io/lch/index.js
|
|
6380
|
-
Color_default.prototype.lch = function() {
|
|
6381
|
-
return rgb2lch_default(this._rgb);
|
|
6382
|
-
};
|
|
6383
|
-
Color_default.prototype.hcl = function() {
|
|
6384
|
-
return rgb2lch_default(this._rgb).reverse();
|
|
6385
|
-
};
|
|
6386
|
-
chroma_default.lch = (...args) => new Color_default(...args, "lch");
|
|
6387
|
-
chroma_default.hcl = (...args) => new Color_default(...args, "hcl");
|
|
6388
|
-
input_default.format.lch = lch2rgb_default;
|
|
6389
|
-
input_default.format.hcl = hcl2rgb_default;
|
|
6390
|
-
["lch", "hcl"].forEach(
|
|
6391
|
-
(m) => input_default.autodetect.push({
|
|
6392
|
-
p: 2,
|
|
6393
|
-
test: (...args) => {
|
|
6394
|
-
args = unpack_default(args, m);
|
|
6395
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
6396
|
-
return m;
|
|
6397
|
-
}
|
|
6398
|
-
}
|
|
6399
|
-
})
|
|
6400
|
-
);
|
|
6401
|
-
|
|
6402
|
-
// node_modules/chroma-js/src/colors/w3cx11.js
|
|
6403
|
-
var w3cx11 = {
|
|
6404
|
-
aliceblue: "#f0f8ff",
|
|
6405
|
-
antiquewhite: "#faebd7",
|
|
6406
|
-
aqua: "#00ffff",
|
|
6407
|
-
aquamarine: "#7fffd4",
|
|
6408
|
-
azure: "#f0ffff",
|
|
6409
|
-
beige: "#f5f5dc",
|
|
6410
|
-
bisque: "#ffe4c4",
|
|
6411
|
-
black: "#000000",
|
|
6412
|
-
blanchedalmond: "#ffebcd",
|
|
6413
|
-
blue: "#0000ff",
|
|
6414
|
-
blueviolet: "#8a2be2",
|
|
6415
|
-
brown: "#a52a2a",
|
|
6416
|
-
burlywood: "#deb887",
|
|
6417
|
-
cadetblue: "#5f9ea0",
|
|
6418
|
-
chartreuse: "#7fff00",
|
|
6419
|
-
chocolate: "#d2691e",
|
|
6420
|
-
coral: "#ff7f50",
|
|
6421
|
-
cornflowerblue: "#6495ed",
|
|
6422
|
-
cornsilk: "#fff8dc",
|
|
6423
|
-
crimson: "#dc143c",
|
|
6424
|
-
cyan: "#00ffff",
|
|
6425
|
-
darkblue: "#00008b",
|
|
6426
|
-
darkcyan: "#008b8b",
|
|
6427
|
-
darkgoldenrod: "#b8860b",
|
|
6428
|
-
darkgray: "#a9a9a9",
|
|
6429
|
-
darkgreen: "#006400",
|
|
6430
|
-
darkgrey: "#a9a9a9",
|
|
6431
|
-
darkkhaki: "#bdb76b",
|
|
6432
|
-
darkmagenta: "#8b008b",
|
|
6433
|
-
darkolivegreen: "#556b2f",
|
|
6434
|
-
darkorange: "#ff8c00",
|
|
6435
|
-
darkorchid: "#9932cc",
|
|
6436
|
-
darkred: "#8b0000",
|
|
6437
|
-
darksalmon: "#e9967a",
|
|
6438
|
-
darkseagreen: "#8fbc8f",
|
|
6439
|
-
darkslateblue: "#483d8b",
|
|
6440
|
-
darkslategray: "#2f4f4f",
|
|
6441
|
-
darkslategrey: "#2f4f4f",
|
|
6442
|
-
darkturquoise: "#00ced1",
|
|
6443
|
-
darkviolet: "#9400d3",
|
|
6444
|
-
deeppink: "#ff1493",
|
|
6445
|
-
deepskyblue: "#00bfff",
|
|
6446
|
-
dimgray: "#696969",
|
|
6447
|
-
dimgrey: "#696969",
|
|
6448
|
-
dodgerblue: "#1e90ff",
|
|
6449
|
-
firebrick: "#b22222",
|
|
6450
|
-
floralwhite: "#fffaf0",
|
|
6451
|
-
forestgreen: "#228b22",
|
|
6452
|
-
fuchsia: "#ff00ff",
|
|
6453
|
-
gainsboro: "#dcdcdc",
|
|
6454
|
-
ghostwhite: "#f8f8ff",
|
|
6455
|
-
gold: "#ffd700",
|
|
6456
|
-
goldenrod: "#daa520",
|
|
6457
|
-
gray: "#808080",
|
|
6458
|
-
green: "#008000",
|
|
6459
|
-
greenyellow: "#adff2f",
|
|
6460
|
-
grey: "#808080",
|
|
6461
|
-
honeydew: "#f0fff0",
|
|
6462
|
-
hotpink: "#ff69b4",
|
|
6463
|
-
indianred: "#cd5c5c",
|
|
6464
|
-
indigo: "#4b0082",
|
|
6465
|
-
ivory: "#fffff0",
|
|
6466
|
-
khaki: "#f0e68c",
|
|
6467
|
-
laserlemon: "#ffff54",
|
|
6468
|
-
lavender: "#e6e6fa",
|
|
6469
|
-
lavenderblush: "#fff0f5",
|
|
6470
|
-
lawngreen: "#7cfc00",
|
|
6471
|
-
lemonchiffon: "#fffacd",
|
|
6472
|
-
lightblue: "#add8e6",
|
|
6473
|
-
lightcoral: "#f08080",
|
|
6474
|
-
lightcyan: "#e0ffff",
|
|
6475
|
-
lightgoldenrod: "#fafad2",
|
|
6476
|
-
lightgoldenrodyellow: "#fafad2",
|
|
6477
|
-
lightgray: "#d3d3d3",
|
|
6478
|
-
lightgreen: "#90ee90",
|
|
6479
|
-
lightgrey: "#d3d3d3",
|
|
6480
|
-
lightpink: "#ffb6c1",
|
|
6481
|
-
lightsalmon: "#ffa07a",
|
|
6482
|
-
lightseagreen: "#20b2aa",
|
|
6483
|
-
lightskyblue: "#87cefa",
|
|
6484
|
-
lightslategray: "#778899",
|
|
6485
|
-
lightslategrey: "#778899",
|
|
6486
|
-
lightsteelblue: "#b0c4de",
|
|
6487
|
-
lightyellow: "#ffffe0",
|
|
6488
|
-
lime: "#00ff00",
|
|
6489
|
-
limegreen: "#32cd32",
|
|
6490
|
-
linen: "#faf0e6",
|
|
6491
|
-
magenta: "#ff00ff",
|
|
6492
|
-
maroon: "#800000",
|
|
6493
|
-
maroon2: "#7f0000",
|
|
6494
|
-
maroon3: "#b03060",
|
|
6495
|
-
mediumaquamarine: "#66cdaa",
|
|
6496
|
-
mediumblue: "#0000cd",
|
|
6497
|
-
mediumorchid: "#ba55d3",
|
|
6498
|
-
mediumpurple: "#9370db",
|
|
6499
|
-
mediumseagreen: "#3cb371",
|
|
6500
|
-
mediumslateblue: "#7b68ee",
|
|
6501
|
-
mediumspringgreen: "#00fa9a",
|
|
6502
|
-
mediumturquoise: "#48d1cc",
|
|
6503
|
-
mediumvioletred: "#c71585",
|
|
6504
|
-
midnightblue: "#191970",
|
|
6505
|
-
mintcream: "#f5fffa",
|
|
6506
|
-
mistyrose: "#ffe4e1",
|
|
6507
|
-
moccasin: "#ffe4b5",
|
|
6508
|
-
navajowhite: "#ffdead",
|
|
6509
|
-
navy: "#000080",
|
|
6510
|
-
oldlace: "#fdf5e6",
|
|
6511
|
-
olive: "#808000",
|
|
6512
|
-
olivedrab: "#6b8e23",
|
|
6513
|
-
orange: "#ffa500",
|
|
6514
|
-
orangered: "#ff4500",
|
|
6515
|
-
orchid: "#da70d6",
|
|
6516
|
-
palegoldenrod: "#eee8aa",
|
|
6517
|
-
palegreen: "#98fb98",
|
|
6518
|
-
paleturquoise: "#afeeee",
|
|
6519
|
-
palevioletred: "#db7093",
|
|
6520
|
-
papayawhip: "#ffefd5",
|
|
6521
|
-
peachpuff: "#ffdab9",
|
|
6522
|
-
peru: "#cd853f",
|
|
6523
|
-
pink: "#ffc0cb",
|
|
6524
|
-
plum: "#dda0dd",
|
|
6525
|
-
powderblue: "#b0e0e6",
|
|
6526
|
-
purple: "#800080",
|
|
6527
|
-
purple2: "#7f007f",
|
|
6528
|
-
purple3: "#a020f0",
|
|
6529
|
-
rebeccapurple: "#663399",
|
|
6530
|
-
red: "#ff0000",
|
|
6531
|
-
rosybrown: "#bc8f8f",
|
|
6532
|
-
royalblue: "#4169e1",
|
|
6533
|
-
saddlebrown: "#8b4513",
|
|
6534
|
-
salmon: "#fa8072",
|
|
6535
|
-
sandybrown: "#f4a460",
|
|
6536
|
-
seagreen: "#2e8b57",
|
|
6537
|
-
seashell: "#fff5ee",
|
|
6538
|
-
sienna: "#a0522d",
|
|
6539
|
-
silver: "#c0c0c0",
|
|
6540
|
-
skyblue: "#87ceeb",
|
|
6541
|
-
slateblue: "#6a5acd",
|
|
6542
|
-
slategray: "#708090",
|
|
6543
|
-
slategrey: "#708090",
|
|
6544
|
-
snow: "#fffafa",
|
|
6545
|
-
springgreen: "#00ff7f",
|
|
6546
|
-
steelblue: "#4682b4",
|
|
6547
|
-
tan: "#d2b48c",
|
|
6548
|
-
teal: "#008080",
|
|
6549
|
-
thistle: "#d8bfd8",
|
|
6550
|
-
tomato: "#ff6347",
|
|
6551
|
-
turquoise: "#40e0d0",
|
|
6552
|
-
violet: "#ee82ee",
|
|
6553
|
-
wheat: "#f5deb3",
|
|
6554
|
-
white: "#ffffff",
|
|
6555
|
-
whitesmoke: "#f5f5f5",
|
|
6556
|
-
yellow: "#ffff00",
|
|
6557
|
-
yellowgreen: "#9acd32"
|
|
6558
|
-
};
|
|
6559
|
-
var w3cx11_default = w3cx11;
|
|
6560
|
-
|
|
6561
|
-
// node_modules/chroma-js/src/io/named/index.js
|
|
6562
|
-
Color_default.prototype.name = function() {
|
|
6563
|
-
const hex = rgb2hex_default(this._rgb, "rgb");
|
|
6564
|
-
for (let n of Object.keys(w3cx11_default)) {
|
|
6565
|
-
if (w3cx11_default[n] === hex) return n.toLowerCase();
|
|
6566
|
-
}
|
|
6567
|
-
return hex;
|
|
6568
|
-
};
|
|
6569
|
-
input_default.format.named = (name) => {
|
|
6570
|
-
name = name.toLowerCase();
|
|
6571
|
-
if (w3cx11_default[name]) return hex2rgb_default(w3cx11_default[name]);
|
|
6572
|
-
throw new Error("unknown color name: " + name);
|
|
6573
|
-
};
|
|
6574
|
-
input_default.autodetect.push({
|
|
6575
|
-
p: 5,
|
|
6576
|
-
test: (h, ...rest) => {
|
|
6577
|
-
if (!rest.length && type_default(h) === "string" && w3cx11_default[h.toLowerCase()]) {
|
|
6578
|
-
return "named";
|
|
6579
|
-
}
|
|
6580
|
-
}
|
|
6581
|
-
});
|
|
6582
|
-
|
|
6583
|
-
// node_modules/chroma-js/src/io/num/num2rgb.js
|
|
6584
|
-
var num2rgb = (num2) => {
|
|
6585
|
-
if (type_default(num2) == "number" && num2 >= 0 && num2 <= 16777215) {
|
|
6586
|
-
const r = num2 >> 16;
|
|
6587
|
-
const g = num2 >> 8 & 255;
|
|
6588
|
-
const b = num2 & 255;
|
|
6589
|
-
return [r, g, b, 1];
|
|
6590
|
-
}
|
|
6591
|
-
throw new Error("unknown num color: " + num2);
|
|
6592
|
-
};
|
|
6593
|
-
var num2rgb_default = num2rgb;
|
|
6594
|
-
|
|
6595
|
-
// node_modules/chroma-js/src/io/num/rgb2num.js
|
|
6596
|
-
var rgb2num = (...args) => {
|
|
6597
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
6598
|
-
return (r << 16) + (g << 8) + b;
|
|
6599
|
-
};
|
|
6600
|
-
var rgb2num_default = rgb2num;
|
|
6601
|
-
|
|
6602
|
-
// node_modules/chroma-js/src/io/num/index.js
|
|
6603
|
-
Color_default.prototype.num = function() {
|
|
6604
|
-
return rgb2num_default(this._rgb);
|
|
6605
|
-
};
|
|
6606
|
-
chroma_default.num = (...args) => new Color_default(...args, "num");
|
|
6607
|
-
input_default.format.num = num2rgb_default;
|
|
6608
|
-
input_default.autodetect.push({
|
|
6609
|
-
p: 5,
|
|
6610
|
-
test: (...args) => {
|
|
6611
|
-
if (args.length === 1 && type_default(args[0]) === "number" && args[0] >= 0 && args[0] <= 16777215) {
|
|
6612
|
-
return "num";
|
|
6613
|
-
}
|
|
6614
|
-
}
|
|
6615
|
-
});
|
|
6616
|
-
|
|
6617
|
-
// node_modules/chroma-js/src/io/rgb/index.js
|
|
6618
|
-
var { round: round6 } = Math;
|
|
6619
|
-
Color_default.prototype.rgb = function(rnd2 = true) {
|
|
6620
|
-
if (rnd2 === false) return this._rgb.slice(0, 3);
|
|
6621
|
-
return this._rgb.slice(0, 3).map(round6);
|
|
6622
|
-
};
|
|
6623
|
-
Color_default.prototype.rgba = function(rnd2 = true) {
|
|
6624
|
-
return this._rgb.slice(0, 4).map((v, i) => {
|
|
6625
|
-
return i < 3 ? rnd2 === false ? v : round6(v) : v;
|
|
6626
|
-
});
|
|
6627
|
-
};
|
|
6628
|
-
chroma_default.rgb = (...args) => new Color_default(...args, "rgb");
|
|
6629
|
-
input_default.format.rgb = (...args) => {
|
|
6630
|
-
const rgba = unpack_default(args, "rgba");
|
|
6631
|
-
if (rgba[3] === void 0) rgba[3] = 1;
|
|
6632
|
-
return rgba;
|
|
6633
|
-
};
|
|
6634
|
-
input_default.autodetect.push({
|
|
6635
|
-
p: 3,
|
|
6636
|
-
test: (...args) => {
|
|
6637
|
-
args = unpack_default(args, "rgba");
|
|
6638
|
-
if (type_default(args) === "array" && (args.length === 3 || args.length === 4 && type_default(args[3]) == "number" && args[3] >= 0 && args[3] <= 1)) {
|
|
6639
|
-
return "rgb";
|
|
6640
|
-
}
|
|
6641
|
-
}
|
|
6642
|
-
});
|
|
6643
|
-
|
|
6644
|
-
// node_modules/chroma-js/src/io/temp/temperature2rgb.js
|
|
6645
|
-
var { log } = Math;
|
|
6646
|
-
var temperature2rgb = (kelvin) => {
|
|
6647
|
-
const temp = kelvin / 100;
|
|
6648
|
-
let r, g, b;
|
|
6649
|
-
if (temp < 66) {
|
|
6650
|
-
r = 255;
|
|
6651
|
-
g = temp < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (g = temp - 2) + 104.49216199393888 * log(g);
|
|
6652
|
-
b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp - 10) + 115.67994401066147 * log(b);
|
|
6653
|
-
} else {
|
|
6654
|
-
r = 351.97690566805693 + 0.114206453784165 * (r = temp - 55) - 40.25366309332127 * log(r);
|
|
6655
|
-
g = 325.4494125711974 + 0.07943456536662342 * (g = temp - 50) - 28.0852963507957 * log(g);
|
|
6656
|
-
b = 255;
|
|
6657
|
-
}
|
|
6658
|
-
return [r, g, b, 1];
|
|
6659
|
-
};
|
|
6660
|
-
var temperature2rgb_default = temperature2rgb;
|
|
6661
|
-
|
|
6662
|
-
// node_modules/chroma-js/src/io/temp/rgb2temperature.js
|
|
6663
|
-
var { round: round7 } = Math;
|
|
6664
|
-
var rgb2temperature = (...args) => {
|
|
6665
|
-
const rgb2 = unpack_default(args, "rgb");
|
|
6666
|
-
const r = rgb2[0], b = rgb2[2];
|
|
6667
|
-
let minTemp = 1e3;
|
|
6668
|
-
let maxTemp = 4e4;
|
|
6669
|
-
const eps = 0.4;
|
|
6670
|
-
let temp;
|
|
6671
|
-
while (maxTemp - minTemp > eps) {
|
|
6672
|
-
temp = (maxTemp + minTemp) * 0.5;
|
|
6673
|
-
const rgb3 = temperature2rgb_default(temp);
|
|
6674
|
-
if (rgb3[2] / rgb3[0] >= b / r) {
|
|
6675
|
-
maxTemp = temp;
|
|
6676
|
-
} else {
|
|
6677
|
-
minTemp = temp;
|
|
6678
|
-
}
|
|
6679
|
-
}
|
|
6680
|
-
return round7(temp);
|
|
6681
|
-
};
|
|
6682
|
-
var rgb2temperature_default = rgb2temperature;
|
|
6683
|
-
|
|
6684
|
-
// node_modules/chroma-js/src/io/temp/index.js
|
|
6685
|
-
Color_default.prototype.temp = Color_default.prototype.kelvin = Color_default.prototype.temperature = function() {
|
|
6686
|
-
return rgb2temperature_default(this._rgb);
|
|
6687
|
-
};
|
|
6688
|
-
chroma_default.temp = chroma_default.kelvin = chroma_default.temperature = (...args) => new Color_default(...args, "temp");
|
|
6689
|
-
input_default.format.temp = input_default.format.kelvin = input_default.format.temperature = temperature2rgb_default;
|
|
6690
|
-
|
|
6691
|
-
// node_modules/chroma-js/src/io/oklab/oklab2rgb.js
|
|
6692
|
-
var { pow: pow3, sign } = Math;
|
|
6693
|
-
var oklab2rgb = (...args) => {
|
|
6694
|
-
args = unpack_default(args, "lab");
|
|
6695
|
-
const [L, a, b] = args;
|
|
6696
|
-
const l = pow3(L + 0.3963377774 * a + 0.2158037573 * b, 3);
|
|
6697
|
-
const m = pow3(L - 0.1055613458 * a - 0.0638541728 * b, 3);
|
|
6698
|
-
const s = pow3(L - 0.0894841775 * a - 1.291485548 * b, 3);
|
|
6699
|
-
return [
|
|
6700
|
-
255 * lrgb2rgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
|
|
6701
|
-
255 * lrgb2rgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
|
|
6702
|
-
255 * lrgb2rgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
|
|
6703
|
-
args.length > 3 ? args[3] : 1
|
|
6704
|
-
];
|
|
6705
|
-
};
|
|
6706
|
-
var oklab2rgb_default = oklab2rgb;
|
|
6707
|
-
function lrgb2rgb(c) {
|
|
6708
|
-
const abs3 = Math.abs(c);
|
|
6709
|
-
if (abs3 > 31308e-7) {
|
|
6710
|
-
return (sign(c) || 1) * (1.055 * pow3(abs3, 1 / 2.4) - 0.055);
|
|
6711
|
-
}
|
|
6712
|
-
return c * 12.92;
|
|
6713
|
-
}
|
|
6714
|
-
|
|
6715
|
-
// node_modules/chroma-js/src/io/oklab/rgb2oklab.js
|
|
6716
|
-
var { cbrt, pow: pow4, sign: sign2 } = Math;
|
|
6717
|
-
var rgb2oklab = (...args) => {
|
|
6718
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
6719
|
-
const [lr, lg, lb] = [
|
|
6720
|
-
rgb2lrgb(r / 255),
|
|
6721
|
-
rgb2lrgb(g / 255),
|
|
6722
|
-
rgb2lrgb(b / 255)
|
|
6723
|
-
];
|
|
6724
|
-
const l = cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
|
|
6725
|
-
const m = cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
|
|
6726
|
-
const s = cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
|
|
6727
|
-
return [
|
|
6728
|
-
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
6729
|
-
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
6730
|
-
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s
|
|
6731
|
-
];
|
|
6732
|
-
};
|
|
6733
|
-
var rgb2oklab_default = rgb2oklab;
|
|
6734
|
-
function rgb2lrgb(c) {
|
|
6735
|
-
const abs3 = Math.abs(c);
|
|
6736
|
-
if (abs3 < 0.04045) {
|
|
6737
|
-
return c / 12.92;
|
|
6738
|
-
}
|
|
6739
|
-
return (sign2(c) || 1) * pow4((abs3 + 0.055) / 1.055, 2.4);
|
|
6740
|
-
}
|
|
6741
|
-
|
|
6742
|
-
// node_modules/chroma-js/src/io/oklab/index.js
|
|
6743
|
-
Color_default.prototype.oklab = function() {
|
|
6744
|
-
return rgb2oklab_default(this._rgb);
|
|
6745
|
-
};
|
|
6746
|
-
chroma_default.oklab = (...args) => new Color_default(...args, "oklab");
|
|
6747
|
-
input_default.format.oklab = oklab2rgb_default;
|
|
6748
|
-
input_default.autodetect.push({
|
|
6749
|
-
p: 3,
|
|
6750
|
-
test: (...args) => {
|
|
6751
|
-
args = unpack_default(args, "oklab");
|
|
6752
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
6753
|
-
return "oklab";
|
|
6754
|
-
}
|
|
6755
|
-
}
|
|
6756
|
-
});
|
|
6757
|
-
|
|
6758
|
-
// node_modules/chroma-js/src/io/oklch/oklch2rgb.js
|
|
6759
|
-
var oklch2rgb = (...args) => {
|
|
6760
|
-
args = unpack_default(args, "lch");
|
|
6761
|
-
const [l, c, h] = args;
|
|
6762
|
-
const [L, a, b_] = lch2lab_default(l, c, h);
|
|
6763
|
-
const [r, g, b] = oklab2rgb_default(L, a, b_);
|
|
6764
|
-
return [r, g, b, args.length > 3 ? args[3] : 1];
|
|
6765
|
-
};
|
|
6766
|
-
var oklch2rgb_default = oklch2rgb;
|
|
6767
|
-
|
|
6768
|
-
// node_modules/chroma-js/src/io/oklch/rgb2oklch.js
|
|
6769
|
-
var rgb2oklch = (...args) => {
|
|
6770
|
-
const [r, g, b] = unpack_default(args, "rgb");
|
|
6771
|
-
const [l, a, b_] = rgb2oklab_default(r, g, b);
|
|
6772
|
-
return lab2lch_default(l, a, b_);
|
|
6773
|
-
};
|
|
6774
|
-
var rgb2oklch_default = rgb2oklch;
|
|
6775
|
-
|
|
6776
|
-
// node_modules/chroma-js/src/io/oklch/index.js
|
|
6777
|
-
Color_default.prototype.oklch = function() {
|
|
6778
|
-
return rgb2oklch_default(this._rgb);
|
|
6779
|
-
};
|
|
6780
|
-
chroma_default.oklch = (...args) => new Color_default(...args, "oklch");
|
|
6781
|
-
input_default.format.oklch = oklch2rgb_default;
|
|
6782
|
-
input_default.autodetect.push({
|
|
6783
|
-
p: 3,
|
|
6784
|
-
test: (...args) => {
|
|
6785
|
-
args = unpack_default(args, "oklch");
|
|
6786
|
-
if (type_default(args) === "array" && args.length === 3) {
|
|
6787
|
-
return "oklch";
|
|
6788
|
-
}
|
|
6789
|
-
}
|
|
6790
|
-
});
|
|
6791
|
-
|
|
6792
|
-
// node_modules/chroma-js/src/ops/alpha.js
|
|
6793
|
-
Color_default.prototype.alpha = function(a, mutate = false) {
|
|
6794
|
-
if (a !== void 0 && type_default(a) === "number") {
|
|
6795
|
-
if (mutate) {
|
|
6796
|
-
this._rgb[3] = a;
|
|
6797
|
-
return this;
|
|
6798
|
-
}
|
|
6799
|
-
return new Color_default([this._rgb[0], this._rgb[1], this._rgb[2], a], "rgb");
|
|
6800
|
-
}
|
|
6801
|
-
return this._rgb[3];
|
|
6802
|
-
};
|
|
6803
|
-
|
|
6804
|
-
// node_modules/chroma-js/src/ops/clipped.js
|
|
6805
|
-
Color_default.prototype.clipped = function() {
|
|
6806
|
-
return this._rgb._clipped || false;
|
|
6807
|
-
};
|
|
6808
|
-
|
|
6809
|
-
// node_modules/chroma-js/src/ops/darken.js
|
|
6810
|
-
Color_default.prototype.darken = function(amount = 1) {
|
|
6811
|
-
const me = this;
|
|
6812
|
-
const lab2 = me.lab();
|
|
6813
|
-
lab2[0] -= lab_constants_default.Kn * amount;
|
|
6814
|
-
return new Color_default(lab2, "lab").alpha(me.alpha(), true);
|
|
6815
|
-
};
|
|
6816
|
-
Color_default.prototype.brighten = function(amount = 1) {
|
|
6817
|
-
return this.darken(-amount);
|
|
6818
|
-
};
|
|
6819
|
-
Color_default.prototype.darker = Color_default.prototype.darken;
|
|
6820
|
-
Color_default.prototype.brighter = Color_default.prototype.brighten;
|
|
6821
|
-
|
|
6822
|
-
// node_modules/chroma-js/src/ops/get.js
|
|
6823
|
-
Color_default.prototype.get = function(mc) {
|
|
6824
|
-
const [mode, channel] = mc.split(".");
|
|
6825
|
-
const src = this[mode]();
|
|
6826
|
-
if (channel) {
|
|
6827
|
-
const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
|
|
6828
|
-
if (i > -1) return src[i];
|
|
6829
|
-
throw new Error(`unknown channel ${channel} in mode ${mode}`);
|
|
6830
|
-
} else {
|
|
6831
|
-
return src;
|
|
6832
|
-
}
|
|
6833
|
-
};
|
|
6834
|
-
|
|
6835
|
-
// node_modules/chroma-js/src/ops/luminance.js
|
|
6836
|
-
var { pow: pow5 } = Math;
|
|
6837
|
-
var EPS = 1e-7;
|
|
6838
|
-
var MAX_ITER = 20;
|
|
6839
|
-
Color_default.prototype.luminance = function(lum, mode = "rgb") {
|
|
6840
|
-
if (lum !== void 0 && type_default(lum) === "number") {
|
|
6841
|
-
if (lum === 0) {
|
|
6842
|
-
return new Color_default([0, 0, 0, this._rgb[3]], "rgb");
|
|
6843
|
-
}
|
|
6844
|
-
if (lum === 1) {
|
|
6845
|
-
return new Color_default([255, 255, 255, this._rgb[3]], "rgb");
|
|
6846
|
-
}
|
|
6847
|
-
let cur_lum = this.luminance();
|
|
6848
|
-
let max_iter = MAX_ITER;
|
|
6849
|
-
const test = (low, high) => {
|
|
6850
|
-
const mid = low.interpolate(high, 0.5, mode);
|
|
6851
|
-
const lm = mid.luminance();
|
|
6852
|
-
if (Math.abs(lum - lm) < EPS || !max_iter--) {
|
|
6853
|
-
return mid;
|
|
6854
|
-
}
|
|
6855
|
-
return lm > lum ? test(low, mid) : test(mid, high);
|
|
6856
|
-
};
|
|
6857
|
-
const rgb2 = (cur_lum > lum ? test(new Color_default([0, 0, 0]), this) : test(this, new Color_default([255, 255, 255]))).rgb();
|
|
6858
|
-
return new Color_default([...rgb2, this._rgb[3]]);
|
|
6859
|
-
}
|
|
6860
|
-
return rgb2luminance(...this._rgb.slice(0, 3));
|
|
6861
|
-
};
|
|
6862
|
-
var rgb2luminance = (r, g, b) => {
|
|
6863
|
-
r = luminance_x(r);
|
|
6864
|
-
g = luminance_x(g);
|
|
6865
|
-
b = luminance_x(b);
|
|
6866
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
6867
|
-
};
|
|
6868
|
-
var luminance_x = (x) => {
|
|
6869
|
-
x /= 255;
|
|
6870
|
-
return x <= 0.03928 ? x / 12.92 : pow5((x + 0.055) / 1.055, 2.4);
|
|
6871
|
-
};
|
|
6872
|
-
|
|
6873
|
-
// node_modules/chroma-js/src/interpolator/index.js
|
|
6874
|
-
var interpolator_default = {};
|
|
6875
|
-
|
|
6876
|
-
// node_modules/chroma-js/src/generator/mix.js
|
|
6877
|
-
var mix_default = (col1, col2, f = 0.5, ...rest) => {
|
|
6878
|
-
let mode = rest[0] || "lrgb";
|
|
6879
|
-
if (!interpolator_default[mode] && !rest.length) {
|
|
6880
|
-
mode = Object.keys(interpolator_default)[0];
|
|
6881
|
-
}
|
|
6882
|
-
if (!interpolator_default[mode]) {
|
|
6883
|
-
throw new Error(`interpolation mode ${mode} is not defined`);
|
|
6884
|
-
}
|
|
6885
|
-
if (type_default(col1) !== "object") col1 = new Color_default(col1);
|
|
6886
|
-
if (type_default(col2) !== "object") col2 = new Color_default(col2);
|
|
6887
|
-
return interpolator_default[mode](col1, col2, f).alpha(
|
|
6888
|
-
col1.alpha() + f * (col2.alpha() - col1.alpha())
|
|
6889
|
-
);
|
|
6890
|
-
};
|
|
6891
|
-
|
|
6892
|
-
// node_modules/chroma-js/src/ops/mix.js
|
|
6893
|
-
Color_default.prototype.mix = Color_default.prototype.interpolate = function(col2, f = 0.5, ...rest) {
|
|
6894
|
-
return mix_default(this, col2, f, ...rest);
|
|
6895
|
-
};
|
|
6896
|
-
|
|
6897
|
-
// node_modules/chroma-js/src/ops/premultiply.js
|
|
6898
|
-
Color_default.prototype.premultiply = function(mutate = false) {
|
|
6899
|
-
const rgb2 = this._rgb;
|
|
6900
|
-
const a = rgb2[3];
|
|
6901
|
-
if (mutate) {
|
|
6902
|
-
this._rgb = [rgb2[0] * a, rgb2[1] * a, rgb2[2] * a, a];
|
|
6903
|
-
return this;
|
|
6904
|
-
} else {
|
|
6905
|
-
return new Color_default([rgb2[0] * a, rgb2[1] * a, rgb2[2] * a, a], "rgb");
|
|
6906
|
-
}
|
|
6907
|
-
};
|
|
6908
|
-
|
|
6909
|
-
// node_modules/chroma-js/src/ops/saturate.js
|
|
6910
|
-
Color_default.prototype.saturate = function(amount = 1) {
|
|
6911
|
-
const me = this;
|
|
6912
|
-
const lch2 = me.lch();
|
|
6913
|
-
lch2[1] += lab_constants_default.Kn * amount;
|
|
6914
|
-
if (lch2[1] < 0) lch2[1] = 0;
|
|
6915
|
-
return new Color_default(lch2, "lch").alpha(me.alpha(), true);
|
|
6916
|
-
};
|
|
6917
|
-
Color_default.prototype.desaturate = function(amount = 1) {
|
|
6918
|
-
return this.saturate(-amount);
|
|
6919
|
-
};
|
|
6920
|
-
|
|
6921
|
-
// node_modules/chroma-js/src/ops/set.js
|
|
6922
|
-
Color_default.prototype.set = function(mc, value, mutate = false) {
|
|
6923
|
-
const [mode, channel] = mc.split(".");
|
|
6924
|
-
const src = this[mode]();
|
|
6925
|
-
if (channel) {
|
|
6926
|
-
const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
|
|
6927
|
-
if (i > -1) {
|
|
6928
|
-
if (type_default(value) == "string") {
|
|
6929
|
-
switch (value.charAt(0)) {
|
|
6930
|
-
case "+":
|
|
6931
|
-
src[i] += +value;
|
|
6932
|
-
break;
|
|
6933
|
-
case "-":
|
|
6934
|
-
src[i] += +value;
|
|
6935
|
-
break;
|
|
6936
|
-
case "*":
|
|
6937
|
-
src[i] *= +value.substr(1);
|
|
6938
|
-
break;
|
|
6939
|
-
case "/":
|
|
6940
|
-
src[i] /= +value.substr(1);
|
|
6941
|
-
break;
|
|
6942
|
-
default:
|
|
6943
|
-
src[i] = +value;
|
|
6944
|
-
}
|
|
6945
|
-
} else if (type_default(value) === "number") {
|
|
6946
|
-
src[i] = value;
|
|
6947
|
-
} else {
|
|
6948
|
-
throw new Error(`unsupported value for Color.set`);
|
|
6949
|
-
}
|
|
6950
|
-
const out = new Color_default(src, mode);
|
|
6951
|
-
if (mutate) {
|
|
6952
|
-
this._rgb = out._rgb;
|
|
6953
|
-
return this;
|
|
6954
|
-
}
|
|
6955
|
-
return out;
|
|
6956
|
-
}
|
|
6957
|
-
throw new Error(`unknown channel ${channel} in mode ${mode}`);
|
|
6958
|
-
} else {
|
|
6959
|
-
return src;
|
|
6960
|
-
}
|
|
6961
|
-
};
|
|
6962
|
-
|
|
6963
|
-
// node_modules/chroma-js/src/ops/shade.js
|
|
6964
|
-
Color_default.prototype.tint = function(f = 0.5, ...rest) {
|
|
6965
|
-
return mix_default(this, "white", f, ...rest);
|
|
6966
|
-
};
|
|
6967
|
-
Color_default.prototype.shade = function(f = 0.5, ...rest) {
|
|
6968
|
-
return mix_default(this, "black", f, ...rest);
|
|
6969
|
-
};
|
|
6970
|
-
|
|
6971
|
-
// node_modules/chroma-js/src/interpolator/rgb.js
|
|
6972
|
-
var rgb = (col1, col2, f) => {
|
|
6973
|
-
const xyz0 = col1._rgb;
|
|
6974
|
-
const xyz1 = col2._rgb;
|
|
6975
|
-
return new Color_default(
|
|
6976
|
-
xyz0[0] + f * (xyz1[0] - xyz0[0]),
|
|
6977
|
-
xyz0[1] + f * (xyz1[1] - xyz0[1]),
|
|
6978
|
-
xyz0[2] + f * (xyz1[2] - xyz0[2]),
|
|
6979
|
-
"rgb"
|
|
6980
|
-
);
|
|
6981
|
-
};
|
|
6982
|
-
interpolator_default.rgb = rgb;
|
|
6983
|
-
|
|
6984
|
-
// node_modules/chroma-js/src/interpolator/lrgb.js
|
|
6985
|
-
var { sqrt: sqrt3, pow: pow6 } = Math;
|
|
6986
|
-
var lrgb = (col1, col2, f) => {
|
|
6987
|
-
const [x1, y1, z1] = col1._rgb;
|
|
6988
|
-
const [x2, y2, z2] = col2._rgb;
|
|
6989
|
-
return new Color_default(
|
|
6990
|
-
sqrt3(pow6(x1, 2) * (1 - f) + pow6(x2, 2) * f),
|
|
6991
|
-
sqrt3(pow6(y1, 2) * (1 - f) + pow6(y2, 2) * f),
|
|
6992
|
-
sqrt3(pow6(z1, 2) * (1 - f) + pow6(z2, 2) * f),
|
|
6993
|
-
"rgb"
|
|
6994
|
-
);
|
|
6995
|
-
};
|
|
6996
|
-
interpolator_default.lrgb = lrgb;
|
|
6997
|
-
|
|
6998
|
-
// node_modules/chroma-js/src/interpolator/lab.js
|
|
6999
|
-
var lab = (col1, col2, f) => {
|
|
7000
|
-
const xyz0 = col1.lab();
|
|
7001
|
-
const xyz1 = col2.lab();
|
|
7002
|
-
return new Color_default(
|
|
7003
|
-
xyz0[0] + f * (xyz1[0] - xyz0[0]),
|
|
7004
|
-
xyz0[1] + f * (xyz1[1] - xyz0[1]),
|
|
7005
|
-
xyz0[2] + f * (xyz1[2] - xyz0[2]),
|
|
7006
|
-
"lab"
|
|
7007
|
-
);
|
|
7008
|
-
};
|
|
7009
|
-
interpolator_default.lab = lab;
|
|
7010
|
-
|
|
7011
|
-
// node_modules/chroma-js/src/interpolator/_hsx.js
|
|
7012
|
-
var hsx_default = (col1, col2, f, m) => {
|
|
7013
|
-
let xyz0, xyz1;
|
|
7014
|
-
if (m === "hsl") {
|
|
7015
|
-
xyz0 = col1.hsl();
|
|
7016
|
-
xyz1 = col2.hsl();
|
|
7017
|
-
} else if (m === "hsv") {
|
|
7018
|
-
xyz0 = col1.hsv();
|
|
7019
|
-
xyz1 = col2.hsv();
|
|
7020
|
-
} else if (m === "hcg") {
|
|
7021
|
-
xyz0 = col1.hcg();
|
|
7022
|
-
xyz1 = col2.hcg();
|
|
7023
|
-
} else if (m === "hsi") {
|
|
7024
|
-
xyz0 = col1.hsi();
|
|
7025
|
-
xyz1 = col2.hsi();
|
|
7026
|
-
} else if (m === "lch" || m === "hcl") {
|
|
7027
|
-
m = "hcl";
|
|
7028
|
-
xyz0 = col1.hcl();
|
|
7029
|
-
xyz1 = col2.hcl();
|
|
7030
|
-
} else if (m === "oklch") {
|
|
7031
|
-
xyz0 = col1.oklch().reverse();
|
|
7032
|
-
xyz1 = col2.oklch().reverse();
|
|
7033
|
-
}
|
|
7034
|
-
let hue0, hue1, sat0, sat1, lbv0, lbv1;
|
|
7035
|
-
if (m.substr(0, 1) === "h" || m === "oklch") {
|
|
7036
|
-
[hue0, sat0, lbv0] = xyz0;
|
|
7037
|
-
[hue1, sat1, lbv1] = xyz1;
|
|
7038
|
-
}
|
|
7039
|
-
let sat, hue, lbv, dh;
|
|
7040
|
-
if (!isNaN(hue0) && !isNaN(hue1)) {
|
|
7041
|
-
if (hue1 > hue0 && hue1 - hue0 > 180) {
|
|
7042
|
-
dh = hue1 - (hue0 + 360);
|
|
7043
|
-
} else if (hue1 < hue0 && hue0 - hue1 > 180) {
|
|
7044
|
-
dh = hue1 + 360 - hue0;
|
|
7045
|
-
} else {
|
|
7046
|
-
dh = hue1 - hue0;
|
|
7047
|
-
}
|
|
7048
|
-
hue = hue0 + f * dh;
|
|
7049
|
-
} else if (!isNaN(hue0)) {
|
|
7050
|
-
hue = hue0;
|
|
7051
|
-
if ((lbv1 == 1 || lbv1 == 0) && m != "hsv") sat = sat0;
|
|
7052
|
-
} else if (!isNaN(hue1)) {
|
|
7053
|
-
hue = hue1;
|
|
7054
|
-
if ((lbv0 == 1 || lbv0 == 0) && m != "hsv") sat = sat1;
|
|
7055
|
-
} else {
|
|
7056
|
-
hue = Number.NaN;
|
|
7057
|
-
}
|
|
7058
|
-
if (sat === void 0) sat = sat0 + f * (sat1 - sat0);
|
|
7059
|
-
lbv = lbv0 + f * (lbv1 - lbv0);
|
|
7060
|
-
return m === "oklch" ? new Color_default([lbv, sat, hue], m) : new Color_default([hue, sat, lbv], m);
|
|
7061
|
-
};
|
|
7062
|
-
|
|
7063
|
-
// node_modules/chroma-js/src/interpolator/lch.js
|
|
7064
|
-
var lch = (col1, col2, f) => {
|
|
7065
|
-
return hsx_default(col1, col2, f, "lch");
|
|
7066
|
-
};
|
|
7067
|
-
interpolator_default.lch = lch;
|
|
7068
|
-
interpolator_default.hcl = lch;
|
|
7069
|
-
|
|
7070
|
-
// node_modules/chroma-js/src/interpolator/num.js
|
|
7071
|
-
var num = (col1, col2, f) => {
|
|
7072
|
-
const c1 = col1.num();
|
|
7073
|
-
const c2 = col2.num();
|
|
7074
|
-
return new Color_default(c1 + f * (c2 - c1), "num");
|
|
7075
|
-
};
|
|
7076
|
-
interpolator_default.num = num;
|
|
7077
|
-
|
|
7078
|
-
// node_modules/chroma-js/src/interpolator/hcg.js
|
|
7079
|
-
var hcg = (col1, col2, f) => {
|
|
7080
|
-
return hsx_default(col1, col2, f, "hcg");
|
|
7081
|
-
};
|
|
7082
|
-
interpolator_default.hcg = hcg;
|
|
7083
|
-
|
|
7084
|
-
// node_modules/chroma-js/src/interpolator/hsi.js
|
|
7085
|
-
var hsi = (col1, col2, f) => {
|
|
7086
|
-
return hsx_default(col1, col2, f, "hsi");
|
|
7087
|
-
};
|
|
7088
|
-
interpolator_default.hsi = hsi;
|
|
7089
|
-
|
|
7090
|
-
// node_modules/chroma-js/src/interpolator/hsl.js
|
|
7091
|
-
var hsl = (col1, col2, f) => {
|
|
7092
|
-
return hsx_default(col1, col2, f, "hsl");
|
|
7093
|
-
};
|
|
7094
|
-
interpolator_default.hsl = hsl;
|
|
7095
|
-
|
|
7096
|
-
// node_modules/chroma-js/src/interpolator/hsv.js
|
|
7097
|
-
var hsv = (col1, col2, f) => {
|
|
7098
|
-
return hsx_default(col1, col2, f, "hsv");
|
|
7099
|
-
};
|
|
7100
|
-
interpolator_default.hsv = hsv;
|
|
7101
|
-
|
|
7102
|
-
// node_modules/chroma-js/src/interpolator/oklab.js
|
|
7103
|
-
var oklab = (col1, col2, f) => {
|
|
7104
|
-
const xyz0 = col1.oklab();
|
|
7105
|
-
const xyz1 = col2.oklab();
|
|
7106
|
-
return new Color_default(
|
|
7107
|
-
xyz0[0] + f * (xyz1[0] - xyz0[0]),
|
|
7108
|
-
xyz0[1] + f * (xyz1[1] - xyz0[1]),
|
|
7109
|
-
xyz0[2] + f * (xyz1[2] - xyz0[2]),
|
|
7110
|
-
"oklab"
|
|
7111
|
-
);
|
|
7112
|
-
};
|
|
7113
|
-
interpolator_default.oklab = oklab;
|
|
7114
|
-
|
|
7115
|
-
// node_modules/chroma-js/src/interpolator/oklch.js
|
|
7116
|
-
var oklch = (col1, col2, f) => {
|
|
7117
|
-
return hsx_default(col1, col2, f, "oklch");
|
|
7118
|
-
};
|
|
7119
|
-
interpolator_default.oklch = oklch;
|
|
7120
|
-
|
|
7121
|
-
// node_modules/chroma-js/src/generator/average.js
|
|
7122
|
-
var { pow: pow7, sqrt: sqrt4, PI: PI2, cos: cos3, sin: sin2, atan2: atan22 } = Math;
|
|
7123
|
-
var average_default = (colors, mode = "lrgb", weights = null) => {
|
|
7124
|
-
const l = colors.length;
|
|
7125
|
-
if (!weights) weights = Array.from(new Array(l)).map(() => 1);
|
|
7126
|
-
const k = l / weights.reduce(function(a, b) {
|
|
7127
|
-
return a + b;
|
|
7128
|
-
});
|
|
7129
|
-
weights.forEach((w, i) => {
|
|
7130
|
-
weights[i] *= k;
|
|
7131
|
-
});
|
|
7132
|
-
colors = colors.map((c) => new Color_default(c));
|
|
7133
|
-
if (mode === "lrgb") {
|
|
7134
|
-
return _average_lrgb(colors, weights);
|
|
7135
|
-
}
|
|
7136
|
-
const first = colors.shift();
|
|
7137
|
-
const xyz = first.get(mode);
|
|
7138
|
-
const cnt = [];
|
|
7139
|
-
let dx = 0;
|
|
7140
|
-
let dy = 0;
|
|
7141
|
-
for (let i = 0; i < xyz.length; i++) {
|
|
7142
|
-
xyz[i] = (xyz[i] || 0) * weights[0];
|
|
7143
|
-
cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);
|
|
7144
|
-
if (mode.charAt(i) === "h" && !isNaN(xyz[i])) {
|
|
7145
|
-
const A = xyz[i] / 180 * PI2;
|
|
7146
|
-
dx += cos3(A) * weights[0];
|
|
7147
|
-
dy += sin2(A) * weights[0];
|
|
7148
|
-
}
|
|
7149
|
-
}
|
|
7150
|
-
let alpha = first.alpha() * weights[0];
|
|
7151
|
-
colors.forEach((c, ci) => {
|
|
7152
|
-
const xyz2 = c.get(mode);
|
|
7153
|
-
alpha += c.alpha() * weights[ci + 1];
|
|
7154
|
-
for (let i = 0; i < xyz.length; i++) {
|
|
7155
|
-
if (!isNaN(xyz2[i])) {
|
|
7156
|
-
cnt[i] += weights[ci + 1];
|
|
7157
|
-
if (mode.charAt(i) === "h") {
|
|
7158
|
-
const A = xyz2[i] / 180 * PI2;
|
|
7159
|
-
dx += cos3(A) * weights[ci + 1];
|
|
7160
|
-
dy += sin2(A) * weights[ci + 1];
|
|
7161
|
-
} else {
|
|
7162
|
-
xyz[i] += xyz2[i] * weights[ci + 1];
|
|
7163
|
-
}
|
|
7164
|
-
}
|
|
7165
|
-
}
|
|
7166
|
-
});
|
|
7167
|
-
for (let i = 0; i < xyz.length; i++) {
|
|
7168
|
-
if (mode.charAt(i) === "h") {
|
|
7169
|
-
let A = atan22(dy / cnt[i], dx / cnt[i]) / PI2 * 180;
|
|
7170
|
-
while (A < 0) A += 360;
|
|
7171
|
-
while (A >= 360) A -= 360;
|
|
7172
|
-
xyz[i] = A;
|
|
7173
|
-
} else {
|
|
7174
|
-
xyz[i] = xyz[i] / cnt[i];
|
|
7175
|
-
}
|
|
7176
|
-
}
|
|
7177
|
-
alpha /= l;
|
|
7178
|
-
return new Color_default(xyz, mode).alpha(alpha > 0.99999 ? 1 : alpha, true);
|
|
7179
|
-
};
|
|
7180
|
-
var _average_lrgb = (colors, weights) => {
|
|
7181
|
-
const l = colors.length;
|
|
7182
|
-
const xyz = [0, 0, 0, 0];
|
|
7183
|
-
for (let i = 0; i < colors.length; i++) {
|
|
7184
|
-
const col = colors[i];
|
|
7185
|
-
const f = weights[i] / l;
|
|
7186
|
-
const rgb2 = col._rgb;
|
|
7187
|
-
xyz[0] += pow7(rgb2[0], 2) * f;
|
|
7188
|
-
xyz[1] += pow7(rgb2[1], 2) * f;
|
|
7189
|
-
xyz[2] += pow7(rgb2[2], 2) * f;
|
|
7190
|
-
xyz[3] += rgb2[3] * f;
|
|
7191
|
-
}
|
|
7192
|
-
xyz[0] = sqrt4(xyz[0]);
|
|
7193
|
-
xyz[1] = sqrt4(xyz[1]);
|
|
7194
|
-
xyz[2] = sqrt4(xyz[2]);
|
|
7195
|
-
if (xyz[3] > 0.9999999) xyz[3] = 1;
|
|
7196
|
-
return new Color_default(clip_rgb_default(xyz));
|
|
7197
|
-
};
|
|
7198
|
-
|
|
7199
|
-
// node_modules/chroma-js/src/generator/scale.js
|
|
7200
|
-
var { pow: pow8 } = Math;
|
|
7201
|
-
function scale_default(colors) {
|
|
7202
|
-
let _mode = "rgb";
|
|
7203
|
-
let _nacol = chroma_default("#ccc");
|
|
7204
|
-
let _spread = 0;
|
|
7205
|
-
let _domain = [0, 1];
|
|
7206
|
-
let _pos = [];
|
|
7207
|
-
let _padding = [0, 0];
|
|
7208
|
-
let _classes = false;
|
|
7209
|
-
let _colors = [];
|
|
7210
|
-
let _out = false;
|
|
7211
|
-
let _min = 0;
|
|
7212
|
-
let _max = 1;
|
|
7213
|
-
let _correctLightness = false;
|
|
7214
|
-
let _colorCache = {};
|
|
7215
|
-
let _useCache = true;
|
|
7216
|
-
let _gamma = 1;
|
|
7217
|
-
const setColors = function(colors2) {
|
|
7218
|
-
colors2 = colors2 || ["#fff", "#000"];
|
|
7219
|
-
if (colors2 && type_default(colors2) === "string" && chroma_default.brewer && chroma_default.brewer[colors2.toLowerCase()]) {
|
|
7220
|
-
colors2 = chroma_default.brewer[colors2.toLowerCase()];
|
|
7221
|
-
}
|
|
7222
|
-
if (type_default(colors2) === "array") {
|
|
7223
|
-
if (colors2.length === 1) {
|
|
7224
|
-
colors2 = [colors2[0], colors2[0]];
|
|
7225
|
-
}
|
|
7226
|
-
colors2 = colors2.slice(0);
|
|
7227
|
-
for (let c = 0; c < colors2.length; c++) {
|
|
7228
|
-
colors2[c] = chroma_default(colors2[c]);
|
|
7229
|
-
}
|
|
7230
|
-
_pos.length = 0;
|
|
7231
|
-
for (let c = 0; c < colors2.length; c++) {
|
|
7232
|
-
_pos.push(c / (colors2.length - 1));
|
|
7233
|
-
}
|
|
7234
|
-
}
|
|
7235
|
-
resetCache();
|
|
7236
|
-
return _colors = colors2;
|
|
7237
|
-
};
|
|
7238
|
-
const getClass = function(value) {
|
|
7239
|
-
if (_classes != null) {
|
|
7240
|
-
const n = _classes.length - 1;
|
|
7241
|
-
let i = 0;
|
|
7242
|
-
while (i < n && value >= _classes[i]) {
|
|
7243
|
-
i++;
|
|
7244
|
-
}
|
|
7245
|
-
return i - 1;
|
|
7246
|
-
}
|
|
7247
|
-
return 0;
|
|
7248
|
-
};
|
|
7249
|
-
let tMapLightness = (t) => t;
|
|
7250
|
-
let tMapDomain = (t) => t;
|
|
7251
|
-
const getColor = function(val, bypassMap) {
|
|
7252
|
-
let col, t;
|
|
7253
|
-
if (bypassMap == null) {
|
|
7254
|
-
bypassMap = false;
|
|
7255
|
-
}
|
|
7256
|
-
if (isNaN(val) || val === null) {
|
|
7257
|
-
return _nacol;
|
|
7258
|
-
}
|
|
7259
|
-
if (!bypassMap) {
|
|
7260
|
-
if (_classes && _classes.length > 2) {
|
|
7261
|
-
const c = getClass(val);
|
|
7262
|
-
t = c / (_classes.length - 2);
|
|
7263
|
-
} else if (_max !== _min) {
|
|
7264
|
-
t = (val - _min) / (_max - _min);
|
|
7265
|
-
} else {
|
|
7266
|
-
t = 1;
|
|
7267
|
-
}
|
|
7268
|
-
} else {
|
|
7269
|
-
t = val;
|
|
7270
|
-
}
|
|
7271
|
-
t = tMapDomain(t);
|
|
7272
|
-
if (!bypassMap) {
|
|
7273
|
-
t = tMapLightness(t);
|
|
7274
|
-
}
|
|
7275
|
-
if (_gamma !== 1) {
|
|
7276
|
-
t = pow8(t, _gamma);
|
|
7277
|
-
}
|
|
7278
|
-
t = _padding[0] + t * (1 - _padding[0] - _padding[1]);
|
|
7279
|
-
t = limit_default(t, 0, 1);
|
|
7280
|
-
const k = Math.floor(t * 1e4);
|
|
7281
|
-
if (_useCache && _colorCache[k]) {
|
|
7282
|
-
col = _colorCache[k];
|
|
7283
|
-
} else {
|
|
7284
|
-
if (type_default(_colors) === "array") {
|
|
7285
|
-
for (let i = 0; i < _pos.length; i++) {
|
|
7286
|
-
const p = _pos[i];
|
|
7287
|
-
if (t <= p) {
|
|
7288
|
-
col = _colors[i];
|
|
7289
|
-
break;
|
|
7290
|
-
}
|
|
7291
|
-
if (t >= p && i === _pos.length - 1) {
|
|
7292
|
-
col = _colors[i];
|
|
7293
|
-
break;
|
|
7294
|
-
}
|
|
7295
|
-
if (t > p && t < _pos[i + 1]) {
|
|
7296
|
-
t = (t - p) / (_pos[i + 1] - p);
|
|
7297
|
-
col = chroma_default.interpolate(
|
|
7298
|
-
_colors[i],
|
|
7299
|
-
_colors[i + 1],
|
|
7300
|
-
t,
|
|
7301
|
-
_mode
|
|
7302
|
-
);
|
|
7303
|
-
break;
|
|
7304
|
-
}
|
|
7305
|
-
}
|
|
7306
|
-
} else if (type_default(_colors) === "function") {
|
|
7307
|
-
col = _colors(t);
|
|
7308
|
-
}
|
|
7309
|
-
if (_useCache) {
|
|
7310
|
-
_colorCache[k] = col;
|
|
7311
|
-
}
|
|
7312
|
-
}
|
|
7313
|
-
return col;
|
|
7314
|
-
};
|
|
7315
|
-
var resetCache = () => _colorCache = {};
|
|
7316
|
-
setColors(colors);
|
|
7317
|
-
const f = function(v) {
|
|
7318
|
-
const c = chroma_default(getColor(v));
|
|
7319
|
-
if (_out && c[_out]) {
|
|
7320
|
-
return c[_out]();
|
|
7321
|
-
} else {
|
|
7322
|
-
return c;
|
|
7323
|
-
}
|
|
7324
|
-
};
|
|
7325
|
-
f.classes = function(classes) {
|
|
7326
|
-
if (classes != null) {
|
|
7327
|
-
if (type_default(classes) === "array") {
|
|
7328
|
-
_classes = classes;
|
|
7329
|
-
_domain = [classes[0], classes[classes.length - 1]];
|
|
7330
|
-
} else {
|
|
7331
|
-
const d = chroma_default.analyze(_domain);
|
|
7332
|
-
if (classes === 0) {
|
|
7333
|
-
_classes = [d.min, d.max];
|
|
7334
|
-
} else {
|
|
7335
|
-
_classes = chroma_default.limits(d, "e", classes);
|
|
7336
|
-
}
|
|
7337
|
-
}
|
|
7338
|
-
return f;
|
|
7339
|
-
}
|
|
7340
|
-
return _classes;
|
|
7341
|
-
};
|
|
7342
|
-
f.domain = function(domain) {
|
|
7343
|
-
if (!arguments.length) {
|
|
7344
|
-
return _domain;
|
|
7345
|
-
}
|
|
7346
|
-
_min = domain[0];
|
|
7347
|
-
_max = domain[domain.length - 1];
|
|
7348
|
-
_pos = [];
|
|
7349
|
-
const k = _colors.length;
|
|
7350
|
-
if (domain.length === k && _min !== _max) {
|
|
7351
|
-
for (let d of Array.from(domain)) {
|
|
7352
|
-
_pos.push((d - _min) / (_max - _min));
|
|
7353
|
-
}
|
|
7354
|
-
} else {
|
|
7355
|
-
for (let c = 0; c < k; c++) {
|
|
7356
|
-
_pos.push(c / (k - 1));
|
|
7357
|
-
}
|
|
7358
|
-
if (domain.length > 2) {
|
|
7359
|
-
const tOut = domain.map((d, i) => i / (domain.length - 1));
|
|
7360
|
-
const tBreaks = domain.map((d) => (d - _min) / (_max - _min));
|
|
7361
|
-
if (!tBreaks.every((val, i) => tOut[i] === val)) {
|
|
7362
|
-
tMapDomain = (t) => {
|
|
7363
|
-
if (t <= 0 || t >= 1) return t;
|
|
7364
|
-
let i = 0;
|
|
7365
|
-
while (t >= tBreaks[i + 1]) i++;
|
|
7366
|
-
const f2 = (t - tBreaks[i]) / (tBreaks[i + 1] - tBreaks[i]);
|
|
7367
|
-
const out = tOut[i] + f2 * (tOut[i + 1] - tOut[i]);
|
|
7368
|
-
return out;
|
|
7369
|
-
};
|
|
7370
|
-
}
|
|
7371
|
-
}
|
|
7372
|
-
}
|
|
7373
|
-
_domain = [_min, _max];
|
|
7374
|
-
return f;
|
|
7375
|
-
};
|
|
7376
|
-
f.mode = function(_m) {
|
|
7377
|
-
if (!arguments.length) {
|
|
7378
|
-
return _mode;
|
|
7379
|
-
}
|
|
7380
|
-
_mode = _m;
|
|
7381
|
-
resetCache();
|
|
7382
|
-
return f;
|
|
7383
|
-
};
|
|
7384
|
-
f.range = function(colors2, _pos2) {
|
|
7385
|
-
setColors(colors2);
|
|
7386
|
-
return f;
|
|
7387
|
-
};
|
|
7388
|
-
f.out = function(_o) {
|
|
7389
|
-
_out = _o;
|
|
7390
|
-
return f;
|
|
7391
|
-
};
|
|
7392
|
-
f.spread = function(val) {
|
|
7393
|
-
if (!arguments.length) {
|
|
7394
|
-
return _spread;
|
|
7395
|
-
}
|
|
7396
|
-
_spread = val;
|
|
7397
|
-
return f;
|
|
7398
|
-
};
|
|
7399
|
-
f.correctLightness = function(v) {
|
|
7400
|
-
if (v == null) {
|
|
7401
|
-
v = true;
|
|
7402
|
-
}
|
|
7403
|
-
_correctLightness = v;
|
|
7404
|
-
resetCache();
|
|
7405
|
-
if (_correctLightness) {
|
|
7406
|
-
tMapLightness = function(t) {
|
|
7407
|
-
const L0 = getColor(0, true).lab()[0];
|
|
7408
|
-
const L1 = getColor(1, true).lab()[0];
|
|
7409
|
-
const pol = L0 > L1;
|
|
7410
|
-
let L_actual = getColor(t, true).lab()[0];
|
|
7411
|
-
const L_ideal = L0 + (L1 - L0) * t;
|
|
7412
|
-
let L_diff = L_actual - L_ideal;
|
|
7413
|
-
let t0 = 0;
|
|
7414
|
-
let t1 = 1;
|
|
7415
|
-
let max_iter = 20;
|
|
7416
|
-
while (Math.abs(L_diff) > 0.01 && max_iter-- > 0) {
|
|
7417
|
-
(function() {
|
|
7418
|
-
if (pol) {
|
|
7419
|
-
L_diff *= -1;
|
|
7420
|
-
}
|
|
7421
|
-
if (L_diff < 0) {
|
|
7422
|
-
t0 = t;
|
|
7423
|
-
t += (t1 - t) * 0.5;
|
|
7424
|
-
} else {
|
|
7425
|
-
t1 = t;
|
|
7426
|
-
t += (t0 - t) * 0.5;
|
|
7427
|
-
}
|
|
7428
|
-
L_actual = getColor(t, true).lab()[0];
|
|
7429
|
-
return L_diff = L_actual - L_ideal;
|
|
7430
|
-
})();
|
|
7431
|
-
}
|
|
7432
|
-
return t;
|
|
7433
|
-
};
|
|
7434
|
-
} else {
|
|
7435
|
-
tMapLightness = (t) => t;
|
|
7436
|
-
}
|
|
7437
|
-
return f;
|
|
7438
|
-
};
|
|
7439
|
-
f.padding = function(p) {
|
|
7440
|
-
if (p != null) {
|
|
7441
|
-
if (type_default(p) === "number") {
|
|
7442
|
-
p = [p, p];
|
|
7443
|
-
}
|
|
7444
|
-
_padding = p;
|
|
7445
|
-
return f;
|
|
7446
|
-
} else {
|
|
7447
|
-
return _padding;
|
|
7448
|
-
}
|
|
7449
|
-
};
|
|
7450
|
-
f.colors = function(numColors, out) {
|
|
7451
|
-
if (arguments.length < 2) {
|
|
7452
|
-
out = "hex";
|
|
7453
|
-
}
|
|
7454
|
-
let result = [];
|
|
7455
|
-
if (arguments.length === 0) {
|
|
7456
|
-
result = _colors.slice(0);
|
|
7457
|
-
} else if (numColors === 1) {
|
|
7458
|
-
result = [f(0.5)];
|
|
7459
|
-
} else if (numColors > 1) {
|
|
7460
|
-
const dm = _domain[0];
|
|
7461
|
-
const dd = _domain[1] - dm;
|
|
7462
|
-
result = __range__(0, numColors).map(
|
|
7463
|
-
(i) => f(dm + i / (numColors - 1) * dd)
|
|
7464
|
-
);
|
|
7465
|
-
} else {
|
|
7466
|
-
colors = [];
|
|
7467
|
-
let samples = [];
|
|
7468
|
-
if (_classes && _classes.length > 2) {
|
|
7469
|
-
for (let i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
|
|
7470
|
-
samples.push((_classes[i - 1] + _classes[i]) * 0.5);
|
|
7471
|
-
}
|
|
7472
|
-
} else {
|
|
7473
|
-
samples = _domain;
|
|
7474
|
-
}
|
|
7475
|
-
result = samples.map((v) => f(v));
|
|
7476
|
-
}
|
|
7477
|
-
if (chroma_default[out]) {
|
|
7478
|
-
result = result.map((c) => c[out]());
|
|
7479
|
-
}
|
|
7480
|
-
return result;
|
|
7481
|
-
};
|
|
7482
|
-
f.cache = function(c) {
|
|
7483
|
-
if (c != null) {
|
|
7484
|
-
_useCache = c;
|
|
7485
|
-
return f;
|
|
7486
|
-
} else {
|
|
7487
|
-
return _useCache;
|
|
7488
|
-
}
|
|
7489
|
-
};
|
|
7490
|
-
f.gamma = function(g) {
|
|
7491
|
-
if (g != null) {
|
|
7492
|
-
_gamma = g;
|
|
7493
|
-
return f;
|
|
7494
|
-
} else {
|
|
7495
|
-
return _gamma;
|
|
7496
|
-
}
|
|
7497
|
-
};
|
|
7498
|
-
f.nodata = function(d) {
|
|
7499
|
-
if (d != null) {
|
|
7500
|
-
_nacol = chroma_default(d);
|
|
7501
|
-
return f;
|
|
7502
|
-
} else {
|
|
7503
|
-
return _nacol;
|
|
7504
|
-
}
|
|
7505
|
-
};
|
|
7506
|
-
return f;
|
|
7507
|
-
}
|
|
7508
|
-
function __range__(left, right, inclusive) {
|
|
7509
|
-
let range = [];
|
|
7510
|
-
let ascending = left < right;
|
|
7511
|
-
let end = right ;
|
|
7512
|
-
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
|
7513
|
-
range.push(i);
|
|
7514
|
-
}
|
|
7515
|
-
return range;
|
|
7516
|
-
}
|
|
7517
|
-
|
|
7518
|
-
// node_modules/chroma-js/src/generator/bezier.js
|
|
7519
|
-
var binom_row = function(n) {
|
|
7520
|
-
let row = [1, 1];
|
|
7521
|
-
for (let i = 1; i < n; i++) {
|
|
7522
|
-
let newrow = [1];
|
|
7523
|
-
for (let j = 1; j <= row.length; j++) {
|
|
7524
|
-
newrow[j] = (row[j] || 0) + row[j - 1];
|
|
7525
|
-
}
|
|
7526
|
-
row = newrow;
|
|
7527
|
-
}
|
|
7528
|
-
return row;
|
|
7529
|
-
};
|
|
7530
|
-
var bezier = function(colors) {
|
|
7531
|
-
let I, lab0, lab1, lab2;
|
|
7532
|
-
colors = colors.map((c) => new Color_default(c));
|
|
7533
|
-
if (colors.length === 2) {
|
|
7534
|
-
[lab0, lab1] = colors.map((c) => c.lab());
|
|
7535
|
-
I = function(t) {
|
|
7536
|
-
const lab3 = [0, 1, 2].map((i) => lab0[i] + t * (lab1[i] - lab0[i]));
|
|
7537
|
-
return new Color_default(lab3, "lab");
|
|
7538
|
-
};
|
|
7539
|
-
} else if (colors.length === 3) {
|
|
7540
|
-
[lab0, lab1, lab2] = colors.map((c) => c.lab());
|
|
7541
|
-
I = function(t) {
|
|
7542
|
-
const lab3 = [0, 1, 2].map(
|
|
7543
|
-
(i) => (1 - t) * (1 - t) * lab0[i] + 2 * (1 - t) * t * lab1[i] + t * t * lab2[i]
|
|
7544
|
-
);
|
|
7545
|
-
return new Color_default(lab3, "lab");
|
|
7546
|
-
};
|
|
7547
|
-
} else if (colors.length === 4) {
|
|
7548
|
-
let lab3;
|
|
7549
|
-
[lab0, lab1, lab2, lab3] = colors.map((c) => c.lab());
|
|
7550
|
-
I = function(t) {
|
|
7551
|
-
const lab4 = [0, 1, 2].map(
|
|
7552
|
-
(i) => (1 - t) * (1 - t) * (1 - t) * lab0[i] + 3 * (1 - t) * (1 - t) * t * lab1[i] + 3 * (1 - t) * t * t * lab2[i] + t * t * t * lab3[i]
|
|
7553
|
-
);
|
|
7554
|
-
return new Color_default(lab4, "lab");
|
|
7555
|
-
};
|
|
7556
|
-
} else if (colors.length >= 5) {
|
|
7557
|
-
let labs, row, n;
|
|
7558
|
-
labs = colors.map((c) => c.lab());
|
|
7559
|
-
n = colors.length - 1;
|
|
7560
|
-
row = binom_row(n);
|
|
7561
|
-
I = function(t) {
|
|
7562
|
-
const u = 1 - t;
|
|
7563
|
-
const lab3 = [0, 1, 2].map(
|
|
7564
|
-
(i) => labs.reduce(
|
|
7565
|
-
(sum, el, j) => sum + row[j] * u ** (n - j) * t ** j * el[i],
|
|
7566
|
-
0
|
|
7567
|
-
)
|
|
7568
|
-
);
|
|
7569
|
-
return new Color_default(lab3, "lab");
|
|
7570
|
-
};
|
|
7571
|
-
} else {
|
|
7572
|
-
throw new RangeError("No point in running bezier with only one color.");
|
|
7573
|
-
}
|
|
7574
|
-
return I;
|
|
7575
|
-
};
|
|
7576
|
-
var bezier_default = (colors) => {
|
|
7577
|
-
const f = bezier(colors);
|
|
7578
|
-
f.scale = () => scale_default(f);
|
|
7579
|
-
return f;
|
|
7580
|
-
};
|
|
7581
|
-
|
|
7582
|
-
// node_modules/chroma-js/src/generator/blend.js
|
|
7583
|
-
var blend = (bottom, top, mode) => {
|
|
7584
|
-
if (!blend[mode]) {
|
|
7585
|
-
throw new Error("unknown blend mode " + mode);
|
|
7586
|
-
}
|
|
7587
|
-
return blend[mode](bottom, top);
|
|
7588
|
-
};
|
|
7589
|
-
var blend_f = (f) => (bottom, top) => {
|
|
7590
|
-
const c0 = chroma_default(top).rgb();
|
|
7591
|
-
const c1 = chroma_default(bottom).rgb();
|
|
7592
|
-
return chroma_default.rgb(f(c0, c1));
|
|
7593
|
-
};
|
|
7594
|
-
var each = (f) => (c0, c1) => {
|
|
7595
|
-
const out = [];
|
|
7596
|
-
out[0] = f(c0[0], c1[0]);
|
|
7597
|
-
out[1] = f(c0[1], c1[1]);
|
|
7598
|
-
out[2] = f(c0[2], c1[2]);
|
|
7599
|
-
return out;
|
|
7600
|
-
};
|
|
7601
|
-
var normal = (a) => a;
|
|
7602
|
-
var multiply = (a, b) => a * b / 255;
|
|
7603
|
-
var darken = (a, b) => a > b ? b : a;
|
|
7604
|
-
var lighten = (a, b) => a > b ? a : b;
|
|
7605
|
-
var screen = (a, b) => 255 * (1 - (1 - a / 255) * (1 - b / 255));
|
|
7606
|
-
var overlay = (a, b) => b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255));
|
|
7607
|
-
var burn = (a, b) => 255 * (1 - (1 - b / 255) / (a / 255));
|
|
7608
|
-
var dodge = (a, b) => {
|
|
7609
|
-
if (a === 255) return 255;
|
|
7610
|
-
a = 255 * (b / 255) / (1 - a / 255);
|
|
7611
|
-
return a > 255 ? 255 : a;
|
|
7612
|
-
};
|
|
7613
|
-
blend.normal = blend_f(each(normal));
|
|
7614
|
-
blend.multiply = blend_f(each(multiply));
|
|
7615
|
-
blend.screen = blend_f(each(screen));
|
|
7616
|
-
blend.overlay = blend_f(each(overlay));
|
|
7617
|
-
blend.darken = blend_f(each(darken));
|
|
7618
|
-
blend.lighten = blend_f(each(lighten));
|
|
7619
|
-
blend.dodge = blend_f(each(dodge));
|
|
7620
|
-
blend.burn = blend_f(each(burn));
|
|
7621
|
-
var blend_default = blend;
|
|
7622
|
-
|
|
7623
|
-
// node_modules/chroma-js/src/generator/cubehelix.js
|
|
7624
|
-
var { pow: pow9, sin: sin3, cos: cos4 } = Math;
|
|
7625
|
-
function cubehelix_default(start = 300, rotations = -1.5, hue = 1, gamma = 1, lightness = [0, 1]) {
|
|
7626
|
-
let dh = 0, dl;
|
|
7627
|
-
if (type_default(lightness) === "array") {
|
|
7628
|
-
dl = lightness[1] - lightness[0];
|
|
7629
|
-
} else {
|
|
7630
|
-
dl = 0;
|
|
7631
|
-
lightness = [lightness, lightness];
|
|
7632
|
-
}
|
|
7633
|
-
const f = function(fract) {
|
|
7634
|
-
const a = TWOPI * ((start + 120) / 360 + rotations * fract);
|
|
7635
|
-
const l = pow9(lightness[0] + dl * fract, gamma);
|
|
7636
|
-
const h = dh !== 0 ? hue[0] + fract * dh : hue;
|
|
7637
|
-
const amp = h * l * (1 - l) / 2;
|
|
7638
|
-
const cos_a = cos4(a);
|
|
7639
|
-
const sin_a = sin3(a);
|
|
7640
|
-
const r = l + amp * (-0.14861 * cos_a + 1.78277 * sin_a);
|
|
7641
|
-
const g = l + amp * (-0.29227 * cos_a - 0.90649 * sin_a);
|
|
7642
|
-
const b = l + amp * (1.97294 * cos_a);
|
|
7643
|
-
return chroma_default(clip_rgb_default([r * 255, g * 255, b * 255, 1]));
|
|
7644
|
-
};
|
|
7645
|
-
f.start = function(s) {
|
|
7646
|
-
if (s == null) {
|
|
7647
|
-
return start;
|
|
7648
|
-
}
|
|
7649
|
-
start = s;
|
|
7650
|
-
return f;
|
|
7651
|
-
};
|
|
7652
|
-
f.rotations = function(r) {
|
|
7653
|
-
if (r == null) {
|
|
7654
|
-
return rotations;
|
|
7655
|
-
}
|
|
7656
|
-
rotations = r;
|
|
7657
|
-
return f;
|
|
7658
|
-
};
|
|
7659
|
-
f.gamma = function(g) {
|
|
7660
|
-
if (g == null) {
|
|
7661
|
-
return gamma;
|
|
7662
|
-
}
|
|
7663
|
-
gamma = g;
|
|
7664
|
-
return f;
|
|
7665
|
-
};
|
|
7666
|
-
f.hue = function(h) {
|
|
7667
|
-
if (h == null) {
|
|
7668
|
-
return hue;
|
|
7669
|
-
}
|
|
7670
|
-
hue = h;
|
|
7671
|
-
if (type_default(hue) === "array") {
|
|
7672
|
-
dh = hue[1] - hue[0];
|
|
7673
|
-
if (dh === 0) {
|
|
7674
|
-
hue = hue[1];
|
|
7675
|
-
}
|
|
7676
|
-
} else {
|
|
7677
|
-
dh = 0;
|
|
7678
|
-
}
|
|
7679
|
-
return f;
|
|
7680
|
-
};
|
|
7681
|
-
f.lightness = function(h) {
|
|
7682
|
-
if (h == null) {
|
|
7683
|
-
return lightness;
|
|
7684
|
-
}
|
|
7685
|
-
if (type_default(h) === "array") {
|
|
7686
|
-
lightness = h;
|
|
7687
|
-
dl = h[1] - h[0];
|
|
7688
|
-
} else {
|
|
7689
|
-
lightness = [h, h];
|
|
7690
|
-
dl = 0;
|
|
7691
|
-
}
|
|
7692
|
-
return f;
|
|
7693
|
-
};
|
|
7694
|
-
f.scale = () => chroma_default.scale(f);
|
|
7695
|
-
f.hue(hue);
|
|
7696
|
-
return f;
|
|
7697
|
-
}
|
|
7698
|
-
|
|
7699
|
-
// node_modules/chroma-js/src/generator/random.js
|
|
7700
|
-
var digits = "0123456789abcdef";
|
|
7701
|
-
var { floor: floor3, random } = Math;
|
|
7702
|
-
var random_default = () => {
|
|
7703
|
-
let code = "#";
|
|
7704
|
-
for (let i = 0; i < 6; i++) {
|
|
7705
|
-
code += digits.charAt(floor3(random() * 16));
|
|
7706
|
-
}
|
|
7707
|
-
return new Color_default(code, "hex");
|
|
7708
|
-
};
|
|
7709
|
-
|
|
7710
|
-
// node_modules/chroma-js/src/utils/analyze.js
|
|
7711
|
-
var { log: log2, pow: pow10, floor: floor4, abs } = Math;
|
|
7712
|
-
function analyze(data, key = null) {
|
|
7713
|
-
const r = {
|
|
7714
|
-
min: Number.MAX_VALUE,
|
|
7715
|
-
max: Number.MAX_VALUE * -1,
|
|
7716
|
-
sum: 0,
|
|
7717
|
-
values: [],
|
|
7718
|
-
count: 0
|
|
7719
|
-
};
|
|
7720
|
-
if (type_default(data) === "object") {
|
|
7721
|
-
data = Object.values(data);
|
|
7722
|
-
}
|
|
7723
|
-
data.forEach((val) => {
|
|
7724
|
-
if (key && type_default(val) === "object") val = val[key];
|
|
7725
|
-
if (val !== void 0 && val !== null && !isNaN(val)) {
|
|
7726
|
-
r.values.push(val);
|
|
7727
|
-
r.sum += val;
|
|
7728
|
-
if (val < r.min) r.min = val;
|
|
7729
|
-
if (val > r.max) r.max = val;
|
|
7730
|
-
r.count += 1;
|
|
7731
|
-
}
|
|
7732
|
-
});
|
|
7733
|
-
r.domain = [r.min, r.max];
|
|
7734
|
-
r.limits = (mode, num2) => limits(r, mode, num2);
|
|
7735
|
-
return r;
|
|
7736
|
-
}
|
|
7737
|
-
function limits(data, mode = "equal", num2 = 7) {
|
|
7738
|
-
if (type_default(data) == "array") {
|
|
7739
|
-
data = analyze(data);
|
|
7740
|
-
}
|
|
7741
|
-
const { min: min5, max: max5 } = data;
|
|
7742
|
-
const values = data.values.sort((a, b) => a - b);
|
|
7743
|
-
if (num2 === 1) {
|
|
7744
|
-
return [min5, max5];
|
|
7745
|
-
}
|
|
7746
|
-
const limits2 = [];
|
|
7747
|
-
if (mode.substr(0, 1) === "c") {
|
|
7748
|
-
limits2.push(min5);
|
|
7749
|
-
limits2.push(max5);
|
|
7750
|
-
}
|
|
7751
|
-
if (mode.substr(0, 1) === "e") {
|
|
7752
|
-
limits2.push(min5);
|
|
7753
|
-
for (let i = 1; i < num2; i++) {
|
|
7754
|
-
limits2.push(min5 + i / num2 * (max5 - min5));
|
|
7755
|
-
}
|
|
7756
|
-
limits2.push(max5);
|
|
7757
|
-
} else if (mode.substr(0, 1) === "l") {
|
|
7758
|
-
if (min5 <= 0) {
|
|
7759
|
-
throw new Error(
|
|
7760
|
-
"Logarithmic scales are only possible for values > 0"
|
|
7761
|
-
);
|
|
7762
|
-
}
|
|
7763
|
-
const min_log = Math.LOG10E * log2(min5);
|
|
7764
|
-
const max_log = Math.LOG10E * log2(max5);
|
|
7765
|
-
limits2.push(min5);
|
|
7766
|
-
for (let i = 1; i < num2; i++) {
|
|
7767
|
-
limits2.push(pow10(10, min_log + i / num2 * (max_log - min_log)));
|
|
7768
|
-
}
|
|
7769
|
-
limits2.push(max5);
|
|
7770
|
-
} else if (mode.substr(0, 1) === "q") {
|
|
7771
|
-
limits2.push(min5);
|
|
7772
|
-
for (let i = 1; i < num2; i++) {
|
|
7773
|
-
const p = (values.length - 1) * i / num2;
|
|
7774
|
-
const pb = floor4(p);
|
|
7775
|
-
if (pb === p) {
|
|
7776
|
-
limits2.push(values[pb]);
|
|
7777
|
-
} else {
|
|
7778
|
-
const pr = p - pb;
|
|
7779
|
-
limits2.push(values[pb] * (1 - pr) + values[pb + 1] * pr);
|
|
7780
|
-
}
|
|
7781
|
-
}
|
|
7782
|
-
limits2.push(max5);
|
|
7783
|
-
} else if (mode.substr(0, 1) === "k") {
|
|
7784
|
-
let cluster;
|
|
7785
|
-
const n = values.length;
|
|
7786
|
-
const assignments = new Array(n);
|
|
7787
|
-
const clusterSizes = new Array(num2);
|
|
7788
|
-
let repeat = true;
|
|
7789
|
-
let nb_iters = 0;
|
|
7790
|
-
let centroids = null;
|
|
7791
|
-
centroids = [];
|
|
7792
|
-
centroids.push(min5);
|
|
7793
|
-
for (let i = 1; i < num2; i++) {
|
|
7794
|
-
centroids.push(min5 + i / num2 * (max5 - min5));
|
|
7795
|
-
}
|
|
7796
|
-
centroids.push(max5);
|
|
7797
|
-
while (repeat) {
|
|
7798
|
-
for (let j = 0; j < num2; j++) {
|
|
7799
|
-
clusterSizes[j] = 0;
|
|
7800
|
-
}
|
|
7801
|
-
for (let i = 0; i < n; i++) {
|
|
7802
|
-
const value = values[i];
|
|
7803
|
-
let mindist = Number.MAX_VALUE;
|
|
7804
|
-
let best;
|
|
7805
|
-
for (let j = 0; j < num2; j++) {
|
|
7806
|
-
const dist = abs(centroids[j] - value);
|
|
7807
|
-
if (dist < mindist) {
|
|
7808
|
-
mindist = dist;
|
|
7809
|
-
best = j;
|
|
7810
|
-
}
|
|
7811
|
-
clusterSizes[best]++;
|
|
7812
|
-
assignments[i] = best;
|
|
7813
|
-
}
|
|
7814
|
-
}
|
|
7815
|
-
const newCentroids = new Array(num2);
|
|
7816
|
-
for (let j = 0; j < num2; j++) {
|
|
7817
|
-
newCentroids[j] = null;
|
|
7818
|
-
}
|
|
7819
|
-
for (let i = 0; i < n; i++) {
|
|
7820
|
-
cluster = assignments[i];
|
|
7821
|
-
if (newCentroids[cluster] === null) {
|
|
7822
|
-
newCentroids[cluster] = values[i];
|
|
7823
|
-
} else {
|
|
7824
|
-
newCentroids[cluster] += values[i];
|
|
7825
|
-
}
|
|
7826
|
-
}
|
|
7827
|
-
for (let j = 0; j < num2; j++) {
|
|
7828
|
-
newCentroids[j] *= 1 / clusterSizes[j];
|
|
7829
|
-
}
|
|
7830
|
-
repeat = false;
|
|
7831
|
-
for (let j = 0; j < num2; j++) {
|
|
7832
|
-
if (newCentroids[j] !== centroids[j]) {
|
|
7833
|
-
repeat = true;
|
|
7834
|
-
break;
|
|
7835
|
-
}
|
|
7836
|
-
}
|
|
7837
|
-
centroids = newCentroids;
|
|
7838
|
-
nb_iters++;
|
|
7839
|
-
if (nb_iters > 200) {
|
|
7840
|
-
repeat = false;
|
|
7841
|
-
}
|
|
7842
|
-
}
|
|
7843
|
-
const kClusters = {};
|
|
7844
|
-
for (let j = 0; j < num2; j++) {
|
|
7845
|
-
kClusters[j] = [];
|
|
7846
|
-
}
|
|
7847
|
-
for (let i = 0; i < n; i++) {
|
|
7848
|
-
cluster = assignments[i];
|
|
7849
|
-
kClusters[cluster].push(values[i]);
|
|
7850
|
-
}
|
|
7851
|
-
let tmpKMeansBreaks = [];
|
|
7852
|
-
for (let j = 0; j < num2; j++) {
|
|
7853
|
-
tmpKMeansBreaks.push(kClusters[j][0]);
|
|
7854
|
-
tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);
|
|
7855
|
-
}
|
|
7856
|
-
tmpKMeansBreaks = tmpKMeansBreaks.sort((a, b) => a - b);
|
|
7857
|
-
limits2.push(tmpKMeansBreaks[0]);
|
|
7858
|
-
for (let i = 1; i < tmpKMeansBreaks.length; i += 2) {
|
|
7859
|
-
const v = tmpKMeansBreaks[i];
|
|
7860
|
-
if (!isNaN(v) && limits2.indexOf(v) === -1) {
|
|
7861
|
-
limits2.push(v);
|
|
7862
|
-
}
|
|
7863
|
-
}
|
|
7864
|
-
}
|
|
7865
|
-
return limits2;
|
|
7866
|
-
}
|
|
7867
|
-
|
|
7868
|
-
// node_modules/chroma-js/src/utils/contrast.js
|
|
7869
|
-
var contrast_default = (a, b) => {
|
|
7870
|
-
a = new Color_default(a);
|
|
7871
|
-
b = new Color_default(b);
|
|
7872
|
-
const l1 = a.luminance();
|
|
7873
|
-
const l2 = b.luminance();
|
|
7874
|
-
return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
|
|
7875
|
-
};
|
|
7876
|
-
|
|
7877
|
-
// node_modules/chroma-js/src/utils/delta-e.js
|
|
7878
|
-
var { sqrt: sqrt5, pow: pow11, min: min4, max: max4, atan2: atan23, abs: abs2, cos: cos5, sin: sin4, exp, PI: PI3 } = Math;
|
|
7879
|
-
function delta_e_default(a, b, Kl = 1, Kc = 1, Kh = 1) {
|
|
7880
|
-
var rad2deg = function(rad) {
|
|
7881
|
-
return 360 * rad / (2 * PI3);
|
|
7882
|
-
};
|
|
7883
|
-
var deg2rad = function(deg) {
|
|
7884
|
-
return 2 * PI3 * deg / 360;
|
|
7885
|
-
};
|
|
7886
|
-
a = new Color_default(a);
|
|
7887
|
-
b = new Color_default(b);
|
|
7888
|
-
const [L1, a1, b1] = Array.from(a.lab());
|
|
7889
|
-
const [L2, a2, b2] = Array.from(b.lab());
|
|
7890
|
-
const avgL = (L1 + L2) / 2;
|
|
7891
|
-
const C1 = sqrt5(pow11(a1, 2) + pow11(b1, 2));
|
|
7892
|
-
const C2 = sqrt5(pow11(a2, 2) + pow11(b2, 2));
|
|
7893
|
-
const avgC = (C1 + C2) / 2;
|
|
7894
|
-
const G = 0.5 * (1 - sqrt5(pow11(avgC, 7) / (pow11(avgC, 7) + pow11(25, 7))));
|
|
7895
|
-
const a1p = a1 * (1 + G);
|
|
7896
|
-
const a2p = a2 * (1 + G);
|
|
7897
|
-
const C1p = sqrt5(pow11(a1p, 2) + pow11(b1, 2));
|
|
7898
|
-
const C2p = sqrt5(pow11(a2p, 2) + pow11(b2, 2));
|
|
7899
|
-
const avgCp = (C1p + C2p) / 2;
|
|
7900
|
-
const arctan1 = rad2deg(atan23(b1, a1p));
|
|
7901
|
-
const arctan2 = rad2deg(atan23(b2, a2p));
|
|
7902
|
-
const h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360;
|
|
7903
|
-
const h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360;
|
|
7904
|
-
const avgHp = abs2(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h2p) / 2;
|
|
7905
|
-
const T = 1 - 0.17 * cos5(deg2rad(avgHp - 30)) + 0.24 * cos5(deg2rad(2 * avgHp)) + 0.32 * cos5(deg2rad(3 * avgHp + 6)) - 0.2 * cos5(deg2rad(4 * avgHp - 63));
|
|
7906
|
-
let deltaHp = h2p - h1p;
|
|
7907
|
-
deltaHp = abs2(deltaHp) <= 180 ? deltaHp : h2p <= h1p ? deltaHp + 360 : deltaHp - 360;
|
|
7908
|
-
deltaHp = 2 * sqrt5(C1p * C2p) * sin4(deg2rad(deltaHp) / 2);
|
|
7909
|
-
const deltaL = L2 - L1;
|
|
7910
|
-
const deltaCp = C2p - C1p;
|
|
7911
|
-
const sl = 1 + 0.015 * pow11(avgL - 50, 2) / sqrt5(20 + pow11(avgL - 50, 2));
|
|
7912
|
-
const sc = 1 + 0.045 * avgCp;
|
|
7913
|
-
const sh = 1 + 0.015 * avgCp * T;
|
|
7914
|
-
const deltaTheta = 30 * exp(-pow11((avgHp - 275) / 25, 2));
|
|
7915
|
-
const Rc = 2 * sqrt5(pow11(avgCp, 7) / (pow11(avgCp, 7) + pow11(25, 7)));
|
|
7916
|
-
const Rt = -Rc * sin4(2 * deg2rad(deltaTheta));
|
|
7917
|
-
const result = sqrt5(
|
|
7918
|
-
pow11(deltaL / (Kl * sl), 2) + pow11(deltaCp / (Kc * sc), 2) + pow11(deltaHp / (Kh * sh), 2) + Rt * (deltaCp / (Kc * sc)) * (deltaHp / (Kh * sh))
|
|
7919
|
-
);
|
|
7920
|
-
return max4(0, min4(100, result));
|
|
7921
|
-
}
|
|
7922
|
-
|
|
7923
|
-
// node_modules/chroma-js/src/utils/distance.js
|
|
7924
|
-
function distance_default(a, b, mode = "lab") {
|
|
7925
|
-
a = new Color_default(a);
|
|
7926
|
-
b = new Color_default(b);
|
|
7927
|
-
const l1 = a.get(mode);
|
|
7928
|
-
const l2 = b.get(mode);
|
|
7929
|
-
let sum_sq = 0;
|
|
7930
|
-
for (let i in l1) {
|
|
7931
|
-
const d = (l1[i] || 0) - (l2[i] || 0);
|
|
7932
|
-
sum_sq += d * d;
|
|
7933
|
-
}
|
|
7934
|
-
return Math.sqrt(sum_sq);
|
|
7935
|
-
}
|
|
7936
|
-
|
|
7937
|
-
// node_modules/chroma-js/src/utils/valid.js
|
|
7938
|
-
var valid_default = (...args) => {
|
|
7939
|
-
try {
|
|
7940
|
-
new Color_default(...args);
|
|
7941
|
-
return true;
|
|
7942
|
-
} catch (e) {
|
|
7943
|
-
return false;
|
|
7944
|
-
}
|
|
7945
|
-
};
|
|
7946
|
-
|
|
7947
|
-
// node_modules/chroma-js/src/utils/scales.js
|
|
7948
|
-
var scales_default = {
|
|
7949
|
-
cool() {
|
|
7950
|
-
return scale_default([chroma_default.hsl(180, 1, 0.9), chroma_default.hsl(250, 0.7, 0.4)]);
|
|
7951
|
-
},
|
|
7952
|
-
hot() {
|
|
7953
|
-
return scale_default(["#000", "#f00", "#ff0", "#fff"]).mode(
|
|
7954
|
-
"rgb"
|
|
7955
|
-
);
|
|
7956
|
-
}
|
|
7957
|
-
};
|
|
7958
|
-
|
|
7959
|
-
// node_modules/chroma-js/src/colors/colorbrewer.js
|
|
7960
|
-
var colorbrewer = {
|
|
7961
|
-
// sequential
|
|
7962
|
-
OrRd: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#b30000", "#7f0000"],
|
|
7963
|
-
PuBu: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#045a8d", "#023858"],
|
|
7964
|
-
BuPu: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#810f7c", "#4d004b"],
|
|
7965
|
-
Oranges: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"],
|
|
7966
|
-
BuGn: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#006d2c", "#00441b"],
|
|
7967
|
-
YlOrBr: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#993404", "#662506"],
|
|
7968
|
-
YlGn: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#006837", "#004529"],
|
|
7969
|
-
Reds: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"],
|
|
7970
|
-
RdPu: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a"],
|
|
7971
|
-
Greens: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"],
|
|
7972
|
-
YlGnBu: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494", "#081d58"],
|
|
7973
|
-
Purples: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"],
|
|
7974
|
-
GnBu: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081"],
|
|
7975
|
-
Greys: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"],
|
|
7976
|
-
YlOrRd: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#bd0026", "#800026"],
|
|
7977
|
-
PuRd: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#980043", "#67001f"],
|
|
7978
|
-
Blues: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"],
|
|
7979
|
-
PuBuGn: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016c59", "#014636"],
|
|
7980
|
-
Viridis: ["#440154", "#482777", "#3f4a8a", "#31678e", "#26838f", "#1f9d8a", "#6cce5a", "#b6de2b", "#fee825"],
|
|
7981
|
-
// diverging
|
|
7982
|
-
Spectral: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"],
|
|
7983
|
-
RdYlGn: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"],
|
|
7984
|
-
RdBu: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"],
|
|
7985
|
-
PiYG: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"],
|
|
7986
|
-
PRGn: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"],
|
|
7987
|
-
RdYlBu: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"],
|
|
7988
|
-
BrBG: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"],
|
|
7989
|
-
RdGy: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"],
|
|
7990
|
-
PuOr: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"],
|
|
7991
|
-
// qualitative
|
|
7992
|
-
Set2: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"],
|
|
7993
|
-
Accent: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"],
|
|
7994
|
-
Set1: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"],
|
|
7995
|
-
Set3: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"],
|
|
7996
|
-
Dark2: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"],
|
|
7997
|
-
Paired: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"],
|
|
7998
|
-
Pastel2: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc", "#cccccc"],
|
|
7999
|
-
Pastel1: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec", "#f2f2f2"]
|
|
8000
|
-
};
|
|
8001
|
-
for (let key of Object.keys(colorbrewer)) {
|
|
8002
|
-
colorbrewer[key.toLowerCase()] = colorbrewer[key];
|
|
8003
|
-
}
|
|
8004
|
-
var colorbrewer_default = colorbrewer;
|
|
8005
|
-
|
|
8006
|
-
// node_modules/chroma-js/index.js
|
|
8007
|
-
Object.assign(chroma_default, {
|
|
8008
|
-
average: average_default,
|
|
8009
|
-
bezier: bezier_default,
|
|
8010
|
-
blend: blend_default,
|
|
8011
|
-
cubehelix: cubehelix_default,
|
|
8012
|
-
mix: mix_default,
|
|
8013
|
-
interpolate: mix_default,
|
|
8014
|
-
random: random_default,
|
|
8015
|
-
scale: scale_default,
|
|
8016
|
-
analyze,
|
|
8017
|
-
contrast: contrast_default,
|
|
8018
|
-
deltaE: delta_e_default,
|
|
8019
|
-
distance: distance_default,
|
|
8020
|
-
limits,
|
|
8021
|
-
valid: valid_default,
|
|
8022
|
-
scales: scales_default,
|
|
8023
|
-
input: input_default,
|
|
8024
|
-
colors: w3cx11_default,
|
|
8025
|
-
brewer: colorbrewer_default
|
|
8026
|
-
});
|
|
8027
|
-
var chroma_js_default = chroma_default;
|
|
8028
|
-
|
|
8029
5530
|
// src/palette/use-palette.ts
|
|
8030
5531
|
var import_lodash = __toESM(require_lodash());
|
|
8031
5532
|
var delta = { xs: 0.01, sm: 0.02, md: 0.03, lg: 0.08, xl: 0.14 };
|
|
8032
5533
|
var normalizeHue = (input, range) => (input % range + range) % range;
|
|
8033
5534
|
var markDarkColor = (color) => {
|
|
8034
|
-
const
|
|
8035
|
-
return
|
|
5535
|
+
const hsv = chroma2(color).hsv();
|
|
5536
|
+
return chroma2(hsv[0], hsv[1] * 0.92, Math.min(hsv[2] + 0.01, 1), "hsv").hex();
|
|
8036
5537
|
};
|
|
8037
5538
|
var calculateHue = (color, end, defaultValue) => {
|
|
8038
5539
|
const interval = end - defaultValue;
|
|
@@ -8052,47 +5553,47 @@ var calculateHue = (color, end, defaultValue) => {
|
|
|
8052
5553
|
}
|
|
8053
5554
|
return normalizeHue(color[0] + offset, 360);
|
|
8054
5555
|
};
|
|
8055
|
-
var calculateSaturation = (
|
|
8056
|
-
const interval = (range -
|
|
5556
|
+
var calculateSaturation = (hsv, range, max) => {
|
|
5557
|
+
const interval = (range - max) / 100;
|
|
8057
5558
|
let offset = 0;
|
|
8058
|
-
if (range <
|
|
8059
|
-
offset = interval *
|
|
5559
|
+
if (range < max) {
|
|
5560
|
+
offset = interval * hsv[1] / 5;
|
|
8060
5561
|
if (range < 100) {
|
|
8061
5562
|
offset -= delta.sm;
|
|
8062
5563
|
}
|
|
8063
|
-
} else if (range >
|
|
8064
|
-
if (
|
|
5564
|
+
} else if (range > max) {
|
|
5565
|
+
if (hsv[0] < 30 || hsv[0] > 200) {
|
|
8065
5566
|
offset = interval * delta.md;
|
|
8066
5567
|
} else {
|
|
8067
5568
|
offset = interval * delta.xs;
|
|
8068
5569
|
}
|
|
8069
|
-
if (
|
|
5570
|
+
if (hsv[1] === 0) {
|
|
8070
5571
|
offset = 0;
|
|
8071
5572
|
}
|
|
8072
5573
|
}
|
|
8073
|
-
const newSaturation =
|
|
5574
|
+
const newSaturation = hsv[1] + offset;
|
|
8074
5575
|
return newSaturation > 1 ? 1 : newSaturation < 0 ? 0 : newSaturation;
|
|
8075
5576
|
};
|
|
8076
|
-
var calculateLightness = (
|
|
8077
|
-
const interval = (range -
|
|
5577
|
+
var calculateLightness = (hsv, range, max) => {
|
|
5578
|
+
const interval = (range - max) / 100;
|
|
8078
5579
|
let offset = 0;
|
|
8079
|
-
if (range <
|
|
8080
|
-
if (
|
|
8081
|
-
offset = interval * (1 -
|
|
5580
|
+
if (range < max) {
|
|
5581
|
+
if (hsv[1] < 0.1) {
|
|
5582
|
+
offset = interval * (1 - hsv[2]) / 5 * 1.06;
|
|
8082
5583
|
} else {
|
|
8083
|
-
offset = interval * (1 -
|
|
5584
|
+
offset = interval * (1 - hsv[2]) / 5;
|
|
8084
5585
|
}
|
|
8085
|
-
} else if (range >
|
|
8086
|
-
if ((
|
|
5586
|
+
} else if (range > max) {
|
|
5587
|
+
if ((hsv[0] < 30 || hsv[0] > 200) && hsv[0] > 0) {
|
|
8087
5588
|
offset = interval * delta.lg;
|
|
8088
|
-
if (
|
|
5589
|
+
if (hsv[2] > 0.8) {
|
|
8089
5590
|
offset = interval * delta.xl;
|
|
8090
5591
|
}
|
|
8091
5592
|
} else {
|
|
8092
|
-
offset = interval *
|
|
5593
|
+
offset = interval * hsv[2] / 6;
|
|
8093
5594
|
}
|
|
8094
5595
|
}
|
|
8095
|
-
const newLightness =
|
|
5596
|
+
const newLightness = hsv[2] - offset;
|
|
8096
5597
|
return newLightness > 1 ? 1 : newLightness < 0 ? 0 : newLightness;
|
|
8097
5598
|
};
|
|
8098
5599
|
|
|
@@ -8101,18 +5602,18 @@ var COLOR_STOPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
|
8101
5602
|
var createSolidColorScale = (color, mode = "light") => {
|
|
8102
5603
|
const isDark = mode === "dark";
|
|
8103
5604
|
let baseColor = isDark ? markDarkColor(color) : color;
|
|
8104
|
-
const luminance =
|
|
5605
|
+
const luminance = chroma2(baseColor).luminance();
|
|
8105
5606
|
if (luminance < 0.1) {
|
|
8106
|
-
baseColor =
|
|
5607
|
+
baseColor = chroma2(baseColor).set("hsl.l", 0.4).hex();
|
|
8107
5608
|
} else if (luminance > 0.9) {
|
|
8108
|
-
baseColor =
|
|
5609
|
+
baseColor = chroma2(baseColor).set("hsl.l", 0.6).hex();
|
|
8109
5610
|
}
|
|
8110
|
-
const
|
|
5611
|
+
const hsv = chroma2(baseColor).hsv();
|
|
8111
5612
|
const colors = COLOR_STOPS.map((stop) => {
|
|
8112
|
-
const h = calculateHue(
|
|
8113
|
-
const s = calculateSaturation(
|
|
8114
|
-
const v = calculateLightness(
|
|
8115
|
-
return
|
|
5613
|
+
const h = calculateHue(hsv, stop, 500);
|
|
5614
|
+
const s = calculateSaturation(hsv, stop, 500);
|
|
5615
|
+
const v = calculateLightness(hsv, stop, 500);
|
|
5616
|
+
return chroma2(h, s, v, "hsv");
|
|
8116
5617
|
});
|
|
8117
5618
|
return isDark ? colors.reverse() : colors;
|
|
8118
5619
|
};
|
|
@@ -8190,13 +5691,8 @@ var setNeocardTheme = (0, import_lodash2.debounce)((colors) => {
|
|
|
8190
5691
|
themeDOM.innerHTML = styles;
|
|
8191
5692
|
}
|
|
8192
5693
|
}, 64);
|
|
8193
|
-
|
|
8194
|
-
// src/components/base/utils.ts
|
|
8195
5694
|
function cn(...parts) {
|
|
8196
|
-
return parts.filter(Boolean).join(" ");
|
|
8197
|
-
}
|
|
8198
|
-
function hasRenderableNode(node) {
|
|
8199
|
-
return node !== void 0 && node !== null && typeof node !== "boolean";
|
|
5695
|
+
return twMerge(parts.filter(Boolean).join(" "));
|
|
8200
5696
|
}
|
|
8201
5697
|
|
|
8202
5698
|
// src/components/base/theme.ts
|
|
@@ -8230,9 +5726,9 @@ var baseSlots = {
|
|
|
8230
5726
|
),
|
|
8231
5727
|
buttonDefault: "border-border bg-background text-foreground hover:bg-accent/60",
|
|
8232
5728
|
buttonPrimary: "border-primary/20 bg-primary/10 text-primary hover:bg-primary/15",
|
|
8233
|
-
buttonSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 hover:bg-emerald-500/15",
|
|
5729
|
+
buttonSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400 hover:bg-emerald-500/15",
|
|
8234
5730
|
buttonWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700 hover:bg-amber-500/15",
|
|
8235
|
-
buttonDanger: "border-destructive/20 bg-destructive/10 text-destructive hover:bg-destructive/15",
|
|
5731
|
+
buttonDanger: "border-destructive/20 bg-destructive/10 text-destructive-text hover:bg-destructive/15",
|
|
8236
5732
|
buttonMuted: "border-border/60 bg-muted/45 text-muted-foreground hover:bg-muted/70 hover:text-foreground",
|
|
8237
5733
|
buttonActive: "border-primary/35 bg-primary/10 text-primary",
|
|
8238
5734
|
buttonDisabled: "!cursor-not-allowed opacity-60",
|
|
@@ -8247,10 +5743,101 @@ var baseSlots = {
|
|
|
8247
5743
|
badgePrimary: "border-primary/30 bg-primary/10 text-primary",
|
|
8248
5744
|
badgeSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700",
|
|
8249
5745
|
badgeWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700",
|
|
8250
|
-
badgeDanger: "border-destructive/30 bg-destructive/10 text-destructive",
|
|
5746
|
+
badgeDanger: "border-destructive/30 bg-destructive/10 text-destructive-text",
|
|
8251
5747
|
badgeMuted: "border-border/60 bg-muted text-muted-foreground",
|
|
8252
5748
|
badgeIcon: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",
|
|
8253
5749
|
badgeLabel: "min-w-0 truncate",
|
|
5750
|
+
textRoot: "min-w-0 break-words leading-6",
|
|
5751
|
+
textSizeXs: "text-xs",
|
|
5752
|
+
textSizeSm: "text-sm",
|
|
5753
|
+
textSizeMd: "text-base",
|
|
5754
|
+
textSizeLg: "text-lg",
|
|
5755
|
+
textSizeXl: "text-xl",
|
|
5756
|
+
typographyToneDefault: "text-foreground",
|
|
5757
|
+
typographyToneMuted: "text-muted-foreground",
|
|
5758
|
+
typographyTonePrimary: "text-primary",
|
|
5759
|
+
typographyToneSuccess: "text-emerald-700 dark:text-emerald-400",
|
|
5760
|
+
typographyToneWarning: "text-amber-700 dark:text-amber-400",
|
|
5761
|
+
typographyToneDanger: "text-destructive-text",
|
|
5762
|
+
typographyToneInherit: "text-inherit",
|
|
5763
|
+
headingRoot: "min-w-0 break-words font-semibold tracking-tight",
|
|
5764
|
+
headingSizeXs: "text-sm leading-5",
|
|
5765
|
+
headingSizeSm: "text-base leading-6",
|
|
5766
|
+
headingSizeMd: "text-lg leading-7",
|
|
5767
|
+
headingSizeLg: "text-xl leading-7",
|
|
5768
|
+
headingSizeXl: "text-2xl leading-8",
|
|
5769
|
+
headingSize2xl: "text-3xl leading-9",
|
|
5770
|
+
linkRoot: "inline break-words underline decoration-current/40 underline-offset-4 hover:decoration-current focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
5771
|
+
codeInline: "rounded border border-border/70 bg-muted/60 px-1.5 py-0.5 font-mono text-[0.875em] leading-[1.45] text-foreground",
|
|
5772
|
+
codeBlock: "m-0 max-w-full overflow-x-auto rounded-md border border-border/70 bg-muted/60 p-4 text-foreground",
|
|
5773
|
+
codeContent: "font-mono text-sm leading-6",
|
|
5774
|
+
kbdRoot: "inline-flex min-h-5 items-center rounded border border-border bg-muted/70 px-1.5 font-mono text-[0.75em] font-medium leading-5 text-foreground shadow-[inset_0_-1px_0_hsl(var(--monkeys-color-border))]",
|
|
5775
|
+
listRoot: "m-0 min-w-0 list-outside break-words ps-5 text-foreground",
|
|
5776
|
+
listSpacingCompact: "[&>li+li]:mt-1",
|
|
5777
|
+
listSpacingDefault: "[&>li+li]:mt-2",
|
|
5778
|
+
listSpacingRelaxed: "[&>li+li]:mt-3",
|
|
5779
|
+
listMarkerNone: "list-none ps-0",
|
|
5780
|
+
listMarkerDisc: "list-disc",
|
|
5781
|
+
listMarkerCircle: "list-[circle]",
|
|
5782
|
+
listMarkerSquare: "list-[square]",
|
|
5783
|
+
listMarkerDecimal: "list-decimal",
|
|
5784
|
+
listMarkerLowerAlpha: "list-[lower-alpha]",
|
|
5785
|
+
listMarkerUpperAlpha: "list-[upper-alpha]",
|
|
5786
|
+
listItem: "min-w-0 ps-1 leading-6 marker:text-muted-foreground",
|
|
5787
|
+
stackRoot: "flex min-w-0 flex-col",
|
|
5788
|
+
inlineRoot: "flex min-w-0 flex-row",
|
|
5789
|
+
gridRoot: "grid min-w-0",
|
|
5790
|
+
containerRoot: "mx-auto w-full min-w-0",
|
|
5791
|
+
aspectRatioRoot: "relative min-w-0 overflow-hidden [&>*]:h-full [&>*]:w-full",
|
|
5792
|
+
spinnerRoot: "inline-flex shrink-0 items-center justify-center text-current align-middle",
|
|
5793
|
+
spinnerIndicator: "h-5 w-5 rounded-full border-2 border-current border-r-transparent motion-safe:animate-spin motion-reduce:animate-none",
|
|
5794
|
+
visuallyHiddenRoot: "sr-only",
|
|
5795
|
+
visuallyHiddenFocusable: "focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[1000] focus:rounded-md focus:bg-background focus:px-4 focus:py-2 focus:text-foreground focus:shadow-lg focus:outline-none focus:ring-2 focus:ring-ring focus-within:not-sr-only focus-within:fixed focus-within:left-4 focus-within:top-4 focus-within:z-[1000] focus-within:rounded-md focus-within:bg-background focus-within:px-4 focus-within:py-2 focus-within:text-foreground focus-within:shadow-lg focus-within:ring-2 focus-within:ring-ring",
|
|
5796
|
+
fieldsetRoot: "min-w-0 border-0 p-0 text-foreground",
|
|
5797
|
+
fieldsetLegend: "min-w-0 text-sm font-semibold leading-6 text-foreground",
|
|
5798
|
+
fieldsetDescription: "mt-1 text-sm leading-5 text-muted-foreground",
|
|
5799
|
+
fieldsetError: "mt-1 text-sm leading-5 text-destructive-text",
|
|
5800
|
+
fieldsetContent: "mt-3 grid min-w-0 gap-3",
|
|
5801
|
+
stepsRoot: "m-0 min-w-0 list-none p-0 text-foreground",
|
|
5802
|
+
stepsHorizontal: "flex w-full max-w-full items-start overflow-x-auto pb-2",
|
|
5803
|
+
stepsVertical: "grid",
|
|
5804
|
+
stepsItem: "relative min-w-0",
|
|
5805
|
+
stepsItemHorizontal: "flex min-w-52 flex-1 items-start",
|
|
5806
|
+
stepsItemVertical: "pb-6 last:pb-0",
|
|
5807
|
+
stepsTrigger: "flex min-w-0 flex-1 items-start gap-3 rounded-md border-0 bg-transparent p-1 text-start text-inherit",
|
|
5808
|
+
stepsTriggerInteractive: "cursor-pointer hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
|
|
5809
|
+
stepsTriggerDisabled: "!cursor-not-allowed opacity-60",
|
|
5810
|
+
stepsIndicator: "relative z-[1] inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold",
|
|
5811
|
+
stepsIndicatorPending: "border-border bg-background text-muted-foreground",
|
|
5812
|
+
stepsIndicatorCurrent: "border-primary/50 bg-primary/10 text-primary",
|
|
5813
|
+
stepsIndicatorCompleted: "border-primary bg-primary text-primary-foreground",
|
|
5814
|
+
stepsIndicatorError: "border-destructive bg-destructive text-destructive-foreground",
|
|
5815
|
+
stepsContent: "grid min-w-0 gap-1 pt-0.5",
|
|
5816
|
+
stepsLabel: "min-w-0 break-words text-sm font-medium leading-5",
|
|
5817
|
+
stepsDescription: "min-w-0 break-words text-sm leading-5 text-muted-foreground",
|
|
5818
|
+
stepsStatus: "sr-only",
|
|
5819
|
+
stepsConnector: "shrink-0 bg-border",
|
|
5820
|
+
stepsConnectorHorizontal: "mt-3.5 h-px w-8",
|
|
5821
|
+
stepsConnectorVertical: "absolute bottom-0 top-8 start-3.5 w-px -translate-x-1/2",
|
|
5822
|
+
stepsConnectorCompleted: "bg-primary/60",
|
|
5823
|
+
stepsConnectorError: "bg-destructive/60",
|
|
5824
|
+
scrollAreaViewport: "min-h-0 min-w-0",
|
|
5825
|
+
numberInputControl: "tabular-nums",
|
|
5826
|
+
numberInputStepControls: "me-1 flex shrink-0 self-stretch overflow-hidden border-s border-border",
|
|
5827
|
+
numberInputStepButton: "flex min-h-6 w-7 cursor-pointer items-center justify-center border-0 bg-transparent px-1 text-xs leading-none text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:z-[1] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:!cursor-not-allowed disabled:opacity-40",
|
|
5828
|
+
passwordInputControl: "pe-2",
|
|
5829
|
+
passwordInputToggle: "me-1 inline-flex min-h-7 shrink-0 cursor-pointer items-center justify-center rounded px-2 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:!cursor-not-allowed disabled:opacity-40",
|
|
5830
|
+
inputGroupRoot: cn(
|
|
5831
|
+
"relative flex min-w-0 items-stretch overflow-hidden rounded-md border border-border bg-background text-foreground focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-ring/30",
|
|
5832
|
+
motionBase
|
|
5833
|
+
),
|
|
5834
|
+
inputGroupInvalid: "border-destructive/55 focus-within:border-destructive/70 focus-within:ring-destructive/25",
|
|
5835
|
+
inputGroupDisabled: "!cursor-not-allowed bg-muted/35",
|
|
5836
|
+
inputGroupContent: "flex min-w-0 flex-1 items-stretch [&>*]:min-w-0",
|
|
5837
|
+
inputGroupStartElement: "inline-flex shrink-0 items-center justify-center ps-3 pe-1 text-foreground/75",
|
|
5838
|
+
inputGroupEndElement: "inline-flex shrink-0 items-center justify-center ps-1 pe-3 text-foreground/75",
|
|
5839
|
+
inputGroupStartAddon: "inline-flex max-w-[min(40%,16rem)] shrink-0 items-center overflow-hidden border-e border-border bg-muted/60 px-3 text-sm text-foreground/75 text-ellipsis whitespace-nowrap [&>*]:min-w-0",
|
|
5840
|
+
inputGroupEndAddon: "inline-flex max-w-[min(40%,16rem)] shrink-0 items-center overflow-hidden border-s border-border bg-muted/60 px-3 text-sm text-foreground/75 text-ellipsis whitespace-nowrap [&>*]:min-w-0",
|
|
8254
5841
|
panelRoot: cn(
|
|
8255
5842
|
"group relative flex min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background",
|
|
8256
5843
|
motionInteractive
|
|
@@ -8273,11 +5860,11 @@ var baseSlots = {
|
|
|
8273
5860
|
stateTitle: "text-sm font-semibold text-foreground",
|
|
8274
5861
|
stateDescription: "mt-2 max-w-md text-sm leading-6 text-muted-foreground",
|
|
8275
5862
|
stateActions: "mt-5 flex flex-wrap items-center justify-center gap-2",
|
|
8276
|
-
loadingSpinner: "h-5 w-5 animate-spin",
|
|
5863
|
+
loadingSpinner: "h-5 w-5 motion-safe:animate-spin motion-reduce:animate-none",
|
|
8277
5864
|
fieldRoot: "grid min-w-0 gap-2",
|
|
8278
5865
|
fieldLabelRow: "flex min-w-0 items-center justify-between gap-3",
|
|
8279
5866
|
fieldLabel: "min-w-0 text-sm font-medium leading-none text-foreground",
|
|
8280
|
-
fieldRequired: "text-destructive",
|
|
5867
|
+
fieldRequired: "text-destructive-text",
|
|
8281
5868
|
fieldDescription: "text-sm leading-5 text-muted-foreground",
|
|
8282
5869
|
fieldMessage: "text-sm leading-5 text-muted-foreground",
|
|
8283
5870
|
fieldControl: "min-w-0",
|
|
@@ -8357,9 +5944,9 @@ var baseSlots = {
|
|
|
8357
5944
|
dialogTrigger: "",
|
|
8358
5945
|
dialogTriggerDisabled: "!cursor-not-allowed opacity-60",
|
|
8359
5946
|
dialogOverlay: "fixed inset-0 z-50 bg-background/70 backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
|
|
8360
|
-
dialogContent: "fixed inset-0 z-50 flex min-h-0 items-center justify-center p-4",
|
|
5947
|
+
dialogContent: "pointer-events-none fixed inset-0 z-50 flex min-h-0 items-center justify-center p-4",
|
|
8361
5948
|
dialogPanel: cn(
|
|
8362
|
-
"relative flex max-h-[min(85vh,720px)] w-full max-w-lg min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background text-foreground shadow-xl",
|
|
5949
|
+
"pointer-events-auto relative flex max-h-[min(85vh,720px)] w-full max-w-lg min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background text-foreground shadow-xl",
|
|
8363
5950
|
"motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95 motion-safe:duration-300 motion-safe:ease-out"
|
|
8364
5951
|
),
|
|
8365
5952
|
dialogHeader: "grid min-w-0 gap-1 border-b border-border/60 px-5 py-4",
|
|
@@ -8374,17 +5961,17 @@ var baseSlots = {
|
|
|
8374
5961
|
dropdownRoot: "relative inline-flex min-w-0",
|
|
8375
5962
|
dropdownTrigger: "",
|
|
8376
5963
|
dropdownTriggerDisabled: "!cursor-not-allowed opacity-60",
|
|
8377
|
-
dropdownMenu: "
|
|
5964
|
+
dropdownMenu: "z-50 min-w-48 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
|
|
8378
5965
|
dropdownMenuTop: "bottom-[calc(100%+0.375rem)] top-auto",
|
|
8379
5966
|
dropdownMenuEnd: "left-auto right-0",
|
|
8380
5967
|
dropdownLabel: "px-2.5 py-1.5 text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",
|
|
8381
5968
|
dropdownSeparator: "my-1 h-px bg-border/70",
|
|
8382
5969
|
dropdownItem: cn(
|
|
8383
|
-
"flex min-w-0 cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2 text-left text-sm text-foreground hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
5970
|
+
"flex min-w-0 cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2 text-left text-sm text-foreground hover:bg-accent/60 focus:bg-accent/60 data-[highlighted]:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
8384
5971
|
motionInteractive
|
|
8385
5972
|
),
|
|
8386
|
-
dropdownItemDanger: "text-destructive hover:bg-destructive/10",
|
|
8387
|
-
dropdownItemDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent",
|
|
5973
|
+
dropdownItemDanger: "text-destructive-text hover:bg-destructive/10 focus:bg-destructive/10 data-[highlighted]:bg-destructive/10",
|
|
5974
|
+
dropdownItemDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent focus:bg-transparent data-[highlighted]:bg-transparent",
|
|
8388
5975
|
dropdownItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
|
|
8389
5976
|
dropdownItemContent: "grid min-w-0 flex-1 gap-0.5",
|
|
8390
5977
|
dropdownItemLabel: "min-w-0 truncate",
|
|
@@ -8392,7 +5979,7 @@ var baseSlots = {
|
|
|
8392
5979
|
dropdownItemShortcut: "ml-3 shrink-0 text-xs font-medium text-muted-foreground",
|
|
8393
5980
|
tooltipRoot: "relative inline-flex min-w-0",
|
|
8394
5981
|
tooltipTrigger: "inline-flex min-w-0",
|
|
8395
|
-
tooltipContent: "pointer-events-none
|
|
5982
|
+
tooltipContent: "pointer-events-none z-50 max-w-xs rounded-md border border-border bg-popover px-2.5 py-1.5 text-xs leading-5 text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
|
|
8396
5983
|
noticeBase: cn(
|
|
8397
5984
|
"flex min-w-0 gap-3 rounded-lg border px-4 py-3 text-sm",
|
|
8398
5985
|
motionBase,
|
|
@@ -8402,7 +5989,7 @@ var baseSlots = {
|
|
|
8402
5989
|
noticePrimary: "border-primary/25 bg-primary/10 text-primary",
|
|
8403
5990
|
noticeSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700",
|
|
8404
5991
|
noticeWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700",
|
|
8405
|
-
noticeDanger: "border-destructive/30 bg-destructive/10 text-destructive",
|
|
5992
|
+
noticeDanger: "border-destructive/30 bg-destructive/10 text-destructive-text",
|
|
8406
5993
|
noticeMuted: "border-border/60 bg-muted/35 text-muted-foreground",
|
|
8407
5994
|
noticeIcon: "mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center motion-safe:animate-in motion-safe:fade-in",
|
|
8408
5995
|
noticeTitle: "font-semibold leading-5",
|
|
@@ -8422,12 +6009,12 @@ var baseSlots = {
|
|
|
8422
6009
|
motionBase
|
|
8423
6010
|
),
|
|
8424
6011
|
tabsTrigger: cn(
|
|
8425
|
-
"inline-flex min-w-0 cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground hover:bg-background/70 hover:text-foreground focus-visible:outline-none",
|
|
6012
|
+
"inline-flex min-w-0 cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground hover:bg-background/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:ring-offset-1 motion-reduce:transition-none",
|
|
8426
6013
|
motionInteractive
|
|
8427
6014
|
),
|
|
8428
6015
|
tabsTriggerActive: "bg-background text-foreground shadow-sm",
|
|
8429
6016
|
tabsTriggerDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent",
|
|
8430
|
-
tabsPanel: "min-w-0 rounded-lg border border-border/70 bg-background p-4 text-sm text-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
|
|
6017
|
+
tabsPanel: "min-w-0 rounded-lg border border-border/70 bg-background p-4 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out motion-reduce:transition-none",
|
|
8431
6018
|
segmentedRoot: cn(
|
|
8432
6019
|
"inline-flex min-w-0 items-center gap-1 rounded-lg border border-border/70 bg-muted/30 p-1",
|
|
8433
6020
|
motionBase
|
|
@@ -8447,7 +6034,7 @@ var baseSlots = {
|
|
|
8447
6034
|
skeletonRoot: "relative overflow-hidden rounded-md bg-muted/70",
|
|
8448
6035
|
avatarRoot: "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-muted text-sm font-semibold text-muted-foreground motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
|
|
8449
6036
|
avatarImage: "h-full w-full object-cover",
|
|
8450
|
-
avatarFallback: "flex h-full w-full items-center justify-center bg-muted text-
|
|
6037
|
+
avatarFallback: "flex h-full w-full items-center justify-center bg-muted text-foreground",
|
|
8451
6038
|
avatarStatus: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-muted-foreground motion-safe:animate-pulse",
|
|
8452
6039
|
avatarText: "min-w-0 truncate text-sm font-medium text-foreground",
|
|
8453
6040
|
toolbarRoot: cn(
|
|
@@ -8467,22 +6054,24 @@ var baseSlots = {
|
|
|
8467
6054
|
breadcrumbSeparator: "shrink-0 text-muted-foreground/70",
|
|
8468
6055
|
paginationRoot: "flex min-w-0 flex-wrap items-center justify-between gap-3 text-sm",
|
|
8469
6056
|
paginationInfo: "min-w-0 text-muted-foreground",
|
|
8470
|
-
paginationControls: "flex
|
|
8471
|
-
paginationButton: "inline-flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background px-2.5 text-sm font-medium text-foreground hover:bg-accent/60 disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
|
|
6057
|
+
paginationControls: "flex min-w-0 flex-wrap items-center justify-end gap-1.5",
|
|
6058
|
+
paginationButton: "inline-flex h-8 min-w-8 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-border bg-background px-2.5 text-sm font-medium text-foreground hover:bg-accent/60 disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
|
|
8472
6059
|
paginationButtonDisabled: "!cursor-not-allowed opacity-50",
|
|
8473
|
-
paginationPage: "inline-flex h-8 min-w-8 items-center justify-center rounded-md bg-muted/50 px-2.5 text-sm font-medium text-foreground",
|
|
6060
|
+
paginationPage: "inline-flex h-8 min-w-8 cursor-default items-center justify-center rounded-md bg-muted/50 px-2.5 text-sm font-medium text-foreground hover:bg-muted/50",
|
|
6061
|
+
paginationEllipsis: "inline-flex h-8 min-w-6 items-center justify-center px-1 text-sm text-muted-foreground",
|
|
8474
6062
|
descriptionListRoot: "grid min-w-0 gap-3 text-sm",
|
|
8475
6063
|
descriptionListItem: "grid min-w-0 gap-1 rounded-md border border-border/60 bg-background px-3 py-2 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out hover:shadow-sm",
|
|
8476
6064
|
descriptionListTerm: "min-w-0 truncate text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",
|
|
8477
6065
|
descriptionListValue: "min-w-0 text-sm leading-6 text-foreground",
|
|
8478
6066
|
accordionRoot: "grid min-w-0 gap-2",
|
|
8479
|
-
accordionItem: "overflow-hidden rounded-lg border border-border/70 bg-background motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
|
|
8480
|
-
accordionTrigger: "flex w-full min-w-0 cursor-pointer items-center justify-between gap-3 px-4 py-3 text-
|
|
6067
|
+
accordionItem: "overflow-hidden rounded-lg border border-border/70 bg-background motion-safe:transition motion-safe:duration-300 motion-safe:ease-out motion-reduce:transition-none",
|
|
6068
|
+
accordionTrigger: "flex w-full min-w-0 cursor-pointer items-center justify-between gap-3 px-4 py-3 text-start text-sm font-medium text-foreground hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out motion-reduce:transition-none",
|
|
8481
6069
|
accordionTriggerIcon: cn(
|
|
8482
6070
|
"h-2 w-2 shrink-0 rotate-45 border-b border-r border-current text-muted-foreground",
|
|
8483
|
-
motionTransform
|
|
6071
|
+
motionTransform,
|
|
6072
|
+
"motion-reduce:transition-none"
|
|
8484
6073
|
),
|
|
8485
|
-
accordionPanel: "border-t border-border/60 px-4 py-3 text-sm leading-6 text-muted-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
|
|
6074
|
+
accordionPanel: "border-t border-border/60 px-4 py-3 text-sm leading-6 text-muted-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out motion-reduce:animate-none",
|
|
8486
6075
|
menuTrigger: "inline-flex min-w-0",
|
|
8487
6076
|
menuContent: "z-50 min-w-44 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg outline-none motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95 motion-safe:duration-300 motion-safe:ease-out",
|
|
8488
6077
|
menuLabel: "px-2 py-1.5 text-xs font-medium text-muted-foreground",
|
|
@@ -8495,7 +6084,7 @@ var baseSlots = {
|
|
|
8495
6084
|
menuItemPrimary: "text-primary focus:text-primary data-[highlighted]:text-primary",
|
|
8496
6085
|
menuItemSuccess: "text-emerald-700 focus:text-emerald-700 data-[highlighted]:text-emerald-700",
|
|
8497
6086
|
menuItemWarning: "text-amber-700 focus:text-amber-700 data-[highlighted]:text-amber-700",
|
|
8498
|
-
menuItemDanger: "text-destructive focus:text-destructive data-[highlighted]:text-destructive",
|
|
6087
|
+
menuItemDanger: "text-destructive-text focus:text-destructive-text data-[highlighted]:text-destructive-text",
|
|
8499
6088
|
menuItemMuted: "text-muted-foreground focus:text-foreground data-[highlighted]:text-foreground",
|
|
8500
6089
|
menuItemDisabled: "!cursor-not-allowed opacity-50 data-[disabled]:pointer-events-none",
|
|
8501
6090
|
menuItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
|
|
@@ -8526,13 +6115,13 @@ var baseSlots = {
|
|
|
8526
6115
|
tableBody: "[&_tr:last-child>*]:border-b-0",
|
|
8527
6116
|
tableFooter: "bg-muted/30 font-medium [&_tr>*]:border-t [&_tr>*]:border-border/70",
|
|
8528
6117
|
tableFooterBar: cn(
|
|
8529
|
-
"flex min-w-0 flex-wrap items-center justify-between gap-3 rounded-lg border border-border/70 bg-muted/20 px-4 py-3 text-sm text-
|
|
6118
|
+
"flex min-w-0 flex-wrap items-center justify-between gap-3 rounded-lg border border-border/70 bg-muted/20 px-4 py-3 text-sm text-foreground shadow-none",
|
|
8530
6119
|
motionBase
|
|
8531
6120
|
),
|
|
8532
6121
|
tableFooterBarAttached: "-mt-px rounded-t-none border-t border-border/70 shadow-none",
|
|
8533
6122
|
tableFooterBarLeading: "flex min-w-0 items-center gap-2",
|
|
8534
6123
|
tableFooterBarContent: "min-w-0 flex-1",
|
|
8535
|
-
tableFooterBarActions: "
|
|
6124
|
+
tableFooterBarActions: "ms-auto flex shrink-0 flex-wrap items-center gap-2",
|
|
8536
6125
|
tableSplitRoot: "grid w-full min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)_auto] caption-bottom border-separate border-spacing-0 text-sm text-foreground",
|
|
8537
6126
|
tableSplitHeader: "block w-full min-w-0 shrink-0 overflow-x-hidden overflow-y-hidden bg-transparent",
|
|
8538
6127
|
tableSplitBody: cn(
|
|
@@ -8542,7 +6131,7 @@ var baseSlots = {
|
|
|
8542
6131
|
tableSplitFooter: "block w-full min-w-0 shrink-0 overflow-x-hidden overflow-y-hidden",
|
|
8543
6132
|
tableSplitRow: "grid w-max min-w-full [grid-template-columns:var(--base-table-column-template)]",
|
|
8544
6133
|
tableSplitHead: "flex min-w-0 overflow-hidden",
|
|
8545
|
-
tableSplitCell: "block min-w-0 overflow-hidden",
|
|
6134
|
+
tableSplitCell: "block min-w-0 overflow-hidden [overflow-wrap:anywhere]",
|
|
8546
6135
|
tableRow: cn(
|
|
8547
6136
|
"[&>*]:border-b [&>*]:border-border/60 data-[state=selected]:bg-primary/5 data-[state=selected]:[&>*]:bg-primary/5",
|
|
8548
6137
|
motionBase
|
|
@@ -8571,8 +6160,11 @@ var baseSlots = {
|
|
|
8571
6160
|
"inline-flex h-5 w-4 shrink-0 cursor-grab items-center justify-center rounded-sm text-muted-foreground hover:bg-muted active:cursor-grabbing focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-50",
|
|
8572
6161
|
motionBase
|
|
8573
6162
|
),
|
|
8574
|
-
tableHeadResizeHandle:
|
|
8575
|
-
|
|
6163
|
+
tableHeadResizeHandle: cn(
|
|
6164
|
+
"absolute end-0 top-1/2 h-7 w-2 -translate-y-1/2 cursor-col-resize touch-none rounded-sm after:absolute after:start-1/2 after:top-1/2 after:h-5 after:w-px after:-translate-x-1/2 after:-translate-y-1/2 after:bg-border hover:after:bg-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-50",
|
|
6165
|
+
motionBase
|
|
6166
|
+
),
|
|
6167
|
+
tableCell: "min-w-0 px-3 py-2 align-middle text-sm text-foreground [overflow-wrap:anywhere]",
|
|
8576
6168
|
tableCellAlignCenter: "text-center",
|
|
8577
6169
|
tableCellAlignRight: "text-right",
|
|
8578
6170
|
tableEmptyRow: "[&>*]:border-b [&>*]:border-border/60",
|
|
@@ -9526,1532 +7118,6 @@ function resolveBaseAppearance(appearance) {
|
|
|
9526
7118
|
)
|
|
9527
7119
|
};
|
|
9528
7120
|
}
|
|
9529
|
-
function getBaseButtonToneClassName(theme, tone = "default", active = false) {
|
|
9530
|
-
return cn(
|
|
9531
|
-
tone === "default" && theme.slots.buttonDefault,
|
|
9532
|
-
tone === "primary" && theme.slots.buttonPrimary,
|
|
9533
|
-
tone === "success" && theme.slots.buttonSuccess,
|
|
9534
|
-
tone === "warning" && theme.slots.buttonWarning,
|
|
9535
|
-
tone === "danger" && theme.slots.buttonDanger,
|
|
9536
|
-
tone === "muted" && theme.slots.buttonMuted,
|
|
9537
|
-
active && theme.slots.buttonActive
|
|
9538
|
-
);
|
|
9539
|
-
}
|
|
9540
|
-
function LoadingIcon() {
|
|
9541
|
-
return /* @__PURE__ */ jsxs(
|
|
9542
|
-
"svg",
|
|
9543
|
-
{
|
|
9544
|
-
"aria-hidden": "true",
|
|
9545
|
-
viewBox: "0 0 24 24",
|
|
9546
|
-
className: "h-4 w-4 animate-spin",
|
|
9547
|
-
fill: "none",
|
|
9548
|
-
children: [
|
|
9549
|
-
/* @__PURE__ */ jsx(
|
|
9550
|
-
"circle",
|
|
9551
|
-
{
|
|
9552
|
-
cx: "12",
|
|
9553
|
-
cy: "12",
|
|
9554
|
-
r: "9",
|
|
9555
|
-
className: "opacity-25",
|
|
9556
|
-
stroke: "currentColor",
|
|
9557
|
-
strokeWidth: "3"
|
|
9558
|
-
}
|
|
9559
|
-
),
|
|
9560
|
-
/* @__PURE__ */ jsx(
|
|
9561
|
-
"path",
|
|
9562
|
-
{
|
|
9563
|
-
className: "opacity-75",
|
|
9564
|
-
fill: "currentColor",
|
|
9565
|
-
d: "M12 3a9 9 0 0 1 9 9h-3a6 6 0 0 0-6-6V3Z"
|
|
9566
|
-
}
|
|
9567
|
-
)
|
|
9568
|
-
]
|
|
9569
|
-
}
|
|
9570
|
-
);
|
|
9571
|
-
}
|
|
9572
|
-
forwardRef(
|
|
9573
|
-
function BaseButton2({
|
|
9574
|
-
children,
|
|
9575
|
-
label,
|
|
9576
|
-
icon,
|
|
9577
|
-
endIcon,
|
|
9578
|
-
type = "button",
|
|
9579
|
-
title,
|
|
9580
|
-
ariaLabel,
|
|
9581
|
-
tone,
|
|
9582
|
-
active = false,
|
|
9583
|
-
iconOnly = false,
|
|
9584
|
-
disabled = false,
|
|
9585
|
-
loading = false,
|
|
9586
|
-
stopPropagation = false,
|
|
9587
|
-
appearance,
|
|
9588
|
-
className,
|
|
9589
|
-
classNames,
|
|
9590
|
-
style,
|
|
9591
|
-
onClick,
|
|
9592
|
-
"aria-label": nativeAriaLabel,
|
|
9593
|
-
...buttonProps
|
|
9594
|
-
}, ref) {
|
|
9595
|
-
const theme = resolveBaseAppearance(appearance);
|
|
9596
|
-
const resolvedLabel = children ?? label;
|
|
9597
|
-
const labelText = typeof resolvedLabel === "string" ? resolvedLabel : void 0;
|
|
9598
|
-
const resolvedAriaLabel = ariaLabel ?? nativeAriaLabel ?? labelText ?? title ?? (iconOnly ? "Action" : void 0);
|
|
9599
|
-
const resolvedDisabled = disabled || loading;
|
|
9600
|
-
const handleClick = (event) => {
|
|
9601
|
-
if (stopPropagation) {
|
|
9602
|
-
event.stopPropagation();
|
|
9603
|
-
}
|
|
9604
|
-
if (resolvedDisabled) return;
|
|
9605
|
-
onClick?.(event);
|
|
9606
|
-
};
|
|
9607
|
-
return /* @__PURE__ */ jsxs(
|
|
9608
|
-
"button",
|
|
9609
|
-
{
|
|
9610
|
-
...buttonProps,
|
|
9611
|
-
ref,
|
|
9612
|
-
type,
|
|
9613
|
-
title,
|
|
9614
|
-
"aria-label": resolvedAriaLabel,
|
|
9615
|
-
"aria-pressed": active || void 0,
|
|
9616
|
-
"aria-busy": loading || void 0,
|
|
9617
|
-
disabled: resolvedDisabled,
|
|
9618
|
-
className: cn(
|
|
9619
|
-
theme.slots.buttonBase,
|
|
9620
|
-
iconOnly && theme.slots.buttonIconOnly,
|
|
9621
|
-
getBaseButtonToneClassName(theme, tone, active),
|
|
9622
|
-
resolvedDisabled && theme.slots.buttonDisabled,
|
|
9623
|
-
classNames?.root,
|
|
9624
|
-
className
|
|
9625
|
-
),
|
|
9626
|
-
style: {
|
|
9627
|
-
...theme.styles.button,
|
|
9628
|
-
...active ? theme.styles.buttonActive : void 0,
|
|
9629
|
-
...resolvedDisabled ? theme.styles.buttonDisabled : void 0,
|
|
9630
|
-
...style
|
|
9631
|
-
},
|
|
9632
|
-
onClick: handleClick,
|
|
9633
|
-
children: [
|
|
9634
|
-
loading ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: /* @__PURE__ */ jsx(LoadingIcon, {}) }) : icon ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: icon }) : null,
|
|
9635
|
-
iconOnly ? hasRenderableNode(resolvedLabel) ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: resolvedLabel }) : null : hasRenderableNode(resolvedLabel) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonLabel, classNames?.label), children: resolvedLabel }) : null,
|
|
9636
|
-
!loading && endIcon ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: endIcon }) : null
|
|
9637
|
-
]
|
|
9638
|
-
}
|
|
9639
|
-
);
|
|
9640
|
-
}
|
|
9641
|
-
);
|
|
9642
|
-
function setRefs(element, ...refs) {
|
|
9643
|
-
refs.forEach((ref) => {
|
|
9644
|
-
if (!ref) return;
|
|
9645
|
-
if (typeof ref === "function") {
|
|
9646
|
-
ref(element);
|
|
9647
|
-
return;
|
|
9648
|
-
}
|
|
9649
|
-
ref.current = element;
|
|
9650
|
-
});
|
|
9651
|
-
}
|
|
9652
|
-
forwardRef(
|
|
9653
|
-
function BaseCheckbox2({
|
|
9654
|
-
label,
|
|
9655
|
-
description,
|
|
9656
|
-
indeterminate = false,
|
|
9657
|
-
invalid = false,
|
|
9658
|
-
disabled = false,
|
|
9659
|
-
appearance,
|
|
9660
|
-
className,
|
|
9661
|
-
classNames,
|
|
9662
|
-
style,
|
|
9663
|
-
checked,
|
|
9664
|
-
defaultChecked,
|
|
9665
|
-
onChange,
|
|
9666
|
-
"aria-invalid": nativeAriaInvalid,
|
|
9667
|
-
...checkboxProps
|
|
9668
|
-
}, forwardedRef) {
|
|
9669
|
-
const theme = resolveBaseAppearance(appearance);
|
|
9670
|
-
const inputRef = useRef(null);
|
|
9671
|
-
const [uncontrolledChecked, setUncontrolledChecked] = useState(
|
|
9672
|
-
defaultChecked ?? false
|
|
9673
|
-
);
|
|
9674
|
-
const isControlled = checked !== void 0;
|
|
9675
|
-
const resolvedChecked = Boolean(isControlled ? checked : uncontrolledChecked);
|
|
9676
|
-
const active = indeterminate || resolvedChecked;
|
|
9677
|
-
useEffect(() => {
|
|
9678
|
-
if (inputRef.current) {
|
|
9679
|
-
inputRef.current.indeterminate = indeterminate;
|
|
9680
|
-
}
|
|
9681
|
-
}, [indeterminate]);
|
|
9682
|
-
const handleChange = (event) => {
|
|
9683
|
-
if (disabled) return;
|
|
9684
|
-
if (!isControlled) {
|
|
9685
|
-
setUncontrolledChecked(event.currentTarget.checked);
|
|
9686
|
-
}
|
|
9687
|
-
onChange?.(event);
|
|
9688
|
-
};
|
|
9689
|
-
return /* @__PURE__ */ jsxs(
|
|
9690
|
-
"label",
|
|
9691
|
-
{
|
|
9692
|
-
className: cn(
|
|
9693
|
-
theme.slots.checkboxRoot,
|
|
9694
|
-
disabled && theme.slots.checkboxDisabled,
|
|
9695
|
-
classNames?.root,
|
|
9696
|
-
className
|
|
9697
|
-
),
|
|
9698
|
-
style: {
|
|
9699
|
-
...theme.styles.checkboxRoot,
|
|
9700
|
-
...style
|
|
9701
|
-
},
|
|
9702
|
-
children: [
|
|
9703
|
-
/* @__PURE__ */ jsxs(
|
|
9704
|
-
"span",
|
|
9705
|
-
{
|
|
9706
|
-
className: cn(
|
|
9707
|
-
theme.slots.checkboxBox,
|
|
9708
|
-
active && theme.slots.checkboxBoxChecked,
|
|
9709
|
-
invalid && theme.slots.checkboxBoxInvalid,
|
|
9710
|
-
classNames?.box
|
|
9711
|
-
),
|
|
9712
|
-
style: {
|
|
9713
|
-
...theme.styles.checkboxBox
|
|
9714
|
-
},
|
|
9715
|
-
children: [
|
|
9716
|
-
/* @__PURE__ */ jsx(
|
|
9717
|
-
"input",
|
|
9718
|
-
{
|
|
9719
|
-
...checkboxProps,
|
|
9720
|
-
ref: (element) => setRefs(element, inputRef, forwardedRef),
|
|
9721
|
-
type: "checkbox",
|
|
9722
|
-
disabled,
|
|
9723
|
-
checked,
|
|
9724
|
-
defaultChecked,
|
|
9725
|
-
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
9726
|
-
"aria-checked": indeterminate ? "mixed" : resolvedChecked,
|
|
9727
|
-
className: cn(theme.slots.checkboxInput, classNames?.input),
|
|
9728
|
-
onChange: handleChange
|
|
9729
|
-
}
|
|
9730
|
-
),
|
|
9731
|
-
active ? /* @__PURE__ */ jsx(
|
|
9732
|
-
"span",
|
|
9733
|
-
{
|
|
9734
|
-
"aria-hidden": "true",
|
|
9735
|
-
className: cn(theme.slots.checkboxIndicator, classNames?.indicator),
|
|
9736
|
-
children: indeterminate ? "\u2013" : "\u2713"
|
|
9737
|
-
}
|
|
9738
|
-
) : null
|
|
9739
|
-
]
|
|
9740
|
-
}
|
|
9741
|
-
),
|
|
9742
|
-
hasRenderableNode(label) || hasRenderableNode(description) ? /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.checkboxContent, classNames?.content), children: [
|
|
9743
|
-
hasRenderableNode(label) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.checkboxLabel, classNames?.label), children: label }) : null,
|
|
9744
|
-
hasRenderableNode(description) ? /* @__PURE__ */ jsx(
|
|
9745
|
-
"span",
|
|
9746
|
-
{
|
|
9747
|
-
className: cn(
|
|
9748
|
-
theme.slots.checkboxDescription,
|
|
9749
|
-
classNames?.description
|
|
9750
|
-
),
|
|
9751
|
-
children: description
|
|
9752
|
-
}
|
|
9753
|
-
) : null
|
|
9754
|
-
] }) : null
|
|
9755
|
-
]
|
|
9756
|
-
}
|
|
9757
|
-
);
|
|
9758
|
-
}
|
|
9759
|
-
);
|
|
9760
|
-
forwardRef(
|
|
9761
|
-
function BaseInput2({
|
|
9762
|
-
icon,
|
|
9763
|
-
trailing,
|
|
9764
|
-
invalid = false,
|
|
9765
|
-
disabled = false,
|
|
9766
|
-
readOnly = false,
|
|
9767
|
-
appearance,
|
|
9768
|
-
className,
|
|
9769
|
-
classNames,
|
|
9770
|
-
style,
|
|
9771
|
-
"aria-invalid": nativeAriaInvalid,
|
|
9772
|
-
...inputProps
|
|
9773
|
-
}, ref) {
|
|
9774
|
-
const theme = resolveBaseAppearance(appearance);
|
|
9775
|
-
return /* @__PURE__ */ jsxs(
|
|
9776
|
-
"div",
|
|
9777
|
-
{
|
|
9778
|
-
className: cn(
|
|
9779
|
-
theme.slots.controlWrapper,
|
|
9780
|
-
invalid && theme.slots.controlInvalid,
|
|
9781
|
-
disabled && theme.slots.controlDisabled,
|
|
9782
|
-
readOnly && theme.slots.controlReadOnly,
|
|
9783
|
-
classNames?.root,
|
|
9784
|
-
className
|
|
9785
|
-
),
|
|
9786
|
-
style: {
|
|
9787
|
-
...theme.styles.control,
|
|
9788
|
-
...invalid ? theme.styles.controlInvalid : void 0,
|
|
9789
|
-
...disabled ? theme.styles.controlDisabled : void 0,
|
|
9790
|
-
...style
|
|
9791
|
-
},
|
|
9792
|
-
children: [
|
|
9793
|
-
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
9794
|
-
/* @__PURE__ */ jsx(
|
|
9795
|
-
"input",
|
|
9796
|
-
{
|
|
9797
|
-
...inputProps,
|
|
9798
|
-
ref,
|
|
9799
|
-
disabled,
|
|
9800
|
-
readOnly,
|
|
9801
|
-
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
9802
|
-
className: cn(
|
|
9803
|
-
theme.slots.controlBase,
|
|
9804
|
-
theme.slots.controlInput,
|
|
9805
|
-
classNames?.control
|
|
9806
|
-
)
|
|
9807
|
-
}
|
|
9808
|
-
),
|
|
9809
|
-
hasRenderableNode(trailing) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlTrailing, classNames?.trailing), children: trailing }) : null
|
|
9810
|
-
]
|
|
9811
|
-
}
|
|
9812
|
-
);
|
|
9813
|
-
}
|
|
9814
|
-
);
|
|
9815
|
-
function normalizeValues(values) {
|
|
9816
|
-
const nextValues = [];
|
|
9817
|
-
const seen = /* @__PURE__ */ new Set();
|
|
9818
|
-
values?.forEach((value) => {
|
|
9819
|
-
if (seen.has(value)) return;
|
|
9820
|
-
seen.add(value);
|
|
9821
|
-
nextValues.push(value);
|
|
9822
|
-
});
|
|
9823
|
-
return nextValues;
|
|
9824
|
-
}
|
|
9825
|
-
function getNextEnabledIndex(options, currentIndex, direction) {
|
|
9826
|
-
if (!options.length) return -1;
|
|
9827
|
-
const startIndex = currentIndex >= 0 ? currentIndex : 0;
|
|
9828
|
-
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
9829
|
-
const nextIndex = (startIndex + offset * direction + options.length) % options.length;
|
|
9830
|
-
if (!options[nextIndex]?.disabled) {
|
|
9831
|
-
return nextIndex;
|
|
9832
|
-
}
|
|
9833
|
-
}
|
|
9834
|
-
return -1;
|
|
9835
|
-
}
|
|
9836
|
-
function getFirstEnabledIndex(options) {
|
|
9837
|
-
return options.findIndex((option) => !option.disabled);
|
|
9838
|
-
}
|
|
9839
|
-
function getSafeTagCount(maxTagCount, total) {
|
|
9840
|
-
if (maxTagCount === void 0) return total;
|
|
9841
|
-
if (!Number.isFinite(maxTagCount)) return total;
|
|
9842
|
-
return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
|
|
9843
|
-
}
|
|
9844
|
-
function getDefaultRemoveLabel(option) {
|
|
9845
|
-
return `Remove ${option.value}`;
|
|
9846
|
-
}
|
|
9847
|
-
forwardRef(
|
|
9848
|
-
function BaseMultiSelect2({
|
|
9849
|
-
options,
|
|
9850
|
-
value,
|
|
9851
|
-
defaultValue,
|
|
9852
|
-
name,
|
|
9853
|
-
placeholder = "Select options",
|
|
9854
|
-
icon,
|
|
9855
|
-
invalid = false,
|
|
9856
|
-
disabled = false,
|
|
9857
|
-
required = false,
|
|
9858
|
-
openForPreview = false,
|
|
9859
|
-
maxTagCount,
|
|
9860
|
-
removeLabel = getDefaultRemoveLabel,
|
|
9861
|
-
emptyLabel = "No options",
|
|
9862
|
-
appearance,
|
|
9863
|
-
className,
|
|
9864
|
-
classNames,
|
|
9865
|
-
style,
|
|
9866
|
-
id,
|
|
9867
|
-
"aria-invalid": nativeAriaInvalid,
|
|
9868
|
-
"aria-label": nativeAriaLabel,
|
|
9869
|
-
"aria-labelledby": nativeAriaLabelledBy,
|
|
9870
|
-
onValueChange,
|
|
9871
|
-
...rootProps
|
|
9872
|
-
}, ref) {
|
|
9873
|
-
const theme = resolveBaseAppearance(appearance);
|
|
9874
|
-
const generatedId = useId();
|
|
9875
|
-
const multiSelectId = id ?? generatedId;
|
|
9876
|
-
const controlId = `${multiSelectId}-control`;
|
|
9877
|
-
const listboxId = `${multiSelectId}-listbox`;
|
|
9878
|
-
const rootRef = useRef(null);
|
|
9879
|
-
const optionList = options ?? [];
|
|
9880
|
-
const forceOpen = openForPreview;
|
|
9881
|
-
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
9882
|
-
const open = forceOpen || uncontrolledOpen;
|
|
9883
|
-
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
9884
|
-
() => normalizeValues(defaultValue)
|
|
9885
|
-
);
|
|
9886
|
-
const [activeIndex, setActiveIndex] = useState(
|
|
9887
|
-
() => getFirstEnabledIndex(optionList)
|
|
9888
|
-
);
|
|
9889
|
-
const isControlled = value !== void 0;
|
|
9890
|
-
const selectedValues = useMemo(
|
|
9891
|
-
() => normalizeValues(isControlled ? value : uncontrolledValue),
|
|
9892
|
-
[isControlled, uncontrolledValue, value]
|
|
9893
|
-
);
|
|
9894
|
-
const selectedValueSet = useMemo(
|
|
9895
|
-
() => new Set(selectedValues),
|
|
9896
|
-
[selectedValues]
|
|
9897
|
-
);
|
|
9898
|
-
const optionByValue = useMemo(() => {
|
|
9899
|
-
const map = /* @__PURE__ */ new Map();
|
|
9900
|
-
optionList.forEach((option) => {
|
|
9901
|
-
if (!map.has(option.value)) {
|
|
9902
|
-
map.set(option.value, option);
|
|
9903
|
-
}
|
|
9904
|
-
});
|
|
9905
|
-
return map;
|
|
9906
|
-
}, [optionList]);
|
|
9907
|
-
const selectedOptions = useMemo(
|
|
9908
|
-
() => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
|
|
9909
|
-
(option) => option !== void 0
|
|
9910
|
-
),
|
|
9911
|
-
[optionByValue, selectedValues]
|
|
9912
|
-
);
|
|
9913
|
-
const firstEnabledIndex = useMemo(
|
|
9914
|
-
() => getFirstEnabledIndex(optionList),
|
|
9915
|
-
[optionList]
|
|
9916
|
-
);
|
|
9917
|
-
const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
|
|
9918
|
-
const visibleTagCount = getSafeTagCount(
|
|
9919
|
-
maxTagCount,
|
|
9920
|
-
selectedOptions.length
|
|
9921
|
-
);
|
|
9922
|
-
const visibleOptions = selectedOptions.slice(0, visibleTagCount);
|
|
9923
|
-
const overflowCount = selectedOptions.length - visibleOptions.length;
|
|
9924
|
-
const isPlaceholder = selectedOptions.length === 0;
|
|
9925
|
-
const setRootRef = (node) => {
|
|
9926
|
-
rootRef.current = node;
|
|
9927
|
-
if (typeof ref === "function") {
|
|
9928
|
-
ref(node);
|
|
9929
|
-
} else if (ref) {
|
|
9930
|
-
ref.current = node;
|
|
9931
|
-
}
|
|
9932
|
-
};
|
|
9933
|
-
const setOpen = (nextOpen) => {
|
|
9934
|
-
if (disabled || forceOpen) return;
|
|
9935
|
-
setUncontrolledOpen(nextOpen);
|
|
9936
|
-
if (nextOpen) {
|
|
9937
|
-
setActiveIndex(resolvedActiveIndex);
|
|
9938
|
-
}
|
|
9939
|
-
};
|
|
9940
|
-
useEffect(() => {
|
|
9941
|
-
if (!open || forceOpen) return void 0;
|
|
9942
|
-
const handlePointerDown = (event) => {
|
|
9943
|
-
if (!rootRef.current?.contains(event.target)) {
|
|
9944
|
-
setUncontrolledOpen(false);
|
|
9945
|
-
}
|
|
9946
|
-
};
|
|
9947
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
9948
|
-
return () => {
|
|
9949
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
9950
|
-
};
|
|
9951
|
-
}, [forceOpen, open]);
|
|
9952
|
-
useEffect(() => {
|
|
9953
|
-
if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
|
|
9954
|
-
setActiveIndex(resolvedActiveIndex);
|
|
9955
|
-
}
|
|
9956
|
-
}, [activeIndex, resolvedActiveIndex]);
|
|
9957
|
-
const commitValues = (nextValues) => {
|
|
9958
|
-
const normalizedValues = normalizeValues(nextValues);
|
|
9959
|
-
if (!isControlled) {
|
|
9960
|
-
setUncontrolledValue(normalizedValues);
|
|
9961
|
-
}
|
|
9962
|
-
onValueChange?.(normalizedValues);
|
|
9963
|
-
};
|
|
9964
|
-
const toggleOption = (option) => {
|
|
9965
|
-
if (!option || option.disabled || disabled) return;
|
|
9966
|
-
const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
|
|
9967
|
-
commitValues(nextValues);
|
|
9968
|
-
};
|
|
9969
|
-
const removeOption = (option) => {
|
|
9970
|
-
if (disabled) return;
|
|
9971
|
-
commitValues(
|
|
9972
|
-
selectedValues.filter((selectedValue) => selectedValue !== option.value)
|
|
9973
|
-
);
|
|
9974
|
-
};
|
|
9975
|
-
const focusOption = (direction) => {
|
|
9976
|
-
const nextIndex = getNextEnabledIndex(
|
|
9977
|
-
optionList,
|
|
9978
|
-
resolvedActiveIndex,
|
|
9979
|
-
direction
|
|
9980
|
-
);
|
|
9981
|
-
if (nextIndex >= 0) {
|
|
9982
|
-
setActiveIndex(nextIndex);
|
|
9983
|
-
}
|
|
9984
|
-
};
|
|
9985
|
-
const handleKeyDown = (event) => {
|
|
9986
|
-
if (disabled) return;
|
|
9987
|
-
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
9988
|
-
event.preventDefault();
|
|
9989
|
-
if (!open) {
|
|
9990
|
-
setOpen(true);
|
|
9991
|
-
setActiveIndex(firstEnabledIndex);
|
|
9992
|
-
return;
|
|
9993
|
-
}
|
|
9994
|
-
focusOption(event.key === "ArrowDown" ? 1 : -1);
|
|
9995
|
-
return;
|
|
9996
|
-
}
|
|
9997
|
-
if (event.key === "Home") {
|
|
9998
|
-
event.preventDefault();
|
|
9999
|
-
setOpen(true);
|
|
10000
|
-
setActiveIndex(firstEnabledIndex);
|
|
10001
|
-
return;
|
|
10002
|
-
}
|
|
10003
|
-
if (event.key === "End") {
|
|
10004
|
-
event.preventDefault();
|
|
10005
|
-
setOpen(true);
|
|
10006
|
-
for (let index = optionList.length - 1; index >= 0; index -= 1) {
|
|
10007
|
-
if (!optionList[index]?.disabled) {
|
|
10008
|
-
setActiveIndex(index);
|
|
10009
|
-
break;
|
|
10010
|
-
}
|
|
10011
|
-
}
|
|
10012
|
-
return;
|
|
10013
|
-
}
|
|
10014
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
10015
|
-
event.preventDefault();
|
|
10016
|
-
if (!open) {
|
|
10017
|
-
setOpen(true);
|
|
10018
|
-
return;
|
|
10019
|
-
}
|
|
10020
|
-
toggleOption(optionList[resolvedActiveIndex]);
|
|
10021
|
-
return;
|
|
10022
|
-
}
|
|
10023
|
-
if (event.key === "Escape") {
|
|
10024
|
-
setOpen(false);
|
|
10025
|
-
}
|
|
10026
|
-
};
|
|
10027
|
-
return /* @__PURE__ */ jsxs(
|
|
10028
|
-
"div",
|
|
10029
|
-
{
|
|
10030
|
-
...rootProps,
|
|
10031
|
-
id,
|
|
10032
|
-
ref: setRootRef,
|
|
10033
|
-
className: cn(
|
|
10034
|
-
theme.slots.controlWrapper,
|
|
10035
|
-
"overflow-visible",
|
|
10036
|
-
open && "z-50",
|
|
10037
|
-
invalid && theme.slots.controlInvalid,
|
|
10038
|
-
disabled && theme.slots.controlDisabled,
|
|
10039
|
-
classNames?.root,
|
|
10040
|
-
className
|
|
10041
|
-
),
|
|
10042
|
-
style: {
|
|
10043
|
-
...theme.styles.control,
|
|
10044
|
-
...invalid ? theme.styles.controlInvalid : void 0,
|
|
10045
|
-
...disabled ? theme.styles.controlDisabled : void 0,
|
|
10046
|
-
...style
|
|
10047
|
-
},
|
|
10048
|
-
children: [
|
|
10049
|
-
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
10050
|
-
/* @__PURE__ */ jsx(
|
|
10051
|
-
"div",
|
|
10052
|
-
{
|
|
10053
|
-
id: controlId,
|
|
10054
|
-
role: "combobox",
|
|
10055
|
-
tabIndex: disabled ? -1 : 0,
|
|
10056
|
-
"aria-haspopup": "listbox",
|
|
10057
|
-
"aria-expanded": open,
|
|
10058
|
-
"aria-controls": listboxId,
|
|
10059
|
-
"aria-disabled": disabled || void 0,
|
|
10060
|
-
"aria-required": required || void 0,
|
|
10061
|
-
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
10062
|
-
"aria-label": nativeAriaLabel,
|
|
10063
|
-
"aria-labelledby": nativeAriaLabelledBy,
|
|
10064
|
-
className: cn(
|
|
10065
|
-
theme.slots.controlBase,
|
|
10066
|
-
"flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
|
|
10067
|
-
disabled && "!cursor-not-allowed",
|
|
10068
|
-
classNames?.control
|
|
10069
|
-
),
|
|
10070
|
-
onClick: () => setOpen(!open),
|
|
10071
|
-
onKeyDown: handleKeyDown,
|
|
10072
|
-
children: /* @__PURE__ */ jsxs(
|
|
10073
|
-
"span",
|
|
10074
|
-
{
|
|
10075
|
-
className: cn(
|
|
10076
|
-
"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
|
|
10077
|
-
classNames?.tagList
|
|
10078
|
-
),
|
|
10079
|
-
children: [
|
|
10080
|
-
visibleOptions.map((option) => /* @__PURE__ */ jsxs(
|
|
10081
|
-
"span",
|
|
10082
|
-
{
|
|
10083
|
-
className: cn(
|
|
10084
|
-
"inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-muted/65 px-2 py-0.5 text-xs font-medium text-foreground",
|
|
10085
|
-
classNames?.tag
|
|
10086
|
-
),
|
|
10087
|
-
children: [
|
|
10088
|
-
/* @__PURE__ */ jsx(
|
|
10089
|
-
"span",
|
|
10090
|
-
{
|
|
10091
|
-
className: cn(
|
|
10092
|
-
"max-w-40 truncate",
|
|
10093
|
-
classNames?.tagLabel
|
|
10094
|
-
),
|
|
10095
|
-
children: option.label
|
|
10096
|
-
}
|
|
10097
|
-
),
|
|
10098
|
-
/* @__PURE__ */ jsx(
|
|
10099
|
-
"button",
|
|
10100
|
-
{
|
|
10101
|
-
type: "button",
|
|
10102
|
-
"aria-label": removeLabel(option),
|
|
10103
|
-
disabled,
|
|
10104
|
-
className: cn(
|
|
10105
|
-
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background/80 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed",
|
|
10106
|
-
classNames?.tagRemove
|
|
10107
|
-
),
|
|
10108
|
-
onClick: (event) => {
|
|
10109
|
-
event.preventDefault();
|
|
10110
|
-
event.stopPropagation();
|
|
10111
|
-
removeOption(option);
|
|
10112
|
-
},
|
|
10113
|
-
onMouseDown: (event) => {
|
|
10114
|
-
event.preventDefault();
|
|
10115
|
-
event.stopPropagation();
|
|
10116
|
-
},
|
|
10117
|
-
onKeyDown: (event) => event.stopPropagation(),
|
|
10118
|
-
children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "x" })
|
|
10119
|
-
}
|
|
10120
|
-
)
|
|
10121
|
-
]
|
|
10122
|
-
},
|
|
10123
|
-
option.value
|
|
10124
|
-
)),
|
|
10125
|
-
overflowCount > 0 ? /* @__PURE__ */ jsxs(
|
|
10126
|
-
"span",
|
|
10127
|
-
{
|
|
10128
|
-
className: cn(
|
|
10129
|
-
"inline-flex max-w-full items-center rounded-full border border-border/70 bg-muted/45 px-2 py-0.5 text-xs font-medium text-muted-foreground",
|
|
10130
|
-
classNames?.tag
|
|
10131
|
-
),
|
|
10132
|
-
children: [
|
|
10133
|
-
"+",
|
|
10134
|
-
overflowCount
|
|
10135
|
-
]
|
|
10136
|
-
}
|
|
10137
|
-
) : null,
|
|
10138
|
-
isPlaceholder ? /* @__PURE__ */ jsx(
|
|
10139
|
-
"span",
|
|
10140
|
-
{
|
|
10141
|
-
className: cn(
|
|
10142
|
-
"min-w-0 truncate",
|
|
10143
|
-
theme.slots.selectPlaceholder,
|
|
10144
|
-
classNames?.placeholder
|
|
10145
|
-
),
|
|
10146
|
-
children: placeholder
|
|
10147
|
-
}
|
|
10148
|
-
) : null
|
|
10149
|
-
]
|
|
10150
|
-
}
|
|
10151
|
-
)
|
|
10152
|
-
}
|
|
10153
|
-
),
|
|
10154
|
-
/* @__PURE__ */ jsx(
|
|
10155
|
-
"span",
|
|
10156
|
-
{
|
|
10157
|
-
className: cn(
|
|
10158
|
-
theme.slots.selectChevron,
|
|
10159
|
-
open && "rotate-[225deg]",
|
|
10160
|
-
classNames?.chevron
|
|
10161
|
-
)
|
|
10162
|
-
}
|
|
10163
|
-
),
|
|
10164
|
-
name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsx(
|
|
10165
|
-
"input",
|
|
10166
|
-
{
|
|
10167
|
-
type: "hidden",
|
|
10168
|
-
name,
|
|
10169
|
-
value: selectedValue,
|
|
10170
|
-
className: classNames?.hiddenInput
|
|
10171
|
-
},
|
|
10172
|
-
selectedValue
|
|
10173
|
-
)) : null,
|
|
10174
|
-
open ? /* @__PURE__ */ jsx(
|
|
10175
|
-
"div",
|
|
10176
|
-
{
|
|
10177
|
-
id: listboxId,
|
|
10178
|
-
role: "listbox",
|
|
10179
|
-
"aria-multiselectable": "true",
|
|
10180
|
-
"aria-labelledby": controlId,
|
|
10181
|
-
className: cn(theme.slots.selectMenu, classNames?.menu),
|
|
10182
|
-
style: theme.styles.selectMenu,
|
|
10183
|
-
children: optionList.length > 0 ? optionList.map((option, index) => {
|
|
10184
|
-
const selected = selectedValueSet.has(option.value);
|
|
10185
|
-
const active = index === resolvedActiveIndex;
|
|
10186
|
-
return /* @__PURE__ */ jsxs(
|
|
10187
|
-
"button",
|
|
10188
|
-
{
|
|
10189
|
-
type: "button",
|
|
10190
|
-
role: "option",
|
|
10191
|
-
"aria-selected": selected,
|
|
10192
|
-
disabled: option.disabled,
|
|
10193
|
-
className: cn(
|
|
10194
|
-
theme.slots.selectOption,
|
|
10195
|
-
"gap-2",
|
|
10196
|
-
active && theme.slots.selectOptionActive,
|
|
10197
|
-
selected && theme.slots.selectOptionSelected,
|
|
10198
|
-
option.disabled && theme.slots.selectOptionDisabled,
|
|
10199
|
-
classNames?.option
|
|
10200
|
-
),
|
|
10201
|
-
style: {
|
|
10202
|
-
...theme.styles.selectOption,
|
|
10203
|
-
...active ? theme.styles.selectOptionActive : void 0,
|
|
10204
|
-
...selected ? theme.styles.selectOptionSelected : void 0
|
|
10205
|
-
},
|
|
10206
|
-
onMouseEnter: () => {
|
|
10207
|
-
if (!option.disabled) {
|
|
10208
|
-
setActiveIndex(index);
|
|
10209
|
-
}
|
|
10210
|
-
},
|
|
10211
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
10212
|
-
onClick: () => toggleOption(option),
|
|
10213
|
-
children: [
|
|
10214
|
-
/* @__PURE__ */ jsx(
|
|
10215
|
-
"span",
|
|
10216
|
-
{
|
|
10217
|
-
"aria-hidden": "true",
|
|
10218
|
-
className: cn(
|
|
10219
|
-
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
|
|
10220
|
-
selected && "border-primary/40 bg-primary text-primary-foreground",
|
|
10221
|
-
classNames?.optionIndicator
|
|
10222
|
-
),
|
|
10223
|
-
children: selected ? "\u2713" : null
|
|
10224
|
-
}
|
|
10225
|
-
),
|
|
10226
|
-
/* @__PURE__ */ jsx(
|
|
10227
|
-
"span",
|
|
10228
|
-
{
|
|
10229
|
-
className: cn(
|
|
10230
|
-
"min-w-0 flex-1 truncate",
|
|
10231
|
-
classNames?.optionLabel
|
|
10232
|
-
),
|
|
10233
|
-
children: option.label
|
|
10234
|
-
}
|
|
10235
|
-
)
|
|
10236
|
-
]
|
|
10237
|
-
},
|
|
10238
|
-
option.value
|
|
10239
|
-
);
|
|
10240
|
-
}) : /* @__PURE__ */ jsx(
|
|
10241
|
-
"div",
|
|
10242
|
-
{
|
|
10243
|
-
className: cn(
|
|
10244
|
-
"px-2.5 py-2 text-sm text-muted-foreground",
|
|
10245
|
-
classNames?.empty
|
|
10246
|
-
),
|
|
10247
|
-
children: emptyLabel
|
|
10248
|
-
}
|
|
10249
|
-
)
|
|
10250
|
-
}
|
|
10251
|
-
) : null
|
|
10252
|
-
]
|
|
10253
|
-
}
|
|
10254
|
-
);
|
|
10255
|
-
}
|
|
10256
|
-
);
|
|
10257
|
-
function findOption(options, value) {
|
|
10258
|
-
if (value === void 0) return void 0;
|
|
10259
|
-
return options.find((option) => option.value === value);
|
|
10260
|
-
}
|
|
10261
|
-
function getInitialValue(options, defaultValue) {
|
|
10262
|
-
if (typeof defaultValue === "string") {
|
|
10263
|
-
return defaultValue;
|
|
10264
|
-
}
|
|
10265
|
-
return "";
|
|
10266
|
-
}
|
|
10267
|
-
function getNextEnabledIndex2(options, currentIndex, direction) {
|
|
10268
|
-
if (!options.length) return -1;
|
|
10269
|
-
for (let offset = 1; offset <= options.length; offset += 1) {
|
|
10270
|
-
const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
|
|
10271
|
-
if (!options[nextIndex]?.disabled) {
|
|
10272
|
-
return nextIndex;
|
|
10273
|
-
}
|
|
10274
|
-
}
|
|
10275
|
-
return -1;
|
|
10276
|
-
}
|
|
10277
|
-
forwardRef(
|
|
10278
|
-
function BaseSelect2({
|
|
10279
|
-
options,
|
|
10280
|
-
placeholder,
|
|
10281
|
-
icon,
|
|
10282
|
-
invalid = false,
|
|
10283
|
-
disabled = false,
|
|
10284
|
-
openForPreview = false,
|
|
10285
|
-
appearance,
|
|
10286
|
-
className,
|
|
10287
|
-
classNames,
|
|
10288
|
-
style,
|
|
10289
|
-
children,
|
|
10290
|
-
value,
|
|
10291
|
-
defaultValue,
|
|
10292
|
-
onChange,
|
|
10293
|
-
name,
|
|
10294
|
-
id,
|
|
10295
|
-
required,
|
|
10296
|
-
"aria-invalid": nativeAriaInvalid,
|
|
10297
|
-
"aria-label": nativeAriaLabel,
|
|
10298
|
-
"aria-labelledby": nativeAriaLabelledBy,
|
|
10299
|
-
...selectProps
|
|
10300
|
-
}, ref) {
|
|
10301
|
-
const theme = resolveBaseAppearance(appearance);
|
|
10302
|
-
const generatedId = useId();
|
|
10303
|
-
const selectId = id ?? generatedId;
|
|
10304
|
-
const listboxId = `${selectId}-listbox`;
|
|
10305
|
-
const rootRef = useRef(null);
|
|
10306
|
-
const selectRef = useRef(null);
|
|
10307
|
-
const optionList = options ?? [];
|
|
10308
|
-
const isCustomSelect = optionList.length > 0;
|
|
10309
|
-
const forceOpen = openForPreview;
|
|
10310
|
-
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
10311
|
-
const open = forceOpen || uncontrolledOpen;
|
|
10312
|
-
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
10313
|
-
() => getInitialValue(optionList, defaultValue)
|
|
10314
|
-
);
|
|
10315
|
-
const isControlled = value !== void 0;
|
|
10316
|
-
const selectedValue = String(isControlled ? value : uncontrolledValue);
|
|
10317
|
-
const selectedOption = findOption(optionList, selectedValue);
|
|
10318
|
-
const activeIndex = useMemo(() => {
|
|
10319
|
-
const selectedIndex = optionList.findIndex(
|
|
10320
|
-
(option) => option.value === selectedValue && !option.disabled
|
|
10321
|
-
);
|
|
10322
|
-
if (selectedIndex >= 0) return selectedIndex;
|
|
10323
|
-
return optionList.findIndex((option) => !option.disabled);
|
|
10324
|
-
}, [optionList, selectedValue]);
|
|
10325
|
-
const visibleLabel = selectedOption?.label ?? placeholder;
|
|
10326
|
-
const isPlaceholder = !selectedOption;
|
|
10327
|
-
const setSelectRef = (node) => {
|
|
10328
|
-
selectRef.current = node;
|
|
10329
|
-
if (typeof ref === "function") {
|
|
10330
|
-
ref(node);
|
|
10331
|
-
} else if (ref) {
|
|
10332
|
-
ref.current = node;
|
|
10333
|
-
}
|
|
10334
|
-
};
|
|
10335
|
-
useEffect(() => {
|
|
10336
|
-
if (!open || forceOpen) return void 0;
|
|
10337
|
-
const handlePointerDown = (event) => {
|
|
10338
|
-
if (!rootRef.current?.contains(event.target)) {
|
|
10339
|
-
setUncontrolledOpen(false);
|
|
10340
|
-
}
|
|
10341
|
-
};
|
|
10342
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
10343
|
-
return () => {
|
|
10344
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
10345
|
-
};
|
|
10346
|
-
}, [forceOpen, open]);
|
|
10347
|
-
const notifyChange = (nextValue) => {
|
|
10348
|
-
const selectElement = selectRef.current;
|
|
10349
|
-
if (!selectElement) return;
|
|
10350
|
-
const valueSetter = Object.getOwnPropertyDescriptor(
|
|
10351
|
-
HTMLSelectElement.prototype,
|
|
10352
|
-
"value"
|
|
10353
|
-
)?.set;
|
|
10354
|
-
valueSetter?.call(selectElement, nextValue);
|
|
10355
|
-
selectElement.dispatchEvent(new Event("change", { bubbles: true }));
|
|
10356
|
-
};
|
|
10357
|
-
const commitValue = (nextValue, optionDisabled) => {
|
|
10358
|
-
if (optionDisabled || disabled) return;
|
|
10359
|
-
if (!isControlled) {
|
|
10360
|
-
setUncontrolledValue(nextValue);
|
|
10361
|
-
}
|
|
10362
|
-
notifyChange(nextValue);
|
|
10363
|
-
if (!forceOpen) {
|
|
10364
|
-
setUncontrolledOpen(false);
|
|
10365
|
-
}
|
|
10366
|
-
};
|
|
10367
|
-
const focusOption = (direction) => {
|
|
10368
|
-
const currentIndex = activeIndex >= 0 ? activeIndex : 0;
|
|
10369
|
-
const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
|
|
10370
|
-
if (nextIndex >= 0) {
|
|
10371
|
-
commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
|
|
10372
|
-
}
|
|
10373
|
-
};
|
|
10374
|
-
const handleKeyDown = (event) => {
|
|
10375
|
-
if (disabled) return;
|
|
10376
|
-
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
10377
|
-
event.preventDefault();
|
|
10378
|
-
if (!open) {
|
|
10379
|
-
setUncontrolledOpen(true);
|
|
10380
|
-
return;
|
|
10381
|
-
}
|
|
10382
|
-
focusOption(event.key === "ArrowDown" ? 1 : -1);
|
|
10383
|
-
return;
|
|
10384
|
-
}
|
|
10385
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
10386
|
-
event.preventDefault();
|
|
10387
|
-
if (!forceOpen) {
|
|
10388
|
-
setUncontrolledOpen((current) => !current);
|
|
10389
|
-
}
|
|
10390
|
-
return;
|
|
10391
|
-
}
|
|
10392
|
-
if (event.key === "Escape") {
|
|
10393
|
-
setUncontrolledOpen(false);
|
|
10394
|
-
}
|
|
10395
|
-
};
|
|
10396
|
-
if (!isCustomSelect) {
|
|
10397
|
-
return /* @__PURE__ */ jsxs(
|
|
10398
|
-
"div",
|
|
10399
|
-
{
|
|
10400
|
-
className: cn(
|
|
10401
|
-
theme.slots.controlWrapper,
|
|
10402
|
-
invalid && theme.slots.controlInvalid,
|
|
10403
|
-
disabled && theme.slots.controlDisabled,
|
|
10404
|
-
classNames?.root,
|
|
10405
|
-
className
|
|
10406
|
-
),
|
|
10407
|
-
style: {
|
|
10408
|
-
...theme.styles.control,
|
|
10409
|
-
...invalid ? theme.styles.controlInvalid : void 0,
|
|
10410
|
-
...disabled ? theme.styles.controlDisabled : void 0,
|
|
10411
|
-
...style
|
|
10412
|
-
},
|
|
10413
|
-
children: [
|
|
10414
|
-
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
10415
|
-
/* @__PURE__ */ jsxs(
|
|
10416
|
-
"select",
|
|
10417
|
-
{
|
|
10418
|
-
...selectProps,
|
|
10419
|
-
id,
|
|
10420
|
-
ref,
|
|
10421
|
-
name,
|
|
10422
|
-
value,
|
|
10423
|
-
defaultValue,
|
|
10424
|
-
required,
|
|
10425
|
-
disabled,
|
|
10426
|
-
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
10427
|
-
"aria-label": nativeAriaLabel,
|
|
10428
|
-
"aria-labelledby": nativeAriaLabelledBy,
|
|
10429
|
-
onChange,
|
|
10430
|
-
className: cn(
|
|
10431
|
-
theme.slots.controlBase,
|
|
10432
|
-
theme.slots.controlSelect,
|
|
10433
|
-
classNames?.control
|
|
10434
|
-
),
|
|
10435
|
-
children: [
|
|
10436
|
-
hasRenderableNode(placeholder) ? /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }) : null,
|
|
10437
|
-
children
|
|
10438
|
-
]
|
|
10439
|
-
}
|
|
10440
|
-
),
|
|
10441
|
-
/* @__PURE__ */ jsx("span", { className: theme.slots.selectChevron })
|
|
10442
|
-
]
|
|
10443
|
-
}
|
|
10444
|
-
);
|
|
10445
|
-
}
|
|
10446
|
-
return /* @__PURE__ */ jsxs(
|
|
10447
|
-
"div",
|
|
10448
|
-
{
|
|
10449
|
-
ref: rootRef,
|
|
10450
|
-
className: cn(
|
|
10451
|
-
theme.slots.controlWrapper,
|
|
10452
|
-
"overflow-visible",
|
|
10453
|
-
open && "z-50",
|
|
10454
|
-
invalid && theme.slots.controlInvalid,
|
|
10455
|
-
disabled && theme.slots.controlDisabled,
|
|
10456
|
-
classNames?.root,
|
|
10457
|
-
className
|
|
10458
|
-
),
|
|
10459
|
-
style: {
|
|
10460
|
-
...theme.styles.control,
|
|
10461
|
-
...invalid ? theme.styles.controlInvalid : void 0,
|
|
10462
|
-
...disabled ? theme.styles.controlDisabled : void 0,
|
|
10463
|
-
...style
|
|
10464
|
-
},
|
|
10465
|
-
children: [
|
|
10466
|
-
hasRenderableNode(icon) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
|
|
10467
|
-
/* @__PURE__ */ jsx(
|
|
10468
|
-
"button",
|
|
10469
|
-
{
|
|
10470
|
-
type: "button",
|
|
10471
|
-
id: `${selectId}-button`,
|
|
10472
|
-
disabled,
|
|
10473
|
-
"aria-haspopup": "listbox",
|
|
10474
|
-
"aria-expanded": open,
|
|
10475
|
-
"aria-controls": listboxId,
|
|
10476
|
-
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
10477
|
-
"aria-label": nativeAriaLabel,
|
|
10478
|
-
"aria-labelledby": nativeAriaLabelledBy,
|
|
10479
|
-
className: cn(
|
|
10480
|
-
theme.slots.controlBase,
|
|
10481
|
-
theme.slots.controlSelect,
|
|
10482
|
-
"flex items-center text-left",
|
|
10483
|
-
classNames?.control
|
|
10484
|
-
),
|
|
10485
|
-
onClick: () => {
|
|
10486
|
-
if (!forceOpen) {
|
|
10487
|
-
setUncontrolledOpen((current) => !current);
|
|
10488
|
-
}
|
|
10489
|
-
},
|
|
10490
|
-
onKeyDown: handleKeyDown,
|
|
10491
|
-
children: /* @__PURE__ */ jsx(
|
|
10492
|
-
"span",
|
|
10493
|
-
{
|
|
10494
|
-
className: cn(
|
|
10495
|
-
"min-w-0 flex-1 truncate",
|
|
10496
|
-
isPlaceholder && theme.slots.selectPlaceholder,
|
|
10497
|
-
isPlaceholder && classNames?.placeholder
|
|
10498
|
-
),
|
|
10499
|
-
children: visibleLabel
|
|
10500
|
-
}
|
|
10501
|
-
)
|
|
10502
|
-
}
|
|
10503
|
-
),
|
|
10504
|
-
/* @__PURE__ */ jsx(
|
|
10505
|
-
"span",
|
|
10506
|
-
{
|
|
10507
|
-
className: cn(
|
|
10508
|
-
theme.slots.selectChevron,
|
|
10509
|
-
open && "rotate-[225deg]"
|
|
10510
|
-
)
|
|
10511
|
-
}
|
|
10512
|
-
),
|
|
10513
|
-
/* @__PURE__ */ jsxs(
|
|
10514
|
-
"select",
|
|
10515
|
-
{
|
|
10516
|
-
...selectProps,
|
|
10517
|
-
ref: setSelectRef,
|
|
10518
|
-
id,
|
|
10519
|
-
name,
|
|
10520
|
-
value: selectedValue,
|
|
10521
|
-
required,
|
|
10522
|
-
disabled,
|
|
10523
|
-
"aria-hidden": "true",
|
|
10524
|
-
tabIndex: -1,
|
|
10525
|
-
className: theme.slots.selectNative,
|
|
10526
|
-
onChange,
|
|
10527
|
-
children: [
|
|
10528
|
-
hasRenderableNode(placeholder) ? /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }) : null,
|
|
10529
|
-
optionList.map((option) => /* @__PURE__ */ jsx(
|
|
10530
|
-
"option",
|
|
10531
|
-
{
|
|
10532
|
-
value: option.value,
|
|
10533
|
-
disabled: option.disabled,
|
|
10534
|
-
children: typeof option.label === "string" ? option.label : option.value
|
|
10535
|
-
},
|
|
10536
|
-
option.value
|
|
10537
|
-
))
|
|
10538
|
-
]
|
|
10539
|
-
}
|
|
10540
|
-
),
|
|
10541
|
-
open ? /* @__PURE__ */ jsx(
|
|
10542
|
-
"div",
|
|
10543
|
-
{
|
|
10544
|
-
id: listboxId,
|
|
10545
|
-
role: "listbox",
|
|
10546
|
-
"aria-labelledby": `${selectId}-button`,
|
|
10547
|
-
className: cn(theme.slots.selectMenu, classNames?.menu),
|
|
10548
|
-
style: theme.styles.selectMenu,
|
|
10549
|
-
children: optionList.map((option, index) => {
|
|
10550
|
-
const selected = option.value === selectedValue;
|
|
10551
|
-
const active = index === activeIndex;
|
|
10552
|
-
return /* @__PURE__ */ jsx(
|
|
10553
|
-
"button",
|
|
10554
|
-
{
|
|
10555
|
-
type: "button",
|
|
10556
|
-
role: "option",
|
|
10557
|
-
"aria-selected": selected,
|
|
10558
|
-
disabled: option.disabled,
|
|
10559
|
-
className: cn(
|
|
10560
|
-
theme.slots.selectOption,
|
|
10561
|
-
active && theme.slots.selectOptionActive,
|
|
10562
|
-
selected && theme.slots.selectOptionSelected,
|
|
10563
|
-
option.disabled && theme.slots.selectOptionDisabled,
|
|
10564
|
-
classNames?.option
|
|
10565
|
-
),
|
|
10566
|
-
style: {
|
|
10567
|
-
...theme.styles.selectOption,
|
|
10568
|
-
...active ? theme.styles.selectOptionActive : void 0,
|
|
10569
|
-
...selected ? theme.styles.selectOptionSelected : void 0
|
|
10570
|
-
},
|
|
10571
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
10572
|
-
onClick: () => commitValue(option.value, option.disabled),
|
|
10573
|
-
children: /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: option.label })
|
|
10574
|
-
},
|
|
10575
|
-
option.value
|
|
10576
|
-
);
|
|
10577
|
-
})
|
|
10578
|
-
}
|
|
10579
|
-
) : null
|
|
10580
|
-
]
|
|
10581
|
-
}
|
|
10582
|
-
);
|
|
10583
|
-
}
|
|
10584
|
-
);
|
|
10585
|
-
forwardRef(
|
|
10586
|
-
function BaseSwitch2({
|
|
10587
|
-
label,
|
|
10588
|
-
description,
|
|
10589
|
-
disabled = false,
|
|
10590
|
-
appearance,
|
|
10591
|
-
className,
|
|
10592
|
-
classNames,
|
|
10593
|
-
style,
|
|
10594
|
-
checked,
|
|
10595
|
-
defaultChecked,
|
|
10596
|
-
onChange,
|
|
10597
|
-
...switchProps
|
|
10598
|
-
}, ref) {
|
|
10599
|
-
const theme = resolveBaseAppearance(appearance);
|
|
10600
|
-
const [uncontrolledChecked, setUncontrolledChecked] = useState(
|
|
10601
|
-
defaultChecked ?? false
|
|
10602
|
-
);
|
|
10603
|
-
const isControlled = checked !== void 0;
|
|
10604
|
-
const resolvedChecked = isControlled ? checked : uncontrolledChecked;
|
|
10605
|
-
const handleChange = (event) => {
|
|
10606
|
-
if (!isControlled) {
|
|
10607
|
-
setUncontrolledChecked(event.currentTarget.checked);
|
|
10608
|
-
}
|
|
10609
|
-
onChange?.(event);
|
|
10610
|
-
};
|
|
10611
|
-
return /* @__PURE__ */ jsxs(
|
|
10612
|
-
"label",
|
|
10613
|
-
{
|
|
10614
|
-
className: cn(
|
|
10615
|
-
theme.slots.switchRoot,
|
|
10616
|
-
disabled && theme.slots.switchDisabled,
|
|
10617
|
-
classNames?.root,
|
|
10618
|
-
className
|
|
10619
|
-
),
|
|
10620
|
-
style: {
|
|
10621
|
-
...theme.styles.switchRoot,
|
|
10622
|
-
...style
|
|
10623
|
-
},
|
|
10624
|
-
children: [
|
|
10625
|
-
/* @__PURE__ */ jsxs(
|
|
10626
|
-
"span",
|
|
10627
|
-
{
|
|
10628
|
-
className: cn(
|
|
10629
|
-
theme.slots.switchTrack,
|
|
10630
|
-
resolvedChecked && theme.slots.switchChecked,
|
|
10631
|
-
classNames?.track
|
|
10632
|
-
),
|
|
10633
|
-
style: theme.styles.switchTrack,
|
|
10634
|
-
children: [
|
|
10635
|
-
/* @__PURE__ */ jsx(
|
|
10636
|
-
"input",
|
|
10637
|
-
{
|
|
10638
|
-
...switchProps,
|
|
10639
|
-
ref,
|
|
10640
|
-
type: "checkbox",
|
|
10641
|
-
disabled,
|
|
10642
|
-
checked,
|
|
10643
|
-
defaultChecked,
|
|
10644
|
-
onChange: handleChange,
|
|
10645
|
-
className: cn(theme.slots.switchInput, classNames?.input)
|
|
10646
|
-
}
|
|
10647
|
-
),
|
|
10648
|
-
/* @__PURE__ */ jsx(
|
|
10649
|
-
"span",
|
|
10650
|
-
{
|
|
10651
|
-
className: cn(
|
|
10652
|
-
theme.slots.switchThumb,
|
|
10653
|
-
resolvedChecked && "translate-x-5",
|
|
10654
|
-
classNames?.thumb
|
|
10655
|
-
),
|
|
10656
|
-
style: theme.styles.switchThumb
|
|
10657
|
-
}
|
|
10658
|
-
)
|
|
10659
|
-
]
|
|
10660
|
-
}
|
|
10661
|
-
),
|
|
10662
|
-
hasRenderableNode(label) || hasRenderableNode(description) ? /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.switchContent, classNames?.content), children: [
|
|
10663
|
-
hasRenderableNode(label) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.switchLabel, classNames?.label), children: label }) : null,
|
|
10664
|
-
hasRenderableNode(description) ? /* @__PURE__ */ jsx(
|
|
10665
|
-
"span",
|
|
10666
|
-
{
|
|
10667
|
-
className: cn(
|
|
10668
|
-
theme.slots.switchDescription,
|
|
10669
|
-
classNames?.description
|
|
10670
|
-
),
|
|
10671
|
-
children: description
|
|
10672
|
-
}
|
|
10673
|
-
) : null
|
|
10674
|
-
] }) : null
|
|
10675
|
-
]
|
|
10676
|
-
}
|
|
10677
|
-
);
|
|
10678
|
-
}
|
|
10679
|
-
);
|
|
10680
|
-
var DATA_TRANSFER_COLUMN_TYPE = "application/x-monkeys-base-table-column";
|
|
10681
|
-
var BaseTableContext = createContext(null);
|
|
10682
|
-
function useBaseTableContext(appearance) {
|
|
10683
|
-
const context = useContext(BaseTableContext);
|
|
10684
|
-
if (context) {
|
|
10685
|
-
return {
|
|
10686
|
-
...context,
|
|
10687
|
-
theme: appearance ? resolveBaseAppearance(appearance) : context.theme,
|
|
10688
|
-
appearance: appearance ?? context.appearance
|
|
10689
|
-
};
|
|
10690
|
-
}
|
|
10691
|
-
const theme = resolveBaseAppearance(appearance);
|
|
10692
|
-
return {
|
|
10693
|
-
appearance,
|
|
10694
|
-
theme,
|
|
10695
|
-
layout: "native",
|
|
10696
|
-
setDraggingColumnId: () => {
|
|
10697
|
-
}
|
|
10698
|
-
};
|
|
10699
|
-
}
|
|
10700
|
-
function toCssSize(value) {
|
|
10701
|
-
if (value === void 0) return void 0;
|
|
10702
|
-
return typeof value === "number" ? `${value}px` : value;
|
|
10703
|
-
}
|
|
10704
|
-
function clampWidth(value, minWidth, maxWidth) {
|
|
10705
|
-
const min5 = minWidth ?? 48;
|
|
10706
|
-
const max5 = maxWidth ?? Number.POSITIVE_INFINITY;
|
|
10707
|
-
return Math.min(Math.max(value, min5), max5);
|
|
10708
|
-
}
|
|
10709
|
-
function getNextColumnOrder(order, columnId, targetColumnId) {
|
|
10710
|
-
if (!order || columnId === targetColumnId) return void 0;
|
|
10711
|
-
const fromIndex = order.indexOf(columnId);
|
|
10712
|
-
const toIndex = order.indexOf(targetColumnId);
|
|
10713
|
-
if (fromIndex < 0 || toIndex < 0) return void 0;
|
|
10714
|
-
const next = [...order];
|
|
10715
|
-
const [moved] = next.splice(fromIndex, 1);
|
|
10716
|
-
next.splice(toIndex, 0, moved);
|
|
10717
|
-
return next;
|
|
10718
|
-
}
|
|
10719
|
-
function sortAriaValue(direction) {
|
|
10720
|
-
switch (direction) {
|
|
10721
|
-
case "asc":
|
|
10722
|
-
return "ascending";
|
|
10723
|
-
case "desc":
|
|
10724
|
-
return "descending";
|
|
10725
|
-
default:
|
|
10726
|
-
return void 0;
|
|
10727
|
-
}
|
|
10728
|
-
}
|
|
10729
|
-
function getSplitHeadJustifyContent(align) {
|
|
10730
|
-
switch (align) {
|
|
10731
|
-
case "center":
|
|
10732
|
-
return "center";
|
|
10733
|
-
case "right":
|
|
10734
|
-
return "flex-end";
|
|
10735
|
-
default:
|
|
10736
|
-
return "flex-start";
|
|
10737
|
-
}
|
|
10738
|
-
}
|
|
10739
|
-
function getSplitHeadAlignItems(verticalAlign) {
|
|
10740
|
-
switch (verticalAlign) {
|
|
10741
|
-
case "top":
|
|
10742
|
-
return "flex-start";
|
|
10743
|
-
case "bottom":
|
|
10744
|
-
return "flex-end";
|
|
10745
|
-
default:
|
|
10746
|
-
return "center";
|
|
10747
|
-
}
|
|
10748
|
-
}
|
|
10749
|
-
function SortIndicator({
|
|
10750
|
-
direction,
|
|
10751
|
-
className
|
|
10752
|
-
}) {
|
|
10753
|
-
return /* @__PURE__ */ jsx(
|
|
10754
|
-
"span",
|
|
10755
|
-
{
|
|
10756
|
-
"aria-hidden": "true",
|
|
10757
|
-
className: cn(
|
|
10758
|
-
className,
|
|
10759
|
-
direction === "desc" && "rotate-180",
|
|
10760
|
-
(!direction || direction === "none") && "opacity-45"
|
|
10761
|
-
),
|
|
10762
|
-
children: "\u25B2"
|
|
10763
|
-
}
|
|
10764
|
-
);
|
|
10765
|
-
}
|
|
10766
|
-
function DragHandleIcon() {
|
|
10767
|
-
return /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "grid gap-0.5", children: [
|
|
10768
|
-
/* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
|
|
10769
|
-
/* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
|
|
10770
|
-
/* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" })
|
|
10771
|
-
] });
|
|
10772
|
-
}
|
|
10773
|
-
forwardRef(function BaseTableHead2({
|
|
10774
|
-
columnId,
|
|
10775
|
-
align,
|
|
10776
|
-
verticalAlign,
|
|
10777
|
-
icon,
|
|
10778
|
-
label,
|
|
10779
|
-
description,
|
|
10780
|
-
meta,
|
|
10781
|
-
actions,
|
|
10782
|
-
trailing,
|
|
10783
|
-
sortable,
|
|
10784
|
-
sortDirection = "none",
|
|
10785
|
-
sortLabel,
|
|
10786
|
-
onSort,
|
|
10787
|
-
draggable,
|
|
10788
|
-
dragLabel,
|
|
10789
|
-
resizable,
|
|
10790
|
-
resizeLabel,
|
|
10791
|
-
width,
|
|
10792
|
-
minWidth,
|
|
10793
|
-
maxWidth,
|
|
10794
|
-
appearance,
|
|
10795
|
-
className,
|
|
10796
|
-
classNames,
|
|
10797
|
-
style,
|
|
10798
|
-
children,
|
|
10799
|
-
onDragOver,
|
|
10800
|
-
onDrop,
|
|
10801
|
-
...headProps
|
|
10802
|
-
}, forwardedRef) {
|
|
10803
|
-
const tableContext = useBaseTableContext(appearance);
|
|
10804
|
-
const { theme } = tableContext;
|
|
10805
|
-
const isSplitScroll = tableContext.layout === "split-scroll";
|
|
10806
|
-
const resolvedAlign = align ?? (isSplitScroll ? "center" : "left");
|
|
10807
|
-
const resolvedVerticalAlign = verticalAlign ?? "middle";
|
|
10808
|
-
const headRef = useRef(null);
|
|
10809
|
-
const setHeadRef = (node) => {
|
|
10810
|
-
headRef.current = node;
|
|
10811
|
-
if (typeof forwardedRef === "function") {
|
|
10812
|
-
forwardedRef(node);
|
|
10813
|
-
} else if (forwardedRef) {
|
|
10814
|
-
forwardedRef.current = node;
|
|
10815
|
-
}
|
|
10816
|
-
};
|
|
10817
|
-
const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
|
|
10818
|
-
const canDrag = Boolean(
|
|
10819
|
-
columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
|
|
10820
|
-
);
|
|
10821
|
-
const canResize = Boolean(
|
|
10822
|
-
columnId && resizable !== false && (resizable || tableContext.columnResizeEnabled) && tableContext.onColumnSizeChange
|
|
10823
|
-
);
|
|
10824
|
-
const interactiveSort = Boolean(sortable || onSort);
|
|
10825
|
-
const ariaSort = sortAriaValue(sortDirection);
|
|
10826
|
-
const content = hasRenderableNode(label) ? label : children;
|
|
10827
|
-
const usesRichHeader = canDrag || hasRenderableNode(icon) || hasRenderableNode(label) || hasRenderableNode(description) || hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) || interactiveSort;
|
|
10828
|
-
const renderedContent = usesRichHeader ? /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadContent, classNames?.content), children: [
|
|
10829
|
-
/* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadMain, classNames?.main), children: [
|
|
10830
|
-
canDrag ? /* @__PURE__ */ jsx(
|
|
10831
|
-
"button",
|
|
10832
|
-
{
|
|
10833
|
-
type: "button",
|
|
10834
|
-
draggable: true,
|
|
10835
|
-
title: dragLabel,
|
|
10836
|
-
"aria-label": dragLabel ?? `Drag column ${columnId}`,
|
|
10837
|
-
className: cn(theme.slots.tableHeadDragHandle, classNames?.dragHandle),
|
|
10838
|
-
onClick: (event) => event.stopPropagation(),
|
|
10839
|
-
onDragStart: (event) => {
|
|
10840
|
-
event.stopPropagation();
|
|
10841
|
-
tableContext.setDraggingColumnId(columnId);
|
|
10842
|
-
event.dataTransfer.effectAllowed = "move";
|
|
10843
|
-
event.dataTransfer.setData(DATA_TRANSFER_COLUMN_TYPE, columnId);
|
|
10844
|
-
},
|
|
10845
|
-
onDragEnd: (event) => {
|
|
10846
|
-
event.stopPropagation();
|
|
10847
|
-
tableContext.setDraggingColumnId(void 0);
|
|
10848
|
-
},
|
|
10849
|
-
children: /* @__PURE__ */ jsx(DragHandleIcon, {})
|
|
10850
|
-
}
|
|
10851
|
-
) : null,
|
|
10852
|
-
icon ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadIcon, classNames?.icon), children: icon }) : null,
|
|
10853
|
-
interactiveSort ? /* @__PURE__ */ jsxs(
|
|
10854
|
-
"button",
|
|
10855
|
-
{
|
|
10856
|
-
type: "button",
|
|
10857
|
-
disabled: !onSort,
|
|
10858
|
-
title: sortLabel,
|
|
10859
|
-
className: cn(theme.slots.tableHeadSortButton, classNames?.sortButton),
|
|
10860
|
-
onClick: (event) => {
|
|
10861
|
-
event.stopPropagation();
|
|
10862
|
-
onSort?.(columnId);
|
|
10863
|
-
},
|
|
10864
|
-
children: [
|
|
10865
|
-
/* @__PURE__ */ jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
|
|
10866
|
-
hasRenderableNode(content) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
|
|
10867
|
-
hasRenderableNode(description) ? /* @__PURE__ */ jsx(
|
|
10868
|
-
"span",
|
|
10869
|
-
{
|
|
10870
|
-
className: cn(
|
|
10871
|
-
theme.slots.tableHeadDescription,
|
|
10872
|
-
classNames?.description
|
|
10873
|
-
),
|
|
10874
|
-
children: description
|
|
10875
|
-
}
|
|
10876
|
-
) : null
|
|
10877
|
-
] }),
|
|
10878
|
-
/* @__PURE__ */ jsx(
|
|
10879
|
-
SortIndicator,
|
|
10880
|
-
{
|
|
10881
|
-
direction: sortDirection,
|
|
10882
|
-
className: cn(theme.slots.tableHeadSortIcon, classNames?.sortIcon)
|
|
10883
|
-
}
|
|
10884
|
-
)
|
|
10885
|
-
]
|
|
10886
|
-
}
|
|
10887
|
-
) : /* @__PURE__ */ jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
|
|
10888
|
-
hasRenderableNode(content) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
|
|
10889
|
-
hasRenderableNode(description) ? /* @__PURE__ */ jsx(
|
|
10890
|
-
"span",
|
|
10891
|
-
{
|
|
10892
|
-
className: cn(
|
|
10893
|
-
theme.slots.tableHeadDescription,
|
|
10894
|
-
classNames?.description
|
|
10895
|
-
),
|
|
10896
|
-
children: description
|
|
10897
|
-
}
|
|
10898
|
-
) : null
|
|
10899
|
-
] })
|
|
10900
|
-
] }),
|
|
10901
|
-
hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) ? /* @__PURE__ */ jsxs("div", { className: cn(theme.slots.tableHeadActions, classNames?.actions), children: [
|
|
10902
|
-
hasRenderableNode(meta) ? /* @__PURE__ */ jsx("span", { className: cn(theme.slots.tableHeadMeta, classNames?.meta), children: meta }) : null,
|
|
10903
|
-
actions,
|
|
10904
|
-
trailing
|
|
10905
|
-
] }) : null
|
|
10906
|
-
] }) : children;
|
|
10907
|
-
const handleDragOver = (event) => {
|
|
10908
|
-
onDragOver?.(event);
|
|
10909
|
-
if (!canDrag || !tableContext.draggingColumnId || tableContext.draggingColumnId === columnId) {
|
|
10910
|
-
return;
|
|
10911
|
-
}
|
|
10912
|
-
event.preventDefault();
|
|
10913
|
-
event.dataTransfer.dropEffect = "move";
|
|
10914
|
-
};
|
|
10915
|
-
const handleDrop = (event) => {
|
|
10916
|
-
onDrop?.(event);
|
|
10917
|
-
if (!canDrag || !columnId) return;
|
|
10918
|
-
const sourceColumnId = tableContext.draggingColumnId || event.dataTransfer.getData(DATA_TRANSFER_COLUMN_TYPE);
|
|
10919
|
-
if (!sourceColumnId || sourceColumnId === columnId) return;
|
|
10920
|
-
const nextOrder = getNextColumnOrder(
|
|
10921
|
-
tableContext.columnOrder,
|
|
10922
|
-
sourceColumnId,
|
|
10923
|
-
columnId
|
|
10924
|
-
);
|
|
10925
|
-
if (nextOrder) {
|
|
10926
|
-
event.preventDefault();
|
|
10927
|
-
tableContext.onColumnOrderChange?.(nextOrder, {
|
|
10928
|
-
columnId: sourceColumnId,
|
|
10929
|
-
targetColumnId: columnId
|
|
10930
|
-
});
|
|
10931
|
-
}
|
|
10932
|
-
tableContext.setDraggingColumnId(void 0);
|
|
10933
|
-
};
|
|
10934
|
-
const handleResizePointerDown = (event) => {
|
|
10935
|
-
if (!canResize || !columnId || !tableContext.onColumnSizeChange) return;
|
|
10936
|
-
event.preventDefault();
|
|
10937
|
-
event.stopPropagation();
|
|
10938
|
-
const startX = event.clientX;
|
|
10939
|
-
const currentWidth = typeof controlledWidth === "number" ? controlledWidth : headRef.current?.offsetWidth ?? minWidth ?? 96;
|
|
10940
|
-
const previousWidth = clampWidth(currentWidth, minWidth, maxWidth);
|
|
10941
|
-
const pointerId = event.pointerId;
|
|
10942
|
-
const target = event.currentTarget;
|
|
10943
|
-
target.setPointerCapture?.(pointerId);
|
|
10944
|
-
const handlePointerMove = (moveEvent) => {
|
|
10945
|
-
const nextWidth = clampWidth(
|
|
10946
|
-
previousWidth + moveEvent.clientX - startX,
|
|
10947
|
-
minWidth,
|
|
10948
|
-
maxWidth
|
|
10949
|
-
);
|
|
10950
|
-
tableContext.onColumnSizeChange?.(columnId, nextWidth, {
|
|
10951
|
-
columnId,
|
|
10952
|
-
previousWidth,
|
|
10953
|
-
minWidth,
|
|
10954
|
-
maxWidth
|
|
10955
|
-
});
|
|
10956
|
-
};
|
|
10957
|
-
const cleanup = () => {
|
|
10958
|
-
target.releasePointerCapture?.(pointerId);
|
|
10959
|
-
window.removeEventListener("pointermove", handlePointerMove);
|
|
10960
|
-
window.removeEventListener("pointerup", cleanup);
|
|
10961
|
-
window.removeEventListener("pointercancel", cleanup);
|
|
10962
|
-
};
|
|
10963
|
-
window.addEventListener("pointermove", handlePointerMove);
|
|
10964
|
-
window.addEventListener("pointerup", cleanup);
|
|
10965
|
-
window.addEventListener("pointercancel", cleanup);
|
|
10966
|
-
};
|
|
10967
|
-
return /* @__PURE__ */ jsxs(
|
|
10968
|
-
"th",
|
|
10969
|
-
{
|
|
10970
|
-
...headProps,
|
|
10971
|
-
ref: setHeadRef,
|
|
10972
|
-
scope: headProps.scope ?? "col",
|
|
10973
|
-
"aria-sort": ariaSort,
|
|
10974
|
-
className: cn(
|
|
10975
|
-
theme.slots.tableHead,
|
|
10976
|
-
isSplitScroll && theme.slots.tableSplitHead,
|
|
10977
|
-
resolvedAlign === "center" && theme.slots.tableCellAlignCenter,
|
|
10978
|
-
resolvedAlign === "right" && theme.slots.tableCellAlignRight,
|
|
10979
|
-
classNames?.root,
|
|
10980
|
-
className
|
|
10981
|
-
),
|
|
10982
|
-
style: {
|
|
10983
|
-
...theme.styles.tableHead,
|
|
10984
|
-
...isSplitScroll ? theme.styles.tableSplitHead : void 0,
|
|
10985
|
-
width: isSplitScroll ? void 0 : toCssSize(controlledWidth),
|
|
10986
|
-
minWidth: isSplitScroll ? void 0 : toCssSize(minWidth),
|
|
10987
|
-
maxWidth: isSplitScroll ? void 0 : toCssSize(maxWidth),
|
|
10988
|
-
...isSplitScroll ? {
|
|
10989
|
-
alignItems: getSplitHeadAlignItems(resolvedVerticalAlign),
|
|
10990
|
-
justifyContent: getSplitHeadJustifyContent(resolvedAlign),
|
|
10991
|
-
textAlign: resolvedAlign
|
|
10992
|
-
} : verticalAlign ? { verticalAlign } : void 0,
|
|
10993
|
-
...style
|
|
10994
|
-
},
|
|
10995
|
-
onDragOver: handleDragOver,
|
|
10996
|
-
onDrop: handleDrop,
|
|
10997
|
-
children: [
|
|
10998
|
-
renderedContent,
|
|
10999
|
-
canResize ? /* @__PURE__ */ jsx(
|
|
11000
|
-
"button",
|
|
11001
|
-
{
|
|
11002
|
-
type: "button",
|
|
11003
|
-
title: resizeLabel,
|
|
11004
|
-
"aria-label": resizeLabel ?? `Resize column ${columnId}`,
|
|
11005
|
-
className: cn(theme.slots.tableHeadResizeHandle, classNames?.resizeHandle),
|
|
11006
|
-
onClick: (event) => event.stopPropagation(),
|
|
11007
|
-
onPointerDown: handleResizePointerDown
|
|
11008
|
-
}
|
|
11009
|
-
) : null
|
|
11010
|
-
]
|
|
11011
|
-
}
|
|
11012
|
-
);
|
|
11013
|
-
});
|
|
11014
|
-
forwardRef(
|
|
11015
|
-
function BaseTextarea2({
|
|
11016
|
-
invalid = false,
|
|
11017
|
-
disabled = false,
|
|
11018
|
-
readOnly = false,
|
|
11019
|
-
appearance,
|
|
11020
|
-
className,
|
|
11021
|
-
classNames,
|
|
11022
|
-
style,
|
|
11023
|
-
"aria-invalid": nativeAriaInvalid,
|
|
11024
|
-
...textareaProps
|
|
11025
|
-
}, ref) {
|
|
11026
|
-
const theme = resolveBaseAppearance(appearance);
|
|
11027
|
-
return /* @__PURE__ */ jsx(
|
|
11028
|
-
"textarea",
|
|
11029
|
-
{
|
|
11030
|
-
...textareaProps,
|
|
11031
|
-
ref,
|
|
11032
|
-
disabled,
|
|
11033
|
-
readOnly,
|
|
11034
|
-
"aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
|
|
11035
|
-
className: cn(
|
|
11036
|
-
theme.slots.controlWrapper,
|
|
11037
|
-
theme.slots.controlBase,
|
|
11038
|
-
theme.slots.controlTextarea,
|
|
11039
|
-
invalid && theme.slots.controlInvalid,
|
|
11040
|
-
disabled && theme.slots.controlDisabled,
|
|
11041
|
-
readOnly && theme.slots.controlReadOnly,
|
|
11042
|
-
classNames?.control,
|
|
11043
|
-
className
|
|
11044
|
-
),
|
|
11045
|
-
style: {
|
|
11046
|
-
...theme.styles.control,
|
|
11047
|
-
...invalid ? theme.styles.controlInvalid : void 0,
|
|
11048
|
-
...disabled ? theme.styles.controlDisabled : void 0,
|
|
11049
|
-
...style
|
|
11050
|
-
}
|
|
11051
|
-
}
|
|
11052
|
-
);
|
|
11053
|
-
}
|
|
11054
|
-
);
|
|
11055
7121
|
|
|
11056
7122
|
// src/components/data-explorer/utils.ts
|
|
11057
7123
|
function cn2(...parts) {
|
|
@@ -11077,7 +7143,7 @@ var baseSlots2 = {
|
|
|
11077
7143
|
actionButtonBase: "inline-flex h-9 items-center justify-center gap-2 rounded-md border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
11078
7144
|
actionButtonDefault: "border-border bg-background text-foreground hover:bg-accent/60",
|
|
11079
7145
|
actionButtonPrimary: "border-primary/20 bg-primary/10 text-primary hover:bg-primary/15",
|
|
11080
|
-
actionButtonDanger: "border-destructive/20 bg-destructive/10 text-destructive hover:bg-destructive/15",
|
|
7146
|
+
actionButtonDanger: "border-destructive/20 bg-destructive/10 text-destructive-text hover:bg-destructive/15",
|
|
11081
7147
|
actionButtonMuted: "border-border/60 bg-muted/45 text-muted-foreground hover:bg-muted/70 hover:text-foreground",
|
|
11082
7148
|
actionButtonActive: "ring-1 ring-primary/30",
|
|
11083
7149
|
actionButtonDisabled: "cursor-not-allowed opacity-60",
|
|
@@ -11097,7 +7163,7 @@ var baseSlots2 = {
|
|
|
11097
7163
|
menuSeparator: "-mx-1 my-1 h-px bg-border",
|
|
11098
7164
|
menuItem: "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
11099
7165
|
menuItemPrimary: "text-primary focus:text-primary",
|
|
11100
|
-
menuItemDanger: "text-destructive focus:text-destructive",
|
|
7166
|
+
menuItemDanger: "text-destructive-text focus:text-destructive-text",
|
|
11101
7167
|
menuItemMuted: "text-muted-foreground",
|
|
11102
7168
|
menuItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
|
|
11103
7169
|
menuItemLabel: "truncate",
|
|
@@ -11152,7 +7218,7 @@ var baseSlots2 = {
|
|
|
11152
7218
|
treeNodeChildren: "mt-0.5 min-w-0 space-y-0.5",
|
|
11153
7219
|
treeNodeDragHandle: "inline-flex h-5 w-5 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground active:cursor-grabbing group-hover/tree-node:opacity-100",
|
|
11154
7220
|
treeEmpty: "px-3 py-2 text-xs text-muted-foreground",
|
|
11155
|
-
treeError: "px-3 py-2 text-xs text-destructive",
|
|
7221
|
+
treeError: "px-3 py-2 text-xs text-destructive-text",
|
|
11156
7222
|
treeLoading: "px-3 py-2 text-xs text-muted-foreground"
|
|
11157
7223
|
};
|
|
11158
7224
|
var densitySlots2 = {
|
|
@@ -11546,110 +7612,6 @@ function resolveDataExplorerAppearance(appearance) {
|
|
|
11546
7612
|
)
|
|
11547
7613
|
};
|
|
11548
7614
|
}
|
|
11549
|
-
function getDataExplorerActionToneClassName(theme, tone, active) {
|
|
11550
|
-
return cn2(
|
|
11551
|
-
tone === "primary" ? theme.slots.actionButtonPrimary : tone === "danger" ? theme.slots.actionButtonDanger : tone === "muted" ? theme.slots.actionButtonMuted : theme.slots.actionButtonDefault,
|
|
11552
|
-
active && theme.slots.actionButtonActive
|
|
11553
|
-
);
|
|
11554
|
-
}
|
|
11555
|
-
function LoadingIcon2() {
|
|
11556
|
-
return /* @__PURE__ */ jsxs(
|
|
11557
|
-
"svg",
|
|
11558
|
-
{
|
|
11559
|
-
"aria-hidden": "true",
|
|
11560
|
-
viewBox: "0 0 24 24",
|
|
11561
|
-
className: "h-4 w-4 animate-spin",
|
|
11562
|
-
fill: "none",
|
|
11563
|
-
children: [
|
|
11564
|
-
/* @__PURE__ */ jsx(
|
|
11565
|
-
"circle",
|
|
11566
|
-
{
|
|
11567
|
-
cx: "12",
|
|
11568
|
-
cy: "12",
|
|
11569
|
-
r: "9",
|
|
11570
|
-
className: "opacity-25",
|
|
11571
|
-
stroke: "currentColor",
|
|
11572
|
-
strokeWidth: "3"
|
|
11573
|
-
}
|
|
11574
|
-
),
|
|
11575
|
-
/* @__PURE__ */ jsx(
|
|
11576
|
-
"path",
|
|
11577
|
-
{
|
|
11578
|
-
className: "opacity-75",
|
|
11579
|
-
fill: "currentColor",
|
|
11580
|
-
d: "M12 3a9 9 0 0 1 9 9h-3a6 6 0 0 0-6-6V3Z"
|
|
11581
|
-
}
|
|
11582
|
-
)
|
|
11583
|
-
]
|
|
11584
|
-
}
|
|
11585
|
-
);
|
|
11586
|
-
}
|
|
11587
|
-
forwardRef(function DataExplorerButton2({
|
|
11588
|
-
children,
|
|
11589
|
-
label,
|
|
11590
|
-
icon,
|
|
11591
|
-
endIcon,
|
|
11592
|
-
type = "button",
|
|
11593
|
-
title,
|
|
11594
|
-
ariaLabel,
|
|
11595
|
-
tone,
|
|
11596
|
-
active = false,
|
|
11597
|
-
iconOnly = false,
|
|
11598
|
-
disabled = false,
|
|
11599
|
-
loading = false,
|
|
11600
|
-
stopPropagation = false,
|
|
11601
|
-
appearance,
|
|
11602
|
-
className,
|
|
11603
|
-
classNames,
|
|
11604
|
-
style,
|
|
11605
|
-
onClick,
|
|
11606
|
-
"aria-label": nativeAriaLabel,
|
|
11607
|
-
...buttonProps
|
|
11608
|
-
}, ref) {
|
|
11609
|
-
const theme = resolveDataExplorerAppearance(appearance);
|
|
11610
|
-
const resolvedLabel = children ?? label;
|
|
11611
|
-
const resolvedDisabled = disabled || loading;
|
|
11612
|
-
const handleClick = (event) => {
|
|
11613
|
-
if (stopPropagation) {
|
|
11614
|
-
event.stopPropagation();
|
|
11615
|
-
}
|
|
11616
|
-
if (resolvedDisabled) return;
|
|
11617
|
-
onClick?.(event);
|
|
11618
|
-
};
|
|
11619
|
-
return /* @__PURE__ */ jsxs(
|
|
11620
|
-
"button",
|
|
11621
|
-
{
|
|
11622
|
-
...buttonProps,
|
|
11623
|
-
ref,
|
|
11624
|
-
type,
|
|
11625
|
-
title,
|
|
11626
|
-
"aria-label": ariaLabel ?? nativeAriaLabel,
|
|
11627
|
-
"aria-pressed": active || void 0,
|
|
11628
|
-
"aria-busy": loading || void 0,
|
|
11629
|
-
disabled: resolvedDisabled,
|
|
11630
|
-
className: cn2(
|
|
11631
|
-
theme.slots.controlButton,
|
|
11632
|
-
iconOnly && theme.slots.actionIconButton,
|
|
11633
|
-
getDataExplorerActionToneClassName(theme, tone, active),
|
|
11634
|
-
resolvedDisabled && theme.slots.actionButtonDisabled,
|
|
11635
|
-
classNames?.root,
|
|
11636
|
-
className
|
|
11637
|
-
),
|
|
11638
|
-
style: {
|
|
11639
|
-
...theme.styles.control,
|
|
11640
|
-
...active ? theme.styles.controlActive : void 0,
|
|
11641
|
-
...resolvedDisabled ? theme.styles.controlDisabled : void 0,
|
|
11642
|
-
...style
|
|
11643
|
-
},
|
|
11644
|
-
onClick: handleClick,
|
|
11645
|
-
children: [
|
|
11646
|
-
loading ? /* @__PURE__ */ jsx("span", { className: cn2(theme.slots.controlButtonIcon, classNames?.icon), children: /* @__PURE__ */ jsx(LoadingIcon2, {}) }) : icon ? /* @__PURE__ */ jsx("span", { className: cn2(theme.slots.controlButtonIcon, classNames?.icon), children: icon }) : null,
|
|
11647
|
-
iconOnly ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: resolvedLabel }) : resolvedLabel ? /* @__PURE__ */ jsx("span", { className: cn2(theme.slots.controlButtonLabel, classNames?.label), children: resolvedLabel }) : null,
|
|
11648
|
-
endIcon ? /* @__PURE__ */ jsx("span", { className: cn2(theme.slots.controlButtonIcon, classNames?.icon), children: endIcon }) : null
|
|
11649
|
-
]
|
|
11650
|
-
}
|
|
11651
|
-
);
|
|
11652
|
-
});
|
|
11653
7615
|
|
|
11654
7616
|
// src/theme-system/resolve-theme.ts
|
|
11655
7617
|
var DEFAULT_THEME_ID = "default";
|