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,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeJsonOptions = exports.jsonWriteOptions = exports.jsonReadOptions = void 0;
const defaultsWrite = {
emitDefaultValues: false,
enumAsInteger: false,
useProtoFieldName: false,
prettySpaces: 0,
}, defaultsRead = {
ignoreUnknownFields: false,
};
/**
* Make options for reading JSON data from partial options.
*/
function jsonReadOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
}
exports.jsonReadOptions = jsonReadOptions;
/**
* Make options for writing JSON data from partial options.
*/
function jsonWriteOptions(options) {
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
}
exports.jsonWriteOptions = jsonWriteOptions;
/**
* Merges JSON write or read options. Later values override earlier values. Type registries are merged.
*/
function mergeJsonOptions(a, b) {
var _a, _b;
let c = Object.assign(Object.assign({}, a), b);
c.typeRegistry = [...((_a = a === null || a === void 0 ? void 0 : a.typeRegistry) !== null && _a !== void 0 ? _a : []), ...((_b = b === null || b === void 0 ? void 0 : b.typeRegistry) !== null && _b !== void 0 ? _b : [])];
return c;
}
exports.mergeJsonOptions = mergeJsonOptions;
@@ -0,0 +1,3 @@
# @vitest/spy
Lightweight Jest compatible spy implementation.
@@ -0,0 +1,13 @@
import type {
ClassicConfig,
FlatConfig,
} from '@typescript-eslint/utils/ts-eslint';
import type rules from './rules';
declare const cjsExport: {
configs: Record<string, ClassicConfig.Config>;
meta: FlatConfig.PluginMeta;
rules: typeof rules;
};
export = cjsExport;
@@ -0,0 +1,4 @@
import type { DependencyList, EffectCallback, useEffect, useLayoutEffect } from 'react';
import type { BasicTarget } from './domTarget';
declare const createEffectWithTarget: (useEffectType: typeof useEffect | typeof useLayoutEffect) => (effect: EffectCallback, deps: DependencyList, target: BasicTarget<any> | BasicTarget<any>[]) => void;
export default createEffectWithTarget;
@@ -0,0 +1,35 @@
"use client";
import { useEffect } from 'react';
import { addDomEvent } from './add-dom-event.mjs';
/**
* Attaches an event listener directly to the provided DOM element.
*
* Bypassing React's event system can be desirable, for instance when attaching non-passive
* event handlers.
*
* ```jsx
* const ref = useRef(null)
*
* useDomEvent(ref, 'wheel', onWheel, { passive: false })
*
* return <div ref={ref} />
* ```
*
* @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
* @param eventName - Name of the event you want listen for.
* @param handler - Function to fire when receiving the event.
* @param options - Options to pass to `Event.addEventListener`.
*
* @public
*/
function useDomEvent(ref, eventName, handler, options) {
useEffect(() => {
const element = ref.current;
if (handler && element) {
return addDomEvent(element, eventName, handler, options);
}
}, [ref, eventName, handler, options]);
}
export { useDomEvent };
@@ -0,0 +1,33 @@
var baseIteratee = require('./_baseIteratee'),
basePullAll = require('./_basePullAll');
/**
* This method is like `_.pullAll` except that it accepts `iteratee` which is
* invoked for each element of `array` and `values` to generate the criterion
* by which they're compared. The iteratee is invoked with one argument: (value).
*
* **Note:** Unlike `_.differenceBy`, this method mutates `array`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {Array} values The values to remove.
* @param {Function} [iteratee=_.identity] The iteratee invoked per element.
* @returns {Array} Returns `array`.
* @example
*
* var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
*
* _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
* console.log(array);
* // => [{ 'x': 2 }]
*/
function pullAllBy(array, values, iteratee) {
return (array && array.length && values && values.length)
? basePullAll(array, values, baseIteratee(iteratee, 2))
: array;
}
module.exports = pullAllBy;
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.verify = verify;
const cose_js_1 = require("../../cose.js");
const verifyEC2_js_1 = require("./verifyEC2.js");
const verifyRSA_js_1 = require("./verifyRSA.js");
const verifyOKP_js_1 = require("./verifyOKP.js");
const unwrapEC2Signature_js_1 = require("./unwrapEC2Signature.js");
/**
* Verify signatures with their public key. Supports EC2 and RSA public keys.
*/
function verify(opts) {
const { cosePublicKey, signature, data, shaHashOverride } = opts;
if ((0, cose_js_1.isCOSEPublicKeyEC2)(cosePublicKey)) {
const crv = cosePublicKey.get(cose_js_1.COSEKEYS.crv);
if (!(0, cose_js_1.isCOSECrv)(crv)) {
throw new Error(`unknown COSE curve ${crv}`);
}
const unwrappedSignature = (0, unwrapEC2Signature_js_1.unwrapEC2Signature)(signature, crv);
return (0, verifyEC2_js_1.verifyEC2)({
cosePublicKey,
signature: unwrappedSignature,
data,
shaHashOverride,
});
}
else if ((0, cose_js_1.isCOSEPublicKeyRSA)(cosePublicKey)) {
return (0, verifyRSA_js_1.verifyRSA)({ cosePublicKey, signature, data, shaHashOverride });
}
else if ((0, cose_js_1.isCOSEPublicKeyOKP)(cosePublicKey)) {
return (0, verifyOKP_js_1.verifyOKP)({ cosePublicKey, signature, data });
}
const kty = cosePublicKey.get(cose_js_1.COSEKEYS.kty);
throw new Error(`Signature verification with public key of kty ${kty} is not supported by this method`);
}
@@ -0,0 +1,20 @@
"use strict";
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _create_class(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
exports._ = _create_class;
@@ -0,0 +1 @@
module.exports={C:{"52":0.01004,"59":0.00502,"60":0.01004,"78":0.01004,"91":0.00502,"102":0.00502,"104":0.00502,"115":0.16573,"128":0.74326,"133":0.00502,"134":0.00502,"136":0.01004,"137":0.00502,"138":0.00502,"139":0.01004,"140":0.11048,"141":0.01004,"142":0.03515,"143":0.89894,"144":0.81859,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 92 93 94 95 96 97 98 99 100 101 103 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 121 122 123 124 125 126 127 129 130 131 132 135 145 146 147 3.5 3.6"},D:{"39":0.00502,"40":0.00502,"41":0.01004,"42":0.00502,"43":0.00502,"44":0.01004,"45":0.01004,"46":0.00502,"47":0.00502,"48":0.01004,"49":0.01507,"50":0.00502,"51":0.00502,"52":0.01507,"53":0.00502,"54":0.00502,"55":0.00502,"56":0.00502,"57":0.01004,"58":0.01004,"59":0.00502,"60":0.00502,"66":0.02009,"79":0.03515,"80":0.02511,"87":0.02511,"88":0.02009,"91":0.00502,"92":0.00502,"93":0.00502,"101":0.00502,"102":0.00502,"103":0.12555,"104":0.00502,"108":0.01507,"109":0.32141,"111":0.00502,"112":0.21092,"113":0.02009,"114":0.01507,"115":0.00502,"116":0.13559,"117":0.00502,"118":0.19586,"119":0.01507,"120":0.02511,"121":0.02009,"122":0.06026,"123":0.02009,"124":0.03515,"125":0.30132,"126":0.13057,"127":0.01004,"128":0.07533,"129":0.01507,"130":0.38669,"131":0.06529,"132":0.07533,"133":0.12555,"134":0.05524,"135":0.0904,"136":0.15568,"137":0.18079,"138":0.57753,"139":1.3459,"140":9.19528,"141":16.03022,"142":0.22097,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 61 62 63 64 65 67 68 69 70 71 72 73 74 75 76 77 78 81 83 84 85 86 89 90 94 95 96 97 98 99 100 105 106 107 110 143 144 145"},F:{"89":0.00502,"91":0.00502,"92":0.01507,"95":0.00502,"120":0.07533,"121":0.1607,"122":1.11488,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 90 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.00502,"92":0.00502,"109":0.05022,"120":0.00502,"122":0.01004,"126":0.00502,"129":0.00502,"130":0.00502,"131":0.01004,"132":0.00502,"134":0.01507,"135":0.00502,"136":0.01004,"137":0.02511,"138":0.04018,"139":0.05022,"140":1.62211,"141":5.82552,"142":0.01004,_:"12 13 14 15 16 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 119 121 123 124 125 127 128 133"},E:{"14":0.01507,_:"0 4 5 6 7 8 9 10 11 12 13 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 15.1 15.2-15.3 26.2","11.1":0.00502,"12.1":0.00502,"13.1":0.0452,"14.1":0.03515,"15.4":0.01004,"15.5":0.01004,"15.6":0.19586,"16.0":0.00502,"16.1":0.02511,"16.2":0.01507,"16.3":0.04018,"16.4":0.02511,"16.5":0.02511,"16.6":0.28123,"17.0":0.01507,"17.1":0.19084,"17.2":0.03013,"17.3":0.02511,"17.4":0.07031,"17.5":0.09542,"17.6":0.28123,"18.0":0.01507,"18.1":0.05022,"18.2":0.02511,"18.3":0.08537,"18.4":0.05022,"18.5-18.6":0.18581,"26.0":0.61268,"26.1":0.02009},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.0024,"5.0-5.1":0,"6.0-6.1":0.00959,"7.0-7.1":0.00719,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.02158,"10.0-10.2":0.0024,"10.3":0.04076,"11.0-11.2":0.60427,"11.3-11.4":0.01439,"12.0-12.1":0.0048,"12.2-12.5":0.1175,"13.0-13.1":0,"13.2":0.01199,"13.3":0.0048,"13.4-13.7":0.01918,"14.0-14.4":0.04076,"14.5-14.8":0.04316,"15.0-15.1":0.04076,"15.2-15.3":0.03117,"15.4":0.03597,"15.5":0.04076,"15.6-15.8":0.53233,"16.0":0.07194,"16.1":0.13428,"16.2":0.06954,"16.3":0.12469,"16.4":0.03117,"16.5":0.05515,"16.6-16.7":0.71218,"17.0":0.05036,"17.1":0.07673,"17.2":0.05515,"17.3":0.08153,"17.4":0.14387,"17.5":0.24698,"17.6-17.7":0.62345,"18.0":0.14148,"18.1":0.29254,"18.2":0.15826,"18.3":0.50836,"18.4":0.26137,"18.5-18.6":13.32754,"26.0":1.64736,"26.1":0.05995},P:{"4":0.04159,"21":0.02079,"22":0.02079,"23":0.02079,"24":0.02079,"25":0.0104,"26":0.05198,"27":0.05198,"28":3.69069,"29":0.2807,_:"20 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","5.0-5.4":0.0104,"7.2-7.4":0.0104},I:{"0":0.02486,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.17921,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.01004,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.66207},Q:{_:"14.9"},O:{"0":0.00996},H:{"0":0},L:{"0":22.29666}};
@@ -0,0 +1,6 @@
module.exports = {
"longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
};
//# sourceMappingURL=sr-SP.main.js.map
@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addComment = addComment;
exports.addComments = addComments;
exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
var _t = require("@babel/types");
const {
addComment: _addComment,
addComments: _addComments
} = _t;
function shareCommentsWithSiblings() {
if (typeof this.key === "string") return;
const node = this.node;
if (!node) return;
const trailing = node.trailingComments;
const leading = node.leadingComments;
if (!trailing && !leading) return;
const prev = this.getSibling(this.key - 1);
const next = this.getSibling(this.key + 1);
const hasPrev = Boolean(prev.node);
const hasNext = Boolean(next.node);
if (hasPrev) {
if (leading) {
prev.addComments("trailing", removeIfExisting(leading, prev.node.trailingComments));
}
if (trailing && !hasNext) prev.addComments("trailing", trailing);
}
if (hasNext) {
if (trailing) {
next.addComments("leading", removeIfExisting(trailing, next.node.leadingComments));
}
if (leading && !hasPrev) next.addComments("leading", leading);
}
}
function removeIfExisting(list, toRemove) {
if (!(toRemove != null && toRemove.length)) return list;
const set = new Set(toRemove);
return list.filter(el => {
return !set.has(el);
});
}
function addComment(type, content, line) {
_addComment(this.node, type, content, line);
}
function addComments(type, comments) {
_addComments(this.node, type, comments);
}
//# sourceMappingURL=comments.js.map
@@ -0,0 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { IconSvgProps } from '../types.js';
import 'react';
declare const AlignBottomBoldIcon: (props: IconSvgProps) => react_jsx_runtime.JSX.Element;
export { AlignBottomBoldIcon };
@@ -0,0 +1,177 @@
"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/use-snippet.ts
var use_snippet_exports = {};
__export(use_snippet_exports, {
useSnippet: () => useSnippet
});
module.exports = __toCommonJS(use_snippet_exports);
var import_theme = require("@heroui/theme");
var import_system = require("@heroui/system");
var import_react_utils = require("@heroui/react-utils");
var import_shared_utils = require("@heroui/shared-utils");
var import_use_clipboard = require("@heroui/use-clipboard");
var import_focus = require("@react-aria/focus");
var import_react = require("react");
function useSnippet(originalProps) {
var _a, _b, _c, _d;
const globalContext = (0, import_system.useProviderContext)();
const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.snippet.variantKeys);
const {
ref,
as,
children,
symbol = "$",
classNames,
timeout,
copyIcon,
checkIcon,
codeString,
disableCopy = false,
disableTooltip = false,
hideCopyButton = false,
autoFocus = false,
hideSymbol = false,
onCopy: onCopyProp,
tooltipProps: userTooltipProps = {},
copyButtonProps: userButtonProps = {},
className,
...otherProps
} = props;
const Component = as || "div";
const shouldFilterDOMProps = typeof Component === "string";
const disableAnimation = (_b = (_a = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
const tooltipProps = {
offset: 15,
delay: 1e3,
content: "Copy to clipboard",
color: (_d = originalProps == null ? void 0 : originalProps.color) != null ? _d : (_c = import_theme.snippet.defaultVariants) == null ? void 0 : _c.color,
isDisabled: props.disableCopy,
...userTooltipProps
};
const domRef = (0, import_react_utils.useDOMRef)(ref);
const preRef = (0, import_react.useRef)(null);
const { copy, copied } = (0, import_use_clipboard.useClipboard)({ timeout });
const isMultiLine = children && Array.isArray(children);
const { isFocusVisible, isFocused, focusProps } = (0, import_focus.useFocusRing)({
autoFocus
});
const slots = (0, import_react.useMemo)(
() => (0, import_theme.snippet)({
...variantProps,
disableAnimation
}),
[(0, import_shared_utils.objectToDeps)(variantProps), disableAnimation]
);
const symbolBefore = (0, import_react.useMemo)(() => {
if (!symbol || typeof symbol !== "string")
return symbol;
const str = symbol.trim();
return str ? `${str} ` : "";
}, [symbol]);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const getSnippetProps = (0, import_react.useCallback)(
() => ({
className: slots.base({
class: baseStyles
}),
...(0, import_react_utils.filterDOMProps)(otherProps, {
enabled: shouldFilterDOMProps
})
}),
[slots, baseStyles, isMultiLine, otherProps]
);
const onCopy = (0, import_react.useCallback)(() => {
var _a2;
if (disableCopy) {
return;
}
let stringValue = "";
if (typeof children === "string") {
stringValue = children;
} else if (Array.isArray(children)) {
children.forEach((child) => {
var _a3, _b2;
const childString = typeof child === "string" ? child : (_b2 = (_a3 = child == null ? void 0 : child.props) == null ? void 0 : _a3.children) == null ? void 0 : _b2.toString();
if (childString) {
stringValue += childString + "\n";
}
});
}
const valueToCopy = codeString || stringValue || ((_a2 = preRef.current) == null ? void 0 : _a2.textContent) || "";
copy(valueToCopy);
onCopyProp == null ? void 0 : onCopyProp(valueToCopy);
}, [copy, codeString, disableCopy, onCopyProp, children]);
const copyButtonProps = {
"aria-label": typeof tooltipProps.content === "string" ? tooltipProps.content : "Copy to clipboard",
size: "sm",
variant: "light",
isDisabled: disableCopy,
onPress: onCopy,
isIconOnly: true,
...userButtonProps
};
const getCopyButtonProps = (0, import_react.useCallback)(
() => ({
...copyButtonProps,
"data-copied": (0, import_shared_utils.dataAttr)(copied),
className: slots.copyButton({
class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.copyButton)
})
}),
[
slots,
isFocusVisible,
isFocused,
disableCopy,
classNames == null ? void 0 : classNames.copyButton,
copyButtonProps,
focusProps
]
);
return {
Component,
as,
domRef,
preRef,
children,
slots,
classNames,
copied,
onCopy,
copyIcon,
checkIcon,
symbolBefore,
isMultiLine,
isFocusVisible,
hideCopyButton,
disableCopy,
disableTooltip,
hideSymbol,
tooltipProps,
getSnippetProps,
getCopyButtonProps
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useSnippet
});
@@ -0,0 +1,26 @@
/**
* @import {HtmlExtension} from 'micromark-util-types'
*/
/**
* Create an HTML extension for `micromark` to support GFM strikethrough when
* serializing to HTML.
*
* @returns {HtmlExtension}
* Extension for `micromark` that can be passed in `htmlExtensions`, to
* support GFM strikethrough when serializing to HTML.
*/
export function gfmStrikethroughHtml() {
return {
enter: {
strikethrough() {
this.tag('<del>');
}
},
exit: {
strikethrough() {
this.tag('</del>');
}
}
};
}
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAkBM,SAAS,wCAAkC,KAA6B;QAIvD,2BAAA;IAHtB,IAAI,QAAQ,CAAA,GAAA,+BAAuB,EAAK;QACtC,GAAG,KAAK;QACR,0BAA0B;QAC1B,oBAAoB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,6CAAuB,MAAM,UAAU,EAAE,MAAM,YAAY,GAAG,IAAI,IAAI,MAAM,YAAY,IAAI,IAAI,oBAA5H,kBAAA,OAAsI;IAC5J;IAEA,IAAI,oBACF,gBAAgB,cAChB,UAAU,EACV,aAAa,kBAAkB,EAChC,GAAG;IAEJ,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAE;IAC7B,CAAA,GAAA,gBAAQ,EAAE;QACR,0HAA0H;QAC1H,IAAI,cAAc;QAClB,IAAI,iBAAiB,OAAO,IAAI,eAAe,QAAQ,CAAC,WAAW,OAAO,CAAC,cAAc;YACvF,cAAc,6CAAuB,YAAY,MAAM,YAAY;YACnE,IAAI,eAAe,MACjB,uFAAuF;YACvF,iBAAiB,eAAe,CAAC;gBAAC;aAAY;QAElD;QAEA,2JAA2J;QAC3J,IAAI,eAAe,QAAQ,iBAAiB,UAAU,IAAI,QAAS,CAAC,iBAAiB,SAAS,IAAI,gBAAgB,gBAAgB,OAAO,EACvI,iBAAiB,aAAa,CAAC;QAEjC,gBAAgB,OAAO,GAAG;IAC5B;IAEA,OAAO;QACL,GAAG,KAAK;QACR,YAAY,MAAM,UAAU,IAAI;IAClC;AACF;AAEA,SAAS,6CAA0B,UAA2C,EAAE,YAAsB;IACpG,IAAI,cAA0B;IAC9B,IAAI,YAAY;YAGkD,2BAAA,qBAIH,4BAAA;QAN7D,cAAc,WAAW,WAAW;QACpC,uEAAuE;QACvE,MAAO,eAAe,QAAS,CAAA,aAAa,GAAG,CAAC,kBAAgB,sBAAA,WAAW,OAAO,CAAC,0BAAnB,2CAAA,4BAAA,oBAAiC,KAAK,cAAtC,gDAAA,0BAAwC,UAAU,CAAD,KAAM,gBAAgB,WAAW,UAAU,GAC1J,cAAc,WAAW,WAAW,CAAC;QAEvC,oHAAoH;QACpH,IAAI,eAAe,QAAS,CAAA,aAAa,GAAG,CAAC,kBAAgB,uBAAA,WAAW,OAAO,CAAC,0BAAnB,4CAAA,6BAAA,qBAAiC,KAAK,cAAtC,iDAAA,2BAAwC,UAAU,CAAD,KAAM,gBAAgB,WAAW,UAAU,IACvJ,cAAc,WAAW,WAAW;IAExC;IAEA,OAAO;AACT","sources":["packages/@react-stately/tabs/src/useTabListState.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 {Collection, CollectionStateBase, Key, Node} from '@react-types/shared';\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useEffect, useRef} from 'react';\n\nexport interface TabListStateOptions<T> extends Omit<TabListProps<T>, 'children'>, CollectionStateBase<T> {}\n\nexport interface TabListState<T> extends SingleSelectListState<T> {\n /** Whether the tab list is disabled. */\n isDisabled: boolean\n}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListStateOptions<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true,\n defaultSelectedKey: props.defaultSelectedKey ?? findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : new Set()) ?? undefined\n });\n\n let {\n selectionManager,\n collection,\n selectedKey: currentSelectedKey\n } = state;\n\n let lastSelectedKey = useRef(currentSelectedKey);\n useEffect(() => {\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = currentSelectedKey;\n if (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey)) {\n selectedKey = findDefaultSelectedKey(collection, state.disabledKeys);\n if (selectedKey != null) {\n // directly set selection because replace/toggle selection won't consider disabled keys\n selectionManager.setSelectedKeys([selectedKey]);\n }\n }\n\n // If the tablist doesn't have focus and the selected key changes or if there isn't a focused key yet, change focused key to the selected key if it exists.\n if (selectedKey != null && selectionManager.focusedKey == null || (!selectionManager.isFocused && selectedKey !== lastSelectedKey.current)) {\n selectionManager.setFocusedKey(selectedKey);\n }\n lastSelectedKey.current = selectedKey;\n });\n\n return {\n ...state,\n isDisabled: props.isDisabled || false\n };\n}\n\nfunction findDefaultSelectedKey<T>(collection: Collection<Node<T>> | undefined, disabledKeys: Set<Key>) {\n let selectedKey: Key | null = null;\n if (collection) {\n selectedKey = collection.getFirstKey();\n // loop over tabs until we find one that isn't disabled and select that\n while (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey !== collection.getLastKey()) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n // if this check is true, then every item is disabled, it makes more sense to default to the first key tLine truncated
@@ -0,0 +1,4 @@
import { ResolutionContext } from '../../resolution/models/ResolutionContext';
import { Resolved } from '../../resolution/models/Resolved';
export type DynamicValueBuilder<T> = (context: ResolutionContext) => Resolved<T>;
//# sourceMappingURL=DynamicValueBuilder.d.ts.map
@@ -0,0 +1,33 @@
// Returns a wrapper function that returns a wrapped callback
// The wrapper function should do some stuff, and return a
// presumably different callback function.
// This makes sure that own properties are retained, so that
// decorations and such are not lost along the way.
module.exports = wrappy
function wrappy (fn, cb) {
if (fn && cb) return wrappy(fn)(cb)
if (typeof fn !== 'function')
throw new TypeError('need wrapper function')
Object.keys(fn).forEach(function (k) {
wrapper[k] = fn[k]
})
return wrapper
function wrapper() {
var args = new Array(arguments.length)
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i]
}
var ret = fn.apply(this, args)
var cb = args[args.length-1]
if (typeof ret === 'function' && ret !== cb) {
Object.keys(cb).forEach(function (k) {
ret[k] = cb[k]
})
}
return ret
}
}
@@ -0,0 +1,15 @@
'use strict';
/** @type {import('.')} */
var $gOPD = require('./gOPD');
if ($gOPD) {
try {
$gOPD([], 'length');
} catch (e) {
// IE 8 has a broken gOPD
$gOPD = null;
}
}
module.exports = $gOPD;
@@ -0,0 +1,3 @@
'use strict';
export default typeof FormData !== 'undefined' ? FormData : null;
@@ -0,0 +1,183 @@
// forward declarations
declare global {
namespace NodeJS {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface ReadableStream {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface WritableStream {}
}
/**
* Stub for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface AbortSignal {}
/**
* Stub for https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface ReadableStream {}
}
import { ReactNode } from "react";
import { ErrorInfo, ReactFormState } from "./client";
import { PostponedState, ResumeOptions } from "./static";
export interface BootstrapScriptDescriptor {
src: string;
integrity?: string | undefined;
crossOrigin?: string | undefined;
}
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap Import maps}
*/
// TODO: Ideally TypeScripts standard library would include this type.
// Until then we keep the prefixed one for future compatibility.
export interface ReactImportMap {
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap#imports `imports` reference}
*/
imports?: {
[specifier: string]: string;
} | undefined;
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap#integrity `integrity` reference}
*/
integrity?: {
[moduleURL: string]: string;
} | undefined;
/**
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/importmap#scopes `scopes` reference}
*/
scopes?: {
[scope: string]: {
[specifier: string]: string;
};
} | undefined;
}
export interface RenderToPipeableStreamOptions {
identifierPrefix?: string;
namespaceURI?: string;
nonce?: string;
bootstrapScriptContent?: string;
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
/**
* Maximum length of the header content in unicode code units i.e. string.length.
* Must be a positive integer if specified.
* @default 2000
*/
headersLengthHint?: number | undefined;
importMap?: ReactImportMap | undefined;
progressiveChunkSize?: number;
onHeaders?: ((headers: Headers) => void) | undefined;
onShellReady?: () => void;
onShellError?: (error: unknown) => void;
onAllReady?: () => void;
onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;
formState?: ReactFormState | null;
}
export interface PipeableStream {
abort: (reason?: unknown) => void;
pipe: <Writable extends NodeJS.WritableStream>(destination: Writable) => Writable;
}
export interface ServerOptions {
identifierPrefix?: string;
}
/**
* Only available in the environments with [Node.js Streams](https://nodejs.dev/learn/nodejs-streams).
*
* @see [API](https://react.dev/reference/react-dom/server/renderToPipeableStream)
*
* @param children
* @param options
*/
export function renderToPipeableStream(children: ReactNode, options?: RenderToPipeableStreamOptions): PipeableStream;
/**
* Render a React element to its initial HTML. This should only be used on the server.
* React will return an HTML string. You can use this method to generate HTML on the server
* and send the markup down on the initial request for faster page loads and to allow search
* engines to crawl your pages for SEO purposes.
*
* If you call `ReactDOMClient.hydrateRoot()` on a node that already has this server-rendered markup,
* React will preserve it and only attach event handlers, allowing you
* to have a very performant first-load experience.
*/
export function renderToString(element: ReactNode, options?: ServerOptions): string;
/**
* Similar to `renderToString`, except this doesn't create extra DOM attributes
* such as `data-reactid`, that React uses internally. This is useful if you want
* to use React as a simple static page generator, as stripping away the extra
* attributes can save lots of bytes.
*/
export function renderToStaticMarkup(element: ReactNode, options?: ServerOptions): string;
export interface RenderToReadableStreamOptions {
identifierPrefix?: string;
importMap?: ReactImportMap | undefined;
namespaceURI?: string;
nonce?: string;
bootstrapScriptContent?: string;
bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
/**
* Maximum length of the header content in unicode code units i.e. string.length.
* Must be a positive integer if specified.
* @default 2000
*/
headersLengthHint?: number | undefined;
progressiveChunkSize?: number;
signal?: AbortSignal;
onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;
onHeaders?: ((headers: Headers) => void) | undefined;
formState?: ReactFormState | null;
}
export interface ReactDOMServerReadableStream extends ReadableStream {
allReady: Promise<void>;
}
/**
* Only available in the environments with [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) (this includes browsers, Deno, and some modern edge runtimes).
*
* @see [API](https://react.dev/reference/react-dom/server/renderToReadableStream)
*/
export function renderToReadableStream(
children: ReactNode,
options?: RenderToReadableStreamOptions,
): Promise<ReactDOMServerReadableStream>;
export { ResumeOptions };
/**
* @see {@link https://react.dev/reference/react-dom/server/resume `resume`` reference documentation}
* @version 19.2
*/
export function resume(
children: React.ReactNode,
postponedState: PostponedState,
options?: ResumeOptions,
): Promise<ReactDOMServerReadableStream>;
/**
* @see {@link https://react.dev/reference/react-dom/server/resumeToPipeableStream `resumeToPipeableStream`` reference documentation}
* @version 19.2
*/
export function resumeToPipeableStream(
children: React.ReactNode,
postponedState: PostponedState,
options?: ResumeOptions,
): Promise<PipeableStream>;
export const version: string;
export as namespace ReactDOMServer;
@@ -0,0 +1,8 @@
var $f8c49dd804b75140$exports = {};
$f8c49dd804b75140$exports = {
"breadcrumbs": `\u{5C0E}\u{89BD}\u{5217}`
};
export {$f8c49dd804b75140$exports as default};
//# sourceMappingURL=zh-TW.module.js.map
@@ -0,0 +1,32 @@
var listCacheClear = require('./_listCacheClear'),
listCacheDelete = require('./_listCacheDelete'),
listCacheGet = require('./_listCacheGet'),
listCacheHas = require('./_listCacheHas'),
listCacheSet = require('./_listCacheSet');
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
@@ -0,0 +1,15 @@
"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_string = void 0;
const base_config_1 = require("./base-config");
const es2015_iterable_1 = require("./es2015.iterable");
const es2020_intl_1 = require("./es2020.intl");
const es2020_symbol_wellknown_1 = require("./es2020.symbol.wellknown");
exports.es2020_string = {
libs: [es2015_iterable_1.es2015_iterable, es2020_intl_1.es2020_intl, es2020_symbol_wellknown_1.es2020_symbol_wellknown],
variables: [['String', base_config_1.TYPE]],
};
@@ -0,0 +1,9 @@
(The MIT License)
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,270 @@
/**
* @fileoverview Rule to replace assignment expressions with operator assignment
* @author Brandon Mills
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Checks whether an operator is commutative and has an operator assignment
* shorthand form.
* @param {string} operator Operator to check.
* @returns {boolean} True if the operator is commutative and has a
* shorthand form.
*/
function isCommutativeOperatorWithShorthand(operator) {
return ["*", "&", "^", "|"].includes(operator);
}
/**
* Checks whether an operator is not commutative and has an operator assignment
* shorthand form.
* @param {string} operator Operator to check.
* @returns {boolean} True if the operator is not commutative and has
* a shorthand form.
*/
function isNonCommutativeOperatorWithShorthand(operator) {
return ["+", "-", "/", "%", "<<", ">>", ">>>", "**"].includes(operator);
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/**
* Determines if the left side of a node can be safely fixed (i.e. if it activates the same getters/setters and)
* toString calls regardless of whether assignment shorthand is used)
* @param {ASTNode} node The node on the left side of the expression
* @returns {boolean} `true` if the node can be fixed
*/
function canBeFixed(node) {
return (
node.type === "Identifier" ||
(node.type === "MemberExpression" &&
(node.object.type === "Identifier" ||
node.object.type === "ThisExpression") &&
(!node.computed || node.property.type === "Literal"))
);
}
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: ["always"],
docs: {
description:
"Require or disallow assignment operator shorthand where possible",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/operator-assignment",
},
schema: [
{
enum: ["always", "never"],
},
],
fixable: "code",
messages: {
replaced:
"Assignment (=) can be replaced with operator assignment ({{operator}}).",
unexpected:
"Unexpected operator assignment ({{operator}}) shorthand.",
},
},
create(context) {
const never = context.options[0] === "never";
const sourceCode = context.sourceCode;
/**
* Returns the operator token of an AssignmentExpression or BinaryExpression
* @param {ASTNode} node An AssignmentExpression or BinaryExpression node
* @returns {Token} The operator token in the node
*/
function getOperatorToken(node) {
return sourceCode.getFirstTokenBetween(
node.left,
node.right,
token => token.value === node.operator,
);
}
/**
* Ensures that an assignment uses the shorthand form where possible.
* @param {ASTNode} node An AssignmentExpression node.
* @returns {void}
*/
function verify(node) {
if (
node.operator !== "=" ||
node.right.type !== "BinaryExpression"
) {
return;
}
const left = node.left;
const expr = node.right;
const operator = expr.operator;
if (
isCommutativeOperatorWithShorthand(operator) ||
isNonCommutativeOperatorWithShorthand(operator)
) {
const replacementOperator = `${operator}=`;
if (astUtils.isSameReference(left, expr.left, true)) {
context.report({
node,
messageId: "replaced",
data: { operator: replacementOperator },
fix(fixer) {
if (canBeFixed(left) && canBeFixed(expr.left)) {
const equalsToken = getOperatorToken(node);
const operatorToken = getOperatorToken(expr);
const leftText = sourceCode
.getText()
.slice(node.range[0], equalsToken.range[0]);
const rightText = sourceCode
.getText()
.slice(
operatorToken.range[1],
node.right.range[1],
);
// Check for comments that would be removed.
if (
sourceCode.commentsExistBetween(
equalsToken,
operatorToken,
)
) {
return null;
}
return fixer.replaceText(
node,
`${leftText}${replacementOperator}${rightText}`,
);
}
return null;
},
});
} else if (
astUtils.isSameReference(left, expr.right, true) &&
isCommutativeOperatorWithShorthand(operator)
) {
/*
* This case can't be fixed safely.
* If `a` and `b` both have custom valueOf() behavior, then fixing `a = b * a` to `a *= b` would
* change the execution order of the valueOf() functions.
*/
context.report({
node,
messageId: "replaced",
data: { operator: replacementOperator },
});
}
}
}
/**
* Warns if an assignment expression uses operator assignment shorthand.
* @param {ASTNode} node An AssignmentExpression node.
* @returns {void}
*/
function prohibit(node) {
if (
node.operator !== "=" &&
!astUtils.isLogicalAssignmentOperator(node.operator)
) {
context.report({
node,
messageId: "unexpected",
data: { operator: node.operator },
fix(fixer) {
if (canBeFixed(node.left)) {
const firstToken = sourceCode.getFirstToken(node);
const operatorToken = getOperatorToken(node);
const leftText = sourceCode
.getText()
.slice(node.range[0], operatorToken.range[0]);
const newOperator = node.operator.slice(0, -1);
let rightText;
// Check for comments that would be duplicated.
if (
sourceCode.commentsExistBetween(
firstToken,
operatorToken,
)
) {
return null;
}
// If this change would modify precedence (e.g. `foo *= bar + 1` => `foo = foo * (bar + 1)`), parenthesize the right side.
if (
astUtils.getPrecedence(node.right) <=
astUtils.getPrecedence({
type: "BinaryExpression",
operator: newOperator,
}) &&
!astUtils.isParenthesised(
sourceCode,
node.right,
)
) {
rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`;
} else {
const tokenAfterOperator =
sourceCode.getTokenAfter(operatorToken, {
includeComments: true,
});
let rightTextPrefix = "";
if (
operatorToken.range[1] ===
tokenAfterOperator.range[0] &&
!astUtils.canTokensBeAdjacent(
{
type: "Punctuator",
value: newOperator,
},
tokenAfterOperator,
)
) {
rightTextPrefix = " "; // foo+=+bar -> foo= foo+ +bar
}
rightText = `${rightTextPrefix}${sourceCode.text.slice(operatorToken.range[1], node.range[1])}`;
}
return fixer.replaceText(
node,
`${leftText}= ${leftText}${newOperator}${rightText}`,
);
}
return null;
},
});
}
}
return {
AssignmentExpression: !never ? verify : prohibit,
};
},
};
@@ -0,0 +1,111 @@
import {getItemId as $b1f0cad8af73213b$export$9145995848b05025, listData as $b1f0cad8af73213b$export$3585ede4d035bf14} from "./utils.mjs";
import {useSlotId as $fcwmx$useSlotId, isMac as $fcwmx$isMac, isWebKit as $fcwmx$isWebKit, chain as $fcwmx$chain, filterDOMProps as $fcwmx$filterDOMProps, useLinkProps as $fcwmx$useLinkProps, mergeProps as $fcwmx$mergeProps} from "@react-aria/utils";
import {getItemCount as $fcwmx$getItemCount} from "@react-stately/collections";
import {useHover as $fcwmx$useHover, isFocusVisible as $fcwmx$isFocusVisible} from "@react-aria/interactions";
import {useSelectableItem as $fcwmx$useSelectableItem} from "@react-aria/selection";
/*
* 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 $293f70390ea03370$export$497855f14858aa34(props, state, ref) {
var _item_props, _item_props1;
let { key: key } = props;
let data = (0, $b1f0cad8af73213b$export$3585ede4d035bf14).get(state);
var _props_isDisabled;
let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : state.selectionManager.isDisabled(key);
var _props_isSelected;
let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : state.selectionManager.isSelected(key);
var _props_shouldSelectOnPressUp;
let shouldSelectOnPressUp = (_props_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _props_shouldSelectOnPressUp !== void 0 ? _props_shouldSelectOnPressUp : data === null || data === void 0 ? void 0 : data.shouldSelectOnPressUp;
var _props_shouldFocusOnHover;
let shouldFocusOnHover = (_props_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _props_shouldFocusOnHover !== void 0 ? _props_shouldFocusOnHover : data === null || data === void 0 ? void 0 : data.shouldFocusOnHover;
var _props_shouldUseVirtualFocus;
let shouldUseVirtualFocus = (_props_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _props_shouldUseVirtualFocus !== void 0 ? _props_shouldUseVirtualFocus : data === null || data === void 0 ? void 0 : data.shouldUseVirtualFocus;
var _props_isVirtualized;
let isVirtualized = (_props_isVirtualized = props.isVirtualized) !== null && _props_isVirtualized !== void 0 ? _props_isVirtualized : data === null || data === void 0 ? void 0 : data.isVirtualized;
let labelId = (0, $fcwmx$useSlotId)();
let descriptionId = (0, $fcwmx$useSlotId)();
let optionProps = {
role: 'option',
'aria-disabled': isDisabled || undefined,
'aria-selected': state.selectionManager.selectionMode !== 'none' ? isSelected : undefined
};
// Safari with VoiceOver on macOS misreads options with aria-labelledby or aria-label as simply "text".
// We should not map slots to the label and description on Safari and instead just have VoiceOver read the textContent.
// https://bugs.webkit.org/show_bug.cgi?id=209279
if (!((0, $fcwmx$isMac)() && (0, $fcwmx$isWebKit)())) {
optionProps['aria-label'] = props['aria-label'];
optionProps['aria-labelledby'] = labelId;
optionProps['aria-describedby'] = descriptionId;
}
let item = state.collection.getItem(key);
if (isVirtualized) {
let index = Number(item === null || item === void 0 ? void 0 : item.index);
optionProps['aria-posinset'] = Number.isNaN(index) ? undefined : index + 1;
optionProps['aria-setsize'] = (0, $fcwmx$getItemCount)(state.collection);
}
let onAction = (data === null || data === void 0 ? void 0 : data.onAction) ? ()=>{
var _data_onAction;
return data === null || data === void 0 ? void 0 : (_data_onAction = data.onAction) === null || _data_onAction === void 0 ? void 0 : _data_onAction.call(data, key);
} : undefined;
let { itemProps: itemProps, isPressed: isPressed, isFocused: isFocused, hasAction: hasAction, allowsSelection: allowsSelection } = (0, $fcwmx$useSelectableItem)({
selectionManager: state.selectionManager,
key: key,
ref: ref,
shouldSelectOnPressUp: shouldSelectOnPressUp,
allowsDifferentPressOrigin: shouldSelectOnPressUp && shouldFocusOnHover,
isVirtualized: isVirtualized,
shouldUseVirtualFocus: shouldUseVirtualFocus,
isDisabled: isDisabled,
onAction: onAction || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.onAction) ? (0, $fcwmx$chain)(item === null || item === void 0 ? void 0 : (_item_props1 = item.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.onAction, onAction) : undefined,
linkBehavior: data === null || data === void 0 ? void 0 : data.linkBehavior
});
let { hoverProps: hoverProps } = (0, $fcwmx$useHover)({
isDisabled: isDisabled || !shouldFocusOnHover,
onHoverStart () {
if (!(0, $fcwmx$isFocusVisible)()) {
state.selectionManager.setFocused(true);
state.selectionManager.setFocusedKey(key);
}
}
});
let domProps = (0, $fcwmx$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props);
delete domProps.id;
let linkProps = (0, $fcwmx$useLinkProps)(item === null || item === void 0 ? void 0 : item.props);
return {
optionProps: {
...optionProps,
...(0, $fcwmx$mergeProps)(domProps, itemProps, hoverProps, linkProps),
id: (0, $b1f0cad8af73213b$export$9145995848b05025)(state, key)
},
labelProps: {
id: labelId
},
descriptionProps: {
id: descriptionId
},
isFocused: isFocused,
isFocusVisible: isFocused && (0, $fcwmx$isFocusVisible)(),
isSelected: isSelected,
isDisabled: isDisabled,
isPressed: isPressed,
allowsSelection: allowsSelection,
hasAction: hasAction
};
}
export {$293f70390ea03370$export$497855f14858aa34 as useOption};
//# sourceMappingURL=useOption.module.js.map
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _index = require("../generated/index.js");
var _default = exports.default = createTypeAnnotationBasedOnTypeof;
function createTypeAnnotationBasedOnTypeof(type) {
switch (type) {
case "string":
return (0, _index.stringTypeAnnotation)();
case "number":
return (0, _index.numberTypeAnnotation)();
case "undefined":
return (0, _index.voidTypeAnnotation)();
case "boolean":
return (0, _index.booleanTypeAnnotation)();
case "function":
return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Function"));
case "object":
return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Object"));
case "symbol":
return (0, _index.genericTypeAnnotation)((0, _index.identifier)("Symbol"));
case "bigint":
return (0, _index.anyTypeAnnotation)();
}
throw new Error("Invalid typeof value: " + type);
}
//# sourceMappingURL=createTypeAnnotationBasedOnTypeof.js.map
@@ -0,0 +1,26 @@
let Selector = require('../selector')
let utils = require('../utils')
class FileSelectorButton extends Selector {
constructor(name, prefixes, all) {
super(name, prefixes, all)
if (this.prefixes) {
this.prefixes = utils.uniq(this.prefixes.map(() => '-webkit-'))
}
}
/**
* Return different selectors depend on prefix
*/
prefixed(prefix) {
if (prefix === '-webkit-') {
return '::-webkit-file-upload-button'
}
return `::${prefix}file-selector-button`
}
}
FileSelectorButton.names = ['::file-selector-button']
module.exports = FileSelectorButton
@@ -0,0 +1,7 @@
import getNative from './_getNative.js';
import root from './_root.js';
/* Built-in method references that are verified to be native. */
var Promise = getNative(root, 'Promise');
export default Promise;
@@ -0,0 +1,5 @@
import type { TSchema } from '../../type/schema/index';
/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Clean(schema: TSchema, references: TSchema[], value: unknown): unknown;
/** `[Mutable]` Removes excess properties from a value and returns the result. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first. */
export declare function Clean(schema: TSchema, value: unknown): unknown;
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Ryan Tsao
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,35 @@
var baseClone = require('./_baseClone'),
baseConforms = require('./_baseConforms');
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1;
/**
* Creates a function that invokes the predicate properties of `source` with
* the corresponding property values of a given object, returning `true` if
* all predicates return truthy, else `false`.
*
* **Note:** The created function is equivalent to `_.conformsTo` with
* `source` partially applied.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Util
* @param {Object} source The object of property predicates to conform to.
* @returns {Function} Returns the new spec function.
* @example
*
* var objects = [
* { 'a': 2, 'b': 1 },
* { 'a': 1, 'b': 2 }
* ];
*
* _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
* // => [{ 'a': 1, 'b': 2 }]
*/
function conforms(source) {
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
}
module.exports = conforms;
@@ -0,0 +1 @@
{"version":3,"file":"curryBuildPlanServiceNode.js","sourceRoot":"","sources":["../../../../src/planning/actions/curryBuildPlanServiceNode.ts"],"names":[],"mappings":";;AAgBA,8DA2DC;AAzED,4GAG+D;AAE/D,+FAA4F;AAC5F,qGAAkG;AAClG,qHAAkH;AAOlH,SAAgB,yBAAyB,CACvC,wBAMsB;IAEtB,OAAO,CAAC,MAAkB,EAAmB,EAAE;QAC7C,MAAM,sBAAsB,GAC1B,IAAA,iEAA+B,EAAC,MAAM,CAAC,CAAC;QAE1C,MAAM,kBAAkB,GACtB,IAAI,mEAAgC,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAEpE,MAAM,OAAO,GACX,MAAM,CAAC,eAAe,CAAC,UAAU,IAAI,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC;QAEtE,MAAM,uBAAuB,GAC3B,IAAA,2DAA4B,EAAC,MAAM,EAAE,kBAAkB,EAAE;YACvD,OAAO;SACR,CAAC,CAAC;QAEL,MAAM,mBAAmB,GAAsB,EAAE,CAAC;QAElD,MAAM,WAAW,GAAoB;YACnC,QAAQ,EAAE,mBAAmB;YAC7B,aAAa,EAAE,IAAI;YACnB,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC,iBAAiB;SAC5D,CAAC;QAEF,mBAAmB,CAAC,IAAI,CACtB,GAAG,wBAAwB,CACzB,MAAM,EACN,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,EACX,OAAO,CACR,CACF,CAAC;QAEF,WAAW,CAAC,aAAa;YACvB,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC;QAEvD,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;YACvC,IAAA,iFAAuC,EACrC,WAAW,EACX,MAAM,CAAC,eAAe,CAAC,UAAU,IAAI,KAAK,EAC1C,sBAAsB,CAAC,IAAI,CAC5B,CAAC;YAEF,MAAM,CAAC,eAAe,CAAC,GAAsB,mBAAmB,CAAC;YAEjE,WAAW,CAAC,QAAQ,GAAG,eAAe,CAAC;QACzC,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,oBAAoB,CAAC,gGAA8E,CAAC;AACxH","sources":["packages/@react-aria/menu/intl/sl-SI.json"],"sourcesContent":["{\n \"longPressMessage\": \"Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol\"\n}\n"],"names":[],"version":3,"file":"sl-SI.module.js.map"}
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,SAAS,CAAC;AAC1C","sources":["packages/@react-aria/overlays/intl/pt-BR.json"],"sourcesContent":["{\n \"dismiss\": \"Descartar\"\n}\n"],"names":[],"version":3,"file":"pt-BR.main.js.map"}
@@ -0,0 +1,6 @@
module.exports = {
"breadcrumbs": `\u{639}\u{646}\u{627}\u{635}\u{631} \u{627}\u{644}\u{648}\u{627}\u{62C}\u{647}\u{629}`
};
//# sourceMappingURL=ar-AE.main.js.map
@@ -0,0 +1,42 @@
{
"name": "@react-aria/textfield",
"version": "3.15.0",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
"exports": {
"types": "./dist/types.d.ts",
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
"dist",
"src"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-aria/focus": "^3.19.0",
"@react-aria/form": "^3.0.11",
"@react-aria/label": "^3.7.13",
"@react-aria/utils": "^3.26.0",
"@react-stately/form": "^3.1.0",
"@react-stately/utils": "^3.10.5",
"@react-types/shared": "^3.26.0",
"@react-types/textfield": "^3.10.0",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
}
@@ -0,0 +1,31 @@
var $47fa5ec5ff482271$exports = require("./context.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useCollator", () => $27a5ce66022270ad$export$a16aca283550c30d);
/*
* 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.
*/
let $27a5ce66022270ad$var$cache = new Map();
function $27a5ce66022270ad$export$a16aca283550c30d(options) {
let { locale: locale } = (0, $47fa5ec5ff482271$exports.useLocale)();
let cacheKey = locale + (options ? Object.entries(options).sort((a, b)=>a[0] < b[0] ? -1 : 1).join() : '');
if ($27a5ce66022270ad$var$cache.has(cacheKey)) return $27a5ce66022270ad$var$cache.get(cacheKey);
let formatter = new Intl.Collator(locale, options);
$27a5ce66022270ad$var$cache.set(cacheKey, formatter);
return formatter;
}
//# sourceMappingURL=useCollator.main.js.map
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,SAAS,CAAC;AAC1C","sources":["packages/@react-aria/overlays/intl/cs-CZ.json"],"sourcesContent":["{\n \"dismiss\": \"Odstranit\"\n}\n"],"names":[],"version":3,"file":"cs-CZ.main.js.map"}
@@ -0,0 +1,39 @@
// English (Singapore) [en-sg]
import dayjs from '../index';
var locale = {
name: 'en-sg',
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
weekStart: 1,
weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
ordinal: function ordinal(n) {
return n;
},
formats: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
relativeTime: {
future: 'in %s',
past: '%s ago',
s: 'a few seconds',
m: 'a minute',
mm: '%d minutes',
h: 'an hour',
hh: '%d hours',
d: 'a day',
dd: '%d days',
M: 'a month',
MM: '%d months',
y: 'a year',
yy: '%d years'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,10 @@
declare global {
interface SymbolConstructor {
readonly observable: symbol
}
}
const $$observable = /* #__PURE__ */ (() =>
(typeof Symbol === 'function' && Symbol.observable) || '@@observable')()
export default $$observable
@@ -0,0 +1,7 @@
import type { FieldValues, FormState, InternalFieldName, ReadFormState } from '../types';
declare const _default: <T extends FieldValues, K extends ReadFormState>(formStateData: Partial<FormState<T>> & {
name?: InternalFieldName;
values?: T;
}, _proxyFormState: K, updateFormState: (formState: Partial<FormState<T>>) => void, isRoot?: boolean) => string | true | undefined;
export default _default;
//# sourceMappingURL=shouldRenderFormState.d.ts.map
@@ -0,0 +1 @@
{"mappings":";;;AAIA,SAAS;IACP,OAAO,OAAO,OAAO,cAAc,KAAK;AAC1C;AAQO,SAAS,0CAAqC,OAAwC;IAC3F,MAAM,OAAC,GAAG,OAAE,GAAG,YAAE,QAAQ,EAAC,GAAG;IAE7B,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,UAAU,gBAAA,0BAAA,IAAK,OAAO;QAC1B,IAAI,CAAC,SACH;QAGF,IAAI,CAAC,2CAAqB;YACxB,OAAO,gBAAgB,CAAC,UAAU,UAAU;YAC5C,OAAO;gBACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;YACjD;QACF,OAAO;YAEL,MAAM,yBAAyB,IAAI,OAAO,cAAc,CAAC,CAAC;gBACxD,IAAI,CAAC,QAAQ,MAAM,EACjB;gBAGF;YACF;YACA,uBAAuB,OAAO,CAAC,SAAS;qBAAC;YAAG;YAE5C,OAAO;gBACL,IAAI,SACF,uBAAuB,SAAS,CAAC;YAErC;QACF;IAEF,GAAG;QAAC;QAAU;QAAK;KAAI;AACzB","sources":["packages/@react-aria/utils/src/useResizeObserver.ts"],"sourcesContent":["\nimport {RefObject} from '@react-types/shared';\nimport {useEffect} from 'react';\n\nfunction hasResizeObserver() {\n return typeof window.ResizeObserver !== 'undefined';\n}\n\ntype useResizeObserverOptionsType<T> = {\n ref: RefObject<T | undefined | null> | undefined,\n box?: ResizeObserverBoxOptions,\n onResize: () => void\n}\n\nexport function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>): void {\n const {ref, box, onResize} = options;\n\n useEffect(() => {\n let element = ref?.current;\n if (!element) {\n return;\n }\n\n if (!hasResizeObserver()) {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n } else {\n\n const resizeObserverInstance = new window.ResizeObserver((entries) => {\n if (!entries.length) {\n return;\n }\n\n onResize();\n });\n resizeObserverInstance.observe(element, {box});\n\n return () => {\n if (element) {\n resizeObserverInstance.unobserve(element);\n }\n };\n }\n\n }, [onResize, ref, box]);\n}\n"],"names":[],"version":3,"file":"useResizeObserver.module.js.map"}
@@ -0,0 +1,5 @@
import type { TSESLint } from '@typescript-eslint/utils';
export type Options = ['fields' | 'getters'];
export type MessageIds = 'preferFieldStyle' | 'preferFieldStyleSuggestion' | 'preferGetterStyle' | 'preferGetterStyleSuggestion';
declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener>;
export default _default;
@@ -0,0 +1,7 @@
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
export { commonjsGlobal as c, getDefaultExportFromCjs as g };
@@ -0,0 +1,6 @@
"use strict";
const isBefore = require("./isBefore.js");
function isSameOrAfter(date, input, unit) {
return !isBefore(date, input, unit);
}
module.exports = isSameOrAfter;
@@ -0,0 +1,39 @@
import {useId as $bdb11010cef70236$export$f680877a34711e37} from "./useId.mjs";
/*
* 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 $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
let { id: id, 'aria-label': label, 'aria-labelledby': labelledBy } = props;
// If there is both an aria-label and aria-labelledby,
// combine them by pointing to the element itself.
id = (0, $bdb11010cef70236$export$f680877a34711e37)(id);
if (labelledBy && label) {
let ids = new Set([
id,
...labelledBy.trim().split(/\s+/)
]);
labelledBy = [
...ids
].join(' ');
} else if (labelledBy) labelledBy = labelledBy.trim().split(/\s+/).join(' ');
// If no labels are provided, use the default
if (!label && !labelledBy && defaultLabel) label = defaultLabel;
return {
id: id,
'aria-label': label,
'aria-labelledby': labelledBy
};
}
export {$313b98861ee5dd6c$export$d6875122194c7b44 as useLabels};
//# sourceMappingURL=useLabels.module.js.map
@@ -0,0 +1,40 @@
import type { FieldArrayPath, FieldValues, UseFieldArrayProps, UseFieldArrayReturn } from './types';
/**
* A custom hook that exposes convenient methods to perform operations with a list of dynamic inputs that need to be appended, updated, removed etc. • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn) • [Video](https://youtu.be/4MrbfGSFY2A)
*
* @remarks
* [API](https://react-hook-form.com/docs/usefieldarray) • [Demo](https://codesandbox.io/s/react-hook-form-usefieldarray-ssugn)
*
* @param props - useFieldArray props
*
* @returns methods - functions to manipulate with the Field Arrays (dynamic inputs) {@link UseFieldArrayReturn}
*
* @example
* ```tsx
* function App() {
* const { register, control, handleSubmit, reset, trigger, setError } = useForm({
* defaultValues: {
* test: []
* }
* });
* const { fields, append } = useFieldArray({
* control,
* name: "test"
* });
*
* return (
* <form onSubmit={handleSubmit(data => console.log(data))}>
* {fields.map((item, index) => (
* <input key={item.id} {...register(`test.${index}.firstName`)} />
* ))}
* <button type="button" onClick={() => append({ firstName: "bill" })}>
* append
* </button>
* <input type="submit" />
* </form>
* );
* }
* ```
*/
export declare function useFieldArray<TFieldValues extends FieldValues = FieldValues, TFieldArrayName extends FieldArrayPath<TFieldValues> = FieldArrayPath<TFieldValues>, TKeyName extends string = 'id', TTransformedValues = TFieldValues>(props: UseFieldArrayProps<TFieldValues, TFieldArrayName, TKeyName, TTransformedValues>): UseFieldArrayReturn<TFieldValues, TFieldArrayName, TKeyName>;
//# sourceMappingURL=useFieldArray.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../../../src/plugin/models/Plugin.ts"],"names":[],"mappings":";;;AAGa,QAAA,QAAQ,GAAkB,MAAM,CAAC,GAAG,CAC/C,8BAA8B,CAC/B,CAAC;AAEF,MAAsB,MAAM;IACV,CAAC,gBAAQ,CAAC,GAAS,IAAa,CAAC;IAE9B,UAAU,CAAa;IACvB,QAAQ,CAAgB;IAE3C,YAAY,SAAqB,EAAE,OAAsB;QACvD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;CAGF;AAZD,wBAYC"}
@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.js"],"names":["module","exports","require","convert","err"],"mappings":"AAAA;;AAEA,IAAI;AACFA,EAAAA,MAAM,CAACC,OAAP,GAAiBC,OAAO,CAAC,UAAD,CAAP,CAAoB,YAApB,EAAkCC,OAAnD;AACD,CAFD,CAEE,OAAOC,GAAP,EAAY;AACZJ,EAAAA,MAAM,CAACC,OAAP,GAAiBC,OAAO,CAAC,mBAAD,CAAxB;AACD","sourcesContent":["'use strict';\n\ntry {\n module.exports = require('bindings')('addon.node').convert;\n} catch (err) {\n module.exports = require('../jssrc/index.js');\n}\n"],"file":"index.js"}
@@ -0,0 +1,243 @@
/**
* @fileoverview Enforce label tags have an associated control.
* @author Jesse Beach
*/
// -----------------------------------------------------------------------------
// Requirements
// -----------------------------------------------------------------------------
import { RuleTester } from 'eslint';
import parserOptionsMapper from '../../__util__/parserOptionsMapper';
import parsers from '../../__util__/helpers/parsers';
import rule from '../../../src/rules/label-has-associated-control';
import ruleOptionsMapperFactory from '../../__util__/ruleOptionsMapperFactory';
// -----------------------------------------------------------------------------
// Tests
// -----------------------------------------------------------------------------
const ruleTester = new RuleTester();
const ruleName = 'label-has-associated-control';
const expectedError = {
message: 'A form label must be associated with a control.',
type: 'JSXOpeningElement',
};
const expectedErrorNoLabel = {
message: 'A form label must have accessible text.',
type: 'JSXOpeningElement',
};
const componentsSettings = {
'jsx-a11y': {
components: {
CustomInput: 'input',
CustomLabel: 'label',
},
},
};
const attributesSettings = {
'jsx-a11y': {
attributes: {
for: ['htmlFor', 'for'],
},
},
};
const htmlForValid = [
{ code: '<label htmlFor="js_id"><span><span><span>A label</span></span></span></label>', options: [{ depth: 4 }] },
{ code: '<label htmlFor="js_id" aria-label="A label" />' },
{ code: '<label htmlFor="js_id" aria-labelledby="A label" />' },
{ code: '<div><label htmlFor="js_id">A label</label><input id="js_id" /></div>' },
{ code: '<label for="js_id"><span><span><span>A label</span></span></span></label>', options: [{ depth: 4 }], settings: attributesSettings },
{ code: '<label for="js_id" aria-label="A label" />', settings: attributesSettings },
{ code: '<label for="js_id" aria-labelledby="A label" />', settings: attributesSettings },
{ code: '<div><label for="js_id">A label</label><input id="js_id" /></div>', settings: attributesSettings },
// Custom label component.
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label" />', options: [{ labelComponents: ['CustomLabel'] }] },
{ code: '<CustomLabel htmlFor="js_id" label="A label" />', options: [{ labelAttributes: ['label'], labelComponents: ['CustomLabel'] }] },
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label" />', settings: componentsSettings },
// Custom label attributes.
{ code: '<label htmlFor="js_id" label="A label" />', options: [{ labelAttributes: ['label'] }] },
// Glob support for controlComponents option.
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label" />', options: [{ controlComponents: ['Custom*'] }] },
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label" />', options: [{ controlComponents: ['*Label'] }] },
// Rule does not error if presence of accessible label cannot be determined
{ code: '<div><label htmlFor="js_id"><CustomText /></label><input id="js_id" /></div>' },
];
const nestingValid = [
{ code: '<label>A label<input /></label>' },
{ code: '<label>A label<textarea /></label>' },
{ code: '<label><img alt="A label" /><input /></label>' },
{ code: '<label><img aria-label="A label" /><input /></label>' },
{ code: '<label><span>A label<input /></span></label>' },
{ code: '<label><span><span>A label<input /></span></span></label>', options: [{ depth: 3 }] },
{ code: '<label><span><span><span>A label<input /></span></span></span></label>', options: [{ depth: 4 }] },
{ code: '<label><span><span><span><span>A label</span><input /></span></span></span></label>', options: [{ depth: 5 }] },
{ code: '<label><span><span><span><span aria-label="A label" /><input /></span></span></span></label>', options: [{ depth: 5 }] },
{ code: '<label><span><span><span><input aria-label="A label" /></span></span></span></label>', options: [{ depth: 5 }] },
// Other controls
{ code: '<label>foo<meter /></label>' },
{ code: '<label>foo<output /></label>' },
{ code: '<label>foo<progress /></label>' },
{ code: '<label>foo<textarea /></label>' },
// Custom controlComponents.
{ code: '<label>A label<CustomInput /></label>', options: [{ controlComponents: ['CustomInput'] }] },
{ code: '<label><span>A label<CustomInput /></span></label>', options: [{ controlComponents: ['CustomInput'] }] },
{ code: '<label><span>A label<CustomInput /></span></label>', settings: componentsSettings },
{ code: '<CustomLabel><span>A label<CustomInput /></span></CustomLabel>', options: [{ controlComponents: ['CustomInput'], labelComponents: ['CustomLabel'] }] },
{ code: '<CustomLabel><span label="A label"><CustomInput /></span></CustomLabel>', options: [{ controlComponents: ['CustomInput'], labelComponents: ['CustomLabel'], labelAttributes: ['label'] }] },
// Glob support for controlComponents option.
{ code: '<label><span>A label<CustomInput /></span></label>', options: [{ controlComponents: ['Custom*'] }] },
{ code: '<label><span>A label<CustomInput /></span></label>', options: [{ controlComponents: ['*Input'] }] },
// Rule does not error if presence of accessible label cannot be determined
{ code: '<label><CustomText /><input /></label>' },
];
const bothValid = [
{ code: '<label htmlFor="js_id"><span><span><span>A label<input /></span></span></span></label>', options: [{ depth: 4 }] },
{ code: '<label htmlFor="js_id" aria-label="A label"><input /></label>' },
{ code: '<label htmlFor="js_id" aria-labelledby="A label"><input /></label>' },
{ code: '<label htmlFor="js_id" aria-labelledby="A label"><textarea /></label>' },
// Custom label component.
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label"><input /></CustomLabel>', options: [{ labelComponents: ['CustomLabel'] }] },
{ code: '<CustomLabel htmlFor="js_id" label="A label"><input /></CustomLabel>', options: [{ labelAttributes: ['label'], labelComponents: ['CustomLabel'] }] },
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label"><input /></CustomLabel>', settings: componentsSettings },
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label"><CustomInput /></CustomLabel>', settings: componentsSettings },
// Custom label attributes.
{ code: '<label htmlFor="js_id" label="A label"><input /></label>', options: [{ labelAttributes: ['label'] }] },
{ code: '<label htmlFor="selectInput">Some text<select id="selectInput" /></label>' },
];
const alwaysValid = [
{ code: '<div />' },
{ code: '<CustomElement />' },
{ code: '<input type="hidden" />' },
];
const htmlForInvalid = [
{ code: '<label htmlFor="js_id"><span><span><span>A label</span></span></span></label>', options: [{ depth: 4 }], errors: [expectedError] },
{ code: '<label htmlFor="js_id" aria-label="A label" />', errors: [expectedError] },
{ code: '<label htmlFor="js_id" aria-labelledby="A label" />', errors: [expectedError] },
// Custom label component.
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label" />', options: [{ labelComponents: ['CustomLabel'] }], errors: [expectedError] },
{ code: '<CustomLabel htmlFor="js_id" label="A label" />', options: [{ labelAttributes: ['label'], labelComponents: ['CustomLabel'] }], errors: [expectedError] },
{ code: '<CustomLabel htmlFor="js_id" aria-label="A label" />', settings: componentsSettings, errors: [expectedError] },
// Custom label attributes.
{ code: '<label htmlFor="js_id" label="A label" />', options: [{ labelAttributes: ['label'] }], errors: [expectedError] },
];
const nestingInvalid = [
{ code: '<label>A label<input /></label>', errors: [expectedError] },
{ code: '<label>A label<textarea /></label>', errors: [expectedError] },
{ code: '<label><img alt="A label" /><input /></label>', errors: [expectedError] },
{ code: '<label><img aria-label="A label" /><input /></label>', errors: [expectedError] },
{ code: '<label><span>A label<input /></span></label>', errors: [expectedError] },
{ code: '<label><span><span>A label<input /></span></span></label>', options: [{ depth: 3 }], errors: [expectedError] },
{ code: '<label><span><span><span>A label<input /></span></span></span></label>', options: [{ depth: 4 }], errors: [expectedError] },
{ code: '<label><span><span><span><span>A label</span><input /></span></span></span></label>', options: [{ depth: 5 }], errors: [expectedError] },
{ code: '<label><span><span><span><span aria-label="A label" /><input /></span></span></span></label>', options: [{ depth: 5 }], errors: [expectedError] },
{ code: '<label><span><span><span><input aria-label="A label" /></span></span></span></label>', options: [{ depth: 5 }], errors: [expectedError] },
// Custom controlComponents.
{ code: '<label>A label<OtherCustomInput /></label>', options: [{ controlComponents: ['CustomInput'] }], errors: [expectedError] },
{ code: '<label><span>A label<CustomInput /></span></label>', options: [{ controlComponents: ['CustomInput'] }], errors: [expectedError] },
{ code: '<CustomLabel><span>A label<CustomInput /></span></CustomLabel>', options: [{ controlComponents: ['CustomInput'], labelComponents: ['CustomLabel'] }], errors: [expectedError] },
{ code: '<CustomLabel><span label="A label"><CustomInput /></span></CustomLabel>', options: [{ controlComponents: ['CustomInput'], labelComponents: ['CustomLabel'], labelAttributes: ['label'] }], errors: [expectedError] },
{ code: '<label><span>A label<CustomInput /></span></label>', settings: componentsSettings, errors: [expectedError] },
{ code: '<CustomLabel><span>A label<CustomInput /></span></CustomLabel>', settings: componentsSettings, errors: [expectedError] },
];
const neverValid = [
{ code: '<label htmlFor="js_id" />', errors: [expectedErrorNoLabel] },
{ code: '<label htmlFor="js_id"><input /></label>', errors: [expectedErrorNoLabel] },
{ code: '<label htmlFor="js_id"><textarea /></label>', errors: [expectedErrorNoLabel] },
{ code: '<label></label>', errors: [expectedErrorNoLabel] },
{ code: '<label>A label</label>', errors: [expectedError] },
{ code: '<div><label /><input /></div>', errors: [expectedErrorNoLabel] },
{ code: '<div><label>A label</label><input /></div>', errors: [expectedError] },
// Custom label component.
{ code: '<CustomLabel aria-label="A label" />', options: [{ labelComponents: ['CustomLabel'] }], errors: [expectedError] },
{ code: '<CustomLabel label="A label" />', options: [{ labelAttributes: ['label'], labelComponents: ['CustomLabel'] }], errors: [expectedError] },
{ code: '<CustomLabel aria-label="A label" />', settings: componentsSettings, errors: [expectedError] },
// Custom label attributes.
{ code: '<label label="A label" />', options: [{ labelAttributes: ['label'] }], errors: [expectedError] },
// Custom controlComponents.
{ code: '<label><span><CustomInput /></span></label>', options: [{ controlComponents: ['CustomInput'] }], errors: [expectedErrorNoLabel] },
{ code: '<CustomLabel><span><CustomInput /></span></CustomLabel>', options: [{ controlComponents: ['CustomInput'], labelComponents: ['CustomLabel'] }], errors: [expectedErrorNoLabel] },
{ code: '<CustomLabel><span><CustomInput /></span></CustomLabel>', options: [{ controlComponents: ['CustomInput'], labelComponents: ['CustomLabel'], labelAttributes: ['label'] }], errors: [expectedErrorNoLabel] },
{ code: '<label><span><CustomInput /></span></label>', settings: componentsSettings, errors: [expectedErrorNoLabel] },
{ code: '<CustomLabel><span><CustomInput /></span></CustomLabel>', settings: componentsSettings, errors: [expectedErrorNoLabel] },
];
// htmlFor valid
ruleTester.run(ruleName, rule, {
valid: parsers.all([].concat(
...alwaysValid,
...htmlForValid,
))
.map(ruleOptionsMapperFactory({
assert: 'htmlFor',
}))
.map(parserOptionsMapper),
invalid: parsers.all([].concat(
...neverValid,
...nestingInvalid,
))
.map(ruleOptionsMapperFactory({
assert: 'htmlFor',
}))
.map(parserOptionsMapper),
});
// nesting valid
ruleTester.run(ruleName, rule, {
valid: parsers.all([].concat(
...alwaysValid,
...nestingValid,
))
.map(ruleOptionsMapperFactory({
assert: 'nesting',
}))
.map(parserOptionsMapper),
invalid: parsers.all([].concat(
...neverValid,
...htmlForInvalid,
))
.map(ruleOptionsMapperFactory({
assert: 'nesting',
}))
.map(parserOptionsMapper),
});
// either valid
ruleTester.run(ruleName, rule, {
valid: parsers.all([].concat(
...alwaysValid,
...htmlForValid,
...nestingValid,
))
.map(ruleOptionsMapperFactory({
assert: 'either',
}))
.map(parserOptionsMapper),
invalid: parsers.all([].concat(
...neverValid,
)).map(parserOptionsMapper),
});
// both valid
ruleTester.run(ruleName, rule, {
valid: parsers.all([].concat(
...alwaysValid,
...bothValid,
))
.map(ruleOptionsMapperFactory({
assert: 'both',
}))
.map(parserOptionsMapper),
invalid: parsers.all([].concat(
...neverValid,
)).map(parserOptionsMapper),
});
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAmCM,SAAS,0CAAuB,KAA0B,EAAE,KAA2B;IAC5F,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,qBAAC,iBAAiB,eAAE,WAAW,gBAAE,YAAY,EAAE,OAAO,QAAQ,EAAC,GAAG;IACtE,IAAI,CAAC,aAAa,GAAG,CAAA,GAAA,qBAAO,EAAE,8BAAA,wCAAA,kBAAmB,MAAM;IACvD,IAAI,SAAS,CAAA,GAAA,oBAAM,EAAE,IAAM,iBAAiB,CAAC,aAAa,KAAK,YAAY;QAAC;QAAmB;QAAY;KAAa;IACxH,IAAI,CAAC,eAAe,iBAAiB,GAAG,CAAA,GAAA,qBAAO,EAAwB;IAEvE,IAAI,OAAO,CAAA,GAAA,wBAAU,EAAE,CAAC;QACtB,iBAAiB,0BAAA,2BAAA,gBAAiB;QAClC,YAAY,YAAY;IAC1B,GAAG;QAAC;QAAa;QAAc;KAAW;IAE1C,IAAI,QAAQ,CAAA,GAAA,wBAAU,EAAE;QACtB,iBAAiB;QACjB,aAAa,YAAY;IAC3B,GAAG;QAAC;QAAc;QAAc;KAAW;IAE3C,IAAI,SAAS,CAAA,GAAA,wBAAU,EAAE,CAAC;QACxB,iBAAiB,0BAAA,2BAAA,gBAAiB;QAClC,IAAI,QACF;aAEA,KAAK;IAET,GAAG;QAAC;QAAO;QAAM;KAAO;IAExB,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;2BACpB;oBACA;kBACA;mBACA;sBACA;0BACA;YACA,mJAAmJ;YACnJ,2EAA2E;YAC3E,SAAS,KAAO;oBAChB;QACF,CAAA,GAAI;QAAC;QAAQ;QAAM;QAAO;QAAU;QAAe;QAAQ;KAAa;AAC1E","sources":["packages/@react-stately/menu/src/useSubmenuTriggerState.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusStrategy, Key} from '@react-types/shared';\nimport type {OverlayTriggerState} from '@react-stately/overlays';\nimport {RootMenuTriggerState} from './useMenuTriggerState';\nimport {useCallback, useMemo, useState} from 'react';\n\nexport interface SubmenuTriggerProps {\n /** Key of the trigger item. */\n triggerKey: Key\n}\n\nexport interface SubmenuTriggerState extends OverlayTriggerState {\n /** Whether the submenu is currently open. */\n isOpen: boolean,\n /** Controls which item will be auto focused when the submenu opens. */\n focusStrategy: FocusStrategy | null,\n /** Opens the submenu. */\n open: (focusStrategy?: FocusStrategy | null) => void,\n /** Closes the submenu. */\n close: () => void,\n /** Closes all menus and submenus in the menu tree. */\n closeAll: () => void,\n /** The level of the submenu. */\n submenuLevel: number,\n /** Toggles the submenu. */\n toggle: (focusStrategy?: FocusStrategy | null) => void,\n /** @private */\n setOpen: () => void\n}\n\n/**\n * Manages state for a submenu trigger. Tracks whether the submenu is currently open, the level of the submenu, and\n * controls which item will receive focus when it opens.\n */\nexport function useSubmenuTriggerState(props: SubmenuTriggerProps, state: RootMenuTriggerState): SubmenuTriggerState {\n let {triggerKey} = props;\n let {expandedKeysStack, openSubmenu, closeSubmenu, close: closeAll} = state;\n let [submenuLevel] = useState(expandedKeysStack?.length);\n let isOpen = useMemo(() => expandedKeysStack[submenuLevel] === triggerKey, [expandedKeysStack, triggerKey, submenuLevel]);\n let [focusStrategy, setFocusStrategy] = useState<FocusStrategy | null>(null);\n\n let open = useCallback((focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n openSubmenu(triggerKey, submenuLevel);\n }, [openSubmenu, submenuLevel, triggerKey]);\n\n let close = useCallback(() => {\n setFocusStrategy(null);\n closeSubmenu(triggerKey, submenuLevel);\n }, [closeSubmenu, submenuLevel, triggerKey]);\n\n let toggle = useCallback((focusStrategy?: FocusStrategy | null) => {\n setFocusStrategy(focusStrategy ?? null);\n if (isOpen) {\n close();\n } else {\n open(focusStrategy);\n }\n }, [close, open, isOpen]);\n\n return useMemo(() => ({\n focusStrategy,\n isOpen,\n open,\n close,\n closeAll,\n submenuLevel,\n // TODO: Placeholders that aren't used but give us parity with OverlayTriggerState so we can use this in Popover. Refactor if we update Popover via\n // https://github.com/adobe/react-spectrum/pull/4976#discussion_r1336472863\n setOpen: () => {},\n toggle\n }), [isOpen, open, close, closeAll, focusStrategy, toggle, submenuLevel]);\n}\n"],"names":[],"version":3,"file":"useSubmenuTriggerState.main.js.map"}
@@ -0,0 +1,90 @@
// Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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.
//
// Font table tags
#include "./table_tags.h"
namespace woff2 {
// Note that the byte order is big-endian, not the same as ots.cc
#define TAG(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d)
const uint32_t kKnownTags[63] = {
TAG('c', 'm', 'a', 'p'), // 0
TAG('h', 'e', 'a', 'd'), // 1
TAG('h', 'h', 'e', 'a'), // 2
TAG('h', 'm', 't', 'x'), // 3
TAG('m', 'a', 'x', 'p'), // 4
TAG('n', 'a', 'm', 'e'), // 5
TAG('O', 'S', '/', '2'), // 6
TAG('p', 'o', 's', 't'), // 7
TAG('c', 'v', 't', ' '), // 8
TAG('f', 'p', 'g', 'm'), // 9
TAG('g', 'l', 'y', 'f'), // 10
TAG('l', 'o', 'c', 'a'), // 11
TAG('p', 'r', 'e', 'p'), // 12
TAG('C', 'F', 'F', ' '), // 13
TAG('V', 'O', 'R', 'G'), // 14
TAG('E', 'B', 'D', 'T'), // 15
TAG('E', 'B', 'L', 'C'), // 16
TAG('g', 'a', 's', 'p'), // 17
TAG('h', 'd', 'm', 'x'), // 18
TAG('k', 'e', 'r', 'n'), // 19
TAG('L', 'T', 'S', 'H'), // 20
TAG('P', 'C', 'L', 'T'), // 21
TAG('V', 'D', 'M', 'X'), // 22
TAG('v', 'h', 'e', 'a'), // 23
TAG('v', 'm', 't', 'x'), // 24
TAG('B', 'A', 'S', 'E'), // 25
TAG('G', 'D', 'E', 'F'), // 26
TAG('G', 'P', 'O', 'S'), // 27
TAG('G', 'S', 'U', 'B'), // 28
TAG('E', 'B', 'S', 'C'), // 29
TAG('J', 'S', 'T', 'F'), // 30
TAG('M', 'A', 'T', 'H'), // 31
TAG('C', 'B', 'D', 'T'), // 32
TAG('C', 'B', 'L', 'C'), // 33
TAG('C', 'O', 'L', 'R'), // 34
TAG('C', 'P', 'A', 'L'), // 35
TAG('S', 'V', 'G', ' '), // 36
TAG('s', 'b', 'i', 'x'), // 37
TAG('a', 'c', 'n', 't'), // 38
TAG('a', 'v', 'a', 'r'), // 39
TAG('b', 'd', 'a', 't'), // 40
TAG('b', 'l', 'o', 'c'), // 41
TAG('b', 's', 'l', 'n'), // 42
TAG('c', 'v', 'a', 'r'), // 43
TAG('f', 'd', 's', 'c'), // 44
TAG('f', 'e', 'a', 't'), // 45
TAG('f', 'm', 't', 'x'), // 46
TAG('f', 'v', 'a', 'r'), // 47
TAG('g', 'v', 'a', 'r'), // 48
TAG('h', 's', 't', 'y'), // 49
TAG('j', 'u', 's', 't'), // 50
TAG('l', 'c', 'a', 'r'), // 51
TAG('m', 'o', 'r', 't'), // 52
TAG('m', 'o', 'r', 'x'), // 53
TAG('o', 'p', 'b', 'd'), // 54
TAG('p', 'r', 'o', 'p'), // 55
TAG('t', 'r', 'a', 'k'), // 56
TAG('Z', 'a', 'p', 'f'), // 57
TAG('S', 'i', 'l', 'f'), // 58
TAG('G', 'l', 'a', 't'), // 59
TAG('G', 'l', 'o', 'c'), // 60
TAG('F', 'e', 'a', 't'), // 61
TAG('S', 'i', 'l', 'l'), // 62
};
} // namespace woff2
@@ -0,0 +1,13 @@
var test = require('tape');
var resolve = require('../');
var path = require('path');
test('subdirs', function (t) {
t.plan(2);
var dir = path.join(__dirname, '/subdirs');
resolve('a/b/c/x.json', { basedir: dir }, function (err, res) {
t.ifError(err);
t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json'));
});
});
@@ -0,0 +1,6 @@
var overArg = require('./_overArg');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
module.exports = nativeKeys;
@@ -0,0 +1,83 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {CollectionBuilderContext} from './useTableState';
import {ColumnProps} from '@react-types/table';
import {GridNode} from '@react-types/grid';
import {PartialNode} from '@react-stately/collections';
import React, {JSX, ReactElement} from 'react';
function Column<T>(props: ColumnProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars
return null;
}
Column.getCollectionNode = function* getCollectionNode<T>(props: ColumnProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>, void, GridNode<T>[]> {
let {title, children, childColumns} = props;
let rendered = title || children;
let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'];
let fullNodes = yield {
type: 'column',
hasChildNodes: !!childColumns || (!!title && React.Children.count(children) > 0),
rendered,
textValue,
props,
*childNodes() {
if (childColumns) {
for (let child of childColumns) {
yield {
type: 'column',
value: child
};
}
} else if (title) {
let childColumns: PartialNode<T>[] = [];
React.Children.forEach(children, child => {
childColumns.push({
type: 'column',
element: child as ReactElement<ColumnProps<T>>
});
});
yield* childColumns;
}
},
shouldInvalidate(newContext: CollectionBuilderContext<T>) {
// This is a bit of a hack, but it works.
// If this method is called, then there's a cached version of this node available.
// But, we need to keep the list of columns in the new context up to date.
updateContext(newContext);
return false;
}
};
let updateContext = (context: CollectionBuilderContext<T>) => {
// register leaf columns on the context so that <Row> can access them
for (let node of fullNodes) {
if (!node.hasChildNodes) {
context.columns.push(node);
}
}
};
updateContext(context);
};
/**
* A Column represents a field of each item within a Table. Columns may also contain nested
* Column elements to represent column groups. Nested columns can be statically defined as
* children, or dynamically generated using a function based on the `childColumns` prop.
*/
// We don't want getCollectionNode to show up in the type definition
let _Column = Column as <T>(props: ColumnProps<T>) => JSX.Element;
export {_Column as Column};
@@ -0,0 +1,97 @@
/**
* @import {Schema} from 'property-information'
*/
import {DefinedInfo} from './util/defined-info.js'
import {Info} from './util/info.js'
import {normalize} from './normalize.js'
const cap = /[A-Z]/g
const dash = /-[a-z]/g
const valid = /^data[-\w.:]+$/i
/**
* Look up info on a property.
*
* In most cases the given `schema` contains info on the property.
* All standard,
* most legacy,
* and some non-standard properties are supported.
* For these cases,
* the returned `Info` has hints about the value of the property.
*
* `name` can also be a valid data attribute or property,
* in which case an `Info` object with the correctly cased `attribute` and
* `property` is returned.
*
* `name` can be an unknown attribute,
* in which case an `Info` object with `attribute` and `property` set to the
* given name is returned.
* It is not recommended to provide unsupported legacy or recently specced
* properties.
*
*
* @param {Schema} schema
* Schema;
* either the `html` or `svg` export.
* @param {string} value
* An attribute-like or property-like name;
* it will be passed through `normalize` to hopefully find the correct info.
* @returns {Info}
* Info.
*/
export function find(schema, value) {
const normal = normalize(value)
let property = value
let Type = Info
if (normal in schema.normal) {
return schema.property[schema.normal[normal]]
}
if (normal.length > 4 && normal.slice(0, 4) === 'data' && valid.test(value)) {
// Attribute or property.
if (value.charAt(4) === '-') {
// Turn it into a property.
const rest = value.slice(5).replace(dash, camelcase)
property = 'data' + rest.charAt(0).toUpperCase() + rest.slice(1)
} else {
// Turn it into an attribute.
const rest = value.slice(4)
if (!dash.test(rest)) {
let dashes = rest.replace(cap, kebab)
if (dashes.charAt(0) !== '-') {
dashes = '-' + dashes
}
value = 'data' + dashes
}
}
Type = DefinedInfo
}
return new Type(property, value)
}
/**
* @param {string} $0
* Value.
* @returns {string}
* Kebab.
*/
function kebab($0) {
return '-' + $0.toLowerCase()
}
/**
* @param {string} $0
* Value.
* @returns {string}
* Camel.
*/
function camelcase($0) {
return $0.charAt(1).toUpperCase()
}
@@ -0,0 +1,9 @@
name: Automatic Rebase
on: [pull_request_target]
jobs:
_:
uses: ljharb/actions/.github/workflows/rebase.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,213 @@
var $59kHH$reactariautils = require("@react-aria/utils");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "usePreventScroll", () => $5c2f5cd01815d369$export$ee0f7cc6afcd1c18);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
const $5c2f5cd01815d369$var$visualViewport = typeof document !== 'undefined' && window.visualViewport;
// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
let $5c2f5cd01815d369$var$preventScrollCount = 0;
let $5c2f5cd01815d369$var$restore;
function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {}) {
let { isDisabled: isDisabled } = options;
(0, $59kHH$reactariautils.useLayoutEffect)(()=>{
if (isDisabled) return;
$5c2f5cd01815d369$var$preventScrollCount++;
if ($5c2f5cd01815d369$var$preventScrollCount === 1) {
if ((0, $59kHH$reactariautils.isIOS)()) $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollMobileSafari();
else $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollStandard();
}
return ()=>{
$5c2f5cd01815d369$var$preventScrollCount--;
if ($5c2f5cd01815d369$var$preventScrollCount === 0) $5c2f5cd01815d369$var$restore();
};
}, [
isDisabled
]);
}
// For most browsers, all we need to do is set `overflow: hidden` on the root element, and
// add some padding to prevent the page from shifting when the scrollbar is hidden.
function $5c2f5cd01815d369$var$preventScrollStandard() {
let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
return (0, $59kHH$reactariautils.chain)(scrollbarWidth > 0 && // Use scrollbar-gutter when supported because it also works for fixed positioned elements.
('scrollbarGutter' in document.documentElement.style ? $5c2f5cd01815d369$var$setStyle(document.documentElement, 'scrollbarGutter', 'stable') : $5c2f5cd01815d369$var$setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`)), $5c2f5cd01815d369$var$setStyle(document.documentElement, 'overflow', 'hidden'));
}
// Mobile Safari is a whole different beast. Even with overflow: hidden,
// it still scrolls the page in many situations:
//
// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of
// it, so it becomes scrollable.
// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.
// This may cause even fixed position elements to scroll off the screen.
// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always
// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.
//
// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:
//
// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling
// on the window.
// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at
// the top or bottom. Work around a bug where this does not work when the element does not actually overflow
// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch
// zooming or when an element contains text selection, which may allow scrolling in some cases.
// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents
// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view
// ourselves, without scrolling the whole page.
function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
let scrollable;
let allowTouchMove = false;
let onTouchStart = (e)=>{
// Store the nearest scrollable parent element from the element that the user touched.
let target = e.target;
scrollable = (0, $59kHH$reactariautils.isScrollable)(target) ? target : (0, $59kHH$reactariautils.getScrollParent)(target, true);
allowTouchMove = false;
// If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.
let selection = target.ownerDocument.defaultView.getSelection();
if (selection && !selection.isCollapsed && selection.containsNode(target, true)) allowTouchMove = true;
// If this is a focused input element with a selected range, allow user to drag the selection handles.
if ('selectionStart' in target && 'selectionEnd' in target && target.selectionStart < target.selectionEnd && target.ownerDocument.activeElement === target) allowTouchMove = true;
};
// Prevent scrolling up when at the top and scrolling down when at the bottom
// of a nested scrollable area, otherwise mobile Safari will start scrolling
// the window instead.
// This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.
let style = document.createElement('style');
style.textContent = `
@layer {
* {
overscroll-behavior: contain;
}
}`.trim();
document.head.prepend(style);
let onTouchMove = (e)=>{
// Allow pinch-zooming.
if (e.touches.length === 2 || allowTouchMove) return;
// Prevent scrolling the window.
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
e.preventDefault();
return;
}
// overscroll-behavior should prevent scroll chaining, but currently does not
// if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452
// This checks that both the width and height do not overflow, otherwise we might
// block horizontal scrolling too. In that case, adding `touch-action: pan-x` to
// the element will prevent vertical page scrolling. We can't add that automatically
// because it must be set before the touchstart event.
if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) e.preventDefault();
};
let onBlur = (e)=>{
let target = e.target;
let relatedTarget = e.relatedTarget;
if (relatedTarget && (0, $59kHH$reactariautils.willOpenKeyboard)(relatedTarget)) {
// Focus without scrolling the whole page, and then scroll into view manually.
relatedTarget.focus({
preventScroll: true
});
$5c2f5cd01815d369$var$scrollIntoViewWhenReady(relatedTarget, (0, $59kHH$reactariautils.willOpenKeyboard)(target));
} else if (!relatedTarget) {
var _target_parentElement;
// When tapping the Done button on the keyboard, focus moves to the body.
// FocusScope will then restore focus back to the input. Later when tapping
// the same input again, it is already focused, so no blur event will fire,
// resulting in the flow above never running and Safari's native scrolling occurring.
// Instead, move focus to the parent focusable element (e.g. the dialog).
let focusable = (_target_parentElement = target.parentElement) === null || _target_parentElement === void 0 ? void 0 : _target_parentElement.closest('[tabindex]');
focusable === null || focusable === void 0 ? void 0 : focusable.focus({
preventScroll: true
});
}
};
// Override programmatic focus to scroll into view without scrolling the whole page.
let focus = HTMLElement.prototype.focus;
HTMLElement.prototype.focus = function(opts) {
// Track whether the keyboard was already visible before.
let wasKeyboardVisible = document.activeElement != null && (0, $59kHH$reactariautils.willOpenKeyboard)(document.activeElement);
// Focus the element without scrolling the page.
focus.call(this, {
...opts,
preventScroll: true
});
if (!opts || !opts.preventScroll) $5c2f5cd01815d369$var$scrollIntoViewWhenReady(this, wasKeyboardVisible);
};
let removeEvents = (0, $59kHH$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(document, 'touchstart', onTouchStart, {
passive: false,
capture: true
}), $5c2f5cd01815d369$var$addEvent(document, 'touchmove', onTouchMove, {
passive: false,
capture: true
}), $5c2f5cd01815d369$var$addEvent(document, 'blur', onBlur, true));
return ()=>{
removeEvents();
style.remove();
HTMLElement.prototype.focus = focus;
};
}
// Sets a CSS property on an element, and returns a function to revert it to the previous value.
function $5c2f5cd01815d369$var$setStyle(element, style, value) {
let cur = element.style[style];
element.style[style] = value;
return ()=>{
element.style[style] = cur;
};
}
// Adds an event listener to an element, and returns a function to remove it.
function $5c2f5cd01815d369$var$addEvent(target, event, handler, options) {
// internal function, so it's ok to ignore the difficult to fix type error
// @ts-ignore
target.addEventListener(event, handler, options);
return ()=>{
// @ts-ignore
target.removeEventListener(event, handler, options);
};
}
function $5c2f5cd01815d369$var$scrollIntoViewWhenReady(target, wasKeyboardVisible) {
if (wasKeyboardVisible || !$5c2f5cd01815d369$var$visualViewport) // If the keyboard was already visible, scroll the target into view immediately.
$5c2f5cd01815d369$var$scrollIntoView(target);
else // Otherwise, wait for the visual viewport to resize before scrolling so we can
// measure the correct position to scroll to.
$5c2f5cd01815d369$var$visualViewport.addEventListener('resize', ()=>$5c2f5cd01815d369$var$scrollIntoView(target), {
once: true
});
}
function $5c2f5cd01815d369$var$scrollIntoView(target) {
let root = document.scrollingElement || document.documentElement;
let nextTarget = target;
while(nextTarget && nextTarget !== root){
// Find the parent scrollable element and adjust the scroll position if the target is not already in view.
let scrollable = (0, $59kHH$reactariautils.getScrollParent)(nextTarget);
if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
let scrollableRect = scrollable.getBoundingClientRect();
let targetRect = nextTarget.getBoundingClientRect();
if (targetRect.top < scrollableRect.top || targetRect.bottom > scrollableRect.top + nextTarget.clientHeight) {
let bottom = scrollableRect.bottom;
if ($5c2f5cd01815d369$var$visualViewport) bottom = Math.min(bottom, $5c2f5cd01815d369$var$visualViewport.offsetTop + $5c2f5cd01815d369$var$visualViewport.height);
// Center within the viewport.
let adjustment = targetRect.top - scrollableRect.top - ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);
scrollable.scrollTo({
// Clamp to the valid range to prevent over-scrolling.
top: Math.max(0, Math.min(scrollable.scrollHeight - scrollable.clientHeight, scrollable.scrollTop + adjustment)),
behavior: 'smooth'
});
}
}
nextTarget = scrollable.parentElement;
}
}
//# sourceMappingURL=usePreventScroll.main.js.map
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _AwaitValue;
function _AwaitValue(value) {
this.wrapped = value;
}
//# sourceMappingURL=AwaitValue.js.map
@@ -0,0 +1 @@
{"version":3,"file":"stringifyBinding.js","sourceRoot":"","sources":["../../../../src/binding/calculations/stringifyBinding.ts"],"names":[],"mappings":";;AAKA,4CASC;AAdD,gDAAiE;AAGjE,uDAA0D;AAE1D,SAAgB,gBAAgB,CAAC,OAAgB;IAC/C,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,+BAAiB,CAAC,QAAQ;YAC7B,OAAO,YAAY,OAAO,CAAC,IAAI,0BAA0B,IAAA,mCAA0B,EAAC,OAAO,CAAC,iBAAiB,CAAC,cAAc,OAAO,CAAC,KAAK,2BAA2B,OAAO,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC;QAC3M,KAAK,+BAAiB,CAAC,kBAAkB;YACvC,OAAO,YAAY,OAAO,CAAC,IAAI,0BAA0B,IAAA,mCAA0B,EAAC,OAAO,CAAC,iBAAiB,CAAC,oBAAoB,IAAA,mCAA0B,EAAC,OAAO,CAAC,uBAAuB,CAAC,KAAK,CAAC;QACrM;YACE,OAAO,YAAY,OAAO,CAAC,IAAI,0BAA0B,IAAA,mCAA0B,EAAC,OAAO,CAAC,iBAAiB,CAAC,cAAc,OAAO,CAAC,KAAK,KAAK,CAAC;IACnJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}
module.exports = noop;
@@ -0,0 +1,81 @@
{
"name": "jiti",
"version": "1.21.7",
"description": "Runtime typescript and ESM support for Node.js",
"repository": "unjs/jiti",
"license": "MIT",
"main": "./lib/index.js",
"types": "dist/jiti.d.ts",
"bin": "bin/jiti.js",
"files": [
"lib",
"dist",
"register.js"
],
"scripts": {
"build": "pnpm clean && NODE_ENV=production pnpm webpack",
"clean": "rm -rf dist",
"dev": "pnpm clean && pnpm webpack --watch",
"jiti": "JITI_DEBUG=1 JITI_CACHE=false JITI_REQUIRE_CACHE=false ./bin/jiti.js",
"jiti:legacy": "JITI_DEBUG=1 npx node@12 ./bin/jiti.js",
"lint": "eslint . && prettier -c src lib test stubs",
"lint:fix": "eslint --fix . && prettier -w src lib test stubs",
"release": "pnpm build && pnpm test && changelogen --release --push && npm publish --tag 1x",
"test": "pnpm lint && vitest run --coverage && pnpm test:bun",
"test:bun": "bun --bun test test/bun"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/plugin-proposal-decorators": "^7.25.9",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-syntax-import-assertions": "^7.26.0",
"@babel/plugin-transform-export-namespace-from": "^7.25.9",
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.25.9",
"@babel/plugin-transform-optional-chaining": "^7.25.9",
"@babel/plugin-transform-typescript": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@babel/template": "^7.25.9",
"@babel/types": "^7.26.3",
"@types/babel__core": "^7.20.5",
"@types/babel__template": "^7.4.4",
"@types/node": "^22.10.2",
"@types/object-hash": "^3.0.6",
"@types/resolve": "^1.20.6",
"@types/semver": "^7.5.8",
"@vitest/coverage-v8": "^2.1.8",
"acorn": "^8.14.0",
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-plugin-parameter-decorator": "^1.0.16",
"babel-plugin-transform-typescript-metadata": "^0.3.2",
"changelogen": "^0.5.7",
"config": "^3.3.12",
"create-require": "^1.1.1",
"destr": "^2.0.3",
"escape-string-regexp": "^5.0.0",
"eslint": "^9.17.0",
"eslint-config-unjs": "^0.4.2",
"esm": "^3.2.25",
"estree-walker": "^3.0.3",
"execa": "^9.5.2",
"fast-glob": "^3.3.2",
"mlly": "^1.7.3",
"object-hash": "^3.0.0",
"pathe": "^1.1.2",
"pirates": "^4.0.6",
"pkg-types": "^1.2.1",
"prettier": "^3.4.2",
"reflect-metadata": "^0.2.2",
"semver": "^7.6.3",
"std-env": "^3.8.0",
"terser-webpack-plugin": "^5.3.11",
"ts-loader": "^9.5.1",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"vite": "^6.0.3",
"vitest": "^2.1.8",
"webpack": "^5.97.1",
"webpack-cli": "^5.1.4"
},
"packageManager": "pnpm@9.15.0"
}
@@ -0,0 +1,38 @@
import { Peer } from './types';
export declare class LimitedHashTable<K, V> {
private readonly keyToValue;
private readonly valueToKey;
private maxSize;
constructor(maxSize: number);
resize(count: number): void;
set(key: K, value: V): void;
getValue(key: K): V | undefined;
getKey(value: V): K | undefined;
deleteByValue(value: V): void;
deleteByKey(key: K): void;
getKeyList(): K[];
getHeads(size: number): {
key: K;
value: V;
}[] | undefined;
}
declare class MessageUniqueWrapper {
private readonly msgDataMap;
private readonly msgIdMap;
constructor(maxMap?: number);
getRecentMsgIds(Peer: Peer, size: number): string[];
createUniqueMsgId(peer: Peer, msgId: string): number;
getMsgIdAndPeerByShortId(shortId: number): {
MsgId: string;
Peer: Peer;
} | undefined;
getShortIdByMsgId(msgId: string): number | undefined;
getPeerByMsgId(msgId: string): {
MsgId: string;
Peer: Peer;
} | undefined;
resize(maxSize: number): void;
isShortId(message_id: string): boolean;
}
export declare const MessageUnique: MessageUniqueWrapper;
export {};
@@ -0,0 +1,27 @@
{
"name": "@swc/counter",
"packageManager": "pnpm@8.6.7",
"main": "index.js",
"version": "0.1.3",
"description": "Downloade counter for the swc project",
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/pkgs.git"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"keywords": [
"swc",
"download",
"counter"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
},
"homepage": "https://swc.rs"
}
@@ -0,0 +1 @@
export { _ as default } from "../esm/_iterable_to_array_limit.js";
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"G N O P","33":"C L M","129":"3 4 5 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","161":"0 1 2 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z"},C:{"1":"0 1 2 3 4 5 uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB 0C 1C"},D:{"129":"3 4 5 GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","161":"0 1 2 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z"},E:{"2":"2C","129":"PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","388":"ZB K D E F A B C L M G 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC","420":"J ZC"},F:{"2":"F B C FD GD HD ID NC uC JD OC","129":"0 1 2 3 4 5 p q r s t u v w x y z","161":"6 7 8 9 G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o"},G:{"129":"PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","388":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC"},H:{"2":"hD"},I:{"16":"TC iD jD kD","129":"I","161":"J lD vC mD nD"},J:{"161":"D A"},K:{"16":"A B C NC uC OC","129":"H"},L:{"129":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"161":"PC"},P:{"1":"BB CB DB EB FB","161":"6 7 8 9 J AB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"161":"zD"},R:{"161":"0D"},S:{"1":"1D 2D"}},B:7,C:"Background-clip: text",D:true};
@@ -0,0 +1 @@
export { useDerivedTransform } from './useDerivedTransform';
@@ -0,0 +1,45 @@
import * as diff from 'fast-diff';
import AttributeMap from './AttributeMap';
import Op from './Op';
import OpIterator from './OpIterator';
interface EmbedHandler<T> {
compose(a: T, b: T, keepNull: boolean): T;
invert(a: T, b: T): T;
transform(a: T, b: T, priority: boolean): T;
}
declare class Delta {
static Op: typeof Op;
static OpIterator: typeof OpIterator;
static AttributeMap: typeof AttributeMap;
private static handlers;
static registerEmbed<T>(embedType: string, handler: EmbedHandler<T>): void;
static unregisterEmbed(embedType: string): void;
private static getHandler;
ops: Op[];
constructor(ops?: Op[] | {
ops: Op[];
});
insert(arg: string | Record<string, unknown>, attributes?: AttributeMap | null): this;
delete(length: number): this;
retain(length: number | Record<string, unknown>, attributes?: AttributeMap | null): this;
push(newOp: Op): this;
chop(): this;
filter(predicate: (op: Op, index: number) => boolean): Op[];
forEach(predicate: (op: Op, index: number) => void): void;
map<T>(predicate: (op: Op, index: number) => T): T[];
partition(predicate: (op: Op) => boolean): [Op[], Op[]];
reduce<T>(predicate: (accum: T, curr: Op, index: number) => T, initialValue: T): T;
changeLength(): number;
length(): number;
slice(start?: number, end?: number): Delta;
compose(other: Delta): Delta;
concat(other: Delta): Delta;
diff(other: Delta, cursor?: number | diff.CursorInfo): Delta;
eachLine(predicate: (line: Delta, attributes: AttributeMap, index: number) => boolean | void, newline?: string): void;
invert(base: Delta): Delta;
transform(index: number, priority?: boolean): number;
transform(other: Delta, priority?: boolean): Delta;
transformPosition(index: number, priority?: boolean): number;
}
export default Delta;
export { Op, OpIterator, AttributeMap };
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../../src/binding/actions/getBindingId.ts","../../src/binding/models/BindingScope.ts","../../src/binding/models/BindingType.ts","../../src/common/calculations/chain.ts","../../src/common/models/OneToManyMapStar.ts","../../src/binding/services/ActivationsService.ts","../../src/reflectMetadata/data/classMetadataReflectKey.ts","../../src/metadata/calculations/getDefaultClassMetadata.ts","../../src/reflectMetadata/data/pendingClassMetadataCountReflectKey.ts","../../src/error/models/InversifyCoreError.ts","../../src/error/models/InversifyCoreErrorKind.ts","../../src/metadata/models/MaybeClassElementMetadataKind.ts","../../src/binding/services/BindingService.ts","../../src/binding/services/DeactivationsService.ts","../../src/metadata/models/ClassElementMetadataKind.ts","../../src/metadata/calculations/getClassMetadata.ts","../../src/metadata/calculations/isPendingClassMetadata.ts","../../src/metadata/calculations/validateConstructorMetadataArray.ts","../../src/metadata/calculations/throwAtInvalidClassMetadata.ts","../../src/binding/calculations/buildInstanceBinding.ts","../../src/binding/calculations/cloneBindingCache.ts","../../src/binding/calculations/cloneBinding.ts","../../src/binding/calculations/cloneDynamicValueBinding.ts","../../src/binding/calculations/cloneFactoryBinding.ts","../../src/binding/calculations/cloneInstanceBinding.ts","../../src/binding/calculations/cloneProviderBinding.ts","../../src/binding/calculations/cloneResolvedValueBinding.ts","../../src/binding/calculations/cloneServiceRedirectionBinding.ts","../../src/decorator/actions/decorate.ts","../../src/metadata/calculations/getDefaultPendingClassMetadataCount.ts","../../src/metadata/actions/decrementPendingClassMetadataCount.ts","../../src/metadata/calculations/buildClassElementMetadataFromMaybeClassElementMetadata.ts","../../src/metadata/calculations/assertMetadataFromTypescriptIfManaged.ts","../../src/metadata/calculations/buildManagedMetadataFromMaybeClassElementMetadata.ts","../../src/metadata/calculations/buildDefaultManagedMetadata.ts","../../src/metadata/calculations/buildManagedMetadataFromMaybeManagedMetadata.ts","../../src/metadata/actions/updateMaybeClassMetadataProperty.ts","../../src/decorator/models/DecoratorInfoKind.ts","../../src/metadata/calculations/handleInjectionError.ts","../../src/decorator/calculations/getDecoratorInfo.ts","../../src/decorator/calculations/stringifyDecoratorInfo.ts","../../src/metadata/decorators/injectBase.ts","../../src/metadata/actions/updateMaybeClassMetadataConstructorArgument.ts","../../src/metadata/decorators/inject.ts","../../src/reflectMetadata/data/classIsInjectableFlagReflectKey.ts","../../src/metadata/calculations/isUserlandEmittedType.ts","../../src/metadata/actions/updateClassMetadataWithTypescriptParameterTypes.ts","../../src/reflectMetadata/data/typescriptDesignParameterTypesReflectKey.ts","../../src/metadata/calculations/buildClassElementMetadataFromTypescriptParameterType.ts","../../src/metadata/decorators/injectable.ts","../../src/metadata/actions/setIsInjectableFlag.ts","../../src/metadata/calculations/getExtendedConstructorArguments.ts","../../src/metadata/calculations/getExtendedLifecycle.ts","../../src/metadata/calculations/getExtendedProperties.ts","../../src/metadata/decorators/injectFrom.ts","../../src/metadata/decorators/injectFromBase.ts","../../src/metadata/decorators/injectFromHierarchy.ts","../../src/metadata/decorators/multiInject.ts","../../src/metadata/actions/incrementPendingClassMetadataCount.ts","../../src/metadata/calculations/buildMaybeClassElementMetadataFromMaybeClassElementMetadata.ts","../../src/metadata/calculations/buildDefaultMaybeClassElementMetadata.ts","../../src/metadata/decorators/named.ts","../../src/metadata/actions/updateMetadataName.ts","../../src/metadata/actions/updateMetadataOptional.ts","../../src/metadata/decorators/optional.ts","../../src/metadata/decorators/postConstruct.ts","../../src/metadata/actions/updateMaybeClassMetadataPostConstructor.ts","../../src/metadata/decorators/preDestroy.ts","../../src/metadata/actions/updateMaybeClassMetadataPreDestroy.ts","../../src/metadata/decorators/tagged.ts","../../src/metadata/actions/updateMetadataTag.ts","../../src/metadata/calculations/buildDefaultUnmanagedMetadata.ts","../../src/metadata/calculations/buildUnmanagedMetadataFromMaybeClassElementMetadata.ts","../../src/metadata/calculations/buildUnmanagedMetadataFromMaybeManagedMetadata.ts","../../src/metadata/decorators/unmanaged.ts","../../src/metadata/models/ResolvedValueElementMetadataKind.ts","../../src/error/calculations/isStackOverflowError.ts","../../src/planning/calculations/handlePlanError.ts","../../src/planning/models/LazyPlanServiceNode.ts","../../src/binding/models/BindingConstraintsImplementation.ts","../../src/planning/calculations/buildFilteredServiceBindings.ts","../../src/common/models/SingleImmutableLinkedList.ts","../../src/planning/calculations/buildPlanBindingConstraintsList.ts","../Line truncated
@@ -0,0 +1,7 @@
import * as react_jsx_runtime from 'react/jsx-runtime';
import { IconSvgProps } from './types.mjs';
import 'react';
declare const ShieldSecurityIcon: (props: IconSvgProps) => react_jsx_runtime.JSX.Element;
export { ShieldSecurityIcon };
@@ -0,0 +1,32 @@
/**
* Configurable ways to encode a character yielding pretty or small results.
*
* @param {number} code
* @param {number} next
* @param {FormatSmartOptions} options
* @returns {string}
*/
export function formatSmart(code: number, next: number, options: FormatSmartOptions): string;
export type FormatSmartOptions = {
/**
* Prefer named character references (`&amp;`) where possible.
*/
useNamedReferences?: boolean;
/**
* Prefer the shortest possible reference, if that results in less bytes.
* **Note**: `useNamedReferences` can be omitted when using `useShortestReferences`.
*/
useShortestReferences?: boolean;
/**
* Whether to omit semicolons when possible.
* **Note**: This creates what HTML calls “parse errors” but is otherwise still valid HTML — don’t use this except when building a minifier.
* Omitting semicolons is possible for certain named and numeric references in some cases.
*/
omitOptionalSemicolons?: boolean;
/**
* Create character references which don’t fail in attributes.
* **Note**: `attribute` only applies when operating dangerously with
* `omitOptionalSemicolons: true`.
*/
attribute?: boolean;
};
@@ -0,0 +1,37 @@
import countBy from './countBy.js';
import each from './each.js';
import eachRight from './eachRight.js';
import every from './every.js';
import filter from './filter.js';
import find from './find.js';
import findLast from './findLast.js';
import flatMap from './flatMap.js';
import flatMapDeep from './flatMapDeep.js';
import flatMapDepth from './flatMapDepth.js';
import forEach from './forEach.js';
import forEachRight from './forEachRight.js';
import groupBy from './groupBy.js';
import includes from './includes.js';
import invokeMap from './invokeMap.js';
import keyBy from './keyBy.js';
import map from './map.js';
import orderBy from './orderBy.js';
import partition from './partition.js';
import reduce from './reduce.js';
import reduceRight from './reduceRight.js';
import reject from './reject.js';
import sample from './sample.js';
import sampleSize from './sampleSize.js';
import shuffle from './shuffle.js';
import size from './size.js';
import some from './some.js';
import sortBy from './sortBy.js';
export default {
countBy, each, eachRight, every, filter,
find, findLast, flatMap, flatMapDeep, flatMapDepth,
forEach, forEachRight, groupBy, includes, invokeMap,
keyBy, map, orderBy, partition, reduce,
reduceRight, reject, sample, sampleSize, shuffle,
size, some, sortBy
};
@@ -0,0 +1 @@
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],a):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_pt=a(e.dayjs)}(this,(function(e){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e),t={name:"pt",weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sab".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sa".split("_"),months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(e){return e+"º"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},relativeTime:{future:"em %s",past:"há %s",s:"alguns segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"}};return o.default.locale(t,null,!0),t}));
@@ -0,0 +1,654 @@
'use strict';
const fs = require('fs');
const sysPath = require('path');
const { promisify } = require('util');
const isBinaryPath = require('is-binary-path');
const {
isWindows,
isLinux,
EMPTY_FN,
EMPTY_STR,
KEY_LISTENERS,
KEY_ERR,
KEY_RAW,
HANDLER_KEYS,
EV_CHANGE,
EV_ADD,
EV_ADD_DIR,
EV_ERROR,
STR_DATA,
STR_END,
BRACE_START,
STAR
} = require('./constants');
const THROTTLE_MODE_WATCH = 'watch';
const open = promisify(fs.open);
const stat = promisify(fs.stat);
const lstat = promisify(fs.lstat);
const close = promisify(fs.close);
const fsrealpath = promisify(fs.realpath);
const statMethods = { lstat, stat };
// TODO: emit errors properly. Example: EMFILE on Macos.
const foreach = (val, fn) => {
if (val instanceof Set) {
val.forEach(fn);
} else {
fn(val);
}
};
const addAndConvert = (main, prop, item) => {
let container = main[prop];
if (!(container instanceof Set)) {
main[prop] = container = new Set([container]);
}
container.add(item);
};
const clearItem = cont => key => {
const set = cont[key];
if (set instanceof Set) {
set.clear();
} else {
delete cont[key];
}
};
const delFromSet = (main, prop, item) => {
const container = main[prop];
if (container instanceof Set) {
container.delete(item);
} else if (container === item) {
delete main[prop];
}
};
const isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val;
/**
* @typedef {String} Path
*/
// fs_watch helpers
// object to hold per-process fs_watch instances
// (may be shared across chokidar FSWatcher instances)
/**
* @typedef {Object} FsWatchContainer
* @property {Set} listeners
* @property {Set} errHandlers
* @property {Set} rawEmitters
* @property {fs.FSWatcher=} watcher
* @property {Boolean=} watcherUnusable
*/
/**
* @type {Map<String,FsWatchContainer>}
*/
const FsWatchInstances = new Map();
/**
* Instantiates the fs_watch interface
* @param {String} path to be watched
* @param {Object} options to be passed to fs_watch
* @param {Function} listener main event handler
* @param {Function} errHandler emits info about errors
* @param {Function} emitRaw emits raw event data
* @returns {fs.FSWatcher} new fsevents instance
*/
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
const handleEvent = (rawEvent, evPath) => {
listener(path);
emitRaw(rawEvent, evPath, {watchedPath: path});
// emit based on events occurring for files from a directory's watcher in
// case the file's watcher misses it (and rely on throttling to de-dupe)
if (evPath && path !== evPath) {
fsWatchBroadcast(
sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath)
);
}
};
try {
return fs.watch(path, options, handleEvent);
} catch (error) {
errHandler(error);
}
}
/**
* Helper for passing fs_watch event data to a collection of listeners
* @param {Path} fullPath absolute path bound to fs_watch instance
* @param {String} type listener type
* @param {*=} val1 arguments to be passed to listeners
* @param {*=} val2
* @param {*=} val3
*/
const fsWatchBroadcast = (fullPath, type, val1, val2, val3) => {
const cont = FsWatchInstances.get(fullPath);
if (!cont) return;
foreach(cont[type], (listener) => {
listener(val1, val2, val3);
});
};
/**
* Instantiates the fs_watch interface or binds listeners
* to an existing one covering the same file system entry
* @param {String} path
* @param {String} fullPath absolute path
* @param {Object} options to be passed to fs_watch
* @param {Object} handlers container for event listener functions
*/
const setFsWatchListener = (path, fullPath, options, handlers) => {
const {listener, errHandler, rawEmitter} = handlers;
let cont = FsWatchInstances.get(fullPath);
/** @type {fs.FSWatcher=} */
let watcher;
if (!options.persistent) {
watcher = createFsWatchInstance(
path, options, listener, errHandler, rawEmitter
);
return watcher.close.bind(watcher);
}
if (cont) {
addAndConvert(cont, KEY_LISTENERS, listener);
addAndConvert(cont, KEY_ERR, errHandler);
addAndConvert(cont, KEY_RAW, rawEmitter);
} else {
watcher = createFsWatchInstance(
path,
options,
fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
errHandler, // no need to use broadcast here
fsWatchBroadcast.bind(null, fullPath, KEY_RAW)
);
if (!watcher) return;
watcher.on(EV_ERROR, async (error) => {
const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
cont.watcherUnusable = true; // documented since Node 10.4.1
// Workaround for https://github.com/joyent/node/issues/4337
if (isWindows && error.code === 'EPERM') {
try {
const fd = await open(path, 'r');
await close(fd);
broadcastErr(error);
} catch (err) {}
} else {
broadcastErr(error);
}
});
cont = {
listeners: listener,
errHandlers: errHandler,
rawEmitters: rawEmitter,
watcher
};
FsWatchInstances.set(fullPath, cont);
}
// const index = cont.listeners.indexOf(listener);
// removes this instance's listeners and closes the underlying fs_watch
// instance if there are no more listeners left
return () => {
delFromSet(cont, KEY_LISTENERS, listener);
delFromSet(cont, KEY_ERR, errHandler);
delFromSet(cont, KEY_RAW, rawEmitter);
if (isEmptySet(cont.listeners)) {
// Check to protect against issue gh-730.
// if (cont.watcherUnusable) {
cont.watcher.close();
// }
FsWatchInstances.delete(fullPath);
HANDLER_KEYS.forEach(clearItem(cont));
cont.watcher = undefined;
Object.freeze(cont);
}
};
};
// fs_watchFile helpers
// object to hold per-process fs_watchFile instances
// (may be shared across chokidar FSWatcher instances)
const FsWatchFileInstances = new Map();
/**
* Instantiates the fs_watchFile interface or binds listeners
* to an existing one covering the same file system entry
* @param {String} path to be watched
* @param {String} fullPath absolute path
* @param {Object} options options to be passed to fs_watchFile
* @param {Object} handlers container for event listener functions
* @returns {Function} closer
*/
const setFsWatchFileListener = (path, fullPath, options, handlers) => {
const {listener, rawEmitter} = handlers;
let cont = FsWatchFileInstances.get(fullPath);
/* eslint-disable no-unused-vars, prefer-destructuring */
let listeners = new Set();
let rawEmitters = new Set();
const copts = cont && cont.options;
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
// "Upgrade" the watcher to persistence or a quicker interval.
// This creates some unlikely edge case issues if the user mixes
// settings in a very weird way, but solving for those cases
// doesn't seem worthwhile for the added complexity.
listeners = cont.listeners;
rawEmitters = cont.rawEmitters;
fs.unwatchFile(fullPath);
cont = undefined;
}
/* eslint-enable no-unused-vars, prefer-destructuring */
if (cont) {
addAndConvert(cont, KEY_LISTENERS, listener);
addAndConvert(cont, KEY_RAW, rawEmitter);
} else {
// TODO
// listeners.add(listener);
// rawEmitters.add(rawEmitter);
cont = {
listeners: listener,
rawEmitters: rawEmitter,
options,
watcher: fs.watchFile(fullPath, options, (curr, prev) => {
foreach(cont.rawEmitters, (rawEmitter) => {
rawEmitter(EV_CHANGE, fullPath, {curr, prev});
});
const currmtime = curr.mtimeMs;
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
foreach(cont.listeners, (listener) => listener(path, curr));
}
})
};
FsWatchFileInstances.set(fullPath, cont);
}
// const index = cont.listeners.indexOf(listener);
// Removes this instance's listeners and closes the underlying fs_watchFile
// instance if there are no more listeners left.
return () => {
delFromSet(cont, KEY_LISTENERS, listener);
delFromSet(cont, KEY_RAW, rawEmitter);
if (isEmptySet(cont.listeners)) {
FsWatchFileInstances.delete(fullPath);
fs.unwatchFile(fullPath);
cont.options = cont.watcher = undefined;
Object.freeze(cont);
}
};
};
/**
* @mixin
*/
class NodeFsHandler {
/**
* @param {import("../index").FSWatcher} fsW
*/
constructor(fsW) {
this.fsw = fsW;
this._boundHandleError = (error) => fsW._handleError(error);
}
/**
* Watch file for changes with fs_watchFile or fs_watch.
* @param {String} path to file or dir
* @param {Function} listener on fs change
* @returns {Function} closer for the watcher instance
*/
_watchWithNodeFs(path, listener) {
const opts = this.fsw.options;
const directory = sysPath.dirname(path);
const basename = sysPath.basename(path);
const parent = this.fsw._getWatchedDir(directory);
parent.add(basename);
const absolutePath = sysPath.resolve(path);
const options = {persistent: opts.persistent};
if (!listener) listener = EMPTY_FN;
let closer;
if (opts.usePolling) {
options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ?
opts.binaryInterval : opts.interval;
closer = setFsWatchFileListener(path, absolutePath, options, {
listener,
rawEmitter: this.fsw._emitRaw
});
} else {
closer = setFsWatchListener(path, absolutePath, options, {
listener,
errHandler: this._boundHandleError,
rawEmitter: this.fsw._emitRaw
});
}
return closer;
}
/**
* Watch a file and emit add event if warranted.
* @param {Path} file Path
* @param {fs.Stats} stats result of fs_stat
* @param {Boolean} initialAdd was the file added at watch instantiation?
* @returns {Function} closer for the watcher instance
*/
_handleFile(file, stats, initialAdd) {
if (this.fsw.closed) {
return;
}
const dirname = sysPath.dirname(file);
const basename = sysPath.basename(file);
const parent = this.fsw._getWatchedDir(dirname);
// stats is always present
let prevStats = stats;
// if the file is already being watched, do nothing
if (parent.has(basename)) return;
const listener = async (path, newStats) => {
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
if (!newStats || newStats.mtimeMs === 0) {
try {
const newStats = await stat(file);
if (this.fsw.closed) return;
// Check that change event was not fired because of changed only accessTime.
const at = newStats.atimeMs;
const mt = newStats.mtimeMs;
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
this.fsw._emit(EV_CHANGE, file, newStats);
}
if (isLinux && prevStats.ino !== newStats.ino) {
this.fsw._closeFile(path)
prevStats = newStats;
this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener));
} else {
prevStats = newStats;
}
} catch (error) {
// Fix issues where mtime is null but file is still present
this.fsw._remove(dirname, basename);
}
// add is about to be emitted if file not already tracked in parent
} else if (parent.has(basename)) {
// Check that change event was not fired because of changed only accessTime.
const at = newStats.atimeMs;
const mt = newStats.mtimeMs;
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
this.fsw._emit(EV_CHANGE, file, newStats);
}
prevStats = newStats;
}
}
// kick off the watcher
const closer = this._watchWithNodeFs(file, listener);
// emit an add event if we're supposed to
if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
if (!this.fsw._throttle(EV_ADD, file, 0)) return;
this.fsw._emit(EV_ADD, file, stats);
}
return closer;
}
/**
* Handle symlinks encountered while reading a dir.
* @param {Object} entry returned by readdirp
* @param {String} directory path of dir being read
* @param {String} path of this item
* @param {String} item basename of this item
* @returns {Promise<Boolean>} true if no more processing is needed for this entry.
*/
async _handleSymlink(entry, directory, path, item) {
if (this.fsw.closed) {
return;
}
const full = entry.fullPath;
const dir = this.fsw._getWatchedDir(directory);
if (!this.fsw.options.followSymlinks) {
// watch symlink directly (don't follow) and detect changes
this.fsw._incrReadyCount();
let linkPath;
try {
linkPath = await fsrealpath(path);
} catch (e) {
this.fsw._emitReady();
return true;
}
if (this.fsw.closed) return;
if (dir.has(item)) {
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
this.fsw._symlinkPaths.set(full, linkPath);
this.fsw._emit(EV_CHANGE, path, entry.stats);
}
} else {
dir.add(item);
this.fsw._symlinkPaths.set(full, linkPath);
this.fsw._emit(EV_ADD, path, entry.stats);
}
this.fsw._emitReady();
return true;
}
// don't follow the same symlink more than once
if (this.fsw._symlinkPaths.has(full)) {
return true;
}
this.fsw._symlinkPaths.set(full, true);
}
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
// Normalize the directory name on Windows
directory = sysPath.join(directory, EMPTY_STR);
if (!wh.hasGlob) {
throttler = this.fsw._throttle('readdir', directory, 1000);
if (!throttler) return;
}
const previous = this.fsw._getWatchedDir(wh.path);
const current = new Set();
let stream = this.fsw._readdirp(directory, {
fileFilter: entry => wh.filterPath(entry),
directoryFilter: entry => wh.filterDir(entry),
depth: 0
}).on(STR_DATA, async (entry) => {
if (this.fsw.closed) {
stream = undefined;
return;
}
const item = entry.path;
let path = sysPath.join(directory, item);
current.add(item);
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) {
return;
}
if (this.fsw.closed) {
stream = undefined;
return;
}
// Files that present in current directory snapshot
// but absent in previous are added to watch list and
// emit `add` event.
if (item === target || !target && !previous.has(item)) {
this.fsw._incrReadyCount();
// ensure relativeness of path is preserved in case of watcher reuse
path = sysPath.join(dir, sysPath.relative(dir, path));
this._addToNodeFs(path, initialAdd, wh, depth + 1);
}
}).on(EV_ERROR, this._boundHandleError);
return new Promise(resolve =>
stream.once(STR_END, () => {
if (this.fsw.closed) {
stream = undefined;
return;
}
const wasThrottled = throttler ? throttler.clear() : false;
resolve();
// Files that absent in current directory snapshot
// but present in previous emit `remove` event
// and are removed from @watched[directory].
previous.getChildren().filter((item) => {
return item !== directory &&
!current.has(item) &&
// in case of intersecting globs;
// a path may have been filtered out of this readdir, but
// shouldn't be removed because it matches a different glob
(!wh.hasGlob || wh.filterPath({
fullPath: sysPath.resolve(directory, item)
}));
}).forEach((item) => {
this.fsw._remove(directory, item);
});
stream = undefined;
// one more time for any missed in case changes came in extremely quickly
if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler);
})
);
}
/**
* Read directory to add / remove files from `@watched` list and re-read it on change.
* @param {String} dir fs path
* @param {fs.Stats} stats
* @param {Boolean} initialAdd
* @param {Number} depth relative to user-supplied path
* @param {String} target child path targeted for watch
* @param {Object} wh Common watch helpers for this path
* @param {String} realpath
* @returns {Promise<Function>} closer for the watcher instance.
*/
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
const tracked = parentDir.has(sysPath.basename(dir));
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR, dir, stats);
}
// ensure dir is tracked (harmless if redundant)
parentDir.add(sysPath.basename(dir));
this.fsw._getWatchedDir(dir);
let throttler;
let closer;
const oDepth = this.fsw.options.depth;
if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
if (!target) {
await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
if (this.fsw.closed) return;
}
closer = this._watchWithNodeFs(dir, (dirPath, stats) => {
// if current directory is removed, do nothing
if (stats && stats.mtimeMs === 0) return;
this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
});
}
return closer;
}
/**
* Handle added file, directory, or glob pattern.
* Delegates call to _handleFile / _handleDir after checks.
* @param {String} path to file or ir
* @param {Boolean} initialAdd was the file added at watch instantiation?
* @param {Object} priorWh depth relative to user-supplied path
* @param {Number} depth Child path actually targeted for watch
* @param {String=} target Child path actually targeted for watch
* @returns {Promise}
*/
async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
const ready = this.fsw._emitReady;
if (this.fsw._isIgnored(path) || this.fsw.closed) {
ready();
return false;
}
const wh = this.fsw._getWatchHelpers(path, depth);
if (!wh.hasGlob && priorWh) {
wh.hasGlob = priorWh.hasGlob;
wh.globFilter = priorWh.globFilter;
wh.filterPath = entry => priorWh.filterPath(entry);
wh.filterDir = entry => priorWh.filterDir(entry);
}
// evaluate what is at the path we're being asked to watch
try {
const stats = await statMethods[wh.statMethod](wh.watchPath);
if (this.fsw.closed) return;
if (this.fsw._isIgnored(wh.watchPath, stats)) {
ready();
return false;
}
const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START);
let closer;
if (stats.isDirectory()) {
const absPath = sysPath.resolve(path);
const targetPath = follow ? await fsrealpath(path) : path;
if (this.fsw.closed) return;
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
if (this.fsw.closed) return;
// preserve this symlink's target path
if (absPath !== targetPath && targetPath !== undefined) {
this.fsw._symlinkPaths.set(absPath, targetPath);
}
} else if (stats.isSymbolicLink()) {
const targetPath = follow ? await fsrealpath(path) : path;
if (this.fsw.closed) return;
const parent = sysPath.dirname(wh.watchPath);
this.fsw._getWatchedDir(parent).add(wh.watchPath);
this.fsw._emit(EV_ADD, wh.watchPath, stats);
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
if (this.fsw.closed) return;
// preserve this symlink's target path
if (targetPath !== undefined) {
this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
}
} else {
closer = this._handleFile(wh.watchPath, stats, initialAdd);
}
ready();
this.fsw._addPathCloser(path, closer);
return false;
} catch (error) {
if (this.fsw._handleError(error)) {
ready();
return path;
}
}
}
}
module.exports = NodeFsHandler;
@@ -0,0 +1,8 @@
/**
* Compiler options required to avoid critical functionality issues
*/
export declare const CORE_COMPILER_OPTIONS: {
noEmit: true;
noUnusedLocals: true;
noUnusedParameters: true;
};
@@ -0,0 +1,14 @@
import baseSetToString from './_baseSetToString.js';
import shortOut from './_shortOut.js';
/**
* Sets the `toString` method of `func` to return `string`.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = shortOut(baseSetToString);
export default setToString;
@@ -0,0 +1,36 @@
var test = require('tape')
var clone = require('./')
var fs = require('fs')
test('file', function(t) {
compare(t, fs.statSync(__filename))
t.end()
})
test('directory', function(t) {
compare(t, fs.statSync(__dirname))
t.end()
})
function compare(t, stat) {
var copy = clone(stat)
t.deepEqual(stat, copy, 'clone has equal properties')
t.ok(stat instanceof fs.Stats, 'original is an fs.Stat')
t.ok(copy instanceof fs.Stats, 'copy is an fs.Stat')
;['isDirectory'
, 'isFile'
, 'isBlockDevice'
, 'isCharacterDevice'
, 'isSymbolicLink'
, 'isFIFO'
, 'isSocket'
].forEach(function(method) {
t.equal(
stat[method].call(stat)
, copy[method].call(copy)
, 'equal value for stat.' + method + '()'
)
})
}
@@ -0,0 +1,11 @@
"use strict";
var _assert_this_initialized = require("./_assert_this_initialized.cjs");
var _type_of = require("./_type_of.cjs");
function _possible_constructor_return(self, call) {
if (call && (_type_of._(call) === "object" || typeof call === "function")) return call;
return _assert_this_initialized._(self);
}
exports._ = _possible_constructor_return;
@@ -0,0 +1,74 @@
import nodeos__default from 'node:os';
import './env.D4Lgay0q.js';
import { isCI } from 'std-env';
const defaultInclude = ["**/*.{test,spec}.?(c|m)[jt]s?(x)"];
const defaultExclude = ["**/node_modules/**", "**/.git/**"];
const benchmarkConfigDefaults = {
include: ["**/*.{bench,benchmark}.?(c|m)[jt]s?(x)"],
exclude: defaultExclude,
includeSource: [],
reporters: ["default"],
includeSamples: false
};
// These are the generic defaults for coverage. Providers may also set some provider specific defaults.
const coverageConfigDefaults = {
provider: "v8",
enabled: false,
clean: true,
cleanOnRerun: true,
reportsDirectory: "./coverage",
exclude: [],
reportOnFailure: false,
reporter: [
["text", {}],
["html", {}],
["clover", {}],
["json", {}]
],
allowExternal: false,
excludeAfterRemap: false,
processingConcurrency: Math.min(20, nodeos__default.availableParallelism?.() ?? nodeos__default.cpus().length)
};
const fakeTimersDefaults = {
loopLimit: 1e4,
shouldClearNativeTimers: true
};
const configDefaults = Object.freeze({
allowOnly: !isCI,
isolate: true,
watch: !isCI && process.stdin.isTTY,
globals: false,
environment: "node",
clearMocks: false,
restoreMocks: false,
mockReset: false,
unstubGlobals: false,
unstubEnvs: false,
include: defaultInclude,
exclude: defaultExclude,
teardownTimeout: 1e4,
forceRerunTriggers: ["**/package.json/**", "**/{vitest,vite}.config.*/**"],
update: false,
reporters: [],
silent: false,
hideSkippedTests: false,
api: false,
ui: false,
uiBase: "/__vitest__/",
open: !isCI,
css: { include: [] },
coverage: coverageConfigDefaults,
fakeTimers: fakeTimersDefaults,
maxConcurrency: 5,
dangerouslyIgnoreUnhandledErrors: false,
typecheck: {
checker: "tsc",
include: ["**/*.{test,spec}-d.?(c|m)[jt]s?(x)"],
exclude: defaultExclude
},
slowTestThreshold: 300,
disableConsoleIntercept: false
});
export { coverageConfigDefaults as a, defaultInclude as b, configDefaults as c, defaultExclude as d, benchmarkConfigDefaults as e };
@@ -0,0 +1 @@
{"version":3,"file":"CacheBindingInvalidation.d.ts","sourceRoot":"","sources":["../../../../src/planning/models/CacheBindingInvalidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1B,IAAI,EAAE,4BAA4B,CAAC;IACnC,UAAU,EAAE,oBAAoB,CAAC;CAClC"}
@@ -0,0 +1,11 @@
import * as _heroui_system_rsc from '@heroui/system-rsc';
import { UseCodeProps } from './use-code.js';
import 'react';
import '@heroui/theme';
import '@heroui/react-utils';
interface CodeProps extends UseCodeProps {
}
declare const Code: _heroui_system_rsc.InternalForwardRefRenderFunction<"div", CodeProps, never>;
export { CodeProps, Code as default };
@@ -0,0 +1,37 @@
var $eAK08$reactariatoggle = require("@react-aria/toggle");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useSwitch", () => $e64bc6eb3aa7bd8d$export$d853f7095ae95f88);
/*
* 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 $e64bc6eb3aa7bd8d$export$d853f7095ae95f88(props, state, ref) {
let { labelProps: labelProps, inputProps: inputProps, isSelected: isSelected, isPressed: isPressed, isDisabled: isDisabled, isReadOnly: isReadOnly } = (0, $eAK08$reactariatoggle.useToggle)(props, state, ref);
return {
labelProps: labelProps,
inputProps: {
...inputProps,
role: 'switch',
checked: isSelected
},
isSelected: isSelected,
isPressed: isPressed,
isDisabled: isDisabled,
isReadOnly: isReadOnly
};
}
//# sourceMappingURL=useSwitch.main.js.map
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=SingleImmutableLinkedList.spec.d.ts.map
@@ -0,0 +1,51 @@
{
"name": "blf-debug-appender",
"version": "1.0.5",
"description": "A DebugAppender for `base-log-factory`.",
"types": "dist/index.d.ts",
"module": "dist/index.mjs",
"main": "dist/index.js",
"keywords": [
"log",
"logging",
"log4j"
],
"author": "Jesse Feng <fxm0016@126.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/fengxinming/base-log-factory.git"
},
"bugs": {
"url": "https://github.com/fengxinming/base-log-factory/issues"
},
"homepage": "https://fengxinming.github.io/base-log-factory/",
"dependencies": {
"@types/debug": "^4.1.12",
"date-manip": "^2.0.6",
"debug": "^4.4.0",
"blf-colorful-appender": "^1.0.6",
"base-log-factory": "^2.1.4"
},
"devDependencies": {
"@rollup/plugin-typescript": "^12.1.2",
"@vitest/coverage-v8": "^3.0.8",
"typedoc": "^0.28.1",
"typedoc-plugin-markdown": "^4.5.2",
"vite": "^6.2.2",
"vite-plugin-combine": "^6.2.1",
"vite-plugin-external": "6.0.1",
"vite-plugin-separate-importer": "^6.1.0",
"vitest": "^3.0.8"
},
"files": [
"dist"
],
"scripts": {
"clean": "rm -rf node_modules",
"build": "vite build",
"test": "vitest run --coverage",
"release": "pnpm publish --no-git-checks",
"typedoc": "typedoc && typedoc --options typedoc.zh.json"
}
}
@@ -0,0 +1 @@
{"name":"decimal.js","version":"10.6.0","requiresBuild":false,"files":{"decimal.js":{"checkedAt":1794532106192,"integrity":"sha512-GcC0IglIKtCxjA7drqylpnrTG7aNOKkSzW7CDZz16iT92kUixGhjcsLz75gSQ8JJAYFhBkIOOO+1cfK3eegIQg==","mode":420,"size":136673},"package.json":{"checkedAt":1794532106192,"integrity":"sha512-ryyqG/0Y7x4iLV1h5hB/wptQvG7lg0YtBpGUMfGHTuh02FS5QULrpEUStnq7FKyZF9Xj3uHYcJAgwP12lYJh6A==","mode":420,"size":1190},"LICENCE.md":{"checkedAt":1794532106192,"integrity":"sha512-uGpI1MSMoueqIV8ofXblYUqEz+Igft5d40sJ+z+0zaUxBA+x5WzdUm2jbg1TX5LdQojwcPbjVQLdFxTVG7MGvw==","mode":420,"size":1104},"README.md":{"checkedAt":1794532106192,"integrity":"sha512-2jbdg4nvwqZ9JWuHdDy2jr8lJf0JjyCl7gQ5JP9yzITRbfshuG9aEJOpRil06Y9RjTFxL+3gde+fUHAZ5jpJig==","mode":420,"size":8574},"decimal.mjs":{"checkedAt":1794532106193,"integrity":"sha512-dE8W4zOBNGsINwNYsIxZfmK/ymZhmrxSKQeGpLjW87iAi3Sg0OpRRPr5InCW/v3zJyzUUFMOIBLjAzbPFYDpCQ==","mode":420,"size":127787},"decimal.d.ts":{"checkedAt":1794532106193,"integrity":"sha512-gzEnST5oc0HNzaVyHRiz/g4Ehih8uewkSjH6xS7gneXvchs+vLtvswc0X1T9CRN0jRRlZETnryMcrlW4I77B8g==","mode":420,"size":9019}}}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A wC","164":"B"},B:{"1":"0 1 2 3 4 5 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","36":"C L M G N O P"},C:{"1":"0 1 2 3 4 5 pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"xC TC J ZB K D E F A B C L M G N O 0C 1C","36":"6 7 8 9 P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB"},D:{"1":"0 1 2 3 4 5 jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB"},E:{"1":"gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J ZB K D E F A B C L M G 2C ZC 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC"},F:{"1":"0 1 2 3 4 5 BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"6 7 8 9 F B C G N O P aB AB FD GD HD ID NC uC JD OC"},G:{"1":"gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC"},H:{"2":"hD"},I:{"2":"TC J I iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A","36":"B"},O:{"1":"PC"},P:{"1":"6 7 8 9 AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD","16":"J"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:5,C:"Screen Orientation",D:true};
@@ -0,0 +1,453 @@
export declare class Attributor {
readonly attrName: string;
readonly keyName: string;
static keys(node: HTMLElement): string[];
scope: Scope;
whitelist: string[] | undefined;
constructor(attrName: string, keyName: string, options?: AttributorOptions);
add(node: HTMLElement, value: any): boolean;
canAdd(_node: HTMLElement, value: any): boolean;
remove(node: HTMLElement): void;
value(node: HTMLElement): any;
}
export declare interface AttributorOptions {
scope?: Scope;
whitelist?: string[];
}
export declare class AttributorStore {
private attributes;
private domNode;
constructor(domNode: HTMLElement);
attribute(attribute: Attributor, value: any): void;
build(): void;
copy(target: Formattable): void;
move(target: Formattable): void;
values(): {
[key: string]: any;
};
}
export declare class BlockBlot extends ParentBlot implements Formattable {
static blotName: string;
static scope: Scope;
static tagName: string | string[];
static allowedChildren: BlotConstructor[];
static create(value?: unknown): HTMLElement;
static formats(domNode: HTMLElement, scroll: Root): any;
protected attributes: AttributorStore;
constructor(scroll: Root, domNode: Node);
format(name: string, value: any): void;
formats(): {
[index: string]: any;
};
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
replaceWith(name: string | Blot, value?: any): Blot;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
}
/**
* Blots are the basic building blocks of a Parchment document.
*
* Several basic implementations such as Block, Inline, and Embed are provided.
* In general you will want to extend one of these, instead of building from scratch.
* After implementation, blots need to be registered before usage.
*
* At the very minimum a Blot must be named with a static blotName and associated with either a tagName or className.
* If a Blot is defined with both a tag and class, the class takes precedence, but the tag may be used as a fallback.
* Blots must also have a scope, which determine if it is inline or block.
*/
export declare interface Blot extends LinkedNode {
scroll: Root;
parent: Parent;
prev: Blot | null;
next: Blot | null;
domNode: Node;
statics: BlotConstructor;
attach(): void;
clone(): Blot;
detach(): void;
isolate(index: number, length: number): Blot;
/**
* For leaves, length of blot's value()
* For parents, sum of children's values
*/
length(): number;
/**
* Returns offset between this blot and an ancestor's
*/
offset(root?: Blot): number;
remove(): void;
replaceWith(name: string, value: any): Blot;
replaceWith(replacement: Blot): Blot;
split(index: number, force?: boolean): Blot | null;
wrap(name: string, value?: any): Parent;
wrap(wrapper: Parent): Parent;
deleteAt(index: number, length: number): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
/**
* Called after update cycle completes. Cannot change the value or length
* of the document, and any DOM operation must reduce complexity of the DOM
* tree. A shared context object is passed through all blots.
*/
optimize(context: {
[key: string]: any;
}): void;
optimize(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
/**
* Called when blot changes, with the mutation records of its change.
* Internal records of the blot values can be updated, and modifications of
* the blot itself is permitted. Can be trigger from user change or API call.
* A shared context object is passed through all blots.
*/
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
}
export declare interface BlotConstructor {
new (...args: any[]): Blot;
/**
* Creates corresponding DOM node
*/
create(value?: any): Node;
blotName: string;
tagName: string | string[];
scope: Scope;
className?: string;
requiredContainer?: BlotConstructor;
allowedChildren?: BlotConstructor[];
defaultChild?: BlotConstructor;
}
export declare class ClassAttributor extends Attributor {
static keys(node: HTMLElement): string[];
add(node: HTMLElement, value: any): boolean;
remove(node: HTMLElement): void;
value(node: HTMLElement): any;
}
export declare class ContainerBlot extends ParentBlot {
static blotName: string;
static scope: Scope;
static tagName: string | string[];
prev: BlockBlot | ContainerBlot | null;
next: BlockBlot | ContainerBlot | null;
checkMerge(): boolean;
deleteAt(index: number, length: number): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
optimize(context: {
[key: string]: any;
}): void;
}
export declare class EmbedBlot extends LeafBlot implements Formattable {
static formats(_domNode: HTMLElement, _scroll: Root): any;
format(name: string, value: any): void;
formatAt(index: number, length: number, name: string, value: any): void;
formats(): {
[index: string]: any;
};
}
export declare interface Formattable extends Blot {
/**
* Apply format to blot. Should not pass onto child or other blot.
*/
format(name: string, value: any): void;
/**
* Return formats represented by blot, including from Attributors.
*/
formats(): {
[index: string]: any;
};
}
export declare class InlineBlot extends ParentBlot implements Formattable {
static allowedChildren: BlotConstructor[];
static blotName: string;
static scope: Scope;
static tagName: string | string[];
static create(value?: unknown): HTMLElement;
static formats(domNode: HTMLElement, scroll: Root): any;
protected attributes: AttributorStore;
constructor(scroll: Root, domNode: Node);
format(name: string, value: any): void;
formats(): {
[index: string]: any;
};
formatAt(index: number, length: number, name: string, value: any): void;
optimize(context: {
[key: string]: any;
}): void;
replaceWith(name: string | Blot, value?: any): Blot;
update(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
wrap(name: string | Parent, value?: any): Parent;
}
export declare interface Leaf extends Blot {
index(node: Node, offset: number): number;
position(index: number, inclusive: boolean): [Node, number];
value(): any;
}
export declare class LeafBlot extends ShadowBlot implements Leaf {
static scope: Scope;
/**
* Returns the value represented by domNode if it is this Blot's type
* No checking that domNode can represent this Blot type is required so
* applications needing it should check externally before calling.
*/
static value(_domNode: Node): any;
/**
* Given location represented by node and offset from DOM Selection Range,
* return index to that location.
*/
index(node: Node, offset: number): number;
/**
* Given index to location within blot, return node and offset representing
* that location, consumable by DOM Selection Range
*/
position(index: number, _inclusive?: boolean): [Node, number];
/**
* Return value represented by this blot
* Should not change without interaction from API or
* user change detectable by update()
*/
value(): any;
}
export declare class LinkedList<T extends LinkedNode> {
head: T | null;
tail: T | null;
length: number;
constructor();
append(...nodes: T[]): void;
at(index: number): T | null;
contains(node: T): boolean;
indexOf(node: T): number;
insertBefore(node: T | null, refNode: T | null): void;
offset(target: T): number;
remove(node: T): void;
iterator(curNode?: T | null): () => T | null;
find(index: number, inclusive?: boolean): [T | null, number];
forEach(callback: (cur: T) => void): void;
forEachAt(index: number, length: number, callback: (cur: T, offset: number, length: number) => void): void;
map(callback: (cur: T) => any): any[];
reduce<M>(callback: (memo: M, cur: T) => M, memo: M): M;
}
export declare interface LinkedNode {
prev: LinkedNode | null;
next: LinkedNode | null;
length(): number;
}
export declare interface Parent extends Blot {
children: LinkedList<Blot>;
domNode: HTMLElement;
appendChild(child: Blot): void;
descendant<T>(type: new () => T, index: number): [T, number];
descendant<T>(matcher: (blot: Blot) => boolean, index: number): [T, number];
descendants<T>(type: new () => T, index: number, length: number): T[];
descendants<T>(matcher: (blot: Blot) => boolean, index: number, length: number): T[];
insertBefore(child: Blot, refNode?: Blot | null): void;
moveChildren(parent: Parent, refNode?: Blot | null): void;
path(index: number, inclusive?: boolean): [Blot, number][];
removeChild(child: Blot): void;
unwrap(): void;
}
export declare class ParentBlot extends ShadowBlot implements Parent {
/**
* Whitelist array of Blots that can be direct children.
*/
static allowedChildren?: BlotConstructor[];
/**
* Default child blot to be inserted if this blot becomes empty.
*/
static defaultChild?: BlotConstructor;
static uiClass: string;
children: LinkedList<Blot>;
domNode: HTMLElement;
uiNode: HTMLElement | null;
constructor(scroll: Root, domNode: Node);
appendChild(other: Blot): void;
attach(): void;
attachUI(node: HTMLElement): void;
/**
* Called during construction, should fill its own children LinkedList.
*/
build(): void;
deleteAt(index: number, length: number): void;
descendant<T extends Blot>(criteria: new (...args: any[]) => T, index: number): [T | null, number];
descendant(criteria: (blot: Blot) => boolean, index: number): [Blot | null, number];
descendants<T extends Blot>(criteria: new (...args: any[]) => T, index?: number, length?: number): T[];
descendants(criteria: (blot: Blot) => boolean, index?: number, length?: number): Blot[];
detach(): void;
enforceAllowedChildren(): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
insertBefore(childBlot: Blot, refBlot?: Blot | null): void;
length(): number;
moveChildren(targetParent: Parent, refNode?: Blot | null): void;
optimize(context?: {
[key: string]: any;
}): void;
path(index: number, inclusive?: boolean): [Blot, number][];
removeChild(child: Blot): void;
replaceWith(name: string | Blot, value?: any): Blot;
split(index: number, force?: boolean): Blot | null;
splitAfter(child: Blot): Parent;
unwrap(): void;
update(mutations: MutationRecord[], _context: {
[key: string]: any;
}): void;
}
export declare class Registry implements RegistryInterface {
static blots: WeakMap<Node, Blot>;
static find(node?: Node | null, bubble?: boolean): Blot | null;
private attributes;
private classes;
private tags;
private types;
create(scroll: Root, input: Node | string | Scope, value?: any): Blot;
find(node: Node | null, bubble?: boolean): Blot | null;
query(query: string | Node | Scope, scope?: Scope): RegistryDefinition | null;
register(...definitions: RegistryDefinition[]): RegistryDefinition[];
}
export declare type RegistryDefinition = Attributor | BlotConstructor;
export declare interface RegistryInterface {
create(scroll: Root, input: Node | string | Scope, value?: any): Blot;
query(query: string | Node | Scope, scope: Scope): RegistryDefinition | null;
register(...definitions: any[]): any;
}
export declare interface Root extends Parent {
create(input: Node | string | Scope, value?: any): Blot;
find(node: Node | null, bubble?: boolean): Blot | null;
query(query: string | Node | Scope, scope?: Scope): RegistryDefinition | null;
}
export declare enum Scope {
TYPE = 3,// 0011 Lower two bits
LEVEL = 12,// 1100 Higher two bits
ATTRIBUTE = 13,// 1101
BLOT = 14,// 1110
INLINE = 7,// 0111
BLOCK = 11,// 1011
BLOCK_BLOT = 10,// 1010
INLINE_BLOT = 6,// 0110
BLOCK_ATTRIBUTE = 9,// 1001
INLINE_ATTRIBUTE = 5,// 0101
ANY = 15
}
export declare class ScrollBlot extends ParentBlot implements Root {
registry: Registry;
static blotName: string;
static defaultChild: typeof BlockBlot;
static allowedChildren: BlotConstructor[];
static scope: Scope;
static tagName: string;
observer: MutationObserver;
constructor(registry: Registry, node: HTMLDivElement);
create(input: Node | string | Scope, value?: any): Blot;
find(node: Node | null, bubble?: boolean): Blot | null;
query(query: string | Node | Scope, scope?: Scope): RegistryDefinition | null;
register(...definitions: RegistryDefinition[]): RegistryDefinition[];
build(): void;
detach(): void;
deleteAt(index: number, length: number): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
optimize(context?: {
[key: string]: any;
}): void;
optimize(mutations: MutationRecord[], context: {
[key: string]: any;
}): void;
update(mutations?: MutationRecord[], context?: {
[key: string]: any;
}): void;
}
export declare class ShadowBlot implements Blot {
scroll: Root;
domNode: Node;
static blotName: string;
static className: string;
static requiredContainer: BlotConstructor;
static scope: Scope;
static tagName: string | string[];
static create(rawValue?: unknown): Node;
prev: Blot | null;
next: Blot | null;
parent: Parent;
get statics(): any;
constructor(scroll: Root, domNode: Node);
attach(): void;
clone(): Blot;
detach(): void;
deleteAt(index: number, length: number): void;
formatAt(index: number, length: number, name: string, value: any): void;
insertAt(index: number, value: string, def?: any): void;
isolate(index: number, length: number): Blot;
length(): number;
offset(root?: Blot): number;
optimize(_context?: {
[key: string]: any;
}): void;
remove(): void;
replaceWith(name: string | Blot, value?: any): Blot;
split(index: number, _force?: boolean): Blot | null;
update(_mutations: MutationRecord[], _context: {
[key: string]: any;
}): void;
wrap(name: string | Parent, value?: any): Parent;
}
export declare class StyleAttributor extends Attributor {
static keys(node: HTMLElement): string[];
add(node: HTMLElement, value: any): boolean;
remove(node: HTMLElement): void;
value(node: HTMLElement): any;
}
export declare class TextBlot extends LeafBlot implements Leaf {
static readonly blotName = "text";
static scope: Scope;
static create(value: string): Text;
static value(domNode: Text): string;
domNode: Text;
protected text: string;
constructor(scroll: Root, node: Node);
deleteAt(index: number, length: number): void;
index(node: Node, offset: number): number;
insertAt(index: number, value: string, def?: any): void;
length(): number;
optimize(context: {
[key: string]: any;
}): void;
position(index: number, _inclusive?: boolean): [Node, number];
split(index: number, force?: boolean): Blot | null;
update(mutations: MutationRecord[], _context: {
[key: string]: any;
}): void;
value(): string;
}
export { }
@@ -0,0 +1,3 @@
import type { TSESTree } from '@typescript-eslint/utils';
import type { RuleContext } from '../types.js';
export declare function declaredScope(context: RuleContext, node: TSESTree.Node, name: string): import("@typescript-eslint/scope-manager").ScopeType | undefined;
@@ -0,0 +1,15 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v1.0.0 - 2024-12-10
### Commits
- Initial implementation, tests, readme, types [`5d6baee`](https://github.com/ljharb/side-channel-list/commit/5d6baee5c9054a1238007f5a1dfc109a7a816251)
- Initial commit [`3ae784c`](https://github.com/ljharb/side-channel-list/commit/3ae784c63a47895fbaeed2a91ab54a8029a7a100)
- npm init [`07055a4`](https://github.com/ljharb/side-channel-list/commit/07055a4d139895565b199dba5fe2479c1a1b9e28)
- Only apps should have lockfiles [`9573058`](https://github.com/ljharb/side-channel-list/commit/9573058a47494e2d68f8c6c77b5d7fbe441949c1)
@@ -0,0 +1,789 @@
import type { Dispatch, UnknownAction } from 'redux'
import type { ThunkDispatch } from 'redux-thunk'
import type { ActionCreatorWithPreparedPayload } from './createAction'
import { createAction } from './createAction'
import { isAnyOf } from './matchers'
import { nanoid } from './nanoid'
import type {
FallbackIfUnknown,
Id,
IsAny,
IsUnknown,
SafePromise,
} from './tsHelpers'
export type BaseThunkAPI<
S,
E,
D extends Dispatch = Dispatch,
RejectedValue = unknown,
RejectedMeta = unknown,
FulfilledMeta = unknown,
> = {
dispatch: D
getState: () => S
extra: E
requestId: string
signal: AbortSignal
abort: (reason?: string) => void
rejectWithValue: IsUnknown<
RejectedMeta,
(value: RejectedValue) => RejectWithValue<RejectedValue, RejectedMeta>,
(
value: RejectedValue,
meta: RejectedMeta,
) => RejectWithValue<RejectedValue, RejectedMeta>
>
fulfillWithValue: IsUnknown<
FulfilledMeta,
<FulfilledValue>(value: FulfilledValue) => FulfilledValue,
<FulfilledValue>(
value: FulfilledValue,
meta: FulfilledMeta,
) => FulfillWithMeta<FulfilledValue, FulfilledMeta>
>
}
/**
* @public
*/
export interface SerializedError {
name?: string
message?: string
stack?: string
code?: string
}
const commonProperties: Array<keyof SerializedError> = [
'name',
'message',
'stack',
'code',
]
class RejectWithValue<Payload, RejectedMeta> {
/*
type-only property to distinguish between RejectWithValue and FulfillWithMeta
does not exist at runtime
*/
private readonly _type!: 'RejectWithValue'
constructor(
public readonly payload: Payload,
public readonly meta: RejectedMeta,
) {}
}
class FulfillWithMeta<Payload, FulfilledMeta> {
/*
type-only property to distinguish between RejectWithValue and FulfillWithMeta
does not exist at runtime
*/
private readonly _type!: 'FulfillWithMeta'
constructor(
public readonly payload: Payload,
public readonly meta: FulfilledMeta,
) {}
}
/**
* Serializes an error into a plain object.
* Reworked from https://github.com/sindresorhus/serialize-error
*
* @public
*/
export const miniSerializeError = (value: any): SerializedError => {
if (typeof value === 'object' && value !== null) {
const simpleError: SerializedError = {}
for (const property of commonProperties) {
if (typeof value[property] === 'string') {
simpleError[property] = value[property]
}
}
return simpleError
}
return { message: String(value) }
}
export type AsyncThunkConfig = {
state?: unknown
dispatch?: ThunkDispatch<unknown, unknown, UnknownAction>
extra?: unknown
rejectValue?: unknown
serializedErrorType?: unknown
pendingMeta?: unknown
fulfilledMeta?: unknown
rejectedMeta?: unknown
}
export type GetState<ThunkApiConfig> = ThunkApiConfig extends {
state: infer State
}
? State
: unknown
type GetExtra<ThunkApiConfig> = ThunkApiConfig extends { extra: infer Extra }
? Extra
: unknown
type GetDispatch<ThunkApiConfig> = ThunkApiConfig extends {
dispatch: infer Dispatch
}
? FallbackIfUnknown<
Dispatch,
ThunkDispatch<
GetState<ThunkApiConfig>,
GetExtra<ThunkApiConfig>,
UnknownAction
>
>
: ThunkDispatch<
GetState<ThunkApiConfig>,
GetExtra<ThunkApiConfig>,
UnknownAction
>
export type GetThunkAPI<ThunkApiConfig> = BaseThunkAPI<
GetState<ThunkApiConfig>,
GetExtra<ThunkApiConfig>,
GetDispatch<ThunkApiConfig>,
GetRejectValue<ThunkApiConfig>,
GetRejectedMeta<ThunkApiConfig>,
GetFulfilledMeta<ThunkApiConfig>
>
type GetRejectValue<ThunkApiConfig> = ThunkApiConfig extends {
rejectValue: infer RejectValue
}
? RejectValue
: unknown
type GetPendingMeta<ThunkApiConfig> = ThunkApiConfig extends {
pendingMeta: infer PendingMeta
}
? PendingMeta
: unknown
type GetFulfilledMeta<ThunkApiConfig> = ThunkApiConfig extends {
fulfilledMeta: infer FulfilledMeta
}
? FulfilledMeta
: unknown
type GetRejectedMeta<ThunkApiConfig> = ThunkApiConfig extends {
rejectedMeta: infer RejectedMeta
}
? RejectedMeta
: unknown
type GetSerializedErrorType<ThunkApiConfig> = ThunkApiConfig extends {
serializedErrorType: infer GetSerializedErrorType
}
? GetSerializedErrorType
: SerializedError
type MaybePromise<T> = T | Promise<T> | (T extends any ? Promise<T> : never)
/**
* A type describing the return value of the `payloadCreator` argument to `createAsyncThunk`.
* Might be useful for wrapping `createAsyncThunk` in custom abstractions.
*
* @public
*/
export type AsyncThunkPayloadCreatorReturnValue<
Returned,
ThunkApiConfig extends AsyncThunkConfig,
> = MaybePromise<
| IsUnknown<
GetFulfilledMeta<ThunkApiConfig>,
Returned,
FulfillWithMeta<Returned, GetFulfilledMeta<ThunkApiConfig>>
>
| RejectWithValue<
GetRejectValue<ThunkApiConfig>,
GetRejectedMeta<ThunkApiConfig>
>
>
/**
* A type describing the `payloadCreator` argument to `createAsyncThunk`.
* Might be useful for wrapping `createAsyncThunk` in custom abstractions.
*
* @public
*/
export type AsyncThunkPayloadCreator<
Returned,
ThunkArg = void,
ThunkApiConfig extends AsyncThunkConfig = {},
> = (
arg: ThunkArg,
thunkAPI: GetThunkAPI<ThunkApiConfig>,
) => AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>
/**
* A ThunkAction created by `createAsyncThunk`.
* Dispatching it returns a Promise for either a
* fulfilled or rejected action.
* Also, the returned value contains an `abort()` method
* that allows the asyncAction to be cancelled from the outside.
*
* @public
*/
export type AsyncThunkAction<
Returned,
ThunkArg,
ThunkApiConfig extends AsyncThunkConfig,
> = (
dispatch: NonNullable<GetDispatch<ThunkApiConfig>>,
getState: () => GetState<ThunkApiConfig>,
extra: GetExtra<ThunkApiConfig>,
) => SafePromise<
| ReturnType<AsyncThunkFulfilledActionCreator<Returned, ThunkArg>>
| ReturnType<AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>>
> & {
abort: (reason?: string) => void
requestId: string
arg: ThunkArg
unwrap: () => Promise<Returned>
}
/**
* Config provided when calling the async thunk action creator.
*/
export interface AsyncThunkDispatchConfig {
/**
* An external `AbortSignal` that will be tracked by the internal `AbortSignal`.
*/
signal?: AbortSignal
}
type AsyncThunkActionCreator<
Returned,
ThunkArg,
ThunkApiConfig extends AsyncThunkConfig,
> = IsAny<
ThunkArg,
// any handling
(
arg: ThunkArg,
config?: AsyncThunkDispatchConfig,
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>,
// unknown handling
unknown extends ThunkArg
? (
arg: ThunkArg,
config?: AsyncThunkDispatchConfig,
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> // argument not specified or specified as void or undefined
: [ThunkArg] extends [void] | [undefined]
? (
arg?: undefined,
config?: AsyncThunkDispatchConfig,
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> // argument contains void
: [void] extends [ThunkArg] // make optional
? (
arg?: ThunkArg,
config?: AsyncThunkDispatchConfig,
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig> // argument contains undefined
: [undefined] extends [ThunkArg]
? WithStrictNullChecks<
// with strict nullChecks: make optional
(
arg?: ThunkArg,
config?: AsyncThunkDispatchConfig,
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>,
// without strict null checks this will match everything, so don't make it optional
(
arg: ThunkArg,
config?: AsyncThunkDispatchConfig,
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>
> // default case: normal argument
: (
arg: ThunkArg,
config?: AsyncThunkDispatchConfig,
) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>
>
/**
* Options object for `createAsyncThunk`.
*
* @public
*/
export type AsyncThunkOptions<
ThunkArg = void,
ThunkApiConfig extends AsyncThunkConfig = {},
> = {
/**
* A method to control whether the asyncThunk should be executed. Has access to the
* `arg`, `api.getState()` and `api.extra` arguments.
*
* @returns `false` if it should be skipped
*/
condition?(
arg: ThunkArg,
api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>,
): MaybePromise<boolean | undefined>
/**
* If `condition` returns `false`, the asyncThunk will be skipped.
* This option allows you to control whether a `rejected` action with `meta.condition == false`
* will be dispatched or not.
*
* @default `false`
*/
dispatchConditionRejection?: boolean
serializeError?: (x: unknown) => GetSerializedErrorType<ThunkApiConfig>
/**
* A function to use when generating the `requestId` for the request sequence.
*
* @default `nanoid`
*/
idGenerator?: (arg: ThunkArg) => string
} & IsUnknown<
GetPendingMeta<ThunkApiConfig>,
{
/**
* A method to generate additional properties to be added to `meta` of the pending action.
*
* Using this optional overload will not modify the types correctly, this overload is only in place to support JavaScript users.
* Please use the `ThunkApiConfig` parameter `pendingMeta` to get access to a correctly typed overload
*/
getPendingMeta?(
base: {
arg: ThunkArg
requestId: string
},
api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>,
): GetPendingMeta<ThunkApiConfig>
},
{
/**
* A method to generate additional properties to be added to `meta` of the pending action.
*/
getPendingMeta(
base: {
arg: ThunkArg
requestId: string
},
api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>,
): GetPendingMeta<ThunkApiConfig>
}
>
export type AsyncThunkPendingActionCreator<
ThunkArg,
ThunkApiConfig = {},
> = ActionCreatorWithPreparedPayload<
[string, ThunkArg, GetPendingMeta<ThunkApiConfig>?],
undefined,
string,
never,
{
arg: ThunkArg
requestId: string
requestStatus: 'pending'
} & GetPendingMeta<ThunkApiConfig>
>
export type AsyncThunkRejectedActionCreator<
ThunkArg,
ThunkApiConfig = {},
> = ActionCreatorWithPreparedPayload<
[
Error | null,
string,
ThunkArg,
GetRejectValue<ThunkApiConfig>?,
GetRejectedMeta<ThunkApiConfig>?,
],
GetRejectValue<ThunkApiConfig> | undefined,
string,
GetSerializedErrorType<ThunkApiConfig>,
{
arg: ThunkArg
requestId: string
requestStatus: 'rejected'
aborted: boolean
condition: boolean
} & (
| ({ rejectedWithValue: false } & {
[K in keyof GetRejectedMeta<ThunkApiConfig>]?: undefined
})
| ({ rejectedWithValue: true } & GetRejectedMeta<ThunkApiConfig>)
)
>
export type AsyncThunkFulfilledActionCreator<
Returned,
ThunkArg,
ThunkApiConfig = {},
> = ActionCreatorWithPreparedPayload<
[Returned, string, ThunkArg, GetFulfilledMeta<ThunkApiConfig>?],
Returned,
string,
never,
{
arg: ThunkArg
requestId: string
requestStatus: 'fulfilled'
} & GetFulfilledMeta<ThunkApiConfig>
>
/**
* A type describing the return value of `createAsyncThunk`.
* Might be useful for wrapping `createAsyncThunk` in custom abstractions.
*
* @public
*/
export type AsyncThunk<
Returned,
ThunkArg,
ThunkApiConfig extends AsyncThunkConfig,
> = AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig> & {
pending: AsyncThunkPendingActionCreator<ThunkArg, ThunkApiConfig>
rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>
fulfilled: AsyncThunkFulfilledActionCreator<
Returned,
ThunkArg,
ThunkApiConfig
>
// matchSettled?
settled: (
action: any,
) => action is ReturnType<
| AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>
| AsyncThunkFulfilledActionCreator<Returned, ThunkArg, ThunkApiConfig>
>
typePrefix: string
}
export type OverrideThunkApiConfigs<OldConfig, NewConfig> = Id<
NewConfig & Omit<OldConfig, keyof NewConfig>
>
export type CreateAsyncThunkFunction<
CurriedThunkApiConfig extends AsyncThunkConfig,
> = {
/**
*
* @param typePrefix
* @param payloadCreator
* @param options
*
* @public
*/
// separate signature without `AsyncThunkConfig` for better inference
<Returned, ThunkArg = void>(
typePrefix: string,
payloadCreator: AsyncThunkPayloadCreator<
Returned,
ThunkArg,
CurriedThunkApiConfig
>,
options?: AsyncThunkOptions<ThunkArg, CurriedThunkApiConfig>,
): AsyncThunk<Returned, ThunkArg, CurriedThunkApiConfig>
/**
*
* @param typePrefix
* @param payloadCreator
* @param options
*
* @public
*/
<Returned, ThunkArg, ThunkApiConfig extends AsyncThunkConfig>(
typePrefix: string,
payloadCreator: AsyncThunkPayloadCreator<
Returned,
ThunkArg,
OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>
>,
options?: AsyncThunkOptions<
ThunkArg,
OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>
>,
): AsyncThunk<
Returned,
ThunkArg,
OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>
>
}
type CreateAsyncThunk<CurriedThunkApiConfig extends AsyncThunkConfig> =
CreateAsyncThunkFunction<CurriedThunkApiConfig> & {
withTypes<ThunkApiConfig extends AsyncThunkConfig>(): CreateAsyncThunk<
OverrideThunkApiConfigs<CurriedThunkApiConfig, ThunkApiConfig>
>
}
const externalAbortMessage = 'External signal was aborted'
export const createAsyncThunk = /* @__PURE__ */ (() => {
function createAsyncThunk<
Returned,
ThunkArg,
ThunkApiConfig extends AsyncThunkConfig,
>(
typePrefix: string,
payloadCreator: AsyncThunkPayloadCreator<
Returned,
ThunkArg,
ThunkApiConfig
>,
options?: AsyncThunkOptions<ThunkArg, ThunkApiConfig>,
): AsyncThunk<Returned, ThunkArg, ThunkApiConfig> {
type RejectedValue = GetRejectValue<ThunkApiConfig>
type PendingMeta = GetPendingMeta<ThunkApiConfig>
type FulfilledMeta = GetFulfilledMeta<ThunkApiConfig>
type RejectedMeta = GetRejectedMeta<ThunkApiConfig>
const fulfilled: AsyncThunkFulfilledActionCreator<
Returned,
ThunkArg,
ThunkApiConfig
> = createAction(
typePrefix + '/fulfilled',
(
payload: Returned,
requestId: string,
arg: ThunkArg,
meta?: FulfilledMeta,
) => ({
payload,
meta: {
...((meta as any) || {}),
arg,
requestId,
requestStatus: 'fulfilled' as const,
},
}),
)
const pending: AsyncThunkPendingActionCreator<ThunkArg, ThunkApiConfig> =
createAction(
typePrefix + '/pending',
(requestId: string, arg: ThunkArg, meta?: PendingMeta) => ({
payload: undefined,
meta: {
...((meta as any) || {}),
arg,
requestId,
requestStatus: 'pending' as const,
},
}),
)
const rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig> =
createAction(
typePrefix + '/rejected',
(
error: Error | null,
requestId: string,
arg: ThunkArg,
payload?: RejectedValue,
meta?: RejectedMeta,
) => ({
payload,
error: ((options && options.serializeError) || miniSerializeError)(
error || 'Rejected',
) as GetSerializedErrorType<ThunkApiConfig>,
meta: {
...((meta as any) || {}),
arg,
requestId,
rejectedWithValue: !!payload,
requestStatus: 'rejected' as const,
aborted: error?.name === 'AbortError',
condition: error?.name === 'ConditionError',
},
}),
)
function actionCreator(
arg: ThunkArg,
{ signal }: AsyncThunkDispatchConfig = {},
): AsyncThunkAction<Returned, ThunkArg, Required<ThunkApiConfig>> {
return (dispatch, getState, extra) => {
const requestId = options?.idGenerator
? options.idGenerator(arg)
: nanoid()
const abortController = new AbortController()
let abortHandler: (() => void) | undefined
let abortReason: string | undefined
function abort(reason?: string) {
abortReason = reason
abortController.abort()
}
if (signal) {
if (signal.aborted) {
abort(externalAbortMessage)
} else {
signal.addEventListener(
'abort',
() => abort(externalAbortMessage),
{ once: true },
)
}
}
const promise = (async function () {
let finalAction: ReturnType<typeof fulfilled | typeof rejected>
try {
let conditionResult = options?.condition?.(arg, { getState, extra })
if (isThenable(conditionResult)) {
conditionResult = await conditionResult
}
if (conditionResult === false || abortController.signal.aborted) {
// eslint-disable-next-line no-throw-literal
throw {
name: 'ConditionError',
message: 'Aborted due to condition callback returning false.',
}
}
const abortedPromise = new Promise<never>((_, reject) => {
abortHandler = () => {
reject({
name: 'AbortError',
message: abortReason || 'Aborted',
})
}
abortController.signal.addEventListener('abort', abortHandler)
})
dispatch(
pending(
requestId,
arg,
options?.getPendingMeta?.(
{ requestId, arg },
{ getState, extra },
),
) as any,
)
finalAction = await Promise.race([
abortedPromise,
Promise.resolve(
payloadCreator(arg, {
dispatch,
getState,
extra,
requestId,
signal: abortController.signal,
abort,
rejectWithValue: ((
value: RejectedValue,
meta?: RejectedMeta,
) => {
return new RejectWithValue(value, meta)
}) as any,
fulfillWithValue: ((value: unknown, meta?: FulfilledMeta) => {
return new FulfillWithMeta(value, meta)
}) as any,
}),
).then((result) => {
if (result instanceof RejectWithValue) {
throw result
}
if (result instanceof FulfillWithMeta) {
return fulfilled(result.payload, requestId, arg, result.meta)
}
return fulfilled(result as any, requestId, arg)
}),
])
} catch (err) {
finalAction =
err instanceof RejectWithValue
? rejected(null, requestId, arg, err.payload, err.meta)
: rejected(err as any, requestId, arg)
} finally {
if (abortHandler) {
abortController.signal.removeEventListener('abort', abortHandler)
}
}
// We dispatch the result action _after_ the catch, to avoid having any errors
// here get swallowed by the try/catch block,
// per https://twitter.com/dan_abramov/status/770914221638942720
// and https://github.com/reduxjs/redux-toolkit/blob/e85eb17b39a2118d859f7b7746e0f3fee523e089/docs/tutorials/advanced-tutorial.md#async-error-handling-logic-in-thunks
const skipDispatch =
options &&
!options.dispatchConditionRejection &&
rejected.match(finalAction) &&
(finalAction as any).meta.condition
if (!skipDispatch) {
dispatch(finalAction as any)
}
return finalAction
})()
return Object.assign(promise as SafePromise<any>, {
abort,
requestId,
arg,
unwrap() {
return promise.then<any>(unwrapResult)
},
})
}
}
return Object.assign(
actionCreator as AsyncThunkActionCreator<
Returned,
ThunkArg,
ThunkApiConfig
>,
{
pending,
rejected,
fulfilled,
settled: isAnyOf(rejected, fulfilled),
typePrefix,
},
)
}
createAsyncThunk.withTypes = () => createAsyncThunk
return createAsyncThunk as CreateAsyncThunk<AsyncThunkConfig>
})()
interface UnwrappableAction {
payload: any
meta?: any
error?: any
}
type UnwrappedActionPayload<T extends UnwrappableAction> = Exclude<
T,
{ error: any }
>['payload']
/**
* @public
*/
export function unwrapResult<R extends UnwrappableAction>(
action: R,
): UnwrappedActionPayload<R> {
if (action.meta && action.meta.rejectedWithValue) {
throw action.payload
}
if (action.error) {
throw action.error
}
return action.payload
}
type WithStrictNullChecks<True, False> = undefined extends boolean
? False
: True
function isThenable(value: any): value is PromiseLike<any> {
return (
value !== null &&
typeof value === 'object' &&
typeof value.then === 'function'
)
}
@@ -0,0 +1,2 @@
function e(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then}function t(e){switch(typeof e){case"string":case"symbol":return e.toString();case"function":return e.name;default:throw new Error(`Unexpected ${typeof e} service id type`)}}const n=Symbol.for("@inversifyjs/common/islazyServiceIdentifier");class r{[n];#e;constructor(e){this.#e=e,this[n]=!0}static is(e){return"object"==typeof e&&null!==e&&!0===e[n]}unwrap(){return this.#e()}}export{r as LazyServiceIdentifier,e as isPromise,t as stringifyServiceIdentifier};
//# sourceMappingURL=index.js.map
@@ -0,0 +1,13 @@
export type Options = [
{
allowArgumentsExplicitlyTypedAsAny?: boolean;
allowDirectConstAssertionInArrowFunctions?: boolean;
allowedNames?: string[];
allowHigherOrderFunctions?: boolean;
allowTypedFunctionExpressions?: boolean;
allowOverloadFunctions?: boolean;
}
];
export type MessageIds = 'anyTypedArg' | 'anyTypedArgUnnamed' | 'missingArgType' | 'missingArgTypeUnnamed' | 'missingReturnType';
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,95 @@
# structuredClone polyfill
[![Downloads](https://img.shields.io/npm/dm/@ungap/structured-clone.svg)](https://www.npmjs.com/package/@ungap/structured-clone) [![build status](https://github.com/ungap/structured-clone/actions/workflows/node.js.yml/badge.svg)](https://github.com/ungap/structured-clone/actions) [![Coverage Status](https://coveralls.io/repos/github/ungap/structured-clone/badge.svg?branch=main)](https://coveralls.io/github/ungap/structured-clone?branch=main)
An env agnostic serializer and deserializer with recursion ability and types beyond *JSON* from the *HTML* standard itself.
* [Supported Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types)
* *not supported yet*: Blob, File, FileList, ImageBitmap, ImageData or others non *JS* types but typed arrays are supported without major issues, but u/int8, u/int16, and u/int32 are the only safely suppored (right now).
* *not possible to implement*: the `{transfer: []}` option can be passed but it's completely ignored.
* [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone)
* [Serializer](https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal)
* [Deserializer](https://html.spec.whatwg.org/multipage/structured-data.html#structureddeserialize)
Serialized values can be safely stringified as *JSON* too, and deserialization resurrect all values, even recursive, or more complex than what *JSON* allows.
### Examples
Check the [100% test coverage](./test/index.js) to know even more.
```js
// as default export
import structuredClone from '@ungap/structured-clone';
const cloned = structuredClone({any: 'serializable'});
// as independent serializer/deserializer
import {serialize, deserialize} from '@ungap/structured-clone';
// the result can be stringified as JSON without issues
// even if there is recursive data, bigint values,
// typed arrays, and so on
const serialized = serialize({any: 'serializable'});
// the result will be a replica of the original object
const deserialized = deserialize(serialized);
```
#### Global Polyfill
Note: Only monkey patch the global if needed. This polyfill works just fine as an explicit import: `import structuredClone from "@ungap/structured-clone"`
```js
// Attach the polyfill as a Global function
import structuredClone from "@ungap/structured-clone";
if (!("structuredClone" in globalThis)) {
globalThis.structuredClone = structuredClone;
}
// Or don't monkey patch
import structuredClone from "@ungap/structured-clone"
// Just use it in the file
structuredClone()
```
**Note**: Do not attach this module's default export directly to the global scope, whithout a conditional guard to detect a native implementation. In environments where there is a native global implementation of `structuredClone()` already, assignment to the global object will result in an infinite loop when `globalThis.structuredClone()` is called. See the example above for a safe way to provide the polyfill globally in your project.
### Extra Features
There is no middle-ground between the structured clone algorithm and JSON:
* JSON is more relaxed about incompatible values: it just ignores these
* Structured clone is inflexible regarding incompatible values, yet it makes specialized instances impossible to reconstruct, plus it doesn't offer any helper, such as `toJSON()`, to make serialization possible, or better, with specific cases
This module specialized `serialize` export offers, within the optional extra argument, a **lossy** property to avoid throwing when incompatible types are found down the road (function, symbol, ...), so that it is possible to send with less worrying about thrown errors.
```js
// as default export
import structuredClone from '@ungap/structured-clone';
const cloned = structuredClone(
{
method() {
// ignored, won't be cloned
},
special: Symbol('also ignored')
},
{
// avoid throwing
lossy: true,
// avoid throwing *and* looks for toJSON
json: true
}
);
```
The behavior is the same found in *JSON* when it comes to *Array*, so that unsupported values will result as `null` placeholders instead.
#### toJSON
If `lossy` option is not enough, `json` will actually enforce `lossy` and also check for `toJSON` method when objects are parsed.
Alternative, the `json` exports combines all features:
```js
import {stringify, parse} from '@ungap/structured-clone/json';
parse(stringify({any: 'serializable'}));
```
@@ -0,0 +1,29 @@
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
* and returns an array of their indexes.
*
* @private
* @param {Array} array The array to modify.
* @param {*} placeholder The placeholder to replace.
* @returns {Array} Returns the new array of placeholder indexes.
*/
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
result[resIndex++] = index;
}
}
return result;
}
module.exports = replaceHolders;
@@ -0,0 +1,8 @@
const createHtmlRenderState = () => ({
style: {},
transform: {},
transformOrigin: {},
vars: {},
});
export { createHtmlRenderState };
@@ -0,0 +1,4 @@
import { stringify } from '../index.js'
export * from '../index.js'
export default stringify
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parse = exports.Mutate = exports.Hash = exports.Equal = exports.Encode = exports.Edit = exports.Patch = exports.Diff = exports.Default = exports.Decode = exports.Create = exports.Convert = exports.Clone = exports.Clean = exports.Check = exports.Cast = exports.Assert = exports.ValueErrorIterator = exports.Errors = void 0;
var index_1 = require("../../errors/index");
Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return index_1.Errors; } });
Object.defineProperty(exports, "ValueErrorIterator", { enumerable: true, get: function () { return index_1.ValueErrorIterator; } });
var index_2 = require("../assert/index");
Object.defineProperty(exports, "Assert", { enumerable: true, get: function () { return index_2.Assert; } });
var index_3 = require("../cast/index");
Object.defineProperty(exports, "Cast", { enumerable: true, get: function () { return index_3.Cast; } });
var index_4 = require("../check/index");
Object.defineProperty(exports, "Check", { enumerable: true, get: function () { return index_4.Check; } });
var index_5 = require("../clean/index");
Object.defineProperty(exports, "Clean", { enumerable: true, get: function () { return index_5.Clean; } });
var index_6 = require("../clone/index");
Object.defineProperty(exports, "Clone", { enumerable: true, get: function () { return index_6.Clone; } });
var index_7 = require("../convert/index");
Object.defineProperty(exports, "Convert", { enumerable: true, get: function () { return index_7.Convert; } });
var index_8 = require("../create/index");
Object.defineProperty(exports, "Create", { enumerable: true, get: function () { return index_8.Create; } });
var index_9 = require("../decode/index");
Object.defineProperty(exports, "Decode", { enumerable: true, get: function () { return index_9.Decode; } });
var index_10 = require("../default/index");
Object.defineProperty(exports, "Default", { enumerable: true, get: function () { return index_10.Default; } });
var index_11 = require("../delta/index");
Object.defineProperty(exports, "Diff", { enumerable: true, get: function () { return index_11.Diff; } });
Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return index_11.Patch; } });
Object.defineProperty(exports, "Edit", { enumerable: true, get: function () { return index_11.Edit; } });
var index_12 = require("../encode/index");
Object.defineProperty(exports, "Encode", { enumerable: true, get: function () { return index_12.Encode; } });
var index_13 = require("../equal/index");
Object.defineProperty(exports, "Equal", { enumerable: true, get: function () { return index_13.Equal; } });
var index_14 = require("../hash/index");
Object.defineProperty(exports, "Hash", { enumerable: true, get: function () { return index_14.Hash; } });
var index_15 = require("../mutate/index");
Object.defineProperty(exports, "Mutate", { enumerable: true, get: function () { return index_15.Mutate; } });
var index_16 = require("../parse/index");
Object.defineProperty(exports, "Parse", { enumerable: true, get: function () { return index_16.Parse; } });
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more