quasar 2.14.7 → 2.15.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.
Files changed (158) hide show
  1. package/dist/api/QDialog.json +1 -1
  2. package/dist/api/QImg.json +1 -1
  3. package/dist/api/QSelect.json +1 -1
  4. package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
  5. package/dist/icon-set/eva-icons.umd.prod.js +1 -1
  6. package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
  7. package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
  8. package/dist/icon-set/fontawesome-v6-pro.umd.prod.js +1 -1
  9. package/dist/icon-set/fontawesome-v6.umd.prod.js +1 -1
  10. package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
  11. package/dist/icon-set/line-awesome.umd.prod.js +1 -1
  12. package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
  13. package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
  14. package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
  15. package/dist/icon-set/material-icons.umd.prod.js +1 -1
  16. package/dist/icon-set/material-symbols-outlined.umd.prod.js +1 -1
  17. package/dist/icon-set/material-symbols-rounded.umd.prod.js +1 -1
  18. package/dist/icon-set/material-symbols-sharp.umd.prod.js +1 -1
  19. package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
  20. package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
  21. package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
  22. package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
  23. package/dist/icon-set/mdi-v7.umd.prod.js +1 -1
  24. package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
  25. package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
  26. package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
  27. package/dist/icon-set/svg-fontawesome-v6.umd.prod.js +1 -1
  28. package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
  29. package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
  30. package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
  31. package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
  32. package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
  33. package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
  34. package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
  35. package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
  36. package/dist/icon-set/svg-material-symbols-outlined.umd.prod.js +1 -1
  37. package/dist/icon-set/svg-material-symbols-rounded.umd.prod.js +1 -1
  38. package/dist/icon-set/svg-material-symbols-sharp.umd.prod.js +1 -1
  39. package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
  40. package/dist/icon-set/svg-mdi-v7.umd.prod.js +1 -1
  41. package/dist/icon-set/svg-themify.umd.prod.js +1 -1
  42. package/dist/icon-set/themify.umd.prod.js +1 -1
  43. package/dist/lang/ar-TN.umd.prod.js +1 -1
  44. package/dist/lang/ar.umd.prod.js +1 -1
  45. package/dist/lang/az-Latn.umd.prod.js +1 -1
  46. package/dist/lang/bg.umd.prod.js +1 -1
  47. package/dist/lang/bn.umd.prod.js +1 -1
  48. package/dist/lang/ca.umd.prod.js +1 -1
  49. package/dist/lang/cs.umd.prod.js +1 -1
  50. package/dist/lang/da.umd.prod.js +1 -1
  51. package/dist/lang/de-CH.umd.prod.js +1 -1
  52. package/dist/lang/de-DE.umd.prod.js +1 -1
  53. package/dist/lang/de.umd.prod.js +1 -1
  54. package/dist/lang/el.umd.prod.js +1 -1
  55. package/dist/lang/en-GB.umd.prod.js +1 -1
  56. package/dist/lang/en-US.umd.prod.js +1 -1
  57. package/dist/lang/eo.umd.prod.js +1 -1
  58. package/dist/lang/es.umd.prod.js +1 -1
  59. package/dist/lang/et.umd.prod.js +1 -1
  60. package/dist/lang/eu.umd.prod.js +1 -1
  61. package/dist/lang/fa-IR.umd.prod.js +1 -1
  62. package/dist/lang/fa.umd.prod.js +1 -1
  63. package/dist/lang/fi.umd.prod.js +1 -1
  64. package/dist/lang/fr.umd.prod.js +1 -1
  65. package/dist/lang/gn.umd.prod.js +1 -1
  66. package/dist/lang/he.umd.prod.js +1 -1
  67. package/dist/lang/hi.umd.prod.js +1 -1
  68. package/dist/lang/hr.umd.prod.js +1 -1
  69. package/dist/lang/hu.umd.prod.js +1 -1
  70. package/dist/lang/id.umd.prod.js +1 -1
  71. package/dist/lang/is.umd.prod.js +1 -1
  72. package/dist/lang/it.umd.prod.js +1 -1
  73. package/dist/lang/ja.umd.prod.js +1 -1
  74. package/dist/lang/kk.umd.prod.js +1 -1
  75. package/dist/lang/km.umd.prod.js +1 -1
  76. package/dist/lang/ko-KR.umd.prod.js +1 -1
  77. package/dist/lang/kur-CKB.umd.prod.js +1 -1
  78. package/dist/lang/lt.umd.prod.js +1 -1
  79. package/dist/lang/lu.umd.prod.js +1 -1
  80. package/dist/lang/lv.umd.prod.js +1 -1
  81. package/dist/lang/mk.umd.prod.js +1 -1
  82. package/dist/lang/ml.umd.prod.js +1 -1
  83. package/dist/lang/mm.umd.prod.js +1 -1
  84. package/dist/lang/ms-MY.umd.prod.js +1 -1
  85. package/dist/lang/ms.umd.prod.js +1 -1
  86. package/dist/lang/my.umd.prod.js +1 -1
  87. package/dist/lang/nb-NO.umd.prod.js +1 -1
  88. package/dist/lang/nl.umd.prod.js +1 -1
  89. package/dist/lang/pl.umd.prod.js +1 -1
  90. package/dist/lang/pt-BR.umd.prod.js +1 -1
  91. package/dist/lang/pt.umd.prod.js +1 -1
  92. package/dist/lang/ro.umd.prod.js +1 -1
  93. package/dist/lang/ru.umd.prod.js +1 -1
  94. package/dist/lang/sk.umd.prod.js +1 -1
  95. package/dist/lang/sl.umd.prod.js +1 -1
  96. package/dist/lang/sm.umd.prod.js +1 -1
  97. package/dist/lang/sr-CYR.umd.prod.js +1 -1
  98. package/dist/lang/sr.umd.prod.js +1 -1
  99. package/dist/lang/sv.umd.prod.js +1 -1
  100. package/dist/lang/ta.umd.prod.js +1 -1
  101. package/dist/lang/th.umd.prod.js +1 -1
  102. package/dist/lang/tl.umd.prod.js +1 -1
  103. package/dist/lang/tr.umd.prod.js +1 -1
  104. package/dist/lang/ug.umd.prod.js +1 -1
  105. package/dist/lang/uk.umd.prod.js +1 -1
  106. package/dist/lang/uz-Cyrl.umd.prod.js +1 -1
  107. package/dist/lang/uz-Latn.umd.prod.js +1 -1
  108. package/dist/lang/vi.umd.prod.js +1 -1
  109. package/dist/lang/zh-CN.umd.prod.js +1 -1
  110. package/dist/lang/zh-TW.umd.prod.js +1 -1
  111. package/dist/quasar.cjs.prod.js +59 -59
  112. package/dist/quasar.esm.js +963 -931
  113. package/dist/quasar.esm.prod.js +53 -53
  114. package/dist/quasar.sass +1 -1
  115. package/dist/quasar.umd.js +150 -118
  116. package/dist/quasar.umd.prod.js +55 -55
  117. package/dist/transforms/import-map.json +1 -1
  118. package/dist/transforms/loader-asset-urls.json +1 -1
  119. package/dist/types/composables.d.ts +38 -0
  120. package/dist/types/index.d.ts +12 -0
  121. package/dist/types/tsconfig.json +1 -1
  122. package/dist/vetur/quasar-attributes.json +1 -1
  123. package/dist/vetur/quasar-tags.json +1 -1
  124. package/dist/web-types/web-types.json +1 -1
  125. package/package.json +30 -38
  126. package/src/components/btn-dropdown/QBtnDropdown.js +1 -1
  127. package/src/components/color/QColor.js +19 -13
  128. package/src/components/date/QDate.js +2 -2
  129. package/src/components/dialog/QDialog.js +15 -3
  130. package/src/components/dialog/QDialog.json +19 -0
  131. package/src/components/drawer/QDrawer.js +1 -1
  132. package/src/components/editor/QEditor.js +4 -4
  133. package/src/components/expansion-item/QExpansionItem.js +1 -1
  134. package/src/components/fab/QFab.js +1 -1
  135. package/src/components/img/QImg.js +76 -56
  136. package/src/components/img/QImg.json +20 -6
  137. package/src/components/menu/QMenu.js +2 -2
  138. package/src/components/no-ssr/QNoSsr.js +3 -3
  139. package/src/components/resize-observer/QResizeObserver.js +3 -3
  140. package/src/components/select/QSelect.js +3 -0
  141. package/src/components/select/QSelect.json +7 -0
  142. package/src/components/slide-item/QSlideItem.js +3 -3
  143. package/src/components/stepper/QStep.js +3 -3
  144. package/src/components/tabs/QTabs.js +2 -2
  145. package/src/components/tooltip/QTooltip.js +2 -2
  146. package/src/composables/private/use-field.js +9 -12
  147. package/src/composables/private/use-panel.js +3 -3
  148. package/src/composables/use-hydration.js +16 -0
  149. package/src/composables/use-id.js +50 -0
  150. package/src/composables/use-interval.js +36 -0
  151. package/src/composables/use-render-cache.js +40 -0
  152. package/src/composables/{private/use-split-attrs.js → use-split-attrs.js} +4 -2
  153. package/src/composables/{private/use-tick.js → use-tick.js} +1 -1
  154. package/src/composables/{private/use-timeout.js → use-timeout.js} +5 -2
  155. package/src/composables.js +15 -1
  156. package/src/composables/private/use-cache.js +0 -21
  157. package/src/composables/private/use-can-render.js +0 -16
  158. package/src/composables/private/use-id.js +0 -34
@@ -1,6 +1,6 @@
1
1
  import { h } from 'vue'
2
2
 
3
- import useCanRender from '../../composables/private/use-can-render.js'
3
+ import useHydration from '../../composables/use-hydration.js'
4
4
 
5
5
  import { createComponent } from '../../utils/private/create.js'
6
6
  import { hSlot } from '../../utils/private/render.js'
@@ -18,10 +18,10 @@ export default createComponent({
18
18
  },
19
19
 
20
20
  setup (props, { slots }) {
21
- const canRender = useCanRender()
21
+ const { isHydrated } = useHydration()
22
22
 
23
23
  return () => {
24
- if (canRender.value === true) {
24
+ if (isHydrated.value === true) {
25
25
  const node = hSlot(slots.default)
26
26
  return node === void 0
27
27
  ? node
@@ -1,6 +1,6 @@
1
1
  import { h, onMounted, onBeforeUnmount, getCurrentInstance, nextTick } from 'vue'
2
2
 
3
- import useCanRender from '../../composables/private/use-can-render.js'
3
+ import useHydration from '../../composables/use-hydration.js'
4
4
 
5
5
  import { createComponent } from '../../utils/private/create.js'
6
6
  import { listenOpts, noop } from '../../utils/event.js'
@@ -95,7 +95,7 @@ export default createComponent({
95
95
  return noop
96
96
  }
97
97
  else { // no observer, so fallback to old iframe method
98
- const canRender = useCanRender()
98
+ const { isHydrated } = useHydration()
99
99
 
100
100
  let curDocView
101
101
 
@@ -134,7 +134,7 @@ export default createComponent({
134
134
  onBeforeUnmount(cleanup)
135
135
 
136
136
  return () => {
137
- if (canRender.value === true) {
137
+ if (isHydrated.value === true) {
138
138
  return h('object', {
139
139
  class: 'q--avoid-card-border',
140
140
  style: resizeProps.style,
@@ -79,6 +79,7 @@ export default createComponent({
79
79
 
80
80
  popupContentClass: String,
81
81
  popupContentStyle: [ String, Array, Object ],
82
+ popupNoRouteDismiss: Boolean,
82
83
 
83
84
  useInput: Boolean,
84
85
  useChips: Boolean,
@@ -1186,6 +1187,7 @@ export default createComponent({
1186
1187
  noParentEvent: true,
1187
1188
  noRefocus: true,
1188
1189
  noFocus: true,
1190
+ noRouteDismiss: props.popupNoRouteDismiss,
1189
1191
  square: squaredMenu.value,
1190
1192
  transitionShow: props.transitionShow,
1191
1193
  transitionHide: props.transitionHide,
@@ -1263,6 +1265,7 @@ export default createComponent({
1263
1265
  transitionShow: transitionShowComputed,
1264
1266
  transitionHide: props.transitionHide,
1265
1267
  transitionDuration: props.transitionDuration,
1268
+ noRouteDismiss: props.popupNoRouteDismiss,
1266
1269
  onBeforeShow: onControlPopupShow,
1267
1270
  onBeforeHide: onDialogBeforeHide,
1268
1271
  onHide: onDialogHide,
@@ -232,6 +232,13 @@
232
232
  "category": "style"
233
233
  },
234
234
 
235
+ "popup-no-route-dismiss": {
236
+ "type": "Boolean",
237
+ "desc": "Changing route app won't dismiss the popup (menu or dialog)",
238
+ "category": "behavior",
239
+ "addedIn": "v2.15"
240
+ },
241
+
235
242
  "use-input": {
236
243
  "type": "Boolean",
237
244
  "desc": "Use an input tag where users can type",
@@ -3,7 +3,7 @@ import { h, ref, computed, withDirectives, onBeforeUnmount, onBeforeUpdate, getC
3
3
  import TouchPan from '../../directives/TouchPan.js'
4
4
 
5
5
  import useDark, { useDarkProps } from '../../composables/private/use-dark.js'
6
- import useCache from '../../composables/private/use-cache.js'
6
+ import useRenderCache from '../../composables/use-render-cache.js'
7
7
 
8
8
  import { createComponent } from '../../utils/private/create.js'
9
9
  import { hSlot } from '../../utils/private/render.js'
@@ -36,7 +36,7 @@ export default createComponent({
36
36
  const { $q } = proxy
37
37
 
38
38
  const isDark = useDark(props, $q)
39
- const { getCacheWithFn } = useCache()
39
+ const { getCache } = useRenderCache()
40
40
 
41
41
  const contentRef = ref(null)
42
42
 
@@ -209,7 +209,7 @@ export default createComponent({
209
209
  }
210
210
  else {
211
211
  content.push(
212
- withDirectives(node, getCacheWithFn('dir#' + dirs.join(''), () => {
212
+ withDirectives(node, getCache('dir#' + dirs.join(''), () => {
213
213
  const modifiers = {
214
214
  prevent: true,
215
215
  stop: true,
@@ -4,7 +4,7 @@ import QSlideTransition from '../slide-transition/QSlideTransition.js'
4
4
  import StepHeader from './StepHeader.js'
5
5
 
6
6
  import { usePanelChildProps } from '../../composables/private/use-panel.js'
7
- import useCache from '../../composables/private/use-cache.js'
7
+ import useRenderCache from '../../composables/use-render-cache.js'
8
8
 
9
9
  import { createComponent } from '../../utils/private/create.js'
10
10
  import { stepperKey, emptyRenderFn } from '../../utils/private/symbols.js'
@@ -67,7 +67,7 @@ export default createComponent({
67
67
  return emptyRenderFn
68
68
  }
69
69
 
70
- const { getCacheWithFn } = useCache()
70
+ const { getCache } = useRenderCache()
71
71
 
72
72
  const rootRef = ref(null)
73
73
 
@@ -106,7 +106,7 @@ export default createComponent({
106
106
  ? [
107
107
  h(
108
108
  $stepper.value.needsUniqueKeepAliveWrapper.value === true
109
- ? getCacheWithFn(contentKey.value, () => ({ ...PanelWrapper, name: contentKey.value }))
109
+ ? getCache(contentKey.value, () => ({ ...PanelWrapper, name: contentKey.value }))
110
110
  : PanelWrapper,
111
111
  { key: contentKey.value },
112
112
  slots.default
@@ -3,8 +3,8 @@ import { h, ref, computed, watch, onBeforeUnmount, onActivated, onDeactivated, g
3
3
  import QIcon from '../icon/QIcon.js'
4
4
  import QResizeObserver from '../resize-observer/QResizeObserver.js'
5
5
 
6
- import useTick from '../../composables/private/use-tick.js'
7
- import useTimeout from '../../composables/private/use-timeout.js'
6
+ import useTick from '../../composables/use-tick.js'
7
+ import useTimeout from '../../composables/use-timeout.js'
8
8
 
9
9
  import { createComponent } from '../../utils/private/create.js'
10
10
  import { hSlot } from '../../utils/private/render.js'
@@ -5,8 +5,8 @@ import useScrollTarget from '../../composables/private/use-scroll-target.js'
5
5
  import useModelToggle, { useModelToggleProps, useModelToggleEmits } from '../../composables/private/use-model-toggle.js'
6
6
  import usePortal from '../../composables/private/use-portal.js'
7
7
  import useTransition, { useTransitionProps } from '../../composables/private/use-transition.js'
8
- import useTick from '../../composables/private/use-tick.js'
9
- import useTimeout from '../../composables/private/use-timeout.js'
8
+ import useTick from '../../composables/use-tick.js'
9
+ import useTimeout from '../../composables/use-timeout.js'
10
10
 
11
11
  import { createComponent } from '../../utils/private/create.js'
12
12
  import { getScrollTarget } from '../../utils/scroll.js'
@@ -1,12 +1,12 @@
1
- import { h, ref, computed, watch, Transition, nextTick, onActivated, onDeactivated, onBeforeUnmount, onMounted, getCurrentInstance } from 'vue'
1
+ import { h, ref, computed, Transition, nextTick, onActivated, onDeactivated, onBeforeUnmount, onMounted, getCurrentInstance } from 'vue'
2
2
 
3
3
  import QIcon from '../../components/icon/QIcon.js'
4
4
  import QSpinner from '../../components/spinner/QSpinner.js'
5
5
 
6
6
  import useDark, { useDarkProps } from '../../composables/private/use-dark.js'
7
- import useId, { getId } from './use-id.js'
7
+ import useId from '../use-id.js'
8
8
  import useValidate, { useValidateProps } from './use-validate.js'
9
- import useSplitAttrs from './use-split-attrs.js'
9
+ import useSplitAttrs from '../use-split-attrs.js'
10
10
 
11
11
  import { hSlot } from '../../utils/private/render.js'
12
12
  import { prevent, stopAndPrevent } from '../../utils/event.js'
@@ -69,10 +69,13 @@ export const useFieldProps = {
69
69
  export const useFieldEmits = [ 'update:modelValue', 'clear', 'focus', 'blur', 'popupShow', 'popupHide' ]
70
70
 
71
71
  export function useFieldState ({ requiredForAttr = true, tagProp } = {}) {
72
- const { props, attrs, proxy, vnode } = getCurrentInstance()
72
+ const { props, proxy } = getCurrentInstance()
73
73
 
74
74
  const isDark = useDark(props, proxy.$q)
75
- const targetUid = useId(props.for, requiredForAttr)
75
+ const targetUid = useId({
76
+ required: requiredForAttr,
77
+ getValue: () => props.for
78
+ })
76
79
 
77
80
  return {
78
81
  requiredForAttr,
@@ -90,7 +93,7 @@ export function useFieldState ({ requiredForAttr = true, tagProp } = {}) {
90
93
  focused: ref(false),
91
94
  hasPopupOpen: false,
92
95
 
93
- splitAttrs: useSplitAttrs(attrs, vnode),
96
+ splitAttrs: useSplitAttrs(),
94
97
  targetUid,
95
98
 
96
99
  rootRef: ref(null),
@@ -256,12 +259,6 @@ export default function (state) {
256
259
  return acc
257
260
  })
258
261
 
259
- watch(() => props.for, val => {
260
- // don't transform targetUid into a computed
261
- // prop as it will break SSR
262
- state.targetUid.value = getId(val, state.requiredForAttr)
263
- })
264
-
265
262
  function focusHandler () {
266
263
  const el = document.activeElement
267
264
  let target = state.targetRef !== void 0 && state.targetRef.value
@@ -2,7 +2,7 @@ import { h, ref, computed, watch, nextTick, getCurrentInstance, Transition, Keep
2
2
 
3
3
  import TouchSwipe from '../../directives/TouchSwipe.js'
4
4
 
5
- import useCache from '../../composables/private/use-cache.js'
5
+ import useRenderCache from '../../composables/use-render-cache.js'
6
6
 
7
7
  import { hSlot } from '../../utils/private/render.js'
8
8
  import { getNormalizedVNodes } from '../../utils/private/vm.js'
@@ -48,7 +48,7 @@ export const usePanelEmits = [ 'update:modelValue', 'beforeTransition', 'transit
48
48
 
49
49
  export default function () {
50
50
  const { props, emit, proxy } = getCurrentInstance()
51
- const { getCacheWithFn } = useCache()
51
+ const { getCache } = useRenderCache()
52
52
 
53
53
  let panels, forcedPanelTransition
54
54
 
@@ -207,7 +207,7 @@ export default function () {
207
207
  h(KeepAlive, keepAliveProps.value, [
208
208
  h(
209
209
  needsUniqueKeepAliveWrapper.value === true
210
- ? getCacheWithFn(contentKey.value, () => ({ ...PanelWrapper, name: contentKey.value }))
210
+ ? getCache(contentKey.value, () => ({ ...PanelWrapper, name: contentKey.value }))
211
211
  : PanelWrapper,
212
212
  { key: contentKey.value, style: transitionStyle.value },
213
213
  () => panel
@@ -0,0 +1,16 @@
1
+ import { ref, onMounted } from 'vue'
2
+
3
+ // using it to manage SSR rendering with best performance
4
+ import { isRuntimeSsrPreHydration } from '../plugins/Platform.js'
5
+
6
+ export default function () {
7
+ const isHydrated = ref(!isRuntimeSsrPreHydration.value)
8
+
9
+ if (isHydrated.value === false) {
10
+ onMounted(() => {
11
+ isHydrated.value = true
12
+ })
13
+ }
14
+
15
+ return { isHydrated }
16
+ }
@@ -0,0 +1,50 @@
1
+ import { ref, computed, watch, onMounted } from 'vue'
2
+
3
+ import uid from '../utils/uid.js'
4
+
5
+ import { isRuntimeSsrPreHydration } from '../plugins/Platform.js'
6
+
7
+ function parseValue (val) {
8
+ return val === void 0 || val === null
9
+ ? null
10
+ : val
11
+ }
12
+
13
+ function getId (val, required) {
14
+ return val === void 0 || val === null
15
+ ? (required === true ? `f_${ uid() }` : null)
16
+ : val
17
+ }
18
+
19
+ /**
20
+ * Returns an "id" which is a ref() that can be used as
21
+ * a unique identifier to apply to a DOM node attribute.
22
+ *
23
+ * On SSR, it takes care of generating the id on the client side (only) to
24
+ * avoid hydration errors.
25
+ */
26
+ export default function ({ getValue, required = true } = {}) {
27
+ if (isRuntimeSsrPreHydration.value === true) {
28
+ const id = getValue !== void 0
29
+ ? ref(parseValue(getValue()))
30
+ : ref(null)
31
+
32
+ if (required === true && id.value === null) {
33
+ onMounted(() => {
34
+ id.value = `f_${ uid() }` // getId(null, true)
35
+ })
36
+ }
37
+
38
+ if (getValue !== void 0) {
39
+ watch(getValue, newId => {
40
+ id.value = getId(newId, required)
41
+ })
42
+ }
43
+
44
+ return id
45
+ }
46
+
47
+ return getValue !== void 0
48
+ ? computed(() => getId(getValue(), required))
49
+ : ref(`f_${ uid() }`) // getId(null, true)
50
+ }
@@ -0,0 +1,36 @@
1
+ import { onDeactivated, onBeforeUnmount, getCurrentInstance } from 'vue'
2
+
3
+ import { vmIsDestroyed } from '../utils/private/vm.js'
4
+
5
+ /*
6
+ * Usage:
7
+ * registerInterval(fn[, delay])
8
+ * removeInterval()
9
+ */
10
+
11
+ export default function () {
12
+ let timer = null
13
+ const vm = getCurrentInstance()
14
+
15
+ function removeInterval () {
16
+ if (timer !== null) {
17
+ clearInterval(timer)
18
+ timer = null
19
+ }
20
+ }
21
+
22
+ onDeactivated(removeInterval)
23
+ onBeforeUnmount(removeInterval)
24
+
25
+ return {
26
+ removeInterval,
27
+
28
+ registerInterval (fn, delay) {
29
+ removeInterval(timer)
30
+
31
+ if (vmIsDestroyed(vm) === false) {
32
+ timer = setInterval(fn, delay)
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,40 @@
1
+ export default function () {
2
+ let cache = Object.create(null)
3
+
4
+ return {
5
+ getCache: __QUASAR_SSR_SERVER__
6
+ ? (_, defaultValue) => (
7
+ typeof defaultValue === 'function'
8
+ ? defaultValue()
9
+ : defaultValue
10
+ )
11
+ : (key, defaultValue) => (
12
+ cache[ key ] === void 0
13
+ ? (
14
+ cache[ key ] = (
15
+ typeof defaultValue === 'function'
16
+ ? defaultValue()
17
+ : defaultValue
18
+ )
19
+ )
20
+ : cache[ key ]
21
+ ),
22
+
23
+ setCache (key, obj) {
24
+ cache[ key ] = obj
25
+ },
26
+
27
+ hasCache (key) {
28
+ return cache.hasOwnProperty(key)
29
+ },
30
+
31
+ clearCache (key) {
32
+ if (key !== void 0) {
33
+ delete cache[ key ]
34
+ }
35
+ else {
36
+ cache = {}
37
+ }
38
+ }
39
+ }
40
+ }
@@ -1,8 +1,10 @@
1
- import { ref, onBeforeUpdate } from 'vue'
1
+ import { ref, onBeforeUpdate, getCurrentInstance } from 'vue'
2
2
 
3
3
  const listenerRE = /^on[A-Z]/
4
4
 
5
- export default function (attrs, vnode) {
5
+ export default function () {
6
+ const { attrs, vnode } = getCurrentInstance()
7
+
6
8
  const acc = {
7
9
  listeners: ref({}),
8
10
  attributes: ref({})
@@ -1,6 +1,6 @@
1
1
  import { nextTick, onDeactivated, onBeforeUnmount, getCurrentInstance } from 'vue'
2
2
 
3
- import { vmIsDestroyed } from '../../utils/private/vm'
3
+ import { vmIsDestroyed } from '../utils/private/vm'
4
4
 
5
5
  /*
6
6
  * Usage:
@@ -1,6 +1,6 @@
1
1
  import { onDeactivated, onBeforeUnmount, getCurrentInstance } from 'vue'
2
2
 
3
- import { vmIsDestroyed } from '../../utils/private/vm.js'
3
+ import { vmIsDestroyed } from '../utils/private/vm.js'
4
4
 
5
5
  /*
6
6
  * Usage:
@@ -29,7 +29,10 @@ export default function () {
29
29
  removeTimeout(timer)
30
30
 
31
31
  if (vmIsDestroyed(vm) === false) {
32
- timer = setTimeout(fn, delay)
32
+ timer = setTimeout(() => {
33
+ timer = null
34
+ fn()
35
+ }, delay)
33
36
  }
34
37
  }
35
38
  }
@@ -3,9 +3,23 @@ import useFormChild from './composables/use-form-child.js'
3
3
  import useMeta from './composables/use-meta.js'
4
4
  import useQuasar from './composables/use-quasar.js'
5
5
 
6
+ import useHydration from './composables/use-hydration.js'
7
+ import useId from './composables/use-id.js'
8
+ import useRenderCache from './composables/use-render-cache.js'
9
+ import useSplitAttrs from './composables/use-split-attrs.js'
10
+ import useTick from './composables/use-tick.js'
11
+ import useTimeout from './composables/use-timeout.js'
12
+
6
13
  export {
7
14
  useDialogPluginComponent,
8
15
  useFormChild,
9
16
  useMeta,
10
- useQuasar
17
+ useQuasar,
18
+
19
+ useHydration,
20
+ useId,
21
+ useRenderCache,
22
+ useSplitAttrs,
23
+ useTick,
24
+ useTimeout
11
25
  }
@@ -1,21 +0,0 @@
1
- export default function () {
2
- const cache = new Map()
3
-
4
- return {
5
- getCache: __QUASAR_SSR_SERVER__
6
- ? function (_, obj) { return obj }
7
- : function (key, obj) {
8
- return cache[ key ] === void 0
9
- ? (cache[ key ] = obj)
10
- : cache[ key ]
11
- },
12
-
13
- getCacheWithFn: __QUASAR_SSR_SERVER__
14
- ? function (_, fn) { return fn() }
15
- : function (key, fn) {
16
- return cache[ key ] === void 0
17
- ? (cache[ key ] = fn())
18
- : cache[ key ]
19
- }
20
- }
21
- }
@@ -1,16 +0,0 @@
1
- import { ref, onMounted } from 'vue'
2
-
3
- // using it to manage SSR rendering with best performance
4
- import { isRuntimeSsrPreHydration } from '../../plugins/Platform.js'
5
-
6
- export default function () {
7
- const canRender = ref(!isRuntimeSsrPreHydration.value)
8
-
9
- if (canRender.value === false) {
10
- onMounted(() => {
11
- canRender.value = true
12
- })
13
- }
14
-
15
- return canRender
16
- }
@@ -1,34 +0,0 @@
1
- import { ref, onMounted } from 'vue'
2
-
3
- import uid from '../../utils/uid.js'
4
-
5
- import { isRuntimeSsrPreHydration } from '../../plugins/Platform.js'
6
-
7
- export function getId (val, requiredId) {
8
- return val === void 0
9
- ? (requiredId === true ? `f_${ uid() }` : void 0)
10
- : val
11
- }
12
-
13
- /**
14
- * Returns an "id" which is a ref() that can be used as a unique identifier.
15
- * On SSR, it takes care of generating the id on the client side (only) to
16
- * avoid hydration errors.
17
- */
18
- export default function (initialId, requiredId = true) {
19
- if (isRuntimeSsrPreHydration.value === true) {
20
- const id = ref(initialId)
21
-
22
- if (requiredId === true && initialId === void 0) {
23
- onMounted(() => {
24
- id.value = `f_${ uid() }` // getId(void 0, true)
25
- })
26
- }
27
-
28
- return id
29
- }
30
-
31
- return ref(
32
- getId(initialId, requiredId)
33
- )
34
- }