@bagelink/vue 1.6.47 → 1.6.51

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 (170) hide show
  1. package/bin/experimentalGenTypedRoutes.ts +18 -19
  2. package/bin/utils.ts +4 -4
  3. package/dist/components/AddressSearch.vue.d.ts.map +1 -1
  4. package/dist/components/Alert.vue.d.ts.map +1 -1
  5. package/dist/components/BglVideo.vue.d.ts.map +1 -1
  6. package/dist/components/Card.vue.d.ts.map +1 -1
  7. package/dist/components/Carousel.vue.d.ts +2 -2
  8. package/dist/components/Carousel.vue.d.ts.map +1 -1
  9. package/dist/components/Dropdown.vue.d.ts.map +1 -1
  10. package/dist/components/Flag.vue.d.ts.map +1 -1
  11. package/dist/components/IframeVue.vue.d.ts.map +1 -1
  12. package/dist/components/ListItem.vue.d.ts.map +1 -1
  13. package/dist/components/Loading.vue.d.ts.map +1 -1
  14. package/dist/components/Modal.vue.d.ts.map +1 -1
  15. package/dist/components/ModalForm.vue.d.ts.map +1 -1
  16. package/dist/components/NavBar.vue.d.ts +1 -1
  17. package/dist/components/Pill.vue.d.ts.map +1 -1
  18. package/dist/components/Zoomer.vue.d.ts +0 -1
  19. package/dist/components/Zoomer.vue.d.ts.map +1 -1
  20. package/dist/components/analytics/LineChart.vue.d.ts.map +1 -1
  21. package/dist/components/analytics/PieChart.vue.d.ts +2 -1
  22. package/dist/components/analytics/PieChart.vue.d.ts.map +1 -1
  23. package/dist/components/analytics/index.d.ts +1 -1
  24. package/dist/components/analytics/index.d.ts.map +1 -1
  25. package/dist/components/calendar/CalendarPopover.vue.d.ts.map +1 -1
  26. package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -1
  27. package/dist/components/form/inputs/ColorInput.vue.d.ts.map +1 -1
  28. package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
  29. package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
  30. package/dist/components/form/inputs/RadioGroup.vue.d.ts.map +1 -1
  31. package/dist/components/form/inputs/RangeInput.vue.d.ts +11 -11
  32. package/dist/components/form/inputs/RichText/components/EditorToolbar.vue.d.ts.map +1 -1
  33. package/dist/components/form/inputs/RichText/components/TableGridSelector.vue.d.ts.map +1 -1
  34. package/dist/components/form/inputs/RichText/utils/commands.d.ts.map +1 -1
  35. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  36. package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
  37. package/dist/components/layout/AppSidebar.vue.d.ts +1 -0
  38. package/dist/components/layout/AppSidebar.vue.d.ts.map +1 -1
  39. package/dist/components/layout/Layout.vue.d.ts.map +1 -1
  40. package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
  41. package/dist/components/layout/index.d.ts +3 -3
  42. package/dist/components/layout/index.d.ts.map +1 -1
  43. package/dist/index.cjs +34 -25
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.mjs +6668 -5883
  47. package/dist/plugins/useToast.d.ts.map +1 -1
  48. package/dist/style.css +1 -1
  49. package/package.json +5 -10
  50. package/src/components/AccordionItem.vue +11 -11
  51. package/src/components/AddToCalendar.vue +1 -1
  52. package/src/components/AddressSearch.vue +9 -8
  53. package/src/components/Alert.vue +2 -1
  54. package/src/components/Badge.vue +5 -5
  55. package/src/components/BglVideo.vue +44 -45
  56. package/src/components/Btn.vue +15 -15
  57. package/src/components/Card.vue +10 -8
  58. package/src/components/Carousel.vue +159 -162
  59. package/src/components/DataPreview.vue +1 -1
  60. package/src/components/DragOver.vue +6 -6
  61. package/src/components/Dropdown.vue +39 -38
  62. package/src/components/Flag.vue +7 -6
  63. package/src/components/Icon/Icon.vue +22 -22
  64. package/src/components/IframeVue.vue +5 -5
  65. package/src/components/Image.vue +17 -17
  66. package/src/components/ImportData.vue +79 -79
  67. package/src/components/ListItem.vue +20 -13
  68. package/src/components/Loading.vue +10 -9
  69. package/src/components/MapEmbed/Index.vue +24 -24
  70. package/src/components/Modal.vue +11 -9
  71. package/src/components/ModalForm.vue +9 -8
  72. package/src/components/NavBar.vue +6 -6
  73. package/src/components/Pagination.vue +27 -27
  74. package/src/components/Pill.vue +11 -12
  75. package/src/components/Rating.vue +2 -2
  76. package/src/components/Slider.vue +75 -75
  77. package/src/components/Spreadsheet/Index.vue +34 -34
  78. package/src/components/Spreadsheet/SpreadsheetTable.vue +3 -3
  79. package/src/components/Zoomer.vue +165 -170
  80. package/src/components/analytics/BarChart.vue +6 -6
  81. package/src/components/analytics/KpiCard.vue +2 -2
  82. package/src/components/analytics/LineChart.vue +63 -61
  83. package/src/components/analytics/PieChart.vue +104 -90
  84. package/src/components/analytics/index.ts +2 -2
  85. package/src/components/calendar/CalendarPopover.vue +1 -1
  86. package/src/components/calendar/Index.vue +1 -1
  87. package/src/components/calendar/views/AgendaView.vue +3 -3
  88. package/src/components/calendar/views/DayView.vue +6 -6
  89. package/src/components/calendar/views/MonthView.vue +2 -2
  90. package/src/components/calendar/views/WeekView.vue +18 -18
  91. package/src/components/dataTable/DataTable.vue +4 -4
  92. package/src/components/dataTable/useSorting.ts +1 -1
  93. package/src/components/dataTable/useTableData.ts +15 -15
  94. package/src/components/dataTable/useTableSelection.ts +15 -15
  95. package/src/components/dataTable/useTableVirtualization.ts +1 -1
  96. package/src/components/draggable/useDraggable.ts +42 -42
  97. package/src/components/form/BagelForm.vue +15 -15
  98. package/src/components/form/BglFieldSet.vue +5 -3
  99. package/src/components/form/BglMultiStepForm.vue +20 -21
  100. package/src/components/form/inputs/CheckInput.vue +2 -2
  101. package/src/components/form/inputs/CodeEditor/format.ts +7 -7
  102. package/src/components/form/inputs/CodeEditor/useHighlight.ts +6 -6
  103. package/src/components/form/inputs/ColorInput.vue +5 -4
  104. package/src/components/form/inputs/DateInput.vue +8 -9
  105. package/src/components/form/inputs/DatePicker.vue +24 -24
  106. package/src/components/form/inputs/EmailInput.vue +24 -24
  107. package/src/components/form/inputs/NumberInput.vue +26 -26
  108. package/src/components/form/inputs/OTP.vue +7 -7
  109. package/src/components/form/inputs/PasswordInput.vue +3 -2
  110. package/src/components/form/inputs/RadioGroup.vue +28 -25
  111. package/src/components/form/inputs/RadioPillsInput.vue +12 -12
  112. package/src/components/form/inputs/RangeInput.vue +21 -21
  113. package/src/components/form/inputs/RichText/components/EditorToolbar.vue +107 -92
  114. package/src/components/form/inputs/RichText/components/TableGridSelector.vue +64 -64
  115. package/src/components/form/inputs/RichText/components/gridBox.vue +10 -8
  116. package/src/components/form/inputs/RichText/composables/useCommands.ts +1 -1
  117. package/src/components/form/inputs/RichText/composables/useEditor.ts +12 -12
  118. package/src/components/form/inputs/RichText/composables/useEditorKeyboard.ts +1 -1
  119. package/src/components/form/inputs/RichText/index.vue +138 -138
  120. package/src/components/form/inputs/RichText/utils/commands.ts +84 -85
  121. package/src/components/form/inputs/RichText/utils/debug.ts +1 -1
  122. package/src/components/form/inputs/RichText/utils/formatting.ts +39 -39
  123. package/src/components/form/inputs/RichText/utils/selection.ts +28 -28
  124. package/src/components/form/inputs/RichText/utils/table.ts +19 -19
  125. package/src/components/form/inputs/SelectBtn.vue +1 -1
  126. package/src/components/form/inputs/SelectInput.vue +54 -54
  127. package/src/components/form/inputs/SignaturePad.vue +40 -40
  128. package/src/components/form/inputs/TableField.vue +1 -1
  129. package/src/components/form/inputs/TelInput.vue +54 -53
  130. package/src/components/form/inputs/TextInput.vue +19 -19
  131. package/src/components/form/inputs/ToggleInput.vue +2 -2
  132. package/src/components/form/inputs/Upload/useFileUpload.ts +6 -6
  133. package/src/components/form/useBagelFormState.ts +5 -5
  134. package/src/components/layout/AppLayout.vue +2 -2
  135. package/src/components/layout/AppSidebar.vue +77 -16
  136. package/src/components/layout/Layout.vue +12 -10
  137. package/src/components/layout/SidebarMenu.vue +4 -4
  138. package/src/components/layout/TabbedLayout.vue +17 -17
  139. package/src/components/layout/Tabs.vue +4 -5
  140. package/src/components/layout/TabsNav.vue +14 -14
  141. package/src/components/layout/index.ts +3 -5
  142. package/src/components/lightbox/Lightbox.vue +22 -22
  143. package/src/components/lightbox/index.ts +8 -8
  144. package/src/composables/index.ts +8 -8
  145. package/src/composables/useAddToCalendar.ts +13 -13
  146. package/src/composables/useDevice.ts +2 -2
  147. package/src/composables/useFormField.ts +4 -4
  148. package/src/composables/usePolling.ts +8 -8
  149. package/src/composables/useSchemaField.ts +38 -38
  150. package/src/composables/useTheme.ts +9 -9
  151. package/src/composables/useValidateFieldValue.ts +2 -2
  152. package/src/directives/pattern.ts +25 -25
  153. package/src/directives/ripple.ts +4 -4
  154. package/src/directives/vResize.ts +6 -6
  155. package/src/index.ts +1 -0
  156. package/src/plugins/bagel.ts +4 -4
  157. package/src/plugins/useToast.ts +56 -51
  158. package/src/styles/layout.css +1 -1
  159. package/src/types/index.ts +1 -1
  160. package/src/utils/BagelFormUtils.ts +7 -7
  161. package/src/utils/calendar/Helpers.ts +8 -8
  162. package/src/utils/calendar/dateUtils.ts +22 -22
  163. package/src/utils/calendar/time.ts +25 -25
  164. package/src/utils/calendar/week.ts +25 -25
  165. package/src/utils/elementUtils.ts +27 -27
  166. package/src/utils/sizeParsing.ts +2 -2
  167. package/src/utils/strings.ts +5 -5
  168. package/src/utils/tapDetector.ts +11 -11
  169. package/src/utils/useSearch.ts +29 -29
  170. package/vite.config.ts +0 -2
@@ -47,12 +47,12 @@ function getTarget(el: HTMLElement): HTMLInputElement | HTMLTextAreaElement | nu
47
47
 
48
48
  function getModifiers(binding: DirectiveBinding): string {
49
49
  const modifiers = Object.keys(binding.modifiers)
50
- return 0 < modifiers.length ? modifiers[modifiers.length - 1] : ''
50
+ return modifiers.length > 0 ? modifiers[modifiers.length - 1] : ''
51
51
  }
52
52
 
53
53
  function getRegex(state: PatternState): RegExp {
54
- if (null != state.pattern) {return state.pattern}
55
- if (null != state.modifier && '' !== state.modifier) {
54
+ if (state.pattern != null) { return state.pattern }
55
+ if (state.modifier != null && state.modifier !== '') {
56
56
  const presetPattern = (DEFAULT_PATTERNS as Record<string, PatternValue | undefined>)[state.modifier]?.pattern
57
57
  return presetPattern ?? /./
58
58
  }
@@ -80,10 +80,10 @@ function bindEvents(el: HTMLElement, target: HTMLInputElement | HTMLTextAreaElem
80
80
  }
81
81
 
82
82
  function unbindEvents(target: HTMLInputElement | HTMLTextAreaElement, state: PatternState) {
83
- if (state.keydownEvent) {target.removeEventListener('keydown', state.keydownEvent)}
84
- if (state.inputEvent) {target.removeEventListener('input', state.inputEvent, { capture: true })}
85
- if (state.compositionStartEvent) {target.removeEventListener('compositionstart', state.compositionStartEvent)}
86
- if (state.compositionEndEvent) {target.removeEventListener('compositionend', state.compositionEndEvent)}
83
+ if (state.keydownEvent) { target.removeEventListener('keydown', state.keydownEvent) }
84
+ if (state.inputEvent) { target.removeEventListener('input', state.inputEvent, { capture: true }) }
85
+ if (state.compositionStartEvent) { target.removeEventListener('compositionstart', state.compositionStartEvent) }
86
+ if (state.compositionEndEvent) { target.removeEventListener('compositionend', state.compositionEndEvent) }
87
87
 
88
88
  state.keydownEvent = undefined
89
89
  state.inputEvent = undefined
@@ -102,19 +102,19 @@ function isNavigationOrControlKey(event: KeyboardEvent): boolean {
102
102
  'ArrowDown',
103
103
  'Enter',
104
104
  ]
105
- if (event.ctrlKey || event.altKey || event.metaKey) {return true}
105
+ if (event.ctrlKey || event.altKey || event.metaKey) { return true }
106
106
  return allowedKeys.includes(event.key)
107
107
  }
108
108
 
109
109
  function onKeydown(event: KeyboardEvent, target: HTMLInputElement | HTMLTextAreaElement, state: PatternState) {
110
- if (true === state.composing) {return}
111
- if (isNavigationOrControlKey(event)) {return}
110
+ if (state.composing === true) { return }
111
+ if (isNavigationOrControlKey(event)) { return }
112
112
 
113
113
  // If a transform is configured (e.g., slug/snake/lower/upper),
114
114
  // do not block keystrokes; normalization happens on input.
115
- if (null != state.modifier && '' !== state.modifier) {
115
+ if (state.modifier != null && state.modifier !== '') {
116
116
  const transformFn = (DEFAULT_PATTERNS as Record<string, PatternValue | undefined>)[state.modifier]?.transform
117
- if ('function' === typeof transformFn) {return}
117
+ if (typeof transformFn === 'function') { return }
118
118
  }
119
119
 
120
120
  const regex = getRegex(state)
@@ -142,7 +142,7 @@ function onCompositionEnd(
142
142
  function sanitizeTransformed(value: string, state: PatternState): string {
143
143
  const regex = getRegex(state)
144
144
  let transformed: string
145
- if (null != state.modifier && '' !== state.modifier) {
145
+ if (state.modifier != null && state.modifier !== '') {
146
146
  const transformFn = (DEFAULT_PATTERNS as Record<string, PatternValue | undefined>)[state.modifier]?.transform
147
147
  transformed = transformFn ? transformFn(value) : value
148
148
  } else {
@@ -151,7 +151,7 @@ function sanitizeTransformed(value: string, state: PatternState): string {
151
151
  let result = ''
152
152
  for (let i = 0; i < transformed.length; i++) {
153
153
  const ch = transformed[i]
154
- if (regex.test(ch)) {result += ch}
154
+ if (regex.test(ch)) { result += ch }
155
155
  }
156
156
  return result
157
157
  }
@@ -161,8 +161,8 @@ function onInput(
161
161
  target: HTMLInputElement | HTMLTextAreaElement,
162
162
  state: PatternState,
163
163
  ) {
164
- if (true === state.reformatting) {return}
165
- if (true === state.composing) {return}
164
+ if (state.reformatting === true) { return }
165
+ if (state.composing === true) { return }
166
166
 
167
167
  const originalValue = target.value
168
168
  const selectionEnd = target.selectionEnd ?? originalValue.length
@@ -170,7 +170,7 @@ function onInput(
170
170
  const left = originalValue.slice(0, selectionEnd)
171
171
 
172
172
  const sanitizedFull = sanitizeTransformed(originalValue, state)
173
- if (sanitizedFull === originalValue) {return}
173
+ if (sanitizedFull === originalValue) { return }
174
174
 
175
175
  const leftSanitized = sanitizeTransformed(left, state)
176
176
  const newCursor = leftSanitized.length
@@ -186,15 +186,15 @@ function onInput(
186
186
  const pattern = {
187
187
  beforeMount(el: HTMLElement, binding: DirectiveBinding) {
188
188
  const target = getTarget(el)
189
- if (null === target) {return}
189
+ if (target === null) { return }
190
190
 
191
191
  const state: PatternState = {
192
192
  modifier: getModifiers(binding),
193
193
  }
194
194
 
195
- if ('object' === typeof binding.value && null !== binding.value) {
195
+ if (typeof binding.value === 'object' && binding.value !== null) {
196
196
  state.pattern = binding.value.pattern ?? /./
197
- state.validateOnly = true === binding.value.validateOnly
197
+ state.validateOnly = binding.value.validateOnly === true
198
198
  }
199
199
 
200
200
  stateMap.set(el, state)
@@ -202,18 +202,18 @@ const pattern = {
202
202
  },
203
203
  updated(el: HTMLElement, binding: DirectiveBinding) {
204
204
  const target = getTarget(el)
205
- if (null === target) {return}
205
+ if (target === null) { return }
206
206
 
207
207
  const state = stateMap.get(el)
208
- if (state === undefined) {return}
208
+ if (state === undefined) { return }
209
209
 
210
210
  unbindEvents(target, state)
211
211
 
212
212
  state.modifier = getModifiers(binding)
213
213
 
214
- if ('object' === typeof binding.value && null !== binding.value) {
214
+ if (typeof binding.value === 'object' && binding.value !== null) {
215
215
  state.pattern = binding.value.pattern ?? /./
216
- state.validateOnly = true === binding.value.validateOnly
216
+ state.validateOnly = binding.value.validateOnly === true
217
217
  }
218
218
 
219
219
  bindEvents(el, target, state)
@@ -222,7 +222,7 @@ const pattern = {
222
222
  const target = getTarget(el)
223
223
  const state = stateMap.get(el)
224
224
 
225
- if (null !== target && state !== undefined) {
225
+ if (target !== null && state !== undefined) {
226
226
  unbindEvents(target, state)
227
227
  }
228
228
 
@@ -27,8 +27,8 @@ const ripple: Directive<HTMLElement, boolean> = {
27
27
 
28
28
  (el as any).__rippleClickHandler = clickHandler
29
29
 
30
- if (false !== binding.value) {
31
- if ('static' === getComputedStyle(el).position) {
30
+ if (binding.value !== false) {
31
+ if (getComputedStyle(el).position === 'static') {
32
32
  el.style.position = 'relative'
33
33
  }
34
34
  el.style.overflow = 'hidden'
@@ -37,10 +37,10 @@ const ripple: Directive<HTMLElement, boolean> = {
37
37
  },
38
38
  updated(el: HTMLElement, binding: DirectiveBinding<boolean>) {
39
39
  const clickHandler = (el as any).__rippleClickHandler
40
- if (false === binding.value) {
40
+ if (binding.value === false) {
41
41
  el.removeEventListener('mousedown', clickHandler)
42
42
  } else {
43
- if ('static' === getComputedStyle(el).position) {
43
+ if (getComputedStyle(el).position === 'static') {
44
44
  el.style.position = 'relative'
45
45
  }
46
46
  el.style.overflow = 'hidden'
@@ -73,12 +73,12 @@ function initResize(el: HTMLElement, binding: { value?: ResizeOptions }) {
73
73
  }
74
74
 
75
75
  function applyGridSnapping(height: number): number {
76
- if (!options.gridSize) {return height}
76
+ if (!options.gridSize) { return height }
77
77
  return Math.round(height / options.gridSize) * options.gridSize
78
78
  }
79
79
 
80
80
  function handleMove(e: MouseEvent | TouchEvent) {
81
- if (!isResizing) {return}
81
+ if (!isResizing) { return }
82
82
  e.preventDefault()
83
83
 
84
84
  const clientY = 'touches' in e ? e.touches[0].clientY : e.clientY
@@ -109,7 +109,7 @@ function initResize(el: HTMLElement, binding: { value?: ResizeOptions }) {
109
109
  }
110
110
 
111
111
  function handleEnd(e: MouseEvent | TouchEvent) {
112
- if (!isResizing) {return}
112
+ if (!isResizing) { return }
113
113
 
114
114
  const clientY = 'touches' in e ? e.changedTouches[0].clientY : e.clientY
115
115
  const event = createResizeEvent(clientY)
@@ -136,7 +136,7 @@ function initResize(el: HTMLElement, binding: { value?: ResizeOptions }) {
136
136
 
137
137
  function handleStart(e: MouseEvent | TouchEvent) {
138
138
  // Only handle left mouse button for mouse events
139
- if (e instanceof MouseEvent && 0 !== e.button) {return}
139
+ if (e instanceof MouseEvent && e.button !== 0) { return }
140
140
 
141
141
  e.preventDefault()
142
142
  isResizing = true
@@ -186,7 +186,7 @@ export const vResize: Directive<HTMLElement, ResizeOptions> = {
186
186
 
187
187
  unmounted(el) {
188
188
  const cleanup = (el as any)[RESIZE_KEY]
189
- if ('function' === typeof cleanup) {
189
+ if (typeof cleanup === 'function') {
190
190
  cleanup()
191
191
  delete (el as any)[RESIZE_KEY]
192
192
  }
@@ -195,7 +195,7 @@ export const vResize: Directive<HTMLElement, ResizeOptions> = {
195
195
  updated(el, binding) {
196
196
  if (binding.value !== binding.oldValue) {
197
197
  const cleanup = (el as any)[RESIZE_KEY]
198
- if ('function' === typeof cleanup) {
198
+ if (typeof cleanup === 'function') {
199
199
  cleanup()
200
200
  delete (el as any)[RESIZE_KEY]
201
201
  }
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './components'
2
2
  export * from './components/form/useBagelFormState'
3
3
  export * from './composables'
4
+ export * from './directives'
4
5
  export {
5
6
  bagelInjectionKey,
6
7
  type BagelOptions,
@@ -14,7 +14,7 @@ export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<(key: string) =
14
14
 
15
15
  export function injectI18nT(injectionKey: typeof i18nTInjectionKey = i18nTInjectionKey) {
16
16
  const i18nT = inject(injectionKey)
17
- if (!i18nT) {throw new Error('No i18nT provided')}
17
+ if (!i18nT) { throw new Error('No i18nT provided') }
18
18
  return i18nT
19
19
  }
20
20
 
@@ -55,9 +55,9 @@ export const BagelVue: Plugin<BagelOptions> = {
55
55
  },
56
56
  })
57
57
  const { availableLangs, defaultLang, lang } = useLang()
58
- if (options.availableLangs) {availableLangs.value = options.availableLangs}
59
- if (options.defaultLang) {defaultLang.value = options.defaultLang}
60
- if (options.language) {lang.value = options.language}
58
+ if (options.availableLangs) { availableLangs.value = options.availableLangs }
59
+ if (options.defaultLang) { defaultLang.value = options.defaultLang }
60
+ if (options.language) { lang.value = options.language }
61
61
  app.config.globalProperties.$bagel = bagel
62
62
  app.provide(bagelInjectionKey, bagel)
63
63
  app.config.globalProperties.$i18T
@@ -1,10 +1,11 @@
1
1
  import type { App, InjectionKey, Plugin } from 'vue'
2
2
  import { inject } from 'vue'
3
- import {
3
+ import Toast, {
4
4
  type PluginOptions as ToastOptions,
5
- type ToastInterface,
6
5
  POSITION,
6
+ useToast as useVueToast,
7
7
  } from 'vue-toastification'
8
+ import 'vue-toastification/dist/index.css'
8
9
 
9
10
  export interface ToastApi {
10
11
  success: (message: string, options?: any) => void
@@ -35,58 +36,62 @@ export function useToast(): ToastApi {
35
36
  export type BagelToastOptions = Partial<ToastOptions>
36
37
 
37
38
  export const ToastPlugin: Plugin<BagelToastOptions[]> = {
38
- install: async (app: App, options: BagelToastOptions = {}) => {
39
- try {
40
- // Dynamically import vue-toastification to avoid bundling if not used
41
- const Toast = await import('vue-toastification')
42
- const ToastInterface = Toast.default || Toast
43
-
44
- const defaultOptions: ToastOptions = {
45
- position: POSITION.TOP_RIGHT,
46
- timeout: 3000,
47
- closeOnClick: true,
48
- pauseOnFocusLoss: true,
49
- pauseOnHover: true,
50
- draggable: true,
51
- draggablePercent: 0.6,
52
- showCloseButtonOnHover: false,
53
- hideProgressBar: false,
54
- closeButton: 'button',
55
- icon: true,
56
- rtl: false,
57
- transition: 'Vue-Toastification__fade',
58
- maxToasts: 5,
59
- newestOnTop: true,
60
- ...options,
61
- }
62
-
63
- // Install vue-toastification
64
- app.use(ToastInterface as Plugin, defaultOptions)
65
-
66
- // Get the toast instance
67
- const toast: ToastInterface = app.config.globalProperties.$toast
39
+ install: (app: App, options: BagelToastOptions = {}) => {
40
+ const defaultOptions: ToastOptions = {
41
+ position: POSITION.TOP_RIGHT,
42
+ timeout: 3000,
43
+ closeOnClick: true,
44
+ pauseOnFocusLoss: true,
45
+ pauseOnHover: true,
46
+ draggable: true,
47
+ draggablePercent: 0.6,
48
+ showCloseButtonOnHover: false,
49
+ hideProgressBar: false,
50
+ closeButton: 'button',
51
+ icon: true,
52
+ rtl: false,
53
+ transition: 'Vue-Toastification__fade',
54
+ maxToasts: 5,
55
+ newestOnTop: true,
56
+ ...options,
57
+ }
68
58
 
69
- // Create the API wrapper
70
- const api: ToastApi = {
71
- success: (message: string, options?: any) => toast.success(message, options),
72
- error: (message: string, options?: any) => toast.error(message, options),
73
- info: (message: string, options?: any) => toast.info(message, options),
74
- warning: (message: string, options?: any) => toast.warning(message, options),
75
- show: (message: string, options?: any) => toast(message, options),
76
- clear: () => { toast.clear() },
77
- }
59
+ // Install vue-toastification
60
+ app.use(Toast, defaultOptions)
78
61
 
79
- // Set global singleton on first install
80
- if (!globalToastApi) {
81
- globalToastApi = api
82
- }
62
+ // Create the API wrapper using lazy evaluation
63
+ const api: ToastApi = {
64
+ success: (message: string, opts?: any) => {
65
+ const toast = useVueToast()
66
+ return toast.success(message, opts)
67
+ },
68
+ error: (message: string, opts?: any) => {
69
+ const toast = useVueToast()
70
+ return toast.error(message, opts)
71
+ },
72
+ info: (message: string, opts?: any) => {
73
+ const toast = useVueToast()
74
+ return toast.info(message, opts)
75
+ },
76
+ warning: (message: string, opts?: any) => {
77
+ const toast = useVueToast()
78
+ return toast.warning(message, opts)
79
+ },
80
+ show: (message: string, opts?: any) => {
81
+ const toast = useVueToast()
82
+ return toast(message, opts)
83
+ },
84
+ clear: () => {
85
+ const toast = useVueToast()
86
+ toast.clear()
87
+ },
88
+ }
83
89
 
84
- app.provide(ToastSymbol, api)
85
- } catch (error) {
86
- console.error('Failed to load vue-toastification. Make sure it is installed:', error)
87
- throw new Error(
88
- 'vue-toastification is required for ToastPlugin. Install it with: pnpm add vue-toastification'
89
- )
90
+ // Set global singleton on first install
91
+ if (!globalToastApi) {
92
+ globalToastApi = api
90
93
  }
94
+
95
+ app.provide(ToastSymbol, api)
91
96
  },
92
97
  }
@@ -179,7 +179,7 @@
179
179
  }
180
180
 
181
181
  .align-items-baseline {
182
- align-items: baseline;
182
+ align-items: baseline !important;
183
183
  }
184
184
 
185
185
  .align-items-end {
@@ -37,7 +37,7 @@ export type ExtendedThemeType =
37
37
  // Legacy light variants
38
38
  | 'blue-light' | 'green-light' | 'red-light' | 'yellow-light' | 'purple-light' | 'brown-light'
39
39
  | 'orange-light' | 'turquoise-light' | 'pink-light' | 'gray-light' | 'primary-light'
40
- // Legacy tint variants
40
+ // Legacy tint variants
41
41
  | 'blue-tint' | 'red-tint' | 'primary-tint' | 'black-tint' | 'blue-dark' | 'light'
42
42
  // 10% variants (lightest)
43
43
  | 'blue-10' | 'green-10' | 'red-10' | 'yellow-10' | 'purple-10' | 'brown-10' | 'orange-10' | 'turquoise-10' | 'gray-10' | 'black-10' | 'pink-10'
@@ -103,7 +103,7 @@ export function getBaseField<T, P extends Path<T, PO>, PO extends PathsOptions =
103
103
  labelOrRest: string | Partial<BaseBagelField<T, P>> = {},
104
104
  rest: Partial<BaseBagelField<T, P>> = {}
105
105
  ): BaseBagelField<T, P, PO> {
106
- if ('object' === typeof labelOrRest) {return { id, ...labelOrRest }}
106
+ if (typeof labelOrRest === 'object') { return { id, ...labelOrRest } }
107
107
  return { id, label: labelOrRest, ...rest }
108
108
  }
109
109
 
@@ -429,7 +429,7 @@ export function rangeField<
429
429
  }
430
430
 
431
431
  export function bglForm<T>(idOrField?: string | FieldByP<T, Path<T>>, ...schema: FieldByP<T, Path<T>>[]) {
432
- if ('string' === typeof idOrField) {
432
+ if (typeof idOrField === 'string') {
433
433
  return {
434
434
  $el: 'bagelform',
435
435
  id: idOrField,
@@ -497,13 +497,13 @@ export function colorField<
497
497
 
498
498
  export function findBglFieldById<T>(id: string, _schema: ShallowBglFormSchemaT<T>): FieldByP<T, Path<T>> | undefined {
499
499
  for (const field of _schema) {
500
- if (field.id === id) {return field as FieldByP<T, Path<T>> | undefined}
501
- if (field.children && 0 < Number(field.children.length)) {
500
+ if (field.id === id) { return field as FieldByP<T, Path<T>> | undefined }
501
+ if (field.children && Number(field.children.length) > 0) {
502
502
  const fieldChildren = field.children.filter(
503
- c => 'object' === typeof c && '$el' in c
503
+ c => typeof c === 'object' && '$el' in c
504
504
  )
505
505
  const child = findBglFieldById(id, fieldChildren as ShallowBglFormSchemaT<T>)
506
- if (child) {return child as FieldByP<T, Path<T>> | undefined}
506
+ if (child) { return child as FieldByP<T, Path<T>> | undefined }
507
507
  }
508
508
  }
509
509
  return undefined
@@ -531,7 +531,7 @@ export function arrField<
531
531
  options?: ArrayFieldOptions<T, P>
532
532
  ): ArrayBagelField<T, P, PO> {
533
533
  const arraySpecificAttrs = (
534
- 'string' === typeof schemaOrType
534
+ typeof schemaOrType === 'string'
535
535
  ? { type: schemaOrType }
536
536
  : { schema: schemaOrType }
537
537
  )
@@ -11,7 +11,7 @@ export default class Helpers {
11
11
  * otherwise just use navigator.language
12
12
  */
13
13
  static getBrowserNavigatorLocale(): string {
14
- if ('object' !== typeof navigator) {return 'en-US'}
14
+ if (typeof navigator !== 'object') { return 'en-US' }
15
15
 
16
16
  return navigator.languages && navigator.languages.length
17
17
  ? navigator.languages[0]
@@ -22,16 +22,16 @@ export default class Helpers {
22
22
  * Solution from https://github.com/vuejs/core/issues/4733#issuecomment-1024816095
23
23
  */
24
24
  static hasSlotContent(slot: Slot | undefined) {
25
- if (!slot) {return false}
25
+ if (!slot) { return false }
26
26
 
27
27
  return slot().some((vnode: VNode) => {
28
- if (vnode.type === Comment) {return false}
28
+ if (vnode.type === Comment) { return false }
29
29
 
30
- if (Array.isArray(vnode.children) && !vnode.children.length) {return false}
30
+ if (Array.isArray(vnode.children) && !vnode.children.length) { return false }
31
31
 
32
32
  return (
33
33
  vnode.type !== Text
34
- || ('string' === typeof vnode.children && '' !== vnode.children.trim())
34
+ || (typeof vnode.children === 'string' && vnode.children.trim() !== '')
35
35
  )
36
36
  })
37
37
  }
@@ -43,9 +43,9 @@ export default class Helpers {
43
43
  const isFullDayEvent = DATE_TIME_STRING_FULL_DAY_PATTERN.test(event.time.start)
44
44
  && DATE_TIME_STRING_FULL_DAY_PATTERN.test(event.time.end)
45
45
 
46
- if (isTimedEvent) {return this.getTimedEventType(event, time)}
46
+ if (isTimedEvent) { return this.getTimedEventType(event, time) }
47
47
 
48
- if (isFullDayEvent) {return this.getFullDayEventType(event, time)}
48
+ if (isFullDayEvent) { return this.getFullDayEventType(event, time) }
49
49
 
50
50
  throw new Error('Event has invalid type')
51
51
  }
@@ -81,6 +81,6 @@ export default class Helpers {
81
81
  }
82
82
 
83
83
  static isUIEventTouchEvent(event: UIEvent): boolean {
84
- return 'touches' in event && 'object' === typeof event.touches
84
+ return 'touches' in event && typeof event.touches === 'object'
85
85
  }
86
86
  }
@@ -112,8 +112,8 @@ const translations: Record<AvailableTimeLanguages, LanguageTranslations> = {
112
112
  }
113
113
 
114
114
  export function timeAgo(date: string | Date, lang: AvailableTimeLanguages = 'en') {
115
- if (!date) {return ''}
116
- if ('string' === typeof date) {date = new Date(date)}
115
+ if (!date) { return '' }
116
+ if (typeof date === 'string') { date = new Date(date) }
117
117
  const now: Date = new Date()
118
118
  const nowNumber = now.getTime()
119
119
  const dateNumber = date.getTime()
@@ -133,32 +133,32 @@ export function timeAgo(date: string | Date, lang: AvailableTimeLanguages = 'en'
133
133
 
134
134
  for (const interval of intervals) {
135
135
  const count = Math.floor(Math.abs(seconds) / interval.seconds)
136
- if (1 <= count) {
137
- const suffix = 0 > seconds ? ` ${selectedLang.ago}` : ''
138
- const prefix = 0 < seconds && 'in' !== selectedLang.in ? `${selectedLang.in} ` : ''
136
+ if (count >= 1) {
137
+ const suffix = seconds < 0 ? ` ${selectedLang.ago}` : ''
138
+ const prefix = seconds > 0 && selectedLang.in !== 'in' ? `${selectedLang.in} ` : ''
139
139
 
140
140
  // Handle Hebrew plural forms
141
- if ('he' === lang) {
141
+ if (lang === 'he') {
142
142
  const timeUnit = selectedLang[interval.label] as TimeUnit
143
- const form = 1 === count ? timeUnit.singular : timeUnit.plural
143
+ const form = count === 1 ? timeUnit.singular : timeUnit.plural
144
144
 
145
145
  // For Hebrew, we place the prefix/suffix before the number
146
- const hebrewPrefix = 0 > seconds ? `${selectedLang.ago} ` : (0 < seconds ? `${selectedLang.in} ` : '')
146
+ const hebrewPrefix = seconds < 0 ? `${selectedLang.ago} ` : (seconds > 0 ? `${selectedLang.in} ` : '')
147
147
 
148
- if ('day' === interval.label && 0 < seconds) {
148
+ if (interval.label === 'day' && seconds > 0) {
149
149
  const hours = Math.floor((Math.abs(seconds) % 86400) / 3600)
150
150
  const hourUnit = selectedLang.hour as TimeUnit
151
- const hourForm = 1 === hours ? hourUnit.singular : hourUnit.plural
152
- return `${hebrewPrefix}${count} ${form}${ 0 < hours ? ` ${hours} ${hourForm}` : ''}`
151
+ const hourForm = hours === 1 ? hourUnit.singular : hourUnit.plural
152
+ return `${hebrewPrefix}${count} ${form}${hours > 0 ? ` ${hours} ${hourForm}` : ''}`
153
153
  }
154
154
  return `${hebrewPrefix}${count} ${form}`
155
155
  }
156
156
 
157
157
  // Handle other languages
158
- if ('day' === interval.label && 0 < seconds) {
158
+ if (interval.label === 'day' && seconds > 0) {
159
159
  const hours = Math.floor((Math.abs(seconds) % 86400) / 3600)
160
- const hourLabel = 1 < hours ? `${selectedLang.hour}s` : selectedLang.hour
161
- return `${prefix}${count} ${selectedLang[interval.label]}${ 0 < hours ? ` ${hours} ${hourLabel}` : ''}${suffix}`
160
+ const hourLabel = hours > 1 ? `${selectedLang.hour}s` : selectedLang.hour
161
+ return `${prefix}${count} ${selectedLang[interval.label]}${hours > 0 ? ` ${hours} ${hourLabel}` : ''}${suffix}`
162
162
  }
163
163
  return `${prefix}${count} ${selectedLang[interval.label]}${suffix}`
164
164
  }
@@ -168,7 +168,7 @@ export function timeAgo(date: string | Date, lang: AvailableTimeLanguages = 'en'
168
168
  }
169
169
 
170
170
  function getBrowserNavigatorLocale(): string {
171
- if ('object' !== typeof navigator) {return 'en-US'}
171
+ if (typeof navigator !== 'object') { return 'en-US' }
172
172
  return navigator.languages && navigator.languages.length
173
173
  ? navigator.languages[0]
174
174
  : navigator.language
@@ -182,7 +182,7 @@ function getBrowserNavigatorLocale(): string {
182
182
  */
183
183
  export function handleTimezone(date: Date, intFmtOpt: Intl.DateTimeFormatOptions): Date {
184
184
  // If timeZone is UTC, convert to UTC directly
185
- if ('UTC' === intFmtOpt.timeZone) {
185
+ if (intFmtOpt.timeZone === 'UTC') {
186
186
  const utcDate = new Date(date.getTime())
187
187
  utcDate.setMinutes(utcDate.getMinutes() + date.getTimezoneOffset())
188
188
  return utcDate
@@ -203,7 +203,7 @@ export function handleTimezone(date: Date, intFmtOpt: Intl.DateTimeFormatOptions
203
203
  const parts: Record<string, number> = {}
204
204
 
205
205
  formattedParts.forEach((part) => {
206
- if ('literal' !== part.type && 'timeZoneName' !== part.type) {
206
+ if (part.type !== 'literal' && part.type !== 'timeZoneName') {
207
207
  parts[part.type] = Number.parseInt(part.value, 10)
208
208
  }
209
209
  })
@@ -305,10 +305,10 @@ export function formatDate(
305
305
  let rest: Partial<Pick<Intl.DateTimeFormatOptions, 'hour12'>> = {}
306
306
 
307
307
  // Handle both overloads
308
- if ('string' === typeof formatOrOpts) {
308
+ if (typeof formatOrOpts === 'string') {
309
309
  // First overload: format string directly
310
310
  format = formatOrOpts
311
- } else if (formatOrOpts && 'object' === typeof formatOrOpts) {
311
+ } else if (formatOrOpts && typeof formatOrOpts === 'object') {
312
312
  // Second overload: options object
313
313
  format = formatOrOpts.fmt
314
314
  locale = formatOrOpts.locale
@@ -316,13 +316,13 @@ export function formatDate(
316
316
  rest = formatOrOpts
317
317
  }
318
318
 
319
- if (!date) {return ''}
319
+ if (!date) { return '' }
320
320
  format = format || 'DD.MM.YY'
321
321
 
322
322
  locale = locale || getBrowserNavigatorLocale()
323
323
  try {
324
324
  // Validate the date
325
- const d = 'string' === typeof date || 'number' === typeof date ? new Date(date) : date
325
+ const d = typeof date === 'string' || typeof date === 'number' ? new Date(date) : date
326
326
 
327
327
  // Check if date is valid
328
328
  if (Number.isNaN(d.getTime())) {
@@ -355,7 +355,7 @@ export function formatDate(
355
355
  const partsMap: Partial<Record<Intl.DateTimeFormatPartTypes, string>> = {}
356
356
 
357
357
  formattedParts.forEach((part) => {
358
- if ('literal' !== part.type) {
358
+ if (part.type !== 'literal') {
359
359
  partsMap[part.type] = part.value
360
360
  }
361
361
  })