mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
Remove unnecessary default attributes
This commit is contained in:
40
dist/ueblueprint.js
vendored
40
dist/ueblueprint.js
vendored
@@ -2682,6 +2682,14 @@ class IEntity {
|
||||
this.#ignored = value;
|
||||
}
|
||||
|
||||
#inlined = /** @type {typeof IEntity} */(this.constructor).inlined
|
||||
get inlined() {
|
||||
return this.#inlined
|
||||
}
|
||||
set inlined(value) {
|
||||
this.#inlined = value;
|
||||
}
|
||||
|
||||
#quoted
|
||||
get quoted() {
|
||||
return this.#quoted ?? /** @type {typeof IEntity} */(this.constructor).quoted ?? false
|
||||
@@ -2952,7 +2960,7 @@ class IEntity {
|
||||
if (keyValue.length && (Self.attributes[key]?.quoted || value.quoted)) {
|
||||
keyValue = `"${keyValue}"`;
|
||||
}
|
||||
if (valueType.inlined) {
|
||||
if (value.inlined) {
|
||||
const inlinedPrintKey = valueType.className() === "ArrayEntity"
|
||||
? k => printKey(`${keyValue}${k}`)
|
||||
: k => printKey(`${keyValue}.${k}`);
|
||||
@@ -3263,9 +3271,17 @@ class Grammar {
|
||||
const attributeKey = attributeName.split(Configuration.keysSeparator);
|
||||
const attributeValue = this.getAttribute(entityType, attributeKey);
|
||||
const grammar = attributeValue ? attributeValue.grammar : IEntity.unknownEntityGrammar;
|
||||
const inlined = attributeKey.length > 1;
|
||||
return grammar.map(attributeValue =>
|
||||
values => {
|
||||
Utility.objectSet(values, attributeKey, attributeValue);
|
||||
attributeKey.reduce(
|
||||
(acc, cur, i) => {
|
||||
acc[cur]["inlined"] = inlined && i < attributeKey.length - 1;
|
||||
return acc[cur]
|
||||
},
|
||||
values
|
||||
);
|
||||
handleObjectSet(values, attributeKey, attributeValue);
|
||||
}
|
||||
)
|
||||
@@ -4693,7 +4709,7 @@ const pinColorMaterial = i$3`120, 120, 120`;
|
||||
/** @param {PinEntity<IEntity>} entity */
|
||||
function pinColor(entity) {
|
||||
if (entity.PinType.PinCategory?.toString() === "mask") {
|
||||
const result = colors[entity.PinType.PinSubCategory];
|
||||
const result = colors[entity.PinType.PinSubCategory?.toString()];
|
||||
if (result) {
|
||||
return result
|
||||
}
|
||||
@@ -5250,7 +5266,7 @@ class PinTypeEntity extends IEntity {
|
||||
static attributes = {
|
||||
...super.attributes,
|
||||
PinCategory: StringEntity.withDefault(),
|
||||
PinSubCategory: StringEntity.withDefault(),
|
||||
PinSubCategory: StringEntity,
|
||||
PinSubCategoryObject: ObjectReferenceEntity,
|
||||
PinSubCategoryMemberReference: FunctionReferenceEntity,
|
||||
ContainerType: SymbolEntity,
|
||||
@@ -5612,11 +5628,11 @@ class PinEntity extends IEntity {
|
||||
AutogeneratedDefaultValue: StringEntity,
|
||||
DefaultObject: ObjectReferenceEntity,
|
||||
PersistentGuid: GuidEntity,
|
||||
bHidden: BooleanEntity.withDefault(),
|
||||
bNotConnectable: BooleanEntity.withDefault(),
|
||||
bDefaultValueIsReadOnly: BooleanEntity.withDefault(),
|
||||
bDefaultValueIsIgnored: BooleanEntity.withDefault(),
|
||||
bAdvancedView: BooleanEntity.withDefault(),
|
||||
bHidden: BooleanEntity,
|
||||
bNotConnectable: BooleanEntity,
|
||||
bDefaultValueIsReadOnly: BooleanEntity,
|
||||
bDefaultValueIsIgnored: BooleanEntity,
|
||||
bAdvancedView: BooleanEntity,
|
||||
bOrphanedPin: BooleanEntity,
|
||||
}
|
||||
static grammar = this.createGrammar()
|
||||
@@ -6076,12 +6092,18 @@ class ScriptVariableEntity extends IEntity {
|
||||
|
||||
class UnknownPinEntity extends PinEntity {
|
||||
|
||||
static attributes = {
|
||||
...super.attributes,
|
||||
PinId: GuidEntity
|
||||
}
|
||||
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
/** @returns {P<UnknownPinEntity>} */
|
||||
static createGrammar() {
|
||||
return Parsernostrum.seq(
|
||||
Parsernostrum.reg(new RegExp(`(${Grammar.Regex.Symbol.source})\\s*\\(\\s*`), 1),
|
||||
// Lookbehind
|
||||
Parsernostrum.reg(new RegExp(`(${Grammar.Regex.Symbol.source}\\s*)\\(\\s*`), 1),
|
||||
Grammar.createAttributeGrammar(this).sepBy(Grammar.commaSeparation),
|
||||
Parsernostrum.reg(/\s*(?:,\s*)?\)/)
|
||||
).map(([lookbehind, attributes, _2]) => {
|
||||
|
||||
4
dist/ueblueprint.min.js
vendored
4
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -55,7 +55,7 @@ const pinColorMaterial = css`120, 120, 120`
|
||||
/** @param {PinEntity<IEntity>} entity */
|
||||
export default function pinColor(entity) {
|
||||
if (entity.PinType.PinCategory?.toString() === "mask") {
|
||||
const result = colors[entity.PinType.PinSubCategory]
|
||||
const result = colors[entity.PinType.PinSubCategory?.toString()]
|
||||
if (result) {
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -60,6 +60,14 @@ export default class IEntity {
|
||||
this.#ignored = value
|
||||
}
|
||||
|
||||
#inlined = /** @type {typeof IEntity} */(this.constructor).inlined
|
||||
get inlined() {
|
||||
return this.#inlined
|
||||
}
|
||||
set inlined(value) {
|
||||
this.#inlined = value
|
||||
}
|
||||
|
||||
#quoted
|
||||
get quoted() {
|
||||
return this.#quoted ?? /** @type {typeof IEntity} */(this.constructor).quoted ?? false
|
||||
@@ -330,7 +338,7 @@ export default class IEntity {
|
||||
if (keyValue.length && (Self.attributes[key]?.quoted || value.quoted)) {
|
||||
keyValue = `"${keyValue}"`
|
||||
}
|
||||
if (valueType.inlined) {
|
||||
if (value.inlined) {
|
||||
const inlinedPrintKey = valueType.className() === "ArrayEntity"
|
||||
? k => printKey(`${keyValue}${k}`)
|
||||
: k => printKey(`${keyValue}.${k}`)
|
||||
|
||||
@@ -88,11 +88,11 @@ export default class PinEntity extends IEntity {
|
||||
AutogeneratedDefaultValue: StringEntity,
|
||||
DefaultObject: ObjectReferenceEntity,
|
||||
PersistentGuid: GuidEntity,
|
||||
bHidden: BooleanEntity.withDefault(),
|
||||
bNotConnectable: BooleanEntity.withDefault(),
|
||||
bDefaultValueIsReadOnly: BooleanEntity.withDefault(),
|
||||
bDefaultValueIsIgnored: BooleanEntity.withDefault(),
|
||||
bAdvancedView: BooleanEntity.withDefault(),
|
||||
bHidden: BooleanEntity,
|
||||
bNotConnectable: BooleanEntity,
|
||||
bDefaultValueIsReadOnly: BooleanEntity,
|
||||
bDefaultValueIsIgnored: BooleanEntity,
|
||||
bAdvancedView: BooleanEntity,
|
||||
bOrphanedPin: BooleanEntity,
|
||||
}
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class PinTypeEntity extends IEntity {
|
||||
static attributes = {
|
||||
...super.attributes,
|
||||
PinCategory: StringEntity.withDefault(),
|
||||
PinSubCategory: StringEntity.withDefault(),
|
||||
PinSubCategory: StringEntity,
|
||||
PinSubCategoryObject: ObjectReferenceEntity,
|
||||
PinSubCategoryMemberReference: FunctionReferenceEntity,
|
||||
ContainerType: SymbolEntity,
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
import P from "parsernostrum"
|
||||
import Grammar from "../serialization/Grammar.js"
|
||||
import GuidEntity from "./GuidEntity.js"
|
||||
import PinEntity from "./PinEntity.js"
|
||||
|
||||
export default class UnknownPinEntity extends PinEntity {
|
||||
|
||||
static attributes = {
|
||||
...super.attributes,
|
||||
PinId: GuidEntity
|
||||
}
|
||||
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
/** @returns {P<UnknownPinEntity>} */
|
||||
static createGrammar() {
|
||||
return P.seq(
|
||||
P.reg(new RegExp(`(${Grammar.Regex.Symbol.source})\\s*\\(\\s*`), 1),
|
||||
// Lookbehind
|
||||
P.reg(new RegExp(`(${Grammar.Regex.Symbol.source}\\s*)\\(\\s*`), 1),
|
||||
Grammar.createAttributeGrammar(this).sepBy(Grammar.commaSeparation),
|
||||
P.reg(/\s*(?:,\s*)?\)/)
|
||||
).map(([lookbehind, attributes, _2]) => {
|
||||
|
||||
@@ -107,9 +107,17 @@ export default class Grammar {
|
||||
const attributeKey = attributeName.split(Configuration.keysSeparator)
|
||||
const attributeValue = this.getAttribute(entityType, attributeKey)
|
||||
const grammar = attributeValue ? attributeValue.grammar : IEntity.unknownEntityGrammar
|
||||
const inlined = attributeKey.length > 1
|
||||
return grammar.map(attributeValue =>
|
||||
values => {
|
||||
Utility.objectSet(values, attributeKey, attributeValue)
|
||||
attributeKey.reduce(
|
||||
(acc, cur, i) => {
|
||||
acc[cur]["inlined"] = inlined && i < attributeKey.length - 1
|
||||
return acc[cur]
|
||||
},
|
||||
values
|
||||
)
|
||||
handleObjectSet(values, attributeKey, attributeValue)
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user