@openfairygui/cli 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/cli.mjs CHANGED
@@ -864,7 +864,7 @@ var ExtensibleProperty = class extends Property {
864
864
  };
865
865
  //#endregion
866
866
  //#region ../core/src/constants.ts
867
- const VERSION = `v0.2.1`;
867
+ const VERSION = `v0.2.3`;
868
868
  /** Binary package file magic number: "FGUI" as uint32. */
869
869
  const FGUI_MAGIC = 1179080009;
870
870
  /** Null string index in the binary string table. */
@@ -2277,10 +2277,13 @@ var Component = class extends ExtensibleProperty {
2277
2277
  footerRes: "",
2278
2278
  bgColor: "",
2279
2279
  bgColorEnabled: false,
2280
- designImageAlpha: 0,
2280
+ designImageAlpha: 50,
2281
2281
  designImageLayer: 0,
2282
2282
  designImageOffsetX: 0,
2283
2283
  designImageOffsetY: 0,
2284
+ designImage: "",
2285
+ designImageForTest: false,
2286
+ pageController: "",
2284
2287
  idNum: 0,
2285
2288
  initName: "",
2286
2289
  remark: "",
@@ -2570,6 +2573,24 @@ var Component = class extends ExtensibleProperty {
2570
2573
  setDesignImageOffsetY(v) {
2571
2574
  return this.set("designImageOffsetY", v);
2572
2575
  }
2576
+ getDesignImage() {
2577
+ return this.get("designImage");
2578
+ }
2579
+ setDesignImage(v) {
2580
+ return this.set("designImage", v);
2581
+ }
2582
+ getDesignImageForTest() {
2583
+ return this.get("designImageForTest");
2584
+ }
2585
+ setDesignImageForTest(v) {
2586
+ return this.set("designImageForTest", v);
2587
+ }
2588
+ getPageController() {
2589
+ return this.get("pageController");
2590
+ }
2591
+ setPageController(v) {
2592
+ return this.set("pageController", v);
2593
+ }
2573
2594
  getIdNum() {
2574
2595
  return this.get("idNum");
2575
2596
  }
@@ -3585,6 +3606,7 @@ var GTextField = class extends GObject {
3585
3606
  demoText: "",
3586
3607
  templateVarsEnabled: false,
3587
3608
  faceDilate: 0,
3609
+ outlineSoftness: 0,
3588
3610
  underlaySoftness: 0,
3589
3611
  ubbEnabled: false,
3590
3612
  underline: false,
@@ -3805,6 +3827,12 @@ var GTextField = class extends GObject {
3805
3827
  setFaceDilate(v) {
3806
3828
  return this.setTextFieldProp("faceDilate", v);
3807
3829
  }
3830
+ getOutlineSoftness() {
3831
+ return this.getTextFieldProp("outlineSoftness");
3832
+ }
3833
+ setOutlineSoftness(v) {
3834
+ return this.setTextFieldProp("outlineSoftness", v);
3835
+ }
3808
3836
  getUnderlaySoftness() {
3809
3837
  return this.getTextFieldProp("underlaySoftness");
3810
3838
  }
@@ -4937,6 +4965,7 @@ var GComponent = class extends GObject {
4937
4965
  instanceChecked: false,
4938
4966
  instanceSound: "",
4939
4967
  instanceSoundVolumeScale: 1,
4968
+ instancePopupDirection: 0,
4940
4969
  instancePromptText: "",
4941
4970
  instanceSelectionController: "",
4942
4971
  instanceVisibleItemCount: 0,
@@ -5223,6 +5252,12 @@ var GComponent = class extends GObject {
5223
5252
  setInstanceSoundVolumeScale(v) {
5224
5253
  return this.setComponentProp("instanceSoundVolumeScale", v);
5225
5254
  }
5255
+ getInstancePopupDirection() {
5256
+ return this.getComponentProp("instancePopupDirection");
5257
+ }
5258
+ setInstancePopupDirection(v) {
5259
+ return this.setComponentProp("instancePopupDirection", v);
5260
+ }
5226
5261
  getInstancePromptText() {
5227
5262
  return firstString$1(this.getComponentProp("instancePromptText"));
5228
5263
  }
@@ -5324,6 +5359,7 @@ var GListBase = class extends GObject {
5324
5359
  src: "",
5325
5360
  overflow: 0,
5326
5361
  scrollType: 1,
5362
+ scrollBarDisplay: 0,
5327
5363
  scrollBarFlags: 0,
5328
5364
  scrollBarMargin: [
5329
5365
  0,
@@ -5526,6 +5562,12 @@ var GListBase = class extends GObject {
5526
5562
  setScrollType(v) {
5527
5563
  return this.setListProp("scrollType", v);
5528
5564
  }
5565
+ getScrollBarDisplay() {
5566
+ return this.getListProp("scrollBarDisplay");
5567
+ }
5568
+ setScrollBarDisplay(v) {
5569
+ return this.setListProp("scrollBarDisplay", v);
5570
+ }
5529
5571
  getScrollBarFlags() {
5530
5572
  return this.getListProp("scrollBarFlags");
5531
5573
  }
@@ -16384,10 +16426,15 @@ const ROOT_COMPONENT_PANEL_ATTRS = {
16384
16426
  bgColor: { canonical: "bgColor" },
16385
16427
  bgColorEnabled: { canonical: "bgColorEnabled" },
16386
16428
  idnum: { canonical: "idnum" },
16387
- initName: { canonical: "initName" }
16429
+ initName: { canonical: "initName" },
16430
+ pageController: { canonical: "pageController" },
16431
+ showSound: { canonical: "showSound" },
16432
+ hideSound: { canonical: "hideSound" }
16388
16433
  };
16389
16434
  const ROOT_MISC_PANEL_ATTRS = { remark: { canonical: "remark" } };
16390
16435
  const ROOT_DESIGN_PANEL_ATTRS = {
16436
+ designImage: { canonical: "designImage" },
16437
+ designImageForTest: { canonical: "designImageForTest" },
16391
16438
  designImageAlpha: { canonical: "designImageAlpha" },
16392
16439
  designImageLayer: { canonical: "designImageLayer" },
16393
16440
  designImageOffsetX: { canonical: "designImageOffsetX" },
@@ -16486,6 +16533,7 @@ const TEXT_PANEL_ATTRS = {
16486
16533
  autoClearText: { canonical: "autoClearText" },
16487
16534
  demoText: { canonical: "demoText" },
16488
16535
  faceDilate: { canonical: "faceDilate" },
16536
+ outlineSoftness: { canonical: "outlineSoftness" },
16489
16537
  underlaySoftness: { canonical: "underlaySoftness" },
16490
16538
  vars: { canonical: "vars" }
16491
16539
  };
@@ -16501,6 +16549,7 @@ const TEXT_INPUT_PANEL_ATTRS = {
16501
16549
  };
16502
16550
  const RICH_TEXT_PANEL_ATTRS = {
16503
16551
  restrictSize: { canonical: "restrictSize" },
16552
+ outlineSoftness: { canonical: "outlineSoftness" },
16504
16553
  underlaySoftness: { canonical: "underlaySoftness" }
16505
16554
  };
16506
16555
  const GROUP_PANEL_ATTRS = {
@@ -16557,10 +16606,7 @@ const LIST_PANEL_ATTRS = {
16557
16606
  const BUTTON_EXTENSION_ATTRS = {
16558
16607
  mode: { canonical: "mode" },
16559
16608
  sound: { canonical: "sound" },
16560
- soundVolumeScale: {
16561
- canonical: "soundVolumeScale",
16562
- aliases: ["volume"]
16563
- },
16609
+ soundVolumeScale: { canonical: "volume" },
16564
16610
  downEffect: { canonical: "downEffect" },
16565
16611
  downEffectValue: { canonical: "downEffectValue" },
16566
16612
  title: { canonical: "title" },
@@ -16578,12 +16624,18 @@ const LABEL_EXTENSION_ATTRS = {
16578
16624
  icon: { canonical: "icon" },
16579
16625
  titleColor: { canonical: "titleColor" },
16580
16626
  titleFontSize: { canonical: "titleFontSize" },
16581
- prompt: { canonical: "prompt" }
16627
+ prompt: { canonical: "prompt" },
16628
+ sound: { canonical: "sound" },
16629
+ soundVolumeScale: { canonical: "volume" }
16582
16630
  };
16583
16631
  const COMBOBOX_EXTENSION_ATTRS = {
16584
16632
  dropdown: { canonical: "dropdown" },
16585
16633
  title: { canonical: "title" },
16586
16634
  icon: { canonical: "icon" },
16635
+ titleColor: { canonical: "titleColor" },
16636
+ popupDirection: { canonical: "direction" },
16637
+ sound: { canonical: "sound" },
16638
+ soundVolumeScale: { canonical: "volume" },
16587
16639
  visibleItemCount: { canonical: "visibleItemCount" },
16588
16640
  selectionController: { canonical: "selectionController" },
16589
16641
  autoClearItems: { canonical: "autoClearItems" }
@@ -16593,7 +16645,9 @@ const PROGRESSBAR_EXTENSION_ATTRS = {
16593
16645
  reverse: { canonical: "reverse" },
16594
16646
  value: { canonical: "value" },
16595
16647
  max: { canonical: "max" },
16596
- min: { canonical: "min" }
16648
+ min: { canonical: "min" },
16649
+ sound: { canonical: "sound" },
16650
+ soundVolumeScale: { canonical: "volume" }
16597
16651
  };
16598
16652
  const SLIDER_EXTENSION_ATTRS = {
16599
16653
  titleType: { canonical: "titleType" },
@@ -17287,6 +17341,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
17287
17341
  if (textVars !== void 0) g.setTemplateVarsEnabled?.(parseBool(textVars));
17288
17342
  const textFaceDilate = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.faceDilate);
17289
17343
  if (textFaceDilate !== void 0) g.setFaceDilate?.(parseFloat2(textFaceDilate));
17344
+ const textOutlineSoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.outlineSoftness);
17345
+ if (textOutlineSoftness !== void 0) g.setOutlineSoftness?.(parseFloat2(textOutlineSoftness));
17290
17346
  const textUnderlaySoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underlaySoftness);
17291
17347
  if (textUnderlaySoftness !== void 0) g.setUnderlaySoftness?.(parseFloat2(textUnderlaySoftness));
17292
17348
  const textUbb = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.ubb);
@@ -17411,6 +17467,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
17411
17467
  if (richTextSingleLine !== void 0) g.setSingleLine?.(parseBool(richTextSingleLine));
17412
17468
  const richTextAutoClearText = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.autoClearText);
17413
17469
  if (richTextAutoClearText !== void 0) g.setAutoClearText?.(parseBool(richTextAutoClearText));
17470
+ const richTextOutlineSoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.outlineSoftness);
17471
+ if (richTextOutlineSoftness !== void 0) g.setOutlineSoftness?.(parseFloat2(richTextOutlineSoftness));
17414
17472
  const richTextUnderlaySoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.underlaySoftness);
17415
17473
  if (richTextUnderlaySoftness !== void 0) g.setUnderlaySoftness?.(parseFloat2(richTextUnderlaySoftness));
17416
17474
  const richTextUnderline = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underline);
@@ -17520,6 +17578,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
17520
17578
  if (inputVars !== void 0) g.setTemplateVarsEnabled?.(parseBool(inputVars));
17521
17579
  const inputFaceDilate = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.faceDilate);
17522
17580
  if (inputFaceDilate !== void 0) g.setFaceDilate?.(parseFloat2(inputFaceDilate));
17581
+ const inputOutlineSoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.outlineSoftness);
17582
+ if (inputOutlineSoftness !== void 0) g.setOutlineSoftness?.(parseFloat2(inputOutlineSoftness));
17523
17583
  const inputUnderlaySoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underlaySoftness);
17524
17584
  if (inputUnderlaySoftness !== void 0) g.setUnderlaySoftness?.(parseFloat2(inputUnderlaySoftness));
17525
17585
  const inputUbb = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.ubb);
@@ -18068,9 +18128,10 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
18068
18128
  if (selectionController !== void 0) g.setSelectionController?.(selectionController);
18069
18129
  const overflow = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.overflow);
18070
18130
  const scroll = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scroll);
18131
+ const scrollBar = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBar);
18071
18132
  const scrollBarFlags = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarFlags);
18072
18133
  const margin = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.margin);
18073
- if (overflow || scroll || scrollBarFlags !== void 0 || margin) {
18134
+ if (overflow || scroll || scrollBar || scrollBarFlags !== void 0 || margin) {
18074
18135
  if (overflow) g.setOverflow({
18075
18136
  visible: 0,
18076
18137
  hidden: 1,
@@ -18081,6 +18142,12 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
18081
18142
  vertical: 1,
18082
18143
  both: 2
18083
18144
  }[scroll] ?? 1);
18145
+ if (scrollBar) g.setScrollBarDisplay({
18146
+ default: 0,
18147
+ visible: 1,
18148
+ auto: 2,
18149
+ hidden: 3
18150
+ }[scrollBar] ?? 0);
18084
18151
  if (scrollBarFlags !== void 0) g.setScrollBarFlags(parseInt2(scrollBarFlags));
18085
18152
  if (margin) {
18086
18153
  const parts = margin.split(",").map(Number);
@@ -18184,7 +18251,13 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
18184
18251
  const sound = extSpecs.sound ? readXmlAttr(extAttrs, extSpecs.sound) : void 0;
18185
18252
  if (sound !== void 0) componentObj.setInstanceSound?.(sound);
18186
18253
  const soundVolumeScale = extSpecs.soundVolumeScale ? readXmlAttr(extAttrs, extSpecs.soundVolumeScale) : void 0;
18187
- if (soundVolumeScale !== void 0) componentObj.setInstanceSoundVolumeScale?.(parseFloat2(soundVolumeScale, 1));
18254
+ if (soundVolumeScale !== void 0) componentObj.setInstanceSoundVolumeScale?.(parseFloat2(soundVolumeScale, 100) / 100);
18255
+ const popupDirection = extSpecs.popupDirection ? readXmlAttr(extAttrs, extSpecs.popupDirection) : void 0;
18256
+ if (popupDirection !== void 0) componentObj.setInstancePopupDirection?.({
18257
+ auto: 0,
18258
+ up: 1,
18259
+ down: 2
18260
+ }[popupDirection] ?? 0);
18188
18261
  const prompt = extSpecs.prompt ? readXmlAttr(extAttrs, extSpecs.prompt) : void 0;
18189
18262
  if (prompt !== void 0) componentObj.setInstancePromptText?.(prompt);
18190
18263
  const selectionController = extSpecs.selectionController ? readXmlAttr(extAttrs, extSpecs.selectionController) : void 0;
@@ -18464,6 +18537,10 @@ function readComponentXml(ctx, comp, xmlContent) {
18464
18537
  if (bgColor !== void 0) comp.setBgColor?.(bgColor);
18465
18538
  const bgColorEnabled = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColorEnabled);
18466
18539
  if (bgColorEnabled !== void 0) comp.setBgColorEnabled?.(parseBool(bgColorEnabled));
18540
+ const designImage = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImage);
18541
+ if (designImage !== void 0) comp.setDesignImage?.(designImage);
18542
+ const designImageForTest = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageForTest);
18543
+ if (designImageForTest !== void 0) comp.setDesignImageForTest?.(parseBool(designImageForTest));
18467
18544
  const designImageAlpha = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageAlpha);
18468
18545
  if (designImageAlpha !== void 0) comp.setDesignImageAlpha?.(parseInt2(designImageAlpha));
18469
18546
  const designImageLayer = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageLayer);
@@ -18478,6 +18555,12 @@ function readComponentXml(ctx, comp, xmlContent) {
18478
18555
  if (initName !== void 0) comp.setInitName?.(initName);
18479
18556
  const remark = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.remark);
18480
18557
  if (remark !== void 0) comp.setRemark?.(remark);
18558
+ const pageController = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController);
18559
+ if (pageController !== void 0) comp.setPageController?.(pageController);
18560
+ const showSound = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.showSound);
18561
+ if (showSound !== void 0) comp.setAddedToStageSound?.(showSound);
18562
+ const hideSound = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.hideSound);
18563
+ if (hideSound !== void 0) comp.setRemovedFromStageSound?.(hideSound);
18481
18564
  const clipSoftness = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.clipSoftness);
18482
18565
  if (clipSoftness) {
18483
18566
  const parts = clipSoftness.split(",").map(Number);
@@ -18547,7 +18630,7 @@ function readComponentXml(ctx, comp, xmlContent) {
18547
18630
  case "Button":
18548
18631
  if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.mode) !== void 0) comp.setButtonMode?.(parseButtonMode(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.mode)));
18549
18632
  if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.sound) !== void 0) comp.setSound?.(String(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.sound)));
18550
- if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale) !== void 0) comp.setSoundVolumeScale?.(parseFloat2(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale), 1));
18633
+ if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale) !== void 0) comp.setSoundVolumeScale?.(parseFloat2(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale), 100) / 100);
18551
18634
  if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect) !== void 0) comp.setDownEffect?.(parseInt2(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect)));
18552
18635
  if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffectValue) !== void 0) comp.setDownEffectValue?.(parseFloat2(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffectValue), .8));
18553
18636
  break;
@@ -19967,10 +20050,14 @@ function serializeChild(obj) {
19967
20050
  if (typedObj.getTemplateVarsEnabled?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.vars, "true");
19968
20051
  const faceDilate = typedObj.getFaceDilate?.() ?? 0;
19969
20052
  if (faceDilate !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.faceDilate, String(faceDilate));
20053
+ const outlineSoftness = typedObj.getOutlineSoftness?.() ?? 0;
20054
+ if (outlineSoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.outlineSoftness, String(outlineSoftness));
19970
20055
  const underlaySoftness = typedObj.getUnderlaySoftness?.() ?? 0;
19971
20056
  if (underlaySoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underlaySoftness, String(underlaySoftness));
19972
20057
  }
19973
20058
  if (type === "GRichTextField") {
20059
+ const outlineSoftness = typedObj.getOutlineSoftness?.() ?? 0;
20060
+ if (outlineSoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.outlineSoftness, String(outlineSoftness));
19974
20061
  const underlaySoftness = typedObj.getUnderlaySoftness?.() ?? 0;
19975
20062
  if (underlaySoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.underlaySoftness, String(underlaySoftness));
19976
20063
  }
@@ -20140,6 +20227,13 @@ function serializeChild(obj) {
20140
20227
  1: "vertical",
20141
20228
  2: "both"
20142
20229
  }[scrollType] ?? "vertical");
20230
+ const scrollBarDisplay = typedObj.getScrollBarDisplay?.() ?? 0;
20231
+ if (overflow === 2 && scrollBarDisplay !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBar, {
20232
+ 0: "default",
20233
+ 1: "visible",
20234
+ 2: "auto",
20235
+ 3: "hidden"
20236
+ }[scrollBarDisplay] ?? "default");
20143
20237
  const scrollBarFlags = typedObj.getScrollBarFlags?.() ?? 0;
20144
20238
  if (scrollBarFlags !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarFlags, String(scrollBarFlags));
20145
20239
  const scrollBarMargin = typedObj.getScrollBarMargin?.();
@@ -20240,8 +20334,13 @@ function serializeChild(obj) {
20240
20334
  if (typedObj.getInstanceController?.() && extSpecs.controller) writeXmlAttr(extAttrs, extSpecs.controller, typedObj.getInstanceController?.());
20241
20335
  if (typedObj.getInstancePage?.() && extSpecs.page) writeXmlAttr(extAttrs, extSpecs.page, typedObj.getInstancePage?.());
20242
20336
  if (typedObj.getInstanceChecked?.() && extSpecs.checked) writeXmlAttr(extAttrs, extSpecs.checked, "1");
20337
+ const popupDirection = typedObj.getInstancePopupDirection?.() ?? 0;
20338
+ if (popupDirection !== 0 && extSpecs.popupDirection) writeXmlAttr(extAttrs, extSpecs.popupDirection, {
20339
+ 1: "up",
20340
+ 2: "down"
20341
+ }[popupDirection]);
20243
20342
  if (typedObj.getInstanceSound?.() && extSpecs.sound) writeXmlAttr(extAttrs, extSpecs.sound, typedObj.getInstanceSound?.());
20244
- if ((typedObj.getInstanceSoundVolumeScale?.() ?? 1) !== 1 && extSpecs.soundVolumeScale) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, String(typedObj.getInstanceSoundVolumeScale?.() ?? 1));
20343
+ if ((typedObj.getInstanceSoundVolumeScale?.() ?? 1) !== 1 && extSpecs.soundVolumeScale) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, formatProjectInt32(Math.round((typedObj.getInstanceSoundVolumeScale?.() ?? 1) * 100), "component instance volume"));
20245
20344
  if (typedObj.getInstancePromptText?.() && extSpecs.prompt) writeXmlAttr(extAttrs, extSpecs.prompt, typedObj.getInstancePromptText?.());
20246
20345
  if (typedObj.getInstanceSelectionController?.() && extSpecs.selectionController) writeXmlAttr(extAttrs, extSpecs.selectionController, typedObj.getInstanceSelectionController?.());
20247
20346
  if ((typedObj.getInstanceVisibleItemCount?.() ?? 0) > 0 && extSpecs.visibleItemCount) writeXmlAttr(extAttrs, extSpecs.visibleItemCount, String(typedObj.getInstanceVisibleItemCount?.() ?? 0));
@@ -20419,8 +20518,11 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
20419
20518
  if (typedComp.getBgColorEnabled?.()) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColorEnabled, "true");
20420
20519
  const bgColor = typedComp.getBgColor?.();
20421
20520
  if (bgColor) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColor, bgColor);
20422
- const designImageAlpha = typedComp.getDesignImageAlpha?.() ?? 0;
20423
- if (designImageAlpha !== 0) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageAlpha, String(designImageAlpha));
20521
+ const designImage = typedComp.getDesignImage?.();
20522
+ if (designImage) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImage, designImage);
20523
+ if (typedComp.getDesignImageForTest?.()) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageForTest, "true");
20524
+ const designImageAlpha = typedComp.getDesignImageAlpha?.() ?? 50;
20525
+ if (designImageAlpha !== 50) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageAlpha, String(designImageAlpha));
20424
20526
  const designImageLayer = typedComp.getDesignImageLayer?.() ?? 0;
20425
20527
  if (designImageLayer !== 0) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageLayer, String(designImageLayer));
20426
20528
  const designImageOffsetX = typedComp.getDesignImageOffsetX?.() ?? 0;
@@ -20433,6 +20535,12 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
20433
20535
  if (initName) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.initName, initName);
20434
20536
  const remark = typedComp.getRemark?.();
20435
20537
  if (remark) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.remark, remark);
20538
+ const pageController = typedComp.getPageController?.();
20539
+ if (pageController) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController, pageController);
20540
+ const showSound = typedComp.getAddedToStageSound?.();
20541
+ if (showSound) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.showSound, showSound);
20542
+ const hideSound = typedComp.getRemovedFromStageSound?.();
20543
+ if (hideSound) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.hideSound, hideSound);
20436
20544
  const clipSoftness = typedComp.getClipSoftness?.();
20437
20545
  if (clipSoftness && ((clipSoftness.x ?? 0) !== 0 || (clipSoftness.y ?? 0) !== 0)) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.clipSoftness, formatProjectInt32List([clipSoftness.x ?? 0, clipSoftness.y ?? 0], "component clipSoftness"));
20438
20546
  if (typedComp.getOpaque?.() === false) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.opaque, "false");
@@ -20504,7 +20612,7 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
20504
20612
  case "Button": {
20505
20613
  if ((typedComp.getButtonMode?.() ?? 0) !== 0) writeXmlAttr(extAttrs, extSpecs.mode, formatButtonMode(typedComp.getButtonMode?.() ?? 0));
20506
20614
  if (typedComp.getSound?.()) writeXmlAttr(extAttrs, extSpecs.sound, typedComp.getSound?.());
20507
- if ((typedComp.getSoundVolumeScale?.() ?? 1) !== 1) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, String(typedComp.getSoundVolumeScale?.() ?? 1));
20615
+ if ((typedComp.getSoundVolumeScale?.() ?? 1) !== 1) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, String(Math.round((typedComp.getSoundVolumeScale?.() ?? 1) * 100)));
20508
20616
  const downEffect = typedComp.getDownEffect?.() ?? 0;
20509
20617
  if (downEffect !== 0) {
20510
20618
  writeXmlAttr(extAttrs, extSpecs.downEffect, String(downEffect));
@@ -21735,16 +21843,12 @@ function decodeTextChildSpecific(child, childBuf) {
21735
21843
  y: childBuf.getFloat32()
21736
21844
  });
21737
21845
  if (childBuf.readBool()) {}
21738
- if (childBuf.version >= 3 && remainingBytes(childBuf) >= 13) {
21739
- textChild.setStrikethrough(childBuf.readBool());
21740
- childBuf.skip(12);
21741
- }
21846
+ if (childBuf.version >= 3 && remainingBytes(childBuf) >= 13) textChild.setStrikethrough(childBuf.readBool()).setFaceDilate(childBuf.getFloat32()).setOutlineSoftness(childBuf.getFloat32()).setUnderlaySoftness(childBuf.getFloat32());
21742
21847
  }
21743
21848
  function decodeListScrollPane(child, childBuf) {
21744
21849
  if (!childBuf.seek(0, 7) || remainingBytes(childBuf) < 10) return;
21745
21850
  const listLike = child;
21746
- listLike.setScrollType(childBuf.getUint8());
21747
- childBuf.getUint8();
21851
+ listLike.setScrollType(childBuf.getUint8()).setScrollBarDisplay(childBuf.getUint8());
21748
21852
  listLike.setScrollBarFlags(childBuf.getInt32());
21749
21853
  if (childBuf.readBool() && remainingBytes(childBuf) >= 16) listLike.setScrollBarMargin([
21750
21854
  childBuf.getInt32(),
@@ -21951,10 +22055,7 @@ function decodeChildBlock6(resource, child, childBuf) {
21951
22055
  childBuf.readBool();
21952
22056
  }
21953
22057
  }
21954
- if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) {
21955
- childBuf.readS();
21956
- childBuf.getFloat32();
21957
- }
22058
+ if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
21958
22059
  break;
21959
22060
  case "ComboBox": {
21960
22061
  if (remainingBytes(childBuf) < 2) return;
@@ -21972,24 +22073,17 @@ function decodeChildBlock6(resource, child, childBuf) {
21972
22073
  }
21973
22074
  component.setInstanceComboItems(items).setInstanceTitle(childBuf.readS() ?? "").setInstanceIcon(childBuf.readS() ?? "");
21974
22075
  if (childBuf.readBool()) component.setInstanceTitleColor(readColorValue(childBuf, true));
21975
- component.setInstanceVisibleItemCount(childBuf.getInt32());
21976
- childBuf.getUint8();
22076
+ component.setInstanceVisibleItemCount(childBuf.getInt32()).setInstancePopupDirection(childBuf.getUint8());
21977
22077
  const selectionControllerIndex = childBuf.getInt16();
21978
22078
  if (selectionControllerIndex >= 0) component.setInstanceSelectionController(resource.listControllers()[selectionControllerIndex]?.getName() ?? "");
21979
- if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) {
21980
- childBuf.readS();
21981
- childBuf.getFloat32();
21982
- }
22079
+ if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
21983
22080
  break;
21984
22081
  }
21985
22082
  case "ProgressBar":
21986
22083
  case "Slider":
21987
22084
  if (remainingBytes(childBuf) < 12) return;
21988
22085
  component.setInstanceValue(childBuf.getInt32()).setInstanceMax(childBuf.getInt32()).setInstanceMin(childBuf.getInt32());
21989
- if (extTypeName === "ProgressBar" && childBuf.version >= 5 && remainingBytes(childBuf) >= 6) {
21990
- childBuf.readS();
21991
- childBuf.getFloat32();
21992
- }
22086
+ if (extTypeName === "ProgressBar" && childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
21993
22087
  break;
21994
22088
  default: break;
21995
22089
  }
@@ -23794,9 +23888,9 @@ function _writeChildSpecific(buf, child, pkg, version) {
23794
23888
  buf.writeBool(false);
23795
23889
  if (version >= 3) {
23796
23890
  buf.writeBool(child.getStrikethrough?.() ?? false);
23797
- buf.writeFloat32(0);
23798
- buf.writeFloat32(0);
23799
- buf.writeFloat32(0);
23891
+ buf.writeFloat32(child.getFaceDilate?.() ?? 0);
23892
+ buf.writeFloat32(child.getOutlineSoftness?.() ?? 0);
23893
+ buf.writeFloat32(child.getUnderlaySoftness?.() ?? 0);
23800
23894
  }
23801
23895
  break;
23802
23896
  }
@@ -24018,7 +24112,9 @@ function _writeChildAfterAdd(buf, child, comp, pkg, version) {
24018
24112
  }
24019
24113
  buf.writeSEx(child.getTitle?.() ?? null, true);
24020
24114
  buf.writeS(remapLocalUiUrl(pkg, child.getIcon?.() ?? null));
24021
- buf.writeBool(false);
24115
+ const comboTitleColor = child.getTitleColor?.() ?? null;
24116
+ buf.writeBool(!!comboTitleColor);
24117
+ if (comboTitleColor) buf.writeColor(comboTitleColor, true);
24022
24118
  buf.writeInt32(child.getVisibleItemCount?.() ?? 10);
24023
24119
  buf.writeUint8(child.getPopupDirection?.() ?? 0);
24024
24120
  buf.writeInt16(-1);
@@ -24100,8 +24196,8 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
24100
24196
  buf.writeInt32(child.getInstanceTitleFontSize?.() ?? 0);
24101
24197
  buf.writeBool(false);
24102
24198
  if (version >= 5) {
24103
- buf.writeS(null);
24104
- buf.writeFloat32(1);
24199
+ buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
24200
+ buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
24105
24201
  }
24106
24202
  break;
24107
24203
  }
@@ -24126,11 +24222,11 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
24126
24222
  buf.writeBool(!!comboTitleColor);
24127
24223
  if (comboTitleColor) buf.writeColor(comboTitleColor, true);
24128
24224
  buf.writeInt32(child.getInstanceVisibleItemCount?.() ?? 10);
24129
- buf.writeUint8(0);
24225
+ buf.writeUint8(child.getInstancePopupDirection?.() ?? 0);
24130
24226
  buf.writeInt16(-1);
24131
24227
  if (version >= 5) {
24132
- buf.writeS(null);
24133
- buf.writeFloat32(1);
24228
+ buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
24229
+ buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
24134
24230
  }
24135
24231
  break;
24136
24232
  }
@@ -24140,8 +24236,8 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
24140
24236
  buf.writeInt32(child.getInstanceMax?.() ?? 100);
24141
24237
  buf.writeInt32(child.getInstanceMin?.() ?? 0);
24142
24238
  if (version >= 5 && extType === "ProgressBar") {
24143
- buf.writeS(null);
24144
- buf.writeFloat32(1);
24239
+ buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
24240
+ buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
24145
24241
  }
24146
24242
  break;
24147
24243
  default: break;
@@ -24149,7 +24245,7 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
24149
24245
  }
24150
24246
  function _writeScrollPane(buf, child, pkg) {
24151
24247
  buf.writeUint8(child.getScrollType?.() ?? 1);
24152
- buf.writeUint8(0);
24248
+ buf.writeUint8(child.getScrollBarDisplay?.() ?? 0);
24153
24249
  buf.writeInt32(child.getScrollBarFlags?.() ?? 0);
24154
24250
  const sbMargin = child.getScrollBarMargin?.();
24155
24251
  buf.writeBool(!!sbMargin);
@@ -28727,14 +28823,15 @@ function resolvePublishOptions(doc, overrides = {}) {
28727
28823
  const root = doc.getRoot();
28728
28824
  const publishSettings = (root.getSettings?.() ?? {}).publish ?? {};
28729
28825
  const atlasSetting = publishSettings.atlasSetting ?? {};
28730
- const projectType = root.getProjectType();
28731
- const fileExtension = overrides.fileExtension ?? resolveDefaultPublishFileExtension(projectType, publishSettings);
28826
+ const projectType = overrides.targetProjectType ?? root.getProjectType();
28827
+ const explicitLayaboxTarget = overrides.targetProjectType === ProjectType.LayaBox;
28828
+ const fileExtension = overrides.fileExtension ?? (explicitLayaboxTarget ? "fui" : resolveDefaultPublishFileExtension(projectType, publishSettings));
28732
28829
  let compressed = overrides.compressed ?? publishSettings.compressDesc ?? false;
28733
28830
  if (projectType === UNITY_PROJECT_TYPE) compressed = overrides.compressed ?? false;
28734
28831
  const atlasOptions = {
28735
28832
  maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
28736
28833
  fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
28737
- allowRotation: overrides.atlas?.allowRotation ?? atlasSetting.allowRotation ?? false,
28834
+ allowRotation: overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : atlasSetting.allowRotation ?? false),
28738
28835
  padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
28739
28836
  powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === "pot",
28740
28837
  square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,
@@ -29409,7 +29506,8 @@ function registerPublishCommand(program) {
29409
29506
  const pkgFilter = options.packages?.split(",").map((value) => value.trim());
29410
29507
  const resolved = resolvePublishOptions(doc, {
29411
29508
  compressed: options.compressed,
29412
- packages: pkgFilter
29509
+ packages: pkgFilter,
29510
+ targetProjectType: projectType
29413
29511
  });
29414
29512
  console.log(`Settings: ext=${resolved.fileExtension}, compressed=${resolved.compressed}`);
29415
29513
  if (options.branch) console.log(`Active branch: ${options.branch}`);
@@ -29452,7 +29550,7 @@ function registerRestoreCommand(program) {
29452
29550
  //#region src/utils/package-version.ts
29453
29551
  const require$1 = createRequire(import.meta.url);
29454
29552
  function getInjectedPackageVersion() {
29455
- const version = "0.2.1";
29553
+ const version = "0.2.3";
29456
29554
  return typeof version === "string" && true ? version : null;
29457
29555
  }
29458
29556
  function readPackageVersion() {
@@ -29480,7 +29578,7 @@ function createProgram() {
29480
29578
  " openfairygui",
29481
29579
  "",
29482
29580
  "Input can be a .fairy file or a project root directory (auto-discovers .fairy file).",
29483
- "File extension and binary format are read from project settings."
29581
+ "Publish settings are read from the project; --project-type applies target-specific output rules."
29484
29582
  ].join("\n"));
29485
29583
  return program;
29486
29584
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfairygui/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
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.1",
37
- "@openfairygui/functions": "0.2.1"
36
+ "@openfairygui/functions": "0.2.3",
37
+ "@openfairygui/core": "0.2.3"
38
38
  },
39
39
  "dependencies": {
40
40
  "commander": "^14.0.2",
41
41
  "jiti": "^2.7.0",
42
- "@openfairygui/backend": "0.2.1"
42
+ "@openfairygui/backend": "0.2.3"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "sharp": ">=0.33.0"
package/src/cli.ts CHANGED
@@ -25,7 +25,7 @@ function createProgram(): Command {
25
25
  ' openfairygui',
26
26
  '',
27
27
  'Input can be a .fairy file or a project root directory (auto-discovers .fairy file).',
28
- 'File extension and binary format are read from project settings.',
28
+ 'Publish settings are read from the project; --project-type applies target-specific output rules.',
29
29
  ].join('\n'),
30
30
  );
31
31
 
@@ -1,8 +1,8 @@
1
- import type { Command } from 'commander';
1
+ import path from 'node:path';
2
2
  import { NodeIO } from '@openfairygui/core/node';
3
3
  import { resolvePublishOptions } from '@openfairygui/functions';
4
4
  import { publishNode } from '@openfairygui/functions/node';
5
- import path from 'node:path';
5
+ import type { Command } from 'commander';
6
6
  import { resolveFairyPath } from '../utils/project-input.js';
7
7
  import { parseProjectType } from '../utils/project-type.js';
8
8
 
@@ -44,6 +44,7 @@ export function registerPublishCommand(program: Command): void {
44
44
  const resolved = resolvePublishOptions(doc, {
45
45
  compressed: options.compressed,
46
46
  packages: pkgFilter,
47
+ targetProjectType: projectType,
47
48
  });
48
49
 
49
50
  console.log(`Settings: ext=${resolved.fileExtension}, compressed=${resolved.compressed}`);