docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Type Check & Test (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:25:58 +08:00
1 parent f954252a34
commit e311ca3275
35554 files changed
+6229626 -4

No files matched your search

@@ -0,0 +1,3 @@
export default function bigSign(bigIntValue) {
return (bigIntValue > 0n) - (bigIntValue < 0n)
}
@@ -0,0 +1,7 @@
export { ItemProps } from './item.js';
export { SectionProps } from './section.js';
export { CollectionProps } from './types.js';
export { Item as BaseItem, Section as BaseSection, PartialNode } from '@react-stately/collections';
import '@react-types/shared';
import '@heroui/system';
import 'react';
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","2":"C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t"},C:{"1":"MC YC yC zC","2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I 0C 1C","194":"XC"},D:{"1":"0 1 2 3 4 5 u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t"},E:{"1":"SC nC oC pC qC rC sC tC DD ED","2":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD"},F:{"1":"0 1 2 3 4 5 g h i j k l m n o p q r s t u v w x y z","2":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f FD GD HD ID NC uC JD OC"},G:{"1":"SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD"},H:{"2":"hD"},I:{"1":"I","2":"TC J iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"1":"9 AB BB CB DB EB FB","2":"6 7 8 J oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"2":"zD"},R:{"2":"0D"},S:{"2":"1D 2D"}},B:5,C:"View Transitions API (single-document)",D:true};
@@ -0,0 +1,493 @@
// functions
export function assertEqual(val) {
return val;
}
export function assertNotEqual(val) {
return val;
}
export function assertIs(_arg) { }
export function assertNever(_x) {
throw new Error();
}
export function assert(_) { }
export function getEnumValues(entries) {
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
const values = Object.entries(entries)
.filter(([k, _]) => numericValues.indexOf(+k) === -1)
.map(([_, v]) => v);
return values;
}
export function joinValues(array, separator = "|") {
return array.map((val) => stringifyPrimitive(val)).join(separator);
}
export function jsonStringifyReplacer(_, value) {
if (typeof value === "bigint")
return value.toString();
return value;
}
export function cached(getter) {
const set = false;
return {
get value() {
if (!set) {
const value = getter();
Object.defineProperty(this, "value", { value });
return value;
}
throw new Error("cached value already set");
},
};
}
export function nullish(input) {
return input === null || input === undefined;
}
export function cleanRegex(source) {
const start = source.startsWith("^") ? 1 : 0;
const end = source.endsWith("$") ? source.length - 1 : source.length;
return source.slice(start, end);
}
export function floatSafeRemainder(val, step) {
const valDecCount = (val.toString().split(".")[1] || "").length;
const stepDecCount = (step.toString().split(".")[1] || "").length;
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
return (valInt % stepInt) / 10 ** decCount;
}
export function defineLazy(object, key, getter) {
const set = false;
Object.defineProperty(object, key, {
get() {
if (!set) {
const value = getter();
object[key] = value;
return value;
}
throw new Error("cached value already set");
},
set(v) {
Object.defineProperty(object, key, {
value: v,
// configurable: true,
});
// object[key] = v;
},
configurable: true,
});
}
export function assignProp(target, prop, value) {
Object.defineProperty(target, prop, {
value,
writable: true,
enumerable: true,
configurable: true,
});
}
export function getElementAtPath(obj, path) {
if (!path)
return obj;
return path.reduce((acc, key) => acc?.[key], obj);
}
export function promiseAllObject(promisesObj) {
const keys = Object.keys(promisesObj);
const promises = keys.map((key) => promisesObj[key]);
return Promise.all(promises).then((results) => {
const resolvedObj = {};
for (let i = 0; i < keys.length; i++) {
resolvedObj[keys[i]] = results[i];
}
return resolvedObj;
});
}
export function randomString(length = 10) {
const chars = "abcdefghijklmnopqrstuvwxyz";
let str = "";
for (let i = 0; i < length; i++) {
str += chars[Math.floor(Math.random() * chars.length)];
}
return str;
}
export function esc(str) {
return JSON.stringify(str);
}
export const captureStackTrace = Error.captureStackTrace
? Error.captureStackTrace
: (..._args) => { };
export function isObject(data) {
return typeof data === "object" && data !== null && !Array.isArray(data);
}
export const allowsEval = cached(() => {
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
return false;
}
try {
const F = Function;
new F("");
return true;
}
catch (_) {
return false;
}
});
export function isPlainObject(o) {
if (isObject(o) === false)
return false;
// modified constructor
const ctor = o.constructor;
if (ctor === undefined)
return true;
// modified prototype
const prot = ctor.prototype;
if (isObject(prot) === false)
return false;
// ctor doesn't have static `isPrototypeOf`
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
return false;
}
return true;
}
export function numKeys(data) {
let keyCount = 0;
for (const key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
keyCount++;
}
}
return keyCount;
}
export const getParsedType = (data) => {
const t = typeof data;
switch (t) {
case "undefined":
return "undefined";
case "string":
return "string";
case "number":
return Number.isNaN(data) ? "nan" : "number";
case "boolean":
return "boolean";
case "function":
return "function";
case "bigint":
return "bigint";
case "symbol":
return "symbol";
case "object":
if (Array.isArray(data)) {
return "array";
}
if (data === null) {
return "null";
}
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
return "promise";
}
if (typeof Map !== "undefined" && data instanceof Map) {
return "map";
}
if (typeof Set !== "undefined" && data instanceof Set) {
return "set";
}
if (typeof Date !== "undefined" && data instanceof Date) {
return "date";
}
if (typeof File !== "undefined" && data instanceof File) {
return "file";
}
return "object";
default:
throw new Error(`Unknown data type: ${t}`);
}
};
export const propertyKeyTypes = new Set(["string", "number", "symbol"]);
export const primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
export function escapeRegex(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
// zod-specific utils
export function clone(inst, def, params) {
const cl = new inst._zod.constr(def ?? inst._zod.def);
if (!def || params?.parent)
cl._zod.parent = inst;
return cl;
}
export function normalizeParams(_params) {
const params = _params;
if (!params)
return {};
if (typeof params === "string")
return { error: () => params };
if (params?.message !== undefined) {
if (params?.error !== undefined)
throw new Error("Cannot specify both `message` and `error` params");
params.error = params.message;
}
delete params.message;
if (typeof params.error === "string")
return { ...params, error: () => params.error };
return params;
}
export function createTransparentProxy(getter) {
let target;
return new Proxy({}, {
get(_, prop, receiver) {
target ?? (target = getter());
return Reflect.get(target, prop, receiver);
},
set(_, prop, value, receiver) {
target ?? (target = getter());
return Reflect.set(target, prop, value, receiver);
},
has(_, prop) {
target ?? (target = getter());
return Reflect.has(target, prop);
},
deleteProperty(_, prop) {
target ?? (target = getter());
return Reflect.deleteProperty(target, prop);
},
ownKeys(_) {
target ?? (target = getter());
return Reflect.ownKeys(target);
},
getOwnPropertyDescriptor(_, prop) {
target ?? (target = getter());
return Reflect.getOwnPropertyDescriptor(target, prop);
},
defineProperty(_, prop, descriptor) {
target ?? (target = getter());
return Reflect.defineProperty(target, prop, descriptor);
},
});
}
export function stringifyPrimitive(value) {
if (typeof value === "bigint")
return value.toString() + "n";
if (typeof value === "string")
return `"${value}"`;
return `${value}`;
}
export function optionalKeys(shape) {
return Object.keys(shape).filter((k) => {
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
});
}
export const NUMBER_FORMAT_RANGES = {
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
int32: [-2147483648, 2147483647],
uint32: [0, 4294967295],
float32: [-3.4028234663852886e38, 3.4028234663852886e38],
float64: [-Number.MAX_VALUE, Number.MAX_VALUE],
};
export const BIGINT_FORMAT_RANGES = {
int64: [/* @__PURE__*/ BigInt("-9223372036854775808"), /* @__PURE__*/ BigInt("9223372036854775807")],
uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
};
export function pick(schema, mask) {
const newShape = {};
const currDef = schema._zod.def; //.shape;
for (const key in mask) {
if (!(key in currDef.shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
// pick key
newShape[key] = currDef.shape[key];
}
return clone(schema, {
...schema._zod.def,
shape: newShape,
checks: [],
});
}
export function omit(schema, mask) {
const newShape = { ...schema._zod.def.shape };
const currDef = schema._zod.def; //.shape;
for (const key in mask) {
if (!(key in currDef.shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
delete newShape[key];
}
return clone(schema, {
...schema._zod.def,
shape: newShape,
checks: [],
});
}
export function extend(schema, shape) {
if (!isPlainObject(shape)) {
throw new Error("Invalid input to extend: expected a plain object");
}
const def = {
...schema._zod.def,
get shape() {
const _shape = { ...schema._zod.def.shape, ...shape };
assignProp(this, "shape", _shape); // self-caching
return _shape;
},
checks: [], // delete existing checks
};
return clone(schema, def);
}
export function merge(a, b) {
return clone(a, {
...a._zod.def,
get shape() {
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
assignProp(this, "shape", _shape); // self-caching
return _shape;
},
catchall: b._zod.def.catchall,
checks: [], // delete existing checks
});
}
export function partial(Class, schema, mask) {
const oldShape = schema._zod.def.shape;
const shape = { ...oldShape };
if (mask) {
for (const key in mask) {
if (!(key in oldShape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
// if (oldShape[key]!._zod.optin === "optional") continue;
shape[key] = Class
? new Class({
type: "optional",
innerType: oldShape[key],
})
: oldShape[key];
}
}
else {
for (const key in oldShape) {
// if (oldShape[key]!._zod.optin === "optional") continue;
shape[key] = Class
? new Class({
type: "optional",
innerType: oldShape[key],
})
: oldShape[key];
}
}
return clone(schema, {
...schema._zod.def,
shape,
checks: [],
});
}
export function required(Class, schema, mask) {
const oldShape = schema._zod.def.shape;
const shape = { ...oldShape };
if (mask) {
for (const key in mask) {
if (!(key in shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
// overwrite with non-optional
shape[key] = new Class({
type: "nonoptional",
innerType: oldShape[key],
});
}
}
else {
for (const key in oldShape) {
// overwrite with non-optional
shape[key] = new Class({
type: "nonoptional",
innerType: oldShape[key],
});
}
}
return clone(schema, {
...schema._zod.def,
shape,
// optional: [],
checks: [],
});
}
export function aborted(x, startIndex = 0) {
for (let i = startIndex; i < x.issues.length; i++) {
if (x.issues[i]?.continue !== true)
return true;
}
return false;
}
export function prefixIssues(path, issues) {
return issues.map((iss) => {
var _a;
(_a = iss).path ?? (_a.path = []);
iss.path.unshift(path);
return iss;
});
}
export function unwrapMessage(message) {
return typeof message === "string" ? message : message?.message;
}
export function finalizeIssue(iss, ctx, config) {
const full = { ...iss, path: iss.path ?? [] };
// for backwards compatibility
if (!iss.message) {
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??
unwrapMessage(ctx?.error?.(iss)) ??
unwrapMessage(config.customError?.(iss)) ??
unwrapMessage(config.localeError?.(iss)) ??
"Invalid input";
full.message = message;
}
// delete (full as any).def;
delete full.inst;
delete full.continue;
if (!ctx?.reportInput) {
delete full.input;
}
return full;
}
export function getSizableOrigin(input) {
if (input instanceof Set)
return "set";
if (input instanceof Map)
return "map";
if (input instanceof File)
return "file";
return "unknown";
}
export function getLengthableOrigin(input) {
if (Array.isArray(input))
return "array";
if (typeof input === "string")
return "string";
return "unknown";
}
export function issue(...args) {
const [iss, input, inst] = args;
if (typeof iss === "string") {
return {
message: iss,
code: "custom",
input,
inst,
};
}
return { ...iss };
}
export function cleanEnum(obj) {
return Object.entries(obj)
.filter(([k, _]) => {
// return true if NaN, meaning it's not a number, thus a string key
return Number.isNaN(Number.parseInt(k, 10));
})
.map((el) => el[1]);
}
// instanceof
export class Class {
constructor(..._args) { }
}
@@ -0,0 +1 @@
{"name":"picomatch","version":"4.0.3","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532090032,"integrity":"sha512-iQJoeMXWqmJ6+ML4rS5/Uc95niPtI5BGjke8o2hiHatanYndkWcYZ3rCDXtNRPY5ncBKgQsUkvelrGRUZkVoWw==","mode":420,"size":1091},"lib/constants.js":{"checkedAt":1794532090033,"integrity":"sha512-KITGQyaAGevJuQ2NnD2Y8dew2s4h9qGD9Mm0X/pt7MRKxMzhAs6X+G2yJH5Y4+/qjVE+cNbAW6f9BIYwoNah/A==","mode":420,"size":4458},"index.js":{"checkedAt":1794532090033,"integrity":"sha512-dWOwoZcdtcEv969sGsoAc9OyvIzRP2rBClqwudZ0sDk9z7kxppEhWSAayEtrG5OpKllCnKZyaZ3OVB+MAyHHtg==","mode":420,"size":479},"lib/parse.js":{"checkedAt":1794532090033,"integrity":"sha512-UbNzcKq3PT97U436qq9JJUZJZuwhBmtN79TmEPsVzxyN1hksyAYk0UP0rFtyXJJ6DqS7zQhp9h6fPWVEomsgIw==","mode":420,"size":27544},"lib/picomatch.js":{"checkedAt":1794532090033,"integrity":"sha512-4aECD2sNxhZfoMbmNvXI6TrvJZB49nxw9iP0gEHeIbN0LbvuVtYIHlqOqOZ7wNoWbEoJ47DabZ2YlPyxmc0X6g==","mode":420,"size":9881},"posix.js":{"checkedAt":1794532090033,"integrity":"sha512-h8VLaD9UWTQ161k+8WOyXboqJ04n89oyNTYHwqEsw0im6aT9yeHztQxz/XtyLNM/KPCMWJY3MDTC89VKpZfcpA==","mode":420,"size":60},"lib/scan.js":{"checkedAt":1794532090034,"integrity":"sha512-w6ae9ePRbYvyCBhUhEF8IUNwOb1qJTfTqQwsHHx5Wgis1MoegEaTPMlw3Yx3GDNypYCj5bMS5rQPPBPQHJeBYw==","mode":420,"size":9189},"lib/utils.js":{"checkedAt":1794532090034,"integrity":"sha512-6VUlW8uuNGsKHYbDBLmrKSAU3I7s0GxuhUTau7G+0DjtnIiBFvceeIbd8W9TEEMkK1TGhCZQX8NLK0rYMwk9Cw==","mode":420,"size":1994},"package.json":{"checkedAt":1794532090034,"integrity":"sha512-4rZSPseOPhV77u2OW5G8nNa4C4y+umT3vXA/1UUFsNjCQwCq9g9liCrO1Dx+o3aT8rMy1QZq7jGzvmHodOk+AQ==","mode":420,"size":1953},"README.md":{"checkedAt":1794532090034,"integrity":"sha512-ErnURSGk0C6tsrkrGhGWgRhfWzLvVTGVqfSFdkmal2rBydhu3l24KG0H+DnfGR5OZLhqeSD30ohsD8xkj5cz/Q==","mode":420,"size":28608}}}
@@ -0,0 +1 @@
{"name":"@heroui/system","version":"2.4.7","requiresBuild":false,"files":{"dist/index.js":{"checkedAt":1794532106674,"integrity":"sha512-AqRYQz+rG0d15kfzM+LIhUHqEG4R+1kr7xD/6K6AGhVdM2gjOz+0IHBC2wZDO4fqAylOuLFD54mg5O8qVZiTDg==","mode":420,"size":3687},"dist/provider-context.js":{"checkedAt":1794532104138,"integrity":"sha512-QpqiXtR+L2ptnVC9NxxxbkoOmkJclLcdjlG7im5/lBr/TDUy0kmQn0iPlgMQ/AQIjDdIHC3acn/8xkN7njBr3w==","mode":420,"size":1382},"dist/provider.js":{"checkedAt":1794532106674,"integrity":"sha512-qO2OF/hqceUsh2rN1JXWhqoekdMHCq3W6jRsOdIMAbkT00UnIPkWirYRss/Fbt2t/LMNqJGTNxA49toVkuHx7g==","mode":420,"size":3037},"dist/types.js":{"checkedAt":1794532106674,"integrity":"sha512-zHwr6wjRN4F9Jn+LYLkh90/plbMEqDUWI1O7xIrRvEOnLuBvfss1KlRppRnZXPHFbSSAn8ztjpoyZldueNLh3g==","mode":420,"size":772},"package.json":{"checkedAt":1794532106675,"integrity":"sha512-robE5M5Stf04jWcW5HFr3NseIa5CV8jNQKT8w6Bh7Boeq8WqL9ZpyvHbhd9NHhiLQD2TLwfIb2pU5ClCr+femQ==","mode":420,"size":1711},"README.md":{"checkedAt":1794532106675,"integrity":"sha512-DI+jvho+IItydFZU5S6twSOXdF849u7oolIe1s3p7Ret5A83ycPAmkkzSpkE8fjivCY2TcUk8+NeFbtAU521eA==","mode":420,"size":569},"dist/chunk-6SNXZVD5.mjs":{"checkedAt":1794532106675,"integrity":"sha512-etj9uAT9ZBCksl5A+u0ryX4r20F9EAgO+enWU8V3ng7QyBbB5Y+8VJqmX7fmJCmDi9Z0+mRZpgCEjQ1QcKvA0g==","mode":420,"size":1613},"dist/chunk-Q3W45BN5.mjs":{"checkedAt":1794532104139,"integrity":"sha512-j9ci6WvI5cUj0UKfwxrRPYqlpnSPDDzS5lSjI1KjdUnjNNpmaVO8kg6HJe8whmyriJ+dhWoywDADuzWRenYxxw==","mode":420,"size":255},"dist/index.mjs":{"checkedAt":1794532106675,"integrity":"sha512-Mz9nHgJ20eBT8HRwhkhY82tDtg5VNr04RSZlEKR2EEEI53KEMIdD+5o6I6y2c6F+AJiq6cJiHEiMYsEbnkGyXQ==","mode":420,"size":495},"dist/provider-context.mjs":{"checkedAt":1794532104139,"integrity":"sha512-bYmczeBgnQIijSUcMgN51wR0k/m5CSKAHMpbPcocrsjk2ZDkrYMct1B5Z2g4sEPj+eWs+s6toQVhj23U3Qg87A==","mode":420,"size":146},"dist/provider.mjs":{"checkedAt":1794532106675,"integrity":"sha512-PDli16WsK2qIr53CH9hWIyswhyTlIPU8iP/qAdCZqUcdMeJ1gM3dPJOl812iW2RgBZClnhS1teWoZSbIZsmqUQ==","mode":420,"size":131},"dist/types.mjs":{"checkedAt":1794532106676,"integrity":"sha512-Azoe1jHHrN2TpabriCoWboH1l1Av6LEY4/ETJACsjHRcZb8oajjSapVOGP/eoJYyeDHdsa9dl80+gtO/Oc8Q+A==","mode":420,"size":14},"dist/index.d.ts":{"checkedAt":1794532106676,"integrity":"sha512-UpLOoQJPZSAmVd4avuuf3GUoU4p7DA++i4JECV9jGUxOk9Zg4ZBJEqr4Ab2fKnKGWRcscNr5dfeV903vQCMmNg==","mode":420,"size":799},"dist/provider-context.d.ts":{"checkedAt":1794532106676,"integrity":"sha512-U4dVnjtY1ynK6d963SyFo54vIrcetNxoxlfqcU6m67HaGn05QgtsbdMRXUfzPlA9v2G6AQqn+vQ0GR+JYm8Lrw==","mode":420,"size":3329},"dist/provider.d.ts":{"checkedAt":1794532106676,"integrity":"sha512-iLDv1q3niq1zPOUj5AjisCNT+ii3sLp+PxtV/ODdE+SulEiqrmTw/a/lZbnMuxIu2JQ7WPDOi7ttqxIAtAf7NA==","mode":420,"size":2177},"dist/types.d.ts":{"checkedAt":1794532106676,"integrity":"sha512-qzAKPJmkxeJ4M8s44MgLid6IPjzy0F51LCgcxSttiP3ccM93d+keqWirYbmgrQGz9ZOzUL7nF7Ujav22fFkZYA==","mode":420,"size":277},"LICENSE":{"checkedAt":1794532104252,"integrity":"sha512-eaopHP+N4EYXlGoX9hmoxDPoVft4BqrXKmbsFTcsoBHSrJp/GWF4qVtLBzrw9h9ZrbFfPY69z+3RuDX9FdPG+Q==","mode":420,"size":1064}}}
@@ -0,0 +1,59 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = exports.EventEmitter = void 0;
var _tslib = require("tslib");
var _react = require("react");
var EventEmitter = exports.EventEmitter = /** @class */function () {
function EventEmitter() {
var _this = this;
this.subscriptions = new Set();
this.emit = function (val) {
var e_1, _a;
try {
for (var _b = (0, _tslib.__values)(_this.subscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
var subscription = _c.value;
subscription(val);
}
} catch (e_1_1) {
e_1 = {
error: e_1_1
};
} finally {
try {
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
} finally {
if (e_1) throw e_1.error;
}
}
};
this.useSubscription = function (callback) {
// eslint-disable-next-line react-hooks/rules-of-hooks
var callbackRef = (0, _react.useRef)(undefined);
callbackRef.current = callback;
// eslint-disable-next-line react-hooks/rules-of-hooks
(0, _react.useEffect)(function () {
function subscription(val) {
if (callbackRef.current) {
callbackRef.current(val);
}
}
_this.subscriptions.add(subscription);
return function () {
_this.subscriptions["delete"](subscription);
};
}, []);
};
}
return EventEmitter;
}();
function useEventEmitter() {
var ref = (0, _react.useRef)(undefined);
if (!ref.current) {
ref.current = new EventEmitter();
}
return ref.current;
}
var _default = exports["default"] = useEventEmitter;
@@ -0,0 +1,4 @@
declare class ColorError extends Error {
constructor(color: string);
}
export default ColorError;
@@ -0,0 +1,93 @@
"use client";
// src/utils.ts
import { useContext, useMemo, useRef, useCallback } from "react";
import { mergeProps, mergeRefs } from "@heroui/shared-utils";
var DEFAULT_SLOT = Symbol("default");
function useObjectRef(ref) {
const objRef = useRef(null);
const cleanupRef = useRef(void 0);
const refEffect = useCallback(
(instance) => {
if (typeof ref === "function") {
const refCallback = ref;
const refCleanup = refCallback(instance);
return () => {
if (typeof refCleanup === "function") {
refCleanup();
} else {
refCallback(null);
}
};
} else if (ref) {
ref.current = instance;
return () => {
ref.current = null;
};
}
},
[ref]
);
return useMemo(
() => ({
get current() {
return objRef.current;
},
set current(value) {
objRef.current = value;
if (cleanupRef.current) {
cleanupRef.current();
cleanupRef.current = void 0;
}
if (value != null) {
cleanupRef.current = refEffect(value);
}
}
}),
[refEffect]
);
}
function useSlottedContext(context, slot) {
let ctx = useContext(context);
if (slot === null) {
return null;
}
if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p) => `"${p}"`));
if (!slot && !ctx.slots[DEFAULT_SLOT]) {
throw new Error(`A slot prop is required. Valid slot names are ${availableSlots}.`);
}
let slotKey = slot || DEFAULT_SLOT;
if (!ctx.slots[slotKey]) {
throw new Error(`Invalid slot "${slot}". Valid slot names are ${availableSlots}.`);
}
return ctx.slots[slotKey];
}
return ctx;
}
function useContextProps(props, ref, context) {
let ctx = useSlottedContext(context, props.slot) || {};
let { ref: contextRef, ...contextProps } = ctx;
let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));
let mergedProps = mergeProps(contextProps, props);
if ("style" in contextProps && contextProps.style && "style" in props && props.style) {
if (typeof contextProps.style === "function" || typeof props.style === "function") {
mergedProps.style = (renderProps) => {
let contextStyle = typeof contextProps.style === "function" ? contextProps.style(renderProps) : contextProps.style;
let defaultStyle = { ...renderProps.defaultStyle, ...contextStyle };
let style = typeof props.style === "function" ? props.style({ ...renderProps, defaultStyle }) : props.style;
return { ...defaultStyle, ...style };
};
} else {
mergedProps.style = { ...contextProps.style, ...props.style };
}
}
return [mergedProps, mergedRef];
}
export {
DEFAULT_SLOT,
useObjectRef,
useSlottedContext,
useContextProps
};
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","2":"C L M G N O P","66":"Q H R S T U V W X"},C:{"2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C"},D:{"1":"0 1 2 3 4 5 Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC","66":"LC Q H R S T U V W X"},E:{"2":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED"},F:{"1":"0 1 2 3 4 5 JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B FD GD HD ID NC uC JD OC","66":"9B AC BC CC DC EC FC GC HC IC"},G:{"2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC"},H:{"2":"hD"},I:{"2":"TC J I iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"2":"A B C H NC uC OC"},L:{"2":"I"},M:{"2":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"2":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"2":"zD"},R:{"2":"0D"},S:{"2":"1D 2D"}},B:7,C:"WebHID API",D:true};
@@ -0,0 +1,219 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
const astIgnoreKeys = new Set(['loc', 'parent', 'range']);
const isSameAstNode = (actualNode, expectedNode) => {
if (actualNode === expectedNode) {
return true;
}
if (actualNode &&
expectedNode &&
typeof actualNode === 'object' &&
typeof expectedNode === 'object') {
if (Array.isArray(actualNode) && Array.isArray(expectedNode)) {
if (actualNode.length !== expectedNode.length) {
return false;
}
return !actualNode.some((nodeEle, index) => !isSameAstNode(nodeEle, expectedNode[index]));
}
const actualNodeKeys = Object.keys(actualNode).filter(key => !astIgnoreKeys.has(key));
const expectedNodeKeys = Object.keys(expectedNode).filter(key => !astIgnoreKeys.has(key));
if (actualNodeKeys.length !== expectedNodeKeys.length) {
return false;
}
if (actualNodeKeys.some(actualNodeKey => !Object.hasOwn(expectedNode, actualNodeKey))) {
return false;
}
if (actualNodeKeys.some(actualNodeKey => !isSameAstNode(actualNode[actualNodeKey], expectedNode[actualNodeKey]))) {
return false;
}
return true;
}
return false;
};
exports.default = (0, util_1.createRule)({
name: 'no-duplicate-type-constituents',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow duplicate constituents of union or intersection types',
recommended: 'recommended',
requiresTypeChecking: true,
},
fixable: 'code',
messages: {
duplicate: '{{type}} type constituent is duplicated with {{previous}}.',
unnecessary: 'Explicit undefined is unnecessary on an optional parameter.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
ignoreIntersections: {
type: 'boolean',
description: 'Whether to ignore `&` intersections.',
},
ignoreUnions: {
type: 'boolean',
description: 'Whether to ignore `|` unions.',
},
},
},
],
},
defaultOptions: [
{
ignoreIntersections: false,
ignoreUnions: false,
},
],
create(context, [{ ignoreIntersections, ignoreUnions }]) {
const parserServices = (0, util_1.getParserServices)(context);
const { sourceCode } = context;
function report(messageId, constituentNode, data) {
const getUnionOrIntersectionToken = (where, at) => sourceCode[`getTokens${where}`](constituentNode, {
filter: token => ['&', '|'].includes(token.value) &&
constituentNode.parent.range[0] <= token.range[0] &&
token.range[1] <= constituentNode.parent.range[1],
}).at(at);
const beforeUnionOrIntersectionToken = getUnionOrIntersectionToken('Before', -1);
let afterUnionOrIntersectionToken;
let bracketBeforeTokens;
let bracketAfterTokens;
if (beforeUnionOrIntersectionToken) {
bracketBeforeTokens = sourceCode.getTokensBetween(beforeUnionOrIntersectionToken, constituentNode);
bracketAfterTokens = sourceCode.getTokensAfter(constituentNode, {
count: bracketBeforeTokens.length,
});
}
else {
afterUnionOrIntersectionToken = (0, util_1.nullThrows)(getUnionOrIntersectionToken('After', 0), util_1.NullThrowsReasons.MissingToken('union or intersection token', 'duplicate type constituent'));
bracketAfterTokens = sourceCode.getTokensBetween(constituentNode, afterUnionOrIntersectionToken);
bracketBeforeTokens = sourceCode.getTokensBefore(constituentNode, {
count: bracketAfterTokens.length,
});
}
context.report({
loc: {
start: constituentNode.loc.start,
end: (bracketAfterTokens.at(-1) ?? constituentNode).loc.end,
},
node: constituentNode,
messageId,
data,
fix: fixer => [
beforeUnionOrIntersectionToken,
...bracketBeforeTokens,
constituentNode,
...bracketAfterTokens,
afterUnionOrIntersectionToken,
].flatMap(token => (token ? fixer.remove(token) : [])),
});
}
function checkDuplicateRecursively(unionOrIntersection, constituentNode, uniqueConstituents, cachedTypeMap, forEachNodeType) {
const type = parserServices.getTypeAtLocation(constituentNode);
if (tsutils.isIntrinsicErrorType(type)) {
return;
}
const duplicatedPrevious = uniqueConstituents.find(ele => isSameAstNode(ele, constituentNode)) ??
cachedTypeMap.get(type);
if (duplicatedPrevious) {
report('duplicate', constituentNode, {
type: unionOrIntersection,
previous: sourceCode.getText(duplicatedPrevious),
});
return;
}
forEachNodeType?.(type, constituentNode);
cachedTypeMap.set(type, constituentNode);
uniqueConstituents.push(constituentNode);
if ((unionOrIntersection === 'Union' &&
constituentNode.type === utils_1.AST_NODE_TYPES.TSUnionType) ||
(unionOrIntersection === 'Intersection' &&
constituentNode.type === utils_1.AST_NODE_TYPES.TSIntersectionType)) {
for (const constituent of constituentNode.types) {
checkDuplicateRecursively(unionOrIntersection, constituent, uniqueConstituents, cachedTypeMap, forEachNodeType);
}
}
}
function checkDuplicate(node, forEachNodeType) {
const cachedTypeMap = new Map();
const uniqueConstituents = [];
const unionOrIntersection = node.type === utils_1.AST_NODE_TYPES.TSIntersectionType
? 'Intersection'
: 'Union';
for (const type of node.types) {
checkDuplicateRecursively(unionOrIntersection, type, uniqueConstituents, cachedTypeMap, forEachNodeType);
}
}
return {
...(!ignoreIntersections && {
TSIntersectionType(node) {
if (node.parent.type === utils_1.AST_NODE_TYPES.TSIntersectionType) {
return;
}
checkDuplicate(node);
},
}),
...(!ignoreUnions && {
TSUnionType: (node) => {
if (node.parent.type === utils_1.AST_NODE_TYPES.TSUnionType) {
return;
}
checkDuplicate(node, (constituentNodeType, constituentNode) => {
const maybeTypeAnnotation = node.parent;
if (maybeTypeAnnotation.type === utils_1.AST_NODE_TYPES.TSTypeAnnotation) {
const maybeIdentifier = maybeTypeAnnotation.parent;
if (maybeIdentifier.type === utils_1.AST_NODE_TYPES.Identifier &&
maybeIdentifier.optional) {
const maybeFunction = maybeIdentifier.parent;
if ((0, util_1.isFunctionOrFunctionType)(maybeFunction) &&
maybeFunction.params.includes(maybeIdentifier) &&
tsutils.isTypeFlagSet(constituentNodeType, ts.TypeFlags.Undefined)) {
report('unnecessary', constituentNode);
}
}
}
});
},
}),
};
},
});
@@ -0,0 +1,16 @@
import type * as TSESLint from '../../ts-eslint';
import type { TSESTree } from '../../ts-estree';
/**
* Get the variable of a given name.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#findvariable}
*/
export declare const findVariable: (initialScope: TSESLint.Scope.Scope, nameOrNode: string | TSESTree.Identifier) => TSESLint.Scope.Variable | null;
/**
* Get the innermost scope which contains a given node.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#getinnermostscope}
* @returns The innermost scope which contains the given node.
* If such scope doesn't exist then it returns the 1st argument `initialScope`.
*/
export declare const getInnermostScope: (initialScope: TSESLint.Scope.Scope, node: TSESTree.Node) => TSESLint.Scope.Scope;
@@ -0,0 +1,139 @@
import { createRequire } from 'node:module';
import path from 'node:path';
import { cjsRequire } from '../require.js';
import { pkgDir } from './pkg-dir.js';
import { IMPORT_RESOLVE_ERROR_NAME } from './resolve.js';
export function resolveWithLegacyResolver(resolver, config, modulePath, sourceFile) {
if (resolver.interfaceVersion === 2) {
return resolver.resolve(modulePath, sourceFile, config);
}
try {
const resolved = resolver.resolveImport(modulePath, sourceFile, config);
if (resolved === undefined) {
return {
found: false,
};
}
return {
found: true,
path: resolved,
};
}
catch {
return {
found: false,
};
}
}
export function normalizeConfigResolvers(resolvers, sourceFile) {
const resolverArray = Array.isArray(resolvers) ? resolvers : [resolvers];
const map = new Map();
for (const nameOrRecordOrObject of resolverArray) {
if (typeof nameOrRecordOrObject === 'string') {
const name = nameOrRecordOrObject;
map.set(name, {
name,
enable: true,
options: undefined,
resolver: requireResolver(name, sourceFile),
});
}
else if (typeof nameOrRecordOrObject === 'object') {
if (nameOrRecordOrObject.name && nameOrRecordOrObject.resolver) {
const object = nameOrRecordOrObject;
const { name, enable = true, options, resolver } = object;
map.set(name, { name, enable, options, resolver });
}
else {
const record = nameOrRecordOrObject;
for (const [name, enableOrOptions] of Object.entries(record)) {
const resolver = requireResolver(name, sourceFile);
if (typeof enableOrOptions === 'boolean') {
map.set(name, {
name,
enable: enableOrOptions,
options: undefined,
resolver,
});
}
else {
map.set(name, {
name,
enable: true,
options: enableOrOptions,
resolver,
});
}
}
}
}
else {
const err = new Error('invalid resolver config');
err.name = IMPORT_RESOLVE_ERROR_NAME;
throw err;
}
}
return [...map.values()];
}
export const LEGACY_NODE_RESOLVERS = new Set([
'node',
'eslint-import-resolver-node',
]);
try {
LEGACY_NODE_RESOLVERS.add(cjsRequire.resolve('eslint-import-resolver-node'));
}
catch {
}
function requireResolver(name, sourceFile) {
const resolver = tryRequire(`eslint-import-resolver-${name}`, sourceFile) ||
tryRequire(name, sourceFile) ||
tryRequire(path.resolve(getBaseDir(sourceFile), name));
if (!resolver) {
if (LEGACY_NODE_RESOLVERS.has(name)) {
return undefined;
}
const err = new Error(`unable to load resolver "${name}".`);
err.name = IMPORT_RESOLVE_ERROR_NAME;
throw err;
}
if (!isLegacyResolverValid(resolver)) {
const err = new Error(`${name} with invalid interface loaded as resolver`);
err.name = IMPORT_RESOLVE_ERROR_NAME;
throw err;
}
return resolver;
}
function isLegacyResolverValid(resolver) {
if ('interfaceVersion' in resolver && resolver.interfaceVersion === 2) {
return ('resolve' in resolver &&
!!resolver.resolve &&
typeof resolver.resolve === 'function');
}
return ('resolveImport' in resolver &&
!!resolver.resolveImport &&
typeof resolver.resolveImport === 'function');
}
function tryRequire(target, sourceFile) {
let resolved;
try {
if (sourceFile == null) {
resolved = cjsRequire.resolve(target);
}
else {
try {
resolved = createRequire(path.resolve(sourceFile)).resolve(target);
}
catch {
resolved = cjsRequire.resolve(target);
}
}
}
catch {
return undefined;
}
return cjsRequire(resolved);
}
function getBaseDir(sourceFile) {
return pkgDir(sourceFile) || process.cwd();
}
//# sourceMappingURL=legacy-resolver-settings.js.map
@@ -0,0 +1,45 @@
/**
* @fileoverview Define the cursor which iterates tokens only, with inflated range.
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const ForwardTokenCursor = require("./forward-token-cursor");
//------------------------------------------------------------------------------
// Exports
//------------------------------------------------------------------------------
/**
* The cursor which iterates tokens only, with inflated range.
* This is for the backward compatibility of padding options.
*/
module.exports = class PaddedTokenCursor extends ForwardTokenCursor {
/**
* Initializes this cursor.
* @param {Token[]} tokens The array of tokens.
* @param {Comment[]} comments The array of comments.
* @param {Object} indexMap The map from locations to indices in `tokens`.
* @param {number} startLoc The start location of the iteration range.
* @param {number} endLoc The end location of the iteration range.
* @param {number} beforeCount The number of tokens this cursor iterates before start.
* @param {number} afterCount The number of tokens this cursor iterates after end.
*/
constructor(
tokens,
comments,
indexMap,
startLoc,
endLoc,
beforeCount,
afterCount,
) {
super(tokens, comments, indexMap, startLoc, endLoc);
this.index = Math.max(0, this.index - beforeCount);
this.indexEnd = Math.min(tokens.length - 1, this.indexEnd + afterCount);
}
};
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,uCATW,aAAa,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAC,CAAC,UAElD,KAAK,CAAC,KAAK,CAAC,WAEZ,eAAe,GAEb,KAAK,CAAC,KAAK,CAAC,CAkBxB;8BA9BkD,sBAAsB;2BAAtB,sBAAsB;qCAAtB,sBAAsB"}
@@ -0,0 +1,59 @@
{
"name": "@heroui/use-draggable",
"version": "2.1.3",
"description": "This hook can provide drag and drop interaction",
"keywords": [
"use-draggable"
],
"author": "Junior Garcia <jrgarciadev@gmail.com>",
"homepage": "https://heroui.com",
"license": "MIT",
"main": "dist/index.js",
"sideEffects": false,
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/heroui-inc/heroui.git",
"directory": "packages/hooks/use-draggable"
},
"bugs": {
"url": "https://github.com/heroui-inc/heroui/issues"
},
"peerDependencies": {
"react": ">=18 || >=19.0.0-rc.0"
},
"clean-package": "../../../clean-package.config.json",
"tsup": {
"clean": true,
"target": "es2019",
"format": [
"cjs",
"esm"
]
},
"dependencies": {
"@react-aria/interactions": "3.22.5"
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsup src --dts",
"build:fast": "tsup src",
"dev": "pnpm build:fast --watch",
"clean": "rimraf dist .turbo",
"typecheck": "tsc --noEmit"
}
}
@@ -0,0 +1,38 @@
'use strict';
// https://262.ecma-international.org/16.0/#table-the-typedarray-constructors
module.exports = {
__proto__: null,
name: {
__proto__: null,
$Int8Array: 'INT8',
$Uint8Array: 'UINT8',
$Uint8ClampedArray: 'UINT8C',
$Int16Array: 'INT16',
$Uint16Array: 'UINT16',
$Int32Array: 'INT32',
$Uint32Array: 'UINT32',
$BigInt64Array: 'BIGINT64',
$BigUint64Array: 'BIGUINT64',
$Float16Array: 'FLOAT16',
$Float32Array: 'FLOAT32',
$Float64Array: 'FLOAT64'
},
size: {
__proto__: null,
$INT8: 1,
$UINT8: 1,
$UINT8C: 1,
$INT16: 2,
$UINT16: 2,
$INT32: 4,
$UINT32: 4,
$BIGINT64: 8,
$BIGUINT64: 8,
$FLOAT16: 2,
$FLOAT32: 4,
$FLOAT64: 8
},
choices: '"INT8", "UINT8", "UINT8C", "INT16", "UINT16", "INT32", "UINT32", "BIGINT64", "BIGUINT64", "FLOAT16", "FLOAT32", or "FLOAT64"'
};
@@ -0,0 +1,214 @@
'use strict'
// Copyright (c) 2018 inspiredware
var path = require('path')
var pkg = require(path.resolve('package.json'))
var versionArray = process.version
.substr(1)
.replace(/-.*$/, '')
.split('.')
.map(function (item) {
return +item
})
/**
*
* A set of utilities to assist developers of tools that build
* [N-API](https://nodejs.org/api/n-api.html#n_api_n_api) native add-ons.
*
* The main repository can be found
* [here](https://github.com/inspiredware/napi-build-utils#napi-build-utils).
*
* @module napi-build-utils
*/
/**
* Implements a consistent name of `napi` for N-API runtimes.
*
* @param {string} runtime The runtime string.
* @returns {boolean}
*/
exports.isNapiRuntime = function (runtime) {
return runtime === 'napi'
}
/**
* Determines whether the specified N-API version is supported
* by both the currently running Node instance and the package.
*
* @param {string} napiVersion The N-API version to check.
* @returns {boolean}
*/
exports.isSupportedVersion = function (napiVersion) {
var version = parseInt(napiVersion, 10)
return version <= exports.getNapiVersion() && exports.packageSupportsVersion(version)
}
/**
* Determines whether the specified N-API version is supported by the package.
* The N-API version must be present in the `package.json`
* `binary.napi_versions` array.
*
* @param {number} napiVersion The N-API version to check.
* @returns {boolean}
* @private
*/
exports.packageSupportsVersion = function (napiVersion) {
if (pkg.binary && pkg.binary.napi_versions &&
pkg.binary.napi_versions instanceof Array) { // integer array
for (var i = 0; i < pkg.binary.napi_versions.length; i++) {
if (pkg.binary.napi_versions[i] === napiVersion) return true
};
};
return false
}
/**
* Issues a warning to the supplied log if the N-API version is not supported
* by the current Node instance or if the N-API version is not supported
* by the package.
*
* @param {string} napiVersion The N-API version to check.
* @param {Object} log The log object to which the warnings are to be issued.
* Must implement the `warn` method.
*/
exports.logUnsupportedVersion = function (napiVersion, log) {
if (!exports.isSupportedVersion(napiVersion)) {
if (exports.packageSupportsVersion(napiVersion)) {
log.warn('This Node instance does not support N-API version ' + napiVersion)
} else {
log.warn('This package does not support N-API version ' + napiVersion)
}
}
}
/**
* Issues warnings to the supplied log for those N-API versions not supported
* by the N-API runtime or the package.
*
* Note that this function is specific to the
* [`prebuild`](https://github.com/prebuild/prebuild#prebuild) package.
*
* `target` is the list of targets to be built and is determined in one of
* three ways from the command line arguments:
* (1) `--target` specifies a specific target to build.
* (2) `--all` specifies all N-API versions supported by the package.
* (3) Neither of these specifies to build the single "best version available."
*
* `prebuild` is an array of objects in the form `{runtime: 'napi', target: '2'}`.
* The array contains the list of N-API versions that are supported by both the
* package being built and the currently running Node instance.
*
* The objective of this function is to issue a warning for those items that appear
* in the `target` argument but not in the `prebuild` argument.
* If a specific target is supported by the package (`packageSupportsVersion`) but
* but note in `prebuild`, the assumption is that the target is not supported by
* Node.
*
* @param {(Array<string>|string)} target The N-API version(s) to check. Target is
* @param {Array<Object>} prebuild A config object created by the `prebuild` package.
* @param {Object} log The log object to which the warnings are to be issued.
* Must implement the `warn` method.
* @private
*/
exports.logMissingNapiVersions = function (target, prebuild, log) {
if (exports.getNapiBuildVersions()) {
var targets = [].concat(target)
targets.forEach(function (napiVersion) {
if (!prebuildExists(prebuild, napiVersion)) {
if (exports.packageSupportsVersion(parseInt(napiVersion, 10))) {
log.warn('This Node instance does not support N-API version ' + napiVersion)
} else {
log.warn('This package does not support N-API version ' + napiVersion)
}
}
})
} else {
log.error('Builds with runtime \'napi\' require a binary.napi_versions ' +
'property on the package.json file')
}
}
/**
* Determines whether the specified N-API version exists in the prebuild
* configuration object.
*
* Note that this function is specific to the `prebuild` and `prebuild-install`
* packages.
*
* @param {Object} prebuild A config object created by the `prebuild` package.
* @param {string} napiVersion The N-APi version to be checked.
* @return {boolean}
* @private
*/
var prebuildExists = function (prebuild, napiVersion) {
if (prebuild) {
for (var i = 0; i < prebuild.length; i++) {
if (prebuild[i].target === napiVersion) return true
}
}
return false
}
/**
* Returns the best N-API version to build given the highest N-API
* version supported by the current Node instance and the N-API versions
* supported by the package, or undefined if a suitable N-API version
* cannot be determined.
*
* The best build version is the greatest N-API version supported by
* the package that is less than or equal to the highest N-API version
* supported by the current Node instance.
*
* @returns {number|undefined}
*/
exports.getBestNapiBuildVersion = function () {
var bestNapiBuildVersion = 0
var napiBuildVersions = exports.getNapiBuildVersions(pkg) // array of integer strings
if (napiBuildVersions) {
var ourNapiVersion = exports.getNapiVersion()
napiBuildVersions.forEach(function (napiBuildVersionStr) {
var napiBuildVersion = parseInt(napiBuildVersionStr, 10)
if (napiBuildVersion > bestNapiBuildVersion &&
napiBuildVersion <= ourNapiVersion) {
bestNapiBuildVersion = napiBuildVersion
}
})
}
return bestNapiBuildVersion === 0 ? undefined : bestNapiBuildVersion
}
/**
* Returns an array of N-API versions supported by the package.
*
* @returns {Array<string>|undefined}
*/
exports.getNapiBuildVersions = function () {
var napiBuildVersions = []
// remove duplicates, convert to text
if (pkg.binary && pkg.binary.napi_versions) {
pkg.binary.napi_versions.forEach(function (napiVersion) {
var duplicated = napiBuildVersions.indexOf('' + napiVersion) !== -1
if (!duplicated) {
napiBuildVersions.push('' + napiVersion)
}
})
}
return napiBuildVersions.length ? napiBuildVersions : undefined
}
/**
* Returns the highest N-API version supported by the current node instance
* or undefined if N-API is not supported.
*
* @returns {string|undefined}
*/
exports.getNapiVersion = function () {
var version = process.versions.napi // integer string, can be undefined
if (!version) { // this code should never need to be updated
if (versionArray[0] === 9 && versionArray[1] >= 3) version = '2' // 9.3.0+
else if (versionArray[0] === 8) version = '1' // 8.0.0+
}
return version
}
@@ -0,0 +1,47 @@
Node.js is licensed for use as follows:
"""
Copyright Node.js contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
"""
This license applies to parts of Node.js originating from the
https://github.com/joyent/node repository:
"""
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
"""
@@ -0,0 +1,83 @@
const { Transform } = require('readable-stream')
function inherits (fn, sup) {
fn.super_ = sup
fn.prototype = Object.create(sup.prototype, {
constructor: { value: fn, enumerable: false, writable: true, configurable: true }
})
}
// create a new export function, used by both the main export and
// the .ctor export, contains common logic for dealing with arguments
function through2 (construct) {
return (options, transform, flush) => {
if (typeof options === 'function') {
flush = transform
transform = options
options = {}
}
if (typeof transform !== 'function') {
// noop
transform = (chunk, enc, cb) => cb(null, chunk)
}
if (typeof flush !== 'function') {
flush = null
}
return construct(options, transform, flush)
}
}
// main export, just make me a transform stream!
const make = through2((options, transform, flush) => {
const t2 = new Transform(options)
t2._transform = transform
if (flush) {
t2._flush = flush
}
return t2
})
// make me a reusable prototype that I can `new`, or implicitly `new`
// with a constructor call
const ctor = through2((options, transform, flush) => {
function Through2 (override) {
if (!(this instanceof Through2)) {
return new Through2(override)
}
this.options = Object.assign({}, options, override)
Transform.call(this, this.options)
this._transform = transform
if (flush) {
this._flush = flush
}
}
inherits(Through2, Transform)
return Through2
})
const obj = through2(function (options, transform, flush) {
const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options))
t2._transform = transform
if (flush) {
t2._flush = flush
}
return t2
})
module.exports = make
module.exports.ctor = ctor
module.exports.obj = obj
@@ -0,0 +1,98 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addServiceNodeBindingIfContextFree = addServiceNodeBindingIfContextFree;
const BindingConstraintsImplementation_1 = require("../../binding/models/BindingConstraintsImplementation");
const isStackOverflowError_1 = require("../../error/calculations/isStackOverflowError");
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError");
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind");
const LazyPlanServiceNode_1 = require("../models/LazyPlanServiceNode");
const curryBuildServiceNodeBindings_1 = require("./curryBuildServiceNodeBindings");
const curryLazyBuildPlanServiceNodeFromClassElementMetadata_1 = require("./curryLazyBuildPlanServiceNodeFromClassElementMetadata");
const curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata_1 = require("./curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata");
const currySubplan_1 = require("./currySubplan");
const plan_1 = require("./plan");
const subplan = (0, currySubplan_1.currySubplan)(plan_1.buildPlanServiceNodeFromClassElementMetadata, plan_1.buildPlanServiceNodeFromResolvedValueElementMetadata, circularLazyBuildPlanServiceNodeFromClassElementMetadata, circularLazyBuildPlanServiceNodeFromResolvedValueElementMetadata);
const buildServiceNodeBindings = (0, curryBuildServiceNodeBindings_1.curryBuildServiceNodeBindings)(subplan);
const lazyBuildPlanServiceNodeFromClassElementMetadata = (0, curryLazyBuildPlanServiceNodeFromClassElementMetadata_1.curryLazyBuildPlanServiceNodeFromClassElementMetadata)(buildServiceNodeBindings);
const lazyBuildPlanServiceNodeFromResolvedValueElementMetadata = (0, curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata_1.curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata)(buildServiceNodeBindings);
function circularLazyBuildPlanServiceNodeFromClassElementMetadata(params, bindingConstraintsList, elementMetadata) {
return lazyBuildPlanServiceNodeFromClassElementMetadata(params, bindingConstraintsList, elementMetadata);
}
function circularLazyBuildPlanServiceNodeFromResolvedValueElementMetadata(params, bindingConstraintsList, elementMetadata) {
return lazyBuildPlanServiceNodeFromResolvedValueElementMetadata(params, bindingConstraintsList, elementMetadata);
}
/**
* Attach a binding to a service node if the binding is context-free.
* @param params The plan parameters.
* @param serviceNode The service node to attach the binding to.
* @param binding The binding to attach.
* @param bindingConstraintsList The list of binding constraints.
* @param chainedBindings Whether the bindings are chained.
* @returns True if the binding requires ancestor metadata, false otherwise.
*/
function addServiceNodeBindingIfContextFree(params, serviceNode, binding, bindingConstraintsList, chainedBindings) {
if (LazyPlanServiceNode_1.LazyPlanServiceNode.is(serviceNode) && !serviceNode.isExpanded()) {
return {
isContextFreeBinding: true,
shouldInvalidateServiceNode: false,
};
}
const bindingConstraints = new BindingConstraintsImplementation_1.BindingConstraintsImplementation(bindingConstraintsList.last);
if (!binding.isSatisfiedBy(bindingConstraints) ||
bindingConstraintsList.last.elem.getAncestorsCalled) {
return {
isContextFreeBinding: !bindingConstraintsList.last.elem.getAncestorsCalled,
shouldInvalidateServiceNode: false,
};
}
return addServiceNodeSatisfiedBindingIfContextFree(params, serviceNode, binding, bindingConstraintsList, chainedBindings);
}
function addServiceNodeSatisfiedBindingIfContextFree(params, serviceNode, binding, bindingConstraintsList, chainedBindings) {
let serviceNodeBinding;
try {
[serviceNodeBinding] = buildServiceNodeBindings(params, bindingConstraintsList, [binding], serviceNode, chainedBindings);
}
catch (error) {
if ((0, isStackOverflowError_1.isStackOverflowError)(error)) {
/**
* We could potentially detect if we managed to traverse at least one iteration of the circular dependency loop.
* If so, the binding is context free if and only if bindingConstraintsList.last.elem.getAncestorsCalled is false.
*
* Having said that, computing this does not solve an underlying issue with circular dependencies: further cache
* refreshes are likely to encounter the same issue again and again. Recovering from stack overflow errors constantly
* is not feasible, so we prefer to declare the binding as non context free, asking for a more aggressive cache
* invalidation strategy, which is likely to be a cache clear.
*/
return {
isContextFreeBinding: false,
shouldInvalidateServiceNode: true,
};
}
throw error;
}
return addServiceNodeBindingNodeIfContextFree(serviceNode, serviceNodeBinding);
}
function addServiceNodeBindingNodeIfContextFree(serviceNode, serviceNodeBinding) {
if (Array.isArray(serviceNode.bindings)) {
serviceNode.bindings.push(serviceNodeBinding);
}
else {
if (serviceNode.bindings === undefined) {
serviceNode.bindings = serviceNodeBinding;
}
else {
if (!LazyPlanServiceNode_1.LazyPlanServiceNode.is(serviceNode)) {
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.planning, 'Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue');
}
return {
isContextFreeBinding: true,
shouldInvalidateServiceNode: true,
};
}
}
return {
isContextFreeBinding: true,
shouldInvalidateServiceNode: false,
};
}
//# sourceMappingURL=addServiceNodeBindingIfContextFree.js.map
@@ -0,0 +1,48 @@
import { PluginFunc } from 'dayjs/esm'
declare const plugin: PluginFunc
export = plugin
declare module 'dayjs/esm' {
interface Dayjs {
set(argument: object): Dayjs
add(argument: object): Dayjs
subtract(argument: object): Dayjs
}
interface ConfigTypeMap {
objectSupport: {
years?: number | string;
year?: number | string;
y?: number | string;
months?: number | string;
month?: number | string;
M?: number | string;
days?: number | string;
day?: number | string;
d?: number | string;
dates?: number | string;
date?: number | string;
D?: number | string;
hours?: number | string;
hour?: number | string;
h?: number | string;
minutes?: number | string;
minute?: number | string;
m?: number | string;
seconds?: number | string;
second?: number | string;
s?: number | string;
milliseconds?: number | string;
millisecond?: number | string;
ms?: number | string;
}
}
}
@@ -0,0 +1,825 @@
"use client";
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/listbox.tsx
var listbox_exports = {};
__export(listbox_exports, {
default: () => listbox_default
});
module.exports = __toCommonJS(listbox_exports);
var import_system5 = require("@heroui/system");
var import_utils4 = require("@react-aria/utils");
// src/use-listbox.ts
var import_listbox = require("@react-aria/listbox");
var import_system = require("@heroui/system");
var import_theme = require("@heroui/theme");
var import_list = require("@react-stately/list");
var import_react_utils = require("@heroui/react-utils");
var import_react = require("react");
var import_shared_utils = require("@heroui/shared-utils");
function useListbox(props) {
var _a;
const globalContext = (0, import_system.useProviderContext)();
const {
ref,
as,
state: propState,
variant,
color,
onAction,
children,
onSelectionChange,
disableAnimation = (_a = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a : false,
itemClasses,
className,
topContent,
bottomContent,
emptyContent = "No items.",
hideSelectedIcon = false,
hideEmptyContent = false,
shouldHighlightOnFocus = false,
classNames,
...otherProps
} = props;
const Component = as || "ul";
const shouldFilterDOMProps = typeof Component === "string";
const domRef = (0, import_react_utils.useDOMRef)(ref);
const innerState = (0, import_list.useListState)({ ...props, children, onSelectionChange });
const state = propState || innerState;
const { listBoxProps } = (0, import_listbox.useListBox)({ ...props, onAction }, state, domRef);
const slots = (0, import_react.useMemo)(() => (0, import_theme.listbox)({ className }), [className]);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const getBaseProps = (props2 = {}) => {
return {
ref: domRef,
"data-slot": "base",
className: slots.base({ class: baseStyles }),
...(0, import_react_utils.filterDOMProps)(otherProps, {
enabled: shouldFilterDOMProps
}),
...props2
};
};
const getListProps = (props2 = {}) => {
return {
"data-slot": "list",
className: slots.list({ class: classNames == null ? void 0 : classNames.list }),
...listBoxProps,
...props2
};
};
const getEmptyContentProps = (props2 = {}) => {
return {
"data-slot": "empty-content",
children: emptyContent,
className: slots.emptyContent({ class: classNames == null ? void 0 : classNames.emptyContent }),
...props2
};
};
return {
Component,
state,
variant,
color,
slots,
classNames,
topContent,
bottomContent,
emptyContent,
hideEmptyContent,
shouldHighlightOnFocus,
hideSelectedIcon,
disableAnimation,
className,
itemClasses,
getBaseProps,
getListProps,
getEmptyContentProps
};
}
// src/listbox-section.tsx
var import_theme3 = require("@heroui/theme");
var import_react4 = require("react");
var import_system3 = require("@heroui/system");
var import_utils2 = require("@react-aria/utils");
var import_shared_utils3 = require("@heroui/shared-utils");
var import_divider = require("@heroui/divider");
var import_listbox3 = require("@react-aria/listbox");
// src/listbox-item.tsx
var import_react3 = require("react");
// src/use-listbox-item.ts
var import_react2 = require("react");
var import_theme2 = require("@heroui/theme");
var import_system2 = require("@heroui/system");
var import_focus = require("@react-aria/focus");
var import_react_utils2 = require("@heroui/react-utils");
var import_shared_utils2 = require("@heroui/shared-utils");
var import_listbox2 = require("@react-aria/listbox");
var import_utils = require("@react-aria/utils");
var import_interactions = require("@react-aria/interactions");
var import_use_is_mobile = require("@heroui/use-is-mobile");
function useListboxItem(originalProps) {
var _a, _b;
const globalContext = (0, import_system2.useProviderContext)();
const [props, variantProps] = (0, import_system2.mapPropsVariants)(originalProps, import_theme2.listboxItem.variantKeys);
const {
as,
item,
state,
description,
startContent,
endContent,
isVirtualized,
selectedIcon,
className,
classNames,
autoFocus,
onPress,
onClick: deprecatedOnClick,
shouldHighlightOnFocus,
hideSelectedIcon = false,
isReadOnly = false,
...otherProps
} = props;
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
const domRef = (0, import_react2.useRef)(null);
const Component = as || (originalProps.href ? "a" : "li");
const shouldFilterDOMProps = typeof Component === "string";
const { rendered, key } = item;
const isDisabled = state.disabledKeys.has(key) || originalProps.isDisabled;
const isSelectable = state.selectionManager.selectionMode !== "none";
const isMobile = (0, import_use_is_mobile.useIsMobile)();
if (deprecatedOnClick && typeof deprecatedOnClick === "function") {
(0, import_shared_utils2.warn)(
"onClick is deprecated, please use onPress instead. See: https://github.com/heroui-inc/heroui/issues/4292",
"ListboxItem"
);
}
const { pressProps, isPressed } = (0, import_interactions.usePress)({
ref: domRef,
isDisabled,
onPress
});
const { isHovered, hoverProps } = (0, import_interactions.useHover)({
isDisabled
});
const { isFocusVisible, focusProps } = (0, import_focus.useFocusRing)({
autoFocus
});
const { isFocused, isSelected, optionProps, labelProps, descriptionProps } = (0, import_listbox2.useOption)(
{
key,
isDisabled,
"aria-label": props["aria-label"],
isVirtualized
},
state,
domRef
);
let itemProps = optionProps;
const slots = (0, import_react2.useMemo)(
() => (0, import_theme2.listboxItem)({
...variantProps,
isDisabled,
disableAnimation,
hasTitleTextChild: typeof rendered === "string",
hasDescriptionTextChild: typeof description === "string"
}),
[(0, import_shared_utils2.objectToDeps)(variantProps), isDisabled, disableAnimation, rendered, description]
);
const baseStyles = (0, import_shared_utils2.clsx)(classNames == null ? void 0 : classNames.base, className);
if (isReadOnly) {
itemProps = (0, import_shared_utils2.removeEvents)(itemProps);
}
const isHighlighted = shouldHighlightOnFocus && isFocused || (isMobile ? isHovered || isPressed : isHovered || isFocused && !isFocusVisible);
const getItemProps = (props2 = {}) => ({
ref: domRef,
...(0, import_utils.mergeProps)(
{
onClick: deprecatedOnClick
},
itemProps,
isReadOnly ? {} : (0, import_utils.mergeProps)(focusProps, pressProps),
hoverProps,
(0, import_react_utils2.filterDOMProps)(otherProps, {
enabled: shouldFilterDOMProps
}),
props2
),
"data-selectable": (0, import_shared_utils2.dataAttr)(isSelectable),
"data-focus": (0, import_shared_utils2.dataAttr)(isFocused),
"data-hover": (0, import_shared_utils2.dataAttr)(isHighlighted),
"data-disabled": (0, import_shared_utils2.dataAttr)(isDisabled),
"data-selected": (0, import_shared_utils2.dataAttr)(isSelected),
"data-pressed": (0, import_shared_utils2.dataAttr)(isPressed),
"data-focus-visible": (0, import_shared_utils2.dataAttr)(isFocusVisible),
className: slots.base({ class: (0, import_shared_utils2.clsx)(baseStyles, props2.className) })
});
const getLabelProps = (props2 = {}) => ({
...(0, import_utils.mergeProps)(labelProps, props2),
"data-label": (0, import_shared_utils2.dataAttr)(true),
className: slots.title({ class: classNames == null ? void 0 : classNames.title })
});
const getDescriptionProps = (props2 = {}) => ({
...(0, import_utils.mergeProps)(descriptionProps, props2),
className: slots.description({ class: classNames == null ? void 0 : classNames.description })
});
const getWrapperProps = (props2 = {}) => ({
...(0, import_utils.mergeProps)(props2),
className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper })
});
const getSelectedIconProps = (0, import_react2.useCallback)(
(props2 = {}) => {
return {
"aria-hidden": (0, import_shared_utils2.dataAttr)(true),
"data-disabled": (0, import_shared_utils2.dataAttr)(isDisabled),
className: slots.selectedIcon({ class: classNames == null ? void 0 : classNames.selectedIcon }),
...props2
};
},
[isDisabled, slots, classNames]
);
return {
Component,
domRef,
slots,
classNames,
isSelectable,
isSelected,
isDisabled,
rendered,
description,
startContent,
endContent,
selectedIcon,
hideSelectedIcon,
disableAnimation,
getItemProps,
getLabelProps,
getWrapperProps,
getDescriptionProps,
getSelectedIconProps
};
}
// src/listbox-selected-icon.tsx
var import_jsx_runtime = require("react/jsx-runtime");
function ListboxSelectedIcon(props) {
const { isSelected, disableAnimation, ...otherProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"svg",
{
"aria-hidden": "true",
"data-selected": isSelected,
role: "presentation",
viewBox: "0 0 17 18",
...otherProps,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"polyline",
{
fill: "none",
points: "1 9 7 14 15 4",
stroke: "currentColor",
strokeDasharray: 22,
strokeDashoffset: isSelected ? 44 : 66,
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 1.5,
style: !disableAnimation ? {
transition: "stroke-dashoffset 200ms ease"
} : {}
}
)
}
);
}
// src/listbox-item.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var ListboxItem = (props) => {
const {
Component,
rendered,
description,
isSelectable,
isSelected,
isDisabled,
selectedIcon,
startContent,
endContent,
hideSelectedIcon,
disableAnimation,
getItemProps,
getLabelProps,
getWrapperProps,
getDescriptionProps,
getSelectedIconProps
} = useListboxItem(props);
const selectedContent = (0, import_react3.useMemo)(() => {
const defaultIcon = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ListboxSelectedIcon, { disableAnimation, isSelected });
if (typeof selectedIcon === "function") {
return selectedIcon({ icon: defaultIcon, isSelected, isDisabled });
}
if (selectedIcon)
return selectedIcon;
return defaultIcon;
}, [selectedIcon, isSelected, isDisabled, disableAnimation]);
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Component, { ...getItemProps(), children: [
startContent,
description ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ...getWrapperProps(), children: [
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getLabelProps(), children: rendered }),
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getDescriptionProps(), children: description })
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getLabelProps(), children: rendered }),
isSelectable && !hideSelectedIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { ...getSelectedIconProps(), children: selectedContent }),
endContent
] });
};
ListboxItem.displayName = "HeroUI.ListboxItem";
var listbox_item_default = ListboxItem;
// src/listbox-section.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
var ListboxSection = (0, import_system3.forwardRef)(
({
item,
state,
as,
variant,
color,
disableAnimation,
className,
classNames,
hideSelectedIcon,
showDivider = false,
dividerProps = {},
itemClasses,
title,
items,
...otherProps
}, _) => {
const Component = as || "li";
const slots = (0, import_react4.useMemo)(() => (0, import_theme3.listboxSection)(), []);
const baseStyles = (0, import_shared_utils3.clsx)(classNames == null ? void 0 : classNames.base, className);
const dividerStyles = (0, import_shared_utils3.clsx)(classNames == null ? void 0 : classNames.divider, dividerProps == null ? void 0 : dividerProps.className);
const { itemProps, headingProps, groupProps } = (0, import_listbox3.useListBoxSection)({
heading: item.rendered,
"aria-label": item["aria-label"]
});
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
Component,
{
"data-slot": "base",
...(0, import_utils2.mergeProps)(itemProps, otherProps),
className: slots.base({ class: baseStyles }),
children: [
item.rendered && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"span",
{
...headingProps,
className: slots.heading({ class: classNames == null ? void 0 : classNames.heading }),
"data-slot": "heading",
children: item.rendered
}
),
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
"ul",
{
...groupProps,
className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
"data-has-title": !!item.rendered,
"data-slot": "group",
children: [
[...item.childNodes].map((node) => {
const { key: nodeKey, props: nodeProps } = node;
let listboxItem2 = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
listbox_item_default,
{
classNames: itemClasses,
color,
disableAnimation,
hideSelectedIcon,
item: node,
state,
variant,
...nodeProps
},
nodeKey
);
if (node.wrapper) {
listboxItem2 = node.wrapper(listboxItem2);
}
return listboxItem2;
}),
showDivider && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
import_divider.Divider,
{
as: "li",
className: slots.divider({
class: dividerStyles
}),
...dividerProps
}
)
]
}
)
]
},
item.key
);
}
);
ListboxSection.displayName = "HeroUI.ListboxSection";
var listbox_section_default = ListboxSection;
// src/virtualized-listbox.tsx
var import_react7 = require("react");
var import_utils3 = require("@react-aria/utils");
var import_react_virtual = require("@tanstack/react-virtual");
var import_shared_utils6 = require("@heroui/shared-utils");
// ../scroll-shadow/src/use-scroll-shadow.ts
var import_system4 = require("@heroui/system");
var import_theme4 = require("@heroui/theme");
var import_react_utils3 = require("@heroui/react-utils");
// ../../hooks/use-data-scroll-overflow/src/index.ts
var import_shared_utils4 = require("@heroui/shared-utils");
var import_react5 = require("react");
function useDataScrollOverflow(props = {}) {
const {
domRef,
isEnabled = true,
overflowCheck = "vertical",
visibility = "auto",
offset = 0,
onVisibilityChange,
updateDeps = []
} = props;
const visibleRef = (0, import_react5.useRef)(visibility);
(0, import_react5.useEffect)(() => {
const el = domRef == null ? void 0 : domRef.current;
if (!el || !isEnabled)
return;
const setAttributes = (direction, hasBefore, hasAfter, prefix, suffix) => {
if (visibility === "auto") {
const both = `${prefix}${(0, import_shared_utils4.capitalize)(suffix)}Scroll`;
if (hasBefore && hasAfter) {
el.dataset[both] = "true";
el.removeAttribute(`data-${prefix}-scroll`);
el.removeAttribute(`data-${suffix}-scroll`);
} else {
el.dataset[`${prefix}Scroll`] = hasBefore.toString();
el.dataset[`${suffix}Scroll`] = hasAfter.toString();
el.removeAttribute(`data-${prefix}-${suffix}-scroll`);
}
} else {
const next = hasBefore && hasAfter ? "both" : hasBefore ? prefix : hasAfter ? suffix : "none";
if (next !== visibleRef.current) {
onVisibilityChange == null ? void 0 : onVisibilityChange(next);
visibleRef.current = next;
}
}
};
const checkOverflow = () => {
const directions = [
{ type: "vertical", prefix: "top", suffix: "bottom" },
{ type: "horizontal", prefix: "left", suffix: "right" }
];
for (const { type, prefix, suffix } of directions) {
if (overflowCheck === type || overflowCheck === "both") {
const hasBefore = type === "vertical" ? el.scrollTop > offset : el.scrollLeft > offset;
const hasAfter = type === "vertical" ? el.scrollTop + el.clientHeight + offset < el.scrollHeight : el.scrollLeft + el.clientWidth + offset < el.scrollWidth;
setAttributes(type, hasBefore, hasAfter, prefix, suffix);
}
}
};
const clearOverflow = () => {
["top", "bottom", "top-bottom", "left", "right", "left-right"].forEach((attr) => {
el.removeAttribute(`data-${attr}-scroll`);
});
};
checkOverflow();
el.addEventListener("scroll", checkOverflow);
if (visibility !== "auto") {
clearOverflow();
if (visibility === "both") {
el.dataset.topBottomScroll = String(overflowCheck === "vertical");
el.dataset.leftRightScroll = String(overflowCheck === "horizontal");
} else {
el.dataset.topBottomScroll = "false";
el.dataset.leftRightScroll = "false";
["top", "bottom", "left", "right"].forEach((attr) => {
el.dataset[`${attr}Scroll`] = String(visibility === attr);
});
}
}
return () => {
el.removeEventListener("scroll", checkOverflow);
clearOverflow();
};
}, [...updateDeps, isEnabled, visibility, overflowCheck, onVisibilityChange, domRef]);
}
// ../scroll-shadow/src/use-scroll-shadow.ts
var import_react6 = require("react");
var import_shared_utils5 = require("@heroui/shared-utils");
function useScrollShadow(originalProps) {
var _a;
const [props, variantProps] = (0, import_system4.mapPropsVariants)(originalProps, import_theme4.scrollShadow.variantKeys);
const {
ref,
as,
children,
className,
style,
size = 40,
offset = 0,
visibility = "auto",
isEnabled = true,
onVisibilityChange,
...otherProps
} = props;
const Component = as || "div";
const domRef = (0, import_react_utils3.useDOMRef)(ref);
useDataScrollOverflow({
domRef,
offset,
visibility,
isEnabled,
onVisibilityChange,
updateDeps: [children],
overflowCheck: (_a = originalProps.orientation) != null ? _a : "vertical"
});
const styles = (0, import_react6.useMemo)(
() => (0, import_theme4.scrollShadow)({
...variantProps,
className
}),
[(0, import_shared_utils5.objectToDeps)(variantProps), className]
);
const getBaseProps = (props2 = {}) => {
var _a2;
return {
ref: domRef,
className: styles,
"data-orientation": (_a2 = originalProps.orientation) != null ? _a2 : "vertical",
style: {
"--scroll-shadow-size": `${size}px`,
...style,
...props2.style
},
...otherProps,
...props2
};
};
return { Component, styles, domRef, children, getBaseProps };
}
// src/virtualized-listbox.tsx
var import_react_utils4 = require("@heroui/react-utils");
var import_jsx_runtime4 = require("react/jsx-runtime");
var getItemSizesForCollection = (collection, itemHeight) => {
const sizes = [];
for (const item of collection) {
if (item.type === "section") {
sizes.push(([...item.childNodes].length + 1) * itemHeight);
} else {
sizes.push(itemHeight);
}
}
return sizes;
};
var getScrollState = (element) => {
if (!element || element.scrollTop === void 0 || element.clientHeight === void 0 || element.scrollHeight === void 0) {
return {
isTop: false,
isBottom: false,
isMiddle: false
};
}
const isAtTop = element.scrollTop === 0;
const isAtBottom = Math.ceil(element.scrollTop + element.clientHeight) >= element.scrollHeight;
const isInMiddle = !isAtTop && !isAtBottom;
return {
isTop: isAtTop,
isBottom: isAtBottom,
isMiddle: isInMiddle
};
};
var VirtualizedListbox = (props) => {
const {
Component,
state,
color,
variant,
itemClasses,
getBaseProps,
topContent,
bottomContent,
hideEmptyContent,
hideSelectedIcon,
shouldHighlightOnFocus,
disableAnimation,
getEmptyContentProps,
getListProps,
scrollShadowProps
} = props;
const { virtualization } = props;
if (!virtualization || !(0, import_shared_utils6.isEmpty)(virtualization) && !virtualization.maxListboxHeight && !virtualization.itemHeight) {
throw new Error(
"You are using a virtualized listbox. VirtualizedListbox requires 'virtualization' props with 'maxListboxHeight' and 'itemHeight' properties. This error might have originated from autocomplete components that use VirtualizedListbox. Please provide these props to use the virtualized listbox."
);
}
const { maxListboxHeight, itemHeight } = virtualization;
const listHeight = Math.min(maxListboxHeight, itemHeight * state.collection.size);
const parentRef = (0, import_react7.useRef)(null);
const itemSizes = (0, import_react7.useMemo)(
() => getItemSizesForCollection([...state.collection], itemHeight),
[state.collection, itemHeight]
);
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
count: [...state.collection].length,
getScrollElement: () => parentRef.current,
estimateSize: (i) => itemSizes[i]
});
const virtualItems = rowVirtualizer.getVirtualItems();
const { getBaseProps: getBasePropsScrollShadow } = useScrollShadow({ ...scrollShadowProps });
const renderRow = (virtualItem) => {
var _a;
const item = [...state.collection][virtualItem.index];
if (!item) {
return null;
}
const itemProps = {
color,
item,
state,
variant,
disableAnimation,
hideSelectedIcon,
...item.props
};
const virtualizerStyle = {
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: `${virtualItem.size}px`,
transform: `translateY(${virtualItem.start}px)`
};
if (item.type === "section") {
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
listbox_section_default,
{
...itemProps,
itemClasses,
style: { ...virtualizerStyle, ...itemProps.style }
},
item.key
);
}
let listboxItem2 = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
listbox_item_default,
{
...itemProps,
classNames: (0, import_utils3.mergeProps)(itemClasses, (_a = item.props) == null ? void 0 : _a.classNames),
shouldHighlightOnFocus,
style: { ...virtualizerStyle, ...itemProps.style }
},
item.key
);
if (item.wrapper) {
listboxItem2 = item.wrapper(listboxItem2);
}
return listboxItem2;
};
const [scrollState, setScrollState] = (0, import_react7.useState)({
isTop: false,
isBottom: true,
isMiddle: false
});
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Component, { ...getListProps(), children: [
!state.collection.size && !hideEmptyContent && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...getEmptyContentProps() }) }),
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
"div",
{
...(0, import_react_utils4.filterDOMProps)(getBasePropsScrollShadow()),
ref: parentRef,
"data-bottom-scroll": scrollState.isTop,
"data-top-bottom-scroll": scrollState.isMiddle,
"data-top-scroll": scrollState.isBottom,
style: {
height: maxListboxHeight,
overflow: "auto"
},
onScroll: (e) => {
setScrollState(getScrollState(e.target));
},
children: listHeight > 0 && itemHeight > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
"div",
{
style: {
height: `${rowVirtualizer.getTotalSize()}px`,
width: "100%",
position: "relative"
},
children: virtualItems.map((virtualItem) => renderRow(virtualItem))
}
)
}
)
] });
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ...getBaseProps(), children: [
topContent,
content,
bottomContent
] });
};
var virtualized_listbox_default = VirtualizedListbox;
// src/listbox.tsx
var import_jsx_runtime5 = require("react/jsx-runtime");
var Listbox = (0, import_system5.forwardRef)(function Listbox2(props, ref) {
const { isVirtualized, ...restProps } = props;
const useListboxProps = useListbox({ ...restProps, ref });
const {
Component,
state,
color,
variant,
itemClasses,
getBaseProps,
topContent,
bottomContent,
hideEmptyContent,
hideSelectedIcon,
shouldHighlightOnFocus,
disableAnimation,
getEmptyContentProps,
getListProps
} = useListboxProps;
if (isVirtualized) {
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(virtualized_listbox_default, { ...props, ...useListboxProps });
}
const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Component, { ...getListProps(), children: [
!state.collection.size && !hideEmptyContent && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ...getEmptyContentProps() }) }),
[...state.collection].map((item) => {
var _a;
const itemProps = {
color,
item,
state,
variant,
disableAnimation,
hideSelectedIcon,
...item.props
};
if (item.type === "section") {
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(listbox_section_default, { ...itemProps, itemClasses }, item.key);
}
let listboxItem2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
listbox_item_default,
{
...itemProps,
classNames: (0, import_utils4.mergeProps)(itemClasses, (_a = item.props) == null ? void 0 : _a.classNames),
shouldHighlightOnFocus
},
item.key
);
if (item.wrapper) {
listboxItem2 = item.wrapper(listboxItem2);
}
return listboxItem2;
})
] });
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ...getBaseProps(), children: [
topContent,
content,
bottomContent
] });
});
var listbox_default = Listbox;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
@@ -0,0 +1,11 @@
# Security Policy
## Supported Versions
Latest major/minor version is supported only for security updates.
## Reporting a Vulnerability
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.
@@ -0,0 +1,19 @@
{
"name": "buffer-from",
"version": "1.1.2",
"license": "MIT",
"repository": "LinusU/buffer-from",
"files": [
"index.js"
],
"scripts": {
"test": "standard && node test"
},
"devDependencies": {
"standard": "^12.0.1"
},
"keywords": [
"buffer",
"buffer from"
]
}
@@ -0,0 +1,355 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EventEmitter3 = factory());
})(this, (function () { 'use strict';
var eventemitter3Exports = {};
var eventemitter3$1 = {
get exports(){ return eventemitter3Exports; },
set exports(v){ eventemitter3Exports = v; },
};
(function (module) {
var has = Object.prototype.hasOwnProperty
, prefix = '~';
/**
* Constructor to create a storage for our `EE` objects.
* An `Events` instance is a plain object whose properties are event names.
*
* @constructor
* @private
*/
function Events() {}
//
// We try to not inherit from `Object.prototype`. In some engines creating an
// instance in this way is faster than calling `Object.create(null)` directly.
// If `Object.create(null)` is not supported we prefix the event names with a
// character to make sure that the built-in object properties are not
// overridden or used as an attack vector.
//
if (Object.create) {
Events.prototype = Object.create(null);
//
// This hack is needed because the `__proto__` property is still inherited in
// some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
//
if (!new Events().__proto__) prefix = false;
}
/**
* Representation of a single event listener.
*
* @param {Function} fn The listener function.
* @param {*} context The context to invoke the listener with.
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
* @constructor
* @private
*/
function EE(fn, context, once) {
this.fn = fn;
this.context = context;
this.once = once || false;
}
/**
* Add a listener for a given event.
*
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
* @param {(String|Symbol)} event The event name.
* @param {Function} fn The listener function.
* @param {*} context The context to invoke the listener with.
* @param {Boolean} once Specify if the listener is a one-time listener.
* @returns {EventEmitter}
* @private
*/
function addListener(emitter, event, fn, context, once) {
if (typeof fn !== 'function') {
throw new TypeError('The listener must be a function');
}
var listener = new EE(fn, context || emitter, once)
, evt = prefix ? prefix + event : event;
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
else emitter._events[evt] = [emitter._events[evt], listener];
return emitter;
}
/**
* Clear event by name.
*
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
* @param {(String|Symbol)} evt The Event name.
* @private
*/
function clearEvent(emitter, evt) {
if (--emitter._eventsCount === 0) emitter._events = new Events();
else delete emitter._events[evt];
}
/**
* Minimal `EventEmitter` interface that is molded against the Node.js
* `EventEmitter` interface.
*
* @constructor
* @public
*/
function EventEmitter() {
this._events = new Events();
this._eventsCount = 0;
}
/**
* Return an array listing the events for which the emitter has registered
* listeners.
*
* @returns {Array}
* @public
*/
EventEmitter.prototype.eventNames = function eventNames() {
var names = []
, events
, name;
if (this._eventsCount === 0) return names;
for (name in (events = this._events)) {
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
}
if (Object.getOwnPropertySymbols) {
return names.concat(Object.getOwnPropertySymbols(events));
}
return names;
};
/**
* Return the listeners registered for a given event.
*
* @param {(String|Symbol)} event The event name.
* @returns {Array} The registered listeners.
* @public
*/
EventEmitter.prototype.listeners = function listeners(event) {
var evt = prefix ? prefix + event : event
, handlers = this._events[evt];
if (!handlers) return [];
if (handlers.fn) return [handlers.fn];
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
ee[i] = handlers[i].fn;
}
return ee;
};
/**
* Return the number of listeners listening to a given event.
*
* @param {(String|Symbol)} event The event name.
* @returns {Number} The number of listeners.
* @public
*/
EventEmitter.prototype.listenerCount = function listenerCount(event) {
var evt = prefix ? prefix + event : event
, listeners = this._events[evt];
if (!listeners) return 0;
if (listeners.fn) return 1;
return listeners.length;
};
/**
* Calls each of the listeners registered for a given event.
*
* @param {(String|Symbol)} event The event name.
* @returns {Boolean} `true` if the event had listeners, else `false`.
* @public
*/
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt]) return false;
var listeners = this._events[evt]
, len = arguments.length
, args
, i;
if (listeners.fn) {
if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
switch (len) {
case 1: return listeners.fn.call(listeners.context), true;
case 2: return listeners.fn.call(listeners.context, a1), true;
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
}
for (i = 1, args = new Array(len -1); i < len; i++) {
args[i - 1] = arguments[i];
}
listeners.fn.apply(listeners.context, args);
} else {
var length = listeners.length
, j;
for (i = 0; i < length; i++) {
if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
switch (len) {
case 1: listeners[i].fn.call(listeners[i].context); break;
case 2: listeners[i].fn.call(listeners[i].context, a1); break;
case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
default:
if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
args[j - 1] = arguments[j];
}
listeners[i].fn.apply(listeners[i].context, args);
}
}
}
return true;
};
/**
* Add a listener for a given event.
*
* @param {(String|Symbol)} event The event name.
* @param {Function} fn The listener function.
* @param {*} [context=this] The context to invoke the listener with.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.on = function on(event, fn, context) {
return addListener(this, event, fn, context, false);
};
/**
* Add a one-time listener for a given event.
*
* @param {(String|Symbol)} event The event name.
* @param {Function} fn The listener function.
* @param {*} [context=this] The context to invoke the listener with.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.once = function once(event, fn, context) {
return addListener(this, event, fn, context, true);
};
/**
* Remove the listeners of a given event.
*
* @param {(String|Symbol)} event The event name.
* @param {Function} fn Only remove the listeners that match this function.
* @param {*} context Only remove the listeners that have this context.
* @param {Boolean} once Only remove one-time listeners.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt]) return this;
if (!fn) {
clearEvent(this, evt);
return this;
}
var listeners = this._events[evt];
if (listeners.fn) {
if (
listeners.fn === fn &&
(!once || listeners.once) &&
(!context || listeners.context === context)
) {
clearEvent(this, evt);
}
} else {
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
if (
listeners[i].fn !== fn ||
(once && !listeners[i].once) ||
(context && listeners[i].context !== context)
) {
events.push(listeners[i]);
}
}
//
// Reset the array, or remove it completely if we have no more listeners.
//
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
else clearEvent(this, evt);
}
return this;
};
/**
* Remove all listeners, or those of the specified event.
*
* @param {(String|Symbol)} [event] The event name.
* @returns {EventEmitter} `this`.
* @public
*/
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
var evt;
if (event) {
evt = prefix ? prefix + event : event;
if (this._events[evt]) clearEvent(this, evt);
} else {
this._events = new Events();
this._eventsCount = 0;
}
return this;
};
//
// Alias methods names because people roll like that.
//
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
//
// Expose the prefix.
//
EventEmitter.prefixed = prefix;
//
// Allow `EventEmitter` to be imported as module namespace.
//
EventEmitter.EventEmitter = EventEmitter;
//
// Expose the module.
//
{
module.exports = EventEmitter;
}
} (eventemitter3$1));
var eventemitter3 = eventemitter3Exports;
return eventemitter3;
}));
@@ -0,0 +1 @@
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AA2BM,SAAS,0CAAiB,KAA6B,EAAE,KAAyB;IACvF,IAAI,cAAC,UAAU,QAAE,IAAI,sBAAE,qBAAqB,QAAO,GAAG;IACtD,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAE9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC3E,GAAG,KAAK;QACR,oDAAoD;QACpD,6CAA6C;QAC7C,kBAAkB;mBAClB;QACA,cAAc,MAAM,YAAY,IAAI;IACtC;IAEA,CAAA,GAAA,yCAAgB,EAAE,GAAG,CAAC,OAAO;cAC3B;QACA,eAAe,iBAAiB,EAAE;QAClC,gBAAgB,kBAAkB,EAAE;4BACpC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAErD,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,cAAc,MAAM,MAAM;QAC1B,eAAe,MAAM,OAAO;QAC5B,qBAAqB,MAAM,aAAa;IAC1C;IAEA,OAAO;QACL,YAAY,CAAA,GAAA,iBAAS,EAAE,UAAU;YAC/B,MAAM;YACN,iBAAiB,cAAc;YAC/B,GAAG,UAAU;YACb,GAAG,gBAAgB;QACrB;oBACA;0BACA;2BACA;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/@react-aria/checkbox/src/useCheckboxGroup.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaCheckboxGroupProps} from '@react-types/checkbox';\nimport {checkboxGroupData} from './utils';\nimport {CheckboxGroupState} from '@react-stately/checkbox';\nimport {DOMAttributes, ValidationResult} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useField} from '@react-aria/label';\nimport {useFocusWithin} from '@react-aria/interactions';\n\nexport interface CheckboxGroupAria extends ValidationResult {\n /** Props for the checkbox group wrapper element. */\n groupProps: DOMAttributes,\n /** Props for the checkbox group's visible label (if any). */\n labelProps: DOMAttributes,\n /** Props for the checkbox group description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the checkbox group error message element, if any. */\n errorMessageProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a checkbox group component.\n * Checkbox groups allow users to select multiple items from a list of options.\n * @param props - Props for the checkbox group.\n * @param state - State for the checkbox group, as returned by `useCheckboxGroupState`.\n */\nexport function useCheckboxGroup(props: AriaCheckboxGroupProps, state: CheckboxGroupState): CheckboxGroupAria {\n let {isDisabled, name, validationBehavior = 'aria'} = props;\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n // Checkbox group is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n checkboxGroupData.set(state, {\n name,\n descriptionId: descriptionProps.id,\n errorMessageId: errorMessageProps.id,\n validationBehavior\n });\n\n let domProps = filterDOMProps(props, {labelable: true});\n\n let {focusWithinProps} = useFocusWithin({\n onBlurWithin: props.onBlur,\n onFocusWithin: props.onFocus,\n onFocusWithinChange: props.onFocusChange\n });\n\n return {\n groupProps: mergeProps(domProps, {\n role: 'group',\n 'aria-disabled': isDisabled || undefined,\n ...fieldProps,\n ...focusWithinProps\n }),\n labelProps,\n descriptionProps,\n errorMessageProps,\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useCheckboxGroup.module.js.map"}
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) Roy Riojas and Jared Wray
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,10 @@
import type { LiteralNodeValue, PluginSettings, RuleContext } from '../types.js';
export declare function isAbsolute(name?: LiteralNodeValue): boolean;
export declare function isBuiltIn(name: string, settings: PluginSettings, modulePath?: string | null): boolean;
export declare function isExternalModule(name: string, modulePath: string, context: RuleContext): boolean;
export declare function isExternalModuleMain(name: string, modulePath: string, context: RuleContext): boolean;
export declare function isScoped(name: string): boolean;
export declare function isScopedMain(name: string): boolean;
export declare function isExternalLookingName(name: string): boolean;
export declare function importType(name: LiteralNodeValue, context: RuleContext): "internal" | "absolute" | "builtin" | "parent" | "index" | "sibling" | "external" | "unknown";
export type ImportType = ReturnType<typeof importType>;
@@ -0,0 +1,8 @@
var $74cf411061b983a2$exports = {};
$74cf411061b983a2$exports = {
"dismiss": `Elutas\xedt\xe1s`
};
export {$74cf411061b983a2$exports as default};
//# sourceMappingURL=hu-HU.module.js.map
@@ -0,0 +1,30 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class Flex extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'flex'
}
/**
* Return flex property for 2009 and 2012 specs
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return prefix + 'box-flex'
}
if (spec === 2012) {
return prefix + 'flex-positive'
}
return super.prefixed(prop, prefix)
}
}
Flex.names = ['flex-grow', 'flex-positive']
module.exports = Flex
@@ -0,0 +1,41 @@
{
"name": "@peculiar/asn1-android",
"version": "2.6.0",
"description": "",
"files": [
"build/**/*.{js,d.ts}",
"LICENSE",
"README.md"
],
"bugs": {
"url": "https://github.com/PeculiarVentures/asn1-schema/issues"
},
"homepage": "https://github.com/PeculiarVentures/asn1-schema/tree/master/packages/android#readme",
"keywords": [
"asn"
],
"author": "PeculiarVentures, LLC",
"license": "MIT",
"main": "build/cjs/index.js",
"module": "build/es2015/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
"access": "public"
},
"scripts": {
"clear": "rimraf build",
"build": "npm run build:module && npm run build:types",
"build:module": "npm run build:cjs && npm run build:es2015",
"build:cjs": "tsc -p tsconfig.compile.json --removeComments --module commonjs --outDir build/cjs",
"build:es2015": "tsc -p tsconfig.compile.json --removeComments --module ES2015 --outDir build/es2015",
"prebuild:types": "rimraf build/types",
"build:types": "tsc -p tsconfig.compile.json --outDir build/types --declaration --emitDeclarationOnly",
"rebuild": "npm run clear && npm run build"
},
"dependencies": {
"@peculiar/asn1-schema": "^2.6.0",
"asn1js": "^3.0.6",
"tslib": "^2.8.1"
},
"gitHead": "84379a0671b1312b01fd3b9f1ef038d10560ea4a"
}
@@ -0,0 +1,74 @@
export declare const MiniAppAdaptShareInfoReq: {
appId: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
body: import("napcat-protobuf").MessageProtoFieldType<() => {
extInfo: import("napcat-protobuf").MessageProtoFieldType<() => {
field2: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.BYTES, false, false>;
}, false, false>;
appid: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
title: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
desc: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
time: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT64, false, false>;
scene: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
templateType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
businessType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
picUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
vidUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
jumpUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
iconUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
verType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
shareType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
versionId: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
withShareTicket: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
webURL: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
appidRich: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.BYTES, false, false>;
template: import("napcat-protobuf").MessageProtoFieldType<() => {
templateId: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
templateData: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
}, false, false>;
field20: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
}, false, false>;
};
export declare const MiniAppAdaptShareInfoReqBody: {
extInfo: import("napcat-protobuf").MessageProtoFieldType<() => {
field2: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.BYTES, false, false>;
}, false, false>;
appid: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
title: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
desc: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
time: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT64, false, false>;
scene: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
templateType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
businessType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
picUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
vidUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
jumpUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
iconUrl: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
verType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
shareType: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
versionId: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
withShareTicket: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
webURL: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
appidRich: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.BYTES, false, false>;
template: import("napcat-protobuf").MessageProtoFieldType<() => {
templateId: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
templateData: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
}, false, false>;
field20: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
};
export declare const ExtInfo: {
field2: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.BYTES, false, false>;
};
export declare const Template: {
templateId: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
templateData: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
};
export declare const MiniAppAdaptShareInfoResp: {
field2: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
field3: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
content: import("napcat-protobuf").MessageProtoFieldType<() => {
jsonContent: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
}, false, false>;
};
export declare const MiniAppAdaptShareInfoRespContent: {
jsonContent: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.STRING, false, false>;
};
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = clone;
var _cloneNode = require("./cloneNode.js");
function clone(node) {
return (0, _cloneNode.default)(node, false);
}
//# sourceMappingURL=clone.js.map
@@ -0,0 +1,148 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "کاراکتر", verb: "داشته باشد" },
file: { unit: "بایت", verb: "داشته باشد" },
array: { unit: "آیتم", verb: "داشته باشد" },
set: { unit: "آیتم", verb: "داشته باشد" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "عدد";
}
case "object": {
if (Array.isArray(data)) {
return "آرایه";
}
if (data === null) {
return "null";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "ورودی",
email: "آدرس ایمیل",
url: "URL",
emoji: "ایموجی",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "تاریخ و زمان ایزو",
date: "تاریخ ایزو",
time: "زمان ایزو",
duration: "مدت زمان ایزو",
ipv4: "IPv4 آدرس",
ipv6: "IPv6 آدرس",
cidrv4: "IPv4 دامنه",
cidrv6: "IPv6 دامنه",
base64: "base64-encoded رشته",
base64url: "base64url-encoded رشته",
json_string: "JSON رشته",
e164: "E.164 عدد",
jwt: "JWT",
template_literal: "ورودی",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `ورودی نامعتبر: می‌بایست ${issue.expected} می‌بود، ${parsedType(issue.input)} دریافت شد`;
case "invalid_value":
if (issue.values.length === 1) {
return `ورودی نامعتبر: می‌بایست ${util.stringifyPrimitive(issue.values[0])} می‌بود`;
}
return `گزینه نامعتبر: می‌بایست یکی از ${util.joinValues(issue.values, "|")} می‌بود`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing) {
return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;
}
return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} باشد`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} باشد`;
}
return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} باشد`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;
}
if (_issue.format === "ends_with") {
return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;
}
if (_issue.format === "includes") {
return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;
}
if (_issue.format === "regex") {
return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;
}
return `${Nouns[_issue.format] ?? issue.format} نامعتبر`;
}
case "not_multiple_of":
return `عدد نامعتبر: باید مضرب ${issue.divisor} باشد`;
case "unrecognized_keys":
return `کلید${issue.keys.length > 1 ? "های" : ""} ناشناس: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `کلید ناشناس در ${issue.origin}`;
case "invalid_union":
return `ورودی نامعتبر`;
case "invalid_element":
return `مقدار نامعتبر در ${issue.origin}`;
default:
return `ورودی نامعتبر`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
@@ -0,0 +1,41 @@
{
"name": "@react-aria/label",
"version": "3.7.22",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
"exports": {
"source": "./src/index.ts",
"types": [
"./dist/types.d.ts",
"./src/index.ts"
],
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
"dist",
"src"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-aria/utils": "^3.31.0",
"@react-types/shared": "^3.32.1",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
}
@@ -0,0 +1,43 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("eslint-utils")
module.exports = {
meta: {
docs: {
description: "disallow the `Object.isSealed` method.",
category: "ES5",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-object-issealed.html",
},
fixable: null,
messages: {
forbidden: "ES5 '{{name}}' method is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"() {
const tracker = new ReferenceTracker(context.getScope())
for (const { node, path } of tracker.iterateGlobalReferences({
Object: {
isSealed: { [READ]: true },
},
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,32 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.z = void 0;
const z = __importStar(require("./external.cjs"));
exports.z = z;
__exportStar(require("./external.cjs"), exports);
@@ -0,0 +1,12 @@
/// <reference types="node" />
import { Readable } from 'stream';
import AsyncReader from '../readers/async';
import type Settings from '../settings';
export default class StreamProvider {
private readonly _root;
private readonly _settings;
protected readonly _reader: AsyncReader;
protected readonly _stream: Readable;
constructor(_root: string, _settings: Settings);
read(): Readable;
}
@@ -0,0 +1,63 @@
{
"name": "@heroui/switch",
"version": "2.2.9",
"description": "A switch is similar to a checkbox, but represents on/off values as opposed to selection.",
"keywords": [
"switch"
],
"author": "Junior Garcia <jrgarciadev@gmail.com>",
"homepage": "https://heroui.com",
"license": "MIT",
"main": "dist/index.js",
"sideEffects": false,
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/heroui-inc/heroui.git",
"directory": "packages/components/switch"
},
"bugs": {
"url": "https://github.com/heroui-inc/heroui/issues"
},
"peerDependencies": {
"react": ">=18 || >=19.0.0-rc.0",
"react-dom": ">=18 || >=19.0.0-rc.0",
"@heroui/theme": ">=2.4.3",
"@heroui/system": ">=2.4.0"
},
"dependencies": {
"@react-aria/focus": "3.19.0",
"@react-aria/interactions": "3.22.5",
"@react-aria/switch": "3.6.10",
"@react-aria/utils": "3.26.0",
"@react-aria/visually-hidden": "3.8.18",
"@react-stately/toggle": "3.8.0",
"@react-types/shared": "3.26.0",
"@heroui/shared-utils": "2.1.3",
"@heroui/react-utils": "2.1.4",
"@heroui/use-safe-layout-effect": "2.1.2"
},
"clean-package": "../../../clean-package.config.json",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsup src --dts",
"build:fast": "tsup src",
"dev": "pnpm build:fast --watch",
"clean": "rimraf dist .turbo",
"typecheck": "tsc --noEmit"
}
}
@@ -0,0 +1,43 @@
{
"name": "use-sync-external-store",
"description": "Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.",
"version": "1.6.0",
"exports": {
".": "./index.js",
"./with-selector": "./with-selector.js",
"./with-selector.js": "./with-selector.js",
"./shim": {
"react-native": "./shim/index.native.js",
"default": "./shim/index.js"
},
"./shim/index.js": "./shim/index.js",
"./shim/index.native": "./shim/index.native.js",
"./shim/index.native.js": "./shim/index.native.js",
"./shim/with-selector": "./shim/with-selector.js",
"./shim/with-selector.js": "./shim/with-selector.js",
"./package.json": "./package.json"
},
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",
"directory": "packages/use-sync-external-store"
},
"files": [
"LICENSE",
"README.md",
"index.js",
"index.native.js",
"with-selector.js",
"with-selector.native.js",
"shim/",
"cjs/"
],
"license": "MIT",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"devDependencies": {
"react-17": "npm:react@^17",
"react-dom-17": "npm:react-dom@^17"
}
}
@@ -0,0 +1 @@
{"mappings":"AAAA;;;;;;;;;;CAUC,GAoBM,SAAS,0CAAsB,OAAyB;IAC7D,IAAI,+CACF,QAAQ,KAAK,CAAC;QAAC,eAAe;IAAI;SAC7B;QACL,IAAI,qBAAqB,4CAAsB;QAC/C,QAAQ,KAAK;QACb,4CAAsB;IACxB;AACF;AAEA,IAAI,oDAA8C;AAClD,SAAS;IACP,IAAI,qDAA+B,MAAM;QACvC,oDAA8B;QAC9B,IAAI;YACF,IAAI,YAAY,SAAS,aAAa,CAAC;YACvC,UAAU,KAAK,CAAC;gBACd,IAAI,iBAAgB;oBAClB,oDAA8B;oBAC9B,OAAO;gBACT;YACF;QACF,EAAE,OAAM;QACN,SAAS;QACX;IACF;IAEA,OAAO;AACT;AAEA,SAAS,4CAAsB,OAAyB;IACtD,IAAI,SAAS,QAAQ,UAAU;IAC/B,IAAI,qBAA0C,EAAE;IAChD,IAAI,uBAAuB,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAEhF,MAAO,kBAAkB,eAAe,WAAW,qBAAsB;QACvE,IACE,OAAO,YAAY,GAAG,OAAO,YAAY,IACzC,OAAO,WAAW,GAAG,OAAO,WAAW,EAEvC,mBAAmB,IAAI,CAAC;YACtB,SAAS;YACT,WAAW,OAAO,SAAS;YAC3B,YAAY,OAAO,UAAU;QAC/B;QAEF,SAAS,OAAO,UAAU;IAC5B;IAEA,IAAI,gCAAgC,aAClC,mBAAmB,IAAI,CAAC;QACtB,SAAS;QACT,WAAW,qBAAqB,SAAS;QACzC,YAAY,qBAAqB,UAAU;IAC7C;IAGF,OAAO;AACT;AAEA,SAAS,4CAAsB,kBAAuC;IACpE,KAAK,IAAI,WAAC,OAAO,aAAE,SAAS,cAAE,UAAU,EAAC,IAAI,mBAAoB;QAC/D,QAAQ,SAAS,GAAG;QACpB,QAAQ,UAAU,GAAG;IACvB;AACF","sources":["packages/@react-aria/utils/src/focusWithoutScrolling.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableElement} from '@react-types/shared';\n\n// This is a polyfill for element.focus({preventScroll: true});\n// Currently necessary for Safari and old Edge:\n// https://caniuse.com/#feat=mdn-api_htmlelement_focus_preventscroll_option\n// See https://bugs.webkit.org/show_bug.cgi?id=178583\n//\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/calvellido/focus-options-polyfill\n\ninterface ScrollableElement {\n element: HTMLElement,\n scrollTop: number,\n scrollLeft: number\n}\n\nexport function focusWithoutScrolling(element: FocusableElement): void {\n if (supportsPreventScroll()) {\n element.focus({preventScroll: true});\n } else {\n let scrollableElements = getScrollableElements(element);\n element.focus();\n restoreScrollPosition(scrollableElements);\n }\n}\n\nlet supportsPreventScrollCached: boolean | null = null;\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached == null) {\n supportsPreventScrollCached = false;\n try {\n let focusElem = document.createElement('div');\n focusElem.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n }\n });\n } catch {\n // Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(element: FocusableElement): ScrollableElement[] {\n let parent = element.parentNode;\n let scrollableElements: ScrollableElement[] = [];\n let rootScrollingElement = document.scrollingElement || document.documentElement;\n\n while (parent instanceof HTMLElement && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft\n });\n }\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements: ScrollableElement[]) {\n for (let {element, scrollTop, scrollLeft} of scrollableElements) {\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n"],"names":[],"version":3,"file":"focusWithoutScrolling.module.js.map"}
@@ -0,0 +1,55 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {useId, mergeIds, useSlotId} from './useId';
export {chain} from './chain';
export {createShadowTreeWalker, ShadowTreeWalker} from './shadowdom/ShadowTreeWalker';
export {getActiveElement, getEventTarget, nodeContains} from './shadowdom/DOMFunctions';
export {getOwnerDocument, getOwnerWindow, isShadowRoot} from './domHelpers';
export {mergeProps} from './mergeProps';
export {mergeRefs} from './mergeRefs';
export {filterDOMProps} from './filterDOMProps';
export {focusWithoutScrolling} from './focusWithoutScrolling';
export {getOffset} from './getOffset';
export {openLink, getSyntheticLinkProps, useSyntheticLinkProps, RouterProvider, shouldClientNavigate, useRouter, useLinkProps, handleLinkClick} from './openLink';
export {runAfterTransition} from './runAfterTransition';
export {useDrag1D} from './useDrag1D';
export {useGlobalListeners} from './useGlobalListeners';
export {useLabels} from './useLabels';
export {useObjectRef} from './useObjectRef';
export {useUpdateEffect} from './useUpdateEffect';
export {useUpdateLayoutEffect} from './useUpdateLayoutEffect';
export {useLayoutEffect} from './useLayoutEffect';
export {useResizeObserver} from './useResizeObserver';
export {useSyncRef} from './useSyncRef';
export {getScrollParent} from './getScrollParent';
export {getScrollParents} from './getScrollParents';
export {isScrollable} from './isScrollable';
export {useViewportSize} from './useViewportSize';
export {useDescription} from './useDescription';
export {isMac, isIPhone, isIPad, isIOS, isAppleDevice, isWebKit, isChrome, isAndroid, isFirefox} from './platform';
export {useEvent} from './useEvent';
export {useValueEffect} from './useValueEffect';
export {scrollIntoView, scrollIntoViewport} from './scrollIntoView';
export {clamp, snapValueToStep} from '@react-stately/utils';
export {isVirtualClick, isVirtualPointerEvent} from './isVirtualEvent';
export {useEffectEvent} from './useEffectEvent';
export {useDeepMemo} from './useDeepMemo';
export {useFormReset} from './useFormReset';
export {useLoadMore} from './useLoadMore';
export {useLoadMoreSentinel, useLoadMoreSentinel as UNSTABLE_useLoadMoreSentinel} from './useLoadMoreSentinel';
export {inertValue} from './inertValue';
export {CLEAR_FOCUS_EVENT, FOCUS_EVENT} from './constants';
export {isCtrlKeyPressed, willOpenKeyboard} from './keyboard';
export {useEnterAnimation, useExitAnimation} from './animation';
export {isFocusable, isTabbable} from './isFocusable';
export type {LoadMoreSentinelProps} from './useLoadMoreSentinel';
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAO,MAAM,4CAAmB,CAAC;QACxB;IAAP,OAAO,CAAA,oBAAA,eAAA,yBAAA,GAAI,aAAa,cAAjB,+BAAA,oBAAqB;AAC9B;AAEO,MAAM,4CAAiB,CAC5B;IAEA,IAAI,MAAM,YAAY,MAAM,GAAG,MAAM,KAAK,IACxC,OAAO;IAGT,MAAM,MAAM,0CAAiB;IAC7B,OAAO,IAAI,WAAW,IAAI;AAC5B;AAEA;;CAEC,GACD,SAAS,6BAAO,KAAc;IAC5B,OAAO,UAAU,QACf,OAAO,UAAU,YACjB,cAAc,SACd,OAAO,AAAC,MAAe,QAAQ,KAAK;AACxC;AAKO,SAAS,0CAAa,IAAiB;IAC5C,OAAO,6BAAO,SACZ,KAAK,QAAQ,KAAK,KAAK,sBAAsB,IAC7C,UAAU;AACd","sources":["packages/@react-aria/utils/src/domHelpers.ts"],"sourcesContent":["export const getOwnerDocument = (el: Element | null | undefined): Document => {\n return el?.ownerDocument ?? document;\n};\n\nexport const getOwnerWindow = (\n el: (Window & typeof global) | Element | null | undefined\n): Window & typeof global => {\n if (el && 'window' in el && el.window === el) {\n return el;\n }\n\n const doc = getOwnerDocument(el as Element | null | undefined);\n return doc.defaultView || window;\n};\n\n/**\n * Type guard that checks if a value is a Node. Verifies the presence and type of the nodeType property.\n */\nfunction isNode(value: unknown): value is Node {\n return value !== null &&\n typeof value === 'object' &&\n 'nodeType' in value &&\n typeof (value as Node).nodeType === 'number';\n}\n/**\n * Type guard that checks if a node is a ShadowRoot. Uses nodeType and host property checks to\n * distinguish ShadowRoot from other DocumentFragments.\n */\nexport function isShadowRoot(node: Node | null): node is ShadowRoot {\n return isNode(node) &&\n node.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&\n 'host' in node;\n}\n"],"names":[],"version":3,"file":"domHelpers.main.js.map"}
@@ -0,0 +1,653 @@
'use strict'
/* eslint-disable no-var */
var test = require('tape')
var buildQueue = require('../')
test('concurrency', function (t) {
t.plan(6)
t.throws(buildQueue.bind(null, worker, 0))
t.throws(buildQueue.bind(null, worker, NaN))
t.doesNotThrow(buildQueue.bind(null, worker, 1))
var queue = buildQueue(worker, 1)
t.throws(function () {
queue.concurrency = 0
})
t.throws(function () {
queue.concurrency = NaN
})
t.doesNotThrow(function () {
queue.concurrency = 2
})
function worker (arg, cb) {
cb(null, true)
}
})
test('worker execution', function (t) {
t.plan(3)
var queue = buildQueue(worker, 1)
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
})
function worker (arg, cb) {
t.equal(arg, 42)
cb(null, true)
}
})
test('limit', function (t) {
t.plan(4)
var expected = [10, 0]
var queue = buildQueue(worker, 1)
queue.push(10, result)
queue.push(0, result)
function result (err, arg) {
t.error(err, 'no error')
t.equal(arg, expected.shift(), 'the result matches')
}
function worker (arg, cb) {
setTimeout(cb, arg, null, arg)
}
})
test('multiple executions', function (t) {
t.plan(15)
var queue = buildQueue(worker, 1)
var toExec = [1, 2, 3, 4, 5]
var count = 0
toExec.forEach(function (task) {
queue.push(task, done)
})
function done (err, result) {
t.error(err, 'no error')
t.equal(result, toExec[count - 1], 'the result matches')
}
function worker (arg, cb) {
t.equal(arg, toExec[count], 'arg matches')
count++
setImmediate(cb, null, arg)
}
})
test('multiple executions, one after another', function (t) {
t.plan(15)
var queue = buildQueue(worker, 1)
var toExec = [1, 2, 3, 4, 5]
var count = 0
queue.push(toExec[0], done)
function done (err, result) {
t.error(err, 'no error')
t.equal(result, toExec[count - 1], 'the result matches')
if (count < toExec.length) {
queue.push(toExec[count], done)
}
}
function worker (arg, cb) {
t.equal(arg, toExec[count], 'arg matches')
count++
setImmediate(cb, null, arg)
}
})
test('set this', function (t) {
t.plan(3)
var that = {}
var queue = buildQueue(that, worker, 1)
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(this, that, 'this matches')
})
function worker (arg, cb) {
t.equal(this, that, 'this matches')
cb(null, true)
}
})
test('drain', function (t) {
t.plan(4)
var queue = buildQueue(worker, 1)
var worked = false
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
})
queue.drain = function () {
t.equal(true, worked, 'drained')
}
function worker (arg, cb) {
t.equal(arg, 42)
worked = true
setImmediate(cb, null, true)
}
})
test('pause && resume', function (t) {
t.plan(13)
var queue = buildQueue(worker, 1)
var worked = false
var expected = [42, 24]
t.notOk(queue.paused, 'it should not be paused')
queue.pause()
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
})
queue.push(24, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
})
t.notOk(worked, 'it should be paused')
t.ok(queue.paused, 'it should be paused')
queue.resume()
queue.pause()
queue.resume()
queue.resume() // second resume is a no-op
function worker (arg, cb) {
t.notOk(queue.paused, 'it should not be paused')
t.ok(queue.running() <= queue.concurrency, 'should respect the concurrency')
t.equal(arg, expected.shift())
worked = true
process.nextTick(function () { cb(null, true) })
}
})
test('pause in flight && resume', function (t) {
t.plan(16)
var queue = buildQueue(worker, 1)
var expected = [42, 24, 12]
t.notOk(queue.paused, 'it should not be paused')
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
t.ok(queue.paused, 'it should be paused')
process.nextTick(function () {
queue.resume()
queue.pause()
queue.resume()
})
})
queue.push(24, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
t.notOk(queue.paused, 'it should not be paused')
})
queue.push(12, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
t.notOk(queue.paused, 'it should not be paused')
})
queue.pause()
function worker (arg, cb) {
t.ok(queue.running() <= queue.concurrency, 'should respect the concurrency')
t.equal(arg, expected.shift())
process.nextTick(function () { cb(null, true) })
}
})
test('altering concurrency', function (t) {
t.plan(24)
var queue = buildQueue(worker, 1)
queue.push(24, workDone)
queue.push(24, workDone)
queue.push(24, workDone)
queue.pause()
queue.concurrency = 3 // concurrency changes are ignored while paused
queue.concurrency = 2
queue.resume()
t.equal(queue.running(), 2, '2 jobs running')
queue.concurrency = 3
t.equal(queue.running(), 3, '3 jobs running')
queue.concurrency = 1
t.equal(queue.running(), 3, '3 jobs running') // running jobs can't be killed
queue.push(24, workDone)
queue.push(24, workDone)
queue.push(24, workDone)
queue.push(24, workDone)
function workDone (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
}
function worker (arg, cb) {
t.ok(queue.running() <= queue.concurrency, 'should respect the concurrency')
setImmediate(function () {
cb(null, true)
})
}
})
test('idle()', function (t) {
t.plan(12)
var queue = buildQueue(worker, 1)
t.ok(queue.idle(), 'queue is idle')
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
t.notOk(queue.idle(), 'queue is not idle')
})
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
// it will go idle after executing this function
setImmediate(function () {
t.ok(queue.idle(), 'queue is now idle')
})
})
t.notOk(queue.idle(), 'queue is not idle')
function worker (arg, cb) {
t.notOk(queue.idle(), 'queue is not idle')
t.equal(arg, 42)
setImmediate(cb, null, true)
}
})
test('saturated', function (t) {
t.plan(9)
var queue = buildQueue(worker, 1)
var preworked = 0
var worked = 0
queue.saturated = function () {
t.pass('saturated')
t.equal(preworked, 1, 'started 1 task')
t.equal(worked, 0, 'worked zero task')
}
queue.push(42, done)
queue.push(42, done)
function done (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
}
function worker (arg, cb) {
t.equal(arg, 42)
preworked++
setImmediate(function () {
worked++
cb(null, true)
})
}
})
test('length', function (t) {
t.plan(7)
var queue = buildQueue(worker, 1)
t.equal(queue.length(), 0, 'nothing waiting')
queue.push(42, done)
t.equal(queue.length(), 0, 'nothing waiting')
queue.push(42, done)
t.equal(queue.length(), 1, 'one task waiting')
queue.push(42, done)
t.equal(queue.length(), 2, 'two tasks waiting')
function done (err, result) {
t.error(err, 'no error')
}
function worker (arg, cb) {
setImmediate(function () {
cb(null, true)
})
}
})
test('getQueue', function (t) {
t.plan(10)
var queue = buildQueue(worker, 1)
t.equal(queue.getQueue().length, 0, 'nothing waiting')
queue.push(42, done)
t.equal(queue.getQueue().length, 0, 'nothing waiting')
queue.push(42, done)
t.equal(queue.getQueue().length, 1, 'one task waiting')
t.equal(queue.getQueue()[0], 42, 'should be equal')
queue.push(43, done)
t.equal(queue.getQueue().length, 2, 'two tasks waiting')
t.equal(queue.getQueue()[0], 42, 'should be equal')
t.equal(queue.getQueue()[1], 43, 'should be equal')
function done (err, result) {
t.error(err, 'no error')
}
function worker (arg, cb) {
setImmediate(function () {
cb(null, true)
})
}
})
test('unshift', function (t) {
t.plan(8)
var queue = buildQueue(worker, 1)
var expected = [1, 2, 3, 4]
queue.push(1, done)
queue.push(4, done)
queue.unshift(3, done)
queue.unshift(2, done)
function done (err, result) {
t.error(err, 'no error')
}
function worker (arg, cb) {
t.equal(expected.shift(), arg, 'tasks come in order')
setImmediate(function () {
cb(null, true)
})
}
})
test('unshift && empty', function (t) {
t.plan(2)
var queue = buildQueue(worker, 1)
var completed = false
queue.pause()
queue.empty = function () {
t.notOk(completed, 'the task has not completed yet')
}
queue.unshift(1, done)
queue.resume()
function done (err, result) {
completed = true
t.error(err, 'no error')
}
function worker (arg, cb) {
setImmediate(function () {
cb(null, true)
})
}
})
test('push && empty', function (t) {
t.plan(2)
var queue = buildQueue(worker, 1)
var completed = false
queue.pause()
queue.empty = function () {
t.notOk(completed, 'the task has not completed yet')
}
queue.push(1, done)
queue.resume()
function done (err, result) {
completed = true
t.error(err, 'no error')
}
function worker (arg, cb) {
setImmediate(function () {
cb(null, true)
})
}
})
test('kill', function (t) {
t.plan(5)
var queue = buildQueue(worker, 1)
var expected = [1]
var predrain = queue.drain
queue.drain = function drain () {
t.fail('drain should never be called')
}
queue.push(1, done)
queue.push(4, done)
queue.unshift(3, done)
queue.unshift(2, done)
queue.kill()
function done (err, result) {
t.error(err, 'no error')
setImmediate(function () {
t.equal(queue.length(), 0, 'no queued tasks')
t.equal(queue.running(), 0, 'no running tasks')
t.equal(queue.drain, predrain, 'drain is back to default')
})
}
function worker (arg, cb) {
t.equal(expected.shift(), arg, 'tasks come in order')
setImmediate(function () {
cb(null, true)
})
}
})
test('killAndDrain', function (t) {
t.plan(6)
var queue = buildQueue(worker, 1)
var expected = [1]
var predrain = queue.drain
queue.drain = function drain () {
t.pass('drain has been called')
}
queue.push(1, done)
queue.push(4, done)
queue.unshift(3, done)
queue.unshift(2, done)
queue.killAndDrain()
function done (err, result) {
t.error(err, 'no error')
setImmediate(function () {
t.equal(queue.length(), 0, 'no queued tasks')
t.equal(queue.running(), 0, 'no running tasks')
t.equal(queue.drain, predrain, 'drain is back to default')
})
}
function worker (arg, cb) {
t.equal(expected.shift(), arg, 'tasks come in order')
setImmediate(function () {
cb(null, true)
})
}
})
test('pause && idle', function (t) {
t.plan(11)
var queue = buildQueue(worker, 1)
var worked = false
t.notOk(queue.paused, 'it should not be paused')
t.ok(queue.idle(), 'should be idle')
queue.pause()
queue.push(42, function (err, result) {
t.error(err, 'no error')
t.equal(result, true, 'result matches')
})
t.notOk(worked, 'it should be paused')
t.ok(queue.paused, 'it should be paused')
t.notOk(queue.idle(), 'should not be idle')
queue.resume()
t.notOk(queue.paused, 'it should not be paused')
t.notOk(queue.idle(), 'it should not be idle')
function worker (arg, cb) {
t.equal(arg, 42)
worked = true
process.nextTick(cb.bind(null, null, true))
process.nextTick(function () {
t.ok(queue.idle(), 'is should be idle')
})
}
})
test('push without cb', function (t) {
t.plan(1)
var queue = buildQueue(worker, 1)
queue.push(42)
function worker (arg, cb) {
t.equal(arg, 42)
cb()
}
})
test('unshift without cb', function (t) {
t.plan(1)
var queue = buildQueue(worker, 1)
queue.unshift(42)
function worker (arg, cb) {
t.equal(arg, 42)
cb()
}
})
test('push with worker throwing error', function (t) {
t.plan(5)
var q = buildQueue(function (task, cb) {
cb(new Error('test error'), null)
}, 1)
q.error(function (err, task) {
t.ok(err instanceof Error, 'global error handler should catch the error')
t.match(err.message, /test error/, 'error message should be "test error"')
t.equal(task, 42, 'The task executed should be passed')
})
q.push(42, function (err) {
t.ok(err instanceof Error, 'push callback should catch the error')
t.match(err.message, /test error/, 'error message should be "test error"')
})
})
test('unshift with worker throwing error', function (t) {
t.plan(5)
var q = buildQueue(function (task, cb) {
cb(new Error('test error'), null)
}, 1)
q.error(function (err, task) {
t.ok(err instanceof Error, 'global error handler should catch the error')
t.match(err.message, /test error/, 'error message should be "test error"')
t.equal(task, 42, 'The task executed should be passed')
})
q.unshift(42, function (err) {
t.ok(err instanceof Error, 'unshift callback should catch the error')
t.match(err.message, /test error/, 'error message should be "test error"')
})
})
test('pause/resume should trigger drain event', function (t) {
t.plan(1)
var queue = buildQueue(worker, 1)
queue.pause()
queue.drain = function () {
t.pass('drain should be called')
}
function worker (arg, cb) {
cb(null, true)
}
queue.resume()
})
test('paused flag', function (t) {
t.plan(2)
var queue = buildQueue(function (arg, cb) {
cb(null)
}, 1)
t.equal(queue.paused, false)
queue.pause()
t.equal(queue.paused, true)
})
@@ -0,0 +1,482 @@
'use strict';
module.exports = function generate_validate(it, $keyword, $ruleType) {
var out = '';
var $async = it.schema.$async === true,
$refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'),
$id = it.self._getId(it.schema);
if (it.opts.strictKeywords) {
var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);
if ($unknownKwd) {
var $keywordsMsg = 'unknown keyword: ' + $unknownKwd;
if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg);
else throw new Error($keywordsMsg);
}
}
if (it.isTop) {
out += ' var validate = ';
if ($async) {
it.async = true;
out += 'async ';
}
out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; ';
if ($id && (it.opts.sourceCode || it.opts.processCode)) {
out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' ';
}
}
if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) {
var $keyword = 'false schema';
var $lvl = it.level;
var $dataLvl = it.dataLevel;
var $schema = it.schema[$keyword];
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
var $breakOnError = !it.opts.allErrors;
var $errorKeyword;
var $data = 'data' + ($dataLvl || '');
var $valid = 'valid' + $lvl;
if (it.schema === false) {
if (it.isTop) {
$breakOnError = true;
} else {
out += ' var ' + ($valid) + ' = false; ';
}
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
if (it.opts.messages !== false) {
out += ' , message: \'boolean schema is false\' ';
}
if (it.opts.verbose) {
out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
} else {
if (it.isTop) {
if ($async) {
out += ' return data; ';
} else {
out += ' validate.errors = null; return true; ';
}
} else {
out += ' var ' + ($valid) + ' = true; ';
}
}
if (it.isTop) {
out += ' }; return validate; ';
}
return out;
}
if (it.isTop) {
var $top = it.isTop,
$lvl = it.level = 0,
$dataLvl = it.dataLevel = 0,
$data = 'data';
it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
it.baseId = it.baseId || it.rootId;
delete it.isTop;
it.dataPathArr = [""];
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
var $defaultMsg = 'default is ignored in the schema root';
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
else throw new Error($defaultMsg);
}
out += ' var vErrors = null; ';
out += ' var errors = 0; ';
out += ' if (rootData === undefined) rootData = data; ';
} else {
var $lvl = it.level,
$dataLvl = it.dataLevel,
$data = 'data' + ($dataLvl || '');
if ($id) it.baseId = it.resolve.url(it.baseId, $id);
if ($async && !it.async) throw new Error('async schema in sync schema');
out += ' var errs_' + ($lvl) + ' = errors;';
}
var $valid = 'valid' + $lvl,
$breakOnError = !it.opts.allErrors,
$closingBraces1 = '',
$closingBraces2 = '';
var $errorKeyword;
var $typeSchema = it.schema.type,
$typeIsArray = Array.isArray($typeSchema);
if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {
if ($typeIsArray) {
if ($typeSchema.indexOf('null') == -1) $typeSchema = $typeSchema.concat('null');
} else if ($typeSchema != 'null') {
$typeSchema = [$typeSchema, 'null'];
$typeIsArray = true;
}
}
if ($typeIsArray && $typeSchema.length == 1) {
$typeSchema = $typeSchema[0];
$typeIsArray = false;
}
if (it.schema.$ref && $refKeywords) {
if (it.opts.extendRefs == 'fail') {
throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)');
} else if (it.opts.extendRefs !== true) {
$refKeywords = false;
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
}
}
if (it.schema.$comment && it.opts.$comment) {
out += ' ' + (it.RULES.all.$comment.code(it, '$comment'));
}
if ($typeSchema) {
if (it.opts.coerceTypes) {
var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema);
}
var $rulesGroup = it.RULES.types[$typeSchema];
if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) {
var $schemaPath = it.schemaPath + '.type',
$errSchemaPath = it.errSchemaPath + '/type';
var $schemaPath = it.schemaPath + '.type',
$errSchemaPath = it.errSchemaPath + '/type',
$method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
if ($coerceToTypes) {
var $dataType = 'dataType' + $lvl,
$coerced = 'coerced' + $lvl;
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
if (it.opts.coerceTypes == 'array') {
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } ';
}
out += ' if (' + ($coerced) + ' !== undefined) ; ';
var arr1 = $coerceToTypes;
if (arr1) {
var $type, $i = -1,
l1 = arr1.length - 1;
while ($i < l1) {
$type = arr1[$i += 1];
if ($type == 'string') {
out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
} else if ($type == 'number' || $type == 'integer') {
out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
if ($type == 'integer') {
out += ' && !(' + ($data) + ' % 1)';
}
out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
} else if ($type == 'boolean') {
out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
} else if ($type == 'null') {
out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
} else if (it.opts.coerceTypes == 'array' && $type == 'array') {
out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
}
}
}
out += ' else { ';
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
if ($typeIsArray) {
out += '' + ($typeSchema.join(","));
} else {
out += '' + ($typeSchema);
}
out += '\' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should be ';
if ($typeIsArray) {
out += '' + ($typeSchema.join(","));
} else {
out += '' + ($typeSchema);
}
out += '\' ';
}
if (it.opts.verbose) {
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
out += ' } if (' + ($coerced) + ' !== undefined) { ';
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
if (!$dataLvl) {
out += 'if (' + ($parentData) + ' !== undefined)';
}
out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } ';
} else {
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
if ($typeIsArray) {
out += '' + ($typeSchema.join(","));
} else {
out += '' + ($typeSchema);
}
out += '\' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should be ';
if ($typeIsArray) {
out += '' + ($typeSchema.join(","));
} else {
out += '' + ($typeSchema);
}
out += '\' ';
}
if (it.opts.verbose) {
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
}
out += ' } ';
}
}
if (it.schema.$ref && !$refKeywords) {
out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' ';
if ($breakOnError) {
out += ' } if (errors === ';
if ($top) {
out += '0';
} else {
out += 'errs_' + ($lvl);
}
out += ') { ';
$closingBraces2 += '}';
}
} else {
var arr2 = it.RULES;
if (arr2) {
var $rulesGroup, i2 = -1,
l2 = arr2.length - 1;
while (i2 < l2) {
$rulesGroup = arr2[i2 += 1];
if ($shouldUseGroup($rulesGroup)) {
if ($rulesGroup.type) {
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
}
if (it.opts.useDefaults) {
if ($rulesGroup.type == 'object' && it.schema.properties) {
var $schema = it.schema.properties,
$schemaKeys = Object.keys($schema);
var arr3 = $schemaKeys;
if (arr3) {
var $propertyKey, i3 = -1,
l3 = arr3.length - 1;
while (i3 < l3) {
$propertyKey = arr3[i3 += 1];
var $sch = $schema[$propertyKey];
if ($sch.default !== undefined) {
var $passData = $data + it.util.getProperty($propertyKey);
if (it.compositeRule) {
if (it.opts.strictDefaults) {
var $defaultMsg = 'default is ignored for: ' + $passData;
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
else throw new Error($defaultMsg);
}
} else {
out += ' if (' + ($passData) + ' === undefined ';
if (it.opts.useDefaults == 'empty') {
out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';
}
out += ' ) ' + ($passData) + ' = ';
if (it.opts.useDefaults == 'shared') {
out += ' ' + (it.useDefault($sch.default)) + ' ';
} else {
out += ' ' + (JSON.stringify($sch.default)) + ' ';
}
out += '; ';
}
}
}
}
} else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) {
var arr4 = it.schema.items;
if (arr4) {
var $sch, $i = -1,
l4 = arr4.length - 1;
while ($i < l4) {
$sch = arr4[$i += 1];
if ($sch.default !== undefined) {
var $passData = $data + '[' + $i + ']';
if (it.compositeRule) {
if (it.opts.strictDefaults) {
var $defaultMsg = 'default is ignored for: ' + $passData;
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
else throw new Error($defaultMsg);
}
} else {
out += ' if (' + ($passData) + ' === undefined ';
if (it.opts.useDefaults == 'empty') {
out += ' || ' + ($passData) + ' === null || ' + ($passData) + ' === \'\' ';
}
out += ' ) ' + ($passData) + ' = ';
if (it.opts.useDefaults == 'shared') {
out += ' ' + (it.useDefault($sch.default)) + ' ';
} else {
out += ' ' + (JSON.stringify($sch.default)) + ' ';
}
out += '; ';
}
}
}
}
}
}
var arr5 = $rulesGroup.rules;
if (arr5) {
var $rule, i5 = -1,
l5 = arr5.length - 1;
while (i5 < l5) {
$rule = arr5[i5 += 1];
if ($shouldUseRule($rule)) {
var $code = $rule.code(it, $rule.keyword, $rulesGroup.type);
if ($code) {
out += ' ' + ($code) + ' ';
if ($breakOnError) {
$closingBraces1 += '}';
}
}
}
}
}
if ($breakOnError) {
out += ' ' + ($closingBraces1) + ' ';
$closingBraces1 = '';
}
if ($rulesGroup.type) {
out += ' } ';
if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) {
out += ' else { ';
var $schemaPath = it.schemaPath + '.type',
$errSchemaPath = it.errSchemaPath + '/type';
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \'';
if ($typeIsArray) {
out += '' + ($typeSchema.join(","));
} else {
out += '' + ($typeSchema);
}
out += '\' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should be ';
if ($typeIsArray) {
out += '' + ($typeSchema.join(","));
} else {
out += '' + ($typeSchema);
}
out += '\' ';
}
if (it.opts.verbose) {
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
out += ' } ';
}
}
if ($breakOnError) {
out += ' if (errors === ';
if ($top) {
out += '0';
} else {
out += 'errs_' + ($lvl);
}
out += ') { ';
$closingBraces2 += '}';
}
}
}
}
}
if ($breakOnError) {
out += ' ' + ($closingBraces2) + ' ';
}
if ($top) {
if ($async) {
out += ' if (errors === 0) return data; ';
out += ' else throw new ValidationError(vErrors); ';
} else {
out += ' validate.errors = vErrors; ';
out += ' return errors === 0; ';
}
out += ' }; return validate;';
} else {
out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
}
function $shouldUseGroup($rulesGroup) {
var rules = $rulesGroup.rules;
for (var i = 0; i < rules.length; i++)
if ($shouldUseRule(rules[i])) return true;
}
function $shouldUseRule($rule) {
return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule));
}
function $ruleImplementsSomeKeyword($rule) {
var impl = $rule.implements;
for (var i = 0; i < impl.length; i++)
if (it.schema[impl[i]] !== undefined) return true;
}
return out;
}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Chai.js Assertion Library
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,47 @@
import * as qs from 'node:querystring';
/**
* @typedef ParsedURL
* @type {import('.').ParsedURL}
*/
/**
* @typedef Request
* @property {string} url
* @property {ParsedURL} _parsedUrl
*/
/**
* @param {Request} req
* @returns {ParsedURL|void}
*/
export function parse(req) {
let raw = req.url;
if (raw == null) return;
let prev = req._parsedUrl;
if (prev && prev.raw === raw) return prev;
let pathname=raw, search='', query, hash;
if (raw.length > 1) {
let idx = raw.indexOf('#', 1);
if (idx !== -1) {
hash = raw.substring(idx);
pathname = raw.substring(0, idx);
}
idx = pathname.indexOf('?', 1);
if (idx !== -1) {
search = pathname.substring(idx);
pathname = pathname.substring(0, idx);
if (search.length > 1) {
query = qs.parse(search.substring(1));
}
}
}
return req._parsedUrl = { pathname, search, query, hash, raw };
}
@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CanonicalizeUnicodeLocaleId = CanonicalizeUnicodeLocaleId;
function CanonicalizeUnicodeLocaleId(locale) {
return Intl.getCanonicalLocales(locale)[0];
}
@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _jsxAstUtils = require("jsx-ast-utils");
var _schemas = require("../util/schemas");
var _getElementType = _interopRequireDefault(require("../util/getElementType"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
* @fileoverview Enforce usage of onBlur over onChange for accessibility.
* @author Ethan Cohen
*/
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
var errorMessage = 'onBlur must be used instead of onchange, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users.';
var applicableTypes = ['select', 'option'];
var schema = (0, _schemas.generateObjSchema)();
var _default = exports["default"] = {
meta: {
docs: {
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/no-onchange.md',
description: 'Enforce usage of `onBlur` over `onChange` on select menus for accessibility.'
},
deprecated: true,
schema: [schema]
},
create: function create(context) {
var elementType = (0, _getElementType["default"])(context);
return {
JSXOpeningElement: function JSXOpeningElement(node) {
var nodeType = elementType(node);
if (applicableTypes.indexOf(nodeType) === -1) {
return;
}
var onChange = (0, _jsxAstUtils.getProp)(node.attributes, 'onChange');
var hasOnBlur = (0, _jsxAstUtils.getProp)(node.attributes, 'onBlur') !== undefined;
if (onChange && !hasOnBlur) {
context.report({
node,
message: errorMessage
});
}
}
};
}
};
module.exports = exports.default;
@@ -0,0 +1 @@
{"name":"run-parallel","version":"1.2.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532095613,"integrity":"sha512-UOL/xGxwuTxsayJ0nO2SgwXC182o0nLZBOeagglDRd22rd1cJjlutgtlpdE8Sd463UDlKjR2VFYYD1GyHr7Xog==","mode":420,"size":1081},"index.js":{"checkedAt":1794532095613,"integrity":"sha512-/wZPeJkGsdswZL09gi/HENtDpRyPXN1IkSV9ZmEFaj4BKLHCai3/nL5Lyw+yVP7b0kKBja8A+4e5biijegnFaQ==","mode":420,"size":1034},"package.json":{"checkedAt":1794532095613,"integrity":"sha512-56xaki+SFvCUavZLKew7/IjfFWai1nDck5f1hTxdV88+OxW6RGnUxFddWb+TIh1UuiOi2FIe4CGPSzfmzyVWSA==","mode":420,"size":1291},"README.md":{"checkedAt":1794532095614,"integrity":"sha512-JbMQ5fPgwlVHkMEne4CXv/Q5c3vDm7Jf7ISdGVtqEI8d+5WUOE8c4GtmqYAbjLqVnJQl9JPUgb2ELi4YPEs6yg==","mode":420,"size":3157}}}
@@ -0,0 +1,12 @@
import { isMotionValue } from 'motion-dom';
/**
* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
*
* TODO: Remove and move to library
*/
function resolveMotionValue(value) {
return isMotionValue(value) ? value.get() : value;
}
export { resolveMotionValue };
@@ -0,0 +1 @@
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/path/common.ts"],"names":[],"mappings":"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 truncated
@@ -0,0 +1,18 @@
import asciiToArray from './_asciiToArray.js';
import hasUnicode from './_hasUnicode.js';
import unicodeToArray from './_unicodeToArray.js';
/**
* Converts `string` to an array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the converted array.
*/
function stringToArray(string) {
return hasUnicode(string)
? unicodeToArray(string)
: asciiToArray(string);
}
export default stringToArray;
@@ -0,0 +1 @@
{"name":"node-addon-api","version":"7.1.1","requiresBuild":false,"files":{"nothing.c":{"checkedAt":1794532090153,"integrity":"sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==","mode":420,"size":0},"node_addon_api.gyp":{"checkedAt":1794532103057,"integrity":"sha512-Q4ZhH9O9zJzQQeF6a1t5OcE/dXM/PStW+8uKXDfUMcKBOeaAtar3jRlW/tllYw9yNk5KUfn1ckd4S+n7Mzg87w==","mode":420,"size":793},"node_api.gyp":{"checkedAt":1794532103057,"integrity":"sha512-Q3FYRfcBq9wJ/lnTPj9h4ZJ4q7rLEi7a8bJt5VvYCzNUt21WFpBcgDjrYVjDOZFitApzdCt+THM7OsGH6dsKow==","mode":420,"size":132},"common.gypi":{"checkedAt":1794532103057,"integrity":"sha512-8Fx85VWHMc4wyhfvG5UtzxXFRkG3hOCexCchUAQQFrWwFoRbNrM3yEtjpjqPiTfLYdOges0tncfnTk3CWGFOiQ==","mode":420,"size":724},"except.gypi":{"checkedAt":1794532103057,"integrity":"sha512-806ru1yVOexk+UcHVHg+jSrQBPLxYT3fKk58vy0+BCdJa2Css9LgzgPWjjgRc1HojvHSqRI2WaBVbwo9Df9Qpw==","mode":420,"size":560},"noexcept.gypi":{"checkedAt":1794532103057,"integrity":"sha512-hXkjFRZJt341wNGk8xkf5lRjqy+1dGJWaS+W+NyBCp5A7vqF6qgUGv7UndiW98tY4utIk/lLQOQllxjFC5MHTA==","mode":420,"size":639},"napi-inl.deprecated.h":{"checkedAt":1794532103058,"integrity":"sha512-O4X8C7Qp/xUZtpe/e1Q+gmUiS7kCfOtqlHvfYQjf9W33l9kR5vQvdGZK6a95iwYL7BsIEGXr5nKGcl8iRFOI1g==","mode":420,"size":6323},"napi-inl.h":{"checkedAt":1794532103058,"integrity":"sha512-r967SZG6EPxmjFvKdK9uASuuulcpFpsY/kOfvoXdrr8n+ayJsEWcQDWVV3EhJGI08tCaLJGZ5emAgSymHkbrxw==","mode":420,"size":219411},"napi.h":{"checkedAt":1794532103059,"integrity":"sha512-8QK6HogqhQ+CKfiKoRXhFe0vc94A31y/zPLIGWnaikDCawbaurY28vumJgugpNzJKOydwG54cJePPGfePGCleA==","mode":420,"size":115423},"tools/check-napi.js":{"checkedAt":1794532103059,"integrity":"sha512-bIJbWygiQAfv0AXL9l/9tS8gQAycgKL+Rb7Tdc6IYqZWowNn5TExW+vH1ofH+jVDPmWXXrkN1AS0LcnDsRUq5A==","mode":420,"size":3176},"tools/clang-format.js":{"checkedAt":1794532103059,"integrity":"sha512-++/oLfx+qeHhOlNDSBRfJqU5XuDnmx+sRF2NuPnBN8yAtt4pc9Iv4zkGtuFm+2XlZKEiNa2N4OR3MZMlblpm0g==","mode":420,"size":2002},"tools/conversion.js":{"checkedAt":1794532103059,"integrity":"sha512-sONhkk5wyG+v1lfU02+QBhh7n4jcmx0JrN7B2I2m1OMAaJLdJAnlALxTiGRoXfWs6mUJ2gWsigIGWcu/S6YCZg==","mode":493,"size":15013},"tools/eslint-format.js":{"checkedAt":1794532103060,"integrity":"sha512-nY0IR/rGZO1FAXXw95Ilbz/+pwHbW3N0U7PZa5Y8jjpU9o3/VMkecwlKZIh3JWGko0PSvakrViXB9DzvLe6UVw==","mode":420,"size":2071},"index.js":{"checkedAt":1794532103060,"integrity":"sha512-7PCGAWqbBvmXDZGeOuqhOL2DEfhquTmZuUh+ixvxJL+/4NhWqu0cAWAd+Fxv7ROy5kDQXBShSAELAwSb4Q84gw==","mode":420,"size":377},"package-support.json":{"checkedAt":1794532103060,"integrity":"sha512-u8diyIhux4/YibRqv9n5rKf10srb+WdvagEAJtQFbKoHZRY4CzwHN8YZYui7WwVVCV3QOGyZ2dp3PCAM+hMHVQ==","mode":420,"size":467},"package.json":{"checkedAt":1794532103060,"integrity":"sha512-oy9CHacgKPufnotQ8YxHdPj4u5Lw+z+rgVdoS6IgRvS0dUYklHQcpsU9rF3Gmztl//y6zJCnlLMoXM7jT856Vw==","mode":420,"size":10784},"LICENSE.md":{"checkedAt":1794532103060,"integrity":"sha512-VEgcMoIxeH4zGehni1awyJi7bXsTAqfHQyAGARb8A6bXR9At8Gi7p5YKcaeGCPOltAo+EQuuEH1Bu0CYjY/Csg==","mode":420,"size":1150},"README.md":{"checkedAt":1794532103061,"integrity":"sha512-DRFWO1J+Dhq5l6bf7qf6t5qrWiSRyuIeHKeyGVSkRVl+1mLCWpCBz1NtHfEU0e01oP/OIKhv4m3O4jhsKhyYsQ==","mode":420,"size":14050},"tools/README.md":{"checkedAt":1794532103061,"integrity":"sha512-B9rR2cXGGK/F/iuBg+pA2wzXNuBgC6i95PONtybYXid8RgFA7zEskadIogj/pyKDvgGiJPl280IfFEopd+pLLw==","mode":420,"size":3217}}}
@@ -0,0 +1,54 @@
import * as React from "react";
import { flushSync } from "react-dom";
import { observeElementRect, observeElementOffset, elementScroll, observeWindowRect, observeWindowOffset, windowScroll, Virtualizer } from "@tanstack/virtual-core";
export * from "@tanstack/virtual-core";
const useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
function useVirtualizerBase(options) {
const rerender = React.useReducer(() => ({}), {})[1];
const resolvedOptions = {
...options,
onChange: (instance2, sync) => {
var _a;
if (sync) {
flushSync(rerender);
} else {
rerender();
}
(_a = options.onChange) == null ? void 0 : _a.call(options, instance2, sync);
}
};
const [instance] = React.useState(
() => new Virtualizer(resolvedOptions)
);
instance.setOptions(resolvedOptions);
useIsomorphicLayoutEffect(() => {
return instance._didMount();
}, []);
useIsomorphicLayoutEffect(() => {
return instance._willUpdate();
});
return instance;
}
function useVirtualizer(options) {
return useVirtualizerBase({
observeElementRect,
observeElementOffset,
scrollToFn: elementScroll,
...options
});
}
function useWindowVirtualizer(options) {
return useVirtualizerBase({
getScrollElement: () => typeof document !== "undefined" ? window : null,
observeElementRect: observeWindowRect,
observeElementOffset: observeWindowOffset,
scrollToFn: windowScroll,
initialOffset: () => typeof document !== "undefined" ? window.scrollY : 0,
...options
});
}
export {
useVirtualizer,
useWindowVirtualizer
};
//# sourceMappingURL=index.js.map
@@ -0,0 +1,168 @@
'use strict';
module.exports = function generate_dependencies(it, $keyword, $ruleType) {
var out = ' ';
var $lvl = it.level;
var $dataLvl = it.dataLevel;
var $schema = it.schema[$keyword];
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
var $breakOnError = !it.opts.allErrors;
var $data = 'data' + ($dataLvl || '');
var $errs = 'errs__' + $lvl;
var $it = it.util.copy(it);
var $closingBraces = '';
$it.level++;
var $nextValid = 'valid' + $it.level;
var $schemaDeps = {},
$propertyDeps = {},
$ownProperties = it.opts.ownProperties;
for ($property in $schema) {
if ($property == '__proto__') continue;
var $sch = $schema[$property];
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
$deps[$property] = $sch;
}
out += 'var ' + ($errs) + ' = errors;';
var $currentErrorPath = it.errorPath;
out += 'var missing' + ($lvl) + ';';
for (var $property in $propertyDeps) {
$deps = $propertyDeps[$property];
if ($deps.length) {
out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
if ($ownProperties) {
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
}
if ($breakOnError) {
out += ' && ( ';
var arr1 = $deps;
if (arr1) {
var $propertyKey, $i = -1,
l1 = arr1.length - 1;
while ($i < l1) {
$propertyKey = arr1[$i += 1];
if ($i) {
out += ' || ';
}
var $prop = it.util.getProperty($propertyKey),
$useData = $data + $prop;
out += ' ( ( ' + ($useData) + ' === undefined ';
if ($ownProperties) {
out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
}
out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
}
}
out += ')) { ';
var $propertyPath = 'missing' + $lvl,
$missingProperty = '\' + ' + $propertyPath + ' + \'';
if (it.opts._errorDataPathProperty) {
it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
}
var $$outStack = $$outStack || [];
$$outStack.push(out);
out = ''; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should have ';
if ($deps.length == 1) {
out += 'property ' + (it.util.escapeQuotes($deps[0]));
} else {
out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
}
out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
}
if (it.opts.verbose) {
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
var __err = out;
out = $$outStack.pop();
if (!it.compositeRule && $breakOnError) {
/* istanbul ignore if */
if (it.async) {
out += ' throw new ValidationError([' + (__err) + ']); ';
} else {
out += ' validate.errors = [' + (__err) + ']; return false; ';
}
} else {
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
}
} else {
out += ' ) { ';
var arr2 = $deps;
if (arr2) {
var $propertyKey, i2 = -1,
l2 = arr2.length - 1;
while (i2 < l2) {
$propertyKey = arr2[i2 += 1];
var $prop = it.util.getProperty($propertyKey),
$missingProperty = it.util.escapeQuotes($propertyKey),
$useData = $data + $prop;
if (it.opts._errorDataPathProperty) {
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
}
out += ' if ( ' + ($useData) + ' === undefined ';
if ($ownProperties) {
out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
}
out += ') { var err = '; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
if (it.opts.messages !== false) {
out += ' , message: \'should have ';
if ($deps.length == 1) {
out += 'property ' + (it.util.escapeQuotes($deps[0]));
} else {
out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
}
out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
}
if (it.opts.verbose) {
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
}
out += ' } ';
} else {
out += ' {} ';
}
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
}
}
}
out += ' } ';
if ($breakOnError) {
$closingBraces += '}';
out += ' else { ';
}
}
}
it.errorPath = $currentErrorPath;
var $currentBaseId = $it.baseId;
for (var $property in $schemaDeps) {
var $sch = $schemaDeps[$property];
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
if ($ownProperties) {
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
}
out += ') { ';
$it.schema = $sch;
$it.schemaPath = $schemaPath + it.util.getProperty($property);
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
out += ' ' + (it.validate($it)) + ' ';
$it.baseId = $currentBaseId;
out += ' } ';
if ($breakOnError) {
out += ' if (' + ($nextValid) + ') { ';
$closingBraces += '}';
}
}
}
if ($breakOnError) {
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
}
return out;
}
@@ -0,0 +1,79 @@
{
"name": "domutils",
"version": "3.2.2",
"description": "Utilities for working with htmlparser2's dom",
"author": "Felix Boehm <me@feedic.com>",
"funding": {
"url": "https://github.com/fb55/domutils?sponsor=1"
},
"license": "BSD-2-Clause",
"sideEffects": false,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "lib/esm/index.js",
"exports": {
"require": "./lib/index.js",
"import": "./lib/esm/index.js"
},
"files": [
"lib/**/*"
],
"scripts": {
"test": "npm run test:jest && npm run lint",
"test:jest": "jest",
"lint": "npm run lint:es && npm run lint:prettier",
"lint:es": "eslint --ignore-path .gitignore .",
"lint:prettier": "npm run prettier -- --check",
"format": "npm run format:es && npm run format:prettier",
"format:es": "npm run lint:es -- --fix",
"format:prettier": "npm run prettier -- --write",
"prettier": "prettier \"**/*.{ts,md,json,yml}\" --ignore-path .gitignore",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --sourceRoot https://raw.githubusercontent.com/fb55/domutils/$(git rev-parse HEAD)/src/",
"build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json",
"build:docs": "typedoc src",
"prepare": "npm run build"
},
"repository": {
"type": "git",
"url": "git://github.com/fb55/domutils.git"
},
"keywords": [
"dom",
"htmlparser2"
],
"dependencies": {
"dom-serializer": "^2.0.0",
"domelementtype": "^2.3.0",
"domhandler": "^5.0.3"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@typescript-eslint/eslint-plugin": "^8.19.0",
"@typescript-eslint/parser": "^8.19.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^50.6.1",
"htmlparser2": "~9.1.0",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"ts-jest": "^29.2.5",
"typedoc": "^0.27.6",
"typescript": "^5.7.2"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"coverageProvider": "v8",
"moduleNameMapper": {
"^(.*)\\.js$": [
"$1.js",
"$1"
]
}
},
"prettier": {
"tabWidth": 4
}
}
@@ -0,0 +1,29 @@
/**
* @fileoverview APIs that are not officially supported by ESLint.
* These APIs may change or be removed at any time. Use at your
* own risk.
* @author Nicholas C. Zakas
*/
"use strict";
//-----------------------------------------------------------------------------
// Requirements
//-----------------------------------------------------------------------------
const { FileEnumerator } = require("./cli-engine/file-enumerator");
const { ESLint: FlatESLint, shouldUseFlatConfig } = require("./eslint/eslint");
const { LegacyESLint } = require("./eslint/legacy-eslint");
const builtinRules = require("./rules");
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
module.exports = {
builtinRules,
FlatESLint,
shouldUseFlatConfig,
FileEnumerator,
LegacyESLint,
};
@@ -0,0 +1,10 @@
import { AsnArray } from "@peculiar/asn1-schema";
import { Attribute } from "@peculiar/asn1-x509";
/**
* ```asn1
* Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}
* ```
*/
export declare class Attributes extends AsnArray<Attribute> {
constructor(items?: Attribute[]);
}
@@ -0,0 +1,14 @@
/**
* Turn an mdast `heading` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Heading} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function heading(state: State, node: Heading): Element;
export type Element = import("hast").Element;
export type Heading = import("mdast").Heading;
export type State = import("../state.js").State;
@@ -0,0 +1,96 @@
/**
* This handler implements the default behaviour for unknown fields.
* When reading data, unknown fields are stored on the message, in a
* symbol property.
* When writing data, the symbol property is queried and unknown fields
* are serialized into the output again.
*/
export var UnknownFieldHandler;
(function (UnknownFieldHandler) {
/**
* The symbol used to store unknown fields for a message.
* The property must conform to `UnknownFieldContainer`.
*/
UnknownFieldHandler.symbol = Symbol.for("protobuf-ts/unknown");
/**
* Store an unknown field during binary read directly on the message.
* This method is compatible with `BinaryReadOptions.readUnknownField`.
*/
UnknownFieldHandler.onRead = (typeName, message, fieldNo, wireType, data) => {
let container = is(message) ? message[UnknownFieldHandler.symbol] : message[UnknownFieldHandler.symbol] = [];
container.push({ no: fieldNo, wireType, data });
};
/**
* Write unknown fields stored for the message to the writer.
* This method is compatible with `BinaryWriteOptions.writeUnknownFields`.
*/
UnknownFieldHandler.onWrite = (typeName, message, writer) => {
for (let { no, wireType, data } of UnknownFieldHandler.list(message))
writer.tag(no, wireType).raw(data);
};
/**
* List unknown fields stored for the message.
* Note that there may be multiples fields with the same number.
*/
UnknownFieldHandler.list = (message, fieldNo) => {
if (is(message)) {
let all = message[UnknownFieldHandler.symbol];
return fieldNo ? all.filter(uf => uf.no == fieldNo) : all;
}
return [];
};
/**
* Returns the last unknown field by field number.
*/
UnknownFieldHandler.last = (message, fieldNo) => UnknownFieldHandler.list(message, fieldNo).slice(-1)[0];
const is = (message) => message && Array.isArray(message[UnknownFieldHandler.symbol]);
})(UnknownFieldHandler || (UnknownFieldHandler = {}));
/**
* Merges binary write or read options. Later values override earlier values.
*/
export function mergeBinaryOptions(a, b) {
return Object.assign(Object.assign({}, a), b);
}
/**
* Protobuf binary format wire types.
*
* A wire type provides just enough information to find the length of the
* following value.
*
* See https://developers.google.com/protocol-buffers/docs/encoding#structure
*/
export var WireType;
(function (WireType) {
/**
* Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum
*/
WireType[WireType["Varint"] = 0] = "Varint";
/**
* Used for fixed64, sfixed64, double.
* Always 8 bytes with little-endian byte order.
*/
WireType[WireType["Bit64"] = 1] = "Bit64";
/**
* Used for string, bytes, embedded messages, packed repeated fields
*
* Only repeated numeric types (types which use the varint, 32-bit,
* or 64-bit wire types) can be packed. In proto3, such fields are
* packed by default.
*/
WireType[WireType["LengthDelimited"] = 2] = "LengthDelimited";
/**
* Used for groups
* @deprecated
*/
WireType[WireType["StartGroup"] = 3] = "StartGroup";
/**
* Used for groups
* @deprecated
*/
WireType[WireType["EndGroup"] = 4] = "EndGroup";
/**
* Used for fixed32, sfixed32, float.
* Always 4 bytes with little-endian byte order.
*/
WireType[WireType["Bit32"] = 5] = "Bit32";
})(WireType || (WireType = {}));
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttCertIssuer = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const asn1_x509_1 = require("@peculiar/asn1-x509");
const v2_form_1 = require("./v2_form");
let AttCertIssuer = class AttCertIssuer {
constructor(params = {}) {
Object.assign(this, params);
}
};
exports.AttCertIssuer = AttCertIssuer;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.GeneralName, repeated: "sequence" })
], AttCertIssuer.prototype, "v1Form", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: v2_form_1.V2Form, context: 0, implicit: true })
], AttCertIssuer.prototype, "v2Form", void 0);
exports.AttCertIssuer = AttCertIssuer = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Choice })
], AttCertIssuer);
@@ -0,0 +1,8 @@
import regeneratorAsyncGen from "./regeneratorAsyncGen.js";
function _regeneratorAsync(n, e, r, t, o) {
var a = regeneratorAsyncGen(n, e, r, t, o);
return a.next().then(function (n) {
return n.done ? n.value : a.next();
});
}
export { _regeneratorAsync as default };
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"A B","2":"K D E F wC"},B:{"1":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"xC TC 0C 1C"},D:{"1":"0 1 2 3 4 5 6 7 8 9 L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"J ZB K D E F A B C"},E:{"1":"K D E F A B C L M G 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J 2C ZC","132":"ZB 3C"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z JD OC","2":"F B FD GD HD ID NC uC"},G:{"1":"E LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"ZC KD vC"},H:{"1":"hD"},I:{"1":"TC J I lD vC mD nD","2":"iD jD kD"},J:{"1":"D A"},K:{"1":"C H uC OC","2":"A B NC"},L:{"1":"I"},M:{"1":"MC"},N:{"1":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:6,C:"ECMAScript 5 Strict Mode",D:true};
@@ -0,0 +1,813 @@
/* eslint-disable valid-jsdoc, @typescript-eslint/no-unused-vars */
import type { ComponentType } from 'react'
import { React } from '../utils/react'
import { isValidElementType, isContextConsumer } from '../utils/react-is'
import type { Store } from 'redux'
import type {
ConnectedComponent,
InferableComponentEnhancer,
InferableComponentEnhancerWithProps,
ResolveThunks,
DispatchProp,
ConnectPropsMaybeWithoutContext,
} from '../types'
import type {
MapStateToPropsParam,
MapDispatchToPropsParam,
MergeProps,
MapDispatchToPropsNonObject,
SelectorFactoryOptions,
} from '../connect/selectorFactory'
import defaultSelectorFactory from '../connect/selectorFactory'
import { mapDispatchToPropsFactory } from '../connect/mapDispatchToProps'
import { mapStateToPropsFactory } from '../connect/mapStateToProps'
import { mergePropsFactory } from '../connect/mergeProps'
import type { Subscription } from '../utils/Subscription'
import { createSubscription } from '../utils/Subscription'
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect'
import shallowEqual from '../utils/shallowEqual'
import hoistStatics from '../utils/hoistStatics'
import warning from '../utils/warning'
import type {
ReactReduxContextValue,
ReactReduxContextInstance,
} from './Context'
import { ReactReduxContext } from './Context'
// Define some constant arrays just to avoid re-creating these
const EMPTY_ARRAY: [unknown, number] = [null, 0]
const NO_SUBSCRIPTION_ARRAY = [null, null]
// Attempts to stringify whatever not-really-a-component value we were given
// for logging in an error message
const stringifyComponent = (Comp: unknown) => {
try {
return JSON.stringify(Comp)
} catch (err) {
return String(Comp)
}
}
type EffectFunc = (...args: any[]) => void | ReturnType<React.EffectCallback>
// This is "just" a `useLayoutEffect`, but with two modifications:
// - we need to fall back to `useEffect` in SSR to avoid annoying warnings
// - we extract this to a separate function to avoid closing over values
// and causing memory leaks
function useIsomorphicLayoutEffectWithArgs(
effectFunc: EffectFunc,
effectArgs: any[],
dependencies?: React.DependencyList,
) {
useIsomorphicLayoutEffect(() => effectFunc(...effectArgs), dependencies)
}
// Effect callback, extracted: assign the latest props values to refs for later usage
function captureWrapperProps(
lastWrapperProps: React.MutableRefObject<unknown>,
lastChildProps: React.MutableRefObject<unknown>,
renderIsScheduled: React.MutableRefObject<boolean>,
wrapperProps: unknown,
// actualChildProps: unknown,
childPropsFromStoreUpdate: React.MutableRefObject<unknown>,
notifyNestedSubs: () => void,
) {
// We want to capture the wrapper props and child props we used for later comparisons
lastWrapperProps.current = wrapperProps
renderIsScheduled.current = false
// If the render was from a store update, clear out that reference and cascade the subscriber update
if (childPropsFromStoreUpdate.current) {
childPropsFromStoreUpdate.current = null
notifyNestedSubs()
}
}
// Effect callback, extracted: subscribe to the Redux store or nearest connected ancestor,
// check for updates after dispatched actions, and trigger re-renders.
function subscribeUpdates(
shouldHandleStateChanges: boolean,
store: Store,
subscription: Subscription,
childPropsSelector: (state: unknown, props: unknown) => unknown,
lastWrapperProps: React.MutableRefObject<unknown>,
lastChildProps: React.MutableRefObject<unknown>,
renderIsScheduled: React.MutableRefObject<boolean>,
isMounted: React.MutableRefObject<boolean>,
childPropsFromStoreUpdate: React.MutableRefObject<unknown>,
notifyNestedSubs: () => void,
// forceComponentUpdateDispatch: React.Dispatch<any>,
additionalSubscribeListener: () => void,
) {
// If we're not subscribed to the store, nothing to do here
if (!shouldHandleStateChanges) return () => {}
// Capture values for checking if and when this component unmounts
let didUnsubscribe = false
let lastThrownError: Error | null = null
// We'll run this callback every time a store subscription update propagates to this component
const checkForUpdates = () => {
if (didUnsubscribe || !isMounted.current) {
// Don't run stale listeners.
// Redux doesn't guarantee unsubscriptions happen until next dispatch.
return
}
// TODO We're currently calling getState ourselves here, rather than letting `uSES` do it
const latestStoreState = store.getState()
let newChildProps, error
try {
// Actually run the selector with the most recent store state and wrapper props
// to determine what the child props should be
newChildProps = childPropsSelector(
latestStoreState,
lastWrapperProps.current,
)
} catch (e) {
error = e
lastThrownError = e as Error | null
}
if (!error) {
lastThrownError = null
}
// If the child props haven't changed, nothing to do here - cascade the subscription update
if (newChildProps === lastChildProps.current) {
if (!renderIsScheduled.current) {
notifyNestedSubs()
}
} else {
// Save references to the new child props. Note that we track the "child props from store update"
// as a ref instead of a useState/useReducer because we need a way to determine if that value has
// been processed. If this went into useState/useReducer, we couldn't clear out the value without
// forcing another re-render, which we don't want.
lastChildProps.current = newChildProps
childPropsFromStoreUpdate.current = newChildProps
renderIsScheduled.current = true
// TODO This is hacky and not how `uSES` is meant to be used
// Trigger the React `useSyncExternalStore` subscriber
additionalSubscribeListener()
}
}
// Actually subscribe to the nearest connected ancestor (or store)
subscription.onStateChange = checkForUpdates
subscription.trySubscribe()
// Pull data from the store after first render in case the store has
// changed since we began.
checkForUpdates()
const unsubscribeWrapper = () => {
didUnsubscribe = true
subscription.tryUnsubscribe()
subscription.onStateChange = null
if (lastThrownError) {
// It's possible that we caught an error due to a bad mapState function, but the
// parent re-rendered without this component and we're about to unmount.
// This shouldn't happen as long as we do top-down subscriptions correctly, but
// if we ever do those wrong, this throw will surface the error in our tests.
// In that case, throw the error from here so it doesn't get lost.
throw lastThrownError
}
}
return unsubscribeWrapper
}
// Reducer initial state creation for our update reducer
const initStateUpdates = () => EMPTY_ARRAY
export interface ConnectProps {
/** A custom Context instance that the component can use to access the store from an alternate Provider using that same Context instance */
context?: ReactReduxContextInstance
/** A Redux store instance to be used for subscriptions instead of the store from a Provider */
store?: Store
}
interface InternalConnectProps extends ConnectProps {
reactReduxForwardedRef?: React.ForwardedRef<unknown>
}
function strictEqual(a: unknown, b: unknown) {
return a === b
}
/**
* Infers the type of props that a connector will inject into a component.
*/
export type ConnectedProps<TConnector> =
TConnector extends InferableComponentEnhancerWithProps<
infer TInjectedProps,
any
>
? unknown extends TInjectedProps
? TConnector extends InferableComponentEnhancer<infer TInjectedProps>
? TInjectedProps
: never
: TInjectedProps
: never
export interface ConnectOptions<
State = unknown,
TStateProps = {},
TOwnProps = {},
TMergedProps = {},
> {
forwardRef?: boolean
context?: typeof ReactReduxContext
areStatesEqual?: (
nextState: State,
prevState: State,
nextOwnProps: TOwnProps,
prevOwnProps: TOwnProps,
) => boolean
areOwnPropsEqual?: (
nextOwnProps: TOwnProps,
prevOwnProps: TOwnProps,
) => boolean
areStatePropsEqual?: (
nextStateProps: TStateProps,
prevStateProps: TStateProps,
) => boolean
areMergedPropsEqual?: (
nextMergedProps: TMergedProps,
prevMergedProps: TMergedProps,
) => boolean
}
/**
* Connects a React component to a Redux store.
*
* - Without arguments, just wraps the component, without changing the behavior / props
*
* - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior
* is to override ownProps (as stated in the docs), so what remains is everything that's
* not a state or dispatch prop
*
* - When 3rd param is passed, we don't know if ownProps propagate and whether they
* should be valid component props, because it depends on mergeProps implementation.
* As such, it is the user's responsibility to extend ownProps interface from state or
* dispatch props or both when applicable
*
* @param mapStateToProps
* @param mapDispatchToProps
* @param mergeProps
* @param options
*/
export interface Connect<DefaultState = unknown> {
// tslint:disable:no-unnecessary-generics
(): InferableComponentEnhancer<DispatchProp>
/** mapState only */
<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
): InferableComponentEnhancerWithProps<TStateProps & DispatchProp, TOwnProps>
/** mapDispatch only (as a function) */
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>,
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>
/** mapDispatch only (as an object) */
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
): InferableComponentEnhancerWithProps<
ResolveThunks<TDispatchProps>,
TOwnProps
>
/** mapState and mapDispatch (as a function)*/
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>,
): InferableComponentEnhancerWithProps<
TStateProps & TDispatchProps,
TOwnProps
>
/** mapState and mapDispatch (nullish) */
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: null | undefined,
): InferableComponentEnhancerWithProps<TStateProps, TOwnProps>
/** mapState and mapDispatch (as an object) */
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
): InferableComponentEnhancerWithProps<
TStateProps & ResolveThunks<TDispatchProps>,
TOwnProps
>
/** mergeProps only */
<no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: null | undefined,
mergeProps: MergeProps<undefined, DispatchProp, TOwnProps, TMergedProps>,
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>
/** mapState and mergeProps */
<
TStateProps = {},
no_dispatch = {},
TOwnProps = {},
TMergedProps = {},
State = DefaultState,
>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: null | undefined,
mergeProps: MergeProps<TStateProps, DispatchProp, TOwnProps, TMergedProps>,
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>
/** mapDispatch (as a object) and mergeProps */
<no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>,
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>
/** mapState and options */
<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, State = DefaultState>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: null | undefined,
mergeProps: null | undefined,
options: ConnectOptions<State, TStateProps, TOwnProps>,
): InferableComponentEnhancerWithProps<DispatchProp & TStateProps, TOwnProps>
/** mapDispatch (as a function) and options */
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>,
mergeProps: null | undefined,
options: ConnectOptions<{}, TStateProps, TOwnProps>,
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>
/** mapDispatch (as an object) and options*/
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps: null | undefined,
options: ConnectOptions<{}, TStateProps, TOwnProps>,
): InferableComponentEnhancerWithProps<
ResolveThunks<TDispatchProps>,
TOwnProps
>
/** mapState, mapDispatch (as a function), and options */
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: MapDispatchToPropsNonObject<TDispatchProps, TOwnProps>,
mergeProps: null | undefined,
options: ConnectOptions<State, TStateProps, TOwnProps>,
): InferableComponentEnhancerWithProps<
TStateProps & TDispatchProps,
TOwnProps
>
/** mapState, mapDispatch (as an object), and options */
<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, State = DefaultState>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps: null | undefined,
options: ConnectOptions<State, TStateProps, TOwnProps>,
): InferableComponentEnhancerWithProps<
TStateProps & ResolveThunks<TDispatchProps>,
TOwnProps
>
/** mapState, mapDispatch, mergeProps, and options */
<
TStateProps = {},
TDispatchProps = {},
TOwnProps = {},
TMergedProps = {},
State = DefaultState,
>(
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps: MergeProps<
TStateProps,
TDispatchProps,
TOwnProps,
TMergedProps
>,
options?: ConnectOptions<State, TStateProps, TOwnProps, TMergedProps>,
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>
// tslint:enable:no-unnecessary-generics
}
let hasWarnedAboutDeprecatedPureOption = false
/**
* Connects a React component to a Redux store.
*
* - Without arguments, just wraps the component, without changing the behavior / props
*
* - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior
* is to override ownProps (as stated in the docs), so what remains is everything that's
* not a state or dispatch prop
*
* - When 3rd param is passed, we don't know if ownProps propagate and whether they
* should be valid component props, because it depends on mergeProps implementation.
* As such, it is the user's responsibility to extend ownProps interface from state or
* dispatch props or both when applicable
*
* @param mapStateToProps A function that extracts values from state
* @param mapDispatchToProps Setup for dispatching actions
* @param mergeProps Optional callback to merge state and dispatch props together
* @param options Options for configuring the connection
*
*/
function connect<
TStateProps = {},
TDispatchProps = {},
TOwnProps = {},
TMergedProps = {},
State = unknown,
>(
mapStateToProps?: MapStateToPropsParam<TStateProps, TOwnProps, State>,
mapDispatchToProps?: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
{
// The `pure` option has been removed, so TS doesn't like us destructuring this to check its existence.
// @ts-ignore
pure,
areStatesEqual = strictEqual,
areOwnPropsEqual = shallowEqual,
areStatePropsEqual = shallowEqual,
areMergedPropsEqual = shallowEqual,
// use React's forwardRef to expose a ref of the wrapped component
forwardRef = false,
// the context consumer to use
context = ReactReduxContext,
}: ConnectOptions<unknown, unknown, unknown, unknown> = {},
): unknown {
if (process.env.NODE_ENV !== 'production') {
if (pure !== undefined && !hasWarnedAboutDeprecatedPureOption) {
hasWarnedAboutDeprecatedPureOption = true
warning(
'The `pure` option has been removed. `connect` is now always a "pure/memoized" component',
)
}
}
const Context = context
const initMapStateToProps = mapStateToPropsFactory(mapStateToProps)
const initMapDispatchToProps = mapDispatchToPropsFactory(mapDispatchToProps)
const initMergeProps = mergePropsFactory(mergeProps)
const shouldHandleStateChanges = Boolean(mapStateToProps)
const wrapWithConnect = <TProps,>(
WrappedComponent: ComponentType<TProps>,
) => {
type WrappedComponentProps = TProps &
ConnectPropsMaybeWithoutContext<TProps>
if (process.env.NODE_ENV !== 'production') {
const isValid = /*#__PURE__*/ isValidElementType(WrappedComponent)
if (!isValid)
throw new Error(
`You must pass a component to the function returned by connect. Instead received ${stringifyComponent(
WrappedComponent,
)}`,
)
}
const wrappedComponentName =
WrappedComponent.displayName || WrappedComponent.name || 'Component'
const displayName = `Connect(${wrappedComponentName})`
const selectorFactoryOptions: SelectorFactoryOptions<
any,
any,
any,
any,
State
> = {
shouldHandleStateChanges,
displayName,
wrappedComponentName,
WrappedComponent,
// @ts-ignore
initMapStateToProps,
initMapDispatchToProps,
initMergeProps,
areStatesEqual,
areStatePropsEqual,
areOwnPropsEqual,
areMergedPropsEqual,
}
function ConnectFunction<TOwnProps>(
props: InternalConnectProps & TOwnProps,
) {
const [propsContext, reactReduxForwardedRef, wrapperProps] =
React.useMemo(() => {
// Distinguish between actual "data" props that were passed to the wrapper component,
// and values needed to control behavior (forwarded refs, alternate context instances).
// To maintain the wrapperProps object reference, memoize this destructuring.
const { reactReduxForwardedRef, ...wrapperProps } = props
return [props.context, reactReduxForwardedRef, wrapperProps]
}, [props])
const ContextToUse: ReactReduxContextInstance = React.useMemo(() => {
// Users may optionally pass in a custom context instance to use instead of our ReactReduxContext.
// Memoize the check that determines which context instance we should use.
let ResultContext = Context
if (propsContext?.Consumer) {
if (process.env.NODE_ENV !== 'production') {
const isValid = /*#__PURE__*/ isContextConsumer(
// @ts-ignore
<propsContext.Consumer />,
)
if (!isValid) {
throw new Error(
'You must pass a valid React context consumer as `props.context`',
)
}
ResultContext = propsContext
}
}
return ResultContext
}, [propsContext, Context])
// Retrieve the store and ancestor subscription via context, if available
const contextValue = React.useContext(ContextToUse)
// The store _must_ exist as either a prop or in context.
// We'll check to see if it _looks_ like a Redux store first.
// This allows us to pass through a `store` prop that is just a plain value.
const didStoreComeFromProps =
Boolean(props.store) &&
Boolean(props.store!.getState) &&
Boolean(props.store!.dispatch)
const didStoreComeFromContext =
Boolean(contextValue) && Boolean(contextValue!.store)
if (
process.env.NODE_ENV !== 'production' &&
!didStoreComeFromProps &&
!didStoreComeFromContext
) {
throw new Error(
`Could not find "store" in the context of ` +
`"${displayName}". Either wrap the root component in a <Provider>, ` +
`or pass a custom React context provider to <Provider> and the corresponding ` +
`React context consumer to ${displayName} in connect options.`,
)
}
// Based on the previous check, one of these must be true
const store: Store = didStoreComeFromProps
? props.store!
: contextValue!.store
const getServerState = didStoreComeFromContext
? contextValue!.getServerState
: store.getState
const childPropsSelector = React.useMemo(() => {
// The child props selector needs the store reference as an input.
// Re-create this selector whenever the store changes.
return defaultSelectorFactory(store.dispatch, selectorFactoryOptions)
}, [store])
const [subscription, notifyNestedSubs] = React.useMemo(() => {
if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY
// This Subscription's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
const subscription = createSubscription(
store,
didStoreComeFromProps ? undefined : contextValue!.subscription,
)
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `subscription` will then be null. This can
// probably be avoided if Subscription's listeners logic is changed to not call listeners
// that have been unsubscribed in the middle of the notification loop.
const notifyNestedSubs =
subscription.notifyNestedSubs.bind(subscription)
return [subscription, notifyNestedSubs]
}, [store, didStoreComeFromProps, contextValue])
// Determine what {store, subscription} value should be put into nested context, if necessary,
// and memoize that value to avoid unnecessary context updates.
const overriddenContextValue = React.useMemo(() => {
if (didStoreComeFromProps) {
// This component is directly subscribed to a store from props.
// We don't want descendants reading from this store - pass down whatever
// the existing context value is from the nearest connected ancestor.
return contextValue!
}
// Otherwise, put this component's subscription instance into context, so that
// connected descendants won't update until after this component is done
return {
...contextValue,
subscription,
} as ReactReduxContextValue
}, [didStoreComeFromProps, contextValue, subscription])
// Set up refs to coordinate values between the subscription effect and the render logic
const lastChildProps = React.useRef<unknown>(undefined)
const lastWrapperProps = React.useRef(wrapperProps)
const childPropsFromStoreUpdate = React.useRef<unknown>(undefined)
const renderIsScheduled = React.useRef(false)
const isMounted = React.useRef(false)
// TODO: Change this to `React.useRef<Error>(undefined)` after upgrading to React 19.
/**
* @todo Change this to `React.useRef<Error>(undefined)` after upgrading to React 19.
*/
const latestSubscriptionCallbackError = React.useRef<Error | undefined>(
undefined,
)
useIsomorphicLayoutEffect(() => {
isMounted.current = true
return () => {
isMounted.current = false
}
}, [])
const actualChildPropsSelector = React.useMemo(() => {
const selector = () => {
// Tricky logic here:
// - This render may have been triggered by a Redux store update that produced new child props
// - However, we may have gotten new wrapper props after that
// If we have new child props, and the same wrapper props, we know we should use the new child props as-is.
// But, if we have new wrapper props, those might change the child props, so we have to recalculate things.
// So, we'll use the child props from store update only if the wrapper props are the same as last time.
if (
childPropsFromStoreUpdate.current &&
wrapperProps === lastWrapperProps.current
) {
return childPropsFromStoreUpdate.current
}
// TODO We're reading the store directly in render() here. Bad idea?
// This will likely cause Bad Things (TM) to happen in Concurrent Mode.
// Note that we do this because on renders _not_ caused by store updates, we need the latest store state
// to determine what the child props should be.
return childPropsSelector(store.getState(), wrapperProps)
}
return selector
}, [store, wrapperProps])
// We need this to execute synchronously every time we re-render. However, React warns
// about useLayoutEffect in SSR, so we try to detect environment and fall back to
// just useEffect instead to avoid the warning, since neither will run anyway.
const subscribeForReact = React.useMemo(() => {
const subscribe = (reactListener: () => void) => {
if (!subscription) {
return () => {}
}
return subscribeUpdates(
shouldHandleStateChanges,
store,
subscription,
// @ts-ignore
childPropsSelector,
lastWrapperProps,
lastChildProps,
renderIsScheduled,
isMounted,
childPropsFromStoreUpdate,
notifyNestedSubs,
reactListener,
)
}
return subscribe
}, [subscription])
useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [
lastWrapperProps,
lastChildProps,
renderIsScheduled,
wrapperProps,
childPropsFromStoreUpdate,
notifyNestedSubs,
])
let actualChildProps: Record<string, unknown>
try {
actualChildProps = React.useSyncExternalStore(
// TODO We're passing through a big wrapper that does a bunch of extra side effects besides subscribing
subscribeForReact,
// TODO This is incredibly hacky. We've already processed the store update and calculated new child props,
// TODO and we're just passing that through so it triggers a re-render for us rather than relying on `uSES`.
actualChildPropsSelector,
getServerState
? () => childPropsSelector(getServerState(), wrapperProps)
: actualChildPropsSelector,
)
} catch (err) {
if (latestSubscriptionCallbackError.current) {
// eslint-disable-next-line no-extra-semi
;(err as Error).message +=
`\nThe error may be correlated with this previous error:\n${latestSubscriptionCallbackError.current.stack}\n\n`
}
throw err
}
useIsomorphicLayoutEffect(() => {
latestSubscriptionCallbackError.current = undefined
childPropsFromStoreUpdate.current = undefined
lastChildProps.current = actualChildProps
})
// Now that all that's done, we can finally try to actually render the child component.
// We memoize the elements for the rendered child component as an optimization.
const renderedWrappedComponent = React.useMemo(() => {
return (
// @ts-ignore
<WrappedComponent
{...actualChildProps}
ref={reactReduxForwardedRef}
/>
)
}, [reactReduxForwardedRef, WrappedComponent, actualChildProps])
// If React sees the exact same element reference as last time, it bails out of re-rendering
// that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate.
const renderedChild = React.useMemo(() => {
if (shouldHandleStateChanges) {
// If this component is subscribed to store updates, we need to pass its own
// subscription instance down to our descendants. That means rendering the same
// Context instance, and putting a different value into the context.
return (
<ContextToUse.Provider value={overriddenContextValue}>
{renderedWrappedComponent}
</ContextToUse.Provider>
)
}
return renderedWrappedComponent
}, [ContextToUse, renderedWrappedComponent, overriddenContextValue])
return renderedChild
}
const _Connect = React.memo(ConnectFunction)
type ConnectedWrapperComponent = typeof _Connect & {
WrappedComponent: typeof WrappedComponent
}
// Add a hacky cast to get the right output type
const Connect = _Connect as unknown as ConnectedComponent<
typeof WrappedComponent,
WrappedComponentProps
>
Connect.WrappedComponent = WrappedComponent
Connect.displayName = ConnectFunction.displayName = displayName
if (forwardRef) {
const _forwarded = React.forwardRef(
function forwardConnectRef(props, ref) {
// @ts-ignore
return <Connect {...props} reactReduxForwardedRef={ref} />
},
)
const forwarded = _forwarded as ConnectedWrapperComponent
forwarded.displayName = displayName
forwarded.WrappedComponent = WrappedComponent
return /*#__PURE__*/ hoistStatics(forwarded, WrappedComponent)
}
return /*#__PURE__*/ hoistStatics(Connect, WrappedComponent)
}
return wrapWithConnect
}
export default connect as Connect
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var ListItemRole = {
relatedConcepts: [{
module: 'ARIA',
concept: {
name: 'listitem'
}
}, {
module: 'HTML',
concept: {
name: 'li'
}
}],
type: 'structure'
};
var _default = ListItemRole;
exports.default = _default;
@@ -0,0 +1,6 @@
import { InstanceBinding } from '../../binding/models/InstanceBinding';
import { InstanceBindingNode } from '../../planning/models/InstanceBindingNode';
import { ResolutionParams } from '../models/ResolutionParams';
import { Resolved, SyncResolved } from '../models/Resolved';
export declare function resolveInstanceBindingNode<TActivated, TBinding extends InstanceBinding<TActivated> = InstanceBinding<TActivated>>(resolveInstanceBindingConstructorParams: (params: ResolutionParams, node: InstanceBindingNode<TBinding>) => unknown[] | Promise<unknown[]>, resolveInstanceBindingNodeAsyncFromConstructorParams: (constructorValues: Promise<unknown[]>, params: ResolutionParams, node: InstanceBindingNode<TBinding>) => Promise<SyncResolved<TActivated>>, resolveInstanceBindingNodeFromConstructorParams: (constructorValues: unknown[], params: ResolutionParams, node: InstanceBindingNode<TBinding>) => Resolved<TActivated>): (params: ResolutionParams, node: InstanceBindingNode<TBinding>) => Resolved<TActivated>;
//# sourceMappingURL=resolveInstanceBindingNode.d.ts.map
@@ -0,0 +1,636 @@
# path-scurry
Extremely high performant utility for building tools that read
the file system, minimizing filesystem and path string munging
operations to the greatest degree possible.
## Ugh, yet another file traversal thing on npm?
Yes. None of the existing ones gave me exactly what I wanted.
## Well what is it you wanted?
While working on [glob](http://npm.im/glob), I found that I
needed a module to very efficiently manage the traversal over a
folder tree, such that:
1. No `readdir()` or `stat()` would ever be called on the same
file or directory more than one time.
2. No `readdir()` calls would be made if we can be reasonably
sure that the path is not a directory. (Ie, a previous
`readdir()` or `stat()` covered the path, and
`ent.isDirectory()` is false.)
3. `path.resolve()`, `dirname()`, `basename()`, and other
string-parsing/munging operations are be minimized. This means
it has to track "provisional" child nodes that may not exist
(and if we find that they _don't_ exist, store that
information as well, so we don't have to ever check again).
4. The API is not limited to use as a stream/iterator/etc. There
are many cases where an API like node's `fs` is preferrable.
5. It's more important to prevent excess syscalls than to be up
to date, but it should be smart enough to know what it
_doesn't_ know, and go get it seamlessly when requested.
6. Do not blow up the JS heap allocation if operating on a
directory with a huge number of entries.
7. Handle all the weird aspects of Windows paths, like UNC paths
and drive letters and wrongway slashes, so that the consumer
can return canonical platform-specific paths without having to
parse or join or do any error-prone string munging.
## PERFORMANCE
JavaScript people throw around the word "blazing" a lot. I hope
that this module doesn't blaze anyone. But it does go very fast,
in the cases it's optimized for, if used properly.
PathScurry provides ample opportunities to get extremely good
performance, as well as several options to trade performance for
convenience.
Benchmarks can be run by executing `npm run bench`.
As is always the case, doing more means going slower, doing less
means going faster, and there are trade offs between speed and
memory usage.
PathScurry makes heavy use of [LRUCache](http://npm.im/lru-cache)
to efficiently cache whatever it can, and `Path` objects remain
in the graph for the lifetime of the walker, so repeated calls
with a single PathScurry object will be extremely fast. However,
adding items to a cold cache means "doing more", so in those
cases, we pay a price. Nothing is free, but every effort has been
made to reduce costs wherever possible.
Also, note that a "cache as long as possible" approach means that
changes to the filesystem may not be reflected in the results of
repeated PathScurry operations.
For resolving string paths, `PathScurry` ranges from 5-50 times
faster than `path.resolve` on repeated resolutions, but around
100 to 1000 times _slower_ on the first resolution. If your
program is spending a lot of time resolving the _same_ paths
repeatedly (like, thousands or millions of times), then this can
be beneficial. But both implementations are pretty fast, and
speeding up an infrequent operation from 4µs to 400ns is not
going to move the needle on your app's performance.
For walking file system directory trees, a lot depends on how
often a given PathScurry object will be used, and also on the
walk method used.
With default settings on a folder tree of 100,000 items,
consisting of around a 10-to-1 ratio of normal files to
directories, PathScurry performs comparably to
[@nodelib/fs.walk](http://npm.im/@nodelib/fs.walk), which is the
fastest and most reliable file system walker I could find. As far
as I can tell, it's almost impossible to go much faster in a
Node.js program, just based on how fast you can push syscalls out
to the fs thread pool.
On my machine, that is about 1000-1200 completed walks per second
for async or stream walks, and around 500-600 walks per second
synchronously.
In the warm cache state, PathScurry's performance increases
around 4x for async `for await` iteration, 10-15x faster for
streams and synchronous `for of` iteration, and anywhere from 30x
to 80x faster for the rest.
```
# walk 100,000 fs entries, 10/1 file/dir ratio
# operations / ms
New PathScurry object | Reuse PathScurry object
stream: 1112.589 | 13974.917
sync stream: 492.718 | 15028.343
async walk: 1095.648 | 32706.395
sync walk: 527.632 | 46129.772
async iter: 1288.821 | 5045.510
sync iter: 498.496 | 17920.746
```
A hand-rolled walk calling `entry.readdir()` and recursing
through the entries can benefit even more from caching, with
greater flexibility and without the overhead of streams or
generators.
The cold cache state is still limited by the costs of file system
operations, but with a warm cache, the only bottleneck is CPU
speed and VM optimizations. Of course, in that case, some care
must be taken to ensure that you don't lose performance as a
result of silly mistakes, like calling `readdir()` on entries
that you know are not directories.
```
# manual recursive iteration functions
cold cache | warm cache
async: 1164.901 | 17923.320
cb: 1101.127 | 40999.344
zalgo: 1082.240 | 66689.936
sync: 526.935 | 87097.591
```
In this case, the speed improves by around 10-20x in the async
case, 40x in the case of using `entry.readdirCB` with protections
against synchronous callbacks, and 50-100x with callback
deferrals disabled, and _several hundred times faster_ for
synchronous iteration.
If you can think of a case that is not covered in these
benchmarks, or an implementation that performs significantly
better than PathScurry, please [let me
know](https://github.com/isaacs/path-scurry/issues).
## USAGE
```ts
// hybrid module, load with either method
import { PathScurry, Path } from 'path-scurry'
// or:
const { PathScurry, Path } = require('path-scurry')
// very simple example, say we want to find and
// delete all the .DS_Store files in a given path
// note that the API is very similar to just a
// naive walk with fs.readdir()
import { unlink } from 'fs/promises'
// easy way, iterate over the directory and do the thing
const pw = new PathScurry(process.cwd())
for await (const entry of pw) {
if (entry.isFile() && entry.name === '.DS_Store') {
unlink(entry.fullpath())
}
}
// here it is as a manual recursive method
const walk = async (entry: Path) => {
const promises: Promise<any> = []
// readdir doesn't throw on non-directories, it just doesn't
// return any entries, to save stack trace costs.
// Items are returned in arbitrary unsorted order
for (const child of await pw.readdir(entry)) {
// each child is a Path object
if (child.name === '.DS_Store' && child.isFile()) {
// could also do pw.resolve(entry, child.name),
// just like fs.readdir walking, but .fullpath is
// a *slightly* more efficient shorthand.
promises.push(unlink(child.fullpath()))
} else if (child.isDirectory()) {
promises.push(walk(child))
}
}
return Promise.all(promises)
}
walk(pw.cwd).then(() => {
console.log('all .DS_Store files removed')
})
const pw2 = new PathScurry('/a/b/c') // pw2.cwd is the Path for /a/b/c
const relativeDir = pw2.cwd.resolve('../x') // Path entry for '/a/b/x'
const relative2 = pw2.cwd.resolve('/a/b/d/../x') // same path, same entry
assert.equal(relativeDir, relative2)
```
## API
[Full TypeDoc API](https://isaacs.github.io/path-scurry)
There are platform-specific classes exported, but for the most
part, the default `PathScurry` and `Path` exports are what you
most likely need, unless you are testing behavior for other
platforms.
Intended public API is documented here, but the full
documentation does include internal types, which should not be
accessed directly.
### Interface `PathScurryOpts`
The type of the `options` argument passed to the `PathScurry`
constructor.
- `nocase`: Boolean indicating that file names should be compared
case-insensitively. Defaults to `true` on darwin and win32
implementations, `false` elsewhere.
**Warning** Performing case-insensitive matching on a
case-sensitive filesystem will result in occasionally very
bizarre behavior. Performing case-sensitive matching on a
case-insensitive filesystem may negatively impact performance.
- `childrenCacheSize`: Number of child entries to cache, in order
to speed up `resolve()` and `readdir()` calls. Defaults to
`16 * 1024` (ie, `16384`).
Setting it to a higher value will run the risk of JS heap
allocation errors on large directory trees. Setting it to `256`
or smaller will significantly reduce the construction time and
data consumption overhead, but with the downside of operations
being slower on large directory trees. Setting it to `0` will
mean that effectively no operations are cached, and this module
will be roughly the same speed as `fs` for file system
operations, and _much_ slower than `path.resolve()` for
repeated path resolution.
- `fs` An object that will be used to override the default `fs`
methods. Any methods that are not overridden will use Node's
built-in implementations.
- lstatSync
- readdir (callback `withFileTypes` Dirent variant, used for
readdirCB and most walks)
- readdirSync
- readlinkSync
- realpathSync
- promises: Object containing the following async methods:
- lstat
- readdir (Dirent variant only)
- readlink
- realpath
### Interface `WalkOptions`
The options object that may be passed to all walk methods.
- `withFileTypes`: Boolean, default true. Indicates that `Path`
objects should be returned. Set to `false` to get string paths
instead.
- `follow`: Boolean, default false. Attempt to read directory
entries from symbolic links. Otherwise, only actual directories
are traversed. Regardless of this setting, a given target path
will only ever be walked once, meaning that a symbolic link to
a previously traversed directory will never be followed.
Setting this imposes a slight performance penalty, because
`readlink` must be called on all symbolic links encountered, in
order to avoid infinite cycles.
- `filter`: Function `(entry: Path) => boolean`. If provided,
will prevent the inclusion of any entry for which it returns a
falsey value. This will not prevent directories from being
traversed if they do not pass the filter, though it will
prevent the directories themselves from being included in the
results. By default, if no filter is provided, then all entries
are included in the results.
- `walkFilter`: Function `(entry: Path) => boolean`. If provided,
will prevent the traversal of any directory (or in the case of
`follow:true` symbolic links to directories) for which the
function returns false. This will not prevent the directories
themselves from being included in the result set. Use `filter`
for that.
Note that TypeScript return types will only be inferred properly
from static analysis if the `withFileTypes` option is omitted, or
a constant `true` or `false` value.
### Class `PathScurry`
The main interface. Defaults to an appropriate class based on the
current platform.
Use `PathScurryWin32`, `PathScurryDarwin`, or `PathScurryPosix`
if implementation-specific behavior is desired.
All walk methods may be called with a `WalkOptions` argument to
walk over the object's current working directory with the
supplied options.
#### `async pw.walk(entry?: string | Path | WalkOptions, opts?: WalkOptions)`
Walk the directory tree according to the options provided,
resolving to an array of all entries found.
#### `pw.walkSync(entry?: string | Path | WalkOptions, opts?: WalkOptions)`
Walk the directory tree according to the options provided,
returning an array of all entries found.
#### `pw.iterate(entry?: string | Path | WalkOptions, opts?: WalkOptions)`
Iterate over the directory asynchronously, for use with `for
await of`. This is also the default async iterator method.
#### `pw.iterateSync(entry?: string | Path | WalkOptions, opts?: WalkOptions)`
Iterate over the directory synchronously, for use with `for of`.
This is also the default sync iterator method.
#### `pw.stream(entry?: string | Path | WalkOptions, opts?: WalkOptions)`
Return a [Minipass](http://npm.im/minipass) stream that emits
each entry or path string in the walk. Results are made available
asynchronously.
#### `pw.streamSync(entry?: string | Path | WalkOptions, opts?: WalkOptions)`
Return a [Minipass](http://npm.im/minipass) stream that emits
each entry or path string in the walk. Results are made available
synchronously, meaning that the walk will complete in a single
tick if the stream is fully consumed.
#### `pw.cwd`
Path object representing the current working directory for the
PathScurry.
#### `pw.chdir(path: string)`
Set the new effective current working directory for the scurry
object, so that `path.relative()` and `path.relativePosix()`
return values relative to the new cwd path.
#### `pw.depth(path?: Path | string): number`
Return the depth of the specified path (or the PathScurry cwd)
within the directory tree.
Root entries have a depth of `0`.
#### `pw.resolve(...paths: string[])`
Caching `path.resolve()`.
Significantly faster than `path.resolve()` if called repeatedly
with the same paths. Significantly slower otherwise, as it builds
out the cached Path entries.
To get a `Path` object resolved from the `PathScurry`, use
`pw.cwd.resolve(path)`. Note that `Path.resolve` only takes a
single string argument, not multiple.
#### `pw.resolvePosix(...paths: string[])`
Caching `path.resolve()`, but always using posix style paths.
This is identical to `pw.resolve(...paths)` on posix systems (ie,
everywhere except Windows).
On Windows, it returns the full absolute UNC path using `/`
separators. Ie, instead of `'C:\\foo\\bar`, it would return
`//?/C:/foo/bar`.
#### `pw.relative(path: string | Path): string`
Return the relative path from the PathWalker cwd to the supplied
path string or entry.
If the nearest common ancestor is the root, then an absolute path
is returned.
#### `pw.relativePosix(path: string | Path): string`
Return the relative path from the PathWalker cwd to the supplied
path string or entry, using `/` path separators.
If the nearest common ancestor is the root, then an absolute path
is returned.
On posix platforms (ie, all platforms except Windows), this is
identical to `pw.relative(path)`.
On Windows systems, it returns the resulting string as a
`/`-delimited path. If an absolute path is returned (because the
target does not share a common ancestor with `pw.cwd`), then a
full absolute UNC path will be returned. Ie, instead of
`'C:\\foo\\bar`, it would return `//?/C:/foo/bar`.
#### `pw.basename(path: string | Path): string`
Return the basename of the provided string or Path.
#### `pw.dirname(path: string | Path): string`
Return the parent directory of the supplied string or Path.
#### `async pw.readdir(dir = pw.cwd, opts = { withFileTypes: true })`
Read the directory and resolve to an array of strings if
`withFileTypes` is explicitly set to `false` or Path objects
otherwise.
Can be called as `pw.readdir({ withFileTypes: boolean })` as
well.
Returns `[]` if no entries are found, or if any error occurs.
Note that TypeScript return types will only be inferred properly
from static analysis if the `withFileTypes` option is omitted, or
a constant `true` or `false` value.
#### `pw.readdirSync(dir = pw.cwd, opts = { withFileTypes: true })`
Synchronous `pw.readdir()`
#### `async pw.readlink(link = pw.cwd, opts = { withFileTypes: false })`
Call `fs.readlink` on the supplied string or Path object, and
return the result.
Can be called as `pw.readlink({ withFileTypes: boolean })` as
well.
Returns `undefined` if any error occurs (for example, if the
argument is not a symbolic link), or a `Path` object if
`withFileTypes` is explicitly set to `true`, or a string
otherwise.
Note that TypeScript return types will only be inferred properly
from static analysis if the `withFileTypes` option is omitted, or
a constant `true` or `false` value.
#### `pw.readlinkSync(link = pw.cwd, opts = { withFileTypes: false })`
Synchronous `pw.readlink()`
#### `async pw.lstat(entry = pw.cwd)`
Call `fs.lstat` on the supplied string or Path object, and fill
in as much information as possible, returning the updated `Path`
object.
Returns `undefined` if the entry does not exist, or if any error
is encountered.
Note that some `Stats` data (such as `ino`, `dev`, and `mode`)
will not be supplied. For those things, you'll need to call
`fs.lstat` yourself.
#### `pw.lstatSync(entry = pw.cwd)`
Synchronous `pw.lstat()`
#### `pw.realpath(entry = pw.cwd, opts = { withFileTypes: false })`
Call `fs.realpath` on the supplied string or Path object, and
return the realpath if available.
Returns `undefined` if any error occurs.
May be called as `pw.realpath({ withFileTypes: boolean })` to run
on `pw.cwd`.
#### `pw.realpathSync(entry = pw.cwd, opts = { withFileTypes: false })`
Synchronous `pw.realpath()`
### Class `Path` implements [fs.Dirent](https://nodejs.org/docs/latest/api/fs.html#class-fsdirent)
Object representing a given path on the filesystem, which may or
may not exist.
Note that the actual class in use will be either `PathWin32` or
`PathPosix`, depending on the implementation of `PathScurry` in
use. They differ in the separators used to split and join path
strings, and the handling of root paths.
In `PathPosix` implementations, paths are split and joined using
the `'/'` character, and `'/'` is the only root path ever in use.
In `PathWin32` implementations, paths are split using either
`'/'` or `'\\'` and joined using `'\\'`, and multiple roots may
be in use based on the drives and UNC paths encountered. UNC
paths such as `//?/C:/` that identify a drive letter, will be
treated as an alias for the same root entry as their associated
drive letter (in this case `'C:\\'`).
#### `path.name`
Name of this file system entry.
**Important**: _always_ test the path name against any test
string using the `isNamed` method, and not by directly comparing
this string. Otherwise, unicode path strings that the system sees
as identical will not be properly treated as the same path,
leading to incorrect behavior and possible security issues.
#### `path.isNamed(name: string): boolean`
Return true if the path is a match for the given path name. This
handles case sensitivity and unicode normalization.
Note: even on case-sensitive systems, it is **not** safe to test
the equality of the `.name` property to determine whether a given
pathname matches, due to unicode normalization mismatches.
Always use this method instead of testing the `path.name`
property directly.
#### `path.isCWD`
Set to true if this `Path` object is the current working
directory of the `PathScurry` collection that contains it.
#### `path.getType()`
Returns the type of the Path object, `'File'`, `'Directory'`,
etc.
#### `path.isType(t: type)`
Returns true if `is{t}()` returns true.
For example, `path.isType('Directory')` is equivalent to
`path.isDirectory()`.
#### `path.depth()`
Return the depth of the Path entry within the directory tree.
Root paths have a depth of `0`.
#### `path.fullpath()`
The fully resolved path to the entry.
#### `path.fullpathPosix()`
The fully resolved path to the entry, using `/` separators.
On posix systems, this is identical to `path.fullpath()`. On
windows, this will return a fully resolved absolute UNC path
using `/` separators. Eg, instead of `'C:\\foo\\bar'`, it will
return `'//?/C:/foo/bar'`.
#### `path.isFile()`, `path.isDirectory()`, etc.
Same as the identical `fs.Dirent.isX()` methods.
#### `path.isUnknown()`
Returns true if the path's type is unknown. Always returns true
when the path is known to not exist.
#### `path.resolve(p: string)`
Return a `Path` object associated with the provided path string
as resolved from the current Path object.
#### `path.relative(): string`
Return the relative path from the PathWalker cwd to the supplied
path string or entry.
If the nearest common ancestor is the root, then an absolute path
is returned.
#### `path.relativePosix(): string`
Return the relative path from the PathWalker cwd to the supplied
path string or entry, using `/` path separators.
If the nearest common ancestor is the root, then an absolute path
is returned.
On posix platforms (ie, all platforms except Windows), this is
identical to `pw.relative(path)`.
On Windows systems, it returns the resulting string as a
`/`-delimited path. If an absolute path is returned (because the
target does not share a common ancestor with `pw.cwd`), then a
full absolute UNC path will be returned. Ie, instead of
`'C:\\foo\\bar`, it would return `//?/C:/foo/bar`.
#### `async path.readdir()`
Return an array of `Path` objects found by reading the associated
path entry.
If path is not a directory, or if any error occurs, returns `[]`,
and marks all children as provisional and non-existent.
#### `path.readdirSync()`
Synchronous `path.readdir()`
#### `async path.readlink()`
Return the `Path` object referenced by the `path` as a symbolic
link.
If the `path` is not a symbolic link, or any error occurs,
returns `undefined`.
#### `path.readlinkSync()`
Synchronous `path.readlink()`
#### `async path.lstat()`
Call `lstat` on the path object, and fill it in with details
determined.
If path does not exist, or any other error occurs, returns
`undefined`, and marks the path as "unknown" type.
#### `path.lstatSync()`
Synchronous `path.lstat()`
#### `async path.realpath()`
Call `realpath` on the path, and return a Path object
corresponding to the result, or `undefined` if any error occurs.
#### `path.realpathSync()`
Synchornous `path.realpath()`
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,4BAAiB;IACf,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;AACX","sources":["packages/@react-aria/table/src/*.js"],"sourcesContent":["const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}"],"names":[],"version":3,"file":"intlStrings.module.js.map"}
@@ -0,0 +1,7 @@
'use strict';
var implementation = require('./implementation');
module.exports = function getPolyfill() {
return typeof Object.values === 'function' ? Object.values : implementation;
};
@@ -0,0 +1 @@
module.exports={C:{"52":0.00477,"68":0.00477,"78":0.02385,"113":0.01908,"115":0.0954,"118":0.00954,"121":0.00477,"125":0.00954,"128":0.00954,"135":0.00477,"136":0.01431,"138":0.00477,"139":0.00954,"140":0.02385,"141":0.00954,"142":0.03816,"143":0.39114,"144":0.36252,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 114 116 117 119 120 122 123 124 126 127 129 130 131 132 133 134 137 145 146 147 3.5 3.6"},D:{"38":0.00954,"39":0.00477,"40":0.00477,"41":0.00477,"42":0.00477,"43":0.00477,"44":0.00477,"45":0.00477,"46":0.00477,"47":0.02385,"48":0.00477,"49":0.00954,"50":0.00477,"51":0.00477,"52":0.00477,"53":0.00477,"54":0.00477,"55":0.00477,"56":0.00954,"57":0.00477,"58":0.00477,"59":0.00477,"60":0.00477,"63":0.00477,"66":0.01908,"68":0.00477,"69":0.00477,"70":0.01431,"71":0.00477,"72":0.01908,"73":0.0477,"75":0.00477,"76":0.00477,"78":0.00477,"79":0.24804,"81":0.00954,"83":0.14787,"85":0.00954,"86":0.00477,"87":0.48177,"88":0.02862,"91":0.05724,"92":0.00954,"93":0.00477,"94":0.07155,"95":0.00477,"98":0.03816,"100":0.03816,"101":0.01908,"102":0.01908,"103":0.02862,"104":0.06201,"106":0.00954,"107":0.00477,"108":0.1431,"109":2.45178,"110":0.02385,"111":0.39591,"112":0.90153,"113":0.02385,"114":0.04293,"115":0.00477,"116":0.06678,"119":0.01908,"120":0.29097,"121":0.01431,"122":0.03339,"123":0.01431,"124":0.05247,"125":2.32299,"126":0.0954,"127":0.05247,"128":0.03816,"129":0.06201,"130":0.06201,"131":0.11925,"132":0.05724,"133":0.1908,"134":0.10017,"135":0.06678,"136":0.06678,"137":0.29574,"138":0.47223,"139":0.44838,"140":5.67153,"141":16.52805,"142":0.20988,"143":0.00954,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 61 62 64 65 67 74 77 80 84 89 90 96 97 99 105 117 118 144 145"},F:{"36":0.00477,"40":0.00477,"46":0.17172,"77":0.00477,"79":0.00477,"83":0.00477,"85":0.00954,"86":0.02385,"91":0.00954,"92":0.02385,"95":0.24327,"116":0.00477,"119":0.00477,"120":0.20988,"121":0.09063,"122":1.55979,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 78 80 81 82 84 87 88 89 90 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 117 118 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"13":0.00477,"14":0.08586,"16":0.00954,"18":0.00477,"92":0.00954,"109":0.01908,"114":0.07632,"119":0.00477,"122":0.00477,"126":0.00477,"128":0.00477,"129":0.00477,"130":0.00477,"131":0.01431,"132":0.00954,"133":0.01908,"134":0.05724,"135":0.01431,"136":0.00954,"137":0.02385,"138":0.05724,"139":0.03339,"140":0.62964,"141":3.16728,"142":0.00477,_:"12 15 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 120 121 123 124 125 127"},E:{"14":0.00477,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 12.1 15.2-15.3 17.0 26.2","11.1":0.00477,"13.1":0.00954,"14.1":0.00954,"15.1":0.01431,"15.4":0.00477,"15.5":0.00477,"15.6":0.0477,"16.0":0.00477,"16.1":0.01908,"16.2":0.01431,"16.3":0.00954,"16.4":0.00477,"16.5":0.01908,"16.6":0.07155,"17.1":0.07155,"17.2":0.00954,"17.3":0.02862,"17.4":0.02385,"17.5":0.04293,"17.6":0.06678,"18.0":0.02385,"18.1":0.02862,"18.2":0.01431,"18.3":0.07632,"18.4":0.02385,"18.5-18.6":0.13356,"26.0":0.31482,"26.1":0.02385},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00109,"5.0-5.1":0,"6.0-6.1":0.00436,"7.0-7.1":0.00327,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00982,"10.0-10.2":0.00109,"10.3":0.01855,"11.0-11.2":0.27498,"11.3-11.4":0.00655,"12.0-12.1":0.00218,"12.2-12.5":0.05347,"13.0-13.1":0,"13.2":0.00546,"13.3":0.00218,"13.4-13.7":0.00873,"14.0-14.4":0.01855,"14.5-14.8":0.01964,"15.0-15.1":0.01855,"15.2-15.3":0.01419,"15.4":0.01637,"15.5":0.01855,"15.6-15.8":0.24224,"16.0":0.03274,"16.1":0.06111,"16.2":0.03164,"16.3":0.05674,"16.4":0.01419,"16.5":0.0251,"16.6-16.7":0.32408,"17.0":0.02291,"17.1":0.03492,"17.2":0.0251,"17.3":0.0371,"17.4":0.06547,"17.5":0.11239,"17.6-17.7":0.28371,"18.0":0.06438,"18.1":0.13312,"18.2":0.07202,"18.3":0.23133,"18.4":0.11894,"18.5-18.6":6.06482,"26.0":0.74965,"26.1":0.02728},P:{"4":0.73029,"21":0.01074,"22":0.02148,"23":0.01074,"24":0.02148,"25":0.03222,"26":0.03222,"27":0.1074,"28":1.11691,"29":0.07518,_:"20 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","5.0-5.4":0.0537,"6.2-6.4":0.09666,"7.2-7.4":0.30071,"8.2":0.02148},I:{"0":0.06791,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00003},K:{"0":0.28771,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.00477,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.15693},Q:{"14.9":0.00523},O:{"0":0.03139},H:{"0":0},L:Line truncated
@@ -0,0 +1,46 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("@eslint-community/eslint-utils")
const { getSourceCode } = require("eslint-compat-utils")
module.exports = {
meta: {
docs: {
description: "disallow the `Math.acosh` method.",
category: "ES2015",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-math-acosh.html",
},
fixable: null,
messages: {
forbidden: "ES2015 '{{name}}' method is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"(program) {
const sourceCode = getSourceCode(context)
const tracker = new ReferenceTracker(
sourceCode.getScope(program),
)
for (const { node, path } of tracker.iterateGlobalReferences({
Math: {
acosh: { [READ]: true },
},
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,27 @@
import { __read } from "tslib";
import { useState } from 'react';
import useEventListener from '../useEventListener';
export default function useFocusWithin(target, options) {
var _a = __read(useState(false), 2), isFocusWithin = _a[0], setIsFocusWithin = _a[1];
var _b = options || {}, onFocus = _b.onFocus, onBlur = _b.onBlur, onChange = _b.onChange;
useEventListener('focusin', function (e) {
if (!isFocusWithin) {
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
onChange === null || onChange === void 0 ? void 0 : onChange(true);
setIsFocusWithin(true);
}
}, {
target: target,
});
useEventListener('focusout', function (e) {
var _a, _b;
if (isFocusWithin && !((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.contains) === null || _b === void 0 ? void 0 : _b.call(_a, e.relatedTarget))) {
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
onChange === null || onChange === void 0 ? void 0 : onChange(false);
setIsFocusWithin(false);
}
}, {
target: target,
});
return isFocusWithin;
}
@@ -0,0 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { IconSvgProps } from '../types.js';
import 'react';
declare const CalendarBoldIcon: (props: IconSvgProps) => react_jsx_runtime.JSX.Element;
export { CalendarBoldIcon };
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('value', require('../value'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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 truncated
@@ -0,0 +1,345 @@
import net from 'net';
import http from 'http';
import https from 'https';
import { Duplex } from 'stream';
import { EventEmitter } from 'events';
import createDebug from 'debug';
import promisify from './promisify';
const debug = createDebug('agent-base');
function isAgent(v: any): v is createAgent.AgentLike {
return Boolean(v) && typeof v.addRequest === 'function';
}
function isSecureEndpoint(): boolean {
const { stack } = new Error();
if (typeof stack !== 'string') return false;
return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
}
function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
function createAgent(
callback: createAgent.AgentCallback,
opts?: createAgent.AgentOptions
): createAgent.Agent;
function createAgent(
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
opts?: createAgent.AgentOptions
) {
return new createAgent.Agent(callback, opts);
}
namespace createAgent {
export interface ClientRequest extends http.ClientRequest {
_last?: boolean;
_hadError?: boolean;
method: string;
}
export interface AgentRequestOptions {
host?: string;
path?: string;
// `port` on `http.RequestOptions` can be a string or undefined,
// but `net.TcpNetConnectOpts` expects only a number
port: number;
}
export interface HttpRequestOptions
extends AgentRequestOptions,
Omit<http.RequestOptions, keyof AgentRequestOptions> {
secureEndpoint: false;
}
export interface HttpsRequestOptions
extends AgentRequestOptions,
Omit<https.RequestOptions, keyof AgentRequestOptions> {
secureEndpoint: true;
}
export type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
export type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
export type AgentCallbackReturn = Duplex | AgentLike;
export type AgentCallbackCallback = (
err?: Error | null,
socket?: createAgent.AgentCallbackReturn
) => void;
export type AgentCallbackPromise = (
req: createAgent.ClientRequest,
opts: createAgent.RequestOptions
) =>
| createAgent.AgentCallbackReturn
| Promise<createAgent.AgentCallbackReturn>;
export type AgentCallback = typeof Agent.prototype.callback;
export type AgentOptions = {
timeout?: number;
};
/**
* Base `http.Agent` implementation.
* No pooling/keep-alive is implemented by default.
*
* @param {Function} callback
* @api public
*/
export class Agent extends EventEmitter {
public timeout: number | null;
public maxFreeSockets: number;
public maxTotalSockets: number;
public maxSockets: number;
public sockets: {
[key: string]: net.Socket[];
};
public freeSockets: {
[key: string]: net.Socket[];
};
public requests: {
[key: string]: http.IncomingMessage[];
};
public options: https.AgentOptions;
private promisifiedCallback?: createAgent.AgentCallbackPromise;
private explicitDefaultPort?: number;
private explicitProtocol?: string;
constructor(
callback?: createAgent.AgentCallback | createAgent.AgentOptions,
_opts?: createAgent.AgentOptions
) {
super();
let opts = _opts;
if (typeof callback === 'function') {
this.callback = callback;
} else if (callback) {
opts = callback;
}
// Timeout for the socket to be returned from the callback
this.timeout = null;
if (opts && typeof opts.timeout === 'number') {
this.timeout = opts.timeout;
}
// These aren't actually used by `agent-base`, but are required
// for the TypeScript definition files in `@types/node` :/
this.maxFreeSockets = 1;
this.maxSockets = 1;
this.maxTotalSockets = Infinity;
this.sockets = {};
this.freeSockets = {};
this.requests = {};
this.options = {};
}
get defaultPort(): number {
if (typeof this.explicitDefaultPort === 'number') {
return this.explicitDefaultPort;
}
return isSecureEndpoint() ? 443 : 80;
}
set defaultPort(v: number) {
this.explicitDefaultPort = v;
}
get protocol(): string {
if (typeof this.explicitProtocol === 'string') {
return this.explicitProtocol;
}
return isSecureEndpoint() ? 'https:' : 'http:';
}
set protocol(v: string) {
this.explicitProtocol = v;
}
callback(
req: createAgent.ClientRequest,
opts: createAgent.RequestOptions,
fn: createAgent.AgentCallbackCallback
): void;
callback(
req: createAgent.ClientRequest,
opts: createAgent.RequestOptions
):
| createAgent.AgentCallbackReturn
| Promise<createAgent.AgentCallbackReturn>;
callback(
req: createAgent.ClientRequest,
opts: createAgent.AgentOptions,
fn?: createAgent.AgentCallbackCallback
):
| createAgent.AgentCallbackReturn
| Promise<createAgent.AgentCallbackReturn>
| void {
throw new Error(
'"agent-base" has no default implementation, you must subclass and override `callback()`'
);
}
/**
* Called by node-core's "_http_client.js" module when creating
* a new HTTP request with this Agent instance.
*
* @api public
*/
addRequest(req: ClientRequest, _opts: RequestOptions): void {
const opts: RequestOptions = { ..._opts };
if (typeof opts.secureEndpoint !== 'boolean') {
opts.secureEndpoint = isSecureEndpoint();
}
if (opts.host == null) {
opts.host = 'localhost';
}
if (opts.port == null) {
opts.port = opts.secureEndpoint ? 443 : 80;
}
if (opts.protocol == null) {
opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
}
if (opts.host && opts.path) {
// If both a `host` and `path` are specified then it's most
// likely the result of a `url.parse()` call... we need to
// remove the `path` portion so that `net.connect()` doesn't
// attempt to open that as a unix socket file.
delete opts.path;
}
delete opts.agent;
delete opts.hostname;
delete opts._defaultAgent;
delete opts.defaultPort;
delete opts.createConnection;
// Hint to use "Connection: close"
// XXX: non-documented `http` module API :(
req._last = true;
req.shouldKeepAlive = false;
let timedOut = false;
let timeoutId: ReturnType<typeof setTimeout> | null = null;
const timeoutMs = opts.timeout || this.timeout;
const onerror = (err: NodeJS.ErrnoException) => {
if (req._hadError) return;
req.emit('error', err);
// For Safety. Some additional errors might fire later on
// and we need to make sure we don't double-fire the error event.
req._hadError = true;
};
const ontimeout = () => {
timeoutId = null;
timedOut = true;
const err: NodeJS.ErrnoException = new Error(
`A "socket" was not created for HTTP request before ${timeoutMs}ms`
);
err.code = 'ETIMEOUT';
onerror(err);
};
const callbackError = (err: NodeJS.ErrnoException) => {
if (timedOut) return;
if (timeoutId !== null) {
clearTimeout(timeoutId);
timeoutId = null;
}
onerror(err);
};
const onsocket = (socket: AgentCallbackReturn) => {
if (timedOut) return;
if (timeoutId != null) {
clearTimeout(timeoutId);
timeoutId = null;
}
if (isAgent(socket)) {
// `socket` is actually an `http.Agent` instance, so
// relinquish responsibility for this `req` to the Agent
// from here on
debug(
'Callback returned another Agent instance %o',
socket.constructor.name
);
(socket as createAgent.Agent).addRequest(req, opts);
return;
}
if (socket) {
socket.once('free', () => {
this.freeSocket(socket as net.Socket, opts);
});
req.onSocket(socket as net.Socket);
return;
}
const err = new Error(
`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``
);
onerror(err);
};
if (typeof this.callback !== 'function') {
onerror(new Error('`callback` is not defined'));
return;
}
if (!this.promisifiedCallback) {
if (this.callback.length >= 3) {
debug('Converting legacy callback function to promise');
this.promisifiedCallback = promisify(this.callback);
} else {
this.promisifiedCallback = this.callback;
}
}
if (typeof timeoutMs === 'number' && timeoutMs > 0) {
timeoutId = setTimeout(ontimeout, timeoutMs);
}
if ('port' in opts && typeof opts.port !== 'number') {
opts.port = Number(opts.port);
}
try {
debug(
'Resolving socket for %o request: %o',
opts.protocol,
`${req.method} ${req.path}`
);
Promise.resolve(this.promisifiedCallback(req, opts)).then(
onsocket,
callbackError
);
} catch (err) {
Promise.reject(err).catch(callbackError);
}
}
freeSocket(socket: net.Socket, opts: AgentOptions) {
debug('Freeing socket %o %o', socket.constructor.name, opts);
socket.destroy();
}
destroy() {
debug('Destroying agent %o', this.constructor.name);
}
}
// So that `instanceof` works correctly
createAgent.prototype = createAgent.Agent.prototype;
}
export = createAgent;
@@ -0,0 +1 @@
{"version":3,"file":"accessibility.cjs.development.js","sources":["../src/components/HiddenText/HiddenText.tsx","../src/components/LiveRegion/LiveRegion.tsx","../src/hooks/useAnnouncement.ts"],"sourcesContent":["import React from 'react';\n\ninterface Props {\n id: string;\n value: string;\n}\n\nconst hiddenStyles: React.CSSProperties = {\n display: 'none',\n};\n\nexport function HiddenText({id, value}: Props) {\n return (\n <div id={id} style={hiddenStyles}>\n {value}\n </div>\n );\n}\n","import React from 'react';\n\nexport interface Props {\n id: string;\n announcement: string;\n ariaLiveType?: \"polite\" | \"assertive\" | \"off\";\n}\n\nexport function LiveRegion({id, announcement, ariaLiveType = \"assertive\"}: Props) {\n // Hide element visually but keep it readable by screen readers\n const visuallyHidden: React.CSSProperties = {\n position: 'fixed',\n top: 0,\n left: 0,\n width: 1,\n height: 1,\n margin: -1,\n border: 0,\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(100%)',\n whiteSpace: 'nowrap',\n };\n \n return (\n <div\n id={id}\n style={visuallyHidden}\n role=\"status\"\n aria-live={ariaLiveType}\n aria-atomic\n >\n {announcement}\n </div>\n );\n}\n","import {useCallback, useState} from 'react';\n\nexport function useAnnouncement() {\n const [announcement, setAnnouncement] = useState('');\n const announce = useCallback((value: string | undefined) => {\n if (value != null) {\n setAnnouncement(value);\n }\n }, []);\n\n return {announce, announcement} as const;\n}\n"],"names":["hiddenStyles","display","HiddenText","id","value","React","style","LiveRegion","announcement","ariaLiveType","visuallyHidden","position","top","left","width","height","margin","border","padding","overflow","clip","clipPath","whiteSpace","role","useAnnouncement","setAnnouncement","useState","announce","useCallback"],"mappings":";;;;;;;;;AAOA,MAAMA,YAAY,GAAwB;EACxCC,OAAO,EAAE;AAD+B,CAA1C;SAIgBC;MAAW;IAACC,EAAD;IAAKC;;EAC9B,OACEC,4BAAA,MAAA;IAAKF,EAAE,EAAEA;IAAIG,KAAK,EAAEN;GAApB,EACGI,KADH,CADF;AAKD;;SCTeG;MAAW;IAACJ,EAAD;IAAKK,YAAL;IAAmBC,YAAY,GAAG;;;EAE3D,MAAMC,cAAc,GAAwB;IAC1CC,QAAQ,EAAE,OADgC;IAE1CC,GAAG,EAAE,CAFqC;IAG1CC,IAAI,EAAE,CAHoC;IAI1CC,KAAK,EAAE,CAJmC;IAK1CC,MAAM,EAAE,CALkC;IAM1CC,MAAM,EAAE,CAAC,CANiC;IAO1CC,MAAM,EAAE,CAPkC;IAQ1CC,OAAO,EAAE,CARiC;IAS1CC,QAAQ,EAAE,QATgC;IAU1CC,IAAI,EAAE,eAVoC;IAW1CC,QAAQ,EAAE,aAXgC;IAY1CC,UAAU,EAAE;GAZd;EAeA,OACEjB,4BAAA,MAAA;IACEF,EAAE,EAAEA;IACJG,KAAK,EAAEI;IACPa,IAAI,EAAC;iBACMd;;GAJb,EAOGD,YAPH,CADF;AAWD;;SClCegB;EACd,MAAM,CAAChB,YAAD,EAAeiB,eAAf,IAAkCC,cAAQ,CAAC,EAAD,CAAhD;EACA,MAAMC,QAAQ,GAAGC,iBAAW,CAAExB,KAAD;IAC3B,IAAIA,KAAK,IAAI,IAAb,EAAmB;MACjBqB,eAAe,CAACrB,KAAD,CAAf;;GAFwB,EAIzB,EAJyB,CAA5B;EAMA,OAAO;IAACuB,QAAD;IAAWnB;GAAlB;AACD;;;;;;"}
@@ -0,0 +1,718 @@
flf2a$ 7 6 20 -1 3
Kban by Randy Jae Weinstein
May 16, 1994 - Lehigh University
$$ @
$$ @
$$ @
$$ @
$$ @
$$ @
$$ @@
.|. @
||| @
'|' @
| @
. @
'|' @
@@
" @
@
@
@
@
@
@@
@
}{ {} @
<>++=++<> @
}{ }{ @
<>++=++<> @
}{ }{ @
@@
@
_++_, @
|||| @
||--. @
%|||| @
|||| @
,-__- @@
@
, @
<> / @
/ @
/ @
/ @
/ <> @@
@
/\ @
\/ @
/\ , @
/'\\, @
| \\ @
\\-/\ @@
' @
@
@
@
@
@
@@
/ @
// @
|| @
|| @
|| @
\\ @
\ @@
\ @
\\ @
|| @
|| @
|| @
// @
/ @@
@
<> <> @
\ / @
<>--*--<>@
/ \ @
<> <> @
@@
+ @
@
@
@
@
@
@@
, @
@
@
@
@
@
@@
' @
@
@
@
@
@
@@
. @
@
@
@
@
@
@@
/ @
@
@
@
@
@
@@
@
/\\ @
|| || @
|| || @
|| || @
|| || @
\\/ @@
@
/| @
/|| @
|| @
|| @
|| @
,/-' @@
@
/\ @
( ) @
// @
// @
/( @
{___ @@
____ @
` // @
// @
\\ @
)) @
// @
/' @@
, @
/| @
/ | @
__|_ @
---- @
| @
'-' @@
____ @
|| ` @
||_ @
|/ \ @
)) @
// @
/' @@
@
,/ @
// @
((_- @
|| )) @
(( || @
\// @@
____ @
` || @
/, @
// @
(( @
|| @
|' @@
/\\ @
|| || @
\ / @
/\\ @
// \\ @
|| || @
\\/ @@
@
/\\ @
|| || @
|| || @
\/|| @
|| @
\_/ @@
@
|| @
@
|| @
@
@
@@
@
|| @
@
|| @
' @
@
@@
< @
@
@
@
@
@
@@
@
= @
@
= @
@
@
@@
> @
@
@
@
@
@
@@
? @
@
@
@
@
@
@@
@ @
@
@
@
@
@
@@
| @
||| @
| || @
.''''|. @
.|. .||. @
@
@@
'||''|. @
|| || @
||'''|. @
|| || @
.||...|' @
@
@@
..|'''.| @
.|' ' @
|| @
'|. . @
''|....' @
@
@@
'||''|. @
|| || @
|| || @
|| || @
.||...|' @
@
@@
'||''''| @
|| . @
||''| @
|| @
.||.....| @
@
@@
'||''''| @
|| . @
||''| @
|| @
.||. @
@
@@
..|'''.| @
.|' ' @
|| .... @
'|. || @
''|...'| @
@
@@
'||' '||' @
|| || @
||''''|| @
|| || @
.||. .||. @
@
@@
'||' @
|| @
|| @
|| @
.||. @
@
@@
'||' @
|| @
|| @
|| @
|| .|' @
''' @
@@
'||' |' @
|| .' @
||'|. @
|| || @
.||. ||. @
@
@@
'||' @
|| @
|| @
|| @
.||.....| @
@
@@
'|| ||' @
||| ||| @
|'|..'|| @
| '|' || @
.|. | .||. @
@
@@
'|. '|' @
|'| | @
| '|. | @
| ||| @
.|. '| @
@
@@
..|''|| @
.|' || @
|| || @
'|. || @
''|...|' @
@
@@
'||''|. @
|| || @
||...|' @
|| @
.||. @
@
@@
..|''|| @
.|' || @
|| || @
'|. '. '| @
'|...'|. @
@
@@
'||''|. @
|| || @
||''|' @
|| |. @
.||. '|' @
@
@@
.|'''.| @
||.. ' @
''|||. @
. '|| @
|'....|' @
@
@@
|''||''| @
|| @
|| @
|| @
.||. @
@
@@
'||' '|' @
|| | @
|| | @
|| | @
'|..' @
@
@@
'||' '|' @
'|. .' @
|| | @
||| @
| @
@
@@
'|| '||' '|' @
'|. '|. .' @
|| || | @
||| ||| @
| | @
@
@@
'||' '|' @
|| | @
|| @
| || @
.| ||. @
@
@@
'||' '|' @
|| | @
|| @
|| @
.||. @
@
@@
|'''''|| @
.|' @
|| @
.|' @
||......| @
@
@@
[ @
@
@
@
@
@
@@
\ @
@
@
@
@
@
@@
] @
@
@
@
@
@
@@
x @
/ \ @
/ \ @
@
@
@
@@
_ @
@
@
@
@
@
@@
` @
@
@
@
@
@
@@
@
.... @
'' .|| @
.|' || @
'|..'|' @
@
@@
'|| @
|| ... @
||' || @
|| | @
'|...' @
@
@@
@
.... @
.| '' @
|| @
'|...' @
@
@@
'|| @
.. || @
.' '|| @
|. || @
'|..'||. @
@
@@
@
.... @
.|...|| @
|| @
'|...' @
@
@@
.'|. @
.||. @
|| @
|| @
.||. @
@
@@
@
... . @
|| || @
|'' @
'||||. @
.|....' @
@@
'|| @
|| .. @
||' || @
|| || @
.||. ||. @
@
@@
|| @
... @
|| @
|| @
.||. @
@
@@
|| @
... @
|| @
|| @
|| @
.. |' @
'' @@
'|| @
|| .. @
|| .' @
||'|. @
.||. ||. @
@
@@
'|| @
|| @
|| @
|| @
.||. @
@
@@
@
.. .. .. @
|| || || @
|| || || @
.|| || ||. @
@
@@
@
.. ... @
|| || @
|| || @
.||. ||. @
@
@@
@
... @
.| '|. @
|| || @
'|..|' @
@
@@
@
... ... @
||' || @
|| | @
||...' @
|| @
'''' @@
@
... . @
.' || @
|. || @
'|..'|| @
|| @
'''' @@
@
... .. @
||' '' @
|| @
.||. @
@
@@
@
.... @
||. ' @
. '|.. @
|'..|' @
@
@@
. @
.||. @
|| @
|| @
'|.' @
@
@@
@
... ... @
|| || @
|| || @
'|..'|. @
@
@@
@
.... ... @
'|. | @
'|.| @
'| @
@
@@
@
... ... ... @
|| || | @
||| ||| @
| | @
@
@@
@
... ... @
'|..' @
.|. @
.| ||. @
@
@@
@
.... ... @
'|. | @
'|.| @
'| @
.. | @
'' @@
@
...... @
' .|' @
.|' @
||....| @
@
@@
{ @
@
@
@
@
@
@@
|| @
|| @
@
|| @
|| @
@
@@
} @
@
@
@
@
@
@@
% @
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@@ -0,0 +1,14 @@
import isArrayLikeObject from './isArrayLikeObject.js';
/**
* Casts `value` to an empty array if it's not an array like object.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array|Object} Returns the cast array-like object.
*/
function castArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
}
export default castArrayLikeObject;
@@ -0,0 +1,427 @@
flf2a$ 4 3 10 -1 18
3 lines tall font by LESTER
=============================
-> Conversion to FigLet font by MEPH. (Part of ASCII Editor Service Pack I)
(http://studenten.freepage.de/meph/ascii/ascii/editor/_index.htm)
-> Defined: ASCII code alphanumeric + most used symbols
-> Uppercase characters only.
.-~~-.
(_^..^_)
Lester||||AMC - Anthony Cucchiara
*Mythos Online : Internet Magazine of Lovecraftian Horror - Dead Alice*
http://www.fortunecity.com/victorian/redlion/157/deadal.htm
*Visit my web page ANSI/ASCII/Fonts*
http://members.aol.com/lester5374/
$@
$@
$@
$@@
. @
| @
. @
@@
`' @
`; @
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
`' @
`' @
@
@@
. @
( @
` @
@@
. @
) @
' @
@@
@
@
@
@@
@
@
@
@@
@
@
, @
@@
@
@
@
@@
@
@
. @
@@
, @
,' @
' @
@@
.-. @
|\| @
`-' @
@@
. @
'| @
' @
@@
.-. @
.'' @
`-- @
@@
-. @
-| @
-' @
@@
. . @
`-| @
' @
@@
.-. @
``. @
--' @
@@
.-. @
|-. @
`-' @
@@
.-. @
.' @
' @
@@
.-. @
)-( @
`-' @
@@
.-. @
`-| @
`-' @
@@
| @
@
| @
@@
| @
@
| @
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
.-. @
.' @
. @
@@
@
@
@
@@
.-. @
|-| @
` ' @
@@
.-. @
|( @
`-' @
@@
.-. @
| @
`-' @
@@
.-. @
| )@
`-' @
@@
.-. @
|- @
`-' @
@@
.-. @
|- @
' @
@@
.-. @
|.. @
`-' @
@@
. . @
|-| @
' ` @
@@
.-. @
| @
`-' @
@@
. @
| @
`-' @
@@
. . @
|< @
' ` @
@@
. @
| @
`-' @
@@
. . @
|\/| @
' ` @
@@
. . @
|\| @
' ` @
@@
.-. @
| | @
`-' @
@@
.-. @
|-' @
' @
@@
.-. @
|.| @
`-`.@
@@
.-. @
|( @
' ' @
@@
.-. @
`-. @
`-' @
@@
.-. @
| @
' @
@@
. . @
| | @
`-' @
@@
. . @
| | @
`.' @
@@
. . . @
| | | @
`.'.' @
@@
. . @
)( @
' ` @
@@
. . @
| @
` @
@@
.-. @
/ @
`-' @
@@
.' @
( @
`. @
@@
, @
`, @
` @
@@
`. @
) @
.' @
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
.-. @
|-| @
` ' @
@@
.-. @
|( @
`-' @
@@
.-. @
| @
`-' @
@@
.-. @
| )@
`-' @
@@
.-. @
|- @
`-' @
@@
.-. @
|- @
' @
@@
.-. @
|.. @
`-' @
@@
. . @
|-| @
' ` @
@@
.-. @
| @
`-' @
@@
. @
| @
`-' @
@@
. . @
|< @
' ` @
@@
. @
| @
`-' @
@@
. . @
|\/| @
' ` @
@@
. . @
|\| @
' ` @
@@
.-. @
| | @
`-' @
@@
.-. @
|-' @
' @
@@
.-. @
|.| @
`-`.@
@@
.-. @
|( @
' ' @
@@
.-. @
`-. @
`-' @
@@
.-. @
| @
' @
@@
. . @
| | @
`-' @
@@
. . @
| | @
`.' @
@@
. . . @
| | | @
`.'.' @
@@
. . @
)( @
' ` @
@@
. . @
| @
` @
@@
.-. @
/ @
`-' @
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@@ -0,0 +1,87 @@
// src/common/assertion.ts
var __DEV__ = process.env.NODE_ENV !== "production";
var __TEST__ = process.env.NODE_ENV === "test";
function isArray(value) {
return Array.isArray(value);
}
function isObject(value) {
const type = typeof value;
return value != null && (type === "object" || type === "function") && !isArray(value);
}
// src/common/object.ts
var renameProp = (oldProp, newProp, { [oldProp]: old, ...others }) => ({
[newProp]: old,
...others
});
var copyObject = (obj) => {
if (!isObject(obj)) return obj;
if (obj instanceof Array) return [...obj];
return { ...obj };
};
var omitObject = (obj, omitKeys) => {
if (!isObject(obj)) return obj;
if (obj instanceof Array) return [...obj];
const newObj = { ...obj };
omitKeys.forEach((key) => newObj[key] && delete newObj[key]);
return newObj;
};
var cleanObject = (obj) => {
if (!isObject(obj)) return obj;
if (obj instanceof Array) return [...obj];
const newObj = { ...obj };
Object.keys(newObj).forEach((key) => {
if (newObj[key] === void 0 || newObj[key] === null) {
delete newObj[key];
}
});
return newObj;
};
var cleanObjectKeys = (obj, keys = []) => {
if (!isObject(obj)) return obj;
if (obj instanceof Array) return [...obj];
const newObj = { ...obj };
keys.forEach((key) => {
if (newObj[key]) {
delete newObj[key];
}
});
return newObj;
};
var getKeyValue = (obj, key) => {
if (!isObject(obj)) return obj;
if (obj instanceof Array) return [...obj];
return obj[key];
};
var getProp = (obj, path, fallback, index) => {
const key = typeof path === "string" ? path.split(".") : [path];
for (index = 0; index < key.length; index += 1) {
if (!obj) break;
obj = obj[key[index]];
}
return obj === void 0 ? fallback : obj;
};
var arrayToObject = (arr) => {
if (!arr.length || !Array.isArray(arr)) return {};
return arr.reduce((acc, item) => {
return { ...acc, ...item };
}, {});
};
function compact(object) {
const clone = Object.assign({}, object);
for (let key in clone) {
if (clone[key] === void 0) delete clone[key];
}
return clone;
}
export {
arrayToObject,
cleanObject,
cleanObjectKeys,
compact,
copyObject,
getKeyValue,
getProp,
omitObject,
renameProp
};
@@ -0,0 +1,42 @@
let Declaration = require('../declaration')
let flexSpec = require('./flex-spec')
class Order extends Declaration {
/**
* Return property name by final spec
*/
normalize() {
return 'order'
}
/**
* Change property name for 2009 and 2012 specs
*/
prefixed(prop, prefix) {
let spec
;[spec, prefix] = flexSpec(prefix)
if (spec === 2009) {
return prefix + 'box-ordinal-group'
}
if (spec === 2012) {
return prefix + 'flex-order'
}
return super.prefixed(prop, prefix)
}
/**
* Fix value for 2009 spec
*/
set(decl, prefix) {
let spec = flexSpec(prefix)[0]
if (spec === 2009 && /\d/.test(decl.value)) {
decl.value = (parseInt(decl.value) + 1).toString()
return super.set(decl, prefix)
}
return super.set(decl, prefix)
}
}
Order.names = ['order', 'flex-order', 'box-ordinal-group']
module.exports = Order
@@ -0,0 +1 @@
{"name":"@heroui/react-rsc-utils","version":"2.1.2","requiresBuild":false,"files":{"children.js":{"checkedAt":1794532106727,"integrity":"sha512-LAwIV2CBRYkZRQaIFxunW7PJ1zQVNC2sPhvtX7gXKk1SyKeu0dWBdyf+J++jrkpapnJWwchxhjq2VWPAKyZiIw==","mode":420,"size":45},"dist/children.js":{"checkedAt":1794532106727,"integrity":"sha512-Vvbneoop8wMpZZNml+EL+6DA/3Ur4Y/8qdqEvdOAc5tueCTfFIKMQxkzBqvgnEBDRoXxBHoQK6fLdc6SR9UQAQ==","mode":420,"size":1823},"dist/dom-props.js":{"checkedAt":1794532106728,"integrity":"sha512-IZ+b7ZBC2FEUlbf/yxbIa4ZuUCn2RIy7nDALGf+YO0rzc2KX914ao5HpSKGL71sjRyXFCo47xcEyfYIcjKeINw==","mode":420,"size":3690},"dist/filter-dom-props.js":{"checkedAt":1794532106728,"integrity":"sha512-N1VYheiaYhfMMIIH+kuMO27cXtxnC+qE2n19nejI/VPpygxf6qSfOa7uyhBZCgQx4aVRXD2KMG2lsHC9nzmYXw==","mode":420,"size":4815},"filter-dom-props.js":{"checkedAt":1794532106728,"integrity":"sha512-ett+KYdLziRJQ7F+2SwK9OB/6WCIparSkyidQP7ApFBVUe6kC/r7BvPCRNkNd7Ohs9h/cfcvrFw3StlRBaDJoQ==","mode":420,"size":53},"dist/functions.js":{"checkedAt":1794532106728,"integrity":"sha512-AkJssE8RzCldw9tOz/zLHOc5mxvM0Cu1jfIuk3wis8dDr/d/Qrd31wL+aTTnIv2jtNY+G4qgXGsHY4IA5y1RRA==","mode":420,"size":1626},"dist/index.js":{"checkedAt":1794532106728,"integrity":"sha512-iCVCE88Y9h1vA6YdCUKbEpwiYjThcy7WWOCvi+x+uwP/lk+vb8O7ddHL3O/J+CxWxOBuBL4fb52Xn0p+xorMKg==","mode":420,"size":6324},"package.json":{"checkedAt":1794532106728,"integrity":"sha512-NyrxwjT3l8eXWTLWQr97aQixSR9uFaBWjRB+Hvaf06kbQBN22QO7jGwvDuPfxWKCLF6T2YjSy4IR4IEYSPmUPA==","mode":420,"size":1396},"README.md":{"checkedAt":1794532106728,"integrity":"sha512-wHCfxtl8igIednrxvEMSFYxFIuu9l7pWxzY4PQs7URDOap2Sd0c6prw5SIjcG0b1Vko6Ccff1mXFvjna/D92ew==","mode":420,"size":500},"dist/children.mjs":{"checkedAt":1794532106728,"integrity":"sha512-evdJkVMcMonZR6h4GmbVpWs3hSplucl9O6QAjSjSx0FVz48At55g5prBW0G0uF0BjN49RjXsM7SDpZvfiqul7w==","mode":420,"size":122},"dist/chunk-6HA6QXMR.mjs":{"checkedAt":1794532106728,"integrity":"sha512-cxldYYBvVn+8glJBPlmDiMg9Sg2VdUWxSG2VHIAUH0Nsaop9Aw2KYJt7lC7wY751m9UOWF2f2TrWKwJkqctzVg==","mode":420,"size":291},"dist/chunk-FGM523TA.mjs":{"checkedAt":1794532106729,"integrity":"sha512-ZVBpRIijZT5zfD9PPkkuZJGepj8q4YxiVh/IXWj0c3yFPOwLFSZRbrZMsLydJMWZ6MdglD+aIXXwHvUwpQ37/A==","mode":420,"size":708},"dist/chunk-RFWDHYLZ.mjs":{"checkedAt":1794532106729,"integrity":"sha512-uaeAHj/VQUIKf9ZNEgSREBWvk03+LSstUGsgWyaMg/yQDfQ6gv4P7rPQcDdVD+7CMBVPlQdb22Dwim0/ZekiHA==","mode":420,"size":2627},"dist/chunk-RJKRL3AU.mjs":{"checkedAt":1794532106729,"integrity":"sha512-2fIaoa6MhdL73Fy//UaqQ5rTzuvz6Vb0aHAqeqMrOFeUSiscoqSYe3os/CGVwmDVt9k4ys0E/ybojBvSjyQEzQ==","mode":420,"size":1227},"dist/dom-props.mjs":{"checkedAt":1794532106729,"integrity":"sha512-JcsiFUgt40QxlM1aYgVz281bxvQnttdqiPiqyjGCKl0PPvTYjuJerMtnMteLTY/LLd2Kf0hI0bTDE4QEXwUlKw==","mode":420,"size":116},"dist/filter-dom-props.mjs":{"checkedAt":1794532106729,"integrity":"sha512-ADO8t5l1NrL6PwIFki9UWPHqGOIAa6SCPr60GVJV86KFTo0QAb5ZCqyOL6KyPd/c/MBJt86jvrYz0DJbw8KopQ==","mode":420,"size":117},"dist/functions.mjs":{"checkedAt":1794532106729,"integrity":"sha512-e7WEwwaovuw6tPnurftIVSsXRnuKD7pBmzpLRTwAmmxDDOuJa+FSk3Iryxq5xyzFgHyKj18DHm/kwTeEq5YUkw==","mode":420,"size":74},"dist/index.mjs":{"checkedAt":1794532106729,"integrity":"sha512-RSqCvZ6Tvlq1pbVoB0PunooLr+HNHW1946PVXW++Ovtnv4uov+40xrYAxvpgLf9ZGJnmBguS7MqLjtYdFPwMOA==","mode":420,"size":365},"children.d.ts":{"checkedAt":1794532106729,"integrity":"sha512-GWxwPtRj4Y1fH/JFKVl27o1tl/jie962ahEx829zOLJ3Y22oiOToopM6bJEAyWfg19Si64Q1dADuLo833gbBNQ==","mode":420,"size":33},"dist/children.d.ts":{"checkedAt":1794532106729,"integrity":"sha512-piD8ovlwgDhGPotBzjzbI0X9bcZi0tJg7wFMIRAxvsvaTclrIY6hI0TOVf7bXxO+E8FjP3hnMZqQhn35dmyTRQ==","mode":420,"size":522},"dist/dom-props.d.ts":{"checkedAt":1794532106729,"integrity":"sha512-GqogHW7u8Xp1h7/9nTmZT1UBZlid54919FPg3jF1XsoQlSOfd9y110QY2m1EaP8926IsOYnoUv7lFcM+hFK79Q==","mode":420,"size":124},"dist/filter-dom-props.d.ts":{"checkedAt":1794532106729,"integrity":"sha512-bQmoNFBrfUTk4VqVFFWOlhX6XYhNqTsM6txK6ylB/nWxAnbH0h+M5jfW7l2OJn9kw+KWrdkrVPSWoRCvuSjBxA==","mode":420,"size":1150},"filter-dom-props.d.ts":{"checkedAt":1794532106729,"integrity":"sha512-rRl/j7IDp1vEa/F9YEAzhADtiVCdLzBmtWvJc5nZLxPNZMC85PYGxYDWggR+6aWBcxBwJC4768tKePwn8vILvw==","mode":420,"size":41},"dist/functions.d.ts":{"checkedAt":1794532106729,"integrity":"sha512-G5t/rK2XKmREj1HV411qaBa8oZ4C6WfWWMGRgsIAmCCxpeJBn/FYS07I6VUM6XJUlB5zEkYtSsQVHO/cLAtbnA==","mode":420,"size":641},"dist/index.d.ts":{"checkedAt":1794532106730,"integrity":"sha512-i06FuoJz2u+ctgxjxRPoczXURC/zohnNlhLDBgaAjYw6TEuUpNJlXCpvTxpcj97i8DdX1z8sr+SgA0+yO3uXLA==","mode":420,"size":271},"LICENSE":{"checkedAt":1794532106730,"integrity":"sha512-eaopHP+N4EYXlGoX9hmoxDPoVft4BqrXKmbsFTcsoBHSrJp/GWF4qVtLBzrw9h9ZrbFfPY69z+3RuDX9FdPG+Q==","mode":420,"size":1064}}}
@@ -0,0 +1,9 @@
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"maxNodeModuleJsDepth": 0
},
"exclude": [
"coverage"
]
}
@@ -0,0 +1,110 @@
import { __read } from "tslib";
import { useEffect, useRef, useState } from 'react';
// {[path]: count}
// remove external when no used
var EXTERNAL_USED_COUNT = {};
var loadScript = function (path, props) {
if (props === void 0) { props = {}; }
var script = document.querySelector("script[src=\"".concat(path, "\"]"));
if (!script) {
var newScript_1 = document.createElement('script');
newScript_1.src = path;
Object.keys(props).forEach(function (key) {
newScript_1[key] = props[key];
});
newScript_1.setAttribute('data-status', 'loading');
document.body.appendChild(newScript_1);
return {
ref: newScript_1,
status: 'loading',
};
}
return {
ref: script,
status: script.getAttribute('data-status') || 'ready',
};
};
var loadCss = function (path, props) {
if (props === void 0) { props = {}; }
var css = document.querySelector("link[href=\"".concat(path, "\"]"));
if (!css) {
var newCss_1 = document.createElement('link');
newCss_1.rel = 'stylesheet';
newCss_1.href = path;
Object.keys(props).forEach(function (key) {
newCss_1[key] = props[key];
});
// IE9+
var isLegacyIECss = 'hideFocus' in newCss_1;
// use preload in IE Edge (to detect load errors)
if (isLegacyIECss && newCss_1.relList) {
newCss_1.rel = 'preload';
newCss_1.as = 'style';
}
newCss_1.setAttribute('data-status', 'loading');
document.head.appendChild(newCss_1);
return {
ref: newCss_1,
status: 'loading',
};
}
return {
ref: css,
status: css.getAttribute('data-status') || 'ready',
};
};
var useExternal = function (path, options) {
var _a = __read(useState(path ? 'loading' : 'unset'), 2), status = _a[0], setStatus = _a[1];
var ref = useRef(undefined);
useEffect(function () {
if (!path) {
setStatus('unset');
return;
}
var pathname = path.replace(/[|#].*$/, '');
if ((options === null || options === void 0 ? void 0 : options.type) === 'css' || (!(options === null || options === void 0 ? void 0 : options.type) && /(^css!|\.css$)/.test(pathname))) {
var result = loadCss(path, options === null || options === void 0 ? void 0 : options.css);
ref.current = result.ref;
setStatus(result.status);
}
else if ((options === null || options === void 0 ? void 0 : options.type) === 'js' || (!(options === null || options === void 0 ? void 0 : options.type) && /(^js!|\.js$)/.test(pathname))) {
var result = loadScript(path, options === null || options === void 0 ? void 0 : options.js);
ref.current = result.ref;
setStatus(result.status);
}
else {
// do nothing
console.error("Cannot infer the type of external resource, and please provide a type ('js' | 'css'). " +
'Refer to the https://ahooks.js.org/hooks/dom/use-external/#options');
}
if (!ref.current) {
return;
}
if (EXTERNAL_USED_COUNT[path] === undefined) {
EXTERNAL_USED_COUNT[path] = 1;
}
else {
EXTERNAL_USED_COUNT[path] += 1;
}
var handler = function (event) {
var _a;
var targetStatus = event.type === 'load' ? 'ready' : 'error';
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.setAttribute('data-status', targetStatus);
setStatus(targetStatus);
};
ref.current.addEventListener('load', handler);
ref.current.addEventListener('error', handler);
return function () {
var _a, _b, _c;
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('load', handler);
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('error', handler);
EXTERNAL_USED_COUNT[path] -= 1;
if (EXTERNAL_USED_COUNT[path] === 0 && !(options === null || options === void 0 ? void 0 : options.keepWhenUnused)) {
(_c = ref.current) === null || _c === void 0 ? void 0 : _c.remove();
}
ref.current = undefined;
};
}, [path]);
return status;
};
export default useExternal;
@@ -0,0 +1,44 @@
{
"name": "mime-types",
"description": "The ultimate javascript content-type utility.",
"version": "2.1.35",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
"Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)",
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
],
"license": "MIT",
"keywords": [
"mime",
"types"
],
"repository": "jshttp/mime-types",
"dependencies": {
"mime-db": "1.52.0"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-standard": "14.1.1",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-markdown": "2.2.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-standard": "4.1.0",
"mocha": "9.2.2",
"nyc": "15.1.0"
},
"files": [
"HISTORY.md",
"LICENSE",
"index.js"
],
"engines": {
"node": ">= 0.6"
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec test/test.js",
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}
}
@@ -0,0 +1,516 @@
2.2.0 / 2025-03-27
==================
* deps: send@^1.2.0
2.1.0 / 2024-09-10
===================
* Changes from 1.16.0
* deps: send@^1.2.0
2.0.0 / 2024-08-23
==================
* deps:
* parseurl@^1.3.3
* excape-html@^1.0.3
* encodeurl@^2.0.0
* supertest@^6.3.4
* safe-buffer@^5.2.1
* nyc@^17.0.0
* mocha@^10.7.0
* Changes from 1.x
2.0.0-beta.2 / 2024-03-20
=========================
* deps: send@1.0.0-beta.2
2.0.0-beta.1 / 2022-02-05
=========================
* Change `dotfiles` option default to `'ignore'`
* Drop support for Node.js 0.8
* Remove `hidden` option; use `dotfiles` option instead
* Remove `mime` export; use `mime-types` package instead
* deps: send@1.0.0-beta.1
- Use `mime-types` for file to content type mapping
- deps: debug@3.1.0
1.16.0 / 2024-09-10
===================
* Remove link renderization in html while redirecting
1.15.0 / 2022-03-24
===================
* deps: send@0.18.0
- Fix emitted 416 error missing headers property
- Limit the headers removed for 304 response
- deps: depd@2.0.0
- deps: destroy@1.2.0
- deps: http-errors@2.0.0
- deps: on-finished@2.4.1
- deps: statuses@2.0.1
1.14.2 / 2021-12-15
===================
* deps: send@0.17.2
- deps: http-errors@1.8.1
- deps: ms@2.1.3
- pref: ignore empty http tokens
1.14.1 / 2019-05-10
===================
* Set stricter CSP header in redirect response
* deps: send@0.17.1
- deps: range-parser@~1.2.1
1.14.0 / 2019-05-07
===================
* deps: parseurl@~1.3.3
* deps: send@0.17.0
- deps: http-errors@~1.7.2
- deps: mime@1.6.0
- deps: ms@2.1.1
- deps: statuses@~1.5.0
- perf: remove redundant `path.normalize` call
1.13.2 / 2018-02-07
===================
* Fix incorrect end tag in redirects
* deps: encodeurl@~1.0.2
- Fix encoding `%` as last character
* deps: send@0.16.2
- deps: depd@~1.1.2
- deps: encodeurl@~1.0.2
- deps: statuses@~1.4.0
1.13.1 / 2017-09-29
===================
* Fix regression when `root` is incorrectly set to a file
* deps: send@0.16.1
1.13.0 / 2017-09-27
===================
* deps: send@0.16.0
- Add 70 new types for file extensions
- Add `immutable` option
- Fix missing `</html>` in default error & redirects
- Set charset as "UTF-8" for .js and .json
- Use instance methods on steam to check for listeners
- deps: mime@1.4.1
- perf: improve path validation speed
1.12.6 / 2017-09-22
===================
* deps: send@0.15.6
- deps: debug@2.6.9
- perf: improve `If-Match` token parsing
* perf: improve slash collapsing
1.12.5 / 2017-09-21
===================
* deps: parseurl@~1.3.2
- perf: reduce overhead for full URLs
- perf: unroll the "fast-path" `RegExp`
* deps: send@0.15.5
- Fix handling of modified headers with invalid dates
- deps: etag@~1.8.1
- deps: fresh@0.5.2
1.12.4 / 2017-08-05
===================
* deps: send@0.15.4
- deps: debug@2.6.8
- deps: depd@~1.1.1
- deps: http-errors@~1.6.2
1.12.3 / 2017-05-16
===================
* deps: send@0.15.3
- deps: debug@2.6.7
1.12.2 / 2017-04-26
===================
* deps: send@0.15.2
- deps: debug@2.6.4
1.12.1 / 2017-03-04
===================
* deps: send@0.15.1
- Fix issue when `Date.parse` does not return `NaN` on invalid date
- Fix strict violation in broken environments
1.12.0 / 2017-02-25
===================
* Send complete HTML document in redirect response
* Set default CSP header in redirect response
* deps: send@0.15.0
- Fix false detection of `no-cache` request directive
- Fix incorrect result when `If-None-Match` has both `*` and ETags
- Fix weak `ETag` matching to match spec
- Remove usage of `res._headers` private field
- Support `If-Match` and `If-Unmodified-Since` headers
- Use `res.getHeaderNames()` when available
- Use `res.headersSent` when available
- deps: debug@2.6.1
- deps: etag@~1.8.0
- deps: fresh@0.5.0
- deps: http-errors@~1.6.1
1.11.2 / 2017-01-23
===================
* deps: send@0.14.2
- deps: http-errors@~1.5.1
- deps: ms@0.7.2
- deps: statuses@~1.3.1
1.11.1 / 2016-06-10
===================
* Fix redirect error when `req.url` contains raw non-URL characters
* deps: send@0.14.1
1.11.0 / 2016-06-07
===================
* Use status code 301 for redirects
* deps: send@0.14.0
- Add `acceptRanges` option
- Add `cacheControl` option
- Attempt to combine multiple ranges into single range
- Correctly inherit from `Stream` class
- Fix `Content-Range` header in 416 responses when using `start`/`end` options
- Fix `Content-Range` header missing from default 416 responses
- Ignore non-byte `Range` headers
- deps: http-errors@~1.5.0
- deps: range-parser@~1.2.0
- deps: statuses@~1.3.0
- perf: remove argument reassignment
1.10.3 / 2016-05-30
===================
* deps: send@0.13.2
- Fix invalid `Content-Type` header when `send.mime.default_type` unset
1.10.2 / 2016-01-19
===================
* deps: parseurl@~1.3.1
- perf: enable strict mode
1.10.1 / 2016-01-16
===================
* deps: escape-html@~1.0.3
- perf: enable strict mode
- perf: optimize string replacement
- perf: use faster string coercion
* deps: send@0.13.1
- deps: depd@~1.1.0
- deps: destroy@~1.0.4
- deps: escape-html@~1.0.3
- deps: range-parser@~1.0.3
1.10.0 / 2015-06-17
===================
* Add `fallthrough` option
- Allows declaring this middleware is the final destination
- Provides better integration with Express patterns
* Fix reading options from options prototype
* Improve the default redirect response headers
* deps: escape-html@1.0.2
* deps: send@0.13.0
- Allow Node.js HTTP server to set `Date` response header
- Fix incorrectly removing `Content-Location` on 304 response
- Improve the default redirect response headers
- Send appropriate headers on default error response
- Use `http-errors` for standard emitted errors
- Use `statuses` instead of `http` module for status messages
- deps: escape-html@1.0.2
- deps: etag@~1.7.0
- deps: fresh@0.3.0
- deps: on-finished@~2.3.0
- perf: enable strict mode
- perf: remove unnecessary array allocations
* perf: enable strict mode
* perf: remove argument reassignment
1.9.3 / 2015-05-14
==================
* deps: send@0.12.3
- deps: debug@~2.2.0
- deps: depd@~1.0.1
- deps: etag@~1.6.0
- deps: ms@0.7.1
- deps: on-finished@~2.2.1
1.9.2 / 2015-03-14
==================
* deps: send@0.12.2
- Throw errors early for invalid `extensions` or `index` options
- deps: debug@~2.1.3
1.9.1 / 2015-02-17
==================
* deps: send@0.12.1
- Fix regression sending zero-length files
1.9.0 / 2015-02-16
==================
* deps: send@0.12.0
- Always read the stat size from the file
- Fix mutating passed-in `options`
- deps: mime@1.3.4
1.8.1 / 2015-01-20
==================
* Fix redirect loop in Node.js 0.11.14
* deps: send@0.11.1
- Fix root path disclosure
1.8.0 / 2015-01-05
==================
* deps: send@0.11.0
- deps: debug@~2.1.1
- deps: etag@~1.5.1
- deps: ms@0.7.0
- deps: on-finished@~2.2.0
1.7.2 / 2015-01-02
==================
* Fix potential open redirect when mounted at root
1.7.1 / 2014-10-22
==================
* deps: send@0.10.1
- deps: on-finished@~2.1.1
1.7.0 / 2014-10-15
==================
* deps: send@0.10.0
- deps: debug@~2.1.0
- deps: depd@~1.0.0
- deps: etag@~1.5.0
1.6.5 / 2015-02-04
==================
* Fix potential open redirect when mounted at root
- Back-ported from v1.7.2
1.6.4 / 2014-10-08
==================
* Fix redirect loop when index file serving disabled
1.6.3 / 2014-09-24
==================
* deps: send@0.9.3
- deps: etag@~1.4.0
1.6.2 / 2014-09-15
==================
* deps: send@0.9.2
- deps: depd@0.4.5
- deps: etag@~1.3.1
- deps: range-parser@~1.0.2
1.6.1 / 2014-09-07
==================
* deps: send@0.9.1
- deps: fresh@0.2.4
1.6.0 / 2014-09-07
==================
* deps: send@0.9.0
- Add `lastModified` option
- Use `etag` to generate `ETag` header
- deps: debug@~2.0.0
1.5.4 / 2014-09-04
==================
* deps: send@0.8.5
- Fix a path traversal issue when using `root`
- Fix malicious path detection for empty string path
1.5.3 / 2014-08-17
==================
* deps: send@0.8.3
1.5.2 / 2014-08-14
==================
* deps: send@0.8.2
- Work around `fd` leak in Node.js 0.10 for `fs.ReadStream`
1.5.1 / 2014-08-09
==================
* Fix parsing of weird `req.originalUrl` values
* deps: parseurl@~1.3.0
* deps: utils-merge@1.0.0
1.5.0 / 2014-08-05
==================
* deps: send@0.8.1
- Add `extensions` option
1.4.4 / 2014-08-04
==================
* deps: send@0.7.4
- Fix serving index files without root dir
1.4.3 / 2014-07-29
==================
* deps: send@0.7.3
- Fix incorrect 403 on Windows and Node.js 0.11
1.4.2 / 2014-07-27
==================
* deps: send@0.7.2
- deps: depd@0.4.4
1.4.1 / 2014-07-26
==================
* deps: send@0.7.1
- deps: depd@0.4.3
1.4.0 / 2014-07-21
==================
* deps: parseurl@~1.2.0
- Cache URLs based on original value
- Remove no-longer-needed URL mis-parse work-around
- Simplify the "fast-path" `RegExp`
* deps: send@0.7.0
- Add `dotfiles` option
- deps: debug@1.0.4
- deps: depd@0.4.2
1.3.2 / 2014-07-11
==================
* deps: send@0.6.0
- Cap `maxAge` value to 1 year
- deps: debug@1.0.3
1.3.1 / 2014-07-09
==================
* deps: parseurl@~1.1.3
- faster parsing of href-only URLs
1.3.0 / 2014-06-28
==================
* Add `setHeaders` option
* Include HTML link in redirect response
* deps: send@0.5.0
- Accept string for `maxAge` (converted by `ms`)
1.2.3 / 2014-06-11
==================
* deps: send@0.4.3
- Do not throw un-catchable error on file open race condition
- Use `escape-html` for HTML escaping
- deps: debug@1.0.2
- deps: finished@1.2.2
- deps: fresh@0.2.2
1.2.2 / 2014-06-09
==================
* deps: send@0.4.2
- fix "event emitter leak" warnings
- deps: debug@1.0.1
- deps: finished@1.2.1
1.2.1 / 2014-06-02
==================
* use `escape-html` for escaping
* deps: send@0.4.1
- Send `max-age` in `Cache-Control` in correct format
1.2.0 / 2014-05-29
==================
* deps: send@0.4.0
- Calculate ETag with md5 for reduced collisions
- Fix wrong behavior when index file matches directory
- Ignore stream errors after request ends
- Skip directories in index file search
- deps: debug@0.8.1
1.1.0 / 2014-04-24
==================
* Accept options directly to `send` module
* deps: send@0.3.0
1.0.4 / 2014-04-07
==================
* Resolve relative paths at middleware setup
* Use parseurl to parse the URL from request
1.0.3 / 2014-03-20
==================
* Do not rely on connect-like environments
1.0.2 / 2014-03-06
==================
* deps: send@0.2.0
1.0.1 / 2014-03-05
==================
* Add mime export for back-compat
1.0.0 / 2014-03-05
==================
* Genesis from `connect`
@@ -0,0 +1,115 @@
import { CloneType } from '../clone/type.mjs';
import { Unknown } from '../unknown/index.mjs';
import { ReadonlyOptional } from '../readonly-optional/index.mjs';
import { Readonly } from '../readonly/index.mjs';
import { Optional } from '../optional/index.mjs';
import { Object } from '../object/index.mjs';
import { Record, RecordKey, RecordValue } from '../record/index.mjs';
import * as ValueGuard from '../guard/value.mjs';
import * as KindGuard from '../guard/kind.mjs';
// prettier-ignore
function FromConstructor(args, type) {
type.parameters = FromTypes(args, type.parameters);
type.returns = FromType(args, type.returns);
return type;
}
// prettier-ignore
function FromFunction(args, type) {
type.parameters = FromTypes(args, type.parameters);
type.returns = FromType(args, type.returns);
return type;
}
// prettier-ignore
function FromIntersect(args, type) {
type.allOf = FromTypes(args, type.allOf);
return type;
}
// prettier-ignore
function FromUnion(args, type) {
type.anyOf = FromTypes(args, type.anyOf);
return type;
}
// prettier-ignore
function FromTuple(args, type) {
if (ValueGuard.IsUndefined(type.items))
return type;
type.items = FromTypes(args, type.items);
return type;
}
// prettier-ignore
function FromArray(args, type) {
type.items = FromType(args, type.items);
return type;
}
// prettier-ignore
function FromAsyncIterator(args, type) {
type.items = FromType(args, type.items);
return type;
}
// prettier-ignore
function FromIterator(args, type) {
type.items = FromType(args, type.items);
return type;
}
// prettier-ignore
function FromPromise(args, type) {
type.item = FromType(args, type.item);
return type;
}
// prettier-ignore
function FromObject(args, type) {
const mappedProperties = FromProperties(args, type.properties);
return { ...type, ...Object(mappedProperties) }; // retain options
}
// prettier-ignore
function FromRecord(args, type) {
const mappedKey = FromType(args, RecordKey(type));
const mappedValue = FromType(args, RecordValue(type));
const result = Record(mappedKey, mappedValue);
return { ...type, ...result }; // retain options
}
// prettier-ignore
function FromArgument(args, argument) {
return argument.index in args ? args[argument.index] : Unknown();
}
// prettier-ignore
function FromProperty(args, type) {
const isReadonly = KindGuard.IsReadonly(type);
const isOptional = KindGuard.IsOptional(type);
const mapped = FromType(args, type);
return (isReadonly && isOptional ? ReadonlyOptional(mapped) :
isReadonly && !isOptional ? Readonly(mapped) :
!isReadonly && isOptional ? Optional(mapped) :
mapped);
}
// prettier-ignore
function FromProperties(args, properties) {
return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => {
return { ...result, [key]: FromProperty(args, properties[key]) };
}, {});
}
// prettier-ignore
export function FromTypes(args, types) {
return types.map(type => FromType(args, type));
}
// prettier-ignore
function FromType(args, type) {
return (KindGuard.IsConstructor(type) ? FromConstructor(args, type) :
KindGuard.IsFunction(type) ? FromFunction(args, type) :
KindGuard.IsIntersect(type) ? FromIntersect(args, type) :
KindGuard.IsUnion(type) ? FromUnion(args, type) :
KindGuard.IsTuple(type) ? FromTuple(args, type) :
KindGuard.IsArray(type) ? FromArray(args, type) :
KindGuard.IsAsyncIterator(type) ? FromAsyncIterator(args, type) :
KindGuard.IsIterator(type) ? FromIterator(args, type) :
KindGuard.IsPromise(type) ? FromPromise(args, type) :
KindGuard.IsObject(type) ? FromObject(args, type) :
KindGuard.IsRecord(type) ? FromRecord(args, type) :
KindGuard.IsArgument(type) ? FromArgument(args, type) :
type);
}
/** `[JavaScript]` Instantiates a type with the given parameters */
// prettier-ignore
export function Instantiate(type, args) {
return FromType(args, CloneType(type));
}
@@ -0,0 +1,20 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor');
var IsArray = require('./IsArray');
var ObjectCreate = require('./ObjectCreate');
// https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor
module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) {
GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic
var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto);
var slots = arguments.length < 3 ? [] : arguments[2];
if (!IsArray(slots)) {
throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List');
}
return ObjectCreate(proto, slots);
};
@@ -0,0 +1,23 @@
import type { TSESTree } from '@typescript-eslint/utils';
import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule } from '../util';
declare const baseRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"exceed", ({
countVoidThis?: boolean;
max: number;
} | {
countVoidThis?: boolean;
maximum: number;
})[], unknown, {
ArrowFunctionExpression(node: TSESTree.ArrowFunctionExpression): void;
FunctionDeclaration(node: TSESTree.FunctionDeclaration | TSESTree.TSDeclareFunction | TSESTree.TSFunctionType): void;
FunctionExpression(node: TSESTree.FunctionExpression): void;
}>;
export type Options = InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = InferMessageIdsTypeFromRule<typeof baseRule>;
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"exceed", ({
countVoidThis?: boolean;
max: number;
} | {
countVoidThis?: boolean;
maximum: number;
})[], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,10 @@
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"target": "es2021",
},
"exclude": [
"coverage",
"test/list-exports"
],
}
@@ -0,0 +1,34 @@
'use strict'
const fs = require('../fs')
const u = require('universalify').fromPromise
async function symlinkType (srcpath, type) {
if (type) return type
let stats
try {
stats = await fs.lstat(srcpath)
} catch {
return 'file'
}
return (stats && stats.isDirectory()) ? 'dir' : 'file'
}
function symlinkTypeSync (srcpath, type) {
if (type) return type
let stats
try {
stats = fs.lstatSync(srcpath)
} catch {
return 'file'
}
return (stats && stats.isDirectory()) ? 'dir' : 'file'
}
module.exports = {
symlinkType: u(symlinkType),
symlinkTypeSync
}
@@ -0,0 +1 @@
{"mappings":"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","sources":["packages/@internationalized/date/src/calendars/EthiopicCalendar.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from ICU.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate, Calendar} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {Mutable} from '../utils';\n\nconst ETHIOPIC_EPOCH = 1723856;\nconst COPTIC_EPOCH = 1824665;\n\n// The delta between Amete Alem 1 and Amete Mihret 1\n// AA 5501 = AM 1\nconst AMETE_MIHRET_DELTA = 5500;\n\nfunction ceToJulianDay(epoch: number, year: number, month: number, day: number): number {\n return (\n epoch // difference from Julian epoch to 1,1,1\n + 365 * year // number of days from years\n + Math.floor(year / 4) // extra day of leap year\n + 30 * (month - 1) // number of days from months (1 based)\n + day - 1 // number of days for present month (1 based)\n );\n}\n\nfunction julianDayToCE(epoch: number, jd: number) {\n let year = Math.floor((4 * (jd - epoch)) / 1461);\n let month = 1 + Math.floor((jd - ceToJulianDay(epoch, year, 1, 1)) / 30);\n let day = jd + 1 - ceToJulianDay(epoch, year, month, 1);\n return [year, month, day];\n}\n\nfunction getLeapDay(year: number) {\n return Math.floor((year % 4) / 3);\n}\n\nfunction getDaysInMonth(year: number, month: number) {\n // The Ethiopian and Coptic calendars have 13 months, 12 of 30 days each and\n // an intercalary month at the end of the year of 5 or 6 days, depending whether\n // the year is a leap year or not. The Leap Year follows the same rules as the\n // Julian Calendar so that the eLine truncated
@@ -0,0 +1,28 @@
/**
* Utility for resolving a module relative to another module
* @author Teddy Katz
*/
"use strict";
const Module = require("node:module");
/*
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
* We only support the case where the argument is a filepath, not a URL.
*/
const createRequire = Module.createRequire;
/**
* Resolves a Node module relative to another module
* @param {string} moduleName The name of a Node module, or a path to a Node module.
* @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be
* a file rather than a directory, but the file need not actually exist.
* @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`
* @throws {Error} When the module cannot be resolved.
*/
function resolve(moduleName, relativeToPath) {
return createRequire(relativeToPath).resolve(moduleName);
}
exports.resolve = resolve;
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more