first commit
This commit is contained in:
96
node_modules/vant/lib/highlight/Highlight.d.ts
generated
vendored
Normal file
96
node_modules/vant/lib/highlight/Highlight.d.ts
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import { type ExtractPropTypes, type PropType } from 'vue';
|
||||
export declare const highlightProps: {
|
||||
autoEscape: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
caseSensitive: BooleanConstructor;
|
||||
highlightClass: StringConstructor;
|
||||
highlightTag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
keywords: {
|
||||
type: PropType<string | string[]>;
|
||||
required: true;
|
||||
};
|
||||
sourceString: {
|
||||
type: PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
tag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
unhighlightClass: StringConstructor;
|
||||
unhighlightTag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
};
|
||||
export type HighlightProps = ExtractPropTypes<typeof highlightProps>;
|
||||
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
||||
autoEscape: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
caseSensitive: BooleanConstructor;
|
||||
highlightClass: StringConstructor;
|
||||
highlightTag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
keywords: {
|
||||
type: PropType<string | string[]>;
|
||||
required: true;
|
||||
};
|
||||
sourceString: {
|
||||
type: PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
tag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
unhighlightClass: StringConstructor;
|
||||
unhighlightTag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
||||
autoEscape: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
caseSensitive: BooleanConstructor;
|
||||
highlightClass: StringConstructor;
|
||||
highlightTag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
keywords: {
|
||||
type: PropType<string | string[]>;
|
||||
required: true;
|
||||
};
|
||||
sourceString: {
|
||||
type: PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
tag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
unhighlightClass: StringConstructor;
|
||||
unhighlightTag: {
|
||||
type: PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
}>> & Readonly<{}>, {
|
||||
tag: keyof HTMLElementTagNameMap;
|
||||
autoEscape: boolean;
|
||||
caseSensitive: boolean;
|
||||
highlightTag: keyof HTMLElementTagNameMap;
|
||||
sourceString: string;
|
||||
unhighlightTag: keyof HTMLElementTagNameMap;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
||||
export default _default;
|
||||
147
node_modules/vant/lib/highlight/Highlight.js
generated
vendored
Normal file
147
node_modules/vant/lib/highlight/Highlight.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name2 in all)
|
||||
__defProp(target, name2, { get: all[name2], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
default: () => stdin_default,
|
||||
highlightProps: () => highlightProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_vue = require("vue");
|
||||
var import_utils = require("../utils");
|
||||
const [name, bem] = (0, import_utils.createNamespace)("highlight");
|
||||
const highlightProps = {
|
||||
autoEscape: import_utils.truthProp,
|
||||
caseSensitive: Boolean,
|
||||
highlightClass: String,
|
||||
highlightTag: (0, import_utils.makeStringProp)("span"),
|
||||
keywords: (0, import_utils.makeRequiredProp)([String, Array]),
|
||||
sourceString: (0, import_utils.makeStringProp)(""),
|
||||
tag: (0, import_utils.makeStringProp)("div"),
|
||||
unhighlightClass: String,
|
||||
unhighlightTag: (0, import_utils.makeStringProp)("span")
|
||||
};
|
||||
var stdin_default = (0, import_vue.defineComponent)({
|
||||
name,
|
||||
props: highlightProps,
|
||||
setup(props) {
|
||||
const highlightChunks = (0, import_vue.computed)(() => {
|
||||
const {
|
||||
autoEscape,
|
||||
caseSensitive,
|
||||
keywords,
|
||||
sourceString
|
||||
} = props;
|
||||
const flags = caseSensitive ? "g" : "gi";
|
||||
const _keywords = Array.isArray(keywords) ? keywords : [keywords];
|
||||
let chunks = _keywords.filter((keyword) => keyword).reduce((chunks2, keyword) => {
|
||||
if (autoEscape) {
|
||||
keyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
const regex = new RegExp(keyword, flags);
|
||||
let match;
|
||||
while (match = regex.exec(sourceString)) {
|
||||
const start = match.index;
|
||||
const end = regex.lastIndex;
|
||||
if (start >= end) {
|
||||
regex.lastIndex++;
|
||||
continue;
|
||||
}
|
||||
chunks2.push({
|
||||
start,
|
||||
end,
|
||||
highlight: true
|
||||
});
|
||||
}
|
||||
return chunks2;
|
||||
}, []);
|
||||
chunks = chunks.sort((a, b) => a.start - b.start).reduce((chunks2, currentChunk) => {
|
||||
const prevChunk = chunks2[chunks2.length - 1];
|
||||
if (!prevChunk || currentChunk.start > prevChunk.end) {
|
||||
const unhighlightStart = prevChunk ? prevChunk.end : 0;
|
||||
const unhighlightEnd = currentChunk.start;
|
||||
if (unhighlightStart !== unhighlightEnd) {
|
||||
chunks2.push({
|
||||
start: unhighlightStart,
|
||||
end: unhighlightEnd,
|
||||
highlight: false
|
||||
});
|
||||
}
|
||||
chunks2.push(currentChunk);
|
||||
} else {
|
||||
prevChunk.end = Math.max(prevChunk.end, currentChunk.end);
|
||||
}
|
||||
return chunks2;
|
||||
}, []);
|
||||
const lastChunk = chunks[chunks.length - 1];
|
||||
if (!lastChunk) {
|
||||
chunks.push({
|
||||
start: 0,
|
||||
end: sourceString.length,
|
||||
highlight: false
|
||||
});
|
||||
}
|
||||
if (lastChunk && lastChunk.end < sourceString.length) {
|
||||
chunks.push({
|
||||
start: lastChunk.end,
|
||||
end: sourceString.length,
|
||||
highlight: false
|
||||
});
|
||||
}
|
||||
return chunks;
|
||||
});
|
||||
const renderContent = () => {
|
||||
const {
|
||||
sourceString,
|
||||
highlightClass,
|
||||
unhighlightClass,
|
||||
highlightTag,
|
||||
unhighlightTag
|
||||
} = props;
|
||||
return highlightChunks.value.map((chunk) => {
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
highlight
|
||||
} = chunk;
|
||||
const text = sourceString.slice(start, end);
|
||||
if (highlight) {
|
||||
return (0, import_vue.createVNode)(highlightTag, {
|
||||
"class": [bem("tag"), highlightClass]
|
||||
}, {
|
||||
default: () => [text]
|
||||
});
|
||||
}
|
||||
return (0, import_vue.createVNode)(unhighlightTag, {
|
||||
"class": unhighlightClass
|
||||
}, {
|
||||
default: () => [text]
|
||||
});
|
||||
});
|
||||
};
|
||||
return () => {
|
||||
const {
|
||||
tag
|
||||
} = props;
|
||||
return (0, import_vue.createVNode)(tag, {
|
||||
"class": bem()
|
||||
}, {
|
||||
default: () => [renderContent()]
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
1
node_modules/vant/lib/highlight/index.css
generated
vendored
Normal file
1
node_modules/vant/lib/highlight/index.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
:root,:host{--van-highlight-tag-color: var(--van-primary-color)}.van-highlight__tag{color:var(--van-highlight-tag-color)}
|
||||
73
node_modules/vant/lib/highlight/index.d.ts
generated
vendored
Normal file
73
node_modules/vant/lib/highlight/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
export declare const Highlight: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
||||
autoEscape: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
caseSensitive: BooleanConstructor;
|
||||
highlightClass: StringConstructor;
|
||||
highlightTag: {
|
||||
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
keywords: {
|
||||
type: import("vue").PropType<string | string[]>;
|
||||
required: true;
|
||||
};
|
||||
sourceString: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
tag: {
|
||||
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
unhighlightClass: StringConstructor;
|
||||
unhighlightTag: {
|
||||
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
autoEscape: {
|
||||
type: BooleanConstructor;
|
||||
default: true;
|
||||
};
|
||||
caseSensitive: BooleanConstructor;
|
||||
highlightClass: StringConstructor;
|
||||
highlightTag: {
|
||||
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
keywords: {
|
||||
type: import("vue").PropType<string | string[]>;
|
||||
required: true;
|
||||
};
|
||||
sourceString: {
|
||||
type: import("vue").PropType<string>;
|
||||
default: string;
|
||||
};
|
||||
tag: {
|
||||
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
unhighlightClass: StringConstructor;
|
||||
unhighlightTag: {
|
||||
type: import("vue").PropType<keyof HTMLElementTagNameMap>;
|
||||
default: keyof HTMLElementTagNameMap;
|
||||
};
|
||||
}>> & Readonly<{}>, {
|
||||
tag: keyof HTMLElementTagNameMap;
|
||||
autoEscape: boolean;
|
||||
caseSensitive: boolean;
|
||||
highlightTag: keyof HTMLElementTagNameMap;
|
||||
sourceString: string;
|
||||
unhighlightTag: keyof HTMLElementTagNameMap;
|
||||
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
||||
export default Highlight;
|
||||
export { highlightProps } from './Highlight';
|
||||
export type { HighlightProps } from './Highlight';
|
||||
export type { HighlightThemeVars } from './types';
|
||||
declare module 'vue' {
|
||||
interface GlobalComponents {
|
||||
vanHighlight: typeof Highlight;
|
||||
}
|
||||
}
|
||||
39
node_modules/vant/lib/highlight/index.js
generated
vendored
Normal file
39
node_modules/vant/lib/highlight/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
__export(stdin_exports, {
|
||||
Highlight: () => Highlight,
|
||||
default: () => stdin_default,
|
||||
highlightProps: () => import_Highlight2.highlightProps
|
||||
});
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
var import_utils = require("../utils");
|
||||
var import_Highlight = __toESM(require("./Highlight"));
|
||||
var import_Highlight2 = require("./Highlight");
|
||||
const Highlight = (0, import_utils.withInstall)(import_Highlight.default);
|
||||
var stdin_default = Highlight;
|
||||
1
node_modules/vant/lib/highlight/style/index.d.ts
generated
vendored
Normal file
1
node_modules/vant/lib/highlight/style/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
2
node_modules/vant/lib/highlight/style/index.js
generated
vendored
Normal file
2
node_modules/vant/lib/highlight/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
require("../../style/base.css");
|
||||
require("../index.css");
|
||||
3
node_modules/vant/lib/highlight/types.d.ts
generated
vendored
Normal file
3
node_modules/vant/lib/highlight/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export type HighlightThemeVars = {
|
||||
highlightTagColor?: string;
|
||||
};
|
||||
15
node_modules/vant/lib/highlight/types.js
generated
vendored
Normal file
15
node_modules/vant/lib/highlight/types.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var stdin_exports = {};
|
||||
module.exports = __toCommonJS(stdin_exports);
|
||||
Reference in New Issue
Block a user