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,65 @@
# date-manip
[![npm package](https://nodei.co/npm/date-manip.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/date-manip)
[![NPM Version](https://img.shields.io/npm/v/date-manip.svg?style=flat)](https://npmjs.org/package/date-manip)
[![NPM Downloads](https://img.shields.io/npm/dm/date-manip.svg?style=flat)](https://npmjs.org/package/date-manip)
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/date-manip/badge)](https://www.jsdelivr.com/package/npm/date-manip)
---
## Introduction
`date-manip` is a lightweight and modular JavaScript library for handling date operations with high performance. It provides a rich set of features, including date arithmetic (addition/subtraction), formatting, comparison, and more.
Whether you're building a small utility or a large-scale application, `date-manip` simplifies complex date manipulations while maintaining efficiency and flexibility.
## Features
- **Modularity**: Supports modular import and on-demand loading.
- **High Performance**: Optimized performance for various scenarios.
- **Chaining**: Supports chaining, making the code more concise.
- **Rich Features**: Supports date addition and subtraction, formatting, comparison, and other operations.
## Documentation
For detailed usage instructions and API references, please visit the official documentation:
👉 [View Full Documentation](https://fengxinming.github.io/util/modules/date-manip/)
## Quick Start
### Installation
Install `date-manip` via npm:
```bash
npm install date-manip
```
### Basic Usage
Here’s a quick example to get you started:
```javascript
import { addDays, format } from 'date-manip';
// Add 5 days to the current date
const newDate = addDays(new Date(), 5);
// Format the date as "YYYY-MM-DD"
console.log(format(newDate, 'YYYY-MM-DD'));
```
## Contributing
We welcome contributions from the community! If you find a bug or want to suggest an improvement, feel free to open an issue or submit a pull request.
### How to Contribute
1. Fork the repository.
2. Create a new branch for your changes.
3. Submit a pull request with a clear description of your changes.
## License
This project is licensed under the [MIT License](LICENSE).
@@ -0,0 +1,25 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $fromCharCode = GetIntrinsic('%String.fromCharCode%');
var floor = require('./floor');
var modulo = require('./modulo');
var isCodePoint = require('../helpers/isCodePoint');
// https://262.ecma-international.org/12.0/#sec-utf16encoding
module.exports = function UTF16EncodeCodePoint(cp) {
if (!isCodePoint(cp)) {
throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF');
}
if (cp <= 65535) {
return $fromCharCode(cp);
}
var cu1 = $fromCharCode(floor((cp - 65536) / 1024) + 0xD800);
var cu2 = $fromCharCode(modulo(cp - 65536, 1024) + 0xDC00);
return cu1 + cu2;
};
@@ -0,0 +1 @@
{"version":3,"file":"Prototype.d.ts","sourceRoot":"","sources":["../../../../src/prototype/models/Prototype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,OAAO,CAAC;CACtB"}
@@ -0,0 +1 @@
{"version":3,"file":"error_messages.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/test/node/error_messages.int.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"complexity": 0,
"eqeqeq": [2, "allow-null"],
"func-name-matching": 0,
"id-length": 0,
"max-lines-per-function": 0,
"max-statements": 0,
},
}
@@ -0,0 +1,25 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $match = GetIntrinsic('%Symbol.match%', true);
var hasRegExpMatcher = require('is-regex');
var isObject = require('es-object-atoms/isObject');
var ToBoolean = require('./ToBoolean');
// https://262.ecma-international.org/6.0/#sec-isregexp
module.exports = function IsRegExp(argument) {
if (!isObject(argument)) {
return false;
}
if ($match) {
var isRegExp = argument[$match];
if (typeof isRegExp !== 'undefined') {
return ToBoolean(isRegExp);
}
}
return hasRegExpMatcher(argument);
};
@@ -0,0 +1 @@
{"name":"@esbuild/linux-x64","version":"0.27.2","requiresBuild":false,"files":{"bin/esbuild":{"checkedAt":1794532091250,"integrity":"sha512-NO0ILqkicL8EfezS/We49ImRfQxt9sBPGYp68p0BmCzCeYXNjylJ3lTihu+H5PoBRD6u/yy8+QvvS6m4+2OX6Q==","mode":493,"size":11100344},"package.json":{"checkedAt":1794532091250,"integrity":"sha512-zKSPWX2GQXTGxyG2KyFcjufYIG5u+0WlHbQtb0IaOV+15YnseQucaSiYrLiKNL8pc8iwEgEuh/v0lrllf3rAbg==","mode":420,"size":372},"README.md":{"checkedAt":1794532091251,"integrity":"sha512-qNBiKmnPN19z/Z+/lCWlQUHNdW/dUvbWf5vFnL6D/NigWWw0HAKYXtACpBYUaA3TvTVK/gkK+Cus4aW8HbBtdQ==","mode":420,"size":141}}}
@@ -0,0 +1,2 @@
export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
export type Scalars = Primitive | Primitive[];
@@ -0,0 +1,23 @@
'use strict';
var callBind = require('call-bind');
var define = require('define-properties');
var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var bound = callBind(getPolyfill());
var boundMethod = function trim(receiver) {
RequireObjectCoercible(receiver);
return bound(receiver);
};
define(boundMethod, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = boundMethod;
@@ -0,0 +1,25 @@
import Pool from './pool'
import MockAgent from './mock-agent'
import { Interceptable, MockInterceptor } from './mock-interceptor'
import Dispatcher from './dispatcher'
export default MockPool
/** MockPool extends the Pool API and allows one to mock requests. */
declare class MockPool extends Pool implements Interceptable {
constructor(origin: string, options: MockPool.Options);
/** Intercepts any matching requests that use the same origin as this mock pool. */
intercept(options: MockInterceptor.Options): MockInterceptor;
/** Dispatches a mocked request. */
dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean;
/** Closes the mock pool and gracefully waits for enqueued requests to complete. */
close(): Promise<void>;
}
declare namespace MockPool {
/** MockPool options. */
export interface Options extends Pool.Options {
/** The agent to associate this MockPool with. */
agent: MockAgent;
}
}
@@ -0,0 +1,21 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"id-length": "off",
"no-extra-parens": "off",
},
"overrides": [
{
"files": ["test/**/*.js"],
"rules": {
"id-length": "off",
"multiline-comment-style": "off",
"no-empty-function": "off",
},
},
],
}
@@ -0,0 +1,23 @@
import type { TSchema, SchemaOptions } from '../schema/index';
import type { Static } from '../static/index';
import type { Ensure } from '../helpers/index';
import type { TReadonlyOptional } from '../readonly-optional/index';
import type { TReadonly } from '../readonly/index';
import type { TOptional } from '../optional/index';
import { Kind } from '../symbols/index';
type StaticReturnType<U extends TSchema, P extends unknown[]> = Static<U, P>;
type StaticParameter<T extends TSchema, P extends unknown[]> = T extends TReadonlyOptional<T> ? [Readonly<Static<T, P>>?] : T extends TReadonly<T> ? [Readonly<Static<T, P>>] : T extends TOptional<T> ? [Static<T, P>?] : [
Static<T, P>
];
type StaticParameters<T extends TSchema[], P extends unknown[], Acc extends unknown[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? StaticParameters<R, P, [...Acc, ...StaticParameter<L, P>]> : Acc);
type StaticFunction<T extends TSchema[], U extends TSchema, P extends unknown[]> = Ensure<(...param: StaticParameters<T, P>) => StaticReturnType<U, P>>;
export interface TFunction<T extends TSchema[] = TSchema[], U extends TSchema = TSchema> extends TSchema {
[Kind]: 'Function';
static: StaticFunction<T, U, this['params']>;
type: 'Function';
parameters: T;
returns: U;
}
/** `[JavaScript]` Creates a Function type */
export declare function Function<T extends TSchema[], U extends TSchema>(parameters: [...T], returns: U, options?: SchemaOptions): TFunction<T, U>;
export {};
@@ -0,0 +1 @@
{"version":3,"file":"getCheckboxValue.d.ts","sourceRoot":"","sources":["../../src/logic/getCheckboxValue.ts"],"names":[],"mappings":"AAEA,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,CAAC;CAChD,CAAC;yBASc,UAAU,gBAAgB,EAAE,KAAG,mBAAmB;AAAlE,wBAoBE"}
@@ -0,0 +1,150 @@
export default {
aliceblue: [240, 248, 255],
antiquewhite: [250, 235, 215],
aqua: [0, 255, 255],
aquamarine: [127, 255, 212],
azure: [240, 255, 255],
beige: [245, 245, 220],
bisque: [255, 228, 196],
black: [0, 0, 0],
blanchedalmond: [255, 235, 205],
blue: [0, 0, 255],
blueviolet: [138, 43, 226],
brown: [165, 42, 42],
burlywood: [222, 184, 135],
cadetblue: [95, 158, 160],
chartreuse: [127, 255, 0],
chocolate: [210, 105, 30],
coral: [255, 127, 80],
cornflowerblue: [100, 149, 237],
cornsilk: [255, 248, 220],
crimson: [220, 20, 60],
cyan: [0, 255, 255],
darkblue: [0, 0, 139],
darkcyan: [0, 139, 139],
darkgoldenrod: [184, 134, 11],
darkgray: [169, 169, 169],
darkgreen: [0, 100, 0],
darkgrey: [169, 169, 169],
darkkhaki: [189, 183, 107],
darkmagenta: [139, 0, 139],
darkolivegreen: [85, 107, 47],
darkorange: [255, 140, 0],
darkorchid: [153, 50, 204],
darkred: [139, 0, 0],
darksalmon: [233, 150, 122],
darkseagreen: [143, 188, 143],
darkslateblue: [72, 61, 139],
darkslategray: [47, 79, 79],
darkslategrey: [47, 79, 79],
darkturquoise: [0, 206, 209],
darkviolet: [148, 0, 211],
deeppink: [255, 20, 147],
deepskyblue: [0, 191, 255],
dimgray: [105, 105, 105],
dimgrey: [105, 105, 105],
dodgerblue: [30, 144, 255],
firebrick: [178, 34, 34],
floralwhite: [255, 250, 240],
forestgreen: [34, 139, 34],
fuchsia: [255, 0, 255],
gainsboro: [220, 220, 220],
ghostwhite: [248, 248, 255],
gold: [255, 215, 0],
goldenrod: [218, 165, 32],
gray: [128, 128, 128],
green: [0, 128, 0],
greenyellow: [173, 255, 47],
grey: [128, 128, 128],
honeydew: [240, 255, 240],
hotpink: [255, 105, 180],
indianred: [205, 92, 92],
indigo: [75, 0, 130],
ivory: [255, 255, 240],
khaki: [240, 230, 140],
lavender: [230, 230, 250],
lavenderblush: [255, 240, 245],
lawngreen: [124, 252, 0],
lemonchiffon: [255, 250, 205],
lightblue: [173, 216, 230],
lightcoral: [240, 128, 128],
lightcyan: [224, 255, 255],
lightgoldenrodyellow: [250, 250, 210],
lightgray: [211, 211, 211],
lightgreen: [144, 238, 144],
lightgrey: [211, 211, 211],
lightpink: [255, 182, 193],
lightsalmon: [255, 160, 122],
lightseagreen: [32, 178, 170],
lightskyblue: [135, 206, 250],
lightslategray: [119, 136, 153],
lightslategrey: [119, 136, 153],
lightsteelblue: [176, 196, 222],
lightyellow: [255, 255, 224],
lime: [0, 255, 0],
limegreen: [50, 205, 50],
linen: [250, 240, 230],
magenta: [255, 0, 255],
maroon: [128, 0, 0],
mediumaquamarine: [102, 205, 170],
mediumblue: [0, 0, 205],
mediumorchid: [186, 85, 211],
mediumpurple: [147, 112, 219],
mediumseagreen: [60, 179, 113],
mediumslateblue: [123, 104, 238],
mediumspringgreen: [0, 250, 154],
mediumturquoise: [72, 209, 204],
mediumvioletred: [199, 21, 133],
midnightblue: [25, 25, 112],
mintcream: [245, 255, 250],
mistyrose: [255, 228, 225],
moccasin: [255, 228, 181],
navajowhite: [255, 222, 173],
navy: [0, 0, 128],
oldlace: [253, 245, 230],
olive: [128, 128, 0],
olivedrab: [107, 142, 35],
orange: [255, 165, 0],
orangered: [255, 69, 0],
orchid: [218, 112, 214],
palegoldenrod: [238, 232, 170],
palegreen: [152, 251, 152],
paleturquoise: [175, 238, 238],
palevioletred: [219, 112, 147],
papayawhip: [255, 239, 213],
peachpuff: [255, 218, 185],
peru: [205, 133, 63],
pink: [255, 192, 203],
plum: [221, 160, 221],
powderblue: [176, 224, 230],
purple: [128, 0, 128],
rebeccapurple: [102, 51, 153],
red: [255, 0, 0],
rosybrown: [188, 143, 143],
royalblue: [65, 105, 225],
saddlebrown: [139, 69, 19],
salmon: [250, 128, 114],
sandybrown: [244, 164, 96],
seagreen: [46, 139, 87],
seashell: [255, 245, 238],
sienna: [160, 82, 45],
silver: [192, 192, 192],
skyblue: [135, 206, 235],
slateblue: [106, 90, 205],
slategray: [112, 128, 144],
slategrey: [112, 128, 144],
snow: [255, 250, 250],
springgreen: [0, 255, 127],
steelblue: [70, 130, 180],
tan: [210, 180, 140],
teal: [0, 128, 128],
thistle: [216, 191, 216],
tomato: [255, 99, 71],
turquoise: [64, 224, 208],
violet: [238, 130, 238],
wheat: [245, 222, 179],
white: [255, 255, 255],
whitesmoke: [245, 245, 245],
yellow: [255, 255, 0],
yellowgreen: [154, 205, 50],
}
@@ -0,0 +1,68 @@
import _copy from './copy/index.js'
import _empty from './empty/index.js'
import _ensure from './ensure/index.js'
import _json from './json/index.js'
import _mkdirs from './mkdirs/index.js'
import _move from './move/index.js'
import _outputFile from './output-file/index.js'
import _pathExists from './path-exists/index.js'
import _remove from './remove/index.js'
// NOTE: Only exports fs-extra's functions; fs functions must be imported from "node:fs" or "node:fs/promises"
export const copy = _copy.copy
export const copySync = _copy.copySync
export const emptyDirSync = _empty.emptyDirSync
export const emptydirSync = _empty.emptydirSync
export const emptyDir = _empty.emptyDir
export const emptydir = _empty.emptydir
export const createFile = _ensure.createFile
export const createFileSync = _ensure.createFileSync
export const ensureFile = _ensure.ensureFile
export const ensureFileSync = _ensure.ensureFileSync
export const createLink = _ensure.createLink
export const createLinkSync = _ensure.createLinkSync
export const ensureLink = _ensure.ensureLink
export const ensureLinkSync = _ensure.ensureLinkSync
export const createSymlink = _ensure.createSymlink
export const createSymlinkSync = _ensure.createSymlinkSync
export const ensureSymlink = _ensure.ensureSymlink
export const ensureSymlinkSync = _ensure.ensureSymlinkSync
export const readJson = _json.readJson
export const readJSON = _json.readJSON
export const readJsonSync = _json.readJsonSync
export const readJSONSync = _json.readJSONSync
export const writeJson = _json.writeJson
export const writeJSON = _json.writeJSON
export const writeJsonSync = _json.writeJsonSync
export const writeJSONSync = _json.writeJSONSync
export const outputJson = _json.outputJson
export const outputJSON = _json.outputJSON
export const outputJsonSync = _json.outputJsonSync
export const outputJSONSync = _json.outputJSONSync
export const mkdirs = _mkdirs.mkdirs
export const mkdirsSync = _mkdirs.mkdirsSync
export const mkdirp = _mkdirs.mkdirp
export const mkdirpSync = _mkdirs.mkdirpSync
export const ensureDir = _mkdirs.ensureDir
export const ensureDirSync = _mkdirs.ensureDirSync
export const move = _move.move
export const moveSync = _move.moveSync
export const outputFile = _outputFile.outputFile
export const outputFileSync = _outputFile.outputFileSync
export const pathExists = _pathExists.pathExists
export const pathExistsSync = _pathExists.pathExistsSync
export const remove = _remove.remove
export const removeSync = _remove.removeSync
export default {
..._copy,
..._empty,
..._ensure,
..._json,
..._mkdirs,
..._move,
..._outputFile,
..._pathExists,
..._remove
}
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.multiInject = multiInject;
const decrementPendingClassMetadataCount_1 = require("../actions/decrementPendingClassMetadataCount");
const buildManagedMetadataFromMaybeClassElementMetadata_1 = require("../calculations/buildManagedMetadataFromMaybeClassElementMetadata");
const ClassElementMetadataKind_1 = require("../models/ClassElementMetadataKind");
const injectBase_1 = require("./injectBase");
function multiInject(serviceIdentifier, options) {
const updateMetadata = (0, buildManagedMetadataFromMaybeClassElementMetadata_1.buildManagedMetadataFromMaybeClassElementMetadata)(ClassElementMetadataKind_1.ClassElementMetadataKind.multipleInjection, serviceIdentifier, options);
return (0, injectBase_1.injectBase)(updateMetadata, decrementPendingClassMetadataCount_1.decrementPendingClassMetadataCount);
}
//# sourceMappingURL=multiInject.js.map
@@ -0,0 +1 @@
{"version":3,"file":"PlanTree.js","sourceRoot":"","sources":["../../../../src/planning/models/PlanTree.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_all_comments_from_nodes_1 = require("../get-all-comments-from-nodes");
var get_import_nodes_1 = require("../get-import-nodes");
var get_sorted_nodes_1 = require("../get-sorted-nodes");
var getSortedImportNodes = function (code, options) {
var importNodes = (0, get_import_nodes_1.getImportNodes)(code, options);
return (0, get_sorted_nodes_1.getSortedNodes)(importNodes, {
importOrder: [],
importOrderCaseInsensitive: false,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: false,
importOrderSideEffects: true,
});
};
var getComments = function (commentNodes) {
return commentNodes.map(function (node) { return node.value; });
};
test('it returns empty array when there is no comment', function () {
var result = getSortedImportNodes("import z from 'z';\n ");
var commentNodes = (0, get_all_comments_from_nodes_1.getAllCommentsFromNodes)(result);
var comments = getComments(commentNodes);
expect(comments).toEqual([]);
});
test('it returns single comment of a node', function () {
var result = getSortedImportNodes("// first comment\nimport z from 'z';\n");
var commentNodes = (0, get_all_comments_from_nodes_1.getAllCommentsFromNodes)(result);
var comments = getComments(commentNodes);
expect(comments).toEqual([' first comment']);
});
test('it returns all comments for a node', function () {
var result = getSortedImportNodes("// first comment\n// second comment\nimport z from 'z';\n");
var commentNodes = (0, get_all_comments_from_nodes_1.getAllCommentsFromNodes)(result);
var comments = getComments(commentNodes);
expect(comments).toEqual([' first comment', ' second comment']);
});
test('it returns comment block for a node', function () {
var result = getSortedImportNodes("\n/**\n * some block\n */\nimport z from 'z';\n");
var commentNodes = (0, get_all_comments_from_nodes_1.getAllCommentsFromNodes)(result);
var comments = getComments(commentNodes);
expect(comments).toEqual(['*\n * some block\n ']);
});
@@ -0,0 +1,99 @@
/**
* @import {
* InitialConstruct,
* Initializer,
* State,
* TokenizeContext,
* Token
* } from 'micromark-util-types'
*/
import {ok as assert} from 'devlop'
import {factorySpace} from 'micromark-factory-space'
import {markdownLineEnding} from 'micromark-util-character'
import {codes, constants, types} from 'micromark-util-symbol'
/** @type {InitialConstruct} */
export const content = {tokenize: initializeContent}
/**
* @this {TokenizeContext}
* Context.
* @type {Initializer}
* Content.
*/
function initializeContent(effects) {
const contentStart = effects.attempt(
this.parser.constructs.contentInitial,
afterContentStartConstruct,
paragraphInitial
)
/** @type {Token} */
let previous
return contentStart
/** @type {State} */
function afterContentStartConstruct(code) {
assert(
code === codes.eof || markdownLineEnding(code),
'expected eol or eof'
)
if (code === codes.eof) {
effects.consume(code)
return
}
effects.enter(types.lineEnding)
effects.consume(code)
effects.exit(types.lineEnding)
return factorySpace(effects, contentStart, types.linePrefix)
}
/** @type {State} */
function paragraphInitial(code) {
assert(
code !== codes.eof && !markdownLineEnding(code),
'expected anything other than a line ending or EOF'
)
effects.enter(types.paragraph)
return lineStart(code)
}
/** @type {State} */
function lineStart(code) {
const token = effects.enter(types.chunkText, {
contentType: constants.contentTypeText,
previous
})
if (previous) {
previous.next = token
}
previous = token
return data(code)
}
/** @type {State} */
function data(code) {
if (code === codes.eof) {
effects.exit(types.chunkText)
effects.exit(types.paragraph)
effects.consume(code)
return
}
if (markdownLineEnding(code)) {
effects.consume(code)
effects.exit(types.chunkText)
return lineStart
}
// Data.
effects.consume(code)
return data
}
}
@@ -0,0 +1,24 @@
/*
* 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.
*/ const $b1f0cad8af73213b$export$3585ede4d035bf14 = new WeakMap();
function $b1f0cad8af73213b$var$normalizeKey(key) {
if (typeof key === 'string') return key.replace(/\s*/g, '');
return '' + key;
}
function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey) {
let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
if (!data) throw new Error('Unknown list');
return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey)}`;
}
export {$b1f0cad8af73213b$export$3585ede4d035bf14 as listData, $b1f0cad8af73213b$export$9145995848b05025 as getItemId};
//# sourceMappingURL=utils.module.js.map
@@ -0,0 +1,39 @@
var baseFlatten = require('./_baseFlatten'),
baseIteratee = require('./_baseIteratee'),
baseRest = require('./_baseRest'),
baseUniq = require('./_baseUniq'),
isArrayLikeObject = require('./isArrayLikeObject'),
last = require('./last');
/**
* This method is like `_.union` except that it accepts `iteratee` which is
* invoked for each element of each `arrays` to generate the criterion by
* which uniqueness is computed. Result values are chosen from the first
* array in which the value occurs. The iteratee is invoked with one argument:
* (value).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.unionBy([2.1], [1.2, 2.3], Math.floor);
* // => [2.1, 1.2]
*
* // The `_.property` iteratee shorthand.
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
var unionBy = baseRest(function(arrays) {
var iteratee = last(arrays);
if (isArrayLikeObject(iteratee)) {
iteratee = undefined;
}
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee, 2));
});
module.exports = unionBy;
@@ -0,0 +1,172 @@
"use client";
import {
useButtonGroupContext
} from "./chunk-3SAWKTTV.mjs";
// src/use-button.ts
import { useProviderContext } from "@heroui/system";
import { dataAttr } from "@heroui/shared-utils";
import { useCallback } from "react";
import { useFocusRing } from "@react-aria/focus";
import { chain, mergeProps } from "@react-aria/utils";
import { useDOMRef, filterDOMProps } from "@heroui/react-utils";
import { button } from "@heroui/theme";
import { isValidElement, cloneElement, useMemo } from "react";
import { useAriaButton } from "@heroui/use-aria-button";
import { useHover } from "@react-aria/interactions";
import { useRipple } from "@heroui/ripple";
function useButton(props) {
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
const groupContext = useButtonGroupContext();
const globalContext = useProviderContext();
const isInGroup = !!groupContext;
const {
ref,
as,
children,
startContent: startContentProp,
endContent: endContentProp,
autoFocus,
className,
spinner,
isLoading = false,
disableRipple: disableRippleProp = false,
fullWidth = (_a = groupContext == null ? void 0 : groupContext.fullWidth) != null ? _a : false,
radius = groupContext == null ? void 0 : groupContext.radius,
size = (_b = groupContext == null ? void 0 : groupContext.size) != null ? _b : "md",
color = (_c = groupContext == null ? void 0 : groupContext.color) != null ? _c : "default",
variant = (_d = groupContext == null ? void 0 : groupContext.variant) != null ? _d : "solid",
disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
isDisabled: isDisabledProp = (_g = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _g : false,
isIconOnly = (_h = groupContext == null ? void 0 : groupContext.isIconOnly) != null ? _h : false,
spinnerPlacement = "start",
onPress,
onClick,
...otherProps
} = props;
const Component = as || "button";
const shouldFilterDOMProps = typeof Component === "string";
const domRef = useDOMRef(ref);
const disableRipple = (_i = disableRippleProp || (globalContext == null ? void 0 : globalContext.disableRipple)) != null ? _i : disableAnimation;
const { isFocusVisible, isFocused, focusProps } = useFocusRing({
autoFocus
});
const isDisabled = isDisabledProp || isLoading;
const styles = useMemo(
() => button({
size,
color,
variant,
radius,
fullWidth,
isDisabled,
isInGroup,
disableAnimation,
isIconOnly,
className
}),
[
size,
color,
variant,
radius,
fullWidth,
isDisabled,
isInGroup,
isIconOnly,
disableAnimation,
className
]
);
const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple();
const handlePress = useCallback(
(e) => {
if (disableRipple || isDisabled || disableAnimation)
return;
domRef.current && onRipplePressHandler(e);
},
[disableRipple, isDisabled, disableAnimation, domRef, onRipplePressHandler]
);
const { buttonProps: ariaButtonProps, isPressed } = useAriaButton(
{
elementType: as,
isDisabled,
onPress: chain(onPress, handlePress),
onClick,
...otherProps
},
domRef
);
const { isHovered, hoverProps } = useHover({ isDisabled });
const getButtonProps = useCallback(
(props2 = {}) => ({
"data-disabled": dataAttr(isDisabled),
"data-focus": dataAttr(isFocused),
"data-pressed": dataAttr(isPressed),
"data-focus-visible": dataAttr(isFocusVisible),
"data-hover": dataAttr(isHovered),
"data-loading": dataAttr(isLoading),
...mergeProps(
ariaButtonProps,
focusProps,
hoverProps,
filterDOMProps(otherProps, {
enabled: shouldFilterDOMProps
}),
filterDOMProps(props2)
)
}),
[
isLoading,
isDisabled,
isFocused,
isPressed,
shouldFilterDOMProps,
isFocusVisible,
isHovered,
ariaButtonProps,
focusProps,
hoverProps,
otherProps
]
);
const getIconClone = (icon) => isValidElement(icon) ? cloneElement(icon, {
"aria-hidden": true,
focusable: false,
tabIndex: -1
}) : null;
const startContent = getIconClone(startContentProp);
const endContent = getIconClone(endContentProp);
const spinnerSize = useMemo(() => {
const buttonSpinnerSizeMap = {
sm: "sm",
md: "sm",
lg: "md"
};
return buttonSpinnerSizeMap[size];
}, [size]);
const getRippleProps = useCallback(
() => ({ ripples, onClear: onClearRipple }),
[ripples, onClearRipple]
);
return {
Component,
children,
domRef,
spinner,
styles,
startContent,
endContent,
isLoading,
spinnerPlacement,
spinnerSize,
disableRipple,
getButtonProps,
getRippleProps,
isIconOnly
};
}
export {
useButton
};
@@ -0,0 +1,194 @@
import {
colorVariants
} from "./chunk-GQT3YUX3.mjs";
import {
tv
} from "./chunk-UWE6H66T.mjs";
import {
dataFocusVisibleClasses,
translateCenterClasses
} from "./chunk-GH5E4FQB.mjs";
// src/components/avatar.ts
var avatar = tv({
slots: {
base: [
"flex",
"relative",
"justify-center",
"items-center",
"box-border",
"overflow-hidden",
"align-middle",
"text-white",
"z-0",
...dataFocusVisibleClasses
],
img: [
"flex",
"object-cover",
"w-full",
"h-full",
"transition-opacity",
"!duration-500",
"opacity-0",
"data-[loaded=true]:opacity-100"
],
fallback: [...translateCenterClasses, "flex", "items-center", "justify-center"],
name: [...translateCenterClasses, "font-normal", "text-center", "text-inherit"],
icon: [
...translateCenterClasses,
"flex",
"items-center",
"justify-center",
"text-inherit",
"w-full",
"h-full"
]
},
variants: {
size: {
sm: {
base: "w-8 h-8 text-tiny"
},
md: {
base: "w-10 h-10 text-tiny"
},
lg: {
base: "w-14 h-14 text-small"
}
},
color: {
default: {
base: colorVariants.solid.default
},
primary: {
base: colorVariants.solid.primary
},
secondary: {
base: colorVariants.solid.secondary
},
success: {
base: colorVariants.solid.success
},
warning: {
base: colorVariants.solid.warning
},
danger: {
base: colorVariants.solid.danger
}
},
radius: {
none: {
base: "rounded-none"
},
sm: {
base: "rounded-small"
},
md: {
base: "rounded-medium"
},
lg: {
base: "rounded-large"
},
full: {
base: "rounded-full"
}
},
isBordered: {
true: {
base: "ring-2 ring-offset-2 ring-offset-background dark:ring-offset-background-dark"
}
},
isDisabled: {
true: {
base: "opacity-disabled"
}
},
isInGroup: {
true: {
base: [
"-ms-2 data-[hover=true]:-translate-x-3 rtl:data-[hover=true]:translate-x-3 transition-transform",
"data-[focus-visible=true]:-translate-x-3 rtl:data-[focus-visible=true]:translate-x-3"
]
}
},
isInGridGroup: {
true: {
base: "m-0 data-[hover=true]:translate-x-0"
}
},
disableAnimation: {
true: {
base: "transition-none",
img: "transition-none"
},
false: {}
}
},
defaultVariants: {
size: "md",
color: "default",
radius: "full"
},
compoundVariants: [
{
color: "default",
isBordered: true,
class: {
base: "ring-default"
}
},
{
color: "primary",
isBordered: true,
class: {
base: "ring-primary"
}
},
{
color: "secondary",
isBordered: true,
class: {
base: "ring-secondary"
}
},
{
color: "success",
isBordered: true,
class: {
base: "ring-success"
}
},
{
color: "warning",
isBordered: true,
class: {
base: "ring-warning"
}
},
{
color: "danger",
isBordered: true,
class: {
base: "ring-danger"
}
}
]
});
var avatarGroup = tv({
slots: {
base: "flex items-center justify-center h-auto w-max",
count: "hover:-translate-x-0"
},
variants: {
isGrid: {
true: "inline-grid grid-cols-4 gap-3"
}
}
});
export {
avatar,
avatarGroup
};
@@ -0,0 +1,233 @@
/**
* @import {
* Construct,
* State,
* TokenizeContext,
* Tokenizer
* } from 'micromark-util-types'
*/
import { asciiAlphanumeric, asciiAlpha, asciiAtext, asciiControl } from 'micromark-util-character';
/** @type {Construct} */
export const autolink = {
name: 'autolink',
tokenize: tokenizeAutolink
};
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeAutolink(effects, ok, nok) {
let size = 0;
return start;
/**
* Start of an autolink.
*
* ```markdown
* > | a<https://example.com>b
* ^
* > | a<user@example.com>b
* ^
* ```
*
* @type {State}
*/
function start(code) {
effects.enter("autolink");
effects.enter("autolinkMarker");
effects.consume(code);
effects.exit("autolinkMarker");
effects.enter("autolinkProtocol");
return open;
}
/**
* After `<`, at protocol or atext.
*
* ```markdown
* > | a<https://example.com>b
* ^
* > | a<user@example.com>b
* ^
* ```
*
* @type {State}
*/
function open(code) {
if (asciiAlpha(code)) {
effects.consume(code);
return schemeOrEmailAtext;
}
if (code === 64) {
return nok(code);
}
return emailAtext(code);
}
/**
* At second byte of protocol or atext.
*
* ```markdown
* > | a<https://example.com>b
* ^
* > | a<user@example.com>b
* ^
* ```
*
* @type {State}
*/
function schemeOrEmailAtext(code) {
// ASCII alphanumeric and `+`, `-`, and `.`.
if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) {
// Count the previous alphabetical from `open` too.
size = 1;
return schemeInsideOrEmailAtext(code);
}
return emailAtext(code);
}
/**
* In ambiguous protocol or atext.
*
* ```markdown
* > | a<https://example.com>b
* ^
* > | a<user@example.com>b
* ^
* ```
*
* @type {State}
*/
function schemeInsideOrEmailAtext(code) {
if (code === 58) {
effects.consume(code);
size = 0;
return urlInside;
}
// ASCII alphanumeric and `+`, `-`, and `.`.
if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) {
effects.consume(code);
return schemeInsideOrEmailAtext;
}
size = 0;
return emailAtext(code);
}
/**
* After protocol, in URL.
*
* ```markdown
* > | a<https://example.com>b
* ^
* ```
*
* @type {State}
*/
function urlInside(code) {
if (code === 62) {
effects.exit("autolinkProtocol");
effects.enter("autolinkMarker");
effects.consume(code);
effects.exit("autolinkMarker");
effects.exit("autolink");
return ok;
}
// ASCII control, space, or `<`.
if (code === null || code === 32 || code === 60 || asciiControl(code)) {
return nok(code);
}
effects.consume(code);
return urlInside;
}
/**
* In email atext.
*
* ```markdown
* > | a<user.name@example.com>b
* ^
* ```
*
* @type {State}
*/
function emailAtext(code) {
if (code === 64) {
effects.consume(code);
return emailAtSignOrDot;
}
if (asciiAtext(code)) {
effects.consume(code);
return emailAtext;
}
return nok(code);
}
/**
* In label, after at-sign or dot.
*
* ```markdown
* > | a<user.name@example.com>b
* ^ ^
* ```
*
* @type {State}
*/
function emailAtSignOrDot(code) {
return asciiAlphanumeric(code) ? emailLabel(code) : nok(code);
}
/**
* In label, where `.` and `>` are allowed.
*
* ```markdown
* > | a<user.name@example.com>b
* ^
* ```
*
* @type {State}
*/
function emailLabel(code) {
if (code === 46) {
effects.consume(code);
size = 0;
return emailAtSignOrDot;
}
if (code === 62) {
// Exit, then change the token type.
effects.exit("autolinkProtocol").type = "autolinkEmail";
effects.enter("autolinkMarker");
effects.consume(code);
effects.exit("autolinkMarker");
effects.exit("autolink");
return ok;
}
return emailValue(code);
}
/**
* In label, where `.` and `>` are *not* allowed.
*
* Though, this is also used in `emailLabel` to parse other values.
*
* ```markdown
* > | a<user.name@ex-ample.com>b
* ^
* ```
*
* @type {State}
*/
function emailValue(code) {
// ASCII alphanumeric or `-`.
if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
const next = code === 45 ? emailValue : emailLabel;
effects.consume(code);
return next;
}
return nok(code);
}
}
@@ -0,0 +1,13 @@
{
"all": true,
"check-coverage": false,
"instrumentation": false,
"sourceMap": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"example",
"test",
"test-core-js.js"
]
}
@@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/multer`
# Summary
This package contains type definitions for multer (https://github.com/expressjs/multer).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/multer.
### Additional Details
* Last updated: Sat, 07 Jun 2025 02:15:25 GMT
* Dependencies: [@types/express](https://npmjs.com/package/@types/express)
# Credits
These definitions were written by [jt000](https://github.com/jt000), [vilicvane](https://github.com/vilic), [David Broder-Rodgers](https://github.com/DavidBR-SW), [Michael Ledin](https://github.com/mxl), [HyunSeob Lee](https://github.com/hyunseob), [Pierre Tchuente](https://github.com/PierreTchuente), [Piotr Błażejewicz](https://github.com/peterblazejewicz), and [Sebastian Beltran](https://github.com/bjohansebas).
@@ -0,0 +1,8 @@
var $2599cf0c4ab37f59$exports = {};
$2599cf0c4ab37f59$exports = {
"dismiss": `Descartar`
};
export {$2599cf0c4ab37f59$exports as default};
//# sourceMappingURL=pt-BR.module.js.map
@@ -0,0 +1,4 @@
function _await_value(value) {
this.wrapped = value;
}
export { _await_value as _ };
@@ -0,0 +1,6 @@
import type { RefObject } from 'react';
type TargetValue<T> = T | undefined | null;
type TargetType = HTMLElement | Element | Window | Document;
export type BasicTarget<T extends TargetType = Element> = (() => TargetValue<T>) | TargetValue<T> | RefObject<TargetValue<T>>;
export declare function getTargetElement<T extends TargetType>(target: BasicTarget<T>, defaultElement?: T): TargetValue<T>;
export {};
@@ -0,0 +1,74 @@
import SetCache from './_SetCache.js';
import arrayIncludes from './_arrayIncludes.js';
import arrayIncludesWith from './_arrayIncludesWith.js';
import arrayMap from './_arrayMap.js';
import baseUnary from './_baseUnary.js';
import cacheHas from './_cacheHas.js';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMin = Math.min;
/**
* The base implementation of methods like `_.intersection`, without support
* for iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of shared values.
*/
function baseIntersection(arrays, iteratee, comparator) {
var includes = comparator ? arrayIncludesWith : arrayIncludes,
length = arrays[0].length,
othLength = arrays.length,
othIndex = othLength,
caches = Array(othLength),
maxLength = Infinity,
result = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee) {
array = arrayMap(array, baseUnary(iteratee));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
? new SetCache(othIndex && array)
: undefined;
}
array = arrays[0];
var index = -1,
seen = caches[0];
outer:
while (++index < length && result.length < maxLength) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (!(seen
? cacheHas(seen, computed)
: includes(result, computed, comparator)
)) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache
? cacheHas(cache, computed)
: includes(arrays[othIndex], computed, comparator))
) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
export default baseIntersection;
@@ -0,0 +1 @@
{"version":3,"names":["_nonIterableRest","TypeError"],"sources":["../../src/helpers/nonIterableRest.js"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _nonIterableRest() {\n throw new TypeError(\n \"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\",\n );\n}\n"],"mappings":";;;;;;AAEe,SAASA,gBAAgBA,CAAA,EAAG;EACzC,MAAM,IAAIC,SAAS,CACjB,2IACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1 @@
{"name":"@peculiar/asn1-x509","version":"2.6.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532103110,"integrity":"sha512-Evth0LLVYDIRr374ROJLOt4v8lC/TRqIWQSNjS9p9ABt7CpL5rMaQdOy+jIHXadMYop0CYCo3W5Bqzsfgn03Wg==","mode":420,"size":1057},"build/cjs/algorithm_identifier.js":{"checkedAt":1794532103110,"integrity":"sha512-4laXpcwj7+HPicxJAkxqfgAD1n2aXyU0npPLUAo4iNh3FOeaWgRl4mmYB80pNgAEbvMDU9UcdvBBl58/LfEVrQ==","mode":420,"size":1117},"build/es2015/algorithm_identifier.js":{"checkedAt":1794532103110,"integrity":"sha512-xfXW9qAcunyed2QO3ANguxBVJy9F3ESa+dMZQA4vN4svtOHS0Tno/6oQ/F6htKnouUNRI7MbKz9ugAz1QXCRyw==","mode":420,"size":885},"build/cjs/attribute.js":{"checkedAt":1794532103110,"integrity":"sha512-KgW5k784RP6x86Em8yR4XlzMkW5Gs3exl42OtcPfSiJVtU78m/vYa8H9FRBXSU3dPkXfXOvvlHUFfQxKjDE+0w==","mode":420,"size":672},"build/es2015/attribute.js":{"checkedAt":1794532103110,"integrity":"sha512-bwIZLVq9Z/G9pRkWoShbIU6WShSXM5CVkQACuVJpvo4E9mQtY593EmQB5uQCoU3sfX+AyJbyJQVkKGaY/uamLA==","mode":420,"size":470},"build/cjs/extensions/authority_information_access.js":{"checkedAt":1794532103110,"integrity":"sha512-wEUfZb/TXRHUxDt0QG3gg8rSHOcKokdjFYLKsMJ0sdcqdi77SRXdCJOfJ3N0N4ndNWmqQIqRUstap0ngpyD4Jw==","mode":420,"size":1626},"build/es2015/extensions/authority_information_access.js":{"checkedAt":1794532103110,"integrity":"sha512-J+QhnTom6Thu0VvgTh7MTvRYv/jguy4aCiXNi6PyZzK1Z5SQjvSN+iCFipndg0yk8kqGryF1Er3CJDA8uOI5aQ==","mode":420,"size":1193},"build/cjs/extensions/authority_key_identifier.js":{"checkedAt":1794532103111,"integrity":"sha512-XEU89xmohWBIVHFtA2iXRVTUoKhGBZm8MUWGu9zkkM0vu85sorpSzGbr6iIoLsQ4xG8nj6CY0MmpKUojEXBVPA==","mode":420,"size":1485},"build/es2015/extensions/authority_key_identifier.js":{"checkedAt":1794532103111,"integrity":"sha512-RYuXYnlMzGS2LGKRSkvYHkN/WTkFWMyAY2xhl6MRY3UQY2Yt93ml3IRqY9aWUWUd2aEXW3HOPxr/8WKeXDMOXw==","mode":420,"size":1103},"build/cjs/extensions/basic_constraints.js":{"checkedAt":1794532103111,"integrity":"sha512-sshj4XjrHpnPnRkBYTWv3AT5w7oXIstC8z/gcHQ7db9qgSh9Rrol781nT1uXUca4AjAocstmL49L+3mF4sFVWA==","mode":420,"size":878},"build/es2015/extensions/basic_constraints.js":{"checkedAt":1794532103111,"integrity":"sha512-u64j24eDbN18BpL4UqxLhwexghCoOCyNufGz5J9lgimjm0Raf0CJ3WVnUZ1KPSf3e9TkACnZV+VLS1rSwYtOzg==","mode":420,"size":590},"build/cjs/extensions/certificate_issuer.js":{"checkedAt":1794532103111,"integrity":"sha512-5vDdB7KTbBMVao9tcaPPA/ME96kogufJAxEenaWl39oQMrawewsXEczZBwAY9IYf7/eAON6aGKZ2hi2OtRmysw==","mode":420,"size":920},"build/es2015/extensions/certificate_issuer.js":{"checkedAt":1794532103111,"integrity":"sha512-irKm29+ID1Nh55ltRNkAvSToMBI1I08TxflGyYt+p17/I3L2rBGsz9o9zMwgsAP/U1mLJOInjNyyzKcqVcTszw==","mode":420,"size":644},"build/cjs/certificate_list.js":{"checkedAt":1794532103111,"integrity":"sha512-1oMjMIFa7z9wyQI7ZQQa/qNuDjDlrQH+V9612a9FdqiNE8JrFLbnBdIIWrXq40wn3v6IwQPs7HzZi6mkpx+xlg==","mode":420,"size":1128},"build/es2015/certificate_list.js":{"checkedAt":1794532103112,"integrity":"sha512-9qNvVrXl67Q5M/C8GJSX/r0r06/aNB10MSXe1Hht7UDCtiaQmeNGgT0HywJF6QclbSeMNQIe7VbrO7PhEY3/NQ==","mode":420,"size":808},"build/cjs/extensions/certificate_policies.js":{"checkedAt":1794532103112,"integrity":"sha512-D+rn7p1KjWnOGGdoBPwQVotBV6uS3tbm1ZcOoVmEgOIT6WCArucJLbEDOFW7P7uUQtbn+PO+vrK+qNd9KIn/hw==","mode":420,"size":4803},"build/es2015/extensions/certificate_policies.js":{"checkedAt":1794532103112,"integrity":"sha512-J8GxTRLgUbCbya0CPPjvnqCiYSktZGOzk8VtkxIccoqkKCXQKNfNVZ62hlUzowxo+Y82vI+zrR05CIgDLqzILg==","mode":420,"size":3568},"build/cjs/certificate.js":{"checkedAt":1794532103112,"integrity":"sha512-gQfYbR2wwfSP/1Ty1NzkOE7xIkohQtrp3M+ZCV87LxdSnqpZsUFl60nSKgViEYyonc/4oM9q6uY8K4OP0EtE4w==","mode":420,"size":1130},"build/es2015/certificate.js":{"checkedAt":1794532103112,"integrity":"sha512-/xeD1byzsw+icya90A29FEA+vEvsijNmsE3Gv6ZJvIFslXRUG/67sgvTpga3ywuFk+HcpGZP6wM88YmtkhxOqQ==","mode":420,"size":819},"build/cjs/extensions/crl_delta_indicator.js":{"checkedAt":1794532103113,"integrity":"sha512-DFe2TJWxwPuI4seOe0iee6rCvZne8PcY9Pya5oIBE2tmEw4c7g4Kge9GD0tihDLDcXrRTvvk5BlbYReCFUdBuQ==","mode":420,"size":683},"build/es2015/extensions/crl_delta_indicator.js":{"checkedAt":1794532103113,"integrity":"sha512-pPqbimYV23B6Iy0FXIsoC3xiXEyCMcL8JVuU3UfMjQHMPCpNlxZQHKo+BuVNERe5V7u0axzLGZwucANrQAegrA==","mode":420,"size":422},"build/cjs/extensions/crl_distribution_points.js":{"checkedAt":1794532103113,"integrity":"sha512-AqKE91Mq725KQgce4z3SVk7J9mxk91lxi/fzdDv9d6xKtC/KqGP5ENCtCKHE3bzbf1Vy+qKISR2CHx8KYTpadQ==","mode":420,"size":4485},"build/es2015/extensions/crl_distribution_points.js":{"checkedAt":1794532103113,"integrity":"sha512-392yRUW6tNNKsGkHm8zz0vpGBqBWag3nvvabVDAQLpbV9ujA9uJ6uufxYtczPeug5bpEMqCYB9GhCxpv3Gms6w==","mode":420,"size":3791},"build/cjs/extensions/crl_freshest.js":{"checkedAt":1794532103113,"integrity":"sha512-yHOT+MhA1xaq4A2HOV7aMoO+A4jlIRPwXK7CaeImPFfWHtTipG2ef3Igp7lTN3PC0KICF48qgf4rbihDugMVDg==","mode":420,"size":929},"build/es2015/extensions/crl_freshest.js":{"checkedAt":1794532103113,"Line truncated
@@ -0,0 +1,55 @@
{
"name": "xtend",
"version": "4.0.2",
"description": "extend like a boss",
"keywords": [
"extend",
"merge",
"options",
"opts",
"object",
"array"
],
"author": "Raynos <raynos2@gmail.com>",
"repository": "git://github.com/Raynos/xtend.git",
"main": "immutable",
"scripts": {
"test": "node test"
},
"dependencies": {},
"devDependencies": {
"tape": "~1.1.0"
},
"homepage": "https://github.com/Raynos/xtend",
"contributors": [
{
"name": "Jake Verbaten"
},
{
"name": "Matt Esch"
}
],
"bugs": {
"url": "https://github.com/Raynos/xtend/issues",
"email": "raynos2@gmail.com"
},
"license": "MIT",
"testling": {
"files": "test.js",
"browsers": [
"ie/7..latest",
"firefox/16..latest",
"firefox/nightly",
"chrome/22..latest",
"chrome/canary",
"opera/12..latest",
"opera/next",
"safari/5.1..latest",
"ipad/6.0..latest",
"iphone/6.0..latest"
]
},
"engines": {
"node": ">=0.4"
}
}
@@ -0,0 +1,126 @@
import {
mapPropsVariants
} from "./chunk-YFAKJTDR.mjs";
// src/extend-variants.js
import * as React from "react";
import { tv, cn } from "@heroui/theme";
function getSlots(variants) {
return variants ? Object.values(variants).flatMap(Object.values).reduce((acc, slot) => {
if (typeof slot === "object" && slot !== null && !(slot instanceof String)) {
Object.keys(slot).forEach((key) => {
if (!acc.hasOwnProperty(key)) {
acc[key] = "";
}
});
}
return acc;
}, {}) : {};
}
function getClassNamesWithProps({
props = {},
variants,
slots,
defaultVariants,
compoundVariants,
hasSlots,
opts
}) {
var _a, _b, _c;
const keys = [];
if (defaultVariants && typeof defaultVariants === "object") {
for (const key in defaultVariants) {
const value = defaultVariants[key];
const propValue = props == null ? void 0 : props[key];
if (propValue && propValue !== value) {
keys.push(key);
}
}
}
const customTv = tv(
{
variants,
defaultVariants: defaultVariants && typeof defaultVariants === "object" ? (
// Do not apply default variants when the props variant is different
Object.keys(defaultVariants).filter((k) => !keys.includes(k)).reduce((o, k) => {
o[k] = defaultVariants[k];
return o;
}, [])
) : defaultVariants,
compoundVariants,
...hasSlots && { slots }
},
{
twMerge: (_a = opts.twMerge) != null ? _a : true,
twMergeConfig: (_b = opts.twMergeConfig) != null ? _b : {}
}
);
const [baseProps, variantProps] = mapPropsVariants(props, customTv.variantKeys, false);
const newProps = {
...defaultVariants,
...baseProps,
className: cn(defaultVariants == null ? void 0 : defaultVariants.className, baseProps.className)
};
let classNames = {};
const result = customTv(variantProps);
if (!hasSlots) {
newProps.className = cn(result, newProps.className);
} else {
Object.entries(result).forEach(([key, value]) => {
const slotResult = value();
if (typeof slotResult === "string") {
classNames[key] = slotResult;
}
});
Object.entries((_c = props.classNames) != null ? _c : {}).forEach(([key, value]) => {
classNames[key] = cn(classNames[key], value);
});
}
if (Object.keys(classNames).length !== 0) {
newProps.classNames = classNames;
}
return newProps;
}
function extendVariants(BaseComponent, styles = {}, opts = {}) {
const { variants, defaultVariants, compoundVariants, slots: directSlots } = styles || {};
const inferredSlots = getSlots(variants);
const slots = directSlots ? { ...inferredSlots, ...directSlots } : inferredSlots;
const hasSlots = typeof slots === "object" && Object.keys(slots).length !== 0;
const ForwardedComponent = React.forwardRef((originalProps = {}, ref) => {
const newProps = React.useMemo(
() => getClassNamesWithProps(
{
slots,
variants,
compoundVariants,
props: originalProps,
defaultVariants,
hasSlots,
opts
},
[originalProps]
)
);
return React.createElement(BaseComponent, { ...originalProps, ...newProps, ref });
});
if (BaseComponent.getCollectionNode) {
ForwardedComponent.getCollectionNode = (itemProps) => {
const newProps = getClassNamesWithProps({
slots,
variants,
compoundVariants,
props: itemProps,
defaultVariants,
hasSlots,
opts
});
return BaseComponent.getCollectionNode({ ...itemProps, ...newProps });
};
}
ForwardedComponent.displayName = `Extended(${BaseComponent.displayName || BaseComponent.name})`;
return ForwardedComponent;
}
export {
extendVariants
};
@@ -0,0 +1,58 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Const = Const;
const index_1 = require("../any/index");
const index_2 = require("../bigint/index");
const index_3 = require("../date/index");
const index_4 = require("../function/index");
const index_5 = require("../literal/index");
const index_6 = require("../null/index");
const index_7 = require("../object/index");
const index_8 = require("../symbol/index");
const index_9 = require("../tuple/index");
const index_10 = require("../readonly/index");
const index_11 = require("../undefined/index");
const index_12 = require("../uint8array/index");
const index_13 = require("../unknown/index");
const index_14 = require("../create/index");
// ------------------------------------------------------------------
// ValueGuard
// ------------------------------------------------------------------
const value_1 = require("../guard/value");
// prettier-ignore
function FromArray(T) {
return T.map(L => FromValue(L, false));
}
// prettier-ignore
function FromProperties(value) {
const Acc = {};
for (const K of globalThis.Object.getOwnPropertyNames(value))
Acc[K] = (0, index_10.Readonly)(FromValue(value[K], false));
return Acc;
}
function ConditionalReadonly(T, root) {
return (root === true ? T : (0, index_10.Readonly)(T));
}
// prettier-ignore
function FromValue(value, root) {
return ((0, value_1.IsAsyncIterator)(value) ? ConditionalReadonly((0, index_1.Any)(), root) :
(0, value_1.IsIterator)(value) ? ConditionalReadonly((0, index_1.Any)(), root) :
(0, value_1.IsArray)(value) ? (0, index_10.Readonly)((0, index_9.Tuple)(FromArray(value))) :
(0, value_1.IsUint8Array)(value) ? (0, index_12.Uint8Array)() :
(0, value_1.IsDate)(value) ? (0, index_3.Date)() :
(0, value_1.IsObject)(value) ? ConditionalReadonly((0, index_7.Object)(FromProperties(value)), root) :
(0, value_1.IsFunction)(value) ? ConditionalReadonly((0, index_4.Function)([], (0, index_13.Unknown)()), root) :
(0, value_1.IsUndefined)(value) ? (0, index_11.Undefined)() :
(0, value_1.IsNull)(value) ? (0, index_6.Null)() :
(0, value_1.IsSymbol)(value) ? (0, index_8.Symbol)() :
(0, value_1.IsBigInt)(value) ? (0, index_2.BigInt)() :
(0, value_1.IsNumber)(value) ? (0, index_5.Literal)(value) :
(0, value_1.IsBoolean)(value) ? (0, index_5.Literal)(value) :
(0, value_1.IsString)(value) ? (0, index_5.Literal)(value) :
(0, index_7.Object)({}));
}
/** `[JavaScript]` Creates a readonly const type from the given value. */
function Const(T, options) {
return (0, index_14.CreateType)(FromValue(T, true), options);
}
@@ -0,0 +1,143 @@
/**
* @import {
* Construct,
* Exiter,
* State,
* TokenizeContext,
* Tokenizer
* } from 'micromark-util-types'
*/
import { factorySpace } from 'micromark-factory-space';
import { markdownSpace } from 'micromark-util-character';
/** @type {Construct} */
export const blockQuote = {
continuation: {
tokenize: tokenizeBlockQuoteContinuation
},
exit,
name: 'blockQuote',
tokenize: tokenizeBlockQuoteStart
};
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeBlockQuoteStart(effects, ok, nok) {
const self = this;
return start;
/**
* Start of block quote.
*
* ```markdown
* > | > a
* ^
* ```
*
* @type {State}
*/
function start(code) {
if (code === 62) {
const state = self.containerState;
if (!state.open) {
effects.enter("blockQuote", {
_container: true
});
state.open = true;
}
effects.enter("blockQuotePrefix");
effects.enter("blockQuoteMarker");
effects.consume(code);
effects.exit("blockQuoteMarker");
return after;
}
return nok(code);
}
/**
* After `>`, before optional whitespace.
*
* ```markdown
* > | > a
* ^
* ```
*
* @type {State}
*/
function after(code) {
if (markdownSpace(code)) {
effects.enter("blockQuotePrefixWhitespace");
effects.consume(code);
effects.exit("blockQuotePrefixWhitespace");
effects.exit("blockQuotePrefix");
return ok;
}
effects.exit("blockQuotePrefix");
return ok(code);
}
}
/**
* Start of block quote continuation.
*
* ```markdown
* | > a
* > | > b
* ^
* ```
*
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeBlockQuoteContinuation(effects, ok, nok) {
const self = this;
return contStart;
/**
* Start of block quote continuation.
*
* Also used to parse the first block quote opening.
*
* ```markdown
* | > a
* > | > b
* ^
* ```
*
* @type {State}
*/
function contStart(code) {
if (markdownSpace(code)) {
// Always populated by defaults.
return factorySpace(effects, contBefore, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);
}
return contBefore(code);
}
/**
* At `>`, after optional whitespace.
*
* Also used to parse the first block quote opening.
*
* ```markdown
* | > a
* > | > b
* ^
* ```
*
* @type {State}
*/
function contBefore(code) {
return effects.attempt(blockQuote, ok, nok)(code);
}
}
/** @type {Exiter} */
function exit(effects) {
effects.exit("blockQuote");
}
@@ -0,0 +1,732 @@
import * as core from "../core/index.js";
import { util } from "../core/index.js";
import * as parse from "./parse.js";
export const ZodMiniType = /*@__PURE__*/ core.$constructor("ZodMiniType", (inst, def) => {
if (!inst._zod)
throw new Error("Uninitialized schema in ZodMiniType.");
core.$ZodType.init(inst, def);
inst.def = def;
inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
inst.check = (...checks) => {
return inst.clone({
...def,
checks: [
...(def.checks ?? []),
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
],
}
// { parent: true }
);
};
inst.clone = (_def, params) => core.clone(inst, _def, params);
inst.brand = () => inst;
inst.register = ((reg, meta) => {
reg.add(inst, meta);
return inst;
});
});
export const ZodMiniString = /*@__PURE__*/ core.$constructor("ZodMiniString", (inst, def) => {
core.$ZodString.init(inst, def);
ZodMiniType.init(inst, def);
});
export function string(params) {
return core._string(ZodMiniString, params);
}
export const ZodMiniStringFormat = /*@__PURE__*/ core.$constructor("ZodMiniStringFormat", (inst, def) => {
core.$ZodStringFormat.init(inst, def);
ZodMiniString.init(inst, def);
});
export const ZodMiniEmail = /*@__PURE__*/ core.$constructor("ZodMiniEmail", (inst, def) => {
core.$ZodEmail.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function email(params) {
return core._email(ZodMiniEmail, params);
}
export const ZodMiniGUID = /*@__PURE__*/ core.$constructor("ZodMiniGUID", (inst, def) => {
core.$ZodGUID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function guid(params) {
return core._guid(ZodMiniGUID, params);
}
export const ZodMiniUUID = /*@__PURE__*/ core.$constructor("ZodMiniUUID", (inst, def) => {
core.$ZodUUID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function uuid(params) {
return core._uuid(ZodMiniUUID, params);
}
export function uuidv4(params) {
return core._uuidv4(ZodMiniUUID, params);
}
// ZodMiniUUIDv6
export function uuidv6(params) {
return core._uuidv6(ZodMiniUUID, params);
}
// ZodMiniUUIDv7
export function uuidv7(params) {
return core._uuidv7(ZodMiniUUID, params);
}
export const ZodMiniURL = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => {
core.$ZodURL.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function url(params) {
return core._url(ZodMiniURL, params);
}
export const ZodMiniEmoji = /*@__PURE__*/ core.$constructor("ZodMiniEmoji", (inst, def) => {
core.$ZodEmoji.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function emoji(params) {
return core._emoji(ZodMiniEmoji, params);
}
export const ZodMiniNanoID = /*@__PURE__*/ core.$constructor("ZodMiniNanoID", (inst, def) => {
core.$ZodNanoID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function nanoid(params) {
return core._nanoid(ZodMiniNanoID, params);
}
export const ZodMiniCUID = /*@__PURE__*/ core.$constructor("ZodMiniCUID", (inst, def) => {
core.$ZodCUID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function cuid(params) {
return core._cuid(ZodMiniCUID, params);
}
export const ZodMiniCUID2 = /*@__PURE__*/ core.$constructor("ZodMiniCUID2", (inst, def) => {
core.$ZodCUID2.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function cuid2(params) {
return core._cuid2(ZodMiniCUID2, params);
}
export const ZodMiniULID = /*@__PURE__*/ core.$constructor("ZodMiniULID", (inst, def) => {
core.$ZodULID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function ulid(params) {
return core._ulid(ZodMiniULID, params);
}
export const ZodMiniXID = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => {
core.$ZodXID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function xid(params) {
return core._xid(ZodMiniXID, params);
}
export const ZodMiniKSUID = /*@__PURE__*/ core.$constructor("ZodMiniKSUID", (inst, def) => {
core.$ZodKSUID.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function ksuid(params) {
return core._ksuid(ZodMiniKSUID, params);
}
export const ZodMiniIPv4 = /*@__PURE__*/ core.$constructor("ZodMiniIPv4", (inst, def) => {
core.$ZodIPv4.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function ipv4(params) {
return core._ipv4(ZodMiniIPv4, params);
}
export const ZodMiniIPv6 = /*@__PURE__*/ core.$constructor("ZodMiniIPv6", (inst, def) => {
core.$ZodIPv6.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function ipv6(params) {
return core._ipv6(ZodMiniIPv6, params);
}
export const ZodMiniCIDRv4 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv4", (inst, def) => {
core.$ZodCIDRv4.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function cidrv4(params) {
return core._cidrv4(ZodMiniCIDRv4, params);
}
export const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv6", (inst, def) => {
core.$ZodCIDRv6.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function cidrv6(params) {
return core._cidrv6(ZodMiniCIDRv6, params);
}
export const ZodMiniBase64 = /*@__PURE__*/ core.$constructor("ZodMiniBase64", (inst, def) => {
core.$ZodBase64.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function base64(params) {
return core._base64(ZodMiniBase64, params);
}
export const ZodMiniBase64URL = /*@__PURE__*/ core.$constructor("ZodMiniBase64URL", (inst, def) => {
core.$ZodBase64URL.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function base64url(params) {
return core._base64url(ZodMiniBase64URL, params);
}
export const ZodMiniE164 = /*@__PURE__*/ core.$constructor("ZodMiniE164", (inst, def) => {
core.$ZodE164.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function e164(params) {
return core._e164(ZodMiniE164, params);
}
export const ZodMiniJWT = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
core.$ZodJWT.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function jwt(params) {
return core._jwt(ZodMiniJWT, params);
}
export const ZodMiniCustomStringFormat = /*@__PURE__*/ core.$constructor("ZodMiniCustomStringFormat", (inst, def) => {
core.$ZodCustomStringFormat.init(inst, def);
ZodMiniStringFormat.init(inst, def);
});
export function stringFormat(format, fnOrRegex, _params = {}) {
return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params);
}
export const ZodMiniNumber = /*@__PURE__*/ core.$constructor("ZodMiniNumber", (inst, def) => {
core.$ZodNumber.init(inst, def);
ZodMiniType.init(inst, def);
});
export function number(params) {
return core._number(ZodMiniNumber, params);
}
export const ZodMiniNumberFormat = /*@__PURE__*/ core.$constructor("ZodMiniNumberFormat", (inst, def) => {
core.$ZodNumberFormat.init(inst, def);
ZodMiniNumber.init(inst, def);
});
// int
export function int(params) {
return core._int(ZodMiniNumberFormat, params);
}
// float32
export function float32(params) {
return core._float32(ZodMiniNumberFormat, params);
}
// float64
export function float64(params) {
return core._float64(ZodMiniNumberFormat, params);
}
// int32
export function int32(params) {
return core._int32(ZodMiniNumberFormat, params);
}
// uint32
export function uint32(params) {
return core._uint32(ZodMiniNumberFormat, params);
}
export const ZodMiniBoolean = /*@__PURE__*/ core.$constructor("ZodMiniBoolean", (inst, def) => {
core.$ZodBoolean.init(inst, def);
ZodMiniType.init(inst, def);
});
export function boolean(params) {
return core._boolean(ZodMiniBoolean, params);
}
export const ZodMiniBigInt = /*@__PURE__*/ core.$constructor("ZodMiniBigInt", (inst, def) => {
core.$ZodBigInt.init(inst, def);
ZodMiniType.init(inst, def);
});
export function bigint(params) {
return core._bigint(ZodMiniBigInt, params);
}
export const ZodMiniBigIntFormat = /*@__PURE__*/ core.$constructor("ZodMiniBigIntFormat", (inst, def) => {
core.$ZodBigIntFormat.init(inst, def);
ZodMiniBigInt.init(inst, def);
});
// int64
export function int64(params) {
return core._int64(ZodMiniBigIntFormat, params);
}
// uint64
export function uint64(params) {
return core._uint64(ZodMiniBigIntFormat, params);
}
export const ZodMiniSymbol = /*@__PURE__*/ core.$constructor("ZodMiniSymbol", (inst, def) => {
core.$ZodSymbol.init(inst, def);
ZodMiniType.init(inst, def);
});
export function symbol(params) {
return core._symbol(ZodMiniSymbol, params);
}
export const ZodMiniUndefined = /*@__PURE__*/ core.$constructor("ZodMiniUndefined", (inst, def) => {
core.$ZodUndefined.init(inst, def);
ZodMiniType.init(inst, def);
});
function _undefined(params) {
return core._undefined(ZodMiniUndefined, params);
}
export { _undefined as undefined };
export const ZodMiniNull = /*@__PURE__*/ core.$constructor("ZodMiniNull", (inst, def) => {
core.$ZodNull.init(inst, def);
ZodMiniType.init(inst, def);
});
function _null(params) {
return core._null(ZodMiniNull, params);
}
export { _null as null };
export const ZodMiniAny = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => {
core.$ZodAny.init(inst, def);
ZodMiniType.init(inst, def);
});
export function any() {
return core._any(ZodMiniAny);
}
export const ZodMiniUnknown = /*@__PURE__*/ core.$constructor("ZodMiniUnknown", (inst, def) => {
core.$ZodUnknown.init(inst, def);
ZodMiniType.init(inst, def);
});
export function unknown() {
return core._unknown(ZodMiniUnknown);
}
export const ZodMiniNever = /*@__PURE__*/ core.$constructor("ZodMiniNever", (inst, def) => {
core.$ZodNever.init(inst, def);
ZodMiniType.init(inst, def);
});
export function never(params) {
return core._never(ZodMiniNever, params);
}
export const ZodMiniVoid = /*@__PURE__*/ core.$constructor("ZodMiniVoid", (inst, def) => {
core.$ZodVoid.init(inst, def);
ZodMiniType.init(inst, def);
});
function _void(params) {
return core._void(ZodMiniVoid, params);
}
export { _void as void };
export const ZodMiniDate = /*@__PURE__*/ core.$constructor("ZodMiniDate", (inst, def) => {
core.$ZodDate.init(inst, def);
ZodMiniType.init(inst, def);
});
export function date(params) {
return core._date(ZodMiniDate, params);
}
export const ZodMiniArray = /*@__PURE__*/ core.$constructor("ZodMiniArray", (inst, def) => {
core.$ZodArray.init(inst, def);
ZodMiniType.init(inst, def);
});
export function array(element, params) {
return new ZodMiniArray({
type: "array",
element: element,
...util.normalizeParams(params),
});
}
// .keyof
export function keyof(schema) {
const shape = schema._zod.def.shape;
return literal(Object.keys(shape));
}
export const ZodMiniObject = /*@__PURE__*/ core.$constructor("ZodMiniObject", (inst, def) => {
core.$ZodObject.init(inst, def);
ZodMiniType.init(inst, def);
util.defineLazy(inst, "shape", () => def.shape);
});
export function object(shape, params) {
const def = {
type: "object",
get shape() {
util.assignProp(this, "shape", { ...shape });
return this.shape;
},
...util.normalizeParams(params),
};
return new ZodMiniObject(def);
}
// strictObject
export function strictObject(shape, params) {
return new ZodMiniObject({
type: "object",
// shape: shape as core.$ZodLooseShape,
get shape() {
util.assignProp(this, "shape", { ...shape });
return this.shape;
},
catchall: never(),
...util.normalizeParams(params),
});
}
// looseObject
export function looseObject(shape, params) {
return new ZodMiniObject({
type: "object",
// shape: shape as core.$ZodLooseShape,
get shape() {
util.assignProp(this, "shape", { ...shape });
return this.shape;
},
// get optional() {
// return util.optionalKeys(shape);
// },
catchall: unknown(),
...util.normalizeParams(params),
});
}
// object methods
export function extend(schema, shape) {
return util.extend(schema, shape);
}
export function merge(schema, shape) {
return util.extend(schema, shape);
}
export function pick(schema, mask) {
return util.pick(schema, mask);
}
// .omit
export function omit(schema, mask) {
return util.omit(schema, mask);
}
export function partial(schema, mask) {
return util.partial(ZodMiniOptional, schema, mask);
}
export function required(schema, mask) {
return util.required(ZodMiniNonOptional, schema, mask);
}
export function catchall(inst, catchall) {
return inst.clone({ ...inst._zod.def, catchall: catchall });
}
export const ZodMiniUnion = /*@__PURE__*/ core.$constructor("ZodMiniUnion", (inst, def) => {
core.$ZodUnion.init(inst, def);
ZodMiniType.init(inst, def);
});
export function union(options, params) {
return new ZodMiniUnion({
type: "union",
options: options,
...util.normalizeParams(params),
});
}
export const ZodMiniDiscriminatedUnion = /*@__PURE__*/ core.$constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
core.$ZodDiscriminatedUnion.init(inst, def);
ZodMiniType.init(inst, def);
});
export function discriminatedUnion(discriminator, options, params) {
return new ZodMiniDiscriminatedUnion({
type: "union",
options,
discriminator,
...util.normalizeParams(params),
});
}
export const ZodMiniIntersection = /*@__PURE__*/ core.$constructor("ZodMiniIntersection", (inst, def) => {
core.$ZodIntersection.init(inst, def);
ZodMiniType.init(inst, def);
});
export function intersection(left, right) {
return new ZodMiniIntersection({
type: "intersection",
left: left,
right: right,
});
}
export const ZodMiniTuple = /*@__PURE__*/ core.$constructor("ZodMiniTuple", (inst, def) => {
core.$ZodTuple.init(inst, def);
ZodMiniType.init(inst, def);
});
export function tuple(items, _paramsOrRest, _params) {
const hasRest = _paramsOrRest instanceof core.$ZodType;
const params = hasRest ? _params : _paramsOrRest;
const rest = hasRest ? _paramsOrRest : null;
return new ZodMiniTuple({
type: "tuple",
items: items,
rest,
...util.normalizeParams(params),
});
}
export const ZodMiniRecord = /*@__PURE__*/ core.$constructor("ZodMiniRecord", (inst, def) => {
core.$ZodRecord.init(inst, def);
ZodMiniType.init(inst, def);
});
export function record(keyType, valueType, params) {
return new ZodMiniRecord({
type: "record",
keyType,
valueType: valueType,
...util.normalizeParams(params),
});
}
export function partialRecord(keyType, valueType, params) {
return new ZodMiniRecord({
type: "record",
keyType: union([keyType, never()]),
valueType: valueType,
...util.normalizeParams(params),
});
}
export const ZodMiniMap = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
core.$ZodMap.init(inst, def);
ZodMiniType.init(inst, def);
});
export function map(keyType, valueType, params) {
return new ZodMiniMap({
type: "map",
keyType: keyType,
valueType: valueType,
...util.normalizeParams(params),
});
}
export const ZodMiniSet = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
core.$ZodSet.init(inst, def);
ZodMiniType.init(inst, def);
});
export function set(valueType, params) {
return new ZodMiniSet({
type: "set",
valueType: valueType,
...util.normalizeParams(params),
});
}
export const ZodMiniEnum = /*@__PURE__*/ core.$constructor("ZodMiniEnum", (inst, def) => {
core.$ZodEnum.init(inst, def);
ZodMiniType.init(inst, def);
});
function _enum(values, params) {
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
return new ZodMiniEnum({
type: "enum",
entries,
...util.normalizeParams(params),
});
}
export { _enum as enum };
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
*
* ```ts
* enum Colors { red, green, blue }
* z.enum(Colors);
* ```
*/
export function nativeEnum(entries, params) {
return new ZodMiniEnum({
type: "enum",
entries,
...util.normalizeParams(params),
});
}
export const ZodMiniLiteral = /*@__PURE__*/ core.$constructor("ZodMiniLiteral", (inst, def) => {
core.$ZodLiteral.init(inst, def);
ZodMiniType.init(inst, def);
});
export function literal(value, params) {
return new ZodMiniLiteral({
type: "literal",
values: Array.isArray(value) ? value : [value],
...util.normalizeParams(params),
});
}
export const ZodMiniFile = /*@__PURE__*/ core.$constructor("ZodMiniFile", (inst, def) => {
core.$ZodFile.init(inst, def);
ZodMiniType.init(inst, def);
});
export function file(params) {
return core._file(ZodMiniFile, params);
}
export const ZodMiniTransform = /*@__PURE__*/ core.$constructor("ZodMiniTransform", (inst, def) => {
core.$ZodTransform.init(inst, def);
ZodMiniType.init(inst, def);
});
export function transform(fn) {
return new ZodMiniTransform({
type: "transform",
transform: fn,
});
}
export const ZodMiniOptional = /*@__PURE__*/ core.$constructor("ZodMiniOptional", (inst, def) => {
core.$ZodOptional.init(inst, def);
ZodMiniType.init(inst, def);
});
export function optional(innerType) {
return new ZodMiniOptional({
type: "optional",
innerType: innerType,
});
}
export const ZodMiniNullable = /*@__PURE__*/ core.$constructor("ZodMiniNullable", (inst, def) => {
core.$ZodNullable.init(inst, def);
ZodMiniType.init(inst, def);
});
export function nullable(innerType) {
return new ZodMiniNullable({
type: "nullable",
innerType: innerType,
});
}
// nullish
export function nullish(innerType) {
return optional(nullable(innerType));
}
export const ZodMiniDefault = /*@__PURE__*/ core.$constructor("ZodMiniDefault", (inst, def) => {
core.$ZodDefault.init(inst, def);
ZodMiniType.init(inst, def);
});
export function _default(innerType, defaultValue) {
return new ZodMiniDefault({
type: "default",
innerType: innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
},
});
}
export const ZodMiniPrefault = /*@__PURE__*/ core.$constructor("ZodMiniPrefault", (inst, def) => {
core.$ZodPrefault.init(inst, def);
ZodMiniType.init(inst, def);
});
export function prefault(innerType, defaultValue) {
return new ZodMiniPrefault({
type: "prefault",
innerType: innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : defaultValue;
},
});
}
export const ZodMiniNonOptional = /*@__PURE__*/ core.$constructor("ZodMiniNonOptional", (inst, def) => {
core.$ZodNonOptional.init(inst, def);
ZodMiniType.init(inst, def);
});
export function nonoptional(innerType, params) {
return new ZodMiniNonOptional({
type: "nonoptional",
innerType: innerType,
...util.normalizeParams(params),
});
}
export const ZodMiniSuccess = /*@__PURE__*/ core.$constructor("ZodMiniSuccess", (inst, def) => {
core.$ZodSuccess.init(inst, def);
ZodMiniType.init(inst, def);
});
export function success(innerType) {
return new ZodMiniSuccess({
type: "success",
innerType: innerType,
});
}
export const ZodMiniCatch = /*@__PURE__*/ core.$constructor("ZodMiniCatch", (inst, def) => {
core.$ZodCatch.init(inst, def);
ZodMiniType.init(inst, def);
});
function _catch(innerType, catchValue) {
return new ZodMiniCatch({
type: "catch",
innerType: innerType,
catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
});
}
export { _catch as catch };
export const ZodMiniNaN = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => {
core.$ZodNaN.init(inst, def);
ZodMiniType.init(inst, def);
});
export function nan(params) {
return core._nan(ZodMiniNaN, params);
}
export const ZodMiniPipe = /*@__PURE__*/ core.$constructor("ZodMiniPipe", (inst, def) => {
core.$ZodPipe.init(inst, def);
ZodMiniType.init(inst, def);
});
export function pipe(in_, out) {
return new ZodMiniPipe({
type: "pipe",
in: in_,
out: out,
});
}
export const ZodMiniReadonly = /*@__PURE__*/ core.$constructor("ZodMiniReadonly", (inst, def) => {
core.$ZodReadonly.init(inst, def);
ZodMiniType.init(inst, def);
});
export function readonly(innerType) {
return new ZodMiniReadonly({
type: "readonly",
innerType: innerType,
});
}
export const ZodMiniTemplateLiteral = /*@__PURE__*/ core.$constructor("ZodMiniTemplateLiteral", (inst, def) => {
core.$ZodTemplateLiteral.init(inst, def);
ZodMiniType.init(inst, def);
});
export function templateLiteral(parts, params) {
return new ZodMiniTemplateLiteral({
type: "template_literal",
parts,
...util.normalizeParams(params),
});
}
export const ZodMiniLazy = /*@__PURE__*/ core.$constructor("ZodMiniLazy", (inst, def) => {
core.$ZodLazy.init(inst, def);
ZodMiniType.init(inst, def);
});
// export function lazy<T extends object>(getter: () => T): T {
// return util.createTransparentProxy<T>(getter);
// }
function _lazy(getter) {
return new ZodMiniLazy({
type: "lazy",
getter: getter,
});
}
export { _lazy as lazy };
export const ZodMiniPromise = /*@__PURE__*/ core.$constructor("ZodMiniPromise", (inst, def) => {
core.$ZodPromise.init(inst, def);
ZodMiniType.init(inst, def);
});
export function promise(innerType) {
return new ZodMiniPromise({
type: "promise",
innerType: innerType,
});
}
export const ZodMiniCustom = /*@__PURE__*/ core.$constructor("ZodMiniCustom", (inst, def) => {
core.$ZodCustom.init(inst, def);
ZodMiniType.init(inst, def);
});
// custom checks
export function check(fn, params) {
const ch = new core.$ZodCheck({
check: "custom",
...util.normalizeParams(params),
});
ch._zod.check = fn;
return ch;
}
// ZodCustom
// custom schema
export function custom(fn, _params) {
return core._custom(ZodMiniCustom, fn ?? (() => true), _params);
}
// refine
export function refine(fn, _params = {}) {
return core._refine(ZodMiniCustom, fn, _params);
}
// instanceof
class Class {
constructor(..._args) { }
}
function _instanceof(cls, params = {
error: `Input not instance of ${cls.name}`,
}) {
const inst = custom((data) => data instanceof cls, params);
inst._zod.bag.Class = cls;
return inst;
}
export { _instanceof as instanceof };
// stringbool
export const stringbool = (...args) => core._stringbool({
Pipe: ZodMiniPipe,
Boolean: ZodMiniBoolean,
String: ZodMiniString,
Transform: ZodMiniTransform,
}, ...args);
export function json() {
const jsonSchema = _lazy(() => {
return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
});
return jsonSchema;
}
@@ -0,0 +1,125 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string; verb: string }> = {
string: { unit: "אותיות", verb: "לכלול" },
file: { unit: "בייטים", verb: "לכלול" },
array: { unit: "פריטים", verb: "לכלול" },
set: { unit: "פריטים", verb: "לכלול" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const parsedType = (data: any): string => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "number";
}
case "object": {
if (Array.isArray(data)) {
return "array";
}
if (data === null) {
return "null";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "קלט",
email: "כתובת אימייל",
url: "כתובת רשת",
emoji: "אימוג'י",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "תאריך וזמן ISO",
date: "תאריך ISO",
time: "זמן ISO",
duration: "משך זמן ISO",
ipv4: "כתובת IPv4",
ipv6: "כתובת IPv6",
cidrv4: "טווח IPv4",
cidrv6: "טווח IPv6",
base64: "מחרוזת בבסיס 64",
base64url: "מחרוזת בבסיס 64 לכתובות רשת",
json_string: "מחרוזת JSON",
e164: "מספר E.164",
jwt: "JWT",
template_literal: "קלט",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `קלט לא תקין: צריך ${issue.expected}, התקבל ${parsedType(issue.input)}`;
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(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 ?? "value"} צריך להיות ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
return `גדול מדי: ${issue.origin ?? "value"} צריך להיות ${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 as errors.$ZodStringFormatIssues;
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 ? "ות" : ""} לא מזוה${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 `קלט לא תקין`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}
@@ -0,0 +1,10 @@
import {
useReactAriaAccordionItem
} from "./chunk-AHLWZTIP.mjs";
import {
useReactAriaAccordion
} from "./chunk-BHM6H4ZD.mjs";
export {
useReactAriaAccordion,
useReactAriaAccordionItem
};
@@ -0,0 +1,51 @@
'use strict';
var $TypeError = require('es-errors/type');
var GeneratorStart = require('./GeneratorStart');
var IsArray = require('./IsArray');
var IsCallable = require('./IsCallable');
var OrdinaryObjectCreate = require('./OrdinaryObjectCreate');
var every = require('../helpers/every');
var SLOT = require('internal-slot');
var safeConcat = require('safe-array-concat');
var isObject = require('es-object-atoms/isObject');
var isString = function isString(slot) {
return typeof slot === 'string';
};
// https://262.ecma-international.org/16.0/#sec-createiteratorfromclosure
module.exports = function CreateIteratorFromClosure(closure, generatorBrand, generatorPrototype) {
if (!IsCallable(closure)) {
throw new $TypeError('`closure` must be a function');
}
if (typeof generatorBrand !== 'string') {
throw new $TypeError('`generatorBrand` must be a string');
}
if (!isObject(generatorPrototype)) {
throw new $TypeError('`generatorPrototype` must be an object');
}
var extraSlots = arguments.length > 3 ? arguments[3] : []; // step 2
if (arguments.length > 3) {
if (!IsArray(extraSlots) || !every(extraSlots, isString)) {
throw new $TypeError('`extraSlots` must be a List of String internal slot names');
}
}
var internalSlotsList = safeConcat(extraSlots, ['[[GeneratorContext]]', '[[GeneratorBrand]]', '[[GeneratorState]]']); // step 3
var generator = OrdinaryObjectCreate(generatorPrototype, internalSlotsList); // steps 4, 6
SLOT.set(generator, '[[GeneratorBrand]]', generatorBrand); // step 5
SLOT.set(generator, '[[GeneratorState]]', 'SUSPENDED-START'); // step 6
SLOT.assert(closure, '[[Sentinel]]'); // our userland slot
SLOT.set(generator, '[[Sentinel]]', SLOT.get(closure, '[[Sentinel]]')); // our userland slot
SLOT.assert(closure, '[[CloseIfAbrupt]]'); // our second userland slot
SLOT.set(generator, '[[CloseIfAbrupt]]', SLOT.get(closure, '[[CloseIfAbrupt]]')); // our second userland slot
GeneratorStart(generator, closure); // step 14
return generator; // step 16
};
@@ -0,0 +1,9 @@
{
"rules": {
"array-bracket-newline": 0,
"array-element-newline": 0,
"max-statements-per-line": [2, { "max": 2 }],
"no-invalid-this": 0,
"no-magic-numbers": 0,
}
}
@@ -0,0 +1 @@
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e||self).gooberForwardProp={})}(this,function(e){e.shouldForwardProp=function(e){return function(o){for(let n in o)e(n)||delete o[n]}}});
@@ -0,0 +1 @@
{"version":3,"file":"unmanaged.spec.d.ts","sourceRoot":"","sources":["../../../../src/metadata/decorators/unmanaged.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
var arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
var fractionRegex = /^\d+\/\d+$/;
var stringLengths = /*#__PURE__*/new Set(['px', 'full', 'screen']);
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
// Shadow always begins with x and y offset separated by underscore
var shadowRegex = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
function isLength(value) {
return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value) || isArbitraryLength(value);
}
function isArbitraryLength(value) {
return getIsArbitraryValue(value, 'length', isLengthOnly);
}
function isArbitrarySize(value) {
return getIsArbitraryValue(value, 'size', isNever);
}
function isArbitraryPosition(value) {
return getIsArbitraryValue(value, 'position', isNever);
}
function isArbitraryUrl(value) {
return getIsArbitraryValue(value, 'url', isUrl);
}
function isArbitraryNumber(value) {
return getIsArbitraryValue(value, 'number', isNumber);
}
/**
* @deprecated Will be removed in next major version. Use `isArbitraryNumber` instead.
*/
var isArbitraryWeight = isArbitraryNumber;
function isNumber(value) {
return !Number.isNaN(Number(value));
}
function isPercent(value) {
return value.endsWith('%') && isNumber(value.slice(0, -1));
}
function isInteger(value) {
return isIntegerOnly(value) || getIsArbitraryValue(value, 'number', isIntegerOnly);
}
function isArbitraryValue(value) {
return arbitraryValueRegex.test(value);
}
function isAny() {
return true;
}
function isTshirtSize(value) {
return tshirtUnitRegex.test(value);
}
function isArbitraryShadow(value) {
return getIsArbitraryValue(value, '', isShadow);
}
function getIsArbitraryValue(value, label, testValue) {
var result = arbitraryValueRegex.exec(value);
if (result) {
if (result[1]) {
return result[1] === label;
}
return testValue(result[2]);
}
return false;
}
function isLengthOnly(value) {
return lengthUnitRegex.test(value);
}
function isNever() {
return false;
}
function isUrl(value) {
return value.startsWith('url(');
}
function isIntegerOnly(value) {
return Number.isInteger(Number(value));
}
function isShadow(value) {
return shadowRegex.test(value);
}
export { isAny, isArbitraryLength, isArbitraryNumber, isArbitraryPosition, isArbitraryShadow, isArbitrarySize, isArbitraryUrl, isArbitraryValue, isArbitraryWeight, isInteger, isLength, isNumber, isPercent, isTshirtSize };
//# sourceMappingURL=validators.mjs.map
@@ -0,0 +1,191 @@
/*
* 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.
*/
import {DOMAttributes, FocusableDOMProps, FocusableElement, FocusableProps, RefObject} from '@react-types/shared';
import {focusSafely} from './';
import {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef, useSyncRef} from '@react-aria/utils';
import React, {ForwardedRef, forwardRef, MutableRefObject, ReactElement, ReactNode, useContext, useEffect, useRef} from 'react';
import {useFocus} from './useFocus';
import {useKeyboard} from './useKeyboard';
export interface FocusableOptions<T = FocusableElement> extends FocusableProps<T>, FocusableDOMProps {
/** Whether focus should be disabled. */
isDisabled?: boolean
}
export interface FocusableProviderProps extends DOMAttributes {
/** The child element to provide DOM props to. */
children?: ReactNode
}
interface FocusableContextValue extends FocusableProviderProps {
ref?: MutableRefObject<FocusableElement | null>
}
// Exported for @react-aria/collections, which forwards this context.
/** @private */
export let FocusableContext: React.Context<FocusableContextValue | null> = React.createContext<FocusableContextValue | null>(null);
function useFocusableContext(ref: RefObject<FocusableElement | null>): FocusableContextValue {
let context = useContext(FocusableContext) || {};
useSyncRef(context, ref);
// eslint-disable-next-line
let {ref: _, ...otherProps} = context;
return otherProps;
}
/**
* Provides DOM props to the nearest focusable child.
*/
export const FocusableProvider:
React.ForwardRefExoticComponent<FocusableProviderProps & React.RefAttributes<FocusableElement>> =
React.forwardRef(function FocusableProvider(props: FocusableProviderProps, ref: ForwardedRef<FocusableElement>) {
let {children, ...otherProps} = props;
let objRef = useObjectRef(ref);
let context = {
...otherProps,
ref: objRef
};
return (
<FocusableContext.Provider value={context}>
{children}
</FocusableContext.Provider>
);
});
export interface FocusableAria {
/** Props for the focusable element. */
focusableProps: DOMAttributes
}
/**
* Used to make an element focusable and capable of auto focus.
*/
export function useFocusable<T extends FocusableElement = FocusableElement>(props: FocusableOptions<T>, domRef: RefObject<FocusableElement | null>): FocusableAria {
let {focusProps} = useFocus(props);
let {keyboardProps} = useKeyboard(props);
let interactions = mergeProps(focusProps, keyboardProps);
let domProps = useFocusableContext(domRef);
let interactionProps = props.isDisabled ? {} : domProps;
let autoFocusRef = useRef(props.autoFocus);
useEffect(() => {
if (autoFocusRef.current && domRef.current) {
focusSafely(domRef.current);
}
autoFocusRef.current = false;
}, [domRef]);
// Always set a tabIndex so that Safari allows focusing native buttons and inputs.
let tabIndex: number | undefined = props.excludeFromTabOrder ? -1 : 0;
if (props.isDisabled) {
tabIndex = undefined;
}
return {
focusableProps: mergeProps(
{
...interactions,
tabIndex
},
interactionProps
)
};
}
export interface FocusableComponentProps extends FocusableOptions {
children: ReactElement<DOMAttributes, string>
}
export const Focusable:
React.ForwardRefExoticComponent<FocusableComponentProps & React.RefAttributes<FocusableElement>> =
forwardRef(({children, ...props}: FocusableComponentProps, ref: ForwardedRef<FocusableElement>) => {
ref = useObjectRef(ref);
let {focusableProps} = useFocusable(props, ref);
let child = React.Children.only(children);
useEffect(() => {
if (process.env.NODE_ENV === 'production') {
return;
}
let el = ref.current;
if (!el || !(el instanceof getOwnerWindow(el).Element)) {
console.error('<Focusable> child must forward its ref to a DOM element.');
return;
}
if (!props.isDisabled && !isFocusable(el)) {
console.warn('<Focusable> child must be focusable. Please ensure the tabIndex prop is passed through.');
return;
}
if (
el.localName !== 'button' &&
el.localName !== 'input' &&
el.localName !== 'select' &&
el.localName !== 'textarea' &&
el.localName !== 'a' &&
el.localName !== 'area' &&
el.localName !== 'summary' &&
el.localName !== 'img' &&
el.localName !== 'svg'
) {
let role = el.getAttribute('role');
if (!role) {
console.warn('<Focusable> child must have an interactive ARIA role.');
} else if (
// https://w3c.github.io/aria/#widget_roles
role !== 'application' &&
role !== 'button' &&
role !== 'checkbox' &&
role !== 'combobox' &&
role !== 'gridcell' &&
role !== 'link' &&
role !== 'menuitem' &&
role !== 'menuitemcheckbox' &&
role !== 'menuitemradio' &&
role !== 'option' &&
role !== 'radio' &&
role !== 'searchbox' &&
role !== 'separator' &&
role !== 'slider' &&
role !== 'spinbutton' &&
role !== 'switch' &&
role !== 'tab' &&
role !== 'tabpanel' &&
role !== 'textbox' &&
role !== 'treeitem' &&
// aria-describedby is also announced on these roles
role !== 'img' &&
role !== 'meter' &&
role !== 'progressbar'
) {
console.warn(`<Focusable> child must have an interactive ARIA role. Got "${role}".`);
}
}
}, [ref, props.isDisabled]);
// @ts-ignore
let childRef = parseInt(React.version, 10) < 19 ? child.ref : child.props.ref;
return React.cloneElement(
child,
{
...mergeProps(focusableProps, child.props),
// @ts-ignore
ref: mergeRefs(childRef, ref)
}
);
});
@@ -0,0 +1,53 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $asyncIterator = GetIntrinsic('%Symbol.asyncIterator%', true);
var inspect = require('object-inspect');
var hasSymbols = require('has-symbols')();
var AdvanceStringIndex = require('./AdvanceStringIndex');
var CreateAsyncFromSyncIterator = require('./CreateAsyncFromSyncIterator');
var GetIteratorFromMethod = require('./GetIteratorFromMethod');
var GetMethod = require('./GetMethod');
var ES = {
AdvanceStringIndex: AdvanceStringIndex,
GetMethod: GetMethod
};
var getIteratorMethod = require('../helpers/getIteratorMethod');
// https://262.ecma-international.org/14.0/#sec-getiterator
module.exports = function GetIterator(obj, kind) {
if (kind !== 'SYNC' && kind !== 'ASYNC') {
throw new $TypeError("Assertion failed: `kind` must be one of 'sync' or 'async', got " + inspect(kind));
}
var method;
if (kind === 'ASYNC') { // step 1
if (hasSymbols && $asyncIterator) {
method = GetMethod(obj, $asyncIterator); // step 1.a
}
}
if (typeof method === 'undefined') { // step 1.b
// var syncMethod = GetMethod(obj, $iterator); // step 1.b.i
var syncMethod = getIteratorMethod(ES, obj);
if (kind === 'ASYNC') {
if (typeof syncMethod === 'undefined') {
throw new $TypeError('iterator method is `undefined`'); // step 1.b.ii
}
var syncIteratorRecord = GetIteratorFromMethod(obj, syncMethod); // step 1.b.iii
return CreateAsyncFromSyncIterator(syncIteratorRecord); // step 1.b.iv
}
method = syncMethod; // step 2, kind of
}
if (typeof method === 'undefined') {
throw new $TypeError('iterator method is `undefined`'); // step 3
}
return GetIteratorFromMethod(obj, method); // step 4
};
@@ -0,0 +1,167 @@
import * as T from '../type/index.mjs';
type TDereference<Context extends T.TProperties, Key extends string> = (Key extends keyof Context ? Context[Key] : T.TRef<Key>);
type TDelimitedDecode<Input extends ([unknown, unknown] | unknown)[], Result extends unknown[] = []> = (Input extends [infer Left, ...infer Right] ? Left extends [infer Item, infer _] ? TDelimitedDecode<Right, [...Result, Item]> : TDelimitedDecode<Right, [...Result, Left]> : Result);
type TDelimited<Input extends [unknown, unknown]> = Input extends [infer Left extends unknown[], infer Right extends unknown[]] ? TDelimitedDecode<[...Left, ...Right]> : [];
export type TGenericReferenceParameterListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
export declare function GenericReferenceParameterListMapping(input: [unknown, unknown], context: unknown): unknown[];
export type TGenericReferenceMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties, Result = Context extends T.TProperties ? Input extends [infer Reference extends string, '<', infer Args extends T.TSchema[], '>'] ? T.TInstantiate<TDereference<Context, Reference>, Args> : never : never> = Result;
export declare function GenericReferenceMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
export type TGenericArgumentsListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
export declare function GenericArgumentsListMapping(input: [unknown, unknown], context: unknown): unknown[];
type GenericArgumentsContext<Arguments extends string[], Context extends T.TProperties, Result extends T.TProperties = {}> = (Arguments extends [...infer Left extends string[], infer Right extends string] ? GenericArgumentsContext<Left, Context, Result & {
[_ in Right]: T.TArgument<Left['length']>;
}> : T.Evaluate<Result & Context>);
export type TGenericArgumentsMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['<', infer Arguments extends string[], '>'] ? Context extends infer Context extends T.TProperties ? GenericArgumentsContext<Arguments, Context> : never : never;
declare const GenericArgumentsContext: (_arguments: string[], context: T.TProperties) => T.TProperties;
export declare function GenericArgumentsMapping(input: [unknown, unknown, unknown], context: unknown): T.TProperties;
export type TKeywordStringMapping<Input extends 'string', Context extends T.TProperties> = T.TString;
export declare function KeywordStringMapping(input: 'string', context: unknown): T.TString;
export type TKeywordNumberMapping<Input extends 'number', Context extends T.TProperties> = T.TNumber;
export declare function KeywordNumberMapping(input: 'number', context: unknown): T.TNumber;
export type TKeywordBooleanMapping<Input extends 'boolean', Context extends T.TProperties> = T.TBoolean;
export declare function KeywordBooleanMapping(input: 'boolean', context: unknown): T.TBoolean;
export type TKeywordUndefinedMapping<Input extends 'undefined', Context extends T.TProperties> = T.TUndefined;
export declare function KeywordUndefinedMapping(input: 'undefined', context: unknown): T.TUndefined;
export type TKeywordNullMapping<Input extends 'null', Context extends T.TProperties> = T.TNull;
export declare function KeywordNullMapping(input: 'null', context: unknown): T.TNull;
export type TKeywordIntegerMapping<Input extends 'integer', Context extends T.TProperties> = T.TInteger;
export declare function KeywordIntegerMapping(input: 'integer', context: unknown): T.TInteger;
export type TKeywordBigIntMapping<Input extends 'bigint', Context extends T.TProperties> = T.TBigInt;
export declare function KeywordBigIntMapping(input: 'bigint', context: unknown): T.TBigInt;
export type TKeywordUnknownMapping<Input extends 'unknown', Context extends T.TProperties> = T.TUnknown;
export declare function KeywordUnknownMapping(input: 'unknown', context: unknown): T.TUnknown;
export type TKeywordAnyMapping<Input extends 'any', Context extends T.TProperties> = T.TAny;
export declare function KeywordAnyMapping(input: 'any', context: unknown): T.TAny;
export type TKeywordNeverMapping<Input extends 'never', Context extends T.TProperties> = T.TNever;
export declare function KeywordNeverMapping(input: 'never', context: unknown): T.TNever;
export type TKeywordSymbolMapping<Input extends 'symbol', Context extends T.TProperties> = T.TSymbol;
export declare function KeywordSymbolMapping(input: 'symbol', context: unknown): T.TSymbol;
export type TKeywordVoidMapping<Input extends 'void', Context extends T.TProperties> = T.TVoid;
export declare function KeywordVoidMapping(input: 'void', context: unknown): T.TVoid;
export type TKeywordMapping<Input extends unknown, Context extends T.TProperties> = Input;
export declare function KeywordMapping(input: unknown, context: unknown): unknown;
export type TLiteralStringMapping<Input extends string, Context extends T.TProperties> = Input extends T.TLiteralValue ? T.TLiteral<Input> : never;
export declare function LiteralStringMapping(input: string, context: unknown): T.TLiteral<string>;
export type TLiteralNumberMapping<Input extends string, Context extends T.TProperties> = Input extends `${infer Value extends number}` ? T.TLiteral<Value> : never;
export declare function LiteralNumberMapping(input: string, context: unknown): T.TLiteral<number>;
export type TLiteralBooleanMapping<Input extends 'true' | 'false', Context extends T.TProperties> = Input extends 'true' ? T.TLiteral<true> : T.TLiteral<false>;
export declare function LiteralBooleanMapping(input: 'true' | 'false', context: unknown): T.TLiteral<boolean>;
export type TLiteralMapping<Input extends unknown, Context extends T.TProperties> = Input;
export declare function LiteralMapping(input: unknown, context: unknown): unknown;
export type TKeyOfMapping<Input extends [unknown] | [], Context extends T.TProperties> = Input extends [unknown] ? true : false;
export declare function KeyOfMapping(input: [unknown] | [], context: unknown): boolean;
type TIndexArrayMappingReduce<Input extends unknown[], Result extends unknown[] = []> = (Input extends [infer Left extends unknown, ...infer Right extends unknown[]] ? Left extends ['[', infer Type extends T.TSchema, ']'] ? TIndexArrayMappingReduce<Right, [...Result, [Type]]> : TIndexArrayMappingReduce<Right, [...Result, []]> : Result);
export type TIndexArrayMapping<Input extends ([unknown, unknown, unknown] | [unknown, unknown])[], Context extends T.TProperties> = Input extends unknown[] ? TIndexArrayMappingReduce<Input> : [];
export declare function IndexArrayMapping(input: ([unknown, unknown, unknown] | [unknown, unknown])[], context: unknown): unknown[];
export type TExtendsMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown] | [], Context extends T.TProperties> = Input extends ['extends', infer Type extends T.TSchema, '?', infer True extends T.TSchema, ':', infer False extends T.TSchema] ? [Type, True, False] : [];
export declare function ExtendsMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown] | [], context: unknown): unknown[];
export type TBaseMapping<Input extends [unknown, unknown, unknown] | unknown, Context extends T.TProperties> = (Input extends ['(', infer Type extends T.TSchema, ')'] ? Type : Input extends infer Type extends T.TSchema ? Type : never);
export declare function BaseMapping(input: [unknown, unknown, unknown] | unknown, context: unknown): unknown;
type TFactorIndexArray<Type extends T.TSchema, IndexArray extends unknown[]> = (IndexArray extends [...infer Left extends unknown[], infer Right extends T.TSchema[]] ? (Right extends [infer Indexer extends T.TSchema] ? T.TIndex<TFactorIndexArray<Type, Left>, T.TIndexPropertyKeys<Indexer>> : Right extends [] ? T.TArray<TFactorIndexArray<Type, Left>> : T.TNever) : Type);
type TFactorExtends<Type extends T.TSchema, Extends extends unknown[]> = (Extends extends [infer Right extends T.TSchema, infer True extends T.TSchema, infer False extends T.TSchema] ? T.TExtends<Type, Right, True, False> : Type);
export type TFactorMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends [infer KeyOf extends boolean, infer Type extends T.TSchema, infer IndexArray extends unknown[], infer Extends extends unknown[]] ? KeyOf extends true ? TFactorExtends<T.TKeyOf<TFactorIndexArray<Type, IndexArray>>, Extends> : TFactorExtends<TFactorIndexArray<Type, IndexArray>, Extends> : never;
export declare function FactorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
type TExprBinaryMapping<Left extends T.TSchema, Rest extends unknown[]> = (Rest extends [infer Operator extends unknown, infer Right extends T.TSchema, infer Next extends unknown[]] ? (TExprBinaryMapping<Right, Next> extends infer Schema extends T.TSchema ? (Operator extends '&' ? (Schema extends T.TIntersect<infer Types extends T.TSchema[]> ? T.TIntersect<[Left, ...Types]> : T.TIntersect<[Left, Schema]>) : Operator extends '|' ? (Schema extends T.TUnion<infer Types extends T.TSchema[]> ? T.TUnion<[Left, ...Types]> : T.TUnion<[Left, Schema]>) : never) : never) : Left);
export type TExprTermTailMapping<Input extends [unknown, unknown, unknown] | [], Context extends T.TProperties> = Input;
export declare function ExprTermTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown];
export type TExprTermMapping<Input extends [unknown, unknown], Context extends T.TProperties> = (Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping<Left, Rest> : []);
export declare function ExprTermMapping(input: [unknown, unknown], context: unknown): T.TSchema;
export type TExprTailMapping<Input extends [unknown, unknown, unknown] | [], Context extends T.TProperties> = Input;
export declare function ExprTailMapping(input: [unknown, unknown, unknown] | [], context: unknown): [] | [unknown, unknown, unknown];
export type TExprMapping<Input extends [unknown, unknown], Context extends T.TProperties> = Input extends [infer Left extends T.TSchema, infer Rest extends unknown[]] ? TExprBinaryMapping<Left, Rest> : [];
export declare function ExprMapping(input: [unknown, unknown], context: unknown): T.TSchema;
export type TTypeMapping<Input extends unknown, Context extends T.TProperties> = Input;
export declare function TypeMapping(input: unknown, context: unknown): unknown;
export type TPropertyKeyMapping<Input extends string, Context extends T.TProperties> = Input;
export declare function PropertyKeyMapping(input: string, context: unknown): string;
export type TReadonlyMapping<Input extends [unknown] | [], Context extends T.TProperties> = Input extends [unknown] ? true : false;
export declare function ReadonlyMapping(input: [unknown] | [], context: unknown): boolean;
export type TOptionalMapping<Input extends [unknown] | [], Context extends T.TProperties> = Input extends [unknown] ? true : false;
export declare function OptionalMapping(input: [unknown] | [], context: unknown): boolean;
export type TPropertyMapping<Input extends [unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends [infer IsReadonly extends boolean, infer Key extends string, infer IsOptional extends boolean, string, infer Type extends T.TSchema] ? {
[_ in Key]: ([
IsReadonly,
IsOptional
] extends [true, true] ? T.TReadonlyOptional<Type> : [
IsReadonly,
IsOptional
] extends [true, false] ? T.TReadonly<Type> : [
IsReadonly,
IsOptional
] extends [false, true] ? T.TOptional<Type> : Type);
} : never;
export declare function PropertyMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): {
[x: string]: T.TSchema;
};
export type TPropertyDelimiterMapping<Input extends [unknown, unknown] | [unknown], Context extends T.TProperties> = Input;
export declare function PropertyDelimiterMapping(input: [unknown, unknown] | [unknown], context: unknown): [unknown] | [unknown, unknown];
export type TPropertyListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
export declare function PropertyListMapping(input: [unknown, unknown], context: unknown): unknown[];
type TObjectMappingReduce<PropertiesList extends T.TProperties[], Result extends T.TProperties = {}> = (PropertiesList extends [infer Left extends T.TProperties, ...infer Right extends T.TProperties[]] ? TObjectMappingReduce<Right, Result & Left> : {
[Key in keyof Result]: Result[Key];
});
export type TObjectMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['{', infer PropertyList extends T.TProperties[], '}'] ? T.TObject<TObjectMappingReduce<PropertyList>> : never;
export declare function ObjectMapping(input: [unknown, unknown, unknown], context: unknown): T.TObject<T.TProperties>;
export type TElementListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
export declare function ElementListMapping(input: [unknown, unknown], context: unknown): unknown[];
export type TTupleMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['[', infer Types extends T.TSchema[], ']'] ? T.TTuple<Types> : never;
export declare function TupleMapping(input: [unknown, unknown, unknown], context: unknown): T.TTuple<T.TSchema[]>;
export type TParameterMapping<Input extends [unknown, unknown, unknown], Context extends T.TProperties> = Input extends [string, ':', infer Type extends T.TSchema] ? Type : never;
export declare function ParameterMapping(input: [unknown, unknown, unknown], context: unknown): T.TSchema;
export type TParameterListMapping<Input extends [unknown, unknown], Context extends T.TProperties> = TDelimited<Input>;
export declare function ParameterListMapping(input: [unknown, unknown], context: unknown): unknown[];
export type TFunctionMapping<Input extends [unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['(', infer ParameterList extends T.TSchema[], ')', '=>', infer ReturnType extends T.TSchema] ? T.TFunction<ParameterList, ReturnType> : never;
export declare function FunctionMapping(input: [unknown, unknown, unknown, unknown, unknown], context: unknown): T.TFunction<T.TSchema[], T.TSchema>;
export type TConstructorMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['new', '(', infer ParameterList extends T.TSchema[], ')', '=>', infer InstanceType extends T.TSchema] ? T.TConstructor<ParameterList, InstanceType> : never;
export declare function ConstructorMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TConstructor<T.TSchema[], T.TSchema>;
export type TMappedMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['{', '[', infer _Key extends string, 'in', infer _Right extends T.TSchema, ']', ':', infer _Type extends T.TSchema, '}'] ? T.TLiteral<'Mapped types not supported'> : never;
export declare function MappedMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TLiteral<"Mapped types not supported">;
export type TAsyncIteratorMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['AsyncIterator', '<', infer Type extends T.TSchema, '>'] ? T.TAsyncIterator<Type> : never;
export declare function AsyncIteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TAsyncIterator<T.TSchema>;
export type TIteratorMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Iterator', '<', infer Type extends T.TSchema, '>'] ? T.TIterator<Type> : never;
export declare function IteratorMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TIterator<T.TSchema>;
export type TArgumentMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Argument', '<', infer Type extends T.TSchema, '>'] ? Type extends T.TLiteral<infer Index extends number> ? T.TArgument<Index> : T.TNever : never;
export declare function ArgumentMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever | T.TArgument<number>;
export type TAwaitedMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Awaited', '<', infer Type extends T.TSchema, '>'] ? T.TAwaited<Type> : never;
export declare function AwaitedMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
export type TArrayMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Array', '<', infer Type extends T.TSchema, '>'] ? T.TArray<Type> : never;
export declare function ArrayMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TArray<T.TSchema>;
export type TRecordMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Record', '<', infer Key extends T.TSchema, ',', infer Type extends T.TSchema, '>'] ? T.TRecordOrObject<Key, Type> : never;
export declare function RecordMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever;
export type TPromiseMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Promise', '<', infer Type extends T.TSchema, '>'] ? T.TPromise<Type> : never;
export declare function PromiseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TPromise<T.TSchema>;
export type TConstructorParametersMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['ConstructorParameters', '<', infer Type extends T.TSchema, '>'] ? T.TConstructorParameters<Type> : never;
export declare function ConstructorParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
export type TFunctionParametersMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Parameters', '<', infer Type extends T.TSchema, '>'] ? T.TParameters<Type> : never;
export declare function FunctionParametersMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
export type TInstanceTypeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['InstanceType', '<', infer Type extends T.TSchema, '>'] ? T.TInstanceType<Type> : never;
export declare function InstanceTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
export type TReturnTypeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['ReturnType', '<', infer Type extends T.TSchema, '>'] ? T.TReturnType<Type> : never;
export declare function ReturnTypeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TNever;
export type TPartialMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Partial', '<', infer Type extends T.TSchema, '>'] ? T.TPartial<Type> : never;
export declare function PartialMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
export type TRequiredMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Required', '<', infer Type extends T.TSchema, '>'] ? T.TRequired<Type> : never;
export declare function RequiredMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
export type TPickMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Pick', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TPick<Type, Key> : never;
export declare function PickMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
export type TOmitMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Omit', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TOmit<Type, Key> : never;
export declare function OmitMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TObject<{}>;
export type TExcludeMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Exclude', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExclude<Type, Key> : never;
export declare function ExcludeMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TNever;
export type TExtractMapping<Input extends [unknown, unknown, unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Extract', '<', infer Type extends T.TSchema, ',', infer Key extends T.TSchema, '>'] ? T.TExtract<Type, Key> : never;
export declare function ExtractMapping(input: [unknown, unknown, unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
export type TUppercaseMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Uppercase', '<', infer Type extends T.TSchema, '>'] ? T.TUppercase<Type> : never;
export declare function UppercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
export type TLowercaseMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Lowercase', '<', infer Type extends T.TSchema, '>'] ? T.TLowercase<Type> : never;
export declare function LowercaseMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
export type TCapitalizeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Capitalize', '<', infer Type extends T.TSchema, '>'] ? T.TCapitalize<Type> : never;
export declare function CapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
export type TUncapitalizeMapping<Input extends [unknown, unknown, unknown, unknown], Context extends T.TProperties> = Input extends ['Uncapitalize', '<', infer Type extends T.TSchema, '>'] ? T.TUncapitalize<Type> : never;
export declare function UncapitalizeMapping(input: [unknown, unknown, unknown, unknown], context: unknown): T.TSchema;
export type TDateMapping<Input extends 'Date', Context extends T.TProperties> = T.TDate;
export declare function DateMapping(input: 'Date', context: unknown): T.TDate;
export type TUint8ArrayMapping<Input extends 'Uint8Array', Context extends T.TProperties> = T.TUint8Array;
export declare function Uint8ArrayMapping(input: 'Uint8Array', context: unknown): T.TUint8Array;
export type TReferenceMapping<Input extends string, Context extends T.TProperties> = Context extends T.TProperties ? Input extends string ? TDereference<Context, Input> : never : never;
export declare function ReferenceMapping(input: string, context: unknown): T.TSchema;
export {};
@@ -0,0 +1,39 @@
// Esperanto [eo]
import dayjs from '../index';
var locale = {
name: 'eo',
weekdays: 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'),
months: 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'),
weekStart: 1,
weekdaysShort: 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'),
monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'),
weekdaysMin: 'di_lu_ma_me_ĵa_ve_sa'.split('_'),
ordinal: function ordinal(n) {
return n;
},
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'YYYY-MM-DD',
LL: 'D[-a de] MMMM, YYYY',
LLL: 'D[-a de] MMMM, YYYY HH:mm',
LLLL: 'dddd, [la] D[-a de] MMMM, YYYY HH:mm'
},
relativeTime: {
future: 'post %s',
past: 'antaŭ %s',
s: 'sekundoj',
m: 'minuto',
mm: '%d minutoj',
h: 'horo',
hh: '%d horoj',
d: 'tago',
dd: '%d tagoj',
M: 'monato',
MM: '%d monatoj',
y: 'jaro',
yy: '%d jaroj'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,3 @@
import CryptoJS = require("./index");
export = CryptoJS.EvpKDF;
@@ -0,0 +1,27 @@
'use strict'
const fs = require('../fs')
const { checkPath } = require('./utils')
const getMode = options => {
const defaults = { mode: 0o777 }
if (typeof options === 'number') return options
return ({ ...defaults, ...options }).mode
}
module.exports.makeDir = async (dir, options) => {
checkPath(dir)
return fs.mkdir(dir, {
mode: getMode(options),
recursive: true
})
}
module.exports.makeDirSync = (dir, options) => {
checkPath(dir)
return fs.mkdirSync(dir, {
mode: getMode(options),
recursive: true
})
}
@@ -0,0 +1,265 @@
# vinyl [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url]
## Information
<table><tr><td>Package</td><td>vinyl</td></tr><tr><td>Description</td><td>A virtual file format</td></tr><tr><td>Node Version</td><td>>= 0.9</td></tr></table>
## What is this?
Read this for more info about how this plays into the grand scheme of things [https://medium.com/@eschoff/3828e8126466](https://medium.com/@eschoff/3828e8126466)
## File
```javascript
var File = require('vinyl');
var coffeeFile = new File({
cwd: "/",
base: "/test/",
path: "/test/file.coffee",
contents: new Buffer("test = 123")
});
```
### isVinyl
When checking if an object is a vinyl file, you should not use instanceof. Use the isVinyl function instead.
```js
var File = require('vinyl');
var dummy = new File({stuff});
var notAFile = {};
File.isVinyl(dummy); // true
File.isVinyl(notAFile); // false
```
### isCustomProp
Vinyl checks if a property is not managed internally, such as `sourceMap`. This is than used in `constructor(options)` when setting, and `clone()` when copying properties.
```js
var File = require('vinyl');
File.isCustomProp('sourceMap'); // true
File.isCustomProp('path'); // false -> internal getter/setter
```
Read more in [Extending Vinyl](#extending-vinyl).
### constructor(options)
#### options.cwd
Type: `String`<br><br>Default: `process.cwd()`
#### options.base
Used for relative pathing. Typically where a glob starts.
Type: `String`<br><br>Default: `options.cwd`
#### options.path
Full path to the file.
Type: `String`<br><br>Default: `undefined`
#### options.history
Path history. Has no effect if `options.path` is passed.
Type: `Array`<br><br>Default: `options.path ? [options.path] : []`
#### options.stat
The result of an fs.stat call. See [fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information.
Type: `fs.Stats`<br><br>Default: `null`
#### options.contents
File contents.
Type: `Buffer, Stream, or null`<br><br>Default: `null`
#### options.{custom}
Any other option properties will just be assigned to the new File object.
```js
var File = require('vinyl');
var file = new File({foo: 'bar'});
file.foo === 'bar'; // true
```
### isBuffer()
Returns true if file.contents is a Buffer.
### isStream()
Returns true if file.contents is a Stream.
### isNull()
Returns true if file.contents is null.
### clone([opt])
Returns a new File object with all attributes cloned.<br>By default custom attributes are deep-cloned.
If opt or opt.deep is false, custom attributes will not be deep-cloned.
If opt.contents is false, it will copy file.contents Buffer's reference.
### pipe(stream[, opt])
If file.contents is a Buffer, it will write it to the stream.
If file.contents is a Stream, it will pipe it to the stream.
If file.contents is null, it will do nothing.
If opt.end is false, the destination stream will not be ended (same as node core).
Returns the stream.
### inspect()
Returns a pretty String interpretation of the File. Useful for console.log.
### contents
The [Stream](https://nodejs.org/api/stream.html#stream_stream) or [Buffer](https://nodejs.org/api/buffer.html#buffer_class_buffer) of the file as it was passed in via options, or as the result of modification.
For example:
```js
if (file.isBuffer()) {
console.log(file.contents.toString()); // logs out the string of contents
}
```
### path
Absolute pathname string or `undefined`. Setting to a different value pushes the old value to `history`.
### history
Array of `path` values the file object has had, from `history[0]` (original) through `history[history.length - 1]` (current). `history` and its elements should normally be treated as read-only and only altered indirectly by setting `path`.
### relative
Returns path.relative for the file base and file path.
Example:
```javascript
var file = new File({
cwd: "/",
base: "/test/",
path: "/test/file.coffee"
});
console.log(file.relative); // file.coffee
```
### dirname
Gets and sets path.dirname for the file path.
Example:
```javascript
var file = new File({
cwd: "/",
base: "/test/",
path: "/test/file.coffee"
});
console.log(file.dirname); // /test
file.dirname = '/specs';
console.log(file.dirname); // /specs
console.log(file.path); // /specs/file.coffee
```
### basename
Gets and sets path.basename for the file path.
Example:
```javascript
var file = new File({
cwd: "/",
base: "/test/",
path: "/test/file.coffee"
});
console.log(file.basename); // file.coffee
file.basename = 'file.js';
console.log(file.basename); // file.js
console.log(file.path); // /test/file.js
```
### stem
Gets and sets stem (filename without suffix) for the file path.
Example:
```javascript
var file = new File({
cwd: "/",
base: "/test/",
path: "/test/file.coffee"
});
console.log(file.stem); // file
file.stem = 'foo';
console.log(file.stem); // foo
console.log(file.path); // /test/foo.coffee
```
### extname
Gets and sets path.extname for the file path.
Example:
```javascript
var file = new File({
cwd: "/",
base: "/test/",
path: "/test/file.coffee"
});
console.log(file.extname); // .coffee
file.extname = '.js';
console.log(file.extname); // .js
console.log(file.path); // /test/file.js
```
## Extending Vinyl
When extending Vinyl into your own class with extra features, you need to think about a few things.
When you have your own properties that are managed internally, you need to extend the static `isCustomProp` method to return `false` when one of these properties is queried.
```js
const File = require('vinyl');
const builtInProps = ['foo', '_foo'];
class SuperFile extends File {
constructor(options) {
super(options);
this._foo = 'example internal read-only value';
}
get foo() {
return this._foo;
}
static isCustomProp(name) {
return super.isCustomProp(name) && builtInProps.indexOf(name) === -1;
}
}
```
This makes properties `foo` and `_foo` ignored when cloning, and when passed in options to `constructor(options)` so they don't get assigned to the new object.
Same goes for `clone()`. If you have your own internal stuff that needs special handling during cloning, you should extend it to do so.
[npm-url]: https://npmjs.org/package/vinyl
[npm-image]: https://badge.fury.io/js/vinyl.svg
[travis-url]: https://travis-ci.org/gulpjs/vinyl
[travis-image]: https://travis-ci.org/gulpjs/vinyl.svg?branch=master
[coveralls-url]: https://coveralls.io/github/gulpjs/vinyl
[coveralls-image]: https://coveralls.io/repos/github/gulpjs/vinyl/badge.svg
[depstat-url]: https://david-dm.org/gulpjs/vinyl
[depstat-image]: https://david-dm.org/gulpjs/vinyl.svg
@@ -0,0 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { IconSvgProps } from './types.mjs';
import 'react';
declare const LoadingIcon: (props: IconSvgProps) => react_jsx_runtime.JSX.Element;
export { LoadingIcon };
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('valuesIn', require('../valuesIn'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,21 @@
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
@@ -0,0 +1,298 @@
# jsx-ast-utils <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
AST utility module for statically analyzing JSX.
## Installation
```sh
$ npm i jsx-ast-utils --save
```
## Usage
This is a utility module to evaluate AST objects for JSX syntax. This can be super useful when writing linting rules for JSX code. It was originally in the code for [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y), however I thought it could be useful to be extracted and maintained separately so **you** could write new interesting rules to statically analyze JSX.
### ESLint example
```js
import { hasProp } from 'jsx-ast-utils';
// OR: var hasProp = require('jsx-ast-utils').hasProp;
// OR: const hasProp = require('jsx-ast-utils/hasProp');
// OR: import hasProp from 'jsx-ast-utils/hasProp';
module.exports = context => ({
JSXOpeningElement: node => {
const onChange = hasProp(node.attributes, 'onChange');
if (onChange) {
context.report({
node,
message: `No onChange!`
});
}
}
});
```
## API
### AST Resources
1. [JSX spec](https://github.com/facebook/jsx/blob/master/AST.md)
2. [JS spec](https://github.com/estree/estree/blob/master/spec.md)
### hasProp
```js
hasProp(props, prop, options);
```
Returns boolean indicating whether an prop exists as an attribute on a JSX element node.
#### Props
Object - The attributes on the visited node. (Usually `node.attributes`).
#### Prop
String - A string representation of the prop you want to check for existence.
#### Options
Object - An object representing options for existence checking
1. `ignoreCase` - automatically set to `true`.
2. `spreadStrict` - automatically set to `true`. This means if spread operator exists in
props, it will assume the prop you are looking for is not in the spread.
Example: `<div {...props} />` looking for specific prop here will return false if `spreadStrict` is `true`.
<hr />
### hasAnyProp
```js
hasAnyProp(props, prop, options);
```
Returns a boolean indicating if **any** of props in `prop` argument exist on the node.
#### Props
Object - The attributes on the visited node. (Usually `node.attributes`).
#### Prop
Array<String> - An array of strings representing the props you want to check for existence.
#### Options
Object - An object representing options for existence checking
1. `ignoreCase` - automatically set to `true`.
2. `spreadStrict` - automatically set to `true`. This means if spread operator exists in
props, it will assume the prop you are looking for is not in the spread.
Example: `<div {...props} />` looking for specific prop here will return false if `spreadStrict` is `true`.
<hr />
### hasEveryProp
```js
hasEveryProp(props, prop, options);
```
Returns a boolean indicating if **all** of props in `prop` argument exist on the node.
#### Props
Object - The attributes on the visited node. (Usually `node.attributes`).
#### Prop
Array<String> - An array of strings representing the props you want to check for existence.
#### Options
Object - An object representing options for existence checking
1. `ignoreCase` - automatically set to `true`.
2. `spreadStrict` - automatically set to `true`. This means if spread operator exists in
props, it will assume the prop you are looking for is not in the spread.
Example: `<div {...props} />` looking for specific prop here will return false if `spreadStrict` is `true`.
<hr />
### getProp
```js
getProp(props, prop, options);
```
Returns the JSXAttribute itself or undefined, indicating the prop is not present on the JSXOpeningElement.
#### Props
Object - The attributes on the visited node. (Usually `node.attributes`).
#### Prop
String - A string representation of the prop you want to check for existence.
#### Options
Object - An object representing options for existence checking
1. `ignoreCase` - automatically set to `true`.
<hr />
### elementType
```js
elementType(node)
```
Returns the tagName associated with a JSXElement.
#### Node
Object - The visited JSXElement node object.
<hr />
### getPropValue
```js
getPropValue(prop);
```
Returns the value of a given attribute. Different types of attributes have their associated values in different properties on the object.
This function should return the most *closely* associated value with the intention of the JSX.
#### Prop
Object - The JSXAttribute collected by AST parser.
<hr />
### getLiteralPropValue
```js
getLiteralPropValue(prop);
```
Returns the value of a given attribute. Different types of attributes have their associated values in different properties on the object.
This function should return a value only if we can extract a literal value from its attribute (i.e. values that have generic types in JavaScript - strings, numbers, booleans, etc.)
#### Prop
Object - The JSXAttribute collected by AST parser.
<hr />
### propName
```js
propName(prop);
```
Returns the name associated with a JSXAttribute. For example, given `<div foo="bar" />` and the JSXAttribute for `foo`, this will return the string `"foo"`.
#### Prop
Object - The JSXAttribute collected by AST parser.
<hr />
### eventHandlers
```js
console.log(eventHandlers);
/*
[
'onCopy',
'onCut',
'onPaste',
'onCompositionEnd',
'onCompositionStart',
'onCompositionUpdate',
'onKeyDown',
'onKeyPress',
'onKeyUp',
'onFocus',
'onBlur',
'onChange',
'onInput',
'onSubmit',
'onClick',
'onContextMenu',
'onDblClick',
'onDoubleClick',
'onDrag',
'onDragEnd',
'onDragEnter',
'onDragExit',
'onDragLeave',
'onDragOver',
'onDragStart',
'onDrop',
'onMouseDown',
'onMouseEnter',
'onMouseLeave',
'onMouseMove',
'onMouseOut',
'onMouseOver',
'onMouseUp',
'onSelect',
'onTouchCancel',
'onTouchEnd',
'onTouchMove',
'onTouchStart',
'onScroll',
'onWheel',
'onAbort',
'onCanPlay',
'onCanPlayThrough',
'onDurationChange',
'onEmptied',
'onEncrypted',
'onEnded',
'onError',
'onLoadedData',
'onLoadedMetadata',
'onLoadStart',
'onPause',
'onPlay',
'onPlaying',
'onProgress',
'onRateChange',
'onSeeked',
'onSeeking',
'onStalled',
'onSuspend',
'onTimeUpdate',
'onVolumeChange',
'onWaiting',
'onLoad',
'onError',
'onAnimationStart',
'onAnimationEnd',
'onAnimationIteration',
'onTransitionEnd',
]
*/
```
Contains a flat list of common event handler props used in JSX to attach behaviors
to DOM events.
#### eventHandlersByType
The same list as `eventHandlers`, grouped into types.
```js
console.log(eventHandlersByType);
/*
{
clipboard: [ 'onCopy', 'onCut', 'onPaste' ],
composition: [ 'onCompositionEnd', 'onCompositionStart', 'onCompositionUpdate' ],
keyboard: [ 'onKeyDown', 'onKeyPress', 'onKeyUp' ],
focus: [ 'onFocus', 'onBlur' ],
form: [ 'onChange', 'onInput', 'onSubmit' ],
mouse: [ 'onClick', 'onContextMenu', 'onDblClick', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp' ],
selection: [ 'onSelect' ],
touch: [ 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart' ],
ui: [ 'onScroll' ],
wheel: [ 'onWheel' ],
media: [ 'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onError', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting' ],
image: [ 'onLoad', 'onError' ],
animation: [ 'onAnimationStart', 'onAnimationEnd', 'onAnimationIteration' ],
transition: [ 'onTransitionEnd' ],
}
*/
```
[1]: https://npmjs.org/package/jsx-ast-utils
[2]: https://versionbadg.es/jsx-eslint/jsx-ast-utils.svg
[5]: https://david-dm.org/jsx-eslint/jsx-ast-utils.svg
[6]: https://david-dm.org/jsx-eslint/jsx-ast-utils
[7]: https://david-dm.org/jsx-eslint/jsx-ast-utils/dev-status.svg
[8]: https://david-dm.org/jsx-eslint/jsx-ast-utils#info=devDependencies
[11]: https://nodei.co/npm/jsx-ast-utils.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/jsx-ast-utils.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/jsx-ast-utils.svg
[downloads-url]: https://npm-stat.com/charts.html?package=jsx-ast-utils
[codecov-image]: https://codecov.io/gh/jsx-eslint/jsx-ast-utils/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/jsx-eslint/jsx-ast-utils/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/jsx-eslint/jsx-ast-utils
[actions-url]: https://github.com/jsx-eslint/jsx-ast-utils/actions
@@ -0,0 +1,24 @@
# Security Policies and Procedures
## Reporting a Bug
The `raw-body` team and community take all security bugs seriously. Thank you
for improving the security of Express. We appreciate your efforts and
responsible disclosure and will make every effort to acknowledge your
contributions.
Report security bugs by emailing the current owners of `raw-body`. This information
can be found in the npm registry using the command `npm owner ls raw-body`.
If unsure or unable to get the information from the above, open an issue
in the [project issue tracker](https://github.com/stream-utils/raw-body/issues)
asking for the current contact information.
To ensure the timely response to your report, please ensure that the entirety
of the report is contained within the email body and not solely behind a web
link or an attachment.
At least one owner will acknowledge your email within 48 hours, and will send a
more detailed response within 48 hours indicating the next steps in handling
your report. After the initial reply to your report, the owners will
endeavor to keep you informed of the progress towards a fix and full
announcement, and may ask for additional information or guidance.
@@ -0,0 +1,41 @@
/**
* @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 `Atomics` class.",
category: "ES2017",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-atomics.html",
},
fixable: null,
messages: {
forbidden: "ES2017 '{{name}}' class is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"() {
const tracker = new ReferenceTracker(context.getScope())
for (const { node, path } of tracker.iterateGlobalReferences({
Atomics: { [READ]: true },
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,183 @@
'use strict';
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var _require = require('buffer'),
Buffer = _require.Buffer;
var _require2 = require('util'),
inspect = _require2.inspect;
var custom = inspect && inspect.custom || 'inspect';
function copyBuffer(src, target, offset) {
Buffer.prototype.copy.call(src, target, offset);
}
module.exports = /*#__PURE__*/function () {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
_createClass(BufferList, [{
key: "push",
value: function push(v) {
var entry = {
data: v,
next: null
};
if (this.length > 0) this.tail.next = entry;else this.head = entry;
this.tail = entry;
++this.length;
}
}, {
key: "unshift",
value: function unshift(v) {
var entry = {
data: v,
next: this.head
};
if (this.length === 0) this.tail = entry;
this.head = entry;
++this.length;
}
}, {
key: "shift",
value: function shift() {
if (this.length === 0) return;
var ret = this.head.data;
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
--this.length;
return ret;
}
}, {
key: "clear",
value: function clear() {
this.head = this.tail = null;
this.length = 0;
}
}, {
key: "join",
value: function join(s) {
if (this.length === 0) return '';
var p = this.head;
var ret = '' + p.data;
while (p = p.next) ret += s + p.data;
return ret;
}
}, {
key: "concat",
value: function concat(n) {
if (this.length === 0) return Buffer.alloc(0);
var ret = Buffer.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
}
// Consumes a specified amount of bytes or characters from the buffered data.
}, {
key: "consume",
value: function consume(n, hasStrings) {
var ret;
if (n < this.head.data.length) {
// `slice` is the same for buffers and strings.
ret = this.head.data.slice(0, n);
this.head.data = this.head.data.slice(n);
} else if (n === this.head.data.length) {
// First chunk is a perfect match.
ret = this.shift();
} else {
// Result spans more than one buffer.
ret = hasStrings ? this._getString(n) : this._getBuffer(n);
}
return ret;
}
}, {
key: "first",
value: function first() {
return this.head.data;
}
// Consumes a specified amount of characters from the buffered data.
}, {
key: "_getString",
value: function _getString(n) {
var p = this.head;
var c = 1;
var ret = p.data;
n -= ret.length;
while (p = p.next) {
var str = p.data;
var nb = n > str.length ? str.length : n;
if (nb === str.length) ret += str;else ret += str.slice(0, n);
n -= nb;
if (n === 0) {
if (nb === str.length) {
++c;
if (p.next) this.head = p.next;else this.head = this.tail = null;
} else {
this.head = p;
p.data = str.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
// Consumes a specified amount of bytes from the buffered data.
}, {
key: "_getBuffer",
value: function _getBuffer(n) {
var ret = Buffer.allocUnsafe(n);
var p = this.head;
var c = 1;
p.data.copy(ret);
n -= p.data.length;
while (p = p.next) {
var buf = p.data;
var nb = n > buf.length ? buf.length : n;
buf.copy(ret, ret.length - n, 0, nb);
n -= nb;
if (n === 0) {
if (nb === buf.length) {
++c;
if (p.next) this.head = p.next;else this.head = this.tail = null;
} else {
this.head = p;
p.data = buf.slice(nb);
}
break;
}
++c;
}
this.length -= c;
return ret;
}
// Make sure the linked list only shows the minimal necessary information.
}, {
key: custom,
value: function value(_, options) {
return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
// Only inspect one level.
depth: 0,
// It should not recurse.
customInspect: false
}));
}
}]);
return BufferList;
}();
@@ -0,0 +1,308 @@
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(require("./node"));
var types = _interopRequireWildcard(require("./types"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Container = /*#__PURE__*/function (_Node) {
_inheritsLoose(Container, _Node);
function Container(opts) {
var _this;
_this = _Node.call(this, opts) || this;
if (!_this.nodes) {
_this.nodes = [];
}
return _this;
}
var _proto = Container.prototype;
_proto.append = function append(selector) {
selector.parent = this;
this.nodes.push(selector);
return this;
};
_proto.prepend = function prepend(selector) {
selector.parent = this;
this.nodes.unshift(selector);
return this;
};
_proto.at = function at(index) {
return this.nodes[index];
};
_proto.index = function index(child) {
if (typeof child === 'number') {
return child;
}
return this.nodes.indexOf(child);
};
_proto.removeChild = function removeChild(child) {
child = this.index(child);
this.at(child).parent = undefined;
this.nodes.splice(child, 1);
var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (index >= child) {
this.indexes[id] = index - 1;
}
}
return this;
};
_proto.removeAll = function removeAll() {
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done;) {
var node = _step.value;
node.parent = undefined;
}
this.nodes = [];
return this;
};
_proto.empty = function empty() {
return this.removeAll();
};
_proto.insertAfter = function insertAfter(oldNode, newNode) {
newNode.parent = this;
var oldIndex = this.index(oldNode);
this.nodes.splice(oldIndex + 1, 0, newNode);
newNode.parent = this;
var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (oldIndex <= index) {
this.indexes[id] = index + 1;
}
}
return this;
};
_proto.insertBefore = function insertBefore(oldNode, newNode) {
newNode.parent = this;
var oldIndex = this.index(oldNode);
this.nodes.splice(oldIndex, 0, newNode);
newNode.parent = this;
var index;
for (var id in this.indexes) {
index = this.indexes[id];
if (index <= oldIndex) {
this.indexes[id] = index + 1;
}
}
return this;
};
_proto._findChildAtPosition = function _findChildAtPosition(line, col) {
var found = undefined;
this.each(function (node) {
if (node.atPosition) {
var foundChild = node.atPosition(line, col);
if (foundChild) {
found = foundChild;
return false;
}
} else if (node.isAtPosition(line, col)) {
found = node;
return false;
}
});
return found;
}
/**
* Return the most specific node at the line and column number given.
* The source location is based on the original parsed location, locations aren't
* updated as selector nodes are mutated.
*
* Note that this location is relative to the location of the first character
* of the selector, and not the location of the selector in the overall document
* when used in conjunction with postcss.
*
* If not found, returns undefined.
* @param {number} line The line number of the node to find. (1-based index)
* @param {number} col The column number of the node to find. (1-based index)
*/;
_proto.atPosition = function atPosition(line, col) {
if (this.isAtPosition(line, col)) {
return this._findChildAtPosition(line, col) || this;
} else {
return undefined;
}
};
_proto._inferEndPosition = function _inferEndPosition() {
if (this.last && this.last.source && this.last.source.end) {
this.source = this.source || {};
this.source.end = this.source.end || {};
Object.assign(this.source.end, this.last.source.end);
}
};
_proto.each = function each(callback) {
if (!this.lastEach) {
this.lastEach = 0;
}
if (!this.indexes) {
this.indexes = {};
}
this.lastEach++;
var id = this.lastEach;
this.indexes[id] = 0;
if (!this.length) {
return undefined;
}
var index, result;
while (this.indexes[id] < this.length) {
index = this.indexes[id];
result = callback(this.at(index), index);
if (result === false) {
break;
}
this.indexes[id] += 1;
}
delete this.indexes[id];
if (result === false) {
return false;
}
};
_proto.walk = function walk(callback) {
return this.each(function (node, i) {
var result = callback(node, i);
if (result !== false && node.length) {
result = node.walk(callback);
}
if (result === false) {
return false;
}
});
};
_proto.walkAttributes = function walkAttributes(callback) {
var _this2 = this;
return this.walk(function (selector) {
if (selector.type === types.ATTRIBUTE) {
return callback.call(_this2, selector);
}
});
};
_proto.walkClasses = function walkClasses(callback) {
var _this3 = this;
return this.walk(function (selector) {
if (selector.type === types.CLASS) {
return callback.call(_this3, selector);
}
});
};
_proto.walkCombinators = function walkCombinators(callback) {
var _this4 = this;
return this.walk(function (selector) {
if (selector.type === types.COMBINATOR) {
return callback.call(_this4, selector);
}
});
};
_proto.walkComments = function walkComments(callback) {
var _this5 = this;
return this.walk(function (selector) {
if (selector.type === types.COMMENT) {
return callback.call(_this5, selector);
}
});
};
_proto.walkIds = function walkIds(callback) {
var _this6 = this;
return this.walk(function (selector) {
if (selector.type === types.ID) {
return callback.call(_this6, selector);
}
});
};
_proto.walkNesting = function walkNesting(callback) {
var _this7 = this;
return this.walk(function (selector) {
if (selector.type === types.NESTING) {
return callback.call(_this7, selector);
}
});
};
_proto.walkPseudos = function walkPseudos(callback) {
var _this8 = this;
return this.walk(function (selector) {
if (selector.type === types.PSEUDO) {
return callback.call(_this8, selector);
}
});
};
_proto.walkTags = function walkTags(callback) {
var _this9 = this;
return this.walk(function (selector) {
if (selector.type === types.TAG) {
return callback.call(_this9, selector);
}
});
};
_proto.walkUniversals = function walkUniversals(callback) {
var _this10 = this;
return this.walk(function (selector) {
if (selector.type === types.UNIVERSAL) {
return callback.call(_this10, selector);
}
});
};
_proto.split = function split(callback) {
var _this11 = this;
var current = [];
return this.reduce(function (memo, node, index) {
var split = callback.call(_this11, node);
current.push(node);
if (split) {
memo.push(current);
current = [];
} else if (index === _this11.length - 1) {
memo.push(current);
}
return memo;
}, []);
};
_proto.map = function map(callback) {
return this.nodes.map(callback);
};
_proto.reduce = function reduce(callback, memo) {
return this.nodes.reduce(callback, memo);
};
_proto.every = function every(callback) {
return this.nodes.every(callback);
};
_proto.some = function some(callback) {
return this.nodes.some(callback);
};
_proto.filter = function filter(callback) {
return this.nodes.filter(callback);
};
_proto.sort = function sort(callback) {
return this.nodes.sort(callback);
};
_proto.toString = function toString() {
return this.map(String).join('');
};
_createClass(Container, [{
key: "first",
get: function get() {
return this.at(0);
}
}, {
key: "last",
get: function get() {
return this.at(this.length - 1);
}
}, {
key: "length",
get: function get() {
return this.nodes.length;
}
}]);
return Container;
}(_node["default"]);
exports["default"] = Container;
module.exports = exports.default;
@@ -0,0 +1,328 @@
'use strict';
var utils = require('./utils');
var has = Object.prototype.hasOwnProperty;
var isArray = Array.isArray;
var defaults = {
allowDots: false,
allowEmptyArrays: false,
allowPrototypes: false,
allowSparse: false,
arrayLimit: 20,
charset: 'utf-8',
charsetSentinel: false,
comma: false,
decodeDotInKeys: false,
decoder: utils.decode,
delimiter: '&',
depth: 5,
duplicates: 'combine',
ignoreQueryPrefix: false,
interpretNumericEntities: false,
parameterLimit: 1000,
parseArrays: true,
plainObjects: false,
strictDepth: false,
strictNullHandling: false,
throwOnLimitExceeded: false
};
var interpretNumericEntities = function (str) {
return str.replace(/&#(\d+);/g, function ($0, numberStr) {
return String.fromCharCode(parseInt(numberStr, 10));
});
};
var parseArrayValue = function (val, options, currentArrayLength) {
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
return val.split(',');
}
if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
}
return val;
};
// This is what browsers will submit when the ✓ character occurs in an
// application/x-www-form-urlencoded body and the encoding of the page containing
// the form is iso-8859-1, or when the submitted form has an accept-charset
// attribute of iso-8859-1. Presumably also with other charsets that do not contain
// the ✓ character, such as us-ascii.
var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
var parseValues = function parseQueryStringValues(str, options) {
var obj = { __proto__: null };
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
var parts = cleanStr.split(
options.delimiter,
options.throwOnLimitExceeded ? limit + 1 : limit
);
if (options.throwOnLimitExceeded && parts.length > limit) {
throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
}
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
var i;
var charset = options.charset;
if (options.charsetSentinel) {
for (i = 0; i < parts.length; ++i) {
if (parts[i].indexOf('utf8=') === 0) {
if (parts[i] === charsetSentinel) {
charset = 'utf-8';
} else if (parts[i] === isoSentinel) {
charset = 'iso-8859-1';
}
skipIndex = i;
i = parts.length; // The eslint settings do not allow break;
}
}
}
for (i = 0; i < parts.length; ++i) {
if (i === skipIndex) {
continue;
}
var part = parts[i];
var bracketEqualsPos = part.indexOf(']=');
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
var key;
var val;
if (pos === -1) {
key = options.decoder(part, defaults.decoder, charset, 'key');
val = options.strictNullHandling ? null : '';
} else {
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
val = utils.maybeMap(
parseArrayValue(
part.slice(pos + 1),
options,
isArray(obj[key]) ? obj[key].length : 0
),
function (encodedVal) {
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
}
);
}
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
val = interpretNumericEntities(String(val));
}
if (part.indexOf('[]=') > -1) {
val = isArray(val) ? [val] : val;
}
var existing = has.call(obj, key);
if (existing && options.duplicates === 'combine') {
obj[key] = utils.combine(obj[key], val);
} else if (!existing || options.duplicates === 'last') {
obj[key] = val;
}
}
return obj;
};
var parseObject = function (chain, val, options, valuesParsed) {
var currentArrayLength = 0;
if (chain.length > 0 && chain[chain.length - 1] === '[]') {
var parentKey = chain.slice(0, -1).join('');
currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
}
var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
for (var i = chain.length - 1; i >= 0; --i) {
var obj;
var root = chain[i];
if (root === '[]' && options.parseArrays) {
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
? []
: utils.combine([], leaf);
} else {
obj = options.plainObjects ? { __proto__: null } : {};
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
var index = parseInt(decodedRoot, 10);
if (!options.parseArrays && decodedRoot === '') {
obj = { 0: leaf };
} else if (
!isNaN(index)
&& root !== decodedRoot
&& String(index) === decodedRoot
&& index >= 0
&& (options.parseArrays && index <= options.arrayLimit)
) {
obj = [];
obj[index] = leaf;
} else if (decodedRoot !== '__proto__') {
obj[decodedRoot] = leaf;
}
}
leaf = obj;
}
return leaf;
};
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
if (!givenKey) {
return;
}
// Transform dot notation to bracket notation
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
// The regex chunks
var brackets = /(\[[^[\]]*])/;
var child = /(\[[^[\]]*])/g;
// Get the parent
var segment = options.depth > 0 && brackets.exec(key);
var parent = segment ? key.slice(0, segment.index) : key;
// Stash the parent if it exists
var keys = [];
if (parent) {
// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
if (!options.plainObjects && has.call(Object.prototype, parent)) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(parent);
}
// Loop through children appending to the array until we hit depth
var i = 0;
while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
i += 1;
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(segment[1]);
}
// If there's a remainder, check strictDepth option for throw, else just add whatever is left
if (segment) {
if (options.strictDepth === true) {
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
}
keys.push('[' + key.slice(segment.index) + ']');
}
return parseObject(keys, val, options, valuesParsed);
};
var normalizeParseOptions = function normalizeParseOptions(opts) {
if (!opts) {
return defaults;
}
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
}
if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {
throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');
}
if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {
throw new TypeError('Decoder has to be a function.');
}
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
}
if (typeof opts.throwOnLimitExceeded !== 'undefined' && typeof opts.throwOnLimitExceeded !== 'boolean') {
throw new TypeError('`throwOnLimitExceeded` option must be a boolean');
}
var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates;
if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {
throw new TypeError('The duplicates option must be either combine, first, or last');
}
var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
return {
allowDots: allowDots,
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
charset: charset,
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
duplicates: duplicates,
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
parseArrays: opts.parseArrays !== false,
plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
};
};
module.exports = function (str, opts) {
var options = normalizeParseOptions(opts);
if (str === '' || str === null || typeof str === 'undefined') {
return options.plainObjects ? { __proto__: null } : {};
}
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
var obj = options.plainObjects ? { __proto__: null } : {};
// Iterate over the keys and setup the new object
var keys = Object.keys(tempObj);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
obj = utils.merge(obj, newObj, options);
}
if (options.allowSparse === true) {
return obj;
}
return utils.compact(obj);
};
@@ -0,0 +1,413 @@
export default `flf2a$ 4 3 10 0 3
italic.flf Version 2
by: Bas Meijer meijer@info.win.tue.nl bas@damek.kth.se
fixed by: Ryan Youck youck@cs.uregina.ca
$@
$@
$@
@@
@
| @
. @
@@
// @
$$ @
@
@@
@
_|_|_ @
-|-|- @
@@
||_ @
(||$ @
_||) @
|| @@
@
0/ @
/0 @
@@
@
()/ @
(X @
@@
/ @
$ @
$ @
@@
$/ @
($ @
$\\ @
@@
\\$ @
$) @
/$ @
@@
$ $@
$\\/$@
$/\\$@
$ $@@
$ $@
$_|_$@
$ | $@
$ $@@
$@
$$@
,$@
$@@
$ $@
$__$@
$ $@
$ $@@
$@
$ $@
. $@
$@@
@
$/ @
/$ @
@@
__ @
/ ) @
(__/ @
@@
@
-/ @
/ @
@@
_ @
_) @
/__ @
@@
_ @
_) @
__) @
@@
@
(_/ @
/ @
@@
__ @
/_ @
__) @
@@
__ @
/_ @
(__) @
@@
___ @
_/ @
/ @
@@
_ @
(_) @
(__) @
@@
__ @
(__) @
__/ @
@@
@
. @
. @
@@
@
. @
, @
@@
$ $@
$/$@
$\\$@
$ $@@
$ $@
$__$@
$--$@
$ $@@
$ $@
$\\$@
$/$@
$ $@@
$ _ @
$ )@
$ . @
$ @@
@
@
@
@@
_ @
/_| @
( | @
@@
__ @
/ _) @
/(_) @
@@
_ @
/ ) @
(__ @
@@
__ @
/ ) @
/(_/ @
@@
___ @
(_ @
/__ @
@@
___ @
(_ $ @
/$ @
@@
__ @
/ _ @
(__) @
@@
@
)__/ @
/ / @
@@
@
/ @
( @
@@
@
/ @
(_/ @
@@
@
/__/ @
/ ) @
@@
@
/ @
(__ @
@@
@
/|/| @
/ | @
@@
@
/| ) @
/ |/ @
@@
__ @
/ ) @
(__/ @
@@
__ @
/__) @
/ $ @
@@
__ @
/ ) @
(__\\ @
@@
__ @
/__) @
/ ($ @
@@
__ @
( @
__) @
@@
____ @
/ $ @
( @
@@
@
/ / @
(__/ @
@@
@
( / @
|_/ @
@@
@
( / @
|/|/ @
@@
@
\\_) @
( \\ @
@@
@
(__/ @
/$ @
@@
__ @
_/ @
/__ @
@@
_ @
|$ @
|_ @
@@
@
\\ @
\\ @
@@
_ @
$| @
_| @
@@
@
/\\ @
$$ @
@@
@
@
__ @
@@
\\ @
$ @
$ @
@@
@
_ @
(/ @
@@
@
/ @
() @
@@
@
_ @
($ @
@@
@
_/ @
(/ @
@@
@
_$@
(- @
@@
_ @
(_ @
/$ @
@@
@
_ @
(/ @
_/ @@
@
/ @
/) @
@@
@
' @
/ @
@@
@
' @
/ @
_/ @@
@
/ @
/( @
@@
@
/ @
( @
@@
@
_ @
//) @
@@
@
@
/) @
@@
@
@
() @
@@
@
@
/) @
/ @@
@
_ @
(/ @
/ @@
@
_ @
/$ @
@@
@
$_ @
_)$ @
@@
@
_/ @
/ @
@@
@
$ @
(/ @
@@
@
$$ @
\\/ @
@@
@
$$ @
((/ @
@@
@
$$ @
)( @
@@
@
$ @
(/ @
/ @@
@
_ @
/_ @
@@
( @
< @
( @
@@
| @
| @
| @
@@
) @
> @
) @
@@
@
/\\/ @
@
@@
o_o @
/_| @
( | @
@@
o__o @
/ ) @
(__/ @
@@
o o@
/ / @
(__/ @
@@
@
-_-@
(/ @
@@
@
-- @
() @
@@
@
- -@
(/ @
@@
__ @
/ _) @
/(_) @
/ @@
`
@@ -0,0 +1,6 @@
{
"private": true,
"types": "../dist/types/client.d.ts",
"main": "../dist/cjs/client.js",
"module": "../dist/es/client.mjs"
}
@@ -0,0 +1,91 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = memoize;
var _setImmediate = require('./internal/setImmediate.js');
var _setImmediate2 = _interopRequireDefault(_setImmediate);
var _initialParams = require('./internal/initialParams.js');
var _initialParams2 = _interopRequireDefault(_initialParams);
var _wrapAsync = require('./internal/wrapAsync.js');
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Caches the results of an async function. When creating a hash to store
* function results against, the callback is omitted from the hash and an
* optional hash function can be used.
*
* **Note: if the async function errs, the result will not be cached and
* subsequent calls will call the wrapped function.**
*
* If no hash function is specified, the first argument is used as a hash key,
* which may work reasonably if it is a string or a data type that converts to a
* distinct string. Note that objects and arrays will not behave reasonably.
* Neither will cases where the other arguments are significant. In such cases,
* specify your own hash function.
*
* The cache of results is exposed as the `memo` property of the function
* returned by `memoize`.
*
* @name memoize
* @static
* @memberOf module:Utils
* @method
* @category Util
* @param {AsyncFunction} fn - The async function to proxy and cache results from.
* @param {Function} hasher - An optional function for generating a custom hash
* for storing results. It has all the arguments applied to it apart from the
* callback, and must be synchronous.
* @returns {AsyncFunction} a memoized version of `fn`
* @example
*
* var slow_fn = function(name, callback) {
* // do something
* callback(null, result);
* };
* var fn = async.memoize(slow_fn);
*
* // fn can now be used as if it were slow_fn
* fn('some name', function() {
* // callback
* });
*/
function memoize(fn, hasher = v => v) {
var memo = Object.create(null);
var queues = Object.create(null);
var _fn = (0, _wrapAsync2.default)(fn);
var memoized = (0, _initialParams2.default)((args, callback) => {
var key = hasher(...args);
if (key in memo) {
(0, _setImmediate2.default)(() => callback(null, ...memo[key]));
} else if (key in queues) {
queues[key].push(callback);
} else {
queues[key] = [callback];
_fn(...args, (err, ...resultArgs) => {
// #1465 don't memoize if an error occurred
if (!err) {
memo[key] = resultArgs;
}
var q = queues[key];
delete queues[key];
for (var i = 0, l = q.length; i < l; i++) {
q[i](err, ...resultArgs);
}
});
}
});
memoized.memo = memo;
memoized.unmemoized = fn;
return memoized;
}
module.exports = exports.default;
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MacData = void 0;
const tslib_1 = require("tslib");
const asn1_rsa_1 = require("@peculiar/asn1-rsa");
const asn1_schema_1 = require("@peculiar/asn1-schema");
class MacData {
constructor(params = {}) {
this.mac = new asn1_rsa_1.DigestInfo();
this.macSalt = new asn1_schema_1.OctetString();
this.iterations = 1;
Object.assign(this, params);
}
}
exports.MacData = MacData;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_rsa_1.DigestInfo })
], MacData.prototype, "mac", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], MacData.prototype, "macSalt", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, defaultValue: 1 })
], MacData.prototype, "iterations", void 0);
@@ -0,0 +1,57 @@
var createWrap = require('./_createWrap');
/** Used to compose bitmasks for function metadata. */
var WRAP_CURRY_FLAG = 8;
/**
* Creates a function that accepts arguments of `func` and either invokes
* `func` returning its result, if at least `arity` number of arguments have
* been provided, or returns a function that accepts the remaining `func`
* arguments, and so on. The arity of `func` may be specified if `func.length`
* is not sufficient.
*
* The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for provided arguments.
*
* **Note:** This method doesn't set the "length" property of curried functions.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
* var abc = function(a, b, c) {
* return [a, b, c];
* };
*
* var curried = _.curry(abc);
*
* curried(1)(2)(3);
* // => [1, 2, 3]
*
* curried(1, 2)(3);
* // => [1, 2, 3]
*
* curried(1, 2, 3);
* // => [1, 2, 3]
*
* // Curried with placeholders.
* curried(1)(_, 3)(2);
* // => [1, 2, 3]
*/
function curry(func, arity, guard) {
arity = guard ? undefined : arity;
var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
result.placeholder = curry.placeholder;
return result;
}
// Assign default placeholders.
curry.placeholder = {};
module.exports = curry;
@@ -0,0 +1,7 @@
import { a as addObject, b as addNumber } from "./addObject-CJjLNrjF.mjs";
function subtract(date, num, unit) {
return typeof num === "object" && num !== null ? addObject(date, num, -1) : addNumber(date, -num, unit);
}
export {
subtract as default
};
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CAAsB,MAAsB,EAAE,YAAmB;IAC/E,MAAM,iBAAiB,CAAA,GAAA,aAAK,EAAE;IAC9B,MAAM,WAAW,CAAA,GAAA,aAAK,EAAgB;IAEtC,CAAA,GAAA,yCAAc,EAAE;QACd,eAAe,OAAO,GAAG;QACzB,OAAO;YACL,eAAe,OAAO,GAAG;QAC3B;IACF,GAAG,EAAE;IAEL,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,eAAe,OAAO,EACxB,eAAe,OAAO,GAAG;aACpB,IAAI,CAAC,SAAS,OAAO,IAAI,aAAa,IAAI,CAAC,CAAC,KAAK,IAAM,CAAC,OAAO,EAAE,CAAC,KAAK,QAAQ,CAAC,EAAE,IACvF;QAEF,SAAS,OAAO,GAAG;IACnB,uDAAuD;IACzD,GAAG;AACL","sources":["packages/@react-aria/utils/src/useUpdateLayoutEffect.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {EffectCallback, useRef} from 'react';\nimport {useLayoutEffect} from './useLayoutEffect';\n\n// Like useLayoutEffect, but only called for updates after the initial render.\nexport function useUpdateLayoutEffect(effect: EffectCallback, dependencies: any[]): void {\n const isInitialMount = useRef(true);\n const lastDeps = useRef<any[] | null>(null);\n\n useLayoutEffect(() => {\n isInitialMount.current = true;\n return () => {\n isInitialMount.current = false;\n };\n }, []);\n\n useLayoutEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n } else if (!lastDeps.current || dependencies.some((dep, i) => !Object.is(dep, lastDeps[i]))) {\n effect();\n }\n lastDeps.current = dependencies;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n}\n"],"names":[],"version":3,"file":"useUpdateLayoutEffect.module.js.map"}
@@ -0,0 +1,33 @@
'use strict';
module.exports = function (getPrototypeOf, t) {
t.test('nullish value', function (st) {
st['throws'](function () { return getPrototypeOf(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { return getPrototypeOf(null); }, TypeError, 'null is not an object');
st.end();
});
t['throws'](function () { getPrototypeOf(true); }, 'throws for true');
t['throws'](function () { getPrototypeOf(false); }, 'throws for false');
t['throws'](function () { getPrototypeOf(42); }, 'throws for 42');
t['throws'](function () { getPrototypeOf(NaN); }, 'throws for NaN');
t['throws'](function () { getPrototypeOf(0); }, 'throws for +0');
t['throws'](function () { getPrototypeOf(-0); }, 'throws for -0');
t['throws'](function () { getPrototypeOf(Infinity); }, 'throws for ∞');
t['throws'](function () { getPrototypeOf(-Infinity); }, 'throws for -∞');
t['throws'](function () { getPrototypeOf(''); }, 'throws for empty string');
t['throws'](function () { getPrototypeOf('foo'); }, 'throws for non-empty string');
t.equal(getPrototypeOf(/a/g), RegExp.prototype);
t.equal(getPrototypeOf(new Date()), Date.prototype);
t.equal(getPrototypeOf(function () {}), Function.prototype);
t.equal(getPrototypeOf([]), Array.prototype);
t.equal(getPrototypeOf({}), Object.prototype);
var obj = { __proto__: null };
if ('toString' in obj) {
t.comment('no null objects in this engine');
t.equal(getPrototypeOf(obj), Object.prototype, '"null" object has Object.prototype as [[Prototype]]');
} else {
t.equal(getPrototypeOf(obj), null, 'null object has null [[Prototype]]');
}
};
@@ -0,0 +1,28 @@
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
export { _iterableToArrayLimit as default };
@@ -0,0 +1,77 @@
{
"name": "normalize-path",
"description": "Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.",
"version": "3.0.0",
"homepage": "https://github.com/jonschlinkert/normalize-path",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"Blaine Bublitz (https://twitter.com/BlaineBublitz)",
"Jon Schlinkert (http://twitter.com/jonschlinkert)"
],
"repository": "jonschlinkert/normalize-path",
"bugs": {
"url": "https://github.com/jonschlinkert/normalize-path/issues"
},
"license": "MIT",
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"devDependencies": {
"gulp-format-md": "^1.0.0",
"minimist": "^1.2.0",
"mocha": "^3.5.3"
},
"keywords": [
"absolute",
"backslash",
"delimiter",
"file",
"file-path",
"filepath",
"fix",
"forward",
"fp",
"fs",
"normalize",
"path",
"relative",
"separator",
"slash",
"slashes",
"trailing",
"unix",
"urix"
],
"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"description": "Other useful path-related libraries:",
"list": [
"contains-path",
"is-absolute",
"is-relative",
"parse-filepath",
"path-ends-with",
"path-ends-with",
"unixify"
]
},
"lint": {
"reflinks": true
}
}
}
@@ -0,0 +1,491 @@
"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 });
exports.GenericReferenceParameterListMapping = GenericReferenceParameterListMapping;
exports.GenericReferenceMapping = GenericReferenceMapping;
exports.GenericArgumentsListMapping = GenericArgumentsListMapping;
exports.GenericArgumentsMapping = GenericArgumentsMapping;
exports.KeywordStringMapping = KeywordStringMapping;
exports.KeywordNumberMapping = KeywordNumberMapping;
exports.KeywordBooleanMapping = KeywordBooleanMapping;
exports.KeywordUndefinedMapping = KeywordUndefinedMapping;
exports.KeywordNullMapping = KeywordNullMapping;
exports.KeywordIntegerMapping = KeywordIntegerMapping;
exports.KeywordBigIntMapping = KeywordBigIntMapping;
exports.KeywordUnknownMapping = KeywordUnknownMapping;
exports.KeywordAnyMapping = KeywordAnyMapping;
exports.KeywordNeverMapping = KeywordNeverMapping;
exports.KeywordSymbolMapping = KeywordSymbolMapping;
exports.KeywordVoidMapping = KeywordVoidMapping;
exports.KeywordMapping = KeywordMapping;
exports.LiteralStringMapping = LiteralStringMapping;
exports.LiteralNumberMapping = LiteralNumberMapping;
exports.LiteralBooleanMapping = LiteralBooleanMapping;
exports.LiteralMapping = LiteralMapping;
exports.KeyOfMapping = KeyOfMapping;
exports.IndexArrayMapping = IndexArrayMapping;
exports.ExtendsMapping = ExtendsMapping;
exports.BaseMapping = BaseMapping;
exports.FactorMapping = FactorMapping;
exports.ExprTermTailMapping = ExprTermTailMapping;
exports.ExprTermMapping = ExprTermMapping;
exports.ExprTailMapping = ExprTailMapping;
exports.ExprMapping = ExprMapping;
exports.TypeMapping = TypeMapping;
exports.PropertyKeyMapping = PropertyKeyMapping;
exports.ReadonlyMapping = ReadonlyMapping;
exports.OptionalMapping = OptionalMapping;
exports.PropertyMapping = PropertyMapping;
exports.PropertyDelimiterMapping = PropertyDelimiterMapping;
exports.PropertyListMapping = PropertyListMapping;
exports.ObjectMapping = ObjectMapping;
exports.ElementListMapping = ElementListMapping;
exports.TupleMapping = TupleMapping;
exports.ParameterMapping = ParameterMapping;
exports.ParameterListMapping = ParameterListMapping;
exports.FunctionMapping = FunctionMapping;
exports.ConstructorMapping = ConstructorMapping;
exports.MappedMapping = MappedMapping;
exports.AsyncIteratorMapping = AsyncIteratorMapping;
exports.IteratorMapping = IteratorMapping;
exports.ArgumentMapping = ArgumentMapping;
exports.AwaitedMapping = AwaitedMapping;
exports.ArrayMapping = ArrayMapping;
exports.RecordMapping = RecordMapping;
exports.PromiseMapping = PromiseMapping;
exports.ConstructorParametersMapping = ConstructorParametersMapping;
exports.FunctionParametersMapping = FunctionParametersMapping;
exports.InstanceTypeMapping = InstanceTypeMapping;
exports.ReturnTypeMapping = ReturnTypeMapping;
exports.PartialMapping = PartialMapping;
exports.RequiredMapping = RequiredMapping;
exports.PickMapping = PickMapping;
exports.OmitMapping = OmitMapping;
exports.ExcludeMapping = ExcludeMapping;
exports.ExtractMapping = ExtractMapping;
exports.UppercaseMapping = UppercaseMapping;
exports.LowercaseMapping = LowercaseMapping;
exports.CapitalizeMapping = CapitalizeMapping;
exports.UncapitalizeMapping = UncapitalizeMapping;
exports.DateMapping = DateMapping;
exports.Uint8ArrayMapping = Uint8ArrayMapping;
exports.ReferenceMapping = ReferenceMapping;
const T = __importStar(require("../type/index"));
// prettier-ignore
const Dereference = (context, key) => {
return key in context ? context[key] : T.Ref(key);
};
// prettier-ignore
const DelimitedDecode = (input, result = []) => {
return input.reduce((result, left) => {
return T.ValueGuard.IsArray(left) && left.length === 2
? [...result, left[0]]
: [...result, left];
}, []);
};
// prettier-ignore
const Delimited = (input) => {
const [left, right] = input;
return DelimitedDecode([...left, ...right]);
};
// prettier-ignore
function GenericReferenceParameterListMapping(input, context) {
return Delimited(input);
}
// prettier-ignore
function GenericReferenceMapping(input, context) {
const type = Dereference(context, input[0]);
const args = input[2];
return T.Instantiate(type, args);
}
// prettier-ignore
function GenericArgumentsListMapping(input, context) {
return Delimited(input);
}
// ...
// prettier-ignore
const GenericArgumentsContext = (_arguments, context) => {
return _arguments.reduce((result, arg, index) => {
return { ...result, [arg]: T.Argument(index) };
}, context);
};
// prettier-ignore
function GenericArgumentsMapping(input, context) {
return input.length === 3
? GenericArgumentsContext(input[1], context)
: {};
}
// prettier-ignore
function KeywordStringMapping(input, context) {
return T.String();
}
// prettier-ignore
function KeywordNumberMapping(input, context) {
return T.Number();
}
// prettier-ignore
function KeywordBooleanMapping(input, context) {
return T.Boolean();
}
// prettier-ignore
function KeywordUndefinedMapping(input, context) {
return T.Undefined();
}
// prettier-ignore
function KeywordNullMapping(input, context) {
return T.Null();
}
// prettier-ignore
function KeywordIntegerMapping(input, context) {
return T.Integer();
}
// prettier-ignore
function KeywordBigIntMapping(input, context) {
return T.BigInt();
}
// prettier-ignore
function KeywordUnknownMapping(input, context) {
return T.Unknown();
}
// prettier-ignore
function KeywordAnyMapping(input, context) {
return T.Any();
}
// prettier-ignore
function KeywordNeverMapping(input, context) {
return T.Never();
}
// prettier-ignore
function KeywordSymbolMapping(input, context) {
return T.Symbol();
}
// prettier-ignore
function KeywordVoidMapping(input, context) {
return T.Void();
}
// prettier-ignore
function KeywordMapping(input, context) {
return input;
}
// prettier-ignore
function LiteralStringMapping(input, context) {
return T.Literal(input);
}
// prettier-ignore
function LiteralNumberMapping(input, context) {
return T.Literal(parseFloat(input));
}
// prettier-ignore
function LiteralBooleanMapping(input, context) {
return T.Literal(input === 'true');
}
// prettier-ignore
function LiteralMapping(input, context) {
return input;
}
// prettier-ignore
function KeyOfMapping(input, context) {
return input.length > 0;
}
// prettier-ignore
function IndexArrayMapping(input, context) {
return input.reduce((result, current) => {
return current.length === 3
? [...result, [current[1]]]
: [...result, []];
}, []);
}
// prettier-ignore
function ExtendsMapping(input, context) {
return input.length === 6
? [input[1], input[3], input[5]]
: [];
}
// prettier-ignore
function BaseMapping(input, context) {
return T.ValueGuard.IsArray(input) && input.length === 3 ? input[1] : input;
}
// ...
// prettier-ignore
const FactorIndexArray = (Type, indexArray) => {
return indexArray.reduceRight((result, right) => {
const _right = right;
return (_right.length === 1 ? T.Index(result, _right[0]) :
_right.length === 0 ? T.Array(result, _right[0]) :
T.Never());
}, Type);
};
// prettier-ignore
const FactorExtends = (Type, Extends) => {
return Extends.length === 3
? T.Extends(Type, Extends[0], Extends[1], Extends[2])
: Type;
};
// prettier-ignore
function FactorMapping(input, context) {
const [KeyOf, Type, IndexArray, Extends] = input;
return KeyOf
? FactorExtends(T.KeyOf(FactorIndexArray(Type, IndexArray)), Extends)
: FactorExtends(FactorIndexArray(Type, IndexArray), Extends);
}
// prettier-ignore
function ExprBinaryMapping(Left, Rest) {
return (Rest.length === 3 ? (() => {
const [Operator, Right, Next] = Rest;
const Schema = ExprBinaryMapping(Right, Next);
if (Operator === '&') {
return T.TypeGuard.IsIntersect(Schema)
? T.Intersect([Left, ...Schema.allOf])
: T.Intersect([Left, Schema]);
}
if (Operator === '|') {
return T.TypeGuard.IsUnion(Schema)
? T.Union([Left, ...Schema.anyOf])
: T.Union([Left, Schema]);
}
throw 1;
})() : Left);
}
// prettier-ignore
function ExprTermTailMapping(input, context) {
return input;
}
// prettier-ignore
function ExprTermMapping(input, context) {
const [left, rest] = input;
return ExprBinaryMapping(left, rest);
}
// prettier-ignore
function ExprTailMapping(input, context) {
return input;
}
// prettier-ignore
function ExprMapping(input, context) {
const [left, rest] = input;
return ExprBinaryMapping(left, rest);
}
// prettier-ignore
function TypeMapping(input, context) {
return input;
}
// prettier-ignore
function PropertyKeyMapping(input, context) {
return input;
}
// prettier-ignore
function ReadonlyMapping(input, context) {
return input.length > 0;
}
// prettier-ignore
function OptionalMapping(input, context) {
return input.length > 0;
}
// prettier-ignore
function PropertyMapping(input, context) {
const [isReadonly, key, isOptional, _colon, type] = input;
return {
[key]: (isReadonly && isOptional ? T.ReadonlyOptional(type) :
isReadonly && !isOptional ? T.Readonly(type) :
!isReadonly && isOptional ? T.Optional(type) :
type)
};
}
// prettier-ignore
function PropertyDelimiterMapping(input, context) {
return input;
}
// prettier-ignore
function PropertyListMapping(input, context) {
return Delimited(input);
}
// prettier-ignore
function ObjectMapping(input, context) {
const propertyList = input[1];
return T.Object(propertyList.reduce((result, property) => {
return { ...result, ...property };
}, {}));
}
// prettier-ignore
function ElementListMapping(input, context) {
return Delimited(input);
}
// prettier-ignore
function TupleMapping(input, context) {
return T.Tuple(input[1]);
}
// prettier-ignore
function ParameterMapping(input, context) {
const [_ident, _colon, type] = input;
return type;
}
// prettier-ignore
function ParameterListMapping(input, context) {
return Delimited(input);
}
// prettier-ignore
function FunctionMapping(input, context) {
const [_lparan, parameterList, _rparan, _arrow, returnType] = input;
return T.Function(parameterList, returnType);
}
// prettier-ignore
function ConstructorMapping(input, context) {
const [_new, _lparan, parameterList, _rparan, _arrow, instanceType] = input;
return T.Constructor(parameterList, instanceType);
}
// prettier-ignore
function MappedMapping(input, context) {
const [_lbrace, _lbracket, _key, _in, _right, _rbracket, _colon, _type] = input;
return T.Literal('Mapped types not supported');
}
// prettier-ignore
function AsyncIteratorMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.AsyncIterator(type);
}
// prettier-ignore
function IteratorMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Iterator(type);
}
// prettier-ignore
function ArgumentMapping(input, context) {
return T.KindGuard.IsLiteralNumber(input[2])
? T.Argument(Math.trunc(input[2].const))
: T.Never();
}
// prettier-ignore
function AwaitedMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Awaited(type);
}
// prettier-ignore
function ArrayMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Array(type);
}
// prettier-ignore
function RecordMapping(input, context) {
const [_name, _langle, key, _comma, type, _rangle] = input;
return T.Record(key, type);
}
// prettier-ignore
function PromiseMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Promise(type);
}
// prettier-ignore
function ConstructorParametersMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.ConstructorParameters(type);
}
// prettier-ignore
function FunctionParametersMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Parameters(type);
}
// prettier-ignore
function InstanceTypeMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.InstanceType(type);
}
// prettier-ignore
function ReturnTypeMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.ReturnType(type);
}
// prettier-ignore
function PartialMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Partial(type);
}
// prettier-ignore
function RequiredMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Required(type);
}
// prettier-ignore
function PickMapping(input, context) {
const [_name, _langle, key, _comma, type, _rangle] = input;
return T.Pick(key, type);
}
// prettier-ignore
function OmitMapping(input, context) {
const [_name, _langle, key, _comma, type, _rangle] = input;
return T.Omit(key, type);
}
// prettier-ignore
function ExcludeMapping(input, context) {
const [_name, _langle, key, _comma, type, _rangle] = input;
return T.Exclude(key, type);
}
// prettier-ignore
function ExtractMapping(input, context) {
const [_name, _langle, key, _comma, type, _rangle] = input;
return T.Extract(key, type);
}
// prettier-ignore
function UppercaseMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Uppercase(type);
}
// prettier-ignore
function LowercaseMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Lowercase(type);
}
// prettier-ignore
function CapitalizeMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Capitalize(type);
}
// prettier-ignore
function UncapitalizeMapping(input, context) {
const [_name, _langle, type, _rangle] = input;
return T.Uncapitalize(type);
}
// prettier-ignore
function DateMapping(input, context) {
return T.Date();
}
// prettier-ignore
function Uint8ArrayMapping(input, context) {
return T.Uint8Array();
}
// prettier-ignore
function ReferenceMapping(input, context) {
const target = Dereference(context, input);
return target;
}
@@ -0,0 +1,18 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true);
var $isExtensible = GetIntrinsic('%Object.isExtensible%', true);
var isPrimitive = require('../helpers/isPrimitive');
// https://262.ecma-international.org/6.0/#sec-isextensible-o
module.exports = $preventExtensions
? function IsExtensible(obj) {
return !isPrimitive(obj) && $isExtensible(obj);
}
: function IsExtensible(obj) {
return !isPrimitive(obj);
};
@@ -0,0 +1 @@
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAOD,SAAS,kCAAe,KAA0B;IAChD,OAAO;AACT;AAEA,kCAAY,iBAAiB,GAAG,UAAU,kBAAqB,KAA0B,EAAE,OAAoC;IAC7H,IAAI,YAAC,QAAQ,WAAE,OAAO,EAAC,GAAG;IAE1B,4DAA4D;IAC5D,QAAQ,OAAO,GAAG,EAAE;IAEpB,IAAI,OAAO,aAAa,YAAY;QAClC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM;QAGlB,KAAK,IAAI,UAAU,QACjB,MAAM;YACJ,MAAM;YACN,OAAO;YACP,UAAU;QACZ;IAEJ,OAAO;QACL,IAAI,UAA4B,EAAE;QAClC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;YAC/B,QAAQ,IAAI,CAAC;gBACX,MAAM;gBACN,SAAS;YACX;QACF;QAEA,OAAO;IACT;AACF;AAEA;;;CAGC,GACD,oEAAoE;AACpE,IAAI,4CAAe","sources":["packages/@react-stately/table/src/TableHeader.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 {CollectionBuilderContext} from './useTableState';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\nimport {TableHeaderProps} from '@react-types/table';\n\nfunction TableHeader<T>(props: TableHeaderProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nTableHeader.getCollectionNode = function* getCollectionNode<T>(props: TableHeaderProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>, void, any> {\n let {children, columns} = props;\n\n // Clear columns so they aren't double added in strict mode.\n context.columns = [];\n\n if (typeof children === 'function') {\n if (!columns) {\n throw new Error('props.children was a function but props.columns is missing');\n }\n\n for (let column of columns) {\n yield {\n type: 'column',\n value: column,\n renderer: children\n };\n }\n } else {\n let columns: PartialNode<T>[] = [];\n React.Children.forEach(children, column => {\n columns.push({\n type: 'column',\n element: column\n });\n });\n\n yield* columns;\n }\n};\n\n/**\n * A TableHeader is a container for the Column elements in a Table. Columns can be statically defined\n * as children, or generated dynamically using a function based on the data passed to the `columns` prop.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _TableHeader = TableHeader as <T>(props: TableHeaderProps<T>) => JSX.Element;\nexport {_TableHeader as TableHeader};\n"],"names":[],"version":3,"file":"TableHeader.module.js.map"}
@@ -0,0 +1,10 @@
/**
* Encode a code point as a character reference.
*
* @param {number} code
* Code point to encode.
* @returns {string}
* Encoded character reference.
*/
export function encodeCharacterReference(code: number): string;
//# sourceMappingURL=encode-character-reference.d.ts.map
@@ -0,0 +1,53 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"
const { checkExistence, messages } = require("../util/check-existence")
const getAllowModules = require("../util/get-allow-modules")
const getResolvePaths = require("../util/get-resolve-paths")
const getResolverConfig = require("../util/get-resolver-config")
const getTSConfig = require("../util/get-tsconfig")
const getTryExtensions = require("../util/get-try-extensions")
const getTypescriptExtensionMap = require("../util/get-typescript-extension-map")
const visitRequire = require("../util/visit-require")
/** @type {import('./rule-module').RuleModule} */
module.exports = {
meta: {
docs: {
description:
"disallow `require()` expressions which import missing modules",
recommended: true,
url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-missing-require.md",
},
type: "problem",
fixable: null,
schema: [
{
type: "object",
properties: {
allowModules: getAllowModules.schema,
tryExtensions: getTryExtensions.schema,
resolvePaths: getResolvePaths.schema,
resolverConfig: getResolverConfig.schema,
typescriptExtensionMap: getTypescriptExtensionMap.schema,
tsconfigPath: getTSConfig.schema,
},
additionalProperties: false,
},
],
messages,
},
create(context) {
const filePath = context.filename ?? context.getFilename()
if (filePath === "<input>") {
return {}
}
return visitRequire(context, {}, targets => {
checkExistence(context, targets)
})
},
}
@@ -0,0 +1,151 @@
// Unique symbol cannot be declared in a namespace directly, so we declare it top-level
// See: https://github.com/sindresorhus/map-obj/pull/38#discussion_r702396878
declare const skipSymbol: unique symbol;
declare namespace mapObject {
type Mapper<
SourceObjectType extends {[key: string]: any},
MappedObjectKeyType extends string,
MappedObjectValueType
> = (
sourceKey: keyof SourceObjectType,
sourceValue: SourceObjectType[keyof SourceObjectType],
source: SourceObjectType
) => [
targetKey: MappedObjectKeyType,
targetValue: MappedObjectValueType,
mapperOptions?: mapObject.MapperOptions
] | typeof mapObject.mapObjectSkip;
interface Options {
/**
Recurse nested objects and objects in arrays.
@default false
*/
deep?: boolean;
/**
Target object to map properties on to.
@default {}
*/
target?: {[key: string]: any};
}
interface DeepOptions extends Options {
deep: true;
}
interface TargetOptions<TargetObjectType extends {[key: string]: any}> extends Options {
target: TargetObjectType;
}
interface MapperOptions {
/**
Whether `targetValue` should be recursed.
Requires `deep: true`.
@default true
*/
readonly shouldRecurse?: boolean;
}
/**
Return this value from a `mapper` function to remove a key from an object.
@example
```
const mapObject = require('map-obj');
const object = {one: 1, two: 2}
const mapper = (key, value) => value === 1 ? [key, value] : mapObject.mapObjectSkip
const result = mapObject(object, mapper);
console.log(result);
//=> {one: 1}
```
*/
const mapObjectSkip: typeof skipSymbol
}
/**
Map object keys and values into a new object.
@param source - Source object to copy properties from.
@param mapper - Mapping function.
@example
```
import mapObject = require('map-obj');
const newObject = mapObject({foo: 'bar'}, (key, value) => [value, key]);
//=> {bar: 'foo'}
const newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value]);
//=> {foo: true, bar: {bAz: true}}
const newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value], {deep: true});
//=> {foo: true, bar: {baz: true}}
const newObject = mapObject({one: 1, two: 2}, (key, value) => value === 1 ? [key, value] : mapObject.mapObjectSkip);
//=> {one: 1}
```
*/
declare function mapObject<
SourceObjectType extends object,
TargetObjectType extends {[key: string]: any},
MappedObjectKeyType extends string,
MappedObjectValueType
>(
source: SourceObjectType,
mapper: mapObject.Mapper<
SourceObjectType,
MappedObjectKeyType,
MappedObjectValueType
>,
options: mapObject.DeepOptions & mapObject.TargetOptions<TargetObjectType>
): TargetObjectType & {[key: string]: unknown};
declare function mapObject<
SourceObjectType extends object,
MappedObjectKeyType extends string,
MappedObjectValueType
>(
source: SourceObjectType,
mapper: mapObject.Mapper<
SourceObjectType,
MappedObjectKeyType,
MappedObjectValueType
>,
options: mapObject.DeepOptions
): {[key: string]: unknown};
declare function mapObject<
SourceObjectType extends {[key: string]: any},
TargetObjectType extends {[key: string]: any},
MappedObjectKeyType extends string,
MappedObjectValueType
>(
source: SourceObjectType,
mapper: mapObject.Mapper<
SourceObjectType,
MappedObjectKeyType,
MappedObjectValueType
>,
options: mapObject.TargetOptions<TargetObjectType>
): TargetObjectType & {[K in MappedObjectKeyType]: MappedObjectValueType};
declare function mapObject<
SourceObjectType extends {[key: string]: any},
MappedObjectKeyType extends string,
MappedObjectValueType
>(
source: SourceObjectType,
mapper: mapObject.Mapper<
SourceObjectType,
MappedObjectKeyType,
MappedObjectValueType
>,
options?: mapObject.Options
): {[K in MappedObjectKeyType]: MappedObjectValueType};
export = mapObject;
@@ -0,0 +1 @@
module.exports={A:{A:{"644":"K D E F wC","772":"A B"},B:{"1":"0 1 2 3 4 5 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","260":"C L M G N O"},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 0C 1C","8":"xC TC"},D:{"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 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"},E:{"1":"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 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 OC","8":"F B FD GD HD ID NC uC JD"},G:{"1":"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":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD"},H:{"2":"hD"},I:{"2":"TC J iD jD kD lD vC mD nD","1025":"I"},J:{"2":"D A"},K:{"1":"OC","8":"A B C NC uC","1025":"H"},L:{"1025":"I"},M:{"2":"MC"},N:{"1":"A B"},O:{"1025":"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:{"1":"zD"},R:{"2":"0D"},S:{"2":"1D 2D"}},B:1,C:"Drag and Drop",D:true};
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"E F A B","2":"K D wC"},B:{"1":"C L M G N O P","4":"0 1 2 3 4 5 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":"6 7 8 9 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","4":"0 1 2 3 4 5 J ZB K D E F A B C L M G N O 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","16":"xC TC 0C 1C"},D:{"4":"0 1 2 3 4 5 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","16":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB"},E:{"4":"K D E F A B C L M G 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","16":"J ZB 2C ZC"},F:{"4":"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","16":"F B FD GD HD ID NC uC"},G:{"4":"E 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","16":"ZC KD vC LD MD"},H:{"2":"hD"},I:{"4":"J I lD vC mD nD","16":"TC iD jD kD"},J:{"4":"D A"},K:{"4":"H OC","16":"A B C NC uC"},L:{"4":"I"},M:{"4":"MC"},N:{"1":"A B"},O:{"4":"PC"},P:{"4":"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:{"4":"zD"},R:{"4":"0D"},S:{"1":"1D","4":"2D"}},B:6,C:"X-Frame-Options HTTP header",D:true};
@@ -0,0 +1,71 @@
import {
useMultiSelectListState
} from "./chunk-RVB7J7GX.mjs";
// src/use-multiselect-state.ts
import { useMenuTriggerState } from "@react-stately/menu";
import { useFormValidationState } from "@react-stately/form";
import { useState } from "react";
function useMultiSelectState({
validate,
validationBehavior,
...props
}) {
const [isFocused, setFocused] = useState(false);
const [focusStrategy, setFocusStrategy] = useState(null);
const triggerState = useMenuTriggerState(props);
const listState = useMultiSelectListState({
...props,
onSelectionChange: (keys) => {
if (props.onSelectionChange != null) {
if (keys === "all") {
props.onSelectionChange(new Set(listState.collection.getKeys()));
} else {
props.onSelectionChange(keys);
}
}
if (props.selectionMode === "single") {
triggerState.close();
}
}
});
const validationState = useFormValidationState({
...props,
validationBehavior,
validate: (value) => {
if (!validate)
return;
const keys = Array.from(value);
return validate(props.selectionMode === "single" ? keys[0] : keys);
},
value: listState.selectedKeys
});
const shouldHideContent = listState.collection.size === 0 && props.hideEmptyContent;
return {
...validationState,
...listState,
...triggerState,
focusStrategy,
close() {
triggerState.close();
},
open(focusStrategy2 = null) {
if (shouldHideContent)
return;
setFocusStrategy(focusStrategy2);
triggerState.open();
},
toggle(focusStrategy2 = null) {
if (shouldHideContent)
return;
setFocusStrategy(focusStrategy2);
triggerState.toggle();
},
isFocused,
setFocused
};
}
export {
useMultiSelectState
};
@@ -0,0 +1,19 @@
{
"name": "debug",
"repo": "visionmedia/debug",
"description": "small debugging utility",
"version": "2.6.9",
"keywords": [
"debug",
"log",
"debugger"
],
"main": "src/browser.js",
"scripts": [
"src/browser.js",
"src/debug.js"
],
"dependencies": {
"rauchg/ms.js": "0.7.1"
}
}
@@ -0,0 +1,73 @@
# jsx-a11y/no-interactive-element-to-noninteractive-role
💼 This rule is enabled in the following configs: ☑️ `recommended`, 🔒 `strict`.
<!-- end auto-generated rule header -->
Interactive HTML elements indicate _controls_ in the user interface. Interactive elements include `<a href>`, `<button>`, `<input>`, `<select>`, `<textarea>`.
Non-interactive HTML elements and non-interactive ARIA roles indicate _content_ and _containers_ in the user interface. Non-interactive elements include `<main>`, `<area>`, `<h1>` (,`<h2>`, etc), `<img>`, `<li>`, `<ul>` and `<ol>`.
[WAI-ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#usage_intro) should not be used to convert an interactive element to a non-interactive element. Non-interactive ARIA roles include `article`, `banner`, `complementary`, `img`, `listitem`, `main`, `region` and `tooltip`.
## How do I resolve this error?
### Case: The element should be a container, like an article
Wrap your interactive element in a `<div>` with the desired role.
```jsx
<div role="article">
<button>Save</button>
</div>
```
### Case: The element should be content, like an image
Put the content inside your interactive element.
```jsx
<div
role="button"
onClick={() => {}}
onKeyPress={() => {}}
tabIndex="0">
<div role="img" aria-label="Save" />
</div>
```
## Rule options
The recommended options for this rule allow the `tr` element to be given a role of `presentation` (or its semantic equivalent `none`). Under normal circumstances, an element with an interactive role should not be semantically neutralized with `presentation` (or `none`).
Options are provided as an object keyed by HTML element name; the value is an array of interactive roles that are allowed on the specified element.
```js
{
'no-interactive-element-to-noninteractive-role': [
'error',
{
tr: ['none', 'presentation'],
},
]
}
```
Under the recommended options, the following code is valid. It would be invalid under the strict rules.
```jsx
<tr role="presentation" />
```
## Accessibility guidelines
- [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value)
### Resources
- [ARIA Spec, States and Properties](https://www.w3.org/TR/wai-aria/#states_and_properties)
- [Chrome Audit Rules, AX_ARIA_04](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_04)
- [WAI-ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#usage_intro)
- [WAI-ARIA Authoring Practices Guide - Design Patterns and Widgets](https://www.w3.org/TR/wai-aria-practices-1.1/#aria_ex)
- [Fundamental Keyboard Navigation Conventions](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_generalnav)
- [Mozilla Developer Network - ARIA Techniques](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_button_role#Keyboard_and_focus)
@@ -0,0 +1 @@
{"version":3,"names":["isModule","path","node","sourceType"],"sources":["../src/is-module.ts"],"sourcesContent":["import type { NodePath } from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\n\n/**\n * A small utility to check if a file qualifies as a module.\n */\nexport default function isModule(path: NodePath<t.Program>) {\n return path.node.sourceType === \"module\";\n}\n"],"mappings":";;;;;;AAMe,SAASA,QAAQA,CAACC,IAAyB,EAAE;EAC1D,OAAOA,IAAI,CAACC,IAAI,CAACC,UAAU,KAAK,QAAQ;AAC1C","ignoreList":[]}
@@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var module$1 = require('module');
var url = require('url');
var path = require('path');
/**
* @fileoverview Universal module importer
*/
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('module-importer.cjs', document.baseURI).href)));
const __dirname$1 = path.dirname(__filename$1);
const require$1 = module$1.createRequire(__dirname$1 + "/");
const { ModuleImporter } = require$1("./module-importer.cjs");
exports.ModuleImporter = ModuleImporter;
@@ -0,0 +1,2 @@
import 'reflect-metadata';
//# sourceMappingURL=preDestroy.int.spec.d.ts.map
@@ -0,0 +1,9 @@
const distance = (a, b) => Math.abs(a - b);
function distance2D(a, b) {
// Multi-dimensional
const xDelta = distance(a.x, b.x);
const yDelta = distance(a.y, b.y);
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
}
export { distance, distance2D };
@@ -0,0 +1,12 @@
import { progress } from 'motion-utils';
import { mixNumber } from '../../../utils/mix/number.mjs';
function fillOffset(offset, remaining) {
const min = offset[offset.length - 1];
for (let i = 1; i <= remaining; i++) {
const offsetProgress = progress(0, remaining, i);
offset.push(mixNumber(min, 1, offsetProgress));
}
}
export { fillOffset };
@@ -0,0 +1,63 @@
// @ts-check
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "init", {
enumerable: true,
get: function() {
return init;
}
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function isESM() {
const pkgPath = _path.default.resolve("./package.json");
try {
let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
return pkg.type && pkg.type === "module";
} catch (err) {
return false;
}
}
function init(args) {
let messages = [];
let isProjectESM = args["--ts"] || args["--esm"] || isESM();
let syntax = args["--ts"] ? "ts" : isProjectESM ? "js" : "cjs";
let extension = args["--ts"] ? "ts" : "js";
var _args___;
let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
if (_fs.default.existsSync(tailwindConfigLocation)) {
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
} else {
let stubContentsFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../../../stubs/config.full.js") : _path.default.resolve(__dirname, "../../../stubs/config.simple.js"), "utf8");
let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../stubs/tailwind.config.${syntax}`), "utf8");
// Change colors import
stubContentsFile = stubContentsFile.replace("../colors", "tailwindcss/colors");
// Replace contents of {ts,js,cjs} file with the stub {simple,full}.
stubFile = stubFile.replace("__CONFIG__", stubContentsFile.replace("module.exports =", "").trim()).trim() + "\n\n";
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
}
if (args["--postcss"]) {
let postcssConfigLocation = _path.default.resolve("./postcss.config.js");
if (_fs.default.existsSync(postcssConfigLocation)) {
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
} else {
let stubFile = _fs.default.readFileSync(isProjectESM ? _path.default.resolve(__dirname, "../../../stubs/postcss.config.js") : _path.default.resolve(__dirname, "../../../stubs/postcss.config.cjs"), "utf8");
_fs.default.writeFileSync(postcssConfigLocation, stubFile, "utf8");
messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
}
}
if (messages.length > 0) {
console.log();
for (let message of messages){
console.log(message);
}
}
}
@@ -0,0 +1,41 @@
{
"name": "commander",
"version": "4.1.1",
"description": "the complete solution for node.js command-line programs",
"keywords": [
"commander",
"command",
"option",
"parser"
],
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/tj/commander.js.git"
},
"scripts": {
"lint": "eslint index.js \"tests/**/*.js\"",
"test": "jest && npm run test-typings",
"test-typings": "tsc -p tsconfig.json"
},
"main": "index",
"files": [
"index.js",
"typings/index.d.ts"
],
"dependencies": {},
"devDependencies": {
"@types/jest": "^24.0.23",
"@types/node": "^12.12.11",
"eslint": "^6.7.0",
"eslint-plugin-jest": "^22.21.0",
"jest": "^24.8.0",
"standard": "^14.3.1",
"typescript": "^3.7.2"
},
"typings": "typings/index.d.ts",
"engines": {
"node": ">= 6"
}
}
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/supports-preserve-symlink-flag
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,3 @@
import { useLayoutEffect } from 'react';
import { createUpdateEffect } from '../createUpdateEffect';
export default createUpdateEffect(useLayoutEffect);
@@ -0,0 +1,7 @@
export declare class TypedEventEmitter<E extends Record<string, any>> {
private emitter;
on<K extends keyof E>(event: K, listener: (payload: E[K]) => void): () => void;
once<K extends keyof E>(event: K, listener: (payload: E[K]) => void): void;
off<K extends keyof E>(event: K, listener: (payload: E[K]) => void): void;
emit<K extends keyof E>(event: K, payload: E[K]): void;
}
@@ -0,0 +1,23 @@
/**
* @import {Schema as SchemaType, Space} from 'property-information'
*/
/** @type {SchemaType} */
export class Schema {
/**
* @param {SchemaType['property']} property
* Property.
* @param {SchemaType['normal']} normal
* Normal.
* @param {Space | undefined} [space]
* Space.
* @returns
* Schema.
*/
constructor(property: SchemaType["property"], normal: SchemaType["normal"], space?: Space | undefined);
normal: Record<string, string>;
property: Record<string, import("property-information").Info>;
space: Space | undefined;
}
import type { Space } from 'property-information';
import type { Schema as SchemaType } from 'property-information';
//# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1,16 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
import { id_ce } from "../object_identifiers";
export const id_ce_basicConstraints = `${id_ce}.19`;
export class BasicConstraints {
constructor(params = {}) {
this.cA = false;
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Boolean, defaultValue: false })
], BasicConstraints.prototype, "cA", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, optional: true })
], BasicConstraints.prototype, "pathLenConstraint", void 0);
@@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return parseAnimationValue;
}
});
const DIRECTIONS = new Set([
"normal",
"reverse",
"alternate",
"alternate-reverse"
]);
const PLAY_STATES = new Set([
"running",
"paused"
]);
const FILL_MODES = new Set([
"none",
"forwards",
"backwards",
"both"
]);
const ITERATION_COUNTS = new Set([
"infinite"
]);
const TIMINGS = new Set([
"linear",
"ease",
"ease-in",
"ease-out",
"ease-in-out",
"step-start",
"step-end"
]);
const TIMING_FNS = [
"cubic-bezier",
"steps"
];
const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubic-bezier(a, b, c)` these don't count.
;
const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
;
const TIME = /^(-?[\d.]+m?s)$/;
const DIGIT = /^(\d+)$/;
function parseAnimationValue(input) {
let animations = input.split(COMMA);
return animations.map((animation)=>{
let value = animation.trim();
let result = {
value
};
let parts = value.split(SPACE);
let seen = new Set();
for (let part of parts){
if (!seen.has("DIRECTIONS") && DIRECTIONS.has(part)) {
result.direction = part;
seen.add("DIRECTIONS");
} else if (!seen.has("PLAY_STATES") && PLAY_STATES.has(part)) {
result.playState = part;
seen.add("PLAY_STATES");
} else if (!seen.has("FILL_MODES") && FILL_MODES.has(part)) {
result.fillMode = part;
seen.add("FILL_MODES");
} else if (!seen.has("ITERATION_COUNTS") && (ITERATION_COUNTS.has(part) || DIGIT.test(part))) {
result.iterationCount = part;
seen.add("ITERATION_COUNTS");
} else if (!seen.has("TIMING_FUNCTION") && TIMINGS.has(part)) {
result.timingFunction = part;
seen.add("TIMING_FUNCTION");
} else if (!seen.has("TIMING_FUNCTION") && TIMING_FNS.some((f)=>part.startsWith(`${f}(`))) {
result.timingFunction = part;
seen.add("TIMING_FUNCTION");
} else if (!seen.has("DURATION") && TIME.test(part)) {
result.duration = part;
seen.add("DURATION");
} else if (!seen.has("DELAY") && TIME.test(part)) {
result.delay = part;
seen.add("DELAY");
} else if (!seen.has("NAME")) {
result.name = part;
seen.add("NAME");
} else {
if (!result.unknown) result.unknown = [];
result.unknown.push(part);
}
}
return result;
});
}
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Josh Junon
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,4 @@
import type { FieldArrayMethodProps, InternalFieldName } from '../types';
declare const _default: (name: InternalFieldName, index: number, options?: FieldArrayMethodProps) => string;
export default _default;
//# sourceMappingURL=getFocusFieldName.d.ts.map
@@ -0,0 +1,367 @@
/**
* @fileoverview Rule to check for the usage of var.
* @author Jamund Ferguson
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Check whether a given variable is a global variable or not.
* @param {eslint-scope.Variable} variable The variable to check.
* @returns {boolean} `true` if the variable is a global variable.
*/
function isGlobal(variable) {
return Boolean(variable.scope) && variable.scope.type === "global";
}
/**
* Finds the nearest function scope or global scope walking up the scope
* hierarchy.
* @param {eslint-scope.Scope} scope The scope to traverse.
* @returns {eslint-scope.Scope} a function scope or global scope containing the given
* scope.
*/
function getEnclosingFunctionScope(scope) {
let currentScope = scope;
while (currentScope.type !== "function" && currentScope.type !== "global") {
currentScope = currentScope.upper;
}
return currentScope;
}
/**
* Checks whether the given variable has any references from a more specific
* function expression (i.e. a closure).
* @param {eslint-scope.Variable} variable A variable to check.
* @returns {boolean} `true` if the variable is used from a closure.
*/
function isReferencedInClosure(variable) {
const enclosingFunctionScope = getEnclosingFunctionScope(variable.scope);
return variable.references.some(
reference =>
getEnclosingFunctionScope(reference.from) !==
enclosingFunctionScope,
);
}
/**
* Checks whether the given node is the assignee of a loop.
* @param {ASTNode} node A VariableDeclaration node to check.
* @returns {boolean} `true` if the declaration is assigned as part of loop
* iteration.
*/
function isLoopAssignee(node) {
return (
(node.parent.type === "ForOfStatement" ||
node.parent.type === "ForInStatement") &&
node === node.parent.left
);
}
/**
* Checks whether the given variable declaration is immediately initialized.
* @param {ASTNode} node A VariableDeclaration node to check.
* @returns {boolean} `true` if the declaration has an initializer.
*/
function isDeclarationInitialized(node) {
return node.declarations.every(declarator => declarator.init !== null);
}
const SCOPE_NODE_TYPE =
/^(?:Program|BlockStatement|SwitchStatement|ForStatement|ForInStatement|ForOfStatement)$/u;
/**
* Gets the scope node which directly contains a given node.
* @param {ASTNode} node A node to get. This is a `VariableDeclaration` or
* an `Identifier`.
* @returns {ASTNode} A scope node. This is one of `Program`, `BlockStatement`,
* `SwitchStatement`, `ForStatement`, `ForInStatement`, and
* `ForOfStatement`.
*/
function getScopeNode(node) {
for (
let currentNode = node;
currentNode;
currentNode = currentNode.parent
) {
if (SCOPE_NODE_TYPE.test(currentNode.type)) {
return currentNode;
}
}
/* c8 ignore next */
return null;
}
/**
* Checks whether a given variable is redeclared or not.
* @param {eslint-scope.Variable} variable A variable to check.
* @returns {boolean} `true` if the variable is redeclared.
*/
function isRedeclared(variable) {
return variable.defs.length >= 2;
}
/**
* Checks whether a given variable is used from outside of the specified scope.
* @param {ASTNode} scopeNode A scope node to check.
* @returns {Function} The predicate function which checks whether a given
* variable is used from outside of the specified scope.
*/
function isUsedFromOutsideOf(scopeNode) {
/**
* Checks whether a given reference is inside of the specified scope or not.
* @param {eslint-scope.Reference} reference A reference to check.
* @returns {boolean} `true` if the reference is inside of the specified
* scope.
*/
function isOutsideOfScope(reference) {
const scope = scopeNode.range;
const id = reference.identifier.range;
return id[0] < scope[0] || id[1] > scope[1];
}
return function (variable) {
return variable.references.some(isOutsideOfScope);
};
}
/**
* Creates the predicate function which checks whether a variable has their references in TDZ.
*
* The predicate function would return `true`:
*
* - if a reference is before the declarator. E.g. (var a = b, b = 1;)(var {a = b, b} = {};)
* - if a reference is in the expression of their default value. E.g. (var {a = a} = {};)
* - if a reference is in the expression of their initializer. E.g. (var a = a;)
* @param {ASTNode} node The initializer node of VariableDeclarator.
* @returns {Function} The predicate function.
* @private
*/
function hasReferenceInTDZ(node) {
const initStart = node.range[0];
const initEnd = node.range[1];
return variable => {
const id = variable.defs[0].name;
const idStart = id.range[0];
const defaultValue =
id.parent.type === "AssignmentPattern" ? id.parent.right : null;
const defaultStart = defaultValue && defaultValue.range[0];
const defaultEnd = defaultValue && defaultValue.range[1];
return variable.references.some(reference => {
const start = reference.identifier.range[0];
const end = reference.identifier.range[1];
return (
!reference.init &&
(start < idStart ||
(defaultValue !== null &&
start >= defaultStart &&
end <= defaultEnd) ||
(!astUtils.isFunction(node) &&
start >= initStart &&
end <= initEnd))
);
});
};
}
/**
* Checks whether a given variable has name that is allowed for 'var' declarations,
* but disallowed for `let` declarations.
* @param {eslint-scope.Variable} variable The variable to check.
* @returns {boolean} `true` if the variable has a disallowed name.
*/
function hasNameDisallowedForLetDeclarations(variable) {
return variable.name === "let";
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
dialects: ["typescript", "javascript"],
language: "javascript",
docs: {
description: "Require `let` or `const` instead of `var`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-var",
},
schema: [],
fixable: "code",
messages: {
unexpectedVar: "Unexpected var, use let or const instead.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Checks whether the variables which are defined by the given declarator node have their references in TDZ.
* @param {ASTNode} declarator The VariableDeclarator node to check.
* @returns {boolean} `true` if one of the variables which are defined by the given declarator node have their references in TDZ.
*/
function hasSelfReferenceInTDZ(declarator) {
if (!declarator.init) {
return false;
}
const variables = sourceCode.getDeclaredVariables(declarator);
return variables.some(hasReferenceInTDZ(declarator.init));
}
/**
* Checks whether it can fix a given variable declaration or not.
* It cannot fix if the following cases:
*
* - A variable is a global variable.
* - A variable is declared on a SwitchCase node.
* - A variable is redeclared.
* - A variable is used from outside the scope.
* - A variable is used from a closure within a loop.
* - A variable might be used before it is assigned within a loop.
* - A variable might be used in TDZ.
* - A variable is declared in statement position (e.g. a single-line `IfStatement`)
* - A variable has name that is disallowed for `let` declarations.
*
* ## A variable is declared on a SwitchCase node.
*
* If this rule modifies 'var' declarations on a SwitchCase node, it
* would generate the warnings of 'no-case-declarations' rule. And the
* 'eslint:recommended' preset includes 'no-case-declarations' rule, so
* this rule doesn't modify those declarations.
*
* ## A variable is redeclared.
*
* The language spec disallows redeclarations of `let` declarations.
* Those variables would cause syntax errors.
*
* ## A variable is used from outside the scope.
*
* The language spec disallows accesses from outside of the scope for
* `let` declarations. Those variables would cause reference errors.
*
* ## A variable is used from a closure within a loop.
*
* A `var` declaration within a loop shares the same variable instance
* across all loop iterations, while a `let` declaration creates a new
* instance for each iteration. This means if a variable in a loop is
* referenced by any closure, changing it from `var` to `let` would
* change the behavior in a way that is generally unsafe.
*
* ## A variable might be used before it is assigned within a loop.
*
* Within a loop, a `let` declaration without an initializer will be
* initialized to null, while a `var` declaration will retain its value
* from the previous iteration, so it is only safe to change `var` to
* `let` if we can statically determine that the variable is always
* assigned a value before its first access in the loop body. To keep
* the implementation simple, we only convert `var` to `let` within
* loops when the variable is a loop assignee or the declaration has an
* initializer.
* @param {ASTNode} node A variable declaration node to check.
* @returns {boolean} `true` if it can fix the node.
*/
function canFix(node) {
const variables = sourceCode.getDeclaredVariables(node);
const scopeNode = getScopeNode(node);
if (
node.parent.type === "SwitchCase" ||
node.declarations.some(hasSelfReferenceInTDZ) ||
variables.some(isGlobal) ||
variables.some(isRedeclared) ||
variables.some(isUsedFromOutsideOf(scopeNode)) ||
variables.some(hasNameDisallowedForLetDeclarations)
) {
return false;
}
if (astUtils.isInLoop(node)) {
if (variables.some(isReferencedInClosure)) {
return false;
}
if (!isLoopAssignee(node) && !isDeclarationInitialized(node)) {
return false;
}
}
if (
!isLoopAssignee(node) &&
!(
node.parent.type === "ForStatement" &&
node.parent.init === node
) &&
!astUtils.STATEMENT_LIST_PARENTS.has(node.parent.type)
) {
// If the declaration is not in a block, e.g. `if (foo) var bar = 1;`, then it can't be fixed.
return false;
}
return true;
}
/**
* Reports a given variable declaration node.
* @param {ASTNode} node A variable declaration node to report.
* @returns {void}
*/
function report(node) {
context.report({
node,
messageId: "unexpectedVar",
fix(fixer) {
const varToken = sourceCode.getFirstToken(node, {
filter: t => t.value === "var",
});
return canFix(node)
? fixer.replaceText(varToken, "let")
: null;
},
});
}
return {
"VariableDeclaration:exit"(node) {
if (node.kind !== "var") {
return;
}
if (
node.parent.type === "TSModuleBlock" &&
node.parent.parent.type === "TSModuleDeclaration" &&
node.parent.parent.global
) {
return;
}
report(node);
},
};
},
};
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more