@bagelink/vue 1.20.76 → 1.20.78

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 (67) hide show
  1. package/dist/StructuredEditor-HFOfODf9.cjs +2 -0
  2. package/dist/StructuredEditor-w0UY60b7.js +2431 -0
  3. package/dist/StructuredEditor.css +1 -0
  4. package/dist/babel-BVvTH0ev.js +10053 -0
  5. package/dist/babel-BzIDwrmk.cjs +16 -0
  6. package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts +45 -28
  7. package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts.map +1 -1
  8. package/dist/components/form/inputs/CodeEditor/SearchPanel.vue.d.ts +10 -0
  9. package/dist/components/form/inputs/CodeEditor/SearchPanel.vue.d.ts.map +1 -0
  10. package/dist/components/form/inputs/CodeEditor/StructuredEditor.vue.d.ts +27 -0
  11. package/dist/components/form/inputs/CodeEditor/StructuredEditor.vue.d.ts.map +1 -0
  12. package/dist/components/form/inputs/CodeEditor/formatCode.d.ts +4 -0
  13. package/dist/components/form/inputs/CodeEditor/formatCode.d.ts.map +1 -0
  14. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
  15. package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
  16. package/dist/core.css +3 -1
  17. package/dist/dist-B-MCiFKR.cjs +10 -0
  18. package/dist/dist-B0uc2InW.js +6 -0
  19. package/dist/dist-BIAEQGHn.cjs +1 -0
  20. package/dist/dist-BLxHnfU6.js +1071 -0
  21. package/dist/dist-BRA2DQF2.cjs +1 -0
  22. package/dist/dist-BnLdfA7w.js +69 -0
  23. package/dist/dist-CL50Ff42.cjs +1 -0
  24. package/dist/dist-CwUttjIh.js +1100 -0
  25. package/dist/dist-CzY35u4H.cjs +1 -0
  26. package/dist/dist-D8OWrPLr.js +1336 -0
  27. package/dist/dist-DSCI9g6w.cjs +13 -0
  28. package/dist/dist-DsBgijLf.cjs +1 -0
  29. package/dist/dist-GbVY_Jpv.cjs +1 -0
  30. package/dist/dist-IV7z-zur.js +11909 -0
  31. package/dist/dist-Mr0UMyoK.js +1063 -0
  32. package/dist/dist-jq7acmcZ.js +6 -0
  33. package/dist/estree-CKgw47OZ.js +8211 -0
  34. package/dist/estree-HqeJuE3g.cjs +44 -0
  35. package/dist/html-B-hsQYII.js +7289 -0
  36. package/dist/html-BrqW5pT-.cjs +25 -0
  37. package/dist/index.cjs +1 -764
  38. package/dist/index.mjs +308 -65621
  39. package/dist/postcss-Bk65KKdh.js +6703 -0
  40. package/dist/postcss-BxY0xtVZ.cjs +61 -0
  41. package/dist/src-BACj3hjY.cjs +764 -0
  42. package/dist/src-SwfYbKT-.js +65571 -0
  43. package/dist/src.css +1 -0
  44. package/dist/standalone-CAcRm_h6.cjs +29 -0
  45. package/dist/standalone-D-HcbQmf.js +3549 -0
  46. package/dist/style.css +3 -1
  47. package/dist/utils/calendarDate.d.ts +6 -0
  48. package/dist/utils/calendarDate.d.ts.map +1 -0
  49. package/dist/utils/date.d.ts.map +1 -1
  50. package/package.json +13 -2
  51. package/src/components/form/inputs/CodeEditor/Index.vue +70 -310
  52. package/src/components/form/inputs/CodeEditor/SearchPanel.vue +124 -0
  53. package/src/components/form/inputs/CodeEditor/StructuredEditor.vue +266 -0
  54. package/src/components/form/inputs/CodeEditor/formatCode.ts +34 -0
  55. package/src/components/form/inputs/DatePicker.vue +4 -1
  56. package/src/components/form/inputs/RichText/index.vue +2 -1
  57. package/src/utils/calendarDate.ts +16 -0
  58. package/src/utils/date.ts +2 -1
  59. package/vite.config.ts +5 -3
  60. package/dist/components/form/inputs/CodeEditor/useHighlight.d.ts +0 -33
  61. package/dist/components/form/inputs/CodeEditor/useHighlight.d.ts.map +0 -1
  62. package/dist/index.css +0 -1
  63. package/src/components/form/inputs/CodeEditor/useHighlight.ts +0 -123
  64. /package/dist/{page-flip.browser-BXnk8BM6.js → page-flip.browser-0kqlwcC8.js} +0 -0
  65. /package/dist/{page-flip.browser-ByKQXhqK.cjs → page-flip.browser-Dfy5mAgM.cjs} +0 -0
  66. /package/dist/{pdf-CV7M2d0x.cjs → pdf-BBd7GH-5.cjs} +0 -0
  67. /package/dist/{pdf-DuN3_wNN.js → pdf-scP2ZqGZ.js} +0 -0
@@ -1,123 +0,0 @@
1
- import type { HighlightJS, HighlightTheme } from './CodeTypes'
2
- import { appendStyle, appendScript, awaitGlobal } from '../../../../index'
3
- import { ref } from 'vue'
4
-
5
- // Extend the Window interface
6
- interface CustomWindow extends Window {
7
- hljs: HighlightJS
8
- }
9
- declare const window: CustomWindow
10
-
11
- export function useHighlight(theme: HighlightTheme = 'dark') {
12
- const hljs = ref<HighlightJS | null>(null)
13
- const loaded = ref(false)
14
- const currentTheme = ref<HighlightTheme>(theme)
15
-
16
- const normalizeTheme = (t: HighlightTheme): HighlightTheme => {
17
- if (t === 'dark') { return 'atom-one-dark' }
18
- if (t === 'light') { return 'atom-one-light' }
19
- return t
20
- }
21
-
22
- const getThemeCssUrl = (t: HighlightTheme) => `https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/styles/${t}.min.css`
23
-
24
- // Remove highlight.js theme links EXCEPT the one we're about to keep.
25
- // Removing a <link> that is still loading prevents its onload from ever
26
- // firing, which would leave `appendStyle` hanging forever. When multiple
27
- // editors mount at once this caused one editor to get stuck on `loaded=false`.
28
- const removeOtherThemeLinks = (keepUrl: string) => {
29
- document.querySelectorAll('link[rel="stylesheet"]').forEach((link) => {
30
- if (link instanceof HTMLLinkElement && link.href.includes('/styles/') && link.href.includes('highlight.js')) {
31
- if (link.href !== keepUrl) { link.parentElement?.removeChild(link) }
32
- }
33
- })
34
- }
35
-
36
- const loadTheme = async (theme: HighlightTheme) => {
37
- const next = normalizeTheme(theme)
38
- try {
39
- const url = getThemeCssUrl(next)
40
- // Append first (idempotent: appendStyle resolves immediately if the
41
- // link already exists), then remove only the *other* theme links.
42
- await appendStyle(url)
43
- removeOtherThemeLinks(url)
44
- currentTheme.value = next
45
- } catch (error) {
46
- console.error('Failed to apply theme. Falling back to atom-one-dark:', error)
47
- currentTheme.value = 'atom-one-dark'
48
- const url = getThemeCssUrl(currentTheme.value)
49
- await appendStyle(url)
50
- removeOtherThemeLinks(url)
51
- }
52
- }
53
-
54
- const setTheme = async (theme: HighlightTheme) => {
55
- const next = normalizeTheme(theme)
56
- if (next === currentTheme.value) { return }
57
- await loadTheme(next)
58
- }
59
-
60
- const loadHighlight = async () => {
61
- if (loaded.value) { return }
62
-
63
- try {
64
- // Load highlight.js
65
- await appendScript('https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/highlight.min.js', { id: 'hljs-cdn' })
66
- // `appendScript` may resolve before the script has finished executing when
67
- // multiple editors mount at once (a duplicate <script id> is detected in the
68
- // DOM and resolves immediately). Wait for the actual global to appear.
69
- const lib = await awaitGlobal<HighlightJS>('hljs')
70
- await loadTheme(currentTheme.value)
71
-
72
- hljs.value = lib
73
- loaded.value = true
74
- } catch (error) {
75
- console.error('Error loading highlight.js:', error)
76
- }
77
- }
78
-
79
- const escapeHtml = (unsafe: string) => {
80
- return unsafe.replace(/[&<>"']/g, (m) => {
81
- const replacements: { [key: string]: string } = {
82
- '&': '&amp;',
83
- '<': '&lt;',
84
- '>': '&gt;',
85
- '"': '&quot;',
86
- '\'': '&#039;'
87
- }
88
- return replacements[m] || ''
89
- })
90
- }
91
-
92
- const highlightCode = (code: string, language?: string, autodetect = true, ignoreIllegals = true) => {
93
- if (!hljs.value) { return escapeHtml(code) }
94
-
95
- try {
96
- const lang = language || ''
97
-
98
- if (lang && !autodetect && !hljs.value.getLanguage(lang)) {
99
- console.warn(`The language "${lang}" is not available.`)
100
- return escapeHtml(code)
101
- }
102
-
103
- const result = autodetect
104
- ? hljs.value.highlightAuto(code)
105
- : hljs.value.highlight(code, { language: lang, ignoreIllegals })
106
-
107
- return result.value || escapeHtml(code)
108
- } catch (error) {
109
- console.error('Highlighting error:', error)
110
- return escapeHtml(code)
111
- }
112
- }
113
-
114
- return {
115
- hljs,
116
- loaded,
117
- loadHighlight,
118
- setTheme,
119
- currentTheme,
120
- escapeHtml,
121
- highlightCode
122
- }
123
- }
File without changes
File without changes