@openfairygui/cli 0.2.0-alpha.23 → 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 +38 -1
  2. package/package.json +4 -4
package/dist/cli.mjs CHANGED
@@ -2252,6 +2252,7 @@ var Component = class extends ExtensibleProperty {
2252
2252
  changeOnClick: true,
2253
2253
  fixedGripSize: false,
2254
2254
  opaque: true,
2255
+ customProperties: [],
2255
2256
  childrenRenderOrder: ChildrenRenderOrder.Ascent,
2256
2257
  apexIndex: 0,
2257
2258
  relations: [],
@@ -2639,6 +2640,12 @@ var Component = class extends ExtensibleProperty {
2639
2640
  setOpaque(v) {
2640
2641
  return this.set("opaque", v);
2641
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
+ }
2642
2649
  getChildrenRenderOrder() {
2643
2650
  return this.get("childrenRenderOrder");
2644
2651
  }
@@ -10068,6 +10075,11 @@ const RELATION_ATTRS = {
10068
10075
  target: { canonical: "target" },
10069
10076
  sidePair: { canonical: "sidePair" }
10070
10077
  };
10078
+ const CUSTOM_PROPERTY_ATTRS = {
10079
+ target: { canonical: "target" },
10080
+ propertyId: { canonical: "propertyId" },
10081
+ label: { canonical: "label" }
10082
+ };
10071
10083
  const GEAR_ATTRS = {
10072
10084
  controller: { canonical: "controller" },
10073
10085
  pages: { canonical: "pages" },
@@ -10156,6 +10168,7 @@ const PROGRESSBAR_EXTENSION_NODE = defineNode(PROGRESSBAR_EXTENSION_ATTRS);
10156
10168
  const SLIDER_EXTENSION_NODE = defineNode(SLIDER_EXTENSION_ATTRS);
10157
10169
  const SCROLLBAR_EXTENSION_NODE = defineNode(SCROLLBAR_EXTENSION_ATTRS);
10158
10170
  const RELATION_NODE = defineNode(RELATION_ATTRS);
10171
+ const CUSTOM_PROPERTY_NODE = defineNode(CUSTOM_PROPERTY_ATTRS);
10159
10172
  const GEAR_NODE = defineNode(GEAR_ATTRS);
10160
10173
  const CONTROLLER_ACTION_NODE = defineNode(CONTROLLER_ACTION_ATTRS);
10161
10174
  const TRANSITION_ITEM_NODE = defineNode(TRANSITION_ITEM_ATTRS);
@@ -10246,7 +10259,8 @@ const PROJECT_XML_PROTOCOL = {
10246
10259
  movieClip: MOVIE_CLIP_NODE,
10247
10260
  componentRoot: defineNode(mergeAttrs(ROOT_COMPONENT_PANEL_ATTRS, ROOT_DESIGN_PANEL_ATTRS, ROOT_MISC_PANEL_ATTRS), mergeChildren({
10248
10261
  controller: CONTROLLER_NODE,
10249
- transition: TRANSITION_NODE
10262
+ transition: TRANSITION_NODE,
10263
+ customProperty: CUSTOM_PROPERTY_NODE
10250
10264
  }, WITH_ROOT_EXTENSION_CHILDREN), mergeContainers({ displayList: DISPLAY_LIST_CONTAINER$2 })),
10251
10265
  componentInstance: COMPONENT_INSTANCE_NODE,
10252
10266
  buttonExtension: BUTTON_EXTENSION_NODE,
@@ -11884,6 +11898,19 @@ function readComponentXml(ctx, comp, xmlContent) {
11884
11898
  }
11885
11899
  }
11886
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
+ }));
11887
11914
  const localControllers = /* @__PURE__ */ new Map();
11888
11915
  const controllers = ensureArray(compNode.controller);
11889
11916
  for (const ctrlDef of controllers) {
@@ -13647,6 +13674,16 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
13647
13674
  const transitionChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "transition");
13648
13675
  if (transitionChildName) compNode[transitionChildName] = transitions.map((t) => serializeTransition(t));
13649
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
+ });
13650
13687
  if (extType) {
13651
13688
  const extSpecs = EXTENSION_PROTOCOL_MAP[extType].attrs;
13652
13689
  const extAttrs = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/cli",
3
- "version": "0.2.0-alpha.23",
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/core": "0.2.0-alpha.23",
37
- "@openfairygui/functions": "0.2.0-alpha.23"
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.23"
42
+ "@openfairygui/backend": "0.2.0-alpha.24"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "sharp": ">=0.33.0"