@axium/storage 0.20.2 → 0.20.4

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.
@@ -0,0 +1,110 @@
1
+ :host {
2
+ anchor-scope: --preview-openers;
3
+ }
4
+
5
+ .preview-action {
6
+ --size: 18px;
7
+ }
8
+
9
+ .preview-action:hover {
10
+ cursor: pointer;
11
+ }
12
+
13
+ .preview-top-bar {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: 1em;
17
+ justify-content: space-between;
18
+ padding: 0;
19
+ position: absolute;
20
+ inset: 0.5em 1em 0;
21
+ height: fit-content;
22
+
23
+ > div {
24
+ display: flex;
25
+ gap: 1em;
26
+ align-items: center;
27
+ }
28
+ }
29
+
30
+ .openers {
31
+ padding: 1em;
32
+ border: var(--border-accent);
33
+ border-radius: 1em;
34
+ height: 2em;
35
+ anchor-name: --preview-openers;
36
+ }
37
+
38
+ .openers :global([popover]) {
39
+ inset: anchor(bottom) anchor(right) auto anchor(left);
40
+ position-anchor: --preview-openers;
41
+ width: anchor-size(width);
42
+ }
43
+
44
+ .actions {
45
+ right: 0;
46
+ }
47
+
48
+ .preview-content {
49
+ position: absolute;
50
+ inset: 3em 10em 1em;
51
+ display: flex;
52
+ text-align: center;
53
+ align-items: center;
54
+ justify-content: center;
55
+ flex-direction: column;
56
+
57
+ .full-fill {
58
+ position: absolute;
59
+ inset: 0;
60
+ width: 100%;
61
+ height: 100%;
62
+ }
63
+
64
+ .preview-text {
65
+ white-space: pre-wrap;
66
+ overflow-y: scroll;
67
+ line-height: 1.6;
68
+ background-color: var(--bg-menu);
69
+ font-family: monospace;
70
+ }
71
+
72
+ img,
73
+ video {
74
+ max-width: 100%;
75
+ max-height: 100%;
76
+ }
77
+ }
78
+
79
+ .no-preview {
80
+ display: flex;
81
+ flex-direction: column;
82
+ gap: 1em;
83
+ align-items: center;
84
+ justify-content: center;
85
+ }
86
+
87
+ @media (width < 700px) {
88
+ .preview-top-bar {
89
+ flex-direction: column;
90
+
91
+ .actions {
92
+ justify-content: space-around;
93
+ width: 100%;
94
+
95
+ .preview-action {
96
+ padding: 1em;
97
+ flex: 1 1 0;
98
+ border-radius: 1em;
99
+ border: var(--border-accent);
100
+ padding: 1em;
101
+ justify-content: center;
102
+ display: flex;
103
+ }
104
+ }
105
+ }
106
+
107
+ .preview-content {
108
+ inset: 10em 1em 0;
109
+ }
110
+ }
@@ -7,6 +7,7 @@
7
7
  import { copyShortURL } from '@axium/storage/client/frontend';
8
8
  import type { StorageItemMetadata } from '@axium/storage/common';
9
9
  import '@axium/storage/polyfills';
10
+ import './Preview.css';
10
11
 
11
12
  const {
12
13
  item,
@@ -144,116 +145,3 @@
144
145
  >
145
146
  <p>{text('storage.Preview.download_confirm')}</p>
146
147
  </FormDialog>
147
-
148
- <style>
149
- :host {
150
- anchor-scope: --preview-openers;
151
- }
152
-
153
- .preview-action {
154
- --size: 18px;
155
- }
156
-
157
- .preview-action:hover {
158
- cursor: pointer;
159
- }
160
-
161
- .preview-top-bar {
162
- display: flex;
163
- align-items: center;
164
- gap: 1em;
165
- justify-content: space-between;
166
- padding: 0;
167
- position: absolute;
168
- inset: 0.5em 1em 0;
169
- height: fit-content;
170
-
171
- > div {
172
- display: flex;
173
- gap: 1em;
174
- align-items: center;
175
- }
176
- }
177
-
178
- .openers {
179
- padding: 1em;
180
- border: var(--border-accent);
181
- border-radius: 1em;
182
- height: 2em;
183
- anchor-name: --preview-openers;
184
- }
185
-
186
- .openers :global([popover]) {
187
- inset: anchor(bottom) anchor(right) auto anchor(left);
188
- position-anchor: --preview-openers;
189
- width: anchor-size(width);
190
- }
191
-
192
- .actions {
193
- right: 0;
194
- }
195
-
196
- .preview-content {
197
- position: absolute;
198
- inset: 3em 10em 1em;
199
- display: flex;
200
- text-align: center;
201
- align-items: center;
202
- justify-content: center;
203
- flex-direction: column;
204
-
205
- .full-fill {
206
- position: absolute;
207
- inset: 0;
208
- width: 100%;
209
- height: 100%;
210
- }
211
-
212
- .preview-text {
213
- white-space: pre-wrap;
214
- overflow-y: scroll;
215
- line-height: 1.6;
216
- background-color: var(--bg-menu);
217
- font-family: monospace;
218
- }
219
-
220
- img,
221
- video {
222
- max-width: 100%;
223
- max-height: 100%;
224
- }
225
- }
226
-
227
- .no-preview {
228
- display: flex;
229
- flex-direction: column;
230
- gap: 1em;
231
- align-items: center;
232
- justify-content: center;
233
- }
234
-
235
- @media (width < 700px) {
236
- .preview-top-bar {
237
- flex-direction: column;
238
-
239
- .actions {
240
- justify-content: space-around;
241
- width: 100%;
242
-
243
- .preview-action {
244
- padding: 1em;
245
- flex: 1 1 0;
246
- border-radius: 1em;
247
- border: var(--border-accent);
248
- padding: 1em;
249
- justify-content: center;
250
- display: flex;
251
- }
252
- }
253
- }
254
-
255
- .preview-content {
256
- inset: 10em 1em 0;
257
- }
258
- }
259
- </style>
package/lib/Usage.svelte CHANGED
@@ -15,8 +15,8 @@
15
15
  <p>
16
16
  <a href="/files/usage">
17
17
  <NumberBar
18
- max={info.limits.user_size && info.limits.user_size * 1_000_000n}
19
- value={info.usedBytes}
18
+ max={!!info.limits.user_size && Number(info.limits.user_size * 1_000_000n)}
19
+ value={Number(info.usedBytes)}
20
20
  text="{formatBytes(info.usedBytes)} {!info.limits.user_size
21
21
  ? ''
22
22
  : '/ ' + formatBytes(info.limits.user_size * 1_000_000n)}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/storage",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "description": "User file storage for Axium",
6
6
  "funding": {
@@ -40,7 +40,7 @@
40
40
  "build": "tsc"
41
41
  },
42
42
  "peerDependencies": {
43
- "@axium/client": ">=0.19.1",
43
+ "@axium/client": ">=0.19.8",
44
44
  "@axium/core": ">=0.22.0",
45
45
  "@axium/server": ">=0.39.0",
46
46
  "@sveltejs/kit": "^2.27.3",
@@ -23,6 +23,6 @@
23
23
 
24
24
  <h2>{text('page.files.usage.heading')}</h2>
25
25
 
26
- <p><NumberBar max={limits.user_size * 1_000_000n} value={usedBytes} text={barText} /></p>
26
+ <p><NumberBar max={Number(limits.user_size * 1_000_000n)} value={Number(usedBytes)} text={barText} /></p>
27
27
 
28
28
  <List bind:items emptyText={text('page.files.usage.empty')} user={data.session?.user} />