@bagelink/vue 1.4.167 → 1.4.171

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAI1E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,IAAI,GAAE,MAAY,QAO1D;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,UAMlC;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ3D;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,iBAGtE;AAED,wBAAgB,QAAQ,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,UAG3C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,QAIrE;AAED,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,UAOpE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,EAC7C,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,QAAQ,CAAC,EAAE,GAAG,EACd,GAAG,CAAC,EAAE,CAAC;;EAwBP;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAO9C;AAED,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG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,CAAC,CAAC,EAClC,IAAI,CAAC,EAAE,GAAG,EAAE,EACZ,OAAO,CAAC,EAAE,MAAM,EAAE,GAChB,cAAc,CAAC,CAAC,CAAC,CAgBnB;AAED,wBAAgB,KAAK,CAAC,EAAE,GAAE,MAAY,oBAErC;AAKD,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CxF;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAatD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,UAIvC;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,aAAa,SAAO,GAAG,MAAM,GAAG,SAAS,CAG/G;AAED,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAM5C,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,sBAsB5C;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,GAAE,GAAe,GAAG,GAAG,CAa1F;AAID,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,QAkBpE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.4.167",
4
+ "version": "1.4.171",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -115,29 +115,52 @@ const shouldDisablePositioning = $computed(() => {
115
115
  return disablePlacement && isMobile
116
116
  })
117
117
 
118
+ // Convert hover triggers to click on mobile devices
119
+ const computedTriggers = $computed((): TriggerEvent[] => {
120
+ if (isMobile && triggers.includes('hover')) {
121
+ // Replace hover with click on mobile
122
+ return triggers.map(trigger => trigger === 'hover' ? 'click' : trigger) as TriggerEvent[]
123
+ }
124
+ return triggers
125
+ })
126
+
118
127
  // Intelligent trigger configuration
119
128
  const computedShowTriggers = $computed((): TriggerEvent[] => {
120
- if (showTriggers !== undefined) return showTriggers
121
- return triggers
129
+ if (showTriggers !== undefined) {
130
+ // Also convert hover to click in showTriggers on mobile
131
+ if (isMobile && showTriggers.includes('hover')) {
132
+ return showTriggers.map(trigger => trigger === 'hover' ? 'click' : trigger) as TriggerEvent[]
133
+ }
134
+ return showTriggers
135
+ }
136
+ return computedTriggers
122
137
  })
123
138
 
124
139
  const computedHideTriggers = $computed((): TriggerEvent[] => {
125
- if (hideTriggers !== undefined) return hideTriggers
140
+ if (hideTriggers !== undefined) {
141
+ // Also convert hover to click in hideTriggers on mobile
142
+ if (isMobile && hideTriggers.includes('hover')) {
143
+ return hideTriggers.map(trigger => trigger === 'hover' ? 'click' : trigger) as TriggerEvent[]
144
+ }
145
+ return hideTriggers
146
+ }
126
147
  // For click-only dropdowns, only hide on click
127
- if (triggers.length === 1 && triggers[0] === 'click') {
148
+ if (computedTriggers.length === 1 && computedTriggers[0] === 'click') {
128
149
  return ['click'] as TriggerEvent[]
129
150
  }
130
151
  // For hover dropdowns, add click to hide triggers for better UX
131
- if (triggers.includes('hover')) {
132
- return [...triggers, 'click'] as TriggerEvent[]
152
+ // But on mobile, hover becomes click, so we handle it differently
153
+ if (computedTriggers.includes('hover')) {
154
+ return [...computedTriggers, 'click'] as TriggerEvent[]
133
155
  }
134
- return triggers
156
+ return computedTriggers
135
157
  })
136
158
 
137
159
  const computedPopperTriggers = $computed((): TriggerEvent[] => {
138
160
  if (popperTriggers.length > 0) return popperTriggers
139
161
  // For hover dropdowns, enable hover on popper to keep it open
140
- if (triggers.includes('hover')) {
162
+ // But on mobile, don't add hover triggers since we convert to click
163
+ if (computedTriggers.includes('hover') && !isMobile) {
141
164
  return ['hover'] as TriggerEvent[]
142
165
  }
143
166
  return []
@@ -147,7 +170,8 @@ const computedPopperTriggers = $computed((): TriggerEvent[] => {
147
170
  const computedPopperShowTriggers = $computed((): TriggerEvent[] | undefined => {
148
171
  const hasExplicitShowTriggers = Array.isArray(popperShowTriggers) && popperShowTriggers.length > 0
149
172
  if (hasExplicitShowTriggers) return popperShowTriggers
150
- if (triggers.includes('hover')) return ['hover'] as TriggerEvent[]
173
+ // Only add hover for popper on desktop
174
+ if (computedTriggers.includes('hover') && !isMobile) return ['hover'] as TriggerEvent[]
151
175
  return undefined
152
176
  })
153
177
 
@@ -155,7 +179,8 @@ const computedPopperHideTriggers = $computed((): TriggerEvent[] => {
155
179
  const hasExplicitHideTriggers = Array.isArray(popperHideTriggers) && popperHideTriggers.length > 0
156
180
  if (hasExplicitHideTriggers) return popperHideTriggers
157
181
  // For hover dropdowns, make sure popper hides on mouseout
158
- if (triggers.includes('hover')) {
182
+ // But only on desktop where hover is meaningful
183
+ if (computedTriggers.includes('hover') && !isMobile) {
159
184
  return ['hover'] as TriggerEvent[]
160
185
  }
161
186
  return []
@@ -165,11 +190,11 @@ const computedAutoHide = $computed(() => autoHide)
165
190
 
166
191
  const computedDelay = $computed((): number | { show: number, hide: number } | undefined => {
167
192
  if (delay !== undefined) return delay
168
- // For hover dropdowns, add a hide delay
169
- if (triggers.includes('hover')) {
170
- return { show: 0, hide: 10 } // 50ms delay before hiding
193
+ // For hover dropdowns, add a hide delay (but only on desktop)
194
+ if (computedTriggers.includes('hover') && !isMobile) {
195
+ return { show: 0, hide: 10 } // 10ms delay before hiding
171
196
  }
172
- // For click dropdowns, no delay
197
+ // For click dropdowns (including mobile), no delay
173
198
  return 0
174
199
  })
175
200
 
@@ -179,7 +204,7 @@ defineExpose({ show, hide, shown })
179
204
  <template>
180
205
  <DDown
181
206
  ref="ddownRef" v-model:shown="shown" :disabled :noAutoFocus :positioning-disabled="shouldDisablePositioning"
182
- :placement :autoHide="computedAutoHide" :delay="computedDelay" :triggers :showTriggers="computedShowTriggers"
207
+ :placement :autoHide="computedAutoHide" :delay="computedDelay" :triggers="computedTriggers" :showTriggers="computedShowTriggers"
183
208
  :hideTriggers="computedHideTriggers" :popperTriggers="computedPopperTriggers"
184
209
  :popperShowTriggers="computedPopperShowTriggers" :popperHideTriggers="computedPopperHideTriggers"
185
210
  :showGroup="showGroup" @hide="emit('hide')" @show="emit('show')"
@@ -157,7 +157,7 @@ onUnmounted(() => {
157
157
  :key="event.id"
158
158
  class="event"
159
159
  :style="{
160
- height: `${event.height}px`,
160
+ // height: `${event.height}px`,
161
161
  backgroundColor: event.color || 'var(--bgl-primary)',
162
162
  }"
163
163
  :data-date="event.start_time"
@@ -207,11 +207,11 @@ onUnmounted(() => {
207
207
  .agenda-content {
208
208
  flex-grow: 1;
209
209
  overflow-y: auto;
210
- padding: 1rem;
210
+ padding: 1rem 0;
211
211
  }
212
212
 
213
213
  .event {
214
- margin-bottom: 1rem;
214
+ margin-bottom: 0.5rem;
215
215
  border-radius: 4px;
216
216
  overflow: hidden;
217
217
  cursor: pointer;
@@ -219,7 +219,8 @@ onUnmounted(() => {
219
219
  }
220
220
 
221
221
  .event:hover {
222
- transform: scale(1.01);
222
+ /* transform: scale(1.01); */
223
+ filter: brightness(90%);
223
224
  }
224
225
 
225
226
  .event-content {
@@ -318,7 +318,7 @@ onUnmounted(() => {
318
318
  }
319
319
 
320
320
  .event-content {
321
- padding: 0.5rem;
321
+ padding: 0.15rem 0.5rem;
322
322
  color: white;
323
323
  font-size: 0.9rem;
324
324
  height: 100%;
@@ -217,13 +217,21 @@ function handleEventSelection(event: CalendarEvent, domEvent?: MouseEvent) {
217
217
  font-size: 0.8rem;
218
218
  cursor: pointer;
219
219
  transition: all 0.2s ease;
220
+ display: flex;
221
+ align-items: center;
222
+ gap: 0.25rem;
223
+ min-width: 0;
224
+ justify-content: space-between;
225
+ /* Allow flex items to shrink */
220
226
  }
221
227
 
222
228
  .event-title {
223
229
  font-weight: 500;
224
- white-space: nowrap;
230
+ /* white-space: nowrap; */
231
+ height: 1lh;
225
232
  overflow: hidden;
226
233
  text-overflow: ellipsis;
234
+
227
235
  }
228
236
 
229
237
  .event-time {
@@ -4,6 +4,7 @@ import type { MaybeRefOrGetter, Ref, UnwrapRef } from 'vue'
4
4
  import { getFallbackSchema } from '@bagelink/vue'
5
5
  import { ref, toValue, watch } from 'vue'
6
6
 
7
+ export { getBagelInstance, setBagelInstance, useBagel } from './useBagel'
7
8
  export { useDevice } from './useDevice'
8
9
  export { useExcel } from './useExcel'
9
10
  export { usePolling } from './usePolling'
@@ -0,0 +1,21 @@
1
+ import type { Bagel } from '@bagelink/sdk'
2
+ import { shallowRef } from 'vue'
3
+
4
+ // Global state for the Bagel instance (using shallowRef to avoid deep reactivity on class instance)
5
+ const bagelInstance = shallowRef<Bagel | null>(null)
6
+
7
+ export function useBagel(): Bagel {
8
+ const instance = bagelInstance.value
9
+ if (!instance) {
10
+ throw new Error('Bagel instance is not initialized. Please install BagelVue plugin first.')
11
+ }
12
+ return instance
13
+ }
14
+
15
+ export function setBagelInstance(instance: Bagel) {
16
+ bagelInstance.value = instance
17
+ }
18
+
19
+ export function getBagelInstance(): Bagel | null {
20
+ return bagelInstance.value
21
+ }
package/src/index.ts CHANGED
@@ -6,8 +6,7 @@ export {
6
6
  type BagelOptions,
7
7
  BagelVue,
8
8
  i18nTInjectionKey,
9
- useBagel,
10
- useI18nT,
9
+ injectI18nT,
11
10
  } from './plugins/bagel'
12
11
  export { ModalPlugin, useModal } from './plugins/useModal'
13
12
  export * from './types'
@@ -4,6 +4,7 @@ import FloatingVue from 'floating-vue'
4
4
  import { inject } from 'vue'
5
5
 
6
6
  import lightboxPlugin from '../components/lightbox/index'
7
+ import { setBagelInstance } from '../composables/useBagel'
7
8
  import { ripple, pattern } from '../directives'
8
9
  import { useLang } from '../utils'
9
10
  import clickOutside from '../utils/clickOutside'
@@ -11,13 +12,7 @@ import clickOutside from '../utils/clickOutside'
11
12
  export const bagelInjectionKey = Symbol('bagel') as InjectionKey<Bagel>
12
13
  export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<(key: string) => string>
13
14
 
14
- export function useBagel(injectionKey: InjectionKey<Bagel> = bagelInjectionKey): Bagel {
15
- const bagel = inject(injectionKey)
16
- if (!bagel) throw new Error('No bagel provided')
17
- return bagel
18
- }
19
-
20
- export function useI18nT(injectionKey: typeof i18nTInjectionKey = i18nTInjectionKey) {
15
+ export function injectI18nT(injectionKey: typeof i18nTInjectionKey = i18nTInjectionKey) {
21
16
  const i18nT = inject(injectionKey)
22
17
  if (!i18nT) throw new Error('No i18nT provided')
23
18
  return i18nT
@@ -36,6 +31,10 @@ export interface BagelOptions {
36
31
  export const BagelVue: Plugin<BagelOptions> = {
37
32
  install: (app, options) => {
38
33
  const bagel = new Bagel({ host: options.host, fileBaseUrl: options.fileBaseUrl, onError: options.onError })
34
+
35
+ // Set global Bagel instance for the composable
36
+ setBagelInstance(bagel)
37
+
39
38
  app.directive('click-outside', clickOutside)
40
39
  app.directive('ripple', ripple)
41
40
  app.directive('pattern', pattern)
@@ -332,4 +332,5 @@ select {
332
332
  position: absolute !important;
333
333
  bottom: 0 !important;
334
334
  left: 50% !important;
335
+ min-width: 0 !important;
335
336
  }
@@ -206,17 +206,32 @@ export { useLang } from './lang'
206
206
  export { formatString } from './strings'
207
207
  export { useDebounceFn } from '@vueuse/core'
208
208
 
209
- const fileBaseUrl = (import.meta.env.VITE_FILE_BASE_URL || 'https://files.bagel.design').replace(/\/$/, '')
210
- const bagelBaseUrl = import.meta.env.VITE_BAGEL_BASE_URL
209
+ import { getBagelInstance } from '../composables/useBagel'
211
210
 
212
211
  const URL_REGEX = /^https?:\/\/|^\/\//
213
212
 
214
213
  export function pathKeyToURL(pathKey?: string) {
215
- if (!pathKey || URL_REGEX.test(pathKey)) return pathKey
214
+ if (pathKey === undefined || pathKey === '' || URL_REGEX.test(pathKey)) return pathKey
215
+
216
+ const bagel = getBagelInstance()
217
+ if (!bagel) {
218
+ console.warn('Bagel instance is not initialized. Please install BagelVue plugin.')
219
+ return pathKey
220
+ }
221
+
216
222
  if (pathKey.startsWith('static/')) {
217
- return `${bagelBaseUrl}/${pathKey}`
223
+ if (bagel.host === undefined || bagel.host === '') {
224
+ console.warn('Bagel host is not configured. Please set it in BagelVue options.')
225
+ return pathKey
226
+ }
227
+ return `${bagel.host}/${pathKey}`
228
+ }
229
+
230
+ if (bagel.fileBaseUrl === undefined || bagel.fileBaseUrl === '') {
231
+ console.warn('File base URL is not configured. Please set it in BagelVue options.')
232
+ return pathKey
218
233
  }
219
- return `${fileBaseUrl}/${pathKey}`
234
+ return `${bagel.fileBaseUrl}/${pathKey}`
220
235
  }
221
236
 
222
237
  export function getNestedValue(obj: any, path?: string, defaultValue: any = undefined): any {