@openfairygui/functions 0.2.0-alpha.1 → 0.2.0-alpha.12

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,79 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _openfairygui_core_uam = require("@openfairygui/core/uam");
3
+ //#region src/uam-transaction.ts
4
+ function mapTransactionErrorStage(error) {
5
+ switch (error.code) {
6
+ case "transaction_unsupported": return "preflight";
7
+ case "invalid_uam": return "preflight";
8
+ case "execution_failure": return error.opIndex === void 0 && error.issues !== void 0 ? "postflight" : "execution";
9
+ case "selector_ambiguity": return error.opIndex === void 0 ? "preflight" : "execution";
10
+ }
11
+ }
12
+ function compactDiagnostic(diagnostic) {
13
+ return Object.fromEntries(Object.entries(diagnostic).filter(([, value]) => value !== void 0));
14
+ }
15
+ function isTransactionSupportIssue(issue) {
16
+ return "code" in issue;
17
+ }
18
+ function mapTransactionDiagnostics(error) {
19
+ if (error.issues?.length) return error.issues.map((issue) => {
20
+ if (isTransactionSupportIssue(issue)) return compactDiagnostic({
21
+ code: issue.code,
22
+ message: issue.message,
23
+ severity: "error",
24
+ path: issue.path,
25
+ nodeKind: issue.nodeKind,
26
+ resourceKind: issue.resourceKind,
27
+ gearKind: issue.gearKind,
28
+ field: issue.field,
29
+ operationKind: issue.operationKind ?? error.opKind,
30
+ opIndex: error.opIndex,
31
+ opId: error.opId
32
+ });
33
+ return compactDiagnostic({
34
+ code: error.code,
35
+ message: issue.message,
36
+ severity: "error",
37
+ path: issue.path,
38
+ operationKind: error.opKind,
39
+ opIndex: error.opIndex,
40
+ opId: error.opId
41
+ });
42
+ });
43
+ return [compactDiagnostic({
44
+ code: error.code,
45
+ message: error.message,
46
+ severity: "error",
47
+ path: error.opIndex === void 0 ? void 0 : `operations[${error.opIndex}]`,
48
+ operationKind: error.opKind,
49
+ opIndex: error.opIndex,
50
+ opId: error.opId
51
+ })];
52
+ }
53
+ function applyUamTransactionApp(input) {
54
+ try {
55
+ return {
56
+ ok: true,
57
+ project: (0, _openfairygui_core_uam.applyUamTransaction)(input.project, input.operations)
58
+ };
59
+ } catch (error) {
60
+ if (error instanceof _openfairygui_core_uam.UamTransactionError) return {
61
+ ok: false,
62
+ error: {
63
+ code: error.code,
64
+ stage: mapTransactionErrorStage(error),
65
+ message: error.message,
66
+ opIndex: error.opIndex,
67
+ opId: error.opId,
68
+ opKind: error.opKind,
69
+ operationKind: error.opKind,
70
+ selector: error.selector,
71
+ issues: error.issues,
72
+ diagnostics: mapTransactionDiagnostics(error)
73
+ }
74
+ };
75
+ throw error;
76
+ }
77
+ }
78
+ //#endregion
79
+ exports.applyUamTransactionApp = applyUamTransactionApp;
@@ -0,0 +1,42 @@
1
+ import { UamProject, UamTransactionErrorCode, UamTransactionOperation, UamTransactionSupportIssue, UamValidationIssue } from "@openfairygui/core/uam";
2
+
3
+ //#region src/uam-transaction.d.ts
4
+ interface ApplyUamTransactionAppInput {
5
+ project: UamProject;
6
+ operations: UamTransactionOperation[];
7
+ }
8
+ interface ApplyUamTransactionAppError {
9
+ code: UamTransactionErrorCode;
10
+ stage: 'preflight' | 'execution' | 'postflight';
11
+ message: string;
12
+ opIndex?: number;
13
+ opId?: string;
14
+ opKind?: UamTransactionOperation['kind'];
15
+ operationKind?: UamTransactionOperation['kind'];
16
+ selector?: Record<string, unknown>;
17
+ issues?: UamValidationIssue[] | UamTransactionSupportIssue[];
18
+ diagnostics: ApplyUamTransactionAppDiagnostic[];
19
+ }
20
+ type ApplyUamTransactionAppResult = {
21
+ ok: true;
22
+ project: UamProject;
23
+ } | {
24
+ ok: false;
25
+ error: ApplyUamTransactionAppError;
26
+ };
27
+ interface ApplyUamTransactionAppDiagnostic {
28
+ code: string;
29
+ message: string;
30
+ severity: 'error';
31
+ path?: string;
32
+ nodeKind?: string;
33
+ resourceKind?: string;
34
+ gearKind?: string;
35
+ field?: string;
36
+ operationKind?: UamTransactionOperation['kind'];
37
+ opIndex?: number;
38
+ opId?: string;
39
+ }
40
+ declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
41
+ //#endregion
42
+ export { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp };
@@ -0,0 +1,42 @@
1
+ import { UamProject, UamTransactionErrorCode, UamTransactionOperation, UamTransactionSupportIssue, UamValidationIssue } from "@openfairygui/core/uam";
2
+
3
+ //#region src/uam-transaction.d.ts
4
+ interface ApplyUamTransactionAppInput {
5
+ project: UamProject;
6
+ operations: UamTransactionOperation[];
7
+ }
8
+ interface ApplyUamTransactionAppError {
9
+ code: UamTransactionErrorCode;
10
+ stage: 'preflight' | 'execution' | 'postflight';
11
+ message: string;
12
+ opIndex?: number;
13
+ opId?: string;
14
+ opKind?: UamTransactionOperation['kind'];
15
+ operationKind?: UamTransactionOperation['kind'];
16
+ selector?: Record<string, unknown>;
17
+ issues?: UamValidationIssue[] | UamTransactionSupportIssue[];
18
+ diagnostics: ApplyUamTransactionAppDiagnostic[];
19
+ }
20
+ type ApplyUamTransactionAppResult = {
21
+ ok: true;
22
+ project: UamProject;
23
+ } | {
24
+ ok: false;
25
+ error: ApplyUamTransactionAppError;
26
+ };
27
+ interface ApplyUamTransactionAppDiagnostic {
28
+ code: string;
29
+ message: string;
30
+ severity: 'error';
31
+ path?: string;
32
+ nodeKind?: string;
33
+ resourceKind?: string;
34
+ gearKind?: string;
35
+ field?: string;
36
+ operationKind?: UamTransactionOperation['kind'];
37
+ opIndex?: number;
38
+ opId?: string;
39
+ }
40
+ declare function applyUamTransactionApp(input: ApplyUamTransactionAppInput): ApplyUamTransactionAppResult;
41
+ //#endregion
42
+ export { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp };
@@ -0,0 +1,78 @@
1
+ import { UamTransactionError, applyUamTransaction } from "@openfairygui/core/uam";
2
+ //#region src/uam-transaction.ts
3
+ function mapTransactionErrorStage(error) {
4
+ switch (error.code) {
5
+ case "transaction_unsupported": return "preflight";
6
+ case "invalid_uam": return "preflight";
7
+ case "execution_failure": return error.opIndex === void 0 && error.issues !== void 0 ? "postflight" : "execution";
8
+ case "selector_ambiguity": return error.opIndex === void 0 ? "preflight" : "execution";
9
+ }
10
+ }
11
+ function compactDiagnostic(diagnostic) {
12
+ return Object.fromEntries(Object.entries(diagnostic).filter(([, value]) => value !== void 0));
13
+ }
14
+ function isTransactionSupportIssue(issue) {
15
+ return "code" in issue;
16
+ }
17
+ function mapTransactionDiagnostics(error) {
18
+ if (error.issues?.length) return error.issues.map((issue) => {
19
+ if (isTransactionSupportIssue(issue)) return compactDiagnostic({
20
+ code: issue.code,
21
+ message: issue.message,
22
+ severity: "error",
23
+ path: issue.path,
24
+ nodeKind: issue.nodeKind,
25
+ resourceKind: issue.resourceKind,
26
+ gearKind: issue.gearKind,
27
+ field: issue.field,
28
+ operationKind: issue.operationKind ?? error.opKind,
29
+ opIndex: error.opIndex,
30
+ opId: error.opId
31
+ });
32
+ return compactDiagnostic({
33
+ code: error.code,
34
+ message: issue.message,
35
+ severity: "error",
36
+ path: issue.path,
37
+ operationKind: error.opKind,
38
+ opIndex: error.opIndex,
39
+ opId: error.opId
40
+ });
41
+ });
42
+ return [compactDiagnostic({
43
+ code: error.code,
44
+ message: error.message,
45
+ severity: "error",
46
+ path: error.opIndex === void 0 ? void 0 : `operations[${error.opIndex}]`,
47
+ operationKind: error.opKind,
48
+ opIndex: error.opIndex,
49
+ opId: error.opId
50
+ })];
51
+ }
52
+ function applyUamTransactionApp(input) {
53
+ try {
54
+ return {
55
+ ok: true,
56
+ project: applyUamTransaction(input.project, input.operations)
57
+ };
58
+ } catch (error) {
59
+ if (error instanceof UamTransactionError) return {
60
+ ok: false,
61
+ error: {
62
+ code: error.code,
63
+ stage: mapTransactionErrorStage(error),
64
+ message: error.message,
65
+ opIndex: error.opIndex,
66
+ opId: error.opId,
67
+ opKind: error.opKind,
68
+ operationKind: error.opKind,
69
+ selector: error.selector,
70
+ issues: error.issues,
71
+ diagnostics: mapTransactionDiagnostics(error)
72
+ }
73
+ };
74
+ throw error;
75
+ }
76
+ }
77
+ //#endregion
78
+ export { applyUamTransactionApp };
package/dist/web.cjs ADDED
@@ -0,0 +1,272 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_publish = require("./publish-CtCXsMdj.cjs");
3
+ let _openfairygui_core = require("@openfairygui/core");
4
+ //#region src/adapters/web/publish.ts
5
+ function getBrowserContext(canvas) {
6
+ const context = canvas.getContext("2d");
7
+ if (!context) throw new Error("publishBrowser: a 2D canvas context is unavailable.");
8
+ return context;
9
+ }
10
+ function createBrowserCanvas(width, height) {
11
+ if (typeof OffscreenCanvas !== "undefined") return new OffscreenCanvas(width, height);
12
+ if (typeof globalThis.document === "undefined") throw new Error("publishBrowser: OffscreenCanvas or a DOM canvas is required for atlas PNG generation.");
13
+ const canvas = globalThis.document.createElement("canvas");
14
+ canvas.width = width;
15
+ canvas.height = height;
16
+ return canvas;
17
+ }
18
+ function assertBrowserImageSupport() {
19
+ if (typeof createImageBitmap !== "function") throw new Error("publishBrowser: createImageBitmap is required for atlas PNG generation.");
20
+ if (typeof OffscreenCanvas === "undefined" && typeof globalThis.document === "undefined") throw new Error("publishBrowser: OffscreenCanvas or a DOM canvas is required for atlas PNG generation.");
21
+ }
22
+ function createRaster(width, height, background) {
23
+ const canvas = createBrowserCanvas(width, height);
24
+ const context = getBrowserContext(canvas);
25
+ context.clearRect(0, 0, width, height);
26
+ if (background && background.alpha > 0) {
27
+ context.fillStyle = `rgba(${background.r}, ${background.g}, ${background.b}, ${background.alpha})`;
28
+ context.fillRect(0, 0, width, height);
29
+ }
30
+ return {
31
+ canvas,
32
+ width,
33
+ height
34
+ };
35
+ }
36
+ function imageMimeType(path) {
37
+ if (/\.svg$/iu.test(path)) return "image/svg+xml";
38
+ if (/\.jpe?g$/iu.test(path)) return "image/jpeg";
39
+ if (/\.webp$/iu.test(path)) return "image/webp";
40
+ if (/\.gif$/iu.test(path)) return "image/gif";
41
+ return "image/png";
42
+ }
43
+ function imageMimeTypeFromBytes(bytes) {
44
+ if (bytes[0] === 255 && bytes[1] === 216) return "image/jpeg";
45
+ if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70) return "image/gif";
46
+ if (bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70) return "image/webp";
47
+ return "image/png";
48
+ }
49
+ async function canvasToPng(canvas) {
50
+ let blob;
51
+ if ("convertToBlob" in canvas && typeof canvas.convertToBlob === "function") blob = await canvas.convertToBlob({ type: "image/png" });
52
+ else blob = await new Promise((resolve, reject) => {
53
+ canvas.toBlob((value) => {
54
+ if (value) resolve(value);
55
+ else reject(/* @__PURE__ */ new Error("publishBrowser: canvas PNG encoding failed."));
56
+ }, "image/png");
57
+ });
58
+ return new Uint8Array(await blob.arrayBuffer());
59
+ }
60
+ async function decodeRaster(bytes, mimeType) {
61
+ if (typeof createImageBitmap !== "function") throw new Error("publishBrowser: createImageBitmap is required for atlas PNG generation.");
62
+ const copy = bytes.slice();
63
+ const bitmap = await createImageBitmap(new Blob([copy.buffer], { type: mimeType }));
64
+ try {
65
+ const raster = createRaster(bitmap.width, bitmap.height);
66
+ getBrowserContext(raster.canvas).drawImage(bitmap, 0, 0);
67
+ return raster;
68
+ } finally {
69
+ bitmap.close();
70
+ }
71
+ }
72
+ var BrowserImagePipeline = class {
73
+ rawOutput = false;
74
+ constructor(raster, decode, write) {
75
+ this.raster = raster;
76
+ this.decode = decode;
77
+ this.write = write;
78
+ }
79
+ ensureAlpha() {
80
+ return this;
81
+ }
82
+ resize(options) {
83
+ this.raster = this.raster.then((source) => {
84
+ const target = createRaster(options.width, options.height);
85
+ getBrowserContext(target.canvas).drawImage(source.canvas, 0, 0, options.width, options.height);
86
+ return target;
87
+ });
88
+ return this;
89
+ }
90
+ raw() {
91
+ this.rawOutput = true;
92
+ return this;
93
+ }
94
+ extract(options) {
95
+ this.raster = this.raster.then((source) => {
96
+ const target = createRaster(options.width, options.height);
97
+ getBrowserContext(target.canvas).drawImage(source.canvas, options.left, options.top, options.width, options.height, 0, 0, options.width, options.height);
98
+ return target;
99
+ });
100
+ return this;
101
+ }
102
+ png() {
103
+ this.rawOutput = false;
104
+ return this;
105
+ }
106
+ rotate(angle) {
107
+ this.raster = this.raster.then((source) => {
108
+ if (angle % 180 === 0) return source;
109
+ const target = createRaster(source.height, source.width);
110
+ const context = getBrowserContext(target.canvas);
111
+ context.save();
112
+ if (angle === 270 || angle === -90) {
113
+ context.translate(0, source.width);
114
+ context.rotate(-Math.PI / 2);
115
+ } else {
116
+ context.translate(source.height, 0);
117
+ context.rotate(Math.PI / 2);
118
+ }
119
+ context.drawImage(source.canvas, 0, 0);
120
+ context.restore();
121
+ return target;
122
+ });
123
+ return this;
124
+ }
125
+ composite(inputs) {
126
+ this.raster = this.raster.then(async (target) => {
127
+ const context = getBrowserContext(target.canvas);
128
+ for (const input of inputs) {
129
+ const source = await this.decode(input.input);
130
+ context.drawImage(source.canvas, input.left, input.top);
131
+ }
132
+ return target;
133
+ });
134
+ return this;
135
+ }
136
+ async metadata() {
137
+ const raster = await this.raster;
138
+ return {
139
+ width: raster.width,
140
+ height: raster.height,
141
+ channels: 4,
142
+ hasAlpha: true
143
+ };
144
+ }
145
+ async toBuffer(options) {
146
+ const raster = await this.raster;
147
+ if (options?.resolveWithObject) {
148
+ const data = getBrowserContext(raster.canvas).getImageData(0, 0, raster.width, raster.height).data;
149
+ return {
150
+ data: new Uint8Array(data),
151
+ info: {
152
+ width: raster.width,
153
+ height: raster.height,
154
+ channels: 4
155
+ }
156
+ };
157
+ }
158
+ if (this.rawOutput) return new Uint8Array(getBrowserContext(raster.canvas).getImageData(0, 0, raster.width, raster.height).data);
159
+ return canvasToPng(raster.canvas);
160
+ }
161
+ async toFile(path) {
162
+ const raster = await this.raster;
163
+ await this.write(path, await canvasToPng(raster.canvas));
164
+ }
165
+ };
166
+ function createBrowserImageEncoder(sourceFileSystem, outputFileSystem) {
167
+ const decode = (bytes) => decodeRaster(bytes, imageMimeTypeFromBytes(bytes));
168
+ return (input) => {
169
+ return new BrowserImagePipeline(typeof input === "string" ? sourceFileSystem.readFileRaw(input).then((bytes) => decodeRaster(bytes, imageMimeType(input))) : input instanceof Uint8Array ? decode(input) : Promise.resolve(createRaster(input.create.width, input.create.height, input.create.background)), decode, outputFileSystem.writeFileRaw);
170
+ };
171
+ }
172
+ function createTrackingFileSystem(fileSystem, files) {
173
+ return {
174
+ join: (...paths) => fileSystem.join(...paths),
175
+ mkdir: (path) => fileSystem.mkdir(path),
176
+ writeFileRaw: async (path, data) => {
177
+ await fileSystem.writeFileRaw(path, data);
178
+ files.set(path, data.byteLength);
179
+ }
180
+ };
181
+ }
182
+ function createDiagnosticLogger(logger, diagnostics) {
183
+ return {
184
+ debug(message) {
185
+ diagnostics.push({
186
+ level: "debug",
187
+ message
188
+ });
189
+ logger.debug(message);
190
+ },
191
+ info(message) {
192
+ diagnostics.push({
193
+ level: "info",
194
+ message
195
+ });
196
+ logger.info(message);
197
+ },
198
+ warn(message) {
199
+ diagnostics.push({
200
+ level: "warning",
201
+ message
202
+ });
203
+ logger.warn(message);
204
+ },
205
+ error(message) {
206
+ diagnostics.push({
207
+ level: "error",
208
+ message
209
+ });
210
+ logger.error(message);
211
+ }
212
+ };
213
+ }
214
+ function toResult(success, files, diagnostics) {
215
+ return {
216
+ success,
217
+ files: [...files].map(([path, size]) => ({
218
+ path,
219
+ size
220
+ })),
221
+ diagnostics
222
+ };
223
+ }
224
+ /**
225
+ * Publish a loaded FairyGUI project to browser-provided storage.
226
+ *
227
+ * The adapter uses browser Canvas APIs for atlas composition, writes only through
228
+ * the supplied output filesystem, and intentionally skips Node publish plugins.
229
+ */
230
+ async function publishBrowser(options) {
231
+ const files = /* @__PURE__ */ new Map();
232
+ const diagnostics = [];
233
+ const root = options.document.getRoot();
234
+ const previousProjectType = root.getProjectType();
235
+ const previousLogger = options.document.getLogger();
236
+ options.document.setLogger(createDiagnosticLogger(previousLogger, diagnostics));
237
+ try {
238
+ if (options.projectType !== "layabox") throw new Error(`publishBrowser: unsupported project type "${String(options.projectType)}".`);
239
+ assertBrowserImageSupport();
240
+ root.setProjectType(_openfairygui_core.ProjectType.LayaBox);
241
+ const outputFileSystem = createTrackingFileSystem(options.outputFileSystem, files);
242
+ const sourceAssetsPath = options.sourceFileSystem.join(options.document.getProjectDir(), "assets");
243
+ await options.document.transform(require_publish.publish({
244
+ output: options.output,
245
+ compressed: options.compressed,
246
+ fileExtension: "fui",
247
+ packages: options.packages,
248
+ branch: options.branch,
249
+ basePath: sourceAssetsPath,
250
+ encoder: createBrowserImageEncoder(options.sourceFileSystem, outputFileSystem),
251
+ atlas: {
252
+ ...options.atlas,
253
+ readFileRaw: (path) => options.sourceFileSystem.readFileRaw(path)
254
+ },
255
+ fs: outputFileSystem,
256
+ plugins: [],
257
+ codeGeneration: false
258
+ }));
259
+ return toResult(true, files, diagnostics);
260
+ } catch (error) {
261
+ diagnostics.push({
262
+ level: "error",
263
+ message: error instanceof Error ? error.message : String(error)
264
+ });
265
+ return toResult(false, files, diagnostics);
266
+ } finally {
267
+ root.setProjectType(previousProjectType);
268
+ options.document.setLogger(previousLogger);
269
+ }
270
+ }
271
+ //#endregion
272
+ exports.publishBrowser = publishBrowser;
package/dist/web.d.cts ADDED
@@ -0,0 +1,41 @@
1
+ import { d as PublishSourceFileSystem, t as AtlasOptions, u as PublishOutputFileSystem } from "./atlas-CHsu2Y8i.cjs";
2
+ import { Document } from "@openfairygui/core";
3
+
4
+ //#region src/adapters/web/publish.d.ts
5
+ type BrowserPublishProjectType = 'layabox';
6
+ type BrowserPublishAtlasOptions = Pick<AtlasOptions, 'maxSize' | 'fast' | 'allowRotation' | 'padding' | 'powerOfTwo' | 'square' | 'multiPage' | 'trimImage' | 'extractAlpha'>;
7
+ type BrowserPublishSourceFileSystem = PublishSourceFileSystem;
8
+ type BrowserPublishOutputFileSystem = PublishOutputFileSystem;
9
+ interface BrowserPublishOptions {
10
+ document: Document;
11
+ sourceFileSystem: BrowserPublishSourceFileSystem;
12
+ outputFileSystem: BrowserPublishOutputFileSystem;
13
+ projectType: BrowserPublishProjectType;
14
+ output: string;
15
+ compressed?: boolean;
16
+ packages?: string[];
17
+ branch?: string;
18
+ atlas?: BrowserPublishAtlasOptions;
19
+ }
20
+ interface BrowserPublishDiagnostic {
21
+ level: 'debug' | 'info' | 'warning' | 'error';
22
+ message: string;
23
+ }
24
+ interface BrowserPublishedFile {
25
+ path: string;
26
+ size: number;
27
+ }
28
+ interface BrowserPublishResult {
29
+ success: boolean;
30
+ files: BrowserPublishedFile[];
31
+ diagnostics: BrowserPublishDiagnostic[];
32
+ }
33
+ /**
34
+ * Publish a loaded FairyGUI project to browser-provided storage.
35
+ *
36
+ * The adapter uses browser Canvas APIs for atlas composition, writes only through
37
+ * the supplied output filesystem, and intentionally skips Node publish plugins.
38
+ */
39
+ declare function publishBrowser(options: BrowserPublishOptions): Promise<BrowserPublishResult>;
40
+ //#endregion
41
+ export { type BrowserPublishAtlasOptions, type BrowserPublishDiagnostic, type BrowserPublishOptions, type BrowserPublishOutputFileSystem, type BrowserPublishProjectType, type BrowserPublishResult, type BrowserPublishSourceFileSystem, type BrowserPublishedFile, publishBrowser };
package/dist/web.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ import { d as PublishSourceFileSystem, t as AtlasOptions, u as PublishOutputFileSystem } from "./atlas-CDn6TirX.js";
2
+ import { Document } from "@openfairygui/core";
3
+
4
+ //#region src/adapters/web/publish.d.ts
5
+ type BrowserPublishProjectType = 'layabox';
6
+ type BrowserPublishAtlasOptions = Pick<AtlasOptions, 'maxSize' | 'fast' | 'allowRotation' | 'padding' | 'powerOfTwo' | 'square' | 'multiPage' | 'trimImage' | 'extractAlpha'>;
7
+ type BrowserPublishSourceFileSystem = PublishSourceFileSystem;
8
+ type BrowserPublishOutputFileSystem = PublishOutputFileSystem;
9
+ interface BrowserPublishOptions {
10
+ document: Document;
11
+ sourceFileSystem: BrowserPublishSourceFileSystem;
12
+ outputFileSystem: BrowserPublishOutputFileSystem;
13
+ projectType: BrowserPublishProjectType;
14
+ output: string;
15
+ compressed?: boolean;
16
+ packages?: string[];
17
+ branch?: string;
18
+ atlas?: BrowserPublishAtlasOptions;
19
+ }
20
+ interface BrowserPublishDiagnostic {
21
+ level: 'debug' | 'info' | 'warning' | 'error';
22
+ message: string;
23
+ }
24
+ interface BrowserPublishedFile {
25
+ path: string;
26
+ size: number;
27
+ }
28
+ interface BrowserPublishResult {
29
+ success: boolean;
30
+ files: BrowserPublishedFile[];
31
+ diagnostics: BrowserPublishDiagnostic[];
32
+ }
33
+ /**
34
+ * Publish a loaded FairyGUI project to browser-provided storage.
35
+ *
36
+ * The adapter uses browser Canvas APIs for atlas composition, writes only through
37
+ * the supplied output filesystem, and intentionally skips Node publish plugins.
38
+ */
39
+ declare function publishBrowser(options: BrowserPublishOptions): Promise<BrowserPublishResult>;
40
+ //#endregion
41
+ export { type BrowserPublishAtlasOptions, type BrowserPublishDiagnostic, type BrowserPublishOptions, type BrowserPublishOutputFileSystem, type BrowserPublishProjectType, type BrowserPublishResult, type BrowserPublishSourceFileSystem, type BrowserPublishedFile, publishBrowser };