@veltra/desktop 1.3.0 → 1.3.1
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/components/action/action-group.vue.d.ts +2 -2
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
- package/dist/components/breadcrumb/style2.css +1 -2
- package/dist/components/button/style2.css +3 -3
- package/dist/components/card/style2.css +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +4 -4
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/code-editor/lang-loaders.js +1 -0
- package/dist/components/code-editor/lang-loaders.js.map +1 -1
- package/dist/components/condition-editor/style2.css +2 -4
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
- package/dist/components/input/input.vue.d.ts +3 -3
- package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +4 -4
- package/dist/components/number-input/number-input.vue.d.ts +3 -3
- package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
- package/dist/components/rich-text-editor/style2.css +1 -1
- package/dist/components/select/select.vue.d.ts +1 -1
- package/dist/components/textarea/textarea.vue.d.ts +3 -3
- package/dist/components/tree-select/tree-select.vue.d.ts +3 -3
- package/dist/node_modules/.bun/@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js +914 -0
- package/dist/node_modules/.bun/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js.map +1 -0
- package/dist/node_modules/.bun/@codemirror_lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js +994 -0
- package/dist/node_modules/.bun/@codemirror_lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js.map +1 -0
- package/dist/node_modules/.bun/@codemirror_lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js +471 -0
- package/dist/node_modules/.bun/@codemirror_lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js.map +1 -0
- package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js +71 -1
- package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js +326 -2
- package/dist/node_modules/.bun/@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_css@1.3.4/node_modules/@lezer/css/dist/index.js +250 -0
- package/dist/node_modules/.bun/@lezer_css@1.3.4/node_modules/@lezer/css/dist/index.js.map +1 -0
- package/dist/node_modules/.bun/@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js +1 -1
- package/dist/node_modules/.bun/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js +438 -0
- package/dist/node_modules/.bun/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js.map +1 -0
- package/dist/node_modules/.bun/@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js +1952 -0
- package/dist/node_modules/.bun/@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js.map +1 -0
- package/dist/types/code-editor.d.ts +1 -1
- package/package.json +7 -6
- package/src/components/breadcrumb/style.scss +1 -2
- package/src/components/button/style.scss +6 -4
- package/src/components/card/style.scss +1 -1
- package/src/components/code-editor/lang-loaders.ts +1 -0
- package/src/components/condition-editor/style.scss +2 -4
- package/src/components/rich-text-editor/style.scss +1 -1
- package/src/types/code-editor.ts +9 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../../../../node_modules/.bun/@codemirror+lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js"],"sourcesContent":["import { parser, configureNesting } from '@lezer/html';\nimport { cssLanguage, css } from '@codemirror/lang-css';\nimport { javascriptLanguage, typescriptLanguage, jsxLanguage, tsxLanguage, javascript } from '@codemirror/lang-javascript';\nimport { EditorView } from '@codemirror/view';\nimport { EditorSelection } from '@codemirror/state';\nimport { syntaxTree, LRLanguage, indentNodeProp, foldNodeProp, bracketMatchingHandle, LanguageSupport } from '@codemirror/language';\n\nconst Targets = [\"_blank\", \"_self\", \"_top\", \"_parent\"];\nconst Charsets = [\"ascii\", \"utf-8\", \"utf-16\", \"latin1\", \"latin1\"];\nconst Methods = [\"get\", \"post\", \"put\", \"delete\"];\nconst Encs = [\"application/x-www-form-urlencoded\", \"multipart/form-data\", \"text/plain\"];\nconst Bool = [\"true\", \"false\"];\nconst S = {}; // Empty tag spec\nconst Tags = {\n a: {\n attrs: {\n href: null, ping: null, type: null,\n media: null,\n target: Targets,\n hreflang: null\n }\n },\n abbr: S,\n address: S,\n area: {\n attrs: {\n alt: null, coords: null, href: null, target: null, ping: null,\n media: null, hreflang: null, type: null,\n shape: [\"default\", \"rect\", \"circle\", \"poly\"]\n }\n },\n article: S,\n aside: S,\n audio: {\n attrs: {\n src: null, mediagroup: null,\n crossorigin: [\"anonymous\", \"use-credentials\"],\n preload: [\"none\", \"metadata\", \"auto\"],\n autoplay: [\"autoplay\"],\n loop: [\"loop\"],\n controls: [\"controls\"]\n }\n },\n b: S,\n base: { attrs: { href: null, target: Targets } },\n bdi: S,\n bdo: S,\n blockquote: { attrs: { cite: null } },\n body: S,\n br: S,\n button: {\n attrs: {\n form: null, formaction: null, name: null, value: null,\n autofocus: [\"autofocus\"],\n disabled: [\"autofocus\"],\n formenctype: Encs,\n formmethod: Methods,\n formnovalidate: [\"novalidate\"],\n formtarget: Targets,\n type: [\"submit\", \"reset\", \"button\"]\n }\n },\n canvas: { attrs: { width: null, height: null } },\n caption: S,\n center: S,\n cite: S,\n code: S,\n col: { attrs: { span: null } },\n colgroup: { attrs: { span: null } },\n command: {\n attrs: {\n type: [\"command\", \"checkbox\", \"radio\"],\n label: null, icon: null, radiogroup: null, command: null, title: null,\n disabled: [\"disabled\"],\n checked: [\"checked\"]\n }\n },\n data: { attrs: { value: null } },\n datagrid: { attrs: { disabled: [\"disabled\"], multiple: [\"multiple\"] } },\n datalist: { attrs: { data: null } },\n dd: S,\n del: { attrs: { cite: null, datetime: null } },\n details: { attrs: { open: [\"open\"] } },\n dfn: S,\n div: S,\n dl: S,\n dt: S,\n em: S,\n embed: { attrs: { src: null, type: null, width: null, height: null } },\n eventsource: { attrs: { src: null } },\n fieldset: { attrs: { disabled: [\"disabled\"], form: null, name: null } },\n figcaption: S,\n figure: S,\n footer: S,\n form: {\n attrs: {\n action: null, name: null,\n \"accept-charset\": Charsets,\n autocomplete: [\"on\", \"off\"],\n enctype: Encs,\n method: Methods,\n novalidate: [\"novalidate\"],\n target: Targets\n }\n },\n h1: S, h2: S, h3: S, h4: S, h5: S, h6: S,\n head: {\n children: [\"title\", \"base\", \"link\", \"style\", \"meta\", \"script\", \"noscript\", \"command\"]\n },\n header: S,\n hgroup: S,\n hr: S,\n html: {\n attrs: { manifest: null }\n },\n i: S,\n iframe: {\n attrs: {\n src: null, srcdoc: null, name: null, width: null, height: null,\n sandbox: [\"allow-top-navigation\", \"allow-same-origin\", \"allow-forms\", \"allow-scripts\"],\n seamless: [\"seamless\"]\n }\n },\n img: {\n attrs: {\n alt: null, src: null, ismap: null, usemap: null, width: null, height: null,\n crossorigin: [\"anonymous\", \"use-credentials\"]\n }\n },\n input: {\n attrs: {\n alt: null, dirname: null, form: null, formaction: null,\n height: null, list: null, max: null, maxlength: null, min: null,\n name: null, pattern: null, placeholder: null, size: null, src: null,\n step: null, value: null, width: null,\n accept: [\"audio/*\", \"video/*\", \"image/*\"],\n autocomplete: [\"on\", \"off\"],\n autofocus: [\"autofocus\"],\n checked: [\"checked\"],\n disabled: [\"disabled\"],\n formenctype: Encs,\n formmethod: Methods,\n formnovalidate: [\"novalidate\"],\n formtarget: Targets,\n multiple: [\"multiple\"],\n readonly: [\"readonly\"],\n required: [\"required\"],\n type: [\"hidden\", \"text\", \"search\", \"tel\", \"url\", \"email\", \"password\", \"datetime\", \"date\", \"month\",\n \"week\", \"time\", \"datetime-local\", \"number\", \"range\", \"color\", \"checkbox\", \"radio\",\n \"file\", \"submit\", \"image\", \"reset\", \"button\"]\n }\n },\n ins: { attrs: { cite: null, datetime: null } },\n kbd: S,\n keygen: {\n attrs: {\n challenge: null, form: null, name: null,\n autofocus: [\"autofocus\"],\n disabled: [\"disabled\"],\n keytype: [\"RSA\"]\n }\n },\n label: { attrs: { for: null, form: null } },\n legend: S,\n li: { attrs: { value: null } },\n link: {\n attrs: {\n href: null, type: null,\n hreflang: null,\n media: null,\n sizes: [\"all\", \"16x16\", \"16x16 32x32\", \"16x16 32x32 64x64\"]\n }\n },\n map: { attrs: { name: null } },\n mark: S,\n menu: { attrs: { label: null, type: [\"list\", \"context\", \"toolbar\"] } },\n meta: {\n attrs: {\n content: null,\n charset: Charsets,\n name: [\"viewport\", \"application-name\", \"author\", \"description\", \"generator\", \"keywords\"],\n \"http-equiv\": [\"content-language\", \"content-type\", \"default-style\", \"refresh\"]\n }\n },\n meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },\n nav: S,\n noscript: S,\n object: {\n attrs: {\n data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,\n typemustmatch: [\"typemustmatch\"]\n }\n },\n ol: { attrs: { reversed: [\"reversed\"], start: null, type: [\"1\", \"a\", \"A\", \"i\", \"I\"] },\n children: [\"li\", \"script\", \"template\", \"ul\", \"ol\"] },\n optgroup: { attrs: { disabled: [\"disabled\"], label: null } },\n option: { attrs: { disabled: [\"disabled\"], label: null, selected: [\"selected\"], value: null } },\n output: { attrs: { for: null, form: null, name: null } },\n p: S,\n param: { attrs: { name: null, value: null } },\n pre: S,\n progress: { attrs: { value: null, max: null } },\n q: { attrs: { cite: null } },\n rp: S,\n rt: S,\n ruby: S,\n samp: S,\n script: {\n attrs: {\n type: [\"text/javascript\"],\n src: null,\n async: [\"async\"],\n defer: [\"defer\"],\n charset: Charsets\n }\n },\n section: S,\n select: {\n attrs: {\n form: null, name: null, size: null,\n autofocus: [\"autofocus\"],\n disabled: [\"disabled\"],\n multiple: [\"multiple\"]\n }\n },\n slot: { attrs: { name: null } },\n small: S,\n source: { attrs: { src: null, type: null, media: null } },\n span: S,\n strong: S,\n style: {\n attrs: {\n type: [\"text/css\"],\n media: null,\n scoped: null\n }\n },\n sub: S,\n summary: S,\n sup: S,\n table: S,\n tbody: S,\n td: { attrs: { colspan: null, rowspan: null, headers: null } },\n template: S,\n textarea: {\n attrs: {\n dirname: null, form: null, maxlength: null, name: null, placeholder: null,\n rows: null, cols: null,\n autofocus: [\"autofocus\"],\n disabled: [\"disabled\"],\n readonly: [\"readonly\"],\n required: [\"required\"],\n wrap: [\"soft\", \"hard\"]\n }\n },\n tfoot: S,\n th: { attrs: { colspan: null, rowspan: null, headers: null, scope: [\"row\", \"col\", \"rowgroup\", \"colgroup\"] } },\n thead: S,\n time: { attrs: { datetime: null } },\n title: S,\n tr: S,\n track: {\n attrs: {\n src: null, label: null, default: null,\n kind: [\"subtitles\", \"captions\", \"descriptions\", \"chapters\", \"metadata\"],\n srclang: null\n }\n },\n ul: { children: [\"li\", \"script\", \"template\", \"ul\", \"ol\"] },\n var: S,\n video: {\n attrs: {\n src: null, poster: null, width: null, height: null,\n crossorigin: [\"anonymous\", \"use-credentials\"],\n preload: [\"auto\", \"metadata\", \"none\"],\n autoplay: [\"autoplay\"],\n mediagroup: [\"movie\"],\n muted: [\"muted\"],\n controls: [\"controls\"]\n }\n },\n wbr: S\n};\nconst GlobalAttrs = {\n accesskey: null,\n class: null,\n contenteditable: Bool,\n contextmenu: null,\n dir: [\"ltr\", \"rtl\", \"auto\"],\n draggable: [\"true\", \"false\", \"auto\"],\n dropzone: [\"copy\", \"move\", \"link\", \"string:\", \"file:\"],\n hidden: [\"hidden\"],\n id: null,\n inert: [\"inert\"],\n itemid: null,\n itemprop: null,\n itemref: null,\n itemscope: [\"itemscope\"],\n itemtype: null,\n lang: [\"ar\", \"bn\", \"de\", \"en-GB\", \"en-US\", \"es\", \"fr\", \"hi\", \"id\", \"ja\", \"pa\", \"pt\", \"ru\", \"tr\", \"zh\"],\n spellcheck: Bool,\n autocorrect: Bool,\n autocapitalize: Bool,\n style: null,\n tabindex: null,\n title: null,\n translate: [\"yes\", \"no\"],\n rel: [\"stylesheet\", \"alternate\", \"author\", \"bookmark\", \"help\", \"license\", \"next\", \"nofollow\", \"noreferrer\", \"prefetch\", \"prev\", \"search\", \"tag\"],\n role: /*@__PURE__*/\"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer\".split(\" \"),\n \"aria-activedescendant\": null,\n \"aria-atomic\": Bool,\n \"aria-autocomplete\": [\"inline\", \"list\", \"both\", \"none\"],\n \"aria-busy\": Bool,\n \"aria-checked\": [\"true\", \"false\", \"mixed\", \"undefined\"],\n \"aria-controls\": null,\n \"aria-describedby\": null,\n \"aria-disabled\": Bool,\n \"aria-dropeffect\": null,\n \"aria-expanded\": [\"true\", \"false\", \"undefined\"],\n \"aria-flowto\": null,\n \"aria-grabbed\": [\"true\", \"false\", \"undefined\"],\n \"aria-haspopup\": Bool,\n \"aria-hidden\": Bool,\n \"aria-invalid\": [\"true\", \"false\", \"grammar\", \"spelling\"],\n \"aria-label\": null,\n \"aria-labelledby\": null,\n \"aria-level\": null,\n \"aria-live\": [\"off\", \"polite\", \"assertive\"],\n \"aria-multiline\": Bool,\n \"aria-multiselectable\": Bool,\n \"aria-owns\": null,\n \"aria-posinset\": null,\n \"aria-pressed\": [\"true\", \"false\", \"mixed\", \"undefined\"],\n \"aria-readonly\": Bool,\n \"aria-relevant\": null,\n \"aria-required\": Bool,\n \"aria-selected\": [\"true\", \"false\", \"undefined\"],\n \"aria-setsize\": null,\n \"aria-sort\": [\"ascending\", \"descending\", \"none\", \"other\"],\n \"aria-valuemax\": null,\n \"aria-valuemin\": null,\n \"aria-valuenow\": null,\n \"aria-valuetext\": null\n};\nconst eventAttributes = /*@__PURE__*/(\"beforeunload copy cut dragstart dragover dragleave dragenter dragend \" +\n \"drag paste focus blur change click load mousedown mouseenter mouseleave \" +\n \"mouseup keydown keyup resize scroll unload\").split(\" \").map(n => \"on\" + n);\nfor (let a of eventAttributes)\n GlobalAttrs[a] = null;\nclass Schema {\n constructor(extraTags, extraAttrs) {\n this.tags = { ...Tags, ...extraTags };\n this.globalAttrs = { ...GlobalAttrs, ...extraAttrs };\n this.allTags = Object.keys(this.tags);\n this.globalAttrNames = Object.keys(this.globalAttrs);\n }\n}\nSchema.default = /*@__PURE__*/new Schema;\nfunction elementName(doc, tree, max = doc.length) {\n if (!tree)\n return \"\";\n let tag = tree.firstChild;\n let name = tag && tag.getChild(\"TagName\");\n return name ? doc.sliceString(name.from, Math.min(name.to, max)) : \"\";\n}\nfunction findParentElement(tree, skip = false) {\n for (; tree; tree = tree.parent)\n if (tree.name == \"Element\") {\n if (skip)\n skip = false;\n else\n return tree;\n }\n return null;\n}\nfunction allowedChildren(doc, tree, schema) {\n let parentInfo = schema.tags[elementName(doc, findParentElement(tree))];\n return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags;\n}\nfunction openTags(doc, tree) {\n let open = [];\n for (let parent = findParentElement(tree); parent && !parent.type.isTop; parent = findParentElement(parent.parent)) {\n let tagName = elementName(doc, parent);\n if (tagName && parent.lastChild.name == \"CloseTag\")\n break;\n if (tagName && open.indexOf(tagName) < 0 && (tree.name == \"EndTag\" || tree.from >= parent.firstChild.to))\n open.push(tagName);\n }\n return open;\n}\nconst identifier = /^[:\\-\\.\\w\\u00b7-\\uffff]*$/;\nfunction completeTag(state, schema, tree, from, to) {\n let end = /\\s*>/.test(state.sliceDoc(to, to + 5)) ? \"\" : \">\";\n let parent = findParentElement(tree, tree.name == \"StartTag\" || tree.name == \"TagName\");\n return { from, to,\n options: allowedChildren(state.doc, parent, schema).map(tagName => ({ label: tagName, type: \"type\" })).concat(openTags(state.doc, tree).map((tag, i) => ({ label: \"/\" + tag, apply: \"/\" + tag + end,\n type: \"type\", boost: 99 - i }))),\n validFor: /^\\/?[:\\-\\.\\w\\u00b7-\\uffff]*$/ };\n}\nfunction completeCloseTag(state, tree, from, to) {\n let end = /\\s*>/.test(state.sliceDoc(to, to + 5)) ? \"\" : \">\";\n return { from, to,\n options: openTags(state.doc, tree).map((tag, i) => ({ label: tag, apply: tag + end, type: \"type\", boost: 99 - i })),\n validFor: identifier };\n}\nfunction completeStartTag(state, schema, tree, pos) {\n let options = [], level = 0;\n for (let tagName of allowedChildren(state.doc, tree, schema))\n options.push({ label: \"<\" + tagName, type: \"type\" });\n for (let open of openTags(state.doc, tree))\n options.push({ label: \"</\" + open + \">\", type: \"type\", boost: 99 - level++ });\n return { from: pos, to: pos, options, validFor: /^<\\/?[:\\-\\.\\w\\u00b7-\\uffff]*$/ };\n}\nfunction completeAttrName(state, schema, tree, from, to) {\n let elt = findParentElement(tree), info = elt ? schema.tags[elementName(state.doc, elt)] : null;\n let localAttrs = info && info.attrs ? Object.keys(info.attrs) : [];\n let names = info && info.globalAttrs === false ? localAttrs\n : localAttrs.length ? localAttrs.concat(schema.globalAttrNames) : schema.globalAttrNames;\n return { from, to,\n options: names.map(attrName => ({ label: attrName, type: \"property\" })),\n validFor: identifier };\n}\nfunction completeAttrValue(state, schema, tree, from, to) {\n var _a;\n let nameNode = (_a = tree.parent) === null || _a === void 0 ? void 0 : _a.getChild(\"AttributeName\");\n let options = [], token = undefined;\n if (nameNode) {\n let attrName = state.sliceDoc(nameNode.from, nameNode.to);\n let attrs = schema.globalAttrs[attrName];\n if (!attrs) {\n let elt = findParentElement(tree), info = elt ? schema.tags[elementName(state.doc, elt)] : null;\n attrs = (info === null || info === void 0 ? void 0 : info.attrs) && info.attrs[attrName];\n }\n if (attrs) {\n let base = state.sliceDoc(from, to).toLowerCase(), quoteStart = '\"', quoteEnd = '\"';\n if (/^['\"]/.test(base)) {\n token = base[0] == '\"' ? /^[^\"]*$/ : /^[^']*$/;\n quoteStart = \"\";\n quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? \"\" : base[0];\n base = base.slice(1);\n from++;\n }\n else {\n token = /^[^\\s<>='\"]*$/;\n }\n for (let value of attrs)\n options.push({ label: value, apply: quoteStart + value + quoteEnd, type: \"constant\" });\n }\n }\n return { from, to, options, validFor: token };\n}\nfunction htmlCompletionFor(schema, context) {\n let { state, pos } = context, tree = syntaxTree(state).resolveInner(pos, -1), around = tree.resolve(pos);\n for (let scan = pos, before; around == tree && (before = tree.childBefore(scan));) {\n let last = before.lastChild;\n if (!last || !last.type.isError || last.from < last.to)\n break;\n around = tree = before;\n scan = last.from;\n }\n if (tree.name == \"TagName\") {\n return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos)\n : completeTag(state, schema, tree, tree.from, pos);\n }\n else if (tree.name == \"StartTag\" || tree.name == \"IncompleteTag\") {\n return completeTag(state, schema, tree, pos, pos);\n }\n else if (tree.name == \"StartCloseTag\" || tree.name == \"IncompleteCloseTag\") {\n return completeCloseTag(state, tree, pos, pos);\n }\n else if (tree.name == \"OpenTag\" || tree.name == \"SelfClosingTag\" || tree.name == \"AttributeName\") {\n return completeAttrName(state, schema, tree, tree.name == \"AttributeName\" ? tree.from : pos, pos);\n }\n else if (tree.name == \"Is\" || tree.name == \"AttributeValue\" || tree.name == \"UnquotedAttributeValue\") {\n return completeAttrValue(state, schema, tree, tree.name == \"Is\" ? pos : tree.from, pos);\n }\n else if (context.explicit && (around.name == \"Element\" || around.name == \"Text\" || around.name == \"Document\")) {\n return completeStartTag(state, schema, tree, pos);\n }\n else {\n return null;\n }\n}\n/**\nHTML tag completion. Opens and closes tags and attributes in a\ncontext-aware way.\n*/\nfunction htmlCompletionSource(context) {\n return htmlCompletionFor(Schema.default, context);\n}\n/**\nCreate a completion source for HTML extended with additional tags\nor attributes.\n*/\nfunction htmlCompletionSourceWith(config) {\n let { extraTags, extraGlobalAttributes: extraAttrs } = config;\n let schema = extraAttrs || extraTags ? new Schema(extraTags, extraAttrs) : Schema.default;\n return (context) => htmlCompletionFor(schema, context);\n}\n\nconst jsonParser = /*@__PURE__*/javascriptLanguage.parser.configure({ top: \"SingleExpression\" });\nconst defaultNesting = [\n { tag: \"script\",\n attrs: attrs => attrs.type == \"text/typescript\" || attrs.lang == \"ts\",\n parser: typescriptLanguage.parser },\n { tag: \"script\",\n attrs: attrs => attrs.type == \"text/babel\" || attrs.type == \"text/jsx\",\n parser: jsxLanguage.parser },\n { tag: \"script\",\n attrs: attrs => attrs.type == \"text/typescript-jsx\",\n parser: tsxLanguage.parser },\n { tag: \"script\",\n attrs(attrs) {\n return /^(importmap|speculationrules|application\\/(.+\\+)?json)$/i.test(attrs.type);\n },\n parser: jsonParser },\n { tag: \"script\",\n attrs(attrs) {\n return !attrs.type || /^(?:text|application)\\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type);\n },\n parser: javascriptLanguage.parser },\n { tag: \"style\",\n attrs(attrs) {\n return (!attrs.lang || attrs.lang == \"css\") && (!attrs.type || /^(text\\/)?(x-)?(stylesheet|css)$/i.test(attrs.type));\n },\n parser: cssLanguage.parser }\n];\nconst defaultAttrs = /*@__PURE__*/[\n { name: \"style\",\n parser: /*@__PURE__*/cssLanguage.parser.configure({ top: \"Styles\" }) }\n].concat(/*@__PURE__*/eventAttributes.map(name => ({ name, parser: javascriptLanguage.parser })));\nconst htmlPlain = /*@__PURE__*/LRLanguage.define({\n name: \"html\",\n parser: /*@__PURE__*/parser.configure({\n props: [\n /*@__PURE__*/indentNodeProp.add({\n Element(context) {\n let after = /^(\\s*)(<\\/)?/.exec(context.textAfter);\n if (context.node.to <= context.pos + after[0].length)\n return context.continue();\n return context.lineIndent(context.node.from) + (after[2] ? 0 : context.unit);\n },\n \"OpenTag CloseTag SelfClosingTag\"(context) {\n return context.column(context.node.from) + context.unit;\n },\n Document(context) {\n if (context.pos + /\\s*/.exec(context.textAfter)[0].length < context.node.to)\n return context.continue();\n let endElt = null, close;\n for (let cur = context.node;;) {\n let last = cur.lastChild;\n if (!last || last.name != \"Element\" || last.to != cur.to)\n break;\n endElt = cur = last;\n }\n if (endElt && !((close = endElt.lastChild) && (close.name == \"CloseTag\" || close.name == \"SelfClosingTag\")))\n return context.lineIndent(endElt.from) + context.unit;\n return null;\n }\n }),\n /*@__PURE__*/foldNodeProp.add({\n Element(node) {\n let first = node.firstChild, last = node.lastChild;\n if (!first || first.name != \"OpenTag\")\n return null;\n return { from: first.to, to: last.name == \"CloseTag\" ? last.from : node.to };\n }\n }),\n /*@__PURE__*/bracketMatchingHandle.add({\n \"OpenTag CloseTag\": node => node.getChild(\"TagName\")\n })\n ]\n }),\n languageData: {\n commentTokens: { block: { open: \"<!--\", close: \"-->\" } },\n indentOnInput: /^\\s*<\\/\\w+\\W$/,\n wordChars: \"-_\"\n }\n});\n/**\nA language provider based on the [Lezer HTML\nparser](https://github.com/lezer-parser/html), extended with the\nJavaScript and CSS parsers to parse the content of `<script>` and\n`<style>` tags.\n*/\nconst htmlLanguage = /*@__PURE__*/htmlPlain.configure({\n wrap: /*@__PURE__*/configureNesting(defaultNesting, defaultAttrs)\n});\n/**\nLanguage support for HTML, including\n[`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and\nCSS support extensions.\n*/\nfunction html(config = {}) {\n let dialect = \"\", wrap;\n if (config.matchClosingTags === false)\n dialect = \"noMatch\";\n if (config.selfClosingTags === true)\n dialect = (dialect ? dialect + \" \" : \"\") + \"selfClosing\";\n if (config.nestedLanguages && config.nestedLanguages.length ||\n config.nestedAttributes && config.nestedAttributes.length)\n wrap = configureNesting((config.nestedLanguages || []).concat(defaultNesting), (config.nestedAttributes || []).concat(defaultAttrs));\n let lang = wrap ? htmlPlain.configure({ wrap, dialect }) : dialect ? htmlLanguage.configure({ dialect }) : htmlLanguage;\n return new LanguageSupport(lang, [\n htmlLanguage.data.of({ autocomplete: htmlCompletionSourceWith(config) }),\n config.autoCloseTags !== false ? autoCloseTags : [],\n javascript().support,\n css().support\n ]);\n}\nconst selfClosers = /*@__PURE__*/new Set(/*@__PURE__*/\"area base br col command embed frame hr img input keygen link meta param source track wbr menuitem\".split(\" \"));\n/**\nExtension that will automatically insert close tags when a `>` or\n`/` is typed.\n*/\nconst autoCloseTags = /*@__PURE__*/EditorView.inputHandler.of((view, from, to, text, insertTransaction) => {\n if (view.composing || view.state.readOnly || from != to || (text != \">\" && text != \"/\") ||\n !htmlLanguage.isActiveAt(view.state, from, -1))\n return false;\n let base = insertTransaction(), { state } = base;\n let closeTags = state.changeByRange(range => {\n var _a, _b, _c;\n let didType = state.doc.sliceString(range.from - 1, range.to) == text;\n let { head } = range, after = syntaxTree(state).resolveInner(head, -1), name;\n if (didType && text == \">\" && after.name == \"EndTag\") {\n let tag = after.parent;\n if (((_b = (_a = tag.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != \"CloseTag\" &&\n (name = elementName(state.doc, tag.parent, head)) &&\n !selfClosers.has(name)) {\n let to = head + (state.doc.sliceString(head, head + 1) === \">\" ? 1 : 0);\n let insert = `</${name}>`;\n return { range, changes: { from: head, to, insert } };\n }\n }\n else if (didType && text == \"/\" && after.name == \"IncompleteCloseTag\") {\n let tag = after.parent;\n if (after.from == head - 2 && ((_c = tag.lastChild) === null || _c === void 0 ? void 0 : _c.name) != \"CloseTag\" &&\n (name = elementName(state.doc, tag, head)) && !selfClosers.has(name)) {\n let to = head + (state.doc.sliceString(head, head + 1) === \">\" ? 1 : 0);\n let insert = `${name}>`;\n return {\n range: EditorSelection.cursor(head + insert.length, -1),\n changes: { from: head, to, insert }\n };\n }\n }\n return { range };\n });\n if (closeTags.changes.empty)\n return false;\n view.dispatch([\n base,\n state.update(closeTags, {\n userEvent: \"input.complete\",\n scrollIntoView: true\n })\n ]);\n return true;\n});\n\nexport { autoCloseTags, html, htmlCompletionSource, htmlCompletionSourceWith, htmlLanguage };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAOA,MAAM,UAAU;CAAC;CAAU;CAAS;CAAQ;AAAS;AACrD,MAAM,WAAW;CAAC;CAAS;CAAS;CAAU;CAAU;AAAQ;AAChE,MAAM,UAAU;CAAC;CAAO;CAAQ;CAAO;AAAQ;AAC/C,MAAM,OAAO;CAAC;CAAqC;CAAuB;AAAY;AACtF,MAAM,OAAO,CAAC,QAAQ,OAAO;AAC7B,MAAM,IAAI,CAAC;AACX,MAAM,OAAO;CACT,GAAG,EACC,OAAO;EACH,MAAM;EAAM,MAAM;EAAM,MAAM;EAC9B,OAAO;EACP,QAAQ;EACR,UAAU;CACd,EACJ;CACA,MAAM;CACN,SAAS;CACT,MAAM,EACF,OAAO;EACH,KAAK;EAAM,QAAQ;EAAM,MAAM;EAAM,QAAQ;EAAM,MAAM;EACzD,OAAO;EAAM,UAAU;EAAM,MAAM;EACnC,OAAO;GAAC;GAAW;GAAQ;GAAU;EAAM;CAC/C,EACJ;CACA,SAAS;CACT,OAAO;CACP,OAAO,EACH,OAAO;EACH,KAAK;EAAM,YAAY;EACvB,aAAa,CAAC,aAAa,iBAAiB;EAC5C,SAAS;GAAC;GAAQ;GAAY;EAAM;EACpC,UAAU,CAAC,UAAU;EACrB,MAAM,CAAC,MAAM;EACb,UAAU,CAAC,UAAU;CACzB,EACJ;CACA,GAAG;CACH,MAAM,EAAE,OAAO;EAAE,MAAM;EAAM,QAAQ;CAAQ,EAAE;CAC/C,KAAK;CACL,KAAK;CACL,YAAY,EAAE,OAAO,EAAE,MAAM,KAAK,EAAE;CACpC,MAAM;CACN,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;IACtC;GACJ;EACJ;EACA,OAAO,EAAE,MAAM;CACnB,CAAC;CACD,IAAI,UAAU,QAAQ,OAClB,OAAO;CACX,KAAK,SAAS,CACV,MACA,MAAM,OAAO,WAAW;EACpB,WAAW;EACX,gBAAgB;CACpB,CAAC,CACL,CAAC;CACD,OAAO;AACX,CAAC"}
|
|
@@ -373,6 +373,6 @@ const autoCloseTags = /*@__PURE__*/ EditorView.inputHandler.of((view, from, to,
|
|
|
373
373
|
return true;
|
|
374
374
|
});
|
|
375
375
|
//#endregion
|
|
376
|
-
export { javascript };
|
|
376
|
+
export { javascript, javascriptLanguage, jsxLanguage, tsxLanguage, typescriptLanguage };
|
|
377
377
|
|
|
378
378
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import { EditorSelection, EditorState, Prec, countColumn } from "../../../../../@codemirror_state@6.7.0/node_modules/@codemirror/state/dist/index.js";
|
|
2
|
+
import { EditorView, keymap } from "../../../../../@codemirror_view@6.43.4/node_modules/@codemirror/view/dist/index.js";
|
|
3
|
+
import { NodeProp } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
|
|
4
|
+
import { Language, LanguageDescription, LanguageSupport, ParseContext, defineLanguageFacet, foldNodeProp, foldService, indentNodeProp, indentUnit, languageDataProp, syntaxTree } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
|
|
5
|
+
import { CompletionContext } from "../../../../../@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js";
|
|
6
|
+
import { Emoji, GFM, MarkdownParser, Subscript, Superscript, parseCode, parser } from "../../../../../@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js";
|
|
7
|
+
import { html, htmlCompletionSource } from "../../../../../@codemirror_lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js";
|
|
8
|
+
//#region ../../node_modules/.bun/@codemirror+lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js
|
|
9
|
+
const data = /*@__PURE__*/ defineLanguageFacet({ commentTokens: { block: {
|
|
10
|
+
open: "<!--",
|
|
11
|
+
close: "-->"
|
|
12
|
+
} } });
|
|
13
|
+
const headingProp = /*@__PURE__*/ new NodeProp();
|
|
14
|
+
const commonmark = /*@__PURE__*/ parser.configure({ props: [
|
|
15
|
+
/*@__PURE__*/ foldNodeProp.add((type) => {
|
|
16
|
+
return !type.is("Block") || type.is("Document") || isHeading(type) != null || isList(type) ? void 0 : (tree, state) => ({
|
|
17
|
+
from: state.doc.lineAt(tree.from).to,
|
|
18
|
+
to: tree.to
|
|
19
|
+
});
|
|
20
|
+
}),
|
|
21
|
+
/*@__PURE__*/ headingProp.add(isHeading),
|
|
22
|
+
/*@__PURE__*/ indentNodeProp.add({ Document: () => null }),
|
|
23
|
+
/*@__PURE__*/ languageDataProp.add({ Document: data })
|
|
24
|
+
] });
|
|
25
|
+
function isHeading(type) {
|
|
26
|
+
let match = /^(?:ATX|Setext)Heading(\d)$/.exec(type.name);
|
|
27
|
+
return match ? +match[1] : void 0;
|
|
28
|
+
}
|
|
29
|
+
function isList(type) {
|
|
30
|
+
return type.name == "OrderedList" || type.name == "BulletList";
|
|
31
|
+
}
|
|
32
|
+
function findSectionEnd(headerNode, level) {
|
|
33
|
+
let last = headerNode;
|
|
34
|
+
for (;;) {
|
|
35
|
+
let next = last.nextSibling, heading;
|
|
36
|
+
if (!next || (heading = isHeading(next.type)) != null && heading <= level) break;
|
|
37
|
+
last = next;
|
|
38
|
+
}
|
|
39
|
+
return last.to;
|
|
40
|
+
}
|
|
41
|
+
const headerIndent = /*@__PURE__*/ foldService.of((state, start, end) => {
|
|
42
|
+
for (let node = syntaxTree(state).resolveInner(end, -1); node; node = node.parent) {
|
|
43
|
+
if (node.from < start) break;
|
|
44
|
+
let heading = node.type.prop(headingProp);
|
|
45
|
+
if (heading == null) continue;
|
|
46
|
+
let upto = findSectionEnd(node, heading);
|
|
47
|
+
if (upto > end) return {
|
|
48
|
+
from: end,
|
|
49
|
+
to: upto
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
});
|
|
54
|
+
function mkLang(parser) {
|
|
55
|
+
return new Language(data, parser, [], "markdown");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
Language support for strict CommonMark.
|
|
59
|
+
*/
|
|
60
|
+
const commonmarkLanguage = /*@__PURE__*/ mkLang(commonmark);
|
|
61
|
+
/**
|
|
62
|
+
Language support for [GFM](https://github.github.com/gfm/) plus
|
|
63
|
+
subscript, superscript, and emoji syntax.
|
|
64
|
+
*/
|
|
65
|
+
const markdownLanguage = /*@__PURE__*/ mkLang(/* @__PURE__ */ commonmark.configure([
|
|
66
|
+
GFM,
|
|
67
|
+
Subscript,
|
|
68
|
+
Superscript,
|
|
69
|
+
Emoji,
|
|
70
|
+
{ props: [/*@__PURE__*/ foldNodeProp.add({ Table: (tree, state) => ({
|
|
71
|
+
from: state.doc.lineAt(tree.from).to,
|
|
72
|
+
to: tree.to
|
|
73
|
+
}) })] }
|
|
74
|
+
]));
|
|
75
|
+
function getCodeParser(languages, defaultLanguage) {
|
|
76
|
+
return (info) => {
|
|
77
|
+
if (info && languages) {
|
|
78
|
+
let found = null;
|
|
79
|
+
info = /\S*/.exec(info)[0];
|
|
80
|
+
if (typeof languages == "function") found = languages(info);
|
|
81
|
+
else found = LanguageDescription.matchLanguageName(languages, info, true);
|
|
82
|
+
if (found instanceof LanguageDescription) return found.support ? found.support.language.parser : ParseContext.getSkippingParser(found.load());
|
|
83
|
+
else if (found) return found.parser;
|
|
84
|
+
}
|
|
85
|
+
return defaultLanguage ? defaultLanguage.parser : null;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
var Context = class {
|
|
89
|
+
constructor(node, from, to, spaceBefore, spaceAfter, type, item) {
|
|
90
|
+
this.node = node;
|
|
91
|
+
this.from = from;
|
|
92
|
+
this.to = to;
|
|
93
|
+
this.spaceBefore = spaceBefore;
|
|
94
|
+
this.spaceAfter = spaceAfter;
|
|
95
|
+
this.type = type;
|
|
96
|
+
this.item = item;
|
|
97
|
+
}
|
|
98
|
+
blank(maxWidth, trailing = true) {
|
|
99
|
+
let result = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : "");
|
|
100
|
+
if (maxWidth != null) {
|
|
101
|
+
while (result.length < maxWidth) result += " ";
|
|
102
|
+
return result;
|
|
103
|
+
} else {
|
|
104
|
+
for (let i = this.to - this.from - result.length - this.spaceAfter.length; i > 0; i--) result += " ";
|
|
105
|
+
return result + (trailing ? this.spaceAfter : "");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
marker(doc, add) {
|
|
109
|
+
let number = this.node.name == "OrderedList" ? String(+itemNumber(this.item, doc)[2] + add) : "";
|
|
110
|
+
return this.spaceBefore + number + this.type + this.spaceAfter;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
function getContext(node, doc) {
|
|
114
|
+
let nodes = [], context = [];
|
|
115
|
+
for (let cur = node; cur; cur = cur.parent) {
|
|
116
|
+
if (cur.name == "FencedCode") return context;
|
|
117
|
+
if (cur.name == "ListItem" || cur.name == "Blockquote") nodes.push(cur);
|
|
118
|
+
}
|
|
119
|
+
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
120
|
+
let node = nodes[i], match;
|
|
121
|
+
let line = doc.lineAt(node.from), startPos = node.from - line.from;
|
|
122
|
+
if (node.name == "Blockquote" && (match = /^ *>( ?)/.exec(line.text.slice(startPos)))) context.push(new Context(node, startPos, startPos + match[0].length, "", match[1], ">", null));
|
|
123
|
+
else if (node.name == "ListItem" && node.parent.name == "OrderedList" && (match = /^( *)\d+([.)])( *)/.exec(line.text.slice(startPos)))) {
|
|
124
|
+
let after = match[3], len = match[0].length;
|
|
125
|
+
if (after.length >= 4) {
|
|
126
|
+
after = after.slice(0, after.length - 4);
|
|
127
|
+
len -= 4;
|
|
128
|
+
}
|
|
129
|
+
context.push(new Context(node.parent, startPos, startPos + len, match[1], after, match[2], node));
|
|
130
|
+
} else if (node.name == "ListItem" && node.parent.name == "BulletList" && (match = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(line.text.slice(startPos)))) {
|
|
131
|
+
let after = match[4], len = match[0].length;
|
|
132
|
+
if (after.length > 4) {
|
|
133
|
+
after = after.slice(0, after.length - 4);
|
|
134
|
+
len -= 4;
|
|
135
|
+
}
|
|
136
|
+
let type = match[2];
|
|
137
|
+
if (match[3]) type += match[3].replace(/[xX]/, " ");
|
|
138
|
+
context.push(new Context(node.parent, startPos, startPos + len, match[1], after, type, node));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return context;
|
|
142
|
+
}
|
|
143
|
+
function itemNumber(item, doc) {
|
|
144
|
+
return /^(\s*)(\d+)(?=[.)])/.exec(doc.sliceString(item.from, item.from + 10));
|
|
145
|
+
}
|
|
146
|
+
function renumberList(after, doc, changes, offset = 0) {
|
|
147
|
+
for (let prev = -1, node = after;;) {
|
|
148
|
+
if (node.name == "ListItem") {
|
|
149
|
+
let m = itemNumber(node, doc);
|
|
150
|
+
let number = +m[2];
|
|
151
|
+
if (prev >= 0) {
|
|
152
|
+
if (number != prev + 1) return;
|
|
153
|
+
changes.push({
|
|
154
|
+
from: node.from + m[1].length,
|
|
155
|
+
to: node.from + m[0].length,
|
|
156
|
+
insert: String(prev + 2 + offset)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
prev = number;
|
|
160
|
+
}
|
|
161
|
+
let next = node.nextSibling;
|
|
162
|
+
if (!next) break;
|
|
163
|
+
node = next;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function normalizeIndent(content, state) {
|
|
167
|
+
let blank = /^[ \t]*/.exec(content)[0].length;
|
|
168
|
+
if (!blank || state.facet(indentUnit) != " ") return content;
|
|
169
|
+
let col = countColumn(content, 4, blank);
|
|
170
|
+
let space = "";
|
|
171
|
+
for (let i = col; i > 0;) if (i >= 4) {
|
|
172
|
+
space += " ";
|
|
173
|
+
i -= 4;
|
|
174
|
+
} else {
|
|
175
|
+
space += " ";
|
|
176
|
+
i--;
|
|
177
|
+
}
|
|
178
|
+
return space + content.slice(blank);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
Returns a command like
|
|
182
|
+
[`insertNewlineContinueMarkup`](https://codemirror.net/6/docs/ref/#lang-markdown.insertNewlineContinueMarkup),
|
|
183
|
+
allowing further configuration.
|
|
184
|
+
*/
|
|
185
|
+
const insertNewlineContinueMarkupCommand = (config = {}) => ({ state, dispatch }) => {
|
|
186
|
+
let tree = syntaxTree(state), { doc } = state;
|
|
187
|
+
let dont = null, changes = state.changeByRange((range) => {
|
|
188
|
+
if (!range.empty || !markdownLanguage.isActiveAt(state, range.from, -1) && !markdownLanguage.isActiveAt(state, range.from, 1)) return dont = { range };
|
|
189
|
+
let pos = range.from, line = doc.lineAt(pos);
|
|
190
|
+
let context = getContext(tree.resolveInner(pos, -1), doc);
|
|
191
|
+
while (context.length && context[context.length - 1].from > pos - line.from) context.pop();
|
|
192
|
+
if (!context.length) return dont = { range };
|
|
193
|
+
let inner = context[context.length - 1];
|
|
194
|
+
if (inner.to - inner.spaceAfter.length > pos - line.from) return dont = { range };
|
|
195
|
+
let emptyLine = pos >= inner.to - inner.spaceAfter.length && !/\S/.test(line.text.slice(inner.to));
|
|
196
|
+
if (inner.item && emptyLine) {
|
|
197
|
+
let first = inner.node.firstChild, second = inner.node.getChild("ListItem", "ListItem");
|
|
198
|
+
if (first.to >= pos || second && second.to < pos || line.from > 0 && !/[^\s>]/.test(doc.lineAt(line.from - 1).text) || config.nonTightLists === false) {
|
|
199
|
+
let next = context.length > 1 ? context[context.length - 2] : null;
|
|
200
|
+
let delTo, insert = "";
|
|
201
|
+
if (next && next.item) {
|
|
202
|
+
delTo = line.from + next.from;
|
|
203
|
+
insert = next.marker(doc, 1);
|
|
204
|
+
} else delTo = line.from + (next ? next.to : 0);
|
|
205
|
+
let changes = [{
|
|
206
|
+
from: delTo,
|
|
207
|
+
to: pos,
|
|
208
|
+
insert
|
|
209
|
+
}];
|
|
210
|
+
if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes, -2);
|
|
211
|
+
if (next && next.node.name == "OrderedList") renumberList(next.item, doc, changes);
|
|
212
|
+
return {
|
|
213
|
+
range: EditorSelection.cursor(delTo + insert.length),
|
|
214
|
+
changes
|
|
215
|
+
};
|
|
216
|
+
} else {
|
|
217
|
+
let insert = blankLine(context, state, line);
|
|
218
|
+
return {
|
|
219
|
+
range: EditorSelection.cursor(pos + insert.length + 1),
|
|
220
|
+
changes: {
|
|
221
|
+
from: line.from,
|
|
222
|
+
insert: insert + state.lineBreak
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (inner.node.name == "Blockquote" && emptyLine && line.from) {
|
|
228
|
+
let prevLine = doc.lineAt(line.from - 1), quoted = />\s*$/.exec(prevLine.text);
|
|
229
|
+
if (quoted && quoted.index == inner.from) {
|
|
230
|
+
let changes = state.changes([{
|
|
231
|
+
from: prevLine.from + quoted.index,
|
|
232
|
+
to: prevLine.to
|
|
233
|
+
}, {
|
|
234
|
+
from: line.from + inner.from,
|
|
235
|
+
to: line.to
|
|
236
|
+
}]);
|
|
237
|
+
return {
|
|
238
|
+
range: range.map(changes),
|
|
239
|
+
changes
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
let changes = [];
|
|
244
|
+
if (inner.node.name == "OrderedList") renumberList(inner.item, doc, changes);
|
|
245
|
+
let continued = inner.item && inner.item.from < line.from;
|
|
246
|
+
let insert = "";
|
|
247
|
+
if (!continued || /^[\s\d.)\-+*>]*/.exec(line.text)[0].length >= inner.to) for (let i = 0, e = context.length - 1; i <= e; i++) insert += i == e && !continued ? context[i].marker(doc, 1) : context[i].blank(i < e ? countColumn(line.text, 4, context[i + 1].from) - insert.length : null);
|
|
248
|
+
let from = pos;
|
|
249
|
+
while (from > line.from && /\s/.test(line.text.charAt(from - line.from - 1))) from--;
|
|
250
|
+
insert = normalizeIndent(insert, state);
|
|
251
|
+
if (nonTightList(inner.node, state.doc)) insert = blankLine(context, state, line) + state.lineBreak + insert;
|
|
252
|
+
changes.push({
|
|
253
|
+
from,
|
|
254
|
+
to: pos,
|
|
255
|
+
insert: state.lineBreak + insert
|
|
256
|
+
});
|
|
257
|
+
return {
|
|
258
|
+
range: EditorSelection.cursor(from + insert.length + 1),
|
|
259
|
+
changes
|
|
260
|
+
};
|
|
261
|
+
});
|
|
262
|
+
if (dont) return false;
|
|
263
|
+
dispatch(state.update(changes, {
|
|
264
|
+
scrollIntoView: true,
|
|
265
|
+
userEvent: "input"
|
|
266
|
+
}));
|
|
267
|
+
return true;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
This command, when invoked in Markdown context with cursor
|
|
271
|
+
selection(s), will create a new line with the markup for
|
|
272
|
+
blockquotes and lists that were active on the old line. If the
|
|
273
|
+
cursor was directly after the end of the markup for the old line,
|
|
274
|
+
trailing whitespace and list markers are removed from that line.
|
|
275
|
+
|
|
276
|
+
The command does nothing in non-Markdown context, so it should
|
|
277
|
+
not be used as the only binding for Enter (even in a Markdown
|
|
278
|
+
document, HTML and code regions might use a different language).
|
|
279
|
+
*/
|
|
280
|
+
const insertNewlineContinueMarkup = /*@__PURE__*/ insertNewlineContinueMarkupCommand();
|
|
281
|
+
function isMark(node) {
|
|
282
|
+
return node.name == "QuoteMark" || node.name == "ListMark";
|
|
283
|
+
}
|
|
284
|
+
function nonTightList(node, doc) {
|
|
285
|
+
if (node.name != "OrderedList" && node.name != "BulletList") return false;
|
|
286
|
+
let first = node.firstChild, second = node.getChild("ListItem", "ListItem");
|
|
287
|
+
if (!second) return false;
|
|
288
|
+
let line1 = doc.lineAt(first.to), line2 = doc.lineAt(second.from);
|
|
289
|
+
let empty = /^[\s>]*$/.test(line1.text);
|
|
290
|
+
return line1.number + (empty ? 0 : 1) < line2.number;
|
|
291
|
+
}
|
|
292
|
+
function blankLine(context, state, line) {
|
|
293
|
+
let insert = "";
|
|
294
|
+
for (let i = 0, e = context.length - 2; i <= e; i++) insert += context[i].blank(i < e ? countColumn(line.text, 4, context[i + 1].from) - insert.length : null, i < e);
|
|
295
|
+
return normalizeIndent(insert, state);
|
|
296
|
+
}
|
|
297
|
+
function contextNodeForDelete(tree, pos) {
|
|
298
|
+
let node = tree.resolveInner(pos, -1), scan = pos;
|
|
299
|
+
if (isMark(node)) {
|
|
300
|
+
scan = node.from;
|
|
301
|
+
node = node.parent;
|
|
302
|
+
}
|
|
303
|
+
for (let prev; prev = node.childBefore(scan);) if (isMark(prev)) scan = prev.from;
|
|
304
|
+
else if (prev.name == "OrderedList" || prev.name == "BulletList") {
|
|
305
|
+
node = prev.lastChild;
|
|
306
|
+
scan = node.to;
|
|
307
|
+
} else break;
|
|
308
|
+
return node;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
This command will, when invoked in a Markdown context with the
|
|
312
|
+
cursor directly after list or blockquote markup, delete one level
|
|
313
|
+
of markup. When the markup is for a list, it will be replaced by
|
|
314
|
+
spaces on the first invocation (a further invocation will delete
|
|
315
|
+
the spaces), to make it easy to continue a list.
|
|
316
|
+
|
|
317
|
+
When not after Markdown block markup, this command will return
|
|
318
|
+
false, so it is intended to be bound alongside other deletion
|
|
319
|
+
commands, with a higher precedence than the more generic commands.
|
|
320
|
+
*/
|
|
321
|
+
const deleteMarkupBackward = ({ state, dispatch }) => {
|
|
322
|
+
let tree = syntaxTree(state);
|
|
323
|
+
let dont = null, changes = state.changeByRange((range) => {
|
|
324
|
+
let pos = range.from, { doc } = state;
|
|
325
|
+
if (range.empty && markdownLanguage.isActiveAt(state, range.from)) {
|
|
326
|
+
let line = doc.lineAt(pos);
|
|
327
|
+
let context = getContext(contextNodeForDelete(tree, pos), doc);
|
|
328
|
+
if (context.length) {
|
|
329
|
+
let inner = context[context.length - 1];
|
|
330
|
+
let spaceEnd = inner.to - inner.spaceAfter.length + (inner.spaceAfter ? 1 : 0);
|
|
331
|
+
if (pos - line.from > spaceEnd && !/\S/.test(line.text.slice(spaceEnd, pos - line.from))) return {
|
|
332
|
+
range: EditorSelection.cursor(line.from + spaceEnd),
|
|
333
|
+
changes: {
|
|
334
|
+
from: line.from + spaceEnd,
|
|
335
|
+
to: pos
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
if (pos - line.from == spaceEnd && (inner.item && line.from <= inner.item.from || /^[\s>]*$/.test(line.text.slice(0, inner.to)))) {
|
|
339
|
+
let start = line.from + inner.from;
|
|
340
|
+
if (inner.item && inner.node.from < inner.item.from && /\S/.test(line.text.slice(inner.from, inner.to))) {
|
|
341
|
+
let insert = inner.blank(countColumn(line.text, 4, inner.to) - countColumn(line.text, 4, inner.from));
|
|
342
|
+
if (start == line.from) insert = normalizeIndent(insert, state);
|
|
343
|
+
return {
|
|
344
|
+
range: EditorSelection.cursor(start + insert.length),
|
|
345
|
+
changes: {
|
|
346
|
+
from: start,
|
|
347
|
+
to: line.from + inner.to,
|
|
348
|
+
insert
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
if (start < pos) return {
|
|
353
|
+
range: EditorSelection.cursor(start),
|
|
354
|
+
changes: {
|
|
355
|
+
from: start,
|
|
356
|
+
to: pos
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return dont = { range };
|
|
363
|
+
});
|
|
364
|
+
if (dont) return false;
|
|
365
|
+
dispatch(state.update(changes, {
|
|
366
|
+
scrollIntoView: true,
|
|
367
|
+
userEvent: "delete"
|
|
368
|
+
}));
|
|
369
|
+
return true;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
A small keymap with Markdown-specific bindings. Binds Enter to
|
|
373
|
+
[`insertNewlineContinueMarkup`](https://codemirror.net/6/docs/ref/#lang-markdown.insertNewlineContinueMarkup)
|
|
374
|
+
and Backspace to
|
|
375
|
+
[`deleteMarkupBackward`](https://codemirror.net/6/docs/ref/#lang-markdown.deleteMarkupBackward).
|
|
376
|
+
*/
|
|
377
|
+
const markdownKeymap = [{
|
|
378
|
+
key: "Enter",
|
|
379
|
+
run: insertNewlineContinueMarkup
|
|
380
|
+
}, {
|
|
381
|
+
key: "Backspace",
|
|
382
|
+
run: deleteMarkupBackward
|
|
383
|
+
}];
|
|
384
|
+
const htmlNoMatch = /*@__PURE__*/ html({ matchClosingTags: false });
|
|
385
|
+
/**
|
|
386
|
+
Markdown language support.
|
|
387
|
+
*/
|
|
388
|
+
function markdown(config = {}) {
|
|
389
|
+
let { codeLanguages, defaultCodeLanguage, addKeymap = true, base: { parser } = commonmarkLanguage, completeHTMLTags = true, pasteURLAsLink: pasteURL = true, htmlTagLanguage = htmlNoMatch } = config;
|
|
390
|
+
if (!(parser instanceof MarkdownParser)) throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
|
|
391
|
+
let extensions = config.extensions ? [config.extensions] : [];
|
|
392
|
+
let support = [htmlTagLanguage.support, headerIndent], defaultCode;
|
|
393
|
+
if (pasteURL) support.push(pasteURLAsLink);
|
|
394
|
+
if (defaultCodeLanguage instanceof LanguageSupport) {
|
|
395
|
+
support.push(defaultCodeLanguage.support);
|
|
396
|
+
defaultCode = defaultCodeLanguage.language;
|
|
397
|
+
} else if (defaultCodeLanguage) defaultCode = defaultCodeLanguage;
|
|
398
|
+
let codeParser = codeLanguages || defaultCode ? getCodeParser(codeLanguages, defaultCode) : void 0;
|
|
399
|
+
extensions.push(parseCode({
|
|
400
|
+
codeParser,
|
|
401
|
+
htmlParser: htmlTagLanguage.language.parser
|
|
402
|
+
}));
|
|
403
|
+
if (addKeymap) support.push(Prec.high(keymap.of(markdownKeymap)));
|
|
404
|
+
let lang = mkLang(parser.configure(extensions));
|
|
405
|
+
if (completeHTMLTags) support.push(lang.data.of({ autocomplete: htmlTagCompletion }));
|
|
406
|
+
return new LanguageSupport(lang, support);
|
|
407
|
+
}
|
|
408
|
+
function htmlTagCompletion(context) {
|
|
409
|
+
let { state, pos } = context, m = /<[:\-\.\w\u00b7-\uffff]*$/.exec(state.sliceDoc(pos - 25, pos));
|
|
410
|
+
if (!m) return null;
|
|
411
|
+
let tree = syntaxTree(state).resolveInner(pos, -1);
|
|
412
|
+
while (tree && !tree.type.isTop) {
|
|
413
|
+
if (tree.name == "CodeBlock" || tree.name == "FencedCode" || tree.name == "ProcessingInstructionBlock" || tree.name == "CommentBlock" || tree.name == "Link" || tree.name == "Image") return null;
|
|
414
|
+
tree = tree.parent;
|
|
415
|
+
}
|
|
416
|
+
return {
|
|
417
|
+
from: pos - m[0].length,
|
|
418
|
+
to: pos,
|
|
419
|
+
options: htmlTagCompletions(),
|
|
420
|
+
validFor: /^<[:\-\.\w\u00b7-\uffff]*$/
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
let _tagCompletions = null;
|
|
424
|
+
function htmlTagCompletions() {
|
|
425
|
+
if (_tagCompletions) return _tagCompletions;
|
|
426
|
+
let result = htmlCompletionSource(new CompletionContext(EditorState.create({ extensions: htmlNoMatch }), 0, true));
|
|
427
|
+
return _tagCompletions = result ? result.options : [];
|
|
428
|
+
}
|
|
429
|
+
const nonPlainText = /code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i;
|
|
430
|
+
/**
|
|
431
|
+
An extension that intercepts pastes when the pasted content looks
|
|
432
|
+
like a URL and the selection is non-empty and selects regular
|
|
433
|
+
text, making the selection a link with the pasted URL as target.
|
|
434
|
+
*/
|
|
435
|
+
const pasteURLAsLink = /*@__PURE__*/ EditorView.domEventHandlers({ paste: (event, view) => {
|
|
436
|
+
var _a;
|
|
437
|
+
let { main } = view.state.selection;
|
|
438
|
+
if (main.empty) return false;
|
|
439
|
+
let link = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text/plain");
|
|
440
|
+
if (!link || !/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(link)) return false;
|
|
441
|
+
if (/^www\./.test(link)) link = "https://" + link;
|
|
442
|
+
if (!markdownLanguage.isActiveAt(view.state, main.from, 1)) return false;
|
|
443
|
+
let tree = syntaxTree(view.state), crossesNode = false;
|
|
444
|
+
tree.iterate({
|
|
445
|
+
from: main.from,
|
|
446
|
+
to: main.to,
|
|
447
|
+
enter: (node) => {
|
|
448
|
+
if (node.from > main.from || nonPlainText.test(node.name)) crossesNode = true;
|
|
449
|
+
},
|
|
450
|
+
leave: (node) => {
|
|
451
|
+
if (node.to < main.to) crossesNode = true;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
if (crossesNode) return false;
|
|
455
|
+
view.dispatch({
|
|
456
|
+
changes: [{
|
|
457
|
+
from: main.from,
|
|
458
|
+
insert: "["
|
|
459
|
+
}, {
|
|
460
|
+
from: main.to,
|
|
461
|
+
insert: `](${link})`
|
|
462
|
+
}],
|
|
463
|
+
userEvent: "input.paste",
|
|
464
|
+
scrollIntoView: true
|
|
465
|
+
});
|
|
466
|
+
return true;
|
|
467
|
+
} });
|
|
468
|
+
//#endregion
|
|
469
|
+
export { markdown };
|
|
470
|
+
|
|
471
|
+
//# sourceMappingURL=index.js.map
|