@openfairygui/functions 0.2.1 → 0.2.3

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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_publish = require("./publish-CykUJfVa.cjs");
3
- const require_restore = require("./restore-CEywQUHz.cjs");
2
+ const require_publish = require("./publish-Cl1b5HtO.cjs");
3
+ const require_restore = require("./restore-BXJjaSMN.cjs");
4
4
  const require_uam_transaction = require("./uam-transaction.cjs");
5
5
  //#region src/inspect.ts
6
6
  function mapResource(resource) {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as AtlasRasterInput, c as AtlasRasterResolvedBuffer, d as PublishSourceFileSystem, i as AtlasRasterCompositeInput, l as PublishFileSystem, n as atlas, o as AtlasRasterMetadata, r as AtlasRasterBackend, s as AtlasRasterPipeline, t as AtlasOptions, u as PublishOutputFileSystem } from "./atlas-CHsu2Y8i.cjs";
2
- import { A as ExtrasMap, B as ResolvedPublishOptions, C as MaybePromise, D as CliAtlasSettings, E as PluginModule, F as RootProjectSettings, I as publish, L as PublishOptions, M as HasOptionalSrc, N as HasOptionalUrl, O as CliCodeGenerationSettings, P as PublishDependency, R as ResolvePublishOptionsOverrides, S as LoadedPlugin, T as PluginManifest, V as resolvePublishOptions, _ as encodeText, a as RestoreImageExtractor, b as CodeWriter, c as restore, d as CodegenMember, f as CodegenReferencedComponent, g as decodeText, h as buildCodegenClasses, i as RestoreImageExtractInput, j as HasOptionalFont, k as CliPublishSettings, l as AUTO_GENERATED_CODE_MARK, m as ResolvedPackageCodegenPlan, n as RestoreImageCropInput, o as RestoreOptions, p as PublishCodeGenerationOptions, r as RestoreImageCropper, s as RestoreResult, t as RestoreFileSystem, u as CodegenClass, v as publishCodeGeneration, w as Plugin, x as ICodeWriterConfig, y as resolvePackageCodegenPlan, z as ResolvedPublishAtlasOptions } from "./restore-BeWaJNjR.cjs";
2
+ import { A as ExtrasMap, B as ResolvedPublishOptions, C as MaybePromise, D as CliAtlasSettings, E as PluginModule, F as RootProjectSettings, I as publish, L as PublishOptions, M as HasOptionalSrc, N as HasOptionalUrl, O as CliCodeGenerationSettings, P as PublishDependency, R as ResolvePublishOptionsOverrides, S as LoadedPlugin, T as PluginManifest, V as resolvePublishOptions, _ as encodeText, a as RestoreImageExtractor, b as CodeWriter, c as restore, d as CodegenMember, f as CodegenReferencedComponent, g as decodeText, h as buildCodegenClasses, i as RestoreImageExtractInput, j as HasOptionalFont, k as CliPublishSettings, l as AUTO_GENERATED_CODE_MARK, m as ResolvedPackageCodegenPlan, n as RestoreImageCropInput, o as RestoreOptions, p as PublishCodeGenerationOptions, r as RestoreImageCropper, s as RestoreResult, t as RestoreFileSystem, u as CodegenClass, v as publishCodeGeneration, w as Plugin, x as ICodeWriterConfig, y as resolvePackageCodegenPlan, z as ResolvedPublishAtlasOptions } from "./restore-C8FYrc7J.cjs";
3
3
  import { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp, applyUamTransactionAppAsync } from "./uam-transaction.cjs";
4
4
  import { Document, Transform } from "@openfairygui/core";
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as AtlasRasterInput, c as AtlasRasterResolvedBuffer, d as PublishSourceFileSystem, i as AtlasRasterCompositeInput, l as PublishFileSystem, n as atlas, o as AtlasRasterMetadata, r as AtlasRasterBackend, s as AtlasRasterPipeline, t as AtlasOptions, u as PublishOutputFileSystem } from "./atlas-C6tbl7nn.js";
2
- import { A as ExtrasMap, B as ResolvedPublishOptions, C as MaybePromise, D as CliAtlasSettings, E as PluginModule, F as RootProjectSettings, I as publish, L as PublishOptions, M as HasOptionalSrc, N as HasOptionalUrl, O as CliCodeGenerationSettings, P as PublishDependency, R as ResolvePublishOptionsOverrides, S as LoadedPlugin, T as PluginManifest, V as resolvePublishOptions, _ as encodeText, a as RestoreImageExtractor, b as CodeWriter, c as restore, d as CodegenMember, f as CodegenReferencedComponent, g as decodeText, h as buildCodegenClasses, i as RestoreImageExtractInput, j as HasOptionalFont, k as CliPublishSettings, l as AUTO_GENERATED_CODE_MARK, m as ResolvedPackageCodegenPlan, n as RestoreImageCropInput, o as RestoreOptions, p as PublishCodeGenerationOptions, r as RestoreImageCropper, s as RestoreResult, t as RestoreFileSystem, u as CodegenClass, v as publishCodeGeneration, w as Plugin, x as ICodeWriterConfig, y as resolvePackageCodegenPlan, z as ResolvedPublishAtlasOptions } from "./restore-Dh0-Nvms.js";
2
+ import { A as ExtrasMap, B as ResolvedPublishOptions, C as MaybePromise, D as CliAtlasSettings, E as PluginModule, F as RootProjectSettings, I as publish, L as PublishOptions, M as HasOptionalSrc, N as HasOptionalUrl, O as CliCodeGenerationSettings, P as PublishDependency, R as ResolvePublishOptionsOverrides, S as LoadedPlugin, T as PluginManifest, V as resolvePublishOptions, _ as encodeText, a as RestoreImageExtractor, b as CodeWriter, c as restore, d as CodegenMember, f as CodegenReferencedComponent, g as decodeText, h as buildCodegenClasses, i as RestoreImageExtractInput, j as HasOptionalFont, k as CliPublishSettings, l as AUTO_GENERATED_CODE_MARK, m as ResolvedPackageCodegenPlan, n as RestoreImageCropInput, o as RestoreOptions, p as PublishCodeGenerationOptions, r as RestoreImageCropper, s as RestoreResult, t as RestoreFileSystem, u as CodegenClass, v as publishCodeGeneration, w as Plugin, x as ICodeWriterConfig, y as resolvePackageCodegenPlan, z as ResolvedPublishAtlasOptions } from "./restore-D7RtsnWd.js";
3
3
  import { ApplyUamTransactionAppDiagnostic, ApplyUamTransactionAppError, ApplyUamTransactionAppInput, ApplyUamTransactionAppResult, applyUamTransactionApp, applyUamTransactionAppAsync } from "./uam-transaction.js";
4
4
  import { Document, Transform } from "@openfairygui/core";
5
5
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as decodeText, g as createTransform, h as atlas, i as buildCodegenClasses, l as resolvePackageCodegenPlan, n as resolvePublishOptions, o as encodeText, r as AUTO_GENERATED_CODE_MARK, s as publishCodeGeneration, t as publish } from "./publish-DXoaC1Nl.js";
2
- import { t as restore } from "./restore-BQp01WY3.js";
1
+ import { a as decodeText, g as createTransform, h as atlas, i as buildCodegenClasses, l as resolvePackageCodegenPlan, n as resolvePublishOptions, o as encodeText, r as AUTO_GENERATED_CODE_MARK, s as publishCodeGeneration, t as publish } from "./publish-Ni90AtjG.js";
2
+ import { t as restore } from "./restore-teyQ9DXH.js";
3
3
  import { applyUamTransactionApp, applyUamTransactionAppAsync } from "./uam-transaction.js";
4
4
  //#region src/inspect.ts
5
5
  function mapResource(resource) {
package/dist/node.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_publish = require("./publish-CykUJfVa.cjs");
3
- const require_restore = require("./restore-CEywQUHz.cjs");
2
+ const require_publish = require("./publish-Cl1b5HtO.cjs");
3
+ const require_restore = require("./restore-BXJjaSMN.cjs");
4
4
  //#region src/adapters/node/plugins.ts
5
5
  const importNative$2 = new Function("id", "return import(id)");
6
6
  async function loadPlugins(doc, pluginsDir) {
package/dist/node.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as AtlasRasterBackend } from "./atlas-CHsu2Y8i.cjs";
2
- import { L as PublishOptions, S as LoadedPlugin, o as RestoreOptions, s as RestoreResult } from "./restore-BeWaJNjR.cjs";
2
+ import { L as PublishOptions, S as LoadedPlugin, o as RestoreOptions, s as RestoreResult } from "./restore-C8FYrc7J.cjs";
3
3
  import { Document } from "@openfairygui/core";
4
4
 
5
5
  //#region src/adapters/node/publish.d.ts
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as AtlasRasterBackend } from "./atlas-C6tbl7nn.js";
2
- import { L as PublishOptions, S as LoadedPlugin, o as RestoreOptions, s as RestoreResult } from "./restore-Dh0-Nvms.js";
2
+ import { L as PublishOptions, S as LoadedPlugin, o as RestoreOptions, s as RestoreResult } from "./restore-D7RtsnWd.js";
3
3
  import { Document } from "@openfairygui/core";
4
4
 
5
5
  //#region src/adapters/node/publish.d.ts
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- import { m as formatPluginError, t as publish, u as resolveProjectBasePath } from "./publish-DXoaC1Nl.js";
2
- import { t as restore } from "./restore-BQp01WY3.js";
1
+ import { m as formatPluginError, t as publish, u as resolveProjectBasePath } from "./publish-Ni90AtjG.js";
2
+ import { t as restore } from "./restore-teyQ9DXH.js";
3
3
  //#region src/adapters/node/plugins.ts
4
4
  const importNative$2 = new Function("id", "return import(id)");
5
5
  async function loadPlugins(doc, pluginsDir) {
@@ -2897,14 +2897,15 @@ function resolvePublishOptions(doc, overrides = {}) {
2897
2897
  const root = doc.getRoot();
2898
2898
  const publishSettings = (root.getSettings?.() ?? {}).publish ?? {};
2899
2899
  const atlasSetting = publishSettings.atlasSetting ?? {};
2900
- const projectType = root.getProjectType();
2901
- const fileExtension = overrides.fileExtension ?? resolveDefaultPublishFileExtension(projectType, publishSettings);
2900
+ const projectType = overrides.targetProjectType ?? root.getProjectType();
2901
+ const explicitLayaboxTarget = overrides.targetProjectType === _openfairygui_core.ProjectType.LayaBox;
2902
+ const fileExtension = overrides.fileExtension ?? (explicitLayaboxTarget ? "fui" : resolveDefaultPublishFileExtension(projectType, publishSettings));
2902
2903
  let compressed = overrides.compressed ?? publishSettings.compressDesc ?? false;
2903
2904
  if (projectType === UNITY_PROJECT_TYPE) compressed = overrides.compressed ?? false;
2904
2905
  const atlasOptions = {
2905
2906
  maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
2906
2907
  fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
2907
- allowRotation: overrides.atlas?.allowRotation ?? atlasSetting.allowRotation ?? false,
2908
+ allowRotation: overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : atlasSetting.allowRotation ?? false),
2908
2909
  padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
2909
2910
  powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === "pot",
2910
2911
  square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,
@@ -2897,14 +2897,15 @@ function resolvePublishOptions(doc, overrides = {}) {
2897
2897
  const root = doc.getRoot();
2898
2898
  const publishSettings = (root.getSettings?.() ?? {}).publish ?? {};
2899
2899
  const atlasSetting = publishSettings.atlasSetting ?? {};
2900
- const projectType = root.getProjectType();
2901
- const fileExtension = overrides.fileExtension ?? resolveDefaultPublishFileExtension(projectType, publishSettings);
2900
+ const projectType = overrides.targetProjectType ?? root.getProjectType();
2901
+ const explicitLayaboxTarget = overrides.targetProjectType === ProjectType.LayaBox;
2902
+ const fileExtension = overrides.fileExtension ?? (explicitLayaboxTarget ? "fui" : resolveDefaultPublishFileExtension(projectType, publishSettings));
2902
2903
  let compressed = overrides.compressed ?? publishSettings.compressDesc ?? false;
2903
2904
  if (projectType === UNITY_PROJECT_TYPE) compressed = overrides.compressed ?? false;
2904
2905
  const atlasOptions = {
2905
2906
  maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
2906
2907
  fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
2907
- allowRotation: overrides.atlas?.allowRotation ?? atlasSetting.allowRotation ?? false,
2908
+ allowRotation: overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : atlasSetting.allowRotation ?? false),
2908
2909
  padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
2909
2910
  powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === "pot",
2910
2911
  square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,
@@ -1,4 +1,4 @@
1
- const require_publish = require("./publish-CykUJfVa.cjs");
1
+ const require_publish = require("./publish-Cl1b5HtO.cjs");
2
2
  let _openfairygui_core = require("@openfairygui/core");
3
3
  //#region src/restore-internals/output-transaction.ts
4
4
  function isPathWithin(root, candidate) {
@@ -61,6 +61,8 @@ interface PublishOptions {
61
61
  }
62
62
  interface ResolvedPublishAtlasOptions extends Pick<AtlasOptions, 'maxSize' | 'fast' | 'allowRotation' | 'padding' | 'powerOfTwo' | 'square' | 'multiPage' | 'trimImage' | 'extractAlpha'> {}
63
63
  interface ResolvePublishOptionsOverrides {
64
+ /** Select a target profile between direct overrides and persisted project settings. */
65
+ targetProjectType?: number;
64
66
  compressed?: boolean;
65
67
  fileExtension?: string;
66
68
  packages?: string[];
@@ -61,6 +61,8 @@ interface PublishOptions {
61
61
  }
62
62
  interface ResolvedPublishAtlasOptions extends Pick<AtlasOptions, 'maxSize' | 'fast' | 'allowRotation' | 'padding' | 'powerOfTwo' | 'square' | 'multiPage' | 'trimImage' | 'extractAlpha'> {}
63
63
  interface ResolvePublishOptionsOverrides {
64
+ /** Select a target profile between direct overrides and persisted project settings. */
65
+ targetProjectType?: number;
64
66
  compressed?: boolean;
65
67
  fileExtension?: string;
66
68
  packages?: string[];
@@ -1,4 +1,4 @@
1
- import { d as basename, f as normalizeComparablePath, p as trimTrailingSlashes } from "./publish-DXoaC1Nl.js";
1
+ import { d as basename, f as normalizeComparablePath, p as trimTrailingSlashes } from "./publish-Ni90AtjG.js";
2
2
  import { BinaryReader, ProjectType, ProjectWriter, generateId } from "@openfairygui/core";
3
3
  //#region src/restore-internals/output-transaction.ts
4
4
  function isPathWithin(root, candidate) {
package/dist/web.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_publish = require("./publish-CykUJfVa.cjs");
2
+ const require_publish = require("./publish-Cl1b5HtO.cjs");
3
3
  let _openfairygui_core = require("@openfairygui/core");
4
4
  let fast_xml_parser = require("fast-xml-parser");
5
5
  //#region src/adapters/web/raster.ts
package/dist/web.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as resolveCodeGenerationSettings, n as resolvePublishOptions, t as publish } from "./publish-DXoaC1Nl.js";
1
+ import { c as resolveCodeGenerationSettings, n as resolvePublishOptions, t as publish } from "./publish-Ni90AtjG.js";
2
2
  import { ProjectType } from "@openfairygui/core";
3
3
  import { XMLParser, XMLValidator } from "fast-xml-parser";
4
4
  //#region src/adapters/web/raster.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/functions",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "FairyGUI Headless Authoring SDK — composable transform functions.",
5
5
  "author": "OpenFairyGUI Contributors",
6
6
  "license": "MIT",
@@ -75,7 +75,7 @@
75
75
  "dependencies": {
76
76
  "fast-xml-parser": "^5.0.0",
77
77
  "jiti": "^2.6.1",
78
- "@openfairygui/core": "0.2.1"
78
+ "@openfairygui/core": "0.2.3"
79
79
  },
80
80
  "optionalDependencies": {
81
81
  "sharp": ">=0.33.0"
@@ -1,8 +1,8 @@
1
1
  import { type Document, ProjectType } from '@openfairygui/core';
2
2
  import type { AtlasOptions } from '../atlas.js';
3
3
  import type { LoadedPlugin } from '../plugins/types.js';
4
- import type { AtlasRasterBackend, PublishFileSystem } from './contracts.js';
5
4
  import type { CliPublishSettings, RootProjectSettings } from '../shared-types.js';
5
+ import type { AtlasRasterBackend, PublishFileSystem } from './contracts.js';
6
6
 
7
7
  export interface PublishOptions {
8
8
  /**
@@ -87,6 +87,8 @@ export interface ResolvedPublishAtlasOptions
87
87
  > {}
88
88
 
89
89
  export interface ResolvePublishOptionsOverrides {
90
+ /** Select a target profile between direct overrides and persisted project settings. */
91
+ targetProjectType?: number;
90
92
  compressed?: boolean;
91
93
  fileExtension?: string;
92
94
  packages?: string[];
@@ -150,9 +152,12 @@ export function resolvePublishOptions(
150
152
  const settings = (root.getSettings?.() ?? {}) as RootProjectSettings;
151
153
  const publishSettings: CliPublishSettings = settings.publish ?? {};
152
154
  const atlasSetting = publishSettings.atlasSetting ?? {};
153
- const projectType = root.getProjectType();
155
+ const projectType = overrides.targetProjectType ?? root.getProjectType();
156
+ const explicitLayaboxTarget = overrides.targetProjectType === ProjectType.LayaBox;
154
157
 
155
- const fileExtension = overrides.fileExtension ?? resolveDefaultPublishFileExtension(projectType, publishSettings);
158
+ const fileExtension =
159
+ overrides.fileExtension ??
160
+ (explicitLayaboxTarget ? 'fui' : resolveDefaultPublishFileExtension(projectType, publishSettings));
156
161
 
157
162
  let compressed = overrides.compressed ?? publishSettings.compressDesc ?? false;
158
163
  if (projectType === UNITY_PROJECT_TYPE) {
@@ -162,7 +167,8 @@ export function resolvePublishOptions(
162
167
  const atlasOptions: ResolvedPublishAtlasOptions = {
163
168
  maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
164
169
  fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
165
- allowRotation: overrides.atlas?.allowRotation ?? atlasSetting.allowRotation ?? false,
170
+ allowRotation:
171
+ overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : (atlasSetting.allowRotation ?? false)),
166
172
  padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
167
173
  powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === 'pot',
168
174
  square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,