@profpowell/vb-project-planning 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -5
- package/dist/vb-project-planning.css +48 -5
- package/dist/vb-project-planning.js +165 -12
- package/dist/vb-project-planning.min.css +1 -1
- package/dist/vb-project-planning.min.js +44 -44
- package/package.json +5 -4
- package/src/web-components/iron-triangle/api.json +1 -1
- package/src/web-components/iron-triangle/logic.js +157 -0
- package/src/web-components/iron-triangle/styles.css +60 -3
- package/src/web-components/product-roadmap/logic.js +25 -13
- package/src/web-components/requirement-card/logic.js +1 -1
- package/src/web-components/user-persona/logic.js +1 -1
- package/src/web-components/user-story/logic.js +2 -1
|
@@ -294,7 +294,7 @@ var re=`
|
|
|
294
294
|
transition: none !important;
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
`;var Ir=window.matchMedia("(prefers-reduced-motion: reduce)");var se=new Map;function w(
|
|
297
|
+
`;var Ir=window.matchMedia("(prefers-reduced-motion: reduce)");var se=new Map;function w(n,t,e={}){let r=e.priority??10,a={impl:t,bundle:e.bundle,contract:e.contract,priority:r},s=se.get(n);if(customElements.get(n)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}se.set(n,a),customElements.define(n,t)}function m(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function O(n){return n.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function B(n){let t=0;for(let r=0;r<n.length;r++)t=n.charCodeAt(r)+((t<<5)-t);return`hsl(${(t%360+360)%360}, 65%, 55%)`}function k(n){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`}var E={user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',check:'<path d="M20 6 9 17l-5-5"/>',target:'<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',alertTriangle:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',messageCircle:'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',lightbulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',wrench:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',mapPin:'<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',checkCircle:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>'},ft={says:{label:"Says",icon:E.messageCircle,color:"#3b82f6"},thinks:{label:"Thinks",icon:E.lightbulb,color:"#8b5cf6"},does:{label:"Does",icon:E.wrench,color:"#f59e0b"},feels:{label:"Feels",icon:E.heart,color:"#ef4444"}},R={delighted:{emoji:"\u{1F604}",score:.95,color:"#16a34a"},satisfied:{emoji:"\u{1F60A}",score:.8,color:"#22c55e"},hopeful:{emoji:"\u{1F642}",score:.68,color:"#84cc16"},curious:{emoji:"\u{1F914}",score:.55,color:"#eab308"},neutral:{emoji:"\u{1F610}",score:.5,color:"#94a3b8"},uncertain:{emoji:"\u{1F615}",score:.4,color:"#f97316"},confused:{emoji:"\u{1F635}",score:.3,color:"#fb923c"},frustrated:{emoji:"\u{1F624}",score:.18,color:"#ef4444"},angry:{emoji:"\u{1F620}",score:.05,color:"#dc2626"}};var Re="https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait",Z=[32,64,128,256,512];function je(n){let t=0;for(let e=0;e<n.length;e++)t=n.charCodeAt(e)+((t<<5)-t);return t}function De(n){let t=Z[0],e=Math.abs(n-t);for(let r=1;r<Z.length;r++){let a=Math.abs(n-Z[r]);a<e&&(t=Z[r],e=a)}return t}function ae(n,t=128){let e=je(String(n)),r=(e%100+100)%100,a=(e>>>16&1)===0?"female":"male",s=De(t);return`${Re}/${a}/${s}/${r}.jpg`}function bt(n){let t=0;for(let e=0;e<n.length;e++)t=n.charCodeAt(e)+((t<<5)-t);return t}var Fe=["Sarah Chen","Marcus Johnson","Aisha Patel","James O'Brien","Yuki Tanaka","Elena Rodriguez","David Kim","Fatima Al-Hassan","Lucas Silva","Priya Sharma","Noah Williams","Mei Lin","Carlos Mendez","Amara Osei","Henrik Larsson","Zara Ahmed"],Oe=["Product Manager","UX Designer","Frontend Developer","Data Analyst","Marketing Lead","QA Engineer","DevOps Lead","Content Strategist","Startup Founder","IT Director","Customer Success Lead","Research Scientist"],Be=["San Francisco, CA","Austin, TX","London, UK","Toronto, CA","Berlin, DE","Tokyo, JP","Sydney, AU","S\xE3o Paulo, BR"],He=["I need tools that help me stay organized without slowing me down.","The dashboard is where I live \u2014 it has to be fast and reliable.","I want to understand the data, not fight the interface.","If it takes more than two clicks, I\u2019ll find another way.","Collaboration shouldn\u2019t mean endless notification noise.","I just want it to work the way I expect it to.","Give me the big picture first, then let me drill into details.","Accessibility isn\u2019t a nice-to-have \u2014 it\u2019s how I use the web."],Ue=["Streamline daily workflows","Reduce context-switching","Stay aligned with the team","Make data-driven decisions quickly","Ship features on a predictable cadence","Automate repetitive tasks","Improve onboarding experience","Keep documentation up to date"],Ve=["Too many disconnected tools","Slow page loads break focus","Unclear ownership of tasks","Settings that reset unexpectedly","Notifications that bury important updates","Poor mobile experience","Inconsistent design across features","No offline support"],We=["Checks dashboards every morning","Prefers keyboard shortcuts over mouse","Skims docs, reads deeply only when stuck","Shares screenshots in Slack","Batches email to twice a day","Tests features in incognito first","Bookmarks frequently used reports","Uses dark mode exclusively"],gt=class extends HTMLElement{static get observedAttributes(){return["role","age","location","avatar","compact","src","data-list-stories","id"]}#e=new Map;#t=null;constructor(){super(),this.attachShadow({mode:"open"})}relatedStories(){if(!this.id)return[];let t=this.getRootNode(),e=t.querySelectorAll?t:document;return Array.from(e.querySelectorAll(`user-story[persona-id="${Qe(this.id)}"]:not([data-detail-clone])`))}#r(){for(let t of[...this.children]){let e=t.getAttribute("slot");e&&!this.getAttribute(e)&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}get data(){return{name:this.personaName,role:this.personaRole||void 0,age:this.age||void 0,location:this.location||void 0,avatar:this.avatar||void 0,quote:this.quote||void 0,bio:this.#e.get("bio")||void 0,goals:this.#e.get("goals")||void 0,frustrations:this.#e.get("frustrations")||void 0,behaviors:this.#e.get("behaviors")||void 0}}set data(t){!t||typeof t!="object"||(this._applyData(t),this.shadowRoot&&this.#o(),this.dispatchEvent(new CustomEvent("user-persona:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0})))}_applyData(t){for(let e of["role","age","location","avatar"])t[e]&&this.setAttribute(e,String(t[e]));if(t.name&&!this.querySelector('[slot="name"]')){let e=document.createElement("h2");e.slot="name",e.textContent=String(t.name),this.appendChild(e)}if(t.quote&&!this.querySelector('[slot="quote"]')){let e=document.createElement("p");e.slot="quote",e.textContent=String(t.quote),this.appendChild(e)}for(let e of["bio","goals","frustrations","behaviors"])t[e]&&this.#e.set(e,String(t[e]))}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();this._applyData(r),this.#o()}catch(e){console.warn(`[user-persona] Failed to load src="${t}":`,e)}}connectedCallback(){this.#r(),this.hasAttribute("data-mock")?this.#i():this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#o(),this.#a(),this.setAttribute("data-upgraded",""),this.dispatchEvent(new CustomEvent("persona-ready",{bubbles:!0,composed:!0,detail:{name:this.personaName,role:this.personaRole}}))}disconnectedCallback(){this.removeAttribute("data-upgraded"),this.#t?.disconnect(),this.#t=null}#a(){if(!this.hasAttribute("data-list-stories")||!this.id){this.#t?.disconnect(),this.#t=null;return}this.#t||(this.#t=new MutationObserver(()=>this.#s()),this.#t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["persona-id"]}))}#s(){if(!this.shadowRoot)return;let t=this.shadowRoot.querySelector("[data-stories-section]");t&&(t.outerHTML=this.#n())}#n(){if(!this.hasAttribute("data-list-stories")||!this.id)return"";let t=this.relatedStories();return`
|
|
298
298
|
<section class="section" part="section-stories" data-stories-section>
|
|
299
299
|
<div class="section-header">
|
|
300
300
|
<div class="section-icon stories" aria-hidden="true">
|
|
@@ -306,7 +306,7 @@ var re=`
|
|
|
306
306
|
${t.length===0?'<p class="empty-stories">No user stories reference this persona yet.</p>':`<ul class="story-list">${t.map(e=>{let r=e.id||e.getAttribute("story-id")||"",a=e.querySelector('[slot="action"]')?.textContent?.trim()||e.getAttribute("action")||e.id||"untitled",s=e.getAttribute("priority")||"",i=e.getAttribute("status")||"";return`<li class="story-item" data-priority="${m(s)}" data-status="${m(i)}">${r?`<a href="#${m(r)}">${m(a)}</a>`:`<span>${m(a)}</span>`}${s?`<span class="story-meta">${m(s)}</span>`:""}${i?`<span class="story-meta">${m(i)}</span>`:""}</li>`}).join("")}</ul>`}
|
|
307
307
|
</div>
|
|
308
308
|
</section>
|
|
309
|
-
`}attributeChangedCallback(t,e,r){if(!(e===r||!this.shadowRoot)){if(t==="src"&&this.isConnected){this._loadSrc(r);return}(t==="data-list-stories"||t==="id")&&this.#a(),this.#
|
|
309
|
+
`}attributeChangedCallback(t,e,r){if(!(e===r||!this.shadowRoot)){if(t==="src"&&this.isConnected){this._loadSrc(r);return}(t==="data-list-stories"||t==="id")&&this.#a(),this.#o()}}get personaName(){return this.querySelector('[slot="name"]')?.textContent?.trim()||this.#e.get("name")||"Unnamed Persona"}get personaRole(){return this.getAttribute("role")||""}get age(){return this.getAttribute("age")||""}get location(){return this.getAttribute("location")||""}get avatar(){return this.getAttribute("avatar")||""}get quote(){return this.querySelector('[slot="quote"]')?.textContent?.trim()||this.#e.get("quote")||""}get compact(){return this.hasAttribute("compact")}#i(){let t=this.dataset.seed||this.dataset.mock||String(Date.now()),e=s=>s[(bt(t+s.length)%s.length+s.length)%s.length],r=(s,i)=>{let o=[];for(let c=0;c<i;c++)o.push(s[(bt(t+c+s.length)%s.length+s.length)%s.length]);return[...new Set(o)]};if(!this.querySelector('[slot="name"]')){let s=document.createElement("h2");s.slot="name",s.textContent=e(Fe),this.appendChild(s)}if(this.getAttribute("role")||this.setAttribute("role",e(Oe)),this.getAttribute("age")||this.setAttribute("age",String(25+(bt(t)%30+30)%30)),this.getAttribute("location")||this.setAttribute("location",e(Be)),!this.getAttribute("avatar")){let s=this.querySelector('[slot="name"]')?.textContent?.trim()||"Persona";this.setAttribute("avatar",ae(s,256))}if(!this.querySelector('[slot="quote"]')){let s=document.createElement("p");s.slot="quote",s.textContent=e(He),this.appendChild(s)}let a=(s,i)=>{if(this.querySelector(`[slot="${s}"]`))return;let o=document.createElement("ul");o.setAttribute("slot",s);for(let c of i){let d=document.createElement("li");d.textContent=c,o.appendChild(d)}this.appendChild(o)};a("goals",r(Ue,3)),a("frustrations",r(Ve,3)),a("behaviors",r(We,3))}#o(){let t=this.personaName,e=this.personaRole,r=this.age,a=this.location,s=this.avatar,i=this.quote,o=B(t),c=s?`background:url(${m(s)}) center/cover`:`background:${o}`;this.shadowRoot.innerHTML=`
|
|
310
310
|
<style>${re}</style>
|
|
311
311
|
|
|
312
312
|
<article class="persona-card" part="card" role="article"
|
|
@@ -395,10 +395,10 @@ var re=`
|
|
|
395
395
|
</div>
|
|
396
396
|
</div>
|
|
397
397
|
|
|
398
|
-
${this.#
|
|
398
|
+
${this.#n()}
|
|
399
399
|
</div>
|
|
400
400
|
</article>
|
|
401
|
-
`}};function
|
|
401
|
+
`}};function Qe(n){return typeof CSS<"u"&&CSS.escape?CSS.escape(String(n)):String(n).replace(/["\\]/g,"\\$&")}w("user-persona",gt);var vt=`
|
|
402
402
|
:host {
|
|
403
403
|
--_bg: var(--user-story-bg, var(--color-surface, #ffffff));
|
|
404
404
|
--_text: var(--user-story-text, var(--color-text, #1a1a1a));
|
|
@@ -721,7 +721,7 @@ var re=`
|
|
|
721
721
|
:host([detail="compact"]) .slot-fallback {
|
|
722
722
|
display: none;
|
|
723
723
|
}
|
|
724
|
-
`;var yt=class
|
|
724
|
+
`;var yt=class n extends HTMLElement{static get observedAttributes(){return["persona-id","priority","points","status","epic","story-id","compact","detail","src"]}static PRIORITIES={critical:{label:"Critical",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"},high:{label:"High",color:"#ea580c",bg:"rgba(234, 88, 12, 0.1)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(202, 138, 4, 0.1)"},low:{label:"Low",color:"#16a34a",bg:"rgba(22, 163, 74, 0.1)"}};static STATUSES={backlog:{label:"Backlog",color:"#6b7280",bg:"rgba(107, 114, 128, 0.1)"},"to-do":{label:"To Do",color:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)"},"in-progress":{label:"In Progress",color:"#8b5cf6",bg:"rgba(139, 92, 246, 0.1)"},review:{label:"Review",color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)"},done:{label:"Done",color:"#22c55e",bg:"rgba(34, 197, 94, 0.1)"}};#e=new Map;#t=null;constructor(){super(),this.attachShadow({mode:"open"})}#r(){for(let t of[...this.children]){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}get data(){return{storyId:this.storyId||void 0,personaId:this.personaId||void 0,priority:this.priority,status:this.status,points:this.points||void 0,epic:this.epic||void 0,detail:this.getAttribute("detail")||void 0,persona:this.persona||void 0,action:this.action||void 0,benefit:this.benefit||void 0,title:this.storyTitle||void 0}}set data(t){!t||typeof t!="object"||(this._applyData(t),this.#r(),this.shadowRoot&&this.#o(),this.dispatchEvent(new CustomEvent("user-story:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0})))}_applyData(t){for(let[e,r]of[["storyId","story-id"],["personaId","persona-id"],["priority","priority"],["status","status"],["points","points"],["epic","epic"],["detail","detail"]])t[e]!=null&&this.setAttribute(r,String(t[e]));if(t.persona&&!this.querySelector('[slot="persona"]')){let e=document.createElement("span");e.slot="persona",e.textContent=String(t.persona),this.appendChild(e)}if(t.action&&!this.querySelector('[slot="action"]')){let e=document.createElement("span");e.slot="action",e.textContent=String(t.action),this.appendChild(e)}if(t.benefit&&!this.querySelector('[slot="benefit"]')){let e=document.createElement("span");e.slot="benefit",e.textContent=String(t.benefit),this.appendChild(e)}if(t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h3");e.slot="title",e.textContent=String(t.title),this.appendChild(e)}for(let e of["acceptance-criteria","tasks","notes"]){let r=e==="acceptance-criteria"?"acceptanceCriteria":e;if(t[r]&&!this.querySelector(`[slot="${e}"]`))if(Array.isArray(t[r])){let a=document.createElement("ul");a.slot=e;for(let s of t[r]){let i=document.createElement("li");i.textContent=String(s),a.appendChild(i)}this.appendChild(a)}else{let a=document.createElement("p");a.slot=e,a.textContent=String(t[r]),this.appendChild(a)}}}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();this._applyData(r),this.#r(),this.#o()}catch(e){console.warn(`[user-story] Failed to load src="${t}":`,e)}}connectedCallback(){this.#r(),this.storyId&&!this.id&&!this.hasAttribute("data-detail-clone")&&(this.id=this.storyId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#o(),this.#a(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded"),this.#t?.disconnect(),this.#t=null}attributeChangedCallback(t,e,r){e!==r&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(r):(this.#o(),t==="persona-id"&&this.#a()))}#a(){if(this.#t?.disconnect(),this.#t=null,!this.personaId||this.#s())return;let t=this.getRootNode(),r=(t&&typeof t.getElementById=="function"?t:document).getElementById(this.personaId);!r||r.tagName!=="USER-PERSONA"||(this.#t=new MutationObserver(()=>this.#o()),this.#t.observe(r,{attributes:!0,attributeFilter:["role"]}))}get persona(){return this.#s()||this.#n()||"user"}get personaId(){return this.getAttribute("persona-id")||""}#s(){return this.querySelector('[slot="persona"]')?.textContent?.trim()||this.#e.get("persona")||""}#n(){if(!this.personaId)return"";let t=this.getRootNode(),r=(t&&typeof t.getElementById=="function"?t:document).getElementById(this.personaId);return!r||r.tagName!=="USER-PERSONA"?"":r.getAttribute("role")?.trim()||""}#i(){return/^[aeio]/i.test(this.persona.trim())?"an":"a"}get action(){return this.querySelector('[slot="action"]')?.textContent?.trim()||this.#e.get("action")||""}get benefit(){return this.querySelector('[slot="benefit"]')?.textContent?.trim()||this.#e.get("benefit")||""}get priority(){return this.getAttribute("priority")||"medium"}get points(){return this.getAttribute("points")||""}get status(){return this.getAttribute("status")||"backlog"}get epic(){return this.getAttribute("epic")||""}get storyId(){return this.getAttribute("story-id")||""}get storyTitle(){return this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||""}get _minimalLabel(){if(this.storyTitle)return this.storyTitle;let t=this.action;return t.length>40?t.slice(0,40)+"\u2026":t}get compact(){return this.hasAttribute("compact")}get _detailLevel(){return this.getAttribute("detail")?this.getAttribute("detail"):this.hasAttribute("compact")?"compact":"full"}updateStatus(t){n.STATUSES[t]&&(this.setAttribute("status",t),this.dispatchEvent(new CustomEvent("status-changed",{detail:{status:t,storyId:this.storyId},bubbles:!0,composed:!0})))}updatePriority(t){n.PRIORITIES[t]&&(this.setAttribute("priority",t),this.dispatchEvent(new CustomEvent("priority-changed",{detail:{priority:t,storyId:this.storyId},bubbles:!0,composed:!0})))}showDetail(){let t=`story-dialog-${this.storyId||this.id||"detail"}`,e=document.getElementById(t);e||(e=document.createElement("dialog"),e.id=t,e.setAttribute("data-size","l"),document.body.appendChild(e));let r=document.createElement("form");r.method="dialog";let a=document.createElement("header"),s=document.createElement("h3");s.textContent=this.storyTitle||this.storyId||"Story Detail";let i=document.createElement("button");i.type="submit",i.setAttribute("aria-label","Close"),i.textContent="\xD7",a.appendChild(s),a.appendChild(i);let o=document.createElement("section"),c=document.createElement("user-story");for(let l of this.getAttributeNames())l==="detail"||l==="compact"||l==="data-upgraded"||l==="draggable"||l==="data-id"||l==="data-quadrant"||c.setAttribute(l,this.getAttribute(l)??"");let d=[...this.children].some(l=>l.getAttribute("slot")&&l.tagName!=="DIALOG");c.setAttribute("detail",d?"full":"compact"),c.removeAttribute("id"),c.setAttribute("data-detail-clone","");for(let l of[...this.children])l.tagName!=="DIALOG"&&c.appendChild(l.cloneNode(!0));o.appendChild(c),r.appendChild(a),r.appendChild(o),e.innerHTML="",e.appendChild(r),e.addEventListener("close",()=>{e.innerHTML=""},{once:!0}),e.showModal()}#o(){let t=n.PRIORITIES[this.priority]||n.PRIORITIES.medium,e=n.STATUSES[this.status]||n.STATUSES.backlog,r=this._detailLevel,a=this.storyId?`User story: ${m(this.storyId)}`:"User story";if(this.shadowRoot){if(r==="minimal"){this.shadowRoot.innerHTML=`
|
|
725
725
|
<style>${vt}</style>
|
|
726
726
|
<article class="story-card story-card--minimal" role="article" aria-label="${a}"
|
|
727
727
|
tabindex="0">
|
|
@@ -732,7 +732,7 @@ var re=`
|
|
|
732
732
|
</div>
|
|
733
733
|
</div>
|
|
734
734
|
</article>
|
|
735
|
-
`;let s=this.shadowRoot.querySelector(".story-card--minimal");if(!s)return;s.addEventListener("click",()=>this.showDetail()),s.addEventListener("keydown",i=>{let
|
|
735
|
+
`;let s=this.shadowRoot.querySelector(".story-card--minimal");if(!s)return;s.addEventListener("click",()=>this.showDetail()),s.addEventListener("keydown",i=>{let o=i;(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this.showDetail())})}else this.shadowRoot.innerHTML=`
|
|
736
736
|
<style>${vt}</style>
|
|
737
737
|
|
|
738
738
|
<article class="story-card story-card--${r}" part="card" role="article" aria-label="${a}">
|
|
@@ -755,7 +755,7 @@ var re=`
|
|
|
755
755
|
<div class="story-body" part="body">
|
|
756
756
|
<p class="story-statement" part="statement">
|
|
757
757
|
<span class="keyword">As ${this.#i()}</span>
|
|
758
|
-
${this.personaId?`<a class="persona-text persona-text--link" href="#${m(this.personaId)}">${k(E.user)} <slot name="persona"><span>${m(this.#
|
|
758
|
+
${this.personaId?`<a class="persona-text persona-text--link" href="#${m(this.personaId)}">${k(E.user)} <slot name="persona"><span>${m(this.#n()||"user")}</span></slot></a>`:'<span class="persona-text"><slot name="persona"><span>user</span></slot></span>'},
|
|
759
759
|
<span class="keyword">I want</span>
|
|
760
760
|
<span class="action-text"><slot name="action"><span>[describe the action]</span></slot></span>${this.benefit||this.querySelector('[slot="benefit"]')?`
|
|
761
761
|
<span class="keyword">so that</span>
|
|
@@ -807,7 +807,7 @@ var re=`
|
|
|
807
807
|
</div>
|
|
808
808
|
</div>
|
|
809
809
|
</article>
|
|
810
|
-
`,r==="compact"&&this.shadowRoot.querySelectorAll(".section").forEach(i=>{let
|
|
810
|
+
`,r==="compact"&&this.shadowRoot.querySelectorAll(".section").forEach(i=>{let o=i.querySelector("slot");o&&o.assignedNodes().length===0&&i.setAttribute("data-empty","")});this.dispatchEvent(new CustomEvent("story-ready",{detail:{id:this.storyId,persona:this.persona,action:this.action,benefit:this.benefit,priority:this.priority,status:this.status,points:this.points},bubbles:!0,composed:!0}))}}};w("user-story",yt);var tt=`
|
|
811
811
|
:host {
|
|
812
812
|
display: block;
|
|
813
813
|
font-family: var(--_font-sans);
|
|
@@ -1105,7 +1105,7 @@ var re=`
|
|
|
1105
1105
|
.journey__grid-wrap { overflow: visible; }
|
|
1106
1106
|
.row-label, .corner { position: relative; }
|
|
1107
1107
|
}
|
|
1108
|
-
`;var
|
|
1108
|
+
`;var Xe=0;function M(n,t,e="vb-vt"){if(!n?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return t(),null;let r=`${e}-${++Xe}`;n.style.viewTransitionName=r;let a=document.startViewTransition(t);return a.finished.finally(()=>{n.style.viewTransitionName===r&&(n.style.viewTransitionName="")}),a}var Ye=[{key:"actions",label:"Actions"},{key:"thoughts",label:"Thoughts"},{key:"touchpoints",label:"Touchpoints"},{key:"painPoints",label:"Pain Points"},{key:"opportunities",label:"Opportunities"}],xt=class extends HTMLElement{static get observedAttributes(){return["src","persona","persona-id","story-ids","compact"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"}),this.__phases=null}get phases(){return this.__phases}set phases(t){this.__phases!==t&&(this.__phases=t,this.isConnected&&this._render(),this.dispatchEvent(new CustomEvent("user-journey:phases-changed",{detail:{phases:t,source:"property"},bubbles:!0,composed:!0})))}get data(){return{persona:this.getAttribute("persona")||void 0,personaId:this.getAttribute("persona-id")||void 0,title:this.querySelector('[slot="title"]')?.textContent?.trim()||void 0,summary:this.querySelector('[slot="summary"]')?.textContent?.trim()||void 0,phases:this.__phases||void 0}}set data(t){if(!(!t||typeof t!="object")){if(t.persona&&this.setAttribute("persona",String(t.persona)),t.personaId&&this.setAttribute("persona-id",String(t.personaId)),t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h2");e.slot="title",e.textContent=t.title,this.appendChild(e)}if(t.summary&&!this.querySelector('[slot="summary"]')){let e=document.createElement("p");e.slot="summary",e.textContent=t.summary,this.appendChild(e)}t.phases!=null&&(this.__phases=t.phases),this.isConnected&&this._render(),this.dispatchEvent(new CustomEvent("user-journey:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0}))}}#t(){for(let t of this.children){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}connectedCallback(){this.#t(),this.setAttribute("data-upgraded",""),this.hasAttribute("src")?this._loadSrc(this.getAttribute("src")):this._render()}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t){this.isConnected&&(t==="src"?this._loadSrc(this.getAttribute("src")):this._render())}async _loadSrc(t){if(!t)return;let e=this.shadowRoot;e.innerHTML=`<style>${tt}</style><div class="state-msg">Loading\u2026</div>`;try{let r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}`);let a=await r.json();if(a.persona&&this.setAttribute("persona",a.persona),a.personaId&&this.setAttribute("persona-id",a.personaId),a.title&&!this.querySelector('[slot="title"]')){let s=document.createElement("h2");s.slot="title",s.textContent=a.title,this.appendChild(s)}if(a.summary&&!this.querySelector('[slot="summary"]')){let s=document.createElement("p");s.slot="summary",s.textContent=a.summary,this.appendChild(s)}this.__phases=a.phases||[],this._render()}catch(r){e.innerHTML=`<style>${tt}</style><div class="state-msg state-msg--error">Could not load journey: ${m(r.message)}</div>`}}_render(){let t=this._resolve("persona")||"",e=this._resolve("persona-id")||"",r=(this.getAttribute("story-ids")||"").split(",").map(u=>u.trim()).filter(Boolean),a=this.hasAttribute("compact"),s=this.__phases,i=!!this.querySelector('[slot="summary"]')||this.#e.has("summary"),o=this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||"",c=`<style>${tt}</style>
|
|
1109
1109
|
<article class="journey${a?" journey--compact":""}">
|
|
1110
1110
|
|
|
1111
1111
|
<header class="journey__header">
|
|
@@ -1129,7 +1129,7 @@ var re=`
|
|
|
1129
1129
|
<p>Add phase data via <code>src</code> (JSON) or set <code>.phases</code> programmatically.</p>
|
|
1130
1130
|
</div>`}
|
|
1131
1131
|
|
|
1132
|
-
</article>`,d=this.shadowRoot,l=()=>{d.innerHTML=c};d.querySelector("article")?M(this,l,"uj-vt"):l(),this.dispatchEvent(new CustomEvent("journey-ready",{bubbles:!0,composed:!0,detail:{title:
|
|
1132
|
+
</article>`,d=this.shadowRoot,l=()=>{d.innerHTML=c};d.querySelector("article")?M(this,l,"uj-vt"):l(),this.dispatchEvent(new CustomEvent("journey-ready",{bubbles:!0,composed:!0,detail:{title:o,persona:t,phaseCount:s?s.length:0}}))}_curve(t){let c=t.length,d=b=>28+(c<2?944/2:b/(c-1)*944),l=b=>14+(1-(R[b.emotion]||R.neutral).score)*72,u=t.map((b,v)=>({x:d(v),y:l(b),ph:b})),p=`M ${u[0].x},${u[0].y}`;for(let b=1;b<u.length;b++){let v=u[b-1],x=u[b],_=(v.x+x.x)/2;p+=` C ${_},${v.y} ${_},${x.y} ${x.x},${x.y}`}let h=`uj-${Math.random().toString(36).slice(2,8)}`,f=u.at(-1);return`
|
|
1133
1133
|
<div class="journey__curve" aria-hidden="true">
|
|
1134
1134
|
<svg viewBox="0 0 1000 100" preserveAspectRatio="none" class="curve-svg">
|
|
1135
1135
|
<defs>
|
|
@@ -1146,14 +1146,14 @@ var re=`
|
|
|
1146
1146
|
<path d="${p}" fill="none" class="curve-line"/>
|
|
1147
1147
|
${u.map(({x:b,y:v,ph:x})=>{let _=R[x.emotion]||R.neutral;return`<circle cx="${b}" cy="${v}" r="5" class="dot" style="fill:${_.color}"/>`}).join("")}
|
|
1148
1148
|
</svg>
|
|
1149
|
-
</div>`}_grid(t){let e=t.map((a,s)=>{let i=R[a.emotion]||R.neutral,
|
|
1149
|
+
</div>`}_grid(t){let e=t.map((a,s)=>{let i=R[a.emotion]||R.neutral,o=a.storyIds||[];return`
|
|
1150
1150
|
<th class="phase-head" data-emotion="${a.emotion||"neutral"}"
|
|
1151
1151
|
style="--ec:${i.color}">
|
|
1152
1152
|
<span class="ph-num">${s+1}</span>
|
|
1153
1153
|
<span class="ph-name">${m(a.name||"")}</span>
|
|
1154
1154
|
<span class="ph-emoji" title="${a.emotion||"neutral"}"><span role="img" aria-label="${m(a.emotion||"neutral")}">${i.emoji}</span></span>
|
|
1155
|
-
${
|
|
1156
|
-
</th>`}).join(""),r=
|
|
1155
|
+
${o.length?`<div class="ph-stories">${o.map(c=>`<a class="chip chip--story" href="#${c}">${this._label(c)}</a>`).join("")}</div>`:""}
|
|
1156
|
+
</th>`}).join(""),r=Ye.map(({key:a,label:s})=>{let i=t.map(o=>{let c=o[a]||[];return c.length?`<td class="data-cell data-cell--${a.toLowerCase()}">
|
|
1157
1157
|
${c.map(d=>`<p>${m(d)}</p>`).join("")}
|
|
1158
1158
|
</td>`:'<td class="data-cell data-cell--empty">\u2014</td>'}).join("");return`
|
|
1159
1159
|
<tr class="grid-row grid-row--${a.toLowerCase()}">
|
|
@@ -1684,7 +1684,7 @@ var re=`
|
|
|
1684
1684
|
.state-msg { padding: var(--_space-l); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
1685
1685
|
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
1686
1686
|
code { font-family: var(--font-mono, Monaco, Menlo, monospace); font-size: 0.88em; }
|
|
1687
|
-
`;var _t=["says","thinks","does","feels"],wt=class extends HTMLElement{static get observedAttributes(){return["persona","persona-id","src","editable","compact"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"}),this.__quadrants=null,this.__goals=null,this.__painPoints=null,this._editingQuadrants=new Set}get quadrants(){return this.__quadrants}set quadrants(t){this.__quadrants=t,this.isConnected&&this._render()}get goals(){return this.__goals}set goals(t){this.__goals=t,this.isConnected&&this._render()}get painPoints(){return this.__painPoints}set painPoints(t){this.__painPoints=t,this.isConnected&&this._render()}#t(){for(let t of this.children){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}connectedCallback(){this.#t(),this.setAttribute("data-upgraded",""),this.hasAttribute("src")?this._loadSrc(this.getAttribute("src")):this._render()}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t){this.isConnected&&(t==="src"?this._loadSrc(this.getAttribute("src")):this._render())}get data(){let t=this.querySelector('[slot="title"]'),e=this.querySelector('[slot="summary"]');return{persona:this.getAttribute("persona")||void 0,personaId:this.getAttribute("persona-id")||void 0,title:t?.textContent?.trim()||void 0,summary:e?.textContent?.trim()||void 0,quadrants:this.__quadrants||void 0,goals:this.__goals||void 0,painPoints:this.__painPoints||void 0}}set data(t){if(!(!t||typeof t!="object")){if(t.persona&&this.setAttribute("persona",String(t.persona)),t.personaId&&this.setAttribute("persona-id",String(t.personaId)),t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h2");e.slot="title",e.textContent=t.title,this.appendChild(e)}if(t.summary&&!this.querySelector('[slot="summary"]')){let e=document.createElement("p");e.slot="summary",e.textContent=t.summary,this.appendChild(e)}t.quadrants!=null&&(this.__quadrants=t.quadrants),t.goals!=null&&(this.__goals=t.goals),t.painPoints!=null&&(this.__painPoints=t.painPoints),this.isConnected&&this._render(),this.dispatchEvent(new CustomEvent("empathy-map:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0}))}}editQuadrant(t){_t.includes(t)&&this.hasAttribute("editable")&&this._openEdit(t)}closeQuadrant(t){_t.includes(t)&&this._closeEdit(t)}async _loadSrc(t){if(!(!t||!this.shadowRoot)){this.shadowRoot.innerHTML=`<style>${et}</style><div class="state-msg">Loading\u2026</div>`;try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();if(r.persona&&this.setAttribute("persona",r.persona),r.personaId&&this.setAttribute("persona-id",r.personaId),r.title&&!this.querySelector('[slot="title"]')){let a=document.createElement("h2");a.slot="title",a.textContent=r.title,this.appendChild(a)}if(r.summary&&!this.querySelector('[slot="summary"]')){let a=document.createElement("p");a.slot="summary",a.textContent=r.summary,this.appendChild(a)}this.__quadrants=r.quadrants||null,this.__goals=r.goals||null,this.__painPoints=r.painPoints||null,this._render()}catch(e){if(!this.shadowRoot)return;let r=e instanceof Error?e.message:String(e);this.shadowRoot.innerHTML=`<style>${et}</style><div class="state-msg state-msg--error">Could not load empathy map: ${m(r)}</div>`}}}_render(){let t=this._resolve("persona")||"",e=this._resolve("persona-id")||"",r=this.hasAttribute("compact"),a=this.hasAttribute("editable"),s=!!this.querySelector('[slot="title"]')||this.#e.has("title"),i=!!this.querySelector('[slot="summary"]')||this.#e.has("summary"),
|
|
1687
|
+
`;var _t=["says","thinks","does","feels"],wt=class extends HTMLElement{static get observedAttributes(){return["persona","persona-id","src","editable","compact"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"}),this.__quadrants=null,this.__goals=null,this.__painPoints=null,this._editingQuadrants=new Set}get quadrants(){return this.__quadrants}set quadrants(t){this.__quadrants=t,this.isConnected&&this._render()}get goals(){return this.__goals}set goals(t){this.__goals=t,this.isConnected&&this._render()}get painPoints(){return this.__painPoints}set painPoints(t){this.__painPoints=t,this.isConnected&&this._render()}#t(){for(let t of this.children){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}connectedCallback(){this.#t(),this.setAttribute("data-upgraded",""),this.hasAttribute("src")?this._loadSrc(this.getAttribute("src")):this._render()}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t){this.isConnected&&(t==="src"?this._loadSrc(this.getAttribute("src")):this._render())}get data(){let t=this.querySelector('[slot="title"]'),e=this.querySelector('[slot="summary"]');return{persona:this.getAttribute("persona")||void 0,personaId:this.getAttribute("persona-id")||void 0,title:t?.textContent?.trim()||void 0,summary:e?.textContent?.trim()||void 0,quadrants:this.__quadrants||void 0,goals:this.__goals||void 0,painPoints:this.__painPoints||void 0}}set data(t){if(!(!t||typeof t!="object")){if(t.persona&&this.setAttribute("persona",String(t.persona)),t.personaId&&this.setAttribute("persona-id",String(t.personaId)),t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h2");e.slot="title",e.textContent=t.title,this.appendChild(e)}if(t.summary&&!this.querySelector('[slot="summary"]')){let e=document.createElement("p");e.slot="summary",e.textContent=t.summary,this.appendChild(e)}t.quadrants!=null&&(this.__quadrants=t.quadrants),t.goals!=null&&(this.__goals=t.goals),t.painPoints!=null&&(this.__painPoints=t.painPoints),this.isConnected&&this._render(),this.dispatchEvent(new CustomEvent("empathy-map:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0}))}}editQuadrant(t){_t.includes(t)&&this.hasAttribute("editable")&&this._openEdit(t)}closeQuadrant(t){_t.includes(t)&&this._closeEdit(t)}async _loadSrc(t){if(!(!t||!this.shadowRoot)){this.shadowRoot.innerHTML=`<style>${et}</style><div class="state-msg">Loading\u2026</div>`;try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();if(r.persona&&this.setAttribute("persona",r.persona),r.personaId&&this.setAttribute("persona-id",r.personaId),r.title&&!this.querySelector('[slot="title"]')){let a=document.createElement("h2");a.slot="title",a.textContent=r.title,this.appendChild(a)}if(r.summary&&!this.querySelector('[slot="summary"]')){let a=document.createElement("p");a.slot="summary",a.textContent=r.summary,this.appendChild(a)}this.__quadrants=r.quadrants||null,this.__goals=r.goals||null,this.__painPoints=r.painPoints||null,this._render()}catch(e){if(!this.shadowRoot)return;let r=e instanceof Error?e.message:String(e);this.shadowRoot.innerHTML=`<style>${et}</style><div class="state-msg state-msg--error">Could not load empathy map: ${m(r)}</div>`}}}_render(){let t=this._resolve("persona")||"",e=this._resolve("persona-id")||"",r=this.hasAttribute("compact"),a=this.hasAttribute("editable"),s=!!this.querySelector('[slot="title"]')||this.#e.has("title"),i=!!this.querySelector('[slot="summary"]')||this.#e.has("summary"),o=this.__goals?.length||this.querySelector('[slot="goals"]'),c=this.__painPoints?.length||this.querySelector('[slot="pain-points"]'),d=`<style>${et}</style>
|
|
1688
1688
|
<article class="empathy-map${r?" empathy-map--compact":""}">
|
|
1689
1689
|
|
|
1690
1690
|
<header class="empathy-map__header">
|
|
@@ -1707,14 +1707,14 @@ var re=`
|
|
|
1707
1707
|
${_t.map(u=>this._renderQuadrant(u,a)).join("")}
|
|
1708
1708
|
</div>
|
|
1709
1709
|
|
|
1710
|
-
${
|
|
1710
|
+
${o||c?`
|
|
1711
1711
|
<footer class="empathy-map__footer">
|
|
1712
1712
|
${this._renderSummaryRow("goals",k(E.target),"Goals")}
|
|
1713
1713
|
${this._renderSummaryRow("pain-points",k(E.alertTriangle),"Pain Points")}
|
|
1714
1714
|
</footer>
|
|
1715
1715
|
`:""}
|
|
1716
1716
|
|
|
1717
|
-
</article>`,l=()=>{this.shadowRoot&&(this.shadowRoot.innerHTML=d,a&&this._bindEditListeners())};this.shadowRoot?.querySelector("article")?M(this,l,"em-vt"):l(),this.dispatchEvent(new CustomEvent("empathy-map:ready",{bubbles:!0,composed:!0,detail:{title:this.querySelector('[slot="title"]')?.textContent?.trim()||"Empathy Map",persona:t}}))}_renderQuadrant(t,e){let r=ft[t],a=this.__quadrants?.[t],s=this._editingQuadrants.has(t),i=a&&a.length?t==="feels"?a.map(c=>this._renderEmotion(c)).join(""):a.map(c=>`<p>${m(c)}</p>`).join(""):`<slot name="${t}"><p class="placeholder">Add ${r.label.toLowerCase()} items\u2026</p></slot>`,
|
|
1717
|
+
</article>`,l=()=>{this.shadowRoot&&(this.shadowRoot.innerHTML=d,a&&this._bindEditListeners())};this.shadowRoot?.querySelector("article")?M(this,l,"em-vt"):l(),this.dispatchEvent(new CustomEvent("empathy-map:ready",{bubbles:!0,composed:!0,detail:{title:this.querySelector('[slot="title"]')?.textContent?.trim()||"Empathy Map",persona:t}}))}_renderQuadrant(t,e){let r=ft[t],a=this.__quadrants?.[t],s=this._editingQuadrants.has(t),i=a&&a.length?t==="feels"?a.map(c=>this._renderEmotion(c)).join(""):a.map(c=>`<p>${m(c)}</p>`).join(""):`<slot name="${t}"><p class="placeholder">Add ${r.label.toLowerCase()} items\u2026</p></slot>`,o=a?.length?a.join(`
|
|
1718
1718
|
`):"";return`
|
|
1719
1719
|
<section class="quadrant quadrant--${t}"${s?" data-editing":""}>
|
|
1720
1720
|
<div class="quadrant__inner">
|
|
@@ -1734,14 +1734,14 @@ var re=`
|
|
|
1734
1734
|
<div class="quadrant__face quadrant__face--back"${s?"":" inert"}>
|
|
1735
1735
|
<textarea class="quadrant__editor" data-quadrant="${t}"
|
|
1736
1736
|
placeholder="One item per line\u2026"
|
|
1737
|
-
aria-label="Edit ${r.label} items">${m(
|
|
1737
|
+
aria-label="Edit ${r.label} items">${m(o)}</textarea>
|
|
1738
1738
|
<button class="quadrant__done-btn" data-quadrant="${t}"
|
|
1739
1739
|
aria-label="Done editing ${r.label}">${k(E.check)} Done</button>
|
|
1740
1740
|
</div>
|
|
1741
1741
|
`:""}
|
|
1742
1742
|
</div>
|
|
1743
1743
|
</div>
|
|
1744
|
-
</section>`}_renderEmotion(t){let e=t.toLowerCase().trim(),r=R[e];return r?`<span class="emotion-tag" style="--ec:${r.color}"><span role="img" aria-label="${m(t)}">${r.emoji}</span> ${m(t)}</span>`:`<p>${m(t)}</p>`}_renderSummaryRow(t,e,r){let s=(t==="pain-points"?"painPoints":t)==="painPoints"?this.__painPoints:this.__goals,i=s?.length?s.map(
|
|
1744
|
+
</section>`}_renderEmotion(t){let e=t.toLowerCase().trim(),r=R[e];return r?`<span class="emotion-tag" style="--ec:${r.color}"><span role="img" aria-label="${m(t)}">${r.emoji}</span> ${m(t)}</span>`:`<p>${m(t)}</p>`}_renderSummaryRow(t,e,r){let s=(t==="pain-points"?"painPoints":t)==="painPoints"?this.__painPoints:this.__goals,i=s?.length?s.map(o=>`<p>${m(o)}</p>`).join(""):`<slot name="${t}"><p class="placeholder">No ${r.toLowerCase()} specified.</p></slot>`;return`
|
|
1745
1745
|
<div class="summary-row">
|
|
1746
1746
|
<span class="summary-row__icon" aria-hidden="true">${e}</span>
|
|
1747
1747
|
<div class="summary-row__body">
|
|
@@ -1749,10 +1749,10 @@ var re=`
|
|
|
1749
1749
|
<div class="summary-row__content">${i}</div>
|
|
1750
1750
|
</div>
|
|
1751
1751
|
</div>`}_bindEditListeners(){let t=this.shadowRoot;t&&(t.querySelectorAll(".quadrant__edit-btn").forEach(e=>{e.addEventListener("click",()=>{let r=e.dataset.quadrant;r&&this._openEdit(r)})}),t.querySelectorAll(".quadrant__done-btn").forEach(e=>{e.addEventListener("click",()=>{let r=e.dataset.quadrant;r&&this._closeEdit(r)})}),t.querySelectorAll(".quadrant__editor").forEach(e=>{let r=e;r.addEventListener("keydown",a=>{let s=a;if(s.key==="Escape"){s.preventDefault();let i=r.dataset.quadrant;i&&this._closeEdit(i)}})}))}_openEdit(t){this._editingQuadrants.add(t);let e=this.shadowRoot?.querySelector(`.quadrant--${t}`);if(!e)return;e.setAttribute("data-editing","");let r=e.querySelector(".quadrant__face--front"),a=e.querySelector(".quadrant__face--back");r&&r.setAttribute("inert",""),a&&a.removeAttribute("inert");let s=e.querySelector(".quadrant__editor");if(s){let i=this.__quadrants?.[t];if(i?.length)s.value=i.join(`
|
|
1752
|
-
`);else{let
|
|
1752
|
+
`);else{let o=e.querySelector(`slot[name="${t}"]`);if(o){let c=o.assignedElements();if(c.length){let d=[];c.forEach(l=>{let u=l.querySelectorAll("li");u.length?u.forEach(p=>d.push(p.textContent?.trim()??"")):d.push(l.textContent?.trim()??"")}),s.value=d.filter(Boolean).join(`
|
|
1753
1753
|
`)}}}s.focus()}}_closeEdit(t){let e=this.shadowRoot?.querySelector(`.quadrant--${t}`);if(!e)return;let r=e.querySelector(".quadrant__editor");if(r){let i=r.value.split(`
|
|
1754
|
-
`).map(c=>c.trim()).filter(Boolean);this.__quadrants||(this.__quadrants={}),this.__quadrants[t]=i;let n=e.querySelector(".quadrant__content");if(n)if(i.length)n.innerHTML=t==="feels"?i.map(c=>this._renderEmotion(c)).join(""):i.map(c=>`<p>${m(c)}</p>`).join("");else{let c=ft[t];n.innerHTML=`<p class="placeholder">Add ${c.label.toLowerCase()} items\u2026</p>`}}this._editingQuadrants.delete(t),e.removeAttribute("data-editing");let a=e.querySelector(".quadrant__face--front"),s=e.querySelector(".quadrant__face--back");a&&a.removeAttribute("inert"),s&&s.setAttribute("inert",""),this.dispatchEvent(new CustomEvent("empathy-map:update",{bubbles:!0,composed:!0,detail:{quadrant:t,items:this.__quadrants?.[t]||[]}}))}};w("empathy-map",wt);var C=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,a){t.addEventListener(e,r,a),this.#e.push(()=>t.removeEventListener(e,r,a))}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let a=`--${t}`;e?r.add(a):r.delete(a)}}_adoptInternals(t){this.#t||(this.#t=t)}};function rt({newItems:o,nodes:t,keyOf:e,renderItem:r,containerFor:a}){let s=[],i=[],n=[],c=new Set;for(let l of o)c.add(e(l));for(let[l,u]of[...t])c.has(l)||(u.remove(),t.delete(l),n.push(l));let d=new Map;for(let l of o){let u=e(l),p=t.get(u)||null,h=a(l,p);d.has(h)||d.set(h,[]),d.get(h)?.push({item:l,key:u,existing:p})}for(let[l,u]of d)for(let p=0;p<u.length;p++){let{item:h,key:f,existing:b}=u[p],v=b;v?(v.parentElement!==l||l.children[p]!==v)&&i.push(f):(v=r(h),t.set(f,v),s.push(f));let x=l.children[p];x!==v&&l.insertBefore(v,x||null)}return{added:s,moved:i,removed:n}}var At=class o extends C{static QUADRANTS=["quick-wins","big-bets","fill-ins","money-pit"];static LABELS={"quick-wins":"Quick Wins","big-bets":"Big Bets","fill-ins":"Fill-Ins","money-pit":"Money Pit"};static DESCRIPTIONS={"quick-wins":"High impact \xB7 Low effort","big-bets":"High impact \xB7 High effort","fill-ins":"Low impact \xB7 Low effort","money-pit":"Low impact \xB7 High effort"};static#e=0;static get observedAttributes(){return["src","compact","title"]}#t=null;#r={};#a=null;#s="";#o=null;setup(){this.#s=`ie-${++o.#e}`;let t=[...this.querySelectorAll(":scope > [data-quadrant], :scope > [draggable]")],e=document.createElement("div");e.className="ie-wrapper";let r=document.createElement("div");r.className="ie-y-label",r.setAttribute("aria-hidden","true"),r.textContent="Impact \u2191";let a=document.createElement("div");a.style.cssText="display:flex;flex-direction:column;flex:1;min-width:0;";let s=document.createElement("div");s.className="ie-grid",s.setAttribute("role","region"),s.setAttribute("aria-label","Impact-Effort prioritization matrix");let i=document.createElement("div");i.className="ie-x-label",i.setAttribute("aria-hidden","true"),i.textContent="Effort \u2192";for(let l of o.QUADRANTS){let u=document.createElement("section");u.className="ie-quadrant",u.dataset.quadrantZone=l,u.setAttribute("aria-label",`${o.LABELS[l]}: ${o.DESCRIPTIONS[l]}`);let p=document.createElement("header");p.className="ie-quadrant-label",p.innerHTML=`${o.LABELS[l]}<br><span class="ie-quadrant-desc">${o.DESCRIPTIONS[l]}</span>`;let h=document.createElement("drag-surface");h.setAttribute("group",this.#s),h.setAttribute("aria-label",o.LABELS[l]),h.setAttribute("data-layout","stack"),h.setAttribute("data-layout-gap","xs"),u.appendChild(p),u.appendChild(h),s.appendChild(u),this.#r[l]=h}t.forEach((l,u)=>{let p=l,h=p.getAttribute("data-quadrant")||"quick-wins",f=this.#r[h]||this.#r["quick-wins"];p.hasAttribute("draggable")||p.setAttribute("draggable","true"),p.hasAttribute("data-id")||(p.dataset.id=`ie-item-${u}`),f.appendChild(p)});let n=document.createElement("div");n.className="ie-live-region",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true");let c=this.getAttribute("title");if(c){let l=document.createElement("h3");l.className="ie-title",l.textContent=c,this.prepend(l)}a.appendChild(s),a.appendChild(i),e.appendChild(r),e.appendChild(a),this.appendChild(e),this.appendChild(n),this.#t=s,this.#a=n,this.#o=e,this.listen(this,"drag-surface:transfer",l=>{let{item:u,fromSurface:p,toSurface:h}=l.detail,f=this.#l(p),b=this.#l(h);!f||!b||(u.setAttribute("data-quadrant",b),this.#p(`Moved ${this.#d(u)} to ${o.LABELS[b]}`),this.dispatchEvent(new CustomEvent("impact-effort:move",{bubbles:!0,detail:{itemId:u.dataset.id,from:f,to:b,item:u}})))});let d=this.getAttribute("src");d&&this.#c(d),this.#f()}teardown(){this.#o&&(this.#o.remove(),this.#o=null),this.#a&&(this.#a.remove(),this.#a=null),this.#t=null,this.#r={},this.#n.clear(),this.#i=[]}#i=[];#n=new Map;get items(){if(this.#i.length)return this.#i;let t=[];for(let[e,r]of Object.entries(this.#r))for(let a of r.querySelectorAll(':scope > [draggable="true"]'))t.push({id:a.getAttribute("data-id")||void 0,quadrant:e,text:a.textContent?.trim()||void 0});return t}set items(t){if(!this.#t)return;let e=Array.isArray(t)?t:[];rt({newItems:e,nodes:this.#n,keyOf:r=>r.id??`${r.quadrant}:${r.text}`,renderItem:r=>{let a=this;if(typeof a.renderItem=="function"){let i=a.renderItem(r);if(i instanceof Element)return i.hasAttribute("draggable")||i.setAttribute("draggable","true"),i.hasAttribute("data-id")||i.setAttribute("data-id",String(r.id??"")),i}let s=document.createElement("article");return s.className="ie-card",s.setAttribute("draggable","true"),r.id&&s.setAttribute("data-id",String(r.id)),s.textContent=r.text||r.id||"",s},containerFor:r=>this.#r[r.quadrant]||this.#r["quick-wins"]}),this.#i=e,this.dispatchEvent(new CustomEvent("impact-effort:items-changed",{detail:{items:e,source:"property"},bubbles:!0}))}attributeChangedCallback(t,e,r){this.hasAttribute("data-upgraded")&&t==="src"&&r&&r!==e&&this.#c(r)}async#c(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();if(!Array.isArray(r))return;let a=()=>{for(let s of o.QUADRANTS){let i=this.#r[s];if(i)for(let n of[...i.querySelectorAll("[draggable]")])n.remove()}r.forEach((s,i)=>{let n=s.quadrant||"quick-wins",c=s.id||`ie-item-${i}`,d;s.persona||s.action||s.storyId?(d=document.createElement("user-story"),d.setAttribute("detail","minimal"),s.storyId&&d.setAttribute("story-id",s.storyId),s.persona&&d.setAttribute("persona",s.persona),s.action&&d.setAttribute("action",s.action),s.benefit&&d.setAttribute("benefit",s.benefit),s.priority&&d.setAttribute("priority",s.priority),s.status&&d.setAttribute("status",s.status),s.points&&d.setAttribute("points",String(s.points))):(d=document.createElement("article"),d.textContent=s.label||s.text||""),d.setAttribute("draggable","true"),d.dataset.id=c,d.dataset.quadrant=n,(this.#r[n]||this.#r["quick-wins"]).appendChild(d)})};this.hasAttribute("data-upgraded")&&this.#t?M(this,a,"ie-vt"):a(),this.#f()}catch(e){console.warn(`[impact-effort] Failed to load src="${t}":`,e)}}#l(t){for(let[e,r]of Object.entries(this.#r))if(r===t)return e;return null}#p(t){let e=this.#a;e&&(e.textContent="",requestAnimationFrame(()=>{e.textContent=t}))}#d(t){return t.dataset.id||t.textContent.trim().slice(0,40)}#f(){let t={};for(let e of o.QUADRANTS){let r=this.#r[e];t[e]=r?r.querySelectorAll('[draggable="true"]').length:0}this.dispatchEvent(new CustomEvent("impact-effort:ready",{bubbles:!0,detail:{quadrantCounts:t}}))}};w("impact-effort",At);var kt=class o extends C{static#e=0;setup(){this.#d=`qg-${++o.#e}`;let t=this.getAttribute("x-label")||"",e=this.getAttribute("y-label")||"",r=this.getAttribute("x-low")||"Low",a=this.getAttribute("x-high")||"High",s=this.getAttribute("y-low")||"Low",i=this.getAttribute("y-high")||"High",n=[this.getAttribute("q1-label")||"Q1",this.getAttribute("q2-label")||"Q2",this.getAttribute("q3-label")||"Q3",this.getAttribute("q4-label")||"Q4"],c=this.hasAttribute("draggable"),d=[...this.querySelectorAll(":scope > [data-quadrant], :scope > [data-x][data-y]")],l=document.createElement("section");l.className="qg-wrapper",l.setAttribute("role","region"),l.setAttribute("aria-label",`${e} \xD7 ${t} quadrant grid`);let u=document.createElement("header");u.className="qg-y-label",u.setAttribute("aria-hidden","true"),u.textContent=`\u2191 ${e}`;let p=document.createElement("aside");p.className="qg-y-scale",p.setAttribute("aria-hidden","true"),p.innerHTML=`<span>${i}</span><span>${s}</span>`;let h=document.createElement("div");h.className="qg-grid";let f=document.createElement("aside");f.className="qg-x-scale",f.setAttribute("aria-hidden","true"),f.innerHTML=`<span>${r}</span><span>${a}</span>`;let b=document.createElement("footer");b.className="qg-x-label",b.setAttribute("aria-hidden","true"),b.textContent=`${t} \u2192`;for(let x=0;x<4;x++){let _=document.createElement("section");_.className="qg-quadrant",_.dataset.quadrantZone=String(x),_.setAttribute("aria-label",n[x]);let g=document.createElement("header");if(g.className="qg-quadrant-label",g.textContent=n[x],_.appendChild(g),c){let y=document.createElement("drag-surface");y.setAttribute("group",this.#d),y.setAttribute("aria-label",n[x]),y.setAttribute("data-layout","stack"),y.setAttribute("data-layout-gap","xs"),_.appendChild(y),this.#f[x]=y}else{let y=document.createElement("ul");y.className="qg-items",_.appendChild(y),this.#u[x]=y}h.appendChild(_),this.#m[x]=_}d.forEach((x,_)=>{let g=x,y=this.#n(g),A=c?this.#f[y]:this.#u[y];if(c&&(g.hasAttribute("draggable")||g.setAttribute("draggable","true")),g.hasAttribute("data-id")||(g.dataset.id=`qg-item-${_}`),g.hasAttribute("data-x")&&g.hasAttribute("data-y")){let S=parseFloat(g.getAttribute("data-x")??""),$=parseFloat(g.getAttribute("data-y")??"");if(Number.isFinite(S)&&Number.isFinite($)){let T=y===0||y===3?(S-.5)*2:S*2,z=y===0||y===1?($-.5)*2:$*2;if(g.style.setProperty("--qg-local-x",T.toFixed(4)),g.style.setProperty("--qg-local-y",z.toFixed(4)),g.classList.add("qg-pinned"),!g.style.getPropertyValue("--qg-pin-hue")){let N=g.dataset.id||(g.textContent||"").trim();g.style.setProperty("--qg-pin-hue",`${o.#o(N)}deg`)}}}if(c)A.appendChild(g);else{let S=document.createElement("li");S.appendChild(g),A.appendChild(S)}});let v=document.createElement("div");v.className="qg-live-region visually-hidden",v.setAttribute("role","status"),v.setAttribute("aria-live","polite"),l.appendChild(u),l.appendChild(p),l.appendChild(h),l.appendChild(f),l.appendChild(b),this.appendChild(l),this.appendChild(v),this.#h=h,this.#b=v,this.#v=n,c&&this.listen(this,"drag-surface:transfer",this.#i),this.#t()}#t(){if(typeof ResizeObserver>"u")return;let t=e=>{let r=e.offsetWidth,a=e.offsetHeight;r>0&&e.style.setProperty("--qg-pin-half-w",`${r/2}px`),a>0&&e.style.setProperty("--qg-pin-half-h",`${a/2}px`)};this.#y=new ResizeObserver(e=>{for(let r of e)t(r.target);this.#r()});for(let e of this.querySelectorAll(".qg-pinned"))this.#y.observe(e);this.#r()}#r(){this.#g||(this.#g=requestAnimationFrame(()=>{this.#g=0,this.#a()}))}#a(){for(let e of this.querySelectorAll(".qg-pinned")){let r=e;r.classList.remove("qg-clustered"),r.style.removeProperty("--qg-cluster-i"),r.style.removeProperty("--qg-cluster-n"),delete r.dataset.cluster,r.dataset.qgTabbed!==void 0&&(r.removeAttribute("tabindex"),delete r.dataset.qgTabbed)}let t=0;for(let e=0;e<4;e++){let r=this.#m[e];if(!r)continue;let a=[...r.querySelectorAll(".qg-pinned")];if(a.length<2)continue;let s=a.map(l=>l.getBoundingClientRect()),i=Array.from({length:a.length},(l,u)=>u),n=l=>i[l]===l?l:i[l]=n(i[l]),c=(l,u)=>{let p=n(l),h=n(u);p!==h&&(i[p]=h)};for(let l=0;l<a.length;l++)for(let u=l+1;u<a.length;u++)o.#s(s[l],s[u])&&c(l,u);let d=new Map;for(let l=0;l<a.length;l++){let u=n(l);d.has(u)||d.set(u,[]),d.get(u)?.push(l)}for(let l of d.values()){if(l.length<2)continue;let u=`c${++t}`;l.forEach((p,h)=>{let f=a[p];f.classList.add("qg-clustered"),f.dataset.cluster=u,f.style.setProperty("--qg-cluster-i",String(h)),f.style.setProperty("--qg-cluster-n",String(l.length)),!f.hasAttribute("tabindex")&&!f.matches("a, button, [contenteditable]")&&(f.setAttribute("tabindex","0"),f.dataset.qgTabbed="")})}}}teardown(){this.#y?.disconnect(),this.#y=null,this.#g&&cancelAnimationFrame(this.#g),this.#g=0}static#s(t,e){return!(t.right<=e.left||e.right<=t.left||t.bottom<=e.top||e.bottom<=t.top)}static#o(t){let e=5381;for(let r=0;r<t.length;r++)e=(e<<5)+e+t.charCodeAt(r)|0;return(e%360+360)%360}#i=t=>{let{item:e,fromSurface:r,toSurface:a}=t.detail,s=this.#c(r),i=this.#c(a);s==null||i==null||(e.setAttribute("data-quadrant",String(i)),this.#p(`Moved ${this.#l(e)} to ${this.#v[i]}`),this.dispatchEvent(new CustomEvent("quadrant-grid:move",{bubbles:!0,detail:{item:e,itemId:e.dataset.id,from:s,to:i}})))};#n(t){let e=parseInt(t.getAttribute("data-quadrant"),10);if(e>=0&&e<=3)return e;if(t.hasAttribute("data-x")&&t.hasAttribute("data-y")){let r=parseFloat(t.getAttribute("data-x")),a=parseFloat(t.getAttribute("data-y"));return o.quadrantFor(r,a)}return 0}static quadrantFor(t,e){let r=t>=.5,a=e>=.5;return a&&r?0:a&&!r?1:!a&&!r?2:3}#c(t){for(let e=0;e<4;e++)if(this.#f[e]===t)return e;return null}#l(t){return(t.textContent||"").trim().split(`
|
|
1755
|
-
`)[0]||"item"}#
|
|
1754
|
+
`).map(c=>c.trim()).filter(Boolean);this.__quadrants||(this.__quadrants={}),this.__quadrants[t]=i;let o=e.querySelector(".quadrant__content");if(o)if(i.length)o.innerHTML=t==="feels"?i.map(c=>this._renderEmotion(c)).join(""):i.map(c=>`<p>${m(c)}</p>`).join("");else{let c=ft[t];o.innerHTML=`<p class="placeholder">Add ${c.label.toLowerCase()} items\u2026</p>`}}this._editingQuadrants.delete(t),e.removeAttribute("data-editing");let a=e.querySelector(".quadrant__face--front"),s=e.querySelector(".quadrant__face--back");a&&a.removeAttribute("inert"),s&&s.setAttribute("inert",""),this.dispatchEvent(new CustomEvent("empathy-map:update",{bubbles:!0,composed:!0,detail:{quadrant:t,items:this.__quadrants?.[t]||[]}}))}};w("empathy-map",wt);var C=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,a){t.addEventListener(e,r,a),this.#e.push(()=>t.removeEventListener(e,r,a))}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let a=`--${t}`;e?r.add(a):r.delete(a)}}_adoptInternals(t){this.#t||(this.#t=t)}};function rt({newItems:n,nodes:t,keyOf:e,renderItem:r,containerFor:a}){let s=[],i=[],o=[],c=new Set;for(let l of n)c.add(e(l));for(let[l,u]of[...t])c.has(l)||(u.remove(),t.delete(l),o.push(l));let d=new Map;for(let l of n){let u=e(l),p=t.get(u)||null,h=a(l,p);d.has(h)||d.set(h,[]),d.get(h)?.push({item:l,key:u,existing:p})}for(let[l,u]of d)for(let p=0;p<u.length;p++){let{item:h,key:f,existing:b}=u[p],v=b;v?(v.parentElement!==l||l.children[p]!==v)&&i.push(f):(v=r(h),t.set(f,v),s.push(f));let x=l.children[p];x!==v&&l.insertBefore(v,x||null)}return{added:s,moved:i,removed:o}}var At=class n extends C{static QUADRANTS=["quick-wins","big-bets","fill-ins","money-pit"];static LABELS={"quick-wins":"Quick Wins","big-bets":"Big Bets","fill-ins":"Fill-Ins","money-pit":"Money Pit"};static DESCRIPTIONS={"quick-wins":"High impact \xB7 Low effort","big-bets":"High impact \xB7 High effort","fill-ins":"Low impact \xB7 Low effort","money-pit":"Low impact \xB7 High effort"};static#e=0;static get observedAttributes(){return["src","compact","title"]}#t=null;#r={};#a=null;#s="";#n=null;setup(){this.#s=`ie-${++n.#e}`;let t=[...this.querySelectorAll(":scope > [data-quadrant], :scope > [draggable]")],e=document.createElement("div");e.className="ie-wrapper";let r=document.createElement("div");r.className="ie-y-label",r.setAttribute("aria-hidden","true"),r.textContent="Impact \u2191";let a=document.createElement("div");a.style.cssText="display:flex;flex-direction:column;flex:1;min-width:0;";let s=document.createElement("div");s.className="ie-grid",s.setAttribute("role","region"),s.setAttribute("aria-label","Impact-Effort prioritization matrix");let i=document.createElement("div");i.className="ie-x-label",i.setAttribute("aria-hidden","true"),i.textContent="Effort \u2192";for(let l of n.QUADRANTS){let u=document.createElement("section");u.className="ie-quadrant",u.dataset.quadrantZone=l,u.setAttribute("aria-label",`${n.LABELS[l]}: ${n.DESCRIPTIONS[l]}`);let p=document.createElement("header");p.className="ie-quadrant-label",p.innerHTML=`${n.LABELS[l]}<br><span class="ie-quadrant-desc">${n.DESCRIPTIONS[l]}</span>`;let h=document.createElement("drag-surface");h.setAttribute("group",this.#s),h.setAttribute("aria-label",n.LABELS[l]),h.setAttribute("data-layout","stack"),h.setAttribute("data-layout-gap","xs"),u.appendChild(p),u.appendChild(h),s.appendChild(u),this.#r[l]=h}t.forEach((l,u)=>{let p=l,h=p.getAttribute("data-quadrant")||"quick-wins",f=this.#r[h]||this.#r["quick-wins"];p.hasAttribute("draggable")||p.setAttribute("draggable","true"),p.hasAttribute("data-id")||(p.dataset.id=`ie-item-${u}`),f.appendChild(p)});let o=document.createElement("div");o.className="ie-live-region",o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),o.setAttribute("aria-atomic","true");let c=this.getAttribute("title");if(c){let l=document.createElement("h3");l.className="ie-title",l.textContent=c,this.prepend(l)}a.appendChild(s),a.appendChild(i),e.appendChild(r),e.appendChild(a),this.appendChild(e),this.appendChild(o),this.#t=s,this.#a=o,this.#n=e,this.listen(this,"drag-surface:transfer",l=>{let{item:u,fromSurface:p,toSurface:h}=l.detail,f=this.#p(p),b=this.#p(h);!f||!b||(u.setAttribute("data-quadrant",b),this.#l(`Moved ${this.#u(u)} to ${n.LABELS[b]}`),this.dispatchEvent(new CustomEvent("impact-effort:move",{bubbles:!0,detail:{itemId:u.dataset.id,from:f,to:b,item:u}})))});let d=this.getAttribute("src");d&&this.#c(d),this.#m()}teardown(){this.#n&&(this.#n.remove(),this.#n=null),this.#a&&(this.#a.remove(),this.#a=null),this.#t=null,this.#r={},this.#o.clear(),this.#i=[]}#i=[];#o=new Map;get items(){if(this.#i.length)return this.#i;let t=[];for(let[e,r]of Object.entries(this.#r))for(let a of r.querySelectorAll(':scope > [draggable="true"]'))t.push({id:a.getAttribute("data-id")||void 0,quadrant:e,text:a.textContent?.trim()||void 0});return t}set items(t){if(!this.#t)return;let e=Array.isArray(t)?t:[];rt({newItems:e,nodes:this.#o,keyOf:r=>r.id??`${r.quadrant}:${r.text}`,renderItem:r=>{let a=this;if(typeof a.renderItem=="function"){let i=a.renderItem(r);if(i instanceof Element)return i.hasAttribute("draggable")||i.setAttribute("draggable","true"),i.hasAttribute("data-id")||i.setAttribute("data-id",String(r.id??"")),i}let s=document.createElement("article");return s.className="ie-card",s.setAttribute("draggable","true"),r.id&&s.setAttribute("data-id",String(r.id)),s.textContent=r.text||r.id||"",s},containerFor:r=>this.#r[r.quadrant]||this.#r["quick-wins"]}),this.#i=e,this.dispatchEvent(new CustomEvent("impact-effort:items-changed",{detail:{items:e,source:"property"},bubbles:!0}))}attributeChangedCallback(t,e,r){this.hasAttribute("data-upgraded")&&t==="src"&&r&&r!==e&&this.#c(r)}async#c(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();if(!Array.isArray(r))return;let a=()=>{for(let s of n.QUADRANTS){let i=this.#r[s];if(i)for(let o of[...i.querySelectorAll("[draggable]")])o.remove()}r.forEach((s,i)=>{let o=s.quadrant||"quick-wins",c=s.id||`ie-item-${i}`,d;s.persona||s.action||s.storyId?(d=document.createElement("user-story"),d.setAttribute("detail","minimal"),s.storyId&&d.setAttribute("story-id",s.storyId),s.persona&&d.setAttribute("persona",s.persona),s.action&&d.setAttribute("action",s.action),s.benefit&&d.setAttribute("benefit",s.benefit),s.priority&&d.setAttribute("priority",s.priority),s.status&&d.setAttribute("status",s.status),s.points&&d.setAttribute("points",String(s.points))):(d=document.createElement("article"),d.textContent=s.label||s.text||""),d.setAttribute("draggable","true"),d.dataset.id=c,d.dataset.quadrant=o,(this.#r[o]||this.#r["quick-wins"]).appendChild(d)})};this.hasAttribute("data-upgraded")&&this.#t?M(this,a,"ie-vt"):a(),this.#m()}catch(e){console.warn(`[impact-effort] Failed to load src="${t}":`,e)}}#p(t){for(let[e,r]of Object.entries(this.#r))if(r===t)return e;return null}#l(t){let e=this.#a;e&&(e.textContent="",requestAnimationFrame(()=>{e.textContent=t}))}#u(t){return t.dataset.id||t.textContent.trim().slice(0,40)}#m(){let t={};for(let e of n.QUADRANTS){let r=this.#r[e];t[e]=r?r.querySelectorAll('[draggable="true"]').length:0}this.dispatchEvent(new CustomEvent("impact-effort:ready",{bubbles:!0,detail:{quadrantCounts:t}}))}};w("impact-effort",At);var kt=class n extends C{static#e=0;setup(){this.#u=`qg-${++n.#e}`;let t=this.getAttribute("x-label")||"",e=this.getAttribute("y-label")||"",r=this.getAttribute("x-low")||"Low",a=this.getAttribute("x-high")||"High",s=this.getAttribute("y-low")||"Low",i=this.getAttribute("y-high")||"High",o=[this.getAttribute("q1-label")||"Q1",this.getAttribute("q2-label")||"Q2",this.getAttribute("q3-label")||"Q3",this.getAttribute("q4-label")||"Q4"],c=this.hasAttribute("draggable"),d=[...this.querySelectorAll(":scope > [data-quadrant], :scope > [data-x][data-y]")],l=document.createElement("section");l.className="qg-wrapper",l.setAttribute("role","region"),l.setAttribute("aria-label",`${e} \xD7 ${t} quadrant grid`);let u=document.createElement("header");u.className="qg-y-label",u.setAttribute("aria-hidden","true"),u.textContent=`\u2191 ${e}`;let p=document.createElement("aside");p.className="qg-y-scale",p.setAttribute("aria-hidden","true"),p.innerHTML=`<span>${i}</span><span>${s}</span>`;let h=document.createElement("div");h.className="qg-grid";let f=document.createElement("aside");f.className="qg-x-scale",f.setAttribute("aria-hidden","true"),f.innerHTML=`<span>${r}</span><span>${a}</span>`;let b=document.createElement("footer");b.className="qg-x-label",b.setAttribute("aria-hidden","true"),b.textContent=`${t} \u2192`;for(let x=0;x<4;x++){let _=document.createElement("section");_.className="qg-quadrant",_.dataset.quadrantZone=String(x),_.setAttribute("aria-label",o[x]);let g=document.createElement("header");if(g.className="qg-quadrant-label",g.textContent=o[x],_.appendChild(g),c){let y=document.createElement("drag-surface");y.setAttribute("group",this.#u),y.setAttribute("aria-label",o[x]),y.setAttribute("data-layout","stack"),y.setAttribute("data-layout-gap","xs"),_.appendChild(y),this.#m[x]=y}else{let y=document.createElement("ul");y.className="qg-items",_.appendChild(y),this.#x[x]=y}h.appendChild(_),this.#f[x]=_}d.forEach((x,_)=>{let g=x,y=this.#o(g),A=c?this.#m[y]:this.#x[y];if(c&&(g.hasAttribute("draggable")||g.setAttribute("draggable","true")),g.hasAttribute("data-id")||(g.dataset.id=`qg-item-${_}`),g.hasAttribute("data-x")&&g.hasAttribute("data-y")){let S=parseFloat(g.getAttribute("data-x")??""),$=parseFloat(g.getAttribute("data-y")??"");if(Number.isFinite(S)&&Number.isFinite($)){let T=y===0||y===3?(S-.5)*2:S*2,z=y===0||y===1?($-.5)*2:$*2;if(g.style.setProperty("--qg-local-x",T.toFixed(4)),g.style.setProperty("--qg-local-y",z.toFixed(4)),g.classList.add("qg-pinned"),!g.style.getPropertyValue("--qg-pin-hue")){let N=g.dataset.id||(g.textContent||"").trim();g.style.setProperty("--qg-pin-hue",`${n.#n(N)}deg`)}}}if(c)A.appendChild(g);else{let S=document.createElement("li");S.appendChild(g),A.appendChild(S)}});let v=document.createElement("div");v.className="qg-live-region visually-hidden",v.setAttribute("role","status"),v.setAttribute("aria-live","polite"),l.appendChild(u),l.appendChild(p),l.appendChild(h),l.appendChild(f),l.appendChild(b),this.appendChild(l),this.appendChild(v),this.#g=h,this.#d=v,this.#h=o,c&&this.listen(this,"drag-surface:transfer",this.#i),this.#t()}#t(){if(typeof ResizeObserver>"u")return;let t=e=>{let r=e.offsetWidth,a=e.offsetHeight;r>0&&e.style.setProperty("--qg-pin-half-w",`${r/2}px`),a>0&&e.style.setProperty("--qg-pin-half-h",`${a/2}px`)};this.#v=new ResizeObserver(e=>{for(let r of e)t(r.target);this.#r()});for(let e of this.querySelectorAll(".qg-pinned"))this.#v.observe(e);this.#r()}#r(){this.#b||(this.#b=requestAnimationFrame(()=>{this.#b=0,this.#a()}))}#a(){for(let e of this.querySelectorAll(".qg-pinned")){let r=e;r.classList.remove("qg-clustered"),r.style.removeProperty("--qg-cluster-i"),r.style.removeProperty("--qg-cluster-n"),delete r.dataset.cluster,r.dataset.qgTabbed!==void 0&&(r.removeAttribute("tabindex"),delete r.dataset.qgTabbed)}let t=0;for(let e=0;e<4;e++){let r=this.#f[e];if(!r)continue;let a=[...r.querySelectorAll(".qg-pinned")];if(a.length<2)continue;let s=a.map(l=>l.getBoundingClientRect()),i=Array.from({length:a.length},(l,u)=>u),o=l=>i[l]===l?l:i[l]=o(i[l]),c=(l,u)=>{let p=o(l),h=o(u);p!==h&&(i[p]=h)};for(let l=0;l<a.length;l++)for(let u=l+1;u<a.length;u++)n.#s(s[l],s[u])&&c(l,u);let d=new Map;for(let l=0;l<a.length;l++){let u=o(l);d.has(u)||d.set(u,[]),d.get(u)?.push(l)}for(let l of d.values()){if(l.length<2)continue;let u=`c${++t}`;l.forEach((p,h)=>{let f=a[p];f.classList.add("qg-clustered"),f.dataset.cluster=u,f.style.setProperty("--qg-cluster-i",String(h)),f.style.setProperty("--qg-cluster-n",String(l.length)),!f.hasAttribute("tabindex")&&!f.matches("a, button, [contenteditable]")&&(f.setAttribute("tabindex","0"),f.dataset.qgTabbed="")})}}}teardown(){this.#v?.disconnect(),this.#v=null,this.#b&&cancelAnimationFrame(this.#b),this.#b=0}static#s(t,e){return!(t.right<=e.left||e.right<=t.left||t.bottom<=e.top||e.bottom<=t.top)}static#n(t){let e=5381;for(let r=0;r<t.length;r++)e=(e<<5)+e+t.charCodeAt(r)|0;return(e%360+360)%360}#i=t=>{let{item:e,fromSurface:r,toSurface:a}=t.detail,s=this.#c(r),i=this.#c(a);s==null||i==null||(e.setAttribute("data-quadrant",String(i)),this.#l(`Moved ${this.#p(e)} to ${this.#h[i]}`),this.dispatchEvent(new CustomEvent("quadrant-grid:move",{bubbles:!0,detail:{item:e,itemId:e.dataset.id,from:s,to:i}})))};#o(t){let e=parseInt(t.getAttribute("data-quadrant"),10);if(e>=0&&e<=3)return e;if(t.hasAttribute("data-x")&&t.hasAttribute("data-y")){let r=parseFloat(t.getAttribute("data-x")),a=parseFloat(t.getAttribute("data-y"));return n.quadrantFor(r,a)}return 0}static quadrantFor(t,e){let r=t>=.5,a=e>=.5;return a&&r?0:a&&!r?1:!a&&!r?2:3}#c(t){for(let e=0;e<4;e++)if(this.#m[e]===t)return e;return null}#p(t){return(t.textContent||"").trim().split(`
|
|
1755
|
+
`)[0]||"item"}#l(t){this.#d&&(this.#d.textContent=t)}#u="";#m={};#x={};#f={};#g=null;#d=null;#h=[];#v=null;#b=0};w("quadrant-grid",kt);var ie=5,Ct=class n extends C{setup(){let t=this.querySelector(":scope > template"),e=t?n.#t(t):[];if(this.hasAttribute("src")){this.#e(this.getAttribute("src"));return}this.#r(e)}async#e(t){try{let r=await(await fetch(t)).json();this.#r(Array.isArray(r)?r:[])}catch(e){console.warn("risk-register: failed to load src",t,e),this.#r([])}}static#t(t){let e=[],r=t.content.querySelectorAll("tr");for(let a of r){let s=[...a.children],i=s[0]?.textContent?.trim()||"",o=a.getAttribute("data-id")||i.toLowerCase().replace(/\s+/g,"-")||`risk-${e.length}`;e.push({id:o,title:i,likelihood:parseInt(s[1]?.textContent??"",10)||0,impact:parseInt(s[2]?.textContent??"",10)||0,owner:s[3]?.textContent?.trim()||"",mitigation:s[4]?.textContent?.trim()||""})}return e}#r(t){this.#i=t,[...this.children].forEach(a=>{a.tagName!=="TEMPLATE"&&a.remove()});let e=this.getAttribute("label");if(e){let a=document.createElement("header");a.className="rr-label",a.textContent=e,this.appendChild(a)}let r=document.createElement("div");r.className="rr-layout",r.appendChild(this.#a(t)),r.appendChild(this.#s(t)),this.appendChild(r),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("risk-register:ready",{bubbles:!0,detail:{count:t.length}}))})}#a(t){let e=document.createElement("data-table"),r=document.createElement("table");return r.innerHTML=`
|
|
1756
1756
|
<thead>
|
|
1757
1757
|
<tr>
|
|
1758
1758
|
<th data-sort="string">Title</th>
|
|
@@ -1765,19 +1765,19 @@ var re=`
|
|
|
1765
1765
|
</thead>
|
|
1766
1766
|
<tbody>
|
|
1767
1767
|
${t.map(a=>`
|
|
1768
|
-
<tr data-id="${
|
|
1769
|
-
<td>${
|
|
1768
|
+
<tr data-id="${n.#n(a.id)}">
|
|
1769
|
+
<td>${n.#n(a.title)}</td>
|
|
1770
1770
|
<td>${a.likelihood||""}</td>
|
|
1771
1771
|
<td>${a.impact||""}</td>
|
|
1772
1772
|
<td></td>
|
|
1773
|
-
<td>${
|
|
1774
|
-
<td>${
|
|
1773
|
+
<td>${n.#n(a.owner)}</td>
|
|
1774
|
+
<td>${n.#n(a.mitigation)}</td>
|
|
1775
1775
|
</tr>
|
|
1776
1776
|
`).join("")}
|
|
1777
1777
|
</tbody>
|
|
1778
|
-
`,e.appendChild(r),e}#s(t){let e=document.createElement("quadrant-grid");e.setAttribute("x-label","Likelihood"),e.setAttribute("y-label","Impact"),e.setAttribute("x-low","Rare"),e.setAttribute("x-high","Likely"),e.setAttribute("y-low","Minor"),e.setAttribute("y-high","Severe"),e.setAttribute("q1-label","Avoid"),e.setAttribute("q2-label","Plan"),e.setAttribute("q3-label","Accept"),e.setAttribute("q4-label","Mitigate");for(let r of t){if(!r.likelihood||!r.impact)continue;let a=document.createElement("span"),s=Math.min(1,Math.max(0,r.likelihood/ie)),i=Math.min(1,Math.max(0,r.impact/ie));a.setAttribute("data-x",s.toFixed(3)),a.setAttribute("data-y",i.toFixed(3)),a.setAttribute("data-id",r.id),a.setAttribute("title",`${r.title} \u2014 likelihood ${r.likelihood}, impact ${r.impact}`),a.textContent=r.title,e.appendChild(a)}return e}static#
|
|
1779
|
-
`)[0].slice(0,60)||"(unnamed)"}#i=null;#
|
|
1780
|
-
`)[0],d.appendChild(u),d.setAttribute("aria-label",`${u.textContent} \u2014 ${d.dataset.start} to ${d.dataset.end} in ${e}`),d.addEventListener("click",p=>{this.#_||this.dispatchEvent(new CustomEvent("product-roadmap:select",{bubbles:!0,detail:{initiative:t,lane:e,start:d.dataset.start,end:d.dataset.end,status:d.dataset.status||null}}))}),this.#g){let p=document.createElement("span");p.className="rm-bar-handle",p.setAttribute("aria-label","Resize end date"),d.appendChild(p),p.addEventListener("pointerdown",h=>this.#s(h,d,t)),d.addEventListener("pointerdown",h=>{h.target!==p&&this.#a(h,d,t)}),d.addEventListener("dragstart",h=>{h.dataTransfer&&(h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("text/plain",t.id||d.dataset.sourceId||"")),this.#k=t,this.#A=e}),d.addEventListener("dragend",()=>{this.#k=null,this.#A=null})}return d}#a(t,e,r){if(t.button!==0)return;t.preventDefault();let a=e.parentElement.getBoundingClientRect(),s=t.clientX,i=parseFloat(e.style.getPropertyValue("--rm-x"))||0,n=parseFloat(e.style.getPropertyValue("--rm-w"))||0;this.#_={kind:"move",bar:e,initiative:r,trackRect:a,startX:s,startFraction:i,widthFraction:n},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#o),e.addEventListener("pointerup",this.#i),e.addEventListener("pointercancel",this.#i)}#s(t,e,r){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let a=e.parentElement.getBoundingClientRect(),s=t.clientX,i=parseFloat(e.style.getPropertyValue("--rm-x"))||0,n=parseFloat(e.style.getPropertyValue("--rm-w"))||0;this.#_={kind:"resize",bar:e,initiative:r,trackRect:a,startX:s,startFraction:i,widthFraction:n},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#o),e.addEventListener("pointerup",this.#i),e.addEventListener("pointercancel",this.#i)}#o=t=>{if(!this.#_)return;let{kind:e,bar:r,trackRect:a,startX:s,startFraction:i,widthFraction:n}=this.#_,c=(t.clientX-s)/a.width;if(e==="move"){let d=Math.max(0,Math.min(1-n,i+c));r.style.setProperty("--rm-x",d.toFixed(4))}else if(e==="resize"){let d=Math.max(.02,Math.min(1-i,n+c));r.style.setProperty("--rm-w",d.toFixed(4))}};#i=t=>{if(!this.#_)return;let{kind:e,bar:r,initiative:a}=this.#_;r.releasePointerCapture(t.pointerId),r.removeEventListener("pointermove",this.#o),r.removeEventListener("pointerup",this.#i),r.removeEventListener("pointercancel",this.#i);let s=parseFloat(r.style.getPropertyValue("--rm-x"))||0,i=parseFloat(r.style.getPropertyValue("--rm-w"))||0,n=this.#d(this.#p(s)),c=this.#d(this.#p(s+i));r.dataset.start=o.#m(n),r.dataset.end=o.#m(c);let d=this.#l(n),l=this.#l(c)-d;r.style.setProperty("--rm-x",d.toFixed(4)),r.style.setProperty("--rm-w",l.toFixed(4)),a&&(a.setAttribute("data-start",r.dataset.start??""),a.setAttribute("data-end",r.dataset.end??"")),this.dispatchEvent(new CustomEvent(e==="move"?"product-roadmap:reschedule":"product-roadmap:resize",{bubbles:!0,detail:{initiative:a,lane:r.dataset.lane,start:r.dataset.start,end:r.dataset.end}})),setTimeout(()=>{this.#_=null},0)};#n=t=>{this.#k&&(t.preventDefault(),t.dataTransfer.dropEffect="move")};#c=t=>{if(!this.#k)return;t.preventDefault();let e=t.currentTarget.dataset.lane,r=this.#k,a=this.#A;if(e===a)return;let s=this.#x.find(i=>i.getAttribute("data-lane")===e);s&&s.appendChild(r),this.dispatchEvent(new CustomEvent("product-roadmap:move",{bubbles:!0,detail:{initiative:r,fromLane:a,toLane:e,start:r.getAttribute("data-start"),end:r.getAttribute("data-end")}})),this.#e()};#l(t){if(!this.#h)return 0;let e=t.getTime()-this.#h.getTime();return Math.max(0,Math.min(1,e/this.#v))}#p(t){let e=this.#h??new Date;return new Date(e.getTime()+t*this.#v)}#d(t){if(this.#y==="month")return new Date(t.getFullYear(),t.getMonth(),1);let e=t.getMonth(),r=Math.floor(e/3)*3;return new Date(t.getFullYear(),r,1)}#f(){let t=[],e=this.#h,r=this.#b;if(!e||!r)return t;if(this.#y==="quarter"){let a=this.#d(e);for(;a<r;){let s=new Date(a.getFullYear(),a.getMonth()+3,1),i=this.#l(a<e?e:a),n=this.#l(s>r?r:s),c=Math.floor(a.getMonth()/3)+1;t.push({startFraction:i,endFraction:n,label:`Q${c} ${a.getFullYear()}`}),a=s}}else{let a=new Date(e.getFullYear(),e.getMonth(),1);for(;a<r;){let s=new Date(a.getFullYear(),a.getMonth()+1,1),i=this.#l(a<e?e:a),n=this.#l(s>r?r:s),c=a.toLocaleString(void 0,{month:"short"});t.push({startFraction:i,endFraction:n,label:`${c} ${a.getFullYear()}`}),a=s}}return t}static#u(t,e){if(!t)return null;let r=String(t).match(/^(\d{4})-Q([1-4])$/i);if(r){let i=Number(r[1]),c=(Number(r[2])-1)*3;return e==="end"?new Date(i,c+3,0):new Date(i,c,1)}let a=String(t).match(/^(\d{4})-(\d{2})-(\d{2})/);if(a)return new Date(Number(a[1]),Number(a[2])-1,Number(a[3]));let s=new Date(t);return isNaN(s.getTime())?null:s}static#m(t){let e=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${r}`}#h=null;#b=null;#v=0;#y="quarter";#g=!1;#x=[];#w=null;#_=null;#k=null;#A=null};w("product-roadmap",$t);function oe(o){let t=o;return class extends t{static keyOf(e){return e.id}#e=[];#t=new Map;get items(){return this.#e}set items(e){let r=e||[],a=rt({newItems:r,nodes:this.#t,keyOf:this.constructor.keyOf,renderItem:s=>this._renderItem(s),containerFor:(s,i)=>this._containerFor(s,i)});this.#e=r,this._postRender({...a,items:r}),this._emit("items-changed",{items:r},"api")}_renderItem(e){throw new Error(`${this.constructor.name}: must implement _renderItem(item)`)}_containerFor(e,r){return this}_postRender(e){}_emit(e,r,a="api"){this.dispatchEvent(new CustomEvent(`${this.localName}:${e}`,{detail:{...r,source:a},bubbles:!0}))}_nodeFor(e){return this.#t.get(e)||null}_seedCollection(e,r){this.#e=e,this.#t.clear();for(let[a,s]of r)this.#t.set(a,s)}_setItemsSilently(e){this.#e=e}}}var qt=class o extends oe(C){static get observedAttributes(){return["src","compact","title"]}static keyOf(t){return t.id??t.storyId}static#e=0;#t=null;#r={};#a={};#s=null;#o="";#i=[];#n=null;setup(){this.#o=`kb-${++o.#e}`;let t=[...this.querySelectorAll(":scope > section[data-column]")];this.#i=t.map(s=>{let i=s.getAttribute("data-column")||"",c=s.getAttribute("data-column-label")||""||this.#v(i),d=s.getAttribute("data-wip"),l=d?parseInt(d,10):null,u=s.getAttribute("data-column-color")||null,p=[...s.children];return{id:i,label:c,wip:l,color:u,children:p}});for(let s of t)s.remove();this.#t=document.createElement("div"),this.#t.className="kb-columns",this.#t.setAttribute("role","region"),this.#t.setAttribute("aria-label","Kanban board");let e=0;for(let s of this.#i){let i=document.createElement("section");i.className="kb-column",i.setAttribute("data-column-id",s.id),s.color&&i.setAttribute("data-column-tint",s.color);let n=document.createElement("header");n.className="kb-column-header";let c=document.createElement("h3");c.textContent=s.label;let d=document.createElement("output");if(d.className="kb-count",d.textContent=String(s.children.length),c.appendChild(d),s.wip!==null&&!isNaN(s.wip)){let u=document.createElement("span");u.className="kb-wip",u.textContent=`/ ${s.wip}`,u.setAttribute("aria-label",`WIP limit ${s.wip}`),c.appendChild(u)}n.appendChild(c),i.appendChild(n);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#o),l.setAttribute("aria-label",`${s.label} items`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),s.children.length>0){for(let u of s.children)u.hasAttribute("draggable")||u.setAttribute("draggable","true"),u.hasAttribute("data-id")||(u.dataset.id=`kb-item-${e}`),l.appendChild(u);e+=s.children.length}else{let u=document.createElement("p");u.className="kb-empty",u.textContent="No items",l.appendChild(u)}i.appendChild(l),this.#t.appendChild(i),this.#r[s.id]=l,this.#a[s.id]=i,s.wip!==null&&s.children.length>s.wip&&i.setAttribute("data-wip-exceeded","")}let r=this.getAttribute("title");if(r){let s=document.createElement("h2");s.className="kb-title",s.textContent=r,this.appendChild(s)}this.appendChild(this.#t),this.#s=document.createElement("div"),this.#s.className="kb-live-region",this.#s.setAttribute("role","status"),this.#s.setAttribute("aria-live","polite"),this.#s.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.listen(this,"drag-surface:reorder",s=>{let i=s.detail,n=s.target.closest("drag-surface"),c=this.#f(n);c&&(this.#u(c),this.#l("drag"),this.dispatchEvent(new CustomEvent("kanban-board:reorder",{bubbles:!0,detail:{itemId:i.itemId,column:c,oldIndex:i.oldIndex,newIndex:i.newIndex}})))}),this.listen(this,"drag-surface:transfer",s=>{let i=s.detail,n=i.fromSurface,c=i.toSurface,d=this.#f(n),l=this.#f(c);if(!d||!l)return;i.item&&i.item.setAttribute("data-column",l),this.#u(d),this.#u(l);let u=c.querySelector(".kb-empty");if(u&&u.remove(),n.querySelectorAll(':scope > [draggable="true"]').length===0&&!n.querySelector(".kb-empty")){let _=document.createElement("p");_.className="kb-empty",_.textContent="No items",n.appendChild(_)}let h=this.#b(i.item),f=this.#m(d),b=this.#m(l);this.#h(`${h} moved from ${f} to ${b}`),this.#l("drag"),this.dispatchEvent(new CustomEvent("kanban-board:transfer",{bubbles:!0,detail:{itemId:i.itemId,fromColumn:d,toColumn:l,newIndex:i.newIndex,item:i.item}}));let v=c.querySelectorAll(':scope > [draggable="true"]').length,x=this.#i.find(_=>_.id===l);x?.wip!==null&&x?.wip!==void 0&&v>x.wip&&this.dispatchEvent(new CustomEvent("kanban-board:wip-exceeded",{bubbles:!0,detail:{column:l,limit:x.wip,count:v}}))}),this.#c();let a=this.getAttribute("src");if(a){this._loadSrc(a);return}this.dispatchEvent(new CustomEvent("kanban-board:ready",{bubbles:!0,detail:{columnCount:this.#i.length,itemCount:e}}))}#c(){let t=[],e=new Map;for(let[r,a]of Object.entries(this.#r)){let s=a.querySelectorAll(':scope > [draggable="true"]');for(let i of s){let n=i.getAttribute("data-id");n&&(t.push({id:n,column:r}),e.set(n,i))}}this._seedCollection(t,e)}#l(t){let e=[],r=new Map;for(let a of this.items){let s=String(a.id??a.storyId??"");s&&r.set(s,a)}for(let[a,s]of Object.entries(this.#r)){let i=s.querySelectorAll(':scope > [draggable="true"]');for(let n of i){let c=n.getAttribute("data-id");if(!c)continue;let d=r.get(c);e.push(d?{...d,column:a}:{id:c,column:a})}}this._setItemsSilently(e),this._emit("items-changed",{items:e},t)}teardown(){let t=this.querySelector(".kb-title");t&&t.remove(),this.#t&&(this.#t.remove(),this.#t=null),this.#s&&(this.#s.remove(),this.#s=null),this.#r={},this.#a={},this.#i=[]}get columns(){return this.#i.map(t=>({id:t.id,label:t.label,wip:t.wip??void 0,color:t.color??void 0}))}set columns(t){let e=(t||[]).map(i=>({id:i.id,label:i.label||this.#v(i.id),wip:i.wip??null,color:i.color??null,children:[]})),r=this.#t;this.#r={},this.#a={},this.#i=e;let a=this.#d();this.#t=a;let s=()=>{r&&r.remove(),this.appendChild(a)};this.hasAttribute("data-upgraded")&&r?M(this,s,"kb-vt"):s()}get renderItem(){return this.#n}set renderItem(t){this.#n=typeof t=="function"?t:null}_renderItem(t){let e;if(this.#n){let r=this.#n(t);if(!(r instanceof Element))throw new Error("kanban-board: renderItem must return an Element");e=r}else e=this.#p(t);return e.hasAttribute("draggable")||e.setAttribute("draggable","true"),e.hasAttribute("data-id")||e.setAttribute("data-id",String(o.keyOf(t))),e}_containerFor(t,e){let r=this.#r[t.column];if(!r)throw new Error(`kanban-board: no column "${t.column}" \u2014 set .columns first or include item.column matching an existing column id`);let a=r.querySelector(":scope > .kb-empty");return a&&a.remove(),r}_postRender(){for(let t of Object.keys(this.#r)){this.#u(t);let e=this.#r[t],r=e.querySelectorAll(':scope > [draggable="true"]'),a=e.querySelector(":scope > .kb-empty");if(r.length===0&&!a){let s=document.createElement("p");s.className="kb-empty",s.textContent="No items",e.appendChild(s)}else r.length>0&&a&&a.remove()}}#p(t){let e=customElements.get("work-item")?"work-item":"article",r=document.createElement(e);return e==="work-item"?r.data={itemId:t.id??t.storyId,type:t.type,priority:t.priority,status:t.status,estimate:t.estimate!=null?String(t.estimate):void 0,assignee:t.assignee,title:t.title,description:t.description,checklist:t.checklist,notes:t.notes,detail:t.detail}:(r.className="kb-card",r.textContent=t.title||t.label||t.id),r}#d(){let t=document.createElement("div");t.className="kb-columns",t.setAttribute("role","region"),t.setAttribute("aria-label","Kanban board");for(let e of this.#i){let r=document.createElement("section");r.className="kb-column",r.setAttribute("data-column-id",e.id),e.color&&r.setAttribute("data-column-tint",e.color);let a=document.createElement("header");a.className="kb-column-header";let s=document.createElement("h3");s.textContent=e.label;let i=document.createElement("output");if(i.className="kb-count",i.textContent="0",s.appendChild(i),e.wip!=null&&!isNaN(e.wip)){let d=document.createElement("span");d.className="kb-wip",d.textContent=`/ ${e.wip}`,d.setAttribute("aria-label",`WIP limit ${e.wip}`),s.appendChild(d)}a.appendChild(s),r.appendChild(a);let n=document.createElement("drag-surface");n.setAttribute("group",this.#o),n.setAttribute("aria-label",`${e.label} items`),n.setAttribute("data-layout","stack"),n.setAttribute("data-layout-gap","xs");let c=document.createElement("p");c.className="kb-empty",c.textContent="No items",n.appendChild(c),r.appendChild(n),t.appendChild(r),this.#r[e.id]=n,this.#a[e.id]=r}return t}attributeChangedCallback(t,e,r){e===r||!this.isConnected||t==="src"&&this._loadSrc(r)}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();for(;this.firstChild;)this.firstChild.remove();for(let s of r.columns||[]){let i=document.createElement("section");i.setAttribute("data-column",s.id),s.label&&i.setAttribute("data-column-label",s.label),s.wip!=null&&i.setAttribute("data-wip",String(s.wip)),s.color&&i.setAttribute("data-column-color",s.color);for(let n of s.items||[]){let c;n.persona||n.action||n.storyId?(c=document.createElement("user-story"),c.setAttribute("detail",n.detail||"minimal"),n.storyId&&c.setAttribute("story-id",n.storyId),n.persona&&c.setAttribute("persona",n.persona),n.action&&c.setAttribute("action",n.action),n.benefit&&c.setAttribute("benefit",n.benefit),n.priority&&c.setAttribute("priority",n.priority),n.status&&c.setAttribute("status",n.status),n.points&&c.setAttribute("points",String(n.points))):(c=document.createElement("article"),c.className="kb-card",c.textContent=n.text||n.label||""),c.setAttribute("draggable","true"),c.dataset.id=n.id||n.storyId||"",i.appendChild(c)}this.appendChild(i)}let a=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,a,"kb-vt"):a()}catch(e){console.warn(`[kanban-board] Failed to load src="${t}":`,e)}}#f(t){if(!t)return null;for(let[e,r]of Object.entries(this.#r))if(r===t)return e;return null}#u(t){let e=this.#r[t],r=this.#a[t];if(!e||!r)return;let a=e.querySelectorAll(':scope > [draggable="true"]').length,s=r.querySelector(".kb-count");s&&(s.textContent=String(a));let i=this.#i.find(n=>n.id===t);i?.wip!==null&&i?.wip!==void 0&&(a>i.wip?r.setAttribute("data-wip-exceeded",""):r.removeAttribute("data-wip-exceeded"))}#m(t){return this.#i.find(r=>r.id===t)?.label||this.#v(t)}#h(t){this.#s&&(this.#s.textContent="",requestAnimationFrame(()=>{this.#s&&(this.#s.textContent=t)}))}#b(t){return t.getAttribute("story-id")||t.getAttribute("data-id")||t.textContent?.trim().slice(0,40)||"item"}#v(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};w("kanban-board",qt);var It=class o extends C{static get observedAttributes(){return["src","compact","title"]}static#e=0;#t=null;#r=null;#a={};#s=null;#o="";#i=[];setup(){this.#o=`sm-${++o.#e}`;let t=[...this.querySelectorAll(":scope > section[data-activity]")];this.#i=t.map(s=>{let i=s.getAttribute("data-activity")||"",c=s.getAttribute("data-activity-label")||""||this.#d(i),d=s.getAttribute("data-journey-phase")||null,l=[...s.children];return{id:i,label:c,journeyPhase:d,children:l}});for(let s of t)s.remove();this.#t=document.createElement("div"),this.#t.className="sm-scroll",this.#t.setAttribute("role","region"),this.#t.setAttribute("aria-label","Story map"),this.#t.setAttribute("tabindex","0"),this.#r=document.createElement("div"),this.#r.className="sm-columns";let e=0;for(let s of this.#i){let i=document.createElement("section");i.className="sm-column",i.setAttribute("data-activity-column",s.id);let n=document.createElement("header");n.className="sm-activity-header";let c=document.createElement("h3");c.textContent=s.label;let d=document.createElement("span");d.className="sm-activity-count",d.textContent=String(s.children.length),c.appendChild(d),n.appendChild(c),i.appendChild(n);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#o),l.setAttribute("aria-label",`${s.label} stories`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),s.children.length>0){for(let u of s.children)l.appendChild(u);e+=s.children.length}else{let u=document.createElement("p");u.className="sm-empty",u.textContent="No stories yet",l.appendChild(u)}i.appendChild(l),this.#r.appendChild(i),this.#a[s.id]=l}let r=this.getAttribute("title");if(r){let s=document.createElement("h2");s.className="sm-title",s.textContent=r,this.appendChild(s)}this.#t.appendChild(this.#r),this.appendChild(this.#t),this.#s=document.createElement("div"),this.#s.className="sm-live-region",this.#s.setAttribute("role","status"),this.#s.setAttribute("aria-live","polite"),this.#s.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.listen(this,"drag-surface:reorder",s=>{let i=s.detail,n=s.target.closest("drag-surface"),c=this.#n(n);c&&(this.#c(c),this.dispatchEvent(new CustomEvent("story-map:reorder",{bubbles:!0,detail:{itemId:i.itemId,activity:c,oldIndex:i.oldIndex,newIndex:i.newIndex}})))}),this.listen(this,"drag-surface:transfer",s=>{let i=s.detail,n=i.fromSurface,c=i.toSurface,d=this.#n(n),l=this.#n(c);if(!d||!l)return;this.#c(d),this.#c(l);let u=c.querySelector(".sm-empty");if(u&&u.remove(),n.querySelectorAll(':scope > [draggable="true"]').length===0&&!n.querySelector(".sm-empty")){let f=document.createElement("p");f.className="sm-empty",f.textContent="No stories yet",n.appendChild(f)}let h=this.#p(i.item);this.#l(`${h} moved from ${d} to ${l}`),this.dispatchEvent(new CustomEvent("story-map:transfer",{bubbles:!0,detail:{itemId:i.itemId,fromActivity:d,toActivity:l,newIndex:i.newIndex}}))});let a=this.getAttribute("src");if(a){this._loadSrc(a);return}this.dispatchEvent(new CustomEvent("story-map:ready",{bubbles:!0,detail:{activityCount:this.#i.length,storyCount:e}}))}teardown(){this.#t&&(this.#t.remove(),this.#t=null),this.#s&&(this.#s.remove(),this.#s=null),this.#r=null,this.#a={},this.#i=[]}get activities(){return this.#i.map(t=>({id:t.id,label:t.label,journeyPhase:t.journeyPhase||void 0,stories:[...this.#a[t.id]?.querySelectorAll(':scope > [draggable="true"]')||[]].map(e=>({id:e.getAttribute("data-id")||void 0,storyId:e.getAttribute("story-id")||void 0,title:e.querySelector('[slot="title"]')?.textContent?.trim()||void 0}))}))}set activities(t){let e=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();for(let a of e){let s=document.createElement("section");s.setAttribute("data-activity",a.id||""),a.label&&s.setAttribute("data-activity-label",a.label),a.journeyPhase&&s.setAttribute("data-journey-phase",a.journeyPhase);for(let i of a.stories||[]){let n,c=this;if(typeof c.renderStory=="function"){let d=c.renderStory(i);n=d instanceof Element?d:null}n||(customElements.get("user-story")?(n=document.createElement("user-story"),n.data=i):(n=document.createElement("article"),n.className="sm-card",n.textContent=i.title||i.id||"")),n.hasAttribute("draggable")||n.setAttribute("draggable","true"),i.id&&!n.hasAttribute("data-id")&&n.setAttribute("data-id",String(i.id)),s.appendChild(n)}this.appendChild(s)}let r=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,r,"sm-vt"):r(),this.dispatchEvent(new CustomEvent("story-map:activities-changed",{detail:{activities:e,source:"property"},bubbles:!0}))}attributeChangedCallback(t,e,r){e===r||!this.isConnected||t==="src"&&this._loadSrc(r)}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();for(;this.firstChild;)this.firstChild.remove();for(let s of r.activities||[]){let i=document.createElement("section");i.setAttribute("data-activity",s.id),i.setAttribute("data-activity-label",s.label||s.id),s.journeyPhase&&i.setAttribute("data-journey-phase",s.journeyPhase);for(let n of s.stories||[]){let c=document.createElement("user-story");c.setAttribute("draggable","true"),c.dataset.id=n.id||n.storyId,(n.storyId||n.id)&&c.setAttribute("story-id",n.storyId||n.id),n.title&&c.setAttribute("title",n.title),n.persona&&c.setAttribute("persona",n.persona),n.action&&c.setAttribute("action",n.action),n.benefit&&c.setAttribute("benefit",n.benefit),n.priority&&c.setAttribute("priority",n.priority),n.status&&c.setAttribute("status",n.status),n.points&&c.setAttribute("points",String(n.points)),c.setAttribute("detail",n.detail||"compact"),i.appendChild(c)}this.appendChild(i)}let a=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,a,"sm-vt"):a()}catch(e){console.warn(`[story-map] Failed to load src="${t}":`,e)}}#n(t){if(!t)return null;for(let[e,r]of Object.entries(this.#a))if(r===t)return e;return null}#c(t){let e=this.#a[t];if(!e)return;let r=e.querySelectorAll(':scope > [draggable="true"]').length,a=e.closest("[data-activity-column]");if(!a)return;let s=a.querySelector(".sm-activity-count");s&&(s.textContent=String(r))}#l(t){this.#s&&(this.#s.textContent="",requestAnimationFrame(()=>{this.#s&&(this.#s.textContent=t)}))}#p(t){return t.getAttribute("story-id")||t.getAttribute("data-id")||t.textContent?.trim().slice(0,40)||"item"}#d(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};w("story-map",It);var st=`
|
|
1778
|
+
`,e.appendChild(r),e}#s(t){let e=document.createElement("quadrant-grid");e.setAttribute("x-label","Likelihood"),e.setAttribute("y-label","Impact"),e.setAttribute("x-low","Rare"),e.setAttribute("x-high","Likely"),e.setAttribute("y-low","Minor"),e.setAttribute("y-high","Severe"),e.setAttribute("q1-label","Avoid"),e.setAttribute("q2-label","Plan"),e.setAttribute("q3-label","Accept"),e.setAttribute("q4-label","Mitigate");for(let r of t){if(!r.likelihood||!r.impact)continue;let a=document.createElement("span"),s=Math.min(1,Math.max(0,r.likelihood/ie)),i=Math.min(1,Math.max(0,r.impact/ie));a.setAttribute("data-x",s.toFixed(3)),a.setAttribute("data-y",i.toFixed(3)),a.setAttribute("data-id",r.id),a.setAttribute("title",`${r.title} \u2014 likelihood ${r.likelihood}, impact ${r.impact}`),a.textContent=r.title,e.appendChild(a)}return e}static#n(t){return String(t??"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}#i=[];get rows(){return[...this.#i]}set rows(t){this.#r(Array.isArray(t)?t:[])}};w("risk-register",Ct);var Et=class n extends C{setup(){let t=this.getAttribute("rows"),e=this.getAttribute("cols"),r=this.getAttribute("link-attr");return!t||!e||!r?(console.warn("traceability-matrix: requires rows, cols, and link-attr attributes"),!1):(queueMicrotask(()=>this.#e(t,e,r)),!0)}#e(t,e,r){let a=[...document.querySelectorAll(t)].filter(g=>g!==this&&!this.contains(g)),s=[...document.querySelectorAll(e)].filter(g=>g!==this&&!this.contains(g));if(!a.length||!s.length){this.#a();return}let i=this.getAttribute("row-label")||"",o=this.getAttribute("cell-mark")||"\u2713",c=this.hasAttribute("flag-orphans"),d=[],l=new WeakMap,u=new WeakMap;for(let g of a){let y=n.#s(g.getAttribute(r));for(let A of y){let S=s.find($=>$.id===A);S&&(d.push({rowEl:g,colEl:S}),l.set(g,(l.get(g)||0)+1),u.set(S,(u.get(S)||0)+1))}}let p=document.createElement("data-table"),h=document.createElement("table"),f=document.createElement("thead"),b=document.createElement("tr"),v=document.createElement("th");v.setAttribute("data-sort","string"),v.textContent=i,b.appendChild(v);for(let g of s){let y=document.createElement("th");y.setAttribute("data-sort","number"),y.textContent=n.#n(g),y.dataset.colId=g.id||"",c&&!u.get(g)&&(y.dataset.orphan=""),b.appendChild(y)}f.appendChild(b),h.appendChild(f);let x=document.createElement("tbody");for(let g of a){let y=document.createElement("tr");y.dataset.rowId=g.id||"",c&&!l.get(g)&&(y.dataset.orphan="");let A=document.createElement("th");A.scope="row",A.textContent=n.#n(g),y.appendChild(A);let S=n.#s(g.getAttribute(r));for(let $ of s){let T=document.createElement("td"),z=S.includes($.id);T.setAttribute("data-sort-value",z?"1":"0"),z?(T.dataset.linked="",T.textContent=o,T.setAttribute("aria-label","linked")):T.setAttribute("aria-label","not linked"),T.dataset.colId=$.id||"",y.appendChild(T)}x.appendChild(y)}h.appendChild(x),p.appendChild(h),[...this.children].forEach(g=>{g.tagName!=="TEMPLATE"&&g.remove()});let _=this.getAttribute("label");if(_){let g=document.createElement("header");g.className="tm-label",g.textContent=_,this.appendChild(g)}this.appendChild(p),this.#i=p,this.#o=new Map(a.map(g=>[g.id,g])),this.#c=new Map(s.map(g=>[g.id,g])),this.listen(p,"click",this.#t),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("traceability-matrix:ready",{bubbles:!0,detail:{rowCount:a.length,colCount:s.length,linkCount:d.length}}))})}#t=t=>{let e=t.target.closest('td, th[scope="row"]');if(!e)return;let r=e.closest("tr");if(!r)return;let a=r.dataset.rowId,s=e.dataset.colId,i=a?this.#o.get(a):null,o=s?this.#c.get(s):null,c=e.hasAttribute("data-state-highlighted");if(this.#r(),c){this.dispatchEvent(new CustomEvent("traceability-matrix:highlight",{bubbles:!0,detail:{rowEl:i,colEl:o,on:!1}}));return}e.setAttribute("data-state-highlighted",""),i&&i.setAttribute("data-state-highlighted",""),o&&o!==i&&o.setAttribute("data-state-highlighted",""),r.setAttribute("data-state-highlighted",""),this.dispatchEvent(new CustomEvent("traceability-matrix:highlight",{bubbles:!0,detail:{rowEl:i,colEl:o,on:!0}}))};#r(){this.#i&&(this.#i.querySelectorAll("[data-state-highlighted]").forEach(t=>t.removeAttribute("data-state-highlighted")),document.querySelectorAll("[data-state-highlighted]").forEach(t=>{(this.#o.has(t.id)||this.#c.has(t.id))&&t.removeAttribute("data-state-highlighted")}))}#a(){[...this.children].forEach(e=>{e.tagName!=="TEMPLATE"&&e.remove()});let t=document.createElement("p");t.className="tm-empty",t.textContent="No matching elements found for this matrix.",this.appendChild(t)}static#s(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}static#n(t){return t.getAttribute("data-matrix-label")||t.id||(t.textContent||"").trim().split(`
|
|
1779
|
+
`)[0].slice(0,60)||"(unnamed)"}#i=null;#o=new Map;#c=new Map};w("traceability-matrix",Et);var Ke=864e5,St=class n extends C{setup(){let t=this.getAttribute("start"),e=this.getAttribute("end"),r=parseFloat(this.getAttribute("total")||"");if(!t||!e||!Number.isFinite(r))return console.warn("burndown-chart: requires start, end, and total attributes"),!1;let a=n.#r(t),s=n.#r(e);if(!a||!s||s<a)return console.warn("burndown-chart: start/end dates invalid",t,e),!1;let i=(this.getAttribute("weekends")||"include")!=="exclude",o=this.getAttribute("unit")||"points",c=this.getAttribute("label")||"",d=this.querySelector(":scope > template"),l=d?n.#t(d):[],u=l.filter(b=>b.delta!==0),p=n.#s(a,s),h=n.#n(p,r,i),f=n.#i(p,l);return this.#e({label:c,unit:o,dayLabels:p,actual:f,ideal:h,scopeChanges:u}),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("burndown-chart:ready",{bubbles:!0,detail:{dayCount:p.length,total:r,scopeChanges:u.length}}))}),!0}#e({label:t,unit:e,dayLabels:r,actual:a,ideal:s,scopeChanges:i}){if([...this.children].forEach(u=>{u.tagName!=="TEMPLATE"&&u.remove()}),t){let u=document.createElement("header");u.className="bdc-label",u.textContent=t,this.appendChild(u)}let o=document.createElement("chart-wc");o.setAttribute("data-type","line"),o.setAttribute("data-legend",""),o.setAttribute("data-tooltip",""),o.setAttribute("data-label-x","Day"),o.setAttribute("data-label-y",e);let c={},d={};r.forEach((u,p)=>{c[u]=s[p],a[p]!==null&&(d[u]=a[p])});let l=[{name:"Actual",values:d},{name:"Ideal",values:c}];if(o.setAttribute("data-values",JSON.stringify(l)),this.appendChild(o),i.length){let u=document.createElement("aside");u.className="bdc-scope-changes";let p=document.createElement("h4");p.textContent="Scope changes",u.appendChild(p);let h=document.createElement("ul");for(let f of i){let b=document.createElement("li"),v=f.delta>0?"+":"";b.innerHTML=`<time datetime="${f.date}">${f.date}</time>: <strong>${v}${f.delta} ${e}</strong>`,h.appendChild(b)}u.appendChild(h),this.appendChild(u)}}static#t(t){let e=[],r=t.content.querySelectorAll("tr");for(let a of r){let s=[...a.children],i=s[0]?.textContent?.trim(),o=parseFloat(s[1]?.textContent??""),c=parseFloat(s[2]?.textContent??"0")||0;!i||!Number.isFinite(o)||e.push({date:i,remaining:o,delta:c})}return e}static#r(t){let e=String(t).match(/^(\d{4})-(\d{2})-(\d{2})/);return e?new Date(Number(e[1]),Number(e[2])-1,Number(e[3])):null}static#a(t){let e=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${r}`}static#s(t,e){let r=[];for(let a=t.getTime();a<=e.getTime();a+=Ke)r.push(n.#a(new Date(a)));return r}static#n(t,e,r){let a=l=>{let u=n.#r(l);if(!u)return!1;let p=u.getDay();return p===0||p===6},s=t.map((l,u)=>({d:l,i:u,weekend:a(l)})).filter(l=>r||!l.weekend),i=s.length>1?e/(s.length-1):0,o=new Array(t.length).fill(null),c=e,d=0;for(let l=0;l<t.length;l++){let u=a(t[l]);r||!u?(o[l]=Math.max(0,e-i*d),d++,c=o[l]):o[l]=c}return o}static#i(t,e){let r=new Map(e.map(a=>[a.date,a.remaining]));return t.map(a=>r.has(a)?r.get(a):null)}};w("burndown-chart",St);var $t=class n extends C{static get observedAttributes(){return["start","end","view","editable","today-marker"]}setup(){if(!this.#e())return!1;let t=[...this.querySelectorAll(":scope > section[data-lane]")];return t.length?(this.#y=t,this.#t(),!0):(console.warn("product-roadmap: no <section data-lane> children found"),!1)}#e(){let t=this.getAttribute("start"),e=this.getAttribute("end");if(!t||!e)return console.warn("product-roadmap: start and end attributes required"),!1;let r=n.#f(t,"start"),a=n.#f(e,"end");return!r||!a||a<=r?(console.warn("product-roadmap: invalid start/end",t,e),!1):(this.#d=r,this.#h=a,this.#v=a.getTime()-r.getTime(),this.#b=this.getAttribute("view")==="month"?"month":"quarter",this.#A=this.hasAttribute("editable"),!0)}attributeChangedCallback(t,e,r){e!==r&&(!this.isConnected||!this.#y.length||this.#e()&&this.#t())}#t(){[...this.children].forEach(a=>{this.#y.includes(a)||a.remove()}),this.#y.forEach(a=>{a.hidden=!0});let t=document.createElement("div");t.className="rm-wrapper";let e=this.#r();t.appendChild(e);let r=document.createElement("div");r.className="rm-lanes";for(let a of this.#y){let s=a.getAttribute("data-lane")||"",i=document.createElement("section");i.className="rm-lane",i.dataset.lane=s;let o=document.createElement("header");o.className="rm-lane-label",o.textContent=s,i.appendChild(o);let c=document.createElement("div");c.className="rm-track",c.dataset.lane=s;let d=[...a.querySelectorAll(":scope > article[data-start][data-end]")];for(let l of d){let u=this.#a(l,s);u&&c.appendChild(u)}this.#A&&(c.addEventListener("dragover",this.#c),c.addEventListener("drop",this.#p)),i.appendChild(c),r.appendChild(i)}if(t.appendChild(r),this.hasAttribute("today-marker")&&this.#d&&this.#h){let a=new Date;if(a>=this.#d&&a<=this.#h){let s=document.createElement("div");s.className="rm-today",s.style.setProperty("--rm-x",this.#l(a).toFixed(4)),s.title=`Today: ${n.#g(a)}`,r.appendChild(s)}}this.appendChild(t),this.#C=t}#r(){let t=document.createElement("header");t.className="rm-axis";let e=this.#x();for(let r of e){let a=document.createElement("div");a.className="rm-tick",a.style.setProperty("--rm-x",r.startFraction.toFixed(4)),a.style.setProperty("--rm-w",(r.endFraction-r.startFraction).toFixed(4)),a.textContent=r.label,t.appendChild(a)}return t}#a(t,e){let r=n.#f(t.getAttribute("data-start"),"start"),a=n.#f(t.getAttribute("data-end"),"end");if(!r||!a||!this.#d||!this.#h)return null;let s=r<this.#d?this.#d:r,i=a>this.#h?this.#h:a;if(s>=i)return null;let o=this.#l(s),c=this.#l(i)-o,d=document.createElement("article");d.className="rm-bar",d.style.setProperty("--rm-x",o.toFixed(4)),d.style.setProperty("--rm-w",c.toFixed(4)),d.dataset.lane=e,d.dataset.start=n.#g(r),d.dataset.end=n.#g(a),t.dataset.status&&(d.dataset.status=t.dataset.status),t.id&&(d.dataset.sourceId=t.id),this.#A&&d.setAttribute("draggable","true");let l=t.querySelector("h1, h2, h3, h4, h5, h6"),u=document.createElement("span");if(u.className="rm-bar-title",u.textContent=l?l.textContent.trim():(t.textContent||"").trim().split(`
|
|
1780
|
+
`)[0],d.appendChild(u),d.setAttribute("aria-label",`${u.textContent} \u2014 ${d.dataset.start} to ${d.dataset.end} in ${e}`),d.addEventListener("click",p=>{this.#_||this.dispatchEvent(new CustomEvent("product-roadmap:select",{bubbles:!0,detail:{initiative:t,lane:e,start:d.dataset.start,end:d.dataset.end,status:d.dataset.status||null}}))}),this.#A){let p=document.createElement("span");p.className="rm-bar-handle",p.setAttribute("aria-label","Resize end date"),d.appendChild(p),p.addEventListener("pointerdown",h=>this.#n(h,d,t)),d.addEventListener("pointerdown",h=>{h.target!==p&&this.#s(h,d,t)}),d.addEventListener("dragstart",h=>{h.dataTransfer&&(h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("text/plain",t.id||d.dataset.sourceId||"")),this.#w=t,this.#k=e}),d.addEventListener("dragend",()=>{this.#w=null,this.#k=null})}return d}#s(t,e,r){if(t.button!==0)return;t.preventDefault();let a=e.parentElement.getBoundingClientRect(),s=t.clientX,i=parseFloat(e.style.getPropertyValue("--rm-x"))||0,o=parseFloat(e.style.getPropertyValue("--rm-w"))||0;this.#_={kind:"move",bar:e,initiative:r,trackRect:a,startX:s,startFraction:i,widthFraction:o},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#i),e.addEventListener("pointerup",this.#o),e.addEventListener("pointercancel",this.#o)}#n(t,e,r){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let a=e.parentElement.getBoundingClientRect(),s=t.clientX,i=parseFloat(e.style.getPropertyValue("--rm-x"))||0,o=parseFloat(e.style.getPropertyValue("--rm-w"))||0;this.#_={kind:"resize",bar:e,initiative:r,trackRect:a,startX:s,startFraction:i,widthFraction:o},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#i),e.addEventListener("pointerup",this.#o),e.addEventListener("pointercancel",this.#o)}#i=t=>{if(!this.#_)return;let{kind:e,bar:r,trackRect:a,startX:s,startFraction:i,widthFraction:o}=this.#_,c=(t.clientX-s)/a.width;if(e==="move"){let d=Math.max(0,Math.min(1-o,i+c));r.style.setProperty("--rm-x",d.toFixed(4))}else if(e==="resize"){let d=Math.max(.02,Math.min(1-i,o+c));r.style.setProperty("--rm-w",d.toFixed(4))}};#o=t=>{if(!this.#_)return;let{kind:e,bar:r,initiative:a}=this.#_;r.releasePointerCapture(t.pointerId),r.removeEventListener("pointermove",this.#i),r.removeEventListener("pointerup",this.#o),r.removeEventListener("pointercancel",this.#o);let s=parseFloat(r.style.getPropertyValue("--rm-x"))||0,i=parseFloat(r.style.getPropertyValue("--rm-w"))||0,o=this.#m(this.#u(s)),c=this.#m(this.#u(s+i));r.dataset.start=n.#g(o),r.dataset.end=n.#g(c);let d=this.#l(o),l=this.#l(c)-d;r.style.setProperty("--rm-x",d.toFixed(4)),r.style.setProperty("--rm-w",l.toFixed(4)),a&&(a.setAttribute("data-start",r.dataset.start??""),a.setAttribute("data-end",r.dataset.end??"")),this.dispatchEvent(new CustomEvent(e==="move"?"product-roadmap:reschedule":"product-roadmap:resize",{bubbles:!0,detail:{initiative:a,lane:r.dataset.lane,start:r.dataset.start,end:r.dataset.end}})),setTimeout(()=>{this.#_=null},0)};#c=t=>{this.#w&&(t.preventDefault(),t.dataTransfer.dropEffect="move")};#p=t=>{if(!this.#w)return;t.preventDefault();let e=t.currentTarget.dataset.lane,r=this.#w,a=this.#k;if(e===a)return;let s=this.#y.find(i=>i.getAttribute("data-lane")===e);s&&s.appendChild(r),this.dispatchEvent(new CustomEvent("product-roadmap:move",{bubbles:!0,detail:{initiative:r,fromLane:a,toLane:e,start:r.getAttribute("data-start"),end:r.getAttribute("data-end")}})),this.#t()};#l(t){if(!this.#d)return 0;let e=t.getTime()-this.#d.getTime();return Math.max(0,Math.min(1,e/this.#v))}#u(t){let e=this.#d??new Date;return new Date(e.getTime()+t*this.#v)}#m(t){if(this.#b==="month")return new Date(t.getFullYear(),t.getMonth(),1);let e=t.getMonth(),r=Math.floor(e/3)*3;return new Date(t.getFullYear(),r,1)}#x(){let t=[],e=this.#d,r=this.#h;if(!e||!r)return t;if(this.#b==="quarter"){let a=this.#m(e);for(;a<r;){let s=new Date(a.getFullYear(),a.getMonth()+3,1),i=this.#l(a<e?e:a),o=this.#l(s>r?r:s),c=Math.floor(a.getMonth()/3)+1;t.push({startFraction:i,endFraction:o,label:`Q${c} ${a.getFullYear()}`}),a=s}}else{let a=new Date(e.getFullYear(),e.getMonth(),1);for(;a<r;){let s=new Date(a.getFullYear(),a.getMonth()+1,1),i=this.#l(a<e?e:a),o=this.#l(s>r?r:s),c=a.toLocaleString(void 0,{month:"short"});t.push({startFraction:i,endFraction:o,label:`${c} ${a.getFullYear()}`}),a=s}}return t}static#f(t,e){if(!t)return null;let r=String(t).match(/^(\d{4})-Q([1-4])$/i);if(r){let i=Number(r[1]),c=(Number(r[2])-1)*3;return e==="end"?new Date(i,c+3,0):new Date(i,c,1)}let a=String(t).match(/^(\d{4})-(\d{2})-(\d{2})/);if(a)return new Date(Number(a[1]),Number(a[2])-1,Number(a[3]));let s=new Date(t);return isNaN(s.getTime())?null:s}static#g(t){let e=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${r}`}#d=null;#h=null;#v=0;#b="quarter";#A=!1;#y=[];#C=null;#_=null;#w=null;#k=null};w("product-roadmap",$t);function ne(n){let t=n;return class extends t{static keyOf(e){return e.id}#e=[];#t=new Map;get items(){return this.#e}set items(e){let r=e||[],a=rt({newItems:r,nodes:this.#t,keyOf:this.constructor.keyOf,renderItem:s=>this._renderItem(s),containerFor:(s,i)=>this._containerFor(s,i)});this.#e=r,this._postRender({...a,items:r}),this._emit("items-changed",{items:r},"api")}_renderItem(e){throw new Error(`${this.constructor.name}: must implement _renderItem(item)`)}_containerFor(e,r){return this}_postRender(e){}_emit(e,r,a="api"){this.dispatchEvent(new CustomEvent(`${this.localName}:${e}`,{detail:{...r,source:a},bubbles:!0}))}_nodeFor(e){return this.#t.get(e)||null}_seedCollection(e,r){this.#e=e,this.#t.clear();for(let[a,s]of r)this.#t.set(a,s)}_setItemsSilently(e){this.#e=e}}}var qt=class n extends ne(C){static get observedAttributes(){return["src","compact","title"]}static keyOf(t){return t.id??t.storyId}static#e=0;#t=null;#r={};#a={};#s=null;#n="";#i=[];#o=null;setup(){this.#n=`kb-${++n.#e}`;let t=[...this.querySelectorAll(":scope > section[data-column]")];this.#i=t.map(s=>{let i=s.getAttribute("data-column")||"",c=s.getAttribute("data-column-label")||""||this.#h(i),d=s.getAttribute("data-wip"),l=d?parseInt(d,10):null,u=s.getAttribute("data-column-color")||null,p=[...s.children];return{id:i,label:c,wip:l,color:u,children:p}});for(let s of t)s.remove();this.#t=document.createElement("div"),this.#t.className="kb-columns",this.#t.setAttribute("role","region"),this.#t.setAttribute("aria-label","Kanban board");let e=0;for(let s of this.#i){let i=document.createElement("section");i.className="kb-column",i.setAttribute("data-column-id",s.id),s.color&&i.setAttribute("data-column-tint",s.color);let o=document.createElement("header");o.className="kb-column-header";let c=document.createElement("h3");c.textContent=s.label;let d=document.createElement("output");if(d.className="kb-count",d.textContent=String(s.children.length),c.appendChild(d),s.wip!==null&&!isNaN(s.wip)){let u=document.createElement("span");u.className="kb-wip",u.textContent=`/ ${s.wip}`,u.setAttribute("aria-label",`WIP limit ${s.wip}`),c.appendChild(u)}o.appendChild(c),i.appendChild(o);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#n),l.setAttribute("aria-label",`${s.label} items`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),s.children.length>0){for(let u of s.children)u.hasAttribute("draggable")||u.setAttribute("draggable","true"),u.hasAttribute("data-id")||(u.dataset.id=`kb-item-${e}`),l.appendChild(u);e+=s.children.length}else{let u=document.createElement("p");u.className="kb-empty",u.textContent="No items",l.appendChild(u)}i.appendChild(l),this.#t.appendChild(i),this.#r[s.id]=l,this.#a[s.id]=i,s.wip!==null&&s.children.length>s.wip&&i.setAttribute("data-wip-exceeded","")}let r=this.getAttribute("title");if(r){let s=document.createElement("h2");s.className="kb-title",s.textContent=r,this.appendChild(s)}this.appendChild(this.#t),this.#s=document.createElement("div"),this.#s.className="kb-live-region",this.#s.setAttribute("role","status"),this.#s.setAttribute("aria-live","polite"),this.#s.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.listen(this,"drag-surface:reorder",s=>{let i=s.detail,o=s.target.closest("drag-surface"),c=this.#m(o);c&&(this.#x(c),this.#p("drag"),this.dispatchEvent(new CustomEvent("kanban-board:reorder",{bubbles:!0,detail:{itemId:i.itemId,column:c,oldIndex:i.oldIndex,newIndex:i.newIndex}})))}),this.listen(this,"drag-surface:transfer",s=>{let i=s.detail,o=i.fromSurface,c=i.toSurface,d=this.#m(o),l=this.#m(c);if(!d||!l)return;i.item&&i.item.setAttribute("data-column",l),this.#x(d),this.#x(l);let u=c.querySelector(".kb-empty");if(u&&u.remove(),o.querySelectorAll(':scope > [draggable="true"]').length===0&&!o.querySelector(".kb-empty")){let _=document.createElement("p");_.className="kb-empty",_.textContent="No items",o.appendChild(_)}let h=this.#d(i.item),f=this.#f(d),b=this.#f(l);this.#g(`${h} moved from ${f} to ${b}`),this.#p("drag"),this.dispatchEvent(new CustomEvent("kanban-board:transfer",{bubbles:!0,detail:{itemId:i.itemId,fromColumn:d,toColumn:l,newIndex:i.newIndex,item:i.item}}));let v=c.querySelectorAll(':scope > [draggable="true"]').length,x=this.#i.find(_=>_.id===l);x?.wip!==null&&x?.wip!==void 0&&v>x.wip&&this.dispatchEvent(new CustomEvent("kanban-board:wip-exceeded",{bubbles:!0,detail:{column:l,limit:x.wip,count:v}}))}),this.#c();let a=this.getAttribute("src");if(a){this._loadSrc(a);return}this.dispatchEvent(new CustomEvent("kanban-board:ready",{bubbles:!0,detail:{columnCount:this.#i.length,itemCount:e}}))}#c(){let t=[],e=new Map;for(let[r,a]of Object.entries(this.#r)){let s=a.querySelectorAll(':scope > [draggable="true"]');for(let i of s){let o=i.getAttribute("data-id");o&&(t.push({id:o,column:r}),e.set(o,i))}}this._seedCollection(t,e)}#p(t){let e=[],r=new Map;for(let a of this.items){let s=String(a.id??a.storyId??"");s&&r.set(s,a)}for(let[a,s]of Object.entries(this.#r)){let i=s.querySelectorAll(':scope > [draggable="true"]');for(let o of i){let c=o.getAttribute("data-id");if(!c)continue;let d=r.get(c);e.push(d?{...d,column:a}:{id:c,column:a})}}this._setItemsSilently(e),this._emit("items-changed",{items:e},t)}teardown(){let t=this.querySelector(".kb-title");t&&t.remove(),this.#t&&(this.#t.remove(),this.#t=null),this.#s&&(this.#s.remove(),this.#s=null),this.#r={},this.#a={},this.#i=[]}get columns(){return this.#i.map(t=>({id:t.id,label:t.label,wip:t.wip??void 0,color:t.color??void 0}))}set columns(t){let e=(t||[]).map(i=>({id:i.id,label:i.label||this.#h(i.id),wip:i.wip??null,color:i.color??null,children:[]})),r=this.#t;this.#r={},this.#a={},this.#i=e;let a=this.#u();this.#t=a;let s=()=>{r&&r.remove(),this.appendChild(a)};this.hasAttribute("data-upgraded")&&r?M(this,s,"kb-vt"):s()}get renderItem(){return this.#o}set renderItem(t){this.#o=typeof t=="function"?t:null}_renderItem(t){let e;if(this.#o){let r=this.#o(t);if(!(r instanceof Element))throw new Error("kanban-board: renderItem must return an Element");e=r}else e=this.#l(t);return e.hasAttribute("draggable")||e.setAttribute("draggable","true"),e.hasAttribute("data-id")||e.setAttribute("data-id",String(n.keyOf(t))),e}_containerFor(t,e){let r=this.#r[t.column];if(!r)throw new Error(`kanban-board: no column "${t.column}" \u2014 set .columns first or include item.column matching an existing column id`);let a=r.querySelector(":scope > .kb-empty");return a&&a.remove(),r}_postRender(){for(let t of Object.keys(this.#r)){this.#x(t);let e=this.#r[t],r=e.querySelectorAll(':scope > [draggable="true"]'),a=e.querySelector(":scope > .kb-empty");if(r.length===0&&!a){let s=document.createElement("p");s.className="kb-empty",s.textContent="No items",e.appendChild(s)}else r.length>0&&a&&a.remove()}}#l(t){let e=customElements.get("work-item")?"work-item":"article",r=document.createElement(e);return e==="work-item"?r.data={itemId:t.id??t.storyId,type:t.type,priority:t.priority,status:t.status,estimate:t.estimate!=null?String(t.estimate):void 0,assignee:t.assignee,title:t.title,description:t.description,checklist:t.checklist,notes:t.notes,detail:t.detail}:(r.className="kb-card",r.textContent=t.title||t.label||t.id),r}#u(){let t=document.createElement("div");t.className="kb-columns",t.setAttribute("role","region"),t.setAttribute("aria-label","Kanban board");for(let e of this.#i){let r=document.createElement("section");r.className="kb-column",r.setAttribute("data-column-id",e.id),e.color&&r.setAttribute("data-column-tint",e.color);let a=document.createElement("header");a.className="kb-column-header";let s=document.createElement("h3");s.textContent=e.label;let i=document.createElement("output");if(i.className="kb-count",i.textContent="0",s.appendChild(i),e.wip!=null&&!isNaN(e.wip)){let d=document.createElement("span");d.className="kb-wip",d.textContent=`/ ${e.wip}`,d.setAttribute("aria-label",`WIP limit ${e.wip}`),s.appendChild(d)}a.appendChild(s),r.appendChild(a);let o=document.createElement("drag-surface");o.setAttribute("group",this.#n),o.setAttribute("aria-label",`${e.label} items`),o.setAttribute("data-layout","stack"),o.setAttribute("data-layout-gap","xs");let c=document.createElement("p");c.className="kb-empty",c.textContent="No items",o.appendChild(c),r.appendChild(o),t.appendChild(r),this.#r[e.id]=o,this.#a[e.id]=r}return t}attributeChangedCallback(t,e,r){e===r||!this.isConnected||t==="src"&&this._loadSrc(r)}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();for(;this.firstChild;)this.firstChild.remove();for(let s of r.columns||[]){let i=document.createElement("section");i.setAttribute("data-column",s.id),s.label&&i.setAttribute("data-column-label",s.label),s.wip!=null&&i.setAttribute("data-wip",String(s.wip)),s.color&&i.setAttribute("data-column-color",s.color);for(let o of s.items||[]){let c;o.persona||o.action||o.storyId?(c=document.createElement("user-story"),c.setAttribute("detail",o.detail||"minimal"),o.storyId&&c.setAttribute("story-id",o.storyId),o.persona&&c.setAttribute("persona",o.persona),o.action&&c.setAttribute("action",o.action),o.benefit&&c.setAttribute("benefit",o.benefit),o.priority&&c.setAttribute("priority",o.priority),o.status&&c.setAttribute("status",o.status),o.points&&c.setAttribute("points",String(o.points))):(c=document.createElement("article"),c.className="kb-card",c.textContent=o.text||o.label||""),c.setAttribute("draggable","true"),c.dataset.id=o.id||o.storyId||"",i.appendChild(c)}this.appendChild(i)}let a=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,a,"kb-vt"):a()}catch(e){console.warn(`[kanban-board] Failed to load src="${t}":`,e)}}#m(t){if(!t)return null;for(let[e,r]of Object.entries(this.#r))if(r===t)return e;return null}#x(t){let e=this.#r[t],r=this.#a[t];if(!e||!r)return;let a=e.querySelectorAll(':scope > [draggable="true"]').length,s=r.querySelector(".kb-count");s&&(s.textContent=String(a));let i=this.#i.find(o=>o.id===t);i?.wip!==null&&i?.wip!==void 0&&(a>i.wip?r.setAttribute("data-wip-exceeded",""):r.removeAttribute("data-wip-exceeded"))}#f(t){return this.#i.find(r=>r.id===t)?.label||this.#h(t)}#g(t){this.#s&&(this.#s.textContent="",requestAnimationFrame(()=>{this.#s&&(this.#s.textContent=t)}))}#d(t){return t.getAttribute("story-id")||t.getAttribute("data-id")||t.textContent?.trim().slice(0,40)||"item"}#h(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};w("kanban-board",qt);var It=class n extends C{static get observedAttributes(){return["src","compact","title"]}static#e=0;#t=null;#r=null;#a={};#s=null;#n="";#i=[];setup(){this.#n=`sm-${++n.#e}`;let t=[...this.querySelectorAll(":scope > section[data-activity]")];this.#i=t.map(s=>{let i=s.getAttribute("data-activity")||"",c=s.getAttribute("data-activity-label")||""||this.#u(i),d=s.getAttribute("data-journey-phase")||null,l=[...s.children];return{id:i,label:c,journeyPhase:d,children:l}});for(let s of t)s.remove();this.#t=document.createElement("div"),this.#t.className="sm-scroll",this.#t.setAttribute("role","region"),this.#t.setAttribute("aria-label","Story map"),this.#t.setAttribute("tabindex","0"),this.#r=document.createElement("div"),this.#r.className="sm-columns";let e=0;for(let s of this.#i){let i=document.createElement("section");i.className="sm-column",i.setAttribute("data-activity-column",s.id);let o=document.createElement("header");o.className="sm-activity-header";let c=document.createElement("h3");c.textContent=s.label;let d=document.createElement("span");d.className="sm-activity-count",d.textContent=String(s.children.length),c.appendChild(d),o.appendChild(c),i.appendChild(o);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#n),l.setAttribute("aria-label",`${s.label} stories`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),s.children.length>0){for(let u of s.children)l.appendChild(u);e+=s.children.length}else{let u=document.createElement("p");u.className="sm-empty",u.textContent="No stories yet",l.appendChild(u)}i.appendChild(l),this.#r.appendChild(i),this.#a[s.id]=l}let r=this.getAttribute("title");if(r){let s=document.createElement("h2");s.className="sm-title",s.textContent=r,this.appendChild(s)}this.#t.appendChild(this.#r),this.appendChild(this.#t),this.#s=document.createElement("div"),this.#s.className="sm-live-region",this.#s.setAttribute("role","status"),this.#s.setAttribute("aria-live","polite"),this.#s.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.listen(this,"drag-surface:reorder",s=>{let i=s.detail,o=s.target.closest("drag-surface"),c=this.#o(o);c&&(this.#c(c),this.dispatchEvent(new CustomEvent("story-map:reorder",{bubbles:!0,detail:{itemId:i.itemId,activity:c,oldIndex:i.oldIndex,newIndex:i.newIndex}})))}),this.listen(this,"drag-surface:transfer",s=>{let i=s.detail,o=i.fromSurface,c=i.toSurface,d=this.#o(o),l=this.#o(c);if(!d||!l)return;this.#c(d),this.#c(l);let u=c.querySelector(".sm-empty");if(u&&u.remove(),o.querySelectorAll(':scope > [draggable="true"]').length===0&&!o.querySelector(".sm-empty")){let f=document.createElement("p");f.className="sm-empty",f.textContent="No stories yet",o.appendChild(f)}let h=this.#l(i.item);this.#p(`${h} moved from ${d} to ${l}`),this.dispatchEvent(new CustomEvent("story-map:transfer",{bubbles:!0,detail:{itemId:i.itemId,fromActivity:d,toActivity:l,newIndex:i.newIndex}}))});let a=this.getAttribute("src");if(a){this._loadSrc(a);return}this.dispatchEvent(new CustomEvent("story-map:ready",{bubbles:!0,detail:{activityCount:this.#i.length,storyCount:e}}))}teardown(){this.#t&&(this.#t.remove(),this.#t=null),this.#s&&(this.#s.remove(),this.#s=null),this.#r=null,this.#a={},this.#i=[]}get activities(){return this.#i.map(t=>({id:t.id,label:t.label,journeyPhase:t.journeyPhase||void 0,stories:[...this.#a[t.id]?.querySelectorAll(':scope > [draggable="true"]')||[]].map(e=>({id:e.getAttribute("data-id")||void 0,storyId:e.getAttribute("story-id")||void 0,title:e.querySelector('[slot="title"]')?.textContent?.trim()||void 0}))}))}set activities(t){let e=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();for(let a of e){let s=document.createElement("section");s.setAttribute("data-activity",a.id||""),a.label&&s.setAttribute("data-activity-label",a.label),a.journeyPhase&&s.setAttribute("data-journey-phase",a.journeyPhase);for(let i of a.stories||[]){let o,c=this;if(typeof c.renderStory=="function"){let d=c.renderStory(i);o=d instanceof Element?d:null}o||(customElements.get("user-story")?(o=document.createElement("user-story"),o.data=i):(o=document.createElement("article"),o.className="sm-card",o.textContent=i.title||i.id||"")),o.hasAttribute("draggable")||o.setAttribute("draggable","true"),i.id&&!o.hasAttribute("data-id")&&o.setAttribute("data-id",String(i.id)),s.appendChild(o)}this.appendChild(s)}let r=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,r,"sm-vt"):r(),this.dispatchEvent(new CustomEvent("story-map:activities-changed",{detail:{activities:e,source:"property"},bubbles:!0}))}attributeChangedCallback(t,e,r){e===r||!this.isConnected||t==="src"&&this._loadSrc(r)}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();for(;this.firstChild;)this.firstChild.remove();for(let s of r.activities||[]){let i=document.createElement("section");i.setAttribute("data-activity",s.id),i.setAttribute("data-activity-label",s.label||s.id),s.journeyPhase&&i.setAttribute("data-journey-phase",s.journeyPhase);for(let o of s.stories||[]){let c=document.createElement("user-story");c.setAttribute("draggable","true"),c.dataset.id=o.id||o.storyId,(o.storyId||o.id)&&c.setAttribute("story-id",o.storyId||o.id),o.title&&c.setAttribute("title",o.title),o.persona&&c.setAttribute("persona",o.persona),o.action&&c.setAttribute("action",o.action),o.benefit&&c.setAttribute("benefit",o.benefit),o.priority&&c.setAttribute("priority",o.priority),o.status&&c.setAttribute("status",o.status),o.points&&c.setAttribute("points",String(o.points)),c.setAttribute("detail",o.detail||"compact"),i.appendChild(c)}this.appendChild(i)}let a=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,a,"sm-vt"):a()}catch(e){console.warn(`[story-map] Failed to load src="${t}":`,e)}}#o(t){if(!t)return null;for(let[e,r]of Object.entries(this.#a))if(r===t)return e;return null}#c(t){let e=this.#a[t];if(!e)return;let r=e.querySelectorAll(':scope > [draggable="true"]').length,a=e.closest("[data-activity-column]");if(!a)return;let s=a.querySelector(".sm-activity-count");s&&(s.textContent=String(r))}#p(t){this.#s&&(this.#s.textContent="",requestAnimationFrame(()=>{this.#s&&(this.#s.textContent=t)}))}#l(t){return t.getAttribute("story-id")||t.getAttribute("data-id")||t.textContent?.trim().slice(0,40)||"item"}#u(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};w("story-map",It);var st=`
|
|
1781
1781
|
:host {
|
|
1782
1782
|
display: block;
|
|
1783
1783
|
position: relative;
|
|
@@ -2225,7 +2225,7 @@ var re=`
|
|
|
2225
2225
|
/* \u2500\u2500 Utility \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
2226
2226
|
.state-msg { padding: var(--_space-l); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
2227
2227
|
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
2228
|
-
`;function
|
|
2228
|
+
`;function Je(){let n=globalThis.localStorage;if(!n)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return n.getItem(t)},async setRaw(t,e){n.setItem(t,e)},async removeRaw(t){n.removeItem(t)},async keys(t){let e=[];for(let r=0;r<n.length;r++){let a=n.key(r);a&&a.startsWith(t)&&e.push(a)}return e}}}var at=null;function j(){return at||(at=Je()),at}function Nt(n,t){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${n}:${t}`}function oe(n){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${n}:`}function ce(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var it={configure(n={}){at=n.backend??null},async set(n,t,e){let r={data:e,timestamp:Date.now()};await j().setRaw(Nt(n,t),JSON.stringify(r))},async get(n,t,e){let r=await j().getRaw(Nt(n,t));if(r==null)return null;let a=ce(r);return!a||e?.maxAge!=null&&Date.now()-a.timestamp>e.maxAge?null:a.data},async remove(n,t){await j().removeRaw(Nt(n,t))},async list(n){let t=oe(n),e=await j().keys(t),r=[];for(let a of e){let s=await j().getRaw(a);if(s==null)continue;let i=ce(s);i&&r.push({key:a.slice(t.length),data:i.data,timestamp:i.timestamp})}return r},async clear(n){let t=oe(n),e=await j().keys(t);for(let r of e)await j().removeRaw(r)},async clearAll(){let n=await j().keys("vb:");for(let t of n)await j().removeRaw(t)},async setMany(n,t){for(let[e,r]of t)await it.set(n,e,r)}};var Mt="[data-copy], [data-copy-target], [data-paste-target]",Ge="Copied to clipboard",Ze="Pasted from clipboard",Tt=new WeakMap;async function zt(n,t={}){if(n==null||n==="")return!1;let{button:e,announceMessage:r=Ge,duration:a=1500}=t;try{await navigator.clipboard.writeText(n)}catch{return!1}return de({button:e,duration:a,announceMessage:r,eventDetail:{text:n}}),!0}function de({button:n,duration:t,announceMessage:e,eventDetail:r,state:a="copied",eventName:s="copy"}){if(n){n.dataset.state=a;let i=Tt.get(n);i&&clearTimeout(i),Tt.set(n,setTimeout(()=>{delete n.dataset.state,Tt.delete(n)},t)),n.dispatchEvent(new CustomEvent(s,{bubbles:!0,detail:r}))}rr(e,n??document.body)}async function tr(n,t={}){let{button:e,announceMessage:r=Ze,duration:a=1500}=t,s;try{s=await navigator.clipboard.readText()}catch{return null}return n&&("value"in n&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)?n.value=s:n.textContent=s,n.dispatchEvent(new Event("input",{bubbles:!0}))),de({button:e,duration:a,announceMessage:r,eventDetail:{text:s},state:"pasted",eventName:"paste"}),s}function le(n=document){n.querySelectorAll(Mt).forEach(Lt)}function Lt(n){n.hasAttribute("data-copy-init")||(n.setAttribute("data-copy-init",""),n.addEventListener("click",()=>{if(n.dataset.pasteTarget){let e=document.querySelector(n.dataset.pasteTarget);if(!e)return;tr(e,{button:n});return}let t=er(n);t&&zt(t,{button:n})}))}function er(n){if(n.dataset.copy)return n.dataset.copy;if(n.dataset.copyTarget){let t=document.querySelector(n.dataset.copyTarget);if(!t)return"";let e=n.dataset.copyAttr;return e?t.getAttribute(e)??"":t.textContent??""}return""}function rr(n,t){let e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.className="visually-hidden",e.textContent=n,t.appendChild(e),setTimeout(()=>e.remove(),1e3)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>le()):le();var sr=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let r=e;r.matches(Mt)&&Lt(r),r.querySelectorAll(Mt).forEach(a=>Lt(a))}});sr.observe(document.documentElement,{childList:!0,subtree:!0});var X=class{#e=new Map;async load(){return[...this.#e.values()]}async save(t){return t.id||(t.id=crypto.randomUUID()),this.#e.set(t.id,t),t}async update(t,e){let r=this.#e.get(t);if(!r)throw new Error(`Pin ${t} not found`);return Object.assign(r,e),r}async remove(t){this.#e.delete(t)}},nt=class{#e;constructor(t="default"){this.#e=t}async#t(){let t=await it.get("reviews",this.#e);return Array.isArray(t)?t:[]}async#r(t){await it.set("reviews",this.#e,t)}async load(){return this.#t()}async save(t){t.id||(t.id=crypto.randomUUID());let e=await this.#t();return e.push(t),await this.#r(e),t}async update(t,e){let r=await this.#t(),a=r.findIndex(s=>s.id===t);if(a===-1)throw new Error(`Pin ${t} not found`);return Object.assign(r[a],e),await this.#r(r),r[a]}async remove(t){let e=(await this.#t()).filter(r=>r.id!==t);await this.#r(e)}},ot=class{#e;constructor(t){if(!t)throw new Error("RestAdapter requires an endpoint URL");this.#e=t.replace(/\/$/,"")}async load(){let t=await fetch(this.#e);if(!t.ok)throw new Error(`HTTP ${t.status}`);let e=await t.json();return Array.isArray(e)?e:e.pins||[]}async save(t){let e=await fetch(this.#e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async update(t,e){let r=await fetch(`${this.#e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}async remove(t){let e=await fetch(`${this.#e}/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`)}},Pt=class extends HTMLElement{static get observedAttributes(){return["src","editable","adapter","endpoint","storage-key","author","compact","show-resolved"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"}),this.__pins=[],this.__adapter=null,this._activePin=null,this._annotating=!1}get pins(){return this.__pins}set pins(t){let e=Array.isArray(t)?t:[];this.__pins!==e&&(this.__pins=e,this.isConnected&&this._render(),this.dispatchEvent(new CustomEvent("review-surface:pins-changed",{detail:{pins:e,source:"property"},bubbles:!0,composed:!0})))}get adapter(){return this.__adapter}set adapter(t){this.__adapter=t,this.isConnected&&this._loadFromAdapter()}#t(){for(let t of this.children){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}connectedCallback(){this.#t(),this.setAttribute("data-upgraded",""),this.#r(),this.hasAttribute("src")?this._loadSrc(this.getAttribute("src")):this._loadFromAdapter()}disconnectedCallback(){this.removeAttribute("data-upgraded"),this.removeAttribute("data-annotating")}attributeChangedCallback(t){this.isConnected&&(t==="src"?this._loadSrc(this.getAttribute("src")):t==="adapter"||t==="endpoint"||t==="storage-key"?(this.#r(),this._loadFromAdapter()):this._render())}#r(){if(this.__adapter&&!(this.__adapter instanceof X)&&!(this.__adapter instanceof nt)&&!(this.__adapter instanceof ot))return;switch(this.getAttribute("adapter")||"memory"){case"local":this.__adapter=new nt(this.getAttribute("storage-key")||"default");break;case"rest":try{this.__adapter=new ot(this.getAttribute("endpoint")??"")}catch{this.__adapter=new X}break;default:this.__adapter=new X}}async _loadSrc(t){if(!(!t||!this.shadowRoot)){this.shadowRoot.innerHTML=`<style>${st}</style><div class="state-msg">Loading\u2026</div>`;try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();this.__pins=Array.isArray(r)?r:r.pins||[],this._render()}catch(e){let r=e instanceof Error?e.message:String(e);this.shadowRoot.innerHTML=`<style>${st}</style><div class="state-msg state-msg--error">Could not load pins: ${m(r)}</div>`}}}async _loadFromAdapter(){if(this.__adapter){try{this.__pins=await this.__adapter.load()}catch{this.__pins=[]}this._render()}}async addPin(t){let e={id:crypto.randomUUID(),x:Math.max(0,Math.min(100,t.x)),y:Math.max(0,Math.min(100,t.y)),text:t.text||"",author:t.author||this.getAttribute("author")||"Anonymous",createdAt:new Date().toISOString(),resolved:!1,resolvedBy:null,resolvedAt:null,replies:[]};return this.__adapter&&await this.__adapter.save(e),this.__pins.push(e),this._render(),this.#c(`Pin ${this.#a().length} added`),this.dispatchEvent(new CustomEvent("review-surface:add",{bubbles:!0,composed:!0,detail:{pin:e}})),e}async removePin(t){let e=this.__pins.find(r=>r.id===t);e&&(this.__adapter&&await this.__adapter.remove(t),this.__pins=this.__pins.filter(r=>r.id!==t),this._activePin===t&&(this._activePin=null),this._render(),this.#c("Pin removed"),this.dispatchEvent(new CustomEvent("review-surface:remove",{bubbles:!0,composed:!0,detail:{pin:e}})))}async resolvePin(t){let e=this.__pins.find(a=>a.id===t);if(!e)return;let r={resolved:!0,resolvedBy:this.getAttribute("author")||"Anonymous",resolvedAt:new Date().toISOString()};this.__adapter&&await this.__adapter.update(t,r),Object.assign(e,r),this._render(),this.#c("Pin resolved"),this.dispatchEvent(new CustomEvent("review-surface:resolve",{bubbles:!0,composed:!0,detail:{pin:e}}))}async unresolvePin(t){let e=this.__pins.find(a=>a.id===t);if(!e)return;let r={resolved:!1,resolvedBy:null,resolvedAt:null};this.__adapter&&await this.__adapter.update(t,r),Object.assign(e,r),this._render(),this.#c("Pin re-opened"),this.dispatchEvent(new CustomEvent("review-surface:update",{bubbles:!0,composed:!0,detail:{pin:e,changes:r}}))}exportPins(){return structuredClone(this.__pins)}importPins(t){this.__pins=Array.isArray(t)?structuredClone(t):[],this._activePin=null,this._render()}#a(){let t=this.hasAttribute("show-resolved");return this.__pins.filter(e=>t||!e.resolved).sort((e,r)=>new Date(e.createdAt??0).getTime()-new Date(r.createdAt??0).getTime())}_render(){if(!this.shadowRoot)return;let t=this.hasAttribute("editable"),e=this.#a(),r=this._activePin?this.__pins.find(a=>a.id===this._activePin):null;this.setAttribute("pin-count",String(e.length)),this.shadowRoot.innerHTML=`<style>${st}</style>
|
|
2229
2229
|
<div class="rs-container">
|
|
2230
2230
|
<slot></slot>
|
|
2231
2231
|
<div class="rs-overlay" role="img" aria-label="Review annotation surface">
|
|
@@ -2272,7 +2272,7 @@ var re=`
|
|
|
2272
2272
|
<div class="rs-comment__meta">
|
|
2273
2273
|
<span class="rs-comment__avatar" style="background:${B(t.author||"Anonymous")}">${O(t.author||"Anonymous")}</span>
|
|
2274
2274
|
<span class="rs-comment__author">${m(t.author||"Anonymous")}</span>
|
|
2275
|
-
<span class="rs-comment__time">${this.#
|
|
2275
|
+
<span class="rs-comment__time">${this.#o(t.createdAt)}</span>
|
|
2276
2276
|
</div>
|
|
2277
2277
|
<div class="rs-comment__text">${m(t.text)}</div>
|
|
2278
2278
|
</div>
|
|
@@ -2284,7 +2284,7 @@ var re=`
|
|
|
2284
2284
|
<div class="rs-comment__meta">
|
|
2285
2285
|
<span class="rs-comment__avatar" style="background:${B(a.author||"Anonymous")}">${O(a.author||"Anonymous")}</span>
|
|
2286
2286
|
<span class="rs-comment__author">${m(a.author||"Anonymous")}</span>
|
|
2287
|
-
<span class="rs-comment__time">${this.#
|
|
2287
|
+
<span class="rs-comment__time">${this.#o(a.createdAt)}</span>
|
|
2288
2288
|
</div>
|
|
2289
2289
|
<div class="rs-comment__text">${m(a.text)}</div>
|
|
2290
2290
|
</div>
|
|
@@ -2310,7 +2310,7 @@ var re=`
|
|
|
2310
2310
|
${k(E.download)} Export
|
|
2311
2311
|
</button>
|
|
2312
2312
|
<output class="rs-toolbar__count">${t} pin${t!==1?"s":""}</output>
|
|
2313
|
-
</div>`}_bindListeners(t){let e=this.shadowRoot;if(!e)return;e.querySelectorAll(".rs-pin").forEach(s=>{s.addEventListener("click",i=>{i.stopPropagation();let n=s.dataset.pinId??null;this._activePin=this._activePin===n?null:n,this._render(),this._activePin&&this.dispatchEvent(new CustomEvent("review-surface:select",{bubbles:!0,composed:!0,detail:{pin:this.__pins.find(c=>c.id===n)}}))})});let r=e.querySelector(".rs-overlay");r&&t&&r.addEventListener("click",s=>{if(!this._annotating)return;let i=s;if(i.target?.closest(".rs-pin"))return;let c=r.getBoundingClientRect(),d=(i.clientX-c.left)/c.width*100,l=(i.clientY-c.top)/c.height*100;this.#s(d,l)}),e.querySelectorAll("[data-action]").forEach(s=>{s.addEventListener("click",i=>{i.stopPropagation();let n=s.dataset.action,c=s.dataset.pinId;switch(n){case"close":this._activePin=null,this._render();break;case"resolve":c&&this.resolvePin(c);break;case"unresolve":c&&this.unresolvePin(c);break;case"delete":c&&this.removePin(c);break;case"toggle-mode":this._annotating=!this._annotating,this._annotating?this.setAttribute("data-annotating",""):this.removeAttribute("data-annotating"),this._render(),this.dispatchEvent(new CustomEvent("review-surface:mode",{bubbles:!0,composed:!0,detail:{mode:this._annotating?"annotate":"view"}}));break;case"export":this.#i();break;case"reply":this.#o(c);break}})});let a=e.querySelector(".rs-input__field");a&&a.addEventListener("keydown",s=>{let i=s;if(i.key==="Enter"&&!i.shiftKey){i.preventDefault();let c=e.querySelector('[data-action="reply"]')?.dataset.pinId;c&&this.#o(c)}}),e.addEventListener("keydown",s=>{s.key==="Escape"&&(this._activePin?(this._activePin=null,this._render()):this._annotating&&(this._annotating=!1,this.removeAttribute("data-annotating"),this._render(),this.dispatchEvent(new CustomEvent("review-surface:mode",{bubbles:!0,composed:!0,detail:{mode:"view"}}))))})}async#s(t,e){let r=this.getAttribute("author")||"Anonymous",a=await this.addPin({x:t,y:e,text:"",author:r});this._activePin=a.id,this._render(),requestAnimationFrame(()=>{(this.shadowRoot?.querySelector(".rs-input__field")??null)?.focus()})}async#o(t){let e=this.shadowRoot?.querySelector(".rs-input__field")??null;if(!e)return;let r=e.value.trim();if(!r)return;let a=this.__pins.find(i=>i.id===t);if(!a)return;let s={id:crypto.randomUUID(),text:r,author:this.getAttribute("author")||"Anonymous",createdAt:new Date().toISOString()};a.replies||(a.replies=[]),a.text?(a.replies.push(s),this.__adapter&&await this.__adapter.update(t,{replies:a.replies})):(a.text=r,this.__adapter&&await this.__adapter.update(t,{text:r})),this._render(),this.#c("Reply added"),requestAnimationFrame(()=>{(this.shadowRoot?.querySelector(".rs-input__field")??null)?.focus()}),this.dispatchEvent(new CustomEvent("review-surface:update",{bubbles:!0,composed:!0,detail:{pin:a,changes:{replies:a.replies}}}))}async#i(){let t=JSON.stringify(this.exportPins(),null,2);if(await zt(t,{announceMessage:"Pins copied to clipboard"}))return;let r=new Blob([t],{type:"application/json"}),a=URL.createObjectURL(r),s=document.createElement("a");s.href=a,s.download="review-pins.json",s.click(),URL.revokeObjectURL(a),this.#c("Pins exported as file")}#n(t){if(!t)return"";try{let e=new Date(t),a=new Date().getTime()-e.getTime(),s=Math.floor(a/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let i=Math.floor(s/60);if(i<24)return`${i}h ago`;let n=Math.floor(i/24);return n<7?`${n}d ago`:e.toLocaleDateString()}catch{return""}}#c(t){let e=this.shadowRoot?.querySelector(".rs-live");e&&(e.textContent=t)}};w("review-surface",Pt);var H=864e5,jt=H*7,ct=H*30,sr=H*91,pe=H*365;function Y(o){return typeof o=="number"?o:new Date(o).getTime()}function ar(o){return o<=jt*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):o<=ct*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):o<=pe?t=>t.toLocaleDateString(void 0,{month:"short",year:"2-digit"}):t=>t.toLocaleDateString(void 0,{year:"numeric"})}function ir(o){return o<=jt*3?"day":o<=ct*3?"week":o<=pe?"month":"quarter"}function ue(o){return String(o).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var Rt=class o extends C{static get observedAttributes(){return["src","title","view","show-today","show-progress","show-dependencies","compact"]}#e=null;#t=null;#r=null;#a=[];#s=0;#o=0;#i=0;setup(){let t=this.querySelector(":scope > table");return!t||(this.#a=this.#l(t),this.#a.length===0)?!1:(this.#s=Math.min(...this.#a.map(e=>e.start)),this.#o=Math.max(...this.#a.map(e=>e.end)),this.#i=this.#o-this.#s,this.#i<=0&&(this.#i=H),this.#p(t),this.dispatchEvent(new CustomEvent("gantt-chart:ready",{bubbles:!0,detail:{taskCount:this.#a.length,dateRange:{start:new Date(this.#s).toISOString(),end:new Date(this.#o).toISOString()}}})),!0)}teardown(){this.#r&&(this.#r.remove(),this.#r=null),this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null);let t=this.querySelector("table.gc-sr-only");t&&t.classList.remove("gc-sr-only"),this.#a=[]}static#n=0;attributeChangedCallback(t,e,r){e===r||!this.isConnected||(t==="src"?this._loadSrc(r):this.hasAttribute("data-upgraded")&&this.#c())}#c(){let t=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};if(this.hasAttribute("data-upgraded")&&"startViewTransition"in document&&!matchMedia("(prefers-reduced-motion: reduce)").matches){let e=`gc-vt-${++o.#n}`;this.style.viewTransitionName=e,document.startViewTransition(t).finished.finally(()=>{this.style.viewTransitionName=""})}else t()}get tasks(){return this.#a}set tasks(t){let e=(t||[]).map((r,a)=>({id:r.id??`gc-task-${a}`,name:r.name??`Task ${a+1}`,start:typeof r.start=="number"?r.start:Y(r.start),end:typeof r.end=="number"?r.end:r.end!=null?Y(r.end):typeof r.start=="number"?r.start:Y(r.start),progress:r.progress??0,group:r.group??null,depends:Array.isArray(r.depends)?r.depends:r.depends?String(r.depends).split(",").map(s=>s.trim()):[],status:r.status??null,assignee:r.assignee??null,milestone:!!r.milestone,color:r.color??null,storyIds:r.storyIds??[],itemIds:r.itemIds??[]}));if((this.#e||this.#r||this.#t)&&(this.#r&&(this.#r.remove(),this.#r=null),this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null)),this.#a=e,e.length>0){this.#s=Math.min(...e.map(a=>a.start)),this.#o=Math.max(...e.map(a=>a.end)),this.#i=this.#o-this.#s,this.#i<=0&&(this.#i=H);let r=this.querySelector(":scope > table");r||(r=document.createElement("table"),r.classList.add("gc-sr-only"),this.appendChild(r)),this.#p(r)}this.dispatchEvent(new CustomEvent("gantt-chart:tasks-changed",{detail:{tasks:e,source:"property"},bubbles:!0}))}#l(t){let e=t.querySelectorAll("tbody tr"),r=[];for(let a=0;a<e.length;a++){let s=e[a],i=s.querySelectorAll("time[datetime]");if(i.length<2&&!s.hasAttribute("data-milestone"))continue;let n=i[0]?.getAttribute("datetime"),c=i.length>1?i[1].getAttribute("datetime"):n;if(!n)continue;let d=s.querySelector("progress"),l=d?d.value/(d.max||100):0,u=s.cells[0]?.textContent?.trim()||`Task ${a+1}`;r.push({id:s.dataset.taskId||`gc-task-${a}`,name:u,start:Y(n),end:Y(c),progress:l,group:s.dataset.group||null,depends:s.dataset.depends?s.dataset.depends.split(",").map(p=>p.trim()):[],status:s.dataset.status||null,assignee:s.dataset.assignee||null,milestone:s.hasAttribute("data-milestone"),color:s.dataset.color||null,storyIds:s.dataset.storyIds?s.dataset.storyIds.split(",").map(p=>p.trim()):[],itemIds:s.dataset.itemIds?s.dataset.itemIds.split(",").map(p=>p.trim()):[]})}return r}#p(t){let e=this.getAttribute("title"),r=this.hasAttribute("show-today"),a=this.hasAttribute("show-progress"),s=this.hasAttribute("show-dependencies");e&&(this.#r=document.createElement("h2"),this.#r.className="gc-title",this.#r.textContent=e,this.insertBefore(this.#r,t)),this.#e=document.createElement("div"),this.#e.className="gc-container",this.#e.setAttribute("role","region"),this.#e.setAttribute("aria-label",`Gantt chart${e?": "+e:""}`);let i=this.#d();this.#e.appendChild(i);let n=document.createElement("div");n.className="gc-body";let c=document.createElement("div");c.className="gc-task-list";let d=document.createElement("div");d.className="gc-bars";let l=this.#u();d.appendChild(l);let u=this.#m();for(let[p,h]of u){if(u.size>1&&p){let f=document.createElement("div");f.className="gc-group-header";let b=document.createElement("span");b.className="gc-group-label",b.textContent=p,f.appendChild(b),c.appendChild(f);let v=document.createElement("div");v.className="gc-group-spacer",d.appendChild(v)}for(let f of h){let b=document.createElement("div");b.className="gc-task-row",b.setAttribute("data-task-id",f.id);let v=document.createElement("span");v.className="gc-task-name",v.textContent=f.name,b.appendChild(v);let x=document.createElement("span");x.className="gc-task-dates",x.textContent=`${new Date(f.start).toLocaleDateString()} to ${new Date(f.end).toLocaleDateString()}`,b.appendChild(x),c.appendChild(b);let _=document.createElement("div");_.className="gc-bar-row",f.milestone?_.appendChild(this.#b(f)):_.appendChild(this.#h(f,a)),d.appendChild(_)}}if(r){let p=this.#v();p&&d.appendChild(p)}s&&requestAnimationFrame(()=>{let p=this.#y(d);p&&d.appendChild(p)}),n.appendChild(c),n.appendChild(d),this.#e.appendChild(n),this.insertBefore(this.#e,t),t.classList.add("gc-sr-only"),this.#t=document.createElement("div"),this.#t.className="gc-sr-only",this.#t.setAttribute("role","status"),this.#t.setAttribute("aria-live","polite"),this.#t.setAttribute("aria-atomic","true"),this.appendChild(this.#t),this.listen(this.#e,"click",p=>{let h=p.target.closest(".gc-bar, .gc-milestone");if(!h)return;let f=h.dataset.taskId,b=this.#a.find(v=>v.id===f);b&&(this.#x(`Selected: ${b.name}`),this.dispatchEvent(new CustomEvent("gantt-chart:task-click",{bubbles:!0,detail:{task:b}})))}),this.listen(this.#e,"keydown",p=>{let h=p;if(h.key==="Enter"||h.key===" "){let f=h.target.closest(".gc-bar, .gc-milestone");f&&(h.preventDefault(),f.click())}})}#d(){let t=document.createElement("div");t.className="gc-timeline-header";let e=document.createElement("div");e.className="gc-timeline-spacer",t.appendChild(e);let r=document.createElement("div");r.className="gc-timeline-dates";let a=this.#f();for(let{position:s,text:i}of a){let n=document.createElement("span");n.className="gc-date-label",n.style.left=`${s}%`,n.textContent=i,r.appendChild(n)}return t.appendChild(r),t}#f(){let t=this.getAttribute("view")||"auto",e=t==="auto"?ir(this.#i):t,r=ar(this.#i),a=[],s;switch(e){case"day":s=H;break;case"week":s=jt;break;case"month":s=ct;break;case"quarter":s=sr;break;default:s=ct}let i=new Date(this.#s);if(e==="week"){let d=i.getDay(),l=d===0?1:d===1?0:8-d;i.setDate(i.getDate()+l)}else if(e==="month")i.setDate(1),i.getTime()<this.#s&&i.setMonth(i.getMonth()+1);else if(e==="quarter"){let d=i.getMonth(),l=Math.ceil((d+1)/3)*3;i.setMonth(l),i.setDate(1)}let n=i.getTime();n>this.#s+s*.5&&a.push({position:0,text:r(new Date(this.#s))});let c=n;for(;c<=this.#o;){let d=(c-this.#s)/this.#i*100;if(d>=0&&d<=100&&a.push({position:d,text:r(new Date(c))}),e==="month"){let l=new Date(c);l.setMonth(l.getMonth()+1),c=l.getTime()}else if(e==="quarter"){let l=new Date(c);l.setMonth(l.getMonth()+3),c=l.getTime()}else c+=s}return a}#u(){let t=document.createElement("div");t.className="gc-grid-lines";let e=this.#f();for(let{position:r}of e){if(r<=0)continue;let a=document.createElement("div");a.className="gc-grid-line",a.style.left=`${r}%`,t.appendChild(a)}return t}#m(){let t=new Map;for(let e of this.#a){let r=e.group||"";t.has(r)||t.set(r,[]),t.get(r)?.push(e)}return t}#h(t,e){let r=(t.start-this.#s)/this.#i*100,a=(t.end-t.start)/this.#i*100,s=document.createElement("div");if(s.className="gc-bar",s.setAttribute("data-task-id",t.id),s.setAttribute("role","img"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label",`${ue(t.name)}: ${new Date(t.start).toLocaleDateString()} to ${new Date(t.end).toLocaleDateString()}`+(t.progress>0?`, ${Math.round(t.progress*100)}% complete`:"")),s.style.left=`${r}%`,s.style.width=`${Math.max(a,.5)}%`,t.status&&s.setAttribute("data-status",t.status),t.color&&s.style.setProperty("--gc-bar-color",t.color),e&&t.progress>0){let i=document.createElement("div");i.className="gc-bar-fill",i.style.width=`${Math.round(t.progress*100)}%`,s.appendChild(i)}if(a>8){let i=document.createElement("span");i.className="gc-bar-label",i.textContent=t.name,s.appendChild(i)}return s}#b(t){let e=(t.start-this.#s)/this.#i*100,r=document.createElement("div");return r.className="gc-milestone",r.setAttribute("data-task-id",t.id),r.setAttribute("role","img"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`Milestone: ${ue(t.name)}, ${new Date(t.start).toLocaleDateString()}`),r.style.left=`${e}%`,t.status&&r.setAttribute("data-status",t.status),t.color&&r.style.setProperty("--gc-bar-color",t.color),r}#v(){let t=Date.now();if(t<this.#s||t>this.#o)return null;let e=(t-this.#s)/this.#i*100,r=document.createElement("div");r.className="gc-today-line",r.style.left=`${e}%`;let a=document.createElement("span");return a.className="gc-today-label",a.textContent="Today",r.appendChild(a),r}#y(t){if(!this.#a.some(l=>l.depends.length>0))return null;let r="http://www.w3.org/2000/svg",a=36,s=t.querySelectorAll(".gc-bar-row").length,i=document.createElementNS(r,"svg");i.setAttribute("class","gc-deps"),i.setAttribute("viewBox",`0 0 100 ${s*a}`),i.setAttribute("preserveAspectRatio","none"),i.style.width="100%",i.style.height="100%";let n=document.createElementNS(r,"defs"),c=document.createElementNS(r,"marker");c.setAttribute("id","gc-arrowhead"),c.setAttribute("markerWidth","8"),c.setAttribute("markerHeight","6"),c.setAttribute("refX","8"),c.setAttribute("refY","3"),c.setAttribute("orient","auto");let d=document.createElementNS(r,"polygon");d.setAttribute("points","0 0, 8 3, 0 6"),d.setAttribute("fill","var(--color-text-muted, #666666)"),c.appendChild(d),n.appendChild(c),i.appendChild(n);for(let l of this.#a)for(let u of l.depends){let p=this.#a.find(A=>A.id===u);if(!p)continue;let h=(p.end-this.#s)/this.#i*100,f=(l.start-this.#s)/this.#i*100,b=this.#g(p.id,t),v=this.#g(l.id,t);if(b===-1||v===-1)continue;let x=b*a+a/2,_=v*a+a/2,g=document.createElementNS(r,"path"),y=h+(f-h)/2;g.setAttribute("d",`M ${h} ${x} C ${y} ${x}, ${y} ${_}, ${f} ${_}`),g.setAttribute("class","gc-dep-line"),g.setAttribute("vector-effect","non-scaling-stroke"),i.appendChild(g)}return i}#g(t,e){let r=e.querySelectorAll(".gc-bar-row");for(let a=0;a<r.length;a++){let s=r[a].querySelector("[data-task-id]");if(s&&s.dataset.taskId===t)return a}return-1}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();for(;this.firstChild;)this.firstChild.remove();let a=document.createElement("table"),s=document.createElement("thead"),i=document.createElement("tr");for(let c of["Task","Start","End","Progress"]){let d=document.createElement("th");d.textContent=c,i.appendChild(d)}s.appendChild(i),a.appendChild(s);let n=document.createElement("tbody");for(let c of r.tasks||[]){let d=document.createElement("tr");c.id&&(d.dataset.taskId=c.id),c.group&&(d.dataset.group=c.group),c.depends&&(d.dataset.depends=Array.isArray(c.depends)?c.depends.join(","):c.depends),c.status&&(d.dataset.status=c.status),c.assignee&&(d.dataset.assignee=c.assignee),c.milestone&&d.setAttribute("data-milestone",""),c.color&&(d.dataset.color=c.color),c.storyIds&&(d.dataset.storyIds=Array.isArray(c.storyIds)?c.storyIds.join(","):c.storyIds),c.itemIds&&(d.dataset.itemIds=Array.isArray(c.itemIds)?c.itemIds.join(","):c.itemIds);let l=document.createElement("td");l.textContent=c.name||"",d.appendChild(l);let u=document.createElement("td"),p=document.createElement("time");p.setAttribute("datetime",c.start),p.textContent=new Date(c.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(p),d.appendChild(u);let h=document.createElement("td"),f=document.createElement("time");f.setAttribute("datetime",c.end||c.start),f.textContent=new Date(c.end||c.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),h.appendChild(f),d.appendChild(h);let b=document.createElement("td"),v=document.createElement("progress");v.value=c.progress||0,v.max=100,v.textContent=`${c.progress||0}%`,b.appendChild(v),d.appendChild(b),n.appendChild(d)}a.appendChild(n),this.appendChild(a),r.title&&this.setAttribute("title",r.title),this.#c()}catch(e){console.warn(`[gantt-chart] Failed to load src="${t}":`,e)}}#x(t){this.#t&&(this.#t.textContent="",requestAnimationFrame(()=>{this.#t&&(this.#t.textContent=t)}))}};w("gantt-chart",Rt);var K=`
|
|
2313
|
+
</div>`}_bindListeners(t){let e=this.shadowRoot;if(!e)return;e.querySelectorAll(".rs-pin").forEach(s=>{s.addEventListener("click",i=>{i.stopPropagation();let o=s.dataset.pinId??null;this._activePin=this._activePin===o?null:o,this._render(),this._activePin&&this.dispatchEvent(new CustomEvent("review-surface:select",{bubbles:!0,composed:!0,detail:{pin:this.__pins.find(c=>c.id===o)}}))})});let r=e.querySelector(".rs-overlay");r&&t&&r.addEventListener("click",s=>{if(!this._annotating)return;let i=s;if(i.target?.closest(".rs-pin"))return;let c=r.getBoundingClientRect(),d=(i.clientX-c.left)/c.width*100,l=(i.clientY-c.top)/c.height*100;this.#s(d,l)}),e.querySelectorAll("[data-action]").forEach(s=>{s.addEventListener("click",i=>{i.stopPropagation();let o=s.dataset.action,c=s.dataset.pinId;switch(o){case"close":this._activePin=null,this._render();break;case"resolve":c&&this.resolvePin(c);break;case"unresolve":c&&this.unresolvePin(c);break;case"delete":c&&this.removePin(c);break;case"toggle-mode":this._annotating=!this._annotating,this._annotating?this.setAttribute("data-annotating",""):this.removeAttribute("data-annotating"),this._render(),this.dispatchEvent(new CustomEvent("review-surface:mode",{bubbles:!0,composed:!0,detail:{mode:this._annotating?"annotate":"view"}}));break;case"export":this.#i();break;case"reply":this.#n(c);break}})});let a=e.querySelector(".rs-input__field");a&&a.addEventListener("keydown",s=>{let i=s;if(i.key==="Enter"&&!i.shiftKey){i.preventDefault();let c=e.querySelector('[data-action="reply"]')?.dataset.pinId;c&&this.#n(c)}}),e.addEventListener("keydown",s=>{s.key==="Escape"&&(this._activePin?(this._activePin=null,this._render()):this._annotating&&(this._annotating=!1,this.removeAttribute("data-annotating"),this._render(),this.dispatchEvent(new CustomEvent("review-surface:mode",{bubbles:!0,composed:!0,detail:{mode:"view"}}))))})}async#s(t,e){let r=this.getAttribute("author")||"Anonymous",a=await this.addPin({x:t,y:e,text:"",author:r});this._activePin=a.id,this._render(),requestAnimationFrame(()=>{(this.shadowRoot?.querySelector(".rs-input__field")??null)?.focus()})}async#n(t){let e=this.shadowRoot?.querySelector(".rs-input__field")??null;if(!e)return;let r=e.value.trim();if(!r)return;let a=this.__pins.find(i=>i.id===t);if(!a)return;let s={id:crypto.randomUUID(),text:r,author:this.getAttribute("author")||"Anonymous",createdAt:new Date().toISOString()};a.replies||(a.replies=[]),a.text?(a.replies.push(s),this.__adapter&&await this.__adapter.update(t,{replies:a.replies})):(a.text=r,this.__adapter&&await this.__adapter.update(t,{text:r})),this._render(),this.#c("Reply added"),requestAnimationFrame(()=>{(this.shadowRoot?.querySelector(".rs-input__field")??null)?.focus()}),this.dispatchEvent(new CustomEvent("review-surface:update",{bubbles:!0,composed:!0,detail:{pin:a,changes:{replies:a.replies}}}))}async#i(){let t=JSON.stringify(this.exportPins(),null,2);if(await zt(t,{announceMessage:"Pins copied to clipboard"}))return;let r=new Blob([t],{type:"application/json"}),a=URL.createObjectURL(r),s=document.createElement("a");s.href=a,s.download="review-pins.json",s.click(),URL.revokeObjectURL(a),this.#c("Pins exported as file")}#o(t){if(!t)return"";try{let e=new Date(t),a=new Date().getTime()-e.getTime(),s=Math.floor(a/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let i=Math.floor(s/60);if(i<24)return`${i}h ago`;let o=Math.floor(i/24);return o<7?`${o}d ago`:e.toLocaleDateString()}catch{return""}}#c(t){let e=this.shadowRoot?.querySelector(".rs-live");e&&(e.textContent=t)}};w("review-surface",Pt);var H=864e5,jt=H*7,ct=H*30,ar=H*91,pe=H*365;function Y(n){return typeof n=="number"?n:new Date(n).getTime()}function ir(n){return n<=jt*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):n<=ct*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):n<=pe?t=>t.toLocaleDateString(void 0,{month:"short",year:"2-digit"}):t=>t.toLocaleDateString(void 0,{year:"numeric"})}function nr(n){return n<=jt*3?"day":n<=ct*3?"week":n<=pe?"month":"quarter"}function ue(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var Rt=class n extends C{static get observedAttributes(){return["src","title","view","show-today","show-progress","show-dependencies","compact"]}#e=null;#t=null;#r=null;#a=[];#s=0;#n=0;#i=0;setup(){let t=this.querySelector(":scope > table");return!t||(this.#a=this.#p(t),this.#a.length===0)?!1:(this.#s=Math.min(...this.#a.map(e=>e.start)),this.#n=Math.max(...this.#a.map(e=>e.end)),this.#i=this.#n-this.#s,this.#i<=0&&(this.#i=H),this.#l(t),this.dispatchEvent(new CustomEvent("gantt-chart:ready",{bubbles:!0,detail:{taskCount:this.#a.length,dateRange:{start:new Date(this.#s).toISOString(),end:new Date(this.#n).toISOString()}}})),!0)}teardown(){this.#r&&(this.#r.remove(),this.#r=null),this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null);let t=this.querySelector("table.gc-sr-only");t&&t.classList.remove("gc-sr-only"),this.#a=[]}static#o=0;attributeChangedCallback(t,e,r){e===r||!this.isConnected||(t==="src"?this._loadSrc(r):this.hasAttribute("data-upgraded")&&this.#c())}#c(){let t=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};if(this.hasAttribute("data-upgraded")&&"startViewTransition"in document&&!matchMedia("(prefers-reduced-motion: reduce)").matches){let e=`gc-vt-${++n.#o}`;this.style.viewTransitionName=e,document.startViewTransition(t).finished.finally(()=>{this.style.viewTransitionName=""})}else t()}get tasks(){return this.#a}set tasks(t){let e=(t||[]).map((r,a)=>({id:r.id??`gc-task-${a}`,name:r.name??`Task ${a+1}`,start:typeof r.start=="number"?r.start:Y(r.start),end:typeof r.end=="number"?r.end:r.end!=null?Y(r.end):typeof r.start=="number"?r.start:Y(r.start),progress:r.progress??0,group:r.group??null,depends:Array.isArray(r.depends)?r.depends:r.depends?String(r.depends).split(",").map(s=>s.trim()):[],status:r.status??null,assignee:r.assignee??null,milestone:!!r.milestone,color:r.color??null,storyIds:r.storyIds??[],itemIds:r.itemIds??[]}));if((this.#e||this.#r||this.#t)&&(this.#r&&(this.#r.remove(),this.#r=null),this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null)),this.#a=e,e.length>0){this.#s=Math.min(...e.map(a=>a.start)),this.#n=Math.max(...e.map(a=>a.end)),this.#i=this.#n-this.#s,this.#i<=0&&(this.#i=H);let r=this.querySelector(":scope > table");r||(r=document.createElement("table"),r.classList.add("gc-sr-only"),this.appendChild(r)),this.#l(r)}this.dispatchEvent(new CustomEvent("gantt-chart:tasks-changed",{detail:{tasks:e,source:"property"},bubbles:!0}))}#p(t){let e=t.querySelectorAll("tbody tr"),r=[];for(let a=0;a<e.length;a++){let s=e[a],i=s.querySelectorAll("time[datetime]");if(i.length<2&&!s.hasAttribute("data-milestone"))continue;let o=i[0]?.getAttribute("datetime"),c=i.length>1?i[1].getAttribute("datetime"):o;if(!o)continue;let d=s.querySelector("progress"),l=d?d.value/(d.max||100):0,u=s.cells[0]?.textContent?.trim()||`Task ${a+1}`;r.push({id:s.dataset.taskId||`gc-task-${a}`,name:u,start:Y(o),end:Y(c),progress:l,group:s.dataset.group||null,depends:s.dataset.depends?s.dataset.depends.split(",").map(p=>p.trim()):[],status:s.dataset.status||null,assignee:s.dataset.assignee||null,milestone:s.hasAttribute("data-milestone"),color:s.dataset.color||null,storyIds:s.dataset.storyIds?s.dataset.storyIds.split(",").map(p=>p.trim()):[],itemIds:s.dataset.itemIds?s.dataset.itemIds.split(",").map(p=>p.trim()):[]})}return r}#l(t){let e=this.getAttribute("title"),r=this.hasAttribute("show-today"),a=this.hasAttribute("show-progress"),s=this.hasAttribute("show-dependencies");e&&(this.#r=document.createElement("h2"),this.#r.className="gc-title",this.#r.textContent=e,this.insertBefore(this.#r,t)),this.#e=document.createElement("div"),this.#e.className="gc-container",this.#e.setAttribute("role","region"),this.#e.setAttribute("aria-label",`Gantt chart${e?": "+e:""}`);let i=this.#u();this.#e.appendChild(i);let o=document.createElement("div");o.className="gc-body";let c=document.createElement("div");c.className="gc-task-list";let d=document.createElement("div");d.className="gc-bars";let l=this.#x();d.appendChild(l);let u=this.#f();for(let[p,h]of u){if(u.size>1&&p){let f=document.createElement("div");f.className="gc-group-header";let b=document.createElement("span");b.className="gc-group-label",b.textContent=p,f.appendChild(b),c.appendChild(f);let v=document.createElement("div");v.className="gc-group-spacer",d.appendChild(v)}for(let f of h){let b=document.createElement("div");b.className="gc-task-row",b.setAttribute("data-task-id",f.id);let v=document.createElement("span");v.className="gc-task-name",v.textContent=f.name,b.appendChild(v);let x=document.createElement("span");x.className="gc-task-dates",x.textContent=`${new Date(f.start).toLocaleDateString()} to ${new Date(f.end).toLocaleDateString()}`,b.appendChild(x),c.appendChild(b);let _=document.createElement("div");_.className="gc-bar-row",f.milestone?_.appendChild(this.#d(f)):_.appendChild(this.#g(f,a)),d.appendChild(_)}}if(r){let p=this.#h();p&&d.appendChild(p)}s&&requestAnimationFrame(()=>{let p=this.#v(d);p&&d.appendChild(p)}),o.appendChild(c),o.appendChild(d),this.#e.appendChild(o),this.insertBefore(this.#e,t),t.classList.add("gc-sr-only"),this.#t=document.createElement("div"),this.#t.className="gc-sr-only",this.#t.setAttribute("role","status"),this.#t.setAttribute("aria-live","polite"),this.#t.setAttribute("aria-atomic","true"),this.appendChild(this.#t),this.listen(this.#e,"click",p=>{let h=p.target.closest(".gc-bar, .gc-milestone");if(!h)return;let f=h.dataset.taskId,b=this.#a.find(v=>v.id===f);b&&(this.#A(`Selected: ${b.name}`),this.dispatchEvent(new CustomEvent("gantt-chart:task-click",{bubbles:!0,detail:{task:b}})))}),this.listen(this.#e,"keydown",p=>{let h=p;if(h.key==="Enter"||h.key===" "){let f=h.target.closest(".gc-bar, .gc-milestone");f&&(h.preventDefault(),f.click())}})}#u(){let t=document.createElement("div");t.className="gc-timeline-header";let e=document.createElement("div");e.className="gc-timeline-spacer",t.appendChild(e);let r=document.createElement("div");r.className="gc-timeline-dates";let a=this.#m();for(let{position:s,text:i}of a){let o=document.createElement("span");o.className="gc-date-label",o.style.left=`${s}%`,o.textContent=i,r.appendChild(o)}return t.appendChild(r),t}#m(){let t=this.getAttribute("view")||"auto",e=t==="auto"?nr(this.#i):t,r=ir(this.#i),a=[],s;switch(e){case"day":s=H;break;case"week":s=jt;break;case"month":s=ct;break;case"quarter":s=ar;break;default:s=ct}let i=new Date(this.#s);if(e==="week"){let d=i.getDay(),l=d===0?1:d===1?0:8-d;i.setDate(i.getDate()+l)}else if(e==="month")i.setDate(1),i.getTime()<this.#s&&i.setMonth(i.getMonth()+1);else if(e==="quarter"){let d=i.getMonth(),l=Math.ceil((d+1)/3)*3;i.setMonth(l),i.setDate(1)}let o=i.getTime();o>this.#s+s*.5&&a.push({position:0,text:r(new Date(this.#s))});let c=o;for(;c<=this.#n;){let d=(c-this.#s)/this.#i*100;if(d>=0&&d<=100&&a.push({position:d,text:r(new Date(c))}),e==="month"){let l=new Date(c);l.setMonth(l.getMonth()+1),c=l.getTime()}else if(e==="quarter"){let l=new Date(c);l.setMonth(l.getMonth()+3),c=l.getTime()}else c+=s}return a}#x(){let t=document.createElement("div");t.className="gc-grid-lines";let e=this.#m();for(let{position:r}of e){if(r<=0)continue;let a=document.createElement("div");a.className="gc-grid-line",a.style.left=`${r}%`,t.appendChild(a)}return t}#f(){let t=new Map;for(let e of this.#a){let r=e.group||"";t.has(r)||t.set(r,[]),t.get(r)?.push(e)}return t}#g(t,e){let r=(t.start-this.#s)/this.#i*100,a=(t.end-t.start)/this.#i*100,s=document.createElement("div");if(s.className="gc-bar",s.setAttribute("data-task-id",t.id),s.setAttribute("role","img"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label",`${ue(t.name)}: ${new Date(t.start).toLocaleDateString()} to ${new Date(t.end).toLocaleDateString()}`+(t.progress>0?`, ${Math.round(t.progress*100)}% complete`:"")),s.style.left=`${r}%`,s.style.width=`${Math.max(a,.5)}%`,t.status&&s.setAttribute("data-status",t.status),t.color&&s.style.setProperty("--gc-bar-color",t.color),e&&t.progress>0){let i=document.createElement("div");i.className="gc-bar-fill",i.style.width=`${Math.round(t.progress*100)}%`,s.appendChild(i)}if(a>8){let i=document.createElement("span");i.className="gc-bar-label",i.textContent=t.name,s.appendChild(i)}return s}#d(t){let e=(t.start-this.#s)/this.#i*100,r=document.createElement("div");return r.className="gc-milestone",r.setAttribute("data-task-id",t.id),r.setAttribute("role","img"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`Milestone: ${ue(t.name)}, ${new Date(t.start).toLocaleDateString()}`),r.style.left=`${e}%`,t.status&&r.setAttribute("data-status",t.status),t.color&&r.style.setProperty("--gc-bar-color",t.color),r}#h(){let t=Date.now();if(t<this.#s||t>this.#n)return null;let e=(t-this.#s)/this.#i*100,r=document.createElement("div");r.className="gc-today-line",r.style.left=`${e}%`;let a=document.createElement("span");return a.className="gc-today-label",a.textContent="Today",r.appendChild(a),r}#v(t){if(!this.#a.some(l=>l.depends.length>0))return null;let r="http://www.w3.org/2000/svg",a=36,s=t.querySelectorAll(".gc-bar-row").length,i=document.createElementNS(r,"svg");i.setAttribute("class","gc-deps"),i.setAttribute("viewBox",`0 0 100 ${s*a}`),i.setAttribute("preserveAspectRatio","none"),i.style.width="100%",i.style.height="100%";let o=document.createElementNS(r,"defs"),c=document.createElementNS(r,"marker");c.setAttribute("id","gc-arrowhead"),c.setAttribute("markerWidth","8"),c.setAttribute("markerHeight","6"),c.setAttribute("refX","8"),c.setAttribute("refY","3"),c.setAttribute("orient","auto");let d=document.createElementNS(r,"polygon");d.setAttribute("points","0 0, 8 3, 0 6"),d.setAttribute("fill","var(--color-text-muted, #666666)"),c.appendChild(d),o.appendChild(c),i.appendChild(o);for(let l of this.#a)for(let u of l.depends){let p=this.#a.find(A=>A.id===u);if(!p)continue;let h=(p.end-this.#s)/this.#i*100,f=(l.start-this.#s)/this.#i*100,b=this.#b(p.id,t),v=this.#b(l.id,t);if(b===-1||v===-1)continue;let x=b*a+a/2,_=v*a+a/2,g=document.createElementNS(r,"path"),y=h+(f-h)/2;g.setAttribute("d",`M ${h} ${x} C ${y} ${x}, ${y} ${_}, ${f} ${_}`),g.setAttribute("class","gc-dep-line"),g.setAttribute("vector-effect","non-scaling-stroke"),i.appendChild(g)}return i}#b(t,e){let r=e.querySelectorAll(".gc-bar-row");for(let a=0;a<r.length;a++){let s=r[a].querySelector("[data-task-id]");if(s&&s.dataset.taskId===t)return a}return-1}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let r=await e.json();for(;this.firstChild;)this.firstChild.remove();let a=document.createElement("table"),s=document.createElement("thead"),i=document.createElement("tr");for(let c of["Task","Start","End","Progress"]){let d=document.createElement("th");d.textContent=c,i.appendChild(d)}s.appendChild(i),a.appendChild(s);let o=document.createElement("tbody");for(let c of r.tasks||[]){let d=document.createElement("tr");c.id&&(d.dataset.taskId=c.id),c.group&&(d.dataset.group=c.group),c.depends&&(d.dataset.depends=Array.isArray(c.depends)?c.depends.join(","):c.depends),c.status&&(d.dataset.status=c.status),c.assignee&&(d.dataset.assignee=c.assignee),c.milestone&&d.setAttribute("data-milestone",""),c.color&&(d.dataset.color=c.color),c.storyIds&&(d.dataset.storyIds=Array.isArray(c.storyIds)?c.storyIds.join(","):c.storyIds),c.itemIds&&(d.dataset.itemIds=Array.isArray(c.itemIds)?c.itemIds.join(","):c.itemIds);let l=document.createElement("td");l.textContent=c.name||"",d.appendChild(l);let u=document.createElement("td"),p=document.createElement("time");p.setAttribute("datetime",c.start),p.textContent=new Date(c.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(p),d.appendChild(u);let h=document.createElement("td"),f=document.createElement("time");f.setAttribute("datetime",c.end||c.start),f.textContent=new Date(c.end||c.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),h.appendChild(f),d.appendChild(h);let b=document.createElement("td"),v=document.createElement("progress");v.value=c.progress||0,v.max=100,v.textContent=`${c.progress||0}%`,b.appendChild(v),d.appendChild(b),o.appendChild(d)}a.appendChild(o),this.appendChild(a),r.title&&this.setAttribute("title",r.title),this.#c()}catch(e){console.warn(`[gantt-chart] Failed to load src="${t}":`,e)}}#A(t){this.#t&&(this.#t.textContent="",requestAnimationFrame(()=>{this.#t&&(this.#t.textContent=t)}))}};w("gantt-chart",Rt);var K=`
|
|
2314
2314
|
:host {
|
|
2315
2315
|
--_bg: var(--work-item-bg, var(--color-surface, #ffffff));
|
|
2316
2316
|
--_text: var(--work-item-text, var(--color-text, #1a1a1a));
|
|
@@ -2673,8 +2673,8 @@ var re=`
|
|
|
2673
2673
|
|
|
2674
2674
|
.state-msg { padding: var(--_space-m); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
2675
2675
|
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
2676
|
-
`;var he={task:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="m9 12 2 2 4-4"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',chore:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',spike:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',feature:'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>'},Dt={critical:{label:"Critical",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"},high:{label:"High",color:"#ea580c",bg:"rgba(234, 88, 12, 0.1)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(202, 138, 4, 0.1)"},low:{label:"Low",color:"#16a34a",bg:"rgba(22, 163, 74, 0.1)"}},Ft={backlog:{label:"Backlog",color:"#6b7280",bg:"rgba(107, 114, 128, 0.1)"},"to-do":{label:"To Do",color:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)"},"in-progress":{label:"In Progress",color:"#8b5cf6",bg:"rgba(139, 92, 246, 0.1)"},review:{label:"Review",color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)"},done:{label:"Done",color:"#22c55e",bg:"rgba(34, 197, 94, 0.1)"},blocked:{label:"Blocked",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"}},Ot=class extends HTMLElement{static get observedAttributes(){return["item-id","type","priority","status","estimate","assignee","story-ids","detail","compact","src"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"})}#t(){for(let t of[...this.children]){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}connectedCallback(){this.#t(),this.itemId&&!this.id&&(this.id=this.itemId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#r(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t,e,r){e!==r&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(r):this.#r())}get itemId(){return this.getAttribute("item-id")||""}get itemTitle(){return this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||""}get itemType(){return this.getAttribute("type")||"task"}get priority(){return this.getAttribute("priority")||"medium"}get status(){return this.getAttribute("status")||"backlog"}get estimate(){return this.getAttribute("estimate")||""}get assignee(){return this.getAttribute("assignee")||""}get storyIds(){let t=this.getAttribute("story-ids")||"";return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}get _detailLevel(){return this.getAttribute("detail")?this.getAttribute("detail"):this.hasAttribute("compact")?"compact":"full"}get _minimalLabel(){return this.itemTitle||this.itemId||"Work item"}updateStatus(t){Ft[t]&&(this.setAttribute("status",t),this.dispatchEvent(new CustomEvent("work-item:status",{detail:{status:t,itemId:this.itemId},bubbles:!0,composed:!0})))}updatePriority(t){Dt[t]&&(this.setAttribute("priority",t),this.dispatchEvent(new CustomEvent("work-item:priority",{detail:{priority:t,itemId:this.itemId},bubbles:!0,composed:!0})))}get data(){return{itemId:this.itemId||void 0,type:this.itemType,priority:this.priority,status:this.status,estimate:this.estimate||void 0,assignee:this.assignee||void 0,storyIds:this.storyIds.length?this.storyIds:void 0,detail:this.getAttribute("detail")||void 0,title:this.itemTitle||void 0}}set data(t){!t||typeof t!="object"||(this._applyData(t),this.shadowRoot&&this.#r(),this.dispatchEvent(new CustomEvent("work-item:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0})))}_applyData(t){for(let[e,r]of[["itemId","item-id"],["type","type"],["priority","priority"],["status","status"],["estimate","estimate"],["assignee","assignee"],["detail","detail"]])t[e]!=null&&this.setAttribute(r,String(t[e]));if(t.storyIds&&this.setAttribute("story-ids",Array.isArray(t.storyIds)?t.storyIds.join(","):String(t.storyIds)),t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h3");e.slot="title",e.textContent=String(t.title),this.appendChild(e)}for(let e of["description","notes"])if(t[e]&&!this.querySelector(`[slot="${e}"]`)){let r=document.createElement("p");r.slot=e,r.textContent=String(t[e]),this.appendChild(r)}if(t.checklist&&!this.querySelector('[slot="checklist"]')){let e=document.createElement("ul");e.slot="checklist";let r=Array.isArray(t.checklist)?t.checklist:[t.checklist];for(let a of r){let s=document.createElement("li");s.textContent=String(a),e.appendChild(s)}this.appendChild(e)}}async _loadSrc(t){if(!t)return;let e=this.shadowRoot;e.innerHTML=`<style>${K}</style><div class="state-msg">Loading\u2026</div>`;try{let r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}`);let a=await r.json();this._applyData(a),this.#r()}catch(r){e.innerHTML=`<style>${K}</style><div class="state-msg state-msg--error">Could not load: ${m(r.message)}</div>`}}#r(){let t=this.shadowRoot,e=Dt[this.priority]||Dt.medium,r=Ft[this.status]||Ft.backlog,a=this.itemType,s=he[a]||he.task,i=this._detailLevel,
|
|
2677
|
-
<article class="wi-card wi-card--minimal" role="article" aria-label="${
|
|
2676
|
+
`;var he={task:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="m9 12 2 2 4-4"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',chore:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',spike:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',feature:'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>'},Dt={critical:{label:"Critical",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"},high:{label:"High",color:"#ea580c",bg:"rgba(234, 88, 12, 0.1)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(202, 138, 4, 0.1)"},low:{label:"Low",color:"#16a34a",bg:"rgba(22, 163, 74, 0.1)"}},Ft={backlog:{label:"Backlog",color:"#6b7280",bg:"rgba(107, 114, 128, 0.1)"},"to-do":{label:"To Do",color:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)"},"in-progress":{label:"In Progress",color:"#8b5cf6",bg:"rgba(139, 92, 246, 0.1)"},review:{label:"Review",color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)"},done:{label:"Done",color:"#22c55e",bg:"rgba(34, 197, 94, 0.1)"},blocked:{label:"Blocked",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"}},Ot=class extends HTMLElement{static get observedAttributes(){return["item-id","type","priority","status","estimate","assignee","story-ids","detail","compact","src"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"})}#t(){for(let t of[...this.children]){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}connectedCallback(){this.#t(),this.itemId&&!this.id&&(this.id=this.itemId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#r(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t,e,r){e!==r&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(r):this.#r())}get itemId(){return this.getAttribute("item-id")||""}get itemTitle(){return this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||""}get itemType(){return this.getAttribute("type")||"task"}get priority(){return this.getAttribute("priority")||"medium"}get status(){return this.getAttribute("status")||"backlog"}get estimate(){return this.getAttribute("estimate")||""}get assignee(){return this.getAttribute("assignee")||""}get storyIds(){let t=this.getAttribute("story-ids")||"";return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}get _detailLevel(){return this.getAttribute("detail")?this.getAttribute("detail"):this.hasAttribute("compact")?"compact":"full"}get _minimalLabel(){return this.itemTitle||this.itemId||"Work item"}updateStatus(t){Ft[t]&&(this.setAttribute("status",t),this.dispatchEvent(new CustomEvent("work-item:status",{detail:{status:t,itemId:this.itemId},bubbles:!0,composed:!0})))}updatePriority(t){Dt[t]&&(this.setAttribute("priority",t),this.dispatchEvent(new CustomEvent("work-item:priority",{detail:{priority:t,itemId:this.itemId},bubbles:!0,composed:!0})))}get data(){return{itemId:this.itemId||void 0,type:this.itemType,priority:this.priority,status:this.status,estimate:this.estimate||void 0,assignee:this.assignee||void 0,storyIds:this.storyIds.length?this.storyIds:void 0,detail:this.getAttribute("detail")||void 0,title:this.itemTitle||void 0}}set data(t){!t||typeof t!="object"||(this._applyData(t),this.shadowRoot&&this.#r(),this.dispatchEvent(new CustomEvent("work-item:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0})))}_applyData(t){for(let[e,r]of[["itemId","item-id"],["type","type"],["priority","priority"],["status","status"],["estimate","estimate"],["assignee","assignee"],["detail","detail"]])t[e]!=null&&this.setAttribute(r,String(t[e]));if(t.storyIds&&this.setAttribute("story-ids",Array.isArray(t.storyIds)?t.storyIds.join(","):String(t.storyIds)),t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h3");e.slot="title",e.textContent=String(t.title),this.appendChild(e)}for(let e of["description","notes"])if(t[e]&&!this.querySelector(`[slot="${e}"]`)){let r=document.createElement("p");r.slot=e,r.textContent=String(t[e]),this.appendChild(r)}if(t.checklist&&!this.querySelector('[slot="checklist"]')){let e=document.createElement("ul");e.slot="checklist";let r=Array.isArray(t.checklist)?t.checklist:[t.checklist];for(let a of r){let s=document.createElement("li");s.textContent=String(a),e.appendChild(s)}this.appendChild(e)}}async _loadSrc(t){if(!t)return;let e=this.shadowRoot;e.innerHTML=`<style>${K}</style><div class="state-msg">Loading\u2026</div>`;try{let r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}`);let a=await r.json();this._applyData(a),this.#r()}catch(r){e.innerHTML=`<style>${K}</style><div class="state-msg state-msg--error">Could not load: ${m(r.message)}</div>`}}#r(){let t=this.shadowRoot,e=Dt[this.priority]||Dt.medium,r=Ft[this.status]||Ft.backlog,a=this.itemType,s=he[a]||he.task,i=this._detailLevel,o=this.itemId?`Work item: ${m(this.itemId)}`:"Work item";if(i==="minimal"){t.innerHTML=`<style>${K}</style>
|
|
2677
|
+
<article class="wi-card wi-card--minimal" role="article" aria-label="${o}"
|
|
2678
2678
|
tabindex="0">
|
|
2679
2679
|
<div class="wi-body">
|
|
2680
2680
|
<div class="wi-meta">
|
|
@@ -2686,7 +2686,7 @@ var re=`
|
|
|
2686
2686
|
</div>
|
|
2687
2687
|
</div>
|
|
2688
2688
|
</article>`;return}if(t.innerHTML=`<style>${K}</style>
|
|
2689
|
-
<article class="wi-card wi-card--${i}" role="article" aria-label="${
|
|
2689
|
+
<article class="wi-card wi-card--${i}" role="article" aria-label="${o}">
|
|
2690
2690
|
|
|
2691
2691
|
<header class="wi-header">
|
|
2692
2692
|
<div class="wi-meta">
|
|
@@ -3156,7 +3156,7 @@ var re=`
|
|
|
3156
3156
|
</div>
|
|
3157
3157
|
</div>
|
|
3158
3158
|
|
|
3159
|
-
</article>`,r==="compact")for(let i of t.querySelectorAll(".adr-section")){let n=i.querySelector("slot");n&&n.assignedNodes().length===0&&i.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("adr-wc:ready",{detail:{adrId:this.adrId,title:this.adrTitle,status:this.status},bubbles:!0,composed:!0}))}};w("adr-wc",Bt);function fe(o,t,e){let r=W(o?.sprintCount)>0?W(o.sprintCount)*(W(o.sprintWeeks)||1):W(o?.sprintWeeks),a=W(t?.teamFTE),s=nr(W(e),0,1);return!(r>0)||!(a>0)||!(s>0)?0:Math.ceil(r*a*s)}function or(o){let t=2166136261;for(let e=0;e<o.length;e++)t^=o.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Ht(o){return o===null||typeof o!="object"?JSON.stringify(o):Array.isArray(o)?"["+o.map(Ht).join(",")+"]":"{"+Object.keys(o).sort().map(e=>JSON.stringify(e)+":"+Ht(o[e])).join(",")+"}"}function be({time:o,cost:t,scope:e}){return or(Ht({time:o||{},cost:t||{},scope:e||{}}))}function W(o){if(o===""||o==null)return 0;let t=Number(o);return Number.isFinite(t)?t:0}function nr(o,t,e){return Math.max(t,Math.min(e,o))}function cr({time:o={},cost:t={},scope:e={}}={}){return{t:P(o.sprintCount,1)*P(o.sprintWeeks,1),c:P(t.teamFTE,0)*P(t.hoursPerWeek,40),s:P(e.mustHaveCount,0)+.5*P(e.shouldHaveCount,0)}}function lr(o){let t=[o.t,o.c,o.s].filter(a=>a>0);if(t.length===0)return{time:1,cost:1,scope:1};let e=Math.max(...t),r=a=>a<=0?.55:.55+(1.45-.55)*(a/e);return{time:r(o.t),cost:r(o.c),scope:r(o.s)}}function Ut(o,t=80){let e={scope:-Math.PI/2,time:5*Math.PI/6,cost:Math.PI/6},r=lr(cr(o)),a=s=>({x:Math.cos(e[s])*t*r[s],y:Math.sin(e[s])*t*r[s],factor:r[s]});return{scope:a("scope"),time:a("time"),cost:a("cost")}}function dr(o={}){let t=P(o.sprintCount,0),e=P(o.sprintWeeks,0);if(t>0&&e>0){let r=t*e;return t>1?`${r} weeks (${t} \xD7 ${e}wk)`:`${r} week${r===1?"":"s"}`}return e>0?`${e} week${e===1?"":"s"}`:o.deadline?`until ${o.deadline}`:"TBD"}function ur(o={}){let t=Number(o.teamFTE),e=o.budgetTier,r=[];return Number.isFinite(t)&&t>0&&r.push(`${t} FTE`),e&&e!=="unset"&&r.push(e),r.length>0?r.join(" \xB7 "):"TBD"}function pr(o={}){let t=P(o.mustHaveCount,0),e=P(o.shouldHaveCount,0);return t>0&&e>0?`${t} must \xB7 ${e} should`:t>0?`${t} must-have`:e>0?`${e} should-have`:"TBD"}function ge(o){return typeof o=="string"&&o.trim().length>0?o:"TBD \u2014 click to set"}var q="http://www.w3.org/2000/svg",hr={scope:{dx:0,dy:-22,anchor:"middle"},time:{dx:-10,dy:14,anchor:"end"},cost:{dx:10,dy:14,anchor:"start"}},mr={scope:{dx:0,dy:-8,anchor:"middle"},time:{dx:-10,dy:28,anchor:"end"},cost:{dx:10,dy:28,anchor:"start"}},fr={scope:{name:"Scope",unit:"# features / story points"},time:{name:"Time",unit:"hours / days / weeks"},cost:{name:"Cost",unit:"FTE / $"}};function ve({value:o={},vertices:t,capacityPoints:e=0,capacitySource:r="formula",qualitySummary:a=""}={}){let s=t||Ut(o),i=document.createElementNS(q,"svg");i.setAttribute("viewBox","-220 -170 440 340"),i.setAttribute("role","group"),i.setAttribute("aria-label",`Project shape: ${e||0} capacity points. Click each corner to edit, or the center to open the quality compass.`);let n=document.createElementNS(q,"polygon");n.setAttribute("class","triangle"),n.setAttribute("points",[`${L(s.scope.x)},${L(s.scope.y)}`,`${L(s.time.x)},${L(s.time.y)}`,`${L(s.cost.x)},${L(s.cost.y)}`].join(" ")),i.append(n);let c=document.createElementNS(q,"g");c.setAttribute("class","center"),c.setAttribute("data-target","quality"),c.setAttribute("tabindex","0"),c.setAttribute("role","button"),c.setAttribute("aria-label",`Quality \u2014 ${ge(a)}. Activate to open the NFR compass.`);let d=document.createElementNS(q,"circle");d.setAttribute("class","capacity-backdrop"),d.setAttribute("cx","0"),d.setAttribute("cy","4"),d.setAttribute("r","32"),c.append(d);let l=document.createElementNS(q,"rect");l.setAttribute("class","hit"),l.setAttribute("x","-36"),l.setAttribute("y","-30"),l.setAttribute("width","72"),l.setAttribute("height","68"),l.setAttribute("rx","34"),c.append(l);let u=document.createElementNS(q,"text");u.setAttribute("class","quality-label"),u.setAttribute("x","0"),u.setAttribute("y","-15"),u.setAttribute("text-anchor","middle"),u.textContent="Quality",c.append(u);let p=document.createElementNS(q,"text");p.setAttribute("class","capacity"),p.setAttribute("x","0"),p.setAttribute("y","7"),p.setAttribute("text-anchor","middle"),p.setAttribute("dominant-baseline","middle"),p.textContent=e>0?String(e):"\u2014",c.append(p);let h=document.createElementNS(q,"text");h.setAttribute("class","capacity-unit"),h.setAttribute("x","0"),h.setAttribute("y","26"),h.setAttribute("text-anchor","middle"),h.textContent=r==="manual"?"pts (manual)":"pts",c.append(h);let f=document.createElementNS(q,"title");f.textContent=ge(a),c.append(f),i.append(c);for(let b of["scope","time","cost"])i.append(br(b,s[b],o));return i}function br(o,t,e){let r=hr[o],a=mr[o],s=fr[o],i=o==="scope"?pr(e.scope):o==="cost"?ur(e.cost):dr(e.time),n=document.createElementNS(q,"g");n.setAttribute("class","vertex"),n.setAttribute("data-axis",o),n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label",`${s.name} \u2014 ${i}. Activate to edit.`);let c=document.createElementNS(q,"rect");c.setAttribute("class","hit");let d=160,l=50,u;r.anchor==="end"?u=t.x-d+6:r.anchor==="start"?u=t.x-6:u=t.x-d/2;let p=o==="scope"?t.y-l+6:t.y-6;c.setAttribute("x",String(L(u))),c.setAttribute("y",String(L(p))),c.setAttribute("width",String(d)),c.setAttribute("height",String(l)),c.setAttribute("rx","6"),n.append(c);let h=document.createElementNS(q,"text");h.setAttribute("class","vertex-name"),h.setAttribute("x",String(L(t.x+r.dx))),h.setAttribute("y",String(L(t.y+r.dy))),h.setAttribute("text-anchor",r.anchor),h.textContent=s.name,n.append(h);let f=document.createElementNS(q,"text");f.setAttribute("class","vertex-summary"),f.setAttribute("x",String(L(t.x+a.dx))),f.setAttribute("y",String(L(t.y+a.dy))),f.setAttribute("text-anchor",a.anchor),f.textContent=i,n.append(f);let b=document.createElementNS(q,"title");return b.textContent=`${s.name}: ${i} \u2014 ${s.unit}`,n.append(b),n}function P(o,t){if(o===""||o==null)return t;let e=Number(o);return Number.isFinite(e)&&e>0?e:t}function L(o){return Math.round(o*100)/100}var lt=["time","cost","scope"],dt={time:[{key:"sprintWeeks",label:"Sprint length (weeks)",type:"number",min:1,step:1,value:2,width:"6rem"},{key:"sprintCount",label:"Number of sprints",type:"number",min:1,step:1,value:3,width:"6rem"},{key:"hoursPerWeek",label:"Hours per week (per FTE)",type:"number",min:1,max:168,step:1,value:40,width:"6rem"},{key:"deadline",label:"Deadline (optional)",type:"date",width:"12rem"}],cost:[{key:"teamFTE",label:"Team size (FTE)",type:"number",min:0,step:.5,value:1,width:"6rem"},{key:"budgetTier",label:"Budget tier",type:"select",options:[["solo","Solo"],["small","Small (2-5)"],["medium","Medium (6-15)"],["large","Large (16+)"]],value:"solo",width:"14rem"},{key:"contractorBudget",label:"Contractor budget ($, optional)",type:"number",min:0,step:100,width:"10rem"}],scope:[{key:"mustHaveCount",label:"Must-have feature count",type:"number",min:0,step:1,width:"6rem"},{key:"shouldHaveCount",label:"Should-have feature count",type:"number",min:0,step:1,width:"6rem"},{key:"scopeNotes",label:"Notes",type:"textarea",rows:3,maxlength:2e3}]},ye={scope:"Scope",time:"Time",cost:"Cost"},Vt=class extends C{static formAssociated=!0;static get observedAttributes(){return["data-focus-factor","data-min-capacity","data-quality-href","data-quality-summary","disabled","locked"]}#e;#t={time:{},cost:{},scope:{},capacityPoints:0,capacitySource:"formula",hash:""};#r=null;#a=[];#s="";#o={};constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){this.#s=this.getAttribute("data-quality-summary")||"",this.#f(),this.#m(),this.listen(this,"click",t=>this.#i(t)),this.listen(this,"keydown",t=>this.#n(t))}attributeChangedCallback(t){this.isConnected&&(t==="data-focus-factor"||t==="data-min-capacity"?this.#u({source:"attribute"}):t==="data-quality-summary"?(this.#s=this.getAttribute("data-quality-summary")||"",this.#m()):(t==="disabled"||t==="locked")&&this.#v())}get value(){return JSON.parse(JSON.stringify({...this.#t,revisionLog:this.#a}))}set value(t){if(!(!t||typeof t!="object")){for(let e of lt)t[e]&&typeof t[e]=="object"&&(this.#t[e]={...t[e]});t.capacitySource==="manual"&&Number.isFinite(t.capacityPoints)?(this.#r=t.capacityPoints,this.#t.capacitySource="manual"):(this.#r=null,this.#t.capacitySource="formula"),Array.isArray(t.revisionLog)&&(this.#a=[...t.revisionLog]),this.#d(),this.#u({source:"property"})}}get capacityPoints(){return this.#t.capacityPoints}get capacitySource(){return this.#t.capacitySource}get hash(){return this.#t.hash}get revisionLog(){return JSON.parse(JSON.stringify(this.#a))}get qualitySummary(){return this.#s}set qualitySummary(t){this.#s=String(t??""),this.#m()}openEditor(t){if(!lt.includes(t))return;let e=this.#l(t);typeof e.showModal=="function"?e.showModal():e.setAttribute("open","")}revise(t,e,r){if(!t||typeof r!="string"||r.length<10)throw new Error("iron-triangle: revise() requires field and a reason of at least 10 characters");let a=this.#y(t);this.#g(t,e);let s={field:t,from:a,to:e,reason:r};this.#a.push({revisedAt:new Date().toISOString(),changes:[s]}),this.dispatchEvent(new CustomEvent("iron-triangle:revise",{bubbles:!0,composed:!0,detail:s})),this.#d(),this.#u({source:"revise"})}setManual(t){let e=Math.max(1,Math.floor(Number(t)||0));this.#r=e;let r=this.#t.capacitySource;this.#t.capacitySource="manual",r!=="manual"&&this.dispatchEvent(new CustomEvent("iron-triangle:mode",{bubbles:!0,composed:!0,detail:{from:r,to:"manual"}})),this.setState("manual",!0),this.setState("formula",!1),this.#u({source:"manual"})}setFormula(){this.#r=null;let t=this.#t.capacitySource;this.#t.capacitySource="formula",t!=="formula"&&this.dispatchEvent(new CustomEvent("iron-triangle:mode",{bubbles:!0,composed:!0,detail:{from:t,to:"formula"}})),this.setState("manual",!1),this.setState("formula",!0),this.#u({source:"formula"})}recalc(){this.#u({source:"recalc"})}#i(t){let e=t.target.closest?.(".vertex[data-axis]");if(e&&this.contains(e)){t.preventDefault(),this.openEditor(e.dataset.axis);return}let r=t.target.closest?.('.center[data-target="quality"]');r&&this.contains(r)&&(t.preventDefault(),this.#c())}#n(t){if(t.key!=="Enter"&&t.key!==" ")return;let e=t.target.closest?.(".vertex[data-axis]");if(e&&this.contains(e)){t.preventDefault(),this.openEditor(e.dataset.axis);return}let r=t.target.closest?.('.center[data-target="quality"]');r&&this.contains(r)&&(t.preventDefault(),this.#c())}#c(){let t=new CustomEvent("iron-triangle:open-quality",{bubbles:!0,composed:!0,cancelable:!0,detail:{qualitySummary:this.#s,capacityPoints:this.#t.capacityPoints}});if(this.dispatchEvent(t)){let r=this.getAttribute("data-quality-href");r&&window.location.assign(r)}}#l(t){if(this.#o[t])return this.#o[t];let e=document.createElement("dialog");e.className=`iron-triangle-dialog iron-triangle-dialog--${t}`,e.setAttribute("aria-label",`${ye[t]} \u2014 edit`);let r=document.createElement("form");r.method="dialog",r.setAttribute("data-layout","stack"),r.setAttribute("data-layout-gap","m");let a=document.createElement("h3");a.textContent=ye[t],r.append(a);for(let c of dt[t])r.append(gr(t,c,this.#t[t]?.[c.key]));let s=document.createElement("div");s.setAttribute("data-layout","cluster"),s.setAttribute("data-layout-gap","s"),s.setAttribute("data-layout-justify","end");let i=document.createElement("button");i.type="button",i.value="cancel",i.textContent="Cancel",i.addEventListener("click",()=>e.close("cancel"));let n=document.createElement("button");return n.type="submit",n.value="save",n.textContent="Save",s.append(i,n),r.append(s),e.append(r),this.append(e),this.#o[t]=e,r.addEventListener("submit",c=>{c.preventDefault(),this.#p(t,r),e.close("save"),this.#u({source:"dialog",field:t})}),e}#p(t,e){let r={};for(let a of dt[t]){let s=e.querySelector(`[name="${t}.${a.key}"]`);if(!s)continue;let i=s.type==="checkbox"?s.checked:s.value;if(!(i===""||i==null))if(a.type==="number"){let n=Number(i);Number.isFinite(n)&&(r[a.key]=n)}else r[a.key]=i}this.#t[t]=r}#d(){for(let t of lt){let e=this.#o[t];if(e)for(let r of dt[t]){let a=e.querySelector(`[name="${t}.${r.key}"]`);if(!a)continue;let s=this.#t[t]?.[r.key];a.value=s==null?"":String(s)}}}#f(){for(let t of lt)for(let e of dt[t])e.value!==void 0&&this.#t[t][e.key]===void 0&&(this.#t[t][e.key]=e.value);this.#u({source:"init"})}#u({source:t,field:e}={}){let r=Number(this.dataset.focusFactor??.6),a=Number(this.dataset.minCapacity??1),s;this.#t.capacitySource==="manual"&&this.#r!=null?s=this.#r:s=fe(this.#t.time,this.#t.cost,r),Number.isFinite(a)&&s>0&&s<a&&(s=a),this.#t.capacityPoints=s,this.#t.hash=be(this.#t),this.#m(),this.#h(),this.#b(),this.dispatchEvent(new CustomEvent("iron-triangle:change",{bubbles:!0,composed:!0,detail:{...this.value,source:t,field:e}}))}#m(){let t=ve({value:this.#t,vertices:Ut(this.#t),capacityPoints:this.#t.capacityPoints,capacitySource:this.#t.capacitySource,qualitySummary:this.#s}),e=this.querySelector(":scope > svg");e?e.replaceWith(t):this.prepend(t),this.dataset.capacityPoints=String(this.#t.capacityPoints),this.dataset.capacitySource=this.#t.capacitySource}#h(){this.setState("formula",this.#t.capacitySource==="formula"),this.setState("manual",this.#t.capacitySource==="manual"),this.setState("unbudgeted",!(this.#t.capacityPoints>0));let t=this.#t.time?.deadline,e=!1;if(t){let r=new Date(t).getTime();Number.isFinite(r)&&(e=r<Date.now())}this.setState("over-deadline",e)}#b(){try{this.#e.setFormValue(JSON.stringify(this.value))}catch{}}#v(){let t=this.hasAttribute("disabled")||this.hasAttribute("locked");for(let e of Object.values(this.#o))for(let r of e.querySelectorAll("input, select, textarea, button"))r.disabled=t}#y(t){if(t==="capacityPoints")return this.#t.capacityPoints;let[e,r]=t.split(".");return e&&r?this.#t[e]?.[r]:void 0}#g(t,e){if(t==="capacityPoints"){this.setManual(e);return}let[r,a]=t.split(".");!r||!a||(this.#t[r]||(this.#t[r]={}),this.#t[r][a]=e)}};function gr(o,t,e){let r=document.createElement("form-field"),a=`${o}-${t.key}`,s=document.createElement("label");s.setAttribute("for",a),s.textContent=t.label,r.append(s);let i;if(t.type==="select"){i=document.createElement("select");for(let[n,c]of t.options){let d=document.createElement("option");d.value=n,d.textContent=c,(e===n||e==null&&t.value===n)&&(d.selected=!0),i.append(d)}}else t.type==="textarea"?(i=document.createElement("textarea"),t.rows&&(i.rows=t.rows),t.maxlength&&(i.maxLength=t.maxlength),e!=null&&(i.value=String(e))):(i=document.createElement("input"),i.type=t.type,t.min!=null&&(i.min=String(t.min)),t.max!=null&&(i.max=String(t.max)),t.step!=null&&(i.step=String(t.step)),e!=null?i.value=String(e):t.value!=null&&(i.value=String(t.value)));return i.id=a,i.name=`${o}.${t.key}`,t.width&&(i.style.inlineSize=t.width),r.append(i),r}w("iron-triangle",Vt);function vr(o){if(!o)return 0;let t=o.dataset?.capacityCost??o.getAttribute?.("data-capacity-cost"),e=Number(t);return Number.isFinite(e)&&e>0?e:0}function xe(o){let t=0;for(let e of o||[])t+=vr(e);return t}function Wt({capacityPoints:o,qualitySum:t,featureSum:e}){let r=Number.isFinite(o)?o:1/0,a=Math.max(0,Number(t)||0),s=Math.max(0,Number(e)||0),i=Number.isFinite(r)?r-a-s:1/0;return{capacity:r,quality:a,features:s,slack:i}}function _e({capacity:o,quality:t,features:e}){if(!Number.isFinite(o)||o<=0){let s=t+e;return s<=0?{quality:0,features:0,slack:100}:{quality:t/s*100,features:e/s*100,slack:0}}let r=t+e,a=Math.max(o,r);return{quality:t/a*100,features:e/a*100,slack:Math.max(0,(o-r)/a*100)}}var Qt=class extends C{static get observedAttributes(){return["data-bind-triangle","data-bind-quality"]}#e=null;#t=null;#r=null;#a=null;#s=!1;setup(){this.#i(),this.#n(),this.#c(),this.#d()}teardown(){this.#e?.(),this.#t?.(),this.#r?.disconnect(),this.#e=null,this.#t=null,this.#r=null}attributeChangedCallback(t){this.isConnected&&(t==="data-bind-triangle"?(this.#i(),this.#d()):t==="data-bind-quality"&&(this.#n(),this.#d()))}get capacityPoints(){return this.#l()}get qualitySum(){return this.#p()}get featureSum(){return this.#a!=null?this.#a:xe(this.querySelectorAll("[data-capacity-cost]"))}set featureSum(t){this.#a=Number.isFinite(+t)?+t:null,this.#d()}get slack(){return Wt({capacityPoints:this.#l(),qualitySum:this.#p(),featureSum:this.featureSum}).slack}#o(t){if(!t)return null;let e=this.getRootNode();return e.getElementById?e.getElementById(t):document.getElementById(t)}#i(){this.#e?.(),this.#e=null;let t=this.#o(this.dataset.bindTriangle);if(!t||t.localName!=="iron-triangle")return;let e=()=>this.#d();t.addEventListener("iron-triangle:change",e),this.#e=()=>t.removeEventListener("iron-triangle:change",e)}#n(){this.#t?.(),this.#t=null;let t=this.#o(this.dataset.bindQuality);if(!t||t.localName!=="quality-target")return;let e=()=>this.#d();t.addEventListener("quality-target:change",e),this.#t=()=>t.removeEventListener("quality-target:change",e)}#c(){this.#r||(this.#r=new MutationObserver(t=>{t.some(r=>!r.target.closest?.("[data-capacity-table]"))&&this.#d()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-capacity-cost"]}))}#l(){let t=this.#o(this.dataset.bindTriangle);if(!t||t.localName!=="iron-triangle")return 1/0;let e=t.capacityPoints;return Number.isFinite(e)&&e>0?e:1/0}#p(){let t=this.#o(this.dataset.bindQuality);return!t||t.localName!=="quality-target"?0:Number(t.criticalSum)||0}#d(){let t=Wt({capacityPoints:this.#l(),qualitySum:this.#p(),featureSum:this.featureSum}),e=_e(t),r=this.querySelector(":scope > [data-capacity-table]");r||(r=document.createElement("section"),r.dataset.capacityTable="",this.prepend(r));let a=yr(t.capacity),s=t.quality>0?`\u2212${t.quality} pts`:"0 pts",i=t.features>0?`\u2212${t.features} pts`:"0 pts",n=xr(t.slack);r.innerHTML=`
|
|
3159
|
+
</article>`,r==="compact")for(let i of t.querySelectorAll(".adr-section")){let o=i.querySelector("slot");o&&o.assignedNodes().length===0&&i.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("adr-wc:ready",{detail:{adrId:this.adrId,title:this.adrTitle,status:this.status},bubbles:!0,composed:!0}))}};w("adr-wc",Bt);function fe(n,t,e){let r=W(n?.sprintCount)>0?W(n.sprintCount)*(W(n.sprintWeeks)||1):W(n?.sprintWeeks),a=W(t?.teamFTE),s=cr(W(e),0,1);return!(r>0)||!(a>0)||!(s>0)?0:Math.ceil(r*a*s)}function or(n){let t=2166136261;for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Ht(n){return n===null||typeof n!="object"?JSON.stringify(n):Array.isArray(n)?"["+n.map(Ht).join(",")+"]":"{"+Object.keys(n).sort().map(e=>JSON.stringify(e)+":"+Ht(n[e])).join(",")+"}"}function be({time:n,cost:t,scope:e}){return or(Ht({time:n||{},cost:t||{},scope:e||{}}))}function W(n){if(n===""||n==null)return 0;let t=Number(n);return Number.isFinite(t)?t:0}function cr(n,t,e){return Math.max(t,Math.min(e,n))}function lr({time:n={},cost:t={},scope:e={}}={}){return{t:P(n.sprintCount,1)*P(n.sprintWeeks,1),c:P(t.teamFTE,0)*P(t.hoursPerWeek,40),s:P(e.mustHaveCount,0)+.5*P(e.shouldHaveCount,0)}}function dr(n){let t=[n.t,n.c,n.s].filter(a=>a>0);if(t.length===0)return{time:1,cost:1,scope:1};let e=Math.max(...t),r=a=>a<=0?.55:.55+(1.45-.55)*(a/e);return{time:r(n.t),cost:r(n.c),scope:r(n.s)}}function Ut(n,t=80){let e={scope:-Math.PI/2,time:5*Math.PI/6,cost:Math.PI/6},r=dr(lr(n)),a=s=>({x:Math.cos(e[s])*t*r[s],y:Math.sin(e[s])*t*r[s],factor:r[s]});return{scope:a("scope"),time:a("time"),cost:a("cost")}}function ur(n={}){let t=P(n.sprintCount,0),e=P(n.sprintWeeks,0);if(t>0&&e>0){let r=t*e;return t>1?`${r} weeks (${t} \xD7 ${e}wk)`:`${r} week${r===1?"":"s"}`}return e>0?`${e} week${e===1?"":"s"}`:n.deadline?`until ${n.deadline}`:"TBD"}function pr(n={}){let t=Number(n.teamFTE),e=n.budgetTier,r=[];return Number.isFinite(t)&&t>0&&r.push(`${t} FTE`),e&&e!=="unset"&&r.push(e),r.length>0?r.join(" \xB7 "):"TBD"}function hr(n={}){let t=P(n.mustHaveCount,0),e=P(n.shouldHaveCount,0);return t>0&&e>0?`${t} must \xB7 ${e} should`:t>0?`${t} must-have`:e>0?`${e} should-have`:"TBD"}function ge(n){return typeof n=="string"&&n.trim().length>0?n:"TBD \u2014 click to set"}var q="http://www.w3.org/2000/svg",mr={scope:{dx:0,dy:-22,anchor:"middle"},time:{dx:-10,dy:14,anchor:"end"},cost:{dx:10,dy:14,anchor:"start"}},fr={scope:{dx:0,dy:-8,anchor:"middle"},time:{dx:-10,dy:28,anchor:"end"},cost:{dx:10,dy:28,anchor:"start"}},br={scope:{name:"Scope",unit:"# features / story points"},time:{name:"Time",unit:"hours / days / weeks"},cost:{name:"Cost",unit:"FTE / $"}};function ve({value:n={},vertices:t,capacityPoints:e=0,capacitySource:r="formula",qualitySummary:a=""}={}){let s=t||Ut(n),i=document.createElementNS(q,"svg");i.setAttribute("viewBox","-220 -170 440 340"),i.setAttribute("role","group"),i.setAttribute("aria-label",`Project shape: ${e||0} capacity points. Click each corner to edit, or the center to open the quality compass.`);let o=document.createElementNS(q,"polygon");o.setAttribute("class","triangle"),o.setAttribute("points",[`${L(s.scope.x)},${L(s.scope.y)}`,`${L(s.time.x)},${L(s.time.y)}`,`${L(s.cost.x)},${L(s.cost.y)}`].join(" ")),i.append(o);let c=document.createElementNS(q,"g");c.setAttribute("class","center"),c.setAttribute("data-target","quality"),c.setAttribute("tabindex","0"),c.setAttribute("role","button"),c.setAttribute("aria-label",`Quality \u2014 ${ge(a)}. Activate to open the NFR compass.`);let d=document.createElementNS(q,"circle");d.setAttribute("class","capacity-backdrop"),d.setAttribute("cx","0"),d.setAttribute("cy","4"),d.setAttribute("r","32"),c.append(d);let l=document.createElementNS(q,"rect");l.setAttribute("class","hit"),l.setAttribute("x","-36"),l.setAttribute("y","-30"),l.setAttribute("width","72"),l.setAttribute("height","68"),l.setAttribute("rx","34"),c.append(l);let u=document.createElementNS(q,"text");u.setAttribute("class","quality-label"),u.setAttribute("x","0"),u.setAttribute("y","-15"),u.setAttribute("text-anchor","middle"),u.textContent="Quality",c.append(u);let p=document.createElementNS(q,"text");p.setAttribute("class","capacity"),p.setAttribute("x","0"),p.setAttribute("y","7"),p.setAttribute("text-anchor","middle"),p.setAttribute("dominant-baseline","middle"),p.textContent=e>0?String(e):"\u2014",c.append(p);let h=document.createElementNS(q,"text");h.setAttribute("class","capacity-unit"),h.setAttribute("x","0"),h.setAttribute("y","26"),h.setAttribute("text-anchor","middle"),h.textContent=r==="manual"?"pts (manual)":"pts",c.append(h);let f=document.createElementNS(q,"title");f.textContent=ge(a),c.append(f),i.append(c);for(let b of["scope","time","cost"])i.append(gr(b,s[b],n));return i}function gr(n,t,e){let r=mr[n],a=fr[n],s=br[n],i=n==="scope"?hr(e.scope):n==="cost"?pr(e.cost):ur(e.time),o=document.createElementNS(q,"g");o.setAttribute("class","vertex"),o.setAttribute("data-axis",n),o.setAttribute("tabindex","0"),o.setAttribute("role","button"),o.setAttribute("aria-label",`${s.name} \u2014 ${i}. Activate to edit.`);let c=document.createElementNS(q,"rect");c.setAttribute("class","hit");let d=160,l=50,u;r.anchor==="end"?u=t.x-d+6:r.anchor==="start"?u=t.x-6:u=t.x-d/2;let p=n==="scope"?t.y-l+6:t.y-6;c.setAttribute("x",String(L(u))),c.setAttribute("y",String(L(p))),c.setAttribute("width",String(d)),c.setAttribute("height",String(l)),c.setAttribute("rx","6"),o.append(c);let h=document.createElementNS(q,"text");h.setAttribute("class","vertex-name"),h.setAttribute("x",String(L(t.x+r.dx))),h.setAttribute("y",String(L(t.y+r.dy))),h.setAttribute("text-anchor",r.anchor),h.textContent=s.name,o.append(h);let f=document.createElementNS(q,"text");f.setAttribute("class","vertex-summary"),f.setAttribute("x",String(L(t.x+a.dx))),f.setAttribute("y",String(L(t.y+a.dy))),f.setAttribute("text-anchor",a.anchor),f.textContent=i,o.append(f);let b=document.createElementNS(q,"title");return b.textContent=`${s.name}: ${i} \u2014 ${s.unit}`,o.append(b),o}function P(n,t){if(n===""||n==null)return t;let e=Number(n);return Number.isFinite(e)&&e>0?e:t}function L(n){return Math.round(n*100)/100}var lt=["time","cost","scope"],dt={time:[{key:"sprintWeeks",label:"Sprint length (weeks)",type:"number",min:1,step:1,value:2,width:"6rem"},{key:"sprintCount",label:"Number of sprints",type:"number",min:1,step:1,value:3,width:"6rem"},{key:"hoursPerWeek",label:"Hours per week (per FTE)",type:"number",min:1,max:168,step:1,value:40,width:"6rem"},{key:"deadline",label:"Deadline (optional)",type:"date",width:"12rem"}],cost:[{key:"teamFTE",label:"Team size (FTE)",type:"number",min:0,step:.5,value:1,width:"6rem"},{key:"budgetTier",label:"Budget tier",type:"select",options:[["solo","Solo"],["small","Small (2-5)"],["medium","Medium (6-15)"],["large","Large (16+)"]],value:"solo",width:"14rem"},{key:"contractorBudget",label:"Contractor budget ($, optional)",type:"number",min:0,step:100,width:"10rem"}],scope:[{key:"mustHaveCount",label:"Must-have feature count",type:"number",min:0,step:1,width:"6rem"},{key:"shouldHaveCount",label:"Should-have feature count",type:"number",min:0,step:1,width:"6rem"},{key:"scopeNotes",label:"Notes",type:"textarea",rows:3,maxlength:2e3}]},ye={scope:"Scope",time:"Time",cost:"Cost"},Vt=class extends C{static formAssociated=!0;static get observedAttributes(){return["data-focus-factor","data-min-capacity","data-quality-href","data-quality-summary","disabled","locked"]}#e;#t={time:{},cost:{},scope:{},capacityPoints:0,capacitySource:"formula",hash:""};#r=null;#a=[];#s="";#n={};#i=null;#o=null;#c=null;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){this.#s=this.getAttribute("data-quality-summary")||"",this.#g(),this.#y(),this.#h(),this.#C(),this.listen(this,"click",t=>this.#p(t)),this.listen(this,"keydown",t=>this.#l(t))}attributeChangedCallback(t){this.isConnected&&(t==="data-focus-factor"||t==="data-min-capacity"?this.#d({source:"attribute"}):t==="data-quality-summary"?(this.#s=this.getAttribute("data-quality-summary")||"",this.#h()):(t==="disabled"||t==="locked")&&this.#A())}get value(){return JSON.parse(JSON.stringify({...this.#t,revisionLog:this.#a}))}set value(t){if(!(!t||typeof t!="object")){for(let e of lt)t[e]&&typeof t[e]=="object"&&(this.#t[e]={...t[e]});t.capacitySource==="manual"&&Number.isFinite(t.capacityPoints)?(this.#r=t.capacityPoints,this.#t.capacitySource="manual"):(this.#r=null,this.#t.capacitySource="formula"),Array.isArray(t.revisionLog)&&(this.#a=[...t.revisionLog]),this.#f(),this.#d({source:"property"})}}get capacityPoints(){return this.#t.capacityPoints}get capacitySource(){return this.#t.capacitySource}get hash(){return this.#t.hash}get revisionLog(){return JSON.parse(JSON.stringify(this.#a))}get qualitySummary(){return this.#s}set qualitySummary(t){this.#s=String(t??""),this.#h()}openEditor(t){if(!lt.includes(t))return;let e=this.#m(t);typeof e.showModal=="function"?e.showModal():e.setAttribute("open","")}revise(t,e,r){if(!t||typeof r!="string"||r.length<10)throw new Error("iron-triangle: revise() requires field and a reason of at least 10 characters");let a=this.#k(t);this.#q(t,e);let s={field:t,from:a,to:e,reason:r};this.#a.push({revisedAt:new Date().toISOString(),changes:[s]}),this.dispatchEvent(new CustomEvent("iron-triangle:revise",{bubbles:!0,composed:!0,detail:s})),this.#f(),this.#d({source:"revise"})}setManual(t){let e=Math.max(1,Math.floor(Number(t)||0));this.#r=e;let r=this.#t.capacitySource;this.#t.capacitySource="manual",r!=="manual"&&this.dispatchEvent(new CustomEvent("iron-triangle:mode",{bubbles:!0,composed:!0,detail:{from:r,to:"manual"}})),this.setState("manual",!0),this.setState("formula",!1),this.#d({source:"manual"})}setFormula(){this.#r=null;let t=this.#t.capacitySource;this.#t.capacitySource="formula",t!=="formula"&&this.dispatchEvent(new CustomEvent("iron-triangle:mode",{bubbles:!0,composed:!0,detail:{from:t,to:"formula"}})),this.setState("manual",!1),this.setState("formula",!0),this.#d({source:"formula"})}recalc(){this.#d({source:"recalc"})}#p(t){let e=t.target.closest?.(".vertex[data-axis]");if(e&&this.contains(e)){t.preventDefault(),this.openEditor(e.dataset.axis);return}let r=t.target.closest?.('.center[data-target="quality"]');r&&this.contains(r)&&(t.preventDefault(),this.#u())}#l(t){if(t.key!=="Enter"&&t.key!==" ")return;let e=t.target.closest?.(".vertex[data-axis]");if(e&&this.contains(e)){t.preventDefault(),this.openEditor(e.dataset.axis);return}let r=t.target.closest?.('.center[data-target="quality"]');r&&this.contains(r)&&(t.preventDefault(),this.#u())}#u(){let t=new CustomEvent("iron-triangle:open-quality",{bubbles:!0,composed:!0,cancelable:!0,detail:{qualitySummary:this.#s,capacityPoints:this.#t.capacityPoints}});if(this.dispatchEvent(t)){let r=this.getAttribute("data-quality-href");r&&window.location.assign(r)}}#m(t){if(this.#n[t])return this.#n[t];let e=document.createElement("dialog");e.className=`iron-triangle-dialog iron-triangle-dialog--${t}`,e.setAttribute("aria-label",`${ye[t]} \u2014 edit`);let r=document.createElement("form");r.method="dialog",r.setAttribute("data-layout","stack"),r.setAttribute("data-layout-gap","m");let a=document.createElement("h3");a.textContent=ye[t],r.append(a);for(let c of dt[t])r.append(xe(t,c,this.#t[t]?.[c.key]));let s=document.createElement("div");s.setAttribute("data-layout","cluster"),s.setAttribute("data-layout-gap","s"),s.setAttribute("data-layout-justify","end");let i=document.createElement("button");i.type="button",i.value="cancel",i.textContent="Cancel",i.addEventListener("click",()=>e.close("cancel"));let o=document.createElement("button");return o.type="submit",o.value="save",o.textContent="Save",s.append(i,o),r.append(s),e.append(r),this.append(e),this.#n[t]=e,r.addEventListener("submit",c=>{c.preventDefault(),this.#x(t,r),e.close("save"),this.#d({source:"dialog",field:t})}),e}#x(t,e){let r={};for(let a of dt[t]){let s=e.querySelector(`[name="${t}.${a.key}"]`);if(!s)continue;let i=s.type==="checkbox"?s.checked:s.value;if(!(i===""||i==null))if(a.type==="number"){let o=Number(i);Number.isFinite(o)&&(r[a.key]=o)}else r[a.key]=i}this.#t[t]=r}#f(){for(let t of lt){let e=this.#n[t];if(e)for(let r of dt[t]){let a=e.querySelector(`[name="${t}.${r.key}"]`);if(!a)continue;let s=this.#t[t]?.[r.key];a.value=s==null?"":String(s)}}}#g(){for(let t of lt)for(let e of dt[t])e.value!==void 0&&this.#t[t][e.key]===void 0&&(this.#t[t][e.key]=e.value);this.#d({source:"init"})}#d({source:t,field:e}={}){let r=Number(this.dataset.focusFactor??.6),a=Number(this.dataset.minCapacity??1),s;this.#t.capacitySource==="manual"&&this.#r!=null?s=this.#r:s=fe(this.#t.time,this.#t.cost,r),Number.isFinite(a)&&s>0&&s<a&&(s=a),this.#t.capacityPoints=s,this.#t.hash=be(this.#t),this.#h(),this.#v(),this.#C(),this.#b(),this.dispatchEvent(new CustomEvent("iron-triangle:change",{bubbles:!0,composed:!0,detail:{...this.value,source:t,field:e}}))}#h(){let t=ve({value:this.#t,vertices:Ut(this.#t),capacityPoints:this.#t.capacityPoints,capacitySource:this.#t.capacitySource,qualitySummary:this.#s}),e=this.querySelector(":scope > svg");e?e.replaceWith(t):this.prepend(t),this.dataset.capacityPoints=String(this.#t.capacityPoints),this.dataset.capacitySource=this.#t.capacitySource}#v(){this.setState("formula",this.#t.capacitySource==="formula"),this.setState("manual",this.#t.capacitySource==="manual"),this.setState("unbudgeted",!(this.#t.capacityPoints>0));let t=this.#t.time?.deadline,e=!1;if(t){let r=new Date(t).getTime();Number.isFinite(r)&&(e=r<Date.now())}this.setState("over-deadline",e)}#b(){try{this.#e.setFormValue(JSON.stringify(this.value))}catch{}}#A(){let t=this.hasAttribute("disabled")||this.hasAttribute("locked");this.#o&&(this.#o.disabled=t);for(let e of Object.values(this.#n))for(let r of e.querySelectorAll("input, select, textarea, button"))r.disabled=t}#y(){if(this.querySelector(":scope > .iron-triangle-status"))return;let t=document.createElement("div");t.className="iron-triangle-status";let e=document.createElement("output");e.className="iron-triangle-readout",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true");let r=document.createElement("button");r.type="button",r.className="iron-triangle-mode",r.setAttribute("aria-pressed","false"),r.textContent="Manual capacity",r.addEventListener("click",()=>this.#_());let a=document.createElement("p");a.className="iron-triangle-warning",a.setAttribute("data-warning","over-deadline"),a.hidden=!0,t.append(e,r,a);let s=this.querySelector(":scope > svg");s?s.after(t):this.prepend(t),this.#i=e,this.#o=r,this.#c=a,this.#A()}#C(){if(!this.#i)return;let{capacityPoints:t,capacitySource:e}=this.#t,r=e==="manual",a=this.#t.time?.deadline,s=this.matches(":state(over-deadline)"),i=[];i.push(t>0?`Capacity: ${t} points (${r?"manual":"formula"}).`:"Capacity: not yet budgeted."),s&&i.push(`Deadline has passed (${a}).`);let o=i.join(" ");this.#i.textContent!==o&&(this.#i.textContent=o),this.#o&&(this.#o.setAttribute("aria-pressed",r?"true":"false"),this.#o.setAttribute("aria-label",r?`Manual capacity: ${t} points. Activate to edit or return to the formula.`:"Manual capacity. Activate to override the formula with a fixed number.")),this.#c&&(this.#c.textContent=s?`Deadline has passed (${a})`:"",this.#c.hidden=!s)}#_(){let t=this.#w(),e=t.querySelector('[name="capacity.points"]');e.value=String(this.#t.capacityPoints>0?this.#t.capacityPoints:1);let r=t.querySelector('button[value="formula"]');r.hidden=this.#t.capacitySource!=="manual",typeof t.showModal=="function"?t.showModal():t.setAttribute("open","")}#w(){if(this.#n.capacity)return this.#n.capacity;let t=document.createElement("dialog");t.className="iron-triangle-dialog iron-triangle-dialog--capacity",t.setAttribute("aria-label","Capacity \u2014 manual override");let e=document.createElement("form");e.method="dialog",e.setAttribute("data-layout","stack"),e.setAttribute("data-layout-gap","m");let r=document.createElement("h3");r.textContent="Manual capacity",e.append(r);let a=document.createElement("p");a.className="iron-triangle-dialog__hint",a.textContent="Fix the capacity to a number the team committed to. The Time / Cost / Scope inputs stay saved but stop driving the readout.",e.append(a),e.append(xe("capacity",{key:"points",label:"Capacity (points)",type:"number",min:1,step:1,width:"6rem"},this.#t.capacityPoints));let s=document.createElement("div");s.setAttribute("data-layout","cluster"),s.setAttribute("data-layout-gap","s"),s.setAttribute("data-layout-justify","end");let i=document.createElement("button");i.type="button",i.value="formula",i.textContent="Use formula",i.addEventListener("click",()=>{t.close("formula"),this.setFormula()});let o=document.createElement("button");o.type="button",o.value="cancel",o.textContent="Cancel",o.addEventListener("click",()=>t.close("cancel"));let c=document.createElement("button");return c.type="submit",c.value="save",c.textContent="Save",s.append(i,o,c),e.append(s),t.append(e),this.append(t),this.#n.capacity=t,e.addEventListener("submit",d=>{d.preventDefault();let l=e.querySelector('[name="capacity.points"]'),u=Number(l.value);t.close("save"),Number.isFinite(u)&&u>0&&this.setManual(u)}),t}#k(t){if(t==="capacityPoints")return this.#t.capacityPoints;let[e,r]=t.split(".");return e&&r?this.#t[e]?.[r]:void 0}#q(t,e){if(t==="capacityPoints"){this.setManual(e);return}let[r,a]=t.split(".");!r||!a||(this.#t[r]||(this.#t[r]={}),this.#t[r][a]=e)}};function xe(n,t,e){let r=document.createElement("form-field"),a=`${n}-${t.key}`,s=document.createElement("label");s.setAttribute("for",a),s.textContent=t.label,r.append(s);let i;if(t.type==="select"){i=document.createElement("select");for(let[o,c]of t.options){let d=document.createElement("option");d.value=o,d.textContent=c,(e===o||e==null&&t.value===o)&&(d.selected=!0),i.append(d)}}else t.type==="textarea"?(i=document.createElement("textarea"),t.rows&&(i.rows=t.rows),t.maxlength&&(i.maxLength=t.maxlength),e!=null&&(i.value=String(e))):(i=document.createElement("input"),i.type=t.type,t.min!=null&&(i.min=String(t.min)),t.max!=null&&(i.max=String(t.max)),t.step!=null&&(i.step=String(t.step)),e!=null?i.value=String(e):t.value!=null&&(i.value=String(t.value)));return i.id=a,i.name=`${n}.${t.key}`,t.width&&(i.style.inlineSize=t.width),r.append(i),r}w("iron-triangle",Vt);function vr(n){if(!n)return 0;let t=n.dataset?.capacityCost??n.getAttribute?.("data-capacity-cost"),e=Number(t);return Number.isFinite(e)&&e>0?e:0}function _e(n){let t=0;for(let e of n||[])t+=vr(e);return t}function Wt({capacityPoints:n,qualitySum:t,featureSum:e}){let r=Number.isFinite(n)?n:1/0,a=Math.max(0,Number(t)||0),s=Math.max(0,Number(e)||0),i=Number.isFinite(r)?r-a-s:1/0;return{capacity:r,quality:a,features:s,slack:i}}function we({capacity:n,quality:t,features:e}){if(!Number.isFinite(n)||n<=0){let s=t+e;return s<=0?{quality:0,features:0,slack:100}:{quality:t/s*100,features:e/s*100,slack:0}}let r=t+e,a=Math.max(n,r);return{quality:t/a*100,features:e/a*100,slack:Math.max(0,(n-r)/a*100)}}var Qt=class extends C{static get observedAttributes(){return["data-bind-triangle","data-bind-quality"]}#e=null;#t=null;#r=null;#a=null;#s=!1;setup(){this.#i(),this.#o(),this.#c(),this.#u()}teardown(){this.#e?.(),this.#t?.(),this.#r?.disconnect(),this.#e=null,this.#t=null,this.#r=null}attributeChangedCallback(t){this.isConnected&&(t==="data-bind-triangle"?(this.#i(),this.#u()):t==="data-bind-quality"&&(this.#o(),this.#u()))}get capacityPoints(){return this.#p()}get qualitySum(){return this.#l()}get featureSum(){return this.#a!=null?this.#a:_e(this.querySelectorAll("[data-capacity-cost]"))}set featureSum(t){this.#a=Number.isFinite(+t)?+t:null,this.#u()}get slack(){return Wt({capacityPoints:this.#p(),qualitySum:this.#l(),featureSum:this.featureSum}).slack}#n(t){if(!t)return null;let e=this.getRootNode();return e.getElementById?e.getElementById(t):document.getElementById(t)}#i(){this.#e?.(),this.#e=null;let t=this.#n(this.dataset.bindTriangle);if(!t||t.localName!=="iron-triangle")return;let e=()=>this.#u();t.addEventListener("iron-triangle:change",e),this.#e=()=>t.removeEventListener("iron-triangle:change",e)}#o(){this.#t?.(),this.#t=null;let t=this.#n(this.dataset.bindQuality);if(!t||t.localName!=="quality-target")return;let e=()=>this.#u();t.addEventListener("quality-target:change",e),this.#t=()=>t.removeEventListener("quality-target:change",e)}#c(){this.#r||(this.#r=new MutationObserver(t=>{t.some(r=>!r.target.closest?.("[data-capacity-table]"))&&this.#u()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-capacity-cost"]}))}#p(){let t=this.#n(this.dataset.bindTriangle);if(!t||t.localName!=="iron-triangle")return 1/0;let e=t.capacityPoints;return Number.isFinite(e)&&e>0?e:1/0}#l(){let t=this.#n(this.dataset.bindQuality);return!t||t.localName!=="quality-target"?0:Number(t.criticalSum)||0}#u(){let t=Wt({capacityPoints:this.#p(),qualitySum:this.#l(),featureSum:this.featureSum}),e=we(t),r=this.querySelector(":scope > [data-capacity-table]");r||(r=document.createElement("section"),r.dataset.capacityTable="",this.prepend(r));let a=yr(t.capacity),s=t.quality>0?`\u2212${t.quality} pts`:"0 pts",i=t.features>0?`\u2212${t.features} pts`:"0 pts",o=xr(t.slack);r.innerHTML=`
|
|
3160
3160
|
<dl data-layout="grid" class="capacity-ledger" aria-label="Capacity ledger">
|
|
3161
3161
|
<div data-row="capacity">
|
|
3162
3162
|
<dt>Capacity</dt>
|
|
@@ -3175,21 +3175,21 @@ var re=`
|
|
|
3175
3175
|
</div>
|
|
3176
3176
|
<div data-row="slack" data-state="${t.slack<0?"over":"under"}">
|
|
3177
3177
|
<dt>Slack</dt>
|
|
3178
|
-
<dd class="num">${
|
|
3178
|
+
<dd class="num">${o}</dd>
|
|
3179
3179
|
<dd class="bar"><span class="bar-track"><span class="bar-fill bar-slack" style="--w:${e.slack.toFixed(1)}%"></span></span></dd>
|
|
3180
3180
|
</div>
|
|
3181
3181
|
</dl>
|
|
3182
|
-
`,this.setState("overdrawn",t.slack<0);let c=t.slack<0;c!==this.#s&&(this.dispatchEvent(new CustomEvent("capacity-plan:overdrawn",{bubbles:!0,composed:!0,detail:{ledger:t,source:"render"}})),this.#s=c)}};function yr(o){return Number.isFinite(o)?`${o} pts`:"\u221E"}function xr(o){return Number.isFinite(o)?o===0?"0 pts":o>0?`+${o} pts`:`${o} pts`:"\u221E"}w("capacity-plan",Qt);var Yt=Object.freeze(["performance","accessibility","security","reliability","maintainability","observability","compatibility","scalability","portability","internationalization","privacy"]),ut=Object.freeze(["critical","important","acceptable","not-relevant"]),Kt=Object.freeze({critical:"Critical",important:"Important",acceptable:"Acceptable","not-relevant":"Not relevant"}),we=Object.freeze({accessibility:3,performance:5,security:5,reliability:4,observability:3,internationalization:4,compatibility:2,portability:3,privacy:4,scalability:5,maintainability:2}),Ae=Object.freeze({performance:"Performance",accessibility:"Accessibility",security:"Security",reliability:"Reliability",maintainability:"Maintainability",observability:"Observability",compatibility:"Compatibility",scalability:"Scalability",portability:"Portability",internationalization:"Internationalization",privacy:"Privacy"}),va=Object.freeze({accessibility:"a11y",internationalization:"i18n",maintainability:"maint",observability:"obs",compatibility:"compat",portability:"porta",performance:"perf",reliability:"rely",scalability:"scale",security:"sec",privacy:"priv"}),_r=Object.freeze({critical:1,important:.6,acceptable:.3,"not-relevant":0});function G(o){return Ae[o]?Ae[o]:String(o).replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function Jt(o,t={}){let e={};for(let r of o)Object.prototype.hasOwnProperty.call(t,r)&&Number.isFinite(Number(t[r]))?e[r]=Math.max(0,Math.floor(Number(t[r]))):Object.prototype.hasOwnProperty.call(we,r)?e[r]=we[r]:e[r]=1;return Object.freeze(e)}function pt(o,t){let e=0;for(let[r,a]of Object.entries(o||{}))a==="critical"&&(e+=Number(t?.[r]??0));return e}function Ce(o){return Object.keys(o||{}).filter(t=>o[t]==="critical")}function Ee(o){let{vector:t={},rationales:e={},costWeights:r={},capacityPoints:a=1/0,overrunRationale:s="",minRationale:i=10,minOverrunRationale:n=10}=o||{},c=[],d=Ce(t);for(let u of d){let p=e[u];(typeof p!="string"||p.trim().length<i)&&c.push(`Critical "${u}" needs a rationale of at least ${i} characters.`)}let l=pt(t,r);return Number.isFinite(a)&&l>a&&(typeof s!="string"||s.trim().length<n)&&c.push(`Over budget by ${l-a} points (${l}/${a}); overrunRationale of at least ${n} characters required.`),{valid:c.length===0,errors:c,criticalSum:l}}function Se({level:o,rationale:t,minRationale:e=10}){return ut.includes(o)?o==="critical"&&(typeof t!="string"||t.trim().length<e)?{ok:!1,reason:"rationale-too-short"}:{ok:!0}:{ok:!1,reason:"pick-level"}}function ke({ility:o,level:t,costWeight:e}){let r=G(o),a=t?Kt[t]||t:"unset",s=Number(e),i=Number.isFinite(s)?`${s} pts`:"? pts";return`${r} \u2014 ${a} \xB7 ${i}`}function $e(o){if(!o||typeof o!="string")return{};try{let t=JSON.parse(o);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function qe(o){let t=[];for(let e=0;e<o;e++)t.push(-Math.PI/2+2*Math.PI*e/o);return t}function wr({ilities:o,vector:t={},radius:e}){let r=qe(o.length);return o.map((a,s)=>{let i=t[a]||null,n=_r[i]??0;return{ility:a,level:i,x:U(Math.cos(r[s])*e*n),y:U(Math.sin(r[s])*e*n)}})}function Xt({ilities:o,radius:t}){let e=qe(o.length);return o.map((r,a)=>({ility:r,x:U(Math.cos(e[a])*t),y:U(Math.sin(e[a])*t)}))}var I="http://www.w3.org/2000/svg",Ar=Object.freeze([{ratio:1,label:"Critical",className:"ring-critical"},{ratio:.6,label:"Important",className:"ring-important"},{ratio:.3,label:"Acceptable",className:"ring-acceptable"}]),kr=.22;function Ie({ilities:o=[],vector:t={},costWeights:e={},capacityPoints:r=0,radius:a=100}={}){let s=document.createElementNS(I,"svg"),i=a+14,n=i+140,c=i+30;s.setAttribute("viewBox",`${-n} ${-c} ${n*2} ${c*2}`),s.setAttribute("role","group"),s.setAttribute("aria-label",`Quality target. ${Ce(t||{}).length} critical of ${o.length} ilities. Click any axis to edit.`);for(let y of Ar){let A=document.createElementNS(I,"polygon");A.setAttribute("class",`ring ${y.className}`);let S=Xt({ilities:o,radius:a*y.ratio});A.setAttribute("points",S.map($=>`${$.x},${$.y}`).join(" ")),s.append(A)}let d=Xt({ilities:o,radius:a});for(let y of d){let A=document.createElementNS(I,"line");A.setAttribute("class","spoke"),A.setAttribute("x1","0"),A.setAttribute("y1","0"),A.setAttribute("x2",String(y.x)),A.setAttribute("y2",String(y.y)),s.append(A)}let l=wr({ilities:o,vector:t,radius:a}),u=l.filter(y=>Math.hypot(y.x,y.y)>.5);if(u.length>=3){let y=document.createElementNS(I,"polygon");y.setAttribute("class","vector"),y.setAttribute("points",u.map(A=>`${A.x},${A.y}`).join(" ")),s.append(y)}else if(u.length>0)for(let y of u){let A=document.createElementNS(I,"line");A.setAttribute("class","vector-spoke"),A.setAttribute("x1","0"),A.setAttribute("y1","0"),A.setAttribute("x2",String(y.x)),A.setAttribute("y2",String(y.y)),s.append(A)}let p=Xt({ilities:o,radius:i});for(let y=0;y<o.length;y++){let A=o[y],S=l[y],$=p[y],T=Number(e?.[A]??0),z=t?.[A]??null,N=document.createElementNS(I,"g");N.setAttribute("class","axis"),N.setAttribute("data-ility",A),z&&N.setAttribute("data-level",String(z)),N.setAttribute("tabindex","0"),N.setAttribute("role","button"),N.setAttribute("aria-label",`${ke({ility:A,level:z,costWeight:T})}. Activate to edit.`);let D=document.createElementNS(I,"rect");D.setAttribute("class","hit");let ht=Cr($),mt=100,te=22,Le=$.x+(ht==="end"?-mt:ht==="start"?0:-mt/2),ze=$.y-te/2;if(D.setAttribute("x",String(U(Le))),D.setAttribute("y",String(U(ze))),D.setAttribute("width",String(mt)),D.setAttribute("height",String(te)),D.setAttribute("rx","4"),N.append(D),z){let Q=document.createElementNS(I,"circle");Q.setAttribute("class","marker"),Q.setAttribute("cx",String(S.x)),Q.setAttribute("cy",String(S.y)),Q.setAttribute("r","4"),N.append(Q)}let F=document.createElementNS(I,"text");F.setAttribute("class","axis-label"),F.setAttribute("x",String($.x)),F.setAttribute("y",String($.y)),F.setAttribute("text-anchor",ht),F.setAttribute("dominant-baseline","middle"),F.textContent=G(A),N.append(F);let ee=document.createElementNS(I,"title");ee.textContent=ke({ility:A,level:z,costWeight:T}),N.append(ee),s.append(N)}let h=document.createElementNS(I,"g");h.setAttribute("class","center");let f=pt(t,e);Number.isFinite(r)&&f>r&&h.setAttribute("data-over","");let v=a*kr,x=document.createElementNS(I,"circle");x.setAttribute("class","capacity-backdrop"),x.setAttribute("cx","0"),x.setAttribute("cy","0"),x.setAttribute("r",String(U(v))),h.append(x);let _=document.createElementNS(I,"text");_.setAttribute("class","capacity-sum"),_.setAttribute("x","0"),_.setAttribute("y","-3"),_.setAttribute("text-anchor","middle"),_.setAttribute("dominant-baseline","middle"),_.textContent=String(f),h.append(_);let g=document.createElementNS(I,"text");return g.setAttribute("class","capacity-denom"),g.setAttribute("x","0"),g.setAttribute("y","11"),g.setAttribute("text-anchor","middle"),g.textContent=Number.isFinite(r)?`of ${r}`:"unbounded",h.append(g),s.append(h),s}function U(o){return Math.round(o*100)/100}function Cr(o){return Math.abs(o.x)<4?"middle":o.x>0?"start":"end"}var Gt=class extends C{static formAssociated=!0;static get observedAttributes(){return["data-bind-to","data-capacity-points","data-cost-weights","data-radius","data-show-envelope","data-min-rationale","data-max-rationale","data-min-overrun-rationale","data-max-overrun-rationale","disabled","locked"]}#e;#t=[...Yt];#r={};#a={};#s=Jt(Yt);#o="";#i=!1;#n=null;#c=null;#l={};#p=null;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){this.#y(),this.#I(),this.#C(),this.#b(),this.listen(this,"click",t=>this.#d(t)),this.listen(this,"keydown",t=>this.#f(t)),this.listen(this,"input",t=>this.#u(t))}teardown(){this.#n?.(),this.#n=null}attributeChangedCallback(t){this.isConnected&&(t==="data-bind-to"?(this.#I(),this.#C()):t==="data-capacity-points"?this.#C():t==="data-cost-weights"?(this.#y(),this.#C()):t==="data-radius"||t==="data-show-envelope"?this.#C():(t==="disabled"||t==="locked")&&this.#T())}get vector(){return{...this.#r}}set vector(t){this.#g(t),this.#E("property")}get rationales(){return{...this.#a}}set rationales(t){this.#x(t),this.#E("property")}get costWeights(){return{...this.#s}}get capacityPoints(){return this.#w()}set capacityPoints(t){this.#c=Number.isFinite(+t)?+t:null,this.#E("property")}get criticalSum(){return pt(this.#r,this.#s)}get overBudget(){let t=this.#w();return Number.isFinite(t)&&this.criticalSum>t}get overrunRationale(){return this.#o}set overrunRationale(t){this.#o=String(t??"");let e=this.querySelector("[data-quality-overrun] textarea");e&&(e.value=this.#o),this.#$()}get ilities(){return[...this.#t]}set ilities(t){!Array.isArray(t)||t.length===0||(this.#t=[...t],this.#y(),this.#E("property"))}get value(){return{vector:{...this.#r},rationales:{...this.#a},costWeights:{...this.#s},capacityPoints:this.#_(),capacitySource:this.#k(),criticalSum:this.criticalSum,overrunRationale:this.#o||void 0,ironTriangleHash:this.#N()}}openEditor(t){if(!this.#t.includes(t))return;let e=this.#m(t);typeof e.showModal=="function"?e.showModal():e.setAttribute("open","")}checkValidity(){let{valid:t,errors:e}=Ee({vector:this.#r,rationales:this.#a,costWeights:this.#s,capacityPoints:this.#w(),overrunRationale:this.#o,minRationale:this.#S(),minOverrunRationale:this.#q()});this.setState("missing-rationale",!t);let r=this.querySelector("[data-quality-errors]");return r&&(r.textContent=e.join(" ")),t}#d(t){let e=t.target.closest?.(".axis[data-ility]");e&&this.contains(e)&&(t.preventDefault(),this.openEditor(e.dataset.ility))}#f(t){if(t.key!=="Enter"&&t.key!==" ")return;let e=t.target.closest?.(".axis[data-ility]");e&&this.contains(e)&&(t.preventDefault(),this.openEditor(e.dataset.ility))}#u(t){let e=t.target;e?.matches?.("[data-quality-overrun] textarea")&&(this.#o=e.value,this.checkValidity(),this.#$())}#m(t){if(this.#l[t])return this.#h(t),this.#l[t];let e=document.createElement("dialog");e.className=`quality-dialog quality-dialog--${t}`,e.setAttribute("aria-label",`${G(t)} \u2014 edit priority`);let r=document.createElement("form");r.method="dialog",r.setAttribute("data-layout","stack"),r.setAttribute("data-layout-gap","m");let a=document.createElement("h3");a.textContent=G(t),r.append(a);let s=document.createElement("fieldset");s.setAttribute("data-layout","stack"),s.setAttribute("data-layout-gap","2xs");let i=document.createElement("legend");i.textContent="Priority",s.append(i);for(let f of ut){let b=document.createElement("label"),v=document.createElement("input");v.type="radio",v.name="level",v.value=f,b.append(v,document.createTextNode(" "+Kt[f])),s.append(b)}r.append(s);let n=document.createElement("form-field"),c=document.createElement("label");c.setAttribute("for",`quality-${t}-rationale`),c.textContent="Rationale (required when Critical)";let d=document.createElement("textarea");d.id=`quality-${t}-rationale`,d.name="rationale",d.rows=3,d.minLength=this.#S(),d.maxLength=this.#M(),d.placeholder=`Why \u2265 ${this.#S()} chars`,n.append(c,d),r.append(n);let l=document.createElement("p");l.className="message message-error",l.dataset.dialogError="",l.hidden=!0,r.append(l);let u=document.createElement("div");u.setAttribute("data-layout","cluster"),u.setAttribute("data-layout-gap","s"),u.setAttribute("data-layout-justify","end");let p=document.createElement("button");p.type="button",p.textContent="Cancel",p.addEventListener("click",()=>e.close("cancel"));let h=document.createElement("button");return h.type="submit",h.textContent="Save",u.append(p,h),r.append(u),e.append(r),this.append(e),this.#l[t]=e,r.addEventListener("submit",f=>{f.preventDefault();let v=r.querySelector('input[name="level"]:checked')?.value,_=r.querySelector('textarea[name="rationale"]')?.value??"",g=Se({level:v,rationale:_,minRationale:this.#S()});if(!g.ok){l.hidden=!1,l.textContent=g.reason==="pick-level"?"Pick a priority level.":`Rationale must be at least ${this.#S()} characters.`;return}this.#r[t]=v??"",v==="critical"?this.#a[t]=_.trim():delete this.#a[t],e.close("save"),this.#E("dialog",t)}),this.#h(t),e}#h(t){let e=this.#l[t];if(!e)return;let r=this.#r[t];for(let i of e.querySelectorAll('input[name="level"]')){let n=i;n.checked=n.value===r}let a=e.querySelector('textarea[name="rationale"]');a&&(a.value=this.#a[t]||"");let s=e.querySelector("[data-dialog-error]");s&&(s.hidden=!0,s.textContent="")}#b(){if(this.#p)return;let t=document.createElement("section");t.className="quality-footer",t.dataset.qualityFooter="",t.setAttribute("data-layout","stack"),t.setAttribute("data-layout-gap","s");let e=document.createElement("section");e.dataset.qualityOverrun="",e.hidden=!0,e.innerHTML=`
|
|
3182
|
+
`,this.setState("overdrawn",t.slack<0);let c=t.slack<0;c!==this.#s&&(this.dispatchEvent(new CustomEvent("capacity-plan:overdrawn",{bubbles:!0,composed:!0,detail:{ledger:t,source:"render"}})),this.#s=c)}};function yr(n){return Number.isFinite(n)?`${n} pts`:"\u221E"}function xr(n){return Number.isFinite(n)?n===0?"0 pts":n>0?`+${n} pts`:`${n} pts`:"\u221E"}w("capacity-plan",Qt);var Yt=Object.freeze(["performance","accessibility","security","reliability","maintainability","observability","compatibility","scalability","portability","internationalization","privacy"]),ut=Object.freeze(["critical","important","acceptable","not-relevant"]),Kt=Object.freeze({critical:"Critical",important:"Important",acceptable:"Acceptable","not-relevant":"Not relevant"}),Ae=Object.freeze({accessibility:3,performance:5,security:5,reliability:4,observability:3,internationalization:4,compatibility:2,portability:3,privacy:4,scalability:5,maintainability:2}),ke=Object.freeze({performance:"Performance",accessibility:"Accessibility",security:"Security",reliability:"Reliability",maintainability:"Maintainability",observability:"Observability",compatibility:"Compatibility",scalability:"Scalability",portability:"Portability",internationalization:"Internationalization",privacy:"Privacy"}),va=Object.freeze({accessibility:"a11y",internationalization:"i18n",maintainability:"maint",observability:"obs",compatibility:"compat",portability:"porta",performance:"perf",reliability:"rely",scalability:"scale",security:"sec",privacy:"priv"}),_r=Object.freeze({critical:1,important:.6,acceptable:.3,"not-relevant":0});function G(n){return ke[n]?ke[n]:String(n).replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function Jt(n,t={}){let e={};for(let r of n)Object.prototype.hasOwnProperty.call(t,r)&&Number.isFinite(Number(t[r]))?e[r]=Math.max(0,Math.floor(Number(t[r]))):Object.prototype.hasOwnProperty.call(Ae,r)?e[r]=Ae[r]:e[r]=1;return Object.freeze(e)}function pt(n,t){let e=0;for(let[r,a]of Object.entries(n||{}))a==="critical"&&(e+=Number(t?.[r]??0));return e}function Ee(n){return Object.keys(n||{}).filter(t=>n[t]==="critical")}function Se(n){let{vector:t={},rationales:e={},costWeights:r={},capacityPoints:a=1/0,overrunRationale:s="",minRationale:i=10,minOverrunRationale:o=10}=n||{},c=[],d=Ee(t);for(let u of d){let p=e[u];(typeof p!="string"||p.trim().length<i)&&c.push(`Critical "${u}" needs a rationale of at least ${i} characters.`)}let l=pt(t,r);return Number.isFinite(a)&&l>a&&(typeof s!="string"||s.trim().length<o)&&c.push(`Over budget by ${l-a} points (${l}/${a}); overrunRationale of at least ${o} characters required.`),{valid:c.length===0,errors:c,criticalSum:l}}function $e({level:n,rationale:t,minRationale:e=10}){return ut.includes(n)?n==="critical"&&(typeof t!="string"||t.trim().length<e)?{ok:!1,reason:"rationale-too-short"}:{ok:!0}:{ok:!1,reason:"pick-level"}}function Ce({ility:n,level:t,costWeight:e}){let r=G(n),a=t?Kt[t]||t:"unset",s=Number(e),i=Number.isFinite(s)?`${s} pts`:"? pts";return`${r} \u2014 ${a} \xB7 ${i}`}function qe(n){if(!n||typeof n!="string")return{};try{let t=JSON.parse(n);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Ie(n){let t=[];for(let e=0;e<n;e++)t.push(-Math.PI/2+2*Math.PI*e/n);return t}function wr({ilities:n,vector:t={},radius:e}){let r=Ie(n.length);return n.map((a,s)=>{let i=t[a]||null,o=_r[i]??0;return{ility:a,level:i,x:U(Math.cos(r[s])*e*o),y:U(Math.sin(r[s])*e*o)}})}function Xt({ilities:n,radius:t}){let e=Ie(n.length);return n.map((r,a)=>({ility:r,x:U(Math.cos(e[a])*t),y:U(Math.sin(e[a])*t)}))}var I="http://www.w3.org/2000/svg",Ar=Object.freeze([{ratio:1,label:"Critical",className:"ring-critical"},{ratio:.6,label:"Important",className:"ring-important"},{ratio:.3,label:"Acceptable",className:"ring-acceptable"}]),kr=.22;function Ne({ilities:n=[],vector:t={},costWeights:e={},capacityPoints:r=0,radius:a=100}={}){let s=document.createElementNS(I,"svg"),i=a+14,o=i+140,c=i+30;s.setAttribute("viewBox",`${-o} ${-c} ${o*2} ${c*2}`),s.setAttribute("role","group"),s.setAttribute("aria-label",`Quality target. ${Ee(t||{}).length} critical of ${n.length} ilities. Click any axis to edit.`);for(let y of Ar){let A=document.createElementNS(I,"polygon");A.setAttribute("class",`ring ${y.className}`);let S=Xt({ilities:n,radius:a*y.ratio});A.setAttribute("points",S.map($=>`${$.x},${$.y}`).join(" ")),s.append(A)}let d=Xt({ilities:n,radius:a});for(let y of d){let A=document.createElementNS(I,"line");A.setAttribute("class","spoke"),A.setAttribute("x1","0"),A.setAttribute("y1","0"),A.setAttribute("x2",String(y.x)),A.setAttribute("y2",String(y.y)),s.append(A)}let l=wr({ilities:n,vector:t,radius:a}),u=l.filter(y=>Math.hypot(y.x,y.y)>.5);if(u.length>=3){let y=document.createElementNS(I,"polygon");y.setAttribute("class","vector"),y.setAttribute("points",u.map(A=>`${A.x},${A.y}`).join(" ")),s.append(y)}else if(u.length>0)for(let y of u){let A=document.createElementNS(I,"line");A.setAttribute("class","vector-spoke"),A.setAttribute("x1","0"),A.setAttribute("y1","0"),A.setAttribute("x2",String(y.x)),A.setAttribute("y2",String(y.y)),s.append(A)}let p=Xt({ilities:n,radius:i});for(let y=0;y<n.length;y++){let A=n[y],S=l[y],$=p[y],T=Number(e?.[A]??0),z=t?.[A]??null,N=document.createElementNS(I,"g");N.setAttribute("class","axis"),N.setAttribute("data-ility",A),z&&N.setAttribute("data-level",String(z)),N.setAttribute("tabindex","0"),N.setAttribute("role","button"),N.setAttribute("aria-label",`${Ce({ility:A,level:z,costWeight:T})}. Activate to edit.`);let D=document.createElementNS(I,"rect");D.setAttribute("class","hit");let ht=Cr($),mt=100,te=22,ze=$.x+(ht==="end"?-mt:ht==="start"?0:-mt/2),Pe=$.y-te/2;if(D.setAttribute("x",String(U(ze))),D.setAttribute("y",String(U(Pe))),D.setAttribute("width",String(mt)),D.setAttribute("height",String(te)),D.setAttribute("rx","4"),N.append(D),z){let Q=document.createElementNS(I,"circle");Q.setAttribute("class","marker"),Q.setAttribute("cx",String(S.x)),Q.setAttribute("cy",String(S.y)),Q.setAttribute("r","4"),N.append(Q)}let F=document.createElementNS(I,"text");F.setAttribute("class","axis-label"),F.setAttribute("x",String($.x)),F.setAttribute("y",String($.y)),F.setAttribute("text-anchor",ht),F.setAttribute("dominant-baseline","middle"),F.textContent=G(A),N.append(F);let ee=document.createElementNS(I,"title");ee.textContent=Ce({ility:A,level:z,costWeight:T}),N.append(ee),s.append(N)}let h=document.createElementNS(I,"g");h.setAttribute("class","center");let f=pt(t,e);Number.isFinite(r)&&f>r&&h.setAttribute("data-over","");let v=a*kr,x=document.createElementNS(I,"circle");x.setAttribute("class","capacity-backdrop"),x.setAttribute("cx","0"),x.setAttribute("cy","0"),x.setAttribute("r",String(U(v))),h.append(x);let _=document.createElementNS(I,"text");_.setAttribute("class","capacity-sum"),_.setAttribute("x","0"),_.setAttribute("y","-3"),_.setAttribute("text-anchor","middle"),_.setAttribute("dominant-baseline","middle"),_.textContent=String(f),h.append(_);let g=document.createElementNS(I,"text");return g.setAttribute("class","capacity-denom"),g.setAttribute("x","0"),g.setAttribute("y","11"),g.setAttribute("text-anchor","middle"),g.textContent=Number.isFinite(r)?`of ${r}`:"unbounded",h.append(g),s.append(h),s}function U(n){return Math.round(n*100)/100}function Cr(n){return Math.abs(n.x)<4?"middle":n.x>0?"start":"end"}var Gt=class extends C{static formAssociated=!0;static get observedAttributes(){return["data-bind-to","data-capacity-points","data-cost-weights","data-radius","data-show-envelope","data-min-rationale","data-max-rationale","data-min-overrun-rationale","data-max-overrun-rationale","disabled","locked"]}#e;#t=[...Yt];#r={};#a={};#s=Jt(Yt);#n="";#i=!1;#o=null;#c=null;#p={};#l=null;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){this.#v(),this.#q(),this.#E(),this.#d(),this.listen(this,"click",t=>this.#u(t)),this.listen(this,"keydown",t=>this.#m(t)),this.listen(this,"input",t=>this.#x(t))}teardown(){this.#o?.(),this.#o=null}attributeChangedCallback(t){this.isConnected&&(t==="data-bind-to"?(this.#q(),this.#E()):t==="data-capacity-points"?this.#E():t==="data-cost-weights"?(this.#v(),this.#E()):t==="data-radius"||t==="data-show-envelope"?this.#E():(t==="disabled"||t==="locked")&&this.#T())}get vector(){return{...this.#r}}set vector(t){this.#b(t),this.#S("property")}get rationales(){return{...this.#a}}set rationales(t){this.#A(t),this.#S("property")}get costWeights(){return{...this.#s}}get capacityPoints(){return this.#y()}set capacityPoints(t){this.#c=Number.isFinite(+t)?+t:null,this.#S("property")}get criticalSum(){return pt(this.#r,this.#s)}get overBudget(){let t=this.#y();return Number.isFinite(t)&&this.criticalSum>t}get overrunRationale(){return this.#n}set overrunRationale(t){this.#n=String(t??"");let e=this.querySelector("[data-quality-overrun] textarea");e&&(e.value=this.#n),this.#I()}get ilities(){return[...this.#t]}set ilities(t){!Array.isArray(t)||t.length===0||(this.#t=[...t],this.#v(),this.#S("property"))}get value(){return{vector:{...this.#r},rationales:{...this.#a},costWeights:{...this.#s},capacityPoints:this.#C(),capacitySource:this.#_(),criticalSum:this.criticalSum,overrunRationale:this.#n||void 0,ironTriangleHash:this.#k()}}openEditor(t){if(!this.#t.includes(t))return;let e=this.#f(t);typeof e.showModal=="function"?e.showModal():e.setAttribute("open","")}checkValidity(){let{valid:t,errors:e}=Se({vector:this.#r,rationales:this.#a,costWeights:this.#s,capacityPoints:this.#y(),overrunRationale:this.#n,minRationale:this.#$(),minOverrunRationale:this.#N()});this.setState("missing-rationale",!t);let r=this.querySelector("[data-quality-errors]");return r&&(r.textContent=e.join(" ")),t}#u(t){let e=t.target.closest?.(".axis[data-ility]");e&&this.contains(e)&&(t.preventDefault(),this.openEditor(e.dataset.ility))}#m(t){if(t.key!=="Enter"&&t.key!==" ")return;let e=t.target.closest?.(".axis[data-ility]");e&&this.contains(e)&&(t.preventDefault(),this.openEditor(e.dataset.ility))}#x(t){let e=t.target;e?.matches?.("[data-quality-overrun] textarea")&&(this.#n=e.value,this.checkValidity(),this.#I())}#f(t){if(this.#p[t])return this.#g(t),this.#p[t];let e=document.createElement("dialog");e.className=`quality-dialog quality-dialog--${t}`,e.setAttribute("aria-label",`${G(t)} \u2014 edit priority`);let r=document.createElement("form");r.method="dialog",r.setAttribute("data-layout","stack"),r.setAttribute("data-layout-gap","m");let a=document.createElement("h3");a.textContent=G(t),r.append(a);let s=document.createElement("fieldset");s.setAttribute("data-layout","stack"),s.setAttribute("data-layout-gap","2xs");let i=document.createElement("legend");i.textContent="Priority",s.append(i);for(let f of ut){let b=document.createElement("label"),v=document.createElement("input");v.type="radio",v.name="level",v.value=f,b.append(v,document.createTextNode(" "+Kt[f])),s.append(b)}r.append(s);let o=document.createElement("form-field"),c=document.createElement("label");c.setAttribute("for",`quality-${t}-rationale`),c.textContent="Rationale (required when Critical)";let d=document.createElement("textarea");d.id=`quality-${t}-rationale`,d.name="rationale",d.rows=3,d.minLength=this.#$(),d.maxLength=this.#M(),d.placeholder=`Why \u2265 ${this.#$()} chars`,o.append(c,d),r.append(o);let l=document.createElement("p");l.className="message message-error",l.dataset.dialogError="",l.hidden=!0,r.append(l);let u=document.createElement("div");u.setAttribute("data-layout","cluster"),u.setAttribute("data-layout-gap","s"),u.setAttribute("data-layout-justify","end");let p=document.createElement("button");p.type="button",p.textContent="Cancel",p.addEventListener("click",()=>e.close("cancel"));let h=document.createElement("button");return h.type="submit",h.textContent="Save",u.append(p,h),r.append(u),e.append(r),this.append(e),this.#p[t]=e,r.addEventListener("submit",f=>{f.preventDefault();let v=r.querySelector('input[name="level"]:checked')?.value,_=r.querySelector('textarea[name="rationale"]')?.value??"",g=$e({level:v,rationale:_,minRationale:this.#$()});if(!g.ok){l.hidden=!1,l.textContent=g.reason==="pick-level"?"Pick a priority level.":`Rationale must be at least ${this.#$()} characters.`;return}this.#r[t]=v??"",v==="critical"?this.#a[t]=_.trim():delete this.#a[t],e.close("save"),this.#S("dialog",t)}),this.#g(t),e}#g(t){let e=this.#p[t];if(!e)return;let r=this.#r[t];for(let i of e.querySelectorAll('input[name="level"]')){let o=i;o.checked=o.value===r}let a=e.querySelector('textarea[name="rationale"]');a&&(a.value=this.#a[t]||"");let s=e.querySelector("[data-dialog-error]");s&&(s.hidden=!0,s.textContent="")}#d(){if(this.#l)return;let t=document.createElement("section");t.className="quality-footer",t.dataset.qualityFooter="",t.setAttribute("data-layout","stack"),t.setAttribute("data-layout-gap","s");let e=document.createElement("section");e.dataset.qualityOverrun="",e.hidden=!0,e.innerHTML=`
|
|
3183
3183
|
<strong>Over budget \u2014 explain why.</strong>
|
|
3184
3184
|
<small data-overrun-prompt></small>
|
|
3185
3185
|
<form-field>
|
|
3186
|
-
<label for="quality-overrun">Overrun rationale (\u2265 ${this.#
|
|
3186
|
+
<label for="quality-overrun">Overrun rationale (\u2265 ${this.#N()} chars)</label>
|
|
3187
3187
|
<textarea id="quality-overrun" name="overrunRationale"
|
|
3188
|
-
minlength="${this.#
|
|
3188
|
+
minlength="${this.#N()}"
|
|
3189
3189
|
maxlength="${this.#L()}"
|
|
3190
3190
|
rows="3"></textarea>
|
|
3191
3191
|
</form-field>
|
|
3192
|
-
`,t.append(e);let r=document.createElement("p");r.dataset.qualityErrors="",r.className="message message-error",r.setAttribute("role","alert"),t.append(r),this.append(t),this.#
|
|
3192
|
+
`,t.append(e);let r=document.createElement("p");r.dataset.qualityErrors="",r.className="message message-error",r.setAttribute("role","alert"),t.append(r),this.append(t),this.#l=t}#h(){if(!this.#l)return;let t=this.#y(),e=this.criticalSum,r=Number.isFinite(t)&&e>t,a=this.#l.querySelector("[data-quality-overrun]");if(a){a.hidden=!r;let s=a.querySelector("[data-overrun-prompt]");s&&Number.isFinite(t)&&(s.textContent=`You're over budget by ${e-t} points (${e}/${t}).`)}}#v(){let t=qe(this.getAttribute("data-cost-weights")||"");this.#s=Jt(this.#t,t)}#b(t){if(!(!t||typeof t!="object"))for(let[e,r]of Object.entries(t))ut.includes(r)&&(this.#r[e]=r)}#A(t){if(!(!t||typeof t!="object"))for(let[e,r]of Object.entries(t))this.#a[e]=String(r??"")}#y(){let t=this.#w();if(t&&Number.isFinite(t.capacityPoints)&&t.capacityPoints>0)return t.capacityPoints;let e=Number(this.getAttribute("data-capacity-points"));if(Number.isFinite(e)&&e>0)return e;let r=this.#c;return r!==null&&Number.isFinite(r)&&r>0?r:1/0}#C(){let t=this.#y();return Number.isFinite(t)?t:null}#_(){let t=this.#w();return t?.capacitySource==="manual"?"manual":t?"formula":(this.getAttribute("data-capacity-points"),"manual")}#w(){let t=this.getAttribute("data-bind-to");if(!t)return null;let e=this.getRootNode(),r=e.getElementById?e.getElementById(t):document.getElementById(t);return r&&r.localName==="iron-triangle"?r:null}#k(){return this.#w()?.hash||null}#q(){this.#o?.(),this.#o=null;let t=this.#w();if(!t)return;let e=()=>this.#S("iron-triangle");t.addEventListener("iron-triangle:change",e),this.#o=()=>t.removeEventListener("iron-triangle:change",e)}#E(){let t=Er(Number(this.dataset.radius??100),30,400),e=this.#y(),r=Ne({ilities:this.#t,vector:this.#r,costWeights:this.#s,capacityPoints:e,radius:t}),a=this.querySelector(":scope > svg");a?a.replaceWith(r):this.prepend(r)}#S(t,e){this.#E(),this.#h();let r=this.#y(),a=this.criticalSum,s=Number.isFinite(r)&&a>r;if(this.setState("over-budget",s),this.#I(),s!==this.#i){let i=s?"quality-target:over-budget":"quality-target:under-budget",o=s?{delta:a-r,criticalSum:a,capacityPoints:r}:{slack:r-a,criticalSum:a,capacityPoints:r};this.dispatchEvent(new CustomEvent(i,{bubbles:!0,composed:!0,detail:o})),this.#i=s}this.dispatchEvent(new CustomEvent("quality-target:change",{bubbles:!0,composed:!0,detail:{...this.value,source:t,field:e}}))}#I(){try{this.#e.setFormValue(JSON.stringify(this.value))}catch{}}#T(){let t=this.hasAttribute("disabled")||this.hasAttribute("locked");for(let e of Object.values(this.#p))for(let r of e.querySelectorAll("input, textarea, select, button"))r.disabled=t}#$(){return Math.max(0,parseInt(this.dataset.minRationale??"10",10)||10)}#M(){return Math.max(10,parseInt(this.dataset.maxRationale??"200",10)||200)}#N(){return Math.max(0,parseInt(this.dataset.minOverrunRationale??"10",10)||10)}#L(){return Math.max(10,parseInt(this.dataset.maxOverrunRationale??"400",10)||400)}};function Er(n,t,e){return Math.max(t,Math.min(e,n))}w("quality-target",Gt);var Te=`
|
|
3193
3193
|
:host {
|
|
3194
3194
|
--_padding: var(--requirement-card-padding, var(--size-m, 1rem));
|
|
3195
3195
|
--_radius: var(--requirement-card-radius, var(--radius-m, 0.5rem));
|
|
@@ -3296,8 +3296,8 @@ var re=`
|
|
|
3296
3296
|
outline: 2px solid var(--color-focus-ring, var(--color-interactive, currentColor));
|
|
3297
3297
|
outline-offset: 2px;
|
|
3298
3298
|
}
|
|
3299
|
-
`;var
|
|
3300
|
-
<style>${
|
|
3299
|
+
`;var Me=Object.freeze(["critical","important","acceptable","not-relevant"]),Sr=Object.freeze({critical:"Critical",important:"Important",acceptable:"Acceptable","not-relevant":"Not relevant"}),Le=["badge","priority-pill","rationale","conflicts"],$r=`
|
|
3300
|
+
<style>${Te}</style>
|
|
3301
3301
|
<article class="card" part="card">
|
|
3302
3302
|
<header class="head" part="head">
|
|
3303
3303
|
<span class="name" part="name"><slot name="name"></slot></span>
|
|
@@ -3309,4 +3309,4 @@ var re=`
|
|
|
3309
3309
|
<p class="rationale" part="rationale"><slot name="rationale"></slot></p>
|
|
3310
3310
|
<p class="conflicts" part="conflicts"><slot name="conflicts"></slot></p>
|
|
3311
3311
|
</article>
|
|
3312
|
-
`,Zt=class extends C{static get observedAttributes(){return["data-priority","data-conflict","tabindex"]}setup(){if(this.shadowRoot)for(let t of
|
|
3312
|
+
`,Zt=class extends C{static get observedAttributes(){return["data-priority","data-conflict","tabindex"]}setup(){if(this.shadowRoot)for(let t of Le){let e=this.shadowRoot.querySelector(`slot[name="${t}"]`);this.#t(t,e)}else{let t=this.attachShadow({mode:"open"});t.innerHTML=$r;for(let e of Le){let r=t.querySelector(`slot[name="${e}"]`);r?.addEventListener("slotchange",()=>this.#t(e,r)),this.#t(e,r)}}this.#r(),this.#a(),this.#s(),this.listen(this,"click",t=>this.#n(t)),this.listen(this,"keydown",t=>{let e=t;(e.key==="Enter"||e.key===" ")&&this.#e&&(e.preventDefault(),this.#n(e))})}attributeChangedCallback(t){this.isConnected&&(t==="data-priority"?(this.#r(),this.#a()):t==="data-conflict"||t==="tabindex"&&this.#s())}get priority(){return(this.dataset.priority||"").toLowerCase()}set priority(t){let e=String(t||"").toLowerCase();Me.includes(e)?this.dataset.priority=e:delete this.dataset.priority}get hasConflict(){return this.hasAttribute("data-conflict")}set hasConflict(t){t?this.setAttribute("data-conflict",""):this.removeAttribute("data-conflict")}get#e(){return this.hasAttribute("tabindex")||this.closest("a[href], button")}#t(t,e){let r=!!e&&e.assignedNodes().some(a=>a.nodeType===Node.ELEMENT_NODE||a.nodeType===Node.TEXT_NODE&&a.textContent.trim().length>0);this.setState(`has-${t}`,r)}#r(){let t=(this.dataset.priority||"").toLowerCase();for(let e of Me)this.setState(`priority-${e}`,e===t)}#a(){let t=(this.dataset.priority||"").toLowerCase(),e=this.shadowRoot?.querySelector("[data-priority-default]");e&&(e.textContent=Sr[t]||"")}#s(){this.setState("interactive",!!this.#e)}#n(t){this.#e&&this.dispatchEvent(new CustomEvent("requirement-card:click",{bubbles:!0,composed:!0,detail:{priority:this.priority||null,hasConflict:this.hasConflict,originalEvent:t}}))}};w("requirement-card",Zt);
|