@openfairygui/cli 0.2.0-alpha.22 → 0.2.0-alpha.24

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +101 -2
  2. package/package.json +4 -4
package/dist/cli.mjs CHANGED
@@ -1434,6 +1434,7 @@ var ImageResource = class extends ExtensibleProperty {
1434
1434
  width: 0,
1435
1435
  height: 0,
1436
1436
  exported: false,
1437
+ favorite: false,
1437
1438
  textureSetMode: "",
1438
1439
  qualityOption: "",
1439
1440
  smoothing: true,
@@ -1501,6 +1502,12 @@ var ImageResource = class extends ExtensibleProperty {
1501
1502
  setExported(v) {
1502
1503
  return this.set("exported", v);
1503
1504
  }
1505
+ getFavorite() {
1506
+ return this.get("favorite");
1507
+ }
1508
+ setFavorite(v) {
1509
+ return this.set("favorite", v);
1510
+ }
1504
1511
  getTextureSetMode() {
1505
1512
  return this.get("textureSetMode");
1506
1513
  }
@@ -1596,6 +1603,7 @@ var MiscResource = class extends ExtensibleProperty {
1596
1603
  branchItemIds: [],
1597
1604
  file: "",
1598
1605
  exported: false,
1606
+ favorite: false,
1599
1607
  resourceData: null
1600
1608
  });
1601
1609
  }
@@ -1635,6 +1643,12 @@ var MiscResource = class extends ExtensibleProperty {
1635
1643
  setExported(v) {
1636
1644
  return this.set("exported", v);
1637
1645
  }
1646
+ getFavorite() {
1647
+ return this.get("favorite");
1648
+ }
1649
+ setFavorite(v) {
1650
+ return this.set("favorite", v);
1651
+ }
1638
1652
  getResourceData() {
1639
1653
  return this.getRef("resourceData");
1640
1654
  }
@@ -1667,6 +1681,7 @@ var SoundResource = class extends ExtensibleProperty {
1667
1681
  branchItemIds: [],
1668
1682
  file: "",
1669
1683
  exported: false,
1684
+ favorite: false,
1670
1685
  soundData: null
1671
1686
  });
1672
1687
  }
@@ -1706,6 +1721,12 @@ var SoundResource = class extends ExtensibleProperty {
1706
1721
  setExported(v) {
1707
1722
  return this.set("exported", v);
1708
1723
  }
1724
+ getFavorite() {
1725
+ return this.get("favorite");
1726
+ }
1727
+ setFavorite(v) {
1728
+ return this.set("favorite", v);
1729
+ }
1709
1730
  getSoundData() {
1710
1731
  return this.getRef("soundData");
1711
1732
  }
@@ -1739,6 +1760,7 @@ var FontResource = class extends ExtensibleProperty {
1739
1760
  fileName: "",
1740
1761
  textureId: "",
1741
1762
  exported: false,
1763
+ favorite: false,
1742
1764
  renderMode: "",
1743
1765
  samplePointSize: 0,
1744
1766
  ttf: false,
@@ -1794,6 +1816,12 @@ var FontResource = class extends ExtensibleProperty {
1794
1816
  setExported(v) {
1795
1817
  return this.set("exported", v);
1796
1818
  }
1819
+ getFavorite() {
1820
+ return this.get("favorite");
1821
+ }
1822
+ setFavorite(v) {
1823
+ return this.set("favorite", v);
1824
+ }
1797
1825
  getRenderMode() {
1798
1826
  return this.get("renderMode");
1799
1827
  }
@@ -1884,6 +1912,7 @@ var MovieClipResource = class extends ExtensibleProperty {
1884
1912
  highResolutionItemIds: [],
1885
1913
  fileName: "",
1886
1914
  exported: false,
1915
+ favorite: false,
1887
1916
  textureSetMode: "",
1888
1917
  width: 0,
1889
1918
  height: 0,
@@ -1937,6 +1966,12 @@ var MovieClipResource = class extends ExtensibleProperty {
1937
1966
  setExported(v) {
1938
1967
  return this.set("exported", v);
1939
1968
  }
1969
+ getFavorite() {
1970
+ return this.get("favorite");
1971
+ }
1972
+ setFavorite(v) {
1973
+ return this.set("favorite", v);
1974
+ }
1940
1975
  getTextureSetMode() {
1941
1976
  return this.get("textureSetMode");
1942
1977
  }
@@ -2011,6 +2046,7 @@ var SkeletonResourceBase = class extends ExtensibleProperty {
2011
2046
  branchItemIds: [],
2012
2047
  file: "",
2013
2048
  exported: false,
2049
+ favorite: false,
2014
2050
  width: 0,
2015
2051
  height: 0,
2016
2052
  requireIds: [],
@@ -2056,6 +2092,12 @@ var SkeletonResourceBase = class extends ExtensibleProperty {
2056
2092
  setExported(v) {
2057
2093
  return this.set("exported", v);
2058
2094
  }
2095
+ getFavorite() {
2096
+ return this.get("favorite");
2097
+ }
2098
+ setFavorite(v) {
2099
+ return this.set("favorite", v);
2100
+ }
2059
2101
  getWidth() {
2060
2102
  return this.get("width");
2061
2103
  }
@@ -2148,6 +2190,7 @@ var Component = class extends ExtensibleProperty {
2148
2190
  branch: "",
2149
2191
  branchItemIds: [],
2150
2192
  exported: false,
2193
+ favorite: false,
2151
2194
  width: 0,
2152
2195
  height: 0,
2153
2196
  minWidth: 0,
@@ -2209,6 +2252,7 @@ var Component = class extends ExtensibleProperty {
2209
2252
  changeOnClick: true,
2210
2253
  fixedGripSize: false,
2211
2254
  opaque: true,
2255
+ customProperties: [],
2212
2256
  childrenRenderOrder: ChildrenRenderOrder.Ascent,
2213
2257
  apexIndex: 0,
2214
2258
  relations: [],
@@ -2247,6 +2291,12 @@ var Component = class extends ExtensibleProperty {
2247
2291
  setExported(v) {
2248
2292
  return this.set("exported", v);
2249
2293
  }
2294
+ getFavorite() {
2295
+ return this.get("favorite");
2296
+ }
2297
+ setFavorite(v) {
2298
+ return this.set("favorite", v);
2299
+ }
2250
2300
  getWidth() {
2251
2301
  return this.get("width");
2252
2302
  }
@@ -2590,6 +2640,12 @@ var Component = class extends ExtensibleProperty {
2590
2640
  setOpaque(v) {
2591
2641
  return this.set("opaque", v);
2592
2642
  }
2643
+ getCustomProperties() {
2644
+ return this.get("customProperties").map((property) => ({ ...property }));
2645
+ }
2646
+ setCustomProperties(properties) {
2647
+ return this.set("customProperties", properties.map((property) => ({ ...property })));
2648
+ }
2593
2649
  getChildrenRenderOrder() {
2594
2650
  return this.get("childrenRenderOrder");
2595
2651
  }
@@ -9695,6 +9751,7 @@ const defineNode = (attrs, children, containers) => ({
9695
9751
  });
9696
9752
  const PACKAGE_DESCRIPTION_ATTRS = {
9697
9753
  id: { canonical: "id" },
9754
+ hasFavorites: { canonical: "hasFavorites" },
9698
9755
  compressPNG: { canonical: "compressPNG" },
9699
9756
  jpegQuality: { canonical: "jpegQuality" }
9700
9757
  };
@@ -9715,7 +9772,8 @@ const PACKAGE_RESOURCE_BASE_ATTRS = {
9715
9772
  id: { canonical: "id" },
9716
9773
  name: { canonical: "name" },
9717
9774
  path: { canonical: "path" },
9718
- exported: { canonical: "exported" }
9775
+ exported: { canonical: "exported" },
9776
+ favorite: { canonical: "favorite" }
9719
9777
  };
9720
9778
  const PACKAGE_IMAGE_RESOURCE_ATTRS = {
9721
9779
  atlas: { canonical: "atlas" },
@@ -10017,6 +10075,11 @@ const RELATION_ATTRS = {
10017
10075
  target: { canonical: "target" },
10018
10076
  sidePair: { canonical: "sidePair" }
10019
10077
  };
10078
+ const CUSTOM_PROPERTY_ATTRS = {
10079
+ target: { canonical: "target" },
10080
+ propertyId: { canonical: "propertyId" },
10081
+ label: { canonical: "label" }
10082
+ };
10020
10083
  const GEAR_ATTRS = {
10021
10084
  controller: { canonical: "controller" },
10022
10085
  pages: { canonical: "pages" },
@@ -10105,6 +10168,7 @@ const PROGRESSBAR_EXTENSION_NODE = defineNode(PROGRESSBAR_EXTENSION_ATTRS);
10105
10168
  const SLIDER_EXTENSION_NODE = defineNode(SLIDER_EXTENSION_ATTRS);
10106
10169
  const SCROLLBAR_EXTENSION_NODE = defineNode(SCROLLBAR_EXTENSION_ATTRS);
10107
10170
  const RELATION_NODE = defineNode(RELATION_ATTRS);
10171
+ const CUSTOM_PROPERTY_NODE = defineNode(CUSTOM_PROPERTY_ATTRS);
10108
10172
  const GEAR_NODE = defineNode(GEAR_ATTRS);
10109
10173
  const CONTROLLER_ACTION_NODE = defineNode(CONTROLLER_ACTION_ATTRS);
10110
10174
  const TRANSITION_ITEM_NODE = defineNode(TRANSITION_ITEM_ATTRS);
@@ -10195,7 +10259,8 @@ const PROJECT_XML_PROTOCOL = {
10195
10259
  movieClip: MOVIE_CLIP_NODE,
10196
10260
  componentRoot: defineNode(mergeAttrs(ROOT_COMPONENT_PANEL_ATTRS, ROOT_DESIGN_PANEL_ATTRS, ROOT_MISC_PANEL_ATTRS), mergeChildren({
10197
10261
  controller: CONTROLLER_NODE,
10198
- transition: TRANSITION_NODE
10262
+ transition: TRANSITION_NODE,
10263
+ customProperty: CUSTOM_PROPERTY_NODE
10199
10264
  }, WITH_ROOT_EXTENSION_CHILDREN), mergeContainers({ displayList: DISPLAY_LIST_CONTAINER$2 })),
10200
10265
  componentInstance: COMPONENT_INSTANCE_NODE,
10201
10266
  buttonExtension: BUTTON_EXTENSION_NODE,
@@ -11833,6 +11898,19 @@ function readComponentXml(ctx, comp, xmlContent) {
11833
11898
  }
11834
11899
  }
11835
11900
  }
11901
+ const customPropertyChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
11902
+ const customProperties = customPropertyChildName ? ensureArray(compNode[customPropertyChildName]) : [];
11903
+ const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children?.customProperty;
11904
+ comp.setCustomProperties(customProperties.flatMap((value) => {
11905
+ const property = getXmlNode$1(value);
11906
+ const propertyId = property ? parseInt2(readXmlAttr(property, customPropertyProtocol?.attrs.propertyId), -1) : -1;
11907
+ if (!property || propertyId !== 0 && propertyId !== 1) return [];
11908
+ return [{
11909
+ target: readXmlAttr(property, customPropertyProtocol?.attrs.target) ?? "",
11910
+ propertyId,
11911
+ label: readXmlAttr(property, customPropertyProtocol?.attrs.label) ?? ""
11912
+ }];
11913
+ }));
11836
11914
  const localControllers = /* @__PURE__ */ new Map();
11837
11915
  const controllers = ensureArray(compNode.controller);
11838
11916
  for (const ctrlDef of controllers) {
@@ -12297,6 +12375,7 @@ var ProjectReader = class {
12297
12375
  const name = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.name) ?? "";
12298
12376
  const path = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.path) ?? "/";
12299
12377
  const exported = parseBool(readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.exported));
12378
+ const favorite = parseBool(readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.favorite));
12300
12379
  switch (tagName) {
12301
12380
  case "image": {
12302
12381
  const res = doc.createImageResource(name.replace(/\.\w+$/, ""));
@@ -12304,6 +12383,7 @@ var ProjectReader = class {
12304
12383
  res.setPath(path);
12305
12384
  res.setBranch(branchName);
12306
12385
  res.setExported(exported);
12386
+ res.setFavorite(favorite);
12307
12387
  res.setFileName(name);
12308
12388
  const textureSetMode = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageImageResource.attrs.atlas);
12309
12389
  if (textureSetMode !== void 0) res.setTextureSetMode(textureSetMode);
@@ -12333,6 +12413,7 @@ var ProjectReader = class {
12333
12413
  res.setPath(path);
12334
12414
  res.setBranch(branchName);
12335
12415
  res.setExported(exported);
12416
+ res.setFavorite(favorite);
12336
12417
  const filePath = fs.join(packageDir, path.replace(/^\//, ""), name);
12337
12418
  res.setExtras({
12338
12419
  ...res.getExtras(),
@@ -12349,6 +12430,7 @@ var ProjectReader = class {
12349
12430
  res.setBranch(branchName);
12350
12431
  res.setFile(name);
12351
12432
  res.setExported(exported);
12433
+ res.setFavorite(favorite);
12352
12434
  pkg.addResource(res);
12353
12435
  ctx.registerResource(pkg.getId(), id, res);
12354
12436
  return res;
@@ -12360,6 +12442,7 @@ var ProjectReader = class {
12360
12442
  res.setBranch(branchName);
12361
12443
  res.setFile(name);
12362
12444
  res.setExported(exported);
12445
+ res.setFavorite(favorite);
12363
12446
  pkg.addResource(res);
12364
12447
  ctx.registerResource(pkg.getId(), id, res);
12365
12448
  return res;
@@ -12371,6 +12454,7 @@ var ProjectReader = class {
12371
12454
  res.setBranch(branchName);
12372
12455
  res.setFileName(name);
12373
12456
  res.setExported(exported);
12457
+ res.setFavorite(favorite);
12374
12458
  const texture = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageFontResource.attrs.texture);
12375
12459
  if (texture) res.setTextureId(texture);
12376
12460
  const renderMode = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageFontResource.attrs.renderMode);
@@ -12388,6 +12472,7 @@ var ProjectReader = class {
12388
12472
  res.setBranch(branchName);
12389
12473
  res.setFile(name);
12390
12474
  res.setExported(exported);
12475
+ res.setFavorite(favorite);
12391
12476
  res.setWidth(parseInt2(readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageSkeletonResource.attrs.width)));
12392
12477
  res.setHeight(parseInt2(readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageSkeletonResource.attrs.height)));
12393
12478
  const requireValue = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageSkeletonResource.attrs.require);
@@ -12410,6 +12495,7 @@ var ProjectReader = class {
12410
12495
  res.setBranch(branchName);
12411
12496
  res.setFile(name);
12412
12497
  res.setExported(exported);
12498
+ res.setFavorite(favorite);
12413
12499
  res.setWidth(parseInt2(readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageSkeletonResource.attrs.width)));
12414
12500
  res.setHeight(parseInt2(readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageSkeletonResource.attrs.height)));
12415
12501
  const requireValue = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageSkeletonResource.attrs.require);
@@ -12432,6 +12518,7 @@ var ProjectReader = class {
12432
12518
  res.setBranch(branchName);
12433
12519
  res.setFileName(name);
12434
12520
  res.setExported(exported);
12521
+ res.setFavorite(favorite);
12435
12522
  const textureSetMode = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageMovieClipResource.attrs.atlas);
12436
12523
  if (textureSetMode !== void 0) res.setTextureSetMode(textureSetMode);
12437
12524
  pkg.addResource(res);
@@ -13587,6 +13674,16 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
13587
13674
  const transitionChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "transition");
13588
13675
  if (transitionChildName) compNode[transitionChildName] = transitions.map((t) => serializeTransition(t));
13589
13676
  }
13677
+ const customProperties = typedComp.getCustomProperties?.() ?? [];
13678
+ const customPropertyChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
13679
+ const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children?.customProperty;
13680
+ if (customProperties.length > 0 && customPropertyChildName) compNode[customPropertyChildName] = customProperties.map((property) => {
13681
+ const attrs = {};
13682
+ writeXmlAttr(attrs, customPropertyProtocol?.attrs.target, property.target);
13683
+ writeXmlAttr(attrs, customPropertyProtocol?.attrs.propertyId, String(property.propertyId));
13684
+ if (property.label) writeXmlAttr(attrs, customPropertyProtocol?.attrs.label, property.label);
13685
+ return attrs;
13686
+ });
13590
13687
  if (extType) {
13591
13688
  const extSpecs = EXTENSION_PROTOCOL_MAP[extType].attrs;
13592
13689
  const extAttrs = {};
@@ -13794,6 +13891,7 @@ var ProjectWriter = class {
13794
13891
  const codePath = pkg.getCodePath();
13795
13892
  const packageDescriptionAttrs = {};
13796
13893
  writeXmlAttr(packageDescriptionAttrs, PROJECT_XML_PROTOCOL.packageDescription.attrs.id, pkg.getId());
13894
+ if (pkg.listResources().some((resource) => resource.getFavorite?.())) writeXmlAttr(packageDescriptionAttrs, PROJECT_XML_PROTOCOL.packageDescription.attrs.hasFavorites, "true");
13797
13895
  const compressPNG = pkg.getCompressPNG();
13798
13896
  if (compressPNG !== null) writeXmlAttr(packageDescriptionAttrs, PROJECT_XML_PROTOCOL.packageDescription.attrs.compressPNG, compressPNG ? "true" : "false");
13799
13897
  const jpegQuality = pkg.getJpegQuality();
@@ -14004,6 +14102,7 @@ var ProjectWriter = class {
14004
14102
  writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.name, this._resourceFileName(res));
14005
14103
  writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.path, typedRes.getPath?.() ?? "/");
14006
14104
  if (typedRes.getExported?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.exported, "true");
14105
+ if (typedRes.getFavorite?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.packageResource.attrs.favorite, "true");
14007
14106
  if (res.propertyType === "ImageResource") {
14008
14107
  const imgRes = res;
14009
14108
  const textureSetMode = imgRes.getTextureSetMode?.() ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/cli",
3
- "version": "0.2.0-alpha.22",
3
+ "version": "0.2.0-alpha.24",
4
4
  "description": "FairyGUI Headless Authoring SDK — command-line interface.",
5
5
  "author": "OpenFairyGUI Contributors",
6
6
  "license": "MIT",
@@ -33,13 +33,13 @@
33
33
  "restore"
34
34
  ],
35
35
  "devDependencies": {
36
- "@openfairygui/functions": "0.2.0-alpha.22",
37
- "@openfairygui/core": "0.2.0-alpha.22"
36
+ "@openfairygui/core": "0.2.0-alpha.24",
37
+ "@openfairygui/functions": "0.2.0-alpha.24"
38
38
  },
39
39
  "dependencies": {
40
40
  "commander": "^14.0.2",
41
41
  "jiti": "^2.7.0",
42
- "@openfairygui/backend": "0.2.0-alpha.22"
42
+ "@openfairygui/backend": "0.2.0-alpha.24"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "sharp": ">=0.33.0"