docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s

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

No files matched your search

@@ -0,0 +1,4 @@
# Names sorted by how much code was originally theirs.
Isaac Z. Schlueter <i@izs.me>
Meryn Stol <merynstol@gmail.com>
Robert Kowalski <rok@kowalski.gd>
@@ -0,0 +1,14 @@
exports.noPrebuilts = function (opts) {
return new Error([
'No prebuilt binaries found',
'(target=' + opts.target,
'runtime=' + opts.runtime,
'arch=' + opts.arch,
'libc=' + opts.libc,
'platform=' + opts.platform + ')'
].join(' '))
}
exports.invalidArchive = function () {
return new Error('Missing .node file in archive')
}
@@ -0,0 +1,399 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo;
exports._resolve = _resolve;
exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression;
exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement;
exports.getSource = getSource;
exports.isCompletionRecord = isCompletionRecord;
exports.isConstantExpression = isConstantExpression;
exports.isInStrictMode = isInStrictMode;
exports.isNodeType = isNodeType;
exports.isStatementOrBlock = isStatementOrBlock;
exports.isStatic = isStatic;
exports.matchesPattern = matchesPattern;
exports.referencesImport = referencesImport;
exports.resolve = resolve;
exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore;
var _t = require("@babel/types");
const {
STATEMENT_OR_BLOCK_KEYS,
VISITOR_KEYS,
isBlockStatement,
isExpression,
isIdentifier,
isLiteral,
isStringLiteral,
isType,
matchesPattern: _matchesPattern
} = _t;
function matchesPattern(pattern, allowPartial) {
return _matchesPattern(this.node, pattern, allowPartial);
}
{
exports.has = function has(key) {
var _this$node;
const val = (_this$node = this.node) == null ? void 0 : _this$node[key];
if (val && Array.isArray(val)) {
return !!val.length;
} else {
return !!val;
}
};
}
function isStatic() {
return this.scope.isStatic(this.node);
}
{
exports.is = exports.has;
exports.isnt = function isnt(key) {
return !this.has(key);
};
exports.equals = function equals(key, value) {
return this.node[key] === value;
};
}
function isNodeType(type) {
return isType(this.type, type);
}
function canHaveVariableDeclarationOrExpression() {
return (this.key === "init" || this.key === "left") && this.parentPath.isFor();
}
function canSwapBetweenExpressionAndStatement(replacement) {
if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) {
return false;
}
if (this.isExpression()) {
return isBlockStatement(replacement);
} else if (this.isBlockStatement()) {
return isExpression(replacement);
}
return false;
}
function isCompletionRecord(allowInsideFunction) {
let path = this;
let first = true;
do {
const {
type,
container
} = path;
if (!first && (path.isFunction() || type === "StaticBlock")) {
return !!allowInsideFunction;
}
first = false;
if (Array.isArray(container) && path.key !== container.length - 1) {
return false;
}
} while ((path = path.parentPath) && !path.isProgram() && !path.isDoExpression());
return true;
}
function isStatementOrBlock() {
if (this.parentPath.isLabeledStatement() || isBlockStatement(this.container)) {
return false;
} else {
return STATEMENT_OR_BLOCK_KEYS.includes(this.key);
}
}
function referencesImport(moduleSource, importName) {
if (!this.isReferencedIdentifier()) {
if (this.isJSXMemberExpression() && this.node.property.name === importName || (this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? isStringLiteral(this.node.property, {
value: importName
}) : this.node.property.name === importName)) {
const object = this.get("object");
return object.isReferencedIdentifier() && object.referencesImport(moduleSource, "*");
}
return false;
}
const binding = this.scope.getBinding(this.node.name);
if (!binding || binding.kind !== "module") return false;
const path = binding.path;
const parent = path.parentPath;
if (!parent.isImportDeclaration()) return false;
if (parent.node.source.value === moduleSource) {
if (!importName) return true;
} else {
return false;
}
if (path.isImportDefaultSpecifier() && importName === "default") {
return true;
}
if (path.isImportNamespaceSpecifier() && importName === "*") {
return true;
}
if (path.isImportSpecifier() && isIdentifier(path.node.imported, {
name: importName
})) {
return true;
}
return false;
}
function getSource() {
const node = this.node;
if (node.end) {
const code = this.hub.getCode();
if (code) return code.slice(node.start, node.end);
}
return "";
}
function willIMaybeExecuteBefore(target) {
return this._guessExecutionStatusRelativeTo(target) !== "after";
}
function getOuterFunction(path) {
return path.isProgram() ? path : (path.parentPath.scope.getFunctionParent() || path.parentPath.scope.getProgramParent()).path;
}
function isExecutionUncertain(type, key) {
switch (type) {
case "LogicalExpression":
return key === "right";
case "ConditionalExpression":
case "IfStatement":
return key === "consequent" || key === "alternate";
case "WhileStatement":
case "DoWhileStatement":
case "ForInStatement":
case "ForOfStatement":
return key === "body";
case "ForStatement":
return key === "body" || key === "update";
case "SwitchStatement":
return key === "cases";
case "TryStatement":
return key === "handler";
case "AssignmentPattern":
return key === "right";
case "OptionalMemberExpression":
return key === "property";
case "OptionalCallExpression":
return key === "arguments";
default:
return false;
}
}
function isExecutionUncertainInList(paths, maxIndex) {
for (let i = 0; i < maxIndex; i++) {
const path = paths[i];
if (isExecutionUncertain(path.parent.type, path.parentKey)) {
return true;
}
}
return false;
}
const SYMBOL_CHECKING = Symbol();
function _guessExecutionStatusRelativeTo(target) {
return _guessExecutionStatusRelativeToCached(this, target, new Map());
}
function _guessExecutionStatusRelativeToCached(base, target, cache) {
const funcParent = {
this: getOuterFunction(base),
target: getOuterFunction(target)
};
if (funcParent.target.node !== funcParent.this.node) {
return _guessExecutionStatusRelativeToDifferentFunctionsCached(base, funcParent.target, cache);
}
const paths = {
target: target.getAncestry(),
this: base.getAncestry()
};
if (paths.target.includes(base)) return "after";
if (paths.this.includes(target)) return "before";
let commonPath;
const commonIndex = {
target: 0,
this: 0
};
while (!commonPath && commonIndex.this < paths.this.length) {
const path = paths.this[commonIndex.this];
commonIndex.target = paths.target.indexOf(path);
if (commonIndex.target >= 0) {
commonPath = path;
} else {
commonIndex.this++;
}
}
if (!commonPath) {
throw new Error("Internal Babel error - The two compared nodes" + " don't appear to belong to the same program.");
}
if (isExecutionUncertainInList(paths.this, commonIndex.this - 1) || isExecutionUncertainInList(paths.target, commonIndex.target - 1)) {
return "unknown";
}
const divergence = {
this: paths.this[commonIndex.this - 1],
target: paths.target[commonIndex.target - 1]
};
if (divergence.target.listKey && divergence.this.listKey && divergence.target.container === divergence.this.container) {
return divergence.target.key > divergence.this.key ? "before" : "after";
}
const keys = VISITOR_KEYS[commonPath.type];
const keyPosition = {
this: keys.indexOf(divergence.this.parentKey),
target: keys.indexOf(divergence.target.parentKey)
};
return keyPosition.target > keyPosition.this ? "before" : "after";
}
function _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache) {
if (!target.isFunctionDeclaration()) {
if (_guessExecutionStatusRelativeToCached(base, target, cache) === "before") {
return "before";
}
return "unknown";
} else if (target.parentPath.isExportDeclaration()) {
return "unknown";
}
const binding = target.scope.getBinding(target.node.id.name);
if (!binding.references) return "before";
const referencePaths = binding.referencePaths;
let allStatus;
for (const path of referencePaths) {
const childOfFunction = !!path.find(path => path.node === target.node);
if (childOfFunction) continue;
if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
return "unknown";
}
const status = _guessExecutionStatusRelativeToCached(base, path, cache);
if (allStatus && allStatus !== status) {
return "unknown";
} else {
allStatus = status;
}
}
return allStatus;
}
function _guessExecutionStatusRelativeToDifferentFunctionsCached(base, target, cache) {
let nodeMap = cache.get(base.node);
let cached;
if (!nodeMap) {
cache.set(base.node, nodeMap = new Map());
} else if (cached = nodeMap.get(target.node)) {
if (cached === SYMBOL_CHECKING) {
return "unknown";
}
return cached;
}
nodeMap.set(target.node, SYMBOL_CHECKING);
const result = _guessExecutionStatusRelativeToDifferentFunctionsInternal(base, target, cache);
nodeMap.set(target.node, result);
return result;
}
function resolve(dangerous, resolved) {
return _resolve.call(this, dangerous, resolved) || this;
}
function _resolve(dangerous, resolved) {
var _resolved;
if ((_resolved = resolved) != null && _resolved.includes(this)) return;
resolved = resolved || [];
resolved.push(this);
if (this.isVariableDeclarator()) {
if (this.get("id").isIdentifier()) {
return this.get("init").resolve(dangerous, resolved);
} else {}
} else if (this.isReferencedIdentifier()) {
const binding = this.scope.getBinding(this.node.name);
if (!binding) return;
if (!binding.constant) return;
if (binding.kind === "module") return;
if (binding.path !== this) {
const ret = binding.path.resolve(dangerous, resolved);
if (this.find(parent => parent.node === ret.node)) return;
return ret;
}
} else if (this.isTypeCastExpression()) {
return this.get("expression").resolve(dangerous, resolved);
} else if (dangerous && this.isMemberExpression()) {
const targetKey = this.toComputedKey();
if (!isLiteral(targetKey)) return;
const targetName = targetKey.value;
const target = this.get("object").resolve(dangerous, resolved);
if (target.isObjectExpression()) {
const props = target.get("properties");
for (const prop of props) {
if (!prop.isProperty()) continue;
const key = prop.get("key");
let match = prop.isnt("computed") && key.isIdentifier({
name: targetName
});
match = match || key.isLiteral({
value: targetName
});
if (match) return prop.get("value").resolve(dangerous, resolved);
}
} else if (target.isArrayExpression() && !isNaN(+targetName)) {
const elems = target.get("elements");
const elem = elems[targetName];
if (elem) return elem.resolve(dangerous, resolved);
}
}
}
function isConstantExpression() {
if (this.isIdentifier()) {
const binding = this.scope.getBinding(this.node.name);
if (!binding) return false;
return binding.constant;
}
if (this.isLiteral()) {
if (this.isRegExpLiteral()) {
return false;
}
if (this.isTemplateLiteral()) {
return this.get("expressions").every(expression => expression.isConstantExpression());
}
return true;
}
if (this.isUnaryExpression()) {
if (this.node.operator !== "void") {
return false;
}
return this.get("argument").isConstantExpression();
}
if (this.isBinaryExpression()) {
const {
operator
} = this.node;
return operator !== "in" && operator !== "instanceof" && this.get("left").isConstantExpression() && this.get("right").isConstantExpression();
}
if (this.isMemberExpression()) {
return !this.node.computed && this.get("object").isIdentifier({
name: "Symbol"
}) && !this.scope.hasBinding("Symbol", {
noGlobals: true
});
}
if (this.isCallExpression()) {
return this.node.arguments.length === 1 && this.get("callee").matchesPattern("Symbol.for") && !this.scope.hasBinding("Symbol", {
noGlobals: true
}) && this.get("arguments")[0].isStringLiteral();
}
return false;
}
function isInStrictMode() {
const start = this.isProgram() ? this : this.parentPath;
const strictParent = start.find(path => {
if (path.isProgram({
sourceType: "module"
})) return true;
if (path.isClass()) return true;
if (path.isArrowFunctionExpression() && !path.get("body").isBlockStatement()) {
return false;
}
let body;
if (path.isFunction()) {
body = path.node.body;
} else if (path.isProgram()) {
body = path.node;
} else {
return false;
}
for (const directive of body.directives) {
if (directive.value.value === "use strict") {
return true;
}
}
return false;
});
return !!strictParent;
}
//# sourceMappingURL=introspection.js.map
@@ -0,0 +1,24 @@
// Chuvash [cv]
import dayjs from '../index';
var locale = {
name: 'cv',
weekdays: 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'),
months: 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'),
weekStart: 1,
weekdaysShort: 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'),
monthsShort: 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'),
weekdaysMin: 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'),
ordinal: function ordinal(n) {
return n;
},
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD-MM-YYYY',
LL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]',
LLL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
LLLL: 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,17 @@
var $1b0393182473bf9e$exports = {};
$1b0393182473bf9e$exports = {
"deselectedItem": (args)=>`${args.item} nincs kijel\xf6lve.`,
"longPressToSelect": `Nyomja hosszan a kijel\xf6l\xe9shez.`,
"select": `Kijel\xf6l\xe9s`,
"selectedAll": `Az \xf6sszes elem kijel\xf6lve.`,
"selectedCount": (args, formatter)=>`${formatter.plural(args.count, {
"=0": `Egy elem sincs kijel\xf6lve`,
one: ()=>`${formatter.number(args.count)} elem kijel\xf6lve`,
other: ()=>`${formatter.number(args.count)} elem kijel\xf6lve`
})}.`,
"selectedItem": (args)=>`${args.item} kijel\xf6lve.`
};
export {$1b0393182473bf9e$exports as default};
//# sourceMappingURL=hu-HU.module.js.map
@@ -0,0 +1,23 @@
"use strict";
var _super_prop_base = require("./_super_prop_base.cjs");
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) exports._ = _get = Reflect.get;
else {
exports._ = _get = function get(target, property, receiver) {
var base = _super_prop_base._(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) return desc.get.call(receiver || target);
return desc.value;
};
}
return _get(target, property, receiver || target);
}
exports._ = _get;
@@ -0,0 +1,21 @@
import baseForOwn from './_baseForOwn.js';
/**
* The base implementation of `_.invert` and `_.invertBy` which inverts
* `object` with values transformed by `iteratee` and set by `setter`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform values.
* @param {Object} accumulator The initial inverted object.
* @returns {Function} Returns `accumulator`.
*/
function baseInverter(object, setter, iteratee, accumulator) {
baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
}
export default baseInverter;
@@ -0,0 +1,100 @@
import * as ts from 'typescript';
import type { TypeOrValueSpecifier } from './TypeOrValueSpecifier';
export interface ReadonlynessOptions {
readonly allow?: TypeOrValueSpecifier[];
readonly treatMethodsAsReadonly?: boolean;
}
export declare const readonlynessOptionsSchema: {
additionalProperties: false;
properties: {
allow: {
readonly items: {
readonly oneOf: [{
readonly type: "string";
}, {
readonly additionalProperties: false;
readonly properties: {
readonly from: {
readonly enum: ["file"];
readonly type: "string";
};
readonly name: {
readonly oneOf: [{
readonly type: "string";
}, {
readonly items: {
readonly type: "string";
};
readonly minItems: 1;
readonly type: "array";
readonly uniqueItems: true;
}];
};
readonly path: {
readonly type: "string";
};
};
readonly required: ["from", "name"];
readonly type: "object";
}, {
readonly additionalProperties: false;
readonly properties: {
readonly from: {
readonly enum: ["lib"];
readonly type: "string";
};
readonly name: {
readonly oneOf: [{
readonly type: "string";
}, {
readonly items: {
readonly type: "string";
};
readonly minItems: 1;
readonly type: "array";
readonly uniqueItems: true;
}];
};
};
readonly required: ["from", "name"];
readonly type: "object";
}, {
readonly additionalProperties: false;
readonly properties: {
readonly from: {
readonly enum: ["package"];
readonly type: "string";
};
readonly name: {
readonly oneOf: [{
readonly type: "string";
}, {
readonly items: {
readonly type: "string";
};
readonly minItems: 1;
readonly type: "array";
readonly uniqueItems: true;
}];
};
readonly package: {
readonly type: "string";
};
};
readonly required: ["from", "name", "package"];
readonly type: "object";
}];
};
readonly type: "array";
};
treatMethodsAsReadonly: {
type: "boolean";
};
};
type: "object";
};
export declare const readonlynessOptionsDefaults: ReadonlynessOptions;
/**
* Checks if the given type is readonly
*/
export declare function isTypeReadonly(program: ts.Program, type: ts.Type, options?: ReadonlynessOptions): boolean;
@@ -0,0 +1,17 @@
<!--
Thank you for your pull request. Please review the below requirements.
Contributor guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
-->
##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->
- [ ] `npm install && npm test` passes
- [ ] tests are included <!-- Bug fixes and new features should include tests -->
- [ ] documentation is changed or added
- [ ] commit message follows [commit guidelines](https://github.com/googleapis/release-please#how-should-i-write-my-commits)
##### Description of change
<!-- Provide a description of the change -->
@@ -0,0 +1,44 @@
import { NodeIKernelRobotListener } from '../listeners';
import { GeneralCallResult, Peer } from '..';
export interface NodeIKernelRobotService {
fetchGroupRobotStoreDiscovery(arg: unknown): unknown;
sendGroupRobotStoreSearch(arg: unknown): unknown;
fetchGroupRobotStoreCategoryList(arg: unknown): unknown;
FetchSubscribeMsgTemplate(arg: unknown): unknown;
FetchSubcribeMsgTemplateStatus(arg: unknown): unknown;
SubscribeMsgTemplateSet(arg1: unknown, arg2: unknown): unknown;
fetchRecentUsedRobots(arg: unknown): unknown;
fetchShareArkInfo(arg: unknown): unknown;
addKernelRobotListener(Listener: NodeIKernelRobotListener): number;
removeKernelRobotListener(ListenerId: number): unknown;
getAllRobotFriendsFromCache(): Promise<unknown>;
fetchAllRobots(arg1: unknown, arg2: unknown): unknown;
removeAllRecommendCache(): unknown;
setRobotPickTts(arg1: unknown, arg2: unknown): unknown;
getRobotUinRange(data: unknown): Promise<{
response: {
robotUinRanges: Array<unknown>;
};
}>;
getRobotFunctions(peer: Peer, params: {
uins: Array<string>;
num: 0;
client_info: {
platform: 4;
version: '';
build_num: 9999;
};
tinyids: [];
page: 0;
full_fetch: false;
scene: 4;
filter: 1;
bkn: '';
}): Promise<GeneralCallResult & {
response: {
bot_features: Array<unknown>;
next_page: number;
};
}>;
isNull(): boolean;
}
@@ -0,0 +1,22 @@
# CHANGELOG
### 1.3.0
- [#4] Add `SPLAT` symbol.
- [#3] Add linting & TravisCI.
### 1.2.0
- [#2] Move configs from `winston.config.{npm,syslog,npm}` into `triple-beam`.
### 1.1.0
- Expose a `MESSAGE` Symbol, nothing more.
### 1.0.1
- Use `Symbol.for` because that is how they work apparently.
### 1.0.0
- Initial version. Defines a `LEVEL` Symbol, nothing more.
@@ -0,0 +1,17 @@
import * as core from "../core/index.cjs";
import * as schemas from "./schemas.cjs";
export interface ZodCoercedString<T = unknown> extends schemas._ZodString<core.$ZodStringInternals<T>> {
}
export declare function string<T = unknown>(params?: string | core.$ZodStringParams): ZodCoercedString<T>;
export interface ZodCoercedNumber<T = unknown> extends schemas._ZodNumber<core.$ZodNumberInternals<T>> {
}
export declare function number<T = unknown>(params?: string | core.$ZodNumberParams): ZodCoercedNumber<T>;
export interface ZodCoercedBoolean<T = unknown> extends schemas._ZodBoolean<core.$ZodBooleanInternals<T>> {
}
export declare function boolean<T = unknown>(params?: string | core.$ZodBooleanParams): ZodCoercedBoolean<T>;
export interface ZodCoercedBigInt<T = unknown> extends schemas._ZodBigInt<core.$ZodBigIntInternals<T>> {
}
export declare function bigint<T = unknown>(params?: string | core.$ZodBigIntParams): ZodCoercedBigInt<T>;
export interface ZodCoercedDate<T = unknown> extends schemas._ZodDate<core.$ZodDateInternals<T>> {
}
export declare function date<T = unknown>(params?: string | core.$ZodDateParams): ZodCoercedDate<T>;
@@ -0,0 +1 @@
{"mappings":";;AAgBA,OAAY,EAAC,kBAAkB,EAAC,CAAC;AAEjC;IACE,sCAAsC;IACtC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,iDAAiD;IACjD,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAElC,+BAA+B;IAC/B,WAAW,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvC,kCAAkC;IAClC,MAAM,IAAI,IAAI,CAAA;CACf;AAED;;GAEG;AACH,+BAA+B,KAAK,GAAE,kBAAuB,GAAG,WAAW,CA0B1E;AC7CD;IACE;;;OAGG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACtC,qDAAqD;IACrD,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kEAAkE;IAClE,YAAY,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACpC,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IAC7C,sCAAsC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;IACE,uDAAuD;IACvD,QAAQ,CAAC,aAAa,EAAE,QAAQ,GAAG,UAAU,CAAC;IAE9C,sCAAsC;IACtC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAE7B,iDAAiD;IACjD,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhC,yDAAyD;IACzD,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;IAE1B,8CAA8C;IAC9C,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAEjD,yCAAyC;IACzC,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACtC;AAED;;;GAGG;AACH,oCAAoC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,CAkC7E;AC7ED,YAAY,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-stately/toggle/src/packages/@react-stately/toggle/src/useToggleState.ts","packages/@react-stately/toggle/src/packages/@react-stately/toggle/src/useToggleGroupState.ts","packages/@react-stately/toggle/src/packages/@react-stately/toggle/src/index.ts","packages/@react-stately/toggle/src/index.ts"],"sourcesContent":[null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useToggleState} from './useToggleState';\nexport {useToggleGroupState} from './useToggleGroupState';\n\nexport type {ToggleProps} from '@react-types/checkbox';\nexport type {ToggleState, ToggleStateOptions} from './useToggleState';\nexport type {ToggleGroupProps, ToggleGroupState} from './useToggleGroupState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -0,0 +1,12 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es2017_intl = void 0;
const base_config_1 = require("./base-config");
exports.es2017_intl = {
libs: [],
variables: [['Intl', base_config_1.TYPE_VALUE]],
};
@@ -0,0 +1,462 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _keywords = require('../parser/tokenizer/keywords');
var _types = require('../parser/tokenizer/types');
var _getClassInfo = require('../util/getClassInfo'); var _getClassInfo2 = _interopRequireDefault(_getClassInfo);
var _CJSImportTransformer = require('./CJSImportTransformer'); var _CJSImportTransformer2 = _interopRequireDefault(_CJSImportTransformer);
var _ESMImportTransformer = require('./ESMImportTransformer'); var _ESMImportTransformer2 = _interopRequireDefault(_ESMImportTransformer);
var _FlowTransformer = require('./FlowTransformer'); var _FlowTransformer2 = _interopRequireDefault(_FlowTransformer);
var _JestHoistTransformer = require('./JestHoistTransformer'); var _JestHoistTransformer2 = _interopRequireDefault(_JestHoistTransformer);
var _JSXTransformer = require('./JSXTransformer'); var _JSXTransformer2 = _interopRequireDefault(_JSXTransformer);
var _NumericSeparatorTransformer = require('./NumericSeparatorTransformer'); var _NumericSeparatorTransformer2 = _interopRequireDefault(_NumericSeparatorTransformer);
var _OptionalCatchBindingTransformer = require('./OptionalCatchBindingTransformer'); var _OptionalCatchBindingTransformer2 = _interopRequireDefault(_OptionalCatchBindingTransformer);
var _OptionalChainingNullishTransformer = require('./OptionalChainingNullishTransformer'); var _OptionalChainingNullishTransformer2 = _interopRequireDefault(_OptionalChainingNullishTransformer);
var _ReactDisplayNameTransformer = require('./ReactDisplayNameTransformer'); var _ReactDisplayNameTransformer2 = _interopRequireDefault(_ReactDisplayNameTransformer);
var _ReactHotLoaderTransformer = require('./ReactHotLoaderTransformer'); var _ReactHotLoaderTransformer2 = _interopRequireDefault(_ReactHotLoaderTransformer);
var _TypeScriptTransformer = require('./TypeScriptTransformer'); var _TypeScriptTransformer2 = _interopRequireDefault(_TypeScriptTransformer);
class RootTransformer {
__init() {this.transformers = []}
__init2() {this.generatedVariables = []}
constructor(
sucraseContext,
transforms,
enableLegacyBabel5ModuleInterop,
options,
) {;RootTransformer.prototype.__init.call(this);RootTransformer.prototype.__init2.call(this);
this.nameManager = sucraseContext.nameManager;
this.helperManager = sucraseContext.helperManager;
const {tokenProcessor, importProcessor} = sucraseContext;
this.tokens = tokenProcessor;
this.isImportsTransformEnabled = transforms.includes("imports");
this.isReactHotLoaderTransformEnabled = transforms.includes("react-hot-loader");
this.disableESTransforms = Boolean(options.disableESTransforms);
if (!options.disableESTransforms) {
this.transformers.push(
new (0, _OptionalChainingNullishTransformer2.default)(tokenProcessor, this.nameManager),
);
this.transformers.push(new (0, _NumericSeparatorTransformer2.default)(tokenProcessor));
this.transformers.push(new (0, _OptionalCatchBindingTransformer2.default)(tokenProcessor, this.nameManager));
}
if (transforms.includes("jsx")) {
if (options.jsxRuntime !== "preserve") {
this.transformers.push(
new (0, _JSXTransformer2.default)(this, tokenProcessor, importProcessor, this.nameManager, options),
);
}
this.transformers.push(
new (0, _ReactDisplayNameTransformer2.default)(this, tokenProcessor, importProcessor, options),
);
}
let reactHotLoaderTransformer = null;
if (transforms.includes("react-hot-loader")) {
if (!options.filePath) {
throw new Error("filePath is required when using the react-hot-loader transform.");
}
reactHotLoaderTransformer = new (0, _ReactHotLoaderTransformer2.default)(tokenProcessor, options.filePath);
this.transformers.push(reactHotLoaderTransformer);
}
// Note that we always want to enable the imports transformer, even when the import transform
// itself isn't enabled, since we need to do type-only import pruning for both Flow and
// TypeScript.
if (transforms.includes("imports")) {
if (importProcessor === null) {
throw new Error("Expected non-null importProcessor with imports transform enabled.");
}
this.transformers.push(
new (0, _CJSImportTransformer2.default)(
this,
tokenProcessor,
importProcessor,
this.nameManager,
this.helperManager,
reactHotLoaderTransformer,
enableLegacyBabel5ModuleInterop,
Boolean(options.enableLegacyTypeScriptModuleInterop),
transforms.includes("typescript"),
transforms.includes("flow"),
Boolean(options.preserveDynamicImport),
Boolean(options.keepUnusedImports),
),
);
} else {
this.transformers.push(
new (0, _ESMImportTransformer2.default)(
tokenProcessor,
this.nameManager,
this.helperManager,
reactHotLoaderTransformer,
transforms.includes("typescript"),
transforms.includes("flow"),
Boolean(options.keepUnusedImports),
options,
),
);
}
if (transforms.includes("flow")) {
this.transformers.push(
new (0, _FlowTransformer2.default)(this, tokenProcessor, transforms.includes("imports")),
);
}
if (transforms.includes("typescript")) {
this.transformers.push(
new (0, _TypeScriptTransformer2.default)(this, tokenProcessor, transforms.includes("imports")),
);
}
if (transforms.includes("jest")) {
this.transformers.push(
new (0, _JestHoistTransformer2.default)(this, tokenProcessor, this.nameManager, importProcessor),
);
}
}
transform() {
this.tokens.reset();
this.processBalancedCode();
const shouldAddUseStrict = this.isImportsTransformEnabled;
// "use strict" always needs to be first, so override the normal transformer order.
let prefix = shouldAddUseStrict ? '"use strict";' : "";
for (const transformer of this.transformers) {
prefix += transformer.getPrefixCode();
}
prefix += this.helperManager.emitHelpers();
prefix += this.generatedVariables.map((v) => ` var ${v};`).join("");
for (const transformer of this.transformers) {
prefix += transformer.getHoistedCode();
}
let suffix = "";
for (const transformer of this.transformers) {
suffix += transformer.getSuffixCode();
}
const result = this.tokens.finish();
let {code} = result;
if (code.startsWith("#!")) {
let newlineIndex = code.indexOf("\n");
if (newlineIndex === -1) {
newlineIndex = code.length;
code += "\n";
}
return {
code: code.slice(0, newlineIndex + 1) + prefix + code.slice(newlineIndex + 1) + suffix,
// The hashbang line has no tokens, so shifting the tokens to account
// for prefix can happen normally.
mappings: this.shiftMappings(result.mappings, prefix.length),
};
} else {
return {
code: prefix + code + suffix,
mappings: this.shiftMappings(result.mappings, prefix.length),
};
}
}
processBalancedCode() {
let braceDepth = 0;
let parenDepth = 0;
while (!this.tokens.isAtEnd()) {
if (this.tokens.matches1(_types.TokenType.braceL) || this.tokens.matches1(_types.TokenType.dollarBraceL)) {
braceDepth++;
} else if (this.tokens.matches1(_types.TokenType.braceR)) {
if (braceDepth === 0) {
return;
}
braceDepth--;
}
if (this.tokens.matches1(_types.TokenType.parenL)) {
parenDepth++;
} else if (this.tokens.matches1(_types.TokenType.parenR)) {
if (parenDepth === 0) {
return;
}
parenDepth--;
}
this.processToken();
}
}
processToken() {
if (this.tokens.matches1(_types.TokenType._class)) {
this.processClass();
return;
}
for (const transformer of this.transformers) {
const wasProcessed = transformer.process();
if (wasProcessed) {
return;
}
}
this.tokens.copyToken();
}
/**
* Skip past a class with a name and return that name.
*/
processNamedClass() {
if (!this.tokens.matches2(_types.TokenType._class, _types.TokenType.name)) {
throw new Error("Expected identifier for exported class name.");
}
const name = this.tokens.identifierNameAtIndex(this.tokens.currentIndex() + 1);
this.processClass();
return name;
}
processClass() {
const classInfo = _getClassInfo2.default.call(void 0, this, this.tokens, this.nameManager, this.disableESTransforms);
// Both static and instance initializers need a class name to use to invoke the initializer, so
// assign to one if necessary.
const needsCommaExpression =
(classInfo.headerInfo.isExpression || !classInfo.headerInfo.className) &&
classInfo.staticInitializerNames.length + classInfo.instanceInitializerNames.length > 0;
let className = classInfo.headerInfo.className;
if (needsCommaExpression) {
className = this.nameManager.claimFreeName("_class");
this.generatedVariables.push(className);
this.tokens.appendCode(` (${className} =`);
}
const classToken = this.tokens.currentToken();
const contextId = classToken.contextId;
if (contextId == null) {
throw new Error("Expected class to have a context ID.");
}
this.tokens.copyExpectedToken(_types.TokenType._class);
while (!this.tokens.matchesContextIdAndLabel(_types.TokenType.braceL, contextId)) {
this.processToken();
}
this.processClassBody(classInfo, className);
const staticInitializerStatements = classInfo.staticInitializerNames.map(
(name) => `${className}.${name}()`,
);
if (needsCommaExpression) {
this.tokens.appendCode(
`, ${staticInitializerStatements.map((s) => `${s}, `).join("")}${className})`,
);
} else if (classInfo.staticInitializerNames.length > 0) {
this.tokens.appendCode(` ${staticInitializerStatements.map((s) => `${s};`).join(" ")}`);
}
}
/**
* We want to just handle class fields in all contexts, since TypeScript supports them. Later,
* when some JS implementations support class fields, this should be made optional.
*/
processClassBody(classInfo, className) {
const {
headerInfo,
constructorInsertPos,
constructorInitializerStatements,
fields,
instanceInitializerNames,
rangesToRemove,
} = classInfo;
let fieldIndex = 0;
let rangeToRemoveIndex = 0;
const classContextId = this.tokens.currentToken().contextId;
if (classContextId == null) {
throw new Error("Expected non-null context ID on class.");
}
this.tokens.copyExpectedToken(_types.TokenType.braceL);
if (this.isReactHotLoaderTransformEnabled) {
this.tokens.appendCode(
"__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}",
);
}
const needsConstructorInit =
constructorInitializerStatements.length + instanceInitializerNames.length > 0;
if (constructorInsertPos === null && needsConstructorInit) {
const constructorInitializersCode = this.makeConstructorInitCode(
constructorInitializerStatements,
instanceInitializerNames,
className,
);
if (headerInfo.hasSuperclass) {
const argsName = this.nameManager.claimFreeName("args");
this.tokens.appendCode(
`constructor(...${argsName}) { super(...${argsName}); ${constructorInitializersCode}; }`,
);
} else {
this.tokens.appendCode(`constructor() { ${constructorInitializersCode}; }`);
}
}
while (!this.tokens.matchesContextIdAndLabel(_types.TokenType.braceR, classContextId)) {
if (fieldIndex < fields.length && this.tokens.currentIndex() === fields[fieldIndex].start) {
let needsCloseBrace = false;
if (this.tokens.matches1(_types.TokenType.bracketL)) {
this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this`);
} else if (this.tokens.matches1(_types.TokenType.string) || this.tokens.matches1(_types.TokenType.num)) {
this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this[`);
needsCloseBrace = true;
} else {
this.tokens.copyTokenWithPrefix(`${fields[fieldIndex].initializerName}() {this.`);
}
while (this.tokens.currentIndex() < fields[fieldIndex].end) {
if (needsCloseBrace && this.tokens.currentIndex() === fields[fieldIndex].equalsIndex) {
this.tokens.appendCode("]");
}
this.processToken();
}
this.tokens.appendCode("}");
fieldIndex++;
} else if (
rangeToRemoveIndex < rangesToRemove.length &&
this.tokens.currentIndex() >= rangesToRemove[rangeToRemoveIndex].start
) {
if (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) {
this.tokens.removeInitialToken();
}
while (this.tokens.currentIndex() < rangesToRemove[rangeToRemoveIndex].end) {
this.tokens.removeToken();
}
rangeToRemoveIndex++;
} else if (this.tokens.currentIndex() === constructorInsertPos) {
this.tokens.copyToken();
if (needsConstructorInit) {
this.tokens.appendCode(
`;${this.makeConstructorInitCode(
constructorInitializerStatements,
instanceInitializerNames,
className,
)};`,
);
}
this.processToken();
} else {
this.processToken();
}
}
this.tokens.copyExpectedToken(_types.TokenType.braceR);
}
makeConstructorInitCode(
constructorInitializerStatements,
instanceInitializerNames,
className,
) {
return [
...constructorInitializerStatements,
...instanceInitializerNames.map((name) => `${className}.prototype.${name}.call(this)`),
].join(";");
}
/**
* Normally it's ok to simply remove type tokens, but we need to be more careful when dealing with
* arrow function return types since they can confuse the parser. In that case, we want to move
* the close-paren to the same line as the arrow.
*
* See https://github.com/alangpierce/sucrase/issues/391 for more details.
*/
processPossibleArrowParamEnd() {
if (this.tokens.matches2(_types.TokenType.parenR, _types.TokenType.colon) && this.tokens.tokenAtRelativeIndex(1).isType) {
let nextNonTypeIndex = this.tokens.currentIndex() + 1;
// Look ahead to see if this is an arrow function or something else.
while (this.tokens.tokens[nextNonTypeIndex].isType) {
nextNonTypeIndex++;
}
if (this.tokens.matches1AtIndex(nextNonTypeIndex, _types.TokenType.arrow)) {
this.tokens.removeInitialToken();
while (this.tokens.currentIndex() < nextNonTypeIndex) {
this.tokens.removeToken();
}
this.tokens.replaceTokenTrimmingLeftWhitespace(") =>");
return true;
}
}
return false;
}
/**
* An async arrow function might be of the form:
*
* async <
* T
* >() => {}
*
* in which case, removing the type parameters will cause a syntax error. Detect this case and
* move the open-paren earlier.
*/
processPossibleAsyncArrowWithTypeParams() {
if (
!this.tokens.matchesContextual(_keywords.ContextualKeyword._async) &&
!this.tokens.matches1(_types.TokenType._async)
) {
return false;
}
const nextToken = this.tokens.tokenAtRelativeIndex(1);
if (nextToken.type !== _types.TokenType.lessThan || !nextToken.isType) {
return false;
}
let nextNonTypeIndex = this.tokens.currentIndex() + 1;
// Look ahead to see if this is an arrow function or something else.
while (this.tokens.tokens[nextNonTypeIndex].isType) {
nextNonTypeIndex++;
}
if (this.tokens.matches1AtIndex(nextNonTypeIndex, _types.TokenType.parenL)) {
this.tokens.replaceToken("async (");
this.tokens.removeInitialToken();
while (this.tokens.currentIndex() < nextNonTypeIndex) {
this.tokens.removeToken();
}
this.tokens.removeToken();
// We ate a ( token, so we need to process the tokens in between and then the ) token so that
// we remain balanced.
this.processBalancedCode();
this.processToken();
return true;
}
return false;
}
processPossibleTypeRange() {
if (this.tokens.currentToken().isType) {
this.tokens.removeInitialToken();
while (this.tokens.currentToken().isType) {
this.tokens.removeToken();
}
return true;
}
return false;
}
shiftMappings(
mappings,
prefixLength,
) {
for (let i = 0; i < mappings.length; i++) {
const mapping = mappings[i];
if (mapping !== undefined) {
mappings[i] = mapping + prefixLength;
}
}
return mappings;
}
} exports.default = RootTransformer;
@@ -0,0 +1 @@
{"name":"glob-parent","version":"6.0.2","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532094649,"integrity":"sha512-uk8DZVjFcWdJt5QlC/M7V5EvcJOkhGSccT1uO6bimI/WUiQ64lFnNTe3Be8jOF8XNwS727dxl1fKP2uE0UEy2A==","mode":420,"size":857},"index.js":{"checkedAt":1794532094649,"integrity":"sha512-TX5nhCPDEHTpB2h3Y+5to6RTZWgkfuZoFSTQIGzAfYw+ykJuqnB7taJT1/fCNjG2eU3B7oKIv3V4I2gE0Ejq1w==","mode":420,"size":1614},"package.json":{"checkedAt":1794532094649,"integrity":"sha512-+XfA+SK7fQcEQMFvhcrEb6Zunl2wiCzU+Do0LImZv/frVgDL7Z107BAxUUC28Ew8sZv4WmTZsno4D4tiQMshwA==","mode":420,"size":1050},"README.md":{"checkedAt":1794532094649,"integrity":"sha512-6+f/LOX8jy9mu4ln57QTcsuhXSkED0WJ5nyZS6hFEwDWgXOIekSt6iE4D4A54EodKAorDCPkkmr9Ewu6VMJGcA==","mode":420,"size":4198}}}
@@ -0,0 +1,4 @@
/** @type {Construct} */
export const headingAtx: Construct;
import type { Construct } from 'micromark-util-types';
//# sourceMappingURL=heading-atx.d.ts.map
@@ -0,0 +1,26 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="2.0.0"></a>
# [2.0.0](https://github.com/yargs/set-blocking/compare/v1.0.0...v2.0.0) (2016-05-17)
### Features
* add an isTTY check ([#3](https://github.com/yargs/set-blocking/issues/3)) ([66ce277](https://github.com/yargs/set-blocking/commit/66ce277))
### BREAKING CHANGES
* stdio/stderr will not be set to blocking if isTTY === false
<a name="1.0.0"></a>
# 1.0.0 (2016-05-14)
### Features
* implemented shim for stream._handle.setBlocking ([6bde0c0](https://github.com/yargs/set-blocking/commit/6bde0c0))
@@ -0,0 +1,15 @@
import {
breadcrumbItem,
breadcrumbs
} from "../chunk-EYPT3KBI.mjs";
import "../chunk-CWYZ2GEH.mjs";
import "../chunk-GQT3YUX3.mjs";
import "../chunk-46U6G7UJ.mjs";
import "../chunk-DGTYPKBN.mjs";
import "../chunk-UWE6H66T.mjs";
import "../chunk-GIXI35A3.mjs";
import "../chunk-GH5E4FQB.mjs";
export {
breadcrumbItem,
breadcrumbs
};
@@ -0,0 +1,12 @@
var test = require('tape');
var inspect = require('../');
var obj = { x: 'a\r\nb', y: '\x05! \x1f \x12' };
test('interpolate low bytes', function (t) {
t.plan(1);
t.equal(
inspect(obj),
"{ x: 'a\\r\\nb', y: '\\x05! \\x1F \\x12' }"
);
});
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,eAAe,CAAC,wHAAkB,CAAC;AACvD","sources":["packages/@react-aria/breadcrumbs/intl/uk-UA.json"],"sourcesContent":["{\n \"breadcrumbs\": \"Навігаційна стежка\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
@@ -0,0 +1,4 @@
{
"main": "../../cjs/_overload_yield.cjs",
"module": "../../esm/_overload_yield.js"
}
@@ -0,0 +1,100 @@
"use client";
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
Form: () => Form3,
FormContext: () => FormContext,
useSlottedContext: () => useSlottedContext
});
module.exports = __toCommonJS(src_exports);
// src/utils.ts
var import_react = require("react");
var import_utils = require("@react-aria/utils");
var DEFAULT_SLOT = Symbol("default");
function useSlottedContext(context, slot) {
let ctx = (0, import_react.useContext)(context);
if (slot === null) {
return null;
}
if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p) => `"${p}"`));
if (!slot && !ctx.slots[DEFAULT_SLOT]) {
throw new Error(`A slot prop is required. Valid slot names are ${availableSlots}.`);
}
let slotKey = slot || DEFAULT_SLOT;
if (!ctx.slots[slotKey]) {
throw new Error(`Invalid slot "${slot}". Valid slot names are ${availableSlots}.`);
}
return ctx.slots[slotKey];
}
return ctx;
}
function useContextProps(props, ref, context) {
let ctx = useSlottedContext(context, props.slot) || {};
let { ref: contextRef, ...contextProps } = ctx;
let mergedRef = (0, import_utils.useObjectRef)((0, import_react.useMemo)(() => (0, import_utils.mergeRefs)(ref, contextRef), [ref, contextRef]));
let mergedProps = (0, import_utils.mergeProps)(contextProps, props);
if ("style" in contextProps && contextProps.style && "style" in props && props.style) {
if (typeof contextProps.style === "function" || typeof props.style === "function") {
mergedProps.style = (renderProps) => {
let contextStyle = typeof contextProps.style === "function" ? contextProps.style(renderProps) : contextProps.style;
let defaultStyle = { ...renderProps.defaultStyle, ...contextStyle };
let style = typeof props.style === "function" ? props.style({ ...renderProps, defaultStyle }) : props.style;
return { ...defaultStyle, ...style };
};
} else {
mergedProps.style = { ...contextProps.style, ...props.style };
}
}
return [mergedProps, mergedRef];
}
// src/base-form.tsx
var import_form = require("@react-stately/form");
var import_react2 = require("react");
var import_theme = require("@heroui/theme");
var import_jsx_runtime = require("react/jsx-runtime");
var FormContext = (0, import_react2.createContext)(null);
var Form = (0, import_react2.forwardRef)(function Form2(props, ref) {
[props, ref] = useContextProps(props, ref, FormContext);
let { validationErrors, validationBehavior = "native", children, className, ...domProps } = props;
const styles = (0, import_react2.useMemo)(() => (0, import_theme.form)({ className }), [className]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { noValidate: validationBehavior !== "native", ...domProps, ref, className: styles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormContext.Provider, { value: { ...props, validationBehavior }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormValidationContext.Provider, { value: validationErrors != null ? validationErrors : {}, children }) }) });
});
// src/form.tsx
var import_system = require("@heroui/system");
var import_react3 = require("react");
var import_jsx_runtime2 = require("react/jsx-runtime");
var Form3 = (0, import_react3.forwardRef)(function Form4(props, ref) {
var _a, _b;
const globalContext = (0, import_system.useProviderContext)();
const validationBehavior = (_b = (_a = props.validationBehavior) != null ? _a : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _b : "aria";
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Form, { ...props, ref, validationBehavior });
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Form,
FormContext,
useSlottedContext
});
@@ -0,0 +1 @@
{"version":3,"file":"Graphemer.d.ts","sourceRoot":"","sources":["../src/Graphemer.ts"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IA2CvD;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAcrC;;;;OAIG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB;IAIhD;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAcnC;;;;OAIG;IACH,MAAM,CAAC,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAoySrD;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CA47B9C"}
@@ -0,0 +1,4 @@
import React from 'react';
import './Spinner.less';
declare function Spinner({ className, ...props }: React.HTMLAttributes<HTMLElement>): React.JSX.Element;
export default Spinner;
@@ -0,0 +1,89 @@
import {GenMapping, maybeAddSegment, toEncodedMap} from "@jridgewell/gen-mapping";
import {charCodes} from "./parser/util/charcodes";
/**
* Generate a source map indicating that each line maps directly to the original line,
* with the tokens in their new positions.
*/
export default function computeSourceMap(
{code: generatedCode, mappings: rawMappings},
filePath,
options,
source,
tokens,
) {
const sourceColumns = computeSourceColumns(source, tokens);
const map = new GenMapping({file: options.compiledFilename});
let tokenIndex = 0;
// currentMapping is the output source index for the current input token being
// considered.
let currentMapping = rawMappings[0];
while (currentMapping === undefined && tokenIndex < rawMappings.length - 1) {
tokenIndex++;
currentMapping = rawMappings[tokenIndex];
}
let line = 0;
let lineStart = 0;
if (currentMapping !== lineStart) {
maybeAddSegment(map, line, 0, filePath, line, 0);
}
for (let i = 0; i < generatedCode.length; i++) {
if (i === currentMapping) {
const genColumn = currentMapping - lineStart;
const sourceColumn = sourceColumns[tokenIndex];
maybeAddSegment(map, line, genColumn, filePath, line, sourceColumn);
while (
(currentMapping === i || currentMapping === undefined) &&
tokenIndex < rawMappings.length - 1
) {
tokenIndex++;
currentMapping = rawMappings[tokenIndex];
}
}
if (generatedCode.charCodeAt(i) === charCodes.lineFeed) {
line++;
lineStart = i + 1;
if (currentMapping !== lineStart) {
maybeAddSegment(map, line, 0, filePath, line, 0);
}
}
}
const {sourceRoot, sourcesContent, ...sourceMap} = toEncodedMap(map);
return sourceMap ;
}
/**
* Create an array mapping each token index to the 0-based column of the start
* position of the token.
*/
function computeSourceColumns(code, tokens) {
const sourceColumns = new Array(tokens.length);
let tokenIndex = 0;
let currentMapping = tokens[tokenIndex].start;
let lineStart = 0;
for (let i = 0; i < code.length; i++) {
if (i === currentMapping) {
sourceColumns[tokenIndex] = currentMapping - lineStart;
tokenIndex++;
currentMapping = tokens[tokenIndex].start;
}
if (code.charCodeAt(i) === charCodes.lineFeed) {
lineStart = i + 1;
}
}
return sourceColumns;
}
@@ -0,0 +1,145 @@
export { ObjectSchema } from "@eslint/object-schema";
export type PropertyDefinition = $eslintobjectschema.PropertyDefinition;
export type ObjectDefinition = $eslintobjectschema.ObjectDefinition;
export type ConfigObject = $typests.ConfigObject;
export type IMinimatchStatic = minimatch.IMinimatchStatic;
export type IMinimatch = minimatch.IMinimatch;
export type ObjectSchemaInstance = ObjectSchema;
/**
* Represents an array of config objects and provides method for working with
* those config objects.
*/
export class ConfigArray extends Array<any> {
/**
* Creates a new instance of ConfigArray.
* @param {Iterable|Function|Object} configs An iterable yielding config
* objects, or a config function, or a config object.
* @param {Object} options The options for the ConfigArray.
* @param {string} [options.basePath="/"] The absolute path of the config file directory.
* Defaults to `"/"`.
* @param {boolean} [options.normalized=false] Flag indicating if the
* configs have already been normalized.
* @param {Object} [options.schema] The additional schema
* definitions to use for the ConfigArray schema.
* @param {Array<string>} [options.extraConfigTypes] List of config types supported.
* @throws {TypeError} When the `basePath` is not a non-empty string,
*/
constructor(configs: Iterable<any> | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: {
basePath?: string;
normalized?: boolean;
schema?: any;
extraConfigTypes?: Array<string>;
});
/**
* The path of the config file that this array was loaded from.
* This is used to calculate filename matches.
* @property basePath
* @type {string}
*/
basePath: string;
/**
* The supported config types.
* @type {Array<string>}
*/
extraConfigTypes: Array<string>;
/**
* Returns the `files` globs from every config object in the array.
* This can be used to determine which files will be matched by a
* config array or to use as a glob pattern when no patterns are provided
* for a command line interface.
* @returns {Array<string|Function>} An array of matchers.
*/
get files(): Array<string | Function>;
/**
* Returns ignore matchers that should always be ignored regardless of
* the matching `files` fields in any configs. This is necessary to mimic
* the behavior of things like .gitignore and .eslintignore, allowing a
* globbing operation to be faster.
* @returns {Object[]} An array of config objects representing global ignores.
*/
get ignores(): any[];
/**
* Indicates if the config array has been normalized.
* @returns {boolean} True if the config array is normalized, false if not.
*/
isNormalized(): boolean;
/**
* Normalizes a config array by flattening embedded arrays and executing
* config functions.
* @param {Object} [context] The context object for config functions.
* @returns {Promise<ConfigArray>} The current ConfigArray instance.
*/
normalize(context?: any): Promise<ConfigArray>;
/**
* Normalizes a config array by flattening embedded arrays and executing
* config functions.
* @param {Object} [context] The context object for config functions.
* @returns {ConfigArray} The current ConfigArray instance.
*/
normalizeSync(context?: any): ConfigArray;
/**
* Returns the config object for a given file path and a status that can be used to determine why a file has no config.
* @param {string} filePath The path of a file to get a config for.
* @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }}
* An object with an optional property `config` and property `status`.
* `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig},
* `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}.
*/
getConfigWithStatus(filePath: string): {
config?: any;
status: "ignored" | "external" | "unconfigured" | "matched";
};
/**
* Returns the config object for a given file path.
* @param {string} filePath The path of a file to get a config for.
* @returns {Object|undefined} The config object for this file or `undefined`.
*/
getConfig(filePath: string): any | undefined;
/**
* Determines whether a file has a config or why it doesn't.
* @param {string} filePath The path of the file to check.
* @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values:
* * `"ignored"`: the file is ignored
* * `"external"`: the file is outside the base path
* * `"unconfigured"`: the file is not matched by any config
* * `"matched"`: the file has a matching config
*/
getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched";
/**
* Determines if the given filepath is ignored based on the configs.
* @param {string} filePath The path of a file to check.
* @returns {boolean} True if the path is ignored, false if not.
* @deprecated Use `isFileIgnored` instead.
*/
isIgnored(filePath: string): boolean;
/**
* Determines if the given filepath is ignored based on the configs.
* @param {string} filePath The path of a file to check.
* @returns {boolean} True if the path is ignored, false if not.
*/
isFileIgnored(filePath: string): boolean;
/**
* Determines if the given directory is ignored based on the configs.
* This checks only default `ignores` that don't have `files` in the
* same config. A pattern such as `/foo` be considered to ignore the directory
* while a pattern such as `/foo/**` is not considered to ignore the
* directory because it is matching files.
* @param {string} directoryPath The path of a directory to check.
* @returns {boolean} True if the directory is ignored, false if not. Will
* return true for any directory that is not inside of `basePath`.
* @throws {Error} When the `ConfigArray` is not normalized.
*/
isDirectoryIgnored(directoryPath: string): boolean;
#private;
}
export namespace ConfigArraySymbol {
let isNormalized: symbol;
let configCache: symbol;
let schema: symbol;
let finalizeConfig: symbol;
let preprocessConfig: symbol;
}
import type * as $eslintobjectschema from "@eslint/object-schema";
import type * as $typests from "./types.ts";
import minimatch from 'minimatch';
import { ObjectSchema } from '@eslint/object-schema';
@@ -0,0 +1,6 @@
"use strict";
module.exports = function () {
// https://mths.be/emoji
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\Line truncated
};
@@ -0,0 +1,120 @@
import { getJoiner } from '../../src/parser/tokenizers/description.js';
import { Line } from '../../src/primitives.js';
import { seedTokens } from '../../src/util.js';
const source: Line[] = [
{
number: 1,
source: ' /**',
tokens: seedTokens({
start: ' ',
delimiter: '/**',
}),
},
{
number: 2,
source: ' * ',
tokens: seedTokens({
start: ' ',
delimiter: '*',
postDelimiter: ' ',
}),
},
{
number: 3,
source: ' * Description first line\twith\ttabs ',
tokens: seedTokens({
start: ' ',
delimiter: '*',
postDelimiter: ' ',
description: 'Description first line\twith\ttabs ',
}),
},
{
number: 4,
source: ' * second line ',
tokens: seedTokens({
start: ' ',
delimiter: '*',
postDelimiter: ' ',
description: 'second line ',
}),
},
{
number: 5,
source: ' * ',
tokens: seedTokens({
start: ' ',
delimiter: '*',
postDelimiter: ' ',
}),
},
{
number: 6,
source: ' * third line ',
tokens: seedTokens({
start: ' ',
delimiter: '*',
postDelimiter: ' ',
description: 'third line ',
}),
},
{
number: 7,
source: ' */',
tokens: seedTokens({
start: ' ',
end: '*/',
}),
},
];
test('compact', () => {
const joined = getJoiner('compact')(source);
expect(joined).toBe(
'Description first line\twith\ttabs second line third line'
);
});
test('preserve', () => {
const joined = getJoiner('preserve')(source);
expect(joined).toBe(
' \n Description first line\twith\ttabs \n second line \n \n third line '
);
});
test('preserve - empty', () => {
const joined = getJoiner('preserve')([]);
expect(joined).toBe('');
});
test('preserve - no delimiter', () => {
const joined = getJoiner('preserve')([
{
number: 1,
source: '...',
tokens: seedTokens({
start: ' ',
delimiter: '',
postDelimiter: '',
description: 'line with no delimiter',
}),
},
]);
expect(joined).toBe(' line with no delimiter');
});
test('custom', () => {
const spacerFn = (source: Line[]) =>
source
.map(({ tokens: { description } }) =>
description.replace(/\s+/g, ' ').trim().toUpperCase()
)
.filter((s) => s !== '')
.join(' ');
const joined = getJoiner(spacerFn)(source);
expect(joined).toBe(
'DESCRIPTION FIRST LINE WITH TABS SECOND LINE THIRD LINE'
);
});
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAuCM,SAAS,0CAAoB,KAAuB;IACzD,IAAI,sBAAsB,CAAA,GAAA,kDAAqB,EAAE;IACjD,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAwB;IACvE,IAAI,CAAC,mBAAmB,qBAAqB,GAAG,CAAA,GAAA,qBAAO,EAAS,EAAE;IAElE,IAAI,WAAW;QACb,qBAAqB,EAAE;QACvB,oBAAoB,KAAK;IAC3B;IAEA,IAAI,cAAc,CAAC,YAAiB;QAClC,qBAAqB,CAAA;YACnB,IAAI,QAAQ,SAAS,MAAM,EACzB,OAAO;YAGT,OAAO;mBAAI,SAAS,KAAK,CAAC,GAAG;gBAAQ;aAAW;QAClD;IACF;IAEA,IAAI,eAAe,CAAC,YAAiB;QACnC,qBAAqB,CAAA;YACnB,IAAI,MAAM,QAAQ,CAAC,MAAM;YACzB,IAAI,QAAQ,YACV,OAAO,SAAS,KAAK,CAAC,GAAG;iBAEzB,OAAO;QAEX;IACF;IAEA,OAAO;uBACL;QACA,GAAG,mBAAmB;QACtB,MAAK,gBAAsC,IAAI;YAC7C,iBAAiB;YACjB,oBAAoB,IAAI;QAC1B;QACA,QAAO,gBAAsC,IAAI;YAC/C,iBAAiB;YACjB,oBAAoB,MAAM;QAC5B;QACA;YACE;QACF;2BACA;qBACA;sBACA;IACF;AACF","sources":["packages/@react-stately/menu/src/useMenuTriggerState.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 {FocusStrategy, Key} from '@react-types/shared';\nimport {MenuTriggerProps} from '@react-types/menu';\nimport {OverlayTriggerState, useOverlayTriggerState} from '@react-stately/overlays';\nimport {useState} from 'react';\n\nexport interface MenuTriggerState extends OverlayTriggerState {\n /** Controls which item will be auto focused when the menu opens. */\n readonly focusStrategy: FocusStrategy | null,\n\n /** Opens the menu. */\n open(focusStrategy?: FocusStrategy | null): void,\n\n /** Toggles the menu. */\n toggle(focusStrategy?: FocusStrategy | null): void\n}\n\nexport interface RootMenuTriggerState extends MenuTriggerState {\n /** Opens a specific submenu tied to a specific menu item at a specific level. */\n openSubmenu: (triggerKey: Key, level: number) => void,\n\n /** Closes a specific submenu tied to a specific menu item at a specific level. */\n closeSubmenu: (triggerKey: Key, level: number) => void,\n\n /** An array of open submenu trigger keys within the menu tree.\n * The index of key within array matches the submenu level in the tree.\n */\n expandedKeysStack: Key[],\n\n /** Closes the menu and all submenus in the menu tree. */\n close: () => void\n}\n\n/**\n * Manages state for a menu trigger. Tracks whether the menu is currently open,\n * and controls which item will receive focus when it opens. Also tracks the open submenus within\n * the menu tree via their trigger keys.\n */\nexport function useMenuTriggerState(props: MenuTriggerProps): RootMenuTriggerState {\n let overlayTriggerState = useOverlayTriggerState(props);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n let [expandedKeysStack, setExpandedKeysStack] = useState<Key[]>([]);\n\n let closeAll = () => {\n setExpandedKeysStack([]);\n overlayTriggerState.close();\n };\n\n let openSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n if (level > oldStack.length) {\n return oldStack;\n }\n\n return [...oldStack.slice(0, level), triggerKey];\n });\n };\n\n let closeSubmenu = (triggerKey: Key, level: number) => {\n setExpandedKeysStack(oldStack => {\n let key = oldStack[level];\n if (key === triggerKey) {\n return oldStack.slice(0, level);\n } else {\n return oldStack;\n }\n });\n };\n\n return {\n focusStrategy,\n ...overlayTriggerState,\n open(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.open();\n },\n toggle(focusStrategy: FocusStrategy | null = null) {\n setFocusStrategy(focusStrategy);\n overlayTriggerState.toggle();\n },\n close() {\n closeAll();\n },\n expandedKeysStack,\n openSubmenu,\n closeSubmenu\n };\n}\n"],"names":[],"version":3,"file":"useMenuTriggerState.main.js.map"}
@@ -0,0 +1,62 @@
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
// Leon Yu <https://github.com/leonyu>
// BendingBender <https://github.com/BendingBender>
// Maple Miao <https://github.com/mapleeit>
/// <reference types="node" />
import * as stream from 'stream';
import * as http from 'http';
export = FormData;
// Extracted because @types/node doesn't export interfaces.
interface ReadableOptions {
highWaterMark?: number;
encoding?: string;
objectMode?: boolean;
read?(this: stream.Readable, size: number): void;
destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void;
autoDestroy?: boolean;
}
interface Options extends ReadableOptions {
writable?: boolean;
readable?: boolean;
dataSize?: number;
maxDataSize?: number;
pauseStreams?: boolean;
}
declare class FormData extends stream.Readable {
constructor(options?: Options);
append(key: string, value: any, options?: FormData.AppendOptions | string): void;
getHeaders(userHeaders?: FormData.Headers): FormData.Headers;
submit(
params: string | FormData.SubmitOptions,
callback?: (error: Error | null, response: http.IncomingMessage) => void
): http.ClientRequest;
getBuffer(): Buffer;
setBoundary(boundary: string): void;
getBoundary(): string;
getLength(callback: (err: Error | null, length: number) => void): void;
getLengthSync(): number;
hasKnownLength(): boolean;
}
declare namespace FormData {
interface Headers {
[key: string]: any;
}
interface AppendOptions {
header?: string | Headers;
knownLength?: number;
filename?: string;
filepath?: string;
contentType?: string;
}
interface SubmitOptions extends http.RequestOptions {
protocol?: 'https:' | 'http:';
}
}
@@ -0,0 +1,33 @@
import { Pattern, MicromatchOptions, PatternRe } from '../../types';
import Settings from '../../settings';
export type PatternSegment = StaticPatternSegment | DynamicPatternSegment;
type StaticPatternSegment = {
dynamic: false;
pattern: Pattern;
};
type DynamicPatternSegment = {
dynamic: true;
pattern: Pattern;
patternRe: PatternRe;
};
export type PatternSection = PatternSegment[];
export type PatternInfo = {
/**
* Indicates that the pattern has a globstar (more than a single section).
*/
complete: boolean;
pattern: Pattern;
segments: PatternSegment[];
sections: PatternSection[];
};
export default abstract class Matcher {
private readonly _patterns;
private readonly _settings;
private readonly _micromatchOptions;
protected readonly _storage: PatternInfo[];
constructor(_patterns: Pattern[], _settings: Settings, _micromatchOptions: MicromatchOptions);
private _fillStorage;
private _getPatternSegments;
private _splitSegmentsIntoSections;
}
export {};
@@ -0,0 +1,104 @@
// src/use-accordion-item.ts
import { focusSafely } from "@react-aria/focus";
import { useId, useCallback, useEffect } from "react";
import { useButton } from "@react-aria/button";
function useReactAriaAccordionItem(props, state, ref) {
let { item, isDisabled: isDisabledProp } = props;
let key = item.key;
let manager = state.selectionManager;
let buttonId = useId();
let regionId = useId();
let isDisabled = state.disabledKeys.has(item.key) || isDisabledProp;
useEffect(() => {
let isFocused = key === state.focusedKey;
if (isFocused && document.activeElement !== ref.current) {
ref.current && focusSafely(ref.current);
}
}, [ref, key, state.focusedKey]);
let onSelect = useCallback(
(e) => {
if (!manager.canSelectItem(key)) {
return;
}
manager.select(key, e);
state.toggleKey(key);
},
[key, manager]
);
const extendFocusSelection = useCallback(
(toKey) => {
if (manager.selectionBehavior === "replace") {
manager.extendSelection(toKey);
}
manager.setFocusedKey(toKey);
},
[manager]
);
const onKeyDown = useCallback(
(event) => {
const keyMap = {
ArrowDown: () => {
const nextKey = state.collection.getKeyAfter(key);
if (nextKey && state.disabledKeys.has(nextKey)) {
const nextEnabledKey = state.collection.getKeyAfter(nextKey);
nextEnabledKey && extendFocusSelection(nextEnabledKey);
} else {
nextKey && extendFocusSelection(nextKey);
}
},
ArrowUp: () => {
const prevKey = state.collection.getKeyBefore(key);
if (prevKey && state.disabledKeys.has(prevKey)) {
const prevEnabledKey = state.collection.getKeyBefore(prevKey);
prevEnabledKey && extendFocusSelection(prevEnabledKey);
} else {
prevKey && extendFocusSelection(prevKey);
}
},
Home: () => {
const firstKey = state.collection.getFirstKey();
firstKey && extendFocusSelection(firstKey);
},
End: () => {
const lastKey = state.collection.getLastKey();
lastKey && extendFocusSelection(lastKey);
}
};
const action = keyMap[event.key];
if (action) {
event.preventDefault();
if (manager.canSelectItem(key)) {
action(event);
}
}
},
[key, manager]
);
let { buttonProps } = useButton(
{
id: buttonId,
elementType: "button",
isDisabled,
onKeyDown,
onPress: onSelect
},
ref
);
let isExpanded = state.selectionManager.isSelected(item.key);
return {
buttonProps: {
...buttonProps,
"aria-expanded": isExpanded,
"aria-controls": isExpanded ? regionId : void 0
},
regionProps: {
id: regionId,
role: "region",
"aria-labelledby": buttonId
}
};
}
export {
useReactAriaAccordionItem
};
@@ -0,0 +1,29 @@
"use client";
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/base/accordion-item-base.tsx
var accordion_item_base_exports = {};
__export(accordion_item_base_exports, {
default: () => accordion_item_base_default
});
module.exports = __toCommonJS(accordion_item_base_exports);
var import_aria_utils = require("@heroui/aria-utils");
var AccordionItemBase = import_aria_utils.BaseItem;
var accordion_item_base_default = AccordionItemBase;
@@ -0,0 +1,202 @@
/**
* @fileoverview Traverser to traverse AST trees.
* @author Nicholas C. Zakas
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const vk = require("eslint-visitor-keys");
const debug = require("debug")("eslint:traverser");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Do nothing.
* @returns {void}
*/
function noop() {
// do nothing.
}
/**
* Check whether the given value is an ASTNode or not.
* @param {any} x The value to check.
* @returns {boolean} `true` if the value is an ASTNode.
*/
function isNode(x) {
return x !== null && typeof x === "object" && typeof x.type === "string";
}
/**
* Get the visitor keys of a given node.
* @param {Object} visitorKeys The map of visitor keys.
* @param {ASTNode} node The node to get their visitor keys.
* @returns {string[]} The visitor keys of the node.
*/
function getVisitorKeys(visitorKeys, node) {
let keys = visitorKeys[node.type];
if (!keys) {
keys = vk.getKeys(node);
debug(
'Unknown node type "%s": Estimated visitor keys %j',
node.type,
keys,
);
}
return keys;
}
/**
* The traverser class to traverse AST trees.
*/
class Traverser {
constructor() {
this._current = null;
this._parents = [];
this._skipped = false;
this._broken = false;
this._visitorKeys = null;
this._enter = null;
this._leave = null;
}
/**
* Gives current node.
* @returns {ASTNode} The current node.
*/
current() {
return this._current;
}
/**
* Gives a copy of the ancestor nodes.
* @returns {ASTNode[]} The ancestor nodes.
*/
parents() {
return this._parents.slice(0);
}
/**
* Break the current traversal.
* @returns {void}
*/
break() {
this._broken = true;
}
/**
* Skip child nodes for the current traversal.
* @returns {void}
*/
skip() {
this._skipped = true;
}
/**
* Traverse the given AST tree.
* @param {ASTNode} node The root node to traverse.
* @param {Object} options The option object.
* @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`.
* @param {Function} [options.enter=noop] The callback function which is called on entering each node.
* @param {Function} [options.leave=noop] The callback function which is called on leaving each node.
* @returns {void}
*/
traverse(node, options) {
this._current = null;
this._parents = [];
this._skipped = false;
this._broken = false;
this._visitorKeys = options.visitorKeys || vk.KEYS;
this._enter = options.enter || noop;
this._leave = options.leave || noop;
this._traverse(node, null);
}
/**
* Traverse the given AST tree recursively.
* @param {ASTNode} node The current node.
* @param {ASTNode|null} parent The parent node.
* @returns {void}
* @private
*/
_traverse(node, parent) {
if (!isNode(node)) {
return;
}
this._current = node;
this._skipped = false;
this._enter(node, parent);
if (!this._skipped && !this._broken) {
const keys = getVisitorKeys(this._visitorKeys, node);
if (keys.length >= 1) {
this._parents.push(node);
for (let i = 0; i < keys.length && !this._broken; ++i) {
const child = node[keys[i]];
if (Array.isArray(child)) {
for (
let j = 0;
j < child.length && !this._broken;
++j
) {
this._traverse(child[j], node);
}
} else {
this._traverse(child, node);
}
}
this._parents.pop();
}
}
if (!this._broken) {
this._leave(node, parent);
}
this._current = parent;
}
/**
* Calculates the keys to use for traversal.
* @param {ASTNode} node The node to read keys from.
* @returns {string[]} An array of keys to visit on the node.
* @private
*/
static getKeys(node) {
return vk.getKeys(node);
}
/**
* Traverse the given AST tree.
* @param {ASTNode} node The root node to traverse.
* @param {Object} options The option object.
* @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`.
* @param {Function} [options.enter=noop] The callback function which is called on entering each node.
* @param {Function} [options.leave=noop] The callback function which is called on leaving each node.
* @returns {void}
*/
static traverse(node, options) {
new Traverser().traverse(node, options);
}
/**
* The default visitor keys.
* @type {Object}
*/
static get DEFAULT_VISITOR_KEYS() {
return vk.KEYS;
}
}
module.exports = Traverser;
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAaM,MAAM,0DAA2D,CAAA,GAAA,0BAAY,EAA8B,CAAC;AAK5G,SAAS,0CAAsB,KAA0B;IAC9D,IAAI,gBAAC,YAAY,EAAC,GAAG;IACrB,IAAI,EAAC,cAAc,eAAe,EAAC,GAAG;IACtC,qBACE,0DAAC,0CAAc,QAAQ;QAAC,OAAO;YAAC,cAAc,iBAAiB,OAAO,YAAY,yBAAA,0BAAA,eAAgB;QAAe;OAC9G,MAAM,QAAQ;AAGrB;AAEO,SAAS;QACP;IAAP,OAAO,CAAA,cAAA,CAAA,GAAA,uBAAS,EAAE,wDAAX,yBAAA,cAA6B,CAAC;AACvC","sources":["packages/@react-aria/overlays/src/PortalProvider.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport React, {createContext, JSX, ReactNode, useContext} from 'react';\n\nexport interface PortalProviderProps {\n /** Should return the element where we should portal to. Can clear the context by passing null. */\n getContainer?: (() => HTMLElement | null) | null,\n /** The content of the PortalProvider. Should contain all children that want to portal their overlays to the element returned by the provided `getContainer()`. */\n children: ReactNode\n}\n\nexport interface PortalProviderContextValue extends Omit<PortalProviderProps, 'children'>{};\n\nexport const PortalContext: React.Context<PortalProviderContextValue> = createContext<PortalProviderContextValue>({});\n\n/**\n * Sets the portal container for all overlay elements rendered by its children.\n */\nexport function UNSAFE_PortalProvider(props: PortalProviderProps): JSX.Element {\n let {getContainer} = props;\n let {getContainer: ctxGetContainer} = useUNSAFE_PortalContext();\n return (\n <PortalContext.Provider value={{getContainer: getContainer === null ? undefined : getContainer ?? ctxGetContainer}}>\n {props.children}\n </PortalContext.Provider>\n );\n}\n\nexport function useUNSAFE_PortalContext(): PortalProviderContextValue {\n return useContext(PortalContext) ?? {};\n}\n"],"names":[],"version":3,"file":"PortalProvider.main.js.map"}
@@ -0,0 +1,22 @@
import { E as Environment } from './chunks/environment.d.CrsxCzP1.js';
export { a as EnvironmentReturn, V as VmEnvironmentReturn } from './chunks/environment.d.CrsxCzP1.js';
import '@vitest/utils';
declare const environments: {
"node": Environment;
"jsdom": Environment;
"happy-dom": Environment;
"edge-runtime": Environment;
};
interface PopulateOptions {
bindFunctions?: boolean;
additionalKeys?: string[];
}
declare function populateGlobal(global: any, win: any, options?: PopulateOptions): {
keys: Set<string>;
skipKeys: string[];
originals: Map<string | symbol, any>;
};
export { Environment, environments as builtinEnvironments, populateGlobal };
@@ -0,0 +1,615 @@
{
"no-accessor-properties": {
"supported": ">=0.10.0"
},
"no-arbitrary-module-namespace-names": {
"supported": ">=13.2.0"
},
"no-array-from": {
"supported": ">=4.0.0"
},
"no-array-isarray": {
"supported": ">=0.10.0"
},
"no-array-of": {
"supported": ">=4.0.0"
},
"no-array-prototype-copywithin": {
"supported": ">=4.0.0"
},
"no-array-prototype-entries": {
"supported": ">=0.12.0"
},
"no-array-prototype-every": {
"supported": ">=0.10.0"
},
"no-array-prototype-fill": {
"supported": ">=4.0.0"
},
"no-array-prototype-filter": {
"supported": ">=0.10.0"
},
"no-array-prototype-find": {
"supported": ">=4.0.0"
},
"no-array-prototype-findindex": {
"supported": ">=4.0.0"
},
"no-array-prototype-findlast-findlastindex": {
"supported": ">=18.0.0"
},
"no-array-prototype-flat": {
"supported": ">=11.0.0"
},
"no-array-prototype-foreach": {
"supported": ">=0.10.0"
},
"no-array-prototype-includes": {
"supported": ">=6.0.0"
},
"no-array-prototype-indexof": {
"supported": ">=0.10.0"
},
"no-array-prototype-keys": {
"supported": ">=0.12.0"
},
"no-array-prototype-lastindexof": {
"supported": ">=0.10.0"
},
"no-array-prototype-map": {
"supported": ">=0.10.0"
},
"no-array-prototype-reduce": {
"supported": ">=0.10.0"
},
"no-array-prototype-reduceright": {
"supported": ">=0.10.0"
},
"no-array-prototype-some": {
"supported": ">=0.10.0"
},
"no-array-prototype-toreversed": {
"supported": ">=20.0.0"
},
"no-array-prototype-tosorted": {
"supported": ">=20.0.0"
},
"no-array-prototype-tospliced": {
"supported": ">=20.0.0"
},
"no-array-prototype-values": {
"supported": ">=10.9.0"
},
"no-array-prototype-with": {
"supported": ">=20.0.0"
},
"no-array-string-prototype-at": {
"supported": ">=16.6.0"
},
"no-arrow-functions": {
"supported": ">=4.0.0"
},
"no-async-functions": {
"supported": ">=7.6.0"
},
"no-async-iteration": {
"supported": ">=10.0.0"
},
"no-atomics-waitasync": {
"supported": ">=16.0.0"
},
"no-atomics": {
"supported": ">=8.10.0"
},
"no-bigint": {
"supported": ">=10.4.0"
},
"no-binary-numeric-literals": {
"supported": ">=4.0.0"
},
"no-block-scoped-functions": {
"supported": ">=4.0.0",
"strictMode": ">=6.0.0"
},
"no-block-scoped-variables": {
"supported": ">=4.0.0",
"strictMode": ">=6.0.0"
},
"no-class-fields": {
"supported": ">=12.0.0"
},
"no-class-static-block": {
"supported": ">=16.11.0"
},
"no-classes": {
"supported": ">=4.0.0",
"strictMode": ">=6.0.0"
},
"no-computed-properties": {
"supported": ">=4.0.0"
},
"no-date-now": {
"supported": ">=0.10.0"
},
"no-date-prototype-getyear-setyear": {
"supported": ">=0.10.0",
"deprecated": ">=0.10.0"
},
"no-date-prototype-togmtstring": {
"supported": ">=0.10.0",
"deprecated": ">=0.10.0"
},
"no-default-parameters": {
"supported": ">=6.0.0"
},
"no-destructuring": {
"supported": ">=6.0.0"
},
"no-dynamic-import": {
"supported": "^12.17.0 || >=13.2.0"
},
"no-error-cause": {
"supported": ">=16.9.0"
},
"no-escape-unescape": {
"supported": ">=0.10.0",
"deprecated": ">=0.10.0"
},
"no-exponential-operators": {
"supported": ">=7.0.0"
},
"no-export-ns-from": {
"supported": ">=13.2.0"
},
"no-for-of-loops": {
"supported": ">=0.12.0"
},
"no-function-declarations-in-if-statement-clauses-without-block": {
"supported": ">=0.10.0"
},
"no-function-prototype-bind": {
"supported": ">=0.10.0"
},
"no-generators": {
"supported": ">=4.0.0"
},
"no-global-this": {
"supported": ">=12.0.0"
},
"no-hashbang": {
"supported": ">=12.5.0"
},
"no-import-meta": {
"supported": ">=10.4.0"
},
"no-initializers-in-for-in": {
"supported": ">=0.10.0"
},
"no-intl-datetimeformat-prototype-formatrange": {
"supported": ">=12.9.0"
},
"no-intl-datetimeformat-prototype-formattoparts": {
"supported": ">=12.9.0"
},
"no-intl-displaynames": {
"supported": ">=14.0.0"
},
"no-intl-getcanonicallocales": {
"supported": ">=7.0.0"
},
"no-intl-listformat": {
"supported": ">=12.0.0"
},
"no-intl-locale": {
"supported": ">=12.0.0"
},
"no-intl-numberformat-prototype-formatrange": {
"supported": ">=19.0.0"
},
"no-intl-numberformat-prototype-formatrangetoparts": {
"supported": ">=19.0.0"
},
"no-intl-numberformat-prototype-formattoparts": {
"supported": ">=10.0.0"
},
"no-intl-pluralrules-prototype-selectrange": {
"supported": ">=19.0.0"
},
"no-intl-pluralrules": {
"supported": ">=10.0.0"
},
"no-intl-relativetimeformat": {
"supported": ">=12.0.0"
},
"no-intl-segmenter": {
"supported": ">=16.0.0"
},
"no-intl-supportedvaluesof": {
"supported": ">=18.0.0"
},
"no-json-superset": {
"supported": ">=10.0.0"
},
"no-json": {
"supported": ">=0.10.0"
},
"no-keyword-properties": {
"supported": ">=0.10.0"
},
"no-labelled-function-declarations": {
"supported": ">=0.10.0"
},
"no-legacy-object-prototype-accessor-methods": {
"supported": ">=0.10.0",
"deprecated": ">=0.10.0"
},
"no-logical-assignment-operators": {
"supported": ">=15.0.0"
},
"no-malformed-template-literals": {
"supported": ">=8.10.0"
},
"no-map": {
"supported": ">=0.12.0"
},
"no-math-acosh": {
"supported": ">=0.12.0"
},
"no-math-asinh": {
"supported": ">=0.12.0"
},
"no-math-atanh": {
"supported": ">=0.12.0"
},
"no-math-cbrt": {
"supported": ">=0.12.0"
},
"no-math-clz32": {
"supported": ">=0.12.0"
},
"no-math-cosh": {
"supported": ">=0.12.0"
},
"no-math-expm1": {
"supported": ">=0.12.0"
},
"no-math-fround": {
"supported": ">=0.12.0"
},
"no-math-hypot": {
"supported": ">=0.12.0"
},
"no-math-imul": {
"supported": ">=0.12.0"
},
"no-math-log10": {
"supported": ">=0.12.0"
},
"no-math-log1p": {
"supported": ">=0.12.0"
},
"no-math-log2": {
"supported": ">=0.12.0"
},
"no-math-sign": {
"supported": ">=0.12.0"
},
"no-math-sinh": {
"supported": ">=0.12.0"
},
"no-math-tanh": {
"supported": ">=0.12.0"
},
"no-math-trunc": {
"supported": ">=0.12.0"
},
"no-modules": {
"supported": "^12.17.0 || >=13.2.0"
},
"no-new-target": {
"aliases": ["new.target"],
"supported": ">=5.0.0"
},
"no-nullish-coalescing-operators": {
"supported": ">=14.0.0"
},
"no-number-epsilon": {
"supported": ">=0.12.0"
},
"no-number-isfinite": {
"supported": ">=0.10.0"
},
"no-number-isinteger": {
"supported": ">=0.10.0"
},
"no-number-isnan": {
"supported": ">=0.10.0"
},
"no-number-issafeinteger": {
"supported": ">=0.12.0"
},
"no-number-maxsafeinteger": {
"supported": ">=0.12.0"
},
"no-number-minsafeinteger": {
"supported": ">=0.12.0"
},
"no-number-parsefloat": {
"supported": ">=0.12.0"
},
"no-number-parseint": {
"supported": ">=0.12.0"
},
"no-numeric-separators": {
"supported": ">=12.5.0"
},
"no-object-assign": {
"supported": ">=4.0.0"
},
"no-object-create": {
"supported": ">=0.10.0"
},
"no-object-defineproperties": {
"supported": ">=0.10.0"
},
"no-object-defineproperty": {
"supported": ">=0.10.0"
},
"no-object-entries": {
"supported": ">=7.0.0"
},
"no-object-freeze": {
"supported": ">=0.10.0"
},
"no-object-fromentries": {
"supported": ">=12.0.0"
},
"no-object-getownpropertydescriptor": {
"supported": ">=0.10.0"
},
"no-object-getownpropertydescriptors": {
"supported": ">=7.0.0"
},
"no-object-getownpropertynames": {
"supported": ">=0.10.0"
},
"no-object-getownpropertysymbols": {
"supported": ">=0.12.0"
},
"no-object-getprototypeof": {
"supported": ">=0.10.0"
},
"no-object-hasown": {
"supported": ">=16.9.0"
},
"no-object-is": {
"supported": ">=0.10.0"
},
"no-object-isextensible": {
"supported": ">=0.10.0"
},
"no-object-isfrozen": {
"supported": ">=0.10.0"
},
"no-object-issealed": {
"supported": ">=0.10.0"
},
"no-object-keys": {
"supported": ">=0.10.0"
},
"no-object-map-groupby": {
"supported": ">=21.0.0"
},
"no-object-preventextensions": {
"supported": ">=0.10.0"
},
"no-object-seal": {
"supported": ">=0.10.0"
},
"no-object-setprototypeof": {
"supported": ">=0.12.0"
},
"no-object-super-properties": {
"supported": ">=4.0.0"
},
"no-object-values": {
"supported": ">=7.0.0"
},
"no-octal-numeric-literals": {
"supported": ">=4.0.0"
},
"no-optional-catch-binding": {
"supported": ">=10.0.0"
},
"no-optional-chaining": {
"supported": ">=14.0.0"
},
"no-private-in": {
"supported": ">=16.4.0"
},
"no-promise-all-settled": {
"supported": ">=12.9.0"
},
"no-promise-any": {
"supported": ">=15.0.0"
},
"no-promise-prototype-finally": {
"supported": ">=10.0.0"
},
"no-promise-withresolvers": {
"supported": ">=22.11.0"
},
"no-promise": {
"supported": ">=0.12.0"
},
"no-property-shorthands": {
"supported": ">=4.0.0"
},
"no-proxy": {
"supported": ">=6.0.0"
},
"no-reflect": {
"supported": ">=6.0.0"
},
"no-regexp-d-flag": {
"supported": ">=16.0.0"
},
"no-regexp-lookbehind-assertions": {
"aliases": ["regexpLookbehind"],
"supported": ">=8.10.0"
},
"no-regexp-named-capture-groups": {
"supported": ">=10.0.0"
},
"no-regexp-prototype-compile": {
"supported": ">=0.10.0"
},
"no-regexp-prototype-flags": {
"supported": ">=6.0.0"
},
"no-regexp-s-flag": {
"aliases": ["regexpS"],
"supported": ">=8.10.0"
},
"no-regexp-u-flag": {
"aliases": ["regexpU"],
"supported": ">=6.0.0"
},
"no-regexp-unicode-property-escapes-2019": {
"supported": ">=12.1.0 || ^10.16.0"
},
"no-regexp-unicode-property-escapes-2020": {
"supported": ">=13.12.0 || ^12.17.0"
},
"no-regexp-unicode-property-escapes-2021": {
"supported": ">=17.2.0 || ^16.14.0"
},
"no-regexp-unicode-property-escapes-2022": {
"supported": ">=19.1.0 || ^18.13.0"
},
"no-regexp-unicode-property-escapes-2023": {
"supported": null
},
"no-regexp-unicode-property-escapes": {
"aliases": ["regexpUnicodeProperties"],
"supported": ">=10.0.0"
},
"no-regexp-v-flag": {
"supported": ">=20.0.0"
},
"no-regexp-y-flag": {
"aliases": ["regexpY"],
"supported": ">=6.0.0"
},
"no-resizable-and-growable-arraybuffers": {
"supported": ">=20.0.0"
},
"no-rest-parameters": {
"supported": ">=6.0.0"
},
"no-rest-spread-properties": {
"supported": ">=8.3.0"
},
"no-set": {
"supported": ">=0.12.0"
},
"no-shadow-catch-param": {
"supported": ">=0.10.0"
},
"no-shared-array-buffer": {
"supported": ">=8.10.0"
},
"no-spread-elements": {
"supported": ">=5.0.0"
},
"no-string-create-html-methods": {
"supported": ">=0.10.0",
"deprecated": ">=0.10.0"
},
"no-string-fromcodepoint": {
"supported": ">=4.0.0"
},
"no-string-prototype-codepointat": {
"supported": ">=4.0.0"
},
"no-string-prototype-endswith": {
"supported": ">=4.0.0"
},
"no-string-prototype-includes": {
"supported": ">=6.0.0"
},
"no-string-prototype-iswellformed-towellformed": {
"supported": ">=20.0.0"
},
"no-string-prototype-matchall": {
"supported": ">=12.0.0"
},
"no-string-prototype-normalize": {
"supported": ">=0.12.0"
},
"no-string-prototype-padstart-padend": {
"supported": ">=8.0.0"
},
"no-string-prototype-repeat": {
"supported": ">=4.0.0"
},
"no-string-prototype-replaceall": {
"supported": ">=15.0.0"
},
"no-string-prototype-startswith": {
"supported": ">=4.0.0"
},
"no-string-prototype-substr": {
"supported": ">=0.10.0"
},
"no-string-prototype-trim": {
"supported": ">=0.10.0"
},
"no-string-prototype-trimleft-trimright": {
"supported": ">=0.10.0"
},
"no-string-prototype-trimstart-trimend": {
"supported": ">=10.0.0"
},
"no-string-raw": {
"supported": ">=4.0.0"
},
"no-subclassing-builtins": {
"supported": ">=4.0.0"
},
"no-symbol-prototype-description": {
"supported": ">=11.0.0"
},
"no-symbol": {
"supported": ">=0.12.0"
},
"no-template-literals": {
"supported": ">=4.0.0"
},
"no-top-level-await": {
"supported": ">=14.8.0"
},
"no-trailing-commas": {
"supported": ">=0.10.0"
},
"no-trailing-function-commas": {
"aliases": ["trailingCommasInFunctions"],
"supported": ">=8.0.0"
},
"no-typed-arrays": {
"supported": ">=0.10.0"
},
"no-unicode-codepoint-escapes": {
"aliases": ["unicodeCodePointEscapes"],
"supported": ">=4.0.0"
},
"no-weak-map": {
"supported": ">=0.12.0"
},
"no-weak-set": {
"supported": ">=0.12.0"
},
"no-weakrefs": {
"supported": ">=14.6.0"
}
}
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=cloneProviderBinding.spec.d.ts.map
@@ -0,0 +1,6 @@
import type { TSchema } from '../schema/index.mjs';
import { type TReadonly } from '../readonly/index.mjs';
import { type TOptional } from '../optional/index.mjs';
export type TReadonlyOptional<T extends TSchema> = TOptional<T> & TReadonly<T>;
/** `[Json]` Creates a Readonly and Optional property */
export declare function ReadonlyOptional<T extends TSchema>(schema: T): TReadonly<TOptional<T>>;
@@ -0,0 +1,76 @@
/*
* 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 {AriaLabelingProps, DOMProps, LinkDOMProps} from '@react-types/shared';
const DOMPropNames = new Set([
'id'
]);
const labelablePropNames = new Set([
'aria-label',
'aria-labelledby',
'aria-describedby',
'aria-details'
]);
// See LinkDOMProps in dom.d.ts.
const linkPropNames = new Set([
'href',
'hrefLang',
'target',
'rel',
'download',
'ping',
'referrerPolicy'
]);
interface Options {
/**
* If labelling associated aria properties should be included in the filter.
*/
labelable?: boolean,
/** Whether the element is a link and should include DOM props for <a> elements. */
isLink?: boolean,
/**
* A Set of other property names that should be included in the filter.
*/
propNames?: Set<string>
}
const propRe = /^(data-.*)$/;
/**
* Filters out all props that aren't valid DOM props or defined via override prop obj.
* @param props - The component props to be filtered.
* @param opts - Props to override.
*/
export function filterDOMProps(props: DOMProps & AriaLabelingProps & LinkDOMProps, opts: Options = {}): DOMProps & AriaLabelingProps {
let {labelable, isLink, propNames} = opts;
let filteredProps = {};
for (const prop in props) {
if (
Object.prototype.hasOwnProperty.call(props, prop) && (
DOMPropNames.has(prop) ||
(labelable && labelablePropNames.has(prop)) ||
(isLink && linkPropNames.has(prop)) ||
propNames?.has(prop) ||
propRe.test(prop)
)
) {
filteredProps[prop] = props[prop];
}
}
return filteredProps;
}
@@ -0,0 +1,101 @@
# 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.3.0](https://github.com/ljharb/es-to-primitive/compare/v1.2.1...v1.3.0) - 2024-11-26
### Commits
- [actions] reuse common workflows [`bb72efc`](https://github.com/ljharb/es-to-primitive/commit/bb72efc7e04ae11b84e4aecf120a4e9063e34428)
- [Tests] use `es-value-fixtures` [`a912f7b`](https://github.com/ljharb/es-to-primitive/commit/a912f7b675333735c1c980cda88772ac1870395b)
- [Tests] migrate tests to Github Actions [`510baf0`](https://github.com/ljharb/es-to-primitive/commit/510baf092633a62d59866fbf56836ce42c717c70)
- [New] add types [`69ba1fd`](https://github.com/ljharb/es-to-primitive/commit/69ba1fdcac834b03698739990ba98fe6007024dc)
- [meta] remove unused Makefile [`4ea66e6`](https://github.com/ljharb/es-to-primitive/commit/4ea66e62ef4afa0102eb8335ba3e003e8332f664)
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`3c31937`](https://github.com/ljharb/es-to-primitive/commit/3c31937119ca24fd6d00e362d6435a28cfe9e91c)
- [meta] do not publish github action workflow files [`389567e`](https://github.com/ljharb/es-to-primitive/commit/389567e8523b65b90b529f1029d215fd4f12ac14)
- [meta] use `npmignore` to autogenerate an npmignore file [`9f3aa76`](https://github.com/ljharb/es-to-primitive/commit/9f3aa7651791ab9386408035491a1ba4fec4c432)
- [actions] split out node 10-20, and 20+ [`c60d7d8`](https://github.com/ljharb/es-to-primitive/commit/c60d7d822a36880bce0535335c70fdc2a8da232d)
- [Tests] run `nyc` on all tests; use `tape` runner [`29cbb89`](https://github.com/ljharb/es-to-primitive/commit/29cbb89800b5cfef9bef3ae7e0e779c782e1bbb9)
- [meta] add `auto-changelog` [`ea744b2`](https://github.com/ljharb/es-to-primitive/commit/ea744b2a0bda788b0d957c1787e41434e98b0155)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `function.prototype.name`, `has-symbols`, `object-inspect`, `object-is`, `tape` [`e5c3c79`](https://github.com/ljharb/es-to-primitive/commit/e5c3c792f67685a9647e817e7582d4c76a876f69)
- [actions] add automatic rebasing / merge commit blocking [`a5a6f00`](https://github.com/ljharb/es-to-primitive/commit/a5a6f0066540c91c8aa45a4921f1cd2349f435ba)
- [Dev Deps] update `@ljharb/eslint-config`, `es-value-fixtures`, `function.prototype.name`, `npmignore`, `object-inspect`, `object-is`, `tape` [`7941fd5`](https://github.com/ljharb/es-to-primitive/commit/7941fd530fb3a73f923b76c739335ffc21793ad6)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `es-value-fixtures`, `foreach`, `object-inspect`, `tape` [`eb1c79c`](https://github.com/ljharb/es-to-primitive/commit/eb1c79c288c89154014634b94f64308344901eaf)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `function.prototype.name`, `object-inspect`, `safe-publish-latest`, `tape` [`249b42f`](https://github.com/ljharb/es-to-primitive/commit/249b42f1ce069ea78a032f10414d1c1c0b6c6345)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `function.prototype.name`, `object-inspect`, `object-is`, `tape` [`d57d5e9`](https://github.com/ljharb/es-to-primitive/commit/d57d5e9ea5ea4778f383e2f1aa637be0be80dd78)
- [actions] update codecov uploader [`003b62c`](https://github.com/ljharb/es-to-primitive/commit/003b62c483372d5eac38f51925b6cbdf5d7a0665)
- [actions] add "Allow Edits" workflow [`75ee990`](https://github.com/ljharb/es-to-primitive/commit/75ee99083626dc14558ae294c127e4aaf925d214)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `object-is`; add `safe-publish-latest` [`ba5da7b`](https://github.com/ljharb/es-to-primitive/commit/ba5da7bffd93c3cc2e079ad751a3e678333a973e)
- [readme] remove travis badge [`6f7aec7`](https://github.com/ljharb/es-to-primitive/commit/6f7aec78e4f1ebfca74c384a837063f4099e7b9b)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`3291fd5`](https://github.com/ljharb/es-to-primitive/commit/3291fd567695b45bddc58e5ec3da2dcce0e5ccc7)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `function.prototype.name`, `has-symbols`, `object-inspect` [`53007f2`](https://github.com/ljharb/es-to-primitive/commit/53007f25d1f26e301b4f41d070c423723bed1690)
- [actions] update checkout action [`69640db`](https://github.com/ljharb/es-to-primitive/commit/69640dbb9ddafe05527388fe72bda1aca08d07b5)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `object-is`, `tape`; add `aud` [`c9d644e`](https://github.com/ljharb/es-to-primitive/commit/c9d644ef3c6b2210e86ce2d3aa8e8b1668f6801d)
- [Tests] use `for-each` instead of `foreach` [`e9117bb`](https://github.com/ljharb/es-to-primitive/commit/e9117bb055417cb721dbf5dbe1d23b058a8241f2)
- [readme] add github actions/codecov badges [`53cd375`](https://github.com/ljharb/es-to-primitive/commit/53cd375ab22a25d4bada35000473e30c22ee2028)
- [Deps] update `is-callable`, `is-date-object`, `is-symbol` [`8116c68`](https://github.com/ljharb/es-to-primitive/commit/8116c68a8ba555f8daaf1d71a60c974d3439c94b)
- [Tests] fix test skipping for `Symbol.toPrimitive` [`e6268ef`](https://github.com/ljharb/es-to-primitive/commit/e6268ef31b34cb5263501ba9735ccce78a07e504)
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`da41c40`](https://github.com/ljharb/es-to-primitive/commit/da41c40399c2a574f74a59b85800d9934b91d49a)
- [Deps] update `is-callable`, `is-date-object` [`96fe13f`](https://github.com/ljharb/es-to-primitive/commit/96fe13ff3c486c7857c2ca69ac70161ef0e5b4a1)
- [Tests] replace `aud` with `npm audit` [`0b53154`](https://github.com/ljharb/es-to-primitive/commit/0b531546081427cb8a4fc06fde5540ba0b287b5b)
- [meta] use `prepublishOnly` script for npm 7+ [`9d7d485`](https://github.com/ljharb/es-to-primitive/commit/9d7d4856d4b5f28c68de2aba068522b9a85ee669)
- [Deps] update `is-callable` [`3c990b6`](https://github.com/ljharb/es-to-primitive/commit/3c990b646813e2470b19460e32801113f9acc13b)
- [Deps] update `is-callable` [`9bcfff2`](https://github.com/ljharb/es-to-primitive/commit/9bcfff276ce078034404b6b27e4f74beb530002c)
- [Deps] update `is-callable` [`1eb5478`](https://github.com/ljharb/es-to-primitive/commit/1eb5478e0c93b230b7bc67f9fef963d94a391117)
- [meta] only run `aud` on prod deps [`1fcd896`](https://github.com/ljharb/es-to-primitive/commit/1fcd89684a4351c15fec2cb289ecc331f917b80e)
- [Deps] update `is-symbol` [`7174a47`](https://github.com/ljharb/es-to-primitive/commit/7174a474f4f9f07319c81f046b10446caf9b3af0)
<!-- auto-changelog-above -->
1.2.1 / 2019-11-08
=================
* [readme] remove testling URLs
* [meta] add `funding` field
* [meta] create FUNDING.yml
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `replace`, `semver`, `tape`, `function.prototype.name`
* [Tests] use shared travis-ci configs
* [Tests] Add es5 tests for `symbol` types (#45)
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
* [Tests] remove `jscs`
1.2.0 / 2018-09-27
=================
* [New] create ES2015 entry point/property, to replace ES6
* [Fix] Ensure optional arguments are not part of the length (#29)
* [Deps] update `is-callable`
* [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `object-inspect`, `replace`
* [Tests] avoid util.inspect bug with `new Date(NaN)` on node v6.0 and v6.1.
* [Tests] up to `node` `v10.11`, `v9.11`, `v8.12`, `v6.14`, `v4.9`
1.1.1 / 2016-01-03
=================
* [Fix: ES5] fix coercion logic: ES5’s ToPrimitive does not coerce any primitive value, regardless of hint (#2)
1.1.0 / 2015-12-27
=================
* [New] add `Symbol.toPrimitive` support
* [Deps] update `is-callable`, `is-date-object`
* [Dev Deps] update `eslint`, `tape`, `semver`, `jscs`, `covert`, `nsp`, `@ljharb/eslint-config`
* [Dev Deps] remove unused deps
* [Tests] up to `node` `v5.3`
* [Tests] fix npm upgrades on older node versions
* [Tests] fix testling
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
1.0.1 / 2016-01-03
=================
* [Fix: ES5] fix coercion logic: ES5’s ToPrimitive does not coerce any primitive value, regardless of hint (#2)
* [Deps] update `is-callable`, `is-date-object`
* [Dev Deps] update `eslint`, `tape`, `semver`, `jscs`, `covert`, `nsp`, `@ljharb/eslint-config`
* [Dev Deps] remove unused deps
* [Tests] up to `node` `v5.3`
* [Tests] fix npm upgrades on older node versions
* [Tests] fix testling
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
1.0.0 / 2015-03-19
=================
* Initial release.
@@ -0,0 +1,33 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
module.exports = {
meta: {
docs: {
description: "disallow async iteration.",
category: "ES2018",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-async-iteration.html",
},
fixable: null,
messages: {
forbidden: "ES2018 async iteration is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
":function[async=true][generator=true]"(node) {
context.report({ node, messageId: "forbidden" })
},
"ForOfStatement[await=true]"(node) {
context.report({ node, messageId: "forbidden" })
},
}
},
}
@@ -0,0 +1 @@
{"name":"read-pkg","version":"6.0.0","requiresBuild":false,"files":{"license":{"checkedAt":1794532093291,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1794532120007,"integrity":"sha512-g/KzV7Gvc5xVlXhSDUjV+kJpi6PFj+/nm92epTWQqN54ISU1CFiIXCqV8X3SUz9dw+Oydi50S6gbXL6XXaw7Lw==","mode":420,"size":704},"package.json":{"checkedAt":1794532120008,"integrity":"sha512-syR13hmADXO+EXNkjC/Q7NXwxE13i0gn2XurSUOhQungOXJY8zga1R/pMpvUEwyxPtvHZRSyKkNS3O530LqYQQ==","mode":420,"size":902},"readme.md":{"checkedAt":1794532120008,"integrity":"sha512-fNIkgFhy+M1pPQiy5gRPO3UbSNOWdF+sx9OvfSB1h5Vkf1UUkXNwbVdmuRDtg6PK+aVaSukRvhFtyW2Bx/AlHg==","mode":420,"size":1645},"index.d.ts":{"checkedAt":1794532120008,"integrity":"sha512-R+FEa/4HgDhnCKfag5RgvRw+ljXlmF84tTsSq+CEeXxJm8imJ2XZ1rcRvOG1NKWvSPr1SjF92sA7QDdEo4GRHg==","mode":420,"size":1402}}}
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,eAAe,CAAC,qBAAqB,CAAC;AAC1D","sources":["packages/@react-aria/breadcrumbs/intl/pl-PL.json"],"sourcesContent":["{\n \"breadcrumbs\": \"Struktura nawigacyjna\"\n}\n"],"names":[],"version":3,"file":"pl-PL.main.js.map"}
@@ -0,0 +1,16 @@
var $64b7e390f5791490$exports = {};
$64b7e390f5791490$exports = {
"ascending": `oplopend`,
"ascendingSort": (args)=>`gesorteerd in oplopende volgorde in kolom ${args.columnName}`,
"columnSize": (args)=>`${args.value} pixels`,
"descending": `aflopend`,
"descendingSort": (args)=>`gesorteerd in aflopende volgorde in kolom ${args.columnName}`,
"resizerDescription": `Druk op Enter om het formaat te wijzigen`,
"select": `Selecteren`,
"selectAll": `Alles selecteren`,
"sortable": `sorteerbare kolom`
};
export {$64b7e390f5791490$exports as default};
//# sourceMappingURL=nl-NL.module.js.map
@@ -0,0 +1,239 @@
// Copyright (c) 2015 Ryan Prichard
//
// 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.
#include "DebugShowInput.h"
#include <windows.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "../shared/StringBuilder.h"
#include "InputMap.h"
namespace {
struct Flag {
DWORD value;
const char *text;
};
static const Flag kButtonStates[] = {
{ FROM_LEFT_1ST_BUTTON_PRESSED, "1" },
{ FROM_LEFT_2ND_BUTTON_PRESSED, "2" },
{ FROM_LEFT_3RD_BUTTON_PRESSED, "3" },
{ FROM_LEFT_4TH_BUTTON_PRESSED, "4" },
{ RIGHTMOST_BUTTON_PRESSED, "R" },
};
static const Flag kControlKeyStates[] = {
{ CAPSLOCK_ON, "CapsLock" },
{ ENHANCED_KEY, "Enhanced" },
{ LEFT_ALT_PRESSED, "LAlt" },
{ LEFT_CTRL_PRESSED, "LCtrl" },
{ NUMLOCK_ON, "NumLock" },
{ RIGHT_ALT_PRESSED, "RAlt" },
{ RIGHT_CTRL_PRESSED, "RCtrl" },
{ SCROLLLOCK_ON, "ScrollLock" },
{ SHIFT_PRESSED, "Shift" },
};
static const Flag kMouseEventFlags[] = {
{ DOUBLE_CLICK, "Double" },
{ 8/*MOUSE_HWHEELED*/, "HWheel" },
{ MOUSE_MOVED, "Move" },
{ MOUSE_WHEELED, "Wheel" },
};
static void writeFlags(StringBuilder &out, DWORD flags,
const char *remainderName,
const Flag *table, size_t tableSize,
char pre, char sep, char post) {
DWORD remaining = flags;
bool wroteSomething = false;
for (size_t i = 0; i < tableSize; ++i) {
const Flag &f = table[i];
if ((f.value & flags) == f.value) {
if (!wroteSomething && pre != '\0') {
out << pre;
} else if (wroteSomething && sep != '\0') {
out << sep;
}
out << f.text;
wroteSomething = true;
remaining &= ~f.value;
}
}
if (remaining != 0) {
if (!wroteSomething && pre != '\0') {
out << pre;
} else if (wroteSomething && sep != '\0') {
out << sep;
}
out << remainderName << "(0x" << hexOfInt(remaining) << ')';
wroteSomething = true;
}
if (wroteSomething && post != '\0') {
out << post;
}
}
template <size_t n>
static void writeFlags(StringBuilder &out, DWORD flags,
const char *remainderName,
const Flag (&table)[n],
char pre, char sep, char post) {
writeFlags(out, flags, remainderName, table, n, pre, sep, post);
}
} // anonymous namespace
std::string controlKeyStatePrefix(DWORD controlKeyState) {
StringBuilder sb;
writeFlags(sb, controlKeyState,
"keyState", kControlKeyStates, '\0', '-', '-');
return sb.str_moved();
}
std::string mouseEventToString(const MOUSE_EVENT_RECORD &mer) {
const uint16_t buttons = mer.dwButtonState & 0xFFFF;
const int16_t wheel = mer.dwButtonState >> 16;
StringBuilder sb;
sb << "pos=" << mer.dwMousePosition.X << ','
<< mer.dwMousePosition.Y;
writeFlags(sb, mer.dwControlKeyState, "keyState", kControlKeyStates, ' ', ' ', '\0');
writeFlags(sb, mer.dwEventFlags, "flags", kMouseEventFlags, ' ', ' ', '\0');
writeFlags(sb, buttons, "buttons", kButtonStates, ' ', ' ', '\0');
if (wheel != 0) {
sb << " wheel=" << wheel;
}
return sb.str_moved();
}
void debugShowInput(bool enableMouse, bool escapeInput) {
HANDLE conin = GetStdHandle(STD_INPUT_HANDLE);
DWORD origConsoleMode = 0;
if (!GetConsoleMode(conin, &origConsoleMode)) {
fprintf(stderr, "Error: could not read console mode -- "
"is STDIN a console handle?\n");
exit(1);
}
DWORD restoreConsoleMode = origConsoleMode;
if (enableMouse && !(restoreConsoleMode & ENABLE_EXTENDED_FLAGS)) {
// We need to disable QuickEdit mode, because it blocks mouse events.
// If ENABLE_EXTENDED_FLAGS wasn't originally in the console mode, then
// we have no way of knowning whether QuickEdit or InsertMode are
// currently enabled. Enable them both (eventually), because they're
// sensible defaults. This case shouldn't happen typically. See
// misc/EnableExtendedFlags.txt.
restoreConsoleMode |= ENABLE_EXTENDED_FLAGS;
restoreConsoleMode |= ENABLE_QUICK_EDIT_MODE;
restoreConsoleMode |= ENABLE_INSERT_MODE;
}
DWORD newConsoleMode = restoreConsoleMode;
newConsoleMode &= ~ENABLE_PROCESSED_INPUT;
newConsoleMode &= ~ENABLE_LINE_INPUT;
newConsoleMode &= ~ENABLE_ECHO_INPUT;
newConsoleMode |= ENABLE_WINDOW_INPUT;
if (enableMouse) {
newConsoleMode |= ENABLE_MOUSE_INPUT;
newConsoleMode &= ~ENABLE_QUICK_EDIT_MODE;
} else {
newConsoleMode &= ~ENABLE_MOUSE_INPUT;
}
if (escapeInput) {
// As of this writing (2016-06-05), Microsoft has shipped two preview
// builds of Windows 10 (14316 and 14342) that include a new "Windows
// Subsystem for Linux" that runs Ubuntu in a new subsystem. Running
// bash in this subsystem requires the non-legacy console mode, and the
// console input buffer is put into a special mode where escape
// sequences are written into the console input buffer. This mode is
// enabled with the 0x200 flag, which is as-yet undocumented.
// See https://github.com/rprichard/winpty/issues/82.
newConsoleMode |= 0x200;
}
if (!SetConsoleMode(conin, newConsoleMode)) {
fprintf(stderr, "Error: could not set console mode "
"(0x%x -> 0x%x -> 0x%x)\n",
static_cast<unsigned int>(origConsoleMode),
static_cast<unsigned int>(newConsoleMode),
static_cast<unsigned int>(restoreConsoleMode));
exit(1);
}
printf("\nPress any keys -- Ctrl-D exits\n\n");
INPUT_RECORD records[32];
DWORD actual = 0;
bool finished = false;
while (!finished &&
ReadConsoleInputW(conin, records, 32, &actual) && actual >= 1) {
StringBuilder sb;
for (DWORD i = 0; i < actual; ++i) {
const INPUT_RECORD &record = records[i];
if (record.EventType == KEY_EVENT) {
const KEY_EVENT_RECORD &ker = record.Event.KeyEvent;
InputMap::Key key = {
ker.wVirtualKeyCode,
ker.uChar.UnicodeChar,
static_cast<uint16_t>(ker.dwControlKeyState),
};
sb << "key: " << (ker.bKeyDown ? "dn" : "up")
<< " rpt=" << ker.wRepeatCount
<< " scn=" << (ker.wVirtualScanCode ? "0x" : "") << hexOfInt(ker.wVirtualScanCode)
<< ' ' << key.toString() << '\n';
if ((ker.dwControlKeyState &
(LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) &&
ker.wVirtualKeyCode == 'D') {
finished = true;
break;
} else if (ker.wVirtualKeyCode == 0 &&
ker.wVirtualScanCode == 0 &&
ker.uChar.UnicodeChar == 4) {
// Also look for a zeroed-out Ctrl-D record generated for
// ENABLE_VIRTUAL_TERMINAL_INPUT.
finished = true;
break;
}
} else if (record.EventType == MOUSE_EVENT) {
const MOUSE_EVENT_RECORD &mer = record.Event.MouseEvent;
sb << "mouse: " << mouseEventToString(mer) << '\n';
} else if (record.EventType == WINDOW_BUFFER_SIZE_EVENT) {
const WINDOW_BUFFER_SIZE_RECORD &wbsr =
record.Event.WindowBufferSizeEvent;
sb << "buffer-resized: dwSize=("
<< wbsr.dwSize.X << ','
<< wbsr.dwSize.Y << ")\n";
} else if (record.EventType == MENU_EVENT) {
const MENU_EVENT_RECORD &mer = record.Event.MenuEvent;
sb << "menu-event: commandId=0x"
<< hexOfInt(mer.dwCommandId) << '\n';
} else if (record.EventType == FOCUS_EVENT) {
const FOCUS_EVENT_RECORD &fer = record.Event.FocusEvent;
sb << "focus: " << (fer.bSetFocus ? "gained" : "lost") << '\n';
}
}
const auto str = sb.str_moved();
fwrite(str.data(), 1, str.size(), stdout);
fflush(stdout);
}
SetConsoleMode(conin, restoreConsoleMode);
}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAoB,GAA8B,EAAE,OAAqC;IACvG,IAAI,aAAa,oBAAA,8BAAA,QAAS,UAAU;IACpC,IAAI,CAAC,kBAAkB,oBAAoB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAEvD,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,CAAA,gBAAA,0BAAA,IAAK,OAAO,KAAI,CAAC,YAAY;YAC/B,IAAI,SAAS;gBACX,IAAI,IAAI,OAAO,EAAE;oBACf,IAAI,SAAS,CAAA,GAAA,gDAAqB,EAAE,IAAI,OAAO,EAAE;wBAAC,UAAU;oBAAI;oBAChE,oBAAoB,CAAC,CAAC,OAAO,QAAQ;gBACvC;YACF;YAEA;YAEA,qFAAqF;YACrF,IAAI,WAAW,IAAI,iBAAiB;YACpC,SAAS,OAAO,CAAC,IAAI,OAAO,EAAE;gBAC5B,SAAS;gBACT,WAAW;gBACX,YAAY;gBACZ,iBAAiB;oBAAC;oBAAY;iBAAW;YAC3C;YAEA,OAAO;gBACL,qFAAqF;gBACrF,wFAAwF;gBACxF,4FAA4F;gBAC5F,yFAAyF;gBACzF,SAAS,UAAU;YACrB;QACF;IACF;IAEA,OAAO,aAAa,QAAQ;AAC9B","sources":["packages/@react-aria/focus/src/useHasTabbableChild.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {getFocusableTreeWalker} from './FocusScope';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\ninterface AriaHasTabbableChildOptions {\n isDisabled?: boolean\n}\n\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n\n/**\n * Returns whether an element has a tabbable child, and updates as children change.\n * @private\n */\nexport function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean {\n let isDisabled = options?.isDisabled;\n let [hasTabbableChild, setHasTabbableChild] = useState(false);\n\n useLayoutEffect(() => {\n if (ref?.current && !isDisabled) {\n let update = () => {\n if (ref.current) {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setHasTabbableChild(!!walker.nextNode());\n }\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n // Disconnect mutation observer when a React update occurs on the top-level component\n // so we update synchronously after re-rendering. Otherwise React will emit act warnings\n // in tests since mutation observers fire asynchronously. The mutation observer is necessary\n // so we also update if a child component re-renders and adds/removes something tabbable.\n observer.disconnect();\n };\n }\n });\n\n return isDisabled ? false : hasTabbableChild;\n}\n"],"names":[],"version":3,"file":"useHasTabbableChild.main.js.map"}
@@ -0,0 +1,505 @@
"use strict";
// This rule was feature-frozen before we enabled no-property-in-node.
/* eslint-disable eslint-plugin/no-property-in-node */
Object.defineProperty(exports, "__esModule", { value: true });
const scope_manager_1 = require("@typescript-eslint/scope-manager");
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const naming_convention_utils_1 = require("./naming-convention-utils");
// This essentially mirrors ESLint's `camelcase` rule
// note that that rule ignores leading and trailing underscores and only checks those in the middle of a variable name
const defaultCamelCaseAllTheThingsConfig = [
{
format: ['camelCase'],
leadingUnderscore: 'allow',
selector: 'default',
trailingUnderscore: 'allow',
},
{
format: ['camelCase', 'PascalCase'],
selector: 'import',
},
{
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
selector: 'variable',
trailingUnderscore: 'allow',
},
{
format: ['PascalCase'],
selector: 'typeLike',
},
];
exports.default = (0, util_1.createRule)({
name: 'naming-convention',
meta: {
type: 'suggestion',
docs: {
description: 'Enforce naming conventions for everything across a codebase',
// technically only requires type checking if the user uses "type" modifiers
frozen: true,
requiresTypeChecking: true,
},
messages: {
doesNotMatchFormat: '{{type}} name `{{name}}` must match one of the following formats: {{formats}}',
doesNotMatchFormatTrimmed: '{{type}} name `{{name}}` trimmed as `{{processedName}}` must match one of the following formats: {{formats}}',
missingAffix: '{{type}} name `{{name}}` must have one of the following {{position}}es: {{affixes}}',
missingUnderscore: '{{type}} name `{{name}}` must have {{count}} {{position}} underscore(s).',
satisfyCustom: '{{type}} name `{{name}}` must {{regexMatch}} the RegExp: {{regex}}',
unexpectedUnderscore: '{{type}} name `{{name}}` must not have a {{position}} underscore.',
},
schema: naming_convention_utils_1.SCHEMA,
},
defaultOptions: defaultCamelCaseAllTheThingsConfig,
create(contextWithoutDefaults) {
const context = contextWithoutDefaults.options.length > 0
? contextWithoutDefaults
: // only apply the defaults when the user provides no config
Object.setPrototypeOf({
options: defaultCamelCaseAllTheThingsConfig,
}, contextWithoutDefaults);
const validators = (0, naming_convention_utils_1.parseOptions)(context);
const compilerOptions = (0, util_1.getParserServices)(context, true).program?.getCompilerOptions() ?? {};
function handleMember(validator, node, modifiers) {
const key = node.key;
if (requiresQuoting(key, compilerOptions.target)) {
modifiers.add(naming_convention_utils_1.Modifiers.requiresQuotes);
}
validator(key, modifiers);
}
function getMemberModifiers(node) {
const modifiers = new Set();
if ('key' in node && node.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier) {
modifiers.add(naming_convention_utils_1.Modifiers['#private']);
}
else if (node.accessibility) {
modifiers.add(naming_convention_utils_1.Modifiers[node.accessibility]);
}
else {
modifiers.add(naming_convention_utils_1.Modifiers.public);
}
if (node.static) {
modifiers.add(naming_convention_utils_1.Modifiers.static);
}
if ('readonly' in node && node.readonly) {
modifiers.add(naming_convention_utils_1.Modifiers.readonly);
}
if ('override' in node && node.override) {
modifiers.add(naming_convention_utils_1.Modifiers.override);
}
if (node.type === utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition ||
node.type === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition ||
node.type === utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty) {
modifiers.add(naming_convention_utils_1.Modifiers.abstract);
}
return modifiers;
}
const { unusedVariables } = (0, util_1.collectVariables)(context);
function isUnused(name, initialScope) {
let variable = null;
let scope = initialScope;
while (scope) {
variable = scope.set.get(name) ?? null;
if (variable) {
break;
}
scope = scope.upper;
}
if (!variable) {
return false;
}
return unusedVariables.has(variable);
}
function isDestructured(id) {
return (
// `const { x }`
// does not match `const { x: y }`
(id.parent.type === utils_1.AST_NODE_TYPES.Property && id.parent.shorthand) ||
// `const { x = 2 }`
// does not match const `{ x: y = 2 }`
(id.parent.type === utils_1.AST_NODE_TYPES.AssignmentPattern &&
id.parent.parent.type === utils_1.AST_NODE_TYPES.Property &&
id.parent.parent.shorthand));
}
function isAsyncMemberOrProperty(propertyOrMemberNode) {
return Boolean('value' in propertyOrMemberNode &&
propertyOrMemberNode.value &&
'async' in propertyOrMemberNode.value &&
propertyOrMemberNode.value.async);
}
function isAsyncVariableIdentifier(id) {
return Boolean(('async' in id.parent && id.parent.async) ||
('init' in id.parent &&
id.parent.init &&
'async' in id.parent.init &&
id.parent.init.async));
}
const selectors = {
// #region import
'FunctionDeclaration, TSDeclareFunction, FunctionExpression': {
handler: (node, validator) => {
if (node.id == null) {
return;
}
const modifiers = new Set();
// functions create their own nested scope
const scope = context.sourceCode.getScope(node).upper;
if (isGlobal(scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.global);
}
if (isExported(node, node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.exported);
}
if (isUnused(node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
if (node.async) {
modifiers.add(naming_convention_utils_1.Modifiers.async);
}
validator(node.id, modifiers);
},
validator: validators.function,
},
// #endregion
// #region variable
'ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier': {
handler: (node, validator) => {
const modifiers = new Set();
switch (node.type) {
case utils_1.AST_NODE_TYPES.ImportDefaultSpecifier:
modifiers.add(naming_convention_utils_1.Modifiers.default);
break;
case utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier:
modifiers.add(naming_convention_utils_1.Modifiers.namespace);
break;
case utils_1.AST_NODE_TYPES.ImportSpecifier:
// Handle `import { default as Foo }`
if (node.imported.type === utils_1.AST_NODE_TYPES.Identifier &&
node.imported.name !== 'default') {
return;
}
modifiers.add(naming_convention_utils_1.Modifiers.default);
break;
}
validator(node.local, modifiers);
},
validator: validators.import,
},
// #endregion
// #region function
VariableDeclarator: {
handler: (node, validator) => {
const identifiers = getIdentifiersFromPattern(node.id);
const baseModifiers = new Set();
const parent = node.parent;
if (parent.kind === 'const') {
baseModifiers.add(naming_convention_utils_1.Modifiers.const);
}
if (isGlobal(context.sourceCode.getScope(node))) {
baseModifiers.add(naming_convention_utils_1.Modifiers.global);
}
identifiers.forEach(id => {
const modifiers = new Set(baseModifiers);
if (isDestructured(id)) {
modifiers.add(naming_convention_utils_1.Modifiers.destructured);
}
const scope = context.sourceCode.getScope(id);
if (isExported(parent, id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.exported);
}
if (isUnused(id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
if (isAsyncVariableIdentifier(id)) {
modifiers.add(naming_convention_utils_1.Modifiers.async);
}
validator(id, modifiers);
});
},
validator: validators.variable,
},
// #endregion function
// #region parameter
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]': {
handler: (node, validator) => {
const modifiers = getMemberModifiers(node);
handleMember(validator, node, modifiers);
},
validator: validators.classProperty,
},
// #endregion parameter
// #region parameterProperty
':not(ObjectPattern) > Property[computed = false][kind = "init"][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]': {
handler: (node, validator) => {
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
handleMember(validator, node, modifiers);
},
validator: validators.objectLiteralProperty,
},
// #endregion parameterProperty
// #region property
[[
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "ArrowFunctionExpression"]',
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "FunctionExpression"]',
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "TSEmptyBodyFunctionExpression"]',
':matches(MethodDefinition, TSAbstractMethodDefinition)[computed = false][kind = "method"]',
].join(', ')]: {
handler: (node, validator) => {
const modifiers = getMemberModifiers(node);
if (isAsyncMemberOrProperty(node)) {
modifiers.add(naming_convention_utils_1.Modifiers.async);
}
handleMember(validator, node, modifiers);
},
validator: validators.classMethod,
},
[[
'MethodDefinition[computed = false]:matches([kind = "get"], [kind = "set"])',
'TSAbstractMethodDefinition[computed = false]:matches([kind="get"], [kind="set"])',
].join(', ')]: {
handler: (node, validator) => {
const modifiers = getMemberModifiers(node);
handleMember(validator, node, modifiers);
},
validator: validators.classicAccessor,
},
[[
'Property[computed = false][kind = "init"][value.type = "ArrowFunctionExpression"]',
'Property[computed = false][kind = "init"][value.type = "FunctionExpression"]',
'Property[computed = false][kind = "init"][value.type = "TSEmptyBodyFunctionExpression"]',
].join(', ')]: {
handler: (node, validator) => {
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
if (isAsyncMemberOrProperty(node)) {
modifiers.add(naming_convention_utils_1.Modifiers.async);
}
handleMember(validator, node, modifiers);
},
validator: validators.objectLiteralMethod,
},
// #endregion property
// #region method
[[
'TSMethodSignature[computed = false]',
'TSPropertySignature[computed = false][typeAnnotation.typeAnnotation.type = "TSFunctionType"]',
].join(', ')]: {
handler: (node, validator) => {
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
handleMember(validator, node, modifiers);
},
validator: validators.typeMethod,
},
[[
utils_1.AST_NODE_TYPES.AccessorProperty,
utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty,
].join(', ')]: {
handler: (node, validator) => {
const modifiers = getMemberModifiers(node);
handleMember(validator, node, modifiers);
},
validator: validators.autoAccessor,
},
'FunctionDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, FunctionExpression, ArrowFunctionExpression': {
handler: (node, validator) => {
node.params.forEach(param => {
if (param.type === utils_1.AST_NODE_TYPES.TSParameterProperty) {
return;
}
const identifiers = getIdentifiersFromPattern(param);
identifiers.forEach(i => {
const modifiers = new Set();
if (isDestructured(i)) {
modifiers.add(naming_convention_utils_1.Modifiers.destructured);
}
if (isUnused(i.name, context.sourceCode.getScope(i))) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
validator(i, modifiers);
});
});
},
validator: validators.parameter,
},
// #endregion method
// #region accessor
'Property[computed = false]:matches([kind = "get"], [kind = "set"])': {
handler: (node, validator) => {
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
handleMember(validator, node, modifiers);
},
validator: validators.classicAccessor,
},
TSParameterProperty: {
handler: (node, validator) => {
const modifiers = getMemberModifiers(node);
const identifiers = getIdentifiersFromPattern(node.parameter);
identifiers.forEach(i => {
validator(i, modifiers);
});
},
validator: validators.parameterProperty,
},
// #endregion accessor
// #region autoAccessor
'TSPropertySignature[computed = false][typeAnnotation.typeAnnotation.type != "TSFunctionType"]': {
handler: (node, validator) => {
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
if (node.readonly) {
modifiers.add(naming_convention_utils_1.Modifiers.readonly);
}
handleMember(validator, node, modifiers);
},
validator: validators.typeProperty,
},
// #endregion autoAccessor
// #region enumMember
// computed is optional, so can't do [computed = false]
'ClassDeclaration, ClassExpression': {
handler: (node, validator) => {
const id = node.id;
if (id == null) {
return;
}
const modifiers = new Set();
// classes create their own nested scope
const scope = context.sourceCode.getScope(node).upper;
if (node.abstract) {
modifiers.add(naming_convention_utils_1.Modifiers.abstract);
}
if (isExported(node, id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.exported);
}
if (isUnused(id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
validator(id, modifiers);
},
validator: validators.class,
},
// #endregion enumMember
// #region class
TSEnumDeclaration: {
handler: (node, validator) => {
const modifiers = new Set();
// enums create their own nested scope
const scope = context.sourceCode.getScope(node).upper;
if (isExported(node, node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.exported);
}
if (isUnused(node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
validator(node.id, modifiers);
},
validator: validators.enum,
},
// #endregion class
// #region interface
TSEnumMember: {
handler: (node, validator) => {
const id = node.id;
const modifiers = new Set();
if (requiresQuoting(id, compilerOptions.target)) {
modifiers.add(naming_convention_utils_1.Modifiers.requiresQuotes);
}
validator(id, modifiers);
},
validator: validators.enumMember,
},
// #endregion interface
// #region typeAlias
TSInterfaceDeclaration: {
handler: (node, validator) => {
const modifiers = new Set();
const scope = context.sourceCode.getScope(node);
if (isExported(node, node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.exported);
}
if (isUnused(node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
validator(node.id, modifiers);
},
validator: validators.interface,
},
// #endregion typeAlias
// #region enum
TSTypeAliasDeclaration: {
handler: (node, validator) => {
const modifiers = new Set();
const scope = context.sourceCode.getScope(node);
if (isExported(node, node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.exported);
}
if (isUnused(node.id.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
validator(node.id, modifiers);
},
validator: validators.typeAlias,
},
// #endregion enum
// #region typeParameter
'TSTypeParameterDeclaration > TSTypeParameter': {
handler: (node, validator) => {
const modifiers = new Set();
const scope = context.sourceCode.getScope(node);
if (isUnused(node.name.name, scope)) {
modifiers.add(naming_convention_utils_1.Modifiers.unused);
}
validator(node.name, modifiers);
},
validator: validators.typeParameter,
},
// #endregion typeParameter
};
return Object.fromEntries(Object.entries(selectors).map(([selector, { handler, validator }]) => {
return [
selector,
(node) => {
handler(node, validator);
},
];
}));
},
});
function getIdentifiersFromPattern(pattern) {
const identifiers = [];
const visitor = new scope_manager_1.PatternVisitor({}, pattern, id => identifiers.push(id));
visitor.visit(pattern);
return identifiers;
}
function isExported(node, name, scope) {
if (node?.parent?.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration ||
node?.parent?.type === utils_1.AST_NODE_TYPES.ExportNamedDeclaration) {
return true;
}
if (scope == null) {
return false;
}
const variable = scope.set.get(name);
if (variable) {
for (const ref of variable.references) {
const refParent = ref.identifier.parent;
if (refParent.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration ||
refParent.type === utils_1.AST_NODE_TYPES.ExportSpecifier) {
return true;
}
}
}
return false;
}
function isGlobal(scope) {
if (scope == null) {
return false;
}
return (scope.type === utils_1.TSESLint.Scope.ScopeType.global ||
scope.type === utils_1.TSESLint.Scope.ScopeType.module);
}
function requiresQuoting(node, target) {
const name = node.type === utils_1.AST_NODE_TYPES.Identifier ||
node.type === utils_1.AST_NODE_TYPES.PrivateIdentifier
? node.name
: `${node.value}`;
return (0, util_1.requiresQuoting)(name, target);
}
@@ -0,0 +1 @@
{"version":3,"file":"resolveInstanceBindingNodeFromConstructorParams.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveInstanceBindingNodeFromConstructorParams.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAgB,MAAM,oBAAoB,CAAC;AAoC5D,wBAAgB,+CAA+C,CAC7D,UAAU,EACV,QAAQ,SAAS,eAAe,CAAC,UAAU,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,EAE1E,qBAAqB,EAAE,CACrB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAC1C,IAAI,EAAE,mBAAmB,KACtB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACxB,CACD,iBAAiB,EAAE,OAAO,EAAE,EAC5B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAChC,QAAQ,CAAC,UAAU,CAAC,CA+BxB"}
@@ -0,0 +1,56 @@
/**
* @typedef {import('hast').Element} Element
* @typedef {import('hast').Properties} Properties
* @typedef {import('mdast').List} List
* @typedef {import('../state.js').State} State
*/
// Make VS Code show references to the above types.
''
/**
* Turn an mdast `list` node into hast.
*
* @param {State} state
* Info passed around.
* @param {List} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function list(state, node) {
/** @type {Properties} */
const properties = {}
const results = state.all(node)
let index = -1
if (typeof node.start === 'number' && node.start !== 1) {
properties.start = node.start
}
// Like GitHub, add a class for custom styling.
while (++index < results.length) {
const child = results[index]
if (
child.type === 'element' &&
child.tagName === 'li' &&
child.properties &&
Array.isArray(child.properties.className) &&
child.properties.className.includes('task-list-item')
) {
properties.className = ['contains-task-list']
break
}
}
/** @type {Element} */
const result = {
type: 'element',
tagName: node.ordered ? 'ol' : 'ul',
properties,
children: state.wrap(results, true)
}
state.patch(node, result)
return state.applyData(node, result)
}
@@ -0,0 +1,100 @@
import {createSyntheticEvent as $8a9cb279dc87e130$export$525bc4921d56d4a, setEventTarget as $8a9cb279dc87e130$export$c2b7abe5d61ec696, useSyntheticBlurEvent as $8a9cb279dc87e130$export$715c682d09d639cc} from "./utils.module.js";
import {useRef as $3b9Q0$useRef, useCallback as $3b9Q0$useCallback} from "react";
import {useGlobalListeners as $3b9Q0$useGlobalListeners, getOwnerDocument as $3b9Q0$getOwnerDocument, getActiveElement as $3b9Q0$getActiveElement, getEventTarget as $3b9Q0$getEventTarget, nodeContains as $3b9Q0$nodeContains} from "@react-aria/utils";
/*
* 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.
*/ // Portions of the code in this file are based on code from react.
// Original licensing for the following can be found in the
// NOTICE file in the root directory of this source tree.
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
let { isDisabled: isDisabled, onBlurWithin: onBlurWithin, onFocusWithin: onFocusWithin, onFocusWithinChange: onFocusWithinChange } = props;
let state = (0, $3b9Q0$useRef)({
isFocusWithin: false
});
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $3b9Q0$useGlobalListeners)();
let onBlur = (0, $3b9Q0$useCallback)((e)=>{
// Ignore events bubbling through portals.
if (!e.currentTarget.contains(e.target)) return;
// We don't want to trigger onBlurWithin and then immediately onFocusWithin again
// when moving focus inside the element. Only trigger if the currentTarget doesn't
// include the relatedTarget (where focus is moving).
if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
state.current.isFocusWithin = false;
removeAllGlobalListeners();
if (onBlurWithin) onBlurWithin(e);
if (onFocusWithinChange) onFocusWithinChange(false);
}
}, [
onBlurWithin,
onFocusWithinChange,
state,
removeAllGlobalListeners
]);
let onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
let onFocus = (0, $3b9Q0$useCallback)((e)=>{
// Ignore events bubbling through portals.
if (!e.currentTarget.contains(e.target)) return;
// Double check that document.activeElement actually matches e.target in case a previously chained
// focus handler already moved focus somewhere else.
const ownerDocument = (0, $3b9Q0$getOwnerDocument)(e.target);
const activeElement = (0, $3b9Q0$getActiveElement)(ownerDocument);
if (!state.current.isFocusWithin && activeElement === (0, $3b9Q0$getEventTarget)(e.nativeEvent)) {
if (onFocusWithin) onFocusWithin(e);
if (onFocusWithinChange) onFocusWithinChange(true);
state.current.isFocusWithin = true;
onSyntheticFocus(e);
// Browsers don't fire blur events when elements are removed from the DOM.
// However, if a focus event occurs outside the element we're tracking, we
// can manually fire onBlur.
let currentTarget = e.currentTarget;
addGlobalListener(ownerDocument, 'focus', (e)=>{
if (state.current.isFocusWithin && !(0, $3b9Q0$nodeContains)(currentTarget, e.target)) {
let nativeEvent = new ownerDocument.defaultView.FocusEvent('blur', {
relatedTarget: e.target
});
(0, $8a9cb279dc87e130$export$c2b7abe5d61ec696)(nativeEvent, currentTarget);
let event = (0, $8a9cb279dc87e130$export$525bc4921d56d4a)(nativeEvent);
onBlur(event);
}
}, {
capture: true
});
}
}, [
onFocusWithin,
onFocusWithinChange,
onSyntheticFocus,
addGlobalListener,
onBlur
]);
if (isDisabled) return {
focusWithinProps: {
// These cannot be null, that would conflict in mergeProps
onFocus: undefined,
onBlur: undefined
}
};
return {
focusWithinProps: {
onFocus: onFocus,
onBlur: onBlur
}
};
}
export {$9ab94262bd0047c7$export$420e68273165f4ec as useFocusWithin};
//# sourceMappingURL=useFocusWithin.module.js.map
@@ -0,0 +1,3 @@
declare const _exports: import('eslint').Rule.RuleModule;
export = _exports;
//# sourceMappingURL=jsx-no-duplicate-props.d.ts.map
@@ -0,0 +1,20 @@
# goober-autoprefixer
A css autoprefixer for [🥜goober](https://github.com/cristianbote/goober) using [style-vendorizer](https://github.com/kripod/style-vendorizer).
## Install
`npm install --save goober`
## How to use it
This packages exports a `prefix` function that needs to be passed to goober's `setup` function like this:
```jsx
import React from 'react';
import { setup } from 'goober';
import { prefix } from 'goober/prefixer';
// Setup goober for react with autoprefixer
setup(React.createElement, prefix);
```
@@ -0,0 +1,65 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
import KEYS from "./visitor-keys.js";
/**
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
*/
// List to ignore keys.
const KEY_BLACKLIST = new Set([
"parent",
"leadingComments",
"trailingComments"
]);
/**
* Check whether a given key should be used or not.
* @param {string} key The key to check.
* @returns {boolean} `true` if the key should be used.
*/
function filterKey(key) {
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
}
/**
* Get visitor keys of a given node.
* @param {object} node The AST node to get keys.
* @returns {readonly string[]} Visitor keys of the node.
*/
export function getKeys(node) {
return Object.keys(node).filter(filterKey);
}
// Disable valid-jsdoc rule because it reports syntax error on the type of @returns.
// eslint-disable-next-line valid-jsdoc
/**
* Make the union set with `KEYS` and given keys.
* @param {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
export function unionWith(additionalKeys) {
const retv = /** @type {{
[type: string]: ReadonlyArray<string>
}} */ (Object.assign({}, KEYS));
for (const type of Object.keys(additionalKeys)) {
if (Object.prototype.hasOwnProperty.call(retv, type)) {
const keys = new Set(additionalKeys[type]);
for (const key of retv[type]) {
keys.add(key);
}
retv[type] = Object.freeze(Array.from(keys));
} else {
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
}
}
return Object.freeze(retv);
}
export { KEYS };
@@ -0,0 +1,727 @@
export default `flf2a$ 7 6 11 0 11 0 24447 0
Author : MJP
Date : 2003/11/1 11:11:13
Version: 1.0
-------------------------------------------------
-------------------------------------------------
This font has been created using JavE's FIGlet font export assistant.
Have a look at: http://www.jave.de
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
$ #
$ #
$ #
$ #
$ #
$ #
$ ##
.-. #
| ) #
| / #
|/ #
( #
(_) #
##
#
) ) #
(_)(_) #
#
#
#
##
##
#
#
#
#
#
##
$#
#
#
#
#
#
##
%#
#
#
#
#
#
##
&#
#
#
#
#
#
##
'#
#
#
#
#
#
##
(#
#
#
#
#
#
##
)#
#
#
#
#
#
##
*#
#
#
#
#
#
##
#
_||_ #
[_ _] #
|| #
|| #
#
##
,#
#
#
#
#
#
##
#
#
____.___ #
\`----==='#
#
#
##
.#
#
#
#
#
#
##
/#
#
#
#
#
#
##
0#
#
#
#
#
#
##
1#
#
#
#
#
#
##
2#
#
#
#
#
#
##
3#
#
#
#
#
#
##
4#
#
#
#
#
#
##
5#
#
#
#
#
#
##
6#
#
#
#
#
#
##
7#
#
#
#
#
#
##
8#
#
#
#
#
#
##
9#
#
#
#
#
#
##
#
_ #
(_) #
#
_ #
(_) #
##
#
_ #
(_) #
#
( #
(_) #
##
<#
#
#
#
#
#
##
#
____.___ #
\`----==='#
___.____#
\`===----'#
#
##
>#
#
#
#
#
#
##
?#
#
#
#
#
#
##
@#
#
#
#
#
#
##
.--. #
/ /\\ \\ #
/ /__\\ \\ #
| __ | #
| | |)| #
|_| (_) #
##
,---. #
| .-.\\ #
| |-' \\ #
| |--. \\#
| |\`-' /#
/( \`--' #
(__) ##
,--, #
.' .') #
| |(_) #
\\ \\ #
\\ \`-. #
\\____\\ #
##
,'|"\\ #
| |\\ \\ #
| | \\ \\ #
| | \\ \\#
/(|\`-' /#
(__)\`--' #
##
,---. #
| .-' #
| \`-. #
| .-' #
| \`--. #
/( __.' #
(__) ##
,---. #
| .-' #
| \`-. #
| .-' #
| | #
)\\| #
(__) ##
,--, #
.' .' #
| | __ #
\\ \\ ( _)#
\\ \`-) )#
)\\____/ #
(__) ##
.-. .-. #
| | | | #
| \`-' | #
| .-. | #
| | |)| #
/( (_) #
(__) ##
,-. #
|(| #
(_) #
| | #
| | #
\`-' #
##
.-, #
| | #
| | #
| | #
(\`-' | #
\\_ )| #
(_) ##
,-. .-. #
| |/ / #
| | / #
| | \\ #
| |) \\ #
|((_)-' #
(_) ##
,-. #
| | #
| | #
| | #
| \`--. #
|( __.' #
(_) ##
#
|\\ /| #
|(\\ / | #
(_)\\/ | #
| \\ / | #
| |\\/| | #
'-' '-' ##
.-. .-. #
| \\| | #
| | | #
| |\\ | #
| | |)| #
/( (_) #
(__) ##
.---. #
/ .-. ) #
| | |(_) #
| | | | #
\\ \`-' / #
)---' #
(_) ##
,---. #
| .-.\\ #
| |-' ) #
| |--' #
| | #
/( #
(__) ##
.---. #
( .-. \\ #
(_)| | | #
| ||\\ | #
\\ \`-\\\\/ #
\`---\\| #
##
,---. #
| .-.\\ #
| \`-'/ #
| ( #
| |\\ \\ #
|_| \\)\\ #
(__) ##
.---. #
( .-._)#
(_) \\ #
_ \\ \\ #
( \`-' ) #
\`----' #
##
_______ #
|__ __|#
)| | #
(_) | #
| | #
\`-' #
##
.-. .-. #
| | | | #
| | | | #
| | | | #
| \`-')| #
\`---(_) #
##
.-. .-.#
\\ \\ / / #
\\ V / #
) / #
(_) #
#
##
.-. .-. #
| |/\\| | #
| / \\ | #
| /\\ | #
|(/ \\ | #
(_) \\| #
##
.-. .-.#
) \\_/ / #
(_) / #
/ _ \\ #
/ / ) \\ #
\`-' (_)-'#
##
.-. .-.#
\\ \\_/ )/#
\\ (_)#
) ( #
| | #
/(_| #
(__) ##
_____ #
/___ / #
/ /) #
/ /(_) #
/ /___ #
(_____/ #
##
[#
#
#
#
#
#
##
\\#
#
#
#
#
#
##
]#
#
#
#
#
#
##
^#
#
#
#
#
#
##
_#
#
#
#
#
#
##
\`#
#
#
#
#
#
##
.--. #
/ /\\ \\ #
/ /__\\ \\ #
| __ | #
| | |)| #
|_| (_) #
##
,---. #
| .-.\\ #
| |-' \\ #
| |--. \\#
| |\`-' /#
/( \`--' #
(__) ##
,--, #
.' .') #
| |(_) #
\\ \\ #
\\ \`-. #
\\____\\ #
##
,'|"\\ #
| |\\ \\ #
| | \\ \\ #
| | \\ \\#
/(|\`-' /#
(__)\`--' #
##
,---. #
| .-' #
| \`-. #
| .-' #
| \`--. #
/( __.' #
(__) ##
,---. #
| .-' #
| \`-. #
| .-' #
| | #
)\\| #
(__) ##
,--, #
.' .' #
| | __ #
\\ \\ ( _)#
\\ \`-) )#
)\\____/ #
(__) ##
.-. .-. #
| | | | #
| \`-' | #
| .-. | #
| | |)| #
/( (_) #
(__) ##
,-. #
|(| #
(_) #
| | #
| | #
\`-' #
##
.-, #
| | #
| | #
| | #
(\`-' | #
\\_ )| #
(_) ##
,-. .-. #
| |/ / #
| | / #
| | \\ #
| |) \\ #
|((_)-' #
(_) ##
,-. #
| | #
| | #
| | #
| \`--. #
|( __.' #
(_) ##
#
|\\ /| #
|(\\ / | #
(_)\\/ | #
| \\ / | #
| |\\/| | #
'-' '-' ##
.-. .-. #
| \\| | #
| | | #
| |\\ | #
| | |)| #
/( (_) #
(__) ##
.---. #
/ .-. ) #
| | |(_) #
| | | | #
\\ \`-' / #
)---' #
(_) ##
,---. #
| .-.\\ #
| |-' ) #
| |--' #
| | #
/( #
(__) ##
.---. #
( .-. \\ #
(_)| | | #
| ||\\ | #
\\ \`-\\\\/ #
\`---\\| #
##
,---. #
| .-.\\ #
| \`-'/ #
| ( #
| |\\ \\ #
|_| \\)\\ #
(__) ##
.---. #
( .-._)#
(_) \\ #
_ \\ \\ #
( \`-' ) #
\`----' #
##
_______ #
|__ __|#
)| | #
(_) | #
| | #
\`-' #
##
.-. .-. #
| | | | #
| | | | #
| | | | #
| \`-')| #
\`---(_) #
##
.-. .-.#
\\ \\ / / #
\\ V / #
) / #
(_) #
#
##
.-. .-. #
| |/\\| | #
| / \\ | #
| /\\ | #
|(/ \\ | #
(_) \\| #
##
.-. .-.#
) \\_/ / #
(_) / #
/ _ \\ #
/ / ) \\ #
\`-' (_)-'#
##
.-. .-.#
\\ \\_/ )/#
\\ (_)#
) ( #
| | #
/(_| #
(__) ##
_____ #
/___ / #
/ /) #
/ /(_) #
/ /___ #
(_____/ #
##
{#
#
#
#
#
#
##
|#
#
#
#
#
#
##
}#
#
#
#
#
#
##
~#
#
#
#
#
#
##
.--. #
/ /\\ \\ #
/ /__\\ \\ #
| __ | #
| | |)| #
|_| (_) #
##
.---. #
/ .-. ) #
| | |(_) #
| | | | #
\\ \`-' / #
)---' #
(_) ##
.-. .-. #
| | | | #
| | | | #
| | | | #
| \`-')| #
\`---(_) #
##
.--. #
/ /\\ \\ #
/ /__\\ \\ #
| __ | #
| | |)| #
|_| (_) #
##
.---. #
/ .-. ) #
| | |(_) #
| | | | #
\\ \`-' / #
)---' #
(_) ##
.-. .-. #
| | | | #
| | | | #
| | | | #
| \`-')| #
\`---(_) #
##
�#
#
#
#
#
#
##
`
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=BindingFluentSyntax.spec-d.d.ts.map
@@ -0,0 +1,6 @@
import { CreateType } from '../create/type.mjs';
import { Kind } from '../symbols/index.mjs';
/** `[Json]` Creates a Null type */
export function Null(options) {
return CreateType({ [Kind]: 'Null', type: 'null' }, options);
}
@@ -0,0 +1,84 @@
# object-inspect <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
string representations of objects in node and the browser
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
# example
## circular
``` js
var inspect = require('object-inspect');
var obj = { a: 1, b: [3,4] };
obj.c = obj;
console.log(inspect(obj));
```
## dom element
``` js
var inspect = require('object-inspect');
var d = document.createElement('div');
d.setAttribute('id', 'beep');
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
```
output:
```
[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ]
```
# methods
``` js
var inspect = require('object-inspect')
```
## var s = inspect(obj, opts={})
Return a string `s` with the string representation of `obj` up to a depth of `opts.depth`.
Additional options:
- `quoteStyle`: must be "single" or "double", if present. Default `'single'` for strings, `'double'` for HTML elements.
- `maxStringLength`: must be `0`, a positive integer, `Infinity`, or `null`, if present. Default `Infinity`.
- `customInspect`: When `true`, a custom inspect method function will be invoked (either undere the `util.inspect.custom` symbol, or the `inspect` property). When the string `'symbol'`, only the symbol method will be invoked. Default `true`.
- `indent`: must be "\t", `null`, or a positive integer. Default `null`.
- `numericSeparator`: must be a boolean, if present. Default `false`. If `true`, all numbers will be printed with numeric separators (eg, `1234.5678` will be printed as `'1_234.567_8'`)
# install
With [npm](https://npmjs.org) do:
```
npm install object-inspect
```
# license
MIT
[package-url]: https://npmjs.org/package/object-inspect
[npm-version-svg]: https://versionbadg.es/inspect-js/object-inspect.svg
[deps-svg]: https://david-dm.org/inspect-js/object-inspect.svg
[deps-url]: https://david-dm.org/inspect-js/object-inspect
[dev-deps-svg]: https://david-dm.org/inspect-js/object-inspect/dev-status.svg
[dev-deps-url]: https://david-dm.org/inspect-js/object-inspect#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/object-inspect.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/object-inspect.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/object-inspect.svg
[downloads-url]: https://npm-stat.com/charts.html?package=object-inspect
[codecov-image]: https://codecov.io/gh/inspect-js/object-inspect/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/object-inspect/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/object-inspect
[actions-url]: https://github.com/inspect-js/object-inspect/actions
@@ -0,0 +1,2 @@
export { urlAttributes } from "./lib/index.js";
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,14 @@
import 'reflect-metadata';
import { BindInFluentSyntax, BindInWhenOnFluentSyntax, BindOnFluentSyntax, BindToFluentSyntax, BindWhenFluentSyntax, BindWhenOnFluentSyntax, BoundServiceSyntax } from './binding/models/BindingFluentSyntax';
import { BindingIdentifier } from './binding/models/BindingIdentifier';
import { MapToResolvedValueInjectOptions } from './binding/models/MapToResolvedValueInjectOptions';
import { ResolvedValueInjectOptions, ResolvedValueMetadataInjectOptions, ResolvedValueMetadataInjectTagOptions } from './binding/models/ResolvedValueInjectOptions';
import { Bind, ContainerModule, ContainerModuleLoadOptions, IsBound, OnActivation, OnDeactivation, Rebind, RebindSync, Unbind, UnbindSync } from './container/models/ContainerModule';
import { ContainerOptions } from './container/models/ContainerOptions';
import { IsBoundOptions } from './container/models/isBoundOptions';
import { Container } from './container/services/Container';
import { InversifyContainerError } from './error/models/InversifyContainerError';
import { InversifyContainerErrorKind } from './error/models/InversifyContainerErrorKind';
export type { Bind, BindInFluentSyntax, BindingIdentifier, BindInWhenOnFluentSyntax, BindOnFluentSyntax, BindToFluentSyntax, BindWhenFluentSyntax, BindWhenOnFluentSyntax, BoundServiceSyntax, ContainerModuleLoadOptions, ContainerOptions, IsBound, IsBoundOptions, MapToResolvedValueInjectOptions, OnActivation, OnDeactivation, Rebind, RebindSync, ResolvedValueInjectOptions, ResolvedValueMetadataInjectOptions, ResolvedValueMetadataInjectTagOptions, Unbind, UnbindSync, };
export { Container, ContainerModule, InversifyContainerError, InversifyContainerErrorKind, };
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,82 @@
# Change Log
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/). This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
## [1.0.8] - 2021-12-20
Security:
- Upgrade mocha to > 9.0.0 (fixes three security vulnerabilities brought by transitive dependencies)
## [1.0.7] - 2021-05-05
Fixed:
- The scripts/update-changelog.sh wouldn't work without gsed in path
Security:
- Upgrade lodash (transitive development dependency) #17
- Upgrade yargs/y18n (transitive development dependency) #18
## [1.0.6] - 2020-01-27
Changed:
- Upgrade lodash to version 4.17.15 #16
## [1.0.5] - 2019-05-09
Changed:
- Upgrade Mocha to version 6.1.4 #12 by @whyboris
- Example use in README.md by @whyboris
## [1.0.4] - 2017-03-24
Fixed:
- Fails in strict mode #7 by @gilly3
## [1.0.3] - 2016-09-26
Fixed:
- A title of this document :P
Added:
- List of contributors
- Bugs URL
- Git repository URL
## [1.0.2] - 2016-09-26
Fixed:
- Similarity 0 returned for equal strings #4 by @tad-lispy
## [1.0.1] - 2016-09-12
Fixed:
- Wrong results for transposition #2 by @g-adolph
Added:
- First unit test by @g-adolph
- A Change Log :) by @tad-lispy
## [1.0.0] - 2016-02-23
Fixed:
- Update README to match the actual output by @gilly3
## [0.1.3] - 2013-09-02
Fixed:
- Clear matrix on each call @tad-lispy
- Always return an object @tad-lispy
## [0.1.2] - 2013-08-29
Added:
- ReadMe
## [0.1.1] - 2013-08-28
Added:
- Initial working release @tad-lispy
@@ -0,0 +1,232 @@
'use strict';
var utils = require('../utils.js');
var vendor = require('../vendor.js');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
function escape(s) {
return `(?:${vendor.escapeStringRegexp(s)})`;
}
function escapeAndRepeat(s) {
return `${escape(s)}+`;
}
function parseMarkersOption(markers) {
if (!markers.includes("*"))
return markers.concat("*");
return markers;
}
function createExceptionsPattern(exceptions) {
let pattern = "";
if (exceptions.length === 0) {
pattern += "\\s";
} else {
pattern += "(?:\\s|";
if (exceptions.length === 1) {
pattern += escapeAndRepeat(exceptions[0]);
} else {
pattern += "(?:";
pattern += exceptions.map(escapeAndRepeat).join("|");
pattern += ")";
}
pattern += `(?:$|[${Array.from(utils.LINEBREAKS).join("")}]))`;
}
return pattern;
}
function createAlwaysStylePattern(markers, exceptions) {
let pattern = "^";
if (markers.length === 1) {
pattern += escape(markers[0]);
} else {
pattern += "(?:";
pattern += markers.map(escape).join("|");
pattern += ")";
}
pattern += "?";
pattern += createExceptionsPattern(exceptions);
return new RegExp(pattern, "u");
}
function createNeverStylePattern(markers) {
const pattern = `^(${markers.map(escape).join("|")})?[ ]+`;
return new RegExp(pattern, "u");
}
var spacedComment = utils.createRule({
name: "spaced-comment",
package: "js",
meta: {
type: "layout",
docs: {
description: "Enforce consistent spacing after the `//` or `/*` in a comment"
},
fixable: "whitespace",
schema: [
{
type: "string",
enum: ["always", "never"]
},
{
type: "object",
properties: {
exceptions: {
type: "array",
items: {
type: "string"
}
},
markers: {
type: "array",
items: {
type: "string"
}
},
line: {
type: "object",
properties: {
exceptions: {
type: "array",
items: {
type: "string"
}
},
markers: {
type: "array",
items: {
type: "string"
}
}
},
additionalProperties: false
},
block: {
type: "object",
properties: {
exceptions: {
type: "array",
items: {
type: "string"
}
},
markers: {
type: "array",
items: {
type: "string"
}
},
balanced: {
type: "boolean",
default: false
}
},
additionalProperties: false
}
},
additionalProperties: false
}
],
messages: {
unexpectedSpaceAfterMarker: "Unexpected space or tab after marker ({{refChar}}) in comment.",
expectedExceptionAfter: "Expected exception block, space or tab after '{{refChar}}' in comment.",
unexpectedSpaceBefore: "Unexpected space or tab before '*/' in comment.",
unexpectedSpaceAfter: "Unexpected space or tab after '{{refChar}}' in comment.",
expectedSpaceBefore: "Expected space or tab before '*/' in comment.",
expectedSpaceAfter: "Expected space or tab after '{{refChar}}' in comment."
}
},
create(context) {
const sourceCode = context.sourceCode;
const requireSpace = context.options[0] !== "never";
const config = context.options[1] || {};
const balanced = config.block && config.block.balanced;
const styleRules = ["block", "line"].reduce((rule, type) => {
const nodeType = type;
const markers = parseMarkersOption(config[nodeType] && config[nodeType]?.markers || config.markers || []);
const exceptions = config[nodeType] && config[nodeType]?.exceptions || config.exceptions || [];
const endNeverPattern = "[ ]+$";
rule[nodeType] = {
beginRegex: requireSpace ? createAlwaysStylePattern(markers, exceptions) : createNeverStylePattern(markers),
endRegex: balanced && requireSpace ? new RegExp(`${createExceptionsPattern(exceptions)}$`, "u") : new RegExp(endNeverPattern, "u"),
hasExceptions: exceptions.length > 0,
captureMarker: new RegExp(`^(${markers.map(escape).join("|")})`, "u"),
markers: new Set(markers)
};
return rule;
}, {});
function reportBegin(node, messageId, match, refChar) {
const type = node.type.toLowerCase();
const commentIdentifier = type === "block" ? "/*" : "//";
context.report({
node,
fix(fixer) {
const start = node.range[0];
let end = start + 2;
if (requireSpace) {
if (match)
end += match[0].length;
return fixer.insertTextAfterRange([start, end], " ");
}
if (match)
end += match[0].length;
return fixer.replaceTextRange([start, end], commentIdentifier + (match && match[1] ? match[1] : ""));
},
messageId,
data: { refChar }
});
}
function reportEnd(node, messageId, match) {
context.report({
node,
fix(fixer) {
if (requireSpace)
return fixer.insertTextAfterRange([node.range[0], node.range[1] - 2], " ");
const end = node.range[1] - 2;
let start = end;
if (match)
start -= match[0].length;
return fixer.replaceTextRange([start, end], "");
},
messageId
});
}
function checkCommentForSpace(node) {
const type = node.type.toLowerCase();
const rule = styleRules[type];
const commentIdentifier = type === "block" ? "/*" : "//";
if (node.value.length === 0 || rule.markers.has(node.value))
return;
if (type === "line" && (node.value.startsWith("/ <reference") || node.value.startsWith("/ <amd")))
return;
const beginMatch = rule.beginRegex.exec(node.value);
const endMatch = rule.endRegex.exec(node.value);
if (requireSpace) {
if (!beginMatch) {
const hasMarker = rule.captureMarker.exec(node.value);
const marker = hasMarker ? commentIdentifier + hasMarker[0] : commentIdentifier;
if (rule.hasExceptions)
reportBegin(node, "expectedExceptionAfter", hasMarker, marker);
else
reportBegin(node, "expectedSpaceAfter", hasMarker, marker);
}
if (balanced && type === "block" && !endMatch)
reportEnd(node, "expectedSpaceBefore", null);
} else {
if (beginMatch) {
if (!beginMatch[1])
reportBegin(node, "unexpectedSpaceAfter", beginMatch, commentIdentifier);
else
reportBegin(node, "unexpectedSpaceAfterMarker", beginMatch, beginMatch[1]);
}
if (balanced && type === "block" && endMatch)
reportEnd(node, "unexpectedSpaceBefore", endMatch);
}
}
return {
Program() {
const comments = sourceCode.getAllComments();
comments.filter((token) => token.type !== "Shebang").forEach(checkCommentForSpace);
}
};
}
});
module.exports = spacedComment;
@@ -0,0 +1,38 @@
# CHANGELOG
v5.2.2
- Improved documentation and removed unecessary check
v5.2.1:
- 2bb7b05: Added negative sign check
v5.2:
- 6f9d124: Implemented log and improved simplify
- b773e7a: Added named export to TS definition
- 70304f9: Fixed merge conflict
- 3b940d3: Implemented other comparing functions
- 10acdfc: Update README.md
- ba41d00: Update README.md
- 73ded97: Update README.md
- acabc39: Fixed param parsing
v5.0.5:
- 2c9d4c2: Improved roundTo() and param parser
v5.0.4:
- 39e61e7: Fixed bignum param passing
v5.0.3:
- 7d9a3ec: Upgraded bundler for code quality
v5.0.2:
- c64b1d6: fixed esm export
v5.0.1:
- e440f9c: Fixed CJS export
- 9bbdd29: Fixed CJS export
v5.0.0:
- ac7cd06: Fixed readme
- 33cc9e5: Added crude build
- 1adcc76: Release breaking v5.0. Fraction.js now builds on BigInt. The API stays the same as v4, except that the object attributes `n`, `d`, and `s`, are not Number but BigInt and may break code that directly accesses these attributes.
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var sectionheadRole = {
abstract: true,
accessibleNameRequired: false,
baseConcepts: [],
childrenPresentational: false,
nameFrom: ['author', 'contents'],
prohibitedProps: [],
props: {},
relatedConcepts: [],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {},
superClass: [['roletype', 'structure']]
};
var _default = exports.default = sectionheadRole;
@@ -0,0 +1,7 @@
import type { Directives } from '../doc/directives';
import { Document } from '../doc/Document';
import type { ParsedNode } from '../nodes/Node';
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options';
import type * as CST from '../parse/cst';
import type { ComposeErrorHandler } from './composer';
export declare function composeDoc<Contents extends ParsedNode = ParsedNode, Strict extends boolean = true>(options: ParseOptions & DocumentOptions & SchemaOptions, directives: Directives, { offset, start, value, end }: CST.Document, onError: ComposeErrorHandler): Document.Parsed<Contents, Strict>;
@@ -0,0 +1,36 @@
'use strict';
var ToIntegerOrInfinity = require('es-abstract/2025/ToIntegerOrInfinity');
var ToLength = require('es-abstract/2025/ToLength');
var ToObject = require('es-object-atoms/ToObject');
var SameValueZero = require('es-abstract/2025/SameValueZero');
var $isNaN = require('math-intrinsics/isNaN');
var $isFinite = require('math-intrinsics/isFinite');
var GetIntrinsic = require('get-intrinsic');
var callBound = require('call-bound');
var isString = require('is-string');
var $charAt = callBound('String.prototype.charAt');
var $indexOf = GetIntrinsic('%Array.prototype.indexOf%'); // TODO: use callBind.apply without breaking IE 8
var $max = GetIntrinsic('%Math.max%');
module.exports = function includes(searchElement) {
var fromIndex = arguments.length > 1 ? ToIntegerOrInfinity(arguments[1]) : 0;
if ($indexOf && !$isNaN(searchElement) && $isFinite(fromIndex) && typeof searchElement !== 'undefined') {
return $indexOf.apply(this, arguments) > -1;
}
var O = ToObject(this);
var length = ToLength(O.length);
if (length === 0) {
return false;
}
var k = fromIndex >= 0 ? fromIndex : $max(0, length + fromIndex);
while (k < length) {
if (SameValueZero(searchElement, isString(O) ? $charAt(O, k) : O[k])) {
return true;
}
k += 1;
}
return false;
};
@@ -0,0 +1,87 @@
/*
Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* A Variable represents a locally scoped identifier. These include arguments to
* functions.
* @constructor Variable
*/
class Variable {
constructor(name, scope) {
/**
* The variable name, as given in the source code.
* @member {string} Variable#name
*/
this.name = name;
/**
* List of defining occurrences of this variable (like in 'var ...'
* statements or as parameter), as AST nodes.
* @member {espree.Identifier[]} Variable#identifiers
*/
this.identifiers = [];
/**
* List of {@link Reference|references} of this variable (excluding parameter entries)
* in its defining scope and all nested scopes. For defining
* occurrences only see {@link Variable#defs}.
* @member {Reference[]} Variable#references
*/
this.references = [];
/**
* List of defining occurrences of this variable (like in 'var ...'
* statements or as parameter), as custom objects.
* @member {Definition[]} Variable#defs
*/
this.defs = [];
this.tainted = false;
/**
* Whether this is a stack variable.
* @member {boolean} Variable#stack
*/
this.stack = true;
/**
* Reference to the enclosing Scope.
* @member {Scope} Variable#scope
*/
this.scope = scope;
}
}
Variable.CatchClause = "CatchClause";
Variable.Parameter = "Parameter";
Variable.FunctionName = "FunctionName";
Variable.ClassName = "ClassName";
Variable.Variable = "Variable";
Variable.ImportBinding = "ImportBinding";
Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable";
export default Variable;
/* vim: set sw=4 ts=4 et tw=80 : */
@@ -0,0 +1,233 @@
# ipaddr.js — an IPv6 and IPv4 address manipulation library [![Build Status](https://travis-ci.org/whitequark/ipaddr.js.svg)](https://travis-ci.org/whitequark/ipaddr.js)
ipaddr.js is a small (1.9K minified and gzipped) library for manipulating
IP addresses in JavaScript environments. It runs on both CommonJS runtimes
(e.g. [nodejs]) and in a web browser.
ipaddr.js allows you to verify and parse string representation of an IP
address, match it against a CIDR range or range list, determine if it falls
into some reserved ranges (examples include loopback and private ranges),
and convert between IPv4 and IPv4-mapped IPv6 addresses.
[nodejs]: http://nodejs.org
## Installation
`npm install ipaddr.js`
or
`bower install ipaddr.js`
## API
ipaddr.js defines one object in the global scope: `ipaddr`. In CommonJS,
it is exported from the module:
```js
var ipaddr = require('ipaddr.js');
```
The API consists of several global methods and two classes: ipaddr.IPv6 and ipaddr.IPv4.
### Global methods
There are three global methods defined: `ipaddr.isValid`, `ipaddr.parse` and
`ipaddr.process`. All of them receive a string as a single parameter.
The `ipaddr.isValid` method returns `true` if the address is a valid IPv4 or
IPv6 address, and `false` otherwise. It does not throw any exceptions.
The `ipaddr.parse` method returns an object representing the IP address,
or throws an `Error` if the passed string is not a valid representation of an
IP address.
The `ipaddr.process` method works just like the `ipaddr.parse` one, but it
automatically converts IPv4-mapped IPv6 addresses to their IPv4 counterparts
before returning. It is useful when you have a Node.js instance listening
on an IPv6 socket, and the `net.ivp6.bindv6only` sysctl parameter (or its
equivalent on non-Linux OS) is set to 0. In this case, you can accept IPv4
connections on your IPv6-only socket, but the remote address will be mangled.
Use `ipaddr.process` method to automatically demangle it.
### Object representation
Parsing methods return an object which descends from `ipaddr.IPv6` or
`ipaddr.IPv4`. These objects share some properties, but most of them differ.
#### Shared properties
One can determine the type of address by calling `addr.kind()`. It will return
either `"ipv6"` or `"ipv4"`.
An address can be converted back to its string representation with `addr.toString()`.
Note that this method:
* does not return the original string used to create the object (in fact, there is
no way of getting that string)
* returns a compact representation (when it is applicable)
A `match(range, bits)` method can be used to check if the address falls into a
certain CIDR range.
Note that an address can be (obviously) matched only against an address of the same type.
For example:
```js
var addr = ipaddr.parse("2001:db8:1234::1");
var range = ipaddr.parse("2001:db8::");
addr.match(range, 32); // => true
```
Alternatively, `match` can also be called as `match([range, bits])`. In this way,
it can be used together with the `parseCIDR(string)` method, which parses an IP
address together with a CIDR range.
For example:
```js
var addr = ipaddr.parse("2001:db8:1234::1");
addr.match(ipaddr.parseCIDR("2001:db8::/32")); // => true
```
A `range()` method returns one of predefined names for several special ranges defined
by IP protocols. The exact names (and their respective CIDR ranges) can be looked up
in the source: [IPv6 ranges] and [IPv4 ranges]. Some common ones include `"unicast"`
(the default one) and `"reserved"`.
You can match against your own range list by using
`ipaddr.subnetMatch(address, rangeList, defaultName)` method. It can work with a mix of IPv6 or IPv4 addresses, and accepts a name-to-subnet map as the range list. For example:
```js
var rangeList = {
documentationOnly: [ ipaddr.parse('2001:db8::'), 32 ],
tunnelProviders: [
[ ipaddr.parse('2001:470::'), 32 ], // he.net
[ ipaddr.parse('2001:5c0::'), 32 ] // freenet6
]
};
ipaddr.subnetMatch(ipaddr.parse('2001:470:8:66::1'), rangeList, 'unknown'); // => "tunnelProviders"
```
The addresses can be converted to their byte representation with `toByteArray()`.
(Actually, JavaScript mostly does not know about byte buffers. They are emulated with
arrays of numbers, each in range of 0..255.)
```js
var bytes = ipaddr.parse('2a00:1450:8007::68').toByteArray(); // ipv6.google.com
bytes // => [42, 0x00, 0x14, 0x50, 0x80, 0x07, 0x00, <zeroes...>, 0x00, 0x68 ]
```
The `ipaddr.IPv4` and `ipaddr.IPv6` objects have some methods defined, too. All of them
have the same interface for both protocols, and are similar to global methods.
`ipaddr.IPvX.isValid(string)` can be used to check if the string is a valid address
for particular protocol, and `ipaddr.IPvX.parse(string)` is the error-throwing parser.
`ipaddr.IPvX.isValid(string)` uses the same format for parsing as the POSIX `inet_ntoa` function, which accepts unusual formats like `0xc0.168.1.1` or `0x10000000`. The function `ipaddr.IPv4.isValidFourPartDecimal(string)` validates the IPv4 address and also ensures that it is written in four-part decimal format.
[IPv6 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L186
[IPv4 ranges]: https://github.com/whitequark/ipaddr.js/blob/master/src/ipaddr.coffee#L71
#### IPv6 properties
Sometimes you will want to convert IPv6 not to a compact string representation (with
the `::` substitution); the `toNormalizedString()` method will return an address where
all zeroes are explicit.
For example:
```js
var addr = ipaddr.parse("2001:0db8::0001");
addr.toString(); // => "2001:db8::1"
addr.toNormalizedString(); // => "2001:db8:0:0:0:0:0:1"
```
The `isIPv4MappedAddress()` method will return `true` if this address is an IPv4-mapped
one, and `toIPv4Address()` will return an IPv4 object address.
To access the underlying binary representation of the address, use `addr.parts`.
```js
var addr = ipaddr.parse("2001:db8:10::1234:DEAD");
addr.parts // => [0x2001, 0xdb8, 0x10, 0, 0, 0, 0x1234, 0xdead]
```
A IPv6 zone index can be accessed via `addr.zoneId`:
```js
var addr = ipaddr.parse("2001:db8::%eth0");
addr.zoneId // => 'eth0'
```
#### IPv4 properties
`toIPv4MappedAddress()` will return a corresponding IPv4-mapped IPv6 address.
To access the underlying representation of the address, use `addr.octets`.
```js
var addr = ipaddr.parse("192.168.1.1");
addr.octets // => [192, 168, 1, 1]
```
`prefixLengthFromSubnetMask()` will return a CIDR prefix length for a valid IPv4 netmask or
null if the netmask is not valid.
```js
ipaddr.IPv4.parse('255.255.255.240').prefixLengthFromSubnetMask() == 28
ipaddr.IPv4.parse('255.192.164.0').prefixLengthFromSubnetMask() == null
```
`subnetMaskFromPrefixLength()` will return an IPv4 netmask for a valid CIDR prefix length.
```js
ipaddr.IPv4.subnetMaskFromPrefixLength(24) == "255.255.255.0"
ipaddr.IPv4.subnetMaskFromPrefixLength(29) == "255.255.255.248"
```
`broadcastAddressFromCIDR()` will return the broadcast address for a given IPv4 interface and netmask in CIDR notation.
```js
ipaddr.IPv4.broadcastAddressFromCIDR("172.0.0.1/24") == "172.0.0.255"
```
`networkAddressFromCIDR()` will return the network address for a given IPv4 interface and netmask in CIDR notation.
```js
ipaddr.IPv4.networkAddressFromCIDR("172.0.0.1/24") == "172.0.0.0"
```
#### Conversion
IPv4 and IPv6 can be converted bidirectionally to and from network byte order (MSB) byte arrays.
The `fromByteArray()` method will take an array and create an appropriate IPv4 or IPv6 object
if the input satisfies the requirements. For IPv4 it has to be an array of four 8-bit values,
while for IPv6 it has to be an array of sixteen 8-bit values.
For example:
```js
var addr = ipaddr.fromByteArray([0x7f, 0, 0, 1]);
addr.toString(); // => "127.0.0.1"
```
or
```js
var addr = ipaddr.fromByteArray([0x20, 1, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
addr.toString(); // => "2001:db8::1"
```
Both objects also offer a `toByteArray()` method, which returns an array in network byte order (MSB).
For example:
```js
var addr = ipaddr.parse("127.0.0.1");
addr.toByteArray(); // => [0x7f, 0, 0, 1]
```
or
```js
var addr = ipaddr.parse("2001:db8::1");
addr.toByteArray(); // => [0x20, 1, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
```
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAUM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,IAAI,CAAA,GAAA,6BAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB,cAAc,aAAa;QACpD,CAAA,GAAA,yBAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,cAAc,aAAa,KAAK,sBAAsB,QAAQ,WAAW,EAC3E,CAAA,GAAA,4BAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,4BAAoB,EAAE;AAE1B","sources":["packages/@react-aria/focus/src/focusSafely.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableElement} from '@react-types/shared';\nimport {focusWithoutScrolling, getOwnerDocument, runAfterTransition} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement) {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = ownerDocument.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (ownerDocument.activeElement === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.module.js.map"}
@@ -0,0 +1,8 @@
export declare enum InversifyCoreErrorKind {
injectionDecoratorConflict = 0,
missingInjectionDecorator = 1,
planning = 2,
resolution = 3,
unknown = 4
}
//# sourceMappingURL=InversifyCoreErrorKind.d.ts.map
@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./bigint"), exports);
@@ -0,0 +1,235 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _writer = _interopRequireDefault(require("./writer"));
var _directory = _interopRequireDefault(require("./table/directory"));
var _support = _interopRequireDefault(require("./table/support"));
var _checkSum = _interopRequireDefault(require("./util/checkSum"));
var _error = _interopRequireDefault(require("./error"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
* @file ttf写入器
* @author mengke01(kekee000@gmail.com)
*/
// 支持写的表, 注意表顺序
var SUPPORT_TABLES = ['OS/2', 'cmap', 'glyf', 'head', 'hhea', 'hmtx', 'loca', 'maxp', 'name', 'post'];
var TTFWriter = exports.default = /*#__PURE__*/function () {
function TTFWriter() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, TTFWriter);
this.options = {
writeZeroContoursGlyfData: options.writeZeroContoursGlyfData || false,
// 不写入空 glyf 数据
hinting: options.hinting || false,
// 默认不保留hints信息
kerning: options.kerning || false,
// 默认不保留 kernings space 信息
support: options.support // 自定义的导出表结构,可以自己修改某些表项目
};
}
/**
* 处理ttf结构,以便于写
*
* @param {ttfObject} ttf ttf数据结构
*/
return _createClass(TTFWriter, [{
key: "resolveTTF",
value: function resolveTTF(ttf) {
// 头部信息
ttf.version = ttf.version || 0x1;
ttf.numTables = ttf.writeOptions.tables.length;
ttf.entrySelector = Math.floor(Math.log(ttf.numTables) / Math.LN2);
ttf.searchRange = Math.pow(2, ttf.entrySelector) * 16;
ttf.rangeShift = ttf.numTables * 16 - ttf.searchRange;
// 重置校验码
ttf.head.checkSumAdjustment = 0;
ttf.head.magickNumber = 0x5F0F3CF5;
if (typeof ttf.head.created === 'string') {
ttf.head.created = /^\d+$/.test(ttf.head.created) ? +ttf.head.created : Date.parse(ttf.head.created);
}
if (typeof ttf.head.modified === 'string') {
ttf.head.modified = /^\d+$/.test(ttf.head.modified) ? +ttf.head.modified : Date.parse(ttf.head.modified);
}
// 重置日期
if (!ttf.head.created) {
ttf.head.created = Date.now();
}
if (!ttf.head.modified) {
ttf.head.modified = ttf.head.created;
}
var checkUnicodeRepeat = {}; // 检查是否有重复代码点
// 将glyf的代码点按小到大排序
ttf.glyf.forEach(function (glyf, index) {
if (glyf.unicode) {
glyf.unicode = glyf.unicode.sort();
glyf.unicode.forEach(function (u) {
if (checkUnicodeRepeat[u]) {
_error.default.raise({
number: 10200,
data: index
}, index);
} else {
checkUnicodeRepeat[u] = true;
}
});
}
});
}
/**
* 写ttf文件
*
* @param {ttfObject} ttf ttf数据结构
* @return {ArrayBuffer} 字节流
*/
}, {
key: "dump",
value: function dump(ttf) {
// 用来做写入缓存的对象,用完后删掉
ttf.support = Object.assign({}, this.options.support);
// head + directory
var ttfSize = 12 + ttf.numTables * 16;
var ttfHeadOffset = 0; // 记录head的偏移
// 构造tables
ttf.support.tables = [];
ttf.writeOptions.tables.forEach(function (tableName) {
var offset = ttfSize;
var TableClass = _support.default[tableName];
var tableSize = new TableClass().size(ttf); // 原始的表大小
var size = tableSize; // 对齐后的表大小
if (tableName === 'head') {
ttfHeadOffset = offset;
}
// 4字节对齐
if (size % 4) {
size += 4 - size % 4;
}
ttf.support.tables.push({
name: tableName,
checkSum: 0,
offset: offset,
length: tableSize,
size: size
});
ttfSize += size;
});
var writer = new _writer.default(new ArrayBuffer(ttfSize));
// 写头部
writer.writeFixed(ttf.version);
writer.writeUint16(ttf.numTables);
writer.writeUint16(ttf.searchRange);
writer.writeUint16(ttf.entrySelector);
writer.writeUint16(ttf.rangeShift);
// 写表偏移
new _directory.default().write(writer, ttf);
// 写支持的表数据
ttf.support.tables.forEach(function (table) {
var tableStart = writer.offset;
var TableClass = _support.default[table.name];
new TableClass().write(writer, ttf);
if (table.length % 4) {
// 对齐字节
writer.writeEmpty(4 - table.length % 4);
}
// 计算校验和
table.checkSum = (0, _checkSum.default)(writer.getBuffer(), tableStart, table.size);
});
// 重新写入每个表校验和
ttf.support.tables.forEach(function (table, index) {
var offset = 12 + index * 16 + 4;
writer.writeUint32(table.checkSum, offset);
});
// 写入总校验和
var ttfCheckSum = (0xB1B0AFBA - (0, _checkSum.default)(writer.getBuffer()) + 0x100000000) % 0x100000000;
writer.writeUint32(ttfCheckSum, ttfHeadOffset + 8);
delete ttf.writeOptions;
delete ttf.support;
var buffer = writer.getBuffer();
writer.dispose();
return buffer;
}
/**
* 对ttf的表进行评估,标记需要处理的表
*
* @param {Object} ttf ttf对象
*/
}, {
key: "prepareDump",
value: function prepareDump(ttf) {
if (!ttf.glyf || ttf.glyf.length === 0) {
_error.default.raise(10201);
}
if (!ttf['OS/2'] || !ttf.head || !ttf.name) {
_error.default.raise(10204);
}
var tables = SUPPORT_TABLES.slice(0);
ttf.writeOptions = {};
// hinting tables direct copy
if (this.options.hinting) {
['cvt', 'fpgm', 'prep', 'gasp', 'GPOS', 'kern', 'kerx'].forEach(function (table) {
if (ttf[table]) {
tables.push(table);
}
});
}
// copy kerning space table
if (this.options.kerning) {
['GPOS', 'kern', 'kerx'].forEach(function (table) {
if (ttf[table]) {
tables.push(table);
}
});
}
ttf.writeOptions.writeZeroContoursGlyfData = !!this.options.writeZeroContoursGlyfData;
ttf.writeOptions.hinting = !!this.options.hinting;
ttf.writeOptions.kerning = !!this.options.kerning;
ttf.writeOptions.tables = tables.sort();
}
/**
* 写一个ttf字体结构
*
* @param {Object} ttf ttf数据结构
* @return {ArrayBuffer} 缓冲数组
*/
}, {
key: "write",
value: function write(ttf) {
this.prepareDump(ttf);
this.resolveTTF(ttf);
var buffer = this.dump(ttf);
return buffer;
}
/**
* 注销
*/
}, {
key: "dispose",
value: function dispose() {
delete this.options;
}
}]);
}();
@@ -0,0 +1,468 @@
import { HasPropertyKey } from '../guard/index.mjs';
import { Check } from '../check/index.mjs';
import { Clone } from '../clone/index.mjs';
import { Deref, Pushref } from '../deref/index.mjs';
import { TemplateLiteralGenerate, IsTemplateLiteralFinite } from '../../type/template-literal/index.mjs';
import { TypeRegistry } from '../../type/registry/index.mjs';
import { Kind } from '../../type/symbols/index.mjs';
import { TypeBoxError } from '../../type/error/index.mjs';
import { IsFunction } from '../guard/guard.mjs';
// ------------------------------------------------------------------
// Errors
// ------------------------------------------------------------------
export class ValueCreateError extends TypeBoxError {
constructor(schema, message) {
super(message);
this.schema = schema;
}
}
// ------------------------------------------------------------------
// Default
// ------------------------------------------------------------------
function FromDefault(value) {
return IsFunction(value) ? value() : Clone(value);
}
// ------------------------------------------------------------------
// Create
// ------------------------------------------------------------------
function FromAny(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return {};
}
}
function FromArgument(schema, references) {
return {};
}
function FromArray(schema, references) {
if (schema.uniqueItems === true && !HasPropertyKey(schema, 'default')) {
throw new ValueCreateError(schema, 'Array with the uniqueItems constraint requires a default value');
}
else if ('contains' in schema && !HasPropertyKey(schema, 'default')) {
throw new ValueCreateError(schema, 'Array with the contains constraint requires a default value');
}
else if ('default' in schema) {
return FromDefault(schema.default);
}
else if (schema.minItems !== undefined) {
return Array.from({ length: schema.minItems }).map((item) => {
return Visit(schema.items, references);
});
}
else {
return [];
}
}
function FromAsyncIterator(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return (async function* () { })();
}
}
function FromBigInt(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return BigInt(0);
}
}
function FromBoolean(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return false;
}
}
function FromConstructor(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
const value = Visit(schema.returns, references);
if (typeof value === 'object' && !Array.isArray(value)) {
return class {
constructor() {
for (const [key, val] of Object.entries(value)) {
const self = this;
self[key] = val;
}
}
};
}
else {
return class {
};
}
}
}
function FromDate(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else if (schema.minimumTimestamp !== undefined) {
return new Date(schema.minimumTimestamp);
}
else {
return new Date();
}
}
function FromFunction(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return () => Visit(schema.returns, references);
}
}
function FromImport(schema, references) {
const definitions = globalThis.Object.values(schema.$defs);
const target = schema.$defs[schema.$ref];
return Visit(target, [...references, ...definitions]);
}
function FromInteger(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else if (schema.minimum !== undefined) {
return schema.minimum;
}
else {
return 0;
}
}
function FromIntersect(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
// --------------------------------------------------------------
// Note: The best we can do here is attempt to instance each
// sub type and apply through object assign. For non-object
// sub types, we just escape the assignment and just return
// the value. In the latter case, this is typically going to
// be a consequence of an illogical intersection.
// --------------------------------------------------------------
const value = schema.allOf.reduce((acc, schema) => {
const next = Visit(schema, references);
return typeof next === 'object' ? { ...acc, ...next } : next;
}, {});
if (!Check(schema, references, value))
throw new ValueCreateError(schema, 'Intersect produced invalid value. Consider using a default value.');
return value;
}
}
function FromIterator(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return (function* () { })();
}
}
function FromLiteral(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return schema.const;
}
}
function FromNever(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
throw new ValueCreateError(schema, 'Never types cannot be created. Consider using a default value.');
}
}
function FromNot(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
throw new ValueCreateError(schema, 'Not types must have a default value');
}
}
function FromNull(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return null;
}
}
function FromNumber(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else if (schema.minimum !== undefined) {
return schema.minimum;
}
else {
return 0;
}
}
function FromObject(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
const required = new Set(schema.required);
const Acc = {};
for (const [key, subschema] of Object.entries(schema.properties)) {
if (!required.has(key))
continue;
Acc[key] = Visit(subschema, references);
}
return Acc;
}
}
function FromPromise(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return Promise.resolve(Visit(schema.item, references));
}
}
function FromRecord(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return {};
}
}
function FromRef(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return Visit(Deref(schema, references), references);
}
}
function FromRegExp(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
throw new ValueCreateError(schema, 'RegExp types cannot be created. Consider using a default value.');
}
}
function FromString(schema, references) {
if (schema.pattern !== undefined) {
if (!HasPropertyKey(schema, 'default')) {
throw new ValueCreateError(schema, 'String types with patterns must specify a default value');
}
else {
return FromDefault(schema.default);
}
}
else if (schema.format !== undefined) {
if (!HasPropertyKey(schema, 'default')) {
throw new ValueCreateError(schema, 'String types with formats must specify a default value');
}
else {
return FromDefault(schema.default);
}
}
else {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else if (schema.minLength !== undefined) {
// prettier-ignore
return Array.from({ length: schema.minLength }).map(() => ' ').join('');
}
else {
return '';
}
}
}
function FromSymbol(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else if ('value' in schema) {
return Symbol.for(schema.value);
}
else {
return Symbol();
}
}
function FromTemplateLiteral(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
if (!IsTemplateLiteralFinite(schema))
throw new ValueCreateError(schema, 'Can only create template literals that produce a finite variants. Consider using a default value.');
const generated = TemplateLiteralGenerate(schema);
return generated[0];
}
function FromThis(schema, references) {
if (recursiveDepth++ > recursiveMaxDepth)
throw new ValueCreateError(schema, 'Cannot create recursive type as it appears possibly infinite. Consider using a default.');
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return Visit(Deref(schema, references), references);
}
}
function FromTuple(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
if (schema.items === undefined) {
return [];
}
else {
return Array.from({ length: schema.minItems }).map((_, index) => Visit(schema.items[index], references));
}
}
function FromUndefined(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return undefined;
}
}
function FromUnion(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else if (schema.anyOf.length === 0) {
throw new Error('ValueCreate.Union: Cannot create Union with zero variants');
}
else {
return Visit(schema.anyOf[0], references);
}
}
function FromUint8Array(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else if (schema.minByteLength !== undefined) {
return new Uint8Array(schema.minByteLength);
}
else {
return new Uint8Array(0);
}
}
function FromUnknown(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return {};
}
}
function FromVoid(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
return void 0;
}
}
function FromKind(schema, references) {
if (HasPropertyKey(schema, 'default')) {
return FromDefault(schema.default);
}
else {
throw new Error('User defined types must specify a default value');
}
}
function Visit(schema, references) {
const references_ = Pushref(schema, references);
const schema_ = schema;
switch (schema_[Kind]) {
case 'Any':
return FromAny(schema_, references_);
case 'Argument':
return FromArgument(schema_, references_);
case 'Array':
return FromArray(schema_, references_);
case 'AsyncIterator':
return FromAsyncIterator(schema_, references_);
case 'BigInt':
return FromBigInt(schema_, references_);
case 'Boolean':
return FromBoolean(schema_, references_);
case 'Constructor':
return FromConstructor(schema_, references_);
case 'Date':
return FromDate(schema_, references_);
case 'Function':
return FromFunction(schema_, references_);
case 'Import':
return FromImport(schema_, references_);
case 'Integer':
return FromInteger(schema_, references_);
case 'Intersect':
return FromIntersect(schema_, references_);
case 'Iterator':
return FromIterator(schema_, references_);
case 'Literal':
return FromLiteral(schema_, references_);
case 'Never':
return FromNever(schema_, references_);
case 'Not':
return FromNot(schema_, references_);
case 'Null':
return FromNull(schema_, references_);
case 'Number':
return FromNumber(schema_, references_);
case 'Object':
return FromObject(schema_, references_);
case 'Promise':
return FromPromise(schema_, references_);
case 'Record':
return FromRecord(schema_, references_);
case 'Ref':
return FromRef(schema_, references_);
case 'RegExp':
return FromRegExp(schema_, references_);
case 'String':
return FromString(schema_, references_);
case 'Symbol':
return FromSymbol(schema_, references_);
case 'TemplateLiteral':
return FromTemplateLiteral(schema_, references_);
case 'This':
return FromThis(schema_, references_);
case 'Tuple':
return FromTuple(schema_, references_);
case 'Undefined':
return FromUndefined(schema_, references_);
case 'Union':
return FromUnion(schema_, references_);
case 'Uint8Array':
return FromUint8Array(schema_, references_);
case 'Unknown':
return FromUnknown(schema_, references_);
case 'Void':
return FromVoid(schema_, references_);
default:
if (!TypeRegistry.Has(schema_[Kind]))
throw new ValueCreateError(schema_, 'Unknown type');
return FromKind(schema_, references_);
}
}
// ------------------------------------------------------------------
// State
// ------------------------------------------------------------------
const recursiveMaxDepth = 512;
let recursiveDepth = 0;
/** Creates a value from the given schema */
export function Create(...args) {
recursiveDepth = 0;
return args.length === 2 ? Visit(args[0], args[1]) : Visit(args[0], []);
}
@@ -0,0 +1,47 @@
'use strict';
var $TypeError = require('es-errors/type');
var IsFixedLengthArrayBuffer = require('./IsFixedLengthArrayBuffer');
var IsViewOutOfBounds = require('./IsViewOutOfBounds');
var isDataViewWithBufferWitnessRecord = require('../helpers/records/data-view-with-buffer-witness-record');
var dataViewBuffer = require('data-view-buffer');
var dataViewByteLength = require('data-view-byte-length');
var dataViewByteOffset = require('data-view-byte-offset');
// https://262.ecma-international.org/15.0/#sec-getviewbytelength
module.exports = function GetViewByteLength(viewRecord) {
if (!isDataViewWithBufferWitnessRecord(viewRecord)) {
throw new $TypeError('Assertion failed: `viewRecord` must be a DataView with Buffer Witness Record');
}
if (IsViewOutOfBounds(viewRecord)) {
throw new $TypeError('Assertion failed: `viewRecord` is out of bounds'); // step 1
}
var view = viewRecord['[[Object]]']; // step 2
var isFixed = IsFixedLengthArrayBuffer(dataViewBuffer(view));
var viewByteLength = isFixed ? dataViewByteLength(view) : 'AUTO'; // view.[[ByteLength]]
if (viewByteLength !== 'AUTO') {
return viewByteLength; // step 3
}
if (isFixed) {
throw new $TypeError('Assertion failed: DataView’s ArrayBuffer is not fixed length'); // step 4
}
var byteOffset = dataViewByteOffset(view); // step 5
var byteLength = viewRecord['[[CachedBufferByteLength]]']; // step 6
if (byteLength === 'DETACHED') {
throw new $TypeError('Assertion failed: DataView’s ArrayBuffer is detached'); // step 7
}
return byteLength - byteOffset; // step 8
};
@@ -0,0 +1,81 @@
'use strict';
const AggregateError = require('aggregate-error');
module.exports = async (
iterable,
mapper,
{
concurrency = Infinity,
stopOnError = true
} = {}
) => {
return new Promise((resolve, reject) => {
if (typeof mapper !== 'function') {
throw new TypeError('Mapper function is required');
}
if (!((Number.isSafeInteger(concurrency) || concurrency === Infinity) && concurrency >= 1)) {
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
}
const result = [];
const errors = [];
const iterator = iterable[Symbol.iterator]();
let isRejected = false;
let isIterableDone = false;
let resolvingCount = 0;
let currentIndex = 0;
const next = () => {
if (isRejected) {
return;
}
const nextItem = iterator.next();
const index = currentIndex;
currentIndex++;
if (nextItem.done) {
isIterableDone = true;
if (resolvingCount === 0) {
if (!stopOnError && errors.length !== 0) {
reject(new AggregateError(errors));
} else {
resolve(result);
}
}
return;
}
resolvingCount++;
(async () => {
try {
const element = await nextItem.value;
result[index] = await mapper(element, index);
resolvingCount--;
next();
} catch (error) {
if (stopOnError) {
isRejected = true;
reject(error);
} else {
errors.push(error);
resolvingCount--;
next();
}
}
})();
};
for (let i = 0; i < concurrency; i++) {
next();
if (isIterableDone) {
break;
}
}
});
};
@@ -0,0 +1,5 @@
'use strict';
module.exports = {
stdout: false,
stderr: false
};
@@ -0,0 +1,45 @@
'use strict';
var $TypeError = require('es-errors/type');
var callBound = require('call-bound');
var forEach = require('../helpers/forEach');
var $charCodeAt = callBound('String.prototype.charCodeAt');
var $strSplit = callBound('String.prototype.split');
var UnicodeEscape = require('./UnicodeEscape');
var hasOwn = require('hasown');
// https://262.ecma-international.org/9.0/#sec-quotejsonstring
var escapes = {
'\u0008': '\\b',
'\u0009': '\\t',
'\u000A': '\\n',
'\u000C': '\\f',
'\u000D': '\\r',
'\u0022': '\\"',
'\u005c': '\\\\'
};
module.exports = function QuoteJSONString(value) {
if (typeof value !== 'string') {
throw new $TypeError('Assertion failed: `value` must be a String');
}
var product = '"';
if (value) {
forEach($strSplit(value, ''), function (C) {
if (hasOwn(escapes, C)) {
product += escapes[C];
} else if ($charCodeAt(C, 0) < 0x20) {
product += UnicodeEscape(C);
} else {
product += C;
}
});
}
product += '"';
return product;
};
@@ -0,0 +1,14 @@
{
"name": "@my-scope/package-a",
"version": "0.0.0",
"private": true,
"description": "",
"license": "MIT",
"main": "index.js",
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@my-scope/package-b": "^0.0.0"
}
}
@@ -0,0 +1,75 @@
{
"name": "@types/chai",
"version": "5.2.3",
"description": "TypeScript definitions for chai",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai",
"license": "MIT",
"contributors": [
{
"name": "Bart van der Schoor",
"githubUsername": "Bartvds",
"url": "https://github.com/Bartvds"
},
{
"name": "Andrew Brown",
"githubUsername": "AGBrown",
"url": "https://github.com/AGBrown"
},
{
"name": "Olivier Chevet",
"githubUsername": "olivr70",
"url": "https://github.com/olivr70"
},
{
"name": "Matt Wistrand",
"githubUsername": "mwistrand",
"url": "https://github.com/mwistrand"
},
{
"name": "Shaun Luttin",
"githubUsername": "shaunluttin",
"url": "https://github.com/shaunluttin"
},
{
"name": "Satana Charuwichitratana",
"githubUsername": "micksatana",
"url": "https://github.com/micksatana"
},
{
"name": "Erik Schierboom",
"githubUsername": "ErikSchierboom",
"url": "https://github.com/ErikSchierboom"
},
{
"name": "Bogdan Paranytsia",
"githubUsername": "bparan",
"url": "https://github.com/bparan"
},
{
"name": "CXuesong",
"githubUsername": "CXuesong",
"url": "https://github.com/CXuesong"
},
{
"name": "Joey Kilpatrick",
"githubUsername": "joeykilpatrick",
"url": "https://github.com/joeykilpatrick"
}
],
"type": "module",
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/chai"
},
"scripts": {},
"dependencies": {
"@types/deep-eql": "*",
"assertion-error": "^2.0.1"
},
"peerDependencies": {},
"typesPublisherContentHash": "d9d83f1594f42010e624e46e4c8cfeee284bdd04cb05eb0730aec14140f2a833",
"typeScriptVersion": "5.2"
}
@@ -0,0 +1,759 @@
import { debounce, memo, notUndefined, approxEqual } from "./utils.js";
const defaultKeyExtractor = (index) => index;
const defaultRangeExtractor = (range) => {
const start = Math.max(range.startIndex - range.overscan, 0);
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
const arr = [];
for (let i = start; i <= end; i++) {
arr.push(i);
}
return arr;
};
const observeElementRect = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const targetWindow = instance.targetWindow;
if (!targetWindow) {
return;
}
const handler = (rect) => {
const { width, height } = rect;
cb({ width: Math.round(width), height: Math.round(height) });
};
handler(element.getBoundingClientRect());
if (!targetWindow.ResizeObserver) {
return () => {
};
}
const observer = new targetWindow.ResizeObserver((entries) => {
const entry = entries[0];
if (entry == null ? void 0 : entry.borderBoxSize) {
const box = entry.borderBoxSize[0];
if (box) {
handler({ width: box.inlineSize, height: box.blockSize });
return;
}
}
handler(element.getBoundingClientRect());
});
observer.observe(element, { box: "border-box" });
return () => {
observer.unobserve(element);
};
};
const addEventListenerOptions = {
passive: true
};
const observeWindowRect = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const handler = () => {
cb({ width: element.innerWidth, height: element.innerHeight });
};
handler();
element.addEventListener("resize", handler, addEventListenerOptions);
return () => {
element.removeEventListener("resize", handler);
};
};
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
const observeElementOffset = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const targetWindow = instance.targetWindow;
if (!targetWindow) {
return;
}
let offset = 0;
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
targetWindow,
() => {
cb(offset, false);
},
instance.options.isScrollingResetDelay
);
const createHandler = (isScrolling) => () => {
const { horizontal, isRtl } = instance.options;
offset = horizontal ? element["scrollLeft"] * (isRtl && -1 || 1) : element["scrollTop"];
fallback();
cb(offset, isScrolling);
};
const handler = createHandler(true);
const endHandler = createHandler(false);
endHandler();
element.addEventListener("scroll", handler, addEventListenerOptions);
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
return () => {
element.removeEventListener("scroll", handler);
element.removeEventListener("scrollend", endHandler);
};
};
const observeWindowOffset = (instance, cb) => {
const element = instance.scrollElement;
if (!element) {
return;
}
const targetWindow = instance.targetWindow;
if (!targetWindow) {
return;
}
let offset = 0;
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
targetWindow,
() => {
cb(offset, false);
},
instance.options.isScrollingResetDelay
);
const createHandler = (isScrolling) => () => {
offset = element[instance.options.horizontal ? "scrollX" : "scrollY"];
fallback();
cb(offset, isScrolling);
};
const handler = createHandler(true);
const endHandler = createHandler(false);
endHandler();
element.addEventListener("scroll", handler, addEventListenerOptions);
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
return () => {
element.removeEventListener("scroll", handler);
element.removeEventListener("scrollend", endHandler);
};
};
const measureElement = (element, entry, instance) => {
if (entry == null ? void 0 : entry.borderBoxSize) {
const box = entry.borderBoxSize[0];
if (box) {
const size = Math.round(
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
);
return size;
}
}
return Math.round(
element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
);
};
const windowScroll = (offset, {
adjustments = 0,
behavior
}, instance) => {
var _a, _b;
const toOffset = offset + adjustments;
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
[instance.options.horizontal ? "left" : "top"]: toOffset,
behavior
});
};
const elementScroll = (offset, {
adjustments = 0,
behavior
}, instance) => {
var _a, _b;
const toOffset = offset + adjustments;
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
[instance.options.horizontal ? "left" : "top"]: toOffset,
behavior
});
};
class Virtualizer {
constructor(opts) {
this.unsubs = [];
this.scrollElement = null;
this.targetWindow = null;
this.isScrolling = false;
this.scrollToIndexTimeoutId = null;
this.measurementsCache = [];
this.itemSizeCache = /* @__PURE__ */ new Map();
this.pendingMeasuredCacheIndexes = [];
this.scrollRect = null;
this.scrollOffset = null;
this.scrollDirection = null;
this.scrollAdjustments = 0;
this.elementsCache = /* @__PURE__ */ new Map();
this.observer = /* @__PURE__ */ (() => {
let _ro = null;
const get = () => {
if (_ro) {
return _ro;
}
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
return null;
}
return _ro = new this.targetWindow.ResizeObserver((entries) => {
entries.forEach((entry) => {
this._measureElement(entry.target, entry);
});
});
};
return {
disconnect: () => {
var _a;
(_a = get()) == null ? void 0 : _a.disconnect();
_ro = null;
},
observe: (target) => {
var _a;
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
},
unobserve: (target) => {
var _a;
return (_a = get()) == null ? void 0 : _a.unobserve(target);
}
};
})();
this.range = null;
this.setOptions = (opts2) => {
Object.entries(opts2).forEach(([key, value]) => {
if (typeof value === "undefined") delete opts2[key];
});
this.options = {
debug: false,
initialOffset: 0,
overscan: 1,
paddingStart: 0,
paddingEnd: 0,
scrollPaddingStart: 0,
scrollPaddingEnd: 0,
horizontal: false,
getItemKey: defaultKeyExtractor,
rangeExtractor: defaultRangeExtractor,
onChange: () => {
},
measureElement,
initialRect: { width: 0, height: 0 },
scrollMargin: 0,
gap: 0,
indexAttribute: "data-index",
initialMeasurementsCache: [],
lanes: 1,
isScrollingResetDelay: 150,
enabled: true,
isRtl: false,
useScrollendEvent: true,
...opts2
};
};
this.notify = (sync) => {
var _a, _b;
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
};
this.maybeNotify = memo(
() => {
this.calculateRange();
return [
this.isScrolling,
this.range ? this.range.startIndex : null,
this.range ? this.range.endIndex : null
];
},
(isScrolling) => {
this.notify(isScrolling);
},
{
key: process.env.NODE_ENV !== "production" && "maybeNotify",
debug: () => this.options.debug,
initialDeps: [
this.isScrolling,
this.range ? this.range.startIndex : null,
this.range ? this.range.endIndex : null
]
}
);
this.cleanup = () => {
this.unsubs.filter(Boolean).forEach((d) => d());
this.unsubs = [];
this.observer.disconnect();
this.scrollElement = null;
this.targetWindow = null;
};
this._didMount = () => {
return () => {
this.cleanup();
};
};
this._willUpdate = () => {
var _a;
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
if (this.scrollElement !== scrollElement) {
this.cleanup();
if (!scrollElement) {
this.maybeNotify();
return;
}
this.scrollElement = scrollElement;
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
} else {
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
}
this.elementsCache.forEach((cached) => {
this.observer.observe(cached);
});
this._scrollToOffset(this.getScrollOffset(), {
adjustments: void 0,
behavior: void 0
});
this.unsubs.push(
this.options.observeElementRect(this, (rect) => {
this.scrollRect = rect;
this.maybeNotify();
})
);
this.unsubs.push(
this.options.observeElementOffset(this, (offset, isScrolling) => {
this.scrollAdjustments = 0;
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
this.scrollOffset = offset;
this.isScrolling = isScrolling;
this.maybeNotify();
})
);
}
};
this.getSize = () => {
if (!this.options.enabled) {
this.scrollRect = null;
return 0;
}
this.scrollRect = this.scrollRect ?? this.options.initialRect;
return this.scrollRect[this.options.horizontal ? "width" : "height"];
};
this.getScrollOffset = () => {
if (!this.options.enabled) {
this.scrollOffset = null;
return 0;
}
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
return this.scrollOffset;
};
this.getFurthestMeasurement = (measurements, index) => {
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
const furthestMeasurements = /* @__PURE__ */ new Map();
for (let m = index - 1; m >= 0; m--) {
const measurement = measurements[m];
if (furthestMeasurementsFound.has(measurement.lane)) {
continue;
}
const previousFurthestMeasurement = furthestMeasurements.get(
measurement.lane
);
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
furthestMeasurements.set(measurement.lane, measurement);
} else if (measurement.end < previousFurthestMeasurement.end) {
furthestMeasurementsFound.set(measurement.lane, true);
}
if (furthestMeasurementsFound.size === this.options.lanes) {
break;
}
}
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
if (a.end === b.end) {
return a.index - b.index;
}
return a.end - b.end;
})[0] : void 0;
};
this.getMeasurementOptions = memo(
() => [
this.options.count,
this.options.paddingStart,
this.options.scrollMargin,
this.options.getItemKey,
this.options.enabled
],
(count, paddingStart, scrollMargin, getItemKey, enabled) => {
this.pendingMeasuredCacheIndexes = [];
return {
count,
paddingStart,
scrollMargin,
getItemKey,
enabled
};
},
{
key: false
}
);
this.getMeasurements = memo(
() => [this.getMeasurementOptions(), this.itemSizeCache],
({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
if (!enabled) {
this.measurementsCache = [];
this.itemSizeCache.clear();
return [];
}
if (this.measurementsCache.length === 0) {
this.measurementsCache = this.options.initialMeasurementsCache;
this.measurementsCache.forEach((item) => {
this.itemSizeCache.set(item.key, item.size);
});
}
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
this.pendingMeasuredCacheIndexes = [];
const measurements = this.measurementsCache.slice(0, min);
for (let i = min; i < count; i++) {
const key = getItemKey(i);
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
const measuredSize = itemSizeCache.get(key);
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
const end = start + size;
const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
measurements[i] = {
index: i,
start,
size,
end,
key,
lane
};
}
this.measurementsCache = measurements;
return measurements;
},
{
key: process.env.NODE_ENV !== "production" && "getMeasurements",
debug: () => this.options.debug
}
);
this.calculateRange = memo(
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
(measurements, outerSize, scrollOffset) => {
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
measurements,
outerSize,
scrollOffset
}) : null;
},
{
key: process.env.NODE_ENV !== "production" && "calculateRange",
debug: () => this.options.debug
}
);
this.getIndexes = memo(
() => {
let startIndex = null;
let endIndex = null;
const range = this.calculateRange();
if (range) {
startIndex = range.startIndex;
endIndex = range.endIndex;
}
return [
this.options.rangeExtractor,
this.options.overscan,
this.options.count,
startIndex,
endIndex
];
},
(rangeExtractor, overscan, count, startIndex, endIndex) => {
return startIndex === null || endIndex === null ? [] : rangeExtractor({
startIndex,
endIndex,
overscan,
count
});
},
{
key: process.env.NODE_ENV !== "production" && "getIndexes",
debug: () => this.options.debug
}
);
this.indexFromElement = (node) => {
const attributeName = this.options.indexAttribute;
const indexStr = node.getAttribute(attributeName);
if (!indexStr) {
console.warn(
`Missing attribute name '${attributeName}={index}' on measured element.`
);
return -1;
}
return parseInt(indexStr, 10);
};
this._measureElement = (node, entry) => {
const index = this.indexFromElement(node);
const item = this.measurementsCache[index];
if (!item) {
return;
}
const key = item.key;
const prevNode = this.elementsCache.get(key);
if (prevNode !== node) {
if (prevNode) {
this.observer.unobserve(prevNode);
}
this.observer.observe(node);
this.elementsCache.set(key, node);
}
if (node.isConnected) {
this.resizeItem(index, this.options.measureElement(node, entry, this));
}
};
this.resizeItem = (index, size) => {
const item = this.measurementsCache[index];
if (!item) {
return;
}
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
const delta = size - itemSize;
if (delta !== 0) {
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
if (process.env.NODE_ENV !== "production" && this.options.debug) {
console.info("correction", delta);
}
this._scrollToOffset(this.getScrollOffset(), {
adjustments: this.scrollAdjustments += delta,
behavior: void 0
});
}
this.pendingMeasuredCacheIndexes.push(item.index);
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
this.notify(false);
}
};
this.measureElement = (node) => {
if (!node) {
this.elementsCache.forEach((cached, key) => {
if (!cached.isConnected) {
this.observer.unobserve(cached);
this.elementsCache.delete(key);
}
});
return;
}
this._measureElement(node, void 0);
};
this.getVirtualItems = memo(
() => [this.getIndexes(), this.getMeasurements()],
(indexes, measurements) => {
const virtualItems = [];
for (let k = 0, len = indexes.length; k < len; k++) {
const i = indexes[k];
const measurement = measurements[i];
virtualItems.push(measurement);
}
return virtualItems;
},
{
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
debug: () => this.options.debug
}
);
this.getVirtualItemForOffset = (offset) => {
const measurements = this.getMeasurements();
if (measurements.length === 0) {
return void 0;
}
return notUndefined(
measurements[findNearestBinarySearch(
0,
measurements.length - 1,
(index) => notUndefined(measurements[index]).start,
offset
)]
);
};
this.getOffsetForAlignment = (toOffset, align) => {
const size = this.getSize();
const scrollOffset = this.getScrollOffset();
if (align === "auto") {
if (toOffset >= scrollOffset + size) {
align = "end";
}
}
if (align === "end") {
toOffset -= size;
}
const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
const maxOffset = scrollSize - size;
return Math.max(Math.min(maxOffset, toOffset), 0);
};
this.getOffsetForIndex = (index, align = "auto") => {
index = Math.max(0, Math.min(index, this.options.count - 1));
const item = this.measurementsCache[index];
if (!item) {
return void 0;
}
const size = this.getSize();
const scrollOffset = this.getScrollOffset();
if (align === "auto") {
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
align = "end";
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
align = "start";
} else {
return [scrollOffset, align];
}
}
const centerOffset = item.start - this.options.scrollPaddingStart + (item.size - size) / 2;
switch (align) {
case "center":
return [this.getOffsetForAlignment(centerOffset, align), align];
case "end":
return [
this.getOffsetForAlignment(
item.end + this.options.scrollPaddingEnd,
align
),
align
];
default:
return [
this.getOffsetForAlignment(
item.start - this.options.scrollPaddingStart,
align
),
align
];
}
};
this.isDynamicMode = () => this.elementsCache.size > 0;
this.cancelScrollToIndex = () => {
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
this.scrollToIndexTimeoutId = null;
}
};
this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
this.cancelScrollToIndex();
if (behavior === "smooth" && this.isDynamicMode()) {
console.warn(
"The `smooth` scroll behavior is not fully supported with dynamic size."
);
}
this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
adjustments: void 0,
behavior
});
};
this.scrollToIndex = (index, { align: initialAlign = "auto", behavior } = {}) => {
index = Math.max(0, Math.min(index, this.options.count - 1));
this.cancelScrollToIndex();
if (behavior === "smooth" && this.isDynamicMode()) {
console.warn(
"The `smooth` scroll behavior is not fully supported with dynamic size."
);
}
const offsetAndAlign = this.getOffsetForIndex(index, initialAlign);
if (!offsetAndAlign) return;
const [offset, align] = offsetAndAlign;
this._scrollToOffset(offset, { adjustments: void 0, behavior });
if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
this.scrollToIndexTimeoutId = null;
const elementInDOM = this.elementsCache.has(
this.options.getItemKey(index)
);
if (elementInDOM) {
const [latestOffset] = notUndefined(
this.getOffsetForIndex(index, align)
);
if (!approxEqual(latestOffset, this.getScrollOffset())) {
this.scrollToIndex(index, { align, behavior });
}
} else {
this.scrollToIndex(index, { align, behavior });
}
});
}
};
this.scrollBy = (delta, { behavior } = {}) => {
this.cancelScrollToIndex();
if (behavior === "smooth" && this.isDynamicMode()) {
console.warn(
"The `smooth` scroll behavior is not fully supported with dynamic size."
);
}
this._scrollToOffset(this.getScrollOffset() + delta, {
adjustments: void 0,
behavior
});
};
this.getTotalSize = () => {
var _a;
const measurements = this.getMeasurements();
let end;
if (measurements.length === 0) {
end = this.options.paddingStart;
} else {
end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max(
...measurements.slice(-this.options.lanes).map((m) => m.end)
);
}
return Math.max(
end - this.options.scrollMargin + this.options.paddingEnd,
0
);
};
this._scrollToOffset = (offset, {
adjustments,
behavior
}) => {
this.options.scrollToFn(offset, { behavior, adjustments }, this);
};
this.measure = () => {
this.itemSizeCache = /* @__PURE__ */ new Map();
this.notify(false);
};
this.setOptions(opts);
}
}
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
while (low <= high) {
const middle = (low + high) / 2 | 0;
const currentValue = getCurrentValue(middle);
if (currentValue < value) {
low = middle + 1;
} else if (currentValue > value) {
high = middle - 1;
} else {
return middle;
}
}
if (low > 0) {
return low - 1;
} else {
return 0;
}
};
function calculateRange({
measurements,
outerSize,
scrollOffset
}) {
const count = measurements.length - 1;
const getOffset = (index) => measurements[index].start;
const startIndex = findNearestBinarySearch(0, count, getOffset, scrollOffset);
let endIndex = startIndex;
while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
endIndex++;
}
return { startIndex, endIndex };
}
export {
Virtualizer,
approxEqual,
debounce,
defaultKeyExtractor,
defaultRangeExtractor,
elementScroll,
measureElement,
memo,
notUndefined,
observeElementOffset,
observeElementRect,
observeWindowOffset,
observeWindowRect,
windowScroll
};
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAWM,SAAS,0CAAkB,YAA2B;IAC3D,IAAI,CAAC,OAAO,SAAS,GAAG,CAAA,GAAA,qBAAO,EAAE;IACjC,IAAI,SAAgD,CAAA,GAAA,mBAAK,EAAuB;IAEhF,0EAA0E;IAC1E,yCAAyC;IACzC,IAAI,UAAU,CAAA,GAAA,wCAAa,EAAE;QAC3B,IAAI,CAAC,OAAO,OAAO,EACjB;QAEF,uCAAuC;QACvC,IAAI,WAAW,OAAO,OAAO,CAAC,IAAI;QAElC,8CAA8C;QAC9C,IAAI,SAAS,IAAI,EAAE;YACjB,OAAO,OAAO,GAAG;YACjB;QACF;QAEA,iDAAiD;QACjD,8CAA8C;QAC9C,8DAA8D;QAC9D,IAAI,UAAU,SAAS,KAAK,EAC1B;aAEA,SAAS,SAAS,KAAK;IAE3B;IAEA,CAAA,GAAA,yCAAc,EAAE;QACd,uEAAuE;QACvE,IAAI,OAAO,OAAO,EAChB;IAEJ;IAEA,IAAI,QAAQ,CAAA,GAAA,wCAAa,EAAE,CAAA;QACzB,OAAO,OAAO,GAAG,GAAG;QACpB;IACF;IAEA,OAAO;QAAC;QAAO;KAAM;AACvB","sources":["packages/@react-aria/utils/src/useValueEffect.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 {Dispatch, MutableRefObject, useRef, useState} from 'react';\nimport {useEffectEvent, useLayoutEffect} from './';\n\ntype SetValueAction<S> = (prev: S) => Generator<any, void, unknown>;\n\n// This hook works like `useState`, but when setting the value, you pass a generator function\n// that can yield multiple values. Each yielded value updates the state and waits for the next\n// layout effect, then continues the generator. This allows sequential updates to state to be\n// written linearly.\nexport function useValueEffect<S>(defaultValue: S | (() => S)): [S, Dispatch<SetValueAction<S>>] {\n let [value, setValue] = useState(defaultValue);\n let effect: MutableRefObject<Generator<S> | null> = useRef<Generator<S> | null>(null);\n\n // Store the function in a ref so we can always access the current version\n // which has the proper `value` in scope.\n let nextRef = useEffectEvent(() => {\n if (!effect.current) {\n return;\n }\n // Run the generator to the next yield.\n let newValue = effect.current.next();\n\n // If the generator is done, reset the effect.\n if (newValue.done) {\n effect.current = null;\n return;\n }\n\n // If the value is the same as the current value,\n // then continue to the next yield. Otherwise,\n // set the value in state and wait for the next layout effect.\n if (value === newValue.value) {\n nextRef();\n } else {\n setValue(newValue.value);\n }\n });\n\n useLayoutEffect(() => {\n // If there is an effect currently running, continue to the next yield.\n if (effect.current) {\n nextRef();\n }\n });\n\n let queue = useEffectEvent(fn => {\n effect.current = fn(value);\n nextRef();\n });\n\n return [value, queue];\n}\n"],"names":[],"version":3,"file":"useValueEffect.main.js.map"}
@@ -0,0 +1,12 @@
import { PluginFunc } from 'dayjs/esm'
declare const plugin: PluginFunc
export = plugin
declare module 'dayjs/esm' {
interface Dayjs {
week(): number
week(value : number): Dayjs
}
}
@@ -0,0 +1,306 @@
/**
* @import {
* Code,
* Construct,
* Exiter,
* State,
* TokenizeContext,
* Tokenizer
* } from 'micromark-util-types'
*/
import {ok as assert} from 'devlop'
import {factorySpace} from 'micromark-factory-space'
import {asciiDigit, markdownSpace} from 'micromark-util-character'
import {codes, constants, types} from 'micromark-util-symbol'
import {blankLine} from './blank-line.js'
import {thematicBreak} from './thematic-break.js'
/** @type {Construct} */
export const list = {
continuation: {tokenize: tokenizeListContinuation},
exit: tokenizeListEnd,
name: 'list',
tokenize: tokenizeListStart
}
/** @type {Construct} */
const listItemPrefixWhitespaceConstruct = {
partial: true,
tokenize: tokenizeListItemPrefixWhitespace
}
/** @type {Construct} */
const indentConstruct = {partial: true, tokenize: tokenizeIndent}
// To do: `markdown-rs` parses list items on their own and later stitches them
// together.
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeListStart(effects, ok, nok) {
const self = this
const tail = self.events[self.events.length - 1]
let initialSize =
tail && tail[1].type === types.linePrefix
? tail[2].sliceSerialize(tail[1], true).length
: 0
let size = 0
return start
/** @type {State} */
function start(code) {
assert(self.containerState, 'expected state')
const kind =
self.containerState.type ||
(code === codes.asterisk || code === codes.plusSign || code === codes.dash
? types.listUnordered
: types.listOrdered)
if (
kind === types.listUnordered
? !self.containerState.marker || code === self.containerState.marker
: asciiDigit(code)
) {
if (!self.containerState.type) {
self.containerState.type = kind
effects.enter(kind, {_container: true})
}
if (kind === types.listUnordered) {
effects.enter(types.listItemPrefix)
return code === codes.asterisk || code === codes.dash
? effects.check(thematicBreak, nok, atMarker)(code)
: atMarker(code)
}
if (!self.interrupt || code === codes.digit1) {
effects.enter(types.listItemPrefix)
effects.enter(types.listItemValue)
return inside(code)
}
}
return nok(code)
}
/** @type {State} */
function inside(code) {
assert(self.containerState, 'expected state')
if (asciiDigit(code) && ++size < constants.listItemValueSizeMax) {
effects.consume(code)
return inside
}
if (
(!self.interrupt || size < 2) &&
(self.containerState.marker
? code === self.containerState.marker
: code === codes.rightParenthesis || code === codes.dot)
) {
effects.exit(types.listItemValue)
return atMarker(code)
}
return nok(code)
}
/**
* @type {State}
**/
function atMarker(code) {
assert(self.containerState, 'expected state')
assert(code !== codes.eof, 'eof (`null`) is not a marker')
effects.enter(types.listItemMarker)
effects.consume(code)
effects.exit(types.listItemMarker)
self.containerState.marker = self.containerState.marker || code
return effects.check(
blankLine,
// Can’t be empty when interrupting.
self.interrupt ? nok : onBlank,
effects.attempt(
listItemPrefixWhitespaceConstruct,
endOfPrefix,
otherPrefix
)
)
}
/** @type {State} */
function onBlank(code) {
assert(self.containerState, 'expected state')
self.containerState.initialBlankLine = true
initialSize++
return endOfPrefix(code)
}
/** @type {State} */
function otherPrefix(code) {
if (markdownSpace(code)) {
effects.enter(types.listItemPrefixWhitespace)
effects.consume(code)
effects.exit(types.listItemPrefixWhitespace)
return endOfPrefix
}
return nok(code)
}
/** @type {State} */
function endOfPrefix(code) {
assert(self.containerState, 'expected state')
self.containerState.size =
initialSize +
self.sliceSerialize(effects.exit(types.listItemPrefix), true).length
return ok(code)
}
}
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeListContinuation(effects, ok, nok) {
const self = this
assert(self.containerState, 'expected state')
self.containerState._closeFlow = undefined
return effects.check(blankLine, onBlank, notBlank)
/** @type {State} */
function onBlank(code) {
assert(self.containerState, 'expected state')
assert(typeof self.containerState.size === 'number', 'expected size')
self.containerState.furtherBlankLines =
self.containerState.furtherBlankLines ||
self.containerState.initialBlankLine
// We have a blank line.
// Still, try to consume at most the items size.
return factorySpace(
effects,
ok,
types.listItemIndent,
self.containerState.size + 1
)(code)
}
/** @type {State} */
function notBlank(code) {
assert(self.containerState, 'expected state')
if (self.containerState.furtherBlankLines || !markdownSpace(code)) {
self.containerState.furtherBlankLines = undefined
self.containerState.initialBlankLine = undefined
return notInCurrentItem(code)
}
self.containerState.furtherBlankLines = undefined
self.containerState.initialBlankLine = undefined
return effects.attempt(indentConstruct, ok, notInCurrentItem)(code)
}
/** @type {State} */
function notInCurrentItem(code) {
assert(self.containerState, 'expected state')
// While we do continue, we signal that the flow should be closed.
self.containerState._closeFlow = true
// As we’re closing flow, we’re no longer interrupting.
self.interrupt = undefined
// Always populated by defaults.
assert(
self.parser.constructs.disable.null,
'expected `disable.null` to be populated'
)
return factorySpace(
effects,
effects.attempt(list, ok, nok),
types.linePrefix,
self.parser.constructs.disable.null.includes('codeIndented')
? undefined
: constants.tabSize
)(code)
}
}
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeIndent(effects, ok, nok) {
const self = this
assert(self.containerState, 'expected state')
assert(typeof self.containerState.size === 'number', 'expected size')
return factorySpace(
effects,
afterPrefix,
types.listItemIndent,
self.containerState.size + 1
)
/** @type {State} */
function afterPrefix(code) {
assert(self.containerState, 'expected state')
const tail = self.events[self.events.length - 1]
return tail &&
tail[1].type === types.listItemIndent &&
tail[2].sliceSerialize(tail[1], true).length === self.containerState.size
? ok(code)
: nok(code)
}
}
/**
* @this {TokenizeContext}
* Context.
* @type {Exiter}
*/
function tokenizeListEnd(effects) {
assert(this.containerState, 'expected state')
assert(typeof this.containerState.type === 'string', 'expected type')
effects.exit(this.containerState.type)
}
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
const self = this
// Always populated by defaults.
assert(
self.parser.constructs.disable.null,
'expected `disable.null` to be populated'
)
return factorySpace(
effects,
afterPrefix,
types.listItemPrefixWhitespace,
self.parser.constructs.disable.null.includes('codeIndented')
? undefined
: constants.tabSize + 1
)
/** @type {State} */
function afterPrefix(code) {
const tail = self.events[self.events.length - 1]
return !markdownSpace(code) &&
tail &&
tail[1].type === types.listItemPrefixWhitespace
? ok(code)
: nok(code)
}
}
@@ -0,0 +1,608 @@
/**
* @fileoverview A class to track messages reported by the linter for a file.
* @author Nicholas C. Zakas
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const assert = require("../shared/assert");
const { RuleFixer } = require("./rule-fixer");
const { interpolate } = require("./interpolate");
const ruleReplacements = require("../../conf/replacements.json");
//------------------------------------------------------------------------------
// Typedefs
//------------------------------------------------------------------------------
/** @typedef {import("../types").Linter.LintMessage} LintMessage */
/** @typedef {import("../types").Linter.LintSuggestion} SuggestionResult */
/** @typedef {import("@eslint/core").Language} Language */
/** @typedef {import("@eslint/core").SourceLocation} SourceLocation */
/**
* An error message description
* @typedef {Object} MessageDescriptor
* @property {ASTNode} [node] The reported node
* @property {Location} loc The location of the problem.
* @property {string} message The problem message.
* @property {Object} [data] Optional data to use to fill in placeholders in the
* message.
* @property {Function} [fix] The function to call that creates a fix command.
* @property {Array<{desc?: string, messageId?: string, fix: Function}>} suggest Suggestion descriptions and functions to create a the associated fixes.
*/
/**
* @typedef {Object} LintProblem
* @property {string} ruleId The rule ID that reported the problem.
* @property {string} message The problem message.
* @property {SourceLocation} loc The location of the problem.
*/
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const DEFAULT_ERROR_LOC = {
start: { line: 1, column: 0 },
end: { line: 1, column: 1 },
};
/**
* Updates a given location based on the language offsets. This allows us to
* change 0-based locations to 1-based locations. We always want ESLint
* reporting lines and columns starting from 1.
* @todo Potentially this should be moved into a shared utility file.
* @param {Object} location The location to update.
* @param {number} location.line The starting line number.
* @param {number} location.column The starting column number.
* @param {number} [location.endLine] The ending line number.
* @param {number} [location.endColumn] The ending column number.
* @param {Language} language The language to use to adjust the location information.
* @returns {Object} The updated location.
*/
function updateLocationInformation(
{ line, column, endLine, endColumn },
language,
) {
const columnOffset = language.columnStart === 1 ? 0 : 1;
const lineOffset = language.lineStart === 1 ? 0 : 1;
// calculate separately to account for undefined
const finalEndLine = endLine === void 0 ? endLine : endLine + lineOffset;
const finalEndColumn =
endColumn === void 0 ? endColumn : endColumn + columnOffset;
return {
line: line + lineOffset,
column: column + columnOffset,
endLine: finalEndLine,
endColumn: finalEndColumn,
};
}
/**
* creates a missing-rule message.
* @param {string} ruleId the ruleId to create
* @returns {string} created error message
* @private
*/
function createMissingRuleMessage(ruleId) {
return Object.hasOwn(ruleReplacements.rules, ruleId)
? `Rule '${ruleId}' was removed and replaced by: ${ruleReplacements.rules[ruleId].join(", ")}`
: `Definition for rule '${ruleId}' was not found.`;
}
/**
* creates a linting problem
* @param {LintProblem} options to create linting error
* @param {RuleSeverity} severity the error message to report
* @param {Language} language the language to use to adjust the location information.
* @returns {LintMessage} created problem, returns a missing-rule problem if only provided ruleId.
* @private
*/
function createLintingProblem(options, severity, language) {
const {
ruleId = null,
loc = DEFAULT_ERROR_LOC,
message = createMissingRuleMessage(options.ruleId),
} = options;
return {
ruleId,
message,
...updateLocationInformation(
{
line: loc.start.line,
column: loc.start.column,
endLine: loc.end.line,
endColumn: loc.end.column,
},
language,
),
severity,
nodeType: null,
};
}
/**
* Translates a multi-argument context.report() call into a single object argument call
* @param {...*} args A list of arguments passed to `context.report`
* @returns {MessageDescriptor} A normalized object containing report information
*/
function normalizeMultiArgReportCall(...args) {
// If there is one argument, it is considered to be a new-style call already.
if (args.length === 1) {
// Shallow clone the object to avoid surprises if reusing the descriptor
return Object.assign({}, args[0]);
}
// If the second argument is a string, the arguments are interpreted as [node, message, data, fix].
if (typeof args[1] === "string") {
return {
node: args[0],
message: args[1],
data: args[2],
fix: args[3],
};
}
// Otherwise, the arguments are interpreted as [node, loc, message, data, fix].
return {
node: args[0],
loc: args[1],
message: args[2],
data: args[3],
fix: args[4],
};
}
/**
* Asserts that either a loc or a node was provided, and the node is valid if it was provided.
* @param {MessageDescriptor} descriptor A descriptor to validate
* @returns {void}
* @throws AssertionError if neither a node nor a loc was provided, or if the node is not an object
*/
function assertValidNodeInfo(descriptor) {
if (descriptor.node) {
assert(typeof descriptor.node === "object", "Node must be an object");
} else {
assert(
descriptor.loc,
"Node must be provided when reporting error if location is not provided",
);
}
}
/**
* Normalizes a MessageDescriptor to always have a `loc` with `start` and `end` properties
* @param {MessageDescriptor} descriptor A descriptor for the report from a rule.
* @returns {{start: Location, end: (Location|null)}} An updated location that infers the `start` and `end` properties
* from the `node` of the original descriptor, or infers the `start` from the `loc` of the original descriptor.
*/
function normalizeReportLoc(descriptor) {
if (descriptor.loc.start) {
return descriptor.loc;
}
return { start: descriptor.loc, end: null };
}
/**
* Clones the given fix object.
* @param {Fix|null} fix The fix to clone.
* @returns {Fix|null} Deep cloned fix object or `null` if `null` or `undefined` was passed in.
*/
function cloneFix(fix) {
if (!fix) {
return null;
}
return {
range: [fix.range[0], fix.range[1]],
text: fix.text,
};
}
/**
* Check that a fix has a valid range.
* @param {Fix|null} fix The fix to validate.
* @returns {void}
*/
function assertValidFix(fix) {
if (fix) {
assert(
fix.range &&
typeof fix.range[0] === "number" &&
typeof fix.range[1] === "number",
`Fix has invalid range: ${JSON.stringify(fix, null, 2)}`,
);
}
}
/**
* Compares items in a fixes array by range.
* @param {Fix} a The first message.
* @param {Fix} b The second message.
* @returns {number} -1 if a comes before b, 1 if a comes after b, 0 if equal.
* @private
*/
function compareFixesByRange(a, b) {
return a.range[0] - b.range[0] || a.range[1] - b.range[1];
}
/**
* Merges the given fixes array into one.
* @param {Fix[]} fixes The fixes to merge.
* @param {SourceCode} sourceCode The source code object to get the text between fixes.
* @returns {{text: string, range: number[]}} The merged fixes
*/
function mergeFixes(fixes, sourceCode) {
for (const fix of fixes) {
assertValidFix(fix);
}
if (fixes.length === 0) {
return null;
}
if (fixes.length === 1) {
return cloneFix(fixes[0]);
}
fixes.sort(compareFixesByRange);
const originalText = sourceCode.text;
const start = fixes[0].range[0];
const end = fixes.at(-1).range[1];
let text = "";
let lastPos = Number.MIN_SAFE_INTEGER;
for (const fix of fixes) {
assert(
fix.range[0] >= lastPos,
"Fix objects must not be overlapped in a report.",
);
if (fix.range[0] >= 0) {
text += originalText.slice(
Math.max(0, start, lastPos),
fix.range[0],
);
}
text += fix.text;
lastPos = fix.range[1];
}
text += originalText.slice(Math.max(0, start, lastPos), end);
return { range: [start, end], text };
}
/**
* Gets one fix object from the given descriptor.
* If the descriptor retrieves multiple fixes, this merges those to one.
* @param {MessageDescriptor} descriptor The report descriptor.
* @param {SourceCode} sourceCode The source code object to get text between fixes.
* @returns {({text: string, range: number[]}|null)} The fix for the descriptor
*/
function normalizeFixes(descriptor, sourceCode) {
if (typeof descriptor.fix !== "function") {
return null;
}
const ruleFixer = new RuleFixer({ sourceCode });
// @type {null | Fix | Fix[] | IterableIterator<Fix>}
const fix = descriptor.fix(ruleFixer);
// Merge to one.
if (fix && Symbol.iterator in fix) {
return mergeFixes(Array.from(fix), sourceCode);
}
assertValidFix(fix);
return cloneFix(fix);
}
/**
* Gets an array of suggestion objects from the given descriptor.
* @param {MessageDescriptor} descriptor The report descriptor.
* @param {SourceCode} sourceCode The source code object to get text between fixes.
* @param {Object} messages Object of meta messages for the rule.
* @returns {Array<SuggestionResult>} The suggestions for the descriptor
*/
function mapSuggestions(descriptor, sourceCode, messages) {
if (!descriptor.suggest || !Array.isArray(descriptor.suggest)) {
return [];
}
return (
descriptor.suggest
.map(suggestInfo => {
const computedDesc =
suggestInfo.desc || messages[suggestInfo.messageId];
return {
...suggestInfo,
desc: interpolate(computedDesc, suggestInfo.data),
fix: normalizeFixes(suggestInfo, sourceCode),
};
})
// Remove suggestions that didn't provide a fix
.filter(({ fix }) => fix)
);
}
/**
* Creates information about the report from a descriptor
* @param {Object} options Information about the problem
* @param {string} options.ruleId Rule ID
* @param {(0|1|2)} options.severity Rule severity
* @param {(ASTNode|null)} options.node Node
* @param {string} options.message Error message
* @param {string} [options.messageId] The error message ID.
* @param {{start: SourceLocation, end: (SourceLocation|null)}} options.loc Start and end location
* @param {{text: string, range: (number[]|null)}} options.fix The fix object
* @param {Array<{text: string, range: (number[]|null)}>} options.suggestions The array of suggestions objects
* @param {Language} [options.language] The language to use to adjust line and column offsets.
* @returns {LintMessage} Information about the report
*/
function createProblem(options) {
const { language } = options;
// calculate offsets based on the language in use
const columnOffset = language.columnStart === 1 ? 0 : 1;
const lineOffset = language.lineStart === 1 ? 0 : 1;
const problem = {
ruleId: options.ruleId,
severity: options.severity,
message: options.message,
line: options.loc.start.line + lineOffset,
column: options.loc.start.column + columnOffset,
nodeType: (options.node && options.node.type) || null,
};
/*
* If this isn’t in the conditional, some of the tests fail
* because `messageId` is present in the problem object
*/
if (options.messageId) {
problem.messageId = options.messageId;
}
if (options.loc.end) {
problem.endLine = options.loc.end.line + lineOffset;
problem.endColumn = options.loc.end.column + columnOffset;
}
if (options.fix) {
problem.fix = options.fix;
}
if (options.suggestions && options.suggestions.length > 0) {
problem.suggestions = options.suggestions;
}
return problem;
}
/**
* Validates that suggestions are properly defined. Throws if an error is detected.
* @param {Array<{ desc?: string, messageId?: string }>} suggest The incoming suggest data.
* @param {Object} messages Object of meta messages for the rule.
* @returns {void}
*/
function validateSuggestions(suggest, messages) {
if (suggest && Array.isArray(suggest)) {
suggest.forEach(suggestion => {
if (suggestion.messageId) {
const { messageId } = suggestion;
if (!messages) {
throw new TypeError(
`context.report() called with a suggest option with a messageId '${messageId}', but no messages were present in the rule metadata.`,
);
}
if (!messages[messageId]) {
throw new TypeError(
`context.report() called with a suggest option with a messageId '${messageId}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`,
);
}
if (suggestion.desc) {
throw new TypeError(
"context.report() called with a suggest option that defines both a 'messageId' and an 'desc'. Please only pass one.",
);
}
} else if (!suggestion.desc) {
throw new TypeError(
"context.report() called with a suggest option that doesn't have either a `desc` or `messageId`",
);
}
if (typeof suggestion.fix !== "function") {
throw new TypeError(
`context.report() called with a suggest option without a fix function. See: ${JSON.stringify(suggestion, null, 2)}`,
);
}
});
}
}
/**
* Computes the message from a report descriptor.
* @param {MessageDescriptor} descriptor The report descriptor.
* @param {Object} messages Object of meta messages for the rule.
* @returns {string} The computed message.
* @throws {TypeError} If messageId is not found or both message and messageId are provided.
*/
function computeMessageFromDescriptor(descriptor, messages) {
if (descriptor.messageId) {
if (!messages) {
throw new TypeError(
"context.report() called with a messageId, but no messages were present in the rule metadata.",
);
}
const id = descriptor.messageId;
if (descriptor.message) {
throw new TypeError(
"context.report() called with a message and a messageId. Please only pass one.",
);
}
if (!messages || !Object.hasOwn(messages, id)) {
throw new TypeError(
`context.report() called with a messageId of '${id}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`,
);
}
return messages[id];
}
if (descriptor.message) {
return descriptor.message;
}
throw new TypeError(
"Missing `message` property in report() call; add a message that describes the linting problem.",
);
}
/**
* A report object that contains the messages reported the linter
* for a file.
*/
class FileReport {
/**
* The messages reported by the linter for this file.
* @type {LintMessage[]}
*/
messages = [];
/**
* A rule mapper that maps rule IDs to their metadata.
* @type {(string) => RuleDefinition}
*/
#ruleMapper;
/**
* The source code object for the file.
* @type {SourceCode}
*/
#sourceCode;
/**
* The language to use to adjust line and column offsets.
* @type {Language}
*/
#language;
/**
* Whether to disable fixes for this report.
* @type {boolean}
*/
#disableFixes;
/**
* Creates a new FileReport instance.
* @param {Object} options The options for the file report
* @param {(string) => RuleDefinition} options.ruleMapper A rule mapper that maps rule IDs to their metadata.
* @param {SourceCode} options.sourceCode The source code object for the file.
* @param {Language} options.language The language to use to adjust line and column offsets.
* @param {boolean} [options.disableFixes=false] Whether to disable fixes for this report.
*/
constructor({ ruleMapper, sourceCode, language, disableFixes = false }) {
this.#ruleMapper = ruleMapper;
this.#sourceCode = sourceCode;
this.#language = language;
this.#disableFixes = disableFixes;
}
/**
* Adds a rule-generated message to the report.
* @param {string} ruleId The rule ID that reported the problem.
* @param {0|1|2} severity The severity of the problem (0 = off, 1 = warning, 2 = error).
* @param {...*} args The arguments passed to `context.report()`.
* @returns {LintMessage} The created message object.
* @throws {TypeError} If the messageId is not found or both message and messageId are provided.
* @throws {AssertionError} If the node is not an object or neither a node nor a loc is provided.
*/
addRuleMessage(ruleId, severity, ...args) {
const descriptor = normalizeMultiArgReportCall(...args);
const ruleDefinition = this.#ruleMapper(ruleId);
const messages = ruleDefinition?.meta?.messages;
assertValidNodeInfo(descriptor);
const computedMessage = computeMessageFromDescriptor(
descriptor,
messages,
);
validateSuggestions(descriptor.suggest, messages);
this.messages.push(
createProblem({
ruleId,
severity,
node: descriptor.node,
message: interpolate(computedMessage, descriptor.data),
messageId: descriptor.messageId,
loc: descriptor.loc
? normalizeReportLoc(descriptor)
: this.#sourceCode.getLoc(descriptor.node),
fix: this.#disableFixes
? null
: normalizeFixes(descriptor, this.#sourceCode),
suggestions: this.#disableFixes
? []
: mapSuggestions(descriptor, this.#sourceCode, messages),
language: this.#language,
}),
);
return this.messages.at(-1);
}
/**
* Adds an error message to the report. Meant to be called outside of rules.
* @param {LintProblem} descriptor The descriptor for the error message.
* @returns {LintMessage} The created message object.
*/
addError(descriptor) {
const message = createLintingProblem(descriptor, 2, this.#language);
this.messages.push(message);
return message;
}
/**
* Adds a fatal error message to the report. Meant to be called outside of rules.
* @param {LintProblem} descriptor The descriptor for the fatal error message.
* @returns {LintMessage} The created message object.
*/
addFatal(descriptor) {
const message = createLintingProblem(descriptor, 2, this.#language);
message.fatal = true;
this.messages.push(message);
return message;
}
/**
* Adds a warning message to the report. Meant to be called outside of rules.
* @param {LintProblem} descriptor The descriptor for the warning message.
* @returns {LintMessage} The created message object.
*/
addWarning(descriptor) {
const message = createLintingProblem(descriptor, 1, this.#language);
this.messages.push(message);
return message;
}
}
module.exports = {
FileReport,
updateLocationInformation,
};
@@ -0,0 +1,88 @@
// Setting / Unsetting timeouts for every keystroke was a significant overhead
// Inspired from https://github.com/iostreamer-X/timeout-latch
export class TimeoutLatch {
constructor(callback, timeoutMS) {
this.timeLeftMS = void 0;
this.timeoutMS = void 0;
this.isCancelled = false;
this.isTimeExhausted = false;
this.callbacks = [];
this.timeLeftMS = timeoutMS;
this.timeoutMS = timeoutMS;
this.callbacks.push(callback);
}
tick() {
if (!this.isCancelled && !this.isTimeExhausted) {
this.timeLeftMS--;
if (this.timeLeftMS <= 0) {
this.isTimeExhausted = true;
var callbacks = this.callbacks.slice();
this.callbacks.length = 0;
callbacks.forEach(callback => {
try {
callback();
} catch (error) {
console.error('TimeoutLatch callback error:', error);
}
});
}
}
}
cancel() {
this.isCancelled = true;
this.callbacks.length = 0;
}
reset() {
this.timeLeftMS = this.timeoutMS;
this.isCancelled = false;
this.isTimeExhausted = false;
}
get isDone() {
return this.isCancelled || this.isTimeExhausted;
}
}
class Scheduler {
constructor() {
this.interval = null;
this.latches = new Set();
}
add(latch) {
this.latches.add(latch);
this.start();
}
remove(latch) {
this.latches.delete(latch);
if (this.latches.size === 0) {
this.stop();
}
}
start() {
if (this.interval === null) {
this.interval = setInterval(() => {
this.latches.forEach(latch => {
latch.tick();
if (latch.isDone) {
this.remove(latch);
}
});
}, 1);
}
}
stop() {
if (this.interval !== null) {
clearInterval(this.interval);
this.interval = null;
}
}
}
var globalScheduler = null;
export var getScheduler = () => {
if (typeof window === 'undefined') {
return new Scheduler();
}
if (!globalScheduler) {
globalScheduler = new Scheduler();
}
return globalScheduler;
};
@@ -0,0 +1 @@
{"version":3,"file":"background.js","names":["ClassAttributor","Scope","ColorAttributor","BackgroundClass","scope","INLINE","BackgroundStyle"],"sources":["../../src/formats/background.ts"],"sourcesContent":["import { ClassAttributor, Scope } from 'parchment';\nimport { ColorAttributor } from './color.js';\n\nconst BackgroundClass = new ClassAttributor('background', 'ql-bg', {\n scope: Scope.INLINE,\n});\nconst BackgroundStyle = new ColorAttributor('background', 'background-color', {\n scope: Scope.INLINE,\n});\n\nexport { BackgroundClass, BackgroundStyle };\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,KAAK,QAAQ,WAAW;AAClD,SAASC,eAAe,QAAQ,YAAY;AAE5C,MAAMC,eAAe,GAAG,IAAIH,eAAe,CAAC,YAAY,EAAE,OAAO,EAAE;EACjEI,KAAK,EAAEH,KAAK,CAACI;AACf,CAAC,CAAC;AACF,MAAMC,eAAe,GAAG,IAAIJ,eAAe,CAAC,YAAY,EAAE,kBAAkB,EAAE;EAC5EE,KAAK,EAAEH,KAAK,CAACI;AACf,CAAC,CAAC;AAEF,SAASF,eAAe,EAAEG,eAAe","ignoreList":[]}
@@ -0,0 +1,24 @@
/**
* 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: {
...require("./no-new-in-es2023-intl-api").rules,
...require("./no-new-in-es2022-intl-api").rules,
...require("./no-new-in-es2021-intl-api").rules,
...require("./no-new-in-es2020-intl-api").rules,
...require("./no-new-in-es2019-intl-api").rules,
...require("./no-new-in-es2018-intl-api").rules,
...require("./no-new-in-es2017-intl-api").rules,
...require("./no-new-in-es2016-intl-api").rules,
...require("./no-new-in-es2015-intl-api").rules,
},
}
@@ -0,0 +1 @@
{"mappings":";;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/checkbox/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {CheckboxAria} from './useCheckbox';\nexport {useCheckbox} from './useCheckbox';\nexport {useCheckboxGroup} from './useCheckboxGroup';\nexport {useCheckboxGroupItem} from './useCheckboxGroupItem';\nexport type {AriaCheckboxGroupItemProps, AriaCheckboxGroupProps, AriaCheckboxProps} from '@react-types/checkbox';\nexport type {CheckboxGroupAria} from './useCheckboxGroup';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1 @@
{"version":3,"file":"ContainerModuleManager.spec.d.ts","sourceRoot":"","sources":["../../../../src/container/services/ContainerModuleManager.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,145 @@
'use strict'
const util = require('util')
const chownr = util.promisify(require('chownr'))
const mkdirp = require('mkdirp')
const inflight = require('promise-inflight')
const inferOwner = require('infer-owner')
// Memoize getuid()/getgid() calls.
// patch process.setuid/setgid to invalidate cached value on change
const self = { uid: null, gid: null }
const getSelf = () => {
if (typeof self.uid !== 'number') {
self.uid = process.getuid()
const setuid = process.setuid
process.setuid = (uid) => {
self.uid = null
process.setuid = setuid
return process.setuid(uid)
}
}
if (typeof self.gid !== 'number') {
self.gid = process.getgid()
const setgid = process.setgid
process.setgid = (gid) => {
self.gid = null
process.setgid = setgid
return process.setgid(gid)
}
}
}
module.exports.chownr = fixOwner
async function fixOwner (cache, filepath) {
if (!process.getuid) {
// This platform doesn't need ownership fixing
return
}
getSelf()
if (self.uid !== 0) {
// almost certainly can't chown anyway
return
}
const { uid, gid } = await inferOwner(cache)
// No need to override if it's already what we used.
if (self.uid === uid && self.gid === gid) {
return
}
return inflight('fixOwner: fixing ownership on ' + filepath, () =>
chownr(
filepath,
typeof uid === 'number' ? uid : self.uid,
typeof gid === 'number' ? gid : self.gid
).catch((err) => {
if (err.code === 'ENOENT') {
return null
}
throw err
})
)
}
module.exports.chownr.sync = fixOwnerSync
function fixOwnerSync (cache, filepath) {
if (!process.getuid) {
// This platform doesn't need ownership fixing
return
}
const { uid, gid } = inferOwner.sync(cache)
getSelf()
if (self.uid !== 0) {
// almost certainly can't chown anyway
return
}
if (self.uid === uid && self.gid === gid) {
// No need to override if it's already what we used.
return
}
try {
chownr.sync(
filepath,
typeof uid === 'number' ? uid : self.uid,
typeof gid === 'number' ? gid : self.gid
)
} catch (err) {
// only catch ENOENT, any other error is a problem.
if (err.code === 'ENOENT') {
return null
}
throw err
}
}
module.exports.mkdirfix = mkdirfix
async function mkdirfix (cache, p, cb) {
// we have to infer the owner _before_ making the directory, even though
// we aren't going to use the results, since the cache itself might not
// exist yet. If we mkdirp it, then our current uid/gid will be assumed
// to be correct if it creates the cache folder in the process.
await inferOwner(cache)
try {
const made = await mkdirp(p)
if (made) {
await fixOwner(cache, made)
return made
}
} catch (err) {
if (err.code === 'EEXIST') {
await fixOwner(cache, p)
return null
}
throw err
}
}
module.exports.mkdirfix.sync = mkdirfixSync
function mkdirfixSync (cache, p) {
try {
inferOwner.sync(cache)
const made = mkdirp.sync(p)
if (made) {
fixOwnerSync(cache, made)
return made
}
} catch (err) {
if (err.code === 'EEXIST') {
fixOwnerSync(cache, p)
return null
} else {
throw err
}
}
}
@@ -0,0 +1 @@
{"version":3,"file":"recommended.js","sourceRoot":"","sources":["../../src/config/recommended.ts"],"names":[],"mappings":"AAGA,eAAe;IACb,OAAO,EAAE,CAAC,UAAU,CAAC;IAErB,KAAK,EAAE;QAEL,wBAAwB,EAAE,OAAO;QACjC,gBAAgB,EAAE,OAAO;QACzB,oBAAoB,EAAE,OAAO;QAC7B,kBAAkB,EAAE,OAAO;QAC3B,iBAAiB,EAAE,OAAO;QAG1B,8BAA8B,EAAE,MAAM;QACtC,qCAAqC,EAAE,MAAM;QAC7C,wBAAwB,EAAE,MAAM;KACjC;IAID,aAAa,EAAE;QACb,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,IAAI;KAClB;CACqB,CAAA"}
@@ -0,0 +1 @@
{"name":"quill-delta","version":"5.1.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532111993,"integrity":"sha512-L8fj/jE3vZtYEnDPy+5sWi/Mmxiu7Rg+29+fLCoF7ow3cPLIlH1ZcMhxq41iGMh0qZNl9qhiE6xedWvs+VF9Nw==","mode":420,"size":1483},"dist/AttributeMap.js":{"checkedAt":1794532111993,"integrity":"sha512-8lD0JbNPtsjNeJVak3KdepYKG5zW4TuI+0fn9ArVPidzOCQwlh7IpHpfShvH3I3CqMbK94PEUaBNYEfVlTpYdQ==","mode":420,"size":2884},"dist/Delta.js":{"checkedAt":1794532111994,"integrity":"sha512-UsUJpVPjPIzUuQM19Si6ONTTmkB6CL6LkLdwxrwBYMB4vfJvDpg4ZF8WXALLhkgh8QGDlG1UaHVL72nOuI5njg==","mode":420,"size":18876},"dist/Op.js":{"checkedAt":1794532111994,"integrity":"sha512-kZEiF/u/GBZaq83qK1iZisRKv2nTcOc+NEKsKWhbJ9GaLCbcNuM2p8pTPJp/VHochaU8o+5Eau43kDBChPYryQ==","mode":420,"size":608},"dist/OpIterator.js":{"checkedAt":1794532111994,"integrity":"sha512-J24FTgl89kn9rPhTSlE0wZGLn8C2nndNI8UQvXiLffpZCzoDqKSffOECawuQ9Q3cZnE0qXtxFGKhAso6hIZEEA==","mode":420,"size":3189},"package.json":{"checkedAt":1794532111994,"integrity":"sha512-BKwNEj6mE77q6m9XNUrU+dTMB9/amLphQPRjpKxq/mfiAevopg0iGYUcY/YUy2W5jonPFqNxQf/D5WgH30urxw==","mode":420,"size":1887},"tsconfig.json":{"checkedAt":1794532111994,"integrity":"sha512-MISaLc0kWueZhmpqWkw1e+UvorQE/g/D/OsiBrJ0rQExiEn+Hs97IeJJhA83Qc0auyH9vj2SD5PsJM3yShmgRQ==","mode":420,"size":322},"dist/AttributeMap.js.map":{"checkedAt":1794532111994,"integrity":"sha512-1sj1EMukD9qyC9LrRmoD6BBWvEL7AhwvKqJMWWywxjhtZOApfXd18qkP9AFFX1n2yBrgTBuiuUcrjbIWDGCyoQ==","mode":420,"size":3185},"dist/Delta.js.map":{"checkedAt":1794532111995,"integrity":"sha512-vgxjpHBrA2uUq+hKSsL9NjTAK5vALSFuCSHj4Pe55dFVH4+wAsHJw+SJRtwtJiMpkEbhJVTT3uIvzsYHk1046Q==","mode":420,"size":17362},"dist/Op.js.map":{"checkedAt":1794532111995,"integrity":"sha512-ATyVoDmsghY1j2xJEDLE8jTwPPz3sTzvOBXNUoA+X3vLdeYUBc0bgZpwTXopwUcQ+sdMsEhUGaMQWWk+TuXv0w==","mode":420,"size":627},"dist/OpIterator.js.map":{"checkedAt":1794532111995,"integrity":"sha512-CaA5tUdEzUvSBLAMZC247qa9Q9pUkL5066K5Ua8UkPXZ7N9P293JBSIgRj9TklmkSkYBHAgHwXMvjB6CJ4pKFw==","mode":420,"size":2807},"README.md":{"checkedAt":1794532111995,"integrity":"sha512-v+4Eoyp9UzpaPXYTFV4ZYcy2giUpWVlw4pqJ15sv8cQjxhZd/SUmnuVZFekdCyMMfqeysxnCTAZnmkKnouf9hw==","mode":420,"size":15950},"dist/AttributeMap.d.ts":{"checkedAt":1794532111995,"integrity":"sha512-qPzGUrQkeKhm5JrYJt9zj/IAN4W4cr98jgiwRyL41cwa1kuJpFVk1sctoXwuDKDZY+W9D93xjfCAJv1IssGecQ==","mode":420,"size":509},"src/AttributeMap.ts":{"checkedAt":1794532111995,"integrity":"sha512-ziCqvMi9tnNNWKUPulw4+djMUCLAqIzWN7wsP+nhV/Pt0kyUKLGLnjyQ/kcVCA0oTSxFOfyPHWpGF310uB2AWQ==","mode":420,"size":2658},"dist/Delta.d.ts":{"checkedAt":1794532111995,"integrity":"sha512-YnjljacJ7PgZDJTFdyOM/e5b9yRLfx6blJjFMM/gYMoUi8ZOTkpL2TK9H+6NzhY6lGwKv3cZYv7gR4E9hJbdpA==","mode":420,"size":1925},"src/Delta.ts":{"checkedAt":1794532111996,"integrity":"sha512-fBQJtOVjyvOg3gc3d1LiWDIdzTiTT/WjOGQHo/VoQQC4hwxMrdWe/kVWMEd4bFVMYRRLDzSLei7sdWKRmyomEg==","mode":420,"size":17271},"dist/Op.d.ts":{"checkedAt":1794532111996,"integrity":"sha512-zkUXip1p4nDZYYmXRB3fywrrBWV6qyXHH9R5mxHK87BYDTkUPsmeCqoyXrj9zqOtPhal4TlEV9K09AST3PaRJA==","mode":420,"size":287},"src/Op.ts":{"checkedAt":1794532111996,"integrity":"sha512-NZeMRx3reg50uogYe81RHEUfD8c3D1knG78QancqWjpQcMikPkrbbH9+NGdYoKS4nGPoH+TiMiyn7P+B0y7B5w==","mode":420,"size":665},"dist/OpIterator.d.ts":{"checkedAt":1794532111996,"integrity":"sha512-1TFwS3tLEf3sL+7J9zx1QAaLuQRTPMbXgg8dX4Q0yya8JoiQI42Mhz2HjnZA2pJRGgU125SBtzPcoUvkAg2iCQ==","mode":420,"size":278},"src/OpIterator.ts":{"checkedAt":1794532111996,"integrity":"sha512-C98+JvOFDSBJ6dgAu/61xryXbep7UJ/O1lthayiwqklz0zodIU1jtdpqFfkMnPpF/Q4K5ArdDdi6kuO2qjWRAA==","mode":420,"size":2560}}}
@@ -0,0 +1,8 @@
import { Newable } from '@inversifyjs/common';
import { BindingScope } from './BindingScope';
import { bindingTypeValues } from './BindingType';
import { ScopedBinding } from './ScopedBinding';
export interface InstanceBinding<TActivated> extends ScopedBinding<typeof bindingTypeValues.Instance, BindingScope, TActivated> {
readonly implementationType: Newable<TActivated>;
}
//# sourceMappingURL=InstanceBinding.d.ts.map
@@ -0,0 +1,117 @@
/**
* Ref https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
*/
import { UINT16_LE, UINT32_LE } from "token-types";
export const Signature = {
LocalFileHeader: 0x04034b50,
DataDescriptor: 0x08074b50,
CentralFileHeader: 0x02014b50,
EndOfCentralDirectory: 0x06054b50
};
export const DataDescriptor = {
get(array) {
return {
signature: UINT32_LE.get(array, 0),
compressedSize: UINT32_LE.get(array, 8),
uncompressedSize: UINT32_LE.get(array, 12),
};
}, len: 16
};
/**
* First part of the ZIP Local File Header
* Offset | Bytes| Description
* -------|------+-------------------------------------------------------------------
* 0 | 4 | Signature (0x04034b50)
* 4 | 2 | Minimum version needed to extract
* 6 | 2 | Bit flag
* 8 | 2 | Compression method
* 10 | 2 | File last modification time (MS-DOS format)
* 12 | 2 | File last modification date (MS-DOS format)
* 14 | 4 | CRC-32 of uncompressed data
* 18 | 4 | Compressed size
* 22 | 4 | Uncompressed size
* 26 | 2 | File name length (n)
* 28 | 2 | Extra field length (m)
* 30 | n | File name
* 30 + n | m | Extra field
*/
export const LocalFileHeaderToken = {
get(array) {
const flags = UINT16_LE.get(array, 6);
return {
signature: UINT32_LE.get(array, 0),
minVersion: UINT16_LE.get(array, 4),
dataDescriptor: !!(flags & 0x0008),
compressedMethod: UINT16_LE.get(array, 8),
compressedSize: UINT32_LE.get(array, 18),
uncompressedSize: UINT32_LE.get(array, 22),
filenameLength: UINT16_LE.get(array, 26),
extraFieldLength: UINT16_LE.get(array, 28),
filename: null
};
}, len: 30
};
/**
* 4.3.16 End of central directory record:
* end of central dir signature (0x06064b50) 4 bytes
* number of this disk 2 bytes
* number of the disk with the start of the central directory 2 bytes
* total number of entries in the central directory on this disk 2 bytes
* total number of entries in the size of the central directory 2 bytes
* sizeOfTheCentralDirectory 4 bytes
* offset of start of central directory with respect to the starting disk number 4 bytes
* .ZIP file comment length 2 bytes
* .ZIP file comment (variable size)
*/
export const EndOfCentralDirectoryRecordToken = {
get(array) {
return {
signature: UINT32_LE.get(array, 0),
nrOfThisDisk: UINT16_LE.get(array, 4),
nrOfThisDiskWithTheStart: UINT16_LE.get(array, 6),
nrOfEntriesOnThisDisk: UINT16_LE.get(array, 8),
nrOfEntriesOfSize: UINT16_LE.get(array, 10),
sizeOfCd: UINT32_LE.get(array, 12),
offsetOfStartOfCd: UINT32_LE.get(array, 16),
zipFileCommentLength: UINT16_LE.get(array, 20),
};
}, len: 22
};
/**
* File header:
* central file header signature 4 bytes 0 (0x02014b50)
* version made by 2 bytes 4
* version needed to extract 2 bytes 6
* general purpose bit flag 2 bytes 8
* compression method 2 bytes 10
* last mod file time 2 bytes 12
* last mod file date 2 bytes 14
* crc-32 4 bytes 16
* compressed size 4 bytes 20
* uncompressed size 4 bytes 24
* file name length 2 bytes 28
* extra field length 2 bytes 30
* file comment length 2 bytes 32
* disk number start 2 bytes 34
* internal file attributes 2 bytes 36
* external file attributes 4 bytes 38
* relative offset of local header 4 bytes 42
*/
export const FileHeader = {
get(array) {
const flags = UINT16_LE.get(array, 8);
return {
signature: UINT32_LE.get(array, 0),
minVersion: UINT16_LE.get(array, 6),
dataDescriptor: !!(flags & 0x0008),
compressedMethod: UINT16_LE.get(array, 10),
compressedSize: UINT32_LE.get(array, 20),
uncompressedSize: UINT32_LE.get(array, 24),
filenameLength: UINT16_LE.get(array, 28),
extraFieldLength: UINT16_LE.get(array, 30),
fileCommentLength: UINT16_LE.get(array, 32),
relativeOffsetOfLocalHeader: UINT32_LE.get(array, 42),
filename: null
};
}, len: 46
};
@@ -0,0 +1,602 @@
"use client";
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
FreeSoloPopover: () => free_solo_popover_default,
Popover: () => popover_default,
PopoverContent: () => popover_content_default,
PopoverProvider: () => PopoverProvider,
PopoverTrigger: () => popover_trigger_default,
usePopover: () => usePopover,
usePopoverContext: () => usePopoverContext
});
module.exports = __toCommonJS(src_exports);
// src/popover.tsx
var import_react4 = require("react");
var import_system2 = require("@heroui/system");
var import_overlays4 = require("@react-aria/overlays");
var import_framer_motion = require("framer-motion");
// src/use-popover.ts
var import_react2 = require("react");
var import_react_utils = require("@heroui/react-utils");
var import_overlays2 = require("@react-stately/overlays");
var import_focus = require("@react-aria/focus");
var import_overlays3 = require("@react-aria/overlays");
var import_aria_utils2 = require("@heroui/aria-utils");
var import_system = require("@heroui/system");
var import_aria_utils3 = require("@heroui/aria-utils");
var import_theme = require("@heroui/theme");
var import_utils2 = require("@react-aria/utils");
var import_shared_utils = require("@heroui/shared-utils");
var import_react3 = require("react");
// src/use-aria-popover.ts
var import_react = require("react");
var import_overlays = require("@react-aria/overlays");
var import_aria_utils = require("@heroui/aria-utils");
var import_utils = require("@react-aria/utils");
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
function useReactAriaPopover(props, state) {
const {
triggerRef,
popoverRef,
showArrow,
offset = 7,
crossOffset = 0,
scrollRef,
shouldFlip,
boundaryElement,
isDismissable = true,
shouldCloseOnBlur = true,
shouldCloseOnScroll = true,
placement: placementProp = "top",
containerPadding,
shouldCloseOnInteractOutside,
isNonModal: isNonModalProp,
isKeyboardDismissDisabled,
updatePositionDeps = [],
...otherProps
} = props;
const isNonModal = isNonModalProp != null ? isNonModalProp : true;
const { overlayProps, underlayProps } = (0, import_overlays.useOverlay)(
{
isOpen: state.isOpen,
onClose: state.close,
shouldCloseOnBlur,
isDismissable,
isKeyboardDismissDisabled,
shouldCloseOnInteractOutside: shouldCloseOnInteractOutside ? shouldCloseOnInteractOutside : (element) => (0, import_aria_utils.ariaShouldCloseOnInteractOutside)(element, triggerRef, state)
},
popoverRef
);
const {
overlayProps: positionProps,
arrowProps,
placement,
updatePosition
} = (0, import_overlays.useOverlayPosition)({
...otherProps,
shouldFlip,
crossOffset,
targetRef: triggerRef,
overlayRef: popoverRef,
isOpen: state.isOpen,
scrollRef,
boundaryElement,
containerPadding,
placement: (0, import_aria_utils.toReactAriaPlacement)(placementProp),
offset: showArrow ? offset + 3 : offset,
onClose: isNonModal && shouldCloseOnScroll ? state.close : () => {
}
});
(0, import_use_safe_layout_effect.useSafeLayoutEffect)(() => {
if (!updatePositionDeps.length)
return;
updatePosition();
}, updatePositionDeps);
(0, import_react.useEffect)(() => {
if (state.isOpen && !isNonModal && popoverRef.current) {
return (0, import_aria_utils.ariaHideOutside)([popoverRef.current]);
}
}, [isNonModal, state.isOpen, popoverRef]);
return {
popoverProps: (0, import_utils.mergeProps)(overlayProps, positionProps),
arrowProps,
underlayProps,
placement
};
}
// src/use-popover.ts
var DEFAULT_PLACEMENT = "top";
function usePopover(originalProps) {
var _a, _b, _c;
const globalContext = (0, import_system.useProviderContext)();
const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.popover.variantKeys);
const {
as,
ref,
children,
state: stateProp,
triggerRef: triggerRefProp,
scrollRef,
defaultOpen,
onOpenChange,
isOpen: isOpenProp,
isNonModal = true,
shouldFlip = true,
containerPadding = 12,
shouldBlockScroll = false,
isDismissable = true,
shouldCloseOnBlur,
portalContainer,
updatePositionDeps,
dialogProps: dialogPropsProp,
placement: placementProp = DEFAULT_PLACEMENT,
triggerType = "dialog",
showArrow = false,
offset = 7,
crossOffset = 0,
boundaryElement,
isKeyboardDismissDisabled,
shouldCloseOnInteractOutside,
shouldCloseOnScroll,
motionProps,
className,
classNames,
onClose,
...otherProps
} = props;
const Component = as || "div";
const domRef = (0, import_react_utils.useDOMRef)(ref);
const domTriggerRef = (0, import_react3.useRef)(null);
const wasTriggerPressedRef = (0, import_react3.useRef)(false);
const triggerRef = triggerRefProp || domTriggerRef;
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
const innerState = (0, import_overlays2.useOverlayTriggerState)({
isOpen: isOpenProp,
defaultOpen,
onOpenChange: (isOpen) => {
onOpenChange == null ? void 0 : onOpenChange(isOpen);
if (!isOpen) {
onClose == null ? void 0 : onClose();
}
}
});
const state = stateProp || innerState;
const {
popoverProps,
underlayProps,
placement: ariaPlacement
} = useReactAriaPopover(
{
triggerRef,
isNonModal,
popoverRef: domRef,
placement: placementProp,
offset,
scrollRef,
isDismissable,
shouldCloseOnBlur,
boundaryElement,
crossOffset,
shouldFlip,
containerPadding,
updatePositionDeps,
isKeyboardDismissDisabled,
shouldCloseOnScroll,
shouldCloseOnInteractOutside
},
state
);
const placement = (0, import_react3.useMemo)(() => {
if (!ariaPlacement) {
return null;
}
return (0, import_aria_utils2.getShouldUseAxisPlacement)(ariaPlacement, placementProp) ? ariaPlacement : placementProp;
}, [ariaPlacement, placementProp]);
const { triggerProps } = (0, import_overlays3.useOverlayTrigger)({ type: triggerType }, state, triggerRef);
const { isFocusVisible, isFocused, focusProps } = (0, import_focus.useFocusRing)();
const slots = (0, import_react3.useMemo)(
() => (0, import_theme.popover)({
...variantProps
}),
[(0, import_shared_utils.objectToDeps)(variantProps)]
);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
(0, import_overlays3.usePreventScroll)({
isDisabled: !(shouldBlockScroll && state.isOpen)
});
const getPopoverProps = (props2 = {}) => ({
ref: domRef,
...(0, import_utils2.mergeProps)(popoverProps, otherProps, props2),
style: (0, import_utils2.mergeProps)(popoverProps.style, otherProps.style, props2.style)
});
const getDialogProps = (props2 = {}) => ({
"data-slot": "base",
"data-open": (0, import_shared_utils.dataAttr)(state.isOpen),
"data-focus": (0, import_shared_utils.dataAttr)(isFocused),
"data-arrow": (0, import_shared_utils.dataAttr)(showArrow),
"data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
"data-placement": ariaPlacement ? (0, import_aria_utils3.getArrowPlacement)(ariaPlacement, placementProp) : void 0,
...(0, import_utils2.mergeProps)(focusProps, dialogPropsProp, props2),
className: slots.base({ class: (0, import_shared_utils.clsx)(baseStyles) }),
style: {
outline: "none"
}
});
const getContentProps = (0, import_react3.useCallback)(
(props2 = {}) => ({
"data-slot": "content",
"data-open": (0, import_shared_utils.dataAttr)(state.isOpen),
"data-arrow": (0, import_shared_utils.dataAttr)(showArrow),
"data-placement": ariaPlacement ? (0, import_aria_utils3.getArrowPlacement)(ariaPlacement, placementProp) : void 0,
className: slots.content({ class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.content, props2.className) })
}),
[slots, state.isOpen, showArrow, placement, placementProp, classNames, ariaPlacement]
);
const onPress = (0, import_react3.useCallback)(
(e) => {
var _a2;
let pressTimer;
if (e.pointerType === "touch" && ((originalProps == null ? void 0 : originalProps.backdrop) === "blur" || (originalProps == null ? void 0 : originalProps.backdrop) === "opaque")) {
pressTimer = setTimeout(() => {
wasTriggerPressedRef.current = true;
}, 100);
} else {
wasTriggerPressedRef.current = true;
}
(_a2 = triggerProps.onPress) == null ? void 0 : _a2.call(triggerProps, e);
return () => {
clearTimeout(pressTimer);
};
},
[triggerProps == null ? void 0 : triggerProps.onPress]
);
const getTriggerProps = (0, import_react3.useCallback)(
(props2 = {}, _ref = null) => {
const { isDisabled, ...otherProps2 } = props2;
return {
"data-slot": "trigger",
...(0, import_utils2.mergeProps)({ "aria-haspopup": "dialog" }, triggerProps, otherProps2),
onPress,
isDisabled,
className: slots.trigger({
class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.trigger, props2.className),
isTriggerDisabled: isDisabled
}),
ref: (0, import_utils2.mergeRefs)(_ref, triggerRef)
};
},
[state, triggerProps, onPress, triggerRef]
);
const getBackdropProps = (0, import_react3.useCallback)(
(props2 = {}) => ({
"data-slot": "backdrop",
className: slots.backdrop({ class: classNames == null ? void 0 : classNames.backdrop }),
onClick: (e) => {
if (!wasTriggerPressedRef.current) {
e.preventDefault();
return;
}
state.close();
wasTriggerPressedRef.current = false;
},
...underlayProps,
...props2
}),
[slots, state.isOpen, classNames, underlayProps]
);
(0, import_react2.useEffect)(() => {
if (state.isOpen && (domRef == null ? void 0 : domRef.current)) {
return (0, import_overlays3.ariaHideOutside)([domRef == null ? void 0 : domRef.current]);
}
}, [state.isOpen, domRef]);
return {
state,
Component,
children,
classNames,
showArrow,
triggerRef,
placement,
isNonModal,
popoverRef: domRef,
portalContainer,
isOpen: state.isOpen,
onClose: state.close,
disableAnimation,
shouldBlockScroll,
backdrop: (_c = originalProps.backdrop) != null ? _c : "transparent",
motionProps,
getBackdropProps,
getPopoverProps,
getTriggerProps,
getDialogProps,
getContentProps
};
}
// src/popover-context.ts
var import_react_utils2 = require("@heroui/react-utils");
var [PopoverProvider, usePopoverContext] = (0, import_react_utils2.createContext)({
name: "PopoverContext",
errorMessage: "usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Popover />`"
});
// src/popover.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var Popover = (0, import_system2.forwardRef)((props, ref) => {
const { children, ...otherProps } = props;
const context = usePopover({ ...otherProps, ref });
const [trigger, content] = import_react4.Children.toArray(children);
const overlay = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_overlays4.Overlay, { portalContainer: context.portalContainer, children: content });
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopoverProvider, { value: context, children: [
trigger,
context.disableAnimation && context.isOpen ? overlay : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { children: context.isOpen ? overlay : null })
] });
});
Popover.displayName = "HeroUI.Popover";
var popover_default = Popover;
// src/popover-trigger.tsx
var import_react5 = require("react");
var import_react_utils3 = require("@heroui/react-utils");
var import_use_aria_button = require("@heroui/use-aria-button");
var import_button = require("@heroui/button");
var import_utils3 = require("@react-aria/utils");
var import_jsx_runtime2 = require("react/jsx-runtime");
var PopoverTrigger = (props) => {
var _a;
const { triggerRef, getTriggerProps } = usePopoverContext();
const { children, ...otherProps } = props;
const child = (0, import_react5.useMemo)(() => {
if (typeof children === "string")
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children });
return import_react5.Children.only(children);
}, [children]);
const childRef = (_a = child.props.ref) != null ? _a : child.ref;
const { onPress, isDisabled, ...restProps } = (0, import_react5.useMemo)(() => {
return getTriggerProps((0, import_utils3.mergeProps)(otherProps, child.props), childRef);
}, [getTriggerProps, child.props, otherProps, childRef]);
const [, triggerChildren] = (0, import_react_utils3.pickChildren)(children, import_button.Button);
const { buttonProps } = (0, import_use_aria_button.useAriaButton)({ onPress, isDisabled }, triggerRef);
const hasHeroUIButton = (0, import_react5.useMemo)(() => {
return (triggerChildren == null ? void 0 : triggerChildren[0]) !== void 0;
}, [triggerChildren]);
return (0, import_react5.cloneElement)(
child,
(0, import_utils3.mergeProps)(restProps, hasHeroUIButton ? { onPress, isDisabled } : buttonProps)
);
};
PopoverTrigger.displayName = "HeroUI.PopoverTrigger";
var popover_trigger_default = PopoverTrigger;
// src/popover-content.tsx
var import_react6 = require("react");
var import_overlays5 = require("@react-aria/overlays");
var import_framer_utils = require("@heroui/framer-utils");
var import_framer_motion2 = require("framer-motion");
var import_aria_utils4 = require("@heroui/aria-utils");
var import_dialog = require("@react-aria/dialog");
var import_jsx_runtime3 = require("react/jsx-runtime");
var domAnimation = () => import("@heroui/dom-animation").then((res) => res.default);
var PopoverContent = (props) => {
const { as, children, className, ...otherProps } = props;
const {
Component: OverlayComponent,
placement,
backdrop,
motionProps,
disableAnimation,
getPopoverProps,
getDialogProps,
getBackdropProps,
getContentProps,
isNonModal,
onClose
} = usePopoverContext();
const dialogRef = (0, import_react6.useRef)(null);
const { dialogProps: ariaDialogProps, titleProps } = (0, import_dialog.useDialog)({}, dialogRef);
const dialogProps = getDialogProps({
ref: dialogRef,
...ariaDialogProps,
...otherProps
});
const Component = as || OverlayComponent || "div";
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
!isNonModal && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_overlays5.DismissButton, { onDismiss: onClose }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ...dialogProps, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...getContentProps({ className }), children: typeof children === "function" ? children(titleProps) : children }) }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_overlays5.DismissButton, { onDismiss: onClose })
] });
const backdropContent = (0, import_react6.useMemo)(() => {
if (backdrop === "transparent") {
return null;
}
if (disableAnimation) {
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...getBackdropProps() });
}
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_framer_motion2.LazyMotion, { features: domAnimation, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
import_framer_motion2.m.div,
{
animate: "enter",
exit: "exit",
initial: "exit",
variants: import_framer_utils.TRANSITION_VARIANTS.fade,
...getBackdropProps()
}
) });
}, [backdrop, disableAnimation, getBackdropProps]);
const style = placement ? (0, import_aria_utils4.getTransformOrigins)(placement === "center" ? "top" : placement) : void 0;
const contents = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: disableAnimation ? content : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_framer_motion2.LazyMotion, { features: domAnimation, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
import_framer_motion2.m.div,
{
animate: "enter",
exit: "exit",
initial: "initial",
style,
variants: import_framer_utils.TRANSITION_VARIANTS.scaleSpringOpacity,
...motionProps,
children: content
}
) }) });
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ...getPopoverProps(), children: [
backdropContent,
contents
] });
};
PopoverContent.displayName = "HeroUI.PopoverContent";
var popover_content_default = PopoverContent;
// src/free-solo-popover.tsx
var React2 = __toESM(require("react"));
var import_overlays6 = require("@react-aria/overlays");
var import_system3 = require("@heroui/system");
var import_framer_motion3 = require("framer-motion");
var import_utils4 = require("@react-aria/utils");
var import_aria_utils5 = require("@heroui/aria-utils");
var import_framer_utils2 = require("@heroui/framer-utils");
var import_dialog2 = require("@react-aria/dialog");
var import_jsx_runtime4 = require("react/jsx-runtime");
var domAnimation2 = () => import("@heroui/dom-animation").then((res) => res.default);
var FreeSoloPopoverWrapper = (0, import_system3.forwardRef)(
({
children,
motionProps,
placement,
disableAnimation,
style: styleProp = {},
transformOrigin = {},
...otherProps
}, ref) => {
let style = styleProp;
if (transformOrigin.originX !== void 0 || transformOrigin.originY !== void 0) {
style = {
...style,
transformOrigin
};
} else if (placement) {
style = {
...style,
...(0, import_aria_utils5.getTransformOrigins)(placement === "center" ? "top" : placement)
};
}
return disableAnimation ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...otherProps, ref, children }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_framer_motion3.LazyMotion, { features: domAnimation2, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
import_framer_motion3.m.div,
{
ref,
animate: "enter",
exit: "exit",
initial: "initial",
style,
variants: import_framer_utils2.TRANSITION_VARIANTS.scaleSpringOpacity,
...(0, import_utils4.mergeProps)(otherProps, motionProps),
children
}
) });
}
);
FreeSoloPopoverWrapper.displayName = "HeroUI.FreeSoloPopoverWrapper";
var FreeSoloPopover = (0, import_system3.forwardRef)(
({ children, transformOrigin, disableDialogFocus = false, ...props }, ref) => {
const {
Component,
state,
placement,
backdrop,
portalContainer,
disableAnimation,
motionProps,
isNonModal,
getPopoverProps,
getBackdropProps,
getDialogProps,
getContentProps
} = usePopover({
...props,
ref
});
const dialogRef = React2.useRef(null);
const { dialogProps: ariaDialogProps, titleProps } = (0, import_dialog2.useDialog)({}, dialogRef);
const dialogProps = getDialogProps({
...!disableDialogFocus && { ref: dialogRef },
...ariaDialogProps
});
const backdropContent = React2.useMemo(() => {
if (backdrop === "transparent") {
return null;
}
if (disableAnimation) {
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...getBackdropProps() });
}
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_framer_motion3.LazyMotion, { features: domAnimation2, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
import_framer_motion3.m.div,
{
animate: "enter",
exit: "exit",
initial: "exit",
variants: import_framer_utils2.TRANSITION_VARIANTS.fade,
...getBackdropProps()
}
) });
}, [backdrop, disableAnimation, getBackdropProps]);
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_overlays6.Overlay, { portalContainer, children: [
!isNonModal && backdropContent,
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
FreeSoloPopoverWrapper,
{
disableAnimation,
motionProps,
placement,
tabIndex: -1,
transformOrigin,
...dialogProps,
children: [
!isNonModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_overlays6.DismissButton, { onDismiss: state.close }),
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...getContentProps(), children: typeof children === "function" ? children(titleProps) : children }),
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_overlays6.DismissButton, { onDismiss: state.close })
]
}
) })
] });
}
);
FreeSoloPopover.displayName = "HeroUI.FreeSoloPopover";
var free_solo_popover_default = FreeSoloPopover;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
FreeSoloPopover,
Popover,
PopoverContent,
PopoverProvider,
PopoverTrigger,
usePopover,
usePopoverContext
});
@@ -0,0 +1 @@
{"version":3,"file":"image-reference.d.ts","sourceRoot":"","sources":["image-reference.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,qCANW,cAAc,KACd,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CA2ClB;;;;oCArDyC,OAAO;6BAAP,OAAO;2BADnB,wBAAwB;0BAAxB,wBAAwB;AAwDtD;;GAEG;AACH,uCAFa,MAAM,CAIlB"}
@@ -0,0 +1,566 @@
// Compute what scrolling needs to be done on required scrolling boxes for target to be in view
// The type names here are named after the spec to make it easier to find more information around what they mean:
// To reduce churn and reduce things that need be maintained things from the official TS DOM library is used here
// https://drafts.csswg.org/cssom-view/
// For a definition on what is "block flow direction" exactly, check this: https://drafts.csswg.org/css-writing-modes-4/#block-flow-direction
/**
* This new option is tracked in this PR, which is the most likely candidate at the time: https://github.com/w3c/csswg-drafts/pull/1805
* @public
*/
export type ScrollMode = 'always' | 'if-needed'
/** @public */
export interface Options {
/**
* Control the logical scroll position on the y-axis. The spec states that the `block` direction is related to the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode), but this is not implemented yet in this library.
* This means that `block: 'start'` aligns to the top edge and `block: 'end'` to the bottom.
* @defaultValue 'center'
*/
block?: ScrollLogicalPosition
/**
* Like `block` this is affected by the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode). In left-to-right pages `inline: 'start'` will align to the left edge. In right-to-left it should be flipped. This will be supported in a future release.
* @defaultValue 'nearest'
*/
inline?: ScrollLogicalPosition
/**
* This is a proposed addition to the spec that you can track here: https://github.com/w3c/csswg-drafts/pull/5677
*
* This library will be updated to reflect any changes to the spec and will provide a migration path.
* To be backwards compatible with `Element.scrollIntoViewIfNeeded` if something is not 100% visible it will count as "needs scrolling". If you need a different visibility ratio your best option would be to implement an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).
* @defaultValue 'always'
*/
scrollMode?: ScrollMode
/**
* By default there is no boundary. All the parent elements of your target is checked until it reaches the viewport ([`document.scrollingElement`](https://developer.mozilla.org/en-US/docs/Web/API/document/scrollingElement)) when calculating layout and what to scroll.
* By passing a boundary you can short-circuit this loop depending on your needs:
*
* - Prevent the browser window from scrolling.
* - Scroll elements into view in a list, without scrolling container elements.
*
* You can also pass a function to do more dynamic checks to override the scroll scoping:
*
* ```js
* let actions = compute(target, {
* boundary: (parent) => {
* // By default `overflow: hidden` elements are allowed, only `overflow: visible | clip` is skipped as
* // this is required by the CSSOM spec
* if (getComputedStyle(parent)['overflow'] === 'hidden') {
* return false
* }
* return true
* },
* })
* ```
* @defaultValue null
*/
boundary?: Element | ((parent: Element) => boolean) | null
/**
* New option that skips auto-scrolling all nodes with overflow: hidden set
* See FF implementation: https://hg.mozilla.org/integration/fx-team/rev/c48c3ec05012#l7.18
* @defaultValue false
* @public
*/
skipOverflowHiddenElements?: boolean
}
/** @public */
export interface ScrollAction {
el: Element
top: number
left: number
}
// @TODO better shadowdom test, 11 = document fragment
const isElement = (el: any): el is Element =>
typeof el === 'object' && el != null && el.nodeType === 1
const canOverflow = (
overflow: string | null,
skipOverflowHiddenElements?: boolean
) => {
if (skipOverflowHiddenElements && overflow === 'hidden') {
return false
}
return overflow !== 'visible' && overflow !== 'clip'
}
const getFrameElement = (el: Element) => {
if (!el.ownerDocument || !el.ownerDocument.defaultView) {
return null
}
try {
return el.ownerDocument.defaultView.frameElement
} catch (e) {
return null
}
}
const isHiddenByFrame = (el: Element): boolean => {
const frame = getFrameElement(el)
if (!frame) {
return false
}
return (
frame.clientHeight < el.scrollHeight || frame.clientWidth < el.scrollWidth
)
}
const isScrollable = (el: Element, skipOverflowHiddenElements?: boolean) => {
if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {
const style = getComputedStyle(el, null)
return (
canOverflow(style.overflowY, skipOverflowHiddenElements) ||
canOverflow(style.overflowX, skipOverflowHiddenElements) ||
isHiddenByFrame(el)
)
}
return false
}
/**
* Find out which edge to align against when logical scroll position is "nearest"
* Interesting fact: "nearest" works similarily to "if-needed", if the element is fully visible it will not scroll it
*
* Legends:
* ┌────────┐ ┏ ━ ━ ━ ┓
* │ target │ frame
* └────────┘ ┗ ━ ━ ━ ┛
*/
const alignNearest = (
scrollingEdgeStart: number,
scrollingEdgeEnd: number,
scrollingSize: number,
scrollingBorderStart: number,
scrollingBorderEnd: number,
elementEdgeStart: number,
elementEdgeEnd: number,
elementSize: number
) => {
/**
* If element edge A and element edge B are both outside scrolling box edge A and scrolling box edge B
*
* ┌──┐
* ┏━│━━│━┓
* │ │
* ┃ │ │ ┃ do nothing
* │ │
* ┗━│━━│━┛
* └──┘
*
* If element edge C and element edge D are both outside scrolling box edge C and scrolling box edge D
*
* ┏ ━ ━ ━ ━ ┓
* ┌───────────┐
* │┃ ┃│ do nothing
* └───────────┘
* ┗ ━ ━ ━ ━ ┛
*/
if (
(elementEdgeStart < scrollingEdgeStart &&
elementEdgeEnd > scrollingEdgeEnd) ||
(elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd)
) {
return 0
}
/**
* If element edge A is outside scrolling box edge A and element height is less than scrolling box height
*
* ┌──┐
* ┏━│━━│━┓ ┏━┌━━┐━┓
* └──┘ │ │
* from ┃ ┃ to ┃ └──┘ ┃
*
* ┗━ ━━ ━┛ ┗━ ━━ ━┛
*
* If element edge B is outside scrolling box edge B and element height is greater than scrolling box height
*
* ┏━ ━━ ━┓ ┏━┌━━┐━┓
* │ │
* from ┃ ┌──┐ ┃ to ┃ │ │ ┃
* │ │ │ │
* ┗━│━━│━┛ ┗━│━━│━┛
* │ │ └──┘
* │ │
* └──┘
*
* If element edge C is outside scrolling box edge C and element width is less than scrolling box width
*
* from to
* ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓
* ┌───┐ ┌───┐
* │ ┃ │ ┃ ┃ │ ┃
* └───┘ └───┘
* ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛
*
* If element edge D is outside scrolling box edge D and element width is greater than scrolling box width
*
* from to
* ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓
* ┌───────────┐ ┌───────────┐
* ┃ │ ┃ │ ┃ ┃ │
* └───────────┘ └───────────┘
* ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛
*/
if (
(elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize) ||
(elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize)
) {
return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart
}
/**
* If element edge B is outside scrolling box edge B and element height is less than scrolling box height
*
* ┏━ ━━ ━┓ ┏━ ━━ ━┓
*
* from ┃ ┃ to ┃ ┌──┐ ┃
* ┌──┐ │ │
* ┗━│━━│━┛ ┗━└━━┘━┛
* └──┘
*
* If element edge A is outside scrolling box edge A and element height is greater than scrolling box height
*
* ┌──┐
* │ │
* │ │ ┌──┐
* ┏━│━━│━┓ ┏━│━━│━┓
* │ │ │ │
* from ┃ └──┘ ┃ to ┃ │ │ ┃
* │ │
* ┗━ ━━ ━┛ ┗━└━━┘━┛
*
* If element edge C is outside scrolling box edge C and element width is greater than scrolling box width
*
* from to
* ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓
* ┌───────────┐ ┌───────────┐
* │ ┃ │ ┃ │ ┃ ┃
* └───────────┘ └───────────┘
* ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛
*
* If element edge D is outside scrolling box edge D and element width is less than scrolling box width
*
* from to
* ┏ ━ ━ ━ ━ ┓ ┏ ━ ━ ━ ━ ┓
* ┌───┐ ┌───┐
* ┃ │ ┃ │ ┃ │ ┃
* └───┘ └───┘
* ┗ ━ ━ ━ ━ ┛ ┗ ━ ━ ━ ━ ┛
*
*/
if (
(elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize) ||
(elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize)
) {
return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd
}
return 0
}
const getParentElement = (element: Node): Element | null => {
const parent = element.parentElement
if (parent == null) {
return (element.getRootNode() as ShadowRoot).host || null
}
return parent
}
const getScrollMargins = (target: Element) => {
const computedStyle = window.getComputedStyle(target)
return {
top: parseFloat(computedStyle.scrollMarginTop) || 0,
right: parseFloat(computedStyle.scrollMarginRight) || 0,
bottom: parseFloat(computedStyle.scrollMarginBottom) || 0,
left: parseFloat(computedStyle.scrollMarginLeft) || 0,
}
}
/** @public */
export const compute = (target: Element, options: Options): ScrollAction[] => {
if (typeof document === 'undefined') {
// If there's no DOM we assume it's not in a browser environment
return []
}
const { scrollMode, block, inline, boundary, skipOverflowHiddenElements } =
options
// Allow using a callback to check the boundary
// The default behavior is to check if the current target matches the boundary element or not
// If undefined it'll check that target is never undefined (can happen as we recurse up the tree)
const checkBoundary =
typeof boundary === 'function' ? boundary : (node: any) => node !== boundary
if (!isElement(target)) {
throw new TypeError('Invalid target')
}
// Used to handle the top most element that can be scrolled
const scrollingElement = document.scrollingElement || document.documentElement
// Collect all the scrolling boxes, as defined in the spec: https://drafts.csswg.org/cssom-view/#scrolling-box
const frames: Element[] = []
let cursor: Element | null = target
while (isElement(cursor) && checkBoundary(cursor)) {
// Move cursor to parent
cursor = getParentElement(cursor)
// Stop when we reach the viewport
if (cursor === scrollingElement) {
frames.push(cursor)
break
}
// Skip document.body if it's not the scrollingElement and documentElement isn't independently scrollable
if (
cursor != null &&
cursor === document.body &&
isScrollable(cursor) &&
!isScrollable(document.documentElement)
) {
continue
}
// Now we check if the element is scrollable, this code only runs if the loop haven't already hit the viewport or a custom boundary
if (cursor != null && isScrollable(cursor, skipOverflowHiddenElements)) {
frames.push(cursor)
}
}
// Support pinch-zooming properly, making sure elements scroll into the visual viewport
// Browsers that don't support visualViewport will report the layout viewport dimensions on document.documentElement.clientWidth/Height
// and viewport dimensions on window.innerWidth/Height
// https://www.quirksmode.org/mobile/viewports2.html
// https://bokand.github.io/viewport/index.html
const viewportWidth = window.visualViewport?.width ?? innerWidth
const viewportHeight = window.visualViewport?.height ?? innerHeight
const { scrollX, scrollY } = window
const {
height: targetHeight,
width: targetWidth,
top: targetTop,
right: targetRight,
bottom: targetBottom,
left: targetLeft,
} = target.getBoundingClientRect()
const {
top: marginTop,
right: marginRight,
bottom: marginBottom,
left: marginLeft,
} = getScrollMargins(target)
// These values mutate as we loop through and generate scroll coordinates
let targetBlock: number =
block === 'start' || block === 'nearest'
? targetTop - marginTop
: block === 'end'
? targetBottom + marginBottom
: targetTop + targetHeight / 2 - marginTop + marginBottom // block === 'center
let targetInline: number =
inline === 'center'
? targetLeft + targetWidth / 2 - marginLeft + marginRight
: inline === 'end'
? targetRight + marginRight
: targetLeft - marginLeft // inline === 'start || inline === 'nearest
// Collect new scroll positions
const computations: ScrollAction[] = []
// In chrome there's no longer a difference between caching the `frames.length` to a var or not, so we don't in this case (size > speed anyways)
for (let index = 0; index < frames.length; index++) {
const frame = frames[index]
// @TODO add a shouldScroll hook here that allows userland code to take control
const { height, width, top, right, bottom, left } =
frame.getBoundingClientRect()
// If the element is already visible we can end it here
// @TODO targetBlock and targetInline should be taken into account to be compliant with https://github.com/w3c/csswg-drafts/pull/1805/files#diff-3c17f0e43c20f8ecf89419d49e7ef5e0R1333
if (
scrollMode === 'if-needed' &&
targetTop >= 0 &&
targetLeft >= 0 &&
targetBottom <= viewportHeight &&
targetRight <= viewportWidth &&
// scrollingElement is added to the frames array even if it's not scrollable, in which case checking its bounds is not required
((frame === scrollingElement && !isScrollable(frame)) ||
(targetTop >= top &&
targetBottom <= bottom &&
targetLeft >= left &&
targetRight <= right))
) {
// Break the loop and return the computations for things that are not fully visible
return computations
}
const frameStyle = getComputedStyle(frame)
const borderLeft = parseInt(frameStyle.borderLeftWidth as string, 10)
const borderTop = parseInt(frameStyle.borderTopWidth as string, 10)
const borderRight = parseInt(frameStyle.borderRightWidth as string, 10)
const borderBottom = parseInt(frameStyle.borderBottomWidth as string, 10)
let blockScroll: number = 0
let inlineScroll: number = 0
// The property existance checks for offfset[Width|Height] is because only HTMLElement objects have them, but any Element might pass by here
// @TODO find out if the "as HTMLElement" overrides can be dropped
const scrollbarWidth =
'offsetWidth' in frame
? (frame as HTMLElement).offsetWidth -
(frame as HTMLElement).clientWidth -
borderLeft -
borderRight
: 0
const scrollbarHeight =
'offsetHeight' in frame
? (frame as HTMLElement).offsetHeight -
(frame as HTMLElement).clientHeight -
borderTop -
borderBottom
: 0
const scaleX =
'offsetWidth' in frame
? (frame as HTMLElement).offsetWidth === 0
? 0
: width / (frame as HTMLElement).offsetWidth
: 0
const scaleY =
'offsetHeight' in frame
? (frame as HTMLElement).offsetHeight === 0
? 0
: height / (frame as HTMLElement).offsetHeight
: 0
if (scrollingElement === frame) {
// Handle viewport logic (document.documentElement or document.body)
if (block === 'start') {
blockScroll = targetBlock
} else if (block === 'end') {
blockScroll = targetBlock - viewportHeight
} else if (block === 'nearest') {
blockScroll = alignNearest(
scrollY,
scrollY + viewportHeight,
viewportHeight,
borderTop,
borderBottom,
scrollY + targetBlock,
scrollY + targetBlock + targetHeight,
targetHeight
)
} else {
// block === 'center' is the default
blockScroll = targetBlock - viewportHeight / 2
}
if (inline === 'start') {
inlineScroll = targetInline
} else if (inline === 'center') {
inlineScroll = targetInline - viewportWidth / 2
} else if (inline === 'end') {
inlineScroll = targetInline - viewportWidth
} else {
// inline === 'nearest' is the default
inlineScroll = alignNearest(
scrollX,
scrollX + viewportWidth,
viewportWidth,
borderLeft,
borderRight,
scrollX + targetInline,
scrollX + targetInline + targetWidth,
targetWidth
)
}
// Apply scroll position offsets and ensure they are within bounds
// @TODO add more test cases to cover this 100%
blockScroll = Math.max(0, blockScroll + scrollY)
inlineScroll = Math.max(0, inlineScroll + scrollX)
} else {
// Handle each scrolling frame that might exist between the target and the viewport
if (block === 'start') {
blockScroll = targetBlock - top - borderTop
} else if (block === 'end') {
blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight
} else if (block === 'nearest') {
blockScroll = alignNearest(
top,
bottom,
height,
borderTop,
borderBottom + scrollbarHeight,
targetBlock,
targetBlock + targetHeight,
targetHeight
)
} else {
// block === 'center' is the default
blockScroll = targetBlock - (top + height / 2) + scrollbarHeight / 2
}
if (inline === 'start') {
inlineScroll = targetInline - left - borderLeft
} else if (inline === 'center') {
inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2
} else if (inline === 'end') {
inlineScroll = targetInline - right + borderRight + scrollbarWidth
} else {
// inline === 'nearest' is the default
inlineScroll = alignNearest(
left,
right,
width,
borderLeft,
borderRight + scrollbarWidth,
targetInline,
targetInline + targetWidth,
targetWidth
)
}
const { scrollLeft, scrollTop } = frame
// Ensure scroll coordinates are not out of bounds while applying scroll offsets
blockScroll =
scaleY === 0
? 0
: Math.max(
0,
Math.min(
scrollTop + blockScroll / scaleY,
frame.scrollHeight - height / scaleY + scrollbarHeight
)
)
inlineScroll =
scaleX === 0
? 0
: Math.max(
0,
Math.min(
scrollLeft + inlineScroll / scaleX,
frame.scrollWidth - width / scaleX + scrollbarWidth
)
)
// Cache the offset so that parent frames can scroll this into view correctly
targetBlock += scrollTop - blockScroll
targetInline += scrollLeft - inlineScroll
}
computations.push({ el: frame, top: blockScroll, left: inlineScroll })
}
return computations
}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more