@getcortexlabs/mavis-web 0.1.0-alpha.5 → 0.1.0-alpha.6

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 (121) hide show
  1. package/README.md +4 -4
  2. package/dist/components/MAccordion.d.ts +1 -1
  3. package/dist/components/MAlert.d.ts +1 -1
  4. package/dist/components/MAvatar.d.ts +1 -1
  5. package/dist/components/MButton.d.ts +55 -9
  6. package/dist/components/MButton.d.ts.map +1 -1
  7. package/dist/components/MButton.js +13 -8
  8. package/dist/components/MButton.js.map +1 -1
  9. package/dist/components/MCard.d.ts +49 -3
  10. package/dist/components/MCard.d.ts.map +1 -1
  11. package/dist/components/MCard.js +36 -30
  12. package/dist/components/MCard.js.map +1 -1
  13. package/dist/components/MCheckbox.d.ts +1 -1
  14. package/dist/components/MCheckbox.js +3 -3
  15. package/dist/components/MCheckbox.js.map +1 -1
  16. package/dist/components/MChip.d.ts +2 -2
  17. package/dist/components/MCombobox.d.ts +2 -2
  18. package/dist/components/MCombobox.js +3 -3
  19. package/dist/components/MCombobox.js.map +1 -1
  20. package/dist/components/MDatePicker.d.ts +56 -8
  21. package/dist/components/MDatePicker.d.ts.map +1 -1
  22. package/dist/components/MDatePicker.js +9 -0
  23. package/dist/components/MDatePicker.js.map +1 -1
  24. package/dist/components/MDialog.d.ts +1 -1
  25. package/dist/components/MEmptyState.d.ts +1 -1
  26. package/dist/components/MInput.d.ts +7 -7
  27. package/dist/components/MInput.js +3 -3
  28. package/dist/components/MInput.js.map +1 -1
  29. package/dist/components/MLink.d.ts +120 -0
  30. package/dist/components/MLink.d.ts.map +1 -0
  31. package/dist/components/MLink.js +75 -0
  32. package/dist/components/MLink.js.map +1 -0
  33. package/dist/components/MListItem.d.ts +3 -1
  34. package/dist/components/MListItem.d.ts.map +1 -1
  35. package/dist/components/MProgress.d.ts +1 -1
  36. package/dist/components/MRadioGroup.d.ts +1 -1
  37. package/dist/components/MReveal.d.ts +2 -2
  38. package/dist/components/MReveal.d.ts.map +1 -1
  39. package/dist/components/MReveal.js +39 -50
  40. package/dist/components/MReveal.js.map +1 -1
  41. package/dist/components/MSegmentedControl.d.ts +1 -1
  42. package/dist/components/MSelect.d.ts +1 -1
  43. package/dist/components/MSheet.d.ts +1 -1
  44. package/dist/components/MSlider.d.ts +1 -1
  45. package/dist/components/MStack.d.ts +198 -0
  46. package/dist/components/MStack.d.ts.map +1 -0
  47. package/dist/components/MStack.js +62 -0
  48. package/dist/components/MStack.js.map +1 -0
  49. package/dist/components/MSwitch.d.ts +1 -1
  50. package/dist/components/MSwitch.js +3 -3
  51. package/dist/components/MSwitch.js.map +1 -1
  52. package/dist/components/MTabs.d.ts +1 -1
  53. package/dist/components/MText.d.ts +3 -3
  54. package/dist/components/MText.js +6 -6
  55. package/dist/components/MText.js.map +1 -1
  56. package/dist/components/layout.d.ts +179 -2
  57. package/dist/components/layout.d.ts.map +1 -1
  58. package/dist/components/layout.js +10 -10
  59. package/dist/components/layout.js.map +1 -1
  60. package/dist/connected-motion.d.ts +6 -0
  61. package/dist/connected-motion.d.ts.map +1 -0
  62. package/dist/connected-motion.js +18 -0
  63. package/dist/connected-motion.js.map +1 -0
  64. package/dist/experimental.d.ts +9 -0
  65. package/dist/experimental.d.ts.map +1 -0
  66. package/dist/experimental.js +27 -0
  67. package/dist/experimental.js.map +1 -0
  68. package/dist/index.d.ts +4 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +6 -1
  71. package/dist/index.js.map +1 -1
  72. package/dist/motion-region.d.ts +3 -0
  73. package/dist/motion-region.d.ts.map +1 -1
  74. package/dist/motion-region.js +69 -39
  75. package/dist/motion-region.js.map +1 -1
  76. package/dist/motion-surface.d.ts.map +1 -1
  77. package/dist/motion-surface.js +4 -0
  78. package/dist/motion-surface.js.map +1 -1
  79. package/dist/motion.d.ts +2 -2
  80. package/dist/motion.d.ts.map +1 -1
  81. package/dist/motion.js +8 -27
  82. package/dist/motion.js.map +1 -1
  83. package/dist/navigation.d.ts +12 -0
  84. package/dist/navigation.d.ts.map +1 -0
  85. package/dist/navigation.js +38 -0
  86. package/dist/navigation.js.map +1 -0
  87. package/dist/reveal-motion.d.ts +5 -0
  88. package/dist/reveal-motion.d.ts.map +1 -0
  89. package/dist/reveal-motion.js +53 -0
  90. package/dist/reveal-motion.js.map +1 -0
  91. package/dist/scroll-motion.d.ts.map +1 -1
  92. package/dist/scroll-motion.js +16 -14
  93. package/dist/scroll-motion.js.map +1 -1
  94. package/dist/tokens.d.ts +7 -0
  95. package/dist/tokens.d.ts.map +1 -0
  96. package/dist/tokens.js +29 -0
  97. package/dist/tokens.js.map +1 -0
  98. package/package.json +7 -3
  99. package/src/components/MButton.ts +17 -7
  100. package/src/components/MCard.ts +45 -27
  101. package/src/components/MCheckbox.ts +3 -3
  102. package/src/components/MCombobox.ts +3 -3
  103. package/src/components/MDatePicker.ts +8 -0
  104. package/src/components/MInput.ts +3 -3
  105. package/src/components/MLink.ts +85 -0
  106. package/src/components/MReveal.ts +57 -64
  107. package/src/components/MStack.ts +90 -0
  108. package/src/components/MSwitch.ts +3 -3
  109. package/src/components/MText.ts +6 -6
  110. package/src/components/layout.ts +10 -10
  111. package/src/connected-motion.ts +23 -0
  112. package/src/experimental.ts +29 -0
  113. package/src/index.ts +7 -0
  114. package/src/motion-region.ts +94 -41
  115. package/src/motion-surface.ts +12 -1
  116. package/src/motion.ts +10 -40
  117. package/src/navigation.ts +44 -0
  118. package/src/reveal-motion.ts +59 -0
  119. package/src/scroll-motion.ts +16 -15
  120. package/src/style.css +6 -0
  121. package/src/tokens.ts +29 -0
@@ -0,0 +1,12 @@
1
+ import type { NavigationOptions } from '@getcortexlabs/mavis-core';
2
+ /** One real anchor; the application can supply a RouterLink custom-slot navigate callback. */
3
+ export declare function navigationAttrs(options: NavigationOptions, disabled: boolean, activate: () => void, fail: (error: unknown) => void): {
4
+ href: string | undefined;
5
+ role: string;
6
+ target: import("@getcortexlabs/mavis-core").LinkTarget | undefined;
7
+ rel: string | undefined;
8
+ tabindex: number | undefined;
9
+ 'aria-disabled': true | undefined;
10
+ onClick(event: MouseEvent): void;
11
+ };
12
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,8FAA8F;AAC9F,wBAAgB,eAAe,CAC7B,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,IAAI,EACpB,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;;;;;;;mBAUb,UAAU;EAyB5B"}
@@ -0,0 +1,38 @@
1
+ import { linkDestination, linkRel } from '@getcortexlabs/mavis-core';
2
+ /** One real anchor; the application can supply a RouterLink custom-slot navigate callback. */
3
+ export function navigationAttrs(options, disabled, activate, fail) {
4
+ const href = linkDestination(options.href);
5
+ return {
6
+ href: disabled ? undefined : href,
7
+ role: 'link',
8
+ target: options.target,
9
+ rel: linkRel(options.target ?? '_self', options.rel),
10
+ tabindex: disabled ? -1 : undefined,
11
+ 'aria-disabled': disabled || undefined,
12
+ onClick(event) {
13
+ if (disabled) {
14
+ event.preventDefault();
15
+ return;
16
+ }
17
+ if (event.defaultPrevented)
18
+ return;
19
+ activate();
20
+ if (!options.navigate ||
21
+ (options.target && options.target !== '_self') ||
22
+ event.button !== 0 ||
23
+ event.metaKey ||
24
+ event.ctrlKey ||
25
+ event.shiftKey ||
26
+ event.altKey)
27
+ return;
28
+ event.preventDefault();
29
+ try {
30
+ Promise.resolve(options.navigate(href)).catch(fail);
31
+ }
32
+ catch (error) {
33
+ fail(error);
34
+ }
35
+ },
36
+ };
37
+ }
38
+ //# sourceMappingURL=navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../src/navigation.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AAK,EAAE,CAAC;gBACf,IAAI,CAAC,KAAK,CAAC,CAAA;YACb,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type MavisTheme } from '@getcortexlabs/mavis-core';
2
+ import type { RevealHost } from '@getcortexlabs/mavis-core/vue';
3
+ import type { WebMotionContext } from './motion-context.js';
4
+ export declare function revealHost(element: HTMLElement, context: WebMotionContext, theme: () => MavisTheme, hidden: () => boolean): RevealHost;
5
+ //# sourceMappingURL=reveal-motion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-motion.d.ts","sourceRoot":"","sources":["../src/reveal-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,wBAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,MAAM,UAAU,EACvB,MAAM,EAAE,MAAM,OAAO,GACpB,UAAU,CAiDZ"}
@@ -0,0 +1,53 @@
1
+ import { motionRecipe } from '@getcortexlabs/mavis-core';
2
+ export function revealHost(element, context, theme, hidden) {
3
+ let trigger;
4
+ // Initial SSR/KeepAlive presentation needs no animation or geometry acquisition.
5
+ let lease;
6
+ const originalHeight = element.style.height;
7
+ return {
8
+ animate(open, fromClosed) {
9
+ if (!element.isConnected)
10
+ return { finished: Promise.resolve(true), stop() { } };
11
+ lease ??= context.acquire(element.ownerDocument);
12
+ const runtime = lease.runtime;
13
+ if (fromClosed) {
14
+ element.style.height = '0px';
15
+ runtime.set(element, { opacity: 0 });
16
+ }
17
+ const recipe = motionRecipe(theme(), open ? 'enter' : 'exit');
18
+ const size = runtime.animateSize(element, { height: open ? 'auto' : 0 }, recipe.transition);
19
+ const opacity = runtime.animate(element, { opacity: open ? 1 : 0 }, recipe.transition);
20
+ return {
21
+ finished: size.finished,
22
+ stop() {
23
+ size.stop({ restore: true });
24
+ opacity.stop();
25
+ },
26
+ };
27
+ },
28
+ interactive(enabled) {
29
+ element.toggleAttribute('inert', !enabled || Boolean(hidden()));
30
+ if (!enabled || hidden())
31
+ element.setAttribute('aria-hidden', 'true');
32
+ else
33
+ element.removeAttribute('aria-hidden');
34
+ },
35
+ captureFocus() {
36
+ const active = element.ownerDocument.activeElement;
37
+ if (active instanceof element.ownerDocument.defaultView.HTMLElement &&
38
+ !element.contains(active))
39
+ trigger = active;
40
+ },
41
+ restoreFocus() {
42
+ if (element.contains(element.ownerDocument.activeElement) && trigger?.isConnected)
43
+ trigger.focus({ preventScroll: true });
44
+ },
45
+ release() {
46
+ lease?.runtime.release(element);
47
+ lease?.release();
48
+ lease = undefined;
49
+ element.style.height = originalHeight;
50
+ },
51
+ };
52
+ }
53
+ //# sourceMappingURL=reveal-motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-motion.js","sourceRoot":"","sources":["../src/reveal-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,2BAA2B,CAAA;AAIzE,MAAM,UAAU,UAAU,CACxB,OAAoB,EACpB,OAAyB,EACzB,KAAuB,EACvB,MAAqB;IAErB,IAAI,OAAgC,CAAA;IACpC,iFAAiF;IACjF,IAAI,KAAqD,CAAA;IACzD,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAA;IAC3C,OAAO;QACL,OAAO,CAAC,IAAI,EAAE,UAAU;YACtB,IAAI,CAAC,OAAO,CAAC,WAAW;gBAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,KAAI,CAAC,EAAE,CAAA;YAC/E,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;YAChD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G,OAAO,CAAC,aAAa,CAAC,aAAa,CAAA;YAClD,IACE,MAAM,YAAY,OAAO,CAAC,aAAa,CAAC,WAAY,CAAC,WAAW;gBAChE,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAEzB,OAAO,GAAG,MAAM,CAAA;QACpB,CAAC;QACD,YAAY;YACV,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,OAAO,EAAE,WAAW;gBAC/E,OAAO,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;QAC1C,CAAC;QACD,OAAO;YACL,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YAC/B,KAAK,EAAE,OAAO,EAAE,CAAA;YAChB,KAAK,GAAG,SAAS,CAAA;YACjB,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,cAAc,CAAA;QACvC,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-motion.d.ts","sourceRoot":"","sources":["../src/scroll-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAClF,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,wCAAwC,CAAA;AAG/C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,eAI5D;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,EACrC,MAAM,EAAE,MAAM,kBAAkB,GAAG,SAAS,EAC5C,OAAO,EAAE,MAAM,OAAO,QAyDvB"}
1
+ {"version":3,"file":"scroll-motion.d.ts","sourceRoot":"","sources":["../src/scroll-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAG/C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,wCAAwC,CAAA;AAG/C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,eAI5D;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,EACrC,MAAM,EAAE,MAAM,kBAAkB,GAAG,SAAS,EAC5C,OAAO,EAAE,MAAM,OAAO,QAwDvB"}
@@ -1,4 +1,6 @@
1
- import { onActivated, onBeforeUnmount, onDeactivated, watch } from 'vue';
1
+ import { computed, watch } from 'vue';
2
+ import { useConnectedMotion } from './connected-motion.js';
3
+ import { useMotionContext } from './motion-context.js';
2
4
  import { bindMotionScrollSource, } from '@getcortexlabs/mavis-core/experimental';
3
5
  const sources = new WeakMap();
4
6
  export function webScrollElement(adapter) {
@@ -8,16 +10,15 @@ export function webScrollElement(adapter) {
8
10
  return source;
9
11
  }
10
12
  export function useScrollMotion(element, source, enabled) {
11
- let active = true;
12
13
  let release;
13
14
  const clear = () => {
14
15
  release?.();
15
16
  release = undefined;
16
17
  };
17
- const attach = () => {
18
+ const attach = (target) => {
18
19
  clear();
19
- const reference = source(), target = element.value;
20
- if (!active || !enabled() || !reference || !target)
20
+ const reference = source();
21
+ if (!enabled() || !reference)
21
22
  return;
22
23
  const adapter = { kind: 'web' };
23
24
  sources.set(adapter, target);
@@ -55,15 +56,16 @@ export function useScrollMotion(element, source, enabled) {
55
56
  sources.delete(adapter);
56
57
  };
57
58
  };
58
- watch([element, source, enabled], attach, { flush: 'post' });
59
- onActivated(() => {
60
- active = true;
61
- attach();
62
- });
63
- onDeactivated(() => {
64
- active = false;
65
- clear();
59
+ const target = computed(() => (enabled() && source() ? element.value : undefined));
60
+ useConnectedMotion(target, useMotionContext(), (_, connected) => {
61
+ const stop = watch([source, enabled], () => attach(connected), {
62
+ immediate: true,
63
+ flush: 'post',
64
+ });
65
+ return () => {
66
+ stop();
67
+ clear();
68
+ };
66
69
  });
67
- onBeforeUnmount(clear);
68
70
  }
69
71
  //# sourceMappingURL=scroll-motion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-motion.js","sourceRoot":"","sources":["../src/scroll-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,EAAY,MAAM,KAAK,CAAA;AAClF,OAAO,EACL,sBAAsB,GAGvB,MAAM,wCAAwC,CAAA;AAE/C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAoC,CAAA;AAC/D,MAAM,UAAU,gBAAgB,CAAC,OAA4B;IAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IACnC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,SAAS,CAAC,2CAA2C,CAAC,CAAA;IAC7E,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAAqC,EACrC,MAA4C,EAC5C,OAAsB;IAEtB,IAAI,MAAM,GAAG,IAAI,CAAA;IACjB,IAAI,OAAiC,CAAA;IACrC,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,OAAO,EAAE,EAAE,CAAA;QACX,OAAO,GAAG,SAAS,CAAA;IACrB,CAAC,CAAA;IACD,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,KAAK,EAAE,CAAA;QACP,MAAM,SAAS,GAAG,MAAM,EAAE,EACxB,MAAM,GAAG,OAAO,CAAC,KAAK,CAAA;QACxB,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM;YAAE,OAAM;QAC1D,MAAM,OAAO,GAAwB,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACpD,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC5B,MAAM,MAAM,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QACzD,IAAI,QAAQ,GAAG,KAAK,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I,EAAE,CAAC,CAAA;QAClF,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;QACpE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACxC,OAAO,GAAG,GAAG,EAAE;YACb,QAAQ,GAAG,IAAI,CAAA;YACf,MAAM,CAAC,UAAU,EAAE,CAAA;YACnB,SAAS,CAAC,UAAU,EAAE,CAAA;YACtB,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,mBAAmB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;YACvE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAC3C,MAAM,EAAE,CAAA;YACR,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACzB,CAAC,CAAA;IACH,CAAC,CAAA;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IAClF,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE;QAC9D,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;YAC7D,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,MAAM;SACd,CAAC,CAAA;QACF,OAAO,GAAG,EAAE;YACV,IAAI,EAAE,CAAA;YACN,KAAK,EAAE,CAAA;QACT,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type CSSProperties } from 'vue';
2
+ import { type MavisTheme } from '@getcortexlabs/mavis-core';
3
+ /** CSS values for one theme scope. No document mutation or application singleton. */
4
+ export declare function themeVariables(theme: MavisTheme): CSSProperties;
5
+ /** Bind to a host's :style inside the desired MThemeProvider scope. Also works during SSR. */
6
+ export declare function useMavisTokens(): import("vue").ComputedRef<CSSProperties>;
7
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,KAAK,CAAA;AAElD,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEpF,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAiB/D;AAED,8FAA8F;AAC9F,wBAAgB,cAAc,6CAG7B"}
package/dist/tokens.js ADDED
@@ -0,0 +1,29 @@
1
+ import { computed } from 'vue';
2
+ import { useMavisTheme } from '@getcortexlabs/mavis-core/vue';
3
+ import { fontFamily, shadowStyle } from '@getcortexlabs/mavis-core';
4
+ /** CSS values for one theme scope. No document mutation or application singleton. */
5
+ export function themeVariables(theme) {
6
+ const variables = {};
7
+ for (const [name, value] of Object.entries(theme.colors))
8
+ variables[`--m-color-${name}`] = value;
9
+ for (const [name, value] of Object.entries(theme.space))
10
+ variables[`--m-space-${name}`] = `${value}px`;
11
+ for (const [name, value] of Object.entries(theme.radius))
12
+ variables[`--m-radius-${name}`] = `${value}px`;
13
+ for (const [name, value] of Object.entries(theme.elevation))
14
+ variables[`--m-elevation-${name}`] = shadowStyle(value);
15
+ for (const [name, type] of Object.entries(theme.typography)) {
16
+ variables[`--m-type-${name}-font-family`] = fontFamily(type.fontFamily, 'web');
17
+ variables[`--m-type-${name}-font-size`] = `${type.fontSize}px`;
18
+ variables[`--m-type-${name}-font-weight`] = type.fontWeight;
19
+ variables[`--m-type-${name}-line-height`] = type.lineHeight;
20
+ variables[`--m-type-${name}-letter-spacing`] = `${type.letterSpacing}em`;
21
+ }
22
+ return variables;
23
+ }
24
+ /** Bind to a host's :style inside the desired MThemeProvider scope. Also works during SSR. */
25
+ export function useMavisTokens() {
26
+ const { theme } = useMavisTheme();
27
+ return computed(() => themeVariables(theme.value));
28
+ }
29
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,KAAK,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAmB,MAAM,2BAA2B,CAAA;AAEpF,qFAAqF;AACrF,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,MAAM,SAAS,GAAoC,EAAE,CAAA;IACrD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QAAE,SAAS,CAAC,aAAa,IAAI,EAAE,CAAC,GAAG,KAAK,CAAA;IAChG,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;QACrD,SAAS,CAAC,aAAa,IAAI,EAAE,CAAC,GAAG,GAAG,KAAK,IAAI,CAAA;IAC/C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QACtD,SAAS,CAAC,cAAc,IAAI,EAAE,CAAC,GAAG,GAAG,KAAK,IAAI,CAAA;IAChD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QACzD,SAAS,CAAC,iBAAiB,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;IACzD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5D,SAAS,CAAC,YAAY,IAAI,cAAc,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;QAC9E,SAAS,CAAC,YAAY,IAAI,YAAY,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAA;QAC9D,SAAS,CAAC,YAAY,IAAI,cAAc,CAAC,GAAG,IAAI,CAAC,UAAU,CAAA;QAC3D,SAAS,CAAC,YAAY,IAAI,cAAc,CAAC,GAAG,IAAI,CAAC,UAAU,CAAA;QAC3D,SAAS,CAAC,YAAY,IAAI,iBAAiB,CAAC,GAAG,GAAG,IAAI,CAAC,aAAa,IAAI,CAAA;IAC1E,CAAC;IACD,OAAO,SAA0B,CAAA;AACnC,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,cAAc;IAC5B,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,CAAA;IACjC,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AACpD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getcortexlabs/mavis-web",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.6",
4
4
  "description": "Mavis components for Vue Web.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -14,6 +14,10 @@
14
14
  "./style.css": {
15
15
  "types": "./src/style.d.ts",
16
16
  "default": "./src/style.css"
17
+ },
18
+ "./experimental": {
19
+ "types": "./dist/experimental.d.ts",
20
+ "default": "./dist/experimental.js"
17
21
  }
18
22
  },
19
23
  "files": [
@@ -26,11 +30,11 @@
26
30
  "build": "tsc -p tsconfig.build.json"
27
31
  },
28
32
  "dependencies": {
29
- "@getcortexlabs/mavis-core": "0.1.0-alpha.5"
33
+ "@getcortexlabs/mavis-core": "0.1.0-alpha.6"
30
34
  },
31
35
  "peerDependencies": {
32
36
  "vue": "^3.5.42",
33
- "@rafaelaugusto/jolt": "^0.1.0-rc.7"
37
+ "@rafaelaugusto/jolt": "^0.1.0-rc.8"
34
38
  },
35
39
  "license": "MIT",
36
40
  "author": "Rafael Augusto",
@@ -7,7 +7,7 @@ import {
7
7
  useMavisTheme,
8
8
  actionEmits,
9
9
  textContent,
10
- useDefaultShrink,
10
+ useLayoutShrink,
11
11
  viewAttrs,
12
12
  } from '@getcortexlabs/mavis-core/vue'
13
13
  import {
@@ -22,6 +22,7 @@ import {
22
22
  } from '@getcortexlabs/mavis-core'
23
23
  import { webAttrs } from '../style.js'
24
24
  import { usePressFeedback } from '../motion.js'
25
+ import { navigationAttrs } from '../navigation.js'
25
26
 
26
27
  export const MButton = defineComponent({
27
28
  name: 'MButton',
@@ -41,7 +42,7 @@ export const MButton = defineComponent({
41
42
  theme,
42
43
  () => props.motionSurface,
43
44
  )
44
- const shrink = useDefaultShrink()
45
+ const shrink = useLayoutShrink()
45
46
  return () => {
46
47
  const { colors, control } = theme.value
47
48
  const tokens = theme.value.components.button
@@ -81,7 +82,7 @@ export const MButton = defineComponent({
81
82
  )
82
83
  : null
83
84
  return h(
84
- 'button',
85
+ props.href === undefined ? 'button' : 'a',
85
86
  mergeProps(
86
87
  lifecycle,
87
88
  {
@@ -109,20 +110,21 @@ export const MButton = defineComponent({
109
110
  boxShadow: `var(--m-button-shadow, ${shadowStyle(theme.value.elevation[tokens.elevation])})`,
110
111
  border: 0,
111
112
  margin: 0,
113
+ textDecoration: 'none',
112
114
  filter: props.disabled ? 'opacity(0.45)' : undefined,
113
115
  flexGrow: nonNegative(props.grow, 'grow'),
114
- flexShrink: nonNegative(props.shrink ?? shrink, 'shrink'),
116
+ flexShrink: nonNegative(props.shrink ?? shrink.value, 'shrink'),
115
117
  minWidth: '44px',
116
118
  '--m-focus': colors.primary,
117
119
  },
118
120
  },
119
121
  webAttrs({ ...attrs, ...viewAttrs(props) }),
120
122
  {
121
- type: props.type,
123
+ type: props.href === undefined ? props.type : undefined,
122
124
  name: props.name,
123
125
  value: props.value,
124
126
  form: props.form,
125
- disabled: props.disabled,
127
+ disabled: props.href === undefined ? props.disabled : undefined,
126
128
  'aria-disabled': props.disabled || props.loading || undefined,
127
129
  'aria-busy': props.loading || undefined,
128
130
  onClick: (event: MouseEvent) => {
@@ -130,9 +132,17 @@ export const MButton = defineComponent({
130
132
  event.preventDefault()
131
133
  return
132
134
  }
133
- emit('click')
135
+ if (props.href === undefined && !event.defaultPrevented) emit('click')
134
136
  },
135
137
  },
138
+ props.href === undefined
139
+ ? {}
140
+ : navigationAttrs(
141
+ props,
142
+ props.disabled || props.loading,
143
+ () => emit('click'),
144
+ (error) => emit('error', error),
145
+ ),
136
146
  ),
137
147
  hasIcon
138
148
  ? [
@@ -6,33 +6,46 @@ import {
6
6
  useMavisTheme,
7
7
  actionEmits,
8
8
  } from '@getcortexlabs/mavis-core/vue'
9
- import { MColumn } from './layout.js'
9
+ import { MColumn, createLayout } from './layout.js'
10
+ import { navigationAttrs } from '../navigation.js'
10
11
  import { usePressFeedback } from '../motion.js'
11
12
 
13
+ const LinkColumn = createLayout('MCardLink', 'column', 'a')
14
+
12
15
  export const MCard = defineComponent({
13
16
  name: 'MCard',
14
17
  inheritAttrs: false,
15
18
  props: cardProps,
16
19
  emits: actionEmits,
17
20
  setup(props, { attrs, slots, emit }) {
18
- useButtonAction(() => props.interactive)
21
+ useButtonAction(() => props.interactive || props.href !== undefined)
19
22
  const { theme } = useMavisTheme()
20
23
  const lifecycle = usePressFeedback(
21
- () => props.interactive && !props.disabled,
24
+ () => (props.interactive || props.href !== undefined) && !props.disabled,
22
25
  theme,
23
26
  () => props.motionSurface,
24
27
  () => !props.disabled,
25
28
  )
26
29
  const activate = () => {
27
- if (props.interactive && !props.disabled) emit('click')
30
+ if ((props.interactive || props.href !== undefined) && !props.disabled) emit('click')
28
31
  }
29
32
  return () => {
30
- const { interactive, disabled, elevation, motionSurface, ...layout } = props
33
+ const {
34
+ interactive,
35
+ disabled,
36
+ elevation,
37
+ motionSurface,
38
+ href,
39
+ navigate,
40
+ target,
41
+ rel,
42
+ ...layout
43
+ } = props
31
44
  const tokens = theme.value.components.card
32
45
  layout.padding ??= tokens.padding
33
46
  layout.radius ??= tokens.radius
34
47
  return h(
35
- MColumn,
48
+ href === undefined ? MColumn : LinkColumn,
36
49
  mergeProps(
37
50
  lifecycle,
38
51
  layout,
@@ -60,32 +73,37 @@ export const MCard = defineComponent({
60
73
  ? `${resolveRadius(theme.value, props.radius)}px`
61
74
  : `var(--m-card-radius, ${resolveRadius(theme.value, tokens.radius)}px)`,
62
75
  boxShadow: `var(--m-card-shadow, ${shadowStyle(theme.value.elevation[elevation ?? tokens.elevation])})`,
63
- backgroundColor: props.backgroundColor ?? theme.value.colors.surface,
64
- border: `1px solid ${theme.value.colors.border}`,
76
+ backgroundColor:
77
+ props.backgroundColor ?? `var(--m-card-background, ${theme.value.colors.surface})`,
78
+ border: `var(--m-card-border, 1px solid ${theme.value.colors.border})`,
65
79
  filter: interactive && disabled ? 'opacity(0.45)' : undefined,
66
80
  '--m-focus': theme.value.colors.primary,
81
+ textDecoration: 'none',
82
+ color: 'inherit',
67
83
  },
68
84
  },
69
85
  attrs,
70
- interactive
71
- ? {
72
- role: 'button',
73
- tabindex: disabled ? -1 : 0,
74
- 'aria-disabled': disabled || undefined,
75
- onClick: activate,
76
- onKeydown: (event: KeyboardEvent) => {
77
- if (event.target !== event.currentTarget) return
78
- if (event.key === 'Enter' || event.key === ' ') event.preventDefault()
79
- if (event.key === 'Enter' && !event.repeat) activate()
80
- },
81
- onKeyup: (event: KeyboardEvent) => {
82
- if (event.target === event.currentTarget && event.key === ' ') {
83
- event.preventDefault()
84
- activate()
85
- }
86
- },
87
- }
88
- : {},
86
+ href !== undefined
87
+ ? navigationAttrs(props, disabled, activate, (error) => emit('error', error))
88
+ : interactive
89
+ ? {
90
+ role: 'button',
91
+ tabindex: disabled ? -1 : 0,
92
+ 'aria-disabled': disabled || undefined,
93
+ onClick: activate,
94
+ onKeydown: (event: KeyboardEvent) => {
95
+ if (event.target !== event.currentTarget) return
96
+ if (event.key === 'Enter' || event.key === ' ') event.preventDefault()
97
+ if (event.key === 'Enter' && !event.repeat) activate()
98
+ },
99
+ onKeyup: (event: KeyboardEvent) => {
100
+ if (event.target === event.currentTarget && event.key === ' ') {
101
+ event.preventDefault()
102
+ activate()
103
+ }
104
+ },
105
+ }
106
+ : {},
89
107
  ),
90
108
  slots,
91
109
  )
@@ -5,7 +5,7 @@ import {
5
5
  checkboxProps,
6
6
  checkboxEmits,
7
7
  useMavisTheme,
8
- useDefaultShrink,
8
+ useLayoutShrink,
9
9
  } from '@getcortexlabs/mavis-core/vue'
10
10
  import { nonNegative, resolveDimension } from '@getcortexlabs/mavis-core'
11
11
  import { length, webAttrs } from '../style.js'
@@ -19,7 +19,7 @@ export const MCheckbox = defineComponent({
19
19
  setup(props, { attrs, emit }) {
20
20
  useButtonAction()
21
21
  const { theme } = useMavisTheme()
22
- const shrink = useDefaultShrink()
22
+ const shrink = useLayoutShrink()
23
23
  const generatedId = `m-checkbox-${useId()}`
24
24
  useHydrationEdit(
25
25
  (root) => {
@@ -71,7 +71,7 @@ export const MCheckbox = defineComponent({
71
71
  borderRadius: '10px',
72
72
  opacity: props.disabled ? 0.45 : 1,
73
73
  flexGrow: nonNegative(props.grow, 'grow'),
74
- flexShrink: nonNegative(props.shrink ?? shrink, 'shrink'),
74
+ flexShrink: nonNegative(props.shrink ?? shrink.value, 'shrink'),
75
75
  width: length(resolveDimension(props.width)),
76
76
  color: colors.text,
77
77
  fontSize: `${typography.body.fontSize}px`,
@@ -27,7 +27,7 @@ import {
27
27
  useCombobox,
28
28
  useMavisTheme,
29
29
  useButtonAction,
30
- useDefaultShrink,
30
+ useLayoutShrink,
31
31
  } from '@getcortexlabs/mavis-core/vue'
32
32
  import { MColumn } from './layout.js'
33
33
  import { MText } from './MText.js'
@@ -46,7 +46,7 @@ const Combobox = defineComponent({
46
46
  useButtonAction()
47
47
  const { theme } = useMavisTheme()
48
48
  const combo = useCombobox(props, emit)
49
- const shrink = useDefaultShrink()
49
+ const shrink = useLayoutShrink()
50
50
  const generatedId = `m-combobox-${useId()}`
51
51
  const root = ref<HTMLElement>()
52
52
  const editor = ref<HTMLInputElement>()
@@ -243,7 +243,7 @@ const Combobox = defineComponent({
243
243
  minWidth: 0,
244
244
  width: length(resolveDimension(props.width)),
245
245
  flexGrow: nonNegative(props.grow, 'grow'),
246
- flexShrink: nonNegative(props.shrink ?? shrink, 'shrink'),
246
+ flexShrink: nonNegative(props.shrink ?? shrink.value, 'shrink'),
247
247
  },
248
248
  }),
249
249
  [
@@ -17,6 +17,14 @@ export const { MDatePicker, MDateRangePicker } = createDatePickers({
17
17
  Row: MRow,
18
18
  Sheet: MSheet,
19
19
  Calendar: DateCalendar,
20
+ deferActions: true,
21
+ openerAttrs: {
22
+ // Safari does not focus buttons on pointer activation. Capture the actual trigger
23
+ // before the Sheet snapshots focus; keyboard activation already has the right owner.
24
+ onMousedown(event: MouseEvent) {
25
+ if (event.button === 0) (event.currentTarget as HTMLElement).focus({ preventScroll: true })
26
+ },
27
+ },
20
28
  beforeOpen: focusOpener,
21
29
  // MSheet restores the Web opener after its close animation.
22
30
  afterClose: () => {},
@@ -16,7 +16,7 @@ import {
16
16
  inputProps,
17
17
  inputEmits,
18
18
  useMavisTheme,
19
- useDefaultShrink,
19
+ useLayoutShrink,
20
20
  } from '@getcortexlabs/mavis-core/vue'
21
21
  import {
22
22
  fontFamily,
@@ -43,7 +43,7 @@ const Input = defineComponent({
43
43
  useButtonAction()
44
44
  const instance = getCurrentInstance()!
45
45
  const { theme } = useMavisTheme()
46
- const shrink = useDefaultShrink()
46
+ const shrink = useLayoutShrink()
47
47
  const generatedId = `m-input-${useId()}`
48
48
  const editor = ref<HTMLInputElement | HTMLTextAreaElement>()
49
49
  const focused = ref(false)
@@ -186,7 +186,7 @@ const Input = defineComponent({
186
186
  minWidth: 0,
187
187
  fontFamily: fontFamily(typography.body.fontFamily, 'web'),
188
188
  flexGrow: nonNegative(props.grow, 'grow'),
189
- flexShrink: nonNegative(props.shrink ?? shrink, 'shrink'),
189
+ flexShrink: nonNegative(props.shrink ?? shrink.value, 'shrink'),
190
190
  width: length(resolveDimension(props.width)),
191
191
  opacity: props.disabled ? 0.5 : 1,
192
192
  '--m-input-placeholder': colors.muted,