@openfairygui/cli 0.2.0-alpha.23 → 0.2.0-alpha.25
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 +82 -4
- package/package.json +4 -4
package/dist/cli.mjs
CHANGED
|
@@ -2252,6 +2252,7 @@ var Component = class extends ExtensibleProperty {
|
|
|
2252
2252
|
changeOnClick: true,
|
|
2253
2253
|
fixedGripSize: false,
|
|
2254
2254
|
opaque: true,
|
|
2255
|
+
customProperties: [],
|
|
2255
2256
|
childrenRenderOrder: ChildrenRenderOrder.Ascent,
|
|
2256
2257
|
apexIndex: 0,
|
|
2257
2258
|
relations: [],
|
|
@@ -2639,6 +2640,12 @@ var Component = class extends ExtensibleProperty {
|
|
|
2639
2640
|
setOpaque(v) {
|
|
2640
2641
|
return this.set("opaque", v);
|
|
2641
2642
|
}
|
|
2643
|
+
getCustomProperties() {
|
|
2644
|
+
return this.get("customProperties").map((property) => ({ ...property }));
|
|
2645
|
+
}
|
|
2646
|
+
setCustomProperties(properties) {
|
|
2647
|
+
return this.set("customProperties", properties.map((property) => ({ ...property })));
|
|
2648
|
+
}
|
|
2642
2649
|
getChildrenRenderOrder() {
|
|
2643
2650
|
return this.get("childrenRenderOrder");
|
|
2644
2651
|
}
|
|
@@ -9995,6 +10002,8 @@ const LIST_PANEL_ATTRS = {
|
|
|
9995
10002
|
canonical: "autoItemSize",
|
|
9996
10003
|
aliases: ["autoResizeItem"]
|
|
9997
10004
|
},
|
|
10005
|
+
childrenRenderOrder: { canonical: "renderOrder" },
|
|
10006
|
+
apexIndex: { canonical: "apex" },
|
|
9998
10007
|
selectionMode: { canonical: "selectionMode" },
|
|
9999
10008
|
selectionController: { canonical: "selectionController" },
|
|
10000
10009
|
defaultItem: { canonical: "defaultItem" },
|
|
@@ -10012,7 +10021,9 @@ const LIST_PANEL_ATTRS = {
|
|
|
10012
10021
|
treeView: { canonical: "treeView" },
|
|
10013
10022
|
indent: { canonical: "indent" },
|
|
10014
10023
|
clickToExpand: { canonical: "clickToExpand" },
|
|
10015
|
-
autoClearItems: { canonical: "autoClearItems" }
|
|
10024
|
+
autoClearItems: { canonical: "autoClearItems" },
|
|
10025
|
+
scrollItemToViewOnClick: { canonical: "scrollItemToViewOnClick" },
|
|
10026
|
+
foldInvisibleItems: { canonical: "foldInvisibleItems" }
|
|
10016
10027
|
};
|
|
10017
10028
|
const BUTTON_EXTENSION_ATTRS = {
|
|
10018
10029
|
mode: { canonical: "mode" },
|
|
@@ -10068,6 +10079,11 @@ const RELATION_ATTRS = {
|
|
|
10068
10079
|
target: { canonical: "target" },
|
|
10069
10080
|
sidePair: { canonical: "sidePair" }
|
|
10070
10081
|
};
|
|
10082
|
+
const CUSTOM_PROPERTY_ATTRS = {
|
|
10083
|
+
target: { canonical: "target" },
|
|
10084
|
+
propertyId: { canonical: "propertyId" },
|
|
10085
|
+
label: { canonical: "label" }
|
|
10086
|
+
};
|
|
10071
10087
|
const GEAR_ATTRS = {
|
|
10072
10088
|
controller: { canonical: "controller" },
|
|
10073
10089
|
pages: { canonical: "pages" },
|
|
@@ -10156,6 +10172,7 @@ const PROGRESSBAR_EXTENSION_NODE = defineNode(PROGRESSBAR_EXTENSION_ATTRS);
|
|
|
10156
10172
|
const SLIDER_EXTENSION_NODE = defineNode(SLIDER_EXTENSION_ATTRS);
|
|
10157
10173
|
const SCROLLBAR_EXTENSION_NODE = defineNode(SCROLLBAR_EXTENSION_ATTRS);
|
|
10158
10174
|
const RELATION_NODE = defineNode(RELATION_ATTRS);
|
|
10175
|
+
const CUSTOM_PROPERTY_NODE = defineNode(CUSTOM_PROPERTY_ATTRS);
|
|
10159
10176
|
const GEAR_NODE = defineNode(GEAR_ATTRS);
|
|
10160
10177
|
const CONTROLLER_ACTION_NODE = defineNode(CONTROLLER_ACTION_ATTRS);
|
|
10161
10178
|
const TRANSITION_ITEM_NODE = defineNode(TRANSITION_ITEM_ATTRS);
|
|
@@ -10246,7 +10263,8 @@ const PROJECT_XML_PROTOCOL = {
|
|
|
10246
10263
|
movieClip: MOVIE_CLIP_NODE,
|
|
10247
10264
|
componentRoot: defineNode(mergeAttrs(ROOT_COMPONENT_PANEL_ATTRS, ROOT_DESIGN_PANEL_ATTRS, ROOT_MISC_PANEL_ATTRS), mergeChildren({
|
|
10248
10265
|
controller: CONTROLLER_NODE,
|
|
10249
|
-
transition: TRANSITION_NODE
|
|
10266
|
+
transition: TRANSITION_NODE,
|
|
10267
|
+
customProperty: CUSTOM_PROPERTY_NODE
|
|
10250
10268
|
}, WITH_ROOT_EXTENSION_CHILDREN), mergeContainers({ displayList: DISPLAY_LIST_CONTAINER$2 })),
|
|
10251
10269
|
componentInstance: COMPONENT_INSTANCE_NODE,
|
|
10252
10270
|
buttonExtension: BUTTON_EXTENSION_NODE,
|
|
@@ -11403,6 +11421,14 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
11403
11421
|
}
|
|
11404
11422
|
const autoResizeItem = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem);
|
|
11405
11423
|
if (autoResizeItem !== void 0) g.setAutoResizeItem?.(parseBool(autoResizeItem));
|
|
11424
|
+
const childrenRenderOrder = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder);
|
|
11425
|
+
if (childrenRenderOrder) g.setChildrenRenderOrder?.({
|
|
11426
|
+
ascent: 0,
|
|
11427
|
+
descent: 1,
|
|
11428
|
+
arch: 2
|
|
11429
|
+
}[childrenRenderOrder] ?? 0);
|
|
11430
|
+
const apexIndex = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.apexIndex);
|
|
11431
|
+
if (apexIndex !== void 0) g.setApexIndex?.(parseInt2(apexIndex));
|
|
11406
11432
|
const selectionMode = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.selectionMode);
|
|
11407
11433
|
if (selectionMode) g.setSelectionMode({
|
|
11408
11434
|
single: 0,
|
|
@@ -11438,6 +11464,16 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
11438
11464
|
});
|
|
11439
11465
|
}
|
|
11440
11466
|
}
|
|
11467
|
+
const scrollBarMargin = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarMargin);
|
|
11468
|
+
if (scrollBarMargin) {
|
|
11469
|
+
const parts = scrollBarMargin.split(",").map(Number);
|
|
11470
|
+
g.setScrollBarMargin?.({
|
|
11471
|
+
top: parts[0] ?? 0,
|
|
11472
|
+
bottom: parts[1] ?? 0,
|
|
11473
|
+
left: parts[2] ?? 0,
|
|
11474
|
+
right: parts[3] ?? 0
|
|
11475
|
+
});
|
|
11476
|
+
}
|
|
11441
11477
|
const clipSoftness = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.clipSoftness);
|
|
11442
11478
|
if (clipSoftness) {
|
|
11443
11479
|
const csParts = clipSoftness.split(",").map(Number);
|
|
@@ -11446,6 +11482,10 @@ function createDisplayObject$1(ctx, doc, tagName, attrs, localControllers) {
|
|
|
11446
11482
|
y: csParts[1] ?? 0
|
|
11447
11483
|
});
|
|
11448
11484
|
}
|
|
11485
|
+
const scrollItemToViewOnClick = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollItemToViewOnClick);
|
|
11486
|
+
if (scrollItemToViewOnClick !== void 0) g.setScrollItemToViewOnClick?.(parseBool(scrollItemToViewOnClick));
|
|
11487
|
+
const foldInvisibleItems = readXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.foldInvisibleItems);
|
|
11488
|
+
if (foldInvisibleItems !== void 0) g.setFoldInvisibleItems?.(parseBool(foldInvisibleItems));
|
|
11449
11489
|
const listItemChildName = getProtocolChildName$2(PROJECT_XML_PROTOCOL.list, "item");
|
|
11450
11490
|
const items = listItemChildName ? ensureArray(attrs[listItemChildName]) : [];
|
|
11451
11491
|
if (items.length > 0) {
|
|
@@ -11884,6 +11924,19 @@ function readComponentXml(ctx, comp, xmlContent) {
|
|
|
11884
11924
|
}
|
|
11885
11925
|
}
|
|
11886
11926
|
}
|
|
11927
|
+
const customPropertyChildName = getProtocolChildName$1(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
11928
|
+
const customProperties = customPropertyChildName ? ensureArray(compNode[customPropertyChildName]) : [];
|
|
11929
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children?.customProperty;
|
|
11930
|
+
comp.setCustomProperties(customProperties.flatMap((value) => {
|
|
11931
|
+
const property = getXmlNode$1(value);
|
|
11932
|
+
const propertyId = property ? parseInt2(readXmlAttr(property, customPropertyProtocol?.attrs.propertyId), -1) : -1;
|
|
11933
|
+
if (!property || propertyId !== 0 && propertyId !== 1) return [];
|
|
11934
|
+
return [{
|
|
11935
|
+
target: readXmlAttr(property, customPropertyProtocol?.attrs.target) ?? "",
|
|
11936
|
+
propertyId,
|
|
11937
|
+
label: readXmlAttr(property, customPropertyProtocol?.attrs.label) ?? ""
|
|
11938
|
+
}];
|
|
11939
|
+
}));
|
|
11887
11940
|
const localControllers = /* @__PURE__ */ new Map();
|
|
11888
11941
|
const controllers = ensureArray(compNode.controller);
|
|
11889
11942
|
for (const ctrlDef of controllers) {
|
|
@@ -12904,10 +12957,11 @@ function serializeChild(obj) {
|
|
|
12904
12957
|
if (obj.getId()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.displayObject.attrs.id, obj.getId());
|
|
12905
12958
|
if (obj.getName()) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.displayObject.attrs.name, obj.getName());
|
|
12906
12959
|
const type = obj.propertyType;
|
|
12907
|
-
if (type === "GImage" || type === "GMovieClip" || type === "GComponent" || EXTENSION_TYPE[type]) {
|
|
12960
|
+
if (type === "GImage" || type === "GMovieClip" || type === "GComponent" || type === "GList" || type === "GTree" || EXTENSION_TYPE[type]) {
|
|
12908
12961
|
const src = typedObj.getSrc?.();
|
|
12909
12962
|
if (src) if (type === "GComponent" || EXTENSION_TYPE[type]) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.componentInstance.attrs.src, src);
|
|
12910
12963
|
else if (type === "GMovieClip") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.movieClip.attrs.src, src);
|
|
12964
|
+
else if (type === "GList" || type === "GTree") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.src, src);
|
|
12911
12965
|
else writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.image.attrs.src, src);
|
|
12912
12966
|
}
|
|
12913
12967
|
if ((type === "GComponent" || type === "GList" || type === "GTree") && typedObj.getControllerOverrides?.()) if (type === "GComponent") writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.componentInstance.attrs.controllerOverrides, typedObj.getControllerOverrides?.());
|
|
@@ -13279,6 +13333,16 @@ function serializeChild(obj) {
|
|
|
13279
13333
|
else if (layout === 3 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount, String(lineCount));
|
|
13280
13334
|
if (layout === 4 && lineCount !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.lineItemCount2, String(lineCount));
|
|
13281
13335
|
if (typedObj.getAutoResizeItem?.() === false) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.autoResizeItem, "false");
|
|
13336
|
+
const childrenRenderOrder = typedObj.getChildrenRenderOrder?.() ?? 0;
|
|
13337
|
+
if (childrenRenderOrder !== 0) {
|
|
13338
|
+
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.childrenRenderOrder, {
|
|
13339
|
+
0: "ascent",
|
|
13340
|
+
1: "descent",
|
|
13341
|
+
2: "arch"
|
|
13342
|
+
}[childrenRenderOrder] ?? "ascent");
|
|
13343
|
+
const apexIndex = typedObj.getApexIndex?.() ?? 0;
|
|
13344
|
+
if (childrenRenderOrder === 2 && apexIndex !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.apexIndex, String(apexIndex));
|
|
13345
|
+
}
|
|
13282
13346
|
const selectionMode = typedObj.getSelectionMode?.();
|
|
13283
13347
|
if (selectionMode !== void 0 && selectionMode !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.selectionMode, {
|
|
13284
13348
|
0: "single",
|
|
@@ -13293,7 +13357,7 @@ function serializeChild(obj) {
|
|
|
13293
13357
|
if (isTree) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.treeView, "true");
|
|
13294
13358
|
if (isTree) {
|
|
13295
13359
|
const indent = typedObj.getIndent?.() ?? 0;
|
|
13296
|
-
|
|
13360
|
+
writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.indent, String(indent));
|
|
13297
13361
|
const clickToExpand = typedObj.getClickToExpand?.() ?? 0;
|
|
13298
13362
|
if (clickToExpand !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.clickToExpand, String(clickToExpand));
|
|
13299
13363
|
}
|
|
@@ -13311,6 +13375,8 @@ function serializeChild(obj) {
|
|
|
13311
13375
|
}[scrollType] ?? "vertical");
|
|
13312
13376
|
const scrollBarFlags = typedObj.getScrollBarFlags?.() ?? 0;
|
|
13313
13377
|
if (scrollBarFlags !== 0) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarFlags, String(scrollBarFlags));
|
|
13378
|
+
const scrollBarMargin = typedObj.getScrollBarMargin?.();
|
|
13379
|
+
if (hasNonZeroInsets(scrollBarMargin)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarMargin, formatInsets(scrollBarMargin));
|
|
13314
13380
|
const vtScrollBarRes = typedObj.getVtScrollBarRes?.() ?? "";
|
|
13315
13381
|
const hzScrollBarRes = typedObj.getHzScrollBarRes?.() ?? "";
|
|
13316
13382
|
if (vtScrollBarRes || hzScrollBarRes) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollBarRes, `${vtScrollBarRes},${hzScrollBarRes}`);
|
|
@@ -13321,6 +13387,8 @@ function serializeChild(obj) {
|
|
|
13321
13387
|
if (hasNonZeroInsets(margin)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.margin, formatInsets(margin));
|
|
13322
13388
|
const clipSoftness = typedObj.getClipSoftness?.();
|
|
13323
13389
|
if (clipSoftness && ((clipSoftness.x ?? 0) !== 0 || (clipSoftness.y ?? 0) !== 0)) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.clipSoftness, `${clipSoftness.x ?? 0},${clipSoftness.y ?? 0}`);
|
|
13390
|
+
if (typedObj.getScrollItemToViewOnClick?.() === false) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.scrollItemToViewOnClick, "false");
|
|
13391
|
+
if (typedObj.getFoldInvisibleItems?.() === true) writeXmlAttr(attrs, PROJECT_XML_PROTOCOL.list.attrs.foldInvisibleItems, "true");
|
|
13324
13392
|
const listItems = typedObj.getListItems?.() ?? [];
|
|
13325
13393
|
const listItemChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.list, "item");
|
|
13326
13394
|
if (listItems.length > 0 && listItemChildName) attrs[listItemChildName] = listItems.map((item) => serializeListItemXmlNode(item, { forceLevel: isTree }));
|
|
@@ -13647,6 +13715,16 @@ async function writeComponent(fs, comp, pkgDir, sourceRelativePath) {
|
|
|
13647
13715
|
const transitionChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "transition");
|
|
13648
13716
|
if (transitionChildName) compNode[transitionChildName] = transitions.map((t) => serializeTransition(t));
|
|
13649
13717
|
}
|
|
13718
|
+
const customProperties = typedComp.getCustomProperties?.() ?? [];
|
|
13719
|
+
const customPropertyChildName = getProtocolChildName(PROJECT_XML_PROTOCOL.componentRoot, "customProperty");
|
|
13720
|
+
const customPropertyProtocol = PROJECT_XML_PROTOCOL.componentRoot.children?.customProperty;
|
|
13721
|
+
if (customProperties.length > 0 && customPropertyChildName) compNode[customPropertyChildName] = customProperties.map((property) => {
|
|
13722
|
+
const attrs = {};
|
|
13723
|
+
writeXmlAttr(attrs, customPropertyProtocol?.attrs.target, property.target);
|
|
13724
|
+
writeXmlAttr(attrs, customPropertyProtocol?.attrs.propertyId, String(property.propertyId));
|
|
13725
|
+
if (property.label) writeXmlAttr(attrs, customPropertyProtocol?.attrs.label, property.label);
|
|
13726
|
+
return attrs;
|
|
13727
|
+
});
|
|
13650
13728
|
if (extType) {
|
|
13651
13729
|
const extSpecs = EXTENSION_PROTOCOL_MAP[extType].attrs;
|
|
13652
13730
|
const extAttrs = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfairygui/cli",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.25",
|
|
4
4
|
"description": "FairyGUI Headless Authoring SDK — command-line interface.",
|
|
5
5
|
"author": "OpenFairyGUI Contributors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"restore"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@openfairygui/
|
|
37
|
-
"@openfairygui/
|
|
36
|
+
"@openfairygui/functions": "0.2.0-alpha.25",
|
|
37
|
+
"@openfairygui/core": "0.2.0-alpha.25"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"commander": "^14.0.2",
|
|
41
41
|
"jiti": "^2.7.0",
|
|
42
|
-
"@openfairygui/backend": "0.2.0-alpha.
|
|
42
|
+
"@openfairygui/backend": "0.2.0-alpha.25"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
45
|
"sharp": ">=0.33.0"
|