From 978da1ce0456ac4d4fe121f70e2e3a09477775ec Mon Sep 17 00:00:00 2001 From: David Evans Date: Wed, 14 Feb 2018 22:59:19 +0000 Subject: [PATCH] Fix references inside groups overflowing edges [#49] --- lib/sequence-diagram.js | 2 +- lib/sequence-diagram.min.js | 2 +- scripts/sequence/Generator.js | 2 +- scripts/sequence/Generator_spec.js | 23 +++++++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/sequence-diagram.js b/lib/sequence-diagram.js index 91ec58e..69f1b51 100644 --- a/lib/sequence-diagram.js +++ b/lib/sequence-diagram.js @@ -2900,7 +2900,7 @@ define('sequence/Generator',['core/ArrayUtilities'], (array) => { GAgent.make(alias), {blocked: true, group: alias} ); - this.defineGAgents(gAgents); + this.defineGAgents([...gAgents, leftGAgent, rightGAgent]); const {indexL, indexR} = addBounds( this.gAgents, leftGAgent, diff --git a/lib/sequence-diagram.min.js b/lib/sequence-diagram.min.js index 54f41b8..e8a5b0f 100644 --- a/lib/sequence-diagram.min.js +++ b/lib/sequence-diagram.min.js @@ -1 +1 @@ -!function(){var e,t,n;!function(r){function i(e,t){return x.call(e,t)}function s(e,t){var n,r,i,s,a,o,l,h,d,g,c,u=t&&t.split("/"),p=b.map,f=p&&p["*"]||{};if(e){for(a=(e=e.split("/")).length-1,b.nodeIdCompat&&w.test(e[a])&&(e[a]=e[a].replace(w,"")),"."===e[0].charAt(0)&&u&&(e=u.slice(0,u.length-1).concat(e)),d=0;d0&&(e.splice(d-1,2),d-=2)}e=e.join("/")}if((u||f)&&p){for(d=(n=e.split("/")).length;d>0;d-=1){if(r=n.slice(0,d).join("/"),u)for(g=u.length;g>0;g-=1)if((i=p[u.slice(0,g).join("/")])&&(i=i[r])){s=i,o=d;break}if(s)break;!l&&f&&f[r]&&(l=f[r],h=d)}!s&&l&&(s=l,o=h),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function a(e,t){return function(){var n=k.call(arguments,0);return"string"!=typeof n[0]&&1===n.length&&n.push(null),c.apply(r,n.concat([e,t]))}}function o(e){return function(t){f[e]=t}}function l(e){if(i(m,e)){var t=m[e];delete m[e],y[e]=!0,g.apply(r,t)}if(!i(f,e)&&!i(y,e))throw new Error("No "+e);return f[e]}function h(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function d(e){return e?h(e):[]}var g,c,u,p,f={},m={},b={},y={},x=Object.prototype.hasOwnProperty,k=[].slice,w=/\.js$/;u=function(e,t){var n,r=h(e),i=r[0],a=t[1];return e=r[1],i&&(n=l(i=s(i,a))),i?e=n&&n.normalize?n.normalize(e,function(e){return function(t){return s(t,e)}}(a)):s(e,a):(i=(r=h(e=s(e,a)))[0],e=r[1],i&&(n=l(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},p={require:function(e){return a(e)},exports:function(e){var t=f[e];return void 0!==t?t:f[e]={}},module:function(e){return{id:e,uri:"",exports:f[e],config:function(e){return function(){return b&&b.config&&b.config[e]||{}}}(e)}}},g=function(e,t,n,s){var h,g,c,b,x,k,w,A=[],v=typeof n;if(s=s||e,k=d(s),"undefined"===v||"function"===v){for(t=!t.length&&n.length?["require","exports","module"]:t,x=0;x{"use strict";return class{constructor(){this.listeners=new Map,this.forwards=new Set}addEventListener(e,t){const n=this.listeners.get(e);n?n.push(t):this.listeners.set(e,[t])}removeEventListener(e,t){const n=this.listeners.get(e);if(!n)return;const r=n.indexOf(t);-1!==r&&n.splice(r,1)}countEventListeners(e){return(this.listeners.get(e)||[]).length}removeAllEventListeners(e){e?this.listeners.delete(e):this.listeners.clear()}addEventForwarding(e){this.forwards.add(e)}removeEventForwarding(e){this.forwards.delete(e)}removeAllEventForwardings(){this.forwards.clear()}trigger(e,t=[]){(this.listeners.get(e)||[]).forEach(e=>e.apply(null,t)),this.forwards.forEach(n=>n.trigger(e,t))}}}),n("core/ArrayUtilities",[],()=>{"use strict";function e(e,t,n=null){if(null===n)return e.indexOf(t);for(let r=0;r=e.length)return void i.push(r.slice());const s=e[n];if(!Array.isArray(s))return r.push(s),t(e,n+1,r,i),void r.pop();for(let a=0;a{n.push(...t(e))}),n}}}),n("sequence/CodeMirrorMode",["core/ArrayUtilities"],e=>{"use strict";function t(e,t=!1){return{type:"string",suggest:t,then:Object.assign({"":0},e)}}function n(e,t){return e.v===t.v&&e.prefix===t.prefix&&e.suffix===t.suffix&&e.q===t.q}function r(t,n,r){let i=r.suggest;return Array.isArray(i)||(i=[i]),e.flatMap(i,e=>!1===e?[]:"object"==typeof e?e.known?t["known"+e.known]||[]:[e]:"string"==typeof e&&e?[{v:e,q:""===n}]:[function(e,t){return Object.keys(t.then).length>0?{v:e,suffix:" ",q:!1}:{v:e,suffix:"\n",q:!1}}(n,r)])}function i(t,i){const s=[],a=e.last(i);return Object.keys(a.then).forEach(o=>{let l=a.then[o];"number"==typeof l&&(l=i[i.length-l-1]),e.mergeSets(s,r(t,o,l),n)}),s}function s(t,r,i,{suggest:s,override:a}){let o=null;"object"==typeof s&&s.known&&(o=s.known),r.type&&o!==r.type&&(a&&(r.type=a),e.mergeSets(t["known"+r.type],[{v:r.value,suffix:" ",q:!0}],n),r.type="",r.value=""),o&&(r.type=o,r.value&&(r.value+=i.s),r.value+=i.v)}function a(t,n,r){const a={type:"",value:""};let o=r;const h=[o];return t.line.forEach((n,r)=>{r===t.line.length-1&&(t.completions=i(t,h));const d=n.q?"":n.v;let g=o.then[d];void 0===g?(g=o.then[""],t.isVar=!0):t.isVar=n.q,"number"==typeof g?h.length-=g:h.push(g||l),o=e.last(h),s(t,a,n,o)}),n&&s(t,a,null,{}),t.nextCompletions=i(t,h),t.valid=Boolean(o.then["\n"])||0===Object.keys(o.then).length,o.type}function o(e){const t=e.baseToken||{};return{value:t.v||"",quoted:t.q||!1}}const l={type:"error line-error",suggest:!1,then:{"":0}},h=["database","red"],d=(()=>{function e(e,t=1){return{type:"variable",suggest:{known:"Agent"},then:Object.assign({},e,{"":0,",":{type:"operator",then:{"":t}}})}}function n(e){return{type:"keyword",suggest:[e+" of ",e+": "],then:{of:{type:"keyword",then:{"":g}},":":{type:"operator",then:{"":a}},"":g}}}function r({exit:e,sourceExit:t,blankExit:n}){const r={type:"operator",then:{"+":l,"-":l,"*":l,"!":l,"":e}};return{"+":{type:"operator",then:{"+":l,"-":l,"*":r,"!":l,"":e}},"-":{type:"operator",then:{"+":l,"-":l,"*":r,"!":{type:"operator",then:{"+":l,"-":l,"*":l,"!":l,"":e}},"":e}},"*":{type:"operator",then:Object.assign({"+":r,"-":r,"*":l,"!":l,"":e},t||e)},"!":r,"":n||e}}const i={type:"",suggest:"\n",then:{}},s={type:"",suggest:!1,then:{}},a=t({"\n":i}),o={type:"operator",then:{"":a,"\n":s}},d=e({"\n":i,as:{type:"keyword",then:{"":{type:"variable",suggest:{known:"Agent"},then:{"":0,",":{type:"operator",then:{"":3}},"\n":i}}}}}),g=e({":":o}),c={type:"variable",suggest:{known:"Agent"},then:{"":0,":":{type:"operator",then:{"":a,"\n":s}},"\n":i}},u={":":{type:"operator",then:{"":t({as:{type:"keyword",then:{"":{type:"variable",suggest:{known:"Agent"},then:{"":0,"\n":i}}}}})}}},p={type:"keyword",then:Object.assign({over:{type:"keyword",then:{"":e(u)}}},u)},f={"\n":i,":":{type:"operator",then:{"":a,"\n":s}},with:{type:"keyword",suggest:["with height "],then:{height:{type:"keyword",then:{"":{type:"number",suggest:["6 ","30 "],then:{"\n":i,":":{type:"operator",then:{"":a,"\n":s}}}}}}}}},m=function(e,t,n){const r=Object.assign({},n);return t.forEach(t=>{r[t]={type:e,then:n}}),r}("keyword",["a","an"],function(e,t,n){const r={},i=Object.assign({},n);return t.forEach(t=>{r[t]={type:e,then:i},i[t]=0}),r}("keyword",h,{"\n":i})),b={type:"keyword",then:{"":a,":":{type:"operator",then:{"":a}},"\n":i}},y={title:{type:"keyword",then:{"":a}},theme:{type:"keyword",then:{"":{type:"string",suggest:{global:"themes",suffix:"\n"},then:{"":0,"\n":i}}}},headers:{type:"keyword",then:{none:{type:"keyword",then:{}},cross:{type:"keyword",then:{}},box:{type:"keyword",then:{}},fade:{type:"keyword",then:{}},bar:{type:"keyword",then:{}}}},terminators:{type:"keyword",then:{none:{type:"keyword",then:{}},cross:{type:"keyword",then:{}},box:{type:"keyword",then:{}},fade:{type:"keyword",then:{}},bar:{type:"keyword",then:{}}}},divider:{type:"keyword",then:Object.assign({line:{type:"keyword",then:f},space:{type:"keyword",then:f},delay:{type:"keyword",then:f},tear:{type:"keyword",then:f}},f)},define:{type:"keyword",then:{"":d,as:l}},begin:{type:"keyword",then:{"":d,reference:p,as:l}},end:{type:"keyword",then:{"":d,as:l,"\n":i}},if:b,else:{type:"keyword",suggest:["else\n","else if: "],then:{if:{type:"keyword",suggest:"if: ",then:{"":a,":":{type:"operator",then:{"":a}}}},"\n":i}},repeat:b,group:b,note:{type:"keyword",then:{over:{type:"keyword",then:{"":g}},left:n("left"),right:n("right"),between:{type:"keyword",then:{"":e({":":l},g)}}}},state:{type:"keyword",suggest:"state over ",then:{over:{type:"keyword",then:{"":{type:"variable",suggest:{known:"Agent"},then:{"":0,",":l,":":o}}}}}},text:{type:"keyword",then:{left:n("left"),right:n("right")}},autolabel:{type:"keyword",then:{off:{type:"keyword",then:{}},"":t({"\n":i},[{v:"