@antha/asset 0.0.8 → 0.1.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/dist/antha-asset.mod.js +46 -44
- package/dist/asset-loader.d.ts +2 -1
- package/dist/asset-loader.js +13 -10
- package/package.json +9 -9
package/dist/antha-asset.mod.js
CHANGED
|
@@ -23,56 +23,58 @@ export const AnthaAssetLoadingScreen = defineElement()({
|
|
|
23
23
|
hostClasses: {
|
|
24
24
|
'antha-asset-loading-screen-completed': ({ inputs }) => inputs.completed,
|
|
25
25
|
},
|
|
26
|
-
styles: ({ hostClasses }) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
styles: ({ hostClasses }) => {
|
|
27
|
+
return css `
|
|
28
|
+
:host {
|
|
29
|
+
position: fixed;
|
|
30
|
+
inset: 0;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
background-color: black;
|
|
36
|
+
color: white;
|
|
37
|
+
z-index: 9999;
|
|
38
|
+
gap: 24px;
|
|
39
|
+
opacity: 1;
|
|
40
|
+
transition: opacity ${loadingScreenFadeMs}ms ease-in;
|
|
41
|
+
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
.loading-text {
|
|
44
|
+
font-size: 24px;
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
.dots {
|
|
49
|
+
font-family: monospace;
|
|
50
|
+
position: absolute;
|
|
51
|
+
left: 100%;
|
|
52
|
+
bottom: 0;
|
|
53
|
+
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
.progress-track {
|
|
56
|
+
width: 300px;
|
|
57
|
+
height: 1em;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
border: 4px solid white;
|
|
60
|
+
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
.current-resource-name {
|
|
63
|
+
font-size: 14px;
|
|
64
|
+
opacity: 0.7;
|
|
65
|
+
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
.progress-fill {
|
|
68
|
+
height: 100%;
|
|
69
|
+
background-color: white;
|
|
70
|
+
transition: width ${loadingScreenProgressGrowMs}ms ease-in;
|
|
71
|
+
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
${hostClasses['antha-asset-loading-screen-completed'].selector} {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
},
|
|
76
78
|
render({ inputs }) {
|
|
77
79
|
const dotCount = inputs.dotCount % 4;
|
|
78
80
|
const dots = '.'.repeat(dotCount) + '\u00A0'.repeat(3 - dotCount);
|
package/dist/asset-loader.d.ts
CHANGED
|
@@ -166,6 +166,7 @@ export declare class AssetLoader extends ListenTarget<AssetLoaderProgressUpdateE
|
|
|
166
166
|
destroy(): Promise<void>;
|
|
167
167
|
/** Loads multiple assets. */
|
|
168
168
|
bulkLoadAssets(assets: ReadonlyArray<Readonly<Asset>>, options?: Readonly<AssetBulkLoaderLoadOptions>): Promise<ReadonlyArray<unknown>>;
|
|
169
|
-
|
|
169
|
+
/** Dispatch a loading progress event for the active bulk load. */
|
|
170
|
+
protected dispatchProgressUpdate(detail: ConstructorParameters<typeof AssetLoaderProgressUpdateEvent>[0]['detail']): void;
|
|
170
171
|
}
|
|
171
172
|
export {};
|
package/dist/asset-loader.js
CHANGED
|
@@ -111,16 +111,18 @@ export class AssetLoader extends ListenTarget {
|
|
|
111
111
|
chunkSize: options.maxParallelism,
|
|
112
112
|
})
|
|
113
113
|
: [[...assets]];
|
|
114
|
-
const createIncrementProgressCallback = (asset) =>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
const createIncrementProgressCallback = (asset) => {
|
|
115
|
+
return (amount) => {
|
|
116
|
+
currentProgress += amount ?? 1;
|
|
117
|
+
if (!options.hideLoadingScreen) {
|
|
118
|
+
this.dispatchProgressUpdate({
|
|
119
|
+
current: currentProgress,
|
|
120
|
+
total: maxProgress,
|
|
121
|
+
currentResourceName: asset.name,
|
|
122
|
+
complete: false,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
124
126
|
};
|
|
125
127
|
const results = (await awaitedBlockingMap(chunkedAssets, async (assetChunk) => {
|
|
126
128
|
return await Promise.all(assetChunk.map(async (asset) => {
|
|
@@ -164,6 +166,7 @@ export class AssetLoader extends ListenTarget {
|
|
|
164
166
|
}
|
|
165
167
|
return results;
|
|
166
168
|
}
|
|
169
|
+
/** Dispatch a loading progress event for the active bulk load. */
|
|
167
170
|
dispatchProgressUpdate(detail) {
|
|
168
171
|
this.dispatch(new AssetLoaderProgressUpdateEvent({
|
|
169
172
|
detail,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antha/asset",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "An Antha mod for handling asset loading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vir",
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"test:docs": "virmator docs check"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@augment-vir/assert": "^
|
|
38
|
-
"@augment-vir/common": "^
|
|
39
|
-
"typed-event-target": "^4.3.
|
|
37
|
+
"@augment-vir/assert": "^32.2.2",
|
|
38
|
+
"@augment-vir/common": "^32.2.2",
|
|
39
|
+
"typed-event-target": "^4.3.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@augment-vir/test": "^
|
|
43
|
-
"@web/dev-server-esbuild": "^
|
|
44
|
-
"@web/test-runner": "^0.
|
|
45
|
-
"@web/test-runner-playwright": "^0.
|
|
42
|
+
"@augment-vir/test": "^32.2.2",
|
|
43
|
+
"@web/dev-server-esbuild": "^2.0.0",
|
|
44
|
+
"@web/test-runner": "^1.0.0",
|
|
45
|
+
"@web/test-runner-playwright": "^1.0.0",
|
|
46
46
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
47
47
|
"pixi.js": "^8.19.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@antha/engine": "^0.0
|
|
50
|
+
"@antha/engine": "^0.1.0",
|
|
51
51
|
"element-vir": ">=26"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|