@getcortexlabs/mavis 0.1.0-rc.13 → 0.1.0-rc.14

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 (76) hide show
  1. package/README.md +5 -5
  2. package/dist/native/flex-layout.ios.d.ts.map +1 -1
  3. package/dist/native/flex-layout.ios.js +4 -0
  4. package/dist/native/flex-layout.ios.js.map +1 -1
  5. package/dist/native/motion-region.d.ts.map +1 -1
  6. package/dist/native/motion-region.js +1 -0
  7. package/dist/native/motion-region.js.map +1 -1
  8. package/dist/native/motion-surface.d.ts +1 -1
  9. package/dist/native/motion-surface.d.ts.map +1 -1
  10. package/dist/native/motion-surface.js +20 -3
  11. package/dist/native/motion-surface.js.map +1 -1
  12. package/dist/native/scroll-motion.d.ts +1 -1
  13. package/dist/native/scroll-motion.d.ts.map +1 -1
  14. package/dist/native/scroll-motion.js +55 -16
  15. package/dist/native/scroll-motion.js.map +1 -1
  16. package/dist/native/section-scroll.d.ts +1 -1
  17. package/dist/native/section-scroll.d.ts.map +1 -1
  18. package/dist/native/section-scroll.js +19 -6
  19. package/dist/native/section-scroll.js.map +1 -1
  20. package/dist/vue/card-input.d.ts +4 -0
  21. package/dist/vue/card-input.d.ts.map +1 -0
  22. package/dist/vue/card-input.js +37 -0
  23. package/dist/vue/card-input.js.map +1 -0
  24. package/dist/vue/components/ChoiceControl.d.ts +1 -1
  25. package/dist/vue/components/DateCalendar.d.ts +1 -1
  26. package/dist/vue/components/MButton.d.ts +6 -6
  27. package/dist/vue/components/MCard.d.ts.map +1 -1
  28. package/dist/vue/components/MCard.js +3 -2
  29. package/dist/vue/components/MCard.js.map +1 -1
  30. package/dist/vue/components/MChip.d.ts +1 -1
  31. package/dist/vue/components/MDatePicker.d.ts +96 -96
  32. package/dist/vue/components/MDatePicker.d.ts.map +1 -1
  33. package/dist/vue/components/MEmptyState.d.ts +1 -1
  34. package/dist/vue/components/MInput.d.ts +4 -4
  35. package/dist/vue/components/MPopover.d.ts +1 -1
  36. package/dist/vue/components/MProgress.d.ts +1 -1
  37. package/dist/vue/components/MRangeSlider.d.ts +2 -2
  38. package/dist/vue/components/MResizablePanels.d.ts +1 -1
  39. package/dist/vue/components/MReveal.d.ts +8 -8
  40. package/dist/vue/components/MSheet.d.ts +4 -4
  41. package/dist/vue/components/MSlider.d.ts +1 -1
  42. package/dist/vue/components/MStack.d.ts +8 -8
  43. package/dist/vue/components/MTimePicker.d.ts +40 -40
  44. package/dist/vue/components/MTimePicker.d.ts.map +1 -1
  45. package/dist/vue/components/MTooltip.d.ts +1 -1
  46. package/dist/vue/components/MVirtualList.d.ts.map +1 -1
  47. package/dist/vue/components/MVirtualList.js +88 -67
  48. package/dist/vue/components/MVirtualList.js.map +1 -1
  49. package/dist/vue/components/advanced.d.ts +34 -34
  50. package/dist/vue/components/configurator.d.ts +33 -33
  51. package/dist/vue/components/creative.d.ts +20 -20
  52. package/dist/vue/components/dashboard.d.ts +12 -12
  53. package/dist/vue/components/dashboard.d.ts.map +1 -1
  54. package/dist/vue/components/dashboard.js +167 -66
  55. package/dist/vue/components/dashboard.js.map +1 -1
  56. package/dist/vue/components/discovery.d.ts +10 -10
  57. package/dist/vue/components/interactive.d.ts +6 -6
  58. package/dist/vue/components/layout.d.ts +16 -16
  59. package/dist/vue/components/navigation.d.ts +4 -4
  60. package/dist/vue/components/screen-components.d.ts +23 -23
  61. package/dist/vue/components/wayfinding.d.ts +11 -11
  62. package/dist/vue/components/workflows.d.ts +5 -5
  63. package/dist/vue/use-motion-surface.d.ts.map +1 -1
  64. package/dist/vue/use-motion-surface.js +0 -6
  65. package/dist/vue/use-motion-surface.js.map +1 -1
  66. package/package.json +3 -3
  67. package/src/native/flex-layout.ios.ts +4 -0
  68. package/src/native/motion-region.ts +1 -0
  69. package/src/native/motion-surface.ts +22 -3
  70. package/src/native/scroll-motion.ts +60 -19
  71. package/src/native/section-scroll.ts +16 -6
  72. package/src/vue/card-input.ts +44 -0
  73. package/src/vue/components/MCard.ts +4 -3
  74. package/src/vue/components/MVirtualList.ts +104 -78
  75. package/src/vue/components/dashboard.ts +173 -68
  76. package/src/vue/use-motion-surface.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"use-motion-surface.js","sourceRoot":"","sources":["../../src/vue/use-motion-surface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAA6B,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAGhB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEtD,MAAM,UAAU,gBAAgB,CAC9B,OAAwC,EACxC,UAAyB,GAAG,EAAE,CAAC,IAAI,EACnC,YAA2B,GAAG,EAAE,CAAC,KAAK,EACtC,WAAW,GAAG,KAAK;IAEnB,IAAI,IAAsB,CAAA;IAC1B,IAAI,MAAgC,CAAA;IACpC,IAAI,aAAuC,CAAA;IAC3C,IAAI,UAAkE,CAAA;IACtE,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4C,CAAA;IAClE,IAAI,UAA4B,CAAA;IAChC,IAAI,YAAY,GAAG,KAAK,CAAA;IACxB,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;IACrD,IAAI,IAAqD,CAAA;IACzD,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,MAAM,KAAK,GAAG,WAAW,EAAE,EAAE,CAA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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getcortexlabs/mavis",
3
- "version": "0.1.0-rc.13",
3
+ "version": "0.1.0-rc.14",
4
4
  "description": "Mavis UI foundations for NativeScript, with a Vue integration.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@nativescript/core": "^9.1.3",
46
- "@rafaelaugusto/jolt": "^0.1.0-rc.13",
46
+ "@rafaelaugusto/jolt": "^0.1.0-rc.15",
47
47
  "nativescript-vue": "^3.1.3"
48
48
  },
49
49
  "peerDependenciesMeta": {
@@ -52,7 +52,7 @@
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@getcortexlabs/mavis-core": "0.1.0-rc.13"
55
+ "@getcortexlabs/mavis-core": "0.1.0-rc.14"
56
56
  },
57
57
  "nativescript": {
58
58
  "platforms": {
@@ -222,5 +222,9 @@ export class MavisFlexLayout extends FlexboxLayout {
222
222
  ? layout.makeMeasureSpec(child.effectiveHeight, layout.EXACTLY)
223
223
  : layout.makeMeasureSpec(available, mode),
224
224
  )
225
+ // Core applies min/max constraints before our width-aware remeasurement. Its
226
+ // Flexbox onMeasure does not enforce its own minimum, so measuring a nested
227
+ // row again can collapse a 44-point link to its label's intrinsic height.
228
+ base._checkSizeConstraints.call(this, child)
225
229
  }
226
230
  }
@@ -204,6 +204,7 @@ export function attachNativeMotionRegion(reference: MotionRegion, target: View)
204
204
  : ([resolveChild(step[0]), step[1], step[2]] as const),
205
205
  )
206
206
  const adapter: MotionRegionAdapter = {
207
+ // Jolt captures before native unload, then waits for layout; rebuilt RC.15 classes own exits.
207
208
  animateLayout: (change, { transition, ...options }) =>
208
209
  animateLayout(target, change, { ...transition, ...options }),
209
210
  ...nativePlatformMotion(target, resolveChild, scope),
@@ -48,6 +48,8 @@ export function nativeContinuousSurface(
48
48
  | 'drag'
49
49
  | 'map'
50
50
  | 'mapColor'
51
+ | 'scalar'
52
+ | 'readVelocity'
51
53
  | 'refresh'
52
54
  | 'scrollLinked'
53
55
  | 'scrollSection'
@@ -177,10 +179,27 @@ export function nativeContinuousSurface(
177
179
  refresh: () => target.requestLayout(),
178
180
  map(source, input, output, options) {
179
181
  const mapped = sources.get(source)!.to(input, output, options)
180
- const value = { get: () => mapped.get(), dispose() {} }
182
+ const value = { get: () => mapped.get(), dispose: () => mapped.dispose() }
181
183
  sources.set(value, mapped)
182
184
  return value
183
185
  },
186
+ scalar(source, operation, operand, maximum) {
187
+ const input = sources.get(source)!
188
+ let result: DerivedValue
189
+ if (operation === 'clamp') result = input.clamp(operand as number, maximum!)
190
+ else if (
191
+ operation === 'abs' ||
192
+ operation === 'sin' ||
193
+ operation === 'cos' ||
194
+ operation === 'velocity'
195
+ )
196
+ result = input[operation]()
197
+ else result = input[operation](typeof operand === 'number' ? operand : sources.get(operand!)!)
198
+ const value = { get: () => result.get(), dispose: () => result.dispose() }
199
+ sources.set(value, result)
200
+ return value
201
+ },
202
+ readVelocity: (source) => sources.get(source)!.getVelocity(),
184
203
  mapColor(source, input, output) {
185
204
  const mapped = sources.get(source)!.to(input, output)
186
205
  const value = { get: () => mapped.get().hex, dispose() {} }
@@ -199,7 +218,7 @@ export function nativeContinuousSurface(
199
218
  },
200
219
  playbackProgress(handle) {
201
220
  const progress = playbackProgress(handle as Parameters<typeof playbackProgress>[0])
202
- const value = { get: () => progress.get(), dispose() {} }
221
+ const value = { get: () => progress.get(), dispose: () => progress.dispose() }
203
222
  sources.set(value, progress)
204
223
  return value
205
224
  },
@@ -212,7 +231,7 @@ export function nativeContinuousSurface(
212
231
  const value: MotionValueAdapter = {
213
232
  get: () => source.get(),
214
233
  set: (value) => set(source, value),
215
- dispose: () => stop(source),
234
+ dispose: () => source.dispose(),
216
235
  }
217
236
  sources.set(value, source)
218
237
  return value
@@ -1,5 +1,11 @@
1
1
  import type { EventData, ScrollView, View } from '@nativescript/core'
2
- import { bind, scrollValue, onReducedMotion, reducedMotion } from '@rafaelaugusto/jolt'
2
+ import {
3
+ bind,
4
+ scrollValue,
5
+ onReducedMotion,
6
+ reducedMotion,
7
+ type DerivedValue,
8
+ } from '@rafaelaugusto/jolt'
3
9
  import {
4
10
  bindMotionScrollSource,
5
11
  type MotionScrollAdapter,
@@ -33,7 +39,9 @@ export function nativeScrollMotion(
33
39
  ) {
34
40
  const source = sources.get(adapter)
35
41
  if (!source) throw new TypeError('Use a scrolling MScreen in this renderer.')
36
- const offset = scrollValue(source)
42
+ const offset = scrollValue(source, {
43
+ execution: options.execution === 'scheduler' ? 'javascript' : 'auto',
44
+ })
37
45
  const active = new Map<string, readonly number[]>()
38
46
  for (const [key, values] of Object.entries(frames)) {
39
47
  if (key === 'scale') {
@@ -42,21 +50,45 @@ export function nativeScrollMotion(
42
50
  } else active.set(key, values)
43
51
  }
44
52
  const bindings = new Map<string, () => void>()
53
+ let bounded: DerivedValue | undefined
45
54
  let disposed = false
46
55
  let maximum = -1
47
56
  let content: View | undefined
57
+ const clearBindings = () => {
58
+ for (const release of bindings.values()) release()
59
+ bindings.clear()
60
+ bounded?.dispose()
61
+ bounded = undefined
62
+ }
48
63
  const apply = () => {
49
64
  if (disposed) return
50
- const bounded = offset.to([0, Math.max(1, maximum)], [0, Math.max(0, maximum)])
51
- for (const [key, output] of active) {
52
- bindings.get(key)?.()
53
- const input = output.map(
54
- (_, index) =>
55
- options.range[0] + (index * (options.range[1] - options.range[0])) / (output.length - 1),
56
- )
57
- const values =
58
- reducedMotion() && key !== 'opacity' ? output.map(() => output.at(-1)!) : output
59
- bindings.set(key, bind(target, { [key]: bounded.to(input, values) }))
65
+ clearBindings()
66
+ bounded = offset.to([0, Math.max(1, maximum)], [0, Math.max(0, maximum)])
67
+ try {
68
+ for (const [key, output] of active) {
69
+ const input = output.map(
70
+ (_, index) =>
71
+ options.range[0] +
72
+ (index * (options.range[1] - options.range[0])) / (output.length - 1),
73
+ )
74
+ const values =
75
+ reducedMotion() && key !== 'opacity' ? output.map(() => output.at(-1)!) : output
76
+ const mapped = bounded.to(input, values)
77
+ let release: () => void
78
+ try {
79
+ release = bind(target, { [key]: mapped })
80
+ } catch (error) {
81
+ mapped.dispose()
82
+ throw error
83
+ }
84
+ bindings.set(key, () => {
85
+ release()
86
+ mapped.dispose()
87
+ })
88
+ }
89
+ } catch (error) {
90
+ clearBindings()
91
+ throw error
60
92
  }
61
93
  }
62
94
  const refresh = () => {
@@ -71,16 +103,18 @@ export function nativeScrollMotion(
71
103
  }
72
104
  if (changed) apply()
73
105
  // Re-read the actual bounded offset without a Vue update or an additional clock.
74
- offset.ref(null)
75
- offset.ref(source)
106
+ offset.refresh()
76
107
  }
77
108
  const layout = (_event: EventData) => refresh()
78
109
  source.on('layoutChanged', layout)
79
110
  const offReduced = onReducedMotion(apply)
80
- refresh()
81
- return {
111
+ const control = {
82
112
  get execution() {
83
- return disposed || !active.size ? ('released' as const) : ('native' as const)
113
+ return disposed || !active.size
114
+ ? ('released' as const)
115
+ : offset.execution === 'native'
116
+ ? ('native' as const)
117
+ : ('scheduler' as const)
84
118
  },
85
119
  refresh,
86
120
  interrupt(properties: readonly string[]) {
@@ -90,6 +124,7 @@ export function nativeScrollMotion(
90
124
  bindings.get(key)?.()
91
125
  bindings.delete(key)
92
126
  }
127
+ if (!active.size) control.dispose()
93
128
  },
94
129
  dispose() {
95
130
  if (disposed) return
@@ -97,10 +132,16 @@ export function nativeScrollMotion(
97
132
  source.off('layoutChanged', layout)
98
133
  content?.off('layoutChanged', layout)
99
134
  offReduced()
100
- for (const release of bindings.values()) release()
101
- bindings.clear()
135
+ clearBindings()
102
136
  active.clear()
103
137
  offset.dispose()
104
138
  },
105
139
  }
140
+ try {
141
+ refresh()
142
+ } catch (error) {
143
+ control.dispose()
144
+ throw error
145
+ }
146
+ return control
106
147
  }
@@ -21,6 +21,12 @@ export function nativeSectionScroll(
21
21
  let link: ReturnType<typeof nativeScrollMotion> | undefined
22
22
  let previous = '',
23
23
  disposed = false
24
+ const active = new Map(Object.entries(frames))
25
+ if (active.has('scale')) {
26
+ if (!active.has('scaleX')) active.set('scaleX', active.get('scale')!)
27
+ if (!active.has('scaleY')) active.set('scaleY', active.get('scale')!)
28
+ active.delete('scale')
29
+ }
24
30
  const observed = new Set<View>()
25
31
  const refresh = () => {
26
32
  if (disposed) return
@@ -40,14 +46,14 @@ export function nativeSectionScroll(
40
46
  }
41
47
  const values = measured.settled
42
48
  ? Object.fromEntries(
43
- Object.entries(frames).map(([property, values]) => [
44
- property,
45
- [values.at(-1)!, values.at(-1)!],
46
- ]),
49
+ [...active].map(([property, values]) => [property, [values.at(-1)!, values.at(-1)!]]),
47
50
  )
48
- : frames
51
+ : Object.fromEntries(active)
49
52
  link?.dispose()
50
- link = nativeScrollMotion(adapter, target, values, { range: measured.range })
53
+ link = nativeScrollMotion(adapter, target, values, {
54
+ range: measured.range,
55
+ execution: options.execution,
56
+ })
51
57
  previous = key
52
58
  }
53
59
  for (let view: View | undefined = section; view; view = view.parent as View | undefined) {
@@ -74,7 +80,11 @@ export function nativeSectionScroll(
74
80
  },
75
81
  refresh,
76
82
  interrupt(properties: readonly string[]) {
83
+ for (const property of properties)
84
+ for (const key of property === 'scale' ? ['scaleX', 'scaleY'] : [property])
85
+ active.delete(key)
77
86
  link?.interrupt(properties)
87
+ if (!active.size) dispose()
78
88
  },
79
89
  dispose,
80
90
  }
@@ -0,0 +1,44 @@
1
+ import type { TapGestureEventData, View } from '@nativescript/core'
2
+
3
+ /** A child's native control owns its hit; blank space still belongs to the card. */
4
+ export function ownsCardTap(event?: Partial<TapGestureEventData>): boolean {
5
+ const card = (event?.object ?? event?.view) as View | undefined
6
+ if (!card || !event?.getX || !event.getY) return true
7
+ const x = event.getX(),
8
+ y = event.getY()
9
+ if (!Number.isFinite(x) || !Number.isFinite(y)) return true
10
+ const containsControl = (view: View): boolean => {
11
+ if (view.visibility !== undefined && view.visibility !== 'visible') return false
12
+ if (
13
+ /^(MavisButton|Button|TextField|TextView|SearchBar|Switch|Slider|DatePicker|TimePicker|ListPicker|SegmentedBar|WebView)$/.test(
14
+ view.typeName,
15
+ ) ||
16
+ ['button', 'link', 'checkbox', 'radio', 'switch', 'slider', 'combobox', 'tab'].includes(
17
+ view.accessibilityRole,
18
+ )
19
+ ) {
20
+ const origin = view.getLocationRelativeTo(card)
21
+ const size = view.getActualSize()
22
+ if (
23
+ origin &&
24
+ x >= origin.x &&
25
+ y >= origin.y &&
26
+ x <= origin.x + size.width &&
27
+ y <= origin.y + size.height
28
+ )
29
+ return true
30
+ }
31
+ let found = false
32
+ view.eachChildView?.((child) => {
33
+ found = containsControl(child)
34
+ return !found
35
+ })
36
+ return found
37
+ }
38
+ let found = false
39
+ card.eachChildView?.((child) => {
40
+ found = containsControl(child)
41
+ return !found
42
+ })
43
+ return !found
44
+ }
@@ -1,4 +1,5 @@
1
1
  import { nativeDestination, navigateNative } from '../navigation.js'
2
+ import { ownsCardTap } from '../card-input.js'
2
3
  import { resolveSpace, resolveRadius, shadowStyle } from '@getcortexlabs/mavis-core'
3
4
  import { ActionChildren } from '../accessibility.js'
4
5
  import { defineComponent, getCurrentInstance, h, mergeProps } from 'nativescript-vue'
@@ -13,7 +14,7 @@ import { MColumn } from './layout.js'
13
14
  import { usePressFeedback } from '../use-press.js'
14
15
  import { useMotionSurface } from '../use-motion-surface.js'
15
16
  import { keepShadow } from '../../native/moved-shadow.js'
16
- import type { EventData, View } from '@nativescript/core'
17
+ import type { EventData, TapGestureEventData, View } from '@nativescript/core'
17
18
 
18
19
  export const MCard = defineComponent({
19
20
  name: 'MCard',
@@ -90,8 +91,8 @@ export const MCard = defineComponent({
90
91
  accessibilityRole: href !== undefined ? 'link' : interactive ? 'button' : '',
91
92
  accessibilityState: interactive && disabled ? 'disabled' : '',
92
93
  onTap: interactive
93
- ? () => {
94
- if (enabled() && allowsActivation()) {
94
+ ? (event?: TapGestureEventData) => {
95
+ if (enabled() && allowsActivation() && ownsCardTap(event)) {
95
96
  emit('click')
96
97
  if (href !== undefined)
97
98
  void navigateNative(navigation()).catch((error) => emit('error', error))
@@ -1,138 +1,164 @@
1
- import { useComponentContent } from '@getcortexlabs/mavis-core/vue'
2
- import { useMotionSurface } from '../use-motion-surface.js'
3
1
  import type { VirtualListComponent } from '@getcortexlabs/mavis-core/vue'
4
2
  import {
5
- computed,
6
3
  defineComponent,
7
4
  h,
8
- ListView,
9
5
  mergeProps,
10
6
  nextTick,
7
+ onBeforeUnmount,
8
+ registerElement,
11
9
  shallowRef,
12
- ref,
10
+ useItemTemplates,
13
11
  watch,
14
12
  } from 'nativescript-vue'
15
- import { isAndroid, type EventData, type ListView as NativeList } from '@nativescript/core'
16
- import { virtualListProps } from '@getcortexlabs/mavis-core/vue'
13
+ import {
14
+ isAndroid,
15
+ ListView as NativeList,
16
+ type EventData,
17
+ type ItemEventData,
18
+ } from '@nativescript/core'
19
+ import { listChanges, type ListChanges } from '@rafaelaugusto/jolt'
20
+ import { useMavisTheme, virtualListProps } from '@getcortexlabs/mavis-core/vue'
17
21
  import {
18
22
  choiceKey,
23
+ componentMotion,
19
24
  virtualKeys,
20
25
  virtualWindow,
21
- type VirtualItemSlot,
22
26
  type VirtualListHandle,
23
27
  } from '@getcortexlabs/mavis-core'
24
28
  import { MText } from './MText.js'
25
29
 
26
- // A recycled cell never inherits the previous item's presentation. Only a data
27
- // revision on an already loaded logical item plays; ordinary scrolling stays still.
28
- const RealizedContent = defineComponent({
29
- props: { revision: Number, height: Number },
30
- setup(props, { slots }) {
31
- const feedback = useComponentContent(() => props.revision, false)
32
- const motion = useMotionSurface(() => feedback)
33
- return () => h('GridLayout', { ...motion, height: props.height }, slots.default?.())
34
- },
35
- })
30
+ // Core owns placement/recycling. Vue owns the contents, with no independent items watcher.
31
+ registerElement('MavisVirtualList', () => NativeList, { viewFlags: 8 })
36
32
 
37
33
  const VirtualList = defineComponent({
38
34
  name: 'MVirtualList',
39
35
  inheritAttrs: false,
40
36
  props: virtualListProps,
41
37
  setup(props, { attrs, slots, expose }) {
42
- const keys = computed(() => virtualKeys(props.items, props.itemKey))
38
+ const { theme } = useMavisTheme()
43
39
  const list = shallowRef<NativeList>()
44
- const revision = ref(0)
40
+ let rendered: readonly unknown[] = [...props.items]
41
+ let controller: ListChanges<unknown> | undefined
45
42
  let requested = props.initialIndex
43
+ const key = (item: unknown) => virtualKeys([item], props.itemKey)[0]!
44
+ const templates = useItemTemplates({
45
+ componentName: 'MVirtualList',
46
+ slots: {
47
+ default: ({ item, index }) => [
48
+ h('GridLayout', { height: props.rowHeight, bindingContext: item }, [
49
+ h(
50
+ 'GridLayout',
51
+ { key: choiceKey(key(item)), height: props.rowHeight },
52
+ slots.default?.({ item, index, itemKey: key(item) }),
53
+ ),
54
+ ]),
55
+ ],
56
+ },
57
+ })
58
+ function renderItem(data: EventData) {
59
+ const event = data as ItemEventData
60
+ const item = rendered[event.index]
61
+ if (item === undefined) return
62
+ event.view = templates.renderCell(
63
+ { item, index: event.index, even: event.index % 2 === 0, odd: event.index % 2 !== 0 },
64
+ event.view,
65
+ )
66
+ }
67
+ function clear() {
68
+ list.value?.off(NativeList.itemLoadingEvent, renderItem)
69
+ controller?.dispose()
70
+ controller = undefined
71
+ }
72
+ function attach() {
73
+ clear()
74
+ const view = list.value
75
+ if (!view?.isLoaded) return
76
+ controller = listChanges(view, {
77
+ key: (item) => choiceKey(key(item)),
78
+ rowHeight: props.rowHeight,
79
+ move: componentMotion(theme.value, 'layout'),
80
+ enter: true,
81
+ exit: 'fadeOut',
82
+ })
83
+ if (!props.animated) controller.pause()
84
+ // Jolt subscribed first: recycle notification clears the old key's motion
85
+ // before Vue patches the reused cell with another item.
86
+ view.on(NativeList.itemLoadingEvent, renderItem)
87
+ }
46
88
  function scrollToIndex(index: number) {
47
89
  if (!Number.isInteger(index) || index < 0 || index >= props.items.length)
48
90
  throw new RangeError('List index is out of range.')
49
91
  requested = index
92
+ controller?.stop()
50
93
  list.value?.scrollToIndex(index)
51
94
  }
52
95
  expose({ scrollToIndex } satisfies VirtualListHandle)
53
96
  watch(
54
- keys,
55
- (next, previous) => {
56
- revision.value++
57
- const view = list.value
58
- const first = view
59
- ? isAndroid
60
- ? view.android?.getFirstVisiblePosition()
61
- : view.ios?.indexPathsForVisibleRows?.firstObject?.row
62
- : requested
63
- const key = previous[Math.max(0, first ?? requested)]
64
- const index = key === undefined ? -1 : next.indexOf(key)
65
- requested = Math.max(0, Math.min(index < 0 ? requested : index, next.length - 1))
66
- void nextTick(() => {
67
- if (next.length && view?.isLoaded) view.scrollToIndex(requested)
68
- })
97
+ () => props.items.map((item) => ({ item, key: key(item) })),
98
+ () => {
99
+ virtualKeys(props.items, props.itemKey)
100
+ rendered = [...props.items]
101
+ if (controller && !controller.disposed) controller.update(rendered)
102
+ else if (list.value) list.value.items = [...rendered]
69
103
  },
70
104
  { flush: 'pre' },
71
105
  )
106
+ watch(
107
+ () => props.animated,
108
+ (enabled) => (enabled ? controller?.play() : controller?.pause()),
109
+ )
110
+ watch(
111
+ () => [props.rowHeight, props.height],
112
+ () => {
113
+ attach()
114
+ },
115
+ { flush: 'post' },
116
+ )
117
+ onBeforeUnmount(clear)
72
118
  return () => {
73
119
  virtualWindow(props.items.length, props.rowHeight, props.height, 0, props.overscan)
74
- void keys.value
120
+ virtualKeys(props.items, props.itemKey)
75
121
  if (!props.label.trim()) throw new TypeError('Virtual lists require a label.')
76
122
  if (!Number.isInteger(props.initialIndex) || props.initialIndex < 0)
77
123
  throw new RangeError('initialIndex must be a nonnegative integer.')
78
- if (!props.items.length)
79
- return h(
80
- 'GridLayout',
81
- mergeProps(attrs, {
82
- id: props.id,
83
- height: props.height,
84
- accessibilityLabel: props.label,
85
- }),
86
- slots.empty?.() ?? [h(MText, { text: props.emptyLabel, tone: 'muted' })],
87
- )
88
124
  const content = h(
89
- ListView,
125
+ 'MavisVirtualList',
90
126
  mergeProps(attrs, {
91
127
  id: props.id,
92
- items: props.items,
93
128
  rowHeight: props.rowHeight,
94
129
  height: props.height,
95
130
  separatorColor: 'transparent',
96
131
  accessibilityLabel: props.label,
132
+ itemTemplates: templates.itemTemplates,
133
+ itemTemplateSelector: () => 'default',
97
134
  onLoaded: (event: EventData) => {
98
- list.value = event.object as NativeList
99
- // Core iOS coerces a pre-mount rowHeight to auto. Reapply it once the
100
- // UITableView exists so its delegate and scroll geometry use fixed rows.
101
- if (!isAndroid) {
102
- list.value.rowHeight = 'auto'
103
- list.value.rowHeight = props.rowHeight
104
- }
135
+ const view = (list.value = event.object as NativeList)
136
+ if (!isAndroid) view.rowHeight = 'auto'
137
+ view.rowHeight = props.rowHeight
138
+ rendered = [...props.items]
139
+ view.on(NativeList.itemLoadingEvent, renderItem)
140
+ view.items = [...rendered]
141
+ attach()
105
142
  void nextTick(() => {
106
- if (list.value?.isLoaded)
107
- list.value.scrollToIndex(Math.min(requested, props.items.length - 1))
143
+ if (view.isLoaded && rendered.length)
144
+ view.scrollToIndex(Math.min(requested, rendered.length - 1))
108
145
  })
109
146
  },
110
147
  onUnloaded: () => {
148
+ clear()
111
149
  list.value = undefined
112
150
  },
113
151
  }),
114
- {
115
- default: ({ item, index }: VirtualItemSlot) =>
116
- h('GridLayout', { height: props.rowHeight }, [
117
- // NativeScript owns cell reuse. A keyed child remounts local state when its logical item changes.
118
- h(
119
- RealizedContent,
120
- {
121
- key: choiceKey(keys.value[index]!),
122
- height: props.rowHeight,
123
- revision: revision.value,
124
- },
125
- () => slots.default?.({ item, index, itemKey: keys.value[index]! }),
126
- ),
127
- ]),
128
- },
152
+ templates.cellVNodes(),
129
153
  )
130
- // A flex parent's intrinsic/exact passes alternate width measure modes.
131
- // Core iOS reloads UITableView when that spec changes, losing its scroll
132
- // offset during cell reuse. The bounded grid gives the list one exact width.
133
- return isAndroid
134
- ? content
135
- : h('GridLayout', { rows: '*', columns: '*', height: props.height }, [content])
154
+ // The stable exact-size parent avoids iOS width-mode reloads and keeps the
155
+ // native list alive when the data becomes empty.
156
+ return h('GridLayout', { rows: '*', columns: '*', height: props.height }, [
157
+ content,
158
+ ...(!props.items.length
159
+ ? (slots.empty?.() ?? [h(MText, { text: props.emptyLabel, tone: 'muted' })])
160
+ : []),
161
+ ])
136
162
  }
137
163
  },
138
164
  })