@veltra/desktop 1.9.2 → 1.10.0

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.
Files changed (45) hide show
  1. package/dist/components/file-viewer/previewers/sheet-previewer.js +5 -9
  2. package/dist/components/file-viewer/previewers/sheet-previewer.js.map +1 -1
  3. package/dist/node_modules/.bun/@codemirror_commands@6.11.0/node_modules/@codemirror/commands/dist/index.js +1 -1
  4. package/dist/node_modules/.bun/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js +2 -2
  5. package/dist/node_modules/.bun/@codemirror_lang-java@6.0.2/node_modules/@codemirror/lang-java/dist/index.js +1 -1
  6. package/dist/node_modules/.bun/@codemirror_lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js +2 -2
  7. package/dist/node_modules/.bun/@codemirror_lang-markdown@6.5.2/node_modules/@codemirror/lang-markdown/dist/index.js +2 -2
  8. package/dist/node_modules/.bun/@codemirror_lang-sql@6.10.0/node_modules/@codemirror/lang-sql/dist/index.js +2 -2
  9. package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js +3 -3
  10. package/dist/node_modules/.bun/@codemirror_state@6.7.1/node_modules/@codemirror/state/dist/index.js +1 -1
  11. package/dist/node_modules/.bun/@codemirror_theme-one-dark@6.1.3/node_modules/@codemirror/theme-one-dark/dist/index.js +1 -1
  12. package/dist/node_modules/.bun/@codemirror_view@6.43.9/node_modules/@codemirror/view/dist/index.js +1 -1
  13. package/dist/node_modules/.bun/{@lezer_common@1.5.2 → @lezer_common@1.5.3}/node_modules/@lezer/common/dist/index.js +4 -4
  14. package/dist/node_modules/.bun/{@lezer_common@1.5.2 → @lezer_common@1.5.3}/node_modules/@lezer/common/dist/index.js.map +1 -1
  15. package/dist/node_modules/.bun/@lezer_css@1.3.9/node_modules/@lezer/css/dist/index.js +278 -0
  16. package/dist/node_modules/.bun/@lezer_css@1.3.9/node_modules/@lezer/css/dist/index.js.map +1 -0
  17. package/dist/node_modules/.bun/{@lezer_highlight@1.2.3 → @lezer_highlight@1.2.5}/node_modules/@lezer/highlight/dist/index.js +4 -4
  18. package/dist/node_modules/.bun/@lezer_highlight@1.2.5/node_modules/@lezer/highlight/dist/index.js.map +1 -0
  19. package/dist/node_modules/.bun/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js +3 -3
  20. package/dist/node_modules/.bun/@lezer_java@1.1.5/node_modules/@lezer/java/dist/index.js +240 -0
  21. package/dist/node_modules/.bun/@lezer_java@1.1.5/node_modules/@lezer/java/dist/index.js.map +1 -0
  22. package/dist/node_modules/.bun/@lezer_javascript@1.5.6/node_modules/@lezer/javascript/dist/index.js +491 -0
  23. package/dist/node_modules/.bun/@lezer_javascript@1.5.6/node_modules/@lezer/javascript/dist/index.js.map +1 -0
  24. package/dist/node_modules/.bun/@lezer_json@1.0.3/node_modules/@lezer/json/dist/index.js +2 -2
  25. package/dist/node_modules/.bun/{@lezer_lr@1.4.10 → @lezer_lr@1.4.11}/node_modules/@lezer/lr/dist/index.js +41 -29
  26. package/dist/node_modules/.bun/@lezer_lr@1.4.11/node_modules/@lezer/lr/dist/index.js.map +1 -0
  27. package/dist/node_modules/.bun/{@lezer_markdown@1.7.2 → @lezer_markdown@1.8.0}/node_modules/@lezer/markdown/dist/index.js +17 -8
  28. package/dist/node_modules/.bun/@lezer_markdown@1.8.0/node_modules/@lezer/markdown/dist/index.js.map +1 -0
  29. package/dist/node_modules/.bun/{@marijn_find-cluster-break@1.0.3 → @marijn_find-cluster-break@1.0.4}/node_modules/@marijn/find-cluster-break/src/index.js +2 -2
  30. package/dist/node_modules/.bun/@marijn_find-cluster-break@1.0.4/node_modules/@marijn/find-cluster-break/src/index.js.map +1 -0
  31. package/dist/node_modules/.bun/{style-mod@4.1.3 → style-mod@4.1.4}/node_modules/style-mod/src/style-mod.js +9 -4
  32. package/dist/node_modules/.bun/style-mod@4.1.4/node_modules/style-mod/src/style-mod.js.map +1 -0
  33. package/package.json +2 -8
  34. package/src/components/file-viewer/previewers/sheet-previewer.vue +6 -11
  35. package/dist/node_modules/.bun/@lezer_css@1.3.6/node_modules/@lezer/css/dist/index.js +0 -268
  36. package/dist/node_modules/.bun/@lezer_css@1.3.6/node_modules/@lezer/css/dist/index.js.map +0 -1
  37. package/dist/node_modules/.bun/@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js.map +0 -1
  38. package/dist/node_modules/.bun/@lezer_java@1.1.3/node_modules/@lezer/java/dist/index.js +0 -235
  39. package/dist/node_modules/.bun/@lezer_java@1.1.3/node_modules/@lezer/java/dist/index.js.map +0 -1
  40. package/dist/node_modules/.bun/@lezer_javascript@1.5.4/node_modules/@lezer/javascript/dist/index.js +0 -491
  41. package/dist/node_modules/.bun/@lezer_javascript@1.5.4/node_modules/@lezer/javascript/dist/index.js.map +0 -1
  42. package/dist/node_modules/.bun/@lezer_lr@1.4.10/node_modules/@lezer/lr/dist/index.js.map +0 -1
  43. package/dist/node_modules/.bun/@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js.map +0 -1
  44. package/dist/node_modules/.bun/@marijn_find-cluster-break@1.0.3/node_modules/@marijn/find-cluster-break/src/index.js.map +0 -1
  45. package/dist/node_modules/.bun/style-mod@4.1.3/node_modules/style-mod/src/style-mod.js.map +0 -1
@@ -13,7 +13,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
13
13
  },
14
14
  emits: ["error"],
15
15
  setup(__props, { emit: __emit }) {
16
- /** 仅类型查询;运行时通过动态 import 加载,未安装时不炸主入口 */
16
+ /** 仅类型查询;运行时通过动态 import 加载(保持 sheet 层按需分包,不打进主产物) */
17
17
  const emit = __emit;
18
18
  const cls = bem("file-viewer");
19
19
  const container = useTemplateRef("container");
@@ -32,15 +32,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
32
32
  grid?.release();
33
33
  grid = void 0;
34
34
  }
35
- /** 动态加载 sheet-core;未安装 optional peer 时返回 undefined */
35
+ /** 动态加载电子表格层(infinitable/sheet);加载失败(缺依赖)时返回 undefined */
36
36
  async function resolveSheetCore() {
37
37
  if (sheetCore) return sheetCore;
38
38
  try {
39
- const [core, grid] = await Promise.all([import("@veltra/sheet-core"), import("@veltra/sheet-core/grid")]);
40
- sheetCore = {
41
- ...core,
42
- ...grid
43
- };
39
+ sheetCore = await import("infinitable/sheet");
44
40
  return sheetCore;
45
41
  } catch {
46
42
  return;
@@ -85,7 +81,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
85
81
  if (token !== loadToken) return;
86
82
  if (!core) {
87
83
  unavailable.value = true;
88
- emit("error", /* @__PURE__ */ new Error("未安装 @veltra/sheet-core,无法预览 Excel/CSV"));
84
+ emit("error", /* @__PURE__ */ new Error("未安装 infinitable,无法预览 Excel/CSV"));
89
85
  return;
90
86
  }
91
87
  unavailable.value = false;
@@ -113,7 +109,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
113
109
  key: 0,
114
110
  class: normalizeClass(unref(cls).e("empty"))
115
111
  }, [createVNode(unref(_sfc_main$1), {
116
- text: "无法预览表格:未安装 @veltra/sheet-core",
112
+ text: "无法预览表格:未安装 infinitable",
117
113
  size: 32
118
114
  })], 2)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
119
115
  truncated.value ? (openBlock(), createElementBlock("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-previewer.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createVNode","UEmpty","_Fragment","_toDisplayString","_createCommentVNode","_renderList","_createElementVNode"],"sources":["../../../../src/components/file-viewer/previewers/sheet-previewer.vue"],"sourcesContent":["<template>\n <div :class=\"cls.e('sheet')\">\n <div v-if=\"unavailable\" :class=\"cls.e('empty')\">\n <u-empty text=\"无法预览表格:未安装 @veltra/sheet-core\" :size=\"32\" />\n </div>\n <template v-else>\n <div v-if=\"truncated\" :class=\"cls.e('sheet-note')\">\n 共 {{ totalRows.toLocaleString() }} 行,超出预览上限\n {{ maxRows.toLocaleString() }} 行,已全量加载\n </div>\n <div v-if=\"sheets.length > 1\" :class=\"cls.e('sheet-tabs')\">\n <button\n v-for=\"(s, i) in sheets\"\n :key=\"s.name\"\n :class=\"[cls.e('sheet-tab'), bem.is('active', i === activeSheetIndex)]\"\n @click=\"activeSheetIndex = i\"\n >\n {{ s.name }}\n </button>\n </div>\n <div ref=\"container\" :class=\"cls.e('sheet-stage')\" />\n <div v-if=\"loading\" :class=\"cls.e('loading')\">加载中…</div>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { onBeforeUnmount, ref, shallowRef, useTemplateRef, watch } from 'vue'\n\nimport type { FileViewerItem } from '../../../types/file-viewer'\nimport { UEmpty } from '../../empty'\nimport { getExtension, toArrayBuffer } from '../helper'\n\ndefineOptions({ name: 'UFileViewerSheetPreviewer' })\n\n/** 仅类型查询;运行时通过动态 import 加载,未安装时不炸主入口 */\ntype SheetCoreModule = typeof import('@veltra/sheet-core') &\n typeof import('@veltra/sheet-core/grid')\ntype Sheet = InstanceType<SheetCoreModule['Sheet']>\ntype SheetGrid = InstanceType<SheetCoreModule['SheetGrid']>\n\nconst { file, maxRows = 50_000 } = defineProps<{ file: FileViewerItem; maxRows?: number }>()\n\nconst emit = defineEmits<{ (e: 'error', err: unknown): void }>()\n\nconst cls = bem('file-viewer')\nconst container = useTemplateRef<HTMLDivElement>('container')\nconst loading = ref(true)\nconst unavailable = ref(false)\nconst truncated = ref(false)\nconst totalRows = ref(0)\nconst sheets = shallowRef<Sheet[]>([])\nconst activeSheetIndex = ref(0)\n\nlet controller: AbortController | undefined\n/** 递增 token:importXlsx 无 AbortSignal,靠它防止切文件后旧解析结果落地 */\nlet loadToken = 0\nlet grid: SheetGrid | undefined\nlet sheetCore: SheetCoreModule | undefined\n\nfunction releaseGrid() {\n grid?.release()\n grid = undefined\n}\n\n/** 动态加载 sheet-core;未安装 optional peer 时返回 undefined */\nasync function resolveSheetCore(): Promise<SheetCoreModule | undefined> {\n if (sheetCore) return sheetCore\n try {\n const [core, grid] = await Promise.all([\n import('@veltra/sheet-core'),\n import('@veltra/sheet-core/grid')\n ])\n sheetCore = { ...core, ...grid }\n return sheetCore\n } catch {\n return undefined\n }\n}\n\n/** 解析文件为 Sheet 列表:xlsx 多表(importXlsx 建工作簿);csv 单表,表名取文件名 */\nasync function parseFile(\n core: SheetCoreModule,\n file: FileViewerItem,\n signal?: AbortSignal\n): Promise<Sheet[]> {\n const buf = await toArrayBuffer(file.src, signal)\n if (getExtension(file.name) === 'csv') {\n const text = new TextDecoder('utf-8', { fatal: false }).decode(buf)\n const sheet = new core.Sheet(file.name)\n core.importCsv(text, sheet)\n return [sheet]\n }\n const workbook = await core.importXlsx(buf)\n return workbook.getSheets()\n}\n\nfunction renderActive() {\n const sheet = sheets.value[activeSheetIndex.value]\n const el = container.value\n releaseGrid()\n if (!sheet || !el || !sheetCore) return\n\n // SheetGrid 的 rows 选项是渲染行数下限(构造时数据高水位恒并入渲染尺寸),\n // 不能用作行数上限;deleteRows 硬裁又会让引用被裁区域的公式显示 #REF!,\n // 故 maxRows 只驱动截断提示,不裁模型\n const total = sheet.rowCount\n totalRows.value = total\n truncated.value = maxRows > 0 && total > maxRows\n\n grid = new sheetCore.SheetGrid({ container: el, sheet, readonly: true })\n}\n\nasync function load() {\n const token = ++loadToken\n controller?.abort()\n controller = new AbortController()\n loading.value = true\n truncated.value = false\n releaseGrid()\n sheets.value = []\n activeSheetIndex.value = 0\n\n try {\n const core = await resolveSheetCore()\n if (token !== loadToken) return\n if (!core) {\n unavailable.value = true\n emit('error', new Error('未安装 @veltra/sheet-core,无法预览 Excel/CSV'))\n return\n }\n unavailable.value = false\n\n const parsed = await parseFile(core, file, controller.signal)\n if (token !== loadToken) return\n sheets.value = parsed\n renderActive()\n } catch (err) {\n if (token !== loadToken) return\n if ((err as { name?: string })?.name === 'AbortError') return\n emit('error', err)\n } finally {\n if (token === loadToken) loading.value = false\n }\n}\n\n// 只盯 src:宿主重算出的同内容新 file 对象不应触发重载(重新解析 zip 开销大)\nwatch(() => file.src, load, { immediate: true })\nwatch(activeSheetIndex, renderActive)\n\nonBeforeUnmount(() => {\n controller?.abort()\n releaseGrid()\n sheets.value = []\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;EA4CA,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,aAAa;EAC7B,MAAM,YAAY,eAA+B,WAAW;EAC5D,MAAM,UAAU,IAAI,IAAI;EACxB,MAAM,cAAc,IAAI,KAAK;EAC7B,MAAM,YAAY,IAAI,KAAK;EAC3B,MAAM,YAAY,IAAI,CAAC;EACvB,MAAM,SAAS,WAAoB,CAAC,CAAC;EACrC,MAAM,mBAAmB,IAAI,CAAC;EAE9B,IAAI;;EAEJ,IAAI,YAAY;EAChB,IAAI;EACJ,IAAI;EAEJ,SAAS,cAAc;GACrB,MAAM,QAAQ;GACd,OAAO,KAAA;EACT;;EAGA,eAAe,mBAAyD;GACtE,IAAI,WAAW,OAAO;GACtB,IAAI;IACF,MAAM,CAAC,MAAM,QAAQ,MAAM,QAAQ,IAAI,CACrC,OAAO,uBACP,OAAO,0BACT,CAAC;IACD,YAAY;KAAE,GAAG;KAAM,GAAG;IAAK;IAC/B,OAAO;GACT,QAAQ;IACN;GACF;EACF;;EAGA,eAAe,UACb,MACA,MACA,QACkB;GAClB,MAAM,MAAM,MAAM,cAAc,KAAK,KAAK,MAAM;GAChD,IAAI,aAAa,KAAK,IAAI,MAAM,OAAO;IACrC,MAAM,OAAO,IAAI,YAAY,SAAS,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,GAAG;IAClE,MAAM,QAAQ,IAAI,KAAK,MAAM,KAAK,IAAI;IACtC,KAAK,UAAU,MAAM,KAAK;IAC1B,OAAO,CAAC,KAAK;GACf;GAEA,QAAO,MADgB,KAAK,WAAW,GAAG,EAAA,CAC1B,UAAU;EAC5B;EAEA,SAAS,eAAe;GACtB,MAAM,QAAQ,O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AA,QAAI,CAAA,KAAAK,mBAAA,QAAA,IAAA"}
1
+ {"version":3,"file":"sheet-previewer.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createVNode","UEmpty","_Fragment","_toDisplayString","_createCommentVNode","_renderList","_createElementVNode"],"sources":["../../../../src/components/file-viewer/previewers/sheet-previewer.vue"],"sourcesContent":["<template>\n <div :class=\"cls.e('sheet')\">\n <div v-if=\"unavailable\" :class=\"cls.e('empty')\">\n <u-empty text=\"无法预览表格:未安装 infinitable\" :size=\"32\" />\n </div>\n <template v-else>\n <div v-if=\"truncated\" :class=\"cls.e('sheet-note')\">\n 共 {{ totalRows.toLocaleString() }} 行,超出预览上限\n {{ maxRows.toLocaleString() }} 行,已全量加载\n </div>\n <div v-if=\"sheets.length > 1\" :class=\"cls.e('sheet-tabs')\">\n <button\n v-for=\"(s, i) in sheets\"\n :key=\"s.name\"\n :class=\"[cls.e('sheet-tab'), bem.is('active', i === activeSheetIndex)]\"\n @click=\"activeSheetIndex = i\"\n >\n {{ s.name }}\n </button>\n </div>\n <div ref=\"container\" :class=\"cls.e('sheet-stage')\" />\n <div v-if=\"loading\" :class=\"cls.e('loading')\">加载中…</div>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { bem } from '@veltra/utils'\nimport { onBeforeUnmount, ref, shallowRef, useTemplateRef, watch } from 'vue'\n\nimport type { FileViewerItem } from '../../../types/file-viewer'\nimport { UEmpty } from '../../empty'\nimport { getExtension, toArrayBuffer } from '../helper'\n\ndefineOptions({ name: 'UFileViewerSheetPreviewer' })\n\n/** 仅类型查询;运行时通过动态 import 加载(保持 sheet 层按需分包,不打进主产物) */\ntype SheetCoreModule = typeof import('infinitable/sheet')\ntype Sheet = InstanceType<SheetCoreModule['Sheet']>\ntype SheetGrid = InstanceType<SheetCoreModule['SheetGrid']>\n\nconst { file, maxRows = 50_000 } = defineProps<{ file: FileViewerItem; maxRows?: number }>()\n\nconst emit = defineEmits<{ (e: 'error', err: unknown): void }>()\n\nconst cls = bem('file-viewer')\nconst container = useTemplateRef<HTMLDivElement>('container')\nconst loading = ref(true)\nconst unavailable = ref(false)\nconst truncated = ref(false)\nconst totalRows = ref(0)\nconst sheets = shallowRef<Sheet[]>([])\nconst activeSheetIndex = ref(0)\n\nlet controller: AbortController | undefined\n/** 递增 token:importXlsx 无 AbortSignal,靠它防止切文件后旧解析结果落地 */\nlet loadToken = 0\nlet grid: SheetGrid | undefined\nlet sheetCore: SheetCoreModule | undefined\n\nfunction releaseGrid() {\n grid?.release()\n grid = undefined\n}\n\n/** 动态加载电子表格层(infinitable/sheet);加载失败(缺依赖)时返回 undefined */\nasync function resolveSheetCore(): Promise<SheetCoreModule | undefined> {\n if (sheetCore) return sheetCore\n try {\n sheetCore = await import('infinitable/sheet')\n return sheetCore\n } catch {\n return undefined\n }\n}\n\n/** 解析文件为 Sheet 列表:xlsx 多表(importXlsx 建工作簿);csv 单表,表名取文件名 */\nasync function parseFile(\n core: SheetCoreModule,\n file: FileViewerItem,\n signal?: AbortSignal\n): Promise<Sheet[]> {\n const buf = await toArrayBuffer(file.src, signal)\n if (getExtension(file.name) === 'csv') {\n const text = new TextDecoder('utf-8', { fatal: false }).decode(buf)\n const sheet = new core.Sheet(file.name)\n core.importCsv(text, sheet)\n return [sheet]\n }\n const workbook = await core.importXlsx(buf)\n return workbook.getSheets()\n}\n\nfunction renderActive() {\n const sheet = sheets.value[activeSheetIndex.value]\n const el = container.value\n releaseGrid()\n if (!sheet || !el || !sheetCore) return\n\n // SheetGrid 的 rows 选项是渲染行数下限(构造时数据高水位恒并入渲染尺寸),\n // 不能用作行数上限;deleteRows 硬裁又会让引用被裁区域的公式显示 #REF!,\n // 故 maxRows 只驱动截断提示,不裁模型\n const total = sheet.rowCount\n totalRows.value = total\n truncated.value = maxRows > 0 && total > maxRows\n\n grid = new sheetCore.SheetGrid({ container: el, sheet, readonly: true })\n}\n\nasync function load() {\n const token = ++loadToken\n controller?.abort()\n controller = new AbortController()\n loading.value = true\n truncated.value = false\n releaseGrid()\n sheets.value = []\n activeSheetIndex.value = 0\n\n try {\n const core = await resolveSheetCore()\n if (token !== loadToken) return\n if (!core) {\n unavailable.value = true\n emit('error', new Error('未安装 infinitable,无法预览 Excel/CSV'))\n return\n }\n unavailable.value = false\n\n const parsed = await parseFile(core, file, controller.signal)\n if (token !== loadToken) return\n sheets.value = parsed\n renderActive()\n } catch (err) {\n if (token !== loadToken) return\n if ((err as { name?: string })?.name === 'AbortError') return\n emit('error', err)\n } finally {\n if (token === loadToken) loading.value = false\n }\n}\n\n// 只盯 src:宿主重算出的同内容新 file 对象不应触发重载(重新解析 zip 开销大)\nwatch(() => file.src, load, { immediate: true })\nwatch(activeSheetIndex, renderActive)\n\nonBeforeUnmount(() => {\n controller?.abort()\n releaseGrid()\n sheets.value = []\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;EA2CA,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,aAAa;EAC7B,MAAM,YAAY,eAA+B,WAAW;EAC5D,MAAM,UAAU,IAAI,IAAI;EACxB,MAAM,cAAc,IAAI,KAAK;EAC7B,MAAM,YAAY,IAAI,KAAK;EAC3B,MAAM,YAAY,IAAI,CAAC;EACvB,MAAM,SAAS,WAAoB,CAAC,CAAC;EACrC,MAAM,mBAAmB,IAAI,CAAC;EAE9B,IAAI;;EAEJ,IAAI,YAAY;EAChB,IAAI;EACJ,IAAI;EAEJ,SAAS,cAAc;GACrB,MAAM,QAAQ;GACd,OAAO,KAAA;EACT;;EAGA,eAAe,mBAAyD;GACtE,IAAI,WAAW,OAAO;GACtB,IAAI;IACF,YAAY,MAAM,OAAO;IACzB,OAAO;GACT,QAAQ;IACN;GACF;EACF;;EAGA,eAAe,UACb,MACA,MACA,QACkB;GAClB,MAAM,MAAM,MAAM,cAAc,KAAK,KAAK,MAAM;GAChD,IAAI,aAAa,KAAK,IAAI,MAAM,OAAO;IACrC,MAAM,OAAO,IAAI,YAAY,SAAS,EAAE,OAAO,MAA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A,UAAA;;IAGbG,mBAAqD,OAAA;KAA5C,SAAA;KAAJ,KAAI;KAAa,OAAKR,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,aAAA,CAAA;;IACvB,QAAA,SAAXH,UAAA,GAAAC,mBAAwD,OAAA;;KAAnC,OAAKC,eAAEC,MAAA,GAAA,CAAG,CAAC,EAAC,SAAA,CAAA;IAAa,GAAA,QAAI,CAAA,KAAAK,mBAAA,QAAA,IAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Annotation, ChangeDesc, ChangeSet, EditorSelection, Facet, StateEffect, StateField, Text, Transaction, combineConfig, countColumn, findClusterBreak } from "../../../../../@codemirror_state@6.7.1/node_modules/@codemirror/state/dist/index.js";
2
2
  import { Direction, EditorView } from "../../../../../@codemirror_view@6.43.9/node_modules/@codemirror/view/dist/index.js";
3
- import { NodeProp } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
3
+ import { NodeProp } from "../../../../../@lezer_common@1.5.3/node_modules/@lezer/common/dist/index.js";
4
4
  import { IndentContext, getIndentUnit, getIndentation, indentString, indentUnit, matchBrackets, syntaxTree } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
5
5
  //#region ../../node_modules/.bun/@codemirror+commands@6.11.0/node_modules/@codemirror/commands/dist/index.js
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { IterMode, NodeWeakMap } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
1
+ import { IterMode, NodeWeakMap } from "../../../../../@lezer_common@1.5.3/node_modules/@lezer/common/dist/index.js";
2
2
  import { LRLanguage, LanguageSupport, continuedIndent, foldInside, foldNodeProp, indentNodeProp, syntaxTree } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
3
- import { parser } from "../../../../../@lezer_css@1.3.6/node_modules/@lezer/css/dist/index.js";
3
+ import { parser } from "../../../../../@lezer_css@1.3.9/node_modules/@lezer/css/dist/index.js";
4
4
  //#region ../../node_modules/.bun/@codemirror+lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js
5
5
  let _properties = null;
6
6
  function properties() {
@@ -1,5 +1,5 @@
1
1
  import { LRLanguage, LanguageSupport, continuedIndent, delimitedIndent, flatIndent, foldInside, foldNodeProp, indentNodeProp } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
2
- import { parser } from "../../../../../@lezer_java@1.1.3/node_modules/@lezer/java/dist/index.js";
2
+ import { parser } from "../../../../../@lezer_java@1.1.5/node_modules/@lezer/java/dist/index.js";
3
3
  //#region ../../node_modules/.bun/@codemirror+lang-java@6.0.2/node_modules/@codemirror/lang-java/dist/index.js
4
4
  /**
5
5
  A language provider based on the [Lezer Java
@@ -1,9 +1,9 @@
1
1
  import { EditorSelection } from "../../../../../@codemirror_state@6.7.1/node_modules/@codemirror/state/dist/index.js";
2
2
  import { EditorView } from "../../../../../@codemirror_view@6.43.9/node_modules/@codemirror/view/dist/index.js";
3
- import { IterMode, NodeWeakMap } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
3
+ import { IterMode, NodeWeakMap } from "../../../../../@lezer_common@1.5.3/node_modules/@lezer/common/dist/index.js";
4
4
  import { LRLanguage, LanguageSupport, continuedIndent, defineLanguageFacet, delimitedIndent, flatIndent, foldInside, foldNodeProp, indentNodeProp, sublanguageProp, syntaxTree } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
5
5
  import { completeFromList, ifNotIn, snippetCompletion } from "../../../../../@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js";
6
- import { parser } from "../../../../../@lezer_javascript@1.5.4/node_modules/@lezer/javascript/dist/index.js";
6
+ import { parser } from "../../../../../@lezer_javascript@1.5.6/node_modules/@lezer/javascript/dist/index.js";
7
7
  //#region ../../node_modules/.bun/@codemirror+lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js
8
8
  /**
9
9
  A collection of JavaScript-related
@@ -1,9 +1,9 @@
1
1
  import { EditorSelection, EditorState, Prec, countColumn } from "../../../../../@codemirror_state@6.7.1/node_modules/@codemirror/state/dist/index.js";
2
2
  import { EditorView, keymap } from "../../../../../@codemirror_view@6.43.9/node_modules/@codemirror/view/dist/index.js";
3
- import { NodeProp } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
3
+ import { NodeProp } from "../../../../../@lezer_common@1.5.3/node_modules/@lezer/common/dist/index.js";
4
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
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";
6
+ import { Emoji, GFM, MarkdownParser, Subscript, Superscript, parseCode, parser } from "../../../../../@lezer_markdown@1.8.0/node_modules/@lezer/markdown/dist/index.js";
7
7
  import { html, htmlCompletionSource } from "../../../../../@codemirror_lang-html@6.4.12/node_modules/@codemirror/lang-html/dist/index.js";
8
8
  //#region ../../node_modules/.bun/@codemirror+lang-markdown@6.5.2/node_modules/@codemirror/lang-markdown/dist/index.js
9
9
  const data = /*@__PURE__*/ defineLanguageFacet({ commentTokens: { block: {
@@ -1,7 +1,7 @@
1
- import { styleTags, tags } from "../../../../../@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js";
1
+ import { styleTags, tags } from "../../../../../@lezer_highlight@1.2.5/node_modules/@lezer/highlight/dist/index.js";
2
2
  import { LRLanguage, LanguageSupport, continuedIndent, foldNodeProp, indentNodeProp, syntaxTree } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
3
3
  import { completeFromList, ifNotIn } from "../../../../../@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js";
4
- import { ExternalTokenizer, LRParser } from "../../../../../@lezer_lr@1.4.10/node_modules/@lezer/lr/dist/index.js";
4
+ import { ExternalTokenizer, LRParser } from "../../../../../@lezer_lr@1.4.11/node_modules/@lezer/lr/dist/index.js";
5
5
  //#region ../../node_modules/.bun/@codemirror+lang-sql@6.10.0/node_modules/@codemirror/lang-sql/dist/index.js
6
6
  const whitespace = 36;
7
7
  const LineComment = 1;
@@ -1,8 +1,8 @@
1
1
  import { EditorState, Facet, Prec, RangeSet, RangeSetBuilder, StateEffect, StateField, combineConfig, countColumn } from "../../../../../@codemirror_state@6.7.1/node_modules/@codemirror/state/dist/index.js";
2
- import { StyleModule } from "../../../../../style-mod@4.1.3/node_modules/style-mod/src/style-mod.js";
2
+ import { StyleModule } from "../../../../../style-mod@4.1.4/node_modules/style-mod/src/style-mod.js";
3
3
  import { Decoration, Direction, EditorView, GutterMarker, ViewPlugin, WidgetType, gutter, logException } from "../../../../../@codemirror_view@6.43.9/node_modules/@codemirror/view/dist/index.js";
4
- import { IterMode, NodeProp, NodeSet, NodeType, Parser, Tree, TreeFragment } from "../../../../../@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js";
5
- import { highlightTree, styleTags, tagHighlighter, tags } from "../../../../../@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js";
4
+ import { IterMode, NodeProp, NodeSet, NodeType, Parser, Tree, TreeFragment } from "../../../../../@lezer_common@1.5.3/node_modules/@lezer/common/dist/index.js";
5
+ import { highlightTree, styleTags, tagHighlighter, tags } from "../../../../../@lezer_highlight@1.2.5/node_modules/@lezer/highlight/dist/index.js";
6
6
  //#region ../../node_modules/.bun/@codemirror+language@6.12.4/node_modules/@codemirror/language/dist/index.js
7
7
  var _a;
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { findClusterBreak as findClusterBreak$1 } from "../../../../../@marijn_find-cluster-break@1.0.3/node_modules/@marijn/find-cluster-break/src/index.js";
1
+ import { findClusterBreak as findClusterBreak$1 } from "../../../../../@marijn_find-cluster-break@1.0.4/node_modules/@marijn/find-cluster-break/src/index.js";
2
2
  //#region ../../node_modules/.bun/@codemirror+state@6.7.1/node_modules/@codemirror/state/dist/index.js
3
3
  /**
4
4
  The data structure for documents. @nonabstract
@@ -1,5 +1,5 @@
1
1
  import { EditorView } from "../../../../../@codemirror_view@6.43.9/node_modules/@codemirror/view/dist/index.js";
2
- import { tags } from "../../../../../@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js";
2
+ import { tags } from "../../../../../@lezer_highlight@1.2.5/node_modules/@lezer/highlight/dist/index.js";
3
3
  import { HighlightStyle, syntaxHighlighting } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
4
4
  //#region ../../node_modules/.bun/@codemirror+theme-one-dark@6.1.3/node_modules/@codemirror/theme-one-dark/dist/index.js
5
5
  const chalky = "#e5c07b";
@@ -1,5 +1,5 @@
1
1
  import { Annotation, ChangeSet, CharCategory, EditorSelection, EditorState, Facet, MapMode, Prec, RangeSet, RangeSetBuilder, RangeValue, StateEffect, StateField, Text, Transaction, codePointAt, codePointSize, combineConfig, countColumn, findClusterBreak, findColumn } from "../../../../../@codemirror_state@6.7.1/node_modules/@codemirror/state/dist/index.js";
2
- import { StyleModule } from "../../../../../style-mod@4.1.3/node_modules/style-mod/src/style-mod.js";
2
+ import { StyleModule } from "../../../../../style-mod@4.1.4/node_modules/style-mod/src/style-mod.js";
3
3
  import { base, keyName, shift } from "../../../../../w3c-keyname@2.2.8/node_modules/w3c-keyname/index.js";
4
4
  import crelt from "../../../../../crelt@1.0.7/node_modules/crelt/index.js";
5
5
  //#region ../../node_modules/.bun/@codemirror+view@6.43.9/node_modules/@codemirror/view/dist/index.js
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.bun/@lezer+common@1.5.2/node_modules/@lezer/common/dist/index.js
1
+ //#region ../../node_modules/.bun/@lezer+common@1.5.3/node_modules/@lezer/common/dist/index.js
2
2
  /**
3
3
  The default maximum length of a `TreeBuffer` node.
4
4
  */
@@ -1761,12 +1761,12 @@ var StructureCursor = class {
1761
1761
  constructor(root, offset) {
1762
1762
  this.offset = offset;
1763
1763
  this.done = false;
1764
- this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts);
1764
+ this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts | IterMode.ExcludeBuffers);
1765
1765
  }
1766
1766
  moveTo(pos) {
1767
1767
  let { cursor } = this, p = pos - this.offset;
1768
- while (!this.done && cursor.from < p) if (cursor.to >= pos && cursor.enter(p, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers));
1769
- else if (cursor.to <= pos) {
1768
+ while (!this.done && cursor.from < p) if (cursor.to >= p && cursor.enter(p, 1, IterMode.IncludeAnonymous | IterMode.IgnoreOverlays | IterMode.ExcludeBuffers));
1769
+ else if (cursor.to <= p) {
1770
1770
  if (!cursor.next(false)) this.done = true;
1771
1771
  } else break;
1772
1772
  }