Compare commits

..
1 Commits
Author SHA1 Message Date
TanTan e311ca3275 docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
2026-11-13 09:25:58 +08:00
35554 changed files with 6229626 additions and 4 deletions

No files matched your search

@@ -0,0 +1 @@
{"name":"is-decimal","version":"2.0.1","requiresBuild":false,"files":{"license":{"checkedAt":1794532114184,"integrity":"sha512-cQvy4TvDNGTww5W7wo7SHRjv/0G8g3u/v8V2BhwwrAM+M5M2Z7W8hy+cQrU+e4exnULY2LrZ0EQqBk6Fj/Sdrw==","mode":420,"size":1099},"index.js":{"checkedAt":1794532114184,"integrity":"sha512-Ef/WzDdNlRURFEKenzZy582/8P2ed9J2cO7S4xXYfkZp4MiGrEmq292IdzAWnI0bew3OUeisRkiWCn+evQ355A==","mode":420,"size":374},"package.json":{"checkedAt":1794532114184,"integrity":"sha512-07zzsdzPQHfwaMGiIB1f8LjbjOTvsaoI6oHxUF6zuBJezQ7GmLpGU/QthVji9qMfxBvIXA4zneWnUFJMo6dpzA==","mode":420,"size":1848},"readme.md":{"checkedAt":1794532114184,"integrity":"sha512-OW2cwzgiiI2Lwv26BYTyPUA6XBJWWvWv5Z6l84dzhbaGyMvjc+6DFcq67o7DIgMUKzWj8m22xY5jmrfMKG9EJw==","mode":420,"size":3307},"index.d.ts":{"checkedAt":1794532114184,"integrity":"sha512-zHr5yf8VKaT29+lgapoh4jrDPc8HLtw4M7k81joHZ11Ct7nmkTa8vBUBop4NykdhBO3iPl/e+oKx8n3KsQPLHA==","mode":420,"size":264}}}
@@ -0,0 +1,30 @@
'use strict';
var testArray = function testArray(t, actual, expected, msg) {
t.deepEqual(actual, expected, msg);
t.equal(actual.length, expected.length, 'expected ' + expected.length + ', got ' + actual.length);
};
module.exports = function (flat, t) {
t.test('flattens', function (st) {
testArray(st, flat([1, [2], [[3]], [[['four']]]]), [1, 2, [3], [['four']]], 'missing depth only flattens 1 deep');
testArray(st, flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, [3], [['four']]], 'depth of 1 only flattens 1 deep');
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, 3, ['four']], 'depth of 1 only flattens 1 deep: sanity check');
testArray(st, flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, ['four']], 'depth of 2 only flattens 2 deep');
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, 'four'], 'depth of 2 only flattens 2 deep: sanity check');
testArray(st, flat([1, [2], [[3]], [[['four']]]], 3), [1, 2, 3, 'four'], 'depth of 3 only flattens 3 deep');
testArray(st, flat([1, [2], [[3]], [[['four']]]], Infinity), [1, 2, 3, 'four'], 'depth of Infinity flattens all the way');
st.end();
});
t.test('sparse arrays', function (st) {
// eslint-disable-next-line no-sparse-arrays
st.deepEqual(flat([, [1]]), flat([[], [1]]), 'an array hole is treated the same as an empty array');
st.end();
});
};
@@ -0,0 +1 @@
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAkGM,SAAS,0CAAkB,OAA8B;IAC9D,IAAI,EACF,kBAAkB,OAAO,OACzB,GAAG,OACH,GAAG,yBACH,qBAAqB,yBACrB,qBAAqB,SACrB,KAAK,cACL,UAAU,YACV,QAAQ,8BACR,0BAA0B,gBAC1B,eAAe,UAChB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ;IAErB,IAAI,WAAW,CAAC;QACd,IAAI,EAAE,WAAW,KAAK,cAAc,CAAA,GAAA,yCAA+B,EAAE,IACnE,QAAQ,eAAe,CAAC;aACnB;YACL,IAAI,QAAQ,aAAa,KAAK,QAC5B;YAGF,IAAI,QAAQ,MAAM,CAAC,MAAM;gBACvB,IAAI,iBAAiB,eAAe,IAAI,OAAO,EAAE;oBAC/C,IAAI,YAAY,QAAQ,YAAY,CAAC;oBACrC,OAAO,IAAI,CAAC,IAAI,OAAO,EAAE,GAAG,UAAU,IAAI,EAAE,UAAU,aAAa;oBACnE,qFAAqF;oBACrF,QAAQ,eAAe,CAAC,QAAQ,YAAY;oBAC5C;gBACF,OAAO,IAAI,iBAAiB,cAAc,iBAAiB,QACzD;YAEJ;YAEA,IAAI,QAAQ,aAAa,KAAK;gBAC5B,IAAI,QAAQ,UAAU,CAAC,QAAQ,CAAC,QAAQ,sBAAsB,EAC5D,QAAQ,eAAe,CAAC;qBAExB,QAAQ,gBAAgB,CAAC;mBAEtB,IAAI,KAAK,EAAE,QAAQ,EACxB,QAAQ,eAAe,CAAC;iBACnB,IAAI,QAAQ,iBAAiB,KAAK,YAAa,KAAM,CAAA,CAAA,GAAA,yCAAe,EAAE,MAAM,EAAE,WAAW,KAAK,WAAW,EAAE,WAAW,KAAK,SAAQ,GACxI,wIAAwI;YACxI,QAAQ,eAAe,CAAC;iBAExB,QAAQ,gBAAgB,CAAC;QAE7B;IACF;IAEA,sEAAsE;IACtE,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,YAAY,QAAQ,QAAQ,UAAU;QAC1C,IAAI,aAAa,QAAQ,SAAS,IAAI,CAAC,uBAAuB;YAC5D,IAAI,OACF;iBACK,IAAI,SAAS,aAAa,KAAK,IAAI,OAAO,IAAI,IAAI,OAAO,EAC9D,CAAA,GAAA,kBAAU,EAAE,IAAI,OAAO;QAE3B;IACF,uDAAuD;IACvD,GAAG;QAAC;QAAK;QAAK,QAAQ,UAAU;QAAE,QAAQ,kBAAkB;QAAE,QAAQ,SAAS;QAAE;KAAsB;IAEvG,aAAa,cAAc,QAAQ,UAAU,CAAC;IAC9C,6FAA6F;IAC7F,2FAA2F;IAC3F,mEAAmE;IACnE,IAAI,YAA6C,CAAC;IAClD,IAAI,CAAC,yBAAyB,CAAC,YAC7B,YAAY;QACV,UAAU,QAAQ,QAAQ,UAAU,GAAG,IAAI;QAC3C,SAAQ,CAAC;YACP,IAAI,EAAE,MAAM,KAAK,IAAI,OAAO,EAC1B,QAAQ,aAAa,CAAC;QAE1B;IACF;SACK,IAAI,YACT,UAAU,WAAW,GAAG,CAAC;QACvB,oEAAoE;QACpE,EAAE,cAAc;IAClB;IAGF,gHAAgH;IAChH,wHAAwH;IACxH,6GAA6G;IAC7G,mFAAmF;IACnF,IAAI,iBAAiB,QAAQ,MAAM,CAAC,QAAQ,iBAAiB;IAC7D,IAAI,gBAAgB,QAAQ,MAAM,CAAC,QAAQ,iBAAiB,eAAe,iBAAiB;IAC5F,IAAI,kBAAkB,CAAC,cAAc,QAAQ,aAAa,CAAC,QAAQ,CAAC;IACpE,IAAI,gBAAgB,AAAC,CAAA,YAAY,aAAY,KAAM,CAAC;IACpD,IAAI,mBAAmB,iBACrB,CAAA,QAAQ,iBAAiB,KAAK,YAC1B,CAAC,kBACD,CAAC,mBAAmB,QAAQ,OAAO,AAAD;IAExC,IAAI,qBAAqB,iBAAiB,mBAAmB,QAAQ,iBAAiB,KAAK;IAC3F,IAAI,YAAY,oBAAoB;IACpC,IAAI,WAAW,CAAA,GAAA,aAAK,EAAsB;IAE1C,IAAI,mBAAmB,aAAa;IACpC,IAAI,+BAA+B,CAAA,GAAA,aAAK,EAAE;IAC1C,IAAI,+BAA+B,CAAA,GAAA,aAAK,EAAE;IAE1C,IAAI,gBAAgB,CAAC;QACnB,IAAI,UACF;QAGF,IAAI,iBAAiB,IAAI,OAAO,EAAE;YAChC,IAAI,YAAY,QAAQ,YAAY,CAAC;YACrC,OAAO,IAAI,CAAC,IAAI,OAAO,EAAE,GAAG,UAAU,IAAI,EAAE,UAAU,aAAa;QACrE;IACF;IAEA,oFAAoF;IACpF,4DAA4D;IAC5D,8EAA8E;IAC9E,sFAAsF;IACtF,qFAAqF;IACrF,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,iBAA6B,CAAC;IAClC,IAAI,uBAAuB;QACzB,eAAe,YAAY,GAAG,CAAC;YAC7B,SAAS,OAAO,GAAG,EAAE,WAAW;YAChC,6BAA6B,OAAO,GAAG;YACvC,IAAI,EAAE,WAAW,KAAK,cAAe,CAAA,CAAC,aAAa,sCAAe,GAChE,SAAS;QAEb;QAEA,8IAA8I;QAC9I,+HAA+H;QAC/H,IAAI,CAAC,4BACH,eAAe,OAAO,GAAG,CAAC;YACxB,IAAI,oBAAqB,sBAAsB,EAAE,WAAW,KAAK,SAAU;gBACzE,IAAI,EAAE,WAAW,KAAK,cAAc,CAAC,qCACnC;gBAGF,cAAc;YAChB,OAAO,IAAI,EAAE,WAAW,KAAK,cAAc,iBACzC,SAAS;QAEb;aACK;YACL,eAAe,SAAS,GAAG,mBAAmB,YAAY,CAAC;gBACzD,IAAI,EAAE,WAAW,KAAK,cAAc,iBAClC,SAAS;YAEb;YAEA,eAAe,OAAO,GAAG,mBAAmB,gBAAgB;QAC9D;IACF,OAAO;QACL,eAAe,YAAY,GAAG,CAAC;YAC7B,SAAS,OAAO,GAAG,EAAE,WAAW;YAChC,6BAA6B,OAAO,GAAG;YACvC,6BAA6B,OAAO,GAAG;YAEvC,sFAAsF;YACtF,8FAA8F;YAC9F,iDAAiD;YACjD,IACE,mBACE,CAAA,AAAC,EAAE,WAAW,KAAK,WAAW,CAAC,oBAC9B,EAAE,WAAW,KAAK,cAAe,CAAA,CAAC,iBAAiB,sCAAe,CAAE,GAGvE,SAAS;QAEb;QAEA,eAAe,OAAO,GAAG,CAAC;YACxB,4EAA4E;YAC5E,+EAA+E;YAC/E,kEAAkE;YAClE,IACE,EAAE,WAAW,KAAK,WAClB,EAAE,WAAW,KAAK,SAClB,EAAE,WAAW,KAAK,aACjB,EAAE,WAAW,KAAK,cAAc,aAAa,uCAC7C,EAAE,WAAW,KAAK,WAAW,6BAA6B,OAAO,EAClE;gBACA,IAAI,WACF,cAAc;qBACT,IAAI,iBACT,SAAS;YAEb;QACF;IACF;IAEA,SAAS,CAAC,WAAW,GAAG;IACxB,eAAe,mBAAmB,GAAG;IACrC,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;IAEvC,sFAAsF;IACtF,IAAI,gBAAgB,qBAAqB,CAAC;QACxC,IAAI,SAAS,OAAO,KAAK,SAAS;YAChC,EAAE,eAAe;YACjB,EAAE,cAAc;YAChB,cAAc;QAChB;IACF,IAAI;IAEJ,sGAAsG;IACtG,mGAAmG;IACnG,4FAA4F;IAC5F,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAClC,YAAY,CAAC;QACb,aAAY,CAAC;YACX,IAAI,EAAE,WAAW,KAAK,SAAS;gBAC7B,SAAS;gBACT,QAAQ,oBAAoB,CAAC;YAC/B;QACF;IACF;IAEA,8EAA8E;IAC9E,yEAAyE;IACzE,6EAA6E;IAC7E,kCAAkC;IAClC,IAAI,qBAAqB,CAAA;QACvB,IAAI,SAAS,OAAO,KAAK,WAAW,6BAA6B,OAAO,EACtE,EAAE,cAAc;IAEpB;IAEA,4DAA4D;IAC5D,gDAAgD;IAChD,IAAI,UAAU,QAAQ,MAAM,CAAC,OAAO,CAAA;QAClC,IAAI,CAAC,AAAC,CAAA,GAAA,eAAO,EAAU,SAAS,EAC9B,EAAE,cAAc;IAEpB,IAAI;IAEJ,OAAO;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,WACA,mBAAmB,mBAAmB,aAAa,CAAC,GACpD,mBAAmB,iBAAiB,CAAC,GACrC;2BAAC;gCAAe;qBAAoB;QAAO;mBAE7C;QACA,YAAY,QAAQ,UAAU,CAAC;QAC/B,WAAW,QAAQ,SAAS,IAAI,QAAQ,UAAU,KAAK;oBACvD;yBACA;mBACA;IACF;AACF;AAEA,SAAS;IACP,IAAI,QAAQ,OAAO,KAAK;IACxB,OAAO,CAAA,kBAAA,4BAAA,MAAO,GAAG,MAAK;AACxB;AAEA,SAAS;IACP,IAAI,QAAQ,OAAO,KAAK;IACxB,OAAO,CAAA,kBAAA,4BAAA,MAAO,GAAG,MAAK,OAAO,CAAA,kBAAA,4BAAA,MAAO,IAAI,MAAK;AAC/C","sources":["packages/@react-aria/selection/src/useSelectableItem.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 * Line truncated
@@ -0,0 +1,183 @@
import type { AST_NODE_TYPES, AST_TOKEN_TYPES } from '../ts-estree';
import type { ClassicConfig } from './Config';
import type { Linter } from './Linter';
import type { ParserOptions } from './ParserOptions';
import type { ReportDescriptorMessageData, RuleCreateFunction, RuleModule, SharedConfigurationSettings } from './Rule';
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export interface ValidTestCase<Options extends readonly unknown[]> {
/**
* Code for the test case.
*/
readonly code: string;
/**
* Environments for the test case.
*/
readonly env?: Readonly<Linter.EnvironmentConfig>;
/**
* The fake filename for the test case. Useful for rules that make assertion about filenames.
*/
readonly filename?: string;
/**
* The additional global variables.
*/
readonly globals?: Readonly<Linter.GlobalsConfig>;
/**
* Name for the test case.
*/
readonly name?: string;
/**
* Run this case exclusively for debugging in supported test frameworks.
*/
readonly only?: boolean;
/**
* Options for the test case.
*/
readonly options?: Readonly<Options>;
/**
* The absolute path for the parser.
*/
readonly parser?: string;
/**
* Options for the parser.
*/
readonly parserOptions?: Readonly<ParserOptions>;
/**
* Settings for the test case.
*/
readonly settings?: Readonly<SharedConfigurationSettings>;
}
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export interface SuggestionOutput<MessageIds extends string> {
/**
* The data used to fill the message template.
*/
readonly data?: ReportDescriptorMessageData;
/**
* Reported message ID.
*/
readonly messageId: MessageIds;
/**
* NOTE: Suggestions will be applied as a stand-alone change, without triggering multi-pass fixes.
* Each individual error has its own suggestion, so you have to show the correct, _isolated_ output for each suggestion.
*/
readonly output: string;
}
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export interface InvalidTestCase<MessageIds extends string, Options extends readonly unknown[]> extends ValidTestCase<Options> {
/**
* Expected errors.
*/
readonly errors: readonly TestCaseError<MessageIds>[];
/**
* The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested.
*/
readonly output?: string | string[] | null;
}
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export interface TestCaseError<MessageIds extends string> {
/**
* The 1-based column number of the reported start location.
*/
readonly column?: number;
/**
* The data used to fill the message template.
*/
readonly data?: ReportDescriptorMessageData;
/**
* The 1-based column number of the reported end location.
*/
readonly endColumn?: number;
/**
* The 1-based line number of the reported end location.
*/
readonly endLine?: number;
/**
* The 1-based line number of the reported start location.
*/
readonly line?: number;
/**
* Reported message ID.
*/
readonly messageId: MessageIds;
/**
* Reported suggestions.
*/
readonly suggestions?: readonly SuggestionOutput<MessageIds>[] | null;
/**
* The type of the reported AST node.
*/
readonly type?: AST_NODE_TYPES | AST_TOKEN_TYPES;
}
/**
* @param text a string describing the rule
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export type RuleTesterTestFrameworkFunction = (text: string, callback: () => void) => void;
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export interface RunTests<MessageIds extends string, Options extends readonly unknown[]> {
readonly invalid: readonly InvalidTestCase<MessageIds, Options>[];
readonly valid: readonly (string | ValidTestCase<Options>)[];
}
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export interface RuleTesterConfig extends ClassicConfig.Config {
readonly parser: string;
readonly parserOptions?: Readonly<ParserOptions>;
}
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
declare class RuleTesterBase {
/**
* Creates a new instance of RuleTester.
* @param testerConfig extra configuration for the tester
*/
constructor(testerConfig?: RuleTesterConfig);
/**
* Adds a new rule test to execute.
* @param ruleName The name of the rule to run.
* @param rule The rule to test.
* @param tests The collection of tests to run.
*/
run<MessageIds extends string, Options extends readonly unknown[]>(ruleName: string, rule: RuleModule<MessageIds, Options>, tests: RunTests<MessageIds, Options>): void;
/**
* If you supply a value to this property, the rule tester will call this instead of using the version defined on
* the global namespace.
*/
static get describe(): RuleTesterTestFrameworkFunction;
static set describe(value: RuleTesterTestFrameworkFunction | undefined);
/**
* If you supply a value to this property, the rule tester will call this instead of using the version defined on
* the global namespace.
*/
static get it(): RuleTesterTestFrameworkFunction;
static set it(value: RuleTesterTestFrameworkFunction | undefined);
/**
* If you supply a value to this property, the rule tester will call this instead of using the version defined on
* the global namespace.
*/
static get itOnly(): RuleTesterTestFrameworkFunction;
static set itOnly(value: RuleTesterTestFrameworkFunction | undefined);
/**
* Define a rule for one particular run of tests.
*/
defineRule<MessageIds extends string, Options extends readonly unknown[]>(name: string, rule: RuleCreateFunction<MessageIds, Options> | RuleModule<MessageIds, Options>): void;
}
declare const RuleTester_base: typeof RuleTesterBase;
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
export declare class RuleTester extends RuleTester_base {
}
export {};
@@ -0,0 +1 @@
module.exports={C:{"4":0.00679,"56":0.0034,"72":0.00679,"78":0.0034,"101":0.0034,"112":0.0034,"115":0.10528,"127":0.02038,"128":0.01019,"133":0.0034,"136":0.00679,"137":0.0034,"138":0.0034,"139":0.00679,"140":0.02717,"141":0.01019,"142":0.03736,"143":0.56034,"144":0.45167,"145":0.01358,_:"2 3 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 52 53 54 55 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 103 104 105 106 107 108 109 110 111 113 114 116 117 118 119 120 121 122 123 124 125 126 129 130 131 132 134 135 146 147 3.5 3.6"},D:{"43":0.0034,"44":0.0034,"46":0.0034,"47":0.0034,"48":0.0034,"49":0.01019,"50":0.0034,"51":0.0034,"52":0.0034,"53":0.0034,"54":0.0034,"55":0.0034,"56":0.0034,"58":0.0034,"59":0.0034,"60":0.0034,"63":0.0034,"64":0.00679,"68":0.00679,"69":0.0034,"70":0.02377,"71":0.00679,"72":0.00679,"73":0.0034,"74":0.01358,"75":0.01698,"76":0.02377,"77":0.01019,"78":0.0034,"79":0.02377,"80":0.02038,"81":0.00679,"83":0.01019,"84":0.00679,"85":0.0034,"86":0.02038,"87":0.01019,"88":0.0034,"89":0.00679,"90":0.0034,"91":0.00679,"92":0.0034,"93":0.02717,"94":0.01019,"95":0.00679,"96":0.0034,"97":0.01698,"98":0.01358,"99":0.00679,"100":0.0034,"101":0.0034,"102":0.0034,"103":0.07811,"104":0.01358,"105":0.35658,"106":0.00679,"108":0.0034,"109":0.77089,"110":0.00679,"111":0.01019,"113":0.01019,"114":0.03736,"115":0.0034,"116":0.05773,"117":0.00679,"118":0.01019,"119":0.02377,"120":0.00679,"121":0.00679,"122":0.03056,"123":0.01698,"124":0.04075,"125":0.97126,"126":0.04754,"127":0.01358,"128":0.05434,"129":0.01019,"130":0.02717,"131":0.0849,"132":0.03736,"133":0.03736,"134":0.05773,"135":0.05434,"136":0.07471,"137":0.12565,"138":0.39054,"139":0.50261,"140":3.69485,"141":6.8735,"142":0.09169,"143":0.00679,_:"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 45 57 61 62 65 66 67 107 112 144 145"},F:{"18":0.0034,"42":0.0034,"68":0.0034,"79":0.00679,"86":0.0034,"87":0.0034,"88":0.0034,"90":0.01019,"91":0.07811,"92":0.05434,"95":0.03396,"113":0.0034,"114":0.0034,"116":0.0034,"117":0.0034,"118":0.0034,"119":0.00679,"120":0.22414,"121":0.02377,"122":0.92371,_:"9 11 12 15 16 17 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 85 89 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.01019,"13":0.0034,"14":0.00679,"15":0.02377,"16":0.0034,"17":0.00679,"18":0.05094,"84":0.01019,"85":0.0034,"89":0.01698,"90":0.02038,"92":0.07471,"100":0.02377,"109":0.01358,"111":0.0034,"112":0.0034,"114":0.01698,"116":0.0034,"122":0.03396,"124":0.0034,"126":0.0034,"127":0.0034,"128":0.0034,"129":0.0034,"130":0.01358,"131":0.02038,"132":0.00679,"133":0.0034,"134":0.01019,"135":0.01019,"136":0.02038,"137":0.01698,"138":0.05434,"139":0.0849,"140":0.66901,"141":2.13608,"142":0.01358,_:"79 80 81 83 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 113 115 117 118 119 120 121 123 125"},E:{"11":0.00679,"13":0.00679,"14":0.0034,_:"0 4 5 6 7 8 9 10 12 15 3.1 3.2 6.1 7.1 9.1 10.1 15.2-15.3 15.4 15.5 16.0 16.2 26.2","5.1":0.0034,"11.1":0.01019,"12.1":0.0034,"13.1":0.03056,"14.1":0.00679,"15.1":0.0034,"15.6":0.0815,"16.1":0.0034,"16.3":0.0034,"16.4":0.0034,"16.5":0.0034,"16.6":0.05773,"17.0":0.0034,"17.1":0.01019,"17.2":0.0034,"17.3":0.00679,"17.4":0.00679,"17.5":0.01019,"17.6":0.05773,"18.0":0.0034,"18.1":0.00679,"18.2":0.0034,"18.3":0.02038,"18.4":0.01358,"18.5-18.6":0.05094,"26.0":0.23772,"26.1":0.00679},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00117,"5.0-5.1":0,"6.0-6.1":0.00468,"7.0-7.1":0.00351,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.01054,"10.0-10.2":0.00117,"10.3":0.01991,"11.0-11.2":0.29506,"11.3-11.4":0.00703,"12.0-12.1":0.00234,"12.2-12.5":0.05737,"13.0-13.1":0,"13.2":0.00585,"13.3":0.00234,"13.4-13.7":0.00937,"14.0-14.4":0.01991,"14.5-14.8":0.02108,"15.0-15.1":0.01991,"15.2-15.3":0.01522,"15.4":0.01756,"15.5":0.01991,"15.6-15.8":0.25994,"16.0":0.03513,"16.1":0.06557,"16.2":0.03396,"16.3":0.06089,"16.4":0.01522,"16.5":0.02693,"16.6-16.7":0.34775,"17.0":0.02459,"17.1":0.03747,"17.2":0.02693,"17.3":0.03981,"17.4":0.07025,"17.5":0.1206,"17.6-17.7":0.30443,"18.0":0.06908,"18.1":0.14285,"18.2":0.07728,"18.3":0.24823,"18.4":0.12763,"18.5-18.6":6.5078,"26.0":0.8044,"26.1":0.02927},P:{"4":0.11326,"21":0.0103,"22":0.04118,"23":0.0103,"24":0.17503,"25":0.38095,"26":0.05148,"27":0.33977,"28":1.21493,"29":0.03089,_:"20 6.2-6.4 8.2 10.1 12.0 14.0 15.0 18.0","5.0-5.4":0.05148,"7.2-7.4":0.09266,"9.2":0.0103,"11.1-11.2":0.03089,"13.0":0.0103,"16.0":0.02059,"17.0":0.0103,"19.0":0.02059},I:{"0":0.05276,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00003},K:{"0":9.4711Line truncated
@@ -0,0 +1,110 @@
# es-iterator-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
An ESnext spec-compliant sync iterator helpers shim/polyfill/replacement that works as far down as ES3.
This package implements the [es-shim API](https://github.com/es-shims/api) “multi” interface. It works in an ES3-supported environment and complies with the [iterator helpers spec](https://tc39.es/proposal-iterator-helpers/) and the [iterator sequencing spec](https://tc39.es/proposal-iterator-sequencing/).
Because the `Iterator.prototype` methods depend on a receiver (the `this` value), the main export in each subdirectory takes the iterator to operate on as the first argument.
The main export of the package itself is simply an array of the available directory names. It’s sole intended use is for build tooling and testing.
## Supported things
- [`Iterator` constructor](https://tc39.es/proposal-iterator-helpers/#sec-iterator-constructor)
- [`Iterator.prototype`](https://tc39.es/proposal-iterator-helpers/#sec-iterator.prototype)
- [`Iterator.concat`](https://tc39.es/proposal-iterator-sequencing/)
- [`Iterator.from`](https://tc39.es/proposal-iterator-helpers/#sec-iterator.from)
- [`Iterator.zip`](https://tc39.es/proposal-joint-iteration/#sec-iterator.zip)
- [`Iterator.zipKeyed`](https://tc39.es/proposal-joint-iteration/#sec-iterator.zipkeyed)
- [`Iterator.prototype.constructor`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.constructor)
- [`Iterator.prototype.drop`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.drop)
- [`Iterator.prototype.every`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.every)
- [`Iterator.prototype.filter`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.filter)
- [`Iterator.prototype.find`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.find)
- [`Iterator.prototype.flatMap`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.flatmap)
- [`Iterator.prototype.forEach`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.foreach)
- [`Iterator.prototype.map`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.map)
- [`Iterator.prototype.reduce`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.reduce)
- [`Iterator.prototype.some`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.some)
- [`Iterator.prototype.take`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.take)
- [`Iterator.prototype.toArray`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.toarray)
## Environments where this is needed
- node v22, Chrome >= v122: has a [bug](https://issues.chromium.org/issues/336839115)
- node < v22, Chrome < v122, Safari <= v17.1, Firefox <= v125: not implemented
- all environments lack Iterator.concat, Iterator.zip, Iterator.zipKeyed
## Getting started
```sh
npm install --save es-iterator-helpers
```
## Usage/Examples
Using explicit imports:
```js
const map = require('es-iterator-helpers/Iterator.prototype.map');
const toArray = require('es-iterator-helpers/Iterator.prototype.toArray');
const assert = require('assert');
const iterator = [1, 2, 3].values();
const mapped = map(iterator, (x) => x + 10);
assert.deepEqual(
mapped.next(),
{
done: false,
value: 11,
}
);
assert.deepEqual(
toArray(mapped),
[12, 13]
);
```
Shim using `require`:
```js
require('es-iterator-helpers/auto'); // shim all of the methods
require('es-iterator-helpers/Iterator.prototype.map/auto'); // shim the “map” method
```
Shim using `import` syntax:
[](#preventEval)
```js
import 'es-iterator-helpers/auto'; // shim all of the methods
import 'es-iterator-helpers/Iterator.prototype.map/auto'; // shim the “map” method
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/es-iterator-helpers
[npm-version-svg]: https://versionbadg.es/es-shims/iterator-helpers.svg
[deps-svg]: https://david-dm.org/es-shims/iterator-helpers.svg
[deps-url]: https://david-dm.org/es-shims/iterator-helpers
[dev-deps-svg]: https://david-dm.org/es-shims/iterator-helpers/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/iterator-helpers#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/es-iterator-helpers.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/es-iterator-helpers.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/es-iterator-helpers.svg
[downloads-url]: https://npm-stat.com/charts.html?package=es-iterator-helpers
[codecov-image]: https://codecov.io/gh/es-shims/iterator-helpers/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/iterator-helpers/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/iterator-helpers
[actions-url]: https://github.com/es-shims/iterator-helpers/actions
@@ -0,0 +1,34 @@
var baseHasIn = require('./_baseHasIn'),
hasPath = require('./_hasPath');
/**
* Checks if `path` is a direct or inherited property of `object`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` exists, else `false`.
* @example
*
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
*
* _.hasIn(object, 'a');
* // => true
*
* _.hasIn(object, 'a.b');
* // => true
*
* _.hasIn(object, ['a', 'b']);
* // => true
*
* _.hasIn(object, 'b');
* // => false
*/
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
module.exports = hasIn;
@@ -0,0 +1 @@
{"version":3,"file":"incrementPendingClassMetadataCount.d.ts","sourceRoot":"","sources":["../../../../src/metadata/actions/incrementPendingClassMetadataCount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,wBAAgB,kCAAkC,CAChD,IAAI,EAAE,MAAM,GACX,CAAC,QAAQ,EAAE,yBAAyB,GAAG,SAAS,KAAK,IAAI,CAW3D"}
@@ -0,0 +1,13 @@
/*
* 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.
*/
export type Direction = 'ltr' | 'rtl';
@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["// Compute what scrolling needs to be done on required scrolling boxes for target to be in view\n\n// The type names here are named after the spec to make it easier to find more information around what they mean:\n// To reduce churn and reduce things that need be maintained things from the official TS DOM library is used here\n// https://drafts.csswg.org/cssom-view/\n\n// For a definition on what is \"block flow direction\" exactly, check this: https://drafts.csswg.org/css-writing-modes-4/#block-flow-direction\n\n/**\n * This new option is tracked in this PR, which is the most likely candidate at the time: https://github.com/w3c/csswg-drafts/pull/1805\n * @public\n */\nexport type ScrollMode = 'always' | 'if-needed'\n\n/** @public */\nexport interface Options {\n /**\n * Control the logical scroll position on the y-axis. The spec states that the `block` direction is related to the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode), but this is not implemented yet in this library.\n * This means that `block: 'start'` aligns to the top edge and `block: 'end'` to the bottom.\n * @defaultValue 'center'\n */\n block?: ScrollLogicalPosition\n /**\n * Like `block` this is affected by the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode). In left-to-right pages `inline: 'start'` will align to the left edge. In right-to-left it should be flipped. This will be supported in a future release.\n * @defaultValue 'nearest'\n */\n inline?: ScrollLogicalPosition\n /**\n * This is a proposed addition to the spec that you can track here: https://github.com/w3c/csswg-drafts/pull/5677\n *\n * This library will be updated to reflect any changes to the spec and will provide a migration path.\n * To be backwards compatible with `Element.scrollIntoViewIfNeeded` if something is not 100% visible it will count as \"needs scrolling\". If you need a different visibility ratio your best option would be to implement an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).\n * @defaultValue 'always'\n */\n scrollMode?: ScrollMode\n /**\n * By default there is no boundary. All the parent elements of your target is checked until it reaches the viewport ([`document.scrollingElement`](https://developer.mozilla.org/en-US/docs/Web/API/document/scrollingElement)) when calculating layout and what to scroll.\n * By passing a boundary you can short-circuit this loop depending on your needs:\n * \n * - Prevent the browser window from scrolling.\n * - Scroll elements into view in a list, without scrolling container elements.\n * \n * You can also pass a function to do more dynamic checks to override the scroll scoping:\n * \n * ```js\n * let actions = compute(target, {\n * boundary: (parent) => {\n * // By default `overflow: hidden` elements are allowed, only `overflow: visible | clip` is skipped as\n * // this is required by the CSSOM spec\n * if (getComputedStyle(parent)['overflow'] === 'hidden') {\n * return false\n * }\n\n * return true\n * },\n * })\n * ```\n * @defaultValue null\n */\n boundary?: Element | ((parent: Element) => boolean) | null\n /**\n * New option that skips auto-scrolling all nodes with overflow: hidden set\n * See FF implementation: https://hg.mozilla.org/integration/fx-team/rev/c48c3ec05012#l7.18\n * @defaultValue false\n * @public\n */\n skipOverflowHiddenElements?: boolean\n}\n\n/** @public */\nexport interface ScrollAction {\n el: Element\n top: number\n left: number\n}\n\n// @TODO better shadowdom test, 11 = document fragment\nconst isElement = (el: any): el is Element =>\n typeof el === 'object' && el != null && el.nodeType === 1\n\nconst canOverflow = (\n overflow: string | null,\n skipOverflowHiddenElements?: boolean\n) => {\n if (skipOverflowHiddenElements && overflow === 'hidden') {\n return false\n }\n\n return overflow !== 'visible' && overflow !== 'clip'\n}\n\nconst getFrameElement = (el: Element) => {\n if (!el.ownerDocument || !el.ownerDocument.defaultView) {\n return null\n }\n\n try {\n return el.ownerDocument.defaultView.frameElement\n } catch (e) {\n return null\n }\n}\n\nconst isHiddenByFrame = (el: Element): boolean => {\n const frame = getFrameElement(el)\n if (!frame) {\n return false\n }\n\n return (\n frame.clientHeight < el.scrollHeight || frame.clientWidth < el.scrollWidth\n )\n}\n\nconst isScrollable = (el: Element, skipOverflowHiddenElements?: boolean) => {\n if (el.clientHeight < el.scrollHeight || el.clientWidth < el.scrollWidth) {\n const style = getComputedStyle(el, null)\n return (\n canOverflow(style.overflowY, skipOverflowHiddenElements) ||\n canOverflow(style.overflowX, skipOverflowHiddenElements) ||\n isHiddenByFrame(el)\n )\n }\Line truncated
@@ -0,0 +1,51 @@
import connect from './components/connect'
export type {
Connect,
ConnectProps,
ConnectedProps,
} from './components/connect'
import shallowEqual from './utils/shallowEqual'
import Provider from './components/Provider'
import { defaultNoopBatch } from './utils/batch'
export { ReactReduxContext } from './components/Context'
export type { ReactReduxContextValue } from './components/Context'
export type { ProviderProps } from './components/Provider'
export type {
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsFunction,
MapDispatchToPropsNonObject,
MapDispatchToPropsParam,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
MergeProps,
Selector,
SelectorFactory,
} from './connect/selectorFactory'
export { createDispatchHook, useDispatch } from './hooks/useDispatch'
export type { UseDispatch } from './hooks/useDispatch'
export { createSelectorHook, useSelector } from './hooks/useSelector'
export type { UseSelector } from './hooks/useSelector'
export { createStoreHook, useStore } from './hooks/useStore'
export type { UseStore } from './hooks/useStore'
export type { Subscription } from './utils/Subscription'
export * from './types'
/**
* @deprecated As of React 18, batching is enabled by default for ReactDOM and React Native.
* This is now a no-op that immediately runs the callback.
*/
const batch = defaultNoopBatch
export { Provider, batch, connect, shallowEqual }
@@ -0,0 +1 @@
{"name":"@react-aria/utils","version":"3.31.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532105972,"integrity":"sha512-cil7stSp3ik41Hdv2Dj+GMcbvUfs1q+MZ2Yte0804py9i6oJJN/diCiIr/brcQOZ5ZqwAI6dgaHA7l8FZheQBw==","mode":420,"size":11335},"dist/animation.main.js":{"checkedAt":1794532106306,"integrity":"sha512-7feAscBFcCGo8YpNo8WcREg9rM/YlHl2st63brcfJoHG910/iXMxz5q/nau12/O6kakGxlVhO4poRz1WGu91PA==","mode":420,"size":4187},"dist/animation.module.js":{"checkedAt":1794532106306,"integrity":"sha512-zUpetpAjR3+jidD7Aq2Vi83OMVwVW4KFU2nZeyMQ6W7elVCdx3x/24KI8mKVk0LbjXJFlicg3YlUYegSMdrW6w==","mode":420,"size":4058},"dist/chain.main.js":{"checkedAt":1794532106306,"integrity":"sha512-OGYCmGHakAibaS0hmBtDfMCKiVpDH6AfRreRNk15RQ02ghFQLeEXWmb166DHKOA7CkWL3q9NaArAsVnbV6RL8A==","mode":420,"size":1161},"dist/chain.module.js":{"checkedAt":1794532106306,"integrity":"sha512-vfurJ4N9/R+Zu6HvNvowjluOjMdKIlAvwupSzeeVjjw7kCznmOoEuTyyzQDlsjGj3RJttulf6x14UMg8a3K3BA==","mode":420,"size":1005},"dist/constants.main.js":{"checkedAt":1794532106306,"integrity":"sha512-hrSKwOv/SqgLrYz4O8bLal+3lYXCPEZeRPToIjKlaO9sJj54qBS/xNgKYKu4RQh++v3Y4+VHP94BqEjVcgGfCQ==","mode":420,"size":1214},"dist/constants.module.js":{"checkedAt":1794532106306,"integrity":"sha512-yznDncqCqgpxjr8xskQ22JfaqUJNCawBg2JGFJ6XIu910XS1mxRfc3Df0SI66BnQvJV2I0MxS5OmlD1WdPdAeg==","mode":420,"size":1020},"dist/DOMFunctions.main.js":{"checkedAt":1794532106307,"integrity":"sha512-qR5GkR8pFVVfC3VFVR6KcM/Bkmy9GahDOJllK7UHbYc+Do/Yfga3klFHFHLpr6HMYNdyB+t49NceqnJ8CkeLgw==","mode":420,"size":2215},"dist/DOMFunctions.module.js":{"checkedAt":1794532106307,"integrity":"sha512-RLToQ+JJGvch0lZhpGLUPXn2YDLIXgHp+YatOt3LFoMGsQaNTDXJ4AA/Bemsa/6U4gOwJE7corEQzLa4/IBcsg==","mode":420,"size":1969},"dist/domHelpers.main.js":{"checkedAt":1794532106307,"integrity":"sha512-6tqW0KpiEnZtR/rmIN7TBwELQ+TCEKNjR1dBpJf7H0u9wQsYq1yAcgRYxrQEB6xTAoLjXV5pdqdxUXzD7NsTaA==","mode":420,"size":1400},"dist/domHelpers.module.js":{"checkedAt":1794532106307,"integrity":"sha512-R1q/DMGsEC2qJxTbuAKvv+T7UlKeeya9a4hdNhDmXVxWPfbnSsrhlXDp1ijk4ttVJXOH64PeXOwBLmIou+U96Q==","mode":420,"size":1168},"dist/filterDOMProps.main.js":{"checkedAt":1794532106307,"integrity":"sha512-mrBJNRO/kTjpHRndMnTIMyJkF4TjIeAm8d+caXwlROSI5oqw0ZmwqlbLzjopTBTtU0Gmq7UUpzo835neHBo8jw==","mode":420,"size":3112},"dist/filterDOMProps.module.js":{"checkedAt":1794532106307,"integrity":"sha512-ukGMlPBvWyDT+jxXd1mCrggans3pxs7VNWW9nd6m3sH01hJ/Yk9finFsdMARcsbhh4AvcS/GSQfbQ+wRUSEbaA==","mode":420,"size":2956},"dist/focusWithoutScrolling.main.js":{"checkedAt":1794532106307,"integrity":"sha512-ZhFu6IGLm8DZKMLB3xHrh9MdHEaHLga5ij3zorUpOidS5ohOuXayyOj6EgWzAmaOGQxzmzVOnRnQ4YO+Hs/qcQ==","mode":420,"size":3060},"dist/focusWithoutScrolling.module.js":{"checkedAt":1794532106308,"integrity":"sha512-ZoTo3/DRrtIUvEnQHqqlJFulcYrRWx4gYdQn4Zehf1+ctP8z2cOgAKJ9r65p33D0ne3/ijfOyjVaPzi5xnypfA==","mode":420,"size":2904},"dist/getOffset.main.js":{"checkedAt":1794532106308,"integrity":"sha512-mves/ckeOxLeueSOLxMv2rJyoBPJ/bdqLgHiPk4kO/9RApZgABh+/z91DW6wMvWlmztjvWNRkRYlMjg0S9culQ==","mode":420,"size":1182},"dist/getOffset.module.js":{"checkedAt":1794532106308,"integrity":"sha512-N8v3VxEZaApNxoAAoeVH2Hq8AlXiboUvS7La0Bg8f1+lWanYjpQ21DgbVAWg8F3CiEBvNfqlne+p9rRbI596bw==","mode":420,"size":1026},"dist/getScrollParent.main.js":{"checkedAt":1794532106308,"integrity":"sha512-8Y7KQrfwH3aUtXFroDVcmqPfFBkCpbLWOmnjpYLQm94qKLa2WK7o+XMOOwrHco95RKan9lljGzMD1S373+P4VQ==","mode":420,"size":1451},"dist/getScrollParent.module.js":{"checkedAt":1794532106308,"integrity":"sha512-poFOgvrldy19ltrOhWfO6Xc/lPscxdvracUpC+Kg5Fn54bwA5RtozBoeRRzNQA9BjxknEJW2Bz4p32z63AdfSQ==","mode":420,"size":1334},"dist/getScrollParents.main.js":{"checkedAt":1794532106308,"integrity":"sha512-+v2dhsAG2fEZcTG5nfvkWv+fncF75bZfvhcJhfxbeMUbKra1IrWOALcLOL0FaIyeUL2+qFoPd9G10bNGoHf0LA==","mode":420,"size":1308},"dist/getScrollParents.module.js":{"checkedAt":1794532106308,"integrity":"sha512-OFjhuPTEqago5mI4LTbzm3kEw7ePK/Gfs/w5pDjSdOklb63MmXsC40G0dhW2rpUiw95e3fWs0aww5LWgauMXFQ==","mode":420,"size":1188},"dist/inertValue.main.js":{"checkedAt":1794532106308,"integrity":"sha512-3g+yguFpRTHGP9bodHPqCipzvxKkTKf70UW3GGklH6Z3PdG/5shu9V62XMMuodzgmKUcuma0CeNwM4TR56VkCA==","mode":420,"size":582},"dist/inertValue.module.js":{"checkedAt":1794532106309,"integrity":"sha512-qRVBfR6xZmYRJscSN74rbRxTW0Ugf+f571Ir5ox0WX2w4A3webPS71xkeEr43rLQ5dMb0HVOTfiORLUvGplGRw==","mode":420,"size":432},"dist/isElementVisible.main.js":{"checkedAt":1794532106309,"integrity":"sha512-vZDnfZL7RByS150LMhuweC5JfMjQBwuYcZtl8aj4ME8ONdYNnr95r60fZe2iZeBYjO9wpUFg9UJiJkoJ9x3eww==","mode":420,"size":2764},"dist/isElementVisible.module.js":{"checkedAt":1794532106309,"integrity":"sha512-5srCmy9Q+JMmPvR0DfRA22RVISGS+BzmH3hS/bwlTgpAXVsLUdCVs5TT1aOhoa696odYTYRZDt1GVh5Tyb0DpQ==","mode":420,"size":2644},"dist/isFocusable.main.js":{"checkedAt":1794532106309,"integrity":"sha512-h2z2BNLkYn2EqOHNrkfSn0CaaBQnFpFxw/CJbcIEuTA1SDv7t7e1akt/hj9VSKdEKyOz8htRMbCXynPIK0uHyA==","mode":420,"size":2617}Line truncated
@@ -0,0 +1,2 @@
var convert = require('./convert');
module.exports = convert(require('../function'));
@@ -0,0 +1,35 @@
{
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
"name": "minimatch",
"description": "a glob matcher in javascript",
"publishConfig": {
"tag": "legacy-v5"
},
"version": "5.1.6",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/minimatch.git"
},
"main": "minimatch.js",
"scripts": {
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
},
"engines": {
"node": ">=10"
},
"dependencies": {
"brace-expansion": "^2.0.1"
},
"devDependencies": {
"tap": "^16.3.2"
},
"license": "ISC",
"files": [
"minimatch.js",
"lib"
]
}
@@ -0,0 +1,932 @@
<!--
Notes for maintaining this document:
* update the version of the link for `commonmark-html` once in a while
-->
# react-markdown
[![Build][badge-build-image]][badge-build-url]
[![Coverage][badge-coverage-image]][badge-coverage-url]
[![Downloads][badge-downloads-image]][badge-downloads-url]
[![Size][badge-size-image]][badge-size-url]
React component to render markdown.
## Feature highlights
* [x] **[safe][section-security] by default**
(no `dangerouslySetInnerHTML` or XSS attacks)
* [x] **[components][section-components]**
(pass your own component to use instead of `<h2>` for `## hi`)
* [x] **[plugins][section-plugins]**
(many plugins you can pick and choose from)
* [x] **[compliant][section-syntax]**
(100% to CommonMark, 100% to GFM with a plugin)
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`Markdown`](#markdown)
* [`MarkdownAsync`](#markdownasync)
* [`MarkdownHooks`](#markdownhooks)
* [`defaultUrlTransform(url)`](#defaulturltransformurl)
* [`AllowElement`](#allowelement)
* [`Components`](#components)
* [`ExtraProps`](#extraprops)
* [`Options`](#options)
* [`UrlTransform`](#urltransform)
* [Examples](#examples)
* [Use a plugin](#use-a-plugin)
* [Use a plugin with options](#use-a-plugin-with-options)
* [Use custom components (syntax highlight)](#use-custom-components-syntax-highlight)
* [Use remark and rehype plugins (math)](#use-remark-and-rehype-plugins-math)
* [Plugins](#plugins)
* [Syntax](#syntax)
* [Types](#types)
* [Compatibility](#compatibility)
* [Architecture](#architecture)
* [Appendix A: HTML in markdown](#appendix-a-html-in-markdown)
* [Appendix B: Components](#appendix-b-components)
* [Appendix C: line endings in markdown (and JSX)](#appendix-c-line-endings-in-markdown-and-jsx)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package is a [React][] component that can be given a string of markdown
that it’ll safely render to React elements.
You can pass plugins to change how markdown is transformed and pass components
that will be used instead of normal HTML elements.
* to learn markdown, see this [cheatsheet and tutorial][commonmark-help]
* to try out `react-markdown`, see [our demo][github-io-react-markdown]
## When should I use this?
There are other ways to use markdown in React out there so why use this one?
The three main reasons are that they often rely on `dangerouslySetInnerHTML`,
have bugs with how they handle markdown, or don’t let you swap elements for
components.
`react-markdown` builds a virtual DOM, so React only replaces what changed,
from a syntax tree.
That’s supported because we use [unified][github-unified],
specifically [remark][github-remark] for markdown and [rehype][github-rehype]
for HTML,
which are popular tools to transform content with plugins.
This package focusses on making it easy for beginners to safely use markdown in
React.
When you’re familiar with unified, you can use a modern hooks based alternative
[`react-remark`][github-react-remark] or [`rehype-react`][github-rehype-react]
manually.
If you instead want to use JavaScript and JSX *inside* markdown files, use
[MDX][github-mdx].
## Install
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][npm-install]:
```sh
npm install react-markdown
```
In Deno with [`esm.sh`][esmsh]:
```js
import Markdown from 'https://esm.sh/react-markdown@9'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import Markdown from 'https://esm.sh/react-markdown@9?bundle'
</script>
```
## Use
A basic hello world:
```js
import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
const markdown = '# Hi, *Pluto*!'
createRoot(document.body).render(<Markdown>{markdown}</Markdown>)
```
<details>
<summary>Show equivalent JSX</summary>
```js
<h1>
Hi, <em>Pluto</em>!
</h1>
```
</details>
Here is an example that shows how to use a plugin
([`remark-gfm`][github-remark-gfm],
which adds support for footnotes, strikethrough, tables, tasklists and
URLs directly):
```js
import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
const markdown = `Just a link: www.nasa.gov.`
createRoot(document.body).render(
<Markdown remarkPlugins={[remarkGfm]}>{markdown}</Markdown>
)
```
<details>
<summary>Show equivalent JSX</summary>
```js
<p>
Just a link: <a href="http://www.nasa.gov">www.nasa.gov</a>.
</p>
```
</details>
## API
This package exports the identifiers
[`MarkdownAsync`][api-markdown-async],
[`MarkdownHooks`][api-markdown-hooks],
and
[`defaultUrlTransform`][api-default-url-transform].
The default export is [`Markdown`][api-markdown].
### `Markdown`
Component to render markdown.
This is a synchronous component.
When using async plugins,
see [`MarkdownAsync`][api-markdown-async] or
[`MarkdownHooks`][api-markdown-hooks].
###### Parameters
* `options` ([`Options`][api-options])
— props
###### Returns
React element (`JSX.Element`).
### `MarkdownAsync`
Component to render markdown with support for async plugins
through async/await.
Components returning promises are supported on the server.
For async support on the client,
see [`MarkdownHooks`][api-markdown-hooks].
###### Parameters
* `options` ([`Options`][api-options])
— props
###### Returns
Promise to a React element (`Promise<JSX.Element>`).
### `MarkdownHooks`
Component to render markdown with support for async plugins through hooks.
This uses `useEffect` and `useState` hooks.
Hooks run on the client and do not immediately render something.
For async support on the server,
see [`MarkdownAsync`][api-markdown-async].
###### Parameters
* `options` ([`Options`][api-options])
— props
###### Returns
React element (`JSX.Element`).
### `defaultUrlTransform(url)`
Make a URL safe.
###### Parameters
* `url` (`string`)
— URL
###### Returns
Safe URL (`string`).
### `AllowElement`
Filter elements (TypeScript type).
###### Parameters
* `node` ([`Element` from `hast`][github-hast-element])
— element to check
* `index` (`number | undefined`)
— index of `element` in `parent`
* `parent` ([`Node` from `hast`][github-hast-nodes])
— parent of `element`
###### Returns
Whether to allow `element` (`boolean`, optional).
### `Components`
Map tag names to components (TypeScript type).
###### Type
```ts
import type {Element} from 'hast'
type Components = Partial<{
[TagName in keyof JSX.IntrinsicElements]:
// Class component:
| (new (props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.ElementClass)
// Function component:
| ((props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.Element | string | null | undefined)
// Tag name:
| keyof JSX.IntrinsicElements
}>
```
### `ExtraProps`
Extra fields we pass to components (TypeScript type).
###### Fields
* `node` ([`Element` from `hast`][github-hast-element], optional)
— original node
### `Options`
Configuration (TypeScript type).
###### Fields
* `allowElement` ([`AllowElement`][api-allow-element], optional)
— filter elements;
`allowedElements` / `disallowedElements` is used first
* `allowedElements` (`Array<string>`, default: all tag names)
— tag names to allow;
cannot combine w/ `disallowedElements`
* `children` (`string`, optional)
— markdown
* `className` (`string`, optional)
— wrap in a `div` with this class name
* `components` ([`Components`][api-components], optional)
— map tag names to components
* `disallowedElements` (`Array<string>`, default: `[]`)
— tag names to disallow;
cannot combine w/ `allowedElements`
* `rehypePlugins` (`Array<Plugin>`, optional)
— list of [rehype plugins][github-rehype-plugins] to use
* `remarkPlugins` (`Array<Plugin>`, optional)
— list of [remark plugins][github-remark-plugins] to use
* `remarkRehypeOptions`
([`Options` from `remark-rehype`][github-remark-rehype-options],
optional)
— options to pass through to `remark-rehype`
* `skipHtml` (`boolean`, default: `false`)
— ignore HTML in markdown completely
* `unwrapDisallowed` (`boolean`, default: `false`)
— extract (unwrap) what’s in disallowed elements;
normally when say `strong` is not allowed, it and it’s children are dropped,
with `unwrapDisallowed` the element itself is replaced by its children
* `urlTransform` ([`UrlTransform`][api-url-transform], default:
[`defaultUrlTransform`][api-default-url-transform])
— change URLs
### `UrlTransform`
Transform URLs (TypeScript type).
###### Parameters
* `url` (`string`)
— URL
* `key` (`string`, example: `'href'`)
— property name
* `node` ([`Element` from `hast`][github-hast-element])
— element to check
###### Returns
Transformed URL (`string`, optional).
## Examples
### Use a plugin
This example shows how to use a remark plugin.
In this case, [`remark-gfm`][github-remark-gfm],
which adds support for strikethrough, tables, tasklists and URLs directly:
```js
import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
const markdown = `A paragraph with *emphasis* and **strong importance**.
> A block quote with ~strikethrough~ and a URL: https://reactjs.org.
* Lists
* [ ] todo
* [x] done
A table:
| a | b |
| - | - |
`
createRoot(document.body).render(
<Markdown remarkPlugins={[remarkGfm]}>{markdown}</Markdown>
)
```
<details>
<summary>Show equivalent JSX</summary>
```js
<>
<p>
A paragraph with <em>emphasis</em> and <strong>strong importance</strong>.
</p>
<blockquote>
<p>
A block quote with <del>strikethrough</del> and a URL:{' '}
<a href="https://reactjs.org">https://reactjs.org</a>.
</p>
</blockquote>
<ul className="contains-task-list">
<li>Lists</li>
<li className="task-list-item">
<input type="checkbox" disabled /> todo
</li>
<li className="task-list-item">
<input type="checkbox" disabled checked /> done
</li>
</ul>
<p>A table:</p>
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
</table>
</>
```
</details>
### Use a plugin with options
This example shows how to use a plugin and give it options.
To do that, use an array with the plugin at the first place, and the options
second.
[`remark-gfm`][github-remark-gfm] has an option to allow only double tildes for
strikethrough:
```js
import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
const markdown = 'This ~is not~ strikethrough, but ~~this is~~!'
createRoot(document.body).render(
<Markdown remarkPlugins={[[remarkGfm, {singleTilde: false}]]}>
{markdown}
</Markdown>
)
```
<details>
<summary>Show equivalent JSX</summary>
```js
<p>
This ~is not~ strikethrough, but <del>this is</del>!
</p>
```
</details>
### Use custom components (syntax highlight)
This example shows how you can overwrite the normal handling of an element by
passing a component.
In this case, we apply syntax highlighting with the seriously super amazing
[`react-syntax-highlighter`][github-react-syntax-highlighter] by
[**@conorhastings**][github-conorhastings]:
<!-- To do: currently broken on actual ESM; let’s find an alternative? -->
```js
import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
import {Prism as SyntaxHighlighter} from 'react-syntax-highlighter'
import {dark} from 'react-syntax-highlighter/dist/esm/styles/prism'
// Did you know you can use tildes instead of backticks for code in markdown? ✨
const markdown = `Here is some JavaScript code:
~~~js
console.log('It works!')
~~~
`
createRoot(document.body).render(
<Markdown
children={markdown}
components={{
code(props) {
const {children, className, node, ...rest} = props
const match = /language-(\w+)/.exec(className || '')
return match ? (
<SyntaxHighlighter
{...rest}
PreTag="div"
children={String(children).replace(/\n$/, '')}
language={match[1]}
style={dark}
/>
) : (
<code {...rest} className={className}>
{children}
</code>
)
}
}}
/>
)
```
<details>
<summary>Show equivalent JSX</summary>
```js
<>
<p>Here is some JavaScript code:</p>
<pre>
<SyntaxHighlighter language="js" style={dark} PreTag="div" children="console.log('It works!')" />
</pre>
</>
```
</details>
### Use remark and rehype plugins (math)
This example shows how a syntax extension
(through [`remark-math`][github-remark-math])
is used to support math in markdown, and a transform plugin
([`rehype-katex`][github-rehype-katex]) to render that math.
```js
import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
import rehypeKatex from 'rehype-katex'
import remarkMath from 'remark-math'
import 'katex/dist/katex.min.css' // `rehype-katex` does not import the CSS for you
const markdown = `The lift coefficient ($C_L$) is a dimensionless coefficient.`
createRoot(document.body).render(
<Markdown remarkPlugins={[remarkMath]} rehypePlugins={[rehypeKatex]}>
{markdown}
</Markdown>
)
```
<details>
<summary>Show equivalent JSX</summary>
```js
<p>
The lift coefficient (
<span className="katex">
<span className="katex-mathml">
<math xmlns="http://www.w3.org/1998/Math/MathML">{/* … */}</math>
</span>
<span className="katex-html" aria-hidden="true">
{/* … */}
</span>
</span>
) is a dimensionless coefficient.
</p>
```
</details>
## Plugins
We use [unified][github-unified],
specifically [remark][github-remark] for markdown and
[rehype][github-rehype] for HTML,
which are tools to transform content with plugins.
Here are three good ways to find plugins:
* [`awesome-remark`][github-awesome-remark] and
[`awesome-rehype`][github-awesome-rehype]
— selection of the most awesome projects
* [List of remark plugins][github-remark-plugins] and
[list of rehype plugins][github-rehype-plugins]
— list of all plugins
* [`remark-plugin`][github-topic-remark-plugin] and
[`rehype-plugin`][github-topic-rehype-plugin] topics
— any tagged repo on GitHub
## Syntax
`react-markdown` follows CommonMark, which standardizes the differences between
markdown implementations, by default.
Some syntax extensions are supported through plugins.
We use [`micromark`][github-micromark] under the hood for our parsing.
See its documentation for more information on markdown, CommonMark, and
extensions.
## Types
This package is fully typed with [TypeScript][].
It exports the additional types
[`AllowElement`][api-allow-element],
[`ExtraProps`][api-extra-props],
[`Components`][api-components],
[`Options`][api-options], and
[`UrlTransform`][api-url-transform].
## Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line, `react-markdown@^9`,
compatible with Node.js 16.
They work in all modern browsers (essentially: everything not IE 11).
You can use a bundler (such as esbuild, webpack, or Rollup) to use this package
in your project, and use its options (or plugins) to add support for legacy
browsers.
## Architecture
<pre><code> react-markdown
+----------------------------------------------------------------------------------------------------------------+
| |
| +----------+ +----------------+ +---------------+ +----------------+ +------------+ |
| | | | | | | | | | | |
<a href="https://commonmark.org">markdown</a>-+->+ <a href="https://github.com/remarkjs/remark">remark</a> +-<a href="https://github.com/syntax-tree/mdast">mdast</a>->+ <a href="https://github.com/remarkjs/remark/blob/main/doc/plugins.md">remark plugins</a> +-<a href="https://github.com/syntax-tree/mdast">mdast</a>->+ <a href="https://github.com/remarkjs/remark-rehype">remark-rehype</a> +-<a href="https://github.com/syntax-tree/hast">hast</a>->+ <a href="https://github.com/rehypejs/rehype/blob/main/doc/plugins.md">rehype plugins</a> +-<a href="https://github.com/syntax-tree/hast">hast</a>->+ <a href="#appendix-b-components">components</a> +-+->react elements
| | | | | | | | | | | |
| +----------+ +----------------+ +---------------+ +----------------+ +------------+ |
| |
+----------------------------------------------------------------------------------------------------------------+
</code></pre>
To understand what this project does, it’s important to first understand what
unified does: please read through the [`unifiedjs/unified`][github-unified]
readme
(the part until you hit the API section is required reading).
`react-markdown` is a unified pipeline — wrapped so that most folks don’t need
to directly interact with unified.
The processor goes through these steps:
* parse markdown to mdast (markdown syntax tree)
* transform through remark (markdown ecosystem)
* transform mdast to hast (HTML syntax tree)
* transform through rehype (HTML ecosystem)
* render hast to React with components
## Appendix A: HTML in markdown
`react-markdown` typically escapes HTML (or ignores it, with `skipHtml`)
because it is dangerous and defeats the purpose of this library.
However, if you are in a trusted environment (you trust the markdown), and
can spare the bundle size (±60kb minzipped), then you can use
[`rehype-raw`][github-rehype-raw]:
```js
import React from 'react'
import {createRoot} from 'react-dom/client'
import Markdown from 'react-markdown'
import rehypeRaw from 'rehype-raw'
const markdown = `<div class="note">
Some *emphasis* and <strong>strong</strong>!
</div>`
createRoot(document.body).render(
<Markdown rehypePlugins={[rehypeRaw]}>{markdown}</Markdown>
)
```
<details>
<summary>Show equivalent JSX</summary>
```js
<div className="note">
<p>
Some <em>emphasis</em> and <strong>strong</strong>!
</p>
</div>
```
</details>
**Note**: HTML in markdown is still bound by how [HTML works in
CommonMark][commonmark-html].
Make sure to use blank lines around block-level HTML that again contains
markdown!
## Appendix B: Components
You can also change the things that come from markdown:
```js
<Markdown
components={{
// Map `h1` (`# heading`) to use `h2`s.
h1: 'h2',
// Rewrite `em`s (`*like so*`) to `i` with a red foreground color.
em(props) {
const {node, ...rest} = props
return <i style={{color: 'red'}} {...rest} />
}
}}
/>
```
The keys in components are HTML equivalents for the things you write with
markdown (such as `h1` for `# heading`).
Normally, in markdown, those are: `a`, `blockquote`, `br`, `code`, `em`, `h1`,
`h2`, `h3`, `h4`, `h5`, `h6`, `hr`, `img`, `li`, `ol`, `p`, `pre`, `strong`, and
`ul`.
With [`remark-gfm`][github-remark-gfm],
you can also use `del`, `input`, `table`, `tbody`, `td`, `th`, `thead`, and `tr`.
Other remark or rehype plugins that add support for new constructs will also
work with `react-markdown`.
The props that are passed are what you probably would expect: an `a` (link) will
get `href` (and `title`) props, and `img` (image) an `src`, `alt` and `title`,
etc.
Every component will receive a `node`.
This is the original [`Element` from `hast`][github-hast-element] element being
turned into a React element.
## Appendix C: line endings in markdown (and JSX)
You might have trouble with how line endings work in markdown and JSX.
We recommend the following, which solves all line ending problems:
```js
// If you write actual markdown in your code, put your markdown in a variable;
// **do not indent markdown**:
const markdown = `
# This is perfect!
`
// Pass the value as an expression as an only child:
const result = <Markdown>{markdown}</Markdown>
```
👆 That works.
Read on for what doesn’t and why that is.
You might try to write markdown directly in your JSX and find that it **does
not** work:
```js
<Markdown>
# Hi
This is **not** a paragraph.
</Markdown>
```
The is because in JSX the whitespace (including line endings) is collapsed to
a single space.
So the above example is equivalent to:
```js
<Markdown> # Hi This is **not** a paragraph. </Markdown>
```
Instead, to pass markdown to `Markdown`, you can use an expression:
with a template literal:
```js
<Markdown>{`
# Hi
This is a paragraph.
`}</Markdown>
```
Template literals have another potential problem, because they keep whitespace
(including indentation) inside them.
That means that the following **does not** turn into a heading:
```js
<Markdown>{`
# This is **not** a heading, it’s an indented code block
`}</Markdown>
```
## Security
Use of `react-markdown` is secure by default.
Overwriting `urlTransform` to something insecure will open you up to XSS
vectors.
Furthermore, the `remarkPlugins`, `rehypePlugins`, and `components` you use may
be insecure.
To make sure the content is completely safe, even after what plugins do,
use [`rehype-sanitize`][github-rehype-sanitize].
It lets you define your own schema of what is and isn’t allowed.
## Related
* [`MDX`][github-mdx]
— JSX *in* markdown
* [`remark-gfm`][github-remark-gfm]
— add support for GitHub flavored markdown support
* [`react-remark`][github-react-remark]
— hook based alternative
* [`rehype-react`][github-rehype-react]
— turn HTML into React elements
## Contribute
See [`contributing.md`][health-contributing] in [`remarkjs/.github`][health]
for ways to get started.
See [`support.md`][health-support] for ways to get help.
This project has a [code of conduct][health-coc].
By interacting with this repository, organization, or community you agree to
abide by its terms.
## License
[MIT][file-license] © [Espen Hovlandsdal][author]
[api-allow-element]: #allowelement
[api-components]: #components
[api-default-url-transform]: #defaulturltransformurl
[api-extra-props]: #extraprops
[api-markdown]: #markdown
[api-markdown-async]: #markdownasync
[api-markdown-hooks]: #markdownhooks
[api-options]: #options
[api-url-transform]: #urltransform
[author]: https://espen.codes/
[badge-build-image]: https://github.com/remarkjs/react-markdown/workflows/main/badge.svg
[badge-build-url]: https://github.com/remarkjs/react-markdown/actions
[badge-coverage-image]: https://img.shields.io/codecov/c/github/remarkjs/react-markdown.svg
[badge-coverage-url]: https://codecov.io/github/remarkjs/react-markdown
[badge-downloads-image]: https://img.shields.io/npm/dm/react-markdown.svg
[badge-downloads-url]: https://www.npmjs.com/package/react-markdown
[badge-size-image]: https://img.shields.io/bundlejs/size/react-markdown
[badge-size-url]: https://bundlejs.com/?q=react-markdown
[commonmark-help]: https://commonmark.org/help/
[commonmark-html]: https://spec.commonmark.org/0.31.2/#html-blocks
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[file-license]: license
[github-awesome-rehype]: https://github.com/rehypejs/awesome-rehype
[github-awesome-remark]: https://github.com/remarkjs/awesome-remark
[github-conorhastings]: https://github.com/conorhastings
[github-hast-element]: https://github.com/syntax-tree/hast#element
[github-hast-nodes]: https://github.com/syntax-tree/hast#nodes
[github-io-react-markdown]: https://remarkjs.github.io/react-markdown/
[github-mdx]: https://github.com/mdx-js/mdx/
[github-micromark]: https://github.com/micromark/micromark
[github-react-remark]: https://github.com/remarkjs/react-remark
[github-react-syntax-highlighter]: https://github.com/react-syntax-highlighter/react-syntax-highlighter
[github-rehype]: https://github.com/rehypejs/rehype
[github-rehype-katex]: https://github.com/remarkjs/remark-math/tree/main/packages/rehype-katex
[github-rehype-plugins]: https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins
[github-rehype-raw]: https://github.com/rehypejs/rehype-raw
[github-rehype-react]: https://github.com/rehypejs/rehype-react
[github-rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize
[github-remark]: https://github.com/remarkjs/remark
[github-remark-gfm]: https://github.com/remarkjs/remark-gfm
[github-remark-math]: https://github.com/remarkjs/remark-math
[github-remark-plugins]: https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins
[github-remark-rehype-options]: https://github.com/remarkjs/remark-rehype#options
[github-topic-rehype-plugin]: https://github.com/topics/rehype-plugin
[github-topic-remark-plugin]: https://github.com/topics/remark-plugin
[github-unified]: https://github.com/unifiedjs/unified
[health]: https://github.com/remarkjs/.github
[health-coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md
[health-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md
[health-support]: https://github.com/remarkjs/.github/blob/main/support.md
[npm-install]: https://docs.npmjs.com/cli/install
[react]: http://reactjs.org
[section-components]: #appendix-b-components
[section-plugins]: #plugins
[section-security]: #security
[section-syntax]: #syntax
[typescript]: https://www.typescriptlang.org
@@ -0,0 +1,39 @@
/**
Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag.
@param flag - CLI flag to look for. The `--` prefix is optional.
@param argv - CLI arguments. Default: `process.argv`.
@returns Whether the flag exists.
@example
```
// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow
// foo.ts
import hasFlag = require('has-flag');
hasFlag('unicorn');
//=> true
hasFlag('--unicorn');
//=> true
hasFlag('f');
//=> true
hasFlag('-f');
//=> true
hasFlag('foo=bar');
//=> true
hasFlag('foo');
//=> false
hasFlag('rainbow');
//=> false
```
*/
declare function hasFlag(flag: string, argv?: string[]): boolean;
export = hasFlag;
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloneRest = CloneRest;
exports.CloneType = CloneType;
const value_1 = require("./value");
/** Clones a Rest */
function CloneRest(schemas) {
return schemas.map((schema) => CloneType(schema));
}
/** Clones a Type */
function CloneType(schema, options) {
return options === undefined ? (0, value_1.Clone)(schema) : (0, value_1.Clone)({ ...options, ...schema });
}
@@ -0,0 +1,6 @@
import {
pink
} from "../chunk-DCEG5LGX.mjs";
export {
pink
};
@@ -0,0 +1,36 @@
'use strict';
require('../auto');
var runTests = require('./tests');
var test = require('tape');
var defineProperties = require('define-properties');
var callBind = require('call-bind');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();
test('shimmed', function (t) {
t.equal(String.prototype.trimEnd.length, 0, 'String#trimEnd has a length of 0');
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal((/^(?:trimRight|trimEnd)$/).test(String.prototype.trimEnd.name), true, 'String#trimEnd has name "trimRight" or "trimEnd"');
st.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(String.prototype, 'trimEnd'), 'String#trimEnd is not enumerable');
et.end();
});
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
t.test('bad string/this value', { skip: !supportsStrictMode }, function (st) {
st['throws'](function () { return String.prototype.trimEnd.call(undefined, 'a'); }, TypeError, 'undefined is not an object');
st['throws'](function () { return String.prototype.trimEnd.call(null, 'a'); }, TypeError, 'null is not an object');
st.end();
});
runTests(callBind(String.prototype.trimEnd), t);
t.end();
});
@@ -0,0 +1,182 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'no-inferrable-types',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean',
recommended: 'stylistic',
},
fixable: 'code',
messages: {
noInferrableType: 'Type {{type}} trivially inferred from a {{type}} literal, remove type annotation.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
ignoreParameters: {
type: 'boolean',
description: 'Whether to ignore function parameters.',
},
ignoreProperties: {
type: 'boolean',
description: 'Whether to ignore class properties.',
},
},
},
],
},
defaultOptions: [
{
ignoreParameters: false,
ignoreProperties: false,
},
],
create(context, [{ ignoreParameters, ignoreProperties }]) {
function isFunctionCall(init, callName) {
const node = (0, util_1.skipChainExpression)(init);
return (node.type === utils_1.AST_NODE_TYPES.CallExpression &&
node.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
node.callee.name === callName);
}
function isLiteral(init, typeName) {
return (init.type === utils_1.AST_NODE_TYPES.Literal && typeof init.value === typeName);
}
function isIdentifier(init, ...names) {
return (init.type === utils_1.AST_NODE_TYPES.Identifier && names.includes(init.name));
}
function hasUnaryPrefix(init, ...operators) {
return (init.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
operators.includes(init.operator));
}
const keywordMap = {
[utils_1.AST_NODE_TYPES.TSBigIntKeyword]: 'bigint',
[utils_1.AST_NODE_TYPES.TSBooleanKeyword]: 'boolean',
[utils_1.AST_NODE_TYPES.TSNullKeyword]: 'null',
[utils_1.AST_NODE_TYPES.TSNumberKeyword]: 'number',
[utils_1.AST_NODE_TYPES.TSStringKeyword]: 'string',
[utils_1.AST_NODE_TYPES.TSSymbolKeyword]: 'symbol',
[utils_1.AST_NODE_TYPES.TSUndefinedKeyword]: 'undefined',
};
/**
* Returns whether a node has an inferrable value or not
*/
function isInferrable(annotation, init) {
switch (annotation.type) {
case utils_1.AST_NODE_TYPES.TSBigIntKeyword: {
// note that bigint cannot have + prefixed to it
const unwrappedInit = hasUnaryPrefix(init, '-')
? init.argument
: init;
return (isFunctionCall(unwrappedInit, 'BigInt') ||
unwrappedInit.type === utils_1.AST_NODE_TYPES.Literal);
}
case utils_1.AST_NODE_TYPES.TSBooleanKeyword:
return (hasUnaryPrefix(init, '!') ||
isFunctionCall(init, 'Boolean') ||
isLiteral(init, 'boolean'));
case utils_1.AST_NODE_TYPES.TSNumberKeyword: {
const unwrappedInit = hasUnaryPrefix(init, '+', '-')
? init.argument
: init;
return (isIdentifier(unwrappedInit, 'Infinity', 'NaN') ||
isFunctionCall(unwrappedInit, 'Number') ||
isLiteral(unwrappedInit, 'number'));
}
case utils_1.AST_NODE_TYPES.TSNullKeyword:
return init.type === utils_1.AST_NODE_TYPES.Literal && init.value == null;
case utils_1.AST_NODE_TYPES.TSStringKeyword:
return (isFunctionCall(init, 'String') ||
isLiteral(init, 'string') ||
init.type === utils_1.AST_NODE_TYPES.TemplateLiteral);
case utils_1.AST_NODE_TYPES.TSSymbolKeyword:
return isFunctionCall(init, 'Symbol');
case utils_1.AST_NODE_TYPES.TSTypeReference: {
if (annotation.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
annotation.typeName.name === 'RegExp') {
const isRegExpLiteral = init.type === utils_1.AST_NODE_TYPES.Literal &&
init.value instanceof RegExp;
const isRegExpNewCall = init.type === utils_1.AST_NODE_TYPES.NewExpression &&
init.callee.type === utils_1.AST_NODE_TYPES.Identifier &&
init.callee.name === 'RegExp';
const isRegExpCall = isFunctionCall(init, 'RegExp');
return isRegExpLiteral || isRegExpCall || isRegExpNewCall;
}
return false;
}
case utils_1.AST_NODE_TYPES.TSUndefinedKeyword:
return (hasUnaryPrefix(init, 'void') || isIdentifier(init, 'undefined'));
}
return false;
}
/**
* Reports an inferrable type declaration, if any
*/
function reportInferrableType(node, typeNode, initNode) {
if (!typeNode || !initNode) {
return;
}
if (!isInferrable(typeNode.typeAnnotation, initNode)) {
return;
}
const type = typeNode.typeAnnotation.type === utils_1.AST_NODE_TYPES.TSTypeReference
? // TODO - if we add more references
'RegExp'
: keywordMap[typeNode.typeAnnotation.type];
context.report({
node,
messageId: 'noInferrableType',
data: {
type,
},
*fix(fixer) {
if ((node.type === utils_1.AST_NODE_TYPES.AssignmentPattern &&
node.left.optional) ||
(node.type === utils_1.AST_NODE_TYPES.PropertyDefinition && node.definite)) {
yield fixer.remove((0, util_1.nullThrows)(context.sourceCode.getTokenBefore(typeNode), util_1.NullThrowsReasons.MissingToken('token before', 'type node')));
}
yield fixer.remove(typeNode);
},
});
}
function inferrableVariableVisitor(node) {
reportInferrableType(node, node.id.typeAnnotation, node.init);
}
function inferrableParameterVisitor(node) {
if (ignoreParameters) {
return;
}
node.params.forEach(param => {
if (param.type === utils_1.AST_NODE_TYPES.TSParameterProperty) {
param = param.parameter;
}
if (param.type === utils_1.AST_NODE_TYPES.AssignmentPattern) {
reportInferrableType(param, param.left.typeAnnotation, param.right);
}
});
}
function inferrablePropertyVisitor(node) {
// We ignore `readonly` because of Microsoft/TypeScript#14416
// Essentially a readonly property without a type
// will result in its value being the type, leading to
// compile errors if the type is stripped.
if (ignoreProperties || node.readonly || node.optional) {
return;
}
reportInferrableType(node, node.typeAnnotation, node.value);
}
return {
AccessorProperty: inferrablePropertyVisitor,
ArrowFunctionExpression: inferrableParameterVisitor,
FunctionDeclaration: inferrableParameterVisitor,
FunctionExpression: inferrableParameterVisitor,
PropertyDefinition: inferrablePropertyVisitor,
VariableDeclarator: inferrableVariableVisitor,
};
},
});
@@ -0,0 +1,73 @@
import { ScalarType } from "./reflection-info";
/**
* Determines whether two message of the same type have the same field values.
* Checks for deep equality, traversing repeated fields, oneof groups, maps
* and messages recursively.
* Will also return true if both messages are `undefined`.
*/
export function reflectionEquals(info, a, b) {
if (a === b)
return true;
if (!a || !b)
return false;
for (let field of info.fields) {
let localName = field.localName;
let val_a = field.oneof ? a[field.oneof][localName] : a[localName];
let val_b = field.oneof ? b[field.oneof][localName] : b[localName];
switch (field.kind) {
case "enum":
case "scalar":
let t = field.kind == "enum" ? ScalarType.INT32 : field.T;
if (!(field.repeat
? repeatedPrimitiveEq(t, val_a, val_b)
: primitiveEq(t, val_a, val_b)))
return false;
break;
case "map":
if (!(field.V.kind == "message"
? repeatedMsgEq(field.V.T(), objectValues(val_a), objectValues(val_b))
: repeatedPrimitiveEq(field.V.kind == "enum" ? ScalarType.INT32 : field.V.T, objectValues(val_a), objectValues(val_b))))
return false;
break;
case "message":
let T = field.T();
if (!(field.repeat
? repeatedMsgEq(T, val_a, val_b)
: T.equals(val_a, val_b)))
return false;
break;
}
}
return true;
}
const objectValues = Object.values;
function primitiveEq(type, a, b) {
if (a === b)
return true;
if (type !== ScalarType.BYTES)
return false;
let ba = a;
let bb = b;
if (ba.length !== bb.length)
return false;
for (let i = 0; i < ba.length; i++)
if (ba[i] != bb[i])
return false;
return true;
}
function repeatedPrimitiveEq(type, a, b) {
if (a.length !== b.length)
return false;
for (let i = 0; i < a.length; i++)
if (!primitiveEq(type, a[i], b[i]))
return false;
return true;
}
function repeatedMsgEq(type, a, b) {
if (a.length !== b.length)
return false;
for (let i = 0; i < a.length; i++)
if (!type.equals(a[i], b[i]))
return false;
return true;
}
@@ -0,0 +1,8 @@
import { default as Level } from './Level';
import { TLevel } from './typings';
/**
* Normalize log level (标准化日志级别)
* @param level Log level (日志级别)
* @returns Normalized log level (标准化后的日志级别)
*/
export default function normalizeLevel(level: Level | TLevel): Level | undefined;
@@ -0,0 +1,192 @@
/**
* @fileoverview Rule to warn when a function expression does not have a name.
* @author Kyle T. Nunery
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
/**
* Checks whether or not a given variable is a function name.
* @param {eslint-scope.Variable} variable A variable to check.
* @returns {boolean} `true` if the variable is a function name.
*/
function isFunctionName(variable) {
return variable && variable.defs[0].type === "FunctionName";
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: ["always", {}],
docs: {
description: "Require or disallow named `function` expressions",
recommended: false,
url: "https://eslint.org/docs/latest/rules/func-names",
},
schema: {
definitions: {
value: {
enum: ["always", "as-needed", "never"],
},
},
items: [
{
$ref: "#/definitions/value",
},
{
type: "object",
properties: {
generators: {
$ref: "#/definitions/value",
},
},
additionalProperties: false,
},
],
},
messages: {
unnamed: "Unexpected unnamed {{name}}.",
named: "Unexpected named {{name}}.",
},
},
create(context) {
const sourceCode = context.sourceCode;
/**
* Returns the config option for the given node.
* @param {ASTNode} node A node to get the config for.
* @returns {string} The config option.
*/
function getConfigForNode(node) {
if (node.generator && context.options[1].generators) {
return context.options[1].generators;
}
return context.options[0];
}
/**
* Determines whether the current FunctionExpression node is a get, set, or
* shorthand method in an object literal or a class.
* @param {ASTNode} node A node to check.
* @returns {boolean} True if the node is a get, set, or shorthand method.
*/
function isObjectOrClassMethod(node) {
const parent = node.parent;
return (
parent.type === "MethodDefinition" ||
(parent.type === "Property" &&
(parent.method ||
parent.kind === "get" ||
parent.kind === "set"))
);
}
/**
* Determines whether the current FunctionExpression node has a name that would be
* inferred from context in a conforming ES6 environment.
* @param {ASTNode} node A node to check.
* @returns {boolean} True if the node would have a name assigned automatically.
*/
function hasInferredName(node) {
const parent = node.parent;
return (
isObjectOrClassMethod(node) ||
(parent.type === "VariableDeclarator" &&
parent.id.type === "Identifier" &&
parent.init === node) ||
(parent.type === "Property" && parent.value === node) ||
(parent.type === "PropertyDefinition" &&
parent.value === node) ||
(parent.type === "AssignmentExpression" &&
parent.left.type === "Identifier" &&
parent.right === node) ||
(parent.type === "AssignmentPattern" &&
parent.left.type === "Identifier" &&
parent.right === node)
);
}
/**
* Reports that an unnamed function should be named
* @param {ASTNode} node The node to report in the event of an error.
* @returns {void}
*/
function reportUnexpectedUnnamedFunction(node) {
context.report({
node,
messageId: "unnamed",
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
data: { name: astUtils.getFunctionNameWithKind(node) },
});
}
/**
* Reports that a named function should be unnamed
* @param {ASTNode} node The node to report in the event of an error.
* @returns {void}
*/
function reportUnexpectedNamedFunction(node) {
context.report({
node,
messageId: "named",
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
data: { name: astUtils.getFunctionNameWithKind(node) },
});
}
/**
* The listener for function nodes.
* @param {ASTNode} node function node
* @returns {void}
*/
function handleFunction(node) {
// Skip recursive functions.
const nameVar = sourceCode.getDeclaredVariables(node)[0];
if (isFunctionName(nameVar) && nameVar.references.length > 0) {
return;
}
const hasName = Boolean(node.id && node.id.name);
const config = getConfigForNode(node);
if (config === "never") {
if (hasName && node.type !== "FunctionDeclaration") {
reportUnexpectedNamedFunction(node);
}
} else if (config === "as-needed") {
if (!hasName && !hasInferredName(node)) {
reportUnexpectedUnnamedFunction(node);
}
} else {
if (!hasName && !isObjectOrClassMethod(node)) {
reportUnexpectedUnnamedFunction(node);
}
}
}
return {
"FunctionExpression:exit": handleFunction,
"ExportDefaultDeclaration > FunctionDeclaration": handleFunction,
};
},
};
@@ -0,0 +1,59 @@
/**
* @license React
* use-sync-external-store-shim.native.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
"use strict";
var React = require("react");
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var objectIs = "function" === typeof Object.is ? Object.is : is,
useState = React.useState,
useEffect = React.useEffect,
useLayoutEffect = React.useLayoutEffect,
useDebugValue = React.useDebugValue;
function useSyncExternalStore$1(subscribe, getSnapshot) {
var value = getSnapshot(),
_useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
inst = _useState[0].inst,
forceUpdate = _useState[1];
useLayoutEffect(
function () {
inst.value = value;
inst.getSnapshot = getSnapshot;
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
},
[subscribe, value, getSnapshot]
);
useEffect(
function () {
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
return subscribe(function () {
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
});
},
[subscribe]
);
useDebugValue(value);
return value;
}
function checkIfSnapshotChanged(inst) {
var latestGetSnapshot = inst.getSnapshot;
inst = inst.value;
try {
var nextValue = latestGetSnapshot();
return !objectIs(inst, nextValue);
} catch (error) {
return !0;
}
}
exports.useSyncExternalStore =
void 0 !== React.useSyncExternalStore
? React.useSyncExternalStore
: useSyncExternalStore$1;
@@ -0,0 +1,12 @@
import { MessageElement, Peer } from '../types';
export interface NodeIkernelTestPerformanceService {
insertMsg(MsgParam: {
peer: Peer;
msgTime: string;
msgId: string;
msgSeq: string;
batchNums: number;
timesPerBatch: number;
numPerTime: number;
}, msg: Array<MessageElement>): Promise<unknown>;
}
@@ -0,0 +1,86 @@
'use strict';
var utils = require('../utils.js');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
var restSpreadSpacing = utils.createRule({
name: "rest-spread-spacing",
package: "js",
meta: {
type: "layout",
docs: {
description: "Enforce spacing between rest and spread operators and their expressions"
},
fixable: "whitespace",
schema: [
{
type: "string",
enum: ["always", "never"]
}
],
messages: {
unexpectedWhitespace: "Unexpected whitespace after {{type}} operator.",
expectedWhitespace: "Expected whitespace after {{type}} operator."
}
},
create(context) {
const sourceCode = context.sourceCode;
const alwaysSpace = context.options[0] === "always";
function checkWhiteSpace(node) {
const operator = sourceCode.getFirstToken(node);
const nextToken = sourceCode.getTokenAfter(operator);
const hasWhitespace = sourceCode.isSpaceBetweenTokens(operator, nextToken);
let type;
switch (node.type) {
case "SpreadElement":
type = "spread";
if (node.parent.type === "ObjectExpression")
type += " property";
break;
case "RestElement":
type = "rest";
if (node.parent.type === "ObjectPattern")
type += " property";
break;
default:
return;
}
if (alwaysSpace && !hasWhitespace) {
context.report({
node,
loc: operator.loc,
messageId: "expectedWhitespace",
data: {
type
},
fix(fixer) {
return fixer.replaceTextRange([operator.range[1], nextToken.range[0]], " ");
}
});
} else if (!alwaysSpace && hasWhitespace) {
context.report({
node,
loc: {
start: operator.loc.end,
end: nextToken.loc.start
},
messageId: "unexpectedWhitespace",
data: {
type
},
fix(fixer) {
return fixer.removeRange([operator.range[1], nextToken.range[0]]);
}
});
}
}
return {
SpreadElement: checkWhiteSpace,
RestElement: checkWhiteSpace
};
}
});
module.exports = restSpreadSpacing;
@@ -0,0 +1 @@
{"version":3,"file":"eslintrc-universal.cjs","sources":["../lib/shared/config-ops.js","../lib/shared/deprecation-warnings.js","../lib/shared/ajv.js","../lib/shared/deep-merge-arrays.js","../conf/config-schema.js","../conf/environments.js","../lib/shared/config-validator.js","../lib/shared/naming.js","../lib/index-universal.js"],"sourcesContent":["/**\n * @fileoverview Config file operations. This file must be usable in the browser,\n * so no Node-specific code can be here.\n * @author Nicholas C. Zakas\n */\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\nconst RULE_SEVERITY_STRINGS = [\"off\", \"warn\", \"error\"],\n RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {\n map[value] = index;\n return map;\n }, {}),\n VALID_SEVERITIES = new Set([0, 1, 2, \"off\", \"warn\", \"error\"]);\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Normalizes the severity value of a rule's configuration to a number\n * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally\n * received from the user. A valid config value is either 0, 1, 2, the string \"off\" (treated the same as 0),\n * the string \"warn\" (treated the same as 1), the string \"error\" (treated the same as 2), or an array\n * whose first element is one of the above values. Strings are matched case-insensitively.\n * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.\n */\nfunction getRuleSeverity(ruleConfig) {\n const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (severityValue === 0 || severityValue === 1 || severityValue === 2) {\n return severityValue;\n }\n\n if (typeof severityValue === \"string\") {\n return RULE_SEVERITY[severityValue.toLowerCase()] || 0;\n }\n\n return 0;\n}\n\n/**\n * Converts old-style severity settings (0, 1, 2) into new-style\n * severity settings (off, warn, error) for all rules. Assumption is that severity\n * values have already been validated as correct.\n * @param {Object} config The config object to normalize.\n * @returns {void}\n */\nfunction normalizeToStrings(config) {\n\n if (config.rules) {\n Object.keys(config.rules).forEach(ruleId => {\n const ruleConfig = config.rules[ruleId];\n\n if (typeof ruleConfig === \"number\") {\n config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];\n } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === \"number\") {\n ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];\n }\n });\n }\n}\n\n/**\n * Determines if the severity for the given rule configuration represents an error.\n * @param {int|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} True if the rule represents an error, false if not.\n */\nfunction isErrorSeverity(ruleConfig) {\n return getRuleSeverity(ruleConfig) === 2;\n}\n\n/**\n * Checks whether a given config has valid severity or not.\n * @param {number|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isValidSeverity(ruleConfig) {\n let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (typeof severity === \"string\") {\n severity = severity.toLowerCase();\n }\n return VALID_SEVERITIES.has(severity);\n}\n\n/**\n * Checks whether every rule of a given config has valid severity or not.\n * @param {Object} config The configuration for rules.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isEverySeverityValid(config) {\n return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId]));\n}\n\n/**\n * Normalizes a value for a global in a config\n * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in\n * a global directive comment\n * @returns {(\"readable\"|\"writeable\"|\"off\")} The value normalized as a string\n * @throws Error if global value is invalid\n */\nfunction normalizeConfigGlobal(configuredValue) {\n switch (configuredValue) {\n case \"off\":\n return \"off\";\n\n case true:\n case \"true\":\n case \"writeable\":\n case \"writable\":\n return \"writable\";\n\n case null:\n case false:\n case \"false\":\n case \"readable\":\n case \"readonly\":\n return \"readonly\";\n\n default:\n throw new Error(`'${configuredValue}' is not a Line truncated
@@ -0,0 +1,5 @@
var Stream = require('stream').Stream;
module.exports = function(o) {
return !!o && o instanceof Stream;
};
@@ -0,0 +1,112 @@
'use strict';
/* eslint global-require: 0 */
/** @satisfies {Record<string, import('eslint').Rule.RuleModule>} */
const rules = {
'boolean-prop-naming': require('./boolean-prop-naming'),
'button-has-type': require('./button-has-type'),
'checked-requires-onchange-or-readonly': require('./checked-requires-onchange-or-readonly'),
'default-props-match-prop-types': require('./default-props-match-prop-types'),
'destructuring-assignment': require('./destructuring-assignment'),
'display-name': require('./display-name'),
'forbid-component-props': require('./forbid-component-props'),
'forbid-dom-props': require('./forbid-dom-props'),
'forbid-elements': require('./forbid-elements'),
'forbid-foreign-prop-types': require('./forbid-foreign-prop-types'),
'forbid-prop-types': require('./forbid-prop-types'),
'forward-ref-uses-ref': require('./forward-ref-uses-ref'),
'function-component-definition': require('./function-component-definition'),
'hook-use-state': require('./hook-use-state'),
'iframe-missing-sandbox': require('./iframe-missing-sandbox'),
'jsx-boolean-value': require('./jsx-boolean-value'),
'jsx-child-element-spacing': require('./jsx-child-element-spacing'),
'jsx-closing-bracket-location': require('./jsx-closing-bracket-location'),
'jsx-closing-tag-location': require('./jsx-closing-tag-location'),
'jsx-curly-spacing': require('./jsx-curly-spacing'),
'jsx-curly-newline': require('./jsx-curly-newline'),
'jsx-equals-spacing': require('./jsx-equals-spacing'),
'jsx-filename-extension': require('./jsx-filename-extension'),
'jsx-first-prop-new-line': require('./jsx-first-prop-new-line'),
'jsx-handler-names': require('./jsx-handler-names'),
'jsx-indent': require('./jsx-indent'),
'jsx-indent-props': require('./jsx-indent-props'),
'jsx-key': require('./jsx-key'),
'jsx-max-depth': require('./jsx-max-depth'),
'jsx-max-props-per-line': require('./jsx-max-props-per-line'),
'jsx-newline': require('./jsx-newline'),
'jsx-no-bind': require('./jsx-no-bind'),
'jsx-no-comment-textnodes': require('./jsx-no-comment-textnodes'),
'jsx-no-constructed-context-values': require('./jsx-no-constructed-context-values'),
'jsx-no-duplicate-props': require('./jsx-no-duplicate-props'),
'jsx-no-leaked-render': require('./jsx-no-leaked-render'),
'jsx-no-literals': require('./jsx-no-literals'),
'jsx-no-script-url': require('./jsx-no-script-url'),
'jsx-no-target-blank': require('./jsx-no-target-blank'),
'jsx-no-useless-fragment': require('./jsx-no-useless-fragment'),
'jsx-one-expression-per-line': require('./jsx-one-expression-per-line'),
'jsx-no-undef': require('./jsx-no-undef'),
'jsx-curly-brace-presence': require('./jsx-curly-brace-presence'),
'jsx-pascal-case': require('./jsx-pascal-case'),
'jsx-fragments': require('./jsx-fragments'),
'jsx-props-no-multi-spaces': require('./jsx-props-no-multi-spaces'),
'jsx-props-no-spreading': require('./jsx-props-no-spreading'),
'jsx-props-no-spread-multi': require('./jsx-props-no-spread-multi'),
'jsx-sort-default-props': require('./jsx-sort-default-props'),
'jsx-sort-props': require('./jsx-sort-props'),
'jsx-space-before-closing': require('./jsx-space-before-closing'),
'jsx-tag-spacing': require('./jsx-tag-spacing'),
'jsx-uses-react': require('./jsx-uses-react'),
'jsx-uses-vars': require('./jsx-uses-vars'),
'jsx-wrap-multilines': require('./jsx-wrap-multilines'),
'no-invalid-html-attribute': require('./no-invalid-html-attribute'),
'no-access-state-in-setstate': require('./no-access-state-in-setstate'),
'no-adjacent-inline-elements': require('./no-adjacent-inline-elements'),
'no-array-index-key': require('./no-array-index-key'),
'no-arrow-function-lifecycle': require('./no-arrow-function-lifecycle'),
'no-children-prop': require('./no-children-prop'),
'no-danger': require('./no-danger'),
'no-danger-with-children': require('./no-danger-with-children'),
'no-deprecated': require('./no-deprecated'),
'no-did-mount-set-state': require('./no-did-mount-set-state'),
'no-did-update-set-state': require('./no-did-update-set-state'),
'no-direct-mutation-state': require('./no-direct-mutation-state'),
'no-find-dom-node': require('./no-find-dom-node'),
'no-is-mounted': require('./no-is-mounted'),
'no-multi-comp': require('./no-multi-comp'),
'no-namespace': require('./no-namespace'),
'no-set-state': require('./no-set-state'),
'no-string-refs': require('./no-string-refs'),
'no-redundant-should-component-update': require('./no-redundant-should-component-update'),
'no-render-return-value': require('./no-render-return-value'),
'no-this-in-sfc': require('./no-this-in-sfc'),
'no-typos': require('./no-typos'),
'no-unescaped-entities': require('./no-unescaped-entities'),
'no-unknown-property': require('./no-unknown-property'),
'no-unsafe': require('./no-unsafe'),
'no-unstable-nested-components': require('./no-unstable-nested-components'),
'no-unused-class-component-methods': require('./no-unused-class-component-methods'),
'no-unused-prop-types': require('./no-unused-prop-types'),
'no-unused-state': require('./no-unused-state'),
'no-object-type-as-default-prop': require('./no-object-type-as-default-prop'),
'no-will-update-set-state': require('./no-will-update-set-state'),
'prefer-es6-class': require('./prefer-es6-class'),
'prefer-exact-props': require('./prefer-exact-props'),
'prefer-read-only-props': require('./prefer-read-only-props'),
'prefer-stateless-function': require('./prefer-stateless-function'),
'prop-types': require('./prop-types'),
'react-in-jsx-scope': require('./react-in-jsx-scope'),
'require-default-props': require('./require-default-props'),
'require-optimization': require('./require-optimization'),
'require-render-return': require('./require-render-return'),
'self-closing-comp': require('./self-closing-comp'),
'sort-comp': require('./sort-comp'),
'sort-default-props': require('./sort-default-props'),
'sort-prop-types': require('./sort-prop-types'),
'state-in-constructor': require('./state-in-constructor'),
'static-property-placement': require('./static-property-placement'),
'style-prop-object': require('./style-prop-object'),
'void-dom-elements-no-children': require('./void-dom-elements-no-children'),
};
module.exports = rules;
@@ -0,0 +1,7 @@
import {
filterDOMProps
} from "./chunk-RJKRL3AU.mjs";
import "./chunk-RFWDHYLZ.mjs";
export {
filterDOMProps
};
@@ -0,0 +1 @@
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,QAAQ,WAUjF;AAED,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,UACpB,QAAQ,GAAG,QAAQ,aAW3C;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,UAE/C;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,UAErD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAStE"}
@@ -0,0 +1 @@
import { Kind, Hint, ReadonlyKind, OptionalKind } from '../symbols/index.mjs';
@@ -0,0 +1 @@
{"name":"micromark-extension-gfm-strikethrough","version":"2.1.0","requiresBuild":false,"files":{"license":{"checkedAt":1794532112717,"integrity":"sha512-fzvkEDDVqhfCJpKNt4nSfCdql95dXnYBu6QTwaEDV5dX/EtSGYys2u3y/9LaRjp4jUgB4qbz5csHGjJjcZAb2Q==","mode":420,"size":1099},"dev/lib/html.js":{"checkedAt":1794532116115,"integrity":"sha512-RkJ6NdbT3mJWu/sUVv8VDghPzEW6ebK9mVcEPDHgWmlj4fQYmKMoK0MI0iA11dZK+4+ePJinVilxRZboA4KEag==","mode":420,"size":549},"lib/html.js":{"checkedAt":1794532116115,"integrity":"sha512-YhNRZUXgDdGp4A9oLlpchNNB89gl55f8efMEq5TldWu4pbXX3HqOpwQGoSmcYnovXCSI0j0/82MoaHGE6dVODQ==","mode":420,"size":551},"dev/index.js":{"checkedAt":1794532116116,"integrity":"sha512-3fqKrfI8J7X8q2ALCUC3Tp6k96PtNpgqbJgozX4jD123ilnmmGediVNpLKpSMsMuyfwjSThtt5ijiNYOBy6DFA==","mode":420,"size":147},"index.js":{"checkedAt":1794532116116,"integrity":"sha512-oU1fJGsAALhVbkfLA375J7Qa4Fl4ZyGeQC0PwG/rKX75IMjcQlfXjum9WawudXmkdW4sKDfXBFvg7SiEPtQs0Q==","mode":420,"size":152},"dev/lib/syntax.js":{"checkedAt":1794532116116,"integrity":"sha512-XGnVWUs7zOISmhjCLMogvtH2FkaP/4dUpGnLVThXm35A6RhOBhb1NrW9AgdYqZ0GQH3pnu/ydXTJ7IZXujrP2w==","mode":420,"size":5300},"lib/syntax.js":{"checkedAt":1794532116116,"integrity":"sha512-RYkdCI+dcD/AkIb9i8sKeIGkppygR+1kISgwEj+v7NudV7itjTCDWAfKcO4r9HZA/I5/iPBmcdBSUa117CMbtg==","mode":420,"size":4763},"package.json":{"checkedAt":1794532116116,"integrity":"sha512-hXeLKFdMlbbSXB9Uw51FZ1trjpXPIW58UNHoKQ9enxgBxj6nXJItdB+jf+puvEhI3fk10E8S1iDtH1zAlffKtw==","mode":420,"size":3306},"readme.md":{"checkedAt":1794532116116,"integrity":"sha512-hvQggZbfq6Yf/jKDYtu8sm2HMEKzayr47gY2HwXNmBENaOYHFTcMJR0XCYIjprjm4hLz5AKwyo1Kup+OBVe64Q==","mode":420,"size":8438},"dev/lib/html.d.ts":{"checkedAt":1794532116116,"integrity":"sha512-toMC9eeENpwPEaFFcaoKMdH/fcbKX/muToBD1ViELALeWQV++kLs9LxLdfD8jMfX3hNfFoKCxj+kSg8MaGcgtw==","mode":420,"size":449},"lib/html.d.ts":{"checkedAt":1794532116116,"integrity":"sha512-toMC9eeENpwPEaFFcaoKMdH/fcbKX/muToBD1ViELALeWQV++kLs9LxLdfD8jMfX3hNfFoKCxj+kSg8MaGcgtw==","mode":420,"size":449},"dev/index.d.ts":{"checkedAt":1794532116117,"integrity":"sha512-HnE3Ok54zMSAmIDfrRzd2T3On8mYR/36TU3oP7bcHfy6RqNWggHwOZQWyWdlO8Epkgx0tTL1n3luO5BeszXFCg==","mode":420,"size":718},"index.d.ts":{"checkedAt":1794532116117,"integrity":"sha512-FR+NF8n4zvG5WIamS7/ZShL7bZkhHhw4FYQwo/ICi3yJgXNYnkjm9w+T/rHd+tJnCA/LWosytKtXrbSAukKPjg==","mode":420,"size":668},"dev/lib/syntax.d.ts":{"checkedAt":1794532116117,"integrity":"sha512-jozsSshFaMXCGHpxxufyWcIUu8BD8Kr5+M/D9XQwDEuWUNMrwtMutqNDKyQ8rKQGWb9K//jIxf2l9OMx1VF3bA==","mode":420,"size":498},"lib/syntax.d.ts":{"checkedAt":1794532116117,"integrity":"sha512-jozsSshFaMXCGHpxxufyWcIUu8BD8Kr5+M/D9XQwDEuWUNMrwtMutqNDKyQ8rKQGWb9K//jIxf2l9OMx1VF3bA==","mode":420,"size":498}}}
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('defaultsAll', require('../defaults'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,12 @@
import type { TSchema, SchemaOptions } from '../schema/index';
import type { TProperties } from '../object/index';
import { type TMappedResult, type TMappedKey } from '../mapped/index';
import { type TOmit } from './omit';
type TFromPropertyKey<Type extends TSchema, Key extends PropertyKey> = {
[_ in Key]: TOmit<Type, [Key]>;
};
type TFromPropertyKeys<Type extends TSchema, PropertyKeys extends PropertyKey[], Result extends TProperties = {}> = (PropertyKeys extends [infer LK extends PropertyKey, ...infer RK extends PropertyKey[]] ? TFromPropertyKeys<Type, RK, Result & TFromPropertyKey<Type, LK>> : Result);
type TFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey> = (TFromPropertyKeys<Type, MappedKey['keys']>);
export type TOmitFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey<Type, MappedKey>> = (TMappedResult<Properties>);
export declare function OmitFromMappedKey<Type extends TSchema, MappedKey extends TMappedKey, Properties extends TProperties = TFromMappedKey<Type, MappedKey>>(type: Type, mappedKey: MappedKey, options?: SchemaOptions): TMappedResult<Properties>;
export {};
@@ -0,0 +1,3 @@
declare const _exports: import('eslint').Rule.RuleModule;
export = _exports;
//# sourceMappingURL=no-unsafe.d.ts.map
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return negateValue;
}
});
function negateValue(value) {
value = `${value}`;
if (value === "0") {
return "0";
}
// Flip sign of numbers
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
}
// What functions we support negating numeric values for
// var() isn't inherently a numeric function but we support it anyway
// The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
// to produce generally useful results and that will be covered already
let numericFunctions = [
"var",
"calc",
"min",
"max",
"clamp"
];
for (const fn of numericFunctions){
if (value.includes(`${fn}(`)) {
return `calc(${value} * -1)`;
}
}
}
@@ -0,0 +1,25 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var style_to_object_1 = __importDefault(require("style-to-object"));
var utilities_1 = require("./utilities");
/**
* Parses CSS inline style to JavaScript object (camelCased).
*/
function StyleToJS(style, options) {
var output = {};
if (!style || typeof style !== 'string') {
return output;
}
(0, style_to_object_1.default)(style, function (property, value) {
// skip CSS comment
if (property && value) {
output[(0, utilities_1.camelCase)(property, options)] = value;
}
});
return output;
}
StyleToJS.default = StyleToJS;
module.exports = StyleToJS;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
import CryptoJS = require("./index");
export = CryptoJS.pad.AnsiX923;
@@ -0,0 +1,35 @@
const unicode = require('../lib/unicode')
module.exports = {
isSpaceSeparator (c) {
return typeof c === 'string' && unicode.Space_Separator.test(c)
},
isIdStartChar (c) {
return typeof c === 'string' && (
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c === '$') || (c === '_') ||
unicode.ID_Start.test(c)
)
},
isIdContinueChar (c) {
return typeof c === 'string' && (
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||
(c === '$') || (c === '_') ||
(c === '\u200C') || (c === '\u200D') ||
unicode.ID_Continue.test(c)
)
},
isDigit (c) {
return typeof c === 'string' && /[0-9]/.test(c)
},
isHexDigit (c) {
return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
},
}
@@ -0,0 +1,3 @@
export type MessageId = 'noNamed' | 'multiDefault' | 'multiNamed';
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageId, [], import("../utils/create-rule.ts").ImportXPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,63 @@
import type { Linter } from './Linter';
export declare namespace Processor {
interface ProcessorMeta {
/**
* The unique name of the processor.
*/
name: string;
/**
* The a string identifying the version of the processor.
*/
version?: string;
}
type PreProcess = (text: string, filename: string) => (string | {
filename: string;
text: string;
})[];
type PostProcess = (messagesList: Linter.LintMessage[][], filename: string) => Linter.LintMessage[];
interface ProcessorModule {
/**
* Information about the processor to uniquely identify it when serializing.
*/
meta?: ProcessorMeta;
/**
* The function to merge messages.
*/
postprocess?: PostProcess;
/**
* The function to extract code blocks.
*/
preprocess?: PreProcess;
/**
* If `true` then it means the processor supports autofix.
*/
supportsAutofix?: boolean;
}
/**
* A loose definition of the ParserModule type for use with configs
* This type intended to relax validation of configs so that parsers that have
* different AST types or scope managers can still be passed to configs
*
* @see {@link LooseRuleDefinition}, {@link LooseParserModule}
*/
interface LooseProcessorModule {
/**
* Information about the processor to uniquely identify it when serializing.
*/
meta?: {
[K in keyof ProcessorMeta]?: ProcessorMeta[K] | undefined;
};
/**
* The function to merge messages.
*/
postprocess?: (messagesList: any, filename: string) => any;
/**
* The function to extract code blocks.
*/
preprocess?: (text: string, filename: string) => any;
/**
* If `true` then it means the processor supports autofix.
*/
supportsAutofix?: boolean | undefined;
}
}
@@ -0,0 +1,63 @@
var apply = require('./_apply'),
arrayPush = require('./_arrayPush'),
baseRest = require('./_baseRest'),
castSlice = require('./_castSlice'),
toInteger = require('./toInteger');
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Creates a function that invokes `func` with the `this` binding of the
* create function and an array of arguments much like
* [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
*
* **Note:** This method is based on the
* [spread operator](https://mdn.io/spread_operator).
*
* @static
* @memberOf _
* @since 3.2.0
* @category Function
* @param {Function} func The function to spread arguments over.
* @param {number} [start=0] The start position of the spread.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.spread(function(who, what) {
* return who + ' says ' + what;
* });
*
* say(['fred', 'hello']);
* // => 'fred says hello'
*
* var numbers = Promise.all([
* Promise.resolve(40),
* Promise.resolve(36)
* ]);
*
* numbers.then(_.spread(function(x, y) {
* return x + y;
* }));
* // => a Promise of 76
*/
function spread(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) {
var array = args[start],
otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
module.exports = spread;
@@ -0,0 +1,25 @@
/**
* Checks if `value` is `null` or `undefined`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is nullish, else `false`.
* @example
*
* _.isNil(null);
* // => true
*
* _.isNil(void 0);
* // => true
*
* _.isNil(NaN);
* // => false
*/
function isNil(value) {
return value == null;
}
export default isNil;
@@ -0,0 +1 @@
{"name":"replace-ext","version":"0.0.1","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532118738,"integrity":"sha512-1w8Or3mIr2dhlm8bpM4cYze01g+mBvBrKN+JqDs0L1+Gag8/sxPFLUdakIFbA6I3UxvWOBZx5S9ahuPHZet4sA==","mode":420,"size":944},".npmignore":{"checkedAt":1794532118738,"integrity":"sha512-Rl4j1vI1y8OJ1pbXJvv9V/t1CdK39irpnC1EKfa9e2u/qMhuEqCcjieWmjhshrRsULXsPybK325k8dq7GT0bZg==","mode":420,"size":52},"README.md":{"checkedAt":1794532118738,"integrity":"sha512-GXWKmfxppE1AiRmIBha9zBW4vnTX+vPB1XgM8x4xzXIiYq5vG8LacG2Hbk6J7d4lYHem9k/wjvqg5pz90goH9Q==","mode":420,"size":1267},"LICENSE":{"checkedAt":1794532118738,"integrity":"sha512-MVW/VBVogzHhwHyEcSdnO326q+tMl8evFHEQ1zNKfQMtvxOX03yq/cEBdooTooAOUqRihxKGp9DS+7CCE8181w==","mode":493,"size":1078},"index.js":{"checkedAt":1794532118738,"integrity":"sha512-qToedzbzrioFi/56KoUlbqw1kSvAnKyG3bjsvgU/0Q94KPr3c3+OuXyDRzwVMFtP0tPfm68Y3kfVt6pZ0iOtFQ==","mode":420,"size":276},".travis.yml":{"checkedAt":1794532118738,"integrity":"sha512-bqP9SZQT+4t+6dETrPoF2l520tXlO0chBYQilW5Gk9aBCYuZyUJsoPM4IVtVZjllaF6g21vRbvajj8lJmsu5Ug==","mode":420,"size":103},"test/main.js":{"checkedAt":1794532118739,"integrity":"sha512-uZivs0Af2NR72O9ND+FM/4ihwfd8qQlKcEk1mlolF20edeAx7XGJ6dRgwqUh7NVI4UMhZdwgOSH3XwCcl1ZhNw==","mode":420,"size":1563}}}
@@ -0,0 +1,61 @@
type Pathname = string
interface TestResult {
ignored: boolean
unignored: boolean
}
export interface Ignore {
/**
* Adds one or several rules to the current manager.
* @param {string[]} patterns
* @returns IgnoreBase
*/
add(patterns: string | Ignore | readonly (string | Ignore)[]): this
/**
* Filters the given array of pathnames, and returns the filtered array.
* NOTICE that each path here should be a relative path to the root of your repository.
* @param paths the array of paths to be filtered.
* @returns The filtered array of paths
*/
filter(pathnames: readonly Pathname[]): Pathname[]
/**
* Creates a filter function which could filter
* an array of paths with Array.prototype.filter.
*/
createFilter(): (pathname: Pathname) => boolean
/**
* Returns Boolean whether pathname should be ignored.
* @param {string} pathname a path to check
* @returns boolean
*/
ignores(pathname: Pathname): boolean
/**
* Returns whether pathname should be ignored or unignored
* @param {string} pathname a path to check
* @returns TestResult
*/
test(pathname: Pathname): TestResult
}
export interface Options {
ignorecase?: boolean
// For compatibility
ignoreCase?: boolean
allowRelativePaths?: boolean
}
/**
* Creates new ignore manager.
*/
declare function ignore(options?: Options): Ignore
declare namespace ignore {
export function isPathValid (pathname: string): boolean
}
export default ignore
@@ -0,0 +1,68 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {FocusableElement} from '@react-types/shared';
import {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';
import {PressProps} from './usePress';
import {PressResponderContext} from './context';
import React, {ForwardedRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';
interface PressResponderProps extends PressProps {
children: ReactNode
}
export const PressResponder:
React.ForwardRefExoticComponent<PressResponderProps & React.RefAttributes<FocusableElement>> =
React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {
let isRegistered = useRef(false);
let prevContext = useContext(PressResponderContext);
ref = useObjectRef(ref || prevContext?.ref);
let context = mergeProps(prevContext || {}, {
...props,
ref,
register() {
isRegistered.current = true;
if (prevContext) {
prevContext.register();
}
}
});
useSyncRef(prevContext, ref);
useEffect(() => {
if (!isRegistered.current) {
if (process.env.NODE_ENV !== 'production') {
console.warn(
'A PressResponder was rendered without a pressable child. ' +
'Either call the usePress hook, or wrap your DOM node with <Pressable> component.'
);
}
isRegistered.current = true; // only warn once in strict mode.
}
}, []);
return (
<PressResponderContext.Provider value={context}>
{children}
</PressResponderContext.Provider>
);
});
export function ClearPressResponder({children}: {children: ReactNode}): JSX.Element {
let context = useMemo(() => ({register: () => {}}), []);
return (
<PressResponderContext.Provider value={context}>
{children}
</PressResponderContext.Provider>
);
}
@@ -0,0 +1 @@
module.exports={C:{"143":1.7563,"144":1.7563,_:"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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 145 146 147 3.5 3.6"},D:{"95":0.07983,"109":0.36159,"125":0.95798,"131":0.39916,"138":0.15966,"139":0.31933,"140":14.49655,"141":15.01311,_:"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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 126 127 128 129 130 132 133 134 135 136 137 142 143 144 145"},F:{"122":0.92042,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"114":0.15966,"140":0.36159,"141":4.83218,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 142"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 15.6 16.0 16.1 16.2 16.3 16.4 16.5 16.6 17.0 17.1 17.2 17.3 17.4 17.5 17.6 18.0 18.1 18.2 18.3 18.4 18.5-18.6 26.1 26.2","26.0":0.2395},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00087,"5.0-5.1":0,"6.0-6.1":0.0035,"7.0-7.1":0.00262,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.00787,"10.0-10.2":0.00087,"10.3":0.01486,"11.0-11.2":0.22027,"11.3-11.4":0.00524,"12.0-12.1":0.00175,"12.2-12.5":0.04283,"13.0-13.1":0,"13.2":0.00437,"13.3":0.00175,"13.4-13.7":0.00699,"14.0-14.4":0.01486,"14.5-14.8":0.01573,"15.0-15.1":0.01486,"15.2-15.3":0.01136,"15.4":0.01311,"15.5":0.01486,"15.6-15.8":0.19405,"16.0":0.02622,"16.1":0.04895,"16.2":0.02535,"16.3":0.04545,"16.4":0.01136,"16.5":0.0201,"16.6-16.7":0.25961,"17.0":0.01836,"17.1":0.02797,"17.2":0.0201,"17.3":0.02972,"17.4":0.05245,"17.5":0.09003,"17.6-17.7":0.22727,"18.0":0.05157,"18.1":0.10664,"18.2":0.05769,"18.3":0.18531,"18.4":0.09528,"18.5-18.6":4.85824,"26.0":0.60051,"26.1":0.02185},P:{"28":3.27787,_:"4 20 21 22 23 24 25 26 27 29 5.0-5.4 6.2-6.4 7.2-7.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"},I:{"0":0,"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},K:{"0":0,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.16442},Q:{_:"14.9"},O:{"0":1.25174},H:{"0":0},L:{"0":43.66862}};
@@ -0,0 +1,41 @@
import type { PointerActivationConstraint } from '../sensors';
import type { Active, Over } from '../store';
import type { Collision } from '../utilities/algorithms';
import type { Coordinates, Translate } from './coordinates';
import type { UniqueIdentifier } from '.';
interface DragEvent {
activatorEvent: Event;
active: Active;
collisions: Collision[] | null;
delta: Translate;
over: Over | null;
}
/**
* Fired if a pending drag was aborted before it started.
* Only meaningful in the context of activation constraints.
**/
export interface DragAbortEvent {
id: UniqueIdentifier;
}
/**
* Fired when a drag is about to start pending activation constraints.
* @note For pointer events, it will be fired repeatedly with updated
* coordinates when pointer is moved until the drag starts.
*/
export interface DragPendingEvent {
id: UniqueIdentifier;
constraint: PointerActivationConstraint;
initialCoordinates: Coordinates;
offset?: Coordinates | undefined;
}
export interface DragStartEvent extends Pick<DragEvent, 'active' | 'activatorEvent'> {
}
export interface DragMoveEvent extends DragEvent {
}
export interface DragOverEvent extends DragMoveEvent {
}
export interface DragEndEvent extends DragEvent {
}
export interface DragCancelEvent extends DragEndEvent {
}
export {};
@@ -0,0 +1,650 @@
import * as _codemirror_state from '@codemirror/state';
import { StateCommand, Facet, Transaction, StateEffect, Extension, StateField, EditorState } from '@codemirror/state';
import { KeyBinding, Command } from '@codemirror/view';
/**
An object of this type can be provided as [language
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) under a `"commentTokens"`
property to configure comment syntax for a language.
*/
interface CommentTokens {
/**
The block comment syntax, if any. For example, for HTML
you'd provide `{open: "<!--", close: "-->"}`.
*/
block?: {
open: string;
close: string;
};
/**
The line comment syntax. For example `"//"`.
*/
line?: string;
}
/**
Comment or uncomment the current selection. Will use line comments
if available, otherwise falling back to block comments.
*/
declare const toggleComment: StateCommand;
/**
Comment or uncomment the current selection using line comments.
The line comment syntax is taken from the
[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
*/
declare const toggleLineComment: StateCommand;
/**
Comment the current selection using line comments.
*/
declare const lineComment: StateCommand;
/**
Uncomment the current selection using line comments.
*/
declare const lineUncomment: StateCommand;
/**
Comment or uncomment the current selection using block comments.
The block comment syntax is taken from the
[`commentTokens`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) [language
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt).
*/
declare const toggleBlockComment: StateCommand;
/**
Comment the current selection using block comments.
*/
declare const blockComment: StateCommand;
/**
Uncomment the current selection using block comments.
*/
declare const blockUncomment: StateCommand;
/**
Comment or uncomment the lines around the current selection using
block comments.
*/
declare const toggleBlockCommentByLine: StateCommand;
/**
Transaction annotation that will prevent that transaction from
being combined with other transactions in the undo history. Given
`"before"`, it'll prevent merging with previous transactions. With
`"after"`, subsequent transactions won't be combined with this
one. With `"full"`, the transaction is isolated on both sides.
*/
declare const isolateHistory: _codemirror_state.AnnotationType<"after" | "before" | "full">;
/**
This facet provides a way to register functions that, given a
transaction, provide a set of effects that the history should
store when inverting the transaction. This can be used to
integrate some kinds of effects in the history, so that they can
be undone (and redone again).
*/
declare const invertedEffects: Facet<(tr: Transaction) => readonly StateEffect<any>[], readonly ((tr: Transaction) => readonly StateEffect<any>[])[]>;
interface HistoryConfig {
/**
The minimum depth (amount of events) to store. Defaults to 100.
*/
minDepth?: number;
/**
The maximum time (in milliseconds) that adjacent events can be
apart and still be grouped together. Defaults to 500.
*/
newGroupDelay?: number;
/**
By default, when close enough together in time, changes are
joined into an existing undo event if they touch any of the
changed ranges from that event. You can pass a custom predicate
here to influence that logic.
*/
joinToEvent?: (tr: Transaction, isAdjacent: boolean) => boolean;
}
/**
Create a history extension with the given configuration.
*/
declare function history(config?: HistoryConfig): Extension;
/**
The state field used to store the history data. Should probably
only be used when you want to
[serialize](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) or
[deserialize](https://codemirror.net/6/docs/ref/#state.EditorState^fromJSON) state objects in a way
that preserves history.
*/
declare const historyField: StateField<unknown>;
/**
Undo a single group of history events. Returns false if no group
was available.
*/
declare const undo: StateCommand;
/**
Redo a group of history events. Returns false if no group was
available.
*/
declare const redo: StateCommand;
/**
Undo a change or selection change.
*/
declare const undoSelection: StateCommand;
/**
Redo a change or selection change.
*/
declare const redoSelection: StateCommand;
/**
The amount of undoable change events available in a given state.
*/
declare const undoDepth: (state: EditorState) => number;
/**
The amount of redoable change events available in a given state.
*/
declare const redoDepth: (state: EditorState) => number;
/**
Default key bindings for the undo history.
- Mod-z: [`undo`](https://codemirror.net/6/docs/ref/#commands.undo).
- Mod-y (Mod-Shift-z on macOS) + Ctrl-Shift-z on Linux: [`redo`](https://codemirror.net/6/docs/ref/#commands.redo).
- Mod-u: [`undoSelection`](https://codemirror.net/6/docs/ref/#commands.undoSelection).
- Alt-u (Mod-Shift-u on macOS): [`redoSelection`](https://codemirror.net/6/docs/ref/#commands.redoSelection).
*/
declare const historyKeymap: readonly KeyBinding[];
/**
Move the selection one character to the left (which is backward in
left-to-right text, forward in right-to-left text).
*/
declare const cursorCharLeft: Command;
/**
Move the selection one character to the right.
*/
declare const cursorCharRight: Command;
/**
Move the selection one character forward.
*/
declare const cursorCharForward: Command;
/**
Move the selection one character backward.
*/
declare const cursorCharBackward: Command;
/**
Move the selection one character forward, in logical
(non-text-direction-aware) string index order.
*/
declare const cursorCharForwardLogical: StateCommand;
/**
Move the selection one character backward, in logical string index
order.
*/
declare const cursorCharBackwardLogical: StateCommand;
/**
Move the selection to the left across one group of word or
non-word (but also non-space) characters.
*/
declare const cursorGroupLeft: Command;
/**
Move the selection one group to the right.
*/
declare const cursorGroupRight: Command;
/**
Move the selection one group forward.
*/
declare const cursorGroupForward: Command;
/**
Move the selection one group backward.
*/
declare const cursorGroupBackward: Command;
/**
Move the cursor one group forward in the default Windows style,
where it moves to the start of the next group.
*/
declare const cursorGroupForwardWin: Command;
/**
Move the selection one group or camel-case subword forward.
*/
declare const cursorSubwordForward: Command;
/**
Move the selection one group or camel-case subword backward.
*/
declare const cursorSubwordBackward: Command;
/**
Move the cursor over the next syntactic element to the left.
*/
declare const cursorSyntaxLeft: Command;
/**
Move the cursor over the next syntactic element to the right.
*/
declare const cursorSyntaxRight: Command;
/**
Move the selection one line up.
*/
declare const cursorLineUp: Command;
/**
Move the selection one line down.
*/
declare const cursorLineDown: Command;
/**
Move the selection one page up.
*/
declare const cursorPageUp: Command;
/**
Move the selection one page down.
*/
declare const cursorPageDown: Command;
/**
Move the selection to the next line wrap point, or to the end of
the line if there isn't one left on this line.
*/
declare const cursorLineBoundaryForward: Command;
/**
Move the selection to previous line wrap point, or failing that to
the start of the line. If the line is indented, and the cursor
isn't already at the end of the indentation, this will move to the
end of the indentation instead of the start of the line.
*/
declare const cursorLineBoundaryBackward: Command;
/**
Move the selection one line wrap point to the left.
*/
declare const cursorLineBoundaryLeft: Command;
/**
Move the selection one line wrap point to the right.
*/
declare const cursorLineBoundaryRight: Command;
/**
Move the selection to the start of the line.
*/
declare const cursorLineStart: Command;
/**
Move the selection to the end of the line.
*/
declare const cursorLineEnd: Command;
/**
Move the selection to the bracket matching the one it is currently
on, if any.
*/
declare const cursorMatchingBracket: StateCommand;
/**
Extend the selection to the bracket matching the one the selection
head is currently on, if any.
*/
declare const selectMatchingBracket: StateCommand;
/**
Move the selection head one character to the left, while leaving
the anchor in place.
*/
declare const selectCharLeft: Command;
/**
Move the selection head one character to the right.
*/
declare const selectCharRight: Command;
/**
Move the selection head one character forward.
*/
declare const selectCharForward: Command;
/**
Move the selection head one character backward.
*/
declare const selectCharBackward: Command;
/**
Move the selection head one character forward by logical
(non-direction aware) string index order.
*/
declare const selectCharForwardLogical: StateCommand;
/**
Move the selection head one character backward by logical string
index order.
*/
declare const selectCharBackwardLogical: StateCommand;
/**
Move the selection head one [group](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) to
the left.
*/
declare const selectGroupLeft: Command;
/**
Move the selection head one group to the right.
*/
declare const selectGroupRight: Command;
/**
Move the selection head one group forward.
*/
declare const selectGroupForward: Command;
/**
Move the selection head one group backward.
*/
declare const selectGroupBackward: Command;
/**
Move the selection head one group forward in the default Windows
style, skipping to the start of the next group.
*/
declare const selectGroupForwardWin: Command;
/**
Move the selection head one group or camel-case subword forward.
*/
declare const selectSubwordForward: Command;
/**
Move the selection head one group or subword backward.
*/
declare const selectSubwordBackward: Command;
/**
Move the selection head over the next syntactic element to the left.
*/
declare const selectSyntaxLeft: Command;
/**
Move the selection head over the next syntactic element to the right.
*/
declare const selectSyntaxRight: Command;
/**
Move the selection head one line up.
*/
declare const selectLineUp: Command;
/**
Move the selection head one line down.
*/
declare const selectLineDown: Command;
/**
Move the selection head one page up.
*/
declare const selectPageUp: Command;
/**
Move the selection head one page down.
*/
declare const selectPageDown: Command;
/**
Move the selection head to the next line boundary.
*/
declare const selectLineBoundaryForward: Command;
/**
Move the selection head to the previous line boundary.
*/
declare const selectLineBoundaryBackward: Command;
/**
Move the selection head one line boundary to the left.
*/
declare const selectLineBoundaryLeft: Command;
/**
Move the selection head one line boundary to the right.
*/
declare const selectLineBoundaryRight: Command;
/**
Move the selection head to the start of the line.
*/
declare const selectLineStart: Command;
/**
Move the selection head to the end of the line.
*/
declare const selectLineEnd: Command;
/**
Move the selection to the start of the document.
*/
declare const cursorDocStart: StateCommand;
/**
Move the selection to the end of the document.
*/
declare const cursorDocEnd: StateCommand;
/**
Move the selection head to the start of the document.
*/
declare const selectDocStart: StateCommand;
/**
Move the selection head to the end of the document.
*/
declare const selectDocEnd: StateCommand;
/**
Select the entire document.
*/
declare const selectAll: StateCommand;
/**
Expand the selection to cover entire lines.
*/
declare const selectLine: StateCommand;
/**
Select the next syntactic construct that is larger than the
selection. Note that this will only work insofar as the language
[provider](https://codemirror.net/6/docs/ref/#language.language) you use builds up a full
syntax tree.
*/
declare const selectParentSyntax: StateCommand;
/**
Expand the selection by adding a cursor above the heads of
currently selected ranges.
*/
declare const addCursorAbove: Command;
/**
Expand the selection by adding a cursor below the heads of
currently selected ranges.
*/
declare const addCursorBelow: Command;
/**
Simplify the current selection. When multiple ranges are selected,
reduce it to its main range. Otherwise, if the selection is
non-empty, convert it to a cursor selection.
*/
declare const simplifySelection: StateCommand;
/**
Delete the selection, or, for cursor selections, the character or
indentation unit before the cursor.
*/
declare const deleteCharBackward: Command;
/**
Delete the selection or the character before the cursor. Does not
implement any extended behavior like deleting whole indentation
units in one go.
*/
declare const deleteCharBackwardStrict: Command;
/**
Delete the selection or the character after the cursor.
*/
declare const deleteCharForward: Command;
/**
Delete the selection or backward until the end of the next
[group](https://codemirror.net/6/docs/ref/#view.EditorView.moveByGroup), only skipping groups of
whitespace when they consist of a single space.
*/
declare const deleteGroupBackward: StateCommand;
/**
Delete the selection or forward until the end of the next group.
*/
declare const deleteGroupForward: StateCommand;
/**
Variant of [`deleteGroupForward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupForward)
that uses the Windows convention of also deleting the whitespace
after a word.
*/
declare const deleteGroupForwardWin: Command;
/**
Delete the selection, or, if it is a cursor selection, delete to
the end of the line. If the cursor is directly at the end of the
line, delete the line break after it.
*/
declare const deleteToLineEnd: Command;
/**
Delete the selection, or, if it is a cursor selection, delete to
the start of the line. If the cursor is directly at the start of the
line, delete the line break before it.
*/
declare const deleteToLineStart: Command;
/**
Delete the selection, or, if it is a cursor selection, delete to
the start of the line or the next line wrap before the cursor.
*/
declare const deleteLineBoundaryBackward: Command;
/**
Delete the selection, or, if it is a cursor selection, delete to
the end of the line or the next line wrap after the cursor.
*/
declare const deleteLineBoundaryForward: Command;
/**
Delete all whitespace directly before a line end from the
document.
*/
declare const deleteTrailingWhitespace: StateCommand;
/**
Replace each selection range with a line break, leaving the cursor
on the line before the break.
*/
declare const splitLine: StateCommand;
/**
Flip the characters before and after the cursor(s).
*/
declare const transposeChars: StateCommand;
/**
Move the selected lines up one line.
*/
declare const moveLineUp: StateCommand;
/**
Move the selected lines down one line.
*/
declare const moveLineDown: StateCommand;
/**
Create a copy of the selected lines. Keep the selection in the top copy.
*/
declare const copyLineUp: StateCommand;
/**
Create a copy of the selected lines. Keep the selection in the bottom copy.
*/
declare const copyLineDown: StateCommand;
/**
Delete selected lines.
*/
declare const deleteLine: Command;
/**
Replace the selection with a newline.
*/
declare const insertNewline: StateCommand;
/**
Replace the selection with a newline and the same amount of
indentation as the line above.
*/
declare const insertNewlineKeepIndent: StateCommand;
/**
Replace the selection with a newline and indent the newly created
line(s). If the current line consists only of whitespace, this
will also delete that whitespace. When the cursor is between
matching brackets, an additional newline will be inserted after
the cursor.
*/
declare const insertNewlineAndIndent: StateCommand;
/**
Create a blank, indented line below the current line.
*/
declare const insertBlankLine: StateCommand;
/**
Auto-indent the selected lines. This uses the [indentation service
facet](https://codemirror.net/6/docs/ref/#language.indentService) as source for auto-indent
information.
*/
declare const indentSelection: StateCommand;
/**
Add a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation to all selected
lines.
*/
declare const indentMore: StateCommand;
/**
Remove a [unit](https://codemirror.net/6/docs/ref/#language.indentUnit) of indentation from all
selected lines.
*/
declare const indentLess: StateCommand;
/**
Enables or disables
[tab-focus mode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode). While on, this
prevents the editor's key bindings from capturing Tab or
Shift-Tab, making it possible for the user to move focus out of
the editor with the keyboard.
*/
declare const toggleTabFocusMode: Command;
/**
Temporarily enables [tab-focus
mode](https://codemirror.net/6/docs/ref/#view.EditorView.setTabFocusMode) for two seconds or until
another key is pressed.
*/
declare const temporarilySetTabFocusMode: Command;
/**
Insert a tab character at the cursor or, if something is selected,
use [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) to indent the entire
selection.
*/
declare const insertTab: StateCommand;
/**
Array of key bindings containing the Emacs-style bindings that are
available on macOS by default.
- Ctrl-b: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)
- Ctrl-f: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)
- Ctrl-p: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)
- Ctrl-n: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)
- Ctrl-a: [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)
- Ctrl-e: [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)
- Ctrl-d: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)
- Ctrl-h: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)
- Ctrl-k: [`deleteToLineEnd`](https://codemirror.net/6/docs/ref/#commands.deleteToLineEnd)
- Ctrl-Alt-h: [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)
- Ctrl-o: [`splitLine`](https://codemirror.net/6/docs/ref/#commands.splitLine)
- Ctrl-t: [`transposeChars`](https://codemirror.net/6/docs/ref/#commands.transposeChars)
- Ctrl-v: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown)
- Alt-v: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp)
*/
declare const emacsStyleKeymap: readonly KeyBinding[];
/**
An array of key bindings closely sticking to platform-standard or
widely used bindings. (This includes the bindings from
[`emacsStyleKeymap`](https://codemirror.net/6/docs/ref/#commands.emacsStyleKeymap), with their `key`
property changed to `mac`.)
- ArrowLeft: [`cursorCharLeft`](https://codemirror.net/6/docs/ref/#commands.cursorCharLeft) ([`selectCharLeft`](https://codemirror.net/6/docs/ref/#commands.selectCharLeft) with Shift)
- ArrowRight: [`cursorCharRight`](https://codemirror.net/6/docs/ref/#commands.cursorCharRight) ([`selectCharRight`](https://codemirror.net/6/docs/ref/#commands.selectCharRight) with Shift)
- Ctrl-ArrowLeft (Alt-ArrowLeft on macOS): [`cursorGroupLeft`](https://codemirror.net/6/docs/ref/#commands.cursorGroupLeft) ([`selectGroupLeft`](https://codemirror.net/6/docs/ref/#commands.selectGroupLeft) with Shift)
- Ctrl-ArrowRight (Alt-ArrowRight on macOS): [`cursorGroupRight`](https://codemirror.net/6/docs/ref/#commands.cursorGroupRight) ([`selectGroupRight`](https://codemirror.net/6/docs/ref/#commands.selectGroupRight) with Shift)
- Cmd-ArrowLeft (on macOS): [`cursorLineStart`](https://codemirror.net/6/docs/ref/#commands.cursorLineStart) ([`selectLineStart`](https://codemirror.net/6/docs/ref/#commands.selectLineStart) with Shift)
- Cmd-ArrowRight (on macOS): [`cursorLineEnd`](https://codemirror.net/6/docs/ref/#commands.cursorLineEnd) ([`selectLineEnd`](https://codemirror.net/6/docs/ref/#commands.selectLineEnd) with Shift)
- ArrowUp: [`cursorLineUp`](https://codemirror.net/6/docs/ref/#commands.cursorLineUp) ([`selectLineUp`](https://codemirror.net/6/docs/ref/#commands.selectLineUp) with Shift)
- ArrowDown: [`cursorLineDown`](https://codemirror.net/6/docs/ref/#commands.cursorLineDown) ([`selectLineDown`](https://codemirror.net/6/docs/ref/#commands.selectLineDown) with Shift)
- Cmd-ArrowUp (on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)
- Cmd-ArrowDown (on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)
- Ctrl-ArrowUp (on macOS): [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)
- Ctrl-ArrowDown (on macOS): [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)
- PageUp: [`cursorPageUp`](https://codemirror.net/6/docs/ref/#commands.cursorPageUp) ([`selectPageUp`](https://codemirror.net/6/docs/ref/#commands.selectPageUp) with Shift)
- PageDown: [`cursorPageDown`](https://codemirror.net/6/docs/ref/#commands.cursorPageDown) ([`selectPageDown`](https://codemirror.net/6/docs/ref/#commands.selectPageDown) with Shift)
- Home: [`cursorLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryBackward) ([`selectLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryBackward) with Shift)
- End: [`cursorLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryForward) ([`selectLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryForward) with Shift)
- Ctrl-Home (Cmd-Home on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)
- Ctrl-End (Cmd-Home on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)
- Enter and Shift-Enter: [`insertNewlineAndIndent`](https://codemirror.net/6/docs/ref/#commands.insertNewlineAndIndent)
- Ctrl-a (Cmd-a on macOS): [`selectAll`](https://codemirror.net/6/docs/ref/#commands.selectAll)
- Backspace: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)
- Delete: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)
- Ctrl-Backspace (Alt-Backspace on macOS): [`deleteGroupBackward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupBackward)
- Ctrl-Delete (Alt-Delete on macOS): [`deleteGroupForward`](https://codemirror.net/6/docs/ref/#commands.deleteGroupForward)
- Cmd-Backspace (macOS): [`deleteLineBoundaryBackward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryBackward).
- Cmd-Delete (macOS): [`deleteLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.deleteLineBoundaryForward).
*/
declare const standardKeymap: readonly KeyBinding[];
/**
The default keymap. Includes all bindings from
[`standardKeymap`](https://codemirror.net/6/docs/ref/#commands.standardKeymap) plus the following:
- Alt-ArrowLeft (Ctrl-ArrowLeft on macOS): [`cursorSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxLeft) ([`selectSyntaxLeft`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxLeft) with Shift)
- Alt-ArrowRight (Ctrl-ArrowRight on macOS): [`cursorSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.cursorSyntaxRight) ([`selectSyntaxRight`](https://codemirror.net/6/docs/ref/#commands.selectSyntaxRight) with Shift)
- Alt-ArrowUp: [`moveLineUp`](https://codemirror.net/6/docs/ref/#commands.moveLineUp)
- Alt-ArrowDown: [`moveLineDown`](https://codemirror.net/6/docs/ref/#commands.moveLineDown)
- Shift-Alt-ArrowUp: [`copyLineUp`](https://codemirror.net/6/docs/ref/#commands.copyLineUp)
- Shift-Alt-ArrowDown: [`copyLineDown`](https://codemirror.net/6/docs/ref/#commands.copyLineDown)
- Ctrl-Alt-ArrowUp (Cmd-Alt-ArrowUp on macOS): [`addCursorAbove`](https://codemirror.net/6/docs/ref/#commands.addCursorAbove).
- Ctrl-Alt-ArrowDown (Cmd-Alt-ArrowDown on macOS): [`addCursorBelow`](https://codemirror.net/6/docs/ref/#commands.addCursorBelow).
- Escape: [`simplifySelection`](https://codemirror.net/6/docs/ref/#commands.simplifySelection)
- Ctrl-Enter (Cmd-Enter on macOS): [`insertBlankLine`](https://codemirror.net/6/docs/ref/#commands.insertBlankLine)
- Alt-l (Ctrl-l on macOS): [`selectLine`](https://codemirror.net/6/docs/ref/#commands.selectLine)
- Ctrl-i (Cmd-i on macOS): [`selectParentSyntax`](https://codemirror.net/6/docs/ref/#commands.selectParentSyntax)
- Ctrl-[ (Cmd-[ on macOS): [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess)
- Ctrl-] (Cmd-] on macOS): [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore)
- Ctrl-Alt-\\ (Cmd-Alt-\\ on macOS): [`indentSelection`](https://codemirror.net/6/docs/ref/#commands.indentSelection)
- Shift-Ctrl-k (Shift-Cmd-k on macOS): [`deleteLine`](https://codemirror.net/6/docs/ref/#commands.deleteLine)
- Shift-Ctrl-\\ (Shift-Cmd-\\ on macOS): [`cursorMatchingBracket`](https://codemirror.net/6/docs/ref/#commands.cursorMatchingBracket)
- Ctrl-/ (Cmd-/ on macOS): [`toggleComment`](https://codemirror.net/6/docs/ref/#commands.toggleComment).
- Shift-Alt-a: [`toggleBlockComment`](https://codemirror.net/6/docs/ref/#commands.toggleBlockComment).
- Ctrl-m (Alt-Shift-m on macOS): [`toggleTabFocusMode`](https://codemirror.net/6/docs/ref/#commands.toggleTabFocusMode).
*/
declare const defaultKeymap: readonly KeyBinding[];
/**
A binding that binds Tab to [`indentMore`](https://codemirror.net/6/docs/ref/#commands.indentMore) and
Shift-Tab to [`indentLess`](https://codemirror.net/6/docs/ref/#commands.indentLess).
Please see the [Tab example](../../examples/tab/) before using
this.
*/
declare const indentWithTab: KeyBinding;
export { type CommentTokens, addCursorAbove, addCursorBelow, blockComment, blockUncomment, copyLineDown, copyLineUp, cursorCharBackward, cursorCharBackwardLogical, cursorCharForward, cursorCharForwardLogical, cursorCharLeft, cursorCharRight, cursorDocEnd, cursorDocStart, cursorGroupBackward, cursorGroupForward, cursorGroupForwardWin, cursorGroupLeft, cursorGroupRight, cursorLineBoundaryBackward, cursorLineBoundaryForward, cursorLineBoundaryLeft, cursorLineBoundaryRight, cursorLineDown, cursorLineEnd, cursorLineStart, cursorLineUp, cursorMatchingBracket, cursorPageDown, cursorPageUp, cursorSubwordBackward, cursorSubwordForward, cursorSyntaxLeft, cursorSyntaxRight, defaultKeymap, deleteCharBackward, deleteCharBackwardStrict, deleteCharForward, deleteGroupBackward, deleteGroupForward, deleteGroupForwardWin, deleteLine, deleteLineBoundaryBackward, deleteLineBoundaryForward, deleteToLineEnd, deleteToLineStart, deleteTrailingWhitespace, emacsStyleKeymap, history, historyField, historyKeymap, indentLess, indentMore, indentSelection, indentWithTab, insertBlankLine, insertNewline, insertNewlineAndIndent, insertNewlineKeepIndent, insertTab, invertedEffects, isolateHistory, lineComment, lineUncomment, moveLineDown, moveLineUp, redo, redoDepth, redoSelection, selectAll, selectCharBackward, selectCharBackwardLogical, selectCharForward, selectCharForwardLogical, selectCharLeft, selectCharRight, selectDocEnd, selectDocStart, selectGroupBackward, selectGroupForward, selectGroupForwardWin, selectGroupLeft, selectGroupRight, selectLine, selectLineBoundaryBackward, selectLineBoundaryForward, selectLineBoundaryLeft, selectLineBoundaryRight, selectLineDown, selectLineEnd, selectLineStart, selectLineUp, selectMatchingBracket, selectPageDown, selectPageUp, selectParentSyntax, selectSubwordBackward, selectSubwordForward, selectSyntaxLeft, selectSyntaxRight, simplifySelection, splitLine, standardKeymap, temporarilySetTabFocusMode, toggleBlockComment, toggleBlockCommentByLine, toggleComment, toggleLineComment, toggleTabFocusMode, transposeChars, undo, undoDepth, undoSelection };
@@ -0,0 +1,9 @@
import { Scalar } from '../nodes/Scalar';
import type { StringifyContext } from './stringify';
interface StringifyScalar {
value: string;
comment?: string | null;
type?: string;
}
export declare function stringifyString(item: Scalar | StringifyScalar, ctx: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
export {};
@@ -0,0 +1,52 @@
{
"name": "esrecurse",
"description": "ECMAScript AST recursive visitor",
"homepage": "https://github.com/estools/esrecurse",
"main": "esrecurse.js",
"version": "4.3.0",
"engines": {
"node": ">=4.0"
},
"maintainers": [
{
"name": "Yusuke Suzuki",
"email": "utatane.tea@gmail.com",
"web": "https://github.com/Constellation"
}
],
"repository": {
"type": "git",
"url": "https://github.com/estools/esrecurse.git"
},
"dependencies": {
"estraverse": "^5.2.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",
"chai": "^4.0.2",
"esprima": "^4.0.0",
"gulp": "^3.9.0",
"gulp-bump": "^2.7.0",
"gulp-eslint": "^4.0.0",
"gulp-filter": "^5.0.0",
"gulp-git": "^2.4.1",
"gulp-mocha": "^4.3.1",
"gulp-tag-version": "^1.2.1",
"jsdoc": "^3.3.0-alpha10",
"minimist": "^1.1.0"
},
"license": "BSD-2-Clause",
"scripts": {
"test": "gulp travis",
"unit-test": "gulp test",
"lint": "gulp lint"
},
"babel": {
"presets": [
"es2015"
]
}
}
@@ -0,0 +1,43 @@
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "gridIds", () => $6acf696f746f932c$export$552312adfd451dab);
$parcel$export(module.exports, "getColumnHeaderId", () => $6acf696f746f932c$export$37cd4213f2ad742e);
$parcel$export(module.exports, "getCellId", () => $6acf696f746f932c$export$19baff3266315d44);
$parcel$export(module.exports, "getRowLabelledBy", () => $6acf696f746f932c$export$85069b70317f543);
/*
* 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 $6acf696f746f932c$export$552312adfd451dab = new WeakMap();
function $6acf696f746f932c$var$normalizeKey(key) {
if (typeof key === 'string') return key.replace(/\s*/g, '');
return '' + key;
}
function $6acf696f746f932c$export$37cd4213f2ad742e(state, columnKey) {
let gridId = $6acf696f746f932c$export$552312adfd451dab.get(state);
if (!gridId) throw new Error('Unknown grid');
return `${gridId}-${$6acf696f746f932c$var$normalizeKey(columnKey)}`;
}
function $6acf696f746f932c$export$19baff3266315d44(state, rowKey, columnKey) {
let gridId = $6acf696f746f932c$export$552312adfd451dab.get(state);
if (!gridId) throw new Error('Unknown grid');
return `${gridId}-${$6acf696f746f932c$var$normalizeKey(rowKey)}-${$6acf696f746f932c$var$normalizeKey(columnKey)}`;
}
function $6acf696f746f932c$export$85069b70317f543(state, rowKey) {
// A row is labelled by it's row headers.
return [
...state.collection.rowHeaderColumnKeys
].map((columnKey)=>$6acf696f746f932c$export$19baff3266315d44(state, rowKey, columnKey)).join(' ');
}
//# sourceMappingURL=utils.main.js.map
@@ -0,0 +1,11 @@
import { promise as queueAsPromised } from './queue.js'
/* eslint-disable */
const queue = queueAsPromised(worker, 1)
console.log('the result is', await queue.push(42))
async function worker (arg) {
return 42 * 2
}
@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = parseCFFEncoding;
/**
* @file 解析cff编码
* @author mengke01(kekee000@gmail.com)
*/
/**
* 解析cff encoding数据
* See Adobe TN #5176 chapter 12, "Encodings".
*
* @param {Reader} reader 读取器
* @param {number=} start 偏移
* @return {Object} 编码表
*/
function parseCFFEncoding(reader, start) {
if (null != start) {
reader.seek(start);
}
var i;
var code;
var encoding = {};
var format = reader.readUint8();
if (format === 0) {
var nCodes = reader.readUint8();
for (i = 0; i < nCodes; i += 1) {
code = reader.readUint8();
encoding[code] = i;
}
} else if (format === 1) {
var nRanges = reader.readUint8();
code = 1;
for (i = 0; i < nRanges; i += 1) {
var first = reader.readUint8();
var nLeft = reader.readUint8();
for (var j = first; j <= first + nLeft; j += 1) {
encoding[j] = code;
code += 1;
}
}
} else {
console.warn('unknown encoding format:' + format);
}
return encoding;
}
@@ -0,0 +1,36 @@
"use strict"
const {
definePrototypeMethodHandler,
} = require("../util/define-prototype-method-handler")
module.exports = {
meta: {
docs: {
description: "disallow the `Set.prototype.isSubsetOf` method.",
category: "ES2025",
proposal: "set-methods",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-set-prototype-issubsetof.html",
},
fixable: null,
messages: {
forbidden: "ES2025 '{{name}}' method is forbidden.",
},
schema: [
{
type: "object",
properties: {
aggressive: { type: "boolean" },
},
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
return definePrototypeMethodHandler(context, {
Set: ["isSubsetOf"],
})
},
}
@@ -0,0 +1 @@
{"name":"compressible","version":"2.0.18","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532103268,"integrity":"sha512-iwWNtxw0wslfJ9F2n8JXm5zpCbwR7Gu+rFrXsuO44MbiUu1TZov30H2eWdbt7+mvwcEp0nSR1CyUCYsPUbI+WQ==","mode":420,"size":1233},"index.js":{"checkedAt":1794532103268,"integrity":"sha512-1/M/lsoE88CWoC2i0B8H/0/1OqcNqutPKkOZ6r4VRFXLD8XkfgiBjWTaySq6DxOPG3ta5xiVfdPZmn2/2wXidg==","mode":420,"size":1038},"package.json":{"checkedAt":1794532103269,"integrity":"sha512-Wk1cB0QJbo7jJUs0U25uFc/2lqJNNbLaXrcPDQ+S9gxPpNcOZYDnHqLtJ0Ep2893chz2MdxN1mArJloAXbTERw==","mode":420,"size":1311},"HISTORY.md":{"checkedAt":1794532103269,"integrity":"sha512-HjgVdL/NlSwDhkut3BCwnal4ahlNd2eLzPCGPARs0Wy+rjHtAJNL7/s426/dIwbg7NI5wnkxuhLImjx+ULgavg==","mode":420,"size":1976},"README.md":{"checkedAt":1794532103269,"integrity":"sha512-GahpusTGRt2M/0s2vsEMBfDm0bBXMVlnhBVY+xoDcfBKn4rGbeW9PGQWZ7LM1adQWm8Q3WizIF1D1jwI97IS7w==","mode":420,"size":1797}}}
@@ -0,0 +1,142 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "字符", verb: "包含" },
file: { unit: "字节", verb: "包含" },
array: { unit: "项", verb: "包含" },
set: { unit: "项", verb: "包含" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "非数字(NaN)" : "数字";
}
case "object": {
if (Array.isArray(data)) {
return "数组";
}
if (data === null) {
return "空值(null)";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "输入",
email: "电子邮件",
url: "URL",
emoji: "表情符号",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO日期时间",
date: "ISO日期",
time: "ISO时间",
duration: "ISO时长",
ipv4: "IPv4地址",
ipv6: "IPv6地址",
cidrv4: "IPv4网段",
cidrv6: "IPv6网段",
base64: "base64编码字符串",
base64url: "base64url编码字符串",
json_string: "JSON字符串",
e164: "E.164号码",
jwt: "JWT",
template_literal: "输入",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `无效输入:期望 ${issue.expected},实际接收 ${parsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1)
return `无效输入:期望 ${util.stringifyPrimitive(issue.values[0])}`;
return `无效选项:期望以下之一 ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "个元素"}`;
return `数值过大:期望 ${issue.origin ?? "值"} ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `数值过小:期望 ${issue.origin} ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `无效字符串:必须以 "${_issue.prefix}" 开头`;
if (_issue.format === "ends_with")
return `无效字符串:必须以 "${_issue.suffix}" 结尾`;
if (_issue.format === "includes")
return `无效字符串:必须包含 "${_issue.includes}"`;
if (_issue.format === "regex")
return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;
return `无效${Nouns[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `无效数字:必须是 ${issue.divisor} 的倍数`;
case "unrecognized_keys":
return `出现未知的键(key): ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `${issue.origin} 中的键(key)无效`;
case "invalid_union":
return "无效输入";
case "invalid_element":
return `${issue.origin} 中包含无效值(value)`;
default:
return `无效输入`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
@@ -0,0 +1,25 @@
"use strict"
const { READ } = require("@eslint-community/eslint-utils")
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
const dgram = {
createSocket: { [READ]: { supported: ["0.1.99"] } },
Socket: { [READ]: { supported: ["0.1.99"] } },
}
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
module.exports = {
dgram: {
[READ]: { supported: ["0.1.99"] },
...dgram,
},
"node:dgram": {
[READ]: { supported: ["14.13.1", "12.20.0"] },
...dgram,
},
}
@@ -0,0 +1,21 @@
'use strict';
var define = require('define-properties');
var getPolyfill = require('./polyfill');
module.exports = function shimGetPrototypeOf() {
define(
global,
{ Reflect: {} },
{ Reflect: function () { return typeof Reflect !== 'object' || !Reflect; } }
);
var polyfill = getPolyfill();
define(
Reflect,
{ getPrototypeOf: polyfill },
{ getPrototypeOf: function () { return Reflect.getPrototypeOf !== polyfill; } }
);
return polyfill;
};
@@ -0,0 +1,5 @@
'use strict';
// https://262.ecma-international.org/6.0/#sec-algorithm-conventions
module.exports = require('math-intrinsics/min');
@@ -0,0 +1,18 @@
'use strict';
var test = require('tape');
var forEach = require('for-each');
var shims = require('../');
forEach(shims, function (shim) {
var shimTests;
try {
shimTests = require('./' + shim); // eslint-disable-line global-require
} catch (e) {
test(shim + ': implementation', { todo: true });
}
if (shimTests) {
shimTests.implementation();
}
});
@@ -0,0 +1 @@
{"mappings":"AAcA,mCAAmC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;AAChN,mCAAmC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;ACHhN;;GAEG;AACH,sBAAsB,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,MAAkB,EAAE,GAAG,GAAE,MAAiB,GAAG,MAAM,CAG5F;AAuBD,gCAAgC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAsBrH;AAGD,8BAA8B,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAAW,GAAG,MAAM,CAItF","sources":["packages/@react-stately/utils/src/packages/@react-stately/utils/src/useControlledState.ts","packages/@react-stately/utils/src/packages/@react-stately/utils/src/number.ts","packages/@react-stately/utils/src/packages/@react-stately/utils/src/index.ts","packages/@react-stately/utils/src/index.ts"],"sourcesContent":[null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useControlledState} from './useControlledState';\nexport {clamp, snapValueToStep, toFixedNumber} from './number';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -0,0 +1,157 @@
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*
* @deprecated since v4.2.0
* This rule was based on an invalid assumption.
* No meaning.
*/
"use strict"
const path = require("path")
const resolve = require("resolve")
const getPackageJson = require("../util/get-package-json")
const mergeVisitorsInPlace = require("../util/merge-visitors-in-place")
const visitImport = require("../util/visit-import")
const visitRequire = require("../util/visit-require")
const CORE_MODULES = new Set([
"assert",
"buffer",
"child_process",
"cluster",
"console",
"constants",
"crypto",
"dgram",
"dns",
/* "domain", */ "events",
"fs",
"http",
"https",
"module",
"net",
"os",
"path",
/* "punycode", */ "querystring",
"readline",
"repl",
"stream",
"string_decoder",
"timers",
"tls",
"tty",
"url",
"util",
"vm",
"zlib",
])
const BACK_SLASH = /\\/gu
module.exports = {
meta: {
docs: {
description:
"disallow third-party modules which are hiding core modules",
category: "Possible Errors",
recommended: false,
url:
"https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-hide-core-modules.md",
},
type: "problem",
deprecated: true,
fixable: null,
schema: [
{
type: "object",
properties: {
allow: {
type: "array",
items: { enum: Array.from(CORE_MODULES) },
additionalItems: false,
uniqueItems: true,
},
ignoreDirectDependencies: { type: "boolean" },
ignoreIndirectDependencies: { type: "boolean" },
},
additionalProperties: false,
},
],
},
create(context) {
if (context.getFilename() === "<input>") {
return {}
}
const filePath = path.resolve(context.getFilename())
const dirPath = path.dirname(filePath)
const packageJson = getPackageJson(filePath)
const deps = new Set(
[].concat(
Object.keys((packageJson && packageJson.dependencies) || {}),
Object.keys((packageJson && packageJson.devDependencies) || {})
)
)
const options = context.options[0] || {}
const allow = options.allow || []
const ignoreDirectDependencies = Boolean(
options.ignoreDirectDependencies
)
const ignoreIndirectDependencies = Boolean(
options.ignoreIndirectDependencies
)
const targets = []
return [
visitImport(context, { includeCore: true }, importTargets =>
targets.push(...importTargets)
),
visitRequire(context, { includeCore: true }, requireTargets =>
targets.push(...requireTargets)
),
{
"Program:exit"() {
for (const target of targets.filter(
t =>
CORE_MODULES.has(t.moduleName) &&
t.moduleName === t.name
)) {
const name = target.moduleName
const allowed =
allow.indexOf(name) !== -1 ||
(ignoreDirectDependencies && deps.has(name)) ||
(ignoreIndirectDependencies && !deps.has(name))
if (allowed) {
continue
}
let resolved = ""
try {
resolved = resolve.sync(`${name}/`, {
basedir: dirPath,
})
} catch (_error) {
continue
}
context.report({
node: target.node,
loc: target.node.loc,
message:
"Unexpected import of third-party module '{{name}}'.",
data: {
name: path
.relative(dirPath, resolved)
.replace(BACK_SLASH, "/"),
},
})
}
},
},
].reduce(
(mergedVisitor, thisVisitor) =>
mergeVisitorsInPlace(mergedVisitor, thisVisitor),
{}
)
},
}
@@ -0,0 +1,5 @@
import { LongType, ScalarType } from "./reflection-info";
/**
* Creates the default value for a scalar type.
*/
export declare function reflectionScalarDefault(type: ScalarType, longType?: LongType): string | number | bigint | boolean | Uint8Array;
@@ -0,0 +1,49 @@
{
"name": "@react-aria/checkbox",
"version": "3.16.2",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
"exports": {
"source": "./src/index.ts",
"types": [
"./dist/types.d.ts",
"./src/index.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/form": "^3.1.2",
"@react-aria/interactions": "^3.25.6",
"@react-aria/label": "^3.7.22",
"@react-aria/toggle": "^3.12.2",
"@react-aria/utils": "^3.31.0",
"@react-stately/checkbox": "^3.7.2",
"@react-stately/form": "^3.2.2",
"@react-stately/toggle": "^3.9.2",
"@react-types/checkbox": "^3.10.2",
"@react-types/shared": "^3.32.1",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
}
@@ -0,0 +1,50 @@
export type Id<T> = { [K in keyof T]: T[K] } & {}
export type WithRequiredProp<T, K extends keyof T> = Omit<T, K> &
Required<Pick<T, K>>
export type Override<T1, T2> = T2 extends any ? Omit<T1, keyof T2> & T2 : never
export function assertCast<T>(v: any): asserts v is T {}
export function safeAssign<T extends object>(
target: T,
...args: Array<Partial<NoInfer<T>>>
): T {
return Object.assign(target, ...args)
}
/**
* Convert a Union type `(A|B)` to an intersection type `(A&B)`
*/
export type UnionToIntersection<U> = (
U extends any ? (k: U) => void : never
) extends (k: infer I) => void
? I
: never
export type NonOptionalKeys<T> = {
[K in keyof T]-?: undefined extends T[K] ? never : K
}[keyof T]
export type HasRequiredProps<T, True, False> =
NonOptionalKeys<T> extends never ? False : True
export type OptionalIfAllPropsOptional<T> = HasRequiredProps<T, T, T | never>
export type NoInfer<T> = [T][T extends any ? 0 : never]
export type NonUndefined<T> = T extends undefined ? never : T
export type UnwrapPromise<T> = T extends PromiseLike<infer V> ? V : T
export type MaybePromise<T> = T | PromiseLike<T>
export type OmitFromUnion<T, K extends keyof T> = T extends any
? Omit<T, K>
: never
export type IsAny<T, True, False = never> = true | false extends (
T extends never ? true : false
)
? True
: False
export type CastAny<T, CastTo> = IsAny<T, CastTo, T>
@@ -0,0 +1,33 @@
var OverloadYield = require("./OverloadYield.js");
var regeneratorDefine = require("./regeneratorDefine.js");
function AsyncIterator(t, e) {
function n(r, o, i, f) {
try {
var c = t[r](o),
u = c.value;
return u instanceof OverloadYield ? e.resolve(u.v).then(function (t) {
n("next", t, i, f);
}, function (t) {
n("throw", t, i, f);
}) : e.resolve(u).then(function (t) {
c.value = t, i(c);
}, function (t) {
return n("throw", t, i, f);
});
} catch (t) {
f(t);
}
}
var r;
this.next || (regeneratorDefine(AsyncIterator.prototype), regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
return this;
})), regeneratorDefine(this, "_invoke", function (t, o, i) {
function f() {
return new e(function (e, r) {
n(t, i, e, r);
});
}
return r = r ? r.then(f, f) : f();
}, !0);
}
module.exports = AsyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports;
@@ -0,0 +1,6 @@
{
"version": 3,
"sources": ["../src/sourcemap-codec.ts", "../src/vlq.ts", "../src/strings.ts", "../src/scopes.ts"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,QAAQ,IAAI,WAAW,CAAC;AAC9B,IAAM,YAAY,IAAI,WAAW,CAAC;AAEzC,IAAM,QAAQ;AACd,IAAM,YAAY,IAAI,WAAW,EAAE;AACnC,IAAM,YAAY,IAAI,WAAW,GAAG;AAEpC,SAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,QAAM,IAAI,MAAM,WAAW,CAAC;AAC5B,YAAU,CAAC,IAAI;AACf,YAAU,CAAC,IAAI;AACjB;AAEO,SAAS,cAAc,QAAsB,UAA0B;AAC5E,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,MAAI,UAAU;AAEd,KAAG;AACD,UAAM,IAAI,OAAO,KAAK;AACtB,cAAU,UAAU,CAAC;AACrB,cAAU,UAAU,OAAO;AAC3B,aAAS;AAAA,EACX,SAAS,UAAU;AAEnB,QAAM,eAAe,QAAQ;AAC7B,aAAW;AAEX,MAAI,cAAc;AAChB,YAAQ,cAAc,CAAC;AAAA,EACzB;AAEA,SAAO,WAAW;AACpB;AAEO,SAAS,cAAc,SAAuB,KAAa,UAA0B;AAC1F,MAAI,QAAQ,MAAM;AAElB,UAAQ,QAAQ,IAAK,CAAC,SAAS,IAAK,IAAI,SAAS;AACjD,KAAG;AACD,QAAI,UAAU,QAAQ;AACtB,eAAW;AACX,QAAI,QAAQ,EAAG,YAAW;AAC1B,YAAQ,MAAM,UAAU,OAAO,CAAC;AAAA,EAClC,SAAS,QAAQ;AAEjB,SAAO;AACT;AAEO,SAAS,WAAW,QAAsB,KAAa;AAC5D,MAAI,OAAO,OAAO,IAAK,QAAO;AAC9B,SAAO,OAAO,KAAK,MAAM;AAC3B;;;ACtDA,IAAM,YAAY,OAAO;AAGzB,IAAM,KACJ,OAAO,gBAAgB,cACH,oBAAI,YAAY,IAChC,OAAO,WAAW,cAChB;AAAA,EACE,OAAO,KAAyB;AAC9B,UAAM,MAAM,OAAO,KAAK,IAAI,QAAQ,IAAI,YAAY,IAAI,UAAU;AAClE,WAAO,IAAI,SAAS;AAAA,EACtB;AACF,IACA;AAAA,EACE,OAAO,KAAyB;AAC9B,QAAI,MAAM;AACV,aAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,aAAO,OAAO,aAAa,IAAI,CAAC,CAAC;AAAA,IACnC;AACA,WAAO;AAAA,EACT;AACF;AAED,IAAM,eAAN,MAAmB;AAAA,EAAnB;AACL,eAAM;AACN,SAAQ,MAAM;AACd,SAAQ,SAAS,IAAI,WAAW,SAAS;AAAA;AAAA,EAEzC,MAAM,GAAiB;AACrB,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,KAAK,KAAK,IAAI;AACrB,QAAI,KAAK,QAAQ,WAAW;AAC1B,WAAK,OAAO,GAAG,OAAO,MAAM;AAC5B,WAAK,MAAM;AAAA,IACb;AAAA,EACF;AAAA,EAEA,QAAgB;AACd,UAAM,EAAE,QAAQ,KAAK,IAAI,IAAI;AAC7B,WAAO,MAAM,IAAI,MAAM,GAAG,OAAO,OAAO,SAAS,GAAG,GAAG,CAAC,IAAI;AAAA,EAC9D;AACF;AAEO,IAAM,eAAN,MAAmB;AAAA,EAIxB,YAAY,QAAgB;AAH5B,eAAM;AAIJ,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAe;AACb,WAAO,KAAK,OAAO,WAAW,KAAK,KAAK;AAAA,EAC1C;AAAA,EAEA,OAAe;AACb,WAAO,KAAK,OAAO,WAAW,KAAK,GAAG;AAAA,EACxC;AAAA,EAEA,QAAQ,MAAsB;AAC5B,UAAM,EAAE,QAAQ,IAAI,IAAI;AACxB,UAAM,MAAM,OAAO,QAAQ,MAAM,GAAG;AACpC,WAAO,QAAQ,KAAK,OAAO,SAAS;AAAA,EACtC;AACF;;;AC7DA,IAAM,QAAe,CAAC;AA+Bf,SAAS,qBAAqB,OAAgC;AACnE,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,SAAS,IAAI,aAAa,KAAK;AACrC,QAAM,SAA0B,CAAC;AACjC,QAAM,QAAyB,CAAC;AAChC,MAAI,OAAO;AAEX,SAAO,OAAO,MAAM,QAAQ,OAAO,OAAO;AACxC,WAAO,cAAc,QAAQ,IAAI;AACjC,UAAM,SAAS,cAAc,QAAQ,CAAC;AAEtC,QAAI,CAAC,WAAW,QAAQ,MAAM,GAAG;AAC/B,YAAM,OAAO,MAAM,IAAI;AACvB,WAAK,CAAC,IAAI;AACV,WAAK,CAAC,IAAI;AACV;AAAA,IACF;AAEA,UAAM,OAAO,cAAc,QAAQ,CAAC;AACpC,UAAM,SAAS,cAAc,QAAQ,CAAC;AACtC,UAAM,UAAU,SAAS;AAEzB,UAAM,QACJ,UAAU,CAAC,MAAM,QAAQ,GAAG,GAAG,MAAM,cAAc,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,QAAQ,GAAG,GAAG,IAAI;AAG5F,QAAI,OAAc;AAClB,QAAI,WAAW,QAAQ,MAAM,GAAG;AAC9B,aAAO,CAAC;AACR,SAAG;AACD,cAAM,YAAY,cAAc,QAAQ,CAAC;AACzC,aAAK,KAAK,SAAS;AAAA,MACrB,SAAS,WAAW,QAAQ,MAAM;AAAA,IACpC;AACA,UAAM,OAAO;AAEb,WAAO,KAAK,KAAK;AACjB,UAAM,KAAK,KAAK;AAAA,EAClB;AAEA,SAAO;AACT;AAEO,SAAS,qBAAqB,QAAiC;AACpE,QAAM,SAAS,IAAI,aAAa;AAEhC,WAAS,IAAI,GAAG,IAAI,OAAO,UAAU;AACnC,QAAI,sBAAsB,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;AAAA,EAClD;AAEA,SAAO,OAAO,MAAM;AACtB;AAEA,SAAS,sBACP,QACA,OACA,QACA,OAGQ;AACR,QAAM,QAAQ,OAAO,KAAK;AAC1B,QAAM,EAAE,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,KAAK,IAAI;AAElF,MAAI,QAAQ,EAAG,QAAO,MAAM,KAAK;AAEjC,QAAM,CAAC,IAAI,cAAc,QAAQ,WAAW,MAAM,CAAC,CAAC;AACpD,gBAAc,QAAQ,aAAa,CAAC;AACpC,gBAAc,QAAQ,MAAM,CAAC;AAE7B,QAAM,SAAS,MAAM,WAAW,IAAI,IAAS;AAC7C,gBAAc,QAAQ,QAAQ,CAAC;AAC/B,MAAI,MAAM,WAAW,EAAG,eAAc,QAAQ,MAAM,CAAC,GAAG,CAAC;AAEzD,aAAW,KAAK,MAAM;AACpB,kBAAc,QAAQ,GAAG,CAAC;AAAA,EAC5B;AAEA,OAAK,SAAS,QAAQ,OAAO,UAAU;AACrC,UAAM,OAAO,OAAO,KAAK;AACzB,UAAM,EAAE,GAAG,GAAG,GAAG,EAAE,IAAI;AACvB,QAAI,IAAI,WAAY,MAAM,WAAW,KAAK,WAAY;AACpD;AAAA,IACF;AACA,YAAQ,sBAAsB,QAAQ,OAAO,QAAQ,KAAK;AAAA,EAC5D;AAEA,SAAO,MAAM,KAAK;AAClB,QAAM,CAAC,IAAI,cAAc,QAAQ,SAAS,MAAM,CAAC,CAAC;AAClD,gBAAc,QAAQ,WAAW,CAAC;AAElC,SAAO;AACT;AAEO,SAAS,sBAAsB,OAAiC;AACrE,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,SAAS,IAAI,aAAa,KAAK;AACrC,QAAM,SAA2B,CAAC;AAClC,QAAM,QAA0B,CAAC;AAEjC,MAAI,UAAU;AACd,MAAI,yBAAyB;AAC7B,MAAI,uBAAuB;AAC3B,MAAI,uBAAuB;AAC3B,MAAI,eAAe;AACnB,MAAI,iBAAiB;AACrB,MAAI,cAAc;AAClB,MAAI,gBAAgB;AAEpB,KAAG;AACD,UAAM,OAAO,OAAO,QAAQ,GAAG;AAC/B,QAAI,YAAY;AAEhB,WAAO,OAAO,MAAM,MAAM,OAAO,OAAO;AACtC,kBAAY,cAAc,QAAQ,SAAS;AAE3C,UAAI,CAAC,WAAW,QAAQ,IAAI,GAAG;AAC7B,cAAM,OAAO,MAAM,IAAI;AACvB,aAAK,CAAC,IAAI;AACV,aAAK,CAAC,IAAI;AACV;AAAA,MACF;AAEA,YAAM,SAAS,cAAc,QAAQ,CAAC;AACtC,YAAM,gBAAgB,SAAS;AAC/B,YAAM,cAAc,SAAS;AAC7B,YAAM,WAAW,SAAS;AAE1B,UAAI,WAA4B;AAChC,UAAI,WAAsB;AAC1B,UAAI;AACJ,UAAI,eAAe;AACjB,cAAM,kBAAkB,cAAc,QAAQ,sBAAsB;AACpE,+BAAuB;AAAA,UACrB;AAAA,UACA,2BAA2B,kBAAkB,uBAAuB;AAAA,QACtE;AAEA,iCAAyB;AACzB,gBAAQ,CAAC,SAAS,WAAW,GAAG,GAAG,iBAAiB,oBAAoB;AAAA,MAC1E,OAAO;AACL,gBAAQ,CAAC,SAAS,WAAW,GAAG,CAAC;AAAA,MACnC;AAEA,YAAM,UAAU,CAAC,CAAC;AAElB,UAAI,aAAa;AACf,cAAM,UAAU;AAChB,cAAM,WAAW;AACjB,+BAAuB,cAAc,QAAQ,oBAAoB;AACjE,cAAM,aAAa,YAAY;AAC/B,uBAAe,cAAc,QAAQ,aAAa,eAAe,CAAC;AAClE,yBAAiB;AAAA,UACf;AAAA,UACA,cAAc,aAAa,eAAe,iBAAiB;AAAA,QAC7D;AAEA,mBAAW,CAAC,sBAAsB,cAAc,cAAc;AAAA,MAChE;AACA,YAAM,WAAW;AAEjB,UAAI,WAAW,QAAQ,IAAI,GAAGLine truncated
"names": []
}
@@ -0,0 +1,24 @@
# @heroui/slider
Slider allows a user to select one or more values within a range.
Please refer to the [documentation](https://heroui.com/docs/components/slider) for more information.
## Installation
```sh
yarn add @heroui/slider
# or
npm i @heroui/slider
```
## Contribution
Yes please! See the
[contributing guidelines](https://github.com/frontio-ai/heroui/blob/master/CONTRIBUTING.md)
for details.
## License
This project is licensed under the terms of the
[MIT license](https://github.com/frontio-ai/heroui/blob/master/LICENSE).
@@ -0,0 +1,8 @@
type Unscopableable = string & {
[K in keyof typeof Array.prototype]:
typeof Array.prototype[K] extends Function ? K : never
}[keyof typeof Array.prototype];
declare function shimUnscopables(method: Unscopableable): void;
export = shimUnscopables;
@@ -0,0 +1,4 @@
{
"main": "../../cjs/_async_to_generator.cjs",
"module": "../../esm/_async_to_generator.js"
}
@@ -0,0 +1,4 @@
import { Newable } from '@inversifyjs/common';
import { ClassElementMetadata } from '../models/ClassElementMetadata';
export declare function validateConstructorMetadataArray(type: Newable, value: (ClassElementMetadata | undefined)[]): asserts value is ClassElementMetadata[];
//# sourceMappingURL=validateConstructorMetadataArray.d.ts.map
@@ -0,0 +1 @@
export declare function parserSeemsToBeTSESLint(parser: string | undefined): boolean;
@@ -0,0 +1,299 @@
/*
* 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 {DOMAttributes, FocusableElement, Key, RefObject} from '@react-types/shared';
import {focusSafely, isFocusVisible} from '@react-aria/interactions';
import {getFocusableTreeWalker} from '@react-aria/focus';
import {getScrollParent, mergeProps, scrollIntoViewport} from '@react-aria/utils';
import {GridCollection, GridNode} from '@react-types/grid';
import {gridMap} from './utils';
import {GridState} from '@react-stately/grid';
import {KeyboardEvent as ReactKeyboardEvent, useRef} from 'react';
import {useLocale} from '@react-aria/i18n';
import {useSelectableItem} from '@react-aria/selection';
export interface GridCellProps {
/** An object representing the grid cell. Contains all the relevant information that makes up the grid cell. */
node: GridNode<unknown>,
/** Whether the grid cell is contained in a virtual scroller. */
isVirtualized?: boolean,
/** Whether the cell or its first focusable child element should be focused when the grid cell is focused. */
focusMode?: 'child' | 'cell',
/** Whether selection should occur on press up instead of press down. */
shouldSelectOnPressUp?: boolean,
/** Indicates how many columns the data cell spans. */
colSpan?: number,
/**
* Handler that is called when a user performs an action on the cell.
* Please use onCellAction at the collection level instead.
* @deprecated
**/
onAction?: () => void
}
export interface GridCellAria {
/** Props for the grid cell element. */
gridCellProps: DOMAttributes,
/** Whether the cell is currently in a pressed state. */
isPressed: boolean
}
/**
* Provides the behavior and accessibility implementation for a cell in a grid.
* @param props - Props for the cell.
* @param state - State of the parent grid, as returned by `useGridState`.
*/
export function useGridCell<T, C extends GridCollection<T>>(props: GridCellProps, state: GridState<T, C>, ref: RefObject<FocusableElement | null>): GridCellAria {
let {
node,
isVirtualized,
focusMode = 'child',
shouldSelectOnPressUp,
onAction
} = props;
let {direction} = useLocale();
let {keyboardDelegate, actions: {onCellAction}} = gridMap.get(state)!;
// We need to track the key of the item at the time it was last focused so that we force
// focus to go to the item when the DOM node is reused for a different item in a virtualizer.
let keyWhenFocused = useRef<Key | null>(null);
// Handles focusing the cell. If there is a focusable child,
// it is focused, otherwise the cell itself is focused.
let focus = () => {
if (ref.current) {
let treeWalker = getFocusableTreeWalker(ref.current);
if (focusMode === 'child') {
// If focus is already on a focusable child within the cell, early return so we don't shift focus
if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement) {
return;
}
let focusable = state.selectionManager.childFocusStrategy === 'last'
? last(treeWalker)
: treeWalker.firstChild() as FocusableElement;
if (focusable) {
focusSafely(focusable);
return;
}
}
if (
(keyWhenFocused.current != null && node.key !== keyWhenFocused.current) ||
!ref.current.contains(document.activeElement)
) {
focusSafely(ref.current);
}
}
};
let {itemProps, isPressed} = useSelectableItem({
selectionManager: state.selectionManager,
key: node.key,
ref,
isVirtualized,
focus,
shouldSelectOnPressUp,
onAction: onCellAction ? () => onCellAction(node.key) : onAction,
isDisabled: state.collection.size === 0
});
let onKeyDownCapture = (e: ReactKeyboardEvent) => {
if (!e.currentTarget.contains(e.target as Element) || state.isKeyboardNavigationDisabled || !ref.current || !document.activeElement) {
return;
}
let walker = getFocusableTreeWalker(ref.current);
walker.currentNode = document.activeElement;
switch (e.key) {
case 'ArrowLeft': {
// Find the next focusable element within the cell.
let focusable: FocusableElement | null = direction === 'rtl'
? walker.nextNode() as FocusableElement
: walker.previousNode() as FocusableElement;
// Don't focus the cell itself if focusMode is "child"
if (focusMode === 'child' && focusable === ref.current) {
focusable = null;
}
e.preventDefault();
e.stopPropagation();
if (focusable) {
focusSafely(focusable);
scrollIntoViewport(focusable, {containingElement: getScrollParent(ref.current)});
} else {
// If there is no next focusable child, then move to the next cell to the left of this one.
// This will be handled by useSelectableCollection. However, if there is no cell to the left
// of this one, only one column, and the grid doesn't focus rows, then the next key will be the
// same as this one. In that case we need to handle focusing either the cell or the first/last
// child, depending on the focus mode.
let prev = keyboardDelegate.getKeyLeftOf?.(node.key);
if (prev !== node.key) {
// We prevent the capturing event from reaching children of the cell, e.g. pickers.
// We want arrow keys to navigate to the next cell instead. We need to re-dispatch
// the event from a higher parent so it still bubbles and gets handled by useSelectableCollection.
ref.current.parentElement?.dispatchEvent(
new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)
);
break;
}
if (focusMode === 'cell' && direction === 'rtl') {
focusSafely(ref.current);
scrollIntoViewport(ref.current, {containingElement: getScrollParent(ref.current)});
} else {
walker.currentNode = ref.current;
focusable = direction === 'rtl'
? walker.firstChild() as FocusableElement
: last(walker);
if (focusable) {
focusSafely(focusable);
scrollIntoViewport(focusable, {containingElement: getScrollParent(ref.current)});
}
}
}
break;
}
case 'ArrowRight': {
let focusable: FocusableElement | null = direction === 'rtl'
? walker.previousNode() as FocusableElement
: walker.nextNode() as FocusableElement;
if (focusMode === 'child' && focusable === ref.current) {
focusable = null;
}
e.preventDefault();
e.stopPropagation();
if (focusable) {
focusSafely(focusable);
scrollIntoViewport(focusable, {containingElement: getScrollParent(ref.current)});
} else {
let next = keyboardDelegate.getKeyRightOf?.(node.key);
if (next !== node.key) {
// We prevent the capturing event from reaching children of the cell, e.g. pickers.
// We want arrow keys to navigate to the next cell instead. We need to re-dispatch
// the event from a higher parent so it still bubbles and gets handled by useSelectableCollection.
ref.current.parentElement?.dispatchEvent(
new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)
);
break;
}
if (focusMode === 'cell' && direction === 'ltr') {
focusSafely(ref.current);
scrollIntoViewport(ref.current, {containingElement: getScrollParent(ref.current)});
} else {
walker.currentNode = ref.current;
focusable = direction === 'rtl'
? last(walker)
: walker.firstChild() as FocusableElement;
if (focusable) {
focusSafely(focusable);
scrollIntoViewport(focusable, {containingElement: getScrollParent(ref.current)});
}
}
}
break;
}
case 'ArrowUp':
case 'ArrowDown':
// Prevent this event from reaching cell children, e.g. menu buttons. We want arrow keys to navigate
// to the cell above/below instead. We need to re-dispatch the event from a higher parent so it still
// bubbles and gets handled by useSelectableCollection.
if (!e.altKey && ref.current.contains(e.target as Element)) {
e.stopPropagation();
e.preventDefault();
ref.current.parentElement?.dispatchEvent(
new KeyboardEvent(e.nativeEvent.type, e.nativeEvent)
);
}
break;
}
};
// Grid cells can have focusable elements inside them. In this case, focus should
// be marshalled to that element rather than focusing the cell itself.
let onFocus = (e) => {
keyWhenFocused.current = node.key;
if (e.target !== ref.current) {
// useSelectableItem only handles setting the focused key when
// the focused element is the gridcell itself. We also want to
// set the focused key when a child element receives focus.
// If focus is currently visible (e.g. the user is navigating with the keyboard),
// then skip this. We want to restore focus to the previously focused row/cell
// in that case since the table should act like a single tab stop.
if (!isFocusVisible()) {
state.selectionManager.setFocusedKey(node.key);
}
return;
}
// If the cell itself is focused, wait a frame so that focus finishes propagatating
// up to the tree, and move focus to a focusable child if possible.
requestAnimationFrame(() => {
if (focusMode === 'child' && document.activeElement === ref.current) {
focus();
}
});
};
let gridCellProps: DOMAttributes = mergeProps(itemProps, {
role: 'gridcell',
onKeyDownCapture,
'aria-colspan': node.colSpan,
'aria-colindex': node.colIndex != null ? node.colIndex + 1 : undefined, // aria-colindex is 1-based
colSpan: isVirtualized ? undefined : node.colSpan,
onFocus
});
if (isVirtualized) {
gridCellProps['aria-colindex'] = (node.colIndex ?? node.index) + 1; // aria-colindex is 1-based
}
// When pressing with a pointer and cell selection is not enabled, usePress will be applied to the
// row rather than the cell. However, when the row is draggable, usePress cannot preventDefault
// on pointer down, so the browser will try to focus the cell which has a tabIndex applied.
// To avoid this, remove the tabIndex from the cell briefly on pointer down.
if (shouldSelectOnPressUp && gridCellProps.tabIndex != null && gridCellProps.onPointerDown == null) {
gridCellProps.onPointerDown = (e) => {
let el = e.currentTarget;
let tabindex = el.getAttribute('tabindex');
el.removeAttribute('tabindex');
requestAnimationFrame(() => {
if (tabindex != null) {
el.setAttribute('tabindex', tabindex);
}
});
};
}
return {
gridCellProps,
isPressed
};
}
function last(walker: TreeWalker) {
let next: FocusableElement | null = null;
let last: FocusableElement | null = null;
do {
last = walker.lastChild() as FocusableElement | null;
if (last) {
next = last;
}
} while (last);
return next;
}
@@ -0,0 +1,15 @@
import {
avatar,
avatarGroup
} from "../chunk-4MXK6CQJ.mjs";
import "../chunk-CWYZ2GEH.mjs";
import "../chunk-GQT3YUX3.mjs";
import "../chunk-46U6G7UJ.mjs";
import "../chunk-DGTYPKBN.mjs";
import "../chunk-UWE6H66T.mjs";
import "../chunk-GIXI35A3.mjs";
import "../chunk-GH5E4FQB.mjs";
export {
avatar,
avatarGroup
};
@@ -0,0 +1,776 @@
import * as tailwind_variants from 'tailwind-variants';
import { VariantProps } from 'tailwind-variants';
import * as tailwind_variants_dist_config from 'tailwind-variants/dist/config';
/**
* Checkbox wrapper **Tailwind Variants** component
*
* const {base, wrapper, icon, label} = checkbox({...})
*
* @example
* <label className={base())}>
* // hidden input
* <span className={wrapper()} aria-hidden="true" data-selected={selected}>
* <svg className={icon()}>
* // check icon
* </svg>
* </span>
* <span className={label()}>Label</span>
* </label>
*/
declare const checkbox: tailwind_variants.TVReturnType<{
color: {
default: {
wrapper: string;
};
primary: {
wrapper: string;
};
secondary: {
wrapper: string;
};
success: {
wrapper: string;
};
warning: {
wrapper: string;
};
danger: {
wrapper: string;
};
};
size: {
sm: {
wrapper: string[];
label: string;
icon: string;
};
md: {
wrapper: string[];
label: string;
icon: string;
};
lg: {
wrapper: string[];
label: string;
icon: string;
};
};
radius: {
none: {
wrapper: string;
};
sm: {
wrapper: string[];
};
md: {
wrapper: string[];
};
lg: {
wrapper: string[];
};
full: {
wrapper: string;
};
};
lineThrough: {
true: {
label: string[];
};
};
isDisabled: {
true: {
base: string;
};
};
isInvalid: {
true: {
wrapper: string;
label: string;
};
};
disableAnimation: {
true: {
wrapper: string;
icon: string;
label: string;
};
false: {
wrapper: string[];
icon: string;
label: string;
};
};
}, {
base: string;
wrapper: string[];
hiddenInput: string[];
icon: string;
label: string;
}, undefined, tailwind_variants_dist_config.TVConfig<{
color: {
default: {
wrapper: string;
};
primary: {
wrapper: string;
};
secondary: {
wrapper: string;
};
success: {
wrapper: string;
};
warning: {
wrapper: string;
};
danger: {
wrapper: string;
};
};
size: {
sm: {
wrapper: string[];
label: string;
icon: string;
};
md: {
wrapper: string[];
label: string;
icon: string;
};
lg: {
wrapper: string[];
label: string;
icon: string;
};
};
radius: {
none: {
wrapper: string;
};
sm: {
wrapper: string[];
};
md: {
wrapper: string[];
};
lg: {
wrapper: string[];
};
full: {
wrapper: string;
};
};
lineThrough: {
true: {
label: string[];
};
};
isDisabled: {
true: {
base: string;
};
};
isInvalid: {
true: {
wrapper: string;
label: string;
};
};
disableAnimation: {
true: {
wrapper: string;
icon: string;
label: string;
};
false: {
wrapper: string[];
icon: string;
label: string;
};
};
}, {
color: {
default: {
wrapper: string;
};
primary: {
wrapper: string;
};
secondary: {
wrapper: string;
};
success: {
wrapper: string;
};
warning: {
wrapper: string;
};
danger: {
wrapper: string;
};
};
size: {
sm: {
wrapper: string[];
label: string;
icon: string;
};
md: {
wrapper: string[];
label: string;
icon: string;
};
lg: {
wrapper: string[];
label: string;
icon: string;
};
};
radius: {
none: {
wrapper: string;
};
sm: {
wrapper: string[];
};
md: {
wrapper: string[];
};
lg: {
wrapper: string[];
};
full: {
wrapper: string;
};
};
lineThrough: {
true: {
label: string[];
};
};
isDisabled: {
true: {
base: string;
};
};
isInvalid: {
true: {
wrapper: string;
label: string;
};
};
disableAnimation: {
true: {
wrapper: string;
icon: string;
label: string;
};
false: {
wrapper: string[];
icon: string;
label: string;
};
};
}>, {
color: {
default: {
wrapper: string;
};
primary: {
wrapper: string;
};
secondary: {
wrapper: string;
};
success: {
wrapper: string;
};
warning: {
wrapper: string;
};
danger: {
wrapper: string;
};
};
size: {
sm: {
wrapper: string[];
label: string;
icon: string;
};
md: {
wrapper: string[];
label: string;
icon: string;
};
lg: {
wrapper: string[];
label: string;
icon: string;
};
};
radius: {
none: {
wrapper: string;
};
sm: {
wrapper: string[];
};
md: {
wrapper: string[];
};
lg: {
wrapper: string[];
};
full: {
wrapper: string;
};
};
lineThrough: {
true: {
label: string[];
};
};
isDisabled: {
true: {
base: string;
};
};
isInvalid: {
true: {
wrapper: string;
label: string;
};
};
disableAnimation: {
true: {
wrapper: string;
icon: string;
label: string;
};
false: {
wrapper: string[];
icon: string;
label: string;
};
};
}, {
base: string;
wrapper: string[];
hiddenInput: string[];
icon: string;
label: string;
}, tailwind_variants.TVReturnType<{
color: {
default: {
wrapper: string;
};
primary: {
wrapper: string;
};
secondary: {
wrapper: string;
};
success: {
wrapper: string;
};
warning: {
wrapper: string;
};
danger: {
wrapper: string;
};
};
size: {
sm: {
wrapper: string[];
label: string;
icon: string;
};
md: {
wrapper: string[];
label: string;
icon: string;
};
lg: {
wrapper: string[];
label: string;
icon: string;
};
};
radius: {
none: {
wrapper: string;
};
sm: {
wrapper: string[];
};
md: {
wrapper: string[];
};
lg: {
wrapper: string[];
};
full: {
wrapper: string;
};
};
lineThrough: {
true: {
label: string[];
};
};
isDisabled: {
true: {
base: string;
};
};
isInvalid: {
true: {
wrapper: string;
label: string;
};
};
disableAnimation: {
true: {
wrapper: string;
icon: string;
label: string;
};
false: {
wrapper: string[];
icon: string;
label: string;
};
};
}, {
base: string;
wrapper: string[];
hiddenInput: string[];
icon: string;
label: string;
}, undefined, tailwind_variants_dist_config.TVConfig<{
color: {
default: {
wrapper: string;
};
primary: {
wrapper: string;
};
secondary: {
wrapper: string;
};
success: {
wrapper: string;
};
warning: {
wrapper: string;
};
danger: {
wrapper: string;
};
};
size: {
sm: {
wrapper: string[];
label: string;
icon: string;
};
md: {
wrapper: string[];
label: string;
icon: string;
};
lg: {
wrapper: string[];
label: string;
icon: string;
};
};
radius: {
none: {
wrapper: string;
};
sm: {
wrapper: string[];
};
md: {
wrapper: string[];
};
lg: {
wrapper: string[];
};
full: {
wrapper: string;
};
};
lineThrough: {
true: {
label: string[];
};
};
isDisabled: {
true: {
base: string;
};
};
isInvalid: {
true: {
wrapper: string;
label: string;
};
};
disableAnimation: {
true: {
wrapper: string;
icon: string;
label: string;
};
false: {
wrapper: string[];
icon: string;
label: string;
};
};
}, {
color: {
default: {
wrapper: string;
};
primary: {
wrapper: string;
};
secondary: {
wrapper: string;
};
success: {
wrapper: string;
};
warning: {
wrapper: string;
};
danger: {
wrapper: string;
};
};
size: {
sm: {
wrapper: string[];
label: string;
icon: string;
};
md: {
wrapper: string[];
label: string;
icon: string;
};
lg: {
wrapper: string[];
label: string;
icon: string;
};
};
radius: {
none: {
wrapper: string;
};
sm: {
wrapper: string[];
};
md: {
wrapper: string[];
};
lg: {
wrapper: string[];
};
full: {
wrapper: string;
};
};
lineThrough: {
true: {
label: string[];
};
};
isDisabled: {
true: {
base: string;
};
};
isInvalid: {
true: {
wrapper: string;
label: string;
};
};
disableAnimation: {
true: {
wrapper: string;
icon: string;
label: string;
};
false: {
wrapper: string[];
icon: string;
label: string;
};
};
}>, unknown, unknown, undefined>>;
/**
* CheckboxGroup wrapper **Tailwind Variants** component
*
* const {base, label, wrapper} = checkboxGroup({...})
*
* @example
* <div className={base())}>
* <label className={label()}>Label</label>
* <div className={wrapper()} data-orientation="vertical/horizontal">
* // checkboxes
* </div>
* </div>
*/
declare const checkboxGroup: tailwind_variants.TVReturnType<{
isRequired: {
true: {
label: string;
};
};
isInvalid: {
true: {
description: string;
};
};
disableAnimation: {
true: {};
false: {
description: string;
};
};
}, {
base: string;
label: string;
wrapper: string;
description: string;
errorMessage: string;
}, undefined, tailwind_variants_dist_config.TVConfig<{
isRequired: {
true: {
label: string;
};
};
isInvalid: {
true: {
description: string;
};
};
disableAnimation: {
true: {};
false: {
description: string;
};
};
}, {
isRequired: {
true: {
label: string;
};
};
isInvalid: {
true: {
description: string;
};
};
disableAnimation: {
true: {};
false: {
description: string;
};
};
}>, {
isRequired: {
true: {
label: string;
};
};
isInvalid: {
true: {
description: string;
};
};
disableAnimation: {
true: {};
false: {
description: string;
};
};
}, {
base: string;
label: string;
wrapper: string;
description: string;
errorMessage: string;
}, tailwind_variants.TVReturnType<{
isRequired: {
true: {
label: string;
};
};
isInvalid: {
true: {
description: string;
};
};
disableAnimation: {
true: {};
false: {
description: string;
};
};
}, {
base: string;
label: string;
wrapper: string;
description: string;
errorMessage: string;
}, undefined, tailwind_variants_dist_config.TVConfig<{
isRequired: {
true: {
label: string;
};
};
isInvalid: {
true: {
description: string;
};
};
disableAnimation: {
true: {};
false: {
description: string;
};
};
}, {
isRequired: {
true: {
label: string;
};
};
isInvalid: {
true: {
description: string;
};
};
disableAnimation: {
true: {};
false: {
description: string;
};
};
}>, unknown, unknown, undefined>>;
type CheckboxGroupSlots = keyof ReturnType<typeof checkboxGroup>;
type CheckboxVariantProps = VariantProps<typeof checkbox>;
type CheckboxSlots = keyof ReturnType<typeof checkbox>;
export { CheckboxGroupSlots, CheckboxSlots, CheckboxVariantProps, checkbox, checkboxGroup };
@@ -0,0 +1,235 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = applyDecs2305;
var _checkInRHS = require("./checkInRHS.js");
var _setFunctionName = require("./setFunctionName.js");
var _toPropertyKey = require("./toPropertyKey.js");
function applyDecs2305(targetClass, memberDecs, classDecs, classDecsHaveThis, instanceBrand, parentClass) {
function _bindPropCall(obj, name, before) {
return function (_this, value) {
if (before) {
before(_this);
}
return obj[name].call(_this, value);
};
}
function runInitializers(initializers, value) {
for (var i = 0; i < initializers.length; i++) {
initializers[i].call(value);
}
return value;
}
function assertCallable(fn, hint1, hint2, throwUndefined) {
if (typeof fn !== "function") {
if (throwUndefined || fn !== void 0) {
throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
}
}
return fn;
}
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, metadata, initializers, ret, isStatic, isPrivate, isField, isAccessor, hasPrivateBrand) {
function assertInstanceIfPrivate(target) {
if (!hasPrivateBrand(target)) {
throw new TypeError("Attempted to access private element on non-instance");
}
}
var decs = decInfo[0],
decVal = decInfo[3],
_,
isClass = !ret;
if (!isClass) {
if (!decoratorsHaveThis && !Array.isArray(decs)) {
decs = [decs];
}
var desc = {},
init = [],
key = kind === 3 ? "get" : kind === 4 || isAccessor ? "set" : "value";
if (isPrivate) {
if (isField || isAccessor) {
desc = {
get: (0, _setFunctionName.default)(function () {
return decVal(this);
}, name, "get"),
set: function (value) {
decInfo[4](this, value);
}
};
} else {
desc[key] = decVal;
}
if (!isField) {
(0, _setFunctionName.default)(desc[key], name, kind === 2 ? "" : key);
}
} else if (!isField) {
desc = Object.getOwnPropertyDescriptor(Class, name);
}
}
var newValue = Class;
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
var dec = decs[i],
decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
var decoratorFinishedRef = {};
var ctx = {
kind: ["field", "accessor", "method", "getter", "setter", "class"][kind],
name: name,
metadata: metadata,
addInitializer: function (decoratorFinishedRef, initializer) {
if (decoratorFinishedRef.v) {
throw new Error("attempted to call addInitializer after decoration was finished");
}
assertCallable(initializer, "An initializer", "be", true);
initializers.push(initializer);
}.bind(null, decoratorFinishedRef)
};
try {
if (isClass) {
if (_ = assertCallable(dec.call(decThis, newValue, ctx), "class decorators", "return")) {
newValue = _;
}
} else {
ctx["static"] = isStatic;
ctx["private"] = isPrivate;
var get, set;
if (!isPrivate) {
get = function (target) {
return target[name];
};
if (kind < 2 || kind === 4) {
set = function (target, v) {
target[name] = v;
};
}
} else if (kind === 2) {
get = function (_this) {
assertInstanceIfPrivate(_this);
return desc.value;
};
} else {
if (kind < 4) {
get = _bindPropCall(desc, "get", assertInstanceIfPrivate);
}
if (kind !== 3) {
set = _bindPropCall(desc, "set", assertInstanceIfPrivate);
}
}
var access = ctx.access = {
has: isPrivate ? hasPrivateBrand.bind() : function (target) {
return name in target;
}
};
if (get) access.get = get;
if (set) access.set = set;
newValue = dec.call(decThis, isAccessor ? {
get: desc.get,
set: desc.set
} : desc[key], ctx);
if (isAccessor) {
if (typeof newValue === "object" && newValue) {
if (_ = assertCallable(newValue.get, "accessor.get")) {
desc.get = _;
}
if (_ = assertCallable(newValue.set, "accessor.set")) {
desc.set = _;
}
if (_ = assertCallable(newValue.init, "accessor.init")) {
init.push(_);
}
} else if (newValue !== void 0) {
throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
}
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) {
if (isField) {
init.push(newValue);
} else {
desc[key] = newValue;
}
}
}
} finally {
decoratorFinishedRef.v = true;
}
}
if (isField || isAccessor) {
ret.push(function (instance, value) {
for (var i = init.length - 1; i >= 0; i--) {
value = init[i].call(instance, value);
}
return value;
});
}
if (!isField && !isClass) {
if (isPrivate) {
if (isAccessor) {
ret.push(_bindPropCall(desc, "get"), _bindPropCall(desc, "set"));
} else {
ret.push(kind === 2 ? desc[key] : _bindPropCall.call.bind(desc[key]));
}
} else {
Object.defineProperty(Class, name, desc);
}
}
return newValue;
}
function applyMemberDecs(Class, decInfos, instanceBrand, metadata) {
var ret = [];
var protoInitializers;
var staticInitializers;
var staticBrand = function (_) {
return (0, _checkInRHS.default)(_) === Class;
};
var existingNonFields = new Map();
function pushInitializers(initializers) {
if (initializers) {
ret.push(runInitializers.bind(null, initializers));
}
}
for (var i = 0; i < decInfos.length; i++) {
var decInfo = decInfos[i];
if (!Array.isArray(decInfo)) continue;
var kind = decInfo[1];
var name = decInfo[2];
var isPrivate = decInfo.length > 3;
var decoratorsHaveThis = kind & 16;
var isStatic = !!(kind & 8);
kind &= 7;
var isField = kind === 0;
var key = name + "/" + isStatic;
if (!isField && !isPrivate) {
var existingKind = existingNonFields.get(key);
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
}
existingNonFields.set(key, kind > 2 ? kind : true);
}
applyDec(isStatic ? Class : Class.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : (0, _toPropertyKey.default)(name), kind, metadata, isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, isStatic, isPrivate, isField, kind === 1, isStatic && isPrivate ? staticBrand : instanceBrand);
}
pushInitializers(protoInitializers);
pushInitializers(staticInitializers);
return ret;
}
function defineMetadata(Class, metadata) {
return Object.defineProperty(Class, Symbol.metadata || Symbol["for"]("Symbol.metadata"), {
configurable: true,
enumerable: true,
value: metadata
});
}
if (arguments.length >= 6) {
var parentMetadata = parentClass[Symbol.metadata || Symbol["for"]("Symbol.metadata")];
}
var metadata = Object.create(parentMetadata == null ? null : parentMetadata);
var e = applyMemberDecs(targetClass, memberDecs, instanceBrand, metadata);
if (!classDecs.length) defineMetadata(targetClass, metadata);
return {
e: e,
get c() {
var initializers = [];
return classDecs.length && [defineMetadata(applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, metadata, initializers), metadata), runInitializers.bind(null, initializers, targetClass)];
}
};
}
//# sourceMappingURL=applyDecs2305.js.map
@@ -0,0 +1,3 @@
export { default as instanceCachingFactory } from "./instance-caching-factory";
export { default as instancePerContainerCachingFactory } from "./instance-per-container-caching-factory";
export { default as predicateAwareClassFactory } from "./predicate-aware-class-factory";
@@ -0,0 +1,37 @@
{
"name": "@nodelib/fs.stat",
"version": "2.0.5",
"description": "Get the status of a file with some features",
"license": "MIT",
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat",
"keywords": [
"NodeLib",
"fs",
"FileSystem",
"file system",
"stat"
],
"engines": {
"node": ">= 8"
},
"files": [
"out/**",
"!out/**/*.map",
"!out/**/*.spec.*"
],
"main": "out/index.js",
"typings": "out/index.d.ts",
"scripts": {
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
"lint": "eslint \"src/**/*.ts\" --cache",
"compile": "tsc -b .",
"compile:watch": "tsc -p . --watch --sourceMap",
"test": "mocha \"out/**/*.spec.js\" -s 0",
"build": "npm run clean && npm run compile && npm run lint && npm test",
"watch": "npm run clean && npm run compile:watch"
},
"devDependencies": {
"@nodelib/fs.macchiato": "1.0.4"
},
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
}
@@ -0,0 +1,119 @@
/**
* Copyright (c) 2017, Daniel Imms (MIT License).
* Copyright (c) 2018, Microsoft Corporation (MIT License).
*/
import * as assert from 'assert';
import { WindowsTerminal } from './windowsTerminal';
import { UnixTerminal } from './unixTerminal';
import { Terminal } from './terminal';
import { Socket } from 'net';
const terminalConstructor = (process.platform === 'win32') ? WindowsTerminal : UnixTerminal;
const SHELL = (process.platform === 'win32') ? 'cmd.exe' : '/bin/bash';
let terminalCtor: WindowsTerminal | UnixTerminal;
if (process.platform === 'win32') {
terminalCtor = require('./windowsTerminal');
} else {
terminalCtor = require('./unixTerminal');
}
class TestTerminal extends Terminal {
public checkType<T>(name: string, value: T, type: string, allowArray: boolean = false): void {
this._checkType(name, value, type, allowArray);
}
protected _write(data: string): void {
throw new Error('Method not implemented.');
}
public resize(cols: number, rows: number): void {
throw new Error('Method not implemented.');
}
public clear(): void {
throw new Error('Method not implemented.');
}
public destroy(): void {
throw new Error('Method not implemented.');
}
public kill(signal?: string): void {
throw new Error('Method not implemented.');
}
public get process(): string {
throw new Error('Method not implemented.');
}
public get master(): Socket {
throw new Error('Method not implemented.');
}
public get slave(): Socket {
throw new Error('Method not implemented.');
}
}
describe('Terminal', () => {
describe('constructor', () => {
it('should do basic type checks', () => {
assert.throws(
() => new (<any>terminalCtor)('a', 'b', { 'name': {} }),
'name must be a string (not a object)'
);
});
});
describe('checkType', () => {
it('should throw for the wrong type', () => {
const t = new TestTerminal();
assert.doesNotThrow(() => t.checkType('foo', 'test', 'string'));
assert.doesNotThrow(() => t.checkType('foo', 1, 'number'));
assert.doesNotThrow(() => t.checkType('foo', {}, 'object'));
assert.throws(() => t.checkType('foo', 'test', 'number'));
assert.throws(() => t.checkType('foo', 1, 'object'));
assert.throws(() => t.checkType('foo', {}, 'string'));
});
it('should throw for wrong types within arrays', () => {
const t = new TestTerminal();
assert.doesNotThrow(() => t.checkType('foo', ['test'], 'string', true));
assert.doesNotThrow(() => t.checkType('foo', [1], 'number', true));
assert.doesNotThrow(() => t.checkType('foo', [{}], 'object', true));
assert.throws(() => t.checkType('foo', ['test'], 'number', true));
assert.throws(() => t.checkType('foo', [1], 'object', true));
assert.throws(() => t.checkType('foo', [{}], 'string', true));
});
});
describe('automatic flow control', () => {
it('should respect ctor flow control options', () => {
const pty = new terminalConstructor(SHELL, [], {handleFlowControl: true, flowControlPause: 'abc', flowControlResume: '123'});
assert.equal(pty.handleFlowControl, true);
assert.equal((pty as any)._flowControlPause, 'abc');
assert.equal((pty as any)._flowControlResume, '123');
});
// TODO: I don't think this test ever worked due to pollUntil being used incorrectly
// it('should do flow control automatically', async function(): Promise<void> {
// // Flow control doesn't work on Windows
// if (process.platform === 'win32') {
// return;
// }
// this.timeout(10000);
// const pty = new terminalConstructor(SHELL, [], {handleFlowControl: true, flowControlPause: 'PAUSE', flowControlResume: 'RESUME'});
// let read: string = '';
// pty.on('data', data => read += data);
// pty.on('pause', () => read += 'paused');
// pty.on('resume', () => read += 'resumed');
// pty.write('1');
// pty.write('PAUSE');
// pty.write('2');
// pty.write('RESUME');
// pty.write('3');
// await pollUntil(() => {
// return stripEscapeSequences(read).endsWith('1pausedresumed23');
// }, 100, 10);
// });
});
});
function stripEscapeSequences(data: string): string {
return data.replace(/\u001b\[0K/, '');
}
@@ -0,0 +1,7 @@
'use strict';
const path = require('path');
const binaryExtensions = require('binary-extensions');
const extensions = new Set(binaryExtensions);
module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase());
@@ -0,0 +1,5 @@
'use strict'
module.exports.isClean = Symbol('isClean')
module.exports.my = Symbol('my')
@@ -0,0 +1,18 @@
import type { TSchema } from '../schema/index.mjs';
import type { Evaluate } from '../helpers/index.mjs';
import { type TIntersectEvaluated } from '../intersect/index.mjs';
import { type TIndexFromPropertyKeys } from '../indexed/index.mjs';
import { type TKeyOfPropertyKeys } from '../keyof/index.mjs';
import { type TNever } from '../never/index.mjs';
import { type TObject, type TProperties, type ObjectOptions } from '../object/index.mjs';
import { TSetDistinct } from '../sets/index.mjs';
type TCompositeKeys<T extends TSchema[], Acc extends PropertyKey[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeKeys<R, [...Acc, ...TKeyOfPropertyKeys<L>]> : TSetDistinct<Acc>);
type TFilterNever<T extends TSchema[], Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? L extends TNever ? TFilterNever<R, [...Acc]> : TFilterNever<R, [...Acc, L]> : Acc);
type TCompositeProperty<T extends TSchema[], K extends PropertyKey, Acc extends TSchema[] = []> = (T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? TCompositeProperty<R, K, [...Acc, ...TIndexFromPropertyKeys<L, [K]>]> : TFilterNever<Acc>);
type TCompositeProperties<T extends TSchema[], K extends PropertyKey[], Acc = {}> = (K extends [infer L extends PropertyKey, ...infer R extends PropertyKey[]] ? TCompositeProperties<T, R, Acc & {
[_ in L]: TIntersectEvaluated<TCompositeProperty<T, L>>;
}> : Acc);
type TCompositeEvaluate<T extends TSchema[], K extends PropertyKey[] = TCompositeKeys<T>, P extends TProperties = Evaluate<TCompositeProperties<T, K>>, R extends TSchema = TObject<P>> = R;
export type TComposite<T extends TSchema[]> = TCompositeEvaluate<T>;
export declare function Composite<T extends TSchema[]>(T: [...T], options?: ObjectOptions): TComposite<T>;
export {};
@@ -0,0 +1,39 @@
var $g7qpO$reactstatelyutils = require("@react-stately/utils");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useToggleState", () => $d84f98b140466b44$export$8042c6c013fd5226);
/*
* 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 $d84f98b140466b44$export$8042c6c013fd5226(props = {}) {
let { isReadOnly: isReadOnly } = props;
// have to provide an empty function so useControlledState doesn't throw a fit
// can't use useControlledState's prop calling because we need the event object from the change
let [isSelected, setSelected] = (0, $g7qpO$reactstatelyutils.useControlledState)(props.isSelected, props.defaultSelected || false, props.onChange);
function updateSelected(value) {
if (!isReadOnly) setSelected(value);
}
function toggleState() {
if (!isReadOnly) setSelected(!isSelected);
}
return {
isSelected: isSelected,
setSelected: updateSelected,
toggle: toggleState
};
}
//# sourceMappingURL=useToggleState.main.js.map
@@ -0,0 +1 @@
{"version":3,"file":"Newable.js","sourceRoot":"","sources":["../../../../src/services/models/Newable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
module.exports = {
y: 1 << 0,
n: 1 << 1,
a: 1 << 2,
p: 1 << 3,
u: 1 << 4,
x: 1 << 5,
d: 1 << 6
}
@@ -0,0 +1,34 @@
var defer = require('./defer.js');
// API
module.exports = async;
/**
* Runs provided callback asynchronously
* even if callback itself is not
*
* @param {function} callback - callback to invoke
* @returns {function} - augmented callback
*/
function async(callback)
{
var isAsync = false;
// check if async happened
defer(function() { isAsync = true; });
return function async_callback(err, result)
{
if (isAsync)
{
callback(err, result);
}
else
{
defer(function nextTick_callback()
{
callback(err, result);
});
}
};
}
@@ -0,0 +1,63 @@
import { Directives } from '../doc/directives';
import { Document } from '../doc/Document';
import type { ErrorCode } from '../errors';
import { YAMLParseError, YAMLWarning } from '../errors';
import type { ParsedNode, Range } from '../nodes/Node';
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options';
import type { Token } from '../parse/cst';
type ErrorSource = number | [number, number] | Range | {
offset: number;
source?: string;
};
export type ComposeErrorHandler = (source: ErrorSource, code: ErrorCode, message: string, warning?: boolean) => void;
/**
* Compose a stream of CST nodes into a stream of YAML Documents.
*
* ```ts
* import { Composer, Parser } from 'yaml'
*
* const src: string = ...
* const tokens = new Parser().parse(src)
* const docs = new Composer().compose(tokens)
* ```
*/
export declare class Composer<Contents extends ParsedNode = ParsedNode, Strict extends boolean = true> {
private directives;
private doc;
private options;
private atDirectives;
private prelude;
private errors;
private warnings;
constructor(options?: ParseOptions & DocumentOptions & SchemaOptions);
private onError;
private decorate;
/**
* Current stream status information.
*
* Mostly useful at the end of input for an empty stream.
*/
streamInfo(): {
comment: string;
directives: Directives;
errors: YAMLParseError[];
warnings: YAMLWarning[];
};
/**
* Compose tokens into documents.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
compose(tokens: Iterable<Token>, forceDoc?: boolean, endOffset?: number): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
/** Advance the composer by one CST token. */
next(token: Token): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
/**
* Call at end of input to yield any remaining document.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
end(forceDoc?: boolean, endOffset?: number): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
}
export {};
@@ -0,0 +1,6 @@
export { useWebSocket as default } from './lib/use-websocket';
export { SendMessage, Options } from './lib/types';
export { useSocketIO } from './lib/use-socket-io';
export { ReadyState } from './lib/constants';
export { useEventSource } from './lib/use-event-source';
export { resetGlobalState } from './lib/util';
@@ -0,0 +1,946 @@
'use strict';
var utils = require('../utils.js');
var utils$1 = require('@typescript-eslint/utils');
var astUtils = require('@typescript-eslint/utils/ast-utils');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
var _baseRule = utils.createRule({
name: "no-extra-parens",
package: "js",
meta: {
type: "layout",
docs: {
description: "Disallow unnecessary parentheses"
},
fixable: "code",
schema: {
anyOf: [
{
type: "array",
items: [
{
type: "string",
enum: ["functions"]
}
],
minItems: 0,
maxItems: 1
},
{
type: "array",
items: [
{
type: "string",
enum: ["all"]
},
{
type: "object",
properties: {
conditionalAssign: { type: "boolean" },
ternaryOperandBinaryExpressions: { type: "boolean" },
nestedBinaryExpressions: { type: "boolean" },
returnAssign: { type: "boolean" },
ignoreJSX: { type: "string", enum: ["none", "all", "single-line", "multi-line"] },
enforceForArrowConditionals: { type: "boolean" },
enforceForSequenceExpressions: { type: "boolean" },
enforceForNewInMemberExpressions: { type: "boolean" },
enforceForFunctionPrototypeMethods: { type: "boolean" },
allowParensAfterCommentPattern: { type: "string" }
},
additionalProperties: false
}
],
minItems: 0,
maxItems: 2
}
]
},
messages: {
unexpected: "Unnecessary parentheses around expression."
}
},
create(context) {
const sourceCode = context.sourceCode;
const tokensToIgnore = /* @__PURE__ */ new WeakSet();
const precedence = utils.getPrecedence;
const ALL_NODES = context.options[0] !== "functions";
const EXCEPT_COND_ASSIGN = ALL_NODES && context.options[1] && context.options[1].conditionalAssign === false;
const EXCEPT_COND_TERNARY = ALL_NODES && context.options[1] && context.options[1].ternaryOperandBinaryExpressions === false;
const NESTED_BINARY = ALL_NODES && context.options[1] && context.options[1].nestedBinaryExpressions === false;
const EXCEPT_RETURN_ASSIGN = ALL_NODES && context.options[1] && context.options[1].returnAssign === false;
const IGNORE_JSX = ALL_NODES && context.options[1] && context.options[1].ignoreJSX;
const IGNORE_ARROW_CONDITIONALS = ALL_NODES && context.options[1] && context.options[1].enforceForArrowConditionals === false;
const IGNORE_SEQUENCE_EXPRESSIONS = ALL_NODES && context.options[1] && context.options[1].enforceForSequenceExpressions === false;
const IGNORE_NEW_IN_MEMBER_EXPR = ALL_NODES && context.options[1] && context.options[1].enforceForNewInMemberExpressions === false;
const IGNORE_FUNCTION_PROTOTYPE_METHODS = ALL_NODES && context.options[1] && context.options[1].enforceForFunctionPrototypeMethods === false;
const ALLOW_PARENS_AFTER_COMMENT_PATTERN = ALL_NODES && context.options[1] && context.options[1].allowParensAfterCommentPattern;
const PRECEDENCE_OF_ASSIGNMENT_EXPR = precedence({ type: "AssignmentExpression" });
const PRECEDENCE_OF_UPDATE_EXPR = precedence({ type: "UpdateExpression" });
let reportsBuffer;
function isImmediateFunctionPrototypeMethodCall(node) {
const callNode = utils.skipChainExpression(node);
if (callNode.type !== "CallExpression")
return false;
const callee = utils.skipChainExpression(callNode.callee);
return callee.type === "MemberExpression" && callee.object.type === "FunctionExpression" && ["call", "apply"].includes(utils.getStaticPropertyName(callee));
}
function ruleApplies(node) {
if (node.type === "JSXElement" || node.type === "JSXFragment") {
const isSingleLine = node.loc.start.line === node.loc.end.line;
switch (IGNORE_JSX) {
// Exclude this JSX element from linting
case "all":
return false;
// Exclude this JSX element if it is multi-line element
case "multi-line":
return isSingleLine;
// Exclude this JSX element if it is single-line element
case "single-line":
return !isSingleLine;
}
}
if (node.type === "SequenceExpression" && IGNORE_SEQUENCE_EXPRESSIONS)
return false;
if (isImmediateFunctionPrototypeMethodCall(node) && IGNORE_FUNCTION_PROTOTYPE_METHODS)
return false;
return ALL_NODES || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
}
function isParenthesised(node) {
return utils.isParenthesized(node, sourceCode, 1);
}
function isParenthesisedTwice(node) {
return utils.isParenthesized(node, sourceCode, 2);
}
function hasExcessParens(node) {
return ruleApplies(node) && isParenthesised(node);
}
function hasDoubleExcessParens(node) {
return ruleApplies(node) && isParenthesisedTwice(node);
}
function hasExcessParensWithPrecedence(node, precedenceLowerLimit) {
if (ruleApplies(node) && isParenthesised(node)) {
if (precedence(node) >= precedenceLowerLimit || isParenthesisedTwice(node)) {
return true;
}
}
return false;
}
function isCondAssignException(node) {
return EXCEPT_COND_ASSIGN && node.test && node.test.type === "AssignmentExpression";
}
function isInReturnStatement(node) {
for (let currentNode = node; currentNode; currentNode = currentNode.parent) {
if (currentNode.type === "ReturnStatement" || currentNode.type === "ArrowFunctionExpression" && currentNode.body.type !== "BlockStatement") {
return true;
}
}
return false;
}
function isNewExpressionWithParens(newExpression) {
const lastToken = sourceCode.getLastToken(newExpression);
const penultimateToken = sourceCode.getTokenBefore(lastToken);
return newExpression.arguments.length > 0 || // The expression should end with its own parens, e.g., new new foo() is not a new expression with parens
utils.isOpeningParenToken(penultimateToken) && utils.isClosingParenToken(lastToken) && newExpression.callee.range[1] < newExpression.range[1];
}
function containsAssignment(node) {
if (node.type === "AssignmentExpression")
return true;
if (node.type === "ConditionalExpression" && (node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) {
return true;
}
if ("left" in node && (node.left && node.left.type === "AssignmentExpression" || node.right && node.right.type === "AssignmentExpression")) {
return true;
}
return false;
}
function isReturnAssignException(node) {
if (!EXCEPT_RETURN_ASSIGN || !isInReturnStatement(node))
return false;
if (node.type === "ReturnStatement")
return node.argument && containsAssignment(node.argument);
if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatement")
return containsAssignment(node.body);
return containsAssignment(node);
}
function hasExcessParensNoLineTerminator(token, node) {
if (token.loc.end.line === node.loc.start.line)
return hasExcessParens(node);
return hasDoubleExcessParens(node);
}
function requiresLeadingSpace(node) {
const leftParenToken = sourceCode.getTokenBefore(node);
const tokenBeforeLeftParen = sourceCode.getTokenBefore(leftParenToken, { includeComments: true });
const tokenAfterLeftParen = sourceCode.getTokenAfter(leftParenToken, { includeComments: true });
return tokenBeforeLeftParen && tokenBeforeLeftParen.range[1] === leftParenToken.range[0] && leftParenToken.range[1] === tokenAfterLeftParen.range[0] && !utils.canTokensBeAdjacent(tokenBeforeLeftParen, tokenAfterLeftParen);
}
function requiresTrailingSpace(node) {
const nextTwoTokens = sourceCode.getTokensAfter(node, { count: 2 });
const rightParenToken = nextTwoTokens[0];
const tokenAfterRightParen = nextTwoTokens[1];
const tokenBeforeRightParen = sourceCode.getLastToken(node);
return rightParenToken && tokenAfterRightParen && !sourceCode.isSpaceBetweenTokens(rightParenToken, tokenAfterRightParen) && !utils.canTokensBeAdjacent(tokenBeforeRightParen, tokenAfterRightParen);
}
function isIIFE(node) {
const maybeCallNode = utils.skipChainExpression(node);
return maybeCallNode.type === "CallExpression" && maybeCallNode.callee.type === "FunctionExpression";
}
function canBeAssignmentTarget(node) {
return !!(node && (node.type === "Identifier" || node.type === "MemberExpression"));
}
function isFixable(node) {
if (node.type !== "Literal" || typeof node.value !== "string")
return true;
if (isParenthesisedTwice(node))
return true;
return !utils.isTopLevelExpressionStatement(node.parent);
}
function report(node) {
const leftParenToken = sourceCode.getTokenBefore(node);
const rightParenToken = sourceCode.getTokenAfter(node);
if (!isParenthesisedTwice(node)) {
if (tokensToIgnore.has(sourceCode.getFirstToken(node)))
return;
if (isIIFE(node) && !("callee" in node && isParenthesised(node.callee)))
return;
if (ALLOW_PARENS_AFTER_COMMENT_PATTERN) {
const commentsBeforeLeftParenToken = sourceCode.getCommentsBefore(leftParenToken);
const totalCommentsBeforeLeftParenTokenCount = commentsBeforeLeftParenToken.length;
const ignorePattern = new RegExp(ALLOW_PARENS_AFTER_COMMENT_PATTERN, "u");
if (totalCommentsBeforeLeftParenTokenCount > 0 && ignorePattern.test(commentsBeforeLeftParenToken[totalCommentsBeforeLeftParenTokenCount - 1].value)) {
return;
}
}
}
function finishReport() {
context.report({
node,
loc: leftParenToken.loc,
messageId: "unexpected",
fix: isFixable(node) ? (fixer) => {
const parenthesizedSource = sourceCode.text.slice(leftParenToken.range[1], rightParenToken.range[0]);
return fixer.replaceTextRange([
leftParenToken.range[0],
rightParenToken.range[1]
], (requiresLeadingSpace(node) ? " " : "") + parenthesizedSource + (requiresTrailingSpace(node) ? " " : ""));
} : null
});
}
if (reportsBuffer) {
reportsBuffer.reports.push({ node, finishReport });
return;
}
finishReport();
}
function checkArgumentWithPrecedence(node) {
if ("argument" in node && node.argument && hasExcessParensWithPrecedence(node.argument, precedence(node)))
report(node.argument);
}
function doesMemberExpressionContainCallExpression(node) {
let currentNode = node.object;
let currentNodeType = node.object.type;
while (currentNodeType === "MemberExpression") {
if (!("object" in currentNode))
break;
currentNode = currentNode.object;
currentNodeType = currentNode.type;
}
return currentNodeType === "CallExpression";
}
function checkCallNew(node) {
const callee = node.callee;
if (hasExcessParensWithPrecedence(callee, precedence(node))) {
if (hasDoubleExcessParens(callee) || !(isIIFE(node) || callee.type === "NewExpression" && !isNewExpressionWithParens(callee) && !(node.type === "NewExpression" && !isNewExpressionWithParens(node)) || node.type === "NewExpression" && callee.type === "MemberExpression" && doesMemberExpressionContainCallExpression(callee) || (!("optional" in node) || !node.optional) && callee.type === "ChainExpression")) {
report(node.callee);
}
}
node.arguments.filter((arg) => hasExcessParensWithPrecedence(arg, PRECEDENCE_OF_ASSIGNMENT_EXPR)).forEach(report);
}
function checkBinaryLogical(node) {
const prec = precedence(node);
const leftPrecedence = precedence(node.left);
const rightPrecedence = precedence(node.right);
const isExponentiation = node.operator === "**";
const shouldSkipLeft = NESTED_BINARY && (node.left.type === "BinaryExpression" || node.left.type === "LogicalExpression");
const shouldSkipRight = NESTED_BINARY && (node.right.type === "BinaryExpression" || node.right.type === "LogicalExpression");
if (!shouldSkipLeft && hasExcessParens(node.left)) {
if (!(["AwaitExpression", "UnaryExpression"].includes(node.left.type) && isExponentiation) && !utils.isMixedLogicalAndCoalesceExpressions(node.left, node) && (leftPrecedence > prec || leftPrecedence === prec && !isExponentiation) || isParenthesisedTwice(node.left)) {
report(node.left);
}
}
if (!shouldSkipRight && hasExcessParens(node.right)) {
if (!utils.isMixedLogicalAndCoalesceExpressions(node.right, node) && (rightPrecedence > prec || rightPrecedence === prec && isExponentiation) || isParenthesisedTwice(node.right)) {
report(node.right);
}
}
}
function checkClass(node) {
if (!node.superClass)
return;
const hasExtraParens = precedence(node.superClass) > PRECEDENCE_OF_UPDATE_EXPR ? hasExcessParens(node.superClass) : hasDoubleExcessParens(node.superClass);
if (hasExtraParens)
report(node.superClass);
}
function checkSpreadOperator(node) {
if (hasExcessParensWithPrecedence(node.argument, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(node.argument);
}
function checkExpressionOrExportStatement(node) {
const firstToken = isParenthesised(node) ? sourceCode.getTokenBefore(node) : sourceCode.getFirstToken(node);
const secondToken = sourceCode.getTokenAfter(firstToken, utils.isNotOpeningParenToken);
const thirdToken = secondToken ? sourceCode.getTokenAfter(secondToken) : null;
const tokenAfterClosingParens = secondToken ? sourceCode.getTokenAfter(secondToken, utils.isNotClosingParenToken) : null;
if (utils.isOpeningParenToken(firstToken) && (utils.isOpeningBraceToken(secondToken) || secondToken.type === "Keyword" && (secondToken.value === "function" || secondToken.value === "class" || secondToken.value === "let" && tokenAfterClosingParens && (utils.isOpeningBracketToken(tokenAfterClosingParens) || tokenAfterClosingParens.type === "Identifier")) || secondToken && secondToken.type === "Identifier" && secondToken.value === "async" && thirdToken && thirdToken.type === "Keyword" && thirdToken.value === "function")) {
tokensToIgnore.add(secondToken);
}
const hasExtraParens = node.parent.type === "ExportDefaultDeclaration" ? hasExcessParensWithPrecedence(node, PRECEDENCE_OF_ASSIGNMENT_EXPR) : hasExcessParens(node);
if (hasExtraParens)
report(node);
}
function pathToAncestor(node, ancestor) {
const path = [node];
let currentNode = node;
while (currentNode !== ancestor) {
currentNode = currentNode.parent;
if (currentNode === null || currentNode === void 0)
throw new Error("Nodes are not in the ancestor-descendant relationship.");
path.push(currentNode);
}
return path;
}
function pathToDescendant(node, descendant) {
return pathToAncestor(descendant, node).reverse();
}
function isSafelyEnclosingInExpression(node, child) {
switch (node.type) {
case "ArrayExpression":
case "ArrayPattern":
case "BlockStatement":
case "ObjectExpression":
case "ObjectPattern":
case "TemplateLiteral":
return true;
case "ArrowFunctionExpression":
case "FunctionExpression":
return node.params.includes(child);
case "CallExpression":
case "NewExpression":
return node.arguments.includes(child);
case "MemberExpression":
return node.computed && node.property === child;
case "ConditionalExpression":
return node.consequent === child;
default:
return false;
}
}
function startNewReportsBuffering() {
reportsBuffer = {
upper: reportsBuffer,
inExpressionNodes: [],
reports: []
};
}
function endCurrentReportsBuffering() {
const { upper, inExpressionNodes, reports } = reportsBuffer ?? {};
if (upper) {
upper.inExpressionNodes.push(...inExpressionNodes ?? []);
upper.reports.push(...reports ?? []);
} else {
reports?.forEach(({ finishReport }) => finishReport());
}
reportsBuffer = upper;
}
function isInCurrentReportsBuffer(node) {
return reportsBuffer?.reports.some((r) => r.node === node);
}
function removeFromCurrentReportsBuffer(node) {
if (reportsBuffer)
reportsBuffer.reports = reportsBuffer.reports.filter((r) => r.node !== node);
}
function isMemberExpInNewCallee(node) {
if (node.type === "MemberExpression") {
return node.parent.type === "NewExpression" && node.parent.callee === node ? true : "object" in node.parent && node.parent.object === node && isMemberExpInNewCallee(node.parent);
}
return false;
}
function isAnonymousFunctionAssignmentException({ left, operator, right }) {
if (left.type === "Identifier" && ["=", "&&=", "||=", "??="].includes(operator)) {
const rhsType = right.type;
if (rhsType === "ArrowFunctionExpression")
return true;
if ((rhsType === "FunctionExpression" || rhsType === "ClassExpression") && !right.id)
return true;
}
return false;
}
return {
ArrayExpression(node) {
node.elements.filter((e) => !!e && hasExcessParensWithPrecedence(e, PRECEDENCE_OF_ASSIGNMENT_EXPR)).forEach(report);
},
ArrayPattern(node) {
node.elements.filter((e) => !!e && canBeAssignmentTarget(e) && hasExcessParens(e)).forEach(report);
},
ArrowFunctionExpression(node) {
if (isReturnAssignException(node))
return;
if (node.body.type === "ConditionalExpression" && IGNORE_ARROW_CONDITIONALS) {
return;
}
if (node.body.type !== "BlockStatement") {
const firstBodyToken = sourceCode.getFirstToken(node.body, utils.isNotOpeningParenToken);
const tokenBeforeFirst = sourceCode.getTokenBefore(firstBodyToken);
if (utils.isOpeningParenToken(tokenBeforeFirst) && utils.isOpeningBraceToken(firstBodyToken))
tokensToIgnore.add(firstBodyToken);
if (hasExcessParensWithPrecedence(node.body, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(node.body);
}
},
AssignmentExpression(node) {
if (canBeAssignmentTarget(node.left) && hasExcessParens(node.left) && (!isAnonymousFunctionAssignmentException(node) || isParenthesisedTwice(node.left))) {
report(node.left);
}
if (!isReturnAssignException(node) && hasExcessParensWithPrecedence(node.right, precedence(node)))
report(node.right);
},
BinaryExpression(node) {
if (reportsBuffer && node.operator === "in")
reportsBuffer.inExpressionNodes.push(node);
checkBinaryLogical(node);
},
"CallExpression": checkCallNew,
ConditionalExpression(node) {
if (isReturnAssignException(node))
return;
const availableTypes = /* @__PURE__ */ new Set(["BinaryExpression", "LogicalExpression"]);
if (!(EXCEPT_COND_TERNARY && availableTypes.has(node.test.type)) && !isCondAssignException(node) && hasExcessParensWithPrecedence(node.test, precedence({ type: "LogicalExpression", operator: "||" }))) {
report(node.test);
}
if (!(EXCEPT_COND_TERNARY && availableTypes.has(node.consequent.type)) && hasExcessParensWithPrecedence(node.consequent, PRECEDENCE_OF_ASSIGNMENT_EXPR)) {
report(node.consequent);
}
if (!(EXCEPT_COND_TERNARY && availableTypes.has(node.alternate.type)) && hasExcessParensWithPrecedence(node.alternate, PRECEDENCE_OF_ASSIGNMENT_EXPR)) {
report(node.alternate);
}
},
DoWhileStatement(node) {
if (hasExcessParens(node.test) && !isCondAssignException(node))
report(node.test);
},
"ExportDefaultDeclaration": (node) => checkExpressionOrExportStatement(node.declaration),
"ExpressionStatement": (node) => checkExpressionOrExportStatement(node.expression),
ForInStatement(node) {
if (node.left.type !== "VariableDeclaration") {
const firstLeftToken = sourceCode.getFirstToken(node.left, utils.isNotOpeningParenToken);
if (firstLeftToken.value === "let" && utils.isOpeningBracketToken(
sourceCode.getTokenAfter(firstLeftToken, utils.isNotClosingParenToken)
)) {
tokensToIgnore.add(firstLeftToken);
}
}
if (hasExcessParens(node.left))
report(node.left);
if (hasExcessParens(node.right))
report(node.right);
},
ForOfStatement(node) {
if (node.left.type !== "VariableDeclaration") {
const firstLeftToken = sourceCode.getFirstToken(node.left, utils.isNotOpeningParenToken);
if (firstLeftToken.value === "let") {
tokensToIgnore.add(firstLeftToken);
}
}
if (hasExcessParens(node.left))
report(node.left);
if (hasExcessParensWithPrecedence(node.right, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(node.right);
},
ForStatement(node) {
if (node.test && hasExcessParens(node.test) && !isCondAssignException(node))
report(node.test);
if (node.update && hasExcessParens(node.update))
report(node.update);
if (node.init) {
if (node.init.type !== "VariableDeclaration") {
const firstToken = sourceCode.getFirstToken(node.init, utils.isNotOpeningParenToken);
if (firstToken.value === "let" && utils.isOpeningBracketToken(
sourceCode.getTokenAfter(firstToken, utils.isNotClosingParenToken)
)) {
tokensToIgnore.add(firstToken);
}
}
startNewReportsBuffering();
if (hasExcessParens(node.init))
report(node.init);
}
},
"ForStatement > *.init:exit": function(node) {
if (reportsBuffer?.reports.length) {
reportsBuffer.inExpressionNodes.forEach((inExpressionNode) => {
const path = pathToDescendant(node, inExpressionNode);
let nodeToExclude = null;
for (let i = 0; i < path.length; i++) {
const pathNode = path[i];
if (i < path.length - 1) {
const nextPathNode = path[i + 1];
if (isSafelyEnclosingInExpression(pathNode, nextPathNode)) {
return;
}
}
if (isParenthesised(pathNode)) {
if (isInCurrentReportsBuffer(pathNode)) {
if (isParenthesisedTwice(pathNode)) {
return;
}
if (!nodeToExclude)
nodeToExclude = pathNode;
} else {
return;
}
}
}
if (nodeToExclude)
removeFromCurrentReportsBuffer(nodeToExclude);
});
}
endCurrentReportsBuffering();
},
IfStatement(node) {
if (hasExcessParens(node.test) && !isCondAssignException(node))
report(node.test);
},
ImportExpression(node) {
const { source } = node;
if (source.type === "SequenceExpression") {
if (hasDoubleExcessParens(source))
report(source);
} else if (hasExcessParens(source)) {
report(source);
}
},
"LogicalExpression": checkBinaryLogical,
MemberExpression(node) {
const shouldAllowWrapOnce = isMemberExpInNewCallee(node) && doesMemberExpressionContainCallExpression(node);
const nodeObjHasExcessParens = shouldAllowWrapOnce ? hasDoubleExcessParens(node.object) : hasExcessParens(node.object) && !(isImmediateFunctionPrototypeMethodCall(node.parent) && "callee" in node.parent && node.parent.callee === node && IGNORE_FUNCTION_PROTOTYPE_METHODS);
if (nodeObjHasExcessParens && precedence(node.object) >= precedence(node) && (node.computed || !(utils.isDecimalInteger(node.object) || node.object.type === "Literal" && "regex" in node.object && node.object.regex))) {
report(node.object);
}
if (nodeObjHasExcessParens && node.object.type === "CallExpression") {
report(node.object);
}
if (nodeObjHasExcessParens && !IGNORE_NEW_IN_MEMBER_EXPR && node.object.type === "NewExpression" && isNewExpressionWithParens(node.object)) {
report(node.object);
}
if (nodeObjHasExcessParens && node.optional && node.object.type === "ChainExpression") {
report(node.object);
}
if (node.computed && hasExcessParens(node.property))
report(node.property);
},
"MethodDefinition[computed=true]": function(node) {
if (hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(node.key);
},
"NewExpression": checkCallNew,
ObjectExpression(node) {
node.properties.filter((property) => property.type === "Property" && property.value && hasExcessParensWithPrecedence(property.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)).forEach((property) => report(property.value));
},
ObjectPattern(node) {
node.properties.filter((property) => {
const value = property.value;
return value && canBeAssignmentTarget(value) && hasExcessParens(value);
}).forEach((property) => report(property.value));
},
Property(node) {
if (node.computed) {
const { key } = node;
if (key && hasExcessParensWithPrecedence(key, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(key);
}
},
PropertyDefinition(node) {
if (node.computed && hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(node.key);
if (node.value && hasExcessParensWithPrecedence(node.value, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(node.value);
},
RestElement(node) {
const argument = node.argument;
if (canBeAssignmentTarget(argument) && hasExcessParens(argument))
report(argument);
},
ReturnStatement(node) {
const returnToken = sourceCode.getFirstToken(node);
if (isReturnAssignException(node))
return;
if (node.argument && returnToken && hasExcessParensNoLineTerminator(returnToken, node.argument) && !(node.argument.type === "Literal" && "regex" in node.argument && node.argument.regex)) {
report(node.argument);
}
},
SequenceExpression(node) {
const precedenceOfNode = precedence(node);
node.expressions.filter((e) => hasExcessParensWithPrecedence(e, precedenceOfNode)).forEach(report);
},
SwitchCase(node) {
if (node.test && hasExcessParens(node.test))
report(node.test);
},
SwitchStatement(node) {
if (hasExcessParens(node.discriminant))
report(node.discriminant);
},
ThrowStatement(node) {
const throwToken = sourceCode.getFirstToken(node);
if (throwToken && node.argument && hasExcessParensNoLineTerminator(throwToken, node.argument))
report(node.argument);
},
"UnaryExpression": checkArgumentWithPrecedence,
UpdateExpression(node) {
if (node.prefix) {
checkArgumentWithPrecedence(node);
} else {
const { argument } = node;
const operatorToken = sourceCode.getLastToken(node);
if (argument.loc.end.line === operatorToken.loc.start.line) {
checkArgumentWithPrecedence(node);
} else {
if (hasDoubleExcessParens(argument))
report(argument);
}
}
},
"AwaitExpression": checkArgumentWithPrecedence,
VariableDeclarator(node) {
if (node.init && hasExcessParensWithPrecedence(node.init, PRECEDENCE_OF_ASSIGNMENT_EXPR) && !(node.init.type === "Literal" && "regex" in node.init && node.init.regex)) {
report(node.init);
}
},
WhileStatement(node) {
if (hasExcessParens(node.test) && !isCondAssignException(node))
report(node.test);
},
WithStatement(node) {
if (hasExcessParens(node.object))
report(node.object);
},
YieldExpression(node) {
if (node.argument) {
const yieldToken = sourceCode.getFirstToken(node);
if (precedence(node.argument) >= precedence(node) && yieldToken && hasExcessParensNoLineTerminator(yieldToken, node.argument) || hasDoubleExcessParens(node.argument)) {
report(node.argument);
}
}
},
"ClassDeclaration": checkClass,
"ClassExpression": checkClass,
"SpreadElement": checkSpreadOperator,
"SpreadProperty": checkSpreadOperator,
TemplateLiteral(node) {
node.expressions.filter((e) => e && hasExcessParens(e)).forEach(report);
},
AssignmentPattern(node) {
const { left, right } = node;
if (canBeAssignmentTarget(left) && hasExcessParens(left))
report(left);
if (right && hasExcessParensWithPrecedence(right, PRECEDENCE_OF_ASSIGNMENT_EXPR))
report(right);
},
// This listener is exposed for TypeScript rule to consume
TSStringKeyword(node) {
if (hasExcessParens(node))
report(node);
}
};
}
});
const baseRule = /* @__PURE__ */ utils.castRuleModule(_baseRule);
var noExtraParens = utils.createRule({
name: "no-extra-parens",
package: "ts",
meta: {
type: "layout",
docs: {
description: "Disallow unnecessary parentheses"
},
fixable: "code",
hasSuggestions: baseRule.meta.hasSuggestions,
schema: baseRule.meta.schema,
messages: baseRule.meta.messages
},
defaultOptions: ["all"],
create(context) {
const sourceCode = context.sourceCode;
const rules = baseRule.create(context);
function binaryExp(node) {
const rule = rules.BinaryExpression;
const isLeftTypeAssertion = astUtils.isTypeAssertion(node.left);
const isRightTypeAssertion = astUtils.isTypeAssertion(node.right);
if (isLeftTypeAssertion && isRightTypeAssertion)
return;
if (isLeftTypeAssertion) {
return rule({
...node,
left: {
...node.left,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
if (isRightTypeAssertion) {
return rule({
...node,
right: {
...node.right,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
return rule(node);
}
function callExp(node) {
const rule = rules.CallExpression;
if (astUtils.isTypeAssertion(node.callee)) {
return rule({
...node,
callee: {
...node.callee,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
if (node.typeArguments && node.arguments.length === 1 && sourceCode.getTokenAfter(node.callee, astUtils.isOpeningParenToken) !== sourceCode.getTokenBefore(node.arguments[0], astUtils.isOpeningParenToken)) {
return rule({
...node,
arguments: [
{
...node.arguments[0],
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
]
});
}
return rule(node);
}
function unaryUpdateExpression(node) {
const rule = rules.UnaryExpression;
if (astUtils.isTypeAssertion(node.argument)) {
return rule({
...node,
argument: {
...node.argument,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
return rule(node);
}
const overrides = {
ArrayExpression(node) {
return rules.ArrayExpression({
...node,
elements: node.elements.map(
(element) => astUtils.isTypeAssertion(element) ? { ...element, type: utils$1.AST_NODE_TYPES.FunctionExpression } : element
)
});
},
ArrowFunctionExpression(node) {
if (!astUtils.isTypeAssertion(node.body))
return rules.ArrowFunctionExpression(node);
},
// AssignmentExpression
AwaitExpression(node) {
if (astUtils.isTypeAssertion(node.argument)) {
return rules.AwaitExpression({
...node,
argument: {
...node.argument,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
return rules.AwaitExpression(node);
},
"BinaryExpression": binaryExp,
"CallExpression": callExp,
ClassDeclaration(node) {
if (node.superClass?.type === utils$1.AST_NODE_TYPES.TSAsExpression) {
return rules.ClassDeclaration({
...node,
superClass: {
...node.superClass,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
return rules.ClassDeclaration(node);
},
ClassExpression(node) {
if (node.superClass?.type === utils$1.AST_NODE_TYPES.TSAsExpression) {
return rules.ClassExpression({
...node,
superClass: {
...node.superClass,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
return rules.ClassExpression(node);
},
ConditionalExpression(node) {
if (astUtils.isTypeAssertion(node.test)) {
return rules.ConditionalExpression({
...node,
test: {
...node.test,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
if (astUtils.isTypeAssertion(node.consequent)) {
return rules.ConditionalExpression({
...node,
consequent: {
...node.consequent,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
if (astUtils.isTypeAssertion(node.alternate)) {
return rules.ConditionalExpression({
...node,
alternate: {
...node.alternate,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
return rules.ConditionalExpression(node);
},
// DoWhileStatement
// ForIn and ForOf are guarded by eslint version
ForStatement(node) {
if (node.init && astUtils.isTypeAssertion(node.init)) {
return rules.ForStatement({
...node,
init: null
});
}
if (node.test && astUtils.isTypeAssertion(node.test)) {
return rules.ForStatement({
...node,
test: null
});
}
if (node.update && astUtils.isTypeAssertion(node.update)) {
return rules.ForStatement({
...node,
update: null
});
}
return rules.ForStatement(node);
},
"ForStatement > *.init:exit": function(node) {
if (!astUtils.isTypeAssertion(node))
return rules["ForStatement > *.init:exit"](node);
},
// IfStatement
"LogicalExpression": binaryExp,
MemberExpression(node) {
if (astUtils.isTypeAssertion(node.object)) {
return rules.MemberExpression({
...node,
object: {
...node.object,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
if (astUtils.isTypeAssertion(node.property)) {
return rules.MemberExpression({
...node,
property: {
...node.property,
type: utils$1.AST_NODE_TYPES.FunctionExpression
}
});
}
return rules.MemberExpression(node);
},
"NewExpression": callExp,
// ObjectExpression
// ReturnStatement
// SequenceExpression
SpreadElement(node) {
if (!astUtils.isTypeAssertion(node.argument))
return rules.SpreadElement(node);
},
SwitchCase(node) {
if (node.test && !astUtils.isTypeAssertion(node.test))
return rules.SwitchCase(node);
},
// SwitchStatement
ThrowStatement(node) {
if (node.argument && !astUtils.isTypeAssertion(node.argument))
return rules.ThrowStatement(node);
},
"UnaryExpression": unaryUpdateExpression,
UpdateExpression(node) {
if (astUtils.isTypeAssertion(node.argument)) {
return unaryUpdateExpression(node);
}
return rules.UpdateExpression(node);
},
// VariableDeclarator
VariableDeclarator(node) {
if (astUtils.isTypeAssertion(node.init)) {
return rules.VariableDeclarator({
...node,
type: utils$1.AST_NODE_TYPES.VariableDeclarator,
init: {
...node.init,
type: utils$1.AST_NODE_TYPES.FunctionExpression
}
});
}
return rules.VariableDeclarator(node);
},
// WhileStatement
// WithStatement - i'm not going to even bother implementing this terrible and never used feature
YieldExpression(node) {
if (node.argument && !astUtils.isTypeAssertion(node.argument))
return rules.YieldExpression(node);
},
ForInStatement(node) {
if (astUtils.isTypeAssertion(node.right)) {
return;
}
return rules.ForInStatement(node);
},
ForOfStatement(node) {
if (astUtils.isTypeAssertion(node.right)) {
return rules.ForOfStatement({
...node,
type: utils$1.AST_NODE_TYPES.ForOfStatement,
right: {
...node.right,
type: utils$1.AST_NODE_TYPES.SequenceExpression
}
});
}
return rules.ForOfStatement(node);
},
TSStringKeyword(node) {
return rules.TSStringKeyword({
...node,
type: utils$1.AST_NODE_TYPES.FunctionExpression
});
}
};
return Object.assign({}, rules, overrides);
}
});
module.exports = noExtraParens;
@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const add = require("./add.js");
const addDays = require("./addDays.js");
const addHours = require("./addHours.js");
const addMilliseconds = require("./addMilliseconds.js");
const addMinutes = require("./addMinutes.js");
const addMonths = require("./addMonths.js");
const addSeconds = require("./addSeconds.js");
const addYears = require("./addYears.js");
const compile = require("./compile.js");
const dayOfYear = require("./dayOfYear.js");
const daysInMonth = require("./daysInMonth.js");
const diff = require("./diff.js");
const diffInDays = require("./diffInDays.js");
const diffInHours = require("./diffInHours.js");
const diffInMilliseconds = require("./diffInMilliseconds.js");
const diffInMinutes = require("./diffInMinutes.js");
const diffInMonths = require("./diffInMonths.js");
const diffInSeconds = require("./diffInSeconds.js");
const diffInYears = require("./diffInYears.js");
const endOf = require("./endOf.js");
const format = require("./format.js");
const get = require("./set-Bwi5SIy8.js");
const isAfter = require("./isAfter.js");
const isBefore = require("./isBefore.js");
const isBetween = require("./isBetween.js");
const isLeapYear = require("./isLeapYear.js");
const isSame = require("./isSame.js");
const isSameOrAfter = require("./isSameOrAfter.js");
const isSameOrBefore = require("./isSameOrBefore.js");
const isValid = require("./isValid.js");
const parse = require("./parse.js");
const startOf = require("./startOf.js");
const subDays = require("./subDays.js");
const subHours = require("./subHours.js");
const subMilliseconds = require("./subMilliseconds.js");
const subMinutes = require("./subMinutes.js");
const subMonths = require("./subMonths.js");
const subSeconds = require("./subSeconds.js");
const subYears = require("./subYears.js");
const subtract = require("./subtract.js");
const units = require("./units.js");
exports.add = add;
exports.addDays = addDays;
exports.addHours = addHours;
exports.addMilliseconds = addMilliseconds;
exports.addMinutes = addMinutes;
exports.addMonths = addMonths;
exports.addSeconds = addSeconds;
exports.addYears = addYears;
exports.compile = compile;
exports.dayOfYear = dayOfYear;
exports.daysInMonth = daysInMonth;
exports.diff = diff;
exports.diffInDays = diffInDays;
exports.diffInHours = diffInHours;
exports.diffInMilliseconds = diffInMilliseconds;
exports.diffInMinutes = diffInMinutes;
exports.diffInMonths = diffInMonths;
exports.diffInSeconds = diffInSeconds;
exports.diffInYears = diffInYears;
exports.endOf = endOf;
exports.format = format;
exports.get = get.get;
exports.set = get.set;
exports.isAfter = isAfter;
exports.isBefore = isBefore;
exports.isBetween = isBetween;
exports.isLeapYear = isLeapYear;
exports.isSame = isSame;
exports.isSameOrAfter = isSameOrAfter;
exports.isSameOrBefore = isSameOrBefore;
exports.isValid = isValid;
exports.parse = parse;
exports.startOf = startOf;
exports.subDays = subDays;
exports.subHours = subHours;
exports.subMilliseconds = subMilliseconds;
exports.subMinutes = subMinutes;
exports.subMonths = subMonths;
exports.subSeconds = subSeconds;
exports.subYears = subYears;
exports.subtract = subtract;
exports.units = units;
@@ -0,0 +1,31 @@
'use strict';
var callBound = require('call-bound');
var safeRegexTest = require('safe-regex-test');
var isFnRegex = safeRegexTest(/^\s*(?:function)?\*/);
var hasToStringTag = require('has-tostringtag/shams')();
var getProto = require('get-proto');
var toStr = callBound('Object.prototype.toString');
var fnToStr = callBound('Function.prototype.toString');
var getGeneratorFunction = require('generator-function');
/** @type {import('.')} */
module.exports = function isGeneratorFunction(fn) {
if (typeof fn !== 'function') {
return false;
}
if (isFnRegex(fnToStr(fn))) {
return true;
}
if (!hasToStringTag) {
var str = toStr(fn);
return str === '[object GeneratorFunction]';
}
if (!getProto) {
return false;
}
var GeneratorFunction = getGeneratorFunction();
return GeneratorFunction && getProto(fn) === GeneratorFunction.prototype;
};
@@ -0,0 +1,921 @@
/**
* react-router v7.9.5
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
"use client";
import {
RSCRouterGlobalErrorBoundary,
deserializeErrors,
getHydrationData,
populateRSCRouteModules
} from "./chunk-JG3XND5A.mjs";
import {
CRITICAL_CSS_DATA_ATTRIBUTE,
ErrorResponseImpl,
FrameworkContext,
RSCRouterContext,
RemixErrorBoundary,
RouterProvider,
UNSTABLE_TransitionEnabledRouterProvider,
createBrowserHistory,
createClientRoutes,
createClientRoutesWithHMRRevalidationOptOut,
createContext,
createRequestInit,
createRouter,
decodeViaTurboStream,
getPatchRoutesOnNavigationFunction,
getSingleFetchDataStrategyImpl,
getTurboStreamSingleFetchDataStrategy,
hydrationRouteProperties,
invariant,
isMutationMethod,
mapRouteProperties,
noActionDefinedError,
setIsHydrated,
shouldHydrateRouteLoader,
singleFetchUrl,
stripIndexParam,
useFogOFWarDiscovery
} from "./chunk-UIGDSWPH.mjs";
// lib/dom-export/dom-router-provider.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
function RouterProvider2(props) {
return /* @__PURE__ */ React.createElement(RouterProvider, { flushSync: ReactDOM.flushSync, ...props });
}
// lib/dom-export/hydrated-router.tsx
import * as React2 from "react";
var ssrInfo = null;
var router = null;
function initSsrInfo() {
if (!ssrInfo && window.__reactRouterContext && window.__reactRouterManifest && window.__reactRouterRouteModules) {
if (window.__reactRouterManifest.sri === true) {
const importMap = document.querySelector("script[rr-importmap]");
if (importMap?.textContent) {
try {
window.__reactRouterManifest.sri = JSON.parse(
importMap.textContent
).integrity;
} catch (err) {
console.error("Failed to parse import map", err);
}
}
}
ssrInfo = {
context: window.__reactRouterContext,
manifest: window.__reactRouterManifest,
routeModules: window.__reactRouterRouteModules,
stateDecodingPromise: void 0,
router: void 0,
routerInitialized: false
};
}
}
function createHydratedRouter({
getContext,
unstable_instrumentations
}) {
initSsrInfo();
if (!ssrInfo) {
throw new Error(
"You must be using the SSR features of React Router in order to skip passing a `router` prop to `<RouterProvider>`"
);
}
let localSsrInfo = ssrInfo;
if (!ssrInfo.stateDecodingPromise) {
let stream = ssrInfo.context.stream;
invariant(stream, "No stream found for single fetch decoding");
ssrInfo.context.stream = void 0;
ssrInfo.stateDecodingPromise = decodeViaTurboStream(stream, window).then((value) => {
ssrInfo.context.state = value.value;
localSsrInfo.stateDecodingPromise.value = true;
}).catch((e) => {
localSsrInfo.stateDecodingPromise.error = e;
});
}
if (ssrInfo.stateDecodingPromise.error) {
throw ssrInfo.stateDecodingPromise.error;
}
if (!ssrInfo.stateDecodingPromise.value) {
throw ssrInfo.stateDecodingPromise;
}
let routes = createClientRoutes(
ssrInfo.manifest.routes,
ssrInfo.routeModules,
ssrInfo.context.state,
ssrInfo.context.ssr,
ssrInfo.context.isSpaMode
);
let hydrationData = void 0;
if (ssrInfo.context.isSpaMode) {
let { loaderData } = ssrInfo.context.state;
if (ssrInfo.manifest.routes.root?.hasLoader && loaderData && "root" in loaderData) {
hydrationData = {
loaderData: {
root: loaderData.root
}
};
}
} else {
hydrationData = getHydrationData({
state: ssrInfo.context.state,
routes,
getRouteInfo: (routeId) => ({
clientLoader: ssrInfo.routeModules[routeId]?.clientLoader,
hasLoader: ssrInfo.manifest.routes[routeId]?.hasLoader === true,
hasHydrateFallback: ssrInfo.routeModules[routeId]?.HydrateFallback != null
}),
location: window.location,
basename: window.__reactRouterContext?.basename,
isSpaMode: ssrInfo.context.isSpaMode
});
if (hydrationData && hydrationData.errors) {
hydrationData.errors = deserializeErrors(hydrationData.errors);
}
}
let router2 = createRouter({
routes,
history: createBrowserHistory(),
basename: ssrInfo.context.basename,
getContext,
hydrationData,
hydrationRouteProperties,
unstable_instrumentations,
mapRouteProperties,
future: {
middleware: ssrInfo.context.future.v8_middleware
},
dataStrategy: getTurboStreamSingleFetchDataStrategy(
() => router2,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.basename
),
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode,
ssrInfo.context.basename
)
});
ssrInfo.router = router2;
if (router2.state.initialized) {
ssrInfo.routerInitialized = true;
router2.initialize();
}
router2.createRoutesForHMR = /* spacer so ts-ignore does not affect the right hand of the assignment */
createClientRoutesWithHMRRevalidationOptOut;
window.__reactRouterDataRouter = router2;
return router2;
}
function HydratedRouter(props) {
if (!router) {
router = createHydratedRouter({
getContext: props.getContext,
unstable_instrumentations: props.unstable_instrumentations
});
}
let [criticalCss, setCriticalCss] = React2.useState(
process.env.NODE_ENV === "development" ? ssrInfo?.context.criticalCss : void 0
);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development") {
setCriticalCss(void 0);
}
}, []);
React2.useEffect(() => {
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
document.querySelectorAll(`[${CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
}
}, [criticalCss]);
let [location2, setLocation] = React2.useState(router.state.location);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router && !ssrInfo.routerInitialized) {
ssrInfo.routerInitialized = true;
ssrInfo.router.initialize();
}
}, []);
React2.useLayoutEffect(() => {
if (ssrInfo && ssrInfo.router) {
return ssrInfo.router.subscribe((newState) => {
if (newState.location !== location2) {
setLocation(newState.location);
}
});
}
}, [location2]);
invariant(ssrInfo, "ssrInfo unavailable for HydratedRouter");
useFogOFWarDiscovery(
router,
ssrInfo.manifest,
ssrInfo.routeModules,
ssrInfo.context.ssr,
ssrInfo.context.routeDiscovery,
ssrInfo.context.isSpaMode
);
return (
// This fragment is important to ensure we match the <ServerRouter> JSX
// structure so that useId values hydrate correctly
/* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
FrameworkContext.Provider,
{
value: {
manifest: ssrInfo.manifest,
routeModules: ssrInfo.routeModules,
future: ssrInfo.context.future,
criticalCss,
ssr: ssrInfo.context.ssr,
isSpaMode: ssrInfo.context.isSpaMode,
routeDiscovery: ssrInfo.context.routeDiscovery
}
},
/* @__PURE__ */ React2.createElement(RemixErrorBoundary, { location: location2 }, /* @__PURE__ */ React2.createElement(
RouterProvider2,
{
router,
unstable_onError: props.unstable_onError
}
))
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
);
}
// lib/rsc/browser.tsx
import * as React3 from "react";
import * as ReactDOM2 from "react-dom";
function createCallServer({
createFromReadableStream,
createTemporaryReferenceSet,
encodeReply,
fetch: fetchImplementation = fetch
}) {
const globalVar = window;
let landedActionId = 0;
return async (id, args) => {
let actionId = globalVar.__routerActionID = (globalVar.__routerActionID ?? (globalVar.__routerActionID = 0)) + 1;
const temporaryReferences = createTemporaryReferenceSet();
const payloadPromise = fetchImplementation(
new Request(location.href, {
body: await encodeReply(args, { temporaryReferences }),
method: "POST",
headers: {
Accept: "text/x-component",
"rsc-action-id": id
}
})
).then((response) => {
if (!response.body) {
throw new Error("No response body");
}
return createFromReadableStream(response.body, {
temporaryReferences
});
});
globalVar.__reactRouterDataRouter.__setPendingRerender(
Promise.resolve(payloadPromise).then(async (payload) => {
if (payload.type === "redirect") {
if (payload.reload || isExternalLocation(payload.location)) {
window.location.href = payload.location;
return () => {
};
}
return () => {
globalVar.__reactRouterDataRouter.navigate(payload.location, {
replace: payload.replace
});
};
}
if (payload.type !== "action") {
throw new Error("Unexpected payload type");
}
const rerender = await payload.rerender;
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
if (rerender.type === "redirect") {
if (rerender.reload || isExternalLocation(rerender.location)) {
window.location.href = rerender.location;
return;
}
return () => {
globalVar.__reactRouterDataRouter.navigate(rerender.location, {
replace: rerender.replace
});
};
}
return () => {
let lastMatch;
for (const match of rerender.matches) {
globalVar.__reactRouterDataRouter.patchRoutes(
lastMatch?.id ?? null,
[createRouteFromServerManifest(match)],
true
);
lastMatch = match;
}
window.__reactRouterDataRouter._internalSetStateDoNotUseOrYouWillBreakYourApp(
{
loaderData: Object.assign(
{},
globalVar.__reactRouterDataRouter.state.loaderData,
rerender.loaderData
),
errors: rerender.errors ? Object.assign(
{},
globalVar.__reactRouterDataRouter.state.errors,
rerender.errors
) : null
}
);
};
}
return () => {
};
}).catch(() => {
})
);
return payloadPromise.then((payload) => {
if (payload.type !== "action" && payload.type !== "redirect") {
throw new Error("Unexpected payload type");
}
return payload.actionResult;
});
};
}
function createRouterFromPayload({
fetchImplementation,
createFromReadableStream,
getContext,
payload
}) {
const globalVar = window;
if (globalVar.__reactRouterDataRouter && globalVar.__reactRouterRouteModules)
return {
router: globalVar.__reactRouterDataRouter,
routeModules: globalVar.__reactRouterRouteModules
};
if (payload.type !== "render") throw new Error("Invalid payload type");
globalVar.__reactRouterRouteModules = globalVar.__reactRouterRouteModules ?? {};
populateRSCRouteModules(globalVar.__reactRouterRouteModules, payload.matches);
let patches = /* @__PURE__ */ new Map();
payload.patches?.forEach((patch) => {
invariant(patch.parentId, "Invalid patch parentId");
if (!patches.has(patch.parentId)) {
patches.set(patch.parentId, []);
}
patches.get(patch.parentId)?.push(patch);
});
let routes = payload.matches.reduceRight((previous, match) => {
const route = createRouteFromServerManifest(
match,
payload
);
if (previous.length > 0) {
route.children = previous;
let childrenToPatch = patches.get(match.id);
if (childrenToPatch) {
route.children.push(
...childrenToPatch.map((r) => createRouteFromServerManifest(r))
);
}
}
return [route];
}, []);
globalVar.__reactRouterDataRouter = createRouter({
routes,
getContext,
basename: payload.basename,
history: createBrowserHistory(),
hydrationData: getHydrationData({
state: {
loaderData: payload.loaderData,
actionData: payload.actionData,
errors: payload.errors
},
routes,
getRouteInfo: (routeId) => {
let match = payload.matches.find((m) => m.id === routeId);
invariant(match, "Route not found in payload");
return {
clientLoader: match.clientLoader,
hasLoader: match.hasLoader,
hasHydrateFallback: match.hydrateFallbackElement != null
};
},
location: payload.location,
basename: payload.basename,
isSpaMode: false
}),
async patchRoutesOnNavigation({ path, signal }) {
if (discoveredPaths.has(path)) {
return;
}
await fetchAndApplyManifestPatches(
[path],
createFromReadableStream,
fetchImplementation,
signal
);
},
// FIXME: Pass `build.ssr` into this function
dataStrategy: getRSCSingleFetchDataStrategy(
() => globalVar.__reactRouterDataRouter,
true,
payload.basename,
createFromReadableStream,
fetchImplementation
)
});
if (globalVar.__reactRouterDataRouter.state.initialized) {
globalVar.__routerInitialized = true;
globalVar.__reactRouterDataRouter.initialize();
} else {
globalVar.__routerInitialized = false;
}
let lastLoaderData = void 0;
globalVar.__reactRouterDataRouter.subscribe(({ loaderData, actionData }) => {
if (lastLoaderData !== loaderData) {
globalVar.__routerActionID = (globalVar.__routerActionID ?? (globalVar.__routerActionID = 0)) + 1;
}
});
globalVar.__reactRouterDataRouter._updateRoutesForHMR = (routeUpdateByRouteId) => {
const oldRoutes = window.__reactRouterDataRouter.routes;
const newRoutes = [];
function walkRoutes(routes2, parentId) {
return routes2.map((route) => {
const routeUpdate = routeUpdateByRouteId.get(route.id);
if (routeUpdate) {
const {
routeModule,
hasAction,
hasComponent,
hasErrorBoundary,
hasLoader
} = routeUpdate;
const newRoute = createRouteFromServerManifest({
clientAction: routeModule.clientAction,
clientLoader: routeModule.clientLoader,
element: route.element,
errorElement: route.errorElement,
handle: route.handle,
hasAction,
hasComponent,
hasErrorBoundary,
hasLoader,
hydrateFallbackElement: route.hydrateFallbackElement,
id: route.id,
index: route.index,
links: routeModule.links,
meta: routeModule.meta,
parentId,
path: route.path,
shouldRevalidate: routeModule.shouldRevalidate
});
if (route.children) {
newRoute.children = walkRoutes(route.children, route.id);
}
return newRoute;
}
const updatedRoute = { ...route };
if (route.children) {
updatedRoute.children = walkRoutes(route.children, route.id);
}
return updatedRoute;
});
}
newRoutes.push(
...walkRoutes(oldRoutes, void 0)
);
window.__reactRouterDataRouter._internalSetRoutes(newRoutes);
};
return {
router: globalVar.__reactRouterDataRouter,
routeModules: globalVar.__reactRouterRouteModules
};
}
var renderedRoutesContext = createContext();
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
let dataStrategy = getSingleFetchDataStrategyImpl(
getRouter,
(match) => {
let M = match;
return {
hasLoader: M.route.hasLoader,
hasClientLoader: M.route.hasClientLoader,
hasComponent: M.route.hasComponent,
hasAction: M.route.hasAction,
hasClientAction: M.route.hasClientAction,
hasShouldRevalidate: M.route.hasShouldRevalidate
};
},
// pass map into fetchAndDecode so it can add payloads
getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation),
ssr,
basename,
// If the route has a component but we don't have an element, we need to hit
// the server loader flow regardless of whether the client loader calls
// `serverLoader` or not, otherwise we'll have nothing to render.
(match) => {
let M = match;
return M.route.hasComponent && !M.route.element;
}
);
return async (args) => args.runClientMiddleware(async () => {
let context = args.context;
context.set(renderedRoutesContext, []);
let results = await dataStrategy(args);
const renderedRoutesById = /* @__PURE__ */ new Map();
for (const route of context.get(renderedRoutesContext)) {
if (!renderedRoutesById.has(route.id)) {
renderedRoutesById.set(route.id, []);
}
renderedRoutesById.get(route.id).push(route);
}
for (const match of args.matches) {
const renderedRoutes = renderedRoutesById.get(match.route.id);
if (renderedRoutes) {
for (const rendered of renderedRoutes) {
window.__reactRouterDataRouter.patchRoutes(
rendered.parentId ?? null,
[createRouteFromServerManifest(rendered)],
true
);
}
}
}
return results;
});
}
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
return async (args, basename, targetRoutes) => {
let { request, context } = args;
let url = singleFetchUrl(request.url, basename, "rsc");
if (request.method === "GET") {
url = stripIndexParam(url);
if (targetRoutes) {
url.searchParams.set("_routes", targetRoutes.join(","));
}
}
let res = await fetchImplementation(
new Request(url, await createRequestInit(request))
);
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
throw new ErrorResponseImpl(res.status, res.statusText, await res.text());
}
invariant(res.body, "No response body to decode");
try {
const payload = await createFromReadableStream(res.body, {
temporaryReferences: void 0
});
if (payload.type === "redirect") {
return {
status: res.status,
data: {
redirect: {
redirect: payload.location,
reload: payload.reload,
replace: payload.replace,
revalidate: false,
status: payload.status
}
}
};
}
if (payload.type !== "render") {
throw new Error("Unexpected payload type");
}
context.get(renderedRoutesContext).push(...payload.matches);
let results = { routes: {} };
const dataKey = isMutationMethod(request.method) ? "actionData" : "loaderData";
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
results.routes[routeId] = { data };
}
if (payload.errors) {
for (let [routeId, error] of Object.entries(payload.errors)) {
results.routes[routeId] = { error };
}
}
return { status: res.status, data: results };
} catch (e) {
throw new Error("Unable to decode RSC response");
}
};
}
function RSCHydratedRouter({
createFromReadableStream,
fetch: fetchImplementation = fetch,
payload,
routeDiscovery = "eager",
getContext
}) {
if (payload.type !== "render") throw new Error("Invalid payload type");
let { router: router2, routeModules } = React3.useMemo(
() => createRouterFromPayload({
payload,
fetchImplementation,
getContext,
createFromReadableStream
}),
[createFromReadableStream, payload, fetchImplementation, getContext]
);
React3.useEffect(() => {
setIsHydrated();
}, []);
React3.useLayoutEffect(() => {
const globalVar = window;
if (!globalVar.__routerInitialized) {
globalVar.__routerInitialized = true;
globalVar.__reactRouterDataRouter.initialize();
}
}, []);
let [location2, setLocation] = React3.useState(router2.state.location);
React3.useLayoutEffect(
() => router2.subscribe((newState) => {
if (newState.location !== location2) {
setLocation(newState.location);
}
}),
[router2, location2]
);
React3.useEffect(() => {
if (routeDiscovery === "lazy" || // @ts-expect-error - TS doesn't know about this yet
window.navigator?.connection?.saveData === true) {
return;
}
function registerElement(el) {
let path = el.tagName === "FORM" ? el.getAttribute("action") : el.getAttribute("href");
if (!path) {
return;
}
let pathname = el.tagName === "A" ? el.pathname : new URL(path, window.location.origin).pathname;
if (!discoveredPaths.has(pathname)) {
nextPaths.add(pathname);
}
}
async function fetchPatches() {
document.querySelectorAll("a[data-discover], form[data-discover]").forEach(registerElement);
let paths = Array.from(nextPaths.keys()).filter((path) => {
if (discoveredPaths.has(path)) {
nextPaths.delete(path);
return false;
}
return true;
});
if (paths.length === 0) {
return;
}
try {
await fetchAndApplyManifestPatches(
paths,
createFromReadableStream,
fetchImplementation
);
} catch (e) {
console.error("Failed to fetch manifest patches", e);
}
}
let debouncedFetchPatches = debounce(fetchPatches, 100);
fetchPatches();
let observer = new MutationObserver(() => debouncedFetchPatches());
observer.observe(document.documentElement, {
subtree: true,
childList: true,
attributes: true,
attributeFilter: ["data-discover", "href", "action"]
});
}, [routeDiscovery, createFromReadableStream, fetchImplementation]);
const frameworkContext = {
future: {
// These flags have no runtime impact so can always be false. If we add
// flags that drive runtime behavior they'll need to be proxied through.
v8_middleware: false,
unstable_subResourceIntegrity: false
},
isSpaMode: false,
ssr: true,
criticalCss: "",
manifest: {
routes: {},
version: "1",
url: "",
entry: {
module: "",
imports: []
}
},
routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
routeModules
};
return /* @__PURE__ */ React3.createElement(RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(RSCRouterGlobalErrorBoundary, { location: location2 }, /* @__PURE__ */ React3.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(UNSTABLE_TransitionEnabledRouterProvider, { router: router2, flushSync: ReactDOM2.flushSync }))));
}
function createRouteFromServerManifest(match, payload) {
let hasInitialData = payload && match.id in payload.loaderData;
let initialData = payload?.loaderData[match.id];
let hasInitialError = payload?.errors && match.id in payload.errors;
let initialError = payload?.errors?.[match.id];
let isHydrationRequest = match.clientLoader?.hydrate === true || !match.hasLoader || // If the route has a component but we don't have an element, we need to hit
// the server loader flow regardless of whether the client loader calls
// `serverLoader` or not, otherwise we'll have nothing to render.
match.hasComponent && !match.element;
invariant(window.__reactRouterRouteModules);
populateRSCRouteModules(window.__reactRouterRouteModules, match);
let dataRoute = {
id: match.id,
element: match.element,
errorElement: match.errorElement,
handle: match.handle,
hasErrorBoundary: match.hasErrorBoundary,
hydrateFallbackElement: match.hydrateFallbackElement,
index: match.index,
loader: match.clientLoader ? async (args, singleFetch) => {
try {
let result = await match.clientLoader({
...args,
serverLoader: () => {
preventInvalidServerHandlerCall(
"loader",
match.id,
match.hasLoader
);
if (isHydrationRequest) {
if (hasInitialData) {
return initialData;
}
if (hasInitialError) {
throw initialError;
}
}
return callSingleFetch(singleFetch);
}
});
return result;
} finally {
isHydrationRequest = false;
}
} : (
// We always make the call in this RSC world since even if we don't
// have a `loader` we may need to get the `element` implementation
(_, singleFetch) => callSingleFetch(singleFetch)
),
action: match.clientAction ? (args, singleFetch) => match.clientAction({
...args,
serverAction: async () => {
preventInvalidServerHandlerCall(
"action",
match.id,
match.hasLoader
);
return await callSingleFetch(singleFetch);
}
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
throw noActionDefinedError("action", match.id);
},
path: match.path,
shouldRevalidate: match.shouldRevalidate,
// We always have a "loader" in this RSC world since even if we don't
// have a `loader` we may need to get the `element` implementation
hasLoader: true,
hasClientLoader: match.clientLoader != null,
hasAction: match.hasAction,
hasClientAction: match.clientAction != null,
hasShouldRevalidate: match.shouldRevalidate != null
};
if (typeof dataRoute.loader === "function") {
dataRoute.loader.hydrate = shouldHydrateRouteLoader(
match.id,
match.clientLoader,
match.hasLoader,
false
);
}
return dataRoute;
}
function callSingleFetch(singleFetch) {
invariant(typeof singleFetch === "function", "Invalid singleFetch parameter");
return singleFetch();
}
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
if (!hasHandler) {
let fn = type === "action" ? "serverAction()" : "serverLoader()";
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
console.error(msg);
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg), true);
}
}
var nextPaths = /* @__PURE__ */ new Set();
var discoveredPathsMaxSize = 1e3;
var discoveredPaths = /* @__PURE__ */ new Set();
var URL_LIMIT = 7680;
function getManifestUrl(paths) {
if (paths.length === 0) {
return null;
}
if (paths.length === 1) {
return new URL(`${paths[0]}.manifest`, window.location.origin);
}
const globalVar = window;
let basename = (globalVar.__reactRouterDataRouter.basename ?? "").replace(
/^\/|\/$/g,
""
);
let url = new URL(`${basename}/.manifest`, window.location.origin);
url.searchParams.set("paths", paths.sort().join(","));
return url;
}
async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
let url = getManifestUrl(paths);
if (url == null) {
return;
}
if (url.toString().length > URL_LIMIT) {
nextPaths.clear();
return;
}
let response = await fetchImplementation(new Request(url, { signal }));
if (!response.body || response.status < 200 || response.status >= 300) {
throw new Error("Unable to fetch new route matches from the server");
}
let payload = await createFromReadableStream(response.body, {
temporaryReferences: void 0
});
if (payload.type !== "manifest") {
throw new Error("Failed to patch routes");
}
paths.forEach((p) => addToFifoQueue(p, discoveredPaths));
payload.patches.forEach((p) => {
window.__reactRouterDataRouter.patchRoutes(
p.parentId ?? null,
[createRouteFromServerManifest(p)]
);
});
}
function addToFifoQueue(path, queue) {
if (queue.size >= discoveredPathsMaxSize) {
let first = queue.values().next().value;
queue.delete(first);
}
queue.add(path);
}
function debounce(callback, wait) {
let timeoutId;
return (...args) => {
window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(() => callback(...args), wait);
};
}
function isExternalLocation(location2) {
const newLocation = new URL(location2, window.location.href);
return newLocation.origin !== window.location.origin;
}
// lib/rsc/html-stream/browser.ts
function getRSCStream() {
let encoder = new TextEncoder();
let streamController = null;
let rscStream = new ReadableStream({
start(controller) {
if (typeof window === "undefined") {
return;
}
let handleChunk = (chunk) => {
if (typeof chunk === "string") {
controller.enqueue(encoder.encode(chunk));
} else {
controller.enqueue(chunk);
}
};
window.__FLIGHT_DATA || (window.__FLIGHT_DATA = []);
window.__FLIGHT_DATA.forEach(handleChunk);
window.__FLIGHT_DATA.push = (chunk) => {
handleChunk(chunk);
return 0;
};
streamController = controller;
}
});
if (typeof document !== "undefined" && document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", () => {
streamController?.close();
});
} else {
streamController?.close();
}
return rscStream;
}
export {
HydratedRouter,
RouterProvider2 as RouterProvider,
RSCHydratedRouter as unstable_RSCHydratedRouter,
createCallServer as unstable_createCallServer,
getRSCStream as unstable_getRSCStream
};
@@ -0,0 +1,41 @@
const path = require('path')
const fs = require('fs')
function tryRequirePkg(pkg) {
try {
return require(pkg);
} catch {
return null;
}
}
function copyDemiDir(dir) {
const src = path.join(__dirname, '..', 'dist', 'demi', dir)
const dest = path.join(__dirname, '..', 'dist')
fs.cpSync(src, dest, { recursive: true })
}
function modifyDts(path) {
const dts = fs.readFileSync(path, 'utf8')
const modifiedDts = dts.replace(/\.\.\/\.\.\/common/g, './common')
fs.writeFileSync(path, modifiedDts, 'utf8')
}
function postinstall() {
const nextjs = tryRequirePkg('next/package.json')
const react = tryRequirePkg('react/package.json')
const nextjsVersion = Number((nextjs?.version || '').split('.')[0])
const reactVersion = Number((react?.version || '').split('.')[0])
if (reactVersion === 18 && nextjsVersion < 15) {
copyDemiDir('react18')
} else {
copyDemiDir('react19')
}
modifyDts(path.join(__dirname, '..', 'dist', 'index.d.ts'))
}
postinstall();
@@ -0,0 +1 @@
{"version":3,"file":"break.d.ts","sourceRoot":"","sources":["break.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,6BANW,KAAK,MACL,OAAO,GAAG,SAAS,SACnB,KAAK,QACL,IAAI,GACF,MAAM,CAiBlB;2BA5BgC,OAAO;6BAAP,OAAO;2BACV,wBAAwB;0BAAxB,wBAAwB"}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more