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,91 @@
export { M as ModuleMocker, c as createCompilerHints } from './chunk-mocker.js';
import { M as MockerRegistry } from './chunk-registry.js';
import { c as createManualModuleSource, a as cleanUrl } from './chunk-utils.js';
export { M as ModuleMockerServerInterceptor } from './chunk-interceptor-native.js';
import './index.js';
import './chunk-pathe.M-eThtNZ.js';
class ModuleMockerMSWInterceptor {
mocks = new MockerRegistry();
startPromise;
worker;
constructor(options = {}) {
this.options = options;
if (!options.globalThisAccessor) {
options.globalThisAccessor = "\"__vitest_mocker__\"";
}
}
async register(module) {
await this.init();
this.mocks.add(module);
}
async delete(url) {
await this.init();
this.mocks.delete(url);
}
async invalidate() {
this.mocks.clear();
}
async resolveManualMock(mock) {
const exports$1 = Object.keys(await mock.resolve());
const text = createManualModuleSource(mock.url, exports$1, this.options.globalThisAccessor);
return new Response(text, { headers: { "Content-Type": "application/javascript" } });
}
async init() {
if (this.worker) {
return this.worker;
}
if (this.startPromise) {
return this.startPromise;
}
const worker = this.options.mswWorker;
this.startPromise = Promise.all([worker ? { setupWorker(handler) {
worker.use(handler);
return worker;
} } : import('msw/browser'), import('msw/core/http')]).then(([{ setupWorker }, { http }]) => {
const worker = setupWorker(http.get(/.+/, async ({ request }) => {
const path = cleanQuery(request.url.slice(location.origin.length));
if (!this.mocks.has(path)) {
return passthrough();
}
const mock = this.mocks.get(path);
switch (mock.type) {
case "manual": return this.resolveManualMock(mock);
case "automock":
case "autospy": return Response.redirect(injectQuery(path, `mock=${mock.type}`));
case "redirect": return Response.redirect(mock.redirect);
default: throw new Error(`Unknown mock type: ${mock.type}`);
}
}));
return worker.start(this.options.mswOptions).then(() => worker);
}).finally(() => {
this.worker = worker;
this.startPromise = undefined;
});
return await this.startPromise;
}
}
const trailingSeparatorRE = /[?&]$/;
const timestampRE = /\bt=\d{13}&?\b/;
const versionRE = /\bv=\w{8}&?\b/;
function cleanQuery(url) {
return url.replace(timestampRE, "").replace(versionRE, "").replace(trailingSeparatorRE, "");
}
function passthrough() {
return new Response(null, {
status: 302,
statusText: "Passthrough",
headers: { "x-msw-intention": "passthrough" }
});
}
const replacePercentageRE = /%/g;
function injectQuery(url, queryToInject) {
// encode percents for consistent behavior with pathToFileURL
// see #2614 for details
const resolvedUrl = new URL(url.replace(replacePercentageRE, "%25"), location.href);
const { search, hash } = resolvedUrl;
const pathname = cleanUrl(url);
return `${pathname}?${queryToInject}${search ? `&${search.slice(1)}` : ""}${hash ?? ""}`;
}
export { ModuleMockerMSWInterceptor };
@@ -0,0 +1,53 @@
{
"name": "parchment",
"version": "3.0.0",
"description": "A document model for rich text editors",
"author": "Jason Chen <jhchen7@gmail.com>",
"homepage": "http://quilljs.com/docs/parchment",
"main": "./dist/parchment.js",
"types": "./dist/parchment.d.ts",
"type": "module",
"sideEffects": false,
"files": [
"tsconfig.json",
"dist",
"src"
],
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.1",
"@microsoft/api-extractor": "^7.42.3",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitest/browser": "^1.4.0",
"del-cli": "^5.1.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-require-extensions": "^0.1.3",
"eslint-plugin-tree-shaking": "^1.12.1",
"playwright": "1.42.1",
"prettier": "^3.2.5",
"typescript": "^5.4.2",
"vite": "^5.1.6",
"vitest": "^1.4.0"
},
"prettier": {
"singleQuote": true
},
"license": "BSD-3-Clause",
"repository": "github:quilljs/parchment",
"scripts": {
"build": "npm run build:bundle && npm run build:types",
"build:bundle": "vite build",
"build:types": "tsc --emitDeclarationOnly && api-extractor run && del-cli dist/typings",
"lint": "eslint 'src/**/*.ts' 'tests/**/*.ts'",
"prepare": "npm run build",
"test": "npm run test:unit",
"test:unit": "vitest --typecheck",
"test:pkg": "attw $(npm pack)"
},
"bugs": {
"url": "https://github.com/quilljs/parchment/issues"
}
}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAMD,SAAS,gCAAa,KAAwB;IAC5C,OAAO;AACT;AAEA,gCAAU,iBAAiB,GAAG,UAAU,kBAAqB,KAAwB;IACnF,IAAI,YAAC,QAAQ,SAAE,KAAK,EAAC,GAAG;IACxB,MAAM;QACJ,MAAM;QACN,eAAe;eACf;QACA,CAAC;YACC,IAAI,OAAO,aAAa,YAAY;gBAClC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM;gBAGlB,KAAK,IAAI,QAAQ,MACf,MAAM;oBACJ,MAAM;oBACN,OAAO;oBACP,UAAU;gBACZ;YAEJ,OAAO;gBACL,IAAI,QAA0B,EAAE;gBAChC,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;oBAC/B,MAAM,IAAI,CAAC;wBACT,MAAM;wBACN,SAAS;oBACX;gBACF;gBAEA,OAAO;YACT;QACF;IACF;AACF;AAEA;;;CAGC,GACD,oEAAoE;AACpE,IAAI,4CAAa","sources":["packages/@react-stately/table/src/TableBody.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 {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\nimport {TableBodyProps} from '@react-types/table';\n\nfunction TableBody<T>(props: TableBodyProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nTableBody.getCollectionNode = function* getCollectionNode<T>(props: TableBodyProps<T>): Generator<PartialNode<T>> {\n let {children, items} = props;\n yield {\n type: 'body',\n hasChildNodes: true,\n props,\n *childNodes() {\n if (typeof children === 'function') {\n if (!items) {\n throw new Error('props.children was a function but props.items is missing');\n }\n\n for (let item of items) {\n yield {\n type: 'item',\n value: item,\n renderer: children\n };\n }\n } else {\n let items: PartialNode<T>[] = [];\n React.Children.forEach(children, item => {\n items.push({\n type: 'item',\n element: item\n });\n });\n\n yield* items;\n }\n }\n };\n};\n\n/**\n * A TableBody is a container for the Row elements of a Table. Rows can be statically defined\n * as children, or generated dynamically using a function based on the data passed to the `items` prop.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _TableBody = TableBody as <T>(props: TableBodyProps<T>) => JSX.Element;\nexport {_TableBody as TableBody};\n"],"names":[],"version":3,"file":"TableBody.main.js.map"}
@@ -0,0 +1,232 @@
import { useEffect, useState, useRef } from 'react';
import { DefaultToastOptions, Toast, ToastType } from './types';
export const TOAST_EXPIRE_DISMISS_DELAY = 1000;
export const TOAST_LIMIT = 20;
export const DEFAULT_TOASTER_ID = 'default';
interface ToasterSettings {
toastLimit: number;
}
export enum ActionType {
ADD_TOAST,
UPDATE_TOAST,
UPSERT_TOAST,
DISMISS_TOAST,
REMOVE_TOAST,
START_PAUSE,
END_PAUSE,
}
export type Action =
| {
type: ActionType.ADD_TOAST;
toast: Toast;
}
| {
type: ActionType.UPSERT_TOAST;
toast: Toast;
}
| {
type: ActionType.UPDATE_TOAST;
toast: Partial<Toast>;
}
| {
type: ActionType.DISMISS_TOAST;
toastId?: string;
}
| {
type: ActionType.REMOVE_TOAST;
toastId?: string;
}
| {
type: ActionType.START_PAUSE;
time: number;
}
| {
type: ActionType.END_PAUSE;
time: number;
};
interface ToasterState {
toasts: Toast[];
settings: ToasterSettings;
pausedAt: number | undefined;
}
interface State {
[toasterId: string]: ToasterState;
}
export const reducer = (state: ToasterState, action: Action): ToasterState => {
const { toastLimit } = state.settings;
switch (action.type) {
case ActionType.ADD_TOAST:
return {
...state,
toasts: [action.toast, ...state.toasts].slice(0, toastLimit),
};
case ActionType.UPDATE_TOAST:
return {
...state,
toasts: state.toasts.map((t) =>
t.id === action.toast.id ? { ...t, ...action.toast } : t
),
};
case ActionType.UPSERT_TOAST:
const { toast } = action;
return reducer(state, {
type: state.toasts.find((t) => t.id === toast.id)
? ActionType.UPDATE_TOAST
: ActionType.ADD_TOAST,
toast,
});
case ActionType.DISMISS_TOAST:
const { toastId } = action;
return {
...state,
toasts: state.toasts.map((t) =>
t.id === toastId || toastId === undefined
? {
...t,
dismissed: true,
visible: false,
}
: t
),
};
case ActionType.REMOVE_TOAST:
if (action.toastId === undefined) {
return {
...state,
toasts: [],
};
}
return {
...state,
toasts: state.toasts.filter((t) => t.id !== action.toastId),
};
case ActionType.START_PAUSE:
return {
...state,
pausedAt: action.time,
};
case ActionType.END_PAUSE:
const diff = action.time - (state.pausedAt || 0);
return {
...state,
pausedAt: undefined,
toasts: state.toasts.map((t) => ({
...t,
pauseDuration: t.pauseDuration + diff,
})),
};
}
};
const listeners: Array<
[toasterId: string, reducer: (state: ToasterState) => void]
> = [];
const defaultToasterState: ToasterState = {
toasts: [],
pausedAt: undefined,
settings: {
toastLimit: TOAST_LIMIT,
},
};
let memoryState: State = {};
export const dispatch = (action: Action, toasterId = DEFAULT_TOASTER_ID) => {
memoryState[toasterId] = reducer(
memoryState[toasterId] || defaultToasterState,
action
);
listeners.forEach(([id, listener]) => {
if (id === toasterId) {
listener(memoryState[toasterId]);
}
});
};
export const dispatchAll = (action: Action) =>
Object.keys(memoryState).forEach((toasterId) => dispatch(action, toasterId));
export const getToasterIdFromToastId = (toastId: string) =>
Object.keys(memoryState).find((toasterId) =>
memoryState[toasterId].toasts.some((t) => t.id === toastId)
);
export const createDispatch =
(toasterId = DEFAULT_TOASTER_ID) =>
(action: Action) => {
dispatch(action, toasterId);
};
export const defaultTimeouts: {
[key in ToastType]: number;
} = {
blank: 4000,
error: 4000,
success: 2000,
loading: Infinity,
custom: 4000,
};
export const useStore = (
toastOptions: DefaultToastOptions = {},
toasterId: string = DEFAULT_TOASTER_ID
): ToasterState => {
const [state, setState] = useState<ToasterState>(
memoryState[toasterId] || defaultToasterState
);
const initial = useRef(memoryState[toasterId]);
// TODO: Switch to useSyncExternalStore when targeting React 18+
useEffect(() => {
if (initial.current !== memoryState[toasterId]) {
setState(memoryState[toasterId]);
}
listeners.push([toasterId, setState]);
return () => {
const index = listeners.findIndex(([id]) => id === toasterId);
if (index > -1) {
listeners.splice(index, 1);
}
};
}, [toasterId]);
const mergedToasts = state.toasts.map((t) => ({
...toastOptions,
...toastOptions[t.type],
...t,
removeDelay:
t.removeDelay ||
toastOptions[t.type]?.removeDelay ||
toastOptions?.removeDelay,
duration:
t.duration ||
toastOptions[t.type]?.duration ||
toastOptions?.duration ||
defaultTimeouts[t.type],
style: {
...toastOptions.style,
...toastOptions[t.type]?.style,
...t.style,
},
}));
return {
...state,
toasts: mergedToasts,
};
};
@@ -0,0 +1,26 @@
import * as React from 'react';
interface CreateContextOptions {
/**
* If `true`, React will throw if context is `null` or `undefined`
* In some cases, you might want to support nested context, so you can set it to `false`
*/
strict?: boolean;
/**
* Error message to throw if the context is `undefined`
*/
errorMessage?: string;
/**
* The display name of the context
*/
name?: string;
}
type CreateContextReturn<T> = [React.Provider<T>, () => T, React.Context<T>];
/**
* Creates a named context, provider, and hook.
*
* @param options create context options
*/
declare function createContext<ContextType>(options?: CreateContextOptions): CreateContextReturn<ContextType>;
export { type CreateContextOptions, type CreateContextReturn, createContext };
@@ -0,0 +1,80 @@
'use strict';
const astUtil = require('./ast');
const pragmaUtil = require('./pragma');
const variableUtil = require('./variable');
/**
* Check if variable is destructured from pragma import
*
* @param {Context} context eslint context
* @param {ASTNode} node The AST node to check
* @param {string} variable The variable name to check
* @returns {boolean} True if createElement is destructured from the pragma
*/
module.exports = function isDestructuredFromPragmaImport(context, node, variable) {
const pragma = pragmaUtil.getFromContext(context);
const variableInScope = variableUtil.getVariableFromContext(context, node, variable);
if (variableInScope) {
const latestDef = variableUtil.getLatestVariableDefinition(variableInScope);
if (latestDef) {
// check if latest definition is a variable declaration: 'variable = value'
if (latestDef.node.type === 'VariableDeclarator' && latestDef.node.init) {
// check for: 'variable = pragma.variable'
if (
latestDef.node.init.type === 'MemberExpression'
&& latestDef.node.init.object.type === 'Identifier'
&& latestDef.node.init.object.name === pragma
) {
return true;
}
// check for: '{variable} = pragma'
if (
latestDef.node.init.type === 'Identifier'
&& latestDef.node.init.name === pragma
) {
return true;
}
// "require('react')"
let requireExpression = null;
// get "require('react')" from: "{variable} = require('react')"
if (astUtil.isCallExpression(latestDef.node.init)) {
requireExpression = latestDef.node.init;
}
// get "require('react')" from: "variable = require('react').variable"
if (
!requireExpression
&& latestDef.node.init.type === 'MemberExpression'
&& astUtil.isCallExpression(latestDef.node.init.object)
) {
requireExpression = latestDef.node.init.object;
}
// check proper require.
if (
requireExpression
&& requireExpression.callee
&& requireExpression.callee.name === 'require'
&& requireExpression.arguments[0]
&& requireExpression.arguments[0].value === pragma.toLocaleLowerCase()
) {
return true;
}
return false;
}
// latest definition is an import declaration: import {<variable>} from 'react'
if (
latestDef.parent
&& latestDef.parent.type === 'ImportDeclaration'
&& latestDef.parent.source.value === pragma.toLocaleLowerCase()
) {
return true;
}
}
}
return false;
};
@@ -0,0 +1,111 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
var _types = require('../parser/tokenizer/types');
var _Transformer = require('./Transformer'); var _Transformer2 = _interopRequireDefault(_Transformer);
const JEST_GLOBAL_NAME = "jest";
const HOISTED_METHODS = ["mock", "unmock", "enableAutomock", "disableAutomock"];
/**
* Implementation of babel-plugin-jest-hoist, which hoists up some jest method
* calls above the imports to allow them to override other imports.
*
* To preserve line numbers, rather than directly moving the jest.mock code, we
* wrap each invocation in a function statement and then call the function from
* the top of the file.
*/
class JestHoistTransformer extends _Transformer2.default {
__init() {this.hoistedFunctionNames = []}
constructor(
rootTransformer,
tokens,
nameManager,
importProcessor,
) {
super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.nameManager = nameManager;this.importProcessor = importProcessor;JestHoistTransformer.prototype.__init.call(this);;
}
process() {
if (
this.tokens.currentToken().scopeDepth === 0 &&
this.tokens.matches4(_types.TokenType.name, _types.TokenType.dot, _types.TokenType.name, _types.TokenType.parenL) &&
this.tokens.identifierName() === JEST_GLOBAL_NAME
) {
// TODO: This only works if imports transform is active, which it will be for jest.
// But if jest adds module support and we no longer need the import transform, this needs fixing.
if (_optionalChain([this, 'access', _ => _.importProcessor, 'optionalAccess', _2 => _2.getGlobalNames, 'call', _3 => _3(), 'optionalAccess', _4 => _4.has, 'call', _5 => _5(JEST_GLOBAL_NAME)])) {
return false;
}
return this.extractHoistedCalls();
}
return false;
}
getHoistedCode() {
if (this.hoistedFunctionNames.length > 0) {
// This will be placed before module interop code, but that's fine since
// imports aren't allowed in module mock factories.
return this.hoistedFunctionNames.map((name) => `${name}();`).join("");
}
return "";
}
/**
* Extracts any methods calls on the jest-object that should be hoisted.
*
* According to the jest docs, https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options,
* mock, unmock, enableAutomock, disableAutomock, are the methods that should be hoisted.
*
* We do not apply the same checks of the arguments as babel-plugin-jest-hoist does.
*/
extractHoistedCalls() {
// We're handling a chain of calls where `jest` may or may not need to be inserted for each call
// in the chain, so remove the initial `jest` to make the loop implementation cleaner.
this.tokens.removeToken();
// Track some state so that multiple non-hoisted chained calls in a row keep their chaining
// syntax.
let followsNonHoistedJestCall = false;
// Iterate through all chained calls on the jest object.
while (this.tokens.matches3(_types.TokenType.dot, _types.TokenType.name, _types.TokenType.parenL)) {
const methodName = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1);
const shouldHoist = HOISTED_METHODS.includes(methodName);
if (shouldHoist) {
// We've matched e.g. `.mock(...)` or similar call.
// Replace the initial `.` with `function __jestHoist(){jest.`
const hoistedFunctionName = this.nameManager.claimFreeName("__jestHoist");
this.hoistedFunctionNames.push(hoistedFunctionName);
this.tokens.replaceToken(`function ${hoistedFunctionName}(){${JEST_GLOBAL_NAME}.`);
this.tokens.copyToken();
this.tokens.copyToken();
this.rootTransformer.processBalancedCode();
this.tokens.copyExpectedToken(_types.TokenType.parenR);
this.tokens.appendCode(";}");
followsNonHoistedJestCall = false;
} else {
// This is a non-hoisted method, so just transform the code as usual.
if (followsNonHoistedJestCall) {
// If we didn't hoist the previous call, we can leave the code as-is to chain off of the
// previous method call. It's important to preserve the code here because we don't know
// for sure that the method actually returned the jest object for chaining.
this.tokens.copyToken();
} else {
// If we hoisted the previous call, we know it returns the jest object back, so we insert
// the identifier `jest` to continue the chain.
this.tokens.replaceToken(`${JEST_GLOBAL_NAME}.`);
}
this.tokens.copyToken();
this.tokens.copyToken();
this.rootTransformer.processBalancedCode();
this.tokens.copyExpectedToken(_types.TokenType.parenR);
followsNonHoistedJestCall = true;
}
}
return true;
}
} exports.default = JestHoistTransformer;
@@ -0,0 +1,37 @@
/**
* @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 `Promise.allSettled` function",
category: "ES2020",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-promise-all-settled.html",
},
fixable: null,
messages: {
forbidden: "ES2020 'Promise.allSettled' function is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"() {
const tracker = new ReferenceTracker(context.getScope())
for (const { node } of tracker.iterateGlobalReferences({
Promise: { allSettled: { [READ]: true } },
})) {
context.report({ node, messageId: "forbidden" })
}
},
}
},
}
@@ -0,0 +1,297 @@
"use strict";
var IntegerSet_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyMintKeyDescription = exports.KeyDescription = exports.Version = exports.SecurityLevel = exports.AuthorizationList = exports.IntegerSet = exports.RootOfTrust = exports.VerifiedBootState = exports.id_ce_keyDescription = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
exports.id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
var VerifiedBootState;
(function (VerifiedBootState) {
VerifiedBootState[VerifiedBootState["verified"] = 0] = "verified";
VerifiedBootState[VerifiedBootState["selfSigned"] = 1] = "selfSigned";
VerifiedBootState[VerifiedBootState["unverified"] = 2] = "unverified";
VerifiedBootState[VerifiedBootState["failed"] = 3] = "failed";
})(VerifiedBootState || (exports.VerifiedBootState = VerifiedBootState = {}));
class RootOfTrust {
constructor(params = {}) {
this.verifiedBootKey = new asn1_schema_1.OctetString();
this.deviceLocked = false;
this.verifiedBootState = VerifiedBootState.verified;
Object.assign(this, params);
}
}
exports.RootOfTrust = RootOfTrust;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], RootOfTrust.prototype, "verifiedBootKey", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Boolean })
], RootOfTrust.prototype, "deviceLocked", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], RootOfTrust.prototype, "verifiedBootState", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString, optional: true })
], RootOfTrust.prototype, "verifiedBootHash", void 0);
let IntegerSet = IntegerSet_1 = class IntegerSet extends asn1_schema_1.AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, IntegerSet_1.prototype);
}
};
exports.IntegerSet = IntegerSet;
exports.IntegerSet = IntegerSet = IntegerSet_1 = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Set, itemType: asn1_schema_1.AsnPropTypes.Integer })
], IntegerSet);
class AuthorizationList {
constructor(params = {}) {
Object.assign(this, params);
}
}
exports.AuthorizationList = AuthorizationList;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 1, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "purpose", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 2, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "algorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 3, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "keySize", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 5, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "digest", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 6, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "padding", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 10, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "ecCurve", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 200, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "rsaPublicExponent", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 203, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "mgfDigest", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 303, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistance", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 305, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "earlyBootOnly", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 400, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "activeDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 401, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "originationExpireDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 402, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageExpireDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 405, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageCountLimit", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 503, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "noAuthRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 504, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "userAuthType", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 505, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "authTimeout", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 506, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allowWhileOnBody", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 507, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedUserPresenceRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 508, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedConfirmationRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 509, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "unlockedDeviceRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 600, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allApplications", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 601, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "applicationId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 701, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "creationDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 702, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "origin", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 703, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistant", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 704, type: RootOfTrust, optional: true })
], AuthorizationList.prototype, "rootOfTrust", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 705, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 706, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osPatchLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 709, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationApplicationId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 710, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdBrand", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 711, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdDevice", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 712, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdProduct", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 713, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSerial", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 714, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdImei", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 715, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdMeid", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 716, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdManufacturer", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 717, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdModel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 718, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "vendorPatchLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 719, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "bootPatchLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 720, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "deviceUniqueAttestation", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 723, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSecondImei", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 724, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "moduleHash", void 0);
var SecurityLevel;
(function (SecurityLevel) {
SecurityLevel[SecurityLevel["software"] = 0] = "software";
SecurityLevel[SecurityLevel["trustedEnvironment"] = 1] = "trustedEnvironment";
SecurityLevel[SecurityLevel["strongBox"] = 2] = "strongBox";
})(SecurityLevel || (exports.SecurityLevel = SecurityLevel = {}));
var Version;
(function (Version) {
Version[Version["KM2"] = 1] = "KM2";
Version[Version["KM3"] = 2] = "KM3";
Version[Version["KM4"] = 3] = "KM4";
Version[Version["KM4_1"] = 4] = "KM4_1";
Version[Version["keyMint1"] = 100] = "keyMint1";
Version[Version["keyMint2"] = 200] = "keyMint2";
Version[Version["keyMint3"] = 300] = "keyMint3";
Version[Version["keyMint4"] = 400] = "keyMint4";
})(Version || (exports.Version = Version = {}));
class KeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.KM4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keymasterVersion = 0;
this.keymasterSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new asn1_schema_1.OctetString();
this.uniqueId = new asn1_schema_1.OctetString();
this.softwareEnforced = new AuthorizationList();
this.teeEnforced = new AuthorizationList();
Object.assign(this, params);
}
}
exports.KeyDescription = KeyDescription;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyDescription.prototype, "attestationVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyDescription.prototype, "attestationSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyDescription.prototype, "keymasterVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyDescription.prototype, "keymasterSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyDescription.prototype, "attestationChallenge", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyDescription.prototype, "uniqueId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyDescription.prototype, "softwareEnforced", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyDescription.prototype, "teeEnforced", void 0);
class KeyMintKeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.keyMint4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keyMintVersion = 0;
this.keyMintSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new asn1_schema_1.OctetString();
this.uniqueId = new asn1_schema_1.OctetString();
this.softwareEnforced = new AuthorizationList();
this.hardwareEnforced = new AuthorizationList();
Object.assign(this, params);
}
toLegacyKeyDescription() {
return new KeyDescription({
attestationVersion: this.attestationVersion,
attestationSecurityLevel: this.attestationSecurityLevel,
keymasterVersion: this.keyMintVersion,
keymasterSecurityLevel: this.keyMintSecurityLevel,
attestationChallenge: this.attestationChallenge,
uniqueId: this.uniqueId,
softwareEnforced: this.softwareEnforced,
teeEnforced: this.hardwareEnforced,
});
}
static fromLegacyKeyDescription(keyDesc) {
return new KeyMintKeyDescription({
attestationVersion: keyDesc.attestationVersion,
attestationSecurityLevel: keyDesc.attestationSecurityLevel,
keyMintVersion: keyDesc.keymasterVersion,
keyMintSecurityLevel: keyDesc.keymasterSecurityLevel,
attestationChallenge: keyDesc.attestationChallenge,
uniqueId: keyDesc.uniqueId,
softwareEnforced: keyDesc.softwareEnforced,
hardwareEnforced: keyDesc.teeEnforced,
});
}
}
exports.KeyMintKeyDescription = KeyMintKeyDescription;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "attestationVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "attestationSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "keyMintVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "keyMintSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyMintKeyDescription.prototype, "attestationChallenge", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyMintKeyDescription.prototype, "uniqueId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "softwareEnforced", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "hardwareEnforced", void 0);
@@ -0,0 +1,523 @@
"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/components/date-input.ts
var date_input_exports = {};
__export(date_input_exports, {
dateInput: () => dateInput
});
module.exports = __toCommonJS(date_input_exports);
// src/utils/tv.ts
var import_tailwind_variants = require("tailwind-variants");
// src/utils/tw-merge-config.ts
var COMMON_UNITS = ["small", "medium", "large"];
var twMergeConfig = {
theme: {
opacity: ["disabled"],
spacing: ["divider"],
borderWidth: COMMON_UNITS,
borderRadius: COMMON_UNITS
},
classGroups: {
shadow: [{ shadow: COMMON_UNITS }],
"font-size": [{ text: ["tiny", ...COMMON_UNITS] }],
"bg-image": [
"bg-stripe-gradient-default",
"bg-stripe-gradient-primary",
"bg-stripe-gradient-secondary",
"bg-stripe-gradient-success",
"bg-stripe-gradient-warning",
"bg-stripe-gradient-danger"
]
}
};
// src/utils/tv.ts
var tv = (options, config) => {
var _a, _b, _c;
return (0, import_tailwind_variants.tv)(options, {
...config,
twMerge: (_a = config == null ? void 0 : config.twMerge) != null ? _a : true,
twMergeConfig: {
...config == null ? void 0 : config.twMergeConfig,
theme: {
...(_b = config == null ? void 0 : config.twMergeConfig) == null ? void 0 : _b.theme,
...twMergeConfig.theme
},
classGroups: {
...(_c = config == null ? void 0 : config.twMergeConfig) == null ? void 0 : _c.classGroups,
...twMergeConfig.classGroups
}
}
});
};
// src/components/date-input.ts
var dateInput = tv({
slots: {
base: "group flex flex-col",
label: [
"block subpixel-antialiased text-small text-default-600",
"group-data-[required=true]:after:content-['*'] group-data-[required=true]:after:text-danger group-data-[required=true]:after:ml-0.5",
"group-data-[invalid=true]:text-danger"
],
inputWrapper: [
"relative px-3 gap-3 w-full inline-flex flex-row items-center",
"cursor-text tap-highlight-transparent shadow-sm"
],
input: "flex h-full gap-x-0.5 w-full font-normal",
innerWrapper: [
"flex items-center text-default-400 w-full gap-x-2 h-6",
"group-data-[invalid=true]:text-danger"
],
segment: [
"group first:-ml-0.5 [&:not(:first-child)]:-ml-1 px-0.5 my-auto box-content tabular-nums text-start",
"inline-block outline-none focus:shadow-sm rounded-md",
"text-foreground-500 data-[editable=true]:text-foreground",
"data-[editable=true]:data-[placeholder=true]:text-foreground-500",
"data-[invalid=true]:text-danger-300 data-[invalid=true]:data-[editable=true]:text-danger",
"data-[invalid=true]:focus:bg-danger-400/50 dark:data-[invalid=true]:focus:bg-danger-400/20",
"data-[invalid=true]:data-[editable=true]:focus:text-danger"
],
helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
description: "text-tiny text-foreground-400",
errorMessage: "text-tiny text-danger"
},
variants: {
variant: {
flat: {
inputWrapper: [
"bg-default-100",
"hover:bg-default-200",
"focus-within:hover:bg-default-100",
"group-data-[invalid=true]:bg-danger-50",
"group-data-[invalid=true]:hover:bg-danger-100",
"group-data-[invalid=true]:focus-within:hover:bg-danger-50"
]
},
faded: {
inputWrapper: [
"bg-default-100",
"border-medium",
"border-default-200",
"hover:border-default-400",
"group-data-[invalid=true]:bg-danger-50",
"group-data-[invalid=true]:hover:bg-danger-100",
"group-data-[invalid=true]:focus-within:hover:bg-danger-50"
]
},
bordered: {
inputWrapper: [
"border-medium",
"border-default-200",
"hover:border-default-400",
"focus-within:border-default-foreground",
"focus-within:hover:border-default-foreground",
"group-data-[invalid=true]:border-danger",
"group-data-[invalid=true]:hover:border-danger",
"group-data-[invalid=true]:focus-within:hover:border-danger"
]
},
underlined: {
inputWrapper: [
"px-1",
"pb-1",
"gap-0",
"relative",
"box-border",
"border-b-medium",
"shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
"border-default-200",
"!rounded-none",
"hover:border-default-300",
"after:content-['']",
"after:w-0",
"after:origin-center",
"after:bg-default-foreground",
"after:absolute",
"after:left-1/2",
"after:-translate-x-1/2",
"after:-bottom-[2px]",
"after:h-[2px]",
"focus-within:after:w-full",
"group-data-[invalid=true]:after:bg-danger"
]
}
},
color: {
default: {
segment: "focus:bg-default-400/50 data-[editable=true]:focus:text-default-foreground"
},
primary: {
segment: "focus:bg-primary-400/50 data-[editable=true]:focus:text-primary"
},
secondary: {
segment: "focus:bg-secondary-400/50 data-[editable=true]:focus:text-secondary"
},
success: {
segment: "focus:bg-success-400/50 dark:focus:bg-success-400/20 data-[editable=true]:focus:text-success"
},
warning: {
segment: "focus:bg-warning-400/50 dark:focus:bg-warning-400/20 data-[editable=true]:focus:text-warning"
},
danger: {
segment: "focus:bg-danger-400/50 dark:focus:bg-danger-400/20 data-[editable=true]:focus:text-danger"
}
},
size: {
sm: {
label: "text-tiny",
input: "text-small",
inputWrapper: "h-8 min-h-8 px-2 rounded-small"
},
md: {
input: "text-small",
inputWrapper: "h-10 min-h-10 rounded-medium",
clearButton: "text-large"
},
lg: {
label: "text-medium",
input: "text-medium",
inputWrapper: "h-12 min-h-12 rounded-large"
}
},
radius: {
none: {
inputWrapper: "rounded-none"
},
sm: {
inputWrapper: "rounded-small"
},
md: {
inputWrapper: "rounded-medium"
},
lg: {
inputWrapper: "rounded-large"
},
full: {
inputWrapper: "rounded-full"
}
},
labelPlacement: {
outside: {
base: "flex flex-col data-[has-helper=true]:pb-[calc(theme(fontSize.tiny)_+8px)] gap-y-1.5",
label: "w-full text-foreground",
helperWrapper: "absolute top-[calc(100%_+_2px)] start-0"
},
"outside-left": {
base: "flex-row items-center data-[has-helper=true]:pb-[calc(theme(fontSize.tiny)_+_8px)] gap-x-2 flex-nowrap",
label: "relative text-foreground",
inputWrapper: "relative flex-1",
helperWrapper: "absolute top-[calc(100%_+_2px)] start-0"
},
inside: {
label: "w-full text-tiny cursor-text",
inputWrapper: "flex-col items-start justify-center gap-0"
}
},
fullWidth: {
true: {
base: "w-full",
inputWrapper: "w-full"
}
},
isDisabled: {
true: {
base: "opacity-disabled pointer-events-none",
inputWrapper: "pointer-events-none",
label: "pointer-events-none"
}
},
disableAnimation: {
true: {
label: "transition-none",
input: "transition-none",
inputWrapper: "transition-none"
},
false: {
label: [
"!ease-out",
"!duration-200",
"will-change-auto",
"motion-reduce:transition-none",
"transition-[color,opacity]"
],
inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
segment: "transition-colors motion-reduce:transition-none"
}
}
},
defaultVariants: {
variant: "flat",
color: "default",
size: "md",
fullWidth: true,
labelPlacement: "inside",
isDisabled: false
},
compoundVariants: [
{
variant: "flat",
color: "primary",
class: {
innerWrapper: "text-primary",
inputWrapper: ["bg-primary-100", "hover:bg-primary-50", "focus-within:bg-primary-50"],
segment: "text-primary-300 data-[editable=true]:data-[placeholder=true]:text-primary-300 data-[editable=true]:text-primary",
label: "text-primary"
}
},
{
variant: "flat",
color: "secondary",
class: {
innerWrapper: "text-secondary",
inputWrapper: ["bg-secondary-100", "hover:bg-secondary-50", "focus-within:bg-secondary-50"],
segment: "text-secondary-300 data-[editable=true]:data-[placeholder=true]:text-secondary-300 data-[editable=true]:text-secondary",
label: "text-secondary"
}
},
{
variant: "flat",
color: "success",
class: {
innerWrapper: "text-success-600 dark:text-success",
inputWrapper: ["bg-success-100", "hover:bg-success-50", "focus-within:bg-success-50"],
segment: "text-success-400 data-[editable=true]:data-[placeholder=true]:text-success-400 data-[editable=true]:text-success-600 data-[editable=true]:focus:text-success-600",
label: "text-success-600 dark:text-success"
}
},
{
variant: "flat",
color: "warning",
class: {
innerWrapper: "text-warning-600 dark:text-warning",
inputWrapper: ["bg-warning-100", "hover:bg-warning-50", "focus-within:bg-warning-50"],
segment: "text-warning-400 data-[editable=true]:data-[placeholder=true]:text-warning-400 data-[editable=true]:text-warning-600 data-[editable=true]:focus:text-warning-600",
label: "text-warning-600 dark:text-warning"
}
},
{
variant: "flat",
color: "danger",
class: {
innerWrapper: "text-danger",
inputWrapper: ["bg-danger-100", "hover:bg-danger-50", "focus-within:bg-danger-50"],
segment: "text-danger-300 data-[editable=true]:data-[placeholder=true]:text-danger-300 data-[editable=true]:text-danger",
label: "text-danger"
}
},
{
variant: "faded",
color: "primary",
class: {
innerWrapper: "text-primary",
inputWrapper: [
"hover:border-primary",
"focus-within:border-primary",
"focus-within:hover:border-primary"
],
label: "text-primary"
}
},
{
variant: "faded",
color: "secondary",
class: {
innerWrapper: "text-secondary",
inputWrapper: [
"hover:border-secondary",
"focus-within:border-secondary",
"focus-within:hover:border-secondary"
],
label: "text-secondary"
}
},
{
variant: "faded",
color: "success",
class: {
innerWrapper: "text-success",
inputWrapper: [
"hover:border-success",
"focus-within:border-success",
"focus-within:hover:border-success"
],
label: "text-success"
}
},
{
variant: "faded",
color: "warning",
class: {
innerWrapper: "text-warning",
inputWrapper: [
"hover:border-warning",
"focus-within:border-warning",
"focus-within:hover:border-warning"
],
label: "text-warning"
}
},
{
variant: "faded",
color: "danger",
class: {
innerWrapper: "text-danger",
inputWrapper: [
"hover:border-danger",
"focus-within:border-danger",
"focus-within:hover:border-danger"
],
label: "text-danger"
}
},
{
variant: "bordered",
color: "primary",
class: {
innerWrapper: "text-primary",
inputWrapper: ["focus-within:border-primary", "focus-within:hover:border-primary"],
label: "text-primary"
}
},
{
variant: "bordered",
color: "secondary",
class: {
innerWrapper: "text-secondary",
inputWrapper: ["focus-within:border-secondary", "focus-within:hover:border-secondary"],
label: "text-secondary"
}
},
{
variant: "bordered",
color: "success",
class: {
innerWrapper: "text-success",
inputWrapper: ["focus-within:border-success", "focus-within:hover:border-success"],
label: "text-success"
}
},
{
variant: "bordered",
color: "warning",
class: {
innerWrapper: "text-warning",
inputWrapper: ["focus-within:border-warning", "focus-within:hover:border-warning"],
label: "text-warning"
}
},
{
variant: "bordered",
color: "danger",
class: {
innerWrapper: "text-danger",
inputWrapper: ["focus-within:border-danger", "focus-within:hover:border-danger"],
label: "text-danger"
}
},
{
variant: "underlined",
color: "primary",
class: {
innerWrapper: "text-primary",
inputWrapper: "after:bg-primary",
label: "text-primary"
}
},
{
variant: "underlined",
color: "secondary",
class: {
innerWrapper: "text-secondary",
inputWrapper: "after:bg-secondary",
label: "text-secondary"
}
},
{
variant: "underlined",
color: "success",
class: {
innerWrapper: "text-success",
inputWrapper: "after:bg-success",
label: "text-success"
}
},
{
variant: "underlined",
color: "warning",
class: {
innerWrapper: "text-warning",
inputWrapper: "after:bg-warning",
label: "text-warning"
}
},
{
variant: "underlined",
color: "danger",
class: {
innerWrapper: "text-danger",
inputWrapper: "after:bg-danger",
label: "text-danger"
}
},
{
labelPlacement: "inside",
size: "sm",
class: {
inputWrapper: "h-12 py-1.5 px-3"
}
},
{
labelPlacement: "inside",
size: "md",
class: {
inputWrapper: "h-14 py-2"
}
},
{
labelPlacement: "inside",
size: "lg",
class: {
label: "text-medium",
inputWrapper: "h-16 py-2.5 gap-0"
}
},
{
disableAnimation: false,
variant: ["faded", "bordered"],
class: {
inputWrapper: "transition-colors motion-reduce:transition-none"
}
},
{
disableAnimation: false,
variant: "underlined",
class: {
inputWrapper: "after:transition-width motion-reduce:after:transition-none"
}
}
]
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
dateInput
});
@@ -0,0 +1 @@
{"version":3,"file":"minpath.d.ts","sourceRoot":"","sources":["minpath.js"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
declare function useRafInterval(fn: () => void, delay: number | undefined, options?: {
immediate?: boolean;
}): () => void;
export default useRafInterval;
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return isKeyframeRule;
}
});
function isKeyframeRule(rule) {
return rule.parent && rule.parent.type === "atrule" && /keyframes$/.test(rule.parent.name);
}
@@ -0,0 +1,140 @@
/**
* @typedef {object} ScreenValue
* @property {number|undefined} min
* @property {number|undefined} max
* @property {string|undefined} raw
*/
/**
* @typedef {object} Screen
* @property {string} name
* @property {boolean} not
* @property {ScreenValue[]} values
*/
/**
* A function that normalizes the various forms that the screens object can be
* provided in.
*
* Input(s):
* - ['100px', '200px'] // Raw strings
* - { sm: '100px', md: '200px' } // Object with string values
* - { sm: { min: '100px' }, md: { max: '100px' } } // Object with object values
* - { sm: [{ min: '100px' }, { max: '200px' }] } // Object with object array (multiple values)
*
* Output(s):
* - [{ name: 'sm', values: [{ min: '100px', max: '200px' }] }] // List of objects, that contains multiple values
*
* @returns {Screen[]}
*/
export function normalizeScreens(screens, root = true) {
if (Array.isArray(screens)) {
return screens.map((screen) => {
if (root && Array.isArray(screen)) {
throw new Error('The tuple syntax is not supported for `screens`.')
}
if (typeof screen === 'string') {
return { name: screen.toString(), not: false, values: [{ min: screen, max: undefined }] }
}
let [name, options] = screen
name = name.toString()
if (typeof options === 'string') {
return { name, not: false, values: [{ min: options, max: undefined }] }
}
if (Array.isArray(options)) {
return { name, not: false, values: options.map((option) => resolveValue(option)) }
}
return { name, not: false, values: [resolveValue(options)] }
})
}
return normalizeScreens(Object.entries(screens ?? {}), false)
}
/**
* @param {Screen} screen
* @returns {{result: false, reason: string} | {result: true, reason: null}}
*/
export function isScreenSortable(screen) {
if (screen.values.length !== 1) {
return { result: false, reason: 'multiple-values' }
} else if (screen.values[0].raw !== undefined) {
return { result: false, reason: 'raw-values' }
} else if (screen.values[0].min !== undefined && screen.values[0].max !== undefined) {
return { result: false, reason: 'min-and-max' }
}
return { result: true, reason: null }
}
/**
* @param {'min' | 'max'} type
* @param {Screen | 'string'} a
* @param {Screen | 'string'} z
* @returns {number}
*/
export function compareScreens(type, a, z) {
let aScreen = toScreen(a, type)
let zScreen = toScreen(z, type)
let aSorting = isScreenSortable(aScreen)
let bSorting = isScreenSortable(zScreen)
// These cases should never happen and indicate a bug in Tailwind CSS itself
if (aSorting.reason === 'multiple-values' || bSorting.reason === 'multiple-values') {
throw new Error(
'Attempted to sort a screen with multiple values. This should never happen. Please open a bug report.'
)
} else if (aSorting.reason === 'raw-values' || bSorting.reason === 'raw-values') {
throw new Error(
'Attempted to sort a screen with raw values. This should never happen. Please open a bug report.'
)
} else if (aSorting.reason === 'min-and-max' || bSorting.reason === 'min-and-max') {
throw new Error(
'Attempted to sort a screen with both min and max values. This should never happen. Please open a bug report.'
)
}
// Let the sorting begin
let { min: aMin, max: aMax } = aScreen.values[0]
let { min: zMin, max: zMax } = zScreen.values[0]
// Negating screens flip their behavior. Basically `not min-width` is `max-width`
if (a.not) [aMin, aMax] = [aMax, aMin]
if (z.not) [zMin, zMax] = [zMax, zMin]
aMin = aMin === undefined ? aMin : parseFloat(aMin)
aMax = aMax === undefined ? aMax : parseFloat(aMax)
zMin = zMin === undefined ? zMin : parseFloat(zMin)
zMax = zMax === undefined ? zMax : parseFloat(zMax)
let [aValue, zValue] = type === 'min' ? [aMin, zMin] : [zMax, aMax]
return aValue - zValue
}
/**
*
* @param {PartialScreen> | string} value
* @param {'min' | 'max'} type
* @returns {Screen}
*/
export function toScreen(value, type) {
if (typeof value === 'object') {
return value
}
return {
name: 'arbitrary-screen',
values: [{ [type]: value }],
}
}
function resolveValue({ 'min-width': _minWidth, min = _minWidth, max, raw } = {}) {
return { min, max, raw }
}
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=issue_549.int.spec.d.ts.map
@@ -0,0 +1,114 @@
"use client";
// src/overlays/ariaHideOutside.ts
var refCountMap = /* @__PURE__ */ new WeakMap();
var observerStack = [];
function ariaHideOutside(targets, root = document.body) {
let visibleNodes = new Set(targets);
let hiddenNodes = /* @__PURE__ */ new Set();
let walk = (root2) => {
for (let element of root2.querySelectorAll(
"[data-live-announcer], [data-react-aria-top-layer]"
)) {
visibleNodes.add(element);
}
let acceptNode = (node) => {
if (visibleNodes.has(node) || node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") {
return NodeFilter.FILTER_REJECT;
}
for (let target of visibleNodes) {
if (node.contains(target)) {
return NodeFilter.FILTER_SKIP;
}
}
return NodeFilter.FILTER_ACCEPT;
};
let walker = document.createTreeWalker(root2, NodeFilter.SHOW_ELEMENT, { acceptNode });
let acceptRoot = acceptNode(root2);
if (acceptRoot === NodeFilter.FILTER_ACCEPT) {
hide(root2);
}
if (acceptRoot !== NodeFilter.FILTER_REJECT) {
let node = walker.nextNode();
while (node != null) {
hide(node);
node = walker.nextNode();
}
}
};
let hide = (node) => {
var _a;
let refCount = (_a = refCountMap.get(node)) != null ? _a : 0;
if (node.getAttribute("aria-hidden") === "true" && refCount === 0) {
return;
}
if (refCount === 0) {
node.setAttribute("aria-hidden", "true");
}
hiddenNodes.add(node);
refCountMap.set(node, refCount + 1);
};
if (observerStack.length) {
observerStack[observerStack.length - 1].disconnect();
}
walk(root);
let observer = new MutationObserver((changes) => {
for (let change of changes) {
if (change.type !== "childList" || change.addedNodes.length === 0) {
continue;
}
if (![...visibleNodes, ...hiddenNodes].some((node) => node.contains(change.target))) {
for (let node of change.removedNodes) {
if (node instanceof Element) {
visibleNodes.delete(node);
hiddenNodes.delete(node);
}
}
for (let node of change.addedNodes) {
if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) {
visibleNodes.add(node);
} else if (node instanceof Element) {
walk(node);
}
}
}
}
});
observer.observe(root, { childList: true, subtree: true });
let observerWrapper = {
observe() {
observer.observe(root, { childList: true, subtree: true });
},
disconnect() {
observer.disconnect();
}
};
observerStack.push(observerWrapper);
return () => {
observer.disconnect();
for (let node of hiddenNodes) {
let count = refCountMap.get(node);
if (count == null) {
continue;
}
if (count === 1) {
node.removeAttribute("aria-hidden");
refCountMap.delete(node);
} else {
refCountMap.set(node, count - 1);
}
}
if (observerWrapper === observerStack[observerStack.length - 1]) {
observerStack.pop();
if (observerStack.length) {
observerStack[observerStack.length - 1].observe();
}
} else {
observerStack.splice(observerStack.indexOf(observerWrapper), 1);
}
};
}
export {
ariaHideOutside
};
@@ -0,0 +1,71 @@
import path from 'node:path';
import { readdir } from 'node:fs';
/**
* @typedef WalkState
* @interface
* @property {string[]} files - files
* @property {number} calls - number of ongoing calls
* @property {(dir: string)=>boolean} skip - function to skip dirs
* @property {boolean} err - error flag
* @property {string[]} configNames - config file names
*/
const sep = path.sep;
/**
* find all tsconfig.json files in dir
*
* @param {string} dir - path to dir (absolute or relative to cwd)
* @param {import('./public.d.ts').TSConfckFindAllOptions} [options] - options
* @returns {Promise<string[]>} list of absolute paths to all found tsconfig.json files
*/
export async function findAll(dir, options) {
/** @type WalkState */
const state = {
files: [],
calls: 0,
skip: options?.skip,
err: false,
configNames: options?.configNames ?? ['tsconfig.json']
};
return new Promise((resolve, reject) => {
walk(path.resolve(dir), state, (err, files) => (err ? reject(err) : resolve(files)));
});
}
/**
*
* @param {string} dir
* @param {WalkState} state
* @param {(err: NodeJS.ErrnoException | null, files?: string[]) => void} done
*/
function walk(dir, state, done) {
if (state.err) {
return;
}
state.calls++;
readdir(dir, { withFileTypes: true }, (err, entries = []) => {
if (state.err) {
return;
}
// skip deleted or inaccessible directories
if (err && !(err.code === 'ENOENT' || err.code === 'EACCES' || err.code === 'EPERM')) {
state.err = true;
done(err);
} else {
for (const ent of entries) {
if (ent.isDirectory() && !state.skip?.(ent.name)) {
walk(`${dir}${sep}${ent.name}`, state, done);
} else if (ent.isFile() && state.configNames.includes(ent.name)) {
state.files.push(`${dir}${sep}${ent.name}`);
}
}
if (--state.calls === 0) {
if (!state.err) {
done(null, state.files);
}
}
}
});
}
@@ -0,0 +1,13 @@
import { memo } from 'motion-utils';
const supportsPartialKeyframes = /*@__PURE__*/ memo(() => {
try {
document.createElement("div").animate({ opacity: [1] });
}
catch (e) {
return false;
}
return true;
});
export { supportsPartialKeyframes };
@@ -0,0 +1,18 @@
"use strict";
const Level = require("./Level.js");
function normalizeLevel(level) {
if (typeof level === "string") {
level = Level[level.toUpperCase()];
if (level === void 0) {
return;
}
return level;
}
if (typeof level === "number") {
if (Level[level] === void 0) {
return;
}
return level;
}
}
module.exports = normalizeLevel;
@@ -0,0 +1,252 @@
'use strict';
var utils = require('../utils.js');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
const OPTION_ALWAYS = "always";
const OPTION_NEVER = "never";
const OPTION_IGNORE = "ignore";
const OPTION_VALUES = [
OPTION_ALWAYS,
OPTION_NEVER,
OPTION_IGNORE
];
const DEFAULT_CONFIG = { props: OPTION_NEVER, children: OPTION_NEVER, propElementValues: OPTION_IGNORE };
const messages = {
unnecessaryCurly: "Curly braces are unnecessary here.",
missingCurly: "Need to wrap this literal in a JSX expression."
};
var jsxCurlyBracePresence = utils.createRule({
name: "jsx-curly-brace-presence",
package: "jsx",
meta: {
type: "layout",
docs: {
description: "Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes"
},
fixable: "code",
messages,
schema: [
{
anyOf: [
{
type: "object",
properties: {
props: { type: "string", enum: OPTION_VALUES },
children: { type: "string", enum: OPTION_VALUES },
propElementValues: { type: "string", enum: OPTION_VALUES }
},
additionalProperties: false
},
{
type: "string",
enum: OPTION_VALUES
}
]
}
]
},
create(context) {
const HTML_ENTITY_REGEX = () => /&[A-Z\d#]+;/gi;
const ruleOptions = context.options[0];
const userConfig = typeof ruleOptions === "string" ? { props: ruleOptions, children: ruleOptions, propElementValues: OPTION_IGNORE } : Object.assign({}, DEFAULT_CONFIG, ruleOptions);
function containsLineTerminators(rawStringValue) {
return /[\n\r\u2028\u2029]/.test(rawStringValue);
}
function containsBackslash(rawStringValue) {
return rawStringValue.includes("\\");
}
function containsHTMLEntity(rawStringValue) {
return HTML_ENTITY_REGEX().test(rawStringValue);
}
function containsOnlyHtmlEntities(rawStringValue) {
return rawStringValue.replace(HTML_ENTITY_REGEX(), "").trim() === "";
}
function containsDisallowedJSXTextChars(rawStringValue) {
return /[{<>}]/.test(rawStringValue);
}
function containsQuoteCharacters(value) {
return /['"]/.test(value);
}
function containsMultilineComment(value) {
return /\/\*/.test(value);
}
function escapeDoubleQuotes(rawStringValue) {
return rawStringValue.replace(/\\"/g, '"').replace(/"/g, '\\"');
}
function escapeBackslashes(rawStringValue) {
return rawStringValue.replace(/\\/g, "\\\\");
}
function needToEscapeCharacterForJSX(raw, node) {
return containsBackslash(raw) || containsHTMLEntity(raw) || node.parent.type !== "JSXAttribute" && containsDisallowedJSXTextChars(raw);
}
function containsWhitespaceExpression(child) {
if (child.type === "JSXExpressionContainer") {
const value = child.expression.value;
return value ? utils.isWhiteSpaces(value) : false;
}
return false;
}
function isLineBreak(text) {
return containsLineTerminators(text) && text.trim() === "";
}
function wrapNonHTMLEntities(text) {
const HTML_ENTITY = "<HTML_ENTITY>";
const withCurlyBraces = text.split(HTML_ENTITY_REGEX()).map((word) => word === "" ? "" : `{${JSON.stringify(word)}}`).join(HTML_ENTITY);
const htmlEntities = text.match(HTML_ENTITY_REGEX());
return htmlEntities.reduce((acc, htmlEntity) => acc.replace(HTML_ENTITY, htmlEntity), withCurlyBraces);
}
function wrapWithCurlyBraces(rawText) {
if (!containsLineTerminators(rawText))
return `{${JSON.stringify(rawText)}}`;
return rawText.split("\n").map((line) => {
if (line.trim() === "")
return line;
const firstCharIndex = line.search(/\S/);
const leftWhitespace = line.slice(0, firstCharIndex);
const text = line.slice(firstCharIndex);
if (containsHTMLEntity(line))
return `${leftWhitespace}${wrapNonHTMLEntities(text)}`;
return `${leftWhitespace}{${JSON.stringify(text)}}`;
}).join("\n");
}
function reportUnnecessaryCurly(JSXExpressionNode) {
context.report({
messageId: "unnecessaryCurly",
node: JSXExpressionNode,
fix(fixer) {
const expression = JSXExpressionNode.expression;
let textToReplace;
if (utils.isJSX(expression)) {
const sourceCode = context.sourceCode;
textToReplace = sourceCode.getText(expression);
} else {
const parentType = JSXExpressionNode.parent.type;
if (parentType === "JSXAttribute") {
textToReplace = `"${expression.type === "TemplateLiteral" ? expression.quasis[0].value.raw : expression.raw.slice(1, -1)}"`;
} else if (utils.isJSX(expression)) {
const sourceCode = context.sourceCode;
textToReplace = sourceCode.getText(expression);
} else {
textToReplace = expression.type === "TemplateLiteral" ? expression.quasis[0].value.cooked : expression.value;
}
}
return fixer.replaceText(JSXExpressionNode, textToReplace);
}
});
}
function reportMissingCurly(literalNode) {
context.report({
messageId: "missingCurly",
node: literalNode,
fix(fixer) {
if (utils.isJSX(literalNode))
return fixer.replaceText(literalNode, `{${context.sourceCode.getText(literalNode)}}`);
if (containsOnlyHtmlEntities(literalNode.raw) || literalNode.parent.type === "JSXAttribute" && containsLineTerminators(literalNode.raw) || isLineBreak(literalNode.raw)) {
return null;
}
const expression = literalNode.parent.type === "JSXAttribute" ? `{"${escapeDoubleQuotes(escapeBackslashes(
literalNode.raw.slice(1, -1)
))}"}` : wrapWithCurlyBraces(literalNode.raw);
return fixer.replaceText(literalNode, expression);
}
});
}
function isWhiteSpaceLiteral(node) {
return node.type && node.type === "Literal" && node.value && utils.isWhiteSpaces(node.value);
}
function isStringWithTrailingWhiteSpaces(value) {
return /^\s|\s$/.test(value);
}
function isLiteralWithTrailingWhiteSpaces(node) {
return node.type && node.type === "Literal" && node.value && isStringWithTrailingWhiteSpaces(node.value);
}
function lintUnnecessaryCurly(JSXExpressionNode) {
const expression = JSXExpressionNode.expression;
const expressionType = expression.type;
const sourceCode = context.sourceCode;
if (sourceCode.getCommentsInside && sourceCode.getCommentsInside(JSXExpressionNode).length > 0)
return;
if ((expressionType === "Literal" || expressionType === "JSXText") && typeof expression.value === "string" && (JSXExpressionNode.parent.type === "JSXAttribute" && !isWhiteSpaceLiteral(expression) || !isLiteralWithTrailingWhiteSpaces(expression)) && !containsMultilineComment(expression.value) && !needToEscapeCharacterForJSX(expression.raw, JSXExpressionNode) && (utils.isJSX(JSXExpressionNode.parent) || !containsQuoteCharacters(expression.value))) {
reportUnnecessaryCurly(JSXExpressionNode);
} else if (expressionType === "TemplateLiteral" && expression.expressions.length === 0 && !expression.quasis[0].value.raw.includes("\n") && !isStringWithTrailingWhiteSpaces(expression.quasis[0].value.raw) && !needToEscapeCharacterForJSX(expression.quasis[0].value.raw, JSXExpressionNode) && !containsQuoteCharacters(expression.quasis[0].value.cooked)) {
reportUnnecessaryCurly(JSXExpressionNode);
} else if (utils.isJSX(expression)) {
reportUnnecessaryCurly(JSXExpressionNode);
}
}
function areRuleConditionsSatisfied(parent, config, ruleCondition) {
return parent.type === "JSXAttribute" && typeof config.props === "string" && config.props === ruleCondition || utils.isJSX(parent) && typeof config.children === "string" && config.children === ruleCondition;
}
function getAdjacentSiblings(node, children) {
for (let i = 1; i < children.length - 1; i++) {
const child = children[i];
if (node === child)
return [children[i - 1], children[i + 1]];
}
if (node === children[0] && children[1])
return [children[1]];
if (node === children[children.length - 1] && children[children.length - 2])
return [children[children.length - 2]];
return [];
}
function hasAdjacentJsxExpressionContainers(node, children) {
if (!children)
return false;
const childrenExcludingWhitespaceLiteral = children.filter((child) => !isWhiteSpaceLiteral(child));
const adjSiblings = getAdjacentSiblings(node, childrenExcludingWhitespaceLiteral);
return adjSiblings.some((x) => x.type && x.type === "JSXExpressionContainer");
}
function hasAdjacentJsx(node, children) {
if (!children)
return false;
const childrenExcludingWhitespaceLiteral = children.filter((child) => !isWhiteSpaceLiteral(child));
const adjSiblings = getAdjacentSiblings(node, childrenExcludingWhitespaceLiteral);
return adjSiblings.some((x) => x.type && ["JSXExpressionContainer", "JSXElement"].includes(x.type));
}
function shouldCheckForUnnecessaryCurly(node, config) {
const parent = node.parent;
if (parent.type && parent.type === "JSXAttribute" && (node.expression && node.expression.type && node.expression.type !== "Literal" && node.expression.type !== "StringLiteral" && node.expression.type !== "TemplateLiteral")) {
return false;
}
if (utils.isJSX(parent) && hasAdjacentJsxExpressionContainers(node, parent.children))
return false;
if (containsWhitespaceExpression(node) && hasAdjacentJsx(node, parent.children))
return false;
if (parent.children && parent.children.length === 1 && containsWhitespaceExpression(node)) {
return false;
}
return areRuleConditionsSatisfied(parent, config, OPTION_NEVER);
}
function shouldCheckForMissingCurly(node, config) {
if (utils.isJSX(node))
return config.propElementValues !== OPTION_IGNORE;
if (isLineBreak(node.raw) || containsOnlyHtmlEntities(node.raw)) {
return false;
}
const parent = node.parent;
if (parent.children && parent.children.length === 1 && containsWhitespaceExpression(parent.children[0])) {
return false;
}
return areRuleConditionsSatisfied(parent, config, OPTION_ALWAYS);
}
return {
"JSXAttribute > JSXExpressionContainer > JSXElement": function(node) {
if (userConfig.propElementValues === OPTION_NEVER)
reportUnnecessaryCurly(node.parent);
},
JSXExpressionContainer(node) {
if (shouldCheckForUnnecessaryCurly(node, userConfig))
lintUnnecessaryCurly(node);
},
"JSXAttribute > JSXElement, Literal, JSXText": function(node) {
if (shouldCheckForMissingCurly(node, userConfig))
reportMissingCurly(node);
}
};
}
});
module.exports = jsxCurlyBracePresence;
@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* @file ttf `name`编码表
* @author mengke01(kekee000@gmail.com)
*/
var nameId = {
0: 'copyright',
1: 'fontFamily',
2: 'fontSubFamily',
3: 'uniqueSubFamily',
4: 'fullName',
5: 'version',
6: 'postScriptName',
7: 'tradeMark',
8: 'manufacturer',
9: 'designer',
10: 'description',
11: 'urlOfFontVendor',
12: 'urlOfFontDesigner',
13: 'licence',
14: 'urlOfLicence',
16: 'preferredFamily',
17: 'preferredSubFamily',
18: 'compatibleFull',
19: 'sampleText'
};
// 反转names
var nameIdHash = {};
Object.keys(nameId).forEach(function (id) {
nameIdHash[nameId[id]] = +id;
});
nameId.names = nameIdHash;
var _default = exports.default = nameId;
@@ -0,0 +1,14 @@
# vp-runtime-helper
[![npm package](https://nodei.co/npm/vp-runtime-helper.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vp-runtime-helper)
> Helper functions for Vite plugins.
[![NPM version](https://img.shields.io/npm/v/vp-runtime-helper.svg?style=flat)](https://npmjs.org/package/vp-runtime-helper)
[![NPM Downloads](https://img.shields.io/npm/dm/vp-runtime-helper.svg?style=flat)](https://npmjs.org/package/vp-runtime-helper)
## Installation
```bash
npm install vp-runtime-helper --save
```
@@ -0,0 +1,16 @@
{
"name": "buffer-fill",
"version": "1.0.0",
"license": "MIT",
"repository": "LinusU/buffer-fill",
"files": [
"index.js"
],
"scripts": {
"test": "standard && node test"
},
"devDependencies": {
"buffer-alloc-unsafe": "^1.1.0",
"standard": "^7.1.2"
}
}
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAUM,SAAS,yCAAiB,UAAkC,CAAC,CAAC;IACnE,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IACvB,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,KAAK,UAAU,CAAC,QAAQ,UAAU;QAAC;QAAQ;KAAQ;AAC9E","sources":["packages/@react-aria/i18n/src/useListFormatter.tsx"],"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 {useLocale} from './context';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized list formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the list formatter for performance.\n * @param options - Formatting options.\n */\nexport function useListFormatter(options: Intl.ListFormatOptions = {}): Intl.ListFormat {\n let {locale} = useLocale();\n return useMemo(() => new Intl.ListFormat(locale, options), [locale, options]);\n}\n"],"names":[],"version":3,"file":"useListFormatter.module.js.map"}
@@ -0,0 +1,18 @@
'use strict';
var define = require('define-properties');
var getPolyfill = require('./polyfill');
var $IteratorPrototype = require('../Iterator.prototype/implementation');
module.exports = function shimIteratorPrototypeFlatMap() {
var polyfill = getPolyfill();
define(
$IteratorPrototype,
{ flatMap: polyfill },
{ flatMap: function () { return $IteratorPrototype.flatMap !== polyfill; } }
);
return polyfill;
};
@@ -0,0 +1,21 @@
MIT License
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
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,19 @@
Copyright (C) 2014-2016 Kevin Beaty
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,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _commandRole = _interopRequireDefault(require("./abstract/commandRole"));
var _compositeRole = _interopRequireDefault(require("./abstract/compositeRole"));
var _inputRole = _interopRequireDefault(require("./abstract/inputRole"));
var _landmarkRole = _interopRequireDefault(require("./abstract/landmarkRole"));
var _rangeRole = _interopRequireDefault(require("./abstract/rangeRole"));
var _roletypeRole = _interopRequireDefault(require("./abstract/roletypeRole"));
var _sectionRole = _interopRequireDefault(require("./abstract/sectionRole"));
var _sectionheadRole = _interopRequireDefault(require("./abstract/sectionheadRole"));
var _selectRole = _interopRequireDefault(require("./abstract/selectRole"));
var _structureRole = _interopRequireDefault(require("./abstract/structureRole"));
var _widgetRole = _interopRequireDefault(require("./abstract/widgetRole"));
var _windowRole = _interopRequireDefault(require("./abstract/windowRole"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
var ariaAbstractRoles = [['command', _commandRole.default], ['composite', _compositeRole.default], ['input', _inputRole.default], ['landmark', _landmarkRole.default], ['range', _rangeRole.default], ['roletype', _roletypeRole.default], ['section', _sectionRole.default], ['sectionhead', _sectionheadRole.default], ['select', _selectRole.default], ['structure', _structureRole.default], ['widget', _widgetRole.default], ['window', _windowRole.default]];
var _default = exports.default = ariaAbstractRoles;
@@ -0,0 +1,22 @@
var createMathOperation = require('./_createMathOperation');
/**
* Subtract two numbers.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Math
* @param {number} minuend The first number in a subtraction.
* @param {number} subtrahend The second number in a subtraction.
* @returns {number} Returns the difference.
* @example
*
* _.subtract(6, 4);
* // => 2
*/
var subtract = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
}, 0);
module.exports = subtract;
@@ -0,0 +1,41 @@
import { OneBotAction } from '../../action/OneBotAction';
import { Static } from '@sinclair/typebox';
export declare const GoCQHTTPUploadGroupFilePayloadSchema: import("@sinclair/typebox").TObject<{
group_id: import("@sinclair/typebox").TString;
file: import("@sinclair/typebox").TString;
name: import("@sinclair/typebox").TString;
folder: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
folder_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
upload_file: import("@sinclair/typebox").TBoolean;
}>;
export type GoCQHTTPUploadGroupFilePayload = Static<typeof GoCQHTTPUploadGroupFilePayloadSchema>;
export declare const GoCQHTTPUploadGroupFileReturnSchema: import("@sinclair/typebox").TObject<{
file_id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
}>;
export type GoCQHTTPUploadGroupFileResponse = Static<typeof GoCQHTTPUploadGroupFileReturnSchema>;
export default class GoCQHTTPUploadGroupFile extends OneBotAction<GoCQHTTPUploadGroupFilePayload, GoCQHTTPUploadGroupFileResponse> {
actionName: "upload_group_file";
payloadSchema: import("@sinclair/typebox").TObject<{
group_id: import("@sinclair/typebox").TString;
file: import("@sinclair/typebox").TString;
name: import("@sinclair/typebox").TString;
folder: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
folder_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
upload_file: import("@sinclair/typebox").TBoolean;
}>;
returnSchema: import("@sinclair/typebox").TObject<{
file_id: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
}>;
actionSummary: string;
actionDescription: string;
actionTags: string[];
payloadExample: {
group_id: string;
file: string;
name: string;
};
returnExample: {
file_id: string;
};
_handle(payload: GoCQHTTPUploadGroupFilePayload): Promise<GoCQHTTPUploadGroupFileResponse>;
}
@@ -0,0 +1 @@
{"name":"get-proto","version":"1.0.1","requiresBuild":false,"files":{".eslintrc":{"checkedAt":1794532089359,"integrity":"sha512-BWZQrsWtO4RiVbuBrG1qRc+oDqqc24AlGCnwDkILxT+LuLm/eaPbzve/FjBoSYVfD7PGTpKKMEPX0Te0l97jVg==","mode":420,"size":104},".nycrc":{"checkedAt":1794532089360,"integrity":"sha512-2vm1RFz8Ajl/OYrfoCWPJIm3Bpnf7Gyn5bha/lZx/cq+We3uMy9xj15XeP6x4wF3jf/pO7KMHAkU9mllm605xg==","mode":420,"size":139},"LICENSE":{"checkedAt":1794532089360,"integrity":"sha512-DfNUj4ZListp/YLpckBij+vkBVWkSEFOdxu4rWG5FuaAe+QKkoSlSqzfh1kFxBi13lXazRikIibz3c4Tfs2lgA==","mode":420,"size":1071},"index.js":{"checkedAt":1794532089360,"integrity":"sha512-f4fzhziHunxgAOLyRAQQ60yLokGSLgR648+FYuwA0/LGpSodEbnqACOjLcQh8AxrItXQM4goTtiWSjn8nCYjBA==","mode":420,"size":821},"test/index.js":{"checkedAt":1794532089360,"integrity":"sha512-OfLMtlu6+RPdyMoYF/I2iQd2BF3otW/16R5JZEKUnzG+aNrSCMQhoZNxNGzORzlbTbkEGREYeiCCpV0Y6EB/nQ==","mode":420,"size":2359},"Object.getPrototypeOf.js":{"checkedAt":1794532089360,"integrity":"sha512-ruMcATO/KIuo1qYcPNwnVpnSjCcGYKPCxNnVFT/OSwu+NXzHuwJPNls6AGF/vOcoykbYlL8Gw9MQJJ5NfxqD0A==","mode":420,"size":156},"Reflect.getPrototypeOf.js":{"checkedAt":1794532089361,"integrity":"sha512-HiMfEi3Y4G8WLARtKz5Cn5JUTubRFzcXFvUUIJLgHKkqUV+uD/Yt0o+EIV4szrPLjkT3WQdPJ2RL6S1uC/lx0Q==","mode":420,"size":150},"package.json":{"checkedAt":1794532089361,"integrity":"sha512-u95BNqBSUhDrMY6GR+UxfZTnJc0K9XixzT+ql6ySA1m7pv2GPlDyUsA3vOS3Bgl0u2uQVNbv9UCU1FAomUPorQ==","mode":420,"size":2176},"tsconfig.json":{"checkedAt":1794532089361,"integrity":"sha512-7JUI6f+Uo7d5m7hRnFHTwvIq4b3fu8OVANjUmh2Vgklh8YVT+z+8++cBMFqiaB6XR0NsioNs+wCDn7qKiSAmww==","mode":420,"size":118},"CHANGELOG.md":{"checkedAt":1794532089361,"integrity":"sha512-ubFvHe7My35Kb9qTjQdjvaCLrZ0P+V1WWbo5coxIvEqnkg1q7HVTTWRjSD5C12Mk1oEwdb7pWh9PBsFMqit6sQ==","mode":420,"size":1054},"README.md":{"checkedAt":1794532089361,"integrity":"sha512-OaOze4fsmuaHiKUj0H8rqwLmchO27aBvuM8JMEVOY9RwEDkIa9fsvv3z/uDOODfU452oZ1+L6IbcvNOXeeXwMg==","mode":420,"size":1794},"index.d.ts":{"checkedAt":1794532089361,"integrity":"sha512-/93dwYgpIgd02+AXYMM4IAwfUcGdcZq4W8b+CNrxj5MX0b8FlLEt6OZ83En9ND6e+dJzBaLopVC38Y/Yhj1q3Q==","mode":420,"size":126},"Object.getPrototypeOf.d.ts":{"checkedAt":1794532089361,"integrity":"sha512-0E0VqilzUAwVgjKHsC6sH9pZXQYP56atHrR+Xm2ijbHowzHYt/Ode5U+PAdvzZYcE69D6ZRRgeILh4hNc1q7+g==","mode":420,"size":125},"Reflect.getPrototypeOf.d.ts":{"checkedAt":1794532089362,"integrity":"sha512-tBYHGFDKVz/bzVcItV652xo/8/A/e7TspfTqGqnrvOIUQHfcS+x6o3rGixvxuSEUqNYjj0+th6+AjI7zd0JC/A==","mode":420,"size":67},".github/FUNDING.yml":{"checkedAt":1794532089362,"integrity":"sha512-RKttjbMjrzrmSa4cjYdVwZZiee3Wf8rwyIhBMVFNO9oeBu2tU3rhy+IR0U2rqLQpNPdF6HjnxbBe4AyyHjQoyA==","mode":420,"size":580}}}
@@ -0,0 +1,35 @@
"use strict"
const {
definePrototypeMethodHandler,
} = require("../util/define-prototype-method-handler")
module.exports = {
meta: {
docs: {
description: "disallow the `Array.prototype.toSpliced` method.",
category: "ES2023",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-array-prototype-tospliced.html",
},
fixable: null,
messages: {
forbidden: "ES2023 '{{name}}' method is forbidden.",
},
schema: [
{
type: "object",
properties: {
aggressive: { type: "boolean" },
},
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
return definePrototypeMethodHandler(context, {
Array: ["toSpliced"],
})
},
}
@@ -0,0 +1,16 @@
var Stream = require('stream');
if (process.env.READABLE_STREAM === 'disable' && Stream) {
module.exports = Stream.Readable;
Object.assign(module.exports, Stream);
module.exports.Stream = Stream;
} else {
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = Stream || exports;
exports.Readable = exports;
exports.Writable = require('./lib/_stream_writable.js');
exports.Duplex = require('./lib/_stream_duplex.js');
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('./lib/_stream_passthrough.js');
exports.finished = require('./lib/internal/streams/end-of-stream.js');
exports.pipeline = require('./lib/internal/streams/pipeline.js');
}
@@ -0,0 +1,185 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {FocusableElement} from './dom';
import {
FocusEvent,
MouseEvent,
KeyboardEvent as ReactKeyboardEvent,
SyntheticEvent
} from 'react';
// Event bubbling can be problematic in real-world applications, so the default for React Spectrum components
// is not to propagate. This can be overridden by calling continuePropagation() on the event.
export type BaseEvent<T extends SyntheticEvent> = T & {
/**
* Use continuePropagation.
* @deprecated */
stopPropagation(): void,
continuePropagation(): void
}
export type KeyboardEvent = BaseEvent<ReactKeyboardEvent<any>>;
export type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';
export interface PressEvent {
/** The type of press event being fired. */
type: 'pressstart' | 'pressend' | 'pressup' | 'press',
/** The pointer type that triggered the press event. */
pointerType: PointerType,
/** The target element of the press event. */
target: Element,
/** Whether the shift keyboard modifier was held during the press event. */
shiftKey: boolean,
/** Whether the ctrl keyboard modifier was held during the press event. */
ctrlKey: boolean,
/** Whether the meta keyboard modifier was held during the press event. */
metaKey: boolean,
/** Whether the alt keyboard modifier was held during the press event. */
altKey: boolean,
/** X position relative to the target. */
x: number,
/** Y position relative to the target. */
y: number,
/**
* By default, press events stop propagation to parent elements.
* In cases where a handler decides not to handle a specific event,
* it can call `continuePropagation()` to allow a parent to handle it.
*/
continuePropagation(): void
}
export interface LongPressEvent extends Omit<PressEvent, 'type' | 'continuePropagation'> {
/** The type of long press event being fired. */
type: 'longpressstart' | 'longpressend' | 'longpress'
}
export interface HoverEvent {
/** The type of hover event being fired. */
type: 'hoverstart' | 'hoverend',
/** The pointer type that triggered the hover event. */
pointerType: 'mouse' | 'pen',
/** The target element of the hover event. */
target: HTMLElement
}
export interface KeyboardEvents {
/** Handler that is called when a key is pressed. */
onKeyDown?: (e: KeyboardEvent) => void,
/** Handler that is called when a key is released. */
onKeyUp?: (e: KeyboardEvent) => void
}
export interface FocusEvents<Target = Element> {
/** Handler that is called when the element receives focus. */
onFocus?: (e: FocusEvent<Target>) => void,
/** Handler that is called when the element loses focus. */
onBlur?: (e: FocusEvent<Target>) => void,
/** Handler that is called when the element's focus status changes. */
onFocusChange?: (isFocused: boolean) => void
}
export interface HoverEvents {
/** Handler that is called when a hover interaction starts. */
onHoverStart?: (e: HoverEvent) => void,
/** Handler that is called when a hover interaction ends. */
onHoverEnd?: (e: HoverEvent) => void,
/** Handler that is called when the hover state changes. */
onHoverChange?: (isHovering: boolean) => void
}
export interface PressEvents {
/** Handler that is called when the press is released over the target. */
onPress?: (e: PressEvent) => void,
/** Handler that is called when a press interaction starts. */
onPressStart?: (e: PressEvent) => void,
/**
* Handler that is called when a press interaction ends, either
* over the target or when the pointer leaves the target.
*/
onPressEnd?: (e: PressEvent) => void,
/** Handler that is called when the press state changes. */
onPressChange?: (isPressed: boolean) => void,
/**
* Handler that is called when a press is released over the target, regardless of
* whether it started on the target or not.
*/
onPressUp?: (e: PressEvent) => void,
/**
* **Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress`
* provided for compatibility with other libraries. `onPress` provides
* additional event details for non-mouse interactions.
*/
onClick?: (e: MouseEvent<FocusableElement>) => void
}
export interface FocusableProps<Target = Element> extends FocusEvents<Target>, KeyboardEvents {
/** Whether the element should receive focus on render. */
autoFocus?: boolean
}
interface BaseMoveEvent {
/** The pointer type that triggered the move event. */
pointerType: PointerType,
/** Whether the shift keyboard modifier was held during the move event. */
shiftKey: boolean,
/** Whether the ctrl keyboard modifier was held during the move event. */
ctrlKey: boolean,
/** Whether the meta keyboard modifier was held during the move event. */
metaKey: boolean,
/** Whether the alt keyboard modifier was held during the move event. */
altKey: boolean
}
export interface MoveStartEvent extends BaseMoveEvent {
/** The type of move event being fired. */
type: 'movestart'
}
export interface MoveMoveEvent extends BaseMoveEvent {
/** The type of move event being fired. */
type: 'move',
/** The amount moved in the X direction since the last event. */
deltaX: number,
/** The amount moved in the Y direction since the last event. */
deltaY: number
}
export interface MoveEndEvent extends BaseMoveEvent {
/** The type of move event being fired. */
type: 'moveend'
}
export type MoveEvent = MoveStartEvent | MoveMoveEvent | MoveEndEvent;
export interface MoveEvents {
/** Handler that is called when a move interaction starts. */
onMoveStart?: (e: MoveStartEvent) => void,
/** Handler that is called when the element is moved. */
onMove?: (e: MoveMoveEvent) => void,
/** Handler that is called when a move interaction ends. */
onMoveEnd?: (e: MoveEndEvent) => void
}
export interface ScrollEvent {
/** The amount moved in the X direction since the last event. */
deltaX: number,
/** The amount moved in the Y direction since the last event. */
deltaY: number
}
export interface ScrollEvents {
/** Handler that is called when the scroll wheel moves. */
onScroll?: (e: ScrollEvent) => void
}
@@ -0,0 +1,73 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const scope_manager_1 = require("@typescript-eslint/scope-manager");
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
function hasAssignmentBeforeNode(variable, node) {
return (variable.references.some(ref => ref.isWrite() && ref.identifier.range[1] < node.range[1]) ||
variable.defs.some(def => isDefinitionWithAssignment(def) && def.node.range[1] < node.range[1]));
}
function isDefinitionWithAssignment(definition) {
if (definition.type !== scope_manager_1.DefinitionType.Variable) {
return false;
}
const variableDeclarator = definition.node;
return variableDeclarator.definite || variableDeclarator.init != null;
}
exports.default = (0, util_1.createRule)({
name: 'no-non-null-asserted-nullish-coalescing',
meta: {
type: 'problem',
docs: {
description: 'Disallow non-null assertions in the left operand of a nullish coalescing operator',
recommended: 'strict',
},
hasSuggestions: true,
messages: {
noNonNullAssertedNullishCoalescing: 'The nullish coalescing operator is designed to handle undefined and null - using a non-null assertion is not needed.',
suggestRemovingNonNull: 'Remove the non-null assertion.',
},
schema: [],
},
defaultOptions: [],
create(context) {
return {
'LogicalExpression[operator = "??"] > TSNonNullExpression.left'(node) {
if (node.expression.type === utils_1.TSESTree.AST_NODE_TYPES.Identifier) {
const scope = context.sourceCode.getScope(node);
const identifier = node.expression;
const variable = utils_1.ASTUtils.findVariable(scope, identifier.name);
if (variable && !hasAssignmentBeforeNode(variable, node)) {
return;
}
}
context.report({
node,
messageId: 'noNonNullAssertedNullishCoalescing',
/*
Use a suggestion instead of a fixer, because this can break type checks.
The resulting type of the nullish coalesce is only influenced by the right operand if the left operand can be `null` or `undefined`.
After removing the non-null assertion the type of the left operand might contain `null` or `undefined` and then the type of the right operand
might change the resulting type of the nullish coalesce.
See the following example:
function test(x?: string): string {
const bar = x! ?? false; // type analysis reports `bar` has type `string`
// x ?? false; // type analysis reports `bar` has type `string | false`
return bar;
}
*/
suggest: [
{
messageId: 'suggestRemovingNonNull',
fix(fixer) {
const exclamationMark = (0, util_1.nullThrows)(context.sourceCode.getLastToken(node, utils_1.ASTUtils.isNonNullAssertionPunctuator), util_1.NullThrowsReasons.MissingToken('!', 'Non-null Assertion'));
return fixer.remove(exclamationMark);
},
},
],
});
},
};
},
});
@@ -0,0 +1,8 @@
import type { TSESTree } from '@typescript-eslint/types';
import { DefinitionBase } from './DefinitionBase';
import { DefinitionType } from './DefinitionType';
export declare class TSEnumMemberDefinition extends DefinitionBase<DefinitionType.TSEnumMember, TSESTree.TSEnumMember, null, TSESTree.Identifier | TSESTree.StringLiteral> {
readonly isTypeDefinition = true;
readonly isVariableDefinition = true;
constructor(name: TSESTree.Identifier | TSESTree.StringLiteral, node: TSEnumMemberDefinition['node']);
}
@@ -0,0 +1,43 @@
import { OneBotAction } from '../../action/OneBotAction';
import { Static } from '@sinclair/typebox';
declare const PayloadSchema: import("@sinclair/typebox").TObject<{
group_id: import("@sinclair/typebox").TString;
}>;
type PayloadType = Static<typeof PayloadSchema>;
declare const ReturnSchema: import("@sinclair/typebox").TObject<{
group_all_shut: import("@sinclair/typebox").TNumber;
group_remark: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
member_count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
max_member_count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
}>;
type ReturnType = Static<typeof ReturnSchema>;
declare class GetGroupInfo extends OneBotAction<PayloadType, ReturnType> {
actionName: "get_group_info";
payloadSchema: import("@sinclair/typebox").TObject<{
group_id: import("@sinclair/typebox").TString;
}>;
returnSchema: import("@sinclair/typebox").TObject<{
group_all_shut: import("@sinclair/typebox").TNumber;
group_remark: import("@sinclair/typebox").TString;
group_id: import("@sinclair/typebox").TNumber;
group_name: import("@sinclair/typebox").TString;
member_count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
max_member_count: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
}>;
actionSummary: string;
actionDescription: string;
actionTags: string[];
payloadExample: {
group_id: string;
};
returnExample: {
group_id: number;
group_name: string;
member_count: number;
max_member_count: number;
};
_handle(payload: PayloadType): Promise<import("index").OB11Group>;
}
export default GetGroupInfo;
@@ -0,0 +1,954 @@
## 8.15.0 (2025-06-08)
### New features
Support `using` and `await using` syntax.
The `AnyNode` type is now defined in such a way that plugins can extend it.
### Bug fixes
Fix an issue where the `bigint` property of literal nodes for non-decimal bigints had the wrong format.
The `acorn` CLI tool no longer crashes when emitting a tree that contains a bigint.
## 8.14.1 (2025-03-05)
### Bug fixes
Fix an issue where `await` expressions in class field initializers were inappropriately allowed.
Properly allow await inside an async arrow function inside a class field initializer.
Mention the source file name in syntax error messages when given.
Properly add an empty `attributes` property to every form of `ExportNamedDeclaration`.
## 8.14.0 (2024-10-27)
### New features
Support ES2025 import attributes.
Support ES2025 RegExp modifiers.
### Bug fixes
Support some missing Unicode properties.
## 8.13.0 (2024-10-16)
### New features
Upgrade to Unicode 16.0.
## 8.12.1 (2024-07-03)
### Bug fixes
Fix a regression that caused Acorn to no longer run on Node versions <8.10.
## 8.12.0 (2024-06-14)
### New features
Support ES2025 duplicate capture group names in regular expressions.
### Bug fixes
Include `VariableDeclarator` in the `AnyNode` type so that walker objects can refer to it without getting a type error.
Properly raise a parse error for invalid `for`/`of` statements using `async` as binding name.
Properly recognize \"use strict\" when preceded by a string with an escaped newline.
Mark the `Parser` constructor as protected, not private, so plugins can extend it without type errors.
Fix a bug where some invalid `delete` expressions were let through when the operand was parenthesized and `preserveParens` was enabled.
Properly normalize line endings in raw strings of invalid template tokens.
Properly track line numbers for escaped newlines in strings.
Fix a bug that broke line number accounting after a template literal with invalid escape sequences.
## 8.11.3 (2023-12-29)
### Bug fixes
Add `Function` and `Class` to the `AggregateType` type, so that they can be used in walkers without raising a type error.
Make sure `onToken` get an `import` keyword token when parsing `import.meta`.
Fix a bug where `.loc.start` could be undefined for `new.target` `meta` nodes.
## 8.11.2 (2023-10-27)
### Bug fixes
Fix a bug that caused regular expressions after colon tokens to not be properly tokenized in some circumstances.
## 8.11.1 (2023-10-26)
### Bug fixes
Fix a regression where `onToken` would receive 'name' tokens for 'new' keyword tokens.
## 8.11.0 (2023-10-26)
### Bug fixes
Fix an issue where tokenizing (without parsing) an object literal with a property named `class` or `function` could, in some circumstance, put the tokenizer into an invalid state.
Fix an issue where a slash after a call to a propery named the same as some keywords would be tokenized as a regular expression.
### New features
Upgrade to Unicode 15.1.
Use a set of new, much more precise, TypeScript types.
## 8.10.0 (2023-07-05)
### New features
Add a `checkPrivateFields` option that disables strict checking of private property use.
## 8.9.0 (2023-06-16)
### Bug fixes
Forbid dynamic import after `new`, even when part of a member expression.
### New features
Add Unicode properties for ES2023.
Add support for the `v` flag to regular expressions.
## 8.8.2 (2023-01-23)
### Bug fixes
Fix a bug that caused `allowHashBang` to be set to false when not provided, even with `ecmaVersion >= 14`.
Fix an exception when passing no option object to `parse` or `new Parser`.
Fix incorrect parse error on `if (0) let\n[astral identifier char]`.
## 8.8.1 (2022-10-24)
### Bug fixes
Make type for `Comment` compatible with estree types.
## 8.8.0 (2022-07-21)
### Bug fixes
Allow parentheses around spread args in destructuring object assignment.
Fix an issue where the tree contained `directive` properties in when parsing with a language version that doesn't support them.
### New features
Support hashbang comments by default in ECMAScript 2023 and later.
## 8.7.1 (2021-04-26)
### Bug fixes
Stop handling `"use strict"` directives in ECMAScript versions before 5.
Fix an issue where duplicate quoted export names in `export *` syntax were incorrectly checked.
Add missing type for `tokTypes`.
## 8.7.0 (2021-12-27)
### New features
Support quoted export names.
Upgrade to Unicode 14.
Add support for Unicode 13 properties in regular expressions.
### Bug fixes
Use a loop to find line breaks, because the existing regexp search would overrun the end of the searched range and waste a lot of time in minified code.
## 8.6.0 (2021-11-18)
### Bug fixes
Fix a bug where an object literal with multiple `__proto__` properties would incorrectly be accepted if a later property value held an assigment.
### New features
Support class private fields with the `in` operator.
## 8.5.0 (2021-09-06)
### Bug fixes
Improve context-dependent tokenization in a number of corner cases.
Fix location tracking after a 0x2028 or 0x2029 character in a string literal (which before did not increase the line number).
Fix an issue where arrow function bodies in for loop context would inappropriately consume `in` operators.
Fix wrong end locations stored on SequenceExpression nodes.
Implement restriction that `for`/`of` loop LHS can't start with `let`.
### New features
Add support for ES2022 class static blocks.
Allow multiple input files to be passed to the CLI tool.
## 8.4.1 (2021-06-24)
### Bug fixes
Fix a bug where `allowAwaitOutsideFunction` would allow `await` in class field initializers, and setting `ecmaVersion` to 13 or higher would allow top-level await in non-module sources.
## 8.4.0 (2021-06-11)
### New features
A new option, `allowSuperOutsideMethod`, can be used to suppress the error when `super` is used in the wrong context.
## 8.3.0 (2021-05-31)
### New features
Default `allowAwaitOutsideFunction` to true for ECMAScript 2022 an higher.
Add support for the `d` ([indices](https://github.com/tc39/proposal-regexp-match-indices)) regexp flag.
## 8.2.4 (2021-05-04)
### Bug fixes
Fix spec conformity in corner case 'for await (async of ...)'.
## 8.2.3 (2021-05-04)
### Bug fixes
Fix an issue where the library couldn't parse 'for (async of ...)'.
Fix a bug in UTF-16 decoding that would read characters incorrectly in some circumstances.
## 8.2.2 (2021-04-29)
### Bug fixes
Fix a bug where a class field initialized to an async arrow function wouldn't allow await inside it. Same issue existed for generator arrow functions with yield.
## 8.2.1 (2021-04-24)
### Bug fixes
Fix a regression introduced in 8.2.0 where static or async class methods with keyword names fail to parse.
## 8.2.0 (2021-04-24)
### New features
Add support for ES2022 class fields and private methods.
## 8.1.1 (2021-04-12)
### Various
Stop shipping source maps in the NPM package.
## 8.1.0 (2021-03-09)
### Bug fixes
Fix a spurious error in nested destructuring arrays.
### New features
Expose `allowAwaitOutsideFunction` in CLI interface.
Make `allowImportExportAnywhere` also apply to `import.meta`.
## 8.0.5 (2021-01-25)
### Bug fixes
Adjust package.json to work with Node 12.16.0 and 13.0-13.6.
## 8.0.4 (2020-10-05)
### Bug fixes
Make `await x ** y` an error, following the spec.
Fix potentially exponential regular expression.
## 8.0.3 (2020-10-02)
### Bug fixes
Fix a wasteful loop during `Parser` creation when setting `ecmaVersion` to `"latest"`.
## 8.0.2 (2020-09-30)
### Bug fixes
Make the TypeScript types reflect the current allowed values for `ecmaVersion`.
Fix another regexp/division tokenizer issue.
## 8.0.1 (2020-08-12)
### Bug fixes
Provide the correct value in the `version` export.
## 8.0.0 (2020-08-12)
### Bug fixes
Disallow expressions like `(a = b) = c`.
Make non-octal escape sequences a syntax error in strict mode.
### New features
The package can now be loaded directly as an ECMAScript module in node 13+.
Update to the set of Unicode properties from ES2021.
### Breaking changes
The `ecmaVersion` option is now required. For the moment, omitting it will still work with a warning, but that will change in a future release.
Some changes to method signatures that may be used by plugins.
## 7.4.0 (2020-08-03)
### New features
Add support for logical assignment operators.
Add support for numeric separators.
## 7.3.1 (2020-06-11)
### Bug fixes
Make the string in the `version` export match the actual library version.
## 7.3.0 (2020-06-11)
### Bug fixes
Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
### New features
Add support for optional chaining (`?.`).
## 7.2.0 (2020-05-09)
### Bug fixes
Fix precedence issue in parsing of async arrow functions.
### New features
Add support for nullish coalescing.
Add support for `import.meta`.
Support `export * as ...` syntax.
Upgrade to Unicode 13.
## 6.4.1 (2020-03-09)
### Bug fixes
More carefully check for valid UTF16 surrogate pairs in regexp validator.
## 7.1.1 (2020-03-01)
### Bug fixes
Treat `\8` and `\9` as invalid escapes in template strings.
Allow unicode escapes in property names that are keywords.
Don't error on an exponential operator expression as argument to `await`.
More carefully check for valid UTF16 surrogate pairs in regexp validator.
## 7.1.0 (2019-09-24)
### Bug fixes
Disallow trailing object literal commas when ecmaVersion is less than 5.
### New features
Add a static `acorn` property to the `Parser` class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
## 7.0.0 (2019-08-13)
### Breaking changes
Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
Makes 10 (ES2019) the default value for the `ecmaVersion` option.
## 6.3.0 (2019-08-12)
### New features
`sourceType: "module"` can now be used even when `ecmaVersion` is less than 6, to parse module-style code that otherwise conforms to an older standard.
## 6.2.1 (2019-07-21)
### Bug fixes
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances.
## 6.2.0 (2019-07-04)
### Bug fixes
Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
Disallow binding `let` in patterns.
### New features
Support bigint syntax with `ecmaVersion` >= 11.
Support dynamic `import` syntax with `ecmaVersion` >= 11.
Upgrade to Unicode version 12.
## 6.1.1 (2019-02-27)
### Bug fixes
Fix bug that caused parsing default exports of with names to fail.
## 6.1.0 (2019-02-08)
### Bug fixes
Fix scope checking when redefining a `var` as a lexical binding.
### New features
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
## 6.0.7 (2019-02-04)
### Bug fixes
Check that exported bindings are defined.
Don't treat `\u180e` as a whitespace character.
Check for duplicate parameter names in methods.
Don't allow shorthand properties when they are generators or async methods.
Forbid binding `await` in async arrow function's parameter list.
## 6.0.6 (2019-01-30)
### Bug fixes
The content of class declarations and expressions is now always parsed in strict mode.
Don't allow `let` or `const` to bind the variable name `let`.
Treat class declarations as lexical.
Don't allow a generator function declaration as the sole body of an `if` or `else`.
Ignore `"use strict"` when after an empty statement.
Allow string line continuations with special line terminator characters.
Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
Fix bug with parsing `yield` in a `for` loop initializer.
Implement special cases around scope checking for functions.
## 6.0.5 (2019-01-02)
### Bug fixes
Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
Don't treat `let` as a keyword when the next token is `{` on the next line.
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
## 6.0.4 (2018-11-05)
### Bug fixes
Further improvements to tokenizing regular expressions in corner cases.
## 6.0.3 (2018-11-04)
### Bug fixes
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
Remove stray symlink in the package tarball.
## 6.0.2 (2018-09-26)
### Bug fixes
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
## 6.0.1 (2018-09-14)
### Bug fixes
Fix wrong value in `version` export.
## 6.0.0 (2018-09-14)
### Bug fixes
Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
Forbid `new.target` in top-level arrow functions.
Fix issue with parsing a regexp after `yield` in some contexts.
### New features
The package now comes with TypeScript definitions.
### Breaking changes
The default value of the `ecmaVersion` option is now 9 (2018).
Plugins work differently, and will have to be rewritten to work with this version.
The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`).
## 5.7.3 (2018-09-10)
### Bug fixes
Fix failure to tokenize regexps after expressions like `x.of`.
Better error message for unterminated template literals.
## 5.7.2 (2018-08-24)
### Bug fixes
Properly handle `allowAwaitOutsideFunction` in for statements.
Treat function declarations at the top level of modules like let bindings.
Don't allow async function declarations as the only statement under a label.
## 5.7.0 (2018-06-15)
### New features
Upgraded to Unicode 11.
## 5.6.0 (2018-05-31)
### New features
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
Allow binding-less catch statements when ECMAVersion >= 10.
Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
## 5.5.3 (2018-03-08)
### Bug fixes
A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
## 5.5.2 (2018-03-08)
### Bug fixes
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
## 5.5.1 (2018-03-06)
### Bug fixes
Fix misleading error message for octal escapes in template strings.
## 5.5.0 (2018-02-27)
### New features
The identifier character categorization is now based on Unicode version 10.
Acorn will now validate the content of regular expressions, including new ES9 features.
## 5.4.0 (2018-02-01)
### Bug fixes
Disallow duplicate or escaped flags on regular expressions.
Disallow octal escapes in strings in strict mode.
### New features
Add support for async iteration.
Add support for object spread and rest.
## 5.3.0 (2017-12-28)
### Bug fixes
Fix parsing of floating point literals with leading zeroes in loose mode.
Allow duplicate property names in object patterns.
Don't allow static class methods named `prototype`.
Disallow async functions directly under `if` or `else`.
Parse right-hand-side of `for`/`of` as an assignment expression.
Stricter parsing of `for`/`in`.
Don't allow unicode escapes in contextual keywords.
### New features
Parsing class members was factored into smaller methods to allow plugins to hook into it.
## 5.2.1 (2017-10-30)
### Bug fixes
Fix a token context corruption bug.
## 5.2.0 (2017-10-30)
### Bug fixes
Fix token context tracking for `class` and `function` in property-name position.
Make sure `%*` isn't parsed as a valid operator.
Allow shorthand properties `get` and `set` to be followed by default values.
Disallow `super` when not in callee or object position.
### New features
Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
## 5.1.2 (2017-09-04)
### Bug fixes
Disable parsing of legacy HTML-style comments in modules.
Fix parsing of async methods whose names are keywords.
## 5.1.1 (2017-07-06)
### Bug fixes
Fix problem with disambiguating regexp and division after a class.
## 5.1.0 (2017-07-05)
### Bug fixes
Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
Parse zero-prefixed numbers with non-octal digits as decimal.
Allow object/array patterns in rest parameters.
Don't error when `yield` is used as a property name.
Allow `async` as a shorthand object property.
### New features
Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
## 5.0.3 (2017-04-01)
### Bug fixes
Fix spurious duplicate variable definition errors for named functions.
## 5.0.2 (2017-03-30)
### Bug fixes
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
## 5.0.0 (2017-03-28)
### Bug fixes
Raise an error for duplicated lexical bindings.
Fix spurious error when an assignement expression occurred after a spread expression.
Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
Allow labels in front or `var` declarations, even in strict mode.
### Breaking changes
Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`.
## 4.0.11 (2017-02-07)
### Bug fixes
Allow all forms of member expressions to be parenthesized as lvalue.
## 4.0.10 (2017-02-07)
### Bug fixes
Don't expect semicolons after default-exported functions or classes, even when they are expressions.
Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode.
## 4.0.9 (2017-02-06)
### Bug fixes
Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again.
## 4.0.8 (2017-02-03)
### Bug fixes
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
## 4.0.7 (2017-02-02)
### Bug fixes
Accept invalidly rejected code like `(x).y = 2` again.
Don't raise an error when a function _inside_ strict code has a non-simple parameter list.
## 4.0.6 (2017-02-02)
### Bug fixes
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
## 4.0.5 (2017-02-02)
### Bug fixes
Disallow parenthesized pattern expressions.
Allow keywords as export names.
Don't allow the `async` keyword to be parenthesized.
Properly raise an error when a keyword contains a character escape.
Allow `"use strict"` to appear after other string literal expressions.
Disallow labeled declarations.
## 4.0.4 (2016-12-19)
### Bug fixes
Fix crash when `export` was followed by a keyword that can't be
exported.
## 4.0.3 (2016-08-16)
### Bug fixes
Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode.
Properly parse properties named `async` in ES2017 mode.
Fix bug where reserved words were broken in ES2017 mode.
## 4.0.2 (2016-08-11)
### Bug fixes
Don't ignore period or 'e' characters after octal numbers.
Fix broken parsing for call expressions in default parameter values of arrow functions.
## 4.0.1 (2016-08-08)
### Bug fixes
Fix false positives in duplicated export name errors.
## 4.0.0 (2016-08-07)
### Breaking changes
The default `ecmaVersion` option value is now 7.
A number of internal method signatures changed, so plugins might need to be updated.
### Bug fixes
The parser now raises errors on duplicated export names.
`arguments` and `eval` can now be used in shorthand properties.
Duplicate parameter names in non-simple argument lists now always produce an error.
### New features
The `ecmaVersion` option now also accepts year-style version numbers
(2015, etc).
Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
Support for trailing commas in call expressions when `ecmaVersion` is >= 8.
## 3.3.0 (2016-07-25)
### Bug fixes
Fix bug in tokenizing of regexp operator after a function declaration.
Fix parser crash when parsing an array pattern with a hole.
### New features
Implement check against complex argument lists in functions that enable strict mode in ES7.
## 3.2.0 (2016-06-07)
### Bug fixes
Improve handling of lack of unicode regexp support in host
environment.
Properly reject shorthand properties whose name is a keyword.
### New features
Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object.
## 3.1.0 (2016-04-18)
### Bug fixes
Properly tokenize the division operator directly after a function expression.
Allow trailing comma in destructuring arrays.
## 3.0.4 (2016-02-25)
### Fixes
Allow update expressions as left-hand-side of the ES7 exponential operator.
## 3.0.2 (2016-02-10)
### Fixes
Fix bug that accidentally made `undefined` a reserved word when parsing ES7.
## 3.0.0 (2016-02-10)
### Breaking changes
The default value of the `ecmaVersion` option is now 6 (used to be 5).
Support for comprehension syntax (which was dropped from the draft spec) has been removed.
### Fixes
`let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
A parenthesized class or function expression after `export default` is now parsed correctly.
### New features
When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`).
The identifier character ranges are now based on Unicode 8.0.0.
Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled.
## 2.7.0 (2016-01-04)
### Fixes
Stop allowing rest parameters in setters.
Disallow `y` rexexp flag in ES5.
Disallow `\00` and `\000` escapes in strict mode.
Raise an error when an import name is a reserved word.
## 2.6.2 (2015-11-10)
### Fixes
Don't crash when no options object is passed.
## 2.6.0 (2015-11-09)
### Fixes
Add `await` as a reserved word in module sources.
Disallow `yield` in a parameter default value for a generator.
Forbid using a comma after a rest pattern in an array destructuring.
### New features
Support parsing stdin in command-line tool.
## 2.5.0 (2015-10-27)
### Fixes
Fix tokenizer support in the command-line tool.
Stop allowing `new.target` outside of functions.
Remove legacy `guard` and `guardedHandler` properties from try nodes.
Stop allowing multiple `__proto__` properties on an object literal in strict mode.
Don't allow rest parameters to be non-identifier patterns.
Check for duplicate paramter names in arrow functions.
@@ -0,0 +1,10 @@
{
"extends": "@ljharb/tsconfig",
"compilerOptions": {
"target": "ESNext",
"lib": ["es2024"],
},
"exclude": [
"coverage",
],
}
@@ -0,0 +1,149 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports._getTypeAnnotation = _getTypeAnnotation;
exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches;
exports.couldBeBaseType = couldBeBaseType;
exports.getTypeAnnotation = getTypeAnnotation;
exports.isBaseType = isBaseType;
exports.isGenericType = isGenericType;
var inferers = require("./inferers.js");
var _t = require("@babel/types");
const {
anyTypeAnnotation,
isAnyTypeAnnotation,
isArrayTypeAnnotation,
isBooleanTypeAnnotation,
isEmptyTypeAnnotation,
isFlowBaseAnnotation,
isGenericTypeAnnotation,
isIdentifier,
isMixedTypeAnnotation,
isNumberTypeAnnotation,
isStringTypeAnnotation,
isTSArrayType,
isTSTypeAnnotation,
isTSTypeReference,
isTupleTypeAnnotation,
isTypeAnnotation,
isUnionTypeAnnotation,
isVoidTypeAnnotation,
stringTypeAnnotation,
voidTypeAnnotation
} = _t;
function getTypeAnnotation() {
let type = this.getData("typeAnnotation");
if (type != null) {
return type;
}
type = _getTypeAnnotation.call(this) || anyTypeAnnotation();
if (isTypeAnnotation(type) || isTSTypeAnnotation(type)) {
type = type.typeAnnotation;
}
this.setData("typeAnnotation", type);
return type;
}
const typeAnnotationInferringNodes = new WeakSet();
function _getTypeAnnotation() {
const node = this.node;
if (!node) {
if (this.key === "init" && this.parentPath.isVariableDeclarator()) {
const declar = this.parentPath.parentPath;
const declarParent = declar.parentPath;
if (declar.key === "left" && declarParent.isForInStatement()) {
return stringTypeAnnotation();
}
if (declar.key === "left" && declarParent.isForOfStatement()) {
return anyTypeAnnotation();
}
return voidTypeAnnotation();
} else {
return;
}
}
if (node.typeAnnotation) {
return node.typeAnnotation;
}
if (typeAnnotationInferringNodes.has(node)) {
return;
}
typeAnnotationInferringNodes.add(node);
try {
var _inferer;
let inferer = inferers[node.type];
if (inferer) {
return inferer.call(this, node);
}
inferer = inferers[this.parentPath.type];
if ((_inferer = inferer) != null && _inferer.validParent) {
return this.parentPath.getTypeAnnotation();
}
} finally {
typeAnnotationInferringNodes.delete(node);
}
}
function isBaseType(baseName, soft) {
return _isBaseType(baseName, this.getTypeAnnotation(), soft);
}
function _isBaseType(baseName, type, soft) {
if (baseName === "string") {
return isStringTypeAnnotation(type);
} else if (baseName === "number") {
return isNumberTypeAnnotation(type);
} else if (baseName === "boolean") {
return isBooleanTypeAnnotation(type);
} else if (baseName === "any") {
return isAnyTypeAnnotation(type);
} else if (baseName === "mixed") {
return isMixedTypeAnnotation(type);
} else if (baseName === "empty") {
return isEmptyTypeAnnotation(type);
} else if (baseName === "void") {
return isVoidTypeAnnotation(type);
} else {
if (soft) {
return false;
} else {
throw new Error(`Unknown base type ${baseName}`);
}
}
}
function couldBeBaseType(name) {
const type = this.getTypeAnnotation();
if (isAnyTypeAnnotation(type)) return true;
if (isUnionTypeAnnotation(type)) {
for (const type2 of type.types) {
if (isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
return true;
}
}
return false;
} else {
return _isBaseType(name, type, true);
}
}
function baseTypeStrictlyMatches(rightArg) {
const left = this.getTypeAnnotation();
const right = rightArg.getTypeAnnotation();
if (!isAnyTypeAnnotation(left) && isFlowBaseAnnotation(left)) {
return right.type === left.type;
}
return false;
}
function isGenericType(genericName) {
const type = this.getTypeAnnotation();
if (genericName === "Array") {
if (isTSArrayType(type) || isArrayTypeAnnotation(type) || isTupleTypeAnnotation(type)) {
return true;
}
}
return isGenericTypeAnnotation(type) && isIdentifier(type.id, {
name: genericName
}) || isTSTypeReference(type) && isIdentifier(type.typeName, {
name: genericName
});
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
export declare function flatten<T>(items: T[][]): T[];
export declare function splitWhen<T>(items: T[], predicate: (item: T) => boolean): T[][];
@@ -0,0 +1,936 @@
export default `flf2a$ 9 8 14 -1 16
Gothic.flf - Taken from a banner program called "gothic" by Howard Chu
Figletization suggested bu Bob Bright (bright@cc.umanitoba.ca)
Figletized by Wendell Hicken 11/19/93 (whicken@parasoft.com)
Version 1.1 - updated on 11/23/93
Version 1.11 - updated on 11/28/93 by Brian Tao (taob@io.org)
- adjusted baseline and fixed some spacing problems
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be \`a', for now
$ - the "hardblank" -- prints as a blank, but can't be smushed
9 - height of a character
8 - height of a character, not including descenders
14 - max line length (excluding comment lines) + a fudge factor
-1 - default smushmode for this font (like "-m 15" on command line)
16 - number of comment lines
@
@
@
@
@
@
@
@
@@
@
/\\ @
\\/ @
}{ @
\\/ @
@
<> @
@
@@
<> <> @
) ) @
@
@
@
@
@
@
@@
<> <> @
}{ }{ @
<>++=++<> @
}{ }{ @
<>++=++<> @
}{ }{ @
<> <> @
@
@@
_++_, @
|||| @
||--. @
~|||| @
|||| @
,-__- @
|| @
@
@@
@
, @
<> / @
/ @
/ @
/ @
/ <> @
\` @
@@
@
/\\ @
\\/ @
/\\ , @
/'\\\\, @
| \\\\ @
\\\\-/\\ @
@
@@
<>@
)@
@
@
@
@
@
@
@@
/ @
// @
|| @
|| @
|| @
\\\\ @
\\ @
@
@@
\\ @
\\\\ @
|| @
|| @
|| @
// @
/ @
@
@@
@
<> <> @
\\ / @
<>-*-<> @
/ \\ @
<> <> @
@
@
@@
@
@
<> @
}{ @
<>--<> @
}{ @
<> @
@
@@
@
@
@
@
@
@
<> @
) @
@@
@
@
@
@
<>-<> @
@
@
@
@@
@
@
@
@
@
@
<> @
@
@@
@
/ @
/ @
// @
/ @
// @
/ @
/ @
@@
@
/\\\\ @
|| || @
|| || @
|| || @
|| || @
\\\\/ @
@
@@
@
/| @
/|| @
|| @
|| @
|| @
,/-' @
@
@@
@
/\\ @
( ) @
// @
// @
/( @
{___ @
@
@@
____ @
\` // @
// @
\\\\ @
)) @
// @
/' @
@
@@
, @
/| @
/ | @
__|_ @
---- @
| @
,_, @
@
@@
____ @
|| \` @
||_ @
|/ \\ @
)) @
// @
/' @
@
@@
@
,/ @
// @
((_- @
|| )) @
(( || @
\\// @
@
@@
____ @
\` || @
/, @
// @
(( @
|| @
|' @
@
@@
@
/\\\\ @
|| || @
\\ / @
/\\\\ @
// \\\\ @
|| || @
\\\\/ @
@@
@
/\\\\ @
|| || @
|| || @
\\/|| @
|| @
\\_/ @
@
@@
@
@
@
<> @
@
@
<> @
@
@@
@
@
@
<> @
@
@
<> @
) @
@@
@
/ @
/ @
// @
<< @
\\\\ @
\\ @
\\ @
@@
@
@
@
<>-<> @
@
<>-<> @
@
@
@@
@
\\ @
\\ @
\\\\ @
>> @
// @
/ @
/ @
@@
-_ @
/ \\\\ @
\` || @
|, @
(( @
@
<> @
@
@@
@
/\\\\ @
|| || @
||/|| @
||\\| @
|| @
\\\\_, @
@
@@
___ @
- -_, @
( ~/|| @
( / || @
\\/==|| @
/_ _|| @
( - \\\\, @
@
@@
@
_-_ _,, @
-/ ) @
~||_< @
|| \\\\ @
,/--|| @
_--_-' @
( @
@@
@
,- _~. @
(' /| @
(( || @
(( || @
( / | @
-____- @
@
@@
@
-_____ @
' | -, @
/| | |\` @
|| |==|| @
~|| | |, @
~-____, @
( @
@@
@
,- _~, @
(' /| / @
(( ||/= @
(( || @
( / | @
-____- @
@
@@
_ ,@
,- - @
_||_ @
' || @
|| @
|, @
_-/ @
@
@@
__ , @
,-| ~ @
('||/__, @
(( ||| | @
(( |||==| @
( / | , @
-____/ @
@
@@
@
_-_- @
/, @
|| __ @
~||- - @
||===|| @
( \\_, | @
\` @
@@
@
_-_, @
// @
|| @
~|| @
|| @
_-_, @
@
@@
@
_-_,, @
( // @
_|| @
_|| @
|| @
-__-, @
@
@@
@
_-_-, @
// , @
||/\\\\ @
~|| < @
||/\\\\ @
_-__,\\\\, @
@
@@
@
_-_- @
/, @
|| @
~|| @
|| @
( -__, @
@
@@
@
/\\\\,/\\\\, @
/| || || @
|| || || @
||=|= || @
~|| || || @
|, \\\\,\\\\, @
_- @
@@
__ @
/ -, @
|| ) @
~||---) @
~||---, @
~|| / @
|, / @
-_- --~ @
@@
__ @
,-||-, @
('||| ) @
(( |||--)) @
(( |||--)) @
( / | ) @
-____- @
@
@@
@
-__ /\\\\ @
|| \\\\ @
/||__|| @
\\||__|| @
|| |, @
_-||-_/ @
|| @
@@
__ @
,-||-, @
('||| ) @
(( |||--)) @
(( |||--)) @
( / | ) @
-____-\\\\ @
@
@@
@
-__ /\\ @
|| \\, @
/|| / @
\\||/- @
|| \\ @
_---_-|, @
@
@@
@
-_-/ @
(_ / @
(_ --_ @
--_ ) @
_/ )) @
(_-_- @
@
@@
___ @
- ---___- @
(' || @
(( || @
(( || @
(( // @
-____- @
@
@@
_ _ _ , @
- - / - - @
('|| || @
(( ||--|| @
(( ||--|| @
(( / || @
-___-\\\\, @
@
@@
_ @
- - _- @
)- ) @
)___) @
~)___) @
) ) @
/-_/ @
@
@@
_ @
- - /, /, @
)/ )/ ) @
)__)__) @
~)__)__) @
) ) ) @
/-_/-_/ @
@
@@
_ @
- - /\` @
\\\\ / @
\\\\/ @
==/\\== @
/ \\\\ @
\\\\/ \\\\, @
@
@@
@
-_ _ @
|,- \` @
~||__)) @
~||__)) @
|_ _, @
-' - @
( _-_ @
@@
@
_-___ @
/ @
/ @
=/= @
/ @
/-__- @
@
@@
__ @
|| @
|| @
|| @
|| @
|| @
|| @
||__ @
@@
@
\\ @
\\ @
\\\\ @
\\ @
\\\\ @
\\ @
\\ @
@@
__ @
|| @
|| @
|| @
|| @
|| @
|| @
__|| @
@@
x @
/ \\ @
/ \\ @
@
@
@
@
@
@@
@
@
@
@
@
@
@
_____ @
@@
@
<> @
( @
@
@
@
@
@
@@
@
@
_ @
< \\, @
/-|| @
(( || @
\\/\\\\ @
@
@@
@
,, @
|| @
||/|, @
|| || @
|| |' @
\\\\/ @
@
@@
@
@
@
_-_ @
|| @
|| @
\\\\,/ @
@
@@
@
|\\ @
\\\\ @
/ \\\\ @
|| || @
|| || @
\\\\/ @
@
@@
@
@
@
_-_ @
|| \\\\ @
||/ @
\\\\,/ @
@
@@
@
/\\ @
|| @
=||= @
|| @
|| @
\\\\, @
@
@@
@
@
_ @
/ \\\\ @
|| || @
|| || @
\\\\_-| @
/ \\ @
'----\`@@
@
,, @
|| @
||/\\\\ @
|| || @
|| || @
\\\\ |/ @
_/ @
@@
@
@
' @
\\\\ @
|| @
|| @
\\\\ @
@
@@
@
@
' @
\\\\ @
|| @
|| @
|| @
|; @
/ @@
@
,, @
|| @
||/\\ @
||_< @
|| | @
\\\\,\\ @
@
@@
@
,, @
|| @
|| @
|| @
|| @
\\\\ @
@
@@
@
@
@
\\\\/\\\\/\\\\ @
|| || || @
|| || || @
\\\\ \\\\ \\\\ @
@
@@
@
@
@
\\\\/\\\\ @
|| || @
|| || @
\\\\ \\\\ @
@
@@
@
@
@
/'\\\\ @
|| || @
|| || @
\\\\,/ @
@
@@
@
@
@
-_-_ @
|| \\\\ @
|| || @
||-' @
|/ @
' @@
@
@
@
/'\\\\ @
|| || @
|| || @
\\\\,|| @
|| @
'\` @@
@
@
@
,._-_ @
|| @
|| @
\\\\, @
@
@@
@
@
@
_-_, @
||_. @
~ || @
,-_- @
@
@@
@
, @
|| @
=||= @
|| @
|| @
\\\\, @
@
@@
@
@
@
\\\\ \\\\ @
|| || @
|| || @
\\\\/\\\\ @
@
@@
@
@
; @
\\\\/\\ @
|| | @
|| | @
\\\\/ @
@
@@
@
@
; @
\\\\/\\/\\ @
|| | | @
|| | | @
\\\\/\\\\/ @
@
@@
@
@
, @
\\\\ /\` @
\\\\ @
/\\\\ @
/ \\; @
@
@@
@
@
@
'\\\\/\\\\ @
|| ;' @
||/ @
|/ @
( @
-_- @@
@
@
@
/\\\\ @
/ @
/\\\\ @
|| @
/ @
(, @@
_ @
( @
) @
) @
-{ @
) @
) @
(_ @
@@
@
|| @
|| @
|| @
|| @
|| @
|| @
|| @
@@
_ @
) @
( @
( @
}- @
( @
( @
_) @
@@
_ @
/ \\_/ @
@
@
@
@
@
@
@@
___ @
- -_, @
( ~/|| @
( / || @
\\/==|| @
/_ _|| @
( - \\\\, @
@
@@
__ @
,-||-, @
('||| ) @
(( |||--)) @
(( |||--)) @
( / | ) @
-____- @
@
@@
_ _ _ , @
- - / - - @
('|| || @
(( ||--|| @
(( ||--|| @
(( / || @
-___-\\\\, @
@
@@
@
\` \` @
_ @
< \\, @
/-|| @
(( || @
\\/\\\\ @
@
@@
@
\` \` @
@
/'\\\\ @
|| || @
|| || @
\\\\,/ @
@
@@
@
\` \` @
@
\\\\ \\\\ @
|| || @
|| || @
\\\\/\\\\ @
@
@@
@
_-_ _,, @
-/ ) @
~||_< @
|| \\\\ @
,/--|| @
_--_-' @
( || @
|| @@
`
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","2":"C L M G N O P"},C:{"1":"0 1 2 3 4 5 6 7 8 9 K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"xC TC J ZB 0C 1C"},D:{"1":"0 1 2 3 4 5 6 7 8 9 K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"J ZB"},E:{"1":"ZB K D E F A B C L M G 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J 2C ZC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z NC uC JD OC","4":"F FD GD HD ID"},G:{"1":"E KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"ZC"},H:{"2":"hD"},I:{"1":"I mD nD","2":"TC J iD jD kD lD vC"},J:{"1":"D A"},K:{"1":"C H NC uC OC","4":"A B"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:1,C:"Server-sent events",D:true};
@@ -0,0 +1,25 @@
import { Properties as CSSProperties } from 'csstype';
import { Theme, DefaultTheme } from 'goober';
export = gooberGlobal;
export as namespace gooberGlobal;
declare namespace gooberGlobal {
interface CSSAttribute extends CSSProperties {
[key: string]: CSSAttribute | string | number | undefined;
}
function createGlobalStyles(
tag: CSSAttribute | TemplateStringsArray | string,
...props: Array<
| string
| number
| ((props: Theme<DefaultTheme>) => CSSAttribute | string | number | false | undefined)
>
): Function;
function glob(
tag: CSSAttribute | TemplateStringsArray | string,
...props: Array<string | number>
): void;
}
@@ -0,0 +1 @@
{"version":3,"file":"encode-html.js","sourceRoot":"","sources":["../../../src/generated/encode-html.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAM9C,SAAS,WAAW,CAChB,KAAQ;IAER,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAChD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,kBAAkB;AACL,QAAA,QAAQ,GAA+C,IAAI,GAAG,CAAwB,eAAe,CAAA,WAAW,CAAC,CAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,WAAW,CAAC,EAAC,CAAC,EAAE,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,EAAC,CAAC,EAAC,MAAM,EAAC,CAAC,EAAC,IAAI,EAAC,CAAC,EAAC,QAAQ,EAAC,CAAC,EAAC,CAAC,CAAC,EAAC,EAAC,CAAC,EAAC,UAAU,EAAC,CAAC,EAAC,IAAI,EAAC,CAAC,EAAC,OAAO,EAAC,CAAC,EAAC,CAAC,CAAC,EAAC,EAAC,CAAC,EAAC,MAAM,EAAC,CAAC,EAAC,IAAI,EAAC,CAAC,EAAC,QAAQ,EAAC,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,EAAE,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,oBAAoB,CAAC,EAAC,CAAC,CAAC,EAAC,EAAC,CAAC,EAAC,GAAG,EAAC,CAAC,EAAC,SAAS,EAAC,CAAC,EAAC,CAAC,EAAE,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,EAAE,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,YAAY,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,aAAa,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,aAAa,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,OAAO,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,QAAQ,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,CAAC,CAAC,Line truncated
@@ -0,0 +1 @@
{"version":3,"file":"buildBindingIdentifier.js","sourceRoot":"","sources":["../../../../src/binding/calculations/buildBindingIdentifier.ts"],"names":[],"mappings":";;AAOA,wDAOC;AAZD,mEAGqC;AAErC,SAAgB,sBAAsB,CACpC,OAA0C;IAE1C,OAAO;QACL,CAAC,2CAAuB,CAAC,EAAE,IAAI;QAC/B,EAAE,EAAE,OAAO,CAAC,EAAE;KACf,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
module.exports = {
"dismiss": `Revocare`
};
//# sourceMappingURL=ro-RO.main.js.map
@@ -0,0 +1 @@
{"version":3,"file":"decode-data-html.js","sourceRoot":"https://raw.githubusercontent.com/fb55/entities/61afd4701eaa736978b13c7351cd3de9a96b04bc/src/","sources":["generated/decode-data-html.ts"],"names":[],"mappings":";AAAA,8CAA8C;;AAE9C,kBAAe,IAAI,WAAW;AAC1B,kBAAkB;AAClB,268CAA268C;KACt68C,KAAK,CAAC,EAAE,CAAC;KACT,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CACnC,CAAC"}
@@ -0,0 +1,49 @@
import type * as errors from "./errors.js";
import type * as schemas from "./schemas.js";
import type { Class } from "./util.js";
type ZodTrait = {
_zod: {
def: any;
[k: string]: any;
};
};
export interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
new (def: D): T;
init(inst: T, def: D): asserts inst is T;
}
/** A special constant with type `never` */
export declare const NEVER: never;
export declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void, params?: {
Parent?: typeof Class;
}): $constructor<T, D>;
export declare const $brand: unique symbol;
export type $brand<T extends string | number | symbol = string | number | symbol> = {
[$brand]: {
[k in T]: true;
};
};
export type $ZodBranded<T extends schemas.SomeType, Brand extends string | number | symbol> = T & Record<"_zod", Record<"output", output<T> & $brand<Brand>>>;
export declare class $ZodAsyncError extends Error {
constructor();
}
export type input<T> = T extends {
_zod: {
input: any;
};
} ? Required<T["_zod"]>["input"] : unknown;
export type output<T> = T extends {
_zod: {
output: any;
};
} ? Required<T["_zod"]>["output"] : unknown;
export type { output as infer };
export interface $ZodConfig {
/** Custom error map. Overrides `config().localeError`. */
customError?: errors.$ZodErrorMap | undefined;
/** Localized error map. Lowest priority. */
localeError?: errors.$ZodErrorMap | undefined;
/** Disable JIT schema compilation. Useful in environments that disallow `eval`. */
jitless?: boolean | undefined;
}
export declare const globalConfig: $ZodConfig;
export declare function config(newConfig?: Partial<$ZodConfig>): $ZodConfig;
@@ -0,0 +1,407 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
import * as Strings from 'browser/LocalizableStrings';
import { ITerminal, IRenderDebouncer } from 'browser/Types';
import { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { ICoreBrowserService, IRenderService } from 'browser/services/Services';
import { IBuffer } from 'common/buffer/Types';
import { IInstantiationService } from 'common/services/Services';
import { addDisposableDomListener } from 'browser/Lifecycle';
const MAX_ROWS_TO_READ = 20;
const enum BoundaryPosition {
TOP,
BOTTOM
}
// Turn this on to unhide the accessibility tree and display it under
// (instead of overlapping with) the terminal.
const DEBUG = false;
export class AccessibilityManager extends Disposable {
private _debugRootContainer: HTMLElement | undefined;
private _accessibilityContainer: HTMLElement;
private _rowContainer: HTMLElement;
private _rowElements: HTMLElement[];
private _rowColumns: WeakMap<HTMLElement, number[]> = new WeakMap();
private _liveRegion: HTMLElement;
private _liveRegionLineCount: number = 0;
private _liveRegionDebouncer: IRenderDebouncer;
private _topBoundaryFocusListener: (e: FocusEvent) => void;
private _bottomBoundaryFocusListener: (e: FocusEvent) => void;
/**
* This queue has a character pushed to it for keys that are pressed, if the
* next character added to the terminal is equal to the key char then it is
* not announced (added to live region) because it has already been announced
* by the textarea event (which cannot be canceled). There are some race
* condition cases if there is typing while data is streaming, but this covers
* the main case of typing into the prompt and inputting the answer to a
* question (Y/N, etc.).
*/
private _charsToConsume: string[] = [];
private _charsToAnnounce: string = '';
constructor(
private readonly _terminal: ITerminal,
@IInstantiationService instantiationService: IInstantiationService,
@ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,
@IRenderService private readonly _renderService: IRenderService
) {
super();
this._accessibilityContainer = this._coreBrowserService.mainDocument.createElement('div');
this._accessibilityContainer.classList.add('xterm-accessibility');
this._rowContainer = this._coreBrowserService.mainDocument.createElement('div');
this._rowContainer.setAttribute('role', 'list');
this._rowContainer.classList.add('xterm-accessibility-tree');
this._rowElements = [];
for (let i = 0; i < this._terminal.rows; i++) {
this._rowElements[i] = this._createAccessibilityTreeNode();
this._rowContainer.appendChild(this._rowElements[i]);
}
this._topBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.TOP);
this._bottomBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.BOTTOM);
this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);
this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);
this._refreshRowsDimensions();
this._accessibilityContainer.appendChild(this._rowContainer);
this._liveRegion = this._coreBrowserService.mainDocument.createElement('div');
this._liveRegion.classList.add('live-region');
this._liveRegion.setAttribute('aria-live', 'assertive');
this._accessibilityContainer.appendChild(this._liveRegion);
this._liveRegionDebouncer = this.register(new TimeBasedDebouncer(this._renderRows.bind(this)));
if (!this._terminal.element) {
throw new Error('Cannot enable accessibility before Terminal.open');
}
if (DEBUG) {
this._accessibilityContainer.classList.add('debug');
this._rowContainer.classList.add('debug');
// Use a `<div class="xterm">` container so that the css will still apply.
this._debugRootContainer = document.createElement('div');
this._debugRootContainer.classList.add('xterm');
this._debugRootContainer.appendChild(document.createTextNode('------start a11y------'));
this._debugRootContainer.appendChild(this._accessibilityContainer);
this._debugRootContainer.appendChild(document.createTextNode('------end a11y------'));
this._terminal.element.insertAdjacentElement('afterend', this._debugRootContainer);
} else {
this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityContainer);
}
this.register(this._terminal.onResize(e => this._handleResize(e.rows)));
this.register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));
this.register(this._terminal.onScroll(() => this._refreshRows()));
// Line feed is an issue as the prompt won't be read out after a command is run
this.register(this._terminal.onA11yChar(char => this._handleChar(char)));
this.register(this._terminal.onLineFeed(() => this._handleChar('\n')));
this.register(this._terminal.onA11yTab(spaceCount => this._handleTab(spaceCount)));
this.register(this._terminal.onKey(e => this._handleKey(e.key)));
this.register(this._terminal.onBlur(() => this._clearLiveRegion()));
this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));
this.register(addDisposableDomListener(document, 'selectionchange', () => this._handleSelectionChange()));
this.register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions()));
this._refreshRows();
this.register(toDisposable(() => {
if (DEBUG) {
this._debugRootContainer!.remove();
} else {
this._accessibilityContainer.remove();
}
this._rowElements.length = 0;
}));
}
private _handleTab(spaceCount: number): void {
for (let i = 0; i < spaceCount; i++) {
this._handleChar(' ');
}
}
private _handleChar(char: string): void {
if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {
if (this._charsToConsume.length > 0) {
// Have the screen reader ignore the char if it was just input
const shiftedChar = this._charsToConsume.shift();
if (shiftedChar !== char) {
this._charsToAnnounce += char;
}
} else {
this._charsToAnnounce += char;
}
if (char === '\n') {
this._liveRegionLineCount++;
if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {
this._liveRegion.textContent += Strings.tooMuchOutput;
}
}
}
}
private _clearLiveRegion(): void {
this._liveRegion.textContent = '';
this._liveRegionLineCount = 0;
}
private _handleKey(keyChar: string): void {
this._clearLiveRegion();
// Only add the char if there is no control character.
if (!/\p{Control}/u.test(keyChar)) {
this._charsToConsume.push(keyChar);
}
}
private _refreshRows(start?: number, end?: number): void {
this._liveRegionDebouncer.refresh(start, end, this._terminal.rows);
}
private _renderRows(start: number, end: number): void {
const buffer: IBuffer = this._terminal.buffer;
const setSize = buffer.lines.length.toString();
for (let i = start; i <= end; i++) {
const line = buffer.lines.get(buffer.ydisp + i);
const columns: number[] = [];
const lineData = line?.translateToString(true, undefined, undefined, columns) || '';
const posInSet = (buffer.ydisp + i + 1).toString();
const element = this._rowElements[i];
if (element) {
if (lineData.length === 0) {
element.innerText = '\u00a0';
this._rowColumns.set(element, [0, 1]);
} else {
element.textContent = lineData;
this._rowColumns.set(element, columns);
}
element.setAttribute('aria-posinset', posInSet);
element.setAttribute('aria-setsize', setSize);
}
}
this._announceCharacters();
}
private _announceCharacters(): void {
if (this._charsToAnnounce.length === 0) {
return;
}
this._liveRegion.textContent += this._charsToAnnounce;
this._charsToAnnounce = '';
}
private _handleBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {
const boundaryElement = e.target as HTMLElement;
const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];
// Don't scroll if the buffer top has reached the end in that direction
const posInSet = boundaryElement.getAttribute('aria-posinset');
const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;
if (posInSet === lastRowPos) {
return;
}
// Don't scroll when the last focused item was not the second row (focus is going the other
// direction)
if (e.relatedTarget !== beforeBoundaryElement) {
return;
}
// Remove old boundary element from array
let topBoundaryElement: HTMLElement;
let bottomBoundaryElement: HTMLElement;
if (position === BoundaryPosition.TOP) {
topBoundaryElement = boundaryElement;
bottomBoundaryElement = this._rowElements.pop()!;
this._rowContainer.removeChild(bottomBoundaryElement);
} else {
topBoundaryElement = this._rowElements.shift()!;
bottomBoundaryElement = boundaryElement;
this._rowContainer.removeChild(topBoundaryElement);
}
// Remove listeners from old boundary elements
topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);
bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);
// Add new element to array/DOM
if (position === BoundaryPosition.TOP) {
const newElement = this._createAccessibilityTreeNode();
this._rowElements.unshift(newElement);
this._rowContainer.insertAdjacentElement('afterbegin', newElement);
} else {
const newElement = this._createAccessibilityTreeNode();
this._rowElements.push(newElement);
this._rowContainer.appendChild(newElement);
}
// Add listeners to new boundary elements
this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);
this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);
// Scroll up
this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);
// Focus new boundary before element
this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();
// Prevent the standard behavior
e.preventDefault();
e.stopImmediatePropagation();
}
private _handleSelectionChange(): void {
if (this._rowElements.length === 0) {
return;
}
const selection = document.getSelection();
if (!selection) {
return;
}
if (selection.isCollapsed) {
// Only do something when the anchorNode is inside the row container. This
// behavior mirrors what we do with mouse --- if the mouse clicks
// somewhere outside of the terminal, we don't clear the selection.
if (this._rowContainer.contains(selection.anchorNode)) {
this._terminal.clearSelection();
}
return;
}
if (!selection.anchorNode || !selection.focusNode) {
console.error('anchorNode and/or focusNode are null');
return;
}
// Sort the two selection points in document order.
let begin = { node: selection.anchorNode, offset: selection.anchorOffset };
let end = { node: selection.focusNode, offset: selection.focusOffset };
if ((begin.node.compareDocumentPosition(end.node) & Node.DOCUMENT_POSITION_PRECEDING) || (begin.node === end.node && begin.offset > end.offset) ) {
[begin, end] = [end, begin];
}
// Clamp begin/end to the inside of the row container.
if (begin.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING)) {
begin = { node: this._rowElements[0].childNodes[0], offset: 0 };
}
if (!this._rowContainer.contains(begin.node)) {
// This happens when `begin` is below the last row.
return;
}
const lastRowElement = this._rowElements.slice(-1)[0];
if (end.node.compareDocumentPosition(lastRowElement) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING)) {
end = {
node: lastRowElement,
offset: lastRowElement.textContent?.length ?? 0
};
}
if (!this._rowContainer.contains(end.node)) {
// This happens when `end` is above the first row.
return;
}
const toRowColumn = ({ node, offset }: typeof begin): {row: number, column: number} | null => {
// `node` is either the row element or the Text node inside it.
const rowElement: any = node instanceof Text ? node.parentNode : node;
let row = parseInt(rowElement?.getAttribute('aria-posinset'), 10) - 1;
if (isNaN(row)) {
console.warn('row is invalid. Race condition?');
return null;
}
const columns = this._rowColumns.get(rowElement);
if (!columns) {
console.warn('columns is null. Race condition?');
return null;
}
let column = offset < columns.length ? columns[offset] : columns.slice(-1)[0] + 1;
if (column >= this._terminal.cols) {
++row;
column = 0;
}
return {
row,
column
};
};
const beginRowColumn = toRowColumn(begin);
const endRowColumn = toRowColumn(end);
if (!beginRowColumn || !endRowColumn) {
return;
}
if (beginRowColumn.row > endRowColumn.row || (beginRowColumn.row === endRowColumn.row && beginRowColumn.column >= endRowColumn.column)) {
// This should not happen unless we have some bugs.
throw new Error('invalid range');
}
this._terminal.select(
beginRowColumn.column,
beginRowColumn.row,
(endRowColumn.row - beginRowColumn.row) * this._terminal.cols - beginRowColumn.column + endRowColumn.column
);
}
private _handleResize(rows: number): void {
// Remove bottom boundary listener
this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);
// Grow rows as required
for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {
this._rowElements[i] = this._createAccessibilityTreeNode();
this._rowContainer.appendChild(this._rowElements[i]);
}
// Shrink rows as required
while (this._rowElements.length > rows) {
this._rowContainer.removeChild(this._rowElements.pop()!);
}
// Add bottom boundary listener
this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);
this._refreshRowsDimensions();
}
private _createAccessibilityTreeNode(): HTMLElement {
const element = this._coreBrowserService.mainDocument.createElement('div');
element.setAttribute('role', 'listitem');
element.tabIndex = -1;
this._refreshRowDimensions(element);
return element;
}
private _refreshRowsDimensions(): void {
if (!this._renderService.dimensions.css.cell.height) {
return;
}
this._accessibilityContainer.style.width = `${this._renderService.dimensions.css.canvas.width}px`;
if (this._rowElements.length !== this._terminal.rows) {
this._handleResize(this._terminal.rows);
}
for (let i = 0; i < this._terminal.rows; i++) {
this._refreshRowDimensions(this._rowElements[i]);
}
}
private _refreshRowDimensions(element: HTMLElement): void {
element.style.height = `${this._renderService.dimensions.css.cell.height}px`;
}
}
@@ -0,0 +1,43 @@
{
"name": "pirates",
"description": "Properly hijack require, i.e., properly define require hooks and customizations",
"main": "lib/index.js",
"types": "index.d.ts",
"scripts": {
"test": "ava"
},
"files": [
"lib",
"index.d.ts"
],
"repository": {
"type": "git",
"url": "https://github.com/danez/pirates.git"
},
"engines": {
"node": ">= 6"
},
"author": {
"name": "Ari Porad",
"email": "ari@ariporad.com",
"url": "http://ariporad.com"
},
"devDependencies": {
"ava": "1.4.1",
"decache": "4.6.2"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/danez/pirates/issues"
},
"homepage": "https://github.com/danez/pirates#readme",
"ava": {
"files": [
"test/*.js"
],
"sources": [
"lib/**/*.js"
]
},
"version": "4.0.7"
}
@@ -0,0 +1,74 @@
var arrayEach = require('./_arrayEach'),
arrayPush = require('./_arrayPush'),
baseFunctions = require('./_baseFunctions'),
copyArray = require('./_copyArray'),
isFunction = require('./isFunction'),
isObject = require('./isObject'),
keys = require('./keys');
/**
* Adds all own enumerable string keyed function properties of a source
* object to the destination object. If `object` is a function, then methods
* are added to its prototype as well.
*
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
* avoid conflicts caused by modifying the original.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {Function|Object} [object=lodash] The destination object.
* @param {Object} source The object of functions to add.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.chain=true] Specify whether mixins are chainable.
* @returns {Function|Object} Returns `object`.
* @example
*
* function vowels(string) {
* return _.filter(string, function(v) {
* return /[aeiou]/i.test(v);
* });
* }
*
* _.mixin({ 'vowels': vowels });
* _.vowels('fred');
* // => ['e']
*
* _('fred').vowels().value();
* // => ['e']
*
* _.mixin({ 'vowels': vowels }, { 'chain': false });
* _('fred').vowels();
* // => ['e']
*/
function mixin(object, source, options) {
var props = keys(source),
methodNames = baseFunctions(source, props);
var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
isFunc = isFunction(object);
arrayEach(methodNames, function(methodName) {
var func = source[methodName];
object[methodName] = func;
if (isFunc) {
object.prototype[methodName] = function() {
var chainAll = this.__chain__;
if (chain || chainAll) {
var result = object(this.__wrapped__),
actions = result.__actions__ = copyArray(this.__actions__);
actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
result.__chain__ = chainAll;
return result;
}
return func.apply(object, arrayPush([this.value()], arguments));
};
}
});
return object;
}
module.exports = mixin;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"2":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"1":"7 8 9 AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB","2":"0 1 2 3 4 5 6 xC TC J ZB K D E F A B C L M G N O P aB VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C","322":"0B 1B 2B 3B UC 4B"},D:{"2":"0 1 2 3 4 5 J ZB K D E F A B C L M G N O P aB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","194":"6 7 8 9 AB BB CB DB EB FB bB cB dB eB fB gB hB"},E:{"2":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED"},F:{"2":"0 1 2 3 4 5 6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z FD GD HD ID NC uC JD OC"},G:{"2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC"},H:{"2":"hD"},I:{"2":"TC J I iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"2":"A B C H NC uC OC"},L:{"2":"I"},M:{"2":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"2":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"2":"zD"},R:{"2":"0D"},S:{"1":"1D","2":"2D"}},B:7,C:"Scoped attribute",D:true};
@@ -0,0 +1,105 @@
'use strict'
module.exports = validate
function isArguments (thingy) {
return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee')
}
const types = {
'*': {label: 'any', check: () => true},
A: {label: 'array', check: _ => Array.isArray(_) || isArguments(_)},
S: {label: 'string', check: _ => typeof _ === 'string'},
N: {label: 'number', check: _ => typeof _ === 'number'},
F: {label: 'function', check: _ => typeof _ === 'function'},
O: {label: 'object', check: _ => typeof _ === 'object' && _ != null && !types.A.check(_) && !types.E.check(_)},
B: {label: 'boolean', check: _ => typeof _ === 'boolean'},
E: {label: 'error', check: _ => _ instanceof Error},
Z: {label: 'null', check: _ => _ == null}
}
function addSchema (schema, arity) {
const group = arity[schema.length] = arity[schema.length] || []
if (group.indexOf(schema) === -1) group.push(schema)
}
function validate (rawSchemas, args) {
if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length)
if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas')
if (!args) throw missingRequiredArg(1, 'args')
if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas)
if (!types.A.check(args)) throw invalidType(1, ['array'], args)
const schemas = rawSchemas.split('|')
const arity = {}
schemas.forEach(schema => {
for (let ii = 0; ii < schema.length; ++ii) {
const type = schema[ii]
if (!types[type]) throw unknownType(ii, type)
}
if (/E.*E/.test(schema)) throw moreThanOneError(schema)
addSchema(schema, arity)
if (/E/.test(schema)) {
addSchema(schema.replace(/E.*$/, 'E'), arity)
addSchema(schema.replace(/E/, 'Z'), arity)
if (schema.length === 1) addSchema('', arity)
}
})
let matching = arity[args.length]
if (!matching) {
throw wrongNumberOfArgs(Object.keys(arity), args.length)
}
for (let ii = 0; ii < args.length; ++ii) {
let newMatching = matching.filter(schema => {
const type = schema[ii]
const typeCheck = types[type].check
return typeCheck(args[ii])
})
if (!newMatching.length) {
const labels = matching.map(_ => types[_[ii]].label).filter(_ => _ != null)
throw invalidType(ii, labels, args[ii])
}
matching = newMatching
}
}
function missingRequiredArg (num) {
return newException('EMISSINGARG', 'Missing required argument #' + (num + 1))
}
function unknownType (num, type) {
return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1))
}
function invalidType (num, expectedTypes, value) {
let valueType
Object.keys(types).forEach(typeCode => {
if (types[typeCode].check(value)) valueType = types[typeCode].label
})
return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
englishList(expectedTypes) + ' but got ' + valueType)
}
function englishList (list) {
return list.join(', ').replace(/, ([^,]+)$/, ' or $1')
}
function wrongNumberOfArgs (expected, got) {
const english = englishList(expected)
const args = expected.every(ex => ex.length === 1)
? 'argument'
: 'arguments'
return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got)
}
function moreThanOneError (schema) {
return newException('ETOOMANYERRORTYPES',
'Only one error type per argument signature is allowed, more than one found in "' + schema + '"')
}
function newException (code, msg) {
const err = new TypeError(msg)
err.code = code
/* istanbul ignore else */
if (Error.captureStackTrace) Error.captureStackTrace(err, validate)
return err
}
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,oBAAoB,CAAC,wGAAyF,CAAC;AACnI","sources":["packages/@react-aria/menu/intl/fr-FR.json"],"sourcesContent":["{\n \"longPressMessage\": \"Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.\"\n}\n"],"names":[],"version":3,"file":"fr-FR.main.js.map"}
@@ -0,0 +1,106 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.7](https://github.com/inspect-js/typed-array-length/compare/v1.0.6...v1.0.7) - 2024-11-22
### Fixed
- [Fix] avoid relying on `__proto__` accessor [`#9`](https://github.com/inspect-js/typed-array-length/issues/9)
### Commits
- [Tests] fix TS issues [`f36b6bd`](https://github.com/inspect-js/typed-array-length/commit/f36b6bdbe472923cdd24158705a19b91ae5f512c)
- [actions] split out node 10-20, and 20+ [`d81efa0`](https://github.com/inspect-js/typed-array-length/commit/d81efa0b275161e82f78ceddb3ccf0bd63c2b834)
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@types/object-inspect`, `auto-changelog`, `object-inspect`, `tape` [`a61b15b`](https://github.com/inspect-js/typed-array-length/commit/a61b15baa1dbc40d0fdd0e23779bfa32acab6f5e)
- [Tests] replace `aud` with `npm audit` [`b0b4e8f`](https://github.com/inspect-js/typed-array-length/commit/b0b4e8fa9a3050edcddead80e86765d8fd78298c)
## [v1.0.6](https://github.com/inspect-js/typed-array-length/compare/v1.0.5...v1.0.6) - 2024-03-21
### Commits
- [types] vastly improve types [`9f68d36`](https://github.com/inspect-js/typed-array-length/commit/9f68d36cdc1abeb412f47e91de289b5fb903a696)
- [types] use shared config [`b6b3cbc`](https://github.com/inspect-js/typed-array-length/commit/b6b3cbcaf8f4a46f5bcb77226d4cea2b3f62ffe2)
- [actions] remove redundant finisher [`c69896e`](https://github.com/inspect-js/typed-array-length/commit/c69896e0d71e9f6da562b9ae0eaba415e4cbff26)
- [Tests] actually check types in tests, and add attw [`e2c3f94`](https://github.com/inspect-js/typed-array-length/commit/e2c3f948bd0b898c38e1d9f63cd9702e728a7109)
## [v1.0.5](https://github.com/inspect-js/typed-array-length/compare/v1.0.4...v1.0.5) - 2024-02-20
### Commits
- add types [`df51e65`](https://github.com/inspect-js/typed-array-length/commit/df51e65a85fa6d1a98571ab30398b36ac2c981bb)
- [Refactor] use `possible-typed-array-names` for a single source of truth [`84503a3`](https://github.com/inspect-js/typed-array-length/commit/84503a3d406e8ae1cc84cf6e893cacc556be664a)
- [actions] update rebase action to use reusable workflow [`f163023`](https://github.com/inspect-js/typed-array-length/commit/f16302365bbb353b0504a41d997fa18196757c80)
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `object-inspect`, `tape` [`57ca930`](https://github.com/inspect-js/typed-array-length/commit/57ca93013d607c0ac46b749d8258bb341b903567)
- [Dev Deps] update `aud`, `is-callable`, `object-inspect`, `tape` [`99343f4`](https://github.com/inspect-js/typed-array-length/commit/99343f477d68f2d53597bc0cadf93e532a498138)
- [Refactor] use `gopd` and `has-proto` [`b134a5c`](https://github.com/inspect-js/typed-array-length/commit/b134a5cc4bea1666f4195d6b6c6e97617305420f)
- [Deps] update `call-bind`, `is-typed-array` [`3b62f55`](https://github.com/inspect-js/typed-array-length/commit/3b62f55cc52da8b4c9548fb8839f0e4db222ac1b)
- [meta] add missing `engines.node` [`ff3e9f7`](https://github.com/inspect-js/typed-array-length/commit/ff3e9f7b8d72c0c2d1e9c2122a701ac454e6552c)
- [Deps] update `is-typed-array` [`877f507`](https://github.com/inspect-js/typed-array-length/commit/877f507048ece8b1db6402b56d512c7eb3337ce9)
- [meta] add `sideEffects` flag [`6e91309`](https://github.com/inspect-js/typed-array-length/commit/6e913098eaca5132a3595b0653d211ffec93f2c6)
## [v1.0.4](https://github.com/inspect-js/typed-array-length/compare/v1.0.3...v1.0.4) - 2022-05-23
### Commits
- [actions] reuse common workflows [`dfd4a37`](https://github.com/inspect-js/typed-array-length/commit/dfd4a37d851a28e3d74d892a69874e02f2e58c37)
- [meta] use `npmignore` to autogenerate an npmignore file [`a837e80`](https://github.com/inspect-js/typed-array-length/commit/a837e80d4029f26785ab9f3aa571ca782ac8e851)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `object-inspect`, `tape` [`7b05a87`](https://github.com/inspect-js/typed-array-length/commit/7b05a8772af399e52bb448618a246cd34d3e3273)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`c495f6e`](https://github.com/inspect-js/typed-array-length/commit/c495f6e050a4a7463a82c9195f31f44cf2760945)
- [meta] simplify "exports" [`e42a6b6`](https://github.com/inspect-js/typed-array-length/commit/e42a6b6b0dc243fce32df20a75a7962782ef2a83)
- [Fix] ensure `for-each` dependency is properly listed [`8ec761c`](https://github.com/inspect-js/typed-array-length/commit/8ec761ca56c13927281d626958a2f55211e14f45)
- [Deps] update `call-bind`, `is-typed-array` [`2cc173a`](https://github.com/inspect-js/typed-array-length/commit/2cc173a4216e167db896bea7b8e03edf8b2d3833)
- [meta] add `safe-publish-latest` [`e8e3afa`](https://github.com/inspect-js/typed-array-length/commit/e8e3afa431ce98bbdbb68c9f8e3c029cc5128c6c)
- [Deps] update `is-typed-array` [`cd8084d`](https://github.com/inspect-js/typed-array-length/commit/cd8084db59b734ac4519b6d47f96233b6f73b1a6)
## [v1.0.3](https://github.com/inspect-js/typed-array-length/compare/v1.0.2...v1.0.3) - 2020-12-05
### Commits
- [Tests] migrate tests to Github Actions [`a578b83`](https://github.com/inspect-js/typed-array-length/commit/a578b83e68055c1e7c7120bc4583e1d6926fc268)
- [meta] avoid publishing github workflows [`f064a4b`](https://github.com/inspect-js/typed-array-length/commit/f064a4bf9090202154249d969be0799c34804ad4)
- [Tests] run `nyc` on all tests [`69b841e`](https://github.com/inspect-js/typed-array-length/commit/69b841e43042358c71c3290342514b6d107f08d1)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`4594e83`](https://github.com/inspect-js/typed-array-length/commit/4594e83250579cdbff870aa951e7af56ca169489)
- [actions] add "Allow Edits" workflow [`81e953b`](https://github.com/inspect-js/typed-array-length/commit/81e953ba6b3f59c5657e0d17fa1e7619b94891f5)
- [Deps] update `is-typed-array`; use `call-bind` instead of `es-abstract` [`e7da56b`](https://github.com/inspect-js/typed-array-length/commit/e7da56b3c03b7f0db9bb110444ec1ccf19d7e9f9)
- [readme] remove travis badge [`6d610d8`](https://github.com/inspect-js/typed-array-length/commit/6d610d83cb78ac5286c5ca273f4b3c7289f7686e)
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`2d0ad64`](https://github.com/inspect-js/typed-array-length/commit/2d0ad644a11f754e61b49d327fdf891605abbe58)
## [v1.0.2](https://github.com/inspect-js/typed-array-length/compare/v1.0.1...v1.0.2) - 2020-04-22
### Commits
- [Dev Deps] update `make-arrow-function`, `make-generator-function` [`4facf69`](https://github.com/inspect-js/typed-array-length/commit/4facf697cafb36b9c1057dc4ca1a21d8550c564e)
- [Deps] update `is-typed-array`, `es-abstract` [`aaf3585`](https://github.com/inspect-js/typed-array-length/commit/aaf3585429896b9520dedd886c07aa4a96b50615)
- [Dev Deps] update `aud`, `auto-changelog` [`f10e298`](https://github.com/inspect-js/typed-array-length/commit/f10e298c7733b8de59231c1581c9b000c205edbd)
- [meta] allow `package.json` to be required/imported [`104f4c6`](https://github.com/inspect-js/typed-array-length/commit/104f4c6a6363e600d54aeb7abd90e37d99693aaf)
- [Tests] only audit prod deps [`c748ab5`](https://github.com/inspect-js/typed-array-length/commit/c748ab596de505483df14ca7eeda7f27aeb20383)
- [Deps] update `es-abstract` [`6cd213e`](https://github.com/inspect-js/typed-array-length/commit/6cd213ec654da3325abc8190f8c07c860474d944)
- [Dev Deps] update `tape` [`2b0b2ea`](https://github.com/inspect-js/typed-array-length/commit/2b0b2ea9be106e8a068597c3f499ef703cce1edb)
- [Dev Deps] update `@ljharb/eslint-config` [`cf462f3`](https://github.com/inspect-js/typed-array-length/commit/cf462f3352cf2fd592e624746371e3de800a265d)
- [Deps] update `is-typed-array` [`ff46995`](https://github.com/inspect-js/typed-array-length/commit/ff469955b5d92942ba066c77eac7467e0c4de1ec)
## [v1.0.1](https://github.com/inspect-js/typed-array-length/compare/v1.0.0...v1.0.1) - 2020-01-19
### Commits
- readme [`d3643fd`](https://github.com/inspect-js/typed-array-length/commit/d3643fd11919844b1f42041ef980a1f33215b515)
- [meta] fix "exports" field [`006e28b`](https://github.com/inspect-js/typed-array-length/commit/006e28b30b11f8948e607d13ef0e96c3d7d7f61f)
## v1.0.0 - 2020-01-18
### Commits
- Initial commit [`5f9e2ec`](https://github.com/inspect-js/typed-array-length/commit/5f9e2ec6650f80dc894e354e9e98181b09006346)
- Tests [`6b9cadb`](https://github.com/inspect-js/typed-array-length/commit/6b9cadb0c274933bc7ee5e3fc6a5a380163cbe76)
- Implementation [`6a3cb50`](https://github.com/inspect-js/typed-array-length/commit/6a3cb50429f40fc4ac9020bbf9539560c1b70213)
- npm init [`41d42cd`](https://github.com/inspect-js/typed-array-length/commit/41d42cddfd3d47df6c9d480cf77787eae1109432)
- [meta] add `auto-changelog` [`4fd159b`](https://github.com/inspect-js/typed-array-length/commit/4fd159bc6535e86c370a2186d60a68656f0d8917)
- [meta] add `funding` field; create FUNDING.yml [`6a9fca7`](https://github.com/inspect-js/typed-array-length/commit/6a9fca7e0fdf3ff3fd4b0f18596471ca3d050a39)
- [actions] add automatic rebasing / merge commit blocking [`8303296`](https://github.com/inspect-js/typed-array-length/commit/83032967b14afd37c382d4bf2c1fc5c95e3764bd)
- [Tests] add `npm run lint` [`47a9c21`](https://github.com/inspect-js/typed-array-length/commit/47a9c211f474dbe8528f6b28f50080eacd5bf7eb)
- [Tests] use shared travis-ci configs [`d0c8915`](https://github.com/inspect-js/typed-array-length/commit/d0c89153e1c50f1eadd0b42521bcdcf3366b8af5)
- Only apps should have lockfiles [`3eaef9c`](https://github.com/inspect-js/typed-array-length/commit/3eaef9cd192b1a25d1930739e7c0044e39ad3c0d)
@@ -0,0 +1,14 @@
import { useCallback } from 'react';
import { rootProjectionNode } from './node/HTMLProjectionNode.mjs';
function useResetProjection() {
const reset = useCallback(() => {
const root = rootProjectionNode.current;
if (!root)
return;
root.resetTree();
}, []);
return reset;
}
export { useResetProjection };
@@ -0,0 +1 @@
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAmBM,SAAS,0CAA4B,KAAuC;IACjF,IAAI,OAAO,aAAa,aAAa;QACnC,QAAQ,GAAG,CAAC;QACZ,OAAO;IACT;IAEA,IAAI,SAAC,KAAK,UAAE,MAAM,WAAE,OAAO,EAAC,GAAG;IAC/B,4DAA4D;IAC5D,2DAA2D;IAC3D,qBAAO,gCAAC;QAAO,OAAO,OAAO,WAAW,cAAc,QAAQ;QAAI,0BAAA;QAAyB,yBAAyB;YAAC,QAAQ,0CAA6B,QAAQ;QAAQ;;AAC5K;AAKO,SAAS,0CAA6B,MAAc,EAAE,OAAgC;IAC3F,OAAO,CAAC,6CAA6C,EAAE,KAAK,SAAS,CAAC,QAAQ,EAAE,EAAE,gCAAU,SAAS,CAAC,CAAC;AACzG;AAEA,MAAM,8BAAQ,IAAI;AAElB,SAAS,gCAAU,OAAgC;IACjD,IAAI,SAAS,4BAAM,GAAG,CAAC;IACvB,IAAI,QACF,OAAO;IAGT,sEAAsE;IACtE,IAAI,OAAO,IAAI;IACf,IAAI,SAAS,IAAI;IACjB,IAAK,IAAI,OAAO,QACd,IAAK,IAAI,OAAO,OAAO,CAAC,IAAI,CAAE;QAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI;QACzB,IAAI,IAAI,OAAO,MAAM,WAAW,KAAK,SAAS,CAAC,KAAK,EAAE,QAAQ;QAC9D,IAAI,KAAK,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,IAAI;YACjC,IAAI,OAAO,OAAO,YAAY,CAAC,OAAO,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG;YACnF,OAAO,GAAG,CAAC,GAAG;QAChB;QACA,KAAK,GAAG,CAAC;IACX;IAGF,IAAI,MAAM;IACV,IAAI,OAAO,IAAI,GAAG,GAChB,OAAO;IAET,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,OACzB,OAAO,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IAE7B,IAAI,OAAO,IAAI,GAAG,GAChB,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IAG3B,OAAO;IACP,IAAK,IAAI,OAAO,QAAS;QACvB,OAAO,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC;QACnB,IAAK,IAAI,OAAO,OAAO,CAAC,IAAI,CAAE;YAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI;YACzB,IAAI,IAAI,OAAO,MAAM,WAAW,KAAK,SAAS,CAAC,KAAK,EAAE,QAAQ;YAC9D,IAAI,OAAO,GAAG,CAAC,IACb,IAAI,OAAO,GAAG,CAAC;YAEjB,OAAO,GAAG,QAAQ,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE;QACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IAC3B;IACA,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM;IACzB,4BAAM,GAAG,CAAC,SAAS;IACnB,OAAO;AACT","sources":["packages/@react-aria/i18n/src/server.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 type {LocalizedString} from '@internationalized/string';\nimport React from 'react';\n\ntype PackageLocalizedStrings = {\n [packageName: string]: Record<string, LocalizedString>\n};\n\ninterface PackageLocalizationProviderProps {\n locale: string,\n strings: PackageLocalizedStrings,\n nonce?: string\n}\n\n/**\n * A PackageLocalizationProvider can be rendered on the server to inject the localized strings\n * needed by the client into the initial HTML.\n */\nexport function PackageLocalizationProvider(props: PackageLocalizationProviderProps) {\n if (typeof document !== 'undefined') {\n console.log('PackageLocalizationProvider should only be rendered on the server.');\n return null;\n }\n\n let {nonce, locale, strings} = props;\n // suppressHydrationWarning is necessary because the browser\n // remove the nonce parameter from the DOM before hydration\n return <script nonce={typeof window === 'undefined' ? nonce : ''} suppressHydrationWarning dangerouslySetInnerHTML={{__html: getPackageLocalizationScript(locale, strings)}} />;\n}\n\n/**\n * Returns the content for an inline `<script>` tag to inject localized strings into initial HTML.\n */\nexport function getPackageLocalizationScript(locale: string, strings: PackageLocalizedStrings) {\n return `window[Symbol.for('react-aria.i18n.locale')]=${JSON.stringify(locale)};{${serialize(strings)}}`;\n}\n\nconst cache = new WeakMap<PackageLocalizedStrings, string>();\n\nfunction serialize(strings: PackageLocalizedStrings): string {\n let cached = cache.get(strings);\n if (cached) {\n return cached;\n }\n\n // Find common strings between packages and hoist them into variables.\n let seen = new Set();\n let common = new Map();\n for (let pkg in strings) {\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (seen.has(s) && !common.has(s)) {\n let name = String.fromCharCode(common.size > 25 ? common.size + 97 : common.size + 65);\n common.set(s, name);\n }\n seen.add(s);\n }\n }\n\n let res = '';\n if (common.size > 0) {\n res += 'let ';\n }\n for (let [string, name] of common) {\n res += `${name}=${string},`;\n }\n if (common.size > 0) {\n res = res.slice(0, -1) + ';';\n }\n\n res += \"window[Symbol.for('react-aria.i18n.strings')]={\";\n for (let pkg in strings) {\n res += `'${pkg}':{`;\n for (let key in strings[pkg]) {\n let v = strings[pkg][key];\n let s = typeof v === 'string' ? JSON.stringify(v) : v.toString();\n if (common.has(s)) {\n s = common.get(s);\n }\n res += `${/[ ()]/.Line truncated
@@ -0,0 +1,26 @@
import { NodeIKernelFileAssistantListener } from '../index';
export interface NodeIKernelFileAssistantService {
addKernelFileAssistantListener(listener: NodeIKernelFileAssistantListener): unknown;
removeKernelFileAssistantListener(arg1: unknown[]): unknown;
getFileAssistantList(arg1: unknown[]): unknown;
getMoreFileAssistantList(arg1: unknown[]): unknown;
getFileSessionList(): unknown;
searchFile(keywords: string[], params: {
resultType: number;
pageLimit: number;
}, resultId: number): number;
resetSearchFileSortType(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
searchMoreFile(arg1: unknown[]): unknown;
cancelSearchFile(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
downloadFile(fileIds: string[]): {
result: number;
errMsg: string;
};
forwardFile(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
cancelFileAction(arg1: unknown[]): unknown;
retryFileAction(arg1: unknown[]): unknown;
deleteFile(arg1: unknown[]): unknown;
saveAs(arg1: unknown, arg2: unknown): unknown;
saveAsWithRename(arg1: unknown, arg2: unknown, arg3: unknown): unknown;
isNull(): boolean;
}
@@ -0,0 +1,14 @@
/**
* Encode only the dangerous HTML characters.
*
* This ensures that certain characters which have special meaning in HTML are
* dealt with.
* Technically, we can skip `>` and `"` in many cases, but CM includes them.
*
* @param {string} value
* Value to encode.
* @returns {string}
* Encoded value.
*/
export function encode(value: string): string;
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
export { _ as default } from "../esm/_object_without_properties.js";
@@ -0,0 +1,4 @@
// envify compatibility
'use strict';
module.exports = require('./loose-envify');
@@ -0,0 +1,3 @@
import type { TSESLint } from '@typescript-eslint/utils';
declare const _default: TSESLint.RuleModule<"bannedClassType", [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener>;
export default _default;
@@ -0,0 +1,20 @@
export declare const GroupRecallMsg: {
type: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
groupUin: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
field3: import("napcat-protobuf").MessageProtoFieldType<() => {
sequence: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
random: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
field3: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
}, false, false>;
field4: import("napcat-protobuf").MessageProtoFieldType<() => {
field1: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
}, false, false>;
};
export declare const GroupRecallMsgField3: {
sequence: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
random: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
field3: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
};
export declare const GroupRecallMsgField4: {
field1: import("napcat-protobuf").ScalarProtoFieldType<ScalarType.UINT32, false, false>;
};
@@ -0,0 +1,229 @@
import { parseFiles } from "@ast-grep/napi";
import MagicString from "magic-string";
import { chalk, fs, path } from "zx";
import { errors } from "./errors.js";
import { root } from "./utils.js";
/**
* @typedef {import("@ast-grep/napi").SgNode} SgNode
*/
export function ast_grep() {
const task_queue = [];
const task = parseFiles([root("esm")], (err, tree) => {
const filename = path.basename(tree.filename(), ".js");
if (filename === "index") {
return;
}
const source = new MagicString(tree.root().text());
source.prepend(`"use strict";\n\n`);
if (filename.startsWith("_ts")) {
const match = tree.root().find(`export { $NAME as _ } from "tslib"`);
if (match) {
const name = match.getMatch("NAME").text();
const range = match.range();
source.update(
range.start.index,
range.end.index,
`exports._ = require("tslib").${name};`,
);
task_queue.push(
fs.writeFile(root("cjs", `${filename}.cjs`), source.toString(), {
encoding: "utf-8",
}),
);
} else {
report_noexport(tree.filename());
}
return;
}
// rewrite export named function
const match = tree.root().find({
rule: {
kind: "export_statement",
pattern: "export { $FUNC as _ }",
},
});
if (match) {
const func = match.getMatch("FUNC");
const func_name = func.text();
if (func_name !== filename) {
report_export_mismatch(tree.filename(), match);
}
const range = match.range();
source.update(
range.start.index,
range.end.index,
`exports._ = ${func_name};`,
);
// since we match the { export x as _ } pattern,
// we need to find the assignment expression from the root
tree
.root()
.findAll({
rule: {
pattern: func_name,
kind: "identifier",
inside: { kind: "assignment_expression", field: "left" },
},
})
.forEach((match) => {
const range = match.range();
source.prependLeft(range.start.index, `exports._ = `);
});
} else {
report_noexport(tree.filename(tree.filename()));
}
// rewrite import
tree
.root()
.findAll({ rule: { pattern: `import { _ as $BINDING } from "$SOURCE"` } })
.forEach((match) => {
const import_binding = match.getMatch("BINDING").text();
const import_source = match.getMatch("SOURCE").text();
const import_basename = path.basename(import_source, ".js");
if (import_binding !== import_basename) {
report_import_mismatch(tree.filename(), match);
}
const range = match.range();
source.update(
range.start.index,
range.end.index,
`var ${import_binding} = require("./${import_binding}.cjs");`,
);
tree
.root()
.findAll({
rule: {
pattern: import_binding,
kind: "identifier",
inside: {
not: {
kind: "import_specifier",
},
},
},
})
.forEach((match) => {
const range = match.range();
const ref_name = match.text();
source.update(
range.start.index,
range.end.index,
`${ref_name}._`,
);
});
});
task_queue.push(
fs.writeFile(root("cjs", `${filename}.cjs`), source.toString(), {
encoding: "utf-8",
}),
);
});
task_queue.push(task);
return task_queue;
}
/**
* @param {string} filename
* @param {SgNode} match
*/
function report_export_mismatch(filename, match) {
const func = match.getMatch("FUNC");
const func_range = func.range();
const text = match.text().split("\n");
const offset = func_range.start.line - match.range().start.line;
text.splice(
offset + 1,
text.length,
chalk.red(
[
" ".repeat(func_range.start.column),
"^".repeat(func_range.end.column - func_range.start.column),
]
.join(""),
),
);
errors.push(
[
`${chalk.bold.red("error")}: mismatch exported function name.`,
"",
`${chalk.blue("-->")} ${filename}:${func_range.start.line + 1}:${func_range.start.column + 1}`,
"",
...text,
"",
`${
chalk.bold(
"note:",
)
} The exported name should be the same as the filename.`,
"",
]
.join("\n"),
);
}
/**
* @param {string} filename
* @param {SgNode} match
*/
function report_import_mismatch(filename, match) {
const binding_range = match.getMatch("BINDING").range();
const source_range = match.getMatch("SOURCE").range();
errors.push(
[
`${chalk.bold.red("error")}: mismatch imported binding name.`,
"",
`${chalk.blue("-->")} ${filename}:${match.range().start.line + 1}`,
"",
match.text(),
[
" ".repeat(binding_range.start.column),
chalk.red("^".repeat(binding_range.end.column - binding_range.start.column)),
" ".repeat(source_range.start.column - binding_range.end.column),
chalk.blue("-".repeat(source_range.end.column - source_range.start.column)),
]
.join(""),
`${
chalk.bold(
"note:",
)
} The imported binding name should be the same as the import source basename.`,
"",
]
.join("\n"),
);
}
/**
* @param {string} filename
*/
function report_noexport(filename) {
errors.push(
[`${chalk.bold.red("error")}: exported name not found`, `${chalk.blue("-->")} ${filename}`].join("\n"),
);
}
@@ -0,0 +1,40 @@
import { rgba } from './rgba.mjs';
import { isColorString } from './utils.mjs';
function parseHex(v) {
let r = "";
let g = "";
let b = "";
let a = "";
// If we have 6 characters, ie #FF0000
if (v.length > 5) {
r = v.substring(1, 3);
g = v.substring(3, 5);
b = v.substring(5, 7);
a = v.substring(7, 9);
// Or we have 3 characters, ie #F00
}
else {
r = v.substring(1, 2);
g = v.substring(2, 3);
b = v.substring(3, 4);
a = v.substring(4, 5);
r += r;
g += g;
b += b;
a += a;
}
return {
red: parseInt(r, 16),
green: parseInt(g, 16),
blue: parseInt(b, 16),
alpha: a ? parseInt(a, 16) / 255 : 1,
};
}
const hex = {
test: /*@__PURE__*/ isColorString("#"),
parse: parseHex,
transform: rgba.transform,
};
export { hex };
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('plant', require('../plant'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,145 @@
/**
* @fileoverview Prevent JSX prop spreading
* @author Ashish Gambhir
*/
'use strict';
const docsUrl = require('../util/docsUrl');
const report = require('../util/report');
// ------------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------------
const OPTIONS = { ignore: 'ignore', enforce: 'enforce' };
const DEFAULTS = {
html: OPTIONS.enforce,
custom: OPTIONS.enforce,
explicitSpread: OPTIONS.enforce,
exceptions: [],
};
const isException = (tag, allExceptions) => allExceptions.indexOf(tag) !== -1;
const isProperty = (property) => property.type === 'Property';
const getTagNameFromMemberExpression = (node) => {
if (node.property.parent) {
return `${node.property.parent.object.name}.${node.property.name}`;
}
// for eslint 3
return `${node.object.name}.${node.property.name}`;
};
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
const messages = {
noSpreading: 'Prop spreading is forbidden',
};
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
description: 'Disallow JSX prop spreading',
category: 'Best Practices',
recommended: false,
url: docsUrl('jsx-props-no-spreading'),
},
messages,
schema: [{
allOf: [{
type: 'object',
properties: {
html: {
enum: [OPTIONS.enforce, OPTIONS.ignore],
},
custom: {
enum: [OPTIONS.enforce, OPTIONS.ignore],
},
explicitSpread: {
enum: [OPTIONS.enforce, OPTIONS.ignore],
},
exceptions: {
type: 'array',
items: {
type: 'string',
uniqueItems: true,
},
},
},
}, {
not: {
type: 'object',
required: ['html', 'custom'],
properties: {
html: {
enum: [OPTIONS.ignore],
},
custom: {
enum: [OPTIONS.ignore],
},
exceptions: {
type: 'array',
minItems: 0,
maxItems: 0,
},
},
},
}],
}],
},
create(context) {
const configuration = context.options[0] || {};
const ignoreHtmlTags = (configuration.html || DEFAULTS.html) === OPTIONS.ignore;
const ignoreCustomTags = (configuration.custom || DEFAULTS.custom) === OPTIONS.ignore;
const ignoreExplicitSpread = (configuration.explicitSpread || DEFAULTS.explicitSpread) === OPTIONS.ignore;
const exceptions = configuration.exceptions || DEFAULTS.exceptions;
return {
JSXSpreadAttribute(node) {
const jsxOpeningElement = node.parent.name;
const type = jsxOpeningElement.type;
let tagName;
if (type === 'JSXIdentifier') {
tagName = jsxOpeningElement.name;
} else if (type === 'JSXMemberExpression') {
tagName = getTagNameFromMemberExpression(jsxOpeningElement);
} else {
tagName = undefined;
}
const isHTMLTag = tagName && tagName[0] !== tagName[0].toUpperCase();
const isCustomTag = tagName && (tagName[0] === tagName[0].toUpperCase() || tagName.includes('.'));
if (
isHTMLTag
&& ((ignoreHtmlTags && !isException(tagName, exceptions))
|| (!ignoreHtmlTags && isException(tagName, exceptions)))
) {
return;
}
if (
isCustomTag
&& ((ignoreCustomTags && !isException(tagName, exceptions))
|| (!ignoreCustomTags && isException(tagName, exceptions)))
) {
return;
}
if (
ignoreExplicitSpread
&& node.argument.type === 'ObjectExpression'
&& node.argument.properties.every(isProperty)
) {
return;
}
report(context, messages.noSpreading, 'noSpreading', {
node,
});
},
};
},
};
@@ -0,0 +1,201 @@
import type LinkedNode from './linked-node.js';
class LinkedList<T extends LinkedNode> {
public head: T | null;
public tail: T | null;
public length: number;
constructor() {
this.head = null;
this.tail = null;
this.length = 0;
}
public append(...nodes: T[]): void {
this.insertBefore(nodes[0], null);
if (nodes.length > 1) {
const rest = nodes.slice(1);
this.append(...rest);
}
}
public at(index: number): T | null {
const next = this.iterator();
let cur = next();
while (cur && index > 0) {
index -= 1;
cur = next();
}
return cur;
}
public contains(node: T): boolean {
const next = this.iterator();
let cur = next();
while (cur) {
if (cur === node) {
return true;
}
cur = next();
}
return false;
}
public indexOf(node: T): number {
const next = this.iterator();
let cur = next();
let index = 0;
while (cur) {
if (cur === node) {
return index;
}
index += 1;
cur = next();
}
return -1;
}
public insertBefore(node: T | null, refNode: T | null): void {
if (node == null) {
return;
}
this.remove(node);
node.next = refNode;
if (refNode != null) {
node.prev = refNode.prev;
if (refNode.prev != null) {
refNode.prev.next = node;
}
refNode.prev = node;
if (refNode === this.head) {
this.head = node;
}
} else if (this.tail != null) {
this.tail.next = node;
node.prev = this.tail;
this.tail = node;
} else {
node.prev = null;
this.head = this.tail = node;
}
this.length += 1;
}
public offset(target: T): number {
let index = 0;
let cur = this.head;
while (cur != null) {
if (cur === target) {
return index;
}
index += cur.length();
cur = cur.next as T;
}
return -1;
}
public remove(node: T): void {
if (!this.contains(node)) {
return;
}
if (node.prev != null) {
node.prev.next = node.next;
}
if (node.next != null) {
node.next.prev = node.prev;
}
if (node === this.head) {
this.head = node.next as T;
}
if (node === this.tail) {
this.tail = node.prev as T;
}
this.length -= 1;
}
public iterator(curNode: T | null = this.head): () => T | null {
// TODO use yield when we can
return (): T | null => {
const ret = curNode;
if (curNode != null) {
curNode = curNode.next as T;
}
return ret;
};
}
public find(index: number, inclusive = false): [T | null, number] {
const next = this.iterator();
let cur = next();
while (cur) {
const length = cur.length();
if (
index < length ||
(inclusive &&
index === length &&
(cur.next == null || cur.next.length() !== 0))
) {
return [cur, index];
}
index -= length;
cur = next();
}
return [null, 0];
}
public forEach(callback: (cur: T) => void): void {
const next = this.iterator();
let cur = next();
while (cur) {
callback(cur);
cur = next();
}
}
public forEachAt(
index: number,
length: number,
callback: (cur: T, offset: number, length: number) => void,
): void {
if (length <= 0) {
return;
}
const [startNode, offset] = this.find(index);
let curIndex = index - offset;
const next = this.iterator(startNode);
let cur = next();
while (cur && curIndex < index + length) {
const curLength = cur.length();
if (index > curIndex) {
callback(
cur,
index - curIndex,
Math.min(length, curIndex + curLength - index),
);
} else {
callback(cur, 0, Math.min(curLength, index + length - curIndex));
}
curIndex += curLength;
cur = next();
}
}
public map(callback: (cur: T) => any): any[] {
return this.reduce((memo: T[], cur: T) => {
memo.push(callback(cur));
return memo;
}, []);
}
public reduce<M>(callback: (memo: M, cur: T) => M, memo: M): M {
const next = this.iterator();
let cur = next();
while (cur) {
memo = callback(memo, cur);
cur = next();
}
return memo;
}
}
export default LinkedList;
@@ -0,0 +1,19 @@
export declare const GuildActionsExamples: {
GetGuildList: {
payload: {};
response: {
guild_id: string;
guild_name: string;
}[];
};
GetGuildProfile: {
payload: {
guild_id: string;
};
response: {
guild_id: string;
guild_name: string;
guild_display_id: string;
};
};
};
@@ -0,0 +1,39 @@
{
"name": "@vitejs/plugin-react-swc",
"version": "4.2.2",
"license": "MIT",
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
"description": "Speed up your Vite dev server with SWC",
"keywords": [
"vite",
"vite-plugin",
"react",
"swc",
"react-refresh",
"fast refresh"
],
"type": "module",
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vitejs/vite-plugin-react.git",
"directory": "packages/plugin-react-swc"
},
"bugs": {
"url": "https://github.com/vitejs/vite-plugin-react/issues"
},
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc#readme",
"dependencies": {
"@rolldown/pluginutils": "1.0.0-beta.47",
"@swc/core": "^1.13.5"
},
"peerDependencies": {
"vite": "^4 || ^5 || ^6 || ^7"
},
"exports": {
".": "./index.js",
"./preamble": "./types/preamble.d.ts"
}
}
@@ -0,0 +1,836 @@
flf2a� 3 3 7 -1 16
Pyramid by Claude Martins 02/95
Includes characters 128-255
figlet release 2.1 -- 12 Aug 1994
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be `a', for now
$ - the "hardblank" -- prints as a blank, but can't be smushed
3 - height of a character
3 - height of a character, not including descenders
7 - max line length (excluding comment lines) + a fudge factor
-1 - default smushmode for this font
16 - number of comment lines
= 
= 
= @
^ @
/!\ @
<___>@@
^ @
/"\ @
<___>@@
^ @
/#\ @
<___>@@
^ @
/$\ @
<___>@@
^ @
/%\ @
<___>@@
^ @
/&\ @
<___>@@
^ @
/'\ @
<___>@@
^ @
/(\ @
<___>@@
^ @
/)\ @
<___>@@
^ @
/*\ @
<___>@@
^ @
/+\ @
<___>@@
^ @
/,\ @
<___>@@
^ @
/-\ @
<___>@@
^ @
/.\ @
<___>@@
^ @
//\ @
<___>@@
^ @
/0\ @
<___>@@
^ @
/1\ @
<___>@@
^ @
/2\ @
<___>@@
^ @
/3\ @
<___>@@
^ @
/4\ @
<___>@@
^ @
/5\ @
<___>@@
^ @
/6\ @
<___>@@
^ @
/7\ @
<___>@@
^ @
/8\ @
<___>@@
^ @
/9\ @
<___>@@
^ @
/:\ @
<___>@@
^ @
/;\ @
<___>@@
^ @
/<\ @
<___>@@
^ @
/=\ @
<___>@@
^ @
/>\ @
<___>@@
^ @
/?\ @
<___>@@
^ @
/@\ @
<___>@@
^ @
/A\ @
<___>@@
^ @
/B\ @
<___>@@
^ @
/C\ @
<___>@@
^ @
/D\ @
<___>@@
^ @
/E\ @
<___>@@
^ @
/F\ @
<___>@@
^ @
/G\ @
<___>@@
^ @
/H\ @
<___>@@
^ @
/I\ @
<___>@@
^ @
/J\ @
<___>@@
^ @
/K\ @
<___>@@
^ @
/L\ @
<___>@@
^ @
/M\ @
<___>@@
^ @
/N\ @
<___>@@
^ @
/O\ @
<___>@@
^ @
/P\ @
<___>@@
^ @
/Q\ @
<___>@@
^ @
/R\ @
<___>@@
^ @
/S\ @
<___>@@
^ @
/T\ @
<___>@@
^ @
/U\ @
<___>@@
^ @
/V\ @
<___>@@
^ @
/W\ @
<___>@@
^ @
/X\ @
<___>@@
^ @
/Y\ @
<___>@@
^ @
/Z\ @
<___>@@
^ @
/[\ @
<___>@@
^ @
/\\ @
<___>@@
^ @
/]\ @
<___>@@
^ @
/^\ @
<___>@@
^ @
/_\ @
<___>@@
^ @
/`\ @
<___>@@
^ @
/a\ @
<___>@@
^ @
/b\ @
<___>@@
^ @
/c\ @
<___>@@
^ @
/d\ @
<___>@@
^ @
/e\ @
<___>@@
^ @
/f\ @
<___>@@
^ @
/g\ @
<___>@@
^ @
/h\ @
<___>@@
^ @
/i\ @
<___>@@
^ @
/j\ @
<___>@@
^ @
/k\ @
<___>@@
^ @
/l\ @
<___>@@
^ @
/m\ @
<___>@@
^ @
/n\ @
<___>@@
^ @
/o\ @
<___>@@
^ @
/p\ @
<___>@@
^ @
/q\ @
<___>@@
^ @
/r\ @
<___>@@
^ @
/s\ @
<___>@@
^ @
/t\ @
<___>@@
^ @
/u\ @
<___>@@
^ @
/v\ @
<___>@@
^ @
/w\ @
<___>@@
^ @
/x\ @
<___>@@
^ @
/y\ @
<___>@@
^ @
/z\ @
<___>@@
^ @
/{\ @
<___>@@
^ @
/|\ @
<___>@@
^ @
/}\ @
<___>@@
^ @
/~\ @
<___>@@
^ @
/�\ @
<___>@@
^ @
/ル\ @
<___>@@
^ @
/媾 @
<___>@@
^ @
/Ы @
<___>@@
^ @
/� @
<___>@@
^ @
/箪 @
<___>@@
^ @
/杤 @
<___>@@
128
^ @
/ヌ\ @
<___>@@
129
^ @
/� @
<___>@@
130
^ @
/饅 @
<___>@@
131
^ @
/秉 @
<___>@@
132
^ @
/臀 @
<___>@@
133
^ @
/濬 @
<___>@@
134
^ @
/藹 @
<___>@@
135
^ @
/軆 @
<___>@@
136
^ @
/鷭 @
<___>@@
137
^ @
/� @
<___>@@
138
^ @
/鐔 @
<___>@@
139
^ @
/� @
<___>@@
140
^ @
/砡 @
<___>@@
141
^ @
/� @
<___>@@
142
^ @
/ト\ @
<___>@@
143
^ @
/ナ\ @
<___>@@
144
^ @
/ノ\ @
<___>@@
145
^ @
/觸 @
<___>@@
146
^ @
/ニ\ @
<___>@@
147
^ @
/� @
<___>@@
148
^ @
/� @
<___>@@
149
^ @
/� @
<___>@@
150
^ @
/犾 @
<___>@@
151
^ @
/� @
<___>@@
152
^ @
/�\ @
<___>@@
153
^ @
/ヨ\ @
<___>@@
154
^ @
/ワ\ @
<___>@@
155
^ @
/「\ @
<___>@@
156
^ @
/」\ @
<___>@@
157
^ @
/・\ @
<___>@@
158
^ @
/、\ @
<___>@@
159
^ @
/暴 @
<___>@@
160
^ @
/畚 @
<___>@@
161
^ @
/偆 @
<___>@@
162
^ @
/� @
<___>@@
163
^ @
/纊 @
<___>@@
164
^ @
/� @
<___>@@
165
^ @
/ム\ @
<___>@@
166
^ @
/ェ\ @
<___>@@
167
^ @
/コ\ @
<___>@@
168
^ @
/ソ\ @
<___>@@
169
^ @
/ィ\ @
<___>@@
170
^ @
/ャ\ @
<___>@@
171
^ @
/ス\ @
<___>@@
172
^ @
/シ\ @
<___>@@
173
^ @
/。\ @
<___>@@
174
^ @
/ォ\ @
<___>@@
175
^ @
/ッ\ @
<___>@@
176
^ @
/予 @
<___>@@
177
^ @
/禄 @
<___>@@
178
^ @
/兔 @
<___>@@
179
^ @
/�\ @
<___>@@
180
^ @
/ウ\ @
<___>@@
181
^ @
/エ\ @
<___>@@
182
^ @
/オ\ @
<___>@@
183
^ @
/ク\ @
<___>@@
184
^ @
/ケ\ @
<___>@@
185
^ @
/�\ @
<___>@@
186
^ @
/ヲ\ @
<___>@@
187
^ @
/ゥ\ @
<___>@@
188
^ @
/ュ\ @
<___>@@
189
^ @
/サ\ @
<___>@@
190
^ @
/セ\ @
<___>@@
191
^ @
/タ\ @
<___>@@
192
^ @
/チ\ @
<___>@@
193
^ @
/ツ\ @
<___>@@
194
^ @
/テ\ @
<___>@@
195
^ @
/ネ\ @
<___>@@
196
^ @
/�\ @
<___>@@
197
^ @
/ハ\ @
<___>@@
198
^ @
/ヒ\ @
<___>@@
199
^ @
/フ\ @
<___>@@
200
^ @
/ョ\ @
<___>@@
201
^ @
/ミ\ @
<___>@@
202
^ @
/ラ\ @
<___>@@
203
^ @
/ン\ @
<___>@@
204
^ @
/゙\ @
<___>@@
205
^ @
/ヘ\ @
<___>@@
206
^ @
/� @
<___>@@
207
^ @
/ホ\ @
<___>@@
208
^ @
/マ\ @
<___>@@
209
^ @
/メ\ @
<___>@@
210
^ @
/モ\ @
<___>@@
211
^ @
/ヤ\ @
<___>@@
212
^ @
/ユ\ @
<___>@@
213
^ @
/リ\ @
<___>@@
214
^ @
/ル\ @
<___>@@
215
^ @
/レ\ @
<___>@@
216
^ @
/ロ\ @
<___>@@
217
^ @
/綵 @
<___>@@
218
^ @
/� @
<___>@@
219
^ @
/喀 @
<___>@@
220
^ @
/媾 @
<___>@@
221
^ @
/彌 @
<___>@@
222
^ @
/拿 @
<___>@@
223
^ @
/杤 @
<___>@@
224
^ @
/€\ @
<___>@@
225
^ @
/゚\ @
<___>@@
226
^ @
/� @
<___>@@
227
^ @
/ソ @
<___>@@
228
^ @
/Ы @
<___>@@
229
^ @
/� @
<___>@@
230
^ @
/� @
<___>@@
231
^ @
/Ⅸ @
<___>@@
232
^ @
/� @
<___>@@
233
^ @
/噂 @
<___>@@
234
^ @
/浬 @
<___>@@
235
^ @
/欺 @
<___>@@
236
^ @
/圭 @
<___>@@
237
^ @
/構 @
<___>@@
238
^ @
/蚕 @
<___>@@
239
^ @
/十 @
<___>@@
240
^ @
/\ @
<___>@@
241
^ @
/ア\ @
<___>@@
242
^ @
/� @
<___>@@
243
^ @
/\ @
<___>@@
244
^ @
/歃 @
<___>@@
245
^ @
/\ @
<___>@@
246
^ @
/� @
<___>@@
247
^ @
/表 @
<___>@@
248
^ @
/ー\ @
<___>@@
249
^ @
/キ\ @
<___>@@
250
^ @
/能 @
<___>@@
251
^ @
/貼 @
<___>@@
252
^ @
/箪 @
<___>@@
253
^ @
/イ\ @
<___>@@
254
^ @
/曾 @
<___>@@
255
^ @
/申 @
<___>@@
@@ -0,0 +1 @@
{"version":3,"file":"checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.spec.d.ts","sourceRoot":"","sources":["../../../../src/planning/calculations/checkPlanServiceRedirectionBindingNodeSingleInjectionBindings.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,67 @@
// Chinese [zh]
import dayjs from '../index';
var locale = {
name: 'zh',
weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
ordinal: function ordinal(number, period) {
switch (period) {
case 'W':
return number + "\u5468";
default:
return number + "\u65E5";
}
},
weekStart: 1,
yearStart: 4,
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'YYYY/MM/DD',
LL: 'YYYY年M月D日',
LLL: 'YYYY年M月D日Ah点mm分',
LLLL: 'YYYY年M月D日ddddAh点mm分',
l: 'YYYY/M/D',
ll: 'YYYY年M月D日',
lll: 'YYYY年M月D日 HH:mm',
llll: 'YYYY年M月D日dddd HH:mm'
},
relativeTime: {
future: '%s后',
past: '%s前',
s: '几秒',
m: '1 分钟',
mm: '%d 分钟',
h: '1 小时',
hh: '%d 小时',
d: '1 天',
dd: '%d 天',
M: '1 个月',
MM: '%d 个月',
y: '1 年',
yy: '%d 年'
},
meridiem: function meridiem(hour, minute) {
var hm = hour * 100 + minute;
if (hm < 600) {
return '凌晨';
} else if (hm < 900) {
return '早上';
} else if (hm < 1100) {
return '上午';
} else if (hm < 1300) {
return '中午';
} else if (hm < 1800) {
return '下午';
}
return '晚上';
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,14 @@
'use strict';
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
var hasSymbolSham = require('./shams');
/** @type {import('.')} */
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== 'function') { return false; }
if (typeof Symbol !== 'function') { return false; }
if (typeof origSymbol('foo') !== 'symbol') { return false; }
if (typeof Symbol('bar') !== 'symbol') { return false; }
return hasSymbolSham();
};
@@ -0,0 +1,26 @@
import {DelimiterCasedProperties} from './delimiter-cased-properties';
/**
Convert object properties to kebab case but not recursively.
This can be useful when, for example, converting some API types from a different style.
@see KebabCase
@see KebabCasedPropertiesDeep
@example
```
interface User {
userId: number;
userName: string;
}
const result: KebabCasedProperties<User> = {
'user-id': 1,
'user-name': 'Tom',
};
```
@category Template Literals
*/
export type KebabCasedProperties<Value> = DelimiterCasedProperties<Value, '-'>;
@@ -0,0 +1,43 @@
'use strict';
var $TypeError = require('es-errors/type');
var IsFixedLengthArrayBuffer = require('./IsFixedLengthArrayBuffer');
var IsTypedArrayOutOfBounds = require('./IsTypedArrayOutOfBounds');
var TypedArrayElementSize = require('./TypedArrayElementSize');
var TypedArrayLength = require('./TypedArrayLength');
var isTypedArrayWithBufferWitnessRecord = require('../helpers/records/typed-array-with-buffer-witness-record');
var typedArrayByffer = require('typed-array-buffer');
var typedArrayByteLength = require('typed-array-byte-length');
// https://262.ecma-international.org/15.0/#sec-typedarraybytelength
module.exports = function TypedArrayByteLength(taRecord) {
if (!isTypedArrayWithBufferWitnessRecord(taRecord)) {
throw new $TypeError('Assertion failed: `taRecord` must be a TypedArray With Buffer Witness Record');
}
if (IsTypedArrayOutOfBounds(taRecord)) {
return 0; // step 1
}
var length = TypedArrayLength(taRecord); // step 2
if (length === 0) {
return 0; // step 3
}
var O = taRecord['[[Object]]']; // step 4
var isFixed = IsFixedLengthArrayBuffer(typedArrayByffer(O));
var byteLength = isFixed ? typedArrayByteLength(O) : 'AUTO';
if (byteLength !== 'AUTO') {
return byteLength; // step 5
}
var elementSize = TypedArrayElementSize(O); // step 6
return length * elementSize; // step 7
};
@@ -0,0 +1,13 @@
export default {
rules: {
'import-x/no-unresolved': 'error',
'import-x/named': 'error',
'import-x/namespace': 'error',
'import-x/default': 'error',
'import-x/export': 'error',
'import-x/no-named-as-default': 'warn',
'import-x/no-named-as-default-member': 'warn',
'import-x/no-duplicates': 'warn',
},
};
//# sourceMappingURL=recommended.js.map
@@ -0,0 +1,10 @@
"use client";
// src/base/table-body.tsx
import { TableBody as TableBodyBase } from "@react-stately/table";
var TableBody = TableBodyBase;
var table_body_default = TableBody;
export {
table_body_default
};
@@ -0,0 +1,103 @@
{
"root": true,
"globals": {
"Float16Array": "readonly",
},
"extends": "@ljharb",
"env": {
"es6": true,
},
"rules": {
"array-bracket-newline": 0,
"complexity": 0,
"eqeqeq": [2, "allow-null"],
"func-name-matching": 0,
"id-length": [2, { "min": 1, "max": 40 }],
"max-params": [2, 5],
"max-lines-per-function": 1,
"max-statements": 1,
"max-statements-per-line": [2, { "max": 2 }],
"multiline-comment-style": 0,
"no-implicit-coercion": [2, {
"boolean": false,
"number": false,
"string": true,
}],
"no-magic-numbers": 0,
"new-cap": 0,
"no-extra-parens": 1,
"sort-keys": 0,
},
"overrides": [
{
"files": "GetIntrinsic.js",
"rules": {
"max-statements": 0,
}
},
{
"files": "operations/*",
"rules": {
"max-lines": 0,
},
},
{
"files": [
"operations/deltas.js",
"operations/getOps.js",
"operations/spackle.js",
"operations/years.js",
],
"extends": "@ljharb/eslint-config/node/latest",
"rules": {
"complexity": 0,
"func-style": 0,
"max-lines-per-function": 0,
"max-nested-callbacks": 0,
"max-statements": 0,
"no-magic-numbers": 0,
"no-throw-literal": 0,
},
},
{
"files": "test/**",
"extends": "@ljharb/eslint-config/tests",
"rules": {
"max-len": 0,
"max-lines-per-function": 0,
"no-implicit-coercion": 0,
"no-invalid-this": 1,
"prefer-promise-reject-errors": 0,
},
},
{
"files": [
"*/Num*ToRawBytes.js",
"*/RawBytesToNum*.js",
"helpers/bytesAs*.js",
"helpers/valueToFloat*.js",
],
"rules": {
"max-lines-per-function": "off",
"max-statements": "off",
"no-redeclare": "warn",
"operator-linebreak": [2, "before", {
"overrides": {
"=": "none"
}
}],
},
},
{
"files": "./*/GetSubstitution.js",
"rules": {
"max-depth": "off",
},
},
],
}
@@ -0,0 +1,44 @@
/**
* Copyright (c) 2016 The xterm.js authors. All rights reserved.
* @license MIT
*/
interface INavigator {
userAgent: string;
language: string;
platform: string;
}
// We're declaring a navigator global here as we expect it in all runtimes (node and browser), but
// we want this module to live in common.
declare const navigator: INavigator;
declare const process: unknown;
export const isNode = (typeof process !== 'undefined' && 'title' in (process as any)) ? true : false;
const userAgent = (isNode) ? 'node' : navigator.userAgent;
const platform = (isNode) ? 'node' : navigator.platform;
export const isFirefox = userAgent.includes('Firefox');
export const isLegacyEdge = userAgent.includes('Edge');
export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
export function getSafariVersion(): number {
if (!isSafari) {
return 0;
}
const majorVersion = userAgent.match(/Version\/(\d+)/);
if (majorVersion === null || majorVersion.length < 2) {
return 0;
}
return parseInt(majorVersion[1]);
}
// Find the users platform. We use this to interpret the meta key
// and ISO third level shifts.
// http://stackoverflow.com/q/19877924/577598
export const isMac = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'].includes(platform);
export const isIpad = platform === 'iPad';
export const isIphone = platform === 'iPhone';
export const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].includes(platform);
export const isLinux = platform.indexOf('Linux') >= 0;
// Note that when this is true, isLinux will also be true.
export const isChromeOS = /\bCrOS\b/.test(userAgent);
@@ -0,0 +1,14 @@
import { GlobOptions } from './glob.js';
/**
* Return true if the patterns provided contain any magic glob characters,
* given the options provided.
*
* Brace expansion is not considered "magic" unless the `magicalBraces` option
* is set, as brace expansion just turns one string into an array of strings.
* So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
* `'xby'` both do not contain any magic glob characters, and it's treated the
* same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
* is in the options, brace expansion _is_ treated as a pattern having magic.
*/
export declare const hasMagic: (pattern: string | string[], options?: GlobOptions) => boolean;
//# sourceMappingURL=has-magic.d.ts.map
@@ -0,0 +1,46 @@
'use strict';
var $Map = typeof Map === 'function' && Map.prototype ? Map : null;
var $Set = typeof Set === 'function' && Set.prototype ? Set : null;
var exported;
if (!$Set) {
/** @type {import('.')} */
// eslint-disable-next-line no-unused-vars
exported = function isSet(x) {
// `Set` is not present in this environment.
return false;
};
}
var $mapHas = $Map ? Map.prototype.has : null;
var $setHas = $Set ? Set.prototype.has : null;
if (!exported && !$setHas) {
/** @type {import('.')} */
// eslint-disable-next-line no-unused-vars
exported = function isSet(x) {
// `Set` does not have a `has` method
return false;
};
}
/** @type {import('.')} */
module.exports = exported || function isSet(x) {
if (!x || typeof x !== 'object') {
return false;
}
try {
$setHas.call(x);
if ($mapHas) {
try {
$mapHas.call(x);
} catch (e) {
return true;
}
}
// @ts-expect-error TS can't figure out that $Set is always truthy here
return x instanceof $Set; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
};
@@ -0,0 +1 @@
{"version":3,"file":"named_default.int.spec.d.ts","sourceRoot":"","sources":["../../../../src/test/features/named_default.int.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.minimum = exports.gte = exports.gt = exports.maximum = exports.lte = exports.lt = void 0;
var index_js_1 = require("../core/index.cjs");
Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return index_js_1._lt; } });
Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return index_js_1._lte; } });
Object.defineProperty(exports, "maximum", { enumerable: true, get: function () { return index_js_1._lte; } });
Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return index_js_1._gt; } });
Object.defineProperty(exports, "gte", { enumerable: true, get: function () { return index_js_1._gte; } });
Object.defineProperty(exports, "minimum", { enumerable: true, get: function () { return index_js_1._gte; } });
Object.defineProperty(exports, "positive", { enumerable: true, get: function () { return index_js_1._positive; } });
Object.defineProperty(exports, "negative", { enumerable: true, get: function () { return index_js_1._negative; } });
Object.defineProperty(exports, "nonpositive", { enumerable: true, get: function () { return index_js_1._nonpositive; } });
Object.defineProperty(exports, "nonnegative", { enumerable: true, get: function () { return index_js_1._nonnegative; } });
Object.defineProperty(exports, "multipleOf", { enumerable: true, get: function () { return index_js_1._multipleOf; } });
Object.defineProperty(exports, "maxSize", { enumerable: true, get: function () { return index_js_1._maxSize; } });
Object.defineProperty(exports, "minSize", { enumerable: true, get: function () { return index_js_1._minSize; } });
Object.defineProperty(exports, "size", { enumerable: true, get: function () { return index_js_1._size; } });
Object.defineProperty(exports, "maxLength", { enumerable: true, get: function () { return index_js_1._maxLength; } });
Object.defineProperty(exports, "minLength", { enumerable: true, get: function () { return index_js_1._minLength; } });
Object.defineProperty(exports, "length", { enumerable: true, get: function () { return index_js_1._length; } });
Object.defineProperty(exports, "regex", { enumerable: true, get: function () { return index_js_1._regex; } });
Object.defineProperty(exports, "lowercase", { enumerable: true, get: function () { return index_js_1._lowercase; } });
Object.defineProperty(exports, "uppercase", { enumerable: true, get: function () { return index_js_1._uppercase; } });
Object.defineProperty(exports, "includes", { enumerable: true, get: function () { return index_js_1._includes; } });
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return index_js_1._startsWith; } });
Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return index_js_1._endsWith; } });
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return index_js_1._property; } });
Object.defineProperty(exports, "mime", { enumerable: true, get: function () { return index_js_1._mime; } });
Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return index_js_1._overwrite; } });
Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return index_js_1._normalize; } });
Object.defineProperty(exports, "trim", { enumerable: true, get: function () { return index_js_1._trim; } });
Object.defineProperty(exports, "toLowerCase", { enumerable: true, get: function () { return index_js_1._toLowerCase; } });
Object.defineProperty(exports, "toUpperCase", { enumerable: true, get: function () { return index_js_1._toUpperCase; } });
@@ -0,0 +1,17 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-flat-configs.js" script.
*/
"use strict"
module.exports = {
plugins: {
get "es-x"() {
return require("../../index.js")
},
},
rules: {
"es-x/no-intl-segmenter": "error",
"es-x/no-intl-supportedvaluesof": "error",
},
}
@@ -0,0 +1,19 @@
Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
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,95 @@
import { ParentBlot } from 'parchment';
import Module from '../core/module.js';
import Quill from '../core/quill.js';
const isMac = /Mac/i.test(navigator.platform);
// Export for testing
export const TTL_FOR_VALID_SELECTION_CHANGE = 100;
// A loose check to determine if the shortcut can move the caret before a UI node:
// <ANY_PARENT>[CARET]<div class="ql-ui"></div>[CONTENT]</ANY_PARENT>
const canMoveCaretBeforeUINode = event => {
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight' ||
// RTL scripts or moving from the end of the previous line
event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'Home') {
return true;
}
if (isMac && event.key === 'a' && event.ctrlKey === true) {
return true;
}
return false;
};
class UINode extends Module {
isListening = false;
selectionChangeDeadline = 0;
constructor(quill, options) {
super(quill, options);
this.handleArrowKeys();
this.handleNavigationShortcuts();
}
handleArrowKeys() {
this.quill.keyboard.addBinding({
key: ['ArrowLeft', 'ArrowRight'],
offset: 0,
shiftKey: null,
handler(range, _ref) {
let {
line,
event
} = _ref;
if (!(line instanceof ParentBlot) || !line.uiNode) {
return true;
}
const isRTL = getComputedStyle(line.domNode)['direction'] === 'rtl';
if (isRTL && event.key !== 'ArrowRight' || !isRTL && event.key !== 'ArrowLeft') {
return true;
}
this.quill.setSelection(range.index - 1, range.length + (event.shiftKey ? 1 : 0), Quill.sources.USER);
return false;
}
});
}
handleNavigationShortcuts() {
this.quill.root.addEventListener('keydown', event => {
if (!event.defaultPrevented && canMoveCaretBeforeUINode(event)) {
this.ensureListeningToSelectionChange();
}
});
}
/**
* We only listen to the `selectionchange` event when
* there is an intention of moving the caret to the beginning using shortcuts.
* This is primarily implemented to prevent infinite loops, as we are changing
* the selection within the handler of a `selectionchange` event.
*/
ensureListeningToSelectionChange() {
this.selectionChangeDeadline = Date.now() + TTL_FOR_VALID_SELECTION_CHANGE;
if (this.isListening) return;
this.isListening = true;
const listener = () => {
this.isListening = false;
if (Date.now() <= this.selectionChangeDeadline) {
this.handleSelectionChange();
}
};
document.addEventListener('selectionchange', listener, {
once: true
});
}
handleSelectionChange() {
const selection = document.getSelection();
if (!selection) return;
const range = selection.getRangeAt(0);
if (range.collapsed !== true || range.startOffset !== 0) return;
const line = this.quill.scroll.find(range.startContainer);
if (!(line instanceof ParentBlot) || !line.uiNode) return;
const newRange = document.createRange();
newRange.setStartAfter(line.uiNode);
newRange.setEndAfter(line.uiNode);
selection.removeAllRanges();
selection.addRange(newRange);
}
}
export default UINode;
//# sourceMappingURL=uiNode.js.map
@@ -0,0 +1,50 @@
import {CamelCase} from './camel-case';
/**
Convert object properties to camel case recursively.
This can be useful when, for example, converting some API types from a different style.
@see CamelCasedProperties
@see CamelCase
@example
```
interface User {
UserId: number;
UserName: string;
}
interface UserWithFriends {
UserInfo: User;
UserFriends: User[];
}
const result: CamelCasedPropertiesDeep<UserWithFriends> = {
userInfo: {
userId: 1,
userName: 'Tom',
},
userFriends: [
{
userId: 2,
userName: 'Jerry',
},
{
userId: 3,
userName: 'Spike',
},
],
};
```
@category Template Literals
*/
export type CamelCasedPropertiesDeep<Value> = Value extends Function
? Value
: Value extends Array<infer U>
? Array<CamelCasedPropertiesDeep<U>>
: Value extends Set<infer U>
? Set<CamelCasedPropertiesDeep<U>> : {
[K in keyof Value as CamelCase<K>]: CamelCasedPropertiesDeep<Value[K]>;
};
@@ -0,0 +1,7 @@
import { ForceFetchClientKeyRetType } from './common';
export interface NodeIKernelTicketService {
addKernelTicketListener(listener: unknown): number;
removeKernelTicketListener(listenerId: number): void;
forceFetchClientKey(arg: string): Promise<ForceFetchClientKeyRetType>;
isNull(): boolean;
}
@@ -0,0 +1,166 @@
"use client";
import { jsx, Fragment } from 'react/jsx-runtime';
import { useMemo, useRef, useState, useContext } from 'react';
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
import { useConstant } from '../../utils/use-constant.mjs';
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
import { PresenceChild } from './PresenceChild.mjs';
import { usePresence } from './use-presence.mjs';
import { onlyElements, getChildKey } from './utils.mjs';
/**
* `AnimatePresence` enables the animation of components that have been removed from the tree.
*
* When adding/removing more than a single child, every child **must** be given a unique `key` prop.
*
* Any `motion` components that have an `exit` property defined will animate out when removed from
* the tree.
*
* ```jsx
* import { motion, AnimatePresence } from 'framer-motion'
*
* export const Items = ({ items }) => (
* <AnimatePresence>
* {items.map(item => (
* <motion.div
* key={item.id}
* initial={{ opacity: 0 }}
* animate={{ opacity: 1 }}
* exit={{ opacity: 0 }}
* />
* ))}
* </AnimatePresence>
* )
* ```
*
* You can sequence exit animations throughout a tree using variants.
*
* If a child contains multiple `motion` components with `exit` props, it will only unmount the child
* once all `motion` components have finished animating out. Likewise, any components using
* `usePresence` all need to call `safeToRemove`.
*
* @public
*/
const AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left", root }) => {
const [isParentPresent, safeToRemove] = usePresence(propagate);
/**
* Filter any children that aren't ReactElements. We can only track components
* between renders with a props.key.
*/
const presentChildren = useMemo(() => onlyElements(children), [children]);
/**
* Track the keys of the currently rendered children. This is used to
* determine which children are exiting.
*/
const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);
/**
* If `initial={false}` we only want to pass this to components in the first render.
*/
const isInitialRender = useRef(true);
/**
* A ref containing the currently present children. When all exit animations
* are complete, we use this to re-render the component with the latest children
* *committed* rather than the latest children *rendered*.
*/
const pendingPresentChildren = useRef(presentChildren);
/**
* Track which exiting children have finished animating out.
*/
const exitComplete = useConstant(() => new Map());
/**
* Save children to render as React state. To ensure this component is concurrent-safe,
* we check for exiting children via an effect.
*/
const [diffedChildren, setDiffedChildren] = useState(presentChildren);
const [renderedChildren, setRenderedChildren] = useState(presentChildren);
useIsomorphicLayoutEffect(() => {
isInitialRender.current = false;
pendingPresentChildren.current = presentChildren;
/**
* Update complete status of exiting children.
*/
for (let i = 0; i < renderedChildren.length; i++) {
const key = getChildKey(renderedChildren[i]);
if (!presentKeys.includes(key)) {
if (exitComplete.get(key) !== true) {
exitComplete.set(key, false);
}
}
else {
exitComplete.delete(key);
}
}
}, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
const exitingChildren = [];
if (presentChildren !== diffedChildren) {
let nextChildren = [...presentChildren];
/**
* Loop through all the currently rendered components and decide which
* are exiting.
*/
for (let i = 0; i < renderedChildren.length; i++) {
const child = renderedChildren[i];
const key = getChildKey(child);
if (!presentKeys.includes(key)) {
nextChildren.splice(i, 0, child);
exitingChildren.push(child);
}
}
/**
* If we're in "wait" mode, and we have exiting children, we want to
* only render these until they've all exited.
*/
if (mode === "wait" && exitingChildren.length) {
nextChildren = exitingChildren;
}
setRenderedChildren(onlyElements(nextChildren));
setDiffedChildren(presentChildren);
/**
* Early return to ensure once we've set state with the latest diffed
* children, we can immediately re-render.
*/
return null;
}
if (process.env.NODE_ENV !== "production" &&
mode === "wait" &&
renderedChildren.length > 1) {
console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
}
/**
* If we've been provided a forceRender function by the LayoutGroupContext,
* we can use it to force a re-render amongst all surrounding components once
* all components have finished animating out.
*/
const { forceRender } = useContext(LayoutGroupContext);
return (jsx(Fragment, { children: renderedChildren.map((child) => {
const key = getChildKey(child);
const isPresent = propagate && !isParentPresent
? false
: presentChildren === renderedChildren ||
presentKeys.includes(key);
const onExit = () => {
if (exitComplete.has(key)) {
exitComplete.set(key, true);
}
else {
return;
}
let isEveryExitComplete = true;
exitComplete.forEach((isExitComplete) => {
if (!isExitComplete)
isEveryExitComplete = false;
});
if (isEveryExitComplete) {
forceRender?.();
setRenderedChildren(pendingPresentChildren.current);
propagate && safeToRemove?.();
onExitComplete && onExitComplete();
}
};
return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial
? undefined
: false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, children: child }, key));
}) }));
};
export { AnimatePresence };
@@ -0,0 +1,28 @@
var baseGetTag = require('./_baseGetTag'),
isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var weakSetTag = '[object WeakSet]';
/**
* Checks if `value` is classified as a `WeakSet` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
* @example
*
* _.isWeakSet(new WeakSet);
* // => true
*
* _.isWeakSet(new Set);
* // => false
*/
function isWeakSet(value) {
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
}
module.exports = isWeakSet;
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AAEH,yCANW,KAAK,CAAC,KAAK,CAAC,GAEV,OAAO,CAuHnB;;2BAvIqC,sBAAsB"}
@@ -0,0 +1,850 @@
/**
* @fileoverview Restrict usage of specified node imports.
* @author Guy Ellis
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
const ignore = require("ignore");
const arrayOfStringsOrObjects = {
type: "array",
items: {
anyOf: [
{ type: "string" },
{
type: "object",
properties: {
name: { type: "string" },
message: {
type: "string",
minLength: 1,
},
importNames: {
type: "array",
items: {
type: "string",
},
},
allowImportNames: {
type: "array",
items: {
type: "string",
},
},
allowTypeImports: {
type: "boolean",
description:
"Whether to allow type-only imports for a path.",
},
},
additionalProperties: false,
required: ["name"],
not: { required: ["importNames", "allowImportNames"] },
},
],
},
uniqueItems: true,
};
const arrayOfStringsOrObjectPatterns = {
anyOf: [
{
type: "array",
items: {
type: "string",
},
uniqueItems: true,
},
{
type: "array",
items: {
type: "object",
properties: {
importNames: {
type: "array",
items: {
type: "string",
},
minItems: 1,
uniqueItems: true,
},
allowImportNames: {
type: "array",
items: {
type: "string",
},
minItems: 1,
uniqueItems: true,
},
group: {
type: "array",
items: {
type: "string",
},
minItems: 1,
uniqueItems: true,
},
regex: {
type: "string",
},
importNamePattern: {
type: "string",
},
allowImportNamePattern: {
type: "string",
},
message: {
type: "string",
minLength: 1,
},
caseSensitive: {
type: "boolean",
},
allowTypeImports: {
type: "boolean",
description:
"Whether to allow type-only imports for a pattern.",
},
},
additionalProperties: false,
not: {
anyOf: [
{ required: ["importNames", "allowImportNames"] },
{
required: [
"importNamePattern",
"allowImportNamePattern",
],
},
{ required: ["importNames", "allowImportNamePattern"] },
{ required: ["importNamePattern", "allowImportNames"] },
{
required: [
"allowImportNames",
"allowImportNamePattern",
],
},
],
},
oneOf: [{ required: ["group"] }, { required: ["regex"] }],
},
uniqueItems: true,
},
],
};
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
dialects: ["typescript", "javascript"],
language: "javascript",
docs: {
description: "Disallow specified modules when loaded by `import`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-restricted-imports",
},
messages: {
path: "'{{importSource}}' import is restricted from being used.",
pathWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"'{{importSource}}' import is restricted from being used. {{customMessage}}",
patterns:
"'{{importSource}}' import is restricted from being used by a pattern.",
patternWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}",
patternAndImportName:
"'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern.",
patternAndImportNameWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}",
patternAndEverything:
"* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern.",
patternAndEverythingWithRegexImportName:
"* import is invalid because import name matching '{{importNames}}' pattern from '{{importSource}}' is restricted from being used.",
patternAndEverythingWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}",
patternAndEverythingWithRegexImportNameAndCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"* import is invalid because import name matching '{{importNames}}' pattern from '{{importSource}}' is restricted from being used. {{customMessage}}",
everything:
"* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.",
everythingWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}",
importName:
"'{{importName}}' import from '{{importSource}}' is restricted.",
importNameWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"'{{importName}}' import from '{{importSource}}' is restricted. {{customMessage}}",
allowedImportName:
"'{{importName}}' import from '{{importSource}}' is restricted because only '{{allowedImportNames}}' import(s) is/are allowed.",
allowedImportNameWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"'{{importName}}' import from '{{importSource}}' is restricted because only '{{allowedImportNames}}' import(s) is/are allowed. {{customMessage}}",
everythingWithAllowImportNames:
"* import is invalid because only '{{allowedImportNames}}' from '{{importSource}}' is/are allowed.",
everythingWithAllowImportNamesAndCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"* import is invalid because only '{{allowedImportNames}}' from '{{importSource}}' is/are allowed. {{customMessage}}",
allowedImportNamePattern:
"'{{importName}}' import from '{{importSource}}' is restricted because only imports that match the pattern '{{allowedImportNamePattern}}' are allowed from '{{importSource}}'.",
allowedImportNamePatternWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"'{{importName}}' import from '{{importSource}}' is restricted because only imports that match the pattern '{{allowedImportNamePattern}}' are allowed from '{{importSource}}'. {{customMessage}}",
everythingWithAllowedImportNamePattern:
"* import is invalid because only imports that match the pattern '{{allowedImportNamePattern}}' from '{{importSource}}' are allowed.",
everythingWithAllowedImportNamePatternWithCustomMessage:
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
"* import is invalid because only imports that match the pattern '{{allowedImportNamePattern}}' from '{{importSource}}' are allowed. {{customMessage}}",
},
schema: {
anyOf: [
arrayOfStringsOrObjects,
{
type: "array",
items: [
{
type: "object",
properties: {
paths: arrayOfStringsOrObjects,
patterns: arrayOfStringsOrObjectPatterns,
},
additionalProperties: false,
},
],
additionalItems: false,
},
],
},
},
create(context) {
const sourceCode = context.sourceCode;
const options = Array.isArray(context.options) ? context.options : [];
const isPathAndPatternsObject =
typeof options[0] === "object" &&
(Object.hasOwn(options[0], "paths") ||
Object.hasOwn(options[0], "patterns"));
const restrictedPaths =
(isPathAndPatternsObject ? options[0].paths : context.options) ||
[];
const groupedRestrictedPaths = restrictedPaths.reduce(
(memo, importSource) => {
const path =
typeof importSource === "string"
? importSource
: importSource.name;
if (!memo[path]) {
memo[path] = [];
}
if (typeof importSource === "string") {
memo[path].push({});
} else {
memo[path].push({
message: importSource.message,
importNames: importSource.importNames,
allowImportNames: importSource.allowImportNames,
allowTypeImports: importSource.allowTypeImports,
});
}
return memo;
},
Object.create(null),
);
// Handle patterns too, either as strings or groups
let restrictedPatterns =
(isPathAndPatternsObject ? options[0].patterns : []) || [];
// standardize to array of objects if we have an array of strings
if (
restrictedPatterns.length > 0 &&
typeof restrictedPatterns[0] === "string"
) {
restrictedPatterns = [{ group: restrictedPatterns }];
}
// relative paths are supported for this rule
const restrictedPatternGroups = restrictedPatterns.map(
({
group,
regex,
message,
caseSensitive,
importNames,
importNamePattern,
allowImportNames,
allowImportNamePattern,
allowTypeImports,
}) => ({
...(group
? {
matcher: ignore({
allowRelativePaths: true,
ignorecase: !caseSensitive,
}).add(group),
}
: {}),
...(typeof regex === "string"
? {
regexMatcher: new RegExp(
regex,
caseSensitive ? "u" : "iu",
),
}
: {}),
customMessage: message,
importNames,
importNamePattern,
allowImportNames,
allowImportNamePattern,
allowTypeImports,
}),
);
// if no imports are restricted we don't need to check
if (
Object.keys(restrictedPaths).length === 0 &&
restrictedPatternGroups.length === 0
) {
return {};
}
/**
* Check if the node is a type-only import
* @param {ASTNode} node The node to check
* @returns {boolean} Whether the node is a type-only import
*/
function isTypeOnlyImport(node) {
return (
node.importKind === "type" ||
(node.specifiers?.length > 0 &&
node.specifiers.every(
specifier => specifier.importKind === "type",
))
);
}
/**
* Check if a specifier is type-only
* @param {ASTNode} specifier The specifier to check
* @returns {boolean} Whether the specifier is type-only
*/
function isTypeOnlySpecifier(specifier) {
return (
specifier.importKind === "type" ||
specifier.exportKind === "type"
);
}
/**
* Check if the node is a type-only export
* @param {ASTNode} node The node to check
* @returns {boolean} Whether the node is a type-only export
*/
function isTypeOnlyExport(node) {
return (
node.exportKind === "type" ||
(node.specifiers?.length > 0 &&
node.specifiers.every(
specifier => specifier.exportKind === "type",
))
);
}
/**
* Report a restricted path.
* @param {string} importSource path of the import
* @param {Map<string,Object[]>} importNames Map of import names that are being imported
* @param {node} node representing the restricted path reference
* @returns {void}
* @private
*/
function checkRestrictedPathAndReport(importSource, importNames, node) {
if (!Object.hasOwn(groupedRestrictedPaths, importSource)) {
return;
}
groupedRestrictedPaths[importSource].forEach(
restrictedPathEntry => {
const customMessage = restrictedPathEntry.message;
const restrictedImportNames =
restrictedPathEntry.importNames;
const allowedImportNames =
restrictedPathEntry.allowImportNames;
const allowTypeImports =
restrictedPathEntry.allowTypeImports;
// Skip if this is a type-only import and it's allowed for this specific entry
if (
allowTypeImports &&
(node.type === "ImportDeclaration" ||
node.type === "TSImportEqualsDeclaration") &&
isTypeOnlyImport(node)
) {
return;
}
// Skip if this is a type-only export and it's allowed for this specific entry
if (
allowTypeImports &&
(node.type === "ExportNamedDeclaration" ||
node.type === "ExportAllDeclaration") &&
isTypeOnlyExport(node)
) {
return;
}
if (!restrictedImportNames && !allowedImportNames) {
context.report({
node,
messageId: customMessage
? "pathWithCustomMessage"
: "path",
data: {
importSource,
customMessage,
},
});
return;
}
importNames.forEach((specifiers, importName) => {
if (importName === "*") {
const [specifier] = specifiers;
if (restrictedImportNames) {
context.report({
node,
messageId: customMessage
? "everythingWithCustomMessage"
: "everything",
loc: specifier.loc,
data: {
importSource,
importNames: restrictedImportNames,
customMessage,
},
});
} else if (allowedImportNames) {
context.report({
node,
messageId: customMessage
? "everythingWithAllowImportNamesAndCustomMessage"
: "everythingWithAllowImportNames",
loc: specifier.loc,
data: {
importSource,
allowedImportNames,
customMessage,
},
});
}
return;
}
if (
restrictedImportNames &&
restrictedImportNames.includes(importName)
) {
specifiers.forEach(specifier => {
// Skip if this is a type-only import specifier and type imports are allowed
if (
allowTypeImports &&
isTypeOnlySpecifier(specifier.specifier)
) {
return;
}
context.report({
node,
messageId: customMessage
? "importNameWithCustomMessage"
: "importName",
loc: specifier.loc,
data: {
importSource,
customMessage,
importName,
},
});
});
}
if (
allowedImportNames &&
!allowedImportNames.includes(importName)
) {
specifiers.forEach(specifier => {
// Skip if this is a type-only import specifier and type imports are allowed
if (
allowTypeImports &&
isTypeOnlySpecifier(specifier.specifier)
) {
return;
}
context.report({
node,
loc: specifier.loc,
messageId: customMessage
? "allowedImportNameWithCustomMessage"
: "allowedImportName",
data: {
importSource,
customMessage,
importName,
allowedImportNames,
},
});
});
}
});
},
);
}
/**
* Report a restricted path specifically for patterns.
* @param {node} node representing the restricted path reference
* @param {Object} group contains an Ignore instance for paths, the customMessage to show on failure,
* and any restricted import names that have been specified in the config
* @param {Map<string,Object[]>} importNames Map of import names that are being imported
* @param {string} importSource the import source string
* @returns {void}
* @private
*/
function reportPathForPatterns(node, group, importNames, importSource) {
// Skip if this is a type-only import and it's allowed
if (
group.allowTypeImports &&
(node.type === "ImportDeclaration" ||
node.type === "TSImportEqualsDeclaration") &&
isTypeOnlyImport(node)
) {
return;
}
// Skip if this is a type-only export and it's allowed
if (
group.allowTypeImports &&
(node.type === "ExportNamedDeclaration" ||
node.type === "ExportAllDeclaration") &&
isTypeOnlyExport(node)
) {
return;
}
const customMessage = group.customMessage;
const restrictedImportNames = group.importNames;
const restrictedImportNamePattern = group.importNamePattern
? new RegExp(group.importNamePattern, "u")
: null;
const allowedImportNames = group.allowImportNames;
const allowedImportNamePattern = group.allowImportNamePattern
? new RegExp(group.allowImportNamePattern, "u")
: null;
/**
* If we are not restricting to any specific import names and just the pattern itself,
* report the error and move on
*/
if (
!restrictedImportNames &&
!allowedImportNames &&
!restrictedImportNamePattern &&
!allowedImportNamePattern
) {
context.report({
node,
messageId: customMessage
? "patternWithCustomMessage"
: "patterns",
data: {
importSource,
customMessage,
},
});
return;
}
importNames.forEach((specifiers, importName) => {
if (importName === "*") {
const [specifier] = specifiers;
if (restrictedImportNames) {
context.report({
node,
messageId: customMessage
? "patternAndEverythingWithCustomMessage"
: "patternAndEverything",
loc: specifier.loc,
data: {
importSource,
importNames: restrictedImportNames,
customMessage,
},
});
} else if (allowedImportNames) {
context.report({
node,
messageId: customMessage
? "everythingWithAllowImportNamesAndCustomMessage"
: "everythingWithAllowImportNames",
loc: specifier.loc,
data: {
importSource,
allowedImportNames,
customMessage,
},
});
} else if (allowedImportNamePattern) {
context.report({
node,
messageId: customMessage
? "everythingWithAllowedImportNamePatternWithCustomMessage"
: "everythingWithAllowedImportNamePattern",
loc: specifier.loc,
data: {
importSource,
allowedImportNamePattern,
customMessage,
},
});
} else {
context.report({
node,
messageId: customMessage
? "patternAndEverythingWithRegexImportNameAndCustomMessage"
: "patternAndEverythingWithRegexImportName",
loc: specifier.loc,
data: {
importSource,
importNames: restrictedImportNamePattern,
customMessage,
},
});
}
return;
}
if (
(restrictedImportNames &&
restrictedImportNames.includes(importName)) ||
(restrictedImportNamePattern &&
restrictedImportNamePattern.test(importName))
) {
specifiers.forEach(specifier => {
// Skip if this is a type-only import specifier and type imports are allowed
if (
group.allowTypeImports &&
isTypeOnlySpecifier(specifier.specifier)
) {
return;
}
context.report({
node,
messageId: customMessage
? "patternAndImportNameWithCustomMessage"
: "patternAndImportName",
loc: specifier.loc,
data: {
importSource,
customMessage,
importName,
},
});
});
}
if (
allowedImportNames &&
!allowedImportNames.includes(importName)
) {
specifiers.forEach(specifier => {
// Skip if this is a type-only import specifier and type imports are allowed
if (
group.allowTypeImports &&
isTypeOnlySpecifier(specifier.specifier)
) {
return;
}
context.report({
node,
messageId: customMessage
? "allowedImportNameWithCustomMessage"
: "allowedImportName",
loc: specifier.loc,
data: {
importSource,
customMessage,
importName,
allowedImportNames,
},
});
});
} else if (
allowedImportNamePattern &&
!allowedImportNamePattern.test(importName)
) {
specifiers.forEach(specifier => {
// Skip if this is a type-only import specifier and type imports are allowed
if (
group.allowTypeImports &&
isTypeOnlySpecifier(specifier.specifier)
) {
return;
}
context.report({
node,
messageId: customMessage
? "allowedImportNamePatternWithCustomMessage"
: "allowedImportNamePattern",
loc: specifier.loc,
data: {
importSource,
customMessage,
importName,
allowedImportNamePattern,
},
});
});
}
});
}
/**
* Check if the given importSource is restricted by a pattern.
* @param {string} importSource path of the import
* @param {Object} group contains a Ignore instance for paths, and the customMessage to show if it fails
* @returns {boolean} whether the variable is a restricted pattern or not
* @private
*/
function isRestrictedPattern(importSource, group) {
return group.regexMatcher
? group.regexMatcher.test(importSource)
: group.matcher.ignores(importSource);
}
/**
* Checks a node to see if any problems should be reported.
* @param {ASTNode} node The node to check.
* @returns {void}
* @private
*/
function checkNode(node) {
const importSource = node.source.value.trim();
const importNames = new Map();
if (node.type === "ExportAllDeclaration") {
const starToken = sourceCode.getFirstToken(node, 1);
importNames.set("*", [{ loc: starToken.loc }]);
} else if (node.specifiers) {
for (const specifier of node.specifiers) {
let name;
const specifierData = { loc: specifier.loc, specifier };
if (specifier.type === "ImportDefaultSpecifier") {
name = "default";
} else if (specifier.type === "ImportNamespaceSpecifier") {
name = "*";
} else if (specifier.imported) {
name = astUtils.getModuleExportName(specifier.imported);
} else if (specifier.local) {
name = astUtils.getModuleExportName(specifier.local);
}
if (typeof name === "string") {
if (importNames.has(name)) {
importNames.get(name).push(specifierData);
} else {
importNames.set(name, [specifierData]);
}
}
}
}
checkRestrictedPathAndReport(importSource, importNames, node);
restrictedPatternGroups.forEach(group => {
if (isRestrictedPattern(importSource, group)) {
reportPathForPatterns(
node,
group,
importNames,
importSource,
);
}
});
}
return {
ImportDeclaration: checkNode,
ExportNamedDeclaration(node) {
if (node.source) {
checkNode(node);
}
},
ExportAllDeclaration: checkNode,
// Add support for TypeScript import equals declarations
TSImportEqualsDeclaration(node) {
if (node.moduleReference.type === "TSExternalModuleReference") {
const importSource = node.moduleReference.expression.value;
const importNames = new Map();
// Use existing logic with the actual node
checkRestrictedPathAndReport(
importSource,
importNames,
node,
);
restrictedPatternGroups.forEach(group => {
if (isRestrictedPattern(importSource, group)) {
reportPathForPatterns(
node,
group,
importNames,
importSource,
);
}
});
}
},
};
},
};
@@ -0,0 +1,64 @@
import { QueryStatus, STATUS_UNINITIALIZED } from '../apiState'
import type { QueryCacheKey } from '../apiState'
import { onFocus, onOnline } from '../setupListeners'
import type {
ApiMiddlewareInternalHandler,
InternalHandlerBuilder,
SubMiddlewareApi,
} from './types'
export const buildWindowEventHandler: InternalHandlerBuilder = ({
reducerPath,
context,
api,
refetchQuery,
internalState,
}) => {
const { removeQueryResult } = api.internalActions
const handler: ApiMiddlewareInternalHandler = (action, mwApi) => {
if (onFocus.match(action)) {
refetchValidQueries(mwApi, 'refetchOnFocus')
}
if (onOnline.match(action)) {
refetchValidQueries(mwApi, 'refetchOnReconnect')
}
}
function refetchValidQueries(
api: SubMiddlewareApi,
type: 'refetchOnFocus' | 'refetchOnReconnect',
) {
const state = api.getState()[reducerPath]
const queries = state.queries
const subscriptions = internalState.currentSubscriptions
context.batch(() => {
for (const queryCacheKey of subscriptions.keys()) {
const querySubState = queries[queryCacheKey]
const subscriptionSubState = subscriptions.get(queryCacheKey)
if (!subscriptionSubState || !querySubState) continue
const values = [...subscriptionSubState.values()]
const shouldRefetch =
values.some((sub) => sub[type] === true) ||
(values.every((sub) => sub[type] === undefined) && state.config[type])
if (shouldRefetch) {
if (subscriptionSubState.size === 0) {
api.dispatch(
removeQueryResult({
queryCacheKey: queryCacheKey as QueryCacheKey,
}),
)
} else if (querySubState.status !== STATUS_UNINITIALIZED) {
api.dispatch(refetchQuery(querySubState))
}
}
}
})
}
return handler
}
@@ -0,0 +1,258 @@
/**
* @fileoverview Prevent declaring unused methods and properties of component class
* @author Paweł Nowak, Berton Zhu
*/
'use strict';
const docsUrl = require('../util/docsUrl');
const componentUtil = require('../util/componentUtil');
const report = require('../util/report');
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
const LIFECYCLE_METHODS = new Set([
'constructor',
'componentDidCatch',
'componentDidMount',
'componentDidUpdate',
'componentWillMount',
'componentWillReceiveProps',
'componentWillUnmount',
'componentWillUpdate',
'getChildContext',
'getSnapshotBeforeUpdate',
'render',
'shouldComponentUpdate',
'UNSAFE_componentWillMount',
'UNSAFE_componentWillReceiveProps',
'UNSAFE_componentWillUpdate',
]);
const ES6_LIFECYCLE = new Set([
'state',
]);
const ES5_LIFECYCLE = new Set([
'getInitialState',
'getDefaultProps',
'mixins',
]);
function isKeyLiteralLike(node, property) {
return property.type === 'Literal'
|| (property.type === 'TemplateLiteral' && property.expressions.length === 0)
|| (node.computed === false && property.type === 'Identifier');
}
// Descend through all wrapping TypeCastExpressions and return the expression
// that was cast.
function uncast(node) {
while (node.type === 'TypeCastExpression') {
node = node.expression;
}
return node;
}
// Return the name of an identifier or the string value of a literal. Useful
// anywhere that a literal may be used as a key (e.g., member expressions,
// method definitions, ObjectExpression property keys).
function getName(node) {
node = uncast(node);
const type = node.type;
if (type === 'Identifier') {
return node.name;
}
if (type === 'Literal') {
return String(node.value);
}
if (type === 'TemplateLiteral' && node.expressions.length === 0) {
return node.quasis[0].value.raw;
}
return null;
}
function isThisExpression(node) {
return uncast(node).type === 'ThisExpression';
}
function getInitialClassInfo(node, isClass) {
return {
classNode: node,
isClass,
// Set of nodes where properties were defined.
properties: new Set(),
// Set of names of properties that we've seen used.
usedProperties: new Set(),
inStatic: false,
};
}
const messages = {
unused: 'Unused method or property "{{name}}"',
unusedWithClass: 'Unused method or property "{{name}}" of class "{{className}}"',
};
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
description: 'Disallow declaring unused methods of component class',
category: 'Best Practices',
recommended: false,
url: docsUrl('no-unused-class-component-methods'),
},
messages,
schema: [],
},
create: ((context) => {
let classInfo = null;
// Takes an ObjectExpression node and adds all named Property nodes to the
// current set of properties.
function addProperty(node) {
classInfo.properties.add(node);
}
// Adds the name of the given node as a used property if the node is an
// Identifier or a Literal. Other node types are ignored.
function addUsedProperty(node) {
const name = getName(node);
if (name) {
classInfo.usedProperties.add(name);
}
}
function reportUnusedProperties() {
// Report all unused properties.
for (const node of classInfo.properties) { // eslint-disable-line no-restricted-syntax
const name = getName(node);
if (
!classInfo.usedProperties.has(name)
&& !LIFECYCLE_METHODS.has(name)
&& (classInfo.isClass ? !ES6_LIFECYCLE.has(name) : !ES5_LIFECYCLE.has(name))
) {
const className = (classInfo.classNode.id && classInfo.classNode.id.name) || '';
const messageID = className ? 'unusedWithClass' : 'unused';
report(
context,
messages[messageID],
messageID,
{
node,
data: {
name,
className,
},
}
);
}
}
}
function exitMethod() {
if (!classInfo || !classInfo.inStatic) {
return;
}
classInfo.inStatic = false;
}
return {
ClassDeclaration(node) {
if (componentUtil.isES6Component(node, context)) {
classInfo = getInitialClassInfo(node, true);
}
},
ObjectExpression(node) {
if (componentUtil.isES5Component(node, context)) {
classInfo = getInitialClassInfo(node, false);
}
},
'ClassDeclaration:exit'() {
if (!classInfo) {
return;
}
reportUnusedProperties();
classInfo = null;
},
'ObjectExpression:exit'(node) {
if (!classInfo || classInfo.classNode !== node) {
return;
}
reportUnusedProperties();
classInfo = null;
},
Property(node) {
if (!classInfo || classInfo.classNode !== node.parent) {
return;
}
if (isKeyLiteralLike(node, node.key)) {
addProperty(node.key);
}
},
'ClassProperty, MethodDefinition, PropertyDefinition'(node) {
if (!classInfo) {
return;
}
if (node.static) {
classInfo.inStatic = true;
return;
}
if (isKeyLiteralLike(node, node.key)) {
addProperty(node.key);
}
},
'ClassProperty:exit': exitMethod,
'MethodDefinition:exit': exitMethod,
'PropertyDefinition:exit': exitMethod,
MemberExpression(node) {
if (!classInfo || classInfo.inStatic) {
return;
}
if (isThisExpression(node.object) && isKeyLiteralLike(node, node.property)) {
if (node.parent.type === 'AssignmentExpression' && node.parent.left === node) {
// detect `this.property = xxx`
addProperty(node.property);
} else {
// detect `this.property()`, `x = this.property`, etc.
addUsedProperty(node.property);
}
}
},
VariableDeclarator(node) {
if (!classInfo || classInfo.inStatic) {
return;
}
// detect `{ foo, bar: baz } = this`
if (node.init && isThisExpression(node.init) && node.id.type === 'ObjectPattern') {
node.id.properties
.filter((prop) => prop.type === 'Property' && isKeyLiteralLike(prop, prop.key))
.forEach((prop) => {
addUsedProperty('key' in prop ? prop.key : undefined);
});
}
},
};
}),
};
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more