mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-21 14:13:36 +08:00
docs:更新文档
This commit is contained in:
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
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.
|
||||
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-core/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# @vue/compiler-core
|
||||
4267
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
4267
node_modules/@vue/compiler-core/dist/compiler-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4206
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
4206
node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
958
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
958
node_modules/@vue/compiler-core/dist/compiler-core.d.ts
generated
vendored
Normal file
@@ -0,0 +1,958 @@
|
||||
import { generateCodeFrame } from '@vue/shared';
|
||||
import { ParserPlugin } from '@babel/parser';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
import { SourceMapGenerator } from 'source-map';
|
||||
|
||||
export declare function advancePositionWithClone(pos: Position_2, source: string, numberOfCharacters?: number): Position_2;
|
||||
|
||||
export declare function advancePositionWithMutation(pos: Position_2, source: string, numberOfCharacters?: number): Position_2;
|
||||
|
||||
export declare interface ArrayExpression extends Node_2 {
|
||||
type: NodeTypes.JS_ARRAY_EXPRESSION;
|
||||
elements: Array<string | JSChildNode>;
|
||||
}
|
||||
|
||||
export declare function assert(condition: boolean, msg?: string): void;
|
||||
|
||||
export declare interface AssignmentExpression extends Node_2 {
|
||||
type: NodeTypes.JS_ASSIGNMENT_EXPRESSION;
|
||||
left: SimpleExpressionNode;
|
||||
right: JSChildNode;
|
||||
}
|
||||
|
||||
export declare interface AttributeNode extends Node_2 {
|
||||
type: NodeTypes.ATTRIBUTE;
|
||||
name: string;
|
||||
value: TextNode | undefined;
|
||||
}
|
||||
|
||||
export declare const BASE_TRANSITION: unique symbol;
|
||||
|
||||
export declare function baseCompile(template: string | RootNode, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export declare interface BaseElementNode extends Node_2 {
|
||||
type: NodeTypes.ELEMENT;
|
||||
ns: Namespace;
|
||||
tag: string;
|
||||
tagType: ElementTypes;
|
||||
isSelfClosing: boolean;
|
||||
props: Array<AttributeNode | DirectiveNode>;
|
||||
children: TemplateChildNode[];
|
||||
}
|
||||
|
||||
export declare function baseParse(content: string, options?: ParserOptions): RootNode;
|
||||
|
||||
export declare interface BindingMetadata {
|
||||
[key: string]: 'data' | 'props' | 'setup' | 'options';
|
||||
}
|
||||
|
||||
export declare type BlockCodegenNode = VNodeCall | RenderSlotCall;
|
||||
|
||||
export declare interface BlockStatement extends Node_2 {
|
||||
type: NodeTypes.JS_BLOCK_STATEMENT;
|
||||
body: (JSChildNode | IfStatement)[];
|
||||
}
|
||||
|
||||
export declare function buildProps(node: ElementNode, context: TransformContext, props?: ElementNode['props'], ssr?: boolean): {
|
||||
props: PropsExpression | undefined;
|
||||
directives: DirectiveNode[];
|
||||
patchFlag: number;
|
||||
dynamicPropNames: string[];
|
||||
};
|
||||
|
||||
export declare function buildSlots(node: ElementNode, context: TransformContext, buildSlotFn?: SlotFnBuilder): {
|
||||
slots: SlotsExpression;
|
||||
hasDynamicSlots: boolean;
|
||||
};
|
||||
|
||||
export declare interface CacheExpression extends Node_2 {
|
||||
type: NodeTypes.JS_CACHE_EXPRESSION;
|
||||
index: number;
|
||||
value: JSChildNode;
|
||||
isVNode: boolean;
|
||||
}
|
||||
|
||||
export declare interface CallExpression extends Node_2 {
|
||||
type: NodeTypes.JS_CALL_EXPRESSION;
|
||||
callee: string | symbol;
|
||||
arguments: (string | symbol | JSChildNode | SSRCodegenNode | TemplateChildNode | TemplateChildNode[])[];
|
||||
}
|
||||
|
||||
export declare const CAMELIZE: unique symbol;
|
||||
|
||||
export declare const CAPITALIZE: unique symbol;
|
||||
|
||||
export declare interface CodegenContext extends Omit<Required<CodegenOptions>, 'bindingMetadata'> {
|
||||
source: string;
|
||||
code: string;
|
||||
line: number;
|
||||
column: number;
|
||||
offset: number;
|
||||
indentLevel: number;
|
||||
pure: boolean;
|
||||
map?: SourceMapGenerator;
|
||||
helper(key: symbol): string;
|
||||
push(code: string, node?: CodegenNode): void;
|
||||
indent(): void;
|
||||
deindent(withoutNewLine?: boolean): void;
|
||||
newline(): void;
|
||||
}
|
||||
|
||||
declare type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
|
||||
|
||||
export declare interface CodegenOptions {
|
||||
/**
|
||||
* - `module` mode will generate ES module import statements for helpers
|
||||
* and export the render function as the default export.
|
||||
* - `function` mode will generate a single `const { helpers... } = Vue`
|
||||
* statement and return the render function. It expects `Vue` to be globally
|
||||
* available (or passed by wrapping the code with an IIFE). It is meant to be
|
||||
* used with `new Function(code)()` to generate a render function at runtime.
|
||||
* @default 'function'
|
||||
*/
|
||||
mode?: 'module' | 'function';
|
||||
/**
|
||||
* Generate source map?
|
||||
* @default false
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
/**
|
||||
* Filename for source map generation.
|
||||
* @default 'template.vue.html'
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* SFC scoped styles ID
|
||||
*/
|
||||
scopeId?: string | null;
|
||||
/**
|
||||
* Option to optimize helper import bindings via variable assignment
|
||||
* (only used for webpack code-split)
|
||||
* @default false
|
||||
*/
|
||||
optimizeImports?: boolean;
|
||||
/**
|
||||
* Customize where to import runtime helpers from.
|
||||
* @default 'vue'
|
||||
*/
|
||||
runtimeModuleName?: string;
|
||||
/**
|
||||
* Customize the global variable name of `Vue` to get helpers from
|
||||
* in function mode
|
||||
* @default 'Vue'
|
||||
*/
|
||||
runtimeGlobalName?: string;
|
||||
prefixIdentifiers?: boolean;
|
||||
bindingMetadata?: BindingMetadata;
|
||||
ssr?: boolean;
|
||||
}
|
||||
|
||||
export declare interface CodegenResult {
|
||||
code: string;
|
||||
ast: RootNode;
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
|
||||
export declare interface CommentNode extends Node_2 {
|
||||
type: NodeTypes.COMMENT;
|
||||
content: string;
|
||||
}
|
||||
|
||||
export declare interface CompilerError extends SyntaxError {
|
||||
code: number;
|
||||
loc?: SourceLocation;
|
||||
}
|
||||
|
||||
export declare type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
|
||||
|
||||
export declare interface ComponentNode extends BaseElementNode {
|
||||
tagType: ElementTypes.COMPONENT;
|
||||
codegenNode: VNodeCall | CacheExpression | undefined;
|
||||
ssrCodegenNode?: CallExpression;
|
||||
}
|
||||
|
||||
export declare interface CompoundExpressionNode extends Node_2 {
|
||||
type: NodeTypes.COMPOUND_EXPRESSION;
|
||||
children: (SimpleExpressionNode | CompoundExpressionNode | InterpolationNode | TextNode | string | symbol)[];
|
||||
/**
|
||||
* an expression parsed as the params of a function will track
|
||||
* the identifiers declared inside the function body.
|
||||
*/
|
||||
identifiers?: string[];
|
||||
}
|
||||
|
||||
export declare interface ConditionalDynamicSlotNode extends ConditionalExpression {
|
||||
consequent: DynamicSlotNode;
|
||||
alternate: DynamicSlotNode | SimpleExpressionNode;
|
||||
}
|
||||
|
||||
export declare interface ConditionalExpression extends Node_2 {
|
||||
type: NodeTypes.JS_CONDITIONAL_EXPRESSION;
|
||||
test: JSChildNode;
|
||||
consequent: JSChildNode;
|
||||
alternate: JSChildNode;
|
||||
newline: boolean;
|
||||
}
|
||||
|
||||
export declare interface CoreCompilerError extends CompilerError {
|
||||
code: ErrorCodes;
|
||||
}
|
||||
|
||||
export declare const CREATE_BLOCK: unique symbol;
|
||||
|
||||
export declare const CREATE_COMMENT: unique symbol;
|
||||
|
||||
export declare const CREATE_SLOTS: unique symbol;
|
||||
|
||||
export declare const CREATE_STATIC: unique symbol;
|
||||
|
||||
export declare const CREATE_TEXT: unique symbol;
|
||||
|
||||
export declare const CREATE_VNODE: unique symbol;
|
||||
|
||||
export declare function createArrayExpression(elements: ArrayExpression['elements'], loc?: SourceLocation): ArrayExpression;
|
||||
|
||||
export declare function createAssignmentExpression(left: AssignmentExpression['left'], right: AssignmentExpression['right']): AssignmentExpression;
|
||||
|
||||
export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
|
||||
|
||||
export declare function createCacheExpression(index: number, value: JSChildNode, isVNode?: boolean): CacheExpression;
|
||||
|
||||
export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
|
||||
|
||||
export declare function createCompilerError<T extends number>(code: T, loc?: SourceLocation, messages?: {
|
||||
[code: number]: string;
|
||||
}, additionalMessage?: string): T extends ErrorCodes ? CoreCompilerError : CompilerError;
|
||||
|
||||
export declare function createCompoundExpression(children: CompoundExpressionNode['children'], loc?: SourceLocation): CompoundExpressionNode;
|
||||
|
||||
export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
|
||||
|
||||
export declare function createForLoopParams({ value, key, index }: ForParseResult): ExpressionNode[];
|
||||
|
||||
export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
|
||||
|
||||
export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
|
||||
|
||||
export declare function createInterpolation(content: InterpolationNode['content'] | string, loc: SourceLocation): InterpolationNode;
|
||||
|
||||
export declare function createObjectExpression(properties: ObjectExpression['properties'], loc?: SourceLocation): ObjectExpression;
|
||||
|
||||
export declare function createObjectProperty(key: Property['key'] | string, value: Property['value']): Property;
|
||||
|
||||
export declare function createReturnStatement(returns: ReturnStatement['returns']): ReturnStatement;
|
||||
|
||||
export declare function createRoot(children: TemplateChildNode[], loc?: SourceLocation): RootNode;
|
||||
|
||||
export declare function createSequenceExpression(expressions: SequenceExpression['expressions']): SequenceExpression;
|
||||
|
||||
export declare function createSimpleExpression(content: SimpleExpressionNode['content'], isStatic: SimpleExpressionNode['isStatic'], loc?: SourceLocation, isConstant?: boolean): SimpleExpressionNode;
|
||||
|
||||
export declare function createStructuralDirectiveTransform(name: string | RegExp, fn: StructuralDirectiveTransform): NodeTransform;
|
||||
|
||||
export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
|
||||
|
||||
export declare function createTransformContext(root: RootNode, { prefixIdentifiers, hoistStatic, cacheHandlers, nodeTransforms, directiveTransforms, transformHoist, isBuiltInComponent, isCustomElement, expressionPlugins, scopeId, ssr, ssrCssVars, bindingMetadata, onError }: TransformOptions): TransformContext;
|
||||
|
||||
export declare function createVNodeCall(context: TransformContext | null, tag: VNodeCall['tag'], props?: VNodeCall['props'], children?: VNodeCall['children'], patchFlag?: VNodeCall['patchFlag'], dynamicProps?: VNodeCall['dynamicProps'], directives?: VNodeCall['directives'], isBlock?: VNodeCall['isBlock'], disableTracking?: VNodeCall['disableTracking'], loc?: SourceLocation): VNodeCall;
|
||||
|
||||
export declare interface DirectiveArgumentNode extends ArrayExpression {
|
||||
elements: [string] | [string, ExpressionNode] | [string, ExpressionNode, ExpressionNode] | [string, ExpressionNode, ExpressionNode, ObjectExpression];
|
||||
}
|
||||
|
||||
export declare interface DirectiveArguments extends ArrayExpression {
|
||||
elements: DirectiveArgumentNode[];
|
||||
}
|
||||
|
||||
export declare interface DirectiveNode extends Node_2 {
|
||||
type: NodeTypes.DIRECTIVE;
|
||||
name: string;
|
||||
exp: ExpressionNode | undefined;
|
||||
arg: ExpressionNode | undefined;
|
||||
modifiers: string[];
|
||||
/**
|
||||
* optional property to cache the expression parse result for v-for
|
||||
*/
|
||||
parseResult?: ForParseResult;
|
||||
}
|
||||
|
||||
export declare type DirectiveTransform = (dir: DirectiveNode, node: ElementNode, context: TransformContext, augmentor?: (ret: DirectiveTransformResult) => DirectiveTransformResult) => DirectiveTransformResult;
|
||||
|
||||
declare interface DirectiveTransformResult {
|
||||
props: Property[];
|
||||
needRuntime?: boolean | symbol;
|
||||
ssrTagParts?: TemplateLiteral['elements'];
|
||||
}
|
||||
|
||||
export declare interface DynamicSlotEntries extends ArrayExpression {
|
||||
elements: (ConditionalDynamicSlotNode | ListDynamicSlotNode)[];
|
||||
}
|
||||
|
||||
export declare interface DynamicSlotFnProperty extends Property {
|
||||
value: SlotFunctionExpression;
|
||||
}
|
||||
|
||||
export declare interface DynamicSlotNode extends ObjectExpression {
|
||||
properties: [Property, DynamicSlotFnProperty];
|
||||
}
|
||||
|
||||
export declare interface DynamicSlotsExpression extends CallExpression {
|
||||
callee: typeof CREATE_SLOTS;
|
||||
arguments: [SlotsObjectExpression, DynamicSlotEntries];
|
||||
}
|
||||
|
||||
export declare type ElementNode = PlainElementNode | ComponentNode | SlotOutletNode | TemplateNode;
|
||||
|
||||
export declare const enum ElementTypes {
|
||||
ELEMENT = 0,
|
||||
COMPONENT = 1,
|
||||
SLOT = 2,
|
||||
TEMPLATE = 3
|
||||
}
|
||||
|
||||
export declare const enum ErrorCodes {
|
||||
ABRUPT_CLOSING_OF_EMPTY_COMMENT = 0,
|
||||
CDATA_IN_HTML_CONTENT = 1,
|
||||
DUPLICATE_ATTRIBUTE = 2,
|
||||
END_TAG_WITH_ATTRIBUTES = 3,
|
||||
END_TAG_WITH_TRAILING_SOLIDUS = 4,
|
||||
EOF_BEFORE_TAG_NAME = 5,
|
||||
EOF_IN_CDATA = 6,
|
||||
EOF_IN_COMMENT = 7,
|
||||
EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT = 8,
|
||||
EOF_IN_TAG = 9,
|
||||
INCORRECTLY_CLOSED_COMMENT = 10,
|
||||
INCORRECTLY_OPENED_COMMENT = 11,
|
||||
INVALID_FIRST_CHARACTER_OF_TAG_NAME = 12,
|
||||
MISSING_ATTRIBUTE_VALUE = 13,
|
||||
MISSING_END_TAG_NAME = 14,
|
||||
MISSING_WHITESPACE_BETWEEN_ATTRIBUTES = 15,
|
||||
NESTED_COMMENT = 16,
|
||||
UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME = 17,
|
||||
UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE = 18,
|
||||
UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME = 19,
|
||||
UNEXPECTED_NULL_CHARACTER = 20,
|
||||
UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME = 21,
|
||||
UNEXPECTED_SOLIDUS_IN_TAG = 22,
|
||||
X_INVALID_END_TAG = 23,
|
||||
X_MISSING_END_TAG = 24,
|
||||
X_MISSING_INTERPOLATION_END = 25,
|
||||
X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END = 26,
|
||||
X_V_IF_NO_EXPRESSION = 27,
|
||||
X_V_IF_SAME_KEY = 28,
|
||||
X_V_ELSE_NO_ADJACENT_IF = 29,
|
||||
X_V_FOR_NO_EXPRESSION = 30,
|
||||
X_V_FOR_MALFORMED_EXPRESSION = 31,
|
||||
X_V_FOR_TEMPLATE_KEY_PLACEMENT = 32,
|
||||
X_V_BIND_NO_EXPRESSION = 33,
|
||||
X_V_ON_NO_EXPRESSION = 34,
|
||||
X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET = 35,
|
||||
X_V_SLOT_MIXED_SLOT_USAGE = 36,
|
||||
X_V_SLOT_DUPLICATE_SLOT_NAMES = 37,
|
||||
X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN = 38,
|
||||
X_V_SLOT_MISPLACED = 39,
|
||||
X_V_MODEL_NO_EXPRESSION = 40,
|
||||
X_V_MODEL_MALFORMED_EXPRESSION = 41,
|
||||
X_V_MODEL_ON_SCOPE_VARIABLE = 42,
|
||||
X_INVALID_EXPRESSION = 43,
|
||||
X_KEEP_ALIVE_INVALID_CHILDREN = 44,
|
||||
X_PREFIX_ID_NOT_SUPPORTED = 45,
|
||||
X_MODULE_MODE_NOT_SUPPORTED = 46,
|
||||
X_CACHE_HANDLER_NOT_SUPPORTED = 47,
|
||||
X_SCOPE_ID_NOT_SUPPORTED = 48,
|
||||
__EXTEND_POINT__ = 49
|
||||
}
|
||||
|
||||
export declare type ExpressionNode = SimpleExpressionNode | CompoundExpressionNode;
|
||||
|
||||
export declare function findDir(node: ElementNode, name: string | RegExp, allowEmpty?: boolean): DirectiveNode | undefined;
|
||||
|
||||
export declare function findProp(node: ElementNode, name: string, dynamicOnly?: boolean, allowEmpty?: boolean): ElementNode['props'][0] | undefined;
|
||||
|
||||
export declare interface ForCodegenNode extends VNodeCall {
|
||||
isBlock: true;
|
||||
tag: typeof FRAGMENT;
|
||||
props: undefined;
|
||||
children: ForRenderListExpression;
|
||||
patchFlag: string;
|
||||
disableTracking: boolean;
|
||||
}
|
||||
|
||||
export declare interface ForIteratorExpression extends FunctionExpression {
|
||||
returns: BlockCodegenNode;
|
||||
}
|
||||
|
||||
export declare interface ForNode extends Node_2 {
|
||||
type: NodeTypes.FOR;
|
||||
source: ExpressionNode;
|
||||
valueAlias: ExpressionNode | undefined;
|
||||
keyAlias: ExpressionNode | undefined;
|
||||
objectIndexAlias: ExpressionNode | undefined;
|
||||
parseResult: ForParseResult;
|
||||
children: TemplateChildNode[];
|
||||
codegenNode?: ForCodegenNode;
|
||||
}
|
||||
|
||||
declare interface ForParseResult {
|
||||
source: ExpressionNode;
|
||||
value: ExpressionNode | undefined;
|
||||
key: ExpressionNode | undefined;
|
||||
index: ExpressionNode | undefined;
|
||||
}
|
||||
|
||||
export declare interface ForRenderListExpression extends CallExpression {
|
||||
callee: typeof RENDER_LIST;
|
||||
arguments: [ExpressionNode, ForIteratorExpression];
|
||||
}
|
||||
|
||||
export declare const FRAGMENT: unique symbol;
|
||||
|
||||
export declare interface FunctionExpression extends Node_2 {
|
||||
type: NodeTypes.JS_FUNCTION_EXPRESSION;
|
||||
params: ExpressionNode | string | (ExpressionNode | string)[] | undefined;
|
||||
returns?: TemplateChildNode | TemplateChildNode[] | JSChildNode;
|
||||
body?: BlockStatement | IfStatement;
|
||||
newline: boolean;
|
||||
/**
|
||||
* This flag is for codegen to determine whether it needs to generate the
|
||||
* withScopeId() wrapper
|
||||
*/
|
||||
isSlot: boolean;
|
||||
}
|
||||
|
||||
export declare function generate(ast: RootNode, options?: CodegenOptions & {
|
||||
onContextCreated?: (context: CodegenContext) => void;
|
||||
}): CodegenResult;
|
||||
export { generateCodeFrame }
|
||||
|
||||
export declare function getBaseTransformPreset(prefixIdentifiers?: boolean): TransformPreset;
|
||||
|
||||
export declare function getInnerRange(loc: SourceLocation, offset: number, length?: number): SourceLocation;
|
||||
|
||||
export declare function hasDynamicKeyVBind(node: ElementNode): boolean;
|
||||
|
||||
export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
|
||||
|
||||
export declare const helperNameMap: any;
|
||||
|
||||
export declare type HoistTransform = (children: TemplateChildNode[], context: TransformContext, parent: ParentNode_2) => void;
|
||||
|
||||
export declare interface IfBranchNode extends Node_2 {
|
||||
type: NodeTypes.IF_BRANCH;
|
||||
condition: ExpressionNode | undefined;
|
||||
children: TemplateChildNode[];
|
||||
userKey?: AttributeNode | DirectiveNode;
|
||||
}
|
||||
|
||||
export declare interface IfConditionalExpression extends ConditionalExpression {
|
||||
consequent: BlockCodegenNode;
|
||||
alternate: BlockCodegenNode | IfConditionalExpression;
|
||||
}
|
||||
|
||||
export declare interface IfNode extends Node_2 {
|
||||
type: NodeTypes.IF;
|
||||
branches: IfBranchNode[];
|
||||
codegenNode?: IfConditionalExpression | CacheExpression;
|
||||
}
|
||||
|
||||
export declare interface IfStatement extends Node_2 {
|
||||
type: NodeTypes.JS_IF_STATEMENT;
|
||||
test: ExpressionNode;
|
||||
consequent: BlockStatement;
|
||||
alternate: IfStatement | BlockStatement | ReturnStatement | undefined;
|
||||
}
|
||||
|
||||
declare interface ImportItem {
|
||||
exp: string | ExpressionNode;
|
||||
path: string;
|
||||
}
|
||||
|
||||
declare type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : CallExpression;
|
||||
|
||||
export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
|
||||
|
||||
export declare interface InterpolationNode extends Node_2 {
|
||||
type: NodeTypes.INTERPOLATION;
|
||||
content: ExpressionNode;
|
||||
}
|
||||
|
||||
export declare function isBindKey(arg: DirectiveNode['arg'], name: string): boolean;
|
||||
|
||||
export declare const isBuiltInType: (tag: string, expected: string) => boolean;
|
||||
|
||||
export declare function isCoreComponent(tag: string): symbol | void;
|
||||
|
||||
export declare const isMemberExpression: (path: string) => boolean;
|
||||
|
||||
export declare const isSimpleIdentifier: (name: string) => boolean;
|
||||
|
||||
export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
|
||||
|
||||
export declare const isStaticExp: (p: JSChildNode) => p is SimpleExpressionNode;
|
||||
|
||||
export declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
|
||||
|
||||
export declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
|
||||
|
||||
export declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
|
||||
|
||||
export declare type JSChildNode = VNodeCall | CallExpression | ObjectExpression | ArrayExpression | ExpressionNode | FunctionExpression | ConditionalExpression | CacheExpression | AssignmentExpression | SequenceExpression;
|
||||
|
||||
export declare const KEEP_ALIVE: unique symbol;
|
||||
|
||||
export declare interface ListDynamicSlotIterator extends FunctionExpression {
|
||||
returns: DynamicSlotNode;
|
||||
}
|
||||
|
||||
export declare interface ListDynamicSlotNode extends CallExpression {
|
||||
callee: typeof RENDER_LIST;
|
||||
arguments: [ExpressionNode, ListDynamicSlotIterator];
|
||||
}
|
||||
|
||||
export declare const locStub: SourceLocation;
|
||||
|
||||
export declare const MERGE_PROPS: unique symbol;
|
||||
|
||||
export declare type Namespace = number;
|
||||
|
||||
export declare const enum Namespaces {
|
||||
HTML = 0
|
||||
}
|
||||
|
||||
declare interface Node_2 {
|
||||
type: NodeTypes;
|
||||
loc: SourceLocation;
|
||||
}
|
||||
export { Node_2 as Node }
|
||||
|
||||
export declare type NodeTransform = (node: RootNode | TemplateChildNode, context: TransformContext) => void | (() => void) | (() => void)[];
|
||||
|
||||
export declare const enum NodeTypes {
|
||||
ROOT = 0,
|
||||
ELEMENT = 1,
|
||||
TEXT = 2,
|
||||
COMMENT = 3,
|
||||
SIMPLE_EXPRESSION = 4,
|
||||
INTERPOLATION = 5,
|
||||
ATTRIBUTE = 6,
|
||||
DIRECTIVE = 7,
|
||||
COMPOUND_EXPRESSION = 8,
|
||||
IF = 9,
|
||||
IF_BRANCH = 10,
|
||||
FOR = 11,
|
||||
TEXT_CALL = 12,
|
||||
VNODE_CALL = 13,
|
||||
JS_CALL_EXPRESSION = 14,
|
||||
JS_OBJECT_EXPRESSION = 15,
|
||||
JS_PROPERTY = 16,
|
||||
JS_ARRAY_EXPRESSION = 17,
|
||||
JS_FUNCTION_EXPRESSION = 18,
|
||||
JS_CONDITIONAL_EXPRESSION = 19,
|
||||
JS_CACHE_EXPRESSION = 20,
|
||||
JS_BLOCK_STATEMENT = 21,
|
||||
JS_TEMPLATE_LITERAL = 22,
|
||||
JS_IF_STATEMENT = 23,
|
||||
JS_ASSIGNMENT_EXPRESSION = 24,
|
||||
JS_SEQUENCE_EXPRESSION = 25,
|
||||
JS_RETURN_STATEMENT = 26
|
||||
}
|
||||
|
||||
export declare const noopDirectiveTransform: DirectiveTransform;
|
||||
|
||||
export declare interface ObjectExpression extends Node_2 {
|
||||
type: NodeTypes.JS_OBJECT_EXPRESSION;
|
||||
properties: Array<Property>;
|
||||
}
|
||||
|
||||
export declare const OPEN_BLOCK: unique symbol;
|
||||
|
||||
declare type ParentNode_2 = RootNode | ElementNode | IfBranchNode | ForNode;
|
||||
export { ParentNode_2 as ParentNode }
|
||||
|
||||
export declare interface ParserOptions {
|
||||
/**
|
||||
* e.g. platform native elements, e.g. `<div>` for browsers
|
||||
*/
|
||||
isNativeTag?: (tag: string) => boolean;
|
||||
/**
|
||||
* e.g. native elements that can self-close, e.g. `<img>`, `<br>`, `<hr>`
|
||||
*/
|
||||
isVoidTag?: (tag: string) => boolean;
|
||||
/**
|
||||
* e.g. elements that should preserve whitespace inside, e.g. `<pre>`
|
||||
*/
|
||||
isPreTag?: (tag: string) => boolean;
|
||||
/**
|
||||
* Platform-specific built-in components e.g. `<Transition>`
|
||||
*/
|
||||
isBuiltInComponent?: (tag: string) => symbol | void;
|
||||
/**
|
||||
* Separate option for end users to extend the native elements list
|
||||
*/
|
||||
isCustomElement?: (tag: string) => boolean | void;
|
||||
/**
|
||||
* Get tag namespace
|
||||
*/
|
||||
getNamespace?: (tag: string, parent: ElementNode | undefined) => Namespace;
|
||||
/**
|
||||
* Get text parsing mode for this element
|
||||
*/
|
||||
getTextMode?: (node: ElementNode, parent: ElementNode | undefined) => TextModes;
|
||||
/**
|
||||
* @default ['{{', '}}']
|
||||
*/
|
||||
delimiters?: [string, string];
|
||||
/**
|
||||
* Only needed for DOM compilers
|
||||
*/
|
||||
decodeEntities?: (rawText: string, asAttr: boolean) => string;
|
||||
onError?: (error: CompilerError) => void;
|
||||
/**
|
||||
* Keep comments in the templates AST, even in production
|
||||
*/
|
||||
comments?: boolean;
|
||||
}
|
||||
|
||||
export declare interface PlainElementNode extends BaseElementNode {
|
||||
tagType: ElementTypes.ELEMENT;
|
||||
codegenNode: VNodeCall | SimpleExpressionNode | CacheExpression | undefined;
|
||||
ssrCodegenNode?: TemplateLiteral;
|
||||
}
|
||||
|
||||
export declare const POP_SCOPE_ID: unique symbol;
|
||||
|
||||
declare interface Position_2 {
|
||||
offset: number;
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
export { Position_2 as Position }
|
||||
|
||||
export declare function processExpression(node: SimpleExpressionNode, context: TransformContext, asParams?: boolean, asRawStatements?: boolean): ExpressionNode;
|
||||
|
||||
export declare function processFor(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (forNode: ForNode) => (() => void) | undefined): (() => void) | undefined;
|
||||
|
||||
export declare function processIf(node: ElementNode, dir: DirectiveNode, context: TransformContext, processCodegen?: (node: IfNode, branch: IfBranchNode, isRoot: boolean) => (() => void) | undefined): (() => void) | undefined;
|
||||
|
||||
export declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
|
||||
|
||||
export declare interface Property extends Node_2 {
|
||||
type: NodeTypes.JS_PROPERTY;
|
||||
key: ExpressionNode;
|
||||
value: JSChildNode;
|
||||
}
|
||||
|
||||
declare type PropsExpression = ObjectExpression | CallExpression | ExpressionNode;
|
||||
|
||||
export declare const PUSH_SCOPE_ID: unique symbol;
|
||||
|
||||
export declare function registerRuntimeHelpers(helpers: any): void;
|
||||
|
||||
export declare const RENDER_LIST: unique symbol;
|
||||
|
||||
export declare const RENDER_SLOT: unique symbol;
|
||||
|
||||
export declare interface RenderSlotCall extends CallExpression {
|
||||
callee: typeof RENDER_SLOT;
|
||||
arguments: [string, string | ExpressionNode] | [string, string | ExpressionNode, PropsExpression] | [
|
||||
string,
|
||||
string | ExpressionNode,
|
||||
PropsExpression | '{}',
|
||||
TemplateChildNode[]
|
||||
];
|
||||
}
|
||||
|
||||
export declare const RESOLVE_COMPONENT: unique symbol;
|
||||
|
||||
export declare const RESOLVE_DIRECTIVE: unique symbol;
|
||||
|
||||
export declare const RESOLVE_DYNAMIC_COMPONENT: unique symbol;
|
||||
|
||||
export declare function resolveComponentType(node: ComponentNode, context: TransformContext, ssr?: boolean): string | symbol | CallExpression;
|
||||
|
||||
export declare interface ReturnStatement extends Node_2 {
|
||||
type: NodeTypes.JS_RETURN_STATEMENT;
|
||||
returns: TemplateChildNode | TemplateChildNode[] | JSChildNode;
|
||||
}
|
||||
|
||||
export declare interface RootNode extends Node_2 {
|
||||
type: NodeTypes.ROOT;
|
||||
children: TemplateChildNode[];
|
||||
helpers: symbol[];
|
||||
components: string[];
|
||||
directives: string[];
|
||||
hoists: (JSChildNode | null)[];
|
||||
imports: ImportItem[];
|
||||
cached: number;
|
||||
temps: number;
|
||||
ssrHelpers?: symbol[];
|
||||
codegenNode?: TemplateChildNode | JSChildNode | BlockStatement | undefined;
|
||||
}
|
||||
|
||||
export declare interface SequenceExpression extends Node_2 {
|
||||
type: NodeTypes.JS_SEQUENCE_EXPRESSION;
|
||||
expressions: JSChildNode[];
|
||||
}
|
||||
|
||||
export declare const SET_BLOCK_TRACKING: unique symbol;
|
||||
|
||||
export declare interface SimpleExpressionNode extends Node_2 {
|
||||
type: NodeTypes.SIMPLE_EXPRESSION;
|
||||
content: string;
|
||||
isStatic: boolean;
|
||||
isConstant: boolean;
|
||||
/**
|
||||
* Indicates this is an identifier for a hoist vnode call and points to the
|
||||
* hoisted node.
|
||||
*/
|
||||
hoisted?: JSChildNode;
|
||||
/**
|
||||
* an expression parsed as the params of a function will track
|
||||
* the identifiers declared inside the function body.
|
||||
*/
|
||||
identifiers?: string[];
|
||||
/**
|
||||
* some expressions (e.g. transformAssetUrls import identifiers) are constant,
|
||||
* but cannot be stringified because they must be first evaluated at runtime.
|
||||
*/
|
||||
isRuntimeConstant?: boolean;
|
||||
}
|
||||
|
||||
export declare type SlotFnBuilder = (slotProps: ExpressionNode | undefined, slotChildren: TemplateChildNode[], loc: SourceLocation) => FunctionExpression;
|
||||
|
||||
export declare interface SlotFunctionExpression extends FunctionExpression {
|
||||
returns: TemplateChildNode[];
|
||||
}
|
||||
|
||||
export declare interface SlotOutletNode extends BaseElementNode {
|
||||
tagType: ElementTypes.SLOT;
|
||||
codegenNode: RenderSlotCall | CacheExpression | undefined;
|
||||
ssrCodegenNode?: CallExpression;
|
||||
}
|
||||
|
||||
declare interface SlotOutletProcessResult {
|
||||
slotName: string | ExpressionNode;
|
||||
slotProps: PropsExpression | undefined;
|
||||
}
|
||||
|
||||
export declare type SlotsExpression = SlotsObjectExpression | DynamicSlotsExpression;
|
||||
|
||||
export declare interface SlotsObjectExpression extends ObjectExpression {
|
||||
properties: SlotsObjectProperty[];
|
||||
}
|
||||
|
||||
export declare interface SlotsObjectProperty extends Property {
|
||||
value: SlotFunctionExpression;
|
||||
}
|
||||
|
||||
export declare interface SourceLocation {
|
||||
start: Position_2;
|
||||
end: Position_2;
|
||||
source: string;
|
||||
}
|
||||
|
||||
export declare type SSRCodegenNode = BlockStatement | TemplateLiteral | IfStatement | AssignmentExpression | ReturnStatement | SequenceExpression;
|
||||
|
||||
export declare type StructuralDirectiveTransform = (node: ElementNode, dir: DirectiveNode, context: TransformContext) => void | (() => void);
|
||||
|
||||
export declare const SUSPENSE: unique symbol;
|
||||
|
||||
export declare const TELEPORT: unique symbol;
|
||||
|
||||
export declare type TemplateChildNode = ElementNode | InterpolationNode | CompoundExpressionNode | TextNode | CommentNode | IfNode | IfBranchNode | ForNode | TextCallNode;
|
||||
|
||||
export declare interface TemplateLiteral extends Node_2 {
|
||||
type: NodeTypes.JS_TEMPLATE_LITERAL;
|
||||
elements: (string | JSChildNode)[];
|
||||
}
|
||||
|
||||
export declare interface TemplateNode extends BaseElementNode {
|
||||
tagType: ElementTypes.TEMPLATE;
|
||||
codegenNode: undefined;
|
||||
}
|
||||
|
||||
export declare type TemplateTextChildNode = TextNode | InterpolationNode | CompoundExpressionNode;
|
||||
|
||||
export declare interface TextCallNode extends Node_2 {
|
||||
type: NodeTypes.TEXT_CALL;
|
||||
content: TextNode | InterpolationNode | CompoundExpressionNode;
|
||||
codegenNode: CallExpression | SimpleExpressionNode;
|
||||
}
|
||||
|
||||
export declare const enum TextModes {
|
||||
DATA = 0,
|
||||
RCDATA = 1,
|
||||
RAWTEXT = 2,
|
||||
CDATA = 3,
|
||||
ATTRIBUTE_VALUE = 4
|
||||
}
|
||||
|
||||
export declare interface TextNode extends Node_2 {
|
||||
type: NodeTypes.TEXT;
|
||||
content: string;
|
||||
}
|
||||
|
||||
export declare const TO_DISPLAY_STRING: unique symbol;
|
||||
|
||||
export declare const TO_HANDLER_KEY: unique symbol;
|
||||
|
||||
export declare const TO_HANDLERS: unique symbol;
|
||||
|
||||
export declare function toValidAssetId(name: string, type: 'component' | 'directive'): string;
|
||||
|
||||
export declare const trackSlotScopes: NodeTransform;
|
||||
|
||||
export declare const trackVForSlotScopes: NodeTransform;
|
||||
|
||||
export declare function transform(root: RootNode, options: TransformOptions): void;
|
||||
|
||||
export declare const transformBind: DirectiveTransform;
|
||||
|
||||
export declare interface TransformContext extends Required<TransformOptions> {
|
||||
root: RootNode;
|
||||
helpers: Set<symbol>;
|
||||
components: Set<string>;
|
||||
directives: Set<string>;
|
||||
hoists: (JSChildNode | null)[];
|
||||
imports: Set<ImportItem>;
|
||||
temps: number;
|
||||
cached: number;
|
||||
identifiers: {
|
||||
[name: string]: number | undefined;
|
||||
};
|
||||
scopes: {
|
||||
vFor: number;
|
||||
vSlot: number;
|
||||
vPre: number;
|
||||
vOnce: number;
|
||||
};
|
||||
parent: ParentNode_2 | null;
|
||||
childIndex: number;
|
||||
currentNode: RootNode | TemplateChildNode | null;
|
||||
helper<T extends symbol>(name: T): T;
|
||||
helperString(name: symbol): string;
|
||||
replaceNode(node: TemplateChildNode): void;
|
||||
removeNode(node?: TemplateChildNode): void;
|
||||
onNodeRemoved(): void;
|
||||
addIdentifiers(exp: ExpressionNode | string): void;
|
||||
removeIdentifiers(exp: ExpressionNode | string): void;
|
||||
hoist(exp: JSChildNode): SimpleExpressionNode;
|
||||
cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T;
|
||||
}
|
||||
|
||||
export declare const transformElement: NodeTransform;
|
||||
|
||||
export declare const transformExpression: NodeTransform;
|
||||
|
||||
export declare const transformModel: DirectiveTransform;
|
||||
|
||||
export declare const transformOn: DirectiveTransform;
|
||||
|
||||
export declare interface TransformOptions {
|
||||
/**
|
||||
* An array of node transforms to be applied to every AST node.
|
||||
*/
|
||||
nodeTransforms?: NodeTransform[];
|
||||
/**
|
||||
* An object of { name: transform } to be applied to every directive attribute
|
||||
* node found on element nodes.
|
||||
*/
|
||||
directiveTransforms?: Record<string, DirectiveTransform | undefined>;
|
||||
/**
|
||||
* An optional hook to transform a node being hoisted.
|
||||
* used by compiler-dom to turn hoisted nodes into stringified HTML vnodes.
|
||||
* @default null
|
||||
*/
|
||||
transformHoist?: HoistTransform | null;
|
||||
/**
|
||||
* If the pairing runtime provides additional built-in elements, use this to
|
||||
* mark them as built-in so the compiler will generate component vnodes
|
||||
* for them.
|
||||
*/
|
||||
isBuiltInComponent?: (tag: string) => symbol | void;
|
||||
/**
|
||||
* Used by some transforms that expects only native elements
|
||||
*/
|
||||
isCustomElement?: (tag: string) => boolean | void;
|
||||
/**
|
||||
* Transform expressions like {{ foo }} to `_ctx.foo`.
|
||||
* If this option is false, the generated code will be wrapped in a
|
||||
* `with (this) { ... }` block.
|
||||
* - This is force-enabled in module mode, since modules are by default strict
|
||||
* and cannot use `with`
|
||||
* @default mode === 'module'
|
||||
*/
|
||||
prefixIdentifiers?: boolean;
|
||||
/**
|
||||
* Hoist static VNodes and props objects to `_hoisted_x` constants
|
||||
* @default false
|
||||
*/
|
||||
hoistStatic?: boolean;
|
||||
/**
|
||||
* Cache v-on handlers to avoid creating new inline functions on each render,
|
||||
* also avoids the need for dynamically patching the handlers by wrapping it.
|
||||
* e.g `@click="foo"` by default is compiled to `{ onClick: foo }`. With this
|
||||
* option it's compiled to:
|
||||
* ```js
|
||||
* { onClick: _cache[0] || (_cache[0] = e => _ctx.foo(e)) }
|
||||
* ```
|
||||
* - Requires "prefixIdentifiers" to be enabled because it relies on scope
|
||||
* analysis to determine if a handler is safe to cache.
|
||||
* @default false
|
||||
*/
|
||||
cacheHandlers?: boolean;
|
||||
/**
|
||||
* A list of parser plugins to enable for `@babel/parser`, which is used to
|
||||
* parse expressions in bindings and interpolations.
|
||||
* https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
*/
|
||||
expressionPlugins?: ParserPlugin[];
|
||||
/**
|
||||
* SFC scoped styles ID
|
||||
*/
|
||||
scopeId?: string | null;
|
||||
/**
|
||||
* Generate SSR-optimized render functions instead.
|
||||
* The resulting function must be attached to the component via the
|
||||
* `ssrRender` option instead of `render`.
|
||||
*/
|
||||
ssr?: boolean;
|
||||
/**
|
||||
* SFC `<style vars>` injection string
|
||||
* needed to render inline CSS variables on component root
|
||||
*/
|
||||
ssrCssVars?: string;
|
||||
/**
|
||||
* Optional binding metadata analyzed from script - used to optimize
|
||||
* binding access when `prefixIdentifiers` is enabled.
|
||||
*/
|
||||
bindingMetadata?: BindingMetadata;
|
||||
onError?: (error: CompilerError) => void;
|
||||
}
|
||||
|
||||
export declare type TransformPreset = [
|
||||
NodeTransform[],
|
||||
Record<string, DirectiveTransform>
|
||||
];
|
||||
|
||||
export declare function traverseNode(node: RootNode | TemplateChildNode, context: TransformContext): void;
|
||||
|
||||
export declare interface VNodeCall extends Node_2 {
|
||||
type: NodeTypes.VNODE_CALL;
|
||||
tag: string | symbol | CallExpression;
|
||||
props: PropsExpression | undefined;
|
||||
children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | undefined;
|
||||
patchFlag: string | undefined;
|
||||
dynamicProps: string | undefined;
|
||||
directives: DirectiveArguments | undefined;
|
||||
isBlock: boolean;
|
||||
disableTracking: boolean;
|
||||
}
|
||||
|
||||
export declare const WITH_CTX: unique symbol;
|
||||
|
||||
export declare const WITH_DIRECTIVES: unique symbol;
|
||||
|
||||
export declare const WITH_SCOPE_ID: unique symbol;
|
||||
|
||||
export { }
|
||||
3919
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
3919
node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-core/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-core.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-core.cjs.js')
|
||||
}
|
||||
73
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
73
node_modules/@vue/compiler-core/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/compiler-core@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/compiler-core@3.0.2",
|
||||
"_id": "@vue/compiler-core@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-d5C3ofy7pazk2BpwzlkJb6XJVzQ=",
|
||||
"_location": "/@vue/compiler-core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/compiler-core@3.0.2",
|
||||
"name": "@vue/compiler-core",
|
||||
"escapedName": "@vue%2fcompiler-core",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/compiler-dom",
|
||||
"/@vue/compiler-sfc"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fcompiler-core/-/compiler-core-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerCore",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.12.0",
|
||||
"@babel/types": "^7.12.0",
|
||||
"@vue/shared": "3.0.2",
|
||||
"estree-walker": "^2.0.1",
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"description": "@vue/compiler-core",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-core#readme",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-core.esm-bundler.js",
|
||||
"name": "@vue/compiler-core",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/compiler-core"
|
||||
},
|
||||
"types": "dist/compiler-core.d.ts",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/compiler-dom/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
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.
|
||||
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# @vue/compiler-dom
|
||||
3071
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
3071
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3029
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
3029
node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
65
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
65
node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import { CodegenResult } from '@vue/compiler-core';
|
||||
import { CompilerError } from '@vue/compiler-core';
|
||||
import { CompilerOptions } from '@vue/compiler-core';
|
||||
import { DirectiveTransform } from '@vue/compiler-core';
|
||||
import { NodeTransform } from '@vue/compiler-core';
|
||||
import { ParserOptions } from '@vue/compiler-core';
|
||||
import { RootNode } from '@vue/compiler-core';
|
||||
import { SourceLocation } from '@vue/compiler-core';
|
||||
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
||||
|
||||
declare interface DOMCompilerError extends CompilerError {
|
||||
code: DOMErrorCodes;
|
||||
}
|
||||
|
||||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
||||
|
||||
export declare const enum DOMErrorCodes {
|
||||
X_V_HTML_NO_EXPRESSION = 49,
|
||||
X_V_HTML_WITH_CHILDREN = 50,
|
||||
X_V_TEXT_NO_EXPRESSION = 51,
|
||||
X_V_TEXT_WITH_CHILDREN = 52,
|
||||
X_V_MODEL_ON_INVALID_ELEMENT = 53,
|
||||
X_V_MODEL_ARG_ON_ELEMENT = 54,
|
||||
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 55,
|
||||
X_V_MODEL_UNNECESSARY_VALUE = 56,
|
||||
X_V_SHOW_NO_EXPRESSION = 57,
|
||||
X_TRANSITION_INVALID_CHILDREN = 58,
|
||||
X_IGNORED_SIDE_EFFECT_TAG = 59,
|
||||
__EXTEND_POINT__ = 60
|
||||
}
|
||||
|
||||
export declare const DOMNodeTransforms: NodeTransform[];
|
||||
|
||||
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
||||
|
||||
export declare const parserOptions: ParserOptions;
|
||||
|
||||
export declare const transformStyle: NodeTransform;
|
||||
|
||||
export declare const TRANSITION: unique symbol;
|
||||
|
||||
export declare const TRANSITION_GROUP: unique symbol;
|
||||
|
||||
export declare const V_MODEL_CHECKBOX: unique symbol;
|
||||
|
||||
export declare const V_MODEL_DYNAMIC: unique symbol;
|
||||
|
||||
export declare const V_MODEL_RADIO: unique symbol;
|
||||
|
||||
export declare const V_MODEL_SELECT: unique symbol;
|
||||
|
||||
export declare const V_MODEL_TEXT: unique symbol;
|
||||
|
||||
export declare const V_ON_WITH_KEYS: unique symbol;
|
||||
|
||||
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
||||
|
||||
export declare const V_SHOW: unique symbol;
|
||||
|
||||
export * from "@vue/compiler-core";
|
||||
|
||||
export { }
|
||||
4316
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
4316
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
448
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
448
node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js
generated
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
import { registerRuntimeHelpers, isBuiltInType, createSimpleExpression, createCompilerError, createObjectProperty, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, transformOn as transformOn$1, createCompoundExpression, isStaticExp, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
|
||||
export * from '@vue/compiler-core';
|
||||
import { isVoidTag, isHTMLTag, isSVGTag, makeMap, parseStringStyle, capitalize, extend } from '@vue/shared';
|
||||
|
||||
const V_MODEL_RADIO = Symbol((process.env.NODE_ENV !== 'production') ? `vModelRadio` : ``);
|
||||
const V_MODEL_CHECKBOX = Symbol((process.env.NODE_ENV !== 'production') ? `vModelCheckbox` : ``);
|
||||
const V_MODEL_TEXT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelText` : ``);
|
||||
const V_MODEL_SELECT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelSelect` : ``);
|
||||
const V_MODEL_DYNAMIC = Symbol((process.env.NODE_ENV !== 'production') ? `vModelDynamic` : ``);
|
||||
const V_ON_WITH_MODIFIERS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnModifiersGuard` : ``);
|
||||
const V_ON_WITH_KEYS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnKeysGuard` : ``);
|
||||
const V_SHOW = Symbol((process.env.NODE_ENV !== 'production') ? `vShow` : ``);
|
||||
const TRANSITION = Symbol((process.env.NODE_ENV !== 'production') ? `Transition` : ``);
|
||||
const TRANSITION_GROUP = Symbol((process.env.NODE_ENV !== 'production') ? `TransitionGroup` : ``);
|
||||
registerRuntimeHelpers({
|
||||
[V_MODEL_RADIO]: `vModelRadio`,
|
||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||
[V_MODEL_TEXT]: `vModelText`,
|
||||
[V_MODEL_SELECT]: `vModelSelect`,
|
||||
[V_MODEL_DYNAMIC]: `vModelDynamic`,
|
||||
[V_ON_WITH_MODIFIERS]: `withModifiers`,
|
||||
[V_ON_WITH_KEYS]: `withKeys`,
|
||||
[V_SHOW]: `vShow`,
|
||||
[TRANSITION]: `Transition`,
|
||||
[TRANSITION_GROUP]: `TransitionGroup`
|
||||
});
|
||||
|
||||
/* eslint-disable no-restricted-globals */
|
||||
let decoder;
|
||||
function decodeHtmlBrowser(raw) {
|
||||
(decoder || (decoder = document.createElement('div'))).innerHTML = raw;
|
||||
return decoder.textContent;
|
||||
}
|
||||
|
||||
const isRawTextContainer = /*#__PURE__*/ makeMap('style,iframe,script,noscript', true);
|
||||
const parserOptions = {
|
||||
isVoidTag,
|
||||
isNativeTag: tag => isHTMLTag(tag) || isSVGTag(tag),
|
||||
isPreTag: tag => tag === 'pre',
|
||||
decodeEntities: decodeHtmlBrowser ,
|
||||
isBuiltInComponent: (tag) => {
|
||||
if (isBuiltInType(tag, `Transition`)) {
|
||||
return TRANSITION;
|
||||
}
|
||||
else if (isBuiltInType(tag, `TransitionGroup`)) {
|
||||
return TRANSITION_GROUP;
|
||||
}
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||
getNamespace(tag, parent) {
|
||||
let ns = parent ? parent.ns : 0 /* HTML */;
|
||||
if (parent && ns === 2 /* MATH_ML */) {
|
||||
if (parent.tag === 'annotation-xml') {
|
||||
if (tag === 'svg') {
|
||||
return 1 /* SVG */;
|
||||
}
|
||||
if (parent.props.some(a => a.type === 6 /* ATTRIBUTE */ &&
|
||||
a.name === 'encoding' &&
|
||||
a.value != null &&
|
||||
(a.value.content === 'text/html' ||
|
||||
a.value.content === 'application/xhtml+xml'))) {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
|
||||
tag !== 'mglyph' &&
|
||||
tag !== 'malignmark') {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
else if (parent && ns === 1 /* SVG */) {
|
||||
if (parent.tag === 'foreignObject' ||
|
||||
parent.tag === 'desc' ||
|
||||
parent.tag === 'title') {
|
||||
ns = 0 /* HTML */;
|
||||
}
|
||||
}
|
||||
if (ns === 0 /* HTML */) {
|
||||
if (tag === 'svg') {
|
||||
return 1 /* SVG */;
|
||||
}
|
||||
if (tag === 'math') {
|
||||
return 2 /* MATH_ML */;
|
||||
}
|
||||
}
|
||||
return ns;
|
||||
},
|
||||
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
||||
getTextMode({ tag, ns }) {
|
||||
if (ns === 0 /* HTML */) {
|
||||
if (tag === 'textarea' || tag === 'title') {
|
||||
return 1 /* RCDATA */;
|
||||
}
|
||||
if (isRawTextContainer(tag)) {
|
||||
return 2 /* RAWTEXT */;
|
||||
}
|
||||
}
|
||||
return 0 /* DATA */;
|
||||
}
|
||||
};
|
||||
|
||||
// Parse inline CSS strings for static style attributes into an object.
|
||||
// This is a NodeTransform since it works on the static `style` attribute and
|
||||
// converts it into a dynamic equivalent:
|
||||
// style="color: red" -> :style='{ "color": "red" }'
|
||||
// It is then processed by `transformElement` and included in the generated
|
||||
// props.
|
||||
const transformStyle = node => {
|
||||
if (node.type === 1 /* ELEMENT */) {
|
||||
node.props.forEach((p, i) => {
|
||||
if (p.type === 6 /* ATTRIBUTE */ && p.name === 'style' && p.value) {
|
||||
// replace p with an expression node
|
||||
node.props[i] = {
|
||||
type: 7 /* DIRECTIVE */,
|
||||
name: `bind`,
|
||||
arg: createSimpleExpression(`style`, true, p.loc),
|
||||
exp: parseInlineCSS(p.value.content, p.loc),
|
||||
modifiers: [],
|
||||
loc: p.loc
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const parseInlineCSS = (cssText, loc) => {
|
||||
const normalized = parseStringStyle(cssText);
|
||||
return createSimpleExpression(JSON.stringify(normalized), false, loc, true);
|
||||
};
|
||||
|
||||
function createDOMCompilerError(code, loc) {
|
||||
return createCompilerError(code, loc, (process.env.NODE_ENV !== 'production') || !true ? DOMErrorMessages : undefined);
|
||||
}
|
||||
const DOMErrorMessages = {
|
||||
[49 /* X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
||||
[50 /* X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
||||
[51 /* X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
||||
[52 /* X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
||||
[53 /* X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||
[54 /* X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
||||
[55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||
[56 /* X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||
[57 /* X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
||||
[58 /* X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
||||
[59 /* X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||
};
|
||||
|
||||
const transformVHtml = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(49 /* X_V_HTML_NO_EXPRESSION */, loc));
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(createDOMCompilerError(50 /* X_V_HTML_WITH_CHILDREN */, loc));
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression('', true))
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformVText = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(51 /* X_V_TEXT_NO_EXPRESSION */, loc));
|
||||
}
|
||||
if (node.children.length) {
|
||||
context.onError(createDOMCompilerError(52 /* X_V_TEXT_WITH_CHILDREN */, loc));
|
||||
node.children.length = 0;
|
||||
}
|
||||
return {
|
||||
props: [
|
||||
createObjectProperty(createSimpleExpression(`textContent`, true), exp
|
||||
? createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc)
|
||||
: createSimpleExpression('', true))
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const transformModel = (dir, node, context) => {
|
||||
const baseResult = transformModel$1(dir, node, context);
|
||||
// base transform has errors OR component v-model (only need props)
|
||||
if (!baseResult.props.length || node.tagType === 1 /* COMPONENT */) {
|
||||
return baseResult;
|
||||
}
|
||||
if (dir.arg) {
|
||||
context.onError(createDOMCompilerError(54 /* X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
||||
}
|
||||
function checkDuplicatedValue() {
|
||||
const value = findProp(node, 'value');
|
||||
if (value) {
|
||||
context.onError(createDOMCompilerError(56 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
||||
}
|
||||
}
|
||||
const { tag } = node;
|
||||
const isCustomElement = context.isCustomElement(tag);
|
||||
if (tag === 'input' ||
|
||||
tag === 'textarea' ||
|
||||
tag === 'select' ||
|
||||
isCustomElement) {
|
||||
let directiveToUse = V_MODEL_TEXT;
|
||||
let isInvalidType = false;
|
||||
if (tag === 'input' || isCustomElement) {
|
||||
const type = findProp(node, `type`);
|
||||
if (type) {
|
||||
if (type.type === 7 /* DIRECTIVE */) {
|
||||
// :type="foo"
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
}
|
||||
else if (type.value) {
|
||||
switch (type.value.content) {
|
||||
case 'radio':
|
||||
directiveToUse = V_MODEL_RADIO;
|
||||
break;
|
||||
case 'checkbox':
|
||||
directiveToUse = V_MODEL_CHECKBOX;
|
||||
break;
|
||||
case 'file':
|
||||
isInvalidType = true;
|
||||
context.onError(createDOMCompilerError(55 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
||||
break;
|
||||
default:
|
||||
// text type
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (hasDynamicKeyVBind(node)) {
|
||||
// element has bindings with dynamic keys, which can possibly contain
|
||||
// "type".
|
||||
directiveToUse = V_MODEL_DYNAMIC;
|
||||
}
|
||||
else {
|
||||
// text type
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
}
|
||||
}
|
||||
else if (tag === 'select') {
|
||||
directiveToUse = V_MODEL_SELECT;
|
||||
}
|
||||
else {
|
||||
// textarea
|
||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
||||
}
|
||||
// inject runtime directive
|
||||
// by returning the helper symbol via needRuntime
|
||||
// the import will replaced a resolveDirective call.
|
||||
if (!isInvalidType) {
|
||||
baseResult.needRuntime = context.helper(directiveToUse);
|
||||
}
|
||||
}
|
||||
else {
|
||||
context.onError(createDOMCompilerError(53 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
||||
}
|
||||
// native vmodel doesn't need the `modelValue` props since they are also
|
||||
// passed to the runtime as `binding.value`. removing it reduces code size.
|
||||
baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* SIMPLE_EXPRESSION */ &&
|
||||
p.key.content === 'modelValue'));
|
||||
return baseResult;
|
||||
};
|
||||
|
||||
const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`);
|
||||
const isNonKeyModifier = /*#__PURE__*/ makeMap(
|
||||
// event propagation management
|
||||
`stop,prevent,self,` +
|
||||
// system modifiers + exact
|
||||
`ctrl,shift,alt,meta,exact,` +
|
||||
// mouse
|
||||
`middle`);
|
||||
// left & right could be mouse or key modifiers based on event type
|
||||
const maybeKeyModifier = /*#__PURE__*/ makeMap('left,right');
|
||||
const isKeyboardEvent = /*#__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`, true);
|
||||
const resolveModifiers = (key, modifiers) => {
|
||||
const keyModifiers = [];
|
||||
const nonKeyModifiers = [];
|
||||
const eventOptionModifiers = [];
|
||||
for (let i = 0; i < modifiers.length; i++) {
|
||||
const modifier = modifiers[i];
|
||||
if (isEventOptionModifier(modifier)) {
|
||||
// eventOptionModifiers: modifiers for addEventListener() options,
|
||||
// e.g. .passive & .capture
|
||||
eventOptionModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
// runtimeModifiers: modifiers that needs runtime guards
|
||||
if (maybeKeyModifier(modifier)) {
|
||||
if (isStaticExp(key)) {
|
||||
if (isKeyboardEvent(key.content)) {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
else {
|
||||
keyModifiers.push(modifier);
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isNonKeyModifier(modifier)) {
|
||||
nonKeyModifiers.push(modifier);
|
||||
}
|
||||
else {
|
||||
keyModifiers.push(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
keyModifiers,
|
||||
nonKeyModifiers,
|
||||
eventOptionModifiers
|
||||
};
|
||||
};
|
||||
const transformClick = (key, event) => {
|
||||
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === 'onclick';
|
||||
return isStaticClick
|
||||
? createSimpleExpression(event, true)
|
||||
: key.type !== 4 /* SIMPLE_EXPRESSION */
|
||||
? createCompoundExpression([
|
||||
`(`,
|
||||
key,
|
||||
`) === "onClick" ? "${event}" : (`,
|
||||
key,
|
||||
`)`
|
||||
])
|
||||
: key;
|
||||
};
|
||||
const transformOn = (dir, node, context) => {
|
||||
return transformOn$1(dir, node, context, baseResult => {
|
||||
const { modifiers } = dir;
|
||||
if (!modifiers.length)
|
||||
return baseResult;
|
||||
let { key, value: handlerExp } = baseResult.props[0];
|
||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers);
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
if (nonKeyModifiers.includes('right')) {
|
||||
key = transformClick(key, `onContextmenu`);
|
||||
}
|
||||
if (nonKeyModifiers.includes('middle')) {
|
||||
key = transformClick(key, `onMouseup`);
|
||||
}
|
||||
if (nonKeyModifiers.length) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [
|
||||
handlerExp,
|
||||
JSON.stringify(nonKeyModifiers)
|
||||
]);
|
||||
}
|
||||
if (keyModifiers.length &&
|
||||
// if event name is dynamic, always wrap with keys guard
|
||||
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||
handlerExp,
|
||||
JSON.stringify(keyModifiers)
|
||||
]);
|
||||
}
|
||||
if (eventOptionModifiers.length) {
|
||||
const modifierPostfix = eventOptionModifiers.map(capitalize).join('');
|
||||
key = isStaticExp(key)
|
||||
? createSimpleExpression(`${key.content}${modifierPostfix}`, true)
|
||||
: createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||
}
|
||||
return {
|
||||
props: [createObjectProperty(key, handlerExp)]
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const transformShow = (dir, node, context) => {
|
||||
const { exp, loc } = dir;
|
||||
if (!exp) {
|
||||
context.onError(createDOMCompilerError(57 /* X_V_SHOW_NO_EXPRESSION */, loc));
|
||||
}
|
||||
return {
|
||||
props: [],
|
||||
needRuntime: context.helper(V_SHOW)
|
||||
};
|
||||
};
|
||||
|
||||
const warnTransitionChildren = (node, context) => {
|
||||
if (node.type === 1 /* ELEMENT */ &&
|
||||
node.tagType === 1 /* COMPONENT */) {
|
||||
const component = context.isBuiltInComponent(node.tag);
|
||||
if (component === TRANSITION) {
|
||||
return () => {
|
||||
if (node.children.length && hasMultipleChildren(node)) {
|
||||
context.onError(createDOMCompilerError(58 /* X_TRANSITION_INVALID_CHILDREN */, {
|
||||
start: node.children[0].loc.start,
|
||||
end: node.children[node.children.length - 1].loc.end,
|
||||
source: ''
|
||||
}));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
function hasMultipleChildren(node) {
|
||||
// #1352 filter out potential comment nodes.
|
||||
const children = (node.children = node.children.filter(c => c.type !== 3 /* COMMENT */));
|
||||
const child = children[0];
|
||||
return (children.length !== 1 ||
|
||||
child.type === 11 /* FOR */ ||
|
||||
(child.type === 9 /* IF */ && child.branches.some(hasMultipleChildren)));
|
||||
}
|
||||
|
||||
const ignoreSideEffectTags = (node, context) => {
|
||||
if (node.type === 1 /* ELEMENT */ &&
|
||||
node.tagType === 0 /* ELEMENT */ &&
|
||||
(node.tag === 'script' || node.tag === 'style')) {
|
||||
context.onError(createDOMCompilerError(59 /* X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
||||
context.removeNode();
|
||||
}
|
||||
};
|
||||
|
||||
const DOMNodeTransforms = [
|
||||
transformStyle,
|
||||
...((process.env.NODE_ENV !== 'production') ? [warnTransitionChildren] : [])
|
||||
];
|
||||
const DOMDirectiveTransforms = {
|
||||
cloak: noopDirectiveTransform,
|
||||
html: transformVHtml,
|
||||
text: transformVText,
|
||||
model: transformModel,
|
||||
on: transformOn,
|
||||
show: transformShow
|
||||
};
|
||||
function compile(template, options = {}) {
|
||||
return baseCompile(template, extend({}, parserOptions, options, {
|
||||
nodeTransforms: [
|
||||
// ignore <script> and <tag>
|
||||
// this is not put inside DOMNodeTransforms because that list is used
|
||||
// by compiler-ssr to generate vnode fallback branches
|
||||
ignoreSideEffectTags,
|
||||
...DOMNodeTransforms,
|
||||
...(options.nodeTransforms || [])
|
||||
],
|
||||
directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
|
||||
transformHoist: null
|
||||
}));
|
||||
}
|
||||
function parse(template, options = {}) {
|
||||
return baseParse(template, extend({}, parserOptions, options));
|
||||
}
|
||||
|
||||
export { DOMDirectiveTransforms, DOMNodeTransforms, TRANSITION, TRANSITION_GROUP, V_MODEL_CHECKBOX, V_MODEL_DYNAMIC, V_MODEL_RADIO, V_MODEL_SELECT, V_MODEL_TEXT, V_ON_WITH_KEYS, V_ON_WITH_MODIFIERS, V_SHOW, compile, createDOMCompilerError, parse, parserOptions, transformStyle };
|
||||
4435
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
4435
node_modules/@vue/compiler-dom/dist/compiler-dom.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
1
node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
7
node_modules/@vue/compiler-dom/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/compiler-dom.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/compiler-dom.cjs.js')
|
||||
}
|
||||
77
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
77
node_modules/@vue/compiler-dom/package.json
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/compiler-dom@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/compiler-dom@3.0.2",
|
||||
"_id": "@vue/compiler-dom@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-HUDeBLzfmqu3n7aoAt1wovPCmSo=",
|
||||
"_location": "/@vue/compiler-dom",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/compiler-dom@3.0.2",
|
||||
"name": "@vue/compiler-dom",
|
||||
"escapedName": "@vue%2fcompiler-dom",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/compiler-sfc",
|
||||
"/@vue/compiler-ssr",
|
||||
"/vite",
|
||||
"/vue"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fcompiler-dom/-/compiler-dom-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerDOM",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/compiler-core": "3.0.2",
|
||||
"@vue/shared": "3.0.2"
|
||||
},
|
||||
"description": "@vue/compiler-dom",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-dom#readme",
|
||||
"jsdelivr": "dist/compiler-dom/global.js",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "dist/compiler-dom.esm-bundler.js",
|
||||
"name": "@vue/compiler-dom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/compiler-dom"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"types": "dist/compiler-dom.d.ts",
|
||||
"unpkg": "dist/compiler-dom/global.js",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
15
node_modules/@vue/compiler-sfc/README.md
generated
vendored
Normal file
15
node_modules/@vue/compiler-sfc/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# @vue/compiler-sfc
|
||||
|
||||
> Lower level utilities for compiling Vue single file components
|
||||
|
||||
This package contains lower level utilities that you can use if you are writing a plugin / transform for a bundler or module system that compiles Vue single file components into JavaScript. It is used in [vue-loader](https://github.com/vuejs/vue-loader).
|
||||
|
||||
The API surface is intentionally minimal - the goal is to reuse as much as possible while being as flexible as possible.
|
||||
|
||||
## Browser Build Usage
|
||||
|
||||
This package relies on `postcss`, `postcss-selector-parser` and `postcss-modules`
|
||||
|
||||
## API
|
||||
|
||||
TODO
|
||||
2036
node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
generated
vendored
Normal file
2036
node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
190
node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts
generated
vendored
Normal file
190
node_modules/@vue/compiler-sfc/dist/compiler-sfc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
import { BindingMetadata } from '@vue/compiler-core';
|
||||
import { CodegenResult } from '@vue/compiler-core';
|
||||
import { CompilerError } from '@vue/compiler-core';
|
||||
import { CompilerOptions } from '@vue/compiler-core';
|
||||
import { generateCodeFrame } from '@vue/compiler-core';
|
||||
import { LazyResult } from 'postcss';
|
||||
import { ParserOptions } from '@vue/compiler-core';
|
||||
import { ParserPlugin } from '@babel/parser';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
import { Result } from 'postcss';
|
||||
import { RootNode } from '@vue/compiler-core';
|
||||
import { SourceLocation } from '@vue/compiler-core';
|
||||
import { Statement } from '@babel/types';
|
||||
|
||||
declare interface AssetURLOptions {
|
||||
/**
|
||||
* If base is provided, instead of transforming relative asset urls into
|
||||
* imports, they will be directly rewritten to absolute urls.
|
||||
*/
|
||||
base?: string | null;
|
||||
/**
|
||||
* If true, also processes absolute urls.
|
||||
*/
|
||||
includeAbsolute?: boolean;
|
||||
tags?: AssetURLTagConfig;
|
||||
}
|
||||
|
||||
declare interface AssetURLTagConfig {
|
||||
[name: string]: string[];
|
||||
}
|
||||
export { BindingMetadata }
|
||||
export { CompilerError }
|
||||
export { CompilerOptions }
|
||||
|
||||
/**
|
||||
* Compile `<script setup>`
|
||||
* It requires the whole SFC descriptor because we need to handle and merge
|
||||
* normal `<script>` + `<script setup>` if both are present.
|
||||
*/
|
||||
export declare function compileScript(sfc: SFCDescriptor, options?: SFCScriptCompileOptions): SFCScriptBlock;
|
||||
|
||||
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
|
||||
|
||||
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
|
||||
|
||||
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
|
||||
export { generateCodeFrame }
|
||||
|
||||
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, compiler }?: SFCParseOptions): SFCParseResult;
|
||||
|
||||
declare type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
||||
|
||||
/**
|
||||
* Utility for rewriting `export default` in a script block into a variable
|
||||
* declaration so that we can inject things into it
|
||||
*/
|
||||
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
|
||||
|
||||
export declare interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
|
||||
isAsync?: boolean;
|
||||
modules?: boolean;
|
||||
modulesOptions?: {
|
||||
scopeBehaviour?: 'global' | 'local';
|
||||
globalModulePaths?: string[];
|
||||
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
||||
hashPrefix?: string;
|
||||
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
||||
};
|
||||
}
|
||||
|
||||
export declare interface SFCBlock {
|
||||
type: string;
|
||||
content: string;
|
||||
attrs: Record<string, string | true>;
|
||||
loc: SourceLocation;
|
||||
map?: RawSourceMap;
|
||||
lang?: string;
|
||||
src?: string;
|
||||
}
|
||||
|
||||
export declare interface SFCDescriptor {
|
||||
filename: string;
|
||||
source: string;
|
||||
template: SFCTemplateBlock | null;
|
||||
script: SFCScriptBlock | null;
|
||||
scriptSetup: SFCScriptBlock | null;
|
||||
styles: SFCStyleBlock[];
|
||||
customBlocks: SFCBlock[];
|
||||
}
|
||||
|
||||
export declare interface SFCParseOptions {
|
||||
filename?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
pad?: boolean | 'line' | 'space';
|
||||
compiler?: TemplateCompiler;
|
||||
}
|
||||
|
||||
declare interface SFCParseResult {
|
||||
descriptor: SFCDescriptor;
|
||||
errors: (CompilerError | SyntaxError)[];
|
||||
}
|
||||
|
||||
export declare interface SFCScriptBlock extends SFCBlock {
|
||||
type: 'script';
|
||||
setup?: string | boolean;
|
||||
bindings?: BindingMetadata;
|
||||
scriptAst?: Statement[];
|
||||
scriptSetupAst?: Statement[];
|
||||
}
|
||||
|
||||
export declare interface SFCScriptCompileOptions {
|
||||
/**
|
||||
* https://babeljs.io/docs/en/babel-parser#plugins
|
||||
*/
|
||||
babelParserPlugins?: ParserPlugin[];
|
||||
}
|
||||
|
||||
export declare interface SFCStyleBlock extends SFCBlock {
|
||||
type: 'style';
|
||||
scoped?: boolean;
|
||||
vars?: string;
|
||||
module?: string | boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCStyleCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
id: string;
|
||||
map?: RawSourceMap;
|
||||
scoped?: boolean;
|
||||
vars?: boolean;
|
||||
trim?: boolean;
|
||||
preprocessLang?: PreprocessLang;
|
||||
preprocessOptions?: any;
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
postcssOptions?: any;
|
||||
postcssPlugins?: any[];
|
||||
}
|
||||
|
||||
export declare interface SFCStyleCompileResults {
|
||||
code: string;
|
||||
map: RawSourceMap | undefined;
|
||||
rawResult: LazyResult | Result | undefined;
|
||||
errors: Error[];
|
||||
modules?: Record<string, string>;
|
||||
dependencies: Set<string>;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateBlock extends SFCBlock {
|
||||
type: 'template';
|
||||
functional?: boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateCompileOptions {
|
||||
source: string;
|
||||
filename: string;
|
||||
ssr?: boolean;
|
||||
inMap?: RawSourceMap;
|
||||
compiler?: TemplateCompiler;
|
||||
compilerOptions?: CompilerOptions;
|
||||
preprocessLang?: string;
|
||||
preprocessOptions?: any;
|
||||
/**
|
||||
* In some cases, compiler-sfc may not be inside the project root (e.g. when
|
||||
* linked or globally installed). In such cases a custom `require` can be
|
||||
* passed to correctly resolve the preprocessors.
|
||||
*/
|
||||
preprocessCustomRequire?: (id: string) => any;
|
||||
/**
|
||||
* Configure what tags/attributes to transform into asset url imports,
|
||||
* or disable the transform altogether with `false`.
|
||||
*/
|
||||
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
|
||||
}
|
||||
|
||||
export declare interface SFCTemplateCompileResults {
|
||||
code: string;
|
||||
source: string;
|
||||
tips: string[];
|
||||
errors: (string | CompilerError)[];
|
||||
map?: RawSourceMap;
|
||||
}
|
||||
|
||||
export declare interface TemplateCompiler {
|
||||
compile(template: string, options: CompilerOptions): CodegenResult;
|
||||
parse(template: string, options: ParserOptions): RootNode;
|
||||
}
|
||||
|
||||
export { }
|
||||
36612
node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js
generated
vendored
Normal file
36612
node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
36627
node_modules/@vue/compiler-sfc/dist/compiler-sfc.global.js
generated
vendored
Normal file
36627
node_modules/@vue/compiler-sfc/dist/compiler-sfc.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
node_modules/@vue/compiler-sfc/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
15
node_modules/@vue/compiler-sfc/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
166
node_modules/@vue/compiler-sfc/node_modules/lru-cache/README.md
generated
vendored
Normal file
166
node_modules/@vue/compiler-sfc/node_modules/lru-cache/README.md
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
# lru cache
|
||||
|
||||
A cache object that deletes the least-recently-used items.
|
||||
|
||||
[](https://travis-ci.org/isaacs/node-lru-cache) [](https://coveralls.io/github/isaacs/node-lru-cache)
|
||||
|
||||
## Installation:
|
||||
|
||||
```javascript
|
||||
npm install lru-cache --save
|
||||
```
|
||||
|
||||
## Usage:
|
||||
|
||||
```javascript
|
||||
var LRU = require("lru-cache")
|
||||
, options = { max: 500
|
||||
, length: function (n, key) { return n * 2 + key.length }
|
||||
, dispose: function (key, n) { n.close() }
|
||||
, maxAge: 1000 * 60 * 60 }
|
||||
, cache = new LRU(options)
|
||||
, otherCache = new LRU(50) // sets just the max size
|
||||
|
||||
cache.set("key", "value")
|
||||
cache.get("key") // "value"
|
||||
|
||||
// non-string keys ARE fully supported
|
||||
// but note that it must be THE SAME object, not
|
||||
// just a JSON-equivalent object.
|
||||
var someObject = { a: 1 }
|
||||
cache.set(someObject, 'a value')
|
||||
// Object keys are not toString()-ed
|
||||
cache.set('[object Object]', 'a different value')
|
||||
assert.equal(cache.get(someObject), 'a value')
|
||||
// A similar object with same keys/values won't work,
|
||||
// because it's a different object identity
|
||||
assert.equal(cache.get({ a: 1 }), undefined)
|
||||
|
||||
cache.reset() // empty the cache
|
||||
```
|
||||
|
||||
If you put more stuff in it, then items will fall out.
|
||||
|
||||
If you try to put an oversized thing in it, then it'll fall out right
|
||||
away.
|
||||
|
||||
## Options
|
||||
|
||||
* `max` The maximum size of the cache, checked by applying the length
|
||||
function to all values in the cache. Not setting this is kind of
|
||||
silly, since that's the whole purpose of this lib, but it defaults
|
||||
to `Infinity`. Setting it to a non-number or negative number will
|
||||
throw a `TypeError`. Setting it to 0 makes it be `Infinity`.
|
||||
* `maxAge` Maximum age in ms. Items are not pro-actively pruned out
|
||||
as they age, but if you try to get an item that is too old, it'll
|
||||
drop it and return undefined instead of giving it to you.
|
||||
Setting this to a negative value will make everything seem old!
|
||||
Setting it to a non-number will throw a `TypeError`.
|
||||
* `length` Function that is used to calculate the length of stored
|
||||
items. If you're storing strings or buffers, then you probably want
|
||||
to do something like `function(n, key){return n.length}`. The default is
|
||||
`function(){return 1}`, which is fine if you want to store `max`
|
||||
like-sized things. The item is passed as the first argument, and
|
||||
the key is passed as the second argumnet.
|
||||
* `dispose` Function that is called on items when they are dropped
|
||||
from the cache. This can be handy if you want to close file
|
||||
descriptors or do other cleanup tasks when items are no longer
|
||||
accessible. Called with `key, value`. It's called *before*
|
||||
actually removing the item from the internal cache, so if you want
|
||||
to immediately put it back in, you'll have to do that in a
|
||||
`nextTick` or `setTimeout` callback or it won't do anything.
|
||||
* `stale` By default, if you set a `maxAge`, it'll only actually pull
|
||||
stale items out of the cache when you `get(key)`. (That is, it's
|
||||
not pre-emptively doing a `setTimeout` or anything.) If you set
|
||||
`stale:true`, it'll return the stale value before deleting it. If
|
||||
you don't set this, then it'll return `undefined` when you try to
|
||||
get a stale entry, as if it had already been deleted.
|
||||
* `noDisposeOnSet` By default, if you set a `dispose()` method, then
|
||||
it'll be called whenever a `set()` operation overwrites an existing
|
||||
key. If you set this option, `dispose()` will only be called when a
|
||||
key falls out of the cache, not when it is overwritten.
|
||||
* `updateAgeOnGet` When using time-expiring entries with `maxAge`,
|
||||
setting this to `true` will make each item's effective time update
|
||||
to the current time whenever it is retrieved from cache, causing it
|
||||
to not expire. (It can still fall out of cache based on recency of
|
||||
use, of course.)
|
||||
|
||||
## API
|
||||
|
||||
* `set(key, value, maxAge)`
|
||||
* `get(key) => value`
|
||||
|
||||
Both of these will update the "recently used"-ness of the key.
|
||||
They do what you think. `maxAge` is optional and overrides the
|
||||
cache `maxAge` option if provided.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
The key and val can be any value.
|
||||
|
||||
* `peek(key)`
|
||||
|
||||
Returns the key value (or `undefined` if not found) without
|
||||
updating the "recently used"-ness of the key.
|
||||
|
||||
(If you find yourself using this a lot, you *might* be using the
|
||||
wrong sort of data structure, but there are some use cases where
|
||||
it's handy.)
|
||||
|
||||
* `del(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
* `reset()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
* `has(key)`
|
||||
|
||||
Check if a key is in the cache, without updating the recent-ness
|
||||
or deleting it for being stale.
|
||||
|
||||
* `forEach(function(value,key,cache), [thisp])`
|
||||
|
||||
Just like `Array.prototype.forEach`. Iterates over all the keys
|
||||
in the cache, in order of recent-ness. (Ie, more recently used
|
||||
items are iterated over first.)
|
||||
|
||||
* `rforEach(function(value,key,cache), [thisp])`
|
||||
|
||||
The same as `cache.forEach(...)` but items are iterated over in
|
||||
reverse order. (ie, less recently used items are iterated over
|
||||
first.)
|
||||
|
||||
* `keys()`
|
||||
|
||||
Return an array of the keys in the cache.
|
||||
|
||||
* `values()`
|
||||
|
||||
Return an array of the values in the cache.
|
||||
|
||||
* `length`
|
||||
|
||||
Return total length of objects in cache taking into account
|
||||
`length` options function.
|
||||
|
||||
* `itemCount`
|
||||
|
||||
Return total quantity of objects currently in cache. Note, that
|
||||
`stale` (see options) items are returned as part of this item
|
||||
count.
|
||||
|
||||
* `dump()`
|
||||
|
||||
Return an array of the cache entries ready for serialization and usage
|
||||
with 'destinationCache.load(arr)`.
|
||||
|
||||
* `load(cacheEntriesArray)`
|
||||
|
||||
Loads another cache entries array, obtained with `sourceCache.dump()`,
|
||||
into the cache. The destination cache is reset before loading new entries
|
||||
|
||||
* `prune()`
|
||||
|
||||
Manually iterates over the entire cache proactively pruning old entries
|
||||
334
node_modules/@vue/compiler-sfc/node_modules/lru-cache/index.js
generated
vendored
Normal file
334
node_modules/@vue/compiler-sfc/node_modules/lru-cache/index.js
generated
vendored
Normal file
@@ -0,0 +1,334 @@
|
||||
'use strict'
|
||||
|
||||
// A linked list to keep track of recently-used-ness
|
||||
const Yallist = require('yallist')
|
||||
|
||||
const MAX = Symbol('max')
|
||||
const LENGTH = Symbol('length')
|
||||
const LENGTH_CALCULATOR = Symbol('lengthCalculator')
|
||||
const ALLOW_STALE = Symbol('allowStale')
|
||||
const MAX_AGE = Symbol('maxAge')
|
||||
const DISPOSE = Symbol('dispose')
|
||||
const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
|
||||
const LRU_LIST = Symbol('lruList')
|
||||
const CACHE = Symbol('cache')
|
||||
const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
|
||||
|
||||
const naiveLength = () => 1
|
||||
|
||||
// lruList is a yallist where the head is the youngest
|
||||
// item, and the tail is the oldest. the list contains the Hit
|
||||
// objects as the entries.
|
||||
// Each Hit object has a reference to its Yallist.Node. This
|
||||
// never changes.
|
||||
//
|
||||
// cache is a Map (or PseudoMap) that matches the keys to
|
||||
// the Yallist.Node object.
|
||||
class LRUCache {
|
||||
constructor (options) {
|
||||
if (typeof options === 'number')
|
||||
options = { max: options }
|
||||
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
if (options.max && (typeof options.max !== 'number' || options.max < 0))
|
||||
throw new TypeError('max must be a non-negative number')
|
||||
// Kind of weird to have a default max of Infinity, but oh well.
|
||||
const max = this[MAX] = options.max || Infinity
|
||||
|
||||
const lc = options.length || naiveLength
|
||||
this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
|
||||
this[ALLOW_STALE] = options.stale || false
|
||||
if (options.maxAge && typeof options.maxAge !== 'number')
|
||||
throw new TypeError('maxAge must be a number')
|
||||
this[MAX_AGE] = options.maxAge || 0
|
||||
this[DISPOSE] = options.dispose
|
||||
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
|
||||
this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
|
||||
this.reset()
|
||||
}
|
||||
|
||||
// resize the cache when the max changes.
|
||||
set max (mL) {
|
||||
if (typeof mL !== 'number' || mL < 0)
|
||||
throw new TypeError('max must be a non-negative number')
|
||||
|
||||
this[MAX] = mL || Infinity
|
||||
trim(this)
|
||||
}
|
||||
get max () {
|
||||
return this[MAX]
|
||||
}
|
||||
|
||||
set allowStale (allowStale) {
|
||||
this[ALLOW_STALE] = !!allowStale
|
||||
}
|
||||
get allowStale () {
|
||||
return this[ALLOW_STALE]
|
||||
}
|
||||
|
||||
set maxAge (mA) {
|
||||
if (typeof mA !== 'number')
|
||||
throw new TypeError('maxAge must be a non-negative number')
|
||||
|
||||
this[MAX_AGE] = mA
|
||||
trim(this)
|
||||
}
|
||||
get maxAge () {
|
||||
return this[MAX_AGE]
|
||||
}
|
||||
|
||||
// resize the cache when the lengthCalculator changes.
|
||||
set lengthCalculator (lC) {
|
||||
if (typeof lC !== 'function')
|
||||
lC = naiveLength
|
||||
|
||||
if (lC !== this[LENGTH_CALCULATOR]) {
|
||||
this[LENGTH_CALCULATOR] = lC
|
||||
this[LENGTH] = 0
|
||||
this[LRU_LIST].forEach(hit => {
|
||||
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
|
||||
this[LENGTH] += hit.length
|
||||
})
|
||||
}
|
||||
trim(this)
|
||||
}
|
||||
get lengthCalculator () { return this[LENGTH_CALCULATOR] }
|
||||
|
||||
get length () { return this[LENGTH] }
|
||||
get itemCount () { return this[LRU_LIST].length }
|
||||
|
||||
rforEach (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (let walker = this[LRU_LIST].tail; walker !== null;) {
|
||||
const prev = walker.prev
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
|
||||
forEach (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (let walker = this[LRU_LIST].head; walker !== null;) {
|
||||
const next = walker.next
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = next
|
||||
}
|
||||
}
|
||||
|
||||
keys () {
|
||||
return this[LRU_LIST].toArray().map(k => k.key)
|
||||
}
|
||||
|
||||
values () {
|
||||
return this[LRU_LIST].toArray().map(k => k.value)
|
||||
}
|
||||
|
||||
reset () {
|
||||
if (this[DISPOSE] &&
|
||||
this[LRU_LIST] &&
|
||||
this[LRU_LIST].length) {
|
||||
this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
|
||||
}
|
||||
|
||||
this[CACHE] = new Map() // hash of items by key
|
||||
this[LRU_LIST] = new Yallist() // list of items in order of use recency
|
||||
this[LENGTH] = 0 // length of items in the list
|
||||
}
|
||||
|
||||
dump () {
|
||||
return this[LRU_LIST].map(hit =>
|
||||
isStale(this, hit) ? false : {
|
||||
k: hit.key,
|
||||
v: hit.value,
|
||||
e: hit.now + (hit.maxAge || 0)
|
||||
}).toArray().filter(h => h)
|
||||
}
|
||||
|
||||
dumpLru () {
|
||||
return this[LRU_LIST]
|
||||
}
|
||||
|
||||
set (key, value, maxAge) {
|
||||
maxAge = maxAge || this[MAX_AGE]
|
||||
|
||||
if (maxAge && typeof maxAge !== 'number')
|
||||
throw new TypeError('maxAge must be a number')
|
||||
|
||||
const now = maxAge ? Date.now() : 0
|
||||
const len = this[LENGTH_CALCULATOR](value, key)
|
||||
|
||||
if (this[CACHE].has(key)) {
|
||||
if (len > this[MAX]) {
|
||||
del(this, this[CACHE].get(key))
|
||||
return false
|
||||
}
|
||||
|
||||
const node = this[CACHE].get(key)
|
||||
const item = node.value
|
||||
|
||||
// dispose of the old one before overwriting
|
||||
// split out into 2 ifs for better coverage tracking
|
||||
if (this[DISPOSE]) {
|
||||
if (!this[NO_DISPOSE_ON_SET])
|
||||
this[DISPOSE](key, item.value)
|
||||
}
|
||||
|
||||
item.now = now
|
||||
item.maxAge = maxAge
|
||||
item.value = value
|
||||
this[LENGTH] += len - item.length
|
||||
item.length = len
|
||||
this.get(key)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
const hit = new Entry(key, value, len, now, maxAge)
|
||||
|
||||
// oversized objects fall out of cache automatically.
|
||||
if (hit.length > this[MAX]) {
|
||||
if (this[DISPOSE])
|
||||
this[DISPOSE](key, value)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this[LENGTH] += hit.length
|
||||
this[LRU_LIST].unshift(hit)
|
||||
this[CACHE].set(key, this[LRU_LIST].head)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
has (key) {
|
||||
if (!this[CACHE].has(key)) return false
|
||||
const hit = this[CACHE].get(key).value
|
||||
return !isStale(this, hit)
|
||||
}
|
||||
|
||||
get (key) {
|
||||
return get(this, key, true)
|
||||
}
|
||||
|
||||
peek (key) {
|
||||
return get(this, key, false)
|
||||
}
|
||||
|
||||
pop () {
|
||||
const node = this[LRU_LIST].tail
|
||||
if (!node)
|
||||
return null
|
||||
|
||||
del(this, node)
|
||||
return node.value
|
||||
}
|
||||
|
||||
del (key) {
|
||||
del(this, this[CACHE].get(key))
|
||||
}
|
||||
|
||||
load (arr) {
|
||||
// reset the cache
|
||||
this.reset()
|
||||
|
||||
const now = Date.now()
|
||||
// A previous serialized cache has the most recent items first
|
||||
for (let l = arr.length - 1; l >= 0; l--) {
|
||||
const hit = arr[l]
|
||||
const expiresAt = hit.e || 0
|
||||
if (expiresAt === 0)
|
||||
// the item was created without expiration in a non aged cache
|
||||
this.set(hit.k, hit.v)
|
||||
else {
|
||||
const maxAge = expiresAt - now
|
||||
// dont add already expired items
|
||||
if (maxAge > 0) {
|
||||
this.set(hit.k, hit.v, maxAge)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prune () {
|
||||
this[CACHE].forEach((value, key) => get(this, key, false))
|
||||
}
|
||||
}
|
||||
|
||||
const get = (self, key, doUse) => {
|
||||
const node = self[CACHE].get(key)
|
||||
if (node) {
|
||||
const hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE])
|
||||
return undefined
|
||||
} else {
|
||||
if (doUse) {
|
||||
if (self[UPDATE_AGE_ON_GET])
|
||||
node.value.now = Date.now()
|
||||
self[LRU_LIST].unshiftNode(node)
|
||||
}
|
||||
}
|
||||
return hit.value
|
||||
}
|
||||
}
|
||||
|
||||
const isStale = (self, hit) => {
|
||||
if (!hit || (!hit.maxAge && !self[MAX_AGE]))
|
||||
return false
|
||||
|
||||
const diff = Date.now() - hit.now
|
||||
return hit.maxAge ? diff > hit.maxAge
|
||||
: self[MAX_AGE] && (diff > self[MAX_AGE])
|
||||
}
|
||||
|
||||
const trim = self => {
|
||||
if (self[LENGTH] > self[MAX]) {
|
||||
for (let walker = self[LRU_LIST].tail;
|
||||
self[LENGTH] > self[MAX] && walker !== null;) {
|
||||
// We know that we're about to delete this one, and also
|
||||
// what the next least recently used key will be, so just
|
||||
// go ahead and set it now.
|
||||
const prev = walker.prev
|
||||
del(self, walker)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const del = (self, node) => {
|
||||
if (node) {
|
||||
const hit = node.value
|
||||
if (self[DISPOSE])
|
||||
self[DISPOSE](hit.key, hit.value)
|
||||
|
||||
self[LENGTH] -= hit.length
|
||||
self[CACHE].delete(hit.key)
|
||||
self[LRU_LIST].removeNode(node)
|
||||
}
|
||||
}
|
||||
|
||||
class Entry {
|
||||
constructor (key, value, length, now, maxAge) {
|
||||
this.key = key
|
||||
this.value = value
|
||||
this.length = length
|
||||
this.now = now
|
||||
this.maxAge = maxAge || 0
|
||||
}
|
||||
}
|
||||
|
||||
const forEachStep = (self, fn, node, thisp) => {
|
||||
let hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE])
|
||||
hit = undefined
|
||||
}
|
||||
if (hit)
|
||||
fn.call(thisp, hit.value, hit.key, self)
|
||||
}
|
||||
|
||||
module.exports = LRUCache
|
||||
71
node_modules/@vue/compiler-sfc/node_modules/lru-cache/package.json
generated
vendored
Normal file
71
node_modules/@vue/compiler-sfc/node_modules/lru-cache/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"lru-cache@5.1.1",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "lru-cache@5.1.1",
|
||||
"_id": "lru-cache@5.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-HaJ+ZxAnGUdpXa9oSOhH8B2EuSA=",
|
||||
"_location": "/@vue/compiler-sfc/lru-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "lru-cache@5.1.1",
|
||||
"name": "lru-cache",
|
||||
"escapedName": "lru-cache",
|
||||
"rawSpec": "5.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "5.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/compiler-sfc"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/lru-cache/-/lru-cache-5.1.1.tgz",
|
||||
"_spec": "5.1.1",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/node-lru-cache/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"yallist": "^3.0.2"
|
||||
},
|
||||
"description": "A cache object that deletes the least-recently-used items.",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"tap": "^12.1.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/node-lru-cache#readme",
|
||||
"keywords": [
|
||||
"mru",
|
||||
"lru",
|
||||
"cache"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "lru-cache",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-lru-cache.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coveragerport": "tap --coverage-report=html",
|
||||
"postpublish": "git push origin --all; git push origin --tags",
|
||||
"postversion": "npm publish",
|
||||
"preversion": "npm test",
|
||||
"snap": "TAP_SNAPSHOT=1 tap test/*.js -J",
|
||||
"test": "tap test/*.js --100 -J"
|
||||
},
|
||||
"version": "5.1.1"
|
||||
}
|
||||
96
node_modules/@vue/compiler-sfc/package.json
generated
vendored
Normal file
96
node_modules/@vue/compiler-sfc/package.json
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/compiler-sfc@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/compiler-sfc@3.0.2",
|
||||
"_id": "@vue/compiler-sfc@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-IscP7XLDR6TV+i2y6AWUsxk9zlc=",
|
||||
"_location": "/@vue/compiler-sfc",
|
||||
"_phantomChildren": {
|
||||
"yallist": "3.1.1"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/compiler-sfc@3.0.2",
|
||||
"name": "@vue/compiler-sfc",
|
||||
"escapedName": "@vue%2fcompiler-sfc",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/vite",
|
||||
"/vitepress"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fcompiler-sfc/-/compiler-sfc-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueCompilerSFC",
|
||||
"formats": [
|
||||
"cjs",
|
||||
"global",
|
||||
"esm-browser"
|
||||
],
|
||||
"prod": false,
|
||||
"enableNonBrowserBranches": true
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.12.0",
|
||||
"@babel/types": "^7.12.0",
|
||||
"@vue/compiler-core": "3.0.2",
|
||||
"@vue/compiler-dom": "3.0.2",
|
||||
"@vue/compiler-ssr": "3.0.2",
|
||||
"@vue/shared": "3.0.2",
|
||||
"consolidate": "^0.16.0",
|
||||
"estree-walker": "^2.0.1",
|
||||
"hash-sum": "^2.0.0",
|
||||
"lru-cache": "^5.1.1",
|
||||
"magic-string": "^0.25.7",
|
||||
"merge-source-map": "^1.1.0",
|
||||
"postcss": "^7.0.32",
|
||||
"postcss-modules": "^3.2.2",
|
||||
"postcss-selector-parser": "^6.0.4",
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"description": "@vue/compiler-sfc",
|
||||
"devDependencies": {
|
||||
"@types/consolidate": "^0.14.0",
|
||||
"@types/lru-cache": "^5.1.0",
|
||||
"pug": "^2.0.4",
|
||||
"sass": "^1.26.9"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/compiler-sfc.cjs.js",
|
||||
"name": "@vue/compiler-sfc",
|
||||
"peerDependencies": {
|
||||
"vue": "3.0.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/compiler-sfc"
|
||||
},
|
||||
"types": "dist/compiler-sfc.d.ts",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
1
node_modules/@vue/compiler-ssr/README.md
generated
vendored
Normal file
1
node_modules/@vue/compiler-ssr/README.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# @vue/compiler-ssr
|
||||
1022
node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
1022
node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts
generated
vendored
Normal file
6
node_modules/@vue/compiler-ssr/dist/compiler-ssr.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { CodegenResult } from '@vue/compiler-dom';
|
||||
import { CompilerOptions } from '@vue/compiler-dom';
|
||||
|
||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||
|
||||
export { }
|
||||
67
node_modules/@vue/compiler-ssr/package.json
generated
vendored
Normal file
67
node_modules/@vue/compiler-ssr/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/compiler-ssr@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/compiler-ssr@3.0.2",
|
||||
"_id": "@vue/compiler-ssr@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-c69NJ0p5v8xyqZaptF8QcufeqiY=",
|
||||
"_location": "/@vue/compiler-ssr",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/compiler-ssr@3.0.2",
|
||||
"name": "@vue/compiler-ssr",
|
||||
"escapedName": "@vue%2fcompiler-ssr",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/compiler-sfc",
|
||||
"/@vue/server-renderer"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fcompiler-ssr/-/compiler-ssr-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"prod": false,
|
||||
"formats": [
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.0.2",
|
||||
"@vue/shared": "3.0.2"
|
||||
},
|
||||
"description": "@vue/compiler-ssr",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-ssr#readme",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/compiler-ssr.cjs.js",
|
||||
"name": "@vue/compiler-ssr",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/compiler-ssr"
|
||||
},
|
||||
"types": "dist/compiler-ssr.d.ts",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
21
node_modules/@vue/reactivity/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/reactivity/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
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.
|
||||
19
node_modules/@vue/reactivity/README.md
generated
vendored
Normal file
19
node_modules/@vue/reactivity/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @vue/reactivity
|
||||
|
||||
## Usage Note
|
||||
|
||||
This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. `@vue/runtime-dom`), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.
|
||||
|
||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build reactivity --types` from repo root, which will generate an API report at `temp/reactivity.api.md`.
|
||||
|
||||
## Credits
|
||||
|
||||
The implementation of this module is inspired by the following prior art in the JavaScript ecosystem:
|
||||
|
||||
- [Meteor Tracker](https://docs.meteor.com/api/tracker.html)
|
||||
- [nx-js/observer-util](https://github.com/nx-js/observer-util)
|
||||
- [salesforce/observable-membrane](https://github.com/salesforce/observable-membrane)
|
||||
|
||||
## Caveats
|
||||
|
||||
- Built-in objects are not observed except for `Array`, `Map`, `WeakMap`, `Set` and `WeakSet`.
|
||||
875
node_modules/@vue/reactivity/dist/reactivity.cjs.js
generated
vendored
Normal file
875
node_modules/@vue/reactivity/dist/reactivity.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,875 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
const targetMap = new WeakMap();
|
||||
const effectStack = [];
|
||||
let activeEffect;
|
||||
const ITERATE_KEY = Symbol( 'iterate' );
|
||||
const MAP_KEY_ITERATE_KEY = Symbol( 'Map key iterate' );
|
||||
function isEffect(fn) {
|
||||
return fn && fn._isEffect === true;
|
||||
}
|
||||
function effect(fn, options = shared.EMPTY_OBJ) {
|
||||
if (isEffect(fn)) {
|
||||
fn = fn.raw;
|
||||
}
|
||||
const effect = createReactiveEffect(fn, options);
|
||||
if (!options.lazy) {
|
||||
effect();
|
||||
}
|
||||
return effect;
|
||||
}
|
||||
function stop(effect) {
|
||||
if (effect.active) {
|
||||
cleanup(effect);
|
||||
if (effect.options.onStop) {
|
||||
effect.options.onStop();
|
||||
}
|
||||
effect.active = false;
|
||||
}
|
||||
}
|
||||
let uid = 0;
|
||||
function createReactiveEffect(fn, options) {
|
||||
const effect = function reactiveEffect() {
|
||||
if (!effect.active) {
|
||||
return options.scheduler ? undefined : fn();
|
||||
}
|
||||
if (!effectStack.includes(effect)) {
|
||||
cleanup(effect);
|
||||
try {
|
||||
enableTracking();
|
||||
effectStack.push(effect);
|
||||
activeEffect = effect;
|
||||
return fn();
|
||||
}
|
||||
finally {
|
||||
effectStack.pop();
|
||||
resetTracking();
|
||||
activeEffect = effectStack[effectStack.length - 1];
|
||||
}
|
||||
}
|
||||
};
|
||||
effect.id = uid++;
|
||||
effect.allowRecurse = !!options.allowRecurse;
|
||||
effect._isEffect = true;
|
||||
effect.active = true;
|
||||
effect.raw = fn;
|
||||
effect.deps = [];
|
||||
effect.options = options;
|
||||
return effect;
|
||||
}
|
||||
function cleanup(effect) {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].delete(effect);
|
||||
}
|
||||
deps.length = 0;
|
||||
}
|
||||
}
|
||||
let shouldTrack = true;
|
||||
const trackStack = [];
|
||||
function pauseTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = false;
|
||||
}
|
||||
function enableTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = true;
|
||||
}
|
||||
function resetTracking() {
|
||||
const last = trackStack.pop();
|
||||
shouldTrack = last === undefined ? true : last;
|
||||
}
|
||||
function track(target, type, key) {
|
||||
if (!shouldTrack || activeEffect === undefined) {
|
||||
return;
|
||||
}
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, (depsMap = new Map()));
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, (dep = new Set()));
|
||||
}
|
||||
if (!dep.has(activeEffect)) {
|
||||
dep.add(activeEffect);
|
||||
activeEffect.deps.push(dep);
|
||||
if ( activeEffect.options.onTrack) {
|
||||
activeEffect.options.onTrack({
|
||||
effect: activeEffect,
|
||||
target,
|
||||
type,
|
||||
key
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
||||
const depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
// never been tracked
|
||||
return;
|
||||
}
|
||||
const effects = new Set();
|
||||
const add = (effectsToAdd) => {
|
||||
if (effectsToAdd) {
|
||||
effectsToAdd.forEach(effect => {
|
||||
if (effect !== activeEffect || effect.allowRecurse) {
|
||||
effects.add(effect);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
if (type === "clear" /* CLEAR */) {
|
||||
// collection being cleared
|
||||
// trigger all effects for target
|
||||
depsMap.forEach(add);
|
||||
}
|
||||
else if (key === 'length' && shared.isArray(target)) {
|
||||
depsMap.forEach((dep, key) => {
|
||||
if (key === 'length' || key >= newValue) {
|
||||
add(dep);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// schedule runs for SET | ADD | DELETE
|
||||
if (key !== void 0) {
|
||||
add(depsMap.get(key));
|
||||
}
|
||||
// also run for iteration key on ADD | DELETE | Map.SET
|
||||
switch (type) {
|
||||
case "add" /* ADD */:
|
||||
if (!shared.isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (shared.isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
else if (shared.isIntegerKey(key)) {
|
||||
// new index added to array -> length changes
|
||||
add(depsMap.get('length'));
|
||||
}
|
||||
break;
|
||||
case "delete" /* DELETE */:
|
||||
if (!shared.isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (shared.isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "set" /* SET */:
|
||||
if (shared.isMap(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const run = (effect) => {
|
||||
if ( effect.options.onTrigger) {
|
||||
effect.options.onTrigger({
|
||||
effect,
|
||||
target,
|
||||
key,
|
||||
type,
|
||||
newValue,
|
||||
oldValue,
|
||||
oldTarget
|
||||
});
|
||||
}
|
||||
if (effect.options.scheduler) {
|
||||
effect.options.scheduler(effect);
|
||||
}
|
||||
else {
|
||||
effect();
|
||||
}
|
||||
};
|
||||
effects.forEach(run);
|
||||
}
|
||||
|
||||
const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
|
||||
.map(key => Symbol[key])
|
||||
.filter(shared.isSymbol));
|
||||
const get = /*#__PURE__*/ createGetter();
|
||||
const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
||||
const readonlyGet = /*#__PURE__*/ createGetter(true);
|
||||
const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
||||
const arrayInstrumentations = {};
|
||||
['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
const arr = toRaw(this);
|
||||
for (let i = 0, l = this.length; i < l; i++) {
|
||||
track(arr, "get" /* GET */, i + '');
|
||||
}
|
||||
// we run the method using the original args first (which may be reactive)
|
||||
const res = method.apply(arr, args);
|
||||
if (res === -1 || res === false) {
|
||||
// if that didn't work, run it again using raw values.
|
||||
return method.apply(arr, args.map(toRaw));
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
});
|
||||
['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
pauseTracking();
|
||||
const res = method.apply(this, args);
|
||||
resetTracking();
|
||||
return res;
|
||||
};
|
||||
});
|
||||
function createGetter(isReadonly = false, shallow = false) {
|
||||
return function get(target, key, receiver) {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */ &&
|
||||
receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {
|
||||
return target;
|
||||
}
|
||||
const targetIsArray = shared.isArray(target);
|
||||
if (targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
|
||||
return Reflect.get(arrayInstrumentations, key, receiver);
|
||||
}
|
||||
const res = Reflect.get(target, key, receiver);
|
||||
if (shared.isSymbol(key)
|
||||
? builtInSymbols.has(key)
|
||||
: key === `__proto__` || key === `__v_isRef`) {
|
||||
return res;
|
||||
}
|
||||
if (!isReadonly) {
|
||||
track(target, "get" /* GET */, key);
|
||||
}
|
||||
if (shallow) {
|
||||
return res;
|
||||
}
|
||||
if (isRef(res)) {
|
||||
// ref unwrapping - does not apply for Array + integer key.
|
||||
const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key);
|
||||
return shouldUnwrap ? res.value : res;
|
||||
}
|
||||
if (shared.isObject(res)) {
|
||||
// Convert returned value into a proxy as well. we do the isObject check
|
||||
// here to avoid invalid value warning. Also need to lazy access readonly
|
||||
// and reactive here to avoid circular dependency.
|
||||
return isReadonly ? readonly(res) : reactive(res);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
}
|
||||
const set = /*#__PURE__*/ createSetter();
|
||||
const shallowSet = /*#__PURE__*/ createSetter(true);
|
||||
function createSetter(shallow = false) {
|
||||
return function set(target, key, value, receiver) {
|
||||
const oldValue = target[key];
|
||||
if (!shallow) {
|
||||
value = toRaw(value);
|
||||
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const hadKey = shared.isArray(target) && shared.isIntegerKey(key)
|
||||
? Number(key) < target.length
|
||||
: shared.hasOwn(target, key);
|
||||
const result = Reflect.set(target, key, value, receiver);
|
||||
// don't trigger if target is something up in the prototype chain of original
|
||||
if (target === toRaw(receiver)) {
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (shared.hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
function deleteProperty(target, key) {
|
||||
const hadKey = shared.hasOwn(target, key);
|
||||
const oldValue = target[key];
|
||||
const result = Reflect.deleteProperty(target, key);
|
||||
if (result && hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function has(target, key) {
|
||||
const result = Reflect.has(target, key);
|
||||
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
|
||||
track(target, "has" /* HAS */, key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function ownKeys(target) {
|
||||
track(target, "iterate" /* ITERATE */, shared.isArray(target) ? 'length' : ITERATE_KEY);
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
const mutableHandlers = {
|
||||
get,
|
||||
set,
|
||||
deleteProperty,
|
||||
has,
|
||||
ownKeys
|
||||
};
|
||||
const readonlyHandlers = {
|
||||
get: readonlyGet,
|
||||
set(target, key) {
|
||||
{
|
||||
console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, key) {
|
||||
{
|
||||
console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const shallowReactiveHandlers = shared.extend({}, mutableHandlers, {
|
||||
get: shallowGet,
|
||||
set: shallowSet
|
||||
});
|
||||
// Props handlers are special in the sense that it should not unwrap top-level
|
||||
// refs (in order to allow refs to be explicitly passed down), but should
|
||||
// retain the reactivity of the normal readonly object.
|
||||
const shallowReadonlyHandlers = shared.extend({}, readonlyHandlers, {
|
||||
get: shallowReadonlyGet
|
||||
});
|
||||
|
||||
const toReactive = (value) => shared.isObject(value) ? reactive(value) : value;
|
||||
const toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
|
||||
const toShallow = (value) => value;
|
||||
const getProto = (v) => Reflect.getPrototypeOf(v);
|
||||
function get$1(target, key, isReadonly = false, isShallow = false) {
|
||||
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
||||
// of the value
|
||||
target = target["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
||||
const { has } = getProto(rawTarget);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
if (has.call(rawTarget, key)) {
|
||||
return wrap(target.get(key));
|
||||
}
|
||||
else if (has.call(rawTarget, rawKey)) {
|
||||
return wrap(target.get(rawKey));
|
||||
}
|
||||
}
|
||||
function has$1(key, isReadonly = false) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
||||
return key === rawKey
|
||||
? target.has(key)
|
||||
: target.has(key) || target.has(rawKey);
|
||||
}
|
||||
function size(target, isReadonly = false) {
|
||||
target = target["__v_raw" /* RAW */];
|
||||
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return Reflect.get(target, 'size', target);
|
||||
}
|
||||
function add(value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const proto = getProto(target);
|
||||
const hadKey = proto.has.call(target, value);
|
||||
const result = target.add(value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, value, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function set$1(key, value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get.call(target, key);
|
||||
const result = target.set(key, value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (shared.hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function deleteEntry(key) {
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get ? get.call(target, key) : undefined;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.delete(key);
|
||||
if (hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function clear() {
|
||||
const target = toRaw(this);
|
||||
const hadItems = target.size !== 0;
|
||||
const oldTarget = shared.isMap(target)
|
||||
? new Map(target)
|
||||
: new Set(target)
|
||||
;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.clear();
|
||||
if (hadItems) {
|
||||
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function createForEach(isReadonly, isShallow) {
|
||||
return function forEach(callback, thisArg) {
|
||||
const observed = this;
|
||||
const target = observed["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return target.forEach((value, key) => {
|
||||
// important: make sure the callback is
|
||||
// 1. invoked with the reactive map as `this` and 3rd arg
|
||||
// 2. the value received should be a corresponding reactive/readonly.
|
||||
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
||||
});
|
||||
};
|
||||
}
|
||||
function createIterableMethod(method, isReadonly, isShallow) {
|
||||
return function (...args) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const targetIsMap = shared.isMap(rawTarget);
|
||||
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
||||
const isKeyOnly = method === 'keys' && targetIsMap;
|
||||
const innerIterator = target[method](...args);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly &&
|
||||
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
||||
// return a wrapped iterator which returns observed versions of the
|
||||
// values emitted from the real iterator
|
||||
return {
|
||||
// iterator protocol
|
||||
next() {
|
||||
const { value, done } = innerIterator.next();
|
||||
return done
|
||||
? { value, done }
|
||||
: {
|
||||
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
||||
done
|
||||
};
|
||||
},
|
||||
// iterable protocol
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function createReadonlyMethod(type) {
|
||||
return function (...args) {
|
||||
{
|
||||
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
||||
console.warn(`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
||||
}
|
||||
return type === "delete" /* DELETE */ ? false : this;
|
||||
};
|
||||
}
|
||||
const mutableInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, false)
|
||||
};
|
||||
const shallowInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, false, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, true)
|
||||
};
|
||||
const readonlyInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this, true);
|
||||
},
|
||||
has(key) {
|
||||
return has$1.call(this, key, true);
|
||||
},
|
||||
add: createReadonlyMethod("add" /* ADD */),
|
||||
set: createReadonlyMethod("set" /* SET */),
|
||||
delete: createReadonlyMethod("delete" /* DELETE */),
|
||||
clear: createReadonlyMethod("clear" /* CLEAR */),
|
||||
forEach: createForEach(true, false)
|
||||
};
|
||||
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
||||
iteratorMethods.forEach(method => {
|
||||
mutableInstrumentations[method] = createIterableMethod(method, false, false);
|
||||
readonlyInstrumentations[method] = createIterableMethod(method, true, false);
|
||||
shallowInstrumentations[method] = createIterableMethod(method, false, true);
|
||||
});
|
||||
function createInstrumentationGetter(isReadonly, shallow) {
|
||||
const instrumentations = shallow
|
||||
? shallowInstrumentations
|
||||
: isReadonly
|
||||
? readonlyInstrumentations
|
||||
: mutableInstrumentations;
|
||||
return (target, key, receiver) => {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */) {
|
||||
return target;
|
||||
}
|
||||
return Reflect.get(shared.hasOwn(instrumentations, key) && key in target
|
||||
? instrumentations
|
||||
: target, key, receiver);
|
||||
};
|
||||
}
|
||||
const mutableCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, false)
|
||||
};
|
||||
const shallowCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, true)
|
||||
};
|
||||
const readonlyCollectionHandlers = {
|
||||
get: createInstrumentationGetter(true, false)
|
||||
};
|
||||
function checkIdentityKeys(target, has, key) {
|
||||
const rawKey = toRaw(key);
|
||||
if (rawKey !== key && has.call(target, rawKey)) {
|
||||
const type = shared.toRawType(target);
|
||||
console.warn(`Reactive ${type} contains both the raw and reactive ` +
|
||||
`versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
|
||||
`which can lead to inconsistencies. ` +
|
||||
`Avoid differentiating between the raw and reactive versions ` +
|
||||
`of an object and only use the reactive version if possible.`);
|
||||
}
|
||||
}
|
||||
|
||||
const reactiveMap = new WeakMap();
|
||||
const readonlyMap = new WeakMap();
|
||||
function targetTypeMap(rawType) {
|
||||
switch (rawType) {
|
||||
case 'Object':
|
||||
case 'Array':
|
||||
return 1 /* COMMON */;
|
||||
case 'Map':
|
||||
case 'Set':
|
||||
case 'WeakMap':
|
||||
case 'WeakSet':
|
||||
return 2 /* COLLECTION */;
|
||||
default:
|
||||
return 0 /* INVALID */;
|
||||
}
|
||||
}
|
||||
function getTargetType(value) {
|
||||
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
||||
? 0 /* INVALID */
|
||||
: targetTypeMap(shared.toRawType(value));
|
||||
}
|
||||
function reactive(target) {
|
||||
// if trying to observe a readonly proxy, return the readonly version.
|
||||
if (target && target["__v_isReadonly" /* IS_READONLY */]) {
|
||||
return target;
|
||||
}
|
||||
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are reactive, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
function shallowReactive(target) {
|
||||
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
|
||||
}
|
||||
function readonly(target) {
|
||||
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are readonly, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
// This is used for creating the props proxy object for stateful components.
|
||||
function shallowReadonly(target) {
|
||||
return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
|
||||
if (!shared.isObject(target)) {
|
||||
{
|
||||
console.warn(`value cannot be made reactive: ${String(target)}`);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
// target is already a Proxy, return it.
|
||||
// exception: calling readonly() on a reactive object
|
||||
if (target["__v_raw" /* RAW */] &&
|
||||
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
||||
return target;
|
||||
}
|
||||
// target already has corresponding Proxy
|
||||
const proxyMap = isReadonly ? readonlyMap : reactiveMap;
|
||||
const existingProxy = proxyMap.get(target);
|
||||
if (existingProxy) {
|
||||
return existingProxy;
|
||||
}
|
||||
// only a whitelist of value types can be observed.
|
||||
const targetType = getTargetType(target);
|
||||
if (targetType === 0 /* INVALID */) {
|
||||
return target;
|
||||
}
|
||||
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
||||
proxyMap.set(target, proxy);
|
||||
return proxy;
|
||||
}
|
||||
function isReactive(value) {
|
||||
if (isReadonly(value)) {
|
||||
return isReactive(value["__v_raw" /* RAW */]);
|
||||
}
|
||||
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
||||
}
|
||||
function isReadonly(value) {
|
||||
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
||||
}
|
||||
function isProxy(value) {
|
||||
return isReactive(value) || isReadonly(value);
|
||||
}
|
||||
function toRaw(observed) {
|
||||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
|
||||
}
|
||||
function markRaw(value) {
|
||||
shared.def(value, "__v_skip" /* SKIP */, true);
|
||||
return value;
|
||||
}
|
||||
|
||||
const convert = (val) => shared.isObject(val) ? reactive(val) : val;
|
||||
function isRef(r) {
|
||||
return Boolean(r && r.__v_isRef === true);
|
||||
}
|
||||
function ref(value) {
|
||||
return createRef(value);
|
||||
}
|
||||
function shallowRef(value) {
|
||||
return createRef(value, true);
|
||||
}
|
||||
class RefImpl {
|
||||
constructor(_rawValue, _shallow = false) {
|
||||
this._rawValue = _rawValue;
|
||||
this._shallow = _shallow;
|
||||
this.__v_isRef = true;
|
||||
this._value = _shallow ? _rawValue : convert(_rawValue);
|
||||
}
|
||||
get value() {
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newVal) {
|
||||
if (shared.hasChanged(toRaw(newVal), this._rawValue)) {
|
||||
this._rawValue = newVal;
|
||||
this._value = this._shallow ? newVal : convert(newVal);
|
||||
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef(rawValue, shallow = false) {
|
||||
if (isRef(rawValue)) {
|
||||
return rawValue;
|
||||
}
|
||||
return new RefImpl(rawValue, shallow);
|
||||
}
|
||||
function triggerRef(ref) {
|
||||
trigger(toRaw(ref), "set" /* SET */, 'value', ref.value );
|
||||
}
|
||||
function unref(ref) {
|
||||
return isRef(ref) ? ref.value : ref;
|
||||
}
|
||||
const shallowUnwrapHandlers = {
|
||||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
||||
set: (target, key, value, receiver) => {
|
||||
const oldValue = target[key];
|
||||
if (isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return Reflect.set(target, key, value, receiver);
|
||||
}
|
||||
}
|
||||
};
|
||||
function proxyRefs(objectWithRefs) {
|
||||
return isReactive(objectWithRefs)
|
||||
? objectWithRefs
|
||||
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
||||
}
|
||||
class CustomRefImpl {
|
||||
constructor(factory) {
|
||||
this.__v_isRef = true;
|
||||
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
||||
this._get = get;
|
||||
this._set = set;
|
||||
}
|
||||
get value() {
|
||||
return this._get();
|
||||
}
|
||||
set value(newVal) {
|
||||
this._set(newVal);
|
||||
}
|
||||
}
|
||||
function customRef(factory) {
|
||||
return new CustomRefImpl(factory);
|
||||
}
|
||||
function toRefs(object) {
|
||||
if ( !isProxy(object)) {
|
||||
console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
||||
}
|
||||
const ret = shared.isArray(object) ? new Array(object.length) : {};
|
||||
for (const key in object) {
|
||||
ret[key] = toRef(object, key);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
class ObjectRefImpl {
|
||||
constructor(_object, _key) {
|
||||
this._object = _object;
|
||||
this._key = _key;
|
||||
this.__v_isRef = true;
|
||||
}
|
||||
get value() {
|
||||
return this._object[this._key];
|
||||
}
|
||||
set value(newVal) {
|
||||
this._object[this._key] = newVal;
|
||||
}
|
||||
}
|
||||
function toRef(object, key) {
|
||||
return isRef(object[key])
|
||||
? object[key]
|
||||
: new ObjectRefImpl(object, key);
|
||||
}
|
||||
|
||||
class ComputedRefImpl {
|
||||
constructor(getter, _setter, isReadonly) {
|
||||
this._setter = _setter;
|
||||
this._dirty = true;
|
||||
this.__v_isRef = true;
|
||||
this.effect = effect(getter, {
|
||||
lazy: true,
|
||||
scheduler: () => {
|
||||
if (!this._dirty) {
|
||||
this._dirty = true;
|
||||
trigger(toRaw(this), "set" /* SET */, 'value');
|
||||
}
|
||||
}
|
||||
});
|
||||
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
||||
}
|
||||
get value() {
|
||||
if (this._dirty) {
|
||||
this._value = this.effect();
|
||||
this._dirty = false;
|
||||
}
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newValue) {
|
||||
this._setter(newValue);
|
||||
}
|
||||
}
|
||||
function computed(getterOrOptions) {
|
||||
let getter;
|
||||
let setter;
|
||||
if (shared.isFunction(getterOrOptions)) {
|
||||
getter = getterOrOptions;
|
||||
setter = () => {
|
||||
console.warn('Write operation failed: computed value is readonly');
|
||||
}
|
||||
;
|
||||
}
|
||||
else {
|
||||
getter = getterOrOptions.get;
|
||||
setter = getterOrOptions.set;
|
||||
}
|
||||
return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
|
||||
}
|
||||
|
||||
exports.ITERATE_KEY = ITERATE_KEY;
|
||||
exports.computed = computed;
|
||||
exports.customRef = customRef;
|
||||
exports.effect = effect;
|
||||
exports.enableTracking = enableTracking;
|
||||
exports.isProxy = isProxy;
|
||||
exports.isReactive = isReactive;
|
||||
exports.isReadonly = isReadonly;
|
||||
exports.isRef = isRef;
|
||||
exports.markRaw = markRaw;
|
||||
exports.pauseTracking = pauseTracking;
|
||||
exports.proxyRefs = proxyRefs;
|
||||
exports.reactive = reactive;
|
||||
exports.readonly = readonly;
|
||||
exports.ref = ref;
|
||||
exports.resetTracking = resetTracking;
|
||||
exports.shallowReactive = shallowReactive;
|
||||
exports.shallowReadonly = shallowReadonly;
|
||||
exports.shallowRef = shallowRef;
|
||||
exports.stop = stop;
|
||||
exports.toRaw = toRaw;
|
||||
exports.toRef = toRef;
|
||||
exports.toRefs = toRefs;
|
||||
exports.track = track;
|
||||
exports.trigger = trigger;
|
||||
exports.triggerRef = triggerRef;
|
||||
exports.unref = unref;
|
||||
816
node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js
generated
vendored
Normal file
816
node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js
generated
vendored
Normal file
@@ -0,0 +1,816 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var shared = require('@vue/shared');
|
||||
|
||||
const targetMap = new WeakMap();
|
||||
const effectStack = [];
|
||||
let activeEffect;
|
||||
const ITERATE_KEY = Symbol( '');
|
||||
const MAP_KEY_ITERATE_KEY = Symbol( '');
|
||||
function isEffect(fn) {
|
||||
return fn && fn._isEffect === true;
|
||||
}
|
||||
function effect(fn, options = shared.EMPTY_OBJ) {
|
||||
if (isEffect(fn)) {
|
||||
fn = fn.raw;
|
||||
}
|
||||
const effect = createReactiveEffect(fn, options);
|
||||
if (!options.lazy) {
|
||||
effect();
|
||||
}
|
||||
return effect;
|
||||
}
|
||||
function stop(effect) {
|
||||
if (effect.active) {
|
||||
cleanup(effect);
|
||||
if (effect.options.onStop) {
|
||||
effect.options.onStop();
|
||||
}
|
||||
effect.active = false;
|
||||
}
|
||||
}
|
||||
let uid = 0;
|
||||
function createReactiveEffect(fn, options) {
|
||||
const effect = function reactiveEffect() {
|
||||
if (!effect.active) {
|
||||
return options.scheduler ? undefined : fn();
|
||||
}
|
||||
if (!effectStack.includes(effect)) {
|
||||
cleanup(effect);
|
||||
try {
|
||||
enableTracking();
|
||||
effectStack.push(effect);
|
||||
activeEffect = effect;
|
||||
return fn();
|
||||
}
|
||||
finally {
|
||||
effectStack.pop();
|
||||
resetTracking();
|
||||
activeEffect = effectStack[effectStack.length - 1];
|
||||
}
|
||||
}
|
||||
};
|
||||
effect.id = uid++;
|
||||
effect.allowRecurse = !!options.allowRecurse;
|
||||
effect._isEffect = true;
|
||||
effect.active = true;
|
||||
effect.raw = fn;
|
||||
effect.deps = [];
|
||||
effect.options = options;
|
||||
return effect;
|
||||
}
|
||||
function cleanup(effect) {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].delete(effect);
|
||||
}
|
||||
deps.length = 0;
|
||||
}
|
||||
}
|
||||
let shouldTrack = true;
|
||||
const trackStack = [];
|
||||
function pauseTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = false;
|
||||
}
|
||||
function enableTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = true;
|
||||
}
|
||||
function resetTracking() {
|
||||
const last = trackStack.pop();
|
||||
shouldTrack = last === undefined ? true : last;
|
||||
}
|
||||
function track(target, type, key) {
|
||||
if (!shouldTrack || activeEffect === undefined) {
|
||||
return;
|
||||
}
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, (depsMap = new Map()));
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, (dep = new Set()));
|
||||
}
|
||||
if (!dep.has(activeEffect)) {
|
||||
dep.add(activeEffect);
|
||||
activeEffect.deps.push(dep);
|
||||
}
|
||||
}
|
||||
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
||||
const depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
// never been tracked
|
||||
return;
|
||||
}
|
||||
const effects = new Set();
|
||||
const add = (effectsToAdd) => {
|
||||
if (effectsToAdd) {
|
||||
effectsToAdd.forEach(effect => {
|
||||
if (effect !== activeEffect || effect.allowRecurse) {
|
||||
effects.add(effect);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
if (type === "clear" /* CLEAR */) {
|
||||
// collection being cleared
|
||||
// trigger all effects for target
|
||||
depsMap.forEach(add);
|
||||
}
|
||||
else if (key === 'length' && shared.isArray(target)) {
|
||||
depsMap.forEach((dep, key) => {
|
||||
if (key === 'length' || key >= newValue) {
|
||||
add(dep);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// schedule runs for SET | ADD | DELETE
|
||||
if (key !== void 0) {
|
||||
add(depsMap.get(key));
|
||||
}
|
||||
// also run for iteration key on ADD | DELETE | Map.SET
|
||||
switch (type) {
|
||||
case "add" /* ADD */:
|
||||
if (!shared.isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (shared.isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
else if (shared.isIntegerKey(key)) {
|
||||
// new index added to array -> length changes
|
||||
add(depsMap.get('length'));
|
||||
}
|
||||
break;
|
||||
case "delete" /* DELETE */:
|
||||
if (!shared.isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (shared.isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "set" /* SET */:
|
||||
if (shared.isMap(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const run = (effect) => {
|
||||
if (effect.options.scheduler) {
|
||||
effect.options.scheduler(effect);
|
||||
}
|
||||
else {
|
||||
effect();
|
||||
}
|
||||
};
|
||||
effects.forEach(run);
|
||||
}
|
||||
|
||||
const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
|
||||
.map(key => Symbol[key])
|
||||
.filter(shared.isSymbol));
|
||||
const get = /*#__PURE__*/ createGetter();
|
||||
const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
||||
const readonlyGet = /*#__PURE__*/ createGetter(true);
|
||||
const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
||||
const arrayInstrumentations = {};
|
||||
['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
const arr = toRaw(this);
|
||||
for (let i = 0, l = this.length; i < l; i++) {
|
||||
track(arr, "get" /* GET */, i + '');
|
||||
}
|
||||
// we run the method using the original args first (which may be reactive)
|
||||
const res = method.apply(arr, args);
|
||||
if (res === -1 || res === false) {
|
||||
// if that didn't work, run it again using raw values.
|
||||
return method.apply(arr, args.map(toRaw));
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
});
|
||||
['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
pauseTracking();
|
||||
const res = method.apply(this, args);
|
||||
resetTracking();
|
||||
return res;
|
||||
};
|
||||
});
|
||||
function createGetter(isReadonly = false, shallow = false) {
|
||||
return function get(target, key, receiver) {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */ &&
|
||||
receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {
|
||||
return target;
|
||||
}
|
||||
const targetIsArray = shared.isArray(target);
|
||||
if (targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
|
||||
return Reflect.get(arrayInstrumentations, key, receiver);
|
||||
}
|
||||
const res = Reflect.get(target, key, receiver);
|
||||
if (shared.isSymbol(key)
|
||||
? builtInSymbols.has(key)
|
||||
: key === `__proto__` || key === `__v_isRef`) {
|
||||
return res;
|
||||
}
|
||||
if (!isReadonly) {
|
||||
track(target, "get" /* GET */, key);
|
||||
}
|
||||
if (shallow) {
|
||||
return res;
|
||||
}
|
||||
if (isRef(res)) {
|
||||
// ref unwrapping - does not apply for Array + integer key.
|
||||
const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key);
|
||||
return shouldUnwrap ? res.value : res;
|
||||
}
|
||||
if (shared.isObject(res)) {
|
||||
// Convert returned value into a proxy as well. we do the isObject check
|
||||
// here to avoid invalid value warning. Also need to lazy access readonly
|
||||
// and reactive here to avoid circular dependency.
|
||||
return isReadonly ? readonly(res) : reactive(res);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
}
|
||||
const set = /*#__PURE__*/ createSetter();
|
||||
const shallowSet = /*#__PURE__*/ createSetter(true);
|
||||
function createSetter(shallow = false) {
|
||||
return function set(target, key, value, receiver) {
|
||||
const oldValue = target[key];
|
||||
if (!shallow) {
|
||||
value = toRaw(value);
|
||||
if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const hadKey = shared.isArray(target) && shared.isIntegerKey(key)
|
||||
? Number(key) < target.length
|
||||
: shared.hasOwn(target, key);
|
||||
const result = Reflect.set(target, key, value, receiver);
|
||||
// don't trigger if target is something up in the prototype chain of original
|
||||
if (target === toRaw(receiver)) {
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (shared.hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
function deleteProperty(target, key) {
|
||||
const hadKey = shared.hasOwn(target, key);
|
||||
const oldValue = target[key];
|
||||
const result = Reflect.deleteProperty(target, key);
|
||||
if (result && hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function has(target, key) {
|
||||
const result = Reflect.has(target, key);
|
||||
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
|
||||
track(target, "has" /* HAS */, key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function ownKeys(target) {
|
||||
track(target, "iterate" /* ITERATE */, shared.isArray(target) ? 'length' : ITERATE_KEY);
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
const mutableHandlers = {
|
||||
get,
|
||||
set,
|
||||
deleteProperty,
|
||||
has,
|
||||
ownKeys
|
||||
};
|
||||
const readonlyHandlers = {
|
||||
get: readonlyGet,
|
||||
set(target, key) {
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, key) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const shallowReactiveHandlers = shared.extend({}, mutableHandlers, {
|
||||
get: shallowGet,
|
||||
set: shallowSet
|
||||
});
|
||||
// Props handlers are special in the sense that it should not unwrap top-level
|
||||
// refs (in order to allow refs to be explicitly passed down), but should
|
||||
// retain the reactivity of the normal readonly object.
|
||||
const shallowReadonlyHandlers = shared.extend({}, readonlyHandlers, {
|
||||
get: shallowReadonlyGet
|
||||
});
|
||||
|
||||
const toReactive = (value) => shared.isObject(value) ? reactive(value) : value;
|
||||
const toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
|
||||
const toShallow = (value) => value;
|
||||
const getProto = (v) => Reflect.getPrototypeOf(v);
|
||||
function get$1(target, key, isReadonly = false, isShallow = false) {
|
||||
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
||||
// of the value
|
||||
target = target["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
||||
const { has } = getProto(rawTarget);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
if (has.call(rawTarget, key)) {
|
||||
return wrap(target.get(key));
|
||||
}
|
||||
else if (has.call(rawTarget, rawKey)) {
|
||||
return wrap(target.get(rawKey));
|
||||
}
|
||||
}
|
||||
function has$1(key, isReadonly = false) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
||||
return key === rawKey
|
||||
? target.has(key)
|
||||
: target.has(key) || target.has(rawKey);
|
||||
}
|
||||
function size(target, isReadonly = false) {
|
||||
target = target["__v_raw" /* RAW */];
|
||||
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return Reflect.get(target, 'size', target);
|
||||
}
|
||||
function add(value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const proto = getProto(target);
|
||||
const hadKey = proto.has.call(target, value);
|
||||
const result = target.add(value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, value, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function set$1(key, value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
const oldValue = get.call(target, key);
|
||||
const result = target.set(key, value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (shared.hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function deleteEntry(key) {
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
const oldValue = get ? get.call(target, key) : undefined;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.delete(key);
|
||||
if (hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function clear() {
|
||||
const target = toRaw(this);
|
||||
const hadItems = target.size !== 0;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.clear();
|
||||
if (hadItems) {
|
||||
trigger(target, "clear" /* CLEAR */, undefined, undefined);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function createForEach(isReadonly, isShallow) {
|
||||
return function forEach(callback, thisArg) {
|
||||
const observed = this;
|
||||
const target = observed["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return target.forEach((value, key) => {
|
||||
// important: make sure the callback is
|
||||
// 1. invoked with the reactive map as `this` and 3rd arg
|
||||
// 2. the value received should be a corresponding reactive/readonly.
|
||||
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
||||
});
|
||||
};
|
||||
}
|
||||
function createIterableMethod(method, isReadonly, isShallow) {
|
||||
return function (...args) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const targetIsMap = shared.isMap(rawTarget);
|
||||
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
||||
const isKeyOnly = method === 'keys' && targetIsMap;
|
||||
const innerIterator = target[method](...args);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly &&
|
||||
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
||||
// return a wrapped iterator which returns observed versions of the
|
||||
// values emitted from the real iterator
|
||||
return {
|
||||
// iterator protocol
|
||||
next() {
|
||||
const { value, done } = innerIterator.next();
|
||||
return done
|
||||
? { value, done }
|
||||
: {
|
||||
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
||||
done
|
||||
};
|
||||
},
|
||||
// iterable protocol
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function createReadonlyMethod(type) {
|
||||
return function (...args) {
|
||||
return type === "delete" /* DELETE */ ? false : this;
|
||||
};
|
||||
}
|
||||
const mutableInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, false)
|
||||
};
|
||||
const shallowInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, false, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, true)
|
||||
};
|
||||
const readonlyInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this, true);
|
||||
},
|
||||
has(key) {
|
||||
return has$1.call(this, key, true);
|
||||
},
|
||||
add: createReadonlyMethod("add" /* ADD */),
|
||||
set: createReadonlyMethod("set" /* SET */),
|
||||
delete: createReadonlyMethod("delete" /* DELETE */),
|
||||
clear: createReadonlyMethod("clear" /* CLEAR */),
|
||||
forEach: createForEach(true, false)
|
||||
};
|
||||
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
||||
iteratorMethods.forEach(method => {
|
||||
mutableInstrumentations[method] = createIterableMethod(method, false, false);
|
||||
readonlyInstrumentations[method] = createIterableMethod(method, true, false);
|
||||
shallowInstrumentations[method] = createIterableMethod(method, false, true);
|
||||
});
|
||||
function createInstrumentationGetter(isReadonly, shallow) {
|
||||
const instrumentations = shallow
|
||||
? shallowInstrumentations
|
||||
: isReadonly
|
||||
? readonlyInstrumentations
|
||||
: mutableInstrumentations;
|
||||
return (target, key, receiver) => {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */) {
|
||||
return target;
|
||||
}
|
||||
return Reflect.get(shared.hasOwn(instrumentations, key) && key in target
|
||||
? instrumentations
|
||||
: target, key, receiver);
|
||||
};
|
||||
}
|
||||
const mutableCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, false)
|
||||
};
|
||||
const shallowCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, true)
|
||||
};
|
||||
const readonlyCollectionHandlers = {
|
||||
get: createInstrumentationGetter(true, false)
|
||||
};
|
||||
|
||||
const reactiveMap = new WeakMap();
|
||||
const readonlyMap = new WeakMap();
|
||||
function targetTypeMap(rawType) {
|
||||
switch (rawType) {
|
||||
case 'Object':
|
||||
case 'Array':
|
||||
return 1 /* COMMON */;
|
||||
case 'Map':
|
||||
case 'Set':
|
||||
case 'WeakMap':
|
||||
case 'WeakSet':
|
||||
return 2 /* COLLECTION */;
|
||||
default:
|
||||
return 0 /* INVALID */;
|
||||
}
|
||||
}
|
||||
function getTargetType(value) {
|
||||
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
||||
? 0 /* INVALID */
|
||||
: targetTypeMap(shared.toRawType(value));
|
||||
}
|
||||
function reactive(target) {
|
||||
// if trying to observe a readonly proxy, return the readonly version.
|
||||
if (target && target["__v_isReadonly" /* IS_READONLY */]) {
|
||||
return target;
|
||||
}
|
||||
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are reactive, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
function shallowReactive(target) {
|
||||
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
|
||||
}
|
||||
function readonly(target) {
|
||||
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are readonly, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
// This is used for creating the props proxy object for stateful components.
|
||||
function shallowReadonly(target) {
|
||||
return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
|
||||
if (!shared.isObject(target)) {
|
||||
return target;
|
||||
}
|
||||
// target is already a Proxy, return it.
|
||||
// exception: calling readonly() on a reactive object
|
||||
if (target["__v_raw" /* RAW */] &&
|
||||
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
||||
return target;
|
||||
}
|
||||
// target already has corresponding Proxy
|
||||
const proxyMap = isReadonly ? readonlyMap : reactiveMap;
|
||||
const existingProxy = proxyMap.get(target);
|
||||
if (existingProxy) {
|
||||
return existingProxy;
|
||||
}
|
||||
// only a whitelist of value types can be observed.
|
||||
const targetType = getTargetType(target);
|
||||
if (targetType === 0 /* INVALID */) {
|
||||
return target;
|
||||
}
|
||||
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
||||
proxyMap.set(target, proxy);
|
||||
return proxy;
|
||||
}
|
||||
function isReactive(value) {
|
||||
if (isReadonly(value)) {
|
||||
return isReactive(value["__v_raw" /* RAW */]);
|
||||
}
|
||||
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
||||
}
|
||||
function isReadonly(value) {
|
||||
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
||||
}
|
||||
function isProxy(value) {
|
||||
return isReactive(value) || isReadonly(value);
|
||||
}
|
||||
function toRaw(observed) {
|
||||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
|
||||
}
|
||||
function markRaw(value) {
|
||||
shared.def(value, "__v_skip" /* SKIP */, true);
|
||||
return value;
|
||||
}
|
||||
|
||||
const convert = (val) => shared.isObject(val) ? reactive(val) : val;
|
||||
function isRef(r) {
|
||||
return Boolean(r && r.__v_isRef === true);
|
||||
}
|
||||
function ref(value) {
|
||||
return createRef(value);
|
||||
}
|
||||
function shallowRef(value) {
|
||||
return createRef(value, true);
|
||||
}
|
||||
class RefImpl {
|
||||
constructor(_rawValue, _shallow = false) {
|
||||
this._rawValue = _rawValue;
|
||||
this._shallow = _shallow;
|
||||
this.__v_isRef = true;
|
||||
this._value = _shallow ? _rawValue : convert(_rawValue);
|
||||
}
|
||||
get value() {
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newVal) {
|
||||
if (shared.hasChanged(toRaw(newVal), this._rawValue)) {
|
||||
this._rawValue = newVal;
|
||||
this._value = this._shallow ? newVal : convert(newVal);
|
||||
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef(rawValue, shallow = false) {
|
||||
if (isRef(rawValue)) {
|
||||
return rawValue;
|
||||
}
|
||||
return new RefImpl(rawValue, shallow);
|
||||
}
|
||||
function triggerRef(ref) {
|
||||
trigger(toRaw(ref), "set" /* SET */, 'value', void 0);
|
||||
}
|
||||
function unref(ref) {
|
||||
return isRef(ref) ? ref.value : ref;
|
||||
}
|
||||
const shallowUnwrapHandlers = {
|
||||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
||||
set: (target, key, value, receiver) => {
|
||||
const oldValue = target[key];
|
||||
if (isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return Reflect.set(target, key, value, receiver);
|
||||
}
|
||||
}
|
||||
};
|
||||
function proxyRefs(objectWithRefs) {
|
||||
return isReactive(objectWithRefs)
|
||||
? objectWithRefs
|
||||
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
||||
}
|
||||
class CustomRefImpl {
|
||||
constructor(factory) {
|
||||
this.__v_isRef = true;
|
||||
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
||||
this._get = get;
|
||||
this._set = set;
|
||||
}
|
||||
get value() {
|
||||
return this._get();
|
||||
}
|
||||
set value(newVal) {
|
||||
this._set(newVal);
|
||||
}
|
||||
}
|
||||
function customRef(factory) {
|
||||
return new CustomRefImpl(factory);
|
||||
}
|
||||
function toRefs(object) {
|
||||
const ret = shared.isArray(object) ? new Array(object.length) : {};
|
||||
for (const key in object) {
|
||||
ret[key] = toRef(object, key);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
class ObjectRefImpl {
|
||||
constructor(_object, _key) {
|
||||
this._object = _object;
|
||||
this._key = _key;
|
||||
this.__v_isRef = true;
|
||||
}
|
||||
get value() {
|
||||
return this._object[this._key];
|
||||
}
|
||||
set value(newVal) {
|
||||
this._object[this._key] = newVal;
|
||||
}
|
||||
}
|
||||
function toRef(object, key) {
|
||||
return isRef(object[key])
|
||||
? object[key]
|
||||
: new ObjectRefImpl(object, key);
|
||||
}
|
||||
|
||||
class ComputedRefImpl {
|
||||
constructor(getter, _setter, isReadonly) {
|
||||
this._setter = _setter;
|
||||
this._dirty = true;
|
||||
this.__v_isRef = true;
|
||||
this.effect = effect(getter, {
|
||||
lazy: true,
|
||||
scheduler: () => {
|
||||
if (!this._dirty) {
|
||||
this._dirty = true;
|
||||
trigger(toRaw(this), "set" /* SET */, 'value');
|
||||
}
|
||||
}
|
||||
});
|
||||
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
||||
}
|
||||
get value() {
|
||||
if (this._dirty) {
|
||||
this._value = this.effect();
|
||||
this._dirty = false;
|
||||
}
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newValue) {
|
||||
this._setter(newValue);
|
||||
}
|
||||
}
|
||||
function computed(getterOrOptions) {
|
||||
let getter;
|
||||
let setter;
|
||||
if (shared.isFunction(getterOrOptions)) {
|
||||
getter = getterOrOptions;
|
||||
setter = shared.NOOP;
|
||||
}
|
||||
else {
|
||||
getter = getterOrOptions.get;
|
||||
setter = getterOrOptions.set;
|
||||
}
|
||||
return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
|
||||
}
|
||||
|
||||
exports.ITERATE_KEY = ITERATE_KEY;
|
||||
exports.computed = computed;
|
||||
exports.customRef = customRef;
|
||||
exports.effect = effect;
|
||||
exports.enableTracking = enableTracking;
|
||||
exports.isProxy = isProxy;
|
||||
exports.isReactive = isReactive;
|
||||
exports.isReadonly = isReadonly;
|
||||
exports.isRef = isRef;
|
||||
exports.markRaw = markRaw;
|
||||
exports.pauseTracking = pauseTracking;
|
||||
exports.proxyRefs = proxyRefs;
|
||||
exports.reactive = reactive;
|
||||
exports.readonly = readonly;
|
||||
exports.ref = ref;
|
||||
exports.resetTracking = resetTracking;
|
||||
exports.shallowReactive = shallowReactive;
|
||||
exports.shallowReadonly = shallowReadonly;
|
||||
exports.shallowRef = shallowRef;
|
||||
exports.stop = stop;
|
||||
exports.toRaw = toRaw;
|
||||
exports.toRef = toRef;
|
||||
exports.toRefs = toRefs;
|
||||
exports.track = track;
|
||||
exports.trigger = trigger;
|
||||
exports.triggerRef = triggerRef;
|
||||
exports.unref = unref;
|
||||
269
node_modules/@vue/reactivity/dist/reactivity.d.ts
generated
vendored
Normal file
269
node_modules/@vue/reactivity/dist/reactivity.d.ts
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
|
||||
declare type BaseTypes = string | number | boolean;
|
||||
|
||||
declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
||||
|
||||
declare type CollectionTypes = IterableCollections | WeakCollections;
|
||||
|
||||
export declare function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>;
|
||||
|
||||
export declare function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>;
|
||||
|
||||
export declare type ComputedGetter<T> = (ctx?: any) => T;
|
||||
|
||||
export declare interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
||||
readonly value: T;
|
||||
}
|
||||
|
||||
export declare type ComputedSetter<T> = (v: T) => void;
|
||||
|
||||
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
||||
|
||||
declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
||||
get: () => T;
|
||||
set: (value: T) => void;
|
||||
};
|
||||
|
||||
export declare type DebuggerEvent = {
|
||||
effect: ReactiveEffect;
|
||||
target: object;
|
||||
type: TrackOpTypes | TriggerOpTypes;
|
||||
key: any;
|
||||
} & DebuggerEventExtraInfo;
|
||||
|
||||
declare interface DebuggerEventExtraInfo {
|
||||
newValue?: any;
|
||||
oldValue?: any;
|
||||
oldTarget?: Map<any, any> | Set<any>;
|
||||
}
|
||||
|
||||
export declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends {} ? {
|
||||
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
||||
} : Readonly<T>;
|
||||
|
||||
declare type Dep = Set<ReactiveEffect>;
|
||||
|
||||
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffect<T>;
|
||||
|
||||
export declare function enableTracking(): void;
|
||||
|
||||
export declare function isProxy(value: unknown): boolean;
|
||||
|
||||
export declare function isReactive(value: unknown): boolean;
|
||||
|
||||
export declare function isReadonly(value: unknown): boolean;
|
||||
|
||||
export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
||||
|
||||
declare type IterableCollections = Map<any, any> | Set<any>;
|
||||
|
||||
export declare const ITERATE_KEY: unique symbol;
|
||||
|
||||
export declare function markRaw<T extends object>(value: T): T;
|
||||
|
||||
export declare function pauseTracking(): void;
|
||||
|
||||
declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
||||
|
||||
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
|
||||
|
||||
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
|
||||
|
||||
export declare interface ReactiveEffect<T = any> {
|
||||
(): T;
|
||||
_isEffect: true;
|
||||
id: number;
|
||||
active: boolean;
|
||||
raw: () => T;
|
||||
deps: Array<Dep>;
|
||||
options: ReactiveEffectOptions;
|
||||
allowRecurse: boolean;
|
||||
}
|
||||
|
||||
export declare interface ReactiveEffectOptions {
|
||||
lazy?: boolean;
|
||||
scheduler?: (job: ReactiveEffect) => void;
|
||||
onTrack?: (event: DebuggerEvent) => void;
|
||||
onTrigger?: (event: DebuggerEvent) => void;
|
||||
onStop?: () => void;
|
||||
allowRecurse?: boolean;
|
||||
}
|
||||
|
||||
export declare const enum ReactiveFlags {
|
||||
SKIP = "__v_skip",
|
||||
IS_REACTIVE = "__v_isReactive",
|
||||
IS_READONLY = "__v_isReadonly",
|
||||
RAW = "__v_raw"
|
||||
}
|
||||
|
||||
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
|
||||
|
||||
export declare interface Ref<T = any> {
|
||||
value: T;
|
||||
/**
|
||||
* Type differentiator only.
|
||||
* We need this to be in public d.ts but don't want it to show up in IDE
|
||||
* autocomplete, so we use a private Symbol instead.
|
||||
*/
|
||||
[RefSymbol]: true;
|
||||
/* Excluded from this release type: _shallow */
|
||||
}
|
||||
|
||||
export declare function ref<T extends object>(value: T): T extends Ref ? T : Ref<UnwrapRef<T>>;
|
||||
|
||||
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
|
||||
|
||||
export declare function ref<T = any>(): Ref<T | undefined>;
|
||||
|
||||
declare const RefSymbol: unique symbol;
|
||||
|
||||
/**
|
||||
* This is a special exported interface for other packages to declare
|
||||
* additional types that should bail out for ref unwrapping. For example
|
||||
* \@vue/runtime-dom can declare it like so in its d.ts:
|
||||
*
|
||||
* ``` ts
|
||||
* declare module '@vue/reactivity' {
|
||||
* export interface RefUnwrapBailTypes {
|
||||
* runtimeDOMBailTypes: Node | Window
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Note that api-extractor somehow refuses to include `declare module`
|
||||
* augmentations in its generated d.ts, so we have to manually append them
|
||||
* to the final generated d.ts in our build process.
|
||||
*/
|
||||
export declare interface RefUnwrapBailTypes {
|
||||
}
|
||||
|
||||
export declare function resetTracking(): void;
|
||||
|
||||
export declare function shallowReactive<T extends object>(target: T): T;
|
||||
|
||||
export declare function shallowReadonly<T extends object>(target: T): Readonly<{
|
||||
[K in keyof T]: UnwrapNestedRefs<T[K]>;
|
||||
}>;
|
||||
|
||||
export declare function shallowRef<T extends object>(value: T): T extends Ref ? T : Ref<T>;
|
||||
|
||||
export declare function shallowRef<T>(value: T): Ref<T>;
|
||||
|
||||
export declare function shallowRef<T = any>(): Ref<T | undefined>;
|
||||
|
||||
export declare type ShallowUnwrapRef<T> = {
|
||||
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K];
|
||||
};
|
||||
|
||||
declare function stop_2(effect: ReactiveEffect): void;
|
||||
export { stop_2 as stop }
|
||||
|
||||
declare type SymbolExtract<T> = (T extends {
|
||||
[Symbol.asyncIterator]: infer V;
|
||||
} ? {
|
||||
[Symbol.asyncIterator]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.hasInstance]: infer V;
|
||||
} ? {
|
||||
[Symbol.hasInstance]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.isConcatSpreadable]: infer V;
|
||||
} ? {
|
||||
[Symbol.isConcatSpreadable]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.iterator]: infer V;
|
||||
} ? {
|
||||
[Symbol.iterator]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.match]: infer V;
|
||||
} ? {
|
||||
[Symbol.match]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.matchAll]: infer V;
|
||||
} ? {
|
||||
[Symbol.matchAll]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.replace]: infer V;
|
||||
} ? {
|
||||
[Symbol.replace]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.search]: infer V;
|
||||
} ? {
|
||||
[Symbol.search]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.species]: infer V;
|
||||
} ? {
|
||||
[Symbol.species]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.split]: infer V;
|
||||
} ? {
|
||||
[Symbol.split]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.toPrimitive]: infer V;
|
||||
} ? {
|
||||
[Symbol.toPrimitive]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.toStringTag]: infer V;
|
||||
} ? {
|
||||
[Symbol.toStringTag]: V;
|
||||
} : {}) & (T extends {
|
||||
[Symbol.unscopables]: infer V;
|
||||
} ? {
|
||||
[Symbol.unscopables]: V;
|
||||
} : {});
|
||||
|
||||
export declare function toRaw<T>(observed: T): T;
|
||||
|
||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): Ref<T[K]>;
|
||||
|
||||
export declare type ToRefs<T = any> = {
|
||||
[K in keyof T]: Ref<T[K]>;
|
||||
};
|
||||
|
||||
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
||||
|
||||
export declare function track(target: object, type: TrackOpTypes, key: unknown): void;
|
||||
|
||||
export declare const enum TrackOpTypes {
|
||||
GET = "get",
|
||||
HAS = "has",
|
||||
ITERATE = "iterate"
|
||||
}
|
||||
|
||||
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void;
|
||||
|
||||
export declare const enum TriggerOpTypes {
|
||||
SET = "set",
|
||||
ADD = "add",
|
||||
DELETE = "delete",
|
||||
CLEAR = "clear"
|
||||
}
|
||||
|
||||
export declare function triggerRef(ref: Ref): void;
|
||||
|
||||
export declare function unref<T>(ref: T): T extends Ref<infer V> ? V : T;
|
||||
|
||||
declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRef<T>;
|
||||
|
||||
declare type UnwrappedObject<T> = {
|
||||
[P in keyof T]: UnwrapRef<T[P]>;
|
||||
} & SymbolExtract<T>;
|
||||
|
||||
export declare type UnwrapRef<T> = T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
||||
|
||||
declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] ? T : T extends Array<any> ? {
|
||||
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
||||
} : T extends object ? UnwrappedObject<T> : T;
|
||||
|
||||
declare type WeakCollections = WeakMap<any, any> | WeakSet<any>;
|
||||
|
||||
export declare interface WritableComputedOptions<T> {
|
||||
get: ComputedGetter<T>;
|
||||
set: ComputedSetter<T>;
|
||||
}
|
||||
|
||||
export declare interface WritableComputedRef<T> extends Ref<T> {
|
||||
readonly effect: ReactiveEffect<T>;
|
||||
}
|
||||
|
||||
export { }
|
||||
886
node_modules/@vue/reactivity/dist/reactivity.esm-browser.js
generated
vendored
Normal file
886
node_modules/@vue/reactivity/dist/reactivity.esm-browser.js
generated
vendored
Normal file
@@ -0,0 +1,886 @@
|
||||
const EMPTY_OBJ = Object.freeze({})
|
||||
;
|
||||
const EMPTY_ARR = Object.freeze([]) ;
|
||||
const extend = Object.assign;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
|
||||
const targetMap = new WeakMap();
|
||||
const effectStack = [];
|
||||
let activeEffect;
|
||||
const ITERATE_KEY = Symbol( 'iterate' );
|
||||
const MAP_KEY_ITERATE_KEY = Symbol( 'Map key iterate' );
|
||||
function isEffect(fn) {
|
||||
return fn && fn._isEffect === true;
|
||||
}
|
||||
function effect(fn, options = EMPTY_OBJ) {
|
||||
if (isEffect(fn)) {
|
||||
fn = fn.raw;
|
||||
}
|
||||
const effect = createReactiveEffect(fn, options);
|
||||
if (!options.lazy) {
|
||||
effect();
|
||||
}
|
||||
return effect;
|
||||
}
|
||||
function stop(effect) {
|
||||
if (effect.active) {
|
||||
cleanup(effect);
|
||||
if (effect.options.onStop) {
|
||||
effect.options.onStop();
|
||||
}
|
||||
effect.active = false;
|
||||
}
|
||||
}
|
||||
let uid = 0;
|
||||
function createReactiveEffect(fn, options) {
|
||||
const effect = function reactiveEffect() {
|
||||
if (!effect.active) {
|
||||
return options.scheduler ? undefined : fn();
|
||||
}
|
||||
if (!effectStack.includes(effect)) {
|
||||
cleanup(effect);
|
||||
try {
|
||||
enableTracking();
|
||||
effectStack.push(effect);
|
||||
activeEffect = effect;
|
||||
return fn();
|
||||
}
|
||||
finally {
|
||||
effectStack.pop();
|
||||
resetTracking();
|
||||
activeEffect = effectStack[effectStack.length - 1];
|
||||
}
|
||||
}
|
||||
};
|
||||
effect.id = uid++;
|
||||
effect.allowRecurse = !!options.allowRecurse;
|
||||
effect._isEffect = true;
|
||||
effect.active = true;
|
||||
effect.raw = fn;
|
||||
effect.deps = [];
|
||||
effect.options = options;
|
||||
return effect;
|
||||
}
|
||||
function cleanup(effect) {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].delete(effect);
|
||||
}
|
||||
deps.length = 0;
|
||||
}
|
||||
}
|
||||
let shouldTrack = true;
|
||||
const trackStack = [];
|
||||
function pauseTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = false;
|
||||
}
|
||||
function enableTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = true;
|
||||
}
|
||||
function resetTracking() {
|
||||
const last = trackStack.pop();
|
||||
shouldTrack = last === undefined ? true : last;
|
||||
}
|
||||
function track(target, type, key) {
|
||||
if (!shouldTrack || activeEffect === undefined) {
|
||||
return;
|
||||
}
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, (depsMap = new Map()));
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, (dep = new Set()));
|
||||
}
|
||||
if (!dep.has(activeEffect)) {
|
||||
dep.add(activeEffect);
|
||||
activeEffect.deps.push(dep);
|
||||
if ( activeEffect.options.onTrack) {
|
||||
activeEffect.options.onTrack({
|
||||
effect: activeEffect,
|
||||
target,
|
||||
type,
|
||||
key
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
||||
const depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
// never been tracked
|
||||
return;
|
||||
}
|
||||
const effects = new Set();
|
||||
const add = (effectsToAdd) => {
|
||||
if (effectsToAdd) {
|
||||
effectsToAdd.forEach(effect => {
|
||||
if (effect !== activeEffect || effect.allowRecurse) {
|
||||
effects.add(effect);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
if (type === "clear" /* CLEAR */) {
|
||||
// collection being cleared
|
||||
// trigger all effects for target
|
||||
depsMap.forEach(add);
|
||||
}
|
||||
else if (key === 'length' && isArray(target)) {
|
||||
depsMap.forEach((dep, key) => {
|
||||
if (key === 'length' || key >= newValue) {
|
||||
add(dep);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// schedule runs for SET | ADD | DELETE
|
||||
if (key !== void 0) {
|
||||
add(depsMap.get(key));
|
||||
}
|
||||
// also run for iteration key on ADD | DELETE | Map.SET
|
||||
switch (type) {
|
||||
case "add" /* ADD */:
|
||||
if (!isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
else if (isIntegerKey(key)) {
|
||||
// new index added to array -> length changes
|
||||
add(depsMap.get('length'));
|
||||
}
|
||||
break;
|
||||
case "delete" /* DELETE */:
|
||||
if (!isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "set" /* SET */:
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const run = (effect) => {
|
||||
if ( effect.options.onTrigger) {
|
||||
effect.options.onTrigger({
|
||||
effect,
|
||||
target,
|
||||
key,
|
||||
type,
|
||||
newValue,
|
||||
oldValue,
|
||||
oldTarget
|
||||
});
|
||||
}
|
||||
if (effect.options.scheduler) {
|
||||
effect.options.scheduler(effect);
|
||||
}
|
||||
else {
|
||||
effect();
|
||||
}
|
||||
};
|
||||
effects.forEach(run);
|
||||
}
|
||||
|
||||
const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
|
||||
.map(key => Symbol[key])
|
||||
.filter(isSymbol));
|
||||
const get = /*#__PURE__*/ createGetter();
|
||||
const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
||||
const readonlyGet = /*#__PURE__*/ createGetter(true);
|
||||
const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
||||
const arrayInstrumentations = {};
|
||||
['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
const arr = toRaw(this);
|
||||
for (let i = 0, l = this.length; i < l; i++) {
|
||||
track(arr, "get" /* GET */, i + '');
|
||||
}
|
||||
// we run the method using the original args first (which may be reactive)
|
||||
const res = method.apply(arr, args);
|
||||
if (res === -1 || res === false) {
|
||||
// if that didn't work, run it again using raw values.
|
||||
return method.apply(arr, args.map(toRaw));
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
});
|
||||
['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
pauseTracking();
|
||||
const res = method.apply(this, args);
|
||||
resetTracking();
|
||||
return res;
|
||||
};
|
||||
});
|
||||
function createGetter(isReadonly = false, shallow = false) {
|
||||
return function get(target, key, receiver) {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */ &&
|
||||
receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {
|
||||
return target;
|
||||
}
|
||||
const targetIsArray = isArray(target);
|
||||
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
||||
return Reflect.get(arrayInstrumentations, key, receiver);
|
||||
}
|
||||
const res = Reflect.get(target, key, receiver);
|
||||
if (isSymbol(key)
|
||||
? builtInSymbols.has(key)
|
||||
: key === `__proto__` || key === `__v_isRef`) {
|
||||
return res;
|
||||
}
|
||||
if (!isReadonly) {
|
||||
track(target, "get" /* GET */, key);
|
||||
}
|
||||
if (shallow) {
|
||||
return res;
|
||||
}
|
||||
if (isRef(res)) {
|
||||
// ref unwrapping - does not apply for Array + integer key.
|
||||
const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
|
||||
return shouldUnwrap ? res.value : res;
|
||||
}
|
||||
if (isObject(res)) {
|
||||
// Convert returned value into a proxy as well. we do the isObject check
|
||||
// here to avoid invalid value warning. Also need to lazy access readonly
|
||||
// and reactive here to avoid circular dependency.
|
||||
return isReadonly ? readonly(res) : reactive(res);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
}
|
||||
const set = /*#__PURE__*/ createSetter();
|
||||
const shallowSet = /*#__PURE__*/ createSetter(true);
|
||||
function createSetter(shallow = false) {
|
||||
return function set(target, key, value, receiver) {
|
||||
const oldValue = target[key];
|
||||
if (!shallow) {
|
||||
value = toRaw(value);
|
||||
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const hadKey = isArray(target) && isIntegerKey(key)
|
||||
? Number(key) < target.length
|
||||
: hasOwn(target, key);
|
||||
const result = Reflect.set(target, key, value, receiver);
|
||||
// don't trigger if target is something up in the prototype chain of original
|
||||
if (target === toRaw(receiver)) {
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
function deleteProperty(target, key) {
|
||||
const hadKey = hasOwn(target, key);
|
||||
const oldValue = target[key];
|
||||
const result = Reflect.deleteProperty(target, key);
|
||||
if (result && hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function has(target, key) {
|
||||
const result = Reflect.has(target, key);
|
||||
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
||||
track(target, "has" /* HAS */, key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function ownKeys(target) {
|
||||
track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
const mutableHandlers = {
|
||||
get,
|
||||
set,
|
||||
deleteProperty,
|
||||
has,
|
||||
ownKeys
|
||||
};
|
||||
const readonlyHandlers = {
|
||||
get: readonlyGet,
|
||||
set(target, key) {
|
||||
{
|
||||
console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, key) {
|
||||
{
|
||||
console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const shallowReactiveHandlers = extend({}, mutableHandlers, {
|
||||
get: shallowGet,
|
||||
set: shallowSet
|
||||
});
|
||||
// Props handlers are special in the sense that it should not unwrap top-level
|
||||
// refs (in order to allow refs to be explicitly passed down), but should
|
||||
// retain the reactivity of the normal readonly object.
|
||||
const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
|
||||
get: shallowReadonlyGet
|
||||
});
|
||||
|
||||
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
||||
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
||||
const toShallow = (value) => value;
|
||||
const getProto = (v) => Reflect.getPrototypeOf(v);
|
||||
function get$1(target, key, isReadonly = false, isShallow = false) {
|
||||
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
||||
// of the value
|
||||
target = target["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
||||
const { has } = getProto(rawTarget);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
if (has.call(rawTarget, key)) {
|
||||
return wrap(target.get(key));
|
||||
}
|
||||
else if (has.call(rawTarget, rawKey)) {
|
||||
return wrap(target.get(rawKey));
|
||||
}
|
||||
}
|
||||
function has$1(key, isReadonly = false) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
||||
return key === rawKey
|
||||
? target.has(key)
|
||||
: target.has(key) || target.has(rawKey);
|
||||
}
|
||||
function size(target, isReadonly = false) {
|
||||
target = target["__v_raw" /* RAW */];
|
||||
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return Reflect.get(target, 'size', target);
|
||||
}
|
||||
function add(value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const proto = getProto(target);
|
||||
const hadKey = proto.has.call(target, value);
|
||||
const result = target.add(value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, value, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function set$1(key, value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get.call(target, key);
|
||||
const result = target.set(key, value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function deleteEntry(key) {
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get ? get.call(target, key) : undefined;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.delete(key);
|
||||
if (hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function clear() {
|
||||
const target = toRaw(this);
|
||||
const hadItems = target.size !== 0;
|
||||
const oldTarget = isMap(target)
|
||||
? new Map(target)
|
||||
: new Set(target)
|
||||
;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.clear();
|
||||
if (hadItems) {
|
||||
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function createForEach(isReadonly, isShallow) {
|
||||
return function forEach(callback, thisArg) {
|
||||
const observed = this;
|
||||
const target = observed["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return target.forEach((value, key) => {
|
||||
// important: make sure the callback is
|
||||
// 1. invoked with the reactive map as `this` and 3rd arg
|
||||
// 2. the value received should be a corresponding reactive/readonly.
|
||||
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
||||
});
|
||||
};
|
||||
}
|
||||
function createIterableMethod(method, isReadonly, isShallow) {
|
||||
return function (...args) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const targetIsMap = isMap(rawTarget);
|
||||
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
||||
const isKeyOnly = method === 'keys' && targetIsMap;
|
||||
const innerIterator = target[method](...args);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly &&
|
||||
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
||||
// return a wrapped iterator which returns observed versions of the
|
||||
// values emitted from the real iterator
|
||||
return {
|
||||
// iterator protocol
|
||||
next() {
|
||||
const { value, done } = innerIterator.next();
|
||||
return done
|
||||
? { value, done }
|
||||
: {
|
||||
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
||||
done
|
||||
};
|
||||
},
|
||||
// iterable protocol
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function createReadonlyMethod(type) {
|
||||
return function (...args) {
|
||||
{
|
||||
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
||||
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
||||
}
|
||||
return type === "delete" /* DELETE */ ? false : this;
|
||||
};
|
||||
}
|
||||
const mutableInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, false)
|
||||
};
|
||||
const shallowInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, false, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, true)
|
||||
};
|
||||
const readonlyInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this, true);
|
||||
},
|
||||
has(key) {
|
||||
return has$1.call(this, key, true);
|
||||
},
|
||||
add: createReadonlyMethod("add" /* ADD */),
|
||||
set: createReadonlyMethod("set" /* SET */),
|
||||
delete: createReadonlyMethod("delete" /* DELETE */),
|
||||
clear: createReadonlyMethod("clear" /* CLEAR */),
|
||||
forEach: createForEach(true, false)
|
||||
};
|
||||
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
||||
iteratorMethods.forEach(method => {
|
||||
mutableInstrumentations[method] = createIterableMethod(method, false, false);
|
||||
readonlyInstrumentations[method] = createIterableMethod(method, true, false);
|
||||
shallowInstrumentations[method] = createIterableMethod(method, false, true);
|
||||
});
|
||||
function createInstrumentationGetter(isReadonly, shallow) {
|
||||
const instrumentations = shallow
|
||||
? shallowInstrumentations
|
||||
: isReadonly
|
||||
? readonlyInstrumentations
|
||||
: mutableInstrumentations;
|
||||
return (target, key, receiver) => {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */) {
|
||||
return target;
|
||||
}
|
||||
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
||||
? instrumentations
|
||||
: target, key, receiver);
|
||||
};
|
||||
}
|
||||
const mutableCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, false)
|
||||
};
|
||||
const shallowCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, true)
|
||||
};
|
||||
const readonlyCollectionHandlers = {
|
||||
get: createInstrumentationGetter(true, false)
|
||||
};
|
||||
function checkIdentityKeys(target, has, key) {
|
||||
const rawKey = toRaw(key);
|
||||
if (rawKey !== key && has.call(target, rawKey)) {
|
||||
const type = toRawType(target);
|
||||
console.warn(`Reactive ${type} contains both the raw and reactive ` +
|
||||
`versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
|
||||
`which can lead to inconsistencies. ` +
|
||||
`Avoid differentiating between the raw and reactive versions ` +
|
||||
`of an object and only use the reactive version if possible.`);
|
||||
}
|
||||
}
|
||||
|
||||
const reactiveMap = new WeakMap();
|
||||
const readonlyMap = new WeakMap();
|
||||
function targetTypeMap(rawType) {
|
||||
switch (rawType) {
|
||||
case 'Object':
|
||||
case 'Array':
|
||||
return 1 /* COMMON */;
|
||||
case 'Map':
|
||||
case 'Set':
|
||||
case 'WeakMap':
|
||||
case 'WeakSet':
|
||||
return 2 /* COLLECTION */;
|
||||
default:
|
||||
return 0 /* INVALID */;
|
||||
}
|
||||
}
|
||||
function getTargetType(value) {
|
||||
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
||||
? 0 /* INVALID */
|
||||
: targetTypeMap(toRawType(value));
|
||||
}
|
||||
function reactive(target) {
|
||||
// if trying to observe a readonly proxy, return the readonly version.
|
||||
if (target && target["__v_isReadonly" /* IS_READONLY */]) {
|
||||
return target;
|
||||
}
|
||||
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are reactive, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
function shallowReactive(target) {
|
||||
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
|
||||
}
|
||||
function readonly(target) {
|
||||
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are readonly, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
// This is used for creating the props proxy object for stateful components.
|
||||
function shallowReadonly(target) {
|
||||
return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
|
||||
if (!isObject(target)) {
|
||||
{
|
||||
console.warn(`value cannot be made reactive: ${String(target)}`);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
// target is already a Proxy, return it.
|
||||
// exception: calling readonly() on a reactive object
|
||||
if (target["__v_raw" /* RAW */] &&
|
||||
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
||||
return target;
|
||||
}
|
||||
// target already has corresponding Proxy
|
||||
const proxyMap = isReadonly ? readonlyMap : reactiveMap;
|
||||
const existingProxy = proxyMap.get(target);
|
||||
if (existingProxy) {
|
||||
return existingProxy;
|
||||
}
|
||||
// only a whitelist of value types can be observed.
|
||||
const targetType = getTargetType(target);
|
||||
if (targetType === 0 /* INVALID */) {
|
||||
return target;
|
||||
}
|
||||
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
||||
proxyMap.set(target, proxy);
|
||||
return proxy;
|
||||
}
|
||||
function isReactive(value) {
|
||||
if (isReadonly(value)) {
|
||||
return isReactive(value["__v_raw" /* RAW */]);
|
||||
}
|
||||
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
||||
}
|
||||
function isReadonly(value) {
|
||||
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
||||
}
|
||||
function isProxy(value) {
|
||||
return isReactive(value) || isReadonly(value);
|
||||
}
|
||||
function toRaw(observed) {
|
||||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
|
||||
}
|
||||
function markRaw(value) {
|
||||
def(value, "__v_skip" /* SKIP */, true);
|
||||
return value;
|
||||
}
|
||||
|
||||
const convert = (val) => isObject(val) ? reactive(val) : val;
|
||||
function isRef(r) {
|
||||
return Boolean(r && r.__v_isRef === true);
|
||||
}
|
||||
function ref(value) {
|
||||
return createRef(value);
|
||||
}
|
||||
function shallowRef(value) {
|
||||
return createRef(value, true);
|
||||
}
|
||||
class RefImpl {
|
||||
constructor(_rawValue, _shallow = false) {
|
||||
this._rawValue = _rawValue;
|
||||
this._shallow = _shallow;
|
||||
this.__v_isRef = true;
|
||||
this._value = _shallow ? _rawValue : convert(_rawValue);
|
||||
}
|
||||
get value() {
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newVal) {
|
||||
if (hasChanged(toRaw(newVal), this._rawValue)) {
|
||||
this._rawValue = newVal;
|
||||
this._value = this._shallow ? newVal : convert(newVal);
|
||||
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef(rawValue, shallow = false) {
|
||||
if (isRef(rawValue)) {
|
||||
return rawValue;
|
||||
}
|
||||
return new RefImpl(rawValue, shallow);
|
||||
}
|
||||
function triggerRef(ref) {
|
||||
trigger(toRaw(ref), "set" /* SET */, 'value', ref.value );
|
||||
}
|
||||
function unref(ref) {
|
||||
return isRef(ref) ? ref.value : ref;
|
||||
}
|
||||
const shallowUnwrapHandlers = {
|
||||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
||||
set: (target, key, value, receiver) => {
|
||||
const oldValue = target[key];
|
||||
if (isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return Reflect.set(target, key, value, receiver);
|
||||
}
|
||||
}
|
||||
};
|
||||
function proxyRefs(objectWithRefs) {
|
||||
return isReactive(objectWithRefs)
|
||||
? objectWithRefs
|
||||
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
||||
}
|
||||
class CustomRefImpl {
|
||||
constructor(factory) {
|
||||
this.__v_isRef = true;
|
||||
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
||||
this._get = get;
|
||||
this._set = set;
|
||||
}
|
||||
get value() {
|
||||
return this._get();
|
||||
}
|
||||
set value(newVal) {
|
||||
this._set(newVal);
|
||||
}
|
||||
}
|
||||
function customRef(factory) {
|
||||
return new CustomRefImpl(factory);
|
||||
}
|
||||
function toRefs(object) {
|
||||
if ( !isProxy(object)) {
|
||||
console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
||||
}
|
||||
const ret = isArray(object) ? new Array(object.length) : {};
|
||||
for (const key in object) {
|
||||
ret[key] = toRef(object, key);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
class ObjectRefImpl {
|
||||
constructor(_object, _key) {
|
||||
this._object = _object;
|
||||
this._key = _key;
|
||||
this.__v_isRef = true;
|
||||
}
|
||||
get value() {
|
||||
return this._object[this._key];
|
||||
}
|
||||
set value(newVal) {
|
||||
this._object[this._key] = newVal;
|
||||
}
|
||||
}
|
||||
function toRef(object, key) {
|
||||
return isRef(object[key])
|
||||
? object[key]
|
||||
: new ObjectRefImpl(object, key);
|
||||
}
|
||||
|
||||
class ComputedRefImpl {
|
||||
constructor(getter, _setter, isReadonly) {
|
||||
this._setter = _setter;
|
||||
this._dirty = true;
|
||||
this.__v_isRef = true;
|
||||
this.effect = effect(getter, {
|
||||
lazy: true,
|
||||
scheduler: () => {
|
||||
if (!this._dirty) {
|
||||
this._dirty = true;
|
||||
trigger(toRaw(this), "set" /* SET */, 'value');
|
||||
}
|
||||
}
|
||||
});
|
||||
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
||||
}
|
||||
get value() {
|
||||
if (this._dirty) {
|
||||
this._value = this.effect();
|
||||
this._dirty = false;
|
||||
}
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newValue) {
|
||||
this._setter(newValue);
|
||||
}
|
||||
}
|
||||
function computed(getterOrOptions) {
|
||||
let getter;
|
||||
let setter;
|
||||
if (isFunction(getterOrOptions)) {
|
||||
getter = getterOrOptions;
|
||||
setter = () => {
|
||||
console.warn('Write operation failed: computed value is readonly');
|
||||
}
|
||||
;
|
||||
}
|
||||
else {
|
||||
getter = getterOrOptions.get;
|
||||
setter = getterOrOptions.set;
|
||||
}
|
||||
return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
|
||||
}
|
||||
|
||||
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };
|
||||
1
node_modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js
generated
vendored
Normal file
1
node_modules/@vue/reactivity/dist/reactivity.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
847
node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
generated
vendored
Normal file
847
node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
generated
vendored
Normal file
@@ -0,0 +1,847 @@
|
||||
import { EMPTY_OBJ, isArray, isMap, isIntegerKey, isSymbol, extend, hasOwn, isObject, hasChanged, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';
|
||||
|
||||
const targetMap = new WeakMap();
|
||||
const effectStack = [];
|
||||
let activeEffect;
|
||||
const ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'iterate' : '');
|
||||
const MAP_KEY_ITERATE_KEY = Symbol((process.env.NODE_ENV !== 'production') ? 'Map key iterate' : '');
|
||||
function isEffect(fn) {
|
||||
return fn && fn._isEffect === true;
|
||||
}
|
||||
function effect(fn, options = EMPTY_OBJ) {
|
||||
if (isEffect(fn)) {
|
||||
fn = fn.raw;
|
||||
}
|
||||
const effect = createReactiveEffect(fn, options);
|
||||
if (!options.lazy) {
|
||||
effect();
|
||||
}
|
||||
return effect;
|
||||
}
|
||||
function stop(effect) {
|
||||
if (effect.active) {
|
||||
cleanup(effect);
|
||||
if (effect.options.onStop) {
|
||||
effect.options.onStop();
|
||||
}
|
||||
effect.active = false;
|
||||
}
|
||||
}
|
||||
let uid = 0;
|
||||
function createReactiveEffect(fn, options) {
|
||||
const effect = function reactiveEffect() {
|
||||
if (!effect.active) {
|
||||
return options.scheduler ? undefined : fn();
|
||||
}
|
||||
if (!effectStack.includes(effect)) {
|
||||
cleanup(effect);
|
||||
try {
|
||||
enableTracking();
|
||||
effectStack.push(effect);
|
||||
activeEffect = effect;
|
||||
return fn();
|
||||
}
|
||||
finally {
|
||||
effectStack.pop();
|
||||
resetTracking();
|
||||
activeEffect = effectStack[effectStack.length - 1];
|
||||
}
|
||||
}
|
||||
};
|
||||
effect.id = uid++;
|
||||
effect.allowRecurse = !!options.allowRecurse;
|
||||
effect._isEffect = true;
|
||||
effect.active = true;
|
||||
effect.raw = fn;
|
||||
effect.deps = [];
|
||||
effect.options = options;
|
||||
return effect;
|
||||
}
|
||||
function cleanup(effect) {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].delete(effect);
|
||||
}
|
||||
deps.length = 0;
|
||||
}
|
||||
}
|
||||
let shouldTrack = true;
|
||||
const trackStack = [];
|
||||
function pauseTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = false;
|
||||
}
|
||||
function enableTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = true;
|
||||
}
|
||||
function resetTracking() {
|
||||
const last = trackStack.pop();
|
||||
shouldTrack = last === undefined ? true : last;
|
||||
}
|
||||
function track(target, type, key) {
|
||||
if (!shouldTrack || activeEffect === undefined) {
|
||||
return;
|
||||
}
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, (depsMap = new Map()));
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, (dep = new Set()));
|
||||
}
|
||||
if (!dep.has(activeEffect)) {
|
||||
dep.add(activeEffect);
|
||||
activeEffect.deps.push(dep);
|
||||
if ((process.env.NODE_ENV !== 'production') && activeEffect.options.onTrack) {
|
||||
activeEffect.options.onTrack({
|
||||
effect: activeEffect,
|
||||
target,
|
||||
type,
|
||||
key
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
||||
const depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
// never been tracked
|
||||
return;
|
||||
}
|
||||
const effects = new Set();
|
||||
const add = (effectsToAdd) => {
|
||||
if (effectsToAdd) {
|
||||
effectsToAdd.forEach(effect => {
|
||||
if (effect !== activeEffect || effect.allowRecurse) {
|
||||
effects.add(effect);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
if (type === "clear" /* CLEAR */) {
|
||||
// collection being cleared
|
||||
// trigger all effects for target
|
||||
depsMap.forEach(add);
|
||||
}
|
||||
else if (key === 'length' && isArray(target)) {
|
||||
depsMap.forEach((dep, key) => {
|
||||
if (key === 'length' || key >= newValue) {
|
||||
add(dep);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// schedule runs for SET | ADD | DELETE
|
||||
if (key !== void 0) {
|
||||
add(depsMap.get(key));
|
||||
}
|
||||
// also run for iteration key on ADD | DELETE | Map.SET
|
||||
switch (type) {
|
||||
case "add" /* ADD */:
|
||||
if (!isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
else if (isIntegerKey(key)) {
|
||||
// new index added to array -> length changes
|
||||
add(depsMap.get('length'));
|
||||
}
|
||||
break;
|
||||
case "delete" /* DELETE */:
|
||||
if (!isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "set" /* SET */:
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const run = (effect) => {
|
||||
if ((process.env.NODE_ENV !== 'production') && effect.options.onTrigger) {
|
||||
effect.options.onTrigger({
|
||||
effect,
|
||||
target,
|
||||
key,
|
||||
type,
|
||||
newValue,
|
||||
oldValue,
|
||||
oldTarget
|
||||
});
|
||||
}
|
||||
if (effect.options.scheduler) {
|
||||
effect.options.scheduler(effect);
|
||||
}
|
||||
else {
|
||||
effect();
|
||||
}
|
||||
};
|
||||
effects.forEach(run);
|
||||
}
|
||||
|
||||
const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
|
||||
.map(key => Symbol[key])
|
||||
.filter(isSymbol));
|
||||
const get = /*#__PURE__*/ createGetter();
|
||||
const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
||||
const readonlyGet = /*#__PURE__*/ createGetter(true);
|
||||
const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
||||
const arrayInstrumentations = {};
|
||||
['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
const arr = toRaw(this);
|
||||
for (let i = 0, l = this.length; i < l; i++) {
|
||||
track(arr, "get" /* GET */, i + '');
|
||||
}
|
||||
// we run the method using the original args first (which may be reactive)
|
||||
const res = method.apply(arr, args);
|
||||
if (res === -1 || res === false) {
|
||||
// if that didn't work, run it again using raw values.
|
||||
return method.apply(arr, args.map(toRaw));
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
});
|
||||
['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
pauseTracking();
|
||||
const res = method.apply(this, args);
|
||||
resetTracking();
|
||||
return res;
|
||||
};
|
||||
});
|
||||
function createGetter(isReadonly = false, shallow = false) {
|
||||
return function get(target, key, receiver) {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */ &&
|
||||
receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {
|
||||
return target;
|
||||
}
|
||||
const targetIsArray = isArray(target);
|
||||
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
||||
return Reflect.get(arrayInstrumentations, key, receiver);
|
||||
}
|
||||
const res = Reflect.get(target, key, receiver);
|
||||
if (isSymbol(key)
|
||||
? builtInSymbols.has(key)
|
||||
: key === `__proto__` || key === `__v_isRef`) {
|
||||
return res;
|
||||
}
|
||||
if (!isReadonly) {
|
||||
track(target, "get" /* GET */, key);
|
||||
}
|
||||
if (shallow) {
|
||||
return res;
|
||||
}
|
||||
if (isRef(res)) {
|
||||
// ref unwrapping - does not apply for Array + integer key.
|
||||
const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
|
||||
return shouldUnwrap ? res.value : res;
|
||||
}
|
||||
if (isObject(res)) {
|
||||
// Convert returned value into a proxy as well. we do the isObject check
|
||||
// here to avoid invalid value warning. Also need to lazy access readonly
|
||||
// and reactive here to avoid circular dependency.
|
||||
return isReadonly ? readonly(res) : reactive(res);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
}
|
||||
const set = /*#__PURE__*/ createSetter();
|
||||
const shallowSet = /*#__PURE__*/ createSetter(true);
|
||||
function createSetter(shallow = false) {
|
||||
return function set(target, key, value, receiver) {
|
||||
const oldValue = target[key];
|
||||
if (!shallow) {
|
||||
value = toRaw(value);
|
||||
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const hadKey = isArray(target) && isIntegerKey(key)
|
||||
? Number(key) < target.length
|
||||
: hasOwn(target, key);
|
||||
const result = Reflect.set(target, key, value, receiver);
|
||||
// don't trigger if target is something up in the prototype chain of original
|
||||
if (target === toRaw(receiver)) {
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
function deleteProperty(target, key) {
|
||||
const hadKey = hasOwn(target, key);
|
||||
const oldValue = target[key];
|
||||
const result = Reflect.deleteProperty(target, key);
|
||||
if (result && hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function has(target, key) {
|
||||
const result = Reflect.has(target, key);
|
||||
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
||||
track(target, "has" /* HAS */, key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function ownKeys(target) {
|
||||
track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
const mutableHandlers = {
|
||||
get,
|
||||
set,
|
||||
deleteProperty,
|
||||
has,
|
||||
ownKeys
|
||||
};
|
||||
const readonlyHandlers = {
|
||||
get: readonlyGet,
|
||||
set(target, key) {
|
||||
if ((process.env.NODE_ENV !== 'production')) {
|
||||
console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, key) {
|
||||
if ((process.env.NODE_ENV !== 'production')) {
|
||||
console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const shallowReactiveHandlers = extend({}, mutableHandlers, {
|
||||
get: shallowGet,
|
||||
set: shallowSet
|
||||
});
|
||||
// Props handlers are special in the sense that it should not unwrap top-level
|
||||
// refs (in order to allow refs to be explicitly passed down), but should
|
||||
// retain the reactivity of the normal readonly object.
|
||||
const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
|
||||
get: shallowReadonlyGet
|
||||
});
|
||||
|
||||
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
||||
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
||||
const toShallow = (value) => value;
|
||||
const getProto = (v) => Reflect.getPrototypeOf(v);
|
||||
function get$1(target, key, isReadonly = false, isShallow = false) {
|
||||
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
||||
// of the value
|
||||
target = target["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
||||
const { has } = getProto(rawTarget);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
if (has.call(rawTarget, key)) {
|
||||
return wrap(target.get(key));
|
||||
}
|
||||
else if (has.call(rawTarget, rawKey)) {
|
||||
return wrap(target.get(rawKey));
|
||||
}
|
||||
}
|
||||
function has$1(key, isReadonly = false) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
||||
return key === rawKey
|
||||
? target.has(key)
|
||||
: target.has(key) || target.has(rawKey);
|
||||
}
|
||||
function size(target, isReadonly = false) {
|
||||
target = target["__v_raw" /* RAW */];
|
||||
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return Reflect.get(target, 'size', target);
|
||||
}
|
||||
function add(value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const proto = getProto(target);
|
||||
const hadKey = proto.has.call(target, value);
|
||||
const result = target.add(value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, value, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function set$1(key, value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else if ((process.env.NODE_ENV !== 'production')) {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get.call(target, key);
|
||||
const result = target.set(key, value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function deleteEntry(key) {
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else if ((process.env.NODE_ENV !== 'production')) {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get ? get.call(target, key) : undefined;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.delete(key);
|
||||
if (hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function clear() {
|
||||
const target = toRaw(this);
|
||||
const hadItems = target.size !== 0;
|
||||
const oldTarget = (process.env.NODE_ENV !== 'production')
|
||||
? isMap(target)
|
||||
? new Map(target)
|
||||
: new Set(target)
|
||||
: undefined;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.clear();
|
||||
if (hadItems) {
|
||||
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function createForEach(isReadonly, isShallow) {
|
||||
return function forEach(callback, thisArg) {
|
||||
const observed = this;
|
||||
const target = observed["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return target.forEach((value, key) => {
|
||||
// important: make sure the callback is
|
||||
// 1. invoked with the reactive map as `this` and 3rd arg
|
||||
// 2. the value received should be a corresponding reactive/readonly.
|
||||
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
||||
});
|
||||
};
|
||||
}
|
||||
function createIterableMethod(method, isReadonly, isShallow) {
|
||||
return function (...args) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const targetIsMap = isMap(rawTarget);
|
||||
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
||||
const isKeyOnly = method === 'keys' && targetIsMap;
|
||||
const innerIterator = target[method](...args);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly &&
|
||||
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
||||
// return a wrapped iterator which returns observed versions of the
|
||||
// values emitted from the real iterator
|
||||
return {
|
||||
// iterator protocol
|
||||
next() {
|
||||
const { value, done } = innerIterator.next();
|
||||
return done
|
||||
? { value, done }
|
||||
: {
|
||||
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
||||
done
|
||||
};
|
||||
},
|
||||
// iterable protocol
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function createReadonlyMethod(type) {
|
||||
return function (...args) {
|
||||
if ((process.env.NODE_ENV !== 'production')) {
|
||||
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
||||
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
||||
}
|
||||
return type === "delete" /* DELETE */ ? false : this;
|
||||
};
|
||||
}
|
||||
const mutableInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, false)
|
||||
};
|
||||
const shallowInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, false, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, true)
|
||||
};
|
||||
const readonlyInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this, true);
|
||||
},
|
||||
has(key) {
|
||||
return has$1.call(this, key, true);
|
||||
},
|
||||
add: createReadonlyMethod("add" /* ADD */),
|
||||
set: createReadonlyMethod("set" /* SET */),
|
||||
delete: createReadonlyMethod("delete" /* DELETE */),
|
||||
clear: createReadonlyMethod("clear" /* CLEAR */),
|
||||
forEach: createForEach(true, false)
|
||||
};
|
||||
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
||||
iteratorMethods.forEach(method => {
|
||||
mutableInstrumentations[method] = createIterableMethod(method, false, false);
|
||||
readonlyInstrumentations[method] = createIterableMethod(method, true, false);
|
||||
shallowInstrumentations[method] = createIterableMethod(method, false, true);
|
||||
});
|
||||
function createInstrumentationGetter(isReadonly, shallow) {
|
||||
const instrumentations = shallow
|
||||
? shallowInstrumentations
|
||||
: isReadonly
|
||||
? readonlyInstrumentations
|
||||
: mutableInstrumentations;
|
||||
return (target, key, receiver) => {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */) {
|
||||
return target;
|
||||
}
|
||||
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
||||
? instrumentations
|
||||
: target, key, receiver);
|
||||
};
|
||||
}
|
||||
const mutableCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, false)
|
||||
};
|
||||
const shallowCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, true)
|
||||
};
|
||||
const readonlyCollectionHandlers = {
|
||||
get: createInstrumentationGetter(true, false)
|
||||
};
|
||||
function checkIdentityKeys(target, has, key) {
|
||||
const rawKey = toRaw(key);
|
||||
if (rawKey !== key && has.call(target, rawKey)) {
|
||||
const type = toRawType(target);
|
||||
console.warn(`Reactive ${type} contains both the raw and reactive ` +
|
||||
`versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
|
||||
`which can lead to inconsistencies. ` +
|
||||
`Avoid differentiating between the raw and reactive versions ` +
|
||||
`of an object and only use the reactive version if possible.`);
|
||||
}
|
||||
}
|
||||
|
||||
const reactiveMap = new WeakMap();
|
||||
const readonlyMap = new WeakMap();
|
||||
function targetTypeMap(rawType) {
|
||||
switch (rawType) {
|
||||
case 'Object':
|
||||
case 'Array':
|
||||
return 1 /* COMMON */;
|
||||
case 'Map':
|
||||
case 'Set':
|
||||
case 'WeakMap':
|
||||
case 'WeakSet':
|
||||
return 2 /* COLLECTION */;
|
||||
default:
|
||||
return 0 /* INVALID */;
|
||||
}
|
||||
}
|
||||
function getTargetType(value) {
|
||||
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
||||
? 0 /* INVALID */
|
||||
: targetTypeMap(toRawType(value));
|
||||
}
|
||||
function reactive(target) {
|
||||
// if trying to observe a readonly proxy, return the readonly version.
|
||||
if (target && target["__v_isReadonly" /* IS_READONLY */]) {
|
||||
return target;
|
||||
}
|
||||
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are reactive, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
function shallowReactive(target) {
|
||||
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
|
||||
}
|
||||
function readonly(target) {
|
||||
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are readonly, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
// This is used for creating the props proxy object for stateful components.
|
||||
function shallowReadonly(target) {
|
||||
return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
|
||||
if (!isObject(target)) {
|
||||
if ((process.env.NODE_ENV !== 'production')) {
|
||||
console.warn(`value cannot be made reactive: ${String(target)}`);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
// target is already a Proxy, return it.
|
||||
// exception: calling readonly() on a reactive object
|
||||
if (target["__v_raw" /* RAW */] &&
|
||||
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
||||
return target;
|
||||
}
|
||||
// target already has corresponding Proxy
|
||||
const proxyMap = isReadonly ? readonlyMap : reactiveMap;
|
||||
const existingProxy = proxyMap.get(target);
|
||||
if (existingProxy) {
|
||||
return existingProxy;
|
||||
}
|
||||
// only a whitelist of value types can be observed.
|
||||
const targetType = getTargetType(target);
|
||||
if (targetType === 0 /* INVALID */) {
|
||||
return target;
|
||||
}
|
||||
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
||||
proxyMap.set(target, proxy);
|
||||
return proxy;
|
||||
}
|
||||
function isReactive(value) {
|
||||
if (isReadonly(value)) {
|
||||
return isReactive(value["__v_raw" /* RAW */]);
|
||||
}
|
||||
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
||||
}
|
||||
function isReadonly(value) {
|
||||
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
||||
}
|
||||
function isProxy(value) {
|
||||
return isReactive(value) || isReadonly(value);
|
||||
}
|
||||
function toRaw(observed) {
|
||||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
|
||||
}
|
||||
function markRaw(value) {
|
||||
def(value, "__v_skip" /* SKIP */, true);
|
||||
return value;
|
||||
}
|
||||
|
||||
const convert = (val) => isObject(val) ? reactive(val) : val;
|
||||
function isRef(r) {
|
||||
return Boolean(r && r.__v_isRef === true);
|
||||
}
|
||||
function ref(value) {
|
||||
return createRef(value);
|
||||
}
|
||||
function shallowRef(value) {
|
||||
return createRef(value, true);
|
||||
}
|
||||
class RefImpl {
|
||||
constructor(_rawValue, _shallow = false) {
|
||||
this._rawValue = _rawValue;
|
||||
this._shallow = _shallow;
|
||||
this.__v_isRef = true;
|
||||
this._value = _shallow ? _rawValue : convert(_rawValue);
|
||||
}
|
||||
get value() {
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newVal) {
|
||||
if (hasChanged(toRaw(newVal), this._rawValue)) {
|
||||
this._rawValue = newVal;
|
||||
this._value = this._shallow ? newVal : convert(newVal);
|
||||
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef(rawValue, shallow = false) {
|
||||
if (isRef(rawValue)) {
|
||||
return rawValue;
|
||||
}
|
||||
return new RefImpl(rawValue, shallow);
|
||||
}
|
||||
function triggerRef(ref) {
|
||||
trigger(toRaw(ref), "set" /* SET */, 'value', (process.env.NODE_ENV !== 'production') ? ref.value : void 0);
|
||||
}
|
||||
function unref(ref) {
|
||||
return isRef(ref) ? ref.value : ref;
|
||||
}
|
||||
const shallowUnwrapHandlers = {
|
||||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
||||
set: (target, key, value, receiver) => {
|
||||
const oldValue = target[key];
|
||||
if (isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return Reflect.set(target, key, value, receiver);
|
||||
}
|
||||
}
|
||||
};
|
||||
function proxyRefs(objectWithRefs) {
|
||||
return isReactive(objectWithRefs)
|
||||
? objectWithRefs
|
||||
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
||||
}
|
||||
class CustomRefImpl {
|
||||
constructor(factory) {
|
||||
this.__v_isRef = true;
|
||||
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
||||
this._get = get;
|
||||
this._set = set;
|
||||
}
|
||||
get value() {
|
||||
return this._get();
|
||||
}
|
||||
set value(newVal) {
|
||||
this._set(newVal);
|
||||
}
|
||||
}
|
||||
function customRef(factory) {
|
||||
return new CustomRefImpl(factory);
|
||||
}
|
||||
function toRefs(object) {
|
||||
if ((process.env.NODE_ENV !== 'production') && !isProxy(object)) {
|
||||
console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
||||
}
|
||||
const ret = isArray(object) ? new Array(object.length) : {};
|
||||
for (const key in object) {
|
||||
ret[key] = toRef(object, key);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
class ObjectRefImpl {
|
||||
constructor(_object, _key) {
|
||||
this._object = _object;
|
||||
this._key = _key;
|
||||
this.__v_isRef = true;
|
||||
}
|
||||
get value() {
|
||||
return this._object[this._key];
|
||||
}
|
||||
set value(newVal) {
|
||||
this._object[this._key] = newVal;
|
||||
}
|
||||
}
|
||||
function toRef(object, key) {
|
||||
return isRef(object[key])
|
||||
? object[key]
|
||||
: new ObjectRefImpl(object, key);
|
||||
}
|
||||
|
||||
class ComputedRefImpl {
|
||||
constructor(getter, _setter, isReadonly) {
|
||||
this._setter = _setter;
|
||||
this._dirty = true;
|
||||
this.__v_isRef = true;
|
||||
this.effect = effect(getter, {
|
||||
lazy: true,
|
||||
scheduler: () => {
|
||||
if (!this._dirty) {
|
||||
this._dirty = true;
|
||||
trigger(toRaw(this), "set" /* SET */, 'value');
|
||||
}
|
||||
}
|
||||
});
|
||||
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
||||
}
|
||||
get value() {
|
||||
if (this._dirty) {
|
||||
this._value = this.effect();
|
||||
this._dirty = false;
|
||||
}
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newValue) {
|
||||
this._setter(newValue);
|
||||
}
|
||||
}
|
||||
function computed(getterOrOptions) {
|
||||
let getter;
|
||||
let setter;
|
||||
if (isFunction(getterOrOptions)) {
|
||||
getter = getterOrOptions;
|
||||
setter = (process.env.NODE_ENV !== 'production')
|
||||
? () => {
|
||||
console.warn('Write operation failed: computed value is readonly');
|
||||
}
|
||||
: NOOP;
|
||||
}
|
||||
else {
|
||||
getter = getterOrOptions.get;
|
||||
setter = getterOrOptions.set;
|
||||
}
|
||||
return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
|
||||
}
|
||||
|
||||
export { ITERATE_KEY, computed, customRef, effect, enableTracking, isProxy, isReactive, isReadonly, isRef, markRaw, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, track, trigger, triggerRef, unref };
|
||||
919
node_modules/@vue/reactivity/dist/reactivity.global.js
generated
vendored
Normal file
919
node_modules/@vue/reactivity/dist/reactivity.global.js
generated
vendored
Normal file
@@ -0,0 +1,919 @@
|
||||
var VueReactivity = (function (exports) {
|
||||
'use strict';
|
||||
|
||||
const EMPTY_OBJ = Object.freeze({})
|
||||
;
|
||||
const EMPTY_ARR = Object.freeze([]) ;
|
||||
const extend = Object.assign;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
|
||||
const targetMap = new WeakMap();
|
||||
const effectStack = [];
|
||||
let activeEffect;
|
||||
const ITERATE_KEY = Symbol( 'iterate' );
|
||||
const MAP_KEY_ITERATE_KEY = Symbol( 'Map key iterate' );
|
||||
function isEffect(fn) {
|
||||
return fn && fn._isEffect === true;
|
||||
}
|
||||
function effect(fn, options = EMPTY_OBJ) {
|
||||
if (isEffect(fn)) {
|
||||
fn = fn.raw;
|
||||
}
|
||||
const effect = createReactiveEffect(fn, options);
|
||||
if (!options.lazy) {
|
||||
effect();
|
||||
}
|
||||
return effect;
|
||||
}
|
||||
function stop(effect) {
|
||||
if (effect.active) {
|
||||
cleanup(effect);
|
||||
if (effect.options.onStop) {
|
||||
effect.options.onStop();
|
||||
}
|
||||
effect.active = false;
|
||||
}
|
||||
}
|
||||
let uid = 0;
|
||||
function createReactiveEffect(fn, options) {
|
||||
const effect = function reactiveEffect() {
|
||||
if (!effect.active) {
|
||||
return options.scheduler ? undefined : fn();
|
||||
}
|
||||
if (!effectStack.includes(effect)) {
|
||||
cleanup(effect);
|
||||
try {
|
||||
enableTracking();
|
||||
effectStack.push(effect);
|
||||
activeEffect = effect;
|
||||
return fn();
|
||||
}
|
||||
finally {
|
||||
effectStack.pop();
|
||||
resetTracking();
|
||||
activeEffect = effectStack[effectStack.length - 1];
|
||||
}
|
||||
}
|
||||
};
|
||||
effect.id = uid++;
|
||||
effect.allowRecurse = !!options.allowRecurse;
|
||||
effect._isEffect = true;
|
||||
effect.active = true;
|
||||
effect.raw = fn;
|
||||
effect.deps = [];
|
||||
effect.options = options;
|
||||
return effect;
|
||||
}
|
||||
function cleanup(effect) {
|
||||
const { deps } = effect;
|
||||
if (deps.length) {
|
||||
for (let i = 0; i < deps.length; i++) {
|
||||
deps[i].delete(effect);
|
||||
}
|
||||
deps.length = 0;
|
||||
}
|
||||
}
|
||||
let shouldTrack = true;
|
||||
const trackStack = [];
|
||||
function pauseTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = false;
|
||||
}
|
||||
function enableTracking() {
|
||||
trackStack.push(shouldTrack);
|
||||
shouldTrack = true;
|
||||
}
|
||||
function resetTracking() {
|
||||
const last = trackStack.pop();
|
||||
shouldTrack = last === undefined ? true : last;
|
||||
}
|
||||
function track(target, type, key) {
|
||||
if (!shouldTrack || activeEffect === undefined) {
|
||||
return;
|
||||
}
|
||||
let depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
targetMap.set(target, (depsMap = new Map()));
|
||||
}
|
||||
let dep = depsMap.get(key);
|
||||
if (!dep) {
|
||||
depsMap.set(key, (dep = new Set()));
|
||||
}
|
||||
if (!dep.has(activeEffect)) {
|
||||
dep.add(activeEffect);
|
||||
activeEffect.deps.push(dep);
|
||||
if ( activeEffect.options.onTrack) {
|
||||
activeEffect.options.onTrack({
|
||||
effect: activeEffect,
|
||||
target,
|
||||
type,
|
||||
key
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
||||
const depsMap = targetMap.get(target);
|
||||
if (!depsMap) {
|
||||
// never been tracked
|
||||
return;
|
||||
}
|
||||
const effects = new Set();
|
||||
const add = (effectsToAdd) => {
|
||||
if (effectsToAdd) {
|
||||
effectsToAdd.forEach(effect => {
|
||||
if (effect !== activeEffect || effect.allowRecurse) {
|
||||
effects.add(effect);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
if (type === "clear" /* CLEAR */) {
|
||||
// collection being cleared
|
||||
// trigger all effects for target
|
||||
depsMap.forEach(add);
|
||||
}
|
||||
else if (key === 'length' && isArray(target)) {
|
||||
depsMap.forEach((dep, key) => {
|
||||
if (key === 'length' || key >= newValue) {
|
||||
add(dep);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// schedule runs for SET | ADD | DELETE
|
||||
if (key !== void 0) {
|
||||
add(depsMap.get(key));
|
||||
}
|
||||
// also run for iteration key on ADD | DELETE | Map.SET
|
||||
switch (type) {
|
||||
case "add" /* ADD */:
|
||||
if (!isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
else if (isIntegerKey(key)) {
|
||||
// new index added to array -> length changes
|
||||
add(depsMap.get('length'));
|
||||
}
|
||||
break;
|
||||
case "delete" /* DELETE */:
|
||||
if (!isArray(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(MAP_KEY_ITERATE_KEY));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "set" /* SET */:
|
||||
if (isMap(target)) {
|
||||
add(depsMap.get(ITERATE_KEY));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
const run = (effect) => {
|
||||
if ( effect.options.onTrigger) {
|
||||
effect.options.onTrigger({
|
||||
effect,
|
||||
target,
|
||||
key,
|
||||
type,
|
||||
newValue,
|
||||
oldValue,
|
||||
oldTarget
|
||||
});
|
||||
}
|
||||
if (effect.options.scheduler) {
|
||||
effect.options.scheduler(effect);
|
||||
}
|
||||
else {
|
||||
effect();
|
||||
}
|
||||
};
|
||||
effects.forEach(run);
|
||||
}
|
||||
|
||||
const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
|
||||
.map(key => Symbol[key])
|
||||
.filter(isSymbol));
|
||||
const get = /*#__PURE__*/ createGetter();
|
||||
const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
||||
const readonlyGet = /*#__PURE__*/ createGetter(true);
|
||||
const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
||||
const arrayInstrumentations = {};
|
||||
['includes', 'indexOf', 'lastIndexOf'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
const arr = toRaw(this);
|
||||
for (let i = 0, l = this.length; i < l; i++) {
|
||||
track(arr, "get" /* GET */, i + '');
|
||||
}
|
||||
// we run the method using the original args first (which may be reactive)
|
||||
const res = method.apply(arr, args);
|
||||
if (res === -1 || res === false) {
|
||||
// if that didn't work, run it again using raw values.
|
||||
return method.apply(arr, args.map(toRaw));
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
});
|
||||
['push', 'pop', 'shift', 'unshift', 'splice'].forEach(key => {
|
||||
const method = Array.prototype[key];
|
||||
arrayInstrumentations[key] = function (...args) {
|
||||
pauseTracking();
|
||||
const res = method.apply(this, args);
|
||||
resetTracking();
|
||||
return res;
|
||||
};
|
||||
});
|
||||
function createGetter(isReadonly = false, shallow = false) {
|
||||
return function get(target, key, receiver) {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */ &&
|
||||
receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) {
|
||||
return target;
|
||||
}
|
||||
const targetIsArray = isArray(target);
|
||||
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
||||
return Reflect.get(arrayInstrumentations, key, receiver);
|
||||
}
|
||||
const res = Reflect.get(target, key, receiver);
|
||||
if (isSymbol(key)
|
||||
? builtInSymbols.has(key)
|
||||
: key === `__proto__` || key === `__v_isRef`) {
|
||||
return res;
|
||||
}
|
||||
if (!isReadonly) {
|
||||
track(target, "get" /* GET */, key);
|
||||
}
|
||||
if (shallow) {
|
||||
return res;
|
||||
}
|
||||
if (isRef(res)) {
|
||||
// ref unwrapping - does not apply for Array + integer key.
|
||||
const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
|
||||
return shouldUnwrap ? res.value : res;
|
||||
}
|
||||
if (isObject(res)) {
|
||||
// Convert returned value into a proxy as well. we do the isObject check
|
||||
// here to avoid invalid value warning. Also need to lazy access readonly
|
||||
// and reactive here to avoid circular dependency.
|
||||
return isReadonly ? readonly(res) : reactive(res);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
}
|
||||
const set = /*#__PURE__*/ createSetter();
|
||||
const shallowSet = /*#__PURE__*/ createSetter(true);
|
||||
function createSetter(shallow = false) {
|
||||
return function set(target, key, value, receiver) {
|
||||
const oldValue = target[key];
|
||||
if (!shallow) {
|
||||
value = toRaw(value);
|
||||
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const hadKey = isArray(target) && isIntegerKey(key)
|
||||
? Number(key) < target.length
|
||||
: hasOwn(target, key);
|
||||
const result = Reflect.set(target, key, value, receiver);
|
||||
// don't trigger if target is something up in the prototype chain of original
|
||||
if (target === toRaw(receiver)) {
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
function deleteProperty(target, key) {
|
||||
const hadKey = hasOwn(target, key);
|
||||
const oldValue = target[key];
|
||||
const result = Reflect.deleteProperty(target, key);
|
||||
if (result && hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function has(target, key) {
|
||||
const result = Reflect.has(target, key);
|
||||
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
||||
track(target, "has" /* HAS */, key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function ownKeys(target) {
|
||||
track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
const mutableHandlers = {
|
||||
get,
|
||||
set,
|
||||
deleteProperty,
|
||||
has,
|
||||
ownKeys
|
||||
};
|
||||
const readonlyHandlers = {
|
||||
get: readonlyGet,
|
||||
set(target, key) {
|
||||
{
|
||||
console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
deleteProperty(target, key) {
|
||||
{
|
||||
console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const shallowReactiveHandlers = extend({}, mutableHandlers, {
|
||||
get: shallowGet,
|
||||
set: shallowSet
|
||||
});
|
||||
// Props handlers are special in the sense that it should not unwrap top-level
|
||||
// refs (in order to allow refs to be explicitly passed down), but should
|
||||
// retain the reactivity of the normal readonly object.
|
||||
const shallowReadonlyHandlers = extend({}, readonlyHandlers, {
|
||||
get: shallowReadonlyGet
|
||||
});
|
||||
|
||||
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
||||
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
||||
const toShallow = (value) => value;
|
||||
const getProto = (v) => Reflect.getPrototypeOf(v);
|
||||
function get$1(target, key, isReadonly = false, isShallow = false) {
|
||||
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
||||
// of the value
|
||||
target = target["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "get" /* GET */, rawKey);
|
||||
const { has } = getProto(rawTarget);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
if (has.call(rawTarget, key)) {
|
||||
return wrap(target.get(key));
|
||||
}
|
||||
else if (has.call(rawTarget, rawKey)) {
|
||||
return wrap(target.get(rawKey));
|
||||
}
|
||||
}
|
||||
function has$1(key, isReadonly = false) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const rawKey = toRaw(key);
|
||||
if (key !== rawKey) {
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, key);
|
||||
}
|
||||
!isReadonly && track(rawTarget, "has" /* HAS */, rawKey);
|
||||
return key === rawKey
|
||||
? target.has(key)
|
||||
: target.has(key) || target.has(rawKey);
|
||||
}
|
||||
function size(target, isReadonly = false) {
|
||||
target = target["__v_raw" /* RAW */];
|
||||
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return Reflect.get(target, 'size', target);
|
||||
}
|
||||
function add(value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const proto = getProto(target);
|
||||
const hadKey = proto.has.call(target, value);
|
||||
const result = target.add(value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, value, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function set$1(key, value) {
|
||||
value = toRaw(value);
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get.call(target, key);
|
||||
const result = target.set(key, value);
|
||||
if (!hadKey) {
|
||||
trigger(target, "add" /* ADD */, key, value);
|
||||
}
|
||||
else if (hasChanged(value, oldValue)) {
|
||||
trigger(target, "set" /* SET */, key, value, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function deleteEntry(key) {
|
||||
const target = toRaw(this);
|
||||
const { has, get } = getProto(target);
|
||||
let hadKey = has.call(target, key);
|
||||
if (!hadKey) {
|
||||
key = toRaw(key);
|
||||
hadKey = has.call(target, key);
|
||||
}
|
||||
else {
|
||||
checkIdentityKeys(target, has, key);
|
||||
}
|
||||
const oldValue = get ? get.call(target, key) : undefined;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.delete(key);
|
||||
if (hadKey) {
|
||||
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function clear() {
|
||||
const target = toRaw(this);
|
||||
const hadItems = target.size !== 0;
|
||||
const oldTarget = isMap(target)
|
||||
? new Map(target)
|
||||
: new Set(target)
|
||||
;
|
||||
// forward the operation before queueing reactions
|
||||
const result = target.clear();
|
||||
if (hadItems) {
|
||||
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function createForEach(isReadonly, isShallow) {
|
||||
return function forEach(callback, thisArg) {
|
||||
const observed = this;
|
||||
const target = observed["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
||||
return target.forEach((value, key) => {
|
||||
// important: make sure the callback is
|
||||
// 1. invoked with the reactive map as `this` and 3rd arg
|
||||
// 2. the value received should be a corresponding reactive/readonly.
|
||||
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
||||
});
|
||||
};
|
||||
}
|
||||
function createIterableMethod(method, isReadonly, isShallow) {
|
||||
return function (...args) {
|
||||
const target = this["__v_raw" /* RAW */];
|
||||
const rawTarget = toRaw(target);
|
||||
const targetIsMap = isMap(rawTarget);
|
||||
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
||||
const isKeyOnly = method === 'keys' && targetIsMap;
|
||||
const innerIterator = target[method](...args);
|
||||
const wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive;
|
||||
!isReadonly &&
|
||||
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
||||
// return a wrapped iterator which returns observed versions of the
|
||||
// values emitted from the real iterator
|
||||
return {
|
||||
// iterator protocol
|
||||
next() {
|
||||
const { value, done } = innerIterator.next();
|
||||
return done
|
||||
? { value, done }
|
||||
: {
|
||||
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
||||
done
|
||||
};
|
||||
},
|
||||
// iterable protocol
|
||||
[Symbol.iterator]() {
|
||||
return this;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function createReadonlyMethod(type) {
|
||||
return function (...args) {
|
||||
{
|
||||
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
||||
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
||||
}
|
||||
return type === "delete" /* DELETE */ ? false : this;
|
||||
};
|
||||
}
|
||||
const mutableInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, false)
|
||||
};
|
||||
const shallowInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, false, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this);
|
||||
},
|
||||
has: has$1,
|
||||
add,
|
||||
set: set$1,
|
||||
delete: deleteEntry,
|
||||
clear,
|
||||
forEach: createForEach(false, true)
|
||||
};
|
||||
const readonlyInstrumentations = {
|
||||
get(key) {
|
||||
return get$1(this, key, true);
|
||||
},
|
||||
get size() {
|
||||
return size(this, true);
|
||||
},
|
||||
has(key) {
|
||||
return has$1.call(this, key, true);
|
||||
},
|
||||
add: createReadonlyMethod("add" /* ADD */),
|
||||
set: createReadonlyMethod("set" /* SET */),
|
||||
delete: createReadonlyMethod("delete" /* DELETE */),
|
||||
clear: createReadonlyMethod("clear" /* CLEAR */),
|
||||
forEach: createForEach(true, false)
|
||||
};
|
||||
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
||||
iteratorMethods.forEach(method => {
|
||||
mutableInstrumentations[method] = createIterableMethod(method, false, false);
|
||||
readonlyInstrumentations[method] = createIterableMethod(method, true, false);
|
||||
shallowInstrumentations[method] = createIterableMethod(method, false, true);
|
||||
});
|
||||
function createInstrumentationGetter(isReadonly, shallow) {
|
||||
const instrumentations = shallow
|
||||
? shallowInstrumentations
|
||||
: isReadonly
|
||||
? readonlyInstrumentations
|
||||
: mutableInstrumentations;
|
||||
return (target, key, receiver) => {
|
||||
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
||||
return !isReadonly;
|
||||
}
|
||||
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
||||
return isReadonly;
|
||||
}
|
||||
else if (key === "__v_raw" /* RAW */) {
|
||||
return target;
|
||||
}
|
||||
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
||||
? instrumentations
|
||||
: target, key, receiver);
|
||||
};
|
||||
}
|
||||
const mutableCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, false)
|
||||
};
|
||||
const shallowCollectionHandlers = {
|
||||
get: createInstrumentationGetter(false, true)
|
||||
};
|
||||
const readonlyCollectionHandlers = {
|
||||
get: createInstrumentationGetter(true, false)
|
||||
};
|
||||
function checkIdentityKeys(target, has, key) {
|
||||
const rawKey = toRaw(key);
|
||||
if (rawKey !== key && has.call(target, rawKey)) {
|
||||
const type = toRawType(target);
|
||||
console.warn(`Reactive ${type} contains both the raw and reactive ` +
|
||||
`versions of the same object${type === `Map` ? ` as keys` : ``}, ` +
|
||||
`which can lead to inconsistencies. ` +
|
||||
`Avoid differentiating between the raw and reactive versions ` +
|
||||
`of an object and only use the reactive version if possible.`);
|
||||
}
|
||||
}
|
||||
|
||||
const reactiveMap = new WeakMap();
|
||||
const readonlyMap = new WeakMap();
|
||||
function targetTypeMap(rawType) {
|
||||
switch (rawType) {
|
||||
case 'Object':
|
||||
case 'Array':
|
||||
return 1 /* COMMON */;
|
||||
case 'Map':
|
||||
case 'Set':
|
||||
case 'WeakMap':
|
||||
case 'WeakSet':
|
||||
return 2 /* COLLECTION */;
|
||||
default:
|
||||
return 0 /* INVALID */;
|
||||
}
|
||||
}
|
||||
function getTargetType(value) {
|
||||
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
||||
? 0 /* INVALID */
|
||||
: targetTypeMap(toRawType(value));
|
||||
}
|
||||
function reactive(target) {
|
||||
// if trying to observe a readonly proxy, return the readonly version.
|
||||
if (target && target["__v_isReadonly" /* IS_READONLY */]) {
|
||||
return target;
|
||||
}
|
||||
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are reactive, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
function shallowReactive(target) {
|
||||
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers);
|
||||
}
|
||||
function readonly(target) {
|
||||
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
// Return a reactive-copy of the original object, where only the root level
|
||||
// properties are readonly, and does NOT unwrap refs nor recursively convert
|
||||
// returned properties.
|
||||
// This is used for creating the props proxy object for stateful components.
|
||||
function shallowReadonly(target) {
|
||||
return createReactiveObject(target, true, shallowReadonlyHandlers, readonlyCollectionHandlers);
|
||||
}
|
||||
function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) {
|
||||
if (!isObject(target)) {
|
||||
{
|
||||
console.warn(`value cannot be made reactive: ${String(target)}`);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
// target is already a Proxy, return it.
|
||||
// exception: calling readonly() on a reactive object
|
||||
if (target["__v_raw" /* RAW */] &&
|
||||
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
||||
return target;
|
||||
}
|
||||
// target already has corresponding Proxy
|
||||
const proxyMap = isReadonly ? readonlyMap : reactiveMap;
|
||||
const existingProxy = proxyMap.get(target);
|
||||
if (existingProxy) {
|
||||
return existingProxy;
|
||||
}
|
||||
// only a whitelist of value types can be observed.
|
||||
const targetType = getTargetType(target);
|
||||
if (targetType === 0 /* INVALID */) {
|
||||
return target;
|
||||
}
|
||||
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
||||
proxyMap.set(target, proxy);
|
||||
return proxy;
|
||||
}
|
||||
function isReactive(value) {
|
||||
if (isReadonly(value)) {
|
||||
return isReactive(value["__v_raw" /* RAW */]);
|
||||
}
|
||||
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
||||
}
|
||||
function isReadonly(value) {
|
||||
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
||||
}
|
||||
function isProxy(value) {
|
||||
return isReactive(value) || isReadonly(value);
|
||||
}
|
||||
function toRaw(observed) {
|
||||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
|
||||
}
|
||||
function markRaw(value) {
|
||||
def(value, "__v_skip" /* SKIP */, true);
|
||||
return value;
|
||||
}
|
||||
|
||||
const convert = (val) => isObject(val) ? reactive(val) : val;
|
||||
function isRef(r) {
|
||||
return Boolean(r && r.__v_isRef === true);
|
||||
}
|
||||
function ref(value) {
|
||||
return createRef(value);
|
||||
}
|
||||
function shallowRef(value) {
|
||||
return createRef(value, true);
|
||||
}
|
||||
class RefImpl {
|
||||
constructor(_rawValue, _shallow = false) {
|
||||
this._rawValue = _rawValue;
|
||||
this._shallow = _shallow;
|
||||
this.__v_isRef = true;
|
||||
this._value = _shallow ? _rawValue : convert(_rawValue);
|
||||
}
|
||||
get value() {
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newVal) {
|
||||
if (hasChanged(toRaw(newVal), this._rawValue)) {
|
||||
this._rawValue = newVal;
|
||||
this._value = this._shallow ? newVal : convert(newVal);
|
||||
trigger(toRaw(this), "set" /* SET */, 'value', newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef(rawValue, shallow = false) {
|
||||
if (isRef(rawValue)) {
|
||||
return rawValue;
|
||||
}
|
||||
return new RefImpl(rawValue, shallow);
|
||||
}
|
||||
function triggerRef(ref) {
|
||||
trigger(toRaw(ref), "set" /* SET */, 'value', ref.value );
|
||||
}
|
||||
function unref(ref) {
|
||||
return isRef(ref) ? ref.value : ref;
|
||||
}
|
||||
const shallowUnwrapHandlers = {
|
||||
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
||||
set: (target, key, value, receiver) => {
|
||||
const oldValue = target[key];
|
||||
if (isRef(oldValue) && !isRef(value)) {
|
||||
oldValue.value = value;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return Reflect.set(target, key, value, receiver);
|
||||
}
|
||||
}
|
||||
};
|
||||
function proxyRefs(objectWithRefs) {
|
||||
return isReactive(objectWithRefs)
|
||||
? objectWithRefs
|
||||
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
||||
}
|
||||
class CustomRefImpl {
|
||||
constructor(factory) {
|
||||
this.__v_isRef = true;
|
||||
const { get, set } = factory(() => track(this, "get" /* GET */, 'value'), () => trigger(this, "set" /* SET */, 'value'));
|
||||
this._get = get;
|
||||
this._set = set;
|
||||
}
|
||||
get value() {
|
||||
return this._get();
|
||||
}
|
||||
set value(newVal) {
|
||||
this._set(newVal);
|
||||
}
|
||||
}
|
||||
function customRef(factory) {
|
||||
return new CustomRefImpl(factory);
|
||||
}
|
||||
function toRefs(object) {
|
||||
if ( !isProxy(object)) {
|
||||
console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
||||
}
|
||||
const ret = isArray(object) ? new Array(object.length) : {};
|
||||
for (const key in object) {
|
||||
ret[key] = toRef(object, key);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
class ObjectRefImpl {
|
||||
constructor(_object, _key) {
|
||||
this._object = _object;
|
||||
this._key = _key;
|
||||
this.__v_isRef = true;
|
||||
}
|
||||
get value() {
|
||||
return this._object[this._key];
|
||||
}
|
||||
set value(newVal) {
|
||||
this._object[this._key] = newVal;
|
||||
}
|
||||
}
|
||||
function toRef(object, key) {
|
||||
return isRef(object[key])
|
||||
? object[key]
|
||||
: new ObjectRefImpl(object, key);
|
||||
}
|
||||
|
||||
class ComputedRefImpl {
|
||||
constructor(getter, _setter, isReadonly) {
|
||||
this._setter = _setter;
|
||||
this._dirty = true;
|
||||
this.__v_isRef = true;
|
||||
this.effect = effect(getter, {
|
||||
lazy: true,
|
||||
scheduler: () => {
|
||||
if (!this._dirty) {
|
||||
this._dirty = true;
|
||||
trigger(toRaw(this), "set" /* SET */, 'value');
|
||||
}
|
||||
}
|
||||
});
|
||||
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
||||
}
|
||||
get value() {
|
||||
if (this._dirty) {
|
||||
this._value = this.effect();
|
||||
this._dirty = false;
|
||||
}
|
||||
track(toRaw(this), "get" /* GET */, 'value');
|
||||
return this._value;
|
||||
}
|
||||
set value(newValue) {
|
||||
this._setter(newValue);
|
||||
}
|
||||
}
|
||||
function computed(getterOrOptions) {
|
||||
let getter;
|
||||
let setter;
|
||||
if (isFunction(getterOrOptions)) {
|
||||
getter = getterOrOptions;
|
||||
setter = () => {
|
||||
console.warn('Write operation failed: computed value is readonly');
|
||||
}
|
||||
;
|
||||
}
|
||||
else {
|
||||
getter = getterOrOptions.get;
|
||||
setter = getterOrOptions.set;
|
||||
}
|
||||
return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set);
|
||||
}
|
||||
|
||||
exports.ITERATE_KEY = ITERATE_KEY;
|
||||
exports.computed = computed;
|
||||
exports.customRef = customRef;
|
||||
exports.effect = effect;
|
||||
exports.enableTracking = enableTracking;
|
||||
exports.isProxy = isProxy;
|
||||
exports.isReactive = isReactive;
|
||||
exports.isReadonly = isReadonly;
|
||||
exports.isRef = isRef;
|
||||
exports.markRaw = markRaw;
|
||||
exports.pauseTracking = pauseTracking;
|
||||
exports.proxyRefs = proxyRefs;
|
||||
exports.reactive = reactive;
|
||||
exports.readonly = readonly;
|
||||
exports.ref = ref;
|
||||
exports.resetTracking = resetTracking;
|
||||
exports.shallowReactive = shallowReactive;
|
||||
exports.shallowReadonly = shallowReadonly;
|
||||
exports.shallowRef = shallowRef;
|
||||
exports.stop = stop;
|
||||
exports.toRaw = toRaw;
|
||||
exports.toRef = toRef;
|
||||
exports.toRefs = toRefs;
|
||||
exports.track = track;
|
||||
exports.trigger = trigger;
|
||||
exports.triggerRef = triggerRef;
|
||||
exports.unref = unref;
|
||||
|
||||
return exports;
|
||||
|
||||
}({}));
|
||||
1
node_modules/@vue/reactivity/dist/reactivity.global.prod.js
generated
vendored
Normal file
1
node_modules/@vue/reactivity/dist/reactivity.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/reactivity/index.js
generated
vendored
Normal file
7
node_modules/@vue/reactivity/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/reactivity.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/reactivity.cjs.js')
|
||||
}
|
||||
73
node_modules/@vue/reactivity/package.json
generated
vendored
Normal file
73
node_modules/@vue/reactivity/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/reactivity@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/reactivity@3.0.2",
|
||||
"_id": "@vue/reactivity@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Qu1a9gJbSUpeabBRafzd8E7r/nc=",
|
||||
"_location": "/@vue/reactivity",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/reactivity@3.0.2",
|
||||
"name": "@vue/reactivity",
|
||||
"escapedName": "@vue%2freactivity",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/runtime-core"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2freactivity/-/reactivity-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueReactivity",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.0.2"
|
||||
},
|
||||
"description": "@vue/reactivity",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/reactivity#readme",
|
||||
"jsdelivr": "dist/reactivity.global.js",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "dist/reactivity.esm-bundler.js",
|
||||
"name": "@vue/reactivity",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/reactivity"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"types": "dist/reactivity.d.ts",
|
||||
"unpkg": "dist/reactivity.global.js",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
21
node_modules/@vue/runtime-core/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/runtime-core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
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.
|
||||
28
node_modules/@vue/runtime-core/README.md
generated
vendored
Normal file
28
node_modules/@vue/runtime-core/README.md
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# @vue/runtime-core
|
||||
|
||||
> This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
|
||||
|
||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
|
||||
|
||||
## Building a Custom Renderer
|
||||
|
||||
``` ts
|
||||
import { createRenderer } from '@vue/runtime-core'
|
||||
|
||||
const { render, createApp } = createRenderer({
|
||||
patchProp,
|
||||
insert,
|
||||
remove,
|
||||
createElement,
|
||||
// ...
|
||||
})
|
||||
|
||||
// `render` is the low-level API
|
||||
// `createApp` returns an app instance with configurable context shared
|
||||
// by the entire app tree.
|
||||
export { render, createApp }
|
||||
|
||||
export * from '@vue/runtime-core'
|
||||
```
|
||||
|
||||
See `@vue/runtime-dom` for how a DOM-targeting renderer is implemented.
|
||||
6585
node_modules/@vue/runtime-core/dist/runtime-core.cjs.js
generated
vendored
Normal file
6585
node_modules/@vue/runtime-core/dist/runtime-core.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5538
node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js
generated
vendored
Normal file
5538
node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1382
node_modules/@vue/runtime-core/dist/runtime-core.d.ts
generated
vendored
Normal file
1382
node_modules/@vue/runtime-core/dist/runtime-core.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6855
node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
generated
vendored
Normal file
6855
node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
node_modules/@vue/runtime-core/index.js
generated
vendored
Normal file
7
node_modules/@vue/runtime-core/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/runtime-core.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/runtime-core.cjs.js')
|
||||
}
|
||||
70
node_modules/@vue/runtime-core/package.json
generated
vendored
Normal file
70
node_modules/@vue/runtime-core/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/runtime-core@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/runtime-core@3.0.2",
|
||||
"_id": "@vue/runtime-core@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-1+1GKvHLC/mDZmjk5vqz8vSxvAA=",
|
||||
"_location": "/@vue/runtime-core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/runtime-core@3.0.2",
|
||||
"name": "@vue/runtime-core",
|
||||
"escapedName": "@vue%2fruntime-core",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/runtime-dom"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fruntime-core/-/runtime-core-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeCore",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "3.0.2",
|
||||
"@vue/shared": "3.0.2"
|
||||
},
|
||||
"description": "@vue/runtime-core",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-core#readme",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-core.esm-bundler.js",
|
||||
"name": "@vue/runtime-core",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/runtime-core"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"types": "dist/runtime-core.d.ts",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
21
node_modules/@vue/runtime-dom/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/runtime-dom/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
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.
|
||||
13
node_modules/@vue/runtime-dom/README.md
generated
vendored
Normal file
13
node_modules/@vue/runtime-dom/README.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# @vue/runtime-dom
|
||||
|
||||
``` js
|
||||
import { h, createApp } from '@vue/runtime-dom'
|
||||
|
||||
const RootComponent = {
|
||||
render() {
|
||||
return h('div', 'hello world')
|
||||
}
|
||||
}
|
||||
|
||||
createApp(RootComponent).mount('#app')
|
||||
```
|
||||
1299
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js
generated
vendored
Normal file
1299
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1255
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js
generated
vendored
Normal file
1255
node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1452
node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts
generated
vendored
Normal file
1452
node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9146
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.js
generated
vendored
Normal file
9146
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js
generated
vendored
Normal file
1
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1248
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
generated
vendored
Normal file
1248
node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9241
node_modules/@vue/runtime-dom/dist/runtime-dom.global.js
generated
vendored
Normal file
9241
node_modules/@vue/runtime-dom/dist/runtime-dom.global.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js
generated
vendored
Normal file
1
node_modules/@vue/runtime-dom/dist/runtime-dom.global.prod.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@vue/runtime-dom/index.js
generated
vendored
Normal file
7
node_modules/@vue/runtime-dom/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/runtime-dom.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/runtime-dom.cjs.js')
|
||||
}
|
||||
74
node_modules/@vue/runtime-dom/package.json
generated
vendored
Normal file
74
node_modules/@vue/runtime-dom/package.json
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/runtime-dom@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/runtime-dom@3.0.2",
|
||||
"_id": "@vue/runtime-dom@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-nRZtAyJVWAJdPYD1A5tkbgBRtxw=",
|
||||
"_location": "/@vue/runtime-dom",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/runtime-dom@3.0.2",
|
||||
"name": "@vue/runtime-dom",
|
||||
"escapedName": "@vue%2fruntime-dom",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/vue"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fruntime-dom/-/runtime-dom-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"name": "VueRuntimeDOM",
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"esm-browser",
|
||||
"cjs",
|
||||
"global"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/runtime-core": "3.0.2",
|
||||
"@vue/shared": "3.0.2",
|
||||
"csstype": "^2.6.8"
|
||||
},
|
||||
"description": "@vue/runtime-dom",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/runtime-dom#readme",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "dist/runtime-dom.esm-bundler.js",
|
||||
"name": "@vue/runtime-dom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/runtime-dom"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"types": "dist/runtime-dom.d.ts",
|
||||
"unpkg": "dist/runtime-dom.global.js",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
21
node_modules/@vue/server-renderer/LICENSE
generated
vendored
Normal file
21
node_modules/@vue/server-renderer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018-present, Yuxi (Evan) You
|
||||
|
||||
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.
|
||||
16
node_modules/@vue/server-renderer/README.md
generated
vendored
Normal file
16
node_modules/@vue/server-renderer/README.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# @vue/server-renderer
|
||||
|
||||
``` js
|
||||
const { createSSRApp } = require('vue')
|
||||
const { renderToString } = require('@vue/server-renderer')
|
||||
|
||||
const app = createSSRApp({
|
||||
data: () => ({ msg: 'hello' }),
|
||||
template: `<div>{{ msg }}</div>`
|
||||
})
|
||||
|
||||
;(async () => {
|
||||
const html = await renderToString(app)
|
||||
console.log(html)
|
||||
})()
|
||||
```
|
||||
835
node_modules/@vue/server-renderer/dist/server-renderer.cjs.js
generated
vendored
Normal file
835
node_modules/@vue/server-renderer/dist/server-renderer.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,835 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var vue = require('vue');
|
||||
var shared = require('@vue/shared');
|
||||
var compilerSsr = require('@vue/compiler-ssr');
|
||||
var stream = require('stream');
|
||||
|
||||
// leading comma for empty string ""
|
||||
const shouldIgnoreProp = shared.makeMap(`,key,ref,innerHTML,textContent`);
|
||||
function ssrRenderAttrs(props, tag) {
|
||||
let ret = '';
|
||||
for (const key in props) {
|
||||
if (shouldIgnoreProp(key) ||
|
||||
shared.isOn(key) ||
|
||||
(tag === 'textarea' && key === 'value')) {
|
||||
continue;
|
||||
}
|
||||
const value = props[key];
|
||||
if (key === 'class') {
|
||||
ret += ` class="${ssrRenderClass(value)}"`;
|
||||
}
|
||||
else if (key === 'style') {
|
||||
ret += ` style="${ssrRenderStyle(value)}"`;
|
||||
}
|
||||
else {
|
||||
ret += ssrRenderDynamicAttr(key, value, tag);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
// render an attr with dynamic (unknown) key.
|
||||
function ssrRenderDynamicAttr(key, value, tag) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
const attrKey = tag && tag.indexOf('-') > 0
|
||||
? key // preserve raw name on custom elements
|
||||
: shared.propsToAttrMap[key] || key.toLowerCase();
|
||||
if (shared.isBooleanAttr(attrKey)) {
|
||||
return value === false ? `` : ` ${attrKey}`;
|
||||
}
|
||||
else if (shared.isSSRSafeAttrName(attrKey)) {
|
||||
return value === '' ? ` ${attrKey}` : ` ${attrKey}="${shared.escapeHtml(value)}"`;
|
||||
}
|
||||
else {
|
||||
console.warn(`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`);
|
||||
return ``;
|
||||
}
|
||||
}
|
||||
// Render a v-bind attr with static key. The key is pre-processed at compile
|
||||
// time and we only need to check and escape value.
|
||||
function ssrRenderAttr(key, value) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
return ` ${key}="${shared.escapeHtml(value)}"`;
|
||||
}
|
||||
function isRenderableValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === 'string' || type === 'number' || type === 'boolean';
|
||||
}
|
||||
function ssrRenderClass(raw) {
|
||||
return shared.escapeHtml(shared.normalizeClass(raw));
|
||||
}
|
||||
function ssrRenderStyle(raw) {
|
||||
if (!raw) {
|
||||
return '';
|
||||
}
|
||||
if (shared.isString(raw)) {
|
||||
return shared.escapeHtml(raw);
|
||||
}
|
||||
const styles = shared.normalizeStyle(raw);
|
||||
return shared.escapeHtml(shared.stringifyStyle(styles));
|
||||
}
|
||||
|
||||
const compileCache = Object.create(null);
|
||||
function ssrCompile(template, instance) {
|
||||
const cached = compileCache[template];
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const { code } = compilerSsr.compile(template, {
|
||||
isCustomElement: instance.appContext.config.isCustomElement || shared.NO,
|
||||
isNativeTag: instance.appContext.config.isNativeTag || shared.NO,
|
||||
onError(err) {
|
||||
{
|
||||
const message = `[@vue/server-renderer] Template compilation error: ${err.message}`;
|
||||
const codeFrame = err.loc &&
|
||||
shared.generateCodeFrame(template, err.loc.start.offset, err.loc.end.offset);
|
||||
vue.warn(codeFrame ? `${message}\n${codeFrame}` : message);
|
||||
}
|
||||
}
|
||||
});
|
||||
return (compileCache[template] = Function('require', code)(require));
|
||||
}
|
||||
|
||||
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
||||
parentPush('<!--teleport start-->');
|
||||
let teleportContent;
|
||||
if (disabled) {
|
||||
contentRenderFn(parentPush);
|
||||
teleportContent = `<!---->`;
|
||||
}
|
||||
else {
|
||||
const { getBuffer, push } = createBuffer();
|
||||
contentRenderFn(push);
|
||||
push(`<!---->`); // teleport end anchor
|
||||
teleportContent = getBuffer();
|
||||
}
|
||||
const context = parentComponent.appContext.provides[vue.ssrContextKey];
|
||||
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
||||
if (teleportBuffers[target]) {
|
||||
teleportBuffers[target].push(teleportContent);
|
||||
}
|
||||
else {
|
||||
teleportBuffers[target] = [teleportContent];
|
||||
}
|
||||
parentPush('<!--teleport end-->');
|
||||
}
|
||||
|
||||
const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode } = vue.ssrUtils;
|
||||
// Each component has a buffer array.
|
||||
// A buffer array can contain one of the following:
|
||||
// - plain string
|
||||
// - A resolved buffer (recursive arrays of strings that can be unrolled
|
||||
// synchronously)
|
||||
// - An async buffer (a Promise that resolves to a resolved buffer)
|
||||
function createBuffer() {
|
||||
let appendable = false;
|
||||
const buffer = [];
|
||||
return {
|
||||
getBuffer() {
|
||||
// Return static buffer and await on items during unroll stage
|
||||
return buffer;
|
||||
},
|
||||
push(item) {
|
||||
const isStringItem = shared.isString(item);
|
||||
if (appendable && isStringItem) {
|
||||
buffer[buffer.length - 1] += item;
|
||||
}
|
||||
else {
|
||||
buffer.push(item);
|
||||
}
|
||||
appendable = isStringItem;
|
||||
if (shared.isPromise(item) || (shared.isArray(item) && item.hasAsync)) {
|
||||
// promise, or child buffer with async, mark as async.
|
||||
// this allows skipping unnecessary await ticks during unroll stage
|
||||
buffer.hasAsync = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function renderComponentVNode(vnode, parentComponent = null) {
|
||||
const instance = createComponentInstance(vnode, parentComponent, null);
|
||||
const res = setupComponent(instance, true /* isSSR */);
|
||||
const hasAsyncSetup = shared.isPromise(res);
|
||||
const prefetch = vnode.type.serverPrefetch;
|
||||
if (hasAsyncSetup || prefetch) {
|
||||
let p = hasAsyncSetup
|
||||
? res.catch(err => {
|
||||
vue.warn(`[@vue/server-renderer]: Uncaught error in async setup:\n`, err);
|
||||
})
|
||||
: Promise.resolve();
|
||||
if (prefetch) {
|
||||
p = p.then(() => prefetch.call(instance.proxy)).catch(err => {
|
||||
vue.warn(`[@vue/server-renderer]: Uncaught error in serverPrefetch:\n`, err);
|
||||
});
|
||||
}
|
||||
return p.then(() => renderComponentSubTree(instance));
|
||||
}
|
||||
else {
|
||||
return renderComponentSubTree(instance);
|
||||
}
|
||||
}
|
||||
function renderComponentSubTree(instance) {
|
||||
const comp = instance.type;
|
||||
const { getBuffer, push } = createBuffer();
|
||||
if (shared.isFunction(comp)) {
|
||||
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance);
|
||||
}
|
||||
else {
|
||||
if (!instance.render && !comp.ssrRender && shared.isString(comp.template)) {
|
||||
comp.ssrRender = ssrCompile(comp.template, instance);
|
||||
}
|
||||
if (comp.ssrRender) {
|
||||
// optimized
|
||||
// resolve fallthrough attrs
|
||||
let attrs = instance.type.inheritAttrs !== false ? instance.attrs : undefined;
|
||||
// inherited scopeId
|
||||
const scopeId = instance.vnode.scopeId;
|
||||
const treeOwnerId = instance.parent && instance.parent.type.__scopeId;
|
||||
const slotScopeId = treeOwnerId && treeOwnerId !== scopeId ? treeOwnerId + '-s' : null;
|
||||
if (scopeId || slotScopeId) {
|
||||
attrs = { ...attrs };
|
||||
if (scopeId)
|
||||
attrs[scopeId] = '';
|
||||
if (slotScopeId)
|
||||
attrs[slotScopeId] = '';
|
||||
}
|
||||
// set current rendering instance for asset resolution
|
||||
setCurrentRenderingInstance(instance);
|
||||
comp.ssrRender(instance.proxy, push, instance, attrs,
|
||||
// compiler-optimized bindings
|
||||
instance.props, instance.setupState, instance.data, instance.ctx);
|
||||
setCurrentRenderingInstance(null);
|
||||
}
|
||||
else if (instance.render) {
|
||||
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance);
|
||||
}
|
||||
else {
|
||||
vue.warn(`Component ${comp.name ? `${comp.name} ` : ``} is missing template or render function.`);
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
return getBuffer();
|
||||
}
|
||||
function renderVNode(push, vnode, parentComponent) {
|
||||
const { type, shapeFlag, children } = vnode;
|
||||
switch (type) {
|
||||
case vue.Text:
|
||||
push(shared.escapeHtml(children));
|
||||
break;
|
||||
case vue.Comment:
|
||||
push(children ? `<!--${shared.escapeHtmlComment(children)}-->` : `<!---->`);
|
||||
break;
|
||||
case vue.Static:
|
||||
push(children);
|
||||
break;
|
||||
case vue.Fragment:
|
||||
push(`<!--[-->`); // open
|
||||
renderVNodeChildren(push, children, parentComponent);
|
||||
push(`<!--]-->`); // close
|
||||
break;
|
||||
default:
|
||||
if (shapeFlag & 1 /* ELEMENT */) {
|
||||
renderElementVNode(push, vnode, parentComponent);
|
||||
}
|
||||
else if (shapeFlag & 6 /* COMPONENT */) {
|
||||
push(renderComponentVNode(vnode, parentComponent));
|
||||
}
|
||||
else if (shapeFlag & 64 /* TELEPORT */) {
|
||||
renderTeleportVNode(push, vnode, parentComponent);
|
||||
}
|
||||
else if (shapeFlag & 128 /* SUSPENSE */) {
|
||||
renderVNode(push, vnode.ssContent, parentComponent);
|
||||
}
|
||||
else {
|
||||
vue.warn('[@vue/server-renderer] Invalid VNode type:', type, `(${typeof type})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderVNodeChildren(push, children, parentComponent) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
renderVNode(push, normalizeVNode(children[i]), parentComponent);
|
||||
}
|
||||
}
|
||||
function renderElementVNode(push, vnode, parentComponent) {
|
||||
const tag = vnode.type;
|
||||
let { props, children, shapeFlag, scopeId, dirs } = vnode;
|
||||
let openTag = `<${tag}`;
|
||||
if (dirs) {
|
||||
props = applySSRDirectives(vnode, props, dirs);
|
||||
}
|
||||
if (props) {
|
||||
openTag += ssrRenderAttrs(props, tag);
|
||||
}
|
||||
openTag += resolveScopeId(scopeId, vnode, parentComponent);
|
||||
push(openTag + `>`);
|
||||
if (!shared.isVoidTag(tag)) {
|
||||
let hasChildrenOverride = false;
|
||||
if (props) {
|
||||
if (props.innerHTML) {
|
||||
hasChildrenOverride = true;
|
||||
push(props.innerHTML);
|
||||
}
|
||||
else if (props.textContent) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.textContent));
|
||||
}
|
||||
else if (tag === 'textarea' && props.value) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.value));
|
||||
}
|
||||
}
|
||||
if (!hasChildrenOverride) {
|
||||
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
||||
push(shared.escapeHtml(children));
|
||||
}
|
||||
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
||||
renderVNodeChildren(push, children, parentComponent);
|
||||
}
|
||||
}
|
||||
push(`</${tag}>`);
|
||||
}
|
||||
}
|
||||
function resolveScopeId(scopeId, vnode, parentComponent) {
|
||||
let res = ``;
|
||||
if (scopeId) {
|
||||
res = ` ${scopeId}`;
|
||||
}
|
||||
if (parentComponent) {
|
||||
const treeOwnerId = parentComponent.type.__scopeId;
|
||||
// vnode's own scopeId and the current rendering component's scopeId is
|
||||
// different - this is a slot content node.
|
||||
if (treeOwnerId && treeOwnerId !== scopeId) {
|
||||
res += ` ${treeOwnerId}-s`;
|
||||
}
|
||||
if (vnode === parentComponent.subTree) {
|
||||
res += resolveScopeId(parentComponent.vnode.scopeId, parentComponent.vnode, parentComponent.parent);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function applySSRDirectives(vnode, rawProps, dirs) {
|
||||
const toMerge = [];
|
||||
for (let i = 0; i < dirs.length; i++) {
|
||||
const binding = dirs[i];
|
||||
const { dir: { getSSRProps } } = binding;
|
||||
if (getSSRProps) {
|
||||
const props = getSSRProps(binding, vnode);
|
||||
if (props)
|
||||
toMerge.push(props);
|
||||
}
|
||||
}
|
||||
return vue.mergeProps(rawProps || {}, ...toMerge);
|
||||
}
|
||||
function renderTeleportVNode(push, vnode, parentComponent) {
|
||||
const target = vnode.props && vnode.props.to;
|
||||
const disabled = vnode.props && vnode.props.disabled;
|
||||
if (!target) {
|
||||
vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
||||
return [];
|
||||
}
|
||||
if (!shared.isString(target)) {
|
||||
vue.warn(`[@vue/server-renderer] Teleport target must be a query selector string.`);
|
||||
return [];
|
||||
}
|
||||
ssrRenderTeleport(push, push => {
|
||||
renderVNodeChildren(push, vnode.children, parentComponent);
|
||||
}, target, disabled || disabled === '', parentComponent);
|
||||
}
|
||||
|
||||
const { isVNode } = vue.ssrUtils;
|
||||
async function unrollBuffer(buffer) {
|
||||
if (buffer.hasAsync) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
ret += await unrollBuffer(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
return unrollBufferSync(buffer);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync(buffer) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
ret += unrollBufferSync(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
async function renderToString(input, context = {}) {
|
||||
if (isVNode(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToString(vue.createApp({ render: () => input }), context);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(vue.ssrContextKey, context);
|
||||
const buffer = await renderComponentVNode(vnode);
|
||||
await resolveTeleports(context);
|
||||
return unrollBuffer(buffer);
|
||||
}
|
||||
async function resolveTeleports(context) {
|
||||
if (context.__teleportBuffers) {
|
||||
context.teleports = context.teleports || {};
|
||||
for (const key in context.__teleportBuffers) {
|
||||
// note: it's OK to await sequentially here because the Promises were
|
||||
// created eagerly in parallel.
|
||||
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { isVNode: isVNode$1 } = vue.ssrUtils;
|
||||
async function unrollBuffer$1(buffer, stream) {
|
||||
if (buffer.hasAsync) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
await unrollBuffer$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
unrollBufferSync$1(buffer, stream);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync$1(buffer, stream) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
unrollBufferSync$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderToStream(input, context = {}) {
|
||||
if (isVNode$1(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToStream(vue.createApp({ render: () => input }), context);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(vue.ssrContextKey, context);
|
||||
const stream$1 = new stream.Readable();
|
||||
Promise.resolve(renderComponentVNode(vnode))
|
||||
.then(buffer => unrollBuffer$1(buffer, stream$1))
|
||||
.then(() => {
|
||||
stream$1.push(null);
|
||||
})
|
||||
.catch(error => {
|
||||
stream$1.destroy(error);
|
||||
});
|
||||
return stream$1;
|
||||
}
|
||||
|
||||
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null) {
|
||||
return renderComponentVNode(vue.createVNode(comp, props, children), parentComponent);
|
||||
}
|
||||
|
||||
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent) {
|
||||
// template-compiled slots are always rendered as fragments
|
||||
push(`<!--[-->`);
|
||||
const slotFn = slots[slotName];
|
||||
if (slotFn) {
|
||||
const scopeId = parentComponent && parentComponent.type.__scopeId;
|
||||
const ret = slotFn(slotProps, push, parentComponent, scopeId ? ` ${scopeId}-s` : ``);
|
||||
if (Array.isArray(ret)) {
|
||||
// normal slot
|
||||
renderVNodeChildren(push, ret, parentComponent);
|
||||
}
|
||||
}
|
||||
else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
push(`<!--]-->`);
|
||||
}
|
||||
|
||||
function ssrInterpolate(value) {
|
||||
return shared.escapeHtml(shared.toDisplayString(value));
|
||||
}
|
||||
|
||||
function toRaw(observed) {
|
||||
return ((observed && toRaw(observed["__v_raw" /* RAW */])) || observed);
|
||||
}
|
||||
|
||||
function isRef(r) {
|
||||
return Boolean(r && r.__v_isRef === true);
|
||||
}
|
||||
|
||||
const stack = [];
|
||||
function pushWarningContext(vnode) {
|
||||
stack.push(vnode);
|
||||
}
|
||||
function popWarningContext() {
|
||||
stack.pop();
|
||||
}
|
||||
function warn(msg, ...args) {
|
||||
const instance = stack.length ? stack[stack.length - 1].component : null;
|
||||
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
||||
const trace = getComponentTrace();
|
||||
if (appWarnHandler) {
|
||||
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
||||
msg + args.join(''),
|
||||
instance && instance.proxy,
|
||||
trace
|
||||
.map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`)
|
||||
.join('\n'),
|
||||
trace
|
||||
]);
|
||||
}
|
||||
else {
|
||||
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
||||
/* istanbul ignore if */
|
||||
if (trace.length &&
|
||||
// avoid spamming console during tests
|
||||
!false) {
|
||||
warnArgs.push(`\n`, ...formatTrace(trace));
|
||||
}
|
||||
console.warn(...warnArgs);
|
||||
}
|
||||
}
|
||||
function getComponentTrace() {
|
||||
let currentVNode = stack[stack.length - 1];
|
||||
if (!currentVNode) {
|
||||
return [];
|
||||
}
|
||||
// we can't just use the stack because it will be incomplete during updates
|
||||
// that did not start from the root. Re-construct the parent chain using
|
||||
// instance parent pointers.
|
||||
const normalizedStack = [];
|
||||
while (currentVNode) {
|
||||
const last = normalizedStack[0];
|
||||
if (last && last.vnode === currentVNode) {
|
||||
last.recurseCount++;
|
||||
}
|
||||
else {
|
||||
normalizedStack.push({
|
||||
vnode: currentVNode,
|
||||
recurseCount: 0
|
||||
});
|
||||
}
|
||||
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
||||
currentVNode = parentInstance && parentInstance.vnode;
|
||||
}
|
||||
return normalizedStack;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
function formatTrace(trace) {
|
||||
const logs = [];
|
||||
trace.forEach((entry, i) => {
|
||||
logs.push(...(i === 0 ? [] : [`\n`]), ...formatTraceEntry(entry));
|
||||
});
|
||||
return logs;
|
||||
}
|
||||
function formatTraceEntry({ vnode, recurseCount }) {
|
||||
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
||||
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
||||
const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
|
||||
const close = `>` + postfix;
|
||||
return vnode.props
|
||||
? [open, ...formatProps(vnode.props), close]
|
||||
: [open + close];
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
function formatProps(props) {
|
||||
const res = [];
|
||||
const keys = Object.keys(props);
|
||||
keys.slice(0, 3).forEach(key => {
|
||||
res.push(...formatProp(key, props[key]));
|
||||
});
|
||||
if (keys.length > 3) {
|
||||
res.push(` ...`);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
function formatProp(key, value, raw) {
|
||||
if (shared.isString(value)) {
|
||||
value = JSON.stringify(value);
|
||||
return raw ? value : [`${key}=${value}`];
|
||||
}
|
||||
else if (typeof value === 'number' ||
|
||||
typeof value === 'boolean' ||
|
||||
value == null) {
|
||||
return raw ? value : [`${key}=${value}`];
|
||||
}
|
||||
else if (isRef(value)) {
|
||||
value = formatProp(key, toRaw(value.value), true);
|
||||
return raw ? value : [`${key}=Ref<`, value, `>`];
|
||||
}
|
||||
else if (shared.isFunction(value)) {
|
||||
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
||||
}
|
||||
else {
|
||||
value = toRaw(value);
|
||||
return raw ? value : [`${key}=`, value];
|
||||
}
|
||||
}
|
||||
|
||||
const ErrorTypeStrings = {
|
||||
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
||||
["c" /* CREATED */]: 'created hook',
|
||||
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
||||
["m" /* MOUNTED */]: 'mounted hook',
|
||||
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
||||
["u" /* UPDATED */]: 'updated',
|
||||
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
||||
["um" /* UNMOUNTED */]: 'unmounted hook',
|
||||
["a" /* ACTIVATED */]: 'activated hook',
|
||||
["da" /* DEACTIVATED */]: 'deactivated hook',
|
||||
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
||||
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
||||
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
||||
[0 /* SETUP_FUNCTION */]: 'setup function',
|
||||
[1 /* RENDER_FUNCTION */]: 'render function',
|
||||
[2 /* WATCH_GETTER */]: 'watcher getter',
|
||||
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
||||
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
||||
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
||||
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
||||
[7 /* VNODE_HOOK */]: 'vnode hook',
|
||||
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
||||
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
||||
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
||||
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
||||
[12 /* FUNCTION_REF */]: 'ref function',
|
||||
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
||||
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
||||
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
|
||||
};
|
||||
function callWithErrorHandling(fn, instance, type, args) {
|
||||
let res;
|
||||
try {
|
||||
res = args ? fn(...args) : fn();
|
||||
}
|
||||
catch (err) {
|
||||
handleError(err, instance, type);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function handleError(err, instance, type, throwInDev = true) {
|
||||
const contextVNode = instance ? instance.vnode : null;
|
||||
if (instance) {
|
||||
let cur = instance.parent;
|
||||
// the exposed instance is the render proxy to keep it consistent with 2.x
|
||||
const exposedInstance = instance.proxy;
|
||||
// in production the hook receives only the error code
|
||||
const errorInfo = ErrorTypeStrings[type] ;
|
||||
while (cur) {
|
||||
const errorCapturedHooks = cur.ec;
|
||||
if (errorCapturedHooks) {
|
||||
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
||||
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
cur = cur.parent;
|
||||
}
|
||||
// app-level handling
|
||||
const appErrorHandler = instance.appContext.config.errorHandler;
|
||||
if (appErrorHandler) {
|
||||
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
logError(err, type, contextVNode, throwInDev);
|
||||
}
|
||||
function logError(err, type, contextVNode, throwInDev = true) {
|
||||
{
|
||||
const info = ErrorTypeStrings[type];
|
||||
if (contextVNode) {
|
||||
pushWarningContext(contextVNode);
|
||||
}
|
||||
warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
||||
if (contextVNode) {
|
||||
popWarningContext();
|
||||
}
|
||||
// crash in dev by default so it's more noticeable
|
||||
if (throwInDev) {
|
||||
throw err;
|
||||
}
|
||||
else {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const classifyRE = /(?:^|[-_])(\w)/g;
|
||||
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
||||
/* istanbul ignore next */
|
||||
function formatComponentName(instance, Component, isRoot = false) {
|
||||
let name = shared.isFunction(Component)
|
||||
? Component.displayName || Component.name
|
||||
: Component.name;
|
||||
if (!name && Component.__file) {
|
||||
const match = Component.__file.match(/([^/\\]+)\.vue$/);
|
||||
if (match) {
|
||||
name = match[1];
|
||||
}
|
||||
}
|
||||
if (!name && instance && instance.parent) {
|
||||
// try to infer the name based on reverse resolution
|
||||
const inferFromRegistry = (registry) => {
|
||||
for (const key in registry) {
|
||||
if (registry[key] === Component) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
};
|
||||
name =
|
||||
inferFromRegistry(instance.components ||
|
||||
instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
||||
}
|
||||
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
||||
}
|
||||
|
||||
function ssrRenderList(source, renderItem) {
|
||||
if (shared.isArray(source) || shared.isString(source)) {
|
||||
for (let i = 0, l = source.length; i < l; i++) {
|
||||
renderItem(source[i], i);
|
||||
}
|
||||
}
|
||||
else if (typeof source === 'number') {
|
||||
if ( !Number.isInteger(source)) {
|
||||
warn(`The v-for range expect an integer value but got ${source}.`);
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < source; i++) {
|
||||
renderItem(i + 1, i);
|
||||
}
|
||||
}
|
||||
else if (shared.isObject(source)) {
|
||||
if (source[Symbol.iterator]) {
|
||||
const arr = Array.from(source);
|
||||
for (let i = 0, l = arr.length; i < l; i++) {
|
||||
renderItem(arr[i], i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const keys = Object.keys(source);
|
||||
for (let i = 0, l = keys.length; i < l; i++) {
|
||||
const key = keys[i];
|
||||
renderItem(source[key], key, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function ssrRenderSuspense(push, { default: renderContent }) {
|
||||
if (renderContent) {
|
||||
renderContent();
|
||||
}
|
||||
else {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
|
||||
function ssrResolveCssVars(source, scopeId) {
|
||||
const style = {};
|
||||
const prefix = scopeId ? `${scopeId.replace(/^data-v-/, '')}-` : ``;
|
||||
for (const key in source) {
|
||||
style[`--${prefix}${key}`] = source[key];
|
||||
}
|
||||
return { style };
|
||||
}
|
||||
|
||||
const ssrLooseEqual = shared.looseEqual;
|
||||
function ssrLooseContain(arr, value) {
|
||||
return shared.looseIndexOf(arr, value) > -1;
|
||||
}
|
||||
// for <input :type="type" v-model="model" value="value">
|
||||
function ssrRenderDynamicModel(type, model, value) {
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return shared.looseEqual(model, value) ? ' checked' : '';
|
||||
case 'checkbox':
|
||||
return (Array.isArray(model)
|
||||
? ssrLooseContain(model, value)
|
||||
: model)
|
||||
? ' checked'
|
||||
: '';
|
||||
default:
|
||||
// text types
|
||||
return ssrRenderAttr('value', model);
|
||||
}
|
||||
}
|
||||
// for <input v-bind="obj" v-model="model">
|
||||
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
||||
const { type, value } = existingProps;
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return shared.looseEqual(model, value) ? { checked: true } : null;
|
||||
case 'checkbox':
|
||||
return (Array.isArray(model)
|
||||
? ssrLooseContain(model, value)
|
||||
: model)
|
||||
? { checked: true }
|
||||
: null;
|
||||
default:
|
||||
// text types
|
||||
return { value: model };
|
||||
}
|
||||
}
|
||||
|
||||
exports.renderToStream = renderToStream;
|
||||
exports.renderToString = renderToString;
|
||||
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
|
||||
exports.ssrInterpolate = ssrInterpolate;
|
||||
exports.ssrLooseContain = ssrLooseContain;
|
||||
exports.ssrLooseEqual = ssrLooseEqual;
|
||||
exports.ssrRenderAttr = ssrRenderAttr;
|
||||
exports.ssrRenderAttrs = ssrRenderAttrs;
|
||||
exports.ssrRenderClass = ssrRenderClass;
|
||||
exports.ssrRenderComponent = ssrRenderComponent;
|
||||
exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
|
||||
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
|
||||
exports.ssrRenderList = ssrRenderList;
|
||||
exports.ssrRenderSlot = ssrRenderSlot;
|
||||
exports.ssrRenderStyle = ssrRenderStyle;
|
||||
exports.ssrRenderSuspense = ssrRenderSuspense;
|
||||
exports.ssrRenderTeleport = ssrRenderTeleport;
|
||||
exports.ssrRenderVNode = renderVNode;
|
||||
exports.ssrResolveCssVars = ssrResolveCssVars;
|
||||
592
node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js
generated
vendored
Normal file
592
node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js
generated
vendored
Normal file
@@ -0,0 +1,592 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var vue = require('vue');
|
||||
var shared = require('@vue/shared');
|
||||
var compilerSsr = require('@vue/compiler-ssr');
|
||||
var stream = require('stream');
|
||||
|
||||
// leading comma for empty string ""
|
||||
const shouldIgnoreProp = shared.makeMap(`,key,ref,innerHTML,textContent`);
|
||||
function ssrRenderAttrs(props, tag) {
|
||||
let ret = '';
|
||||
for (const key in props) {
|
||||
if (shouldIgnoreProp(key) ||
|
||||
shared.isOn(key) ||
|
||||
(tag === 'textarea' && key === 'value')) {
|
||||
continue;
|
||||
}
|
||||
const value = props[key];
|
||||
if (key === 'class') {
|
||||
ret += ` class="${ssrRenderClass(value)}"`;
|
||||
}
|
||||
else if (key === 'style') {
|
||||
ret += ` style="${ssrRenderStyle(value)}"`;
|
||||
}
|
||||
else {
|
||||
ret += ssrRenderDynamicAttr(key, value, tag);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
// render an attr with dynamic (unknown) key.
|
||||
function ssrRenderDynamicAttr(key, value, tag) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
const attrKey = tag && tag.indexOf('-') > 0
|
||||
? key // preserve raw name on custom elements
|
||||
: shared.propsToAttrMap[key] || key.toLowerCase();
|
||||
if (shared.isBooleanAttr(attrKey)) {
|
||||
return value === false ? `` : ` ${attrKey}`;
|
||||
}
|
||||
else if (shared.isSSRSafeAttrName(attrKey)) {
|
||||
return value === '' ? ` ${attrKey}` : ` ${attrKey}="${shared.escapeHtml(value)}"`;
|
||||
}
|
||||
else {
|
||||
console.warn(`[@vue/server-renderer] Skipped rendering unsafe attribute name: ${attrKey}`);
|
||||
return ``;
|
||||
}
|
||||
}
|
||||
// Render a v-bind attr with static key. The key is pre-processed at compile
|
||||
// time and we only need to check and escape value.
|
||||
function ssrRenderAttr(key, value) {
|
||||
if (!isRenderableValue(value)) {
|
||||
return ``;
|
||||
}
|
||||
return ` ${key}="${shared.escapeHtml(value)}"`;
|
||||
}
|
||||
function isRenderableValue(value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
const type = typeof value;
|
||||
return type === 'string' || type === 'number' || type === 'boolean';
|
||||
}
|
||||
function ssrRenderClass(raw) {
|
||||
return shared.escapeHtml(shared.normalizeClass(raw));
|
||||
}
|
||||
function ssrRenderStyle(raw) {
|
||||
if (!raw) {
|
||||
return '';
|
||||
}
|
||||
if (shared.isString(raw)) {
|
||||
return shared.escapeHtml(raw);
|
||||
}
|
||||
const styles = shared.normalizeStyle(raw);
|
||||
return shared.escapeHtml(shared.stringifyStyle(styles));
|
||||
}
|
||||
|
||||
const compileCache = Object.create(null);
|
||||
function ssrCompile(template, instance) {
|
||||
const cached = compileCache[template];
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
const { code } = compilerSsr.compile(template, {
|
||||
isCustomElement: instance.appContext.config.isCustomElement || shared.NO,
|
||||
isNativeTag: instance.appContext.config.isNativeTag || shared.NO,
|
||||
onError(err) {
|
||||
{
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
});
|
||||
return (compileCache[template] = Function('require', code)(require));
|
||||
}
|
||||
|
||||
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
||||
parentPush('<!--teleport start-->');
|
||||
let teleportContent;
|
||||
if (disabled) {
|
||||
contentRenderFn(parentPush);
|
||||
teleportContent = `<!---->`;
|
||||
}
|
||||
else {
|
||||
const { getBuffer, push } = createBuffer();
|
||||
contentRenderFn(push);
|
||||
push(`<!---->`); // teleport end anchor
|
||||
teleportContent = getBuffer();
|
||||
}
|
||||
const context = parentComponent.appContext.provides[vue.ssrContextKey];
|
||||
const teleportBuffers = context.__teleportBuffers || (context.__teleportBuffers = {});
|
||||
if (teleportBuffers[target]) {
|
||||
teleportBuffers[target].push(teleportContent);
|
||||
}
|
||||
else {
|
||||
teleportBuffers[target] = [teleportContent];
|
||||
}
|
||||
parentPush('<!--teleport end-->');
|
||||
}
|
||||
|
||||
const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode } = vue.ssrUtils;
|
||||
// Each component has a buffer array.
|
||||
// A buffer array can contain one of the following:
|
||||
// - plain string
|
||||
// - A resolved buffer (recursive arrays of strings that can be unrolled
|
||||
// synchronously)
|
||||
// - An async buffer (a Promise that resolves to a resolved buffer)
|
||||
function createBuffer() {
|
||||
let appendable = false;
|
||||
const buffer = [];
|
||||
return {
|
||||
getBuffer() {
|
||||
// Return static buffer and await on items during unroll stage
|
||||
return buffer;
|
||||
},
|
||||
push(item) {
|
||||
const isStringItem = shared.isString(item);
|
||||
if (appendable && isStringItem) {
|
||||
buffer[buffer.length - 1] += item;
|
||||
}
|
||||
else {
|
||||
buffer.push(item);
|
||||
}
|
||||
appendable = isStringItem;
|
||||
if (shared.isPromise(item) || (shared.isArray(item) && item.hasAsync)) {
|
||||
// promise, or child buffer with async, mark as async.
|
||||
// this allows skipping unnecessary await ticks during unroll stage
|
||||
buffer.hasAsync = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function renderComponentVNode(vnode, parentComponent = null) {
|
||||
const instance = createComponentInstance(vnode, parentComponent, null);
|
||||
const res = setupComponent(instance, true /* isSSR */);
|
||||
const hasAsyncSetup = shared.isPromise(res);
|
||||
const prefetch = vnode.type.serverPrefetch;
|
||||
if (hasAsyncSetup || prefetch) {
|
||||
let p = hasAsyncSetup
|
||||
? res.catch(err => {
|
||||
vue.warn(`[@vue/server-renderer]: Uncaught error in async setup:\n`, err);
|
||||
})
|
||||
: Promise.resolve();
|
||||
if (prefetch) {
|
||||
p = p.then(() => prefetch.call(instance.proxy)).catch(err => {
|
||||
vue.warn(`[@vue/server-renderer]: Uncaught error in serverPrefetch:\n`, err);
|
||||
});
|
||||
}
|
||||
return p.then(() => renderComponentSubTree(instance));
|
||||
}
|
||||
else {
|
||||
return renderComponentSubTree(instance);
|
||||
}
|
||||
}
|
||||
function renderComponentSubTree(instance) {
|
||||
const comp = instance.type;
|
||||
const { getBuffer, push } = createBuffer();
|
||||
if (shared.isFunction(comp)) {
|
||||
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance);
|
||||
}
|
||||
else {
|
||||
if (!instance.render && !comp.ssrRender && shared.isString(comp.template)) {
|
||||
comp.ssrRender = ssrCompile(comp.template, instance);
|
||||
}
|
||||
if (comp.ssrRender) {
|
||||
// optimized
|
||||
// resolve fallthrough attrs
|
||||
let attrs = instance.type.inheritAttrs !== false ? instance.attrs : undefined;
|
||||
// inherited scopeId
|
||||
const scopeId = instance.vnode.scopeId;
|
||||
const treeOwnerId = instance.parent && instance.parent.type.__scopeId;
|
||||
const slotScopeId = treeOwnerId && treeOwnerId !== scopeId ? treeOwnerId + '-s' : null;
|
||||
if (scopeId || slotScopeId) {
|
||||
attrs = { ...attrs };
|
||||
if (scopeId)
|
||||
attrs[scopeId] = '';
|
||||
if (slotScopeId)
|
||||
attrs[slotScopeId] = '';
|
||||
}
|
||||
// set current rendering instance for asset resolution
|
||||
setCurrentRenderingInstance(instance);
|
||||
comp.ssrRender(instance.proxy, push, instance, attrs,
|
||||
// compiler-optimized bindings
|
||||
instance.props, instance.setupState, instance.data, instance.ctx);
|
||||
setCurrentRenderingInstance(null);
|
||||
}
|
||||
else if (instance.render) {
|
||||
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance);
|
||||
}
|
||||
else {
|
||||
vue.warn(`Component ${comp.name ? `${comp.name} ` : ``} is missing template or render function.`);
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
return getBuffer();
|
||||
}
|
||||
function renderVNode(push, vnode, parentComponent) {
|
||||
const { type, shapeFlag, children } = vnode;
|
||||
switch (type) {
|
||||
case vue.Text:
|
||||
push(shared.escapeHtml(children));
|
||||
break;
|
||||
case vue.Comment:
|
||||
push(children ? `<!--${shared.escapeHtmlComment(children)}-->` : `<!---->`);
|
||||
break;
|
||||
case vue.Static:
|
||||
push(children);
|
||||
break;
|
||||
case vue.Fragment:
|
||||
push(`<!--[-->`); // open
|
||||
renderVNodeChildren(push, children, parentComponent);
|
||||
push(`<!--]-->`); // close
|
||||
break;
|
||||
default:
|
||||
if (shapeFlag & 1 /* ELEMENT */) {
|
||||
renderElementVNode(push, vnode, parentComponent);
|
||||
}
|
||||
else if (shapeFlag & 6 /* COMPONENT */) {
|
||||
push(renderComponentVNode(vnode, parentComponent));
|
||||
}
|
||||
else if (shapeFlag & 64 /* TELEPORT */) {
|
||||
renderTeleportVNode(push, vnode, parentComponent);
|
||||
}
|
||||
else if (shapeFlag & 128 /* SUSPENSE */) {
|
||||
renderVNode(push, vnode.ssContent, parentComponent);
|
||||
}
|
||||
else {
|
||||
vue.warn('[@vue/server-renderer] Invalid VNode type:', type, `(${typeof type})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderVNodeChildren(push, children, parentComponent) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
renderVNode(push, normalizeVNode(children[i]), parentComponent);
|
||||
}
|
||||
}
|
||||
function renderElementVNode(push, vnode, parentComponent) {
|
||||
const tag = vnode.type;
|
||||
let { props, children, shapeFlag, scopeId, dirs } = vnode;
|
||||
let openTag = `<${tag}`;
|
||||
if (dirs) {
|
||||
props = applySSRDirectives(vnode, props, dirs);
|
||||
}
|
||||
if (props) {
|
||||
openTag += ssrRenderAttrs(props, tag);
|
||||
}
|
||||
openTag += resolveScopeId(scopeId, vnode, parentComponent);
|
||||
push(openTag + `>`);
|
||||
if (!shared.isVoidTag(tag)) {
|
||||
let hasChildrenOverride = false;
|
||||
if (props) {
|
||||
if (props.innerHTML) {
|
||||
hasChildrenOverride = true;
|
||||
push(props.innerHTML);
|
||||
}
|
||||
else if (props.textContent) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.textContent));
|
||||
}
|
||||
else if (tag === 'textarea' && props.value) {
|
||||
hasChildrenOverride = true;
|
||||
push(shared.escapeHtml(props.value));
|
||||
}
|
||||
}
|
||||
if (!hasChildrenOverride) {
|
||||
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
||||
push(shared.escapeHtml(children));
|
||||
}
|
||||
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
||||
renderVNodeChildren(push, children, parentComponent);
|
||||
}
|
||||
}
|
||||
push(`</${tag}>`);
|
||||
}
|
||||
}
|
||||
function resolveScopeId(scopeId, vnode, parentComponent) {
|
||||
let res = ``;
|
||||
if (scopeId) {
|
||||
res = ` ${scopeId}`;
|
||||
}
|
||||
if (parentComponent) {
|
||||
const treeOwnerId = parentComponent.type.__scopeId;
|
||||
// vnode's own scopeId and the current rendering component's scopeId is
|
||||
// different - this is a slot content node.
|
||||
if (treeOwnerId && treeOwnerId !== scopeId) {
|
||||
res += ` ${treeOwnerId}-s`;
|
||||
}
|
||||
if (vnode === parentComponent.subTree) {
|
||||
res += resolveScopeId(parentComponent.vnode.scopeId, parentComponent.vnode, parentComponent.parent);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function applySSRDirectives(vnode, rawProps, dirs) {
|
||||
const toMerge = [];
|
||||
for (let i = 0; i < dirs.length; i++) {
|
||||
const binding = dirs[i];
|
||||
const { dir: { getSSRProps } } = binding;
|
||||
if (getSSRProps) {
|
||||
const props = getSSRProps(binding, vnode);
|
||||
if (props)
|
||||
toMerge.push(props);
|
||||
}
|
||||
}
|
||||
return vue.mergeProps(rawProps || {}, ...toMerge);
|
||||
}
|
||||
function renderTeleportVNode(push, vnode, parentComponent) {
|
||||
const target = vnode.props && vnode.props.to;
|
||||
const disabled = vnode.props && vnode.props.disabled;
|
||||
if (!target) {
|
||||
vue.warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
||||
return [];
|
||||
}
|
||||
if (!shared.isString(target)) {
|
||||
vue.warn(`[@vue/server-renderer] Teleport target must be a query selector string.`);
|
||||
return [];
|
||||
}
|
||||
ssrRenderTeleport(push, push => {
|
||||
renderVNodeChildren(push, vnode.children, parentComponent);
|
||||
}, target, disabled || disabled === '', parentComponent);
|
||||
}
|
||||
|
||||
const { isVNode } = vue.ssrUtils;
|
||||
async function unrollBuffer(buffer) {
|
||||
if (buffer.hasAsync) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
ret += await unrollBuffer(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
return unrollBufferSync(buffer);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync(buffer) {
|
||||
let ret = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
ret += item;
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
ret += unrollBufferSync(item);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
async function renderToString(input, context = {}) {
|
||||
if (isVNode(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToString(vue.createApp({ render: () => input }), context);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(vue.ssrContextKey, context);
|
||||
const buffer = await renderComponentVNode(vnode);
|
||||
await resolveTeleports(context);
|
||||
return unrollBuffer(buffer);
|
||||
}
|
||||
async function resolveTeleports(context) {
|
||||
if (context.__teleportBuffers) {
|
||||
context.teleports = context.teleports || {};
|
||||
for (const key in context.__teleportBuffers) {
|
||||
// note: it's OK to await sequentially here because the Promises were
|
||||
// created eagerly in parallel.
|
||||
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { isVNode: isVNode$1 } = vue.ssrUtils;
|
||||
async function unrollBuffer$1(buffer, stream) {
|
||||
if (buffer.hasAsync) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isPromise(item)) {
|
||||
item = await item;
|
||||
}
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
await unrollBuffer$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// sync buffer can be more efficiently unrolled without unnecessary await
|
||||
// ticks
|
||||
unrollBufferSync$1(buffer, stream);
|
||||
}
|
||||
}
|
||||
function unrollBufferSync$1(buffer, stream) {
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let item = buffer[i];
|
||||
if (shared.isString(item)) {
|
||||
stream.push(item);
|
||||
}
|
||||
else {
|
||||
// since this is a sync buffer, child buffers are never promises
|
||||
unrollBufferSync$1(item, stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
function renderToStream(input, context = {}) {
|
||||
if (isVNode$1(input)) {
|
||||
// raw vnode, wrap with app (for context)
|
||||
return renderToStream(vue.createApp({ render: () => input }), context);
|
||||
}
|
||||
// rendering an app
|
||||
const vnode = vue.createVNode(input._component, input._props);
|
||||
vnode.appContext = input._context;
|
||||
// provide the ssr context to the tree
|
||||
input.provide(vue.ssrContextKey, context);
|
||||
const stream$1 = new stream.Readable();
|
||||
Promise.resolve(renderComponentVNode(vnode))
|
||||
.then(buffer => unrollBuffer$1(buffer, stream$1))
|
||||
.then(() => {
|
||||
stream$1.push(null);
|
||||
})
|
||||
.catch(error => {
|
||||
stream$1.destroy(error);
|
||||
});
|
||||
return stream$1;
|
||||
}
|
||||
|
||||
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null) {
|
||||
return renderComponentVNode(vue.createVNode(comp, props, children), parentComponent);
|
||||
}
|
||||
|
||||
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent) {
|
||||
// template-compiled slots are always rendered as fragments
|
||||
push(`<!--[-->`);
|
||||
const slotFn = slots[slotName];
|
||||
if (slotFn) {
|
||||
const scopeId = parentComponent && parentComponent.type.__scopeId;
|
||||
const ret = slotFn(slotProps, push, parentComponent, scopeId ? ` ${scopeId}-s` : ``);
|
||||
if (Array.isArray(ret)) {
|
||||
// normal slot
|
||||
renderVNodeChildren(push, ret, parentComponent);
|
||||
}
|
||||
}
|
||||
else if (fallbackRenderFn) {
|
||||
fallbackRenderFn();
|
||||
}
|
||||
push(`<!--]-->`);
|
||||
}
|
||||
|
||||
function ssrInterpolate(value) {
|
||||
return shared.escapeHtml(shared.toDisplayString(value));
|
||||
}
|
||||
|
||||
function ssrRenderList(source, renderItem) {
|
||||
if (shared.isArray(source) || shared.isString(source)) {
|
||||
for (let i = 0, l = source.length; i < l; i++) {
|
||||
renderItem(source[i], i);
|
||||
}
|
||||
}
|
||||
else if (typeof source === 'number') {
|
||||
for (let i = 0; i < source; i++) {
|
||||
renderItem(i + 1, i);
|
||||
}
|
||||
}
|
||||
else if (shared.isObject(source)) {
|
||||
if (source[Symbol.iterator]) {
|
||||
const arr = Array.from(source);
|
||||
for (let i = 0, l = arr.length; i < l; i++) {
|
||||
renderItem(arr[i], i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const keys = Object.keys(source);
|
||||
for (let i = 0, l = keys.length; i < l; i++) {
|
||||
const key = keys[i];
|
||||
renderItem(source[key], key, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function ssrRenderSuspense(push, { default: renderContent }) {
|
||||
if (renderContent) {
|
||||
renderContent();
|
||||
}
|
||||
else {
|
||||
push(`<!---->`);
|
||||
}
|
||||
}
|
||||
|
||||
function ssrResolveCssVars(source, scopeId) {
|
||||
const style = {};
|
||||
const prefix = scopeId ? `${scopeId.replace(/^data-v-/, '')}-` : ``;
|
||||
for (const key in source) {
|
||||
style[`--${prefix}${key}`] = source[key];
|
||||
}
|
||||
return { style };
|
||||
}
|
||||
|
||||
const ssrLooseEqual = shared.looseEqual;
|
||||
function ssrLooseContain(arr, value) {
|
||||
return shared.looseIndexOf(arr, value) > -1;
|
||||
}
|
||||
// for <input :type="type" v-model="model" value="value">
|
||||
function ssrRenderDynamicModel(type, model, value) {
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return shared.looseEqual(model, value) ? ' checked' : '';
|
||||
case 'checkbox':
|
||||
return (Array.isArray(model)
|
||||
? ssrLooseContain(model, value)
|
||||
: model)
|
||||
? ' checked'
|
||||
: '';
|
||||
default:
|
||||
// text types
|
||||
return ssrRenderAttr('value', model);
|
||||
}
|
||||
}
|
||||
// for <input v-bind="obj" v-model="model">
|
||||
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
||||
const { type, value } = existingProps;
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return shared.looseEqual(model, value) ? { checked: true } : null;
|
||||
case 'checkbox':
|
||||
return (Array.isArray(model)
|
||||
? ssrLooseContain(model, value)
|
||||
: model)
|
||||
? { checked: true }
|
||||
: null;
|
||||
default:
|
||||
// text types
|
||||
return { value: model };
|
||||
}
|
||||
}
|
||||
|
||||
exports.renderToStream = renderToStream;
|
||||
exports.renderToString = renderToString;
|
||||
exports.ssrGetDynamicModelProps = ssrGetDynamicModelProps;
|
||||
exports.ssrInterpolate = ssrInterpolate;
|
||||
exports.ssrLooseContain = ssrLooseContain;
|
||||
exports.ssrLooseEqual = ssrLooseEqual;
|
||||
exports.ssrRenderAttr = ssrRenderAttr;
|
||||
exports.ssrRenderAttrs = ssrRenderAttrs;
|
||||
exports.ssrRenderClass = ssrRenderClass;
|
||||
exports.ssrRenderComponent = ssrRenderComponent;
|
||||
exports.ssrRenderDynamicAttr = ssrRenderDynamicAttr;
|
||||
exports.ssrRenderDynamicModel = ssrRenderDynamicModel;
|
||||
exports.ssrRenderList = ssrRenderList;
|
||||
exports.ssrRenderSlot = ssrRenderSlot;
|
||||
exports.ssrRenderStyle = ssrRenderStyle;
|
||||
exports.ssrRenderSuspense = ssrRenderSuspense;
|
||||
exports.ssrRenderTeleport = ssrRenderTeleport;
|
||||
exports.ssrRenderVNode = renderVNode;
|
||||
exports.ssrResolveCssVars = ssrResolveCssVars;
|
||||
75
node_modules/@vue/server-renderer/dist/server-renderer.d.ts
generated
vendored
Normal file
75
node_modules/@vue/server-renderer/dist/server-renderer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/// <reference types="node" />
|
||||
import { App } from 'vue';
|
||||
import { Component } from 'vue';
|
||||
import { ComponentInternalInstance } from 'vue';
|
||||
import { Readable } from 'stream';
|
||||
import { Slots } from 'vue';
|
||||
import { VNode } from 'vue';
|
||||
|
||||
declare type Props = Record<string, unknown>;
|
||||
|
||||
declare type PushFn = (item: SSRBufferItem) => void;
|
||||
|
||||
export declare function renderToStream(input: App | VNode, context?: SSRContext): Readable;
|
||||
|
||||
export declare function renderToString(input: App | VNode, context?: SSRContext): Promise<string>;
|
||||
|
||||
declare type SSRBuffer = SSRBufferItem[] & {
|
||||
hasAsync?: boolean;
|
||||
};
|
||||
|
||||
declare type SSRBufferItem = string | SSRBuffer | Promise<SSRBuffer>;
|
||||
|
||||
export declare type SSRContext = {
|
||||
[key: string]: any;
|
||||
teleports?: Record<string, string>;
|
||||
__teleportBuffers?: Record<string, SSRBuffer>;
|
||||
};
|
||||
|
||||
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
|
||||
checked: boolean;
|
||||
value?: undefined;
|
||||
} | {
|
||||
value: unknown;
|
||||
checked?: undefined;
|
||||
} | null;
|
||||
|
||||
export declare function ssrInterpolate(value: unknown): string;
|
||||
|
||||
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
|
||||
|
||||
export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
|
||||
|
||||
export declare function ssrRenderAttr(key: string, value: unknown): string;
|
||||
|
||||
export declare function ssrRenderAttrs(props: Record<string, unknown>, tag?: string): string;
|
||||
|
||||
export declare function ssrRenderClass(raw: unknown): string;
|
||||
|
||||
export declare function ssrRenderComponent(comp: Component, props?: Props | null, children?: Slots | SSRSlots | null, parentComponent?: ComponentInternalInstance | null): SSRBuffer | Promise<SSRBuffer>;
|
||||
|
||||
export declare function ssrRenderDynamicAttr(key: string, value: unknown, tag?: string): string;
|
||||
|
||||
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
|
||||
|
||||
export declare function ssrRenderList(source: unknown, renderItem: (value: unknown, key: string | number, index?: number) => void): void;
|
||||
|
||||
export declare function ssrRenderSlot(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance): void;
|
||||
|
||||
export declare function ssrRenderStyle(raw: unknown): string;
|
||||
|
||||
export declare function ssrRenderSuspense(push: PushFn, { default: renderContent }: Record<string, (() => void) | undefined>): Promise<void>;
|
||||
|
||||
export declare function ssrRenderTeleport(parentPush: PushFn, contentRenderFn: (push: PushFn) => void, target: string, disabled: boolean, parentComponent: ComponentInternalInstance): void;
|
||||
|
||||
export declare function ssrRenderVNode(push: PushFn, vnode: VNode, parentComponent: ComponentInternalInstance): void;
|
||||
|
||||
export declare function ssrResolveCssVars(source: Record<string, string>, scopeId?: string): {
|
||||
style: Record<string, string>;
|
||||
};
|
||||
|
||||
declare type SSRSlot = (props: Props, push: PushFn, parentComponent: ComponentInternalInstance | null, scopeId: string | null) => void;
|
||||
|
||||
declare type SSRSlots = Record<string, SSRSlot>;
|
||||
|
||||
export { }
|
||||
7
node_modules/@vue/server-renderer/index.js
generated
vendored
Normal file
7
node_modules/@vue/server-renderer/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/server-renderer.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/server-renderer.cjs.js')
|
||||
}
|
||||
69
node_modules/@vue/server-renderer/package.json
generated
vendored
Normal file
69
node_modules/@vue/server-renderer/package.json
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/server-renderer@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/server-renderer@3.0.2",
|
||||
"_id": "@vue/server-renderer@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-jeRNMW459OIWa1dOelNSSdwLxUY=",
|
||||
"_location": "/@vue/server-renderer",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/server-renderer@3.0.2",
|
||||
"name": "@vue/server-renderer",
|
||||
"escapedName": "@vue%2fserver-renderer",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/vitepress"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fserver-renderer/-/server-renderer-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"formats": [
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vue/compiler-ssr": "3.0.2",
|
||||
"@vue/shared": "3.0.2"
|
||||
},
|
||||
"description": "@vue/server-renderer",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/server-renderer#readme",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "@vue/server-renderer",
|
||||
"peerDependencies": {
|
||||
"vue": "3.0.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/server-renderer"
|
||||
},
|
||||
"types": "dist/server-renderer.d.ts",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
3
node_modules/@vue/shared/README.md
generated
vendored
Normal file
3
node_modules/@vue/shared/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @vue/shared
|
||||
|
||||
Internal utility functions and constants shared across `@vue` packages.
|
||||
547
node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
547
node_modules/@vue/shared/dist/shared.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,547 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const map = Object.create(null);
|
||||
const list = str.split(',');
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
map[list[i]] = true;
|
||||
}
|
||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
||||
}
|
||||
|
||||
// Patch flags are optimization hints generated by the compiler.
|
||||
// when a block with dynamicChildren is encountered during diff, the algorithm
|
||||
// enters "optimized mode". In this mode, we know that the vdom is produced by
|
||||
// a render function generated by the compiler, so the algorithm only needs to
|
||||
// handle updates explicitly marked by these patch flags.
|
||||
// dev only flag -> name mapping
|
||||
const PatchFlagNames = {
|
||||
[1 /* TEXT */]: `TEXT`,
|
||||
[2 /* CLASS */]: `CLASS`,
|
||||
[4 /* STYLE */]: `STYLE`,
|
||||
[8 /* PROPS */]: `PROPS`,
|
||||
[16 /* FULL_PROPS */]: `FULL_PROPS`,
|
||||
[32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
||||
[64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
||||
[128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
||||
[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
||||
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
||||
[512 /* NEED_PATCH */]: `NEED_PATCH`,
|
||||
[-1 /* HOISTED */]: `HOISTED`,
|
||||
[-2 /* BAIL */]: `BAIL`
|
||||
};
|
||||
|
||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl';
|
||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
const lines = source.split(/\r?\n/);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count += lines[i].length + 1;
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
||||
const lineLength = lines[j].length;
|
||||
if (j === i) {
|
||||
// push underline
|
||||
const pad = start - (count - lineLength) + 1;
|
||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
||||
}
|
||||
else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + '^'.repeat(length));
|
||||
}
|
||||
count += lineLength + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* On the client we only need to offer special cases for boolean attributes that
|
||||
* have different names from their corresponding dom properties:
|
||||
* - itemscope -> N/A
|
||||
* - allowfullscreen -> allowFullscreen
|
||||
* - formnovalidate -> formNoValidate
|
||||
* - ismap -> isMap
|
||||
* - nomodule -> noModule
|
||||
* - novalidate -> noValidate
|
||||
* - readonly -> readOnly
|
||||
*/
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
||||
`loop,open,required,reversed,scoped,seamless,` +
|
||||
`checked,muted,multiple,selected`);
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return (attrValidationCache[name] = !isUnsafe);
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: 'accept-charset',
|
||||
className: 'class',
|
||||
htmlFor: 'for',
|
||||
httpEquiv: 'http-equiv'
|
||||
};
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
|
||||
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
|
||||
`columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
|
||||
`grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
|
||||
`grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
|
||||
`line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
|
||||
// SVG
|
||||
`fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width`);
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
||||
`value,width,wrap`);
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:(.+)/;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.split(listDelimiterRE).forEach(item => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = '';
|
||||
if (!styles) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) ||
|
||||
(typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
|
||||
// only render valid values
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = '';
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
}
|
||||
else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
res += normalizeClass(value[i]) + ' ';
|
||||
}
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
|
||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
||||
'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
|
||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
||||
'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
|
||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
||||
'summary,template,blockquote,iframe,tfoot';
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
||||
'text,textPath,title,tspan,unknown,use,view';
|
||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = '' + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = '';
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34: // "
|
||||
escaped = '"';
|
||||
break;
|
||||
case 38: // &
|
||||
escaped = '&';
|
||||
break;
|
||||
case 39: // '
|
||||
escaped = ''';
|
||||
break;
|
||||
case 60: // <
|
||||
escaped = '<';
|
||||
break;
|
||||
case 62: // >
|
||||
escaped = '>';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.substring(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
||||
}
|
||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, '');
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
/* istanbul ignore if: this if will probably never be called */
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if ((aHasKey && !bHasKey) ||
|
||||
(!aHasKey && bHasKey) ||
|
||||
!looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex(item => looseEqual(item, val));
|
||||
}
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
const toDisplayString = (val) => {
|
||||
return val == null
|
||||
? ''
|
||||
: isObject(val)
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
||||
entries[`${key} =>`] = val;
|
||||
return entries;
|
||||
}, {})
|
||||
};
|
||||
}
|
||||
else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()]
|
||||
};
|
||||
}
|
||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* List of @babel/parser plugins that are used for template expression
|
||||
* transforms and SFC script transforms. By default we enable proposals slated
|
||||
* for ES2020. This will need to be updated as the spec moves forward.
|
||||
* Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
*/
|
||||
const babelParserDefaultPlugins = [
|
||||
'bigInt',
|
||||
'optionalChaining',
|
||||
'nullishCoalescingOperator'
|
||||
];
|
||||
const EMPTY_OBJ = Object.freeze({})
|
||||
;
|
||||
const EMPTY_ARR = Object.freeze([]) ;
|
||||
const NOOP = () => { };
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
const NO = () => false;
|
||||
const onRE = /^on[^a-z]/;
|
||||
const isOn = (key) => onRE.test(key);
|
||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
||||
const isDate = (val) => val instanceof Date;
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const isPromise = (val) => {
|
||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
',key,ref,' +
|
||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const toHandlerKey = cacheStringFunction((str) => (str ? `on${capitalize(str)}` : ``));
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return (_globalThis ||
|
||||
(_globalThis =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {}));
|
||||
};
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
exports.NOOP = NOOP;
|
||||
exports.PatchFlagNames = PatchFlagNames;
|
||||
exports.babelParserDefaultPlugins = babelParserDefaultPlugins;
|
||||
exports.camelize = camelize;
|
||||
exports.capitalize = capitalize;
|
||||
exports.def = def;
|
||||
exports.escapeHtml = escapeHtml;
|
||||
exports.escapeHtmlComment = escapeHtmlComment;
|
||||
exports.extend = extend;
|
||||
exports.generateCodeFrame = generateCodeFrame;
|
||||
exports.getGlobalThis = getGlobalThis;
|
||||
exports.hasChanged = hasChanged;
|
||||
exports.hasOwn = hasOwn;
|
||||
exports.hyphenate = hyphenate;
|
||||
exports.invokeArrayFns = invokeArrayFns;
|
||||
exports.isArray = isArray;
|
||||
exports.isBooleanAttr = isBooleanAttr;
|
||||
exports.isDate = isDate;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||
exports.isHTMLTag = isHTMLTag;
|
||||
exports.isIntegerKey = isIntegerKey;
|
||||
exports.isKnownAttr = isKnownAttr;
|
||||
exports.isMap = isMap;
|
||||
exports.isModelListener = isModelListener;
|
||||
exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
|
||||
exports.isObject = isObject;
|
||||
exports.isOn = isOn;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isReservedProp = isReservedProp;
|
||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||
exports.isSVGTag = isSVGTag;
|
||||
exports.isSet = isSet;
|
||||
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||
exports.isString = isString;
|
||||
exports.isSymbol = isSymbol;
|
||||
exports.isVoidTag = isVoidTag;
|
||||
exports.looseEqual = looseEqual;
|
||||
exports.looseIndexOf = looseIndexOf;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
exports.parseStringStyle = parseStringStyle;
|
||||
exports.propsToAttrMap = propsToAttrMap;
|
||||
exports.remove = remove;
|
||||
exports.stringifyStyle = stringifyStyle;
|
||||
exports.toDisplayString = toDisplayString;
|
||||
exports.toHandlerKey = toHandlerKey;
|
||||
exports.toNumber = toNumber;
|
||||
exports.toRawType = toRawType;
|
||||
exports.toTypeString = toTypeString;
|
||||
546
node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
546
node_modules/@vue/shared/dist/shared.cjs.prod.js
generated
vendored
Normal file
@@ -0,0 +1,546 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const map = Object.create(null);
|
||||
const list = str.split(',');
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
map[list[i]] = true;
|
||||
}
|
||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
||||
}
|
||||
|
||||
// Patch flags are optimization hints generated by the compiler.
|
||||
// when a block with dynamicChildren is encountered during diff, the algorithm
|
||||
// enters "optimized mode". In this mode, we know that the vdom is produced by
|
||||
// a render function generated by the compiler, so the algorithm only needs to
|
||||
// handle updates explicitly marked by these patch flags.
|
||||
// dev only flag -> name mapping
|
||||
const PatchFlagNames = {
|
||||
[1 /* TEXT */]: `TEXT`,
|
||||
[2 /* CLASS */]: `CLASS`,
|
||||
[4 /* STYLE */]: `STYLE`,
|
||||
[8 /* PROPS */]: `PROPS`,
|
||||
[16 /* FULL_PROPS */]: `FULL_PROPS`,
|
||||
[32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
||||
[64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
||||
[128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
||||
[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
||||
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
||||
[512 /* NEED_PATCH */]: `NEED_PATCH`,
|
||||
[-1 /* HOISTED */]: `HOISTED`,
|
||||
[-2 /* BAIL */]: `BAIL`
|
||||
};
|
||||
|
||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl';
|
||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
const lines = source.split(/\r?\n/);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count += lines[i].length + 1;
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
||||
const lineLength = lines[j].length;
|
||||
if (j === i) {
|
||||
// push underline
|
||||
const pad = start - (count - lineLength) + 1;
|
||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
||||
}
|
||||
else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + '^'.repeat(length));
|
||||
}
|
||||
count += lineLength + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* On the client we only need to offer special cases for boolean attributes that
|
||||
* have different names from their corresponding dom properties:
|
||||
* - itemscope -> N/A
|
||||
* - allowfullscreen -> allowFullscreen
|
||||
* - formnovalidate -> formNoValidate
|
||||
* - ismap -> isMap
|
||||
* - nomodule -> noModule
|
||||
* - novalidate -> noValidate
|
||||
* - readonly -> readOnly
|
||||
*/
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
||||
`loop,open,required,reversed,scoped,seamless,` +
|
||||
`checked,muted,multiple,selected`);
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return (attrValidationCache[name] = !isUnsafe);
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: 'accept-charset',
|
||||
className: 'class',
|
||||
htmlFor: 'for',
|
||||
httpEquiv: 'http-equiv'
|
||||
};
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
|
||||
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
|
||||
`columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
|
||||
`grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
|
||||
`grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
|
||||
`line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
|
||||
// SVG
|
||||
`fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width`);
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
||||
`value,width,wrap`);
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:(.+)/;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.split(listDelimiterRE).forEach(item => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = '';
|
||||
if (!styles) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) ||
|
||||
(typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
|
||||
// only render valid values
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = '';
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
}
|
||||
else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
res += normalizeClass(value[i]) + ' ';
|
||||
}
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
|
||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
||||
'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
|
||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
||||
'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
|
||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
||||
'summary,template,blockquote,iframe,tfoot';
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
||||
'text,textPath,title,tspan,unknown,use,view';
|
||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = '' + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = '';
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34: // "
|
||||
escaped = '"';
|
||||
break;
|
||||
case 38: // &
|
||||
escaped = '&';
|
||||
break;
|
||||
case 39: // '
|
||||
escaped = ''';
|
||||
break;
|
||||
case 60: // <
|
||||
escaped = '<';
|
||||
break;
|
||||
case 62: // >
|
||||
escaped = '>';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.substring(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
||||
}
|
||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, '');
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
/* istanbul ignore if: this if will probably never be called */
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if ((aHasKey && !bHasKey) ||
|
||||
(!aHasKey && bHasKey) ||
|
||||
!looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex(item => looseEqual(item, val));
|
||||
}
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
const toDisplayString = (val) => {
|
||||
return val == null
|
||||
? ''
|
||||
: isObject(val)
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
||||
entries[`${key} =>`] = val;
|
||||
return entries;
|
||||
}, {})
|
||||
};
|
||||
}
|
||||
else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()]
|
||||
};
|
||||
}
|
||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* List of @babel/parser plugins that are used for template expression
|
||||
* transforms and SFC script transforms. By default we enable proposals slated
|
||||
* for ES2020. This will need to be updated as the spec moves forward.
|
||||
* Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
*/
|
||||
const babelParserDefaultPlugins = [
|
||||
'bigInt',
|
||||
'optionalChaining',
|
||||
'nullishCoalescingOperator'
|
||||
];
|
||||
const EMPTY_OBJ = {};
|
||||
const EMPTY_ARR = [];
|
||||
const NOOP = () => { };
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
const NO = () => false;
|
||||
const onRE = /^on[^a-z]/;
|
||||
const isOn = (key) => onRE.test(key);
|
||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
||||
const isDate = (val) => val instanceof Date;
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const isPromise = (val) => {
|
||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
',key,ref,' +
|
||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const toHandlerKey = cacheStringFunction((str) => (str ? `on${capitalize(str)}` : ``));
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return (_globalThis ||
|
||||
(_globalThis =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {}));
|
||||
};
|
||||
|
||||
exports.EMPTY_ARR = EMPTY_ARR;
|
||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||
exports.NO = NO;
|
||||
exports.NOOP = NOOP;
|
||||
exports.PatchFlagNames = PatchFlagNames;
|
||||
exports.babelParserDefaultPlugins = babelParserDefaultPlugins;
|
||||
exports.camelize = camelize;
|
||||
exports.capitalize = capitalize;
|
||||
exports.def = def;
|
||||
exports.escapeHtml = escapeHtml;
|
||||
exports.escapeHtmlComment = escapeHtmlComment;
|
||||
exports.extend = extend;
|
||||
exports.generateCodeFrame = generateCodeFrame;
|
||||
exports.getGlobalThis = getGlobalThis;
|
||||
exports.hasChanged = hasChanged;
|
||||
exports.hasOwn = hasOwn;
|
||||
exports.hyphenate = hyphenate;
|
||||
exports.invokeArrayFns = invokeArrayFns;
|
||||
exports.isArray = isArray;
|
||||
exports.isBooleanAttr = isBooleanAttr;
|
||||
exports.isDate = isDate;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isGloballyWhitelisted = isGloballyWhitelisted;
|
||||
exports.isHTMLTag = isHTMLTag;
|
||||
exports.isIntegerKey = isIntegerKey;
|
||||
exports.isKnownAttr = isKnownAttr;
|
||||
exports.isMap = isMap;
|
||||
exports.isModelListener = isModelListener;
|
||||
exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
|
||||
exports.isObject = isObject;
|
||||
exports.isOn = isOn;
|
||||
exports.isPlainObject = isPlainObject;
|
||||
exports.isPromise = isPromise;
|
||||
exports.isReservedProp = isReservedProp;
|
||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||
exports.isSVGTag = isSVGTag;
|
||||
exports.isSet = isSet;
|
||||
exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
||||
exports.isString = isString;
|
||||
exports.isSymbol = isSymbol;
|
||||
exports.isVoidTag = isVoidTag;
|
||||
exports.looseEqual = looseEqual;
|
||||
exports.looseIndexOf = looseIndexOf;
|
||||
exports.makeMap = makeMap;
|
||||
exports.normalizeClass = normalizeClass;
|
||||
exports.normalizeStyle = normalizeStyle;
|
||||
exports.objectToString = objectToString;
|
||||
exports.parseStringStyle = parseStringStyle;
|
||||
exports.propsToAttrMap = propsToAttrMap;
|
||||
exports.remove = remove;
|
||||
exports.stringifyStyle = stringifyStyle;
|
||||
exports.toDisplayString = toDisplayString;
|
||||
exports.toHandlerKey = toHandlerKey;
|
||||
exports.toNumber = toNumber;
|
||||
exports.toRawType = toRawType;
|
||||
exports.toTypeString = toTypeString;
|
||||
221
node_modules/@vue/shared/dist/shared.d.ts
generated
vendored
Normal file
221
node_modules/@vue/shared/dist/shared.d.ts
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
|
||||
/**
|
||||
* List of @babel/parser plugins that are used for template expression
|
||||
* transforms and SFC script transforms. By default we enable proposals slated
|
||||
* for ES2020. This will need to be updated as the spec moves forward.
|
||||
* Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
*/
|
||||
export declare const babelParserDefaultPlugins: readonly ["bigInt", "optionalChaining", "nullishCoalescingOperator"];
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const camelize: (str: string) => string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const capitalize: (str: string) => string;
|
||||
|
||||
export declare const def: (obj: object, key: string | symbol, value: any) => void;
|
||||
|
||||
export declare const EMPTY_ARR: readonly never[];
|
||||
|
||||
export declare const EMPTY_OBJ: {
|
||||
readonly [key: string]: any;
|
||||
};
|
||||
|
||||
export declare function escapeHtml(string: unknown): string;
|
||||
|
||||
export declare function escapeHtmlComment(src: string): string;
|
||||
|
||||
export declare const extend: {
|
||||
<T, U>(target: T, source: U): T & U;
|
||||
<T_1, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
||||
<T_2, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
||||
(target: object, ...sources: any[]): any;
|
||||
};
|
||||
|
||||
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
||||
|
||||
export declare const getGlobalThis: () => any;
|
||||
|
||||
export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
||||
|
||||
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const hyphenate: (str: string) => string;
|
||||
|
||||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
||||
|
||||
export declare const isArray: (arg: any) => arg is any[];
|
||||
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
export declare const isBooleanAttr: (key: string) => boolean;
|
||||
|
||||
export declare const isDate: (val: unknown) => val is Date;
|
||||
|
||||
export declare const isFunction: (val: unknown) => val is Function;
|
||||
|
||||
export declare const isGloballyWhitelisted: (key: string) => boolean;
|
||||
|
||||
export declare const isHTMLTag: (key: string) => boolean;
|
||||
|
||||
export declare const isIntegerKey: (key: unknown) => boolean;
|
||||
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
export declare const isKnownAttr: (key: string) => boolean;
|
||||
|
||||
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
||||
|
||||
export declare const isModelListener: (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
export declare const isNoUnitNumericStyleProp: (key: string) => boolean;
|
||||
|
||||
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
||||
|
||||
export declare const isOn: (key: string) => boolean;
|
||||
|
||||
export declare const isPlainObject: (val: unknown) => val is object;
|
||||
|
||||
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
||||
|
||||
export declare const isReservedProp: (key: string) => boolean;
|
||||
|
||||
export declare const isSet: (val: unknown) => val is Set<any>;
|
||||
|
||||
export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
||||
|
||||
export declare function isSSRSafeAttrName(name: string): boolean;
|
||||
|
||||
export declare const isString: (val: unknown) => val is string;
|
||||
|
||||
export declare const isSVGTag: (key: string) => boolean;
|
||||
|
||||
export declare const isSymbol: (val: unknown) => val is symbol;
|
||||
|
||||
export declare const isVoidTag: (key: string) => boolean;
|
||||
|
||||
export declare function looseEqual(a: any, b: any): boolean;
|
||||
|
||||
export declare function looseIndexOf(arr: any[], val: any): number;
|
||||
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
||||
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
export declare const NO: () => boolean;
|
||||
|
||||
export declare const NOOP: () => void;
|
||||
|
||||
export declare function normalizeClass(value: unknown): string;
|
||||
|
||||
export declare type NormalizedStyle = Record<string, string | number>;
|
||||
|
||||
export declare function normalizeStyle(value: unknown): NormalizedStyle | undefined;
|
||||
|
||||
export declare const objectToString: () => string;
|
||||
|
||||
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
||||
|
||||
export declare const PatchFlagNames: {
|
||||
[x: number]: string;
|
||||
};
|
||||
|
||||
export declare const enum PatchFlags {
|
||||
TEXT = 1,
|
||||
CLASS = 2,
|
||||
STYLE = 4,
|
||||
PROPS = 8,
|
||||
FULL_PROPS = 16,
|
||||
HYDRATE_EVENTS = 32,
|
||||
STABLE_FRAGMENT = 64,
|
||||
KEYED_FRAGMENT = 128,
|
||||
UNKEYED_FRAGMENT = 256,
|
||||
NEED_PATCH = 512,
|
||||
DYNAMIC_SLOTS = 1024,
|
||||
HOISTED = -1,
|
||||
BAIL = -2
|
||||
}
|
||||
|
||||
export declare const propsToAttrMap: Record<string, string | undefined>;
|
||||
|
||||
export declare const remove: <T>(arr: T[], el: T) => void;
|
||||
|
||||
export declare const enum ShapeFlags {
|
||||
ELEMENT = 1,
|
||||
FUNCTIONAL_COMPONENT = 2,
|
||||
STATEFUL_COMPONENT = 4,
|
||||
TEXT_CHILDREN = 8,
|
||||
ARRAY_CHILDREN = 16,
|
||||
SLOTS_CHILDREN = 32,
|
||||
TELEPORT = 64,
|
||||
SUSPENSE = 128,
|
||||
COMPONENT_SHOULD_KEEP_ALIVE = 256,
|
||||
COMPONENT_KEPT_ALIVE = 512,
|
||||
COMPONENT = 6
|
||||
}
|
||||
|
||||
export declare const enum SlotFlags {
|
||||
/**
|
||||
* Stable slots that only reference slot props or context state. The slot
|
||||
* can fully capture its own dependencies so when passed down the parent won't
|
||||
* need to force the child to update.
|
||||
*/
|
||||
STABLE = 1,
|
||||
/**
|
||||
* Slots that reference scope variables (v-for or an outer slot prop), or
|
||||
* has conditional structure (v-if, v-for). The parent will need to force
|
||||
* the child to update because the slot does not fully capture its dependencies.
|
||||
*/
|
||||
DYNAMIC = 2,
|
||||
/**
|
||||
* `<slot/>` being forwarded into a child component. Whether the parent needs
|
||||
* to update the child is dependent on what kind of slots the parent itself
|
||||
* received. This has to be refined at runtime, when the child's vnode
|
||||
* is being created (in `normalizeChildren`)
|
||||
*/
|
||||
FORWARDED = 3
|
||||
}
|
||||
|
||||
export declare function stringifyStyle(styles: NormalizedStyle | undefined): string;
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
export declare const toDisplayString: (val: unknown) => string;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export declare const toHandlerKey: (str: string) => string;
|
||||
|
||||
export declare const toNumber: (val: any) => any;
|
||||
|
||||
export declare const toRawType: (value: unknown) => string;
|
||||
|
||||
export declare const toTypeString: (value: unknown) => string;
|
||||
|
||||
export { }
|
||||
489
node_modules/@vue/shared/dist/shared.esm-bundler.js
generated
vendored
Normal file
489
node_modules/@vue/shared/dist/shared.esm-bundler.js
generated
vendored
Normal file
@@ -0,0 +1,489 @@
|
||||
/**
|
||||
* Make a map and return a function for checking if a key
|
||||
* is in that map.
|
||||
* IMPORTANT: all calls of this function must be prefixed with
|
||||
* \/\*#\_\_PURE\_\_\*\/
|
||||
* So that rollup can tree-shake them if necessary.
|
||||
*/
|
||||
function makeMap(str, expectsLowerCase) {
|
||||
const map = Object.create(null);
|
||||
const list = str.split(',');
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
map[list[i]] = true;
|
||||
}
|
||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
||||
}
|
||||
|
||||
// Patch flags are optimization hints generated by the compiler.
|
||||
// when a block with dynamicChildren is encountered during diff, the algorithm
|
||||
// enters "optimized mode". In this mode, we know that the vdom is produced by
|
||||
// a render function generated by the compiler, so the algorithm only needs to
|
||||
// handle updates explicitly marked by these patch flags.
|
||||
// dev only flag -> name mapping
|
||||
const PatchFlagNames = {
|
||||
[1 /* TEXT */]: `TEXT`,
|
||||
[2 /* CLASS */]: `CLASS`,
|
||||
[4 /* STYLE */]: `STYLE`,
|
||||
[8 /* PROPS */]: `PROPS`,
|
||||
[16 /* FULL_PROPS */]: `FULL_PROPS`,
|
||||
[32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
||||
[64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
||||
[128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
||||
[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
||||
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
||||
[512 /* NEED_PATCH */]: `NEED_PATCH`,
|
||||
[-1 /* HOISTED */]: `HOISTED`,
|
||||
[-2 /* BAIL */]: `BAIL`
|
||||
};
|
||||
|
||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl';
|
||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
||||
|
||||
const range = 2;
|
||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||
const lines = source.split(/\r?\n/);
|
||||
let count = 0;
|
||||
const res = [];
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
count += lines[i].length + 1;
|
||||
if (count >= start) {
|
||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||
if (j < 0 || j >= lines.length)
|
||||
continue;
|
||||
const line = j + 1;
|
||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
||||
const lineLength = lines[j].length;
|
||||
if (j === i) {
|
||||
// push underline
|
||||
const pad = start - (count - lineLength) + 1;
|
||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
||||
}
|
||||
else if (j > i) {
|
||||
if (end > count) {
|
||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||
res.push(` | ` + '^'.repeat(length));
|
||||
}
|
||||
count += lineLength + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* On the client we only need to offer special cases for boolean attributes that
|
||||
* have different names from their corresponding dom properties:
|
||||
* - itemscope -> N/A
|
||||
* - allowfullscreen -> allowFullscreen
|
||||
* - formnovalidate -> formNoValidate
|
||||
* - ismap -> isMap
|
||||
* - nomodule -> noModule
|
||||
* - novalidate -> noValidate
|
||||
* - readonly -> readOnly
|
||||
*/
|
||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
||||
/**
|
||||
* The full list is needed during SSR to produce the correct initial markup.
|
||||
*/
|
||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
||||
`loop,open,required,reversed,scoped,seamless,` +
|
||||
`checked,muted,multiple,selected`);
|
||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||
const attrValidationCache = {};
|
||||
function isSSRSafeAttrName(name) {
|
||||
if (attrValidationCache.hasOwnProperty(name)) {
|
||||
return attrValidationCache[name];
|
||||
}
|
||||
const isUnsafe = unsafeAttrCharRE.test(name);
|
||||
if (isUnsafe) {
|
||||
console.error(`unsafe attribute name: ${name}`);
|
||||
}
|
||||
return (attrValidationCache[name] = !isUnsafe);
|
||||
}
|
||||
const propsToAttrMap = {
|
||||
acceptCharset: 'accept-charset',
|
||||
className: 'class',
|
||||
htmlFor: 'for',
|
||||
httpEquiv: 'http-equiv'
|
||||
};
|
||||
/**
|
||||
* CSS properties that accept plain numbers
|
||||
*/
|
||||
const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,` +
|
||||
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
|
||||
`columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
|
||||
`grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,` +
|
||||
`grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,` +
|
||||
`line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,` +
|
||||
// SVG
|
||||
`fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
|
||||
`stroke-miterlimit,stroke-opacity,stroke-width`);
|
||||
/**
|
||||
* Known attributes, this is used for stringification of runtime static nodes
|
||||
* so that we don't stringify bindings that cannot be set from HTML.
|
||||
* Don't also forget to allow `data-*` and `aria-*`!
|
||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||
*/
|
||||
const isKnownAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
||||
`value,width,wrap`);
|
||||
|
||||
function normalizeStyle(value) {
|
||||
if (isArray(value)) {
|
||||
const res = {};
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const item = value[i];
|
||||
const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||
const propertyDelimiterRE = /:(.+)/;
|
||||
function parseStringStyle(cssText) {
|
||||
const ret = {};
|
||||
cssText.split(listDelimiterRE).forEach(item => {
|
||||
if (item) {
|
||||
const tmp = item.split(propertyDelimiterRE);
|
||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
function stringifyStyle(styles) {
|
||||
let ret = '';
|
||||
if (!styles) {
|
||||
return ret;
|
||||
}
|
||||
for (const key in styles) {
|
||||
const value = styles[key];
|
||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||
if (isString(value) ||
|
||||
(typeof value === 'number' && isNoUnitNumericStyleProp(normalizedKey))) {
|
||||
// only render valid values
|
||||
ret += `${normalizedKey}:${value};`;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function normalizeClass(value) {
|
||||
let res = '';
|
||||
if (isString(value)) {
|
||||
res = value;
|
||||
}
|
||||
else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
res += normalizeClass(value[i]) + ' ';
|
||||
}
|
||||
}
|
||||
else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim();
|
||||
}
|
||||
|
||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
||||
'header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,' +
|
||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
||||
'data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,' +
|
||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
||||
'summary,template,blockquote,iframe,tfoot';
|
||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
||||
'text,textPath,title,tspan,unknown,use,view';
|
||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
||||
|
||||
const escapeRE = /["'&<>]/;
|
||||
function escapeHtml(string) {
|
||||
const str = '' + string;
|
||||
const match = escapeRE.exec(str);
|
||||
if (!match) {
|
||||
return str;
|
||||
}
|
||||
let html = '';
|
||||
let escaped;
|
||||
let index;
|
||||
let lastIndex = 0;
|
||||
for (index = match.index; index < str.length; index++) {
|
||||
switch (str.charCodeAt(index)) {
|
||||
case 34: // "
|
||||
escaped = '"';
|
||||
break;
|
||||
case 38: // &
|
||||
escaped = '&';
|
||||
break;
|
||||
case 39: // '
|
||||
escaped = ''';
|
||||
break;
|
||||
case 60: // <
|
||||
escaped = '<';
|
||||
break;
|
||||
case 62: // >
|
||||
escaped = '>';
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (lastIndex !== index) {
|
||||
html += str.substring(lastIndex, index);
|
||||
}
|
||||
lastIndex = index + 1;
|
||||
html += escaped;
|
||||
}
|
||||
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
||||
}
|
||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||
function escapeHtmlComment(src) {
|
||||
return src.replace(commentStripRE, '');
|
||||
}
|
||||
|
||||
function looseCompareArrays(a, b) {
|
||||
if (a.length !== b.length)
|
||||
return false;
|
||||
let equal = true;
|
||||
for (let i = 0; equal && i < a.length; i++) {
|
||||
equal = looseEqual(a[i], b[i]);
|
||||
}
|
||||
return equal;
|
||||
}
|
||||
function looseEqual(a, b) {
|
||||
if (a === b)
|
||||
return true;
|
||||
let aValidType = isDate(a);
|
||||
let bValidType = isDate(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
||||
}
|
||||
aValidType = isArray(a);
|
||||
bValidType = isArray(b);
|
||||
if (aValidType || bValidType) {
|
||||
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
||||
}
|
||||
aValidType = isObject(a);
|
||||
bValidType = isObject(b);
|
||||
if (aValidType || bValidType) {
|
||||
/* istanbul ignore if: this if will probably never be called */
|
||||
if (!aValidType || !bValidType) {
|
||||
return false;
|
||||
}
|
||||
const aKeysCount = Object.keys(a).length;
|
||||
const bKeysCount = Object.keys(b).length;
|
||||
if (aKeysCount !== bKeysCount) {
|
||||
return false;
|
||||
}
|
||||
for (const key in a) {
|
||||
const aHasKey = a.hasOwnProperty(key);
|
||||
const bHasKey = b.hasOwnProperty(key);
|
||||
if ((aHasKey && !bHasKey) ||
|
||||
(!aHasKey && bHasKey) ||
|
||||
!looseEqual(a[key], b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return String(a) === String(b);
|
||||
}
|
||||
function looseIndexOf(arr, val) {
|
||||
return arr.findIndex(item => looseEqual(item, val));
|
||||
}
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
const toDisplayString = (val) => {
|
||||
return val == null
|
||||
? ''
|
||||
: isObject(val)
|
||||
? JSON.stringify(val, replacer, 2)
|
||||
: String(val);
|
||||
};
|
||||
const replacer = (_key, val) => {
|
||||
if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
||||
entries[`${key} =>`] = val;
|
||||
return entries;
|
||||
}, {})
|
||||
};
|
||||
}
|
||||
else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()]
|
||||
};
|
||||
}
|
||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||
return String(val);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* List of @babel/parser plugins that are used for template expression
|
||||
* transforms and SFC script transforms. By default we enable proposals slated
|
||||
* for ES2020. This will need to be updated as the spec moves forward.
|
||||
* Full list at https://babeljs.io/docs/en/next/babel-parser#plugins
|
||||
*/
|
||||
const babelParserDefaultPlugins = [
|
||||
'bigInt',
|
||||
'optionalChaining',
|
||||
'nullishCoalescingOperator'
|
||||
];
|
||||
const EMPTY_OBJ = (process.env.NODE_ENV !== 'production')
|
||||
? Object.freeze({})
|
||||
: {};
|
||||
const EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
|
||||
const NOOP = () => { };
|
||||
/**
|
||||
* Always return false.
|
||||
*/
|
||||
const NO = () => false;
|
||||
const onRE = /^on[^a-z]/;
|
||||
const isOn = (key) => onRE.test(key);
|
||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
||||
const extend = Object.assign;
|
||||
const remove = (arr, el) => {
|
||||
const i = arr.indexOf(el);
|
||||
if (i > -1) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
};
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||
const isArray = Array.isArray;
|
||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
||||
const isDate = (val) => val instanceof Date;
|
||||
const isFunction = (val) => typeof val === 'function';
|
||||
const isString = (val) => typeof val === 'string';
|
||||
const isSymbol = (val) => typeof val === 'symbol';
|
||||
const isObject = (val) => val !== null && typeof val === 'object';
|
||||
const isPromise = (val) => {
|
||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||
};
|
||||
const objectToString = Object.prototype.toString;
|
||||
const toTypeString = (value) => objectToString.call(value);
|
||||
const toRawType = (value) => {
|
||||
// extract "RawType" from strings like "[object RawType]"
|
||||
return toTypeString(value).slice(8, -1);
|
||||
};
|
||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
||||
const isIntegerKey = (key) => isString(key) &&
|
||||
key !== 'NaN' &&
|
||||
key[0] !== '-' &&
|
||||
'' + parseInt(key, 10) === key;
|
||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
',key,ref,' +
|
||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
||||
const cacheStringFunction = (fn) => {
|
||||
const cache = Object.create(null);
|
||||
return ((str) => {
|
||||
const hit = cache[str];
|
||||
return hit || (cache[str] = fn(str));
|
||||
});
|
||||
};
|
||||
const camelizeRE = /-(\w)/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const camelize = cacheStringFunction((str) => {
|
||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
||||
});
|
||||
const hyphenateRE = /\B([A-Z])/g;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
const toHandlerKey = cacheStringFunction((str) => (str ? `on${capitalize(str)}` : ``));
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
const hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
||||
const invokeArrayFns = (fns, arg) => {
|
||||
for (let i = 0; i < fns.length; i++) {
|
||||
fns[i](arg);
|
||||
}
|
||||
};
|
||||
const def = (obj, key, value) => {
|
||||
Object.defineProperty(obj, key, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
value
|
||||
});
|
||||
};
|
||||
const toNumber = (val) => {
|
||||
const n = parseFloat(val);
|
||||
return isNaN(n) ? val : n;
|
||||
};
|
||||
let _globalThis;
|
||||
const getGlobalThis = () => {
|
||||
return (_globalThis ||
|
||||
(_globalThis =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {}));
|
||||
};
|
||||
|
||||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, babelParserDefaultPlugins, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, invokeArrayFns, isArray, isBooleanAttr, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
||||
7
node_modules/@vue/shared/index.js
generated
vendored
Normal file
7
node_modules/@vue/shared/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./dist/shared.cjs.prod.js')
|
||||
} else {
|
||||
module.exports = require('./dist/shared.cjs.js')
|
||||
}
|
||||
72
node_modules/@vue/shared/package.json
generated
vendored
Normal file
72
node_modules/@vue/shared/package.json
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@vue/shared@3.0.2",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@vue/shared@3.0.2",
|
||||
"_id": "@vue/shared@3.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-QZvYWi69vU9Clj6YxaGxA0Uhdtk=",
|
||||
"_location": "/@vue/shared",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@vue/shared@3.0.2",
|
||||
"name": "@vue/shared",
|
||||
"escapedName": "@vue%2fshared",
|
||||
"scope": "@vue",
|
||||
"rawSpec": "3.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/compiler-core",
|
||||
"/@vue/compiler-dom",
|
||||
"/@vue/compiler-sfc",
|
||||
"/@vue/compiler-ssr",
|
||||
"/@vue/reactivity",
|
||||
"/@vue/runtime-core",
|
||||
"/@vue/runtime-dom",
|
||||
"/@vue/server-renderer",
|
||||
"/vue"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@vue%2fshared/-/shared-3.0.2.tgz",
|
||||
"_spec": "3.0.2",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Evan You"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vue-next/issues"
|
||||
},
|
||||
"buildOptions": {
|
||||
"formats": [
|
||||
"esm-bundler",
|
||||
"cjs"
|
||||
]
|
||||
},
|
||||
"description": "internal utils shared across @vue packages",
|
||||
"files": [
|
||||
"index.js",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/shared#readme",
|
||||
"keywords": [
|
||||
"vue"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"module": "dist/shared.esm-bundler.js",
|
||||
"name": "@vue/shared",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vue-next.git",
|
||||
"directory": "packages/shared"
|
||||
},
|
||||
"types": "dist/shared.d.ts",
|
||||
"version": "3.0.2"
|
||||
}
|
||||
Reference in New Issue
Block a user