mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-06-11 21:53:11 +08:00
Refactor jsdoc types (#16)
* WIP * Fix type 1 * Missing types info * Some fixes * Several types refactoring and fixes * WIP * Fix grammar
This commit is contained in:
605
dist/ueblueprint.js
vendored
605
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
@@ -5,13 +5,6 @@ import LinkElement from "./element/LinkElement.js"
|
|||||||
import NodeElement from "./element/NodeElement.js"
|
import NodeElement from "./element/NodeElement.js"
|
||||||
import Utility from "./Utility.js"
|
import Utility from "./Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("./element/PinElement.js").default} PinElement
|
|
||||||
* @typedef {import("./entity/PinReferenceEntity.js").default} PinReferenceEntity
|
|
||||||
* @typedef {import("./template/node/CommentNodeTemplate.js").default} CommentNodeTemplate
|
|
||||||
* @typedef {typeof Blueprint} BlueprintConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends {IElement<Object, BlueprintTemplate>} */
|
/** @extends {IElement<Object, BlueprintTemplate>} */
|
||||||
export default class Blueprint extends IElement {
|
export default class Blueprint extends IElement {
|
||||||
|
|
||||||
@@ -203,14 +196,14 @@ export default class Blueprint extends IElement {
|
|||||||
getViewportSize() {
|
getViewportSize() {
|
||||||
return [
|
return [
|
||||||
this.template.viewportElement.clientWidth,
|
this.template.viewportElement.clientWidth,
|
||||||
this.template.viewportElement.clientHeight
|
this.template.viewportElement.clientHeight,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
getScrollMax() {
|
getScrollMax() {
|
||||||
return [
|
return [
|
||||||
this.template.viewportElement.scrollWidth - this.template.viewportElement.clientWidth,
|
this.template.viewportElement.scrollWidth - this.template.viewportElement.clientWidth,
|
||||||
this.template.viewportElement.scrollHeight - this.template.viewportElement.clientHeight
|
this.template.viewportElement.scrollHeight - this.template.viewportElement.clientHeight,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,8 +405,8 @@ export default class Blueprint extends IElement {
|
|||||||
for (const element of graphElements) {
|
for (const element of graphElements) {
|
||||||
element.blueprint = this
|
element.blueprint = this
|
||||||
if (element instanceof NodeElement && !this.nodes.includes(element)) {
|
if (element instanceof NodeElement && !this.nodes.includes(element)) {
|
||||||
const nodeName = element.entity.getObjectName()
|
const name = element.entity.getObjectName()
|
||||||
const homonymNode = this.nodes.find(node => node.entity.getObjectName() == nodeName)
|
const homonymNode = this.nodes.find(node => node.entity.getObjectName() == name)
|
||||||
if (homonymNode) {
|
if (homonymNode) {
|
||||||
// Inserted node keeps tha name and the homonym nodes is renamed
|
// Inserted node keeps tha name and the homonym nodes is renamed
|
||||||
let name = homonymNode.entity.getObjectName(true)
|
let name = homonymNode.entity.getObjectName(true)
|
||||||
@@ -421,9 +414,9 @@ export default class Blueprint extends IElement {
|
|||||||
do {
|
do {
|
||||||
++this.#nodeNameCounter[name]
|
++this.#nodeNameCounter[name]
|
||||||
} while (this.nodes.find(node =>
|
} while (this.nodes.find(node =>
|
||||||
node.entity.getObjectName() == Configuration.nodeName(name, this.#nodeNameCounter[name])
|
node.entity.getObjectName() == Configuration.nodeTitle(name, this.#nodeNameCounter[name])
|
||||||
))
|
))
|
||||||
homonymNode.rename(Configuration.nodeName(name, this.#nodeNameCounter[name]))
|
homonymNode.rename(Configuration.nodeTitle(name, this.#nodeNameCounter[name]))
|
||||||
}
|
}
|
||||||
this.nodes.push(element)
|
this.nodes.push(element)
|
||||||
element.addEventListener(Configuration.removeEventName, removeEventHandler)
|
element.addEventListener(Configuration.removeEventName, removeEventHandler)
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { css } from "lit"
|
import { css } from "lit"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("./entity/ObjectEntity.js").default} ObjectEntity
|
|
||||||
* @typedef {import("./entity/ObjectReferenceEntity.js").default} ObjectReferenceEntity
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class Configuration {
|
export default class Configuration {
|
||||||
static nodeColors = {
|
static nodeColors = {
|
||||||
black: css`20, 20, 20`,
|
black: css`20, 20, 20`,
|
||||||
@@ -86,7 +81,7 @@ export default class Configuration {
|
|||||||
static mouseWheelZoomThreshold = 80
|
static mouseWheelZoomThreshold = 80
|
||||||
static nodeDragEventName = "ueb-node-drag"
|
static nodeDragEventName = "ueb-node-drag"
|
||||||
static nodeDragGeneralEventName = "ueb-node-drag-general"
|
static nodeDragGeneralEventName = "ueb-node-drag-general"
|
||||||
static nodeName = (name, counter) => `${name}_${counter}`
|
static nodeTitle = (name, counter) => `${name}_${counter}`
|
||||||
static nodeRadius = 8 // px
|
static nodeRadius = 8 // px
|
||||||
static nodeReflowEventName = "ueb-node-reflow"
|
static nodeReflowEventName = "ueb-node-reflow"
|
||||||
static paths = {
|
static paths = {
|
||||||
|
|||||||
@@ -3,23 +3,6 @@ import Configuration from "./Configuration.js"
|
|||||||
import MirroredEntity from "./entity/MirroredEntity.js"
|
import MirroredEntity from "./entity/MirroredEntity.js"
|
||||||
import Union from "./entity/Union.js"
|
import Union from "./entity/Union.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("./Blueprint.js").default} Blueprint
|
|
||||||
* @typedef {import("./entity/IEntity.js").AnyValue} AnyValue
|
|
||||||
* @typedef {import("./entity/IEntity.js").AttributeInformation} AttributeInformation
|
|
||||||
* @typedef {import("./entity/IEntity.js").default} IEntity
|
|
||||||
* @typedef {import("./entity/IEntity.js").EntityConstructor} EntityConstructor
|
|
||||||
* @typedef {import("./entity/LinearColorEntity.js").default} LinearColorEntity
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @typedef {import("./entity/IEntity.js").AnyValueConstructor<T>} AnyValueConstructor
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template T
|
|
||||||
* @typedef {import("./entity/IEntity.js").TypeGetter<T>} TypeGetter
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class Utility {
|
export default class Utility {
|
||||||
|
|
||||||
static booleanConverter = {
|
static booleanConverter = {
|
||||||
@@ -233,20 +216,24 @@ export default class Utility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {null | AnyValue | AttributeInformation} value
|
* @template {AnyValue} T
|
||||||
|
* @param {T} value
|
||||||
|
* @returns {SimpleValueType<T>}
|
||||||
*/
|
*/
|
||||||
static getType(value) {
|
static getType(value) {
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (value?.constructor === Object && /** @type {AttributeInformation} */(value)?.type instanceof Function) {
|
if (value?.constructor === Object && /** @type {AttributeInformation} */(value)?.type instanceof Function) {
|
||||||
|
// @ts-expect-error
|
||||||
return /** @type {AttributeInformation} */(value).type
|
return /** @type {AttributeInformation} */(value).type
|
||||||
}
|
}
|
||||||
return /** @type {AnyValueConstructor<any>} */(value?.constructor)
|
return /** @type {SimpleValueType<any>} */(value?.constructor)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {new (...args: any) => any} C
|
* @template {SimpleValue} V
|
||||||
|
* @template {SimpleValueType<V>} C
|
||||||
* @param {C} type
|
* @param {C} type
|
||||||
* @returns {value is InstanceType<C>}
|
* @returns {value is InstanceType<C>}
|
||||||
*/
|
*/
|
||||||
@@ -257,8 +244,8 @@ export default class Utility {
|
|||||||
return (acceptNull && value === null) || value instanceof type || value?.constructor === type
|
return (acceptNull && value === null) || value instanceof type || value?.constructor === type
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {AnyValue} value */
|
/** @param {AnyValue | Object} value */
|
||||||
static sanitize(value, targetType = /** @type {AnyValueConstructor<typeof value>} */(value?.constructor)) {
|
static sanitize(value, targetType = /** @type {SimpleValueType<typeof value>} */(value?.constructor)) {
|
||||||
if (targetType instanceof Array) {
|
if (targetType instanceof Array) {
|
||||||
targetType = targetType[0]
|
targetType = targetType[0]
|
||||||
}
|
}
|
||||||
@@ -283,7 +270,7 @@ export default class Utility {
|
|||||||
? BigInt(/** @type {Number} */(value))
|
? BigInt(/** @type {Number} */(value))
|
||||||
: new /** @type {EntityConstructor} */(targetType)(value)
|
: new /** @type {EntityConstructor} */(targetType)(value)
|
||||||
}
|
}
|
||||||
if (value instanceof Boolean || value instanceof Number || value instanceof String || value instanceof BigInt) {
|
if (value instanceof Boolean || value instanceof Number || value instanceof String) {
|
||||||
value = value.valueOf() // Get the relative primitive value
|
value = value.valueOf() // Get the relative primitive value
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
/**
|
|
||||||
* @typedef {import("./IElement.js").default} IElement
|
|
||||||
* @typedef {new (...args) => IElement} ElementConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class ElementFactory {
|
export default class ElementFactory {
|
||||||
|
|
||||||
/** @type {Map<String, ElementConstructor>} */
|
/** @type {Map<String, AnyConstructor<IElement>>} */
|
||||||
static #elementConstructors = new Map()
|
static #elementConstructors = new Map()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} tagName
|
* @param {String} tagName
|
||||||
* @param {ElementConstructor} entityConstructor
|
* @param {AnyConstructor<IElement>} entityConstructor
|
||||||
*/
|
*/
|
||||||
static registerElement(tagName, entityConstructor) {
|
static registerElement(tagName, entityConstructor) {
|
||||||
ElementFactory.#elementConstructors.set(tagName, entityConstructor)
|
ElementFactory.#elementConstructors.set(tagName, entityConstructor)
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
import IDraggableElement from "./IDraggableElement.js"
|
import IDraggableElement from "./IDraggableElement.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/WindowElement.js").default} WindowElement
|
|
||||||
* @typedef {import("../entity/IEntity.js").default} IEntity
|
|
||||||
* @typedef {import("../template/IDraggableControlTemplate.js").default} IDraggableControlTemplate
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IEntity} T
|
* @template {IEntity} T
|
||||||
* @template {IDraggableControlTemplate} U
|
* @template {IDraggableControlTemplate} U
|
||||||
|
|||||||
@@ -2,15 +2,6 @@ import Configuration from "../Configuration.js"
|
|||||||
import IElement from "./IElement.js"
|
import IElement from "./IElement.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../entity/IEntity.js").default} IEntity
|
|
||||||
* @typedef {import("../template/IDraggableTemplate.js").default} IDraggableTemplate
|
|
||||||
* @typedef {CustomEvent<{
|
|
||||||
* value: [Number, Number]
|
|
||||||
* }>} DragEvent
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IEntity} T
|
* @template {IEntity} T
|
||||||
* @template {IDraggableTemplate} U
|
* @template {IDraggableTemplate} U
|
||||||
|
|||||||
@@ -2,16 +2,8 @@ import { LitElement } from "lit"
|
|||||||
import Configuration from "../Configuration.js"
|
import Configuration from "../Configuration.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../Blueprint.js").default} Blueprint
|
* @template {IEntity} EntityT
|
||||||
* @typedef {import("../entity/IEntity.js").default} IEntity
|
* @template {ITemplate} TemplateT
|
||||||
* @typedef {import("../input/IInput.js").default} IInput
|
|
||||||
* @typedef {import("../template/ITemplate.js").default} ITemplate
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {IEntity} T
|
|
||||||
* @template {ITemplate} U
|
|
||||||
*/
|
*/
|
||||||
export default class IElement extends LitElement {
|
export default class IElement extends LitElement {
|
||||||
|
|
||||||
@@ -24,7 +16,7 @@ export default class IElement extends LitElement {
|
|||||||
this.#blueprint = v
|
this.#blueprint = v
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {T} */
|
/** @type {EntityT} */
|
||||||
#entity
|
#entity
|
||||||
get entity() {
|
get entity() {
|
||||||
return this.#entity
|
return this.#entity
|
||||||
@@ -33,7 +25,7 @@ export default class IElement extends LitElement {
|
|||||||
this.#entity = entity
|
this.#entity = entity
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {U} */
|
/** @type {TemplateT} */
|
||||||
#template
|
#template
|
||||||
get template() {
|
get template() {
|
||||||
return this.#template
|
return this.#template
|
||||||
@@ -46,8 +38,8 @@ export default class IElement extends LitElement {
|
|||||||
inputObjects = []
|
inputObjects = []
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {T} entity
|
* @param {EntityT} entity
|
||||||
* @param {U} template
|
* @param {TemplateT} template
|
||||||
*/
|
*/
|
||||||
initialize(entity, template) {
|
initialize(entity, template) {
|
||||||
this.requestUpdate()
|
this.requestUpdate()
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
import IElement from "./IElement.js"
|
import IElement from "./IElement.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../entity/IEntity.js").default} IEntity
|
* @template {IEntity} EntityT
|
||||||
* @typedef {import("../template/ITemplate.js").default} ITemplate
|
* @template {ITemplate} TemplateT
|
||||||
*/
|
* @extends {IElement<EntityT, TemplateT>}
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {IEntity} T
|
|
||||||
* @template {ITemplate} U
|
|
||||||
* @extends {IElement<T, U>}
|
|
||||||
*/
|
*/
|
||||||
export default class IFromToPositionedElement extends IElement {
|
export default class IFromToPositionedElement extends IElement {
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,9 @@ import IDraggableElement from "./IDraggableElement.js"
|
|||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../element/IDraggableElement.js").DragEvent} DragEvent
|
* @template {IEntity} EntityT
|
||||||
* @typedef {import("../entity/IEntity.js").default} IEntity
|
* @template {ISelectableDraggableTemplate} TemplateT
|
||||||
* @typedef {import("../template/ISelectableDraggableTemplate.js").default} ISelectableDraggableTemplate
|
* @extends {IDraggableElement<EntityT, TemplateT>}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {IEntity} T
|
|
||||||
* @template {ISelectableDraggableTemplate} U
|
|
||||||
* @extends {IDraggableElement<T, U>}
|
|
||||||
*/
|
*/
|
||||||
export default class ISelectableDraggableElement extends IDraggableElement {
|
export default class ISelectableDraggableElement extends IDraggableElement {
|
||||||
|
|
||||||
@@ -25,7 +19,7 @@ export default class ISelectableDraggableElement extends IDraggableElement {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {DragEvent} e */
|
/** @param {UEBDragEvent} e */
|
||||||
dragHandler = e => this.addLocation(...e.detail.value)
|
dragHandler = e => this.addLocation(...e.detail.value)
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|||||||
@@ -5,13 +5,6 @@ import LinkTemplate from "../template/LinkTemplate.js"
|
|||||||
import SVGIcon from "../SVGIcon.js"
|
import SVGIcon from "../SVGIcon.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/IDraggableElement.js").DragEvent} DragEvent
|
|
||||||
* @typedef {import("./PinElement.js").default} PinElement
|
|
||||||
* @typedef {import("lit").TemplateResult<1>} TemplateResult
|
|
||||||
* @typedef {typeof LinkElement} LinkElementConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends {IFromToPositionedElement<Object, LinkTemplate>} */
|
/** @extends {IFromToPositionedElement<Object, LinkTemplate>} */
|
||||||
export default class LinkElement extends IFromToPositionedElement {
|
export default class LinkElement extends IFromToPositionedElement {
|
||||||
|
|
||||||
@@ -60,9 +53,9 @@ export default class LinkElement extends IFromToPositionedElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#nodeDeleteHandler = () => this.remove()
|
#nodeDeleteHandler = () => this.remove()
|
||||||
/** @param {DragEvent} e */
|
/** @param {UEBDragEvent} e */
|
||||||
#nodeDragSourceHandler = e => this.addSourceLocation(...e.detail.value)
|
#nodeDragSourceHandler = e => this.addSourceLocation(...e.detail.value)
|
||||||
/** @param {DragEvent} e */
|
/** @param {UEBDragEvent} e */
|
||||||
#nodeDragDestinatonHandler = e => this.addDestinationLocation(...e.detail.value)
|
#nodeDragDestinatonHandler = e => this.addDestinationLocation(...e.detail.value)
|
||||||
#nodeReflowSourceHandler = e => this.setSourceLocation()
|
#nodeReflowSourceHandler = e => this.setSourceLocation()
|
||||||
#nodeReflowDestinatonHandler = e => this.setDestinationLocation()
|
#nodeReflowDestinatonHandler = e => this.setDestinationLocation()
|
||||||
@@ -98,6 +91,7 @@ export default class LinkElement extends IFromToPositionedElement {
|
|||||||
* @param {PinElement} source
|
* @param {PinElement} source
|
||||||
* @param {PinElement?} destination
|
* @param {PinElement?} destination
|
||||||
*/
|
*/
|
||||||
|
// @ts-expect-error
|
||||||
initialize(source, destination) {
|
initialize(source, destination) {
|
||||||
super.initialize({}, new LinkTemplate())
|
super.initialize({}, new LinkTemplate())
|
||||||
if (source) {
|
if (source) {
|
||||||
|
|||||||
@@ -14,14 +14,6 @@ import VariableAccessNodeTemplate from "../template/node/VariableAccessNodeTempl
|
|||||||
import VariableConversionNodeTemplate from "../template/node/VariableConversionNodeTemplate.js"
|
import VariableConversionNodeTemplate from "../template/node/VariableConversionNodeTemplate.js"
|
||||||
import VariableOperationNodeTemplate from "../template/node/VariableOperationNodeTemplate.js"
|
import VariableOperationNodeTemplate from "../template/node/VariableOperationNodeTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("./IDraggableElement.js").DragEvent} DragEvent
|
|
||||||
* @typedef {import("./IElement.js").default} IElement
|
|
||||||
* @typedef {import("../entity/ObjectReferenceEntity.js").default} ObjectReferenceEntity
|
|
||||||
* @typedef {import("./PinElement.js").default} PinElement
|
|
||||||
* @typedef {typeof NodeElement} NodeElementConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends {ISelectableDraggableElement<ObjectEntity, NodeTemplate>} */
|
/** @extends {ISelectableDraggableElement<ObjectEntity, NodeTemplate>} */
|
||||||
export default class NodeElement extends ISelectableDraggableElement {
|
export default class NodeElement extends ISelectableDraggableElement {
|
||||||
|
|
||||||
@@ -32,9 +24,9 @@ export default class NodeElement extends ISelectableDraggableElement {
|
|||||||
attribute: "data-type",
|
attribute: "data-type",
|
||||||
reflect: true,
|
reflect: true,
|
||||||
},
|
},
|
||||||
nodeName: {
|
nodeTitle: {
|
||||||
type: String,
|
type: String,
|
||||||
attribute: "data-name",
|
attribute: "data-title",
|
||||||
reflect: true,
|
reflect: true,
|
||||||
},
|
},
|
||||||
advancedPinDisplay: {
|
advancedPinDisplay: {
|
||||||
@@ -84,7 +76,7 @@ export default class NodeElement extends ISelectableDraggableElement {
|
|||||||
/** @type {NodeElement[]} */
|
/** @type {NodeElement[]} */
|
||||||
boundComments = []
|
boundComments = []
|
||||||
#commentDragged = false
|
#commentDragged = false
|
||||||
/** @param {DragEvent} e */
|
/** @param {UEBDragEvent} e */
|
||||||
#commentDragHandler = e => {
|
#commentDragHandler = e => {
|
||||||
// If selected, it will already drag, also must check if under nested comments, it must drag just once
|
// If selected, it will already drag, also must check if under nested comments, it must drag just once
|
||||||
if (!this.selected && !this.#commentDragged) {
|
if (!this.selected && !this.#commentDragged) {
|
||||||
@@ -211,7 +203,7 @@ export default class NodeElement extends ISelectableDraggableElement {
|
|||||||
super.initialize(entity, template)
|
super.initialize(entity, template)
|
||||||
this.#pins = this.template.createPinElements()
|
this.#pins = this.template.createPinElements()
|
||||||
this.typePath = this.entity.getType()
|
this.typePath = this.entity.getType()
|
||||||
this.nodeName = this.entity.getObjectName()
|
this.nodeTitle = this.entity.getObjectName()
|
||||||
this.advancedPinDisplay = this.entity.AdvancedPinDisplay?.toString()
|
this.advancedPinDisplay = this.entity.AdvancedPinDisplay?.toString()
|
||||||
this.enabledState = this.entity.EnabledState
|
this.enabledState = this.entity.EnabledState
|
||||||
this.nodeDisplayName = this.getNodeDisplayName()
|
this.nodeDisplayName = this.getNodeDisplayName()
|
||||||
@@ -305,7 +297,7 @@ export default class NodeElement extends ISelectableDraggableElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.entity.Name = name
|
this.entity.Name = name
|
||||||
this.nodeName = this.entity.Name
|
this.nodeTitle = this.entity.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
getPinElements() {
|
getPinElements() {
|
||||||
|
|||||||
@@ -21,18 +21,6 @@ import Utility from "../Utility.js"
|
|||||||
import Vector2DPinTemplate from "../template/pin/Vector2DPinTemplate.js"
|
import Vector2DPinTemplate from "../template/pin/Vector2DPinTemplate.js"
|
||||||
import VectorPinTemplate from "../template/pin/VectorPinTemplate.js"
|
import VectorPinTemplate from "../template/pin/VectorPinTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValue} AnyValue
|
|
||||||
* @typedef {import("./LinkElement.js").LinkElementConstructor} LinkElementConstructor
|
|
||||||
* @typedef {import("./NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("lit").CSSResult} CSSResult
|
|
||||||
* @typedef {typeof PinElement} PinElementConstructor
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template T
|
|
||||||
* @typedef {import("parsimmon").Success<T>} Success
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {AnyValue} T
|
* @template {AnyValue} T
|
||||||
* @extends {IElement<PinEntity<T>, PinTemplate>}
|
* @extends {IElement<PinEntity<T>, PinTemplate>}
|
||||||
@@ -114,10 +102,7 @@ export default class PinElement extends IElement {
|
|||||||
/** @type {NodeElement} */
|
/** @type {NodeElement} */
|
||||||
nodeElement
|
nodeElement
|
||||||
|
|
||||||
/**
|
/** @param {PinEntity<any>} pinEntity */
|
||||||
* @param {PinEntity<any>} pinEntity
|
|
||||||
* @return {new () => PinTemplate}
|
|
||||||
*/
|
|
||||||
static getTypeTemplate(pinEntity) {
|
static getTypeTemplate(pinEntity) {
|
||||||
if (pinEntity.PinType.ContainerType?.toString() === "Array") {
|
if (pinEntity.PinType.ContainerType?.toString() === "Array") {
|
||||||
return PinTemplate
|
return PinTemplate
|
||||||
@@ -128,16 +113,12 @@ export default class PinElement extends IElement {
|
|||||||
if (pinEntity.getType() === "exec") {
|
if (pinEntity.getType() === "exec") {
|
||||||
return ExecPinTemplate
|
return ExecPinTemplate
|
||||||
}
|
}
|
||||||
let result
|
return (pinEntity.isInput() ? PinElement.#inputPinTemplates[pinEntity.getType()] : PinTemplate) ?? PinTemplate
|
||||||
if (pinEntity.isInput()) {
|
|
||||||
result = PinElement.#inputPinTemplates[pinEntity.getType()]
|
|
||||||
}
|
|
||||||
return result ?? PinTemplate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static newObject(
|
static newObject(
|
||||||
entity = new PinEntity(),
|
entity = new PinEntity(),
|
||||||
template = new (PinElement.getTypeTemplate(entity))(),
|
template = /** @type {PinTemplate} */(new (PinElement.getTypeTemplate(entity))()),
|
||||||
nodeElement = undefined
|
nodeElement = undefined
|
||||||
) {
|
) {
|
||||||
const result = new PinElement()
|
const result = new PinElement()
|
||||||
@@ -147,7 +128,7 @@ export default class PinElement extends IElement {
|
|||||||
|
|
||||||
initialize(
|
initialize(
|
||||||
entity = /** @type {PinEntity<T>} */(new PinEntity()),
|
entity = /** @type {PinEntity<T>} */(new PinEntity()),
|
||||||
template = new (PinElement.getTypeTemplate(entity))(),
|
template = /** @type {PinTemplate} */(new (PinElement.getTypeTemplate(entity))()),
|
||||||
nodeElement = undefined
|
nodeElement = undefined
|
||||||
) {
|
) {
|
||||||
this.nodeElement = nodeElement
|
this.nodeElement = nodeElement
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import FastSelectionModel from "../selection/FastSelectionModel.js"
|
|||||||
import IFromToPositionedElement from "./IFromToPositionedElement.js"
|
import IFromToPositionedElement from "./IFromToPositionedElement.js"
|
||||||
import SelectorTemplate from "../template/SelectorTemplate.js"
|
import SelectorTemplate from "../template/SelectorTemplate.js"
|
||||||
|
|
||||||
/** @typedef {import("../Blueprint.js").BlueprintConstructor} BlueprintConstructor */
|
|
||||||
|
|
||||||
/** @extends {IFromToPositionedElement<Object, SelectorTemplate>} */
|
/** @extends {IFromToPositionedElement<Object, SelectorTemplate>} */
|
||||||
export default class SelectorElement extends IFromToPositionedElement {
|
export default class SelectorElement extends IFromToPositionedElement {
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import Configuration from "../Configuration.js"
|
|||||||
import IDraggableElement from "./IDraggableElement.js"
|
import IDraggableElement from "./IDraggableElement.js"
|
||||||
import WindowTemplate from "../template/window/WindowTemplate.js"
|
import WindowTemplate from "../template/window/WindowTemplate.js"
|
||||||
|
|
||||||
/** @typedef {typeof WindowElement} WindowElementConstructor */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {WindowTemplate} T
|
* @template {WindowTemplate} T
|
||||||
* @extends {IDraggableElement<Object, T>}
|
* @extends {IDraggableElement<Object, T>}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import IEntity from "./IEntity.js"
|
import IEntity from "./IEntity.js"
|
||||||
|
|
||||||
/** @typedef {import("./ObjectEntity.js").default} ObjectEntity */
|
|
||||||
|
|
||||||
export default class Base64ObjectsEncoded extends IEntity {
|
export default class Base64ObjectsEncoded extends IEntity {
|
||||||
|
|
||||||
static attributes = {
|
static attributes = {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/** @typedef {import("./IEntity.js").default} IEntity */
|
|
||||||
|
|
||||||
export default class ComputedType {
|
export default class ComputedType {
|
||||||
|
|
||||||
#f
|
#f
|
||||||
|
|||||||
@@ -5,44 +5,6 @@ import SerializerFactory from "../serialization/SerializerFactory.js"
|
|||||||
import Union from "./Union.js"
|
import Union from "./Union.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @typedef {(new (...any) => T) | StringConstructor | NumberConstructor | BigIntConstructor | BooleanConstructor
|
|
||||||
* | ArrayConstructor} AnyValueConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {IEntity | MirroredEntity | String | Number | BigInt | Boolean} AnySimpleValue
|
|
||||||
* @typedef {AnySimpleValue | AnySimpleValue[]} AnyValue
|
|
||||||
* @typedef {(entity: IEntity) => AnyValue} ValueSupplier
|
|
||||||
* @typedef {AnyValueConstructor<AnyValue> | AnyValueConstructor<AnyValue>[] | Union | Union[] | ComputedType | MirroredEntity} AttributeType
|
|
||||||
* @typedef {{
|
|
||||||
* type?: AttributeType,
|
|
||||||
* default?: AnyValue | ValueSupplier,
|
|
||||||
* nullable?: Boolean,
|
|
||||||
* ignored?: Boolean,
|
|
||||||
* serialized?: Boolean,
|
|
||||||
* expected?: Boolean,
|
|
||||||
* inlined?: Boolean,
|
|
||||||
* quoted?: Boolean,
|
|
||||||
* predicate?: (value: AnyValue) => Boolean,
|
|
||||||
* }} AttributeInformation
|
|
||||||
* @typedef {{
|
|
||||||
* [key: String]: AttributeInformation
|
|
||||||
* }} AttributeDeclarations
|
|
||||||
* @typedef {typeof IEntity} EntityConstructor
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template T
|
|
||||||
* @typedef {{
|
|
||||||
* (value: Boolean): BooleanConstructor,
|
|
||||||
* (value: Number): NumberConstructor,
|
|
||||||
* (value: String): StringConstructor,
|
|
||||||
* (value: BigInt): BigIntConstructor,
|
|
||||||
* (value: T): typeof value.constructor,
|
|
||||||
* }} TypeGetter
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class IEntity extends Serializable {
|
export default class IEntity extends Serializable {
|
||||||
|
|
||||||
/** @type {String | Union<String[]>} */
|
/** @type {String | Union<String[]>} */
|
||||||
@@ -65,7 +27,7 @@ export default class IEntity extends Serializable {
|
|||||||
constructor(values = {}, suppressWarns = false) {
|
constructor(values = {}, suppressWarns = false) {
|
||||||
super()
|
super()
|
||||||
/** @type {String} */ this.lookbehind
|
/** @type {String} */ this.lookbehind
|
||||||
const Self = /** @type {EntityConstructor} */(this.constructor)
|
const Self = /** @type {typeof IEntity} */(this.constructor)
|
||||||
let attributes = Self.attributes
|
let attributes = Self.attributes
|
||||||
if (values.attributes) {
|
if (values.attributes) {
|
||||||
attributes = { ...Self.attributes }
|
attributes = { ...Self.attributes }
|
||||||
@@ -166,7 +128,7 @@ export default class IEntity extends Serializable {
|
|||||||
.getSerializer(defaultType)
|
.getSerializer(defaultType)
|
||||||
.read(/** @type {String} */(value))
|
.read(/** @type {String} */(value))
|
||||||
}
|
}
|
||||||
assignAttribute(Utility.sanitize(value, /** @type {AnyValueConstructor<*>} */(defaultType)))
|
assignAttribute(Utility.sanitize(value, /** @type {AnyConstructor<*>} */(defaultType)))
|
||||||
continue // We have a value, need nothing more
|
continue // We have a value, need nothing more
|
||||||
}
|
}
|
||||||
if (Object.hasOwn(attribute, "default")) { // Accept also explicit undefined
|
if (Object.hasOwn(attribute, "default")) { // Accept also explicit undefined
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ export default class IntegerEntity extends IEntity {
|
|||||||
return Grammar.integer.map(v => new this(v))
|
return Grammar.integer.map(v => new this(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param {Number | AttributeInformation} value */
|
||||||
constructor(value = 0) {
|
constructor(value = 0) {
|
||||||
if (value.constructor !== Object) {
|
super(value.constructor === Object
|
||||||
// @ts-expect-error
|
? value
|
||||||
value = {
|
: {
|
||||||
value: value,
|
value: value,
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
super(value)
|
|
||||||
/** @type {Number} */ this.value
|
/** @type {Number} */ this.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("./IEntity.js").default} IEntity
|
|
||||||
* @typedef {import("./IEntity.js").EntityConstructor} EntityConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class MirroredEntity {
|
export default class MirroredEntity {
|
||||||
|
|
||||||
static attributes = {
|
static attributes = {
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import UnknownPinEntity from "./UnknownPinEntity.js"
|
|||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
import VariableReferenceEntity from "./VariableReferenceEntity.js"
|
import VariableReferenceEntity from "./VariableReferenceEntity.js"
|
||||||
|
|
||||||
/** @typedef {import("./VectorEntity.js").default} VectorEntity */
|
|
||||||
|
|
||||||
export default class ObjectEntity extends IEntity {
|
export default class ObjectEntity extends IEntity {
|
||||||
|
|
||||||
static #keyName = {
|
static #keyName = {
|
||||||
@@ -305,7 +303,7 @@ export default class ObjectEntity extends IEntity {
|
|||||||
},
|
},
|
||||||
CustomProperties: {
|
CustomProperties: {
|
||||||
type: [new Union(PinEntity, UnknownPinEntity)],
|
type: [new Union(PinEntity, UnknownPinEntity)],
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
static {
|
static {
|
||||||
this.cleanupAttributes(this.attributes)
|
this.cleanupAttributes(this.attributes)
|
||||||
@@ -316,7 +314,7 @@ export default class ObjectEntity extends IEntity {
|
|||||||
Parsimmon.regex(/CustomProperties\s+/),
|
Parsimmon.regex(/CustomProperties\s+/),
|
||||||
Grammar.grammarFor(
|
Grammar.grammarFor(
|
||||||
undefined,
|
undefined,
|
||||||
(this.attributes.CustomProperties ?? ObjectEntity.attributes.CustomProperties).type[0]
|
this.attributes.CustomProperties.type[0]
|
||||||
),
|
),
|
||||||
).map(([_0, pin]) => values => {
|
).map(([_0, pin]) => values => {
|
||||||
if (!values.CustomProperties) {
|
if (!values.CustomProperties) {
|
||||||
@@ -382,7 +380,7 @@ export default class ObjectEntity extends IEntity {
|
|||||||
Parsimmon.regex(/\s+End\s+Object/),
|
Parsimmon.regex(/\s+End\s+Object/),
|
||||||
)
|
)
|
||||||
.map(([_0, attributes, _2]) => {
|
.map(([_0, attributes, _2]) => {
|
||||||
let values = {}
|
const values = {}
|
||||||
attributes.forEach(attributeSetter => attributeSetter(values))
|
attributes.forEach(attributeSetter => attributeSetter(values))
|
||||||
return new this(values)
|
return new this(values)
|
||||||
})
|
})
|
||||||
@@ -390,6 +388,7 @@ export default class ObjectEntity extends IEntity {
|
|||||||
|
|
||||||
/** @param {String} value */
|
/** @param {String} value */
|
||||||
static keyName(value) {
|
static keyName(value) {
|
||||||
|
/** @type {String} */
|
||||||
let result = ObjectEntity.#keyName[value]
|
let result = ObjectEntity.#keyName[value]
|
||||||
if (result) {
|
if (result) {
|
||||||
return result
|
return result
|
||||||
@@ -400,7 +399,7 @@ export default class ObjectEntity extends IEntity {
|
|||||||
}
|
}
|
||||||
const match = value.match(/NumPad([a-zA-Z]+)/)
|
const match = value.match(/NumPad([a-zA-Z]+)/)
|
||||||
if (match) {
|
if (match) {
|
||||||
result = Utility.numberFromText(match[1])
|
result = Utility.numberFromText(match[1]).toString()
|
||||||
if (result) {
|
if (result) {
|
||||||
return "Num " + result
|
return "Num " + result
|
||||||
}
|
}
|
||||||
@@ -410,10 +409,10 @@ export default class ObjectEntity extends IEntity {
|
|||||||
static getMultipleObjectsGrammar() {
|
static getMultipleObjectsGrammar() {
|
||||||
return Parsimmon.seq(
|
return Parsimmon.seq(
|
||||||
Parsimmon.optWhitespace,
|
Parsimmon.optWhitespace,
|
||||||
this.grammar,
|
this.createGrammar(),
|
||||||
Parsimmon.seq(
|
Parsimmon.seq(
|
||||||
Parsimmon.whitespace,
|
Parsimmon.whitespace,
|
||||||
this.grammar,
|
this.createGrammar(),
|
||||||
)
|
)
|
||||||
.map(([_0, object]) => object)
|
.map(([_0, object]) => object)
|
||||||
.many(),
|
.many(),
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ export default class PathSymbolEntity extends IEntity {
|
|||||||
static {
|
static {
|
||||||
this.cleanupAttributes(this.attributes)
|
this.cleanupAttributes(this.attributes)
|
||||||
}
|
}
|
||||||
static #grammar = Grammar.symbol.map(v => new PathSymbolEntity(v))
|
static grammar = this.createGrammar()
|
||||||
|
|
||||||
static createGrammar() {
|
static createGrammar() {
|
||||||
return PathSymbolEntity.#grammar
|
return Grammar.symbol.map(v => new this(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(values) {
|
constructor(values) {
|
||||||
|
|||||||
@@ -23,12 +23,6 @@ import Utility from "../Utility.js"
|
|||||||
import Vector2DEntity from "./Vector2DEntity.js"
|
import Vector2DEntity from "./Vector2DEntity.js"
|
||||||
import VectorEntity from "./VectorEntity.js"
|
import VectorEntity from "./VectorEntity.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("./IEntity.js").AnyValue} AnyValue
|
|
||||||
* @typedef {import("./ObjectEntity.js").default} ObjectEntity
|
|
||||||
* @typedef {import("lit").CSSResult} CSSResult
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @template {AnyValue} T */
|
/** @template {AnyValue} T */
|
||||||
export default class PinEntity extends IEntity {
|
export default class PinEntity extends IEntity {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import Configuration from "../Configuration.js"
|
import Configuration from "../Configuration.js"
|
||||||
|
|
||||||
/** @typedef {import("../Blueprint.js").default} Blueprint */
|
|
||||||
|
|
||||||
/** @template {Element} T */
|
/** @template {Element} T */
|
||||||
export default class IInput {
|
export default class IInput {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
import IInput from "./IInput"
|
|
||||||
|
|
||||||
/** @typedef {import("../Blueprint.js").default} Blueprint */
|
|
||||||
|
|
||||||
export default class InputCombination {
|
export default class InputCombination {
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import ElementFactory from "../../element/ElementFactory.js"
|
|||||||
import IInput from "../IInput.js"
|
import IInput from "../IInput.js"
|
||||||
import ObjectSerializer from "../../serialization/ObjectSerializer.js"
|
import ObjectSerializer from "../../serialization/ObjectSerializer.js"
|
||||||
|
|
||||||
/** @typedef {import("../../element/NodeElement.js").NodeElementConstructor} NodeElementConstructor */
|
|
||||||
|
|
||||||
export default class Paste extends IInput {
|
export default class Paste extends IInput {
|
||||||
|
|
||||||
static #serializer = new ObjectSerializer()
|
static #serializer = new ObjectSerializer()
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import KeyboardShortcut from "./KeyboardShortcut.js"
|
|||||||
import Shortcuts from "../../Shortcuts.js"
|
import Shortcuts from "../../Shortcuts.js"
|
||||||
import Zoom from "../mouse/Zoom.js"
|
import Zoom from "../mouse/Zoom.js"
|
||||||
|
|
||||||
/** @typedef {import("../../Blueprint.js").default} Blueprint */
|
|
||||||
|
|
||||||
export default class KeyboardEnableZoom extends KeyboardShortcut {
|
export default class KeyboardEnableZoom extends KeyboardShortcut {
|
||||||
|
|
||||||
/** @type {Zoom} */
|
/** @type {Zoom} */
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import Configuration from "../../Configuration.js"
|
|||||||
import IInput from "../IInput.js"
|
import IInput from "../IInput.js"
|
||||||
import KeyBindingEntity from "../../entity/KeyBindingEntity.js"
|
import KeyBindingEntity from "../../entity/KeyBindingEntity.js"
|
||||||
|
|
||||||
/** @typedef {import("../../Blueprint.js").default} Blueprint */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {Element} T
|
* @template {Element} T
|
||||||
* @extends IInput<T>
|
* @extends IInput<T>
|
||||||
|
|||||||
@@ -3,11 +3,6 @@ import IDraggableElement from "../../element/IDraggableElement.js"
|
|||||||
import IPointing from "./IPointing.js"
|
import IPointing from "./IPointing.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../Blueprint.js").default} Blueprint
|
|
||||||
* @typedef {import("../../element/IElement.js").default} IElement
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IElement} T
|
* @template {IElement} T
|
||||||
* @extends {IPointing<T>}
|
* @extends {IPointing<T>}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import IInput from "../IInput.js"
|
import IInput from "../IInput.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/** @typedef {import("../keyboard/KeyboardShortcut.js").default} KeyboardShortcut */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {Element} T
|
* @template {Element} T
|
||||||
* @extends {IInput<T>}
|
* @extends {IInput<T>}
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import Configuration from "../../Configuration.js"
|
import Configuration from "../../Configuration.js"
|
||||||
import IPointing from "./IPointing.js"
|
import IPointing from "./IPointing.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../Blueprint.js").default} Blueprint
|
|
||||||
* @typedef {import("../keyboard/KeyboardShortcut.js").default} KeyboardShortcut
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {Element} T
|
* @template {Element} T
|
||||||
* @extends {IPointing<T>}
|
* @extends {IPointing<T>}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import MouseMoveDraggable from "./MouseMoveDraggable.js"
|
import MouseMoveDraggable from "./MouseMoveDraggable.js"
|
||||||
|
|
||||||
/** @typedef {import("../../Blueprint.js").default} Blueprint */
|
|
||||||
|
|
||||||
export default class MouseClickDrag extends MouseMoveDraggable {
|
export default class MouseClickDrag extends MouseMoveDraggable {
|
||||||
|
|
||||||
#onClicked
|
#onClicked
|
||||||
|
|||||||
@@ -2,14 +2,6 @@ import Configuration from "../../Configuration.js"
|
|||||||
import ElementFactory from "../../element/ElementFactory.js"
|
import ElementFactory from "../../element/ElementFactory.js"
|
||||||
import IMouseClickDrag from "./IMouseClickDrag.js"
|
import IMouseClickDrag from "./IMouseClickDrag.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../Blueprint.js").default} Blueprint
|
|
||||||
* @typedef {import("../../element/LinkElement.js").default} LinkElement
|
|
||||||
* @typedef {import("../../element/LinkElement.js").LinkElementConstructor} LinkElementConstructor
|
|
||||||
* @typedef {import("../../element/PinElement.js").default} PinElement
|
|
||||||
* @typedef {import("../../template/pin/KnotPinTemplate.js").default} KnotPinTemplate
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends IMouseClickDrag<PinElement> */
|
/** @extends IMouseClickDrag<PinElement> */
|
||||||
export default class MouseCreateLink extends IMouseClickDrag {
|
export default class MouseCreateLink extends IMouseClickDrag {
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import IMouseClickDrag from "./IMouseClickDrag.js"
|
import IMouseClickDrag from "./IMouseClickDrag.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/IDraggableElement.js").default} IDraggableElement
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IDraggableElement} T
|
* @template {IDraggableElement} T
|
||||||
* @extends {IMouseClickDrag<T>}
|
* @extends {IMouseClickDrag<T>}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import IMouseClickDrag from "./IMouseClickDrag.js"
|
import IMouseClickDrag from "./IMouseClickDrag.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/IDraggableElement.js").default} IDraggableElement
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IDraggableElement} T
|
* @template {IDraggableElement} T
|
||||||
* @extends {IMouseClickDrag<T>}
|
* @extends {IMouseClickDrag<T>}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import MouseMoveDraggable from "./MouseMoveDraggable.js"
|
import MouseMoveDraggable from "./MouseMoveDraggable.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("../../template/node/CommentNodeTemplate.js").default} CommentNodeTemplate
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends {MouseMoveDraggable<NodeElement>} */
|
/** @extends {MouseMoveDraggable<NodeElement>} */
|
||||||
export default class MouseMoveNodes extends MouseMoveDraggable {
|
export default class MouseMoveNodes extends MouseMoveDraggable {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import IPointing from "./IPointing.js"
|
import IPointing from "./IPointing.js"
|
||||||
|
|
||||||
/** @typedef {import("../../Blueprint.js").default} Blueprint */
|
|
||||||
|
|
||||||
export default class MouseWheel extends IPointing {
|
export default class MouseWheel extends IPointing {
|
||||||
|
|
||||||
static #ignoreEvent =
|
static #ignoreEvent =
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import Serializer from "./Serializer.js"
|
import Serializer from "./Serializer.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValue} AnyValue
|
* @template {SimpleValueType<SimpleValue>} T
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValueConstructor<*>} AnyValueConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @extends {Serializer<T>}
|
* @extends {Serializer<T>}
|
||||||
*/
|
*/
|
||||||
export default class CustomSerializer extends Serializer {
|
export default class CustomSerializer extends Serializer {
|
||||||
@@ -14,8 +9,8 @@ export default class CustomSerializer extends Serializer {
|
|||||||
#objectWriter
|
#objectWriter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {(v: T, insideString: Boolean) => String} objectWriter
|
* @param {(v: ConstructedType<T>, insideString: Boolean) => String} objectWriter
|
||||||
* @param {AnyValueConstructor} entityType
|
* @param {T} entityType
|
||||||
*/
|
*/
|
||||||
constructor(objectWriter, entityType) {
|
constructor(objectWriter, entityType) {
|
||||||
super(entityType)
|
super(entityType)
|
||||||
@@ -23,7 +18,7 @@ export default class CustomSerializer extends Serializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {T} entity
|
* @param {ConstructedType<T>} entity
|
||||||
* @param {Boolean} insideString
|
* @param {Boolean} insideString
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,17 +6,6 @@ import Serializable from "./Serializable.js"
|
|||||||
import Union from "../entity/Union.js"
|
import Union from "../entity/Union.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import ("../entity/IEntity").AnyValue} AnyValue
|
|
||||||
* @typedef {import ("../entity/IEntity").AttributeType} AttributeType
|
|
||||||
* @typedef {import ("../entity/IEntity").AttributeInformation} AttributeInformation
|
|
||||||
* @typedef {import ("../entity/IEntity").EntityConstructor} EntityConstructor
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @typedef {import ("../entity/IEntity").AnyValueConstructor<T>} AnyValueConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
let P = Parsimmon
|
let P = Parsimmon
|
||||||
|
|
||||||
export default class Grammar {
|
export default class Grammar {
|
||||||
@@ -133,9 +122,10 @@ export default class Grammar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AttributeType} type
|
* @template {SimpleValueType<SimpleValue>} T
|
||||||
* @returns {Parsimmon.Parser<any>}
|
* @param {T} type
|
||||||
*/
|
* @returns {Parsimmon.Parser<ConstructedType<T>>}
|
||||||
|
*/
|
||||||
static grammarFor(
|
static grammarFor(
|
||||||
attribute,
|
attribute,
|
||||||
type = attribute?.constructor === Object
|
type = attribute?.constructor === Object
|
||||||
@@ -181,7 +171,6 @@ export default class Grammar {
|
|||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
if (type?.prototype instanceof Serializable) {
|
if (type?.prototype instanceof Serializable) {
|
||||||
// @ts-expect-error
|
|
||||||
return /** @type {typeof Serializable} */(type).grammar
|
return /** @type {typeof Serializable} */(type).grammar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,8 +191,8 @@ export default class Grammar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {AnyValue} T
|
* @template {SimpleValueType<SimpleValue>} T
|
||||||
* @param {AnyValueConstructor<T>} entityType
|
* @param {T} entityType
|
||||||
* @param {String[]} key
|
* @param {String[]} key
|
||||||
* @returns {AttributeInformation}
|
* @returns {AttributeInformation}
|
||||||
*/
|
*/
|
||||||
@@ -256,7 +245,7 @@ export default class Grammar {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IEntity} T
|
* @template {IEntity} T
|
||||||
* @param {new (...args: any) => T} entityType
|
* @param {AnyConstructor<T> & EntityConstructor} entityType
|
||||||
* @param {Boolean | Number} acceptUnknownKeys Number to specify the limit or true, to let it be a reasonable value
|
* @param {Boolean | Number} acceptUnknownKeys Number to specify the limit or true, to let it be a reasonable value
|
||||||
* @returns {Parsimmon.Parser<T>}
|
* @returns {Parsimmon.Parser<T>}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import PinEntity from "../entity/PinEntity.js"
|
|||||||
import Serializer from "./Serializer.js"
|
import Serializer from "./Serializer.js"
|
||||||
import SerializerFactory from "./SerializerFactory.js"
|
import SerializerFactory from "./SerializerFactory.js"
|
||||||
|
|
||||||
|
/** @extends Serializer<ObjectEntityConstructor> */
|
||||||
export default class ObjectSerializer extends Serializer {
|
export default class ObjectSerializer extends Serializer {
|
||||||
|
|
||||||
constructor(entityType = ObjectEntity) {
|
constructor(entityType = ObjectEntity) {
|
||||||
|
|||||||
@@ -3,32 +3,22 @@ import IEntity from "../entity/IEntity.js"
|
|||||||
import SerializerFactory from "./SerializerFactory.js"
|
import SerializerFactory from "./SerializerFactory.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
/** @template {SimpleValueType<SimpleValue>} T */
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValue} AnyValue
|
|
||||||
* @typedef {import("../entity/IEntity.js").EntityConstructor} EntityConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValueConstructor<T>} AnyValueConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @template {AnyValue} T */
|
|
||||||
export default class Serializer {
|
export default class Serializer {
|
||||||
|
|
||||||
/** @type {(v: String) => String} */
|
/** @type {(v: String) => String} */
|
||||||
static same = v => v
|
static same = v => v
|
||||||
|
|
||||||
/** @type {(entity: AnyValue, serialized: String) => String} */
|
/** @type {(entity: SimpleValue, serialized: String) => String} */
|
||||||
static notWrapped = (entity, serialized) => serialized
|
static notWrapped = (entity, serialized) => serialized
|
||||||
|
|
||||||
/** @type {(entity: AnyValue, serialized: String) => String} */
|
/** @type {(entity: SimpleValue, serialized: String) => String} */
|
||||||
static bracketsWrapped = (entity, serialized) => `(${serialized})`
|
static bracketsWrapped = (entity, serialized) => `(${serialized})`
|
||||||
|
|
||||||
/** @param {AnyValueConstructor<T>} entityType */
|
/** @param {T} entityType */
|
||||||
constructor(
|
constructor(
|
||||||
entityType,
|
entityType,
|
||||||
/** @type {(entity: T, serialized: String) => String} */
|
/** @type {(entity: ConstructedType<T>, serialized: String) => String} */
|
||||||
wrap = (entity, serialized) => serialized,
|
wrap = (entity, serialized) => serialized,
|
||||||
attributeSeparator = ",",
|
attributeSeparator = ",",
|
||||||
trailingSeparator = false,
|
trailingSeparator = false,
|
||||||
@@ -45,13 +35,13 @@ export default class Serializer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} value
|
* @param {String} value
|
||||||
* @returns {T}
|
* @returns {ConstructedType<T>}
|
||||||
*/
|
*/
|
||||||
read(value) {
|
read(value) {
|
||||||
return this.doRead(value.trim())
|
return this.doRead(value.trim())
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {T} value */
|
/** @param {ConstructedType<T>} value */
|
||||||
write(value, insideString = false) {
|
write(value, insideString = false) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
return this.doWrite(value, insideString)
|
return this.doWrite(value, insideString)
|
||||||
@@ -59,7 +49,7 @@ export default class Serializer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} value
|
* @param {String} value
|
||||||
* @returns {T}
|
* @returns {ConstructedType<T>}
|
||||||
*/
|
*/
|
||||||
doRead(value) {
|
doRead(value) {
|
||||||
let grammar = Grammar.grammarFor(undefined, this.entityType)
|
let grammar = Grammar.grammarFor(undefined, this.entityType)
|
||||||
@@ -71,7 +61,7 @@ export default class Serializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {T & IEntity} entity
|
* @param {ConstructedType<T> & IEntity} entity
|
||||||
* @param {Boolean} insideString
|
* @param {Boolean} insideString
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
@@ -152,7 +142,6 @@ export default class Serializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showProperty(entity, key) {
|
showProperty(entity, key) {
|
||||||
// @ts-expect-error
|
|
||||||
const attribute = /** @type {EntityConstructor} */(this.entityType).attributes[key]
|
const attribute = /** @type {EntityConstructor} */(this.entityType).attributes[key]
|
||||||
if (attribute?.constructor === Object && attribute.ignored) {
|
if (attribute?.constructor === Object && attribute.ignored) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -1,38 +1,22 @@
|
|||||||
/**
|
|
||||||
* @typedef {import("../entity/IEntity.js").default} IEntity
|
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValue} AnyValue
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValueConstructor<T>} AnyValueConstructor
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @typedef {import("./Serializer.js").default<T>} Serializer
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class SerializerFactory {
|
export default class SerializerFactory {
|
||||||
|
|
||||||
/** @type {Map<AnyValueConstructor<AnyValue>, Serializer<AnyValue>>} */
|
|
||||||
static #serializers = new Map()
|
static #serializers = new Map()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {AnyValue} T
|
* @template {SimpleValueType<SimpleValue>} T
|
||||||
* @param {AnyValueConstructor<T>} entity
|
* @param {T} type
|
||||||
* @param {Serializer<T>} object
|
* @param {Serializer<T>} object
|
||||||
*/
|
*/
|
||||||
static registerSerializer(entity, object) {
|
static registerSerializer(type, object) {
|
||||||
SerializerFactory.#serializers.set(entity, object)
|
SerializerFactory.#serializers.set(type, object)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {AnyValue} T
|
* @template {SimpleValueType<any>} T
|
||||||
* @param {new (...any) => T} entity
|
* @param {T} type
|
||||||
* @returns {Serializer<T>}
|
* @returns {Serializer<ConstructedType<T>>}
|
||||||
*/
|
*/
|
||||||
static getSerializer(entity) {
|
static getSerializer(type) {
|
||||||
// @ts-expect-error
|
return SerializerFactory.#serializers.get(type)
|
||||||
return SerializerFactory.#serializers.get(entity)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,23 +2,18 @@ import Serializer from "./Serializer.js"
|
|||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValue} AnyValue
|
* @template {SimpleValueType<SimpleValue>} T
|
||||||
* @typedef {import("../entity/IEntity.js").AnyValueConstructor<*>} AnyValueConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @extends {Serializer<T>}
|
* @extends {Serializer<T>}
|
||||||
*/
|
*/
|
||||||
export default class ToStringSerializer extends Serializer {
|
export default class ToStringSerializer extends Serializer {
|
||||||
|
|
||||||
/** @param {AnyValueConstructor} entityType */
|
/** @param {T} entityType */
|
||||||
constructor(entityType) {
|
constructor(entityType) {
|
||||||
super(entityType)
|
super(entityType)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {T} entity
|
* @param {ConstructedType<T>} entity
|
||||||
* @param {Boolean} insideString
|
* @param {Boolean} insideString
|
||||||
*/
|
*/
|
||||||
doWrite(entity, insideString, indentation = "") {
|
doWrite(entity, insideString, indentation = "") {
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ import VariableReferenceEntity from "../entity/VariableReferenceEntity.js"
|
|||||||
import Vector2DEntity from "../entity/Vector2DEntity.js"
|
import Vector2DEntity from "../entity/Vector2DEntity.js"
|
||||||
import VectorEntity from "../entity/VectorEntity.js"
|
import VectorEntity from "../entity/VectorEntity.js"
|
||||||
|
|
||||||
/** @typedef {import("../entity/IEntity.js").AnySimpleValue} AnySimpleValue */
|
|
||||||
|
|
||||||
Grammar.unknownValue =
|
Grammar.unknownValue =
|
||||||
Parsimmon.alt(
|
Parsimmon.alt(
|
||||||
// Remember to keep the order, otherwise parsing might fail
|
// Remember to keep the order, otherwise parsing might fail
|
||||||
@@ -78,7 +76,6 @@ export default function initializeSerializerFactory() {
|
|||||||
SerializerFactory.registerSerializer(
|
SerializerFactory.registerSerializer(
|
||||||
Array,
|
Array,
|
||||||
new CustomSerializer(
|
new CustomSerializer(
|
||||||
/** @param {AnySimpleValue[]} array */
|
|
||||||
(array, insideString) =>
|
(array, insideString) =>
|
||||||
`(${array
|
`(${array
|
||||||
.map(v =>
|
.map(v =>
|
||||||
@@ -253,9 +250,7 @@ export default function initializeSerializerFactory() {
|
|||||||
String,
|
String,
|
||||||
new CustomSerializer(
|
new CustomSerializer(
|
||||||
(value, insideString) => insideString
|
(value, insideString) => insideString
|
||||||
// @ts-expect-error
|
|
||||||
? Utility.escapeString(value)
|
? Utility.escapeString(value)
|
||||||
// @ts-expect-error
|
|
||||||
: `"${Utility.escapeString(value)}"`,
|
: `"${Utility.escapeString(value)}"`,
|
||||||
String
|
String
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,14 +14,6 @@ import Unfocus from "../input/mouse/Unfocus.js"
|
|||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
import Zoom from "../input/mouse/Zoom.js"
|
import Zoom from "../input/mouse/Zoom.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../Blueprint.js").default} Blueprint
|
|
||||||
* @typedef {import("../element/PinElement.js").default} PinElement
|
|
||||||
* @typedef {import("../element/SelectorElement.js").default} SelectorElement
|
|
||||||
* @typedef {import("../entity/PinReferenceEntity.js").default} PinReferenceEntity
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends ITemplate<Blueprint> */
|
/** @extends ITemplate<Blueprint> */
|
||||||
export default class BlueprintTemplate extends ITemplate {
|
export default class BlueprintTemplate extends ITemplate {
|
||||||
|
|
||||||
@@ -226,7 +218,7 @@ export default class BlueprintTemplate extends ITemplate {
|
|||||||
/** @param {PinReferenceEntity} pinReference */
|
/** @param {PinReferenceEntity} pinReference */
|
||||||
getPin(pinReference) {
|
getPin(pinReference) {
|
||||||
return /** @type {PinElement} */(this.blueprint.querySelector(
|
return /** @type {PinElement} */(this.blueprint.querySelector(
|
||||||
`ueb-node[data-name="${pinReference.objectName}"] ueb-pin[data-id="${pinReference.pinGuid}"]`
|
`ueb-node[data-title="${pinReference.objectName}"] ueb-pin[data-id="${pinReference.pinGuid}"]`
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import IDraggableControlTemplate from "./IDraggableControlTemplate.js"
|
import IDraggableControlTemplate from "./IDraggableControlTemplate.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/** @typedef {import("../element/ColorHandlerElement.js").default} ColorHandlerElement */
|
|
||||||
|
|
||||||
/** @extends {IDraggableControlTemplate<ColorHandlerElement>} */
|
/** @extends {IDraggableControlTemplate<ColorHandlerElement>} */
|
||||||
export default class ColorHandlerTemplate extends IDraggableControlTemplate {
|
export default class ColorHandlerTemplate extends IDraggableControlTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import IDraggableControlTemplate from "./IDraggableControlTemplate.js"
|
import IDraggableControlTemplate from "./IDraggableControlTemplate.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/** @typedef {import("../element/ColorHandlerElement.js").default} ColorHandlerElement */
|
|
||||||
|
|
||||||
/** @extends {IDraggableControlTemplate<ColorHandlerElement>} */
|
/** @extends {IDraggableControlTemplate<ColorHandlerElement>} */
|
||||||
export default class ColorSliderTemplate extends IDraggableControlTemplate {
|
export default class ColorSliderTemplate extends IDraggableControlTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import IDraggableTemplate from "./IDraggableTemplate.js"
|
import IDraggableTemplate from "./IDraggableTemplate.js"
|
||||||
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable.js"
|
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/IDraggableElement.js").default} IDraggableElement
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IDraggableElement} T
|
* @template {IDraggableElement} T
|
||||||
* @extends {IDraggableTemplate<T>}
|
* @extends {IDraggableTemplate<T>}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import IDraggableTemplate from "./IDraggableTemplate.js"
|
import IDraggableTemplate from "./IDraggableTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/IDraggableElement.js").default} IDraggableElement
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IDraggableElement} T
|
* @template {IDraggableElement} T
|
||||||
* @extends {IDraggableTemplate<T>}
|
* @extends {IDraggableTemplate<T>}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import ITemplate from "./ITemplate.js"
|
|||||||
import KeyboardShortcut from "../input/keyboard/KeyboardShortcut.js"
|
import KeyboardShortcut from "../input/keyboard/KeyboardShortcut.js"
|
||||||
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable.js"
|
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable.js"
|
||||||
|
|
||||||
/** @typedef {import("../element/IDraggableElement.js").default} IDraggableElement */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IDraggableElement} T
|
* @template {IDraggableElement} T
|
||||||
* @extends {ITemplate<T>}
|
* @extends {ITemplate<T>}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import ITemplate from "./ITemplate.js"
|
import ITemplate from "./ITemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/IFromToPositionedElement.js").default} IFromToPositionedElement
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {IFromToPositionedElement} T
|
* @template {IFromToPositionedElement} T
|
||||||
* @extends {ITemplate<T>}
|
* @extends {ITemplate<T>}
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import MouseClickDrag from "../input/mouse/MouseClickDrag.js"
|
import MouseClickDrag from "../input/mouse/MouseClickDrag.js"
|
||||||
import NodeTemplate from "./node/NodeTemplate.js"
|
import NodeTemplate from "./node/NodeTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class IResizeableTemplate extends NodeTemplate {
|
export default class IResizeableTemplate extends NodeTemplate {
|
||||||
|
|
||||||
#THandler = document.createElement("div")
|
#THandler = document.createElement("div")
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
import IDraggablePositionedTemplate from "./IDraggablePositionedTemplate.js"
|
import IDraggablePositionedTemplate from "./IDraggablePositionedTemplate.js"
|
||||||
import MouseMoveNodes from "../input/mouse/MouseMoveNodes.js"
|
import MouseMoveNodes from "../input/mouse/MouseMoveNodes.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("../input/mouse/MouseMoveDraggable.js").default} MouseMoveDraggable
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {NodeElement} T
|
* @template {NodeElement} T
|
||||||
* @extends {IDraggablePositionedTemplate<T>}
|
* @extends {IDraggablePositionedTemplate<T>}
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
import { html } from "lit"
|
import { html } from "lit"
|
||||||
|
|
||||||
/**
|
/** @template {IElement} ElementT */
|
||||||
* @typedef {import("../element/IElement.js").default} IElement
|
|
||||||
* @typedef {import("../input/IInput.js").default} IInput
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @template {IElement} T */
|
|
||||||
export default class ITemplate {
|
export default class ITemplate {
|
||||||
|
|
||||||
/** @type {T} */
|
/** @type {ElementT} */
|
||||||
element
|
element
|
||||||
|
|
||||||
get blueprint() {
|
get blueprint() {
|
||||||
@@ -22,7 +16,7 @@ export default class ITemplate {
|
|||||||
return this.#inputObjects
|
return this.#inputObjects
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {T} element */
|
/** @param {ElementT} element */
|
||||||
initialize(element) {
|
initialize(element) {
|
||||||
this.element = element
|
this.element = element
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,6 @@ import MouseDbClick from "../input/mouse/MouseDbClick.js"
|
|||||||
import Shortcuts from "../Shortcuts.js"
|
import Shortcuts from "../Shortcuts.js"
|
||||||
import Utility from "../Utility.js"
|
import Utility from "../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../element/LinkElement.js").default} LinkElement
|
|
||||||
* @typedef {import("../element/LinkElement.js").LinkElementConstructor} LinkElementConstructor
|
|
||||||
* @typedef {import("../element/NodeElement.js").NodeElementConstructor} NodeElementConstructor
|
|
||||||
* @typedef {import("./node/KnotNodeTemplate.js").default} KnotNodeTemplate
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/** @extends {IFromToPositionedTemplate<LinkElement>} */
|
/** @extends {IFromToPositionedTemplate<LinkElement>} */
|
||||||
export default class LinkTemplate extends IFromToPositionedTemplate {
|
export default class LinkTemplate extends IFromToPositionedTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import IFromToPositionedTemplate from "./IFromToPositionedTemplate.js"
|
import IFromToPositionedTemplate from "./IFromToPositionedTemplate.js"
|
||||||
|
|
||||||
/** @typedef {import("../element/SelectorElement.js").default} SelectorElement */
|
|
||||||
|
|
||||||
/** @extends IFromToPositionedTemplate<SelectorElement> */
|
/** @extends IFromToPositionedTemplate<SelectorElement> */
|
||||||
export default class SelectorTemplate extends IFromToPositionedTemplate {
|
export default class SelectorTemplate extends IFromToPositionedTemplate {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,6 @@ import Configuration from "../../Configuration.js"
|
|||||||
import IResizeableTemplate from "../IResizeableTemplate.js"
|
import IResizeableTemplate from "../IResizeableTemplate.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class CommentNodeTemplate extends IResizeableTemplate {
|
export default class CommentNodeTemplate extends IResizeableTemplate {
|
||||||
|
|
||||||
#selectableAreaHeight = 0
|
#selectableAreaHeight = 0
|
||||||
|
|||||||
@@ -4,11 +4,6 @@ import ElementFactory from "../../element/ElementFactory.js"
|
|||||||
import MinimalPinTemplate from "../pin/MinimalPinTemplate.js"
|
import MinimalPinTemplate from "../pin/MinimalPinTemplate.js"
|
||||||
import NodeTemplate from "./NodeTemplate.js"
|
import NodeTemplate from "./NodeTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/PinElement.js").PinElementConstructor} PinElementConstructor
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class EventNodeTemplate extends NodeTemplate {
|
export default class EventNodeTemplate extends NodeTemplate {
|
||||||
|
|
||||||
static nodeStyleClasses = [...super.nodeStyleClasses, "ueb-node-style-event"]
|
static nodeStyleClasses = [...super.nodeStyleClasses, "ueb-node-style-event"]
|
||||||
|
|||||||
@@ -4,12 +4,6 @@ import ElementFactory from "../../element/ElementFactory.js"
|
|||||||
import KnotPinTemplate from "../pin/KnotPinTemplate.js"
|
import KnotPinTemplate from "../pin/KnotPinTemplate.js"
|
||||||
import NodeTemplate from "./NodeTemplate.js"
|
import NodeTemplate from "./NodeTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("../../element/PinElement.js").default} PinElement
|
|
||||||
* @typedef {import("../../element/PinElement.js").PinElementConstructor} PinElementConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class KnotNodeTemplate extends NodeTemplate {
|
export default class KnotNodeTemplate extends NodeTemplate {
|
||||||
|
|
||||||
static #traversedPin = new Set()
|
static #traversedPin = new Set()
|
||||||
|
|||||||
@@ -4,19 +4,9 @@ import ISelectableDraggableTemplate from "../ISelectableDraggableTemplate.js"
|
|||||||
import SVGIcon from "../../SVGIcon.js"
|
import SVGIcon from "../../SVGIcon.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("../../element/PinElement.js").default} PinElement
|
|
||||||
* @typedef {import("../../element/PinElement.js").PinElementConstructor} PinElementConstructor
|
|
||||||
* @typedef {import("../../entity/PinEntity.js").default} PinEntity
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends {ISelectableDraggableTemplate<NodeElement>} */
|
/** @extends {ISelectableDraggableTemplate<NodeElement>} */
|
||||||
export default class NodeTemplate extends ISelectableDraggableTemplate {
|
export default class NodeTemplate extends ISelectableDraggableTemplate {
|
||||||
|
|
||||||
/** @typedef {typeof NodeTemplate} NodeTemplateConstructor */
|
|
||||||
|
|
||||||
static nodeStyleClasses = ["ueb-node-style-default"]
|
static nodeStyleClasses = ["ueb-node-style-default"]
|
||||||
|
|
||||||
#hasSubtitle = false
|
#hasSubtitle = false
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import Configuration from "../../Configuration.js"
|
import Configuration from "../../Configuration.js"
|
||||||
import VariableManagementNodeTemplate from "./VariableMangementNodeTemplate.js"
|
import VariableManagementNodeTemplate from "./VariableMangementNodeTemplate.js"
|
||||||
|
|
||||||
/** @typedef {import("../../element/NodeElement.js").default} NodeElement */
|
|
||||||
|
|
||||||
export default class VariableAccessNodeTemplate extends VariableManagementNodeTemplate {
|
export default class VariableAccessNodeTemplate extends VariableManagementNodeTemplate {
|
||||||
|
|
||||||
/** @param {NodeElement} element */
|
/** @param {NodeElement} element */
|
||||||
|
|||||||
@@ -3,11 +3,6 @@ import ElementFactory from "../../element/ElementFactory.js"
|
|||||||
import NodeTemplate from "./NodeTemplate.js"
|
import NodeTemplate from "./NodeTemplate.js"
|
||||||
import SVGIcon from "../../SVGIcon.js"
|
import SVGIcon from "../../SVGIcon.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/NodeElement.js").default} NodeElement
|
|
||||||
* @typedef {import("../../element/PinElement.js").PinElementConstructor} PinElementConstructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class VariableManagementNodeTemplate extends NodeTemplate {
|
export default class VariableManagementNodeTemplate extends NodeTemplate {
|
||||||
|
|
||||||
#hasInput = false
|
#hasInput = false
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { html } from "lit"
|
|||||||
import MouseIgnore from "../../input/mouse/MouseIgnore.js"
|
import MouseIgnore from "../../input/mouse/MouseIgnore.js"
|
||||||
import PinTemplate from "./PinTemplate.js"
|
import PinTemplate from "./PinTemplate.js"
|
||||||
|
|
||||||
/** @typedef {import("lit").PropertyValues} PropertyValues */
|
|
||||||
|
|
||||||
/** @extends PinTemplate<Boolean> */
|
/** @extends PinTemplate<Boolean> */
|
||||||
export default class BoolPinTemplate extends PinTemplate {
|
export default class BoolPinTemplate extends PinTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ import { html } from "lit"
|
|||||||
import ITemplate from "../ITemplate.js"
|
import ITemplate from "../ITemplate.js"
|
||||||
import MouseIgnore from "../../input/mouse/MouseIgnore.js"
|
import MouseIgnore from "../../input/mouse/MouseIgnore.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import ("../../element/DropdownElement.js").default} DropdownElement
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends {ITemplate<DropdownElement>} */
|
/** @extends {ITemplate<DropdownElement>} */
|
||||||
export default class DropdownTemplate extends ITemplate {
|
export default class DropdownTemplate extends ITemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,6 @@ import Configuration from "../../Configuration.js"
|
|||||||
import IInputPinTemplate from "./IInputPinTemplate.js"
|
import IInputPinTemplate from "./IInputPinTemplate.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/DropdownElement.js").default} DropdownElement
|
|
||||||
* @typedef {import("../../element/PinElement.js").AnyValue} AnyValue
|
|
||||||
* @typedef {import("../../entity/EnumEntity.js").default} EnumEntity
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @typedef {import("../../element/PinElement.js").default<T>} PinElement
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends IInputPinTemplate<EnumEntity> */
|
/** @extends IInputPinTemplate<EnumEntity> */
|
||||||
export default class EnumPinTemplate extends IInputPinTemplate {
|
export default class EnumPinTemplate extends IInputPinTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ import Configuration from "../../Configuration.js"
|
|||||||
import PinTemplate from "./PinTemplate.js"
|
import PinTemplate from "./PinTemplate.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/** @typedef {import("lit").PropertyValues} PropertyValues */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template {AnyValue} T
|
||||||
* @extends PinTemplate<T>
|
* @extends PinTemplate<T>
|
||||||
*/
|
*/
|
||||||
export default class IInputPinTemplate extends PinTemplate {
|
export default class IInputPinTemplate extends PinTemplate {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import IInputPinTemplate from "./IInputPinTemplate.js"
|
import IInputPinTemplate from "./IInputPinTemplate.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template {AnyValue} T
|
||||||
* @extends IInputPinTemplate<T>
|
* @extends IInputPinTemplate<T>
|
||||||
*/
|
*/
|
||||||
export default class INumericPinTemplate extends IInputPinTemplate {
|
export default class INumericPinTemplate extends IInputPinTemplate {
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import ITemplate from "../ITemplate.js"
|
import ITemplate from "../ITemplate.js"
|
||||||
import MouseIgnore from "../../input/mouse/MouseIgnore.js"
|
import MouseIgnore from "../../input/mouse/MouseIgnore.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import ("../../element/InputElement").default} InputElement
|
|
||||||
* @typedef {import ("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends {ITemplate<InputElement>} */
|
/** @extends {ITemplate<InputElement>} */
|
||||||
export default class InputTemplate extends ITemplate {
|
export default class InputTemplate extends ITemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { html } from "lit"
|
import { html } from "lit"
|
||||||
import INumericPinTemplate from "./INumericPinTemplate.js"
|
import INumericPinTemplate from "./INumericPinTemplate.js"
|
||||||
|
|
||||||
/** @typedef {import("../../entity/IntegerEntity.js").default} IntegerEntity */
|
|
||||||
|
|
||||||
/** @extends INumericPinTemplate<IntegerEntity> */
|
/** @extends INumericPinTemplate<IntegerEntity> */
|
||||||
export default class IntPinTemplate extends INumericPinTemplate {
|
export default class IntPinTemplate extends INumericPinTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,6 @@ import { html } from "lit"
|
|||||||
import MinimalPinTemplate from "./MinimalPinTemplate.js"
|
import MinimalPinTemplate from "./MinimalPinTemplate.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../entity/PinEntity.js").default} KnotEntity
|
|
||||||
* @typedef {import("../node/KnotNodeTemplate.js").default} KnotNodeTemplate
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends MinimalPinTemplate<KnotEntity> */
|
/** @extends MinimalPinTemplate<KnotEntity> */
|
||||||
export default class KnotPinTemplate extends MinimalPinTemplate {
|
export default class KnotPinTemplate extends MinimalPinTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,6 @@ import Configuration from "../../Configuration.js"
|
|||||||
import ElementFactory from "../../element/ElementFactory.js"
|
import ElementFactory from "../../element/ElementFactory.js"
|
||||||
import PinTemplate from "./PinTemplate.js"
|
import PinTemplate from "./PinTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/WindowElement.js").default} WindowElement
|
|
||||||
* @typedef {import("../../element/WindowElement.js").WindowElementConstructor} WindowElementConstructor
|
|
||||||
* @typedef {import("../../entity/LinearColorEntity.js").default} LinearColorEntity
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @extends PinTemplate<LinearColorEntity> */
|
/** @extends PinTemplate<LinearColorEntity> */
|
||||||
export default class LinearColorPinTemplate extends PinTemplate {
|
export default class LinearColorPinTemplate extends PinTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
import { html } from "lit"
|
import { html } from "lit"
|
||||||
import PinTemplate from "./PinTemplate.js"
|
import PinTemplate from "./PinTemplate.js"
|
||||||
|
|
||||||
/** @typedef {import("../../entity/IEntity.js").AnyValue} AnyValue */
|
|
||||||
/**
|
/**
|
||||||
* @template {AnyValue} T
|
* @template {AnyValue} T
|
||||||
* @typedef {import("../../element/PinElement.js").default<T>} PinElement
|
* @extends PinTemplate<T>
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {AnyValue} T
|
|
||||||
* @extends PinTemplate<PinElement<T>>
|
|
||||||
*/
|
*/
|
||||||
export default class MinimalPinTemplate extends PinTemplate {
|
export default class MinimalPinTemplate extends PinTemplate {
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,12 @@ import VariableConversionNodeTemplate from "../node/VariableConversionNodeTempla
|
|||||||
import VariableOperationNodeTemplate from "../node/VariableOperationNodeTemplate.js"
|
import VariableOperationNodeTemplate from "../node/VariableOperationNodeTemplate.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../../input/IInput.js").default} IInput
|
* @template {AnyValue} T
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @template T
|
|
||||||
* @typedef {import("../../element/PinElement.js").default<T>} PinElement
|
* @typedef {import("../../element/PinElement.js").default<T>} PinElement
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template T
|
* @template {AnyValue} T
|
||||||
* @extends ITemplate<PinElement<T>>
|
* @extends ITemplate<PinElement<T>>
|
||||||
*/
|
*/
|
||||||
export default class PinTemplate extends ITemplate {
|
export default class PinTemplate extends ITemplate {
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import INumericPinTemplate from "./INumericPinTemplate.js"
|
|||||||
import RotatorEntity from "../../entity/RotatorEntity.js"
|
import RotatorEntity from "../../entity/RotatorEntity.js"
|
||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
|
|
||||||
/** @typedef {import("../../entity/RotatorEntity.js").default} Rotator */
|
/** @extends INumericPinTemplate<RotatorEntity> */
|
||||||
|
|
||||||
/** @extends INumericPinTemplate<Rotator> */
|
|
||||||
export default class RotatorPinTemplate extends INumericPinTemplate {
|
export default class RotatorPinTemplate extends INumericPinTemplate {
|
||||||
|
|
||||||
#getR() {
|
#getR() {
|
||||||
|
|||||||
@@ -7,11 +7,6 @@ import LinearColorEntity from "../../entity/LinearColorEntity.js"
|
|||||||
import Utility from "../../Utility.js"
|
import Utility from "../../Utility.js"
|
||||||
import WindowTemplate from "./WindowTemplate.js"
|
import WindowTemplate from "./WindowTemplate.js"
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef {import("../../element/WindowElement.js").default} WindowElement
|
|
||||||
* @typedef {import("lit").PropertyValues} PropertyValues
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default class ColorPickerWindowTemplate extends WindowTemplate {
|
export default class ColorPickerWindowTemplate extends WindowTemplate {
|
||||||
|
|
||||||
/** @type {ColorHandlerElement} */ #wheelHandler
|
/** @type {ColorHandlerElement} */ #wheelHandler
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import IDraggablePositionedTemplate from "../IDraggablePositionedTemplate.js"
|
|||||||
import MouseMoveDraggable from "../../input/mouse/MouseMoveDraggable.js"
|
import MouseMoveDraggable from "../../input/mouse/MouseMoveDraggable.js"
|
||||||
import SVGIcon from "../../SVGIcon.js"
|
import SVGIcon from "../../SVGIcon.js"
|
||||||
|
|
||||||
/** @typedef {import("../../element/WindowElement.js").default} WindowElement */
|
|
||||||
|
|
||||||
/** @extends {IDraggablePositionedTemplate<WindowElement>} */
|
/** @extends {IDraggablePositionedTemplate<WindowElement>} */
|
||||||
export default class WindowTemplate extends IDraggablePositionedTemplate {
|
export default class WindowTemplate extends IDraggablePositionedTemplate {
|
||||||
|
|
||||||
|
|||||||
204
js/types.js
Normal file
204
js/types.js
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
/**
|
||||||
|
* @template T
|
||||||
|
* @typedef {new (...args: any) => T} AnyConstructor
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @typedef {IEntity | String | Number | BigInt | Boolean | Array | MirroredEntity} SimpleValue
|
||||||
|
* @typedef {SimpleValue | Union | Union[]} AnyValue
|
||||||
|
* @typedef {SimpleValueType<SimpleValue> | SimpleValueType<SimpleValue>[] | MirroredEntity | Union | Union[] | ComputedType} AttributeType
|
||||||
|
* @typedef {(entity: IEntity) => AnyValue} ValueSupplier
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @template {SimpleValue} T
|
||||||
|
* @typedef {AnyConstructor<T> & EntityConstructor | StringConstructor | NumberConstructor | BigIntConstructor
|
||||||
|
* | BooleanConstructor | ArrayConstructor | MirroredEntityConstructor} SimpleValueType
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @template {SimpleValue} T
|
||||||
|
* @typedef {T extends String
|
||||||
|
* ? StringConstructor
|
||||||
|
* : T extends Number
|
||||||
|
* ? NumberConstructor
|
||||||
|
* : T extends BigInt
|
||||||
|
* ? BigIntConstructor
|
||||||
|
* : T extends Boolean
|
||||||
|
* ? BooleanConstructor
|
||||||
|
* : T extends Array
|
||||||
|
* ? ArrayConstructor
|
||||||
|
* : T extends MirroredEntity
|
||||||
|
* ? MirroredEntityConstructor
|
||||||
|
* : T extends IEntity
|
||||||
|
* ? AnyConstructor<T> & EntityConstructor
|
||||||
|
* : any
|
||||||
|
* } ConstructorType
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @template T
|
||||||
|
* @typedef {T extends StringConstructor
|
||||||
|
* ? String
|
||||||
|
* : T extends NumberConstructor
|
||||||
|
* ? Number
|
||||||
|
* : T extends BigIntConstructor
|
||||||
|
* ? BigInt
|
||||||
|
* : T extends BooleanConstructor
|
||||||
|
* ? Boolean
|
||||||
|
* : T extends ArrayConstructor
|
||||||
|
* ? Array
|
||||||
|
* : T extends MirroredEntity
|
||||||
|
* ? MirroredEntity
|
||||||
|
* : T extends AnyConstructor<infer R>
|
||||||
|
* ? R
|
||||||
|
* : any
|
||||||
|
* } ConstructedType
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* type?: AttributeType,
|
||||||
|
* default?: AnyValue | ValueSupplier,
|
||||||
|
* nullable?: Boolean,
|
||||||
|
* ignored?: Boolean,
|
||||||
|
* serialized?: Boolean,
|
||||||
|
* expected?: Boolean,
|
||||||
|
* inlined?: Boolean,
|
||||||
|
* quoted?: Boolean,
|
||||||
|
* predicate?: (value: AnyValue) => Boolean,
|
||||||
|
* }} AttributeInformation
|
||||||
|
* @typedef {{ [key: String]: AttributeInformation }} AttributeDeclarations
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {CustomEvent<{ value: [Number, Number] }>} UEBDragEvent
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @template T
|
||||||
|
* @typedef {{
|
||||||
|
* (value: Boolean): BooleanConstructor,
|
||||||
|
* (value: Number): NumberConstructor,
|
||||||
|
* (value: String): StringConstructor,
|
||||||
|
* (value: BigInt): BigIntConstructor,
|
||||||
|
* (value: T): typeof value.constructor,
|
||||||
|
* }} TypeGetter
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {typeof import("./Blueprint.js").default} BlueprintConstructor
|
||||||
|
* @typedef {typeof import("./element/LinkElement.js").default} LinkElementConstructor
|
||||||
|
* @typedef {typeof import("./element/NodeElement.js").default} NodeElementConstructor
|
||||||
|
* @typedef {typeof import("./element/PinElement.js").default} PinElementConstructor
|
||||||
|
* @typedef {typeof import("./element/WindowElement.js").default} WindowElementConstructor
|
||||||
|
* @typedef {typeof import("./entity/IEntity.js").default} EntityConstructor
|
||||||
|
* @typedef {typeof import("./entity/MirroredEntity.js").default} MirroredEntityConstructor
|
||||||
|
* @typedef {typeof import("./entity/ObjectEntity.js").default} ObjectEntityConstructor
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @typedef {import("./Blueprint.js").default} Blueprint
|
||||||
|
* @typedef {import("./element/ColorHandlerElement.js").default} ColorHandlerElement
|
||||||
|
* @typedef {import("./element/ColorSliderElement.js").default} ColorSliderElement
|
||||||
|
* @typedef {import("./element/DropdownElement.js").default} DropdownElement
|
||||||
|
* @typedef {import("./element/ElementFactory.js").default} ElementFactory
|
||||||
|
* @typedef {import("./element/IDraggableControlElement.js").default} IDraggableControlElement
|
||||||
|
* @typedef {import("./element/IDraggableElement.js").default} IDraggableElement
|
||||||
|
* @typedef {import("./element/IElement.js").default} IElement
|
||||||
|
* @typedef {import("./element/IFromToPositionedElement.js").default} IFromToPositionedElement
|
||||||
|
* @typedef {import("./element/InputElement.js").default} InputElement
|
||||||
|
* @typedef {import("./element/ISelectableDraggableElement.js").default} ISelectableDraggableElement
|
||||||
|
* @typedef {import("./element/LinkElement.js").default} LinkElement
|
||||||
|
* @typedef {import("./element/NodeElement.js").default} NodeElement
|
||||||
|
* @typedef {import("./element/PinElement.js").default} PinElement
|
||||||
|
* @typedef {import("./element/SelectorElement.js").default} SelectorElement
|
||||||
|
* @typedef {import("./element/WindowElement.js").default} WindowElement
|
||||||
|
* @typedef {import("./entity/Base64ObjectsEncoded.js").default} Base64ObjectsEncoded
|
||||||
|
* @typedef {import("./entity/ByteEntity.js").default} ByteEntity
|
||||||
|
* @typedef {import("./entity/ColorChannelEntity.js").default} ColorChannelEntity
|
||||||
|
* @typedef {import("./entity/ComputedType.js").default} ComputedType
|
||||||
|
* @typedef {import("./entity/EnumDisplayValueEntity.js").default} EnumDisplayValueEntity
|
||||||
|
* @typedef {import("./entity/EnumEntity.js").default} EnumEntity
|
||||||
|
* @typedef {import("./entity/FormatTextEntity.js").default} FormatTextEntity
|
||||||
|
* @typedef {import("./entity/FunctionReferenceEntity.js").default} FunctionReferenceEntity
|
||||||
|
* @typedef {import("./entity/GuidEntity.js").default} GuidEntity
|
||||||
|
* @typedef {import("./entity/IdentifierEntity.js").default} IdentifierEntity
|
||||||
|
* @typedef {import("./entity/IEntity.js").default} IEntity
|
||||||
|
* @typedef {import("./entity/Integer64Entity.js").default} Integer64Entity
|
||||||
|
* @typedef {import("./entity/IntegerEntity.js").default} IntegerEntity
|
||||||
|
* @typedef {import("./entity/InvariantTextEntity.js").default} InvariantTextEntity
|
||||||
|
* @typedef {import("./entity/KeyBindingEntity.js").default} KeyBindingEntity
|
||||||
|
* @typedef {import("./entity/LinearColorEntity.js").default} LinearColorEntity
|
||||||
|
* @typedef {import("./entity/LocalizedTextEntity.js").default} LocalizedTextEntity
|
||||||
|
* @typedef {import("./entity/MacroGraphReferenceEntity.js").default} MacroGraphReferenceEntity
|
||||||
|
* @typedef {import("./entity/MirroredEntity.js").default} MirroredEntity
|
||||||
|
* @typedef {import("./entity/NaturalNumberEntity.js").default} NaturalNumberEntity
|
||||||
|
* @typedef {import("./entity/ObjectEntity.js").default} ObjectEntity
|
||||||
|
* @typedef {import("./entity/ObjectReferenceEntity.js").default} ObjectReferenceEntity
|
||||||
|
* @typedef {import("./entity/objects/KnotEntity.js").default} KnotEntity
|
||||||
|
* @typedef {import("./entity/PathSymbolEntity.js").default} PathSymbolEntity
|
||||||
|
* @typedef {import("./entity/PinEntity.js").default} PinEntity
|
||||||
|
* @typedef {import("./entity/PinReferenceEntity.js").default} PinReferenceEntity
|
||||||
|
* @typedef {import("./entity/PinTypeEntity.js").default} PinTypeEntity
|
||||||
|
* @typedef {import("./entity/RotatorEntity.js").default} RotatorEntity
|
||||||
|
* @typedef {import("./entity/SimpleSerializationRotatorEntity.js").default} SimpleSerializationRotatorEntity
|
||||||
|
* @typedef {import("./entity/SimpleSerializationVector2DEntity.js").default} SimpleSerializationVector2DEntity
|
||||||
|
* @typedef {import("./entity/SimpleSerializationVectorEntity.js").default} SimpleSerializationVectorEntity
|
||||||
|
* @typedef {import("./entity/SymbolEntity.js").default} SymbolEntity
|
||||||
|
* @typedef {import("./entity/TerminalTypeEntity.js").default} TerminalTypeEntity
|
||||||
|
* @typedef {import("./entity/Union.js").default} Union
|
||||||
|
* @typedef {import("./entity/UnknownKeysEntity.js").default} UnknownKeysEntity
|
||||||
|
* @typedef {import("./entity/UnknownPinEntity.js").default} UnknownPinEntity
|
||||||
|
* @typedef {import("./entity/VariableReferenceEntity.js").default} VariableReferenceEntity
|
||||||
|
* @typedef {import("./entity/Vector2DEntity.js").default} Vector2DEntity
|
||||||
|
* @typedef {import("./entity/VectorEntity.js").default} VectorEntity
|
||||||
|
* @typedef {import("./input/IInput.js").default} IInput
|
||||||
|
* @typedef {import("./template/BlueprintTemplate.js").default} BlueprintTemplate
|
||||||
|
* @typedef {import("./template/ColorHandlerTemplate.js").default} ColorHandlerTemplate
|
||||||
|
* @typedef {import("./template/ColorSliderTemplate.js").default} ColorSliderTemplate
|
||||||
|
* @typedef {import("./template/IDraggableControlTemplate.js").default} IDraggableControlTemplate
|
||||||
|
* @typedef {import("./template/IDraggablePositionedTemplate.js").default} IDraggablePositionedTemplate
|
||||||
|
* @typedef {import("./template/IDraggableTemplate.js").default} IDraggableTemplate
|
||||||
|
* @typedef {import("./template/IFromToPositionedTemplate.js").default} IFromToPositionedTemplate
|
||||||
|
* @typedef {import("./template/IResizeableTemplate.js").default} IResizeableTemplate
|
||||||
|
* @typedef {import("./template/ISelectableDraggableTemplate.js").default} ISelectableDraggableTemplate
|
||||||
|
* @typedef {import("./template/ITemplate.js").default} ITemplate
|
||||||
|
* @typedef {import("./template/LinkTemplate.js").default} LinkTemplate
|
||||||
|
* @typedef {import("./template/node/CommentNodeTemplate.js").default} CommentNodeTemplate
|
||||||
|
* @typedef {import("./template/node/EventNodeTemplate.js").default} EventNodeTemplate
|
||||||
|
* @typedef {import("./template/node/KnotNodeTemplate.js").default} KnotNodeTemplate
|
||||||
|
* @typedef {import("./template/node/NodeTemplate.js").default} NodeTemplate
|
||||||
|
* @typedef {import("./template/node/VariableAccessNodeTemplate.js").default} VariableAccessNodeTemplate
|
||||||
|
* @typedef {import("./template/node/VariableConversionNodeTemplate.js").default} VariableConversionNodeTemplate
|
||||||
|
* @typedef {import("./template/node/VariableMangementNodeTemplate.js").default} VariableMangementNodeTemplate
|
||||||
|
* @typedef {import("./template/node/VariableOperationNodeTemplate.js").default} VariableOperationNodeTemplate
|
||||||
|
* @typedef {import("./template/pin/BoolPinTemplate.js").default} BoolPinTemplate
|
||||||
|
* @typedef {import("./template/pin/DropdownTemplate.js").default} DropdownTemplate
|
||||||
|
* @typedef {import("./template/pin/EnumPinTemplate.js").default} EnumPinTemplate
|
||||||
|
* @typedef {import("./template/pin/ExecPinTemplate.js").default} ExecPinTemplate
|
||||||
|
* @typedef {import("./template/pin/IInputPinTemplate.js").default} IInputPinTemplate
|
||||||
|
* @typedef {import("./template/pin/InputTemplate.js").default} InputTemplate
|
||||||
|
* @typedef {import("./template/pin/Int64PinTemplate.js").default} Int64PinTemplate
|
||||||
|
* @typedef {import("./template/pin/IntPinTemplate.js").default} IntPinTemplate
|
||||||
|
* @typedef {import("./template/pin/INumericPinTemplate.js").default} INumericPinTemplate
|
||||||
|
* @typedef {import("./template/pin/KnotPinTemplate.js").default} KnotPinTemplate
|
||||||
|
* @typedef {import("./template/pin/LinearColorPinTemplate.js").default} LinearColorPinTemplate
|
||||||
|
* @typedef {import("./template/pin/MinimalPinTemplate.js").default} MinimalPinTemplate
|
||||||
|
* @typedef {import("./template/pin/NamePinTemplate.js").default} NamePinTemplate
|
||||||
|
* @typedef {import("./template/pin/RealPinTemplate.js").default} RealPinTemplate
|
||||||
|
* @typedef {import("./template/pin/ReferencePinTemplate.js").default} ReferencePinTemplate
|
||||||
|
* @typedef {import("./template/pin/RotatorPinTemplate.js").default} RotatorPinTemplate
|
||||||
|
* @typedef {import("./template/pin/StringPinTemplate.js").default} StringPinTemplate
|
||||||
|
* @typedef {import("./template/pin/Vector2DPinTemplate.js").default} Vector2DPinTemplate
|
||||||
|
* @typedef {import("./template/pin/VectorPinTemplate.js").default} VectorPinTemplate
|
||||||
|
* @typedef {import("./template/SelectorTemplate.js").default} SelectorTemplate
|
||||||
|
* @typedef {import("./template/window/ColorPickerWindowTemplate.js").default} ColorPickerWindowTemplate
|
||||||
|
* @typedef {import("./template/window/WindowTemplate.js").default} WindowTemplate
|
||||||
|
* @typedef {import("./input/keyboard/KeyboardShortcut.js").default} KeyboardShortcut
|
||||||
|
* @typedef {import("lit").CSSResult} CSSResult
|
||||||
|
* @typedef {import("lit").PropertyValues} PropertyValues
|
||||||
|
* @typedef {import("lit").TemplateResult} TemplateResult
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @template {SimpleValueType<SimpleValue>} T
|
||||||
|
* @typedef {import("./serialization/Serializer.js").default<T>} Serializer
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @template T
|
||||||
|
* @typedef {import("parsimmon").Success} Success
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user