Compare commits
33 Commits
e41869a9e7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
158e9c4044 | ||
|
|
334cce8af3 | ||
|
|
266036a6ec | ||
|
|
0cb4491920 | ||
|
|
710bddd8e4 | ||
|
|
4122545cff | ||
|
|
e58ff43014 | ||
|
|
c3624d8aca | ||
|
|
bf30315217 | ||
|
|
46a344db74 | ||
|
|
5de7699182 | ||
|
|
1dd5df8074 | ||
|
|
b15edd0e90 | ||
|
|
34e3989ef6 | ||
|
|
9c032b9b0b | ||
|
|
50810fec47 | ||
|
|
67ce4fd1b0 | ||
|
|
bfb96b7dde | ||
|
|
dadb236bc3 | ||
|
|
8cd1a65189 | ||
|
|
c359aae479 | ||
|
|
d90c63ceb4 | ||
|
|
313afec294 | ||
|
|
10276f7fd5 | ||
|
|
860740f3fe | ||
|
|
2de301dbed | ||
|
|
e55630f986 | ||
|
|
301e44997f | ||
|
|
0ed56594ff | ||
|
|
080c919569 | ||
|
|
2efe358891 | ||
|
|
451d8ae191 | ||
|
|
11d3247a8c |
86
buildoz.css
86
buildoz.css
@@ -23,7 +23,7 @@ bz-select > button::after {
|
||||
content: "\00BB";
|
||||
transform: rotate(90deg);
|
||||
position: absolute;
|
||||
right: 0.5em;
|
||||
right: clamp(-1em, calc(100% - 1em), 0.5em);
|
||||
top: 0;
|
||||
pointer-events: none;
|
||||
font-size: 1.5em;
|
||||
@@ -184,7 +184,7 @@ bz-slidepane[side="right"] div.handle {
|
||||
top: 50%;
|
||||
width: 11px;
|
||||
height: 40px;
|
||||
background: repeating-linear-gradient( to right, rgba(255,255,255,1) 0, rgba(255,255,255,1) 2px, rgba(0,0,0,0.2) 3px, rgba(0,0,0,0.2) 4px );
|
||||
background: repeating-linear-gradient( to right, rgba(255,255,255,1) 0, rgba(255,255,255,1) 2px, rgba(0,0,0,0.5) 3px, rgba(0,0,0,0.5) 4px );
|
||||
transform: translateY(-50%);
|
||||
cursor: ew-resize;
|
||||
}
|
||||
@@ -195,14 +195,16 @@ bz-graflow {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100vw;
|
||||
height: 50vh;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
bz-graflow .bzgf-main-container{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* BZGRAFLOW_CORE_START */
|
||||
@@ -247,4 +249,82 @@ bz-graflow button.bzgf-zoom-out{
|
||||
left: 5px;
|
||||
top: 5px;
|
||||
}
|
||||
bz-graflow path.bzgf-wirecoat{
|
||||
pointer-events: auto;
|
||||
stroke-width: 6;
|
||||
stroke: #0000!important;
|
||||
}
|
||||
bz-graflow path.bzgf-wirecoat:hover{
|
||||
stroke: #FF08!important;
|
||||
}
|
||||
bz-graflow .bzgf-nodes-container .port.selectable:hover{
|
||||
border: 5px solid #FF08!important;
|
||||
cursor: pointer;
|
||||
}
|
||||
bz-graflow .graflow-error{ background:red;color:black;position: absolute;top: 0;left: 50%;transform: translateX(-50%); }
|
||||
|
||||
/* BZGRAFLOW_CORE_END */
|
||||
|
||||
bz-grafloweditor {
|
||||
width: 98vw;
|
||||
height: 98vh;
|
||||
margin: auto;
|
||||
}
|
||||
bz-grafloweditor .bzgfe-main-container{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: grid;
|
||||
grid-template-columns: 15vw auto;
|
||||
grid-gap: 1px;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
bz-grafloweditor .bzgfe-nodes-container{
|
||||
overflow: auto;
|
||||
border: 2px solid #000;
|
||||
display: grid;
|
||||
grid-auto-flow: row;
|
||||
justify-items: center;
|
||||
}
|
||||
|
||||
bz-grafloweditor bz-graflow{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
bz-grafloweditor .bzgfe-nodes-container .bzgf-node{
|
||||
position: relative;
|
||||
margin: 5px auto;
|
||||
}
|
||||
bz-grafloweditor bz-slidepane { z-index: 10; background-color: #0008!important;}
|
||||
bz-grafloweditor bz-slidepane .inner-console{
|
||||
padding: 5px;
|
||||
background: #FFF;
|
||||
}
|
||||
bz-grafloweditor .inner-console section{
|
||||
display: grid;
|
||||
grid-auto-flow: row;
|
||||
grid-gap: 5px;
|
||||
background-color: #DDD;
|
||||
padding: 5px;
|
||||
margin: 5px auto;
|
||||
}
|
||||
|
||||
bz-grafloweditor .inner-console section .cols-2{
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-gap: 1em;
|
||||
background-color: #CCC;
|
||||
min-height: 2.5em;
|
||||
}
|
||||
|
||||
bz-grafloweditor .inner-console section .cols-2 label{
|
||||
text-align: right;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
bz-grafloweditor .inner-console section .cols-2 input{
|
||||
max-height: 2em;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
70
buildoz.js
70
buildoz.js
@@ -12,9 +12,17 @@
|
||||
*/
|
||||
|
||||
class Buildoz extends HTMLElement {
|
||||
|
||||
// static is evaluated when the class is defined, therefore while buildoz.js is executing.
|
||||
// therefore document.currentScript refers to buildoz.js (but not later!!)
|
||||
static _buildozUrl = document.currentScript?.src ?? ''
|
||||
|
||||
constructor(){
|
||||
super() // always call super() first!
|
||||
this.attrs = {}
|
||||
|
||||
// Usefull for relative dependencies, to keep lib fully portable
|
||||
this.buildozUrl = Buildoz._buildozUrl // was defined in the past
|
||||
}
|
||||
|
||||
static get observedAttributes(){ //observable attributes triggering attributeChangedCallback
|
||||
@@ -48,6 +56,17 @@ class Buildoz extends HTMLElement {
|
||||
getBZAttribute(attrName){ // Little helper for defaults
|
||||
return(this.getAttribute(attrName) || this.defaultAttrs[attrName] )
|
||||
}
|
||||
|
||||
fireEvent(eventName, detail){
|
||||
let myname = this.tagName.toLocaleLowerCase()
|
||||
myname = myname.substring(myname.indexOf('-')+1)
|
||||
const eventFullName = `bz:${myname}:${eventName}`
|
||||
this.dispatchEvent(new CustomEvent(eventFullName, {
|
||||
detail,
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
class BZselect extends Buildoz {
|
||||
@@ -271,6 +290,8 @@ class BZslidePane extends Buildoz {
|
||||
}
|
||||
this.dragMove = this.dragMove.bind(this)
|
||||
this.dragEnd = this.dragEnd.bind(this)
|
||||
this.lastClientX = 0
|
||||
this.lastClientY = 0
|
||||
// Fill with innerHTML or other DOM manip should not allow coating to be removed
|
||||
this._observer = new MutationObserver(muts => { this.coat() })
|
||||
}
|
||||
@@ -300,37 +321,62 @@ class BZslidePane extends Buildoz {
|
||||
dragStart(evt){
|
||||
evt.target.setPointerCapture(evt.pointerId)
|
||||
this.dragStartX = evt.clientX
|
||||
this.dragStartY = evt.clientY
|
||||
this.dragStartY = evt.clientY
|
||||
this.lastClientX = evt.clientX
|
||||
this.lastClientY = evt.clientY
|
||||
this.handle.addEventListener('pointermove', this.dragMove)
|
||||
this.handle.addEventListener('pointerup', this.dragEnd)
|
||||
}
|
||||
|
||||
dragMove(evt){
|
||||
const box = this.getBoundingClientRect()
|
||||
const parentBox = this.parentElement.getBoundingClientRect()
|
||||
let width, height
|
||||
const boundaryEl = this.offsetParent || this.parentElement
|
||||
const parentBox = boundaryEl.getBoundingClientRect()
|
||||
let width, height, min, max
|
||||
switch(this.getAttribute('side')){
|
||||
case 'top':
|
||||
height = (evt.clientY > box.top) ? (evt.clientY - box.top) : 0
|
||||
if(height>(parentBox.height/2)) height = Math.floor(parentBox.height/2)
|
||||
min = parseInt(this.getBZAttribute('minheight')) || 0
|
||||
if(evt.clientY > (box.top + min)) height = (evt.clientY - box.top)
|
||||
else if(evt.clientY < this.lastClientY) height = min
|
||||
else if(evt.clientY > this.lastClientY) height = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxheight')) || Math.floor(parentBox.height/2)
|
||||
height = Math.min(height, parentBox.height, max)
|
||||
this.style.height = height+'px'
|
||||
break
|
||||
case 'bottom':
|
||||
height = (evt.clientY < box.bottom) ? (box.bottom - evt.clientY) : 0
|
||||
if(height>(parentBox.height/2)) height = Math.floor(parentBox.height/2)
|
||||
min = parseInt(this.getBZAttribute('minheight')) || 0
|
||||
if(evt.clientY < (box.bottom - min)) height = (box.bottom - evt.clientY)
|
||||
else if(evt.clientY > this.lastClientY) height = min
|
||||
else if(evt.clientY < this.lastClientY) height = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxheight')) || Math.floor(parentBox.height/2)
|
||||
height = Math.min(height, parentBox.height, max)
|
||||
this.style.height = height+'px'
|
||||
break
|
||||
case 'left':
|
||||
width = (evt.clientX > box.left) ? (evt.clientX - box.left) : 0
|
||||
if(width>(parentBox.width/2)) width = Math.floor(parentBox.width/2)
|
||||
min = parseInt(this.getBZAttribute('minwidth')) || 0
|
||||
if(evt.clientX < (box.left + min)) width = (evt.clientX - box.left)
|
||||
else if(evt.clientX > this.lastClientX) width = min
|
||||
else if(evt.clientX < this.lastClientX) width = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxwidth')) || Math.floor(parentBox.width/2)
|
||||
width = Math.min(width, parentBox.width, max)
|
||||
this.style.width = width+'px'
|
||||
break
|
||||
case'right':
|
||||
width = (evt.clientX < box.right) ? (box.right - evt.clientX) : 0
|
||||
if(width>(parentBox.width/2)) width = Math.floor(parentBox.width/2)
|
||||
case 'right':
|
||||
min = parseInt(this.getBZAttribute('minwidth')) || 0
|
||||
if(evt.clientX < (box.right - min)) width = (box.right - evt.clientX)
|
||||
else if(evt.clientX < this.lastClientX) width = min
|
||||
else if(evt.clientX > this.lastClientX) width = 0
|
||||
else break
|
||||
max = parseInt(this.getBZAttribute('maxwidth')) || Math.floor(parentBox.width/2)
|
||||
width = Math.min(width, parentBox.width, max)
|
||||
this.style.width = width+'px'
|
||||
break
|
||||
}
|
||||
this.lastClientX = evt.clientX
|
||||
this.lastClientY = evt.clientY
|
||||
}
|
||||
|
||||
dragEnd(evt){
|
||||
|
||||
191
bzGraflow-editor.js
Normal file
191
bzGraflow-editor.js
Normal file
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* _ ___ Another
|
||||
* / |/ (_)______ __ _____
|
||||
* / / / __(_-</ // (_-<
|
||||
* /_/|_/_/\__/___/\_, /___/
|
||||
* /___/
|
||||
* production !
|
||||
*
|
||||
* Licensed under the MIT License:
|
||||
* This code is free to use and modify,
|
||||
* as long as the copyright notice and license are kept.
|
||||
*/
|
||||
class BZgrafloweditor extends Buildoz{
|
||||
constructor(){
|
||||
super()
|
||||
this.defaultAttrs = { }
|
||||
window.debugEditor = this
|
||||
}
|
||||
|
||||
async connectedCallback() {
|
||||
await customElements.whenDefined('bz-graflow')
|
||||
await customElements.whenDefined('bz-slidepane')
|
||||
await customElements.whenDefined('bz-select')
|
||||
super.connectedCallback()
|
||||
const nodesUrl = this.getBZAttribute('nodes')
|
||||
this.mainContainer = document.createElement('div')
|
||||
this.mainContainer.classList.add('bzgfe-main-container')
|
||||
this.nodesContainer = document.createElement('div')
|
||||
this.nodesContainer.classList.add('bzgfe-nodes-container')
|
||||
this.mainContainer.append(this.nodesContainer)
|
||||
this.slidePane = document.createElement('bz-slidepane')
|
||||
this.slidePane.setAttribute('side', 'right')
|
||||
this.slidePane.setAttribute('data-output', 'console')
|
||||
this.slidePane.setAttribute('maxwidth', '350')
|
||||
this.slidePane.setAttribute('minwidth', '200')
|
||||
this.fillconsole()
|
||||
//this.mainContainer.append(this.slidePane)
|
||||
this.graflow = document.createElement('bz-graflow')
|
||||
this.graflow.setAttribute('nodes', nodesUrl)
|
||||
this.graflow.setAttribute('edit', "nodesmove,editwires,dropnodes")
|
||||
this.graflow.setAttribute('align', "center")
|
||||
this.graflow.setAttribute('wiretype', "bezier")
|
||||
this.graflow.setAttribute('tension', "30")
|
||||
this.graflow.setAttribute('gapx', "80")
|
||||
this.graflow.setAttribute('gapy', "80")
|
||||
this.graflow.addEventListener('bz:graflow:domConnected', this.setupDropZone.bind(this))
|
||||
this.graflow.append(this.slidePane)
|
||||
this.mainContainer.append(this.graflow)
|
||||
this.append(this.mainContainer)
|
||||
document.querySelector('[data-trigger="onAutoplace1H"]').addEventListener('click',
|
||||
(evt) => { this.graflow.autoPlace('horizontal', null, null, 1000, null) }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace1V"]').addEventListener('click',
|
||||
(evt) => { this.graflow.autoPlace('vertical', null, null, 1000, null) }
|
||||
)
|
||||
document.querySelector('input[name="tension"]').addEventListener('change',
|
||||
(evt) => { this.graflow.setAttribute('tension', evt.target.value); this.graflow.refresh() }
|
||||
)
|
||||
document.querySelector('input[name="gapx"]').addEventListener('change',
|
||||
(evt) => { this.graflow.setAttribute('gapx', evt.target.value); this.graflow.refresh() }
|
||||
)
|
||||
document.querySelector('input[name="gapy"]').addEventListener('change',
|
||||
(evt) => { this.graflow.setAttribute('gapy', evt.target.value); this.graflow.refresh() }
|
||||
)
|
||||
document.querySelector('bz-select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { this.graflow.setAttribute('wiretype', evt.target.value); this.graflow.refresh() }
|
||||
)
|
||||
document.querySelector('bz-select[name="align"]').addEventListener('change',
|
||||
(evt) => { this.graflow.setAttribute('align', evt.target.value); this.graflow.refresh() }
|
||||
)
|
||||
this.graflow.addEventListener('bz:graflow:nodesLoaded', this.refreshNodes.bind(this))
|
||||
this.graflow.loadNodes(nodesUrl)
|
||||
}
|
||||
|
||||
fillconsole(){
|
||||
this.slidePane.innerHTML = `
|
||||
<div class="inner-console">
|
||||
<section>
|
||||
<button data-trigger="onAutoplace1H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace1V">Auto-place Vertical</button>
|
||||
<div class="cols-2"><label>GapX</label><input name="gapx" type="number" size="2" value="80"></div>
|
||||
<div class="cols-2"><label>GapY</label><input name="gapy" type="number" size="2" value="80"></div>
|
||||
<div class="cols-2">
|
||||
<label>Alignment</label>
|
||||
<bz-select name="align">
|
||||
<option value="center" selected>Center</option>
|
||||
<option value="first">First</option>
|
||||
<option value="last">Last</option>
|
||||
<option value="parent">Parent</option>
|
||||
</bz-select>
|
||||
</div>
|
||||
<div class="cols-2">
|
||||
<label>Wire Type</label>
|
||||
<bz-select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</bz-select>
|
||||
</div>
|
||||
<div class="cols-2"><label>Tension</label><input name="tension" type="number" size="2" value="30"></div>
|
||||
</section>
|
||||
<section>
|
||||
<button data-trigger="onImportFlow">Import Flow</button>
|
||||
<button data-trigger="onExportFlow">Export Flow</button>
|
||||
<input type="file" name="importFlow" accept="application/json" style="display: none;">
|
||||
</section>
|
||||
</div>
|
||||
`
|
||||
this.slidePane.querySelector('button[data-trigger="onExportFlow"]').addEventListener('click', this.onExportFlow.bind(this))
|
||||
this.slidePane.querySelector('button[data-trigger="onImportFlow"]').addEventListener('click', this.onImportFlow.bind(this))
|
||||
}
|
||||
|
||||
refreshNodes(e){
|
||||
for(const nodeType in this.graflow.nodesRegistry){
|
||||
const nodeDef = this.graflow.nodesRegistry[nodeType]
|
||||
if(nodeDef.dataset.editor=='exclude') continue
|
||||
const node = nodeDef.cloneNode(true)
|
||||
this.makeNodeDraggable(node)
|
||||
this.nodesContainer.append(node)
|
||||
}
|
||||
}
|
||||
|
||||
makeNodeDraggable(node){
|
||||
node.draggable = true
|
||||
node.style.cursor = 'pointer'
|
||||
node.addEventListener('dragstart', (evt) => {
|
||||
evt.dataTransfer.setData('text/plain', node.dataset.nodetype)
|
||||
evt.dataTransfer.effectAllowed = 'copy'
|
||||
evt.dataTransfer.setDragImage(node, evt.offsetX, evt.offsetY)
|
||||
})
|
||||
}
|
||||
|
||||
onNodeDragEnd(evt){
|
||||
console.log('drag end', evt)
|
||||
evt.dataTransfer.clearData()
|
||||
}
|
||||
|
||||
setupDropZone(){
|
||||
const dropZone = this.graflow.wiresContainer
|
||||
const nodesContainer = this.graflow.nodesContainer
|
||||
dropZone.addEventListener('dragover', (evt) => {
|
||||
evt.preventDefault()
|
||||
evt.dataTransfer.dropEffect = 'copy'
|
||||
})
|
||||
dropZone.addEventListener('drop', (evt) => {
|
||||
evt.preventDefault()
|
||||
const nodeType = evt.dataTransfer.getData('text/plain')
|
||||
if(!nodeType || !(nodeType in this.graflow.nodesRegistry)) return
|
||||
const rect = nodesContainer.getBoundingClientRect()
|
||||
const x = evt.clientX - rect.left + nodesContainer.scrollLeft
|
||||
const y = evt.clientY - rect.top + nodesContainer.scrollTop
|
||||
const id = 'n' + crypto.randomUUID().replace(/-/g, '').slice(0, 8)
|
||||
this.graflow.addNode({ id, nodeType, coords: { x, y } })
|
||||
for(const node of this.graflow.flow.nodes){
|
||||
if(node.id == id){
|
||||
node.coords.x = x
|
||||
node.coords.y = y
|
||||
break
|
||||
}
|
||||
}
|
||||
this.graflow.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
onImportFlow(e){
|
||||
const fileInput = this.slidePane.querySelector('input[name="importFlow"]')
|
||||
fileInput.addEventListener('change', (evt) => {
|
||||
const file = evt.target.files[0]
|
||||
if(file) this.graflow.loadFlow(file)
|
||||
fileInput.value = ''
|
||||
}, { once: true })
|
||||
fileInput.click()
|
||||
}
|
||||
|
||||
onExportFlow(e){
|
||||
const flowDeep = JSON.parse(JSON.stringify(this.graflow.flow))
|
||||
delete flowDeep.longLinks
|
||||
const exportObj = {
|
||||
nodesFile: this.getBZAttribute('nodes'),
|
||||
flow: flowDeep
|
||||
}
|
||||
const flowJson = JSON.stringify(exportObj, null, 2)
|
||||
const flowBlob = new Blob([flowJson], { type: 'application/json' })
|
||||
const flowUrl = URL.createObjectURL(flowBlob)
|
||||
const flowLink = document.createElement('a')
|
||||
flowLink.href = flowUrl
|
||||
flowLink.download = 'flow.json'
|
||||
flowLink.click()
|
||||
}
|
||||
}
|
||||
Buildoz.define('grafloweditor', BZgrafloweditor)
|
||||
402
bzGraflow.js
402
bzGraflow.js
@@ -10,7 +10,6 @@
|
||||
* This code is free to use and modify,
|
||||
* as long as the copyright notice and license are kept.
|
||||
*/
|
||||
|
||||
class BZgraflow extends Buildoz{
|
||||
dirVect = {
|
||||
n: { x: 0, y: -1 },
|
||||
@@ -36,10 +35,11 @@ class BZgraflow extends Buildoz{
|
||||
|
||||
static _coreCssPromise = null
|
||||
|
||||
static async getCoreCss(){
|
||||
async getCoreCss(){
|
||||
if(BZgraflow._coreCssPromise) return(await BZgraflow._coreCssPromise)
|
||||
BZgraflow._coreCssPromise = (async() => {
|
||||
const res = await fetch('/app/thirdparty/buildoz/buildoz.css')
|
||||
const url = new URL('./buildoz.css', this.buildozUrl)
|
||||
const res = await fetch(url)
|
||||
const css = await res.text()
|
||||
const m = css.match(/\/\*\s*BZGRAFLOW_CORE_START\s*\*\/([\s\S]*?)\/\*\s*BZGRAFLOW_CORE_END\s*\*\//)
|
||||
const core = m ? m[1] : ''
|
||||
@@ -52,7 +52,7 @@ class BZgraflow extends Buildoz{
|
||||
if(!this.hasAttribute('isolated')) return
|
||||
if(this._isolatedCoreInjected) return
|
||||
this._isolatedCoreInjected = true
|
||||
const core = await BZgraflow.getCoreCss()
|
||||
const core = await this.getCoreCss()
|
||||
// Convert light-dom selectors (`bz-graflow ...`) to shadow-dom selectors (`:host ...`)
|
||||
const shadowCss = core.replaceAll('bz-graflow', ':host')
|
||||
const style = document.createElement('style')
|
||||
@@ -66,10 +66,6 @@ class BZgraflow extends Buildoz{
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
const flowUrl = this.getBZAttribute('flow')
|
||||
if(!flowUrl) return // Be tolerant: maybe injected later from JS above
|
||||
// If attribute "isolated" is present, render inside a shadow root.
|
||||
// Otherwise, render in light DOM (no shadow DOM).
|
||||
this.hostContainer = document.createElement('div')
|
||||
this.hostContainer.classList.add('bzgf-main-container')
|
||||
this.mainContainer = this.hasAttribute('isolated')
|
||||
@@ -84,40 +80,51 @@ class BZgraflow extends Buildoz{
|
||||
this.mainContainer.append(this.wiresContainer)
|
||||
this.mainContainer.append(this.nodesContainer)
|
||||
this.append(this.hostContainer)
|
||||
this.loadFlow(flowUrl).then(() => {
|
||||
if(this.getBZAttribute('edit')){
|
||||
const edit = this.getBZAttribute('edit').split(',')
|
||||
if(edit.includes('nodesmove')){
|
||||
this.nodesMover = new MovingNodes(this, '.bzgf-node')
|
||||
}
|
||||
if(edit.includes('wires')){
|
||||
this.WiresEditor = new EditWires(this, '.bzgf-wire')
|
||||
this.WiresEditor.enableEditWires()
|
||||
//this.WiresEditor.enableMovingNodes('.bzgf-wire')
|
||||
}
|
||||
if(edit.includes('dropnodes')){
|
||||
this.NodesReceiver = new DroppingNodes(this, '.bzgf-node')
|
||||
//this.NodesReceiver.enableDroppingNodes('.bzgf-node')
|
||||
}
|
||||
if(this.getBZAttribute('edit')){
|
||||
const edit = this.getBZAttribute('edit').split(',')
|
||||
if(edit.includes('nodesmove')){
|
||||
this.nodesMover = new MovingNodes(this, '.bzgf-node')
|
||||
}
|
||||
})
|
||||
if(edit.includes('editwires')){
|
||||
this.WiresEditor = new EditWires(this, '.bzgf-wire')
|
||||
}
|
||||
if(edit.includes('dropnodes')){
|
||||
this.NodesReceiver = new DroppingNodes(this, '.bzgf-node')
|
||||
}
|
||||
}
|
||||
this.fireEvent('domConnected', { graflow: this })
|
||||
const flowUrl = this.getBZAttribute('flow')
|
||||
if(flowUrl) this.loadFlow(flowUrl)
|
||||
else this.initFlow()
|
||||
}
|
||||
|
||||
error(msg, err){
|
||||
this.innerHTML = `<div style="background:red;color:black;margin: auto;width: fit-content;">${msg}</div>`
|
||||
this.querySelector('.graflow-error')?.remove()
|
||||
const errorEl = document.createElement('div')
|
||||
errorEl.classList.add('graflow-error')
|
||||
errorEl.innerHTML = `${msg}`
|
||||
this.appendChild(errorEl)
|
||||
if(err) console.error(msg, err)
|
||||
else console.error(msg)
|
||||
}
|
||||
|
||||
async loadFlow(url){
|
||||
const res = await fetch(url+'?'+crypto.randomUUID())
|
||||
const buf = await res.text()
|
||||
async loadFlow(source){
|
||||
let buf
|
||||
if(source instanceof Blob){
|
||||
buf = await source.text()
|
||||
} else {
|
||||
const url = source
|
||||
const fetchUrl = (typeof url === 'string' && !url.startsWith('blob:') && !url.startsWith('data:'))
|
||||
? (url + '?' + crypto.randomUUID())
|
||||
: url
|
||||
const res = await fetch(fetchUrl)
|
||||
buf = await res.text()
|
||||
}
|
||||
let flowObj
|
||||
try{
|
||||
flowObj = JSON.parse(buf)
|
||||
} catch(err){
|
||||
this.error('Could not parse flow JSON!?', err)
|
||||
|
||||
return
|
||||
}
|
||||
if(!flowObj.nodesFile){
|
||||
@@ -127,11 +134,11 @@ class BZgraflow extends Buildoz{
|
||||
await this.loadNodes(flowObj.nodesFile)
|
||||
this.flow = flowObj.flow
|
||||
this.refresh()
|
||||
this.dispatchEvent(new CustomEvent('flowLoaded', {
|
||||
detail: { url },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}))
|
||||
this.fireEvent('flowLoaded', { url: source instanceof Blob ? null : source, blob: source instanceof Blob ? source : null })
|
||||
}
|
||||
|
||||
initFlow(){
|
||||
this.flow = { nodes: [], links: [] }
|
||||
}
|
||||
|
||||
async loadNodes(url) {
|
||||
@@ -174,11 +181,7 @@ class BZgraflow extends Buildoz{
|
||||
BZgraflow._loadedNodeStyles.add(url)
|
||||
}
|
||||
}
|
||||
this.dispatchEvent(new CustomEvent('nodesLoaded', {
|
||||
detail: { url },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}))
|
||||
this.fireEvent('nodesLoaded', { url: url })
|
||||
}
|
||||
|
||||
addNode(node){
|
||||
@@ -240,7 +243,7 @@ class BZgraflow extends Buildoz{
|
||||
this.invade(this, childEl)
|
||||
childEl.hostContainer.appendChild(btnExitSubflow)
|
||||
|
||||
childEl.addEventListener('flowLoaded', (e) => {
|
||||
childEl.addEventListener('bz:graflow:flowLoaded', (e) => {
|
||||
for(const portLink of flowNode.subflow.portLinks){
|
||||
const nid = crypto.randomUUID()
|
||||
childEl.addNode({
|
||||
@@ -304,12 +307,8 @@ class BZgraflow extends Buildoz{
|
||||
this.hostContainer.style.visibility = 'hidden'
|
||||
childEl.style.transform = 'none' // Important for nested subflows to position correctly
|
||||
childEl.style.willChange = ''
|
||||
newEl.style.overflow = 'auto'
|
||||
this.dispatchEvent(new CustomEvent('subflowLoaded', {
|
||||
detail: { subflow: childEl },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}))
|
||||
childEl.style.overflow = 'auto'
|
||||
this.fireEvent('subflowLoaded', { subflow: childEl })
|
||||
}, { once:true })
|
||||
}
|
||||
|
||||
@@ -384,11 +383,7 @@ class BZgraflow extends Buildoz{
|
||||
this.hostContainer.style.opacity = '1'
|
||||
this.hostContainer.style.visibility = 'visible'
|
||||
childEl.style.willChange = ''
|
||||
this.dispatchEvent(new CustomEvent('subflowExited', {
|
||||
detail: { subflow: childEl },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}))
|
||||
this.fireEvent('subflowExited', { subflow: childEl })
|
||||
}, { once:true })
|
||||
}
|
||||
|
||||
@@ -404,9 +399,13 @@ class BZgraflow extends Buildoz{
|
||||
return(this.stagedNodes[nid])
|
||||
}
|
||||
|
||||
addWire(link){
|
||||
addWire(link){
|
||||
const [idNode1, idPort1] = link.from
|
||||
const [idNode2, idPort2] = link.to
|
||||
if(this.getLink(idNode1,idNode2)) {
|
||||
console.warn('Current version of graflow does not allow multiple wires between same nodes',this.getLink(idNode1,idNode2),idNode1,idNode2)
|
||||
return
|
||||
}
|
||||
const path = this.linkNodes(idNode1, idPort1, idNode2, idPort2)
|
||||
const id = `${idNode1}_${idNode2}`
|
||||
this.stagedWires[id] = document.createElementNS('http://www.w3.org/2000/svg', 'path')
|
||||
@@ -416,6 +415,7 @@ class BZgraflow extends Buildoz{
|
||||
if(this.arrowDefs && link.startArrow) this.stagedWires[id].setAttribute('marker-start','url(#arrow)')
|
||||
this.stagedWires[id].classList.add('bzgf-wire')
|
||||
this.stagedWires[id].dataset.id = id
|
||||
this.stagedWires[id].link = link
|
||||
this.wiresContainer.append(this.stagedWires[id])
|
||||
if(!this.flow.links.find(l => l.from[0] === idNode1 && l.from[1] === idPort1 && l.to[0] === idNode2 && l.to[1] === idPort2)) {
|
||||
this.flow.links.push(link)
|
||||
@@ -424,6 +424,8 @@ class BZgraflow extends Buildoz{
|
||||
}
|
||||
|
||||
clear(){
|
||||
this.stagedNodes = {}
|
||||
this.stagedWires = {}
|
||||
this.nodesContainer.innerHTML = ''
|
||||
this.wiresContainer.innerHTML = ''
|
||||
if(this.arrowDefs) this.wiresContainer.appendChild(this.arrowDefs)
|
||||
@@ -445,11 +447,7 @@ class BZgraflow extends Buildoz{
|
||||
else this.currentOrientation = 'vertical'
|
||||
}
|
||||
if(forceAutoplace) this.autoPlace(this.currentOrientation)
|
||||
this.dispatchEvent(new CustomEvent('refreshed', {
|
||||
detail: { },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}))
|
||||
this.fireEvent('refreshed', { })
|
||||
}
|
||||
|
||||
// Convert viewport (client) coordinates to this instance's SVG local coordinates.
|
||||
@@ -639,11 +637,11 @@ class BZgraflow extends Buildoz{
|
||||
return(path)
|
||||
}
|
||||
|
||||
autoPlace(orientation = 'horizontal', gapx = null, gapy = null, tween = null, align = null){
|
||||
if(gapx == null) gapx = parseInt(this.getBZAttribute('gapx')) || 80
|
||||
if(gapy == null) gapy = parseInt(this.getBZAttribute('gapy')) || 80
|
||||
if(tween == null) tween = parseInt(this.getBZAttribute('tween')) || 500
|
||||
if(align == null) align = this.getBZAttribute('align') || 'center'
|
||||
autoPlace(orientation = 'horizontal', gapx = null, gapy = null, tween = null, align = null){
|
||||
if(gapx == null) gapx = parseInt(this.getBZAttribute('gapx')) || 80
|
||||
if(gapy == null) gapy = parseInt(this.getBZAttribute('gapy')) || 80
|
||||
if(tween == null) tween = parseInt(this.getBZAttribute('tween')) || 500
|
||||
if(align == null) align = this.getBZAttribute('align') || 'center'
|
||||
|
||||
this.currentOrientation = orientation
|
||||
// Cancel any previous autoPlace() animations by bumping a token.
|
||||
@@ -654,17 +652,17 @@ class BZgraflow extends Buildoz{
|
||||
// Cleanup placeholders from previous autoPlace() runs.
|
||||
// Each run creates new longLinkPlaceHolder_* IDs; without cleanup they accumulate in the DOM.
|
||||
this.clearFakeNodes()
|
||||
|
||||
let links = Object.values(this.stagedWires).map(w => w?.link).filter(Boolean)
|
||||
links = links.length ? links : (this.flow?.links || [])
|
||||
// Loops create infinite recursion in dfs for getting parents & adjacency lists: Remove them !
|
||||
let linksWithoutBackEdges
|
||||
if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){
|
||||
const backEdges = this.findBackEdges(this.flow.nodes, this.flow.links)
|
||||
linksWithoutBackEdges = this.flow.links.filter((link, idx) => (!backEdges.includes(idx)) && (link.from[0] != link.to[0]))
|
||||
if(this.hasAnyLoop(this.flow.nodes, links)){
|
||||
const backEdges = this.findBackEdges(this.flow.nodes, links)
|
||||
linksWithoutBackEdges = links.filter((link, idx) => (!backEdges.includes(idx)) && (link.from[0] != link.to[0]))
|
||||
} else {
|
||||
linksWithoutBackEdges = this.flow.links
|
||||
linksWithoutBackEdges = links
|
||||
}
|
||||
const { parents, adj } = this.buildGraphStructures(this.flow.nodes, linksWithoutBackEdges)
|
||||
|
||||
const layers = this.computeLayers(this.flow.nodes, parents)
|
||||
|
||||
// Layer-0 nodes have no parents, so reorderLayers() (which uses parent ordering) cannot
|
||||
@@ -712,11 +710,10 @@ class BZgraflow extends Buildoz{
|
||||
if(totWidth>maxWidth) maxWidth = totWidth
|
||||
layerWidths.push(totWidth)
|
||||
}
|
||||
|
||||
|
||||
// If any long-links, create placeholders for skipped layers
|
||||
this._virtualLinks = new Map()
|
||||
this.flow.longLinks = this.findLongLinks(this.flow.links)
|
||||
this.flow.longLinks = this.findLongLinks(links)
|
||||
for(const llink of this.flow.longLinks){
|
||||
let fakeParent = llink.link.from[0]
|
||||
for(const layerIdx of llink.skippedLayers){
|
||||
@@ -765,14 +762,14 @@ class BZgraflow extends Buildoz{
|
||||
y = ((maxHeight - layerHeights[idx]) / 2) + gapy
|
||||
break
|
||||
}
|
||||
console.log('======>',gapy, y)
|
||||
for(const nid of layer){
|
||||
let placedY
|
||||
if(!nid.startsWith('longLinkPlaceHolder_')) {
|
||||
const bb = this.stagedNodes[nid].getBoundingClientRect()
|
||||
const nodeHeight = this.stagedNodes[nid].offsetHeight || bb.height
|
||||
if((align == 'parent') && (nid in parents) && (parents[nid][0] in parentsY)) {
|
||||
y = Math.max(parentsY[parents[nid][0]], y) //TODO handle multiple parents with avg
|
||||
console.log('parent', nid, parents[nid], parentsY[parents[nid][0]])
|
||||
y = Math.max(parentsY[parents[nid][0]], y) //TODO handle multiple parents with avg
|
||||
}
|
||||
placedY = y
|
||||
this.moveNode(nid, x, y, orientation, tween, null, token)
|
||||
@@ -791,7 +788,7 @@ class BZgraflow extends Buildoz{
|
||||
this.moveNode(nid, x, y, orientation, tween, null, token)
|
||||
// Never increment parentsY for fake nodes: they're placeholders and must not disalign real children
|
||||
y = Math.max(y, placedY + gapy + fakeNodeHeight)
|
||||
}
|
||||
}
|
||||
parentsY[nid] = placedY
|
||||
nodeY[nid] = placedY
|
||||
nodeX[nid] = x
|
||||
@@ -989,11 +986,13 @@ class BZgraflow extends Buildoz{
|
||||
|
||||
if(p < 1) requestAnimationFrame(frame.bind(this))
|
||||
else{
|
||||
this.dispatchEvent(new CustomEvent('nodeMoved', {
|
||||
detail: { nid, x, y },
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
}))
|
||||
const flowNode = this.flow?.nodes?.find(n => n.id === nid)
|
||||
if(flowNode) {
|
||||
if(!flowNode.coords) flowNode.coords = {}
|
||||
flowNode.coords.x = x
|
||||
flowNode.coords.y = y
|
||||
}
|
||||
this.fireEvent('nodeMoved', { nid, x, y })
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(frame.bind(this))
|
||||
@@ -1017,15 +1016,13 @@ class BZgraflow extends Buildoz{
|
||||
wire.setAttribute('d', path)
|
||||
}
|
||||
}
|
||||
this.fireEvent('wiresUpdated', { nid, orientation, LondLinkfix })
|
||||
}
|
||||
|
||||
getLink(nid1, nid2){
|
||||
let lnk = null
|
||||
lnk = this.flow.links.find(item => ((item.from[0]==nid1) && (item.to[0]==nid2)))
|
||||
if(!lnk) {
|
||||
lnk = this._virtualLinks?.get(`${nid1}__${nid2}`)
|
||||
}
|
||||
return(lnk)
|
||||
const wire = this.stagedWires[`${nid1}_${nid2}`]
|
||||
if(wire?.link) return wire.link
|
||||
return this._virtualLinks?.get(`${nid1}__${nid2}`) ?? null
|
||||
}
|
||||
|
||||
buildGraphStructures(nodes, links, includeLinkIndexes = false) {
|
||||
@@ -1132,11 +1129,11 @@ class BZgraflow extends Buildoz{
|
||||
|
||||
findLongLinks(links) {
|
||||
let linksWithoutBackEdges
|
||||
if(this.hasAnyLoop(this.flow.nodes, this.flow.links)){
|
||||
const backEdges = this.findBackEdges(this.flow.nodes, this.flow.links)
|
||||
linksWithoutBackEdges = this.flow.links.filter((link, idx) => (!backEdges.includes(idx)) && (link.from[0] != link.to[0]))
|
||||
if(this.hasAnyLoop(this.flow.nodes, links)){
|
||||
const backEdges = this.findBackEdges(this.flow.nodes, links)
|
||||
linksWithoutBackEdges = links.filter((link, idx) => (!backEdges.includes(idx)) && (link.from[0] != link.to[0]))
|
||||
} else {
|
||||
linksWithoutBackEdges = this.flow.links
|
||||
linksWithoutBackEdges = links
|
||||
}
|
||||
/// Yes that means we ignore long & back links !
|
||||
const { parents } = this.buildGraphStructures(this.flow.nodes, linksWithoutBackEdges)
|
||||
@@ -1161,14 +1158,14 @@ class BZgraflow extends Buildoz{
|
||||
return(crossLayerLinks)
|
||||
}
|
||||
|
||||
autofit(){
|
||||
autofit(percent=100){
|
||||
const parentBB = this.parentElement.getBoundingClientRect()
|
||||
// Use scroll dimensions for actual content extent (nodes can extend beyond element bounds)
|
||||
const contentW = Math.max(this.scrollWidth || this.offsetWidth || 1, 1)
|
||||
const contentH = Math.max(this.scrollHeight || this.offsetHeight || 1, 1)
|
||||
const sx = parentBB.width / contentW
|
||||
const sy = parentBB.height / contentH
|
||||
const scale = Math.min(sx, sy) // uniform scale to fit inside parent
|
||||
const scale = Math.min(sx, sy)*(percent/100) // uniform scale to fit inside parent
|
||||
this.style.transformOrigin = 'top left'
|
||||
this.style.transform = `scale(${scale})`
|
||||
}
|
||||
@@ -1176,53 +1173,57 @@ class BZgraflow extends Buildoz{
|
||||
Buildoz.define('graflow', BZgraflow)
|
||||
|
||||
class MovingNodes{
|
||||
|
||||
constructor(graflow, itemSelector, handleSelector = itemSelector){
|
||||
this.graflow = graflow
|
||||
this.itemSelector = itemSelector
|
||||
this.handleSelector = handleSelector
|
||||
this.nodesContainer = this.graflow.mainContainer.querySelector('.bzgf-nodes-container')
|
||||
this.state = null
|
||||
|
||||
this.interactiveElementsSelector = `
|
||||
.port,
|
||||
input,
|
||||
textarea,
|
||||
select,
|
||||
button,
|
||||
a[href]
|
||||
`
|
||||
this.graflow.addEventListener('refreshed', this.enableMovingNodes.bind(this))
|
||||
this._boundPointerDown = this.pointerDown.bind(this)
|
||||
this._boundPointerMove = this.pointerMove.bind(this)
|
||||
this._boundPointerUp = this.pointerUp.bind(this)
|
||||
this.graflow.addEventListener('bz:graflow:refreshed', this.enableMovingNodes.bind(this))
|
||||
}
|
||||
|
||||
enableMovingNodes() {
|
||||
enableMovingNodes() {
|
||||
if(!this._handleCursorStyle){
|
||||
const style = document.createElement('style')
|
||||
style.textContent = `${this.handleSelector}{ cursor: move }`
|
||||
const selector = `${this.handleSelector}:not(${this.interactiveElementsSelector.replace(/\s+/g, ' ').trim()})`
|
||||
style.textContent = `${selector}{ cursor: move }`
|
||||
this.nodesContainer.appendChild(style)
|
||||
this._handleCursorStyle = style
|
||||
}
|
||||
|
||||
this.nodesContainer.querySelectorAll(this.handleSelector).forEach(item =>
|
||||
item.addEventListener('pointerdown', this.pointerDown.bind(this))
|
||||
item.addEventListener('pointerdown', this._boundPointerDown)
|
||||
)
|
||||
this.nodesContainer.addEventListener('pointermove', this.pointerMove.bind(this))
|
||||
this.nodesContainer.addEventListener('pointermove', this._boundPointerMove)
|
||||
this.nodesContainer.querySelectorAll(this.handleSelector).forEach(item =>
|
||||
item.addEventListener('pointerup', this.pointerUp.bind(this))
|
||||
item.addEventListener('pointerup', this._boundPointerUp)
|
||||
)
|
||||
}
|
||||
|
||||
disableMovingNodes(){
|
||||
this.nodesContainer.querySelectorAll(this.handleSelector).forEach(item =>
|
||||
item.removeEventListener('pointerdown', this.pointerDown.bind(this))
|
||||
item.removeEventListener('pointerdown', this._boundPointerDown)
|
||||
)
|
||||
this.nodesContainer.removeEventListener('pointermove', this.pointerMove.bind(this))
|
||||
this.nodesContainer.removeEventListener('pointermove', this._boundPointerMove)
|
||||
this.nodesContainer.querySelectorAll(this.handleSelector).forEach(item =>
|
||||
item.removeEventListener('pointerup', this.pointerUp.bind(this))
|
||||
item.removeEventListener('pointerup', this._boundPointerUp)
|
||||
)
|
||||
}
|
||||
|
||||
pointerDown(e){
|
||||
this.graflow.clearFakeNodes()
|
||||
console.log('=====> interactive element', e.target)
|
||||
|
||||
const node = e.target.closest(this.itemSelector)
|
||||
if(!node) return
|
||||
@@ -1236,18 +1237,18 @@ class MovingNodes{
|
||||
handle = node.querySelector(this.handleSelector)
|
||||
if(e.target != handle) return
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const rect = node.getBoundingClientRect()
|
||||
|
||||
const parentBB = this.nodesContainer.getBoundingClientRect()
|
||||
const offsetX = rect.left - parentBB.left + this.nodesContainer.scrollLeft
|
||||
const offsetY = rect.top - parentBB.top + this.nodesContainer.scrollTop
|
||||
this.state = {
|
||||
node,
|
||||
handle,
|
||||
startX: e.clientX,
|
||||
startY: e.clientY,
|
||||
offsetX: rect.left,
|
||||
offsetY: rect.top
|
||||
offsetX,
|
||||
offsetY
|
||||
}
|
||||
const x = e.clientX - this.state.startX + this.state.offsetX
|
||||
const y = e.clientY - this.state.startY + this.state.offsetY
|
||||
@@ -1256,7 +1257,7 @@ class MovingNodes{
|
||||
node.style.left = `${x}px`
|
||||
node.style.top = `${y}px`
|
||||
node.style.margin = '0'
|
||||
node.style.zIndex = '9999'
|
||||
node.style.zIndex = '3'
|
||||
node.style.pointerEvents = 'none'
|
||||
}
|
||||
|
||||
@@ -1272,8 +1273,19 @@ class MovingNodes{
|
||||
|
||||
pointerUp(e){
|
||||
if(!this.state) return
|
||||
this.state.node.releasePointerCapture(e.pointerId)
|
||||
this.state.node.style.pointerEvents = ''
|
||||
const { node, startX, startY, offsetX, offsetY } = this.state
|
||||
const x = e.clientX - startX + offsetX
|
||||
const y = e.clientY - startY + offsetY
|
||||
node.releasePointerCapture(e.pointerId)
|
||||
node.style.pointerEvents = ''
|
||||
for(const n of this.graflow.flow.nodes){
|
||||
if(n.id == node.dataset.id){
|
||||
n.coords.x = x
|
||||
n.coords.y = y
|
||||
break
|
||||
}
|
||||
}
|
||||
this.graflow.fireEvent('nodeMoved', { nodeId: node.dataset.id, x, y })
|
||||
this.state = null
|
||||
}
|
||||
}
|
||||
@@ -1283,15 +1295,179 @@ class EditWires{
|
||||
this.graflow = graflow
|
||||
this.nodesContainer = this.graflow.mainContainer.querySelector('.bzgf-nodes-container')
|
||||
this.state = null
|
||||
this.graflow.tabIndex = 0 // Make keyboard reactive
|
||||
this._boundPointerMove = this.pointerMove.bind(this)
|
||||
this.graflow.addEventListener('bz:graflow:refreshed', this.enableEditWires.bind(this))
|
||||
this.graflow.addEventListener('bz:graflow:refreshed', this.enableSelectPorts.bind(this))
|
||||
this.graflow.addEventListener('bz:graflow:wiresUpdated', this.enableEditWires.bind(this))
|
||||
this.graflow.addEventListener('keyup', this.onKeyUp.bind(this))
|
||||
}
|
||||
enableEditWires(){
|
||||
|
||||
enableEditWires(){
|
||||
this.graflow.wiresContainer.querySelectorAll('.bzgf-wirecoat').forEach(item => item.remove())
|
||||
for(const ref in this.graflow.stagedWires ){
|
||||
this.graflow.stagedWires[ref].addEventListener('click', this.onSelectWire.bind(this))
|
||||
const clone = this.graflow.stagedWires[ref].cloneNode(true)
|
||||
clone.classList.add('bzgf-wirecoat')
|
||||
this.graflow.wiresContainer.appendChild(clone)
|
||||
clone.addEventListener('click', this.onSelectWire.bind(this))
|
||||
if(clone.dataset.id == this.currentlySelectedWire?.dataset.id) this.onSelectWire({target: clone})
|
||||
}
|
||||
}
|
||||
|
||||
enableSelectPorts(){
|
||||
this.currentlyHoveredPort = null
|
||||
const portEls = this.graflow.nodesContainer.querySelectorAll('.port')
|
||||
for(const port of portEls){
|
||||
port.addEventListener('click', this.onSelectPort.bind(this))
|
||||
port.addEventListener('pointerenter', this._onPortPointerEnter.bind(this))
|
||||
port.addEventListener('pointerleave', this._onPortPointerLeave.bind(this))
|
||||
port.classList.add('selectable')
|
||||
}
|
||||
}
|
||||
|
||||
_onPortPointerEnter(e){
|
||||
this.currentlyHoveredPort = e.target.closest('.port')
|
||||
}
|
||||
|
||||
_onPortPointerLeave(e){
|
||||
if(this.currentlyHoveredPort === e.target.closest('.port')) this.currentlyHoveredPort = null
|
||||
}
|
||||
|
||||
onSelectPort(e){
|
||||
const port = e.target
|
||||
if(this.currentlySelectedPort == port) {
|
||||
this.currentlySelectedPort.style.removeProperty('border')
|
||||
this.currentlySelectedPort = null
|
||||
this.state = null
|
||||
this._setWirecoatsPointerEvents('')
|
||||
this.graflow.mainContainer.removeEventListener('pointermove', this._boundPointerMove)
|
||||
if(this.tempwire) this.tempwire.remove()
|
||||
return
|
||||
}
|
||||
if(this.currentlySelectedPort) {
|
||||
this.tempwire.remove()
|
||||
this.tempwire = null
|
||||
this.makeWireBetweenPorts(this.currentlySelectedPort, port)
|
||||
this.enableEditWires()
|
||||
this.currentlySelectedPort.style.removeProperty('border')
|
||||
this.currentlySelectedPort = null
|
||||
this.state = null
|
||||
this._setWirecoatsPointerEvents('')
|
||||
this.graflow.mainContainer.removeEventListener('pointermove', this._boundPointerMove)
|
||||
} else {
|
||||
this.tension = parseInt(this.graflow.getBZAttribute('tension')) || 60
|
||||
this.wireType = this.graflow.getBZAttribute('wiretype') || 'bezier'
|
||||
this.currentlySelectedPort = port
|
||||
port.style.setProperty('border', '5px solid #FF0', 'important')
|
||||
this.state = {
|
||||
startX: e.clientX,
|
||||
startY: e.clientY,
|
||||
port
|
||||
}
|
||||
this.tempwire = document.createElementNS('http://www.w3.org/2000/svg', 'path')
|
||||
this.tempwire.setAttribute('fill', 'none')
|
||||
this.tempwire.style.pointerEvents = 'none'
|
||||
this.graflow.wiresContainer.appendChild(this.tempwire)
|
||||
this.tempwire.classList.add('bzgf-wire')
|
||||
this._setWirecoatsPointerEvents('none')
|
||||
this.graflow.mainContainer.addEventListener('pointermove', this._boundPointerMove)
|
||||
}
|
||||
}
|
||||
|
||||
_setWirecoatsPointerEvents(value){
|
||||
this.graflow.wiresContainer.querySelectorAll('.bzgf-wirecoat').forEach(el => { el.style.pointerEvents = value })
|
||||
}
|
||||
|
||||
pointerMove(e){
|
||||
if(!this.state) return
|
||||
const { port } = this.state
|
||||
const bb = port.getBoundingClientRect()
|
||||
const p1 = this.graflow.clientToSvg(bb.x + bb.width / 2, bb.y + bb.height / 2)
|
||||
const p2 = this.graflow.clientToSvg(e.clientX, e.clientY)
|
||||
const x1 = Math.floor(p1.x)
|
||||
const y1 = Math.floor(p1.y)
|
||||
const x2 = Math.floor(p2.x)
|
||||
const y2 = Math.floor(p2.y)
|
||||
const dir1 = port.dataset.direction
|
||||
const oppositeDir = { n: 's', s: 'n', e: 'w', w: 'e' }
|
||||
const hovered = this.currentlyHoveredPort
|
||||
|
||||
const dir2 = (hovered && hovered !== port) ? hovered.dataset.direction : oppositeDir[dir1]
|
||||
const c1x = x1 + this.tension * this.graflow.dirVect[dir1].x
|
||||
const c1y = y1 + this.tension * this.graflow.dirVect[dir1].y
|
||||
const c2x = x2 + this.tension * this.graflow.dirVect[dir2].x
|
||||
const c2y = y2 + this.tension * this.graflow.dirVect[dir2].y
|
||||
const node1 = port.closest('.bzgf-node')
|
||||
const node2 = hovered?.closest('.bzgf-node') ?? { offsetWidth: 0, offsetHeight: 0 }
|
||||
const seg = this.graflow.buildSegment(
|
||||
x1, y1,
|
||||
c1x, c1y,
|
||||
c2x, c2y,
|
||||
x2, y2,
|
||||
this.wireType,
|
||||
node1, node2,
|
||||
dir1, dir2,
|
||||
this.tension)
|
||||
if(!seg) return
|
||||
this.tempwire.setAttribute('d', `M ${x1} ${y1} ${seg}`)
|
||||
}
|
||||
|
||||
makeWireBetweenPorts(port1, port2){
|
||||
const node1 = port1.closest('.bzgf-node')
|
||||
const node2 = port2.closest('.bzgf-node')
|
||||
const idNode1 = node1.dataset.id
|
||||
const idNode2 = node2.dataset.id
|
||||
const idPort1 = port1.dataset.id
|
||||
const idPort2 = port2.dataset.id
|
||||
if(!node1 || !node2 || !port1 || !port2) {
|
||||
console.warn('Link on bad node / port ', idNode1, idPort1, idNode2, idPort2)
|
||||
return('')
|
||||
}
|
||||
this.graflow.addWire({ from: [idNode1, idPort1], to: [idNode2, idPort2] })
|
||||
this.graflow.fireEvent('wireAdded', { from: [idNode1, idPort1], to: [idNode2, idPort2], id: `${idNode1}_${idNode2}` })
|
||||
}
|
||||
|
||||
onSelectWire(e){
|
||||
const wire = e.target
|
||||
console.log('wire', wire)
|
||||
if(this.currentlySelectedWire) this.currentlySelectedWire.style.removeProperty('stroke') //this.currentlySelectedWire.style.setProperty('stroke', '#0000', 'important')
|
||||
if(wire==this.currentlySelectedWire) {
|
||||
this.currentlySelectedWire = null
|
||||
return
|
||||
}
|
||||
this.currentlySelectedWire = wire
|
||||
wire.style.setProperty('stroke', '#FF0F', 'important')
|
||||
}
|
||||
|
||||
onKeyUp(e){
|
||||
if((e.key == 'Delete') && this.currentlySelectedWire) {
|
||||
const wireId = this.currentlySelectedWire.dataset.id
|
||||
const linkToRemove = this.graflow.stagedWires[wireId]?.link
|
||||
this.graflow.flow.links = this.graflow.flow.links.filter(link =>
|
||||
linkToRemove ? link !== linkToRemove : (link.from[0] + '_' + link.to[0] !== wireId)
|
||||
)
|
||||
this.graflow.stagedWires[wireId]?.remove()
|
||||
delete this.graflow.stagedWires[wireId]
|
||||
this.currentlySelectedWire.remove()
|
||||
this.currentlySelectedWire = null
|
||||
this.graflow.fireEvent('wireRemoved', { wireId })
|
||||
return
|
||||
}
|
||||
if(e.key == 'Escape') {
|
||||
if(this.currentlySelectedWire) {
|
||||
this.currentlySelectedWire.style.setProperty('stroke', '#0000', 'important')
|
||||
this.currentlySelectedWire = null
|
||||
}
|
||||
if(this.currentlySelectedPort) {
|
||||
this.currentlySelectedPort.style.removeProperty('border')
|
||||
this.currentlySelectedPort = null
|
||||
}
|
||||
if(this.tempwire) {
|
||||
this.tempwire.remove()
|
||||
this.tempwire = null
|
||||
this.graflow.mainContainer.removeEventListener('pointermove', this._boundPointerMove)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
workflow quotidien
|
||||
|
||||
Modifier buildoz:
|
||||
|
||||
cd app/thirdparty/buildoz
|
||||
git commit
|
||||
git push
|
||||
|
||||
Puis dans P42:
|
||||
|
||||
git add app/thirdparty/buildoz
|
||||
git commit -m "update buildoz"
|
||||
|
||||
Car P42 stocke la référence du commit buildoz.
|
||||
46
graflow_examples/etest1.html
Normal file
46
graflow_examples/etest1.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<script src="../bzGraflow-editor.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
}
|
||||
body{
|
||||
display: grid;
|
||||
grid-gap: 5px;
|
||||
background:#888;
|
||||
font-size: 16px;
|
||||
}
|
||||
bz-graflow{
|
||||
border: 2px solid black;
|
||||
}
|
||||
bz-graflow.compunet{ grid-column: 1 / -1; width: 100vw; height: 60vh; background:black; }
|
||||
</style>
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-grafloweditor nodes="./nodesLib/nodesTest1.html" >
|
||||
</bz-grafloweditor>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"nodesFile": "/app/thirdparty/buildoz/graflow_examples/nodesLib/nodesTest1.html",
|
||||
"nodesFile": "./nodesLib/nodesTest1.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "inc",
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
{ "nodeType": "inc",
|
||||
"subflow": {
|
||||
"url": "/app/thirdparty/buildoz/graflow_examples/flows/testFlowEic.json",
|
||||
"url": "./flows/testFlowEic.json",
|
||||
"portLinks": [
|
||||
{ "refNodeType": "refnodein", "refnodePort": "out1",
|
||||
"parentPort": "in1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"nodesFile": "/app/thirdparty/buildoz/graflow_examples/nodesLib/nodesTest1.html",
|
||||
"nodesFile": "./nodesLib/nodesTest1.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "inc",
|
||||
@@ -33,6 +33,10 @@
|
||||
{ "nodeType": "console",
|
||||
"id": "9999",
|
||||
"coords": { "x": 800, "y": 350}
|
||||
},
|
||||
{ "nodeType": "square",
|
||||
"id": "prng",
|
||||
"coords": { "x": 250, "y": 400}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"nodesFile": "/app/thirdparty/buildoz/graflow_examples/nodesLib/nodes16ports.html",
|
||||
"nodesFile": "./nodesLib/nodes16ports.html",
|
||||
"flow": {
|
||||
"nodes": [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"nodesFile": "/app/thirdparty/buildoz/graflow_examples/nodesLib/nodesTest2.html",
|
||||
"nodesFile": "./nodesLib/nodesTest2.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "process",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"nodesFile": "/app/thirdparty/buildoz/graflow_examples/nodesLib/nodesEIC.html",
|
||||
"nodesFile": "./nodesLib/nodesEIC.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "eicBasic",
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
"data": { "a": "a3", "b":"b3"},
|
||||
"subflow": {
|
||||
"url": "/app/thirdparty/buildoz/graflow_examples/flows/testFlowICMP.json",
|
||||
"url": "./flows/testFlowICMP.json",
|
||||
"portLinks": [
|
||||
{ "refNodeType": "refnodein", "refnodePort": "out1",
|
||||
"parentPort": "in1",
|
||||
|
||||
98
graflow_examples/flows/testFlowEvent1.json
Normal file
98
graflow_examples/flows/testFlowEvent1.json
Normal file
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"nodesFile": "./nodesLib/nodesEIC.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "config",
|
||||
"ncoords": { "x": 50, "y": 120},
|
||||
"markup": {
|
||||
"title": "Configure event",
|
||||
"subtitle": "",
|
||||
"severity": "warning"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "mailinvit",
|
||||
"ncoords": { "x": 100, "y": 220},
|
||||
"markup": {
|
||||
"title": "Candidates invitation mailing",
|
||||
"subtitle": "",
|
||||
"severity": "success"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "applicationsurvey",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "Application survey",
|
||||
"subtitle": "",
|
||||
"severity": "success"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "enrollment",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "Candidates enrollment",
|
||||
"subtitle": "",
|
||||
"severity": "secondary"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "mailwelcome",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "Welcome mailing",
|
||||
"subtitle": "",
|
||||
"severity": "warning"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "mailrejection",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "Rejection mailing",
|
||||
"subtitle": "",
|
||||
"severity": "warning"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "event",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "Event",
|
||||
"subtitle": "",
|
||||
"severity": "secondary"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "mailstatisfaction",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "Satisfaction survey mailing",
|
||||
"subtitle": "",
|
||||
"severity": "success"
|
||||
}
|
||||
},
|
||||
{ "nodeType": "eicBasic",
|
||||
"id": "satisfactionsurvey",
|
||||
"ncoords": { "x": 150, "y": 320},
|
||||
"markup": {
|
||||
"title": "Satisfaction survey",
|
||||
"subtitle": "",
|
||||
"severity": "warning"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
{ "from": ["config", "out1"], "to": ["mailinvit", "in1"] },
|
||||
{ "from": ["mailinvit", "out1"], "to": ["applicationsurvey", "in1"] },
|
||||
{ "from": ["applicationsurvey", "out1"], "to": ["enrollment", "in1"] },
|
||||
{ "from": ["enrollment", "out1"], "to": ["mailwelcome", "in1"] },
|
||||
{ "from": ["enrollment", "out1"], "to": ["mailrejection", "in1"] },
|
||||
{ "from": ["mailwelcome", "out1"], "to": ["event", "in1"] },
|
||||
{ "from": ["event", "out1"], "to": ["mailstatisfaction", "in1"] },
|
||||
{ "from": ["mailstatisfaction", "out1"], "to": ["satisfactionsurvey", "in1"] }
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"nodesFile": "/app/thirdparty/buildoz/graflow_examples/nodesLib/nodesEIC.html",
|
||||
"nodesFile": "./nodesLib/nodesEIC.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "eicBasic",
|
||||
@@ -7,7 +7,7 @@
|
||||
"markup": {
|
||||
"title": "Evaluations",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
"severity": "info"
|
||||
},
|
||||
"data": { "node": "eval", "nodeId":null}
|
||||
},
|
||||
@@ -17,7 +17,7 @@
|
||||
"markup": {
|
||||
"title": "GAP",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
"severity": "accent"
|
||||
},
|
||||
"data": { "a": "a2", "b":"b2"}
|
||||
},
|
||||
@@ -27,7 +27,7 @@
|
||||
"markup": {
|
||||
"title": "CID",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
"severity": "primary"
|
||||
},
|
||||
"data": { "a": "a3", "b":"b3"}
|
||||
},
|
||||
@@ -37,7 +37,7 @@
|
||||
"markup": {
|
||||
"title": "Case Allocation",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
"severity": "success"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity"
|
||||
@@ -49,7 +49,7 @@
|
||||
"markup": {
|
||||
"title": "Grant Signature",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
"severity": "danger"
|
||||
},
|
||||
"data": {
|
||||
"track": "grant"
|
||||
@@ -123,7 +123,7 @@
|
||||
"markup": {
|
||||
"title": "Investment Agreement",
|
||||
"subtitle": "...",
|
||||
"severity": "secondary"
|
||||
"severity": "warning"
|
||||
},
|
||||
"data": {
|
||||
"track": "equity",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"nodesFile": "/app/thirdparty/buildoz/graflow_examples/nodesLib/nodesEIC2.html",
|
||||
"nodesFile": "./nodesLib/nodesEIC2.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "eicBasic",
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
position: absolute;
|
||||
padding: .5em;
|
||||
}
|
||||
|
||||
div.bzgf-node div.body[primary] { background-color: var(--eicui-base-color-primary); color:white;}
|
||||
div.bzgf-node div.body[info] { background-color: var(--eicui-base-color-info); color:white;}
|
||||
div.bzgf-node div.body[success] { background-color: var(--eicui-base-color-success); color:white;}
|
||||
div.bzgf-node div.body[warning] { background-color: var(--eicui-base-color-warning);}
|
||||
div.bzgf-node div.body[danger] { background-color: var(--eicui-base-color-danger);}
|
||||
div.bzgf-node div.body[accent] { background-color: var(--eicui-base-color-accent);}
|
||||
|
||||
.bzgf-node .body{
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
@@ -68,7 +76,7 @@
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="eicBasic">
|
||||
<div class="body">
|
||||
<div class="body" {severity}>
|
||||
<div class="title">{title}</div>
|
||||
<div class="subtitle">{subtitle}</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,15 @@
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
padding: .5em;
|
||||
}
|
||||
}
|
||||
|
||||
div.bzgf-node[primary] { background-color: var(--eicui-base-color-primary);}
|
||||
div.bzgf-node[info] { background-color: var(--eicui-base-color-info);}
|
||||
div.bzgf-node[success] { background-color: var(--eicui-base-color-success);}
|
||||
div.bzgf-node[warning] { background-color: var(--eicui-base-color-warning);}
|
||||
div.bzgf-node[danger] { background-color: var(--eicui-base-color-danger);}
|
||||
div.bzgf-node[accent] { background-color: var(--eicui-base-color-accent);}
|
||||
|
||||
.bzgf-node .body{
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
|
||||
@@ -96,10 +96,21 @@
|
||||
.bzgf-node[data-nodetype="input"] .title,
|
||||
.bzgf-node[data-nodetype="console"] .title{ background: #555; }
|
||||
|
||||
|
||||
|
||||
.bzgf-node[data-nodetype="square"]{
|
||||
background: #FAA;
|
||||
border-color: #A00;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
.bzgf-node[data-nodetype="square"] .title{ background: #555; }
|
||||
|
||||
.bzgf-node[data-nodetype="refnodein"], .bzgf-node[data-nodetype="refnodeout"] {
|
||||
width:3em;
|
||||
height:3em;
|
||||
padding: 2px;
|
||||
border: none;
|
||||
}
|
||||
.bzgf-node[data-nodetype="refnodein"] .body, .bzgf-node[data-nodetype="refnodeout"] .body{
|
||||
border-radius: 50%;
|
||||
@@ -108,6 +119,10 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin:0;
|
||||
}
|
||||
.bzgf-node[data-nodetype="refnodein"] .port, .bzgf-node[data-nodetype="refnodeout"] .port{
|
||||
top: 50%;
|
||||
}
|
||||
.bzgf-node[data-nodetype="refnodein"] .body{ background: #0F0; }
|
||||
.bzgf-node[data-nodetype="refnodeout"] .body{ background: #FF0; }
|
||||
@@ -189,14 +204,25 @@
|
||||
</template>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="refnodein">
|
||||
<div class="bzgf-node" data-nodetype="square">
|
||||
<div class="title">PRNG</div>
|
||||
<div class="body"></div>
|
||||
<div class="port" data-type="out" data-id="w" data-direction="w"></div>
|
||||
<div class="port" data-type="out" data-id="n" data-direction="n"></div>
|
||||
<div class="port" data-type="out" data-id="e" data-direction="e"></div>
|
||||
<div class="port" data-type="out" data-id="s" data-direction="s"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="refnodein" data-editor="exclude">
|
||||
<div class="body">{parentport}</div>
|
||||
<div class="port" data-type="out" data-id="out1" data-direction="e"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="refnodeout">
|
||||
<div class="bzgf-node" data-nodetype="refnodeout" data-editor="exclude">
|
||||
<div class="body">{parentport}</div>
|
||||
<div class="port" data-type="in" data-id="in1" data-direction="w"></div>
|
||||
</div>
|
||||
|
||||
@@ -4,18 +4,144 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<style>
|
||||
table {
|
||||
margin: 0 auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid black;
|
||||
max-width: 10em;
|
||||
min-width: 7em;
|
||||
text-align: center;
|
||||
}
|
||||
th{
|
||||
background: #555;
|
||||
color: white;
|
||||
}
|
||||
tr > td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ul>
|
||||
<li><a target="test1" href="./test1.html">test1 (P42 graph + ISOLATED + 2 depths subflows)</a></li>
|
||||
<li><a target="test2" href="./test2.html">test2 (organigram) + ISOLATED</a></li>
|
||||
<li><a target="test3" href="./test3.html">test3 (EIC simple + subflow + NON-ISOLATED)</a></li>
|
||||
<li><a target="test4" href="./test4.html">test4 (EIC-ICMP + NON-ISOLATED + AUTOFIT with ResizeObserver on container)</a></li>
|
||||
<li><a target="test4.5" href="./test4.5.html">test4.5 (EIC-ICMP + NON-ISOLATED + single-port, ortho, oriented, aligned top)</a></li>
|
||||
<li><a target="test5" href="./test5.html">test5 (P42 graph + ISOLATED + EDITABLE)</a></li>
|
||||
<li><a target="test6" href="./test6.html">test6 (16 port combinations)</a></li>
|
||||
|
||||
</ul>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Style</th>
|
||||
<th>isolated</th>
|
||||
<th>subflow</th>
|
||||
<th>autofit</th>
|
||||
<th>wireStyle</th>
|
||||
<th>align</th>
|
||||
<th>oriented</th>
|
||||
<th>nodesmove</th>
|
||||
<th>editwires</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a target="test1" href="./test1.html">test1</a></td>
|
||||
<td>Graflow P42</td>
|
||||
<td>YES</td>
|
||||
<td>2 depths</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="test2" href="./test2.html">test2</a></td>
|
||||
<td>Graflow Organigram</td>
|
||||
<td>YES</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="test3" href="./test3.html">test3</a></td>
|
||||
<td>Graflow EIC simple</td>
|
||||
<td>NO</td>
|
||||
<td>1 depth</td>
|
||||
<td></td>
|
||||
<td>Straight</td>
|
||||
<td>First</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="test4" href="./test4.html">test4</a></td>
|
||||
<td>Graflow EIC-ICMP</td>
|
||||
<td>NO</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>Bezier</td>
|
||||
<td>Center</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="test4.5" href="./test4.5.html">test4.5</a></td>
|
||||
<td>Graflow EIC-ICMP II</td>
|
||||
<td>NO</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>Ortho</td>
|
||||
<td>Parent</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="test5" href="./test5.html">test5</a></td>
|
||||
<td>Graflow P42</td>
|
||||
<td>YES</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a target="test6" href="./test6.html">test6</a></td>
|
||||
<td>Graflow 16 ports test</td>
|
||||
<td>NO</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Style</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a target="etest1" href="./etest1.html">Editor test</a></td>
|
||||
<td>P42</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/buildoz/buildoz.css">
|
||||
<script src="/app/thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="/app/thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
@@ -53,10 +53,10 @@
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw1 = document.querySelector('bz-graflow.compunet')
|
||||
grflw1.addEventListener('subflowLoaded',
|
||||
grflw1.addEventListener('bz:graflow:subflowLoaded',
|
||||
(evt) => { grflw1 = evt.detail.subflow }
|
||||
)
|
||||
grflw1.addEventListener('subflowExited',
|
||||
grflw1.addEventListener('bz:graflow:subflowExited',
|
||||
(evt) => { grflw1 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace1H"]').addEventListener('click',
|
||||
@@ -76,7 +76,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="compunet" flow="/app/thirdparty/buildoz/graflow_examples/flows/testFlow1.1.json" tension="60" isolated>
|
||||
<bz-graflow class="compunet" flow="./flows/testFlow1.1.json" tension="60" isolated>
|
||||
<div class="demooptions"> <!-- just for demo purposes -->
|
||||
<button data-trigger="onAutoplace1H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace1V">Auto-place Vertical</button>
|
||||
@@ -91,7 +91,7 @@
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="compunet" type="number" size="2" value="60"></div>
|
||||
<div class="cols-2"><label>tension</label><input data-id="compunet" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/buildoz/buildoz.css">
|
||||
<script src="/app/thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="/app/thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
@@ -53,10 +53,10 @@
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw3 = document.querySelector('bz-graflow.organi')
|
||||
grflw3.addEventListener('subflowLoaded',
|
||||
grflw3.addEventListener('bz:graflow:subflowLoaded',
|
||||
(evt) => { grflw3 = evt.detail.subflow }
|
||||
)
|
||||
grflw3.addEventListener('subflowExited',
|
||||
grflw3.addEventListener('bz:graflow:subflowExited',
|
||||
(evt) => { grflw3 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace3H"]').addEventListener('click',
|
||||
@@ -76,7 +76,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="organi" flow="/app/thirdparty/buildoz/graflow_examples/flows/testFlow2.json" tension="60" isolated>
|
||||
<bz-graflow class="organi" flow="./flows/testFlow2.json" tension="60" isolated>
|
||||
<div class="demooptions">
|
||||
<button data-trigger="onAutoplace3H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace3V">Auto-place Vertical</button>
|
||||
@@ -92,7 +92,7 @@
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
<option value="parent">Parent</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="organi" type="number" size="2" value="60"></div>
|
||||
<div class="cols-2"><label>tension</label><input data-id="organi" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
|
||||
98
graflow_examples/test3.1.html
Normal file
98
graflow_examples/test3.1.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
}
|
||||
body{
|
||||
display: grid;
|
||||
grid-gap: 5px;
|
||||
background:#888;
|
||||
font-size: 16px;
|
||||
}
|
||||
.demooptions{
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
width: 10em;
|
||||
background: #FFFB;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
z-index:99999;
|
||||
font-size: .7em;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
.demooptions button{
|
||||
text-transform: none;
|
||||
margin: 2px;
|
||||
font-size: 1em;
|
||||
}
|
||||
bz-graflow{
|
||||
overflow: scroll;
|
||||
border: 2px solid black;
|
||||
}
|
||||
bz-graflow.eic{ grid-column: 1 / -1; width: 120vw; height: 40vh; background: var(--eicui-base-color-grey-10); }
|
||||
</style>
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw2 = document.querySelector('bz-graflow.eic')
|
||||
grflw2.setAttribute('tension', document.querySelector('input[data-id="eic"]').value)
|
||||
grflw2.setAttribute('align', document.querySelector('select[name="align"]').value)
|
||||
grflw2.setAttribute('wiretype', document.querySelector('select[name="wiretype"]').value)
|
||||
grflw2.addEventListener('bz:graflow:refresh',
|
||||
(evt) => { grflw2.style.transform = 'scale(.75)'; }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace2H"]').addEventListener('click',
|
||||
(evt) => { grflw2.autoPlace('horizontal', 100, 30, 1000, document.querySelector('[data-id="eic"]').value) }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace2V"]').addEventListener('click',
|
||||
(evt) => { grflw2.autoPlace('vertical', 80, 80, 1000, document.querySelector('[data-id="eic"]').value) }
|
||||
)
|
||||
document.querySelector('input[data-id="eic"]').addEventListener('change',
|
||||
(evt) => { grflw2.setAttribute('tension', evt.target.value); grflw2.refresh() }
|
||||
)
|
||||
document.querySelector('select[name="wiretype"]').addEventListener('change',
|
||||
(evt) => { grflw2.setAttribute('wiretype', evt.target.value); grflw2.refresh() }
|
||||
)
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="eic" flow="./flows/testFlowEvent1.json" tension="50">
|
||||
<div class="demooptions"> <!-- just for demo purposes -->
|
||||
<button data-trigger="onAutoplace2H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace2V">Auto-place Vertical</button>
|
||||
<select name="align" data-id="eic">
|
||||
<option value="center">Center</option>
|
||||
<option value="first" selected>First</option>
|
||||
<option value="last">Last</option>
|
||||
<option value="parent">Parent</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class="cols-2"><label>tension</label><input data-id="eic" type="number" size="2" value="50"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,18 +4,18 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/buildoz/buildoz.css">
|
||||
<script src="/app/thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="/app/thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
@@ -53,10 +53,13 @@
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw2 = document.querySelector('bz-graflow.eic')
|
||||
grflw2.addEventListener('subflowLoaded',
|
||||
grflw2.setAttribute('tension', document.querySelector('input[data-id="eic"]').value)
|
||||
grflw2.setAttribute('align', document.querySelector('select[name="align"]').value)
|
||||
grflw2.setAttribute('wiretype', document.querySelector('select[name="wiretype"]').value)
|
||||
grflw2.addEventListener('bz:graflow:subflowLoaded',
|
||||
(evt) => { grflw2 = evt.detail.subflow }
|
||||
)
|
||||
grflw2.addEventListener('subflowExited',
|
||||
grflw2.addEventListener('bz:graflow:subflowExited',
|
||||
(evt) => { grflw2 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace2H"]').addEventListener('click',
|
||||
@@ -76,22 +79,22 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="eic" flow="/app/thirdparty/buildoz/graflow_examples/flows/testFlowEic.json" tension="60">
|
||||
<bz-graflow class="eic" flow="./flows/testFlowEic.json" tension="60">
|
||||
<div class="demooptions"> <!-- just for demo purposes -->
|
||||
<button data-trigger="onAutoplace2H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace2V">Auto-place Vertical</button>
|
||||
<select name="align" data-id="eic">
|
||||
<option value="center">Center</option>
|
||||
<option value="first">First</option>
|
||||
<option value="first" selected>First</option>
|
||||
<option value="last">Last</option>
|
||||
<option value="parent">Parent</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
<option value="straight"selected>Straight</option>
|
||||
<option value="bezier">Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="eic" type="number" size="2" value="60"></div>
|
||||
<div class="cols-2"><label>tension</label><input data-id="eic" type="number" size="2" value="1"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
</body>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/buildoz/buildoz.css">
|
||||
<script src="/app/thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="/app/thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
@@ -53,10 +53,13 @@
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw4 = document.querySelector('bz-graflow.icmp')
|
||||
grflw4.addEventListener('subflowLoaded',
|
||||
grflw4.setAttribute('tension', document.querySelector('input[data-id="icmp"]').value)
|
||||
grflw4.setAttribute('align', document.querySelector('select[name="align"]').value)
|
||||
grflw4.setAttribute('wiretype', document.querySelector('select[name="wiretype"]').value)
|
||||
grflw4.addEventListener('bz:graflow:subflowLoaded',
|
||||
(evt) => { grflw4 = evt.detail.subflow }
|
||||
)
|
||||
grflw4.addEventListener('subflowExited',
|
||||
grflw4.addEventListener('bz:graflow:subflowExited',
|
||||
(evt) => { grflw4 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace4H"]').addEventListener('click',
|
||||
@@ -76,22 +79,22 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="icmp" flow="/app/thirdparty/buildoz/graflow_examples/flows/testFlowICMP2.json" tension="20" align="first" wiretype="ortho" gapx="100" gapy="30">
|
||||
<bz-graflow class="icmp" flow="./flows/testFlowICMP2.json" tension="20" align="first" wiretype="ortho" gapx="100" gapy="30">
|
||||
<div class="demooptions"> <!-- just for demo purposes -->
|
||||
<button data-trigger="onAutoplace4H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace4V">Auto-place Vertical</button>
|
||||
<select name="align" data-id="icmp">
|
||||
<option value="center">Center</option>
|
||||
<option value="first" selected>First</option>
|
||||
<option value="first">First</option>
|
||||
<option value="last">Last</option>
|
||||
<option value="parent">Parent</option>
|
||||
<option value="parent" selected>Parent</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho" selected>Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier">Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="icmp" type="number" size="2" value="20"></div>
|
||||
<div class="cols-2"><label>tension</label><input data-id="icmp" type="number" size="2" value="20"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
</body>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/buildoz/buildoz.css">
|
||||
<script src="/app/thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="/app/thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
@@ -55,16 +55,37 @@
|
||||
min-width: 800px;
|
||||
min-height: 300px;
|
||||
border: 1px solid #999;
|
||||
padding: 1rem;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
border:2px solid #A00
|
||||
}
|
||||
.container::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 3px;
|
||||
bottom: 3px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
pointer-events: none;
|
||||
background:
|
||||
repeating-linear-gradient(
|
||||
135deg,
|
||||
transparent 0px,
|
||||
transparent 3px,
|
||||
#A00 3px,
|
||||
#A00 6px
|
||||
);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
const severities = ['primary', 'info', 'success', 'warning', 'danger', 'accent']
|
||||
|
||||
let grflw4 = document.querySelector('bz-graflow.icmp')
|
||||
grflw4.addEventListener('subflowLoaded',
|
||||
grflw4.addEventListener('bz:graflow:subflowLoaded',
|
||||
(evt) => { grflw4 = evt.detail.subflow }
|
||||
)
|
||||
grflw4.addEventListener('subflowExited',
|
||||
grflw4.addEventListener('bz:graflow:subflowExited',
|
||||
(evt) => { grflw4 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace4H"]').addEventListener('click',
|
||||
@@ -83,21 +104,32 @@
|
||||
const el = document.querySelector('.container')
|
||||
let timer = null // debounce
|
||||
const ro = new ResizeObserver(([entry]) => {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
const grfl = entry.target.querySelector('bz-graflow')
|
||||
grfl.autofit()
|
||||
}, 200)
|
||||
})
|
||||
|
||||
const grfl = entry.target.querySelector('bz-graflow')
|
||||
grfl.autofit()
|
||||
})
|
||||
ro.observe(el)
|
||||
|
||||
let aifmi = null; let sidx=0;
|
||||
const sevanimation = () => { console.log('sevanimation')
|
||||
severities.forEach(severity => aifmi.removeAttribute(severity))
|
||||
aifmi.setAttribute(severities[sidx], '')
|
||||
sidx++
|
||||
if (sidx >= severities.length) sidx = 0
|
||||
setTimeout(sevanimation, 1000)
|
||||
}
|
||||
grflw4.addEventListener('bz:graflow:refreshed',() => {
|
||||
if(aifmi) return
|
||||
aifmi = grflw4.stagedNodes['aifm-investment'].querySelector('.body')
|
||||
sevanimation()
|
||||
})
|
||||
|
||||
})
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container" style="padding:0;"">
|
||||
<bz-graflow class="icmp" flow="/app/thirdparty/buildoz/graflow_examples/flows/testFlowICMP.json" tension="60">
|
||||
<div class="container">
|
||||
<bz-graflow class="icmp" flow="./flows/testFlowICMP.json" tension="60">
|
||||
<div class="demooptions">
|
||||
<button data-trigger="onAutoplace4H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace4V">Auto-place Vertical</button>
|
||||
@@ -112,7 +144,7 @@
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="icmp" type="number" size="2" value="60"></div>
|
||||
<div class="cols-2"><label>tension</label><input data-id="icmp" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
</div>
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/buildoz/buildoz.css">
|
||||
<script src="/app/thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="/app/thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
@@ -53,10 +53,10 @@
|
||||
<script>
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw1 = document.querySelector('bz-graflow.compunet')
|
||||
grflw1.addEventListener('subflowLoaded',
|
||||
grflw1.addEventListener('bz:graflow:subflowLoaded',
|
||||
(evt) => { grflw1 = evt.detail.subflow }
|
||||
)
|
||||
grflw1.addEventListener('subflowExited',
|
||||
grflw1.addEventListener('bz:graflow:subflowExited',
|
||||
(evt) => { grflw1 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace1H"]').addEventListener('click',
|
||||
@@ -76,7 +76,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="compunet" flow="/app/thirdparty/buildoz/graflow_examples/flows/testFlow1.json" tension="60" isolated edit="nodesmove,wires,dropnodes" >
|
||||
<bz-graflow class="compunet" flow="./flows/testFlow1.json" tension="60" isolated edit="nodesmove,editwires,dropnodes" >
|
||||
<div class="demooptions"> <!-- just for demo purposes -->
|
||||
<button data-trigger="onAutoplace1H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace1V">Auto-place Vertical</button>
|
||||
@@ -91,7 +91,7 @@
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="compunet" type="number" size="2" value="60"></div>
|
||||
<div class="cols-2"><label>tension</label><input data-id="compunet" type="number" size="2" value="60"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
<title>graflow</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="/app/thirdparty/buildoz/buildoz.css">
|
||||
<script src="/app/thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="/app/thirdparty/buildoz/bzGraflow.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../../eicui/eicui-2.0.css">
|
||||
<link type="text/css" rel="stylesheet" href="../buildoz.css">
|
||||
<script src="../buildoz.js"></script>
|
||||
<script src="../bzGraflow.js"></script>
|
||||
<style>
|
||||
@font-face { /*FF does not indirectly load if inside a shawdow-dom */
|
||||
font-family: 'glyphs';
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/app/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/app/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/app/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/app/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
src: url('/assets/styles/fonts/glyphs.eot');
|
||||
src: url('/assets/styles/fonts/glyphs.eot') format('embedded-opentype'),
|
||||
url('/assets/styles/fonts/glyphs.ttf') format('truetype'),
|
||||
url('/assets/styles/fonts/glyphs.woff') format('woff'),
|
||||
url('/assets/styles/fonts/glyphs.svg') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-display: block;
|
||||
@@ -54,11 +54,12 @@
|
||||
window.addEventListener('load',()=>{
|
||||
let grflw1 = document.querySelector('bz-graflow.compunet')
|
||||
grflw1.setAttribute('tension', document.querySelector('input[data-id="compunet"]').value)
|
||||
grflw1.setAttribute('align', document.querySelector('select[name="align"]').value)
|
||||
grflw1.setAttribute('wiretype', document.querySelector('select[name="wiretype"]').value)
|
||||
grflw1.addEventListener('subflowLoaded',
|
||||
grflw1.addEventListener('bz:graflow:subflowLoaded',
|
||||
(evt) => { grflw1 = evt.detail.subflow }
|
||||
)
|
||||
grflw1.addEventListener('subflowExited',
|
||||
grflw1.addEventListener('bz:graflow:subflowExited',
|
||||
(evt) => { grflw1 = evt.target }
|
||||
)
|
||||
document.querySelector('[data-trigger="onAutoplace1H"]').addEventListener('click',
|
||||
@@ -78,7 +79,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<bz-graflow class="compunet" flow="/app/thirdparty/buildoz/graflow_examples/flows/testFlow16ports.json" tension="60" isolated edit="nodesmove" >
|
||||
<bz-graflow class="compunet" flow="./flows/testFlow16ports.json" tension="60" isolated edit="nodesmove" >
|
||||
<div class="demooptions"> <!-- just for demo purposes -->
|
||||
<button data-trigger="onAutoplace1H">Auto-place Horizontal</button>
|
||||
<button data-trigger="onAutoplace1V">Auto-place Vertical</button>
|
||||
@@ -89,11 +90,11 @@
|
||||
<option value="parent">Parent</option>
|
||||
</select>
|
||||
<select name="wiretype">
|
||||
<option value="ortho">Ortho</option>
|
||||
<option value="ortho" selected>Ortho</option>
|
||||
<option value="straight">Straight</option>
|
||||
<option value="bezier" selected>Bezier</option>
|
||||
<option value="bezier">Bezier</option>
|
||||
</select>
|
||||
<div class-"cols-2"=""><label>tension</label><input data-id="compunet" type="number" size="2" value="20"></div>
|
||||
<div class="cols-2"><label>tension</label><input data-id="compunet" type="number" size="2" value="20"></div>
|
||||
</div>
|
||||
</bz-graflow>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user