Data types-related fixes

This commit is contained in:
barsdeveloper
2022-03-20 22:29:53 +01:00
parent 871f76b305
commit 4dd2929a9f
15 changed files with 128 additions and 23 deletions

View File

@@ -1 +1 @@
.ueb{--ueb-pin-color: white;--ueb-pin-dim-color: #afafaf}.ueb-pin-boolean{--ueb-pin-color: #930000}.ueb-pin-integer{--ueb-pin-color: #1fe0ad}.ueb-pin-float{--ueb-pin-color: #9ffb44}.ueb-pin-vector{--ueb-pin-color: #fcc823}.ueb-pin-rotator{--ueb-pin-color: #9eb1fc}.ueb-pin-string{--ueb-pin-color: #fc00d2;--ueb-pin-background: linear-gradient(90deg, #fc00d220, #fc00d280 15%, #fc00d250 85%, transparent)}.ueb-pin-name{--ueb-pin-color: #cb81fc}.ueb-pin-objectreference{--ueb-pin-color: #00a8f2}/*# sourceMappingURL=ueblueprint-node-value-type-color.css.map */
.ueb{--ueb-pin-color: white;--ueb-pin-dim-color: #afafaf}.ueb-pin-boolean{--ueb-pin-color: #930000}.ueb-pin-int{--ueb-pin-color: #1fe0ad}.ueb-pin-float{--ueb-pin-color: #9ffb44}.ueb-pin-vector{--ueb-pin-color: #fcc823}.ueb-pin-rotator{--ueb-pin-color: #9eb1fc}.ueb-pin-string{--ueb-pin-color: #fc00d2;--ueb-pin-background: linear-gradient(90deg, #fc00d220, #fc00d280 15%, #fc00d250 85%, transparent)}.ueb-pin-name{--ueb-pin-color: #cb81fc}.ueb-pin-object{--ueb-pin-color: #00a8f2}/*# sourceMappingURL=ueblueprint-node-value-type-color.css.map */

View File

@@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["../../scss/ueblueprint-node-value-type-color.scss"],"names":[],"mappings":"AAAA,KAGI,uBACA,6BAGJ,iBAEI,yBAGJ,iBAEI,yBAGJ,eAEI,yBAGJ,gBAEI,yBAGJ,iBAEI,yBAGJ,gBAEI,yBACA,mGAGJ,cAEI,yBAGJ,yBAEI","file":"ueblueprint-node-value-type-color.css"}
{"version":3,"sourceRoot":"","sources":["../../scss/ueblueprint-node-value-type-color.scss"],"names":[],"mappings":"AAAA,KAGI,uBACA,6BAGJ,iBAEI,yBAGJ,aAEI,yBAGJ,eAEI,yBAGJ,gBAEI,yBAGJ,iBAEI,yBAGJ,gBAEI,yBACA,mGAGJ,cAEI,yBAGJ,gBAEI","file":"ueblueprint-node-value-type-color.css"}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["../../scss/ueblueprint-style.scss"],"names":[],"mappings":"AAAA,WACI,qBACA,iBACA,IACI,kGAIR,WACI,qBACA,mBACA,IACI,sGAIR,cACI,cACA,kBACA,8EACA,+BACA,iBAGJ,qBACI,aACA,kBACA,MACA,QACA,OACA,aACA,0BACA,UAGJ,mBACI,gBAGJ,mBACI,kBACA,aACA,gBACA,qBAGJ,oDACI,gBAGJ,UACI,kFACA,kBACA,eACA,gBACA,kEACA,mEACA,yBACA,iBAEI,s3BA0BJ,gBAEI,sZAQJ,sFACA,gEACA,oDACA,qBACA,gBAGJ,kDACI,gBAGJ,qBAGI,eACA,6CAGJ,iBAEI,mBAGJ,iBAEI,kBAGJ,iBAEI,mBAGJ,iBAEI,iBACA,uDAGJ,iBAEI,mBACA,uDAGJ,iBACI,sBACA,uDAGJ,iBACI,iBACA,uDAGJ,iBACI,sBACA,uDAGJ,iBACI,sBACA,uDAGJ,kBAEI,iBACA,uDAGJ,kBAEI,sBACA,uDAGJ,kBAEI,sBACA,uDAGJ,kBACI,kBACA,QACA,SACA,wGAGJ,SACI,cACA,kBACA,sGACA,qCACA,uDACA,sBAGJ,wEACI,YAGJ,iBACI,YACA,YACA,+CAGJ,cACI,UAGJ,+BACI,iBACI,kNAIJ,oDACA,0CACA,sDACA,0BACA,oBAGJ,kBACI,kBACA,YACA,gCACA,qCACA,0BACA,gBAGJ,iBACI,kBACA,6DACA,gEACA,8EACA,aACA,gBACA,mBAGJ,eACI,iFACA,qBACA,mBAGJ,eACI,aACA,cACA,WACA,gBACA,mBAGJ,iBACI,kBACA,iBAGJ,kBACI,kBAGJ,QACI,cACA,gBAGJ,mDACI,eAGJ,sFACI,qCACA,iBAGJ,cACI,qBACA,kBACA,YACA,aACA,wBACA,wBAGJ,sBACI,WACA,cACA,kBACA,MACA,QACA,SACA,OACA,sCACA,kBAGJ,2CACI,gCAGJ,qBACI,WACA,cACA,kBACA,qBACA,sBACA,QACA,SACA,kCACA,qCACA,4CAGJ,gEACI,8DACA,8DACA,8DACA,8DACA,oGACA,qGACA,kBACA,wCACA,yCACA,0CACA,4CAGJ,aACI,cACA,kBACA,kBACA,MACA,OACA,QACA,SACA,iBAEI,wlDAmDJ,gBAEI,gQAWJ,oBAEI,wJAOJ,4BAGJ,gDACI,mBAIJ,eACI,mBAGJ,SACI,kEAEA,uEACA,cACA,8CAKA,kBAGJ,aACI,iEACA,kBACA,MACA,OACA,WACA,YACA,eACA,8FACA,iBAGJ,kBACI,mBACA,4BACA,eAGJ,8DAEI,eACA,4BAGJ,iBACI,cACA,mBACA,kBACA,kDACA,qHAOA,sBACA,gBACA,kBACA,4EACA,+BACA,mBACA","file":"ueblueprint-style.css"}
{"version":3,"sourceRoot":"","sources":["../../scss/ueblueprint-style.scss"],"names":[],"mappings":"AAAA,WACI,qBACA,iBACA,IACI,kGAIR,WACI,qBACA,mBACA,IACI,sGAIR,cACI,cACA,kBACA,8EACA,+BACA,iBAGJ,qBACI,aACA,kBACA,MACA,QACA,OACA,aACA,0BACA,UAGJ,mBACI,gBAGJ,mBACI,kBACA,aACA,gBACA,qBAGJ,oDACI,gBAGJ,UACI,kFACA,kBACA,eACA,gBACA,kEACA,mEACA,yBACA,iBAEI,s3BA0BJ,gBAEI,sZAQJ,sFACA,gEACA,oDACA,qBACA,gBAGJ,kDACI,gBAGJ,mDACI,eAGJ,qBAGI,eACA,6CAGJ,iBAEI,mBAGJ,iBAEI,kBAGJ,iBAEI,mBAGJ,iBAEI,iBACA,uDAGJ,iBAEI,mBACA,uDAGJ,iBACI,sBACA,uDAGJ,iBACI,iBACA,uDAGJ,iBACI,sBACA,uDAGJ,iBACI,sBACA,uDAGJ,kBAEI,iBACA,uDAGJ,kBAEI,sBACA,uDAGJ,kBAEI,sBACA,uDAGJ,kBACI,kBACA,QACA,SACA,wGAGJ,SACI,cACA,kBACA,sGACA,qCACA,uDACA,sBAGJ,wEACI,YAGJ,iBACI,YACA,YACA,+CAGJ,+BACI,iBACI,kNAIJ,oDACA,0CACA,sDACA,0BACA,oBAGJ,kBACI,kBACA,YACA,gCACA,qCACA,0BACA,gBAGJ,iBACI,kBACA,6DACA,gEACA,8EACA,aACA,gBACA,mBAGJ,eACI,iFACA,qBACA,mBAGJ,eACI,aACA,cACA,WACA,gBACA,mBAGJ,iBACI,kBACA,iBAGJ,kBACI,kBAGJ,QACI,cACA,gBAGJ,wEACI,aAGJ,6EACI,qCACA,iBAGJ,0BACI,iBAGJ,cACI,qBACA,kBACA,YACA,aACA,wBACA,wBAGJ,sBACI,WACA,cACA,kBACA,MACA,QACA,SACA,OACA,sCACA,kBAGJ,2CACI,gCAGJ,qBACI,WACA,cACA,kBACA,qBACA,sBACA,QACA,SACA,kCACA,qCACA,4CAGJ,gEACI,8DACA,8DACA,8DACA,8DACA,oGACA,qGACA,kBACA,wCACA,yCACA,0CACA,4CAGJ,aACI,cACA,kBACA,kBACA,MACA,OACA,QACA,SACA,iBAEI,wlDAmDJ,gBAEI,gQAWJ,oBAEI,wJAOJ,4BAGJ,gDACI,mBAIJ,eACI,mBAGJ,SACI,kEAEA,uEACA,cACA,8CAKA,kBAGJ,aACI,iEACA,kBACA,MACA,OACA,WACA,YACA,eACA,8FACA,iBAGJ,kBACI,mBACA,4BACA,eAGJ,8DAEI,eACA,4BAGJ,iBACI,cACA,mBACA,kBACA,kDACA,qHAOA,sBACA,gBACA,kBACA,4EACA,+BACA,mBACA","file":"ueblueprint-style.css"}

58
dist/ueblueprint.js vendored
View File

@@ -1016,6 +1016,36 @@ class GuidEntity extends IEntity {
}
}
class Identifier extends IEntity {
static attributes = {
value: String,
}
constructor(options = {}) {
// Not instanceof to pick also primitive string
if (options.constructor === String) {
options = {
value: options
};
}
super(options);
/** @type {String} */
this.value;
if (!this.value.match(/\w+/)) {
throw new Error("The value must be an identifier (/\w+/).")
}
}
valueOf() {
return this.value
}
toString() {
return this.value
}
}
class IntegerEntity extends IEntity {
static attributes = {
@@ -1199,6 +1229,7 @@ class ObjectEntity extends IEntity {
TargetType: new TypeInitialization(ObjectReferenceEntity, false, null),
NodePosX: IntegerEntity,
NodePosY: IntegerEntity,
AdvancedPinDisplay: new TypeInitialization(Identifier, false, null),
NodeGuid: GuidEntity,
ErrorType: new TypeInitialization(IntegerEntity, false),
ErrorMsg: new TypeInitialization(String, false, ""),
@@ -1264,6 +1295,9 @@ class Grammar {
/** @param {Grammar} r */
Guid = r => P$1.regex(/[0-9a-zA-Z]{32}/).map(v => new GuidEntity({ value: v })).desc("32 digit hexadecimal (accepts all the letters for safety) value")
/** @param {Grammar} */
Identifier = r => P$1.regex(/\w+/).map(v => new Identifier(v))
/** @param {Grammar} r */
PathSymbolEntity = r => P$1.regex(/[0-9a-zA-Z_]+/).map(v => new PathSymbolEntity({ value: v }))
@@ -1338,6 +1372,8 @@ class Grammar {
return r.String
case GuidEntity:
return r.Guid
case Identifier:
return r.Identifier
case ObjectReferenceEntity:
return r.Reference
case LocalizedTextEntity:
@@ -1508,7 +1544,7 @@ class ISerializer {
// Recursive call when finding an object
result += (result.length ? this.separator : "")
+ this.subWrite(fullKey, value);
} else if (value !== undefined && this.showProperty(fullKey, value)) {
} else if (value !== undefined && this.showProperty(object, fullKey, value)) {
result += (result.length ? this.separator : "")
+ this.prefix
+ this.attributeKeyPrinter(fullKey)
@@ -1523,7 +1559,7 @@ class ISerializer {
return result
}
showProperty(attributeKey, attributeValue) {
showProperty(object, attributeKey, attributeValue) {
const attributes = this.entityType.attributes;
const attribute = Utility.objectGet(attributes, attributeKey);
if (attribute instanceof TypeInitialization) {
@@ -1539,7 +1575,7 @@ class ObjectSerializer extends ISerializer {
super(ObjectEntity, " ", "\n", false);
}
showProperty(attributeKey, attributeValue) {
showProperty(object, attributeKey, attributeValue) {
switch (attributeKey.toString()) {
case "Class":
case "Name":
@@ -1547,7 +1583,7 @@ class ObjectSerializer extends ISerializer {
// Serielized separately
return false
}
return super.showProperty(attributeKey, attributeValue)
return super.showProperty(object, attributeKey, attributeValue)
}
read(value) {
@@ -1579,7 +1615,12 @@ class ObjectSerializer extends ISerializer {
let result = `Begin Object Class=${object.Class.path} Name=${this.writeValue(object.Name)}
${this.subWrite([], object)
+ object
.CustomProperties.map(pin => this.separator + this.prefix + "CustomProperties " + SerializerFactory.getSerializer(PinEntity).write(pin))
.CustomProperties.map(pin =>
this.separator
+ this.prefix
+ "CustomProperties "
+ SerializerFactory.getSerializer(PinEntity).write(pin)
)
.join("")}
End Object\n`;
return result
@@ -2704,6 +2745,9 @@ class PinTemplate extends ITemplate {
"ueb-pin-" + sanitizeText(pin.getType())
);
pin.dataset.id = pin.GetPinIdValue();
if (pin.entity.bAdvancedView) {
pin.dataset.advancedView = "true";
}
pin.clickableElement = pin;
window.customElements.whenDefined("ueb-node").then(pin.nodeElement = pin.closest("ueb-node"));
pin.getLinks().forEach(pinReference => {
@@ -2931,6 +2975,9 @@ class NodeTemplate extends SelectableDraggableTemplate {
node.classList.add("ueb-selected");
}
node.dataset.name = node.getNodeName();
if (node.entity.AdvancedPinDisplay) {
node.dataset.advancedDisplay = node.entity.AdvancedPinDisplay;
}
node.style.setProperty("--ueb-position-x", sanitizeText(node.location[0]));
node.style.setProperty("--ueb-position-y", sanitizeText(node.location[1]));
/** @type {HTMLElement} */
@@ -3653,6 +3700,7 @@ function initializeSerializerFactory() {
: ""
))
);
SerializerFactory.registerSerializer(Identifier, new ToStringSerializer(Identifier));
SerializerFactory.registerSerializer(PathSymbolEntity, new ToStringSerializer(PathSymbolEntity));
SerializerFactory.registerSerializer(GuidEntity, new ToStringSerializer(GuidEntity));
SerializerFactory.registerSerializer(IntegerEntity, new ToStringSerializer(IntegerEntity));

32
js/entity/Identifier.js Normal file
View File

@@ -0,0 +1,32 @@
import IEntity from "./IEntity"
export default class Identifier extends IEntity {
static attributes = {
value: String,
}
constructor(options = {}) {
// Not instanceof to pick also primitive string
if (options.constructor === String) {
options = {
value: options
}
}
super(options)
/** @type {String} */
this.value
if (!this.value.match(/\w+/)) {
throw new Error("The value must be an identifier (/\w+/).")
}
}
valueOf() {
return this.value
}
toString() {
return this.value
}
}

View File

@@ -1,5 +1,6 @@
import FunctionReferenceEntity from "./FunctionReferenceEntity"
import GuidEntity from "./GuidEntity"
import Identifier from "./Identifier"
import IEntity from "./IEntity"
import IntegerEntity from "./IntegerEntity"
import ObjectReferenceEntity from "./ObjectReferenceEntity"
@@ -19,6 +20,7 @@ export default class ObjectEntity extends IEntity {
TargetType: new TypeInitialization(ObjectReferenceEntity, false, null),
NodePosX: IntegerEntity,
NodePosY: IntegerEntity,
AdvancedPinDisplay: new TypeInitialization(Identifier, false, null),
NodeGuid: GuidEntity,
ErrorType: new TypeInitialization(IntegerEntity, false),
ErrorMsg: new TypeInitialization(String, false, ""),

View File

@@ -1,5 +1,6 @@
import FunctionReferenceEntity from "../entity/FunctionReferenceEntity"
import GuidEntity from "../entity/GuidEntity"
import Identifier from "../entity/Identifier"
import IntegerEntity from "../entity/IntegerEntity"
import LocalizedTextEntity from "../entity/LocalizedTextEntity"
import ObjectEntity from "../entity/ObjectEntity"
@@ -47,6 +48,9 @@ export default class Grammar {
/** @param {Grammar} r */
Guid = r => P.regex(/[0-9a-zA-Z]{32}/).map(v => new GuidEntity({ value: v })).desc("32 digit hexadecimal (accepts all the letters for safety) value")
/** @param {Grammar} */
Identifier = r => P.regex(/\w+/).map(v => new Identifier(v))
/** @param {Grammar} r */
PathSymbolEntity = r => P.regex(/[0-9a-zA-Z_]+/).map(v => new PathSymbolEntity({ value: v }))
@@ -121,6 +125,8 @@ export default class Grammar {
return r.String
case GuidEntity:
return r.Guid
case Identifier:
return r.Identifier
case ObjectReferenceEntity:
return r.Reference
case LocalizedTextEntity:

View File

@@ -58,7 +58,7 @@ export default class ISerializer {
// Recursive call when finding an object
result += (result.length ? this.separator : "")
+ this.subWrite(fullKey, value)
} else if (value !== undefined && this.showProperty(fullKey, value)) {
} else if (value !== undefined && this.showProperty(object, fullKey, value)) {
result += (result.length ? this.separator : "")
+ this.prefix
+ this.attributeKeyPrinter(fullKey)
@@ -73,7 +73,7 @@ export default class ISerializer {
return result
}
showProperty(attributeKey, attributeValue) {
showProperty(object, attributeKey, attributeValue) {
const attributes = this.entityType.attributes
const attribute = Utility.objectGet(attributes, attributeKey)
if (attribute instanceof TypeInitialization) {

View File

@@ -9,7 +9,7 @@ export default class ObjectSerializer extends ISerializer {
super(ObjectEntity, " ", "\n", false)
}
showProperty(attributeKey, attributeValue) {
showProperty(object, attributeKey, attributeValue) {
switch (attributeKey.toString()) {
case "Class":
case "Name":
@@ -17,7 +17,7 @@ export default class ObjectSerializer extends ISerializer {
// Serielized separately
return false
}
return super.showProperty(attributeKey, attributeValue)
return super.showProperty(object, attributeKey, attributeValue)
}
read(value) {
@@ -49,7 +49,12 @@ export default class ObjectSerializer extends ISerializer {
let result = `Begin Object Class=${object.Class.path} Name=${this.writeValue(object.Name)}
${this.subWrite([], object)
+ object
.CustomProperties.map(pin => this.separator + this.prefix + "CustomProperties " + SerializerFactory.getSerializer(PinEntity).write(pin))
.CustomProperties.map(pin =>
this.separator
+ this.prefix
+ "CustomProperties "
+ SerializerFactory.getSerializer(PinEntity).write(pin)
)
.join("")}
End Object\n`
return result

View File

@@ -12,6 +12,7 @@ import PinEntity from "../entity/PinEntity"
import PinReferenceEntity from "../entity/PinReferenceEntity"
import SerializerFactory from "./SerializerFactory"
import ToStringSerializer from "./ToStringSerializer"
import Identifier from "../entity/Identifier"
export default function initializeSerializerFactory() {
SerializerFactory.registerSerializer(
@@ -44,6 +45,7 @@ export default function initializeSerializerFactory() {
: ""
))
)
SerializerFactory.registerSerializer(Identifier, new ToStringSerializer(Identifier))
SerializerFactory.registerSerializer(PathSymbolEntity, new ToStringSerializer(PathSymbolEntity))
SerializerFactory.registerSerializer(GuidEntity, new ToStringSerializer(GuidEntity))
SerializerFactory.registerSerializer(IntegerEntity, new ToStringSerializer(IntegerEntity))

View File

@@ -42,6 +42,9 @@ export default class NodeTemplate extends SelectableDraggableTemplate {
node.classList.add("ueb-selected")
}
node.dataset.name = node.getNodeName()
if (node.entity.AdvancedPinDisplay) {
node.dataset.advancedDisplay = node.entity.AdvancedPinDisplay
}
node.style.setProperty("--ueb-position-x", sanitizeText(node.location[0]))
node.style.setProperty("--ueb-position-y", sanitizeText(node.location[1]))
/** @type {HTMLElement} */

View File

@@ -40,6 +40,9 @@ export default class PinTemplate extends ITemplate {
"ueb-pin-" + sanitizeText(pin.getType())
)
pin.dataset.id = pin.GetPinIdValue()
if (pin.entity.bAdvancedView) {
pin.dataset.advancedView = "true"
}
pin.clickableElement = pin
window.customElements.whenDefined("ueb-node").then(pin.nodeElement = pin.closest("ueb-node"))
pin.getLinks().forEach(pinReference => {

View File

@@ -10,7 +10,7 @@
--ueb-pin-color: #{$ueb-pin-color};
}
.ueb-pin-integer {
.ueb-pin-int {
$ueb-pin-color : #1fe0ad;
--ueb-pin-color: #{$ueb-pin-color};
}
@@ -41,7 +41,7 @@
--ueb-pin-color: #{$ueb-pin-color};
}
.ueb-pin-objectreference {
.ueb-pin-object {
$ueb-pin-color : #00a8f2;
--ueb-pin-color: #{$ueb-pin-color};
}

View File

@@ -105,6 +105,10 @@ ueb-blueprint[data-drag-scrolling="true"] .ueb-grid {
cursor: grabbing;
}
ueb-blueprint[data-drag-scrolling="false"] .ueb-grid {
cursor: default;
}
.ueb-zoom--.ueb,
.ueb {
/* 16/16 */
@@ -203,10 +207,6 @@ ueb-blueprint[data-drag-scrolling="false"][data-selecting="false"] ueb-node {
border-radius: calc(var(--ueb-node-radius) * 1.4);
}
.ueb-selected {
z-index: 1;
}
.ueb-selected>.ueb-node-border {
background-image:
linear-gradient(to right, #f1b000 0%, #f1b000 100%),
@@ -267,15 +267,19 @@ ueb-pin {
padding: 1px 2px;
}
ueb-blueprint[data-drag-scrolling="false"] .ueb-grid {
cursor: default;
ueb-node[data-advanced-display="Hidden"] ueb-pin[data-advanced-view="true"] {
display: none;
}
ueb-blueprint[data-drag-scrolling="false"][data-selecting="false"] ueb-node ueb-pin:hover {
ueb-blueprint[data-drag-scrolling="false"][data-selecting="false"] ueb-pin:hover {
background: var(--ueb-pin-background);
cursor : crosshair;
}
.ueb-node-outputs ueb-pin {
text-align: right;
}
.ueb-pin-icon {
display : inline-block;
position : relative;