@getcortexlabs/mavis 0.1.0-alpha.6 → 0.1.0-alpha.8

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 (142) hide show
  1. package/README.md +5 -5
  2. package/dist/native/collection-motion.d.ts +5 -0
  3. package/dist/native/collection-motion.d.ts.map +1 -0
  4. package/dist/native/collection-motion.js +157 -0
  5. package/dist/native/collection-motion.js.map +1 -0
  6. package/dist/native/image-effects.d.ts +11 -0
  7. package/dist/native/image-effects.d.ts.map +1 -0
  8. package/dist/native/image-effects.js +61 -0
  9. package/dist/native/image-effects.js.map +1 -0
  10. package/dist/native/motion-owner.d.ts.map +1 -1
  11. package/dist/native/motion-owner.js +1 -0
  12. package/dist/native/motion-owner.js.map +1 -1
  13. package/dist/native/motion-region.d.ts.map +1 -1
  14. package/dist/native/motion-region.js +7 -2
  15. package/dist/native/motion-region.js.map +1 -1
  16. package/dist/native/motion-surface.d.ts +2 -2
  17. package/dist/native/motion-surface.d.ts.map +1 -1
  18. package/dist/native/motion-surface.js +55 -2
  19. package/dist/native/motion-surface.js.map +1 -1
  20. package/dist/native/platform-motion.d.ts +5 -0
  21. package/dist/native/platform-motion.d.ts.map +1 -0
  22. package/dist/native/platform-motion.js +90 -0
  23. package/dist/native/platform-motion.js.map +1 -0
  24. package/dist/native/press.d.ts +2 -0
  25. package/dist/native/press.d.ts.map +1 -1
  26. package/dist/native/press.js +6 -0
  27. package/dist/native/press.js.map +1 -1
  28. package/dist/native/surface-effects.d.ts +4 -0
  29. package/dist/native/surface-effects.d.ts.map +1 -0
  30. package/dist/native/surface-effects.js +31 -0
  31. package/dist/native/surface-effects.js.map +1 -0
  32. package/dist/native/visual-effects.d.ts +5 -0
  33. package/dist/native/visual-effects.d.ts.map +1 -0
  34. package/dist/native/visual-effects.js +126 -0
  35. package/dist/native/visual-effects.js.map +1 -0
  36. package/dist/vue/components/ChoiceControl.d.ts.map +1 -1
  37. package/dist/vue/components/ChoiceControl.js +20 -5
  38. package/dist/vue/components/ChoiceControl.js.map +1 -1
  39. package/dist/vue/components/DateCalendar.d.ts +3 -3
  40. package/dist/vue/components/LoadingDecoration.d.ts +116 -0
  41. package/dist/vue/components/LoadingDecoration.d.ts.map +1 -0
  42. package/dist/vue/components/LoadingDecoration.js +34 -0
  43. package/dist/vue/components/LoadingDecoration.js.map +1 -0
  44. package/dist/vue/components/MAlert.d.ts +1 -1
  45. package/dist/vue/components/MAvatar.d.ts +1 -1
  46. package/dist/vue/components/MBadge.d.ts +1 -1
  47. package/dist/vue/components/MButton.d.ts +36 -14
  48. package/dist/vue/components/MButton.d.ts.map +1 -1
  49. package/dist/vue/components/MButton.js +29 -2
  50. package/dist/vue/components/MButton.js.map +1 -1
  51. package/dist/vue/components/MCard.d.ts +6 -6
  52. package/dist/vue/components/MChip.d.ts +3 -3
  53. package/dist/vue/components/MCombobox.d.ts +2 -2
  54. package/dist/vue/components/MDatePicker.d.ts +16 -16
  55. package/dist/vue/components/MDialog.d.ts +4 -1
  56. package/dist/vue/components/MDialog.d.ts.map +1 -1
  57. package/dist/vue/components/MEmptyState.d.ts +2 -2
  58. package/dist/vue/components/MFilePicker.d.ts +2 -2
  59. package/dist/vue/components/MIcon.d.ts +19 -1
  60. package/dist/vue/components/MIcon.d.ts.map +1 -1
  61. package/dist/vue/components/MIcon.js +13 -2
  62. package/dist/vue/components/MIcon.js.map +1 -1
  63. package/dist/vue/components/MImage.d.ts +203 -0
  64. package/dist/vue/components/MImage.d.ts.map +1 -0
  65. package/dist/vue/components/MImage.js +157 -0
  66. package/dist/vue/components/MImage.js.map +1 -0
  67. package/dist/vue/components/MInput.d.ts +4 -4
  68. package/dist/vue/components/MInput.d.ts.map +1 -1
  69. package/dist/vue/components/MInput.js +9 -5
  70. package/dist/vue/components/MInput.js.map +1 -1
  71. package/dist/vue/components/MLink.d.ts +3 -3
  72. package/dist/vue/components/MListItem.d.ts +1 -1
  73. package/dist/vue/components/MProgress.d.ts +2 -2
  74. package/dist/vue/components/MReveal.d.ts +11 -11
  75. package/dist/vue/components/MScreen.d.ts +11 -1
  76. package/dist/vue/components/MScreen.d.ts.map +1 -1
  77. package/dist/vue/components/MScreen.js +26 -4
  78. package/dist/vue/components/MScreen.js.map +1 -1
  79. package/dist/vue/components/MSelect.d.ts +1 -1
  80. package/dist/vue/components/MSheet.d.ts +4 -4
  81. package/dist/vue/components/MSkeleton.d.ts +11 -0
  82. package/dist/vue/components/MSkeleton.d.ts.map +1 -1
  83. package/dist/vue/components/MSkeleton.js +5 -3
  84. package/dist/vue/components/MSkeleton.js.map +1 -1
  85. package/dist/vue/components/MStack.d.ts +11 -11
  86. package/dist/vue/components/MSwitch.d.ts.map +1 -1
  87. package/dist/vue/components/MSwitch.js +13 -3
  88. package/dist/vue/components/MSwitch.js.map +1 -1
  89. package/dist/vue/components/MText.d.ts +15 -4
  90. package/dist/vue/components/MText.d.ts.map +1 -1
  91. package/dist/vue/components/MText.js +3 -1
  92. package/dist/vue/components/MText.js.map +1 -1
  93. package/dist/vue/components/configurator.d.ts +541 -0
  94. package/dist/vue/components/configurator.d.ts.map +1 -0
  95. package/dist/vue/components/configurator.js +24 -0
  96. package/dist/vue/components/configurator.js.map +1 -0
  97. package/dist/vue/components/layout.d.ts +35 -24
  98. package/dist/vue/components/layout.d.ts.map +1 -1
  99. package/dist/vue/components/layout.js +3 -1
  100. package/dist/vue/components/layout.js.map +1 -1
  101. package/dist/vue/components/workflows.d.ts +1 -1
  102. package/dist/vue/index.d.ts +3 -1
  103. package/dist/vue/index.d.ts.map +1 -1
  104. package/dist/vue/index.js +6 -1
  105. package/dist/vue/index.js.map +1 -1
  106. package/dist/vue/use-choice-paint.d.ts +9 -0
  107. package/dist/vue/use-choice-paint.d.ts.map +1 -0
  108. package/dist/vue/use-choice-paint.js +32 -0
  109. package/dist/vue/use-choice-paint.js.map +1 -0
  110. package/dist/vue/use-motion-surface.d.ts +1 -1
  111. package/dist/vue/use-motion-surface.d.ts.map +1 -1
  112. package/dist/vue/use-motion-surface.js +31 -2
  113. package/dist/vue/use-motion-surface.js.map +1 -1
  114. package/package.json +3 -3
  115. package/src/native/collection-motion.ts +166 -0
  116. package/src/native/image-effects.ts +71 -0
  117. package/src/native/motion-owner.ts +1 -0
  118. package/src/native/motion-region.ts +7 -2
  119. package/src/native/motion-surface.ts +63 -3
  120. package/src/native/platform-motion.ts +103 -0
  121. package/src/native/press.ts +6 -0
  122. package/src/native/surface-effects.ts +33 -0
  123. package/src/native/visual-effects.ts +147 -0
  124. package/src/vue/components/ChoiceControl.ts +25 -5
  125. package/src/vue/components/LoadingDecoration.ts +38 -0
  126. package/src/vue/components/MButton.ts +33 -2
  127. package/src/vue/components/MIcon.ts +14 -2
  128. package/src/vue/components/MImage.ts +181 -0
  129. package/src/vue/components/MInput.ts +9 -5
  130. package/src/vue/components/MScreen.ts +31 -3
  131. package/src/vue/components/MSkeleton.ts +5 -3
  132. package/src/vue/components/MSwitch.ts +16 -3
  133. package/src/vue/components/MText.ts +7 -0
  134. package/src/vue/components/configurator.ts +27 -0
  135. package/src/vue/components/layout.ts +3 -0
  136. package/src/vue/index.ts +8 -0
  137. package/src/vue/use-choice-paint.ts +39 -0
  138. package/src/vue/use-motion-surface.ts +32 -1
  139. package/dist/vue/reveal-motion.d.ts +0 -13
  140. package/dist/vue/reveal-motion.d.ts.map +0 -1
  141. package/dist/vue/reveal-motion.js +0 -58
  142. package/dist/vue/reveal-motion.js.map +0 -1
@@ -12,12 +12,20 @@ import { nativeMotionOwner } from '../native/motion-owner.js'
12
12
  export function useMotionSurface(
13
13
  surface: () => MotionSurface | undefined,
14
14
  enabled: () => boolean = () => true,
15
+ plainText: () => boolean = () => false,
16
+ afterLayout = false,
15
17
  ) {
16
18
  let view: View | undefined
17
19
  let unbind: (() => void) | undefined
18
20
  let offPreference: (() => void) | undefined
19
21
  let continuous: ReturnType<typeof nativeContinuousSurface> | undefined
20
22
  const active = new Map<ReturnType<typeof animate>, MotionFrames>()
23
+ let layoutView: View | undefined
24
+ let layoutQueued = false
25
+ const clearLayout = () => {
26
+ layoutView?.off('layoutChanged', laidOut)
27
+ layoutView = undefined
28
+ }
21
29
  const release = () => {
22
30
  unbind?.()
23
31
  unbind = undefined
@@ -32,7 +40,21 @@ export function useMotionSurface(
32
40
  const target = view
33
41
  const reference = surface()
34
42
  if (!target || !reference) return
35
- continuous = nativeContinuousSurface(target, enabled)
43
+ if (
44
+ afterLayout &&
45
+ (!target.isLayoutValid ||
46
+ target.getActualSize().width <= 0 ||
47
+ target.getActualSize().height <= 0)
48
+ ) {
49
+ if (layoutView !== target) {
50
+ clearLayout()
51
+ layoutView = target
52
+ target.on('layoutChanged', laidOut)
53
+ }
54
+ return
55
+ }
56
+ clearLayout()
57
+ continuous = nativeContinuousSurface(target, enabled, plainText)
36
58
  unbind = bindMotionSurface(
37
59
  reference,
38
60
  nativeMotionOwner(
@@ -66,7 +88,16 @@ export function useMotionSurface(
66
88
  if (Object.keys(values).length) set(target, values)
67
89
  })
68
90
  }
91
+ const laidOut = () => {
92
+ if (layoutQueued) return
93
+ layoutQueued = true
94
+ void Promise.resolve().then(() => {
95
+ layoutQueued = false
96
+ if (view) bind()
97
+ })
98
+ }
69
99
  const unloaded = () => {
100
+ clearLayout()
70
101
  release()
71
102
  view = undefined
72
103
  }
@@ -1,13 +0,0 @@
1
- import type { View } from '@nativescript/core';
2
- type Element = {
3
- nativeView: View;
4
- };
5
- /** Each transition owns its completion; an interrupted leave cannot finish a new entry. */
6
- export declare function useRevealMotion(): {
7
- onEnter: (element: Element, done: () => void) => void;
8
- onLeave: (element: Element, done: () => void) => void;
9
- onEnterCancelled: ({ nativeView: view }: Element) => void;
10
- onLeaveCancelled: ({ nativeView: view }: Element) => void;
11
- };
12
- export {};
13
- //# sourceMappingURL=reveal-motion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reveal-motion.d.ts","sourceRoot":"","sources":["../../src/vue/reveal-motion.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAI9C,KAAK,OAAO,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,CAAA;AAEnC,2FAA2F;AAC3F,wBAAgB,eAAe;uBAcuB,OAAO,QAAQ,MAAM,IAAI;uBAAzB,OAAO,QAAQ,MAAM,IAAI;6CAPvC,OAAO;6CAAP,OAAO;EA+C9C"}
@@ -1,58 +0,0 @@
1
- import { onBeforeUnmount } from 'nativescript-vue';
2
- import { useMavisTheme } from '@getcortexlabs/mavis-core/vue';
3
- import { animate, set, onReducedMotion } from '@rafaelaugusto/jolt';
4
- import { motionRecipe } from '@getcortexlabs/mavis-core';
5
- /** Each transition owns its completion; an interrupted leave cannot finish a new entry. */
6
- export function useRevealMotion() {
7
- const { theme } = useMavisTheme();
8
- const entered = new WeakSet();
9
- const active = new Map();
10
- const cancel = ({ nativeView: view }) => {
11
- const operation = active.get(view);
12
- if (!operation)
13
- return;
14
- active.delete(view);
15
- operation.remove();
16
- operation.handle.stop();
17
- };
18
- const run = (phase) => (element, done) => {
19
- const recipe = motionRecipe(theme.value, phase === 'enter' ? 'enter' : 'exit');
20
- const view = element.nativeView;
21
- cancel(element);
22
- if (phase === 'enter' && !entered.has(view)) {
23
- entered.add(view);
24
- set(view, { opacity: 0, y: theme.value.motion.enterOffset });
25
- }
26
- const handle = animate(view, phase === 'enter' ? { opacity: 1, y: 0 } : { opacity: 0 }, recipe.transition);
27
- const unloaded = () => cancel(element);
28
- const operation = { handle, phase, remove: () => view.off('unloaded', unloaded) };
29
- active.set(view, operation);
30
- view.on('unloaded', unloaded);
31
- void handle.finished.then(() => {
32
- if (active.get(view) !== operation)
33
- return;
34
- active.delete(view);
35
- operation.remove();
36
- done();
37
- });
38
- };
39
- const offPreference = onReducedMotion((reduced) => {
40
- if (reduced)
41
- for (const [view, operation] of active) {
42
- if (operation.phase === 'enter')
43
- set(view, { y: 0 });
44
- }
45
- });
46
- onBeforeUnmount(() => {
47
- offPreference();
48
- for (const view of active.keys())
49
- cancel({ nativeView: view });
50
- });
51
- return {
52
- onEnter: run('enter'),
53
- onLeave: run('leave'),
54
- onEnterCancelled: cancel,
55
- onLeaveCancelled: cancel,
56
- };
57
- }
58
- //# sourceMappingURL=reveal-motion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reveal-motion.js","sourceRoot":"","sources":["../../src/vue/reveal-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD,2FAA2F;AAC3F,MAAM,UAAU,eAAe;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,CAAA;IACjC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAQ,CAAA;IACnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAGnB,CAAA;IACH,MAAM,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAW,EAAE,EAAE;QAC/C,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,CAAC,SAAS;YAAE,OAAM;QACtB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACnB,SAAS,CAAC,MAAM,EAAE,CAAA;QAClB,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC,CAAA;IACD,MAAM,GAAG,GAAG,CAAC,KAAwB,EAAE,EAAE,CAAC,CAAC,OAAgB,EAAE,IAAgB,EAAE,EAAE;QAC/E,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,C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