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,31 @@
type Key = string | number;
interface MergeObject {
[key: string]: any;
}
declare const renameProp: (oldProp: string, newProp: string, { [oldProp]: old, ...others }: {
[x: string]: any;
}) => {
[x: string]: any;
};
declare const copyObject: (obj: any) => any;
declare const omitObject: (obj: any, omitKeys: string[]) => any;
declare const cleanObject: (obj: any) => any;
declare const cleanObjectKeys: (obj: any, keys?: string[]) => any;
declare const getKeyValue: (obj: any, key: Key) => any;
/**
* Get value from a deeply nested object using a string path.
* Memorizes the value.
* @param obj - the object
* @param path - the string path
* @param fallback - the fallback value
*/
declare const getProp: (obj: Record<string, any>, path: string | number, fallback?: any, index?: number) => any;
/**
* Converting an array of objects into a single object.
* @param arr - the array of objects
* @returns the single object
*/
declare const arrayToObject: (arr: any[]) => any;
declare function compact<T extends Record<any, any>>(object: T): {} & T;
export { type MergeObject, arrayToObject, cleanObject, cleanObjectKeys, compact, copyObject, getKeyValue, getProp, omitObject, renameProp };
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isType;
var _index = require("../definitions/index.js");
function isType(nodeType, targetType) {
if (nodeType === targetType) return true;
if (nodeType == null) return false;
if (_index.ALIAS_KEYS[targetType]) return false;
const aliases = _index.FLIPPED_ALIAS_KEYS[targetType];
if (aliases != null && aliases.includes(nodeType)) return true;
return false;
}
//# sourceMappingURL=isType.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,SAAS,GAGnB,MAAM,eAAe,CAAA;AACtB,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAA;AAsDpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,IAAI,OAAO,SAAS,KAAK,UAAU;YAAE,OAAO,GAAG,SAAS,CAAA;QACxD,SAAS,GAAG,IAAI,CAAA;QAChB,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,GAAG,SAAS,CAAA;QACnB,SAAS,GAAG,EAAE,CAAA;IAChB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAA;QAC3B,OAAO,GAAG,EAAE,CAAA;QACZ,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,CAAA;AACnD,CAAC,CAAA;AAiCD,MAAM,UAAU,eAAe,CAC7B,GAAG,MAAc;IAEjB,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAEnE,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3B,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAI3C,CAAA;IAED,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAEpB,qBAAqB;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,6BAA6B;YAC7B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACvB,CAAC;QACD,oBAAoB;IACtB,CAAC,CAAA;IACD,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;IAExC,YAAY,CAAC,KAAK,CAAC,CAAA;IACnB,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE3B,IAAI,IAAI,GAAG,KAAK,CAAA;IAChB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACvC,qBAAqB;QACrB,IAAI,IAAI;YAAE,OAAM;QAChB,oBAAoB;QACpB,IAAI,GAAG,IAAI,CAAA;QACX,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE;YACnC,WAAW,EAAE,GAAG,CAAC,GAAG;SACrB,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,MAAM,CAAA;QACrD,YAAY,EAAE,CAAA;QAEd,IAAI,GAAG,KAAK,KAAK;YAAE,OAAM;aACpB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,GAAG,GAAG,CAAA;YACZ,IAAI,GAAG,IAAI,CAAA;QACb,CAAC;aAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,GAAG,GAAG,CAAA;YACV,MAAM,GAAG,IAAI,CAAA;QACf,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,yDAAyD;YACzD,0DAA0D;YAC1D,wDAAwD;YACxD,0DAA0D;YAC1D,sCAAsC;YACtC,0BAA0B;YAC1B,UAAU,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,IAAI,CAAC,CAAA;YAC1B,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBACjC,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YACtC,CAAC;YACD,oBAAoB;QACtB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n ChildProcess,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n processInfo: {\n watchdogPid?: ChildProcess['pid']\n },\n) =>\n | void\n |Line truncated
@@ -0,0 +1,37 @@
import $lFxPb$intlStringsmodulejs from "./intlStrings.module.js";
import {filterDOMProps as $lFxPb$filterDOMProps} from "@react-aria/utils";
import {useLocalizedStringFormatter as $lFxPb$useLocalizedStringFormatter} from "@react-aria/i18n";
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
/*
* 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.
*/
function $848231d7a2b3998e$export$8cefe241bd876ca0(props) {
let { 'aria-label': ariaLabel, ...otherProps } = props;
let strings = (0, $lFxPb$useLocalizedStringFormatter)((0, ($parcel$interopDefault($lFxPb$intlStringsmodulejs))), '@react-aria/breadcrumbs');
return {
navProps: {
...(0, $lFxPb$filterDOMProps)(otherProps, {
labelable: true
}),
'aria-label': ariaLabel || strings.format('breadcrumbs')
}
};
}
export {$848231d7a2b3998e$export$8cefe241bd876ca0 as useBreadcrumbs};
//# sourceMappingURL=useBreadcrumbs.module.js.map
@@ -0,0 +1,24 @@
'use strict';
var $TypeError = require('es-errors/type');
var isObject = require('es-object-atoms/isObject');
var CreateDataProperty = require('./CreateDataProperty');
var isPropertyKey = require('../helpers/isPropertyKey');
// // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow
module.exports = function CreateDataPropertyOrThrow(O, P, V) {
if (!isObject(O)) {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!isPropertyKey(P)) {
throw new $TypeError('Assertion failed: P is not a Property Key');
}
var success = CreateDataProperty(O, P, V);
if (!success) {
throw new $TypeError('unable to create data property');
}
return success;
};
@@ -0,0 +1,143 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "harf", verb: "olmalıdır" },
file: { unit: "bayt", verb: "olmalıdır" },
array: { unit: "unsur", verb: "olmalıdır" },
set: { unit: "unsur", verb: "olmalıdır" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "numara";
}
case "object": {
if (Array.isArray(data)) {
return "saf";
}
if (data === null) {
return "gayb";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "giren",
email: "epostagâh",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO hengâmı",
date: "ISO tarihi",
time: "ISO zamanı",
duration: "ISO müddeti",
ipv4: "IPv4 nişânı",
ipv6: "IPv6 nişânı",
cidrv4: "IPv4 menzili",
cidrv6: "IPv6 menzili",
base64: "base64-şifreli metin",
base64url: "base64url-şifreli metin",
json_string: "JSON metin",
e164: "E.164 sayısı",
jwt: "JWT",
template_literal: "giren",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `Fâsit giren: umulan ${issue.expected}, alınan ${parsedType(issue.input)}`;
// return `Fâsit giren: umulan ${issue.expected}, alınan ${util.getParsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1)
return `Fâsit giren: umulan ${util.stringifyPrimitive(issue.values[0])}`;
return `Fâsit tercih: mûteberler ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmalıydı.`;
return `Fazla büyük: ${issue.origin ?? "value"}, ${adj}${issue.maximum.toString()} olmalıydı.`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} ${sizing.unit} sahip olmalıydı.`;
}
return `Fazla küçük: ${issue.origin}, ${adj}${issue.minimum.toString()} olmalıydı.`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Fâsit metin: "${_issue.prefix}" ile başlamalı.`;
if (_issue.format === "ends_with")
return `Fâsit metin: "${_issue.suffix}" ile bitmeli.`;
if (_issue.format === "includes")
return `Fâsit metin: "${_issue.includes}" ihtivâ etmeli.`;
if (_issue.format === "regex")
return `Fâsit metin: ${_issue.pattern} nakşına uymalı.`;
return `Fâsit ${Nouns[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Fâsit sayı: ${issue.divisor} katı olmalıydı.`;
case "unrecognized_keys":
return `Tanınmayan anahtar ${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `${issue.origin} için tanınmayan anahtar var.`;
case "invalid_union":
return "Giren tanınamadı.";
case "invalid_element":
return `${issue.origin} için tanınmayan kıymet var.`;
default:
return `Kıymet tanınamadı.`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
@@ -0,0 +1,312 @@
# State &middot; [![monthly downloads](https://img.shields.io/npm/dm/state-local)](https://www.npmjs.com/package/state-local) [![gitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/suren-atoyan/state-local/blob/master/LICENSE) [![Rate on Openbase](https://badges.openbase.io/js/rating/state-local.svg)](https://openbase.io/js/state-local?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge) [![build size](https://img.shields.io/bundlephobia/minzip/state-local)](https://bundlephobia.com/result?p=state-local) [![npm version](https://img.shields.io/npm/v/state-local.svg?style=flat)](https://www.npmjs.com/package/state-local) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/suren-atoyan/state-local/pulls)
:zap: Tiny, simple, and robust technique for defining and acting with local states (for all js environments - node, browser, etc.)
## Synopsis
A local state for modules, functions, and other ECs
## Motivation
We all love functional programming and the concepts of it. It gives us many clean patterns, which we use in our code regardless of exactly which paradigm is in the base of our codebase. But sometimes, for some reason, we can't keep our code "clean" and have to interact with items that are outside of the current lexical environment
For example:
:x:
```javascript
let x = 0;
let y = 1;
// ...
function someFn() {
// ...
x++;
}
// ...
function anotherFn() {
// ...
y = 6;
console.log(x);
}
// ...
function yetAnotherFn() {
// ...
y = x + 4;
x = null; // 🚶
}
```
The example above lacks control over the mutations and consumption, which can lead to unpredictable and unwanted results. It is just an example of real-life usage and there are many similar cases that belong to the same class of the problem
**The purpose of this library is to give an opportunity to work with local states in a clear, predictable, trackable, and strict way**
:white_check_mark:
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ x: 0, y: 1 });
// ...
function someFn() {
// ...
setState(state => ({ x: state.x + 1 }));
}
// ...
function anotherFn() {
// ...
setState({ y: 6 });
const state = getState();
console.log(state);
}
// ...
function yetAnotherFn() {
// ...
setState(state => ({ y: state.x + 4, x: null }));
}
```
[codesandbox](https://codesandbox.io/s/motivation-1-xv5el?file=/src/index.js)
We also can track the changes in items:
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ x: 0, y: 1 }, {
x: latestX => console.log('(⌐▀ ̯ʖ▀) Houston we have a problem; "x" has been changed. "x" now is:', latestX),
y: latestY => console.log('(⌐▀ ̯ʖ▀) Houston we have a problem; "y" has been changed. "y" now is:', latestY),
});
// ...
```
[codesandbox](https://codesandbox.io/s/motivation-2-ivf7d)
We can use the subset of the state in some execution contexts:
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ x: 5, y: 7 });
// ...
function someFn() {
const state = getState(({ x }) => ({ x }));
console.log(state.x); // 5
console.log(state.y); // ❌ undefined - there is no y
}
```
[codesandbox](https://codesandbox.io/s/motivation-3-femne)
And much more...
## Documentation
#### Contents
* [Installation](#installation)
* Usage
* [create](#create)
* [initial state](#initial-state)
* [handler](#handler)
* [getState](#getstate)
* [selector](#selector)
* [setState](#setstate)
#### Installation
You can install this library as an npm package or download it from the CDN and use it in node or browser:
```bash
npm install state-local
```
or
```bash
yarn add state-local
```
or
```html
<script src="https://unpkg.com/state-local/dist/state-local.js"></script>
<script>
// now it is available in `window` (window.state)
const [getState, setState] = state.create({ x: 11, y: 13 });
// ...
</script>
```
#### create
The default export has a method called `create`, which is supposed to be a function to create a state:
```javascript
import state from 'state-local';
// state.create
// ...
```
[codesandbox](https://codesandbox.io/s/docs-create-t1cxe)
`create` is a function with two parameters:
1) [`initial state`](#initial-state) (**required**)
2) [`handler`](#handler) (**optional**)
#### initial state
`initial state` is a base structure and a value for the state. It should be a non-empty object
```javascript
import state from 'state-local';
/*
const [getState, setState] = state.create(); // ❌ error - initial state is required
const [getState, setState] = state.create(5); // ❌ error - initial state should be an object
const [getState, setState] = state.create({}); // ❌ error - initial state shouldn\'t be an empty object
*/
const [getState, setState] = state.create({ isLoading: false, payload: null }); // ✅
// ...
```
[codesandbox](https://codesandbox.io/s/docs-initial-state-22i3s)
#### handler
`handler` is a second parameter for `create` function and it is optional. It is going to be a handler for state updates. Hence it can be either a function or an object.
- If the handler is a function than it should be called immediately after every state update (with the latest state)
- If the handler is an object than the keys of that object should be a subset of the state and the values should be called immediately after every update of the corresponding field in the state (with the latest value of the field)
see example below:
if `handler` is a function
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ x: 2, y: 3, z: 5 }, handleStateUpdate /* will be called immediately after every state update */);
function handleStateUpdate(latestState) {
console.log('hey state has been updated; the new state is:', latestState); // { x: 7, y: 11, z: 13 }
}
setState({ x: 7, y: 11, z: 13 });
// ...
```
[codesandbox](https://codesandbox.io/s/handler-function-uevxj)
if `handler` is an object
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ x: 2, y: 3, z: 5 }, {
x: handleXUpdate, // will be called immediately after every "x" update
y: handleYUpdate, // will be called immediately after every "y" update
// and we don't want to listen "z" updates 😔
});
function handleXUpdate(latestX) {
console.log('(⌐▀ ̯ʖ▀) Houston we have a problem; "x" has been changed. "x" now is:', latestX); // ... "x" now is 7
}
function handleYUpdate(latestY) {
console.log('(⌐▀ ̯ʖ▀) Houston we have a problem; "y" has been changed. "y" now is:', latestY); // ... "y" now is 11
}
setState({ x: 7, y: 11, z: 13 });
// ...
```
[codesandbox](https://codesandbox.io/s/handler-object-8k0pt)
#### getState
`getState` is the first element of the pair returned by `create` function. It will return the current state or the subset of the current state depending on how it was called. It has an optional parameter `selector`
```javascript
import state from "state-local";
const [getState, setState] = state.create({ p1: 509, p2: 521 });
const state = getState();
console.log(state.p1); // 509
console.log(state.p2); // 521
// or
const { p1, p2 } = getState();
console.log(p1); // 509
console.log(p2); // 521
```
[codesandbox](https://codesandbox.io/s/getstate-zn3hj)
#### selector
`selector` is a function that is supposed to be passed (optional) as an argument to `getState`. It receives the current state and returns a subset of the state
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ p1: 389, p2: 397, p3: 401 });
function someFn() {
const state = getState(({ p1, p2 }) => ({ p1, p2 }));
console.log(state.p1); // 389
console.log(state.p2); // 397
console.log(state.p3); // ❌ undefined - there is no p3
}
```
[codesandbox](https://codesandbox.io/s/selector-vjmdu)
#### setState
`setState` is the second element of the pair returned by `create` function. It is going to receive an object as a change for the state. The change object will be shallow merged with the current state and the result will be the next state
**NOTE: the change object can't contain a field that is not specified in the "initial" state**
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ x:0, y: 0 });
setState({ z: 'some value' }); // ❌ error - it seams you want to change a field in the state which is not specified in the "initial" state
setState({ x: 11 }); // ✅ ok
setState({ y: 1 }); // ✅ ok
setState({ x: -11, y: 11 }); // ✅ ok
```
[codesandbox](https://codesandbox.io/s/setstate-1-u4fq0)
`setState` also can receive a function which will be called with the current state and it is supposed to return the change object
```javascript
import state from 'state-local';
const [getState, setState] = state.create({ x:0, y: 0 });
setState(state => ({ x: state.x + 2 })); // ✅ ok
setState(state => ({ x: state.x - 11, y: state.y + 11 })); // ✅ ok
setState(state => ({ z: 'some value' })); // ❌ error - it seams you want to change a field in the state which is not specified in the "initial" state
```
[codesandbox](https://codesandbox.io/s/smoosh-wildflower-nv9dg)
## License
[MIT](./LICENSE)
@@ -0,0 +1,121 @@
/*
* 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.
*/
// We store a global list of elements that are currently transitioning,
// mapped to a set of CSS properties that are transitioning for that element.
// This is necessary rather than a simple count of transitions because of browser
// bugs, e.g. Chrome sometimes fires both transitionend and transitioncancel rather
// than one or the other. So we need to track what's actually transitioning so that
// we can ignore these duplicate events.
let transitionsByElement = new Map<EventTarget, Set<string>>();
// A list of callbacks to call once there are no transitioning elements.
let transitionCallbacks = new Set<() => void>();
function setupGlobalEvents() {
if (typeof window === 'undefined') {
return;
}
function isTransitionEvent(event: Event): event is TransitionEvent {
return 'propertyName' in event;
}
let onTransitionStart = (e: Event) => {
if (!isTransitionEvent(e) || !e.target) {
return;
}
// Add the transitioning property to the list for this element.
let transitions = transitionsByElement.get(e.target);
if (!transitions) {
transitions = new Set();
transitionsByElement.set(e.target, transitions);
// The transitioncancel event must be registered on the element itself, rather than as a global
// event. This enables us to handle when the node is deleted from the document while it is transitioning.
// In that case, the cancel event would have nowhere to bubble to so we need to handle it directly.
e.target.addEventListener('transitioncancel', onTransitionEnd, {
once: true
});
}
transitions.add(e.propertyName);
};
let onTransitionEnd = (e: Event) => {
if (!isTransitionEvent(e) || !e.target) {
return;
}
// Remove property from list of transitioning properties.
let properties = transitionsByElement.get(e.target);
if (!properties) {
return;
}
properties.delete(e.propertyName);
// If empty, remove transitioncancel event, and remove the element from the list of transitioning elements.
if (properties.size === 0) {
e.target.removeEventListener('transitioncancel', onTransitionEnd);
transitionsByElement.delete(e.target);
}
// If no transitioning elements, call all of the queued callbacks.
if (transitionsByElement.size === 0) {
for (let cb of transitionCallbacks) {
cb();
}
transitionCallbacks.clear();
}
};
document.body.addEventListener('transitionrun', onTransitionStart);
document.body.addEventListener('transitionend', onTransitionEnd);
}
if (typeof document !== 'undefined') {
if (document.readyState !== 'loading') {
setupGlobalEvents();
} else {
document.addEventListener('DOMContentLoaded', setupGlobalEvents);
}
}
/**
* Cleans up any elements that are no longer in the document.
* This is necessary because we can't rely on transitionend events to fire
* for elements that are removed from the document while transitioning.
*/
function cleanupDetachedElements() {
for (const [eventTarget] of transitionsByElement) {
// Similar to `eventTarget instanceof Element && !eventTarget.isConnected`, but avoids
// the explicit instanceof check, since it may be different in different contexts.
if ('isConnected' in eventTarget && !eventTarget.isConnected) {
transitionsByElement.delete(eventTarget);
}
}
}
export function runAfterTransition(fn: () => void): void {
// Wait one frame to see if an animation starts, e.g. a transition on mount.
requestAnimationFrame(() => {
cleanupDetachedElements();
// If no transitions are running, call the function immediately.
// Otherwise, add it to a list of callbacks to run at the end of the animation.
if (transitionsByElement.size === 0) {
fn();
} else {
transitionCallbacks.add(fn);
}
});
}
@@ -0,0 +1,70 @@
// Lithuanian [lt]
import dayjs from '../index';
var monthFormat = 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_');
var monthStandalone = 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'); // eslint-disable-next-line no-useless-escape
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/;
var months = function months(dayjsInstance, format) {
if (MONTHS_IN_FORMAT.test(format)) {
return monthFormat[dayjsInstance.month()];
}
return monthStandalone[dayjsInstance.month()];
};
months.s = monthStandalone;
months.f = monthFormat;
var locale = {
name: 'lt',
weekdays: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'),
weekdaysShort: 'sek_pir_ant_tre_ket_pen_šeš'.split('_'),
weekdaysMin: 's_p_a_t_k_pn_š'.split('_'),
months: months,
monthsShort: 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),
ordinal: function ordinal(n) {
return n + ".";
},
weekStart: 1,
relativeTime: {
future: 'už %s',
past: 'prieš %s',
s: 'kelias sekundes',
m: 'minutę',
mm: '%d minutes',
h: 'valandą',
hh: '%d valandas',
d: 'dieną',
dd: '%d dienas',
M: 'mėnesį',
MM: '%d mėnesius',
y: 'metus',
yy: '%d metus'
},
format: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'YYYY-MM-DD',
LL: 'YYYY [m.] MMMM D [d.]',
LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',
l: 'YYYY-MM-DD',
ll: 'YYYY [m.] MMMM D [d.]',
lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]'
},
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'YYYY-MM-DD',
LL: 'YYYY [m.] MMMM D [d.]',
LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',
l: 'YYYY-MM-DD',
ll: 'YYYY [m.] MMMM D [d.]',
lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,48 @@
import { AsnArray } from "@peculiar/asn1-schema";
import { GeneralName } from "../general_name";
/**
* ```asn1
* id-ce-nameConstraints OBJECT IDENTIFIER ::= { id-ce 30 }
* ```
*/
export declare const id_ce_nameConstraints = "2.5.29.30";
/**
* ```asn1
* BaseDistance ::= INTEGER (0..MAX)
* ```
*/
export type BaseDistance = number;
/**
* ```asn1
* GeneralSubtree ::= SEQUENCE {
* base GeneralName,
* minimum [0] BaseDistance DEFAULT 0,
* maximum [1] BaseDistance OPTIONAL }
* ```
*/
export declare class GeneralSubtree {
base: GeneralName;
minimum: BaseDistance;
maximum?: BaseDistance;
constructor(params?: Partial<GeneralSubtree>);
}
/**
* ```asn1
* GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
* ```
*/
export declare class GeneralSubtrees extends AsnArray<GeneralSubtree> {
constructor(items?: GeneralSubtree[]);
}
/**
* ```asn1
* NameConstraints ::= SEQUENCE {
* permittedSubtrees [0] GeneralSubtrees OPTIONAL,
* excludedSubtrees [1] GeneralSubtrees OPTIONAL }
* ```
*/
export declare class NameConstraints {
permittedSubtrees?: GeneralSubtrees;
excludedSubtrees?: GeneralSubtrees;
constructor(params?: Partial<NameConstraints>);
}
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeDereferenceError = void 0;
exports.Pushref = Pushref;
exports.Deref = Deref;
const index_1 = require("../../type/error/index");
const index_2 = require("../../type/symbols/index");
const guard_1 = require("../guard/guard");
class TypeDereferenceError extends index_1.TypeBoxError {
constructor(schema) {
super(`Unable to dereference schema with $id '${schema.$ref}'`);
this.schema = schema;
}
}
exports.TypeDereferenceError = TypeDereferenceError;
function Resolve(schema, references) {
const target = references.find((target) => target.$id === schema.$ref);
if (target === undefined)
throw new TypeDereferenceError(schema);
return Deref(target, references);
}
/** `[Internal]` Pushes a schema onto references if the schema has an $id and does not exist on references */
function Pushref(schema, references) {
if (!(0, guard_1.IsString)(schema.$id) || references.some((target) => target.$id === schema.$id))
return references;
references.push(schema);
return references;
}
/** `[Internal]` Dereferences a schema from the references array or throws if not found */
function Deref(schema, references) {
// prettier-ignore
return (schema[index_2.Kind] === 'This' || schema[index_2.Kind] === 'Ref')
? Resolve(schema, references)
: schema;
}
@@ -0,0 +1,19 @@
var $2Y3Ap$react = require("react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "inertValue", () => $13915169b1e4142c$export$a9d04c5684123369);
function $13915169b1e4142c$export$a9d04c5684123369(value) {
const pieces = (0, $2Y3Ap$react.version).split('.');
const major = parseInt(pieces[0], 10);
if (major >= 19) return value;
// compatibility with React < 19
return value ? 'true' : undefined;
}
//# sourceMappingURL=inertValue.main.js.map
@@ -0,0 +1,60 @@
{
"name": "clsx",
"version": "2.1.1",
"repository": "lukeed/clsx",
"description": "A tiny (239B) utility for constructing className strings conditionally.",
"module": "dist/clsx.mjs",
"unpkg": "dist/clsx.min.js",
"main": "dist/clsx.js",
"types": "clsx.d.ts",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./clsx.d.mts",
"default": "./dist/clsx.mjs"
},
"default": {
"types": "./clsx.d.ts",
"default": "./dist/clsx.js"
}
},
"./lite": {
"import": {
"types": "./clsx.d.mts",
"default": "./dist/lite.mjs"
},
"default": {
"types": "./clsx.d.ts",
"default": "./dist/lite.js"
}
}
},
"author": {
"name": "Luke Edwards",
"email": "luke.edwards05@gmail.com",
"url": "https://lukeed.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"build": "node bin",
"test": "uvu -r esm test"
},
"files": [
"*.d.mts",
"*.d.ts",
"dist"
],
"keywords": [
"classes",
"classname",
"classnames"
],
"devDependencies": {
"esm": "3.2.25",
"terser": "4.8.0",
"uvu": "0.5.4"
}
}
@@ -0,0 +1 @@
{"name":"gensync","version":"1.0.0-beta.2","requiresBuild":false,"files":{"test/.babelrc":{"checkedAt":1794532117550,"integrity":"sha512-Aa74jGYs7q4vmhUxIWGZYIYawqVC40nBhcsgoImvq28Doak3F8ofgUTuKwubjhwgMV5JM0EEeV20WwjARE3RZA==","mode":420,"size":68},"LICENSE":{"checkedAt":1794532117550,"integrity":"sha512-Vv6TgzZR6rR39WJoWnTQ/ooJWeOAG81566KPwCZI71Ah4pbzgZhRUezOsduhqnwVtp90PRO+oNyC0OOu6nUxJw==","mode":420,"size":1075},"index.js.flow":{"checkedAt":1794532117550,"integrity":"sha512-X8msjX4BIND2UIdgkYLkZDIt6pMMYQ7VBK/NtFkPtGsUt+rFcutg2is0VztIA8tnfXtpTGnbJrRAEwM96vyjQw==","mode":420,"size":846},"index.js":{"checkedAt":1794532117550,"integrity":"sha512-v9EWBE803TVMninAviBwKQ/mSdf9DdLOThM6jh+2WsEaYp+BReew/YVUQJrG9qaaujEgeDaHtpCyEbBVRfagmA==","mode":420,"size":9627},"test/index.test.js":{"checkedAt":1794532117551,"integrity":"sha512-UKOLNhrpaDXk+Qk0BnaWxTNWuioO11uDQYoHEE+B6SdUrcTQz7263QlIg3CGCoFxfeNLm9PAqPZPdus5zrAerg==","mode":420,"size":11019},"package.json":{"checkedAt":1794532117551,"integrity":"sha512-AVDQ/yE01LkBkZYs5HiOZUKkOFdX2DCfr9kBKqV+xY6MglD7kInUfE/pkC31Svtjj2k8k54B/4GGmonaXR/66w==","mode":420,"size":906},"README.md":{"checkedAt":1794532117551,"integrity":"sha512-v4r+YK+hjpX5vz9R0SsRNPhV8fUxm9zdeUDwTrEw3T51QYZu/LQpzgW8sYRwqDeP+FK2ghKTFiUq+b4h8lOOnw==","mode":420,"size":5350}}}
@@ -0,0 +1,67 @@
{
"name": "@heroui/checkbox",
"version": "2.3.9",
"description": "Checkboxes allow users to select multiple items from a list of individual items, or to mark one individual item as selected.",
"keywords": [
"checkbox"
],
"author": "Junior Garcia <jrgarciadev@gmail.com>",
"homepage": "https://heroui.com",
"license": "MIT",
"main": "dist/index.js",
"sideEffects": false,
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/heroui-inc/heroui.git",
"directory": "packages/components/checkbox"
},
"bugs": {
"url": "https://github.com/heroui-inc/heroui/issues"
},
"peerDependencies": {
"@heroui/system": ">=2.4.0",
"@heroui/theme": ">=2.4.3",
"react": ">=18 || >=19.0.0-rc.0",
"react-dom": ">=18 || >=19.0.0-rc.0"
},
"dependencies": {
"@react-aria/checkbox": "3.15.0",
"@react-aria/focus": "3.19.0",
"@react-aria/interactions": "3.22.5",
"@react-aria/utils": "3.26.0",
"@react-aria/visually-hidden": "3.8.18",
"@react-stately/checkbox": "3.6.10",
"@react-stately/toggle": "3.8.0",
"@react-types/checkbox": "3.9.0",
"@react-types/shared": "3.26.0",
"@heroui/form": "2.1.9",
"@heroui/react-utils": "2.1.4",
"@heroui/shared-utils": "2.1.3",
"@heroui/use-callback-ref": "2.1.2",
"@heroui/use-safe-layout-effect": "2.1.2"
},
"clean-package": "../../../clean-package.config.json",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsup src --dts",
"dev": "pnpm build:fast --watch",
"clean": "rimraf dist .turbo",
"typecheck": "tsc --noEmit",
"build:fast": "tsup src"
}
}
@@ -0,0 +1,86 @@
import { isScalar, SCALAR } from '../nodes/identity.js';
import { Scalar } from '../nodes/Scalar.js';
import { resolveBlockScalar } from './resolve-block-scalar.js';
import { resolveFlowScalar } from './resolve-flow-scalar.js';
function composeScalar(ctx, token, tagToken, onError) {
const { value, type, comment, range } = token.type === 'block-scalar'
? resolveBlockScalar(ctx, token, onError)
: resolveFlowScalar(token, ctx.options.strict, onError);
const tagName = tagToken
? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
: null;
let tag;
if (ctx.options.stringKeys && ctx.atKey) {
tag = ctx.schema[SCALAR];
}
else if (tagName)
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
else if (token.type === 'scalar')
tag = findScalarTagByTest(ctx, value, token, onError);
else
tag = ctx.schema[SCALAR];
let scalar;
try {
const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
scalar = isScalar(res) ? res : new Scalar(res);
}
catch (error) {
const msg = error instanceof Error ? error.message : String(error);
onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);
scalar = new Scalar(value);
}
scalar.range = range;
scalar.source = value;
if (type)
scalar.type = type;
if (tagName)
scalar.tag = tagName;
if (tag.format)
scalar.format = tag.format;
if (comment)
scalar.comment = comment;
return scalar;
}
function findScalarTagByName(schema, value, tagName, tagToken, onError) {
if (tagName === '!')
return schema[SCALAR]; // non-specific tag
const matchWithTest = [];
for (const tag of schema.tags) {
if (!tag.collection && tag.tag === tagName) {
if (tag.default && tag.test)
matchWithTest.push(tag);
else
return tag;
}
}
for (const tag of matchWithTest)
if (tag.test?.test(value))
return tag;
const kt = schema.knownTags[tagName];
if (kt && !kt.collection) {
// Ensure that the known tag is available for stringifying,
// but does not get used by default.
schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
return kt;
}
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
return schema[SCALAR];
}
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
tag.test?.test(value)) || schema[SCALAR];
if (schema.compat) {
const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
schema[SCALAR];
if (tag.tag !== compat.tag) {
const ts = directives.tagString(tag.tag);
const cs = directives.tagString(compat.tag);
const msg = `Value may be parsed as either ${ts} or ${cs}`;
onError(token, 'TAG_RESOLVE_FAILED', msg, true);
}
}
return tag;
}
export { composeScalar };
@@ -0,0 +1,6 @@
module.exports = {
"breadcrumbs": `Lingiread`
};
//# sourceMappingURL=et-EE.main.js.map
@@ -0,0 +1,113 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// SEE https://typescript-eslint.io/users/configs
//
// For developers working in the typescript-eslint monorepo:
// You can regenerate it using `yarn generate-configs`
module.exports = {
extends: ['./configs/eslintrc/base', './configs/eslintrc/eslint-recommended'],
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': [
'error',
{ minimumDescriptionLength: 10 },
],
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-array-delete': 'error',
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/no-confusing-void-expression': 'error',
'@typescript-eslint/no-deprecated': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-duplicate-type-constituents': 'error',
'@typescript-eslint/no-dynamic-delete': 'error',
'@typescript-eslint/no-empty-object-type': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'no-implied-eval': 'off',
'@typescript-eslint/no-implied-eval': 'error',
'@typescript-eslint/no-invalid-void-type': 'error',
'@typescript-eslint/no-meaningless-void-operator': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-misused-spread': 'error',
'@typescript-eslint/no-mixed-enums': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-template-expression': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unnecessary-type-conversion': 'error',
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
'@typescript-eslint/no-unsafe-argument': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
'@typescript-eslint/no-unsafe-function-type': 'error',
'@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/no-unsafe-unary-minus': 'error',
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-wrapper-object-types': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-literal-enum-member': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'prefer-promise-reject-errors': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'error',
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
'@typescript-eslint/prefer-return-this-type': 'error',
'@typescript-eslint/related-getter-setter-pairs': 'error',
'require-await': 'off',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/restrict-plus-operands': [
'error',
{
allowAny: false,
allowBoolean: false,
allowNullish: false,
allowNumberAndString: false,
allowRegExp: false,
},
],
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowAny: false,
allowBoolean: false,
allowNever: false,
allowNullish: false,
allowNumber: false,
allowRegExp: false,
},
],
'no-return-await': 'off',
'@typescript-eslint/return-await': [
'error',
'error-handling-correctness-only',
],
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/unbound-method': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
},
};
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var noneRole = {
abstract: false,
accessibleNameRequired: false,
baseConcepts: [],
childrenPresentational: false,
nameFrom: [],
prohibitedProps: [],
props: {},
relatedConcepts: [],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {},
superClass: []
};
var _default = exports.default = noneRole;
@@ -0,0 +1 @@
{"version":3,"file":"isNotParentBindingConstraintsWithServiceId.js","sourceRoot":"","sources":["../../../../src/binding/calculations/isNotParentBindingConstraintsWithServiceId.ts"],"names":[],"mappings":";;AAMA,gGAMC;AATD,2FAAwF;AACxF,mFAAgF;AAEhF,SAAgB,0CAA0C,CACxD,SAA4B;IAE5B,OAAO,IAAA,6DAA6B,EAClC,IAAA,qEAAiC,EAAC,SAAS,CAAC,CAC7C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmpty = exports.isString = void 0;
function isString(input) {
return typeof input === 'string';
}
exports.isString = isString;
function isEmpty(input) {
return input === '';
}
exports.isEmpty = isEmpty;
@@ -0,0 +1,95 @@
import type { Action, Middleware, UnknownAction } from 'redux'
import type { ThunkDispatch } from 'redux-thunk'
import { configureStore } from '../../configureStore'
import { createDynamicMiddleware } from '../index'
const untypedInstance = createDynamicMiddleware()
interface AppDispatch extends ThunkDispatch<number, undefined, UnknownAction> {
(n: 1): 1
}
const typedInstance = createDynamicMiddleware<number, AppDispatch>()
declare const staticMiddleware: Middleware<(n: 1) => 1>
const store = configureStore({
reducer: () => 0,
middleware: (gDM) =>
gDM().prepend(typedInstance.middleware).concat(staticMiddleware),
})
declare const compatibleMiddleware: Middleware<{}, number, AppDispatch>
declare const incompatibleMiddleware: Middleware<{}, string, AppDispatch>
declare const addedMiddleware: Middleware<(n: 2) => 2>
describe('type tests', () => {
test('instance typed at creation ensures middleware compatibility with store', () => {
const store = configureStore({
reducer: () => '',
// @ts-expect-error
middleware: (gDM) => gDM().prepend(typedInstance.middleware),
})
})
test('instance typed at creation enforces correct middleware type', () => {
typedInstance.addMiddleware(
compatibleMiddleware,
// @ts-expect-error
incompatibleMiddleware,
)
const dispatch = store.dispatch(
typedInstance.withMiddleware(
compatibleMiddleware,
// @ts-expect-error
incompatibleMiddleware,
),
)
})
test('withTypes() enforces correct middleware type', () => {
const addMiddleware = untypedInstance.addMiddleware.withTypes<{
state: number
dispatch: AppDispatch
}>()
addMiddleware(
compatibleMiddleware,
// @ts-expect-error
incompatibleMiddleware,
)
const withMiddleware = untypedInstance.withMiddleware.withTypes<{
state: number
dispatch: AppDispatch
}>()
const dispatch = store.dispatch(
withMiddleware(
compatibleMiddleware,
// @ts-expect-error
incompatibleMiddleware,
),
)
})
test('withMiddleware returns typed dispatch, with any applicable extensions', () => {
const dispatch = store.dispatch(
typedInstance.withMiddleware(addedMiddleware),
)
// standard
expectTypeOf(dispatch({ type: 'foo' })).toEqualTypeOf<Action<string>>()
// thunk
expectTypeOf(dispatch(() => 'foo')).toBeString()
// static
expectTypeOf(dispatch(1)).toEqualTypeOf<1>()
// added
expectTypeOf(dispatch(2)).toEqualTypeOf<2>()
})
})
@@ -0,0 +1,35 @@
{
"name": "is-lambda",
"version": "1.0.1",
"description": "Detect if your code is running on an AWS Lambda server",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"clear-require": "^1.0.1",
"standard": "^10.0.2"
},
"scripts": {
"test": "standard && node test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/watson/is-lambda.git"
},
"keywords": [
"aws",
"hosting",
"hosted",
"lambda",
"detect"
],
"author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
"license": "MIT",
"bugs": {
"url": "https://github.com/watson/is-lambda/issues"
},
"homepage": "https://github.com/watson/is-lambda",
"coordinates": [
37.3859955,
-122.0838831
]
}
@@ -0,0 +1,12 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es2017_object = void 0;
const base_config_1 = require("./base-config");
exports.es2017_object = {
libs: [],
variables: [['ObjectConstructor', base_config_1.TYPE]],
};
@@ -0,0 +1,66 @@
var fs = require('fs')
var os = require('os')
var path = require('path')
var crypto = require('crypto')
var mkdirp = require('mkdirp')
function getFilename (req, file, cb) {
crypto.randomBytes(16, function (err, raw) {
cb(err, err ? undefined : raw.toString('hex'))
})
}
function getDestination (req, file, cb) {
cb(null, os.tmpdir())
}
function DiskStorage (opts) {
this.getFilename = (opts.filename || getFilename)
if (typeof opts.destination === 'string') {
mkdirp.sync(opts.destination)
this.getDestination = function ($0, $1, cb) { cb(null, opts.destination) }
} else {
this.getDestination = (opts.destination || getDestination)
}
}
DiskStorage.prototype._handleFile = function _handleFile (req, file, cb) {
var that = this
that.getDestination(req, file, function (err, destination) {
if (err) return cb(err)
that.getFilename(req, file, function (err, filename) {
if (err) return cb(err)
var finalPath = path.join(destination, filename)
var outStream = fs.createWriteStream(finalPath)
file.stream.pipe(outStream)
outStream.on('error', cb)
outStream.on('finish', function () {
cb(null, {
destination: destination,
filename: filename,
path: finalPath,
size: outStream.bytesWritten
})
})
})
})
}
DiskStorage.prototype._removeFile = function _removeFile (req, file, cb) {
var path = file.path
delete file.destination
delete file.filename
delete file.path
fs.unlink(path, cb)
}
module.exports = function (opts) {
return new DiskStorage(opts)
}
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["src/get-innermost-scope.mjs","src/find-variable.mjs","src/token-predicate.mjs","src/get-function-head-location.mjs","src/get-static-value.mjs","src/get-string-if-constant.mjs","src/get-property-name.mjs","src/get-function-name-with-kind.mjs","src/has-side-effect.mjs","src/is-parenthesized.mjs","src/pattern-matcher.mjs","src/reference-tracker.mjs","src/index.mjs"],"sourcesContent":["/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"estree\").Node} Node */\n\n/**\n * Get the innermost scope which contains a given location.\n * @param {Scope} initialScope The initial scope to search.\n * @param {Node} node The location to search.\n * @returns {Scope} The innermost scope.\n */\nexport function getInnermostScope(initialScope, node) {\n const location = /** @type {[number, number]} */ (node.range)[0]\n\n let scope = initialScope\n let found = false\n do {\n found = false\n for (const childScope of scope.childScopes) {\n const range = /** @type {[number, number]} */ (\n childScope.block.range\n )\n\n if (range[0] <= location && location < range[1]) {\n scope = childScope\n found = true\n break\n }\n }\n } while (found)\n\n return scope\n}\n","import { getInnermostScope } from \"./get-innermost-scope.mjs\"\n/** @typedef {import(\"eslint\").Scope.Scope} Scope */\n/** @typedef {import(\"eslint\").Scope.Variable} Variable */\n/** @typedef {import(\"estree\").Identifier} Identifier */\n\n/**\n * Find the variable of a given name.\n * @param {Scope} initialScope The scope to start finding.\n * @param {string|Identifier} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node.\n * @returns {Variable|null} The found variable or null.\n */\nexport function findVariable(initialScope, nameOrNode) {\n let name = \"\"\n /** @type {Scope|null} */\n let scope = initialScope\n\n if (typeof nameOrNode === \"string\") {\n name = nameOrNode\n } else {\n name = nameOrNode.name\n scope = getInnermostScope(scope, nameOrNode)\n }\n\n while (scope != null) {\n const variable = scope.set.get(name)\n if (variable != null) {\n return variable\n }\n scope = scope.upper\n }\n\n return null\n}\n","/** @typedef {import(\"eslint\").AST.Token} Token */\n/** @typedef {import(\"estree\").Comment} Comment */\n/** @typedef {import(\"./types.mjs\").ArrowToken} ArrowToken */\n/** @typedef {import(\"./types.mjs\").CommaToken} CommaToken */\n/** @typedef {import(\"./types.mjs\").SemicolonToken} SemicolonToken */\n/** @typedef {import(\"./types.mjs\").ColonToken} ColonToken */\n/** @typedef {import(\"./types.mjs\").OpeningParenToken} OpeningParenToken */\n/** @typedef {import(\"./types.mjs\").ClosingParenToken} ClosingParenToken */\n/** @typedef {import(\"./types.mjs\").OpeningBracketToken} OpeningBracketToken */\n/** @typedef {import(\"./types.mjs\").ClosingBracketToken} ClosingBracketToken */\n/** @typedef {import(\"./types.mjs\").OpeningBraceToken} OpeningBraceToken */\n/** @typedef {import(\"./types.mjs\").ClosingBraceToken} ClosingBraceToken */\n/**\n * @template {string} Value\n * @typedef {import(\"./types.mjs\").PunctuatorToken<Value>} PunctuatorToken\n */\n\n/** @typedef {Comment | Token} CommentOrToken */\n\n/**\n * Creates the negate function of the given function.\n * @param {function(CommentOrToken):boolean} f - The function to negate.\n * @returns {function(CommentOrToken):boolean} Negated function.\n */\nfunction negate(f) {\n return (token) => !f(token)\n}\n\n/**\n * Checks if the given token is a PunctuatorToken with the given value\n * @template {string} Value\n * @param {CommentOrToken} token - The token to check.\n * @param {Value} value - The value to check.\n * @returns {token is PunctuatorToken<Value>} `true` if the token is a PunctuatorToken with the given value.\n */\nfunction isPunctuatorTokenWithValue(token, value) {\n return token.type === \"Punctuator\" && token.value === value\n}\n\n/**\n * Checks if the given token is an arrow token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is ArrowToken} `true` if the token is an arrow token.\n */\nexport function isArrowToken(token) {\n return isPunctuatorTokenWithValue(token, \"=>\")\n}\n\n/**\n * Checks if the given token is a comma token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is CommaToken} `true` if the token is a comma token.\n */\nexport function isCommaToken(token) {\n return isPunctuatorTokenWithValue(token, \",\")\n}\n\n/**\n * Checks if the given token is a semicolon token or not.\n * @param {CommentOrToken} token - The token to check.\n * @returns {token is SemicolonToken} `true` if the token is a semicolon token.\n */\nexport function isSeLine truncated
@@ -0,0 +1 @@
module.exports={C:{"3":0.00409,"4":0.00817,"34":0.00409,"52":0.00817,"78":0.00409,"99":0.01226,"112":0.00409,"115":0.11032,"120":0.00817,"128":0.00817,"133":0.00409,"135":0.00409,"136":0.00409,"138":0.00817,"139":0.00409,"140":0.03269,"141":0.00817,"142":0.02452,"143":0.56387,"144":0.47806,"145":0.00409,_:"2 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 100 101 102 103 104 105 106 107 108 109 110 111 113 114 116 117 118 119 121 122 123 124 125 126 127 129 130 131 132 134 137 146 147 3.5 3.6"},D:{"39":0.00817,"40":0.00817,"41":0.00817,"42":0.00817,"43":0.00817,"44":0.00817,"45":0.00817,"46":0.00817,"47":0.00817,"48":0.00817,"49":0.01226,"50":0.00817,"51":0.00817,"52":0.01226,"53":0.00817,"54":0.00817,"55":0.00817,"56":0.00817,"57":0.00817,"58":0.00817,"59":0.00817,"60":0.00817,"76":0.01226,"79":0.01226,"80":0.00409,"85":0.00409,"86":0.00409,"87":0.0286,"88":0.00409,"91":0.00409,"93":0.00409,"97":0.00409,"99":0.00409,"102":0.00409,"103":0.05312,"104":0.01226,"105":0.00409,"106":0.00409,"107":0.00409,"108":0.01226,"109":0.74365,"110":0.00409,"111":0.04495,"112":3.04407,"114":0.06538,"115":0.00409,"116":0.09398,"118":0.00409,"119":0.00817,"120":0.01634,"121":0.01226,"122":0.08581,"123":0.02043,"124":0.0286,"125":3.73052,"126":0.23699,"127":0.03677,"128":0.12667,"129":0.04495,"130":0.04086,"131":0.07763,"132":0.0572,"133":0.03269,"134":0.04495,"135":0.06538,"136":0.13484,"137":0.07763,"138":0.24925,"139":0.36365,"140":4.69073,"141":12.45413,"142":0.18387,"143":0.00409,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 77 78 81 83 84 89 90 92 94 95 96 98 100 101 113 117 144 145"},F:{"91":0.00409,"92":0.01226,"95":0.02452,"114":0.00409,"120":0.08172,"121":0.11849,"122":0.87849,_:"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.00409,"92":0.00817,"99":0.00409,"109":0.03269,"114":0.04086,"121":0.00409,"122":0.00409,"126":0.00409,"128":0.00409,"129":0.00409,"130":0.00409,"131":0.01226,"132":0.00409,"133":0.00817,"134":0.1471,"135":0.00817,"136":0.00817,"137":0.01226,"138":0.03677,"139":0.04495,"140":0.89483,"141":3.9389,"142":0.00817,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 100 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 118 119 120 123 124 125 127"},E:{"4":0.00409,"14":0.00409,_:"0 5 6 7 8 9 10 11 12 13 15 3.1 3.2 6.1 7.1 9.1 10.1 11.1 15.1 26.2","5.1":0.00409,"12.1":0.00409,"13.1":0.01226,"14.1":0.01226,"15.2-15.3":0.00409,"15.4":0.00817,"15.5":0.00409,"15.6":0.05312,"16.0":0.00409,"16.1":0.00817,"16.2":0.00409,"16.3":0.00817,"16.4":0.00409,"16.5":0.00817,"16.6":0.06538,"17.0":0.00409,"17.1":0.04086,"17.2":0.01634,"17.3":0.01226,"17.4":0.01634,"17.5":0.02043,"17.6":0.10215,"18.0":0.00817,"18.1":0.02452,"18.2":0.00817,"18.3":0.0286,"18.4":0.01634,"18.5-18.6":0.08989,"26.0":0.29828,"26.1":0.01226},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00096,"5.0-5.1":0,"6.0-6.1":0.00384,"7.0-7.1":0.00288,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00863,"10.0-10.2":0.00096,"10.3":0.01631,"11.0-11.2":0.24173,"11.3-11.4":0.00576,"12.0-12.1":0.00192,"12.2-12.5":0.047,"13.0-13.1":0,"13.2":0.0048,"13.3":0.00192,"13.4-13.7":0.00767,"14.0-14.4":0.01631,"14.5-14.8":0.01727,"15.0-15.1":0.01631,"15.2-15.3":0.01247,"15.4":0.01439,"15.5":0.01631,"15.6-15.8":0.21295,"16.0":0.02878,"16.1":0.05372,"16.2":0.02782,"16.3":0.04988,"16.4":0.01247,"16.5":0.02206,"16.6-16.7":0.2849,"17.0":0.02014,"17.1":0.0307,"17.2":0.02206,"17.3":0.03261,"17.4":0.05756,"17.5":0.0988,"17.6-17.7":0.24941,"18.0":0.0566,"18.1":0.11703,"18.2":0.06331,"18.3":0.20336,"18.4":0.10456,"18.5-18.6":5.33152,"26.0":0.65901,"26.1":0.02398},P:{"4":0.0218,"23":0.0109,"24":0.0109,"26":0.0109,"27":0.0109,"28":0.43601,"29":0.0327,_:"20 21 22 25 5.0-5.4 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","7.2-7.4":0.0218},I:{"0":0.1004,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00002,"4.4":0,"4.4.3-4.4.4":0.00005},K:{"0":0.11237,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.01506,"10":0.00502,"11":0.15562,_:"6 7 9 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.17151},Q:{_:"14.9"},O:{"0":0.01183},H:{"0":0},L:{"0":51.67155}};
@@ -0,0 +1,111 @@
/**
* @import {Node, Parent} from 'unist'
*/
/**
* @template Fn
* @template Fallback
* @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate
*/
/**
* @callback Check
* Check that an arbitrary value is a node.
* @param {unknown} this
* The given context.
* @param {unknown} [node]
* Anything (typically a node).
* @param {number | null | undefined} [index]
* The node’s position in its parent.
* @param {Parent | null | undefined} [parent]
* The node’s parent.
* @returns {boolean}
* Whether this is a node and passes a test.
*
* @typedef {Record<string, unknown> | Node} Props
* Object to check for equivalence.
*
* Note: `Node` is included as it is common but is not indexable.
*
* @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test
* Check for an arbitrary node.
*
* @callback TestFunction
* Check if a node passes a test.
* @param {unknown} this
* The given context.
* @param {Node} node
* A node.
* @param {number | undefined} [index]
* The node’s position in its parent.
* @param {Parent | undefined} [parent]
* The node’s parent.
* @returns {boolean | undefined | void}
* Whether this node passes the test.
*
* Note: `void` is included until TS sees no return as `undefined`.
*/
/**
* Check if `node` is a `Node` and whether it passes the given test.
*
* @param {unknown} node
* Thing to check, typically `Node`.
* @param {Test} test
* A check for a specific node.
* @param {number | null | undefined} index
* The node’s position in its parent.
* @param {Parent | null | undefined} parent
* The node’s parent.
* @param {unknown} context
* Context object (`this`) to pass to `test` functions.
* @returns {boolean}
* Whether `node` is a node and passes a test.
*/
export const is: ((<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
type: Condition[number];
}) & (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
type: Condition[number];
}) & (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
type: Condition;
}) & (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) & (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) & ((node?: null | undefined) => false) & ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) & ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean));
/**
* Generate an assertion from a test.
*
* Useful if you’re going to test many nodes, for example when creating a
* utility where something else passes a compatible test.
*
* The created function is a bit faster because it expects valid input only:
* a `node`, `index`, and `parent`.
*
* @param {Test} test
* * when nullish, checks if `node` is a `Node`.
* * when `string`, works like passing `(node) => node.type === test`.
* * when `function` checks if function passed the node is true.
* * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
* * when `array`, checks if any one of the subtests pass.
* @returns {Check}
* An assertion.
*/
export const convert: ((<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {
type: Condition;
}) & (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) & (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) & ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) & ((test?: Test) => Check));
export type Predicate<Fn, Fallback> = Fn extends (value: any) => value is infer Thing ? Thing : Fallback;
/**
* Check that an arbitrary value is a node.
*/
export type Check = (this: unknown, node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined) => boolean;
/**
* Object to check for equivalence.
*
* Note: `Node` is included as it is common but is not indexable.
*/
export type Props = Record<string, unknown> | Node;
/**
* Check for an arbitrary node.
*/
export type Test = Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined;
/**
* Check if a node passes a test.
*/
export type TestFunction = (this: unknown, node: Node, index?: number | undefined, parent?: Parent | undefined) => boolean | undefined | void;
import type { Parent } from 'unist';
import type { Node } from 'unist';
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Either.js","sourceRoot":"","sources":["../../../../src/either/models/Either.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
import { __extends, __read, __spread } from "tslib";
import { getParamInfo } from "../reflection-helpers";
import { instance as globalContainer } from "../dependency-container";
import { isTokenDescriptor, isTransformDescriptor } from "../providers/injection-token";
import { formatErrorCtor } from "../error-helpers";
function autoInjectable() {
return function (target) {
var paramInfo = getParamInfo(target);
return (function (_super) {
__extends(class_1, _super);
function class_1() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return _super.apply(this, __spread(args.concat(paramInfo.slice(args.length).map(function (type, index) {
var _a, _b, _c;
try {
if (isTokenDescriptor(type)) {
if (isTransformDescriptor(type)) {
return type.multiple
? (_a = globalContainer
.resolve(type.transform)).transform.apply(_a, __spread([globalContainer.resolveAll(type.token)], type.transformArgs)) : (_b = globalContainer
.resolve(type.transform)).transform.apply(_b, __spread([globalContainer.resolve(type.token)], type.transformArgs));
}
else {
return type.multiple
? globalContainer.resolveAll(type.token)
: globalContainer.resolve(type.token);
}
}
else if (isTransformDescriptor(type)) {
return (_c = globalContainer
.resolve(type.transform)).transform.apply(_c, __spread([globalContainer.resolve(type.token)], type.transformArgs));
}
return globalContainer.resolve(type);
}
catch (e) {
var argIndex = index + args.length;
throw new Error(formatErrorCtor(target, argIndex, e));
}
})))) || this;
}
return class_1;
}(target));
};
}
export default autoInjectable;
@@ -0,0 +1,35 @@
import { __read, __spreadArray } from "tslib";
import throttle from 'lodash/throttle';
import { useMemo } from 'react';
import useLatest from '../useLatest';
import useUnmount from '../useUnmount';
import { isFunction } from '../utils';
import isDev from '../utils/isDev';
function useThrottleFn(fn, options) {
var _a;
if (isDev) {
if (!isFunction(fn)) {
console.error("useThrottleFn expected parameter is a function, got ".concat(typeof fn));
}
}
var fnRef = useLatest(fn);
var wait = (_a = options === null || options === void 0 ? void 0 : options.wait) !== null && _a !== void 0 ? _a : 1000;
var throttled = useMemo(function () {
return throttle(function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return fnRef.current.apply(fnRef, __spreadArray([], __read(args), false));
}, wait, options);
}, []);
useUnmount(function () {
throttled.cancel();
});
return {
run: throttled,
cancel: throttled.cancel,
flush: throttled.flush,
};
}
export default useThrottleFn;
@@ -0,0 +1,7 @@
import Cookies from 'js-cookie';
export type State = string | undefined;
export interface Options extends Cookies.CookieAttributes {
defaultValue?: State | (() => State);
}
declare function useCookieState(cookieKey: string, options?: Options): readonly [State, (this: unknown, newValue: State | ((prevState: State) => State), newOptions?: Cookies.CookieAttributes | undefined) => void];
export default useCookieState;
@@ -0,0 +1,63 @@
declare const _default: {
extends: string[];
rules: {
'@typescript-eslint/await-thenable': "error";
'@typescript-eslint/no-array-delete': "error";
'@typescript-eslint/no-base-to-string': "error";
'@typescript-eslint/no-confusing-void-expression': "error";
'@typescript-eslint/no-deprecated': "error";
'@typescript-eslint/no-duplicate-type-constituents': "error";
'@typescript-eslint/no-floating-promises': "error";
'@typescript-eslint/no-for-in-array': "error";
'no-implied-eval': "off";
'@typescript-eslint/no-implied-eval': "error";
'@typescript-eslint/no-meaningless-void-operator': "error";
'@typescript-eslint/no-misused-promises': "error";
'@typescript-eslint/no-misused-spread': "error";
'@typescript-eslint/no-mixed-enums': "error";
'@typescript-eslint/no-redundant-type-constituents': "error";
'@typescript-eslint/no-unnecessary-boolean-literal-compare': "error";
'@typescript-eslint/no-unnecessary-condition': "error";
'@typescript-eslint/no-unnecessary-template-expression': "error";
'@typescript-eslint/no-unnecessary-type-arguments': "error";
'@typescript-eslint/no-unnecessary-type-assertion': "error";
'@typescript-eslint/no-unnecessary-type-conversion': "error";
'@typescript-eslint/no-unnecessary-type-parameters': "error";
'@typescript-eslint/no-unsafe-argument': "error";
'@typescript-eslint/no-unsafe-assignment': "error";
'@typescript-eslint/no-unsafe-call': "error";
'@typescript-eslint/no-unsafe-enum-comparison': "error";
'@typescript-eslint/no-unsafe-member-access': "error";
'@typescript-eslint/no-unsafe-return': "error";
'@typescript-eslint/no-unsafe-unary-minus': "error";
'no-throw-literal': "off";
'@typescript-eslint/only-throw-error': "error";
'prefer-promise-reject-errors': "off";
'@typescript-eslint/prefer-promise-reject-errors': "error";
'@typescript-eslint/prefer-reduce-type-parameter': "error";
'@typescript-eslint/prefer-return-this-type': "error";
'@typescript-eslint/related-getter-setter-pairs': "error";
'require-await': "off";
'@typescript-eslint/require-await': "error";
'@typescript-eslint/restrict-plus-operands': ["error", {
allowAny: boolean;
allowBoolean: boolean;
allowNullish: boolean;
allowNumberAndString: boolean;
allowRegExp: boolean;
}];
'@typescript-eslint/restrict-template-expressions': ["error", {
allowAny: boolean;
allowBoolean: boolean;
allowNever: boolean;
allowNullish: boolean;
allowNumber: boolean;
allowRegExp: boolean;
}];
'no-return-await': "off";
'@typescript-eslint/return-await': ["error", string];
'@typescript-eslint/unbound-method': "error";
'@typescript-eslint/use-unknown-in-catch-callback-variable': "error";
};
};
export = _default;
@@ -0,0 +1 @@
{"version":3,"file":"issue_1416.test.js","sourceRoot":"","sources":["../../../../src/test/bugs/issue_1416.test.ts"],"names":[],"mappings":";;;AAAA,mCAA4D;AAE5D,6BAA0D;AAE1D,IAAA,iBAAQ,EAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,IAAA,WAAE,EAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAE1E,IAAM,KAAK,GAAX,MAAM,KAAK;YACF,aAAa,GAAqB,eAAM,CAAC,EAAE,EAAE,CAAC;YAG9C,OAAO;gBACZ,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,CAAC;SACF,CAAA;QAHQ;YADN,IAAA,cAAU,GAAE;;;;4CAGZ;QANG,KAAK;YADV,IAAA,cAAU,GAAE;WACP,KAAK,CAOV;QAGD,IAAM,KAAK,GAAX,MAAM,KAAK;YACF,OAAO,KAAU,CAAC;SAC1B,CAAA;QAFK,KAAK;YADV,IAAA,cAAU,GAAE;WACP,KAAK,CAEV;QAGD,IAAM,KAAK,GAAX,MAAM,KAAK;YACF,OAAO,KAAU,CAAC;SAC1B,CAAA;QAFK,KAAK;YADV,IAAA,cAAU,GAAE;WACP,KAAK,CAEV;QAED,MAAM,SAAS,GAAc,IAAI,aAAS,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC;QAE1E,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QAC/B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAEvC,MAAM,KAAK,GAAU,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1C,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAErB,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;YACvB,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;YACvB,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;SACxB,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,KAAK,CAAC,aAAa,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,73 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/spinner.tsx
var spinner_exports = {};
__export(spinner_exports, {
default: () => spinner_default
});
module.exports = __toCommonJS(spinner_exports);
var import_system_rsc2 = require("@heroui/system-rsc");
// src/use-spinner.ts
var import_system_rsc = require("@heroui/system-rsc");
var import_theme = require("@heroui/theme");
var import_shared_utils = require("@heroui/shared-utils");
var import_react = require("react");
function useSpinner(originalProps) {
const [props, variantProps] = (0, import_system_rsc.mapPropsVariants)(originalProps, import_theme.spinner.variantKeys);
const { children, className, classNames, label: labelProp, ...otherProps } = props;
const slots = (0, import_react.useMemo)(() => (0, import_theme.spinner)({ ...variantProps }), [(0, import_shared_utils.objectToDeps)(variantProps)]);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const label = labelProp || children;
const ariaLabel = (0, import_react.useMemo)(() => {
if (label && typeof label === "string") {
return label;
}
return !otherProps["aria-label"] ? "Loading" : "";
}, [children, label, otherProps["aria-label"]]);
const getSpinnerProps = (0, import_react.useCallback)(
() => ({
"aria-label": ariaLabel,
className: slots.base({
class: baseStyles
}),
...otherProps
}),
[ariaLabel, slots, baseStyles, otherProps]
);
return { label, slots, classNames, getSpinnerProps };
}
// src/spinner.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var Spinner = (0, import_system_rsc2.forwardRef)((props, ref) => {
const { slots, classNames, label, getSpinnerProps } = useSpinner({ ...props });
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref, ...getSpinnerProps(), children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: slots.circle1({ class: classNames == null ? void 0 : classNames.circle1 }) }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: slots.circle2({ class: classNames == null ? void 0 : classNames.circle2 }) })
] }),
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label })
] });
});
Spinner.displayName = "HeroUI.Spinner";
var spinner_default = Spinner;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
@@ -0,0 +1,530 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.analyzeChain = analyzeChain;
const utils_1 = require("@typescript-eslint/utils");
const ts_api_utils_1 = require("ts-api-utils");
const ts = __importStar(require("typescript"));
const util_1 = require("../../util");
const checkNullishAndReport_1 = require("./checkNullishAndReport");
const compareNodes_1 = require("./compareNodes");
const gatherLogicalOperands_1 = require("./gatherLogicalOperands");
function includesType(parserServices, node, typeFlagIn) {
const typeFlag = typeFlagIn | ts.TypeFlags.Any | ts.TypeFlags.Unknown;
const types = (0, ts_api_utils_1.unionConstituents)(parserServices.getTypeAtLocation(node));
for (const type of types) {
if ((0, util_1.isTypeFlagSet)(type, typeFlag)) {
return true;
}
}
return false;
}
function isValidAndLastChainOperand(ComparisonValueType, comparisonType, parserServices) {
const type = parserServices.getTypeAtLocation(ComparisonValueType);
const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
const types = (0, ts_api_utils_1.unionConstituents)(type);
switch (comparisonType) {
case gatherLogicalOperands_1.ComparisonType.Equal: {
const isNullish = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined));
return !isNullish;
}
case gatherLogicalOperands_1.ComparisonType.StrictEqual: {
const isUndefined = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined));
return !isUndefined;
}
case gatherLogicalOperands_1.ComparisonType.NotStrictEqual: {
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined));
}
case gatherLogicalOperands_1.ComparisonType.NotEqual: {
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined | ts.TypeFlags.Null));
}
}
}
function isValidOrLastChainOperand(ComparisonValueType, comparisonType, parserServices) {
const type = parserServices.getTypeAtLocation(ComparisonValueType);
const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
const types = (0, ts_api_utils_1.unionConstituents)(type);
switch (comparisonType) {
case gatherLogicalOperands_1.ComparisonType.NotEqual: {
const isNullish = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined));
return !isNullish;
}
case gatherLogicalOperands_1.ComparisonType.NotStrictEqual: {
const isUndefined = types.some(t => (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined));
return !isUndefined;
}
case gatherLogicalOperands_1.ComparisonType.Equal:
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined | ts.TypeFlags.Null));
case gatherLogicalOperands_1.ComparisonType.StrictEqual:
return types.every(t => (0, util_1.isTypeFlagSet)(t, ts.TypeFlags.Undefined));
}
}
const analyzeAndChainOperand = (parserServices, operand, index, chain) => {
switch (operand.comparisonType) {
case gatherLogicalOperands_1.NullishComparisonType.Boolean:
case gatherLogicalOperands_1.NullishComparisonType.NotEqualNullOrUndefined:
return [operand];
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualNull: {
// handle `x !== null && x !== undefined`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (nextOperand &&
!includesType(parserServices, operand.comparedName, ts.TypeFlags.Undefined)) {
// we know the next operand is not an `undefined` check and that this
// operand includes `undefined` - which means that making this an
// optional chain would change the runtime behavior of the expression
return [operand];
}
return null;
}
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined: {
// handle `x !== undefined && x !== null`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualNull &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (includesType(parserServices, operand.comparedName, ts.TypeFlags.Null)) {
// we know the next operand is not a `null` check and that this
// operand includes `null` - which means that making this an
// optional chain would change the runtime behavior of the expression
return null;
}
return [operand];
}
default:
return null;
}
};
const analyzeOrChainOperand = (parserServices, operand, index, chain) => {
switch (operand.comparisonType) {
case gatherLogicalOperands_1.NullishComparisonType.NotBoolean:
case gatherLogicalOperands_1.NullishComparisonType.EqualNullOrUndefined:
return [operand];
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualNull: {
// handle `x === null || x === undefined`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (includesType(parserServices, operand.comparedName, ts.TypeFlags.Undefined)) {
// we know the next operand is not an `undefined` check and that this
// operand includes `undefined` - which means that making this an
// optional chain would change the runtime behavior of the expression
return null;
}
return [operand];
}
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined: {
// handle `x === undefined || x === null`
const nextOperand = chain.at(index + 1);
if (nextOperand?.comparisonType === gatherLogicalOperands_1.NullishComparisonType.StrictEqualNull &&
(0, compareNodes_1.compareNodes)(operand.comparedName, nextOperand.comparedName) ===
compareNodes_1.NodeComparisonResult.Equal) {
return [operand, nextOperand];
}
if (includesType(parserServices, operand.comparedName, ts.TypeFlags.Null)) {
// we know the next operand is not a `null` check and that this
// operand includes `null` - which means that making this an
// optional chain would change the runtime behavior of the expression
return null;
}
return [operand];
}
default:
return null;
}
};
/**
* Returns the range that needs to be reported from the chain.
* @param chain The chain of logical expressions.
* @param boundary The boundary range that the range to report cannot fall outside.
* @param sourceCode The source code to get tokens.
* @returns The range to report.
*/
function getReportRange(chain, boundary, sourceCode) {
const leftNode = chain[0].node;
const rightNode = chain[chain.length - 1].node;
let leftMost = (0, util_1.nullThrows)(sourceCode.getFirstToken(leftNode), util_1.NullThrowsReasons.MissingToken('any token', leftNode.type));
let rightMost = (0, util_1.nullThrows)(sourceCode.getLastToken(rightNode), util_1.NullThrowsReasons.MissingToken('any token', rightNode.type));
while (leftMost.range[0] > boundary[0]) {
const token = sourceCode.getTokenBefore(leftMost);
if (!token || !(0, util_1.isOpeningParenToken)(token) || token.range[0] < boundary[0]) {
break;
}
leftMost = token;
}
while (rightMost.range[1] < boundary[1]) {
const token = sourceCode.getTokenAfter(rightMost);
if (!token || !(0, util_1.isClosingParenToken)(token) || token.range[1] > boundary[1]) {
break;
}
rightMost = token;
}
return [leftMost.range[0], rightMost.range[1]];
}
function getReportDescriptor(sourceCode, parserServices, node, operator, options, subChain, lastChain) {
const chain = lastChain ? [...subChain, lastChain] : subChain;
const lastOperand = chain[chain.length - 1];
let useSuggestionFixer;
if (options.allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing ===
true) {
// user has opted-in to the unsafe behavior
useSuggestionFixer = false;
}
// optional chain specifically will union `undefined` into the final type
// so we need to make sure that there is at least one operand that includes
// `undefined`, or else we're going to change the final type - which is
// unsafe and might cause downstream type errors.
else if (lastChain ||
lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.EqualNullOrUndefined ||
lastOperand.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotEqualNullOrUndefined ||
lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined ||
lastOperand.comparisonType ===
gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined ||
(operator === '||' &&
lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.NotBoolean)) {
// we know the last operand is an equality check - so the change in types
// DOES NOT matter and will not change the runtime result or cause a type
// check error
useSuggestionFixer = false;
}
else {
useSuggestionFixer = true;
for (const operand of chain) {
if (includesType(parserServices, operand.node, ts.TypeFlags.Undefined)) {
useSuggestionFixer = false;
break;
}
}
// TODO - we could further reduce the false-positive rate of this check by
// checking for cases where the change in types don't matter like
// the test location of an if/while/etc statement.
// but it's quite complex to do this without false-negatives, so
// for now we'll just be over-eager with our matching.
//
// it's MUCH better to false-positive here and only provide a
// suggestion fixer, rather than false-negative and autofix to
// broken code.
}
// In its most naive form we could just slap `?.` for every single part of the
// chain. However this would be undesirable because it'd create unnecessary
// conditions in the user's code where there were none before - and it would
// cause errors with rules like our `no-unnecessary-condition`.
//
// Instead we want to include the minimum number of `?.` required to correctly
// unify the code into a single chain. Naively you might think that we can
// just take the final operand add `?.` after the locations from the previous
// operands - however this won't be correct either because earlier operands
// can include a necessary `?.` that's not needed or included in a later
// operand.
//
// So instead what we need to do is to start at the first operand and
// iteratively diff it against the next operand, and add the difference to the
// first operand.
//
// eg
// `foo && foo.bar && foo.bar.baz?.bam && foo.bar.baz.bam()`
// 1) `foo`
// 2) diff(`foo`, `foo.bar`) = `.bar`
// 3) result = `foo?.bar`
// 4) diff(`foo.bar`, `foo.bar.baz?.bam`) = `.baz?.bam`
// 5) result = `foo?.bar?.baz?.bam`
// 6) diff(`foo.bar.baz?.bam`, `foo.bar.baz.bam()`) = `()`
// 7) result = `foo?.bar?.baz?.bam?.()`
const parts = [];
for (const current of chain) {
const nextOperand = flattenChainExpression(sourceCode, current.comparedName);
const diff = nextOperand.slice(parts.length);
if (diff.length > 0) {
if (parts.length > 0) {
// we need to make the first operand of the diff optional so it matches the
// logic before merging
// foo.bar && foo.bar.baz
// diff = .baz
// result = foo.bar?.baz
diff[0].optional = true;
}
parts.push(...diff);
}
}
let newCode = parts
.map(part => {
let str = '';
if (part.optional) {
str += '?.';
}
else {
if (part.nonNull) {
str += '!';
}
if (part.requiresDot) {
str += '.';
}
}
if (part.precedence !== util_1.OperatorPrecedence.Invalid &&
part.precedence < util_1.OperatorPrecedence.Member) {
str += `(${part.text})`;
}
else {
str += part.text;
}
return str;
})
.join('');
if (lastOperand.node.type === utils_1.AST_NODE_TYPES.BinaryExpression) {
// retain the ending comparison for cases like
// x && x.a != null
// x && typeof x.a !== 'undefined'
const operator = lastOperand.node.operator;
const { left, right } = (() => {
if (lastOperand.isYoda) {
const unaryOperator = lastOperand.node.right.type === utils_1.AST_NODE_TYPES.UnaryExpression
? `${lastOperand.node.right.operator} `
: '';
return {
left: sourceCode.getText(lastOperand.node.left),
right: unaryOperator + newCode,
};
}
const unaryOperator = lastOperand.node.left.type === utils_1.AST_NODE_TYPES.UnaryExpression
? `${lastOperand.node.left.operator} `
: '';
return {
left: unaryOperator + newCode,
right: sourceCode.getText(lastOperand.node.right),
};
})();
newCode = `${left} ${operator} ${right}`;
}
else if (lastOperand.comparisonType === gatherLogicalOperands_1.NullishComparisonType.NotBoolean) {
newCode = `!${newCode}`;
}
const reportRange = getReportRange(chain, node.range, sourceCode);
const fix = fixer => fixer.replaceTextRange(reportRange, newCode);
return {
loc: {
end: sourceCode.getLocFromIndex(reportRange[1]),
start: sourceCode.getLocFromIndex(reportRange[0]),
},
messageId: 'preferOptionalChain',
...(0, util_1.getFixOrSuggest)({
fixOrSuggest: useSuggestionFixer ? 'suggest' : 'fix',
suggestion: {
fix,
messageId: 'optionalChainSuggest',
},
}),
};
function flattenChainExpression(sourceCode, node) {
switch (node.type) {
case utils_1.AST_NODE_TYPES.ChainExpression:
return flattenChainExpression(sourceCode, node.expression);
case utils_1.AST_NODE_TYPES.CallExpression: {
const argumentsText = (() => {
const closingParenToken = (0, util_1.nullThrows)(sourceCode.getLastToken(node), util_1.NullThrowsReasons.MissingToken('closing parenthesis', node.type));
const openingParenToken = (0, util_1.nullThrows)(sourceCode.getFirstTokenBetween(node.typeArguments ?? node.callee, closingParenToken, util_1.isOpeningParenToken), util_1.NullThrowsReasons.MissingToken('opening parenthesis', node.type));
return sourceCode.text.substring(openingParenToken.range[0], closingParenToken.range[1]);
})();
const typeArgumentsText = (() => {
if (node.typeArguments == null) {
return '';
}
return sourceCode.getText(node.typeArguments);
})();
return [
...flattenChainExpression(sourceCode, node.callee),
{
nonNull: false,
optional: node.optional,
// no precedence for this
precedence: util_1.OperatorPrecedence.Invalid,
requiresDot: false,
text: typeArgumentsText + argumentsText,
},
];
}
case utils_1.AST_NODE_TYPES.MemberExpression: {
const propertyText = sourceCode.getText(node.property);
return [
...flattenChainExpression(sourceCode, node.object),
{
nonNull: node.object.type === utils_1.AST_NODE_TYPES.TSNonNullExpression,
optional: node.optional,
precedence: node.computed
? // computed is already wrapped in [] so no need to wrap in () as well
util_1.OperatorPrecedence.Invalid
: (0, util_1.getOperatorPrecedenceForNode)(node.property),
requiresDot: !node.computed,
text: node.computed ? `[${propertyText}]` : propertyText,
},
];
}
case utils_1.AST_NODE_TYPES.TSNonNullExpression:
return flattenChainExpression(sourceCode, node.expression);
default:
return [
{
nonNull: false,
optional: false,
precedence: (0, util_1.getOperatorPrecedenceForNode)(node),
requiresDot: false,
text: sourceCode.getText(node),
},
];
}
}
}
function analyzeChain(context, parserServices, options, node, operator, chain, lastChainOperand) {
// need at least 2 operands in a chain for it to be a chain
if (chain.length + (lastChainOperand ? 1 : 0) <= 1 ||
/* istanbul ignore next -- previous checks make this unreachable, but keep it for exhaustiveness check */
operator === '??') {
return;
}
const analyzeOperand = (() => {
switch (operator) {
case '&&':
return analyzeAndChainOperand;
case '||':
return analyzeOrChainOperand;
}
})();
// Things like x !== null && x !== undefined have two nodes, but they are
// one logical unit here, so we'll allow them to be grouped.
let subChain = [];
let lastChain = undefined;
const maybeReportThenReset = (newChainSeed) => {
if (subChain.length + (lastChain ? 1 : 0) > 1) {
const subChainFlat = subChain.flat();
const maybeNullishNodes = lastChain
? subChainFlat.map(({ node }) => node)
: subChainFlat.slice(0, -1).map(({ node }) => node);
(0, checkNullishAndReport_1.checkNullishAndReport)(context, parserServices, options, maybeNullishNodes, getReportDescriptor(context.sourceCode, parserServices, node, operator, options, subChainFlat, lastChain));
}
// we've reached the end of a chain of logical expressions
// i.e. the current operand doesn't belong to the previous chain.
//
// we don't want to throw away the current operand otherwise we will skip it
// and that can cause us to miss chains. So instead we seed the new chain
// with the current operand
//
// eg this means we can catch cases like:
// unrelated != null && foo != null && foo.bar != null;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ first "chain"
// ^^^^^^^^^^^ newChainSeed
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ second chain
subChain = newChainSeed ? [newChainSeed] : [];
lastChain = undefined;
};
for (let i = 0; i < chain.length; i += 1) {
const lastOperand = subChain.flat().at(-1);
const operand = chain[i];
const validatedOperands = analyzeOperand(parserServices, operand, i, chain);
if (!validatedOperands) {
// TODO - #7170
// check if the name is a superset/equal - if it is, then it likely
// intended to be part of the chain and something we should include in the
// report, eg
// foo == null || foo.bar;
// ^^^^^^^^^^^ valid OR chain
// ^^^^^^^ invalid OR chain logical, but still part of
// the chain for combination purposes
if (lastOperand) {
const comparisonResult = (0, compareNodes_1.compareNodes)(lastOperand.comparedName, operand.comparedName);
switch (operand.comparisonType) {
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined:
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined: {
if (comparisonResult === compareNodes_1.NodeComparisonResult.Subset) {
lastChain = operand;
}
break;
}
}
}
maybeReportThenReset();
continue;
}
// in case multiple operands were consumed - make sure to correctly increment the index
i += validatedOperands.length - 1;
const currentOperand = validatedOperands[0];
if (lastOperand) {
const comparisonResult = (0, compareNodes_1.compareNodes)(lastOperand.comparedName,
// purposely inspect and push the last operand because the prior operands don't matter
// this also means we won't false-positive in cases like
// foo !== null && foo !== undefined
validatedOperands[validatedOperands.length - 1].comparedName);
if (comparisonResult === compareNodes_1.NodeComparisonResult.Subset) {
// the operands are comparable, so we can continue searching
subChain.push(currentOperand);
}
else if (comparisonResult === compareNodes_1.NodeComparisonResult.Invalid) {
maybeReportThenReset(validatedOperands);
}
else {
// purposely don't push this case because the node is a no-op and if
// we consider it then we might report on things like
// foo && foo
}
}
else {
subChain.push(currentOperand);
}
}
const lastOperand = subChain.flat().at(-1);
if (lastOperand && lastChainOperand) {
const comparisonResult = (0, compareNodes_1.compareNodes)(lastOperand.comparedName, lastChainOperand.comparedName);
const isValidLastChainOperand = operator === '&&'
? isValidAndLastChainOperand
: isValidOrLastChainOperand;
if (comparisonResult === compareNodes_1.NodeComparisonResult.Subset &&
isValidLastChainOperand(lastChainOperand.comparisonValue, lastChainOperand.comparisonType, parserServices)) {
lastChain = lastChainOperand;
}
}
// check the leftovers
maybeReportThenReset();
}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAQD,SAAS,6BAAU,KAAqB;IACtC,OAAO;AACT;AAEA,6BAAO,iBAAiB,GAAG,UAAU,kBAAqB,KAAqB,EAAE,OAAoC;IACnH,IAAI,SAAC,KAAK,YAAE,QAAQ,gBAAE,YAAY,EAAC,GAAG;IAEtC,IAAI,WAAW,SAAS;IACxB,IAAI,YAAY,MAAM,SAAS,IAAK,CAAA,OAAO,aAAa,WAAW,WAAW,EAAC,KAAM,KAAK,CAAC,aAAa;IAExG,IAAI,YAAY,MAAM;QACpB,MAAM;QACN,eAAe,CAAC,CAAC,gBAAiB,CAAC,CAAC,SAAS,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;kBAC9E;mBACA;eACA;QACA,CAAC;YACC,IAAI,cACF,KAAK,IAAI,SAAS,aAChB,MAAM;gBACJ,MAAM;gBACN,OAAO;YACT;iBAEG,IAAI,OAAO;gBAChB,IAAI,eAAiC,EAAE;gBACvC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;oBAC/B,aAAa,IAAI,CAAC;wBAChB,MAAM;wBACN,SAAS;oBACX;gBACF;gBAEA,OAAO;YACT;QACF;QACA,kBAAiB,UAAuC;YACtD,yCAAyC;YACzC,kFAAkF;YAClF,0EAA0E;YAC1E,cAAc;YACd,OAAO;QACT;IACF;IAEA,IAAI,gBAAgB,CAAC;QACnB,qEAAqE;QACrE,KAAK,IAAI,QAAQ,UACf,IAAI,CAAC,KAAK,aAAa,EACrB,QAAQ,OAAO,CAAC,IAAI,CAAC;IAG3B;IAEA,cAAc;AAChB;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAU","sources":["packages/@react-stately/table/src/Column.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CollectionBuilderContext} from './useTableState';\nimport {ColumnProps} from '@react-types/table';\nimport {GridNode} from '@react-types/grid';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\n\nfunction Column<T>(props: ColumnProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nColumn.getCollectionNode = function* getCollectionNode<T>(props: ColumnProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>, void, GridNode<T>[]> {\n let {title, children, childColumns} = props;\n\n let rendered = title || children;\n let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'];\n\n let fullNodes = yield {\n type: 'column',\n hasChildNodes: !!childColumns || (!!title && React.Children.count(children) > 0),\n rendered,\n textValue,\n props,\n *childNodes() {\n if (childColumns) {\n for (let child of childColumns) {\n yield {\n type: 'column',\n value: child\n };\n }\n } else if (title) {\n let childColumns: PartialNode<T>[] = [];\n React.Children.forEach(children, child => {\n childColumns.push({\n type: 'column',\n element: child as ReactElement<ColumnProps<T>>\n });\n });\n\n yield* childColumns;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // This is a bit of a hack, but it works.\n // If this method is called, then there's a cached version of this node available.\n // But, we need to keep the list of columns in the new context up to date.\n updateContext(newContext);\n return false;\n }\n };\n\n let updateContext = (context: CollectionBuilderContext<T>) => {\n // register leaf columns on the context so that <Row> can access them\n for (let node of fullNodes) {\n if (!node.hasChildNodes) {\n context.columns.push(node);\n }\n }\n };\n\n updateContext(context);\n};\n\n/**\n * A Column represents a field of each item within a Table. Columns may also contain nested\n * Column elements to represent column groups. Nested columns can be statically defined as\n * children, or dynamically generated using a function based on the `childColumns` prop.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Column = Column as <T>(props: ColumnProps<T>) => JSX.Element;\nexport {_Column as Column};\n"],"names":[],"version":3,"file":"Column.main.js.map"}
@@ -0,0 +1,6 @@
export { useReactAriaAccordion } from './use-accordion.js';
export { useReactAriaAccordionItem } from './use-accordion-item.js';
import '@react-types/accordion';
import 'react';
import '@react-types/shared';
import '@react-stately/tree';
@@ -0,0 +1,4 @@
import { ClassAttributor, StyleAttributor } from 'parchment';
declare const SizeClass: ClassAttributor;
declare const SizeStyle: StyleAttributor;
export { SizeClass, SizeStyle };
@@ -0,0 +1 @@
{"name":"fd-slicer2","version":"1.2.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532099660,"integrity":"sha512-vWk2RyVsHhS8igELBGn9xSLBNXijuZs4vugEQHnoOcieQkWTPDxKAfQpPRwMazMogg34pyFaEqYVLpqVY9mcLg==","mode":420,"size":1057},"index.js":{"checkedAt":1794532099661,"integrity":"sha512-xTk2AxnV5VsN1AC0uOcI1UzvtdqX64hQ0eOwpGxVFw4s38Lmuz9jG4iVkJkID2W7ZFOxiDQl0rxIzTgMgH6Qig==","mode":420,"size":7263},"package.json":{"checkedAt":1794532099661,"integrity":"sha512-8OlH54WKphckxH6+OW0+6H3Jtu/u0e4WdAc4wyPMMMsGdvh6k0U65t8SPAtjEWmKIE/obpoKu9u0kgoatwGCYQ==","mode":420,"size":851},"CHANGELOG.md":{"checkedAt":1794532099661,"integrity":"sha512-BUXK/uVG6ww9dUC3U6UE6mH3/IbKWky/lnCh2iUT4j6rC+HpcM0hoNJOodnrUv5ERTS9fw3vZJ3+bpE6sm+8Ew==","mode":420,"size":911},"README.md":{"checkedAt":1794532099661,"integrity":"sha512-AUzv+BHuYC7f83FyZlWpFlV1oXtboWeYsUTSQAU5VJxDjNwYE1MGPFSf1zHh0sZ7us9QZfa/ftBsYP982LRsZA==","mode":420,"size":6908}}}
@@ -0,0 +1,5 @@
/**
* Returns a number (float) representing the luminance of a color.
*/
declare function getLuminance(color: string): number;
export default getLuminance;
@@ -0,0 +1,211 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/Types';
import { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from 'common/buffer/Constants';
export class AttributeData implements IAttributeData {
public static toColorRGB(value: number): IColorRGB {
return [
value >>> Attributes.RED_SHIFT & 255,
value >>> Attributes.GREEN_SHIFT & 255,
value & 255
];
}
public static fromColorRGB(value: IColorRGB): number {
return (value[0] & 255) << Attributes.RED_SHIFT | (value[1] & 255) << Attributes.GREEN_SHIFT | value[2] & 255;
}
public clone(): IAttributeData {
const newObj = new AttributeData();
newObj.fg = this.fg;
newObj.bg = this.bg;
newObj.extended = this.extended.clone();
return newObj;
}
// data
public fg = 0;
public bg = 0;
public extended: IExtendedAttrs = new ExtendedAttrs();
// flags
public isInverse(): number { return this.fg & FgFlags.INVERSE; }
public isBold(): number { return this.fg & FgFlags.BOLD; }
public isUnderline(): number {
if (this.hasExtendedAttrs() && this.extended.underlineStyle !== UnderlineStyle.NONE) {
return 1;
}
return this.fg & FgFlags.UNDERLINE;
}
public isBlink(): number { return this.fg & FgFlags.BLINK; }
public isInvisible(): number { return this.fg & FgFlags.INVISIBLE; }
public isItalic(): number { return this.bg & BgFlags.ITALIC; }
public isDim(): number { return this.bg & BgFlags.DIM; }
public isStrikethrough(): number { return this.fg & FgFlags.STRIKETHROUGH; }
public isProtected(): number { return this.bg & BgFlags.PROTECTED; }
public isOverline(): number { return this.bg & BgFlags.OVERLINE; }
// color modes
public getFgColorMode(): number { return this.fg & Attributes.CM_MASK; }
public getBgColorMode(): number { return this.bg & Attributes.CM_MASK; }
public isFgRGB(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_RGB; }
public isBgRGB(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_RGB; }
public isFgPalette(): boolean { return (this.fg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.fg & Attributes.CM_MASK) === Attributes.CM_P256; }
public isBgPalette(): boolean { return (this.bg & Attributes.CM_MASK) === Attributes.CM_P16 || (this.bg & Attributes.CM_MASK) === Attributes.CM_P256; }
public isFgDefault(): boolean { return (this.fg & Attributes.CM_MASK) === 0; }
public isBgDefault(): boolean { return (this.bg & Attributes.CM_MASK) === 0; }
public isAttributeDefault(): boolean { return this.fg === 0 && this.bg === 0; }
// colors
public getFgColor(): number {
switch (this.fg & Attributes.CM_MASK) {
case Attributes.CM_P16:
case Attributes.CM_P256: return this.fg & Attributes.PCOLOR_MASK;
case Attributes.CM_RGB: return this.fg & Attributes.RGB_MASK;
default: return -1; // CM_DEFAULT defaults to -1
}
}
public getBgColor(): number {
switch (this.bg & Attributes.CM_MASK) {
case Attributes.CM_P16:
case Attributes.CM_P256: return this.bg & Attributes.PCOLOR_MASK;
case Attributes.CM_RGB: return this.bg & Attributes.RGB_MASK;
default: return -1; // CM_DEFAULT defaults to -1
}
}
// extended attrs
public hasExtendedAttrs(): number {
return this.bg & BgFlags.HAS_EXTENDED;
}
public updateExtended(): void {
if (this.extended.isEmpty()) {
this.bg &= ~BgFlags.HAS_EXTENDED;
} else {
this.bg |= BgFlags.HAS_EXTENDED;
}
}
public getUnderlineColor(): number {
if ((this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor) {
switch (this.extended.underlineColor & Attributes.CM_MASK) {
case Attributes.CM_P16:
case Attributes.CM_P256: return this.extended.underlineColor & Attributes.PCOLOR_MASK;
case Attributes.CM_RGB: return this.extended.underlineColor & Attributes.RGB_MASK;
default: return this.getFgColor();
}
}
return this.getFgColor();
}
public getUnderlineColorMode(): number {
return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
? this.extended.underlineColor & Attributes.CM_MASK
: this.getFgColorMode();
}
public isUnderlineColorRGB(): boolean {
return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_RGB
: this.isFgRGB();
}
public isUnderlineColorPalette(): boolean {
return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
? (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P16
|| (this.extended.underlineColor & Attributes.CM_MASK) === Attributes.CM_P256
: this.isFgPalette();
}
public isUnderlineColorDefault(): boolean {
return (this.bg & BgFlags.HAS_EXTENDED) && ~this.extended.underlineColor
? (this.extended.underlineColor & Attributes.CM_MASK) === 0
: this.isFgDefault();
}
public getUnderlineStyle(): UnderlineStyle {
return this.fg & FgFlags.UNDERLINE
? (this.bg & BgFlags.HAS_EXTENDED ? this.extended.underlineStyle : UnderlineStyle.SINGLE)
: UnderlineStyle.NONE;
}
public getUnderlineVariantOffset(): number {
return this.extended.underlineVariantOffset;
}
}
/**
* Extended attributes for a cell.
* Holds information about different underline styles and color.
*/
export class ExtendedAttrs implements IExtendedAttrs {
private _ext: number = 0;
public get ext(): number {
if (this._urlId) {
return (
(this._ext & ~ExtFlags.UNDERLINE_STYLE) |
(this.underlineStyle << 26)
);
}
return this._ext;
}
public set ext(value: number) { this._ext = value; }
public get underlineStyle(): UnderlineStyle {
// Always return the URL style if it has one
if (this._urlId) {
return UnderlineStyle.DASHED;
}
return (this._ext & ExtFlags.UNDERLINE_STYLE) >> 26;
}
public set underlineStyle(value: UnderlineStyle) {
this._ext &= ~ExtFlags.UNDERLINE_STYLE;
this._ext |= (value << 26) & ExtFlags.UNDERLINE_STYLE;
}
public get underlineColor(): number {
return this._ext & (Attributes.CM_MASK | Attributes.RGB_MASK);
}
public set underlineColor(value: number) {
this._ext &= ~(Attributes.CM_MASK | Attributes.RGB_MASK);
this._ext |= value & (Attributes.CM_MASK | Attributes.RGB_MASK);
}
private _urlId: number = 0;
public get urlId(): number {
return this._urlId;
}
public set urlId(value: number) {
this._urlId = value;
}
public get underlineVariantOffset(): number {
const val = (this._ext & ExtFlags.VARIANT_OFFSET) >> 29;
if (val < 0) {
return val ^ 0xFFFFFFF8;
}
return val;
}
public set underlineVariantOffset(value: number) {
this._ext &= ~ExtFlags.VARIANT_OFFSET;
this._ext |= (value << 29) & ExtFlags.VARIANT_OFFSET;
}
constructor(
ext: number = 0,
urlId: number = 0
) {
this._ext = ext;
this._urlId = urlId;
}
public clone(): IExtendedAttrs {
return new ExtendedAttrs(this._ext, this._urlId);
}
/**
* Convenient method to indicate whether the object holds no additional information,
* that needs to be persistant in the buffer.
*/
public isEmpty(): boolean {
return this.underlineStyle === UnderlineStyle.NONE && this._urlId === 0;
}
}
@@ -0,0 +1 @@
{"version":3,"file":"isMultipleSelect.d.ts","sourceRoot":"","sources":["../../src/utils/isMultipleSelect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;yBAE7B,SAAS,YAAY,KAAG,OAAO,IAAI,iBAAiB;AAApE,wBACqC"}
@@ -0,0 +1,28 @@
import createCompounder from './_createCompounder.js';
/**
* Converts `string` to
* [snake case](https://en.wikipedia.org/wiki/Snake_case).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the snake cased string.
* @example
*
* _.snakeCase('Foo Bar');
* // => 'foo_bar'
*
* _.snakeCase('fooBar');
* // => 'foo_bar'
*
* _.snakeCase('--FOO-BAR--');
* // => 'foo_bar'
*/
var snakeCase = createCompounder(function(result, word, index) {
return result + (index ? '_' : '') + word.toLowerCase();
});
export default snakeCase;
@@ -0,0 +1 @@
{"name":"tailwind-merge","version":"1.14.0","requiresBuild":false,"files":{"dist/index.js":{"checkedAt":1794532104664,"integrity":"sha512-9aB/lKybo3Ud5MCDX9fTr9Le742YkCltyeTEzv0qMJ/TY2CL/7/jn4ZxfAqM/Rgdm6+aQHhbrVFN7oDuDh0GJA==","mode":420,"size":206},"dist/tailwind-merge.cjs.development.js":{"checkedAt":1794532104664,"integrity":"sha512-3GMJm3U2C2t1IiNuCpcay12t0k3MnOalh8GpjJhxBeS5Hf60pq9fjJH3vMTUT9ZCoJz7tk7RzXTb+cAJzLTtmg==","mode":420,"size":74191},"dist/tailwind-merge.cjs.production.min.js":{"checkedAt":1794532104664,"integrity":"sha512-4ARjyikxYQVV3Dm4JTKDGDeipllNE+yt59IN4vYYuntp4H6FHrexY6SMzfwVcqAADGac75pPuRWENtGUniNyCQ==","mode":420,"size":21642},"package.json":{"checkedAt":1794532104664,"integrity":"sha512-6K8jwOv5+mAMOrH7zfdxp+/xxfj7AR0NERMfjHWzOYsgp0ywJKOkUyO5Jft53Kum7jBEI/ymi3Pex/jbxQRkiA==","mode":420,"size":2359},"dist/lib/class-utils.mjs.map":{"checkedAt":1794532104665,"integrity":"sha512-5T61lOE7LAhREZfJkOepa/BZFzKyK9lYlG3rnL71Fq09AdITiHSA1vzITxVCIol265oJf49T40GyRIAZkhDCGw==","mode":420,"size":12881},"dist/lib/config-utils.mjs.map":{"checkedAt":1794532104665,"integrity":"sha512-GvVXwCPnjphEMezNf+9GZZRAehsCpdiBJOru1Nqrt5IuofF6rDXd2g4CfH36UGBOqX0BCO0XujAuX3OS9TKMgg==","mode":420,"size":951},"dist/lib/create-tailwind-merge.mjs.map":{"checkedAt":1794532104665,"integrity":"sha512-FcWaRinCv/9ELoP9qtcrtAWM1t5EJYMx1F2exUAVvGqokUFJdRCgNhVtktIKJxvnOd2hcSH1eGnzL0GQJL782g==","mode":420,"size":3531},"dist/lib/default-config.mjs.map":{"checkedAt":1794532104665,"integrity":"sha512-psRNqROOPkSuYfwt5a5qKOM7dhenEHa8e4eV6VN0gl1GrZ5geHDT3Zvn0SHliu4Xv+9MHx8p2DDoIIRl6CGC1g==","mode":420,"size":101722},"dist/lib/extend-tailwind-merge.mjs.map":{"checkedAt":1794532104665,"integrity":"sha512-kAJ9oT+6VPkzatIMhR9z9ypO4sekUUVn1HLK67tSsJu2abBDZ5OlA+TP6PiuwXi2ehRWy6YjLbR76J8nVDr4pw==","mode":420,"size":1579},"dist/lib/from-theme.mjs.map":{"checkedAt":1794532104665,"integrity":"sha512-YXnZ2Bos/yo2pmMZepvaVQFEL+3Wb+OKoJBQYUeEdYNNJhMdIuDW6Ffo9K7C1dY2lY8rZvqSLmhrXeQ+2GFZOQ==","mode":420,"size":662},"dist/lib/lru-cache.mjs.map":{"checkedAt":1794532104665,"integrity":"sha512-fBaJckNZAs8DjrBkMCDLdFfDfB/uordSZzv1rOL1WyA8f7ZB8C04gM7jWfqFGXQeTAutdeyTEjR/CyxSYSU0Qw==","mode":420,"size":3182},"dist/lib/merge-classlist.mjs.map":{"checkedAt":1794532104666,"integrity":"sha512-Sae5aB5MifYV1PGOn62xxN7ctCmpWdkK3OWGr7IfXh0RgzZrIG0CY7OEAK8KciYYYJDAKsPayaoIhF/2XmgMEg==","mode":420,"size":6252},"dist/lib/merge-configs.mjs.map":{"checkedAt":1794532104666,"integrity":"sha512-gR+l/AuKCV1BvIkyhZxEFZQWJOnzgAkjh/WrQ1NQAANDm05MJgFAE3+KgBW3B8gPK4FLNGZkdYchLRPcj5506A==","mode":420,"size":3217},"dist/lib/modifier-utils.mjs.map":{"checkedAt":1794532104666,"integrity":"sha512-qM0eYpQchM+xds00r/Foh3SWcuCuNCtoKp74aESyrnZK7FHopyWKvNO0/YTo+Lz+hkhNwMP6Fg7ZyeFYEmeK4A==","mode":420,"size":6384},"dist/tailwind-merge.cjs.development.js.map":{"checkedAt":1794532104666,"integrity":"sha512-b/8HyMjWIoRlWqNVDyjjk4tnW2wwz1djcNNscY97/pWF6qt9pwlSgMXV+UuM+zVL/MhO4aPAk9wzSW2H9IK7uw==","mode":420,"size":148238},"dist/tailwind-merge.cjs.production.min.js.map":{"checkedAt":1794532104667,"integrity":"sha512-de1Lkz+pMaUrl90M6lVJdhbdQPzt7JHBGP0y96UBr38tJorea24uxzYYO/sGr2ur5Pa3Mn10MletTKFlBwHEwA==","mode":420,"size":117762},"dist/tailwind-merge.mjs.map":{"checkedAt":1794532104667,"integrity":"sha512-Dnz7RCxTq9zIj0jAomWol/R4r1d79X43dIiIGDhWJL5MR/Asj0dAk2/YSEas6ltKnidANdIzfw9IcxVpAiE8Mw==","mode":420,"size":821},"dist/lib/tw-join.mjs.map":{"checkedAt":1794532104667,"integrity":"sha512-NOyMUuAEC1V8TQyBgwhoTCPkyOMUZTGGlinviPlJX0hpiEhFAhje5tIBABs2ShqfKLzlzeGjznkd5m5xIS4bXQ==","mode":420,"size":2695},"dist/lib/tw-merge.mjs.map":{"checkedAt":1794532104667,"integrity":"sha512-c5+jCoRzzSdfZ9WsWaTqjrzWKJuurkVPcfL+Liq9PQmC3uX9mdqB70cfTr/KPrpeSq1J1wT4WjffGwSJy2x75g==","mode":420,"size":396},"dist/lib/validators.mjs.map":{"checkedAt":1794532104667,"integrity":"sha512-YSK+8y+hVCYhpCsoqFtHT6DpLKcGOXrCBWsp8LKIneRsTPgShjL8zIsizYTTtTqHJ/s0Ch3V0F7jOwpv5TuCew==","mode":420,"size":6149},"LICENSE.md":{"checkedAt":1794532104667,"integrity":"sha512-RymcfAdUL7gCogwTZS2tveRSWMbAKmoe+cjKkCskMmSnMWv7Ox6Spc/iBa/Ogc3gI0tBVSR8AmV/x5EdCy/OoQ==","mode":420,"size":1070},"README.md":{"checkedAt":1794532104667,"integrity":"sha512-dTJm+FQOMvSpdK5qjp1ddEmptmEqBdAHYONjPtfi+ZtH8VAkMTrp9+Lt5Uwo1XQ9k/uLucaLjEigRrrw1nAiFQ==","mode":420,"size":1956},"dist/lib/class-utils.mjs":{"checkedAt":1794532104668,"integrity":"sha512-XbPaUw8cxp8cH16Rqc/EroY5yArBqWGucE8fwVcdKm9PTQad0o+xlNYPlnT2pvk8yyC01CCs9FzUzM1JP07uDg==","mode":420,"size":5323},"dist/lib/config-utils.mjs":{"checkedAt":1794532104668,"integrity":"sha512-yDIByj6I/xHYJfVciPbvMqpxuxUs0r8ds/aI/r04FCYLFhYlDDD3vigz9kgvRYfCxRfklmGWoxvOhyoRf1a47Q==","mode":420,"size":421},"dist/lib/create-tailwind-merge.mjs":{"checkedAt":1794532104668,"integrity":"sha512-MTQwHZKxOZ2qc3LRwS5jzI4FVI7ww7312peql+CuD80ALF2V4Jxwgad7IbD51Zpgnzgvk9H6G/qyomMdIMh63Q==","mode":420,"size":1369},"dist/lib/default-config.mjs":{"checkedAt":1794532104668,"integrity":"sha512-OFfDhJqhx0VZ74e4ia4UE2D68lb9AZuHsB1EQELine truncated
@@ -0,0 +1,32 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es6 = void 0;
const es5_1 = require("./es5");
const es2015_collection_1 = require("./es2015.collection");
const es2015_core_1 = require("./es2015.core");
const es2015_generator_1 = require("./es2015.generator");
const es2015_iterable_1 = require("./es2015.iterable");
const es2015_promise_1 = require("./es2015.promise");
const es2015_proxy_1 = require("./es2015.proxy");
const es2015_reflect_1 = require("./es2015.reflect");
const es2015_symbol_1 = require("./es2015.symbol");
const es2015_symbol_wellknown_1 = require("./es2015.symbol.wellknown");
exports.es6 = {
libs: [
es5_1.es5,
es2015_core_1.es2015_core,
es2015_collection_1.es2015_collection,
es2015_iterable_1.es2015_iterable,
es2015_generator_1.es2015_generator,
es2015_promise_1.es2015_promise,
es2015_proxy_1.es2015_proxy,
es2015_reflect_1.es2015_reflect,
es2015_symbol_1.es2015_symbol,
es2015_symbol_wellknown_1.es2015_symbol_wellknown,
],
variables: [],
};
@@ -0,0 +1,41 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("eslint-utils")
module.exports = {
meta: {
docs: {
description: "disallow the `SharedArrayBuffer` class.",
category: "ES2017",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-shared-array-buffer.html",
},
fixable: null,
messages: {
forbidden: "ES2017 '{{name}}' class is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"() {
const tracker = new ReferenceTracker(context.getScope())
for (const { node, path } of tracker.iterateGlobalReferences({
SharedArrayBuffer: { [READ]: true },
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,16 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es2016_full = void 0;
const dom_1 = require("./dom");
const dom_iterable_1 = require("./dom.iterable");
const es2016_1 = require("./es2016");
const scripthost_1 = require("./scripthost");
const webworker_importscripts_1 = require("./webworker.importscripts");
exports.es2016_full = {
libs: [es2016_1.es2016, dom_1.dom, webworker_importscripts_1.webworker_importscripts, scripthost_1.scripthost, dom_iterable_1.dom_iterable],
variables: [],
};
@@ -0,0 +1,80 @@
'use strict'
const index = require('./entry-index')
const memo = require('./memoization')
const write = require('./content/write')
const Flush = require('minipass-flush')
const { PassThrough } = require('minipass-collect')
const Pipeline = require('minipass-pipeline')
const putOpts = (opts) => ({
algorithms: ['sha512'],
...opts,
})
module.exports = putData
async function putData (cache, key, data, opts = {}) {
const { memoize } = opts
opts = putOpts(opts)
const res = await write(cache, data, opts)
const entry = await index.insert(cache, key, res.integrity, { ...opts, size: res.size })
if (memoize) {
memo.put(cache, entry, data, opts)
}
return res.integrity
}
module.exports.stream = putStream
function putStream (cache, key, opts = {}) {
const { memoize } = opts
opts = putOpts(opts)
let integrity
let size
let error
let memoData
const pipeline = new Pipeline()
// first item in the pipeline is the memoizer, because we need
// that to end first and get the collected data.
if (memoize) {
const memoizer = new PassThrough().on('collect', data => {
memoData = data
})
pipeline.push(memoizer)
}
// contentStream is a write-only, not a passthrough
// no data comes out of it.
const contentStream = write.stream(cache, opts)
.on('integrity', (int) => {
integrity = int
})
.on('size', (s) => {
size = s
})
.on('error', (err) => {
error = err
})
pipeline.push(contentStream)
// last but not least, we write the index and emit hash and size,
// and memoize if we're doing that
pipeline.push(new Flush({
async flush () {
if (!error) {
const entry = await index.insert(cache, key, integrity, { ...opts, size })
if (memoize && memoData) {
memo.put(cache, entry, memoData, opts)
}
pipeline.emit('integrity', integrity)
pipeline.emit('size', size)
}
},
}))
return pipeline
}
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _classPrivateMethodSet;
function _classPrivateMethodSet() {
throw new TypeError("attempted to reassign private method");
}
//# sourceMappingURL=classPrivateMethodSet.js.map
@@ -0,0 +1,29 @@
{
"name": "wrappy",
"version": "1.0.2",
"description": "Callback wrapping utility",
"main": "wrappy.js",
"files": [
"wrappy.js"
],
"directories": {
"test": "test"
},
"dependencies": {},
"devDependencies": {
"tap": "^2.3.1"
},
"scripts": {
"test": "tap --coverage test/*.js"
},
"repository": {
"type": "git",
"url": "https://github.com/npm/wrappy"
},
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "ISC",
"bugs": {
"url": "https://github.com/npm/wrappy/issues"
},
"homepage": "https://github.com/npm/wrappy"
}
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017, Brian Woodward.
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,8 @@
var $5809cc9d4e92de73$exports = {};
$5809cc9d4e92de73$exports = {
"dismiss": `Luk`
};
export {$5809cc9d4e92de73$exports as default};
//# sourceMappingURL=da-DK.module.js.map
@@ -0,0 +1,101 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var min = require('math-intrinsics/min');
var $TypeError = require('es-errors/type');
var $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true);
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
var callBound = require('call-bound');
var byteLength = require('array-buffer-byte-length');
var $maxByteLength = callBound('%ArrayBuffer.prototype.maxByteLength%', true);
var copy = function copyAB(src, start, end) {
var that = new $Uint8Array(src);
if (typeof end === 'undefined') {
end = that.length; // eslint-disable-line no-param-reassign
}
var result = new $ArrayBuffer(end - start);
var resultArray = new $Uint8Array(result);
for (var i = 0; i < resultArray.length; i++) {
resultArray[i] = that[i + start];
}
return result;
};
var $abSlice = callBound('%ArrayBuffer.prototype.slice%', true)
|| function slice(ab, a, b) { // in node < 0.11, slice is an own nonconfigurable property
return ab.slice ? ab.slice(a, b) : copy(ab, a, b); // node 0.8 lacks `slice`
};
var DetachArrayBuffer = require('./DetachArrayBuffer');
var IsDetachedBuffer = require('./IsDetachedBuffer');
var IsFixedLengthArrayBuffer = require('./IsFixedLengthArrayBuffer');
var ToIndex = require('./ToIndex');
var isArrayBuffer = require('is-array-buffer');
var isSharedArrayBuffer = require('is-shared-array-buffer');
// https://262.ecma-international.org/15.0/#sec-arraybuffercopyanddetach
module.exports = function ArrayBufferCopyAndDetach(arrayBuffer, newLength, preserveResizability) {
if (preserveResizability !== 'PRESERVE-RESIZABILITY' && preserveResizability !== 'FIXED-LENGTH') {
throw new $TypeError('`preserveResizability` must be ~PRESERVE-RESIZABILITY~ or ~FIXED-LENGTH~');
}
if (!isArrayBuffer(arrayBuffer) || isSharedArrayBuffer(arrayBuffer)) {
throw new $TypeError('`arrayBuffer` must be a non-shared ArrayBuffer'); // steps 1 - 2
}
var abByteLength;
var newByteLength;
if (typeof newLength === 'undefined') { // step 3
newByteLength = byteLength(arrayBuffer); // step 3.a
abByteLength = newByteLength;
} else { // step 4
newByteLength = ToIndex(newLength); // step 4.a
}
if (IsDetachedBuffer(arrayBuffer)) {
throw new $TypeError('`arrayBuffer` must not be detached'); // step 5
}
var newMaxByteLength;
if (preserveResizability === 'PRESERVE-RESIZABILITY' && !IsFixedLengthArrayBuffer(arrayBuffer)) { // step 6
newMaxByteLength = $maxByteLength(arrayBuffer); // step 6.a
} else { // step 7
newMaxByteLength = 'EMPTY'; // step 7.a
}
// commented out since there's no way to set or access this key
// 8. If arrayBuffer.[[ArrayBufferDetachKey]] is not undefined, throw a TypeError exception.
// 9. Let newBuffer be ? AllocateArrayBuffer(%ArrayBuffer%, newByteLength, newMaxByteLength).
var newBuffer = newMaxByteLength === 'EMPTY' ? new $ArrayBuffer(newByteLength) : new $ArrayBuffer(newByteLength, { maxByteLength: newMaxByteLength });
if (typeof abByteLength !== 'number') {
abByteLength = byteLength(arrayBuffer);
}
var copyLength = min(newByteLength, abByteLength); // step 10
if (newByteLength > copyLength || newMaxByteLength !== 'EMPTY') {
var taNew = new $Uint8Array(newBuffer);
var taOld = new $Uint8Array(arrayBuffer);
for (var i = 0; i < copyLength; i++) {
taNew[i] = taOld[i];
}
} else {
newBuffer = $abSlice(arrayBuffer, 0, copyLength); // ? optimization for when the new buffer will not be larger than the old one
}
/*
11. Let fromBlock be arrayBuffer.[[ArrayBufferData]].
12. Let toBlock be newBuffer.[[ArrayBufferData]].
13. Perform CopyDataBlockBytes(toBlock, 0, fromBlock, 0, copyLength).
14. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as a zero-copy move or a realloc.
*/
DetachArrayBuffer(arrayBuffer); // step 15
return newBuffer; // step 16
};
@@ -0,0 +1,334 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
/**
* Static methods on these globals are either not `this`-aware or supported being
* called without `this`.
*
* - `Promise` is not in the list because it supports subclassing by using `this`
* - `Array` is in the list because although it supports subclassing, the `this`
* value defaults to `Array` when unbound
*
* This is now a language-design invariant: static methods are never `this`-aware
* because TC39 wants to make `array.map(Class.method)` work!
*/
const SUPPORTED_GLOBALS = [
'Number',
'Object',
'String', // eslint-disable-line @typescript-eslint/internal/prefer-ast-types-enum
'RegExp',
'Symbol',
'Array',
'Proxy',
'Date',
'Atomics',
'Reflect',
'console',
'Math',
'JSON',
'Intl',
];
const nativelyBoundMembers = new Set(SUPPORTED_GLOBALS.flatMap(namespace => {
if (!(namespace in global)) {
// node.js might not have namespaces like Intl depending on compilation options
// https://nodejs.org/api/intl.html#intl_options_for_building_node_js
return [];
}
const object = global[namespace];
return Object.getOwnPropertyNames(object)
.filter(name => !name.startsWith('_') &&
typeof object[name] === 'function')
.map(name => `${namespace}.${name}`);
}));
const SUPPORTED_GLOBAL_TYPES = [
'NumberConstructor',
'ObjectConstructor',
'StringConstructor',
'SymbolConstructor',
'ArrayConstructor',
'Array',
'ProxyConstructor',
'Console',
'DateConstructor',
'Atomics',
'Math',
'JSON',
];
const isNotImported = (symbol, currentSourceFile) => {
const { valueDeclaration } = symbol;
if (!valueDeclaration) {
// working around https://github.com/microsoft/TypeScript/issues/31294
return false;
}
return (!!currentSourceFile &&
currentSourceFile !== valueDeclaration.getSourceFile());
};
const BASE_MESSAGE = [
`A method that is not declared with \`this: void\` may cause unintentional scoping of \`this\` when separated from its object.`,
`Consider using an arrow function or explicitly \`.bind()\`ing the method to avoid calling the method with an unintended \`this\` value. `,
].join('\n');
exports.default = (0, util_1.createRule)({
name: 'unbound-method',
meta: {
type: 'problem',
docs: {
description: 'Enforce unbound methods are called with their expected scope',
recommended: 'recommended',
requiresTypeChecking: true,
},
messages: {
unbound: BASE_MESSAGE,
unboundWithoutThisAnnotation: `${BASE_MESSAGE}\nIf a function does not access \`this\`, it can be annotated with \`this: void\`.`,
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
ignoreStatic: {
type: 'boolean',
description: 'Whether to skip checking whether `static` methods are correctly bound.',
},
},
},
],
},
defaultOptions: [
{
ignoreStatic: false,
},
],
create(context, [{ ignoreStatic }]) {
const services = (0, util_1.getParserServices)(context);
const currentSourceFile = services.program.getSourceFile(context.filename);
function checkIfMethodAndReport(node, symbol) {
if (!symbol) {
return false;
}
const { dangerous, firstParamIsThis } = checkIfMethod(symbol, ignoreStatic);
if (dangerous) {
context.report({
node,
messageId: firstParamIsThis === false
? 'unboundWithoutThisAnnotation'
: 'unbound',
});
return true;
}
return false;
}
function isNativelyBound(object, property) {
// We can't rely entirely on the type-level checks made at the end of this
// function, because sometimes type declarations don't come from the
// default library, but come from, for example, "@types/node". And we can't
// tell if a method is unbound just by looking at its signature declared in
// the interface.
//
// See related discussion https://github.com/typescript-eslint/typescript-eslint/pull/8952#discussion_r1576543310
if (object.type === utils_1.AST_NODE_TYPES.Identifier &&
property.type === utils_1.AST_NODE_TYPES.Identifier) {
const objectSymbol = services.getSymbolAtLocation(object);
const notImported = objectSymbol != null &&
isNotImported(objectSymbol, currentSourceFile);
if (notImported &&
nativelyBoundMembers.has(`${object.name}.${property.name}`)) {
return true;
}
}
// if `${object.name}.${property.name}` doesn't match any of
// the nativelyBoundMembers, then we fallback to type-level checks
return ((0, util_1.isBuiltinSymbolLike)(services.program, services.getTypeAtLocation(object), SUPPORTED_GLOBAL_TYPES) &&
(0, util_1.isSymbolFromDefaultLibrary)(services.program, services.getTypeAtLocation(property).getSymbol()));
}
return {
MemberExpression(node) {
if (isSafeUse(node) || isNativelyBound(node.object, node.property)) {
return;
}
checkIfMethodAndReport(node, services.getSymbolAtLocation(node));
},
ObjectPattern(node) {
if (isNodeInsideTypeDeclaration(node)) {
return;
}
let initNode = null;
if (node.parent.type === utils_1.AST_NODE_TYPES.VariableDeclarator) {
initNode = node.parent.init;
}
else if (node.parent.type === utils_1.AST_NODE_TYPES.AssignmentPattern ||
node.parent.type === utils_1.AST_NODE_TYPES.AssignmentExpression) {
initNode = node.parent.right;
}
for (const property of node.properties) {
if (property.type !== utils_1.AST_NODE_TYPES.Property ||
property.key.type !== utils_1.AST_NODE_TYPES.Identifier) {
continue;
}
if (initNode) {
if (!isNativelyBound(initNode, property.key)) {
const reported = checkIfMethodAndReport(property.key, services
.getTypeAtLocation(initNode)
.getProperty(property.key.name));
if (reported) {
continue;
}
// In assignment patterns, we should also check the type of
// Foo's nativelyBound method because initNode might be used as
// default value:
// function ({ nativelyBound }: Foo = NativeObject) {}
}
else if (node.parent.type !== utils_1.AST_NODE_TYPES.AssignmentPattern) {
continue;
}
}
for (const intersectionPart of tsutils
.unionConstituents(services.getTypeAtLocation(node))
.flatMap(unionPart => tsutils.intersectionConstituents(unionPart))) {
const reported = checkIfMethodAndReport(property.key, intersectionPart.getProperty(property.key.name));
if (reported) {
break;
}
}
}
},
};
},
});
function isNodeInsideTypeDeclaration(node) {
let parent = node;
while ((parent = parent.parent)) {
if ((parent.type === utils_1.AST_NODE_TYPES.ClassDeclaration && parent.declare) ||
parent.type === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition ||
parent.type === utils_1.AST_NODE_TYPES.TSDeclareFunction ||
parent.type === utils_1.AST_NODE_TYPES.TSFunctionType ||
parent.type === utils_1.AST_NODE_TYPES.TSInterfaceDeclaration ||
parent.type === utils_1.AST_NODE_TYPES.TSTypeAliasDeclaration ||
(parent.type === utils_1.AST_NODE_TYPES.VariableDeclaration && parent.declare)) {
return true;
}
}
return false;
}
function checkIfMethod(symbol, ignoreStatic) {
const { valueDeclaration } = symbol;
if (!valueDeclaration) {
// working around https://github.com/microsoft/TypeScript/issues/31294
return { dangerous: false };
}
switch (valueDeclaration.kind) {
case ts.SyntaxKind.PropertyDeclaration:
return {
dangerous: valueDeclaration.initializer?.kind ===
ts.SyntaxKind.FunctionExpression,
};
case ts.SyntaxKind.PropertyAssignment: {
const assignee = valueDeclaration.initializer;
if (assignee.kind !== ts.SyntaxKind.FunctionExpression) {
return {
dangerous: false,
};
}
return checkMethod(assignee, ignoreStatic);
}
case ts.SyntaxKind.MethodDeclaration:
case ts.SyntaxKind.MethodSignature: {
return checkMethod(valueDeclaration, ignoreStatic);
}
}
return { dangerous: false };
}
function checkMethod(valueDeclaration, ignoreStatic) {
const firstParam = valueDeclaration.parameters.at(0);
const firstParamIsThis = firstParam?.name.kind === ts.SyntaxKind.Identifier &&
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
firstParam.name.escapedText === 'this';
const thisArgIsVoid = firstParamIsThis && firstParam.type?.kind === ts.SyntaxKind.VoidKeyword;
return {
dangerous: !thisArgIsVoid &&
!(ignoreStatic &&
tsutils.includesModifier((0, util_1.getModifiers)(valueDeclaration), ts.SyntaxKind.StaticKeyword)),
firstParamIsThis,
};
}
function isSafeUse(node) {
const parent = node.parent;
switch (parent?.type) {
case utils_1.AST_NODE_TYPES.IfStatement:
case utils_1.AST_NODE_TYPES.ForStatement:
case utils_1.AST_NODE_TYPES.MemberExpression:
case utils_1.AST_NODE_TYPES.SwitchStatement:
case utils_1.AST_NODE_TYPES.UpdateExpression:
case utils_1.AST_NODE_TYPES.WhileStatement:
return true;
case utils_1.AST_NODE_TYPES.CallExpression:
return parent.callee === node;
case utils_1.AST_NODE_TYPES.ConditionalExpression:
return parent.test === node;
case utils_1.AST_NODE_TYPES.TaggedTemplateExpression:
return parent.tag === node;
case utils_1.AST_NODE_TYPES.UnaryExpression:
// the first case is safe for obvious
// reasons. The second one is also fine
// since we're returning something falsy
return ['!', 'delete', 'typeof', 'void'].includes(parent.operator);
case utils_1.AST_NODE_TYPES.BinaryExpression:
return ['!=', '!==', '==', '===', 'instanceof'].includes(parent.operator);
case utils_1.AST_NODE_TYPES.AssignmentExpression:
return (parent.operator === '=' &&
(node === parent.left ||
(node.type === utils_1.AST_NODE_TYPES.MemberExpression &&
node.object.type === utils_1.AST_NODE_TYPES.Super &&
parent.left.type === utils_1.AST_NODE_TYPES.MemberExpression &&
parent.left.object.type === utils_1.AST_NODE_TYPES.ThisExpression)));
case utils_1.AST_NODE_TYPES.ChainExpression:
case utils_1.AST_NODE_TYPES.TSNonNullExpression:
case utils_1.AST_NODE_TYPES.TSAsExpression:
case utils_1.AST_NODE_TYPES.TSTypeAssertion:
return isSafeUse(parent);
case utils_1.AST_NODE_TYPES.LogicalExpression:
if (parent.operator === '&&' && parent.left === node) {
// this is safe, as && will return the left if and only if it's falsy
return true;
}
// in all other cases, it's likely the logical expression will return the method ref
// so make sure the parent is a safe usage
return isSafeUse(parent);
}
return false;
}
@@ -0,0 +1,14 @@
declare const purple: {
50: string;
100: string;
200: string;
300: string;
400: string;
500: string;
600: string;
700: string;
800: string;
900: string;
};
export { purple };
@@ -0,0 +1,3 @@
declare const TypeError: TypeErrorConstructor
export = TypeError;
@@ -0,0 +1 @@
{"version":3,"file":"verifyJWT.d.ts","sourceRoot":"","sources":["../../src/metadata/verifyJWT.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CA0B9E"}
@@ -0,0 +1 @@
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAyDA,IAAM,cAAc,GAAoB;IACtC,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;IAClB,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;IACjB,aAAa,EAAE,GAAG;IAClB,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF,SAAgB,mBAAmB,CAAC,OAAuB;IACzD,IAAM,SAAS,yBAAyB,cAAc,GAAK,OAAO,CAAE,CAAC;IAErE,IAAI,SAAS,CAAC,aAAa,GAAG,CAAC,EAAE;QAC/B,SAAS,CAAC,aAAa,GAAG,CAAC,CAAC;KAC7B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AARD,kDAQC"}
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateSetMetadataWithList = exports.updateReflectMetadata = exports.updateOwnReflectMetadata = exports.setReflectMetadata = exports.getReflectMetadata = exports.getOwnReflectMetadata = exports.buildEmptySetMetadata = exports.buildEmptyMapMetadata = exports.buildEmptyArrayMetadata = exports.buildArrayMetadataWithIndex = exports.buildArrayMetadataWithElement = exports.buildArrayMetadataWithArray = void 0;
const buildArrayMetadataWithArray_1 = require("./reflectMetadata/utils/buildArrayMetadataWithArray");
Object.defineProperty(exports, "buildArrayMetadataWithArray", { enumerable: true, get: function () { return buildArrayMetadataWithArray_1.buildArrayMetadataWithArray; } });
const buildArrayMetadataWithElement_1 = require("./reflectMetadata/utils/buildArrayMetadataWithElement");
Object.defineProperty(exports, "buildArrayMetadataWithElement", { enumerable: true, get: function () { return buildArrayMetadataWithElement_1.buildArrayMetadataWithElement; } });
const buildArrayMetadataWithIndex_1 = require("./reflectMetadata/utils/buildArrayMetadataWithIndex");
Object.defineProperty(exports, "buildArrayMetadataWithIndex", { enumerable: true, get: function () { return buildArrayMetadataWithIndex_1.buildArrayMetadataWithIndex; } });
const buildEmptyArrayMetadata_1 = require("./reflectMetadata/utils/buildEmptyArrayMetadata");
Object.defineProperty(exports, "buildEmptyArrayMetadata", { enumerable: true, get: function () { return buildEmptyArrayMetadata_1.buildEmptyArrayMetadata; } });
const buildEmptyMapMetadata_1 = require("./reflectMetadata/utils/buildEmptyMapMetadata");
Object.defineProperty(exports, "buildEmptyMapMetadata", { enumerable: true, get: function () { return buildEmptyMapMetadata_1.buildEmptyMapMetadata; } });
const buildEmptySetMetadata_1 = require("./reflectMetadata/utils/buildEmptySetMetadata");
Object.defineProperty(exports, "buildEmptySetMetadata", { enumerable: true, get: function () { return buildEmptySetMetadata_1.buildEmptySetMetadata; } });
const getOwnReflectMetadata_1 = require("./reflectMetadata/utils/getOwnReflectMetadata");
Object.defineProperty(exports, "getOwnReflectMetadata", { enumerable: true, get: function () { return getOwnReflectMetadata_1.getOwnReflectMetadata; } });
const getReflectMetadata_1 = require("./reflectMetadata/utils/getReflectMetadata");
Object.defineProperty(exports, "getReflectMetadata", { enumerable: true, get: function () { return getReflectMetadata_1.getReflectMetadata; } });
const setReflectMetadata_1 = require("./reflectMetadata/utils/setReflectMetadata");
Object.defineProperty(exports, "setReflectMetadata", { enumerable: true, get: function () { return setReflectMetadata_1.setReflectMetadata; } });
const updateOwnReflectMetadata_1 = require("./reflectMetadata/utils/updateOwnReflectMetadata");
Object.defineProperty(exports, "updateOwnReflectMetadata", { enumerable: true, get: function () { return updateOwnReflectMetadata_1.updateOwnReflectMetadata; } });
const updateReflectMetadata_1 = require("./reflectMetadata/utils/updateReflectMetadata");
Object.defineProperty(exports, "updateReflectMetadata", { enumerable: true, get: function () { return updateReflectMetadata_1.updateReflectMetadata; } });
const updateSetMetadataWithList_1 = require("./reflectMetadata/utils/updateSetMetadataWithList");
Object.defineProperty(exports, "updateSetMetadataWithList", { enumerable: true, get: function () { return updateSetMetadataWithList_1.updateSetMetadataWithList; } });
//# sourceMappingURL=index.js.map
@@ -0,0 +1,41 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("eslint-utils")
module.exports = {
meta: {
docs: {
description: "disallow the `JSON` class.",
category: "ES5",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-json.html",
},
fixable: null,
messages: {
forbidden: "ES5 '{{name}}' class is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"() {
const tracker = new ReferenceTracker(context.getScope())
for (const { node, path } of tracker.iterateGlobalReferences({
JSON: { [READ]: true },
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,23 @@
import defineProperty from "./defineProperty.js";
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function (r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
defineProperty(e, r, t[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
}
return e;
}
export { _objectSpread2 as default };
@@ -0,0 +1 @@
{"name":"balanced-match","version":"1.0.2","requiresBuild":false,"files":{"index.js":{"checkedAt":1794532092798,"integrity":"sha512-On+I14WfZSKe2XPS92lPrfgetskE+fzKficLb9X1QFKvV3icK7v09X2e3vLNf/ywEfZm9DoNbjt3blnFcmqUHw==","mode":420,"size":1219},"package.json":{"checkedAt":1794532092798,"integrity":"sha512-Sc4WoEcmCNFuCSsGAoqFTlyA+94wAG/btgiNrpF3Dvh5ZaMvbockdxn7eYH+w969whabnfEY1n1lalN4Yg25wQ==","mode":420,"size":1069},"LICENSE.md":{"checkedAt":1794532092799,"integrity":"sha512-OJZRzHJff6KN+0Xl3oTiMiEmGPStwYdEOVbIcl5WhPOd0lvwQPlVE9F2de0t5xiPoRDmabkZh62VapXCJKzCUQ==","mode":420,"size":1096},"README.md":{"checkedAt":1794532092799,"integrity":"sha512-1aLuAwBwaFDuKgITe09b0qLG7m3apKOatp9257NArTfHQsR755gSKZhacBKxoXWYEvootkJFOzvbEpS3r3il8A==","mode":420,"size":3502},".github/FUNDING.yml":{"checkedAt":1794532092799,"integrity":"sha512-0gDr7nLxDDZ91NG6c++h87vNoDSkjotzVezJvS6yQazB3wQxYOThpd1rIqe3ImbLkKGJ6bR+bLkBKwQKayTYcQ==","mode":420,"size":53}}}
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var SliderThumbRole = {
relatedConcepts: [],
type: 'structure'
};
var _default = SliderThumbRole;
exports.default = _default;
@@ -0,0 +1,39 @@
// Uyghur (China) [ug-cn]
import dayjs from '../index';
var locale = {
name: 'ug-cn',
weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split('_'),
months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split('_'),
weekStart: 1,
weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split('_'),
weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
ordinal: function ordinal(n) {
return n;
},
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'YYYY-MM-DD',
LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى',
LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm',
LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm'
},
relativeTime: {
future: '%s كېيىن',
past: '%s بۇرۇن',
s: 'نەچچە سېكونت',
m: 'بىر مىنۇت',
mm: '%d مىنۇت',
h: 'بىر سائەت',
hh: '%d سائەت',
d: 'بىر كۈن',
dd: '%d كۈن',
M: 'بىر ئاي',
MM: '%d ئاي',
y: 'بىر يىل',
yy: '%d يىل'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1 @@
{"name":"process-nextick-args","version":"2.0.1","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532101478,"integrity":"sha512-ZJXMBOqzsFoturx5BnAMoHLgcXGdFFpAPLoE7t3cdwBsmSXGgpI7EuYBleubtENX5ofsioifuD6g95EIf+lelA==","mode":420,"size":578},"index.js":{"checkedAt":1794532101478,"integrity":"sha512-68FhVmcwOzUXwzD60NF7oOtHNp0Pm537BRt70vBIHC2IX0UYpZptBNGLwUd5Valz2Ed9qAe4Kw7Ue5pGG51vHw==","mode":420,"size":1083},"license.md":{"checkedAt":1794532101478,"integrity":"sha512-Xm5PTOiImOsmOpmZ4kcw8jJTVX6R7l1oUB0hMPFUh7vloiw0ufXEGhCfUmsHWwWW+fl2FbmpDDNt0F0fGn14IQ==","mode":420,"size":1064},"readme.md":{"checkedAt":1794532101478,"integrity":"sha512-cwoFuY3H7kzvWzslHlJc5mrWQqnErdW5vC3Mt91Yh1Z+S7TNO9J+gHfUSO+ktQUYGn4kyXogOZD1sSIbWrHjfg==","mode":420,"size":450}}}
@@ -0,0 +1,114 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.isUnsafeAssignment = isUnsafeAssignment;
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const predicates_1 = require("./predicates");
/**
* Does a simple check to see if there is an any being assigned to a non-any type.
*
* This also checks generic positions to ensure there's no unsafe sub-assignments.
* Note: in the case of generic positions, it makes the assumption that the two types are the same.
*
* @example See tests for examples
*
* @returns false if it's safe, or an object with the two types if it's unsafe
*/
function isUnsafeAssignment(type, receiver, checker, senderNode) {
return isUnsafeAssignmentWorker(type, receiver, checker, senderNode, new Map());
}
function isUnsafeAssignmentWorker(type, receiver, checker, senderNode, visited) {
if ((0, predicates_1.isTypeAnyType)(type)) {
// Allow assignment of any ==> unknown.
if ((0, predicates_1.isTypeUnknownType)(receiver)) {
return false;
}
if (!(0, predicates_1.isTypeAnyType)(receiver)) {
return { receiver, sender: type };
}
}
const typeAlreadyVisited = visited.get(type);
if (typeAlreadyVisited) {
if (typeAlreadyVisited.has(receiver)) {
return false;
}
typeAlreadyVisited.add(receiver);
}
else {
visited.set(type, new Set([receiver]));
}
if (tsutils.isTypeReference(type) && tsutils.isTypeReference(receiver)) {
// TODO - figure out how to handle cases like this,
// where the types are assignable, but not the same type
/*
function foo(): ReadonlySet<number> { return new Set<any>(); }
// and
type Test<T> = { prop: T }
type Test2 = { prop: string }
declare const a: Test<any>;
const b: Test2 = a;
*/
if (type.target !== receiver.target) {
// if the type references are different, assume safe, as we won't know how to compare the two types
// the generic positions might not be equivalent for both types
return false;
}
if (senderNode?.type === utils_1.AST_NODE_TYPES.NewExpression &&
senderNode.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
senderNode.callee.name === 'Map' &&
senderNode.arguments.length === 0 &&
senderNode.typeArguments == null) {
// special case to handle `new Map()`
// unfortunately Map's default empty constructor is typed to return `Map<any, any>` :(
// https://github.com/typescript-eslint/typescript-eslint/issues/2109#issuecomment-634144396
return false;
}
const typeArguments = type.typeArguments ?? [];
const receiverTypeArguments = receiver.typeArguments ?? [];
for (let i = 0; i < typeArguments.length; i += 1) {
const arg = typeArguments[i];
const receiverArg = receiverTypeArguments[i];
const unsafe = isUnsafeAssignmentWorker(arg, receiverArg, checker, senderNode, visited);
if (unsafe) {
return { receiver, sender: type };
}
}
return false;
}
return false;
}
@@ -0,0 +1 @@
{"name":"normalize-path","version":"2.1.1","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532124085,"integrity":"sha512-hJ1zDdM4Yg8zp1sNWHF2yh7scSS10VYvMAdGuByuVl610WhY2wxziH+bm2R4lX1uA8Jnz4I407Yw2AXqf2t4aA==","mode":420,"size":1784},"README.md":{"checkedAt":1794532124085,"integrity":"sha512-4f0FpDRqO3skpeP6DoMe4076Hf4bhqqQfYRLt99lhf7RSo65NiinguBBj45cZ0bta+fwfShobLYvJnYaBPZlVg==","mode":420,"size":5085},"LICENSE":{"checkedAt":1794532124085,"integrity":"sha512-tvfTdJiWJDiFPpsR/I9WZSs0oBmhGFXq7UhlakT0rx9viP394eXYZoTSYAH9KLC6LQkxkGWAeqY2WHVWHwxwPQ==","mode":420,"size":1087},"index.js":{"checkedAt":1794532124085,"integrity":"sha512-yjuKDEi3loFLITg3c3zH39/YSquRT00N/hBZRKln7jo6yWJU+FljfP/MtVcYa6fozO7OkZAeXFhmjFxa1dYBjg==","mode":420,"size":505}}}
@@ -0,0 +1,170 @@
'use strict';
const stringify = require('./lib/stringify');
const compile = require('./lib/compile');
const expand = require('./lib/expand');
const parse = require('./lib/parse');
/**
* Expand the given pattern or create a regex-compatible string.
*
* ```js
* const braces = require('braces');
* console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
* console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
* ```
* @param {String} `str`
* @param {Object} `options`
* @return {String}
* @api public
*/
const braces = (input, options = {}) => {
let output = [];
if (Array.isArray(input)) {
for (const pattern of input) {
const result = braces.create(pattern, options);
if (Array.isArray(result)) {
output.push(...result);
} else {
output.push(result);
}
}
} else {
output = [].concat(braces.create(input, options));
}
if (options && options.expand === true && options.nodupes === true) {
output = [...new Set(output)];
}
return output;
};
/**
* Parse the given `str` with the given `options`.
*
* ```js
* // braces.parse(pattern, [, options]);
* const ast = braces.parse('a/{b,c}/d');
* console.log(ast);
* ```
* @param {String} pattern Brace pattern to parse
* @param {Object} options
* @return {Object} Returns an AST
* @api public
*/
braces.parse = (input, options = {}) => parse(input, options);
/**
* Creates a braces string from an AST, or an AST node.
*
* ```js
* const braces = require('braces');
* let ast = braces.parse('foo/{a,b}/bar');
* console.log(stringify(ast.nodes[2])); //=> '{a,b}'
* ```
* @param {String} `input` Brace pattern or AST.
* @param {Object} `options`
* @return {Array} Returns an array of expanded values.
* @api public
*/
braces.stringify = (input, options = {}) => {
if (typeof input === 'string') {
return stringify(braces.parse(input, options), options);
}
return stringify(input, options);
};
/**
* Compiles a brace pattern into a regex-compatible, optimized string.
* This method is called by the main [braces](#braces) function by default.
*
* ```js
* const braces = require('braces');
* console.log(braces.compile('a/{b,c}/d'));
* //=> ['a/(b|c)/d']
* ```
* @param {String} `input` Brace pattern or AST.
* @param {Object} `options`
* @return {Array} Returns an array of expanded values.
* @api public
*/
braces.compile = (input, options = {}) => {
if (typeof input === 'string') {
input = braces.parse(input, options);
}
return compile(input, options);
};
/**
* Expands a brace pattern into an array. This method is called by the
* main [braces](#braces) function when `options.expand` is true. Before
* using this method it's recommended that you read the [performance notes](#performance))
* and advantages of using [.compile](#compile) instead.
*
* ```js
* const braces = require('braces');
* console.log(braces.expand('a/{b,c}/d'));
* //=> ['a/b/d', 'a/c/d'];
* ```
* @param {String} `pattern` Brace pattern
* @param {Object} `options`
* @return {Array} Returns an array of expanded values.
* @api public
*/
braces.expand = (input, options = {}) => {
if (typeof input === 'string') {
input = braces.parse(input, options);
}
let result = expand(input, options);
// filter out empty strings if specified
if (options.noempty === true) {
result = result.filter(Boolean);
}
// filter out duplicates if specified
if (options.nodupes === true) {
result = [...new Set(result)];
}
return result;
};
/**
* Processes a brace pattern and returns either an expanded array
* (if `options.expand` is true), a highly optimized regex-compatible string.
* This method is called by the main [braces](#braces) function.
*
* ```js
* const braces = require('braces');
* console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
* //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
* ```
* @param {String} `pattern` Brace pattern
* @param {Object} `options`
* @return {Array} Returns an array of expanded values.
* @api public
*/
braces.create = (input, options = {}) => {
if (input === '' || input.length < 3) {
return [input];
}
return options.expand !== true
? braces.compile(input, options)
: braces.expand(input, options);
};
/**
* Expose "braces"
*/
module.exports = braces;
@@ -0,0 +1,62 @@
import { camelCase } from './utilities';
describe('camelCase', () => {
it('returns "" for empty string', () => {
expect(camelCase('')).toBe('');
});
// no hyphen
it.each([
['foo', 'foo'],
['fooBar', 'fooBar'],
])('does not transform "%s"', (property, expected) => {
expect(camelCase(property)).toBe(expected);
});
// custom property
it.each([
['--fooBar', '--fooBar'],
['--foo-bar', '--foo-bar'],
['--foo-100', '--foo-100'],
['--test_ing', '--test_ing'],
])('does not transform custom property "%s"', (property, expected) => {
expect(camelCase(property)).toBe(expected);
});
// vendor prefix
it.each([
['-khtml-transition', 'khtmlTransition'],
['-moz-user-select', 'mozUserSelect'],
['-ms-transform', 'msTransform'],
['-ms-user-select', 'msUserSelect'],
['-o-transition', 'oTransition'],
['-webkit-transition', 'webkitTransition'],
['-webkit-user-select', 'webkitUserSelect'],
])('transforms vendor prefix "%s" to "%s"', (property, expected) => {
expect(camelCase(property)).toBe(expected);
});
it.each([
['foo-bar', 'fooBar'],
['foo-bar-baz', 'fooBarBaz'],
['CAMEL-CASE', 'camelCase'],
])('transforms "%s" to "%s"', (property, expected) => {
expect(camelCase(property)).toBe(expected);
});
describe('option reactCompat is true', () => {
const options = { reactCompat: true };
it.each([
['-khtml-transition', 'KhtmlTransition'],
['-o-transition', 'OTransition'],
['-moz-user-select', 'MozUserSelect'],
['-ms-transform', 'msTransform'],
['-ms-user-select', 'msUserSelect'],
['-webkit-transition', 'WebkitTransition'],
['-webkit-user-select', 'WebkitUserSelect'],
])('capitalizes vendor prefix "%s" to "%s"', (property, expected) => {
expect(camelCase(property, options)).toBe(expected);
});
});
});
@@ -0,0 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { IconSvgProps } from './types.js';
import 'react';
declare const LoadingIcon: (props: IconSvgProps) => react_jsx_runtime.JSX.Element;
export { LoadingIcon };
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/has-property-descriptors
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,53 @@
"use client";
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/card-body.tsx
var card_body_exports = {};
__export(card_body_exports, {
default: () => card_body_default
});
module.exports = __toCommonJS(card_body_exports);
var import_system = require("@heroui/system");
var import_react_utils2 = require("@heroui/react-utils");
var import_shared_utils = require("@heroui/shared-utils");
// src/card-context.ts
var import_react_utils = require("@heroui/react-utils");
var [CardProvider, useCardContext] = (0, import_react_utils.createContext)({
name: "CardContext",
strict: true,
errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
});
// src/card-body.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var CardBody = (0, import_system.forwardRef)((props, ref) => {
var _a;
const { as, className, children, ...otherProps } = props;
const Component = as || "div";
const domRef = (0, import_react_utils2.useDOMRef)(ref);
const { slots, classNames } = useCardContext();
const bodyStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.body, className);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: domRef, className: (_a = slots.body) == null ? void 0 : _a.call(slots, { class: bodyStyles }), ...otherProps, children });
});
CardBody.displayName = "HeroUI.CardBody";
var card_body_default = CardBody;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
@@ -0,0 +1,149 @@
# ccount
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
Count how often a character (or substring) is used in a string.
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`ccount(value, character)`](#ccountvalue-character)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package is a small utility that helps you find how frequently a substring
occurs in another string.
## When should I use this?
I find this particularly useful when generating code, for example, when building
a string that can either be double or single quoted.
I use this utility to choose single quotes when double quotes are used more
frequently, and double quotes otherwise.
## Install
This package is [ESM only][esm].
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
```sh
npm install ccount
```
In Deno with [Skypack][]:
```js
import {ccount} from 'https://cdn.skypack.dev/ccount@2?dts'
```
In browsers with [Skypack][]:
```html
<script type="module">
import {ccount} from 'https://cdn.skypack.dev/ccount@2?min'
</script>
```
## Use
```js
import {ccount} from 'ccount'
ccount('foo(bar(baz)', '(') // => 2
ccount('foo(bar(baz)', ')') // => 1
```
## API
This package exports the following identifier: `ccount`.
There is no default export.
### `ccount(value, character)`
Count how often a character (or substring) is used in a string.
###### Parameters
* `value` (`string`)
— value to search in
* `character` (`string`)
— character (or substring) to look for
###### Returns
`number` — number of times `character` occurred in `value`.
## Types
This package is fully typed with [TypeScript][].
## Compatibility
This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
It also works in Deno and modern browsers.
## Security
This package is safe.
## Related
* [`wooorm/longest-streak`](https://github.com/wooorm/longest-streak)
— count of longest repeating streak of `character` in `value`
* [`wooorm/direction`](https://github.com/wooorm/direction)
— detect directionality: left-to-right, right-to-left, or neutral
## Contribute
Yes please!
See [How to Contribute to Open Source][contribute].
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[build-badge]: https://github.com/wooorm/ccount/workflows/main/badge.svg
[build]: https://github.com/wooorm/ccount/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/ccount.svg
[coverage]: https://codecov.io/github/wooorm/ccount
[downloads-badge]: https://img.shields.io/npm/dm/ccount.svg
[downloads]: https://www.npmjs.com/package/ccount
[size-badge]: https://img.shields.io/bundlephobia/minzip/ccount.svg
[size]: https://bundlephobia.com/result?p=ccount
[npm]: https://docs.npmjs.com/cli/install
[skypack]: https://www.skypack.dev
[license]: license
[author]: https://wooorm.com
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[typescript]: https://www.typescriptlang.org
[contribute]: https://opensource.guide/how-to-contribute/
@@ -0,0 +1,6 @@
'use strict';
module.exports = {
map: require('./lib/map'),
mapSeries: require('./lib/mapSeries'),
};
@@ -0,0 +1 @@
{"version":3,"names":["_fs","data","require","_path","_debug","_t","_convertSourceMap","_file","_index","_cloneDeep","file","traverseFast","debug","buildDebug","INLINE_SOURCEMAP_REGEX","EXTERNAL_SOURCEMAP_REGEX","normalizeFile","pluginPasses","options","code","ast","type","Error","cloneInputAst","cloneDeep","parser","inputMap","inputSourceMap","convertSourceMap","fromObject","lastComment","extractComments","fromComment","err","filename","match","exec","inputMapContent","fs","readFileSync","path","resolve","dirname","fromJSON","File","extractCommentsFromList","regex","comments","filter","value","test","node","leadingComments","innerComments","trailingComments"],"sources":["../../src/transformation/normalize-file.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport buildDebug from \"debug\";\nimport type { Handler } from \"gensync\";\nimport { file, traverseFast } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { PluginPasses } from \"../config/index.ts\";\nimport convertSourceMap from \"convert-source-map\";\nimport type { SourceMapConverter as Converter } from \"convert-source-map\";\nimport File from \"./file/file.ts\";\nimport parser from \"../parser/index.ts\";\nimport cloneDeep from \"./util/clone-deep.ts\";\nimport type { ResolvedOptions } from \"../config/validation/options.ts\";\n\nconst debug = buildDebug(\"babel:transform:file\");\n\n// These regexps are copied from the convert-source-map package,\n// but without // or /* at the beginning of the comment.\n\nconst INLINE_SOURCEMAP_REGEX =\n /^[@#]\\s+sourceMappingURL=data:(?:application|text)\\/json;(?:charset[:=]\\S+?;)?base64,.*$/;\nconst EXTERNAL_SOURCEMAP_REGEX =\n /^[@#][ \\t]+sourceMappingURL=([^\\s'\"`]+)[ \\t]*$/;\n\nexport type NormalizedFile = {\n code: string;\n ast: t.File;\n inputMap: Converter | null;\n};\n\nexport default function* normalizeFile(\n pluginPasses: PluginPasses,\n options: ResolvedOptions,\n code: string,\n ast?: t.File | t.Program | null,\n): Handler<File> {\n code = `${code || \"\"}`;\n\n if (ast) {\n if (ast.type === \"Program\") {\n ast = file(ast, [], []);\n } else if (ast.type !== \"File\") {\n throw new Error(\"AST root must be a Program or File node\");\n }\n\n if (options.cloneInputAst) {\n ast = cloneDeep(ast);\n }\n } else {\n ast = yield* parser(pluginPasses, options, code);\n }\n\n let inputMap = null;\n if (options.inputSourceMap !== false) {\n // If an explicit object is passed in, it overrides the processing of\n // source maps that may be in the file itself.\n if (typeof options.inputSourceMap === \"object\") {\n inputMap = convertSourceMap.fromObject(options.inputSourceMap);\n }\n\n if (!inputMap) {\n const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);\n if (lastComment) {\n try {\n inputMap = convertSourceMap.fromComment(\"//\" + lastComment);\n } catch (err) {\n if (process.env.BABEL_8_BREAKING) {\n console.warn(\n \"discarding unknown inline input sourcemap\",\n options.filename,\n err,\n );\n } else {\n debug(\"discarding unknown inline input sourcemap\");\n }\n }\n }\n }\n\n if (!inputMap) {\n const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);\n if (typeof options.filename === \"string\" && lastComment) {\n try {\n // when `lastComment` is non-null, EXTERNAL_SOURCEMAP_REGEX must have matches\n const match: [string, string] = EXTERNAL_SOURCEMAP_REGEX.exec(\n lastComment,\n ) as any;\n const inputMapContent = fs.readFileSync(\n path.resolve(path.dirname(options.filename), match[1]),\n \"utf8\",\n );\n inputMap = convertSourceMap.fromJSON(inputMapContent);\n } catch (err) {\n debug(\"discarding unknown file input sourcemap\", err);\n }\n } else if (lastComment) {\n debug(\"discarding un-loadable file input sourcemap\");\n }\n }\n }\n\n return new File(options, {\n code,\n ast: ast,\n inputMap,\n });\n}\n\nfunction extractCommentsFromList(\n regex: RegExp,\n comments: t.Comment[],\n lastComment: string | null,\n): [t.Comment[], string | null] {\n if (comments) {\n comments = comments.filter(({ value }) => {\n if (regex.test(value)) {\n lastComment = value;\n return false;\n }\n return true;\n });\n }\n return [comments, lastComment];\n}\n\nfunction extractComments(regex: RegExp, ast: t.Node) {\n let lastComment: string = null;\n traverseFast(ast, node => {\n [node.leadingComments, lastComment] = extractCommentsFromList(\n regex,\n node.leadingComments,\n lastComment,\n );\n [node.innerComments, lastComment] = extractCommentsFromList(\n regex,\n node.innerCLine truncated
@@ -0,0 +1,134 @@
var $g3RPq$react = require("react");
var $g3RPq$reactariainteractions = require("@react-aria/interactions");
var $g3RPq$reactariautils = require("@react-aria/utils");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useSafelyMouseToSubmenu", () => $62347d8c4183e713$export$85ec83e04c95f50a);
const $62347d8c4183e713$var$ALLOWED_INVALID_MOVEMENTS = 2;
const $62347d8c4183e713$var$THROTTLE_TIME = 50;
const $62347d8c4183e713$var$TIMEOUT_TIME = 1000;
const $62347d8c4183e713$var$ANGLE_PADDING = Math.PI / 12; // 15°
function $62347d8c4183e713$export$85ec83e04c95f50a(options) {
let { menuRef: menuRef, submenuRef: submenuRef, isOpen: isOpen, isDisabled: isDisabled } = options;
let prevPointerPos = (0, $g3RPq$react.useRef)(undefined);
let submenuRect = (0, $g3RPq$react.useRef)(undefined);
let lastProcessedTime = (0, $g3RPq$react.useRef)(0);
let timeout = (0, $g3RPq$react.useRef)(undefined);
let autoCloseTimeout = (0, $g3RPq$react.useRef)(undefined);
let submenuSide = (0, $g3RPq$react.useRef)(undefined);
let movementsTowardsSubmenuCount = (0, $g3RPq$react.useRef)(2);
let [preventPointerEvents, setPreventPointerEvents] = (0, $g3RPq$react.useState)(false);
let updateSubmenuRect = ()=>{
if (submenuRef.current) {
submenuRect.current = submenuRef.current.getBoundingClientRect();
submenuSide.current = undefined;
}
};
(0, $g3RPq$reactariautils.useResizeObserver)({
ref: submenuRef,
onResize: updateSubmenuRect
});
let reset = ()=>{
setPreventPointerEvents(false);
movementsTowardsSubmenuCount.current = $62347d8c4183e713$var$ALLOWED_INVALID_MOVEMENTS;
prevPointerPos.current = undefined;
};
let modality = (0, $g3RPq$reactariainteractions.useInteractionModality)();
(0, $g3RPq$react.useEffect)(()=>{
if (preventPointerEvents && menuRef.current) menuRef.current.style.pointerEvents = 'none';
else menuRef.current.style.pointerEvents = '';
}, [
menuRef,
preventPointerEvents
]);
(0, $g3RPq$react.useEffect)(()=>{
let submenu = submenuRef.current;
let menu = menuRef.current;
if (isDisabled || !submenu || !isOpen || modality !== 'pointer' || !menu) {
reset();
return;
}
submenuRect.current = submenu.getBoundingClientRect();
let onPointerMove = (e)=>{
if (e.pointerType === 'touch' || e.pointerType === 'pen') return;
let currentTime = Date.now();
// Throttle
if (currentTime - lastProcessedTime.current < $62347d8c4183e713$var$THROTTLE_TIME) return;
clearTimeout(timeout.current);
clearTimeout(autoCloseTimeout.current);
let { clientX: mouseX, clientY: mouseY } = e;
if (!prevPointerPos.current) {
prevPointerPos.current = {
x: mouseX,
y: mouseY
};
return;
}
if (!submenuRect.current) return;
if (!submenuSide.current) submenuSide.current = mouseX > submenuRect.current.right ? 'left' : 'right';
// Pointer is outside of parent menu
if (mouseX < menu.getBoundingClientRect().left || mouseX > menu.getBoundingClientRect().right || mouseY < menu.getBoundingClientRect().top || mouseY > menu.getBoundingClientRect().bottom) {
reset();
return;
}
/* Check if pointer is moving towards submenu.
Uses the 2-argument arctangent (https://en.wikipedia.org/wiki/Atan2) to calculate:
- angle between previous pointer and top of submenu
- angle between previous pointer and bottom of submenu
- angle between previous pointer and current pointer (delta)
If the pointer delta angle value is between the top and bottom angle values, we know the pointer is moving towards the submenu.
*/ let prevMouseX = prevPointerPos.current.x;
let prevMouseY = prevPointerPos.current.y;
let toSubmenuX = submenuSide.current === 'right' ? submenuRect.current.left - prevMouseX : prevMouseX - submenuRect.current.right;
let angleTop = Math.atan2(prevMouseY - submenuRect.current.top, toSubmenuX) + $62347d8c4183e713$var$ANGLE_PADDING;
let angleBottom = Math.atan2(prevMouseY - submenuRect.current.bottom, toSubmenuX) - $62347d8c4183e713$var$ANGLE_PADDING;
let anglePointer = Math.atan2(prevMouseY - mouseY, submenuSide.current === 'left' ? -(mouseX - prevMouseX) : mouseX - prevMouseX);
let isMovingTowardsSubmenu = anglePointer < angleTop && anglePointer > angleBottom;
movementsTowardsSubmenuCount.current = isMovingTowardsSubmenu ? Math.min(movementsTowardsSubmenuCount.current + 1, $62347d8c4183e713$var$ALLOWED_INVALID_MOVEMENTS) : Math.max(movementsTowardsSubmenuCount.current - 1, 0);
if (movementsTowardsSubmenuCount.current >= $62347d8c4183e713$var$ALLOWED_INVALID_MOVEMENTS) setPreventPointerEvents(true);
else setPreventPointerEvents(false);
lastProcessedTime.current = currentTime;
prevPointerPos.current = {
x: mouseX,
y: mouseY
};
// If the pointer is moving towards the submenu, start a timeout to close if no other movements are made after 500ms.
if (isMovingTowardsSubmenu) timeout.current = setTimeout(()=>{
reset();
autoCloseTimeout.current = setTimeout(()=>{
// Fire a pointerover event to trigger the menu to close.
// Wait until pointer-events:none is no longer applied
let target = document.elementFromPoint(mouseX, mouseY);
if (target && menu.contains(target)) target.dispatchEvent(new PointerEvent('pointerover', {
bubbles: true,
cancelable: true
}));
}, 100);
}, $62347d8c4183e713$var$TIMEOUT_TIME);
};
window.addEventListener('pointermove', onPointerMove);
return ()=>{
window.removeEventListener('pointermove', onPointerMove);
clearTimeout(timeout.current);
clearTimeout(autoCloseTimeout.current);
movementsTowardsSubmenuCount.current = $62347d8c4183e713$var$ALLOWED_INVALID_MOVEMENTS;
};
}, [
isDisabled,
isOpen,
menuRef,
modality,
setPreventPointerEvents,
submenuRef
]);
}
//# sourceMappingURL=useSafelyMouseToSubmenu.main.js.map
@@ -0,0 +1 @@
{"version":3,"file":"resolveBindingsDeactivations.js","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveBindingsDeactivations.ts"],"names":[],"mappings":";;AAsBA,oEAyBC;AA7CD,gFAA6E;AAE7E,oEAAuE;AAKvE,+EAA4E;AAE5E,MAAM,cAAc,GAIhB,OAAO,CAAC;AAOZ,SAAgB,4BAA4B,CAC1C,MAA0B,EAC1B,QAAuC;IAEvC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,uBAAuB,GAC3B,oCAAoC,CAAC,QAAQ,CAAC,CAAC;IAEjD,MAAM,0BAA0B,GAAoB,EAAE,CAAC;IAEvD,KAAK,MAAM,OAAO,IAAI,uBAAuB,EAAE,CAAC;QAC9C,MAAM,kBAAkB,GACtB,IAAA,yDAA2B,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE/C,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACrC,0BAA0B,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,IAAI,0BAA0B,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,SAAS,oCAAoC,CAC3C,QAA2B;IAE3B,MAAM,gBAAgB,GAA4C,EAAE,CAAC;IAErE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IACE,IAAA,iCAAe,EAAC,OAAO,CAAC;YACxB,OAAO,CAAC,KAAK,KAAK,iCAAkB,CAAC,SAAS;YAC9C,OAAO,CAAC,KAAK,CAAC,OAAO,EACrB,CAAC;YACD,gBAAgB,CAAC,IAAI,CAAC,OAAgD,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"isNotParentBindingConstraintsWithServiceId.d.ts","sourceRoot":"","sources":["../../../../src/binding/calculations/isNotParentBindingConstraintsWithServiceId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAKvD,wBAAgB,0CAA0C,CACxD,SAAS,EAAE,iBAAiB,GAC3B,CAAC,WAAW,EAAE,kBAAkB,KAAK,OAAO,CAI9C"}
@@ -0,0 +1,17 @@
import copyObject from './_copyObject.js';
import keysIn from './keysIn.js';
/**
* The base implementation of `_.assignIn` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
export default baseAssignIn;
@@ -0,0 +1,20 @@
import * as React from 'react';
type ReactRef<T> = React.RefObject<T> | React.MutableRefObject<T> | React.Ref<T>;
/**
* Assigns a value to a ref function or object
*
* @param ref the ref to assign to
* @param value the value
*/
declare function assignRef<T = any>(ref: ReactRef<T> | undefined, value: T): void;
/**
* Combine multiple React refs into a single ref function.
* This is used mostly when you need to allow consumers forward refs to
* internal components
*
* @param refs refs to assign to value to
*/
declare function mergeRefs<T>(...refs: (ReactRef<T> | undefined)[]): (node: T | null) => void;
export { ReactRef, assignRef, mergeRefs };
@@ -0,0 +1,61 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _eachOfLimit = require('./internal/eachOfLimit.js');
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
var _awaitify = require('./internal/awaitify.js');
var _awaitify2 = _interopRequireDefault(_awaitify);
var _once = require('./internal/once.js');
var _once2 = _interopRequireDefault(_once);
var _wrapAsync = require('./internal/wrapAsync.js');
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a
* time.
*
* @name mapValuesLimit
* @static
* @memberOf module:Collections
* @method
* @see [async.mapValues]{@link module:Collections.mapValues}
* @category Collection
* @param {Object} obj - A collection to iterate over.
* @param {number} limit - The maximum number of async operations at a time.
* @param {AsyncFunction} iteratee - A function to apply to each value and key
* in `coll`.
* The iteratee should complete with the transformed value as its result.
* Invoked with (value, key, callback).
* @param {Function} [callback] - A callback which is called when all `iteratee`
* functions have finished, or an error occurs. `result` is a new object consisting
* of each key from `obj`, with each transformed value on the right-hand side.
* Invoked with (err, result).
* @returns {Promise} a promise, if no callback is passed
*/
function mapValuesLimit(obj, limit, iteratee, callback) {
callback = (0, _once2.default)(callback);
var newObj = {};
var _iteratee = (0, _wrapAsync2.default)(iteratee);
return (0, _eachOfLimit2.default)(limit)(obj, (val, key, next) => {
_iteratee(val, key, (err, result) => {
if (err) return next(err);
newObj[key] = result;
next(err);
});
}, err => callback(err, newObj));
}
exports.default = (0, _awaitify2.default)(mapValuesLimit, 4);
module.exports = exports.default;
@@ -0,0 +1 @@
{"version":3,"file":"Snapshot.d.ts","sourceRoot":"","sources":["../../../../src/snapshot/models/Snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,QAAQ;IACvB,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB,EAAE,oBAAoB,CAAC;CAC3C"}
@@ -0,0 +1,7 @@
# @stylistic/eslint-plugin
Stylistic rules for ESLint, works for both JavaScript and TypeScript.
This plugin is a merge of `@stylistic/eslint-plugin-js` and `@stylistic/eslint-plugin-ts`.
Check the [documentation](https://eslint.style/packages/default) for more details.
@@ -0,0 +1,119 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createTester = require('./internal/createTester.js');
var _createTester2 = _interopRequireDefault(_createTester);
var _eachOf = require('./eachOf.js');
var _eachOf2 = _interopRequireDefault(_eachOf);
var _awaitify = require('./internal/awaitify.js');
var _awaitify2 = _interopRequireDefault(_awaitify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns `true` if every element in `coll` satisfies an async test. If any
* iteratee call returns `false`, the main `callback` is immediately called.
*
* @name every
* @static
* @memberOf module:Collections
* @method
* @alias all
* @category Collection
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
* in the collection in parallel.
* The iteratee must complete with a boolean result value.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called after all the
* `iteratee` functions have finished. Result will be either `true` or `false`
* depending on the values of the async tests. Invoked with (err, result).
* @returns {Promise} a promise, if no callback provided
* @example
*
* // dir1 is a directory that contains file1.txt, file2.txt
* // dir2 is a directory that contains file3.txt, file4.txt
* // dir3 is a directory that contains file5.txt
* // dir4 does not exist
*
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
*
* // asynchronous function that checks if a file exists
* function fileExists(file, callback) {
* fs.access(file, fs.constants.F_OK, (err) => {
* callback(null, !err);
* });
* }
*
* // Using callbacks
* async.every(fileList, fileExists, function(err, result) {
* console.log(result);
* // true
* // result is true since every file exists
* });
*
* async.every(withMissingFileList, fileExists, function(err, result) {
* console.log(result);
* // false
* // result is false since NOT every file exists
* });
*
* // Using Promises
* async.every(fileList, fileExists)
* .then( result => {
* console.log(result);
* // true
* // result is true since every file exists
* }).catch( err => {
* console.log(err);
* });
*
* async.every(withMissingFileList, fileExists)
* .then( result => {
* console.log(result);
* // false
* // result is false since NOT every file exists
* }).catch( err => {
* console.log(err);
* });
*
* // Using async/await
* async () => {
* try {
* let result = await async.every(fileList, fileExists);
* console.log(result);
* // true
* // result is true since every file exists
* }
* catch (err) {
* console.log(err);
* }
* }
*
* async () => {
* try {
* let result = await async.every(withMissingFileList, fileExists);
* console.log(result);
* // false
* // result is false since NOT every file exists
* }
* catch (err) {
* console.log(err);
* }
* }
*
*/
function every(coll, iteratee, callback) {
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
}
exports.default = (0, _awaitify2.default)(every, 3);
module.exports = exports.default;
@@ -0,0 +1,15 @@
engines:
duplication:
enabled: true
config:
languages:
- javascript
eslint:
enabled: true
channel: "eslint-3"
ratings:
paths:
- "**.js"
exclude_paths:
- "dist/"
- "src/*.spec.js"
@@ -0,0 +1,46 @@
/**
* @author Yosuke Ota
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("@eslint-community/eslint-utils")
const { getSourceCode } = require("eslint-compat-utils")
module.exports = {
meta: {
docs: {
description:
"disallow the `WeakRef` and `FinalizationRegistry` class.",
category: "ES2021",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-weakrefs.html",
},
fixable: null,
messages: {
forbidden: "ES2021 '{{name}}' class is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"(program) {
const sourceCode = getSourceCode(context)
const tracker = new ReferenceTracker(
sourceCode.getScope(program),
)
for (const { node, path } of tracker.iterateGlobalReferences({
FinalizationRegistry: { [READ]: true },
WeakRef: { [READ]: true },
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,23 @@
export { default as adjustHue } from './adjustHue';
export { default as darken } from './darken';
export { default as desaturate } from './desaturate';
export { default as getContrast } from './getContrast';
export { default as getLuminance } from './getLuminance';
export { default as getScale } from './getScale';
export { default as guard } from './guard';
export { default as hasBadContrast } from './hasBadContrast';
export { default as hsla } from './hsla';
export { default as lighten } from './lighten';
export { default as mix } from './mix';
export { default as opacify } from './opacify';
export { default as parseToHsla } from './parseToHsla';
export { default as readableColor } from './readableColor';
export { default as readableColorIsBlack } from './readableColorIsBlack';
export { default as rgba } from './rgba';
export { default as saturate } from './saturate';
export { default as transparentize } from './transparentize';
export { default as parseToRgba } from './parseToRgba';
export { default as ColorError } from './ColorError';
export { default as toHex } from './toHex';
export { default as toRgba } from './toRgba';
export { default as toHsla } from './toHsla';
@@ -0,0 +1,5 @@
function isDOMKeyframes(keyframes) {
return typeof keyframes === "object" && !Array.isArray(keyframes);
}
export { isDOMKeyframes };
@@ -0,0 +1,230 @@
Node.js - jsonfile
================
Easily read/write JSON files in Node.js. _Note: this module cannot be used in the browser._
[![npm Package](https://img.shields.io/npm/v/jsonfile.svg?style=flat-square)](https://www.npmjs.org/package/jsonfile)
[![linux build status](https://img.shields.io/github/actions/workflow/status/jprichardson/node-jsonfile/ci.yml?branch=master)](https://github.com/jprichardson/node-jsonfile/actions?query=branch%3Amaster)
[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-jsonfile/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master)
<a href="https://github.com/feross/standard"><img src="https://cdn.rawgit.com/feross/standard/master/sticker.svg" alt="Standard JavaScript" width="100"></a>
Why?
----
Writing `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying.
Installation
------------
npm install --save jsonfile
API
---
* [`readFile(filename, [options], callback)`](#readfilefilename-options-callback)
* [`readFileSync(filename, [options])`](#readfilesyncfilename-options)
* [`writeFile(filename, obj, [options], callback)`](#writefilefilename-obj-options-callback)
* [`writeFileSync(filename, obj, [options])`](#writefilesyncfilename-obj-options)
----
### readFile(filename, [options], callback)
`options` (`object`, default `undefined`): Pass in any [`fs.readFile`](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
- `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback.
If `false`, returns `null` for the object.
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
jsonfile.readFile(file, function (err, obj) {
if (err) console.error(err)
console.dir(obj)
})
```
You can also use this method with promises. The `readFile` method will return a promise if you do not pass a callback function.
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
jsonfile.readFile(file)
.then(obj => console.dir(obj))
.catch(error => console.error(error))
```
----
### readFileSync(filename, [options])
`options` (`object`, default `undefined`): Pass in any [`fs.readFileSync`](https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_options) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
- `throws` (`boolean`, default: `true`). If an error is encountered reading or parsing the file, throw the error. If `false`, returns `null` for the object.
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
console.dir(jsonfile.readFileSync(file))
```
----
### writeFile(filename, obj, [options], callback)
`options`: Pass in any [`fs.writeFile`](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end.
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFile(file, obj, function (err) {
if (err) console.error(err)
})
```
Or use with promises as follows:
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFile(file, obj)
.then(res => {
console.log('Write complete')
})
.catch(error => console.error(error))
```
**formatting with spaces:**
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFile(file, obj, { spaces: 2 }, function (err) {
if (err) console.error(err)
})
```
**overriding EOL:**
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFile(file, obj, { spaces: 2, EOL: '\r\n' }, function (err) {
if (err) console.error(err)
})
```
**disabling the EOL at the end of file:**
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFile(file, obj, { spaces: 2, finalEOL: false }, function (err) {
if (err) console.log(err)
})
```
**appending to an existing JSON file:**
You can use `fs.writeFile` option `{ flag: 'a' }` to achieve this.
```js
const jsonfile = require('jsonfile')
const file = '/tmp/mayAlreadyExistedData.json'
const obj = { name: 'JP' }
jsonfile.writeFile(file, obj, { flag: 'a' }, function (err) {
if (err) console.error(err)
})
```
----
### writeFileSync(filename, obj, [options])
`options`: Pass in any [`fs.writeFileSync`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end.
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFileSync(file, obj)
```
**formatting with spaces:**
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFileSync(file, obj, { spaces: 2 })
```
**overriding EOL:**
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFileSync(file, obj, { spaces: 2, EOL: '\r\n' })
```
**disabling the EOL at the end of file:**
```js
const jsonfile = require('jsonfile')
const file = '/tmp/data.json'
const obj = { name: 'JP' }
jsonfile.writeFileSync(file, obj, { spaces: 2, finalEOL: false })
```
**appending to an existing JSON file:**
You can use `fs.writeFileSync` option `{ flag: 'a' }` to achieve this.
```js
const jsonfile = require('jsonfile')
const file = '/tmp/mayAlreadyExistedData.json'
const obj = { name: 'JP' }
jsonfile.writeFileSync(file, obj, { flag: 'a' })
```
License
-------
(MIT License)
Copyright 2012-2016, JP Richardson <jprichardson@gmail.com>
@@ -0,0 +1 @@
{"name":"deepmerge","version":"4.3.1","requiresBuild":false,"files":{".editorconfig":{"checkedAt":1794532090089,"integrity":"sha512-i8Gr/3AJXK5eTeigVmQux/pOqupEnEMXmH3CRd9A0E8vAlmcJqg7yb7HD4mafzabMvfIU5OvDXciTfYYnaVdxQ==","mode":420,"size":113},".eslintcache":{"checkedAt":1794532090089,"integrity":"sha512-d/8IkZ8Oxr4H3e9n6/N1wTtfBtvnOINGcguJplVGBooucSA4DCajEhys5AtPfZMqaZJLEZsmVU0m1ysk+BkSGw==","mode":420,"size":382},"dist/cjs.js":{"checkedAt":1794532090089,"integrity":"sha512-4wYhfon4cYGKg/QIV3WIkLc2NGOVvOiNHB0ARF1tk3tjmTPvUd7kh/l70+Rqwuk2lOVldhloGVsQnpatoRhEYQ==","mode":420,"size":4048},"index.js":{"checkedAt":1794532090090,"integrity":"sha512-nW8pslVdZAla+hYnlLS9l6yP8j7na5/H7gRYyNHCjEplgUrI5qEYhR86zdt252yeozi+NVRWZS0uTAO7q6rZBA==","mode":420,"size":3293},"rollup.config.js":{"checkedAt":1794532090090,"integrity":"sha512-VduH5qi7vd8S5qN6nECYNO0wiPpT9ojI0XS7fHli4B3xdJGN5oxxWYfPGY8jOLfaZgPiEj5M569wQJRxd1/a8Q==","mode":420,"size":343},"dist/umd.js":{"checkedAt":1794532090090,"integrity":"sha512-TZvhWeN2tMqLJjTpgr3vTEfQULe14ru1d9L4i+W/mS99FAxm2YYiXzxJvgUYXKNGiycy9z5MnlWDqu30n/NfpQ==","mode":420,"size":4420},"package.json":{"checkedAt":1794532090090,"integrity":"sha512-sttXgenMCBglXiyGnQLRmYuCc5eb79Uqwyq2CpHaD54Fb913XOyEM7mVG1gxMzJZwL41+ovTU2aOMRePOsvklw==","mode":420,"size":1152},"changelog.md":{"checkedAt":1794532090090,"integrity":"sha512-qKLeGTxvufhXpScEb/q/Ir273ZGEfRkfjfMF8Zuk6Lw1tukg73NdNFbZyqgqZjr4HwZGHsFAaWeQRGfhmOVv2Q==","mode":420,"size":9785},"readme.md":{"checkedAt":1794532090090,"integrity":"sha512-LvVv5uil7Gt1e+vGK6NOJoWHr01lgQiPkf+5p+Ic/iu0hUFJ6TsuKtnS6r9MVQ+iZgsJN+/QpIw7YJpSo5PTUQ==","mode":420,"size":5682},"index.d.ts":{"checkedAt":1794532090091,"integrity":"sha512-wSrp4czF97QxsOm3Ucw6oFViAW2HH7qp6H+O5dIxUS04sexAe+AmizgnGuyC2LtaxftENmavIc8rDiR/BBxvGQ==","mode":420,"size":823},"license.txt":{"checkedAt":1794532090091,"integrity":"sha512-T6VKDhvxWrCKRH/kJDl06Ur3yyPyHiESBV0AjUE0MaXP07adXVnWpS9SaeaARS7F/Wkpcnd5YNyngZlTH44o7w==","mode":420,"size":1116}}}
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,gBAAE,CAAC;IACnC,iBAAiB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IACzD,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,iBAAG,CAAC;IAC1C,cAAc,CAAC,gBAAE,CAAC;IAClB,kBAAkB,CAAC,OAAS,CAAC,gCAAI,EAAE,KAAK,UAAU,CAAC,gDAAM,CAAC;IAC1D,sBAAsB,CAAC,+EAAgB,CAAC;IACxC,UAAU,CAAC,gBAAE,CAAC;IACd,aAAa,CAAC,gBAAE,CAAC;IACjB,YAAY,CAAC,wCAAK,CAAC;AACrB","sources":["packages/@react-aria/table/intl/zh-TW.json"],"sourcesContent":["{\n \"ascending\": \"遞增\",\n \"ascendingSort\": \"已依據「{columnName}」欄遞增排序\",\n \"columnSize\": \"{value} 像素\",\n \"descending\": \"遞減\",\n \"descendingSort\": \"已依據「{columnName}」欄遞減排序\",\n \"resizerDescription\": \"按 Enter 鍵以開始調整大小\",\n \"select\": \"選取\",\n \"selectAll\": \"全選\",\n \"sortable\": \"可排序的欄\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
@@ -0,0 +1,84 @@
'use strict'
const DuplexStream = require('readable-stream').Duplex
const inherits = require('inherits')
const BufferList = require('./BufferList')
function BufferListStream (callback) {
if (!(this instanceof BufferListStream)) {
return new BufferListStream(callback)
}
if (typeof callback === 'function') {
this._callback = callback
const piper = function piper (err) {
if (this._callback) {
this._callback(err)
this._callback = null
}
}.bind(this)
this.on('pipe', function onPipe (src) {
src.on('error', piper)
})
this.on('unpipe', function onUnpipe (src) {
src.removeListener('error', piper)
})
callback = null
}
BufferList._init.call(this, callback)
DuplexStream.call(this)
}
inherits(BufferListStream, DuplexStream)
Object.assign(BufferListStream.prototype, BufferList.prototype)
BufferListStream.prototype._new = function _new (callback) {
return new BufferListStream(callback)
}
BufferListStream.prototype._write = function _write (buf, encoding, callback) {
this._appendBuffer(buf)
if (typeof callback === 'function') {
callback()
}
}
BufferListStream.prototype._read = function _read (size) {
if (!this.length) {
return this.push(null)
}
size = Math.min(size, this.length)
this.push(this.slice(0, size))
this.consume(size)
}
BufferListStream.prototype.end = function end (chunk) {
DuplexStream.prototype.end.call(this, chunk)
if (this._callback) {
this._callback(null, this.slice())
this._callback = null
}
}
BufferListStream.prototype._destroy = function _destroy (err, cb) {
this._bufs.length = 0
this.length = 0
cb(err)
}
BufferListStream.prototype._isBufferList = function _isBufferList (b) {
return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b)
}
BufferListStream.isBufferList = BufferList.isBufferList
module.exports = BufferListStream
module.exports.BufferListStream = BufferListStream
module.exports.BufferList = BufferList
@@ -0,0 +1,869 @@
// Project: https://github.com/isaacs/node-lru-cache
// Based initially on @types/lru-cache
// https://github.com/DefinitelyTyped/DefinitelyTyped
// used under the terms of the MIT License, shown below.
//
// DefinitelyTyped license:
// ------
// MIT License
//
// Copyright (c) Microsoft Corporation.
//
// 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
// ------
//
// Changes by Isaac Z. Schlueter released under the terms found in the
// LICENSE file within this project.
/**
* Integer greater than 0, representing some number of milliseconds, or the
* time at which a TTL started counting from.
*/
declare type LRUMilliseconds = number
/**
* An integer greater than 0, reflecting the calculated size of items
*/
declare type LRUSize = number
/**
* An integer greater than 0, reflecting a number of items
*/
declare type LRUCount = number
declare class LRUCache<K, V> implements Iterable<[K, V]> {
constructor(options: LRUCache.Options<K, V>)
/**
* Number of items in the cache.
* Alias for {@link size}
*
* @deprecated since 7.0 use {@link size} instead
*/
public readonly length: LRUCount
public readonly max: LRUCount
public readonly maxSize: LRUSize
public readonly maxEntrySize: LRUSize
public readonly sizeCalculation:
| LRUCache.SizeCalculator<K, V>
| undefined
public readonly dispose: LRUCache.Disposer<K, V>
/**
* @since 7.4.0
*/
public readonly disposeAfter: LRUCache.Disposer<K, V> | null
public readonly noDisposeOnSet: boolean
public readonly ttl: LRUMilliseconds
public readonly ttlResolution: LRUMilliseconds
public readonly ttlAutopurge: boolean
public readonly allowStale: boolean
public readonly updateAgeOnGet: boolean
/**
* @since 7.11.0
*/
public readonly noDeleteOnStaleGet: boolean
/**
* @since 7.6.0
*/
public readonly fetchMethod: LRUCache.Fetcher<K, V> | null
/**
* The total number of items held in the cache at the current moment.
*/
public readonly size: LRUCount
/**
* The total size of items in cache when using size tracking.
*/
public readonly calculatedSize: LRUSize
/**
* Add a value to the cache.
*/
public set(
key: K,
value: V,
options?: LRUCache.SetOptions<K, V>
): this
/**
* Return a value from the cache. Will update the recency of the cache entry
* found.
*
* If the key is not found, {@link get} will return `undefined`. This can be
* confusing when setting values specifically to `undefined`, as in
* `cache.set(key, undefined)`. Use {@link has} to determine whether a key is
* present in the cache at all.
*/
public get(key: K, options?: LRUCache.GetOptions<V>): V | undefined
/**
* Like {@link get} but doesn't update recency or delete stale items.
* Returns `undefined` if the item is stale, unless {@link allowStale} is set
* either on the cache or in the options object.
*/
public peek(key: K, options?: LRUCache.PeekOptions): V | undefined
/**
* Check if a key is in the cache, without updating the recency of use.
* Will return false if the item is stale, even though it is technically
* in the cache.
*
* Will not update item age unless {@link updateAgeOnHas} is set in the
* options or constructor.
*/
public has(key: K, options?: LRUCache.HasOptions<V>): boolean
/**
* Deletes a key out of the cache.
* Returns true if the key was deleted, false otherwise.
*/
public delete(key: K): boolean
/**
* Clear the cache entirely, throwing away all values.
*/
public clear(): void
/**
* Delete any stale entries. Returns true if anything was removed, false
* otherwise.
*/
public purgeStale(): boolean
/**
* Find a value for which the supplied fn method returns a truthy value,
* similar to Array.find(). fn is called as fn(value, key, cache).
*/
public find(
callbackFn: (
value: V,
key: K,
cache: this
) => boolean | undefined | void,
options?: LRUCache.GetOptions<V>
): V | undefined
/**
* Call the supplied function on each item in the cache, in order from
* most recently used to least recently used. fn is called as
* fn(value, key, cache). Does not update age or recenty of use.
*/
public forEach<T = this>(
callbackFn: (this: T, value: V, key: K, cache: this) => void,
thisArg?: T
): void
/**
* The same as {@link forEach} but items are iterated over in reverse
* order. (ie, less recently used items are iterated over first.)
*/
public rforEach<T = this>(
callbackFn: (this: T, value: V, key: K, cache: this) => void,
thisArg?: T
): void
/**
* Return a generator yielding the keys in the cache,
* in order from most recently used to least recently used.
*/
public keys(): Generator<K, void, void>
/**
* Inverse order version of {@link keys}
*
* Return a generator yielding the keys in the cache,
* in order from least recently used to most recently used.
*/
public rkeys(): Generator<K, void, void>
/**
* Return a generator yielding the values in the cache,
* in order from most recently used to least recently used.
*/
public values(): Generator<V, void, void>
/**
* Inverse order version of {@link values}
*
* Return a generator yielding the values in the cache,
* in order from least recently used to most recently used.
*/
public rvalues(): Generator<V, void, void>
/**
* Return a generator yielding `[key, value]` pairs,
* in order from most recently used to least recently used.
*/
public entries(): Generator<[K, V], void, void>
/**
* Inverse order version of {@link entries}
*
* Return a generator yielding `[key, value]` pairs,
* in order from least recently used to most recently used.
*/
public rentries(): Generator<[K, V], void, void>
/**
* Iterating over the cache itself yields the same results as
* {@link entries}
*/
public [Symbol.iterator](): Generator<[K, V], void, void>
/**
* Return an array of [key, entry] objects which can be passed to
* cache.load()
*/
public dump(): Array<[K, LRUCache.Entry<V>]>
/**
* Reset the cache and load in the items in entries in the order listed.
* Note that the shape of the resulting cache may be different if the
* same options are not used in both caches.
*/
public load(
cacheEntries: ReadonlyArray<[K, LRUCache.Entry<V>]>
): void
/**
* Evict the least recently used item, returning its value or `undefined`
* if cache is empty.
*/
public pop(): V | undefined
/**
* Deletes a key out of the cache.
*
* @deprecated since 7.0 use delete() instead
*/
public del(key: K): boolean
/**
* Clear the cache entirely, throwing away all values.
*
* @deprecated since 7.0 use clear() instead
*/
public reset(): void
/**
* Manually iterates over the entire cache proactively pruning old entries.
*
* @deprecated since 7.0 use purgeStale() instead
*/
public prune(): boolean
/**
* Make an asynchronous cached fetch using the {@link fetchMethod} function.
*
* If multiple fetches for the same key are issued, then they will all be
* coalesced into a single call to fetchMethod.
*
* Note that this means that handling options such as
* {@link allowStaleOnFetchAbort}, {@link signal}, and
* {@link allowStaleOnFetchRejection} will be determined by the FIRST fetch()
* call for a given key.
*
* This is a known (fixable) shortcoming which will be addresed on when
* someone complains about it, as the fix would involve added complexity and
* may not be worth the costs for this edge case.
*
* since: 7.6.0
*/
public fetch(
key: K,
options?: LRUCache.FetchOptions<K, V>
): Promise<V>
/**
* since: 7.6.0
*/
public getRemainingTTL(key: K): LRUMilliseconds
}
declare namespace LRUCache {
type DisposeReason = 'evict' | 'set' | 'delete'
type SizeCalculator<K, V> = (value: V, key: K) => LRUSize
type Disposer<K, V> = (
value: V,
key: K,
reason: DisposeReason
) => void
type Fetcher<K, V> = (
key: K,
staleValue: V | undefined,
options: FetcherOptions<K, V>
) => Promise<V | void | undefined> | V | void | undefined
interface DeprecatedOptions<K, V> {
/**
* alias for ttl
*
* @deprecated since 7.0 use options.ttl instead
*/
maxAge?: LRUMilliseconds
/**
* alias for {@link sizeCalculation}
*
* @deprecated since 7.0 use {@link sizeCalculation} instead
*/
length?: SizeCalculator<K, V>
/**
* alias for allowStale
*
* @deprecated since 7.0 use options.allowStale instead
*/
stale?: boolean
}
interface LimitedByCount {
/**
* The number of most recently used items to keep.
* Note that we may store fewer items than this if maxSize is hit.
*/
max: LRUCount
}
type MaybeMaxEntrySizeLimit<K, V> =
| {
/**
* The maximum allowed size for any single item in the cache.
*
* If a larger item is passed to {@link set} or returned by a
* {@link fetchMethod}, then it will not be stored in the cache.
*/
maxEntrySize: LRUSize
sizeCalculation?: SizeCalculator<K, V>
}
| {}
interface LimitedBySize<K, V> {
/**
* If you wish to track item size, you must provide a maxSize
* note that we still will only keep up to max *actual items*,
* if max is set, so size tracking may cause fewer than max items
* to be stored. At the extreme, a single item of maxSize size
* will cause everything else in the cache to be dropped when it
* is added. Use with caution!
*
* Note also that size tracking can negatively impact performance,
* though for most cases, only minimally.
*/
maxSize: LRUSize
/**
* Function to calculate size of items. Useful if storing strings or
* buffers or other items where memory size depends on the object itself.
*
* Items larger than {@link maxEntrySize} will not be stored in the cache.
*
* Note that when {@link maxSize} or {@link maxEntrySize} are set, every
* item added MUST have a size specified, either via a `sizeCalculation` in
* the constructor, or `sizeCalculation` or {@link size} options to
* {@link set}.
*/
sizeCalculation?: SizeCalculator<K, V>
}
interface LimitedByTTL {
/**
* Max time in milliseconds for items to live in cache before they are
* considered stale. Note that stale items are NOT preemptively removed
* by default, and MAY live in the cache, contributing to its LRU max,
* long after they have expired.
*
* Also, as this cache is optimized for LRU/MRU operations, some of
* the staleness/TTL checks will reduce performance, as they will incur
* overhead by deleting items.
*
* Must be an integer number of ms, defaults to 0, which means "no TTL"
*/
ttl: LRUMilliseconds
/**
* Boolean flag to tell the cache to not update the TTL when
* setting a new value for an existing key (ie, when updating a value
* rather than inserting a new value). Note that the TTL value is
* _always_ set (if provided) when adding a new entry into the cache.
*
* @default false
* @since 7.4.0
*/
noUpdateTTL?: boolean
/**
* Minimum amount of time in ms in which to check for staleness.
* Defaults to 1, which means that the current time is checked
* at most once per millisecond.
*
* Set to 0 to check the current time every time staleness is tested.
* (This reduces performance, and is theoretically unnecessary.)
*
* Setting this to a higher value will improve performance somewhat
* while using ttl tracking, albeit at the expense of keeping stale
* items around a bit longer than their TTLs would indicate.
*
* @default 1
* @since 7.1.0
*/
ttlResolution?: LRUMilliseconds
/**
* Preemptively remove stale items from the cache.
* Note that this may significantly degrade performance,
* especially if the cache is storing a large number of items.
* It is almost always best to just leave the stale items in
* the cache, and let them fall out as new items are added.
*
* Note that this means that {@link allowStale} is a bit pointless,
* as stale items will be deleted almost as soon as they expire.
*
* Use with caution!
*
* @default false
* @since 7.1.0
*/
ttlAutopurge?: boolean
/**
* Return stale items from {@link get} before disposing of them.
* Return stale values from {@link fetch} while performing a call
* to the {@link fetchMethod} in the background.
*
* @default false
*/
allowStale?: boolean
/**
* Update the age of items on {@link get}, renewing their TTL
*
* @default false
*/
updateAgeOnGet?: boolean
/**
* Do not delete stale items when they are retrieved with {@link get}.
* Note that the {@link get} return value will still be `undefined` unless
* allowStale is true.
*
* @default false
* @since 7.11.0
*/
noDeleteOnStaleGet?: boolean
/**
* Update the age of items on {@link has}, renewing their TTL
*
* @default false
*/
updateAgeOnHas?: boolean
}
type SafetyBounds<K, V> =
| LimitedByCount
| LimitedBySize<K, V>
| LimitedByTTL
// options shared by all three of the limiting scenarios
interface SharedOptions<K, V> {
/**
* Function that is called on items when they are dropped from the cache.
* This can be handy if you want to close file descriptors or do other
* cleanup tasks when items are no longer accessible. Called with `key,
* value`. It's called before actually removing the item from the
* internal cache, so it is *NOT* safe to re-add them.
* Use {@link disposeAfter} if you wish to dispose items after they have
* been full removed, when it is safe to add them back to the cache.
*/
dispose?: Disposer<K, V>
/**
* The same as dispose, but called *after* the entry is completely
* removed and the cache is once again in a clean state. It is safe to
* add an item right back into the cache at this point.
* However, note that it is *very* easy to inadvertently create infinite
* recursion this way.
*
* @since 7.3.0
*/
disposeAfter?: Disposer<K, V>
/**
* Set to true to suppress calling the dispose() function if the entry
* key is still accessible within the cache.
* This may be overridden by passing an options object to {@link set}.
*
* @default false
*/
noDisposeOnSet?: boolean
/**
* Function that is used to make background asynchronous fetches. Called
* with `fetchMethod(key, staleValue, { signal, options, context })`.
*
* If `fetchMethod` is not provided, then {@link fetch} is
* equivalent to `Promise.resolve(cache.get(key))`.
*
* The `fetchMethod` should ONLY return `undefined` in cases where the
* abort controller has sent an abort signal.
*
* @since 7.6.0
*/
fetchMethod?: LRUCache.Fetcher<K, V>
/**
* Set to true to suppress the deletion of stale data when a
* {@link fetchMethod} throws an error or returns a rejected promise
*
* This may be overridden in the {@link fetchMethod}.
*
* @default false
* @since 7.10.0
*/
noDeleteOnFetchRejection?: boolean
/**
* Set to true to allow returning stale data when a {@link fetchMethod}
* throws an error or returns a rejected promise. Note that this
* differs from using {@link allowStale} in that stale data will
* ONLY be returned in the case that the fetch fails, not any other
* times.
*
* This may be overridden in the {@link fetchMethod}.
*
* @default false
* @since 7.16.0
*/
allowStaleOnFetchRejection?: boolean
/**
*
* Set to true to ignore the `abort` event emitted by the `AbortSignal`
* object passed to {@link fetchMethod}, and still cache the
* resulting resolution value, as long as it is not `undefined`.
*
* When used on its own, this means aborted {@link fetch} calls are not
* immediately resolved or rejected when they are aborted, and instead take
* the full time to await.
*
* When used with {@link allowStaleOnFetchAbort}, aborted {@link fetch}
* calls will resolve immediately to their stale cached value or
* `undefined`, and will continue to process and eventually update the
* cache when they resolve, as long as the resulting value is not
* `undefined`, thus supporting a "return stale on timeout while
* refreshing" mechanism by passing `AbortSignal.timeout(n)` as the signal.
*
* **Note**: regardless of this setting, an `abort` event _is still emitted
* on the `AbortSignal` object_, so may result in invalid results when
* passed to other underlying APIs that use AbortSignals.
*
* This may be overridden in the {@link fetchMethod} or the call to
* {@link fetch}.
*
* @default false
* @since 7.17.0
*/
ignoreFetchAbort?: boolean
/**
* Set to true to return a stale value from the cache when the
* `AbortSignal` passed to the {@link fetchMethod} dispatches an `'abort'`
* event, whether user-triggered, or due to internal cache behavior.
*
* Unless {@link ignoreFetchAbort} is also set, the underlying
* {@link fetchMethod} will still be considered canceled, and its return
* value will be ignored and not cached.
*
* This may be overridden in the {@link fetchMethod} or the call to
* {@link fetch}.
*
* @default false
* @since 7.17.0
*/
allowStaleOnFetchAbort?: boolean
/**
* Set to any value in the constructor or {@link fetch} options to
* pass arbitrary data to the {@link fetchMethod} in the {@link context}
* options field.
*
* @since 7.12.0
*/
fetchContext?: any
}
type Options<K, V> = SharedOptions<K, V> &
DeprecatedOptions<K, V> &
SafetyBounds<K, V> &
MaybeMaxEntrySizeLimit<K, V>
/**
* options which override the options set in the LRUCache constructor
* when making calling {@link set}.
*/
interface SetOptions<K, V> {
/**
* A value for the size of the entry, prevents calls to
* {@link sizeCalculation}.
*
* Items larger than {@link maxEntrySize} will not be stored in the cache.
*
* Note that when {@link maxSize} or {@link maxEntrySize} are set, every
* item added MUST have a size specified, either via a `sizeCalculation` in
* the constructor, or {@link sizeCalculation} or `size` options to
* {@link set}.
*/
size?: LRUSize
/**
* Overrides the {@link sizeCalculation} method set in the constructor.
*
* Items larger than {@link maxEntrySize} will not be stored in the cache.
*
* Note that when {@link maxSize} or {@link maxEntrySize} are set, every
* item added MUST have a size specified, either via a `sizeCalculation` in
* the constructor, or `sizeCalculation` or {@link size} options to
* {@link set}.
*/
sizeCalculation?: SizeCalculator<K, V>
ttl?: LRUMilliseconds
start?: LRUMilliseconds
noDisposeOnSet?: boolean
noUpdateTTL?: boolean
status?: Status<V>
}
/**
* options which override the options set in the LRUCAche constructor
* when calling {@link has}.
*/
interface HasOptions<V> {
updateAgeOnHas?: boolean
status: Status<V>
}
/**
* options which override the options set in the LRUCache constructor
* when calling {@link get}.
*/
interface GetOptions<V> {
allowStale?: boolean
updateAgeOnGet?: boolean
noDeleteOnStaleGet?: boolean
status?: Status<V>
}
/**
* options which override the options set in the LRUCache constructor
* when calling {@link peek}.
*/
interface PeekOptions {
allowStale?: boolean
}
/**
* Options object passed to the {@link fetchMethod}
*
* May be mutated by the {@link fetchMethod} to affect the behavior of the
* resulting {@link set} operation on resolution, or in the case of
* {@link noDeleteOnFetchRejection}, {@link ignoreFetchAbort}, and
* {@link allowStaleOnFetchRejection}, the handling of failure.
*/
interface FetcherFetchOptions<K, V> {
allowStale?: boolean
updateAgeOnGet?: boolean
noDeleteOnStaleGet?: boolean
size?: LRUSize
sizeCalculation?: SizeCalculator<K, V>
ttl?: LRUMilliseconds
noDisposeOnSet?: boolean
noUpdateTTL?: boolean
noDeleteOnFetchRejection?: boolean
allowStaleOnFetchRejection?: boolean
ignoreFetchAbort?: boolean
allowStaleOnFetchAbort?: boolean
status?: Status<V>
}
/**
* Status object that may be passed to {@link fetch}, {@link get},
* {@link set}, and {@link has}.
*/
interface Status<V> {
/**
* The status of a set() operation.
*
* - add: the item was not found in the cache, and was added
* - update: the item was in the cache, with the same value provided
* - replace: the item was in the cache, and replaced
* - miss: the item was not added to the cache for some reason
*/
set?: 'add' | 'update' | 'replace' | 'miss'
/**
* the ttl stored for the item, or undefined if ttls are not used.
*/
ttl?: LRUMilliseconds
/**
* the start time for the item, or undefined if ttls are not used.
*/
start?: LRUMilliseconds
/**
* The timestamp used for TTL calculation
*/
now?: LRUMilliseconds
/**
* the remaining ttl for the item, or undefined if ttls are not used.
*/
remainingTTL?: LRUMilliseconds
/**
* The calculated size for the item, if sizes are used.
*/
size?: LRUSize
/**
* A flag indicating that the item was not stored, due to exceeding the
* {@link maxEntrySize}
*/
maxEntrySizeExceeded?: true
/**
* The old value, specified in the case of `set:'update'` or
* `set:'replace'`
*/
oldValue?: V
/**
* The results of a {@link has} operation
*
* - hit: the item was found in the cache
* - stale: the item was found in the cache, but is stale
* - miss: the item was not found in the cache
*/
has?: 'hit' | 'stale' | 'miss'
/**
* The status of a {@link fetch} operation.
* Note that this can change as the underlying fetch() moves through
* various states.
*
* - inflight: there is another fetch() for this key which is in process
* - get: there is no fetchMethod, so {@link get} was called.
* - miss: the item is not in cache, and will be fetched.
* - hit: the item is in the cache, and was resolved immediately.
* - stale: the item is in the cache, but stale.
* - refresh: the item is in the cache, and not stale, but
* {@link forceRefresh} was specified.
*/
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
/**
* The {@link fetchMethod} was called
*/
fetchDispatched?: true
/**
* The cached value was updated after a successful call to fetchMethod
*/
fetchUpdated?: true
/**
* The reason for a fetch() rejection. Either the error raised by the
* {@link fetchMethod}, or the reason for an AbortSignal.
*/
fetchError?: Error
/**
* The fetch received an abort signal
*/
fetchAborted?: true
/**
* The abort signal received was ignored, and the fetch was allowed to
* continue.
*/
fetchAbortIgnored?: true
/**
* The fetchMethod promise resolved successfully
*/
fetchResolved?: true
/**
* The fetchMethod promise was rejected
*/
fetchRejected?: true
/**
* The status of a {@link get} operation.
*
* - fetching: The item is currently being fetched. If a previous value is
* present and allowed, that will be returned.
* - stale: The item is in the cache, and is stale.
* - hit: the item is in the cache
* - miss: the item is not in the cache
*/
get?: 'stale' | 'hit' | 'miss'
/**
* A fetch or get operation returned a stale value.
*/
returnedStale?: true
}
/**
* options which override the options set in the LRUCache constructor
* when calling {@link fetch}.
*
* This is the union of GetOptions and SetOptions, plus
* {@link noDeleteOnFetchRejection}, {@link allowStaleOnFetchRejection},
* {@link forceRefresh}, and {@link fetchContext}
*/
interface FetchOptions<K, V> extends FetcherFetchOptions<K, V> {
forceRefresh?: boolean
fetchContext?: any
signal?: AbortSignal
status?: Status<V>
}
interface FetcherOptions<K, V> {
signal: AbortSignal
options: FetcherFetchOptions<K, V>
/**
* Object provided in the {@link fetchContext} option
*/
context: any
}
interface Entry<V> {
value: V
ttl?: LRUMilliseconds
size?: LRUSize
start?: LRUMilliseconds
}
}
export = LRUCache
@@ -0,0 +1 @@
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAsCM,SAAS,0CAAU,KAAqC,EAAE,GAAmB;IAClF,IAAI,eACF,cAAc,sBACd,UAAU,WACV,OAAO,gBACP,YAAY,cACZ,UAAU,aACV,SAAS,iBACT,aAAa,uBACb,mBAAmB,0BACnB,4BAA4B;IAC5B,sBAAsB,EACtB,aAAa;IACb,SAAS,iBAAiB,QAC1B,IAAI,UACJ,MAAM,OACN,GAAG,QACH,OAAO,UACR,GAAG;IACJ,IAAI;IACJ,IAAI,gBAAgB,UAClB,kBAAkB;cAChB;QACA,UAAU;IACZ;SAEA,kBAAkB;QAChB,MAAM;QACN,UAAU,aAAa,YAAY;QACnC,MAAM,gBAAgB,OAAO,CAAC,aAAa,OAAO;QAClD,QAAQ,gBAAgB,MAAM,SAAS;QACvC,MAAM,gBAAgB,UAAU,OAAO;QACvC,UAAU,gBAAgB,UAAU,aAAa;QACjD,iBAAiB,CAAC,cAAc,gBAAgB,UAAU,YAAY;QACtE,KAAK,gBAAgB,MAAM,MAAM;IACnC;IAGF,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;sBACrC;oBACA;uBACA;iBACA;mBACA;oBACA;6BACA;aACA;IACF;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC3C,IAAI,wBACF,eAAe,QAAQ,GAAG,aAAa,KAAK,eAAe,QAAQ;IAErE,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,gBAAgB,YAAY,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAE/F,OAAO;mBACL;QACA,aAAa,CAAA,GAAA,iBAAS,EAAE,iBAAiB,aAAa;YACpD,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;gBACR,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf;YACF;QACF;IACF;AACF","sources":["packages/@react-aria/button/src/useButton.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 {\n AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n InputHTMLAttributes,\n RefObject\n} from 'react';\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {useFocusable} from '@react-aria/focus';\nimport {usePress} from '@react-aria/interactions';\n\nexport interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {}\n\nexport interface ButtonAria<T> {\n /** Props for the button element. */\n buttonProps: T,\n /** Whether the button is currently pressed. */\n isPressed: boolean\n}\n\n// Order with overrides is important: 'button' should be default\nexport function useButton(props: AriaButtonOptions<'button'>, ref: RefObject<HTMLButtonElement | null>): ButtonAria<ButtonHTMLAttributes<HTMLButtonElement>>;\nexport function useButton(props: AriaButtonOptions<'a'>, ref: RefObject<HTMLAnchorElement | null>): ButtonAria<AnchorHTMLAttributes<HTMLAnchorElement>>;\nexport function useButton(props: AriaButtonOptions<'div'>, ref: RefObject<HTMLDivElement | null>): ButtonAria<HTMLAttributes<HTMLDivElement>>;\nexport function useButton(props: AriaButtonOptions<'input'>, ref: RefObject<HTMLInputElement | null>): ButtonAria<InputHTMLAttributes<HTMLInputElement>>;\nexport function useButton(props: AriaButtonOptions<'span'>, ref: RefObject<HTMLSpanElement | null>): ButtonAria<HTMLAttributes<HTMLSpanElement>>;\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<Element | null>): ButtonAria<DOMAttributes>;\n/**\n * Provides the behavior and accessibility implementation for a button component. Handles mouse, keyboard, and touch interactions,\n * focus behavior, and ARIA props for both native button elements and custom element types.\n * @param props - Props to be applied to the button.\n * @param ref - A ref to a DOM element for the button.\n */\nexport function useButton(props: AriaButtonOptions<ElementType>, ref: RefObject<any>): ButtonAria<HTMLAttributes<any>> {\n let {\n elementType = 'button',\n isDisabled,\n onPress,\n onPressStart,\n onPressEnd,\n onPressUp,\n onPressChange,\n preventFocusOnPress,\n // @ts-ignore - undocumented\n allowFocusWhenDisabled,\n // @ts-ignore\n onClick: deprecatedOnClick,\n href,\n target,\n rel,\n type = 'button'\n } = props;\n let additionalProps;\n if (elementType === 'button') {\n additionalProps = {\n type,\n disabled: isDisabled\n };\n } else {\n additionalProps = {\n role: 'button',\n tabIndex: isDisabled ? undefined : 0,\n href: elementType === 'a' && !isDisabled ? href : undefined,\n target: elementType === 'a' ? target : undefined,\n type: elementType === 'input' ? type : undefined,\n disabled: elementType === 'input' ? isDisabled : undefined,\n 'aria-disabled': !isDisabled || elementType === 'input' ? undefined : isDisabled,\n rel: elementType === 'a' ? rel : undefined\n };\n }\n\n let {presLine truncated
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more