1
This commit is contained in:
869
package/component/es/_chunks/@ctrl/index.js
Normal file
869
package/component/es/_chunks/@ctrl/index.js
Normal file
@@ -0,0 +1,869 @@
|
||||
function bound01(n, max) {
|
||||
if (isOnePointZero(n)) {
|
||||
n = "100%";
|
||||
}
|
||||
var isPercent = isPercentage(n);
|
||||
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
||||
if (isPercent) {
|
||||
n = parseInt(String(n * max), 10) / 100;
|
||||
}
|
||||
if (Math.abs(n - max) < 1e-6) {
|
||||
return 1;
|
||||
}
|
||||
if (max === 360) {
|
||||
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
|
||||
} else {
|
||||
n = n % max / parseFloat(String(max));
|
||||
}
|
||||
return n;
|
||||
}
|
||||
function clamp01(val) {
|
||||
return Math.min(1, Math.max(0, val));
|
||||
}
|
||||
function isOnePointZero(n) {
|
||||
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
|
||||
}
|
||||
function isPercentage(n) {
|
||||
return typeof n === "string" && n.indexOf("%") !== -1;
|
||||
}
|
||||
function boundAlpha(a) {
|
||||
a = parseFloat(a);
|
||||
if (isNaN(a) || a < 0 || a > 1) {
|
||||
a = 1;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
function convertToPercentage(n) {
|
||||
if (n <= 1) {
|
||||
return "".concat(Number(n) * 100, "%");
|
||||
}
|
||||
return n;
|
||||
}
|
||||
function pad2(c) {
|
||||
return c.length === 1 ? "0" + c : String(c);
|
||||
}
|
||||
function rgbToRgb(r, g, b) {
|
||||
return {
|
||||
r: bound01(r, 255) * 255,
|
||||
g: bound01(g, 255) * 255,
|
||||
b: bound01(b, 255) * 255
|
||||
};
|
||||
}
|
||||
function rgbToHsl(r, g, b) {
|
||||
r = bound01(r, 255);
|
||||
g = bound01(g, 255);
|
||||
b = bound01(b, 255);
|
||||
var max = Math.max(r, g, b);
|
||||
var min = Math.min(r, g, b);
|
||||
var h = 0;
|
||||
var s = 0;
|
||||
var l = (max + min) / 2;
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
h = 0;
|
||||
} else {
|
||||
var d = max - min;
|
||||
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
||||
switch (max) {
|
||||
case r:
|
||||
h = (g - b) / d + (g < b ? 6 : 0);
|
||||
break;
|
||||
case g:
|
||||
h = (b - r) / d + 2;
|
||||
break;
|
||||
case b:
|
||||
h = (r - g) / d + 4;
|
||||
break;
|
||||
}
|
||||
h /= 6;
|
||||
}
|
||||
return { h, s, l };
|
||||
}
|
||||
function hue2rgb(p, q, t) {
|
||||
if (t < 0) {
|
||||
t += 1;
|
||||
}
|
||||
if (t > 1) {
|
||||
t -= 1;
|
||||
}
|
||||
if (t < 1 / 6) {
|
||||
return p + (q - p) * (6 * t);
|
||||
}
|
||||
if (t < 1 / 2) {
|
||||
return q;
|
||||
}
|
||||
if (t < 2 / 3) {
|
||||
return p + (q - p) * (2 / 3 - t) * 6;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
function hslToRgb(h, s, l) {
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
h = bound01(h, 360);
|
||||
s = bound01(s, 100);
|
||||
l = bound01(l, 100);
|
||||
if (s === 0) {
|
||||
g = l;
|
||||
b = l;
|
||||
r = l;
|
||||
} else {
|
||||
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
||||
var p = 2 * l - q;
|
||||
r = hue2rgb(p, q, h + 1 / 3);
|
||||
g = hue2rgb(p, q, h);
|
||||
b = hue2rgb(p, q, h - 1 / 3);
|
||||
}
|
||||
return { r: r * 255, g: g * 255, b: b * 255 };
|
||||
}
|
||||
function rgbToHsv(r, g, b) {
|
||||
r = bound01(r, 255);
|
||||
g = bound01(g, 255);
|
||||
b = bound01(b, 255);
|
||||
var max = Math.max(r, g, b);
|
||||
var min = Math.min(r, g, b);
|
||||
var h = 0;
|
||||
var v = max;
|
||||
var d = max - min;
|
||||
var s = max === 0 ? 0 : d / max;
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else {
|
||||
switch (max) {
|
||||
case r:
|
||||
h = (g - b) / d + (g < b ? 6 : 0);
|
||||
break;
|
||||
case g:
|
||||
h = (b - r) / d + 2;
|
||||
break;
|
||||
case b:
|
||||
h = (r - g) / d + 4;
|
||||
break;
|
||||
}
|
||||
h /= 6;
|
||||
}
|
||||
return { h, s, v };
|
||||
}
|
||||
function hsvToRgb(h, s, v) {
|
||||
h = bound01(h, 360) * 6;
|
||||
s = bound01(s, 100);
|
||||
v = bound01(v, 100);
|
||||
var i = Math.floor(h);
|
||||
var f = h - i;
|
||||
var p = v * (1 - s);
|
||||
var q = v * (1 - f * s);
|
||||
var t = v * (1 - (1 - f) * s);
|
||||
var mod = i % 6;
|
||||
var r = [v, q, p, p, t, v][mod];
|
||||
var g = [t, v, v, q, p, p][mod];
|
||||
var b = [p, p, t, v, v, q][mod];
|
||||
return { r: r * 255, g: g * 255, b: b * 255 };
|
||||
}
|
||||
function rgbToHex(r, g, b, allow3Char) {
|
||||
var hex = [
|
||||
pad2(Math.round(r).toString(16)),
|
||||
pad2(Math.round(g).toString(16)),
|
||||
pad2(Math.round(b).toString(16))
|
||||
];
|
||||
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
|
||||
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
||||
}
|
||||
return hex.join("");
|
||||
}
|
||||
function rgbaToHex(r, g, b, a, allow4Char) {
|
||||
var hex = [
|
||||
pad2(Math.round(r).toString(16)),
|
||||
pad2(Math.round(g).toString(16)),
|
||||
pad2(Math.round(b).toString(16)),
|
||||
pad2(convertDecimalToHex(a))
|
||||
];
|
||||
if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
|
||||
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
||||
}
|
||||
return hex.join("");
|
||||
}
|
||||
function convertDecimalToHex(d) {
|
||||
return Math.round(parseFloat(d) * 255).toString(16);
|
||||
}
|
||||
function convertHexToDecimal(h) {
|
||||
return parseIntFromHex(h) / 255;
|
||||
}
|
||||
function parseIntFromHex(val) {
|
||||
return parseInt(val, 16);
|
||||
}
|
||||
function numberInputToObject(color) {
|
||||
return {
|
||||
r: color >> 16,
|
||||
g: (color & 65280) >> 8,
|
||||
b: color & 255
|
||||
};
|
||||
}
|
||||
var names = {
|
||||
aliceblue: "#f0f8ff",
|
||||
antiquewhite: "#faebd7",
|
||||
aqua: "#00ffff",
|
||||
aquamarine: "#7fffd4",
|
||||
azure: "#f0ffff",
|
||||
beige: "#f5f5dc",
|
||||
bisque: "#ffe4c4",
|
||||
black: "#000000",
|
||||
blanchedalmond: "#ffebcd",
|
||||
blue: "#0000ff",
|
||||
blueviolet: "#8a2be2",
|
||||
brown: "#a52a2a",
|
||||
burlywood: "#deb887",
|
||||
cadetblue: "#5f9ea0",
|
||||
chartreuse: "#7fff00",
|
||||
chocolate: "#d2691e",
|
||||
coral: "#ff7f50",
|
||||
cornflowerblue: "#6495ed",
|
||||
cornsilk: "#fff8dc",
|
||||
crimson: "#dc143c",
|
||||
cyan: "#00ffff",
|
||||
darkblue: "#00008b",
|
||||
darkcyan: "#008b8b",
|
||||
darkgoldenrod: "#b8860b",
|
||||
darkgray: "#a9a9a9",
|
||||
darkgreen: "#006400",
|
||||
darkgrey: "#a9a9a9",
|
||||
darkkhaki: "#bdb76b",
|
||||
darkmagenta: "#8b008b",
|
||||
darkolivegreen: "#556b2f",
|
||||
darkorange: "#ff8c00",
|
||||
darkorchid: "#9932cc",
|
||||
darkred: "#8b0000",
|
||||
darksalmon: "#e9967a",
|
||||
darkseagreen: "#8fbc8f",
|
||||
darkslateblue: "#483d8b",
|
||||
darkslategray: "#2f4f4f",
|
||||
darkslategrey: "#2f4f4f",
|
||||
darkturquoise: "#00ced1",
|
||||
darkviolet: "#9400d3",
|
||||
deeppink: "#ff1493",
|
||||
deepskyblue: "#00bfff",
|
||||
dimgray: "#696969",
|
||||
dimgrey: "#696969",
|
||||
dodgerblue: "#1e90ff",
|
||||
firebrick: "#b22222",
|
||||
floralwhite: "#fffaf0",
|
||||
forestgreen: "#228b22",
|
||||
fuchsia: "#ff00ff",
|
||||
gainsboro: "#dcdcdc",
|
||||
ghostwhite: "#f8f8ff",
|
||||
goldenrod: "#daa520",
|
||||
gold: "#ffd700",
|
||||
gray: "#808080",
|
||||
green: "#008000",
|
||||
greenyellow: "#adff2f",
|
||||
grey: "#808080",
|
||||
honeydew: "#f0fff0",
|
||||
hotpink: "#ff69b4",
|
||||
indianred: "#cd5c5c",
|
||||
indigo: "#4b0082",
|
||||
ivory: "#fffff0",
|
||||
khaki: "#f0e68c",
|
||||
lavenderblush: "#fff0f5",
|
||||
lavender: "#e6e6fa",
|
||||
lawngreen: "#7cfc00",
|
||||
lemonchiffon: "#fffacd",
|
||||
lightblue: "#add8e6",
|
||||
lightcoral: "#f08080",
|
||||
lightcyan: "#e0ffff",
|
||||
lightgoldenrodyellow: "#fafad2",
|
||||
lightgray: "#d3d3d3",
|
||||
lightgreen: "#90ee90",
|
||||
lightgrey: "#d3d3d3",
|
||||
lightpink: "#ffb6c1",
|
||||
lightsalmon: "#ffa07a",
|
||||
lightseagreen: "#20b2aa",
|
||||
lightskyblue: "#87cefa",
|
||||
lightslategray: "#778899",
|
||||
lightslategrey: "#778899",
|
||||
lightsteelblue: "#b0c4de",
|
||||
lightyellow: "#ffffe0",
|
||||
lime: "#00ff00",
|
||||
limegreen: "#32cd32",
|
||||
linen: "#faf0e6",
|
||||
magenta: "#ff00ff",
|
||||
maroon: "#800000",
|
||||
mediumaquamarine: "#66cdaa",
|
||||
mediumblue: "#0000cd",
|
||||
mediumorchid: "#ba55d3",
|
||||
mediumpurple: "#9370db",
|
||||
mediumseagreen: "#3cb371",
|
||||
mediumslateblue: "#7b68ee",
|
||||
mediumspringgreen: "#00fa9a",
|
||||
mediumturquoise: "#48d1cc",
|
||||
mediumvioletred: "#c71585",
|
||||
midnightblue: "#191970",
|
||||
mintcream: "#f5fffa",
|
||||
mistyrose: "#ffe4e1",
|
||||
moccasin: "#ffe4b5",
|
||||
navajowhite: "#ffdead",
|
||||
navy: "#000080",
|
||||
oldlace: "#fdf5e6",
|
||||
olive: "#808000",
|
||||
olivedrab: "#6b8e23",
|
||||
orange: "#ffa500",
|
||||
orangered: "#ff4500",
|
||||
orchid: "#da70d6",
|
||||
palegoldenrod: "#eee8aa",
|
||||
palegreen: "#98fb98",
|
||||
paleturquoise: "#afeeee",
|
||||
palevioletred: "#db7093",
|
||||
papayawhip: "#ffefd5",
|
||||
peachpuff: "#ffdab9",
|
||||
peru: "#cd853f",
|
||||
pink: "#ffc0cb",
|
||||
plum: "#dda0dd",
|
||||
powderblue: "#b0e0e6",
|
||||
purple: "#800080",
|
||||
rebeccapurple: "#663399",
|
||||
red: "#ff0000",
|
||||
rosybrown: "#bc8f8f",
|
||||
royalblue: "#4169e1",
|
||||
saddlebrown: "#8b4513",
|
||||
salmon: "#fa8072",
|
||||
sandybrown: "#f4a460",
|
||||
seagreen: "#2e8b57",
|
||||
seashell: "#fff5ee",
|
||||
sienna: "#a0522d",
|
||||
silver: "#c0c0c0",
|
||||
skyblue: "#87ceeb",
|
||||
slateblue: "#6a5acd",
|
||||
slategray: "#708090",
|
||||
slategrey: "#708090",
|
||||
snow: "#fffafa",
|
||||
springgreen: "#00ff7f",
|
||||
steelblue: "#4682b4",
|
||||
tan: "#d2b48c",
|
||||
teal: "#008080",
|
||||
thistle: "#d8bfd8",
|
||||
tomato: "#ff6347",
|
||||
turquoise: "#40e0d0",
|
||||
violet: "#ee82ee",
|
||||
wheat: "#f5deb3",
|
||||
white: "#ffffff",
|
||||
whitesmoke: "#f5f5f5",
|
||||
yellow: "#ffff00",
|
||||
yellowgreen: "#9acd32"
|
||||
};
|
||||
function inputToRGB(color) {
|
||||
var rgb = { r: 0, g: 0, b: 0 };
|
||||
var a = 1;
|
||||
var s = null;
|
||||
var v = null;
|
||||
var l = null;
|
||||
var ok = false;
|
||||
var format = false;
|
||||
if (typeof color === "string") {
|
||||
color = stringInputToObject(color);
|
||||
}
|
||||
if (typeof color === "object") {
|
||||
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
||||
rgb = rgbToRgb(color.r, color.g, color.b);
|
||||
ok = true;
|
||||
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
||||
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
||||
s = convertToPercentage(color.s);
|
||||
v = convertToPercentage(color.v);
|
||||
rgb = hsvToRgb(color.h, s, v);
|
||||
ok = true;
|
||||
format = "hsv";
|
||||
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
||||
s = convertToPercentage(color.s);
|
||||
l = convertToPercentage(color.l);
|
||||
rgb = hslToRgb(color.h, s, l);
|
||||
ok = true;
|
||||
format = "hsl";
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(color, "a")) {
|
||||
a = color.a;
|
||||
}
|
||||
}
|
||||
a = boundAlpha(a);
|
||||
return {
|
||||
ok,
|
||||
format: color.format || format,
|
||||
r: Math.min(255, Math.max(rgb.r, 0)),
|
||||
g: Math.min(255, Math.max(rgb.g, 0)),
|
||||
b: Math.min(255, Math.max(rgb.b, 0)),
|
||||
a
|
||||
};
|
||||
}
|
||||
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
||||
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
||||
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
|
||||
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
||||
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
||||
var matchers = {
|
||||
CSS_UNIT: new RegExp(CSS_UNIT),
|
||||
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
||||
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
||||
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
||||
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
||||
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
||||
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
||||
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
||||
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
||||
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
||||
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
||||
};
|
||||
function stringInputToObject(color) {
|
||||
color = color.trim().toLowerCase();
|
||||
if (color.length === 0) {
|
||||
return false;
|
||||
}
|
||||
var named = false;
|
||||
if (names[color]) {
|
||||
color = names[color];
|
||||
named = true;
|
||||
} else if (color === "transparent") {
|
||||
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
||||
}
|
||||
var match = matchers.rgb.exec(color);
|
||||
if (match) {
|
||||
return { r: match[1], g: match[2], b: match[3] };
|
||||
}
|
||||
match = matchers.rgba.exec(color);
|
||||
if (match) {
|
||||
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
||||
}
|
||||
match = matchers.hsl.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], l: match[3] };
|
||||
}
|
||||
match = matchers.hsla.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
||||
}
|
||||
match = matchers.hsv.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], v: match[3] };
|
||||
}
|
||||
match = matchers.hsva.exec(color);
|
||||
if (match) {
|
||||
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
||||
}
|
||||
match = matchers.hex8.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1]),
|
||||
g: parseIntFromHex(match[2]),
|
||||
b: parseIntFromHex(match[3]),
|
||||
a: convertHexToDecimal(match[4]),
|
||||
format: named ? "name" : "hex8"
|
||||
};
|
||||
}
|
||||
match = matchers.hex6.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1]),
|
||||
g: parseIntFromHex(match[2]),
|
||||
b: parseIntFromHex(match[3]),
|
||||
format: named ? "name" : "hex"
|
||||
};
|
||||
}
|
||||
match = matchers.hex4.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1] + match[1]),
|
||||
g: parseIntFromHex(match[2] + match[2]),
|
||||
b: parseIntFromHex(match[3] + match[3]),
|
||||
a: convertHexToDecimal(match[4] + match[4]),
|
||||
format: named ? "name" : "hex8"
|
||||
};
|
||||
}
|
||||
match = matchers.hex3.exec(color);
|
||||
if (match) {
|
||||
return {
|
||||
r: parseIntFromHex(match[1] + match[1]),
|
||||
g: parseIntFromHex(match[2] + match[2]),
|
||||
b: parseIntFromHex(match[3] + match[3]),
|
||||
format: named ? "name" : "hex"
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isValidCSSUnit(color) {
|
||||
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
||||
}
|
||||
var TinyColor = function() {
|
||||
function TinyColor2(color, opts) {
|
||||
if (color === void 0) {
|
||||
color = "";
|
||||
}
|
||||
if (opts === void 0) {
|
||||
opts = {};
|
||||
}
|
||||
var _a;
|
||||
if (color instanceof TinyColor2) {
|
||||
return color;
|
||||
}
|
||||
if (typeof color === "number") {
|
||||
color = numberInputToObject(color);
|
||||
}
|
||||
this.originalInput = color;
|
||||
var rgb = inputToRGB(color);
|
||||
this.originalInput = color;
|
||||
this.r = rgb.r;
|
||||
this.g = rgb.g;
|
||||
this.b = rgb.b;
|
||||
this.a = rgb.a;
|
||||
this.roundA = Math.round(100 * this.a) / 100;
|
||||
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
|
||||
this.gradientType = opts.gradientType;
|
||||
if (this.r < 1) {
|
||||
this.r = Math.round(this.r);
|
||||
}
|
||||
if (this.g < 1) {
|
||||
this.g = Math.round(this.g);
|
||||
}
|
||||
if (this.b < 1) {
|
||||
this.b = Math.round(this.b);
|
||||
}
|
||||
this.isValid = rgb.ok;
|
||||
}
|
||||
TinyColor2.prototype.isDark = function() {
|
||||
return this.getBrightness() < 128;
|
||||
};
|
||||
TinyColor2.prototype.isLight = function() {
|
||||
return !this.isDark();
|
||||
};
|
||||
TinyColor2.prototype.getBrightness = function() {
|
||||
var rgb = this.toRgb();
|
||||
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
||||
};
|
||||
TinyColor2.prototype.getLuminance = function() {
|
||||
var rgb = this.toRgb();
|
||||
var R;
|
||||
var G;
|
||||
var B;
|
||||
var RsRGB = rgb.r / 255;
|
||||
var GsRGB = rgb.g / 255;
|
||||
var BsRGB = rgb.b / 255;
|
||||
if (RsRGB <= 0.03928) {
|
||||
R = RsRGB / 12.92;
|
||||
} else {
|
||||
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
if (GsRGB <= 0.03928) {
|
||||
G = GsRGB / 12.92;
|
||||
} else {
|
||||
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
if (BsRGB <= 0.03928) {
|
||||
B = BsRGB / 12.92;
|
||||
} else {
|
||||
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
||||
};
|
||||
TinyColor2.prototype.getAlpha = function() {
|
||||
return this.a;
|
||||
};
|
||||
TinyColor2.prototype.setAlpha = function(alpha) {
|
||||
this.a = boundAlpha(alpha);
|
||||
this.roundA = Math.round(100 * this.a) / 100;
|
||||
return this;
|
||||
};
|
||||
TinyColor2.prototype.toHsv = function() {
|
||||
var hsv = rgbToHsv(this.r, this.g, this.b);
|
||||
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
|
||||
};
|
||||
TinyColor2.prototype.toHsvString = function() {
|
||||
var hsv = rgbToHsv(this.r, this.g, this.b);
|
||||
var h = Math.round(hsv.h * 360);
|
||||
var s = Math.round(hsv.s * 100);
|
||||
var v = Math.round(hsv.v * 100);
|
||||
return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toHsl = function() {
|
||||
var hsl = rgbToHsl(this.r, this.g, this.b);
|
||||
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
|
||||
};
|
||||
TinyColor2.prototype.toHslString = function() {
|
||||
var hsl = rgbToHsl(this.r, this.g, this.b);
|
||||
var h = Math.round(hsl.h * 360);
|
||||
var s = Math.round(hsl.s * 100);
|
||||
var l = Math.round(hsl.l * 100);
|
||||
return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toHex = function(allow3Char) {
|
||||
if (allow3Char === void 0) {
|
||||
allow3Char = false;
|
||||
}
|
||||
return rgbToHex(this.r, this.g, this.b, allow3Char);
|
||||
};
|
||||
TinyColor2.prototype.toHexString = function(allow3Char) {
|
||||
if (allow3Char === void 0) {
|
||||
allow3Char = false;
|
||||
}
|
||||
return "#" + this.toHex(allow3Char);
|
||||
};
|
||||
TinyColor2.prototype.toHex8 = function(allow4Char) {
|
||||
if (allow4Char === void 0) {
|
||||
allow4Char = false;
|
||||
}
|
||||
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
|
||||
};
|
||||
TinyColor2.prototype.toHex8String = function(allow4Char) {
|
||||
if (allow4Char === void 0) {
|
||||
allow4Char = false;
|
||||
}
|
||||
return "#" + this.toHex8(allow4Char);
|
||||
};
|
||||
TinyColor2.prototype.toRgb = function() {
|
||||
return {
|
||||
r: Math.round(this.r),
|
||||
g: Math.round(this.g),
|
||||
b: Math.round(this.b),
|
||||
a: this.a
|
||||
};
|
||||
};
|
||||
TinyColor2.prototype.toRgbString = function() {
|
||||
var r = Math.round(this.r);
|
||||
var g = Math.round(this.g);
|
||||
var b = Math.round(this.b);
|
||||
return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toPercentageRgb = function() {
|
||||
var fmt = function(x) {
|
||||
return "".concat(Math.round(bound01(x, 255) * 100), "%");
|
||||
};
|
||||
return {
|
||||
r: fmt(this.r),
|
||||
g: fmt(this.g),
|
||||
b: fmt(this.b),
|
||||
a: this.a
|
||||
};
|
||||
};
|
||||
TinyColor2.prototype.toPercentageRgbString = function() {
|
||||
var rnd = function(x) {
|
||||
return Math.round(bound01(x, 255) * 100);
|
||||
};
|
||||
return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
|
||||
};
|
||||
TinyColor2.prototype.toName = function() {
|
||||
if (this.a === 0) {
|
||||
return "transparent";
|
||||
}
|
||||
if (this.a < 1) {
|
||||
return false;
|
||||
}
|
||||
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
|
||||
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
|
||||
var _b = _a[_i], key = _b[0], value = _b[1];
|
||||
if (hex === value) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
TinyColor2.prototype.toString = function(format) {
|
||||
var formatSet = Boolean(format);
|
||||
format = format !== null && format !== void 0 ? format : this.format;
|
||||
var formattedString = false;
|
||||
var hasAlpha = this.a < 1 && this.a >= 0;
|
||||
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
|
||||
if (needsAlphaFormat) {
|
||||
if (format === "name" && this.a === 0) {
|
||||
return this.toName();
|
||||
}
|
||||
return this.toRgbString();
|
||||
}
|
||||
if (format === "rgb") {
|
||||
formattedString = this.toRgbString();
|
||||
}
|
||||
if (format === "prgb") {
|
||||
formattedString = this.toPercentageRgbString();
|
||||
}
|
||||
if (format === "hex" || format === "hex6") {
|
||||
formattedString = this.toHexString();
|
||||
}
|
||||
if (format === "hex3") {
|
||||
formattedString = this.toHexString(true);
|
||||
}
|
||||
if (format === "hex4") {
|
||||
formattedString = this.toHex8String(true);
|
||||
}
|
||||
if (format === "hex8") {
|
||||
formattedString = this.toHex8String();
|
||||
}
|
||||
if (format === "name") {
|
||||
formattedString = this.toName();
|
||||
}
|
||||
if (format === "hsl") {
|
||||
formattedString = this.toHslString();
|
||||
}
|
||||
if (format === "hsv") {
|
||||
formattedString = this.toHsvString();
|
||||
}
|
||||
return formattedString || this.toHexString();
|
||||
};
|
||||
TinyColor2.prototype.toNumber = function() {
|
||||
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
|
||||
};
|
||||
TinyColor2.prototype.clone = function() {
|
||||
return new TinyColor2(this.toString());
|
||||
};
|
||||
TinyColor2.prototype.lighten = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.l += amount / 100;
|
||||
hsl.l = clamp01(hsl.l);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.brighten = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var rgb = this.toRgb();
|
||||
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
||||
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
||||
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
||||
return new TinyColor2(rgb);
|
||||
};
|
||||
TinyColor2.prototype.darken = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.l -= amount / 100;
|
||||
hsl.l = clamp01(hsl.l);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.tint = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
return this.mix("white", amount);
|
||||
};
|
||||
TinyColor2.prototype.shade = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
return this.mix("black", amount);
|
||||
};
|
||||
TinyColor2.prototype.desaturate = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.s -= amount / 100;
|
||||
hsl.s = clamp01(hsl.s);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.saturate = function(amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 10;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
hsl.s += amount / 100;
|
||||
hsl.s = clamp01(hsl.s);
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.greyscale = function() {
|
||||
return this.desaturate(100);
|
||||
};
|
||||
TinyColor2.prototype.spin = function(amount) {
|
||||
var hsl = this.toHsl();
|
||||
var hue = (hsl.h + amount) % 360;
|
||||
hsl.h = hue < 0 ? 360 + hue : hue;
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.mix = function(color, amount) {
|
||||
if (amount === void 0) {
|
||||
amount = 50;
|
||||
}
|
||||
var rgb1 = this.toRgb();
|
||||
var rgb2 = new TinyColor2(color).toRgb();
|
||||
var p = amount / 100;
|
||||
var rgba = {
|
||||
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
||||
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
||||
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
||||
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
||||
};
|
||||
return new TinyColor2(rgba);
|
||||
};
|
||||
TinyColor2.prototype.analogous = function(results, slices) {
|
||||
if (results === void 0) {
|
||||
results = 6;
|
||||
}
|
||||
if (slices === void 0) {
|
||||
slices = 30;
|
||||
}
|
||||
var hsl = this.toHsl();
|
||||
var part = 360 / slices;
|
||||
var ret = [this];
|
||||
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
||||
hsl.h = (hsl.h + part) % 360;
|
||||
ret.push(new TinyColor2(hsl));
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
TinyColor2.prototype.complement = function() {
|
||||
var hsl = this.toHsl();
|
||||
hsl.h = (hsl.h + 180) % 360;
|
||||
return new TinyColor2(hsl);
|
||||
};
|
||||
TinyColor2.prototype.monochromatic = function(results) {
|
||||
if (results === void 0) {
|
||||
results = 6;
|
||||
}
|
||||
var hsv = this.toHsv();
|
||||
var h = hsv.h;
|
||||
var s = hsv.s;
|
||||
var v = hsv.v;
|
||||
var res = [];
|
||||
var modification = 1 / results;
|
||||
while (results--) {
|
||||
res.push(new TinyColor2({ h, s, v }));
|
||||
v = (v + modification) % 1;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
TinyColor2.prototype.splitcomplement = function() {
|
||||
var hsl = this.toHsl();
|
||||
var h = hsl.h;
|
||||
return [
|
||||
this,
|
||||
new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
||||
new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
|
||||
];
|
||||
};
|
||||
TinyColor2.prototype.onBackground = function(background) {
|
||||
var fg = this.toRgb();
|
||||
var bg = new TinyColor2(background).toRgb();
|
||||
return new TinyColor2({
|
||||
r: bg.r + (fg.r - bg.r) * fg.a,
|
||||
g: bg.g + (fg.g - bg.g) * fg.a,
|
||||
b: bg.b + (fg.b - bg.b) * fg.a
|
||||
});
|
||||
};
|
||||
TinyColor2.prototype.triad = function() {
|
||||
return this.polyad(3);
|
||||
};
|
||||
TinyColor2.prototype.tetrad = function() {
|
||||
return this.polyad(4);
|
||||
};
|
||||
TinyColor2.prototype.polyad = function(n) {
|
||||
var hsl = this.toHsl();
|
||||
var h = hsl.h;
|
||||
var result = [this];
|
||||
var increment = 360 / n;
|
||||
for (var i = 1; i < n; i++) {
|
||||
result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
|
||||
}
|
||||
return result;
|
||||
};
|
||||
TinyColor2.prototype.equals = function(color) {
|
||||
return this.toRgbString() === new TinyColor2(color).toRgbString();
|
||||
};
|
||||
return TinyColor2;
|
||||
}();
|
||||
export { TinyColor as T };
|
||||
2063
package/component/es/_chunks/@intlify/index.js
Normal file
2063
package/component/es/_chunks/@intlify/index.js
Normal file
File diff suppressed because it is too large
Load Diff
5499
package/component/es/_chunks/@umijs/index.js
Normal file
5499
package/component/es/_chunks/@umijs/index.js
Normal file
File diff suppressed because it is too large
Load Diff
216
package/component/es/_chunks/@vue/index.js
Normal file
216
package/component/es/_chunks/@vue/index.js
Normal file
@@ -0,0 +1,216 @@
|
||||
const NOOP = () => {
|
||||
};
|
||||
const isArray = Array.isArray;
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isSymbol = (val) => typeof val === "symbol";
|
||||
let activeEffectScope;
|
||||
function recordEffectScope(effect, scope = activeEffectScope) {
|
||||
if (scope && scope.active) {
|
||||
scope.effects.push(effect);
|
||||
}
|
||||
}
|
||||
const createDep = (effects) => {
|
||||
const dep = new Set(effects);
|
||||
dep.w = 0;
|
||||
dep.n = 0;
|
||||
return dep;
|
||||
};
|
||||
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
||||
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
||||
const initDepMarkers = ({ deps }) => {
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].w |= trackOpBit;
|
||||
}
|
||||
}
|
||||
};
|
||||
const finalizeDepMarkers = (effect) => {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
let ptr = 0;
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
const dep = deps[i];
|
||||
if (wasTracked(dep) && !newTracked(dep)) {
|
||||
dep.delete(effect);
|
||||
} else {
|
||||
deps[ptr++] = dep;
|
||||
}
|
||||
dep.w &= ~trackOpBit;
|
||||
dep.n &= ~trackOpBit;
|
||||
}
|
||||
deps.length = ptr;
|
||||
}
|
||||
};
|
||||
let effectTrackDepth = 0;
|
||||
let trackOpBit = 1;
|
||||
const maxMarkerBits = 30;
|
||||
let activeEffect;
|
||||
class ReactiveEffect {
|
||||
constructor(fn, scheduler = null, scope) {
|
||||
this.fn = fn;
|
||||
this.scheduler = scheduler;
|
||||
this.active = true;
|
||||
this.deps = [];
|
||||
this.parent = void 0;
|
||||
recordEffectScope(this, scope);
|
||||
}
|
||||
run() {
|
||||
if (!this.active) {
|
||||
return this.fn();
|
||||
}
|
||||
let parent = activeEffect;
|
||||
let lastShouldTrack = shouldTrack;
|
||||
while (parent) {
|
||||
if (parent === this) {
|
||||
return;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
try {
|
||||
this.parent = activeEffect;
|
||||
activeEffect = this;
|
||||
shouldTrack = true;
|
||||
trackOpBit = 1 << ++effectTrackDepth;
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
initDepMarkers(this);
|
||||
} else {
|
||||
cleanupEffect(this);
|
||||
}
|
||||
return this.fn();
|
||||
} finally {
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
finalizeDepMarkers(this);
|
||||
}
|
||||
trackOpBit = 1 << --effectTrackDepth;
|
||||
activeEffect = this.parent;
|
||||
shouldTrack = lastShouldTrack;
|
||||
this.parent = void 0;
|
||||
if (this.deferStop) {
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
stop() {
|
||||
if (activeEffect === this) {
|
||||
this.deferStop = true;
|
||||
} else if (this.active) {
|
||||
cleanupEffect(this);
|
||||
if (this.onStop) {
|
||||
this.onStop();
|
||||
}
|
||||
this.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
function cleanupEffect(effect) {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].delete(effect);
|
||||
}
|
||||
deps.length = 0;
|
||||
}
|
||||
}
|
||||
let shouldTrack = true;
|
||||
function trackEffects(dep, debuggerEventExtraInfo) {
|
||||
let shouldTrack2 = false;
|
||||
if (effectTrackDepth <= maxMarkerBits) {
|
||||
if (!newTracked(dep)) {
|
||||
dep.n |= trackOpBit;
|
||||
shouldTrack2 = !wasTracked(dep);
|
||||
}
|
||||
} else {
|
||||
shouldTrack2 = !dep.has(activeEffect);
|
||||
}
|
||||
if (shouldTrack2) {
|
||||
dep.add(activeEffect);
|
||||
activeEffect.deps.push(dep);
|
||||
}
|
||||
}
|
||||
function triggerEffects(dep, debuggerEventExtraInfo) {
|
||||
const effects = isArray(dep) ? dep : [...dep];
|
||||
for (const effect of effects) {
|
||||
if (effect.computed) {
|
||||
triggerEffect(effect);
|
||||
}
|
||||
}
|
||||
for (const effect of effects) {
|
||||
if (!effect.computed) {
|
||||
triggerEffect(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
function triggerEffect(effect, debuggerEventExtraInfo) {
|
||||
if (effect !== activeEffect || effect.allowRecurse) {
|
||||
if (effect.scheduler) {
|
||||
effect.scheduler();
|
||||
} else {
|
||||
effect.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
|
||||
function toRaw(observed) {
|
||||
const raw = observed && observed["__v_raw"];
|
||||
return raw ? toRaw(raw) : observed;
|
||||
}
|
||||
function trackRefValue(ref) {
|
||||
if (shouldTrack && activeEffect) {
|
||||
ref = toRaw(ref);
|
||||
{
|
||||
trackEffects(ref.dep || (ref.dep = createDep()));
|
||||
}
|
||||
}
|
||||
}
|
||||
function triggerRefValue(ref, newVal) {
|
||||
ref = toRaw(ref);
|
||||
if (ref.dep) {
|
||||
{
|
||||
triggerEffects(ref.dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
class ComputedRefImpl {
|
||||
constructor(getter, _setter, isReadonly, isSSR) {
|
||||
this._setter = _setter;
|
||||
this.dep = void 0;
|
||||
this.__v_isRef = true;
|
||||
this._dirty = true;
|
||||
this.effect = new ReactiveEffect(getter, () => {
|
||||
if (!this._dirty) {
|
||||
this._dirty = true;
|
||||
triggerRefValue(this);
|
||||
}
|
||||
});
|
||||
this.effect.computed = this;
|
||||
this.effect.active = this._cacheable = !isSSR;
|
||||
this["__v_isReadonly"] = isReadonly;
|
||||
}
|
||||
get value() {
|
||||
const self = toRaw(this);
|
||||
trackRefValue(self);
|
||||
if (self._dirty || !self._cacheable) {
|
||||
self._dirty = false;
|
||||
self._value = self.effect.run();
|
||||
}
|
||||
return self._value;
|
||||
}
|
||||
set value(newValue) {
|
||||
this._setter(newValue);
|
||||
}
|
||||
}
|
||||
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
||||
let getter;
|
||||
let setter;
|
||||
const onlyGetter = isFunction(getterOrOptions);
|
||||
if (onlyGetter) {
|
||||
getter = getterOrOptions;
|
||||
setter = NOOP;
|
||||
} else {
|
||||
getter = getterOrOptions.get;
|
||||
setter = getterOrOptions.set;
|
||||
}
|
||||
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
||||
return cRef;
|
||||
}
|
||||
export { computed as c };
|
||||
564
package/component/es/_chunks/@vueuse/index.js
Normal file
564
package/component/es/_chunks/@vueuse/index.js
Normal file
@@ -0,0 +1,564 @@
|
||||
import { computed, isRef, reactive, unref, toRefs, getCurrentScope, onScopeDispose, getCurrentInstance, onMounted, nextTick, ref, watch, customRef, onUpdated } from "vue";
|
||||
var _a;
|
||||
const isClient = typeof window !== "undefined";
|
||||
const toString = Object.prototype.toString;
|
||||
const isFunction = (val) => typeof val === "function";
|
||||
const isNumber = (val) => typeof val === "number";
|
||||
const isString = (val) => typeof val === "string";
|
||||
const isObject = (val) => toString.call(val) === "[object Object]";
|
||||
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
||||
const noop = () => {
|
||||
};
|
||||
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
||||
function resolveUnref(r) {
|
||||
return typeof r === "function" ? r() : unref(r);
|
||||
}
|
||||
function createFilterWrapper(filter, fn) {
|
||||
function wrapper(...args) {
|
||||
filter(() => fn.apply(this, args), { fn, thisArg: this, args });
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
function throttleFilter(ms, trailing = true, leading = true) {
|
||||
let lastExec = 0;
|
||||
let timer;
|
||||
let isLeading = true;
|
||||
const clear = () => {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = void 0;
|
||||
}
|
||||
};
|
||||
const filter = (invoke) => {
|
||||
const duration = resolveUnref(ms);
|
||||
const elapsed = Date.now() - lastExec;
|
||||
clear();
|
||||
if (duration <= 0) {
|
||||
lastExec = Date.now();
|
||||
return invoke();
|
||||
}
|
||||
if (elapsed > duration && (leading || !isLeading)) {
|
||||
lastExec = Date.now();
|
||||
invoke();
|
||||
} else if (trailing) {
|
||||
timer = setTimeout(() => {
|
||||
lastExec = Date.now();
|
||||
isLeading = true;
|
||||
clear();
|
||||
invoke();
|
||||
}, duration);
|
||||
}
|
||||
if (!leading && !timer)
|
||||
timer = setTimeout(() => isLeading = true, duration);
|
||||
isLeading = false;
|
||||
};
|
||||
return filter;
|
||||
}
|
||||
function identity(arg) {
|
||||
return arg;
|
||||
}
|
||||
function tryOnScopeDispose(fn) {
|
||||
if (getCurrentScope()) {
|
||||
onScopeDispose(fn);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function toReactive(objectRef) {
|
||||
if (!isRef(objectRef))
|
||||
return reactive(objectRef);
|
||||
const proxy = new Proxy({}, {
|
||||
get(_, p, receiver) {
|
||||
return unref(Reflect.get(objectRef.value, p, receiver));
|
||||
},
|
||||
set(_, p, value) {
|
||||
if (isRef(objectRef.value[p]) && !isRef(value))
|
||||
objectRef.value[p].value = value;
|
||||
else
|
||||
objectRef.value[p] = value;
|
||||
return true;
|
||||
},
|
||||
deleteProperty(_, p) {
|
||||
return Reflect.deleteProperty(objectRef.value, p);
|
||||
},
|
||||
has(_, p) {
|
||||
return Reflect.has(objectRef.value, p);
|
||||
},
|
||||
ownKeys() {
|
||||
return Object.keys(objectRef.value);
|
||||
},
|
||||
getOwnPropertyDescriptor() {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
}
|
||||
});
|
||||
return reactive(proxy);
|
||||
}
|
||||
function reactiveComputed(fn) {
|
||||
return toReactive(computed(fn));
|
||||
}
|
||||
function reactiveOmit(obj, ...keys) {
|
||||
const flatKeys = keys.flat();
|
||||
return reactiveComputed(() => Object.fromEntries(Object.entries(toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
||||
}
|
||||
function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
|
||||
return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
|
||||
}
|
||||
function tryOnMounted(fn, sync = true) {
|
||||
if (getCurrentInstance())
|
||||
onMounted(fn);
|
||||
else if (sync)
|
||||
fn();
|
||||
else
|
||||
nextTick(fn);
|
||||
}
|
||||
function useTimeoutFn(cb, interval, options = {}) {
|
||||
const {
|
||||
immediate = true
|
||||
} = options;
|
||||
const isPending = ref(false);
|
||||
let timer = null;
|
||||
function clear() {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
function stop() {
|
||||
isPending.value = false;
|
||||
clear();
|
||||
}
|
||||
function start(...args) {
|
||||
clear();
|
||||
isPending.value = true;
|
||||
timer = setTimeout(() => {
|
||||
isPending.value = false;
|
||||
timer = null;
|
||||
cb(...args);
|
||||
}, resolveUnref(interval));
|
||||
}
|
||||
if (immediate) {
|
||||
isPending.value = true;
|
||||
if (isClient)
|
||||
start();
|
||||
}
|
||||
tryOnScopeDispose(stop);
|
||||
return {
|
||||
isPending,
|
||||
start,
|
||||
stop
|
||||
};
|
||||
}
|
||||
function unrefElement(elRef) {
|
||||
var _a2;
|
||||
const plain = resolveUnref(elRef);
|
||||
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
|
||||
}
|
||||
const defaultWindow = isClient ? window : void 0;
|
||||
function useEventListener(...args) {
|
||||
let target;
|
||||
let event;
|
||||
let listener;
|
||||
let options;
|
||||
if (isString(args[0])) {
|
||||
[event, listener, options] = args;
|
||||
target = defaultWindow;
|
||||
} else {
|
||||
[target, event, listener, options] = args;
|
||||
}
|
||||
if (!target)
|
||||
return noop;
|
||||
let cleanup = noop;
|
||||
const stopWatch = watch(() => unrefElement(target), (el) => {
|
||||
cleanup();
|
||||
if (!el)
|
||||
return;
|
||||
el.addEventListener(event, listener, options);
|
||||
cleanup = () => {
|
||||
el.removeEventListener(event, listener, options);
|
||||
cleanup = noop;
|
||||
};
|
||||
}, { immediate: true, flush: "post" });
|
||||
const stop = () => {
|
||||
stopWatch();
|
||||
cleanup();
|
||||
};
|
||||
tryOnScopeDispose(stop);
|
||||
return stop;
|
||||
}
|
||||
function onClickOutside(target, handler, options = {}) {
|
||||
const { window: window2 = defaultWindow, ignore, capture = true, detectIframe = false } = options;
|
||||
if (!window2)
|
||||
return;
|
||||
const shouldListen = ref(true);
|
||||
let fallback;
|
||||
const listener = (event) => {
|
||||
window2.clearTimeout(fallback);
|
||||
const el = unrefElement(target);
|
||||
const composedPath = event.composedPath();
|
||||
if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
|
||||
return;
|
||||
if (ignore && ignore.length > 0) {
|
||||
if (ignore.some((target2) => {
|
||||
const el2 = unrefElement(target2);
|
||||
return el2 && (event.target === el2 || composedPath.includes(el2));
|
||||
}))
|
||||
return;
|
||||
}
|
||||
handler(event);
|
||||
};
|
||||
const cleanup = [
|
||||
useEventListener(window2, "click", listener, { passive: true, capture }),
|
||||
useEventListener(window2, "pointerdown", (e) => {
|
||||
const el = unrefElement(target);
|
||||
shouldListen.value = !!el && !e.composedPath().includes(el);
|
||||
}, { passive: true }),
|
||||
useEventListener(window2, "pointerup", (e) => {
|
||||
if (e.button === 0) {
|
||||
const path = e.composedPath();
|
||||
e.composedPath = () => path;
|
||||
fallback = window2.setTimeout(() => listener(e), 50);
|
||||
}
|
||||
}, { passive: true }),
|
||||
detectIframe && useEventListener(window2, "blur", (event) => {
|
||||
var _a2;
|
||||
const el = unrefElement(target);
|
||||
if (((_a2 = document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
|
||||
handler(event);
|
||||
})
|
||||
].filter(Boolean);
|
||||
const stop = () => cleanup.forEach((fn) => fn());
|
||||
return stop;
|
||||
}
|
||||
function templateRef(key, initialValue = null) {
|
||||
const instance = getCurrentInstance();
|
||||
let _trigger = () => {
|
||||
};
|
||||
const element = customRef((track, trigger) => {
|
||||
_trigger = trigger;
|
||||
return {
|
||||
get() {
|
||||
var _a2, _b;
|
||||
track();
|
||||
return (_b = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$refs[key]) != null ? _b : initialValue;
|
||||
},
|
||||
set() {
|
||||
}
|
||||
};
|
||||
});
|
||||
tryOnMounted(_trigger);
|
||||
onUpdated(_trigger);
|
||||
return element;
|
||||
}
|
||||
function useSupported(callback, sync = false) {
|
||||
const isSupported = ref();
|
||||
const update = () => isSupported.value = Boolean(callback());
|
||||
update();
|
||||
tryOnMounted(update, sync);
|
||||
return isSupported;
|
||||
}
|
||||
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
||||
const globalKey = "__vueuse_ssr_handlers__";
|
||||
_global[globalKey] = _global[globalKey] || {};
|
||||
_global[globalKey];
|
||||
var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
|
||||
var __hasOwnProp$f = Object.prototype.hasOwnProperty;
|
||||
var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
|
||||
var __objRest$2 = (source, exclude) => {
|
||||
var target = {};
|
||||
for (var prop in source)
|
||||
if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
|
||||
target[prop] = source[prop];
|
||||
if (source != null && __getOwnPropSymbols$f)
|
||||
for (var prop of __getOwnPropSymbols$f(source)) {
|
||||
if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
|
||||
target[prop] = source[prop];
|
||||
}
|
||||
return target;
|
||||
};
|
||||
function useResizeObserver(target, callback, options = {}) {
|
||||
const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
|
||||
let observer;
|
||||
const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
|
||||
const cleanup = () => {
|
||||
if (observer) {
|
||||
observer.disconnect();
|
||||
observer = void 0;
|
||||
}
|
||||
};
|
||||
const stopWatch = watch(() => unrefElement(target), (el) => {
|
||||
cleanup();
|
||||
if (isSupported.value && window2 && el) {
|
||||
observer = new ResizeObserver(callback);
|
||||
observer.observe(el, observerOptions);
|
||||
}
|
||||
}, { immediate: true, flush: "post" });
|
||||
const stop = () => {
|
||||
cleanup();
|
||||
stopWatch();
|
||||
};
|
||||
tryOnScopeDispose(stop);
|
||||
return {
|
||||
isSupported,
|
||||
stop
|
||||
};
|
||||
}
|
||||
function useRafFn(fn, options = {}) {
|
||||
const {
|
||||
immediate = true,
|
||||
window: window2 = defaultWindow
|
||||
} = options;
|
||||
const isActive = ref(false);
|
||||
let rafId = null;
|
||||
function loop() {
|
||||
if (!isActive.value || !window2)
|
||||
return;
|
||||
fn();
|
||||
rafId = window2.requestAnimationFrame(loop);
|
||||
}
|
||||
function resume() {
|
||||
if (!isActive.value && window2) {
|
||||
isActive.value = true;
|
||||
loop();
|
||||
}
|
||||
}
|
||||
function pause() {
|
||||
isActive.value = false;
|
||||
if (rafId != null && window2) {
|
||||
window2.cancelAnimationFrame(rafId);
|
||||
rafId = null;
|
||||
}
|
||||
}
|
||||
if (immediate)
|
||||
resume();
|
||||
tryOnScopeDispose(pause);
|
||||
return {
|
||||
isActive,
|
||||
pause,
|
||||
resume
|
||||
};
|
||||
}
|
||||
function useEyeDropper(options = {}) {
|
||||
const { initialValue = "" } = options;
|
||||
const isSupported = useSupported(() => typeof window !== "undefined" && "EyeDropper" in window);
|
||||
const sRGBHex = ref(initialValue);
|
||||
async function open(openOptions) {
|
||||
if (!isSupported.value)
|
||||
return;
|
||||
const eyeDropper = new window.EyeDropper();
|
||||
const result = await eyeDropper.open(openOptions);
|
||||
sRGBHex.value = result.sRGBHex;
|
||||
return result;
|
||||
}
|
||||
return { isSupported, sRGBHex, open };
|
||||
}
|
||||
function useMousePressed(options = {}) {
|
||||
const {
|
||||
touch = true,
|
||||
drag = true,
|
||||
initialValue = false,
|
||||
window: window2 = defaultWindow
|
||||
} = options;
|
||||
const pressed = ref(initialValue);
|
||||
const sourceType = ref(null);
|
||||
if (!window2) {
|
||||
return {
|
||||
pressed,
|
||||
sourceType
|
||||
};
|
||||
}
|
||||
const onPressed = (srcType) => () => {
|
||||
pressed.value = true;
|
||||
sourceType.value = srcType;
|
||||
};
|
||||
const onReleased = () => {
|
||||
pressed.value = false;
|
||||
sourceType.value = null;
|
||||
};
|
||||
const target = computed(() => unrefElement(options.target) || window2);
|
||||
useEventListener(target, "mousedown", onPressed("mouse"), { passive: true });
|
||||
useEventListener(window2, "mouseleave", onReleased, { passive: true });
|
||||
useEventListener(window2, "mouseup", onReleased, { passive: true });
|
||||
if (drag) {
|
||||
useEventListener(target, "dragstart", onPressed("mouse"), { passive: true });
|
||||
useEventListener(window2, "drop", onReleased, { passive: true });
|
||||
useEventListener(window2, "dragend", onReleased, { passive: true });
|
||||
}
|
||||
if (touch) {
|
||||
useEventListener(target, "touchstart", onPressed("touch"), { passive: true });
|
||||
useEventListener(window2, "touchend", onReleased, { passive: true });
|
||||
useEventListener(window2, "touchcancel", onReleased, { passive: true });
|
||||
}
|
||||
return {
|
||||
pressed,
|
||||
sourceType
|
||||
};
|
||||
}
|
||||
var SwipeDirection;
|
||||
(function(SwipeDirection2) {
|
||||
SwipeDirection2["UP"] = "UP";
|
||||
SwipeDirection2["RIGHT"] = "RIGHT";
|
||||
SwipeDirection2["DOWN"] = "DOWN";
|
||||
SwipeDirection2["LEFT"] = "LEFT";
|
||||
SwipeDirection2["NONE"] = "NONE";
|
||||
})(SwipeDirection || (SwipeDirection = {}));
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __spreadValues = (a, b) => {
|
||||
for (var prop in b || (b = {}))
|
||||
if (__hasOwnProp.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
if (__getOwnPropSymbols)
|
||||
for (var prop of __getOwnPropSymbols(b)) {
|
||||
if (__propIsEnum.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
const _TransitionPresets = {
|
||||
easeInSine: [0.12, 0, 0.39, 0],
|
||||
easeOutSine: [0.61, 1, 0.88, 1],
|
||||
easeInOutSine: [0.37, 0, 0.63, 1],
|
||||
easeInQuad: [0.11, 0, 0.5, 0],
|
||||
easeOutQuad: [0.5, 1, 0.89, 1],
|
||||
easeInOutQuad: [0.45, 0, 0.55, 1],
|
||||
easeInCubic: [0.32, 0, 0.67, 0],
|
||||
easeOutCubic: [0.33, 1, 0.68, 1],
|
||||
easeInOutCubic: [0.65, 0, 0.35, 1],
|
||||
easeInQuart: [0.5, 0, 0.75, 0],
|
||||
easeOutQuart: [0.25, 1, 0.5, 1],
|
||||
easeInOutQuart: [0.76, 0, 0.24, 1],
|
||||
easeInQuint: [0.64, 0, 0.78, 0],
|
||||
easeOutQuint: [0.22, 1, 0.36, 1],
|
||||
easeInOutQuint: [0.83, 0, 0.17, 1],
|
||||
easeInExpo: [0.7, 0, 0.84, 0],
|
||||
easeOutExpo: [0.16, 1, 0.3, 1],
|
||||
easeInOutExpo: [0.87, 0, 0.13, 1],
|
||||
easeInCirc: [0.55, 0, 1, 0.45],
|
||||
easeOutCirc: [0, 0.55, 0.45, 1],
|
||||
easeInOutCirc: [0.85, 0, 0.15, 1],
|
||||
easeInBack: [0.36, 0, 0.66, -0.56],
|
||||
easeOutBack: [0.34, 1.56, 0.64, 1],
|
||||
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
||||
};
|
||||
const TransitionPresets = __spreadValues({
|
||||
linear: identity
|
||||
}, _TransitionPresets);
|
||||
function createEasingFunction([p0, p1, p2, p3]) {
|
||||
const a = (a1, a2) => 1 - 3 * a2 + 3 * a1;
|
||||
const b = (a1, a2) => 3 * a2 - 6 * a1;
|
||||
const c = (a1) => 3 * a1;
|
||||
const calcBezier = (t, a1, a2) => ((a(a1, a2) * t + b(a1, a2)) * t + c(a1)) * t;
|
||||
const getSlope = (t, a1, a2) => 3 * a(a1, a2) * t * t + 2 * b(a1, a2) * t + c(a1);
|
||||
const getTforX = (x) => {
|
||||
let aGuessT = x;
|
||||
for (let i = 0; i < 4; ++i) {
|
||||
const currentSlope = getSlope(aGuessT, p0, p2);
|
||||
if (currentSlope === 0)
|
||||
return aGuessT;
|
||||
const currentX = calcBezier(aGuessT, p0, p2) - x;
|
||||
aGuessT -= currentX / currentSlope;
|
||||
}
|
||||
return aGuessT;
|
||||
};
|
||||
return (x) => p0 === p1 && p2 === p3 ? x : calcBezier(getTforX(x), p1, p3);
|
||||
}
|
||||
function useTransition(source, options = {}) {
|
||||
const {
|
||||
delay = 0,
|
||||
disabled = false,
|
||||
duration = 1e3,
|
||||
onFinished = noop,
|
||||
onStarted = noop,
|
||||
transition = identity
|
||||
} = options;
|
||||
const currentTransition = computed(() => {
|
||||
const t = unref(transition);
|
||||
return isFunction(t) ? t : createEasingFunction(t);
|
||||
});
|
||||
const sourceValue = computed(() => {
|
||||
const s = unref(source);
|
||||
return isNumber(s) ? s : s.map(unref);
|
||||
});
|
||||
const sourceVector = computed(() => isNumber(sourceValue.value) ? [sourceValue.value] : sourceValue.value);
|
||||
const outputVector = ref(sourceVector.value.slice(0));
|
||||
let currentDuration;
|
||||
let diffVector;
|
||||
let endAt;
|
||||
let startAt;
|
||||
let startVector;
|
||||
const { resume, pause } = useRafFn(() => {
|
||||
const now = Date.now();
|
||||
const progress = clamp(1 - (endAt - now) / currentDuration, 0, 1);
|
||||
outputVector.value = startVector.map((val, i) => {
|
||||
var _a2;
|
||||
return val + ((_a2 = diffVector[i]) != null ? _a2 : 0) * currentTransition.value(progress);
|
||||
});
|
||||
if (progress >= 1) {
|
||||
pause();
|
||||
onFinished();
|
||||
}
|
||||
}, { immediate: false });
|
||||
const start = () => {
|
||||
pause();
|
||||
currentDuration = unref(duration);
|
||||
diffVector = outputVector.value.map((n, i) => {
|
||||
var _a2, _b;
|
||||
return ((_a2 = sourceVector.value[i]) != null ? _a2 : 0) - ((_b = outputVector.value[i]) != null ? _b : 0);
|
||||
});
|
||||
startVector = outputVector.value.slice(0);
|
||||
startAt = Date.now();
|
||||
endAt = startAt + currentDuration;
|
||||
resume();
|
||||
onStarted();
|
||||
};
|
||||
const timeout = useTimeoutFn(start, delay, { immediate: false });
|
||||
watch(sourceVector, () => {
|
||||
if (unref(disabled)) {
|
||||
outputVector.value = sourceVector.value.slice(0);
|
||||
} else {
|
||||
if (unref(delay) <= 0)
|
||||
start();
|
||||
else
|
||||
timeout.start();
|
||||
}
|
||||
}, { deep: true });
|
||||
return computed(() => {
|
||||
const targetVector = unref(disabled) ? sourceVector : outputVector;
|
||||
return isNumber(sourceValue.value) ? targetVector.value[0] : targetVector.value;
|
||||
});
|
||||
}
|
||||
function useWindowSize(options = {}) {
|
||||
const {
|
||||
window: window2 = defaultWindow,
|
||||
initialWidth = Infinity,
|
||||
initialHeight = Infinity,
|
||||
listenOrientation = true,
|
||||
includeScrollbar = true
|
||||
} = options;
|
||||
const width = ref(initialWidth);
|
||||
const height = ref(initialHeight);
|
||||
const update = () => {
|
||||
if (window2) {
|
||||
if (includeScrollbar) {
|
||||
width.value = window2.innerWidth;
|
||||
height.value = window2.innerHeight;
|
||||
} else {
|
||||
width.value = window2.document.documentElement.clientWidth;
|
||||
height.value = window2.document.documentElement.clientHeight;
|
||||
}
|
||||
}
|
||||
};
|
||||
update();
|
||||
tryOnMounted(update);
|
||||
useEventListener("resize", update, { passive: true });
|
||||
if (listenOrientation)
|
||||
useEventListener("orientationchange", update, { passive: true });
|
||||
return { width, height };
|
||||
}
|
||||
export { TransitionPresets as T, useResizeObserver as a, useThrottleFn as b, useEventListener as c, useEyeDropper as d, useTransition as e, useMousePressed as f, isObject as i, onClickOutside as o, reactiveOmit as r, templateRef as t, useWindowSize as u };
|
||||
1011
package/component/es/_chunks/async-validator/index.js
Normal file
1011
package/component/es/_chunks/async-validator/index.js
Normal file
File diff suppressed because it is too large
Load Diff
2570
package/component/es/_chunks/cropperjs/index.js
Normal file
2570
package/component/es/_chunks/cropperjs/index.js
Normal file
File diff suppressed because it is too large
Load Diff
208
package/component/es/_chunks/dayjs/index.js
Normal file
208
package/component/es/_chunks/dayjs/index.js
Normal file
@@ -0,0 +1,208 @@
|
||||
import { c as commonjsGlobal } from "../@umijs/index.js";
|
||||
var dayjs_min = { exports: {} };
|
||||
(function(module, exports) {
|
||||
!function(t, e) {
|
||||
module.exports = e();
|
||||
}(commonjsGlobal, function() {
|
||||
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_") }, m = function(t2, e2, n2) {
|
||||
var r2 = String(t2);
|
||||
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
||||
}, g = { s: m, z: function(t2) {
|
||||
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
||||
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
||||
}, m: function t2(e2, n2) {
|
||||
if (e2.date() < n2.date())
|
||||
return -t2(n2, e2);
|
||||
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
|
||||
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
||||
}, a: function(t2) {
|
||||
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
||||
}, p: function(t2) {
|
||||
return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
||||
}, u: function(t2) {
|
||||
return void 0 === t2;
|
||||
} }, v = "en", D = {};
|
||||
D[v] = M;
|
||||
var p = function(t2) {
|
||||
return t2 instanceof _;
|
||||
}, S = function t2(e2, n2, r2) {
|
||||
var i2;
|
||||
if (!e2)
|
||||
return v;
|
||||
if ("string" == typeof e2) {
|
||||
var s2 = e2.toLowerCase();
|
||||
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
||||
var u2 = e2.split("-");
|
||||
if (!i2 && u2.length > 1)
|
||||
return t2(u2[0]);
|
||||
} else {
|
||||
var a2 = e2.name;
|
||||
D[a2] = e2, i2 = a2;
|
||||
}
|
||||
return !r2 && i2 && (v = i2), i2 || !r2 && v;
|
||||
}, w = function(t2, e2) {
|
||||
if (p(t2))
|
||||
return t2.clone();
|
||||
var n2 = "object" == typeof e2 ? e2 : {};
|
||||
return n2.date = t2, n2.args = arguments, new _(n2);
|
||||
}, O = g;
|
||||
O.l = S, O.i = p, O.w = function(t2, e2) {
|
||||
return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
||||
};
|
||||
var _ = function() {
|
||||
function M2(t2) {
|
||||
this.$L = S(t2.locale, null, true), this.parse(t2);
|
||||
}
|
||||
var m2 = M2.prototype;
|
||||
return m2.parse = function(t2) {
|
||||
this.$d = function(t3) {
|
||||
var e2 = t3.date, n2 = t3.utc;
|
||||
if (null === e2)
|
||||
return new Date(NaN);
|
||||
if (O.u(e2))
|
||||
return new Date();
|
||||
if (e2 instanceof Date)
|
||||
return new Date(e2);
|
||||
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
||||
var r2 = e2.match(l);
|
||||
if (r2) {
|
||||
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
||||
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
||||
}
|
||||
}
|
||||
return new Date(e2);
|
||||
}(t2), this.$x = t2.x || {}, this.init();
|
||||
}, m2.init = function() {
|
||||
var t2 = this.$d;
|
||||
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
||||
}, m2.$utils = function() {
|
||||
return O;
|
||||
}, m2.isValid = function() {
|
||||
return !(this.$d.toString() === $);
|
||||
}, m2.isSame = function(t2, e2) {
|
||||
var n2 = w(t2);
|
||||
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
||||
}, m2.isAfter = function(t2, e2) {
|
||||
return w(t2) < this.startOf(e2);
|
||||
}, m2.isBefore = function(t2, e2) {
|
||||
return this.endOf(e2) < w(t2);
|
||||
}, m2.$g = function(t2, e2, n2) {
|
||||
return O.u(t2) ? this[e2] : this.set(n2, t2);
|
||||
}, m2.unix = function() {
|
||||
return Math.floor(this.valueOf() / 1e3);
|
||||
}, m2.valueOf = function() {
|
||||
return this.$d.getTime();
|
||||
}, m2.startOf = function(t2, e2) {
|
||||
var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
|
||||
var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
||||
return r2 ? i2 : i2.endOf(a);
|
||||
}, l2 = function(t3, e3) {
|
||||
return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
||||
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
|
||||
switch (h2) {
|
||||
case c:
|
||||
return r2 ? $2(1, 0) : $2(31, 11);
|
||||
case f:
|
||||
return r2 ? $2(1, M3) : $2(0, M3 + 1);
|
||||
case o:
|
||||
var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2;
|
||||
return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
||||
case a:
|
||||
case d:
|
||||
return l2(g2 + "Hours", 0);
|
||||
case u:
|
||||
return l2(g2 + "Minutes", 1);
|
||||
case s:
|
||||
return l2(g2 + "Seconds", 2);
|
||||
case i:
|
||||
return l2(g2 + "Milliseconds", 3);
|
||||
default:
|
||||
return this.clone();
|
||||
}
|
||||
}, m2.endOf = function(t2) {
|
||||
return this.startOf(t2, false);
|
||||
}, m2.$set = function(t2, e2) {
|
||||
var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
||||
if (o2 === f || o2 === c) {
|
||||
var y2 = this.clone().set(d, 1);
|
||||
y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
||||
} else
|
||||
$2 && this.$d[$2](l2);
|
||||
return this.init(), this;
|
||||
}, m2.set = function(t2, e2) {
|
||||
return this.clone().$set(t2, e2);
|
||||
}, m2.get = function(t2) {
|
||||
return this[O.p(t2)]();
|
||||
}, m2.add = function(r2, h2) {
|
||||
var d2, $2 = this;
|
||||
r2 = Number(r2);
|
||||
var l2 = O.p(h2), y2 = function(t2) {
|
||||
var e2 = w($2);
|
||||
return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
|
||||
};
|
||||
if (l2 === f)
|
||||
return this.set(f, this.$M + r2);
|
||||
if (l2 === c)
|
||||
return this.set(c, this.$y + r2);
|
||||
if (l2 === a)
|
||||
return y2(1);
|
||||
if (l2 === o)
|
||||
return y2(7);
|
||||
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
||||
return O.w(m3, this);
|
||||
}, m2.subtract = function(t2, e2) {
|
||||
return this.add(-1 * t2, e2);
|
||||
}, m2.format = function(t2) {
|
||||
var e2 = this, n2 = this.$locale();
|
||||
if (!this.isValid())
|
||||
return n2.invalidDate || $;
|
||||
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
|
||||
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].substr(0, s3);
|
||||
}, c2 = function(t3) {
|
||||
return O.s(s2 % 12 || 12, t3, "0");
|
||||
}, d2 = n2.meridiem || function(t3, e3, n3) {
|
||||
var r3 = t3 < 12 ? "AM" : "PM";
|
||||
return n3 ? r3.toLowerCase() : r3;
|
||||
}, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
|
||||
return r2.replace(y, function(t3, e3) {
|
||||
return e3 || l2[t3] || i2.replace(":", "");
|
||||
});
|
||||
}, m2.utcOffset = function() {
|
||||
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
||||
}, m2.diff = function(r2, d2, $2) {
|
||||
var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3);
|
||||
return v2 = (l2 = {}, l2[c] = v2 / 12, l2[f] = v2, l2[h] = v2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? v2 : O.a(v2);
|
||||
}, m2.daysInMonth = function() {
|
||||
return this.endOf(f).$D;
|
||||
}, m2.$locale = function() {
|
||||
return D[this.$L];
|
||||
}, m2.locale = function(t2, e2) {
|
||||
if (!t2)
|
||||
return this.$L;
|
||||
var n2 = this.clone(), r2 = S(t2, e2, true);
|
||||
return r2 && (n2.$L = r2), n2;
|
||||
}, m2.clone = function() {
|
||||
return O.w(this.$d, this);
|
||||
}, m2.toDate = function() {
|
||||
return new Date(this.valueOf());
|
||||
}, m2.toJSON = function() {
|
||||
return this.isValid() ? this.toISOString() : null;
|
||||
}, m2.toISOString = function() {
|
||||
return this.$d.toISOString();
|
||||
}, m2.toString = function() {
|
||||
return this.$d.toUTCString();
|
||||
}, M2;
|
||||
}(), b = _.prototype;
|
||||
return w.prototype = b, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
|
||||
b[t2[1]] = function(e2) {
|
||||
return this.$g(e2, t2[0], t2[1]);
|
||||
};
|
||||
}), w.extend = function(t2, e2) {
|
||||
return t2.$i || (t2(e2, _, w), t2.$i = true), w;
|
||||
}, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
|
||||
return w(1e3 * t2);
|
||||
}, w.en = D[v], w.Ls = D, w.p = {}, w;
|
||||
});
|
||||
})(dayjs_min);
|
||||
var dayjs = dayjs_min.exports;
|
||||
export { dayjs as d };
|
||||
311
package/component/es/_chunks/evtd/index.js
Normal file
311
package/component/es/_chunks/evtd/index.js
Normal file
@@ -0,0 +1,311 @@
|
||||
const traps = {
|
||||
mousemoveoutside: /* @__PURE__ */ new WeakMap(),
|
||||
clickoutside: /* @__PURE__ */ new WeakMap()
|
||||
};
|
||||
function createTrapHandler(name, el, originalHandler) {
|
||||
if (name === "mousemoveoutside") {
|
||||
const moveHandler = (e) => {
|
||||
if (el.contains(e.target))
|
||||
return;
|
||||
originalHandler(e);
|
||||
};
|
||||
return {
|
||||
mousemove: moveHandler,
|
||||
touchstart: moveHandler
|
||||
};
|
||||
} else if (name === "clickoutside") {
|
||||
let mouseDownOutside = false;
|
||||
const downHandler = (e) => {
|
||||
mouseDownOutside = !el.contains(e.target);
|
||||
};
|
||||
const upHanlder = (e) => {
|
||||
if (!mouseDownOutside)
|
||||
return;
|
||||
if (el.contains(e.target))
|
||||
return;
|
||||
originalHandler(e);
|
||||
};
|
||||
return {
|
||||
mousedown: downHandler,
|
||||
mouseup: upHanlder,
|
||||
touchstart: downHandler,
|
||||
touchend: upHanlder
|
||||
};
|
||||
}
|
||||
console.error(`[evtd/create-trap-handler]: name \`${name}\` is invalid. This could be a bug of evtd.`);
|
||||
return {};
|
||||
}
|
||||
function ensureTrapHandlers(name, el, handler) {
|
||||
const handlers = traps[name];
|
||||
let elHandlers = handlers.get(el);
|
||||
if (elHandlers === void 0) {
|
||||
handlers.set(el, elHandlers = /* @__PURE__ */ new WeakMap());
|
||||
}
|
||||
let trapHandler = elHandlers.get(handler);
|
||||
if (trapHandler === void 0) {
|
||||
elHandlers.set(handler, trapHandler = createTrapHandler(name, el, handler));
|
||||
}
|
||||
return trapHandler;
|
||||
}
|
||||
function trapOn(name, el, handler, options) {
|
||||
if (name === "mousemoveoutside" || name === "clickoutside") {
|
||||
const trapHandlers = ensureTrapHandlers(name, el, handler);
|
||||
Object.keys(trapHandlers).forEach((key) => {
|
||||
on(key, document, trapHandlers[key], options);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function trapOff(name, el, handler, options) {
|
||||
if (name === "mousemoveoutside" || name === "clickoutside") {
|
||||
const trapHandlers = ensureTrapHandlers(name, el, handler);
|
||||
Object.keys(trapHandlers).forEach((key) => {
|
||||
off(key, document, trapHandlers[key], options);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function createDelegate() {
|
||||
if (typeof window === "undefined") {
|
||||
return {
|
||||
on: () => {
|
||||
},
|
||||
off: () => {
|
||||
}
|
||||
};
|
||||
}
|
||||
const propagationStopped = /* @__PURE__ */ new WeakMap();
|
||||
const immediatePropagationStopped = /* @__PURE__ */ new WeakMap();
|
||||
function trackPropagation() {
|
||||
propagationStopped.set(this, true);
|
||||
}
|
||||
function trackImmediate() {
|
||||
propagationStopped.set(this, true);
|
||||
immediatePropagationStopped.set(this, true);
|
||||
}
|
||||
function spy(event, propName, fn) {
|
||||
const source = event[propName];
|
||||
event[propName] = function() {
|
||||
fn.apply(event, arguments);
|
||||
return source.apply(event, arguments);
|
||||
};
|
||||
return event;
|
||||
}
|
||||
function unspy(event, propName) {
|
||||
event[propName] = Event.prototype[propName];
|
||||
}
|
||||
const currentTargets = /* @__PURE__ */ new WeakMap();
|
||||
const currentTargetDescriptor = Object.getOwnPropertyDescriptor(Event.prototype, "currentTarget");
|
||||
function getCurrentTarget() {
|
||||
var _a;
|
||||
return (_a = currentTargets.get(this)) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
function defineCurrentTarget(event, getter) {
|
||||
if (currentTargetDescriptor === void 0)
|
||||
return;
|
||||
Object.defineProperty(event, "currentTarget", {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: getter !== null && getter !== void 0 ? getter : currentTargetDescriptor.get
|
||||
});
|
||||
}
|
||||
const phaseToTypeToElToHandlers = {
|
||||
bubble: {},
|
||||
capture: {}
|
||||
};
|
||||
const typeToWindowEventHandlers = {};
|
||||
function createUnifiedHandler() {
|
||||
const delegeteHandler = function(e) {
|
||||
const { type, eventPhase, target, bubbles } = e;
|
||||
if (eventPhase === 2)
|
||||
return;
|
||||
const phase = eventPhase === 1 ? "capture" : "bubble";
|
||||
let cursor = target;
|
||||
const path = [];
|
||||
while (true) {
|
||||
if (cursor === null)
|
||||
cursor = window;
|
||||
path.push(cursor);
|
||||
if (cursor === window) {
|
||||
break;
|
||||
}
|
||||
cursor = cursor.parentNode || null;
|
||||
}
|
||||
const captureElToHandlers = phaseToTypeToElToHandlers.capture[type];
|
||||
const bubbleElToHandlers = phaseToTypeToElToHandlers.bubble[type];
|
||||
spy(e, "stopPropagation", trackPropagation);
|
||||
spy(e, "stopImmediatePropagation", trackImmediate);
|
||||
defineCurrentTarget(e, getCurrentTarget);
|
||||
if (phase === "capture") {
|
||||
if (captureElToHandlers === void 0)
|
||||
return;
|
||||
for (let i = path.length - 1; i >= 0; --i) {
|
||||
if (propagationStopped.has(e))
|
||||
break;
|
||||
const target2 = path[i];
|
||||
const handlers = captureElToHandlers.get(target2);
|
||||
if (handlers !== void 0) {
|
||||
currentTargets.set(e, target2);
|
||||
for (const handler of handlers) {
|
||||
if (immediatePropagationStopped.has(e))
|
||||
break;
|
||||
handler(e);
|
||||
}
|
||||
}
|
||||
if (i === 0 && !bubbles && bubbleElToHandlers !== void 0) {
|
||||
const bubbleHandlers = bubbleElToHandlers.get(target2);
|
||||
if (bubbleHandlers !== void 0) {
|
||||
for (const handler of bubbleHandlers) {
|
||||
if (immediatePropagationStopped.has(e))
|
||||
break;
|
||||
handler(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (phase === "bubble") {
|
||||
if (bubbleElToHandlers === void 0)
|
||||
return;
|
||||
for (let i = 0; i < path.length; ++i) {
|
||||
if (propagationStopped.has(e))
|
||||
break;
|
||||
const target2 = path[i];
|
||||
const handlers = bubbleElToHandlers.get(target2);
|
||||
if (handlers !== void 0) {
|
||||
currentTargets.set(e, target2);
|
||||
for (const handler of handlers) {
|
||||
if (immediatePropagationStopped.has(e))
|
||||
break;
|
||||
handler(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unspy(e, "stopPropagation");
|
||||
unspy(e, "stopImmediatePropagation");
|
||||
defineCurrentTarget(e);
|
||||
};
|
||||
delegeteHandler.displayName = "evtdUnifiedHandler";
|
||||
return delegeteHandler;
|
||||
}
|
||||
function createUnifiedWindowEventHandler() {
|
||||
const delegateHandler = function(e) {
|
||||
const { type, eventPhase } = e;
|
||||
if (eventPhase !== 2)
|
||||
return;
|
||||
const handlers = typeToWindowEventHandlers[type];
|
||||
if (handlers === void 0)
|
||||
return;
|
||||
handlers.forEach((handler) => handler(e));
|
||||
};
|
||||
delegateHandler.displayName = "evtdUnifiedWindowEventHandler";
|
||||
return delegateHandler;
|
||||
}
|
||||
const unifiedHandler = createUnifiedHandler();
|
||||
const unfiendWindowEventHandler = createUnifiedWindowEventHandler();
|
||||
function ensureElToHandlers(phase, type) {
|
||||
const phaseHandlers = phaseToTypeToElToHandlers[phase];
|
||||
if (phaseHandlers[type] === void 0) {
|
||||
phaseHandlers[type] = /* @__PURE__ */ new Map();
|
||||
window.addEventListener(type, unifiedHandler, phase === "capture");
|
||||
}
|
||||
return phaseHandlers[type];
|
||||
}
|
||||
function ensureWindowEventHandlers(type) {
|
||||
const windowEventHandlers = typeToWindowEventHandlers[type];
|
||||
if (windowEventHandlers === void 0) {
|
||||
typeToWindowEventHandlers[type] = /* @__PURE__ */ new Set();
|
||||
window.addEventListener(type, unfiendWindowEventHandler);
|
||||
}
|
||||
return typeToWindowEventHandlers[type];
|
||||
}
|
||||
function ensureHandlers(elToHandlers, el) {
|
||||
let elHandlers = elToHandlers.get(el);
|
||||
if (elHandlers === void 0) {
|
||||
elToHandlers.set(el, elHandlers = /* @__PURE__ */ new Set());
|
||||
}
|
||||
return elHandlers;
|
||||
}
|
||||
function handlerExist(el, phase, type, handler) {
|
||||
const elToHandlers = phaseToTypeToElToHandlers[phase][type];
|
||||
if (elToHandlers !== void 0) {
|
||||
const handlers = elToHandlers.get(el);
|
||||
if (handlers !== void 0) {
|
||||
if (handlers.has(handler))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function windowEventHandlerExist(type, handler) {
|
||||
const handlers = typeToWindowEventHandlers[type];
|
||||
if (handlers !== void 0) {
|
||||
if (handlers.has(handler)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function on2(type, el, handler, options) {
|
||||
let mergedHandler;
|
||||
if (typeof options === "object" && options.once === true) {
|
||||
mergedHandler = (e) => {
|
||||
off2(type, el, mergedHandler, options);
|
||||
handler(e);
|
||||
};
|
||||
} else {
|
||||
mergedHandler = handler;
|
||||
}
|
||||
const trapped = trapOn(type, el, mergedHandler, options);
|
||||
if (trapped)
|
||||
return;
|
||||
const phase = options === true || typeof options === "object" && options.capture === true ? "capture" : "bubble";
|
||||
const elToHandlers = ensureElToHandlers(phase, type);
|
||||
const handlers = ensureHandlers(elToHandlers, el);
|
||||
if (!handlers.has(mergedHandler))
|
||||
handlers.add(mergedHandler);
|
||||
if (el === window) {
|
||||
const windowEventHandlers = ensureWindowEventHandlers(type);
|
||||
if (!windowEventHandlers.has(mergedHandler)) {
|
||||
windowEventHandlers.add(mergedHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
function off2(type, el, handler, options) {
|
||||
const trapped = trapOff(type, el, handler, options);
|
||||
if (trapped)
|
||||
return;
|
||||
const capture = options === true || typeof options === "object" && options.capture === true;
|
||||
const phase = capture ? "capture" : "bubble";
|
||||
const elToHandlers = ensureElToHandlers(phase, type);
|
||||
const handlers = ensureHandlers(elToHandlers, el);
|
||||
if (el === window) {
|
||||
const mirrorPhase = capture ? "bubble" : "capture";
|
||||
if (!handlerExist(el, mirrorPhase, type, handler) && windowEventHandlerExist(type, handler)) {
|
||||
const windowEventHandlers = typeToWindowEventHandlers[type];
|
||||
windowEventHandlers.delete(handler);
|
||||
if (windowEventHandlers.size === 0) {
|
||||
window.removeEventListener(type, unfiendWindowEventHandler);
|
||||
typeToWindowEventHandlers[type] = void 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (handlers.has(handler))
|
||||
handlers.delete(handler);
|
||||
if (handlers.size === 0) {
|
||||
elToHandlers.delete(el);
|
||||
}
|
||||
if (elToHandlers.size === 0) {
|
||||
window.removeEventListener(type, unifiedHandler, phase === "capture");
|
||||
phaseToTypeToElToHandlers[phase][type] = void 0;
|
||||
}
|
||||
}
|
||||
return {
|
||||
on: on2,
|
||||
off: off2
|
||||
};
|
||||
}
|
||||
const { on, off } = createDelegate();
|
||||
export { off as a, on as o };
|
||||
1
package/component/es/_chunks/vue-demi/index.js
Normal file
1
package/component/es/_chunks/vue-demi/index.js
Normal file
@@ -0,0 +1 @@
|
||||
import "vue";
|
||||
1172
package/component/es/_chunks/vue-i18n/index.js
Normal file
1172
package/component/es/_chunks/vue-i18n/index.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user