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,4 @@
import type { TSESLint } from '@typescript-eslint/utils';
export type MessageId = 'noUnnecessaryTemplateExpression';
declare const _default: TSESLint.RuleModule<"noUnnecessaryTemplateExpression", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener>;
export default _default;
@@ -0,0 +1,252 @@
# vfile-message
[![Build][badge-build-image]][badge-build-url]
[![Coverage][badge-coverage-image]][badge-coverage-url]
[![Downloads][badge-downloads-image]][badge-downloads-url]
[![Size][badge-size-image]][badge-size-url]
Create [vfile][github-vfile] messages.
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`VFileMessage(reason[, options])`](#vfilemessagereason-options)
* [`Options`](#options)
* [Well-known](#well-known)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package provides a (lint) message format.
## When should I use this?
In most cases,
you can use `file.message` from `VFile` itself,
but in some cases you might not have a file,
and still want to emit warnings or errors,
in which case this can be used directly.
## Install
This package is [ESM only][github-gist-esm].
In Node.js (version 16+),
install with [npm][npmjs-install]:
```sh
npm install vfile-message
```
In Deno with [`esm.sh`][esmsh]:
```js
import {VFileMessage} from 'https://esm.sh/vfile-message@4'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import {VFileMessage} from 'https://esm.sh/vfile-message@4?bundle'
</script>
```
## Use
```js
import {VFileMessage} from 'vfile-message'
const message = new VFileMessage(
'Unexpected unknown word `braavo`, did you mean `bravo`?',
{place: {column: 8, line: 1}, ruleId: 'typo', source: 'spell'}
)
console.log(message)
```
Yields:
```text
[1:8: Unexpected unknown word `braavo`, did you mean `bravo`?] {
reason: 'Unexpected unknown word `braavo`, did you mean `bravo`?',
line: 1,
column: 8,
ancestors: undefined,
cause: undefined,
fatal: undefined,
place: {line: 1, column: 8},
ruleId: 'typo',
source: 'spell'
}
```
## API
This package exports the identifier [`VFileMessage`][api-vfile-message].
There is no default export.
It exports the additional [TypeScript][] type [`Options`][api-options].
### `VFileMessage(reason[, options])`
Create a message for `reason`.
> 🪦 **Note**: also has obsolete signatures.
###### Parameters
* `reason` (`string`)
— reason for message (should use markdown)
* `options` ([`Options`][api-options], optional)
— configuration.
###### Extends
[`Error`][developer-mozilla-error].
###### Returns
Instance of `VFileMessage`.
###### Fields
* `ancestors` ([`Array<Node>`][github-unist-node] or `undefined`)
— stack of (inclusive) ancestor nodes surrounding the message
* `cause` ([`Error`][developer-mozilla-error] or `undefined`)
— original error cause of the message
* `column` (`number` or `undefined`)
— starting column of message
* `fatal` (`boolean` or `undefined`)
— state of problem; `true`: error, file not usable; `false`: warning,
change may be needed; `undefined`: info, change likely not needed
* `line` (`number` or `undefined`)
— starting line of message
* `place` ([`Point`][github-unist-point], [`Position`][github-unist-position]
or `undefined`)
— place of message
* `reason` (`string`)
— reason for message (should use markdown)
* `ruleId` (`string` or `undefined`, example: `'my-rule'`)
— category of message
* `source` (`string` or `undefined`, example: `'my-package'`)
— namespace of message
### `Options`
Configuration (TypeScript type).
###### Fields
* `ancestors` ([`Array<Node>`][github-unist-node], optional)
— stack of (inclusive) ancestor nodes surrounding the message
* `cause` ([`Error`][developer-mozilla-error], optional)
— original error cause of the message
* `place` ([`Point`][github-unist-point] or [`Position`][github-unist-position],
optional)
— place of message
* `ruleId` (`string`, optional, example: `'my-rule'`)
— category of message
* `source` (`string`, optional, , example: `'my-package'`)
— namespace of who sent the message
### Well-known
It’s OK to store custom data directly on the `VFileMessage`, some of those are
handled by [utilities][github-vfile-util].
The following fields are documented and typed here.
###### Fields
* `actual` (`string`, optional)
— specify the source value that’s being reported, which is deemed incorrect
* `expected` (`Array<string>`, optional)
— suggest acceptable values that can be used instead of `actual`
* `url` (`string`, optional)
— link to docs for the message (this must be an absolute URL that can be
passed as `x` to `new URL(x)`)
* `note` (`string`, optional)
— long form description of the message (you should use markdown)
## Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `vfile-message@^4`,
compatible with Node.js 16.
## Contribute
See [`contributing.md`][health-contributing] in [`vfile/.github`][health]
for ways to get started.
See [`support.md`][health-support] for ways to get help.
This project has a [code of conduct][health-coc].
By interacting with this repository,
organization,
or community you agree to abide by its terms.
## License
[MIT][file-license] © [Titus Wormer][wooorm]
<!-- Definitions -->
[api-options]: #options
[api-vfile-message]: #vfilemessagereason-options
[badge-build-image]: https://github.com/vfile/vfile-message/workflows/main/badge.svg
[badge-build-url]: https://github.com/vfile/vfile-message/actions
[badge-coverage-image]: https://img.shields.io/codecov/c/github/vfile/vfile-message.svg
[badge-coverage-url]: https://codecov.io/github/vfile/vfile-message
[badge-downloads-image]: https://img.shields.io/npm/dm/vfile-message.svg
[badge-downloads-url]: https://www.npmjs.com/package/vfile-message
[badge-size-image]: https://img.shields.io/bundlejs/size/vfile-message
[badge-size-url]: https://bundlejs.com/?q=vfile-message
[developer-mozilla-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
[esmsh]: https://esm.sh
[file-license]: license
[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[github-unist-node]: https://github.com/syntax-tree/unist#node
[github-unist-point]: https://github.com/syntax-tree/unist#point
[github-unist-position]: https://github.com/syntax-tree/unist#position
[github-vfile]: https://github.com/vfile/vfile
[github-vfile-util]: https://github.com/vfile/vfile#utilities
[health]: https://github.com/vfile/.github
[health-coc]: https://github.com/vfile/.github/blob/main/code-of-conduct.md
[health-contributing]: https://github.com/vfile/.github/blob/main/contributing.md
[health-support]: https://github.com/vfile/.github/blob/main/support.md
[npmjs-install]: https://docs.npmjs.com/cli/install
[typescript]: https://www.typescriptlang.org
[wooorm]: https://wooorm.com
@@ -0,0 +1,33 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {useOverlayPosition} from './useOverlayPosition';
export {useOverlay} from './useOverlay';
export {useOverlayTrigger} from './useOverlayTrigger';
export {usePreventScroll} from './usePreventScroll';
export {ModalProvider, useModalProvider, OverlayProvider, OverlayContainer, useModal} from './useModal';
export {DismissButton} from './DismissButton';
export {ariaHideOutside} from './ariaHideOutside';
export {usePopover} from './usePopover';
export {useModalOverlay} from './useModalOverlay';
export {Overlay, useOverlayFocusContain} from './Overlay';
export {UNSAFE_PortalProvider, useUNSAFE_PortalContext} from './PortalProvider';
export type {AriaPositionProps, PositionAria} from './useOverlayPosition';
export type {AriaOverlayProps, OverlayAria} from './useOverlay';
export type {OverlayTriggerAria, OverlayTriggerProps} from './useOverlayTrigger';
export type {AriaModalOptions, ModalAria, ModalProviderAria, ModalProviderProps, OverlayContainerProps} from './useModal';
export type {DismissButtonProps} from './DismissButton';
export type {AriaPopoverProps, PopoverAria} from './usePopover';
export type {AriaModalOverlayProps, ModalOverlayAria} from './useModalOverlay';
export type {OverlayProps} from './Overlay';
export type {Placement, PlacementAxis, PositionProps} from '@react-types/overlays';
export type {PortalProviderProps, PortalProviderContextValue} from './PortalProvider';
@@ -0,0 +1,69 @@
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f',
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
rsComboSymbolsRange = '\\u20d0-\\u20ff',
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
rsDingbatRange = '\\u2700-\\u27bf',
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
rsPunctuationRange = '\\u2000-\\u206f',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange = '\\ufe0e\\ufe0f',
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
var rsApos = "['\u2019]",
rsBreak = '[' + rsBreakRange + ']',
rsCombo = '[' + rsComboRange + ']',
rsDigits = '\\d+',
rsDingbat = '[' + rsDingbatRange + ']',
rsLower = '[' + rsLowerRange + ']',
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsUpper = '[' + rsUpperRange + ']',
rsZWJ = '\\u200d';
/** Used to compose unicode regexes. */
var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
/** Used to match complex or compound words. */
var reUnicodeWord = RegExp([
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
rsUpper + '+' + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join('|'), 'g');
/**
* Splits a Unicode `string` into an array of its words.
*
* @private
* @param {string} The string to inspect.
* @returns {Array} Returns the words of `string`.
*/
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
export default unicodeWords;
@@ -0,0 +1,303 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const scope_manager_1 = require("@typescript-eslint/scope-manager");
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const referenceContainsTypeQuery_1 = require("../util/referenceContainsTypeQuery");
const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/;
/**
* Parses a given value as options.
*/
function parseOptions(options) {
let functions = true;
let classes = true;
let enums = true;
let variables = true;
let typedefs = true;
let ignoreTypeReferences = true;
let allowNamedExports = false;
if (typeof options === 'string') {
functions = options !== 'nofunc';
}
else if (typeof options === 'object' && options != null) {
functions = options.functions !== false;
classes = options.classes !== false;
enums = options.enums !== false;
variables = options.variables !== false;
typedefs = options.typedefs !== false;
ignoreTypeReferences = options.ignoreTypeReferences !== false;
allowNamedExports = options.allowNamedExports !== false;
}
return {
allowNamedExports,
classes,
enums,
functions,
ignoreTypeReferences,
typedefs,
variables,
};
}
/**
* Checks whether or not a given variable is a function declaration.
*/
function isFunction(variable) {
return variable.defs[0].type === scope_manager_1.DefinitionType.FunctionName;
}
/**
* Checks whether or not a given variable is a type declaration.
*/
function isTypedef(variable) {
return variable.defs[0].type === scope_manager_1.DefinitionType.Type;
}
/**
* Checks whether or not a given variable is a enum declaration.
*/
function isOuterEnum(variable, reference) {
return (variable.defs[0].type === scope_manager_1.DefinitionType.TSEnumName &&
variable.scope.variableScope !== reference.from.variableScope);
}
/**
* Checks whether or not a given variable is a class declaration in an upper function scope.
*/
function isOuterClass(variable, reference) {
return (variable.defs[0].type === scope_manager_1.DefinitionType.ClassName &&
variable.scope.variableScope !== reference.from.variableScope);
}
/**
* Checks whether or not a given variable is a variable declaration in an upper function scope.
*/
function isOuterVariable(variable, reference) {
return (variable.defs[0].type === scope_manager_1.DefinitionType.Variable &&
variable.scope.variableScope !== reference.from.variableScope);
}
/**
* Checks whether or not a given reference is a export reference.
*/
function isNamedExports(reference) {
const { identifier } = reference;
return (identifier.parent.type === utils_1.AST_NODE_TYPES.ExportSpecifier &&
identifier.parent.local === identifier);
}
/**
* Checks whether or not a given reference is a type reference.
*/
function isTypeReference(reference) {
return (reference.isTypeReference ||
(0, referenceContainsTypeQuery_1.referenceContainsTypeQuery)(reference.identifier));
}
/**
* Checks whether or not a given location is inside of the range of a given node.
*/
function isInRange(node, location) {
return !!node && node.range[0] <= location && location <= node.range[1];
}
/**
* Decorators are transpiled such that the decorator is placed after the class declaration
* So it is considered safe
*/
function isClassRefInClassDecorator(variable, reference) {
if (variable.defs[0].type !== scope_manager_1.DefinitionType.ClassName ||
variable.defs[0].node.decorators.length === 0) {
return false;
}
for (const deco of variable.defs[0].node.decorators) {
if (reference.identifier.range[0] >= deco.range[0] &&
reference.identifier.range[1] <= deco.range[1]) {
return true;
}
}
return false;
}
/**
* Checks whether or not a given reference is inside of the initializers of a given variable.
*
* @returns `true` in the following cases:
* - var a = a
* - var [a = a] = list
* - var {a = a} = obj
* - for (var a in a) {}
* - for (var a of a) {}
*/
function isInInitializer(variable, reference) {
if (variable.scope !== reference.from) {
return false;
}
let node = variable.identifiers[0].parent;
const location = reference.identifier.range[1];
while (node) {
if (node.type === utils_1.AST_NODE_TYPES.VariableDeclarator) {
if (isInRange(node.init, location)) {
return true;
}
if ((node.parent.parent.type === utils_1.AST_NODE_TYPES.ForInStatement ||
node.parent.parent.type === utils_1.AST_NODE_TYPES.ForOfStatement) &&
isInRange(node.parent.parent.right, location)) {
return true;
}
break;
}
else if (node.type === utils_1.AST_NODE_TYPES.AssignmentPattern) {
if (isInRange(node.right, location)) {
return true;
}
}
else if (SENTINEL_TYPE.test(node.type)) {
break;
}
node = node.parent;
}
return false;
}
exports.default = (0, util_1.createRule)({
name: 'no-use-before-define',
meta: {
type: 'problem',
docs: {
description: 'Disallow the use of variables before they are defined',
extendsBaseRule: true,
},
messages: {
noUseBeforeDefine: "'{{name}}' was used before it was defined.",
},
schema: [
{
oneOf: [
{
type: 'string',
description: 'Broadly set functions and allowNamedExports to false.',
enum: ['nofunc'],
},
{
type: 'object',
additionalProperties: false,
properties: {
allowNamedExports: {
type: 'boolean',
description: 'Whether to ignore named exports.',
},
classes: {
type: 'boolean',
description: 'Whether to ignore references to class declarations.',
},
enums: {
type: 'boolean',
description: 'Whether to check references to enums.',
},
functions: {
type: 'boolean',
description: 'Whether to ignore references to function declarations.',
},
ignoreTypeReferences: {
type: 'boolean',
description: 'Whether to ignore type references, such as in type annotations and assertions.',
},
typedefs: {
type: 'boolean',
description: 'Whether to check references to types.',
},
variables: {
type: 'boolean',
description: 'Whether to ignore references to variables.',
},
},
},
],
},
],
},
defaultOptions: [
{
allowNamedExports: false,
classes: true,
enums: true,
functions: true,
ignoreTypeReferences: true,
typedefs: true,
variables: true,
},
],
create(context, optionsWithDefault) {
const options = parseOptions(optionsWithDefault[0]);
/**
* Determines whether a given use-before-define case should be reported according to the options.
* @param variable The variable that gets used before being defined
* @param reference The reference to the variable
*/
function isForbidden(variable, reference) {
if (options.ignoreTypeReferences && isTypeReference(reference)) {
return false;
}
if (isFunction(variable)) {
return options.functions;
}
if (isOuterClass(variable, reference)) {
return options.classes;
}
if (isOuterVariable(variable, reference)) {
return options.variables;
}
if (isOuterEnum(variable, reference)) {
return options.enums;
}
if (isTypedef(variable)) {
return options.typedefs;
}
return true;
}
function isDefinedBeforeUse(variable, reference) {
return (variable.identifiers[0].range[1] <= reference.identifier.range[1] &&
!(reference.isValueReference && isInInitializer(variable, reference)));
}
/**
* Finds and validates all variables in a given scope.
*/
function findVariablesInScope(scope) {
scope.references.forEach(reference => {
const variable = reference.resolved;
function report() {
context.report({
node: reference.identifier,
messageId: 'noUseBeforeDefine',
data: {
name: reference.identifier.name,
},
});
}
// Skips when the reference is:
// - initializations.
// - referring to an undefined variable.
// - referring to a global environment variable (there're no identifiers).
// - located preceded by the variable (except in initializers).
// - allowed by options.
if (reference.init) {
return;
}
if (!options.allowNamedExports && isNamedExports(reference)) {
if (!variable || !isDefinedBeforeUse(variable, reference)) {
report();
}
return;
}
if (!variable) {
return;
}
if (variable.identifiers.length === 0 ||
isDefinedBeforeUse(variable, reference) ||
!isForbidden(variable, reference) ||
isClassRefInClassDecorator(variable, reference) ||
reference.from.type === utils_1.TSESLint.Scope.ScopeType.functionType) {
return;
}
// Reports.
report();
});
scope.childScopes.forEach(findVariablesInScope);
}
return {
Program(node) {
findVariablesInScope(context.sourceCode.getScope(node));
},
};
},
});
@@ -0,0 +1,27 @@
"use client";
// src/refs.ts
import { isFunction } from "@heroui/shared-utils";
function assignRef(ref, value) {
if (ref == null)
return;
if (isFunction(ref)) {
ref(value);
return;
}
try {
ref.current = value;
} catch (error) {
throw new Error(`Cannot assign value '${value}' to ref '${ref}'`);
}
}
function mergeRefs(...refs) {
return (node) => {
refs.forEach((ref) => assignRef(ref, node));
};
}
export {
assignRef,
mergeRefs
};
@@ -0,0 +1,17 @@
const postfixRE = /[?#].*$/;
export function cleanUrl(url) {
return url.replace(postfixRE, '');
}
export function extractQueryWithoutFragment(url) {
const questionMarkIndex = url.indexOf('?');
if (questionMarkIndex === -1) {
return '';
}
const fragmentIndex = url.indexOf('#', questionMarkIndex); // Search for # after ?
if (fragmentIndex === -1) {
return url.substring(questionMarkIndex);
}
else {
return url.substring(questionMarkIndex, fragmentIndex);
}
}
@@ -0,0 +1,29 @@
/*
* 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 type {GridCollection} from '@react-types/grid';
import type {GridState} from '@react-stately/grid';
import type {Key, KeyboardDelegate} from '@react-types/shared';
interface GridMapShared {
keyboardDelegate: KeyboardDelegate,
actions: {
onRowAction?: (key: Key) => void,
onCellAction?: (key: Key) => void
},
shouldSelectOnPressUp?: boolean
}
// Used to share:
// keyboard delegate between useGrid and useGridCell
// onRowAction/onCellAction across hooks
export const gridMap: WeakMap<GridState<unknown, GridCollection<unknown>>, GridMapShared> = new WeakMap<GridState<unknown, GridCollection<unknown>>, GridMapShared>();
@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2014 Douglas Christopher Wilson
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 @@
{"name":"use-latest","version":"1.3.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532108380,"integrity":"sha512-AbBwWeKT1gpjmgCsukp3hP/D1gdf1Mr1oO/4/Yieb/bJgECQMwPKZknSB8ChSvRkrlAK/s222mbLWPSioFdTUg==","mode":420,"size":1060},"dist/use-latest.cjs.default.js":{"checkedAt":1794532108380,"integrity":"sha512-2lQ1QJ3ILhXnhqSI3SjC52aOGiNDPrxtA41aQHQQmBPDl9DrxVowMMpZH4AhDe02b03UwO418f++t2M6VY7cKQ==","mode":420,"size":59},"dist/use-latest.cjs.js":{"checkedAt":1794532108380,"integrity":"sha512-PiKQvjn8OdFpHK+p0rLGTORVRVUy/+LzemrW6NQ2qCztQC3cGaC1PLZFoWx8wjgnRTXZQJFprUCAADkfJGGKUg==","mode":420,"size":663},"dist/use-latest.esm.js":{"checkedAt":1794532108381,"integrity":"sha512-IAYVrk0UvS4YQigcOZPQ2AqTJ3fRO8qGr8KdrXkSfOZkVX2uacCeTnueE8KPeaCRomylCf0ExKSlYBB1kUALuA==","mode":420,"size":299},"package.json":{"checkedAt":1794532108381,"integrity":"sha512-F9+aRvfg/IxbjO48+n66sknALCWJXLkJS3kNuIOyDkNSLQsaGPgczcKIB9pFlz5zp14WXi70KRHot7ALvojBlA==","mode":420,"size":1754},"README.md":{"checkedAt":1794532108381,"integrity":"sha512-VNM2yRJkQ1NnCL0JIcGCUaOauHQuWIRxzV4kimmYfx/5aXujF7JS9RCvZazQ3a756QYNJwoey8XXBn+0MX8msg==","mode":420,"size":108},"dist/use-latest.cjs.mjs":{"checkedAt":1794532108381,"integrity":"sha512-Bp0+DsZ2BymcJr4KIIiXrvUb87uxKQmUeQNTQM5usxNnUqkiwHzk7hCMs6pR+JcW3UnYjeiCwivp1cfMQ5hVTg==","mode":420,"size":97},"dist/use-latest.cjs.d.mts":{"checkedAt":1794532108381,"integrity":"sha512-0EN1prM0t+VfUL0NNjXFWnm2Les2QhO5XCR1saeq9RxggZCk5ytDrLobME1HSYiQypBhxd+b/r5G0TyfGp8c5A==","mode":420,"size":353},"dist/declarations/src/index.d.ts":{"checkedAt":1794532108381,"integrity":"sha512-tmT6+Id9sk80icX0BDWKS2IqIBQeeV2ENFpuPZyieIPWPPki+iwdwF0X3DepU5FeAO44A/6uHo8fqutWNXD5wg==","mode":420,"size":73},"dist/use-latest.cjs.d.ts":{"checkedAt":1794532108381,"integrity":"sha512-VowBJRtyKqI0p+FvyqleIcnm+37p32WcOhgffHcV1eQXEdbZeRaok5ikCmW0ZBFEenxxUw+4yMvbG13+y7RIYA==","mode":420,"size":341},"dist/use-latest.cjs.default.d.ts":{"checkedAt":1794532108382,"integrity":"sha512-Va8Lacg73xbU7KbjjLh4RTwMTfU2mFbYFGAGtVMEpObQ/JYJXfRtBSEiGgqJiVcdHN41GaDap2Ckv8vAK42BOg==","mode":420,"size":66}}}
@@ -0,0 +1,758 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
const empty = z.templateLiteral([]);
const hello = z.templateLiteral(["hello"]);
const world = z.templateLiteral(["", z.literal("world")]);
const one = z.templateLiteral([1]);
const two = z.templateLiteral(["", z.literal(2)]);
const truee = z.templateLiteral([true]);
const anotherTrue = z.templateLiteral(["", z.literal(true)]);
const falsee = z.templateLiteral([false]);
const anotherFalse = z.templateLiteral(["", z.literal(false)]);
const nulll = z.templateLiteral([null]);
const anotherNull = z.templateLiteral(["", z.null()]);
const undefinedd = z.templateLiteral([undefined]);
const anotherUndefined = z.templateLiteral(["", z.undefined()]);
const anyString = z.templateLiteral(["", z.string()]);
const lazyString = z.templateLiteral(["", z.lazy(() => z.string())]);
const anyNumber = z.templateLiteral(["", z.number()]);
const anyInt = z.templateLiteral(["", z.number().int()]);
// const anyFiniteNumber = z.templateLiteral(["", z.number().finite()]);
// const anyNegativeNumber = z.templateLiteral(["", z.number().negative()]);
// const anyPositiveNumber = z.templateLiteral(["", z.number().positive()]);
// const zeroButInADumbWay = z.templateLiteral(["", z.number().nonnegative().nonpositive()]);
// const finiteButInADumbWay = z.templateLiteral(["", z.number().min(5).max(10)]);
const bool = z.templateLiteral(["", z.boolean()]);
const bigone = z.templateLiteral(["", z.literal(BigInt(1))]);
const anyBigint = z.templateLiteral(["", z.bigint()]);
const nullableYo = z.templateLiteral(["", z.nullable(z.literal("yo"))]);
const nullableString = z.templateLiteral(["", z.nullable(z.string())]);
const optionalYeah = z.templateLiteral(["", z.literal("yeah").optional()]);
const optionalString = z.templateLiteral(["", z.string().optional()]);
const optionalNumber = z.templateLiteral(["", z.number().optional()]);
const nullishBruh = z.templateLiteral(["", z.literal("bruh").nullish()]);
const nullishString = z.templateLiteral(["", z.string().nullish()]);
const cuid = z.templateLiteral(["", z.string().cuid()]);
const cuidZZZ = z.templateLiteral(["", z.string().cuid(), "ZZZ"]);
const cuid2 = z.templateLiteral(["", z.string().cuid2()]);
const datetime = z.templateLiteral(["", z.string().datetime()]);
const email = z.templateLiteral(["", z.string().email()]);
// const ip = z.templateLiteral(["", z.string().ip()]);
const ipv4 = z.templateLiteral(["", z.string().ipv4()]);
const ipv6 = z.templateLiteral(["", z.string().ipv6()]);
const ulid = z.templateLiteral(["", z.string().ulid()]);
const uuid = z.templateLiteral(["", z.string().uuid()]);
const stringAToZ = z.templateLiteral(["", z.string().regex(/^[a-z]+$/)]);
const stringStartsWith = z.templateLiteral(["", z.string().startsWith("hello")]);
const stringEndsWith = z.templateLiteral(["", z.string().endsWith("world")]);
const stringMax5 = z.templateLiteral(["", z.string().max(5)]);
const stringMin5 = z.templateLiteral(["", z.string().min(5)]);
const stringLen5 = z.templateLiteral(["", z.string().length(5)]);
const stringMin5Max10 = z.templateLiteral(["", z.string().min(5).max(10)]);
const stringStartsWithMax5 = z.templateLiteral(["", z.string().startsWith("hello").max(5)]);
const brandedString = z.templateLiteral(["", z.string().min(1).brand("myBrand")]);
// const anything = z.templateLiteral(["", z.any()]);
const url = z.templateLiteral(["https://", z.string().regex(/\w+/), ".", z.enum(["com", "net"])]);
const measurement = z.templateLiteral([
"",
z.number().finite(),
z.enum(["px", "em", "rem", "vh", "vw", "vmin", "vmax"]).optional(),
]);
const connectionString = z.templateLiteral([
"mongodb://",
z
.templateLiteral([
"",
z.string().regex(/\w+/).describe("username"),
":",
z.string().regex(/\w+/).describe("password"),
"@",
])
.optional(),
z.string().regex(/\w+/).describe("host"),
":",
z.number().finite().int().positive().describe("port"),
z
.templateLiteral([
"/",
z.string().regex(/\w+/).optional().describe("defaultauthdb"),
z
.templateLiteral([
"?",
z
.string()
.regex(/^\w+=\w+(&\w+=\w+)*$/)
.optional()
.describe("options"),
])
.optional(),
])
.optional(),
]);
test("template literal type inference", () => {
expectTypeOf<z.infer<typeof empty>>().toEqualTypeOf<``>();
expectTypeOf<z.infer<typeof hello>>().toEqualTypeOf<`hello`>();
expectTypeOf<z.infer<typeof world>>().toEqualTypeOf<`world`>();
expectTypeOf<z.infer<typeof one>>().toEqualTypeOf<`1`>();
expectTypeOf<z.infer<typeof two>>().toEqualTypeOf<`2`>();
expectTypeOf<z.infer<typeof truee>>().toEqualTypeOf<`true`>();
expectTypeOf<z.infer<typeof anotherTrue>>().toEqualTypeOf<`true`>();
expectTypeOf<z.infer<typeof falsee>>().toEqualTypeOf<`false`>();
expectTypeOf<z.infer<typeof anotherFalse>>().toEqualTypeOf<`false`>();
expectTypeOf<z.infer<typeof nulll>>().toEqualTypeOf<`null`>();
expectTypeOf<z.infer<typeof anotherNull>>().toEqualTypeOf<`null`>();
expectTypeOf<z.infer<typeof undefinedd>>().toEqualTypeOf<``>();
expectTypeOf<z.infer<typeof anotherUndefined>>().toEqualTypeOf<``>();
expectTypeOf<z.infer<typeof anyString>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof lazyString>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof anyNumber>>().toEqualTypeOf<`${number}`>();
expectTypeOf<z.infer<typeof anyInt>>().toEqualTypeOf<`${number}`>();
// expectTypeOf<z.infer<typeof anyFiniteNumber>>().toEqualTypeOf<`${number}`>();
// expectTypeOf<z.infer<typeof anyNegativeNumber>>().toEqualTypeOf<`${number}`>();
// expectTypeOf<z.infer<typeof anyPositiveNumber>>().toEqualTypeOf<`${number}`>();
// expectTypeOf<z.infer<typeof zeroButInADumbWay>>().toEqualTypeOf<`${number}`>();
// expectTypeOf<z.infer<typeof finiteButInADumbWay>>().toEqualTypeOf<`${number}`>();
expectTypeOf<z.infer<typeof bool>>().toEqualTypeOf<`true` | `false`>();
expectTypeOf<z.infer<typeof bigone>>().toEqualTypeOf<`${bigint}`>();
expectTypeOf<z.infer<typeof anyBigint>>().toEqualTypeOf<`${bigint}`>();
expectTypeOf<z.infer<typeof nullableYo>>().toEqualTypeOf<`yo` | `null`>();
expectTypeOf<z.infer<typeof nullableString>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof optionalYeah>>().toEqualTypeOf<`yeah` | ``>();
expectTypeOf<z.infer<typeof optionalString>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof optionalNumber>>().toEqualTypeOf<`${number}` | ``>();
expectTypeOf<z.infer<typeof nullishBruh>>().toEqualTypeOf<`bruh` | `null` | ``>();
expectTypeOf<z.infer<typeof nullishString>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof cuid>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof cuidZZZ>>().toEqualTypeOf<`${string}ZZZ`>();
expectTypeOf<z.infer<typeof cuid2>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof datetime>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof email>>().toEqualTypeOf<string>();
// expectTypeOf<z.infer<typeof ip>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof ipv4>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof ipv6>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof ulid>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof uuid>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringAToZ>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringStartsWith>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringEndsWith>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringMax5>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringMin5>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringLen5>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringMin5Max10>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof stringStartsWithMax5>>().toEqualTypeOf<string>();
expectTypeOf<z.infer<typeof brandedString>>().toEqualTypeOf<`${string & z.core.$brand<"myBrand">}`>();
// expectTypeOf<z.infer<typeof anything>>().toEqualTypeOf<`${any}`>();
expectTypeOf<z.infer<typeof url>>().toEqualTypeOf<`https://${string}.com` | `https://${string}.net`>();
expectTypeOf<z.infer<typeof measurement>>().toEqualTypeOf<
| `${number}`
| `${number}px`
| `${number}em`
| `${number}rem`
| `${number}vh`
| `${number}vw`
| `${number}vmin`
| `${number}vmax`
>();
expectTypeOf<z.infer<typeof connectionString>>().toEqualTypeOf<
| `mongodb://${string}:${number}`
| `mongodb://${string}:${number}/${string}`
| `mongodb://${string}:${number}/${string}?${string}`
| `mongodb://${string}:${string}@${string}:${number}`
| `mongodb://${string}:${string}@${string}:${number}/${string}`
| `mongodb://${string}:${string}@${string}:${number}/${string}?${string}`
>();
});
test("template literal unsupported args", () => {
expect(() =>
// @ts-expect-error
z.templateLiteral([z.object({})])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.array(z.object({}))])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.union([z.object({}), z.string()])])
).toThrow();
// @ts-expect-error
expect(() => z.templateLiteral([z.date()])).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.custom<object>((_) => true)])
).toThrow();
expect(() =>
z.templateLiteral([
// @ts-expect-error
z.discriminatedUnion("discriminator", [z.object({}), z.object({})]),
])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.function()])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.instanceof(class MyClass {})])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.intersection(z.object({}), z.object({}))])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.map(z.string(), z.string())])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.nullable(z.object({}))])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.optional(z.object({}))])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.promise()])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.record(z.unknown())])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.set(z.string())])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.symbol()])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.tuple([z.string()])])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.unknown()])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.void()])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.never()])
).toThrow();
// @ts-expect-error
expect(() => z.templateLiteral([z.nan()])).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.pipe(z.string(), z.string())])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.preprocess(() => true, z.boolean())])
).toThrow();
expect(() =>
// @ts-expect-error
z.templateLiteral([z.object({}).brand("brand")])
).toThrow();
// these constraints aren't enforced but they shouldn't throw
z.templateLiteral([z.number().multipleOf(2)]);
z.templateLiteral([z.string().emoji()]);
z.templateLiteral([z.string().url()]);
z.templateLiteral([z.string().url()]);
z.templateLiteral([z.string().trim()]);
z.templateLiteral([z.string().includes("train")]);
z.templateLiteral([z.string().toLowerCase()]);
z.templateLiteral([z.string().toUpperCase()]);
});
test("template literal parsing - success - basic cases", () => {
expect(() => z.templateLiteral([]).parse(7)).toThrow();
empty.parse("");
hello.parse("hello");
world.parse("world");
one.parse("1");
two.parse("2");
truee.parse("true");
anotherTrue.parse("true");
falsee.parse("false");
anotherFalse.parse("false");
nulll.parse("null");
anotherNull.parse("null");
undefinedd.parse("undefined");
anotherUndefined.parse("undefined");
anyString.parse("blahblahblah");
anyString.parse("");
lazyString.parse("blahblahblah");
lazyString.parse("");
anyNumber.parse("123");
anyNumber.parse("1.23");
anyNumber.parse("0");
anyNumber.parse("-1.23");
anyNumber.parse("-123");
// anyNumber.parse("Infinity");
// anyNumber.parse("-Infinity");
anyInt.parse("123");
// anyInt.parse("-123");
// anyFiniteNumber.parse("123");
// anyFiniteNumber.parse("1.23");
// anyFiniteNumber.parse("0");
// anyFiniteNumber.parse("-1.23");
// anyFiniteNumber.parse("-123");
// anyNegativeNumber.parse("-123");
// anyNegativeNumber.parse("-1.23");
// anyNegativeNumber.parse("-Infinity");
// anyPositiveNumber.parse("123");
// anyPositiveNumber.parse("1.23");
// anyPositiveNumber.parse("Infinity");
// zeroButInADumbWay.parse("0");
// zeroButInADumbWay.parse("00000");
// finiteButInADumbWay.parse("5");
// finiteButInADumbWay.parse("10");
// finiteButInADumbWay.parse("6.66");
bool.parse("true");
bool.parse("false");
bigone.parse("1");
anyBigint.parse("123456");
anyBigint.parse("0");
// anyBigint.parse("-123456");
nullableYo.parse("yo");
nullableYo.parse("null");
nullableString.parse("abc");
nullableString.parse("null");
optionalYeah.parse("yeah");
optionalYeah.parse("");
optionalString.parse("abc");
optionalString.parse("");
optionalNumber.parse("123");
optionalNumber.parse("1.23");
optionalNumber.parse("0");
optionalNumber.parse("-1.23");
optionalNumber.parse("-123");
// optionalNumber.parse("Infinity");
// optionalNumber.parse("-Infinity");
nullishBruh.parse("bruh");
nullishBruh.parse("null");
nullishBruh.parse("");
cuid.parse("cjld2cyuq0000t3rmniod1foy");
cuidZZZ.parse("cjld2cyuq0000t3rmniod1foyZZZ");
cuid2.parse("tz4a98xxat96iws9zmbrgj3a");
datetime.parse(new Date().toISOString());
email.parse("info@example.com");
// ip.parse("213.174.246.205");
// ip.parse("c359:f57c:21e5:39eb:1187:e501:f936:b452");
ipv4.parse("213.174.246.205");
ipv6.parse("c359:f57c:21e5:39eb:1187:e501:f936:b452");
ulid.parse("01GW3D2QZJBYB6P1Z1AE997VPW");
uuid.parse("808989fd-3a6e-4af2-b607-737323a176f6");
stringAToZ.parse("asudgaskhdgashd");
stringStartsWith.parse("hello world");
stringEndsWith.parse("hello world");
stringMax5.parse("hello");
stringMin5.parse("hello");
stringLen5.parse("hello");
stringMin5Max10.parse("hello worl");
stringStartsWithMax5.parse("hello");
brandedString.parse("branded string");
});
test("template literal parsing - failure - basic cases", () => {
expect(() => empty.parse("a")).toThrow();
expect(() => hello.parse("hello!")).toThrow();
expect(() => hello.parse("!hello")).toThrow();
expect(() => world.parse("world!")).toThrow();
expect(() => world.parse("!world")).toThrow();
expect(() => one.parse("2")).toThrow();
expect(() => one.parse("12")).toThrow();
expect(() => one.parse("21")).toThrow();
expect(() => two.parse("1")).toThrow();
expect(() => two.parse("21")).toThrow();
expect(() => two.parse("12")).toThrow();
expect(() => truee.parse("false")).toThrow();
expect(() => truee.parse("1true")).toThrow();
expect(() => truee.parse("true1")).toThrow();
expect(() => anotherTrue.parse("false")).toThrow();
expect(() => anotherTrue.parse("1true")).toThrow();
expect(() => anotherTrue.parse("true1")).toThrow();
expect(() => falsee.parse("true")).toThrow();
expect(() => falsee.parse("1false")).toThrow();
expect(() => falsee.parse("false1")).toThrow();
expect(() => anotherFalse.parse("true")).toThrow();
expect(() => anotherFalse.parse("1false")).toThrow();
expect(() => anotherFalse.parse("false1")).toThrow();
expect(() => nulll.parse("123")).toThrow();
expect(() => nulll.parse("null1")).toThrow();
expect(() => nulll.parse("1null")).toThrow();
expect(() => anotherNull.parse("123")).toThrow();
expect(() => anotherNull.parse("null1")).toThrow();
expect(() => anotherNull.parse("1null")).toThrow();
expect(() => undefinedd.parse("123")).toThrow();
expect(() => undefinedd.parse("undefined1")).toThrow();
expect(() => undefinedd.parse("1undefined")).toThrow();
expect(() => anotherUndefined.parse("123")).toThrow();
expect(() => anotherUndefined.parse("undefined1")).toThrow();
expect(() => anotherUndefined.parse("1undefined")).toThrow();
expect(() => anyNumber.parse("2a")).toThrow();
expect(() => anyNumber.parse("a2")).toThrow();
expect(() => anyNumber.parse("-2a")).toThrow();
expect(() => anyNumber.parse("a-2")).toThrow();
expect(() => anyNumber.parse("2.5a")).toThrow();
expect(() => anyNumber.parse("a2.5")).toThrow();
expect(() => anyNumber.parse("Infinitya")).toThrow();
expect(() => anyNumber.parse("aInfinity")).toThrow();
expect(() => anyNumber.parse("-Infinitya")).toThrow();
expect(() => anyNumber.parse("a-Infinity")).toThrow();
expect(() => anyNumber.parse("2e5")).toThrow();
expect(() => anyNumber.parse("2e-5")).toThrow();
expect(() => anyNumber.parse("2e+5")).toThrow();
expect(() => anyNumber.parse("-2e5")).toThrow();
expect(() => anyNumber.parse("-2e-5")).toThrow();
expect(() => anyNumber.parse("-2e+5")).toThrow();
expect(() => anyNumber.parse("2.1e5")).toThrow();
expect(() => anyNumber.parse("2.1e-5")).toThrow();
expect(() => anyNumber.parse("2.1e+5")).toThrow();
expect(() => anyNumber.parse("-2.1e5")).toThrow();
expect(() => anyNumber.parse("-2.1e-5")).toThrow();
expect(() => anyNumber.parse("-2.1e+5")).toThrow();
expect(() => anyNumber.parse("-Infinity")).toThrow();
expect(() => anyNumber.parse("Infinity")).toThrow();
expect(() => anyInt.parse("1.23")).toThrow();
expect(() => anyInt.parse("-1.23")).toThrow();
expect(() => anyInt.parse("d1")).toThrow();
expect(() => anyInt.parse("1d")).toThrow();
// expect(() => anyFiniteNumber.parse("Infinity")).toThrow();
// expect(() => anyFiniteNumber.parse("-Infinity")).toThrow();
// expect(() => anyFiniteNumber.parse("123a")).toThrow();
// expect(() => anyFiniteNumber.parse("a123")).toThrow();
// expect(() => anyNegativeNumber.parse("0")).toThrow();
// expect(() => anyNegativeNumber.parse("1")).toThrow();
// expect(() => anyNegativeNumber.parse("Infinity")).toThrow();
// expect(() => anyPositiveNumber.parse("0")).toThrow();
// expect(() => anyPositiveNumber.parse("-1")).toThrow();
// expect(() => anyPositiveNumber.parse("-Infinity")).toThrow();
// expect(() => zeroButInADumbWay.parse("1")).toThrow();
// expect(() => zeroButInADumbWay.parse("-1")).toThrow();
// expect(() => finiteButInADumbWay.parse("Infinity")).toThrow();
// expect(() => finiteButInADumbWay.parse("-Infinity")).toThrow();
// expect(() => finiteButInADumbWay.parse("-5")).toThrow();
// expect(() => finiteButInADumbWay.parse("10a")).toThrow();
// expect(() => finiteButInADumbWay.parse("a10")).toThrow();
expect(() => bool.parse("123")).toThrow();
expect(() => bigone.parse("2")).toThrow();
expect(() => bigone.parse("c1")).toThrow();
expect(() => anyBigint.parse("1.23")).toThrow();
expect(() => anyBigint.parse("-1.23")).toThrow();
expect(() => anyBigint.parse("c123")).toThrow();
expect(() => nullableYo.parse("yo1")).toThrow();
expect(() => nullableYo.parse("1yo")).toThrow();
expect(() => nullableYo.parse("null1")).toThrow();
expect(() => nullableYo.parse("1null")).toThrow();
expect(() => optionalYeah.parse("yeah1")).toThrow();
expect(() => optionalYeah.parse("1yeah")).toThrow();
expect(() => optionalYeah.parse("undefined")).toThrow();
expect(() => optionalNumber.parse("123a")).toThrow();
expect(() => optionalNumber.parse("a123")).toThrow();
// expect(() => optionalNumber.parse("Infinitya")).toThrow();
// expect(() => optionalNumber.parse("aInfinity")).toThrow();
expect(() => nullishBruh.parse("bruh1")).toThrow();
expect(() => nullishBruh.parse("1bruh")).toThrow();
expect(() => nullishBruh.parse("null1")).toThrow();
expect(() => nullishBruh.parse("1null")).toThrow();
expect(() => nullishBruh.parse("undefined")).toThrow();
expect(() => cuid.parse("bjld2cyuq0000t3rmniod1foy")).toThrow();
expect(() => cuid.parse("cjld2cyu")).toThrow();
expect(() => cuid.parse("cjld2 cyu")).toThrow();
expect(() => cuid.parse("cjld2cyuq0000t3rmniod1foy ")).toThrow();
expect(() => cuid.parse("1cjld2cyuq0000t3rmniod1foy")).toThrow();
expect(() => cuidZZZ.parse("cjld2cyuq0000t3rmniod1foy")).toThrow();
expect(() => cuidZZZ.parse("cjld2cyuq0000t3rmniod1foyZZY")).toThrow();
expect(() => cuidZZZ.parse("cjld2cyuq0000t3rmniod1foyZZZ1")).toThrow();
expect(() => cuidZZZ.parse("1cjld2cyuq0000t3rmniod1foyZZZ")).toThrow();
expect(() => cuid2.parse("A9z4a98xxat96iws9zmbrgj3a")).toThrow();
expect(() => cuid2.parse("tz4a98xxat96iws9zmbrgj3!")).toThrow();
expect(() => datetime.parse("2022-01-01 00:00:00")).toThrow();
expect(() => email.parse("info@example.com@")).toThrow();
// expect(() => ip.parse("213.174.246:205")).toThrow();
// expect(() => ip.parse("c359.f57c:21e5:39eb:1187:e501:f936:b452")).toThrow();
expect(() => ipv4.parse("1213.174.246.205")).toThrow();
expect(() => ipv4.parse("c359:f57c:21e5:39eb:1187:e501:f936:b452")).toThrow();
expect(() => ipv6.parse("c359:f57c:21e5:39eb:1187:e501:f936:b4521")).toThrow();
expect(() => ipv6.parse("213.174.246.205")).toThrow();
expect(() => ulid.parse("01GW3D2QZJBYB6P1Z1AE997VPW!")).toThrow();
expect(() => uuid.parse("808989fd-3a6e-4af2-b607-737323a176f6Z")).toThrow();
expect(() => uuid.parse("Z808989fd-3a6e-4af2-b607-737323a176f6")).toThrow();
expect(() => stringAToZ.parse("asdasdasd1")).toThrow();
expect(() => stringAToZ.parse("1asdasdasd")).toThrow();
expect(() => stringStartsWith.parse("ahello")).toThrow();
expect(() => stringEndsWith.parse("worlda")).toThrow();
expect(() => stringMax5.parse("123456")).toThrow();
expect(() => stringMin5.parse("1234")).toThrow();
expect(() => stringLen5.parse("123456")).toThrow();
expect(() => stringLen5.parse("1234")).toThrow();
expect(() => stringMin5Max10.parse("1234")).toThrow();
expect(() => stringMin5Max10.parse("12345678901")).toThrow();
// the "startswith" overrides the max length
// expect(() => stringStartsWithMax5.parse("hello1")).toThrow();
expect(() => stringStartsWithMax5.parse("1hell")).toThrow();
expect(() => brandedString.parse("")).toThrow();
});
test("regexes", () => {
expect(empty._zod.pattern.source).toMatchInlineSnapshot(`"^$"`);
expect(hello._zod.pattern.source).toMatchInlineSnapshot(`"^hello$"`);
expect(world._zod.pattern.source).toMatchInlineSnapshot(`"^(world)$"`);
expect(one._zod.pattern.source).toMatchInlineSnapshot(`"^1$"`);
expect(two._zod.pattern.source).toMatchInlineSnapshot(`"^(2)$"`);
expect(truee._zod.pattern.source).toMatchInlineSnapshot(`"^true$"`);
expect(anotherTrue._zod.pattern.source).toMatchInlineSnapshot(`"^(true)$"`);
expect(falsee._zod.pattern.source).toMatchInlineSnapshot(`"^false$"`);
expect(anotherFalse._zod.pattern.source).toMatchInlineSnapshot(`"^(false)$"`);
expect(nulll._zod.pattern.source).toMatchInlineSnapshot(`"^null$"`);
expect(anotherNull._zod.pattern.source).toMatchInlineSnapshot(`"^null$"`);
expect(undefinedd._zod.pattern.source).toMatchInlineSnapshot(`"^undefined$"`);
expect(anotherUndefined._zod.pattern.source).toMatchInlineSnapshot(`"^undefined$"`);
expect(anyString._zod.pattern.source).toMatchInlineSnapshot(`"^[\\s\\S]{0,}$"`);
expect(lazyString._zod.pattern.source).toMatchInlineSnapshot(`"^[\\s\\S]{0,}$"`);
expect(anyNumber._zod.pattern.source).toMatchInlineSnapshot(`"^-?\\d+(?:\\.\\d+)?$"`);
expect(anyInt._zod.pattern.source).toMatchInlineSnapshot(`"^\\d+$"`);
// expect(anyFiniteNumber._zod.pattern.source).toMatchInlineSnapshot(`"^-?\\d+(?:\\.\\d+)?$"`);
// expect(anyNegativeNumber._zod.pattern.source).toMatchInlineSnapshot(`"^-?\\d+(?:\\.\\d+)?$"`);
// expect(anyPositiveNumber._zod.pattern.source).toMatchInlineSnapshot(`"^-?\\d+(?:\\.\\d+)?$"`);
// expect(zeroButInADumbWay._zod.pattern.source).toMatchInlineSnapshot(`"^-?\\d+(?:\\.\\d+)?$"`);
// expect(finiteButInADumbWay._zod.pattern.source).toMatchInlineSnapshot(`"^-?\\d+(?:\\.\\d+)?$"`);
expect(bool._zod.pattern.source).toMatchInlineSnapshot(`"^true|false$"`);
expect(bigone._zod.pattern.source).toMatchInlineSnapshot(`"^(1)$"`);
expect(anyBigint._zod.pattern.source).toMatchInlineSnapshot(`"^\\d+n?$"`);
expect(nullableYo._zod.pattern.source).toMatchInlineSnapshot(`"^((yo)|null)$"`);
expect(nullableString._zod.pattern.source).toMatchInlineSnapshot(`"^([\\s\\S]{0,}|null)$"`);
expect(optionalYeah._zod.pattern.source).toMatchInlineSnapshot(`"^((yeah))?$"`);
expect(optionalString._zod.pattern.source).toMatchInlineSnapshot(`"^([\\s\\S]{0,})?$"`);
expect(optionalNumber._zod.pattern.source).toMatchInlineSnapshot(`"^(-?\\d+(?:\\.\\d+)?)?$"`);
expect(nullishBruh._zod.pattern.source).toMatchInlineSnapshot(`"^(((bruh)|null))?$"`);
expect(nullishString._zod.pattern.source).toMatchInlineSnapshot(`"^(([\\s\\S]{0,}|null))?$"`);
expect(cuid._zod.pattern.source).toMatchInlineSnapshot(`"^[cC][^\\s-]{8,}$"`);
expect(cuidZZZ._zod.pattern.source).toMatchInlineSnapshot(`"^[cC][^\\s-]{8,}ZZZ$"`);
expect(cuid2._zod.pattern.source).toMatchInlineSnapshot(`"^[0-9a-z]+$"`);
expect(datetime._zod.pattern.source).toMatchInlineSnapshot(
`"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"`
);
expect(email._zod.pattern.source).toMatchInlineSnapshot(
`"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"`
);
// expect(ip._zod.pattern.source).toMatchInlineSnapshot(
// `"^(^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$)|(^(([a-fA-F0-9]{1,4}:){7}|::([a-fA-F0-9]{1,4}:){0,6}|([a-fA-F0-9]{1,4}:){1}:([a-fA-F0-9]{1,4}:){0,5}|([a-fA-F0-9]{1,4}:){2}:([a-fA-F0-9]{1,4}:){0,4}|([a-fA-F0-9]{1,4}:){3}:([a-fA-F0-9]{1,4}:){0,3}|([a-fA-F0-9]{1,4}:){4}:([a-fA-F0-9]{1,4}:){0,2}|([a-fA-F0-9]{1,4}:){5}:([a-fA-F0-9]{1,4}:){0,1})([a-fA-F0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$)$"`
// );
expect(ipv4._zod.pattern.source).toMatchInlineSnapshot(
`"^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$"`
);
expect(ipv6._zod.pattern.source).toMatchInlineSnapshot(
`"^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$"`
);
expect(ulid._zod.pattern.source).toMatchInlineSnapshot(`"^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$"`);
expect(uuid._zod.pattern.source).toMatchInlineSnapshot(
`"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"`
);
expect(stringAToZ._zod.pattern.source).toMatchInlineSnapshot(`"^[a-z]+$"`);
expect(stringStartsWith._zod.pattern.source).toMatchInlineSnapshot(`"^hello.*$"`);
expect(stringEndsWith._zod.pattern.source).toMatchInlineSnapshot(`"^.*world$"`);
expect(stringMax5._zod.pattern.source).toMatchInlineSnapshot(`"^[\\s\\S]{0,5}$"`);
expect(stringMin5._zod.pattern.source).toMatchInlineSnapshot(`"^[\\s\\S]{5,}$"`);
expect(stringLen5._zod.pattern.source).toMatchInlineSnapshot(`"^[\\s\\S]{5,5}$"`);
expect(stringMin5Max10._zod.pattern.source).toMatchInlineSnapshot(`"^[\\s\\S]{5,10}$"`);
expect(brandedString._zod.pattern.source).toMatchInlineSnapshot(`"^[\\s\\S]{1,}$"`);
expect(url._zod.pattern.source).toMatchInlineSnapshot(`"^https:\\/\\/\\w+\\.(com|net)$"`);
expect(measurement._zod.pattern.source).toMatchInlineSnapshot(`"^-?\\d+(?:\\.\\d+)?((px|em|rem|vh|vw|vmin|vmax))?$"`);
expect(connectionString._zod.pattern.source).toMatchInlineSnapshot(
`"^mongodb:\\/\\/(\\w+:\\w+@)?\\w+:\\d+(\\/(\\w+)?(\\?(\\w+=\\w+(&\\w+=\\w+)*)?)?)?$"`
);
});
test("template literal parsing - success - complex cases", () => {
url.parse("https://example.com");
url.parse("https://speedtest.net");
// measurement.parse(1);
// measurement.parse(1.1);
// measurement.parse(0);
// measurement.parse(-1.1);
// measurement.parse(-1);
measurement.parse("1");
measurement.parse("1.1");
measurement.parse("0");
measurement.parse("-1");
measurement.parse("-1.1");
measurement.parse("1px");
measurement.parse("1.1px");
measurement.parse("0px");
measurement.parse("-1px");
measurement.parse("-1.1px");
measurement.parse("1em");
measurement.parse("1.1em");
measurement.parse("0em");
measurement.parse("-1em");
measurement.parse("-1.1em");
measurement.parse("1rem");
measurement.parse("1.1rem");
measurement.parse("0rem");
measurement.parse("-1rem");
measurement.parse("-1.1rem");
measurement.parse("1vh");
measurement.parse("1.1vh");
measurement.parse("0vh");
measurement.parse("-1vh");
measurement.parse("-1.1vh");
measurement.parse("1vw");
measurement.parse("1.1vw");
measurement.parse("0vw");
measurement.parse("-1vw");
measurement.parse("-1.1vw");
measurement.parse("1vmin");
measurement.parse("1.1vmin");
measurement.parse("0vmin");
measurement.parse("-1vmin");
measurement.parse("-1.1vmin");
measurement.parse("1vmax");
measurement.parse("1.1vmax");
measurement.parse("0vmax");
measurement.parse("-1vmax");
measurement.parse("-1.1vmax");
connectionString.parse("mongodb://host:1234");
connectionString.parse("mongodb://host:1234/");
connectionString.parse("mongodb://host:1234/defaultauthdb");
connectionString.parse("mongodb://host:1234/defaultauthdb?authSource=admin");
connectionString.parse("mongodb://host:1234/defaultauthdb?authSource=admin&connectTimeoutMS=300000");
connectionString.parse("mongodb://host:1234/?authSource=admin");
connectionString.parse("mongodb://host:1234/?authSource=admin&connectTimeoutMS=300000");
connectionString.parse("mongodb://username:password@host:1234");
connectionString.parse("mongodb://username:password@host:1234/");
connectionString.parse("mongodb://username:password@host:1234/defaultauthdb");
connectionString.parse("mongodb://username:password@host:1234/defaultauthdb?authSource=admin");
connectionString.parse(
"mongodb://username:password@host:1234/defaultauthdb?authSource=admin&connectTimeoutMS=300000"
);
connectionString.parse("mongodb://username:password@host:1234/?authSource=admin");
connectionString.parse("mongodb://username:password@host:1234/?authSource=admin&connectTimeoutMS=300000");
});
test("template literal parsing - failure - complex cases", () => {
expect(() => url.parse("http://example.com")).toThrow();
expect(() => url.parse("https://.com")).toThrow();
expect(() => url.parse("https://examplecom")).toThrow();
expect(() => url.parse("https://example.org")).toThrow();
expect(() => url.parse("https://example.net.il")).toThrow();
expect(() => measurement.parse("1.1.1")).toThrow();
expect(() => measurement.parse("Infinity")).toThrow();
expect(() => measurement.parse("-Infinity")).toThrow();
expect(() => measurement.parse("NaN")).toThrow();
expect(() => measurement.parse("1%")).toThrow();
expect(() => connectionString.parse("mongod://host:1234")).toThrow();
expect(() => connectionString.parse("mongodb://:1234")).toThrow();
expect(() => connectionString.parse("mongodb://host1234")).toThrow();
expect(() => connectionString.parse("mongodb://host:d234")).toThrow();
expect(() => connectionString.parse("mongodb://host:12.34")).toThrow();
expect(() => connectionString.parse("mongodb://host:-1234")).toThrow();
expect(() => connectionString.parse("mongodb://host:-12.34")).toThrow();
expect(() => connectionString.parse("mongodb://host:")).toThrow();
expect(() => connectionString.parse("mongodb://:password@host:1234")).toThrow();
expect(() => connectionString.parse("mongodb://usernamepassword@host:1234")).toThrow();
expect(() => connectionString.parse("mongodb://username:@host:1234")).toThrow();
expect(() => connectionString.parse("mongodb://@host:1234")).toThrow();
expect(() => connectionString.parse("mongodb://host:1234/defaultauthdb?authSourceadmin")).toThrow();
expect(() => connectionString.parse("mongodb://host:1234/?authSourceadmin")).toThrow();
expect(() => connectionString.parse("mongodb://host:1234/defaultauthdb?&authSource=admin")).toThrow();
expect(() => connectionString.parse("mongodb://host:1234/?&authSource=admin")).toThrow();
});
test("template literal parsing - failure - issue format", () => {
expect(anotherNull.safeParse("1null")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_format",
"format": "template_literal",
"pattern": "^null$",
"path": [],
"message": "Invalid input"
}
]],
"success": false,
}
`);
expect(cuidZZZ.safeParse("1cjld2cyuq0000t3rmniod1foyZZZ")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_format",
"format": "template_literal",
"pattern": "^[cC][^\\\\s-]{8,}ZZZ$",
"path": [],
"message": "Invalid input"
}
]],
"success": false,
}
`);
expect(stringMin5Max10.safeParse("1234")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_format",
"format": "template_literal",
"pattern": "^[\\\\s\\\\S]{5,10}$",
"path": [],
"message": "Invalid input"
}
]],
"success": false,
}
`);
expect(connectionString.safeParse("mongodb://host:1234/defaultauthdb?authSourceadmin")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_format",
"format": "template_literal",
"pattern": "^mongodb:\\\\/\\\\/(\\\\w+:\\\\w+@)?\\\\w+:\\\\d+(\\\\/(\\\\w+)?(\\\\?(\\\\w+=\\\\w+(&\\\\w+=\\\\w+)*)?)?)?$",
"path": [],
"message": "Invalid input"
}
]],
"success": false,
}
`);
expect(stringStartsWithMax5.safeParse("1hell")).toMatchInlineSnapshot(`
{
"error": [ZodError: [
{
"code": "invalid_format",
"format": "template_literal",
"pattern": "^hello.*$",
"path": [],
"message": "Invalid input"
}
]],
"success": false,
}
`);
});
@@ -0,0 +1,720 @@
flf2a$ 7 5 16 0 5 0 64 0
Font Author: ?
Font based on TheDraw's "THIS!.TDF"
FIGFont created with: http://patorjk.com/figfont-editor
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
▄$@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
▄▀▀█▄$ @
▐ ▄▀ ▀▄$@
█▄▄▄█$@
▄▀ █$@
█ ▄▀$ @
▐ ▐$ @
@@
▄▀▀█▄▄$ @
▐ ▄▀ █$@
█▄▄▄▀$ @
█ █$ @
▄▀▄▄▄▀$ @
█ ▐$ @
▐ @@
▄▀▄▄▄▄$ @
█ █ ▌$@
▐ █ @
█ @
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄$ @
█ ▄▀ █$@
▐ █ █$@
█ █$@
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄▄▄$@
▐ ▄▀ ▐$@
█▄▄▄▄▄$ @
█ ▌$ @
▄▀▄▄▄▄$ @
█ ▐$ @
▐ @@
▄▀▀▀█▄$ @
█ ▄▀ ▀▄$@
▐ █▄▄▄▄$ @
█ ▐$ @
█ @
█ @
▐ @@
▄▀▀▀▀▄$ @
█ @
█ ▀▄▄$ @
█ █ █$@
▐▀▄▄▄▄▀ ▐$@
▐ @
@@
▄▀▀▄ ▄▄$ @
█ █ ▄▀$@
▐ █▄▄▄█$ @
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀█▀▄$ @
█ █ █$ @
▐ █ ▐$ @
█ @
▄▀▀▀▀▀▄$ @
█ █$@
▐ ▐$@@
▄█$@
▄▀▀▀█▀ ▐$@
█ █$ @
▐ █$ @
▄ ▀▄$ @
▀▀▀▀$ @
@@
▄▀▀▄ █$@
█ █ ▄▀$@
▐ █▀▄$ @
█ █$@
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄ @
█ █ @
▐ █ @
█ @
▄▀▄▄▄▄▄▄▀$@
█ @
▐ @@
▄▀▀▄ ▄▀▄$@
█ █ ▀ █$@
▐ █ █$@
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀▄ ▀▄$@
█ █ █ █$@
▐ █ ▀█$@
█ █$ @
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄$ @
█ █$@
█ █$@
▀▄ ▄▀$@
▀▀▀▀ $ @
@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀▀▀$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ █$ @
█ █$ @
▀▄▄▄▄▀▄$ @
█$@
▐$@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀█▀$ @
▄▀ █$ @
█ █$ @
▐ ▐$ @
@@
▄▀▀▀▀▄$@
█ █ ▐$@
▀▄$ @
▀▄ █$ @
█▀▀▀$ @
▐ @
@@
▄▀▀▀█▀▀▄$@
█ █ ▐$@
▐ █$ @
█$ @
▄▀$ @
█ @
▐ @@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ █$ @
▀▄▄▄▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ ▄▀$ @
▀▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ ▐ █$@
▐ █ █$@
█ ▄ █$ @
▀▄▀ ▀▄ ▄▀$ @
▀$ @
@@
▄▀▀▄ ▄▀▄$@
█ █ █$@
▐ ▀▄▀$ @
▄▀ █$ @
█ ▄▀$ @
▄▀ ▄▀$ @
█ ▐$ @@
▄▀▀▄ ▀▀▄$@
█ ▀▄ ▄▀$@
▐ █$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ ▄▀$ @
▐ ▄▄▀▀$ @
█$ @
▀▄▄▄▄▀$@
▐$ @
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
▄▀▀█▄$ @
▐ ▄▀ ▀▄$@
█▄▄▄█$@
▄▀ █$@
█ ▄▀$ @
▐ ▐$ @
@@
▄▀▀█▄▄$ @
▐ ▄▀ █$@
█▄▄▄▀$ @
█ █$ @
▄▀▄▄▄▀$ @
█ ▐$ @
▐ @@
▄▀▄▄▄▄$ @
█ █ ▌$@
▐ █ @
█ @
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄$ @
█ ▄▀ █$@
▐ █ █$@
█ █$@
▄▀▄▄▄▄▀$@
█ ▐$ @
▐ @@
▄▀▀█▄▄▄▄$@
▐ ▄▀ ▐$@
█▄▄▄▄▄$ @
█ ▌$ @
▄▀▄▄▄▄$ @
█ ▐$ @
▐ @@
▄▀▀▀█▄$ @
█ ▄▀ ▀▄$@
▐ █▄▄▄▄$ @
█ ▐$ @
█ @
█ @
▐ @@
▄▀▀▀▀▄$ @
█ @
█ ▀▄▄$ @
█ █ █$@
▐▀▄▄▄▄▀ ▐$@
▐ @
@@
▄▀▀▄ ▄▄$ @
█ █ ▄▀$@
▐ █▄▄▄█$ @
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀█▀▄$ @
█ █ █$ @
▐ █ ▐$ @
█ @
▄▀▀▀▀▀▄$ @
█ █$@
▐ ▐$@@
▄█$@
▄▀▀▀█▀ ▐$@
█ █$ @
▐ █$ @
▄ ▀▄$ @
▀▀▀▀$ @
@@
▄▀▀▄ █$@
█ █ ▄▀$@
▐ █▀▄$ @
█ █$@
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄ @
█ █ @
▐ █ @
█ @
▄▀▄▄▄▄▄▄▀$@
█ @
▐ @@
▄▀▀▄ ▄▀▄$@
█ █ ▀ █$@
▐ █ █$@
█ █$ @
▄▀ ▄▀$ @
█ █$ @
▐ ▐$ @@
▄▀▀▄ ▀▄$@
█ █ █ █$@
▐ █ ▀█$@
█ █$ @
▄▀ █$ @
█ ▐$ @
▐ @@
▄▀▀▀▀▄$ @
█ █$@
█ █$@
▀▄ ▄▀$@
▀▀▀▀ $ @
@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀▀▀$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ █$ @
█ █$ @
▀▄▄▄▄▀▄$ @
█$@
▐$@
@@
▄▀▀▄▀▀▀▄$@
█ █ █$@
▐ █▀▀█▀$ @
▄▀ █$ @
█ █$ @
▐ ▐$ @
@@
▄▀▀▀▀▄$@
█ █ ▐$@
▀▄$ @
▀▄ █$ @
█▀▀▀$ @
▐ @
@@
▄▀▀▀█▀▀▄$@
█ █ ▐$@
▐ █$ @
█$ @
▄▀$ @
█ @
▐ @@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ █$ @
▀▄▄▄▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ █$@
▐ █ █$ @
█ ▄▀$ @
▀▄▀$ @
@
@@
▄▀▀▄ ▄▀▀▄$@
█ █ ▐ █$@
▐ █ █$@
█ ▄ █$ @
▀▄▀ ▀▄ ▄▀$ @
▀$ @
@@
▄▀▀▄ ▄▀▄$@
█ █ █$@
▐ ▀▄▀$ @
▄▀ █$ @
█ ▄▀$ @
▄▀ ▄▀$ @
█ ▐$ @@
▄▀▀▄ ▀▀▄$@
█ ▀▄ ▄▀$@
▐ █$ @
█$ @
▄▀$ @
█$ @
▐$ @@
▄▀▀▀▀▄$ @
█ ▄▀$ @
▐ ▄▄▀▀$ @
█$ @
▀▄▄▄▄▀$@
▐$ @
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@@
@@ -0,0 +1,15 @@
const {asyncIterator} = Symbol;
const readBlob = async function* (blob) {
if (blob.stream) {
yield* blob.stream()
} else if (blob.arrayBuffer) {
yield await blob.arrayBuffer()
} else if (blob[asyncIterator]) {
yield* blob[asyncIterator]();
} else {
yield blob;
}
}
export default readBlob;
@@ -0,0 +1 @@
{"version":3,"file":"componentUtil.d.ts","sourceRoot":"","sources":["componentUtil.js"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,qCAJW,OAAO,WACP,OAAO,GACL,OAAO,CAmBnB;AAyCD;;;;GAIG;AACH,qCAJW,OAAO,WACP,OAAO,GACL,OAAO,CAmBnB;AAED;;;;;GAKG;AACH,+CAJW,OAAO,QACP,OAAO,GACL,OAAO,GAAC,IAAI,CAaxB;AAED;;;;;GAKG;AACH,+CAJW,OAAO,QACP,OAAO,GACL,OAAO,GAAG,IAAI,CAY1B;AAlGD;;;;;GAKG;AACH,0CAJW,GAAG,WACH,OAAO,GACL,OAAO,CAiCnB;AA+DD;;;;;GAKG;AACH,sCAJW,OAAO,WACP,OAAO,GACL,OAAO,CAQnB;AAED;;;GAGG;AACH,8CAHW,OAAO,GACL,OAAO,CAMnB"}
@@ -0,0 +1,943 @@
flf2a$ 9 8 18 0 24 0 64 0
Author : LG Beard
Date : 2005/5/8 6:45:39
Version: 1.0
-------------------------------------------------
_ _ _ _ _ _ ~ ~
=_/\\___ _____==__/\\___==_/\\___===_/\\_======_/\\_===_/\\___========~ ~====
(_ v ))(_ ____))(_ _ ))(_ _)) (____)) (_ )) ___~____
/ : <\ \\ / ._)) / |))// / \\ / \\ / : \\ ((______))_
/:. | // ///:. |____ /:. ~ \\ /:. \\__ /:. \\ /:. | // \:. /__)
\___| //\ // \ _____))\___| // \__ ____))\__ // \___| // \_ _/
=====\//==\//===\//===========\//=====\//========\//=======\//=======~~======
~ ~ ~ ~ ~ ~ ~
Font Built from a sig dated 17 Feb 1995
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $#
$ $#
$ $#
$ $#
$ $#
$ $#
$ $#
$ $#
$ $##
_ #
_/\\_ #
(_ _)) #
/ \\ #
/ \ :\\ #
\__/\// #
\// #
#
##
"#
#
#
#
#
#
#
#
##
##
#
#
#
#
#
#
#
##
_ #
/\\_ #
/ _ \\ #
\:.\\// #
/\\ \\ #
\_ _// #
\// #
#
##
%#
#
#
#
#
#
#
#
##
&#
#
#
#
#
#
#
#
##
____ #
(:. _)) #
\// #
#
#
#
#
#
##
_ #
//\__ #
// _\ #
\\:`\ #
//:./_ #
\\ __/ #
\\/ #
#
##
_ #
__/\\ #
/_ \\ #
/':// #
_\.:\\ #
\__ // #
\// #
#
##
*#
#
#
#
#
#
#
#
##
+#
#
#
#
#
#
#
#
##
#
#
#
#
___ #
((:. ) #
\\/ #
#
##
-#
#
#
#
#
#
#
#
##
#
#
#
#
_ #
_/\\_ #
(:.__)) #
#
##
_ #
//\ #
// / #
// / #
_//./ #
((_ _) #
\\/ #
#
##
_ #
__/\\__ #
(_ __)) #
/ _ \\ #
/:.(_)) \\ #
\ _____// #
\// #
#
##
_ #
_/\\_ #
(____)) #
/ \\ #
/:. \\ #
\__ // #
\// #
#
##
_ #
__//\ #
// \ #
\\_/ / #
/.:/_/\\ #
\ ___// #
\// #
#
##
_ #
__/\\ #
/ \\ #
\_/':// #
/ \.:\\ #
\__ // #
\// #
#
##
_ #
/\\ _ #
/ ///\\ #
\ \/ // #
_\:.// #
(_ _) #
\// #
#
##
_ #
/\\__ #
/ _ \\ #
\':\\\// #
/ \ \\ #
\__ // #
\// #
#
##
_ #
_/\\_ #
(____)) #
/ \_ #
/:. / \\ #
\ ___// #
\// #
#
##
_ #
___/\\ #
/ \\ #
\_/ .:// #
\ // #
(_ _)) #
\// #
#
##
_ #
/\\__ #
/:. \\ #
\ \_// #
/_\ \\ #
\__.:// #
\// #
#
##
_ #
___/\\ #
/ \\ #
\__/ :// #
\ // #
(_ _)) #
\// #
#
##
____ #
(:. _)) #
\// #
#
_ #
_/\\_ #
(:.__)) #
#
##
____ #
(:. _)) #
\// #
#
___ #
((:. ) #
\\/ #
#
##
#
_ #
//\__ #
//. _\ #
\\: __/ #
\\/ #
#
#
##
=#
#
#
#
#
#
#
#
##
#
_ #
__/\\ #
/_ :\\ #
\__ '// #
\// #
#
#
##
_ #
___/\\ #
/ \\ #
\_/\.:// #
_/ // #
(_ _)) #
\// #
#
##
@#
#
#
#
#
#
#
#
##
_ #
__/\\__ #
(_ ____) #
/ _ \\ #
/:./_\ \\ #
\ _ // #
\// \// #
#
##
_ #
__/\\___ #
(_ __)) #
/ ._))// #
/: ._))\\ #
\ ____// #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ || #
/:. ||___ #
\ _____)) #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ _ \\ #
/:. |_\ \\ #
\ _____// #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ ._)) #
/:. ||___ #
\ _____)) #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ ||__ #
/:. ._)) #
\ _)) #
\// #
#
##
_ #
__/\\__ #
(_ ___)) #
/ || _ #
/:. \/ \\ #
\ ____// #
\// #
#
##
_ #
_/\\___ #
(_ __ __)) #
/ |_| \\ #
/:. _ \\ #
\___| | // #
\// #
#
##
_ #
_/\\_ #
(____)) #
/ \\ #
/:. \\ #
\__ // #
\// #
#
##
_ #
__/\\__ #
(_ _)) #
\ \\ #
/\/ .:\\ #
\__ _// #
\// #
#
##
#
_/\\___ #
(_ __)) #
/ : \\ #
/:. | // #
\___| \\ #
\// #
#
##
_ #
_/\\_ #
(_ _)) #
/ \\ #
/:. \\__ #
\__ ____)) #
\// #
#
##
_ #
_/\\___ _____ #
(_ v )) #
/ : <\ \\ #
/:. | // // #
\___| //\ // #
\// \// #
#
##
_ #
_/\\___ #
(_ )) #
/ : \\ #
/:. | // #
\___| // #
\// #
#
##
_ #
__/\\___ #
(_ _)) #
/ _ \\ #
/:.(_)) \\ #
\ _____// #
\// #
#
##
_ #
_/\\___ #
(_ _ _)) #
/ |))\\ #
/:. ___// #
\_ \\ #
\// #
#
##
_ #
__/\\___ #
(_ __)) #
/ _ \\ #
/:.(_)) \\_ #
\ _______// #
\// #
#
##
_ #
_/\\___ #
(_ _ )) #
/ |))// #
/:. \\ #
\___| // #
\// #
#
##
_ #
/\\__ #
/ \\ #
_\ \_// #
// \:.\ #
\\__ / #
\\/ #
#
##
_ #
__/\\__ #
(__ __)) #
/ \\ #
/:. \\ #
\__ // #
\// #
#
##
_ #
___ /\\ #
/ //\ \\ #
\:.\\_\ \\ #
\ :. // #
(_ ___)) #
\// #
#
##
_ #
_ /\\ #
/ \\ \\ #
\:'/ // #
\ // #
(_ _)) #
\// #
#
##
_ _ #
___ /\\ /\\ #
/ | \\/ \\ #
\:' | \\ \\ #
\ : </ // #
(_ ___^____)) #
\// #
#
##
_ _ #
_/\\/\\_ #
(_ / __)) #
\/ \\ #
__/./.\\_ #
(_ _) _)) #
\// \// #
#
##
_ #
_ /\\ #
/\\ / // #
\ \/ // #
_\:.// #
(_ _)) #
\// #
#
##
_ #
__//\ #
// \ #
\\_/ /_ #
/.:/ \\ #
\ __// #
\// #
#
##
_ #
//\__ #
// _\ #
||:`| #
||:.|_ #
\\ __/ #
\\/ #
#
##
_ #
/\\ #
\ \\ #
\ \\ #
\:\\_ #
(_ _)) #
\// #
#
##
_ #
__/\\ #
/_ \\ #
|':|| #
_|.:|| #
\__ // #
\// #
#
##
^#
#
#
#
#
#
#
#
##
_#
#
#
#
#
#
#
#
##
___ #
((:. ) #
\\/ #
#
#
#
#
#
##
_ #
__/\\__ #
(_ ____) #
/ _ \\ #
/:./_\ \\ #
\ _ // #
\// \// #
#
##
_ #
__/\\___ #
(_ __)) #
/ ._))// #
/: ._))\\ #
\ ____// #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ || #
/:. ||___ #
\ _____)) #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ _ \\ #
/:. |_\ \\ #
\ _____// #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ ._)) #
/:. ||___ #
\ _____)) #
\// #
#
##
_ #
__/\\___ #
(_ ____)) #
/ ||__ #
/:. ._)) #
\ _)) #
\// #
#
##
_ #
__/\\__ #
(_ ___)) #
/ || _ #
/:. \/ \\ #
\ ____// #
\// #
#
##
_ #
_/\\___ #
(_ __ __)) #
/ |_| \\ #
/:. _ \\ #
\___| | // #
\// #
#
##
_ #
_/\\_ #
(____)) #
/ \\ #
/:. \\ #
\__ // #
\// #
#
##
_ #
__/\\__ #
(_ _)) #
\ \\ #
/\/ .:\\ #
\__ _// #
\// #
#
##
#
_/\\___ #
(_ __)) #
/ : \\ #
/:. | // #
\___| \\ #
\// #
#
##
_ #
_/\\_ #
(_ _)) #
/ \\ #
/:. \\__ #
\__ ____)) #
\// #
#
##
_ #
_/\\___ _____ #
(_ v )) #
/ : <\ \\ #
/:. | // // #
\___| //\ // #
\// \// #
#
##
_ #
_/\\___ #
(_ )) #
/ : \\ #
/:. | // #
\___| // #
\// #
#
##
_ #
__/\\___ #
(_ _)) #
/ _ \\ #
/:.(_)) \\ #
\ _____// #
\// #
#
##
_ #
_/\\___ #
(_ _ _)) #
/ |))\\ #
/:. ___// #
\_ \\ #
\// #
#
##
_ #
__/\\___ #
(_ __)) #
/ _ \\ #
/:.(_)) \\_ #
\ _______// #
\// #
#
##
_ #
_/\\___ #
(_ _ )) #
/ |))// #
/:. \\ #
\___| // #
\// #
#
##
_ #
/\\__ #
/ \\ #
_\ \_// #
// \:.\ #
\\__ / #
\\/ #
#
##
_ #
__/\\__ #
(__ __)) #
/ \\ #
/:. \\ #
\__ // #
\// #
#
##
_ #
___ /\\ #
/ //\ \\ #
\:.\\_\ \\ #
\ :. // #
(_ ___)) #
\// #
#
##
_ #
_ /\\ #
/ \\ \\ #
\:'/ // #
\ // #
(_ _)) #
\// #
#
##
_ _ #
___ /\\ /\\ #
/ | \\/ \\ #
\:' | \\ \\ #
\ : </ // #
(_ ___^____)) #
\// #
#
##
_ _ #
_/\\/\\_ #
(_ / __)) #
\/ \\ #
__/./.\\_ #
(_ _) _)) #
\// \// #
#
##
_ #
_ /\\ #
/\\ / // #
\ \/ // #
_\:.// #
(_ _)) #
\// #
#
##
_ #
__//\ #
// \ #
\\_/ /_ #
/.:/ \\ #
\ __// #
\// #
#
##
_ #
//\__ #
// _\ #
\\:`\ #
//:./_ #
\\ __/ #
\\/ #
#
##
_ #
_/\\_ #
(_ _)) #
/ \\ #
/:. \\ #
\ _// #
\// #
#
##
_ #
__/\\ #
/_ \\ #
/':// #
_\.:\\ #
\__ // #
\// #
#
##
~#
#
#
#
#
#
#
#
##
_ #
__/\\__ #
(_ ____) #
/ _ \\ #
/:./_\ \\ #
\ _ // #
\// \// #
#
##
_ #
__/\\___ #
(_ _)) #
/ _ \\ #
/:.(_)) \\ #
\ _____// #
\// #
#
##
_ #
___ /\\ #
/ //\ \\ #
\:.\\_\ \\ #
\ :. // #
(_ ___)) #
\// #
#
##
_ #
__/\\__ #
(_ ____) #
/ _ \\ #
/:./_\ \\ #
\ _ // #
\// \// #
#
##
_ #
__/\\___ #
(_ _)) #
/ _ \\ #
/:.(_)) \\ #
\ _____// #
\// #
#
##
_ #
___ /\\ #
/ //\ \\ #
\:.\\_\ \\ #
\ :. // #
(_ ___)) #
\// #
#
##
ß#
#
#
#
#
#
#
#
##
@@ -0,0 +1,115 @@
/**
* @fileoverview Enforces or disallows inline comments.
* @author Greg Cochard
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [{}],
docs: {
description: "Disallow inline comments after code",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-inline-comments",
},
schema: [
{
type: "object",
properties: {
ignorePattern: {
type: "string",
},
},
additionalProperties: false,
},
],
messages: {
unexpectedInlineComment: "Unexpected comment inline with code.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const [{ ignorePattern }] = context.options;
const customIgnoreRegExp =
ignorePattern && new RegExp(ignorePattern, "u");
/**
* Will check that comments are not on lines starting with or ending with code
* @param {ASTNode} node The comment node to check
* @private
* @returns {void}
*/
function testCodeAroundComment(node) {
const startLine = String(sourceCode.lines[node.loc.start.line - 1]),
endLine = String(sourceCode.lines[node.loc.end.line - 1]),
preamble = startLine.slice(0, node.loc.start.column).trim(),
postamble = endLine.slice(node.loc.end.column).trim(),
isPreambleEmpty = !preamble,
isPostambleEmpty = !postamble;
// Nothing on both sides
if (isPreambleEmpty && isPostambleEmpty) {
return;
}
// Matches the ignore pattern
if (customIgnoreRegExp && customIgnoreRegExp.test(node.value)) {
return;
}
// JSX Exception
if (
(isPreambleEmpty || preamble === "{") &&
(isPostambleEmpty || postamble === "}")
) {
const enclosingNode = sourceCode.getNodeByRangeIndex(
node.range[0],
);
if (
enclosingNode &&
enclosingNode.type === "JSXEmptyExpression"
) {
return;
}
}
// Don't report ESLint directive comments
if (astUtils.isDirectiveComment(node)) {
return;
}
context.report({
node,
messageId: "unexpectedInlineComment",
});
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
Program() {
sourceCode
.getAllComments()
.filter(token => token.type !== "Shebang")
.forEach(testCodeAroundComment);
},
};
},
};
@@ -0,0 +1,15 @@
/**
* Turn an mdast `break` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Break} node
* mdast node.
* @returns {Array<Element | Text>}
* hast element content.
*/
export function hardBreak(state: State, node: Break): Array<Element | Text>;
export type Element = import("hast").Element;
export type Text = import("hast").Text;
export type Break = import("mdast").Break;
export type State = import("../state.js").State;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"C L M G N O P","2":"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:{"2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C"},D:{"2":"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:{"2":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED"},F:{"2":"0 1 2 3 4 5 6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z FD GD HD ID NC uC JD OC"},G:{"2":"E ZC KD vC LD MD ND OD","132":"PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC"},H:{"2":"hD"},I:{"2":"TC J I iD jD kD lD vC mD nD"},J:{"2":"D","132":"A"},K:{"2":"A B C H NC uC","132":"OC"},L:{"2":"I"},M:{"2":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"2":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"2":"zD"},R:{"2":"0D"},S:{"2":"1D 2D"}},B:6,C:"AC-3 (Dolby Digital) and EC-3 (Dolby Digital Plus) codecs",D:false};
@@ -0,0 +1,86 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { getSourceCode } = require("eslint-compat-utils")
/**
* Checks whether it is string literal
* @param {string} s string source code
* @returns {boolean} true: is string literal source code
*/
function isStringLiteralCode(s) {
return (
(s.startsWith("'") && s.endsWith("'")) ||
(s.startsWith('"') && s.endsWith('"'))
)
}
/**
* Transform template literal to string concatenation.
* @param {ASTNode} node TemplateLiteral node.(not within TaggedTemplateExpression)
* @param {SourceCode} sourceCode SourceCode
* @returns {string} After transformation
*/
function templateLiteralToStringConcat(node, sourceCode) {
const ss = []
node.quasis.forEach((q, i) => {
const value = q.value.cooked
if (value) {
ss.push(JSON.stringify(value))
}
if (i < node.expressions.length) {
const e = node.expressions[i]
const text = sourceCode.getText(e)
ss.push(text)
}
})
if (!ss.length || !isStringLiteralCode(ss[0])) {
ss.unshift('""')
}
return ss.join("+")
}
module.exports = {
meta: {
docs: {
description: "disallow template literals.",
category: "ES2015",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-template-literals.html",
},
fixable: "code",
messages: {
forbidden: "ES2015 template literals are forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
const sourceCode = getSourceCode(context)
return {
"TaggedTemplateExpression, :not(TaggedTemplateExpression) > TemplateLiteral"(
node,
) {
context.report({
node,
messageId: "forbidden",
fix:
node.type === "TemplateLiteral"
? (fixer) =>
fixer.replaceText(
node,
templateLiteralToStringConcat(
node,
sourceCode,
),
)
: undefined,
})
},
}
},
}
@@ -0,0 +1,21 @@
import {useListState as $e72dd72e1c76a225$export$2f645645f7bca764} from "./useListState.module.js";
import {useSingleSelectListState as $a0d645289fe9b86b$export$e7f05e985daf4b5f} from "./useSingleSelectListState.module.js";
import {ListCollection as $a02d57049d202695$export$d085fb9e920b5ca7} from "./ListCollection.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {$e72dd72e1c76a225$export$2f645645f7bca764 as useListState, $a0d645289fe9b86b$export$e7f05e985daf4b5f as useSingleSelectListState, $a02d57049d202695$export$d085fb9e920b5ca7 as ListCollection};
//# sourceMappingURL=module.js.map
@@ -0,0 +1,91 @@
'use strict';
var utils = require('../utils.js');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
const messages = {
noSpaceBefore: "There should be no space before '='",
noSpaceAfter: "There should be no space after '='",
needSpaceBefore: "A space is required before '='",
needSpaceAfter: "A space is required after '='"
};
var jsxEqualsSpacing = utils.createRule({
name: "jsx-equals-spacing",
package: "jsx",
meta: {
type: "layout",
docs: {
description: "Enforce or disallow spaces around equal signs in JSX attributes"
},
fixable: "code",
messages,
schema: [
{
type: "string",
enum: ["always", "never"]
}
]
},
create(context) {
const config = context.options[0] || "never";
return {
JSXOpeningElement(node) {
node.attributes.forEach((attrNode) => {
if (!(attrNode.type !== "JSXSpreadAttribute" && attrNode.value !== null))
return;
const sourceCode = context.sourceCode;
const equalToken = sourceCode.getTokenAfter(attrNode.name);
const spacedBefore = sourceCode.isSpaceBetweenTokens(attrNode.name, equalToken);
const spacedAfter = sourceCode.isSpaceBetweenTokens(equalToken, attrNode.value);
if (config === "never") {
if (spacedBefore) {
context.report({
node: attrNode,
messageId: "noSpaceBefore",
loc: equalToken.loc.start,
fix(fixer) {
return fixer.removeRange([attrNode.name.range[1], equalToken.range[0]]);
}
});
}
if (spacedAfter) {
context.report({
node: attrNode,
messageId: "noSpaceAfter",
loc: equalToken.loc.start,
fix(fixer) {
return fixer.removeRange([equalToken.range[1], attrNode.value.range[0]]);
}
});
}
} else if (config === "always") {
if (!spacedBefore) {
context.report({
messageId: "needSpaceBefore",
node: attrNode,
loc: equalToken.loc.start,
fix(fixer) {
return fixer.insertTextBefore(equalToken, " ");
}
});
}
if (!spacedAfter) {
context.report({
node: attrNode,
messageId: "needSpaceAfter",
loc: equalToken.loc.start,
fix(fixer) {
return fixer.insertTextAfter(equalToken, " ");
}
});
}
}
});
}
};
}
});
module.exports = jsxEqualsSpacing;
@@ -0,0 +1 @@
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAED,2EAA2E;AACpE,MAAM,4CAAoB;AAC1B,MAAM,4CAAc","sources":["packages/@react-aria/utils/src/constants.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\n// Custom event names for updating the autocomplete's aria-activedecendant.\nexport const CLEAR_FOCUS_EVENT = 'react-aria-clear-focus';\nexport const FOCUS_EVENT = 'react-aria-focus';\n"],"names":[],"version":3,"file":"constants.main.js.map"}
@@ -0,0 +1,18 @@
# `@img/sharp-linux-x64`
Prebuilt sharp for use with Linux (glibc) x64.
## Licensing
Copyright 2013 Lovell Fuller and others.
Licensed 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
[https://www.apache.org/licenses/LICENSE-2.0](https://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 CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1,54 @@
'use strict';
const astUtil = require('./ast');
/**
* Checks if the node is a React.createContext call
* @param {ASTNode} node - The AST node being checked.
* @returns {boolean} - True if node is a React.createContext call, false if not.
*/
module.exports = function isCreateContext(node) {
if (
node.init
&& node.init.callee
) {
if (
astUtil.isCallExpression(node.init)
&& node.init.callee.name === 'createContext'
) {
return true;
}
if (
node.init.callee.type === 'MemberExpression'
&& node.init.callee.property
&& node.init.callee.property.name === 'createContext'
) {
return true;
}
}
if (
node.expression
&& node.expression.type === 'AssignmentExpression'
&& node.expression.operator === '='
&& astUtil.isCallExpression(node.expression.right)
&& node.expression.right.callee
) {
const right = node.expression.right;
if (right.callee.name === 'createContext') {
return true;
}
if (
right.callee.type === 'MemberExpression'
&& right.callee.property
&& right.callee.property.name === 'createContext'
) {
return true;
}
}
return false;
};
@@ -0,0 +1,21 @@
declare function diff(
text1: string,
text2: string,
cursorPos?: number | diff.CursorInfo,
cleanup?: boolean
): diff.Diff[];
declare namespace diff {
type Diff = [-1 | 0 | 1, string];
const DELETE: -1;
const INSERT: 1;
const EQUAL: 0;
interface CursorInfo {
oldRange: { index: number; length: number };
newRange: { index: number; length: number };
}
}
export = diff;
@@ -0,0 +1 @@
module.exports={C:{"4":0.02055,"88":0.00685,"115":0.09589,"120":0.00685,"122":0.00685,"123":0.00685,"125":0.00685,"128":0.00685,"136":0.00685,"140":0.0137,"141":0.00685,"142":0.0137,"143":0.62326,"144":0.44519,_:"2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 121 124 126 127 129 130 131 132 133 134 135 137 138 139 145 146 147 3.5 3.6"},D:{"38":0.00685,"39":0.0137,"40":0.0137,"41":0.0137,"42":0.0137,"43":0.0137,"44":0.0137,"45":0.0137,"46":0.0137,"47":0.0137,"48":0.0137,"49":0.02055,"50":0.0137,"51":0.0137,"52":0.0137,"53":0.02055,"54":0.0137,"55":0.0137,"56":0.0137,"57":0.0137,"58":0.0137,"59":0.0137,"60":0.0137,"70":0.00685,"79":0.09589,"81":0.00685,"85":0.00685,"87":0.06164,"88":0.00685,"91":0.00685,"93":0.00685,"95":0.02055,"96":0.00685,"97":0.02055,"99":0.00685,"100":0.00685,"101":0.00685,"102":0.0137,"103":0.0137,"104":0.04109,"106":0.00685,"108":0.04109,"109":1.13693,"110":0.02055,"111":0.03425,"112":6.75311,"113":0.00685,"114":0.02055,"116":0.04109,"119":0.0137,"120":0.0274,"121":0.06849,"122":0.11643,"123":0.0274,"124":0.0274,"125":11.15702,"126":0.62326,"127":0.0274,"128":0.04109,"129":0.02055,"130":0.02055,"131":0.10958,"132":0.05479,"133":0.05479,"134":0.06849,"135":0.12328,"136":0.08219,"137":0.12328,"138":0.3493,"139":0.47258,"140":8.43797,"141":23.14277,"142":0.32875,"143":0.00685,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 61 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 80 83 84 86 89 90 92 94 98 105 107 115 117 118 144 145"},F:{"91":0.00685,"92":0.0137,"95":0.0274,"114":0.0137,"120":0.10274,"121":0.26711,"122":2.08895,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 115 116 117 118 119 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00685,"85":0.00685,"92":0.0137,"109":0.0137,"114":0.04794,"121":0.00685,"122":0.0137,"130":0.00685,"131":0.0137,"133":0.00685,"134":0.00685,"135":0.00685,"136":0.0137,"137":0.0137,"138":0.03425,"139":0.0274,"140":0.67805,"141":3.38341,"142":0.02055,_:"12 13 14 15 16 17 79 80 81 83 84 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 119 120 123 124 125 126 127 128 129 132"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 6.1 7.1 9.1 10.1 11.1 12.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 17.0 26.2","5.1":0.00685,"13.1":0.00685,"14.1":0.00685,"15.1":0.00685,"15.6":0.03425,"16.3":0.00685,"16.4":0.00685,"16.5":0.00685,"16.6":0.03425,"17.1":0.00685,"17.2":0.00685,"17.3":0.0137,"17.4":0.02055,"17.5":0.0137,"17.6":0.05479,"18.0":0.00685,"18.1":0.00685,"18.2":0.0137,"18.3":0.02055,"18.4":0.0274,"18.5-18.6":0.05479,"26.0":0.19862,"26.1":0.00685},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00035,"5.0-5.1":0,"6.0-6.1":0.00139,"7.0-7.1":0.00104,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00312,"10.0-10.2":0.00035,"10.3":0.00589,"11.0-11.2":0.08735,"11.3-11.4":0.00208,"12.0-12.1":0.00069,"12.2-12.5":0.01698,"13.0-13.1":0,"13.2":0.00173,"13.3":0.00069,"13.4-13.7":0.00277,"14.0-14.4":0.00589,"14.5-14.8":0.00624,"15.0-15.1":0.00589,"15.2-15.3":0.00451,"15.4":0.0052,"15.5":0.00589,"15.6-15.8":0.07695,"16.0":0.0104,"16.1":0.01941,"16.2":0.01005,"16.3":0.01802,"16.4":0.00451,"16.5":0.00797,"16.6-16.7":0.10294,"17.0":0.00728,"17.1":0.01109,"17.2":0.00797,"17.3":0.01178,"17.4":0.0208,"17.5":0.0357,"17.6-17.7":0.09012,"18.0":0.02045,"18.1":0.04229,"18.2":0.02288,"18.3":0.07348,"18.4":0.03778,"18.5-18.6":1.92646,"26.0":0.23812,"26.1":0.00867},P:{"4":0.07195,"21":0.01028,"23":0.03083,"24":0.01028,"25":0.02056,"26":0.02056,"27":0.08223,"28":0.52419,"29":0.04111,_:"20 22 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","5.0-5.4":0.01028,"7.2-7.4":0.04111},I:{"0":0.04405,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00002},K:{"0":0.22687,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.02055,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.1544},Q:{_:"14.9"},O:{"0":0.0126},H:{"0":0},L:{"0":29.52601}};
@@ -0,0 +1,137 @@
<p align="center">
<a href="https://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
</a>
</p>
# glob-parent
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
Extract the non-magic parent path from a glob string.
## Usage
```js
var globParent = require('glob-parent');
globParent('path/to/*.js'); // 'path/to'
globParent('/root/path/to/*.js'); // '/root/path/to'
globParent('/*.js'); // '/'
globParent('*.js'); // '.'
globParent('**/*.js'); // '.'
globParent('path/{to,from}'); // 'path'
globParent('path/!(to|from)'); // 'path'
globParent('path/?(to|from)'); // 'path'
globParent('path/+(to|from)'); // 'path'
globParent('path/*(to|from)'); // 'path'
globParent('path/@(to|from)'); // 'path'
globParent('path/**/*'); // 'path'
// if provided a non-glob path, returns the nearest dir
globParent('path/foo/bar.js'); // 'path/foo'
globParent('path/foo/'); // 'path/foo'
globParent('path/foo'); // 'path' (see issue #3 for details)
```
## API
### `globParent(maybeGlobString, [options])`
Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below.
#### options
```js
{
// Disables the automatic conversion of slashes for Windows
flipBackslashes: true
}
```
## Escaping
The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters:
- `?` (question mark) unless used as a path segment alone
- `*` (asterisk)
- `|` (pipe)
- `(` (opening parenthesis)
- `)` (closing parenthesis)
- `{` (opening curly brace)
- `}` (closing curly brace)
- `[` (opening bracket)
- `]` (closing bracket)
**Example**
```js
globParent('foo/[bar]/') // 'foo'
globParent('foo/\\[bar]/') // 'foo/[bar]'
```
## Limitations
### Braces & Brackets
This library attempts a quick and imperfect method of determining which path
parts have glob magic without fully parsing/lexing the pattern. There are some
advanced use cases that can trip it up, such as nested braces where the outer
pair is escaped and the inner one contains a path separator. If you find
yourself in the unlikely circumstance of being affected by this or need to
ensure higher-fidelity glob handling in your library, it is recommended that you
pre-process your input with [expand-braces] and/or [expand-brackets].
### Windows
Backslashes are not valid path separators for globs. If a path with backslashes
is provided anyway, for simple cases, glob-parent will replace the path
separator for you and return the non-glob parent path (now with
forward-slashes, which are still valid as Windows path separators).
This cannot be used in conjunction with escape characters.
```js
// BAD
globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)'
// GOOD
globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)'
```
If you are using escape characters for a pattern without path parts (i.e.
relative to `cwd`), prefix with `./` to avoid confusing glob-parent.
```js
// BAD
globParent('foo \\[bar]') // 'foo '
globParent('foo \\[bar]*') // 'foo '
// GOOD
globParent('./foo \\[bar]') // 'foo [bar]'
globParent('./foo \\[bar]*') // '.'
```
## License
ISC
[expand-braces]: https://github.com/jonschlinkert/expand-braces
[expand-brackets]: https://github.com/jonschlinkert/expand-brackets
[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg
[npm-url]: https://www.npmjs.com/package/glob-parent
[npm-image]: https://img.shields.io/npm/v/glob-parent.svg
[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master
[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master
[travis-url]: https://travis-ci.org/gulpjs/glob-parent
[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor
[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg
[gitter-url]: https://gitter.im/gulpjs/gulp
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
@@ -0,0 +1 @@
{"name":"react-router-dom","version":"7.9.5","requiresBuild":false,"files":{"dist/index.js":{"checkedAt":1794532115356,"integrity":"sha512-OiN292m5DVjGkMUPX4f7USeQW7qECot65pDJBXs+dLKGCwc7OZMxi4OQchyaNnoVNdCfcJuKtlYqEighprapFQ==","mode":420,"size":1655},"package.json":{"checkedAt":1794532115356,"integrity":"sha512-ck5qtrAUi1spyOaxM0UXrNPVSiyUpBsU1Rx4ctZAAFCYkvL9UPjGM1wyINl6LzVTJ1V/cXyql0uqsxrEj/84vQ==","mode":420,"size":1689},"README.md":{"checkedAt":1794532115357,"integrity":"sha512-h/RdvnNGCLFpufSkItp0JIRVw1sd7AYjfjtqPx1r+E4kr+2oT1hhFj7m3P6UvkbJwaIoOoYsZdys4tJWj1b+dw==","mode":420,"size":292},"dist/index.mjs":{"checkedAt":1794532115357,"integrity":"sha512-wuidsRWiF4BUNIxz6M5DDEr8xLT16OaTksZFBNiw98jckfqTY9ERX7ECGU6zuvVXpDaxUQQIqzBNOmnC02tuaQ==","mode":420,"size":383},"dist/index.d.mts":{"checkedAt":1794532115357,"integrity":"sha512-7mq5zbjx29iHWbWmhRmGsCGos74LtpBrF88nOU/xDEh1+lUuvzaqs7mYlu33bNYhscACtJL1tWar0QHj7D23ag==","mode":420,"size":118},"dist/index.d.ts":{"checkedAt":1794532115357,"integrity":"sha512-7mq5zbjx29iHWbWmhRmGsCGos74LtpBrF88nOU/xDEh1+lUuvzaqs7mYlu33bNYhscACtJL1tWar0QHj7D23ag==","mode":420,"size":118},"LICENSE.md":{"checkedAt":1794532115357,"integrity":"sha512-qkJUqAOnDOXecjoiEC/0mAYM6stGOmTsCuVeenmknKO1aBxcti6Yf/SlwWamyaYaGuOQKLGQbZU8qZOsjzJPzg==","mode":420,"size":1161}}}
@@ -0,0 +1,687 @@
/**
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
interface IBlockVector {
x: number;
y: number;
w: number;
h: number;
}
export const blockElementDefinitions: { [index: string]: IBlockVector[] | undefined } = {
// Block elements (0x2580-0x2590)
'▀': [{ x: 0, y: 0, w: 8, h: 4 }], // UPPER HALF BLOCK
'▁': [{ x: 0, y: 7, w: 8, h: 1 }], // LOWER ONE EIGHTH BLOCK
'▂': [{ x: 0, y: 6, w: 8, h: 2 }], // LOWER ONE QUARTER BLOCK
'▃': [{ x: 0, y: 5, w: 8, h: 3 }], // LOWER THREE EIGHTHS BLOCK
'▄': [{ x: 0, y: 4, w: 8, h: 4 }], // LOWER HALF BLOCK
'▅': [{ x: 0, y: 3, w: 8, h: 5 }], // LOWER FIVE EIGHTHS BLOCK
'▆': [{ x: 0, y: 2, w: 8, h: 6 }], // LOWER THREE QUARTERS BLOCK
'▇': [{ x: 0, y: 1, w: 8, h: 7 }], // LOWER SEVEN EIGHTHS BLOCK
'█': [{ x: 0, y: 0, w: 8, h: 8 }], // FULL BLOCK
'▉': [{ x: 0, y: 0, w: 7, h: 8 }], // LEFT SEVEN EIGHTHS BLOCK
'▊': [{ x: 0, y: 0, w: 6, h: 8 }], // LEFT THREE QUARTERS BLOCK
'▋': [{ x: 0, y: 0, w: 5, h: 8 }], // LEFT FIVE EIGHTHS BLOCK
'▌': [{ x: 0, y: 0, w: 4, h: 8 }], // LEFT HALF BLOCK
'▍': [{ x: 0, y: 0, w: 3, h: 8 }], // LEFT THREE EIGHTHS BLOCK
'▎': [{ x: 0, y: 0, w: 2, h: 8 }], // LEFT ONE QUARTER BLOCK
'▏': [{ x: 0, y: 0, w: 1, h: 8 }], // LEFT ONE EIGHTH BLOCK
'▐': [{ x: 4, y: 0, w: 4, h: 8 }], // RIGHT HALF BLOCK
// Block elements (0x2594-0x2595)
'▔': [{ x: 0, y: 0, w: 8, h: 1 }], // UPPER ONE EIGHTH BLOCK
'▕': [{ x: 7, y: 0, w: 1, h: 8 }], // RIGHT ONE EIGHTH BLOCK
// Terminal graphic characters (0x2596-0x259F)
'▖': [{ x: 0, y: 4, w: 4, h: 4 }], // QUADRANT LOWER LEFT
'▗': [{ x: 4, y: 4, w: 4, h: 4 }], // QUADRANT LOWER RIGHT
'▘': [{ x: 0, y: 0, w: 4, h: 4 }], // QUADRANT UPPER LEFT
'▙': [{ x: 0, y: 0, w: 4, h: 8 }, { x: 0, y: 4, w: 8, h: 4 }], // QUADRANT UPPER LEFT AND LOWER LEFT AND LOWER RIGHT
'▚': [{ x: 0, y: 0, w: 4, h: 4 }, { x: 4, y: 4, w: 4, h: 4 }], // QUADRANT UPPER LEFT AND LOWER RIGHT
'▛': [{ x: 0, y: 0, w: 4, h: 8 }, { x: 4, y: 0, w: 4, h: 4 }], // QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER LEFT
'▜': [{ x: 0, y: 0, w: 8, h: 4 }, { x: 4, y: 0, w: 4, h: 8 }], // QUADRANT UPPER LEFT AND UPPER RIGHT AND LOWER RIGHT
'▝': [{ x: 4, y: 0, w: 4, h: 4 }], // QUADRANT UPPER RIGHT
'▞': [{ x: 4, y: 0, w: 4, h: 4 }, { x: 0, y: 4, w: 4, h: 4 }], // QUADRANT UPPER RIGHT AND LOWER LEFT
'▟': [{ x: 4, y: 0, w: 4, h: 8 }, { x: 0, y: 4, w: 8, h: 4 }], // QUADRANT UPPER RIGHT AND LOWER LEFT AND LOWER RIGHT
// VERTICAL ONE EIGHTH BLOCK-2 through VERTICAL ONE EIGHTH BLOCK-7
'\u{1FB70}': [{ x: 1, y: 0, w: 1, h: 8 }],
'\u{1FB71}': [{ x: 2, y: 0, w: 1, h: 8 }],
'\u{1FB72}': [{ x: 3, y: 0, w: 1, h: 8 }],
'\u{1FB73}': [{ x: 4, y: 0, w: 1, h: 8 }],
'\u{1FB74}': [{ x: 5, y: 0, w: 1, h: 8 }],
'\u{1FB75}': [{ x: 6, y: 0, w: 1, h: 8 }],
// HORIZONTAL ONE EIGHTH BLOCK-2 through HORIZONTAL ONE EIGHTH BLOCK-7
'\u{1FB76}': [{ x: 0, y: 1, w: 8, h: 1 }],
'\u{1FB77}': [{ x: 0, y: 2, w: 8, h: 1 }],
'\u{1FB78}': [{ x: 0, y: 3, w: 8, h: 1 }],
'\u{1FB79}': [{ x: 0, y: 4, w: 8, h: 1 }],
'\u{1FB7A}': [{ x: 0, y: 5, w: 8, h: 1 }],
'\u{1FB7B}': [{ x: 0, y: 6, w: 8, h: 1 }],
// LEFT AND LOWER ONE EIGHTH BLOCK
'\u{1FB7C}': [{ x: 0, y: 0, w: 1, h: 8 }, { x: 0, y: 7, w: 8, h: 1 }],
// LEFT AND UPPER ONE EIGHTH BLOCK
'\u{1FB7D}': [{ x: 0, y: 0, w: 1, h: 8 }, { x: 0, y: 0, w: 8, h: 1 }],
// RIGHT AND UPPER ONE EIGHTH BLOCK
'\u{1FB7E}': [{ x: 7, y: 0, w: 1, h: 8 }, { x: 0, y: 0, w: 8, h: 1 }],
// RIGHT AND LOWER ONE EIGHTH BLOCK
'\u{1FB7F}': [{ x: 7, y: 0, w: 1, h: 8 }, { x: 0, y: 7, w: 8, h: 1 }],
// UPPER AND LOWER ONE EIGHTH BLOCK
'\u{1FB80}': [{ x: 0, y: 0, w: 8, h: 1 }, { x: 0, y: 7, w: 8, h: 1 }],
// HORIZONTAL ONE EIGHTH BLOCK-1358
'\u{1FB81}': [{ x: 0, y: 0, w: 8, h: 1 }, { x: 0, y: 2, w: 8, h: 1 }, { x: 0, y: 4, w: 8, h: 1 }, { x: 0, y: 7, w: 8, h: 1 }],
// UPPER ONE QUARTER BLOCK
'\u{1FB82}': [{ x: 0, y: 0, w: 8, h: 2 }],
// UPPER THREE EIGHTHS BLOCK
'\u{1FB83}': [{ x: 0, y: 0, w: 8, h: 3 }],
// UPPER FIVE EIGHTHS BLOCK
'\u{1FB84}': [{ x: 0, y: 0, w: 8, h: 5 }],
// UPPER THREE QUARTERS BLOCK
'\u{1FB85}': [{ x: 0, y: 0, w: 8, h: 6 }],
// UPPER SEVEN EIGHTHS BLOCK
'\u{1FB86}': [{ x: 0, y: 0, w: 8, h: 7 }],
// RIGHT ONE QUARTER BLOCK
'\u{1FB87}': [{ x: 6, y: 0, w: 2, h: 8 }],
// RIGHT THREE EIGHTHS B0OCK
'\u{1FB88}': [{ x: 5, y: 0, w: 3, h: 8 }],
// RIGHT FIVE EIGHTHS BL0CK
'\u{1FB89}': [{ x: 3, y: 0, w: 5, h: 8 }],
// RIGHT THREE QUARTERS 0LOCK
'\u{1FB8A}': [{ x: 2, y: 0, w: 6, h: 8 }],
// RIGHT SEVEN EIGHTHS B0OCK
'\u{1FB8B}': [{ x: 1, y: 0, w: 7, h: 8 }],
// CHECKER BOARD FILL
'\u{1FB95}': [
{ x: 0, y: 0, w: 2, h: 2 }, { x: 4, y: 0, w: 2, h: 2 },
{ x: 2, y: 2, w: 2, h: 2 }, { x: 6, y: 2, w: 2, h: 2 },
{ x: 0, y: 4, w: 2, h: 2 }, { x: 4, y: 4, w: 2, h: 2 },
{ x: 2, y: 6, w: 2, h: 2 }, { x: 6, y: 6, w: 2, h: 2 }
],
// INVERSE CHECKER BOARD FILL
'\u{1FB96}': [
{ x: 2, y: 0, w: 2, h: 2 }, { x: 6, y: 0, w: 2, h: 2 },
{ x: 0, y: 2, w: 2, h: 2 }, { x: 4, y: 2, w: 2, h: 2 },
{ x: 2, y: 4, w: 2, h: 2 }, { x: 6, y: 4, w: 2, h: 2 },
{ x: 0, y: 6, w: 2, h: 2 }, { x: 4, y: 6, w: 2, h: 2 }
],
// HEAVY HORIZONTAL FILL (upper middle and lower one quarter block)
'\u{1FB97}': [{ x: 0, y: 2, w: 8, h: 2 }, { x: 0, y: 6, w: 8, h: 2 }]
};
type PatternDefinition = number[][];
/**
* Defines the repeating pattern used by special characters, the pattern is made up of a 2d array of
* pixel values to be filled (1) or not filled (0).
*/
const patternCharacterDefinitions: { [key: string]: PatternDefinition | undefined } = {
// Shade characters (0x2591-0x2593)
'░': [ // LIGHT SHADE (25%)
[1, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 0]
],
'▒': [ // MEDIUM SHADE (50%)
[1, 0],
[0, 0],
[0, 1],
[0, 0]
],
'▓': [ // DARK SHADE (75%)
[0, 1],
[1, 1],
[1, 0],
[1, 1]
]
};
const enum Shapes {
/** │ */ TOP_TO_BOTTOM = 'M.5,0 L.5,1',
/** ─ */ LEFT_TO_RIGHT = 'M0,.5 L1,.5',
/** └ */ TOP_TO_RIGHT = 'M.5,0 L.5,.5 L1,.5',
/** ┘ */ TOP_TO_LEFT = 'M.5,0 L.5,.5 L0,.5',
/** ┐ */ LEFT_TO_BOTTOM = 'M0,.5 L.5,.5 L.5,1',
/** ┌ */ RIGHT_TO_BOTTOM = 'M0.5,1 L.5,.5 L1,.5',
/** ╵ */ MIDDLE_TO_TOP = 'M.5,.5 L.5,0',
/** ╴ */ MIDDLE_TO_LEFT = 'M.5,.5 L0,.5',
/** ╶ */ MIDDLE_TO_RIGHT = 'M.5,.5 L1,.5',
/** ╷ */ MIDDLE_TO_BOTTOM = 'M.5,.5 L.5,1',
/** ┴ */ T_TOP = 'M0,.5 L1,.5 M.5,.5 L.5,0',
/** ┤ */ T_LEFT = 'M.5,0 L.5,1 M.5,.5 L0,.5',
/** ├ */ T_RIGHT = 'M.5,0 L.5,1 M.5,.5 L1,.5',
/** ┬ */ T_BOTTOM = 'M0,.5 L1,.5 M.5,.5 L.5,1',
/** ┼ */ CROSS = 'M0,.5 L1,.5 M.5,0 L.5,1',
/** ╌ */ TWO_DASHES_HORIZONTAL = 'M.1,.5 L.4,.5 M.6,.5 L.9,.5', // .2 empty, .3 filled
/** ┄ */ THREE_DASHES_HORIZONTAL = 'M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5', // .1333 empty, .2 filled
/** ┉ */ FOUR_DASHES_HORIZONTAL = 'M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5', // .1 empty, .15 filled
/** ╎ */ TWO_DASHES_VERTICAL = 'M.5,.1 L.5,.4 M.5,.6 L.5,.9',
/** ┆ */ THREE_DASHES_VERTICAL = 'M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333',
/** ┊ */ FOUR_DASHES_VERTICAL = 'M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95',
}
const enum Style {
NORMAL = 1,
BOLD = 3
}
/**
* @param xp The percentage of 15% of the x axis.
* @param yp The percentage of 15% of the x axis on the y axis.
*/
type DrawFunctionDefinition = (xp: number, yp: number) => string;
/**
* This contains the definitions of all box drawing characters in the format of SVG paths (ie. the
* svg d attribute).
*/
export const boxDrawingDefinitions: { [character: string]: { [fontWeight: number]: string | DrawFunctionDefinition } | undefined } = {
// Uniform normal and bold
'─': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT },
'━': { [Style.BOLD]: Shapes.LEFT_TO_RIGHT },
'│': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM },
'┃': { [Style.BOLD]: Shapes.TOP_TO_BOTTOM },
'┌': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM },
'┏': { [Style.BOLD]: Shapes.RIGHT_TO_BOTTOM },
'┐': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM },
'┓': { [Style.BOLD]: Shapes.LEFT_TO_BOTTOM },
'└': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT },
'┗': { [Style.BOLD]: Shapes.TOP_TO_RIGHT },
'┘': { [Style.NORMAL]: Shapes.TOP_TO_LEFT },
'┛': { [Style.BOLD]: Shapes.TOP_TO_LEFT },
'├': { [Style.NORMAL]: Shapes.T_RIGHT },
'┣': { [Style.BOLD]: Shapes.T_RIGHT },
'┤': { [Style.NORMAL]: Shapes.T_LEFT },
'┫': { [Style.BOLD]: Shapes.T_LEFT },
'┬': { [Style.NORMAL]: Shapes.T_BOTTOM },
'┳': { [Style.BOLD]: Shapes.T_BOTTOM },
'┴': { [Style.NORMAL]: Shapes.T_TOP },
'┻': { [Style.BOLD]: Shapes.T_TOP },
'┼': { [Style.NORMAL]: Shapes.CROSS },
'╋': { [Style.BOLD]: Shapes.CROSS },
'╴': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT },
'╸': { [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'╵': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP },
'╹': { [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'╶': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT },
'╺': { [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'╷': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM },
'╻': { [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
// Double border
'═': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp}` },
'║': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1` },
'╒': { [Style.NORMAL]: (xp, yp) => `M.5,1 L.5,${.5 - yp} L1,${.5 - yp} M.5,${.5 + yp} L1,${.5 + yp}` },
'╓': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},1 L${.5 - xp},.5 L1,.5 M${.5 + xp},.5 L${.5 + xp},1` },
'╔': { [Style.NORMAL]: (xp, yp) => `M1,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1` },
'╕': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L.5,${.5 - yp} L.5,1 M0,${.5 + yp} L.5,${.5 + yp}` },
'╖': { [Style.NORMAL]: (xp, yp) => `M${.5 + xp},1 L${.5 + xp},.5 L0,.5 M${.5 - xp},.5 L${.5 - xp},1` },
'╗': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M0,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},1` },
'╘': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 + yp} L1,${.5 + yp} M.5,${.5 - yp} L1,${.5 - yp}` },
'╙': { [Style.NORMAL]: (xp, yp) => `M1,.5 L${.5 - xp},.5 L${.5 - xp},0 M${.5 + xp},.5 L${.5 + xp},0` },
'╚': { [Style.NORMAL]: (xp, yp) => `M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0 M1,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},0` },
'╛': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L.5,${.5 + yp} L.5,0 M0,${.5 - yp} L.5,${.5 - yp}` },
'╜': { [Style.NORMAL]: (xp, yp) => `M0,.5 L${.5 + xp},.5 L${.5 + xp},0 M${.5 - xp},.5 L${.5 - xp},0` },
'╝': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0 M0,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},0` },
'╞': { [Style.NORMAL]: (xp, yp) => `${Shapes.TOP_TO_BOTTOM} M.5,${.5 - yp} L1,${.5 - yp} M.5,${.5 + yp} L1,${.5 + yp}` },
'╟': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1 M${.5 + xp},.5 L1,.5` },
'╠': { [Style.NORMAL]: (xp, yp) => `M${.5 - xp},0 L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1 M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0` },
'╡': { [Style.NORMAL]: (xp, yp) => `${Shapes.TOP_TO_BOTTOM} M0,${.5 - yp} L.5,${.5 - yp} M0,${.5 + yp} L.5,${.5 + yp}` },
'╢': { [Style.NORMAL]: (xp, yp) => `M0,.5 L${.5 - xp},.5 M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1` },
'╣': { [Style.NORMAL]: (xp, yp) => `M${.5 + xp},0 L${.5 + xp},1 M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0` },
'╤': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp} M.5,${.5 + yp} L.5,1` },
'╥': { [Style.NORMAL]: (xp, yp) => `${Shapes.LEFT_TO_RIGHT} M${.5 - xp},.5 L${.5 - xp},1 M${.5 + xp},.5 L${.5 + xp},1` },
'╦': { [Style.NORMAL]: (xp, yp) => `M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1` },
'╧': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 - yp} M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp}` },
'╨': { [Style.NORMAL]: (xp, yp) => `${Shapes.LEFT_TO_RIGHT} M${.5 - xp},.5 L${.5 - xp},0 M${.5 + xp},.5 L${.5 + xp},0` },
'╩': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L1,${.5 + yp} M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0 M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0` },
'╪': { [Style.NORMAL]: (xp, yp) => `${Shapes.TOP_TO_BOTTOM} M0,${.5 - yp} L1,${.5 - yp} M0,${.5 + yp} L1,${.5 + yp}` },
'╫': { [Style.NORMAL]: (xp, yp) => `${Shapes.LEFT_TO_RIGHT} M${.5 - xp},0 L${.5 - xp},1 M${.5 + xp},0 L${.5 + xp},1` },
'╬': { [Style.NORMAL]: (xp, yp) => `M0,${.5 + yp} L${.5 - xp},${.5 + yp} L${.5 - xp},1 M1,${.5 + yp} L${.5 + xp},${.5 + yp} L${.5 + xp},1 M0,${.5 - yp} L${.5 - xp},${.5 - yp} L${.5 - xp},0 M1,${.5 - yp} L${.5 + xp},${.5 - yp} L${.5 + xp},0` },
// Diagonal
'╱': { [Style.NORMAL]: 'M1,0 L0,1' },
'╲': { [Style.NORMAL]: 'M0,0 L1,1' },
'╳': { [Style.NORMAL]: 'M1,0 L0,1 M0,0 L1,1' },
// Mixed weight
'╼': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT, [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'╽': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP, [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
'╾': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT, [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'╿': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'┍': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'┎': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT, [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
'┑': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'┒': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT, [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
'┕': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP, [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'┖': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'┙': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP, [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'┚': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'┝': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'┞': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'┟': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT, [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
'┠': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT, [Style.BOLD]: Shapes.TOP_TO_BOTTOM },
'┡': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM, [Style.BOLD]: Shapes.TOP_TO_RIGHT },
'┢': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP, [Style.BOLD]: Shapes.RIGHT_TO_BOTTOM },
'┥': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'┦': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'┧': { [Style.NORMAL]: Shapes.TOP_TO_LEFT, [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
'┨': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT, [Style.BOLD]: Shapes.TOP_TO_BOTTOM },
'┩': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM, [Style.BOLD]: Shapes.TOP_TO_LEFT },
'┪': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP, [Style.BOLD]: Shapes.LEFT_TO_BOTTOM },
'┭': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'┮': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM, [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'┯': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM, [Style.BOLD]: Shapes.LEFT_TO_RIGHT },
'┰': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT, [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
'┱': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT, [Style.BOLD]: Shapes.LEFT_TO_BOTTOM },
'┲': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT, [Style.BOLD]: Shapes.RIGHT_TO_BOTTOM },
'┵': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT, [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'┶': { [Style.NORMAL]: Shapes.TOP_TO_LEFT, [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'┷': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP, [Style.BOLD]: Shapes.LEFT_TO_RIGHT },
'┸': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'┹': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT, [Style.BOLD]: Shapes.TOP_TO_LEFT },
'┺': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT, [Style.BOLD]: Shapes.TOP_TO_RIGHT },
'┽': { [Style.NORMAL]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_RIGHT}`, [Style.BOLD]: Shapes.MIDDLE_TO_LEFT },
'┾': { [Style.NORMAL]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_LEFT}`, [Style.BOLD]: Shapes.MIDDLE_TO_RIGHT },
'┿': { [Style.NORMAL]: Shapes.TOP_TO_BOTTOM, [Style.BOLD]: Shapes.LEFT_TO_RIGHT },
'╀': { [Style.NORMAL]: `${Shapes.LEFT_TO_RIGHT} ${Shapes.MIDDLE_TO_BOTTOM}`, [Style.BOLD]: Shapes.MIDDLE_TO_TOP },
'╁': { [Style.NORMAL]: `${Shapes.MIDDLE_TO_TOP} ${Shapes.LEFT_TO_RIGHT}`, [Style.BOLD]: Shapes.MIDDLE_TO_BOTTOM },
'╂': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT, [Style.BOLD]: Shapes.TOP_TO_BOTTOM },
'╃': { [Style.NORMAL]: Shapes.RIGHT_TO_BOTTOM, [Style.BOLD]: Shapes.TOP_TO_LEFT },
'╄': { [Style.NORMAL]: Shapes.LEFT_TO_BOTTOM, [Style.BOLD]: Shapes.TOP_TO_RIGHT },
'╅': { [Style.NORMAL]: Shapes.TOP_TO_RIGHT, [Style.BOLD]: Shapes.LEFT_TO_BOTTOM },
'╆': { [Style.NORMAL]: Shapes.TOP_TO_LEFT, [Style.BOLD]: Shapes.RIGHT_TO_BOTTOM },
'╇': { [Style.NORMAL]: Shapes.MIDDLE_TO_BOTTOM, [Style.BOLD]: `${Shapes.MIDDLE_TO_TOP} ${Shapes.LEFT_TO_RIGHT}` },
'╈': { [Style.NORMAL]: Shapes.MIDDLE_TO_TOP, [Style.BOLD]: `${Shapes.LEFT_TO_RIGHT} ${Shapes.MIDDLE_TO_BOTTOM}` },
'╉': { [Style.NORMAL]: Shapes.MIDDLE_TO_RIGHT, [Style.BOLD]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_LEFT}` },
'╊': { [Style.NORMAL]: Shapes.MIDDLE_TO_LEFT, [Style.BOLD]: `${Shapes.TOP_TO_BOTTOM} ${Shapes.MIDDLE_TO_RIGHT}` },
// Dashed
'╌': { [Style.NORMAL]: Shapes.TWO_DASHES_HORIZONTAL },
'╍': { [Style.BOLD]: Shapes.TWO_DASHES_HORIZONTAL },
'┄': { [Style.NORMAL]: Shapes.THREE_DASHES_HORIZONTAL },
'┅': { [Style.BOLD]: Shapes.THREE_DASHES_HORIZONTAL },
'┈': { [Style.NORMAL]: Shapes.FOUR_DASHES_HORIZONTAL },
'┉': { [Style.BOLD]: Shapes.FOUR_DASHES_HORIZONTAL },
'╎': { [Style.NORMAL]: Shapes.TWO_DASHES_VERTICAL },
'╏': { [Style.BOLD]: Shapes.TWO_DASHES_VERTICAL },
'┆': { [Style.NORMAL]: Shapes.THREE_DASHES_VERTICAL },
'┇': { [Style.BOLD]: Shapes.THREE_DASHES_VERTICAL },
'┊': { [Style.NORMAL]: Shapes.FOUR_DASHES_VERTICAL },
'┋': { [Style.BOLD]: Shapes.FOUR_DASHES_VERTICAL },
// Curved
'╭': { [Style.NORMAL]: (xp, yp) => `M.5,1 L.5,${.5 + (yp / .15 * .5)} C.5,${.5 + (yp / .15 * .5)},.5,.5,1,.5` },
'╮': { [Style.NORMAL]: (xp, yp) => `M.5,1 L.5,${.5 + (yp / .15 * .5)} C.5,${.5 + (yp / .15 * .5)},.5,.5,0,.5` },
'╯': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 - (yp / .15 * .5)} C.5,${.5 - (yp / .15 * .5)},.5,.5,0,.5` },
'╰': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 - (yp / .15 * .5)} C.5,${.5 - (yp / .15 * .5)},.5,.5,1,.5` }
};
interface IVectorShape {
d: string;
type: VectorType;
leftPadding?: number;
rightPadding?: number;
}
const enum VectorType {
FILL,
STROKE
}
/**
* This contains the definitions of the primarily used box drawing characters as vector shapes. The
* reason these characters are defined specially is to avoid common problems if a user's font has
* not been patched with powerline characters and also to get pixel perfect rendering as rendering
* issues can occur around AA/SPAA.
*
* The line variants draw beyond the cell and get clipped to ensure the end of the line is not
* visible.
*
* Original symbols defined in https://github.com/powerline/fontpatcher
*/
export const powerlineDefinitions: { [index: string]: IVectorShape } = {
// Right triangle solid
'\u{E0B0}': { d: 'M0,0 L1,.5 L0,1', type: VectorType.FILL, rightPadding: 2 },
// Right triangle line
'\u{E0B1}': { d: 'M-1,-.5 L1,.5 L-1,1.5', type: VectorType.STROKE, leftPadding: 1, rightPadding: 1 },
// Left triangle solid
'\u{E0B2}': { d: 'M1,0 L0,.5 L1,1', type: VectorType.FILL, leftPadding: 2 },
// Left triangle line
'\u{E0B3}': { d: 'M2,-.5 L0,.5 L2,1.5', type: VectorType.STROKE, leftPadding: 1, rightPadding: 1 },
// Right semi-circle solid
'\u{E0B4}': { d: 'M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0', type: VectorType.FILL, rightPadding: 1 },
// Right semi-circle line
'\u{E0B5}': { d: 'M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0', type: VectorType.STROKE, rightPadding: 1 },
// Left semi-circle solid
'\u{E0B6}': { d: 'M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0', type: VectorType.FILL, leftPadding: 1 },
// Left semi-circle line
'\u{E0B7}': { d: 'M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0', type: VectorType.STROKE, leftPadding: 1 },
// Lower left triangle
'\u{E0B8}': { d: 'M-.5,-.5 L1.5,1.5 L-.5,1.5', type: VectorType.FILL },
// Backslash separator
'\u{E0B9}': { d: 'M-.5,-.5 L1.5,1.5', type: VectorType.STROKE, leftPadding: 1, rightPadding: 1 },
// Lower right triangle
'\u{E0BA}': { d: 'M1.5,-.5 L-.5,1.5 L1.5,1.5', type: VectorType.FILL },
// Upper left triangle
'\u{E0BC}': { d: 'M1.5,-.5 L-.5,1.5 L-.5,-.5', type: VectorType.FILL },
// Forward slash separator
'\u{E0BD}': { d: 'M1.5,-.5 L-.5,1.5', type: VectorType.STROKE, leftPadding: 1, rightPadding: 1 },
// Upper right triangle
'\u{E0BE}': { d: 'M-.5,-.5 L1.5,1.5 L1.5,-.5', type: VectorType.FILL }
};
// Forward slash separator redundant
powerlineDefinitions['\u{E0BB}'] = powerlineDefinitions['\u{E0BD}'];
// Backslash separator redundant
powerlineDefinitions['\u{E0BF}'] = powerlineDefinitions['\u{E0B9}'];
/**
* Try drawing a custom block element or box drawing character, returning whether it was
* successfully drawn.
*/
export function tryDrawCustomChar(
ctx: CanvasRenderingContext2D,
c: string,
xOffset: number,
yOffset: number,
deviceCellWidth: number,
deviceCellHeight: number,
fontSize: number,
devicePixelRatio: number
): boolean {
const blockElementDefinition = blockElementDefinitions[c];
if (blockElementDefinition) {
drawBlockElementChar(ctx, blockElementDefinition, xOffset, yOffset, deviceCellWidth, deviceCellHeight);
return true;
}
const patternDefinition = patternCharacterDefinitions[c];
if (patternDefinition) {
drawPatternChar(ctx, patternDefinition, xOffset, yOffset, deviceCellWidth, deviceCellHeight);
return true;
}
const boxDrawingDefinition = boxDrawingDefinitions[c];
if (boxDrawingDefinition) {
drawBoxDrawingChar(ctx, boxDrawingDefinition, xOffset, yOffset, deviceCellWidth, deviceCellHeight, devicePixelRatio);
return true;
}
const powerlineDefinition = powerlineDefinitions[c];
if (powerlineDefinition) {
drawPowerlineChar(ctx, powerlineDefinition, xOffset, yOffset, deviceCellWidth, deviceCellHeight, fontSize, devicePixelRatio);
return true;
}
return false;
}
function drawBlockElementChar(
ctx: CanvasRenderingContext2D,
charDefinition: IBlockVector[],
xOffset: number,
yOffset: number,
deviceCellWidth: number,
deviceCellHeight: number
): void {
for (let i = 0; i < charDefinition.length; i++) {
const box = charDefinition[i];
const xEighth = deviceCellWidth / 8;
const yEighth = deviceCellHeight / 8;
ctx.fillRect(
xOffset + box.x * xEighth,
yOffset + box.y * yEighth,
box.w * xEighth,
box.h * yEighth
);
}
}
const cachedPatterns: Map<PatternDefinition, Map</* fillStyle */string, CanvasPattern>> = new Map();
function drawPatternChar(
ctx: CanvasRenderingContext2D,
charDefinition: number[][],
xOffset: number,
yOffset: number,
deviceCellWidth: number,
deviceCellHeight: number
): void {
let patternSet = cachedPatterns.get(charDefinition);
if (!patternSet) {
patternSet = new Map();
cachedPatterns.set(charDefinition, patternSet);
}
const fillStyle = ctx.fillStyle;
if (typeof fillStyle !== 'string') {
throw new Error(`Unexpected fillStyle type "${fillStyle}"`);
}
let pattern = patternSet.get(fillStyle);
if (!pattern) {
const width = charDefinition[0].length;
const height = charDefinition.length;
const tmpCanvas = ctx.canvas.ownerDocument.createElement('canvas');
tmpCanvas.width = width;
tmpCanvas.height = height;
const tmpCtx = throwIfFalsy(tmpCanvas.getContext('2d'));
const imageData = new ImageData(width, height);
// Extract rgba from fillStyle
let r: number;
let g: number;
let b: number;
let a: number;
if (fillStyle.startsWith('#')) {
r = parseInt(fillStyle.slice(1, 3), 16);
g = parseInt(fillStyle.slice(3, 5), 16);
b = parseInt(fillStyle.slice(5, 7), 16);
a = fillStyle.length > 7 && parseInt(fillStyle.slice(7, 9), 16) || 1;
} else if (fillStyle.startsWith('rgba')) {
([r, g, b, a] = fillStyle.substring(5, fillStyle.length - 1).split(',').map(e => parseFloat(e)));
} else {
throw new Error(`Unexpected fillStyle color format "${fillStyle}" when drawing pattern glyph`);
}
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
imageData.data[(y * width + x) * 4 ] = r;
imageData.data[(y * width + x) * 4 + 1] = g;
imageData.data[(y * width + x) * 4 + 2] = b;
imageData.data[(y * width + x) * 4 + 3] = charDefinition[y][x] * (a * 255);
}
}
tmpCtx.putImageData(imageData, 0, 0);
pattern = throwIfFalsy(ctx.createPattern(tmpCanvas, null));
patternSet.set(fillStyle, pattern);
}
ctx.fillStyle = pattern;
ctx.fillRect(xOffset, yOffset, deviceCellWidth, deviceCellHeight);
}
/**
* Draws the following box drawing characters by mapping a subset of SVG d attribute instructions to
* canvas draw calls.
*
* Box styles: ┎┰┒┍┯┑╓╥╖╒╤╕ ┏┳┓┌┲┓┌┬┐┏┱┐
* ┌─┬─┐ ┏━┳━┓ ╔═╦═╗ ┠╂┨┝┿┥╟╫╢╞╪╡ ┡╇┩├╊┫┢╈┪┣╉┤
* │ │ │ ┃ ┃ ┃ ║ ║ ║ ┖┸┚┕┷┙╙╨╜╘╧╛ └┴┘└┺┛┗┻┛┗┹┘
* ├─┼─┤ ┣━╋━┫ ╠═╬═╣ ┏┱┐┌┲┓┌┬┐┌┬┐ ┏┳┓┌┮┓┌┬┐┏┭┐
* │ │ │ ┃ ┃ ┃ ║ ║ ║ ┡╃┤├╄┩├╆┪┢╅┤ ┞╀┦├┾┫┟╁┧┣┽┤
* └─┴─┘ ┗━┻━┛ ╚═╩═╝ └┴┘└┴┘└┺┛┗┹┘ └┴┘└┶┛┗┻┛┗┵┘
*
* Other:
* ╭─╮ ╲ ╱ ╷╻╎╏┆┇┊┋ ╺╾╴ ╌╌╌ ┄┄┄ ┈┈┈
* │ │ ╳ ╽╿╎╏┆┇┊┋ ╶╼╸ ╍╍╍ ┅┅┅ ┉┉┉
* ╰─╯ ╱ ╲ ╹╵╎╏┆┇┊┋
*
* All box drawing characters:
* ─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏
* ┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟
* ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯
* ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿
* ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏
* ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟
* ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯
* ╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿
*
* ---
*
* Box drawing alignment tests: █
* ▉
* ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
* ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
* ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
* ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
* ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
* ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
* ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
*
* Source: https://www.w3.org/2001/06/utf-8-test/UTF-8-demo.html
*/
function drawBoxDrawingChar(
ctx: CanvasRenderingContext2D,
charDefinition: { [fontWeight: number]: string | ((xp: number, yp: number) => string) },
xOffset: number,
yOffset: number,
deviceCellWidth: number,
deviceCellHeight: number,
devicePixelRatio: number
): void {
ctx.strokeStyle = ctx.fillStyle;
for (const [fontWeight, instructions] of Object.entries(charDefinition)) {
ctx.beginPath();
ctx.lineWidth = devicePixelRatio * Number.parseInt(fontWeight);
let actualInstructions: string;
if (typeof instructions === 'function') {
const xp = .15;
const yp = .15 / deviceCellHeight * deviceCellWidth;
actualInstructions = instructions(xp, yp);
} else {
actualInstructions = instructions;
}
for (const instruction of actualInstructions.split(' ')) {
const type = instruction[0];
const f = svgToCanvasInstructionMap[type];
if (!f) {
console.error(`Could not find drawing instructions for "${type}"`);
continue;
}
const args: string[] = instruction.substring(1).split(',');
if (!args[0] || !args[1]) {
continue;
}
f(ctx, translateArgs(args, deviceCellWidth, deviceCellHeight, xOffset, yOffset, true, devicePixelRatio));
}
ctx.stroke();
ctx.closePath();
}
}
function drawPowerlineChar(
ctx: CanvasRenderingContext2D,
charDefinition: IVectorShape,
xOffset: number,
yOffset: number,
deviceCellWidth: number,
deviceCellHeight: number,
fontSize: number,
devicePixelRatio: number
): void {
// Clip the cell to make sure drawing doesn't occur beyond bounds
const clipRegion = new Path2D();
clipRegion.rect(xOffset, yOffset, deviceCellWidth, deviceCellHeight);
ctx.clip(clipRegion);
ctx.beginPath();
// Scale the stroke with DPR and font size
const cssLineWidth = fontSize / 12;
ctx.lineWidth = devicePixelRatio * cssLineWidth;
for (const instruction of charDefinition.d.split(' ')) {
const type = instruction[0];
const f = svgToCanvasInstructionMap[type];
if (!f) {
console.error(`Could not find drawing instructions for "${type}"`);
continue;
}
const args: string[] = instruction.substring(1).split(',');
if (!args[0] || !args[1]) {
continue;
}
f(ctx, translateArgs(
args,
deviceCellWidth,
deviceCellHeight,
xOffset,
yOffset,
false,
devicePixelRatio,
(charDefinition.leftPadding ?? 0) * (cssLineWidth / 2),
(charDefinition.rightPadding ?? 0) * (cssLineWidth / 2)
));
}
if (charDefinition.type === VectorType.STROKE) {
ctx.strokeStyle = ctx.fillStyle;
ctx.stroke();
} else {
ctx.fill();
}
ctx.closePath();
}
function clamp(value: number, max: number, min: number = 0): number {
return Math.max(Math.min(value, max), min);
}
const svgToCanvasInstructionMap: { [index: string]: any } = {
'C': (ctx: CanvasRenderingContext2D, args: number[]) => ctx.bezierCurveTo(args[0], args[1], args[2], args[3], args[4], args[5]),
'L': (ctx: CanvasRenderingContext2D, args: number[]) => ctx.lineTo(args[0], args[1]),
'M': (ctx: CanvasRenderingContext2D, args: number[]) => ctx.moveTo(args[0], args[1])
};
function translateArgs(args: string[], cellWidth: number, cellHeight: number, xOffset: number, yOffset: number, doClamp: boolean, devicePixelRatio: number, leftPadding: number = 0, rightPadding: number = 0): number[] {
const result = args.map(e => parseFloat(e) || parseInt(e));
if (result.length < 2) {
throw new Error('Too few arguments for instruction');
}
for (let x = 0; x < result.length; x += 2) {
// Translate from 0-1 to 0-cellWidth
result[x] *= cellWidth - (leftPadding * devicePixelRatio) - (rightPadding * devicePixelRatio);
// Ensure coordinate doesn't escape cell bounds and round to the nearest 0.5 to ensure a crisp
// line at 100% devicePixelRatio
if (doClamp && result[x] !== 0) {
result[x] = clamp(Math.round(result[x] + 0.5) - 0.5, cellWidth, 0);
}
// Apply the cell's offset (ie. x*cellWidth)
result[x] += xOffset + (leftPadding * devicePixelRatio);
}
for (let y = 1; y < result.length; y += 2) {
// Translate from 0-1 to 0-cellHeight
result[y] *= cellHeight;
// Ensure coordinate doesn't escape cell bounds and round to the nearest 0.5 to ensure a crisp
// line at 100% devicePixelRatio
if (doClamp && result[y] !== 0) {
result[y] = clamp(Math.round(result[y] + 0.5) - 0.5, cellHeight, 0);
}
// Apply the cell's offset (ie. x*cellHeight)
result[y] += yOffset;
}
return result;
}
@@ -0,0 +1,9 @@
import type { TSESTree } from '@typescript-eslint/utils';
import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule } from '../util';
declare const baseRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noUselessConstructor" | "removeConstructor", [], unknown, {
MethodDefinition(node: TSESTree.MethodDefinition): void;
}>;
export type Options = InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = InferMessageIdsTypeFromRule<typeof baseRule>;
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"noUselessConstructor" | "removeConstructor", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,41 @@
'use strict'
const MinipassPipeline = require('minipass-pipeline')
class CachingMinipassPipeline extends MinipassPipeline {
#events = []
#data = new Map()
constructor (opts, ...streams) {
// CRITICAL: do NOT pass the streams to the call to super(), this will start
// the flow of data and potentially cause the events we need to catch to emit
// before we've finished our own setup. instead we call super() with no args,
// finish our setup, and then push the streams into ourselves to start the
// data flow
super()
this.#events = opts.events
/* istanbul ignore next - coverage disabled because this is pointless to test here */
if (streams.length) {
this.push(...streams)
}
}
on (event, handler) {
if (this.#events.includes(event) && this.#data.has(event)) {
return handler(...this.#data.get(event))
}
return super.on(event, handler)
}
emit (event, ...data) {
if (this.#events.includes(event)) {
this.#data.set(event, data)
}
return super.emit(event, ...data)
}
}
module.exports = CachingMinipassPipeline
@@ -0,0 +1,410 @@
# buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/buffer/master.svg
[travis-url]: https://travis-ci.org/feross/buffer
[npm-image]: https://img.shields.io/npm/v/buffer.svg
[npm-url]: https://npmjs.org/package/buffer
[downloads-image]: https://img.shields.io/npm/dm/buffer.svg
[downloads-url]: https://npmjs.org/package/buffer
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### The buffer module from [node.js](https://nodejs.org/), for the browser.
[![saucelabs][saucelabs-image]][saucelabs-url]
[saucelabs-image]: https://saucelabs.com/browser-matrix/buffer.svg
[saucelabs-url]: https://saucelabs.com/u/buffer
With [browserify](http://browserify.org), simply `require('buffer')` or use the `Buffer` global and you will get this module.
The goal is to provide an API that is 100% identical to
[node's Buffer API](https://nodejs.org/api/buffer.html). Read the
[official docs](https://nodejs.org/api/buffer.html) for the full list of properties,
instance methods, and class methods that are supported.
## features
- Manipulate binary data like a boss, in all browsers!
- Super fast. Backed by Typed Arrays (`Uint8Array`/`ArrayBuffer`, not `Object`)
- Extremely small bundle size (**6.75KB minified + gzipped**, 51.9KB with comments)
- Excellent browser support (Chrome, Firefox, Edge, Safari 9+, IE 11, iOS 9+, Android, etc.)
- Preserves Node API exactly, with one minor difference (see below)
- Square-bracket `buf[4]` notation works!
- Does not modify any browser prototypes or put anything on `window`
- Comprehensive test suite (including all buffer tests from node.js core)
## install
To use this module directly (without browserify), install it:
```bash
npm install buffer
```
This module was previously called **native-buffer-browserify**, but please use **buffer**
from now on.
If you do not use a bundler, you can use the [standalone script](https://bundle.run/buffer).
## usage
The module's API is identical to node's `Buffer` API. Read the
[official docs](https://nodejs.org/api/buffer.html) for the full list of properties,
instance methods, and class methods that are supported.
As mentioned above, `require('buffer')` or use the `Buffer` global with
[browserify](http://browserify.org) and this module will automatically be included
in your bundle. Almost any npm module will work in the browser, even if it assumes that
the node `Buffer` API will be available.
To depend on this module explicitly (without browserify), require it like this:
```js
var Buffer = require('buffer/').Buffer // note: the trailing slash is important!
```
To require this module explicitly, use `require('buffer/')` which tells the node.js module
lookup algorithm (also used by browserify) to use the **npm module** named `buffer`
instead of the **node.js core** module named `buffer`!
## how does it work?
The Buffer constructor returns instances of `Uint8Array` that have their prototype
changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`,
so the returned instances will have all the node `Buffer` methods and the
`Uint8Array` methods. Square bracket notation works as expected -- it returns a
single octet.
The `Uint8Array` prototype remains unmodified.
## tracking the latest node api
This module tracks the Buffer API in the latest (unstable) version of node.js. The Buffer
API is considered **stable** in the
[node stability index](https://nodejs.org/docs/latest/api/documentation.html#documentation_stability_index),
so it is unlikely that there will ever be breaking changes.
Nonetheless, when/if the Buffer API changes in node, this module's API will change
accordingly.
## related packages
- [`buffer-reverse`](https://www.npmjs.com/package/buffer-reverse) - Reverse a buffer
- [`buffer-xor`](https://www.npmjs.com/package/buffer-xor) - Bitwise xor a buffer
- [`is-buffer`](https://www.npmjs.com/package/is-buffer) - Determine if an object is a Buffer without including the whole `Buffer` package
## conversion packages
### convert typed array to buffer
Use [`typedarray-to-buffer`](https://www.npmjs.com/package/typedarray-to-buffer) to convert any kind of typed array to a `Buffer`. Does not perform a copy, so it's super fast.
### convert buffer to typed array
`Buffer` is a subclass of `Uint8Array` (which is a typed array). So there is no need to explicitly convert to typed array. Just use the buffer as a `Uint8Array`.
### convert blob to buffer
Use [`blob-to-buffer`](https://www.npmjs.com/package/blob-to-buffer) to convert a `Blob` to a `Buffer`.
### convert buffer to blob
To convert a `Buffer` to a `Blob`, use the `Blob` constructor:
```js
var blob = new Blob([ buffer ])
```
Optionally, specify a mimetype:
```js
var blob = new Blob([ buffer ], { type: 'text/html' })
```
### convert arraybuffer to buffer
To convert an `ArrayBuffer` to a `Buffer`, use the `Buffer.from` function. Does not perform a copy, so it's super fast.
```js
var buffer = Buffer.from(arrayBuffer)
```
### convert buffer to arraybuffer
To convert a `Buffer` to an `ArrayBuffer`, use the `.buffer` property (which is present on all `Uint8Array` objects):
```js
var arrayBuffer = buffer.buffer.slice(
buffer.byteOffset, buffer.byteOffset + buffer.byteLength
)
```
Alternatively, use the [`to-arraybuffer`](https://www.npmjs.com/package/to-arraybuffer) module.
## performance
See perf tests in `/perf`.
`BrowserBuffer` is the browser `buffer` module (this repo). `Uint8Array` is included as a
sanity check (since `BrowserBuffer` uses `Uint8Array` under the hood, `Uint8Array` will
always be at least a bit faster). Finally, `NodeBuffer` is the node.js buffer module,
which is included to compare against.
NOTE: Performance has improved since these benchmarks were taken. PR welcome to update the README.
### Chrome 38
| Method | Operations | Accuracy | Sampled | Fastest |
|:-------|:-----------|:---------|:--------|:-------:|
| BrowserBuffer#bracket-notation | 11,457,464 ops/sec | ±0.86% | 66 | ✓ |
| Uint8Array#bracket-notation | 10,824,332 ops/sec | ±0.74% | 65 | |
| | | | |
| BrowserBuffer#concat | 450,532 ops/sec | ±0.76% | 68 | |
| Uint8Array#concat | 1,368,911 ops/sec | ±1.50% | 62 | ✓ |
| | | | |
| BrowserBuffer#copy(16000) | 903,001 ops/sec | ±0.96% | 67 | |
| Uint8Array#copy(16000) | 1,422,441 ops/sec | ±1.04% | 66 | ✓ |
| | | | |
| BrowserBuffer#copy(16) | 11,431,358 ops/sec | ±0.46% | 69 | |
| Uint8Array#copy(16) | 13,944,163 ops/sec | ±1.12% | 68 | ✓ |
| | | | |
| BrowserBuffer#new(16000) | 106,329 ops/sec | ±6.70% | 44 | |
| Uint8Array#new(16000) | 131,001 ops/sec | ±2.85% | 31 | ✓ |
| | | | |
| BrowserBuffer#new(16) | 1,554,491 ops/sec | ±1.60% | 65 | |
| Uint8Array#new(16) | 6,623,930 ops/sec | ±1.66% | 65 | ✓ |
| | | | |
| BrowserBuffer#readDoubleBE | 112,830 ops/sec | ±0.51% | 69 | ✓ |
| DataView#getFloat64 | 93,500 ops/sec | ±0.57% | 68 | |
| | | | |
| BrowserBuffer#readFloatBE | 146,678 ops/sec | ±0.95% | 68 | ✓ |
| DataView#getFloat32 | 99,311 ops/sec | ±0.41% | 67 | |
| | | | |
| BrowserBuffer#readUInt32LE | 843,214 ops/sec | ±0.70% | 69 | ✓ |
| DataView#getUint32 | 103,024 ops/sec | ±0.64% | 67 | |
| | | | |
| BrowserBuffer#slice | 1,013,941 ops/sec | ±0.75% | 67 | |
| Uint8Array#subarray | 1,903,928 ops/sec | ±0.53% | 67 | ✓ |
| | | | |
| BrowserBuffer#writeFloatBE | 61,387 ops/sec | ±0.90% | 67 | |
| DataView#setFloat32 | 141,249 ops/sec | ±0.40% | 66 | ✓ |
### Firefox 33
| Method | Operations | Accuracy | Sampled | Fastest |
|:-------|:-----------|:---------|:--------|:-------:|
| BrowserBuffer#bracket-notation | 20,800,421 ops/sec | ±1.84% | 60 | |
| Uint8Array#bracket-notation | 20,826,235 ops/sec | ±2.02% | 61 | ✓ |
| | | | |
| BrowserBuffer#concat | 153,076 ops/sec | ±2.32% | 61 | |
| Uint8Array#concat | 1,255,674 ops/sec | ±8.65% | 52 | ✓ |
| | | | |
| BrowserBuffer#copy(16000) | 1,105,312 ops/sec | ±1.16% | 63 | |
| Uint8Array#copy(16000) | 1,615,911 ops/sec | ±0.55% | 66 | ✓ |
| | | | |
| BrowserBuffer#copy(16) | 16,357,599 ops/sec | ±0.73% | 68 | |
| Uint8Array#copy(16) | 31,436,281 ops/sec | ±1.05% | 68 | ✓ |
| | | | |
| BrowserBuffer#new(16000) | 52,995 ops/sec | ±6.01% | 35 | |
| Uint8Array#new(16000) | 87,686 ops/sec | ±5.68% | 45 | ✓ |
| | | | |
| BrowserBuffer#new(16) | 252,031 ops/sec | ±1.61% | 66 | |
| Uint8Array#new(16) | 8,477,026 ops/sec | ±0.49% | 68 | ✓ |
| | | | |
| BrowserBuffer#readDoubleBE | 99,871 ops/sec | ±0.41% | 69 | |
| DataView#getFloat64 | 285,663 ops/sec | ±0.70% | 68 | ✓ |
| | | | |
| BrowserBuffer#readFloatBE | 115,540 ops/sec | ±0.42% | 69 | |
| DataView#getFloat32 | 288,722 ops/sec | ±0.82% | 68 | ✓ |
| | | | |
| BrowserBuffer#readUInt32LE | 633,926 ops/sec | ±1.08% | 67 | ✓ |
| DataView#getUint32 | 294,808 ops/sec | ±0.79% | 64 | |
| | | | |
| BrowserBuffer#slice | 349,425 ops/sec | ±0.46% | 69 | |
| Uint8Array#subarray | 5,965,819 ops/sec | ±0.60% | 65 | ✓ |
| | | | |
| BrowserBuffer#writeFloatBE | 59,980 ops/sec | ±0.41% | 67 | |
| DataView#setFloat32 | 317,634 ops/sec | ±0.63% | 68 | ✓ |
### Safari 8
| Method | Operations | Accuracy | Sampled | Fastest |
|:-------|:-----------|:---------|:--------|:-------:|
| BrowserBuffer#bracket-notation | 10,279,729 ops/sec | ±2.25% | 56 | ✓ |
| Uint8Array#bracket-notation | 10,030,767 ops/sec | ±2.23% | 59 | |
| | | | |
| BrowserBuffer#concat | 144,138 ops/sec | ±1.38% | 65 | |
| Uint8Array#concat | 4,950,764 ops/sec | ±1.70% | 63 | ✓ |
| | | | |
| BrowserBuffer#copy(16000) | 1,058,548 ops/sec | ±1.51% | 64 | |
| Uint8Array#copy(16000) | 1,409,666 ops/sec | ±1.17% | 65 | ✓ |
| | | | |
| BrowserBuffer#copy(16) | 6,282,529 ops/sec | ±1.88% | 58 | |
| Uint8Array#copy(16) | 11,907,128 ops/sec | ±2.87% | 58 | ✓ |
| | | | |
| BrowserBuffer#new(16000) | 101,663 ops/sec | ±3.89% | 57 | |
| Uint8Array#new(16000) | 22,050,818 ops/sec | ±6.51% | 46 | ✓ |
| | | | |
| BrowserBuffer#new(16) | 176,072 ops/sec | ±2.13% | 64 | |
| Uint8Array#new(16) | 24,385,731 ops/sec | ±5.01% | 51 | ✓ |
| | | | |
| BrowserBuffer#readDoubleBE | 41,341 ops/sec | ±1.06% | 67 | |
| DataView#getFloat64 | 322,280 ops/sec | ±0.84% | 68 | ✓ |
| | | | |
| BrowserBuffer#readFloatBE | 46,141 ops/sec | ±1.06% | 65 | |
| DataView#getFloat32 | 337,025 ops/sec | ±0.43% | 69 | ✓ |
| | | | |
| BrowserBuffer#readUInt32LE | 151,551 ops/sec | ±1.02% | 66 | |
| DataView#getUint32 | 308,278 ops/sec | ±0.94% | 67 | ✓ |
| | | | |
| BrowserBuffer#slice | 197,365 ops/sec | ±0.95% | 66 | |
| Uint8Array#subarray | 9,558,024 ops/sec | ±3.08% | 58 | ✓ |
| | | | |
| BrowserBuffer#writeFloatBE | 17,518 ops/sec | ±1.03% | 63 | |
| DataView#setFloat32 | 319,751 ops/sec | ±0.48% | 68 | ✓ |
### Node 0.11.14
| Method | Operations | Accuracy | Sampled | Fastest |
|:-------|:-----------|:---------|:--------|:-------:|
| BrowserBuffer#bracket-notation | 10,489,828 ops/sec | ±3.25% | 90 | |
| Uint8Array#bracket-notation | 10,534,884 ops/sec | ±0.81% | 92 | ✓ |
| NodeBuffer#bracket-notation | 10,389,910 ops/sec | ±0.97% | 87 | |
| | | | |
| BrowserBuffer#concat | 487,830 ops/sec | ±2.58% | 88 | |
| Uint8Array#concat | 1,814,327 ops/sec | ±1.28% | 88 | ✓ |
| NodeBuffer#concat | 1,636,523 ops/sec | ±1.88% | 73 | |
| | | | |
| BrowserBuffer#copy(16000) | 1,073,665 ops/sec | ±0.77% | 90 | |
| Uint8Array#copy(16000) | 1,348,517 ops/sec | ±0.84% | 89 | ✓ |
| NodeBuffer#copy(16000) | 1,289,533 ops/sec | ±0.82% | 93 | |
| | | | |
| BrowserBuffer#copy(16) | 12,782,706 ops/sec | ±0.74% | 85 | |
| Uint8Array#copy(16) | 14,180,427 ops/sec | ±0.93% | 92 | ✓ |
| NodeBuffer#copy(16) | 11,083,134 ops/sec | ±1.06% | 89 | |
| | | | |
| BrowserBuffer#new(16000) | 141,678 ops/sec | ±3.30% | 67 | |
| Uint8Array#new(16000) | 161,491 ops/sec | ±2.96% | 60 | |
| NodeBuffer#new(16000) | 292,699 ops/sec | ±3.20% | 55 | ✓ |
| | | | |
| BrowserBuffer#new(16) | 1,655,466 ops/sec | ±2.41% | 82 | |
| Uint8Array#new(16) | 14,399,926 ops/sec | ±0.91% | 94 | ✓ |
| NodeBuffer#new(16) | 3,894,696 ops/sec | ±0.88% | 92 | |
| | | | |
| BrowserBuffer#readDoubleBE | 109,582 ops/sec | ±0.75% | 93 | ✓ |
| DataView#getFloat64 | 91,235 ops/sec | ±0.81% | 90 | |
| NodeBuffer#readDoubleBE | 88,593 ops/sec | ±0.96% | 81 | |
| | | | |
| BrowserBuffer#readFloatBE | 139,854 ops/sec | ±1.03% | 85 | ✓ |
| DataView#getFloat32 | 98,744 ops/sec | ±0.80% | 89 | |
| NodeBuffer#readFloatBE | 92,769 ops/sec | ±0.94% | 93 | |
| | | | |
| BrowserBuffer#readUInt32LE | 710,861 ops/sec | ±0.82% | 92 | |
| DataView#getUint32 | 117,893 ops/sec | ±0.84% | 91 | |
| NodeBuffer#readUInt32LE | 851,412 ops/sec | ±0.72% | 93 | ✓ |
| | | | |
| BrowserBuffer#slice | 1,673,877 ops/sec | ±0.73% | 94 | |
| Uint8Array#subarray | 6,919,243 ops/sec | ±0.67% | 90 | ✓ |
| NodeBuffer#slice | 4,617,604 ops/sec | ±0.79% | 93 | |
| | | | |
| BrowserBuffer#writeFloatBE | 66,011 ops/sec | ±0.75% | 93 | |
| DataView#setFloat32 | 127,760 ops/sec | ±0.72% | 93 | ✓ |
| NodeBuffer#writeFloatBE | 103,352 ops/sec | ±0.83% | 93 | |
### iojs 1.8.1
| Method | Operations | Accuracy | Sampled | Fastest |
|:-------|:-----------|:---------|:--------|:-------:|
| BrowserBuffer#bracket-notation | 10,990,488 ops/sec | ±1.11% | 91 | |
| Uint8Array#bracket-notation | 11,268,757 ops/sec | ±0.65% | 97 | |
| NodeBuffer#bracket-notation | 11,353,260 ops/sec | ±0.83% | 94 | ✓ |
| | | | |
| BrowserBuffer#concat | 378,954 ops/sec | ±0.74% | 94 | |
| Uint8Array#concat | 1,358,288 ops/sec | ±0.97% | 87 | |
| NodeBuffer#concat | 1,934,050 ops/sec | ±1.11% | 78 | ✓ |
| | | | |
| BrowserBuffer#copy(16000) | 894,538 ops/sec | ±0.56% | 84 | |
| Uint8Array#copy(16000) | 1,442,656 ops/sec | ±0.71% | 96 | |
| NodeBuffer#copy(16000) | 1,457,898 ops/sec | ±0.53% | 92 | ✓ |
| | | | |
| BrowserBuffer#copy(16) | 12,870,457 ops/sec | ±0.67% | 95 | |
| Uint8Array#copy(16) | 16,643,989 ops/sec | ±0.61% | 93 | ✓ |
| NodeBuffer#copy(16) | 14,885,848 ops/sec | ±0.74% | 94 | |
| | | | |
| BrowserBuffer#new(16000) | 109,264 ops/sec | ±4.21% | 63 | |
| Uint8Array#new(16000) | 138,916 ops/sec | ±1.87% | 61 | |
| NodeBuffer#new(16000) | 281,449 ops/sec | ±3.58% | 51 | ✓ |
| | | | |
| BrowserBuffer#new(16) | 1,362,935 ops/sec | ±0.56% | 99 | |
| Uint8Array#new(16) | 6,193,090 ops/sec | ±0.64% | 95 | ✓ |
| NodeBuffer#new(16) | 4,745,425 ops/sec | ±1.56% | 90 | |
| | | | |
| BrowserBuffer#readDoubleBE | 118,127 ops/sec | ±0.59% | 93 | ✓ |
| DataView#getFloat64 | 107,332 ops/sec | ±0.65% | 91 | |
| NodeBuffer#readDoubleBE | 116,274 ops/sec | ±0.94% | 95 | |
| | | | |
| BrowserBuffer#readFloatBE | 150,326 ops/sec | ±0.58% | 95 | ✓ |
| DataView#getFloat32 | 110,541 ops/sec | ±0.57% | 98 | |
| NodeBuffer#readFloatBE | 121,599 ops/sec | ±0.60% | 87 | |
| | | | |
| BrowserBuffer#readUInt32LE | 814,147 ops/sec | ±0.62% | 93 | |
| DataView#getUint32 | 137,592 ops/sec | ±0.64% | 90 | |
| NodeBuffer#readUInt32LE | 931,650 ops/sec | ±0.71% | 96 | ✓ |
| | | | |
| BrowserBuffer#slice | 878,590 ops/sec | ±0.68% | 93 | |
| Uint8Array#subarray | 2,843,308 ops/sec | ±1.02% | 90 | |
| NodeBuffer#slice | 4,998,316 ops/sec | ±0.68% | 90 | ✓ |
| | | | |
| BrowserBuffer#writeFloatBE | 65,927 ops/sec | ±0.74% | 93 | |
| DataView#setFloat32 | 139,823 ops/sec | ±0.97% | 89 | ✓ |
| NodeBuffer#writeFloatBE | 135,763 ops/sec | ±0.65% | 96 | |
| | | | |
## Testing the project
First, install the project:
npm install
Then, to run tests in Node.js, run:
npm run test-node
To test locally in a browser, you can run:
npm run test-browser-es5-local # For ES5 browsers that don't support ES6
npm run test-browser-es6-local # For ES6 compliant browsers
This will print out a URL that you can then open in a browser to run the tests, using [airtap](https://www.npmjs.com/package/airtap).
To run automated browser tests using Saucelabs, ensure that your `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables are set, then run:
npm test
This is what's run in Travis, to check against various browsers. The list of browsers is kept in the `bin/airtap-es5.yml` and `bin/airtap-es6.yml` files.
## JavaScript Standard Style
This module uses [JavaScript Standard Style](https://github.com/feross/standard).
[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
To test that the code conforms to the style, `npm install` and run:
./node_modules/.bin/standard
## credit
This was originally forked from [buffer-browserify](https://github.com/toots/buffer-browserify).
## Security Policies and Procedures
The `buffer` team and community take all security bugs in `buffer` seriously. Please see our [security policies and procedures](https://github.com/feross/security) document to learn how to report issues.
## license
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org), and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis.
@@ -0,0 +1,24 @@
# @heroui/checkbox
Checkboxes allow users to select multiple items from a list of individual items, or to mark one individual item as selected.
Please refer to the [documentation](https://heroui.com/docs/components/checkbox) for more information.
## Installation
```sh
yarn add @heroui/checkbox
# or
npm i @heroui/checkbox
```
## Contribution
Yes please! See the
[contributing guidelines](https://github.com/heroui-inc/heroui/blob/master/CONTRIBUTING.md)
for details.
## License
This project is licensed under the terms of the
[MIT license](https://github.com/heroui-inc/heroui/blob/master/LICENSE).
@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');
/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root, 'WeakMap');
module.exports = WeakMap;
@@ -0,0 +1,186 @@
import path from 'path';
import semver from 'semver';
import entries from 'object.entries';
import { version } from 'eslint/package.json';
import flatMap from 'array.prototype.flatmap';
let tsParserVersion;
try {
// eslint-disable-next-line import/no-unresolved, global-require
tsParserVersion = require('@typescript-eslint/parser/package.json').version;
} catch (e) { /**/ }
const disableNewTS = semver.satisfies(tsParserVersion, '>= 4.1') // this rule is not useful on v4.1+ of the TS parser
? (x) => ({ ...x, features: [].concat(x.features, 'no-ts-new') })
: (x) => x;
function minEcmaVersion(features, parserOptions) {
const minEcmaVersionForFeatures = {
'class fields': 2022,
'optional chaining': 2020,
'nullish coalescing': 2020,
};
const result = Math.max(
...[].concat(
(parserOptions && parserOptions.ecmaVersion) || [],
flatMap(entries(minEcmaVersionForFeatures), (entry) => {
const f = entry[0];
const y = entry[1];
return features.has(f) ? y : [];
}),
).map((y) => (y > 5 && y < 2015 ? y + 2009 : y)), // normalize editions to years
);
return Number.isFinite(result) ? result : undefined;
}
const NODE_MODULES = '../../node_modules';
const parsers = {
BABEL_ESLINT: path.join(__dirname, NODE_MODULES, 'babel-eslint'),
'@BABEL_ESLINT': path.join(__dirname, NODE_MODULES, '@babel/eslint-parser'),
TYPESCRIPT_ESLINT: path.join(__dirname, NODE_MODULES, 'typescript-eslint-parser'),
'@TYPESCRIPT_ESLINT': path.join(__dirname, NODE_MODULES, '@typescript-eslint/parser'),
disableNewTS,
babelParserOptions: function parserOptions(test, features) {
return {
...test.parserOptions,
requireConfigFile: false,
babelOptions: {
presets: [
'@babel/preset-react',
],
plugins: [
'@babel/plugin-syntax-do-expressions',
'@babel/plugin-syntax-function-bind',
['@babel/plugin-syntax-decorators', { legacy: true }],
],
parserOpts: {
allowSuperOutsideMethod: false,
allowReturnOutsideFunction: false,
},
},
ecmaFeatures: {
...test.parserOptions && test.parserOptions.ecmaFeatures,
jsx: true,
modules: true,
legacyDecorators: features.has('decorators'),
},
};
},
all: function all(tests) {
const t = flatMap(tests, (test) => {
/* eslint no-param-reassign: 0 */
if (typeof test === 'string') {
test = { code: test };
}
if ('parser' in test) {
delete test.features;
return test;
}
const features = new Set([].concat(test.features || []));
delete test.features;
const es = minEcmaVersion(features, test.parserOptions);
function addComment(testObject, parser) {
const extras = [].concat(
`features: [${Array.from(features).join(',')}]`,
`parser: ${parser}`,
testObject.parserOptions ? `parserOptions: ${JSON.stringify(testObject.parserOptions)}` : [],
testObject.options ? `options: ${JSON.stringify(testObject.options)}` : [],
testObject.settings ? `settings: ${JSON.stringify(testObject.settings)}` : [],
);
const extraComment = `\n// ${extras.join(', ')}`;
// Augment expected fix code output with extraComment
const nextCode = { code: testObject.code + extraComment };
const nextOutput = testObject.output && { output: testObject.output + extraComment };
// Augment expected suggestion outputs with extraComment
// `errors` may be a number (expected number of errors) or an array of
// error objects.
const nextErrors = testObject.errors
&& typeof testObject.errors !== 'number'
&& {
errors: testObject.errors.map(
(errorObject) => {
const nextSuggestions = errorObject.suggestions && {
suggestions: errorObject.suggestions.map((suggestion) => ({ ...suggestion, output: suggestion.output + extraComment })),
};
return { ...errorObject, ...nextSuggestions };
},
),
};
return {
...testObject,
...nextCode,
...nextOutput,
...nextErrors,
};
}
const skipBase = (features.has('class fields') && semver.satisfies(version, '< 8'))
|| (es >= 2020 && semver.satisfies(version, '< 6'))
|| features.has('no-default')
|| features.has('bind operator')
|| features.has('do expressions')
|| features.has('decorators')
|| features.has('flow')
|| features.has('ts')
|| features.has('types')
|| (features.has('fragment') && semver.satisfies(version, '< 5'));
const skipBabel = features.has('no-babel');
const skipOldBabel = skipBabel
|| features.has('no-babel-old')
|| features.has('optional chaining')
|| semver.satisfies(version, '>= 8');
const skipNewBabel = skipBabel
|| features.has('no-babel-new')
|| !semver.satisfies(version, '^7.5.0') // require('@babel/eslint-parser/package.json').peerDependencies.eslint
|| features.has('flow')
|| features.has('types')
|| features.has('ts');
const skipTS = semver.satisfies(version, '<= 5') // TODO: make these pass on eslint 5
|| features.has('no-ts')
|| features.has('flow')
|| features.has('jsx namespace')
|| features.has('bind operator')
|| features.has('do expressions');
const tsOld = !skipTS && !features.has('no-ts-old');
const tsNew = !skipTS && !features.has('no-ts-new');
return [].concat(
skipBase ? [] : addComment(
{
...test,
...typeof es === 'number' && {
parserOptions: { ...test.parserOptions, ecmaVersion: es },
},
},
'default',
),
skipOldBabel ? [] : addComment({
...test,
parser: parsers.BABEL_ESLINT,
parserOptions: parsers.babelParserOptions(test, features),
}, 'babel-eslint'),
skipNewBabel ? [] : addComment({
...test,
parser: parsers['@BABEL_ESLINT'],
parserOptions: parsers.babelParserOptions(test, features),
}, '@babel/eslint-parser'),
tsOld ? addComment({ ...test, parser: parsers.TYPESCRIPT_ESLINT }, 'typescript-eslint') : [],
tsNew ? addComment({ ...test, parser: parsers['@TYPESCRIPT_ESLINT'] }, '@typescript-eslint/parser') : [],
);
});
return t;
},
};
export default parsers;
@@ -0,0 +1,45 @@
import { InstanceContext, NapCatCore } from '../index';
export declare class NTQQCollectionApi {
context: InstanceContext;
core: NapCatCore;
constructor(context: InstanceContext, core: NapCatCore);
createCollection(authorUin: string, authorUid: string, authorName: string, brief: string, rawData: string): Promise<unknown>;
getAllCollection(category?: number, count?: number): Promise<import("../index").GeneralCallResult & {
collectionSearchList: {
collectionItemList: Array<{
cid: string;
type: number;
status: number;
author: {
type: number;
numId: string;
strId: string;
groupId: string;
groupName: string;
uid: string;
};
bid: number;
category: number;
createTime: string;
collectTime: string;
modifyTime: string;
sequence: string;
shareUrl: string;
customGroupId: number;
securityBeat: boolean;
summary: {
textSummary: unknown;
linkSummary: unknown;
gallerySummary: unknown;
audioSummary: unknown;
videoSummary: unknown;
fileSummary: unknown;
locationSummary: unknown;
richMediaSummary: unknown;
};
}>;
hasMore: boolean;
bottomTimeStamp: string;
};
}>;
}
@@ -0,0 +1 @@
{"version":3,"file":"source-type.js","sourceRoot":"","sources":["../../src/utils/source-type.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAGxB,OAAkD;IAClD,IAAI,YAAY,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC,aAAa,CAAC,UAAU,CAAA;IACzC,CAAC;IACD,IAAI,iBAAiB,IAAI,OAAO,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5D,OAAO,OAAO,CAAC,eAAe,CAAC,UAAU,CAAA;IAC3C,CAAC;AACH,CAAC"}
@@ -0,0 +1,298 @@
/**
* @fileoverview Forbid certain propTypes
*/
'use strict';
const variableUtil = require('../util/variable');
const propsUtil = require('../util/props');
const astUtil = require('../util/ast');
const docsUrl = require('../util/docsUrl');
const propWrapperUtil = require('../util/propWrapper');
const report = require('../util/report');
const getText = require('../util/eslint').getText;
// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
const DEFAULTS = ['any', 'array', 'object'];
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
const messages = {
forbiddenPropType: 'Prop type "{{target}}" is forbidden',
};
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
description: 'Disallow certain propTypes',
category: 'Best Practices',
recommended: false,
url: docsUrl('forbid-prop-types'),
},
messages,
schema: [{
type: 'object',
properties: {
forbid: {
type: 'array',
items: {
type: 'string',
},
},
checkContextTypes: {
type: 'boolean',
},
checkChildContextTypes: {
type: 'boolean',
},
},
additionalProperties: true,
}],
},
create(context) {
const configuration = context.options[0] || {};
const checkContextTypes = configuration.checkContextTypes || false;
const checkChildContextTypes = configuration.checkChildContextTypes || false;
let propTypesPackageName = null;
let reactPackageName = null;
let isForeignPropTypesPackage = false;
function isPropTypesPackage(node) {
return (
node.type === 'Identifier'
&& (
node.name === null
|| node.name === propTypesPackageName
|| !isForeignPropTypesPackage
)
) || (
node.type === 'MemberExpression'
&& (
node.object.name === null
|| node.object.name === reactPackageName
|| !isForeignPropTypesPackage
)
);
}
function isForbidden(type) {
const forbid = configuration.forbid || DEFAULTS;
return forbid.indexOf(type) >= 0;
}
function reportIfForbidden(type, declaration, target) {
if (isForbidden(type)) {
report(context, messages.forbiddenPropType, 'forbiddenPropType', {
node: declaration,
data: {
target,
},
});
}
}
function shouldCheckContextTypes(node) {
if (checkContextTypes && propsUtil.isContextTypesDeclaration(node)) {
return true;
}
return false;
}
function shouldCheckChildContextTypes(node) {
if (checkChildContextTypes && propsUtil.isChildContextTypesDeclaration(node)) {
return true;
}
return false;
}
/**
* Checks if propTypes declarations are forbidden
* @param {Array} declarations The array of AST nodes being checked.
* @returns {void}
*/
function checkProperties(declarations) {
if (declarations) {
declarations.forEach((declaration) => {
if (declaration.type !== 'Property') {
return;
}
let target;
let value = declaration.value;
if (
value.type === 'MemberExpression'
&& value.property
&& value.property.name
&& value.property.name === 'isRequired'
) {
value = value.object;
}
if (astUtil.isCallExpression(value)) {
if (!isPropTypesPackage(value.callee)) {
return;
}
value.arguments.forEach((arg) => {
const name = arg.type === 'MemberExpression' ? arg.property.name : arg.name;
reportIfForbidden(name, declaration, name);
});
value = value.callee;
}
if (!isPropTypesPackage(value)) {
return;
}
if (value.property) {
target = value.property.name;
} else if (value.type === 'Identifier') {
target = value.name;
}
reportIfForbidden(target, declaration, target);
});
}
}
function checkNode(node) {
if (!node) {
return;
}
if (node.type === 'ObjectExpression') {
checkProperties(node.properties);
} else if (node.type === 'Identifier') {
const propTypesObject = variableUtil.findVariableByName(context, node, node.name);
if (propTypesObject && propTypesObject.properties) {
checkProperties(propTypesObject.properties);
}
} else if (astUtil.isCallExpression(node)) {
const innerNode = node.arguments && node.arguments[0];
if (
propWrapperUtil.isPropWrapperFunction(context, getText(context, node.callee))
&& innerNode
) {
checkNode(innerNode);
}
}
}
return {
ImportDeclaration(node) {
if (node.source && node.source.value === 'prop-types') { // import PropType from "prop-types"
if (node.specifiers.length > 0) {
propTypesPackageName = node.specifiers[0].local.name;
}
} else if (node.source && node.source.value === 'react') { // import { PropTypes } from "react"
if (node.specifiers.length > 0) {
reactPackageName = node.specifiers[0].local.name; // guard against accidental anonymous `import "react"`
}
if (node.specifiers.length >= 1) {
const propTypesSpecifier = node.specifiers.find((specifier) => (
'imported' in specifier
&& specifier.imported
&& 'name' in specifier.imported
&& specifier.imported.name === 'PropTypes'
));
if (propTypesSpecifier) {
propTypesPackageName = propTypesSpecifier.local.name;
}
}
} else { // package is not imported from "react" or "prop-types"
// eslint-disable-next-line no-lonely-if
if (node.specifiers.some((x) => x.local.name === 'PropTypes')) { // assert: node.specifiers.length > 1
isForeignPropTypesPackage = true;
}
}
},
'ClassProperty, PropertyDefinition'(node) {
if (
!propsUtil.isPropTypesDeclaration(node)
&& !isPropTypesPackage(node)
&& !shouldCheckContextTypes(node)
&& !shouldCheckChildContextTypes(node)
) {
return;
}
checkNode(node.value);
},
MemberExpression(node) {
if (
!propsUtil.isPropTypesDeclaration(node)
&& !isPropTypesPackage(node)
&& !shouldCheckContextTypes(node)
&& !shouldCheckChildContextTypes(node)
) {
return;
}
checkNode('right' in node.parent && node.parent.right);
},
CallExpression(node) {
if (
node.callee.type === 'MemberExpression'
&& node.callee.object
&& !isPropTypesPackage(node.callee.object)
&& !propsUtil.isPropTypesDeclaration(node.callee)
) {
return;
}
if (
node.arguments.length > 0
&& (
('name' in node.callee && node.callee.name === 'shape')
|| astUtil.getPropertyName(node.callee) === 'shape'
)
) {
checkProperties('properties' in node.arguments[0] && node.arguments[0].properties);
}
},
MethodDefinition(node) {
if (
!propsUtil.isPropTypesDeclaration(node)
&& !isPropTypesPackage(node)
&& !shouldCheckContextTypes(node)
&& !shouldCheckChildContextTypes(node)
) {
return;
}
const returnStatement = astUtil.findReturnStatement(node);
if (returnStatement && returnStatement.argument) {
checkNode(returnStatement.argument);
}
},
ObjectExpression(node) {
node.properties.forEach((property) => {
if (!('key' in property) || !property.key) {
return;
}
if (
!propsUtil.isPropTypesDeclaration(property)
&& !isPropTypesPackage(property)
&& !shouldCheckContextTypes(property)
&& !shouldCheckChildContextTypes(property)
) {
return;
}
if (property.value.type === 'ObjectExpression') {
checkProperties(property.value.properties);
}
});
},
};
},
};
@@ -0,0 +1,17 @@
export = IdGenerator;
/**
* A generator for unique ids.
*/
declare class IdGenerator {
/**
* @param {string} prefix Optional. A prefix of generated ids.
*/
constructor(prefix: string);
prefix: string;
n: number;
/**
* Generates id.
* @returns {string} A generated id.
*/
next(): string;
}
@@ -0,0 +1,323 @@
flf2a$ 3 3 7 -1 16 0 0 0
Author : MikeChat & myflix
Date : 2006/5/29 18:09:53
Version: 1.1
-------------------------------------------------
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $#
$ $#
$ $##
o-- #
#
##
"#
#
##
##
#
##
$#
#
##
%#
#
##
&#
#
##
'#
#
##
#
,.-.,#
##
#
`'-'`#
##
*#
#
##
#
+ #
##
,#
#
##
#
| #
##
#
. #
##
/#
#
##
___ #
(___)#
##
#
____\#
##
#
|`._)#
##
#
(_|_)#
##
__#
__|__#
##
_ #
(_| |#
##
___ #
(_) `#
##
#
____|#
##
_ _ #
(_|_)#
##
_ #
__(_)#
##
:#
#
##
;#
#
##
<#
#
##
=#
#
##
> >#
#
##
#
o-_)#
##
@#
#
##
____ #
__|_)#
##
___ #
(_|_)#
##
___ #
( )#
##
___ #
( )#
`-' ##
___ #
| ' |#
##
____ #
' |#
##
___ #
( )#
`| ##
_____#
__|__#
##
|___|#
| |#
##
( #
`--|#
##
_____#
/\ #
..' ##
____#
| #
##
_____#
____<#
##
_____#
___/_#
##
.-. #
( )#
`-' ##
____ #
(_)#
##
___ #
(.__)#
' ##
____ #
_/(_)#
##
_ #
(_/ )#
##
____|#
|#
##
____#
(____#
##
____#
<____#
##
____#
(____#
(____##
_ _#
\_/ #
_/ \_##
____/#
\#
##
_ #
| \_|#
##
___ #
' '#
##
\#
#
##
#
,___,#
##
#
> #
##
#
| #
##
`#
#
##
_ #
_|) #
##
__ #
(_) #
##
_ #
| | #
##
_ #
(_)_#
##
_ #
(|) #
##
__ #
|) #
##
_ #
((_) #
##
___ #
_) #
##
#
--o #
##
#
(__ #
##
___ #
/\ #
##
___ #
#
##
__ #
__< #
##
__. #
__) #
##
_ #
(_) #
##
__ #
(_) #
##
_ #
_(_) #
##
___ #
) #
##
#
(/) #
##
_,_#
( ' #
##
__ #
(__ #
##
__ #
<__ #
##
__ #
(_ #
(__ ##
\,/ #
/`\ #
##
#
(_/_ #
##
#
|\| #
##
#
,-'-,#
##
#
#
_ ##
#
`-.-`#
##
~#
#
##
Ä#
#
##
Ö#
#
##
Ü#
#
##
ä#
#
##
ö#
#
##
ü#
#
##
ß#
#
##
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('zipObjectDeep', require('../zipObjectDeep'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,2 @@
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pako={})}(this,(function(e){"use strict";var t=(e,t,i,n)=>{let a=65535&e|0,r=e>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{a=a+t[n++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16|0};const i=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var n=(e,t,n,a)=>{const r=i,o=a+n;e^=-1;for(let i=a;i<o;i++)e=e>>>8^r[255&(e^t[i])];return-1^e};const a=16209;var r=function(e,t){let i,n,r,o,s,l,d,f,c,h,u,w,b,m,k,_,g,p,v,x,y,E,R,A;const Z=e.state;i=e.next_in,R=e.input,n=i+(e.avail_in-5),r=e.next_out,A=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),l=Z.dmax,d=Z.wsize,f=Z.whave,c=Z.wnext,h=Z.window,u=Z.hold,w=Z.bits,b=Z.lencode,m=Z.distcode,k=(1<<Z.lenbits)-1,_=(1<<Z.distbits)-1;e:do{w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),g=b[u&k];t:for(;;){if(p=g>>>24,u>>>=p,w-=p,p=g>>>16&255,0===p)A[r++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=b[(65535&g)+(u&(1<<p)-1)];continue t}if(32&p){Z.mode=16191;break e}e.msg="invalid literal/length code",Z.mode=a;break e}v=65535&g,p&=15,p&&(w<p&&(u+=R[i++]<<w,w+=8),v+=u&(1<<p)-1,u>>>=p,w-=p),w<15&&(u+=R[i++]<<w,w+=8,u+=R[i++]<<w,w+=8),g=m[u&_];i:for(;;){if(p=g>>>24,u>>>=p,w-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=m[(65535&g)+(u&(1<<p)-1)];continue i}e.msg="invalid distance code",Z.mode=a;break e}if(x=65535&g,p&=15,w<p&&(u+=R[i++]<<w,w+=8,w<p&&(u+=R[i++]<<w,w+=8)),x+=u&(1<<p)-1,x>l){e.msg="invalid distance too far back",Z.mode=a;break e}if(u>>>=p,w-=p,p=r-o,x>p){if(p=x-p,p>f&&Z.sane){e.msg="invalid distance too far back",Z.mode=a;break e}if(y=0,E=h,0===c){if(y+=d-p,p<v){v-=p;do{A[r++]=h[y++]}while(--p);y=r-x,E=A}}else if(c<p){if(y+=d+c-p,p-=c,p<v){v-=p;do{A[r++]=h[y++]}while(--p);if(y=0,c<v){p=c,v-=p;do{A[r++]=h[y++]}while(--p);y=r-x,E=A}}}else if(y+=c-p,p<v){v-=p;do{A[r++]=h[y++]}while(--p);y=r-x,E=A}for(;v>2;)A[r++]=E[y++],A[r++]=E[y++],A[r++]=E[y++],v-=3;v&&(A[r++]=E[y++],v>1&&(A[r++]=E[y++]))}else{y=r-x;do{A[r++]=A[y++],A[r++]=A[y++],A[r++]=A[y++],v-=3}while(v>2);v&&(A[r++]=A[y++],v>1&&(A[r++]=A[y++]))}break}}break}}while(i<n&&r<s);v=w>>3,i-=v,w-=v<<3,u&=(1<<w)-1,e.next_in=i,e.next_out=r,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=r<s?s-r+257:257-(r-s),Z.hold=u,Z.bits=w};const o=15,s=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),l=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),d=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),f=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var c=(e,t,i,n,a,r,c,h)=>{const u=h.bits;let w,b,m,k,_,g,p=0,v=0,x=0,y=0,E=0,R=0,A=0,Z=0,S=0,T=0,O=null;const U=new Uint16Array(16),D=new Uint16Array(16);let I,B,N,C=null;for(p=0;p<=o;p++)U[p]=0;for(v=0;v<n;v++)U[t[i+v]]++;for(E=u,y=o;y>=1&&0===U[y];y--);if(E>y&&(E=y),0===y)return a[r++]=20971520,a[r++]=20971520,h.bits=1,0;for(x=1;x<y&&0===U[x];x++);for(E<x&&(E=x),Z=1,p=1;p<=o;p++)if(Z<<=1,Z-=U[p],Z<0)return-1;if(Z>0&&(0===e||1!==y))return-1;for(D[1]=0,p=1;p<o;p++)D[p+1]=D[p]+U[p];for(v=0;v<n;v++)0!==t[i+v]&&(c[D[t[i+v]]++]=v);if(0===e?(O=C=c,g=20):1===e?(O=s,C=l,g=257):(O=d,C=f,g=0),T=0,v=0,p=x,_=r,R=E,A=0,m=-1,S=1<<E,k=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){I=p-A,c[v]+1<g?(B=0,N=c[v]):c[v]>=g?(B=C[c[v]-g],N=O[c[v]-g]):(B=96,N=0),w=1<<p-A,b=1<<R,x=b;do{b-=w,a[_+(T>>A)+b]=I<<24|B<<16|N|0}while(0!==b);for(w=1<<p-1;T&w;)w>>=1;if(0!==w?(T&=w-1,T+=w):T=0,v++,0==--U[p]){if(p===y)break;p=t[i+c[v]]}if(p>E&&(T&k)!==m){for(0===A&&(A=E),_+=x,R=p-A,Z=1<<R;R+A<y&&(Z-=U[R+A],!(Z<=0));)R++,Z<<=1;if(S+=1<<R,1===e&&S>852||2===e&&S>592)return 1;m=T&k,a[m]=E<<24|R<<16|_-r|0}}return 0!==T&&(a[_+T]=p-A<<24|64<<16|0),h.bits=E,0},h={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:u,Z_BLOCK:w,Z_TREES:b,Z_OK:m,Z_STREAM_END:k,Z_NEED_DICT:_,Z_STREAM_ERROR:g,Z_DATA_ERROR:p,Z_MEM_ERROR:v,Z_BUF_ERROR:x,Z_DEFLATED:y}=h,E=16180,R=16190,A=16191,Z=16192,S=16194,T=16199,O=16200,U=16206,D=16209,I=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function B(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,thLine truncated
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAUM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,IAAI,CAAA,GAAA,mDAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB,cAAc,aAAa;QACpD,CAAA,GAAA,wCAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,cAAc,aAAa,KAAK,sBAAsB,QAAQ,WAAW,EAC3E,CAAA,GAAA,2CAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,2CAAoB,EAAE;AAE1B","sources":["packages/@react-aria/focus/src/focusSafely.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableElement} from '@react-types/shared';\nimport {focusWithoutScrolling, getOwnerDocument, runAfterTransition} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement) {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = ownerDocument.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (ownerDocument.activeElement === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.main.js.map"}
@@ -0,0 +1,14 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-configs.js" script.
*/
"use strict"
module.exports = {
extends: [
require.resolve("./no-new-in-es2023-intl-api"),
require.resolve("./no-new-in-es2022-intl-api"),
require.resolve("./no-new-in-es2021-intl-api"),
require.resolve("./no-new-in-es2020-intl-api"),
],
}
@@ -0,0 +1,107 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MappedFunctionReturnType = MappedFunctionReturnType;
exports.Mapped = Mapped;
const index_1 = require("../symbols/index");
const index_2 = require("../discard/index");
// evaluation types
const index_3 = require("../array/index");
const index_4 = require("../async-iterator/index");
const index_5 = require("../constructor/index");
const index_6 = require("../function/index");
const index_7 = require("../indexed/index");
const index_8 = require("../intersect/index");
const index_9 = require("../iterator/index");
const index_10 = require("../literal/index");
const index_11 = require("../object/index");
const index_12 = require("../optional/index");
const index_13 = require("../promise/index");
const index_14 = require("../readonly/index");
const index_15 = require("../tuple/index");
const index_16 = require("../union/index");
// operator
const index_17 = require("../sets/index");
// mapping types
const mapped_result_1 = require("./mapped-result");
// ------------------------------------------------------------------
// TypeGuard
// ------------------------------------------------------------------
const kind_1 = require("../guard/kind");
// prettier-ignore
function FromMappedResult(K, P) {
return (K in P
? FromSchemaType(K, P[K])
: (0, mapped_result_1.MappedResult)(P));
}
// prettier-ignore
function MappedKeyToKnownMappedResultProperties(K) {
return { [K]: (0, index_10.Literal)(K) };
}
// prettier-ignore
function MappedKeyToUnknownMappedResultProperties(P) {
const Acc = {};
for (const L of P)
Acc[L] = (0, index_10.Literal)(L);
return Acc;
}
// prettier-ignore
function MappedKeyToMappedResultProperties(K, P) {
return ((0, index_17.SetIncludes)(P, K)
? MappedKeyToKnownMappedResultProperties(K)
: MappedKeyToUnknownMappedResultProperties(P));
}
// prettier-ignore
function FromMappedKey(K, P) {
const R = MappedKeyToMappedResultProperties(K, P);
return FromMappedResult(K, R);
}
// prettier-ignore
function FromRest(K, T) {
return T.map(L => FromSchemaType(K, L));
}
// prettier-ignore
function FromProperties(K, T) {
const Acc = {};
for (const K2 of globalThis.Object.getOwnPropertyNames(T))
Acc[K2] = FromSchemaType(K, T[K2]);
return Acc;
}
// prettier-ignore
function FromSchemaType(K, T) {
// required to retain user defined options for mapped type
const options = { ...T };
return (
// unevaluated modifier types
(0, kind_1.IsOptional)(T) ? (0, index_12.Optional)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.OptionalKind]))) :
(0, kind_1.IsReadonly)(T) ? (0, index_14.Readonly)(FromSchemaType(K, (0, index_2.Discard)(T, [index_1.ReadonlyKind]))) :
// unevaluated mapped types
(0, kind_1.IsMappedResult)(T) ? FromMappedResult(K, T.properties) :
(0, kind_1.IsMappedKey)(T) ? FromMappedKey(K, T.keys) :
// unevaluated types
(0, kind_1.IsConstructor)(T) ? (0, index_5.Constructor)(FromRest(K, T.parameters), FromSchemaType(K, T.returns), options) :
(0, kind_1.IsFunction)(T) ? (0, index_6.Function)(FromRest(K, T.parameters), FromSchemaType(K, T.returns), options) :
(0, kind_1.IsAsyncIterator)(T) ? (0, index_4.AsyncIterator)(FromSchemaType(K, T.items), options) :
(0, kind_1.IsIterator)(T) ? (0, index_9.Iterator)(FromSchemaType(K, T.items), options) :
(0, kind_1.IsIntersect)(T) ? (0, index_8.Intersect)(FromRest(K, T.allOf), options) :
(0, kind_1.IsUnion)(T) ? (0, index_16.Union)(FromRest(K, T.anyOf), options) :
(0, kind_1.IsTuple)(T) ? (0, index_15.Tuple)(FromRest(K, T.items ?? []), options) :
(0, kind_1.IsObject)(T) ? (0, index_11.Object)(FromProperties(K, T.properties), options) :
(0, kind_1.IsArray)(T) ? (0, index_3.Array)(FromSchemaType(K, T.items), options) :
(0, kind_1.IsPromise)(T) ? (0, index_13.Promise)(FromSchemaType(K, T.item), options) :
T);
}
// prettier-ignore
function MappedFunctionReturnType(K, T) {
const Acc = {};
for (const L of K)
Acc[L] = FromSchemaType(L, T);
return Acc;
}
/** `[Json]` Creates a Mapped object type */
function Mapped(key, map, options) {
const K = (0, kind_1.IsSchema)(key) ? (0, index_7.IndexPropertyKeys)(key) : key;
const RT = map({ [index_1.Kind]: 'MappedKey', keys: K });
const R = MappedFunctionReturnType(K, RT);
return (0, index_11.Object)(R, options);
}
@@ -0,0 +1 @@
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugin/models/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,QAAQ,EAAE,OAAO,MAE7B,CAAC;AAEF,8BAAsB,MAAM,CAAC,UAAU;IACrC,SAAgB,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAiB;IAEjD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;gBAE/B,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa;aAKzC,IAAI,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;CAC3C"}
@@ -0,0 +1 @@
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_toArray=e()}(this,(function(){"use strict";return function(t,e){e.prototype.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]}}}));
@@ -0,0 +1,44 @@
"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 __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JSONSchema = exports.locales = exports.regexes = exports.util = void 0;
__exportStar(require("./core.cjs"), exports);
__exportStar(require("./parse.cjs"), exports);
__exportStar(require("./errors.cjs"), exports);
__exportStar(require("./schemas.cjs"), exports);
__exportStar(require("./checks.cjs"), exports);
__exportStar(require("./versions.cjs"), exports);
exports.util = __importStar(require("./util.cjs"));
exports.regexes = __importStar(require("./regexes.cjs"));
exports.locales = __importStar(require("../locales/index.cjs"));
__exportStar(require("./registries.cjs"), exports);
__exportStar(require("./doc.cjs"), exports);
__exportStar(require("./function.cjs"), exports);
__exportStar(require("./api.cjs"), exports);
__exportStar(require("./to-json-schema.cjs"), exports);
exports.JSONSchema = __importStar(require("./json-schema.cjs"));
@@ -0,0 +1,51 @@
import arrayMap from './_arrayMap.js';
import baseIndexOf from './_baseIndexOf.js';
import baseIndexOfWith from './_baseIndexOfWith.js';
import baseUnary from './_baseUnary.js';
import copyArray from './_copyArray.js';
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* The base implementation of `_.pullAllBy` without support for iteratee
* shorthands.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns `array`.
*/
function basePullAll(array, values, iteratee, comparator) {
var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
index = -1,
length = values.length,
seen = array;
if (array === values) {
values = copyArray(values);
}
if (iteratee) {
seen = arrayMap(array, baseUnary(iteratee));
}
while (++index < length) {
var fromIndex = 0,
value = values[index],
computed = iteratee ? iteratee(value) : value;
while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
splice.call(seen, fromIndex, 1);
}
splice.call(array, fromIndex, 1);
}
}
return array;
}
export default basePullAll;
@@ -0,0 +1,12 @@
import { motionComponentSymbol } from './symbol.mjs';
/**
* Checks if a component is a `motion` component.
*/
function isMotionComponent(component) {
return (component !== null &&
typeof component === "object" &&
motionComponentSymbol in component);
}
export { isMotionComponent };
@@ -0,0 +1,759 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const utils = require("./utils.cjs");
const defaultKeyExtractor = (index) => index;
const defaultRangeExtractor = (range) => {
const start = Math.max(range.startIndex - range.overscan, 0);
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
const arr = [];
for (let i = start; i <= end; i++) {
arr.push(i);
}
return arr;
};
const observeElementRect = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const targetWindow = instance.targetWindow;
if (!targetWindow) {
return;
}
const handler = (rect) => {
const { width, height } = rect;
cb({ width: Math.round(width), height: Math.round(height) });
};
handler(element.getBoundingClientRect());
if (!targetWindow.ResizeObserver) {
return () => {
};
}
const observer = new targetWindow.ResizeObserver((entries) => {
const entry = entries[0];
if (entry == null ? void 0 : entry.borderBoxSize) {
const box = entry.borderBoxSize[0];
if (box) {
handler({ width: box.inlineSize, height: box.blockSize });
return;
}
}
handler(element.getBoundingClientRect());
});
observer.observe(element, { box: "border-box" });
return () => {
observer.unobserve(element);
};
};
const addEventListenerOptions = {
passive: true
};
const observeWindowRect = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const handler = () => {
cb({ width: element.innerWidth, height: element.innerHeight });
};
handler();
element.addEventListener("resize", handler, addEventListenerOptions);
return () => {
element.removeEventListener("resize", handler);
};
};
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
const observeElementOffset = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const targetWindow = instance.targetWindow;
if (!targetWindow) {
return;
}
let offset = 0;
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : utils.debounce(
targetWindow,
() => {
cb(offset, false);
},
instance.options.isScrollingResetDelay
);
const createHandler = (isScrolling) => () => {
const { horizontal, isRtl } = instance.options;
offset = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
fallback();
cb(offset, isScrolling);
};
const handler = createHandler(true);
const endHandler = createHandler(false);
endHandler();
element.addEventListener("scroll", handler, addEventListenerOptions);
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
return () => {
element.removeEventListener("scroll", handler);
element.removeEventListener("scrollend", endHandler);
};
};
const observeWindowOffset = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const targetWindow = instance.targetWindow;
if (!targetWindow) {
return;
}
let offset = 0;
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : utils.debounce(
targetWindow,
() => {
cb(offset, false);
},
instance.options.isScrollingResetDelay
);
const createHandler = (isScrolling) => () => {
offset = element[instance.options.horizontal ? "scrollX" : "scrollY"];
fallback();
cb(offset, isScrolling);
};
const handler = createHandler(true);
const endHandler = createHandler(false);
endHandler();
element.addEventListener("scroll", handler, addEventListenerOptions);
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
return () => {
element.removeEventListener("scroll", handler);
element.removeEventListener("scrollend", endHandler);
};
};
const measureElement = (element, entry, instance) => {
if (entry == null ? void 0 : entry.borderBoxSize) {
const box = entry.borderBoxSize[0];
if (box) {
const size = Math.round(
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
);
return size;
}
}
return Math.round(
element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
);
};
const windowScroll = (offset, {
adjustments = 0,
behavior
}, instance) => {
var _a, _b;
const toOffset = offset + adjustments;
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
[instance.options.horizontal ? "left" : "top"]: toOffset,
behavior
});
};
const elementScroll = (offset, {
adjustments = 0,
behavior
}, instance) => {
var _a, _b;
const toOffset = offset + adjustments;
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
[instance.options.horizontal ? "left" : "top"]: toOffset,
behavior
});
};
class Virtualizer {
constructor(opts) {
this.unsubs = [];
this.scrollElement = null;
this.targetWindow = null;
this.isScrolling = false;
this.scrollToIndexTimeoutId = null;
this.measurementsCache = [];
this.itemSizeCache = /* @__PURE__ */ new Map();
this.pendingMeasuredCacheIndexes = [];
this.scrollRect = null;
this.scrollOffset = null;
this.scrollDirection = null;
this.scrollAdjustments = 0;
this.elementsCache = /* @__PURE__ */ new Map();
this.observer = /* @__PURE__ */ (() => {
let _ro = null;
const get = () => {
if (_ro) {
return _ro;
}
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
return null;
}
return _ro = new this.targetWindow.ResizeObserver((entries) => {
entries.forEach((entry) => {
this._measureElement(entry.target, entry);
});
});
};
return {
disconnect: () => {
var _a;
(_a = get()) == null ? void 0 : _a.disconnect();
_ro = null;
},
observe: (target) => {
var _a;
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
},
unobserve: (target) => {
var _a;
return (_a = get()) == null ? void 0 : _a.unobserve(target);
}
};
})();
this.range = null;
this.setOptions = (opts2) => {
Object.entries(opts2).forEach(([key, value]) => {
if (typeof value === "undefined") delete opts2[key];
});
this.options = {
debug: false,
initialOffset: 0,
overscan: 1,
paddingStart: 0,
paddingEnd: 0,
scrollPaddingStart: 0,
scrollPaddingEnd: 0,
horizontal: false,
getItemKey: defaultKeyExtractor,
rangeExtractor: defaultRangeExtractor,
onChange: () => {
},
measureElement,
initialRect: { width: 0, height: 0 },
scrollMargin: 0,
gap: 0,
indexAttribute: "data-index",
initialMeasurementsCache: [],
lanes: 1,
isScrollingResetDelay: 150,
enabled: true,
isRtl: false,
useScrollendEvent: true,
...opts2
};
};
this.notify = (sync) => {
var _a, _b;
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
};
this.maybeNotify = utils.memo(
() => {
this.calculateRange();
return [
this.isScrolling,
this.range ? this.range.startIndex : null,
this.range ? this.range.endIndex : null
];
},
(isScrolling) => {
this.notify(isScrolling);
},
{
key: process.env.NODE_ENV !== "production" && "maybeNotify",
debug: () => this.options.debug,
initialDeps: [
this.isScrolling,
this.range ? this.range.startIndex : null,
this.range ? this.range.endIndex : null
]
}
);
this.cleanup = () => {
this.unsubs.filter(Boolean).forEach((d) => d());
this.unsubs = [];
this.observer.disconnect();
this.scrollElement = null;
this.targetWindow = null;
};
this._didMount = () => {
return () => {
this.cleanup();
};
};
this._willUpdate = () => {
var _a;
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
if (this.scrollElement !== scrollElement) {
this.cleanup();
if (!scrollElement) {
this.maybeNotify();
return;
}
this.scrollElement = scrollElement;
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
} else {
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
}
this.elementsCache.forEach((cached) => {
this.observer.observe(cached);
});
this._scrollToOffset(this.getScrollOffset(), {
adjustments: void 0,
behavior: void 0
});
this.unsubs.push(
this.options.observeElementRect(this, (rect) => {
this.scrollRect = rect;
this.maybeNotify();
})
);
this.unsubs.push(
this.options.observeElementOffset(this, (offset, isScrolling) => {
this.scrollAdjustments = 0;
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
this.scrollOffset = offset;
this.isScrolling = isScrolling;
this.maybeNotify();
})
);
}
};
this.getSize = () => {
if (!this.options.enabled) {
this.scrollRect = null;
return 0;
}
this.scrollRect = this.scrollRect ?? this.options.initialRect;
return this.scrollRect[this.options.horizontal ? "width" : "height"];
};
this.getScrollOffset = () => {
if (!this.options.enabled) {
this.scrollOffset = null;
return 0;
}
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
return this.scrollOffset;
};
this.getFurthestMeasurement = (measurements, index) => {
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
const furthestMeasurements = /* @__PURE__ */ new Map();
for (let m = index - 1; m >= 0; m--) {
const measurement = measurements[m];
if (furthestMeasurementsFound.has(measurement.lane)) {
continue;
}
const previousFurthestMeasurement = furthestMeasurements.get(
measurement.lane
);
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
furthestMeasurements.set(measurement.lane, measurement);
} else if (measurement.end < previousFurthestMeasurement.end) {
furthestMeasurementsFound.set(measurement.lane, true);
}
if (furthestMeasurementsFound.size === this.options.lanes) {
break;
}
}
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
if (a.end === b.end) {
return a.index - b.index;
}
return a.end - b.end;
})[0] : void 0;
};
this.getMeasurementOptions = utils.memo(
() => [
this.options.count,
this.options.paddingStart,
this.options.scrollMargin,
this.options.getItemKey,
this.options.enabled
],
(count, paddingStart, scrollMargin, getItemKey, enabled) => {
this.pendingMeasuredCacheIndexes = [];
return {
count,
paddingStart,
scrollMargin,
getItemKey,
enabled
};
},
{
key: false
}
);
this.getMeasurements = utils.memo(
() => [this.getMeasurementOptions(), this.itemSizeCache],
({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
if (!enabled) {
this.measurementsCache = [];
this.itemSizeCache.clear();
return [];
}
if (this.measurementsCache.length === 0) {
this.measurementsCache = this.options.initialMeasurementsCache;
this.measurementsCache.forEach((item) => {
this.itemSizeCache.set(item.key, item.size);
});
}
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
this.pendingMeasuredCacheIndexes = [];
const measurements = this.measurementsCache.slice(0, min);
for (let i = min; i < count; i++) {
const key = getItemKey(i);
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
const measuredSize = itemSizeCache.get(key);
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
const end = start + size;
const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
measurements[i] = {
index: i,
start,
size,
end,
key,
lane
};
}
this.measurementsCache = measurements;
return measurements;
},
{
key: process.env.NODE_ENV !== "production" && "getMeasurements",
debug: () => this.options.debug
}
);
this.calculateRange = utils.memo(
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
(measurements, outerSize, scrollOffset) => {
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
measurements,
outerSize,
scrollOffset
}) : null;
},
{
key: process.env.NODE_ENV !== "production" && "calculateRange",
debug: () => this.options.debug
}
);
this.getIndexes = utils.memo(
() => {
let startIndex = null;
let endIndex = null;
const range = this.calculateRange();
if (range) {
startIndex = range.startIndex;
endIndex = range.endIndex;
}
return [
this.options.rangeExtractor,
this.options.overscan,
this.options.count,
startIndex,
endIndex
];
},
(rangeExtractor, overscan, count, startIndex, endIndex) => {
return startIndex === null || endIndex === null ? [] : rangeExtractor({
startIndex,
endIndex,
overscan,
count
});
},
{
key: process.env.NODE_ENV !== "production" && "getIndexes",
debug: () => this.options.debug
}
);
this.indexFromElement = (node) => {
const attributeName = this.options.indexAttribute;
const indexStr = node.getAttribute(attributeName);
if (!indexStr) {
console.warn(
`Missing attribute name '${attributeName}={index}' on measured element.`
);
return -1;
}
return parseInt(indexStr, 10);
};
this._measureElement = (node, entry) => {
const index = this.indexFromElement(node);
const item = this.measurementsCache[index];
if (!item) {
return;
}
const key = item.key;
const prevNode = this.elementsCache.get(key);
if (prevNode !== node) {
if (prevNode) {
this.observer.unobserve(prevNode);
}
this.observer.observe(node);
this.elementsCache.set(key, node);
}
if (node.isConnected) {
this.resizeItem(index, this.options.measureElement(node, entry, this));
}
};
this.resizeItem = (index, size) => {
const item = this.measurementsCache[index];
if (!item) {
return;
}
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
const delta = size - itemSize;
if (delta !== 0) {
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
if (process.env.NODE_ENV !== "production" && this.options.debug) {
console.info("correction", delta);
}
this._scrollToOffset(this.getScrollOffset(), {
adjustments: this.scrollAdjustments += delta,
behavior: void 0
});
}
this.pendingMeasuredCacheIndexes.push(item.index);
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
this.notify(false);
}
};
this.measureElement = (node) => {
if (!node) {
this.elementsCache.forEach((cached, key) => {
if (!cached.isConnected) {
this.observer.unobserve(cached);
this.elementsCache.delete(key);
}
});
return;
}
this._measureElement(node, void 0);
};
this.getVirtualItems = utils.memo(
() => [this.getIndexes(), this.getMeasurements()],
(indexes, measurements) => {
const virtualItems = [];
for (let k = 0, len = indexes.length; k < len; k++) {
const i = indexes[k];
const measurement = measurements[i];
virtualItems.push(measurement);
}
return virtualItems;
},
{
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
debug: () => this.options.debug
}
);
this.getVirtualItemForOffset = (offset) => {
const measurements = this.getMeasurements();
if (measurements.length === 0) {
return void 0;
}
return utils.notUndefined(
measurements[findNearestBinarySearch(
0,
measurements.length - 1,
(index) => utils.notUndefined(measurements[index]).start,
offset
)]
);
};
this.getOffsetForAlignment = (toOffset, align) => {
const size = this.getSize();
const scrollOffset = this.getScrollOffset();
if (align === "auto") {
if (toOffset >= scrollOffset + size) {
align = "end";
}
}
if (align === "end") {
toOffset -= size;
}
const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
const maxOffset = scrollSize - size;
return Math.max(Math.min(maxOffset, toOffset), 0);
};
this.getOffsetForIndex = (index, align = "auto") => {
index = Math.max(0, Math.min(index, this.options.count - 1));
const item = this.measurementsCache[index];
if (!item) {
return void 0;
}
const size = this.getSize();
const scrollOffset = this.getScrollOffset();
if (align === "auto") {
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
align = "end";
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
align = "start";
} else {
return [scrollOffset, align];
}
}
const centerOffset = item.start - this.options.scrollPaddingStart + (item.size - size) / 2;
switch (align) {
case "center":
return [this.getOffsetForAlignment(centerOffset, align), align];
case "end":
return [
this.getOffsetForAlignment(
item.end + this.options.scrollPaddingEnd,
align
),
align
];
default:
return [
this.getOffsetForAlignment(
item.start - this.options.scrollPaddingStart,
align
),
align
];
}
};
this.isDynamicMode = () => this.elementsCache.size > 0;
this.cancelScrollToIndex = () => {
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
this.scrollToIndexTimeoutId = null;
}
};
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
this.cancelScrollToIndex();
if (behavior === "smooth" && this.isDynamicMode()) {
console.warn(
"The `smooth` scroll behavior is not fully supported with dynamic size."
);
}
this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
adjustments: void 0,
behavior
});
};
this.scrollToIndex = (index, { align: initialAlign = "auto", behavior } = {}) => {
index = Math.max(0, Math.min(index, this.options.count - 1));
this.cancelScrollToIndex();
if (behavior === "smooth" && this.isDynamicMode()) {
console.warn(
"The `smooth` scroll behavior is not fully supported with dynamic size."
);
}
const offsetAndAlign = this.getOffsetForIndex(index, initialAlign);
if (!offsetAndAlign) return;
const [offset, align] = offsetAndAlign;
this._scrollToOffset(offset, { adjustments: void 0, behavior });
if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
this.scrollToIndexTimeoutId = null;
const elementInDOM = this.elementsCache.has(
this.options.getItemKey(index)
);
if (elementInDOM) {
const [latestOffset] = utils.notUndefined(
this.getOffsetForIndex(index, align)
);
if (!utils.approxEqual(latestOffset, this.getScrollOffset())) {
this.scrollToIndex(index, { align, behavior });
}
} else {
this.scrollToIndex(index, { align, behavior });
}
});
}
};
this.scrollBy = (delta, { behavior } = {}) => {
this.cancelScrollToIndex();
if (behavior === "smooth" && this.isDynamicMode()) {
console.warn(
"The `smooth` scroll behavior is not fully supported with dynamic size."
);
}
this._scrollToOffset(this.getScrollOffset() + delta, {
adjustments: void 0,
behavior
});
};
this.getTotalSize = () => {
var _a;
const measurements = this.getMeasurements();
let end;
if (measurements.length === 0) {
end = this.options.paddingStart;
} else {
end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max(
...measurements.slice(-this.options.lanes).map((m) => m.end)
);
}
return Math.max(
end - this.options.scrollMargin + this.options.paddingEnd,
0
);
};
this._scrollToOffset = (offset, {
adjustments,
behavior
}) => {
this.options.scrollToFn(offset, { behavior, adjustments }, this);
};
this.measure = () => {
this.itemSizeCache = /* @__PURE__ */ new Map();
this.notify(false);
};
this.setOptions(opts);
}
}
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
while (low <= high) {
const middle = (low + high) / 2 | 0;
const currentValue = getCurrentValue(middle);
if (currentValue < value) {
low = middle + 1;
} else if (currentValue > value) {
high = middle - 1;
} else {
return middle;
}
}
if (low > 0) {
return low - 1;
} else {
return 0;
}
};
function calculateRange({
measurements,
outerSize,
scrollOffset
}) {
const count = measurements.length - 1;
const getOffset = (index) => measurements[index].start;
const startIndex = findNearestBinarySearch(0, count, getOffset, scrollOffset);
let endIndex = startIndex;
while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
endIndex++;
}
return { startIndex, endIndex };
}
exports.approxEqual = utils.approxEqual;
exports.debounce = utils.debounce;
exports.memo = utils.memo;
exports.notUndefined = utils.notUndefined;
exports.Virtualizer = Virtualizer;
exports.defaultKeyExtractor = defaultKeyExtractor;
exports.defaultRangeExtractor = defaultRangeExtractor;
exports.elementScroll = elementScroll;
exports.measureElement = measureElement;
exports.observeElementOffset = observeElementOffset;
exports.observeElementRect = observeElementRect;
exports.observeWindowOffset = observeWindowOffset;
exports.observeWindowRect = observeWindowRect;
exports.windowScroll = windowScroll;
//# sourceMappingURL=index.cjs.map
@@ -0,0 +1,37 @@
import copyObject from './_copyObject.js';
import createAssigner from './_createAssigner.js';
import keys from './keys.js';
/**
* This method is like `_.assign` except that it accepts `customizer`
* which is invoked to produce the assigned values. If `customizer` returns
* `undefined`, assignment is handled by the method instead. The `customizer`
* is invoked with five arguments: (objValue, srcValue, key, object, source).
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} sources The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @returns {Object} Returns `object`.
* @see _.assignInWith
* @example
*
* function customizer(objValue, srcValue) {
* return _.isUndefined(objValue) ? srcValue : objValue;
* }
*
* var defaults = _.partialRight(_.assignWith, customizer);
*
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keys(source), object, customizer);
});
export default assignWith;
@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.js"],"names":["module","exports","require","convert","err"],"mappings":"AAAA;;AAEA,IAAI;AACFA,EAAAA,MAAM,CAACC,OAAP,GAAiBC,OAAO,CAAC,UAAD,CAAP,CAAoB,YAApB,EAAkCC,OAAnD;AACD,CAFD,CAEE,OAAOC,GAAP,EAAY;AACZJ,EAAAA,MAAM,CAACC,OAAP,GAAiBC,OAAO,CAAC,mBAAD,CAAxB;AACD","sourcesContent":["'use strict';\n\ntry {\n module.exports = require('bindings')('addon.node').convert;\n} catch (err) {\n module.exports = require('../jssrc/index.js');\n}\n"],"file":"index.mjs"}
@@ -0,0 +1 @@
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAMD;;CAEC,GACD,MAAM,mDAA6B,MAAM,WAAW;AA2B7C,SAAS,0CAAc,OAA8B;IAC1D,IAAI,oBAAC,gBAAgB,oBAAE,gBAAgB,gBAAE,YAAY,EAAC,GAAG;IACzD,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAwE;QACvF,QAAQ;QACR,SAAS;IACX,GAAG,OAAO;IAEV,IAAI,YAAY,CAAC;QACf,IAAI,YAAY,sCAAgB,EAAE,GAAG;QACrC,IAAI,CAAC,aAAa,EAAE,OAAO,IAAI,EAAE,OAAO,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAC5E;QAGF,8EAA8E;QAC9E,8EAA8E;QAC9E,+EAA+E;QAC/E,4EAA4E;QAC5E,IAAI,cAAc,OAAO,MAAM,MAAM,CAAC,IAAI,GAAG,MAAM,GAAG,GAAG;YACvD,EAAE,cAAc;YAChB,IAAI,CAAE,CAAA,yBAAyB,CAAA,GAC7B,EAAE,eAAe;QAErB;QAEA,MAAM,MAAM,IAAI;QAEhB,IAAI,iBAAiB,eAAe,IAAI,MAAM;YAC5C,2CAA2C;YAC3C,+FAA+F;YAC/F,IAAI,MAAM,iBAAiB,eAAe,CAAC,MAAM,MAAM,EAAE,iBAAiB,UAAU;YAEpF,wCAAwC;YACxC,IAAI,OAAO,MACT,MAAM,iBAAiB,eAAe,CAAC,MAAM,MAAM;YAGrD,IAAI,OAAO,MAAM;gBACf,iBAAiB,aAAa,CAAC;gBAC/B,IAAI,cACF,aAAa;YAEjB;QACF;QAEA,aAAa,MAAM,OAAO;QAC1B,MAAM,OAAO,GAAG,WAAW;YACzB,MAAM,MAAM,GAAG;QACjB,GAAG;IACL;IAEA,OAAO;QACL,iBAAiB;YACf,+DAA+D;YAC/D,qDAAqD;YACrD,kBAAkB,iBAAiB,eAAe,GAAG,YAAY;QACnE;IACF;AACF;AAEA,SAAS,sCAAgB,GAAW;IAClC,mDAAmD;IACnD,+DAA+D;IAC/D,6BAA6B;IAC7B,0CAA0C;IAC1C,IAAI,IAAI,MAAM,KAAK,KAAK,CAAC,UAAU,IAAI,CAAC,MACtC,OAAO;IAGT,OAAO;AACT","sources":["packages/@react-aria/selection/src/useTypeSelect.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 {DOMAttributes, Key, KeyboardDelegate} from '@react-types/shared';\nimport {KeyboardEvent, useRef} from 'react';\nimport {MultipleSelectionManager} from '@react-stately/selection';\n\n/**\n * Controls how long to wait before clearing the typeahead buffer.\n */\nconst TYPEAHEAD_DEBOUNCE_WAIT_MS = 1000; // 1 second\n\nexport interface AriaTypeSelectOptions {\n /**\n * A delegate that returns collection item keys with respect to visual layout.\n */\n keyboardDelegate: KeyboardDelegate,\n /**\n * An interface for reading and updating multiple selection state.\n */\n selectionManager: MultipleSelectionManager,\n /**\n * Called when an item is focused by typing.\n */\n onTypeSelect?: (key: Key) => void\n}\n\nexport interface TypeSelectAria {\n /**\n * Props to be spread on the owner of the options.\n */\n typeSelectProps: DOMAttributes\n}\n\n/**\n * Handles typeahead interactions with collections.\n */\nexport function useTypeSelect(options: AriaTypeSelectOptions): TypeSelectAria {\n let {keyboardDelegate, selectionManager, onTypeSelect} = options;\n let state = useRef<{search: string, timeout: ReturnType<typeof setTimeout> | undefined}>({\n search: '',\n timeout: undefined\n }).current;\n\n let onKeyDown = (e: KeyboardEvent) => {\n let character = getStringForKey(e.key);\n if (!character || e.ctrlKey || e.metaKey || !e.currentTarget.contains(e.target as HTMLElement)) {\n return;\n }\n\n // Do not propagate the Spacebar event if it's meant to be part of the search.\n // When we time out, the search term becomes empty, hence the check on length.\n // Trimming is to account for the case of pressing the Spacebar more than once,\n // which should cycle through the selection/deselection of the focused item.\n if (character === ' ' && state.search.trim().length > 0) {\n e.preventDefault();\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n }\n\n state.search += character;\n\n if (keyboardDelegate.getKeyForSearch != null) {\n // Use the delegate to find a key to focus.\n // Prioritize items after the currently focused item, falling back to searching the whole list.\n let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);\n\n // If no key found, search from the top.\n if (key == null) {\n key = keyboardDelegate.getKeyForSearch(state.search);\n }\n\n if (key != null) {\n selectionManager.setFocusedKey(key);\n if (onTypeSelect) {\n onTypeSelect(key);\n }\n }\n }\n\n clearTimeout(state.timeout);\n state.timeout = setTimeout(() => {\n state.search = '';\n }, TYPEAHEAD_DEBOUNCE_WAIT_MS);\n };\n\n return {\n typeSelectProps: {\n // Using a capturing listener to catch the keydown event before\n // other hooks in order to handle the Spacebar event.\n onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : undefined\n }\n };\n}\n\nfunction getStringForKey(key: string) {\n // If the key is of lengtLine truncated
@@ -0,0 +1,3 @@
const isMotionValue = (value) => Boolean(value && value.getVelocity);
export { isMotionValue };
@@ -0,0 +1,159 @@
/**
* @fileoverview Rule to check the spacing around the * in yield* expressions.
* @author Bryan Smith
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "yield-star-spacing",
url: "https://eslint.style/rules/yield-star-spacing",
},
},
],
},
type: "layout",
docs: {
description:
"Require or disallow spacing around the `*` in `yield*` expressions",
recommended: false,
url: "https://eslint.org/docs/latest/rules/yield-star-spacing",
},
fixable: "whitespace",
schema: [
{
oneOf: [
{
enum: ["before", "after", "both", "neither"],
},
{
type: "object",
properties: {
before: { type: "boolean" },
after: { type: "boolean" },
},
additionalProperties: false,
},
],
},
],
messages: {
missingBefore: "Missing space before *.",
missingAfter: "Missing space after *.",
unexpectedBefore: "Unexpected space before *.",
unexpectedAfter: "Unexpected space after *.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const mode = (function (option) {
if (!option || typeof option === "string") {
return {
before: { before: true, after: false },
after: { before: false, after: true },
both: { before: true, after: true },
neither: { before: false, after: false },
}[option || "after"];
}
return option;
})(context.options[0]);
/**
* Checks the spacing between two tokens before or after the star token.
* @param {string} side Either "before" or "after".
* @param {Token} leftToken `function` keyword token if side is "before", or
* star token if side is "after".
* @param {Token} rightToken Star token if side is "before", or identifier
* token if side is "after".
* @returns {void}
*/
function checkSpacing(side, leftToken, rightToken) {
if (
sourceCode.isSpaceBetweenTokens(leftToken, rightToken) !==
mode[side]
) {
const after = leftToken.value === "*";
const spaceRequired = mode[side];
const node = after ? leftToken : rightToken;
let messageId;
if (spaceRequired) {
messageId =
side === "before" ? "missingBefore" : "missingAfter";
} else {
messageId =
side === "before"
? "unexpectedBefore"
: "unexpectedAfter";
}
context.report({
node,
messageId,
fix(fixer) {
if (spaceRequired) {
if (after) {
return fixer.insertTextAfter(node, " ");
}
return fixer.insertTextBefore(node, " ");
}
return fixer.removeRange([
leftToken.range[1],
rightToken.range[0],
]);
},
});
}
}
/**
* Enforces the spacing around the star if node is a yield* expression.
* @param {ASTNode} node A yield expression node.
* @returns {void}
*/
function checkExpression(node) {
if (!node.delegate) {
return;
}
const tokens = sourceCode.getFirstTokens(node, 3);
const yieldToken = tokens[0];
const starToken = tokens[1];
const nextToken = tokens[2];
checkSpacing("before", yieldToken, starToken);
checkSpacing("after", starToken, nextToken);
}
return {
YieldExpression: checkExpression,
};
},
};
@@ -0,0 +1,2 @@
export type Newable<TInstance = unknown, TArgs extends unknown[] = any[]> = new (...args: TArgs) => TInstance;
//# sourceMappingURL=Newable.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"typescriptDesignParameterTypesReflectKey.js","sourceRoot":"","sources":["../../../../src/reflectMetadata/data/typescriptDesignParameterTypesReflectKey.ts"],"names":[],"mappings":";;;AAAa,QAAA,kCAAkC,GAAW,mBAAmB,CAAC"}
@@ -0,0 +1,107 @@
import format from "date-manip/dist/format.mjs";
import { isFunction } from "is-what-type";
import compilePattern from "./compilePattern.mjs";
import formatMessage from "./formatMessage.mjs";
import pad from "./pad.mjs";
function literalConverter(text) {
return () => text;
}
function dateConverter(dateFormat = "ISO") {
return (event) => {
return format(event.timestamp, dateFormat);
};
}
function levelConverter(minWidth = 0, alignLeft = true) {
return (event) => {
return pad(event.levelName, minWidth, alignLeft);
};
}
function loggerConverter(minWidth = 0, alignLeft = true) {
return (event) => {
const { loggerName } = event;
return pad(loggerName, minWidth, alignLeft);
};
}
function messageConverter(minWidth = 0, maxLength = 0, alignLeft = true) {
return (event) => {
return formatMessage(event.message, (msg) => {
if (maxLength > 0 && msg.length > maxLength) {
msg = `${msg.substring(0, maxLength)}...`;
}
return pad(msg, minWidth, alignLeft);
});
};
}
function threadConverter() {
return () => {
return `PID:${process.pid}`;
};
}
function mdcConverter(key, minWidth = 0, alignLeft = true) {
return (event) => {
const value = event.context[key] || "";
return pad(String(value), minWidth, alignLeft);
};
}
class PatternLayout {
/**
* Constructor (构造函数)
* @param pattern Pattern string (模版字符串)
*/
constructor(pattern = "[%d{YYYY-MM-DD HH:mm:ss.SSSZ}] %p %c - %m", createConverter) {
this.converters = compilePattern(
pattern,
(specifier, alignLeft, minWidth, maxLength, format2) => {
if (isFunction(createConverter)) {
const converter = createConverter(
specifier,
alignLeft,
minWidth,
maxLength,
format2
);
if (isFunction(converter)) {
return converter;
}
}
switch (specifier.toLowerCase()) {
case "%":
return literalConverter("%");
case "d":
return dateConverter(format2);
case "p":
return levelConverter(minWidth, alignLeft);
case "c":
return loggerConverter(minWidth, alignLeft);
case "m":
return messageConverter(minWidth, maxLength, alignLeft);
case "t":
return threadConverter();
case "x":
return mdcConverter(format2 || "", minWidth, alignLeft);
default:
return literalConverter(`%${specifier}`);
}
},
literalConverter
);
}
/**
* Add a converter (添加转换器)
* @param fn Converter function (转换器函数)
*/
use(fn) {
this.converters.push(fn);
return this;
}
/**
* Format a log event (格式化日志事件)
* @param event Log event (日志事件)
*/
format(event) {
return this.converters.map((converter) => converter(event)).join("");
}
}
export {
PatternLayout as default
};
@@ -0,0 +1,6 @@
/**
* List of legacy HTML named character references that don’t need a trailing semicolon.
*
* @type {Array<string>}
*/
export const characterEntitiesLegacy: Array<string>
@@ -0,0 +1,23 @@
import globParent from 'glob-parent'
// Based on `glob-base`
// https://github.com/micromatch/glob-base/blob/master/index.js
export function parseGlob(pattern) {
let glob = pattern
let base = globParent(pattern)
if (base !== '.') {
glob = pattern.substr(base.length)
if (glob.charAt(0) === '/') {
glob = glob.substr(1)
}
}
if (glob.substr(0, 2) === './') {
glob = glob.substr(2)
} else if (glob.charAt(0) === '/') {
glob = glob.substr(1)
}
return { base, glob }
}
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const esnext_promise: LibDefinition;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"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","2":"C L M G N O P"},C:{"1":"0 1 2 3 4 5 AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B 0C 1C"},D:{"1":"0 1 2 3 4 5 JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"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"},E:{"1":"L M G OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J ZB K D E F A B C 2C ZC 3C 4C 5C 6C aC NC"},F:{"1":"0 1 2 3 4 5 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","2":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B FD GD HD ID NC uC JD OC"},G:{"1":"XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD"},H:{"2":"hD"},I:{"1":"I","2":"TC J iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 AB BB CB DB EB FB uD vD wD xD QC RC SC yD","2":"J oD pD qD rD sD aC tD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"2D","2":"1D"}},B:5,C:"prefers-color-scheme media query",D:true};
@@ -0,0 +1,12 @@
import { EditorView } from '@codemirror/view';
export const defaultLightThemeOption = EditorView.theme(
{
'&': {
backgroundColor: '#fff',
},
},
{
dark: false,
},
);
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('findLastIndex', require('../findLastIndex'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = range;
function range(size) {
var result = Array(size);
while (size--) {
result[size] = size;
}
return result;
}
module.exports = exports.default;
@@ -0,0 +1,8 @@
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
import { Kind } from '../symbols/index.mjs';
export interface TUnknown extends TSchema {
[Kind]: 'Unknown';
static: unknown;
}
/** `[Json]` Creates an Unknown type */
export declare function Unknown(options?: SchemaOptions): TUnknown;
@@ -0,0 +1 @@
{"version":3,"file":"isBindingConstraintsWithTag.js","sourceRoot":"","sources":["../../../../src/binding/calculations/isBindingConstraintsWithTag.ts"],"names":[],"mappings":";;AAEA,kEAMC;AAND,SAAgB,2BAA2B,CACzC,GAAgB,EAChB,KAAc;IAEd,OAAO,CAAC,WAA+B,EAAW,EAAE,CAClD,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;AACrE,CAAC"}
@@ -0,0 +1 @@
!function(u,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(u="undefined"!=typeof globalThis?globalThis:u||self).dayjs_locale_fi=e(u.dayjs)}(this,(function(u){"use strict";function e(u){return u&&"object"==typeof u&&"default"in u?u:{default:u}}var t=e(u);function n(u,e,t,n){var i={s:"muutama sekunti",m:"minuutti",mm:"%d minuuttia",h:"tunti",hh:"%d tuntia",d:"päivä",dd:"%d päivää",M:"kuukausi",MM:"%d kuukautta",y:"vuosi",yy:"%d vuotta",numbers:"nolla_yksi_kaksi_kolme_neljä_viisi_kuusi_seitsemän_kahdeksan_yhdeksän".split("_")},a={s:"muutaman sekunnin",m:"minuutin",mm:"%d minuutin",h:"tunnin",hh:"%d tunnin",d:"päivän",dd:"%d päivän",M:"kuukauden",MM:"%d kuukauden",y:"vuoden",yy:"%d vuoden",numbers:"nollan_yhden_kahden_kolmen_neljän_viiden_kuuden_seitsemän_kahdeksan_yhdeksän".split("_")},s=n&&!e?a:i,_=s[t];return u<10?_.replace("%d",s.numbers[u]):_.replace("%d",u)}var i={name:"fi",weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),ordinal:function(u){return u+"."},weekStart:1,yearStart:4,relativeTime:{future:"%s päästä",past:"%s sitten",s:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},formats:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM[ta] YYYY",LLL:"D. MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, D. MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"D. MMM YYYY",lll:"D. MMM YYYY, [klo] HH.mm",llll:"ddd, D. MMM YYYY, [klo] HH.mm"}};return t.default.locale(i,null,!0),i}));
@@ -0,0 +1 @@
{"version":3,"file":"isoUint8Array.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoUint8Array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAM1E;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAKhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAehD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAYzD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAGvD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAG9D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAE1D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAEvD"}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/focus/src/index.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\nexport {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager, isElementInChildOfActiveScope} from './FocusScope';\nexport {FocusRing} from './FocusRing';\nexport {useFocusRing} from './useFocusRing';\nexport {useHasTabbableChild} from './useHasTabbableChild';\nexport {moveVirtualFocus, dispatchVirtualBlur, dispatchVirtualFocus, getVirtuallyFocusedElement} from './virtualFocus';\n// For backward compatibility.\nexport {isFocusable} from '@react-aria/utils';\nexport {FocusableProvider, Focusable, useFocusable, focusSafely} from '@react-aria/interactions';\n\nexport type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';\nexport type {FocusRingProps} from './FocusRing';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from '@react-aria/interactions';\nexport type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1 @@
{"name":"yaml","version":"2.8.2","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532091298,"integrity":"sha512-Zbryo9vC+G20qJBvHFsA/9aVuux6eflr5LlctTFH7sp5umRuCtTkov1SZKBxGAYph0C3k+uP6NrZIkTyWtTPhQ==","mode":420,"size":738},"browser/dist/nodes/addPairToJSMap.js":{"checkedAt":1794532091298,"integrity":"sha512-/GPZr3PYkkHuCExohl6HaGhkAru28zrUtOe5AJpsiEzTLclmeLqQba4sfd/LVqJPtUdM8LBKH3Hw+5SrPVJxjw==","mode":420,"size":2289},"dist/nodes/addPairToJSMap.js":{"checkedAt":1794532091299,"integrity":"sha512-uEcLPCPSXSd4u832VeQ7oUT/SE42fZsBRAbs5alpoelzPLtGJgnh/2lDu4jvgb+fKloIC5zxNSg5x7eT8LCvaQ==","mode":420,"size":2338},"browser/dist/nodes/Alias.js":{"checkedAt":1794532091299,"integrity":"sha512-rdmjlpfcnJn27Jr+/Y+d3Z639EuBVG31nmYteW09iQ4TCT0tjio2JCposSBqkJcN+TszziHhZeUySWTtmbiubA==","mode":420,"size":3749},"dist/nodes/Alias.js":{"checkedAt":1794532091299,"integrity":"sha512-p5t/f1Fwkf6wQC3ag77Sg66lKt+caB7347fzpJwybQBopgLbQAB0OxOi7XUzl3E0nHkoOvJeXPhd65CXyoIMSA==","mode":420,"size":3793},"browser/dist/doc/anchors.js":{"checkedAt":1794532091299,"integrity":"sha512-tQFoSntKZ3jGyIbmurBLebQzRdkRjEnM72AX1xAOXdyPQuim52ML3scHnDot2M91N/3Gb7T3EKIVfb35hYfN9g==","mode":420,"size":2276},"dist/doc/anchors.js":{"checkedAt":1794532091299,"integrity":"sha512-fVvWzlz0+rvQPi36sAlCYJd9iOE6+NJCz4YdpJVtEAN4NScwKbcxi2+8v8t54au+g3FhtEiFZ7EdooVvWY/25w==","mode":420,"size":2386},"browser/dist/doc/applyReviver.js":{"checkedAt":1794532091300,"integrity":"sha512-D4Z2QeJkrcRSeeXgQjxrLhB/c+KzZQIwuJpnGvR1tsrSzyA11L6KCaH5DUqPD6APuBMZKjsiXcCV4xPbMwOlpA==","mode":420,"size":1923},"dist/doc/applyReviver.js":{"checkedAt":1794532091300,"integrity":"sha512-S6b1ZbJR4vEOinSbu7jc/54uug8UqCTaPcFWf+XjrghGP9tfj6r4vihRUaMoHGa/x7S8tmDc1/cONQfRpJQcbg==","mode":420,"size":1950},"browser/dist/schema/yaml-1.1/binary.js":{"checkedAt":1794532091300,"integrity":"sha512-PcHlqAM6aEVfKbvU/IV5tvtKrPweWvN4mjeqpHXPMM8ksTqrl+kQT4wtc/lrtu24OIgKo5Iwi6vIVtif4tfnnQ==","mode":420,"size":2315},"dist/schema/yaml-1.1/binary.js":{"checkedAt":1794532091300,"integrity":"sha512-TbVUDZbTz2VkGsYZ3OqsbANB1zQOlOJvVdxhsic5UKhODGbVQLpwwLi+iujVbEUe/xjG7ntZkf0Y6yqI55JgvA==","mode":420,"size":2800},"browser/dist/schema/core/bool.js":{"checkedAt":1794532091300,"integrity":"sha512-kG+Q6TjYuzuH0MlK14uoNigdB6EtJUY+V5SX9h5MQ7kgohwpyx08ZkRK/u1KCvO7cLKtBtRcx4QZfLyUXfw7yQ==","mode":420,"size":607},"browser/dist/schema/yaml-1.1/bool.js":{"checkedAt":1794532091300,"integrity":"sha512-P0a9Y/BFMa56YSnw18sOYUwsz7V/+EniGCIQu4Iz2qIMoOcriwqk6mdhOxSvOiwa64XEW3VNIkv5mJoLkCduog==","mode":420,"size":787},"dist/schema/core/bool.js":{"checkedAt":1794532091301,"integrity":"sha512-xghrjvbXKQ4zPwuUSaE4p69hTXAw12XjIV55RhITGAYXW3F3k0uHkFuD0Q/KmgcEPU4CN3rZJ6CFHZ9w8iiBGQ==","mode":420,"size":635},"dist/schema/yaml-1.1/bool.js":{"checkedAt":1794532091301,"integrity":"sha512-KNKdD0y0HMv1dvCCQZcQyEaw88kfgGuOZtpxX1Sq2Pdk1GEQG9raCRhhSAPvUEUYLsmaYwgcIuUPcivtvvXrGw==","mode":420,"size":841},"browser/dist/nodes/Collection.js":{"checkedAt":1794532091301,"integrity":"sha512-sfvot3IO7e1sIA418nZpMcAar8yelO/Ae5jNJcaZ4g55Q++vE8pS9qUUkw11f+VEOe4psparHiBSQW+WRfXrJw==","mode":420,"size":5076},"dist/nodes/Collection.js":{"checkedAt":1794532091301,"integrity":"sha512-lrynn7VBv/YmSkGNHhehXkHp5DV4MuBYe6OjANrgG0Sz68Zx8OuCr71mmSLASOh61h6e0GKHsxbm/8euHtHGGw==","mode":420,"size":5221},"browser/dist/compose/compose-collection.js":{"checkedAt":1794532091301,"integrity":"sha512-TiDvf+v6SPmfCw5L4A44yVidoyu3jdW3PLNeigGUTSSjQpA0vm+MrP2pMEYsJVVORuhQpShApiO9DB0UOtsq3Q==","mode":420,"size":3500},"dist/compose/compose-collection.js":{"checkedAt":1794532091301,"integrity":"sha512-7djL7j/2ePAshej5zWsOY/7dgqllZoVCFU1fXZ6nf1PDmBfFRe5PWKo5lO5Id04fobLR3LwSZZh/3SJWNPcbcw==","mode":420,"size":3613},"browser/dist/compose/compose-doc.js":{"checkedAt":1794532091302,"integrity":"sha512-bvtqdM0Am4kyITWxM2ReGtecvxLBpW6P9cTg+pZGAKv5ST5J0Sutd6nWYci6nkS8uNJBFl0i5ci30OgsdXSQaw==","mode":420,"size":1555},"dist/compose/compose-doc.js":{"checkedAt":1794532091302,"integrity":"sha512-BBe6bteohWLiGrsFrJifHL5vYJA2zz/QRAI8xaTJjmPKnwj5y7LFu9iCayIdUttjrrshGo1aOpjuwaefBa5pUA==","mode":420,"size":1615},"browser/dist/compose/compose-node.js":{"checkedAt":1794532091302,"integrity":"sha512-Fea77LzU5CpsCzl+q22m4sVx+TMKt+TsUMdfZDQFk++BF8uIVyA2XHrSq6aESQm5EN8BRgSJC3vn0/2Ul1ehOQ==","mode":420,"size":3817},"dist/compose/compose-node.js":{"checkedAt":1794532091302,"integrity":"sha512-EwtJJIhG9gSSZQ6SYMyBGNV42EjD+Q8BRFDWhvMS84XMuHGtgxSHZHj1ZTrb+YMKHMPJRlx6K/yKKwoHE7TriQ==","mode":420,"size":3964},"browser/dist/compose/compose-scalar.js":{"checkedAt":1794532091302,"integrity":"sha512-3hlJwoxm3b2ZwGPfab8keNN554SFt6ijPvSH9JpbZOi76c+ea9yHg9EM6g+3IPWZENl82z0W3iXejiDAHwf8Lg==","mode":420,"size":3316},"dist/compose/compose-scalar.js":{"checkedAt":1794532091302,"integrity":"sha512-vLBwDTQMQ8ny8CSJUPYQWg+VYTr7+ijEugCNPbUT3MiPXlppyFMTB39HwQhNBuLEFUCLUgeZ42/EnUmGMqzETg==","mode":420,"size":3446},"browser/dist/compose/composer.js":{"checkedAt":1794532091303,"integrity":"sha512-AQmyPYzuxdv8q7aiR+P2IKIt2Line truncated
@@ -0,0 +1,23 @@
import {Options} from 'indent-string';
/**
[Strip redundant indentation](https://github.com/sindresorhus/strip-indent) and [indent the string](https://github.com/sindresorhus/indent-string).
@param string - The string to normalize indentation.
@param count - How many times you want `options.indent` repeated. Default: `0`.
@example
```
import redent from 'redent';
redent('\n foo\n bar\n', 1);
//=> '\n foo\n bar\n'
```
*/
export default function redent(
string: string,
count?: number,
options?: Options
): string;
export {Options};
@@ -0,0 +1,24 @@
{
"name": "@babel/helper-plugin-utils",
"version": "7.27.1",
"description": "General utilities for plugins to use",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helper-plugin-utils",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-plugin-utils"
},
"main": "./lib/index.js",
"engines": {
"node": ">=6.9.0"
},
"devDependencies": {
"@babel/core": "^7.27.1"
},
"type": "commonjs"
}
@@ -0,0 +1 @@
{"version":3,"names":["_classApplyDescriptorGet","require","_classPrivateFieldGet2","_classPrivateFieldGet","receiver","privateMap","descriptor","classPrivateFieldGet2","classApplyDescriptorGet"],"sources":["../../src/helpers/classPrivateFieldGet.js"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n/* @onlyBabel7 */\n\nimport classApplyDescriptorGet from \"classApplyDescriptorGet\";\nimport classPrivateFieldGet2 from \"classPrivateFieldGet2\";\nexport default function _classPrivateFieldGet(receiver, privateMap) {\n var descriptor = classPrivateFieldGet2(privateMap, receiver);\n return classApplyDescriptorGet(receiver, descriptor);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACe,SAASE,qBAAqBA,CAACC,QAAQ,EAAEC,UAAU,EAAE;EAClE,IAAIC,UAAU,GAAGC,sBAAqB,CAACF,UAAU,EAAED,QAAQ,CAAC;EAC5D,OAAOI,wBAAuB,CAACJ,QAAQ,EAAEE,UAAU,CAAC;AACtD","ignoreList":[]}
@@ -0,0 +1,50 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _eachOfLimit = require('./internal/eachOfLimit.js');
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
var _withoutIndex = require('./internal/withoutIndex.js');
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
var _wrapAsync = require('./internal/wrapAsync.js');
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
var _awaitify = require('./internal/awaitify.js');
var _awaitify2 = _interopRequireDefault(_awaitify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
*
* @name eachLimit
* @static
* @memberOf module:Collections
* @method
* @see [async.each]{@link module:Collections.each}
* @alias forEachLimit
* @category Collection
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
* @param {number} limit - The maximum number of async operations at a time.
* @param {AsyncFunction} iteratee - An async function to apply to each item in
* `coll`.
* The array index is not passed to the iteratee.
* If you need the index, use `eachOfLimit`.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called when all
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
* @returns {Promise} a promise, if a callback is omitted
*/
function eachLimit(coll, limit, iteratee, callback) {
return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
}
exports.default = (0, _awaitify2.default)(eachLimit, 4);
module.exports = exports.default;
@@ -0,0 +1,3 @@
declare const _exports: import('eslint').Rule.RuleModule;
export = _exports;
//# sourceMappingURL=jsx-no-leaked-render.d.ts.map
@@ -0,0 +1,35 @@
import {Except} from './except';
import {Simplify} from './simplify';
/**
Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
@example
```
import {SetRequired} from 'type-fest';
type Foo = {
a?: number;
b: string;
c?: boolean;
}
type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
// type SomeRequired = {
// a?: number;
// b: string; // Was already required and still is.
// c: boolean; // Is now required.
// }
```
@category Utilities
*/
export type SetRequired<BaseType, Keys extends keyof BaseType> =
Simplify<
// Pick just the keys that are optional from the base type.
Except<BaseType, Keys> &
// Pick the keys that should be required from the base type and make them required.
Required<Pick<BaseType, Keys>>
>;
@@ -0,0 +1,88 @@
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "filterDOMProps", () => $8d15d0e1797d4238$export$457c3d6518dd4c6f);
/*
* 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 $8d15d0e1797d4238$var$DOMPropNames = new Set([
'id'
]);
const $8d15d0e1797d4238$var$labelablePropNames = new Set([
'aria-label',
'aria-labelledby',
'aria-describedby',
'aria-details'
]);
// See LinkDOMProps in dom.d.ts.
const $8d15d0e1797d4238$var$linkPropNames = new Set([
'href',
'hrefLang',
'target',
'rel',
'download',
'ping',
'referrerPolicy'
]);
const $8d15d0e1797d4238$var$globalAttrs = new Set([
'dir',
'lang',
'hidden',
'inert',
'translate'
]);
const $8d15d0e1797d4238$var$globalEvents = new Set([
'onClick',
'onAuxClick',
'onContextMenu',
'onDoubleClick',
'onMouseDown',
'onMouseEnter',
'onMouseLeave',
'onMouseMove',
'onMouseOut',
'onMouseOver',
'onMouseUp',
'onTouchCancel',
'onTouchEnd',
'onTouchMove',
'onTouchStart',
'onPointerDown',
'onPointerMove',
'onPointerUp',
'onPointerCancel',
'onPointerEnter',
'onPointerLeave',
'onPointerOver',
'onPointerOut',
'onGotPointerCapture',
'onLostPointerCapture',
'onScroll',
'onWheel',
'onAnimationStart',
'onAnimationEnd',
'onAnimationIteration',
'onTransitionCancel',
'onTransitionEnd',
'onTransitionRun',
'onTransitionStart'
]);
const $8d15d0e1797d4238$var$propRe = /^(data-.*)$/;
function $8d15d0e1797d4238$export$457c3d6518dd4c6f(props, opts = {}) {
let { labelable: labelable, isLink: isLink, global: global, events: events = global, propNames: propNames } = opts;
let filteredProps = {};
for(const prop in props)if (Object.prototype.hasOwnProperty.call(props, prop) && ($8d15d0e1797d4238$var$DOMPropNames.has(prop) || labelable && $8d15d0e1797d4238$var$labelablePropNames.has(prop) || isLink && $8d15d0e1797d4238$var$linkPropNames.has(prop) || global && $8d15d0e1797d4238$var$globalAttrs.has(prop) || events && $8d15d0e1797d4238$var$globalEvents.has(prop) || prop.endsWith('Capture') && $8d15d0e1797d4238$var$globalEvents.has(prop.slice(0, -7)) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $8d15d0e1797d4238$var$propRe.test(prop))) filteredProps[prop] = props[prop];
return filteredProps;
}
//# sourceMappingURL=filterDOMProps.main.js.map
@@ -0,0 +1 @@
{"name":"is-unc-path","version":"1.0.0","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532123460,"integrity":"sha512-xtRxOc0N/od5SoZcuvD0GiBiLhBlkBEoc6uM22WVFWYRA0v+bficTpn7sP8lRJxdaApAbCJVfMFW6RYlPh1XUA==","mode":420,"size":1186},"README.md":{"checkedAt":1794532123461,"integrity":"sha512-8iJmiqQfRmTPrBT0bjftsxqAVmCmlOEg6cD6bY+rpjhePdTL8R8qexzD5HfPPak4OvKWMJQAmsjOTAQ6KUqIng==","mode":420,"size":4023},"LICENSE":{"checkedAt":1794532123461,"integrity":"sha512-oRecjj+Ty0QSZ1pSaJ5E309i5W/dqJJLejf+9/BRvhDgBb2bg8doXR4cnOwgxzR7dqUML/CI+C+rhz8e+NN3JA==","mode":420,"size":1087},"index.js":{"checkedAt":1794532123461,"integrity":"sha512-EgrswdwCWYPhlkgtbRUBhfhf7v8CnTw4B7u1LDuF+efbGixuJkre9YacFmIM+BnZWjK5ujFBANCU1BcaYNMbEw==","mode":420,"size":217}}}
@@ -0,0 +1,21 @@
interface UseClipboardProps {
/**
* The time in milliseconds to wait before resetting the clipboard.
* @default 2000
*/
timeout?: number;
}
/**
* Copies the given text to the clipboard.
* @param {number} timeout - timeout in ms, default 2000
* @returns {copy, copied, error, reset} - copy function, copied state, error state, reset function
*/
declare function useClipboard({ timeout }?: UseClipboardProps): {
copy: (valueToCopy: any) => void;
reset: () => void;
error: Error | null;
copied: boolean;
};
type UseClipboardReturn = ReturnType<typeof useClipboard>;
export { UseClipboardProps, UseClipboardReturn, useClipboard };
@@ -0,0 +1,5 @@
import { ServiceIdentifier } from '@inversifyjs/common';
import { ResolutionParams } from '../models/ResolutionParams';
import { Resolved } from '../models/Resolved';
export declare function resolveBindingServiceActivations<TActivated>(params: ResolutionParams, serviceIdentifier: ServiceIdentifier<TActivated>, value: Resolved<TActivated>): Resolved<TActivated>;
//# sourceMappingURL=resolveBindingServiceActivations.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"PlanResultCacheManager.spec.d.ts","sourceRoot":"","sources":["../../../../src/container/services/PlanResultCacheManager.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
import e,{useRef as n,useReducer as t,createContext as r,useEffect as i,useLayoutEffect as o,useMemo as a,useCallback as c,useState as u,useContext as l,useImperativeHandle as s,Children as d,cloneElement as v}from"react";import{createPortal as f}from"react-dom";function h(){return h=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},h.apply(null,arguments)}function m(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.includes(r))continue;t[r]=e[r]}return t}function g(e){var t=n({fn:e,curr:void 0}).current;if(t.fn=e,!t.curr){var r=Object.create(null);Object.keys(e).forEach(function(e){r[e]=function(){var n;return(n=t.fn[e]).call.apply(n,[t.fn].concat([].slice.call(arguments)))}}),t.curr=r}return t.curr}function p(e){return t(function(e,n){return h({},e,"function"==typeof n?n(e):n)},e)}var w=r(void 0),y="cubic-bezier(0.25, 0.8, 0.25, 1)",x=20,C="undefined"!=typeof window&&"ontouchstart"in window,b=function(e,n,t){return Math.max(Math.min(e,t),n)},E=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=0),b(e,1*(1-t),Math.max(6,n)*(1+t))},k="undefined"==typeof window||/ServerSideRendering/.test(navigator&&navigator.userAgent)?i:o;function P(e,t,r){var o=n(t);o.current=t,i(function(){function n(e){o.current(e)}return e&&window.addEventListener(e,n,r),function(){e&&window.removeEventListener(e,n)}},[e])}var _=["container"];function M(n){var t=n.container,r=void 0===t?document.body:t,i=m(n,_);return f(e.createElement("div",h({},i)),r)}function Y(n){return e.createElement("svg",h({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function X(n){return e.createElement("svg",h({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function N(n){return e.createElement("svg",h({width:"44",height:"44",viewBox:"0 0 768 768"},n),e.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function W(){return i(function(){var e=document.body.style,n=e.overflow;return e.overflow="hidden",function(){e.overflow=n}},[]),null}function S(e){var n=e.touches[0],t=n.clientX,r=n.clientY;if(e.touches.length>=2){var i=e.touches[1],o=i.clientX,a=i.clientY;return[(t+o)/2,(r+a)/2,Math.sqrt(Math.pow(o-t,2)+Math.pow(a-r,2))]}return[t,r,0]}var T=function(e,n,t,r){var i,o=t*n,a=(o-r)/2,c=e;return o<=r?(i=1,c=0):e>0&&a-e<=0?(i=2,c=a):e<0&&a+e<=0&&(i=3,c=-a),[i,c]};function V(e,n,t,r,i,o,a,c,u,l){void 0===a&&(a=innerWidth/2),void 0===c&&(c=innerHeight/2),void 0===u&&(u=0),void 0===l&&(l=0);var s=T(e,o,t,innerWidth)[0],d=T(n,o,r,innerHeight),v=innerWidth/2,f=innerHeight/2;return{x:a-o/i*(a-(v+e))-v+(r/t>=3&&t*o===innerWidth?0:s?u/2:u),y:c-o/i*(c-(f+n))-f+(d[0]?l/2:l),lastCX:a,lastCY:c}}function R(e,n,t){var r=e%180!=0;return r?[t,n,r]:[n,t,r]}function A(e,n,t){var r=R(t,innerWidth,innerHeight),i=r[0],o=r[1],a=0,c=i,u=o,l=e/n*o,s=n/e*i;return e<i&&n<o?(c=e,u=n):e<i&&n>=o?c=l:e>=i&&n<o||e/n>i/o?u=s:n/e>=3&&!r[2]?a=((u=s)-o)/2:c=l,{width:c,height:u,x:0,y:a,pause:!0}}function I(e,t){var r=t.leading,i=void 0!==r&&r,o=t.maxWait,a=t.wait,u=void 0===a?o||0:a,l=n(e);l.current=e;var s=n(0),d=n(),v=function(){return d.current&&clearTimeout(d.current)},f=c(function(){var e=[].slice.call(arguments),n=Date.now();function t(){s.current=n,v(),l.current.apply(null,e)}var r=s.current,a=n-r;if(0===r&&(i&&t(),s.current=n),void 0!==o){if(a>o)return void t()}else a<u&&(s.current=n);v(),d.current=setTimeout(function(){t(),s.current=0},u)},[u,o,i]);return f.cancel=v,f}var H=function(e,n,t){return F(e,n,t,100,function(e){return e},function(){return F(n,e,t)})},L=function(e){return 1-Math.pow(1-e,4)};function F(e,n,t,r,i,o){void 0===r&&(r=400),void 0===i&&(i=L);var a=n-e;if(0!==a){var c=Date.now(),u=0,l=function(){var n=Math.min(1,(Date.now()-c)/r);t(e+i(n)*a)&&n<1?s():(cancelAnimationFrame(u),n>=1&&o&&o())};s()}function s(){u=requestAnimationFrame(l)}}var D={T:0,L:0,W:0,H:0,FIT:void 0},B=function(){var e=n(!1);return i(function(){return e.current=!0,function(){e.current=!1}},[]),e},O=["className"];function z(n){var t=n.className,r=void 0===t?"":t,i=m(n,O);return e.createElement("div",h({className:"PhotoView__Spinner "+r},i),e.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},e.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),e.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var j=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function q(n){var t=n.src,r=n.loaded,i=n.broken,o=n.className,a=n.onPhotoLoad,c=n.loadingElement,u=n.brokenELine truncated
//# sourceMappingURL=react-photo-view.module.js.map
@@ -0,0 +1,53 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed 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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
interface Int8ArrayConstructor {
new (): Int8Array<ArrayBuffer>;
}
interface Uint8ArrayConstructor {
new (): Uint8Array<ArrayBuffer>;
}
interface Uint8ClampedArrayConstructor {
new (): Uint8ClampedArray<ArrayBuffer>;
}
interface Int16ArrayConstructor {
new (): Int16Array<ArrayBuffer>;
}
interface Uint16ArrayConstructor {
new (): Uint16Array<ArrayBuffer>;
}
interface Int32ArrayConstructor {
new (): Int32Array<ArrayBuffer>;
}
interface Uint32ArrayConstructor {
new (): Uint32Array<ArrayBuffer>;
}
interface Float32ArrayConstructor {
new (): Float32Array<ArrayBuffer>;
}
interface Float64ArrayConstructor {
new (): Float64Array<ArrayBuffer>;
}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,MAAM,gCAAU;AAChB,MAAM,gCAAU;AAChB,MAAM,qCAAe;AACrB,MAAM,2CAAqB;AAC3B,MAAM,oCAAc;AACpB,MAAM,8CACF;AACJ,MAAM,mDAA6B;IAAC;IAAS;IAAW;CAAU;AAClE,MAAM,+CAAyB;IAAC;IAAS;IAAU;IAAS;OAAW;CAA2B;AAG3F,SAAS,0CAAU,KAAa;IACrC,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,mCAAmC;IAGrD,OAAO,IAAI,CAAA,GAAA,8BAAG,EACZ,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;AAEnD;AAGO,SAAS,yCAAU,KAAa;IACrC,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,mCAAmC;IAGrD,IAAI,OAA8B,IAAI,CAAA,GAAA,sCAAW,EAC/C,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,OACrB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB;IAGF,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;IAC7D,OAAO;AACT;AAGO,SAAS,0CAAc,KAAa;IACzC,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,wCAAwC;IAG1D,IAAI,OAAO,kCAAY,CAAC,CAAC,EAAE,EAAE,OAAO;IACpC,IAAI,MAAM,OAAO,IAAI,OAAO;IAE5B,IAAI,OAAkC,IAAI,CAAA,GAAA,0CAAe,EACvD,KACA,OAAO,IAAI,CAAC,OAAO,IAAI,MACvB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,GACA,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;IAGjD,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;IAC7D,OAAO;AACT;AAQO,SAAS,0CAAmB,KAAa,EAAE,cAA+B;IAC/E,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,wCAAwC;IAG1D,IAAI,OAAO,kCAAY,CAAC,CAAC,EAAE,EAAE,OAAO;IACpC,IAAI,MAAM,OAAO,IAAI,OAAO;IAE5B,IAAI,OAA+B,IAAI,CAAA,GAAA,uCAAY,EACjD,KACA,OAAO,IAAI,CAAC,OAAO,IAAI,MACvB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,GACA,CAAC,CAAC,GAAG,EACL,GACA,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;IAGjD,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;IAE7D,IAAI,gBAAgB,CAAA,GAAA,4CAAiB,EAAE;IAEvC,IAAI;IACJ,IAAI,CAAC,CAAC,EAAE,EAAE;QACR,IAAI,aAAa,kCAAY,CAAC,CAAC,EAAE,EAAE,KAAK;YACmD,KAA8C;QAAzI,KAAK,MAAM,GAAG,KAAK,IAAI,CAAC,cAAe,CAAA,KAAK,GAAG,CAAC,cAAT,UAAwC,kCAAY,CAAA,MAAA,CAAC,CAAC,EAAE,cAAJ,iBAAA,MAAQ,KAAK,GAAG,MAA5B,QAA8C,kCAAY,CAAA,OAAA,CAAC,CAAC,GAAG,cAAL,kBAAA,OAAS,KAAK,GAAG,MAAM,IAAG;QACnK,KAAK,CAAA,GAAA,uCAAY,EAAE,QAAyB,KAAK,MAAM;QAEvD,uCAAuC;QACvC,IAAI,YAAY,CAAA,GAAA,2CAAgB,EAAE,eAAe,KAAK,QAAQ;QAC9D,IAAI,CAAC,UAAU,QAAQ,CAAC,KACtB,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,qCAAe,KAAK,MAAM,EAAE,gBAAgB,EAAE,0CAAiB,MAAM,IAAI,EAAE,KAAK,QAAQ,EAAE;IAExH,OACE,gEAAgE;IAChE,KAAK,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,4CAAiB,EAAE,gBAAgB,KAAK,QAAQ,EAAE;IAGpE,OAAO,CAAA,GAAA,sCAAW,EAAE,IAAI,KAAK,QAAQ;AACvC;AAMO,SAAS,0CAAc,KAAa,EAAE,QAAgB;IAC3D,IAAI,IAAI,MAAM,KAAK,CAAC;IACpB,IAAI,CAAC,GACH,MAAM,IAAI,MAAM,wCAAwC;IAG1D,IAAI,OAAO,kCAAY,CAAC,CAAC,EAAE,EAAE,OAAO;IACpC,IAAI,MAAM,OAAO,IAAI,OAAO;IAE5B,IAAI,OAA+B,IAAI,CAAA,GAAA,uCAAY,EACjD,KACA,OAAO,IAAI,CAAC,OAAO,IAAI,MACvB,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KACrB,GACA,UACA,GACA,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,MAAM,GAClC,CAAC,CAAC,EAAE,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,YAAY,OAAO;IAGjD,KAAK,GAAG,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,QAAQ,CAAC,cAAc,CAAC;QAGa;IAD1E,IAAI,CAAC,CAAC,EAAE,EACN,KAAK,MAAM,GAAG,kCAAY,CAAC,CAAC,EAAE,EAAE,KAAK,MAAvB,UAA8C,kCAAY,CAAA,MAAA,CAAC,CAAC,EAAE,cAAJ,iBAAA,MAAQ,KAAK,GAAG,MAA5B;IAG9D,OAAO,CAAA,GAAA,oCAAS,EAAE,MAAuB;AAC3C;AAMO,SAAS,0CAAqB,KAAa;IAChD,OAAO,0CAAc,OAAO,CAAA,GAAA,0CAAe;AAC7C;AAEA,SAAS,kCAAY,KAAa,EAAE,GAAW,EAAE,GAAW;IAC1D,IAAI,MAAM,OAAO;IACjB,IAAI,MAAM,OAAO,MAAM,KACrB,MAAM,IAAI,WAAW,CAAC,oBAAoB,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,KAAK;IAGvE,OAAO;AACT;AAEO,SAAS,0CAAa,IAAU;IACrC,OAAO,GAAG,OAAO,KAAK,IAAI,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,OAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,OAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,GAAG,OAAO,KAAK,WAAW,GAAG,OAAO,KAAK,WAAW,GAAG,MAAM,KAAK,CAAC,KAAK,IAAI;AACnM;AAEO,SAAS,0CAAa,IAAkB;IAC7C,IAAI,gBAAgB,CAAA,GAAA,oCAAS,EAAE,MAAM,IAAI,CAAA,GAAA,2CAAgB;IACzD,IAAI;IACJ,IAAI,cAAc,GAAG,KAAK,MACxB,OAAO,cAAc,IAAI,KAAK,IAC1B,SACA,MAAM,OAAO,KAAK,GAAG,CAAC,IAAI,cAAc,IAAI,GAAG,QAAQ,CAAC,GAAG;SAE/D,OAAO,OAAO,cAAc,IAAI,EAAE,QAAQ,CAAC,GAAG;IAEhD,OAAO,GAAG,KAAK,CAAC,EAAE,OAAO,cAAc,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,OAAO,cAAc,GAAG,EAAE,QAAQ,CAAC,GAAG,MAAM;AAChH;AAEO,SAAS,0CAAiB,IAAiB;IAChD,aAAa;IACb,OAAO,GAAG,0CAAa,MAAM,CAAC,EAAE,0CAAa,OAAO;AACtD;AAEA,SAAS,qCAAe,MAAc;IACpC,IAAI,OAAO,KAAK,IAAI,CAAC,UAAU,IAAI,MAAM;IACzC,SAAS,KAAK,GAAG,CAAC;IAClB,IAAI,cAAc,KAAK,KAAK,CAAC,SAAU;IACvC,IAAI,gBAAgB,KAAK,KAAK,CAAC,AAAC,SAAU,UAAoB;IAC9D,IAAI,gBAAgB,KAAK,KAAK,CAAC,AAAC,SAAU,UAAoB,QAAa;IAC3E,IAAI,eALine truncated
@@ -0,0 +1,238 @@
/**
* @fileoverview A rule to set the maximum number of line of code in a function.
* @author Pete Ward <peteward44@gmail.com>
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
const { upperCaseFirst } = require("../shared/string-utils");
//------------------------------------------------------------------------------
// Constants
//------------------------------------------------------------------------------
const OPTIONS_SCHEMA = {
type: "object",
properties: {
max: {
type: "integer",
minimum: 0,
},
skipComments: {
type: "boolean",
},
skipBlankLines: {
type: "boolean",
},
IIFEs: {
type: "boolean",
},
},
additionalProperties: false,
};
const OPTIONS_OR_INTEGER_SCHEMA = {
oneOf: [
OPTIONS_SCHEMA,
{
type: "integer",
minimum: 1,
},
],
};
/**
* Given a list of comment nodes, return a map with numeric keys (source code line numbers) and comment token values.
* @param {Array} comments An array of comment nodes.
* @returns {Map<string, Node>} A map with numeric keys (source code line numbers) and comment token values.
*/
function getCommentLineNumbers(comments) {
const map = new Map();
comments.forEach(comment => {
for (let i = comment.loc.start.line; i <= comment.loc.end.line; i++) {
map.set(i, comment);
}
});
return map;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Enforce a maximum number of lines of code in a function",
recommended: false,
url: "https://eslint.org/docs/latest/rules/max-lines-per-function",
},
schema: [OPTIONS_OR_INTEGER_SCHEMA],
messages: {
exceed: "{{name}} has too many lines ({{lineCount}}). Maximum allowed is {{maxLines}}.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const lines = sourceCode.lines;
const option = context.options[0];
let maxLines = 50;
let skipComments = false;
let skipBlankLines = false;
let IIFEs = false;
if (typeof option === "object") {
maxLines = typeof option.max === "number" ? option.max : 50;
skipComments = !!option.skipComments;
skipBlankLines = !!option.skipBlankLines;
IIFEs = !!option.IIFEs;
} else if (typeof option === "number") {
maxLines = option;
}
const commentLineNumbers = getCommentLineNumbers(
sourceCode.getAllComments(),
);
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
/**
* Tells if a comment encompasses the entire line.
* @param {string} line The source line with a trailing comment
* @param {number} lineNumber The one-indexed line number this is on
* @param {ASTNode} comment The comment to remove
* @returns {boolean} If the comment covers the entire line
*/
function isFullLineComment(line, lineNumber, comment) {
const start = comment.loc.start,
end = comment.loc.end,
isFirstTokenOnLine =
start.line === lineNumber &&
!line.slice(0, start.column).trim(),
isLastTokenOnLine =
end.line === lineNumber && !line.slice(end.column).trim();
return (
comment &&
(start.line < lineNumber || isFirstTokenOnLine) &&
(end.line > lineNumber || isLastTokenOnLine)
);
}
/**
* Identifies is a node is a FunctionExpression which is part of an IIFE
* @param {ASTNode} node Node to test
* @returns {boolean} True if it's an IIFE
*/
function isIIFE(node) {
return (
(node.type === "FunctionExpression" ||
node.type === "ArrowFunctionExpression") &&
node.parent &&
node.parent.type === "CallExpression" &&
node.parent.callee === node
);
}
/**
* Identifies is a node is a FunctionExpression which is embedded within a MethodDefinition or Property
* @param {ASTNode} node Node to test
* @returns {boolean} True if it's a FunctionExpression embedded within a MethodDefinition or Property
*/
function isEmbedded(node) {
if (!node.parent) {
return false;
}
if (node !== node.parent.value) {
return false;
}
if (node.parent.type === "MethodDefinition") {
return true;
}
if (node.parent.type === "Property") {
return (
node.parent.method === true ||
node.parent.kind === "get" ||
node.parent.kind === "set"
);
}
return false;
}
/**
* Count the lines in the function
* @param {ASTNode} funcNode Function AST node
* @returns {void}
* @private
*/
function processFunction(funcNode) {
const node = isEmbedded(funcNode) ? funcNode.parent : funcNode;
if (!IIFEs && isIIFE(node)) {
return;
}
let lineCount = 0;
for (let i = node.loc.start.line - 1; i < node.loc.end.line; ++i) {
const line = lines[i];
if (skipComments) {
if (
commentLineNumbers.has(i + 1) &&
isFullLineComment(
line,
i + 1,
commentLineNumbers.get(i + 1),
)
) {
continue;
}
}
if (skipBlankLines) {
if (line.match(/^\s*$/u)) {
continue;
}
}
lineCount++;
}
if (lineCount > maxLines) {
const name = upperCaseFirst(
astUtils.getFunctionNameWithKind(funcNode),
);
context.report({
node,
messageId: "exceed",
data: { name, lineCount, maxLines },
});
}
}
//--------------------------------------------------------------------------
// Public API
//--------------------------------------------------------------------------
return {
FunctionDeclaration: processFunction,
FunctionExpression: processFunction,
ArrowFunctionExpression: processFunction,
};
},
};
@@ -0,0 +1,10 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"
module.exports = function stripImportPathParams(path) {
const i = path.indexOf("!")
return i === -1 ? path : path.slice(0, i)
}
@@ -0,0 +1 @@
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AACrD,2BAA6B;AAC7B,qCAAoC;AAsCpC,SAAgB,UAAU,CAAC,GAAyB;IAAzB,oBAAA,EAAA,MAAc,iBAAO,CAAC,GAAG;IAClD,OAAO,YAAY,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AACpC,CAAC;AAFD,gCAEC;AAED,SAAgB,YAAY,CAAC,EAIR;QAHnB,GAAG,SAAA,EACH,cAAc,oBAAA,EACd,sBAA+C,EAA/C,cAAc,mBAAG,eAAe,CAAC,cAAc,KAAA;IAE/C,IAAI,cAAc,EAAE;QAClB,gDAAgD;QAChD,IAAM,iBAAe,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC;YAC7D,CAAC,CAAC,cAAc,CAAC,OAAO;YACxB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QAE3C,OAAO;YACL,UAAU,EAAE,SAAS;YACrB,sBAAsB,EAAE,EAAE;YAC1B,OAAO,EAAE,cAAc,CAAC,OAAO;YAC/B,eAAe,mBAAA;YACf,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,UAAU,EAAE,cAAc,CAAC,UAAU;YACrC,WAAW,EAAE,cAAc,CAAC,WAAW;SACxC,CAAC;KACH;IAED,kDAAkD;IAClD,IAAM,UAAU,GAAG,cAAc,CAAC;QAChC,GAAG,KAAA;QACH,MAAM,EAAE,UAAC,GAAW,IAAK,OAAA,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAhB,CAAgB;KAC1C,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE;QAC5B,OAAO;YACL,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,6BAA6B;SACvC,CAAC;KACH;IAED,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;QACvB,OAAO;YACL,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,oCAAoC;SAC9C,CAAC;KACH;IAED,IAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAEnE,OAAO;QACL,UAAU,EAAE,SAAS;QACrB,sBAAsB,EAAE,UAAU,CAAC,YAAY;QAC/C,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,eAAe,iBAAA;QACf,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;KAC9B,CAAC;AACJ,CAAC;AApDD,oCAoDC"}
@@ -0,0 +1,529 @@
/**
* @fileoverview Attempts to discover all state fields in a React component and
* warn if any of them are never read.
*
* State field definitions are collected from `this.state = {}` assignments in
* the constructor, objects passed to `this.setState()`, and `state = {}` class
* property assignments.
*/
'use strict';
const docsUrl = require('../util/docsUrl');
const astUtil = require('../util/ast');
const componentUtil = require('../util/componentUtil');
const report = require('../util/report');
const getScope = require('../util/eslint').getScope;
// Descend through all wrapping TypeCastExpressions and return the expression
// that was cast.
function uncast(node) {
while (node.type === 'TypeCastExpression') {
node = node.expression;
}
return node;
}
// Return the name of an identifier or the string value of a literal. Useful
// anywhere that a literal may be used as a key (e.g., member expressions,
// method definitions, ObjectExpression property keys).
function getName(node) {
node = uncast(node);
const type = node.type;
if (type === 'Identifier') {
return node.name;
}
if (type === 'Literal') {
return String(node.value);
}
if (type === 'TemplateLiteral' && node.expressions.length === 0) {
return node.quasis[0].value.raw;
}
return null;
}
function isThisExpression(node) {
return astUtil.unwrapTSAsExpression(uncast(node)).type === 'ThisExpression';
}
function getInitialClassInfo() {
return {
// Set of nodes where state fields were defined.
stateFields: new Set(),
// Set of names of state fields that we've seen used.
usedStateFields: new Set(),
// Names of local variables that may be pointing to this.state. To
// track this properly, we would need to keep track of all locals,
// shadowing, assignments, etc. To keep things simple, we only
// maintain one set of aliases per method and accept that it will
// produce some false negatives.
aliases: null,
};
}
function isSetStateCall(node) {
const unwrappedCalleeNode = astUtil.unwrapTSAsExpression(node.callee);
return (
unwrappedCalleeNode.type === 'MemberExpression'
&& isThisExpression(unwrappedCalleeNode.object)
&& getName(unwrappedCalleeNode.property) === 'setState'
);
}
const messages = {
unusedStateField: 'Unused state field: \'{{name}}\'',
};
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
description: 'Disallow definitions of unused state',
category: 'Best Practices',
recommended: false,
url: docsUrl('no-unused-state'),
},
messages,
schema: [],
},
create(context) {
// Non-null when we are inside a React component ClassDeclaration and we have
// not yet encountered any use of this.state which we have chosen not to
// analyze. If we encounter any such usage (like this.state being spread as
// JSX attributes), then this is again set to null.
let classInfo = null;
function isStateParameterReference(node) {
const classMethods = [
'shouldComponentUpdate',
'componentWillUpdate',
'UNSAFE_componentWillUpdate',
'getSnapshotBeforeUpdate',
'componentDidUpdate',
];
let scope = getScope(context, node);
while (scope) {
const parent = scope.block && scope.block.parent;
if (
parent
&& parent.type === 'MethodDefinition' && (
(parent.static && parent.key.name === 'getDerivedStateFromProps')
|| classMethods.indexOf(parent.key.name) !== -1
)
&& parent.value.type === 'FunctionExpression'
&& parent.value.params[1]
&& parent.value.params[1].name === node.name
) {
return true;
}
scope = scope.upper;
}
return false;
}
// Returns true if the given node is possibly a reference to `this.state` or the state parameter of
// a lifecycle method.
function isStateReference(node) {
node = uncast(node);
const isDirectStateReference = node.type === 'MemberExpression'
&& isThisExpression(node.object)
&& node.property.name === 'state';
const isAliasedStateReference = node.type === 'Identifier'
&& classInfo.aliases
&& classInfo.aliases.has(node.name);
return isDirectStateReference || isAliasedStateReference || isStateParameterReference(node);
}
// Takes an ObjectExpression node and adds all named Property nodes to the
// current set of state fields.
function addStateFields(node) {
node.properties.filter((prop) => (
prop.type === 'Property'
&& (prop.key.type === 'Literal'
|| (prop.key.type === 'TemplateLiteral' && prop.key.expressions.length === 0)
|| (prop.computed === false && prop.key.type === 'Identifier'))
&& getName(prop.key) !== null
)).forEach((prop) => {
classInfo.stateFields.add(prop);
});
}
// Adds the name of the given node as a used state field if the node is an
// Identifier or a Literal. Other node types are ignored.
function addUsedStateField(node) {
if (!classInfo) {
return;
}
const name = getName(node);
if (name) {
classInfo.usedStateFields.add(name);
}
}
// Records used state fields and new aliases for an ObjectPattern which
// destructures `this.state`.
function handleStateDestructuring(node) {
node.properties.forEach((prop) => {
if (prop.type === 'Property') {
addUsedStateField(prop.key);
} else if (
(prop.type === 'ExperimentalRestProperty' || prop.type === 'RestElement')
&& classInfo.aliases
) {
classInfo.aliases.add(getName(prop.argument));
}
});
}
// Used to record used state fields and new aliases for both
// AssignmentExpressions and VariableDeclarators.
function handleAssignment(left, right) {
const unwrappedRight = astUtil.unwrapTSAsExpression(right);
switch (left.type) {
case 'Identifier':
if (isStateReference(unwrappedRight) && classInfo.aliases) {
classInfo.aliases.add(left.name);
}
break;
case 'ObjectPattern':
if (isStateReference(unwrappedRight)) {
handleStateDestructuring(left);
} else if (isThisExpression(unwrappedRight) && classInfo.aliases) {
left.properties.forEach((prop) => {
if (prop.type === 'Property' && getName(prop.key) === 'state') {
const name = getName(prop.value);
if (name) {
classInfo.aliases.add(name);
} else if (prop.value.type === 'ObjectPattern') {
handleStateDestructuring(prop.value);
}
}
});
}
break;
default:
// pass
}
}
function reportUnusedFields() {
// Report all unused state fields.
classInfo.stateFields.forEach((node) => {
const name = getName(node.key);
if (!classInfo.usedStateFields.has(name)) {
report(context, messages.unusedStateField, 'unusedStateField', {
node,
data: {
name,
},
});
}
});
}
function handleES6ComponentEnter(node) {
if (componentUtil.isES6Component(node, context)) {
classInfo = getInitialClassInfo();
}
}
function handleES6ComponentExit() {
if (!classInfo) {
return;
}
reportUnusedFields();
classInfo = null;
}
function isGDSFP(node) {
const name = getName(node.key);
if (
!node.static
|| name !== 'getDerivedStateFromProps'
|| !node.value
|| !node.value.params
|| node.value.params.length < 2 // no `state` argument
) {
return false;
}
return true;
}
return {
ClassDeclaration: handleES6ComponentEnter,
'ClassDeclaration:exit': handleES6ComponentExit,
ClassExpression: handleES6ComponentEnter,
'ClassExpression:exit': handleES6ComponentExit,
ObjectExpression(node) {
if (componentUtil.isES5Component(node, context)) {
classInfo = getInitialClassInfo();
}
},
'ObjectExpression:exit'(node) {
if (!classInfo) {
return;
}
if (componentUtil.isES5Component(node, context)) {
reportUnusedFields();
classInfo = null;
}
},
CallExpression(node) {
if (!classInfo) {
return;
}
const unwrappedNode = astUtil.unwrapTSAsExpression(node);
const unwrappedArgumentNode = astUtil.unwrapTSAsExpression(unwrappedNode.arguments[0]);
// If we're looking at a `this.setState({})` invocation, record all the
// properties as state fields.
if (
isSetStateCall(unwrappedNode)
&& unwrappedNode.arguments.length > 0
&& unwrappedArgumentNode.type === 'ObjectExpression'
) {
addStateFields(unwrappedArgumentNode);
} else if (
isSetStateCall(unwrappedNode)
&& unwrappedNode.arguments.length > 0
&& unwrappedArgumentNode.type === 'ArrowFunctionExpression'
) {
const unwrappedBodyNode = astUtil.unwrapTSAsExpression(unwrappedArgumentNode.body);
if (unwrappedBodyNode.type === 'ObjectExpression') {
addStateFields(unwrappedBodyNode);
}
if (unwrappedArgumentNode.params.length > 0 && classInfo.aliases) {
const firstParam = unwrappedArgumentNode.params[0];
if (firstParam.type === 'ObjectPattern') {
handleStateDestructuring(firstParam);
} else {
classInfo.aliases.add(getName(firstParam));
}
}
}
},
'ClassProperty, PropertyDefinition'(node) {
if (!classInfo) {
return;
}
// If we see state being assigned as a class property using an object
// expression, record all the fields of that object as state fields.
const unwrappedValueNode = astUtil.unwrapTSAsExpression(node.value);
const name = getName(node.key);
if (
name === 'state'
&& !node.static
&& unwrappedValueNode
&& unwrappedValueNode.type === 'ObjectExpression'
) {
addStateFields(unwrappedValueNode);
}
if (
!node.static
&& unwrappedValueNode
&& unwrappedValueNode.type === 'ArrowFunctionExpression'
) {
// Create a new set for this.state aliases local to this method.
classInfo.aliases = new Set();
}
},
'ClassProperty:exit'(node) {
if (
classInfo
&& !node.static
&& node.value
&& node.value.type === 'ArrowFunctionExpression'
) {
// Forget our set of local aliases.
classInfo.aliases = null;
}
},
'PropertyDefinition, ClassProperty'(node) {
if (!isGDSFP(node)) {
return;
}
const childScope = getScope(context, node).childScopes.find((x) => x.block === node.value);
if (!childScope) {
return;
}
const scope = childScope.variableScope.childScopes.find((x) => x.block === node.value);
const stateArg = node.value.params[1]; // probably "state"
if (!scope || !scope.variables) {
return;
}
const argVar = scope.variables.find((x) => x.name === stateArg.name);
if (argVar) {
const stateRefs = argVar.references;
stateRefs.forEach((ref) => {
const identifier = ref.identifier;
if (identifier && identifier.parent && identifier.parent.type === 'MemberExpression') {
addUsedStateField(identifier.parent.property);
}
});
}
},
'PropertyDefinition:exit'(node) {
if (
classInfo
&& !node.static
&& node.value
&& node.value.type === 'ArrowFunctionExpression'
&& !isGDSFP(node)
) {
// Forget our set of local aliases.
classInfo.aliases = null;
}
},
MethodDefinition() {
if (!classInfo) {
return;
}
// Create a new set for this.state aliases local to this method.
classInfo.aliases = new Set();
},
'MethodDefinition:exit'() {
if (!classInfo) {
return;
}
// Forget our set of local aliases.
classInfo.aliases = null;
},
FunctionExpression(node) {
if (!classInfo) {
return;
}
const parent = node.parent;
if (!componentUtil.isES5Component(parent.parent, context)) {
return;
}
if (
'key' in parent
&& 'name' in parent.key
&& parent.key.name === 'getInitialState'
) {
const body = node.body.body;
const lastBodyNode = body[body.length - 1];
if (
lastBodyNode.type === 'ReturnStatement'
&& lastBodyNode.argument.type === 'ObjectExpression'
) {
addStateFields(lastBodyNode.argument);
}
} else {
// Create a new set for this.state aliases local to this method.
classInfo.aliases = new Set();
}
},
AssignmentExpression(node) {
if (!classInfo) {
return;
}
const unwrappedLeft = astUtil.unwrapTSAsExpression(node.left);
const unwrappedRight = astUtil.unwrapTSAsExpression(node.right);
// Check for assignments like `this.state = {}`
if (
unwrappedLeft.type === 'MemberExpression'
&& isThisExpression(unwrappedLeft.object)
&& getName(unwrappedLeft.property) === 'state'
&& unwrappedRight.type === 'ObjectExpression'
) {
// Find the nearest function expression containing this assignment.
/** @type {import('eslint').Rule.Node} */
let fn = node;
while (fn.type !== 'FunctionExpression' && fn.parent) {
fn = fn.parent;
}
// If the nearest containing function is the constructor, then we want
// to record all the assigned properties as state fields.
if (
fn.parent
&& fn.parent.type === 'MethodDefinition'
&& fn.parent.kind === 'constructor'
) {
addStateFields(unwrappedRight);
}
} else {
// Check for assignments like `alias = this.state` and record the alias.
handleAssignment(unwrappedLeft, unwrappedRight);
}
},
VariableDeclarator(node) {
if (!classInfo || !node.init) {
return;
}
handleAssignment(node.id, node.init);
},
'MemberExpression, OptionalMemberExpression'(node) {
if (!classInfo) {
return;
}
if (isStateReference(astUtil.unwrapTSAsExpression(node.object))) {
// If we see this.state[foo] access, give up.
if (node.computed && node.property.type !== 'Literal') {
classInfo = null;
return;
}
// Otherwise, record that we saw this property being accessed.
addUsedStateField(node.property);
// If we see a `this.state` access in a CallExpression, give up.
} else if (isStateReference(node) && astUtil.isCallExpression(node.parent)) {
classInfo = null;
}
},
JSXSpreadAttribute(node) {
if (classInfo && isStateReference(node.argument)) {
classInfo = null;
}
},
'ExperimentalSpreadProperty, SpreadElement'(node) {
if (classInfo && isStateReference(node.argument)) {
classInfo = null;
}
},
};
},
};
@@ -0,0 +1,8 @@
'use strict';
var Type = require('../type');
module.exports = new Type('tag:yaml.org,2002:map', {
kind: 'mapping',
construct: function (data) { return data !== null ? data : {}; }
});
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,MAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/sv-SE.json"],"sourcesContent":["{\n \"dismiss\": \"Avvisa\"\n}\n"],"names":[],"version":3,"file":"sv-SE.module.js.map"}
@@ -0,0 +1,95 @@
import { OneBotAction } from '../../action/OneBotAction';
import { Static } from '@sinclair/typebox';
export declare const GetGroupSystemMsgPayloadSchema: import("@sinclair/typebox").TObject<{
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString]>;
}>;
export type GetGroupSystemMsgPayload = Static<typeof GetGroupSystemMsgPayloadSchema>;
export declare const GetGroupSystemMsgReturnSchema: import("@sinclair/typebox").TObject<{
invited_requests: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
request_id: import("@sinclair/typebox").TNumber;
invitor_uin: import("@sinclair/typebox").TNumber;
invitor_nick: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
message: import("@sinclair/typebox").TString;
checked: import("@sinclair/typebox").TBoolean;
actor: import("@sinclair/typebox").TNumber;
requester_nick: import("@sinclair/typebox").TString;
}>>;
InvitedRequest: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
request_id: import("@sinclair/typebox").TNumber;
invitor_uin: import("@sinclair/typebox").TNumber;
invitor_nick: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
message: import("@sinclair/typebox").TString;
checked: import("@sinclair/typebox").TBoolean;
actor: import("@sinclair/typebox").TNumber;
requester_nick: import("@sinclair/typebox").TString;
}>>;
join_requests: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
request_id: import("@sinclair/typebox").TNumber;
invitor_uin: import("@sinclair/typebox").TNumber;
invitor_nick: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
message: import("@sinclair/typebox").TString;
checked: import("@sinclair/typebox").TBoolean;
actor: import("@sinclair/typebox").TNumber;
requester_nick: import("@sinclair/typebox").TString;
}>>;
}>;
export type GetGroupSystemMsgReturn = Static<typeof GetGroupSystemMsgReturnSchema>;
export declare class GetGroupSystemMsg extends OneBotAction<GetGroupSystemMsgPayload, GetGroupSystemMsgReturn> {
actionName: "get_group_system_msg";
payloadSchema: import("@sinclair/typebox").TObject<{
count: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString]>;
}>;
returnSchema: import("@sinclair/typebox").TObject<{
invited_requests: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
request_id: import("@sinclair/typebox").TNumber;
invitor_uin: import("@sinclair/typebox").TNumber;
invitor_nick: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
message: import("@sinclair/typebox").TString;
checked: import("@sinclair/typebox").TBoolean;
actor: import("@sinclair/typebox").TNumber;
requester_nick: import("@sinclair/typebox").TString;
}>>;
InvitedRequest: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
request_id: import("@sinclair/typebox").TNumber;
invitor_uin: import("@sinclair/typebox").TNumber;
invitor_nick: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
message: import("@sinclair/typebox").TString;
checked: import("@sinclair/typebox").TBoolean;
actor: import("@sinclair/typebox").TNumber;
requester_nick: import("@sinclair/typebox").TString;
}>>;
join_requests: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
request_id: import("@sinclair/typebox").TNumber;
invitor_uin: import("@sinclair/typebox").TNumber;
invitor_nick: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
message: import("@sinclair/typebox").TString;
checked: import("@sinclair/typebox").TBoolean;
actor: import("@sinclair/typebox").TNumber;
requester_nick: import("@sinclair/typebox").TString;
}>>;
}>;
actionSummary: string;
actionDescription: string;
actionTags: string[];
payloadExample: {
count: number;
};
returnExample: {
invited_requests: never[];
InvitedRequest: never[];
join_requests: never[];
};
_handle(params: GetGroupSystemMsgPayload): Promise<GetGroupSystemMsgReturn>;
}
@@ -0,0 +1,19 @@
import {useToggleState as $3017fa7ffdddec74$export$8042c6c013fd5226} from "./useToggleState.module.js";
import {useToggleGroupState as $ad999b7f496648d1$export$8deac67f4addf270} from "./useToggleGroupState.module.js";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {$3017fa7ffdddec74$export$8042c6c013fd5226 as useToggleState, $ad999b7f496648d1$export$8deac67f4addf270 as useToggleGroupState};
//# sourceMappingURL=module.js.map
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more