@motion-core/motion-gpu 0.2.0 → 0.3.0
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/README.md +6 -0
- package/dist/core/current-value.js +3 -0
- package/dist/core/error-diagnostics.d.ts +14 -0
- package/dist/core/error-diagnostics.js +41 -1
- package/dist/core/error-report.d.ts +37 -0
- package/dist/core/error-report.js +60 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/renderer.d.ts +10 -0
- package/dist/core/renderer.js +66 -4
- package/dist/core/runtime-loop.d.ts +3 -0
- package/dist/core/runtime-loop.js +72 -1
- package/dist/core/types.d.ts +4 -0
- package/dist/passes/BlitPass.d.ts +6 -27
- package/dist/passes/BlitPass.js +10 -121
- package/dist/passes/FullscreenPass.d.ts +37 -0
- package/dist/passes/FullscreenPass.js +131 -0
- package/dist/passes/ShaderPass.d.ts +6 -26
- package/dist/passes/ShaderPass.js +10 -121
- package/dist/svelte/FragCanvas.svelte +43 -0
- package/dist/svelte/FragCanvas.svelte.d.ts +2 -0
- package/dist/svelte/MotionGPUErrorOverlay.svelte +10 -19
- package/dist/svelte/use-texture.d.ts +5 -0
- package/dist/svelte/use-texture.js +7 -1
- package/package.json +1 -1
|
@@ -53,9 +53,8 @@
|
|
|
53
53
|
class="motiongpu-error-source-tab motiongpu-error-source-tab-active"
|
|
54
54
|
role="tab"
|
|
55
55
|
aria-selected="true"
|
|
56
|
-
>{report.source.
|
|
57
|
-
|
|
58
|
-
{report.source.column}{/if})</span
|
|
56
|
+
>{report.source.location}{#if report.source.column}, col {report.source
|
|
57
|
+
.column}{/if}</span
|
|
59
58
|
>
|
|
60
59
|
<span class="motiongpu-error-source-tab-spacer" aria-hidden="true"></span>
|
|
61
60
|
</div>
|
|
@@ -117,21 +116,13 @@
|
|
|
117
116
|
--motiongpu-radius-xl: var(--radius-xl, 1rem);
|
|
118
117
|
--motiongpu-font-sans: var(
|
|
119
118
|
--font-sans,
|
|
120
|
-
'Aeonik Pro',
|
|
121
119
|
'Inter',
|
|
122
120
|
'Segoe UI',
|
|
123
121
|
'Helvetica Neue',
|
|
124
122
|
Arial,
|
|
125
123
|
sans-serif
|
|
126
124
|
);
|
|
127
|
-
--motiongpu-font-mono: var(
|
|
128
|
-
--font-mono,
|
|
129
|
-
'Aeonik font-mono',
|
|
130
|
-
'SFMono-Regular',
|
|
131
|
-
'Menlo',
|
|
132
|
-
'Consolas',
|
|
133
|
-
monospace
|
|
134
|
-
);
|
|
125
|
+
--motiongpu-font-mono: var(--font-mono, 'SFMono-Regular', 'Menlo', 'Consolas', monospace);
|
|
135
126
|
position: fixed;
|
|
136
127
|
inset: 0;
|
|
137
128
|
display: grid;
|
|
@@ -156,7 +147,7 @@
|
|
|
156
147
|
max-width: calc(100vw - 1.5rem);
|
|
157
148
|
box-sizing: border-box;
|
|
158
149
|
font-size: 0.875rem;
|
|
159
|
-
font-weight:
|
|
150
|
+
font-weight: 400;
|
|
160
151
|
line-height: 1.45;
|
|
161
152
|
background: linear-gradient(
|
|
162
153
|
180deg,
|
|
@@ -229,7 +220,7 @@
|
|
|
229
220
|
background: color-mix(in srgb, var(--motiongpu-color-accent) 9%, var(--motiongpu-color-card));
|
|
230
221
|
font-size: 0.82rem;
|
|
231
222
|
line-height: 1.4;
|
|
232
|
-
font-weight:
|
|
223
|
+
font-weight: 400;
|
|
233
224
|
color: var(--motiongpu-color-foreground);
|
|
234
225
|
}
|
|
235
226
|
|
|
@@ -237,7 +228,7 @@
|
|
|
237
228
|
margin: 0;
|
|
238
229
|
font-size: 0.82rem;
|
|
239
230
|
line-height: 1.45;
|
|
240
|
-
font-weight:
|
|
231
|
+
font-weight: 400;
|
|
241
232
|
color: var(--motiongpu-color-foreground-muted);
|
|
242
233
|
}
|
|
243
234
|
|
|
@@ -282,7 +273,7 @@
|
|
|
282
273
|
align-items: center;
|
|
283
274
|
padding: 0.5rem 0.68rem;
|
|
284
275
|
font-size: 0.76rem;
|
|
285
|
-
font-weight:
|
|
276
|
+
font-weight: 400;
|
|
286
277
|
line-height: 1.2;
|
|
287
278
|
color: var(--motiongpu-color-foreground-muted);
|
|
288
279
|
border-right: 1px solid var(--motiongpu-color-border);
|
|
@@ -317,7 +308,7 @@
|
|
|
317
308
|
.motiongpu-error-source-line {
|
|
318
309
|
font-family: var(--motiongpu-font-mono);
|
|
319
310
|
font-size: 0.77rem;
|
|
320
|
-
font-weight:
|
|
311
|
+
font-weight: 400;
|
|
321
312
|
line-height: 1.3;
|
|
322
313
|
font-variant-numeric: tabular-nums;
|
|
323
314
|
font-feature-settings: 'tnum' 1;
|
|
@@ -329,7 +320,7 @@
|
|
|
329
320
|
.motiongpu-error-source-code {
|
|
330
321
|
font-family: var(--motiongpu-font-mono);
|
|
331
322
|
font-size: 0.77rem;
|
|
332
|
-
font-weight:
|
|
323
|
+
font-weight: 400;
|
|
333
324
|
line-height: 1.3;
|
|
334
325
|
color: var(--motiongpu-color-foreground);
|
|
335
326
|
white-space: pre-wrap;
|
|
@@ -367,7 +358,7 @@
|
|
|
367
358
|
background: var(--motiongpu-color-background-muted);
|
|
368
359
|
font-size: 0.74rem;
|
|
369
360
|
line-height: 1.4;
|
|
370
|
-
font-weight:
|
|
361
|
+
font-weight: 400;
|
|
371
362
|
color: var(--motiongpu-color-foreground);
|
|
372
363
|
font-family: var(--motiongpu-font-mono);
|
|
373
364
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CurrentReadable } from '../core/current-value.js';
|
|
2
2
|
import { type LoadedTexture, type TextureLoadOptions } from '../core/texture-loader.js';
|
|
3
|
+
import { type MotionGPUErrorReport } from '../core/error-report.js';
|
|
3
4
|
/**
|
|
4
5
|
* Reactive state returned by {@link useTexture}.
|
|
5
6
|
*/
|
|
@@ -16,6 +17,10 @@ export interface UseTextureResult {
|
|
|
16
17
|
* Last loading error.
|
|
17
18
|
*/
|
|
18
19
|
error: CurrentReadable<Error | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Last loading error normalized to MotionGPU diagnostics report shape.
|
|
22
|
+
*/
|
|
23
|
+
errorReport: CurrentReadable<MotionGPUErrorReport | null>;
|
|
19
24
|
/**
|
|
20
25
|
* Reloads all textures using current URL input.
|
|
21
26
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { onDestroy } from 'svelte';
|
|
2
2
|
import { createCurrentWritable as currentWritable } from '../core/current-value.js';
|
|
3
3
|
import { isAbortError, loadTexturesFromUrls } from '../core/texture-loader.js';
|
|
4
|
+
import { toMotionGPUErrorReport } from '../core/error-report.js';
|
|
4
5
|
/**
|
|
5
6
|
* Normalizes unknown thrown values to an `Error` instance.
|
|
6
7
|
*/
|
|
@@ -60,6 +61,7 @@ export function useTexture(urlInput, options = {}) {
|
|
|
60
61
|
const textures = currentWritable(null);
|
|
61
62
|
const loading = currentWritable(true);
|
|
62
63
|
const error = currentWritable(null);
|
|
64
|
+
const errorReport = currentWritable(null);
|
|
63
65
|
let disposed = false;
|
|
64
66
|
let requestVersion = 0;
|
|
65
67
|
let activeController = null;
|
|
@@ -75,6 +77,7 @@ export function useTexture(urlInput, options = {}) {
|
|
|
75
77
|
activeController = controller;
|
|
76
78
|
loading.set(true);
|
|
77
79
|
error.set(null);
|
|
80
|
+
errorReport.set(null);
|
|
78
81
|
const previous = textures.current;
|
|
79
82
|
const mergedSignal = mergeAbortSignals(controller.signal, options.signal);
|
|
80
83
|
try {
|
|
@@ -98,7 +101,9 @@ export function useTexture(urlInput, options = {}) {
|
|
|
98
101
|
}
|
|
99
102
|
disposeTextures(previous);
|
|
100
103
|
textures.set(null);
|
|
101
|
-
|
|
104
|
+
const normalizedError = toError(nextError);
|
|
105
|
+
error.set(normalizedError);
|
|
106
|
+
errorReport.set(toMotionGPUErrorReport(normalizedError, 'initialization'));
|
|
102
107
|
}
|
|
103
108
|
finally {
|
|
104
109
|
if (!disposed && version === requestVersion) {
|
|
@@ -142,6 +147,7 @@ export function useTexture(urlInput, options = {}) {
|
|
|
142
147
|
textures,
|
|
143
148
|
loading,
|
|
144
149
|
error,
|
|
150
|
+
errorReport,
|
|
145
151
|
reload: load
|
|
146
152
|
};
|
|
147
153
|
}
|