@openfairygui/functions 0.2.0-alpha.13 → 0.2.0-alpha.14

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 CHANGED
@@ -50,9 +50,9 @@ Publish plugins are documented in the repository guide:
50
50
 
51
51
  - https://github.com/OpenFairyGUI/OpenFairyGUI/blob/main/docs/publish-plugins.md
52
52
 
53
- ## Phase A UAM authoring seam
53
+ ## UAM authoring seam
54
54
 
55
- `@openfairygui/functions` also exposes a thin stateless wrapper over the Phase A UAM
55
+ `@openfairygui/functions` also exposes a thin stateless wrapper over the UAM
56
56
  transaction contract from `@openfairygui/core`.
57
57
 
58
58
  This seam:
@@ -63,6 +63,14 @@ This seam:
63
63
  - does not define a second selector / operation grammar
64
64
  - does not wrap `publish` or `restore`
65
65
 
66
+ The transaction surface includes resource rename/move, byte-backed binary resource
67
+ add/replace/remove, and add/update/remove for `display`, `display2`, `look`, `xy`,
68
+ `size`, `color`, `animation`, `text`, `icon`, and `fontSize` gears. Resource
69
+ rename/move/replace/remove requires `sourceBytes`; opt in with
70
+ `ProjectReader.read(path, { hydrateResourceBytes: true })` before lifting a project to
71
+ UAM. Source bytes are written back with the project, and stale source files are removed
72
+ only after all replacement content succeeds.
73
+
66
74
  ```ts
67
75
  import {
68
76
  type UamProject,
@@ -70,7 +78,7 @@ import {
70
78
  } from '@openfairygui/core';
71
79
  import { applyUamTransactionApp } from '@openfairygui/functions';
72
80
 
73
- const project: UamProject = /* ... */;
81
+ const project: UamProject = /* project read and lifted with hydrateResourceBytes */;
74
82
  const operations: UamTransactionOperation[] = [
75
83
  {
76
84
  kind: 'renameResource',
package/dist/node.cjs CHANGED
@@ -89,8 +89,8 @@ async function resolveNodeAssetsPath(document, assetsPath) {
89
89
  }
90
90
  async function loadSharpBackend() {
91
91
  try {
92
- const sharp = await importNative("sharp");
93
- return sharp.default ?? sharp;
92
+ const loaded = await importNative("sharp");
93
+ return loaded.default ?? loaded;
94
94
  } catch {
95
95
  return;
96
96
  }
package/dist/node.js CHANGED
@@ -88,8 +88,8 @@ async function resolveNodeAssetsPath(document, assetsPath) {
88
88
  }
89
89
  async function loadSharpBackend() {
90
90
  try {
91
- const sharp = await importNative("sharp");
92
- return sharp.default ?? sharp;
91
+ const loaded = await importNative("sharp");
92
+ return loaded.default ?? loaded;
93
93
  } catch {
94
94
  return;
95
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/functions",
3
- "version": "0.2.0-alpha.13",
3
+ "version": "0.2.0-alpha.14",
4
4
  "description": "FairyGUI Headless Authoring SDK — composable transform functions.",
5
5
  "author": "OpenFairyGUI Contributors",
6
6
  "license": "MIT",
@@ -74,7 +74,7 @@
74
74
  ],
75
75
  "dependencies": {
76
76
  "jiti": "^2.6.1",
77
- "@openfairygui/core": "0.2.0-alpha.13"
77
+ "@openfairygui/core": "0.2.0-alpha.14"
78
78
  },
79
79
  "devDependencies": {
80
80
  "ava": "^7.0.0",
@@ -68,8 +68,9 @@ async function resolveNodeAssetsPath(document: Document, assetsPath: string | un
68
68
 
69
69
  async function loadSharpBackend(): Promise<AtlasRasterBackend | undefined> {
70
70
  try {
71
- const sharp = await importNative<typeof import('sharp')>('sharp');
72
- return (sharp.default ?? sharp) as unknown as AtlasRasterBackend;
71
+ const loaded = await importNative<typeof import('sharp')>('sharp');
72
+ const sharp = loaded as unknown as { default?: AtlasRasterBackend };
73
+ return sharp.default ?? (loaded as unknown as AtlasRasterBackend);
73
74
  } catch {
74
75
  return undefined;
75
76
  }
@@ -63,6 +63,7 @@ type BrowserCanvas = OffscreenCanvas | HTMLCanvasElement;
63
63
  interface BrowserContext {
64
64
  clearRect(x: number, y: number, width: number, height: number): void;
65
65
  drawImage(image: CanvasImageSource, dx: number, dy: number): void;
66
+ drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void;
66
67
  drawImage(
67
68
  image: CanvasImageSource,
68
69
  sx: number,