update
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,24 @@
|
||||
const context = (() => {
|
||||
if (typeof globalThis !== "undefined") {
|
||||
return globalThis;
|
||||
} else if (typeof self !== "undefined") {
|
||||
return self;
|
||||
} else if (typeof window !== "undefined") {
|
||||
return window;
|
||||
} else {
|
||||
return Function("return this")();
|
||||
}
|
||||
})();
|
||||
const defines = __DEFINES__;
|
||||
Object.keys(defines).forEach((key) => {
|
||||
const segments = key.split(".");
|
||||
let target = context;
|
||||
for (let i = 0; i < segments.length; i++) {
|
||||
const segment = segments[i];
|
||||
if (i === segments.length - 1) {
|
||||
target[segment] = defines[key];
|
||||
} else {
|
||||
target = target[segment] || (target[segment] = {});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"Q H R S T U V W","2":"C L M G N O P","1025":"0 9 X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B qC rC","260":"0 9 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC"},D:{"1":"9B AC BC CC DC Q H R S T U V W","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC","132":"wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B","1025":"0 9 X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"2":"J PB K D E F A B sC SC tC uC vC wC TC","772":"C L M G FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"1":"xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB 4C 5C 6C 7C FC kC 8C GC","132":"kB lB mB nB oB pB qB rB sB tB uB vB wB","1025":"0 AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD HD ID","772":"JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"2":"A B C FC kC GC","1025":"H"},L:{"1025":"I"},M:{"260":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 iD jD kD lD mD IC JC KC nD","2":"J dD eD fD","132":"gD hD TC"},Q:{"132":"oD"},R:{"1025":"pD"},S:{"2":"qD","260":"rD"}},B:7,C:"Feature Policy",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E mC","36":"F A B"},B:{"1":"0 9 G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","36":"C L M"},C:{"1":"0 9 XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC qC","36":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB rC"},D:{"1":"0 9 XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","36":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB"},E:{"1":"E F A B C L M G vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J sC SC","36":"PB K D tC uC"},F:{"1":"0 2 3 4 5 6 7 8 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"F B 4C 5C 6C 7C FC","36":"1 C G N O P QB kC 8C GC"},G:{"1":"E DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC","36":"9C lC AD BD CD"},H:{"2":"WD"},I:{"1":"I","2":"XD","36":"LC J YD ZD aD lC bD cD"},J:{"36":"D A"},K:{"1":"H","2":"A B","36":"C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"36":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","36":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:1,C:"matches() DOM method",D:true};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,824 @@
|
||||
// @flow
|
||||
|
||||
type Exclude<A, B> = A;
|
||||
// see https://gist.github.com/thecotne/6e5969f4aaf8f253985ed36b30ac9fe0
|
||||
type $FlowGen$If<X: boolean, Then, Else = empty> = $Call<
|
||||
((true, Then, Else) => Then) & ((false, Then, Else) => Else),
|
||||
X,
|
||||
Then,
|
||||
Else
|
||||
>;
|
||||
|
||||
type $FlowGen$Assignable<A, B> = $Call<
|
||||
((...r: [B]) => true) & ((...r: [A]) => false),
|
||||
A
|
||||
>;
|
||||
|
||||
import type {
|
||||
Angle,
|
||||
CssColor,
|
||||
Rule,
|
||||
CustomProperty,
|
||||
EnvironmentVariable,
|
||||
Function,
|
||||
Image,
|
||||
LengthValue,
|
||||
MediaQuery,
|
||||
Declaration,
|
||||
Ratio,
|
||||
Resolution,
|
||||
Selector,
|
||||
SupportsCondition,
|
||||
Time,
|
||||
Token,
|
||||
TokenOrValue,
|
||||
UnknownAtRule,
|
||||
Url,
|
||||
Variable,
|
||||
StyleRule,
|
||||
DeclarationBlock,
|
||||
ParsedComponent,
|
||||
Multiplier,
|
||||
StyleSheet,
|
||||
Location2,
|
||||
} from "./ast.js.flow";
|
||||
import { Targets, Features } from "./targets.js.flow";
|
||||
declare export * from "./ast.js.flow";
|
||||
declare export { Targets, Features };
|
||||
export type TransformOptions<C: CustomAtRules> = {|
|
||||
/**
|
||||
* The filename being transformed. Used for error messages and source maps.
|
||||
*/
|
||||
filename: string,
|
||||
|
||||
/**
|
||||
* The source code to transform.
|
||||
*/
|
||||
code: Uint8Array,
|
||||
|
||||
/**
|
||||
* Whether to enable minification.
|
||||
*/
|
||||
minify?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to output a source map.
|
||||
*/
|
||||
sourceMap?: boolean,
|
||||
|
||||
/**
|
||||
* An input source map to extend.
|
||||
*/
|
||||
inputSourceMap?: string,
|
||||
|
||||
/**
|
||||
* An optional project root path, used as the source root in the output source map.
|
||||
* Also used to generate relative paths for sources used in CSS module hashes.
|
||||
*/
|
||||
projectRoot?: string,
|
||||
|
||||
/**
|
||||
* The browser targets for the generated code.
|
||||
*/
|
||||
targets?: Targets,
|
||||
|
||||
/**
|
||||
* Features that should always be compiled, even when supported by targets.
|
||||
*/
|
||||
include?: number,
|
||||
|
||||
/**
|
||||
* Features that should never be compiled, even when unsupported by targets.
|
||||
*/
|
||||
exclude?: number,
|
||||
|
||||
/**
|
||||
* Whether to enable parsing various draft syntax.
|
||||
*/
|
||||
drafts?: Drafts,
|
||||
|
||||
/**
|
||||
* Whether to enable various non-standard syntax.
|
||||
*/
|
||||
nonStandard?: NonStandard,
|
||||
|
||||
/**
|
||||
* Whether to compile this file as a CSS module.
|
||||
*/
|
||||
cssModules?: boolean | CSSModulesConfig,
|
||||
|
||||
/**
|
||||
* Whether to analyze dependencies (e.g. string).
|
||||
* When enabled, string dependencies
|
||||
* are replaced with hashed placeholders that can be replaced with the final
|
||||
* urls later (after bundling). Dependencies are returned as part of the result.
|
||||
*/
|
||||
analyzeDependencies?: boolean | DependencyOptions,
|
||||
|
||||
/**
|
||||
* Replaces user action pseudo classes with class names that can be applied from JavaScript.
|
||||
* This is useful for polyfills, for example.
|
||||
*/
|
||||
pseudoClasses?: PseudoClasses,
|
||||
|
||||
/**
|
||||
* A list of class names, ids, and custom identifiers (e.g. @keyframes) that are known
|
||||
* to be unused. These will be removed during minification. Note that these are not
|
||||
* selectors but individual names (without any . or # prefixes).
|
||||
*/
|
||||
unusedSymbols?: string[],
|
||||
|
||||
/**
|
||||
* Whether to ignore invalid rules and declarations rather than erroring.
|
||||
* When enabled, warnings are returned, and the invalid rule or declaration is
|
||||
* omitted from the output code.
|
||||
*/
|
||||
errorRecovery?: boolean,
|
||||
|
||||
/**
|
||||
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
|
||||
* Multiple visitors can be composed into one using the string function.
|
||||
* For optimal performance, visitors should be as specific as possible about what types of values
|
||||
* they care about so that JavaScript has to be called as little as possible.
|
||||
*/
|
||||
visitor?: Visitor<C>,
|
||||
|
||||
/**
|
||||
* Defines how to parse custom CSS at-rules. Each at-rule can have a prelude, defined using a CSS
|
||||
* [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings), and
|
||||
* a block body. The body can be a declaration list, rule list, or style block as defined in the
|
||||
* [css spec](https://drafts.csswg.org/css-syntax/#declaration-rule-list).
|
||||
*/
|
||||
customAtRules?: C,
|
||||
|};
|
||||
declare type PropertyStart =
|
||||
| "-"
|
||||
| "_"
|
||||
| "a"
|
||||
| "b"
|
||||
| "c"
|
||||
| "d"
|
||||
| "e"
|
||||
| "f"
|
||||
| "g"
|
||||
| "h"
|
||||
| "i"
|
||||
| "j"
|
||||
| "k"
|
||||
| "l"
|
||||
| "m"
|
||||
| "n"
|
||||
| "o"
|
||||
| "p"
|
||||
| "q"
|
||||
| "r"
|
||||
| "s"
|
||||
| "t"
|
||||
| "u"
|
||||
| "v"
|
||||
| "w"
|
||||
| "x"
|
||||
| "y"
|
||||
| "z";
|
||||
export type ReturnedDeclaration =
|
||||
| Declaration
|
||||
| {|
|
||||
/**
|
||||
* The property name.
|
||||
*/
|
||||
property: string,
|
||||
|
||||
/**
|
||||
* The raw string value for the declaration.
|
||||
*/
|
||||
raw: string,
|
||||
|};
|
||||
export type ReturnedMediaQuery =
|
||||
| MediaQuery
|
||||
| {|
|
||||
/**
|
||||
* The raw string value for the media query.
|
||||
*/
|
||||
raw: string,
|
||||
|};
|
||||
declare type FindByType<Union, Name> = $FlowGen$If<
|
||||
$FlowGen$Assignable<
|
||||
Union,
|
||||
{|
|
||||
type: Name,
|
||||
|}
|
||||
>,
|
||||
Union,
|
||||
empty
|
||||
>;
|
||||
export type ReturnedRule = Rule<ReturnedDeclaration, ReturnedMediaQuery>;
|
||||
declare type RequiredValue<Rule> = $FlowGen$If<
|
||||
$FlowGen$Assignable<
|
||||
Rule,
|
||||
{|
|
||||
value: { [key: string]: any },
|
||||
|}
|
||||
>,
|
||||
$FlowGen$If<
|
||||
$FlowGen$Assignable<$PropertyType<Rule, "value">, StyleRule>,
|
||||
{|
|
||||
...Rule,
|
||||
...{|
|
||||
value: {|
|
||||
...Required<StyleRule>,
|
||||
...{|
|
||||
declarations: Required<DeclarationBlock>,
|
||||
|},
|
||||
|},
|
||||
|},
|
||||
|},
|
||||
{|
|
||||
...Rule,
|
||||
...{|
|
||||
value: Required<$PropertyType<Rule, "value">>,
|
||||
|},
|
||||
|}
|
||||
>,
|
||||
Rule
|
||||
>;
|
||||
declare type RuleVisitor<R = RequiredValue<Rule>> = (
|
||||
rule: R
|
||||
) => ReturnedRule | ReturnedRule[] | void;
|
||||
declare type MappedRuleVisitors = $ObjMapi<
|
||||
{ [k: Exclude<$PropertyType<Rule, "type">, "unknown" | "custom">]: any },
|
||||
<Name>(Name) => RuleVisitor<RequiredValue<FindByType<Rule, Name>>>
|
||||
>;
|
||||
declare type UnknownVisitors<T> = {
|
||||
[name: string]: RuleVisitor<T>,
|
||||
};
|
||||
declare type CustomVisitors<T: CustomAtRules> = $ObjMapi<
|
||||
T,
|
||||
<Name>(Name) => RuleVisitor<CustomAtRule<Name, $ElementType<T, Name>>>
|
||||
>;
|
||||
declare type AnyCustomAtRule<C: CustomAtRules> = $ElementType<
|
||||
$ObjMapi<C, <Key>(Key) => CustomAtRule<Key, $ElementType<C, Key>>>,
|
||||
$Keys<C>
|
||||
>;
|
||||
declare type RuleVisitors<C: CustomAtRules> = {|
|
||||
...MappedRuleVisitors,
|
||||
...{|
|
||||
unknown?:
|
||||
| UnknownVisitors<UnknownAtRule>
|
||||
| $Diff<
|
||||
RuleVisitor<UnknownAtRule>,
|
||||
{ [key: $Keys<CallableFunction>]: any }
|
||||
>,
|
||||
custom?:
|
||||
| CustomVisitors<C>
|
||||
| $Diff<
|
||||
RuleVisitor<AnyCustomAtRule<C>>,
|
||||
{ [key: $Keys<CallableFunction>]: any }
|
||||
>,
|
||||
|},
|
||||
|};
|
||||
declare type PreludeTypes = Exclude<
|
||||
$PropertyType<ParsedComponent, "type">,
|
||||
"literal" | "repeated" | "token"
|
||||
>;
|
||||
declare type SyntaxString = string | string;
|
||||
declare type ComponentTypes = $ObjMapi<
|
||||
{ [k: PreludeTypes]: any },
|
||||
<Key>(Key) => FindByType<ParsedComponent, Key>
|
||||
>;
|
||||
declare type Repetitions = $ObjMapi<
|
||||
{ [k: PreludeTypes]: any },
|
||||
<Key>(Key) => {|
|
||||
type: "repeated",
|
||||
value: {|
|
||||
components: FindByType<ParsedComponent, Key>[],
|
||||
multiplier: Multiplier,
|
||||
|},
|
||||
|}
|
||||
>;
|
||||
declare type MappedPrelude = {| ...ComponentTypes, ...Repetitions |};
|
||||
declare type MappedBody<P: $PropertyType<CustomAtRuleDefinition, "body">> =
|
||||
$FlowGen$If<$FlowGen$Assignable<P, "style-block">, "rule-list", P>;
|
||||
declare type CustomAtRule<N, R: CustomAtRuleDefinition> = {|
|
||||
name: N,
|
||||
prelude: $FlowGen$If<
|
||||
$FlowGen$Assignable<$PropertyType<R, "prelude">, $Keys<MappedPrelude>>,
|
||||
$ElementType<MappedPrelude, $PropertyType<R, "prelude">>,
|
||||
ParsedComponent
|
||||
>,
|
||||
body: FindByType<CustomAtRuleBody, MappedBody<$PropertyType<R, "body">>>,
|
||||
loc: Location2,
|
||||
|};
|
||||
declare type CustomAtRuleBody =
|
||||
| {|
|
||||
type: "declaration-list",
|
||||
value: Required<DeclarationBlock>,
|
||||
|}
|
||||
| {|
|
||||
type: "rule-list",
|
||||
value: RequiredValue<Rule>[],
|
||||
|};
|
||||
declare type FindProperty<Union, Name> = $FlowGen$If<
|
||||
$FlowGen$Assignable<
|
||||
Union,
|
||||
{|
|
||||
property: Name,
|
||||
|}
|
||||
>,
|
||||
Union,
|
||||
empty
|
||||
>;
|
||||
declare type DeclarationVisitor<P = Declaration> = (
|
||||
property: P
|
||||
) => ReturnedDeclaration | ReturnedDeclaration[] | void;
|
||||
declare type MappedDeclarationVisitors = $ObjMapi<
|
||||
{
|
||||
[k: Exclude<
|
||||
$PropertyType<Declaration, "property">,
|
||||
"unparsed" | "custom"
|
||||
>]: any,
|
||||
},
|
||||
<Name>(
|
||||
Name
|
||||
) => DeclarationVisitor<
|
||||
FindProperty<Declaration, Name> | FindProperty<Declaration, "unparsed">
|
||||
>
|
||||
>;
|
||||
declare type CustomPropertyVisitors = {
|
||||
[name: string]: DeclarationVisitor<CustomProperty>,
|
||||
};
|
||||
declare type DeclarationVisitors = {|
|
||||
...MappedDeclarationVisitors,
|
||||
...{|
|
||||
custom?: CustomPropertyVisitors | DeclarationVisitor<CustomProperty>,
|
||||
|},
|
||||
|};
|
||||
declare type RawValue = {|
|
||||
/**
|
||||
* A raw string value which will be parsed like CSS.
|
||||
*/
|
||||
raw: string,
|
||||
|};
|
||||
declare type TokenReturnValue = TokenOrValue | TokenOrValue[] | RawValue | void;
|
||||
declare type TokenVisitor = (token: Token) => TokenReturnValue;
|
||||
declare type VisitableTokenTypes =
|
||||
| "ident"
|
||||
| "at-keyword"
|
||||
| "hash"
|
||||
| "id-hash"
|
||||
| "string"
|
||||
| "number"
|
||||
| "percentage"
|
||||
| "dimension";
|
||||
declare type TokenVisitors = $ObjMapi<
|
||||
{ [k: VisitableTokenTypes]: any },
|
||||
<Name>(Name) => (token: FindByType<Token, Name>) => TokenReturnValue
|
||||
>;
|
||||
declare type FunctionVisitor = (fn: Function) => TokenReturnValue;
|
||||
declare type EnvironmentVariableVisitor = (
|
||||
env: EnvironmentVariable
|
||||
) => TokenReturnValue;
|
||||
declare type EnvironmentVariableVisitors = {
|
||||
[name: string]: EnvironmentVariableVisitor,
|
||||
};
|
||||
export type Visitor<C: CustomAtRules> = {|
|
||||
StyleSheet?: (
|
||||
stylesheet: StyleSheet
|
||||
) => StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void,
|
||||
StyleSheetExit?: (
|
||||
stylesheet: StyleSheet
|
||||
) => StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void,
|
||||
Rule?: RuleVisitor<> | RuleVisitors<C>,
|
||||
RuleExit?: RuleVisitor<> | RuleVisitors<C>,
|
||||
Declaration?: DeclarationVisitor<> | DeclarationVisitors,
|
||||
DeclarationExit?: DeclarationVisitor<> | DeclarationVisitors,
|
||||
Url?: (url: Url) => Url | void,
|
||||
Color?: (color: CssColor) => CssColor | void,
|
||||
Image?: (image: Image) => Image | void,
|
||||
ImageExit?: (image: Image) => Image | void,
|
||||
Length?: (length: LengthValue) => LengthValue | void,
|
||||
Angle?: (angle: Angle) => Angle | void,
|
||||
Ratio?: (ratio: Ratio) => Ratio | void,
|
||||
Resolution?: (resolution: Resolution) => Resolution | void,
|
||||
Time?: (time: Time) => Time | void,
|
||||
CustomIdent?: (ident: string) => string | void,
|
||||
DashedIdent?: (ident: string) => string | void,
|
||||
MediaQuery?: (
|
||||
query: MediaQuery
|
||||
) => ReturnedMediaQuery | ReturnedMediaQuery[] | void,
|
||||
MediaQueryExit?: (
|
||||
query: MediaQuery
|
||||
) => ReturnedMediaQuery | ReturnedMediaQuery[] | void,
|
||||
SupportsCondition?: (condition: SupportsCondition) => SupportsCondition,
|
||||
SupportsConditionExit?: (condition: SupportsCondition) => SupportsCondition,
|
||||
Selector?: (selector: Selector) => Selector | Selector[] | void,
|
||||
Token?: TokenVisitor | TokenVisitors,
|
||||
Function?:
|
||||
| FunctionVisitor
|
||||
| {
|
||||
[name: string]: FunctionVisitor,
|
||||
},
|
||||
FunctionExit?:
|
||||
| FunctionVisitor
|
||||
| {
|
||||
[name: string]: FunctionVisitor,
|
||||
},
|
||||
Variable?: (variable: Variable) => TokenReturnValue,
|
||||
VariableExit?: (variable: Variable) => TokenReturnValue,
|
||||
EnvironmentVariable?:
|
||||
| EnvironmentVariableVisitor
|
||||
| EnvironmentVariableVisitors,
|
||||
EnvironmentVariableExit?:
|
||||
| EnvironmentVariableVisitor
|
||||
| EnvironmentVariableVisitors,
|
||||
|};
|
||||
export type CustomAtRules = {|
|
||||
[name: string]: CustomAtRuleDefinition,
|
||||
|};
|
||||
export type CustomAtRuleDefinition = {|
|
||||
/**
|
||||
* Defines the syntax for a custom at-rule prelude. The value should be a
|
||||
* CSS [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings)
|
||||
* representing the types of values that are accepted. This property may be omitted or
|
||||
* set to null to indicate that no prelude is accepted.
|
||||
*/
|
||||
prelude?: SyntaxString | null,
|
||||
|
||||
/**
|
||||
* Defines the type of body contained within the at-rule block.
|
||||
* - declaration-list: A CSS declaration list, as in a style rule.
|
||||
* - rule-list: A list of CSS rules, as supported within a non-nested
|
||||
* at-rule such as string.
|
||||
* - style-block: Both a declaration list and rule list, as accepted within
|
||||
* a nested at-rule within a style rule (e.g. string inside a style rule
|
||||
* with directly nested declarations).
|
||||
*/
|
||||
body?: "declaration-list" | "rule-list" | "style-block" | null,
|
||||
|};
|
||||
export type DependencyOptions = {|
|
||||
/**
|
||||
* Whether to preserve string rules rather than removing them.
|
||||
*/
|
||||
preserveImports?: boolean,
|
||||
|};
|
||||
export type BundleOptions<C: CustomAtRules> = $Diff<
|
||||
TransformOptions<C>,
|
||||
{| code: any |}
|
||||
>;
|
||||
export type BundleAsyncOptions<C: CustomAtRules> = {|
|
||||
...$Exact<BundleOptions<C>>,
|
||||
|
||||
resolver?: Resolver,
|
||||
|};
|
||||
|
||||
/**
|
||||
* Custom resolver to use when loading CSS files.
|
||||
*/
|
||||
export type Resolver = {|
|
||||
/**
|
||||
* Read the given file and return its contents as a string.
|
||||
*/
|
||||
read?: (file: string) => string | Promise<string>,
|
||||
|
||||
/**
|
||||
* Resolve the given CSS import specifier from the provided originating file to a
|
||||
* path which gets passed to string.
|
||||
*/
|
||||
resolve?: (
|
||||
specifier: string,
|
||||
originatingFile: string
|
||||
) => string | Promise<string>,
|
||||
|};
|
||||
export type Drafts = {|
|
||||
/**
|
||||
* Whether to enable @custom-media rules.
|
||||
*/
|
||||
customMedia?: boolean,
|
||||
|};
|
||||
export type NonStandard = {|
|
||||
/**
|
||||
* Whether to enable the non-standard >>> and /deep/ selector combinators used by Angular and Vue.
|
||||
*/
|
||||
deepSelectorCombinator?: boolean,
|
||||
|};
|
||||
export type PseudoClasses = {|
|
||||
hover?: string,
|
||||
active?: string,
|
||||
focus?: string,
|
||||
focusVisible?: string,
|
||||
focusWithin?: string,
|
||||
|};
|
||||
export type TransformResult = {|
|
||||
/**
|
||||
* The transformed code.
|
||||
*/
|
||||
code: Uint8Array,
|
||||
|
||||
/**
|
||||
* The generated source map, if enabled.
|
||||
*/
|
||||
map: Uint8Array | void,
|
||||
|
||||
/**
|
||||
* CSS module exports, if enabled.
|
||||
*/
|
||||
exports: CSSModuleExports | void,
|
||||
|
||||
/**
|
||||
* CSS module references, if string is enabled.
|
||||
*/
|
||||
references: CSSModuleReferences,
|
||||
|
||||
/**
|
||||
* string dependencies, if enabled.
|
||||
*/
|
||||
dependencies: Dependency[] | void,
|
||||
|
||||
/**
|
||||
* Warnings that occurred during compilation.
|
||||
*/
|
||||
warnings: Warning[],
|
||||
|};
|
||||
export type Warning = {|
|
||||
message: string,
|
||||
type: string,
|
||||
value?: any,
|
||||
loc: ErrorLocation,
|
||||
|};
|
||||
export type CSSModulesConfig = {|
|
||||
/**
|
||||
* The pattern to use when renaming class names and other identifiers. Default is string.
|
||||
*/
|
||||
pattern?: string,
|
||||
|
||||
/**
|
||||
* Whether to rename dashed identifiers, e.g. custom properties.
|
||||
*/
|
||||
dashedIdents?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to enable hashing for string.
|
||||
*/
|
||||
animation?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to enable hashing for CSS grid identifiers.
|
||||
*/
|
||||
grid?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to enable hashing for string names.
|
||||
*/
|
||||
container?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to enable hashing for custom identifiers.
|
||||
*/
|
||||
customIdents?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to require at least one class or id selector in each rule.
|
||||
*/
|
||||
pure?: boolean,
|
||||
|};
|
||||
export type CSSModuleExports = {
|
||||
/**
|
||||
* Maps exported (i.e. original) names to local names.
|
||||
*/
|
||||
[name: string]: CSSModuleExport,
|
||||
};
|
||||
export type CSSModuleExport = {|
|
||||
/**
|
||||
* The local (compiled) name for this export.
|
||||
*/
|
||||
name: string,
|
||||
|
||||
/**
|
||||
* Whether the export is referenced in this file.
|
||||
*/
|
||||
isReferenced: boolean,
|
||||
|
||||
/**
|
||||
* Other names that are composed by this export.
|
||||
*/
|
||||
composes: CSSModuleReference[],
|
||||
|};
|
||||
export type CSSModuleReferences = {
|
||||
/**
|
||||
* Maps placeholder names to references.
|
||||
*/
|
||||
[name: string]: DependencyCSSModuleReference,
|
||||
};
|
||||
export type CSSModuleReference =
|
||||
| LocalCSSModuleReference
|
||||
| GlobalCSSModuleReference
|
||||
| DependencyCSSModuleReference;
|
||||
export type LocalCSSModuleReference = {|
|
||||
type: "local",
|
||||
|
||||
/**
|
||||
* The local (compiled) name for the reference.
|
||||
*/
|
||||
name: string,
|
||||
|};
|
||||
export type GlobalCSSModuleReference = {|
|
||||
type: "global",
|
||||
|
||||
/**
|
||||
* The referenced global name.
|
||||
*/
|
||||
name: string,
|
||||
|};
|
||||
export type DependencyCSSModuleReference = {|
|
||||
type: "dependency",
|
||||
|
||||
/**
|
||||
* The name to reference within the dependency.
|
||||
*/
|
||||
name: string,
|
||||
|
||||
/**
|
||||
* The dependency specifier for the referenced file.
|
||||
*/
|
||||
specifier: string,
|
||||
|};
|
||||
export type Dependency = ImportDependency | UrlDependency;
|
||||
export type ImportDependency = {|
|
||||
type: "import",
|
||||
|
||||
/**
|
||||
* The url of the string dependency.
|
||||
*/
|
||||
url: string,
|
||||
|
||||
/**
|
||||
* The media query for the string rule.
|
||||
*/
|
||||
media: string | null,
|
||||
|
||||
/**
|
||||
* The string rule.
|
||||
*/
|
||||
supports: string | null,
|
||||
|
||||
/**
|
||||
* The source location where the string rule was found.
|
||||
*/
|
||||
loc: SourceLocation,
|
||||
|
||||
/**
|
||||
* The placeholder that the import was replaced with.
|
||||
*/
|
||||
placeholder: string,
|
||||
|};
|
||||
export type UrlDependency = {|
|
||||
type: "url",
|
||||
|
||||
/**
|
||||
* The url of the dependency.
|
||||
*/
|
||||
url: string,
|
||||
|
||||
/**
|
||||
* The source location where the string was found.
|
||||
*/
|
||||
loc: SourceLocation,
|
||||
|
||||
/**
|
||||
* The placeholder that the url was replaced with.
|
||||
*/
|
||||
placeholder: string,
|
||||
|};
|
||||
export type SourceLocation = {|
|
||||
/**
|
||||
* The file path in which the dependency exists.
|
||||
*/
|
||||
filePath: string,
|
||||
|
||||
/**
|
||||
* The start location of the dependency.
|
||||
*/
|
||||
start: Location,
|
||||
|
||||
/**
|
||||
* The end location (inclusive) of the dependency.
|
||||
*/
|
||||
end: Location,
|
||||
|};
|
||||
export type Location = {|
|
||||
/**
|
||||
* The line number (1-based).
|
||||
*/
|
||||
line: number,
|
||||
|
||||
/**
|
||||
* The column number (0-based).
|
||||
*/
|
||||
column: number,
|
||||
|};
|
||||
export type ErrorLocation = {|
|
||||
...$Exact<Location>,
|
||||
|
||||
filename: string,
|
||||
|};
|
||||
|
||||
/**
|
||||
* Compiles a CSS file, including optionally minifying and lowering syntax to the given
|
||||
* targets. A source map may also be generated, but this is not enabled by default.
|
||||
*/
|
||||
declare export function transform<C: CustomAtRules>(
|
||||
options: TransformOptions<C>
|
||||
): TransformResult;
|
||||
export type TransformAttributeOptions = {|
|
||||
/**
|
||||
* The filename in which the style attribute appeared. Used for error messages and dependencies.
|
||||
*/
|
||||
filename?: string,
|
||||
|
||||
/**
|
||||
* The source code to transform.
|
||||
*/
|
||||
code: Uint8Array,
|
||||
|
||||
/**
|
||||
* Whether to enable minification.
|
||||
*/
|
||||
minify?: boolean,
|
||||
|
||||
/**
|
||||
* The browser targets for the generated code.
|
||||
*/
|
||||
targets?: Targets,
|
||||
|
||||
/**
|
||||
* Whether to analyze string dependencies.
|
||||
* When enabled, string dependencies are replaced with hashed placeholders
|
||||
* that can be replaced with the final urls later (after bundling).
|
||||
* Dependencies are returned as part of the result.
|
||||
*/
|
||||
analyzeDependencies?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to ignore invalid rules and declarations rather than erroring.
|
||||
* When enabled, warnings are returned, and the invalid rule or declaration is
|
||||
* omitted from the output code.
|
||||
*/
|
||||
errorRecovery?: boolean,
|
||||
|
||||
/**
|
||||
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
|
||||
* Multiple visitors can be composed into one using the string function.
|
||||
* For optimal performance, visitors should be as specific as possible about what types of values
|
||||
* they care about so that JavaScript has to be called as little as possible.
|
||||
*/
|
||||
visitor?: Visitor<empty>,
|
||||
|};
|
||||
export type TransformAttributeResult = {|
|
||||
/**
|
||||
* The transformed code.
|
||||
*/
|
||||
code: Uint8Array,
|
||||
|
||||
/**
|
||||
* string dependencies, if enabled.
|
||||
*/
|
||||
dependencies: Dependency[] | void,
|
||||
|
||||
/**
|
||||
* Warnings that occurred during compilation.
|
||||
*/
|
||||
warnings: Warning[],
|
||||
|};
|
||||
|
||||
/**
|
||||
* Compiles a single CSS declaration list, such as an inline style attribute in HTML.
|
||||
*/
|
||||
declare export function transformStyleAttribute(
|
||||
options: TransformAttributeOptions
|
||||
): TransformAttributeResult;
|
||||
|
||||
/**
|
||||
* Converts a browserslist result into targets that can be passed to lightningcss.
|
||||
* @param browserslist the result of calling string
|
||||
*/
|
||||
declare export function browserslistToTargets(browserslist: string[]): Targets;
|
||||
|
||||
/**
|
||||
* Bundles a CSS file and its dependencies, inlining @import rules.
|
||||
*/
|
||||
declare export function bundle<C: CustomAtRules>(
|
||||
options: BundleOptions<C>
|
||||
): TransformResult;
|
||||
|
||||
/**
|
||||
* Bundles a CSS file and its dependencies asynchronously, inlining @import rules.
|
||||
*/
|
||||
declare export function bundleAsync<C: CustomAtRules>(
|
||||
options: BundleAsyncOptions<C>
|
||||
): Promise<TransformResult>;
|
||||
|
||||
/**
|
||||
* Composes multiple visitor objects into a single one.
|
||||
*/
|
||||
declare export function composeVisitors<C: CustomAtRules>(
|
||||
visitors: Visitor<C>[]
|
||||
): Visitor<C>;
|
||||
@@ -0,0 +1,26 @@
|
||||
# fs-constants
|
||||
|
||||
Small module that allows you to get the fs constants across
|
||||
Node and the browser.
|
||||
|
||||
```
|
||||
npm install fs-constants
|
||||
```
|
||||
|
||||
Previously you would use `require('constants')` for this in node but that has been
|
||||
deprecated and changed to `require('fs').constants` which does not browserify.
|
||||
|
||||
This module uses `require('constants')` in the browser and `require('fs').constants` in node to work around this
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var constants = require('fs-constants')
|
||||
|
||||
console.log('constants:', constants)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getModuleName;
|
||||
{
|
||||
const originalGetModuleName = getModuleName;
|
||||
exports.default = getModuleName = function getModuleName(rootOpts, pluginOpts) {
|
||||
var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo;
|
||||
return originalGetModuleName(rootOpts, {
|
||||
moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId,
|
||||
moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds,
|
||||
getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId,
|
||||
moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
|
||||
});
|
||||
};
|
||||
}
|
||||
function getModuleName(rootOpts, pluginOpts) {
|
||||
const {
|
||||
filename,
|
||||
filenameRelative = filename,
|
||||
sourceRoot = pluginOpts.moduleRoot
|
||||
} = rootOpts;
|
||||
const {
|
||||
moduleId,
|
||||
moduleIds = !!moduleId,
|
||||
getModuleId,
|
||||
moduleRoot = sourceRoot
|
||||
} = pluginOpts;
|
||||
if (!moduleIds) return null;
|
||||
if (moduleId != null && !getModuleId) {
|
||||
return moduleId;
|
||||
}
|
||||
let moduleName = moduleRoot != null ? moduleRoot + "/" : "";
|
||||
if (filenameRelative) {
|
||||
const sourceRootReplacer = sourceRoot != null ? new RegExp("^" + sourceRoot + "/?") : "";
|
||||
moduleName += filenameRelative.replace(sourceRootReplacer, "").replace(/\.\w*$/, "");
|
||||
}
|
||||
moduleName = moduleName.replace(/\\/g, "/");
|
||||
if (getModuleId) {
|
||||
return getModuleId(moduleName) || moduleName;
|
||||
} else {
|
||||
return moduleName;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-module-name.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $currentBaseId = $it.baseId,
|
||||
$allSchemasEmpty = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
if ($allSchemasEmpty) {
|
||||
out += ' if (true) { ';
|
||||
} else {
|
||||
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2011 Dominic Tarr
|
||||
|
||||
Permission is hereby granted, free of charge,
|
||||
to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom
|
||||
the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"B","16":"mC","132":"K D E F A"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 9 SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","132":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB qC rC"},D:{"1":"0 5 6 7 8 9 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","132":"1 2 3 4 J PB K D E F A B C L M G N O P QB"},E:{"1":"A B C L M G TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","132":"J PB K D E F sC SC tC uC vC wC"},F:{"1":"0 1 2 3 4 5 6 7 8 G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","16":"F B C 4C 5C 6C 7C FC kC 8C","132":"GC"},G:{"1":"GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","132":"E SC 9C lC AD BD CD DD ED FD"},H:{"132":"WD"},I:{"1":"I bD cD","132":"LC J XD YD ZD aD lC"},J:{"132":"D A"},K:{"1":"H","16":"A B C FC kC","132":"GC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"B","132":"A"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","132":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","4":"qD"}},B:6,C:"localeCompare()",D:true};
|
||||
@@ -0,0 +1,33 @@
|
||||
import { CursorOptions, CursorResult, Options, SupportInfo } from "./index.js";
|
||||
|
||||
/**
|
||||
* formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code.
|
||||
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted
|
||||
*
|
||||
* The cursorOffset option should be provided, to specify where the cursor is.
|
||||
*
|
||||
* ```js
|
||||
* await prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
|
||||
* ```
|
||||
* `-> { formatted: "1;\n", cursorOffset: 1 }`
|
||||
*/
|
||||
export function formatWithCursor(
|
||||
source: string,
|
||||
options: CursorOptions,
|
||||
): Promise<CursorResult>;
|
||||
|
||||
/**
|
||||
* `format` is used to format text using Prettier. [Options](https://prettier.io/docs/options) may be provided to override the defaults.
|
||||
*/
|
||||
export function format(source: string, options?: Options): Promise<string>;
|
||||
|
||||
/**
|
||||
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
|
||||
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
|
||||
*/
|
||||
export function check(source: string, options?: Options): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Returns an object representing the parsers, languages and file types Prettier supports for the current version.
|
||||
*/
|
||||
export function getSupportInfo(): Promise<SupportInfo>;
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = addComments;
|
||||
function addComments(node, type, comments) {
|
||||
if (!comments || !node) return node;
|
||||
const key = `${type}Comments`;
|
||||
if (node[key]) {
|
||||
if (type === "leading") {
|
||||
node[key] = comments.concat(node[key]);
|
||||
} else {
|
||||
node[key].push(...comments);
|
||||
}
|
||||
} else {
|
||||
node[key] = comments;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=addComments.js.map
|
||||
@@ -0,0 +1,187 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const routerCore = require("@tanstack/router-core");
|
||||
const useLoaderData = require("./useLoaderData.cjs");
|
||||
const useLoaderDeps = require("./useLoaderDeps.cjs");
|
||||
const useParams = require("./useParams.cjs");
|
||||
const useSearch = require("./useSearch.cjs");
|
||||
const useNavigate = require("./useNavigate.cjs");
|
||||
const useMatch = require("./useMatch.cjs");
|
||||
const useRouter = require("./useRouter.cjs");
|
||||
function getRouteApi(id) {
|
||||
return new RouteApi({ id });
|
||||
}
|
||||
class RouteApi extends routerCore.BaseRouteApi {
|
||||
/**
|
||||
* @deprecated Use the `getRouteApi` function instead.
|
||||
*/
|
||||
constructor({ id }) {
|
||||
super({ id });
|
||||
this.useMatch = (opts) => {
|
||||
return useMatch.useMatch({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
from: this.id,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing
|
||||
});
|
||||
};
|
||||
this.useRouteContext = (opts) => {
|
||||
return useMatch.useMatch({
|
||||
from: this.id,
|
||||
select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
|
||||
});
|
||||
};
|
||||
this.useSearch = (opts) => {
|
||||
return useSearch.useSearch({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing,
|
||||
from: this.id
|
||||
});
|
||||
};
|
||||
this.useParams = (opts) => {
|
||||
return useParams.useParams({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing,
|
||||
from: this.id
|
||||
});
|
||||
};
|
||||
this.useLoaderDeps = (opts) => {
|
||||
return useLoaderDeps.useLoaderDeps({ ...opts, from: this.id, strict: false });
|
||||
};
|
||||
this.useLoaderData = (opts) => {
|
||||
return useLoaderData.useLoaderData({ ...opts, from: this.id, strict: false });
|
||||
};
|
||||
this.useNavigate = () => {
|
||||
const router = useRouter.useRouter();
|
||||
return useNavigate.useNavigate({ from: router.routesById[this.id].fullPath });
|
||||
};
|
||||
this.notFound = (opts) => {
|
||||
return routerCore.notFound({ routeId: this.id, ...opts });
|
||||
};
|
||||
}
|
||||
}
|
||||
class Route extends routerCore.BaseRoute {
|
||||
/**
|
||||
* @deprecated Use the `createRoute` function instead.
|
||||
*/
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this.useMatch = (opts) => {
|
||||
return useMatch.useMatch({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
from: this.id,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing
|
||||
});
|
||||
};
|
||||
this.useRouteContext = (opts) => {
|
||||
return useMatch.useMatch({
|
||||
...opts,
|
||||
from: this.id,
|
||||
select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
|
||||
});
|
||||
};
|
||||
this.useSearch = (opts) => {
|
||||
return useSearch.useSearch({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing,
|
||||
from: this.id
|
||||
});
|
||||
};
|
||||
this.useParams = (opts) => {
|
||||
return useParams.useParams({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing,
|
||||
from: this.id
|
||||
});
|
||||
};
|
||||
this.useLoaderDeps = (opts) => {
|
||||
return useLoaderDeps.useLoaderDeps({ ...opts, from: this.id });
|
||||
};
|
||||
this.useLoaderData = (opts) => {
|
||||
return useLoaderData.useLoaderData({ ...opts, from: this.id });
|
||||
};
|
||||
this.useNavigate = () => {
|
||||
return useNavigate.useNavigate({ from: this.fullPath });
|
||||
};
|
||||
this.$$typeof = Symbol.for("react.memo");
|
||||
}
|
||||
}
|
||||
function createRoute(options) {
|
||||
return new Route(options);
|
||||
}
|
||||
function createRootRouteWithContext() {
|
||||
return (options) => {
|
||||
return createRootRoute(options);
|
||||
};
|
||||
}
|
||||
const rootRouteWithContext = createRootRouteWithContext;
|
||||
class RootRoute extends routerCore.BaseRootRoute {
|
||||
/**
|
||||
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
||||
*/
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this.useMatch = (opts) => {
|
||||
return useMatch.useMatch({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
from: this.id,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing
|
||||
});
|
||||
};
|
||||
this.useRouteContext = (opts) => {
|
||||
return useMatch.useMatch({
|
||||
...opts,
|
||||
from: this.id,
|
||||
select: (d) => (opts == null ? void 0 : opts.select) ? opts.select(d.context) : d.context
|
||||
});
|
||||
};
|
||||
this.useSearch = (opts) => {
|
||||
return useSearch.useSearch({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing,
|
||||
from: this.id
|
||||
});
|
||||
};
|
||||
this.useParams = (opts) => {
|
||||
return useParams.useParams({
|
||||
select: opts == null ? void 0 : opts.select,
|
||||
structuralSharing: opts == null ? void 0 : opts.structuralSharing,
|
||||
from: this.id
|
||||
});
|
||||
};
|
||||
this.useLoaderDeps = (opts) => {
|
||||
return useLoaderDeps.useLoaderDeps({ ...opts, from: this.id });
|
||||
};
|
||||
this.useLoaderData = (opts) => {
|
||||
return useLoaderData.useLoaderData({ ...opts, from: this.id });
|
||||
};
|
||||
this.useNavigate = () => {
|
||||
return useNavigate.useNavigate({ from: this.fullPath });
|
||||
};
|
||||
this.$$typeof = Symbol.for("react.memo");
|
||||
}
|
||||
}
|
||||
function createRootRoute(options) {
|
||||
return new RootRoute(options);
|
||||
}
|
||||
function createRouteMask(opts) {
|
||||
return opts;
|
||||
}
|
||||
class NotFoundRoute extends Route {
|
||||
constructor(options) {
|
||||
super({
|
||||
...options,
|
||||
id: "404"
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.NotFoundRoute = NotFoundRoute;
|
||||
exports.RootRoute = RootRoute;
|
||||
exports.Route = Route;
|
||||
exports.RouteApi = RouteApi;
|
||||
exports.createRootRoute = createRootRoute;
|
||||
exports.createRootRouteWithContext = createRootRouteWithContext;
|
||||
exports.createRoute = createRoute;
|
||||
exports.createRouteMask = createRouteMask;
|
||||
exports.getRouteApi = getRouteApi;
|
||||
exports.rootRouteWithContext = rootRouteWithContext;
|
||||
//# sourceMappingURL=route.cjs.map
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "react-refresh",
|
||||
"description": "React is a JavaScript library for building user interfaces.",
|
||||
"keywords": [
|
||||
"react"
|
||||
],
|
||||
"version": "0.14.2",
|
||||
"homepage": "https://reactjs.org/",
|
||||
"bugs": "https://github.com/facebook/react/issues",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"babel.js",
|
||||
"runtime.js",
|
||||
"cjs/",
|
||||
"umd/"
|
||||
],
|
||||
"main": "runtime.js",
|
||||
"exports": {
|
||||
".": "./runtime.js",
|
||||
"./runtime": "./runtime.js",
|
||||
"./babel": "./babel.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/react.git",
|
||||
"directory": "packages/react"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-16-8": "npm:react@16.8.0",
|
||||
"react-dom-16-8": "npm:react-dom@16.8.0",
|
||||
"scheduler-0-13": "npm:scheduler@0.13.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,839 @@
|
||||
/* MIT license */
|
||||
/* eslint-disable no-mixed-operators */
|
||||
const cssKeywords = require('color-name');
|
||||
|
||||
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||
// values that give correct `typeof` results).
|
||||
// do not use box values types (i.e. Number(), String(), etc.)
|
||||
|
||||
const reverseKeywords = {};
|
||||
for (const key of Object.keys(cssKeywords)) {
|
||||
reverseKeywords[cssKeywords[key]] = key;
|
||||
}
|
||||
|
||||
const convert = {
|
||||
rgb: {channels: 3, labels: 'rgb'},
|
||||
hsl: {channels: 3, labels: 'hsl'},
|
||||
hsv: {channels: 3, labels: 'hsv'},
|
||||
hwb: {channels: 3, labels: 'hwb'},
|
||||
cmyk: {channels: 4, labels: 'cmyk'},
|
||||
xyz: {channels: 3, labels: 'xyz'},
|
||||
lab: {channels: 3, labels: 'lab'},
|
||||
lch: {channels: 3, labels: 'lch'},
|
||||
hex: {channels: 1, labels: ['hex']},
|
||||
keyword: {channels: 1, labels: ['keyword']},
|
||||
ansi16: {channels: 1, labels: ['ansi16']},
|
||||
ansi256: {channels: 1, labels: ['ansi256']},
|
||||
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||
gray: {channels: 1, labels: ['gray']}
|
||||
};
|
||||
|
||||
module.exports = convert;
|
||||
|
||||
// Hide .channels and .labels properties
|
||||
for (const model of Object.keys(convert)) {
|
||||
if (!('channels' in convert[model])) {
|
||||
throw new Error('missing channels property: ' + model);
|
||||
}
|
||||
|
||||
if (!('labels' in convert[model])) {
|
||||
throw new Error('missing channel labels property: ' + model);
|
||||
}
|
||||
|
||||
if (convert[model].labels.length !== convert[model].channels) {
|
||||
throw new Error('channel and label counts mismatch: ' + model);
|
||||
}
|
||||
|
||||
const {channels, labels} = convert[model];
|
||||
delete convert[model].channels;
|
||||
delete convert[model].labels;
|
||||
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||
}
|
||||
|
||||
convert.rgb.hsl = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const min = Math.min(r, g, b);
|
||||
const max = Math.max(r, g, b);
|
||||
const delta = max - min;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else if (r === max) {
|
||||
h = (g - b) / delta;
|
||||
} else if (g === max) {
|
||||
h = 2 + (b - r) / delta;
|
||||
} else if (b === max) {
|
||||
h = 4 + (r - g) / delta;
|
||||
}
|
||||
|
||||
h = Math.min(h * 60, 360);
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const l = (min + max) / 2;
|
||||
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
} else if (l <= 0.5) {
|
||||
s = delta / (max + min);
|
||||
} else {
|
||||
s = delta / (2 - max - min);
|
||||
}
|
||||
|
||||
return [h, s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.rgb.hsv = function (rgb) {
|
||||
let rdif;
|
||||
let gdif;
|
||||
let bdif;
|
||||
let h;
|
||||
let s;
|
||||
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const v = Math.max(r, g, b);
|
||||
const diff = v - Math.min(r, g, b);
|
||||
const diffc = function (c) {
|
||||
return (v - c) / 6 / diff + 1 / 2;
|
||||
};
|
||||
|
||||
if (diff === 0) {
|
||||
h = 0;
|
||||
s = 0;
|
||||
} else {
|
||||
s = diff / v;
|
||||
rdif = diffc(r);
|
||||
gdif = diffc(g);
|
||||
bdif = diffc(b);
|
||||
|
||||
if (r === v) {
|
||||
h = bdif - gdif;
|
||||
} else if (g === v) {
|
||||
h = (1 / 3) + rdif - bdif;
|
||||
} else if (b === v) {
|
||||
h = (2 / 3) + gdif - rdif;
|
||||
}
|
||||
|
||||
if (h < 0) {
|
||||
h += 1;
|
||||
} else if (h > 1) {
|
||||
h -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
h * 360,
|
||||
s * 100,
|
||||
v * 100
|
||||
];
|
||||
};
|
||||
|
||||
convert.rgb.hwb = function (rgb) {
|
||||
const r = rgb[0];
|
||||
const g = rgb[1];
|
||||
let b = rgb[2];
|
||||
const h = convert.rgb.hsl(rgb)[0];
|
||||
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||
|
||||
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||
|
||||
return [h, w * 100, b * 100];
|
||||
};
|
||||
|
||||
convert.rgb.cmyk = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
|
||||
const k = Math.min(1 - r, 1 - g, 1 - b);
|
||||
const c = (1 - r - k) / (1 - k) || 0;
|
||||
const m = (1 - g - k) / (1 - k) || 0;
|
||||
const y = (1 - b - k) / (1 - k) || 0;
|
||||
|
||||
return [c * 100, m * 100, y * 100, k * 100];
|
||||
};
|
||||
|
||||
function comparativeDistance(x, y) {
|
||||
/*
|
||||
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||
*/
|
||||
return (
|
||||
((x[0] - y[0]) ** 2) +
|
||||
((x[1] - y[1]) ** 2) +
|
||||
((x[2] - y[2]) ** 2)
|
||||
);
|
||||
}
|
||||
|
||||
convert.rgb.keyword = function (rgb) {
|
||||
const reversed = reverseKeywords[rgb];
|
||||
if (reversed) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
let currentClosestDistance = Infinity;
|
||||
let currentClosestKeyword;
|
||||
|
||||
for (const keyword of Object.keys(cssKeywords)) {
|
||||
const value = cssKeywords[keyword];
|
||||
|
||||
// Compute comparative distance
|
||||
const distance = comparativeDistance(rgb, value);
|
||||
|
||||
// Check if its less, if so set as closest
|
||||
if (distance < currentClosestDistance) {
|
||||
currentClosestDistance = distance;
|
||||
currentClosestKeyword = keyword;
|
||||
}
|
||||
}
|
||||
|
||||
return currentClosestKeyword;
|
||||
};
|
||||
|
||||
convert.keyword.rgb = function (keyword) {
|
||||
return cssKeywords[keyword];
|
||||
};
|
||||
|
||||
convert.rgb.xyz = function (rgb) {
|
||||
let r = rgb[0] / 255;
|
||||
let g = rgb[1] / 255;
|
||||
let b = rgb[2] / 255;
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
||||
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
||||
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
||||
|
||||
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||
|
||||
return [x * 100, y * 100, z * 100];
|
||||
};
|
||||
|
||||
convert.rgb.lab = function (rgb) {
|
||||
const xyz = convert.rgb.xyz(rgb);
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.hsl.rgb = function (hsl) {
|
||||
const h = hsl[0] / 360;
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
let t2;
|
||||
let t3;
|
||||
let val;
|
||||
|
||||
if (s === 0) {
|
||||
val = l * 255;
|
||||
return [val, val, val];
|
||||
}
|
||||
|
||||
if (l < 0.5) {
|
||||
t2 = l * (1 + s);
|
||||
} else {
|
||||
t2 = l + s - l * s;
|
||||
}
|
||||
|
||||
const t1 = 2 * l - t2;
|
||||
|
||||
const rgb = [0, 0, 0];
|
||||
for (let i = 0; i < 3; i++) {
|
||||
t3 = h + 1 / 3 * -(i - 1);
|
||||
if (t3 < 0) {
|
||||
t3++;
|
||||
}
|
||||
|
||||
if (t3 > 1) {
|
||||
t3--;
|
||||
}
|
||||
|
||||
if (6 * t3 < 1) {
|
||||
val = t1 + (t2 - t1) * 6 * t3;
|
||||
} else if (2 * t3 < 1) {
|
||||
val = t2;
|
||||
} else if (3 * t3 < 2) {
|
||||
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||
} else {
|
||||
val = t1;
|
||||
}
|
||||
|
||||
rgb[i] = val * 255;
|
||||
}
|
||||
|
||||
return rgb;
|
||||
};
|
||||
|
||||
convert.hsl.hsv = function (hsl) {
|
||||
const h = hsl[0];
|
||||
let s = hsl[1] / 100;
|
||||
let l = hsl[2] / 100;
|
||||
let smin = s;
|
||||
const lmin = Math.max(l, 0.01);
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||
const v = (l + s) / 2;
|
||||
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||
|
||||
return [h, sv * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hsv.rgb = function (hsv) {
|
||||
const h = hsv[0] / 60;
|
||||
const s = hsv[1] / 100;
|
||||
let v = hsv[2] / 100;
|
||||
const hi = Math.floor(h) % 6;
|
||||
|
||||
const f = h - Math.floor(h);
|
||||
const p = 255 * v * (1 - s);
|
||||
const q = 255 * v * (1 - (s * f));
|
||||
const t = 255 * v * (1 - (s * (1 - f)));
|
||||
v *= 255;
|
||||
|
||||
switch (hi) {
|
||||
case 0:
|
||||
return [v, t, p];
|
||||
case 1:
|
||||
return [q, v, p];
|
||||
case 2:
|
||||
return [p, v, t];
|
||||
case 3:
|
||||
return [p, q, v];
|
||||
case 4:
|
||||
return [t, p, v];
|
||||
case 5:
|
||||
return [v, p, q];
|
||||
}
|
||||
};
|
||||
|
||||
convert.hsv.hsl = function (hsv) {
|
||||
const h = hsv[0];
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
const vmin = Math.max(v, 0.01);
|
||||
let sl;
|
||||
let l;
|
||||
|
||||
l = (2 - s) * v;
|
||||
const lmin = (2 - s) * vmin;
|
||||
sl = s * vmin;
|
||||
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||
sl = sl || 0;
|
||||
l /= 2;
|
||||
|
||||
return [h, sl * 100, l * 100];
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||
convert.hwb.rgb = function (hwb) {
|
||||
const h = hwb[0] / 360;
|
||||
let wh = hwb[1] / 100;
|
||||
let bl = hwb[2] / 100;
|
||||
const ratio = wh + bl;
|
||||
let f;
|
||||
|
||||
// Wh + bl cant be > 1
|
||||
if (ratio > 1) {
|
||||
wh /= ratio;
|
||||
bl /= ratio;
|
||||
}
|
||||
|
||||
const i = Math.floor(6 * h);
|
||||
const v = 1 - bl;
|
||||
f = 6 * h - i;
|
||||
|
||||
if ((i & 0x01) !== 0) {
|
||||
f = 1 - f;
|
||||
}
|
||||
|
||||
const n = wh + f * (v - wh); // Linear interpolation
|
||||
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
||||
switch (i) {
|
||||
default:
|
||||
case 6:
|
||||
case 0: r = v; g = n; b = wh; break;
|
||||
case 1: r = n; g = v; b = wh; break;
|
||||
case 2: r = wh; g = v; b = n; break;
|
||||
case 3: r = wh; g = n; b = v; break;
|
||||
case 4: r = n; g = wh; b = v; break;
|
||||
case 5: r = v; g = wh; b = n; break;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.cmyk.rgb = function (cmyk) {
|
||||
const c = cmyk[0] / 100;
|
||||
const m = cmyk[1] / 100;
|
||||
const y = cmyk[2] / 100;
|
||||
const k = cmyk[3] / 100;
|
||||
|
||||
const r = 1 - Math.min(1, c * (1 - k) + k);
|
||||
const g = 1 - Math.min(1, m * (1 - k) + k);
|
||||
const b = 1 - Math.min(1, y * (1 - k) + k);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.rgb = function (xyz) {
|
||||
const x = xyz[0] / 100;
|
||||
const y = xyz[1] / 100;
|
||||
const z = xyz[2] / 100;
|
||||
let r;
|
||||
let g;
|
||||
let b;
|
||||
|
||||
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||
|
||||
// Assume sRGB
|
||||
r = r > 0.0031308
|
||||
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
||||
: r * 12.92;
|
||||
|
||||
g = g > 0.0031308
|
||||
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
||||
: g * 12.92;
|
||||
|
||||
b = b > 0.0031308
|
||||
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
||||
: b * 12.92;
|
||||
|
||||
r = Math.min(Math.max(0, r), 1);
|
||||
g = Math.min(Math.max(0, g), 1);
|
||||
b = Math.min(Math.max(0, b), 1);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.lab = function (xyz) {
|
||||
let x = xyz[0];
|
||||
let y = xyz[1];
|
||||
let z = xyz[2];
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
||||
|
||||
const l = (116 * y) - 16;
|
||||
const a = 500 * (x - y);
|
||||
const b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.lab.xyz = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let x;
|
||||
let y;
|
||||
let z;
|
||||
|
||||
y = (l + 16) / 116;
|
||||
x = a / 500 + y;
|
||||
z = y - b / 200;
|
||||
|
||||
const y2 = y ** 3;
|
||||
const x2 = x ** 3;
|
||||
const z2 = z ** 3;
|
||||
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||
|
||||
x *= 95.047;
|
||||
y *= 100;
|
||||
z *= 108.883;
|
||||
|
||||
return [x, y, z];
|
||||
};
|
||||
|
||||
convert.lab.lch = function (lab) {
|
||||
const l = lab[0];
|
||||
const a = lab[1];
|
||||
const b = lab[2];
|
||||
let h;
|
||||
|
||||
const hr = Math.atan2(b, a);
|
||||
h = hr * 360 / 2 / Math.PI;
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
const c = Math.sqrt(a * a + b * b);
|
||||
|
||||
return [l, c, h];
|
||||
};
|
||||
|
||||
convert.lch.lab = function (lch) {
|
||||
const l = lch[0];
|
||||
const c = lch[1];
|
||||
const h = lch[2];
|
||||
|
||||
const hr = h / 360 * 2 * Math.PI;
|
||||
const a = c * Math.cos(hr);
|
||||
const b = c * Math.sin(hr);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.rgb.ansi16 = function (args, saturation = null) {
|
||||
const [r, g, b] = args;
|
||||
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
||||
|
||||
value = Math.round(value / 50);
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
let ansi = 30
|
||||
+ ((Math.round(b / 255) << 2)
|
||||
| (Math.round(g / 255) << 1)
|
||||
| Math.round(r / 255));
|
||||
|
||||
if (value === 2) {
|
||||
ansi += 60;
|
||||
}
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.hsv.ansi16 = function (args) {
|
||||
// Optimization here; we already know the value and don't need to get
|
||||
// it converted for us.
|
||||
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||
};
|
||||
|
||||
convert.rgb.ansi256 = function (args) {
|
||||
const r = args[0];
|
||||
const g = args[1];
|
||||
const b = args[2];
|
||||
|
||||
// We use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (r === g && g === b) {
|
||||
if (r < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (r > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
const ansi = 16
|
||||
+ (36 * Math.round(r / 255 * 5))
|
||||
+ (6 * Math.round(g / 255 * 5))
|
||||
+ Math.round(b / 255 * 5);
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.ansi16.rgb = function (args) {
|
||||
let color = args % 10;
|
||||
|
||||
// Handle greyscale
|
||||
if (color === 0 || color === 7) {
|
||||
if (args > 50) {
|
||||
color += 3.5;
|
||||
}
|
||||
|
||||
color = color / 10.5 * 255;
|
||||
|
||||
return [color, color, color];
|
||||
}
|
||||
|
||||
const mult = (~~(args > 50) + 1) * 0.5;
|
||||
const r = ((color & 1) * mult) * 255;
|
||||
const g = (((color >> 1) & 1) * mult) * 255;
|
||||
const b = (((color >> 2) & 1) * mult) * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.ansi256.rgb = function (args) {
|
||||
// Handle greyscale
|
||||
if (args >= 232) {
|
||||
const c = (args - 232) * 10 + 8;
|
||||
return [c, c, c];
|
||||
}
|
||||
|
||||
args -= 16;
|
||||
|
||||
let rem;
|
||||
const r = Math.floor(args / 36) / 5 * 255;
|
||||
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||
const b = (rem % 6) / 5 * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hex = function (args) {
|
||||
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||
+ (Math.round(args[2]) & 0xFF);
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.hex.rgb = function (args) {
|
||||
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||
if (!match) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
let colorString = match[0];
|
||||
|
||||
if (match[0].length === 3) {
|
||||
colorString = colorString.split('').map(char => {
|
||||
return char + char;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
const integer = parseInt(colorString, 16);
|
||||
const r = (integer >> 16) & 0xFF;
|
||||
const g = (integer >> 8) & 0xFF;
|
||||
const b = integer & 0xFF;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hcg = function (rgb) {
|
||||
const r = rgb[0] / 255;
|
||||
const g = rgb[1] / 255;
|
||||
const b = rgb[2] / 255;
|
||||
const max = Math.max(Math.max(r, g), b);
|
||||
const min = Math.min(Math.min(r, g), b);
|
||||
const chroma = (max - min);
|
||||
let grayscale;
|
||||
let hue;
|
||||
|
||||
if (chroma < 1) {
|
||||
grayscale = min / (1 - chroma);
|
||||
} else {
|
||||
grayscale = 0;
|
||||
}
|
||||
|
||||
if (chroma <= 0) {
|
||||
hue = 0;
|
||||
} else
|
||||
if (max === r) {
|
||||
hue = ((g - b) / chroma) % 6;
|
||||
} else
|
||||
if (max === g) {
|
||||
hue = 2 + (b - r) / chroma;
|
||||
} else {
|
||||
hue = 4 + (r - g) / chroma;
|
||||
}
|
||||
|
||||
hue /= 6;
|
||||
hue %= 1;
|
||||
|
||||
return [hue * 360, chroma * 100, grayscale * 100];
|
||||
};
|
||||
|
||||
convert.hsl.hcg = function (hsl) {
|
||||
const s = hsl[1] / 100;
|
||||
const l = hsl[2] / 100;
|
||||
|
||||
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
||||
|
||||
let f = 0;
|
||||
if (c < 1.0) {
|
||||
f = (l - 0.5 * c) / (1.0 - c);
|
||||
}
|
||||
|
||||
return [hsl[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hsv.hcg = function (hsv) {
|
||||
const s = hsv[1] / 100;
|
||||
const v = hsv[2] / 100;
|
||||
|
||||
const c = s * v;
|
||||
let f = 0;
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hsv[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hcg.rgb = function (hcg) {
|
||||
const h = hcg[0] / 360;
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
if (c === 0.0) {
|
||||
return [g * 255, g * 255, g * 255];
|
||||
}
|
||||
|
||||
const pure = [0, 0, 0];
|
||||
const hi = (h % 1) * 6;
|
||||
const v = hi % 1;
|
||||
const w = 1 - v;
|
||||
let mg = 0;
|
||||
|
||||
/* eslint-disable max-statements-per-line */
|
||||
switch (Math.floor(hi)) {
|
||||
case 0:
|
||||
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||
case 1:
|
||||
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||
case 2:
|
||||
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||
case 3:
|
||||
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||
case 4:
|
||||
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||
default:
|
||||
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||
}
|
||||
/* eslint-enable max-statements-per-line */
|
||||
|
||||
mg = (1.0 - c) * g;
|
||||
|
||||
return [
|
||||
(c * pure[0] + mg) * 255,
|
||||
(c * pure[1] + mg) * 255,
|
||||
(c * pure[2] + mg) * 255
|
||||
];
|
||||
};
|
||||
|
||||
convert.hcg.hsv = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const v = c + g * (1.0 - c);
|
||||
let f = 0;
|
||||
|
||||
if (v > 0.0) {
|
||||
f = c / v;
|
||||
}
|
||||
|
||||
return [hcg[0], f * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hsl = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
|
||||
const l = g * (1.0 - c) + 0.5 * c;
|
||||
let s = 0;
|
||||
|
||||
if (l > 0.0 && l < 0.5) {
|
||||
s = c / (2 * l);
|
||||
} else
|
||||
if (l >= 0.5 && l < 1.0) {
|
||||
s = c / (2 * (1 - l));
|
||||
}
|
||||
|
||||
return [hcg[0], s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hwb = function (hcg) {
|
||||
const c = hcg[1] / 100;
|
||||
const g = hcg[2] / 100;
|
||||
const v = c + g * (1.0 - c);
|
||||
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||
};
|
||||
|
||||
convert.hwb.hcg = function (hwb) {
|
||||
const w = hwb[1] / 100;
|
||||
const b = hwb[2] / 100;
|
||||
const v = 1 - b;
|
||||
const c = v - w;
|
||||
let g = 0;
|
||||
|
||||
if (c < 1) {
|
||||
g = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hwb[0], c * 100, g * 100];
|
||||
};
|
||||
|
||||
convert.apple.rgb = function (apple) {
|
||||
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||
};
|
||||
|
||||
convert.rgb.apple = function (rgb) {
|
||||
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||
};
|
||||
|
||||
convert.gray.rgb = function (args) {
|
||||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||
};
|
||||
|
||||
convert.gray.hsl = function (args) {
|
||||
return [0, 0, args[0]];
|
||||
};
|
||||
|
||||
convert.gray.hsv = convert.gray.hsl;
|
||||
|
||||
convert.gray.hwb = function (gray) {
|
||||
return [0, 100, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.cmyk = function (gray) {
|
||||
return [0, 0, 0, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.lab = function (gray) {
|
||||
return [gray[0], 0, 0];
|
||||
};
|
||||
|
||||
convert.gray.hex = function (gray) {
|
||||
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||
const integer = (val << 16) + (val << 8) + val;
|
||||
|
||||
const string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.rgb.gray = function (rgb) {
|
||||
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||
return [val / 255 * 100];
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const scheduler = require("./scheduler.cjs");
|
||||
class Store {
|
||||
constructor(initialState, options) {
|
||||
this.listeners = /* @__PURE__ */ new Set();
|
||||
this.subscribe = (listener) => {
|
||||
var _a, _b;
|
||||
this.listeners.add(listener);
|
||||
const unsub = (_b = (_a = this.options) == null ? void 0 : _a.onSubscribe) == null ? void 0 : _b.call(_a, listener, this);
|
||||
return () => {
|
||||
this.listeners.delete(listener);
|
||||
unsub == null ? void 0 : unsub();
|
||||
};
|
||||
};
|
||||
this.setState = (updater) => {
|
||||
var _a, _b, _c;
|
||||
this.prevState = this.state;
|
||||
this.state = ((_a = this.options) == null ? void 0 : _a.updateFn) ? this.options.updateFn(this.prevState)(updater) : updater(this.prevState);
|
||||
(_c = (_b = this.options) == null ? void 0 : _b.onUpdate) == null ? void 0 : _c.call(_b);
|
||||
scheduler.__flush(this);
|
||||
};
|
||||
this.prevState = initialState;
|
||||
this.state = initialState;
|
||||
this.options = options;
|
||||
}
|
||||
}
|
||||
exports.Store = Store;
|
||||
//# sourceMappingURL=store.cjs.map
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N","1028":"O P"},C:{"1":"0 9 U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB qC rC","132":"tB","578":"uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T"},D:{"1":"0 9 nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB"},E:{"1":"C L M G FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A sC SC tC uC vC wC TC","322":"B"},F:{"1":"0 aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD ED FD GD HD","322":"ID"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"2":"qD rD"}},B:4,C:"Resource Hints: preload",D:true};
|
||||
Reference in New Issue
Block a user