docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Type Check & Test (push) Waiting to run

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

No files matched your search

@@ -0,0 +1,21 @@
let urlAlphabet =
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
let customAlphabet = (alphabet, defaultSize = 21) => {
return (size = defaultSize) => {
let id = ''
let i = size | 0
while (i--) {
id += alphabet[(Math.random() * alphabet.length) | 0]
}
return id
}
}
let nanoid = (size = 21) => {
let id = ''
let i = size | 0
while (i--) {
id += urlAlphabet[(Math.random() * 64) | 0]
}
return id
}
export { nanoid, customAlphabet }
@@ -0,0 +1,18 @@
'use strict';
var define = require('define-properties');
var getPolyfill = require('./polyfill');
var $IteratorPrototype = require('../Iterator.prototype/implementation');
module.exports = function shimIteratorPrototypeDrop() {
var polyfill = getPolyfill();
define(
$IteratorPrototype,
{ drop: polyfill },
{ drop: function () { return $IteratorPrototype.drop !== polyfill; } }
);
return polyfill;
};
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=PlanParamsOperations.js.map
@@ -0,0 +1,76 @@
exports = module.exports = function(bytes)
{
var i = 0;
while(i < bytes.length)
{
if( (// ASCII
bytes[i] == 0x09 ||
bytes[i] == 0x0A ||
bytes[i] == 0x0D ||
(0x20 <= bytes[i] && bytes[i] <= 0x7E)
)
) {
i += 1;
continue;
}
if( (// non-overlong 2-byte
(0xC2 <= bytes[i] && bytes[i] <= 0xDF) &&
(0x80 <= bytes[i+1] && bytes[i+1] <= 0xBF)
)
) {
i += 2;
continue;
}
if( (// excluding overlongs
bytes[i] == 0xE0 &&
(0xA0 <= bytes[i + 1] && bytes[i + 1] <= 0xBF) &&
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF)
) ||
(// straight 3-byte
((0xE1 <= bytes[i] && bytes[i] <= 0xEC) ||
bytes[i] == 0xEE ||
bytes[i] == 0xEF) &&
(0x80 <= bytes[i + 1] && bytes[i+1] <= 0xBF) &&
(0x80 <= bytes[i+2] && bytes[i+2] <= 0xBF)
) ||
(// excluding surrogates
bytes[i] == 0xED &&
(0x80 <= bytes[i+1] && bytes[i+1] <= 0x9F) &&
(0x80 <= bytes[i+2] && bytes[i+2] <= 0xBF)
)
) {
i += 3;
continue;
}
if( (// planes 1-3
bytes[i] == 0xF0 &&
(0x90 <= bytes[i + 1] && bytes[i + 1] <= 0xBF) &&
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF) &&
(0x80 <= bytes[i + 3] && bytes[i + 3] <= 0xBF)
) ||
(// planes 4-15
(0xF1 <= bytes[i] && bytes[i] <= 0xF3) &&
(0x80 <= bytes[i + 1] && bytes[i + 1] <= 0xBF) &&
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF) &&
(0x80 <= bytes[i + 3] && bytes[i + 3] <= 0xBF)
) ||
(// plane 16
bytes[i] == 0xF4 &&
(0x80 <= bytes[i + 1] && bytes[i + 1] <= 0x8F) &&
(0x80 <= bytes[i + 2] && bytes[i + 2] <= 0xBF) &&
(0x80 <= bytes[i + 3] && bytes[i + 3] <= 0xBF)
)
) {
i += 4;
continue;
}
return false;
}
return true;
}
@@ -0,0 +1,2 @@
import type { SortingStrategy } from '../types';
export declare const rectSortingStrategy: SortingStrategy;
@@ -0,0 +1,16 @@
'use strict';
var hasOwn = require('hasown');
module.exports = function isPromiseCapabilityRecord(value) {
return !!value
&& typeof value === 'object'
&& hasOwn(value, '[[Resolve]]')
&& typeof value['[[Resolve]]'] === 'function'
&& hasOwn(value, '[[Reject]]')
&& typeof value['[[Reject]]'] === 'function'
&& hasOwn(value, '[[Promise]]')
&& !!value['[[Promise]]']
&& typeof value['[[Promise]]'] === 'object'
&& typeof value['[[Promise]]'].then === 'function';
};
@@ -0,0 +1 @@
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAqBD,MAAM,+BAAwB;IAC5B,QAAQ;IACR,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,SAAS;IACT,UAAU;IACV,OAAO;IACP,YAAY;AACd;AAUO,SAAS,0CAAkB,QAA6B,CAAC,CAAC;IAC/D,IAAI,SACF,KAAK,eACL,WAAW,EACZ,GAAG;IAEJ,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB,CAAC,MAAQ,WAAW;IAC3C;IAEA,sCAAsC;IACtC,IAAI,iBAAiB,CAAA,GAAA,cAAM,EAAE;QAC3B,IAAI,WACF,OAAO;aACF,IAAI,OACT,OAAO;YAAC,GAAG,4BAAM;YAAE,GAAG,KAAK;QAAA;aAE3B,OAAO;IAEX,uDAAuD;IACvD,GAAG;QAAC;KAAU;IAEd,OAAO;QACL,qBAAqB;YACnB,GAAG,gBAAgB;YACnB,OAAO;QACT;IACF;AACF;AAMO,SAAS,0CAAe,KAA0B;IACvD,6DAA6D;IAC7D,IAAI,YAAC,QAAQ,EAAE,aAAa,UAAU,KAAK,eAAE,WAAW,SAAE,KAAK,EAAE,GAAG,YAAW,GAAG;IAClF,IAAI,uBAAC,mBAAmB,EAAC,GAAG,0CAAkB;IAE9C,qBACE,gCAAC,SAAY,CAAA,GAAA,iBAAS,EAAE,YAAY,sBACjC;AAGP","sources":["packages/@react-aria/visually-hidden/src/VisuallyHidden.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {CSSProperties, JSX, JSXElementConstructor, ReactNode, useMemo, useState} from 'react';\nimport {useFocusWithin} from '@react-aria/interactions';\n\nexport interface VisuallyHiddenProps extends DOMAttributes {\n /** The content to visually hide. */\n children?: ReactNode,\n\n /**\n * The element type for the container.\n * @default 'div'\n */\n elementType?: string | JSXElementConstructor<any>,\n\n /** Whether the element should become visible on focus, for example skip links. */\n isFocusable?: boolean\n}\n\nconst styles: CSSProperties = {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n whiteSpace: 'nowrap'\n};\n\nexport interface VisuallyHiddenAria {\n visuallyHiddenProps: DOMAttributes\n}\n\n/**\n * Provides props for an element that hides its children visually\n * but keeps content visible to assistive technology.\n */\nexport function useVisuallyHidden(props: VisuallyHiddenProps = {}): VisuallyHiddenAria {\n let {\n style,\n isFocusable\n } = props;\n\n let [isFocused, setFocused] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !isFocusable,\n onFocusWithinChange: (val) => setFocused(val)\n });\n\n // If focused, don't hide the element.\n let combinedStyles = useMemo(() => {\n if (isFocused) {\n return style;\n } else if (style) {\n return {...styles, ...style};\n } else {\n return styles;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isFocused]);\n\n return {\n visuallyHiddenProps: {\n ...focusWithinProps,\n style: combinedStyles\n }\n };\n}\n\n/**\n * VisuallyHidden hides its children visually, while keeping content visible\n * to screen readers.\n */\nexport function VisuallyHidden(props: VisuallyHiddenProps): JSX.Element {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {children, elementType: Element = 'div', isFocusable, style, ...otherProps} = props;\n let {visuallyHiddenProps} = useVisuallyHidden(props);\n\n return (\n <Element {...mergeProps(otherProps, visuallyHiddenProps)}>\n {children}\n </Element>\n );\n}\n"],"names":[],"version":3,"file":"VisuallyHidden.module.js.map"}
@@ -0,0 +1,86 @@
import {useCheckbox as $406796ff087fe49b$export$e375f10ce42261c5} from "./useCheckbox.module.js";
import {checkboxGroupData as $1ae600c947479353$export$ec98120685d4f57d} from "./utils.module.js";
import {useFormValidationState as $6clEo$useFormValidationState, DEFAULT_VALIDATION_RESULT as $6clEo$DEFAULT_VALIDATION_RESULT, privateValidationStateProp as $6clEo$privateValidationStateProp} from "@react-stately/form";
import {useRef as $6clEo$useRef, useEffect as $6clEo$useEffect} from "react";
import {useToggleState as $6clEo$useToggleState} from "@react-stately/toggle";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
const toggleState = (0, $6clEo$useToggleState)({
isReadOnly: props.isReadOnly || state.isReadOnly,
isSelected: state.isSelected(props.value),
onChange (isSelected) {
if (isSelected) state.addValue(props.value);
else state.removeValue(props.value);
if (props.onChange) props.onChange(isSelected);
}
});
let { name: name, descriptionId: descriptionId, errorMessageId: errorMessageId, validationBehavior: validationBehavior } = (0, $1ae600c947479353$export$ec98120685d4f57d).get(state);
var _props_validationBehavior;
validationBehavior = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : validationBehavior;
// Local validation for this checkbox.
let { realtimeValidation: realtimeValidation } = (0, $6clEo$useFormValidationState)({
...props,
value: toggleState.isSelected,
// Server validation is handled at the group level.
name: undefined,
validationBehavior: 'aria'
});
// Update the checkbox group state when realtime validation changes.
let nativeValidation = (0, $6clEo$useRef)((0, $6clEo$DEFAULT_VALIDATION_RESULT));
let updateValidation = ()=>{
state.setInvalid(props.value, realtimeValidation.isInvalid ? realtimeValidation : nativeValidation.current);
};
(0, $6clEo$useEffect)(updateValidation);
// Combine group and checkbox level validation.
let combinedRealtimeValidation = state.realtimeValidation.isInvalid ? state.realtimeValidation : realtimeValidation;
let displayValidation = validationBehavior === 'native' ? state.displayValidation : combinedRealtimeValidation;
var _props_isRequired;
let res = (0, $406796ff087fe49b$export$e375f10ce42261c5)({
...props,
isReadOnly: props.isReadOnly || state.isReadOnly,
isDisabled: props.isDisabled || state.isDisabled,
name: props.name || name,
isRequired: (_props_isRequired = props.isRequired) !== null && _props_isRequired !== void 0 ? _props_isRequired : state.isRequired,
validationBehavior: validationBehavior,
[(0, $6clEo$privateValidationStateProp)]: {
realtimeValidation: combinedRealtimeValidation,
displayValidation: displayValidation,
resetValidation: state.resetValidation,
commitValidation: state.commitValidation,
updateValidation (v) {
nativeValidation.current = v;
updateValidation();
}
}
}, toggleState, inputRef);
return {
...res,
inputProps: {
...res.inputProps,
'aria-describedby': [
props['aria-describedby'],
state.isInvalid ? errorMessageId : null,
descriptionId
].filter(Boolean).join(' ') || undefined
}
};
}
export {$fba3e38d5ca8983f$export$353b32fc6898d37d as useCheckboxGroupItem};
//# sourceMappingURL=useCheckboxGroupItem.module.js.map
@@ -0,0 +1,4 @@
{
"main": "../../cjs/_class_static_private_method_get.cjs",
"module": "../../esm/_class_static_private_method_get.js"
}
@@ -0,0 +1,82 @@
export declare type CallbackFunction<T = string> = (error: Error | null, result?: T) => void;
export declare interface FigletDefaults {
font: FontName;
fontPath: string;
fetchFontIfMissing: boolean;
}
declare class FigletFont {
options: FontMetadata;
comment: string;
numChars: number;
[charCode: number]: string[];
constructor();
}
declare interface FigletModule {
loadFont: (font: FontName, callback?: CallbackFunction<FontMetadata>) => Promise<FontMetadata | null>;
loadFontSync: (font: FontName) => FontMetadata;
fonts: (callback?: CallbackFunction<FontName[]>) => Promise<FontName[]>;
fontsSync: () => FontName[];
parseFont: (font: FontName, data: string, override?: boolean) => FontMetadata;
preloadFonts: (fonts: FontName[], callback?: (error?: Error) => void) => Promise<void>;
loadedFonts: () => string[];
clearLoadedFonts: () => void;
textSync: (text: string, options?: FigletOptions) => string;
text: (text: string, optionsOrFontOrCallback?: FigletOptions | FontName | CallbackFunction<string>, callback?: CallbackFunction<string>) => Promise<string>;
(text: string, optionsOrFontOrCallback?: FigletOptions | FontName | CallbackFunction<string>, callback?: CallbackFunction<string>): Promise<string>;
figFonts: Record<string, FigletFont>;
defaults: (opts?: Partial<FigletDefaults>) => FigletDefaults;
metadata: (fontName: FontName, callback?: (error: Error | null, fontOptions?: FontMetadata, comment?: string) => void) => Promise<[FontMetadata, string] | null>;
}
export declare interface FigletOptions {
font?: FontName;
horizontalLayout?: KerningMethods;
verticalLayout?: KerningMethods;
width?: number;
whitespaceBreak?: boolean;
printDirection?: PrintDirection;
showHardBlanks?: boolean;
}
declare interface FittingRules {
hLayout: number;
hRule1: boolean;
hRule2: boolean;
hRule3: boolean;
hRule4: boolean;
hRule5: boolean;
hRule6: boolean;
vLayout: number;
vRule1: boolean;
vRule2: boolean;
vRule3: boolean;
vRule4: boolean;
vRule5: boolean;
}
export declare interface FontMetadata {
baseline?: number;
codeTagCount?: number | null;
fittingRules: FittingRules;
fullLayout?: number | null;
hardBlank?: string;
height?: number;
maxLength?: number;
numCommentLines?: number;
oldLayout?: number;
printDirection?: PrintDirection;
}
export declare type FontName = "1Row" | "3-D" | "3D Diagonal" | "3D-ASCII" | "3x5" | "4Max" | "5 Line Oblique" | "Standard" | "Ghost" | "Big" | "Block" | "Bubble" | "Digital" | "Ivrit" | "Mini" | "Script" | "Shadow" | "Slant" | "Small" | "Speed" | "Tinker-Toy" | string;
declare type KerningMethods = "default" | "full" | "fitted" | "controlled smushing" | "universal smushing";
declare const nodeFiglet: FigletModule;
export default nodeFiglet;
declare type PrintDirection = -1 | 0 | 1;
export { }
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=buildDefaultManagedMetadata.spec.d.ts.map
@@ -0,0 +1,935 @@
flf2a$ 9 8 13 16 16
Epic by Claude Martins 12/94
Figlet release 2.1 -- 12 Aug 1994
Permission is hereby given to modify this font, as long as the
modifier's name is placed on a comment line.
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be `a', for now
$ - the "hardblank" -- prints as a blank, but can't be smushed
9 - height of a character
8 - height of a character, not including descenders
13 - max line length (excluding comment lines) + a fudge factor
16 - default smushmode for this font
16 - number of comment lines
$$@
$$@
$$@
$$@
$$@
$$@
$$@
$$@
$$@@
_ @
( )@
| |@
| |@
| |@
(_)@
_ @
(_)@
@@
_ _ @
( )( )@
\||/ @
@
@
@
@
@
@@
_ _ @
( ) ( ) @
_| |_| |_ @
(_ _ _)@
_| (_) |_ @
(_ _ _)@
| | | | @
(_) (_) @
@@
_ @
__|_|___@
( _____/@
| (|_|__ @
(_____ )@
/\_|_|) |@
\_______)@
|_| @
@@
@
/\@
() / /@
/ / @
/ / @
/ / @
/ / ()@
\/ @
@@
__ @
/__\ @
( \/ ) @
\ / @
/ \/\@
/ /\ /@
( \/ \@
\___/\/@
@@
_ @
( )@
|/ @
@
@
@
@
@
@@
_ @
/ )@
/ / @
( ( @
| | @
( ( @
\ \ @
\_)@
@@
_ @
( \ @
\ \ @
) )@
| |@
) )@
/ / @
(_/ @
@@
@
/\ /\ @
\ \ / / @
_) () (_ @
(_ _)@
) () ( @
/ / \ \ @
\/ \/ @
@@
_ @
( ) @
| | @
__| |__ @
(__ __)@
| | @
| | @
(_) @
@@
@
@
@
@
@
@
_ @
( )@
|/ @@
@
@
@
_____ @
(_____)@
@
@
@
@@
@
@
@
@
@
@
_ @
(_)@
@@
@
/\@
/ /@
/ / @
/ / @
/ / @
/ / @
\/ @
@@
_______ @
( __ )@
| ( ) |@
| | / |@
| (/ /) |@
| / | |@
| (__) |@
(_______)@
@@
__ @
/ \ @
\/) ) @
| | @
| | @
| | @
__) (_@
\____/@
@@
_______ @
/ ___ )@
\/ ) |@
/ )@
_/ / @
/ _/ @
( (__/\@
\_______/@
@@
______ @
/ ___ \ @
\/ \ \@
___) /@
(___ ( @
) \@
/\___/ /@
\______/ @
@@
___ @
/ ) @
/ /) | @
/ (_) (_ @
(____ _)@
) ( @
| | @
(_) @
@@
_______ @
( ____ \@
| ( \/@
| (____ @
(_____ \ @
) )@
/\____) )@
\______/ @
@@
______ @
/ ____ \@
( ( \/@
| (____ @
| ___ \ @
| ( ) )@
( (___) )@
\_____/ @
@@
______ @
/ ___ \ @
\/ ) )@
/ / @
/ / @
/ / @
/ / @
\_/ @
@@
_____ @
/ ___ \ @
( (___) )@
\ / @
/ ___ \ @
( ( ) )@
( (___) )@
\_____/ @
@@
_____ @
/ ___ \ @
( ( ) )@
( (___) |@
\____ |@
) |@
/\____) )@
\______/ @
@@
@
@
_ @
(_)@
@
_ @
(_)@
@
@@
@
@
@
_ @
(_)@
@
_ @
( )@
|/ @@
_ @
/ )@
/ / @
/ / @
( ( @
\ \ @
\ \ @
\_)@
@@
@
@
___ @
(___)@
___ @
(___)@
@
@
@@
_ @
( \ @
\ \ @
\ \ @
) )@
/ / @
/ / @
(_/ @
@@
_____ @
/ ___ \ @
( ( ) )@
\/ / / @
( ( @
| | @
(_) @
_ @
(_) @@
_____ @
/ ___ \ @
/ / _ \ \ @
( ( / \ ) )@
| |(()// / @
( ( \___/ @
\ \____/\ @
\______/ @
@@
_______ @
( ___ )@
| ( ) |@
| (___) |@
| ___ |@
| ( ) |@
| ) ( |@
|/ \|@
@@
______ @
( ___ \ @
| ( ) )@
| (__/ / @
| __ ( @
| ( \ \ @
| )___) )@
|/ \___/ @
@@
_______ @
( ____ \@
| ( \/@
| | @
| | @
| | @
| (____/\@
(_______/@
@@
______ @
( __ \ @
| ( \ )@
| | ) |@
| | | |@
| | ) |@
| (__/ )@
(______/ @
@@
_______ @
( ____ \@
| ( \/@
| (__ @
| __) @
| ( @
| (____/\@
(_______/@
@@
_______ @
( ____ \@
| ( \/@
| (__ @
| __) @
| ( @
| ) @
|/ @
@@
_______ @
( ____ \@
| ( \/@
| | @
| | ____ @
| | \_ )@
| (___) |@
(_______)@
@@
@
|\ /|@
| ) ( |@
| (___) |@
| ___ |@
| ( ) |@
| ) ( |@
|/ \|@
@@
_________@
\__ __/@
) ( @
| | @
| | @
| | @
___) (___@
\_______/@
@@
_________@
\__ _/@
) ( @
| | @
| | @
| | @
|\_) ) @
(____/ @
@@
_ @
| \ /\@
| \ / /@
| (_/ / @
| _ ( @
| ( \ \ @
| / \ \@
|_/ \/@
@@
_ @
( \ @
| ( @
| | @
| | @
| | @
| (____/\@
(_______/@
@@
_______ @
( )@
| () () |@
| || || |@
| |(_)| |@
| | | |@
| ) ( |@
|/ \|@
@@
_ @
( ( /|@
| \ ( |@
| \ | |@
| (\ \) |@
| | \ |@
| ) \ |@
|/ )_)@
@@
_______ @
( ___ )@
| ( ) |@
| | | |@
| | | |@
| | | |@
| (___) |@
(_______)@
@@
_______ @
( ____ )@
| ( )|@
| (____)|@
| _____)@
| ( @
| ) @
|/ @
@@
_______ @
( ___ )@
| ( ) |@
| | | |@
| | | |@
| | /\| |@
| (_\ \ |@
(____\/_)@
@@
_______ @
( ____ )@
| ( )|@
| (____)|@
| __)@
| (\ ( @
| ) \ \__@
|/ \__/@
@@
_______ @
( ____ \@
| ( \/@
| (_____ @
(_____ )@
) |@
/\____) |@
\_______)@
@@
_________@
\__ __/@
) ( @
| | @
| | @
| | @
| | @
)_( @
@@
@
|\ /|@
| ) ( |@
| | | |@
| | | |@
| | | |@
| (___) |@
(_______)@
@@
@
|\ /|@
| ) ( |@
| | | |@
( ( ) )@
\ \_/ / @
\ / @
\_/ @
@@
@
|\ /|@
| ) ( |@
| | _ | |@
| |( )| |@
| || || |@
| () () |@
(_______)@
@@
@
|\ /|@
( \ / )@
\ (_) / @
) _ ( @
/ ( ) \ @
( / \ )@
|/ \|@
@@
@
|\ /|@
( \ / )@
\ (_) / @
\ / @
) ( @
| | @
\_/ @
@@
_______ @
/ ___ )@
\/ ) |@
/ )@
/ / @
/ / @
/ (_/\@
(_______/@
@@
____ @
( __)@
| ( @
| | @
| | @
| | @
| (__ @
(____)@
@@
@
/\ @
\ \ @
\ \ @
\ \ @
\ \ @
\ \@
\/@
@@
____ @
(__ )@
) |@
| |@
| |@
| |@
__) |@
(____)@
@@
/\ @
(/\)@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
_____ @
(_____)@@
_ @
( )@
\|@
@
@
@
@
@
@@
_______ @
( ___ )@
| ( ) |@
| (___) |@
| ___ |@
| ( ) |@
| ) ( |@
|/ \|@
@@
______ @
( ___ \ @
| ( ) )@
| (__/ / @
| __ ( @
| ( \ \ @
| )___) )@
|/ \___/ @
@@
_______ @
( ____ \@
| ( \/@
| | @
| | @
| | @
| (____/\@
(_______/@
@@
______ @
( __ \ @
| ( \ )@
| | ) |@
| | | |@
| | ) |@
| (__/ )@
(______/ @
@@
_______ @
( ____ \@
| ( \/@
| (__ @
| __) @
| ( @
| (____/\@
(_______/@
@@
_______ @
( ____ \@
| ( \/@
| (__ @
| __) @
| ( @
| ) @
|/ @
@@
_______ @
( ____ \@
| ( \/@
| | @
| | ____ @
| | \_ )@
| (___) |@
(_______)@
@@
@
|\ /|@
| ) ( |@
| (___) |@
| ___ |@
| ( ) |@
| ) ( |@
|/ \|@
@@
_________@
\__ __/@
) ( @
| | @
| | @
| | @
___) (___@
\_______/@
@@
_________@
\__ _/@
) ( @
| | @
| | @
| | @
|\_) ) @
(____/ @
@@
_ @
| \ /\@
| \ / /@
| (_/ / @
| _ ( @
| ( \ \ @
| / \ \@
|_/ \/@
@@
_ @
( \ @
| ( @
| | @
| | @
| | @
| (____/\@
(_______/@
@@
_______ @
( )@
| () () |@
| || || |@
| |(_)| |@
| | | |@
| ) ( |@
|/ \|@
@@
_ @
( ( /|@
| \ ( |@
| \ | |@
| (\ \) |@
| | \ |@
| ) \ |@
|/ )_)@
@@
_______ @
( ___ )@
| ( ) |@
| | | |@
| | | |@
| | | |@
| (___) |@
(_______)@
@@
_______ @
( ____ )@
| ( )|@
| (____)|@
| _____)@
| ( @
| ) @
|/ @
@@
_______ @
( ___ )@
| ( ) |@
| | | |@
| | | |@
| | /\| |@
| (_\ \ |@
(____\/_)@
@@
_______ @
( ____ )@
| ( )|@
| (____)|@
| __)@
| (\ ( @
| ) \ \__@
|/ \__/@
@@
_______ @
( ____ \@
| ( \/@
| (_____ @
(_____ )@
) |@
/\____) |@
\_______)@
@@
_________@
\__ __/@
) ( @
| | @
| | @
| | @
| | @
)_( @
@@
@
|\ /|@
| ) ( |@
| | | |@
| | | |@
| | | |@
| (___) |@
(_______)@
@@
@
|\ /|@
| ) ( |@
| | | |@
( ( ) )@
\ \_/ / @
\ / @
\_/ @
@@
@
|\ /|@
| ) ( |@
| | _ | |@
| |( )| |@
| || || |@
| () () |@
(_______)@
@@
@
|\ /|@
( \ / )@
\ (_) / @
) _ ( @
/ ( ) \ @
( / \ )@
|/ \|@
@@
@
|\ /|@
( \ / )@
\ (_) / @
\ / @
) ( @
| | @
\_/ @
@@
_______ @
/ ___ )@
\/ ) |@
/ )@
/ / @
/ / @
/ (_/\@
(_______/@
@@
__ @
( _)@
)( @
/ | @
\ | @
)(_ @
(__)@
@
@@
_ @
( )@
| |@
(_)@
_ @
( )@
| |@
(_)@
@@
__ @
(_ ) @
)( @
| \@
| /@
_)( @
(__) @
@
@@
_ @
/_\_/)@
(/ \_/ @
@
@
@
@
@
@@
__ __ @
(__) (__)@
_______ @
( ___ )@
| (___) |@
| ___ |@
| ) ( |@
|/ \|@
@@
__ __ @
(__) (__)@
_______ @
( ___ )@
| ( ) |@
| | | |@
| (___) |@
(_______)@
@@
__ __ @
(__) (__)@
@
|\ /|@
| ) ( |@
| | | |@
| (___) |@
(_______)@
@@
__ __ @
(__) (__)@
_______ @
( ___ )@
| (___) |@
| ___ |@
| ) ( |@
|/ \|@
@@
__ __ @
(__) (__)@
_______ @
( ___ )@
| ( ) |@
| | | |@
| (___) |@
(_______)@
@@
__ __ @
(__) (__)@
@
|\ /|@
| ) ( |@
| | | |@
| (___) |@
(_______)@
@@
______ @
( ___ \ @
| (___) )@
| ___ / @
| (___)\ @
| |\___/ @
| ) @
|/ @
@@
@@ -0,0 +1,11 @@
export { Dict, __DEV__, __TEST__, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isFunction, isNumeric, isObject } from './assertion.js';
export { clsx } from './clsx.js';
export { MergeObject, arrayToObject, cleanObject, cleanObjectKeys, compact, copyObject, getKeyValue, getProp, omitObject, renameProp } from './object.js';
export { safeAriaLabel, safeText } from './text.js';
export { getMargin } from './dimensions.js';
export { callAll, callAllHandlers, capitalize, debounce, extractProperty, get, getInertValue, getUniqueID, intersectionBy, isReact19, kebabCase, mapKeys, objectToDeps, omit, removeEvents, uniqBy } from './functions.js';
export { clamp, clampPercentage, range } from './numbers.js';
export { warn } from './console.js';
export { Timer } from './types.js';
export { getGregorianYearOffset } from './dates.js';
export { isPatternNumeric } from './regex.js';
@@ -0,0 +1 @@
{"version":3,"file":"buildManagedMetadataFromMaybeClassElementMetadata.d.ts","sourceRoot":"","sources":["../../../../src/metadata/calculations/buildManagedMetadataFromMaybeClassElementMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAKlE,eAAO,MAAM,iDAAiD,EAAE,CAAC,CAC/D,IAAI,EAAE,wBAAwB,CAAC,eAAe,EAC9C,iBAAiB,EAAE,iBAAiB,GAAG,qBAAqB,KACzD,CACH,QAAQ,EAAE,yBAAyB,GAAG,SAAS,KAC5C,oBAAoB,CAAC,GACxB,CAAC,CACC,IAAI,EAAE,wBAAwB,CAAC,iBAAiB,EAChD,iBAAiB,EAAE,iBAAiB,GAAG,qBAAqB,EAC5D,OAAO,EAAE,kBAAkB,GAAG,SAAS,KACpC,CACH,QAAQ,EAAE,yBAAyB,GAAG,SAAS,KAC5C,oBAAoB,CAamD,CAAC"}
@@ -0,0 +1,26 @@
/*
* 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.
*/ class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
constructor(keys, anchorKey, currentKey){
super(keys);
if (keys instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : keys.anchorKey;
this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : keys.currentKey;
} else {
this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : null;
this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : null;
}
}
}
export {$e40ea825a81a3709$export$52baac22726c72bf as Selection};
//# sourceMappingURL=Selection.module.js.map
@@ -0,0 +1,111 @@
import test from 'tape';
import { elementType } from 'jsx-ast-utils';
import isFocusable from '../../../src/util/isFocusable';
import {
genElementSymbol,
genInteractiveElements,
genNonInteractiveElements,
} from '../../../__mocks__/genInteractives';
import JSXAttributeMock from '../../../__mocks__/JSXAttributeMock';
function mergeTabIndex(index, attributes) {
return [].concat(attributes, JSXAttributeMock('tabIndex', index));
}
test('isFocusable', (t) => {
t.test('interactive elements', (st) => {
genInteractiveElements().forEach(({ openingElement }) => {
st.equal(
isFocusable(
elementType(openingElement),
openingElement.attributes,
),
true,
`identifies \`${genElementSymbol(openingElement)}\` as a focusable element`,
);
st.equal(
isFocusable(
elementType(openingElement),
mergeTabIndex(-1, openingElement.attributes),
),
false,
`does NOT identify \`${genElementSymbol(openingElement)}\` with tabIndex of -1 as a focusable element`,
);
st.equal(
isFocusable(
elementType(openingElement),
mergeTabIndex(0, openingElement.attributes),
),
true,
`identifies \`${genElementSymbol(openingElement)}\` with tabIndex of 0 as a focusable element`,
);
st.equal(
isFocusable(
elementType(openingElement),
mergeTabIndex(1, openingElement.attributes),
),
true,
`identifies \`${genElementSymbol(openingElement)}\` with tabIndex of 1 as a focusable element`,
);
});
st.end();
});
t.test('non-interactive elements', (st) => {
genNonInteractiveElements().forEach(({ openingElement }) => {
st.equal(
isFocusable(
elementType(openingElement),
openingElement.attributes,
),
false,
`does NOT identify \`${genElementSymbol(openingElement)}\` as a focusable element`,
);
st.equal(
isFocusable(
elementType(openingElement),
mergeTabIndex(-1, openingElement.attributes),
),
false,
`does NOT identify \`${genElementSymbol(openingElement)}\` with tabIndex of -1 as a focusable element`,
);
st.equal(
isFocusable(
elementType(openingElement),
mergeTabIndex(0, openingElement.attributes),
),
true,
`identifies \`${genElementSymbol(openingElement)}\` with tabIndex of 0 as a focusable element`,
);
st.equal(
isFocusable(
elementType(openingElement),
mergeTabIndex(1, openingElement.attributes),
),
true,
`identifies \`${genElementSymbol(openingElement)}\` with tabIndex of 1 as a focusable element`,
);
st.equal(
isFocusable(
elementType(openingElement),
mergeTabIndex('bogus', openingElement.attributes),
),
false,
`does NOT identify \`${genElementSymbol(openingElement)}\` with tabIndex of 'bogus' as a focusable element`,
);
});
st.end();
});
t.end();
});
@@ -0,0 +1,19 @@
{
"name": "append-field",
"version": "1.0.0",
"license": "MIT",
"author": "Linus Unnebäck <linus@folkdatorn.se>",
"main": "index.js",
"devDependencies": {
"mocha": "^2.2.4",
"standard": "^6.0.5",
"testdata-w3c-json-form": "^0.2.0"
},
"scripts": {
"test": "standard && mocha"
},
"repository": {
"type": "git",
"url": "http://github.com/LinusU/node-append-field.git"
}
}
@@ -0,0 +1 @@
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,8CAA8C;AAC9C,MAAM,oCAAc,IAAI,IAAI;IAAC;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;CAAO;AAC5G,MAAM,kCAAY,IAAI,IAAI;IAAC;IAAM;IAAM;IAAO;IAAO;IAAO;IAAO;IAAM;IAAM;IAAO;IAAM;IAAM;IAAO;IAAO;IAAO;IAAM;IAAM;IAAM;IAAM;CAAK;AAK7I,SAAS,0CAAM,YAAoB;IACxC,kFAAkF;IAClF,IAAI,KAAK,MAAM,EAAE;QACf,IAAI,SAAS,IAAI,KAAK,MAAM,CAAC,cAAc,QAAQ;QAEnD,6DAA6D;QAC7D,6GAA6G;QAC7G,2GAA2G;QAC3G,IAAI,WAAW,OAAO,OAAO,WAAW,KAAK,aAAa,OAAO,WAAW,KAAK,OAAO,QAAQ;QAChG,IAAI,UACF,OAAO,SAAS,SAAS,KAAK;QAGhC,oCAAoC;QACpC,uGAAuG;QACvG,IAAI,OAAO,MAAM,EACf,OAAO,kCAAY,GAAG,CAAC,OAAO,MAAM;IAExC;IAEA,gEAAgE;IAChE,IAAI,OAAO,aAAa,KAAK,CAAC,IAAI,CAAC,EAAE;IACrC,OAAO,gCAAU,GAAG,CAAC;AACvB","sources":["packages/@react-aria/i18n/src/utils.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\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (Intl.Locale) {\n let locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo\n let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;\n if (textInfo) {\n return textInfo.direction === 'rtl';\n }\n\n // Fallback: guess using the script.\n // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n let lang = localeString.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
@@ -0,0 +1,48 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ } = require("eslint-utils")
const checkForPreferGlobal = require("../../util/check-prefer-global")
const trackMap = {
globals: {
URL: { [READ]: true },
},
modules: {
url: {
URL: { [READ]: true },
},
},
}
module.exports = {
meta: {
docs: {
description: 'enforce either `URL` or `require("url").URL`',
category: "Stylistic Issues",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/url.md",
},
type: "suggestion",
fixable: null,
schema: [{ enum: ["always", "never"] }],
messages: {
preferGlobal:
"Unexpected use of 'require(\"url\").URL'. Use the global variable 'URL' instead.",
preferModule:
"Unexpected use of the global variable 'URL'. Use 'require(\"url\").URL' instead.",
},
},
create(context) {
return {
"Program:exit"() {
checkForPreferGlobal(context, trackMap)
},
}
},
}
@@ -0,0 +1,95 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ariaQuery = require("aria-query");
var _jsxAstUtils = require("jsx-ast-utils");
var _arrayIncludes = _interopRequireDefault(require("array-includes"));
var _hasown = _interopRequireDefault(require("hasown"));
var _schemas = require("../util/schemas");
var _getElementType = _interopRequireDefault(require("../util/getElementType"));
var _isAbstractRole = _interopRequireDefault(require("../util/isAbstractRole"));
var _isContentEditable = _interopRequireDefault(require("../util/isContentEditable"));
var _isHiddenFromScreenReader = _interopRequireDefault(require("../util/isHiddenFromScreenReader"));
var _isInteractiveElement = _interopRequireDefault(require("../util/isInteractiveElement"));
var _isInteractiveRole = _interopRequireDefault(require("../util/isInteractiveRole"));
var _isNonInteractiveElement = _interopRequireDefault(require("../util/isNonInteractiveElement"));
var _isNonInteractiveRole = _interopRequireDefault(require("../util/isNonInteractiveRole"));
var _isPresentationRole = _interopRequireDefault(require("../util/isPresentationRole"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/**
* @fileoverview Enforce non-interactive elements have no interactive handlers.
* @author Jese Beach
*
*/
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
var errorMessage = 'Non-interactive elements should not be assigned mouse or keyboard event listeners.';
var defaultInteractiveProps = [].concat(_jsxAstUtils.eventHandlersByType.focus, _jsxAstUtils.eventHandlersByType.image, _jsxAstUtils.eventHandlersByType.keyboard, _jsxAstUtils.eventHandlersByType.mouse);
var schema = (0, _schemas.generateObjSchema)({
handlers: _schemas.arraySchema
});
var _default = exports["default"] = {
meta: {
docs: {
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/no-noninteractive-element-interactions.md',
description: 'Non-interactive elements should not be assigned mouse or keyboard event listeners.'
},
schema: [schema]
},
create: function create(context) {
var options = context.options;
var elementType = (0, _getElementType["default"])(context);
return {
JSXOpeningElement: function (_JSXOpeningElement) {
function JSXOpeningElement(_x) {
return _JSXOpeningElement.apply(this, arguments);
}
JSXOpeningElement.toString = function () {
return _JSXOpeningElement.toString();
};
return JSXOpeningElement;
}(function (node) {
var attributes = node.attributes;
var type = elementType(node);
var config = options[0] || {};
var interactiveProps = config.handlers || defaultInteractiveProps;
// Allow overrides from rule configuration for specific elements and roles.
if ((0, _hasown["default"])(config, type)) {
attributes = attributes.filter(function (attr) {
return attr.type !== 'JSXSpreadAttribute' && !(0, _arrayIncludes["default"])(config[type], (0, _jsxAstUtils.propName)(attr));
});
}
var hasInteractiveProps = interactiveProps.some(function (prop) {
return (0, _jsxAstUtils.hasProp)(attributes, prop) && (0, _jsxAstUtils.getPropValue)((0, _jsxAstUtils.getProp)(attributes, prop)) != null;
});
if (!_ariaQuery.dom.has(type)) {
// Do not test higher level JSX components, as we do not know what
// low-level DOM element this maps to.
return;
}
if (!hasInteractiveProps || (0, _isContentEditable["default"])(type, attributes) || (0, _isHiddenFromScreenReader["default"])(type, attributes) || (0, _isPresentationRole["default"])(type, attributes)) {
// Presentation is an intentional signal from the author that this
// element is not meant to be perceivable. For example, a click screen
// to close a dialog .
return;
}
if ((0, _isInteractiveElement["default"])(type, attributes) || (0, _isInteractiveRole["default"])(type, attributes) || !(0, _isNonInteractiveElement["default"])(type, attributes) && !(0, _isNonInteractiveRole["default"])(type, attributes) || (0, _isAbstractRole["default"])(type, attributes)) {
// This rule has no opinion about abtract roles.
return;
}
// Visible, non-interactive elements should not have an interactive handler.
context.report({
node,
message: errorMessage
});
})
};
}
};
module.exports = exports.default;
@@ -0,0 +1,96 @@
/**
* @fileoverview Common helpers for naming of plugins, formatters and configs
*/
const NAMESPACE_REGEX = /^@.*\//iu;
/**
* Brings package name to correct format based on prefix
* @param {string} name The name of the package.
* @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter"
* @returns {string} Normalized name of the package
* @private
*/
function normalizePackageName(name, prefix) {
let normalizedName = name;
/**
* On Windows, name can come in with Windows slashes instead of Unix slashes.
* Normalize to Unix first to avoid errors later on.
* https://github.com/eslint/eslint/issues/5644
*/
if (normalizedName.includes("\\")) {
normalizedName = normalizedName.replace(/\\/gu, "/");
}
if (normalizedName.charAt(0) === "@") {
/**
* it's a scoped package
* package name is the prefix, or just a username
*/
const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"),
scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u");
if (scopedPackageShortcutRegex.test(normalizedName)) {
normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);
} else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) {
/**
* for scoped packages, insert the prefix after the first / unless
* the path is already @scope/eslint or @scope/eslint-xxx-yyy
*/
normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`);
}
} else if (!normalizedName.startsWith(`${prefix}-`)) {
normalizedName = `${prefix}-${normalizedName}`;
}
return normalizedName;
}
/**
* Removes the prefix from a fullname.
* @param {string} fullname The term which may have the prefix.
* @param {string} prefix The prefix to remove.
* @returns {string} The term without prefix.
*/
function getShorthandName(fullname, prefix) {
if (fullname[0] === "@") {
let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);
if (matchResult) {
return matchResult[1];
}
matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
if (matchResult) {
return `${matchResult[1]}/${matchResult[2]}`;
}
} else if (fullname.startsWith(`${prefix}-`)) {
return fullname.slice(prefix.length + 1);
}
return fullname;
}
/**
* Gets the scope (namespace) of a term.
* @param {string} term The term which may have the namespace.
* @returns {string} The namespace of the term if it has one.
*/
function getNamespaceFromTerm(term) {
const match = term.match(NAMESPACE_REGEX);
return match ? match[0] : "";
}
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
export {
normalizePackageName,
getShorthandName,
getNamespaceFromTerm
};
@@ -0,0 +1,134 @@
didYouMean.js - A simple JavaScript matching engine
===================================================
[Available on GitHub](https://github.com/dcporter/didyoumean.js).
A super-simple, highly optimized JS library for matching human-quality input to a list of potential
matches. You can use it to suggest a misspelled command-line utility option to a user, or to offer
links to nearby valid URLs on your 404 page. (The examples below are taken from a personal project,
my [HTML5 business card](http://dcporter.aws.af.cm/me), which uses didYouMean.js to suggest correct
URLs from misspelled ones, such as [dcporter.aws.af.cm/me/instagarm](http://dcporter.aws.af.cm/me/instagarm).)
Uses the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance).
didYouMean.js works in the browser as well as in node.js. To install it for use in node:
```
npm install didyoumean
```
Examples
--------
Matching against a list of strings:
```
var input = 'insargrm'
var list = ['facebook', 'twitter', 'instagram', 'linkedin'];
console.log(didYouMean(input, list));
> 'instagram'
// The method matches 'insargrm' to 'instagram'.
input = 'google plus';
console.log(didYouMean(input, list));
> null
// The method was unable to find 'google plus' in the list of options.
```
Matching against a list of objects:
```
var input = 'insargrm';
var list = [ { id: 'facebook' }, { id: 'twitter' }, { id: 'instagram' }, { id: 'linkedin' } ];
var key = 'id';
console.log(didYouMean(input, list, key));
> 'instagram'
// The method returns the matching value.
didYouMean.returnWinningObject = true;
console.log(didYouMean(input, list, key));
> { id: 'instagram' }
// The method returns the matching object.
```
didYouMean(str, list, [key])
----------------------------
- str: The string input to match.
- list: An array of strings or objects to match against.
- key (OPTIONAL): If your list array contains objects, you must specify the key which contains the string
to match against.
Returns: the closest matching string, or null if no strings exceed the threshold.
Options
-------
Options are set on the didYouMean function object. You may change them at any time.
### threshold
By default, the method will only return strings whose edit distance is less than 40% (0.4x) of their length.
For example, if a ten-letter string is five edits away from its nearest match, the method will return null.
You can control this by setting the "threshold" value on the didYouMean function. For example, to set the
edit distance threshold to 50% of the input string's length:
```
didYouMean.threshold = 0.5;
```
To return the nearest match no matter the threshold, set this value to null.
### thresholdAbsolute
This option behaves the same as threshold, but instead takes an integer number of edit steps. For example,
if thresholdAbsolute is set to 20 (the default), then the method will only return strings whose edit distance
is less than 20. Both options apply.
### caseSensitive
By default, the method will perform case-insensitive comparisons. If you wish to force case sensitivity, set
the "caseSensitive" value to true:
```
didYouMean.caseSensitive = true;
```
### nullResultValue
By default, the method will return null if there is no sufficiently close match. You can change this value here.
### returnWinningObject
By default, the method will return the winning string value (if any). If your list contains objects rather
than strings, you may set returnWinningObject to true.
```
didYouMean.returnWinningObject = true;
```
This option has no effect on lists of strings.
### returnFirstMatch
By default, the method will search all values and return the closest match. If you're simply looking for a "good-
enough" match, you can set your thresholds appropriately and set returnFirstMatch to true to substantially speed
things up.
License
-------
didYouMean copyright (c) 2013-2014 Dave Porter.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License
[here](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 CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAeM,SAAS,0CAAkB,KAA8B,EAAE,GAAuC;IACvG,IAAI,aACF,SAAS,cACT,UAAU,EACV,gBAAgB,WAAW,eAC3B,cAAc,KACd,GAAG,YACJ,GAAG;IAEJ,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,4BAAM,EAAE;QAAC,YAAY,cAAc;qBAAW;QAAa,GAAG,UAAU;IAAA,GAAG;IAC7F,IAAI,YAAY,WAAW,IAAI,CAAC;IAChC,IAAI,YAA2B,CAAC;IAEhC,IAAI,CAAC,WACH,YAAY;IAGd,IAAI,WAAW;QACb,SAAS,CAAC,eAAe,GAAG,eAAe;QAC3C,2DAA2D;QAC3D,oEAAoE;QACpE,UAAU,QAAQ,GAAG,MAAM,SAAS,GAAG,KAAK;IAC9C;IAEA,OAAO;QACL,WAAW;YACT,iBAAiB;YACjB,GAAG,SAAS;QACd;IACF;AACF","sources":["packages/@react-aria/breadcrumbs/src/useBreadcrumbItem.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 {AriaBreadcrumbItemProps} from '@react-types/breadcrumbs';\nimport {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {useLink} from '@react-aria/link';\n\nexport interface BreadcrumbItemAria {\n /** Props for the breadcrumb item link element. */\n itemProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for an in a breadcrumbs component.\n * See `useBreadcrumbs` for details about breadcrumbs.\n */\nexport function useBreadcrumbItem(props: AriaBreadcrumbItemProps, ref: RefObject<FocusableElement | null>): BreadcrumbItemAria {\n let {\n isCurrent,\n isDisabled,\n 'aria-current': ariaCurrent,\n elementType = 'a',\n ...otherProps\n } = props;\n\n let {linkProps} = useLink({isDisabled: isDisabled || isCurrent, elementType, ...otherProps}, ref);\n let isHeading = /^h[1-6]$/.test(elementType);\n let itemProps: DOMAttributes = {};\n\n if (!isHeading) {\n itemProps = linkProps;\n }\n\n if (isCurrent) {\n itemProps['aria-current'] = ariaCurrent || 'page';\n // isCurrent sets isDisabled === true for the current item,\n // so we have to restore the tabIndex in order to support autoFocus.\n itemProps.tabIndex = props.autoFocus ? -1 : undefined;\n }\n\n return {\n itemProps: {\n 'aria-disabled': isDisabled,\n ...itemProps\n }\n };\n}\n"],"names":[],"version":3,"file":"useBreadcrumbItem.main.js.map"}
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,uFAAuF;AACvF,gGAAgG;;;AAOhG,MAAM,wCAAkB;IAAC;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAE;CAAC;AACjG,MAAM,sCAAgB;IAAC;QAAC;QAAM;QAAG;KAAG;IAAE;QAAC;QAAM;QAAI;KAAG;IAAE;QAAC;QAAM;QAAG;KAAE;IAAE;QAAC;QAAM;QAAG;KAAG;CAAC;AAClF,MAAM,oCAAc;IAAC;IAAM;IAAM;IAAM;IAAM;CAAK;AAClD,MAAM,kCAAY;IAAC;IAAS;IAAU;IAAS;IAAU;CAAQ;AAEjE,SAAS,+CAAyB,IAAqB;IACrD,MAAM,MAAM,sCAAgB,SAAS,CAAC,CAAC,CAAC,MAAM,OAAO,IAAI;QACvD,IAAI,KAAK,IAAI,GAAG,MACd,OAAO;QAGT,IAAI,KAAK,IAAI,KAAK,QAAQ,KAAK,KAAK,GAAG,OACrC,OAAO;QAGT,IAAI,KAAK,IAAI,KAAK,QAAQ,KAAK,KAAK,KAAK,SAAS,KAAK,GAAG,GAAG,KAC3D,OAAO;QAGT,OAAO;IACT;IAEA,IAAI,QAAQ,IACV,OAAO,sCAAgB,MAAM,GAAG;IAGlC,IAAI,QAAQ,GACV,OAAO;IAGT,OAAO,MAAM;AACf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,YAAY,iCAAW,CAAC,gCAAU,OAAO,CAAC,KAAK,GAAG,EAAE;IACxD,IAAI,CAAC,WACH,MAAM,IAAI,MAAM,kBAAkB,KAAK,GAAG;IAG5C,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,KAAK,IAAI,GAAG,WACZ,KAAK,KAAK,EACV,KAAK,GAAG;AAEZ;AAOO,MAAM,kDAAyB,CAAA,GAAA,yCAAgB;IAGpD,cAAc,EAAU,EAAgB;QACtC,IAAI,OAAO,KAAK,CAAC,cAAc;QAC/B,IAAI,MAAM,+CAAyB;QAEnC,OAAO,IAAI,CAAA,GAAA,yCAAW,EACpB,IAAI,EACJ,+BAAS,CAAC,IAAI,EACd,KAAK,IAAI,GAAG,iCAAW,CAAC,IAAI,EAC5B,KAAK,KAAK,EACV,KAAK,GAAG;IAEZ;IAEA,YAAY,IAAqB,EAAE;QACjC,OAAO,KAAK,CAAC,YAAY,kCAAY;IACvC;IAEA,YAAY,IAA8B,EAAE;QAC1C,IAAI,gBAAgB,kCAAY;QAChC,IAAI,MAAM,+CAAyB;QAEnC,IAAI,+BAAS,CAAC,IAAI,KAAK,KAAK,GAAG,EAAE;YAC/B,KAAK,GAAG,GAAG,+BAAS,CAAC,IAAI;YACzB,KAAK,IAAI,GAAG,cAAc,IAAI,GAAG,iCAAW,CAAC,IAAI;QACnD;QAEA,4DAA4D;QAC5D,IAAI,CAAC,aAAa,CAAC;IACrB;IAEA,cAAc,IAA8B,EAAE;QAC5C,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,IAAI,MAAM,mCAAa,CAAC,IAAI;QAC5B,IAAI,OAAO,MAAM;YACf,IAAI,CAAC,SAAS,UAAU,OAAO,GAAG;YAElC,+DAA+D;YAC/D,uDAAuD;YACvD,IAAI,UAAU,UAAU,iCAAW,CAAC,IAAI;YACxC,KAAK,IAAI,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,SAAS,KAAK,IAAI;YACnD,IAAI,KAAK,IAAI,KAAK,SAAS;gBACzB,KAAK,KAAK,GAAG,KAAK,GAAG,CAAC,UAAU,KAAK,KAAK;gBAE1C,IAAI,KAAK,KAAK,KAAK,UACjB,KAAK,GAAG,GAAG,KAAK,GAAG,CAAC,QAAQ,KAAK,GAAG;YAExC;QACF;QAEA,IAAI,KAAK,IAAI,KAAK,KAAK,OAAO,GAAG;YAC/B,IAAI,GAAG,YAAY,SAAS,GAAG,qCAAe,CAAC,IAAI;YACnD,KAAK,KAAK,GAAG,KAAK,GAAG,CAAC,YAAY,KAAK,KAAK;YAE5C,IAAI,KAAK,KAAK,KAAK,YACjB,KAAK,GAAG,GAAG,KAAK,GAAG,CAAC,UAAU,KAAK,GAAG;QAE1C;IACF;IAEA,UAAU;QACR,OAAO;IACT;IAEA,cAAc,IAAqB,EAAU;QAC3C,2FAA2F;QAC3F,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,IAAI,MAAM,qCAAe,CAAC,IAAI;QAC9B,IAAI,OAAO,qCAAe,CAAC,MAAM,EAAE;QACnC,IAAI,QAAQ,MACV,8CAA8C;QAC9C,OAAO,OAAO,GAAG,CAAC,EAAE,GAAG;QAGzB,IAAI,QAAQ,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE;QAE5B,IAAI,KAAK,KAAK,GAAG,IAAI,CAAC,EAAE,IAAK,KAAK,KAAK,KAAK,IAAI,CAAC,EAAE,IAAI,KAAK,GAAG,GAAG,IAAI,CAAC,EAAE,EACvE;QAGF,OAAO;IACT;IAEA,eAAe,IAAqB,EAAU;QAC5C,OAAO,KAAK,CAAC,eAAe,kCAAY;IAC1C;IAEA,sBAAsB,IAAqB,EAAU;QACnD,IAAI,QAAQ,kCAAY;QACxB,OAAO,QAAQ,KAAK,CAAC,EAAE,GAAG;IAC5B;IAEA,qBAAqB,IAAqB,EAAU;QAClD,IAAI,QAAQ,kCAAY;QACxB,OAAO,SAAS,KAAK,KAAK,KAAK,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG;IACvD;;6BAhGA,aAAa;;AAiGf;AAEA,SAAS,kCAAY,IAAqB;IACxC,IAAI,KAAK,IAAI,KAAK,GAAG;QACnB,IAAI,MAAM,gCAAU,OAAO,CAAC,KAAK,GAAG;QACpC,OAAO,qCAAe,CAAC,IAAI;IAC7B;AACF","sources":["packages/@internationalized/date/src/calendars/JapaneseCalendar.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\n// Portions of the code in this file are based on code from the TC39 Temporal proposal.\n// Original licensing can be found in the NOTICE file in the root directory of this source tree.\n\nimport {AnyCalendarDate} from '../types';\nimport {CalendarDate} from '../CalendarDate';\nimport {GregorianCalendar} from './GregorianCalendar';\nimport {Mutable} from '../utils';\n\nconst ERA_START_DATES = [[1868, 9, 8], [1912, 7, 30], [1926, 12, 25], [1989, 1, 8], [2019, 5, 1]];\nconst ERA_END_DATES = [[1912, 7, 29], [1926, 12, 24], [1989, 1, 7], [2019, 4, 30]];\nconst ERA_ADDENDS = [1867, 1911, 1925, 1988, 2018];\nconst ERA_NAMES = ['meiji', 'taisho', 'showa', 'heisei', 'reiwa'];\n\nfunction findEraFromGregorianDate(date: AnyCalendarDate) {\n const idx = ERA_START_DATES.findIndex(([year, month, day]) => {\n if (date.year < year) {\n return true;\n }\n\n if (date.year === year && date.month < month) {\n return true;\n }\n\n if (date.year === year && date.month === month && date.day < day) {\n return true;\n }\n\n return false;\n });\n\n if (idx === -1) {\n return ERA_START_DATES.length - 1;\n }\n\n if (idx === 0) {\n return 0;\nLine truncated
@@ -0,0 +1 @@
{"name":"mylas","version":"2.1.14","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532102804,"integrity":"sha512-ruotZ+ZKiXMFX4rSaFJbFUfxcjanIqaMpeDme7jn5VYSwBvH5iMXoK1H3N/9CYDYl/PlLDFv+jJBaJJYpqd4iA==","mode":420,"size":1070},"build/chunk-M3H36CX2.js":{"checkedAt":1794532102804,"integrity":"sha512-e3TlmEOIKd4ehc44AskNUMryrwDjnWXmIBS8dx9rQTlApRM7BJrRgSYSagN2R5YApElp1gUTtGJ3Q/JqVrLhgg==","mode":420,"size":2705},"build/chunk-VEJPISHX.js":{"checkedAt":1794532102804,"integrity":"sha512-vYncDxMB/p9iznlZGqCtlDowP2tnc2abH0lVIZd7UGqhNoqJjbDW03tSwb4RflM0w/FrOCP/nIVOxotrkRqHqw==","mode":420,"size":5895},"build/index.js":{"checkedAt":1794532102804,"integrity":"sha512-KbvaDxpN90+jBkYdbuiFBYwPGgwBWm7+5OPiABHaddAdmxRghIDf+WSn/Mf5ZjycO4Z3y6O0u2UtKpMXp/jbwQ==","mode":420,"size":394},"build/register.js":{"checkedAt":1794532102804,"integrity":"sha512-Gcsa7H2X0TT8X9a+7XvwlSeV0yEp5Yy4+mtnjwbyMm0UpSEeTYZfJI5QoJvXXs17U9rtsSi9dO9DiJTZexFB9Q==","mode":420,"size":765},"build/worker.js":{"checkedAt":1794532102804,"integrity":"sha512-Gwg2JHPRkmg8Mu7jFWkvSd2722UVYdphY6WE2H+/SaP/+frMZdyJLarNW/YiyWY9j0Pi5UZg0pmT5PpDhLhfbA==","mode":420,"size":839},"package.json":{"checkedAt":1794532102805,"integrity":"sha512-bYdSUXYQPAgN6iV5Blqxad7GzoPxKTjgtItRS5hWrzH2UENiKVGHOCy6/VyrGwVxo58ka9hUkPECJgfXkq6GgQ==","mode":420,"size":1394},"README.md":{"checkedAt":1794532102805,"integrity":"sha512-zhSWPPmgP1lmKnKK5/B7BpIzlLMzwx/pgiqWNwH9dlwPxydDecA5wDCEe3Mi1sKyW2OId5awwVIkJrprNSkAVw==","mode":420,"size":1793},"build/index.d.ts":{"checkedAt":1794532102805,"integrity":"sha512-QfbivAZPguo3F0gzRyhndYnA6L1sTUl7rInYglQA2W1VtMiCWedc5p16bP8/L1Sngezkn7dIdndYXu1ciAnKcQ==","mode":420,"size":372},"build/interfaces.d.ts":{"checkedAt":1794532102805,"integrity":"sha512-TkaIbqSGwqKEn2q0HnxNpQ34/V06GISsBMmA1L3mVSwJ6Pw9ZXX/bUi3G2PtO8b7HzWpVSI2N2uwj8RYgZFSCw==","mode":420,"size":7173},"build/register.d.ts":{"checkedAt":1794532102805,"integrity":"sha512-Zkd+ONek2p5CD6k1ixc4uzqflwsWZVqmsMerxGNiok1i0OL+awmKj4tURZJYYJnuprpdxrzhD/qLlHelWyA0dQ==","mode":420,"size":221}}}
@@ -0,0 +1,29 @@
// src/moon.tsx
import { jsx } from "react/jsx-runtime";
var MoonIcon = (props) => /* @__PURE__ */ jsx(
"svg",
{
"aria-hidden": "true",
focusable: "false",
height: "1em",
role: "presentation",
viewBox: "0 0 512 512",
width: "1em",
...props,
children: /* @__PURE__ */ jsx(
"path",
{
d: "M160 136c0-30.62 4.51-61.61 16-88C99.57 81.27 48 159.32 48 248c0 119.29 96.71 216 216 216 88.68 0 166.73-51.57 200-128-26.39 11.49-57.38 16-88 16-119.29 0-216-96.71-216-216z",
fill: "none",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 32
}
)
}
);
export {
MoonIcon
};
@@ -0,0 +1,10 @@
import { BaseClassElementMetadata } from './BaseClassElementMetadata';
import { MaybeClassElementMetadataKind } from './MaybeClassElementMetadataKind';
import { MetadataName } from './MetadataName';
import { MetadataTag } from './MetadataTag';
export interface MaybeManagedClassElementMetadata extends BaseClassElementMetadata<MaybeClassElementMetadataKind.unknown> {
name: MetadataName | undefined;
optional: boolean;
tags: Map<MetadataTag, unknown>;
}
//# sourceMappingURL=MaybeManagedClassElementMetadata.d.ts.map
@@ -0,0 +1,254 @@
'use strict';
exports.__esModule = true;
const fs = require('fs');
const Module = require('module');
const path = require('path');
const { getPhysicalFilename } = require('./contextCompat');
const hashObject = require('./hash').hashObject;
const ModuleCache = require('./ModuleCache').default;
const pkgDir = require('./pkgDir').default;
const CASE_SENSITIVE_FS = !fs.existsSync(path.join(__dirname.toUpperCase(), 'reSOLVE.js'));
exports.CASE_SENSITIVE_FS = CASE_SENSITIVE_FS;
const ERROR_NAME = 'EslintPluginImportResolveError';
const fileExistsCache = new ModuleCache();
// Polyfill Node's `Module.createRequireFromPath` if not present (added in Node v10.12.0)
// Use `Module.createRequire` if available (added in Node v12.2.0)
const createRequire = Module.createRequire
// @ts-expect-error this only exists in older node
|| Module.createRequireFromPath
|| /** @type {(filename: string) => unknown} */ function (filename) {
const mod = new Module(filename, void null);
mod.filename = filename;
// @ts-expect-error _nodeModulePaths is undocumented
mod.paths = Module._nodeModulePaths(path.dirname(filename));
// @ts-expect-error _compile is undocumented
mod._compile(`module.exports = require;`, filename);
return mod.exports;
};
/** @type {(resolver: object) => resolver is import('./resolve').Resolver} */
function isResolverValid(resolver) {
if ('interfaceVersion' in resolver && resolver.interfaceVersion === 2) {
return 'resolve' in resolver && !!resolver.resolve && typeof resolver.resolve === 'function';
}
return 'resolveImport' in resolver && !!resolver.resolveImport && typeof resolver.resolveImport === 'function';
}
/** @type {<T extends string>(target: T, sourceFile?: string | null | undefined) => undefined | ReturnType<typeof require>} */
function tryRequire(target, sourceFile) {
let resolved;
try {
// Check if the target exists
if (sourceFile != null) {
try {
resolved = createRequire(path.resolve(sourceFile)).resolve(target);
} catch (e) {
resolved = require.resolve(target);
}
} else {
resolved = require.resolve(target);
}
} catch (e) {
// If the target does not exist then just return undefined
return undefined;
}
// If the target exists then return the loaded module
return require(resolved);
}
/** @type {<T extends Map<string, unknown>>(resolvers: string[] | string | { [k: string]: string }, map: T) => T} */
function resolverReducer(resolvers, map) {
if (Array.isArray(resolvers)) {
resolvers.forEach((r) => resolverReducer(r, map));
return map;
}
if (typeof resolvers === 'string') {
map.set(resolvers, null);
return map;
}
if (typeof resolvers === 'object') {
for (const key in resolvers) {
map.set(key, resolvers[key]);
}
return map;
}
const err = new Error('invalid resolver config');
err.name = ERROR_NAME;
throw err;
}
/** @type {(sourceFile: string) => string} */
function getBaseDir(sourceFile) {
return pkgDir(sourceFile) || process.cwd();
}
/** @type {(name: string, sourceFile: string) => import('./resolve').Resolver} */
function requireResolver(name, sourceFile) {
// Try to resolve package with conventional name
const resolver = tryRequire(`eslint-import-resolver-${name}`, sourceFile)
|| tryRequire(name, sourceFile)
|| tryRequire(path.resolve(getBaseDir(sourceFile), name));
if (!resolver) {
const err = new Error(`unable to load resolver "${name}".`);
err.name = ERROR_NAME;
throw err;
}
if (!isResolverValid(resolver)) {
const err = new Error(`${name} with invalid interface loaded as resolver`);
err.name = ERROR_NAME;
throw err;
}
return resolver;
}
// https://stackoverflow.com/a/27382838
/** @type {import('./resolve').fileExistsWithCaseSync} */
exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cacheSettings, strict) {
// don't care if the FS is case-sensitive
if (CASE_SENSITIVE_FS) { return true; }
// null means it resolved to a builtin
if (filepath === null) { return true; }
if (filepath.toLowerCase() === process.cwd().toLowerCase() && !strict) { return true; }
const parsedPath = path.parse(filepath);
const dir = parsedPath.dir;
let result = fileExistsCache.get(filepath, cacheSettings);
if (result != null) { return result; }
// base case
if (dir === '' || parsedPath.root === filepath) {
result = true;
} else {
const filenames = fs.readdirSync(dir);
if (filenames.indexOf(parsedPath.base) === -1) {
result = false;
} else {
result = fileExistsWithCaseSync(dir, cacheSettings, strict);
}
}
fileExistsCache.set(filepath, result);
return result;
};
/** @type {import('./types').ESLintSettings | null} */
let prevSettings = null;
let memoizedHash = '';
/** @type {(modulePath: string, sourceFile: string, settings: import('./types').ESLintSettings) => import('./resolve').ResolvedResult} */
function fullResolve(modulePath, sourceFile, settings) {
// check if this is a bonus core module
const coreSet = new Set(settings['import/core-modules']);
if (coreSet.has(modulePath)) { return { found: true, path: null }; }
const sourceDir = path.dirname(sourceFile);
if (prevSettings !== settings) {
memoizedHash = hashObject(settings).digest('hex');
prevSettings = settings;
}
const cacheKey = sourceDir + memoizedHash + modulePath;
const cacheSettings = ModuleCache.getSettings(settings);
const cachedPath = fileExistsCache.get(cacheKey, cacheSettings);
if (cachedPath !== undefined) { return { found: true, path: cachedPath }; }
/** @type {(resolvedPath: string | null) => void} */
function cache(resolvedPath) {
fileExistsCache.set(cacheKey, resolvedPath);
}
/** @type {(resolver: import('./resolve').Resolver, config: unknown) => import('./resolve').ResolvedResult} */
function withResolver(resolver, config) {
if (resolver.interfaceVersion === 2) {
return resolver.resolve(modulePath, sourceFile, config);
}
try {
const resolved = resolver.resolveImport(modulePath, sourceFile, config);
if (resolved === undefined) { return { found: false }; }
return { found: true, path: resolved };
} catch (err) {
return { found: false };
}
}
const configResolvers = settings['import/resolver']
|| { node: settings['import/resolve'] }; // backward compatibility
const resolvers = resolverReducer(configResolvers, new Map());
for (const pair of resolvers) {
const name = pair[0];
const config = pair[1];
const resolver = requireResolver(name, sourceFile);
const resolved = withResolver(resolver, config);
if (!resolved.found) { continue; }
// else, counts
cache(resolved.path);
return resolved;
}
// failed
// cache(undefined)
return { found: false };
}
/** @type {import('./resolve').relative} */
function relative(modulePath, sourceFile, settings) {
return fullResolve(modulePath, sourceFile, settings).path;
}
exports.relative = relative;
/** @type {Set<import('eslint').Rule.RuleContext>} */
const erroredContexts = new Set();
/**
* Given
* @param p - module path
* @param context - ESLint context
* @return - the full module filesystem path; null if package is core; undefined if not found
* @type {import('./resolve').default}
*/
function resolve(p, context) {
try {
return relative(p, getPhysicalFilename(context), context.settings);
} catch (err) {
if (!erroredContexts.has(context)) {
// The `err.stack` string starts with `err.name` followed by colon and `err.message`.
// We're filtering out the default `err.name` because it adds little value to the message.
// @ts-expect-error this might be an Error
let errMessage = err.message;
// @ts-expect-error this might be an Error
if (err.name !== ERROR_NAME && err.stack) {
// @ts-expect-error this might be an Error
errMessage = err.stack.replace(/^Error: /, '');
}
context.report({
message: `Resolve error: ${errMessage}`,
loc: { line: 1, column: 0 },
});
erroredContexts.add(context);
}
}
}
resolve.relative = relative;
exports.default = resolve;
@@ -0,0 +1,4 @@
{
"main": "../../cjs/_apply_decorated_descriptor.cjs",
"module": "../../esm/_apply_decorated_descriptor.js"
}
@@ -0,0 +1,43 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _tokenizer = require('../parser/tokenizer');
var _types = require('../parser/tokenizer/types');
var _JSXTransformer = require('../transformers/JSXTransformer');
var _getJSXPragmaInfo = require('./getJSXPragmaInfo'); var _getJSXPragmaInfo2 = _interopRequireDefault(_getJSXPragmaInfo);
function getNonTypeIdentifiers(tokens, options) {
const jsxPragmaInfo = _getJSXPragmaInfo2.default.call(void 0, options);
const nonTypeIdentifiers = new Set();
for (let i = 0; i < tokens.tokens.length; i++) {
const token = tokens.tokens[i];
if (
token.type === _types.TokenType.name &&
!token.isType &&
(token.identifierRole === _tokenizer.IdentifierRole.Access ||
token.identifierRole === _tokenizer.IdentifierRole.ObjectShorthand ||
token.identifierRole === _tokenizer.IdentifierRole.ExportAccess) &&
!token.shadowsGlobal
) {
nonTypeIdentifiers.add(tokens.identifierNameForToken(token));
}
if (token.type === _types.TokenType.jsxTagStart) {
nonTypeIdentifiers.add(jsxPragmaInfo.base);
}
if (
token.type === _types.TokenType.jsxTagStart &&
i + 1 < tokens.tokens.length &&
tokens.tokens[i + 1].type === _types.TokenType.jsxTagEnd
) {
nonTypeIdentifiers.add(jsxPragmaInfo.base);
nonTypeIdentifiers.add(jsxPragmaInfo.fragmentBase);
}
if (token.type === _types.TokenType.jsxName && token.identifierRole === _tokenizer.IdentifierRole.Access) {
const identifierName = tokens.identifierNameForToken(token);
// Lower-case single-component tag names like "div" don't count.
if (!_JSXTransformer.startsWithLowerCase.call(void 0, identifierName) || tokens.tokens[i + 1].type === _types.TokenType.dot) {
nonTypeIdentifiers.add(tokens.identifierNameForToken(token));
}
}
}
return nonTypeIdentifiers;
} exports.getNonTypeIdentifiers = getNonTypeIdentifiers;
@@ -0,0 +1,423 @@
flf2a$ 4 3 11 0 14
Fourtops by Randall Ransom 4/94 <ransom@girtab.usc.edu>
Figlet release 2.0 -- August 5, 1993
Date: 9 Apr 1994
Explanation of first line:
flf2 - "magic number" for file identification
a - should always be `a', for now
$ - the "hardblank" -- prints as a blank, but can't be smushed
4 - height of a character
3 - height of a character, not including descenders
11 - max line length (excluding comment lines) + a fudge factor
0 - default smushmode for this font (like "-m 0" on command line)
14 - number of comment lines
$$@
$$@
$$@
$$@@
|@
|@
.@
$@@
||@
$$@
$$@
$$@@
. .$@
-|-|-@
-|-|-@
' '$@@
||@
(~@
_)@
||@@
. /@
$/$@
/ .@
$ $@@
$|@
(~@
(_@
$|@@
/@
$@
$@
$@@
/@
| @
| @
\@@
\ @
|@
|@
/ @@
\ /@
-X-@
/ \@
$ $@@
$.$@
-+-@
$'$@
$ $@@
$@
$@
$@
/@@
$ $@
---@
$ $@
$ $@@
$@
$@
.@
$@@
/@
/ @
/ @
@@
/~~\ @
| |@
\__/ @
@@
/| @
| @
_|_@
@@
/~\@
,/@
/__@
@@
/~\@
<@
\_/@
@@
/| @
/_|_@
| @
@@
|~~@
`~\@
__/@
@@
/~~@
Y~\@
\_/@
@@
~~/@
/ @
/ @
@@
(~)@
/~\@
\_/@
@@
/~\@
`-/@
/ @
@@
$@
.@
.@
$@@
$@
.@
$@
/@@
/@
/ @
\ @
\@@
$ $@
---@
---@
$ $@@
\ @
\@
/@
/ @@
/~\@
_/@
! @
@@
$/~~\$@
| (|_|@
$\__ $@
$ $@@
/\ @
/__\ @
/ \@
@@
|~~\@
|--<@
|__/@
@@
/~~@
| @
\__@
@@
|~~\ @
| |@
|__/ @
@@
|~~@
|--@
|__@
@@
|~~@
|--@
| @
@@
/~~\@
| __@
\__/@
@@
| |@
|--|@
| |@
@@
~|~@
| @
_|_@
@@
~~|~@
| @
\_| @
@@
| /@
|( @
| \@
@@
| @
| @
|__@
@@
|\ /|@
| \/ |@
| |@
@@
|\ |@
| \ |@
| \|@
@@
/~~\ @
| |@
\__/ @
@@
|~~\@
|__/@
| @
@@
/~~\ @
| |@
\__X @
@@
|~~\@
|__/@
| \@
@@
/~~\@
`--.@
\__/@
@@
~~|~~@
| @
| @
@@
| |@
| |@
\_/ @
@@
| |@
\ / @
\/ @
@@
| | |@
| | |@
\/ \/ @
@@
\ /@
X @
/ \@
@@
\ /@
\ / @
| @
@@
~~/@
/ @
/__@
@@
|~@
| @
| @
|_@@
\ @
\ @
\@
@@
~|@
|@
|@
_|@@
/\@
$$@
$$@
$$@@
$$@
$$@
__@
$$@@
\@
$@
$@
$@@
@
/~~|@
\__|@
@@
| @
|~~\@
|__/@
@@
@
/~~@
\__@
@@
|@
/~~|@
\__|@
@@
@
/~/@
\/_@
@@
/~\@
-|- @
| @
@@
@
/~~|@
\__|@
\__|@@
| @
|/~\ @
| |@
@@
'@
|@
|@
@@
'@
|@
|@
\__|@@
| @
|_/@
| \@
@@
|@
|@
|@
@@
@
|/~\ /~\ @
| | |@
@@
@
|/~\ @
| |@
@@
@
/~\@
\_/@
@@
@
|~~\@
|__/@
| @@
@
/~~| @
\__| @
|/@@
@
|/~\@
| @
@@
@
(~@
_)@
@@
| @
~|~@
| @
@@
@
| |@
\_/|@
@@
@
\ /@
\/ @
@@
@
\ /@
\/\/ @
@@
@
\/@
/\@
@@
@
\ /@
\/ @
_/ @@
@
~/@
/_@
@@
|~@
/ @
\ @
|_@@
|@
|@
|@
|@@
~| @
\@
/@
_| @@
@
_-_-@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@
@
@
@@
@@ -0,0 +1,6 @@
function _check_private_redeclaration(obj, privateCollection) {
if (privateCollection.has(obj)) {
throw new TypeError("Cannot initialize the same private elements twice on an object");
}
}
export { _check_private_redeclaration as _ };
@@ -0,0 +1,198 @@
"use strict";
var Buffer = require("safer-buffer").Buffer;
// Export Node.js internal encodings.
module.exports = {
// Encodings
utf8: { type: "_internal", bomAware: true},
cesu8: { type: "_internal", bomAware: true},
unicode11utf8: "utf8",
ucs2: { type: "_internal", bomAware: true},
utf16le: "ucs2",
binary: { type: "_internal" },
base64: { type: "_internal" },
hex: { type: "_internal" },
// Codec.
_internal: InternalCodec,
};
//------------------------------------------------------------------------------
function InternalCodec(codecOptions, iconv) {
this.enc = codecOptions.encodingName;
this.bomAware = codecOptions.bomAware;
if (this.enc === "base64")
this.encoder = InternalEncoderBase64;
else if (this.enc === "cesu8") {
this.enc = "utf8"; // Use utf8 for decoding.
this.encoder = InternalEncoderCesu8;
// Add decoder for versions of Node not supporting CESU-8
if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') {
this.decoder = InternalDecoderCesu8;
this.defaultCharUnicode = iconv.defaultCharUnicode;
}
}
}
InternalCodec.prototype.encoder = InternalEncoder;
InternalCodec.prototype.decoder = InternalDecoder;
//------------------------------------------------------------------------------
// We use node.js internal decoder. Its signature is the same as ours.
var StringDecoder = require('string_decoder').StringDecoder;
if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.
StringDecoder.prototype.end = function() {};
function InternalDecoder(options, codec) {
this.decoder = new StringDecoder(codec.enc);
}
InternalDecoder.prototype.write = function(buf) {
if (!Buffer.isBuffer(buf)) {
buf = Buffer.from(buf);
}
return this.decoder.write(buf);
}
InternalDecoder.prototype.end = function() {
return this.decoder.end();
}
//------------------------------------------------------------------------------
// Encoder is mostly trivial
function InternalEncoder(options, codec) {
this.enc = codec.enc;
}
InternalEncoder.prototype.write = function(str) {
return Buffer.from(str, this.enc);
}
InternalEncoder.prototype.end = function() {
}
//------------------------------------------------------------------------------
// Except base64 encoder, which must keep its state.
function InternalEncoderBase64(options, codec) {
this.prevStr = '';
}
InternalEncoderBase64.prototype.write = function(str) {
str = this.prevStr + str;
var completeQuads = str.length - (str.length % 4);
this.prevStr = str.slice(completeQuads);
str = str.slice(0, completeQuads);
return Buffer.from(str, "base64");
}
InternalEncoderBase64.prototype.end = function() {
return Buffer.from(this.prevStr, "base64");
}
//------------------------------------------------------------------------------
// CESU-8 encoder is also special.
function InternalEncoderCesu8(options, codec) {
}
InternalEncoderCesu8.prototype.write = function(str) {
var buf = Buffer.alloc(str.length * 3), bufIdx = 0;
for (var i = 0; i < str.length; i++) {
var charCode = str.charCodeAt(i);
// Naive implementation, but it works because CESU-8 is especially easy
// to convert from UTF-16 (which all JS strings are encoded in).
if (charCode < 0x80)
buf[bufIdx++] = charCode;
else if (charCode < 0x800) {
buf[bufIdx++] = 0xC0 + (charCode >>> 6);
buf[bufIdx++] = 0x80 + (charCode & 0x3f);
}
else { // charCode will always be < 0x10000 in javascript.
buf[bufIdx++] = 0xE0 + (charCode >>> 12);
buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f);
buf[bufIdx++] = 0x80 + (charCode & 0x3f);
}
}
return buf.slice(0, bufIdx);
}
InternalEncoderCesu8.prototype.end = function() {
}
//------------------------------------------------------------------------------
// CESU-8 decoder is not implemented in Node v4.0+
function InternalDecoderCesu8(options, codec) {
this.acc = 0;
this.contBytes = 0;
this.accBytes = 0;
this.defaultCharUnicode = codec.defaultCharUnicode;
}
InternalDecoderCesu8.prototype.write = function(buf) {
var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes,
res = '';
for (var i = 0; i < buf.length; i++) {
var curByte = buf[i];
if ((curByte & 0xC0) !== 0x80) { // Leading byte
if (contBytes > 0) { // Previous code is invalid
res += this.defaultCharUnicode;
contBytes = 0;
}
if (curByte < 0x80) { // Single-byte code
res += String.fromCharCode(curByte);
} else if (curByte < 0xE0) { // Two-byte code
acc = curByte & 0x1F;
contBytes = 1; accBytes = 1;
} else if (curByte < 0xF0) { // Three-byte code
acc = curByte & 0x0F;
contBytes = 2; accBytes = 1;
} else { // Four or more are not supported for CESU-8.
res += this.defaultCharUnicode;
}
} else { // Continuation byte
if (contBytes > 0) { // We're waiting for it.
acc = (acc << 6) | (curByte & 0x3f);
contBytes--; accBytes++;
if (contBytes === 0) {
// Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80)
if (accBytes === 2 && acc < 0x80 && acc > 0)
res += this.defaultCharUnicode;
else if (accBytes === 3 && acc < 0x800)
res += this.defaultCharUnicode;
else
// Actually add character.
res += String.fromCharCode(acc);
}
} else { // Unexpected continuation byte
res += this.defaultCharUnicode;
}
}
}
this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes;
return res;
}
InternalDecoderCesu8.prototype.end = function() {
var res = 0;
if (this.contBytes > 0)
res += this.defaultCharUnicode;
return res;
}
@@ -0,0 +1,20 @@
import { Line, BlockMarkers, Markers } from '../../primitives.js';
import { Tokenizer } from './index.js';
/**
* Walks over provided lines joining description token into a single string.
* */
export type Joiner = (lines: Line[], markers?: BlockMarkers) => string;
/**
* Shortcut for standard Joiners
* compact - strip surrounding whitespace and concat lines using a single string
* preserve - preserves original whitespace and line breaks as is
*/
export type Spacing = 'compact' | 'preserve' | Joiner;
/**
* Makes no changes to `spec.lines[].tokens` but joins them into `spec.description`
* following given spacing srtategy
* @param {Spacing} spacing tells how to handle the whitespace
* @param {BlockMarkers} markers tells how to handle comment block delimitation
*/
export default function descriptionTokenizer(spacing?: Spacing, markers?: typeof Markers): Tokenizer;
export declare function getJoiner(spacing: Spacing): Joiner;
@@ -0,0 +1,278 @@
import fs from 'node:fs';
import path from 'node:path';
import { minimatch } from 'minimatch';
import { createRule, moduleVisitor, resolve, pkgUp, importType, getFilePackageName, getNpmInstallCommand, } from '../utils/index.js';
const depFieldCache = new Map();
function hasKeys(obj = {}) {
return Object.keys(obj).length > 0;
}
function arrayOrKeys(arrayOrObject) {
return Array.isArray(arrayOrObject)
? arrayOrObject
: Object.keys(arrayOrObject);
}
function readJSON(jsonPath, throwException) {
try {
return JSON.parse(fs.readFileSync(jsonPath, 'utf8'));
}
catch (error) {
if (throwException) {
throw error;
}
}
}
function extractDepFields(pkg) {
return {
dependencies: pkg.dependencies || {},
devDependencies: pkg.devDependencies || {},
optionalDependencies: pkg.optionalDependencies || {},
peerDependencies: pkg.peerDependencies || {},
bundledDependencies: arrayOrKeys(pkg.bundleDependencies || pkg.bundledDependencies || []),
};
}
function getPackageDepFields(packageJsonPath, throwAtRead) {
if (!depFieldCache.has(packageJsonPath)) {
const packageJson = readJSON(packageJsonPath, throwAtRead);
if (packageJson) {
const depFields = extractDepFields(packageJson);
depFieldCache.set(packageJsonPath, depFields);
}
}
return depFieldCache.get(packageJsonPath);
}
function getDependencies(context, packageDir) {
let paths = [];
try {
let packageContent = {
dependencies: {},
devDependencies: {},
optionalDependencies: {},
peerDependencies: {},
bundledDependencies: [],
};
if (packageDir && packageDir.length > 0) {
paths = Array.isArray(packageDir)
? packageDir.map(dir => path.resolve(dir))
: [path.resolve(packageDir)];
}
if (paths.length > 0) {
for (const dir of paths) {
const packageJsonPath = path.resolve(dir, 'package.json');
const packageContent_ = getPackageDepFields(packageJsonPath, paths.length === 1);
if (packageContent_) {
for (const depsKey of Object.keys(packageContent)) {
const key = depsKey;
Object.assign(packageContent[key], packageContent_[key]);
}
}
}
}
else {
const packageJsonPath = pkgUp({
cwd: context.physicalFilename,
});
const packageContent_ = getPackageDepFields(packageJsonPath, false);
if (packageContent_) {
packageContent = packageContent_;
}
}
if (![
packageContent.dependencies,
packageContent.devDependencies,
packageContent.optionalDependencies,
packageContent.peerDependencies,
packageContent.bundledDependencies,
].some(hasKeys)) {
return;
}
return packageContent;
}
catch (error_) {
const error = error_;
if (paths.length > 0 && error.code === 'ENOENT') {
context.report({
messageId: 'pkgNotFound',
loc: { line: 0, column: 0 },
});
}
if (error.name === 'JSONError' || error instanceof SyntaxError) {
context.report({
messageId: 'pkgUnparsable',
data: { error: error.message },
loc: { line: 0, column: 0 },
});
}
}
}
function getModuleOriginalName(name) {
const [first, second] = name.split('/');
return first.startsWith('@') ? `${first}/${second}` : first;
}
function checkDependencyDeclaration(deps, packageName, declarationStatus) {
const newDeclarationStatus = declarationStatus || {
isInDeps: false,
isInDevDeps: false,
isInOptDeps: false,
isInPeerDeps: false,
isInBundledDeps: false,
};
const packageHierarchy = [];
const packageNameParts = packageName ? packageName.split('/') : [];
for (const [index, namePart] of packageNameParts.entries()) {
if (!namePart.startsWith('@')) {
const ancestor = packageNameParts.slice(0, index + 1).join('/');
packageHierarchy.push(ancestor);
}
}
return packageHierarchy.reduce((result, ancestorName) => ({
isInDeps: result.isInDeps || deps.dependencies[ancestorName] !== undefined,
isInDevDeps: result.isInDevDeps || deps.devDependencies[ancestorName] !== undefined,
isInOptDeps: result.isInOptDeps ||
deps.optionalDependencies[ancestorName] !== undefined,
isInPeerDeps: result.isInPeerDeps ||
deps.peerDependencies[ancestorName] !== undefined,
isInBundledDeps: result.isInBundledDeps ||
deps.bundledDependencies.includes(ancestorName),
}), newDeclarationStatus);
}
function reportIfMissing(context, deps, depsOptions, node, name, whitelist) {
if (!depsOptions.verifyTypeImports &&
(('importKind' in node &&
(node.importKind === 'type' ||
node.importKind === 'typeof')) ||
('exportKind' in node && node.exportKind === 'type') ||
('specifiers' in node &&
Array.isArray(node.specifiers) &&
node.specifiers.length > 0 &&
node.specifiers.every(specifier => 'importKind' in specifier &&
(specifier.importKind === 'type' ||
specifier.importKind === 'typeof'))))) {
return;
}
const typeOfImport = importType(name, context);
if (typeOfImport !== 'external' &&
(typeOfImport !== 'internal' || !depsOptions.verifyInternalDeps)) {
return;
}
const resolved = resolve(name, context);
if (!resolved) {
return;
}
const importPackageName = getModuleOriginalName(name);
let declarationStatus = checkDependencyDeclaration(deps, importPackageName);
if (declarationStatus.isInDeps ||
(depsOptions.allowDevDeps && declarationStatus.isInDevDeps) ||
(depsOptions.allowPeerDeps && declarationStatus.isInPeerDeps) ||
(depsOptions.allowOptDeps && declarationStatus.isInOptDeps) ||
(depsOptions.allowBundledDeps && declarationStatus.isInBundledDeps)) {
return;
}
const realPackageName = getFilePackageName(resolved);
if (realPackageName && realPackageName !== importPackageName) {
declarationStatus = checkDependencyDeclaration(deps, realPackageName, declarationStatus);
if (declarationStatus.isInDeps ||
(depsOptions.allowDevDeps && declarationStatus.isInDevDeps) ||
(depsOptions.allowPeerDeps && declarationStatus.isInPeerDeps) ||
(depsOptions.allowOptDeps && declarationStatus.isInOptDeps) ||
(depsOptions.allowBundledDeps && declarationStatus.isInBundledDeps)) {
return;
}
}
const packageName = realPackageName || importPackageName;
if (whitelist?.has(packageName)) {
return;
}
if (declarationStatus.isInDevDeps && !depsOptions.allowDevDeps) {
context.report({
node,
messageId: 'devDep',
data: {
packageName,
},
});
return;
}
if (declarationStatus.isInOptDeps && !depsOptions.allowOptDeps) {
context.report({
node,
messageId: 'optDep',
data: {
packageName,
},
});
return;
}
context.report({
node,
messageId: 'missing',
data: {
packageName,
},
});
}
function testConfig(config, context) {
if (typeof config === 'boolean' || config === undefined) {
return config;
}
const filename = context.physicalFilename;
return config.some(c => minimatch(filename, c) ||
minimatch(filename, path.resolve(context.cwd, c), {
windowsPathsNoEscape: true,
}) ||
minimatch(filename, path.resolve(c), { windowsPathsNoEscape: true }));
}
export default createRule({
name: 'no-extraneous-dependencies',
meta: {
type: 'problem',
docs: {
category: 'Helpful warnings',
description: 'Forbid the use of extraneous packages.',
},
schema: [
{
type: 'object',
properties: {
devDependencies: { type: ['boolean', 'array'] },
optionalDependencies: { type: ['boolean', 'array'] },
peerDependencies: { type: ['boolean', 'array'] },
bundledDependencies: { type: ['boolean', 'array'] },
packageDir: { type: ['string', 'array'] },
includeInternal: { type: ['boolean'] },
includeTypes: { type: ['boolean'] },
whitelist: { type: ['array'] },
},
additionalProperties: false,
},
],
messages: {
pkgNotFound: 'The package.json file could not be found.',
pkgUnparsable: 'The package.json file could not be parsed: {{error}}',
devDep: "'{{packageName}}' should be listed in the project's dependencies, not devDependencies.",
optDep: "'{{packageName}}' should be listed in the project's dependencies, not optionalDependencies.",
missing: `'{{packageName}}' should be listed in the project's dependencies. Run '${getNpmInstallCommand('{{packageName}}')}' to add it`,
},
},
defaultOptions: [],
create(context) {
const options = context.options[0] || {};
const deps = getDependencies(context, options.packageDir) || extractDepFields({});
const depsOptions = {
allowDevDeps: testConfig(options.devDependencies, context) !== false,
allowOptDeps: testConfig(options.optionalDependencies, context) !== false,
allowPeerDeps: testConfig(options.peerDependencies, context) !== false,
allowBundledDeps: testConfig(options.bundledDependencies, context) !== false,
verifyInternalDeps: !!options.includeInternal,
verifyTypeImports: !!options.includeTypes,
};
return {
...moduleVisitor((source, node) => {
reportIfMissing(context, deps, depsOptions, node, source.value, options.whitelist ? new Set(options.whitelist) : undefined);
}, { commonjs: true }),
'Program:exit'() {
depFieldCache.clear();
},
};
},
});
//# sourceMappingURL=no-extraneous-dependencies.js.map
@@ -0,0 +1 @@
{"version":3,"file":"injectFromHierarchy.spec.d.ts","sourceRoot":"","sources":["../../../../src/metadata/decorators/injectFromHierarchy.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
{
"name": "@eslint/plugin-kit",
"version": "0.4.1",
"description": "Utilities for building ESLint plugins.",
"author": "Nicholas C. Zakas",
"type": "module",
"main": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"exports": {
"require": {
"types": "./dist/cjs/index.d.cts",
"default": "./dist/cjs/index.cjs"
},
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
}
},
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eslint/rewrite.git",
"directory": "packages/plugin-kit"
},
"bugs": {
"url": "https://github.com/eslint/rewrite/issues"
},
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/plugin-kit#readme",
"scripts": {
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
"pretest": "npm run build",
"test": "mocha \"tests/**/*.test.js\"",
"test:coverage": "c8 npm test",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:types": "tsc -p tests/types/tsconfig.json"
},
"keywords": [
"eslint",
"eslintplugin",
"eslint-plugin"
],
"license": "Apache-2.0",
"dependencies": {
"@eslint/core": "^0.17.0",
"levn": "^0.4.1"
},
"devDependencies": {
"@types/levn": "^0.4.0",
"rollup-plugin-copy": "^3.5.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
}
@@ -0,0 +1,50 @@
"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 });
exports.NullThrowsReasons = exports.nullThrows = exports.isObjectNotArray = exports.getParserServices = exports.deepMerge = exports.applyDefault = void 0;
const utils_1 = require("@typescript-eslint/utils");
__exportStar(require("./astUtils"), exports);
__exportStar(require("./collectUnusedVariables"), exports);
__exportStar(require("./createRule"), exports);
__exportStar(require("./getFixOrSuggest"), exports);
__exportStar(require("./getFunctionHeadLoc"), exports);
__exportStar(require("./getOperatorPrecedence"), exports);
__exportStar(require("./getStaticStringValue"), exports);
__exportStar(require("./getStringLength"), exports);
__exportStar(require("./getTextWithParentheses"), exports);
__exportStar(require("./getThisExpression"), exports);
__exportStar(require("./getWrappingFixer"), exports);
__exportStar(require("./hasOverloadSignatures"), exports);
__exportStar(require("./isArrayMethodCallWithPredicate"), exports);
__exportStar(require("./isAssignee"), exports);
__exportStar(require("./isNodeEqual"), exports);
__exportStar(require("./isNullLiteral"), exports);
__exportStar(require("./isStartOfExpressionStatement"), exports);
__exportStar(require("./isUndefinedIdentifier"), exports);
__exportStar(require("./misc"), exports);
__exportStar(require("./needsPrecedingSemiColon"), exports);
__exportStar(require("./objectIterators"), exports);
__exportStar(require("./needsToBeAwaited"), exports);
__exportStar(require("./scopeUtils"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./getConstraintInfo"), exports);
__exportStar(require("./getValueOfLiteralType"), exports);
__exportStar(require("./isHigherPrecedenceThanAwait"), exports);
__exportStar(require("./skipChainExpression"), exports);
__exportStar(require("./truthinessUtils"), exports);
// this is done for convenience - saves migrating all of the old rules
__exportStar(require("@typescript-eslint/type-utils"), exports);
exports.applyDefault = utils_1.ESLintUtils.applyDefault, exports.deepMerge = utils_1.ESLintUtils.deepMerge, exports.getParserServices = utils_1.ESLintUtils.getParserServices, exports.isObjectNotArray = utils_1.ESLintUtils.isObjectNotArray, exports.nullThrows = utils_1.ESLintUtils.nullThrows, exports.NullThrowsReasons = utils_1.ESLintUtils.NullThrowsReasons;
@@ -0,0 +1,6 @@
# caniuse-lite
A smaller version of caniuse-db, with only the essentials!
## Docs
Read full docs **[here](https://github.com/browserslist/caniuse-lite#readme)**.
@@ -0,0 +1,268 @@
# Porting to the Buffer.from/Buffer.alloc API
<a id="overview"></a>
## Overview
- [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*)
- [Variant 2: Use a polyfill](#variant-2)
- [Variant 3: manual detection, with safeguards](#variant-3)
### Finding problematic bits of code using grep
Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`.
It will find all the potentially unsafe places in your own code (with some considerably unlikely
exceptions).
### Finding problematic bits of code using Node.js 8
If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code:
- `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js.
- `--trace-deprecation` does the same thing, but only for deprecation warnings.
- `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8.
You can set these flags using an environment variable:
```console
$ export NODE_OPTIONS='--trace-warnings --pending-deprecation'
$ cat example.js
'use strict';
const foo = new Buffer('foo');
$ node example.js
(node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead.
at showFlaggedDeprecation (buffer.js:127:13)
at new Buffer (buffer.js:148:3)
at Object.<anonymous> (/path/to/example.js:2:13)
[... more stack trace lines ...]
```
### Finding problematic bits of code using linters
Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor)
or
[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md)
also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets.
There is a drawback, though, that it doesn't always
[work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is
overriden e.g. with a polyfill, so recommended is a combination of this and some other method
described above.
<a id="variant-1"></a>
## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.
This is the recommended solution nowadays that would imply only minimal overhead.
The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible.
What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way:
- For `new Buffer(number)`, replace it with `Buffer.alloc(number)`.
- For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`).
- For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`.
Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than
`new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling.
Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor)
or
[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md)
is recommended to avoid accidential unsafe Buffer API usage.
There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005)
for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`.
Note that it currently only works with cases where the arguments are literals or where the
constructor is invoked with two arguments.
_If you currently support those older Node.js versions and dropping them would be a semver-major change
for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2)
or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive
the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and
your users will not observe a runtime deprecation warning when running your code on Node.js 10._
<a id="variant-2"></a>
## Variant 2: Use a polyfill
Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older
Node.js versions.
You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill
`const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api.
Make sure that you do not use old `new Buffer` API — in any files where the line above is added,
using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though.
Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or
[buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) —
those are great, the only downsides being 4 deps in the tree and slightly more code changes to
migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only
`Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies.
_Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also
provides a polyfill, but takes a different approach which has
[it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you
to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as
it is problematic, can cause issues in your code, and will start emitting runtime deprecation
warnings starting with Node.js 10._
Note that in either case, it is important that you also remove all calls to the old Buffer
API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides
a polyfill for the new API. I have seen people doing that mistake.
Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor)
or
[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md)
is recommended.
_Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._
<a id="variant-3"></a>
## Variant 3 — manual detection, with safeguards
This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own
wrapper around them.
### Buffer(0)
This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which
returns the same result all the way down to Node.js 0.8.x.
### Buffer(notNumber)
Before:
```js
var buf = new Buffer(notNumber, encoding);
```
After:
```js
var buf;
if (Buffer.from && Buffer.from !== Uint8Array.from) {
buf = Buffer.from(notNumber, encoding);
} else {
if (typeof notNumber === 'number')
throw new Error('The "size" argument must be of type number.');
buf = new Buffer(notNumber, encoding);
}
```
`encoding` is optional.
Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not
hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the
Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous
security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create
problems ranging from DoS to leaking sensitive information to the attacker from the process memory.
When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can
be omitted.
Also note that using TypeScript does not fix this problem for you — when libs written in
`TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as
all type checks are translation-time only and are not present in the actual JS code which TS
compiles to.
### Buffer(number)
For Node.js 0.10.x (and below) support:
```js
var buf;
if (Buffer.alloc) {
buf = Buffer.alloc(number);
} else {
buf = new Buffer(number);
buf.fill(0);
}
```
Otherwise (Node.js ≥ 0.12.x):
```js
const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0);
```
## Regarding Buffer.allocUnsafe
Be extra cautious when using `Buffer.allocUnsafe`:
* Don't use it if you don't have a good reason to
* e.g. you probably won't ever see a performance difference for small buffers, in fact, those
might be even faster with `Buffer.alloc()`,
* if your code is not in the hot code path — you also probably won't notice a difference,
* keep in mind that zero-filling minimizes the potential risks.
* If you use it, make sure that you never return the buffer in a partially-filled state,
* if you are writing to it sequentially — always truncate it to the actuall written length
Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues,
ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs)
leaking to the remote attacker.
_Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js
version (and lacking type checks also adds DoS to the list of potential problems)._
<a id="faq"></a>
## FAQ
<a id="design-flaws"></a>
### What is wrong with the `Buffer` constructor?
The `Buffer` constructor could be used to create a buffer in many different ways:
- `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained
*arbitrary memory* for performance reasons, which could include anything ranging from
program source code to passwords and encryption keys.
- `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of
the string `'abc'`. A second argument could specify another encoding: For example,
`new Buffer(string, 'base64')` could be used to convert a Base64 string into the original
sequence of bytes that it represents.
- There are several other combinations of arguments.
This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell
what exactly the contents of the generated buffer are* without knowing the type of `foo`.
Sometimes, the value of `foo` comes from an external source. For example, this function
could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form:
```
function stringToBase64(req, res) {
// The request body should have the format of `{ string: 'foobar' }`
const rawBytes = new Buffer(req.body.string)
const encoded = rawBytes.toString('base64')
res.end({ encoded: encoded })
}
```
Note that this code does *not* validate the type of `req.body.string`:
- `req.body.string` is expected to be a string. If this is the case, all goes well.
- `req.body.string` is controlled by the client that sends the request.
- If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes:
- Before Node.js 8, the content would be uninitialized
- After Node.js 8, the content would be `50` bytes with the value `0`
Because of the missing type check, an attacker could intentionally send a number
as part of the request. Using this, they can either:
- Read uninitialized memory. This **will** leak passwords, encryption keys and other
kinds of sensitive information. (Information leak)
- Force the program to allocate a large amount of memory. For example, when specifying
`500000000` as the input value, each request will allocate 500MB of memory.
This can be used to either exhaust the memory available of a program completely
and make it crash, or slow it down significantly. (Denial of Service)
Both of these scenarios are considered serious security issues in a real-world
web server context.
when using `Buffer.from(req.body.string)` instead, passing a number will always
throw an exception instead, giving a controlled behaviour that can always be
handled by the program.
<a id="ecosystem-usage"></a>
### The `Buffer()` constructor has been deprecated for a while. Is this really an issue?
Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still
widely used. This includes new code, and overall usage of such code has actually been
*increasing*.
@@ -0,0 +1,25 @@
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export function isScrollable(node: Element | null, checkForOverflow?: boolean): boolean {
if (!node) {
return false;
}
let style = window.getComputedStyle(node);
let isScrollable = /(auto|scroll)/.test(style.overflow + style.overflowX + style.overflowY);
if (isScrollable && checkForOverflow) {
isScrollable = node.scrollHeight !== node.clientHeight || node.scrollWidth !== node.clientWidth;
}
return isScrollable;
}
@@ -0,0 +1,114 @@
### Changelog
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### [v1.1.0](https://github.com/ljharb/internal-slot/compare/v1.0.7...v1.1.0)
> 13 December 2024
- [New] add types [`295d25d`](https://github.com/ljharb/internal-slot/commit/295d25d55cfcb6ba1dd2520b36f4270c5a613c09)
- [actions] split out node 10-20, and 20+ [`9c9a2ab`](https://github.com/ljharb/internal-slot/commit/9c9a2ab345f0cb6d202cc92297060889e9ed5e06)
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `tape` [`9c5621b`](https://github.com/ljharb/internal-slot/commit/9c5621bc88dd9fcf20e2347a7c26af7fdcd509a2)
- [Deps] update `hasown`, `side-channel` [`5281391`](https://github.com/ljharb/internal-slot/commit/52813911eb534cda56e414810b6e2bfe85fa340c)
- [Tests] replace `aud` with `npm audit` [`64ce191`](https://github.com/ljharb/internal-slot/commit/64ce191a0603f10017854cb7dc5629da2b5fca6b)
- [Dev Deps] add missing peer dep [`d500343`](https://github.com/ljharb/internal-slot/commit/d5003432d47d7d5dced1c5c5f3543a4f1b65bb1f)
#### [v1.0.7](https://github.com/ljharb/internal-slot/compare/v1.0.6...v1.0.7)
> 5 February 2024
- [Dev Deps] update `aud`, `npmignore`, `tape` [`89c88c1`](https://github.com/ljharb/internal-slot/commit/89c88c1ed8de7c681fd3cec7bb2f045db0268d84)
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b437631`](https://github.com/ljharb/internal-slot/commit/b4376312d4a5d7bc99fb383cae3f15bd2f3d36d1)
#### [v1.0.6](https://github.com/ljharb/internal-slot/compare/v1.0.5...v1.0.6)
> 20 October 2023
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`4d568d2`](https://github.com/ljharb/internal-slot/commit/4d568d2897a2efe9b0604ae240bc89787924070f)
- [Refactor] use `hasown` instead of `has` [`f946e94`](https://github.com/ljharb/internal-slot/commit/f946e94885f5fa092a4de04f366d746c0c5a2f2f)
- [Deps] update `get-intrinsic` [`1bbc885`](https://github.com/ljharb/internal-slot/commit/1bbc885b0225dadac6e50f421cda5814c242b0bb)
- [meta] remove unused `.eslintignore` [`6fdde1a`](https://github.com/ljharb/internal-slot/commit/6fdde1a25348cf9fc41c9808d342e6502f37658d)
#### [v1.0.5](https://github.com/ljharb/internal-slot/compare/v1.0.4...v1.0.5)
> 9 February 2023
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`e427703`](https://github.com/ljharb/internal-slot/commit/e427703bfc669c590a863ec77ecd3789d7b7c458)
- [Deps] update `get-intrinsic` [`aa652f0`](https://github.com/ljharb/internal-slot/commit/aa652f05c5c15b4ed1a118be60f0565e47bd7208)
- [Fix] improve assertion message [`8df86e3`](https://github.com/ljharb/internal-slot/commit/8df86e3ea21786b5eb7654f22202665c8b63accf)
#### [v1.0.4](https://github.com/ljharb/internal-slot/compare/v1.0.3...v1.0.4)
> 13 December 2022
- [actions] reuse common workflows [`82a1aee`](https://github.com/ljharb/internal-slot/commit/82a1aee603bce8627930597edb3a04b4970ed151)
- [meta] use `npmignore` to autogenerate an npmignore file [`56f7e71`](https://github.com/ljharb/internal-slot/commit/56f7e7182dd934dd6c1b80497a110670d02a91b9)
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`e25ff67`](https://github.com/ljharb/internal-slot/commit/e25ff67d568f77c1b66168957d82b080779e1c0a)
- [actions] update rebase action to use reusable workflow [`227e81e`](https://github.com/ljharb/internal-slot/commit/227e81eaef7230a265103ef1ef0618d2920c3f30)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `foreach`, `object-inspect`, `tape` [`fc9f319`](https://github.com/ljharb/internal-slot/commit/fc9f319d136ddf2e79910390d1e7ad279d41cc01)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest`, `tape` [`0a72a0f`](https://github.com/ljharb/internal-slot/commit/0a72a0f389511b41645f441da19257a266cb37f7)
- [actions] update codecov uploader [`e2b993f`](https://github.com/ljharb/internal-slot/commit/e2b993f143278a30424ebd5526019e59828989d0)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`8f0ab80`](https://github.com/ljharb/internal-slot/commit/8f0ab808afdd458001c35c828962dc714d824754)
- [actions] update checkout action [`8da4b91`](https://github.com/ljharb/internal-slot/commit/8da4b91c3454671da2e53a831ca0928147965a09)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@safe-publish-latest`, `tape` [`7ab37aa`](https://github.com/ljharb/internal-slot/commit/7ab37aabf01ded2605fa583a9866b62172f82e30)
- [readme] add github actions/codecov badges [`71234be`](https://github.com/ljharb/internal-slot/commit/71234bef4ef99e2f17d72ae3a1b7c0522519b7d7)
- [Fix] `assert`: throw on a nonexistent slot even when an object already has other slots [`12580bd`](https://github.com/ljharb/internal-slot/commit/12580bd26fe9f8603566e9e076092b5e1fb7340b)
- [Tests] use `for-each` instead of `foreach` [`7229df0`](https://github.com/ljharb/internal-slot/commit/7229df01666ccb022dde82686d84b97b7bcfc53a)
- [meta] use `prepublishOnly` script for npm 7+ [`8728872`](https://github.com/ljharb/internal-slot/commit/8728872cfbd735d3ae87e885c081a08d5b26edf0)
- [Deps] update `get-intrinsic` [`1b7088f`](https://github.com/ljharb/internal-slot/commit/1b7088fa970c33757816b08357814bdbf6d722b6)
- [Deps] update `get-intrinsic` [`063621e`](https://github.com/ljharb/internal-slot/commit/063621ec99d1b9262d3898c0ecad0e1e98be5f75)
#### [v1.0.3](https://github.com/ljharb/internal-slot/compare/v1.0.2...v1.0.3)
> 26 January 2021
- [Tests] use shared travis-ci configs [`0ef2263`](https://github.com/ljharb/internal-slot/commit/0ef22634fa2269d9df0d784aca3c5748e8eabd3b)
- [Tests] migrate tests to Github Actions [`6253915`](https://github.com/ljharb/internal-slot/commit/6253915d28721df2eda5630849bc6b57647e3ee2)
- [meta] do not publish github action workflow files [`ef94e55`](https://github.com/ljharb/internal-slot/commit/ef94e555727ed6a649ef64010904fe89a468d459)
- [Tests] run `nyc` on all tests; use `tape` runner [`917d6ca`](https://github.com/ljharb/internal-slot/commit/917d6ca630cdcd6b4da9a2c300c6a3abb6e724fe)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`8dcb6fe`](https://github.com/ljharb/internal-slot/commit/8dcb6fe01d6a45e1af17a9dace95ca47c99b4328)
- [actions] add "Allow Edits" workflow [`7aa3e86`](https://github.com/ljharb/internal-slot/commit/7aa3e86edb0149fd882717481885760aeb28474e)
- [Refactor] use `get-intrinsic` instead of `es-abstract`; update `side-channel` [`11ad17d`](https://github.com/ljharb/internal-slot/commit/11ad17d4255adcbc55fd4eca0bf6733bac59f1bf)
- [readme] remove travis badge [`5b75452`](https://github.com/ljharb/internal-slot/commit/5b754523aa07e8f67d0135df75059a18047292bb)
- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`d531688`](https://github.com/ljharb/internal-slot/commit/d5316880956b4dd83e6b6c9ab48fdd8171a4a268)
- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`c76fa91`](https://github.com/ljharb/internal-slot/commit/c76fa91a7e623a738e22332bee4e985aea41122e)
- [Dev Deps] update `eslint`, `tape` [`e733ccd`](https://github.com/ljharb/internal-slot/commit/e733ccd68e81c72ef2e02726e001895053de7887)
- [Dev Deps] update `auto-changelog`; add `aud` [`df20bf5`](https://github.com/ljharb/internal-slot/commit/df20bf5d3943a533c20799d8cc1449997e85d53b)
- [meta] fix autochangelog [`e89e6f1`](https://github.com/ljharb/internal-slot/commit/e89e6f1ff9f10f386e6400b586db78ad9c0f1309)
- [Tests] only audit prod deps [`71317b9`](https://github.com/ljharb/internal-slot/commit/71317b95ec6bbd9877807da0c0316ee9f5f30fab)
- [Deps] update `es-abstract` [`c17ccf4`](https://github.com/ljharb/internal-slot/commit/c17ccf45f4cb0d3b7a1536e9cd3a7ff9a7dafd21)
- [Dev Deps] update `tape` [`d81ae03`](https://github.com/ljharb/internal-slot/commit/d81ae030a0e8f58cee00f752601ce60405a93d78)
- [Deps] update `es-abstract` [`b56303b`](https://github.com/ljharb/internal-slot/commit/b56303b4c3af7a510f9f51860895a46fd2e14752)
- [Deps] update `es-abstract` [`9996d1c`](https://github.com/ljharb/internal-slot/commit/9996d1cf3507750c7a6845a2fb0d0f849ea898a1)
#### [v1.0.2](https://github.com/ljharb/internal-slot/compare/v1.0.1...v1.0.2)
> 20 December 2019
- [Deps] update `es-abstract`, `side-channel` [`5c9df03`](https://github.com/ljharb/internal-slot/commit/5c9df03a25518f5c482cff4e1447a26fa071df9a)
- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`7820f98`](https://github.com/ljharb/internal-slot/commit/7820f984e523a64ddf3068c4e5631abf61eb1ea4)
#### [v1.0.1](https://github.com/ljharb/internal-slot/compare/v1.0.0...v1.0.1)
> 1 December 2019
- [Refactor] use `side-channel` package [`d38639f`](https://github.com/ljharb/internal-slot/commit/d38639f0a3cdb5090711179d0e78df857ecbd5d3)
- [actions] add automatic rebasing / merge commit blocking [`74267e6`](https://github.com/ljharb/internal-slot/commit/74267e6e591e18ba39186cb99139d3fd7a757c9f)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest` [`b042eef`](https://github.com/ljharb/internal-slot/commit/b042eefc067b830bbd370833f7f21754e802b0b2)
- [Deps] update `es-abstract` [`98cf4e8`](https://github.com/ljharb/internal-slot/commit/98cf4e86c1bfe99eda7b11a8ea70394368f33e4f)
#### v1.0.0
> 20 October 2019
- Tests [`b50fa41`](https://github.com/ljharb/internal-slot/commit/b50fa41b6f47aba39ac4cb733658580974a0b00a)
- implementation [`c5a59f3`](https://github.com/ljharb/internal-slot/commit/c5a59f3753677f81aa12a0226d3b1187846d06dd)
- Initial commit [`15ebe4d`](https://github.com/ljharb/internal-slot/commit/15ebe4dc6d46885f67969d64c9c3e705780963f8)
- readme [`382a3f5`](https://github.com/ljharb/internal-slot/commit/382a3f53d8975e6488373a0fc2abcdc7c4c44247)
- npm init [`d5e7c97`](https://github.com/ljharb/internal-slot/commit/d5e7c977ef694e89c245fd11165f63c06a7a5040)
- [meta] add FUNDING.yml [`685b608`](https://github.com/ljharb/internal-slot/commit/685b6087613f6735f4411a558500d92f8a3ec3f2)
- [meta] add `auto-changelog`, `safe-publish-latest` [`f8fdf1c`](https://github.com/ljharb/internal-slot/commit/f8fdf1c3f0c592f71746da6d7f8bea18f8946dda)
- [Tests] add `npm run lint` [`baaaa09`](https://github.com/ljharb/internal-slot/commit/baaaa09ab6e5bc5fcc0e7c76e10c55aa18f4ca7e)
- Only apps should have lockfiles [`dfa7efa`](https://github.com/ljharb/internal-slot/commit/dfa7efa3d5cd23261cb75c2adab6ee3c06790fee)
@@ -0,0 +1,235 @@
"use client";
// src/use-pagination.ts
import { objectToDeps } from "@heroui/shared-utils";
import { PaginationItemType } from "@heroui/use-pagination";
import { useEffect, useRef, useMemo } from "react";
import { mapPropsVariants, useProviderContext } from "@heroui/system";
import { usePagination as useBasePagination } from "@heroui/use-pagination";
import scrollIntoView from "scroll-into-view-if-needed";
import { pagination } from "@heroui/theme";
import { useDOMRef } from "@heroui/react-utils";
import { clsx, dataAttr } from "@heroui/shared-utils";
import { useIntersectionObserver } from "@heroui/use-intersection-observer";
var CURSOR_TRANSITION_TIMEOUT = 300;
function usePagination(originalProps) {
var _a, _b, _c, _d;
const globalContext = useProviderContext();
const [props, variantProps] = mapPropsVariants(originalProps, pagination.variantKeys);
const {
as,
ref,
classNames,
dotsJump = 5,
loop = false,
showControls = false,
total = 1,
initialPage = 1,
page,
siblings,
boundaries,
onChange,
className,
renderItem,
getItemAriaLabel: getItemAriaLabelProp,
...otherProps
} = props;
const Component = as || "nav";
const domRef = useDOMRef(ref);
const cursorRef = useRef(null);
const itemsRef = useRef();
const cursorTimer = useRef();
const disableAnimation = (_b = (_a = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
const disableCursorAnimation = (_d = (_c = originalProps == null ? void 0 : originalProps.disableCursorAnimation) != null ? _c : disableAnimation) != null ? _d : false;
function getItemsRefMap() {
if (!itemsRef.current) {
itemsRef.current = /* @__PURE__ */ new Map();
}
return itemsRef.current;
}
function getItemRef(node, value) {
const map = getItemsRefMap();
if (node) {
map.set(value, node);
} else {
map.delete(value);
}
}
function scrollTo(value, skipAnimation) {
const map = getItemsRefMap();
const node = map.get(value);
if (!node || !cursorRef.current) return;
cursorTimer.current && clearTimeout(cursorTimer.current);
scrollIntoView(node, {
scrollMode: "always",
behavior: "smooth",
block: "start",
inline: "start",
boundary: domRef.current
});
const { offsetLeft } = node;
if (skipAnimation) {
cursorRef.current.setAttribute("data-moving", "false");
cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
return;
}
cursorRef.current.setAttribute("data-moving", "true");
cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1.1)`;
cursorTimer.current = setTimeout(() => {
if (cursorRef.current) {
cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
}
cursorTimer.current = setTimeout(() => {
var _a2;
(_a2 = cursorRef.current) == null ? void 0 : _a2.setAttribute("data-moving", "false");
cursorTimer.current && clearTimeout(cursorTimer.current);
}, CURSOR_TRANSITION_TIMEOUT);
}, CURSOR_TRANSITION_TIMEOUT);
}
const { range, activePage, setPage, previous, next, first, last } = useBasePagination({
page,
total,
initialPage,
siblings,
boundaries,
showControls,
onChange
});
const [setRef, isVisible] = useIntersectionObserver();
useEffect(() => {
if (domRef.current) {
setRef(domRef.current);
}
}, [domRef.current]);
const activePageRef = useRef(activePage);
useEffect(() => {
if (activePage && !disableAnimation && isVisible) {
scrollTo(activePage, activePage === activePageRef.current);
}
activePageRef.current = activePage;
}, [
page,
activePage,
disableAnimation,
disableCursorAnimation,
isVisible,
originalProps.dotsJump,
originalProps.isCompact,
originalProps.showControls
]);
const slots = useMemo(
() => pagination({
...variantProps,
disableAnimation,
disableCursorAnimation
}),
[objectToDeps(variantProps), disableCursorAnimation, disableAnimation]
);
const baseStyles = clsx(classNames == null ? void 0 : classNames.base, className);
const onNext = () => {
if (loop && activePage === total) {
return first();
}
return next();
};
const onPrevious = () => {
if (loop && activePage === 1) {
return last();
}
return previous();
};
const getBaseProps = (props2 = {}) => {
return {
...props2,
ref: domRef,
role: "navigation",
"aria-label": props2["aria-label"] || "pagination navigation",
"data-slot": "base",
"data-controls": dataAttr(showControls),
"data-loop": dataAttr(loop),
"data-dots-jump": dotsJump,
"data-total": total,
"data-active-page": activePage,
className: slots.base({ class: clsx(baseStyles, props2 == null ? void 0 : props2.className) }),
...otherProps
};
};
const getWrapperProps = (props2 = {}) => {
return {
...props2,
"data-slot": "wrapper",
className: slots.wrapper({ class: clsx(classNames == null ? void 0 : classNames.wrapper, props2 == null ? void 0 : props2.className) })
};
};
const getItemAriaLabel = (page2) => {
if (!page2) return;
if (getItemAriaLabelProp) {
return getItemAriaLabelProp(page2);
}
switch (page2) {
case PaginationItemType.DOTS:
return "dots element";
case PaginationItemType.PREV:
return "previous page button";
case PaginationItemType.NEXT:
return "next page button";
case "first":
return "first page button";
case "last":
return "last page button";
default:
return `pagination item ${page2}`;
}
};
const getItemProps = (props2 = {}) => {
return {
...props2,
ref: (node) => getItemRef(node, props2.value),
"data-slot": "item",
isActive: props2.value === activePage,
className: slots.item({ class: clsx(classNames == null ? void 0 : classNames.item, props2 == null ? void 0 : props2.className) }),
onPress: () => {
if (props2.value !== activePage) {
setPage(props2.value);
}
}
};
};
const getCursorProps = (props2 = {}) => {
return {
...props2,
ref: cursorRef,
activePage,
"data-slot": "cursor",
className: slots.cursor({ class: clsx(classNames == null ? void 0 : classNames.cursor, props2 == null ? void 0 : props2.className) })
};
};
return {
Component,
showControls,
dotsJump,
slots,
classNames,
loop,
total,
range,
activePage,
getItemRef,
disableAnimation,
disableCursorAnimation,
setPage,
onPrevious,
onNext,
renderItem,
getBaseProps,
getWrapperProps,
getItemProps,
getCursorProps,
getItemAriaLabel
};
}
export {
CURSOR_TRANSITION_TIMEOUT,
usePagination
};
@@ -0,0 +1,97 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
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 });
exports.getNameLocationInGlobalDirectiveComment = getNameLocationInGlobalDirectiveComment;
exports.forEachReturnStatement = forEachReturnStatement;
const ts = __importStar(require("typescript"));
const escapeRegExp_1 = require("./escapeRegExp");
// deeply re-export, for convenience
__exportStar(require("@typescript-eslint/utils/ast-utils"), exports);
// The following is copied from `eslint`'s source code since it doesn't exist in eslint@5.
// https://github.com/eslint/eslint/blob/145aec1ab9052fbca96a44d04927c595951b1536/lib/rules/utils/ast-utils.js#L1751-L1779
// Could be export { getNameLocationInGlobalDirectiveComment } from 'eslint/lib/rules/utils/ast-utils'
/**
* Get the `loc` object of a given name in a `/*globals` comment directive.
* @param sourceCode The source code to convert index to loc.
* @param comment The `/*globals` comment directive which include the name.
* @param name The name to find.
* @returns The `loc` object.
*/
function getNameLocationInGlobalDirectiveComment(sourceCode, comment, name) {
const namePattern = new RegExp(`[\\s,]${(0, escapeRegExp_1.escapeRegExp)(name)}(?:$|[\\s,:])`, 'gu');
// To ignore the first text "global".
namePattern.lastIndex = comment.value.indexOf('global') + 6;
// Search a given variable name.
const match = namePattern.exec(comment.value);
// Convert the index to loc.
const start = sourceCode.getLocFromIndex(comment.range[0] + '/*'.length + (match ? match.index + 1 : 0));
const end = {
column: start.column + (match ? name.length : 1),
line: start.line,
};
return { end, start };
}
// Copied from typescript https://github.com/microsoft/TypeScript/blob/42b0e3c4630c129ca39ce0df9fff5f0d1b4dd348/src/compiler/utilities.ts#L1335
// Warning: This has the same semantics as the forEach family of functions,
// in that traversal terminates in the event that 'visitor' supplies a truthy value.
function forEachReturnStatement(body, visitor) {
return traverse(body);
function traverse(node) {
switch (node.kind) {
case ts.SyntaxKind.ReturnStatement:
return visitor(node);
case ts.SyntaxKind.CaseBlock:
case ts.SyntaxKind.Block:
case ts.SyntaxKind.IfStatement:
case ts.SyntaxKind.DoStatement:
case ts.SyntaxKind.WhileStatement:
case ts.SyntaxKind.ForStatement:
case ts.SyntaxKind.ForInStatement:
case ts.SyntaxKind.ForOfStatement:
case ts.SyntaxKind.WithStatement:
case ts.SyntaxKind.SwitchStatement:
case ts.SyntaxKind.CaseClause:
case ts.SyntaxKind.DefaultClause:
case ts.SyntaxKind.LabeledStatement:
case ts.SyntaxKind.TryStatement:
case ts.SyntaxKind.CatchClause:
return ts.forEachChild(node, traverse);
}
return undefined;
}
}
@@ -0,0 +1 @@
{"version":3,"file":"file-selector.umd.js","sources":["../../node_modules/tslib/tslib.es6.mjs","../es2015/file.js","../es2015/file-selector.js"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, Line truncated
@@ -0,0 +1,93 @@
/**
* @file 三次贝塞尔转二次贝塞尔
* @author mengke01(kekee000@gmail.com)
*
* references:
* https://github.com/search?utf8=%E2%9C%93&q=svg2ttf
* http://www.caffeineowl.com/graphics/2d/vectorial/cubic2quad01.html
*
*/
function toQuad(p1, c1, c2, p2) {
// Quad control point is (3*c2 - p2 + 3*c1 - p1)/4
const x = (3 * c2.x - p2.x + 3 * c1.x - p1.x) / 4;
const y = (3 * c2.y - p2.y + 3 * c1.y - p1.y) / 4;
return [
p1,
{x, y},
p2
];
}
/**
* 三次贝塞尔转二次贝塞尔
*
* @param {Object} p1 开始点
* @param {Object} c1 控制点1
* @param {Object} c2 控制点2
* @param {Object} p2 结束点
* @return {Array} 二次贝塞尔控制点
*/
export default function bezierCubic2Q2(p1, c1, c2, p2) {
// 判断极端情况,控制点和起止点一样
if (p1.x === c1.x && p1.y === c1.y && c2.x === p2.x && c2.y === p2.y) {
return [
[
p1,
{
x: (p1.x + p2.x) / 2,
y: (p1.y + p2.y) / 2
},
p2
]
];
}
const mx = p2.x - 3 * c2.x + 3 * c1.x - p1.x;
const my = p2.y - 3 * c2.y + 3 * c1.y - p1.y;
// control points near
if (mx * mx + my * my <= 4) {
return [
toQuad(p1, c1, c2, p2)
];
}
// Split to 2 qubic beziers by midpoints
// (p2 + 3*c2 + 3*c1 + p1)/8
const mp = {
x: (p2.x + 3 * c2.x + 3 * c1.x + p1.x) / 8,
y: (p2.y + 3 * c2.y + 3 * c1.y + p1.y) / 8
};
return [
toQuad(
p1,
{
x: (p1.x + c1.x) / 2,
y: (p1.y + c1.y) / 2
},
{
x: (p1.x + 2 * c1.x + c2.x) / 4,
y: (p1.y + 2 * c1.y + c2.y) / 4
},
mp
),
toQuad(
mp,
{
x: (p2.x + c1.x + 2 * c2.x) / 4,
y: (p2.y + c1.y + 2 * c2.y) / 4
},
{
x: (p2.x + c2.x) / 2,
y: (p2.y + c2.y) / 2
},
p2
)
];
}
@@ -0,0 +1,429 @@
/// <reference path="./locale/index.d.ts" />
export = dayjs;
declare function dayjs (date?: dayjs.ConfigType): dayjs.Dayjs
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, strict?: boolean): dayjs.Dayjs
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean): dayjs.Dayjs
declare namespace dayjs {
interface ConfigTypeMap {
default: string | number | Date | Dayjs | null | undefined
}
export type ConfigType = ConfigTypeMap[keyof ConfigTypeMap]
export interface FormatObject { locale?: string, format?: string, utc?: boolean }
export type OptionType = FormatObject | string | string[]
export type UnitTypeShort = 'd' | 'D' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'
export type UnitTypeLong = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date'
export type UnitTypeLongPlural = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' | 'dates'
export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort;
export type OpUnitType = UnitType | "week" | "weeks" | 'w';
export type QUnitType = UnitType | "quarter" | "quarters" | 'Q';
export type ManipulateType = Exclude<OpUnitType, 'date' | 'dates'>;
class Dayjs {
constructor (config?: ConfigType)
/**
* All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one.
* ```
* dayjs().clone()// => Dayjs
* dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it
* ```
* Docs: https://day.js.org/docs/en/parse/dayjs-clone
*/
clone(): Dayjs
/**
* This returns a `boolean` indicating whether the Day.js object contains a valid date or not.
* ```
* dayjs().isValid()// => boolean
* ```
* Docs: https://day.js.org/docs/en/parse/is-valid
*/
isValid(): boolean
/**
* Get the year.
* ```
* dayjs().year()// => 2020
* ```
* Docs: https://day.js.org/docs/en/get-set/year
*/
year(): number
/**
* Set the year.
* ```
* dayjs().year(2000)// => Dayjs
* ```
* Docs: https://day.js.org/docs/en/get-set/year
*/
year(value: number): Dayjs
/**
* Get the month.
*
* Months are zero indexed, so January is month 0.
* ```
* dayjs().month()// => 0-11
* ```
* Docs: https://day.js.org/docs/en/get-set/month
*/
month(): number
/**
* Set the month.
*
* Months are zero indexed, so January is month 0.
*
* Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the next year.
* ```
* dayjs().month(0)// => Dayjs
* ```
* Docs: https://day.js.org/docs/en/get-set/month
*/
month(value: number): Dayjs
/**
* Get the date of the month.
* ```
* dayjs().date()// => 1-31
* ```
* Docs: https://day.js.org/docs/en/get-set/date
*/
date(): number
/**
* Set the date of the month.
*
* Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the next months.
* ```
* dayjs().date(1)// => Dayjs
* ```
* Docs: https://day.js.org/docs/en/get-set/date
*/
date(value: number): Dayjs
/**
* Get the day of the week.
*
* Returns numbers from 0 (Sunday) to 6 (Saturday).
* ```
* dayjs().day()// 0-6
* ```
* Docs: https://day.js.org/docs/en/get-set/day
*/
day(): 0 | 1 | 2 | 3 | 4 | 5 | 6
/**
* Set the day of the week.
*
* Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to next weeks.
* ```
* dayjs().day(0)// => Dayjs
* ```
* Docs: https://day.js.org/docs/en/get-set/day
*/
day(value: number): Dayjs
/**
* Get the hour.
* ```
* dayjs().hour()// => 0-23
* ```
* Docs: https://day.js.org/docs/en/get-set/hour
*/
hour(): number
/**
* Set the hour.
*
* Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the next day.
* ```
* dayjs().hour(12)// => Dayjs
* ```
* Docs: https://day.js.org/docs/en/get-set/hour
*/
hour(value: number): Dayjs
/**
* Get the minutes.
* ```
* dayjs().minute()// => 0-59
* ```
* Docs: https://day.js.org/docs/en/get-set/minute
*/
minute(): number
/**
* Set the minutes.
*
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next hour.
* ```
* dayjs().minute(59)// => Dayjs
* ```
* Docs: https://day.js.org/docs/en/get-set/minute
*/
minute(value: number): Dayjs
/**
* Get the seconds.
* ```
* dayjs().second()// => 0-59
* ```
* Docs: https://day.js.org/docs/en/get-set/second
*/
second(): number
/**
* Set the seconds.
*
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next minutes.
* ```
* dayjs().second(1)// Dayjs
* ```
*/
second(value: number): Dayjs
/**
* Get the milliseconds.
* ```
* dayjs().millisecond()// => 0-999
* ```
* Docs: https://day.js.org/docs/en/get-set/millisecond
*/
millisecond(): number
/**
* Set the milliseconds.
*
* Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the next seconds.
* ```
* dayjs().millisecond(1)// => Dayjs
* ```
* Docs: https://day.js.org/docs/en/get-set/millisecond
*/
millisecond(value: number): Dayjs
/**
* Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes.
*
* In general:
* ```
* dayjs().set(unit, value) === dayjs()[unit](value)
* ```
* Units are case insensitive, and support plural and short forms.
* ```
* dayjs().set('date', 1)
* dayjs().set('month', 3) // April
* dayjs().set('second', 30)
* ```
* Docs: https://day.js.org/docs/en/get-set/set
*/
set(unit: UnitType, value: number): Dayjs
/**
* String getter, returns the corresponding information getting from Day.js object.
*
* In general:
* ```
* dayjs().get(unit) === dayjs()[unit]()
* ```
* Units are case insensitive, and support plural and short forms.
* ```
* dayjs().get('year')
* dayjs().get('month') // start 0
* dayjs().get('date')
* ```
* Docs: https://day.js.org/docs/en/get-set/get
*/
get(unit: UnitType): number
/**
* Returns a cloned Day.js object with a specified amount of time added.
* ```
* dayjs().add(7, 'day')// => Dayjs
* ```
* Units are case insensitive, and support plural and short forms.
*
* Docs: https://day.js.org/docs/en/manipulate/add
*/
add(value: number, unit?: ManipulateType): Dayjs
/**
* Returns a cloned Day.js object with a specified amount of time subtracted.
* ```
* dayjs().subtract(7, 'year')// => Dayjs
* ```
* Units are case insensitive, and support plural and short forms.
*
* Docs: https://day.js.org/docs/en/manipulate/subtract
*/
subtract(value: number, unit?: ManipulateType): Dayjs
/**
* Returns a cloned Day.js object and set it to the start of a unit of time.
* ```
* dayjs().startOf('year')// => Dayjs
* ```
* Units are case insensitive, and support plural and short forms.
*
* Docs: https://day.js.org/docs/en/manipulate/start-of
*/
startOf(unit: OpUnitType): Dayjs
/**
* Returns a cloned Day.js object and set it to the end of a unit of time.
* ```
* dayjs().endOf('month')// => Dayjs
* ```
* Units are case insensitive, and support plural and short forms.
*
* Docs: https://day.js.org/docs/en/manipulate/end-of
*/
endOf(unit: OpUnitType): Dayjs
/**
* Get the formatted date according to the string of tokens passed in.
*
* To escape characters, wrap them in square brackets (e.g. [MM]).
* ```
* dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00'
* dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z'
* dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
* ```
* Docs: https://day.js.org/docs/en/display/format
*/
format(template?: string): string
/**
* This indicates the difference between two date-time in the specified unit.
*
* To get the difference in milliseconds, use `dayjs#diff`
* ```
* const date1 = dayjs('2019-01-25')
* const date2 = dayjs('2018-06-05')
* date1.diff(date2) // 20214000000 default milliseconds
* date1.diff() // milliseconds to current time
* ```
*
* To get the difference in another unit of measurement, pass that measurement as the second argument.
* ```
* const date1 = dayjs('2019-01-25')
* date1.diff('2018-06-05', 'month') // 7
* ```
* Units are case insensitive, and support plural and short forms.
*
* Docs: https://day.js.org/docs/en/display/difference
*/
diff(date?: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number
/**
* This returns the number of **milliseconds** since the Unix Epoch of the Day.js object.
* ```
* dayjs('2019-01-25').valueOf() // 1548381600000
* +dayjs(1548381600000) // 1548381600000
* ```
* To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`.
*
* Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds
*/
valueOf(): number
/**
* This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object.
* ```
* dayjs('2019-01-25').unix() // 1548381600
* ```
* This value is floored to the nearest second, and does not include a milliseconds component.
*
* Docs: https://day.js.org/docs/en/display/unix-timestamp
*/
unix(): number
/**
* Get the number of days in the current month.
* ```
* dayjs('2019-01-25').daysInMonth() // 31
* ```
* Docs: https://day.js.org/docs/en/display/days-in-month
*/
daysInMonth(): number
/**
* To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`.
* ```
* dayjs('2019-01-25').toDate()// => Date
* ```
*/
toDate(): Date
/**
* To serialize as an ISO 8601 string.
* ```
* dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z'
* ```
* Docs: https://day.js.org/docs/en/display/as-json
*/
toJSON(): string
/**
* To format as an ISO 8601 string.
* ```
* dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z'
* ```
* Docs: https://day.js.org/docs/en/display/as-iso-string
*/
toISOString(): string
/**
* Returns a string representation of the date.
* ```
* dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT'
* ```
* Docs: https://day.js.org/docs/en/display/as-string
*/
toString(): string
/**
* Get the UTC offset in minutes.
* ```
* dayjs().utcOffset()
* ```
* Docs: https://day.js.org/docs/en/manipulate/utc-offset
*/
utcOffset(): number
/**
* This indicates whether the Day.js object is before the other supplied date-time.
* ```
* dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds
* ```
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
* ```
* dayjs().isBefore('2011-01-01', 'year')// => boolean
* ```
* Units are case insensitive, and support plural and short forms.
*
* Docs: https://day.js.org/docs/en/query/is-before
*/
isBefore(date?: ConfigType, unit?: OpUnitType): boolean
/**
* This indicates whether the Day.js object is the same as the other supplied date-time.
* ```
* dayjs().isSame(dayjs('2011-01-01')) // default milliseconds
* ```
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
* ```
* dayjs().isSame('2011-01-01', 'year')// => boolean
* ```
* Docs: https://day.js.org/docs/en/query/is-same
*/
isSame(date?: ConfigType, unit?: OpUnitType): boolean
/**
* This indicates whether the Day.js object is after the other supplied date-time.
* ```
* dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds
* ```
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
* ```
* dayjs().isAfter('2011-01-01', 'year')// => boolean
* ```
* Units are case insensitive, and support plural and short forms.
*
* Docs: https://day.js.org/docs/en/query/is-after
*/
isAfter(date?: ConfigType, unit?: OpUnitType): boolean
locale(): string
locale(preset: string | ILocale, object?: Partial<ILocale>): Dayjs
}
export type PluginFunc<T = unknown> = (option: T, c: typeof Dayjs, d: typeof dayjs) => void
export function extend<T = unknown>(plugin: PluginFunc<T>, option?: T): Dayjs
export function locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string
export function isDayjs(d: any): d is Dayjs
export function unix(t: number): Dayjs
const Ls : { [key: string] : ILocale }
}
@@ -0,0 +1,96 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createTester = require('./internal/createTester.js');
var _createTester2 = _interopRequireDefault(_createTester);
var _eachOf = require('./eachOf.js');
var _eachOf2 = _interopRequireDefault(_eachOf);
var _awaitify = require('./internal/awaitify.js');
var _awaitify2 = _interopRequireDefault(_awaitify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns the first value in `coll` that passes an async truth test. The
* `iteratee` is applied in parallel, meaning the first iteratee to return
* `true` will fire the detect `callback` with that result. That means the
* result might not be the first item in the original `coll` (in terms of order)
* that passes the test.
* If order within the original `coll` is important, then look at
* [`detectSeries`]{@link module:Collections.detectSeries}.
*
* @name detect
* @static
* @memberOf module:Collections
* @method
* @alias find
* @category Collections
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
* The iteratee must complete with a boolean value as its result.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called as soon as any
* iteratee returns `true`, or after all the `iteratee` functions have finished.
* Result will be the first item in the array that passes the truth test
* (iteratee) or the value `undefined` if none passed. Invoked with
* (err, result).
* @returns {Promise} a promise, if a callback is omitted
* @example
*
* // dir1 is a directory that contains file1.txt, file2.txt
* // dir2 is a directory that contains file3.txt, file4.txt
* // dir3 is a directory that contains file5.txt
*
* // asynchronous function that checks if a file exists
* function fileExists(file, callback) {
* fs.access(file, fs.constants.F_OK, (err) => {
* callback(null, !err);
* });
* }
*
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
* function(err, result) {
* console.log(result);
* // dir1/file1.txt
* // result now equals the first file in the list that exists
* }
*);
*
* // Using Promises
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
* .then(result => {
* console.log(result);
* // dir1/file1.txt
* // result now equals the first file in the list that exists
* }).catch(err => {
* console.log(err);
* });
*
* // Using async/await
* async () => {
* try {
* let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
* console.log(result);
* // dir1/file1.txt
* // result now equals the file in the list that exists
* }
* catch (err) {
* console.log(err);
* }
* }
*
*/
function detect(coll, iteratee, callback) {
return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback);
}
exports.default = (0, _awaitify2.default)(detect, 3);
module.exports = exports.default;
@@ -0,0 +1,80 @@
{
"name": "scroll-into-view-if-needed",
"version": "3.0.10",
"description": "Ponyfill for upcoming Element.scrollIntoView() APIs like scrollMode: if-needed, behavior: smooth and block: center",
"keywords": [
"behavior-smooth",
"if-needed",
"polyfill",
"ponyfill",
"scroll",
"scroll-into-view",
"scrollIntoView",
"scrollIntoViewIfNeeded",
"scrollMode",
"smooth",
"smoothscroll",
"typescript"
],
"homepage": "https://scroll-into-view.dev",
"repository": {
"type": "git",
"url": "git+https://github.com/scroll-into-view/scroll-into-view-if-needed.git"
},
"license": "MIT",
"author": "Cody Olsen",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.js",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"source": "./src/index.ts",
"typings": "./dist/index.d.ts",
"files": [
"dist",
"src"
],
"scripts": {
"prebuild": "npm run clean",
"build": "pkg build --strict",
"clean": "npx rimraf 'dist'",
"prepublishOnly": "npm run build",
"typecheck": "tsc && tsc --noEmit -p tests/typescript"
},
"browserslist": [
"> 0.2% and supports es6-module and supports es6-module-dynamic-import and not dead and not IE 11",
"maintained node versions"
],
"prettier": {
"semi": false,
"singleQuote": true
},
"dependencies": {
"compute-scroll-into-view": "^3.0.2"
},
"devDependencies": {
"@sanity/pkg-utils": "^2.2.5",
"@sanity/semantic-release-preset": "^4.0.0",
"cross-env": "^7.0.3",
"prettier": "^2.8.4",
"prettier-plugin-packagejson": "^2.4.3",
"rimraf": "^4.1.2",
"typescript": "^5.0.0"
},
"bundlesize": [
{
"path": "./dist/index.js",
"maxSize": "3.3 kB",
"compression": "none"
}
]
}
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const vitest_1 = require("vitest");
const __1 = require("../..");
(0, vitest_1.describe)('Issue 706', () => {
(0, vitest_1.it)('Should expose BindingScopeEnum as part of the public API', () => {
let SomeClass = class SomeClass {
time;
constructor() {
this.time = new Date().getTime();
}
};
SomeClass = tslib_1.__decorate([
(0, __1.injectable)(),
tslib_1.__metadata("design:paramtypes", [])
], SomeClass);
const container = new __1.Container({
defaultScope: __1.bindingScopeValues.Singleton,
});
// eslint-disable-next-line @typescript-eslint/typedef
const TYPE = {
SomeClass: Symbol.for('SomeClass'),
};
container.bind(TYPE.SomeClass).to(SomeClass);
const instanceOne = container.get(TYPE.SomeClass);
const instanceTwo = container.get(TYPE.SomeClass);
(0, vitest_1.expect)(instanceOne.time).toBe(instanceTwo.time);
});
});
//# sourceMappingURL=issue_706.test.js.map
@@ -0,0 +1,360 @@
"use strict";
/* eslint-disable no-param-reassign */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Address4 = void 0;
const common = __importStar(require("./common"));
const constants = __importStar(require("./v4/constants"));
const address_error_1 = require("./address-error");
/**
* Represents an IPv4 address
* @class Address4
* @param {string} address - An IPv4 address string
*/
class Address4 {
constructor(address) {
this.groups = constants.GROUPS;
this.parsedAddress = [];
this.parsedSubnet = '';
this.subnet = '/32';
this.subnetMask = 32;
this.v4 = true;
/**
* Returns true if the address is correct, false otherwise
* @memberof Address4
* @instance
* @returns {Boolean}
*/
this.isCorrect = common.isCorrect(constants.BITS);
/**
* Returns true if the given address is in the subnet of the current address
* @memberof Address4
* @instance
* @returns {boolean}
*/
this.isInSubnet = common.isInSubnet;
this.address = address;
const subnet = constants.RE_SUBNET_STRING.exec(address);
if (subnet) {
this.parsedSubnet = subnet[0].replace('/', '');
this.subnetMask = parseInt(this.parsedSubnet, 10);
this.subnet = `/${this.subnetMask}`;
if (this.subnetMask < 0 || this.subnetMask > constants.BITS) {
throw new address_error_1.AddressError('Invalid subnet mask.');
}
address = address.replace(constants.RE_SUBNET_STRING, '');
}
this.addressMinusSuffix = address;
this.parsedAddress = this.parse(address);
}
static isValid(address) {
try {
// eslint-disable-next-line no-new
new Address4(address);
return true;
}
catch (e) {
return false;
}
}
/*
* Parses a v4 address
*/
parse(address) {
const groups = address.split('.');
if (!address.match(constants.RE_ADDRESS)) {
throw new address_error_1.AddressError('Invalid IPv4 address.');
}
return groups;
}
/**
* Returns the correct form of an address
* @memberof Address4
* @instance
* @returns {String}
*/
correctForm() {
return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');
}
/**
* Converts a hex string to an IPv4 address object
* @memberof Address4
* @static
* @param {string} hex - a hex string to convert
* @returns {Address4}
*/
static fromHex(hex) {
const padded = hex.replace(/:/g, '').padStart(8, '0');
const groups = [];
let i;
for (i = 0; i < 8; i += 2) {
const h = padded.slice(i, i + 2);
groups.push(parseInt(h, 16));
}
return new Address4(groups.join('.'));
}
/**
* Converts an integer into a IPv4 address object
* @memberof Address4
* @static
* @param {integer} integer - a number to convert
* @returns {Address4}
*/
static fromInteger(integer) {
return Address4.fromHex(integer.toString(16));
}
/**
* Return an address from in-addr.arpa form
* @memberof Address4
* @static
* @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
* @returns {Adress4}
* @example
* var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)
* address.correctForm(); // '192.0.2.42'
*/
static fromArpa(arpaFormAddress) {
// remove ending ".in-addr.arpa." or just "."
const leader = arpaFormAddress.replace(/(\.in-addr\.arpa)?\.$/, '');
const address = leader.split('.').reverse().join('.');
return new Address4(address);
}
/**
* Converts an IPv4 address object to a hex string
* @memberof Address4
* @instance
* @returns {String}
*/
toHex() {
return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(':');
}
/**
* Converts an IPv4 address object to an array of bytes
* @memberof Address4
* @instance
* @returns {Array}
*/
toArray() {
return this.parsedAddress.map((part) => parseInt(part, 10));
}
/**
* Converts an IPv4 address object to an IPv6 address group
* @memberof Address4
* @instance
* @returns {String}
*/
toGroup6() {
const output = [];
let i;
for (i = 0; i < constants.GROUPS; i += 2) {
output.push(`${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(this.parsedAddress[i + 1])}`);
}
return output.join(':');
}
/**
* Returns the address as a `bigint`
* @memberof Address4
* @instance
* @returns {bigint}
*/
bigInt() {
return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join('')}`);
}
/**
* Helper function getting start address.
* @memberof Address4
* @instance
* @returns {bigint}
*/
_startAddress() {
return BigInt(`0b${this.mask() + '0'.repeat(constants.BITS - this.subnetMask)}`);
}
/**
* The first address in the range given by this address' subnet.
* Often referred to as the Network Address.
* @memberof Address4
* @instance
* @returns {Address4}
*/
startAddress() {
return Address4.fromBigInt(this._startAddress());
}
/**
* The first host address in the range given by this address's subnet ie
* the first address after the Network Address
* @memberof Address4
* @instance
* @returns {Address4}
*/
startAddressExclusive() {
const adjust = BigInt('1');
return Address4.fromBigInt(this._startAddress() + adjust);
}
/**
* Helper function getting end address.
* @memberof Address4
* @instance
* @returns {bigint}
*/
_endAddress() {
return BigInt(`0b${this.mask() + '1'.repeat(constants.BITS - this.subnetMask)}`);
}
/**
* The last address in the range given by this address' subnet
* Often referred to as the Broadcast
* @memberof Address4
* @instance
* @returns {Address4}
*/
endAddress() {
return Address4.fromBigInt(this._endAddress());
}
/**
* The last host address in the range given by this address's subnet ie
* the last address prior to the Broadcast Address
* @memberof Address4
* @instance
* @returns {Address4}
*/
endAddressExclusive() {
const adjust = BigInt('1');
return Address4.fromBigInt(this._endAddress() - adjust);
}
/**
* Converts a BigInt to a v4 address object
* @memberof Address4
* @static
* @param {bigint} bigInt - a BigInt to convert
* @returns {Address4}
*/
static fromBigInt(bigInt) {
return Address4.fromHex(bigInt.toString(16));
}
/**
* Convert a byte array to an Address4 object
* @memberof Address4
* @static
* @param {Array<number>} bytes - an array of 4 bytes (0-255)
* @returns {Address4}
*/
static fromByteArray(bytes) {
if (bytes.length !== 4) {
throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
}
// Validate that all bytes are within valid range (0-255)
for (let i = 0; i < bytes.length; i++) {
if (!Number.isInteger(bytes[i]) || bytes[i] < 0 || bytes[i] > 255) {
throw new address_error_1.AddressError('All bytes must be integers between 0 and 255');
}
}
return this.fromUnsignedByteArray(bytes);
}
/**
* Convert an unsigned byte array to an Address4 object
* @memberof Address4
* @static
* @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
* @returns {Address4}
*/
static fromUnsignedByteArray(bytes) {
if (bytes.length !== 4) {
throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
}
const address = bytes.join('.');
return new Address4(address);
}
/**
* Returns the first n bits of the address, defaulting to the
* subnet mask
* @memberof Address4
* @instance
* @returns {String}
*/
mask(mask) {
if (mask === undefined) {
mask = this.subnetMask;
}
return this.getBitsBase2(0, mask);
}
/**
* Returns the bits in the given range as a base-2 string
* @memberof Address4
* @instance
* @returns {string}
*/
getBitsBase2(start, end) {
return this.binaryZeroPad().slice(start, end);
}
/**
* Return the reversed ip6.arpa form of the address
* @memberof Address4
* @param {Object} options
* @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
* @instance
* @returns {String}
*/
reverseForm(options) {
if (!options) {
options = {};
}
const reversed = this.correctForm().split('.').reverse().join('.');
if (options.omitSuffix) {
return reversed;
}
return `${reversed}.in-addr.arpa.`;
}
/**
* Returns true if the given address is a multicast address
* @memberof Address4
* @instance
* @returns {boolean}
*/
isMulticast() {
return this.isInSubnet(new Address4('224.0.0.0/4'));
}
/**
* Returns a zero-padded base-2 string representation of the address
* @memberof Address4
* @instance
* @returns {string}
*/
binaryZeroPad() {
return this.bigInt().toString(2).padStart(constants.BITS, '0');
}
/**
* Groups an IPv4 address for inclusion at the end of an IPv6 address
* @returns {String}
*/
groupForV6() {
const segments = this.parsedAddress;
return this.address.replace(constants.RE_ADDRESS, `<span class="hover-group group-v4 group-6">${segments
.slice(0, 2)
.join('.')}</span>.<span class="hover-group group-v4 group-7">${segments
.slice(2, 4)
.join('.')}</span>`);
}
}
exports.Address4 = Address4;
//# sourceMappingURL=ipv4.js.map
@@ -0,0 +1,92 @@
import composeArgs from './_composeArgs.js';
import composeArgsRight from './_composeArgsRight.js';
import countHolders from './_countHolders.js';
import createCtor from './_createCtor.js';
import createRecurry from './_createRecurry.js';
import getHolder from './_getHolder.js';
import reorder from './_reorder.js';
import replaceHolders from './_replaceHolders.js';
import root from './_root.js';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_ARY_FLAG = 128,
WRAP_FLIP_FLAG = 512;
/**
* Creates a function that wraps `func` to invoke it with optional `this`
* binding of `thisArg`, partial application, and currying.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [partialsRight] The arguments to append to those provided
* to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & WRAP_ARY_FLAG,
isBind = bitmask & WRAP_BIND_FLAG,
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
isFlip = bitmask & WRAP_FLIP_FLAG,
Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper),
holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary < length) {
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
export default createHybrid;
@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/query/react/rtkqImports.ts","../../../src/query/react/module.ts","../../../src/query/utils/capitalize.ts","../../../src/query/utils/countObjectKeys.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/tsHelpers.ts","../../../src/query/react/buildHooks.ts","../../../src/query/react/reactImports.ts","../../../src/query/react/reactReduxImports.ts","../../../src/query/react/constants.ts","../../../src/query/react/useSerializedStableValue.ts","../../../src/query/react/useShallowStableValue.ts","../../../src/query/react/index.ts","../../../src/query/react/ApiProvider.tsx"],"sourcesContent":["export { buildCreateApi, coreModule, copyWithStructuralSharing, setupListeners, QueryStatus, skipToken } from '@reduxjs/toolkit/query';","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Api, BaseQueryFn, EndpointDefinitions, InfiniteQueryDefinition, Module, MutationDefinition, PrefetchOptions, QueryArgFrom, QueryDefinition, QueryKeys } from '@reduxjs/toolkit/query';\nimport { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from 'react-redux';\nimport { createSelector as _createSelector } from 'reselect';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { safeAssign } from '../tsHelpers';\nimport { capitalize, countObjectKeys } from '../utils';\nimport type { InfiniteQueryHooks, MutationHooks, QueryHooks } from './buildHooks';\nimport { buildHooks } from './buildHooks';\nimport type { HooksWithUniqueNames } from './namedHooks';\nexport const reactHooksModuleName = /* @__PURE__ */Symbol();\nexport type ReactHooksModule = typeof reactHooksModuleName;\ndeclare module '@reduxjs/toolkit/query' {\n export interface ApiModules<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ReducerPath extends string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TagTypes extends string> {\n [reactHooksModuleName]: {\n /**\n * Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\n */\n endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never };\n /**\n * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\n */\n usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;\n } & HooksWithUniqueNames<Definitions>;\n }\n}\ntype RR = typeof import('react-redux');\nexport interface ReactHooksModuleOptions {\n /**\n * The hooks from React Redux to be used\n */\n hooks?: {\n /**\n * The version of the `useDispatch` hook to be used\n */\n useDispatch: RR['useDispatch'];\n /**\n * The version of the `useSelector` hook to be used\n */\n useSelector: RR['useSelector'];\n /**\n * The version of the `useStore` hook to be used\n */\n useStore: RR['useStore'];\n };\n /**\n * The version of the `batchedUpdates` function to be used\n */\n batch?: RR['batch'];\n /**\n * Enables performing asynchronous tasks immediately within a render.\n *\n * @example\n *\n * ```ts\n * import {\n * buildCreateApi,\n * coreModule,\n * reactHooksModule\n * } from '@reduxjs/toolkit/query/react'\n *\n * const createApi = buildCreateApi(\n * coreModule(),\n * reactHooksModule({ unstable__sideEffectsInRender: true })\n * )\n * ```\n */\n unstable__sideEffectsInRender?: boolean;\n /**\n * A selector creator (usually from `reselect`, or matching the same signature)\n */\n createSelector?: typeof _createSelector;\n}\n\n/**\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\n *\n * @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n * coreModule(),\n * reactHooksModule({\n * hooks: {\n * useDispatch: createDispatchHook(MyContext),\n * useSelector: createSelectorHook(MyContext),\n * useStore: createStoreHook(MyContext)\n * }\n * })\n * );\n * ```\n *\n * @returns A module for use with `buildCreateApi`\n */\nexport const reactHooksModule = ({\n batch = rrBatch,\n hooks = {\n useDispatch: rrUseDispatch,\Line truncated
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAoCM,SAAS,0CAAgB,KAAyB,EAAE,KAAoB,EAAE,GAAuC;QAEtG;IADhB,IAAI,iBAAC,aAAa,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gCAAU,EAAE,OAAO,OAAO;IAC3D,IAAI,aAAY,qBAAA,MAAM,IAAI,CAAC,MAAM,cAAjB,yCAAA,mBAAmB,GAAG;IACtC,IAAI,aAAa,QAAQ,MAAM,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY;QAC5E,cAAc,IAAI,GAAG;QACrB,cAAc,EAAE,GAAG,CAAA,GAAA,mCAAQ,EAAE,OAAO,MAAM,IAAI,CAAC,SAAS,EAAG;IAC7D;IAEA,OAAO;uBACL;mBACA;IACF;AACF","sources":["packages/@react-aria/table/src/useTableCell.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {getCellId} from './utils';\nimport {GridNode} from '@react-types/grid';\nimport {TableState} from '@react-stately/table';\nimport {useGridCell} from '@react-aria/grid';\n\nexport interface AriaTableCellProps {\n /** An object representing the table cell. Contains all the relevant information that makes up the row header. */\n node: GridNode<unknown>,\n /** Whether the cell is contained in a virtual scroller. */\n isVirtualized?: boolean,\n /** Whether selection should occur on press up instead of press down. */\n shouldSelectOnPressUp?: boolean,\n /**\n * Handler that is called when a user performs an action on the cell.\n * Please use onCellAction at the collection level instead.\n * @deprecated\n **/\n onAction?: () => void\n}\n\nexport interface TableCellAria {\n /** Props for the table cell element. */\n gridCellProps: DOMAttributes,\n /** Whether the cell is currently in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a cell in a table.\n * @param props - Props for the cell.\n * @param state - State of the table, as returned by `useTableState`.\n * @param ref - The ref attached to the cell element.\n */\nexport function useTableCell<T>(props: AriaTableCellProps, state: TableState<T>, ref: RefObject<FocusableElement | null>): TableCellAria {\n let {gridCellProps, isPressed} = useGridCell(props, state, ref);\n let columnKey = props.node.column?.key;\n if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {\n gridCellProps.role = 'rowheader';\n gridCellProps.id = getCellId(state, props.node.parentKey!, columnKey);\n }\n\n return {\n gridCellProps,\n isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTableCell.main.js.map"}
@@ -0,0 +1,531 @@
import { QQLevel, NTSex } from './user';
export interface GroupExtInfo {
groupCode: string;
resultCode: number;
extInfo: EXTInfo;
}
export interface GroupExtFilter {
groupInfoExtSeq: number;
reserve: number;
luckyWordId: number;
lightCharNum: number;
luckyWord: number;
starId: number;
essentialMsgSwitch: number;
todoSeq: number;
blacklistExpireTime: number;
isLimitGroupRtc: number;
companyId: number;
hasGroupCustomPortrait: number;
bindGuildId: number;
groupOwnerId: number;
essentialMsgPrivilege: number;
msgEventSeq: number;
inviteRobotSwitch: number;
gangUpId: number;
qqMusicMedalSwitch: number;
showPlayTogetherSwitch: number;
groupFlagPro1: number;
groupBindGuildIds: number;
viewedMsgDisappearTime: number;
groupExtFlameData: number;
groupBindGuildSwitch: number;
groupAioBindGuildId: number;
groupExcludeGuildIds: number;
fullGroupExpansionSwitch: number;
fullGroupExpansionSeq: number;
inviteRobotMemberSwitch: number;
inviteRobotMemberExamine: number;
groupSquareSwitch: number;
}
export interface EXTInfo {
groupInfoExtSeq: number;
reserve: number;
luckyWordId: string;
lightCharNum: number;
luckyWord: string;
starId: number;
essentialMsgSwitch: number;
todoSeq: number;
blacklistExpireTime: number;
isLimitGroupRtc: number;
companyId: number;
hasGroupCustomPortrait: number;
bindGuildId: string;
groupOwnerId: GroupOwnerID;
essentialMsgPrivilege: number;
msgEventSeq: string;
inviteRobotSwitch: number;
gangUpId: string;
qqMusicMedalSwitch: number;
showPlayTogetherSwitch: number;
groupFlagPro1: string;
groupBindGuildIds: GroupGuildIDS;
viewedMsgDisappearTime: string;
groupExtFlameData: GroupEXTFlameData;
groupBindGuildSwitch: number;
groupAioBindGuildId: string;
groupExcludeGuildIds: GroupGuildIDS;
fullGroupExpansionSwitch: number;
fullGroupExpansionSeq: string;
inviteRobotMemberSwitch: number;
inviteRobotMemberExamine: number;
groupSquareSwitch: number;
}
export interface GroupGuildIDS {
guildIds: any[];
}
export interface GroupEXTFlameData {
switchState: number;
state: number;
dayNums: any[];
version: number;
updateTime: string;
isDisplayDayNum: boolean;
}
export interface GroupOwnerID {
memberUin: string;
memberUid: string;
memberQid: string;
}
export interface KickMemberInfo {
optFlag: number;
optOperate: number;
optMemberUid: string;
optBytesMsg: string;
}
export interface GroupDetailInfoV2Param {
groupCode: string;
filter: Filter;
modifyInfo: ModifyInfo;
}
export interface Filter {
noCodeFingerOpenFlag: number;
noFingerOpenFlag: number;
groupName: number;
classExt: number;
classText: number;
fingerMemo: number;
richFingerMemo: number;
tagRecord: number;
groupGeoInfo: FilterGroupGeoInfo;
groupExtAdminNum: number;
flag: number;
groupMemo: number;
groupAioSkinUrl: number;
groupBoardSkinUrl: number;
groupCoverSkinUrl: number;
groupGrade: number;
activeMemberNum: number;
certificationType: number;
certificationText: number;
groupNewGuideLines: FilterGroupNewGuideLines;
groupFace: number;
addOption: number;
shutUpTime: number;
groupTypeFlag: number;
appPrivilegeFlag: number;
appPrivilegeMask: number;
groupExtOnly: GroupEXTOnly;
groupSecLevel: number;
groupSecLevelInfo: number;
subscriptionUin: number;
subscriptionUid: string;
allowMemberInvite: number;
groupQuestion: number;
groupAnswer: number;
groupFlagExt3: number;
groupFlagExt3Mask: number;
groupOpenAppid: number;
rootId: number;
msgLimitFrequency: number;
hlGuildAppid: number;
hlGuildSubType: number;
hlGuildOrgId: number;
groupFlagExt4: number;
groupFlagExt4Mask: number;
groupSchoolInfo: FilterGroupSchoolInfo;
groupCardPrefix: FilterGroupCardPrefix;
allianceId: number;
groupFlagPro1: number;
groupFlagPro1Mask: number;
}
export interface FilterGroupCardPrefix {
introduction: number;
rptPrefix: number;
}
export interface GroupEXTOnly {
tribeId: number;
moneyForAddGroup: number;
}
export interface FilterGroupGeoInfo {
ownerUid: number;
setTime: number;
cityId: number;
longitude: number;
latitude: number;
geoContent: number;
poiId: number;
}
export interface FilterGroupNewGuideLines {
enabled: number;
content: number;
}
export interface FilterGroupSchoolInfo {
location: number;
grade: number;
school: number;
}
export interface ModifyInfo {
noCodeFingerOpenFlag: number;
noFingerOpenFlag: number;
groupName: string;
classExt: number;
classText: string;
fingerMemo: string;
richFingerMemo: string;
tagRecord: any[];
groupGeoInfo: ModifyInfoGroupGeoInfo;
groupExtAdminNum: number;
flag: number;
groupMemo: string;
groupAioSkinUrl: string;
groupBoardSkinUrl: string;
groupCoverSkinUrl: string;
groupGrade: number;
activeMemberNum: number;
certificationType: number;
certificationText: string;
groupNewGuideLines: ModifyInfoGroupNewGuideLines;
groupFace: number;
addOption: number;
shutUpTime: number;
groupTypeFlag: number;
appPrivilegeFlag: number;
appPrivilegeMask: number;
groupExtOnly: GroupEXTOnly;
groupSecLevel: number;
groupSecLevelInfo: number;
subscriptionUin: string;
subscriptionUid: string;
allowMemberInvite: number;
groupQuestion: string;
groupAnswer: string;
groupFlagExt3: number;
groupFlagExt3Mask: number;
groupOpenAppid: number;
rootId: string;
msgLimitFrequency: number;
hlGuildAppid: number;
hlGuildSubType: number;
hlGuildOrgId: number;
groupFlagExt4: number;
groupFlagExt4Mask: number;
groupSchoolInfo: ModifyInfoGroupSchoolInfo;
groupCardPrefix: ModifyInfoGroupCardPrefix;
allianceId: string;
groupFlagPro1: number;
groupFlagPro1Mask: number;
}
export interface ModifyInfoGroupCardPrefix {
introduction: string;
rptPrefix: any[];
}
export interface ModifyInfoGroupGeoInfo {
ownerUid: string;
SetTime: number;
CityId: number;
Longitude: string;
Latitude: string;
GeoContent: string;
poiId: string;
}
export interface ModifyInfoGroupNewGuideLines {
enabled: boolean;
content: string;
}
export interface ModifyInfoGroupSchoolInfo {
location: string;
grade: number;
school: string;
}
export enum GroupInfoSource {
KUNSPECIFIED = 0,
KBIGDATACARD = 1,
KDATACARD = 2,
KNOTICE = 3,
KAIO = 4,
KRECENTCONTACT = 5,
KMOREPANEL = 6
}
export interface GroupDetailInfo {
groupCode: string;
groupUin: string;
ownerUid: string;
ownerUin: string;
groupFlag: number;
groupFlagExt: number;
maxMemberNum: number;
memberNum: number;
groupOption: number;
classExt: number;
groupName: string;
fingerMemo: string;
groupQuestion: string;
certType: number;
richFingerMemo: string;
tagRecord: unknown[];
shutUpAllTimestamp: number;
shutUpMeTimestamp: number;
groupTypeFlag: number;
privilegeFlag: number;
groupSecLevel: number;
groupFlagExt3: number;
isConfGroup: number;
isModifyConfGroupFace: number;
isModifyConfGroupName: number;
groupFlagExt4: number;
groupMemo: string;
cmdUinMsgSeq: number;
cmdUinJoinTime: number;
cmdUinUinFlag: number;
cmdUinMsgMask: number;
groupSecLevelInfo: number;
cmdUinPrivilege: number;
cmdUinFlagEx2: number;
appealDeadline: number;
remarkName: string;
isTop: boolean;
groupFace: number;
groupGeoInfo: {
ownerUid: string;
SetTime: number;
CityId: number;
Longitude: string;
Latitude: string;
GeoContent: string;
poiId: string;
};
certificationText: string;
cmdUinRingtoneId: number;
longGroupName: string;
autoAgreeJoinGroupUserNumForConfGroup: number;
autoAgreeJoinGroupUserNumForNormalGroup: number;
cmdUinFlagExt3Grocery: number;
groupCardPrefix: {
introduction: string;
rptPrefix: unknown[];
};
groupExt: {
groupInfoExtSeq: number;
reserve: number;
luckyWordId: string;
lightCharNum: number;
luckyWord: string;
starId: number;
essentialMsgSwitch: number;
todoSeq: number;
blacklistExpireTime: number;
isLimitGroupRtc: number;
companyId: number;
hasGroupCustomPortrait: number;
bindGuildId: string;
groupOwnerId: {
memberUin: string;
memberUid: string;
memberQid: string;
};
essentialMsgPrivilege: number;
msgEventSeq: string;
inviteRobotSwitch: number;
gangUpId: string;
qqMusicMedalSwitch: number;
showPlayTogetherSwitch: number;
groupFlagPro1: string;
groupBindGuildIds: {
guildIds: unknown[];
};
viewedMsgDisappearTime: string;
groupExtFlameData: {
switchState: number;
state: number;
dayNums: unknown[];
version: number;
updateTime: string;
isDisplayDayNum: boolean;
};
groupBindGuildSwitch: number;
groupAioBindGuildId: string;
groupExcludeGuildIds: {
guildIds: unknown[];
};
fullGroupExpansionSwitch: number;
fullGroupExpansionSeq: string;
inviteRobotMemberSwitch: number;
inviteRobotMemberExamine: number;
groupSquareSwitch: number;
};
msgLimitFrequency: number;
hlGuildAppid: number;
hlGuildSubType: number;
isAllowRecallMsg: number;
confUin: string;
confMaxMsgSeq: number;
confToGroupTime: number;
groupSchoolInfo: {
location: string;
grade: number;
school: string;
};
activeMemberNum: number;
groupGrade: number;
groupCreateTime: number;
subscriptionUin: string;
subscriptionUid: string;
noFingerOpenFlag: number;
noCodeFingerOpenFlag: number;
isGroupFreeze: number;
allianceId: string;
groupExtOnly: {
tribeId: number;
moneyForAddGroup: number;
};
isAllowConfGroupMemberModifyGroupName: number;
isAllowConfGroupMemberNick: number;
isAllowConfGroupMemberAtAll: number;
groupClassText: string;
groupFreezeReason: number;
headPortraitSeq: number;
groupHeadPortrait: {
portraitCnt: number;
portraitInfo: unknown[];
defaultId: number;
verifyingPortraitCnt: number;
verifyingPortraitInfo: unknown[];
};
cmdUinJoinMsgSeq: number;
cmdUinJoinRealMsgSeq: number;
groupAnswer: string;
groupAdminMaxNum: number;
inviteNoAuthNumLimit: string;
hlGuildOrgId: number;
isAllowHlGuildBinary: number;
localExitGroupReason: number;
}
export interface GroupExt0xEF0InfoFilter {
bindGuildId: number;
blacklistExpireTime: number;
companyId: number;
essentialMsgPrivilege: number;
essentialMsgSwitch: number;
fullGroupExpansionSeq: number;
fullGroupExpansionSwitch: number;
gangUpId: number;
groupAioBindGuildId: number;
groupBindGuildIds: number;
groupBindGuildSwitch: number;
groupExcludeGuildIds: number;
groupExtFlameData: number;
groupFlagPro1: number;
groupInfoExtSeq: number;
groupOwnerId: number;
groupSquareSwitch: number;
hasGroupCustomPortrait: number;
inviteRobotMemberExamine: number;
inviteRobotMemberSwitch: number;
inviteRobotSwitch: number;
isLimitGroupRtc: number;
lightCharNum: number;
luckyWord: number;
luckyWordId: number;
msgEventSeq: number;
qqMusicMedalSwitch: number;
reserve: number;
showPlayTogetherSwitch: number;
starId: number;
todoSeq: number;
viewedMsgDisappearTime: number;
}
export interface KickMemberV2Req {
groupCode: string;
kickFlag: number;
kickList: Array<KickMemberInfo>;
kickListUids: Array<string>;
kickMsg: string;
}
export enum DataSource {
LOCAL = 0,
REMOTE = 1
}
export enum GroupListUpdateType {
REFRESHALL = 0,
GETALL = 1,
MODIFIED = 2,
REMOVE = 3
}
export interface GroupMemberCache {
group: {
data: GroupMember[];
isExpired: boolean;
};
isExpired: boolean;
}
export interface Group {
groupCode: string;
createTime?: string;
maxMember: number;
memberCount: number;
groupName: string;
groupStatus: number;
memberRole: number;
isTop: boolean;
toppedTimestamp: string;
privilegeFlag: number;
isConf: boolean;
hasModifyConfGroupFace: boolean;
hasModifyConfGroupName: boolean;
remarkName: string;
hasMemo: boolean;
groupShutupExpireTime: string;
personShutupExpireTime: string;
discussToGroupUin: string;
discussToGroupMaxMsgSeq: number;
discussToGroupTime: number;
groupFlagExt: number;
authGroupType: number;
groupCreditLevel: number;
groupFlagExt3: number;
groupOwnerId: {
memberUin: string;
memberUid: string;
};
}
export enum NTGroupMemberRole {
KUNSPECIFIED = 0,
KSTRANGER = 1,
KMEMBER = 2,
KADMIN = 3,
KOWNER = 4
}
export interface GroupMember {
memberRealLevel: number | undefined;
memberSpecialTitle?: string;
avatarPath: string;
cardName: string;
cardType: number;
isDelete: boolean;
nick: string;
qid: string;
remark: string;
role: NTGroupMemberRole;
shutUpTime: number;
uid: string;
uin: string;
isRobot: boolean;
sex?: NTSex;
age?: number;
qqLevel?: QQLevel;
isChangeRole: boolean;
joinTime: string;
lastSpeakTime: string;
}
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateConstructorMetadataArray = validateConstructorMetadataArray;
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError");
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind");
function validateConstructorMetadataArray(type, value) {
const undefinedIndexes = [];
if (value.length < type.length) {
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.missingInjectionDecorator, `Found unexpected missing metadata on type "${type.name}". "${type.name}" constructor requires at least ${type.length.toString()} arguments, found ${value.length.toString()} instead.
Are you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);
}
// Using a for loop to ensure empty values are traversed as well
for (let i = 0; i < value.length; ++i) {
const element = value[i];
if (element === undefined) {
undefinedIndexes.push(i);
}
}
if (undefinedIndexes.length > 0) {
throw new InversifyCoreError_1.InversifyCoreError(InversifyCoreErrorKind_1.InversifyCoreErrorKind.missingInjectionDecorator, `Found unexpected missing metadata on type "${type.name}" at constructor indexes "${undefinedIndexes.join('", "')}".
Are you using @inject, @multiInject or @unmanaged decorators at those indexes?
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);
}
}
//# sourceMappingURL=validateConstructorMetadataArray.js.map
@@ -0,0 +1 @@
{"version":3,"file":"PlanServiceNodeBindingAddedResult.js","sourceRoot":"","sources":["../../../../src/metadata/models/PlanServiceNodeBindingAddedResult.ts"],"names":[],"mappings":""}
@@ -0,0 +1,223 @@
var $ioO2y$react = require("react");
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "CollectionBuilder", () => $51588fd411aace25$export$bf788dd355e3a401);
/*
* 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.
*/
class $51588fd411aace25$export$bf788dd355e3a401 {
build(props, context) {
this.context = context;
return $51588fd411aace25$var$iterable(()=>this.iterateCollection(props));
}
*iterateCollection(props) {
let { children: children, items: items } = props;
if ((0, ($parcel$interopDefault($ioO2y$react))).isValidElement(children) && children.type === (0, ($parcel$interopDefault($ioO2y$react))).Fragment) yield* this.iterateCollection({
children: children.props.children,
items: items
});
else if (typeof children === 'function') {
if (!items) throw new Error('props.children was a function but props.items is missing');
let index = 0;
for (let item of items){
yield* this.getFullNode({
value: item,
index: index
}, {
renderer: children
});
index++;
}
} else {
let items = [];
(0, ($parcel$interopDefault($ioO2y$react))).Children.forEach(children, (child)=>{
if (child) items.push(child);
});
let index = 0;
for (let item of items){
let nodes = this.getFullNode({
element: item,
index: index
}, {});
for (let node of nodes){
index++;
yield node;
}
}
}
}
getKey(item, partialNode, state, parentKey) {
if (item.key != null) return item.key;
if (partialNode.type === 'cell' && partialNode.key != null) return `${parentKey}${partialNode.key}`;
let v = partialNode.value;
if (v != null) {
var _v_key;
let key = (_v_key = v.key) !== null && _v_key !== void 0 ? _v_key : v.id;
if (key == null) throw new Error('No key found for item');
return key;
}
return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
}
getChildState(state, partialNode) {
return {
renderer: partialNode.renderer || state.renderer
};
}
*getFullNode(partialNode, state, parentKey, parentNode) {
if ((0, ($parcel$interopDefault($ioO2y$react))).isValidElement(partialNode.element) && partialNode.element.type === (0, ($parcel$interopDefault($ioO2y$react))).Fragment) {
let children = [];
(0, ($parcel$interopDefault($ioO2y$react))).Children.forEach(partialNode.element.props.children, (child)=>{
children.push(child);
});
var _partialNode_index;
let index = (_partialNode_index = partialNode.index) !== null && _partialNode_index !== void 0 ? _partialNode_index : 0;
for (const child of children)yield* this.getFullNode({
element: child,
index: index++
}, state, parentKey, parentNode);
return;
}
// If there's a value instead of an element on the node, and a parent renderer function is available,
// use it to render an element for the value.
let element = partialNode.element;
if (!element && partialNode.value && state && state.renderer) {
let cached = this.cache.get(partialNode.value);
if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
cached.index = partialNode.index;
cached.parentKey = parentNode ? parentNode.key : null;
yield cached;
return;
}
element = state.renderer(partialNode.value);
}
// If there's an element with a getCollectionNode function on its type, then it's a supported component.
// Call this function to get a partial node, and recursively build a full node from there.
if ((0, ($parcel$interopDefault($ioO2y$react))).isValidElement(element)) {
let type = element.type;
if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {
let name = element.type;
throw new Error(`Unknown element <${name}> in collection.`);
}
let childNodes = type.getCollectionNode(element.props, this.context);
var _partialNode_index1;
let index = (_partialNode_index1 = partialNode.index) !== null && _partialNode_index1 !== void 0 ? _partialNode_index1 : 0;
let result = childNodes.next();
while(!result.done && result.value){
let childNode = result.value;
partialNode.index = index;
var _childNode_key;
let nodeKey = (_childNode_key = childNode.key) !== null && _childNode_key !== void 0 ? _childNode_key : null;
if (nodeKey == null) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);
let nodes = this.getFullNode({
...childNode,
key: nodeKey,
index: index,
wrapper: $51588fd411aace25$var$compose(partialNode.wrapper, childNode.wrapper)
}, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);
let children = [
...nodes
];
for (let node of children){
var _childNode_value, _ref;
// Cache the node based on its value
node.value = (_ref = (_childNode_value = childNode.value) !== null && _childNode_value !== void 0 ? _childNode_value : partialNode.value) !== null && _ref !== void 0 ? _ref : null;
if (node.value) this.cache.set(node.value, node);
var _parentNode_type;
// The partial node may have specified a type for the child in order to specify a constraint.
// Verify that the full node that was built recursively matches this type.
if (partialNode.type && node.type !== partialNode.type) throw new Error(`Unsupported type <${$51588fd411aace25$var$capitalize(node.type)}> in <${$51588fd411aace25$var$capitalize((_parentNode_type = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== null && _parentNode_type !== void 0 ? _parentNode_type : 'unknown parent type')}>. Only <${$51588fd411aace25$var$capitalize(partialNode.type)}> is supported.`);
index++;
yield node;
}
result = childNodes.next(children);
}
return;
}
// Ignore invalid elements
if (partialNode.key == null || partialNode.type == null) return;
// Create full node
let builder = this;
var _partialNode_value, _partialNode_textValue;
let node = {
type: partialNode.type,
props: partialNode.props,
key: partialNode.key,
parentKey: parentNode ? parentNode.key : null,
value: (_partialNode_value = partialNode.value) !== null && _partialNode_value !== void 0 ? _partialNode_value : null,
level: parentNode ? parentNode.level + 1 : 0,
index: partialNode.index,
rendered: partialNode.rendered,
textValue: (_partialNode_textValue = partialNode.textValue) !== null && _partialNode_textValue !== void 0 ? _partialNode_textValue : '',
'aria-label': partialNode['aria-label'],
wrapper: partialNode.wrapper,
shouldInvalidate: partialNode.shouldInvalidate,
hasChildNodes: partialNode.hasChildNodes || false,
childNodes: $51588fd411aace25$var$iterable(function*() {
if (!partialNode.hasChildNodes || !partialNode.childNodes) return;
let index = 0;
for (let child of partialNode.childNodes()){
// Ensure child keys are globally unique by prepending the parent node's key
if (child.key != null) // TODO: Remove this line entirely and enforce that users always provide unique keys.
// Currently this line will have issues when a parent has a key `a` and a child with key `bc`
// but another parent has key `ab` and its child has a key `c`. The combined keys would result in both
// children having a key of `abc`.
child.key = `${node.key}${child.key}`;
let nodes = builder.getFullNode({
...child,
index: index
}, builder.getChildState(state, child), node.key, node);
for (let node of nodes){
index++;
yield node;
}
}
})
};
yield node;
}
constructor(){
this.cache = new WeakMap();
}
}
// Wraps an iterator function as an iterable object, and caches the results.
function $51588fd411aace25$var$iterable(iterator) {
let cache = [];
let iterable = null;
return {
*[Symbol.iterator] () {
for (let item of cache)yield item;
if (!iterable) iterable = iterator();
for (let item of iterable){
cache.push(item);
yield item;
}
}
};
}
function $51588fd411aace25$var$compose(outer, inner) {
if (outer && inner) return (element)=>outer(inner(element));
if (outer) return outer;
if (inner) return inner;
}
function $51588fd411aace25$var$capitalize(str) {
return str[0].toUpperCase() + str.slice(1);
}
//# sourceMappingURL=CollectionBuilder.main.js.map
@@ -0,0 +1,12 @@
function _defineEnumerableProperties(e, r) {
for (var t in r) {
var n = r[t];
n.configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, t, n);
}
if (Object.getOwnPropertySymbols) for (var a = Object.getOwnPropertySymbols(r), b = 0; b < a.length; b++) {
var i = a[b];
(n = r[i]).configurable = n.enumerable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, i, n);
}
return e;
}
export { _defineEnumerableProperties as default };
@@ -0,0 +1,24 @@
export interface SystemStatus {
cpu: {
model: string;
speed: string;
usage: {
system: string;
qq: string;
};
core: number;
};
memory: {
total: string;
usage: {
system: string;
qq: string;
};
};
arch: string;
}
export interface IStatusHelperSubscription {
on(event: 'statusUpdate', listener: (status: SystemStatus) => void): this;
off(event: 'statusUpdate', listener: (status: SystemStatus) => void): this;
emit(event: 'statusUpdate', status: SystemStatus): boolean;
}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAuEM,SAAS,0CAAW,KAAgB,EAAE,KAAsC,EAAE,GAAkC;IACrH,IAAI,iBACF,aAAa,qBACb,iBAAiB,oBACjB,gBAAgB,aAChB,SAAS,aACT,SAAS,cACT,UAAU,eACV,WAAW,gBACX,YAAY,qBACZ,oBAAoB,yCACpB,qBAAqB,EACtB,GAAG;IACJ,IAAI,EAAC,kBAAkB,OAAO,EAAC,GAAG;IAElC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB,EACnD,QAAQ,IAAI,CAAC;IAGf,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,gCAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,CAAC,gBAAgB;IAC9D,IAAI,WAAW,CAAA,GAAA,oBAAM,EAAE,IAAM,oBAAoB,IAAI,CAAA,GAAA,8CAAmB,EAAE;YACxE,YAAY,MAAM,UAAU;YAC5B,cAAc,MAAM,YAAY;8BAChC;iBACA;uBACA;sBACA;uBACA;QACF,IAAI;QAAC;QAAkB,MAAM,UAAU;QAAE,MAAM,YAAY;QAAE;QAAkB;QAAK;QAAW;QAAU;KAAU;IAEnH,IAAI,mBAAC,eAAe,EAAC,GAAG,CAAA,GAAA,iDAAsB,EAAE;aAC9C;QACA,kBAAkB;QAClB,kBAAkB;uBAClB;mBACA;2BACA;2BACA;IACF;IAEA,IAAI,KAAK,CAAA,GAAA,2BAAI,EAAE,MAAM,EAAE;IACvB,CAAA,GAAA,iCAAM,EAAE,GAAG,CAAC,OAAO;QAAC,kBAAkB;QAAU,SAAS;yBAAC;0BAAa;QAAY;+BAAG;IAAqB;IAE3G,IAAI,mBAAmB,CAAA,GAAA,0DAA+B,EAAE;QACtD,kBAAkB;QAClB,gBAAgB,CAAC,CAAE,CAAA,eAAe,YAAW;IAC/C;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAErD,IAAI,UAAU,CAAA,GAAA,wBAAU,EAAE,CAAC;QACzB,IAAI,QAAQ,SAAS,EAAE;YACrB,gEAAgE;YAChE,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GACpC,QAAQ,UAAU,CAAC;YAGrB;QACF;QAEA,gEAAgE;QAChE,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GACpC;QAGF,QAAQ,UAAU,CAAC;IACrB,GAAG;QAAC;KAAQ;IAEZ,qFAAqF;IACrF,IAAI,sBAAsB,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YACvC,QAAQ,gBAAgB,MAAM;qBAC9B;QACF,CAAA,GAAI;QAAC;QAAS,gBAAgB,MAAM;KAAC;IAErC,IAAI,mBAAmB,CAAA,GAAA,yCAAkB,EAAE,KAAK;QAC9C,YAAY,MAAM,UAAU,CAAC,IAAI,KAAK;IACxC;IAEA,IAAI,YAA2B,CAAA,GAAA,gCAAS,EACtC,UACA;QACE,MAAM;YACN;QACA,wBAAwB,QAAQ,aAAa,KAAK,aAAa,SAAS;IAC1E,GACA,MAAM,4BAA4B,GAAG,sBAAsB,iBAE3D,AADA,mGAAmG;IAClG,MAAM,UAAU,CAAC,IAAI,KAAK,KAAK;QAAC,UAAU,mBAAmB,KAAK;IAAC,KAAM,WAC1E;IAGF,IAAI,eAAe;QACjB,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,IAAI;QAClD,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,WAAW;IAC3D;IAEA,CAAA,GAAA,sDAA2B,EAAE;oBAAC;IAAU,GAAG;IAC3C,OAAO;mBACL;IACF;AACF","sources":["packages/@react-aria/grid/src/useGrid.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 {AriaLabelingProps, DOMAttributes, DOMProps, Key, KeyboardDelegate, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId} from '@react-aria/utils';\nimport {GridCollection} from '@react-types/grid';\nimport {GridKeyboardDelegate} from './GridKeyboardDelegate';\nimport {gridMap} from './utils';\nimport {GridState} from '@react-stately/grid';\nimport {useCallback, useMemo} from 'react';\nimport {useCollator, useLocale} from '@react-aria/i18n';\nimport {useGridSelectionAnnouncement} from './useGridSelectionAnnouncement';\nimport {useHasTabbableChild} from '@react-aria/focus';\nimport {useHighlightSelectionDescription} from './useHighlightSelectionDescription';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface GridProps extends DOMProps, AriaLabelingProps {\n /** Whether the grid uses virtual scrolling. */\n isVirtualized?: boolean,\n /**\n * Whether typeahead navigation is disabled.\n * @default false\n */\n disallowTypeAhead?: boolean,\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate,\n /**\n * Whether initial grid focus should be placed on the grid row or grid cell.\n * @default 'row'\n */\n focusMode?: 'row' | 'cell',\n /**\n * A function that returns the text that should be announced by assistive technology when a row is added or removed from selection.\n * @default (key) => state.collection.getItem(key)?.textValue\n */\n getRowText?: (key: Key) => string,\n /**\n * The ref attached to the scrollable body. Used to provided automatic scrolling on item focus for non-virtualized grids.\n */\n scrollRef?: RefObject<HTMLElement | null>,\n /** Handler that is called when a user performs an action on the row. */\n onRowAction?: (key: Key) => void,\n /** Handler that is called when a user performs an action on the cell. */\n onCellAction?: (key: Key) => void,\n /**\n * Whether pressing the escape key should clear selection in the grid or not.\n *\n * Most experiences should not modify this option as it eliminates a keyboard user's ability to\n * easily clear selection. Line truncated
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('before', require('../before'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,5 @@
<svg viewbox="0 0 18 18">
<line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"></line>
<line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"></line>
<line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"></line>
</svg>

After

Width:  |  Height:  |  Size: 222 B

@@ -0,0 +1,237 @@
/**
* Copyright (c) 2022 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { ColorContrastCache } from 'browser/ColorContrastCache';
import { IThemeService } from 'browser/services/Services';
import { IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
import { channels, color, css, NULL_COLOR } from 'common/Color';
import { EventEmitter } from 'common/EventEmitter';
import { Disposable } from 'common/Lifecycle';
import { IOptionsService, ITheme } from 'common/services/Services';
import { AllColorIndex, IColor, SpecialColorIndex } from 'common/Types';
interface IRestoreColorSet {
foreground: IColor;
background: IColor;
cursor: IColor;
ansi: IColor[];
}
const DEFAULT_FOREGROUND = css.toColor('#ffffff');
const DEFAULT_BACKGROUND = css.toColor('#000000');
const DEFAULT_CURSOR = css.toColor('#ffffff');
const DEFAULT_CURSOR_ACCENT = css.toColor('#000000');
const DEFAULT_SELECTION = {
css: 'rgba(255, 255, 255, 0.3)',
rgba: 0xFFFFFF4D
};
// An IIFE to generate DEFAULT_ANSI_COLORS.
export const DEFAULT_ANSI_COLORS = Object.freeze((() => {
const colors = [
// dark:
css.toColor('#2e3436'),
css.toColor('#cc0000'),
css.toColor('#4e9a06'),
css.toColor('#c4a000'),
css.toColor('#3465a4'),
css.toColor('#75507b'),
css.toColor('#06989a'),
css.toColor('#d3d7cf'),
// bright:
css.toColor('#555753'),
css.toColor('#ef2929'),
css.toColor('#8ae234'),
css.toColor('#fce94f'),
css.toColor('#729fcf'),
css.toColor('#ad7fa8'),
css.toColor('#34e2e2'),
css.toColor('#eeeeec')
];
// Fill in the remaining 240 ANSI colors.
// Generate colors (16-231)
const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];
for (let i = 0; i < 216; i++) {
const r = v[(i / 36) % 6 | 0];
const g = v[(i / 6) % 6 | 0];
const b = v[i % 6];
colors.push({
css: channels.toCss(r, g, b),
rgba: channels.toRgba(r, g, b)
});
}
// Generate greys (232-255)
for (let i = 0; i < 24; i++) {
const c = 8 + i * 10;
colors.push({
css: channels.toCss(c, c, c),
rgba: channels.toRgba(c, c, c)
});
}
return colors;
})());
export class ThemeService extends Disposable implements IThemeService {
public serviceBrand: undefined;
private _colors: IColorSet;
private _contrastCache: IColorContrastCache = new ColorContrastCache();
private _halfContrastCache: IColorContrastCache = new ColorContrastCache();
private _restoreColors!: IRestoreColorSet;
public get colors(): ReadonlyColorSet { return this._colors; }
private readonly _onChangeColors = this.register(new EventEmitter<ReadonlyColorSet>());
public readonly onChangeColors = this._onChangeColors.event;
constructor(
@IOptionsService private readonly _optionsService: IOptionsService
) {
super();
this._colors = {
foreground: DEFAULT_FOREGROUND,
background: DEFAULT_BACKGROUND,
cursor: DEFAULT_CURSOR,
cursorAccent: DEFAULT_CURSOR_ACCENT,
selectionForeground: undefined,
selectionBackgroundTransparent: DEFAULT_SELECTION,
selectionBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
selectionInactiveBackgroundTransparent: DEFAULT_SELECTION,
selectionInactiveBackgroundOpaque: color.blend(DEFAULT_BACKGROUND, DEFAULT_SELECTION),
ansi: DEFAULT_ANSI_COLORS.slice(),
contrastCache: this._contrastCache,
halfContrastCache: this._halfContrastCache
};
this._updateRestoreColors();
this._setTheme(this._optionsService.rawOptions.theme);
this.register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));
this.register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));
}
/**
* Sets the terminal's theme.
* @param theme The theme to use. If a partial theme is provided then default
* colors will be used where colors are not defined.
*/
private _setTheme(theme: ITheme = {}): void {
const colors = this._colors;
colors.foreground = parseColor(theme.foreground, DEFAULT_FOREGROUND);
colors.background = parseColor(theme.background, DEFAULT_BACKGROUND);
colors.cursor = parseColor(theme.cursor, DEFAULT_CURSOR);
colors.cursorAccent = parseColor(theme.cursorAccent, DEFAULT_CURSOR_ACCENT);
colors.selectionBackgroundTransparent = parseColor(theme.selectionBackground, DEFAULT_SELECTION);
colors.selectionBackgroundOpaque = color.blend(colors.background, colors.selectionBackgroundTransparent);
colors.selectionInactiveBackgroundTransparent = parseColor(theme.selectionInactiveBackground, colors.selectionBackgroundTransparent);
colors.selectionInactiveBackgroundOpaque = color.blend(colors.background, colors.selectionInactiveBackgroundTransparent);
colors.selectionForeground = theme.selectionForeground ? parseColor(theme.selectionForeground, NULL_COLOR) : undefined;
if (colors.selectionForeground === NULL_COLOR) {
colors.selectionForeground = undefined;
}
/**
* If selection color is opaque, blend it with background with 0.3 opacity
* Issue #2737
*/
if (color.isOpaque(colors.selectionBackgroundTransparent)) {
const opacity = 0.3;
colors.selectionBackgroundTransparent = color.opacity(colors.selectionBackgroundTransparent, opacity);
}
if (color.isOpaque(colors.selectionInactiveBackgroundTransparent)) {
const opacity = 0.3;
colors.selectionInactiveBackgroundTransparent = color.opacity(colors.selectionInactiveBackgroundTransparent, opacity);
}
colors.ansi = DEFAULT_ANSI_COLORS.slice();
colors.ansi[0] = parseColor(theme.black, DEFAULT_ANSI_COLORS[0]);
colors.ansi[1] = parseColor(theme.red, DEFAULT_ANSI_COLORS[1]);
colors.ansi[2] = parseColor(theme.green, DEFAULT_ANSI_COLORS[2]);
colors.ansi[3] = parseColor(theme.yellow, DEFAULT_ANSI_COLORS[3]);
colors.ansi[4] = parseColor(theme.blue, DEFAULT_ANSI_COLORS[4]);
colors.ansi[5] = parseColor(theme.magenta, DEFAULT_ANSI_COLORS[5]);
colors.ansi[6] = parseColor(theme.cyan, DEFAULT_ANSI_COLORS[6]);
colors.ansi[7] = parseColor(theme.white, DEFAULT_ANSI_COLORS[7]);
colors.ansi[8] = parseColor(theme.brightBlack, DEFAULT_ANSI_COLORS[8]);
colors.ansi[9] = parseColor(theme.brightRed, DEFAULT_ANSI_COLORS[9]);
colors.ansi[10] = parseColor(theme.brightGreen, DEFAULT_ANSI_COLORS[10]);
colors.ansi[11] = parseColor(theme.brightYellow, DEFAULT_ANSI_COLORS[11]);
colors.ansi[12] = parseColor(theme.brightBlue, DEFAULT_ANSI_COLORS[12]);
colors.ansi[13] = parseColor(theme.brightMagenta, DEFAULT_ANSI_COLORS[13]);
colors.ansi[14] = parseColor(theme.brightCyan, DEFAULT_ANSI_COLORS[14]);
colors.ansi[15] = parseColor(theme.brightWhite, DEFAULT_ANSI_COLORS[15]);
if (theme.extendedAnsi) {
const colorCount = Math.min(colors.ansi.length - 16, theme.extendedAnsi.length);
for (let i = 0; i < colorCount; i++) {
colors.ansi[i + 16] = parseColor(theme.extendedAnsi[i], DEFAULT_ANSI_COLORS[i + 16]);
}
}
// Clear our the cache
this._contrastCache.clear();
this._halfContrastCache.clear();
this._updateRestoreColors();
this._onChangeColors.fire(this.colors);
}
public restoreColor(slot?: AllColorIndex): void {
this._restoreColor(slot);
this._onChangeColors.fire(this.colors);
}
private _restoreColor(slot: AllColorIndex | undefined): void {
// unset slot restores all ansi colors
if (slot === undefined) {
for (let i = 0; i < this._restoreColors.ansi.length; ++i) {
this._colors.ansi[i] = this._restoreColors.ansi[i];
}
return;
}
switch (slot) {
case SpecialColorIndex.FOREGROUND:
this._colors.foreground = this._restoreColors.foreground;
break;
case SpecialColorIndex.BACKGROUND:
this._colors.background = this._restoreColors.background;
break;
case SpecialColorIndex.CURSOR:
this._colors.cursor = this._restoreColors.cursor;
break;
default:
this._colors.ansi[slot] = this._restoreColors.ansi[slot];
}
}
public modifyColors(callback: (colors: IColorSet) => void): void {
callback(this._colors);
// Assume the change happened
this._onChangeColors.fire(this.colors);
}
private _updateRestoreColors(): void {
this._restoreColors = {
foreground: this._colors.foreground,
background: this._colors.background,
cursor: this._colors.cursor,
ansi: this._colors.ansi.slice()
};
}
}
function parseColor(
cssString: string | undefined,
fallback: IColor
): IColor {
if (cssString !== undefined) {
try {
return css.toColor(cssString);
} catch {
// no-op
}
}
return fallback;
}
@@ -0,0 +1,171 @@
# @nodelib/fs.scandir
> List files and directories inside the specified directory.
## :bulb: Highlights
The package is aimed at obtaining information about entries in the directory.
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode).
* :link: Can safely work with broken symbolic links.
## Install
```console
npm install @nodelib/fs.scandir
```
## Usage
```ts
import * as fsScandir from '@nodelib/fs.scandir';
fsScandir.scandir('path', (error, stats) => { /* … */ });
```
## API
### .scandir(path, [optionsOrSettings], callback)
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style.
```ts
fsScandir.scandir('path', (error, entries) => { /* … */ });
fsScandir.scandir('path', {}, (error, entries) => { /* … */ });
fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ });
```
### .scandirSync(path, [optionsOrSettings])
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path.
```ts
const entries = fsScandir.scandirSync('path');
const entries = fsScandir.scandirSync('path', {});
const entries = fsScandir.scandirSync(('path', new fsScandir.Settings());
```
#### path
* Required: `true`
* Type: `string | Buffer | URL`
A path to a file. If a URL is provided, it must use the `file:` protocol.
#### optionsOrSettings
* Required: `false`
* Type: `Options | Settings`
* Default: An instance of `Settings` class
An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class.
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
### Settings([options])
A class of full settings of the package.
```ts
const settings = new fsScandir.Settings({ followSymbolicLinks: false });
const entries = fsScandir.scandirSync('path', settings);
```
## Entry
* `name` — The name of the entry (`unknown.txt`).
* `path` — The path of the entry relative to call directory (`root/unknown.txt`).
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class.
* `stats` (optional) — An instance of `fs.Stats` class.
For example, the `scandir` call for `tools` directory with one directory inside:
```ts
{
dirent: Dirent { name: 'typedoc', /* … */ },
name: 'typedoc',
path: 'tools/typedoc'
}
```
## Options
### stats
* Type: `boolean`
* Default: `false`
Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO??
### followSymbolicLinks
* Type: `boolean`
* Default: `false`
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
### `throwErrorOnBrokenSymbolicLink`
* Type: `boolean`
* Default: `true`
Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`.
### `pathSegmentSeparator`
* Type: `string`
* Default: `path.sep`
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead.
### `fs`
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
* Default: A default FS methods
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
```ts
interface FileSystemAdapter {
lstat?: typeof fs.lstat;
stat?: typeof fs.stat;
lstatSync?: typeof fs.lstatSync;
statSync?: typeof fs.statSync;
readdir?: typeof fs.readdir;
readdirSync?: typeof fs.readdirSync;
}
const settings = new fsScandir.Settings({
fs: { lstat: fakeLstat }
});
```
## `old` and `modern` mode
This package has two modes that are used depending on the environment and parameters of use.
### old
* Node.js below `10.10` or when the `stats` option is enabled
When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links).
### modern
* Node.js 10.10+ and the `stats` option is disabled
In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present.
This mode makes fewer calls to the file system. It's faster.
## Changelog
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
## License
This software is released under the terms of the MIT license.
@@ -0,0 +1,3 @@
import CryptoJS = require("./index");
export = CryptoJS.SHA3;
@@ -0,0 +1,14 @@
export { getInertValue } from './getInertValue.js';
export { Dict, __DEV__, __TEST__, dataAttr, isArray, isEmpty, isEmptyArray, isEmptyObject, isFunction, isNumeric, isObject } from '../../common/assertion.js';
export { clsx } from '../../common/clsx.js';
export { MergeObject, arrayToObject, cleanObject, cleanObjectKeys, compact, copyObject, getKeyValue, getProp, omitObject, renameProp } from '../../common/object.js';
export { safeAriaLabel, safeInitials, safeText } from '../../common/text.js';
export { getMargin } from '../../common/dimensions.js';
export { callAll, callAllHandlers, capitalize, debounce, extractProperty, get, getUniqueID, intersectionBy, kebabCase, mapKeys, objectToDeps, omit, removeEvents, uniqBy } from '../../common/functions.js';
export { clamp, clampPercentage, range } from '../../common/numbers.js';
export { warn } from '../../common/console.js';
export { Timer } from '../../common/types.js';
export { getGregorianYearOffset } from '../../common/dates.js';
export { isPatternNumeric } from '../../common/regex.js';
export { chain, idsUpdaterMap, mergeIds, mergeProps, mergeRefs } from '../../common/ra.js';
import 'react';
@@ -0,0 +1,212 @@
# negotiator
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
[![Test Coverage][coveralls-image]][coveralls-url]
An HTTP content negotiator for Node.js
## Installation
```sh
$ npm install negotiator
```
## API
```js
var Negotiator = require('negotiator')
```
### Accept Negotiation
```js
availableMediaTypes = ['text/html', 'text/plain', 'application/json']
// The negotiator constructor receives a request object
negotiator = new Negotiator(request)
// Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8'
negotiator.mediaTypes()
// -> ['text/html', 'image/jpeg', 'application/*']
negotiator.mediaTypes(availableMediaTypes)
// -> ['text/html', 'application/json']
negotiator.mediaType(availableMediaTypes)
// -> 'text/html'
```
You can check a working example at `examples/accept.js`.
#### Methods
##### mediaType()
Returns the most preferred media type from the client.
##### mediaType(availableMediaType)
Returns the most preferred media type from a list of available media types.
##### mediaTypes()
Returns an array of preferred media types ordered by the client preference.
##### mediaTypes(availableMediaTypes)
Returns an array of preferred media types ordered by priority from a list of
available media types.
### Accept-Language Negotiation
```js
negotiator = new Negotiator(request)
availableLanguages = ['en', 'es', 'fr']
// Let's say Accept-Language header is 'en;q=0.8, es, pt'
negotiator.languages()
// -> ['es', 'pt', 'en']
negotiator.languages(availableLanguages)
// -> ['es', 'en']
language = negotiator.language(availableLanguages)
// -> 'es'
```
You can check a working example at `examples/language.js`.
#### Methods
##### language()
Returns the most preferred language from the client.
##### language(availableLanguages)
Returns the most preferred language from a list of available languages.
##### languages()
Returns an array of preferred languages ordered by the client preference.
##### languages(availableLanguages)
Returns an array of preferred languages ordered by priority from a list of
available languages.
### Accept-Charset Negotiation
```js
availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5']
negotiator = new Negotiator(request)
// Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2'
negotiator.charsets()
// -> ['utf-8', 'iso-8859-1', 'utf-7']
negotiator.charsets(availableCharsets)
// -> ['utf-8', 'iso-8859-1']
negotiator.charset(availableCharsets)
// -> 'utf-8'
```
You can check a working example at `examples/charset.js`.
#### Methods
##### charset()
Returns the most preferred charset from the client.
##### charset(availableCharsets)
Returns the most preferred charset from a list of available charsets.
##### charsets()
Returns an array of preferred charsets ordered by the client preference.
##### charsets(availableCharsets)
Returns an array of preferred charsets ordered by priority from a list of
available charsets.
### Accept-Encoding Negotiation
```js
availableEncodings = ['identity', 'gzip']
negotiator = new Negotiator(request)
// Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5'
negotiator.encodings()
// -> ['gzip', 'identity', 'compress']
negotiator.encodings(availableEncodings)
// -> ['gzip', 'identity']
negotiator.encoding(availableEncodings)
// -> 'gzip'
```
You can check a working example at `examples/encoding.js`.
#### Methods
##### encoding()
Returns the most preferred encoding from the client.
##### encoding(availableEncodings)
Returns the most preferred encoding from a list of available encodings.
##### encoding(availableEncodings, { preferred })
Returns the most preferred encoding from a list of available encodings, while prioritizing based on `preferred` array between same-quality encodings.
##### encodings()
Returns an array of preferred encodings ordered by the client preference.
##### encodings(availableEncodings)
Returns an array of preferred encodings ordered by priority from a list of
available encodings.
##### encodings(availableEncodings, { preferred })
Returns an array of preferred encodings ordered by priority from a list of
available encodings, while prioritizing based on `preferred` array between same-quality encodings.
## See Also
The [accepts](https://npmjs.org/package/accepts#readme) module builds on
this module and provides an alternative interface, mime type validation,
and more.
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/negotiator.svg
[npm-url]: https://npmjs.org/package/negotiator
[node-version-image]: https://img.shields.io/node/v/negotiator.svg
[node-version-url]: https://nodejs.org/en/download/
[coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg
[coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master
[downloads-image]: https://img.shields.io/npm/dm/negotiator.svg
[downloads-url]: https://npmjs.org/package/negotiator
[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/negotiator/ci/master?label=ci
[github-actions-ci-url]: https://github.com/jshttp/negotiator/actions/workflows/ci.yml
@@ -0,0 +1,9 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
//"max-statements": [2, 12]
}
}
@@ -0,0 +1,20 @@
import * as Tokens from './token.mjs';
import * as Types from './types.mjs';
type ContextParser<Left extends Types.IParser, Right extends Types.IParser, Code extends string, Context extends unknown> = (Parse<Left, Code, Context> extends [infer Context extends unknown, infer Rest extends string] ? Parse<Right, Rest, Context> : []);
type ArrayParser<Parser extends Types.IParser, Code extends string, Context extends unknown, Result extends unknown[] = []> = (Parse<Parser, Code, Context> extends [infer Value1 extends unknown, infer Rest extends string] ? ArrayParser<Parser, Rest, Context, [...Result, Value1]> : [Result, Code]);
type ConstParser<Value extends string, Code extends string, _Context extends unknown> = (Tokens.Const<Value, Code> extends [infer Match extends Value, infer Rest extends string] ? [Match, Rest] : []);
type IdentParser<Code extends string, _Context extends unknown> = (Tokens.Ident<Code> extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []);
type NumberParser<Code extends string, _Context extends unknown> = (Tokens.Number<Code> extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []);
type OptionalParser<Parser extends Types.IParser, Code extends string, Context extends unknown> = (Parse<Parser, Code, Context> extends [infer Value extends unknown, infer Rest extends string] ? [[Value], Rest] : [[], Code]);
type StringParser<Options extends string[], Code extends string, _Context extends unknown> = (Tokens.String<Options, Code> extends [infer Match extends string, infer Rest extends string] ? [Match, Rest] : []);
type TupleParser<Parsers extends Types.IParser[], Code extends string, Context extends unknown, Result extends unknown[] = []> = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse<Left, Code, Context> extends [infer Value extends unknown, infer Rest extends string] ? TupleParser<Right, Rest, Context, [...Result, Value]> : [] : [Result, Code]);
type UnionParser<Parsers extends Types.IParser[], Code extends string, Context extends unknown> = (Parsers extends [infer Left extends Types.IParser, ...infer Right extends Types.IParser[]] ? Parse<Left, Code, Context> extends [infer Value extends unknown, infer Rest extends string] ? [Value, Rest] : UnionParser<Right, Code, Context> : []);
type ParseCode<Type extends Types.IParser, Code extends string, Context extends unknown = unknown> = (Type extends Types.Context<infer Left extends Types.IParser, infer Right extends Types.IParser> ? ContextParser<Left, Right, Code, Context> : Type extends Types.Array<infer Parser extends Types.IParser> ? ArrayParser<Parser, Code, Context> : Type extends Types.Const<infer Value extends string> ? ConstParser<Value, Code, Context> : Type extends Types.Ident ? IdentParser<Code, Context> : Type extends Types.Number ? NumberParser<Code, Context> : Type extends Types.Optional<infer Parser extends Types.IParser> ? OptionalParser<Parser, Code, Context> : Type extends Types.String<infer Options extends string[]> ? StringParser<Options, Code, Context> : Type extends Types.Tuple<infer Parsers extends Types.IParser[]> ? TupleParser<Parsers, Code, Context> : Type extends Types.Union<infer Parsers extends Types.IParser[]> ? UnionParser<Parsers, Code, Context> : [
]);
type ParseMapping<Parser extends Types.IParser, Result extends unknown, Context extends unknown = unknown> = ((Parser['mapping'] & {
input: Result;
context: Context;
})['output']);
/** Parses code with the given parser */
export type Parse<Type extends Types.IParser, Code extends string, Context extends unknown = unknown> = (ParseCode<Type, Code, Context> extends [infer L extends unknown, infer R extends string] ? [ParseMapping<Type, L, Context>, R] : []);
export {};
@@ -0,0 +1 @@
{"mappings":";;;;;;;AAAA;;;;;;;;;;AAUA;;;;;;AAuBO,SAAS,0CAAc,KAA4B,EAAE,KAAsB,EAAE,GAAkC;IACpH,IAAI,eACF,cAAc,kCACd,qBAAqB,aACtB,GAAG;IACJ,IAAI,cACF,UAAU,EACV,kBAAkB,OAAO,gBACzB,YAAY,EACb,GAAG;IACJ,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,WAAW,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,CAAA,GAAA,yCAAmB,EAClD,YACA,WACA,aACA,eAAe;QAAC;QAAY;QAAc;QAAa;KAAU;IAEnE,IAAI,mBAAC,eAAe,EAAC,GAAG,CAAA,GAAA,8BAAsB,EAAE;aAC9C;QACA,kBAAkB;QAClB,kBAAkB;QAClB,eAAe,uBAAuB;QACtC,wBAAwB;QACxB,WAAW;QACX,cAAc;IAChB;IAEA,+BAA+B;IAC/B,IAAI,SAAS,CAAA,GAAA,YAAI;IACjB,CAAA,GAAA,yCAAM,EAAE,GAAG,CAAC,OAAO;IAEnB,IAAI,oBAAoB,CAAA,GAAA,gBAAQ,EAAE;QAAC,GAAG,KAAK;QAAE,IAAI;IAAM;IAEvD,OAAO;QACL,cAAc;YACZ,GAAG,CAAA,GAAA,iBAAS,EAAE,iBAAiB,kBAAkB;YACjD,MAAM;YACN,oBAAoB;YACpB,UAAU;QACZ;IACF;AACF","sources":["packages/@react-aria/tabs/src/useTabList.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 {AriaTabListProps} from '@react-types/tabs';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\nimport {useMemo} from 'react';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface AriaTabListOptions<T> extends Omit<AriaTabListProps<T>, 'children'> {}\n\nexport interface TabListAria {\n /** Props for the tablist container. */\n tabListProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tab list.\n * Tabs organize content into multiple sections and allow users to navigate between them.\n */\nexport function useTabList<T>(props: AriaTabListOptions<T>, state: TabListState<T>, ref: RefObject<HTMLElement | null>): TabListAria {\n let {\n orientation = 'horizontal',\n keyboardActivation = 'automatic'\n } = props;\n let {\n collection,\n selectionManager: manager,\n disabledKeys\n } = state;\n let {direction} = useLocale();\n let delegate = useMemo(() => new TabsKeyboardDelegate(\n collection,\n direction,\n orientation,\n disabledKeys), [collection, disabledKeys, orientation, direction]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager: manager,\n keyboardDelegate: delegate,\n selectOnFocus: keyboardActivation === 'automatic',\n disallowEmptySelection: true,\n scrollRef: ref,\n linkBehavior: 'selection'\n });\n\n // Compute base id for all tabs\n let tabsId = useId();\n tabsIds.set(state, tabsId);\n\n let tabListLabelProps = useLabels({...props, id: tabsId});\n\n return {\n tabListProps: {\n ...mergeProps(collectionProps, tabListLabelProps),\n role: 'tablist',\n 'aria-orientation': orientation,\n tabIndex: undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"useTabList.module.js.map"}
@@ -0,0 +1,50 @@
'use strict';
var through = require('through2');
var mkdirp = require('./mkdirp');
function toFunction(dirpath) {
function stringResolver(chunk, callback) {
callback(null, dirpath);
}
return stringResolver;
}
function define(options) {
function mkdirpStream(resolver) {
// Handle resolver that's just a dirpath
if (typeof resolver === 'string') {
resolver = toFunction(resolver);
}
function makeFileDirs(chunk, enc, callback) {
resolver(chunk, onDirpath);
function onDirpath(dirpathErr, dirpath, mode) {
if (dirpathErr) {
return callback(dirpathErr);
}
mkdirp(dirpath, mode, onMkdirp);
}
function onMkdirp(mkdirpErr) {
if (mkdirpErr) {
return callback(mkdirpErr);
}
callback(null, chunk);
}
}
return through(options, makeFileDirs);
}
return mkdirpStream;
}
module.exports = define();
module.exports.obj = define({ objectMode: true, highWaterMark: 16 });
@@ -0,0 +1,16 @@
function _object_without_properties_loose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
export { _object_without_properties_loose as _ };
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAsJA;;;;;;;;;;;GAWG;AACH,kCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,YAAY,CAOxB;AAED;;;;;;;;;;;;GAYG;AACH,uCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,OAAO,CAAC,YAAY,CAAC,CAQjC;AAED;;;;;;;;;;;;GAYG;AACH,uCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,YAAY,CAgCxB;AAgLD;;;;;;;;GAQG;AACH,2CALW,MAAM,GAEJ,MAAM,CA0BlB;;;;qCA1aU,QAAQ,CAAC,OAAO,CAAC,SAEjB,MAAM,UAEN,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,KAE3B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;WAOzB,OAAO,GAAG,SAAS;;;;;yBAKpB,GACP,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,eAAe,GAAG,CAAC,GAAG,UAAU,CAAC,GACtF;;;;;;;;UAOU,MAAM;;;;QAEN,MAAM;;;;SAEN,MAAM,OAAO;;;;;;;;;;mBAOb,YAAY,GAAG,IAAI,GAAG,SAAS;;;;;sBAG/B,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;eAGxC,MAAM,GAAG,IAAI,GAAG,SAAS;;;;gBAEzB,MAAM,GAAG,IAAI,GAAG,SAAS;;;;iBAEzB,UAAU,GAAG,IAAI,GAAG,SAAS;;;;;yBAE7B,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;oBAGxC,aAAa,GAAG,IAAI,GAAG,SAAS;;;;oBAEhC,aAAa,GAAG,IAAI,GAAG,SAAS;;;;0BAEhC,QAAQ,CAAC,mBAAmB,CAAC,GAAG,IAAI,GAAG,SAAS;;;;eAEhD,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;uBAE1B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;mBAI1B,YAAY,GAAG,IAAI,GAAG,SAAS;;;;;iCAOlC,MAAM,OAEN,MAAM,QAEN,QAAQ,CAAC,OAAO,CAAC,KAEf,MAAM,GAAG,IAAI,GAAG,SAAS;kCAvFsB,OAAO;6BAFH,MAAM;6BAAN,MAAM;iCAEV,OAAO;oCAAP,OAAO;mCAGxB,SAAS;oDAFH,eAAe"}
@@ -0,0 +1,53 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { Terminal, ITerminalAddon, IViewportRange } from '@xterm/xterm';
declare module '@xterm/addon-web-links' {
/**
* An xterm.js addon that enables web links.
*/
export class WebLinksAddon implements ITerminalAddon {
/**
* Creates a new web links addon.
* @param handler The callback when the link is called.
* @param options Options for the link provider.
*/
constructor(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkProviderOptions);
/**
* Activates the addon
* @param terminal The terminal the addon is being loaded in.
*/
public activate(terminal: Terminal): void;
/**
* Disposes the addon.
*/
public dispose(): void;
}
/**
* An object containing options for a link provider.
*/
export interface ILinkProviderOptions {
/**
* A callback that fires when the mouse hovers over a link.
*/
hover?(event: MouseEvent, text: string, location: IViewportRange): void;
/**
* A callback that fires when the mouse leaves a link. Note that this can
* happen even when tooltipCallback hasn't fired for the link yet.
*/
leave?(event: MouseEvent, text: string): void;
/**
* A callback to use instead of the default one.
*/
urlRegex?: RegExp;
}
}
@@ -0,0 +1,5 @@
import type { TSchema, SchemaOptions } from '../schema/index.mjs';
import { type TIntrinsic } from './intrinsic.mjs';
export type TLowercase<T extends TSchema> = TIntrinsic<T, 'Lowercase'>;
/** `[Json]` Intrinsic function to Lowercase LiteralString types */
export declare function Lowercase<T extends TSchema>(T: T, options?: SchemaOptions): TLowercase<T>;
@@ -0,0 +1,3 @@
export * from './pick-from-mapped-key';
export * from './pick-from-mapped-result';
export * from './pick';
@@ -0,0 +1,3 @@
/*! https://mths.be/repeat v1.0.0 by @mathias */
require('./shim')();
@@ -0,0 +1,41 @@
# Pend
Dead-simple optimistic async helper.
## Usage
```js
var Pend = require('pend');
var pend = new Pend();
pend.max = 10; // defaults to Infinity
setTimeout(pend.hold(), 1000); // pend.wait will have to wait for this hold to finish
pend.go(function(cb) {
console.log("this function is immediately executed");
setTimeout(function() {
console.log("calling cb 1");
cb();
}, 500);
});
pend.go(function(cb) {
console.log("this function is also immediately executed");
setTimeout(function() {
console.log("calling cb 2");
cb();
}, 1000);
});
pend.wait(function(err) {
console.log("this is excuted when the first 2 have returned.");
console.log("err is a possible error in the standard callback style.");
});
```
Output:
```
this function is immediately executed
this function is also immediately executed
calling cb 1
calling cb 2
this is excuted when the first 2 have returned.
err is a possible error in the standard callback style.
```
@@ -0,0 +1,4 @@
import getGeneratorFunction from './index.js';
/** @type {import('./index.d.mts').default} */
export default getGeneratorFunction;
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,MAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/sr-SP.json"],"sourcesContent":["{\n \"dismiss\": \"Odbaci\"\n}\n"],"names":[],"version":3,"file":"sr-SP.main.js.map"}
@@ -0,0 +1,30 @@
export declare function repeat(s: string, times: number): string;
export declare function setInternalSlot<Instance extends object, Internal extends object, Field extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, field: Field, value: NonNullable<Internal>[Field]): void;
export declare function setMultiInternalSlots<Instance extends object, Internal extends object, K extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, props: Pick<NonNullable<Internal>, K>): void;
export declare function getInternalSlot<Instance extends object, Internal extends object, Field extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, field: Field): Internal[Field];
export declare function getMultiInternalSlots<Instance extends object, Internal extends object, Field extends keyof Internal>(map: WeakMap<Instance, Internal>, pl: Instance, ...fields: Field[]): Pick<Internal, Field>;
export interface LiteralPart {
type: 'literal';
value: string;
}
export declare function isLiteralPart(patternPart: LiteralPart | {
type: string;
value?: string;
}): patternPart is LiteralPart;
export declare function defineProperty<T extends object>(target: T, name: string | symbol, { value }: {
value: any;
} & ThisType<any>): void;
/**
* 7.3.5 CreateDataProperty
* @param target
* @param name
* @param value
*/
export declare function createDataProperty<T extends object>(target: T, name: string | symbol, value: any): void;
export declare const UNICODE_EXTENSION_SEQUENCE_REGEX: RegExp;
export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
export declare const createMemoizedNumberFormat: (...args: ConstructorParameters<typeof Intl.NumberFormat>) => Intl.NumberFormat;
export declare const createMemoizedDateTimeFormat: (...args: ConstructorParameters<typeof Intl.DateTimeFormat>) => Intl.DateTimeFormat;
export declare const createMemoizedPluralRules: (...args: ConstructorParameters<typeof Intl.PluralRules>) => Intl.PluralRules;
export declare const createMemoizedLocale: (...args: ConstructorParameters<typeof Intl.Locale>) => Intl.Locale;
export declare const createMemoizedListFormat: (...args: ConstructorParameters<typeof Intl.ListFormat>) => Intl.ListFormat;
@@ -0,0 +1,295 @@
/**
* @import {
* Construct,
* State,
* TokenizeContext,
* Tokenizer
* } from 'micromark-util-types'
*/
import {ok as assert} from 'devlop'
import {factoryDestination} from 'micromark-factory-destination'
import {factoryLabel} from 'micromark-factory-label'
import {factorySpace} from 'micromark-factory-space'
import {factoryTitle} from 'micromark-factory-title'
import {factoryWhitespace} from 'micromark-factory-whitespace'
import {
markdownLineEndingOrSpace,
markdownLineEnding,
markdownSpace
} from 'micromark-util-character'
import {normalizeIdentifier} from 'micromark-util-normalize-identifier'
import {codes, types} from 'micromark-util-symbol'
/** @type {Construct} */
export const definition = {name: 'definition', tokenize: tokenizeDefinition}
/** @type {Construct} */
const titleBefore = {partial: true, tokenize: tokenizeTitleBefore}
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeDefinition(effects, ok, nok) {
const self = this
/** @type {string} */
let identifier
return start
/**
* At start of a definition.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function start(code) {
// Do not interrupt paragraphs (but do follow definitions).
// To do: do `interrupt` the way `markdown-rs` does.
// To do: parse whitespace the way `markdown-rs` does.
effects.enter(types.definition)
return before(code)
}
/**
* After optional whitespace, at `[`.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function before(code) {
// To do: parse whitespace the way `markdown-rs` does.
assert(code === codes.leftSquareBracket, 'expected `[`')
return factoryLabel.call(
self,
effects,
labelAfter,
// Note: we don’t need to reset the way `markdown-rs` does.
nok,
types.definitionLabel,
types.definitionLabelMarker,
types.definitionLabelString
)(code)
}
/**
* After label.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function labelAfter(code) {
identifier = normalizeIdentifier(
self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)
)
if (code === codes.colon) {
effects.enter(types.definitionMarker)
effects.consume(code)
effects.exit(types.definitionMarker)
return markerAfter
}
return nok(code)
}
/**
* After marker.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function markerAfter(code) {
// Note: whitespace is optional.
return markdownLineEndingOrSpace(code)
? factoryWhitespace(effects, destinationBefore)(code)
: destinationBefore(code)
}
/**
* Before destination.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function destinationBefore(code) {
return factoryDestination(
effects,
destinationAfter,
// Note: we don’t need to reset the way `markdown-rs` does.
nok,
types.definitionDestination,
types.definitionDestinationLiteral,
types.definitionDestinationLiteralMarker,
types.definitionDestinationRaw,
types.definitionDestinationString
)(code)
}
/**
* After destination.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function destinationAfter(code) {
return effects.attempt(titleBefore, after, after)(code)
}
/**
* After definition.
*
* ```markdown
* > | [a]: b
* ^
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function after(code) {
return markdownSpace(code)
? factorySpace(effects, afterWhitespace, types.whitespace)(code)
: afterWhitespace(code)
}
/**
* After definition, after optional whitespace.
*
* ```markdown
* > | [a]: b
* ^
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function afterWhitespace(code) {
if (code === codes.eof || markdownLineEnding(code)) {
effects.exit(types.definition)
// Note: we don’t care about uniqueness.
// It’s likely that that doesn’t happen very frequently.
// It is more likely that it wastes precious time.
self.parser.defined.push(identifier)
// To do: `markdown-rs` interrupt.
// // You’d be interrupting.
// tokenizer.interrupt = true
return ok(code)
}
return nok(code)
}
}
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeTitleBefore(effects, ok, nok) {
return titleBefore
/**
* After destination, at whitespace.
*
* ```markdown
* > | [a]: b
* ^
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function titleBefore(code) {
return markdownLineEndingOrSpace(code)
? factoryWhitespace(effects, beforeMarker)(code)
: nok(code)
}
/**
* At title.
*
* ```markdown
* | [a]: b
* > | "c"
* ^
* ```
*
* @type {State}
*/
function beforeMarker(code) {
return factoryTitle(
effects,
titleAfter,
nok,
types.definitionTitle,
types.definitionTitleMarker,
types.definitionTitleString
)(code)
}
/**
* After title.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function titleAfter(code) {
return markdownSpace(code)
? factorySpace(
effects,
titleAfterOptionalWhitespace,
types.whitespace
)(code)
: titleAfterOptionalWhitespace(code)
}
/**
* After title, after optional whitespace.
*
* ```markdown
* > | [a]: b "c"
* ^
* ```
*
* @type {State}
*/
function titleAfterOptionalWhitespace(code) {
return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code)
}
}
@@ -0,0 +1,142 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const confusingOperators = new Set([
'=',
'==',
'===',
'in',
'instanceof',
]);
function isConfusingOperator(operator) {
return confusingOperators.has(operator);
}
exports.default = (0, util_1.createRule)({
name: 'no-confusing-non-null-assertion',
meta: {
type: 'problem',
docs: {
description: 'Disallow non-null assertion in locations that may be confusing',
recommended: 'stylistic',
},
hasSuggestions: true,
messages: {
confusingAssign: 'Confusing combination of non-null assertion and assignment like `a! = b`, which looks very similar to `a != b`.',
confusingEqual: 'Confusing combination of non-null assertion and equality test like `a! == b`, which looks very similar to `a !== b`.',
confusingOperator: 'Confusing combination of non-null assertion and `{{operator}}` operator like `a! {{operator}} b`, which might be misinterpreted as `!(a {{operator}} b)`.',
notNeedInAssign: 'Remove unnecessary non-null assertion (!) in assignment left-hand side.',
notNeedInEqualTest: 'Remove unnecessary non-null assertion (!) in equality test.',
notNeedInOperator: 'Remove possibly unnecessary non-null assertion (!) in the left operand of the `{{operator}}` operator.',
wrapUpLeft: 'Wrap the left-hand side in parentheses to avoid confusion with "{{operator}}" operator.',
},
schema: [],
},
defaultOptions: [],
create(context) {
function confusingOperatorToMessageData(operator) {
switch (operator) {
case '=':
return {
messageId: 'confusingAssign',
};
case '==':
case '===':
return {
messageId: 'confusingEqual',
};
case 'in':
case 'instanceof':
return {
messageId: 'confusingOperator',
data: { operator },
};
// istanbul ignore next
default:
operator;
throw new Error(`Unexpected operator ${operator}`);
}
}
return {
'BinaryExpression, AssignmentExpression'(node) {
const operator = node.operator;
if (isConfusingOperator(operator)) {
// Look for a non-null assertion as the last token on the left hand side.
// That way, we catch things like `1 + two! === 3`, even though the left
// hand side isn't a non-null assertion AST node.
const leftHandFinalToken = context.sourceCode.getLastToken(node.left);
const tokenAfterLeft = context.sourceCode.getTokenAfter(node.left);
if (leftHandFinalToken?.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
leftHandFinalToken.value === '!' &&
tokenAfterLeft?.value !== ')') {
if (node.left.type === utils_1.AST_NODE_TYPES.TSNonNullExpression) {
let suggestions;
switch (operator) {
case '=':
suggestions = [
{
messageId: 'notNeedInAssign',
fix: (fixer) => fixer.remove(leftHandFinalToken),
},
];
break;
case '==':
case '===':
suggestions = [
{
messageId: 'notNeedInEqualTest',
fix: (fixer) => fixer.remove(leftHandFinalToken),
},
];
break;
case 'in':
case 'instanceof':
suggestions = [
{
messageId: 'notNeedInOperator',
data: { operator },
fix: (fixer) => fixer.remove(leftHandFinalToken),
},
{
messageId: 'wrapUpLeft',
data: { operator },
fix: wrapUpLeftFixer(node),
},
];
break;
// istanbul ignore next
default:
operator;
return;
}
context.report({
node,
...confusingOperatorToMessageData(operator),
suggest: suggestions,
});
}
else {
context.report({
node,
...confusingOperatorToMessageData(operator),
suggest: [
{
messageId: 'wrapUpLeft',
data: { operator },
fix: wrapUpLeftFixer(node),
},
],
});
}
}
}
},
};
},
});
function wrapUpLeftFixer(node) {
return (fixer) => [
fixer.insertTextBefore(node.left, '('),
fixer.insertTextAfter(node.left, ')'),
];
}
@@ -0,0 +1,13 @@
'use strict';
const plugin = require('..');
const legacyConfig = plugin.configs['jsx-runtime'];
module.exports = {
plugins: { react: plugin },
rules: legacyConfig.rules,
languageOptions: { parserOptions: legacyConfig.parserOptions },
};
Object.defineProperty(module.exports, 'languageOptions', { enumerable: false });
@@ -0,0 +1 @@
!function(a,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(a="undefined"!=typeof globalThis?globalThis:a||self).dayjs_locale_uz_latn=e(a.dayjs)}(this,(function(a){"use strict";function e(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}var _=e(a),n={name:"uz-latn",weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),weekStart:1,weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),ordinal:function(a){return a},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},relativeTime:{future:"Yaqin %s ichida",past:"%s oldin",s:"soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"}};return _.default.locale(n,null,!0),n}));
@@ -0,0 +1,43 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("eslint-utils")
module.exports = {
meta: {
docs: {
description: "disallow the `Math.tanh` method.",
category: "ES2015",
recommended: false,
url:
"http://mysticatea.github.io/eslint-plugin-es/rules/no-math-tanh.html",
},
fixable: null,
messages: {
forbidden: "ES2015 '{{name}}' method is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"() {
const tracker = new ReferenceTracker(context.getScope())
for (const { node, path } of tracker.iterateGlobalReferences({
Math: {
tanh: { [READ]: true },
},
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,41 @@
import {useLocale as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7} from "./context.mjs";
import {LocalizedStringDictionary as $6ksNp$LocalizedStringDictionary, LocalizedStringFormatter as $6ksNp$LocalizedStringFormatter} from "@internationalized/string";
import {useMemo as $6ksNp$useMemo} from "react";
/*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $fca6afa0e843324b$var$cache = new WeakMap();
function $fca6afa0e843324b$var$getCachedDictionary(strings) {
let dictionary = $fca6afa0e843324b$var$cache.get(strings);
if (!dictionary) {
dictionary = new (0, $6ksNp$LocalizedStringDictionary)(strings);
$fca6afa0e843324b$var$cache.set(strings, dictionary);
}
return dictionary;
}
function $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName) {
return packageName && (0, $6ksNp$LocalizedStringDictionary).getGlobalDictionaryForPackage(packageName) || $fca6afa0e843324b$var$getCachedDictionary(strings);
}
function $fca6afa0e843324b$export$f12b703ca79dfbb1(strings, packageName) {
let { locale: locale } = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)();
let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName);
return (0, $6ksNp$useMemo)(()=>new (0, $6ksNp$LocalizedStringFormatter)(locale, dictionary), [
locale,
dictionary
]);
}
export {$fca6afa0e843324b$export$87b761675e8eaa10 as useLocalizedStringDictionary, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter};
//# sourceMappingURL=useLocalizedStringFormatter.module.js.map
@@ -0,0 +1,13 @@
"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.es2020_number = void 0;
const base_config_1 = require("./base-config");
const es2020_intl_1 = require("./es2020.intl");
exports.es2020_number = {
libs: [es2020_intl_1.es2020_intl],
variables: [['Number', base_config_1.TYPE]],
};
@@ -0,0 +1,24 @@
# @heroui/use-aria-button
A Quick description of the component
> This is an internal utility, not intended for public usage.
## Installation
```sh
yarn add @heroui/use-aria-button
# or
npm i @heroui/use-aria-button
```
## Contribution
Yes please! See the
[contributing guidelines](https://github.com/frontio-ai/heroui/blob/master/CONTRIBUTING.md)
for details.
## License
This project is licensed under the terms of the
[MIT license](https://github.com/frontio-ai/heroui/blob/master/LICENSE).
@@ -0,0 +1,6 @@
module.exports = {
"dismiss": `Elutas\xedt\xe1s`
};
//# sourceMappingURL=hu-HU.main.js.map
@@ -0,0 +1,39 @@
{{## def.checkMissingProperty:_properties:
{{~ _properties:$propertyKey:$i }}
{{?$i}} || {{?}}
{{
var $prop = it.util.getProperty($propertyKey)
, $useData = $data + $prop;
}}
( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) )
{{~}}
#}}
{{## def.errorMissingProperty:_error:
{{
var $propertyPath = 'missing' + $lvl
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
if (it.opts._errorDataPathProperty) {
it.errorPath = it.opts.jsonPointers
? it.util.getPathExpr($currentErrorPath, $propertyPath, true)
: $currentErrorPath + ' + ' + $propertyPath;
}
}}
{{# def.error:_error }}
#}}
{{## def.allErrorsMissingProperty:_error:
{{
var $prop = it.util.getProperty($propertyKey)
, $missingProperty = it.util.escapeQuotes($propertyKey)
, $useData = $data + $prop;
if (it.opts._errorDataPathProperty) {
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
}
}}
if ({{# def.noPropertyInData }}) {
{{# def.addError:_error }}
}
#}}
@@ -0,0 +1,68 @@
/**
* @fileoverview Rule to disallow `javascript:` URLs
* @author Ilya Volodin
*/
/* eslint no-script-url: 0 -- Code is checking to report such URLs */
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow `javascript:` URLs",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-script-url",
},
schema: [],
messages: {
unexpectedScriptURL: "Script URL is a form of eval.",
},
},
create(context) {
/**
* Check whether a node's static value starts with `javascript:` or not.
* And report an error for unexpected script URL.
* @param {ASTNode} node node to check
* @returns {void}
*/
function check(node) {
const value = astUtils.getStaticStringValue(node);
if (
typeof value === "string" &&
value.toLowerCase().indexOf("javascript:") === 0
) {
context.report({ node, messageId: "unexpectedScriptURL" });
}
}
return {
Literal(node) {
if (node.value && typeof node.value === "string") {
check(node);
}
},
TemplateLiteral(node) {
if (
!(
node.parent &&
node.parent.type === "TaggedTemplateExpression"
)
) {
check(node);
}
},
};
},
};
@@ -0,0 +1,98 @@
/**
* @author Jamund Ferguson
* See LICENSE file in root directory for full license.
*/
"use strict"
const { getScope } = require("../util/eslint-compat")
/**
* @typedef {[string?]} RuleOptions
*/
/** @type {import('./rule-module').RuleModule<{RuleOptions: RuleOptions}>} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "require error handling in callbacks",
recommended: false,
url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/handle-callback-err.md",
},
fixable: null,
schema: [
{
type: "string",
},
],
messages: {
expected: "Expected error to be handled.",
},
},
create(context) {
const errorArgument = context.options[0] || "err"
/**
* Checks if the given argument should be interpreted as a regexp pattern.
* @param {string} stringToCheck The string which should be checked.
* @returns {boolean} Whether or not the string should be interpreted as a pattern.
*/
function isPattern(stringToCheck) {
const firstChar = stringToCheck[0]
return firstChar === "^"
}
/**
* Checks if the given name matches the configured error argument.
* @param {string} name The name which should be compared.
* @returns {boolean} Whether or not the given name matches the configured error variable name.
*/
function matchesConfiguredErrorName(name) {
if (isPattern(errorArgument)) {
const regexp = new RegExp(errorArgument, "u")
return regexp.test(name)
}
return name === errorArgument
}
/**
* Get the parameters of a given function scope.
* @param {import('eslint').Scope.Scope} scope The function scope.
* @returns {import('eslint').Scope.Variable[]} All parameters of the given scope.
*/
function getParameters(scope) {
return scope.variables.filter(
variable =>
variable.defs[0] && variable.defs[0].type === "Parameter"
)
}
/**
* Check to see if we're handling the error object properly.
* @param {import('estree').Node} node The AST node to check.
* @returns {void}
*/
function checkForError(node) {
const scope = getScope(context, node)
const parameters = getParameters(scope)
const firstParameter = parameters[0]
if (
firstParameter &&
matchesConfiguredErrorName(firstParameter.name)
) {
if (firstParameter.references.length === 0) {
context.report({ node, messageId: "expected" })
}
}
}
return {
FunctionDeclaration: checkForError,
FunctionExpression: checkForError,
ArrowFunctionExpression: checkForError,
}
},
}
@@ -0,0 +1,102 @@
"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/navbar-menu-toggle.tsx
var navbar_menu_toggle_exports = {};
__export(navbar_menu_toggle_exports, {
default: () => navbar_menu_toggle_default
});
module.exports = __toCommonJS(navbar_menu_toggle_exports);
var import_button = require("@react-aria/button");
var import_system = require("@heroui/system");
var import_react_utils2 = require("@heroui/react-utils");
var import_shared_utils = require("@heroui/shared-utils");
var import_toggle = require("@react-stately/toggle");
var import_focus = require("@react-aria/focus");
var import_utils = require("@react-aria/utils");
var import_interactions = require("@react-aria/interactions");
var import_react = require("react");
// src/navbar-context.ts
var import_react_utils = require("@heroui/react-utils");
var [NavbarProvider, useNavbarContext] = (0, import_react_utils.createContext)({
name: "NavbarContext",
strict: true,
errorMessage: "useNavbarContext: `context` is undefined. Seems you forgot to wrap component within <Navbar />"
});
// src/navbar-menu-toggle.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var NavbarMenuToggle = (0, import_system.forwardRef)((props, ref) => {
var _a;
const {
as,
icon,
className,
onChange,
autoFocus,
srOnlyText: srOnlyTextProp,
...otherProps
} = props;
const Component = as || "button";
const domRef = (0, import_react_utils2.useDOMRef)(ref);
const { slots, classNames, isMenuOpen, setIsMenuOpen } = useNavbarContext();
const handleChange = (isOpen) => {
onChange == null ? void 0 : onChange(isOpen);
setIsMenuOpen(isOpen);
};
const state = (0, import_toggle.useToggleState)({ ...otherProps, isSelected: isMenuOpen, onChange: handleChange });
const { buttonProps, isPressed } = (0, import_button.useToggleButton)(props, state, domRef);
const { isFocusVisible, focusProps } = (0, import_focus.useFocusRing)({ autoFocus });
const { isHovered, hoverProps } = (0, import_interactions.useHover)({});
const toggleStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.toggle, className);
const child = (0, import_react.useMemo)(() => {
if (typeof icon === "function") {
return icon(isMenuOpen != null ? isMenuOpen : false);
}
return icon || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.toggleIcon({ class: classNames == null ? void 0 : classNames.toggleIcon }) });
}, [icon, isMenuOpen, slots.toggleIcon, classNames == null ? void 0 : classNames.toggleIcon]);
const srOnlyText = (0, import_react.useMemo)(() => {
if (srOnlyTextProp) {
return srOnlyTextProp;
}
return state.isSelected ? "close navigation menu" : "open navigation menu";
}, [srOnlyTextProp, isMenuOpen]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
Component,
{
ref: domRef,
className: (_a = slots.toggle) == null ? void 0 : _a.call(slots, { class: toggleStyles }),
"data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
"data-hover": (0, import_shared_utils.dataAttr)(isHovered),
"data-open": (0, import_shared_utils.dataAttr)(isMenuOpen),
"data-pressed": (0, import_shared_utils.dataAttr)(isPressed),
...(0, import_utils.mergeProps)(buttonProps, focusProps, hoverProps, otherProps),
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: slots.srOnly(), children: srOnlyText }),
child
]
}
);
});
NavbarMenuToggle.displayName = "HeroUI.NavbarMenuToggle";
var navbar_menu_toggle_default = NavbarMenuToggle;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
@@ -0,0 +1,159 @@
var $82z6W$reactariautils = require("@react-aria/utils");
var $82z6W$react = require("react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useHover", () => $ffbc150311c75f01$export$ae780daf29e6d456);
/*
* 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
// iOS fires onPointerEnter twice: once with pointerType="touch" and again with pointerType="mouse".
// We want to ignore these emulated events so they do not trigger hover behavior.
// See https://bugs.webkit.org/show_bug.cgi?id=214609.
let $ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents = false;
let $ffbc150311c75f01$var$hoverCount = 0;
function $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents() {
$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents = true;
// Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter
// with pointerType="mouse" immediately after onPointerUp and before onFocus. On other
// devices that don't have this quirk, we don't want to ignore a mouse hover sometime in
// the distant future because a user previously touched the element.
setTimeout(()=>{
$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents = false;
}, 50);
}
function $ffbc150311c75f01$var$handleGlobalPointerEvent(e) {
if (e.pointerType === 'touch') $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents();
}
function $ffbc150311c75f01$var$setupGlobalTouchEvents() {
if (typeof document === 'undefined') return;
if ($ffbc150311c75f01$var$hoverCount === 0) {
if (typeof PointerEvent !== 'undefined') document.addEventListener('pointerup', $ffbc150311c75f01$var$handleGlobalPointerEvent);
else if (process.env.NODE_ENV === 'test') document.addEventListener('touchend', $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
}
$ffbc150311c75f01$var$hoverCount++;
return ()=>{
$ffbc150311c75f01$var$hoverCount--;
if ($ffbc150311c75f01$var$hoverCount > 0) return;
if (typeof PointerEvent !== 'undefined') document.removeEventListener('pointerup', $ffbc150311c75f01$var$handleGlobalPointerEvent);
else if (process.env.NODE_ENV === 'test') document.removeEventListener('touchend', $ffbc150311c75f01$var$setGlobalIgnoreEmulatedMouseEvents);
};
}
function $ffbc150311c75f01$export$ae780daf29e6d456(props) {
let { onHoverStart: onHoverStart, onHoverChange: onHoverChange, onHoverEnd: onHoverEnd, isDisabled: isDisabled } = props;
let [isHovered, setHovered] = (0, $82z6W$react.useState)(false);
let state = (0, $82z6W$react.useRef)({
isHovered: false,
ignoreEmulatedMouseEvents: false,
pointerType: '',
target: null
}).current;
(0, $82z6W$react.useEffect)($ffbc150311c75f01$var$setupGlobalTouchEvents, []);
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $82z6W$reactariautils.useGlobalListeners)();
let { hoverProps: hoverProps, triggerHoverEnd: triggerHoverEnd } = (0, $82z6W$react.useMemo)(()=>{
let triggerHoverStart = (event, pointerType)=>{
state.pointerType = pointerType;
if (isDisabled || pointerType === 'touch' || state.isHovered || !event.currentTarget.contains(event.target)) return;
state.isHovered = true;
let target = event.currentTarget;
state.target = target;
// When an element that is hovered over is removed, no pointerleave event is fired by the browser,
// even though the originally hovered target may have shrunk in size so it is no longer hovered.
// However, a pointerover event will be fired on the new target the mouse is over.
// In Chrome this happens immediately. In Safari and Firefox, it happens upon moving the mouse one pixel.
addGlobalListener((0, $82z6W$reactariautils.getOwnerDocument)(event.target), 'pointerover', (e)=>{
if (state.isHovered && state.target && !(0, $82z6W$reactariautils.nodeContains)(state.target, e.target)) triggerHoverEnd(e, e.pointerType);
}, {
capture: true
});
if (onHoverStart) onHoverStart({
type: 'hoverstart',
target: target,
pointerType: pointerType
});
if (onHoverChange) onHoverChange(true);
setHovered(true);
};
let triggerHoverEnd = (event, pointerType)=>{
let target = state.target;
state.pointerType = '';
state.target = null;
if (pointerType === 'touch' || !state.isHovered || !target) return;
state.isHovered = false;
removeAllGlobalListeners();
if (onHoverEnd) onHoverEnd({
type: 'hoverend',
target: target,
pointerType: pointerType
});
if (onHoverChange) onHoverChange(false);
setHovered(false);
};
let hoverProps = {};
if (typeof PointerEvent !== 'undefined') {
hoverProps.onPointerEnter = (e)=>{
if ($ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents && e.pointerType === 'mouse') return;
triggerHoverStart(e, e.pointerType);
};
hoverProps.onPointerLeave = (e)=>{
if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, e.pointerType);
};
} else if (process.env.NODE_ENV === 'test') {
hoverProps.onTouchStart = ()=>{
state.ignoreEmulatedMouseEvents = true;
};
hoverProps.onMouseEnter = (e)=>{
if (!state.ignoreEmulatedMouseEvents && !$ffbc150311c75f01$var$globalIgnoreEmulatedMouseEvents) triggerHoverStart(e, 'mouse');
state.ignoreEmulatedMouseEvents = false;
};
hoverProps.onMouseLeave = (e)=>{
if (!isDisabled && e.currentTarget.contains(e.target)) triggerHoverEnd(e, 'mouse');
};
}
return {
hoverProps: hoverProps,
triggerHoverEnd: triggerHoverEnd
};
}, [
onHoverStart,
onHoverChange,
onHoverEnd,
isDisabled,
state,
addGlobalListener,
removeAllGlobalListeners
]);
(0, $82z6W$react.useEffect)(()=>{
// Call the triggerHoverEnd as soon as isDisabled changes to true
// Safe to call triggerHoverEnd, it will early return if we aren't currently hovering
if (isDisabled) triggerHoverEnd({
currentTarget: state.target
}, state.pointerType);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
isDisabled
]);
return {
hoverProps: hoverProps,
isHovered: isHovered
};
}
//# sourceMappingURL=useHover.main.js.map
@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var isBrowser = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
var _default = exports["default"] = isBrowser;
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more