@webwallgl/core 0.0.0-stage → 3.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 oneincase <462534624@qq.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ // WebWallGL 公共包类型入口(随 dist 发布为 dist/lib/core.d.ts)。
2
+ //
3
+ // 维护约束与 entry.d.ts 相同:函数签名是**手写的契约面**,类型本体只能来自
4
+ // ./types(tsconfig.lib-types.json 只编译 types.ts,别处的类型在发布包里解析
5
+ // 失败)。导出清单必须与 api/core.ts 一致 —— verify-arch 做机器比对,漏声明
6
+ // 的后果是消费方 import 直接 TS2305。
7
+ import type {
8
+ Pkg,
9
+ PkgEntry,
10
+ PkgLayout,
11
+ Tex,
12
+ TexMip,
13
+ TexFrame,
14
+ TexFrames,
15
+ DecodedMip,
16
+ Fit,
17
+ FitWindowResult,
18
+ } from "./types";
19
+
20
+ export type {
21
+ Pkg,
22
+ PkgEntry,
23
+ PkgLayout,
24
+ Tex,
25
+ TexMip,
26
+ TexFrame,
27
+ TexFrames,
28
+ DecodedMip,
29
+ Fit,
30
+ FitWindowResult,
31
+ };
32
+
33
+ /** 解析 scene.pkg(PKGV0012~0023)。入参必须是 Uint8Array(内部按 byteOffset 建视图) */
34
+ export declare function parsePkg(buf: Uint8Array): Pkg;
35
+
36
+ /** 取入口数据 —— 返回指向 pkg.buf 的零拷贝视图,不复制;需要独立副本自己 .slice() */
37
+ export declare function getEntry(pkg: Pkg, name: string): Uint8Array | null;
38
+
39
+ /** 结构自检:入口数据末尾应恰好贴住文件末尾 */
40
+ export declare function verifyLayout(pkg: Pkg): PkgLayout;
41
+
42
+ /** 解析 .tex(TEXV0005 主路径 + 旧 TEXV0004)。opts.name 仅供越界报错定位用 */
43
+ export declare function parseTex(buf: Uint8Array, opts?: { name?: string }): Tex;
44
+
45
+ export declare const TEXTURE_FORMATS: Record<number, string>;
46
+ export declare const FIF: {
47
+ readonly UNKNOWN: number;
48
+ readonly JPEG: number;
49
+ readonly PNG: number;
50
+ readonly GIF: number;
51
+ readonly WEBP: number;
52
+ readonly MP4: number;
53
+ };
54
+
55
+ /** mip0 解码 → 按载荷类型四选一(rgba / png / image+fif / video) */
56
+ export declare function decodeMip0(tex: Tex): DecodedMip;
57
+
58
+ /** 指定 mip 级独立解码(语义同 decodeMip0;POT 裁剪只在 level 0 生效) */
59
+ export declare function decodeMipLevel(tex: Tex, level: number): DecodedMip;
60
+
61
+ /** 全部 mip 级(freeImage 载荷按 image 透出、只有一级) */
62
+ export declare function decodeMips(tex: Tex): DecodedMip[];
63
+
64
+ /** 像素格式解码:format 取 TEXTURE_FORMATS 的键,返回 RGBA8;BC7(12)暂未实现 */
65
+ export declare function decodePixels(format: number, data: Uint8Array, w: number, h: number): Uint8Array;
66
+
67
+ /** 把设计尺寸(projW×projH)映射到屏幕(width×height)的可见窗口;
68
+ * alignX/alignY∈[0,1] 仅 cover 有溢出可滑,缺省 0.5 居中 */
69
+ export declare function fitWindow(
70
+ fit: Fit,
71
+ projW: number,
72
+ projH: number,
73
+ width: number,
74
+ height: number,
75
+ alignX?: number,
76
+ alignY?: number,
77
+ ): FitWindowResult;
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@webwallgl/core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "WebWallGL engine core: Wallpaper Engine .pkg / .tex decoding and fit math (zero dependencies)",
4
+ "version": "3.0.1",
5
+ "license": "MIT",
6
+ "author": "oneincase <462534624@qq.com>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/oneincase/webwallgl.git"
10
+ },
11
+ "homepage": "https://github.com/oneincase/webwallgl#readme",
12
+ "bugs": "https://github.com/oneincase/webwallgl/issues",
13
+ "type": "module",
14
+ "sideEffects": false,
15
+ "keywords": [
16
+ "wallpaper-engine",
17
+ "wallpaper",
18
+ "webgl",
19
+ "renderer",
20
+ "scene",
21
+ "browser",
22
+ "pkg",
23
+ "tex"
24
+ ],
25
+ "files": [
26
+ "webwallgl-core.mjs",
27
+ "index.d.ts",
28
+ "types.d.ts"
29
+ ],
30
+ "module": "./webwallgl-core.mjs",
31
+ "types": "./index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./index.d.ts",
35
+ "default": "./webwallgl-core.mjs"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ }
42
+ }