@axium/client 0.31.0 → 0.31.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.
package/assets/styles.css CHANGED
@@ -474,4 +474,39 @@ div.toast {
474
474
  z-index: 4;
475
475
  font-size: 1.25em;
476
476
  }
477
+
478
+ :popover-open {
479
+ position: fixed;
480
+ width: 100%;
481
+ max-width: 100%;
482
+ max-height: 80dvh;
483
+ overflow-y: auto;
484
+ border: none;
485
+ gap: 0.25em;
486
+
487
+ &:not(.mobile-top) {
488
+ inset: auto 0 0 0 !important;
489
+ border-top: var(--border-elevated);
490
+ border-radius: 1em 1em 0 0;
491
+ padding: 0.5em 0.5em calc(0.5em + env(safe-area-inset-bottom, 0px));
492
+ }
493
+
494
+ &.mobile-top {
495
+ inset: 0 0 auto 0 !important;
496
+ border-bottom: var(--border-elevated);
497
+ border-radius: 0 0 1em 1em;
498
+ padding: calc(0.5em + env(safe-area-inset-top, 0px)) 0.5em 0.5em;
499
+ }
500
+
501
+ .menu-item {
502
+ padding: 1em;
503
+ font-size: 1.05em;
504
+ border-radius: 0.75em;
505
+ }
506
+
507
+ .menu-header {
508
+ padding: 0.75em 1em 0.5em;
509
+ font-size: 1em;
510
+ }
511
+ }
477
512
  }
@@ -1,3 +1,4 @@
1
1
  export * from './animate.js';
2
2
  export * from './clipboard.js';
3
3
  export * as controls from './controls.js';
4
+ export * from './mobile.js';
package/dist/gui/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './animate.js';
2
2
  export * from './clipboard.js';
3
3
  export * as controls from './controls.js';
4
+ export * from './mobile.js';
@@ -0,0 +1 @@
1
+ export declare function isMobile(): boolean;
@@ -0,0 +1,4 @@
1
+ const width = matchMedia('(width <= 700px)');
2
+ export function isMobile() {
3
+ return width.matches;
4
+ }
@@ -66,16 +66,16 @@
66
66
  :global(:hover:has(:hover > .Popover > .toggle-hover)) > div > .toggle-hover:not(.cascade-hover) {
67
67
  visibility: hidden;
68
68
  }
69
- }
70
69
 
71
- :popover-open {
72
- position-anchor: --popover;
73
- position-try-fallbacks:
74
- flip-inline,
75
- flip-block,
76
- flip-block flip-inline;
77
- position-visibility: always;
78
- left: anchor(left);
79
- top: anchor(bottom);
70
+ :popover-open {
71
+ position-anchor: --popover;
72
+ position-try-fallbacks:
73
+ flip-inline,
74
+ flip-block,
75
+ flip-block flip-inline;
76
+ position-visibility: always;
77
+ left: anchor(left);
78
+ top: anchor(bottom);
79
+ }
80
80
  }
81
81
  </style>
@@ -10,7 +10,7 @@
10
10
  </script>
11
11
 
12
12
  {#if user}
13
- <Popover>
13
+ <Popover class="mobile-top">
14
14
  {#snippet toggle()}
15
15
  <div class="UserMenu toggle">
16
16
  <UserPFP {user} />
@@ -79,12 +79,15 @@
79
79
  }
80
80
 
81
81
  :global(.UserMenu + div:popover-open) {
82
- position: fixed;
83
- left: unset;
84
- right: anchor(right);
85
- top: calc(anchor(bottom) + 0.5em);
86
- width: fit-content;
87
- height: fit-content;
88
82
  cursor: default;
83
+
84
+ @media (width > 700px) {
85
+ position: fixed;
86
+ left: unset;
87
+ right: anchor(right);
88
+ top: calc(anchor(bottom) + 0.5em);
89
+ width: fit-content;
90
+ height: fit-content;
91
+ }
89
92
  }
90
93
  </style>
@@ -1,3 +1,4 @@
1
+ import { isMobile } from '@axium/client/gui';
1
2
  import { mount, unmount } from 'svelte';
2
3
  import type { Attachment } from 'svelte/attachments';
3
4
  import Icon from '../Icon.svelte';
@@ -86,6 +87,8 @@ export function contextMenu(...menuItems: ContextMenuEntry[] | [() => ContextMen
86
87
  menu.showPopover();
87
88
  _forcePopover = true;
88
89
 
90
+ if (isMobile()) return;
91
+
89
92
  const x = e.clientX;
90
93
  const y = e.clientY;
91
94
 
@@ -1,4 +1,4 @@
1
- import { mount, unmount, type Component } from 'svelte';
1
+ import { mount, unmount } from 'svelte';
2
2
  import type { Attachment } from 'svelte/attachments';
3
3
  import Icon from '../Icon.svelte';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/client",
3
- "version": "0.31.0",
3
+ "version": "0.31.1",
4
4
  "author": "James Prevett <jp@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -40,7 +40,10 @@
40
40
  "./toast": "./lib/toast.js",
41
41
  "./attachments": "./lib/attachments/index.js",
42
42
  "./reactive": "./lib/reactive/index.svelte.js",
43
- "./styles/*": "./styles/*.css"
43
+ "./styles/*": {
44
+ "types": "./styles/styles.d.ts",
45
+ "default": "./styles/*.css"
46
+ }
44
47
  },
45
48
  "scripts": {
46
49
  "build": "tsc"
@@ -0,0 +1 @@
1
+ declare module '@axium/client/styles/*';