@openfairygui/cli 0.3.0-alpha.4 → 0.3.0
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 +770 -190
- package/package.json +4 -4
- package/src/cli.ts +1 -1
- package/src/commands/publish.ts +3 -2
package/dist/cli.mjs
CHANGED
|
@@ -730,6 +730,14 @@ var Property = class extends GraphNode {
|
|
|
730
730
|
if (Array.isArray(value)) value = value.slice();
|
|
731
731
|
return super.set(attribute, value);
|
|
732
732
|
}
|
|
733
|
+
/** @hidden */
|
|
734
|
+
getExtendedLiteral(attribute) {
|
|
735
|
+
return super.get(attribute);
|
|
736
|
+
}
|
|
737
|
+
/** @hidden */
|
|
738
|
+
setExtendedLiteral(attribute, value) {
|
|
739
|
+
return super.set(attribute, value.slice());
|
|
740
|
+
}
|
|
733
741
|
getName() {
|
|
734
742
|
return this.get("name");
|
|
735
743
|
}
|
|
@@ -821,7 +829,7 @@ var ExtensibleProperty = class extends Property {
|
|
|
821
829
|
};
|
|
822
830
|
//#endregion
|
|
823
831
|
//#region ../core/src/constants.ts
|
|
824
|
-
const VERSION = `v0.3.0
|
|
832
|
+
const VERSION = `v0.3.0`;
|
|
825
833
|
/** Binary package file magic number: "FGUI" as uint32. */
|
|
826
834
|
const FGUI_MAGIC = 1179080009;
|
|
827
835
|
/** Null string index in the binary string table. */
|
|
@@ -837,6 +845,7 @@ let PropertyType = /* @__PURE__ */ function(PropertyType) {
|
|
|
837
845
|
PropertyType["SOUND_RESOURCE"] = "SoundResource";
|
|
838
846
|
PropertyType["FONT_RESOURCE"] = "FontResource";
|
|
839
847
|
PropertyType["MOVIE_CLIP_RESOURCE"] = "MovieClipResource";
|
|
848
|
+
PropertyType["SWF_RESOURCE"] = "SwfResource";
|
|
840
849
|
PropertyType["SPINE_RESOURCE"] = "SpineResource";
|
|
841
850
|
PropertyType["DRAGON_BONES_RESOURCE"] = "DragonBonesResource";
|
|
842
851
|
PropertyType["COMPONENT"] = "Component";
|
|
@@ -1479,10 +1488,10 @@ var ImageResource = class extends ExtensibleProperty {
|
|
|
1479
1488
|
return this.set("branchItemIds", [...ids]);
|
|
1480
1489
|
}
|
|
1481
1490
|
getHighResolutionItemIds() {
|
|
1482
|
-
return [...this.
|
|
1491
|
+
return [...this.getExtendedLiteral("highResolutionItemIds")];
|
|
1483
1492
|
}
|
|
1484
1493
|
setHighResolutionItemIds(ids) {
|
|
1485
|
-
return this.
|
|
1494
|
+
return this.setExtendedLiteral("highResolutionItemIds", ids);
|
|
1486
1495
|
}
|
|
1487
1496
|
getWidth() {
|
|
1488
1497
|
return this.get("width");
|
|
@@ -1955,10 +1964,10 @@ var MovieClipResource = class extends ExtensibleProperty {
|
|
|
1955
1964
|
return this.set("branchItemIds", [...ids]);
|
|
1956
1965
|
}
|
|
1957
1966
|
getHighResolutionItemIds() {
|
|
1958
|
-
return [...this.
|
|
1967
|
+
return [...this.getExtendedLiteral("highResolutionItemIds")];
|
|
1959
1968
|
}
|
|
1960
1969
|
setHighResolutionItemIds(ids) {
|
|
1961
|
-
return this.
|
|
1970
|
+
return this.setExtendedLiteral("highResolutionItemIds", ids);
|
|
1962
1971
|
}
|
|
1963
1972
|
getFileName() {
|
|
1964
1973
|
return this.get("fileName");
|
|
@@ -2038,6 +2047,74 @@ var MovieClipResource = class extends ExtensibleProperty {
|
|
|
2038
2047
|
}
|
|
2039
2048
|
};
|
|
2040
2049
|
//#endregion
|
|
2050
|
+
//#region ../core/src/properties/swf-resource.ts
|
|
2051
|
+
/** A SWF resource within a FairyGUI package. */
|
|
2052
|
+
var SwfResource = class extends ExtensibleProperty {
|
|
2053
|
+
init() {
|
|
2054
|
+
this.propertyType = PropertyType.SWF_RESOURCE;
|
|
2055
|
+
}
|
|
2056
|
+
getDefaults() {
|
|
2057
|
+
return Object.assign(super.getDefaults(), {
|
|
2058
|
+
id: "",
|
|
2059
|
+
path: "",
|
|
2060
|
+
branch: "",
|
|
2061
|
+
branchItemIds: [],
|
|
2062
|
+
file: "",
|
|
2063
|
+
exported: false,
|
|
2064
|
+
favorite: false,
|
|
2065
|
+
resourceData: null
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
getId() {
|
|
2069
|
+
return this.get("id");
|
|
2070
|
+
}
|
|
2071
|
+
setId(id) {
|
|
2072
|
+
return this.set("id", id);
|
|
2073
|
+
}
|
|
2074
|
+
getPath() {
|
|
2075
|
+
return this.get("path");
|
|
2076
|
+
}
|
|
2077
|
+
setPath(path) {
|
|
2078
|
+
return this.set("path", path);
|
|
2079
|
+
}
|
|
2080
|
+
getBranch() {
|
|
2081
|
+
return this.get("branch");
|
|
2082
|
+
}
|
|
2083
|
+
setBranch(branch) {
|
|
2084
|
+
return this.set("branch", branch);
|
|
2085
|
+
}
|
|
2086
|
+
getBranchItemIds() {
|
|
2087
|
+
return [...this.get("branchItemIds")];
|
|
2088
|
+
}
|
|
2089
|
+
setBranchItemIds(ids) {
|
|
2090
|
+
return this.set("branchItemIds", [...ids]);
|
|
2091
|
+
}
|
|
2092
|
+
getFile() {
|
|
2093
|
+
return this.get("file");
|
|
2094
|
+
}
|
|
2095
|
+
setFile(file) {
|
|
2096
|
+
return this.set("file", file);
|
|
2097
|
+
}
|
|
2098
|
+
getExported() {
|
|
2099
|
+
return this.get("exported");
|
|
2100
|
+
}
|
|
2101
|
+
setExported(value) {
|
|
2102
|
+
return this.set("exported", value);
|
|
2103
|
+
}
|
|
2104
|
+
getFavorite() {
|
|
2105
|
+
return this.get("favorite");
|
|
2106
|
+
}
|
|
2107
|
+
setFavorite(value) {
|
|
2108
|
+
return this.set("favorite", value);
|
|
2109
|
+
}
|
|
2110
|
+
getSourceData() {
|
|
2111
|
+
return this.getRef("resourceData");
|
|
2112
|
+
}
|
|
2113
|
+
setSourceData(buffer) {
|
|
2114
|
+
return this.setRef("resourceData", buffer);
|
|
2115
|
+
}
|
|
2116
|
+
};
|
|
2117
|
+
//#endregion
|
|
2041
2118
|
//#region ../core/src/properties/skeleton-resource-base.ts
|
|
2042
2119
|
/**
|
|
2043
2120
|
* Shared base for skeleton-style package resources.
|
|
@@ -2234,13 +2311,17 @@ var Component = class extends ExtensibleProperty {
|
|
|
2234
2311
|
footerRes: "",
|
|
2235
2312
|
bgColor: "",
|
|
2236
2313
|
bgColorEnabled: false,
|
|
2237
|
-
designImageAlpha:
|
|
2314
|
+
designImageAlpha: 50,
|
|
2238
2315
|
designImageLayer: 0,
|
|
2239
2316
|
designImageOffsetX: 0,
|
|
2240
2317
|
designImageOffsetY: 0,
|
|
2318
|
+
designImage: "",
|
|
2319
|
+
designImageForTest: false,
|
|
2320
|
+
pageController: "",
|
|
2241
2321
|
idNum: 0,
|
|
2242
2322
|
initName: "",
|
|
2243
2323
|
remark: "",
|
|
2324
|
+
customExtensionId: "",
|
|
2244
2325
|
extensionType: "",
|
|
2245
2326
|
buttonMode: 0,
|
|
2246
2327
|
sound: "",
|
|
@@ -2527,6 +2608,24 @@ var Component = class extends ExtensibleProperty {
|
|
|
2527
2608
|
setDesignImageOffsetY(v) {
|
|
2528
2609
|
return this.set("designImageOffsetY", v);
|
|
2529
2610
|
}
|
|
2611
|
+
getDesignImage() {
|
|
2612
|
+
return this.get("designImage");
|
|
2613
|
+
}
|
|
2614
|
+
setDesignImage(v) {
|
|
2615
|
+
return this.set("designImage", v);
|
|
2616
|
+
}
|
|
2617
|
+
getDesignImageForTest() {
|
|
2618
|
+
return this.get("designImageForTest");
|
|
2619
|
+
}
|
|
2620
|
+
setDesignImageForTest(v) {
|
|
2621
|
+
return this.set("designImageForTest", v);
|
|
2622
|
+
}
|
|
2623
|
+
getPageController() {
|
|
2624
|
+
return this.get("pageController");
|
|
2625
|
+
}
|
|
2626
|
+
setPageController(v) {
|
|
2627
|
+
return this.set("pageController", v);
|
|
2628
|
+
}
|
|
2530
2629
|
getIdNum() {
|
|
2531
2630
|
return this.get("idNum");
|
|
2532
2631
|
}
|
|
@@ -2545,6 +2644,12 @@ var Component = class extends ExtensibleProperty {
|
|
|
2545
2644
|
setRemark(v) {
|
|
2546
2645
|
return this.set("remark", v);
|
|
2547
2646
|
}
|
|
2647
|
+
getCustomExtensionId() {
|
|
2648
|
+
return this.get("customExtensionId");
|
|
2649
|
+
}
|
|
2650
|
+
setCustomExtensionId(v) {
|
|
2651
|
+
return this.set("customExtensionId", v);
|
|
2652
|
+
}
|
|
2548
2653
|
getExtensionType() {
|
|
2549
2654
|
return this.get("extensionType");
|
|
2550
2655
|
}
|
|
@@ -3542,6 +3647,7 @@ var GTextField = class extends GObject {
|
|
|
3542
3647
|
demoText: "",
|
|
3543
3648
|
templateVarsEnabled: false,
|
|
3544
3649
|
faceDilate: 0,
|
|
3650
|
+
outlineSoftness: 0,
|
|
3545
3651
|
underlaySoftness: 0,
|
|
3546
3652
|
ubbEnabled: false,
|
|
3547
3653
|
underline: false,
|
|
@@ -3762,6 +3868,12 @@ var GTextField = class extends GObject {
|
|
|
3762
3868
|
setFaceDilate(v) {
|
|
3763
3869
|
return this.setTextFieldProp("faceDilate", v);
|
|
3764
3870
|
}
|
|
3871
|
+
getOutlineSoftness() {
|
|
3872
|
+
return this.getTextFieldProp("outlineSoftness");
|
|
3873
|
+
}
|
|
3874
|
+
setOutlineSoftness(v) {
|
|
3875
|
+
return this.setTextFieldProp("outlineSoftness", v);
|
|
3876
|
+
}
|
|
3765
3877
|
getUnderlaySoftness() {
|
|
3766
3878
|
return this.getTextFieldProp("underlaySoftness");
|
|
3767
3879
|
}
|
|
@@ -4293,6 +4405,7 @@ var GLoader = class extends GObject {
|
|
|
4293
4405
|
shrinkOnly: false,
|
|
4294
4406
|
autoSize: false,
|
|
4295
4407
|
useResize: false,
|
|
4408
|
+
showErrorSign: false,
|
|
4296
4409
|
align: 0,
|
|
4297
4410
|
vAlign: 0,
|
|
4298
4411
|
frame: 0,
|
|
@@ -4430,6 +4543,12 @@ var GLoader = class extends GObject {
|
|
|
4430
4543
|
setUseResize(v) {
|
|
4431
4544
|
return this.set("useResize", v);
|
|
4432
4545
|
}
|
|
4546
|
+
getShowErrorSign() {
|
|
4547
|
+
return this.get("showErrorSign");
|
|
4548
|
+
}
|
|
4549
|
+
setShowErrorSign(v) {
|
|
4550
|
+
return this.set("showErrorSign", v);
|
|
4551
|
+
}
|
|
4433
4552
|
getAlign() {
|
|
4434
4553
|
return this.get("align");
|
|
4435
4554
|
}
|
|
@@ -4894,6 +5013,7 @@ var GComponent = class extends GObject {
|
|
|
4894
5013
|
instanceChecked: false,
|
|
4895
5014
|
instanceSound: "",
|
|
4896
5015
|
instanceSoundVolumeScale: 1,
|
|
5016
|
+
instancePopupDirection: 0,
|
|
4897
5017
|
instancePromptText: "",
|
|
4898
5018
|
instanceSelectionController: "",
|
|
4899
5019
|
instanceVisibleItemCount: 0,
|
|
@@ -5180,6 +5300,12 @@ var GComponent = class extends GObject {
|
|
|
5180
5300
|
setInstanceSoundVolumeScale(v) {
|
|
5181
5301
|
return this.setComponentProp("instanceSoundVolumeScale", v);
|
|
5182
5302
|
}
|
|
5303
|
+
getInstancePopupDirection() {
|
|
5304
|
+
return this.getComponentProp("instancePopupDirection");
|
|
5305
|
+
}
|
|
5306
|
+
setInstancePopupDirection(v) {
|
|
5307
|
+
return this.setComponentProp("instancePopupDirection", v);
|
|
5308
|
+
}
|
|
5183
5309
|
getInstancePromptText() {
|
|
5184
5310
|
return firstString$1(this.getComponentProp("instancePromptText"));
|
|
5185
5311
|
}
|
|
@@ -5243,6 +5369,9 @@ var GComponent = class extends GObject {
|
|
|
5243
5369
|
};
|
|
5244
5370
|
//#endregion
|
|
5245
5371
|
//#region ../core/src/properties/g-list.ts
|
|
5372
|
+
function getDefaultListAutoResizeItem(layout) {
|
|
5373
|
+
return layout === ListLayoutType.SingleColumn || layout === ListLayoutType.SingleRow;
|
|
5374
|
+
}
|
|
5246
5375
|
function firstString(value) {
|
|
5247
5376
|
if (Array.isArray(value)) return String(value[0] ?? "");
|
|
5248
5377
|
return String(value ?? "");
|
|
@@ -5275,12 +5404,13 @@ var GListBase = class extends GObject {
|
|
|
5275
5404
|
columnCount: 0,
|
|
5276
5405
|
selectionMode: ListSelectionMode.Single,
|
|
5277
5406
|
defaultItem: "",
|
|
5278
|
-
autoResizeItem:
|
|
5407
|
+
autoResizeItem: getDefaultListAutoResizeItem(ListLayoutType.SingleColumn),
|
|
5279
5408
|
childrenRenderOrder: 0,
|
|
5280
5409
|
apexIndex: 0,
|
|
5281
5410
|
src: "",
|
|
5282
5411
|
overflow: 0,
|
|
5283
5412
|
scrollType: 1,
|
|
5413
|
+
scrollBarDisplay: 0,
|
|
5284
5414
|
scrollBarFlags: 0,
|
|
5285
5415
|
scrollBarMargin: [
|
|
5286
5416
|
0,
|
|
@@ -5483,6 +5613,12 @@ var GListBase = class extends GObject {
|
|
|
5483
5613
|
setScrollType(v) {
|
|
5484
5614
|
return this.setListProp("scrollType", v);
|
|
5485
5615
|
}
|
|
5616
|
+
getScrollBarDisplay() {
|
|
5617
|
+
return this.getListProp("scrollBarDisplay");
|
|
5618
|
+
}
|
|
5619
|
+
setScrollBarDisplay(v) {
|
|
5620
|
+
return this.setListProp("scrollBarDisplay", v);
|
|
5621
|
+
}
|
|
5486
5622
|
getScrollBarFlags() {
|
|
5487
5623
|
return this.getListProp("scrollBarFlags");
|
|
5488
5624
|
}
|
|
@@ -6441,6 +6577,10 @@ var Controller = class extends ExtensibleProperty {
|
|
|
6441
6577
|
return Object.assign(super.getDefaults(), {
|
|
6442
6578
|
selectedIndex: 0,
|
|
6443
6579
|
autoRadioGroupDepth: false,
|
|
6580
|
+
alias: "",
|
|
6581
|
+
exported: false,
|
|
6582
|
+
homePageType: "default",
|
|
6583
|
+
homePage: "",
|
|
6444
6584
|
pages: new RefList(),
|
|
6445
6585
|
actions: new RefList()
|
|
6446
6586
|
});
|
|
@@ -6457,6 +6597,30 @@ var Controller = class extends ExtensibleProperty {
|
|
|
6457
6597
|
setAutoRadioGroupDepth(v) {
|
|
6458
6598
|
return this.set("autoRadioGroupDepth", v);
|
|
6459
6599
|
}
|
|
6600
|
+
getAlias() {
|
|
6601
|
+
return this.get("alias");
|
|
6602
|
+
}
|
|
6603
|
+
setAlias(v) {
|
|
6604
|
+
return this.set("alias", v);
|
|
6605
|
+
}
|
|
6606
|
+
getExported() {
|
|
6607
|
+
return this.get("exported");
|
|
6608
|
+
}
|
|
6609
|
+
setExported(v) {
|
|
6610
|
+
return this.set("exported", v);
|
|
6611
|
+
}
|
|
6612
|
+
getHomePageType() {
|
|
6613
|
+
return this.get("homePageType");
|
|
6614
|
+
}
|
|
6615
|
+
setHomePageType(v) {
|
|
6616
|
+
return this.set("homePageType", v);
|
|
6617
|
+
}
|
|
6618
|
+
getHomePage() {
|
|
6619
|
+
return this.get("homePage");
|
|
6620
|
+
}
|
|
6621
|
+
setHomePage(v) {
|
|
6622
|
+
return this.set("homePage", v);
|
|
6623
|
+
}
|
|
6460
6624
|
addPage(page) {
|
|
6461
6625
|
return this.addRef("pages", page);
|
|
6462
6626
|
}
|
|
@@ -6490,7 +6654,10 @@ var ControllerPage = class extends Property {
|
|
|
6490
6654
|
this.propertyType = PropertyType.CONTROLLER_PAGE;
|
|
6491
6655
|
}
|
|
6492
6656
|
getDefaults() {
|
|
6493
|
-
return Object.assign(super.getDefaults(), {
|
|
6657
|
+
return Object.assign(super.getDefaults(), {
|
|
6658
|
+
id: "",
|
|
6659
|
+
remark: ""
|
|
6660
|
+
});
|
|
6494
6661
|
}
|
|
6495
6662
|
getId() {
|
|
6496
6663
|
return this.get("id");
|
|
@@ -6498,6 +6665,12 @@ var ControllerPage = class extends Property {
|
|
|
6498
6665
|
setId(id) {
|
|
6499
6666
|
return this.set("id", id);
|
|
6500
6667
|
}
|
|
6668
|
+
getRemark() {
|
|
6669
|
+
return this.get("remark");
|
|
6670
|
+
}
|
|
6671
|
+
setRemark(remark) {
|
|
6672
|
+
return this.set("remark", remark);
|
|
6673
|
+
}
|
|
6501
6674
|
};
|
|
6502
6675
|
//#endregion
|
|
6503
6676
|
//#region ../core/src/properties/controller-action.ts
|
|
@@ -16090,6 +16263,9 @@ var Document = class Document {
|
|
|
16090
16263
|
createMovieClipResource(name = "") {
|
|
16091
16264
|
return new MovieClipResource(this._graph, name);
|
|
16092
16265
|
}
|
|
16266
|
+
createSwfResource(name = "") {
|
|
16267
|
+
return new SwfResource(this._graph, name);
|
|
16268
|
+
}
|
|
16093
16269
|
createSpineResource(name = "") {
|
|
16094
16270
|
return new SpineResource(this._graph, name);
|
|
16095
16271
|
}
|
|
@@ -16345,6 +16521,7 @@ const TEXT_PROPERTY_KEYS = [
|
|
|
16345
16521
|
"autoSize",
|
|
16346
16522
|
"singleLine",
|
|
16347
16523
|
"autoClearText",
|
|
16524
|
+
"outlineSoftness",
|
|
16348
16525
|
"underlaySoftness",
|
|
16349
16526
|
"ubbEnabled",
|
|
16350
16527
|
"underline",
|
|
@@ -16376,7 +16553,7 @@ function isValidUamTextProperties(value, nodeKind) {
|
|
|
16376
16553
|
properties.italic,
|
|
16377
16554
|
properties.bold,
|
|
16378
16555
|
properties.strikethrough
|
|
16379
|
-
].every((item) => typeof item === "boolean") && typeof properties.underlaySoftness === "number" && Number.isFinite(properties.underlaySoftness) && typeof properties.strokeSize === "number" && Number.isFinite(properties.strokeSize) && properties.strokeSize >= 0 && (properties.strokeColor === null ? properties.strokeSize === 1 : isTextColor(properties.strokeColor)) && isFiniteUamPoint(properties.shadowOffset) && (properties.shadowColor === null ? properties.shadowOffset.x === 0 && properties.shadowOffset.y === 0 : isTextColor(properties.shadowColor));
|
|
16556
|
+
].every((item) => typeof item === "boolean") && typeof properties.outlineSoftness === "number" && Number.isFinite(properties.outlineSoftness) && typeof properties.underlaySoftness === "number" && Number.isFinite(properties.underlaySoftness) && typeof properties.strokeSize === "number" && Number.isFinite(properties.strokeSize) && properties.strokeSize >= 0 && (properties.strokeColor === null ? properties.strokeSize === 1 : isTextColor(properties.strokeColor)) && isFiniteUamPoint(properties.shadowOffset) && (properties.shadowColor === null ? properties.shadowOffset.x === 0 && properties.shadowOffset.y === 0 : isTextColor(properties.shadowColor));
|
|
16380
16557
|
if (!commonValid || nodeKind === "richText") return commonValid;
|
|
16381
16558
|
return typeof properties.demoText === "string" && typeof properties.templateVarsEnabled === "boolean" && typeof properties.faceDilate === "number" && Number.isFinite(properties.faceDilate);
|
|
16382
16559
|
}
|
|
@@ -16393,6 +16570,7 @@ function textPropertiesFromNode(node) {
|
|
|
16393
16570
|
autoSize: node.autoSize,
|
|
16394
16571
|
singleLine: node.singleLine,
|
|
16395
16572
|
autoClearText: node.autoClearText,
|
|
16573
|
+
outlineSoftness: node.outlineSoftness,
|
|
16396
16574
|
underlaySoftness: node.underlaySoftness,
|
|
16397
16575
|
ubbEnabled: node.ubbEnabled,
|
|
16398
16576
|
underline: node.underline,
|
|
@@ -16412,6 +16590,29 @@ function textPropertiesFromNode(node) {
|
|
|
16412
16590
|
faceDilate: node.faceDilate
|
|
16413
16591
|
};
|
|
16414
16592
|
}
|
|
16593
|
+
const IMAGE_PROPERTY_KEYS = [
|
|
16594
|
+
"color",
|
|
16595
|
+
"flip",
|
|
16596
|
+
"fillMethod",
|
|
16597
|
+
"fillOrigin",
|
|
16598
|
+
"fillClockwise",
|
|
16599
|
+
"fillAmount"
|
|
16600
|
+
];
|
|
16601
|
+
function isValidUamImageProperties(value) {
|
|
16602
|
+
if (typeof value !== "object" || value === null || !hasExactKeys(value, IMAGE_PROPERTY_KEYS)) return false;
|
|
16603
|
+
const properties = value;
|
|
16604
|
+
return isTextColor(properties.color) && Number.isInteger(properties.flip) && properties.flip >= 0 && properties.flip <= 3 && Number.isInteger(properties.fillMethod) && properties.fillMethod >= 0 && properties.fillMethod <= 5 && Number.isInteger(properties.fillOrigin) && properties.fillOrigin >= 0 && properties.fillOrigin <= 3 && typeof properties.fillClockwise === "boolean" && typeof properties.fillAmount === "number" && Number.isFinite(properties.fillAmount) && (properties.fillMethod === 0 ? properties.fillOrigin === 0 && properties.fillClockwise && properties.fillAmount === 100 : properties.fillAmount >= 0 && properties.fillAmount <= 1);
|
|
16605
|
+
}
|
|
16606
|
+
const MOVIE_CLIP_PROPERTY_KEYS = [
|
|
16607
|
+
"playing",
|
|
16608
|
+
"frame",
|
|
16609
|
+
"color"
|
|
16610
|
+
];
|
|
16611
|
+
function isValidUamMovieClipProperties(value) {
|
|
16612
|
+
if (typeof value !== "object" || value === null || !hasExactKeys(value, MOVIE_CLIP_PROPERTY_KEYS)) return false;
|
|
16613
|
+
const properties = value;
|
|
16614
|
+
return typeof properties.playing === "boolean" && Number.isInteger(properties.frame) && properties.frame >= 0 && isTextColor(properties.color);
|
|
16615
|
+
}
|
|
16415
16616
|
const COMPONENT_PROPERTY_KEYS = [
|
|
16416
16617
|
"minSize",
|
|
16417
16618
|
"maxSize",
|
|
@@ -16436,9 +16637,15 @@ const COMPONENT_PROPERTY_KEYS = [
|
|
|
16436
16637
|
"designImageAlpha",
|
|
16437
16638
|
"designImageLayer",
|
|
16438
16639
|
"designImageOffset",
|
|
16640
|
+
"designImage",
|
|
16641
|
+
"designImageForTest",
|
|
16642
|
+
"pageController",
|
|
16643
|
+
"showSound",
|
|
16644
|
+
"hideSound",
|
|
16439
16645
|
"idNum",
|
|
16440
16646
|
"initName",
|
|
16441
16647
|
"remark",
|
|
16648
|
+
"customExtensionId",
|
|
16442
16649
|
"extensionType",
|
|
16443
16650
|
"opaque",
|
|
16444
16651
|
"buttonMode",
|
|
@@ -16470,6 +16677,8 @@ function isValidUamComponentProperties(value) {
|
|
|
16470
16677
|
properties.bgColor,
|
|
16471
16678
|
properties.initName,
|
|
16472
16679
|
properties.remark,
|
|
16680
|
+
properties.customExtensionId,
|
|
16681
|
+
properties.pageController,
|
|
16473
16682
|
properties.extensionType,
|
|
16474
16683
|
properties.sound,
|
|
16475
16684
|
properties.dropdown,
|
|
@@ -16480,6 +16689,7 @@ function isValidUamComponentProperties(value) {
|
|
|
16480
16689
|
properties.pivotAsAnchor,
|
|
16481
16690
|
properties.reversedMask,
|
|
16482
16691
|
properties.bgColorEnabled,
|
|
16692
|
+
properties.designImageForTest,
|
|
16483
16693
|
properties.opaque,
|
|
16484
16694
|
properties.reverse,
|
|
16485
16695
|
properties.wholeNumbers,
|
|
@@ -16492,8 +16702,6 @@ function isValidUamComponentProperties(value) {
|
|
|
16492
16702
|
properties.scrollType,
|
|
16493
16703
|
properties.scrollBarDisplay,
|
|
16494
16704
|
properties.scrollBarFlags,
|
|
16495
|
-
properties.designImageAlpha,
|
|
16496
|
-
properties.designImageLayer,
|
|
16497
16705
|
properties.idNum,
|
|
16498
16706
|
properties.buttonMode,
|
|
16499
16707
|
properties.soundVolumeScale,
|
|
@@ -16501,7 +16709,7 @@ function isValidUamComponentProperties(value) {
|
|
|
16501
16709
|
properties.downEffectValue,
|
|
16502
16710
|
properties.titleType
|
|
16503
16711
|
];
|
|
16504
|
-
return isFiniteUamSize(properties.minSize) && isFiniteUamSize(properties.maxSize) && isFiniteUamPoint(properties.pivot) && isFiniteUamEdgeInsets(properties.margin) && isFiniteUamPoint(properties.clipSoftness) && isFiniteUamEdgeInsets(properties.scrollBarMargin) && isFiniteUamPoint(properties.designImageOffset) && strings.every((item) => typeof item === "string") && booleans.every((item) => typeof item === "boolean") && numbers.every((item) => typeof item === "number" && Number.isFinite(item)) && Array.isArray(properties.customProperties) && properties.customProperties.every((property) => property && typeof property === "object" && hasExactKeys(property, [
|
|
16712
|
+
return isFiniteUamSize(properties.minSize) && isFiniteUamSize(properties.maxSize) && isFiniteUamPoint(properties.pivot) && isFiniteUamEdgeInsets(properties.margin) && isFiniteUamPoint(properties.clipSoftness) && isFiniteUamEdgeInsets(properties.scrollBarMargin) && isFiniteUamPoint(properties.designImageOffset) && strings.every((item) => typeof item === "string") && booleans.every((item) => typeof item === "boolean") && numbers.every((item) => typeof item === "number" && Number.isFinite(item)) && isUiResourceReference(properties.designImage) && isSoundReference(properties.showSound) && isSoundReference(properties.hideSound) && Number.isInteger(properties.designImageAlpha) && properties.designImageAlpha >= 0 && properties.designImageAlpha <= 100 && Number.isInteger(properties.designImageLayer) && properties.designImageLayer >= 0 && properties.designImageLayer <= 1 && Array.isArray(properties.customProperties) && properties.customProperties.every((property) => property && typeof property === "object" && hasExactKeys(property, [
|
|
16505
16713
|
"target",
|
|
16506
16714
|
"propertyId",
|
|
16507
16715
|
"label"
|
|
@@ -16510,6 +16718,13 @@ function isValidUamComponentProperties(value) {
|
|
|
16510
16718
|
function isNullableString(value) {
|
|
16511
16719
|
return value === null || typeof value === "string";
|
|
16512
16720
|
}
|
|
16721
|
+
function isUiResourceReference(value) {
|
|
16722
|
+
return typeof value === "string" && (value === "" || value.startsWith("ui://") && value.length > 5 && !/\s/.test(value));
|
|
16723
|
+
}
|
|
16724
|
+
const isSoundReference = isUiResourceReference;
|
|
16725
|
+
function isSoundVolume(value) {
|
|
16726
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
|
|
16727
|
+
}
|
|
16513
16728
|
function isValidUamComponentInstanceProperties(value) {
|
|
16514
16729
|
if (typeof value !== "object" || value === null || !("extensionType" in value)) return false;
|
|
16515
16730
|
const properties = value;
|
|
@@ -16537,24 +16752,29 @@ function isValidUamComponentInstanceProperties(value) {
|
|
|
16537
16752
|
properties.controller,
|
|
16538
16753
|
properties.page,
|
|
16539
16754
|
properties.sound
|
|
16540
|
-
].every((item) => typeof item === "string") && finite(properties.titleFontSize) && typeof properties.checked === "boolean" &&
|
|
16755
|
+
].every((item) => typeof item === "string") && finite(properties.titleFontSize) && typeof properties.checked === "boolean" && isSoundReference(properties.sound) && isSoundVolume(properties.soundVolumeScale);
|
|
16541
16756
|
case "Label": return hasExactKeys(properties, [
|
|
16542
16757
|
"extensionType",
|
|
16543
16758
|
"title",
|
|
16544
16759
|
"icon",
|
|
16545
16760
|
"titleColor",
|
|
16546
16761
|
"titleFontSize",
|
|
16547
|
-
"promptText"
|
|
16762
|
+
"promptText",
|
|
16763
|
+
"sound",
|
|
16764
|
+
"soundVolumeScale"
|
|
16548
16765
|
]) && [
|
|
16549
16766
|
properties.title,
|
|
16550
16767
|
properties.icon,
|
|
16551
|
-
properties.titleColor,
|
|
16552
16768
|
properties.promptText
|
|
16553
|
-
].every((item) => typeof item === "string") && finite(properties.titleFontSize);
|
|
16769
|
+
].every((item) => typeof item === "string") && (properties.titleColor === "" || isTextColor(properties.titleColor)) && finite(properties.titleFontSize) && isSoundReference(properties.sound) && isSoundVolume(properties.soundVolumeScale);
|
|
16554
16770
|
case "ComboBox": return hasExactKeys(properties, [
|
|
16555
16771
|
"extensionType",
|
|
16556
16772
|
"title",
|
|
16557
16773
|
"icon",
|
|
16774
|
+
"titleColor",
|
|
16775
|
+
"popupDirection",
|
|
16776
|
+
"sound",
|
|
16777
|
+
"soundVolumeScale",
|
|
16558
16778
|
"visibleItemCount",
|
|
16559
16779
|
"selectionController",
|
|
16560
16780
|
"autoClearItems",
|
|
@@ -16563,12 +16783,23 @@ function isValidUamComponentInstanceProperties(value) {
|
|
|
16563
16783
|
properties.title,
|
|
16564
16784
|
properties.icon,
|
|
16565
16785
|
properties.selectionController
|
|
16566
|
-
].every((item) => typeof item === "string") && finite(properties.visibleItemCount) && typeof properties.autoClearItems === "boolean" && Array.isArray(properties.items) && properties.items.every((item) => item && typeof item === "object" && hasExactKeys(item, [
|
|
16786
|
+
].every((item) => typeof item === "string") && (properties.titleColor === "" || isTextColor(properties.titleColor)) && Number.isInteger(properties.popupDirection) && properties.popupDirection >= 0 && properties.popupDirection <= 2 && isSoundReference(properties.sound) && isSoundVolume(properties.soundVolumeScale) && finite(properties.visibleItemCount) && typeof properties.autoClearItems === "boolean" && Array.isArray(properties.items) && properties.items.every((item) => item && typeof item === "object" && hasExactKeys(item, [
|
|
16567
16787
|
"title",
|
|
16568
16788
|
"value",
|
|
16569
16789
|
"icon"
|
|
16570
16790
|
]) && isNullableString(item.title) && isNullableString(item.value) && isNullableString(item.icon));
|
|
16571
|
-
case "ProgressBar":
|
|
16791
|
+
case "ProgressBar": return hasExactKeys(properties, [
|
|
16792
|
+
"extensionType",
|
|
16793
|
+
"value",
|
|
16794
|
+
"max",
|
|
16795
|
+
"min",
|
|
16796
|
+
"sound",
|
|
16797
|
+
"soundVolumeScale"
|
|
16798
|
+
]) && [
|
|
16799
|
+
properties.value,
|
|
16800
|
+
properties.max,
|
|
16801
|
+
properties.min
|
|
16802
|
+
].every(finite) && isSoundReference(properties.sound) && isSoundVolume(properties.soundVolumeScale);
|
|
16572
16803
|
case "Slider": return hasExactKeys(properties, [
|
|
16573
16804
|
"extensionType",
|
|
16574
16805
|
"value",
|
|
@@ -16624,7 +16855,7 @@ function isSafeRelativePath(value) {
|
|
|
16624
16855
|
return segments.length > 0 && segments.every(isSafePathSegment);
|
|
16625
16856
|
}
|
|
16626
16857
|
function assetFileName$1(resource) {
|
|
16627
|
-
return resource.fileName || (
|
|
16858
|
+
return resource.fileName || ("file" in resource ? resource.file : "") || resource.name;
|
|
16628
16859
|
}
|
|
16629
16860
|
function validatePackageOutputTargets(pkg, pkgPath, issues) {
|
|
16630
16861
|
if (!isSafePathSegment(pkg.name)) pushIssue(issues, `${pkgPath}.name`, `Invalid package output name "${pkg.name}".`, "unsafe_path");
|
|
@@ -16714,9 +16945,23 @@ function validateDisplayNode(node, controllerMap, knownChildIds, knownGroupIds,
|
|
|
16714
16945
|
}
|
|
16715
16946
|
if (node.kind === "component" && node.propertyOverrides !== void 0 && (!Array.isArray(node.propertyOverrides) || !node.propertyOverrides.every(isValidUamComponentPropertyOverride))) pushIssue(issues, `${path}.propertyOverrides`, "Component property overrides must contain a non-empty target, a non-negative integer propertyId, and a string value.");
|
|
16716
16947
|
if (node.kind === "list" || node.kind === "tree") {
|
|
16948
|
+
if (!Number.isInteger(node.scrollBarDisplay) || node.scrollBarDisplay < 0 || node.scrollBarDisplay > 3) pushIssue(issues, `${path}.scrollBarDisplay`, "List scrollBarDisplay must be an integer between 0 and 3.");
|
|
16717
16949
|
for (const [itemIndex, item] of node.listItems.entries()) if (item.propertyOverrides !== void 0 && (!Array.isArray(item.propertyOverrides) || !item.propertyOverrides.every(isValidUamComponentPropertyOverride))) pushIssue(issues, `${path}.listItems[${itemIndex}].propertyOverrides`, "List item property overrides must contain a non-empty target, a non-negative integer propertyId, and a string value.");
|
|
16718
16950
|
}
|
|
16719
16951
|
if ((node.kind === "text" || node.kind === "richText" || node.kind === "textInput") && !isValidUamTextProperties(textPropertiesFromNode(node), node.kind)) pushIssue(issues, path, "Text properties must be a complete valid snapshot matching the display node kind.");
|
|
16952
|
+
if (node.kind === "image" && !isValidUamImageProperties({
|
|
16953
|
+
color: node.color,
|
|
16954
|
+
flip: node.flip,
|
|
16955
|
+
fillMethod: node.fillMethod,
|
|
16956
|
+
fillOrigin: node.fillOrigin,
|
|
16957
|
+
fillClockwise: node.fillClockwise,
|
|
16958
|
+
fillAmount: node.fillAmount
|
|
16959
|
+
})) pushIssue(issues, path, "Image properties must be a complete valid property snapshot.");
|
|
16960
|
+
if (node.kind === "movieClip" && !isValidUamMovieClipProperties({
|
|
16961
|
+
playing: node.playing,
|
|
16962
|
+
frame: node.frame,
|
|
16963
|
+
color: node.color
|
|
16964
|
+
})) pushIssue(issues, path, "MovieClip properties must be a complete valid property snapshot.");
|
|
16720
16965
|
if (node.kind === "loader" || node.kind === "loader3D") {
|
|
16721
16966
|
if ("group" in node) pushIssue(issues, `${path}.group`, `${node.kind} display nodes must not declare a group reference.`);
|
|
16722
16967
|
} else if (!("group" in node) || typeof node.group !== "string") pushIssue(issues, `${path}.group`, "Display node group must be a string.");
|
|
@@ -16787,8 +17032,22 @@ function validateUamProject(project) {
|
|
|
16787
17032
|
if (pageIds.has(page.id)) pushIssue(issues, `${pagePath}.id`, `Duplicate controller page id "${page.id}".`);
|
|
16788
17033
|
pageIds.add(page.id);
|
|
16789
17034
|
}
|
|
17035
|
+
if (typeof controller.autoRadioGroupDepth !== "boolean") pushIssue(issues, `${controllerPath}.autoRadioGroupDepth`, "Controller autoRadioGroupDepth must be boolean.");
|
|
17036
|
+
if (typeof controller.alias !== "string") pushIssue(issues, `${controllerPath}.alias`, "Controller alias must be a string.");
|
|
17037
|
+
if (typeof controller.exported !== "boolean") pushIssue(issues, `${controllerPath}.exported`, "Controller exported must be boolean.");
|
|
17038
|
+
if (![
|
|
17039
|
+
"default",
|
|
17040
|
+
"specific",
|
|
17041
|
+
"branch",
|
|
17042
|
+
"variable"
|
|
17043
|
+
].includes(controller.homePageType)) pushIssue(issues, `${controllerPath}.homePageType`, `Unknown controller home page type "${controller.homePageType}".`);
|
|
17044
|
+
else if (typeof controller.homePage !== "string") pushIssue(issues, `${controllerPath}.homePage`, "Controller homePage must be a string.");
|
|
17045
|
+
else if (controller.homePageType === "specific" && !pageIds.has(controller.homePage)) pushIssue(issues, `${controllerPath}.homePage`, `Unknown controller home page id "${controller.homePage}".`);
|
|
17046
|
+
else if (controller.homePageType === "variable" && !controller.homePage) pushIssue(issues, `${controllerPath}.homePage`, "Variable controller home page requires a custom property key.");
|
|
17047
|
+
else if ((controller.homePageType === "default" || controller.homePageType === "branch") && controller.homePage) pushIssue(issues, `${controllerPath}.homePage`, `Controller home page must be empty for "${controller.homePageType}".`);
|
|
16790
17048
|
for (const [actionIndex, action] of controller.actions.entries()) validateControllerAction(action, pageIds, childIds, `${controllerPath}.actions[${actionIndex}]`, issues);
|
|
16791
17049
|
}
|
|
17050
|
+
if (component.properties.pageController && !controllerMap.has(component.properties.pageController)) pushIssue(issues, `${resourcePath}.component.properties.pageController`, `Unknown page controller "${component.properties.pageController}".`);
|
|
16792
17051
|
for (const [childIndex, child] of component.displayList.entries()) {
|
|
16793
17052
|
if (child.kind === "component" && child.instanceProperties !== void 0 && !isValidUamComponentInstanceProperties(child.instanceProperties)) pushIssue(issues, `${resourcePath}.component.displayList[${childIndex}].instanceProperties`, "Component instance properties must be a complete valid extension snapshot.");
|
|
16794
17053
|
validateDisplayNode(child, controllerMap, childIds, groupIds, `${resourcePath}.component.displayList[${childIndex}]`, issues);
|
|
@@ -16855,6 +17114,7 @@ function validateUamReferences(project) {
|
|
|
16855
17114
|
"image",
|
|
16856
17115
|
"sound",
|
|
16857
17116
|
"misc",
|
|
17117
|
+
"swf",
|
|
16858
17118
|
"font",
|
|
16859
17119
|
"movieClip",
|
|
16860
17120
|
"spine",
|
|
@@ -16885,6 +17145,8 @@ function validateUamReferences(project) {
|
|
|
16885
17145
|
["dropdown", resource.component.properties.dropdown]
|
|
16886
17146
|
]) pushMissingUi(`${componentPath}.properties.${field}`, value, componentKinds, owner);
|
|
16887
17147
|
pushMissingUi(`${componentPath}.properties.sound`, resource.component.properties.sound, ["sound"], owner);
|
|
17148
|
+
pushMissingUi(`${componentPath}.properties.designImage`, resource.component.properties.designImage, ["image"], owner);
|
|
17149
|
+
for (const field of ["showSound", "hideSound"]) pushMissingUi(`${componentPath}.properties.${field}`, resource.component.properties[field], ["sound"], owner);
|
|
16888
17150
|
for (const [nodeIndex, node] of resource.component.displayList.entries()) {
|
|
16889
17151
|
const nodePath = `${componentPath}.displayList[${nodeIndex}]`;
|
|
16890
17152
|
const nodeOwner = {
|
|
@@ -16918,10 +17180,8 @@ function validateUamReferences(project) {
|
|
|
16918
17180
|
if (node.kind === "component" && node.instanceProperties) {
|
|
16919
17181
|
const instance = node.instanceProperties;
|
|
16920
17182
|
if ("icon" in instance) pushMissingUi(`${nodePath}.instanceProperties.icon`, instance.icon, visualKinds, nodeOwner);
|
|
16921
|
-
if (instance.extensionType === "Button") {
|
|
16922
|
-
|
|
16923
|
-
pushMissingUi(`${nodePath}.instanceProperties.sound`, instance.sound, ["sound"], nodeOwner);
|
|
16924
|
-
}
|
|
17183
|
+
if (instance.extensionType === "Button") pushMissingUi(`${nodePath}.instanceProperties.selectedIcon`, instance.selectedIcon, visualKinds, nodeOwner);
|
|
17184
|
+
if (instance.extensionType === "Button" || instance.extensionType === "Label" || instance.extensionType === "ComboBox" || instance.extensionType === "ProgressBar") pushMissingUi(`${nodePath}.instanceProperties.sound`, instance.sound, ["sound"], nodeOwner);
|
|
16925
17185
|
if (instance.extensionType === "ComboBox") for (const [itemIndex, item] of instance.items.entries()) pushMissingUi(`${nodePath}.instanceProperties.items[${itemIndex}].icon`, item.icon ?? "", visualKinds, nodeOwner);
|
|
16926
17186
|
}
|
|
16927
17187
|
if ("icon" in node) pushMissingUi(`${nodePath}.icon`, node.icon, visualKinds, nodeOwner);
|
|
@@ -16937,13 +17197,13 @@ function validateUamReferences(project) {
|
|
|
16937
17197
|
//#endregion
|
|
16938
17198
|
//#region ../core/src/uam/project-source-files.ts
|
|
16939
17199
|
function defaultAssetSourcePath(resource) {
|
|
16940
|
-
const fileName = resource.fileName ?? (
|
|
17200
|
+
const fileName = resource.fileName ?? ("file" in resource ? resource.file : "") ?? "";
|
|
16941
17201
|
return `/${[resource.path.replace(/\\/g, "/").replace(/^\/+|\/+$/g, ""), fileName].filter(Boolean).join("/")}`;
|
|
16942
17202
|
}
|
|
16943
17203
|
//#endregion
|
|
16944
17204
|
//#region ../core/src/uam/source-validation.ts
|
|
16945
17205
|
function assetFileName(resource) {
|
|
16946
|
-
return resource.fileName ?? (
|
|
17206
|
+
return resource.fileName ?? ("file" in resource ? resource.file : "") ?? resource.name;
|
|
16947
17207
|
}
|
|
16948
17208
|
function sourceExtension(resource) {
|
|
16949
17209
|
const fileName = assetFileName(resource);
|
|
@@ -16960,7 +17220,8 @@ function validSvg(bytes) {
|
|
|
16960
17220
|
if (/<(?:a|animate|animatecolor|animatemotion|animatetransform|audio|canvas|discard|embed|feimage|foreignobject|iframe|image|object|script|set|style|video)(?:\s|>)/iu.test(source)) return false;
|
|
16961
17221
|
if (/\s(?:on[\w:-]*|style|src)\s*=/iu.test(source)) return false;
|
|
16962
17222
|
if (/\s(?:href|xlink:href)\s*=\s*['"](?!#[A-Za-z_][\w:.-]*['"])/iu.test(source)) return false;
|
|
16963
|
-
|
|
17223
|
+
const urlSource = source.replace(/\sxmlns\s*=\s*(['"])http:\/\/www\.w3\.org\/2000\/svg\1/giu, "");
|
|
17224
|
+
return !/(?:https?:|file:|javascript:|data:|\/\/)|url\s*\(\s*(?!['"]?#[A-Za-z_])/iu.test(urlSource);
|
|
16964
17225
|
} catch {
|
|
16965
17226
|
return false;
|
|
16966
17227
|
}
|
|
@@ -17273,6 +17534,13 @@ function liftAssetResource(resource) {
|
|
|
17273
17534
|
file: misc.getFile()
|
|
17274
17535
|
};
|
|
17275
17536
|
}
|
|
17537
|
+
if (resource.propertyType === PropertyType.SWF_RESOURCE) {
|
|
17538
|
+
const swf = resource;
|
|
17539
|
+
return {
|
|
17540
|
+
...baseAssetResource("swf", swf),
|
|
17541
|
+
file: swf.getFile()
|
|
17542
|
+
};
|
|
17543
|
+
}
|
|
17276
17544
|
if (resource.propertyType === PropertyType.FONT_RESOURCE) {
|
|
17277
17545
|
const font = resource;
|
|
17278
17546
|
return {
|
|
@@ -17420,7 +17688,16 @@ function liftDisplayNode(child) {
|
|
|
17420
17688
|
kind: "image",
|
|
17421
17689
|
...liftDisplayNodeBase(image),
|
|
17422
17690
|
group: image.getGroup(),
|
|
17423
|
-
resource: {
|
|
17691
|
+
resource: {
|
|
17692
|
+
packageId: image.getPackageId(),
|
|
17693
|
+
resourceId: image.getSrc()
|
|
17694
|
+
},
|
|
17695
|
+
color: image.getColor(),
|
|
17696
|
+
flip: image.getFlip(),
|
|
17697
|
+
fillMethod: image.getFillMethod(),
|
|
17698
|
+
fillOrigin: image.getFillOrigin(),
|
|
17699
|
+
fillClockwise: image.getFillClockwise(),
|
|
17700
|
+
fillAmount: image.getFillAmount()
|
|
17424
17701
|
};
|
|
17425
17702
|
}
|
|
17426
17703
|
if (child.propertyType === PropertyType.G_TEXT_FIELD || child.propertyType === PropertyType.G_RICH_TEXT_FIELD || child.propertyType === PropertyType.G_TEXT_INPUT) {
|
|
@@ -17437,6 +17714,7 @@ function liftDisplayNode(child) {
|
|
|
17437
17714
|
autoSize: text.getAutoSize(),
|
|
17438
17715
|
singleLine: text.getSingleLine(),
|
|
17439
17716
|
autoClearText: text.getAutoClearText(),
|
|
17717
|
+
outlineSoftness: text.getOutlineSoftness(),
|
|
17440
17718
|
underlaySoftness: text.getUnderlaySoftness(),
|
|
17441
17719
|
ubbEnabled: text.getUbbEnabled(),
|
|
17442
17720
|
underline: text.getUnderline(),
|
|
@@ -17518,6 +17796,7 @@ function liftDisplayNode(child) {
|
|
|
17518
17796
|
src: list.getSrc(),
|
|
17519
17797
|
overflow: list.getOverflow(),
|
|
17520
17798
|
scrollType: list.getScrollType(),
|
|
17799
|
+
scrollBarDisplay: list.getScrollBarDisplay(),
|
|
17521
17800
|
scrollBarFlags: list.getScrollBarFlags(),
|
|
17522
17801
|
scrollBarMargin: liftEdgeInsets(list.getScrollBarMargin()),
|
|
17523
17802
|
vtScrollBarRes: list.getVtScrollBarRes(),
|
|
@@ -17600,6 +17879,7 @@ function liftDisplayNode(child) {
|
|
|
17600
17879
|
shrinkOnly: loader.getShrinkOnly(),
|
|
17601
17880
|
autoSize: loader.getAutoSize(),
|
|
17602
17881
|
useResize: loader.getUseResize(),
|
|
17882
|
+
showErrorSign: loader.getShowErrorSign(),
|
|
17603
17883
|
align: loader.getAlign(),
|
|
17604
17884
|
vAlign: loader.getVAlign(),
|
|
17605
17885
|
frame: loader.getFrame(),
|
|
@@ -17735,20 +18015,33 @@ function liftComponentInstanceProperties(component) {
|
|
|
17735
18015
|
icon: component.getInstanceIcon(),
|
|
17736
18016
|
titleColor: component.getInstanceTitleColor(),
|
|
17737
18017
|
titleFontSize: component.getInstanceTitleFontSize(),
|
|
17738
|
-
promptText: component.getInstancePromptText()
|
|
18018
|
+
promptText: component.getInstancePromptText(),
|
|
18019
|
+
sound: component.getInstanceSound(),
|
|
18020
|
+
soundVolumeScale: component.getInstanceSoundVolumeScale()
|
|
17739
18021
|
};
|
|
17740
18022
|
case "ComboBox": return {
|
|
17741
18023
|
extensionType: "ComboBox",
|
|
17742
18024
|
title: component.getInstanceTitle(),
|
|
17743
18025
|
icon: component.getInstanceIcon(),
|
|
18026
|
+
titleColor: component.getInstanceTitleColor(),
|
|
18027
|
+
popupDirection: component.getInstancePopupDirection(),
|
|
18028
|
+
sound: component.getInstanceSound(),
|
|
18029
|
+
soundVolumeScale: component.getInstanceSoundVolumeScale(),
|
|
17744
18030
|
visibleItemCount: component.getInstanceVisibleItemCount(),
|
|
17745
18031
|
selectionController: component.getInstanceSelectionController(),
|
|
17746
18032
|
autoClearItems: component.getInstanceAutoClearItems(),
|
|
17747
18033
|
items: component.getInstanceComboItems().map((item) => ({ ...item }))
|
|
17748
18034
|
};
|
|
17749
|
-
case "ProgressBar":
|
|
18035
|
+
case "ProgressBar": return {
|
|
18036
|
+
extensionType: "ProgressBar",
|
|
18037
|
+
value: component.getInstanceValue(),
|
|
18038
|
+
max: component.getInstanceMax(),
|
|
18039
|
+
min: component.getInstanceMin(),
|
|
18040
|
+
sound: component.getInstanceSound(),
|
|
18041
|
+
soundVolumeScale: component.getInstanceSoundVolumeScale()
|
|
18042
|
+
};
|
|
17750
18043
|
case "Slider": return {
|
|
17751
|
-
extensionType:
|
|
18044
|
+
extensionType: "Slider",
|
|
17752
18045
|
value: component.getInstanceValue(),
|
|
17753
18046
|
max: component.getInstanceMax(),
|
|
17754
18047
|
min: component.getInstanceMin()
|
|
@@ -17762,9 +18055,14 @@ function liftControllers(component) {
|
|
|
17762
18055
|
name: controller.getName(),
|
|
17763
18056
|
selectedIndex: controller.getSelectedIndex(),
|
|
17764
18057
|
autoRadioGroupDepth: controller.getAutoRadioGroupDepth(),
|
|
18058
|
+
alias: controller.getAlias(),
|
|
18059
|
+
exported: controller.getExported(),
|
|
18060
|
+
homePageType: controller.getHomePageType(),
|
|
18061
|
+
homePage: controller.getHomePage(),
|
|
17765
18062
|
pages: controller.listPages().map((page) => ({
|
|
17766
18063
|
id: page.getId(),
|
|
17767
|
-
name: page.getName()
|
|
18064
|
+
name: page.getName(),
|
|
18065
|
+
remark: page.getRemark()
|
|
17768
18066
|
})),
|
|
17769
18067
|
actions: controller.listActions().map((action) => ({
|
|
17770
18068
|
name: action.getName(),
|
|
@@ -17868,9 +18166,15 @@ function liftComponentProperties(resource) {
|
|
|
17868
18166
|
x: resource.getDesignImageOffsetX(),
|
|
17869
18167
|
y: resource.getDesignImageOffsetY()
|
|
17870
18168
|
},
|
|
18169
|
+
designImage: resource.getDesignImage(),
|
|
18170
|
+
designImageForTest: resource.getDesignImageForTest(),
|
|
18171
|
+
pageController: resource.getPageController(),
|
|
18172
|
+
showSound: resource.getAddedToStageSound(),
|
|
18173
|
+
hideSound: resource.getRemovedFromStageSound(),
|
|
17871
18174
|
idNum: resource.getIdNum(),
|
|
17872
18175
|
initName: resource.getInitName(),
|
|
17873
18176
|
remark: resource.getRemark(),
|
|
18177
|
+
customExtensionId: resource.getCustomExtensionId(),
|
|
17874
18178
|
extensionType: resource.getExtensionType(),
|
|
17875
18179
|
opaque: resource.getOpaque(),
|
|
17876
18180
|
buttonMode: resource.getButtonMode(),
|
|
@@ -18076,10 +18380,16 @@ const ROOT_COMPONENT_PANEL_ATTRS = {
|
|
|
18076
18380
|
bgColor: { canonical: "bgColor" },
|
|
18077
18381
|
bgColorEnabled: { canonical: "bgColorEnabled" },
|
|
18078
18382
|
idnum: { canonical: "idnum" },
|
|
18079
|
-
initName: { canonical: "initName" }
|
|
18383
|
+
initName: { canonical: "initName" },
|
|
18384
|
+
customExtention: { canonical: "customExtention" },
|
|
18385
|
+
pageController: { canonical: "pageController" },
|
|
18386
|
+
showSound: { canonical: "showSound" },
|
|
18387
|
+
hideSound: { canonical: "hideSound" }
|
|
18080
18388
|
};
|
|
18081
18389
|
const ROOT_MISC_PANEL_ATTRS = { remark: { canonical: "remark" } };
|
|
18082
18390
|
const ROOT_DESIGN_PANEL_ATTRS = {
|
|
18391
|
+
designImage: { canonical: "designImage" },
|
|
18392
|
+
designImageForTest: { canonical: "designImageForTest" },
|
|
18083
18393
|
designImageAlpha: { canonical: "designImageAlpha" },
|
|
18084
18394
|
designImageLayer: { canonical: "designImageLayer" },
|
|
18085
18395
|
designImageOffsetX: { canonical: "designImageOffsetX" },
|
|
@@ -18124,6 +18434,7 @@ const LOADER_PANEL_ATTRS = {
|
|
|
18124
18434
|
shrinkOnly: { canonical: "shrinkOnly" },
|
|
18125
18435
|
autoSize: { canonical: "autoSize" },
|
|
18126
18436
|
useResize: { canonical: "useResize" },
|
|
18437
|
+
errorSign: { canonical: "errorSign" },
|
|
18127
18438
|
color: { canonical: "color" },
|
|
18128
18439
|
playing: { canonical: "playing" },
|
|
18129
18440
|
frame: { canonical: "frame" },
|
|
@@ -18178,6 +18489,7 @@ const TEXT_PANEL_ATTRS = {
|
|
|
18178
18489
|
autoClearText: { canonical: "autoClearText" },
|
|
18179
18490
|
demoText: { canonical: "demoText" },
|
|
18180
18491
|
faceDilate: { canonical: "faceDilate" },
|
|
18492
|
+
outlineSoftness: { canonical: "outlineSoftness" },
|
|
18181
18493
|
underlaySoftness: { canonical: "underlaySoftness" },
|
|
18182
18494
|
vars: { canonical: "vars" }
|
|
18183
18495
|
};
|
|
@@ -18193,6 +18505,7 @@ const TEXT_INPUT_PANEL_ATTRS = {
|
|
|
18193
18505
|
};
|
|
18194
18506
|
const RICH_TEXT_PANEL_ATTRS = {
|
|
18195
18507
|
restrictSize: { canonical: "restrictSize" },
|
|
18508
|
+
outlineSoftness: { canonical: "outlineSoftness" },
|
|
18196
18509
|
underlaySoftness: { canonical: "underlaySoftness" }
|
|
18197
18510
|
};
|
|
18198
18511
|
const GROUP_PANEL_ATTRS = {
|
|
@@ -18249,10 +18562,7 @@ const LIST_PANEL_ATTRS = {
|
|
|
18249
18562
|
const BUTTON_EXTENSION_ATTRS = {
|
|
18250
18563
|
mode: { canonical: "mode" },
|
|
18251
18564
|
sound: { canonical: "sound" },
|
|
18252
|
-
soundVolumeScale: {
|
|
18253
|
-
canonical: "soundVolumeScale",
|
|
18254
|
-
aliases: ["volume"]
|
|
18255
|
-
},
|
|
18565
|
+
soundVolumeScale: { canonical: "volume" },
|
|
18256
18566
|
downEffect: { canonical: "downEffect" },
|
|
18257
18567
|
downEffectValue: { canonical: "downEffectValue" },
|
|
18258
18568
|
title: { canonical: "title" },
|
|
@@ -18270,12 +18580,18 @@ const LABEL_EXTENSION_ATTRS = {
|
|
|
18270
18580
|
icon: { canonical: "icon" },
|
|
18271
18581
|
titleColor: { canonical: "titleColor" },
|
|
18272
18582
|
titleFontSize: { canonical: "titleFontSize" },
|
|
18273
|
-
prompt: { canonical: "prompt" }
|
|
18583
|
+
prompt: { canonical: "prompt" },
|
|
18584
|
+
sound: { canonical: "sound" },
|
|
18585
|
+
soundVolumeScale: { canonical: "volume" }
|
|
18274
18586
|
};
|
|
18275
18587
|
const COMBOBOX_EXTENSION_ATTRS = {
|
|
18276
18588
|
dropdown: { canonical: "dropdown" },
|
|
18277
18589
|
title: { canonical: "title" },
|
|
18278
18590
|
icon: { canonical: "icon" },
|
|
18591
|
+
titleColor: { canonical: "titleColor" },
|
|
18592
|
+
popupDirection: { canonical: "direction" },
|
|
18593
|
+
sound: { canonical: "sound" },
|
|
18594
|
+
soundVolumeScale: { canonical: "volume" },
|
|
18279
18595
|
visibleItemCount: { canonical: "visibleItemCount" },
|
|
18280
18596
|
selectionController: { canonical: "selectionController" },
|
|
18281
18597
|
autoClearItems: { canonical: "autoClearItems" }
|
|
@@ -18285,7 +18601,9 @@ const PROGRESSBAR_EXTENSION_ATTRS = {
|
|
|
18285
18601
|
reverse: { canonical: "reverse" },
|
|
18286
18602
|
value: { canonical: "value" },
|
|
18287
18603
|
max: { canonical: "max" },
|
|
18288
|
-
min: { canonical: "min" }
|
|
18604
|
+
min: { canonical: "min" },
|
|
18605
|
+
sound: { canonical: "sound" },
|
|
18606
|
+
soundVolumeScale: { canonical: "volume" }
|
|
18289
18607
|
};
|
|
18290
18608
|
const SLIDER_EXTENSION_ATTRS = {
|
|
18291
18609
|
titleType: { canonical: "titleType" },
|
|
@@ -18325,7 +18643,12 @@ const GEAR_ATTRS = {
|
|
|
18325
18643
|
const CONTROLLER_ATTRS = {
|
|
18326
18644
|
name: { canonical: "name" },
|
|
18327
18645
|
pages: { canonical: "pages" },
|
|
18328
|
-
selected: { canonical: "selected" }
|
|
18646
|
+
selected: { canonical: "selected" },
|
|
18647
|
+
alias: { canonical: "alias" },
|
|
18648
|
+
autoRadioGroupDepth: { canonical: "autoRadioGroupDepth" },
|
|
18649
|
+
exported: { canonical: "exported" },
|
|
18650
|
+
homePageType: { canonical: "homePageType" },
|
|
18651
|
+
homePage: { canonical: "homePage" }
|
|
18329
18652
|
};
|
|
18330
18653
|
const CONTROLLER_ACTION_ATTRS = {
|
|
18331
18654
|
type: { canonical: "type" },
|
|
@@ -18339,6 +18662,10 @@ const CONTROLLER_ACTION_ATTRS = {
|
|
|
18339
18662
|
controller: { canonical: "controller" },
|
|
18340
18663
|
targetPage: { canonical: "targetPage" }
|
|
18341
18664
|
};
|
|
18665
|
+
const CONTROLLER_REMARK_ATTRS = {
|
|
18666
|
+
page: { canonical: "page" },
|
|
18667
|
+
value: { canonical: "value" }
|
|
18668
|
+
};
|
|
18342
18669
|
const TRANSITION_ATTRS = {
|
|
18343
18670
|
name: { canonical: "name" },
|
|
18344
18671
|
autoPlay: { canonical: "autoPlay" },
|
|
@@ -18348,7 +18675,7 @@ const TRANSITION_ATTRS = {
|
|
|
18348
18675
|
},
|
|
18349
18676
|
autoPlayDelay: { canonical: "autoPlayDelay" },
|
|
18350
18677
|
options: { canonical: "options" },
|
|
18351
|
-
fps: { canonical: "
|
|
18678
|
+
fps: { canonical: "frameRate" }
|
|
18352
18679
|
};
|
|
18353
18680
|
const TRANSITION_ITEM_ATTRS = {
|
|
18354
18681
|
time: { canonical: "time" },
|
|
@@ -18404,6 +18731,7 @@ const CUSTOM_PROPERTY_NODE = defineNode(CUSTOM_PROPERTY_ATTRS);
|
|
|
18404
18731
|
const PROPERTY_OVERRIDE_NODE = defineNode(PROPERTY_OVERRIDE_ATTRS);
|
|
18405
18732
|
const GEAR_NODE = defineNode(GEAR_ATTRS);
|
|
18406
18733
|
const CONTROLLER_ACTION_NODE = defineNode(CONTROLLER_ACTION_ATTRS);
|
|
18734
|
+
const CONTROLLER_REMARK_NODE = defineNode(CONTROLLER_REMARK_ATTRS);
|
|
18407
18735
|
const TRANSITION_ITEM_NODE = defineNode(TRANSITION_ITEM_ATTRS);
|
|
18408
18736
|
const LIST_ITEM_NODE = defineNode(LIST_ITEM_ATTRS, { property: PROPERTY_OVERRIDE_NODE });
|
|
18409
18737
|
const COMBOBOX_ITEM_NODE = defineNode(COMBOBOX_ITEM_ATTRS);
|
|
@@ -18428,7 +18756,10 @@ const WITH_GROUP_GEAR_CHILDREN = {
|
|
|
18428
18756
|
gearIcon: GEAR_NODE,
|
|
18429
18757
|
gearDisplay2: GEAR_NODE
|
|
18430
18758
|
};
|
|
18431
|
-
const WITH_CONTROLLER_ACTION_CHILDREN = {
|
|
18759
|
+
const WITH_CONTROLLER_ACTION_CHILDREN = {
|
|
18760
|
+
action: CONTROLLER_ACTION_NODE,
|
|
18761
|
+
remark: CONTROLLER_REMARK_NODE
|
|
18762
|
+
};
|
|
18432
18763
|
const WITH_TRANSITION_ITEM_CHILDREN = { item: TRANSITION_ITEM_NODE };
|
|
18433
18764
|
const WITH_LIST_ITEM_CHILDREN = { item: LIST_ITEM_NODE };
|
|
18434
18765
|
const COMBOBOX_EXTENSION_NODE = defineNode(mergeAttrs(COMBOBOX_EXTENSION_ATTRS), mergeChildren({ item: COMBOBOX_ITEM_NODE }));
|
|
@@ -18984,6 +19315,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
18984
19315
|
if (textVars !== void 0) g.setTemplateVarsEnabled?.(parseBool$1(textVars));
|
|
18985
19316
|
const textFaceDilate = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.faceDilate);
|
|
18986
19317
|
if (textFaceDilate !== void 0) g.setFaceDilate?.(parseFloat2(textFaceDilate));
|
|
19318
|
+
const textOutlineSoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.outlineSoftness);
|
|
19319
|
+
if (textOutlineSoftness !== void 0) g.setOutlineSoftness?.(parseFloat2(textOutlineSoftness));
|
|
18987
19320
|
const textUnderlaySoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underlaySoftness);
|
|
18988
19321
|
if (textUnderlaySoftness !== void 0) g.setUnderlaySoftness?.(parseFloat2(textUnderlaySoftness));
|
|
18989
19322
|
const textUbb = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.ubb);
|
|
@@ -19108,6 +19441,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19108
19441
|
if (richTextSingleLine !== void 0) g.setSingleLine?.(parseBool$1(richTextSingleLine));
|
|
19109
19442
|
const richTextAutoClearText = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.autoClearText);
|
|
19110
19443
|
if (richTextAutoClearText !== void 0) g.setAutoClearText?.(parseBool$1(richTextAutoClearText));
|
|
19444
|
+
const richTextOutlineSoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.outlineSoftness);
|
|
19445
|
+
if (richTextOutlineSoftness !== void 0) g.setOutlineSoftness?.(parseFloat2(richTextOutlineSoftness));
|
|
19111
19446
|
const richTextUnderlaySoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.underlaySoftness);
|
|
19112
19447
|
if (richTextUnderlaySoftness !== void 0) g.setUnderlaySoftness?.(parseFloat2(richTextUnderlaySoftness));
|
|
19113
19448
|
const richTextUnderline = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underline);
|
|
@@ -19217,6 +19552,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19217
19552
|
if (inputVars !== void 0) g.setTemplateVarsEnabled?.(parseBool$1(inputVars));
|
|
19218
19553
|
const inputFaceDilate = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.faceDilate);
|
|
19219
19554
|
if (inputFaceDilate !== void 0) g.setFaceDilate?.(parseFloat2(inputFaceDilate));
|
|
19555
|
+
const inputOutlineSoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.outlineSoftness);
|
|
19556
|
+
if (inputOutlineSoftness !== void 0) g.setOutlineSoftness?.(parseFloat2(inputOutlineSoftness));
|
|
19220
19557
|
const inputUnderlaySoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underlaySoftness);
|
|
19221
19558
|
if (inputUnderlaySoftness !== void 0) g.setUnderlaySoftness?.(parseFloat2(inputUnderlaySoftness));
|
|
19222
19559
|
const inputUbb = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.ubb);
|
|
@@ -19440,6 +19777,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19440
19777
|
if (loaderAutoSize !== void 0) g.setAutoSize?.(parseBool$1(loaderAutoSize));
|
|
19441
19778
|
const useResize = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.useResize);
|
|
19442
19779
|
if (useResize !== void 0) g.setUseResize?.(parseBool$1(useResize));
|
|
19780
|
+
const errorSign = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.errorSign);
|
|
19781
|
+
if (errorSign !== void 0) g.setShowErrorSign(parseBool$1(errorSign));
|
|
19443
19782
|
const clearOnPublish = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.clearOnPublish);
|
|
19444
19783
|
if (clearOnPublish !== void 0) g.setClearOnPublish?.(parseBool$1(clearOnPublish));
|
|
19445
19784
|
const loaderColor = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.color);
|
|
@@ -19745,7 +20084,7 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19745
20084
|
if (resolvedLayout === 4 && lineItemCount2 !== void 0) g.setLineCount?.(parseInt2(lineItemCount2));
|
|
19746
20085
|
}
|
|
19747
20086
|
const autoResizeItem = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem);
|
|
19748
|
-
|
|
20087
|
+
g.setAutoResizeItem?.(autoResizeItem === void 0 ? getDefaultListAutoResizeItem(g.getLayout?.() ?? 0) : parseBool$1(autoResizeItem));
|
|
19749
20088
|
const childrenRenderOrder = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder);
|
|
19750
20089
|
if (childrenRenderOrder) g.setChildrenRenderOrder?.({
|
|
19751
20090
|
ascent: 0,
|
|
@@ -19765,9 +20104,10 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19765
20104
|
if (selectionController !== void 0) g.setSelectionController?.(selectionController);
|
|
19766
20105
|
const overflow = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.overflow);
|
|
19767
20106
|
const scroll = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scroll);
|
|
20107
|
+
const scrollBar = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBar);
|
|
19768
20108
|
const scrollBarFlags = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarFlags);
|
|
19769
20109
|
const margin = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.margin);
|
|
19770
|
-
if (overflow || scroll || scrollBarFlags !== void 0 || margin) {
|
|
20110
|
+
if (overflow || scroll || scrollBar || scrollBarFlags !== void 0 || margin) {
|
|
19771
20111
|
if (overflow) g.setOverflow({
|
|
19772
20112
|
visible: 0,
|
|
19773
20113
|
hidden: 1,
|
|
@@ -19778,6 +20118,12 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19778
20118
|
vertical: 1,
|
|
19779
20119
|
both: 2
|
|
19780
20120
|
}[scroll] ?? 1);
|
|
20121
|
+
if (scrollBar) g.setScrollBarDisplay({
|
|
20122
|
+
default: 0,
|
|
20123
|
+
visible: 1,
|
|
20124
|
+
auto: 2,
|
|
20125
|
+
hidden: 3
|
|
20126
|
+
}[scrollBar] ?? 0);
|
|
19781
20127
|
if (scrollBarFlags !== void 0) g.setScrollBarFlags(parseInt2(scrollBarFlags));
|
|
19782
20128
|
if (margin) {
|
|
19783
20129
|
const parts = margin.split(",").map(Number);
|
|
@@ -19881,7 +20227,13 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19881
20227
|
const sound = extSpecs.sound ? readXmlAttr(extAttrs, extSpecs.sound) : void 0;
|
|
19882
20228
|
if (sound !== void 0) componentObj.setInstanceSound?.(sound);
|
|
19883
20229
|
const soundVolumeScale = extSpecs.soundVolumeScale ? readXmlAttr(extAttrs, extSpecs.soundVolumeScale) : void 0;
|
|
19884
|
-
if (soundVolumeScale !== void 0) componentObj.setInstanceSoundVolumeScale?.(parseFloat2(soundVolumeScale,
|
|
20230
|
+
if (soundVolumeScale !== void 0) componentObj.setInstanceSoundVolumeScale?.(parseFloat2(soundVolumeScale, 100) / 100);
|
|
20231
|
+
const popupDirection = extSpecs.popupDirection ? readXmlAttr(extAttrs, extSpecs.popupDirection) : void 0;
|
|
20232
|
+
if (popupDirection !== void 0) componentObj.setInstancePopupDirection?.({
|
|
20233
|
+
auto: 0,
|
|
20234
|
+
up: 1,
|
|
20235
|
+
down: 2
|
|
20236
|
+
}[popupDirection] ?? 0);
|
|
19885
20237
|
const prompt = extSpecs.prompt ? readXmlAttr(extAttrs, extSpecs.prompt) : void 0;
|
|
19886
20238
|
if (prompt !== void 0) componentObj.setInstancePromptText?.(prompt);
|
|
19887
20239
|
const selectionController = extSpecs.selectionController ? readXmlAttr(extAttrs, extSpecs.selectionController) : void 0;
|
|
@@ -19979,6 +20331,12 @@ const EXTENSION_TYPE_MAP = {
|
|
|
19979
20331
|
Slider: "GSlider",
|
|
19980
20332
|
ScrollBar: "GScrollBar"
|
|
19981
20333
|
};
|
|
20334
|
+
const CONTROLLER_HOME_PAGE_TYPES = new Set([
|
|
20335
|
+
"default",
|
|
20336
|
+
"specific",
|
|
20337
|
+
"branch",
|
|
20338
|
+
"variable"
|
|
20339
|
+
]);
|
|
19982
20340
|
const EXTENSION_PROTOCOL_MAP$1 = {
|
|
19983
20341
|
Button: PROJECT_XML_PROTOCOL.buttonExtension,
|
|
19984
20342
|
Label: PROJECT_XML_PROTOCOL.labelExtension,
|
|
@@ -20084,6 +20442,13 @@ function parseButtonMode(value) {
|
|
|
20084
20442
|
const parsed = Number(normalized);
|
|
20085
20443
|
return map[normalized] ?? (Number.isFinite(parsed) ? parsed : 0);
|
|
20086
20444
|
}
|
|
20445
|
+
function parseButtonDownEffect(value) {
|
|
20446
|
+
return {
|
|
20447
|
+
none: 0,
|
|
20448
|
+
dark: 1,
|
|
20449
|
+
scale: 2
|
|
20450
|
+
}[String(value ?? "").trim().toLowerCase()] ?? 0;
|
|
20451
|
+
}
|
|
20087
20452
|
function parseTitleType(value) {
|
|
20088
20453
|
if (typeof value === "number") return value;
|
|
20089
20454
|
const normalized = String(value ?? "").trim().toLowerCase();
|
|
@@ -20161,6 +20526,10 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
20161
20526
|
if (bgColor !== void 0) comp.setBgColor?.(bgColor);
|
|
20162
20527
|
const bgColorEnabled = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColorEnabled);
|
|
20163
20528
|
if (bgColorEnabled !== void 0) comp.setBgColorEnabled?.(parseBool$1(bgColorEnabled));
|
|
20529
|
+
const designImage = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImage);
|
|
20530
|
+
if (designImage !== void 0) comp.setDesignImage?.(designImage);
|
|
20531
|
+
const designImageForTest = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageForTest);
|
|
20532
|
+
if (designImageForTest !== void 0) comp.setDesignImageForTest?.(parseBool$1(designImageForTest));
|
|
20164
20533
|
const designImageAlpha = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageAlpha);
|
|
20165
20534
|
if (designImageAlpha !== void 0) comp.setDesignImageAlpha?.(parseInt2(designImageAlpha));
|
|
20166
20535
|
const designImageLayer = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageLayer);
|
|
@@ -20175,6 +20544,14 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
20175
20544
|
if (initName !== void 0) comp.setInitName?.(initName);
|
|
20176
20545
|
const remark = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.remark);
|
|
20177
20546
|
if (remark !== void 0) comp.setRemark?.(remark);
|
|
20547
|
+
const customExtensionId = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.customExtention);
|
|
20548
|
+
if (customExtensionId !== void 0) comp.setCustomExtensionId?.(customExtensionId);
|
|
20549
|
+
const pageController = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController);
|
|
20550
|
+
if (pageController !== void 0) comp.setPageController?.(pageController);
|
|
20551
|
+
const showSound = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.showSound);
|
|
20552
|
+
if (showSound !== void 0) comp.setAddedToStageSound?.(showSound);
|
|
20553
|
+
const hideSound = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.hideSound);
|
|
20554
|
+
if (hideSound !== void 0) comp.setRemovedFromStageSound?.(hideSound);
|
|
20178
20555
|
const clipSoftness = readXmlAttr(compNode, PROJECT_XML_PROTOCOL.componentRoot.attrs.clipSoftness);
|
|
20179
20556
|
if (clipSoftness) {
|
|
20180
20557
|
const parts = clipSoftness.split(",").map(Number);
|
|
@@ -20244,8 +20621,8 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
20244
20621
|
case "Button":
|
|
20245
20622
|
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.mode) !== void 0) comp.setButtonMode?.(parseButtonMode(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.mode)));
|
|
20246
20623
|
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.sound) !== void 0) comp.setSound?.(String(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.sound)));
|
|
20247
|
-
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale) !== void 0) comp.setSoundVolumeScale?.(parseFloat2(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.soundVolumeScale),
|
|
20248
|
-
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect) !== void 0) comp.setDownEffect?.(
|
|
20624
|
+
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);
|
|
20625
|
+
if (readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect) !== void 0) comp.setDownEffect?.(parseButtonDownEffect(readXmlAttr(extAttrs, EXTENSION_PROTOCOL_MAP$1.Button.attrs.downEffect)));
|
|
20249
20626
|
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));
|
|
20250
20627
|
break;
|
|
20251
20628
|
case "ComboBox":
|
|
@@ -20276,7 +20653,7 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
20276
20653
|
}
|
|
20277
20654
|
const customPropertyChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
20278
20655
|
const customProperties = customPropertyChildName ? ensureArray(compNode[customPropertyChildName]) : [];
|
|
20279
|
-
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children
|
|
20656
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children.customProperty;
|
|
20280
20657
|
comp.setCustomProperties(customProperties.flatMap((value) => {
|
|
20281
20658
|
const property = getXmlNode$1(value);
|
|
20282
20659
|
const propertyId = property ? parseInt2(readXmlAttr(property, customPropertyProtocol?.attrs.propertyId), -1) : -1;
|
|
@@ -20293,13 +20670,24 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
20293
20670
|
const ctrlName = readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.name) ?? "";
|
|
20294
20671
|
const ctrl = doc.createController(ctrlName);
|
|
20295
20672
|
const selected = readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.selected);
|
|
20296
|
-
|
|
20673
|
+
const homePageType = readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.homePageType) ?? "default";
|
|
20674
|
+
if (!CONTROLLER_HOME_PAGE_TYPES.has(homePageType)) throw new Error(`Controller "${ctrlName}" has unsupported homePageType "${homePageType}".`);
|
|
20675
|
+
ctrl.setSelectedIndex(parseInt2(selected)).setAlias(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.alias) ?? "").setAutoRadioGroupDepth(parseBool$1(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.autoRadioGroupDepth))).setExported(parseBool$1(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.exported))).setHomePageType(homePageType).setHomePage(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.homePage) ?? "");
|
|
20297
20676
|
const pages = parseControllerPages(readXmlAttr(ctrlDef, PROJECT_XML_PROTOCOL.controller.attrs.pages) ?? "");
|
|
20298
20677
|
for (const page of pages) {
|
|
20299
20678
|
const p = doc.createControllerPage(page.name);
|
|
20300
20679
|
p.setId(page.id);
|
|
20301
20680
|
ctrl.addPage(p);
|
|
20302
20681
|
}
|
|
20682
|
+
const controllerRemarkChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.controller, "remark");
|
|
20683
|
+
const controllerRemarkProtocol = PROJECT_XML_PROTOCOL.controller.children.remark;
|
|
20684
|
+
const remarks = controllerRemarkChildName ? ensureArray(ctrlDef[controllerRemarkChildName]) : [];
|
|
20685
|
+
for (const remarkDef of remarks) {
|
|
20686
|
+
const pageIndex = parseInt2(readXmlAttr(remarkDef, controllerRemarkProtocol.attrs.page), -1);
|
|
20687
|
+
const page = ctrl.listPages()[pageIndex];
|
|
20688
|
+
if (!page) continue;
|
|
20689
|
+
page.setRemark(readXmlAttr(remarkDef, controllerRemarkProtocol.attrs.value) ?? "");
|
|
20690
|
+
}
|
|
20303
20691
|
const controllerActionChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.controller, "action");
|
|
20304
20692
|
const actions = controllerActionChildName ? ensureArray(ctrlDef[controllerActionChildName]) : [];
|
|
20305
20693
|
for (let actionIndex = 0; actionIndex < actions.length; actionIndex += 1) {
|
|
@@ -21265,6 +21653,7 @@ var ProjectReader = class {
|
|
|
21265
21653
|
case "MovieClipResource": return resource.getFileName();
|
|
21266
21654
|
case "SoundResource":
|
|
21267
21655
|
case "MiscResource":
|
|
21656
|
+
case "SwfResource":
|
|
21268
21657
|
case "SpineResource":
|
|
21269
21658
|
case "DragonBonesResource": return resource.getFile();
|
|
21270
21659
|
default: return "";
|
|
@@ -21360,6 +21749,18 @@ var ProjectReader = class {
|
|
|
21360
21749
|
ctx.registerResource(pkg.getId(), id, res);
|
|
21361
21750
|
return res;
|
|
21362
21751
|
}
|
|
21752
|
+
case "swf": {
|
|
21753
|
+
const res = doc.createSwfResource(name.replace(/\.swf$/i, ""));
|
|
21754
|
+
res.setId(id);
|
|
21755
|
+
res.setPath(path);
|
|
21756
|
+
res.setBranch(branchName);
|
|
21757
|
+
res.setFile(name);
|
|
21758
|
+
res.setExported(exported);
|
|
21759
|
+
res.setFavorite(favorite);
|
|
21760
|
+
pkg.addResource(res);
|
|
21761
|
+
ctx.registerResource(pkg.getId(), id, res);
|
|
21762
|
+
return res;
|
|
21763
|
+
}
|
|
21363
21764
|
case "font": {
|
|
21364
21765
|
const res = doc.createFontResource(name.replace(/\.\w+$/, ""));
|
|
21365
21766
|
res.setId(id);
|
|
@@ -21440,6 +21841,7 @@ var ProjectReader = class {
|
|
|
21440
21841
|
ctx.registerResource(pkg.getId(), id, res);
|
|
21441
21842
|
return res;
|
|
21442
21843
|
}
|
|
21844
|
+
case "atlas": return null;
|
|
21443
21845
|
default:
|
|
21444
21846
|
ctx.addDiagnostic({
|
|
21445
21847
|
severity: "error",
|
|
@@ -21832,6 +22234,13 @@ function formatButtonMode(mode) {
|
|
|
21832
22234
|
2: "Radio"
|
|
21833
22235
|
}[mode] ?? "Common";
|
|
21834
22236
|
}
|
|
22237
|
+
function formatButtonDownEffect(effect) {
|
|
22238
|
+
return [
|
|
22239
|
+
"none",
|
|
22240
|
+
"dark",
|
|
22241
|
+
"scale"
|
|
22242
|
+
][effect] ?? "none";
|
|
22243
|
+
}
|
|
21835
22244
|
function formatTitleType(titleType) {
|
|
21836
22245
|
return {
|
|
21837
22246
|
0: "percent",
|
|
@@ -22094,6 +22503,7 @@ function serializeChild(obj) {
|
|
|
22094
22503
|
if (typedObj.getShrinkOnly?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.shrinkOnly, "1");
|
|
22095
22504
|
if (typedObj.getAutoSize?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.autoSize, "1");
|
|
22096
22505
|
if (typedObj.getUseResize?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.useResize, "1");
|
|
22506
|
+
if (typedObj.getShowErrorSign?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.errorSign, "true");
|
|
22097
22507
|
const loaderColor = typedObj.getColor?.();
|
|
22098
22508
|
if (loaderColor && !isDefaultWhiteColor(loaderColor)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.color, loaderColor);
|
|
22099
22509
|
if (typedObj.getFilter?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.filter, typedObj.getFilter?.());
|
|
@@ -22155,10 +22565,14 @@ function serializeChild(obj) {
|
|
|
22155
22565
|
if (typedObj.getTemplateVarsEnabled?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.vars, "true");
|
|
22156
22566
|
const faceDilate = typedObj.getFaceDilate?.() ?? 0;
|
|
22157
22567
|
if (faceDilate !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.faceDilate, String(faceDilate));
|
|
22568
|
+
const outlineSoftness = typedObj.getOutlineSoftness?.() ?? 0;
|
|
22569
|
+
if (outlineSoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.outlineSoftness, String(outlineSoftness));
|
|
22158
22570
|
const underlaySoftness = typedObj.getUnderlaySoftness?.() ?? 0;
|
|
22159
22571
|
if (underlaySoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underlaySoftness, String(underlaySoftness));
|
|
22160
22572
|
}
|
|
22161
22573
|
if (type === "GRichTextField") {
|
|
22574
|
+
const outlineSoftness = typedObj.getOutlineSoftness?.() ?? 0;
|
|
22575
|
+
if (outlineSoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.outlineSoftness, String(outlineSoftness));
|
|
22162
22576
|
const underlaySoftness = typedObj.getUnderlaySoftness?.() ?? 0;
|
|
22163
22577
|
if (underlaySoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.underlaySoftness, String(underlaySoftness));
|
|
22164
22578
|
}
|
|
@@ -22287,7 +22701,8 @@ function serializeChild(obj) {
|
|
|
22287
22701
|
if ((layout === 2 || layout === 4) && columnCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(columnCount));
|
|
22288
22702
|
else if (layout === 3 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(lineCount));
|
|
22289
22703
|
if (layout === 4 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount2, String(lineCount));
|
|
22290
|
-
|
|
22704
|
+
const autoResizeItem = typedObj.getAutoResizeItem?.() ?? true;
|
|
22705
|
+
if (autoResizeItem !== getDefaultListAutoResizeItem(layout ?? 0)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem, String(autoResizeItem));
|
|
22291
22706
|
const childrenRenderOrder = typedObj.getChildrenRenderOrder?.() ?? 0;
|
|
22292
22707
|
if (childrenRenderOrder !== 0) {
|
|
22293
22708
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder, {
|
|
@@ -22328,6 +22743,13 @@ function serializeChild(obj) {
|
|
|
22328
22743
|
1: "vertical",
|
|
22329
22744
|
2: "both"
|
|
22330
22745
|
}[scrollType] ?? "vertical");
|
|
22746
|
+
const scrollBarDisplay = typedObj.getScrollBarDisplay?.() ?? 0;
|
|
22747
|
+
if (overflow === 2 && scrollBarDisplay !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBar, {
|
|
22748
|
+
0: "default",
|
|
22749
|
+
1: "visible",
|
|
22750
|
+
2: "auto",
|
|
22751
|
+
3: "hidden"
|
|
22752
|
+
}[scrollBarDisplay] ?? "default");
|
|
22331
22753
|
const scrollBarFlags = typedObj.getScrollBarFlags?.() ?? 0;
|
|
22332
22754
|
if (scrollBarFlags !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarFlags, String(scrollBarFlags));
|
|
22333
22755
|
const scrollBarMargin = typedObj.getScrollBarMargin?.();
|
|
@@ -22428,8 +22850,13 @@ function serializeChild(obj) {
|
|
|
22428
22850
|
if (typedObj.getInstanceController?.() && extSpecs.controller) writeXmlAttr(extAttrs, extSpecs.controller, typedObj.getInstanceController?.());
|
|
22429
22851
|
if (typedObj.getInstancePage?.() && extSpecs.page) writeXmlAttr(extAttrs, extSpecs.page, typedObj.getInstancePage?.());
|
|
22430
22852
|
if (typedObj.getInstanceChecked?.() && extSpecs.checked) writeXmlAttr(extAttrs, extSpecs.checked, "1");
|
|
22853
|
+
const popupDirection = typedObj.getInstancePopupDirection?.() ?? 0;
|
|
22854
|
+
if (popupDirection !== 0 && extSpecs.popupDirection) writeXmlAttr(extAttrs, extSpecs.popupDirection, {
|
|
22855
|
+
1: "up",
|
|
22856
|
+
2: "down"
|
|
22857
|
+
}[popupDirection]);
|
|
22431
22858
|
if (typedObj.getInstanceSound?.() && extSpecs.sound) writeXmlAttr(extAttrs, extSpecs.sound, typedObj.getInstanceSound?.());
|
|
22432
|
-
if ((typedObj.getInstanceSoundVolumeScale?.() ?? 1) !== 1 && extSpecs.soundVolumeScale) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale,
|
|
22859
|
+
if ((typedObj.getInstanceSoundVolumeScale?.() ?? 1) !== 1 && extSpecs.soundVolumeScale) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, formatProjectInt32(Math.round((typedObj.getInstanceSoundVolumeScale?.() ?? 1) * 100), "component instance volume"));
|
|
22433
22860
|
if (typedObj.getInstancePromptText?.() && extSpecs.prompt) writeXmlAttr(extAttrs, extSpecs.prompt, typedObj.getInstancePromptText?.());
|
|
22434
22861
|
if (typedObj.getInstanceSelectionController?.() && extSpecs.selectionController) writeXmlAttr(extAttrs, extSpecs.selectionController, typedObj.getInstanceSelectionController?.());
|
|
22435
22862
|
if ((typedObj.getInstanceVisibleItemCount?.() ?? 0) > 0 && extSpecs.visibleItemCount) writeXmlAttr(extAttrs, extSpecs.visibleItemCount, String(typedObj.getInstanceVisibleItemCount?.() ?? 0));
|
|
@@ -22607,8 +23034,11 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22607
23034
|
if (typedComp.getBgColorEnabled?.()) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColorEnabled, "true");
|
|
22608
23035
|
const bgColor = typedComp.getBgColor?.();
|
|
22609
23036
|
if (bgColor) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColor, bgColor);
|
|
22610
|
-
const
|
|
22611
|
-
if (
|
|
23037
|
+
const designImage = typedComp.getDesignImage?.();
|
|
23038
|
+
if (designImage) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImage, designImage);
|
|
23039
|
+
if (typedComp.getDesignImageForTest?.()) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageForTest, "true");
|
|
23040
|
+
const designImageAlpha = typedComp.getDesignImageAlpha?.() ?? 50;
|
|
23041
|
+
if (designImageAlpha !== 50) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageAlpha, String(designImageAlpha));
|
|
22612
23042
|
const designImageLayer = typedComp.getDesignImageLayer?.() ?? 0;
|
|
22613
23043
|
if (designImageLayer !== 0) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageLayer, String(designImageLayer));
|
|
22614
23044
|
const designImageOffsetX = typedComp.getDesignImageOffsetX?.() ?? 0;
|
|
@@ -22621,6 +23051,14 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22621
23051
|
if (initName) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.initName, initName);
|
|
22622
23052
|
const remark = typedComp.getRemark?.();
|
|
22623
23053
|
if (remark) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.remark, remark);
|
|
23054
|
+
const customExtensionId = typedComp.getCustomExtensionId?.();
|
|
23055
|
+
if (customExtensionId) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.customExtention, customExtensionId);
|
|
23056
|
+
const pageController = typedComp.getPageController?.();
|
|
23057
|
+
if (pageController) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.pageController, pageController);
|
|
23058
|
+
const showSound = typedComp.getAddedToStageSound?.();
|
|
23059
|
+
if (showSound) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.showSound, showSound);
|
|
23060
|
+
const hideSound = typedComp.getRemovedFromStageSound?.();
|
|
23061
|
+
if (hideSound) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.hideSound, hideSound);
|
|
22624
23062
|
const clipSoftness = typedComp.getClipSoftness?.();
|
|
22625
23063
|
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"));
|
|
22626
23064
|
if (typedComp.getOpaque?.() === false) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.opaque, "false");
|
|
@@ -22677,7 +23115,7 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22677
23115
|
}
|
|
22678
23116
|
const customProperties = typedComp.getCustomProperties?.() ?? [];
|
|
22679
23117
|
const customPropertyChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
22680
|
-
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children
|
|
23118
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children.customProperty;
|
|
22681
23119
|
if (customProperties.length > 0 && customPropertyChildName) compNode[customPropertyChildName] = customProperties.map((property) => {
|
|
22682
23120
|
const attrs = {};
|
|
22683
23121
|
writeXmlAttr(attrs, customPropertyProtocol?.attrs.target, property.target);
|
|
@@ -22692,10 +23130,10 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22692
23130
|
case "Button": {
|
|
22693
23131
|
if ((typedComp.getButtonMode?.() ?? 0) !== 0) writeXmlAttr(extAttrs, extSpecs.mode, formatButtonMode(typedComp.getButtonMode?.() ?? 0));
|
|
22694
23132
|
if (typedComp.getSound?.()) writeXmlAttr(extAttrs, extSpecs.sound, typedComp.getSound?.());
|
|
22695
|
-
if ((typedComp.getSoundVolumeScale?.() ?? 1) !== 1) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, String(typedComp.getSoundVolumeScale?.() ?? 1));
|
|
23133
|
+
if ((typedComp.getSoundVolumeScale?.() ?? 1) !== 1) writeXmlAttr(extAttrs, extSpecs.soundVolumeScale, String(Math.round((typedComp.getSoundVolumeScale?.() ?? 1) * 100)));
|
|
22696
23134
|
const downEffect = typedComp.getDownEffect?.() ?? 0;
|
|
22697
23135
|
if (downEffect !== 0) {
|
|
22698
|
-
writeXmlAttr(extAttrs, extSpecs.downEffect,
|
|
23136
|
+
writeXmlAttr(extAttrs, extSpecs.downEffect, formatButtonDownEffect(downEffect));
|
|
22699
23137
|
writeXmlAttr(extAttrs, extSpecs.downEffectValue, formatButtonDownEffectValue(typedComp.getDownEffectValue?.() ?? .8));
|
|
22700
23138
|
}
|
|
22701
23139
|
break;
|
|
@@ -22736,11 +23174,27 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22736
23174
|
await fs.writeFile(targetPath, builder.build(xmlObj));
|
|
22737
23175
|
}
|
|
22738
23176
|
function serializeController(ctrl) {
|
|
22739
|
-
const
|
|
23177
|
+
const pages = ctrl.listPages();
|
|
23178
|
+
const pagesStr = pages.map((p) => `${p.getId()},${p.getName()}`).join(",");
|
|
22740
23179
|
const attrs = {};
|
|
22741
23180
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.name, ctrl.getName());
|
|
22742
23181
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.pages, pagesStr);
|
|
22743
23182
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.selected, String(ctrl.getSelectedIndex()));
|
|
23183
|
+
if (ctrl.getAlias()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.alias, ctrl.getAlias());
|
|
23184
|
+
if (ctrl.getAutoRadioGroupDepth()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.autoRadioGroupDepth, "true");
|
|
23185
|
+
if (ctrl.getExported()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.exported, "true");
|
|
23186
|
+
if (ctrl.getHomePageType() !== "default") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.homePageType, ctrl.getHomePageType());
|
|
23187
|
+
if (ctrl.getHomePageType() === "specific" || ctrl.getHomePageType() === "variable") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.homePage, ctrl.getHomePage());
|
|
23188
|
+
const remarkProtocol = PROJECT_XML_PROTOCOL.controller.children.remark;
|
|
23189
|
+
const remarks = pages.flatMap((page, pageIndex) => {
|
|
23190
|
+
if (!page.getRemark()) return [];
|
|
23191
|
+
const remarkAttrs = {};
|
|
23192
|
+
writeXmlAttr(remarkAttrs, remarkProtocol.attrs.page, String(pageIndex));
|
|
23193
|
+
writeXmlAttr(remarkAttrs, remarkProtocol.attrs.value, page.getRemark());
|
|
23194
|
+
return [remarkAttrs];
|
|
23195
|
+
});
|
|
23196
|
+
const remarkChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.controller, "remark");
|
|
23197
|
+
if (remarks.length > 0 && remarkChildName) attrs[remarkChildName] = remarks;
|
|
22744
23198
|
const actions = ctrl.listActions().map((action) => serializeControllerAction(action));
|
|
22745
23199
|
const actionChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.controller, "action");
|
|
22746
23200
|
if (actions.length > 0 && actionChildName) attrs[actionChildName] = actions;
|
|
@@ -23272,6 +23726,7 @@ var ProjectWriter = class {
|
|
|
23272
23726
|
SoundResource: "sound",
|
|
23273
23727
|
FontResource: "font",
|
|
23274
23728
|
MovieClipResource: "movieclip",
|
|
23729
|
+
SwfResource: "swf",
|
|
23275
23730
|
SpineResource: "spine",
|
|
23276
23731
|
DragonBonesResource: "dragonbones"
|
|
23277
23732
|
}[propertyType] ?? null;
|
|
@@ -23284,7 +23739,7 @@ var ProjectWriter = class {
|
|
|
23284
23739
|
const fileName = res.getFileName?.() ?? "";
|
|
23285
23740
|
if (fileName) return fileName;
|
|
23286
23741
|
}
|
|
23287
|
-
if (type === "SoundResource" || type === "MiscResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
23742
|
+
if (type === "SoundResource" || type === "MiscResource" || type === "SwfResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
23288
23743
|
const fileName = res.getFile?.() ?? "";
|
|
23289
23744
|
if (fileName) return fileName;
|
|
23290
23745
|
}
|
|
@@ -23531,21 +23986,31 @@ function decodeComponentControllers(doc, resource, buf) {
|
|
|
23531
23986
|
controller.addPage(page);
|
|
23532
23987
|
}
|
|
23533
23988
|
let homePageIndex = 0;
|
|
23989
|
+
let homePageType = controller.getHomePageType();
|
|
23990
|
+
let homePage = "";
|
|
23534
23991
|
if (controllerBuf.version >= 2 && remainingBytes(controllerBuf) >= 1) switch (controllerBuf.getUint8()) {
|
|
23535
23992
|
case 1:
|
|
23536
|
-
|
|
23993
|
+
homePageType = "specific";
|
|
23994
|
+
if (remainingBytes(controllerBuf) >= 2) {
|
|
23995
|
+
homePageIndex = controllerBuf.getInt16();
|
|
23996
|
+
homePage = controller.listPages()[homePageIndex]?.getId() ?? "";
|
|
23997
|
+
}
|
|
23537
23998
|
break;
|
|
23538
23999
|
case 2:
|
|
24000
|
+
homePageType = "branch";
|
|
23539
24001
|
homePageIndex = 0;
|
|
23540
24002
|
break;
|
|
23541
24003
|
case 3:
|
|
23542
|
-
|
|
24004
|
+
homePageType = "variable";
|
|
24005
|
+
if (remainingBytes(controllerBuf) >= 2) homePage = controllerBuf.readS() ?? "";
|
|
23543
24006
|
homePageIndex = 0;
|
|
23544
24007
|
break;
|
|
23545
24008
|
default:
|
|
24009
|
+
homePageType = "default";
|
|
23546
24010
|
homePageIndex = 0;
|
|
23547
24011
|
break;
|
|
23548
24012
|
}
|
|
24013
|
+
controller.setHomePageType(homePageType).setHomePage(homePage);
|
|
23549
24014
|
if (controller.listPages().length > 0) {
|
|
23550
24015
|
const maxIndex = controller.listPages().length - 1;
|
|
23551
24016
|
controller.setSelectedIndex(Math.min(Math.max(homePageIndex, 0), maxIndex));
|
|
@@ -23908,6 +24373,10 @@ function decodeChildBlock4ComponentLike(resource, child, childBuf) {
|
|
|
23908
24373
|
const controller = resource.listControllers()[pageControllerIndex];
|
|
23909
24374
|
if (controller && "setPageController" in child && typeof child.setPageController === "function") child.setPageController(controller.getName());
|
|
23910
24375
|
}
|
|
24376
|
+
if (childBuf.version >= 2 && remainingBytes(childBuf) >= 2) {
|
|
24377
|
+
const propertyOverrides = decodePropertyOverrides(childBuf);
|
|
24378
|
+
if ("setPropertyOverrides" in child && typeof child.setPropertyOverrides === "function") child.setPropertyOverrides(propertyOverrides);
|
|
24379
|
+
}
|
|
23911
24380
|
}
|
|
23912
24381
|
function decodeChildBlock4TextInput(child, childBuf) {
|
|
23913
24382
|
if (!childBuf.seek(0, 4) || remainingBytes(childBuf) < 10) return;
|
|
@@ -23923,16 +24392,12 @@ function decodeTextChildSpecific(child, childBuf) {
|
|
|
23923
24392
|
y: childBuf.getFloat32()
|
|
23924
24393
|
});
|
|
23925
24394
|
if (childBuf.readBool()) {}
|
|
23926
|
-
if (childBuf.version >= 3 && remainingBytes(childBuf) >= 13)
|
|
23927
|
-
textChild.setStrikethrough(childBuf.readBool());
|
|
23928
|
-
childBuf.skip(12);
|
|
23929
|
-
}
|
|
24395
|
+
if (childBuf.version >= 3 && remainingBytes(childBuf) >= 13) textChild.setStrikethrough(childBuf.readBool()).setFaceDilate(childBuf.getFloat32()).setOutlineSoftness(childBuf.getFloat32()).setUnderlaySoftness(childBuf.getFloat32());
|
|
23930
24396
|
}
|
|
23931
24397
|
function decodeListScrollPane(child, childBuf) {
|
|
23932
24398
|
if (!childBuf.seek(0, 7) || remainingBytes(childBuf) < 10) return;
|
|
23933
24399
|
const listLike = child;
|
|
23934
|
-
listLike.setScrollType(childBuf.getUint8());
|
|
23935
|
-
childBuf.getUint8();
|
|
24400
|
+
listLike.setScrollType(childBuf.getUint8()).setScrollBarDisplay(childBuf.getUint8());
|
|
23936
24401
|
listLike.setScrollBarFlags(childBuf.getInt32());
|
|
23937
24402
|
if (childBuf.readBool() && remainingBytes(childBuf) >= 16) listLike.setScrollBarMargin([
|
|
23938
24403
|
childBuf.getInt32(),
|
|
@@ -23942,20 +24407,26 @@ function decodeListScrollPane(child, childBuf) {
|
|
|
23942
24407
|
]);
|
|
23943
24408
|
listLike.setVtScrollBarRes(childBuf.readS() ?? "").setHzScrollBarRes(childBuf.readS() ?? "").setHeaderRes(childBuf.readS() ?? "").setFooterRes(childBuf.readS() ?? "");
|
|
23944
24409
|
}
|
|
24410
|
+
function decodePropertyOverrides(buf) {
|
|
24411
|
+
const count = buf.getInt16();
|
|
24412
|
+
const properties = [];
|
|
24413
|
+
for (let index = 0; index < count && remainingBytes(buf) >= 6; index += 1) properties.push({
|
|
24414
|
+
target: buf.readS() ?? "",
|
|
24415
|
+
propertyId: buf.getInt16(),
|
|
24416
|
+
value: buf.readS() ?? ""
|
|
24417
|
+
});
|
|
24418
|
+
return properties;
|
|
24419
|
+
}
|
|
23945
24420
|
function decodeListItemOverrides(buf, version) {
|
|
23946
|
-
if (remainingBytes(buf) < 2) return
|
|
24421
|
+
if (remainingBytes(buf) < 2) return {};
|
|
23947
24422
|
const controllerOverrideCount = buf.getInt16();
|
|
23948
24423
|
const controllerParts = [];
|
|
23949
24424
|
for (let index = 0; index < controllerOverrideCount && remainingBytes(buf) >= 4; index += 1) controllerParts.push(buf.readS() ?? "", buf.readS() ?? "");
|
|
23950
|
-
|
|
23951
|
-
|
|
23952
|
-
|
|
23953
|
-
|
|
23954
|
-
|
|
23955
|
-
buf.readS();
|
|
23956
|
-
}
|
|
23957
|
-
}
|
|
23958
|
-
return controllerParts.length > 0 ? controllerParts.join(",") : null;
|
|
24425
|
+
const propertyOverrides = version >= 2 && remainingBytes(buf) >= 2 ? decodePropertyOverrides(buf) : [];
|
|
24426
|
+
return {
|
|
24427
|
+
...controllerParts.length > 0 ? { controllers: controllerParts.join(",") } : {},
|
|
24428
|
+
...propertyOverrides.length > 0 ? { propertyOverrides } : {}
|
|
24429
|
+
};
|
|
23959
24430
|
}
|
|
23960
24431
|
function decodeListItems(child, childBuf) {
|
|
23961
24432
|
if (!childBuf.seek(0, 8) || remainingBytes(childBuf) < 4) return;
|
|
@@ -23984,10 +24455,9 @@ function decodeListItems(child, childBuf) {
|
|
|
23984
24455
|
level,
|
|
23985
24456
|
isFolder
|
|
23986
24457
|
};
|
|
23987
|
-
|
|
23988
|
-
items.push(controllers === null ? item : {
|
|
24458
|
+
items.push({
|
|
23989
24459
|
...item,
|
|
23990
|
-
|
|
24460
|
+
...decodeListItemOverrides(childBuf, childBuf.version)
|
|
23991
24461
|
});
|
|
23992
24462
|
childBuf.pos = nextPos;
|
|
23993
24463
|
}
|
|
@@ -24050,7 +24520,7 @@ function decodeChildBlock5(child, childBuf) {
|
|
|
24050
24520
|
if (remainingBytes(childBuf) < 15) return;
|
|
24051
24521
|
const loader = child;
|
|
24052
24522
|
loader.setUrl(childBuf.readS() ?? "").setAlign(childBuf.getUint8()).setVAlign(childBuf.getUint8()).setFill(childBuf.getUint8()).setShrinkOnly(childBuf.readBool()).setAutoSize(childBuf.readBool());
|
|
24053
|
-
childBuf.readBool();
|
|
24523
|
+
loader.setShowErrorSign(childBuf.readBool());
|
|
24054
24524
|
loader.setPlaying(childBuf.readBool()).setFrame(childBuf.getInt32());
|
|
24055
24525
|
if (childBuf.readBool()) loader.setColor(readColorValue(childBuf, false));
|
|
24056
24526
|
loader.setFillMethod(childBuf.getUint8());
|
|
@@ -24139,10 +24609,7 @@ function decodeChildBlock6(resource, child, childBuf) {
|
|
|
24139
24609
|
childBuf.readBool();
|
|
24140
24610
|
}
|
|
24141
24611
|
}
|
|
24142
|
-
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6)
|
|
24143
|
-
childBuf.readS();
|
|
24144
|
-
childBuf.getFloat32();
|
|
24145
|
-
}
|
|
24612
|
+
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
|
|
24146
24613
|
break;
|
|
24147
24614
|
case "ComboBox": {
|
|
24148
24615
|
if (remainingBytes(childBuf) < 2) return;
|
|
@@ -24160,24 +24627,17 @@ function decodeChildBlock6(resource, child, childBuf) {
|
|
|
24160
24627
|
}
|
|
24161
24628
|
component.setInstanceComboItems(items).setInstanceTitle(childBuf.readS() ?? "").setInstanceIcon(childBuf.readS() ?? "");
|
|
24162
24629
|
if (childBuf.readBool()) component.setInstanceTitleColor(readColorValue(childBuf, true));
|
|
24163
|
-
component.setInstanceVisibleItemCount(childBuf.getInt32());
|
|
24164
|
-
childBuf.getUint8();
|
|
24630
|
+
component.setInstanceVisibleItemCount(childBuf.getInt32()).setInstancePopupDirection(childBuf.getUint8());
|
|
24165
24631
|
const selectionControllerIndex = childBuf.getInt16();
|
|
24166
24632
|
if (selectionControllerIndex >= 0) component.setInstanceSelectionController(resource.listControllers()[selectionControllerIndex]?.getName() ?? "");
|
|
24167
|
-
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6)
|
|
24168
|
-
childBuf.readS();
|
|
24169
|
-
childBuf.getFloat32();
|
|
24170
|
-
}
|
|
24633
|
+
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
|
|
24171
24634
|
break;
|
|
24172
24635
|
}
|
|
24173
24636
|
case "ProgressBar":
|
|
24174
24637
|
case "Slider":
|
|
24175
24638
|
if (remainingBytes(childBuf) < 12) return;
|
|
24176
24639
|
component.setInstanceValue(childBuf.getInt32()).setInstanceMax(childBuf.getInt32()).setInstanceMin(childBuf.getInt32());
|
|
24177
|
-
if (extTypeName === "ProgressBar" && childBuf.version >= 5 && remainingBytes(childBuf) >= 6)
|
|
24178
|
-
childBuf.readS();
|
|
24179
|
-
childBuf.getFloat32();
|
|
24180
|
-
}
|
|
24640
|
+
if (extTypeName === "ProgressBar" && childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
|
|
24181
24641
|
break;
|
|
24182
24642
|
default: break;
|
|
24183
24643
|
}
|
|
@@ -24610,13 +25070,13 @@ var BinaryReader = class {
|
|
|
24610
25070
|
if (scaleOpt === 1) {
|
|
24611
25071
|
const x = buf.getInt32(), y = buf.getInt32();
|
|
24612
25072
|
const w = buf.getInt32(), h = buf.getInt32();
|
|
24613
|
-
buf.getInt32();
|
|
25073
|
+
const tileGridIndice = buf.getInt32();
|
|
24614
25074
|
res.setScaleOption(1).setScale9Grid([
|
|
24615
25075
|
x,
|
|
24616
25076
|
y,
|
|
24617
25077
|
w,
|
|
24618
25078
|
h
|
|
24619
|
-
]);
|
|
25079
|
+
]).setTileGridIndice(tileGridIndice);
|
|
24620
25080
|
} else if (scaleOpt === 2) res.setScaleOption(2);
|
|
24621
25081
|
res.setSmoothing(buf.readBool());
|
|
24622
25082
|
pkg.addResource(res);
|
|
@@ -24654,6 +25114,17 @@ var BinaryReader = class {
|
|
|
24654
25114
|
createdResource = res;
|
|
24655
25115
|
break;
|
|
24656
25116
|
}
|
|
25117
|
+
case BinItemType$1.Swf: {
|
|
25118
|
+
const res = doc.createSwfResource(itemName);
|
|
25119
|
+
res.setId(itemId).setPath(itemPath).setFile(itemFile).setExported(exported);
|
|
25120
|
+
res.setExtras({
|
|
25121
|
+
...res.getExtras(),
|
|
25122
|
+
_publishedFile: itemFile
|
|
25123
|
+
});
|
|
25124
|
+
pkg.addResource(res);
|
|
25125
|
+
createdResource = res;
|
|
25126
|
+
break;
|
|
25127
|
+
}
|
|
24657
25128
|
case BinItemType$1.Component: {
|
|
24658
25129
|
const res = doc.createComponent(itemName);
|
|
24659
25130
|
res.setId(itemId).setPath(itemPath).setExported(exported).setSize(width, height);
|
|
@@ -25187,7 +25658,27 @@ function _writeControllers(buf, comp) {
|
|
|
25187
25658
|
buf.writeSEx(page.getId?.() ?? "", false, false);
|
|
25188
25659
|
buf.writeSEx(page.getName?.() ?? "", false, false);
|
|
25189
25660
|
}
|
|
25190
|
-
|
|
25661
|
+
switch (ctrl.getHomePageType()) {
|
|
25662
|
+
case "default":
|
|
25663
|
+
buf.writeUint8(0);
|
|
25664
|
+
break;
|
|
25665
|
+
case "specific": {
|
|
25666
|
+
const homePageIndex = pages.findIndex((page) => page.getId() === ctrl.getHomePage());
|
|
25667
|
+
if (homePageIndex < 0) throw new Error(`Controller "${ctrl.getName()}" references unknown home page id "${ctrl.getHomePage()}".`);
|
|
25668
|
+
buf.writeUint8(1);
|
|
25669
|
+
buf.writeInt16(homePageIndex);
|
|
25670
|
+
break;
|
|
25671
|
+
}
|
|
25672
|
+
case "branch":
|
|
25673
|
+
buf.writeUint8(2);
|
|
25674
|
+
break;
|
|
25675
|
+
case "variable":
|
|
25676
|
+
if (!ctrl.getHomePage()) throw new Error(`Controller "${ctrl.getName()}" requires a custom property key.`);
|
|
25677
|
+
buf.writeUint8(3);
|
|
25678
|
+
buf.writeS(ctrl.getHomePage());
|
|
25679
|
+
break;
|
|
25680
|
+
default: throw new Error(`Controller "${ctrl.getName()}" has unsupported home page type.`);
|
|
25681
|
+
}
|
|
25191
25682
|
const cb2 = buf.pos - ctrlIndexPos;
|
|
25192
25683
|
const actions = ctrl.listActions?.() ?? [];
|
|
25193
25684
|
buf.writeInt16(actions.length);
|
|
@@ -25888,7 +26379,7 @@ function _writeDisplayList(buf, comp, _doc, pkg, version) {
|
|
|
25888
26379
|
const isTextInput = childType === "GTextInput";
|
|
25889
26380
|
if (isCompOrList) {
|
|
25890
26381
|
cb4 = buf.pos - childIndexPos;
|
|
25891
|
-
_writeChildBlock4Component(buf, child, comp, pkg);
|
|
26382
|
+
_writeChildBlock4Component(buf, child, comp, pkg, version);
|
|
25892
26383
|
} else if (isTextInput) {
|
|
25893
26384
|
cb4 = buf.pos - childIndexPos;
|
|
25894
26385
|
_writeChildBlock4TextInput(buf, child);
|
|
@@ -25982,9 +26473,9 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
25982
26473
|
buf.writeBool(false);
|
|
25983
26474
|
if (version >= 3) {
|
|
25984
26475
|
buf.writeBool(child.getStrikethrough?.() ?? false);
|
|
25985
|
-
buf.writeFloat32(0);
|
|
25986
|
-
buf.writeFloat32(0);
|
|
25987
|
-
buf.writeFloat32(0);
|
|
26476
|
+
buf.writeFloat32(child.getFaceDilate?.() ?? 0);
|
|
26477
|
+
buf.writeFloat32(child.getOutlineSoftness?.() ?? 0);
|
|
26478
|
+
buf.writeFloat32(child.getUnderlaySoftness?.() ?? 0);
|
|
25988
26479
|
}
|
|
25989
26480
|
break;
|
|
25990
26481
|
}
|
|
@@ -26036,13 +26527,13 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
26036
26527
|
buf.writeInt16(child.getMainGridIndex?.() ?? -1);
|
|
26037
26528
|
break;
|
|
26038
26529
|
case "GLoader": {
|
|
26039
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
26530
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
26040
26531
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
26041
26532
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
26042
26533
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
26043
26534
|
buf.writeBool(child.getShrinkOnly?.() ?? false);
|
|
26044
26535
|
buf.writeBool(_boolVal(child.getAutoSize?.(), false));
|
|
26045
|
-
buf.writeBool(false);
|
|
26536
|
+
buf.writeBool(child.getShowErrorSign?.() ?? false);
|
|
26046
26537
|
buf.writeBool(child.getPlaying?.() ?? true);
|
|
26047
26538
|
buf.writeInt32(child.getFrame?.() ?? 0);
|
|
26048
26539
|
const loaderColor = child.getColor?.() ?? null;
|
|
@@ -26061,7 +26552,7 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
26061
26552
|
break;
|
|
26062
26553
|
}
|
|
26063
26554
|
case "GLoader3D": {
|
|
26064
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
26555
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
26065
26556
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
26066
26557
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
26067
26558
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
@@ -26141,7 +26632,7 @@ function _writeChildAfterAdd(buf, child, comp, pkg, version) {
|
|
|
26141
26632
|
case "GTextField":
|
|
26142
26633
|
case "GRichTextField":
|
|
26143
26634
|
case "GTextInput":
|
|
26144
|
-
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getText?.() ?? null), true);
|
|
26635
|
+
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getAutoClearText?.() ? null : child.getText?.() ?? null), true);
|
|
26145
26636
|
break;
|
|
26146
26637
|
case "GButton": {
|
|
26147
26638
|
buf.writeUint8(12);
|
|
@@ -26206,7 +26697,9 @@ function _writeChildAfterAdd(buf, child, comp, pkg, version) {
|
|
|
26206
26697
|
}
|
|
26207
26698
|
buf.writeSEx(child.getTitle?.() ?? null, true);
|
|
26208
26699
|
buf.writeS(remapLocalUiUrl(pkg, child.getIcon?.() ?? null));
|
|
26209
|
-
|
|
26700
|
+
const comboTitleColor = child.getTitleColor?.() ?? null;
|
|
26701
|
+
buf.writeBool(!!comboTitleColor);
|
|
26702
|
+
if (comboTitleColor) buf.writeColor(comboTitleColor, true);
|
|
26210
26703
|
buf.writeInt32(child.getVisibleItemCount?.() ?? 10);
|
|
26211
26704
|
buf.writeUint8(child.getPopupDirection?.() ?? 0);
|
|
26212
26705
|
buf.writeInt16(-1);
|
|
@@ -26288,13 +26781,13 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26288
26781
|
buf.writeInt32(child.getInstanceTitleFontSize?.() ?? 0);
|
|
26289
26782
|
buf.writeBool(false);
|
|
26290
26783
|
if (version >= 5) {
|
|
26291
|
-
buf.writeS(null);
|
|
26292
|
-
buf.writeFloat32(1);
|
|
26784
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
|
|
26785
|
+
buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
|
|
26293
26786
|
}
|
|
26294
26787
|
break;
|
|
26295
26788
|
}
|
|
26296
26789
|
case "ComboBox": {
|
|
26297
|
-
const comboItems = child.getInstanceComboItems?.() ?? [];
|
|
26790
|
+
const comboItems = child.getInstanceAutoClearItems?.() ? [] : child.getInstanceComboItems?.() ?? [];
|
|
26298
26791
|
buf.writeInt16(comboItems.length);
|
|
26299
26792
|
for (const item of comboItems) {
|
|
26300
26793
|
const itemStart = buf.pos;
|
|
@@ -26314,11 +26807,11 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26314
26807
|
buf.writeBool(!!comboTitleColor);
|
|
26315
26808
|
if (comboTitleColor) buf.writeColor(comboTitleColor, true);
|
|
26316
26809
|
buf.writeInt32(child.getInstanceVisibleItemCount?.() ?? 10);
|
|
26317
|
-
buf.writeUint8(0);
|
|
26810
|
+
buf.writeUint8(child.getInstancePopupDirection?.() ?? 0);
|
|
26318
26811
|
buf.writeInt16(-1);
|
|
26319
26812
|
if (version >= 5) {
|
|
26320
|
-
buf.writeS(null);
|
|
26321
|
-
buf.writeFloat32(1);
|
|
26813
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
|
|
26814
|
+
buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
|
|
26322
26815
|
}
|
|
26323
26816
|
break;
|
|
26324
26817
|
}
|
|
@@ -26328,8 +26821,8 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26328
26821
|
buf.writeInt32(child.getInstanceMax?.() ?? 100);
|
|
26329
26822
|
buf.writeInt32(child.getInstanceMin?.() ?? 0);
|
|
26330
26823
|
if (version >= 5 && extType === "ProgressBar") {
|
|
26331
|
-
buf.writeS(null);
|
|
26332
|
-
buf.writeFloat32(1);
|
|
26824
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
|
|
26825
|
+
buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
|
|
26333
26826
|
}
|
|
26334
26827
|
break;
|
|
26335
26828
|
default: break;
|
|
@@ -26337,7 +26830,7 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26337
26830
|
}
|
|
26338
26831
|
function _writeScrollPane(buf, child, pkg) {
|
|
26339
26832
|
buf.writeUint8(child.getScrollType?.() ?? 1);
|
|
26340
|
-
buf.writeUint8(0);
|
|
26833
|
+
buf.writeUint8(child.getScrollBarDisplay?.() ?? 0);
|
|
26341
26834
|
buf.writeInt32(child.getScrollBarFlags?.() ?? 0);
|
|
26342
26835
|
const sbMargin = child.getScrollBarMargin?.();
|
|
26343
26836
|
buf.writeBool(!!sbMargin);
|
|
@@ -26355,7 +26848,7 @@ function _writeScrollPane(buf, child, pkg) {
|
|
|
26355
26848
|
function _writeListItems(buf, child, pkg, version) {
|
|
26356
26849
|
buf.writeS(remapLocalUiUrl(pkg, child.getDefaultItem?.() ?? null));
|
|
26357
26850
|
const isTree = child.propertyType === "GTree";
|
|
26358
|
-
const listItems = child.getListItems?.() ?? [];
|
|
26851
|
+
const listItems = child.getAutoClearItems?.() ? [] : child.getListItems?.() ?? [];
|
|
26359
26852
|
buf.writeInt16(listItems.length);
|
|
26360
26853
|
for (const [index, item] of listItems.entries()) {
|
|
26361
26854
|
const itemStart = buf.pos;
|
|
@@ -26385,7 +26878,7 @@ function _writeListItems(buf, child, pkg, version) {
|
|
|
26385
26878
|
buf.pos = controllerCountPos;
|
|
26386
26879
|
buf.writeInt16(controllerCount);
|
|
26387
26880
|
buf.pos = controllerEnd;
|
|
26388
|
-
if (version >= 2) buf.
|
|
26881
|
+
if (version >= 2) _writePropertyOverrides(buf, item.propertyOverrides ?? []);
|
|
26389
26882
|
const itemEnd = buf.pos;
|
|
26390
26883
|
const saved = buf.pos;
|
|
26391
26884
|
buf.pos = itemStart;
|
|
@@ -26397,7 +26890,7 @@ function _writeTreeSettings(buf, child) {
|
|
|
26397
26890
|
buf.writeInt32(child.getIndent?.() ?? 0);
|
|
26398
26891
|
buf.writeUint8(child.getClickToExpand?.() ?? 0);
|
|
26399
26892
|
}
|
|
26400
|
-
function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
26893
|
+
function _writeChildBlock4Component(buf, child, comp, _pkg, version) {
|
|
26401
26894
|
const pageCtrlName = child.getPageController?.() ?? null;
|
|
26402
26895
|
if (pageCtrlName) {
|
|
26403
26896
|
const ctrlIdx = comp.listControllers().findIndex((c) => c.getName() === pageCtrlName);
|
|
@@ -26419,7 +26912,15 @@ function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
|
26419
26912
|
buf.writeInt16(count);
|
|
26420
26913
|
buf.pos = saved;
|
|
26421
26914
|
} else buf.writeInt16(0);
|
|
26422
|
-
buf.
|
|
26915
|
+
if (version >= 2) _writePropertyOverrides(buf, child.getPropertyOverrides?.() ?? []);
|
|
26916
|
+
}
|
|
26917
|
+
function _writePropertyOverrides(buf, overrides) {
|
|
26918
|
+
buf.writeInt16(overrides.length);
|
|
26919
|
+
for (const property of overrides) {
|
|
26920
|
+
buf.writeS(property.target);
|
|
26921
|
+
buf.writeInt16(property.propertyId);
|
|
26922
|
+
buf.writeSEx(property.value, true);
|
|
26923
|
+
}
|
|
26423
26924
|
}
|
|
26424
26925
|
function _writeChildBlock4TextInput(buf, child) {
|
|
26425
26926
|
buf.writeSEx(child.getPromptText?.() ?? child.getPrompt?.() ?? null);
|
|
@@ -26484,6 +26985,7 @@ const BinItemType = {
|
|
|
26484
26985
|
Component: 3,
|
|
26485
26986
|
Atlas: 4,
|
|
26486
26987
|
Font: 5,
|
|
26988
|
+
Swf: 6,
|
|
26487
26989
|
Misc: 7,
|
|
26488
26990
|
Unknown: 8,
|
|
26489
26991
|
Spine: 9,
|
|
@@ -26501,6 +27003,7 @@ const EDITOR_TYPE_STRING = {
|
|
|
26501
27003
|
SoundResource: "sound",
|
|
26502
27004
|
Component: "component",
|
|
26503
27005
|
FontResource: "font",
|
|
27006
|
+
SwfResource: "swf",
|
|
26504
27007
|
SpineResource: "spine",
|
|
26505
27008
|
DragonBonesResource: "dragonbones"
|
|
26506
27009
|
};
|
|
@@ -26649,7 +27152,7 @@ var BinaryWriter = class {
|
|
|
26649
27152
|
data.writeInt32(grid[1]);
|
|
26650
27153
|
data.writeInt32(grid[2]);
|
|
26651
27154
|
data.writeInt32(grid[3]);
|
|
26652
|
-
data.writeInt32(
|
|
27155
|
+
data.writeInt32(res.getTileGridIndice());
|
|
26653
27156
|
}
|
|
26654
27157
|
data.writeBool(res.getSmoothing());
|
|
26655
27158
|
break;
|
|
@@ -26703,6 +27206,16 @@ var BinaryWriter = class {
|
|
|
26703
27206
|
data.writeInt32(0);
|
|
26704
27207
|
data.writeInt32(0);
|
|
26705
27208
|
break;
|
|
27209
|
+
case "SwfResource":
|
|
27210
|
+
data.writeUint8(BinItemType.Swf);
|
|
27211
|
+
data.writeS(getPublishedItemId$1(res));
|
|
27212
|
+
data.writeS(res.getName());
|
|
27213
|
+
data.writeS(res.getPath());
|
|
27214
|
+
data.writeS(getPublishedFileName(res));
|
|
27215
|
+
data.writeBool(res.getExported());
|
|
27216
|
+
data.writeInt32(0);
|
|
27217
|
+
data.writeInt32(0);
|
|
27218
|
+
break;
|
|
26706
27219
|
case "Component": {
|
|
26707
27220
|
data.writeUint8(BinItemType.Component);
|
|
26708
27221
|
data.writeS(getPublishedItemId$1(res));
|
|
@@ -26846,13 +27359,15 @@ var BinaryWriter = class {
|
|
|
26846
27359
|
const oh = sp.originalHeight ?? 0;
|
|
26847
27360
|
const isPackageItemSprite = packageItemIds.has(sp.itemId);
|
|
26848
27361
|
const isZeroSizedDirectOutput = isPackageItemSprite && sp.w === 0 && sp.h === 0;
|
|
26849
|
-
const
|
|
27362
|
+
const originalWidth = ow || (sp.rotated ? sp.h : sp.w);
|
|
27363
|
+
const originalHeight = oh || (sp.rotated ? sp.w : sp.h);
|
|
27364
|
+
const hasOriginal = isPackageItemSprite && sp.rotated || ox !== 0 || oy !== 0 || originalWidth !== (sp.rotated ? sp.h : sp.w) || originalHeight !== (sp.rotated ? sp.w : sp.h) || isZeroSizedDirectOutput;
|
|
26850
27365
|
data.writeBool(hasOriginal);
|
|
26851
27366
|
if (hasOriginal) {
|
|
26852
27367
|
data.writeInt32(ox);
|
|
26853
27368
|
data.writeInt32(oy);
|
|
26854
|
-
data.writeInt32(
|
|
26855
|
-
data.writeInt32(
|
|
27369
|
+
data.writeInt32(originalWidth);
|
|
27370
|
+
data.writeInt32(originalHeight);
|
|
26856
27371
|
}
|
|
26857
27372
|
}
|
|
26858
27373
|
const spriteNextPos = data.pos;
|
|
@@ -27177,7 +27692,7 @@ function createTransform(name, fn) {
|
|
|
27177
27692
|
Object.defineProperty(fn, "name", { value: name });
|
|
27178
27693
|
return fn;
|
|
27179
27694
|
}
|
|
27180
|
-
function parseTextureSetMode(value) {
|
|
27695
|
+
function parseTextureSetMode(value, maxAtlasIndex = 10) {
|
|
27181
27696
|
const raw = value?.trim() ?? "";
|
|
27182
27697
|
if (!raw) return {
|
|
27183
27698
|
kind: "auto",
|
|
@@ -27200,7 +27715,7 @@ function parseTextureSetMode(value) {
|
|
|
27200
27715
|
};
|
|
27201
27716
|
if (/^\d+$/.test(raw)) {
|
|
27202
27717
|
const pageIndex = Number(raw);
|
|
27203
|
-
if (pageIndex >= 0 && pageIndex <=
|
|
27718
|
+
if (pageIndex >= 0 && pageIndex <= maxAtlasIndex) return {
|
|
27204
27719
|
kind: "page",
|
|
27205
27720
|
raw,
|
|
27206
27721
|
pageIndex
|
|
@@ -27258,9 +27773,9 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
27258
27773
|
const sourcePackageId = child.getPackageId?.()?.trim();
|
|
27259
27774
|
if (sourcePackageId && sourcePackageId !== ownerPackageId) target.packageIds.add(sourcePackageId);
|
|
27260
27775
|
addFontReferences(target, ownerPackageId, child.getFont?.());
|
|
27261
|
-
addTextReferences(target, ownerPackageId, child.getText?.());
|
|
27776
|
+
if (!child.getAutoClearText?.()) addTextReferences(target, ownerPackageId, child.getText?.());
|
|
27262
27777
|
for (const reference of [
|
|
27263
|
-
child.getUrl?.(),
|
|
27778
|
+
child.getClearOnPublish?.() ? void 0 : child.getUrl?.(),
|
|
27264
27779
|
child.getDefaultItem?.(),
|
|
27265
27780
|
child.getIcon?.(),
|
|
27266
27781
|
child.getSelectedIcon?.(),
|
|
@@ -27274,11 +27789,14 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
27274
27789
|
child.getHeaderRes?.(),
|
|
27275
27790
|
child.getFooterRes?.()
|
|
27276
27791
|
]) addUiReference(target, ownerPackageId, reference);
|
|
27277
|
-
for (const item of child.getInstanceComboItems?.() ?? []) addUiReference(target, ownerPackageId, item.icon);
|
|
27278
|
-
for (const item of child.getListItems?.() ?? []) {
|
|
27792
|
+
for (const item of child.getInstanceAutoClearItems?.() ? [] : child.getInstanceComboItems?.() ?? []) addUiReference(target, ownerPackageId, item.icon);
|
|
27793
|
+
for (const item of child.getAutoClearItems?.() ? [] : child.getListItems?.() ?? []) {
|
|
27279
27794
|
addUiReference(target, ownerPackageId, item.icon);
|
|
27795
|
+
addUiReference(target, ownerPackageId, item.selectedIcon);
|
|
27280
27796
|
addUiReference(target, ownerPackageId, item.url);
|
|
27797
|
+
addUnknownReferences(target, ownerPackageId, item.propertyOverrides?.map((property) => property.value));
|
|
27281
27798
|
}
|
|
27799
|
+
addUnknownReferences(target, ownerPackageId, child.getPropertyOverrides?.().map((property) => property.value));
|
|
27282
27800
|
for (const gear of child.listGears?.() ?? []) {
|
|
27283
27801
|
addUnknownReferences(target, ownerPackageId, gear.getValues?.());
|
|
27284
27802
|
addUnknownReferences(target, ownerPackageId, gear.getDefaultValue?.());
|
|
@@ -27308,7 +27826,8 @@ function collectPackageResourceReferences(pkg) {
|
|
|
27308
27826
|
localResourceIds: /* @__PURE__ */ new Set(),
|
|
27309
27827
|
packageIds: /* @__PURE__ */ new Set()
|
|
27310
27828
|
};
|
|
27311
|
-
|
|
27829
|
+
const excludedResourceIds = new Set(pkg.getSourceAtlasSettings().excludedResourceIds);
|
|
27830
|
+
for (const resource of pkg.listResources()) if (resource.propertyType === "Component" && !excludedResourceIds.has(resource.getId())) collectComponentReferences(references, pkg.getId(), resource);
|
|
27312
27831
|
return references;
|
|
27313
27832
|
}
|
|
27314
27833
|
//#endregion
|
|
@@ -27335,6 +27854,9 @@ function isFontResource(resource) {
|
|
|
27335
27854
|
function isSoundResource(resource) {
|
|
27336
27855
|
return resource.propertyType === "SoundResource";
|
|
27337
27856
|
}
|
|
27857
|
+
function isSwfResource(resource) {
|
|
27858
|
+
return resource.propertyType === "SwfResource";
|
|
27859
|
+
}
|
|
27338
27860
|
function isSpineResource(resource) {
|
|
27339
27861
|
return resource.propertyType === "SpineResource";
|
|
27340
27862
|
}
|
|
@@ -27376,10 +27898,12 @@ function extname(fileName) {
|
|
|
27376
27898
|
return normalized.slice(lastDot);
|
|
27377
27899
|
}
|
|
27378
27900
|
function resolvePublishedMiscFileName(resource, projectType) {
|
|
27379
|
-
const
|
|
27380
|
-
if (projectType
|
|
27381
|
-
|
|
27382
|
-
|
|
27901
|
+
const fileName = `${getPublishedId(resource)}${extname(resource.getFile())}`;
|
|
27902
|
+
if (projectType === UNITY_PROJECT_TYPE$1 && fileName.toLowerCase().endsWith(".atlas")) return `${fileName}.txt`;
|
|
27903
|
+
return fileName;
|
|
27904
|
+
}
|
|
27905
|
+
function resolvePublishedSwfFileName(resource) {
|
|
27906
|
+
return `${getPublishedId(resource)}${extname(resource.getFile()) || ".swf"}`;
|
|
27383
27907
|
}
|
|
27384
27908
|
function resolvePublishedSkeletonFileName(resource, projectType) {
|
|
27385
27909
|
if (projectType === UNITY_PROJECT_TYPE$1 && isSpineResource(resource) && resource.getFile().toLowerCase().endsWith(".skel")) return `${resource.getFile()}.bytes`;
|
|
@@ -27446,16 +27970,16 @@ function trimTrailingMissingHighResolutionIds(ids) {
|
|
|
27446
27970
|
while (ids.length > 0 && !ids[ids.length - 1]) ids.pop();
|
|
27447
27971
|
return ids;
|
|
27448
27972
|
}
|
|
27449
|
-
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution) {
|
|
27973
|
+
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution, excludedResourceIds) {
|
|
27450
27974
|
const result = /* @__PURE__ */ new Map();
|
|
27451
27975
|
if (includeHighResolution <= 0) return result;
|
|
27452
27976
|
const highResolutionResourceByKey = /* @__PURE__ */ new Map();
|
|
27453
27977
|
for (const resource of resources) {
|
|
27454
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
27978
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
27455
27979
|
highResolutionResourceByKey.set(buildHighResolutionResourceKey(resource), resource);
|
|
27456
27980
|
}
|
|
27457
27981
|
for (const resource of resources) {
|
|
27458
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
27982
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
27459
27983
|
if (!publishedResourceIds.has(resource.getId())) continue;
|
|
27460
27984
|
if (isHighResolutionVariantName(resource.getName())) continue;
|
|
27461
27985
|
const ids = [];
|
|
@@ -27480,6 +28004,7 @@ function collectHighResolutionItemIds(resources, publishedResourceIds, includeHi
|
|
|
27480
28004
|
}
|
|
27481
28005
|
function collectPackagePublishContext(pkg, options) {
|
|
27482
28006
|
const resources = pkg.listResources();
|
|
28007
|
+
const excludedResourceIds = new Set(pkg.getSourceAtlasSettings().excludedResourceIds);
|
|
27483
28008
|
const resourceMap = new Map(resources.map((resource) => [resource.getId(), resource]));
|
|
27484
28009
|
const referencedIds = collectPackageResourceReferences(pkg).localResourceIds;
|
|
27485
28010
|
const pixelHitTestImageIds = /* @__PURE__ */ new Set();
|
|
@@ -27491,10 +28016,15 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27491
28016
|
while (changed) {
|
|
27492
28017
|
changed = false;
|
|
27493
28018
|
for (const resourceId of [...exportedResourceIds]) {
|
|
28019
|
+
if (excludedResourceIds.has(resourceId)) {
|
|
28020
|
+
exportedResourceIds.delete(resourceId);
|
|
28021
|
+
changed = true;
|
|
28022
|
+
continue;
|
|
28023
|
+
}
|
|
27494
28024
|
const resource = resourcesById.get(resourceId);
|
|
27495
28025
|
if (!resource || !isSkeletonResource(resource)) continue;
|
|
27496
28026
|
for (const requiredId of resource.getRequireIds()) {
|
|
27497
|
-
if (!requiredId || exportedResourceIds.has(requiredId)) continue;
|
|
28027
|
+
if (!requiredId || excludedResourceIds.has(requiredId) || exportedResourceIds.has(requiredId)) continue;
|
|
27498
28028
|
exportedResourceIds.add(requiredId);
|
|
27499
28029
|
changed = true;
|
|
27500
28030
|
}
|
|
@@ -27502,7 +28032,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27502
28032
|
}
|
|
27503
28033
|
return exportedResourceIds;
|
|
27504
28034
|
};
|
|
27505
|
-
for (const atlas of pkg.listAtlases()) for (const sprite of atlas.listSprites()) spriteItemIds.add(sprite.getItemId());
|
|
28035
|
+
for (const atlas of pkg.listAtlases()) for (const sprite of atlas.listSprites()) if (!excludedResourceIds.has(sprite.getItemId())) spriteItemIds.add(sprite.getItemId());
|
|
27506
28036
|
for (const resource of resources) {
|
|
27507
28037
|
if (!isComponentResource(resource)) continue;
|
|
27508
28038
|
const component = resource;
|
|
@@ -27511,7 +28041,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27511
28041
|
const hitTest = component.getHitTest?.()?.trim();
|
|
27512
28042
|
if (hitTest && !hitTest.includes(",")) {
|
|
27513
28043
|
const sourceId = childMap.get(hitTest)?.getSrc?.();
|
|
27514
|
-
if (sourceId) {
|
|
28044
|
+
if (sourceId && !excludedResourceIds.has(sourceId)) {
|
|
27515
28045
|
const sourceResource = resourceMap.get(sourceId);
|
|
27516
28046
|
if (sourceResource && isImageResource(sourceResource)) pixelHitTestImageIds.add(sourceId);
|
|
27517
28047
|
}
|
|
@@ -27520,7 +28050,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27520
28050
|
const publishedResourceIds = new Set(spriteItemIds);
|
|
27521
28051
|
for (const resource of resources) {
|
|
27522
28052
|
const resourceId = resource.getId();
|
|
27523
|
-
if (!resourceId) continue;
|
|
28053
|
+
if (!resourceId || excludedResourceIds.has(resourceId)) continue;
|
|
27524
28054
|
if (isComponentResource(resource)) {
|
|
27525
28055
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
27526
28056
|
continue;
|
|
@@ -27544,7 +28074,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27544
28074
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
27545
28075
|
}
|
|
27546
28076
|
for (const resourceId of collectExportedResourceIds(resources, publishedResourceIds)) publishedResourceIds.add(resourceId);
|
|
27547
|
-
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution);
|
|
28077
|
+
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution, excludedResourceIds);
|
|
27548
28078
|
if (!options.includeBranches) {
|
|
27549
28079
|
const mainByKey = /* @__PURE__ */ new Map();
|
|
27550
28080
|
const activeBranchByKey = /* @__PURE__ */ new Map();
|
|
@@ -27672,6 +28202,10 @@ async function annotatePackagePublishArtifacts(pkg, basePath, encoder, options)
|
|
|
27672
28202
|
setPublishedFileExtra(resource, resolvePublishedMiscFileName(resource, options.projectType));
|
|
27673
28203
|
continue;
|
|
27674
28204
|
}
|
|
28205
|
+
if (isSwfResource(resource)) {
|
|
28206
|
+
setPublishedFileExtra(resource, resolvePublishedSwfFileName(resource));
|
|
28207
|
+
continue;
|
|
28208
|
+
}
|
|
27675
28209
|
if (isSkeletonResource(resource)) setPublishedFileExtra(resource, resolvePublishedSkeletonFileName(resource, options.projectType));
|
|
27676
28210
|
}
|
|
27677
28211
|
}
|
|
@@ -28930,7 +29464,7 @@ function packAtlasPages(inputs, options, forceSinglePage, sizeOverrides) {
|
|
|
28930
29464
|
});
|
|
28931
29465
|
return new MaxRectsPackerCompat({
|
|
28932
29466
|
pot: sizeOverrides?.powerOfTwo ?? options.powerOfTwo,
|
|
28933
|
-
mof: sizeOverrides?.multipleOfFour ??
|
|
29467
|
+
mof: sizeOverrides?.multipleOfFour ?? options.multipleOfFour,
|
|
28934
29468
|
padding: options.padding,
|
|
28935
29469
|
rotation: options.allowRotation,
|
|
28936
29470
|
minWidth: 16,
|
|
@@ -29030,7 +29564,7 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
29030
29564
|
}
|
|
29031
29565
|
}
|
|
29032
29566
|
const outputFile = `${options.outputPath}/${atlasFileName}`;
|
|
29033
|
-
|
|
29567
|
+
const atlasPipeline = encoder({ create: {
|
|
29034
29568
|
width: page.width,
|
|
29035
29569
|
height: page.height,
|
|
29036
29570
|
channels: 4,
|
|
@@ -29040,7 +29574,13 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
29040
29574
|
b: 0,
|
|
29041
29575
|
alpha: 0
|
|
29042
29576
|
}
|
|
29043
|
-
} }).composite(compositeInputs)
|
|
29577
|
+
} }).composite(compositeInputs);
|
|
29578
|
+
if (options.extractAlpha) {
|
|
29579
|
+
const atlasBuffer = await atlasPipeline.png().toBuffer();
|
|
29580
|
+
await encoder(atlasBuffer).removeAlpha().png().toFile(outputFile);
|
|
29581
|
+
const alphaBuffer = await encoder(atlasBuffer).extractChannel("alpha").png().toBuffer();
|
|
29582
|
+
await encoder(alphaBuffer).joinChannel([alphaBuffer, alphaBuffer]).png().toFile(`${options.outputPath}/${insertFileNameSuffix(atlasFileName, "!a")}`);
|
|
29583
|
+
} else await atlasPipeline.toFile(outputFile);
|
|
29044
29584
|
logger.info(`atlas: Generated ${atlasFileName} (${page.width}x${page.height}, ${page.outputRects.length} sprites)`);
|
|
29045
29585
|
}
|
|
29046
29586
|
function inputToCompatRect(input, index) {
|
|
@@ -29090,6 +29630,9 @@ function resolveDirectOutputAtlasSize(width, height, options) {
|
|
|
29090
29630
|
if (options.powerOfTwo) {
|
|
29091
29631
|
resolvedWidth = nextPow2(resolvedWidth);
|
|
29092
29632
|
resolvedHeight = nextPow2(resolvedHeight);
|
|
29633
|
+
} else if (options.multipleOfFour) {
|
|
29634
|
+
resolvedWidth = roundUpToMultiple(resolvedWidth, 4);
|
|
29635
|
+
resolvedHeight = roundUpToMultiple(resolvedHeight, 4);
|
|
29093
29636
|
}
|
|
29094
29637
|
return {
|
|
29095
29638
|
width: resolvedWidth,
|
|
@@ -29204,9 +29747,8 @@ function sortResourcesByOrder(resources, orderMap, inputOrderMap) {
|
|
|
29204
29747
|
});
|
|
29205
29748
|
return ordered;
|
|
29206
29749
|
}
|
|
29207
|
-
function getResourceTextureSetMode(resource) {
|
|
29208
|
-
|
|
29209
|
-
return parseTextureSetMode(resource.getTextureSetMode?.());
|
|
29750
|
+
function getResourceTextureSetMode(resource, maxAtlasIndex) {
|
|
29751
|
+
return parseTextureSetMode(resource.getTextureSetMode?.(), maxAtlasIndex);
|
|
29210
29752
|
}
|
|
29211
29753
|
function groupStandaloneInputs(doc, inputs, options) {
|
|
29212
29754
|
const autoInputs = [];
|
|
@@ -29225,7 +29767,7 @@ function groupStandaloneInputs(doc, inputs, options) {
|
|
|
29225
29767
|
for (const input of inputs) {
|
|
29226
29768
|
const branchName = getInputBranchName(input);
|
|
29227
29769
|
const branchOrdinal = branchOrdinalByName.get(branchName) ?? 0;
|
|
29228
|
-
const mode = getResourceTextureSetMode(input.resource);
|
|
29770
|
+
const mode = getResourceTextureSetMode(input.resource, options.maxAtlasIndex ?? 10);
|
|
29229
29771
|
if (mode.kind === "standalone") {
|
|
29230
29772
|
const key = `${branchName}\u0000${getPublishedItemId(input.resource)}`;
|
|
29231
29773
|
const existing = standaloneGroups.get(key);
|
|
@@ -29269,6 +29811,8 @@ const ATLAS_DEFAULTS = {
|
|
|
29269
29811
|
allowRotation: true,
|
|
29270
29812
|
padding: 1,
|
|
29271
29813
|
powerOfTwo: false,
|
|
29814
|
+
maxAtlasIndex: 10,
|
|
29815
|
+
multipleOfFour: false,
|
|
29272
29816
|
square: false,
|
|
29273
29817
|
multiPage: true,
|
|
29274
29818
|
trimImage: false,
|
|
@@ -29352,7 +29896,7 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
29352
29896
|
const refChild = child;
|
|
29353
29897
|
await addResource(resourceMap.get(refChild.getSrc?.() ?? ""));
|
|
29354
29898
|
for (const ref of [
|
|
29355
|
-
refChild.getUrl?.(),
|
|
29899
|
+
refChild.getClearOnPublish?.() ? void 0 : refChild.getUrl?.(),
|
|
29356
29900
|
refChild.getDefaultItem?.(),
|
|
29357
29901
|
refChild.getIcon?.(),
|
|
29358
29902
|
refChild.getSelectedIcon?.(),
|
|
@@ -29366,11 +29910,14 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
29366
29910
|
refChild.getInstanceIcon?.(),
|
|
29367
29911
|
refChild.getInstanceSelectedIcon?.()
|
|
29368
29912
|
]) await addResourceByLocalUiUrl(ref);
|
|
29369
|
-
for (const item of refChild.getInstanceComboItems?.() ?? []) await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
29370
|
-
for (const item of refChild.getListItems?.() ?? []) {
|
|
29913
|
+
for (const item of refChild.getInstanceAutoClearItems?.() ? [] : refChild.getInstanceComboItems?.() ?? []) await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
29914
|
+
for (const item of refChild.getAutoClearItems?.() ? [] : refChild.getListItems?.() ?? []) {
|
|
29371
29915
|
await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
29916
|
+
await addResourceByLocalUiUrl(item.selectedIcon ?? void 0);
|
|
29372
29917
|
await addResourceByLocalUiUrl(item.url ?? void 0);
|
|
29918
|
+
for (const property of item.propertyOverrides ?? []) await addResourceByLocalUiUrl(property.value);
|
|
29373
29919
|
}
|
|
29920
|
+
for (const property of refChild.getPropertyOverrides?.() ?? []) await addResourceByLocalUiUrl(property.value);
|
|
29374
29921
|
for (const gear of refChild.listGears?.() ?? []) await addGearIconResources(gear);
|
|
29375
29922
|
}
|
|
29376
29923
|
for (const ref of [
|
|
@@ -29621,23 +30168,32 @@ const FGUI_TYPESCRIPT_RUNTIME_TYPES = new Set([
|
|
|
29621
30168
|
"GTree",
|
|
29622
30169
|
"Transition"
|
|
29623
30170
|
]);
|
|
29624
|
-
const
|
|
30171
|
+
const LAYABOX_TYPESCRIPT_VARIANT = {
|
|
29625
30172
|
binderMethod: "setExtension",
|
|
29626
|
-
runtimeNamespace: "fgui"
|
|
30173
|
+
runtimeNamespace: "fgui",
|
|
30174
|
+
runtimeImport: ""
|
|
30175
|
+
};
|
|
30176
|
+
const COCOS_CREATOR_TYPESCRIPT_VARIANT = {
|
|
30177
|
+
...LAYABOX_TYPESCRIPT_VARIANT,
|
|
30178
|
+
runtimeImport: "import * as fgui from \"fairygui-cc\";"
|
|
29627
30179
|
};
|
|
29628
30180
|
async function publishCodeGeneration(doc, options) {
|
|
29629
30181
|
const logger = doc.getLogger();
|
|
29630
30182
|
const settings = resolveCodeGenerationSettings(doc);
|
|
29631
30183
|
if (!settings.allowGenCode) return;
|
|
29632
|
-
const plugins = options.plugins
|
|
30184
|
+
const plugins = options.plugins ?? [];
|
|
29633
30185
|
if (plugins.length > 0) {
|
|
29634
30186
|
let handled = false;
|
|
29635
|
-
for (const plugin of plugins)
|
|
29636
|
-
|
|
29637
|
-
|
|
29638
|
-
|
|
29639
|
-
|
|
29640
|
-
|
|
30187
|
+
for (const plugin of plugins) {
|
|
30188
|
+
const genCode = plugin.plugin.genCode;
|
|
30189
|
+
if (!genCode) continue;
|
|
30190
|
+
try {
|
|
30191
|
+
await genCode(doc, settings, options);
|
|
30192
|
+
handled = true;
|
|
30193
|
+
logger.info(`publish: Generated code using plugin "${plugin.name}"`);
|
|
30194
|
+
} catch (error) {
|
|
30195
|
+
logger.warn(`publish: Code generation plugin "${plugin.name}" failed: ${formatPluginError(error)}`);
|
|
30196
|
+
}
|
|
29641
30197
|
}
|
|
29642
30198
|
if (handled) return;
|
|
29643
30199
|
}
|
|
@@ -29701,8 +30257,9 @@ function supportsCodeGenerationLane(doc, codeType) {
|
|
|
29701
30257
|
}
|
|
29702
30258
|
function resolveFguiTypescriptVariant(doc) {
|
|
29703
30259
|
const projectType = doc.getRoot().getProjectType();
|
|
29704
|
-
if (projectType
|
|
29705
|
-
return
|
|
30260
|
+
if (projectType === ProjectType.LayaBox) return LAYABOX_TYPESCRIPT_VARIANT;
|
|
30261
|
+
if (projectType === ProjectType.CocosCreator) return COCOS_CREATOR_TYPESCRIPT_VARIANT;
|
|
30262
|
+
return null;
|
|
29706
30263
|
}
|
|
29707
30264
|
async function generateUnityCode(doc, pkg, plan, fs) {
|
|
29708
30265
|
const packageDir = fs.join(plan.outputDir, plan.packageFolderName);
|
|
@@ -29885,7 +30442,8 @@ function renderFguiTypescriptComponentClass(classInfo, plan, variant) {
|
|
|
29885
30442
|
}
|
|
29886
30443
|
function renderFguiTypescriptBinder(classes, plan, variant) {
|
|
29887
30444
|
const bindLines = classes.map((classInfo) => `\t\t${variant.runtimeNamespace}.UIObjectFactory.${variant.binderMethod}(${classInfo.encodedClassName}.URL, ${classInfo.encodedClassName});`).join("\n");
|
|
29888
|
-
const
|
|
30445
|
+
const classImports = classes.map((classInfo) => `import ${classInfo.encodedClassName} from "./${classInfo.encodedClassName}";`).join("\n");
|
|
30446
|
+
const importLines = [variant.runtimeImport, classImports].filter(Boolean).join("\n");
|
|
29889
30447
|
return renderTemplate(FGUI_TYPESCRIPT_BINDER_TEMPLATE, {
|
|
29890
30448
|
binderClassName: plan.binderClassName,
|
|
29891
30449
|
bindLines: bindLines ? `${bindLines}\n` : "",
|
|
@@ -29949,6 +30507,7 @@ function normalizeTypeName(value) {
|
|
|
29949
30507
|
}
|
|
29950
30508
|
function collectFguiTypescriptImports(classInfo, variant) {
|
|
29951
30509
|
const imports = /* @__PURE__ */ new Set();
|
|
30510
|
+
if (variant.runtimeImport) imports.add(variant.runtimeImport);
|
|
29952
30511
|
for (const member of classInfo.members) {
|
|
29953
30512
|
if (member.ignored) continue;
|
|
29954
30513
|
const translated = translateFguiTypescriptType(member.type, variant);
|
|
@@ -30922,23 +31481,24 @@ async function exportPackageExternalResources(pkg, outputDir, basePath, fs, read
|
|
|
30922
31481
|
if (exportedResourceIds.size === 0) return;
|
|
30923
31482
|
if (!basePath || !readFileRaw) {
|
|
30924
31483
|
if (pkg.listResources().some((resource) => {
|
|
30925
|
-
return (isMiscResource(resource) || isSkeletonResource(resource)) && exportedResourceIds.has(resource.getId()) || skeletonDependencyImageIds.has(resource.getId());
|
|
31484
|
+
return (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource)) && exportedResourceIds.has(resource.getId()) || skeletonDependencyImageIds.has(resource.getId());
|
|
30926
31485
|
})) throw new Error(`publish: External resources in package "${pkg.getName()}" require basePath and readFileRaw for output.`);
|
|
30927
31486
|
return;
|
|
30928
31487
|
}
|
|
30929
31488
|
for (const resource of pkg.listResources()) {
|
|
30930
31489
|
const resourceId = resource.getId();
|
|
30931
|
-
const
|
|
31490
|
+
const isExternal = exportedResourceIds.has(resourceId) && (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource));
|
|
30932
31491
|
const isSkeletonImageDependency = skeletonDependencyImageIds.has(resourceId) && isImageResource(resource);
|
|
30933
|
-
if (!
|
|
31492
|
+
if (!isExternal && !isSkeletonImageDependency) continue;
|
|
30934
31493
|
let sourcePath;
|
|
30935
31494
|
let targetName;
|
|
30936
31495
|
if (isSkeletonImageDependency) {
|
|
30937
31496
|
sourcePath = resolveImagePath(resource, pkg, basePath);
|
|
30938
31497
|
targetName = resolveImageFileName(resource);
|
|
30939
|
-
} else if (isMiscResource(resource) || isSkeletonResource(resource)) {
|
|
31498
|
+
} else if (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource)) {
|
|
30940
31499
|
sourcePath = resolveGenericResourcePath(resource, pkg, basePath);
|
|
30941
|
-
|
|
31500
|
+
const publishedFile = (resource.getExtras() ?? {})._publishedFile ?? resource.getFile();
|
|
31501
|
+
targetName = isMiscResource(resource) || isSwfResource(resource) ? `${pkg.getPublishName() || pkg.getName()}_${publishedFile}` : publishedFile;
|
|
30942
31502
|
} else continue;
|
|
30943
31503
|
const targetPath = fs.join(outputDir, targetName);
|
|
30944
31504
|
try {
|
|
@@ -30978,16 +31538,20 @@ function resolvePublishOptions(doc, overrides = {}) {
|
|
|
30978
31538
|
const root = doc.getRoot();
|
|
30979
31539
|
const publishSettings = (root.getSettings?.() ?? {}).publish ?? {};
|
|
30980
31540
|
const atlasSetting = publishSettings.atlasSetting ?? {};
|
|
30981
|
-
const projectType = root.getProjectType();
|
|
30982
|
-
const
|
|
30983
|
-
|
|
30984
|
-
|
|
31541
|
+
const projectType = overrides.targetProjectType ?? root.getProjectType();
|
|
31542
|
+
const explicitLayaboxTarget = overrides.targetProjectType === ProjectType.LayaBox;
|
|
31543
|
+
const fileExtension = overrides.fileExtension ?? (explicitLayaboxTarget ? "fui" : resolveDefaultPublishFileExtension(projectType, publishSettings));
|
|
31544
|
+
const runtimeRejectsCompression = projectType === UNITY_PROJECT_TYPE || projectType === COCOS_CREATOR_PROJECT_TYPE;
|
|
31545
|
+
if (runtimeRejectsCompression && overrides.compressed === true) throw new Error("publish: The selected target runtime does not support compressed package data.");
|
|
31546
|
+
const compressed = runtimeRejectsCompression ? false : overrides.compressed ?? publishSettings.compressDesc ?? false;
|
|
30985
31547
|
const atlasOptions = {
|
|
30986
31548
|
maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
|
|
30987
31549
|
fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
|
|
30988
|
-
allowRotation: overrides.atlas?.allowRotation ?? atlasSetting.allowRotation ?? false,
|
|
31550
|
+
allowRotation: overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : atlasSetting.allowRotation ?? false),
|
|
30989
31551
|
padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
|
|
30990
31552
|
powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === "pot",
|
|
31553
|
+
maxAtlasIndex: overrides.atlas?.maxAtlasIndex ?? 10,
|
|
31554
|
+
multipleOfFour: overrides.atlas?.multipleOfFour ?? atlasSetting.sizeOption === "mof",
|
|
30991
31555
|
square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,
|
|
30992
31556
|
multiPage: overrides.atlas?.multiPage ?? atlasSetting.paging ?? true,
|
|
30993
31557
|
trimImage: overrides.atlas?.trimImage ?? atlasSetting.trimImage ?? false,
|
|
@@ -31107,6 +31671,19 @@ function publish(options) {
|
|
|
31107
31671
|
}
|
|
31108
31672
|
}
|
|
31109
31673
|
const publishName = pkg.getPublishName() || pkg.getName();
|
|
31674
|
+
const sourceAtlas = pkg.getSourceAtlasSettings();
|
|
31675
|
+
const usePackageAtlas = !sourceAtlas.useGlobal;
|
|
31676
|
+
const atlas = {
|
|
31677
|
+
...config.atlas,
|
|
31678
|
+
maxSize: options.atlas?.maxSize ?? (usePackageAtlas ? sourceAtlas.maxSize : config.atlas.maxSize),
|
|
31679
|
+
allowRotation: config.projectType === ProjectType.LayaBox ? false : options.atlas?.allowRotation ?? (usePackageAtlas ? sourceAtlas.allowRotation : config.atlas.allowRotation),
|
|
31680
|
+
powerOfTwo: options.atlas?.powerOfTwo ?? (usePackageAtlas ? sourceAtlas.sizeOption === "pot" : config.atlas.powerOfTwo),
|
|
31681
|
+
maxAtlasIndex: options.atlas?.maxAtlasIndex ?? sourceAtlas.maxIndex,
|
|
31682
|
+
multipleOfFour: options.atlas?.multipleOfFour ?? (usePackageAtlas ? sourceAtlas.sizeOption === "mof" : config.atlas.multipleOfFour),
|
|
31683
|
+
square: options.atlas?.square ?? (usePackageAtlas ? sourceAtlas.forceSquare : config.atlas.square),
|
|
31684
|
+
multiPage: options.atlas?.multiPage ?? (usePackageAtlas ? sourceAtlas.paging : config.atlas.multiPage),
|
|
31685
|
+
extractAlpha: config.projectType === ProjectType.Unity && (options.atlas?.extractAlpha ?? (usePackageAtlas || sourceAtlas.extractAlpha ? sourceAtlas.extractAlpha : config.atlas.extractAlpha))
|
|
31686
|
+
};
|
|
31110
31687
|
return {
|
|
31111
31688
|
pkg,
|
|
31112
31689
|
outputDir,
|
|
@@ -31118,7 +31695,7 @@ function publish(options) {
|
|
|
31118
31695
|
activeBranch: config.activeBranch,
|
|
31119
31696
|
includeHighResolution: config.includeHighResolution,
|
|
31120
31697
|
separatedAtlasForBranch: config.separatedAtlasForBranch,
|
|
31121
|
-
atlas
|
|
31698
|
+
atlas
|
|
31122
31699
|
};
|
|
31123
31700
|
};
|
|
31124
31701
|
const createNoopPublishFs = () => ({
|
|
@@ -31138,7 +31715,6 @@ function publish(options) {
|
|
|
31138
31715
|
const atlasRuntimeOptions = resolvePublishAtlasRuntimeOptions(plan.fileExtension);
|
|
31139
31716
|
await atlas({
|
|
31140
31717
|
...plan.atlas,
|
|
31141
|
-
...options.atlas ?? {},
|
|
31142
31718
|
separatedAtlasForBranch: plan.separatedAtlasForBranch,
|
|
31143
31719
|
encoder: options.encoder,
|
|
31144
31720
|
basePath: options.basePath,
|
|
@@ -31666,18 +32242,21 @@ async function validateProjectNode(projectPath) {
|
|
|
31666
32242
|
}
|
|
31667
32243
|
const decodedPaths = new Set(images.map(({ packageIndex, resourceIndex }) => `packages[${packageIndex}].resources[${resourceIndex}]`));
|
|
31668
32244
|
diagnostics = diagnostics.filter((diagnostic) => diagnostic.code !== "decode_capability_unavailable" || !decodedPaths.has(diagnostic.path));
|
|
31669
|
-
for (const { pkg, packageIndex, resource, resourceIndex } of images)
|
|
31670
|
-
|
|
31671
|
-
|
|
31672
|
-
|
|
31673
|
-
|
|
31674
|
-
|
|
31675
|
-
|
|
31676
|
-
|
|
31677
|
-
|
|
31678
|
-
|
|
31679
|
-
|
|
31680
|
-
|
|
32245
|
+
for (const { pkg, packageIndex, resource, resourceIndex } of images) {
|
|
32246
|
+
if (resource.kind !== "image") continue;
|
|
32247
|
+
try {
|
|
32248
|
+
await sharp(resource.sourceBytes).raw().toBuffer();
|
|
32249
|
+
} catch (error) {
|
|
32250
|
+
diagnostics.push({
|
|
32251
|
+
severity: "error",
|
|
32252
|
+
code: "corrupt_source",
|
|
32253
|
+
path: `packages[${packageIndex}].resources[${resourceIndex}]`,
|
|
32254
|
+
message: `Image source cannot be decoded: ${error instanceof Error ? error.message : String(error)}`,
|
|
32255
|
+
packageId: pkg.id,
|
|
32256
|
+
resourceId: resource.id,
|
|
32257
|
+
sourcePath: sourceName(resource)
|
|
32258
|
+
});
|
|
32259
|
+
}
|
|
31681
32260
|
}
|
|
31682
32261
|
return createProjectValidationReport(diagnostics, read.complete && !diagnostics.some((diagnostic) => diagnostic.code === "decode_capability_unavailable"));
|
|
31683
32262
|
}
|
|
@@ -31724,7 +32303,8 @@ function registerPublishCommand(program) {
|
|
|
31724
32303
|
const pkgFilter = options.packages?.split(",").map((value) => value.trim());
|
|
31725
32304
|
const resolved = resolvePublishOptions(doc, {
|
|
31726
32305
|
compressed: options.compressed,
|
|
31727
|
-
packages: pkgFilter
|
|
32306
|
+
packages: pkgFilter,
|
|
32307
|
+
targetProjectType: projectType
|
|
31728
32308
|
});
|
|
31729
32309
|
console.log(`Settings: ext=${resolved.fileExtension}, compressed=${resolved.compressed}`);
|
|
31730
32310
|
if (options.branch) console.log(`Active branch: ${options.branch}`);
|
|
@@ -31784,7 +32364,7 @@ function registerValidateCommand(program) {
|
|
|
31784
32364
|
//#region src/utils/package-version.ts
|
|
31785
32365
|
const require$1 = createRequire(import.meta.url);
|
|
31786
32366
|
function getInjectedPackageVersion() {
|
|
31787
|
-
const version = "0.3.0
|
|
32367
|
+
const version = "0.3.0";
|
|
31788
32368
|
return typeof version === "string" && true ? version : null;
|
|
31789
32369
|
}
|
|
31790
32370
|
function readPackageVersion() {
|
|
@@ -31813,7 +32393,7 @@ function createProgram() {
|
|
|
31813
32393
|
" openfairygui",
|
|
31814
32394
|
"",
|
|
31815
32395
|
"Input can be a .fairy file or a project root directory (auto-discovers .fairy file).",
|
|
31816
|
-
"
|
|
32396
|
+
"Publish settings are read from the project; --project-type applies target-specific output rules."
|
|
31817
32397
|
].join("\n"));
|
|
31818
32398
|
return program;
|
|
31819
32399
|
}
|