@openfairygui/cli 0.3.0-alpha.3 → 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 +1051 -197
- 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);
|
|
@@ -19366,8 +19703,8 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
19366
19703
|
const groupLayout = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.group.attrs.layout);
|
|
19367
19704
|
if (groupLayout) g.setLayout({
|
|
19368
19705
|
none: 0,
|
|
19369
|
-
|
|
19370
|
-
|
|
19706
|
+
hz: 1,
|
|
19707
|
+
vt: 2
|
|
19371
19708
|
}[groupLayout] ?? 0);
|
|
19372
19709
|
const groupLineGap = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.group.attrs.lineGap);
|
|
19373
19710
|
if (groupLineGap !== void 0) g.setLineGap(parseInt2(groupLineGap));
|
|
@@ -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) {
|
|
@@ -20472,12 +20860,53 @@ function isProjectInt32(value) {
|
|
|
20472
20860
|
const parsed = BigInt(trimmed);
|
|
20473
20861
|
return parsed >= -2147483648n && parsed <= 2147483647n;
|
|
20474
20862
|
}
|
|
20863
|
+
function isProjectFiniteNumber(value) {
|
|
20864
|
+
const trimmed = value.trim();
|
|
20865
|
+
return /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(trimmed) && Number.isFinite(Number(trimmed));
|
|
20866
|
+
}
|
|
20867
|
+
function isProjectBoolean(value) {
|
|
20868
|
+
return [
|
|
20869
|
+
"true",
|
|
20870
|
+
"false",
|
|
20871
|
+
"1",
|
|
20872
|
+
"0"
|
|
20873
|
+
].includes(value.trim());
|
|
20874
|
+
}
|
|
20475
20875
|
function hasInvalidProjectInt32Parts(value, partCount, allowSuffix = false) {
|
|
20476
20876
|
const parts = String(value).split(",");
|
|
20477
20877
|
if (allowSuffix ? parts.length < partCount : parts.length !== partCount) return true;
|
|
20478
20878
|
return parts.slice(0, partCount).some((part) => !isProjectInt32(part));
|
|
20479
20879
|
}
|
|
20480
|
-
function
|
|
20880
|
+
function validateComponentXmlValues(ctx, comp, sourcePath, componentNode) {
|
|
20881
|
+
const addInvalidValue = (attrs, spec, path, expectation, isValid, nodeId) => {
|
|
20882
|
+
if (!spec) return;
|
|
20883
|
+
const value = readXmlAttr(attrs, spec);
|
|
20884
|
+
if (value === void 0 || isValid(String(value))) return;
|
|
20885
|
+
ctx.addDiagnostic({
|
|
20886
|
+
severity: "error",
|
|
20887
|
+
code: "invalid_project_value",
|
|
20888
|
+
path: `${path}.${spec.canonical}`,
|
|
20889
|
+
message: `Attribute "${spec.canonical}" must be ${expectation}; received ${JSON.stringify(String(value))}.`,
|
|
20890
|
+
resourceId: comp.getId(),
|
|
20891
|
+
...nodeId ? { nodeId } : {},
|
|
20892
|
+
sourcePath
|
|
20893
|
+
});
|
|
20894
|
+
};
|
|
20895
|
+
const validateBooleanAttrs = (attrs, specs, path, nodeId) => {
|
|
20896
|
+
for (const spec of specs) addInvalidValue(attrs, spec, path, "true, false, 1, or 0", isProjectBoolean, nodeId);
|
|
20897
|
+
};
|
|
20898
|
+
const validateInt32Attrs = (attrs, specs, path, nodeId) => {
|
|
20899
|
+
for (const spec of specs) addInvalidValue(attrs, spec, path, "a signed 32-bit integer", isProjectInt32, nodeId);
|
|
20900
|
+
};
|
|
20901
|
+
const validateNumberTuple = (attrs, spec, partCount, path, nodeId) => {
|
|
20902
|
+
addInvalidValue(attrs, spec, path, `exactly ${partCount} finite number(s)`, (value) => {
|
|
20903
|
+
const parts = value.split(",");
|
|
20904
|
+
return parts.length === partCount && parts.every(isProjectFiniteNumber);
|
|
20905
|
+
}, nodeId);
|
|
20906
|
+
};
|
|
20907
|
+
const validateEnum = (attrs, spec, values, path, nodeId) => {
|
|
20908
|
+
addInvalidValue(attrs, spec, path, `one of ${values.map((value) => JSON.stringify(value)).join(", ")}`, (value) => values.includes(value.trim()), nodeId);
|
|
20909
|
+
};
|
|
20481
20910
|
const addDiagnostics = (attrs, rules, path, nodeId) => {
|
|
20482
20911
|
for (const [spec, partCount] of rules) {
|
|
20483
20912
|
const value = readXmlAttr(attrs, spec);
|
|
@@ -20494,7 +20923,38 @@ function validateComponentXmlGeometry(ctx, comp, sourcePath, componentNode) {
|
|
|
20494
20923
|
}
|
|
20495
20924
|
};
|
|
20496
20925
|
const componentPath = `components.${comp.getId()}`;
|
|
20497
|
-
|
|
20926
|
+
const rootPath = `${componentPath}.component`;
|
|
20927
|
+
const rootAttrs = PROJECT_XML_PROTOCOL.componentRoot.attrs;
|
|
20928
|
+
addDiagnostics(componentNode, COMPONENT_INT32_RULES, rootPath);
|
|
20929
|
+
validateBooleanAttrs(componentNode, [
|
|
20930
|
+
rootAttrs.anchor,
|
|
20931
|
+
rootAttrs.opaque,
|
|
20932
|
+
rootAttrs.reversedMask,
|
|
20933
|
+
rootAttrs.bgColorEnabled
|
|
20934
|
+
], rootPath);
|
|
20935
|
+
validateInt32Attrs(componentNode, [
|
|
20936
|
+
rootAttrs.scrollBarFlags,
|
|
20937
|
+
rootAttrs.designImageAlpha,
|
|
20938
|
+
rootAttrs.designImageLayer,
|
|
20939
|
+
rootAttrs.idnum
|
|
20940
|
+
], rootPath);
|
|
20941
|
+
validateNumberTuple(componentNode, rootAttrs.pivot, 2, rootPath);
|
|
20942
|
+
validateEnum(componentNode, rootAttrs.overflow, [
|
|
20943
|
+
"visible",
|
|
20944
|
+
"hidden",
|
|
20945
|
+
"scroll"
|
|
20946
|
+
], rootPath);
|
|
20947
|
+
validateEnum(componentNode, rootAttrs.scroll, [
|
|
20948
|
+
"horizontal",
|
|
20949
|
+
"vertical",
|
|
20950
|
+
"both"
|
|
20951
|
+
], rootPath);
|
|
20952
|
+
validateEnum(componentNode, rootAttrs.scrollBar, [
|
|
20953
|
+
"default",
|
|
20954
|
+
"visible",
|
|
20955
|
+
"auto",
|
|
20956
|
+
"hidden"
|
|
20957
|
+
], rootPath);
|
|
20498
20958
|
const displayList = getXmlNode(componentNode.displayList);
|
|
20499
20959
|
if (!displayList) return;
|
|
20500
20960
|
let nodeIndex = 0;
|
|
@@ -20505,7 +20965,209 @@ function validateComponentXmlGeometry(ctx, comp, sourcePath, componentNode) {
|
|
|
20505
20965
|
const nodePath = `${componentPath}.displayList.${nodeIndex++}`;
|
|
20506
20966
|
addDiagnostics(attrs, DISPLAY_OBJECT_INT32_RULES, nodePath, nodeId);
|
|
20507
20967
|
const normalizedTagName = tagName.toLowerCase();
|
|
20968
|
+
const displayAttrs = (Object.entries(PROJECT_XML_PROTOCOL.componentRoot.containers?.displayList?.items ?? {}).find(([name]) => name.toLowerCase() === normalizedTagName)?.[1])?.attrs;
|
|
20969
|
+
if (displayAttrs) {
|
|
20970
|
+
validateBooleanAttrs(attrs, [
|
|
20971
|
+
displayAttrs.locked,
|
|
20972
|
+
displayAttrs.aspect,
|
|
20973
|
+
displayAttrs.anchor,
|
|
20974
|
+
displayAttrs.visible,
|
|
20975
|
+
displayAttrs.touchable,
|
|
20976
|
+
displayAttrs.grayed
|
|
20977
|
+
], nodePath, nodeId);
|
|
20978
|
+
for (const spec of [
|
|
20979
|
+
displayAttrs.pivot,
|
|
20980
|
+
displayAttrs.scale,
|
|
20981
|
+
displayAttrs.skew
|
|
20982
|
+
]) validateNumberTuple(attrs, spec, 2, nodePath, nodeId);
|
|
20983
|
+
addInvalidValue(attrs, displayAttrs.rotation, nodePath, "a finite number", isProjectFiniteNumber, nodeId);
|
|
20984
|
+
addInvalidValue(attrs, displayAttrs.alpha, nodePath, "a finite number between 0 and 1", (value) => isProjectFiniteNumber(value) && Number(value) >= 0 && Number(value) <= 1, nodeId);
|
|
20985
|
+
}
|
|
20508
20986
|
if (normalizedTagName === "list" || normalizedTagName === "tree") addDiagnostics(attrs, LIST_INT32_RULES, nodePath, nodeId);
|
|
20987
|
+
if (displayAttrs && [
|
|
20988
|
+
"text",
|
|
20989
|
+
"richtext",
|
|
20990
|
+
"inputtext"
|
|
20991
|
+
].includes(normalizedTagName)) {
|
|
20992
|
+
validateBooleanAttrs(attrs, [
|
|
20993
|
+
displayAttrs.input,
|
|
20994
|
+
displayAttrs.singleLine,
|
|
20995
|
+
displayAttrs.autoClearText,
|
|
20996
|
+
displayAttrs.vars,
|
|
20997
|
+
displayAttrs.ubb,
|
|
20998
|
+
displayAttrs.underline,
|
|
20999
|
+
displayAttrs.italic,
|
|
21000
|
+
displayAttrs.bold,
|
|
21001
|
+
displayAttrs.strikethrough,
|
|
21002
|
+
displayAttrs.password
|
|
21003
|
+
], nodePath, nodeId);
|
|
21004
|
+
validateInt32Attrs(attrs, [
|
|
21005
|
+
displayAttrs.leading,
|
|
21006
|
+
displayAttrs.letterSpacing,
|
|
21007
|
+
displayAttrs.maxLength,
|
|
21008
|
+
displayAttrs.keyboardType
|
|
21009
|
+
], nodePath, nodeId);
|
|
21010
|
+
addInvalidValue(attrs, displayAttrs.fontSize, nodePath, "a positive signed 32-bit integer", (value) => isProjectInt32(value) && BigInt(value.trim()) > 0n, nodeId);
|
|
21011
|
+
for (const spec of [
|
|
21012
|
+
displayAttrs.strokeSize,
|
|
21013
|
+
displayAttrs.faceDilate,
|
|
21014
|
+
displayAttrs.underlaySoftness
|
|
21015
|
+
]) addInvalidValue(attrs, spec, nodePath, "a finite number", isProjectFiniteNumber, nodeId);
|
|
21016
|
+
validateNumberTuple(attrs, displayAttrs.shadowOffset, 2, nodePath, nodeId);
|
|
21017
|
+
validateEnum(attrs, displayAttrs.align, [
|
|
21018
|
+
"left",
|
|
21019
|
+
"center",
|
|
21020
|
+
"right"
|
|
21021
|
+
], nodePath, nodeId);
|
|
21022
|
+
validateEnum(attrs, displayAttrs.vAlign, [
|
|
21023
|
+
"top",
|
|
21024
|
+
"middle",
|
|
21025
|
+
"bottom"
|
|
21026
|
+
], nodePath, nodeId);
|
|
21027
|
+
validateEnum(attrs, displayAttrs.autoSize, [
|
|
21028
|
+
"none",
|
|
21029
|
+
"both",
|
|
21030
|
+
"height",
|
|
21031
|
+
"shrink",
|
|
21032
|
+
"ellipsis"
|
|
21033
|
+
], nodePath, nodeId);
|
|
21034
|
+
}
|
|
21035
|
+
if (displayAttrs && (normalizedTagName === "list" || normalizedTagName === "tree")) {
|
|
21036
|
+
validateBooleanAttrs(attrs, [
|
|
21037
|
+
displayAttrs.autoResizeItem,
|
|
21038
|
+
displayAttrs.treeView,
|
|
21039
|
+
displayAttrs.autoClearItems,
|
|
21040
|
+
displayAttrs.scrollItemToViewOnClick,
|
|
21041
|
+
displayAttrs.foldInvisibleItems
|
|
21042
|
+
], nodePath, nodeId);
|
|
21043
|
+
validateInt32Attrs(attrs, [
|
|
21044
|
+
displayAttrs.lineGap,
|
|
21045
|
+
displayAttrs.columnGap,
|
|
21046
|
+
displayAttrs.lineItemCount,
|
|
21047
|
+
displayAttrs.lineItemCount2,
|
|
21048
|
+
displayAttrs.apexIndex,
|
|
21049
|
+
displayAttrs.scrollBarFlags,
|
|
21050
|
+
displayAttrs.indent,
|
|
21051
|
+
displayAttrs.clickToExpand
|
|
21052
|
+
], nodePath, nodeId);
|
|
21053
|
+
validateEnum(attrs, displayAttrs.layout, [
|
|
21054
|
+
"singleColumn",
|
|
21055
|
+
"singleRow",
|
|
21056
|
+
"flowHorizontal",
|
|
21057
|
+
"flowVertical",
|
|
21058
|
+
"pagination",
|
|
21059
|
+
"single_column",
|
|
21060
|
+
"single_row",
|
|
21061
|
+
"flow_hz",
|
|
21062
|
+
"flow_vt",
|
|
21063
|
+
"column",
|
|
21064
|
+
"row"
|
|
21065
|
+
], nodePath, nodeId);
|
|
21066
|
+
validateEnum(attrs, displayAttrs.align, [
|
|
21067
|
+
"left",
|
|
21068
|
+
"center",
|
|
21069
|
+
"right"
|
|
21070
|
+
], nodePath, nodeId);
|
|
21071
|
+
validateEnum(attrs, displayAttrs.vAlign, [
|
|
21072
|
+
"top",
|
|
21073
|
+
"middle",
|
|
21074
|
+
"bottom"
|
|
21075
|
+
], nodePath, nodeId);
|
|
21076
|
+
validateEnum(attrs, displayAttrs.childrenRenderOrder, [
|
|
21077
|
+
"ascent",
|
|
21078
|
+
"descent",
|
|
21079
|
+
"arch"
|
|
21080
|
+
], nodePath, nodeId);
|
|
21081
|
+
validateEnum(attrs, displayAttrs.selectionMode, [
|
|
21082
|
+
"single",
|
|
21083
|
+
"multiple",
|
|
21084
|
+
"multipleSingleClick",
|
|
21085
|
+
"none"
|
|
21086
|
+
], nodePath, nodeId);
|
|
21087
|
+
validateEnum(attrs, displayAttrs.overflow, [
|
|
21088
|
+
"visible",
|
|
21089
|
+
"hidden",
|
|
21090
|
+
"scroll"
|
|
21091
|
+
], nodePath, nodeId);
|
|
21092
|
+
validateEnum(attrs, displayAttrs.scroll, [
|
|
21093
|
+
"horizontal",
|
|
21094
|
+
"vertical",
|
|
21095
|
+
"both"
|
|
21096
|
+
], nodePath, nodeId);
|
|
21097
|
+
validateEnum(attrs, displayAttrs.scrollBar, [
|
|
21098
|
+
"default",
|
|
21099
|
+
"visible",
|
|
21100
|
+
"auto",
|
|
21101
|
+
"hidden"
|
|
21102
|
+
], nodePath, nodeId);
|
|
21103
|
+
}
|
|
21104
|
+
if (displayAttrs && normalizedTagName === "group") {
|
|
21105
|
+
validateBooleanAttrs(attrs, [
|
|
21106
|
+
displayAttrs.advanced,
|
|
21107
|
+
displayAttrs.excludeInvisibles,
|
|
21108
|
+
displayAttrs.autoSizeDisabled
|
|
21109
|
+
], nodePath, nodeId);
|
|
21110
|
+
validateInt32Attrs(attrs, [
|
|
21111
|
+
displayAttrs.lineGap,
|
|
21112
|
+
displayAttrs.columnGap,
|
|
21113
|
+
displayAttrs.mainGridIndex
|
|
21114
|
+
], nodePath, nodeId);
|
|
21115
|
+
validateEnum(attrs, displayAttrs.layout, [
|
|
21116
|
+
"none",
|
|
21117
|
+
"hz",
|
|
21118
|
+
"vt"
|
|
21119
|
+
], nodePath, nodeId);
|
|
21120
|
+
}
|
|
21121
|
+
if (displayAttrs && [
|
|
21122
|
+
"image",
|
|
21123
|
+
"loader",
|
|
21124
|
+
"loader3d"
|
|
21125
|
+
].includes(normalizedTagName)) {
|
|
21126
|
+
validateBooleanAttrs(attrs, [
|
|
21127
|
+
displayAttrs.fillClockwise,
|
|
21128
|
+
displayAttrs.shrinkOnly,
|
|
21129
|
+
displayAttrs.autoSize,
|
|
21130
|
+
displayAttrs.useResize,
|
|
21131
|
+
displayAttrs.playing,
|
|
21132
|
+
displayAttrs.loop,
|
|
21133
|
+
displayAttrs.clearOnPublish
|
|
21134
|
+
], nodePath, nodeId);
|
|
21135
|
+
validateInt32Attrs(attrs, [
|
|
21136
|
+
displayAttrs.frame,
|
|
21137
|
+
displayAttrs.fillOrigin,
|
|
21138
|
+
displayAttrs.fillAmount
|
|
21139
|
+
], nodePath, nodeId);
|
|
21140
|
+
validateEnum(attrs, displayAttrs.align, [
|
|
21141
|
+
"left",
|
|
21142
|
+
"center",
|
|
21143
|
+
"right"
|
|
21144
|
+
], nodePath, nodeId);
|
|
21145
|
+
validateEnum(attrs, displayAttrs.vAlign, [
|
|
21146
|
+
"top",
|
|
21147
|
+
"middle",
|
|
21148
|
+
"bottom"
|
|
21149
|
+
], nodePath, nodeId);
|
|
21150
|
+
validateEnum(attrs, displayAttrs.fill, [
|
|
21151
|
+
"none",
|
|
21152
|
+
"scale",
|
|
21153
|
+
"scaleMatchHeight",
|
|
21154
|
+
"scaleMatchWidth",
|
|
21155
|
+
"scaleFree",
|
|
21156
|
+
"scaleNoBorder"
|
|
21157
|
+
], nodePath, nodeId);
|
|
21158
|
+
validateEnum(attrs, displayAttrs.fillMethod, [
|
|
21159
|
+
"none",
|
|
21160
|
+
"hz",
|
|
21161
|
+
"vt",
|
|
21162
|
+
"radial90",
|
|
21163
|
+
"radial180",
|
|
21164
|
+
"radial360"
|
|
21165
|
+
], nodePath, nodeId);
|
|
21166
|
+
}
|
|
21167
|
+
if (displayAttrs && (normalizedTagName === "movieclip" || normalizedTagName === "jta")) {
|
|
21168
|
+
validateBooleanAttrs(attrs, [displayAttrs.playing], nodePath, nodeId);
|
|
21169
|
+
validateInt32Attrs(attrs, [displayAttrs.frame], nodePath, nodeId);
|
|
21170
|
+
}
|
|
20509
21171
|
for (const gearTag of ["gearXY", "gearSize"]) for (const [gearIndex, gearDefinition] of ensureArray(attrs[gearTag]).entries()) {
|
|
20510
21172
|
const gear = getXmlNode(gearDefinition);
|
|
20511
21173
|
if (!gear) continue;
|
|
@@ -20649,7 +21311,7 @@ var ProjectReader = class {
|
|
|
20649
21311
|
assertWellFormedXml(compContent);
|
|
20650
21312
|
const componentNode = getXmlNode(parseXML(compContent).component);
|
|
20651
21313
|
if (!componentNode) throw new Error("Component XML must contain a component root element.");
|
|
20652
|
-
|
|
21314
|
+
validateComponentXmlValues(ctx, comp, compPath, componentNode);
|
|
20653
21315
|
}
|
|
20654
21316
|
readComponentXml(ctx, comp, compContent);
|
|
20655
21317
|
} catch (err) {
|
|
@@ -20991,6 +21653,7 @@ var ProjectReader = class {
|
|
|
20991
21653
|
case "MovieClipResource": return resource.getFileName();
|
|
20992
21654
|
case "SoundResource":
|
|
20993
21655
|
case "MiscResource":
|
|
21656
|
+
case "SwfResource":
|
|
20994
21657
|
case "SpineResource":
|
|
20995
21658
|
case "DragonBonesResource": return resource.getFile();
|
|
20996
21659
|
default: return "";
|
|
@@ -21086,6 +21749,18 @@ var ProjectReader = class {
|
|
|
21086
21749
|
ctx.registerResource(pkg.getId(), id, res);
|
|
21087
21750
|
return res;
|
|
21088
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
|
+
}
|
|
21089
21764
|
case "font": {
|
|
21090
21765
|
const res = doc.createFontResource(name.replace(/\.\w+$/, ""));
|
|
21091
21766
|
res.setId(id);
|
|
@@ -21166,6 +21841,7 @@ var ProjectReader = class {
|
|
|
21166
21841
|
ctx.registerResource(pkg.getId(), id, res);
|
|
21167
21842
|
return res;
|
|
21168
21843
|
}
|
|
21844
|
+
case "atlas": return null;
|
|
21169
21845
|
default:
|
|
21170
21846
|
ctx.addDiagnostic({
|
|
21171
21847
|
severity: "error",
|
|
@@ -21558,6 +22234,13 @@ function formatButtonMode(mode) {
|
|
|
21558
22234
|
2: "Radio"
|
|
21559
22235
|
}[mode] ?? "Common";
|
|
21560
22236
|
}
|
|
22237
|
+
function formatButtonDownEffect(effect) {
|
|
22238
|
+
return [
|
|
22239
|
+
"none",
|
|
22240
|
+
"dark",
|
|
22241
|
+
"scale"
|
|
22242
|
+
][effect] ?? "none";
|
|
22243
|
+
}
|
|
21561
22244
|
function formatTitleType(titleType) {
|
|
21562
22245
|
return {
|
|
21563
22246
|
0: "percent",
|
|
@@ -21820,6 +22503,7 @@ function serializeChild(obj) {
|
|
|
21820
22503
|
if (typedObj.getShrinkOnly?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.shrinkOnly, "1");
|
|
21821
22504
|
if (typedObj.getAutoSize?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.autoSize, "1");
|
|
21822
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");
|
|
21823
22507
|
const loaderColor = typedObj.getColor?.();
|
|
21824
22508
|
if (loaderColor && !isDefaultWhiteColor(loaderColor)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.color, loaderColor);
|
|
21825
22509
|
if (typedObj.getFilter?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.loader.attrs.filter, typedObj.getFilter?.());
|
|
@@ -21881,10 +22565,14 @@ function serializeChild(obj) {
|
|
|
21881
22565
|
if (typedObj.getTemplateVarsEnabled?.()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.vars, "true");
|
|
21882
22566
|
const faceDilate = typedObj.getFaceDilate?.() ?? 0;
|
|
21883
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));
|
|
21884
22570
|
const underlaySoftness = typedObj.getUnderlaySoftness?.() ?? 0;
|
|
21885
22571
|
if (underlaySoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.text.attrs.underlaySoftness, String(underlaySoftness));
|
|
21886
22572
|
}
|
|
21887
22573
|
if (type === "GRichTextField") {
|
|
22574
|
+
const outlineSoftness = typedObj.getOutlineSoftness?.() ?? 0;
|
|
22575
|
+
if (outlineSoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.outlineSoftness, String(outlineSoftness));
|
|
21888
22576
|
const underlaySoftness = typedObj.getUnderlaySoftness?.() ?? 0;
|
|
21889
22577
|
if (underlaySoftness !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.richText.attrs.underlaySoftness, String(underlaySoftness));
|
|
21890
22578
|
}
|
|
@@ -21970,8 +22658,8 @@ function serializeChild(obj) {
|
|
|
21970
22658
|
const layout = typedObj.getLayout?.();
|
|
21971
22659
|
if (layout !== void 0 && layout !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.group.attrs.layout, {
|
|
21972
22660
|
0: "none",
|
|
21973
|
-
1: "
|
|
21974
|
-
2: "
|
|
22661
|
+
1: "hz",
|
|
22662
|
+
2: "vt"
|
|
21975
22663
|
}[layout] ?? "none");
|
|
21976
22664
|
const lineGap = typedObj.getLineGap?.() ?? 0;
|
|
21977
22665
|
if (lineGap !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.group.attrs.lineGap, String(lineGap));
|
|
@@ -22013,7 +22701,8 @@ function serializeChild(obj) {
|
|
|
22013
22701
|
if ((layout === 2 || layout === 4) && columnCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(columnCount));
|
|
22014
22702
|
else if (layout === 3 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(lineCount));
|
|
22015
22703
|
if (layout === 4 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount2, String(lineCount));
|
|
22016
|
-
|
|
22704
|
+
const autoResizeItem = typedObj.getAutoResizeItem?.() ?? true;
|
|
22705
|
+
if (autoResizeItem !== getDefaultListAutoResizeItem(layout ?? 0)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem, String(autoResizeItem));
|
|
22017
22706
|
const childrenRenderOrder = typedObj.getChildrenRenderOrder?.() ?? 0;
|
|
22018
22707
|
if (childrenRenderOrder !== 0) {
|
|
22019
22708
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder, {
|
|
@@ -22054,6 +22743,13 @@ function serializeChild(obj) {
|
|
|
22054
22743
|
1: "vertical",
|
|
22055
22744
|
2: "both"
|
|
22056
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");
|
|
22057
22753
|
const scrollBarFlags = typedObj.getScrollBarFlags?.() ?? 0;
|
|
22058
22754
|
if (scrollBarFlags !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarFlags, String(scrollBarFlags));
|
|
22059
22755
|
const scrollBarMargin = typedObj.getScrollBarMargin?.();
|
|
@@ -22154,8 +22850,13 @@ function serializeChild(obj) {
|
|
|
22154
22850
|
if (typedObj.getInstanceController?.() && extSpecs.controller) writeXmlAttr(extAttrs, extSpecs.controller, typedObj.getInstanceController?.());
|
|
22155
22851
|
if (typedObj.getInstancePage?.() && extSpecs.page) writeXmlAttr(extAttrs, extSpecs.page, typedObj.getInstancePage?.());
|
|
22156
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]);
|
|
22157
22858
|
if (typedObj.getInstanceSound?.() && extSpecs.sound) writeXmlAttr(extAttrs, extSpecs.sound, typedObj.getInstanceSound?.());
|
|
22158
|
-
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"));
|
|
22159
22860
|
if (typedObj.getInstancePromptText?.() && extSpecs.prompt) writeXmlAttr(extAttrs, extSpecs.prompt, typedObj.getInstancePromptText?.());
|
|
22160
22861
|
if (typedObj.getInstanceSelectionController?.() && extSpecs.selectionController) writeXmlAttr(extAttrs, extSpecs.selectionController, typedObj.getInstanceSelectionController?.());
|
|
22161
22862
|
if ((typedObj.getInstanceVisibleItemCount?.() ?? 0) > 0 && extSpecs.visibleItemCount) writeXmlAttr(extAttrs, extSpecs.visibleItemCount, String(typedObj.getInstanceVisibleItemCount?.() ?? 0));
|
|
@@ -22333,8 +23034,11 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22333
23034
|
if (typedComp.getBgColorEnabled?.()) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColorEnabled, "true");
|
|
22334
23035
|
const bgColor = typedComp.getBgColor?.();
|
|
22335
23036
|
if (bgColor) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.bgColor, bgColor);
|
|
22336
|
-
const
|
|
22337
|
-
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));
|
|
22338
23042
|
const designImageLayer = typedComp.getDesignImageLayer?.() ?? 0;
|
|
22339
23043
|
if (designImageLayer !== 0) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.designImageLayer, String(designImageLayer));
|
|
22340
23044
|
const designImageOffsetX = typedComp.getDesignImageOffsetX?.() ?? 0;
|
|
@@ -22347,6 +23051,14 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22347
23051
|
if (initName) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.initName, initName);
|
|
22348
23052
|
const remark = typedComp.getRemark?.();
|
|
22349
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);
|
|
22350
23062
|
const clipSoftness = typedComp.getClipSoftness?.();
|
|
22351
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"));
|
|
22352
23064
|
if (typedComp.getOpaque?.() === false) writeXmlAttr(compAttrs, PROJECT_XML_PROTOCOL.componentRoot.attrs.opaque, "false");
|
|
@@ -22403,7 +23115,7 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22403
23115
|
}
|
|
22404
23116
|
const customProperties = typedComp.getCustomProperties?.() ?? [];
|
|
22405
23117
|
const customPropertyChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
22406
|
-
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children
|
|
23118
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children.customProperty;
|
|
22407
23119
|
if (customProperties.length > 0 && customPropertyChildName) compNode[customPropertyChildName] = customProperties.map((property) => {
|
|
22408
23120
|
const attrs = {};
|
|
22409
23121
|
writeXmlAttr(attrs, customPropertyProtocol?.attrs.target, property.target);
|
|
@@ -22418,10 +23130,10 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22418
23130
|
case "Button": {
|
|
22419
23131
|
if ((typedComp.getButtonMode?.() ?? 0) !== 0) writeXmlAttr(extAttrs, extSpecs.mode, formatButtonMode(typedComp.getButtonMode?.() ?? 0));
|
|
22420
23132
|
if (typedComp.getSound?.()) writeXmlAttr(extAttrs, extSpecs.sound, typedComp.getSound?.());
|
|
22421
|
-
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)));
|
|
22422
23134
|
const downEffect = typedComp.getDownEffect?.() ?? 0;
|
|
22423
23135
|
if (downEffect !== 0) {
|
|
22424
|
-
writeXmlAttr(extAttrs, extSpecs.downEffect,
|
|
23136
|
+
writeXmlAttr(extAttrs, extSpecs.downEffect, formatButtonDownEffect(downEffect));
|
|
22425
23137
|
writeXmlAttr(extAttrs, extSpecs.downEffectValue, formatButtonDownEffectValue(typedComp.getDownEffectValue?.() ?? .8));
|
|
22426
23138
|
}
|
|
22427
23139
|
break;
|
|
@@ -22462,11 +23174,27 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
22462
23174
|
await fs.writeFile(targetPath, builder.build(xmlObj));
|
|
22463
23175
|
}
|
|
22464
23176
|
function serializeController(ctrl) {
|
|
22465
|
-
const
|
|
23177
|
+
const pages = ctrl.listPages();
|
|
23178
|
+
const pagesStr = pages.map((p) => `${p.getId()},${p.getName()}`).join(",");
|
|
22466
23179
|
const attrs = {};
|
|
22467
23180
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.name, ctrl.getName());
|
|
22468
23181
|
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.controller.attrs.pages, pagesStr);
|
|
22469
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;
|
|
22470
23198
|
const actions = ctrl.listActions().map((action) => serializeControllerAction(action));
|
|
22471
23199
|
const actionChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.controller, "action");
|
|
22472
23200
|
if (actions.length > 0 && actionChildName) attrs[actionChildName] = actions;
|
|
@@ -22998,6 +23726,7 @@ var ProjectWriter = class {
|
|
|
22998
23726
|
SoundResource: "sound",
|
|
22999
23727
|
FontResource: "font",
|
|
23000
23728
|
MovieClipResource: "movieclip",
|
|
23729
|
+
SwfResource: "swf",
|
|
23001
23730
|
SpineResource: "spine",
|
|
23002
23731
|
DragonBonesResource: "dragonbones"
|
|
23003
23732
|
}[propertyType] ?? null;
|
|
@@ -23010,7 +23739,7 @@ var ProjectWriter = class {
|
|
|
23010
23739
|
const fileName = res.getFileName?.() ?? "";
|
|
23011
23740
|
if (fileName) return fileName;
|
|
23012
23741
|
}
|
|
23013
|
-
if (type === "SoundResource" || type === "MiscResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
23742
|
+
if (type === "SoundResource" || type === "MiscResource" || type === "SwfResource" || type === "SpineResource" || type === "DragonBonesResource") {
|
|
23014
23743
|
const fileName = res.getFile?.() ?? "";
|
|
23015
23744
|
if (fileName) return fileName;
|
|
23016
23745
|
}
|
|
@@ -23257,21 +23986,31 @@ function decodeComponentControllers(doc, resource, buf) {
|
|
|
23257
23986
|
controller.addPage(page);
|
|
23258
23987
|
}
|
|
23259
23988
|
let homePageIndex = 0;
|
|
23989
|
+
let homePageType = controller.getHomePageType();
|
|
23990
|
+
let homePage = "";
|
|
23260
23991
|
if (controllerBuf.version >= 2 && remainingBytes(controllerBuf) >= 1) switch (controllerBuf.getUint8()) {
|
|
23261
23992
|
case 1:
|
|
23262
|
-
|
|
23993
|
+
homePageType = "specific";
|
|
23994
|
+
if (remainingBytes(controllerBuf) >= 2) {
|
|
23995
|
+
homePageIndex = controllerBuf.getInt16();
|
|
23996
|
+
homePage = controller.listPages()[homePageIndex]?.getId() ?? "";
|
|
23997
|
+
}
|
|
23263
23998
|
break;
|
|
23264
23999
|
case 2:
|
|
24000
|
+
homePageType = "branch";
|
|
23265
24001
|
homePageIndex = 0;
|
|
23266
24002
|
break;
|
|
23267
24003
|
case 3:
|
|
23268
|
-
|
|
24004
|
+
homePageType = "variable";
|
|
24005
|
+
if (remainingBytes(controllerBuf) >= 2) homePage = controllerBuf.readS() ?? "";
|
|
23269
24006
|
homePageIndex = 0;
|
|
23270
24007
|
break;
|
|
23271
24008
|
default:
|
|
24009
|
+
homePageType = "default";
|
|
23272
24010
|
homePageIndex = 0;
|
|
23273
24011
|
break;
|
|
23274
24012
|
}
|
|
24013
|
+
controller.setHomePageType(homePageType).setHomePage(homePage);
|
|
23275
24014
|
if (controller.listPages().length > 0) {
|
|
23276
24015
|
const maxIndex = controller.listPages().length - 1;
|
|
23277
24016
|
controller.setSelectedIndex(Math.min(Math.max(homePageIndex, 0), maxIndex));
|
|
@@ -23634,6 +24373,10 @@ function decodeChildBlock4ComponentLike(resource, child, childBuf) {
|
|
|
23634
24373
|
const controller = resource.listControllers()[pageControllerIndex];
|
|
23635
24374
|
if (controller && "setPageController" in child && typeof child.setPageController === "function") child.setPageController(controller.getName());
|
|
23636
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
|
+
}
|
|
23637
24380
|
}
|
|
23638
24381
|
function decodeChildBlock4TextInput(child, childBuf) {
|
|
23639
24382
|
if (!childBuf.seek(0, 4) || remainingBytes(childBuf) < 10) return;
|
|
@@ -23649,16 +24392,12 @@ function decodeTextChildSpecific(child, childBuf) {
|
|
|
23649
24392
|
y: childBuf.getFloat32()
|
|
23650
24393
|
});
|
|
23651
24394
|
if (childBuf.readBool()) {}
|
|
23652
|
-
if (childBuf.version >= 3 && remainingBytes(childBuf) >= 13)
|
|
23653
|
-
textChild.setStrikethrough(childBuf.readBool());
|
|
23654
|
-
childBuf.skip(12);
|
|
23655
|
-
}
|
|
24395
|
+
if (childBuf.version >= 3 && remainingBytes(childBuf) >= 13) textChild.setStrikethrough(childBuf.readBool()).setFaceDilate(childBuf.getFloat32()).setOutlineSoftness(childBuf.getFloat32()).setUnderlaySoftness(childBuf.getFloat32());
|
|
23656
24396
|
}
|
|
23657
24397
|
function decodeListScrollPane(child, childBuf) {
|
|
23658
24398
|
if (!childBuf.seek(0, 7) || remainingBytes(childBuf) < 10) return;
|
|
23659
24399
|
const listLike = child;
|
|
23660
|
-
listLike.setScrollType(childBuf.getUint8());
|
|
23661
|
-
childBuf.getUint8();
|
|
24400
|
+
listLike.setScrollType(childBuf.getUint8()).setScrollBarDisplay(childBuf.getUint8());
|
|
23662
24401
|
listLike.setScrollBarFlags(childBuf.getInt32());
|
|
23663
24402
|
if (childBuf.readBool() && remainingBytes(childBuf) >= 16) listLike.setScrollBarMargin([
|
|
23664
24403
|
childBuf.getInt32(),
|
|
@@ -23668,20 +24407,26 @@ function decodeListScrollPane(child, childBuf) {
|
|
|
23668
24407
|
]);
|
|
23669
24408
|
listLike.setVtScrollBarRes(childBuf.readS() ?? "").setHzScrollBarRes(childBuf.readS() ?? "").setHeaderRes(childBuf.readS() ?? "").setFooterRes(childBuf.readS() ?? "");
|
|
23670
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
|
+
}
|
|
23671
24420
|
function decodeListItemOverrides(buf, version) {
|
|
23672
|
-
if (remainingBytes(buf) < 2) return
|
|
24421
|
+
if (remainingBytes(buf) < 2) return {};
|
|
23673
24422
|
const controllerOverrideCount = buf.getInt16();
|
|
23674
24423
|
const controllerParts = [];
|
|
23675
24424
|
for (let index = 0; index < controllerOverrideCount && remainingBytes(buf) >= 4; index += 1) controllerParts.push(buf.readS() ?? "", buf.readS() ?? "");
|
|
23676
|
-
|
|
23677
|
-
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
|
|
23681
|
-
buf.readS();
|
|
23682
|
-
}
|
|
23683
|
-
}
|
|
23684
|
-
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
|
+
};
|
|
23685
24430
|
}
|
|
23686
24431
|
function decodeListItems(child, childBuf) {
|
|
23687
24432
|
if (!childBuf.seek(0, 8) || remainingBytes(childBuf) < 4) return;
|
|
@@ -23710,10 +24455,9 @@ function decodeListItems(child, childBuf) {
|
|
|
23710
24455
|
level,
|
|
23711
24456
|
isFolder
|
|
23712
24457
|
};
|
|
23713
|
-
|
|
23714
|
-
items.push(controllers === null ? item : {
|
|
24458
|
+
items.push({
|
|
23715
24459
|
...item,
|
|
23716
|
-
|
|
24460
|
+
...decodeListItemOverrides(childBuf, childBuf.version)
|
|
23717
24461
|
});
|
|
23718
24462
|
childBuf.pos = nextPos;
|
|
23719
24463
|
}
|
|
@@ -23776,7 +24520,7 @@ function decodeChildBlock5(child, childBuf) {
|
|
|
23776
24520
|
if (remainingBytes(childBuf) < 15) return;
|
|
23777
24521
|
const loader = child;
|
|
23778
24522
|
loader.setUrl(childBuf.readS() ?? "").setAlign(childBuf.getUint8()).setVAlign(childBuf.getUint8()).setFill(childBuf.getUint8()).setShrinkOnly(childBuf.readBool()).setAutoSize(childBuf.readBool());
|
|
23779
|
-
childBuf.readBool();
|
|
24523
|
+
loader.setShowErrorSign(childBuf.readBool());
|
|
23780
24524
|
loader.setPlaying(childBuf.readBool()).setFrame(childBuf.getInt32());
|
|
23781
24525
|
if (childBuf.readBool()) loader.setColor(readColorValue(childBuf, false));
|
|
23782
24526
|
loader.setFillMethod(childBuf.getUint8());
|
|
@@ -23865,10 +24609,7 @@ function decodeChildBlock6(resource, child, childBuf) {
|
|
|
23865
24609
|
childBuf.readBool();
|
|
23866
24610
|
}
|
|
23867
24611
|
}
|
|
23868
|
-
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6)
|
|
23869
|
-
childBuf.readS();
|
|
23870
|
-
childBuf.getFloat32();
|
|
23871
|
-
}
|
|
24612
|
+
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
|
|
23872
24613
|
break;
|
|
23873
24614
|
case "ComboBox": {
|
|
23874
24615
|
if (remainingBytes(childBuf) < 2) return;
|
|
@@ -23886,24 +24627,17 @@ function decodeChildBlock6(resource, child, childBuf) {
|
|
|
23886
24627
|
}
|
|
23887
24628
|
component.setInstanceComboItems(items).setInstanceTitle(childBuf.readS() ?? "").setInstanceIcon(childBuf.readS() ?? "");
|
|
23888
24629
|
if (childBuf.readBool()) component.setInstanceTitleColor(readColorValue(childBuf, true));
|
|
23889
|
-
component.setInstanceVisibleItemCount(childBuf.getInt32());
|
|
23890
|
-
childBuf.getUint8();
|
|
24630
|
+
component.setInstanceVisibleItemCount(childBuf.getInt32()).setInstancePopupDirection(childBuf.getUint8());
|
|
23891
24631
|
const selectionControllerIndex = childBuf.getInt16();
|
|
23892
24632
|
if (selectionControllerIndex >= 0) component.setInstanceSelectionController(resource.listControllers()[selectionControllerIndex]?.getName() ?? "");
|
|
23893
|
-
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6)
|
|
23894
|
-
childBuf.readS();
|
|
23895
|
-
childBuf.getFloat32();
|
|
23896
|
-
}
|
|
24633
|
+
if (childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
|
|
23897
24634
|
break;
|
|
23898
24635
|
}
|
|
23899
24636
|
case "ProgressBar":
|
|
23900
24637
|
case "Slider":
|
|
23901
24638
|
if (remainingBytes(childBuf) < 12) return;
|
|
23902
24639
|
component.setInstanceValue(childBuf.getInt32()).setInstanceMax(childBuf.getInt32()).setInstanceMin(childBuf.getInt32());
|
|
23903
|
-
if (extTypeName === "ProgressBar" && childBuf.version >= 5 && remainingBytes(childBuf) >= 6)
|
|
23904
|
-
childBuf.readS();
|
|
23905
|
-
childBuf.getFloat32();
|
|
23906
|
-
}
|
|
24640
|
+
if (extTypeName === "ProgressBar" && childBuf.version >= 5 && remainingBytes(childBuf) >= 6) component.setInstanceSound(childBuf.readS() ?? "").setInstanceSoundVolumeScale(childBuf.getFloat32());
|
|
23907
24641
|
break;
|
|
23908
24642
|
default: break;
|
|
23909
24643
|
}
|
|
@@ -24336,13 +25070,13 @@ var BinaryReader = class {
|
|
|
24336
25070
|
if (scaleOpt === 1) {
|
|
24337
25071
|
const x = buf.getInt32(), y = buf.getInt32();
|
|
24338
25072
|
const w = buf.getInt32(), h = buf.getInt32();
|
|
24339
|
-
buf.getInt32();
|
|
25073
|
+
const tileGridIndice = buf.getInt32();
|
|
24340
25074
|
res.setScaleOption(1).setScale9Grid([
|
|
24341
25075
|
x,
|
|
24342
25076
|
y,
|
|
24343
25077
|
w,
|
|
24344
25078
|
h
|
|
24345
|
-
]);
|
|
25079
|
+
]).setTileGridIndice(tileGridIndice);
|
|
24346
25080
|
} else if (scaleOpt === 2) res.setScaleOption(2);
|
|
24347
25081
|
res.setSmoothing(buf.readBool());
|
|
24348
25082
|
pkg.addResource(res);
|
|
@@ -24380,6 +25114,17 @@ var BinaryReader = class {
|
|
|
24380
25114
|
createdResource = res;
|
|
24381
25115
|
break;
|
|
24382
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
|
+
}
|
|
24383
25128
|
case BinItemType$1.Component: {
|
|
24384
25129
|
const res = doc.createComponent(itemName);
|
|
24385
25130
|
res.setId(itemId).setPath(itemPath).setExported(exported).setSize(width, height);
|
|
@@ -24913,7 +25658,27 @@ function _writeControllers(buf, comp) {
|
|
|
24913
25658
|
buf.writeSEx(page.getId?.() ?? "", false, false);
|
|
24914
25659
|
buf.writeSEx(page.getName?.() ?? "", false, false);
|
|
24915
25660
|
}
|
|
24916
|
-
|
|
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
|
+
}
|
|
24917
25682
|
const cb2 = buf.pos - ctrlIndexPos;
|
|
24918
25683
|
const actions = ctrl.listActions?.() ?? [];
|
|
24919
25684
|
buf.writeInt16(actions.length);
|
|
@@ -25614,7 +26379,7 @@ function _writeDisplayList(buf, comp, _doc, pkg, version) {
|
|
|
25614
26379
|
const isTextInput = childType === "GTextInput";
|
|
25615
26380
|
if (isCompOrList) {
|
|
25616
26381
|
cb4 = buf.pos - childIndexPos;
|
|
25617
|
-
_writeChildBlock4Component(buf, child, comp, pkg);
|
|
26382
|
+
_writeChildBlock4Component(buf, child, comp, pkg, version);
|
|
25618
26383
|
} else if (isTextInput) {
|
|
25619
26384
|
cb4 = buf.pos - childIndexPos;
|
|
25620
26385
|
_writeChildBlock4TextInput(buf, child);
|
|
@@ -25708,9 +26473,9 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
25708
26473
|
buf.writeBool(false);
|
|
25709
26474
|
if (version >= 3) {
|
|
25710
26475
|
buf.writeBool(child.getStrikethrough?.() ?? false);
|
|
25711
|
-
buf.writeFloat32(0);
|
|
25712
|
-
buf.writeFloat32(0);
|
|
25713
|
-
buf.writeFloat32(0);
|
|
26476
|
+
buf.writeFloat32(child.getFaceDilate?.() ?? 0);
|
|
26477
|
+
buf.writeFloat32(child.getOutlineSoftness?.() ?? 0);
|
|
26478
|
+
buf.writeFloat32(child.getUnderlaySoftness?.() ?? 0);
|
|
25714
26479
|
}
|
|
25715
26480
|
break;
|
|
25716
26481
|
}
|
|
@@ -25762,13 +26527,13 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
25762
26527
|
buf.writeInt16(child.getMainGridIndex?.() ?? -1);
|
|
25763
26528
|
break;
|
|
25764
26529
|
case "GLoader": {
|
|
25765
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
26530
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
25766
26531
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
25767
26532
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
25768
26533
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
25769
26534
|
buf.writeBool(child.getShrinkOnly?.() ?? false);
|
|
25770
26535
|
buf.writeBool(_boolVal(child.getAutoSize?.(), false));
|
|
25771
|
-
buf.writeBool(false);
|
|
26536
|
+
buf.writeBool(child.getShowErrorSign?.() ?? false);
|
|
25772
26537
|
buf.writeBool(child.getPlaying?.() ?? true);
|
|
25773
26538
|
buf.writeInt32(child.getFrame?.() ?? 0);
|
|
25774
26539
|
const loaderColor = child.getColor?.() ?? null;
|
|
@@ -25787,7 +26552,7 @@ function _writeChildSpecific(buf, child, pkg, version) {
|
|
|
25787
26552
|
break;
|
|
25788
26553
|
}
|
|
25789
26554
|
case "GLoader3D": {
|
|
25790
|
-
buf.writeS(remapLocalUiUrl(pkg, child.getUrl?.() ?? null));
|
|
26555
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getClearOnPublish?.() ? null : child.getUrl?.() ?? null));
|
|
25791
26556
|
buf.writeUint8(child.getAlign?.() ?? 0);
|
|
25792
26557
|
buf.writeUint8(child.getVAlign?.() ?? 0);
|
|
25793
26558
|
buf.writeUint8(child.getFill?.() ?? 0);
|
|
@@ -25867,7 +26632,7 @@ function _writeChildAfterAdd(buf, child, comp, pkg, version) {
|
|
|
25867
26632
|
case "GTextField":
|
|
25868
26633
|
case "GRichTextField":
|
|
25869
26634
|
case "GTextInput":
|
|
25870
|
-
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getText?.() ?? null), true);
|
|
26635
|
+
buf.writeSEx(remapLocalUiRefsInText(pkg, child.getAutoClearText?.() ? null : child.getText?.() ?? null), true);
|
|
25871
26636
|
break;
|
|
25872
26637
|
case "GButton": {
|
|
25873
26638
|
buf.writeUint8(12);
|
|
@@ -25932,7 +26697,9 @@ function _writeChildAfterAdd(buf, child, comp, pkg, version) {
|
|
|
25932
26697
|
}
|
|
25933
26698
|
buf.writeSEx(child.getTitle?.() ?? null, true);
|
|
25934
26699
|
buf.writeS(remapLocalUiUrl(pkg, child.getIcon?.() ?? null));
|
|
25935
|
-
|
|
26700
|
+
const comboTitleColor = child.getTitleColor?.() ?? null;
|
|
26701
|
+
buf.writeBool(!!comboTitleColor);
|
|
26702
|
+
if (comboTitleColor) buf.writeColor(comboTitleColor, true);
|
|
25936
26703
|
buf.writeInt32(child.getVisibleItemCount?.() ?? 10);
|
|
25937
26704
|
buf.writeUint8(child.getPopupDirection?.() ?? 0);
|
|
25938
26705
|
buf.writeInt16(-1);
|
|
@@ -26014,13 +26781,13 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26014
26781
|
buf.writeInt32(child.getInstanceTitleFontSize?.() ?? 0);
|
|
26015
26782
|
buf.writeBool(false);
|
|
26016
26783
|
if (version >= 5) {
|
|
26017
|
-
buf.writeS(null);
|
|
26018
|
-
buf.writeFloat32(1);
|
|
26784
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
|
|
26785
|
+
buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
|
|
26019
26786
|
}
|
|
26020
26787
|
break;
|
|
26021
26788
|
}
|
|
26022
26789
|
case "ComboBox": {
|
|
26023
|
-
const comboItems = child.getInstanceComboItems?.() ?? [];
|
|
26790
|
+
const comboItems = child.getInstanceAutoClearItems?.() ? [] : child.getInstanceComboItems?.() ?? [];
|
|
26024
26791
|
buf.writeInt16(comboItems.length);
|
|
26025
26792
|
for (const item of comboItems) {
|
|
26026
26793
|
const itemStart = buf.pos;
|
|
@@ -26040,11 +26807,11 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26040
26807
|
buf.writeBool(!!comboTitleColor);
|
|
26041
26808
|
if (comboTitleColor) buf.writeColor(comboTitleColor, true);
|
|
26042
26809
|
buf.writeInt32(child.getInstanceVisibleItemCount?.() ?? 10);
|
|
26043
|
-
buf.writeUint8(0);
|
|
26810
|
+
buf.writeUint8(child.getInstancePopupDirection?.() ?? 0);
|
|
26044
26811
|
buf.writeInt16(-1);
|
|
26045
26812
|
if (version >= 5) {
|
|
26046
|
-
buf.writeS(null);
|
|
26047
|
-
buf.writeFloat32(1);
|
|
26813
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
|
|
26814
|
+
buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
|
|
26048
26815
|
}
|
|
26049
26816
|
break;
|
|
26050
26817
|
}
|
|
@@ -26054,8 +26821,8 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26054
26821
|
buf.writeInt32(child.getInstanceMax?.() ?? 100);
|
|
26055
26822
|
buf.writeInt32(child.getInstanceMin?.() ?? 0);
|
|
26056
26823
|
if (version >= 5 && extType === "ProgressBar") {
|
|
26057
|
-
buf.writeS(null);
|
|
26058
|
-
buf.writeFloat32(1);
|
|
26824
|
+
buf.writeS(remapLocalUiUrl(pkg, child.getInstanceSound?.() ?? null));
|
|
26825
|
+
buf.writeFloat32(child.getInstanceSoundVolumeScale?.() ?? 1);
|
|
26059
26826
|
}
|
|
26060
26827
|
break;
|
|
26061
26828
|
default: break;
|
|
@@ -26063,7 +26830,7 @@ function _writeExtensionInstanceData(buf, extType, child, comp, pkg, version) {
|
|
|
26063
26830
|
}
|
|
26064
26831
|
function _writeScrollPane(buf, child, pkg) {
|
|
26065
26832
|
buf.writeUint8(child.getScrollType?.() ?? 1);
|
|
26066
|
-
buf.writeUint8(0);
|
|
26833
|
+
buf.writeUint8(child.getScrollBarDisplay?.() ?? 0);
|
|
26067
26834
|
buf.writeInt32(child.getScrollBarFlags?.() ?? 0);
|
|
26068
26835
|
const sbMargin = child.getScrollBarMargin?.();
|
|
26069
26836
|
buf.writeBool(!!sbMargin);
|
|
@@ -26081,7 +26848,7 @@ function _writeScrollPane(buf, child, pkg) {
|
|
|
26081
26848
|
function _writeListItems(buf, child, pkg, version) {
|
|
26082
26849
|
buf.writeS(remapLocalUiUrl(pkg, child.getDefaultItem?.() ?? null));
|
|
26083
26850
|
const isTree = child.propertyType === "GTree";
|
|
26084
|
-
const listItems = child.getListItems?.() ?? [];
|
|
26851
|
+
const listItems = child.getAutoClearItems?.() ? [] : child.getListItems?.() ?? [];
|
|
26085
26852
|
buf.writeInt16(listItems.length);
|
|
26086
26853
|
for (const [index, item] of listItems.entries()) {
|
|
26087
26854
|
const itemStart = buf.pos;
|
|
@@ -26111,7 +26878,7 @@ function _writeListItems(buf, child, pkg, version) {
|
|
|
26111
26878
|
buf.pos = controllerCountPos;
|
|
26112
26879
|
buf.writeInt16(controllerCount);
|
|
26113
26880
|
buf.pos = controllerEnd;
|
|
26114
|
-
if (version >= 2) buf.
|
|
26881
|
+
if (version >= 2) _writePropertyOverrides(buf, item.propertyOverrides ?? []);
|
|
26115
26882
|
const itemEnd = buf.pos;
|
|
26116
26883
|
const saved = buf.pos;
|
|
26117
26884
|
buf.pos = itemStart;
|
|
@@ -26123,7 +26890,7 @@ function _writeTreeSettings(buf, child) {
|
|
|
26123
26890
|
buf.writeInt32(child.getIndent?.() ?? 0);
|
|
26124
26891
|
buf.writeUint8(child.getClickToExpand?.() ?? 0);
|
|
26125
26892
|
}
|
|
26126
|
-
function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
26893
|
+
function _writeChildBlock4Component(buf, child, comp, _pkg, version) {
|
|
26127
26894
|
const pageCtrlName = child.getPageController?.() ?? null;
|
|
26128
26895
|
if (pageCtrlName) {
|
|
26129
26896
|
const ctrlIdx = comp.listControllers().findIndex((c) => c.getName() === pageCtrlName);
|
|
@@ -26145,7 +26912,15 @@ function _writeChildBlock4Component(buf, child, comp, _pkg) {
|
|
|
26145
26912
|
buf.writeInt16(count);
|
|
26146
26913
|
buf.pos = saved;
|
|
26147
26914
|
} else buf.writeInt16(0);
|
|
26148
|
-
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
|
+
}
|
|
26149
26924
|
}
|
|
26150
26925
|
function _writeChildBlock4TextInput(buf, child) {
|
|
26151
26926
|
buf.writeSEx(child.getPromptText?.() ?? child.getPrompt?.() ?? null);
|
|
@@ -26210,6 +26985,7 @@ const BinItemType = {
|
|
|
26210
26985
|
Component: 3,
|
|
26211
26986
|
Atlas: 4,
|
|
26212
26987
|
Font: 5,
|
|
26988
|
+
Swf: 6,
|
|
26213
26989
|
Misc: 7,
|
|
26214
26990
|
Unknown: 8,
|
|
26215
26991
|
Spine: 9,
|
|
@@ -26227,6 +27003,7 @@ const EDITOR_TYPE_STRING = {
|
|
|
26227
27003
|
SoundResource: "sound",
|
|
26228
27004
|
Component: "component",
|
|
26229
27005
|
FontResource: "font",
|
|
27006
|
+
SwfResource: "swf",
|
|
26230
27007
|
SpineResource: "spine",
|
|
26231
27008
|
DragonBonesResource: "dragonbones"
|
|
26232
27009
|
};
|
|
@@ -26375,7 +27152,7 @@ var BinaryWriter = class {
|
|
|
26375
27152
|
data.writeInt32(grid[1]);
|
|
26376
27153
|
data.writeInt32(grid[2]);
|
|
26377
27154
|
data.writeInt32(grid[3]);
|
|
26378
|
-
data.writeInt32(
|
|
27155
|
+
data.writeInt32(res.getTileGridIndice());
|
|
26379
27156
|
}
|
|
26380
27157
|
data.writeBool(res.getSmoothing());
|
|
26381
27158
|
break;
|
|
@@ -26429,6 +27206,16 @@ var BinaryWriter = class {
|
|
|
26429
27206
|
data.writeInt32(0);
|
|
26430
27207
|
data.writeInt32(0);
|
|
26431
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;
|
|
26432
27219
|
case "Component": {
|
|
26433
27220
|
data.writeUint8(BinItemType.Component);
|
|
26434
27221
|
data.writeS(getPublishedItemId$1(res));
|
|
@@ -26572,13 +27359,15 @@ var BinaryWriter = class {
|
|
|
26572
27359
|
const oh = sp.originalHeight ?? 0;
|
|
26573
27360
|
const isPackageItemSprite = packageItemIds.has(sp.itemId);
|
|
26574
27361
|
const isZeroSizedDirectOutput = isPackageItemSprite && sp.w === 0 && sp.h === 0;
|
|
26575
|
-
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;
|
|
26576
27365
|
data.writeBool(hasOriginal);
|
|
26577
27366
|
if (hasOriginal) {
|
|
26578
27367
|
data.writeInt32(ox);
|
|
26579
27368
|
data.writeInt32(oy);
|
|
26580
|
-
data.writeInt32(
|
|
26581
|
-
data.writeInt32(
|
|
27369
|
+
data.writeInt32(originalWidth);
|
|
27370
|
+
data.writeInt32(originalHeight);
|
|
26582
27371
|
}
|
|
26583
27372
|
}
|
|
26584
27373
|
const spriteNextPos = data.pos;
|
|
@@ -26903,7 +27692,7 @@ function createTransform(name, fn) {
|
|
|
26903
27692
|
Object.defineProperty(fn, "name", { value: name });
|
|
26904
27693
|
return fn;
|
|
26905
27694
|
}
|
|
26906
|
-
function parseTextureSetMode(value) {
|
|
27695
|
+
function parseTextureSetMode(value, maxAtlasIndex = 10) {
|
|
26907
27696
|
const raw = value?.trim() ?? "";
|
|
26908
27697
|
if (!raw) return {
|
|
26909
27698
|
kind: "auto",
|
|
@@ -26926,7 +27715,7 @@ function parseTextureSetMode(value) {
|
|
|
26926
27715
|
};
|
|
26927
27716
|
if (/^\d+$/.test(raw)) {
|
|
26928
27717
|
const pageIndex = Number(raw);
|
|
26929
|
-
if (pageIndex >= 0 && pageIndex <=
|
|
27718
|
+
if (pageIndex >= 0 && pageIndex <= maxAtlasIndex) return {
|
|
26930
27719
|
kind: "page",
|
|
26931
27720
|
raw,
|
|
26932
27721
|
pageIndex
|
|
@@ -26984,9 +27773,9 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
26984
27773
|
const sourcePackageId = child.getPackageId?.()?.trim();
|
|
26985
27774
|
if (sourcePackageId && sourcePackageId !== ownerPackageId) target.packageIds.add(sourcePackageId);
|
|
26986
27775
|
addFontReferences(target, ownerPackageId, child.getFont?.());
|
|
26987
|
-
addTextReferences(target, ownerPackageId, child.getText?.());
|
|
27776
|
+
if (!child.getAutoClearText?.()) addTextReferences(target, ownerPackageId, child.getText?.());
|
|
26988
27777
|
for (const reference of [
|
|
26989
|
-
child.getUrl?.(),
|
|
27778
|
+
child.getClearOnPublish?.() ? void 0 : child.getUrl?.(),
|
|
26990
27779
|
child.getDefaultItem?.(),
|
|
26991
27780
|
child.getIcon?.(),
|
|
26992
27781
|
child.getSelectedIcon?.(),
|
|
@@ -27000,11 +27789,14 @@ function collectComponentReferences(target, ownerPackageId, component) {
|
|
|
27000
27789
|
child.getHeaderRes?.(),
|
|
27001
27790
|
child.getFooterRes?.()
|
|
27002
27791
|
]) addUiReference(target, ownerPackageId, reference);
|
|
27003
|
-
for (const item of child.getInstanceComboItems?.() ?? []) addUiReference(target, ownerPackageId, item.icon);
|
|
27004
|
-
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?.() ?? []) {
|
|
27005
27794
|
addUiReference(target, ownerPackageId, item.icon);
|
|
27795
|
+
addUiReference(target, ownerPackageId, item.selectedIcon);
|
|
27006
27796
|
addUiReference(target, ownerPackageId, item.url);
|
|
27797
|
+
addUnknownReferences(target, ownerPackageId, item.propertyOverrides?.map((property) => property.value));
|
|
27007
27798
|
}
|
|
27799
|
+
addUnknownReferences(target, ownerPackageId, child.getPropertyOverrides?.().map((property) => property.value));
|
|
27008
27800
|
for (const gear of child.listGears?.() ?? []) {
|
|
27009
27801
|
addUnknownReferences(target, ownerPackageId, gear.getValues?.());
|
|
27010
27802
|
addUnknownReferences(target, ownerPackageId, gear.getDefaultValue?.());
|
|
@@ -27034,7 +27826,8 @@ function collectPackageResourceReferences(pkg) {
|
|
|
27034
27826
|
localResourceIds: /* @__PURE__ */ new Set(),
|
|
27035
27827
|
packageIds: /* @__PURE__ */ new Set()
|
|
27036
27828
|
};
|
|
27037
|
-
|
|
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);
|
|
27038
27831
|
return references;
|
|
27039
27832
|
}
|
|
27040
27833
|
//#endregion
|
|
@@ -27061,6 +27854,9 @@ function isFontResource(resource) {
|
|
|
27061
27854
|
function isSoundResource(resource) {
|
|
27062
27855
|
return resource.propertyType === "SoundResource";
|
|
27063
27856
|
}
|
|
27857
|
+
function isSwfResource(resource) {
|
|
27858
|
+
return resource.propertyType === "SwfResource";
|
|
27859
|
+
}
|
|
27064
27860
|
function isSpineResource(resource) {
|
|
27065
27861
|
return resource.propertyType === "SpineResource";
|
|
27066
27862
|
}
|
|
@@ -27102,10 +27898,12 @@ function extname(fileName) {
|
|
|
27102
27898
|
return normalized.slice(lastDot);
|
|
27103
27899
|
}
|
|
27104
27900
|
function resolvePublishedMiscFileName(resource, projectType) {
|
|
27105
|
-
const
|
|
27106
|
-
if (projectType
|
|
27107
|
-
|
|
27108
|
-
|
|
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"}`;
|
|
27109
27907
|
}
|
|
27110
27908
|
function resolvePublishedSkeletonFileName(resource, projectType) {
|
|
27111
27909
|
if (projectType === UNITY_PROJECT_TYPE$1 && isSpineResource(resource) && resource.getFile().toLowerCase().endsWith(".skel")) return `${resource.getFile()}.bytes`;
|
|
@@ -27172,16 +27970,16 @@ function trimTrailingMissingHighResolutionIds(ids) {
|
|
|
27172
27970
|
while (ids.length > 0 && !ids[ids.length - 1]) ids.pop();
|
|
27173
27971
|
return ids;
|
|
27174
27972
|
}
|
|
27175
|
-
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution) {
|
|
27973
|
+
function collectHighResolutionItemIds(resources, publishedResourceIds, includeHighResolution, excludedResourceIds) {
|
|
27176
27974
|
const result = /* @__PURE__ */ new Map();
|
|
27177
27975
|
if (includeHighResolution <= 0) return result;
|
|
27178
27976
|
const highResolutionResourceByKey = /* @__PURE__ */ new Map();
|
|
27179
27977
|
for (const resource of resources) {
|
|
27180
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
27978
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
27181
27979
|
highResolutionResourceByKey.set(buildHighResolutionResourceKey(resource), resource);
|
|
27182
27980
|
}
|
|
27183
27981
|
for (const resource of resources) {
|
|
27184
|
-
if (!isHighResolutionResource(resource)) continue;
|
|
27982
|
+
if (!isHighResolutionResource(resource) || excludedResourceIds.has(resource.getId())) continue;
|
|
27185
27983
|
if (!publishedResourceIds.has(resource.getId())) continue;
|
|
27186
27984
|
if (isHighResolutionVariantName(resource.getName())) continue;
|
|
27187
27985
|
const ids = [];
|
|
@@ -27206,6 +28004,7 @@ function collectHighResolutionItemIds(resources, publishedResourceIds, includeHi
|
|
|
27206
28004
|
}
|
|
27207
28005
|
function collectPackagePublishContext(pkg, options) {
|
|
27208
28006
|
const resources = pkg.listResources();
|
|
28007
|
+
const excludedResourceIds = new Set(pkg.getSourceAtlasSettings().excludedResourceIds);
|
|
27209
28008
|
const resourceMap = new Map(resources.map((resource) => [resource.getId(), resource]));
|
|
27210
28009
|
const referencedIds = collectPackageResourceReferences(pkg).localResourceIds;
|
|
27211
28010
|
const pixelHitTestImageIds = /* @__PURE__ */ new Set();
|
|
@@ -27217,10 +28016,15 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27217
28016
|
while (changed) {
|
|
27218
28017
|
changed = false;
|
|
27219
28018
|
for (const resourceId of [...exportedResourceIds]) {
|
|
28019
|
+
if (excludedResourceIds.has(resourceId)) {
|
|
28020
|
+
exportedResourceIds.delete(resourceId);
|
|
28021
|
+
changed = true;
|
|
28022
|
+
continue;
|
|
28023
|
+
}
|
|
27220
28024
|
const resource = resourcesById.get(resourceId);
|
|
27221
28025
|
if (!resource || !isSkeletonResource(resource)) continue;
|
|
27222
28026
|
for (const requiredId of resource.getRequireIds()) {
|
|
27223
|
-
if (!requiredId || exportedResourceIds.has(requiredId)) continue;
|
|
28027
|
+
if (!requiredId || excludedResourceIds.has(requiredId) || exportedResourceIds.has(requiredId)) continue;
|
|
27224
28028
|
exportedResourceIds.add(requiredId);
|
|
27225
28029
|
changed = true;
|
|
27226
28030
|
}
|
|
@@ -27228,7 +28032,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27228
28032
|
}
|
|
27229
28033
|
return exportedResourceIds;
|
|
27230
28034
|
};
|
|
27231
|
-
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());
|
|
27232
28036
|
for (const resource of resources) {
|
|
27233
28037
|
if (!isComponentResource(resource)) continue;
|
|
27234
28038
|
const component = resource;
|
|
@@ -27237,7 +28041,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27237
28041
|
const hitTest = component.getHitTest?.()?.trim();
|
|
27238
28042
|
if (hitTest && !hitTest.includes(",")) {
|
|
27239
28043
|
const sourceId = childMap.get(hitTest)?.getSrc?.();
|
|
27240
|
-
if (sourceId) {
|
|
28044
|
+
if (sourceId && !excludedResourceIds.has(sourceId)) {
|
|
27241
28045
|
const sourceResource = resourceMap.get(sourceId);
|
|
27242
28046
|
if (sourceResource && isImageResource(sourceResource)) pixelHitTestImageIds.add(sourceId);
|
|
27243
28047
|
}
|
|
@@ -27246,7 +28050,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27246
28050
|
const publishedResourceIds = new Set(spriteItemIds);
|
|
27247
28051
|
for (const resource of resources) {
|
|
27248
28052
|
const resourceId = resource.getId();
|
|
27249
|
-
if (!resourceId) continue;
|
|
28053
|
+
if (!resourceId || excludedResourceIds.has(resourceId)) continue;
|
|
27250
28054
|
if (isComponentResource(resource)) {
|
|
27251
28055
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
27252
28056
|
continue;
|
|
@@ -27270,7 +28074,7 @@ function collectPackagePublishContext(pkg, options) {
|
|
|
27270
28074
|
if (resource.getExported() || referencedIds.has(resourceId)) publishedResourceIds.add(resourceId);
|
|
27271
28075
|
}
|
|
27272
28076
|
for (const resourceId of collectExportedResourceIds(resources, publishedResourceIds)) publishedResourceIds.add(resourceId);
|
|
27273
|
-
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution);
|
|
28077
|
+
const highResolutionItemIds = collectHighResolutionItemIds(resources, publishedResourceIds, options.includeHighResolution, excludedResourceIds);
|
|
27274
28078
|
if (!options.includeBranches) {
|
|
27275
28079
|
const mainByKey = /* @__PURE__ */ new Map();
|
|
27276
28080
|
const activeBranchByKey = /* @__PURE__ */ new Map();
|
|
@@ -27398,6 +28202,10 @@ async function annotatePackagePublishArtifacts(pkg, basePath, encoder, options)
|
|
|
27398
28202
|
setPublishedFileExtra(resource, resolvePublishedMiscFileName(resource, options.projectType));
|
|
27399
28203
|
continue;
|
|
27400
28204
|
}
|
|
28205
|
+
if (isSwfResource(resource)) {
|
|
28206
|
+
setPublishedFileExtra(resource, resolvePublishedSwfFileName(resource));
|
|
28207
|
+
continue;
|
|
28208
|
+
}
|
|
27401
28209
|
if (isSkeletonResource(resource)) setPublishedFileExtra(resource, resolvePublishedSkeletonFileName(resource, options.projectType));
|
|
27402
28210
|
}
|
|
27403
28211
|
}
|
|
@@ -28656,7 +29464,7 @@ function packAtlasPages(inputs, options, forceSinglePage, sizeOverrides) {
|
|
|
28656
29464
|
});
|
|
28657
29465
|
return new MaxRectsPackerCompat({
|
|
28658
29466
|
pot: sizeOverrides?.powerOfTwo ?? options.powerOfTwo,
|
|
28659
|
-
mof: sizeOverrides?.multipleOfFour ??
|
|
29467
|
+
mof: sizeOverrides?.multipleOfFour ?? options.multipleOfFour,
|
|
28660
29468
|
padding: options.padding,
|
|
28661
29469
|
rotation: options.allowRotation,
|
|
28662
29470
|
minWidth: 16,
|
|
@@ -28756,7 +29564,7 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
28756
29564
|
}
|
|
28757
29565
|
}
|
|
28758
29566
|
const outputFile = `${options.outputPath}/${atlasFileName}`;
|
|
28759
|
-
|
|
29567
|
+
const atlasPipeline = encoder({ create: {
|
|
28760
29568
|
width: page.width,
|
|
28761
29569
|
height: page.height,
|
|
28762
29570
|
channels: 4,
|
|
@@ -28766,7 +29574,13 @@ async function writeAtlasPageImage(pkg, inputs, page, atlasFileName, encoder, op
|
|
|
28766
29574
|
b: 0,
|
|
28767
29575
|
alpha: 0
|
|
28768
29576
|
}
|
|
28769
|
-
} }).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);
|
|
28770
29584
|
logger.info(`atlas: Generated ${atlasFileName} (${page.width}x${page.height}, ${page.outputRects.length} sprites)`);
|
|
28771
29585
|
}
|
|
28772
29586
|
function inputToCompatRect(input, index) {
|
|
@@ -28816,6 +29630,9 @@ function resolveDirectOutputAtlasSize(width, height, options) {
|
|
|
28816
29630
|
if (options.powerOfTwo) {
|
|
28817
29631
|
resolvedWidth = nextPow2(resolvedWidth);
|
|
28818
29632
|
resolvedHeight = nextPow2(resolvedHeight);
|
|
29633
|
+
} else if (options.multipleOfFour) {
|
|
29634
|
+
resolvedWidth = roundUpToMultiple(resolvedWidth, 4);
|
|
29635
|
+
resolvedHeight = roundUpToMultiple(resolvedHeight, 4);
|
|
28819
29636
|
}
|
|
28820
29637
|
return {
|
|
28821
29638
|
width: resolvedWidth,
|
|
@@ -28930,9 +29747,8 @@ function sortResourcesByOrder(resources, orderMap, inputOrderMap) {
|
|
|
28930
29747
|
});
|
|
28931
29748
|
return ordered;
|
|
28932
29749
|
}
|
|
28933
|
-
function getResourceTextureSetMode(resource) {
|
|
28934
|
-
|
|
28935
|
-
return parseTextureSetMode(resource.getTextureSetMode?.());
|
|
29750
|
+
function getResourceTextureSetMode(resource, maxAtlasIndex) {
|
|
29751
|
+
return parseTextureSetMode(resource.getTextureSetMode?.(), maxAtlasIndex);
|
|
28936
29752
|
}
|
|
28937
29753
|
function groupStandaloneInputs(doc, inputs, options) {
|
|
28938
29754
|
const autoInputs = [];
|
|
@@ -28951,7 +29767,7 @@ function groupStandaloneInputs(doc, inputs, options) {
|
|
|
28951
29767
|
for (const input of inputs) {
|
|
28952
29768
|
const branchName = getInputBranchName(input);
|
|
28953
29769
|
const branchOrdinal = branchOrdinalByName.get(branchName) ?? 0;
|
|
28954
|
-
const mode = getResourceTextureSetMode(input.resource);
|
|
29770
|
+
const mode = getResourceTextureSetMode(input.resource, options.maxAtlasIndex ?? 10);
|
|
28955
29771
|
if (mode.kind === "standalone") {
|
|
28956
29772
|
const key = `${branchName}\u0000${getPublishedItemId(input.resource)}`;
|
|
28957
29773
|
const existing = standaloneGroups.get(key);
|
|
@@ -28995,6 +29811,8 @@ const ATLAS_DEFAULTS = {
|
|
|
28995
29811
|
allowRotation: true,
|
|
28996
29812
|
padding: 1,
|
|
28997
29813
|
powerOfTwo: false,
|
|
29814
|
+
maxAtlasIndex: 10,
|
|
29815
|
+
multipleOfFour: false,
|
|
28998
29816
|
square: false,
|
|
28999
29817
|
multiPage: true,
|
|
29000
29818
|
trimImage: false,
|
|
@@ -29078,7 +29896,7 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
29078
29896
|
const refChild = child;
|
|
29079
29897
|
await addResource(resourceMap.get(refChild.getSrc?.() ?? ""));
|
|
29080
29898
|
for (const ref of [
|
|
29081
|
-
refChild.getUrl?.(),
|
|
29899
|
+
refChild.getClearOnPublish?.() ? void 0 : refChild.getUrl?.(),
|
|
29082
29900
|
refChild.getDefaultItem?.(),
|
|
29083
29901
|
refChild.getIcon?.(),
|
|
29084
29902
|
refChild.getSelectedIcon?.(),
|
|
@@ -29092,11 +29910,14 @@ async function resolveEditorCompatibleResourceOrder(pkg, allResources, options)
|
|
|
29092
29910
|
refChild.getInstanceIcon?.(),
|
|
29093
29911
|
refChild.getInstanceSelectedIcon?.()
|
|
29094
29912
|
]) await addResourceByLocalUiUrl(ref);
|
|
29095
|
-
for (const item of refChild.getInstanceComboItems?.() ?? []) await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
29096
|
-
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?.() ?? []) {
|
|
29097
29915
|
await addResourceByLocalUiUrl(item.icon ?? void 0);
|
|
29916
|
+
await addResourceByLocalUiUrl(item.selectedIcon ?? void 0);
|
|
29098
29917
|
await addResourceByLocalUiUrl(item.url ?? void 0);
|
|
29918
|
+
for (const property of item.propertyOverrides ?? []) await addResourceByLocalUiUrl(property.value);
|
|
29099
29919
|
}
|
|
29920
|
+
for (const property of refChild.getPropertyOverrides?.() ?? []) await addResourceByLocalUiUrl(property.value);
|
|
29100
29921
|
for (const gear of refChild.listGears?.() ?? []) await addGearIconResources(gear);
|
|
29101
29922
|
}
|
|
29102
29923
|
for (const ref of [
|
|
@@ -29347,23 +30168,32 @@ const FGUI_TYPESCRIPT_RUNTIME_TYPES = new Set([
|
|
|
29347
30168
|
"GTree",
|
|
29348
30169
|
"Transition"
|
|
29349
30170
|
]);
|
|
29350
|
-
const
|
|
30171
|
+
const LAYABOX_TYPESCRIPT_VARIANT = {
|
|
29351
30172
|
binderMethod: "setExtension",
|
|
29352
|
-
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\";"
|
|
29353
30179
|
};
|
|
29354
30180
|
async function publishCodeGeneration(doc, options) {
|
|
29355
30181
|
const logger = doc.getLogger();
|
|
29356
30182
|
const settings = resolveCodeGenerationSettings(doc);
|
|
29357
30183
|
if (!settings.allowGenCode) return;
|
|
29358
|
-
const plugins = options.plugins
|
|
30184
|
+
const plugins = options.plugins ?? [];
|
|
29359
30185
|
if (plugins.length > 0) {
|
|
29360
30186
|
let handled = false;
|
|
29361
|
-
for (const plugin of plugins)
|
|
29362
|
-
|
|
29363
|
-
|
|
29364
|
-
|
|
29365
|
-
|
|
29366
|
-
|
|
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
|
+
}
|
|
29367
30197
|
}
|
|
29368
30198
|
if (handled) return;
|
|
29369
30199
|
}
|
|
@@ -29427,8 +30257,9 @@ function supportsCodeGenerationLane(doc, codeType) {
|
|
|
29427
30257
|
}
|
|
29428
30258
|
function resolveFguiTypescriptVariant(doc) {
|
|
29429
30259
|
const projectType = doc.getRoot().getProjectType();
|
|
29430
|
-
if (projectType
|
|
29431
|
-
return
|
|
30260
|
+
if (projectType === ProjectType.LayaBox) return LAYABOX_TYPESCRIPT_VARIANT;
|
|
30261
|
+
if (projectType === ProjectType.CocosCreator) return COCOS_CREATOR_TYPESCRIPT_VARIANT;
|
|
30262
|
+
return null;
|
|
29432
30263
|
}
|
|
29433
30264
|
async function generateUnityCode(doc, pkg, plan, fs) {
|
|
29434
30265
|
const packageDir = fs.join(plan.outputDir, plan.packageFolderName);
|
|
@@ -29611,7 +30442,8 @@ function renderFguiTypescriptComponentClass(classInfo, plan, variant) {
|
|
|
29611
30442
|
}
|
|
29612
30443
|
function renderFguiTypescriptBinder(classes, plan, variant) {
|
|
29613
30444
|
const bindLines = classes.map((classInfo) => `\t\t${variant.runtimeNamespace}.UIObjectFactory.${variant.binderMethod}(${classInfo.encodedClassName}.URL, ${classInfo.encodedClassName});`).join("\n");
|
|
29614
|
-
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");
|
|
29615
30447
|
return renderTemplate(FGUI_TYPESCRIPT_BINDER_TEMPLATE, {
|
|
29616
30448
|
binderClassName: plan.binderClassName,
|
|
29617
30449
|
bindLines: bindLines ? `${bindLines}\n` : "",
|
|
@@ -29675,6 +30507,7 @@ function normalizeTypeName(value) {
|
|
|
29675
30507
|
}
|
|
29676
30508
|
function collectFguiTypescriptImports(classInfo, variant) {
|
|
29677
30509
|
const imports = /* @__PURE__ */ new Set();
|
|
30510
|
+
if (variant.runtimeImport) imports.add(variant.runtimeImport);
|
|
29678
30511
|
for (const member of classInfo.members) {
|
|
29679
30512
|
if (member.ignored) continue;
|
|
29680
30513
|
const translated = translateFguiTypescriptType(member.type, variant);
|
|
@@ -30648,23 +31481,24 @@ async function exportPackageExternalResources(pkg, outputDir, basePath, fs, read
|
|
|
30648
31481
|
if (exportedResourceIds.size === 0) return;
|
|
30649
31482
|
if (!basePath || !readFileRaw) {
|
|
30650
31483
|
if (pkg.listResources().some((resource) => {
|
|
30651
|
-
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());
|
|
30652
31485
|
})) throw new Error(`publish: External resources in package "${pkg.getName()}" require basePath and readFileRaw for output.`);
|
|
30653
31486
|
return;
|
|
30654
31487
|
}
|
|
30655
31488
|
for (const resource of pkg.listResources()) {
|
|
30656
31489
|
const resourceId = resource.getId();
|
|
30657
|
-
const
|
|
31490
|
+
const isExternal = exportedResourceIds.has(resourceId) && (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource));
|
|
30658
31491
|
const isSkeletonImageDependency = skeletonDependencyImageIds.has(resourceId) && isImageResource(resource);
|
|
30659
|
-
if (!
|
|
31492
|
+
if (!isExternal && !isSkeletonImageDependency) continue;
|
|
30660
31493
|
let sourcePath;
|
|
30661
31494
|
let targetName;
|
|
30662
31495
|
if (isSkeletonImageDependency) {
|
|
30663
31496
|
sourcePath = resolveImagePath(resource, pkg, basePath);
|
|
30664
31497
|
targetName = resolveImageFileName(resource);
|
|
30665
|
-
} else if (isMiscResource(resource) || isSkeletonResource(resource)) {
|
|
31498
|
+
} else if (isMiscResource(resource) || isSwfResource(resource) || isSkeletonResource(resource)) {
|
|
30666
31499
|
sourcePath = resolveGenericResourcePath(resource, pkg, basePath);
|
|
30667
|
-
|
|
31500
|
+
const publishedFile = (resource.getExtras() ?? {})._publishedFile ?? resource.getFile();
|
|
31501
|
+
targetName = isMiscResource(resource) || isSwfResource(resource) ? `${pkg.getPublishName() || pkg.getName()}_${publishedFile}` : publishedFile;
|
|
30668
31502
|
} else continue;
|
|
30669
31503
|
const targetPath = fs.join(outputDir, targetName);
|
|
30670
31504
|
try {
|
|
@@ -30704,16 +31538,20 @@ function resolvePublishOptions(doc, overrides = {}) {
|
|
|
30704
31538
|
const root = doc.getRoot();
|
|
30705
31539
|
const publishSettings = (root.getSettings?.() ?? {}).publish ?? {};
|
|
30706
31540
|
const atlasSetting = publishSettings.atlasSetting ?? {};
|
|
30707
|
-
const projectType = root.getProjectType();
|
|
30708
|
-
const
|
|
30709
|
-
|
|
30710
|
-
|
|
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;
|
|
30711
31547
|
const atlasOptions = {
|
|
30712
31548
|
maxSize: overrides.atlas?.maxSize ?? atlasSetting.maxSize ?? 2048,
|
|
30713
31549
|
fast: overrides.atlas?.fast ?? atlasSetting.fast ?? true,
|
|
30714
|
-
allowRotation: overrides.atlas?.allowRotation ?? atlasSetting.allowRotation ?? false,
|
|
31550
|
+
allowRotation: overrides.atlas?.allowRotation ?? (explicitLayaboxTarget ? false : atlasSetting.allowRotation ?? false),
|
|
30715
31551
|
padding: overrides.atlas?.padding ?? atlasSetting.padding ?? 2,
|
|
30716
31552
|
powerOfTwo: overrides.atlas?.powerOfTwo ?? atlasSetting.sizeOption === "pot",
|
|
31553
|
+
maxAtlasIndex: overrides.atlas?.maxAtlasIndex ?? 10,
|
|
31554
|
+
multipleOfFour: overrides.atlas?.multipleOfFour ?? atlasSetting.sizeOption === "mof",
|
|
30717
31555
|
square: overrides.atlas?.square ?? atlasSetting.forceSquare ?? false,
|
|
30718
31556
|
multiPage: overrides.atlas?.multiPage ?? atlasSetting.paging ?? true,
|
|
30719
31557
|
trimImage: overrides.atlas?.trimImage ?? atlasSetting.trimImage ?? false,
|
|
@@ -30833,6 +31671,19 @@ function publish(options) {
|
|
|
30833
31671
|
}
|
|
30834
31672
|
}
|
|
30835
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
|
+
};
|
|
30836
31687
|
return {
|
|
30837
31688
|
pkg,
|
|
30838
31689
|
outputDir,
|
|
@@ -30844,7 +31695,7 @@ function publish(options) {
|
|
|
30844
31695
|
activeBranch: config.activeBranch,
|
|
30845
31696
|
includeHighResolution: config.includeHighResolution,
|
|
30846
31697
|
separatedAtlasForBranch: config.separatedAtlasForBranch,
|
|
30847
|
-
atlas
|
|
31698
|
+
atlas
|
|
30848
31699
|
};
|
|
30849
31700
|
};
|
|
30850
31701
|
const createNoopPublishFs = () => ({
|
|
@@ -30864,7 +31715,6 @@ function publish(options) {
|
|
|
30864
31715
|
const atlasRuntimeOptions = resolvePublishAtlasRuntimeOptions(plan.fileExtension);
|
|
30865
31716
|
await atlas({
|
|
30866
31717
|
...plan.atlas,
|
|
30867
|
-
...options.atlas ?? {},
|
|
30868
31718
|
separatedAtlasForBranch: plan.separatedAtlasForBranch,
|
|
30869
31719
|
encoder: options.encoder,
|
|
30870
31720
|
basePath: options.basePath,
|
|
@@ -31392,18 +32242,21 @@ async function validateProjectNode(projectPath) {
|
|
|
31392
32242
|
}
|
|
31393
32243
|
const decodedPaths = new Set(images.map(({ packageIndex, resourceIndex }) => `packages[${packageIndex}].resources[${resourceIndex}]`));
|
|
31394
32244
|
diagnostics = diagnostics.filter((diagnostic) => diagnostic.code !== "decode_capability_unavailable" || !decodedPaths.has(diagnostic.path));
|
|
31395
|
-
for (const { pkg, packageIndex, resource, resourceIndex } of images)
|
|
31396
|
-
|
|
31397
|
-
|
|
31398
|
-
|
|
31399
|
-
|
|
31400
|
-
|
|
31401
|
-
|
|
31402
|
-
|
|
31403
|
-
|
|
31404
|
-
|
|
31405
|
-
|
|
31406
|
-
|
|
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
|
+
}
|
|
31407
32260
|
}
|
|
31408
32261
|
return createProjectValidationReport(diagnostics, read.complete && !diagnostics.some((diagnostic) => diagnostic.code === "decode_capability_unavailable"));
|
|
31409
32262
|
}
|
|
@@ -31450,7 +32303,8 @@ function registerPublishCommand(program) {
|
|
|
31450
32303
|
const pkgFilter = options.packages?.split(",").map((value) => value.trim());
|
|
31451
32304
|
const resolved = resolvePublishOptions(doc, {
|
|
31452
32305
|
compressed: options.compressed,
|
|
31453
|
-
packages: pkgFilter
|
|
32306
|
+
packages: pkgFilter,
|
|
32307
|
+
targetProjectType: projectType
|
|
31454
32308
|
});
|
|
31455
32309
|
console.log(`Settings: ext=${resolved.fileExtension}, compressed=${resolved.compressed}`);
|
|
31456
32310
|
if (options.branch) console.log(`Active branch: ${options.branch}`);
|
|
@@ -31510,7 +32364,7 @@ function registerValidateCommand(program) {
|
|
|
31510
32364
|
//#region src/utils/package-version.ts
|
|
31511
32365
|
const require$1 = createRequire(import.meta.url);
|
|
31512
32366
|
function getInjectedPackageVersion() {
|
|
31513
|
-
const version = "0.3.0
|
|
32367
|
+
const version = "0.3.0";
|
|
31514
32368
|
return typeof version === "string" && true ? version : null;
|
|
31515
32369
|
}
|
|
31516
32370
|
function readPackageVersion() {
|
|
@@ -31539,7 +32393,7 @@ function createProgram() {
|
|
|
31539
32393
|
" openfairygui",
|
|
31540
32394
|
"",
|
|
31541
32395
|
"Input can be a .fairy file or a project root directory (auto-discovers .fairy file).",
|
|
31542
|
-
"
|
|
32396
|
+
"Publish settings are read from the project; --project-type applies target-specific output rules."
|
|
31543
32397
|
].join("\n"));
|
|
31544
32398
|
return program;
|
|
31545
32399
|
}
|