mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
JSDoc complete type check
This commit is contained in:
55
dist/css/ueb-style.css
vendored
55
dist/css/ueb-style.css
vendored
@@ -214,6 +214,12 @@ ueb-selector > * {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.ueb-ellipsis-nowrap-text {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
ueb-link {
|
||||
--ueb-from-input-coefficient: calc(2 * var(--ueb-from-input) - 1);
|
||||
/* when from-y > to-y */
|
||||
@@ -612,6 +618,7 @@ ueb-window {
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform: translateX(calc(var(--ueb-position-x) * 1px)) translateY(calc(var(--ueb-position-y) * 1px));
|
||||
background: #242424;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
@@ -624,10 +631,58 @@ ueb-window {
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
.ueb-window-name {
|
||||
flex-grow: 1;
|
||||
padding-left: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ueb-window-close {
|
||||
padding: 8px;
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
}
|
||||
|
||||
.ueb-color-picker-theme,
|
||||
.ueb-color-picker-srgb {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ueb-color-picker-main {
|
||||
display: grid;
|
||||
grid-template: 1fr/auto min-content min-content min-content;
|
||||
}
|
||||
|
||||
.ueb-color-picker-wheel {
|
||||
position: relative;
|
||||
padding-top: 100%;
|
||||
min-width: 200px;
|
||||
border-radius: 100%;
|
||||
background: radial-gradient(white 5%, transparent 85%), conic-gradient(from 90deg, #FF0000 0deg, #FFFF00 60deg, #00FF00 120deg, #00FFFF 180deg, #0000FF 240deg, #FF00FF 300deg, #FF0000 360deg);
|
||||
}
|
||||
|
||||
ueb-color-handler {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -3px;
|
||||
left: -3px;
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
transform: translateX(calc(var(--ueb-position-x) * 1px)) translateY(calc(var(--ueb-position-y) * 1px));
|
||||
border: 1px solid #000;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.ueb-color-picker-saturation,
|
||||
.ueb-color-picker-value {
|
||||
margin: 0 8px;
|
||||
width: 30px;
|
||||
background: linear-gradient(to bottom, transparent 10%, #000000 100%), rebeccapurple;
|
||||
}
|
||||
|
||||
.ueb-color-picker-value {
|
||||
background: linear-gradient(to bottom, transparent 10%, #FFFFFF 100%), rebeccapurple;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=ueb-style.css.map */
|
||||
|
||||
2
dist/css/ueb-style.css.map
vendored
2
dist/css/ueb-style.css.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"sourceRoot":"","sources":["../../scss/style.scss","../../scss/ueb-link.scss","../../scss/ueb-node.scss","../../scss/ueb-pin.scss","../../scss/ueb-type-color.scss","../../scss/ueb-window.scss"],"names":[],"mappings":"AAAA;EACI;EACA;EACA,KACI;;AAIR;EACI;EACA;EACA,KACI;;AAIR;EACI;EACA;EACA,KACI;;AAIR;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAEI;EA0BJ,iBAEI;EAQJ;EACA;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;EACA;;;AAGJ;EACI;EAC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;;AAIR;EACI;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAII;EACA;;;AAIR;EACI;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;;AAGJ;EACI;EACA;EACA;;;ACzIR;EACI;;;AAGJ;EACI;;;AAGJ;EACI;AAAA;AAAA;AAAA;AAAA;AAAA;EAMA;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;ACrEJ;EACI;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA","file":"ueb-style.css"}
|
||||
{"version":3,"sourceRoot":"","sources":["../../scss/style.scss","../../scss/ueb-link.scss","../../scss/ueb-node.scss","../../scss/ueb-pin.scss","../../scss/ueb-type-color.scss","../../scss/ueb-window.scss"],"names":[],"mappings":"AAAA;EACI;EACA;EACA,KACI;;AAIR;EACI;EACA;EACA,KACI;;AAIR;EACI;EACA;EACA,KACI;;AAIR;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGJ;EACI;EACA;EACA;;;AAGJ;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ACI;EACA;EACA;;;AAGJ;AAAA;EAEI;EACA;;;AAGJ;EACI;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA,YACI;;;AAWR;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGJ;AAAA;EAEI;EACA;EACA;;;AAGJ;EACI","file":"ueb-style.css"}
|
||||
2
dist/css/ueb-style.min.css
vendored
2
dist/css/ueb-style.min.css
vendored
File diff suppressed because one or more lines are too long
2
dist/css/ueb-style.min.css.map
vendored
2
dist/css/ueb-style.min.css.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"sourceRoot":"","sources":["../../scss/style.scss","../../scss/ueb-link.scss","../../scss/ueb-node.scss","../../scss/ueb-pin.scss","../../scss/ueb-type-color.scss","../../scss/ueb-window.scss"],"names":[],"mappings":"AAAA,WACI,qBACA,oBACA,IACI,kGAIR,WACI,qBACA,mBACA,IACI,sGAIR,WACI,qBACA,iBACA,IACI,gGAIR,cACI,eACA,6CACA,cACA,kBACA,8EACA,+BACA,WACA,iBAGJ,kBACI,iBAGJ,qBACI,aACA,kBACA,MACA,QACA,OACA,aACA,0BACA,UAGJ,mBACI,iBACA,iCACA,eAGJ,mBACI,kBACA,gCACA,gBACA,kBAGJ,oDACI,gBAGJ,UACI,kFACA,kBACA,eACA,gBACA,+DACA,gEACA,yBACA,iBAEI,s3BA0BJ,gBAEI,sZAQJ,sFACA,gEACA,oDACA,qBACA,gBAGJ,6CACI,gBAGJ,8CACI,eAGJ,6BACI,eAGJ,6BACI,mBAGJ,6BACI,kBAGJ,6BACI,mBAGJ,6BACI,iBAGJ,6BACI,mBAGJ,6BACI,kBAGJ,8BACI,mBAGJ,8BACI,kBAGJ,8BACI,mBAGJ,8BACI,iBACA,uDAGJ,8BACI,mBACA,uDAGJ,8BACI,sBACA,uDAGJ,8BACI,iBACA,uDAGJ,8BACI,sBACA,uDAGJ,8BACI,sBACA,uDAGJ,+BACI,iBACA,uDAGJ,+BACI,sBACA,uDAGJ,+BAC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,cACA,WACA,YAGJ,0CACI,kBAGJ,cACI,qBACA,sBAGJ,sCACI,aAGJ,uBACI,iBAGJ,eACI,qBACA,sBACA,gBACA,yBACA,kBACA,oBACA,aAEA,4FAII,yCACA,aAIR,uCACI,gBACA,UACA,YACA,WACA,yBACA,2BAGJ,+CACI,6OAGJ,oEACI,UACA,WACA,YACA,qBACA,gBACA,yCAGJ,oCACI,cAGJ,qBACI,sBACA,gBACA,WAGJ,uBACI,cACA,aACA,YACA,UACA,eACA,gBACA,gBACA,4BACA,gBACA,cACA,YACA,cAEA,0CACI,WACA,YAGJ,gDACI,mBACA,mBACA,WCzIR,cACI,6BAGJ,SACI,iDAGJ,QACI,4NAMA,+CAGJ,wBACI,+CAGJ,yBACI,gDAGJ,wBACI,+CAGJ,uBACI,8CAGJ,wBACI,+CAGJ,0BACI,iDAGJ,wBACI,+CAGJ,2BACI,kDAGJ,0BACI,iDAGJ,qDACI,uDAGJ,iDACI,kDAGJ,mDACI,oDAGJ,gDACI,iDAGJ,0BACI,iDCrEJ,WACI,cACA,kBACA,MACA,OACA,sGACA,aAGJ,gBACI,aACA,mBACA,mBACA,gBACA,YACA,mBAGJ,kBACI,YACA,YACA","file":"ueb-style.min.css"}
|
||||
{"version":3,"sourceRoot":"","sources":["../../scss/style.scss","../../scss/ueb-link.scss","../../scss/ueb-node.scss","../../scss/ueb-pin.scss","../../scss/ueb-type-color.scss","../../scss/ueb-window.scss"],"names":[],"mappings":"AAAA,WACI,qBACA,oBACA,IACI,kGAIR,WACI,qBACA,mBACA,IACI,sGAIR,WACI,qBACA,iBACA,IACI,gGAIR,cACI,eACA,6CACA,cACA,kBACA,8EACA,+BACA,WACA,iBAGJ,kBACI,iBAGJ,qBACI,aACA,kBACA,MACA,QACA,OACA,aACA,0BACA,UAGJ,mBACI,iBACA,iCACA,eAGJ,mBACI,kBACA,gCACA,gBACA,kBAGJ,oDACI,gBAGJ,UACI,kFACA,kBACA,eACA,gBACA,+DACA,gEACA,yBACA,iBAE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ACA,2DAGJ,wBACI,kBACA,iBACA,gBACA,mBACA,WACI,mLAWR,kBACI,cACA,kBACA,SACA,UACA,UACA,WACA,sGACA,sBACA,kBAGJ,qDAEI,aACA,WACA,0EAGJ,wBACI","file":"ueb-style.min.css"}
|
||||
1071
dist/ueblueprint.js
vendored
1071
dist/ueblueprint.js
vendored
File diff suppressed because it is too large
Load Diff
4
dist/ueblueprint.min.js
vendored
4
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -10,6 +10,12 @@ import Utility from "./Utility"
|
||||
* @typedef {import("./element/PinElement").default} PinElement
|
||||
* @typedef {import("./entity/GuidEntity").default} GuidEntity
|
||||
* @typedef {import("./entity/PinReferenceEntity").default} PinReferenceEntity
|
||||
* @typedef {{
|
||||
* primaryInf: Number,
|
||||
* primarySup: Number,
|
||||
* secondaryInf: Number,
|
||||
* secondarySup: Number
|
||||
* }} BoundariesInfo
|
||||
*/
|
||||
|
||||
/** @extends {IElement<Object, BlueprintTemplate>} */
|
||||
@@ -94,7 +100,7 @@ export default class Blueprint extends IElement {
|
||||
let rect = node.getBoundingClientRect()
|
||||
let gridRect = this.nodesContainerElement.getBoundingClientRect()
|
||||
const scaleCorrection = 1 / this.getScale()
|
||||
return {
|
||||
return /** @type {BoundariesInfo} */ {
|
||||
primaryInf: (rect.left - gridRect.left) * scaleCorrection,
|
||||
primarySup: (rect.right - gridRect.right) * scaleCorrection,
|
||||
// Counter intuitive here: the y (secondary axis is positive towards the bottom, therefore upper bound "sup" is bottom)
|
||||
@@ -132,11 +138,13 @@ export default class Blueprint extends IElement {
|
||||
return [this.scrollX, this.scrollY]
|
||||
}
|
||||
|
||||
/** @param {Number[]} param0 */
|
||||
setScroll([x, y], smooth = false) {
|
||||
this.scrollX = x
|
||||
this.scrollY = y
|
||||
}
|
||||
|
||||
/** @param {Number[]} delta */
|
||||
scrollDelta(delta, smooth = false) {
|
||||
const maxScroll = [2 * Configuration.expandGridSize, 2 * Configuration.expandGridSize]
|
||||
let currentScroll = this.getScroll()
|
||||
@@ -282,7 +290,7 @@ export default class Blueprint extends IElement {
|
||||
let result = this.template.getPin(pinReference)
|
||||
if (result
|
||||
// Make sure it wasn't renamed in the meantime
|
||||
&& result.nodeElement.getNodeName() == pinReference.objectName) {
|
||||
&& result.nodeElement.getNodeName() == pinReference.objectName.toString()) {
|
||||
return result
|
||||
}
|
||||
// Slower fallback
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { css } from "lit"
|
||||
|
||||
export default class Configuration {
|
||||
static colorDragEventName = "ueb-color-drag"
|
||||
static colorPickEventName = "ueb-color-pick"
|
||||
static colorWindowEventName = "ueb-color-window"
|
||||
static deleteNodesKeyboardKey = "Delete"
|
||||
static dragGeneralEventName = "ueb-drag-general"
|
||||
static dragEventName = "ueb-drag"
|
||||
static editTextEventName = {
|
||||
begin: "ueb-edit-text-begin",
|
||||
end: "ueb-edit-text-end",
|
||||
@@ -39,8 +44,8 @@ export default class Configuration {
|
||||
static minZoom = -12
|
||||
static mouseWheelFactor = 0.2
|
||||
static nodeDeleteEventName = "ueb-node-delete"
|
||||
static nodeDragGeneralEventName = "ueb-node-drag-general"
|
||||
static nodeDragEventName = "ueb-node-drag"
|
||||
static nodeDragLocalEventName = "ueb-node-drag-local"
|
||||
static nodeName = (name, counter) => `${name}_${counter}`
|
||||
static nodeRadius = 8 // in pixel
|
||||
static nodeReflowEventName = "ueb-node-reflow"
|
||||
|
||||
@@ -2,8 +2,14 @@ import CalculatedType from "./entity/CalculatedType"
|
||||
import TypeInitialization from "./entity/TypeInitialization"
|
||||
|
||||
/**
|
||||
* @typedef {import("./entity/LinearColorEntity").default} LinearColorEntity
|
||||
* @typedef {import("./element/IElement").default} IElement
|
||||
* @typedef {import("./entity/IEntity").default} IEntity
|
||||
* @typedef {import("./entity/LinearColorEntity").default} LinearColorEntity
|
||||
* @typedef {import("./entity/TypeInitialization").AnyValue} AnyValue
|
||||
*/
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("./entity/TypeInitialization").AnyValueConstructor<T>} AnyValueConstructor
|
||||
*/
|
||||
|
||||
export default class Utility {
|
||||
@@ -31,8 +37,10 @@ export default class Utility {
|
||||
return Math.min(Math.max(val, min), max)
|
||||
}
|
||||
|
||||
/** @param {HTMLElement} element */
|
||||
static getScale(element) {
|
||||
return Number(getComputedStyle(element).getPropertyValue("--ueb-scale"))
|
||||
const scale = getComputedStyle(element).getPropertyValue("--ueb-scale")
|
||||
return scale != "" ? parseFloat(scale) : 1
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,13 +71,17 @@ export default class Utility {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {IEntity}
|
||||
* @param {Object} target Object holding the data
|
||||
* @param {String[]} keys The chained keys to access from object in order to get the value
|
||||
* @param {Boolean} defaultValue Value to return in case from doesn't have it
|
||||
* @returns {any} The value in from corresponding to the keys or defaultValue otherwise
|
||||
* @param {IEntity} entity
|
||||
* @param {String[]} keys
|
||||
* @param {any} propertyDefinition
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
static isSerialized(entity, keys, propertyDefinition = Utility.objectGet(entity.constructor.attributes, keys)) {
|
||||
static isSerialized(
|
||||
entity,
|
||||
keys,
|
||||
// @ts-expect-error
|
||||
propertyDefinition = Utility.objectGet(entity.constructor.attributes, keys)
|
||||
) {
|
||||
if (propertyDefinition instanceof CalculatedType) {
|
||||
return Utility.isSerialized(entity, keys, propertyDefinition.calculate(entity))
|
||||
}
|
||||
@@ -82,13 +94,7 @@ export default class Utility {
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value from an object, gives defaultValue in case of failure
|
||||
* @param {Object} target Object holding the data
|
||||
* @param {String[]} keys The chained keys to access from object in order to get the value
|
||||
* @param {any} defaultValue Value to return in case from doesn't have it
|
||||
* @returns {any} The value in from corresponding to the keys or defaultValue otherwise
|
||||
*/
|
||||
/** @param {String[]} keys */
|
||||
static objectGet(target, keys, defaultValue = undefined) {
|
||||
if (target === undefined) {
|
||||
return undefined
|
||||
@@ -106,12 +112,9 @@ export default class Utility {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a value in an object
|
||||
* @param {Object} target Object holding the data
|
||||
* @param {String[]} keys The chained keys to access from object in order to set the value
|
||||
* @param {*} value Value to be set
|
||||
* @param {Boolean} create Whether to create or not the key in case it doesn't exist
|
||||
* @returns {Boolean} Returns true on succes, false otherwise
|
||||
* @param {String[]} keys
|
||||
* @param {Boolean} create
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
static objectSet(target, keys, value, create = false, defaultDictType = Object) {
|
||||
if (!(keys instanceof Array)) {
|
||||
@@ -142,20 +145,23 @@ export default class Utility {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {AnyValue | AnyValueConstructor<IEntity>} value
|
||||
* @returns {AnyValueConstructor<IEntity>}
|
||||
*/
|
||||
static getType(value) {
|
||||
if (value === null) {
|
||||
return null
|
||||
}
|
||||
let constructor = value?.constructor
|
||||
switch (constructor) {
|
||||
case TypeInitialization:
|
||||
return Utility.getType(value.type)
|
||||
case Function:
|
||||
// value is already a constructor
|
||||
return value
|
||||
default:
|
||||
return constructor
|
||||
if (value instanceof TypeInitialization) {
|
||||
return Utility.getType(value.type)
|
||||
}
|
||||
if (value instanceof Function) {
|
||||
// value is already a constructor
|
||||
return value
|
||||
}
|
||||
/** @ts-expect-error */
|
||||
return value?.constructor
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
37
js/element/ColorHandlerElement.js
Normal file
37
js/element/ColorHandlerElement.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import LinearColorEntity from "../entity/LinearColorEntity"
|
||||
import ColorHandlerTemplate from "../template/ColorHandlerTemplate"
|
||||
import IDraggableElement from "./IDraggableElement"
|
||||
|
||||
/** @typedef {import("../template/ColorPickerWindowTemplate").default} ColorPickerWindowTemplate */
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("./WindowElement").default<T>} WindowElement
|
||||
*/
|
||||
|
||||
export default class ColorHandlerElement extends IDraggableElement {
|
||||
|
||||
/** @type {WindowElement<ColorPickerWindowTemplate>} */
|
||||
windowElement
|
||||
|
||||
constructor() {
|
||||
super({}, new ColorHandlerTemplate())
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
this.windowElement = this.closest("ueb-window")
|
||||
}
|
||||
|
||||
/** @param {Number[]} param0 */
|
||||
addLocation([x, y]) {
|
||||
super.addLocation([x, y])
|
||||
this.windowElement.windowOptions
|
||||
this.windowElement.template.color = this.computeColor()
|
||||
}
|
||||
|
||||
computeColor() {
|
||||
return new LinearColorEntity()
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("ueb-color-handler", ColorHandlerElement)
|
||||
@@ -3,13 +3,13 @@ import IElement from "./IElement"
|
||||
import Utility from "../Utility"
|
||||
|
||||
/**
|
||||
* @typedef {import("../template/SelectableDraggableTemplate").default} SelectableDraggableTemplate
|
||||
* @typedef {import("../template/IDraggableTemplate").default} IDraggableTemplate
|
||||
* @typedef {import("../entity/IEntity").default} IEntity
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {IEntity} T
|
||||
* @template {SelectableDraggableTemplate} U
|
||||
* @template {IDraggableTemplate} U
|
||||
* @extends {IElement<T, U>}
|
||||
*/
|
||||
export default class IDraggableElement extends IElement {
|
||||
@@ -25,8 +25,11 @@ export default class IDraggableElement extends IElement {
|
||||
attribute: false,
|
||||
},
|
||||
}
|
||||
static dragEventName = Configuration.dragEventName
|
||||
static dragGeneralEventName = Configuration.dragGeneralEventName
|
||||
|
||||
constructor(...args) {
|
||||
// @ts-expect-error
|
||||
super(...args)
|
||||
this.locationX = 0
|
||||
this.locationY = 0
|
||||
@@ -38,7 +41,8 @@ export default class IDraggableElement extends IElement {
|
||||
this.locationX = x
|
||||
this.locationY = y
|
||||
if (this.blueprint) {
|
||||
const dragLocalEvent = new CustomEvent(Configuration.nodeDragLocalEventName, {
|
||||
// @ts-expect-error
|
||||
const dragLocalEvent = new CustomEvent(this.constructor.dragEventName, {
|
||||
detail: {
|
||||
value: d,
|
||||
},
|
||||
@@ -56,7 +60,8 @@ export default class IDraggableElement extends IElement {
|
||||
|
||||
/** @param {Number[]} value */
|
||||
dispatchDragEvent(value) {
|
||||
const dragEvent = new CustomEvent(Configuration.nodeDragEventName, {
|
||||
// @ts-expect-error
|
||||
const dragEvent = new CustomEvent(this.constructor.dragGeneralEventName, {
|
||||
detail: {
|
||||
value: value
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@ import { LitElement } from "lit"
|
||||
*/
|
||||
export default class IElement extends LitElement {
|
||||
|
||||
/** @type {import("lit").PropertyDeclarations} */
|
||||
static properties = {
|
||||
}
|
||||
|
||||
@@ -24,7 +25,7 @@ export default class IElement extends LitElement {
|
||||
return this.#blueprint
|
||||
}
|
||||
set blueprint(v) {
|
||||
return this.#blueprint = v
|
||||
this.#blueprint = v
|
||||
}
|
||||
|
||||
/** @type {T} */
|
||||
@@ -63,7 +64,7 @@ export default class IElement extends LitElement {
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
this.blueprint = this.closest("ueb-blueprint")
|
||||
this.blueprint = /** @type {Blueprint} */ this.closest("ueb-blueprint")
|
||||
this.template.connectedCallback()
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ export default class IFromToPositionedElement extends IElement {
|
||||
}
|
||||
|
||||
constructor(...args) {
|
||||
// @ts-expect-error
|
||||
super(...args)
|
||||
this.initialPositionX = 0
|
||||
this.initialPositionY = 0
|
||||
|
||||
@@ -10,8 +10,8 @@ import IDraggableElement from "./IDraggableElement"
|
||||
|
||||
/**
|
||||
* @template {IEntity} T
|
||||
* @template {IDraggableElement} U
|
||||
* @extends {IElement<T, U>}
|
||||
* @template {SelectableDraggableTemplate} U
|
||||
* @extends {IDraggableElement<T, U>}
|
||||
*/
|
||||
export default class ISelectableDraggableElement extends IDraggableElement {
|
||||
|
||||
@@ -40,7 +40,7 @@ export default class ISelectableDraggableElement extends IDraggableElement {
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback()
|
||||
this.blueprint.removeEventListener(Configuration.nodeDragEventName, this.dragHandler)
|
||||
this.blueprint.removeEventListener(Configuration.nodeDragGeneralEventName, this.dragHandler)
|
||||
}
|
||||
|
||||
setSelected(value = true) {
|
||||
@@ -48,9 +48,9 @@ export default class ISelectableDraggableElement extends IDraggableElement {
|
||||
if (this.blueprint) {
|
||||
if (this.selected) {
|
||||
this.listeningDrag = true
|
||||
this.blueprint.addEventListener(Configuration.nodeDragEventName, this.dragHandler)
|
||||
this.blueprint.addEventListener(Configuration.nodeDragGeneralEventName, this.dragHandler)
|
||||
} else {
|
||||
this.blueprint.removeEventListener(Configuration.nodeDragEventName, this.dragHandler)
|
||||
this.blueprint.removeEventListener(Configuration.nodeDragGeneralEventName, this.dragHandler)
|
||||
this.listeningDrag = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ export default class LinkElement extends IFromToPositionedElement {
|
||||
const nodeElement = getCurrentPin().getNodeElement()
|
||||
nodeElement.removeEventListener(Configuration.nodeDeleteEventName, this.#nodeDeleteHandler)
|
||||
nodeElement.removeEventListener(
|
||||
Configuration.nodeDragLocalEventName,
|
||||
Configuration.nodeDragEventName,
|
||||
isDestinationPin ? this.#nodeDragDestinatonHandler : this.#nodeDragSourceHandler
|
||||
)
|
||||
nodeElement.removeEventListener(
|
||||
@@ -135,7 +135,7 @@ export default class LinkElement extends IFromToPositionedElement {
|
||||
const nodeElement = getCurrentPin().getNodeElement()
|
||||
nodeElement.addEventListener(Configuration.nodeDeleteEventName, this.#nodeDeleteHandler)
|
||||
nodeElement.addEventListener(
|
||||
Configuration.nodeDragLocalEventName,
|
||||
Configuration.nodeDragEventName,
|
||||
isDestinationPin ? this.#nodeDragDestinatonHandler : this.#nodeDragSourceHandler
|
||||
)
|
||||
nodeElement.addEventListener(
|
||||
@@ -178,7 +178,7 @@ export default class LinkElement extends IFromToPositionedElement {
|
||||
Promise.all([this.updateComplete, this.sourcePin.updateComplete]).then(() => self.setSourceLocation())
|
||||
return
|
||||
}
|
||||
location = this.sourcePin.template.getLinkLocation(this.sourcePin)
|
||||
location = this.sourcePin.template.getLinkLocation()
|
||||
}
|
||||
const [x, y] = location
|
||||
this.initialPositionX = x
|
||||
@@ -193,7 +193,7 @@ export default class LinkElement extends IFromToPositionedElement {
|
||||
Promise.all([this.updateComplete, this.destinationPin.updateComplete]).then(() => self.setDestinationLocation())
|
||||
return
|
||||
}
|
||||
location = this.destinationPin.template.getLinkLocation(this.destinationPin)
|
||||
location = this.destinationPin.template.getLinkLocation()
|
||||
}
|
||||
this.finaPositionX = location[0]
|
||||
this.finaPositionY = location[1]
|
||||
|
||||
@@ -43,6 +43,8 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
reflect: true,
|
||||
}
|
||||
}
|
||||
static dragEventName = Configuration.nodeDragEventName
|
||||
static dragGeneralEventName = Configuration.nodeDragGeneralEventName
|
||||
|
||||
get blueprint() {
|
||||
return super.blueprint
|
||||
@@ -83,6 +85,7 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
static fromSerializedObject(str) {
|
||||
str = str.trim()
|
||||
let entity = SerializerFactory.getSerializer(ObjectEntity).deserialize(str)
|
||||
// @ts-expect-error
|
||||
return new NodeElement(entity)
|
||||
}
|
||||
|
||||
@@ -136,7 +139,9 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
|
||||
setLocation(value = [0, 0]) {
|
||||
let nodeType = this.entity.NodePosX.constructor
|
||||
// @ts-expect-error
|
||||
this.entity.NodePosX = new nodeType(value[0])
|
||||
// @ts-expect-error
|
||||
this.entity.NodePosY = new nodeType(value[1])
|
||||
super.setLocation(value)
|
||||
}
|
||||
|
||||
@@ -9,20 +9,26 @@ import LinkElement from "./LinkElement"
|
||||
import NamePinTemplate from "../template/NamePinTemplate"
|
||||
import PinTemplate from "../template/PinTemplate"
|
||||
import RealPinTemplate from "../template/RealPinTemplate"
|
||||
import ReferencePinTemplate from "../template/ReferencePinTemplate"
|
||||
import RotatorPinTemplate from "../template/RotatorPinTemplate"
|
||||
import StringPinTemplate from "../template/StringPinTemplate"
|
||||
import Utility from "../Utility"
|
||||
import VectorPinTemplate from "../template/VectorPinTemplate"
|
||||
import ReferencePinTemplate from "../template/ReferencePinTemplate"
|
||||
import RotatorPinTemplate from "../template/RotatorPinTemplate"
|
||||
|
||||
/**
|
||||
* @typedef {import("../entity/GuidEntity").default} GuidEntity
|
||||
* @typedef {import("../entity/PinEntity").default} PinEntity
|
||||
* @typedef {import("../entity/PinReferenceEntity").default} PinReferenceEntity
|
||||
* @typedef {import("./NodeElement").default} NodeElement
|
||||
*/
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("../entity/PinEntity").default<T>} PinEntity
|
||||
*/
|
||||
|
||||
/** @extends {IElement<PinEntity, PinTemplate>} */
|
||||
/**
|
||||
* @template T
|
||||
* @extends {IElement<PinEntity<T>, PinTemplate>}
|
||||
*/
|
||||
export default class PinElement extends IElement {
|
||||
|
||||
static #typeTemplateMap = {
|
||||
@@ -31,9 +37,9 @@ export default class PinElement extends IElement {
|
||||
"/Script/CoreUObject.Vector": VectorPinTemplate,
|
||||
"bool": BoolPinTemplate,
|
||||
"exec": ExecPinTemplate,
|
||||
"MUTABLE_REFERENCE": ReferencePinTemplate,
|
||||
"name": NamePinTemplate,
|
||||
"real": RealPinTemplate,
|
||||
"MUTABLE_REFERENCE": ReferencePinTemplate,
|
||||
"string": StringPinTemplate,
|
||||
}
|
||||
|
||||
@@ -47,6 +53,7 @@ export default class PinElement extends IElement {
|
||||
type: LinearColorEntity,
|
||||
converter: {
|
||||
fromAttribute: (value, type) => {
|
||||
// @ts-expect-error
|
||||
return value ? ISerializer.grammar.LinearColorFromAnyColor.parse(value).value : null
|
||||
},
|
||||
toAttribute: (value, type) => {
|
||||
@@ -79,8 +86,8 @@ export default class PinElement extends IElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {PinEntity} pinEntity
|
||||
* @return {PinTemplate}
|
||||
* @param {PinEntity<any>} pinEntity
|
||||
* @return {new () => PinTemplate}
|
||||
*/
|
||||
static getTypeTemplate(pinEntity) {
|
||||
let result = PinElement.#typeTemplateMap[
|
||||
@@ -102,26 +109,22 @@ export default class PinElement extends IElement {
|
||||
get defaultValue() {
|
||||
return this.unreactiveDefaultValue
|
||||
}
|
||||
/** @param {String} value */
|
||||
set defaultValue(value) {
|
||||
let oldValue = this.unreactiveDefaultValue
|
||||
this.unreactiveDefaultValue = value
|
||||
this.requestUpdate("defaultValue", oldValue)
|
||||
}
|
||||
|
||||
/** @param {PinEntity} entity */
|
||||
/** @param {PinEntity<T>} entity */
|
||||
constructor(entity) {
|
||||
super(
|
||||
entity,
|
||||
new (PinElement.getTypeTemplate(entity))()
|
||||
)
|
||||
this.advancedView = entity.bAdvancedView
|
||||
/** @type {String} */
|
||||
this.unreactiveDefaultValue = entity.getDefaultValue()
|
||||
if (this.unreactiveDefaultValue.constructor === String) {
|
||||
this.unreactiveDefaultValue = entity.getDefaultValue()
|
||||
}
|
||||
this.pinType = this.entity.getType()
|
||||
// @ts-expect-error
|
||||
this.color = this.constructor.properties.color.converter.fromAttribute(Configuration.pinColor[this.pinType]?.toString())
|
||||
this.isLinked = false
|
||||
this.pinDirection = entity.isInput() ? "input" : entity.isOutput() ? "output" : "hidden"
|
||||
@@ -176,7 +179,7 @@ export default class PinElement extends IElement {
|
||||
}
|
||||
|
||||
getLinkLocation() {
|
||||
return this.template.getLinkLocation(this)
|
||||
return this.template.getLinkLocation()
|
||||
}
|
||||
|
||||
/** @returns {NodeElement} */
|
||||
|
||||
@@ -9,6 +9,7 @@ export default class SelectorElement extends IFromToPositionedElement {
|
||||
super({}, new SelectorTemplate())
|
||||
this.selectionModel = null
|
||||
}
|
||||
|
||||
/** @param {Number[]} initialPosition */
|
||||
beginSelect(initialPosition) {
|
||||
this.blueprint.selecting = true
|
||||
|
||||
@@ -3,7 +3,10 @@ import Configuration from "../Configuration"
|
||||
import IDraggableElement from "./IDraggableElement"
|
||||
import WindowTemplate from "../template/WindowTemplate"
|
||||
|
||||
/** @extends {ISelectableDraggableElement<Object, WindowTemplate>} */
|
||||
/**
|
||||
* @template {WindowTemplate} T
|
||||
* @extends {IDraggableElement<Object, T>}
|
||||
*/
|
||||
export default class WindowElement extends IDraggableElement {
|
||||
|
||||
static #typeTemplateMap = {
|
||||
@@ -25,13 +28,15 @@ export default class WindowElement extends IDraggableElement {
|
||||
},
|
||||
}
|
||||
|
||||
constructor(properties = {}) {
|
||||
if (properties.type.constructor == String) {
|
||||
properties.type = WindowElement.#typeTemplateMap[properties.type]
|
||||
constructor(options = {}) {
|
||||
if (options.type.constructor == String) {
|
||||
options.type = WindowElement.#typeTemplateMap[options.type]
|
||||
}
|
||||
properties.type ??= WindowTemplate
|
||||
super({}, new properties.type())
|
||||
this.type = properties.type
|
||||
options.type ??= WindowTemplate
|
||||
options.windowOptions ??= {}
|
||||
super({}, new options.type())
|
||||
this.type = options.type
|
||||
this.windowOptions = options.windowOptions
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
|
||||
@@ -7,4 +7,10 @@ export default class FunctionReferenceEntity extends IEntity {
|
||||
MemberParent: ObjectReferenceEntity,
|
||||
MemberName: "",
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {ObjectReferenceEntity} */ this.MemberParent
|
||||
/** @type {String} */ this.MemberName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,11 @@ export default class GuidEntity extends IEntity {
|
||||
return new GuidEntity({ value: guid })
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {String} */ this.value
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ import SerializerFactory from "../serialization/SerializerFactory"
|
||||
import TypeInitialization from "./TypeInitialization"
|
||||
import Utility from "../Utility"
|
||||
|
||||
/**
|
||||
* @template {IEntity} T
|
||||
* @typedef {new (Object) => T} IEntityConstructor
|
||||
*/
|
||||
|
||||
export default class IEntity extends Observable {
|
||||
|
||||
static attributes = {}
|
||||
@@ -44,6 +49,7 @@ export default class IEntity extends Observable {
|
||||
}
|
||||
|
||||
// Not instanceof because all objects are instenceof Object, exact match needed
|
||||
// @ts-expect-error
|
||||
if (defaultType === Object) {
|
||||
target[property] = {}
|
||||
defineAllAttributes(target[property], properties[property], values[property], property + ".")
|
||||
@@ -58,7 +64,8 @@ export default class IEntity extends Observable {
|
||||
&& defaultValue.serialized
|
||||
&& defaultValue.type !== String
|
||||
) {
|
||||
value = SerializerFactory.getSerializer(defaultValue.type).deserialize(value)
|
||||
// @ts-expect-error
|
||||
value = SerializerFactory.getSerializer((defaultValue.type)).deserialize(value)
|
||||
}
|
||||
target[property] = TypeInitialization.sanitize(value, Utility.getType(defaultValue))
|
||||
continue // We have a value, need nothing more
|
||||
@@ -72,6 +79,7 @@ export default class IEntity extends Observable {
|
||||
if (defaultValue.serialized) {
|
||||
defaultValue = ""
|
||||
} else {
|
||||
// @ts-expect-error
|
||||
defaultType = defaultValue.type
|
||||
defaultValue = defaultValue.value
|
||||
}
|
||||
@@ -82,6 +90,7 @@ export default class IEntity extends Observable {
|
||||
target[property] = TypeInitialization.sanitize(defaultValue, defaultType)
|
||||
}
|
||||
}
|
||||
// @ts-expect-error
|
||||
const attributes = this.constructor.attributes
|
||||
if (values.constructor !== Object && Object.getOwnPropertyNames(attributes).length == 1) {
|
||||
// Where there is just one attribute, option can be the value of that attribute
|
||||
|
||||
@@ -11,6 +11,11 @@ export default class IdentifierEntity extends IEntity {
|
||||
toAttribute: (value, type) => value.toString()
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {String} */ this.value
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export default class IntegerEntity extends IEntity {
|
||||
/** @param {Object | Number | String} options */
|
||||
constructor(options = 0) {
|
||||
super(options)
|
||||
/** @type {Number} */
|
||||
this.value = Math.round(this.value)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,4 +6,9 @@ export default class InvariantTextEntity extends IEntity {
|
||||
static attributes = {
|
||||
value: String,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {String} */ this.value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,5 +19,11 @@ export default class KeyBindingEntity extends IEntity {
|
||||
options.bAlt = options.bAlt ?? false
|
||||
options.bCmd = options.bCmd ?? false
|
||||
super(options)
|
||||
/** @type {String} */ this.ActionName
|
||||
/** @type {Boolean} */ this.bShift
|
||||
/** @type {Boolean} */ this.bCtrl
|
||||
/** @type {Boolean} */ this.bAlt
|
||||
/** @type {Boolean} */ this.bCmd
|
||||
/** @type {IdentifierEntity} */ this.Key
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,55 @@ export default class LinearColorEntity extends IEntity {
|
||||
A: Number,
|
||||
}
|
||||
|
||||
static fromWheelLocation([x, y], radius) {
|
||||
x -= radius
|
||||
y -= radius
|
||||
const mod = Math.sqrt(x * x + y * y)
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {Number} */ this.R
|
||||
/** @type {Number} */ this.G
|
||||
/** @type {Number} */ this.B
|
||||
/** @type {Number} */ this.A
|
||||
}
|
||||
|
||||
toRGBA() {
|
||||
return [this.R, this.G, this.B, this.A]
|
||||
}
|
||||
|
||||
toHSV() {
|
||||
const max = Math.max(this.R, this.G, this.B)
|
||||
const min = Math.min(this.R, this.G, this.B)
|
||||
const d = max - min
|
||||
let h
|
||||
const s = (max === 0 ? 0 : d / max)
|
||||
const v = max / 255
|
||||
switch (max) {
|
||||
case min:
|
||||
h = 0
|
||||
break
|
||||
case this.R:
|
||||
h = (this.G - this.B) + d * (this.G < this.B ? 6 : 0)
|
||||
break
|
||||
case this.G:
|
||||
h = (this.B - this.R) + d * 2
|
||||
break
|
||||
case this.B:
|
||||
h = (this.R - this.G) + d * 4
|
||||
break
|
||||
}
|
||||
h /= 6 * d
|
||||
return [h, s, v]
|
||||
}
|
||||
|
||||
toNumber() {
|
||||
return this.A + this.B << 8 + this.G << 16 + this.R << 24
|
||||
}
|
||||
|
||||
toString() {
|
||||
return Utility.printLinearColor(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,4 +8,11 @@ export default class LocalizedTextEntity extends IEntity {
|
||||
key: String,
|
||||
value: String,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {String} */ this.namespace
|
||||
/** @type {String} */ this.key
|
||||
/** @type {String} */ this.value
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,25 @@ export default class ObjectEntity extends IEntity {
|
||||
|
||||
static nameRegex = /(\w+)_(\d+)/
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {ObjectReferenceEntity} */ this.Class
|
||||
/** @type {String} */ this.Name
|
||||
/** @type {Boolean?} */ this.bIsPureFunc
|
||||
/** @type {VariableReferenceEntity?} */ this.VariableReference
|
||||
/** @type {FunctionReferenceEntity?} */ this.FunctionReference
|
||||
/** @type {FunctionReferenceEntity?} */ this.EventReference
|
||||
/** @type {ObjectReferenceEntity?} */ this.TargetType
|
||||
/** @type {IntegerEntity} */ this.NodePosX
|
||||
/** @type {IntegerEntity} */ this.NodePosY
|
||||
/** @type {IdentifierEntity?} */ this.AdvancedPinDisplay
|
||||
/** @type {IdentifierEntity?} */ this.EnabledState
|
||||
/** @type {GuidEntity} */ this.NodeGuid
|
||||
/** @type {IntegerEntity?} */ this.ErrorType
|
||||
/** @type {String?} */ this.ErrorMsg
|
||||
/** @type {PinEntity[]} */ this.CustomProperties
|
||||
}
|
||||
|
||||
getObjectName(dropCounter = false) {
|
||||
if (dropCounter) {
|
||||
return this.getNameAndCounter()[0]
|
||||
|
||||
@@ -6,4 +6,10 @@ export default class ObjectReferenceEntity extends IEntity {
|
||||
type: String,
|
||||
path: String,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {String} */ this.type
|
||||
/** @type {String} */ this.path
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ export default class PathSymbolEntity extends IEntity {
|
||||
value: String,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {String} */ this.value
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ import SimpleSerializationVectorEntity from "./SimpleSerializationVectorEntity"
|
||||
import TypeInitialization from "./TypeInitialization"
|
||||
import VectorEntity from "./VectorEntity"
|
||||
|
||||
/** @typedef {import("./TypeInitialization").AnyValue} AnyValue */
|
||||
|
||||
/** @template {AnyValue} T */
|
||||
export default class PinEntity extends IEntity {
|
||||
|
||||
static #typeEntityMap = {
|
||||
@@ -76,6 +79,41 @@ export default class PinEntity extends IEntity {
|
||||
: entity
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {GuidEntity} */ this.PinId
|
||||
/** @type {String} */ this.PinName
|
||||
/** @type {LocalizedTextEntity} */ this.PinFriendlyName
|
||||
/** @type {String} */ this.PinToolTip
|
||||
/** @type {String} */ this.Direction
|
||||
/**
|
||||
* @type {{
|
||||
* PinCategory: String,
|
||||
* PinSubCategory: String,
|
||||
* PinSubCategoryObject: ObjectReferenceEntity,
|
||||
* PinSubCategoryMemberReference: any,
|
||||
* PinValueType: String,
|
||||
* ContainerType: ObjectReferenceEntity,
|
||||
* bIsReference: Boolean,
|
||||
* bIsConst: Boolean,
|
||||
* bIsWeakPointer: Boolean,
|
||||
* bIsUObjectWrapper: Boolean,
|
||||
* bSerializeAsSinglePrecisionFloat: Boolean,
|
||||
* }}
|
||||
*/ this.PinType
|
||||
/** @type {PinReferenceEntity[]} */ this.LinkedTo
|
||||
/** @type {T} */ this.DefaultValue
|
||||
/** @type {String} */ this.AutogeneratedDefaultValue
|
||||
/** @type {ObjectReferenceEntity} */ this.DefaultObject
|
||||
/** @type {GuidEntity} */ this.PersistentGuid
|
||||
/** @type {Boolean} */ this.bHidden
|
||||
/** @type {Boolean} */ this.bNotConnectable
|
||||
/** @type {Boolean} */ this.bDefaultValueIsReadOnly
|
||||
/** @type {Boolean} */ this.bDefaultValueIsIgnored
|
||||
/** @type {Boolean} */ this.bAdvancedView
|
||||
/** @type {Boolean} */ this.bOrphanedPin
|
||||
}
|
||||
|
||||
getType() {
|
||||
if (this.PinType.PinCategory == "struct") {
|
||||
return this.PinType.PinSubCategoryObject.path
|
||||
@@ -84,7 +122,7 @@ export default class PinEntity extends IEntity {
|
||||
}
|
||||
|
||||
getDefaultValue() {
|
||||
return this.DefaultValue ?? ""
|
||||
return this.DefaultValue
|
||||
}
|
||||
|
||||
isHidden() {
|
||||
@@ -111,7 +149,7 @@ export default class PinEntity extends IEntity {
|
||||
/** @type {PinReferenceEntity[]} */
|
||||
this.LinkedTo
|
||||
const linkFound = this.LinkedTo?.find(pinReferenceEntity => {
|
||||
return pinReferenceEntity.objectName == targetObjectName
|
||||
return pinReferenceEntity.objectName.toString() == targetObjectName
|
||||
&& pinReferenceEntity.pinGuid.valueOf() == targetPinEntity.PinId.valueOf()
|
||||
})
|
||||
if (!linkFound) {
|
||||
@@ -130,7 +168,7 @@ export default class PinEntity extends IEntity {
|
||||
*/
|
||||
unlinkFrom(targetObjectName, targetPinEntity) {
|
||||
const indexElement = this.LinkedTo?.findIndex(pinReferenceEntity => {
|
||||
return pinReferenceEntity.objectName == targetObjectName
|
||||
return pinReferenceEntity.objectName.toString() == targetObjectName
|
||||
&& pinReferenceEntity.pinGuid.valueOf() == targetPinEntity.PinId.valueOf()
|
||||
})
|
||||
if (indexElement >= 0) {
|
||||
|
||||
@@ -8,4 +8,10 @@ export default class PinReferenceEntity extends IEntity {
|
||||
objectName: PathSymbolEntity,
|
||||
pinGuid: GuidEntity,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {PathSymbolEntity} */ this.objectName
|
||||
/** @type {GuidEntity} */ this.pinGuid
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,11 @@ export default class RotatorEntity extends IEntity {
|
||||
P: Number,
|
||||
Y: Number,
|
||||
}
|
||||
|
||||
constructor(values = {}) {
|
||||
super(values)
|
||||
/** @type {Number} */ this.R
|
||||
/** @type {Number} */ this.P
|
||||
/** @type {Number} */ this.Y
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
/** @template T */
|
||||
|
||||
/**
|
||||
* @typedef {import("./IEntity").default} IEntity
|
||||
* @typedef {IEntity | String | Number | Boolean | Array} AnyValue
|
||||
*/
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @typedef {import("./IEntity").IEntityConstructor<T>} IEntityConstructor
|
||||
*/
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @typedef {IEntityConstructor<T> | StringConstructor | NumberConstructor | BooleanConstructor | ArrayConstructor} AnyValueConstructor
|
||||
*/
|
||||
|
||||
/** @template {AnyValue} T */
|
||||
export default class TypeInitialization {
|
||||
|
||||
/** @type {Constructor|Array<Constructor>} */
|
||||
/** @type {AnyValueConstructor<T>|AnyValueConstructor<T>[]} */
|
||||
#type
|
||||
get type() {
|
||||
return this.#type
|
||||
@@ -18,7 +32,7 @@ export default class TypeInitialization {
|
||||
this.#showDefault = v
|
||||
}
|
||||
|
||||
/** @type {T} */
|
||||
/** @type {T | T[] | String} */
|
||||
#value
|
||||
get value() {
|
||||
return this.#value
|
||||
@@ -54,10 +68,9 @@ export default class TypeInitialization {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {(new () => T) | StringConstructor | NumberConstructor | BooleanConstructor} Constructor
|
||||
* @param {Constructor|Array<Constructor>} type
|
||||
* @param {AnyValueConstructor<T>|AnyValueConstructor<T>[]} type
|
||||
* @param {Boolean} showDefault
|
||||
* @param {any} value
|
||||
* @param {T | T[] | String} value
|
||||
* @param {Boolean} serialized
|
||||
*/
|
||||
constructor(type, showDefault = true, value = undefined, serialized = false) {
|
||||
|
||||
@@ -7,4 +7,11 @@ export default class VectorEntity extends IEntity {
|
||||
Y: Number,
|
||||
Z: Number,
|
||||
}
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
/** @type {Number} */ this.X
|
||||
/** @type {Number} */ this.Y
|
||||
/** @type {Number} */ this.Z
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export default class IKeyboardShortcut extends IInput {
|
||||
return v
|
||||
}
|
||||
if (v.constructor === String) {
|
||||
// @ts-expect-error
|
||||
const parsed = ISerializer.grammar.KeyBinding.parse(v)
|
||||
if (parsed.status) {
|
||||
return parsed.value
|
||||
|
||||
@@ -31,13 +31,21 @@ export default class IMouseClickDrag extends IPointing {
|
||||
clickedPosition = [0, 0]
|
||||
mouseLocation = [0, 0]
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {T} target
|
||||
* @param {Blueprint} blueprint
|
||||
* @param {Object} options
|
||||
*/
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options.clickButton ??= 0
|
||||
options.consumeEvent ??= true
|
||||
options.exitAnyButton ??= true
|
||||
options.draggableElement ??= target
|
||||
options.exitAnyButton ??= true
|
||||
options.looseTarget ??= false
|
||||
options.moveEverywhere ??= false
|
||||
options.movementSpace ??= blueprint?.getGridDOMElement()
|
||||
options.repositionClickOffset ??= false
|
||||
super(target, blueprint, options)
|
||||
this.stepSize = parseInt(options?.stepSize ?? Configuration.gridSize)
|
||||
|
||||
@@ -151,7 +159,7 @@ export default class IMouseClickDrag extends IPointing {
|
||||
startDrag(location) {
|
||||
}
|
||||
|
||||
dragTo(location, movement) {
|
||||
dragTo(location, offset) {
|
||||
}
|
||||
|
||||
endDrag() {
|
||||
|
||||
@@ -10,6 +10,7 @@ import Utility from "../../Utility"
|
||||
export default class IPointing extends IInput {
|
||||
|
||||
constructor(target, blueprint, options) {
|
||||
options.ignoreTranslateCompensate ??= false
|
||||
options.movementSpace ??= blueprint?.getGridDOMElement() ?? document.documentElement
|
||||
super(target, blueprint, options)
|
||||
this.movementSpace = options.movementSpace
|
||||
@@ -21,6 +22,8 @@ export default class IPointing extends IInput {
|
||||
[mouseEvent.clientX, mouseEvent.clientY],
|
||||
this.movementSpace
|
||||
)
|
||||
return this.blueprint.compensateTranslation(location)
|
||||
return this.options.ignoreTranslateCompensate
|
||||
? location
|
||||
: this.blueprint.compensateTranslation(location)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,29 +3,45 @@ import Utility from "../../Utility"
|
||||
|
||||
/**
|
||||
* @typedef {import("../../Blueprint").default} Blueprint
|
||||
* @typedef {import("../../element/ISelectableDraggableElement").default} ISelectableDraggableElement
|
||||
* @typedef {import("../../element/IDraggableElement").default} IDraggableElement
|
||||
*/
|
||||
|
||||
/** @extends {IMouseClickDrag<ISelectableDraggableElement>} */
|
||||
/**
|
||||
* @template {IDraggableElement} T
|
||||
* @extends {IMouseClickDrag<T>}
|
||||
*/
|
||||
export default class MouseMoveDraggable extends IMouseClickDrag {
|
||||
|
||||
dragTo(location, movement) {
|
||||
const initialTargetLocation = [this.target.locationX, this.target.locationY]
|
||||
const [mouseLocation, targetLocation] = this.stepSize > 1
|
||||
? [Utility.snapToGrid(location, this.stepSize), Utility.snapToGrid(initialTargetLocation, this.stepSize)]
|
||||
: [location, initialTargetLocation]
|
||||
const d = [
|
||||
mouseLocation[0] - this.mouseLocation[0],
|
||||
mouseLocation[1] - this.mouseLocation[1]
|
||||
clicked(location) {
|
||||
if (this.options.repositionClickOffset) {
|
||||
this.target.setLocation(this.stepSize > 1
|
||||
? Utility.snapToGrid(location, this.stepSize)
|
||||
: location
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
dragTo(location, offset) {
|
||||
const targetLocation = [this.target.locationX, this.target.locationY]
|
||||
const [adjustedLocation, adjustedTargetLocation] = this.stepSize > 1
|
||||
? [Utility.snapToGrid(location, this.stepSize), Utility.snapToGrid(targetLocation, this.stepSize)]
|
||||
: [location, targetLocation]
|
||||
offset = [
|
||||
adjustedLocation[0] - this.mouseLocation[0],
|
||||
adjustedLocation[1] - this.mouseLocation[1]
|
||||
]
|
||||
if (d[0] == 0 && d[1] == 0) {
|
||||
if (offset[0] == 0 && offset[1] == 0) {
|
||||
return
|
||||
}
|
||||
// Make sure it snaps on the grid
|
||||
d[0] += targetLocation[0] - this.target.locationX
|
||||
d[1] += targetLocation[1] - this.target.locationY
|
||||
this.target.addLocation(d)
|
||||
offset[0] += adjustedTargetLocation[0] - this.target.locationX
|
||||
offset[1] += adjustedTargetLocation[1] - this.target.locationY
|
||||
this.dragAction(adjustedLocation, offset)
|
||||
// Reassign the position of mouse
|
||||
this.mouseLocation = mouseLocation
|
||||
this.mouseLocation = adjustedLocation
|
||||
}
|
||||
|
||||
dragAction(location, offset) {
|
||||
this.target.addLocation(offset)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import IMouseClickDrag from "./IMouseClickDrag"
|
||||
import MouseMoveDraggable from "./MouseMoveDraggable"
|
||||
import Utility from "../../Utility"
|
||||
|
||||
/**
|
||||
* @typedef {import("../../Blueprint").default} Blueprint
|
||||
* @typedef {import("../../element/ISelectableDraggableElement").default} ISelectableDraggableElement
|
||||
*/
|
||||
|
||||
/** @extends {IMouseClickDrag<ISelectableDraggableElement>} */
|
||||
/** @extends {MouseMoveDraggable<ISelectableDraggableElement>} */
|
||||
export default class MouseMoveNodes extends MouseMoveDraggable {
|
||||
|
||||
startDrag() {
|
||||
@@ -17,24 +15,8 @@ export default class MouseMoveNodes extends MouseMoveDraggable {
|
||||
}
|
||||
}
|
||||
|
||||
dragTo(location, movement) {
|
||||
const initialTargetLocation = [this.target.locationX, this.target.locationY]
|
||||
const [mouseLocation, targetLocation] = this.stepSize > 1
|
||||
? [Utility.snapToGrid(location, this.stepSize), Utility.snapToGrid(initialTargetLocation, this.stepSize)]
|
||||
: [location, initialTargetLocation]
|
||||
const d = [
|
||||
mouseLocation[0] - this.mouseLocation[0],
|
||||
mouseLocation[1] - this.mouseLocation[1]
|
||||
]
|
||||
if (d[0] == 0 && d[1] == 0) {
|
||||
return
|
||||
}
|
||||
// Make sure it snaps on the grid
|
||||
d[0] += targetLocation[0] - this.target.locationX
|
||||
d[1] += targetLocation[1] - this.target.locationY
|
||||
this.target.dispatchDragEvent(d)
|
||||
// Reassign the position of mouse
|
||||
this.mouseLocation = mouseLocation
|
||||
dragAction(location, offset) {
|
||||
this.target.dispatchDragEvent(offset)
|
||||
}
|
||||
|
||||
unclicked() {
|
||||
|
||||
@@ -9,17 +9,13 @@ export default class MouseOpenWindow extends IMouseClick {
|
||||
|
||||
#window
|
||||
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options.windowType ??= "window"
|
||||
super(target, blueprint, options)
|
||||
}
|
||||
|
||||
clicked(location) {
|
||||
}
|
||||
|
||||
unclicked(location) {
|
||||
this.#window = new WindowElement({
|
||||
type: this.options.windowType
|
||||
type: this.options.windowType,
|
||||
windowOptions: this.options.windowOptions,
|
||||
})
|
||||
this.blueprint.append(this.#window)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import OrderedIndexArray from "./OrderedIndexArray"
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* primaryInf: Number,
|
||||
* primarySup: Number,
|
||||
* secondaryInf: Number,
|
||||
* secondarySup: Number
|
||||
* }} BoundariesInfo
|
||||
* @typedef {import("../Blueprint").BoundariesInfo} BoundariesInfo
|
||||
* @typedef {{
|
||||
* primaryBoundary: Number,
|
||||
* secondaryBoundary: Number,
|
||||
@@ -19,15 +14,15 @@ import OrderedIndexArray from "./OrderedIndexArray"
|
||||
export default class FastSelectionModel {
|
||||
|
||||
/**
|
||||
* @param {Number[]} initialPosition Coordinates of the starting point of selection [primaryAxisValue, secondaryAxisValue].
|
||||
* @param {Rectangle[]} rectangles Rectangles that can be selected by this object.
|
||||
* @param {(rect: Rectangle) => BoundariesInfo} boundariesFunc A function that, given a rectangle, it provides the boundaries of such rectangle.
|
||||
* @param {(rect: Rectangle, selected: Boolean) => void} selectFunc A function that selects or deselects individual rectangles.
|
||||
* @param {Number[]} initialPosition
|
||||
* @param {Rectangle[]} rectangles
|
||||
* @param {(rect: Rectangle) => BoundariesInfo} boundariesFunc
|
||||
* @param {(rect: Rectangle, selected: Boolean) => void} selectFunc
|
||||
*/
|
||||
constructor(initialPosition, rectangles, boundariesFunc, selectFunc) {
|
||||
this.initialPosition = initialPosition
|
||||
this.finalPosition = initialPosition
|
||||
/** @type Metadata[] */
|
||||
/** @type {Metadata[]} */
|
||||
this.metadata = new Array(rectangles.length)
|
||||
this.primaryOrder = new OrderedIndexArray((element) => this.metadata[element].primaryBoundary)
|
||||
this.secondaryOrder = new OrderedIndexArray((element) => this.metadata[element].secondaryBoundary)
|
||||
@@ -36,7 +31,7 @@ export default class FastSelectionModel {
|
||||
this.primaryOrder.reserve(this.rectangles.length)
|
||||
this.secondaryOrder.reserve(this.rectangles.length)
|
||||
rectangles.forEach((rect, index) => {
|
||||
/** @type Metadata */
|
||||
/** @type {Metadata} */
|
||||
let rectangleMetadata = {
|
||||
primaryBoundary: this.initialPosition[0],
|
||||
secondaryBoundary: this.initialPosition[1],
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
export default class OrderedIndexArray {
|
||||
|
||||
/**
|
||||
* @param {(arrayElement: number) => number} compareFunction A function that, given acouple of elements of the array telles what order are they on.
|
||||
* @param {(number|array)} value Initial length or array to copy from
|
||||
* @param {(arrayElement: number) => number} comparisonValueSupplier
|
||||
* @param {number} value
|
||||
*/
|
||||
constructor(comparisonValueSupplier = (a) => a, value = null) {
|
||||
constructor(comparisonValueSupplier = v => v, value = null) {
|
||||
this.array = new Uint32Array(value)
|
||||
this.comparisonValueSupplier = comparisonValueSupplier
|
||||
this.length = 0
|
||||
this.currentPosition = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} index The index of the value to return
|
||||
* @returns The element of the array
|
||||
*/
|
||||
/** @param {number} index */
|
||||
get(index) {
|
||||
if (index >= 0 && index < this.length) {
|
||||
return this.array[index]
|
||||
@@ -22,19 +19,11 @@ export default class OrderedIndexArray {
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array used by this object.
|
||||
* @returns The array.
|
||||
*/
|
||||
getArray() {
|
||||
return this.array
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position that the value supplied should (or does) occupy in the aray.
|
||||
* @param {number} value The value to look for (it doesn't have to be part of the array).
|
||||
* @returns The position index.
|
||||
*/
|
||||
/** @param {number} value */
|
||||
getPosition(value) {
|
||||
let l = 0
|
||||
let r = this.length
|
||||
@@ -57,11 +46,7 @@ export default class OrderedIndexArray {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the element in the array.
|
||||
* @param element {number} The value to insert into the array.
|
||||
* @returns {number} The position into occupied by value into the array.
|
||||
*/
|
||||
/** @param {number} element */
|
||||
insert(element, comparisonValue = null) {
|
||||
let position = this.getPosition(this.comparisonValueSupplier(element))
|
||||
if (
|
||||
@@ -75,10 +60,7 @@ export default class OrderedIndexArray {
|
||||
return position
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the element from the array.
|
||||
* @param {number} value The value of the element to be remove.
|
||||
*/
|
||||
/** @param {number} element */
|
||||
remove(element) {
|
||||
let position = this.getPosition(this.comparisonValueSupplier(element))
|
||||
if (this.array[position] == element) {
|
||||
@@ -86,10 +68,7 @@ export default class OrderedIndexArray {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the element into the specified position from the array.
|
||||
* @param {number} position The index of the element to be remove.
|
||||
*/
|
||||
/** @param {number} position */
|
||||
removeAt(position) {
|
||||
if (position < this.currentPosition) {
|
||||
--this.currentPosition
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
import GeneralSerializer from "./GeneralSerializer"
|
||||
|
||||
/** @typedef {import("../entity/IEntity").default} IEntity */
|
||||
/**
|
||||
* @typedef {import("../entity/IEntity").default} IEntity
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValue} AnyValue
|
||||
*/
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValueConstructor<T>} AnyValueConstructor
|
||||
*/
|
||||
|
||||
/** @template {IEntity | Boolean | Number | String} T */
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @extends {GeneralSerializer<T>}
|
||||
*/
|
||||
export default class CustomSerializer extends GeneralSerializer {
|
||||
|
||||
#objectWriter
|
||||
|
||||
/**
|
||||
* @param {(v: T, insideString: Boolean) => String} objectWriter
|
||||
* @param {new () => T} entityType
|
||||
* @param {AnyValueConstructor<T>} entityType
|
||||
*/
|
||||
constructor(objectWriter, entityType) {
|
||||
super(undefined, entityType)
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
import Grammar from "./Grammar"
|
||||
import ISerializer from "./ISerializer"
|
||||
|
||||
/** @typedef {import("../entity/IEntity").default} IEntity */
|
||||
/**
|
||||
* @typedef {import("../entity/IEntity").default} IEntity
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValue} AnyValue
|
||||
*/
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValueConstructor<T>} AnyValueConstructor
|
||||
*/
|
||||
|
||||
/** @template {IEntity} T */
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @extends ISerializer<T>
|
||||
*/
|
||||
export default class GeneralSerializer extends ISerializer {
|
||||
|
||||
/** @param {new () => T} entityType */
|
||||
/** @param {AnyValueConstructor<T>} entityType */
|
||||
constructor(wrap, entityType, prefix, separator, trailingSeparator, attributeValueConjunctionSign, attributeKeyPrinter) {
|
||||
wrap = wrap ?? (v => `(${v})`)
|
||||
super(entityType, prefix, separator, trailingSeparator, attributeValueConjunctionSign, attributeKeyPrinter)
|
||||
@@ -18,6 +28,7 @@ export default class GeneralSerializer extends ISerializer {
|
||||
* @returns {T}
|
||||
*/
|
||||
read(value) {
|
||||
// @ts-expect-error
|
||||
let grammar = Grammar.getGrammarForType(ISerializer.grammar, this.entityType)
|
||||
const parseResult = grammar.parse(value)
|
||||
if (!parseResult.status) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
import FunctionReferenceEntity from "../entity/FunctionReferenceEntity"
|
||||
import GuidEntity from "../entity/GuidEntity"
|
||||
import IdentifierEntity from "../entity/IdentifierEntity"
|
||||
@@ -20,6 +21,14 @@ import Utility from "../Utility"
|
||||
import VectorEntity from "../entity/VectorEntity"
|
||||
|
||||
/** @typedef {import("../entity/IEntity").default} IEntity */
|
||||
/**
|
||||
* @template {IEntity} T
|
||||
* @typedef {import("../entity/IEntity").IEntityConstructor<T>} IEntityConstructor
|
||||
*/
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValueConstructor<T>} AnyValueConstructor
|
||||
*/
|
||||
|
||||
let P = Parsimmon
|
||||
|
||||
@@ -27,7 +36,14 @@ export default class Grammar {
|
||||
|
||||
/* --- Factory --- */
|
||||
|
||||
static getGrammarForType(r, attributeType, defaultGrammar) {
|
||||
/**
|
||||
* @template T, U
|
||||
* @param {Grammar} r
|
||||
* @param {AnyValueConstructor<T>} attributeType
|
||||
* @param {Parsimmon<U>} defaultGrammar
|
||||
* @returns
|
||||
*/
|
||||
static getGrammarForType(r, attributeType, defaultGrammar = r.AttributeAnyValue) {
|
||||
if (attributeType instanceof TypeInitialization) {
|
||||
let result = Grammar.getGrammarForType(r, attributeType.type, defaultGrammar)
|
||||
if (attributeType.serialized && !(attributeType.type instanceof String)) {
|
||||
@@ -91,6 +107,12 @@ export default class Grammar {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Grammar} r
|
||||
* @param {IEntityConstructor<IEntity>} entityType
|
||||
* @param {Parsimmon.Parser<String>} valueSeparator
|
||||
* @returns
|
||||
*/
|
||||
static createPropertyGrammar = (r, entityType, valueSeparator = P.string("=").trim(P.optWhitespace)) =>
|
||||
r.AttributeName.skip(valueSeparator)
|
||||
.chain(attributeName => {
|
||||
@@ -104,6 +126,11 @@ export default class Grammar {
|
||||
)
|
||||
})
|
||||
|
||||
/**
|
||||
* @param {Grammar} r
|
||||
* @param {IEntityConstructor<IEntity>} entityType
|
||||
* @returns
|
||||
*/
|
||||
static createEntityGrammar = (r, entityType) =>
|
||||
P.seqMap(
|
||||
entityType.lookbehind
|
||||
@@ -123,14 +150,19 @@ export default class Grammar {
|
||||
|
||||
/* --- General --- */
|
||||
|
||||
/** @param {Grammar} r */
|
||||
InlineWhitespace = r => P.regex(/[^\S\n]+/).desc("inline whitespace")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
InlineOptWhitespace = r => P.regex(/[^\S\n]*/).desc("inline optional whitespace")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
MultilineWhitespace = r => P.regex(/[^\S\n]*\n\s*/).desc("whitespace with at least a newline")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Null = r => P.seq(P.string("("), r.InlineOptWhitespace, P.string(")")).map(_ => null).desc("null: ()")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Boolean = r => P.alt(
|
||||
P.string("True"),
|
||||
P.string("true"),
|
||||
@@ -139,19 +171,26 @@ export default class Grammar {
|
||||
).map(v => v.toLocaleLowerCase() === "true" ? true : false)
|
||||
.desc("either True or False")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
HexDigit = r => P.regex(/[0-9a-fA-f]/).desc("hexadecimal digit")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Number = r => P.regex(/[\-\+]?[0-9]+(?:\.[0-9]+)?/).map(Number).desc("a number")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
NaturalNumber = r => P.regex(/0|[1-9]\d*/).map(Number).desc("a natural number")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
ColorNumber = r => r.NaturalNumber.assert(n => 0 <= n && n < 256, "the color must be between 0 and 256 excluded")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Word = r => P.regex(/[a-zA-Z]+/).desc("a word")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
String = r => P.regex(/(?:[^"\\]|\\.)*/).wrap(P.string('"'), P.string('"')).map(Utility.unescapeString)
|
||||
.desc('string (with possibility to escape the quote using \")')
|
||||
|
||||
/** @param {Grammar} r */
|
||||
ReferencePath = r => P.seq(
|
||||
P.string("/"),
|
||||
r.PathSymbol
|
||||
@@ -164,20 +203,27 @@ export default class Grammar {
|
||||
.tie()
|
||||
.desc('a path (words with possibly underscore, separated by ".", separated by "/")')
|
||||
|
||||
/** @param {Grammar} r */
|
||||
AttributeName = r => r.Word.sepBy1(P.string(".")).tieWith(".").desc('words separated by ""')
|
||||
|
||||
/* --- Entity --- */
|
||||
|
||||
/** @param {Grammar} r */
|
||||
None = r => P.string("None").map(_ => new ObjectReferenceEntity({ type: "None", path: "" })).desc("none")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Integer = r => P.regex(/[\-\+]?[0-9]+/).map(v => new IntegerEntity(v)).desc("an integer")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Guid = r => r.HexDigit.times(32).tie().map(v => new GuidEntity({ value: v })).desc("32 digit hexadecimal value")
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Identifier = r => P.regex(/\w+/).map(v => new IdentifierEntity(v))
|
||||
|
||||
/** @param {Grammar} r */
|
||||
PathSymbol = r => P.regex(/[0-9\w]+/).map(v => new PathSymbolEntity({ value: v }))
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Reference = r => P.alt(
|
||||
r.None,
|
||||
...[r.ReferencePath.map(path => new ObjectReferenceEntity({ type: "", path: path }))]
|
||||
@@ -197,6 +243,7 @@ export default class Grammar {
|
||||
r.Word.map(type => new ObjectReferenceEntity({ type: type, path: "" })),
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
LocalizedText = r => P.seqMap(
|
||||
P.string(LocalizedTextEntity.lookbehind).skip(P.optWhitespace).skip(P.string("(")), // Goes into _0 (ignored)
|
||||
r.String.trim(P.optWhitespace), // Goes into namespace
|
||||
@@ -212,12 +259,14 @@ export default class Grammar {
|
||||
})
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
InvariantText = r => r.String.trim(P.optWhitespace).wrap(
|
||||
P.string(InvariantTextEntity.lookbehind).skip(P.optWhitespace).skip(P.string("(")),
|
||||
P.string(")")
|
||||
)
|
||||
.map(value => new InvariantTextEntity({ value: value }))
|
||||
|
||||
/** @param {Grammar} r */
|
||||
AttributeAnyValue = r => P.alt(
|
||||
r.Null,
|
||||
r.None,
|
||||
@@ -233,6 +282,7 @@ export default class Grammar {
|
||||
r.LinearColor,
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
PinReference = r => P.seqMap(
|
||||
r.PathSymbol, // Goes into objectNAme
|
||||
P.whitespace, // Goes into _ (ignored)
|
||||
@@ -243,10 +293,13 @@ export default class Grammar {
|
||||
})
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Vector = r => Grammar.createEntityGrammar(r, VectorEntity)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Rotator = r => Grammar.createEntityGrammar(r, RotatorEntity)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
SimpleSerializationRotator = r => P.seqMap(
|
||||
r.Number,
|
||||
P.string(",").trim(P.optWhitespace),
|
||||
@@ -260,6 +313,7 @@ export default class Grammar {
|
||||
})
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
SimpleSerializationVector = r => P.seqMap(
|
||||
r.Number,
|
||||
P.string(",").trim(P.optWhitespace),
|
||||
@@ -273,10 +327,13 @@ export default class Grammar {
|
||||
})
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
LinearColor = r => Grammar.createEntityGrammar(r, LinearColorEntity)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
FunctionReference = r => Grammar.createEntityGrammar(r, FunctionReferenceEntity)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
KeyBinding = r => P.alt(
|
||||
r.Identifier.map(identifier => new KeyBindingEntity({
|
||||
Key: identifier
|
||||
@@ -284,8 +341,10 @@ export default class Grammar {
|
||||
Grammar.createEntityGrammar(r, KeyBindingEntity)
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
Pin = r => Grammar.createEntityGrammar(r, PinEntity)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
CustomProperties = r =>
|
||||
P.string("CustomProperties")
|
||||
.then(P.whitespace)
|
||||
@@ -297,7 +356,7 @@ export default class Grammar {
|
||||
Utility.objectSet(entity, ["CustomProperties"], properties, true)
|
||||
})
|
||||
|
||||
/** @returns {Parsimmon.Parser<ObjectEntity>} */
|
||||
/** @param {Grammar} r */
|
||||
Object = r => P.seqMap(
|
||||
P.seq(P.string("Begin"), P.whitespace, P.string("Object"), P.whitespace),
|
||||
P
|
||||
@@ -319,6 +378,7 @@ export default class Grammar {
|
||||
|
||||
/* --- Others --- */
|
||||
|
||||
/** @param {Grammar} r */
|
||||
LinearColorFromHex = r => P
|
||||
.string("#")
|
||||
.then(r.HexDigit.times(2).tie().times(3, 4))
|
||||
@@ -330,6 +390,7 @@ export default class Grammar {
|
||||
A: A ? parseInt(A, 16) / 255 : 1,
|
||||
}))
|
||||
|
||||
/** @param {Grammar} r */
|
||||
LinearColorFromRGBList = r => P.seqMap(
|
||||
r.ColorNumber,
|
||||
P.string(",").skip(P.optWhitespace),
|
||||
@@ -344,6 +405,7 @@ export default class Grammar {
|
||||
})
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
LinearColorFromRGB = r => P.string("rgb").then(
|
||||
r.LinearColorFromRGBList.wrap(
|
||||
P.regex(/\(\s*/),
|
||||
@@ -351,6 +413,7 @@ export default class Grammar {
|
||||
)
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
LinearColorFromRGBA = r => P.string("rgba").then(
|
||||
P.seqMap(
|
||||
r.ColorNumber,
|
||||
@@ -372,6 +435,7 @@ export default class Grammar {
|
||||
)
|
||||
)
|
||||
|
||||
/** @param {Grammar} r */
|
||||
LinearColorFromAnyColor = r => P.alt(
|
||||
r.LinearColorFromRGBList,
|
||||
r.LinearColorFromHex,
|
||||
|
||||
@@ -1,22 +1,38 @@
|
||||
import Grammar from "./Grammar"
|
||||
import IEntity from "../entity/IEntity"
|
||||
import Parsimmon from "parsimmon"
|
||||
import SerializerFactory from "./SerializerFactory"
|
||||
import TypeInitialization from "../entity/TypeInitialization"
|
||||
import Utility from "../Utility"
|
||||
|
||||
/** @template {IEntity} T */
|
||||
/**
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValue} AnyValue
|
||||
*/
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValueConstructor<T>} AnyValueConstructor
|
||||
*/
|
||||
|
||||
/** @template {AnyValue} T */
|
||||
export default class ISerializer {
|
||||
|
||||
// @ts-expect-error
|
||||
static grammar = Parsimmon.createLanguage(new Grammar())
|
||||
|
||||
constructor(entityType, prefix, separator, trailingSeparator, attributeValueConjunctionSign, attributeKeyPrinter) {
|
||||
/** @param {AnyValueConstructor<T>} entityType */
|
||||
constructor(
|
||||
entityType,
|
||||
prefix = "",
|
||||
separator = ",",
|
||||
trailingSeparator = false,
|
||||
attributeValueConjunctionSign = "=",
|
||||
attributeKeyPrinter = k => k.join(".")
|
||||
) {
|
||||
this.entityType = entityType
|
||||
this.prefix = prefix ?? ""
|
||||
this.separator = separator ?? ","
|
||||
this.trailingSeparator = trailingSeparator ?? false
|
||||
this.attributeValueConjunctionSign = attributeValueConjunctionSign ?? "="
|
||||
this.attributeKeyPrinter = attributeKeyPrinter ?? (k => k.join("."))
|
||||
this.prefix = prefix
|
||||
this.separator = separator
|
||||
this.trailingSeparator = trailingSeparator
|
||||
this.attributeValueConjunctionSign = attributeValueConjunctionSign
|
||||
this.attributeKeyPrinter = attributeKeyPrinter
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,12 +43,8 @@ export default class ISerializer {
|
||||
return this.read(value)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {T} object
|
||||
* @param {Boolean} insideString
|
||||
* @returns {String}
|
||||
*/
|
||||
serialize(object, insideString, entity = object) {
|
||||
/** @param {T} object */
|
||||
serialize(object, insideString = false, entity = object) {
|
||||
return this.write(entity, object, insideString)
|
||||
}
|
||||
|
||||
@@ -54,6 +66,7 @@ export default class ISerializer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {AnyValue} value
|
||||
* @param {String[]} fullKey
|
||||
* @param {Boolean} insideString
|
||||
*/
|
||||
@@ -103,6 +116,7 @@ export default class ISerializer {
|
||||
}
|
||||
|
||||
showProperty(entity, object, attributeKey, attributeValue) {
|
||||
// @ts-expect-error
|
||||
const attributes = this.entityType.attributes
|
||||
const attribute = Utility.objectGet(attributes, attributeKey)
|
||||
if (attribute instanceof TypeInitialization) {
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import Utility from "../Utility"
|
||||
|
||||
/** @typedef {import("../entity/IEntity").default} IEntity */
|
||||
|
||||
/**
|
||||
* @template {IEntity} T
|
||||
* @typedef {import("../entity/IEntity").default} IEntity
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValue} AnyValue
|
||||
*/
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValueConstructor<T>} AnyValueConstructor
|
||||
*/
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @typedef {import("./ISerializer").default<T>} ISerializer
|
||||
*/
|
||||
|
||||
export default class SerializerFactory {
|
||||
|
||||
/** @type {Map<T, ISerializer<T>>} */
|
||||
/** @type {Map<AnyValueConstructor<AnyValue>, ISerializer<AnyValue>>} */
|
||||
static #serializers = new Map()
|
||||
|
||||
static registerSerializer(entity, object) {
|
||||
@@ -16,8 +21,8 @@ export default class SerializerFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {IEntity} T
|
||||
* @param {T} entity
|
||||
* @template {AnyValue} T
|
||||
* @param {AnyValueConstructor<T>} entity
|
||||
*/
|
||||
static getSerializer(entity) {
|
||||
return SerializerFactory.#serializers.get(entity)
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
import Utility from "../Utility"
|
||||
import GeneralSerializer from "./GeneralSerializer"
|
||||
|
||||
/** @typedef {import("../entity/IEntity").default} IEntity */
|
||||
|
||||
/** @template {IEntity} T */
|
||||
/** @typedef {import("../entity/TypeInitialization").AnyValue} AnyValue */
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @typedef {import("../entity/TypeInitialization").AnyValueConstructor<T>} AnyValueConstructor
|
||||
*/
|
||||
/**
|
||||
* @template {AnyValue} T
|
||||
* @extends {GeneralSerializer<T>}
|
||||
*/
|
||||
export default class ToStringSerializer extends GeneralSerializer {
|
||||
|
||||
/** @param {new () => T} entityType */
|
||||
/** @param {AnyValueConstructor<T>} entityType */
|
||||
constructor(entityType) {
|
||||
super(undefined, entityType)
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ import ObjectSerializer from "./ObjectSerializer"
|
||||
import PathSymbolEntity from "../entity/PathSymbolEntity"
|
||||
import PinEntity from "../entity/PinEntity"
|
||||
import PinReferenceEntity from "../entity/PinReferenceEntity"
|
||||
import RotatorEntity from "../entity/RotatorEntity"
|
||||
import SerializerFactory from "./SerializerFactory"
|
||||
import SimpleSerializationRotatorEntity from "../entity/SimpleSerializationRotatorEntity"
|
||||
import SimpleSerializationVectorEntity from "../entity/SimpleSerializationVectorEntity"
|
||||
import ToStringSerializer from "./ToStringSerializer"
|
||||
import Utility from "../Utility"
|
||||
import VectorEntity from "../entity/VectorEntity"
|
||||
import RotatorEntity from "../entity/RotatorEntity"
|
||||
import SimpleSerializationRotatorEntity from "../entity/SimpleSerializationRotatorEntity"
|
||||
|
||||
export default function initializeSerializerFactory() {
|
||||
|
||||
@@ -143,7 +143,9 @@ export default function initializeSerializerFactory() {
|
||||
String,
|
||||
new CustomSerializer(
|
||||
(value, insideString) => insideString
|
||||
// @ts-expect-error
|
||||
? Utility.escapeString(value)
|
||||
// @ts-expect-error
|
||||
: `"${Utility.escapeString(value)}"`,
|
||||
String
|
||||
)
|
||||
|
||||
25
js/template/ColorHandlerTemplate.js
Executable file
25
js/template/ColorHandlerTemplate.js
Executable file
@@ -0,0 +1,25 @@
|
||||
import IDraggableTemplate from "./IDraggableTemplate"
|
||||
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable"
|
||||
|
||||
/** @typedef {import("../element/ColorHandlerElement").default} ColorHandlerElement */
|
||||
|
||||
/** @extends {IDraggableTemplate<ColorHandlerElement>} */
|
||||
export default class ColorHandlerTemplate extends IDraggableTemplate {
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
this.window = this.element.closest("ueb-window")
|
||||
}
|
||||
|
||||
createDraggableObject() {
|
||||
new MouseMoveDraggable(this.element, this.element.blueprint, {
|
||||
draggableElement: this.element.parentElement,
|
||||
ignoreTranslateCompensate: true,
|
||||
looseTarget: true,
|
||||
moveEverywhere: true,
|
||||
movementSpace: this.element.parentElement,
|
||||
repositionClickOffset: true,
|
||||
stepSize: 1,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { html } from "lit"
|
||||
import Configuration from "../Configuration"
|
||||
import LinearColorEntity from "../entity/LinearColorEntity"
|
||||
import WindowTemplate from "./WindowTemplate"
|
||||
|
||||
/** @typedef {import("../element/WindowElement").default} WindowElement */
|
||||
@@ -7,31 +9,47 @@ export default class ColorPickerWindowTemplate extends WindowTemplate {
|
||||
|
||||
static windowName = html`Color Picker`
|
||||
|
||||
#picker
|
||||
/** @type {LinearColorEntity} */
|
||||
#color
|
||||
get color() {
|
||||
return this.#color
|
||||
}
|
||||
/** @param {LinearColorEntity} value */
|
||||
set color(value) {
|
||||
if (value.num() == this.color.num()) {
|
||||
this.element.requestUpdate("color", this.#color)
|
||||
this.#color = value
|
||||
}
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
this.color = this.element.windowOptions.getPinColor()
|
||||
}
|
||||
|
||||
/** @param {Map} changedProperties */
|
||||
firstUpdated(changedProperties) {
|
||||
this.#picker = new iro.ColorPicker(
|
||||
this.element.querySelector(".ueb-color-picker"),
|
||||
{
|
||||
layout: [
|
||||
|
||||
]
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
renderContent() {
|
||||
const rgba = this.color.rgba()
|
||||
return html`
|
||||
<div class="ueb-color-picker">
|
||||
<div class="ueb-color-picker-theme"></div>
|
||||
<div class="ueb-color-picker-srgb"></div>
|
||||
<div class="ueb-color-picker-wheel"></div>
|
||||
<div class="ueb-color-picker-saturation"></div>
|
||||
<div class="ueb-color-picker-value"></div>
|
||||
<div class="ueb-color-picker-preview">
|
||||
<div class="ueb-color-picker-preview-old"></div>
|
||||
<div class="ueb-color-picker-preview-new"></div>
|
||||
<div class="ueb-color-picker"
|
||||
.style="--ueb-color-r: ${rgba[0]}; --ueb-color-g: ${rgba[1]}; --ueb-color-b: ${rgba[2]}; --ueb-color-a: ${rgba[3]};">
|
||||
<div class="ueb-color-picker-toolbar">
|
||||
<div class="ueb-color-picker-theme"></div>
|
||||
<div class="ueb-color-picker-srgb"></div>
|
||||
</div>
|
||||
<div class="ueb-color-picker-main">
|
||||
<div class="ueb-color-picker-wheel">
|
||||
<ueb-color-handler></ueb-color-handler>
|
||||
</div>
|
||||
<div class="ueb-color-picker-saturation"></div>
|
||||
<div class="ueb-color-picker-value"></div>
|
||||
<div class="ueb-color-picker-preview">
|
||||
<div class="ueb-color-picker-preview-old"></div>
|
||||
<div class="ueb-color-picker-preview-new"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ueb-color-picker-advanced-toggle"></div>
|
||||
<div class="ueb-color-picker-advanced">
|
||||
@@ -50,4 +68,8 @@ export default class ColorPickerWindowTemplate extends WindowTemplate {
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
this.element.blueprint.removeEventListener(Configuration.colorWindowEventName, this.colorWindowHandler)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import ITemplate from "./ITemplate"
|
||||
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable"
|
||||
|
||||
/** @typedef {import("../element/IDraggableElement").default} IDraggableElement */
|
||||
/**
|
||||
* @typedef {import("../entity/IEntity").default} IEntity
|
||||
* @typedef {import("../element/IDraggableElement").default} IDraggableElement
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {ISelectableDraggableElement} T
|
||||
* @template {IDraggableElement} T
|
||||
* @extends {ITemplate<T>}
|
||||
*/
|
||||
export default class IDraggableTemplate extends ITemplate {
|
||||
@@ -27,9 +30,7 @@ export default class IDraggableTemplate extends ITemplate {
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Map} changedProperties
|
||||
*/
|
||||
/** @param {Map} changedProperties */
|
||||
update(changedProperties) {
|
||||
super.update(changedProperties)
|
||||
if (changedProperties.has("locationX")) {
|
||||
|
||||
@@ -2,8 +2,15 @@ import { html } from "lit"
|
||||
import MouseIgnore from "../input/mouse/MouseIgnore"
|
||||
import PinTemplate from "./PinTemplate"
|
||||
|
||||
/** @typedef {import("../element/PinElement").default} PinElement */
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("../element/PinElement").default<T>} PinElement
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @extends PinTemplate<T>
|
||||
*/
|
||||
export default class IInputPinTemplate extends PinTemplate {
|
||||
|
||||
/** @type {HTMLElement[]} */
|
||||
@@ -12,24 +19,24 @@ export default class IInputPinTemplate extends PinTemplate {
|
||||
return this.#inputContentElements
|
||||
}
|
||||
|
||||
/** @param {String} value */
|
||||
static stringFromInputToUE(value) {
|
||||
return value
|
||||
.replace(/(?=\n\s*)\n$/, "") // Remove trailing double newline
|
||||
.replaceAll("\n", "\\r\n") // Replace newline with \r\n (default newline in UE)
|
||||
}
|
||||
|
||||
/** @param {String} value */
|
||||
static stringFromUEToInput(value) {
|
||||
return value
|
||||
.replaceAll(/(?:\r|(?<=(?:^|[^\\])(?:\\\\)*)\\r)(?=\n)/g, "") // Remove \r leftover from \r\n
|
||||
.replace(/(?<=\n\s*)$/, "\n") // Put back trailing double newline
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Map} changedProperties
|
||||
*/
|
||||
/** @param {Map} changedProperties */
|
||||
firstUpdated(changedProperties) {
|
||||
super.firstUpdated(changedProperties)
|
||||
this.#inputContentElements = [...this.element.querySelectorAll(".ueb-pin-input-content")]
|
||||
this.#inputContentElements = /** @type {HTMLElement[]} */([...this.element.querySelectorAll(".ueb-pin-input-content")])
|
||||
if (this.#inputContentElements.length) {
|
||||
this.setInputs(this.getInputs(), false)
|
||||
let self = this
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { html } from "lit"
|
||||
import MouseOpenWindow from "../input/mouse/MouseOpenWindow"
|
||||
import ColorPickerWindowTemplate from "./ColorPickerWindowTemplate"
|
||||
import IInputPinTemplate from "./IInputPinTemplate"
|
||||
import MouseOpenWindow from "../input/mouse/MouseOpenWindow"
|
||||
|
||||
/**
|
||||
* @typedef {import("../element/PinElement").default} PinElement
|
||||
@@ -24,7 +25,14 @@ export default class LinearColorPinTemplate extends IInputPinTemplate {
|
||||
...super.createInputObjects(),
|
||||
new MouseOpenWindow(this.#input, this.element.blueprint, {
|
||||
moveEverywhere: true,
|
||||
looseTarget: true
|
||||
looseTarget: true,
|
||||
windowType: ColorPickerWindowTemplate,
|
||||
windowOptions: {
|
||||
// The created window will use the following functions to get and set the color
|
||||
getPinColor: () => this.element.defaultValue,
|
||||
/** @param {LinearColorEntity} color */
|
||||
setPinColor: color => this.element.setDefaultValue(color),
|
||||
},
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class NodeTemplate extends SelectableDraggableTemplate {
|
||||
fill="currentColor" />
|
||||
</svg>
|
||||
</span>
|
||||
<span class="ueb-node-name-text">
|
||||
<span class="ueb-node-name-text ueb-ellipsis-nowrap-text">
|
||||
${this.element.nodeDisplayName}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
import { css, html } from "lit"
|
||||
import { html } from "lit"
|
||||
import ITemplate from "./ITemplate"
|
||||
import MouseCreateLink from "../input/mouse/MouseCreateLink"
|
||||
import Utility from "../Utility"
|
||||
|
||||
/**
|
||||
* @typedef {import("../element/NodeElement").default} NodeElement
|
||||
* @typedef {import("../element/PinElement").default} PinElement
|
||||
* @typedef {import("../input/IInput").default} IInput
|
||||
*/
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("../element/PinElement").default<T>} PinElement
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @extends ITemplate<PinElement<T>>
|
||||
*/
|
||||
export default class PinTemplate extends ITemplate {
|
||||
|
||||
static styles = css``
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
this.element.nodeElement = this.element.closest("ueb-node")
|
||||
@@ -23,7 +28,7 @@ export default class PinTemplate extends ITemplate {
|
||||
return [
|
||||
new MouseCreateLink(this.element.clickableElement, this.element.blueprint, {
|
||||
moveEverywhere: true,
|
||||
looseTarget: true
|
||||
looseTarget: true,
|
||||
})
|
||||
]
|
||||
}
|
||||
@@ -36,7 +41,7 @@ export default class PinTemplate extends ITemplate {
|
||||
`
|
||||
const content = html`
|
||||
<div class="ueb-pin-content">
|
||||
<span class="ueb-pin-name">${this.element.getPinDisplayName()}</span>
|
||||
<span class="ueb-pin-name ">${this.element.getPinDisplayName()}</span>
|
||||
${this.renderInput()}
|
||||
</div>
|
||||
`
|
||||
@@ -47,8 +52,7 @@ export default class PinTemplate extends ITemplate {
|
||||
`
|
||||
}
|
||||
|
||||
/** @param {PinElement} pin */
|
||||
renderIcon(pin) {
|
||||
renderIcon() {
|
||||
return html`
|
||||
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle class="ueb-pin-tofill" cx="16" cy="16" r="14" fill="none" stroke="currentColor" stroke-width="5" />
|
||||
@@ -57,8 +61,7 @@ export default class PinTemplate extends ITemplate {
|
||||
`
|
||||
}
|
||||
|
||||
/** @param {PinElement} pin */
|
||||
renderInput(pin) {
|
||||
renderInput() {
|
||||
return html``
|
||||
}
|
||||
|
||||
@@ -69,13 +72,12 @@ export default class PinTemplate extends ITemplate {
|
||||
this.element.clickableElement = this.element
|
||||
}
|
||||
|
||||
/** @param {PinElement} pin */
|
||||
getLinkLocation(pin) {
|
||||
const rect = pin.querySelector(".ueb-pin-icon").getBoundingClientRect()
|
||||
getLinkLocation() {
|
||||
const rect = this.element.querySelector(".ueb-pin-icon").getBoundingClientRect()
|
||||
const location = Utility.convertLocation(
|
||||
[(rect.left + rect.right) / 2, (rect.top + rect.bottom) / 2],
|
||||
pin.blueprint.gridElement
|
||||
this.element.blueprint.gridElement
|
||||
)
|
||||
return pin.blueprint.compensateTranslation(location)
|
||||
return this.element.blueprint.compensateTranslation(location)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,28 @@ import { html } from "lit"
|
||||
import IInputPinTemplate from "./IInputPinTemplate"
|
||||
import Utility from "../Utility"
|
||||
|
||||
/**
|
||||
* @typedef {import("../entity/VectorEntity").default} VectorEntity
|
||||
*/
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("../element/PinElement").default<T>} PinElement
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {Number} T
|
||||
* @extends IInputPinTemplate<T>
|
||||
*/
|
||||
export default class RealPinTemplate extends IInputPinTemplate {
|
||||
|
||||
/** @param {String[]} values */
|
||||
setInputs(values = [], updateDefaultValue = false) {
|
||||
if (!values || values.length == 0) {
|
||||
values = this.getInput()
|
||||
values = [this.getInput()]
|
||||
}
|
||||
let parsedValues = []
|
||||
for (let i = 0; i < values.length; ++i) {
|
||||
let num = parseFloat(values[i])
|
||||
if (isNaN(num)) {
|
||||
num = parseFloat(this.element.entity.DefaultValue != ""
|
||||
? /** @type {String} */(this.element.entity.DefaultValue)
|
||||
: this.element.entity.AutogeneratedDefaultValue)
|
||||
}
|
||||
if (isNaN(num)) {
|
||||
num = 0
|
||||
updateDefaultValue = false
|
||||
@@ -35,7 +43,9 @@ export default class RealPinTemplate extends IInputPinTemplate {
|
||||
return html`
|
||||
<div class="ueb-pin-input">
|
||||
<span class="ueb-pin-input-content" role="textbox" contenteditable="true"
|
||||
.innerText="${IInputPinTemplate.stringFromUEToInput(Utility.minDecimals(this.element.entity.DefaultValue))}"></span>
|
||||
.innerText="${
|
||||
IInputPinTemplate.stringFromUEToInput(Utility.minDecimals(this.element.entity.DefaultValue))
|
||||
}"></span>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
|
||||
@@ -3,7 +3,28 @@ import RotatorEntity from "../entity/RotatorEntity"
|
||||
import IInputPinTemplate from "./IInputPinTemplate"
|
||||
import RealPinTemplate from "./RealPinTemplate"
|
||||
|
||||
export default class RotatorPinTemplate extends RealPinTemplate {
|
||||
/** @typedef {import("../entity/RotatorEntity").default} Rotator */
|
||||
|
||||
/** @extends IInputPinTemplate<Rotator> */
|
||||
export default class RotatorPinTemplate extends IInputPinTemplate {
|
||||
|
||||
/** @param {String[]} values */
|
||||
setInputs(values = [], updateDefaultValue = false) {
|
||||
if (!values || values.length == 0) {
|
||||
values = [this.getInput()]
|
||||
}
|
||||
let parsedValues = []
|
||||
for (let i = 0; i < values.length; ++i) {
|
||||
let num = parseFloat(values[i])
|
||||
if (isNaN(num)) {
|
||||
num = 0
|
||||
updateDefaultValue = false
|
||||
}
|
||||
parsedValues.push(num)
|
||||
}
|
||||
super.setInputs(values, false)
|
||||
this.setDefaultValue(parsedValues, values)
|
||||
}
|
||||
|
||||
setDefaultValue(values = [], rawValues = values) {
|
||||
if (!(this.element.entity.DefaultValue instanceof RotatorEntity)) {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import IDraggableTemplate from "./IDraggableTemplate"
|
||||
import ITemplate from "./ITemplate"
|
||||
import MouseMoveNodes from "../input/mouse/MouseMoveNodes"
|
||||
|
||||
/** @typedef {import("../element/ISelectableDraggableElement").default} ISelectableDraggableElement */
|
||||
/**
|
||||
* @typedef {import("../element/ISelectableDraggableElement").default} ISelectableDraggableElement
|
||||
* @typedef {import("../input/mouse/MouseMoveDraggable").default} MouseMoveDraggable
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {ISelectableDraggableElement} T
|
||||
* @extends {ITemplate<T>}
|
||||
* @extends {IDraggableTemplate<T>}
|
||||
*/
|
||||
export default class SelectableDraggableTemplate extends IDraggableTemplate {
|
||||
|
||||
@@ -15,10 +17,10 @@ export default class SelectableDraggableTemplate extends IDraggableTemplate {
|
||||
}
|
||||
|
||||
createDraggableObject() {
|
||||
return new MouseMoveNodes(this.element, this.element.blueprint, {
|
||||
return /** @type {MouseMoveDraggable} */ (new MouseMoveNodes(this.element, this.element.blueprint, {
|
||||
draggableElement: this.getDraggableElement(),
|
||||
looseTarget: true,
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
/** @param {Map} changedProperties */
|
||||
|
||||
@@ -2,6 +2,7 @@ import IFromToPositionedTemplate from "./IFromToPositionedTemplate"
|
||||
|
||||
/** @typedef {import("../element/SelectorElement").default} SelectorElement */
|
||||
|
||||
/** @extends IFromToPositionedTemplate<SelectorElement> */
|
||||
export default class SelectorTemplate extends IFromToPositionedTemplate {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,36 @@
|
||||
import { html } from "lit"
|
||||
import IInputPinTemplate from "./IInputPinTemplate"
|
||||
import RealPinTemplate from "./RealPinTemplate"
|
||||
import Utility from "../Utility"
|
||||
import VectorEntity from "../entity/VectorEntity"
|
||||
|
||||
/**
|
||||
* @typedef {import("../element/PinElement").default} PinElement
|
||||
* @typedef {import("../entity/LinearColorEntity").default} LinearColorEntity}
|
||||
* @typedef {import("../entity/LinearColorEntity").default} LinearColorEntity
|
||||
*/
|
||||
|
||||
export default class VectorPinTemplate extends RealPinTemplate {
|
||||
/**
|
||||
* @template {VectorEntity} T
|
||||
* @extends IInputPinTemplate<T>
|
||||
*/
|
||||
export default class VectorPinTemplate extends IInputPinTemplate {
|
||||
|
||||
/** @param {String[]} values */
|
||||
setInputs(values = [], updateDefaultValue = false) {
|
||||
if (!values || values.length == 0) {
|
||||
values = [this.getInput()]
|
||||
}
|
||||
let parsedValues = []
|
||||
for (let i = 0; i < values.length; ++i) {
|
||||
let num = parseFloat(values[i])
|
||||
if (isNaN(num)) {
|
||||
num = 0
|
||||
updateDefaultValue = false
|
||||
}
|
||||
parsedValues.push(num)
|
||||
}
|
||||
super.setInputs(values, false)
|
||||
this.setDefaultValue(parsedValues, values)
|
||||
}
|
||||
|
||||
setDefaultValue(values = [], rawValues = values) {
|
||||
if (!(this.element.entity.DefaultValue instanceof VectorEntity)) {
|
||||
@@ -27,27 +48,21 @@ export default class VectorPinTemplate extends RealPinTemplate {
|
||||
<div class="ueb-pin-input-wrapper">
|
||||
<span class="ueb-pin-input-label">X</span>
|
||||
<div class="ueb-pin-input">
|
||||
<span class="ueb-pin-input-content ueb-pin-input-x" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate.stringFromUEToInput(
|
||||
Utility.minDecimals(
|
||||
this.element.entity.getDefaultValue().X
|
||||
)
|
||||
)}"></span>
|
||||
<span class="ueb-pin-input-content ueb-pin-input-x" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate
|
||||
.stringFromUEToInput(Utility.minDecimals(this.element.entity.getDefaultValue().X))
|
||||
}"></span>
|
||||
</div>
|
||||
<span class="ueb-pin-input-label">Y</span>
|
||||
<div class="ueb-pin-input">
|
||||
<span class="ueb-pin-input-content ueb-pin-input-y" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate.stringFromUEToInput(
|
||||
Utility.minDecimals(
|
||||
this.element.entity.getDefaultValue().Y
|
||||
)
|
||||
)}"></span>
|
||||
<span class="ueb-pin-input-content ueb-pin-input-y" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate
|
||||
.stringFromUEToInput(Utility.minDecimals(this.element.entity.getDefaultValue().Y))
|
||||
}"></span>
|
||||
</div>
|
||||
<span class="ueb-pin-input-label">Z</span>
|
||||
<div class="ueb-pin-input">
|
||||
<span class="ueb-pin-input-content ueb-pin-input-z" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate.stringFromUEToInput(
|
||||
Utility.minDecimals(
|
||||
this.element.entity.getDefaultValue().Z
|
||||
)
|
||||
)}"></span>
|
||||
<span class="ueb-pin-input-content ueb-pin-input-z" role="textbox" contenteditable="true" .innerText="${IInputPinTemplate
|
||||
.stringFromUEToInput(Utility.minDecimals(this.element.entity.getDefaultValue().Z))
|
||||
}"></span>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
@@ -4,7 +4,7 @@ import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable"
|
||||
|
||||
/** @typedef {import("../element/WindowElement").default} WindowElement */
|
||||
|
||||
/** @extends {SelectableDraggableTemplate<WindowElement>} */
|
||||
/** @extends {IDraggableTemplate<WindowElement>} */
|
||||
export default class WindowTemplate extends IDraggableTemplate {
|
||||
|
||||
static windowName = html`Window`
|
||||
@@ -12,7 +12,7 @@ export default class WindowTemplate extends IDraggableTemplate {
|
||||
toggleAdvancedDisplayHandler
|
||||
|
||||
getDraggableElement() {
|
||||
return this.element.querySelector(".ueb-window-top")
|
||||
return /** @type {WindowElement} */(this.element.querySelector(".ueb-window-top"))
|
||||
}
|
||||
|
||||
createDraggableObject() {
|
||||
@@ -35,7 +35,9 @@ export default class WindowTemplate extends IDraggableTemplate {
|
||||
return html`
|
||||
<div class="ueb-window">
|
||||
<div class="ueb-window-top">
|
||||
<div class="ueb-window-name">${this.constructor.windowName}</div>
|
||||
<div class="ueb-window-name ueb-ellipsis-nowrap-text">${
|
||||
// @ts-expect-error
|
||||
this.constructor.windowName}</div>
|
||||
<div class="ueb-window-close">
|
||||
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
||||
<line x1="2" y1="2" x2="30" y2="30" stroke="currentColor" stroke-width="4" />
|
||||
|
||||
10
jsconfig.json
Normal file
10
jsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true,
|
||||
"module": "commonjs",
|
||||
"target": "ES2022",
|
||||
},
|
||||
"include": [
|
||||
"js/**/*.js",
|
||||
]
|
||||
}
|
||||
@@ -33,7 +33,6 @@
|
||||
"terser": "^5.14.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jaames/iro": "^5.5.2",
|
||||
"lit": "^2.2.4",
|
||||
"parsimmon": "^1.18.0",
|
||||
"rollup-plugin-html-literals": "^1.1.5"
|
||||
|
||||
@@ -330,4 +330,10 @@ ueb-blueprint[data-selecting="true"] ueb-selector {
|
||||
|
||||
ueb-selector>* {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.ueb-ellipsis-nowrap-text {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ ueb-window {
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform: translateX(calc(var(--ueb-position-x) * 1px)) translateY(calc(var(--ueb-position-y) * 1px));
|
||||
background: #242424;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
@@ -18,8 +19,65 @@ ueb-window {
|
||||
background: #1a1a1a;
|
||||
}
|
||||
|
||||
.ueb-window-name {
|
||||
flex-grow: 1;
|
||||
padding-left: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ueb-window-close {
|
||||
padding: 8px;
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
}
|
||||
|
||||
.ueb-color-picker-theme,
|
||||
.ueb-color-picker-srgb {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ueb-color-picker-main {
|
||||
display: grid;
|
||||
grid-template: 1fr / auto min-content min-content min-content;
|
||||
}
|
||||
|
||||
.ueb-color-picker-wheel {
|
||||
position: relative;
|
||||
padding-top: 100%;
|
||||
min-width: 200px;
|
||||
border-radius: 100%;
|
||||
background:
|
||||
radial-gradient(white 5%, transparent 85%),
|
||||
conic-gradient(from 90deg,
|
||||
#FF0000 0deg,
|
||||
#FFFF00 60deg,
|
||||
#00FF00 120deg,
|
||||
#00FFFF 180deg,
|
||||
#0000FF 240deg,
|
||||
#FF00FF 300deg,
|
||||
#FF0000 360deg);
|
||||
}
|
||||
|
||||
ueb-color-handler {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -3px;
|
||||
left: -3px;
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
transform: translateX(calc(var(--ueb-position-x) * 1px)) translateY(calc(var(--ueb-position-y) * 1px));
|
||||
border: 1px solid #000;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.ueb-color-picker-saturation,
|
||||
.ueb-color-picker-value {
|
||||
margin: 0 8px;
|
||||
width: 30px;
|
||||
background: linear-gradient(to bottom, transparent 10%, #000000 100%), rebeccapurple;
|
||||
}
|
||||
|
||||
.ueb-color-picker-value {
|
||||
background: linear-gradient(to bottom, transparent 10%, #FFFFFF 100%), rebeccapurple;
|
||||
}
|
||||
Reference in New Issue
Block a user