@axium/client 0.31.0 → 0.31.2

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
@@ -232,15 +232,18 @@ div.success {
232
232
  }
233
233
 
234
234
  .danger {
235
- border: var(--border-error);
236
- background-color: hsl(from var(--bg-strong) 0 s l);
237
- color: hsl(0 33 var(--fg-light));
238
- --fill: hsl(0 33 var(--fg-light));
239
- accent-color: hsl(0 33 var(--fg-light));
240
- }
235
+ color: var(--fg-danger);
236
+ --fill: var(--fg-danger);
237
+ accent-color: var(--fg-danger);
238
+
239
+ &:is(button, div):not(.reset) {
240
+ border: var(--border-error);
241
+ background-color: var(--bg-danger);
241
242
 
242
- .danger:hover {
243
- background-color: hsl(0 20 calc(var(--bg-light) + (var(--light-step) * 3)));
243
+ &:hover {
244
+ background-color: hsl(0 20 calc(var(--bg-light) + (var(--light-step) * 3)));
245
+ }
246
+ }
244
247
  }
245
248
 
246
249
  :disabled,
@@ -274,6 +277,15 @@ div.success {
274
277
  background-color: var(--bg-strong);
275
278
  cursor: pointer;
276
279
  }
280
+
281
+ &.danger:where(button, div) {
282
+ border: none;
283
+ background-color: transparent;
284
+
285
+ &:hover {
286
+ background-color: var(--bg-danger);
287
+ }
288
+ }
277
289
  }
278
290
 
279
291
  .menu-header {
@@ -474,4 +486,39 @@ div.toast {
474
486
  z-index: 4;
475
487
  font-size: 1.25em;
476
488
  }
489
+
490
+ :popover-open {
491
+ position: fixed;
492
+ width: 100%;
493
+ max-width: 100%;
494
+ max-height: 80dvh;
495
+ overflow-y: auto;
496
+ border: none;
497
+ gap: 0.25em;
498
+
499
+ &:not(.mobile-top) {
500
+ inset: auto 0 0 0 !important;
501
+ border-top: var(--border-elevated);
502
+ border-radius: 1em 1em 0 0;
503
+ padding: 0.5em 0.5em calc(0.5em + env(safe-area-inset-bottom, 0px));
504
+ }
505
+
506
+ &.mobile-top {
507
+ inset: 0 0 auto 0 !important;
508
+ border-bottom: var(--border-elevated);
509
+ border-radius: 0 0 1em 1em;
510
+ padding: calc(0.5em + env(safe-area-inset-top, 0px)) 0.5em 0.5em;
511
+ }
512
+
513
+ .menu-item {
514
+ padding: 1em;
515
+ font-size: 1.05em;
516
+ border-radius: 0.75em;
517
+ }
518
+
519
+ .menu-header {
520
+ padding: 0.75em 1em 0.5em;
521
+ font-size: 1em;
522
+ }
523
+ }
477
524
  }
package/assets/theme.css CHANGED
@@ -36,6 +36,7 @@ html {
36
36
  --bg-alt: hsl(var(--hue) 5 calc(var(--bg-light) + var(--light-step)));
37
37
  --bg-strong: hsl(var(--hue) 20 calc(var(--bg-light) + var(--light-step)));
38
38
  --bg-elevated: hsl(from var(--bg-menu) h s l / 95%);
39
+ --bg-danger: hsl(from var(--bg-strong) 0 s l);
39
40
 
40
41
  --bg-error: hsl(0 40 var(--bg-light-status));
41
42
  --bg-warning: hsl(60 40 var(--bg-light-status));
@@ -45,6 +46,7 @@ html {
45
46
  --fg-accent: hsl(var(--hue) 15 var(--fg-light));
46
47
  --fg-strong: hsl(var(--hue) 25 calc(var(--fg-light) - var(--light-step)));
47
48
  --fg-disabled: hsl(0 0 calc(var(--fg-light) - var(--light-step)));
49
+ --fg-danger: hsl(0 33 var(--fg-light));
48
50
 
49
51
  --fg-error: hsl(0 50 calc(var(--fg-light) - var(--light-step)));
50
52
  --fg-warning: hsl(60 50 calc(var(--fg-light) - var(--light-step)));
@@ -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} />
@@ -51,8 +51,8 @@
51
51
  <i>{text('AppMenu.failed')}</i>
52
52
  {/await}
53
53
 
54
- <button class="menu-item logout reset" command="show-modal" commandfor="logout">
55
- <Icon i="right-from-bracket" --size="1.5em" --fill="hsl(0 33 var(--fg-light))" />
54
+ <button class="menu-item danger reset" command="show-modal" commandfor="logout">
55
+ <Icon i="right-from-bracket" --size="1.5em" />
56
56
  <span>{text('generic.logout')}</span>
57
57
  </button>
58
58
  </Popover>
@@ -73,18 +73,16 @@
73
73
  background-color: var(--bg-alt);
74
74
  }
75
75
 
76
- .logout {
77
- color: hsl(0 33 var(--fg-light));
78
- font-size: 16px;
79
- }
80
-
81
76
  :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
77
  cursor: default;
78
+
79
+ @media (width > 700px) {
80
+ position: fixed;
81
+ left: unset;
82
+ right: anchor(right);
83
+ top: calc(anchor(bottom) + 0.5em);
84
+ width: fit-content;
85
+ height: fit-content;
86
+ }
89
87
  }
90
88
  </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.2",
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/*';