@kg-ui/kg-ui-plus 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/KgCopilot/CopiContent/AnswerHead.vue.mjs +16 -0
- package/dist/es/KgCopilot/CopiContent/AnswerHead.vue2.mjs +4 -0
- package/dist/es/KgCopilot/CopiContent/UserHead.vue.mjs +26 -0
- package/dist/es/KgCopilot/CopiContent/UserHead.vue2.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue2.mjs +49 -0
- package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue2.mjs +94 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue2.mjs +33 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue2.mjs +140 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue2.mjs +131 -0
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/index.vue.mjs +7 -0
- package/dist/es/KgCopilot/CopiFooter/index.vue2.mjs +21 -0
- package/dist/es/KgCopilot/CopiFooter/index.vue3.mjs +4 -0
- package/dist/es/KgCopilot/dialogue.vue.mjs +7 -0
- package/dist/es/KgCopilot/dialogue.vue2.mjs +131 -0
- package/dist/es/KgCopilot/dialogue.vue3.mjs +4 -0
- package/dist/es/KgCopilot/index.vue.mjs +7 -0
- package/dist/es/KgCopilot/index.vue2.mjs +49 -0
- package/dist/es/KgCopilot/index.vue3.mjs +4 -0
- package/dist/es/KgCopilot/mdInCode.mjs +56 -0
- package/dist/es/KgCopilot/readMd.vue.mjs +7 -0
- package/dist/es/KgCopilot/readMd.vue2.mjs +87 -0
- package/dist/es/KgCopilot/readMd.vue3.mjs +4 -0
- package/dist/es/ReIcon/index.mjs +11 -0
- package/dist/es/ReIcon/src/iconfont.mjs +46 -0
- package/dist/es/ReIcon/src/iconifyIconOffline.mjs +30 -0
- package/dist/es/ReIcon/src/iconifyIconOnline.mjs +29 -0
- package/dist/es/_virtual/___vite-browser-external.mjs +6 -0
- package/dist/es/_virtual/__vite-browser-external.mjs +4 -0
- package/dist/es/_virtual/_commonjsHelpers.mjs +34 -0
- package/dist/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
- package/dist/es/_virtual/index.mjs +13 -0
- package/dist/es/api/project.mjs +51 -0
- package/dist/es/directives/heighlight/index.mjs +69 -0
- package/dist/es/directives/index.mjs +4 -0
- package/dist/es/home/LFilter/FilterArea.vue.mjs +7 -0
- package/dist/es/home/LFilter/FilterArea.vue2.mjs +507 -0
- package/dist/es/home/LFilter/FilterArea.vue3.mjs +4 -0
- package/dist/es/home/LFilter/FilterHead.vue.mjs +129 -0
- package/dist/es/home/LFilter/FilterHead.vue2.mjs +4 -0
- package/dist/es/home/LFilter/FilterItem.vue.mjs +7 -0
- package/dist/es/home/LFilter/FilterItem.vue2.mjs +114 -0
- package/dist/es/home/LFilter/FilterItem.vue3.mjs +4 -0
- package/dist/es/home/LFilter/FilterItemIcon.vue.mjs +7 -0
- package/dist/es/home/LFilter/FilterItemIcon.vue2.mjs +171 -0
- package/dist/es/home/LFilter/FilterItemIcon.vue3.mjs +4 -0
- package/dist/es/home/LFilter/index.vue.mjs +17 -0
- package/dist/es/home/LFilter/index.vue2.mjs +4 -0
- package/dist/es/home/LProject/index.vue.mjs +7 -0
- package/dist/es/home/LProject/index.vue2.mjs +70 -0
- package/dist/es/home/LProject/index.vue3.mjs +4 -0
- package/dist/es/home/index.vue.mjs +7 -0
- package/dist/es/home/index.vue2.mjs +80 -0
- package/dist/es/home/index.vue3.mjs +4 -0
- package/dist/es/index.mjs +36 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/check.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/circle-plus.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/close.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/microphone.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/paperclip.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/promotion.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/upload.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/copy-simple.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/speaker-high-light.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-down-thin.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-up-thin.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/warning-bold.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/add-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/arrow-down-s-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/arrow-up-s-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/check-fill.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/download-line.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/more-2-fill.mjs +8 -0
- package/dist/es/node_modules/.pnpm/@iconify_vue@4.0.0_vue@3.2.45/node_modules/@iconify/vue/dist/iconify.mjs +1702 -0
- package/dist/es/node_modules/.pnpm/@iconify_vue@4.0.0_vue@3.2.45/node_modules/@iconify/vue/dist/offline.mjs +436 -0
- package/dist/es/node_modules/.pnpm/@pureadmin_utils@1.8.5_vue@3.2.45/node_modules/@pureadmin/utils/dist/index.mjs +70 -0
- package/dist/es/node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/callBound.mjs +16 -0
- package/dist/es/node_modules/.pnpm/call-bind@1.0.7/node_modules/call-bind/index.mjs +36 -0
- package/dist/es/node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.mjs +48 -0
- package/dist/es/node_modules/.pnpm/dompurify@3.0.10/node_modules/dompurify/dist/purify.es.mjs +949 -0
- package/dist/es/node_modules/.pnpm/es-define-property@1.0.0/node_modules/es-define-property/index.mjs +22 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.mjs +4 -0
- package/dist/es/node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.mjs +4 -0
- package/dist/es/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.mjs +72 -0
- package/dist/es/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.mjs +6 -0
- package/dist/es/node_modules/.pnpm/get-intrinsic@1.2.4/node_modules/get-intrinsic/index.mjs +320 -0
- package/dist/es/node_modules/.pnpm/gopd@1.0.1/node_modules/gopd/index.mjs +14 -0
- package/dist/es/node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.mjs +19 -0
- package/dist/es/node_modules/.pnpm/has-proto@1.0.3/node_modules/has-proto/index.mjs +11 -0
- package/dist/es/node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/index.mjs +21 -0
- package/dist/es/node_modules/.pnpm/has-symbols@1.0.3/node_modules/has-symbols/shams.mjs +48 -0
- package/dist/es/node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.mjs +8 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/core.mjs +5 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/apache.mjs +91 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/bash.mjs +377 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/basic.mjs +221 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/c.mjs +280 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/css.mjs +732 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dart.mjs +247 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/django.mjs +47 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dns.mjs +71 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dos.mjs +160 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/dust.mjs +38 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/erlang.mjs +176 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/go.mjs +135 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/http.mjs +89 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/java.mjs +254 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/javascript.mjs +698 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/json.mjs +40 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/markdown.mjs +227 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/nginx.mjs +144 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/php.mjs +589 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/python.mjs +414 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/ruby.mjs +414 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/stylus.mjs +766 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/swift.mjs +832 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/typescript.mjs +788 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/es/languages/xml.mjs +227 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/lib/core.mjs +1580 -0
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/styles/paraiso-light.css.mjs +4 -0
- package/dist/es/node_modules/.pnpm/marked@12.0.1/node_modules/marked/lib/marked.esm.mjs +2045 -0
- package/dist/es/node_modules/.pnpm/object-inspect@1.13.1/node_modules/object-inspect/index.mjs +514 -0
- package/dist/es/node_modules/.pnpm/pinyin-match@1.2.4/node_modules/pinyin-match/es/main.mjs +124 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/formats.mjs +22 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/index.mjs +14 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/parse.mjs +199 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/stringify.mjs +262 -0
- package/dist/es/node_modules/.pnpm/qs@6.11.0/node_modules/qs/lib/utils.mjs +196 -0
- package/dist/es/node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.mjs +54 -0
- package/dist/es/node_modules/.pnpm/side-channel@1.0.6/node_modules/side-channel/index.mjs +115 -0
- package/dist/es/store/index.mjs +8 -0
- package/dist/es/store/modules/copilot.mjs +108 -0
- package/dist/es/store/modules/filters.mjs +346 -0
- package/dist/es/store/modules/types.mjs +19 -0
- package/dist/es/style/index.scss.mjs +4 -0
- package/dist/es/style/tailwind.css.mjs +4 -0
- package/dist/es/style.css +1 -0
- package/dist/es/utils/home.mjs +129 -0
- package/dist/es/utils/http/index.mjs +90 -0
- package/dist/es/utils/message.mjs +42 -0
- package/package.json +1 -1
@@ -0,0 +1,589 @@
|
|
1
|
+
function php(hljs) {
|
2
|
+
const regex = hljs.regex;
|
3
|
+
const NOT_PERL_ETC = /(?![A-Za-z0-9])(?![$])/;
|
4
|
+
const IDENT_RE = regex.concat(
|
5
|
+
/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,
|
6
|
+
NOT_PERL_ETC
|
7
|
+
);
|
8
|
+
const PASCAL_CASE_CLASS_NAME_RE = regex.concat(
|
9
|
+
/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,
|
10
|
+
NOT_PERL_ETC
|
11
|
+
);
|
12
|
+
const VARIABLE = {
|
13
|
+
scope: "variable",
|
14
|
+
match: "\\$+" + IDENT_RE
|
15
|
+
};
|
16
|
+
const PREPROCESSOR = {
|
17
|
+
scope: "meta",
|
18
|
+
variants: [
|
19
|
+
{ begin: /<\?php/, relevance: 10 },
|
20
|
+
// boost for obvious PHP
|
21
|
+
{ begin: /<\?=/ },
|
22
|
+
// less relevant per PSR-1 which says not to use short-tags
|
23
|
+
{ begin: /<\?/, relevance: 0.1 },
|
24
|
+
{ begin: /\?>/ }
|
25
|
+
// end php tag
|
26
|
+
]
|
27
|
+
};
|
28
|
+
const SUBST = {
|
29
|
+
scope: "subst",
|
30
|
+
variants: [
|
31
|
+
{ begin: /\$\w+/ },
|
32
|
+
{
|
33
|
+
begin: /\{\$/,
|
34
|
+
end: /\}/
|
35
|
+
}
|
36
|
+
]
|
37
|
+
};
|
38
|
+
const SINGLE_QUOTED = hljs.inherit(hljs.APOS_STRING_MODE, { illegal: null });
|
39
|
+
const DOUBLE_QUOTED = hljs.inherit(hljs.QUOTE_STRING_MODE, {
|
40
|
+
illegal: null,
|
41
|
+
contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST)
|
42
|
+
});
|
43
|
+
const HEREDOC = {
|
44
|
+
begin: /<<<[ \t]*(?:(\w+)|"(\w+)")\n/,
|
45
|
+
end: /[ \t]*(\w+)\b/,
|
46
|
+
contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST),
|
47
|
+
"on:begin": (m, resp) => {
|
48
|
+
resp.data._beginMatch = m[1] || m[2];
|
49
|
+
},
|
50
|
+
"on:end": (m, resp) => {
|
51
|
+
if (resp.data._beginMatch !== m[1])
|
52
|
+
resp.ignoreMatch();
|
53
|
+
}
|
54
|
+
};
|
55
|
+
const NOWDOC = hljs.END_SAME_AS_BEGIN({
|
56
|
+
begin: /<<<[ \t]*'(\w+)'\n/,
|
57
|
+
end: /[ \t]*(\w+)\b/
|
58
|
+
});
|
59
|
+
const WHITESPACE = "[ \n]";
|
60
|
+
const STRING = {
|
61
|
+
scope: "string",
|
62
|
+
variants: [
|
63
|
+
DOUBLE_QUOTED,
|
64
|
+
SINGLE_QUOTED,
|
65
|
+
HEREDOC,
|
66
|
+
NOWDOC
|
67
|
+
]
|
68
|
+
};
|
69
|
+
const NUMBER = {
|
70
|
+
scope: "number",
|
71
|
+
variants: [
|
72
|
+
{ begin: `\\b0[bB][01]+(?:_[01]+)*\\b` },
|
73
|
+
// Binary w/ underscore support
|
74
|
+
{ begin: `\\b0[oO][0-7]+(?:_[0-7]+)*\\b` },
|
75
|
+
// Octals w/ underscore support
|
76
|
+
{ begin: `\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b` },
|
77
|
+
// Hex w/ underscore support
|
78
|
+
// Decimals w/ underscore support, with optional fragments and scientific exponent (e) suffix.
|
79
|
+
{ begin: `(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?` }
|
80
|
+
],
|
81
|
+
relevance: 0
|
82
|
+
};
|
83
|
+
const LITERALS = [
|
84
|
+
"false",
|
85
|
+
"null",
|
86
|
+
"true"
|
87
|
+
];
|
88
|
+
const KWS = [
|
89
|
+
// Magic constants:
|
90
|
+
// <https://www.php.net/manual/en/language.constants.predefined.php>
|
91
|
+
"__CLASS__",
|
92
|
+
"__DIR__",
|
93
|
+
"__FILE__",
|
94
|
+
"__FUNCTION__",
|
95
|
+
"__COMPILER_HALT_OFFSET__",
|
96
|
+
"__LINE__",
|
97
|
+
"__METHOD__",
|
98
|
+
"__NAMESPACE__",
|
99
|
+
"__TRAIT__",
|
100
|
+
// Function that look like language construct or language construct that look like function:
|
101
|
+
// List of keywords that may not require parenthesis
|
102
|
+
"die",
|
103
|
+
"echo",
|
104
|
+
"exit",
|
105
|
+
"include",
|
106
|
+
"include_once",
|
107
|
+
"print",
|
108
|
+
"require",
|
109
|
+
"require_once",
|
110
|
+
// These are not language construct (function) but operate on the currently-executing function and can access the current symbol table
|
111
|
+
// 'compact extract func_get_arg func_get_args func_num_args get_called_class get_parent_class ' +
|
112
|
+
// Other keywords:
|
113
|
+
// <https://www.php.net/manual/en/reserved.php>
|
114
|
+
// <https://www.php.net/manual/en/language.types.type-juggling.php>
|
115
|
+
"array",
|
116
|
+
"abstract",
|
117
|
+
"and",
|
118
|
+
"as",
|
119
|
+
"binary",
|
120
|
+
"bool",
|
121
|
+
"boolean",
|
122
|
+
"break",
|
123
|
+
"callable",
|
124
|
+
"case",
|
125
|
+
"catch",
|
126
|
+
"class",
|
127
|
+
"clone",
|
128
|
+
"const",
|
129
|
+
"continue",
|
130
|
+
"declare",
|
131
|
+
"default",
|
132
|
+
"do",
|
133
|
+
"double",
|
134
|
+
"else",
|
135
|
+
"elseif",
|
136
|
+
"empty",
|
137
|
+
"enddeclare",
|
138
|
+
"endfor",
|
139
|
+
"endforeach",
|
140
|
+
"endif",
|
141
|
+
"endswitch",
|
142
|
+
"endwhile",
|
143
|
+
"enum",
|
144
|
+
"eval",
|
145
|
+
"extends",
|
146
|
+
"final",
|
147
|
+
"finally",
|
148
|
+
"float",
|
149
|
+
"for",
|
150
|
+
"foreach",
|
151
|
+
"from",
|
152
|
+
"global",
|
153
|
+
"goto",
|
154
|
+
"if",
|
155
|
+
"implements",
|
156
|
+
"instanceof",
|
157
|
+
"insteadof",
|
158
|
+
"int",
|
159
|
+
"integer",
|
160
|
+
"interface",
|
161
|
+
"isset",
|
162
|
+
"iterable",
|
163
|
+
"list",
|
164
|
+
"match|0",
|
165
|
+
"mixed",
|
166
|
+
"new",
|
167
|
+
"never",
|
168
|
+
"object",
|
169
|
+
"or",
|
170
|
+
"private",
|
171
|
+
"protected",
|
172
|
+
"public",
|
173
|
+
"readonly",
|
174
|
+
"real",
|
175
|
+
"return",
|
176
|
+
"string",
|
177
|
+
"switch",
|
178
|
+
"throw",
|
179
|
+
"trait",
|
180
|
+
"try",
|
181
|
+
"unset",
|
182
|
+
"use",
|
183
|
+
"var",
|
184
|
+
"void",
|
185
|
+
"while",
|
186
|
+
"xor",
|
187
|
+
"yield"
|
188
|
+
];
|
189
|
+
const BUILT_INS = [
|
190
|
+
// Standard PHP library:
|
191
|
+
// <https://www.php.net/manual/en/book.spl.php>
|
192
|
+
"Error|0",
|
193
|
+
"AppendIterator",
|
194
|
+
"ArgumentCountError",
|
195
|
+
"ArithmeticError",
|
196
|
+
"ArrayIterator",
|
197
|
+
"ArrayObject",
|
198
|
+
"AssertionError",
|
199
|
+
"BadFunctionCallException",
|
200
|
+
"BadMethodCallException",
|
201
|
+
"CachingIterator",
|
202
|
+
"CallbackFilterIterator",
|
203
|
+
"CompileError",
|
204
|
+
"Countable",
|
205
|
+
"DirectoryIterator",
|
206
|
+
"DivisionByZeroError",
|
207
|
+
"DomainException",
|
208
|
+
"EmptyIterator",
|
209
|
+
"ErrorException",
|
210
|
+
"Exception",
|
211
|
+
"FilesystemIterator",
|
212
|
+
"FilterIterator",
|
213
|
+
"GlobIterator",
|
214
|
+
"InfiniteIterator",
|
215
|
+
"InvalidArgumentException",
|
216
|
+
"IteratorIterator",
|
217
|
+
"LengthException",
|
218
|
+
"LimitIterator",
|
219
|
+
"LogicException",
|
220
|
+
"MultipleIterator",
|
221
|
+
"NoRewindIterator",
|
222
|
+
"OutOfBoundsException",
|
223
|
+
"OutOfRangeException",
|
224
|
+
"OuterIterator",
|
225
|
+
"OverflowException",
|
226
|
+
"ParentIterator",
|
227
|
+
"ParseError",
|
228
|
+
"RangeException",
|
229
|
+
"RecursiveArrayIterator",
|
230
|
+
"RecursiveCachingIterator",
|
231
|
+
"RecursiveCallbackFilterIterator",
|
232
|
+
"RecursiveDirectoryIterator",
|
233
|
+
"RecursiveFilterIterator",
|
234
|
+
"RecursiveIterator",
|
235
|
+
"RecursiveIteratorIterator",
|
236
|
+
"RecursiveRegexIterator",
|
237
|
+
"RecursiveTreeIterator",
|
238
|
+
"RegexIterator",
|
239
|
+
"RuntimeException",
|
240
|
+
"SeekableIterator",
|
241
|
+
"SplDoublyLinkedList",
|
242
|
+
"SplFileInfo",
|
243
|
+
"SplFileObject",
|
244
|
+
"SplFixedArray",
|
245
|
+
"SplHeap",
|
246
|
+
"SplMaxHeap",
|
247
|
+
"SplMinHeap",
|
248
|
+
"SplObjectStorage",
|
249
|
+
"SplObserver",
|
250
|
+
"SplPriorityQueue",
|
251
|
+
"SplQueue",
|
252
|
+
"SplStack",
|
253
|
+
"SplSubject",
|
254
|
+
"SplTempFileObject",
|
255
|
+
"TypeError",
|
256
|
+
"UnderflowException",
|
257
|
+
"UnexpectedValueException",
|
258
|
+
"UnhandledMatchError",
|
259
|
+
// Reserved interfaces:
|
260
|
+
// <https://www.php.net/manual/en/reserved.interfaces.php>
|
261
|
+
"ArrayAccess",
|
262
|
+
"BackedEnum",
|
263
|
+
"Closure",
|
264
|
+
"Fiber",
|
265
|
+
"Generator",
|
266
|
+
"Iterator",
|
267
|
+
"IteratorAggregate",
|
268
|
+
"Serializable",
|
269
|
+
"Stringable",
|
270
|
+
"Throwable",
|
271
|
+
"Traversable",
|
272
|
+
"UnitEnum",
|
273
|
+
"WeakReference",
|
274
|
+
"WeakMap",
|
275
|
+
// Reserved classes:
|
276
|
+
// <https://www.php.net/manual/en/reserved.classes.php>
|
277
|
+
"Directory",
|
278
|
+
"__PHP_Incomplete_Class",
|
279
|
+
"parent",
|
280
|
+
"php_user_filter",
|
281
|
+
"self",
|
282
|
+
"static",
|
283
|
+
"stdClass"
|
284
|
+
];
|
285
|
+
const dualCase = (items) => {
|
286
|
+
const result = [];
|
287
|
+
items.forEach((item) => {
|
288
|
+
result.push(item);
|
289
|
+
if (item.toLowerCase() === item) {
|
290
|
+
result.push(item.toUpperCase());
|
291
|
+
} else {
|
292
|
+
result.push(item.toLowerCase());
|
293
|
+
}
|
294
|
+
});
|
295
|
+
return result;
|
296
|
+
};
|
297
|
+
const KEYWORDS = {
|
298
|
+
keyword: KWS,
|
299
|
+
literal: dualCase(LITERALS),
|
300
|
+
built_in: BUILT_INS
|
301
|
+
};
|
302
|
+
const normalizeKeywords = (items) => {
|
303
|
+
return items.map((item) => {
|
304
|
+
return item.replace(/\|\d+$/, "");
|
305
|
+
});
|
306
|
+
};
|
307
|
+
const CONSTRUCTOR_CALL = { variants: [
|
308
|
+
{
|
309
|
+
match: [
|
310
|
+
/new/,
|
311
|
+
regex.concat(WHITESPACE, "+"),
|
312
|
+
// to prevent built ins from being confused as the class constructor call
|
313
|
+
regex.concat("(?!", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"),
|
314
|
+
PASCAL_CASE_CLASS_NAME_RE
|
315
|
+
],
|
316
|
+
scope: {
|
317
|
+
1: "keyword",
|
318
|
+
4: "title.class"
|
319
|
+
}
|
320
|
+
}
|
321
|
+
] };
|
322
|
+
const CONSTANT_REFERENCE = regex.concat(IDENT_RE, "\\b(?!\\()");
|
323
|
+
const LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON = { variants: [
|
324
|
+
{
|
325
|
+
match: [
|
326
|
+
regex.concat(
|
327
|
+
/::/,
|
328
|
+
regex.lookahead(/(?!class\b)/)
|
329
|
+
),
|
330
|
+
CONSTANT_REFERENCE
|
331
|
+
],
|
332
|
+
scope: { 2: "variable.constant" }
|
333
|
+
},
|
334
|
+
{
|
335
|
+
match: [
|
336
|
+
/::/,
|
337
|
+
/class/
|
338
|
+
],
|
339
|
+
scope: { 2: "variable.language" }
|
340
|
+
},
|
341
|
+
{
|
342
|
+
match: [
|
343
|
+
PASCAL_CASE_CLASS_NAME_RE,
|
344
|
+
regex.concat(
|
345
|
+
/::/,
|
346
|
+
regex.lookahead(/(?!class\b)/)
|
347
|
+
),
|
348
|
+
CONSTANT_REFERENCE
|
349
|
+
],
|
350
|
+
scope: {
|
351
|
+
1: "title.class",
|
352
|
+
3: "variable.constant"
|
353
|
+
}
|
354
|
+
},
|
355
|
+
{
|
356
|
+
match: [
|
357
|
+
PASCAL_CASE_CLASS_NAME_RE,
|
358
|
+
regex.concat(
|
359
|
+
"::",
|
360
|
+
regex.lookahead(/(?!class\b)/)
|
361
|
+
)
|
362
|
+
],
|
363
|
+
scope: { 1: "title.class" }
|
364
|
+
},
|
365
|
+
{
|
366
|
+
match: [
|
367
|
+
PASCAL_CASE_CLASS_NAME_RE,
|
368
|
+
/::/,
|
369
|
+
/class/
|
370
|
+
],
|
371
|
+
scope: {
|
372
|
+
1: "title.class",
|
373
|
+
3: "variable.language"
|
374
|
+
}
|
375
|
+
}
|
376
|
+
] };
|
377
|
+
const NAMED_ARGUMENT = {
|
378
|
+
scope: "attr",
|
379
|
+
match: regex.concat(IDENT_RE, regex.lookahead(":"), regex.lookahead(/(?!::)/))
|
380
|
+
};
|
381
|
+
const PARAMS_MODE = {
|
382
|
+
relevance: 0,
|
383
|
+
begin: /\(/,
|
384
|
+
end: /\)/,
|
385
|
+
keywords: KEYWORDS,
|
386
|
+
contains: [
|
387
|
+
NAMED_ARGUMENT,
|
388
|
+
VARIABLE,
|
389
|
+
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
|
390
|
+
hljs.C_BLOCK_COMMENT_MODE,
|
391
|
+
STRING,
|
392
|
+
NUMBER,
|
393
|
+
CONSTRUCTOR_CALL
|
394
|
+
]
|
395
|
+
};
|
396
|
+
const FUNCTION_INVOKE = {
|
397
|
+
relevance: 0,
|
398
|
+
match: [
|
399
|
+
/\b/,
|
400
|
+
// to prevent keywords from being confused as the function title
|
401
|
+
regex.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"),
|
402
|
+
IDENT_RE,
|
403
|
+
regex.concat(WHITESPACE, "*"),
|
404
|
+
regex.lookahead(/(?=\()/)
|
405
|
+
],
|
406
|
+
scope: { 3: "title.function.invoke" },
|
407
|
+
contains: [PARAMS_MODE]
|
408
|
+
};
|
409
|
+
PARAMS_MODE.contains.push(FUNCTION_INVOKE);
|
410
|
+
const ATTRIBUTE_CONTAINS = [
|
411
|
+
NAMED_ARGUMENT,
|
412
|
+
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
|
413
|
+
hljs.C_BLOCK_COMMENT_MODE,
|
414
|
+
STRING,
|
415
|
+
NUMBER,
|
416
|
+
CONSTRUCTOR_CALL
|
417
|
+
];
|
418
|
+
const ATTRIBUTES = {
|
419
|
+
begin: regex.concat(/#\[\s*/, PASCAL_CASE_CLASS_NAME_RE),
|
420
|
+
beginScope: "meta",
|
421
|
+
end: /]/,
|
422
|
+
endScope: "meta",
|
423
|
+
keywords: {
|
424
|
+
literal: LITERALS,
|
425
|
+
keyword: [
|
426
|
+
"new",
|
427
|
+
"array"
|
428
|
+
]
|
429
|
+
},
|
430
|
+
contains: [
|
431
|
+
{
|
432
|
+
begin: /\[/,
|
433
|
+
end: /]/,
|
434
|
+
keywords: {
|
435
|
+
literal: LITERALS,
|
436
|
+
keyword: [
|
437
|
+
"new",
|
438
|
+
"array"
|
439
|
+
]
|
440
|
+
},
|
441
|
+
contains: [
|
442
|
+
"self",
|
443
|
+
...ATTRIBUTE_CONTAINS
|
444
|
+
]
|
445
|
+
},
|
446
|
+
...ATTRIBUTE_CONTAINS,
|
447
|
+
{
|
448
|
+
scope: "meta",
|
449
|
+
match: PASCAL_CASE_CLASS_NAME_RE
|
450
|
+
}
|
451
|
+
]
|
452
|
+
};
|
453
|
+
return {
|
454
|
+
case_insensitive: false,
|
455
|
+
keywords: KEYWORDS,
|
456
|
+
contains: [
|
457
|
+
ATTRIBUTES,
|
458
|
+
hljs.HASH_COMMENT_MODE,
|
459
|
+
hljs.COMMENT("//", "$"),
|
460
|
+
hljs.COMMENT(
|
461
|
+
"/\\*",
|
462
|
+
"\\*/",
|
463
|
+
{ contains: [
|
464
|
+
{
|
465
|
+
scope: "doctag",
|
466
|
+
match: "@[A-Za-z]+"
|
467
|
+
}
|
468
|
+
] }
|
469
|
+
),
|
470
|
+
{
|
471
|
+
match: /__halt_compiler\(\);/,
|
472
|
+
keywords: "__halt_compiler",
|
473
|
+
starts: {
|
474
|
+
scope: "comment",
|
475
|
+
end: hljs.MATCH_NOTHING_RE,
|
476
|
+
contains: [
|
477
|
+
{
|
478
|
+
match: /\?>/,
|
479
|
+
scope: "meta",
|
480
|
+
endsParent: true
|
481
|
+
}
|
482
|
+
]
|
483
|
+
}
|
484
|
+
},
|
485
|
+
PREPROCESSOR,
|
486
|
+
{
|
487
|
+
scope: "variable.language",
|
488
|
+
match: /\$this\b/
|
489
|
+
},
|
490
|
+
VARIABLE,
|
491
|
+
FUNCTION_INVOKE,
|
492
|
+
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
|
493
|
+
{
|
494
|
+
match: [
|
495
|
+
/const/,
|
496
|
+
/\s/,
|
497
|
+
IDENT_RE
|
498
|
+
],
|
499
|
+
scope: {
|
500
|
+
1: "keyword",
|
501
|
+
3: "variable.constant"
|
502
|
+
}
|
503
|
+
},
|
504
|
+
CONSTRUCTOR_CALL,
|
505
|
+
{
|
506
|
+
scope: "function",
|
507
|
+
relevance: 0,
|
508
|
+
beginKeywords: "fn function",
|
509
|
+
end: /[;{]/,
|
510
|
+
excludeEnd: true,
|
511
|
+
illegal: "[$%\\[]",
|
512
|
+
contains: [
|
513
|
+
{ beginKeywords: "use" },
|
514
|
+
hljs.UNDERSCORE_TITLE_MODE,
|
515
|
+
{
|
516
|
+
begin: "=>",
|
517
|
+
// No markup, just a relevance booster
|
518
|
+
endsParent: true
|
519
|
+
},
|
520
|
+
{
|
521
|
+
scope: "params",
|
522
|
+
begin: "\\(",
|
523
|
+
end: "\\)",
|
524
|
+
excludeBegin: true,
|
525
|
+
excludeEnd: true,
|
526
|
+
keywords: KEYWORDS,
|
527
|
+
contains: [
|
528
|
+
"self",
|
529
|
+
VARIABLE,
|
530
|
+
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
|
531
|
+
hljs.C_BLOCK_COMMENT_MODE,
|
532
|
+
STRING,
|
533
|
+
NUMBER
|
534
|
+
]
|
535
|
+
}
|
536
|
+
]
|
537
|
+
},
|
538
|
+
{
|
539
|
+
scope: "class",
|
540
|
+
variants: [
|
541
|
+
{
|
542
|
+
beginKeywords: "enum",
|
543
|
+
illegal: /[($"]/
|
544
|
+
},
|
545
|
+
{
|
546
|
+
beginKeywords: "class interface trait",
|
547
|
+
illegal: /[:($"]/
|
548
|
+
}
|
549
|
+
],
|
550
|
+
relevance: 0,
|
551
|
+
end: /\{/,
|
552
|
+
excludeEnd: true,
|
553
|
+
contains: [
|
554
|
+
{ beginKeywords: "extends implements" },
|
555
|
+
hljs.UNDERSCORE_TITLE_MODE
|
556
|
+
]
|
557
|
+
},
|
558
|
+
// both use and namespace still use "old style" rules (vs multi-match)
|
559
|
+
// because the namespace name can include `\` and we still want each
|
560
|
+
// element to be treated as its own *individual* title
|
561
|
+
{
|
562
|
+
beginKeywords: "namespace",
|
563
|
+
relevance: 0,
|
564
|
+
end: ";",
|
565
|
+
illegal: /[.']/,
|
566
|
+
contains: [hljs.inherit(hljs.UNDERSCORE_TITLE_MODE, { scope: "title.class" })]
|
567
|
+
},
|
568
|
+
{
|
569
|
+
beginKeywords: "use",
|
570
|
+
relevance: 0,
|
571
|
+
end: ";",
|
572
|
+
contains: [
|
573
|
+
// TODO: title.function vs title.class
|
574
|
+
{
|
575
|
+
match: /\b(as|const|function)\b/,
|
576
|
+
scope: "keyword"
|
577
|
+
},
|
578
|
+
// TODO: could be title.class or title.function
|
579
|
+
hljs.UNDERSCORE_TITLE_MODE
|
580
|
+
]
|
581
|
+
},
|
582
|
+
STRING,
|
583
|
+
NUMBER
|
584
|
+
]
|
585
|
+
};
|
586
|
+
}
|
587
|
+
export {
|
588
|
+
php as default
|
589
|
+
};
|