@profpowell/vb-project-planning 0.1.0 → 0.2.1
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 +61 -5
- package/dist/vb-project-planning.js +304 -27
- package/dist/vb-project-planning.min.css +1 -1
- package/dist/vb-project-planning.min.js +101 -101
- package/package.json +5 -4
- package/src/web-components/iron-triangle/_capacity.js +1 -1
- package/src/web-components/iron-triangle/_triangle-geometry.js +1 -1
- package/src/web-components/iron-triangle/api.json +3 -3
- package/src/web-components/iron-triangle/logic.js +200 -5
- package/src/web-components/iron-triangle/styles.css +81 -3
- package/src/web-components/product-roadmap/logic.js +25 -13
- package/src/web-components/quality-target/api.json +2 -3
- package/src/web-components/quality-target/logic.js +85 -13
- package/src/web-components/requirement-card/api.json +1 -1
- package/src/web-components/requirement-card/logic.js +27 -3
- package/src/web-components/requirement-card/static.html +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
|
|
297
|
+
`;var Ns=window.matchMedia("(prefers-reduced-motion: reduce)");var ae=new Map;function w(n,t,e={}){let s=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:s},a=ae.get(n);if(customElements.get(n)){if(!a||a.priority>=s){a&&a.priority===s&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=s){a.priority===s&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${a.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}ae.set(n,r),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 s=0;s<n.length;s++)t=n.charCodeAt(s)+((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 s=1;s<Z.length;s++){let r=Math.abs(n-Z[s]);r<e&&(t=Z[s],e=r)}return t}function ie(n,t=128){let e=je(String(n)),s=(e%100+100)%100,r=(e>>>16&1)===0?"female":"male",a=De(t);return`${Re}/${r}/${a}/${s}.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])`))}#s(){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 s=await e.json();this._applyData(s),this.#o()}catch(e){console.warn(`[user-persona] Failed to load src="${t}":`,e)}}connectedCallback(){this.#s(),this.hasAttribute("data-mock")?this.#a():this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#o(),this.#i(),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}#i(){if(!this.hasAttribute("data-list-stories")||!this.id){this.#t?.disconnect(),this.#t=null;return}this.#t||(this.#t=new MutationObserver(()=>this.#r()),this.#t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["persona-id"]}))}#r(){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">
|
|
@@ -303,10 +303,10 @@ var re=`
|
|
|
303
303
|
<span class="section-title">Stories <span class="section-count">${t.length}</span></span>
|
|
304
304
|
</div>
|
|
305
305
|
<div class="section-content">
|
|
306
|
-
${t.length===0?'<p class="empty-stories">No user stories reference this persona yet.</p>':`<ul class="story-list">${t.map(e=>{let
|
|
306
|
+
${t.length===0?'<p class="empty-stories">No user stories reference this persona yet.</p>':`<ul class="story-list">${t.map(e=>{let s=e.id||e.getAttribute("story-id")||"",r=e.querySelector('[slot="action"]')?.textContent?.trim()||e.getAttribute("action")||e.id||"untitled",a=e.getAttribute("priority")||"",i=e.getAttribute("status")||"";return`<li class="story-item" data-priority="${m(a)}" data-status="${m(i)}">${s?`<a href="#${m(s)}">${m(r)}</a>`:`<span>${m(r)}</span>`}${a?`<span class="story-meta">${m(a)}</span>`:""}${i?`<span class="story-meta">${m(i)}</span>`:""}</li>`}).join("")}</ul>`}
|
|
307
307
|
</div>
|
|
308
308
|
</section>
|
|
309
|
-
`}attributeChangedCallback(t,e,
|
|
309
|
+
`}attributeChangedCallback(t,e,s){if(!(e===s||!this.shadowRoot)){if(t==="src"&&this.isConnected){this._loadSrc(s);return}(t==="data-list-stories"||t==="id")&&this.#i(),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")}#a(){let t=this.dataset.seed||this.dataset.mock||String(Date.now()),e=a=>a[(bt(t+a.length)%a.length+a.length)%a.length],s=(a,i)=>{let o=[];for(let c=0;c<i;c++)o.push(a[(bt(t+c+a.length)%a.length+a.length)%a.length]);return[...new Set(o)]};if(!this.querySelector('[slot="name"]')){let a=document.createElement("h2");a.slot="name",a.textContent=e(Fe),this.appendChild(a)}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 a=this.querySelector('[slot="name"]')?.textContent?.trim()||"Persona";this.setAttribute("avatar",ie(a,256))}if(!this.querySelector('[slot="quote"]')){let a=document.createElement("p");a.slot="quote",a.textContent=e(He),this.appendChild(a)}let r=(a,i)=>{if(this.querySelector(`[slot="${a}"]`))return;let o=document.createElement("ul");o.setAttribute("slot",a);for(let c of i){let d=document.createElement("li");d.textContent=c,o.appendChild(d)}this.appendChild(o)};r("goals",s(Ue,3)),r("frustrations",s(Ve,3)),r("behaviors",s(We,3))}#o(){let t=this.personaName,e=this.personaRole,s=this.age,r=this.location,a=this.avatar,i=this.quote,o=B(t),c=a?`background:url(${m(a)}) center/cover`:`background:${o}`;this.shadowRoot.innerHTML=`
|
|
310
310
|
<style>${re}</style>
|
|
311
311
|
|
|
312
312
|
<article class="persona-card" part="card" role="article"
|
|
@@ -315,7 +315,7 @@ var re=`
|
|
|
315
315
|
<header class="persona-header" part="header">
|
|
316
316
|
<div class="avatar" part="avatar" style="${c}"
|
|
317
317
|
role="img" aria-label="Avatar for ${m(t)}">
|
|
318
|
-
${
|
|
318
|
+
${a?"":m(O(t))}
|
|
319
319
|
</div>
|
|
320
320
|
<div class="header-info">
|
|
321
321
|
<div class="persona-name-wrap" part="name">
|
|
@@ -323,16 +323,16 @@ var re=`
|
|
|
323
323
|
</div>
|
|
324
324
|
${e?`<p class="persona-role" part="role">${m(e)}</p>`:""}
|
|
325
325
|
<div class="persona-meta" part="meta">
|
|
326
|
-
${
|
|
326
|
+
${s?`
|
|
327
327
|
<span class="meta-item">
|
|
328
328
|
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/></svg>
|
|
329
|
-
${m(
|
|
329
|
+
${m(s)} years old
|
|
330
330
|
</span>
|
|
331
331
|
`:""}
|
|
332
|
-
${
|
|
332
|
+
${r?`
|
|
333
333
|
<span class="meta-item">
|
|
334
334
|
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></svg>
|
|
335
|
-
${m(
|
|
335
|
+
${m(r)}
|
|
336
336
|
</span>
|
|
337
337
|
`:""}
|
|
338
338
|
</div>
|
|
@@ -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,9 +721,9 @@ 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"})}#s(){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.#s(),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,s]of[["storyId","story-id"],["personaId","persona-id"],["priority","priority"],["status","status"],["points","points"],["epic","epic"],["detail","detail"]])t[e]!=null&&this.setAttribute(s,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 s=e==="acceptance-criteria"?"acceptanceCriteria":e;if(t[s]&&!this.querySelector(`[slot="${e}"]`))if(Array.isArray(t[s])){let r=document.createElement("ul");r.slot=e;for(let a of t[s]){let i=document.createElement("li");i.textContent=String(a),r.appendChild(i)}this.appendChild(r)}else{let r=document.createElement("p");r.slot=e,r.textContent=String(t[s]),this.appendChild(r)}}}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();this._applyData(s),this.#s(),this.#o()}catch(e){console.warn(`[user-story] Failed to load src="${t}":`,e)}}connectedCallback(){this.#s(),this.storyId&&!this.id&&!this.hasAttribute("data-detail-clone")&&(this.id=this.storyId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#o(),this.#i(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded"),this.#t?.disconnect(),this.#t=null}attributeChangedCallback(t,e,s){e!==s&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(s):(this.#o(),t==="persona-id"&&this.#i()))}#i(){if(this.#t?.disconnect(),this.#t=null,!this.personaId||this.#r())return;let t=this.getRootNode(),s=(t&&typeof t.getElementById=="function"?t:document).getElementById(this.personaId);!s||s.tagName!=="USER-PERSONA"||(this.#t=new MutationObserver(()=>this.#o()),this.#t.observe(s,{attributes:!0,attributeFilter:["role"]}))}get persona(){return this.#r()||this.#n()||"user"}get personaId(){return this.getAttribute("persona-id")||""}#r(){return this.querySelector('[slot="persona"]')?.textContent?.trim()||this.#e.get("persona")||""}#n(){if(!this.personaId)return"";let t=this.getRootNode(),s=(t&&typeof t.getElementById=="function"?t:document).getElementById(this.personaId);return!s||s.tagName!=="USER-PERSONA"?"":s.getAttribute("role")?.trim()||""}#a(){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 s=document.createElement("form");s.method="dialog";let r=document.createElement("header"),a=document.createElement("h3");a.textContent=this.storyTitle||this.storyId||"Story Detail";let i=document.createElement("button");i.type="submit",i.setAttribute("aria-label","Close"),i.textContent="\xD7",r.appendChild(a),r.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),s.appendChild(r),s.appendChild(o),e.innerHTML="",e.appendChild(s),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,s=this._detailLevel,r=this.storyId?`User story: ${m(this.storyId)}`:"User story";if(this.shadowRoot){if(s==="minimal"){this.shadowRoot.innerHTML=`
|
|
725
725
|
<style>${vt}</style>
|
|
726
|
-
<article class="story-card story-card--minimal" role="article" aria-label="${
|
|
726
|
+
<article class="story-card story-card--minimal" role="article" aria-label="${r}"
|
|
727
727
|
tabindex="0">
|
|
728
728
|
<div class="story-body">
|
|
729
729
|
${this.storyId?`<span class="story-id">${m(this.storyId)}</span>`:""}
|
|
@@ -732,10 +732,10 @@ var re=`
|
|
|
732
732
|
</div>
|
|
733
733
|
</div>
|
|
734
734
|
</article>
|
|
735
|
-
`;let
|
|
735
|
+
`;let a=this.shadowRoot.querySelector(".story-card--minimal");if(!a)return;a.addEventListener("click",()=>this.showDetail()),a.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
|
-
<article class="story-card story-card--${
|
|
738
|
+
<article class="story-card story-card--${s}" part="card" role="article" aria-label="${r}">
|
|
739
739
|
<header class="story-header" part="header">
|
|
740
740
|
<div class="story-meta">
|
|
741
741
|
${this.storyId?`<span class="story-id" part="id">${m(this.storyId)}</span>`:""}
|
|
@@ -754,8 +754,8 @@ var re=`
|
|
|
754
754
|
|
|
755
755
|
<div class="story-body" part="body">
|
|
756
756
|
<p class="story-statement" part="statement">
|
|
757
|
-
<span class="keyword">As ${this.#
|
|
758
|
-
${this.personaId?`<a class="persona-text persona-text--link" href="#${m(this.personaId)}">${k(E.user)} <slot name="persona"><span>${m(this.#
|
|
757
|
+
<span class="keyword">As ${this.#a()}</span>
|
|
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
|
-
`,
|
|
810
|
+
`,s==="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,14 +1105,14 @@ var re=`
|
|
|
1105
1105
|
.journey__grid-wrap { overflow: visible; }
|
|
1106
1106
|
.row-label, .corner { position: relative; }
|
|
1107
1107
|
}
|
|
1108
|
-
`;var
|
|
1109
|
-
<article class="journey${
|
|
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 s=`${e}-${++Xe}`;n.style.viewTransitionName=s;let r=document.startViewTransition(t);return r.finished.finally(()=>{n.style.viewTransitionName===s&&(n.style.viewTransitionName="")}),r}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 s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status}`);let r=await s.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.__phases=r.phases||[],this._render()}catch(s){e.innerHTML=`<style>${tt}</style><div class="state-msg state-msg--error">Could not load journey: ${m(s.message)}</div>`}}_render(){let t=this._resolve("persona")||"",e=this._resolve("persona-id")||"",s=(this.getAttribute("story-ids")||"").split(",").map(u=>u.trim()).filter(Boolean),r=this.hasAttribute("compact"),a=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
|
+
<article class="journey${r?" journey--compact":""}">
|
|
1110
1110
|
|
|
1111
1111
|
<header class="journey__header">
|
|
1112
1112
|
<div class="journey__header-top">
|
|
1113
1113
|
<div class="journey__chips">
|
|
1114
1114
|
<span class="chip chip--type">Journey Map</span>
|
|
1115
|
-
${
|
|
1115
|
+
${s.map(u=>`<a class="chip chip--story" href="#${u}">${this._label(u)}</a>`).join("")}
|
|
1116
1116
|
</div>
|
|
1117
1117
|
${t?`
|
|
1118
1118
|
<div class="journey__persona">
|
|
@@ -1125,11 +1125,11 @@ var re=`
|
|
|
1125
1125
|
${i?'<div class="journey__summary-wrap"><slot name="summary"></slot></div>':""}
|
|
1126
1126
|
</header>
|
|
1127
1127
|
|
|
1128
|
-
${
|
|
1128
|
+
${a&&a.length?this._curve(a)+this._grid(a):`<div class="journey__placeholder">
|
|
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:a?a.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,18 +1146,18 @@ 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
|
|
1150
|
-
<th class="phase-head" data-emotion="${
|
|
1149
|
+
</div>`}_grid(t){let e=t.map((r,a)=>{let i=R[r.emotion]||R.neutral,o=r.storyIds||[];return`
|
|
1150
|
+
<th class="phase-head" data-emotion="${r.emotion||"neutral"}"
|
|
1151
1151
|
style="--ec:${i.color}">
|
|
1152
|
-
<span class="ph-num">${
|
|
1153
|
-
<span class="ph-name">${m(
|
|
1154
|
-
<span class="ph-emoji" title="${
|
|
1155
|
-
${
|
|
1156
|
-
</th>`}).join(""),
|
|
1152
|
+
<span class="ph-num">${a+1}</span>
|
|
1153
|
+
<span class="ph-name">${m(r.name||"")}</span>
|
|
1154
|
+
<span class="ph-emoji" title="${r.emotion||"neutral"}"><span role="img" aria-label="${m(r.emotion||"neutral")}">${i.emoji}</span></span>
|
|
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(""),s=Ye.map(({key:r,label:a})=>{let i=t.map(o=>{let c=o[r]||[];return c.length?`<td class="data-cell data-cell--${r.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
|
-
<tr class="grid-row grid-row--${
|
|
1160
|
-
<th class="row-label">${
|
|
1159
|
+
<tr class="grid-row grid-row--${r.toLowerCase()}">
|
|
1160
|
+
<th class="row-label">${a}</th>
|
|
1161
1161
|
${i}
|
|
1162
1162
|
</tr>`}).join("");return`
|
|
1163
1163
|
<div class="journey__grid-wrap">
|
|
@@ -1169,7 +1169,7 @@ var re=`
|
|
|
1169
1169
|
${e}
|
|
1170
1170
|
</tr>
|
|
1171
1171
|
</thead>
|
|
1172
|
-
<tbody>${
|
|
1172
|
+
<tbody>${s}</tbody>
|
|
1173
1173
|
</table>
|
|
1174
1174
|
</div>`}_label(t){return t.replace(/^(activity|persona|journey|story|user)-/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};w("user-journey",xt);var et=`
|
|
1175
1175
|
:host {
|
|
@@ -1684,8 +1684,8 @@ 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
|
|
1688
|
-
<article class="empathy-map${
|
|
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 s=await e.json();if(s.persona&&this.setAttribute("persona",s.persona),s.personaId&&this.setAttribute("persona-id",s.personaId),s.title&&!this.querySelector('[slot="title"]')){let r=document.createElement("h2");r.slot="title",r.textContent=s.title,this.appendChild(r)}if(s.summary&&!this.querySelector('[slot="summary"]')){let r=document.createElement("p");r.slot="summary",r.textContent=s.summary,this.appendChild(r)}this.__quadrants=s.quadrants||null,this.__goals=s.goals||null,this.__painPoints=s.painPoints||null,this._render()}catch(e){if(!this.shadowRoot)return;let s=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(s)}</div>`}}}_render(){let t=this._resolve("persona")||"",e=this._resolve("persona-id")||"",s=this.hasAttribute("compact"),r=this.hasAttribute("editable"),a=!!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
|
+
<article class="empathy-map${s?" empathy-map--compact":""}">
|
|
1689
1689
|
|
|
1690
1690
|
<header class="empathy-map__header">
|
|
1691
1691
|
<div class="empathy-map__header-top">
|
|
@@ -1704,55 +1704,55 @@ var re=`
|
|
|
1704
1704
|
</header>
|
|
1705
1705
|
|
|
1706
1706
|
<div class="empathy-map__grid">
|
|
1707
|
-
${_t.map(u=>this._renderQuadrant(u,
|
|
1707
|
+
${_t.map(u=>this._renderQuadrant(u,r)).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,
|
|
1717
|
+
</article>`,l=()=>{this.shadowRoot&&(this.shadowRoot.innerHTML=d,r&&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 s=ft[t],r=this.__quadrants?.[t],a=this._editingQuadrants.has(t),i=r&&r.length?t==="feels"?r.map(c=>this._renderEmotion(c)).join(""):r.map(c=>`<p>${m(c)}</p>`).join(""):`<slot name="${t}"><p class="placeholder">Add ${s.label.toLowerCase()} items\u2026</p></slot>`,o=r?.length?r.join(`
|
|
1718
1718
|
`):"";return`
|
|
1719
|
-
<section class="quadrant quadrant--${t}"${
|
|
1719
|
+
<section class="quadrant quadrant--${t}"${a?" data-editing":""}>
|
|
1720
1720
|
<div class="quadrant__inner">
|
|
1721
1721
|
<div class="quadrant__header">
|
|
1722
|
-
<div class="quadrant__icon" aria-hidden="true">${k(
|
|
1723
|
-
<span class="quadrant__label">${
|
|
1722
|
+
<div class="quadrant__icon" aria-hidden="true">${k(s.icon)}</div>
|
|
1723
|
+
<span class="quadrant__label">${s.label}</span>
|
|
1724
1724
|
${e?`<button class="quadrant__edit-btn" data-quadrant="${t}"
|
|
1725
|
-
aria-label="Edit ${
|
|
1725
|
+
aria-label="Edit ${s.label}" title="Edit ${s.label}">${k(E.pencil)}</button>`:""}
|
|
1726
1726
|
</div>
|
|
1727
1727
|
<div class="quadrant__faces">
|
|
1728
|
-
<div class="quadrant__face quadrant__face--front"${
|
|
1728
|
+
<div class="quadrant__face quadrant__face--front"${a?" inert":""}>
|
|
1729
1729
|
<div class="quadrant__content">
|
|
1730
1730
|
${i}
|
|
1731
1731
|
</div>
|
|
1732
1732
|
</div>
|
|
1733
1733
|
${e?`
|
|
1734
|
-
<div class="quadrant__face quadrant__face--back"${
|
|
1734
|
+
<div class="quadrant__face quadrant__face--back"${a?"":" inert"}>
|
|
1735
1735
|
<textarea class="quadrant__editor" data-quadrant="${t}"
|
|
1736
1736
|
placeholder="One item per line\u2026"
|
|
1737
|
-
aria-label="Edit ${
|
|
1737
|
+
aria-label="Edit ${s.label} items">${m(o)}</textarea>
|
|
1738
1738
|
<button class="quadrant__done-btn" data-quadrant="${t}"
|
|
1739
|
-
aria-label="Done editing ${
|
|
1739
|
+
aria-label="Done editing ${s.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(),
|
|
1744
|
+
</section>`}_renderEmotion(t){let e=t.toLowerCase().trim(),s=R[e];return s?`<span class="emotion-tag" style="--ec:${s.color}"><span role="img" aria-label="${m(t)}">${s.emoji}</span> ${m(t)}</span>`:`<p>${m(t)}</p>`}_renderSummaryRow(t,e,s){let a=(t==="pain-points"?"painPoints":t)==="painPoints"?this.__painPoints:this.__goals,i=a?.length?a.map(o=>`<p>${m(o)}</p>`).join(""):`<slot name="${t}"><p class="placeholder">No ${s.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">
|
|
1748
|
-
<div class="summary-row__label">${
|
|
1748
|
+
<div class="summary-row__label">${s}</div>
|
|
1749
1749
|
<div class="summary-row__content">${i}</div>
|
|
1750
1750
|
</div>
|
|
1751
|
-
</div>`}_bindEditListeners(){let t=this.shadowRoot;t&&(t.querySelectorAll(".quadrant__edit-btn").forEach(e=>{e.addEventListener("click",()=>{let
|
|
1752
|
-
`);else{let
|
|
1753
|
-
`)}}}
|
|
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"}#
|
|
1751
|
+
</div>`}_bindEditListeners(){let t=this.shadowRoot;t&&(t.querySelectorAll(".quadrant__edit-btn").forEach(e=>{e.addEventListener("click",()=>{let s=e.dataset.quadrant;s&&this._openEdit(s)})}),t.querySelectorAll(".quadrant__done-btn").forEach(e=>{e.addEventListener("click",()=>{let s=e.dataset.quadrant;s&&this._closeEdit(s)})}),t.querySelectorAll(".quadrant__editor").forEach(e=>{let s=e;s.addEventListener("keydown",r=>{let a=r;if(a.key==="Escape"){a.preventDefault();let i=s.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 s=e.querySelector(".quadrant__face--front"),r=e.querySelector(".quadrant__face--back");s&&s.setAttribute("inert",""),r&&r.removeAttribute("inert");let a=e.querySelector(".quadrant__editor");if(a){let i=this.__quadrants?.[t];if(i?.length)a.value=i.join(`
|
|
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()??"")}),a.value=d.filter(Boolean).join(`
|
|
1753
|
+
`)}}}a.focus()}}_closeEdit(t){let e=this.shadowRoot?.querySelector(`.quadrant--${t}`);if(!e)return;let s=e.querySelector(".quadrant__editor");if(s){let i=s.value.split(`
|
|
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 r=e.querySelector(".quadrant__face--front"),a=e.querySelector(".quadrant__face--back");r&&r.removeAttribute("inert"),a&&a.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,s,r){t.addEventListener(e,s,r),this.#e.push(()=>t.removeEventListener(e,s,r))}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{e?s.add(t):s.delete(t)}catch{let r=`--${t}`;e?s.add(r):s.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}};function st({newItems:n,nodes:t,keyOf:e,renderItem:s,containerFor:r}){let a=[],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=r(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=s(h),t.set(f,v),a.push(f));let x=l.children[p];x!==v&&l.insertBefore(v,x||null)}return{added:a,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;#s={};#i=null;#r="";#n=null;setup(){this.#r=`ie-${++n.#e}`;let t=[...this.querySelectorAll(":scope > [data-quadrant], :scope > [draggable]")],e=document.createElement("div");e.className="ie-wrapper";let s=document.createElement("div");s.className="ie-y-label",s.setAttribute("aria-hidden","true"),s.textContent="Impact \u2191";let r=document.createElement("div");r.style.cssText="display:flex;flex-direction:column;flex:1;min-width:0;";let a=document.createElement("div");a.className="ie-grid",a.setAttribute("role","region"),a.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.#r),h.setAttribute("aria-label",n.LABELS[l]),h.setAttribute("data-layout","stack"),h.setAttribute("data-layout-gap","xs"),u.appendChild(p),u.appendChild(h),a.appendChild(u),this.#s[l]=h}t.forEach((l,u)=>{let p=l,h=p.getAttribute("data-quadrant")||"quick-wins",f=this.#s[h]||this.#s["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)}r.appendChild(a),r.appendChild(i),e.appendChild(s),e.appendChild(r),this.appendChild(e),this.appendChild(o),this.#t=a,this.#i=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.#i&&(this.#i.remove(),this.#i=null),this.#t=null,this.#s={},this.#o.clear(),this.#a=[]}#a=[];#o=new Map;get items(){if(this.#a.length)return this.#a;let t=[];for(let[e,s]of Object.entries(this.#s))for(let r of s.querySelectorAll(':scope > [draggable="true"]'))t.push({id:r.getAttribute("data-id")||void 0,quadrant:e,text:r.textContent?.trim()||void 0});return t}set items(t){if(!this.#t)return;let e=Array.isArray(t)?t:[];st({newItems:e,nodes:this.#o,keyOf:s=>s.id??`${s.quadrant}:${s.text}`,renderItem:s=>{let r=this;if(typeof r.renderItem=="function"){let i=r.renderItem(s);if(i instanceof Element)return i.hasAttribute("draggable")||i.setAttribute("draggable","true"),i.hasAttribute("data-id")||i.setAttribute("data-id",String(s.id??"")),i}let a=document.createElement("article");return a.className="ie-card",a.setAttribute("draggable","true"),s.id&&a.setAttribute("data-id",String(s.id)),a.textContent=s.text||s.id||"",a},containerFor:s=>this.#s[s.quadrant]||this.#s["quick-wins"]}),this.#a=e,this.dispatchEvent(new CustomEvent("impact-effort:items-changed",{detail:{items:e,source:"property"},bubbles:!0}))}attributeChangedCallback(t,e,s){this.hasAttribute("data-upgraded")&&t==="src"&&s&&s!==e&&this.#c(s)}async#c(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();if(!Array.isArray(s))return;let r=()=>{for(let a of n.QUADRANTS){let i=this.#s[a];if(i)for(let o of[...i.querySelectorAll("[draggable]")])o.remove()}s.forEach((a,i)=>{let o=a.quadrant||"quick-wins",c=a.id||`ie-item-${i}`,d;a.persona||a.action||a.storyId?(d=document.createElement("user-story"),d.setAttribute("detail","minimal"),a.storyId&&d.setAttribute("story-id",a.storyId),a.persona&&d.setAttribute("persona",a.persona),a.action&&d.setAttribute("action",a.action),a.benefit&&d.setAttribute("benefit",a.benefit),a.priority&&d.setAttribute("priority",a.priority),a.status&&d.setAttribute("status",a.status),a.points&&d.setAttribute("points",String(a.points))):(d=document.createElement("article"),d.textContent=a.label||a.text||""),d.setAttribute("draggable","true"),d.dataset.id=c,d.dataset.quadrant=o,(this.#s[o]||this.#s["quick-wins"]).appendChild(d)})};this.hasAttribute("data-upgraded")&&this.#t?M(this,r,"ie-vt"):r(),this.#m()}catch(e){console.warn(`[impact-effort] Failed to load src="${t}":`,e)}}#p(t){for(let[e,s]of Object.entries(this.#s))if(s===t)return e;return null}#l(t){let e=this.#i;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 s=this.#s[e];t[e]=s?s.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")||"",s=this.getAttribute("x-low")||"Low",r=this.getAttribute("x-high")||"High",a=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>${a}</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>${s}</span><span>${r}</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.#g[x]=y}h.appendChild(_),this.#b[x]=_}d.forEach((x,_)=>{let g=x,y=this.#o(g),A=c?this.#m[y]:this.#g[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.#v=h,this.#d=v,this.#h=o,c&&this.listen(this,"drag-surface:transfer",this.#a),this.#t()}#t(){if(typeof ResizeObserver>"u")return;let t=e=>{let s=e.offsetWidth,r=e.offsetHeight;s>0&&e.style.setProperty("--qg-pin-half-w",`${s/2}px`),r>0&&e.style.setProperty("--qg-pin-half-h",`${r/2}px`)};this.#y=new ResizeObserver(e=>{for(let s of e)t(s.target);this.#s()});for(let e of this.querySelectorAll(".qg-pinned"))this.#y.observe(e);this.#s()}#s(){this.#f||(this.#f=requestAnimationFrame(()=>{this.#f=0,this.#i()}))}#i(){for(let e of this.querySelectorAll(".qg-pinned")){let s=e;s.classList.remove("qg-clustered"),s.style.removeProperty("--qg-cluster-i"),s.style.removeProperty("--qg-cluster-n"),delete s.dataset.cluster,s.dataset.qgTabbed!==void 0&&(s.removeAttribute("tabindex"),delete s.dataset.qgTabbed)}let t=0;for(let e=0;e<4;e++){let s=this.#b[e];if(!s)continue;let r=[...s.querySelectorAll(".qg-pinned")];if(r.length<2)continue;let a=r.map(l=>l.getBoundingClientRect()),i=Array.from({length:r.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<r.length;l++)for(let u=l+1;u<r.length;u++)n.#r(a[l],a[u])&&c(l,u);let d=new Map;for(let l=0;l<r.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=r[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.#f&&cancelAnimationFrame(this.#f),this.#f=0}static#r(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 s=0;s<t.length;s++)e=(e<<5)+e+t.charCodeAt(s)|0;return(e%360+360)%360}#a=t=>{let{item:e,fromSurface:s,toSurface:r}=t.detail,a=this.#c(s),i=this.#c(r);a==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:a,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 s=parseFloat(t.getAttribute("data-x")),r=parseFloat(t.getAttribute("data-y"));return n.quadrantFor(s,r)}return 0}static quadrantFor(t,e){let s=t>=.5,r=e>=.5;return r&&s?0:r&&!s?1:!r&&!s?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={};#g={};#b={};#v=null;#d=null;#h=[];#y=null;#f=0};w("quadrant-grid",kt);var ne=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.#s(e)}async#e(t){try{let s=await(await fetch(t)).json();this.#s(Array.isArray(s)?s:[])}catch(e){console.warn("risk-register: failed to load src",t,e),this.#s([])}}static#t(t){let e=[],s=t.content.querySelectorAll("tr");for(let r of s){let a=[...r.children],i=a[0]?.textContent?.trim()||"",o=r.getAttribute("data-id")||i.toLowerCase().replace(/\s+/g,"-")||`risk-${e.length}`;e.push({id:o,title:i,likelihood:parseInt(a[1]?.textContent??"",10)||0,impact:parseInt(a[2]?.textContent??"",10)||0,owner:a[3]?.textContent?.trim()||"",mitigation:a[4]?.textContent?.trim()||""})}return e}#s(t){this.#a=t,[...this.children].forEach(r=>{r.tagName!=="TEMPLATE"&&r.remove()});let e=this.getAttribute("label");if(e){let r=document.createElement("header");r.className="rr-label",r.textContent=e,this.appendChild(r)}let s=document.createElement("div");s.className="rr-layout",s.appendChild(this.#i(t)),s.appendChild(this.#r(t)),this.appendChild(s),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("risk-register:ready",{bubbles:!0,detail:{count:t.length}}))})}#i(t){let e=document.createElement("data-table"),s=document.createElement("table");return s.innerHTML=`
|
|
1756
1756
|
<thead>
|
|
1757
1757
|
<tr>
|
|
1758
1758
|
<th data-sort="string">Title</th>
|
|
@@ -1764,20 +1764,20 @@ var re=`
|
|
|
1764
1764
|
</tr>
|
|
1765
1765
|
</thead>
|
|
1766
1766
|
<tbody>
|
|
1767
|
-
${t.map(
|
|
1768
|
-
<tr data-id="${
|
|
1769
|
-
<td>${
|
|
1770
|
-
<td>${
|
|
1771
|
-
<td>${
|
|
1767
|
+
${t.map(r=>`
|
|
1768
|
+
<tr data-id="${n.#n(r.id)}">
|
|
1769
|
+
<td>${n.#n(r.title)}</td>
|
|
1770
|
+
<td>${r.likelihood||""}</td>
|
|
1771
|
+
<td>${r.impact||""}</td>
|
|
1772
1772
|
<td></td>
|
|
1773
|
-
<td>${
|
|
1774
|
-
<td>${
|
|
1773
|
+
<td>${n.#n(r.owner)}</td>
|
|
1774
|
+
<td>${n.#n(r.mitigation)}</td>
|
|
1775
1775
|
</tr>
|
|
1776
1776
|
`).join("")}
|
|
1777
1777
|
</tbody>
|
|
1778
|
-
`,e.appendChild(
|
|
1779
|
-
`)[0].slice(0,60)||"(unnamed)"}#
|
|
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(s),e}#r(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 s of t){if(!s.likelihood||!s.impact)continue;let r=document.createElement("span"),a=Math.min(1,Math.max(0,s.likelihood/ne)),i=Math.min(1,Math.max(0,s.impact/ne));r.setAttribute("data-x",a.toFixed(3)),r.setAttribute("data-y",i.toFixed(3)),r.setAttribute("data-id",s.id),r.setAttribute("title",`${s.title} \u2014 likelihood ${s.likelihood}, impact ${s.impact}`),r.textContent=s.title,e.appendChild(r)}return e}static#n(t){return String(t??"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}#a=[];get rows(){return[...this.#a]}set rows(t){this.#s(Array.isArray(t)?t:[])}};w("risk-register",Ct);var Et=class n extends C{setup(){let t=this.getAttribute("rows"),e=this.getAttribute("cols"),s=this.getAttribute("link-attr");return!t||!e||!s?(console.warn("traceability-matrix: requires rows, cols, and link-attr attributes"),!1):(queueMicrotask(()=>this.#e(t,e,s)),!0)}#e(t,e,s){let r=[...document.querySelectorAll(t)].filter(g=>g!==this&&!this.contains(g)),a=[...document.querySelectorAll(e)].filter(g=>g!==this&&!this.contains(g));if(!r.length||!a.length){this.#i();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 r){let y=n.#r(g.getAttribute(s));for(let A of y){let S=a.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 a){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 r){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.#r(g.getAttribute(s));for(let $ of a){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.#a=p,this.#o=new Map(r.map(g=>[g.id,g])),this.#c=new Map(a.map(g=>[g.id,g])),this.listen(p,"click",this.#t),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("traceability-matrix:ready",{bubbles:!0,detail:{rowCount:r.length,colCount:a.length,linkCount:d.length}}))})}#t=t=>{let e=t.target.closest('td, th[scope="row"]');if(!e)return;let s=e.closest("tr");if(!s)return;let r=s.dataset.rowId,a=e.dataset.colId,i=r?this.#o.get(r):null,o=a?this.#c.get(a):null,c=e.hasAttribute("data-state-highlighted");if(this.#s(),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",""),s.setAttribute("data-state-highlighted",""),this.dispatchEvent(new CustomEvent("traceability-matrix:highlight",{bubbles:!0,detail:{rowEl:i,colEl:o,on:!0}}))};#s(){this.#a&&(this.#a.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")}))}#i(){[...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#r(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)"}#a=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"),s=parseFloat(this.getAttribute("total")||"");if(!t||!e||!Number.isFinite(s))return console.warn("burndown-chart: requires start, end, and total attributes"),!1;let r=n.#s(t),a=n.#s(e);if(!r||!a||a<r)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.#r(r,a),h=n.#n(p,s,i),f=n.#a(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:s,scopeChanges:u.length}}))}),!0}#e({label:t,unit:e,dayLabels:s,actual:r,ideal:a,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={};s.forEach((u,p)=>{c[u]=a[p],r[p]!==null&&(d[u]=r[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=[],s=t.content.querySelectorAll("tr");for(let r of s){let a=[...r.children],i=a[0]?.textContent?.trim(),o=parseFloat(a[1]?.textContent??""),c=parseFloat(a[2]?.textContent??"0")||0;!i||!Number.isFinite(o)||e.push({date:i,remaining:o,delta:c})}return e}static#s(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#i(t){let e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}static#r(t,e){let s=[];for(let r=t.getTime();r<=e.getTime();r+=Ke)s.push(n.#i(new Date(r)));return s}static#n(t,e,s){let r=l=>{let u=n.#s(l);if(!u)return!1;let p=u.getDay();return p===0||p===6},a=t.map((l,u)=>({d:l,i:u,weekend:r(l)})).filter(l=>s||!l.weekend),i=a.length>1?e/(a.length-1):0,o=new Array(t.length).fill(null),c=e,d=0;for(let l=0;l<t.length;l++){let u=r(t[l]);s||!u?(o[l]=Math.max(0,e-i*d),d++,c=o[l]):o[l]=c}return o}static#a(t,e){let s=new Map(e.map(r=>[r.date,r.remaining]));return t.map(r=>s.has(r)?s.get(r):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.#x=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 s=n.#b(t,"start"),r=n.#b(e,"end");return!s||!r||r<=s?(console.warn("product-roadmap: invalid start/end",t,e),!1):(this.#d=s,this.#h=r,this.#y=r.getTime()-s.getTime(),this.#f=this.getAttribute("view")==="month"?"month":"quarter",this.#w=this.hasAttribute("editable"),!0)}attributeChangedCallback(t,e,s){e!==s&&(!this.isConnected||!this.#x.length||this.#e()&&this.#t())}#t(){[...this.children].forEach(r=>{this.#x.includes(r)||r.remove()}),this.#x.forEach(r=>{r.hidden=!0});let t=document.createElement("div");t.className="rm-wrapper";let e=this.#s();t.appendChild(e);let s=document.createElement("div");s.className="rm-lanes";for(let r of this.#x){let a=r.getAttribute("data-lane")||"",i=document.createElement("section");i.className="rm-lane",i.dataset.lane=a;let o=document.createElement("header");o.className="rm-lane-label",o.textContent=a,i.appendChild(o);let c=document.createElement("div");c.className="rm-track",c.dataset.lane=a;let d=[...r.querySelectorAll(":scope > article[data-start][data-end]")];for(let l of d){let u=this.#i(l,a);u&&c.appendChild(u)}this.#w&&(c.addEventListener("dragover",this.#c),c.addEventListener("drop",this.#p)),i.appendChild(c),s.appendChild(i)}if(t.appendChild(s),this.hasAttribute("today-marker")&&this.#d&&this.#h){let r=new Date;if(r>=this.#d&&r<=this.#h){let a=document.createElement("div");a.className="rm-today",a.style.setProperty("--rm-x",this.#l(r).toFixed(4)),a.title=`Today: ${n.#v(r)}`,s.appendChild(a)}}this.appendChild(t),this.#_=t}#s(){let t=document.createElement("header");t.className="rm-axis";let e=this.#g();for(let s of e){let r=document.createElement("div");r.className="rm-tick",r.style.setProperty("--rm-x",s.startFraction.toFixed(4)),r.style.setProperty("--rm-w",(s.endFraction-s.startFraction).toFixed(4)),r.textContent=s.label,t.appendChild(r)}return t}#i(t,e){let s=n.#b(t.getAttribute("data-start"),"start"),r=n.#b(t.getAttribute("data-end"),"end");if(!s||!r||!this.#d||!this.#h)return null;let a=s<this.#d?this.#d:s,i=r>this.#h?this.#h:r;if(a>=i)return null;let o=this.#l(a),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.#v(s),d.dataset.end=n.#v(r),t.dataset.status&&(d.dataset.status=t.dataset.status),t.id&&(d.dataset.sourceId=t.id),this.#w&&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.#A||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.#w){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.#r(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.#C=e}),d.addEventListener("dragend",()=>{this.#k=null,this.#C=null})}return d}#r(t,e,s){if(t.button!==0)return;t.preventDefault();let r=e.parentElement.getBoundingClientRect(),a=t.clientX,i=parseFloat(e.style.getPropertyValue("--rm-x"))||0,o=parseFloat(e.style.getPropertyValue("--rm-w"))||0;this.#A={kind:"move",bar:e,initiative:s,trackRect:r,startX:a,startFraction:i,widthFraction:o},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#a),e.addEventListener("pointerup",this.#o),e.addEventListener("pointercancel",this.#o)}#n(t,e,s){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let r=e.parentElement.getBoundingClientRect(),a=t.clientX,i=parseFloat(e.style.getPropertyValue("--rm-x"))||0,o=parseFloat(e.style.getPropertyValue("--rm-w"))||0;this.#A={kind:"resize",bar:e,initiative:s,trackRect:r,startX:a,startFraction:i,widthFraction:o},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#a),e.addEventListener("pointerup",this.#o),e.addEventListener("pointercancel",this.#o)}#a=t=>{if(!this.#A)return;let{kind:e,bar:s,trackRect:r,startX:a,startFraction:i,widthFraction:o}=this.#A,c=(t.clientX-a)/r.width;if(e==="move"){let d=Math.max(0,Math.min(1-o,i+c));s.style.setProperty("--rm-x",d.toFixed(4))}else if(e==="resize"){let d=Math.max(.02,Math.min(1-i,o+c));s.style.setProperty("--rm-w",d.toFixed(4))}};#o=t=>{if(!this.#A)return;let{kind:e,bar:s,initiative:r}=this.#A;s.releasePointerCapture(t.pointerId),s.removeEventListener("pointermove",this.#a),s.removeEventListener("pointerup",this.#o),s.removeEventListener("pointercancel",this.#o);let a=parseFloat(s.style.getPropertyValue("--rm-x"))||0,i=parseFloat(s.style.getPropertyValue("--rm-w"))||0,o=this.#m(this.#u(a)),c=this.#m(this.#u(a+i));s.dataset.start=n.#v(o),s.dataset.end=n.#v(c);let d=this.#l(o),l=this.#l(c)-d;s.style.setProperty("--rm-x",d.toFixed(4)),s.style.setProperty("--rm-w",l.toFixed(4)),r&&(r.setAttribute("data-start",s.dataset.start??""),r.setAttribute("data-end",s.dataset.end??"")),this.dispatchEvent(new CustomEvent(e==="move"?"product-roadmap:reschedule":"product-roadmap:resize",{bubbles:!0,detail:{initiative:r,lane:s.dataset.lane,start:s.dataset.start,end:s.dataset.end}})),setTimeout(()=>{this.#A=null},0)};#c=t=>{this.#k&&(t.preventDefault(),t.dataTransfer.dropEffect="move")};#p=t=>{if(!this.#k)return;t.preventDefault();let e=t.currentTarget.dataset.lane,s=this.#k,r=this.#C;if(e===r)return;let a=this.#x.find(i=>i.getAttribute("data-lane")===e);a&&a.appendChild(s),this.dispatchEvent(new CustomEvent("product-roadmap:move",{bubbles:!0,detail:{initiative:s,fromLane:r,toLane:e,start:s.getAttribute("data-start"),end:s.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.#y))}#u(t){let e=this.#d??new Date;return new Date(e.getTime()+t*this.#y)}#m(t){if(this.#f==="month")return new Date(t.getFullYear(),t.getMonth(),1);let e=t.getMonth(),s=Math.floor(e/3)*3;return new Date(t.getFullYear(),s,1)}#g(){let t=[],e=this.#d,s=this.#h;if(!e||!s)return t;if(this.#f==="quarter"){let r=this.#m(e);for(;r<s;){let a=new Date(r.getFullYear(),r.getMonth()+3,1),i=this.#l(r<e?e:r),o=this.#l(a>s?s:a),c=Math.floor(r.getMonth()/3)+1;t.push({startFraction:i,endFraction:o,label:`Q${c} ${r.getFullYear()}`}),r=a}}else{let r=new Date(e.getFullYear(),e.getMonth(),1);for(;r<s;){let a=new Date(r.getFullYear(),r.getMonth()+1,1),i=this.#l(r<e?e:r),o=this.#l(a>s?s:a),c=r.toLocaleString(void 0,{month:"short"});t.push({startFraction:i,endFraction:o,label:`${c} ${r.getFullYear()}`}),r=a}}return t}static#b(t,e){if(!t)return null;let s=String(t).match(/^(\d{4})-Q([1-4])$/i);if(s){let i=Number(s[1]),c=(Number(s[2])-1)*3;return e==="end"?new Date(i,c+3,0):new Date(i,c,1)}let r=String(t).match(/^(\d{4})-(\d{2})-(\d{2})/);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3]));let a=new Date(t);return isNaN(a.getTime())?null:a}static#v(t){let e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}#d=null;#h=null;#y=0;#f="quarter";#w=!1;#x=[];#_=null;#A=null;#k=null;#C=null};w("product-roadmap",$t);function oe(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 s=e||[],r=st({newItems:s,nodes:this.#t,keyOf:this.constructor.keyOf,renderItem:a=>this._renderItem(a),containerFor:(a,i)=>this._containerFor(a,i)});this.#e=s,this._postRender({...r,items:s}),this._emit("items-changed",{items:s},"api")}_renderItem(e){throw new Error(`${this.constructor.name}: must implement _renderItem(item)`)}_containerFor(e,s){return this}_postRender(e){}_emit(e,s,r="api"){this.dispatchEvent(new CustomEvent(`${this.localName}:${e}`,{detail:{...s,source:r},bubbles:!0}))}_nodeFor(e){return this.#t.get(e)||null}_seedCollection(e,s){this.#e=e,this.#t.clear();for(let[r,a]of s)this.#t.set(r,a)}_setItemsSilently(e){this.#e=e}}}var qt=class n extends oe(C){static get observedAttributes(){return["src","compact","title"]}static keyOf(t){return t.id??t.storyId}static#e=0;#t=null;#s={};#i={};#r=null;#n="";#a=[];#o=null;setup(){this.#n=`kb-${++n.#e}`;let t=[...this.querySelectorAll(":scope > section[data-column]")];this.#a=t.map(a=>{let i=a.getAttribute("data-column")||"",c=a.getAttribute("data-column-label")||""||this.#h(i),d=a.getAttribute("data-wip"),l=d?parseInt(d,10):null,u=a.getAttribute("data-column-color")||null,p=[...a.children];return{id:i,label:c,wip:l,color:u,children:p}});for(let a of t)a.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 a of this.#a){let i=document.createElement("section");i.className="kb-column",i.setAttribute("data-column-id",a.id),a.color&&i.setAttribute("data-column-tint",a.color);let o=document.createElement("header");o.className="kb-column-header";let c=document.createElement("h3");c.textContent=a.label;let d=document.createElement("output");if(d.className="kb-count",d.textContent=String(a.children.length),c.appendChild(d),a.wip!==null&&!isNaN(a.wip)){let u=document.createElement("span");u.className="kb-wip",u.textContent=`/ ${a.wip}`,u.setAttribute("aria-label",`WIP limit ${a.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",`${a.label} items`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),a.children.length>0){for(let u of a.children)u.hasAttribute("draggable")||u.setAttribute("draggable","true"),u.hasAttribute("data-id")||(u.dataset.id=`kb-item-${e}`),l.appendChild(u);e+=a.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.#s[a.id]=l,this.#i[a.id]=i,a.wip!==null&&a.children.length>a.wip&&i.setAttribute("data-wip-exceeded","")}let s=this.getAttribute("title");if(s){let a=document.createElement("h2");a.className="kb-title",a.textContent=s,this.appendChild(a)}this.appendChild(this.#t),this.#r=document.createElement("div"),this.#r.className="kb-live-region",this.#r.setAttribute("role","status"),this.#r.setAttribute("aria-live","polite"),this.#r.setAttribute("aria-atomic","true"),this.appendChild(this.#r),this.listen(this,"drag-surface:reorder",a=>{let i=a.detail,o=a.target.closest("drag-surface"),c=this.#m(o);c&&(this.#g(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",a=>{let i=a.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.#g(d),this.#g(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.#b(d),b=this.#b(l);this.#v(`${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.#a.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 r=this.getAttribute("src");if(r){this._loadSrc(r);return}this.dispatchEvent(new CustomEvent("kanban-board:ready",{bubbles:!0,detail:{columnCount:this.#a.length,itemCount:e}}))}#c(){let t=[],e=new Map;for(let[s,r]of Object.entries(this.#s)){let a=r.querySelectorAll(':scope > [draggable="true"]');for(let i of a){let o=i.getAttribute("data-id");o&&(t.push({id:o,column:s}),e.set(o,i))}}this._seedCollection(t,e)}#p(t){let e=[],s=new Map;for(let r of this.items){let a=String(r.id??r.storyId??"");a&&s.set(a,r)}for(let[r,a]of Object.entries(this.#s)){let i=a.querySelectorAll(':scope > [draggable="true"]');for(let o of i){let c=o.getAttribute("data-id");if(!c)continue;let d=s.get(c);e.push(d?{...d,column:r}:{id:c,column:r})}}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.#r&&(this.#r.remove(),this.#r=null),this.#s={},this.#i={},this.#a=[]}get columns(){return this.#a.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:[]})),s=this.#t;this.#s={},this.#i={},this.#a=e;let r=this.#u();this.#t=r;let a=()=>{s&&s.remove(),this.appendChild(r)};this.hasAttribute("data-upgraded")&&s?M(this,a,"kb-vt"):a()}get renderItem(){return this.#o}set renderItem(t){this.#o=typeof t=="function"?t:null}_renderItem(t){let e;if(this.#o){let s=this.#o(t);if(!(s instanceof Element))throw new Error("kanban-board: renderItem must return an Element");e=s}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 s=this.#s[t.column];if(!s)throw new Error(`kanban-board: no column "${t.column}" \u2014 set .columns first or include item.column matching an existing column id`);let r=s.querySelector(":scope > .kb-empty");return r&&r.remove(),s}_postRender(){for(let t of Object.keys(this.#s)){this.#g(t);let e=this.#s[t],s=e.querySelectorAll(':scope > [draggable="true"]'),r=e.querySelector(":scope > .kb-empty");if(s.length===0&&!r){let a=document.createElement("p");a.className="kb-empty",a.textContent="No items",e.appendChild(a)}else s.length>0&&r&&r.remove()}}#l(t){let e=customElements.get("work-item")?"work-item":"article",s=document.createElement(e);return e==="work-item"?s.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}:(s.className="kb-card",s.textContent=t.title||t.label||t.id),s}#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.#a){let s=document.createElement("section");s.className="kb-column",s.setAttribute("data-column-id",e.id),e.color&&s.setAttribute("data-column-tint",e.color);let r=document.createElement("header");r.className="kb-column-header";let a=document.createElement("h3");a.textContent=e.label;let i=document.createElement("output");if(i.className="kb-count",i.textContent="0",a.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}`),a.appendChild(d)}r.appendChild(a),s.appendChild(r);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),s.appendChild(o),t.appendChild(s),this.#s[e.id]=o,this.#i[e.id]=s}return t}attributeChangedCallback(t,e,s){e===s||!this.isConnected||t==="src"&&this._loadSrc(s)}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();for(;this.firstChild;)this.firstChild.remove();for(let a of s.columns||[]){let i=document.createElement("section");i.setAttribute("data-column",a.id),a.label&&i.setAttribute("data-column-label",a.label),a.wip!=null&&i.setAttribute("data-wip",String(a.wip)),a.color&&i.setAttribute("data-column-color",a.color);for(let o of a.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 r=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,r,"kb-vt"):r()}catch(e){console.warn(`[kanban-board] Failed to load src="${t}":`,e)}}#m(t){if(!t)return null;for(let[e,s]of Object.entries(this.#s))if(s===t)return e;return null}#g(t){let e=this.#s[t],s=this.#i[t];if(!e||!s)return;let r=e.querySelectorAll(':scope > [draggable="true"]').length,a=s.querySelector(".kb-count");a&&(a.textContent=String(r));let i=this.#a.find(o=>o.id===t);i?.wip!==null&&i?.wip!==void 0&&(r>i.wip?s.setAttribute("data-wip-exceeded",""):s.removeAttribute("data-wip-exceeded"))}#b(t){return this.#a.find(s=>s.id===t)?.label||this.#h(t)}#v(t){this.#r&&(this.#r.textContent="",requestAnimationFrame(()=>{this.#r&&(this.#r.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;#s=null;#i={};#r=null;#n="";#a=[];setup(){this.#n=`sm-${++n.#e}`;let t=[...this.querySelectorAll(":scope > section[data-activity]")];this.#a=t.map(a=>{let i=a.getAttribute("data-activity")||"",c=a.getAttribute("data-activity-label")||""||this.#u(i),d=a.getAttribute("data-journey-phase")||null,l=[...a.children];return{id:i,label:c,journeyPhase:d,children:l}});for(let a of t)a.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.#s=document.createElement("div"),this.#s.className="sm-columns";let e=0;for(let a of this.#a){let i=document.createElement("section");i.className="sm-column",i.setAttribute("data-activity-column",a.id);let o=document.createElement("header");o.className="sm-activity-header";let c=document.createElement("h3");c.textContent=a.label;let d=document.createElement("span");d.className="sm-activity-count",d.textContent=String(a.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",`${a.label} stories`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),a.children.length>0){for(let u of a.children)l.appendChild(u);e+=a.children.length}else{let u=document.createElement("p");u.className="sm-empty",u.textContent="No stories yet",l.appendChild(u)}i.appendChild(l),this.#s.appendChild(i),this.#i[a.id]=l}let s=this.getAttribute("title");if(s){let a=document.createElement("h2");a.className="sm-title",a.textContent=s,this.appendChild(a)}this.#t.appendChild(this.#s),this.appendChild(this.#t),this.#r=document.createElement("div"),this.#r.className="sm-live-region",this.#r.setAttribute("role","status"),this.#r.setAttribute("aria-live","polite"),this.#r.setAttribute("aria-atomic","true"),this.appendChild(this.#r),this.listen(this,"drag-surface:reorder",a=>{let i=a.detail,o=a.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",a=>{let i=a.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 r=this.getAttribute("src");if(r){this._loadSrc(r);return}this.dispatchEvent(new CustomEvent("story-map:ready",{bubbles:!0,detail:{activityCount:this.#a.length,storyCount:e}}))}teardown(){this.#t&&(this.#t.remove(),this.#t=null),this.#r&&(this.#r.remove(),this.#r=null),this.#s=null,this.#i={},this.#a=[]}get activities(){return this.#a.map(t=>({id:t.id,label:t.label,journeyPhase:t.journeyPhase||void 0,stories:[...this.#i[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 r of e){let a=document.createElement("section");a.setAttribute("data-activity",r.id||""),r.label&&a.setAttribute("data-activity-label",r.label),r.journeyPhase&&a.setAttribute("data-journey-phase",r.journeyPhase);for(let i of r.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)),a.appendChild(o)}this.appendChild(a)}let s=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,s,"sm-vt"):s(),this.dispatchEvent(new CustomEvent("story-map:activities-changed",{detail:{activities:e,source:"property"},bubbles:!0}))}attributeChangedCallback(t,e,s){e===s||!this.isConnected||t==="src"&&this._loadSrc(s)}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();for(;this.firstChild;)this.firstChild.remove();for(let a of s.activities||[]){let i=document.createElement("section");i.setAttribute("data-activity",a.id),i.setAttribute("data-activity-label",a.label||a.id),a.journeyPhase&&i.setAttribute("data-journey-phase",a.journeyPhase);for(let o of a.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 r=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#t?M(this,r,"sm-vt"):r()}catch(e){console.warn(`[story-map] Failed to load src="${t}":`,e)}}#o(t){if(!t)return null;for(let[e,s]of Object.entries(this.#i))if(s===t)return e;return null}#c(t){let e=this.#i[t];if(!e)return;let s=e.querySelectorAll(':scope > [draggable="true"]').length,r=e.closest("[data-activity-column]");if(!r)return;let a=r.querySelector(".sm-activity-count");a&&(a.textContent=String(s))}#p(t){this.#r&&(this.#r.textContent="",requestAnimationFrame(()=>{this.#r&&(this.#r.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 rt=`
|
|
1781
1781
|
:host {
|
|
1782
1782
|
display: block;
|
|
1783
1783
|
position: relative;
|
|
@@ -2225,32 +2225,32 @@ 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 s=0;s<n.length;s++){let r=n.key(s);r&&r.startsWith(t)&&e.push(r)}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 ce(n){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${n}:`}function le(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 s={data:e,timestamp:Date.now()};await j().setRaw(Nt(n,t),JSON.stringify(s))},async get(n,t,e){let s=await j().getRaw(Nt(n,t));if(s==null)return null;let r=le(s);return!r||e?.maxAge!=null&&Date.now()-r.timestamp>e.maxAge?null:r.data},async remove(n,t){await j().removeRaw(Nt(n,t))},async list(n){let t=ce(n),e=await j().keys(t),s=[];for(let r of e){let a=await j().getRaw(r);if(a==null)continue;let i=le(a);i&&s.push({key:r.slice(t.length),data:i.data,timestamp:i.timestamp})}return s},async clear(n){let t=ce(n),e=await j().keys(t);for(let s of e)await j().removeRaw(s)},async clearAll(){let n=await j().keys("vb:");for(let t of n)await j().removeRaw(t)},async setMany(n,t){for(let[e,s]of t)await it.set(n,e,s)}};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:s=Ge,duration:r=1500}=t;try{await navigator.clipboard.writeText(n)}catch{return!1}return ue({button:e,duration:r,announceMessage:s,eventDetail:{text:n}}),!0}function ue({button:n,duration:t,announceMessage:e,eventDetail:s,state:r="copied",eventName:a="copy"}){if(n){n.dataset.state=r;let i=Tt.get(n);i&&clearTimeout(i),Tt.set(n,setTimeout(()=>{delete n.dataset.state,Tt.delete(n)},t)),n.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:s}))}ss(e,n??document.body)}async function ts(n,t={}){let{button:e,announceMessage:s=Ze,duration:r=1500}=t,a;try{a=await navigator.clipboard.readText()}catch{return null}return n&&("value"in n&&(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)?n.value=a:n.textContent=a,n.dispatchEvent(new Event("input",{bubbles:!0}))),ue({button:e,duration:r,announceMessage:s,eventDetail:{text:a},state:"pasted",eventName:"paste"}),a}function de(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;ts(e,{button:n});return}let t=es(n);t&&zt(t,{button:n})}))}function es(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 ss(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",()=>de()):de();var rs=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let s=e;s.matches(Mt)&&Lt(s),s.querySelectorAll(Mt).forEach(r=>Lt(r))}});rs.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 s=this.#e.get(t);if(!s)throw new Error(`Pin ${t} not found`);return Object.assign(s,e),s}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#s(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.#s(e),t}async update(t,e){let s=await this.#t(),r=s.findIndex(a=>a.id===t);if(r===-1)throw new Error(`Pin ${t} not found`);return Object.assign(s[r],e),await this.#s(s),s[r]}async remove(t){let e=(await this.#t()).filter(s=>s.id!==t);await this.#s(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 s=await fetch(`${this.#e}/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.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.#s(),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.#s(),this._loadFromAdapter()):this._render())}#s(){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>${rt}</style><div class="state-msg">Loading\u2026</div>`;try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();this.__pins=Array.isArray(s)?s:s.pins||[],this._render()}catch(e){let s=e instanceof Error?e.message:String(e);this.shadowRoot.innerHTML=`<style>${rt}</style><div class="state-msg state-msg--error">Could not load pins: ${m(s)}</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.#i().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(s=>s.id===t);e&&(this.__adapter&&await this.__adapter.remove(t),this.__pins=this.__pins.filter(s=>s.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(r=>r.id===t);if(!e)return;let s={resolved:!0,resolvedBy:this.getAttribute("author")||"Anonymous",resolvedAt:new Date().toISOString()};this.__adapter&&await this.__adapter.update(t,s),Object.assign(e,s),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(r=>r.id===t);if(!e)return;let s={resolved:!1,resolvedBy:null,resolvedAt:null};this.__adapter&&await this.__adapter.update(t,s),Object.assign(e,s),this._render(),this.#c("Pin re-opened"),this.dispatchEvent(new CustomEvent("review-surface:update",{bubbles:!0,composed:!0,detail:{pin:e,changes:s}}))}exportPins(){return structuredClone(this.__pins)}importPins(t){this.__pins=Array.isArray(t)?structuredClone(t):[],this._activePin=null,this._render()}#i(){let t=this.hasAttribute("show-resolved");return this.__pins.filter(e=>t||!e.resolved).sort((e,s)=>new Date(e.createdAt??0).getTime()-new Date(s.createdAt??0).getTime())}_render(){if(!this.shadowRoot)return;let t=this.hasAttribute("editable"),e=this.#i(),s=this._activePin?this.__pins.find(r=>r.id===this._activePin):null;this.setAttribute("pin-count",String(e.length)),this.shadowRoot.innerHTML=`<style>${rt}</style>
|
|
2229
2229
|
<div class="rs-container">
|
|
2230
2230
|
<slot></slot>
|
|
2231
2231
|
<div class="rs-overlay" role="img" aria-label="Review annotation surface">
|
|
2232
|
-
${e.map((a
|
|
2232
|
+
${e.map((r,a)=>this._renderPin(r,a+1)).join("")}
|
|
2233
2233
|
</div>
|
|
2234
|
-
${
|
|
2234
|
+
${s?this._renderPopover(s,t):""}
|
|
2235
2235
|
</div>
|
|
2236
2236
|
${t?this._renderToolbar(e.length):""}
|
|
2237
|
-
<div class="rs-live" aria-live="polite" aria-atomic="true"></div>`,this._bindListeners(t),this.dispatchEvent(new CustomEvent("review-surface:ready",{bubbles:!0,composed:!0,detail:{pinCount:e.length}}))}_renderPin(t,e){let
|
|
2237
|
+
<div class="rs-live" aria-live="polite" aria-atomic="true"></div>`,this._bindListeners(t),this.dispatchEvent(new CustomEvent("review-surface:ready",{bubbles:!0,composed:!0,detail:{pinCount:e.length}}))}_renderPin(t,e){let s=t.text?t.text.slice(0,50):"Empty pin";return`<button class="rs-pin"
|
|
2238
2238
|
data-pin-id="${m(t.id)}"
|
|
2239
2239
|
${t.resolved?"data-resolved":""}
|
|
2240
2240
|
${this._activePin===t.id?"data-active":""}
|
|
2241
2241
|
style="left:${t.x}%;top:${t.y}%"
|
|
2242
|
-
aria-label="Pin ${e}: ${m(
|
|
2242
|
+
aria-label="Pin ${e}: ${m(s)}"
|
|
2243
2243
|
aria-expanded="${this._activePin===t.id}"
|
|
2244
2244
|
aria-haspopup="dialog">
|
|
2245
2245
|
<span class="rs-pin__number">${e}</span>
|
|
2246
|
-
</button>`}_renderPopover(t,e){let
|
|
2246
|
+
</button>`}_renderPopover(t,e){let s=this.#i().findIndex(r=>r.id===t.id)+1;return`<div class="rs-popover" data-open
|
|
2247
2247
|
style="left:${Math.min(t.x,70)}%;top:${t.y}%"
|
|
2248
2248
|
role="dialog"
|
|
2249
2249
|
aria-labelledby="rs-popover-title-${m(t.id)}">
|
|
2250
2250
|
|
|
2251
2251
|
<div class="rs-popover__header">
|
|
2252
2252
|
<span class="rs-popover__title" id="rs-popover-title-${m(t.id)}">
|
|
2253
|
-
Pin ${
|
|
2253
|
+
Pin ${s}
|
|
2254
2254
|
${t.resolved?`<span class="rs-resolved-badge">${k(E.checkCircle)} Resolved</span>`:""}
|
|
2255
2255
|
</span>
|
|
2256
2256
|
<div class="rs-popover__actions">
|
|
@@ -2272,21 +2272,21 @@ 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>
|
|
2279
2279
|
|
|
2280
2280
|
${t.replies?.length?`
|
|
2281
2281
|
<div class="rs-replies">
|
|
2282
|
-
${t.replies.map(
|
|
2282
|
+
${t.replies.map(r=>`
|
|
2283
2283
|
<div class="rs-reply">
|
|
2284
2284
|
<div class="rs-comment__meta">
|
|
2285
|
-
<span class="rs-comment__avatar" style="background:${B(
|
|
2286
|
-
<span class="rs-comment__author">${m(
|
|
2287
|
-
<span class="rs-comment__time">${this.#
|
|
2285
|
+
<span class="rs-comment__avatar" style="background:${B(r.author||"Anonymous")}">${O(r.author||"Anonymous")}</span>
|
|
2286
|
+
<span class="rs-comment__author">${m(r.author||"Anonymous")}</span>
|
|
2287
|
+
<span class="rs-comment__time">${this.#o(r.createdAt)}</span>
|
|
2288
2288
|
</div>
|
|
2289
|
-
<div class="rs-comment__text">${m(
|
|
2289
|
+
<div class="rs-comment__text">${m(r.text)}</div>
|
|
2290
2290
|
</div>
|
|
2291
2291
|
`).join("")}
|
|
2292
2292
|
</div>`:""}
|
|
@@ -2294,7 +2294,7 @@ var re=`
|
|
|
2294
2294
|
${e?`
|
|
2295
2295
|
<div class="rs-input">
|
|
2296
2296
|
<textarea class="rs-input__field" placeholder="Reply\u2026" rows="1"
|
|
2297
|
-
aria-label="Reply to pin ${
|
|
2297
|
+
aria-label="Reply to pin ${s}"></textarea>
|
|
2298
2298
|
<button class="rs-input__submit" data-action="reply" data-pin-id="${m(t.id)}"
|
|
2299
2299
|
aria-label="Send reply">${k(E.send)}</button>
|
|
2300
2300
|
</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(a=>{a.addEventListener("click",i=>{i.stopPropagation();let o=a.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 s=e.querySelector(".rs-overlay");s&&t&&s.addEventListener("click",a=>{if(!this._annotating)return;let i=a;if(i.target?.closest(".rs-pin"))return;let c=s.getBoundingClientRect(),d=(i.clientX-c.left)/c.width*100,l=(i.clientY-c.top)/c.height*100;this.#r(d,l)}),e.querySelectorAll("[data-action]").forEach(a=>{a.addEventListener("click",i=>{i.stopPropagation();let o=a.dataset.action,c=a.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.#a();break;case"reply":this.#n(c);break}})});let r=e.querySelector(".rs-input__field");r&&r.addEventListener("keydown",a=>{let i=a;if(i.key==="Enter"&&!i.shiftKey){i.preventDefault();let c=e.querySelector('[data-action="reply"]')?.dataset.pinId;c&&this.#n(c)}}),e.addEventListener("keydown",a=>{a.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#r(t,e){let s=this.getAttribute("author")||"Anonymous",r=await this.addPin({x:t,y:e,text:"",author:s});this._activePin=r.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 s=e.value.trim();if(!s)return;let r=this.__pins.find(i=>i.id===t);if(!r)return;let a={id:crypto.randomUUID(),text:s,author:this.getAttribute("author")||"Anonymous",createdAt:new Date().toISOString()};r.replies||(r.replies=[]),r.text?(r.replies.push(a),this.__adapter&&await this.__adapter.update(t,{replies:r.replies})):(r.text=s,this.__adapter&&await this.__adapter.update(t,{text:s})),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:r,changes:{replies:r.replies}}}))}async#a(){let t=JSON.stringify(this.exportPins(),null,2);if(await zt(t,{announceMessage:"Pins copied to clipboard"}))return;let s=new Blob([t],{type:"application/json"}),r=URL.createObjectURL(s),a=document.createElement("a");a.href=r,a.download="review-pins.json",a.click(),URL.revokeObjectURL(r),this.#c("Pins exported as file")}#o(t){if(!t)return"";try{let e=new Date(t),r=new Date().getTime()-e.getTime(),a=Math.floor(r/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;let i=Math.floor(a/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,as=H*91,he=H*365;function Y(n){return typeof n=="number"?n:new Date(n).getTime()}function is(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<=he?t=>t.toLocaleDateString(void 0,{month:"short",year:"2-digit"}):t=>t.toLocaleDateString(void 0,{year:"numeric"})}function ns(n){return n<=jt*3?"day":n<=ct*3?"week":n<=he?"month":"quarter"}function pe(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;#s=null;#i=[];#r=0;#n=0;#a=0;setup(){let t=this.querySelector(":scope > table");return!t||(this.#i=this.#p(t),this.#i.length===0)?!1:(this.#r=Math.min(...this.#i.map(e=>e.start)),this.#n=Math.max(...this.#i.map(e=>e.end)),this.#a=this.#n-this.#r,this.#a<=0&&(this.#a=H),this.#l(t),this.dispatchEvent(new CustomEvent("gantt-chart:ready",{bubbles:!0,detail:{taskCount:this.#i.length,dateRange:{start:new Date(this.#r).toISOString(),end:new Date(this.#n).toISOString()}}})),!0)}teardown(){this.#s&&(this.#s.remove(),this.#s=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.#i=[]}static#o=0;attributeChangedCallback(t,e,s){e===s||!this.isConnected||(t==="src"?this._loadSrc(s):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.#i}set tasks(t){let e=(t||[]).map((s,r)=>({id:s.id??`gc-task-${r}`,name:s.name??`Task ${r+1}`,start:typeof s.start=="number"?s.start:Y(s.start),end:typeof s.end=="number"?s.end:s.end!=null?Y(s.end):typeof s.start=="number"?s.start:Y(s.start),progress:s.progress??0,group:s.group??null,depends:Array.isArray(s.depends)?s.depends:s.depends?String(s.depends).split(",").map(a=>a.trim()):[],status:s.status??null,assignee:s.assignee??null,milestone:!!s.milestone,color:s.color??null,storyIds:s.storyIds??[],itemIds:s.itemIds??[]}));if((this.#e||this.#s||this.#t)&&(this.#s&&(this.#s.remove(),this.#s=null),this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null)),this.#i=e,e.length>0){this.#r=Math.min(...e.map(r=>r.start)),this.#n=Math.max(...e.map(r=>r.end)),this.#a=this.#n-this.#r,this.#a<=0&&(this.#a=H);let s=this.querySelector(":scope > table");s||(s=document.createElement("table"),s.classList.add("gc-sr-only"),this.appendChild(s)),this.#l(s)}this.dispatchEvent(new CustomEvent("gantt-chart:tasks-changed",{detail:{tasks:e,source:"property"},bubbles:!0}))}#p(t){let e=t.querySelectorAll("tbody tr"),s=[];for(let r=0;r<e.length;r++){let a=e[r],i=a.querySelectorAll("time[datetime]");if(i.length<2&&!a.hasAttribute("data-milestone"))continue;let o=i[0]?.getAttribute("datetime"),c=i.length>1?i[1].getAttribute("datetime"):o;if(!o)continue;let d=a.querySelector("progress"),l=d?d.value/(d.max||100):0,u=a.cells[0]?.textContent?.trim()||`Task ${r+1}`;s.push({id:a.dataset.taskId||`gc-task-${r}`,name:u,start:Y(o),end:Y(c),progress:l,group:a.dataset.group||null,depends:a.dataset.depends?a.dataset.depends.split(",").map(p=>p.trim()):[],status:a.dataset.status||null,assignee:a.dataset.assignee||null,milestone:a.hasAttribute("data-milestone"),color:a.dataset.color||null,storyIds:a.dataset.storyIds?a.dataset.storyIds.split(",").map(p=>p.trim()):[],itemIds:a.dataset.itemIds?a.dataset.itemIds.split(",").map(p=>p.trim()):[]})}return s}#l(t){let e=this.getAttribute("title"),s=this.hasAttribute("show-today"),r=this.hasAttribute("show-progress"),a=this.hasAttribute("show-dependencies");e&&(this.#s=document.createElement("h2"),this.#s.className="gc-title",this.#s.textContent=e,this.insertBefore(this.#s,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.#g();d.appendChild(l);let u=this.#b();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.#v(f,r)),d.appendChild(_)}}if(s){let p=this.#h();p&&d.appendChild(p)}a&&requestAnimationFrame(()=>{let p=this.#y(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.#i.find(v=>v.id===f);b&&(this.#w(`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 s=document.createElement("div");s.className="gc-timeline-dates";let r=this.#m();for(let{position:a,text:i}of r){let o=document.createElement("span");o.className="gc-date-label",o.style.left=`${a}%`,o.textContent=i,s.appendChild(o)}return t.appendChild(s),t}#m(){let t=this.getAttribute("view")||"auto",e=t==="auto"?ns(this.#a):t,s=is(this.#a),r=[],a;switch(e){case"day":a=H;break;case"week":a=jt;break;case"month":a=ct;break;case"quarter":a=as;break;default:a=ct}let i=new Date(this.#r);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.#r&&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.#r+a*.5&&r.push({position:0,text:s(new Date(this.#r))});let c=o;for(;c<=this.#n;){let d=(c-this.#r)/this.#a*100;if(d>=0&&d<=100&&r.push({position:d,text:s(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+=a}return r}#g(){let t=document.createElement("div");t.className="gc-grid-lines";let e=this.#m();for(let{position:s}of e){if(s<=0)continue;let r=document.createElement("div");r.className="gc-grid-line",r.style.left=`${s}%`,t.appendChild(r)}return t}#b(){let t=new Map;for(let e of this.#i){let s=e.group||"";t.has(s)||t.set(s,[]),t.get(s)?.push(e)}return t}#v(t,e){let s=(t.start-this.#r)/this.#a*100,r=(t.end-t.start)/this.#a*100,a=document.createElement("div");if(a.className="gc-bar",a.setAttribute("data-task-id",t.id),a.setAttribute("role","img"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",`${pe(t.name)}: ${new Date(t.start).toLocaleDateString()} to ${new Date(t.end).toLocaleDateString()}`+(t.progress>0?`, ${Math.round(t.progress*100)}% complete`:"")),a.style.left=`${s}%`,a.style.width=`${Math.max(r,.5)}%`,t.status&&a.setAttribute("data-status",t.status),t.color&&a.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)}%`,a.appendChild(i)}if(r>8){let i=document.createElement("span");i.className="gc-bar-label",i.textContent=t.name,a.appendChild(i)}return a}#d(t){let e=(t.start-this.#r)/this.#a*100,s=document.createElement("div");return s.className="gc-milestone",s.setAttribute("data-task-id",t.id),s.setAttribute("role","img"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label",`Milestone: ${pe(t.name)}, ${new Date(t.start).toLocaleDateString()}`),s.style.left=`${e}%`,t.status&&s.setAttribute("data-status",t.status),t.color&&s.style.setProperty("--gc-bar-color",t.color),s}#h(){let t=Date.now();if(t<this.#r||t>this.#n)return null;let e=(t-this.#r)/this.#a*100,s=document.createElement("div");s.className="gc-today-line",s.style.left=`${e}%`;let r=document.createElement("span");return r.className="gc-today-label",r.textContent="Today",s.appendChild(r),s}#y(t){if(!this.#i.some(l=>l.depends.length>0))return null;let s="http://www.w3.org/2000/svg",r=36,a=t.querySelectorAll(".gc-bar-row").length,i=document.createElementNS(s,"svg");i.setAttribute("class","gc-deps"),i.setAttribute("viewBox",`0 0 100 ${a*r}`),i.setAttribute("preserveAspectRatio","none"),i.style.width="100%",i.style.height="100%";let o=document.createElementNS(s,"defs"),c=document.createElementNS(s,"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(s,"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.#i)for(let u of l.depends){let p=this.#i.find(A=>A.id===u);if(!p)continue;let h=(p.end-this.#r)/this.#a*100,f=(l.start-this.#r)/this.#a*100,b=this.#f(p.id,t),v=this.#f(l.id,t);if(b===-1||v===-1)continue;let x=b*r+r/2,_=v*r+r/2,g=document.createElementNS(s,"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}#f(t,e){let s=e.querySelectorAll(".gc-bar-row");for(let r=0;r<s.length;r++){let a=s[r].querySelector("[data-task-id]");if(a&&a.dataset.taskId===t)return r}return-1}async _loadSrc(t){if(t)try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);let s=await e.json();for(;this.firstChild;)this.firstChild.remove();let r=document.createElement("table"),a=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)}a.appendChild(i),r.appendChild(a);let o=document.createElement("tbody");for(let c of s.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)}r.appendChild(o),this.appendChild(r),s.title&&this.setAttribute("title",s.title),this.#c()}catch(e){console.warn(`[gantt-chart] Failed to load src="${t}":`,e)}}#w(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,29 +2673,29 @@ 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
|
|
2677
|
-
<article class="wi-card wi-card--minimal" role="article" aria-label="${
|
|
2676
|
+
`;var me={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.#s(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t,e,s){e!==s&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(s):this.#s())}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.#s(),this.dispatchEvent(new CustomEvent("work-item:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0})))}_applyData(t){for(let[e,s]of[["itemId","item-id"],["type","type"],["priority","priority"],["status","status"],["estimate","estimate"],["assignee","assignee"],["detail","detail"]])t[e]!=null&&this.setAttribute(s,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 s=document.createElement("p");s.slot=e,s.textContent=String(t[e]),this.appendChild(s)}if(t.checklist&&!this.querySelector('[slot="checklist"]')){let e=document.createElement("ul");e.slot="checklist";let s=Array.isArray(t.checklist)?t.checklist:[t.checklist];for(let r of s){let a=document.createElement("li");a.textContent=String(r),e.appendChild(a)}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 s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status}`);let r=await s.json();this._applyData(r),this.#s()}catch(s){e.innerHTML=`<style>${K}</style><div class="state-msg state-msg--error">Could not load: ${m(s.message)}</div>`}}#s(){let t=this.shadowRoot,e=Dt[this.priority]||Dt.medium,s=Ft[this.status]||Ft.backlog,r=this.itemType,a=me[r]||me.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">
|
|
2681
2681
|
${this.itemId?`<span class="wi-id">${m(this.itemId)}</span>`:""}
|
|
2682
|
-
<span class="wi-type" data-type="${m(
|
|
2682
|
+
<span class="wi-type" data-type="${m(r)}">${k(a)} ${m(r)}</span>
|
|
2683
2683
|
</div>
|
|
2684
2684
|
<div class="wi-title-wrap">
|
|
2685
2685
|
<slot name="title"><span class="wi-title-fallback">${m(this._minimalLabel)}</span></slot>
|
|
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">
|
|
2693
2693
|
${this.itemId?`<span class="wi-id">${m(this.itemId)}</span>`:""}
|
|
2694
|
-
<span class="wi-type" data-type="${m(
|
|
2694
|
+
<span class="wi-type" data-type="${m(r)}">${k(a)} ${m(r)}</span>
|
|
2695
2695
|
</div>
|
|
2696
2696
|
<div class="wi-badges">
|
|
2697
2697
|
<span class="wi-priority" style="color:${e.color};background:${e.bg}">${m(e.label)}</span>
|
|
2698
|
-
<span class="wi-status" style="color:${
|
|
2698
|
+
<span class="wi-status" style="color:${s.color};background:${s.bg}">${m(s.label)}</span>
|
|
2699
2699
|
${this.estimate?`<span class="wi-estimate" title="Estimate">${m(this.estimate)}</span>`:""}
|
|
2700
2700
|
</div>
|
|
2701
2701
|
</header>
|
|
@@ -2755,7 +2755,7 @@ var re=`
|
|
|
2755
2755
|
</div>
|
|
2756
2756
|
</div>
|
|
2757
2757
|
|
|
2758
|
-
</article>`,i==="compact")for(let c of t.querySelectorAll(".wi-section")){let d=c.querySelector("slot");d&&d.assignedNodes().length===0&&c.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("work-item:ready",{detail:{itemId:this.itemId,title:this.itemTitle,type:
|
|
2758
|
+
</article>`,i==="compact")for(let c of t.querySelectorAll(".wi-section")){let d=c.querySelector("slot");d&&d.assignedNodes().length===0&&c.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("work-item:ready",{detail:{itemId:this.itemId,title:this.itemTitle,type:r,priority:this.priority,status:this.status},bubbles:!0,composed:!0}))}};w("work-item",Ot);var J=`
|
|
2759
2759
|
:host {
|
|
2760
2760
|
--_bg: var(--adr-wc-bg, var(--color-surface, #ffffff));
|
|
2761
2761
|
--_text: var(--adr-wc-text, var(--color-text, #1a1a1a));
|
|
@@ -3081,8 +3081,8 @@ var re=`
|
|
|
3081
3081
|
|
|
3082
3082
|
.state-msg { padding: var(--_space-m); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
3083
3083
|
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
3084
|
-
`;var
|
|
3085
|
-
<article class="adr-card adr-card--minimal" role="article" aria-label="${
|
|
3084
|
+
`;var fe={proposed:{label:"Proposed",color:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)"},accepted:{label:"Accepted",color:"#22c55e",bg:"rgba(34, 197, 94, 0.1)"},deprecated:{label:"Deprecated",color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)"},superseded:{label:"Superseded",color:"#6b7280",bg:"rgba(107, 114, 128, 0.1)"}},V={calendar:'<rect width="18" height="18" x="3" y="4" rx="2" ry="2"/><line x1="16" x2="16" y1="2" y2="6"/><line x1="8" x2="8" y1="2" y2="6"/><line x1="3" x2="21" y1="10" y2="10"/>',context:'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/>',decision:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/>',consequences:'<path d="m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"/><path d="m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z"/><path d="M7 21h10"/><path d="M12 3v18"/><path d="M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2"/>',arrowRight:'<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>'},Bt=class extends HTMLElement{static get observedAttributes(){return["adr-id","status","supersedes","superseded-by","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())}}connectedCallback(){this.#t(),this.adrId&&!this.id&&(this.id=this.adrId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#s(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t,e,s){e!==s&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(s):this.#s())}get adrId(){return this.getAttribute("adr-id")||""}get status(){return this.getAttribute("status")||"proposed"}get adrTitle(){return this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||""}get adrDate(){let t=this.querySelector('[slot="date"]');return t?.getAttribute("datetime")||t?.textContent?.trim()||this.#e.get("date")||""}get supersedes(){let t=this.getAttribute("supersedes")||"";return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}get supersededBy(){let t=this.getAttribute("superseded-by")||"";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.adrTitle||this.adrId||"ADR"}get data(){return{adrId:this.adrId||void 0,status:this.status,detail:this.getAttribute("detail")||void 0,supersedes:this.supersedes.length?this.supersedes:void 0,supersededBy:this.supersededBy.length?this.supersededBy:void 0,title:this.adrTitle||void 0,date:this.adrDate||void 0}}set data(t){!t||typeof t!="object"||(this._applyData(t),this.#t(),this.shadowRoot&&this.#s(),this.dispatchEvent(new CustomEvent("adr-wc:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0})))}_applyData(t){if(t.adrId!=null&&this.setAttribute("adr-id",String(t.adrId)),t.status!=null&&this.setAttribute("status",String(t.status)),t.detail!=null&&this.setAttribute("detail",String(t.detail)),t.supersedes&&this.setAttribute("supersedes",Array.isArray(t.supersedes)?t.supersedes.join(","):String(t.supersedes)),t.supersededBy&&this.setAttribute("superseded-by",Array.isArray(t.supersededBy)?t.supersededBy.join(","):String(t.supersededBy)),t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h3");e.slot="title",e.textContent=String(t.title),this.appendChild(e)}if(t.date&&!this.querySelector('[slot="date"]')){let e=document.createElement("time");e.slot="date",e.setAttribute("datetime",String(t.date)),e.textContent=new Date(String(t.date)).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),this.appendChild(e)}for(let e of["context","decision"])if(t[e]&&!this.querySelector(`[slot="${e}"]`)){let s=document.createElement("p");s.slot=e,s.textContent=String(t[e]),this.appendChild(s)}if(t.consequences&&!this.querySelector('[slot="consequences"]')){let e=document.createElement("ul");e.slot="consequences";let s=Array.isArray(t.consequences)?t.consequences:[t.consequences];for(let r of s){let a=document.createElement("li");a.textContent=String(r),e.appendChild(a)}this.appendChild(e)}}async _loadSrc(t){if(!t)return;let e=this.shadowRoot;e.innerHTML=`<style>${J}</style><div class="state-msg">Loading\u2026</div>`;try{let s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status}`);let r=await s.json();this._applyData(r),this.#t(),this.#s()}catch(s){e.innerHTML=`<style>${J}</style><div class="state-msg state-msg--error">Could not load: ${m(s.message)}</div>`}}#s(){let t=this.shadowRoot,e=fe[this.status]||fe.proposed,s=this._detailLevel,r=this.adrId?`ADR: ${m(this.adrId)}`:"Architectural Decision Record",a=!!this.querySelector('[slot="date"]')||this.#e.has("date");if(s==="minimal"){t.innerHTML=`<style>${J}</style>
|
|
3085
|
+
<article class="adr-card adr-card--minimal" role="article" aria-label="${r}"
|
|
3086
3086
|
tabindex="0">
|
|
3087
3087
|
<div class="adr-body">
|
|
3088
3088
|
<div class="adr-meta">
|
|
@@ -3094,12 +3094,12 @@ var re=`
|
|
|
3094
3094
|
</div>
|
|
3095
3095
|
</div>
|
|
3096
3096
|
</article>`;return}if(t.innerHTML=`<style>${J}</style>
|
|
3097
|
-
<article class="adr-card adr-card--${
|
|
3097
|
+
<article class="adr-card adr-card--${s}" role="article" aria-label="${r}">
|
|
3098
3098
|
|
|
3099
3099
|
<header class="adr-header">
|
|
3100
3100
|
<div class="adr-meta">
|
|
3101
3101
|
${this.adrId?`<span class="adr-id">${m(this.adrId)}</span>`:""}
|
|
3102
|
-
${
|
|
3102
|
+
${a?`<span class="adr-date-wrap">${k(V.calendar)} <slot name="date"></slot></span>`:""}
|
|
3103
3103
|
</div>
|
|
3104
3104
|
<div class="adr-badges">
|
|
3105
3105
|
<span class="adr-status" style="color:${e.color};background:${e.bg}">${m(e.label)}</span>
|
|
@@ -3156,16 +3156,16 @@ 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>`,s==="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 be(n,t,e){let s=W(n?.sprintCount)>0?W(n.sprintCount)*(W(n.sprintWeeks)||1):W(n?.sprintWeeks),r=W(t?.teamFTE),a=cs(W(e),0,1);return!(s>0)||!(r>0)||!(a>0)?0:Math.ceil(s*r*a)}function os(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 ge({time:n,cost:t,scope:e}){return os(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 cs(n,t,e){return Math.max(t,Math.min(e,n))}function ls({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 ds(n){let t=[n.t,n.c,n.s].filter(r=>r>0);if(t.length===0)return{time:1,cost:1,scope:1};let e=Math.max(...t),s=r=>r<=0?.55:.55+(1.45-.55)*(r/e);return{time:s(n.t),cost:s(n.c),scope:s(n.s)}}function Ut(n,t=80){let e={scope:-Math.PI/2,time:5*Math.PI/6,cost:Math.PI/6},s=ds(ls(n)),r=a=>({x:Math.cos(e[a])*t*s[a],y:Math.sin(e[a])*t*s[a],factor:s[a]});return{scope:r("scope"),time:r("time"),cost:r("cost")}}function us(n={}){let t=P(n.sprintCount,0),e=P(n.sprintWeeks,0);if(t>0&&e>0){let s=t*e;return t>1?`${s} weeks (${t} \xD7 ${e}wk)`:`${s} week${s===1?"":"s"}`}return e>0?`${e} week${e===1?"":"s"}`:n.deadline?`until ${n.deadline}`:"TBD"}function ps(n={}){let t=Number(n.teamFTE),e=n.budgetTier,s=[];return Number.isFinite(t)&&t>0&&s.push(`${t} FTE`),e&&e!=="unset"&&s.push(e),s.length>0?s.join(" \xB7 "):"TBD"}function hs(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 ve(n){return typeof n=="string"&&n.trim().length>0?n:"TBD \u2014 click to set"}var q="http://www.w3.org/2000/svg",ms={scope:{dx:0,dy:-22,anchor:"middle"},time:{dx:-10,dy:14,anchor:"end"},cost:{dx:10,dy:14,anchor:"start"}},fs={scope:{dx:0,dy:-8,anchor:"middle"},time:{dx:-10,dy:28,anchor:"end"},cost:{dx:10,dy:28,anchor:"start"}},bs={scope:{name:"Scope",unit:"# features / story points"},time:{name:"Time",unit:"hours / days / weeks"},cost:{name:"Cost",unit:"FTE / $"}};function ye({value:n={},vertices:t,capacityPoints:e=0,capacitySource:s="formula",qualitySummary:r=""}={}){let a=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(a.scope.x)},${L(a.scope.y)}`,`${L(a.time.x)},${L(a.time.y)}`,`${L(a.cost.x)},${L(a.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 ${ve(r)}. Activate to open the quality decision.`);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=s==="manual"?"pts (manual)":"pts",c.append(h);let f=document.createElementNS(q,"title");f.textContent=ve(r),c.append(f),i.append(c);for(let b of["scope","time","cost"])i.append(gs(b,a[b],n));return i}function gs(n,t,e){let s=ms[n],r=fs[n],a=bs[n],i=n==="scope"?hs(e.scope):n==="cost"?ps(e.cost):us(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",`${a.name} \u2014 ${i}. Activate to edit.`);let c=document.createElementNS(q,"rect");c.setAttribute("class","hit");let d=160,l=50,u;s.anchor==="end"?u=t.x-d+6:s.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+s.dx))),h.setAttribute("y",String(L(t.y+s.dy))),h.setAttribute("text-anchor",s.anchor),h.textContent=a.name,o.append(h);let f=document.createElementNS(q,"text");f.setAttribute("class","vertex-summary"),f.setAttribute("x",String(L(t.x+r.dx))),f.setAttribute("y",String(L(t.y+r.dy))),f.setAttribute("text-anchor",r.anchor),f.textContent=i,o.append(f);let b=document.createElementNS(q,"title");return b.textContent=`${a.name}: ${i} \u2014 ${a.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}]},xe={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:""};#s=null;#i=[];#r="";#n={};#a=null;#o=null;#c=null;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){this.#r=this.getAttribute("data-quality-summary")||"",this.#v(),this.#A(),this.#h(),this.#k(),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.#r=this.getAttribute("data-quality-summary")||"",this.#h()):(t==="disabled"||t==="locked")&&this.#x())}get value(){return JSON.parse(JSON.stringify({...this.#t,revisionLog:this.#i}))}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.#s=t.capacityPoints,this.#t.capacitySource="manual"):(this.#s=null,this.#t.capacitySource="formula"),Array.isArray(t.revisionLog)&&(this.#i=[...t.revisionLog]),this.#b(),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.#i))}get qualitySummary(){return this.#r}set qualitySummary(t){this.#r=String(t??""),this.#h()}openEditor(t){if(!lt.includes(t)||this.#w)return;let e=this.#m(t);typeof e.showModal=="function"?e.showModal():e.setAttribute("open","")}revise(t,e,s){if(!t||typeof s!="string"||s.length<10)throw new Error("iron-triangle: revise() requires field and a reason of at least 10 characters");let r=this.#N(t);this.#E(t,e);let a={field:t,from:r,to:e,reason:s};this.#i.push({revisedAt:new Date().toISOString(),changes:[a]}),this.dispatchEvent(new CustomEvent("iron-triangle:revise",{bubbles:!0,composed:!0,detail:a})),this.#b(),this.#d({source:"revise"})}setManual(t){let e=Math.max(1,Math.floor(Number(t)||0));this.#s=e;let s=this.#t.capacitySource;this.#t.capacitySource="manual",s!=="manual"&&this.dispatchEvent(new CustomEvent("iron-triangle:mode",{bubbles:!0,composed:!0,detail:{from:s,to:"manual"}})),this.setState("manual",!0),this.setState("formula",!1),this.#d({source:"manual"})}setFormula(){this.#s=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 s=t.target.closest?.('.center[data-target="quality"]');s&&this.contains(s)&&(t.preventDefault(),this.hasAttribute("disabled")||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 s=t.target.closest?.('.center[data-target="quality"]');s&&this.contains(s)&&(t.preventDefault(),this.hasAttribute("disabled")||this.#u())}#u(){let t=new CustomEvent("iron-triangle:open-quality",{bubbles:!0,composed:!0,cancelable:!0,detail:{qualitySummary:this.#r,capacityPoints:this.#t.capacityPoints}});if(this.dispatchEvent(t)){let s=this.getAttribute("data-quality-href");s&&window.location.assign(s)}}#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",`${xe[t]} \u2014 edit`);let s=document.createElement("form");s.method="dialog",s.setAttribute("data-layout","stack"),s.setAttribute("data-layout-gap","m");let r=document.createElement("h3");r.textContent=xe[t],s.append(r);for(let c of dt[t])s.append(_e(t,c,this.#t[t]?.[c.key]));let a=document.createElement("div");a.setAttribute("data-layout","cluster"),a.setAttribute("data-layout-gap","s"),a.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",a.append(i,o),s.append(a),e.append(s),this.append(e),this.#n[t]=e,s.addEventListener("submit",c=>{c.preventDefault(),this.#g(t,s),e.close("save"),this.#d({source:"dialog",field:t})}),this.#x(),e}#g(t,e){let s={};for(let r of dt[t]){let a=e.querySelector(`[name="${t}.${r.key}"]`);if(!a)continue;let i=a.type==="checkbox"?a.checked:a.value;if(!(i===""||i==null))if(r.type==="number"){let o=Number(i);Number.isFinite(o)&&(s[r.key]=o)}else s[r.key]=i}this.#t[t]=s}#b(){for(let t of lt){let e=this.#n[t];if(e)for(let s of dt[t]){let r=e.querySelector(`[name="${t}.${s.key}"]`);if(!r)continue;let a=this.#t[t]?.[s.key];r.value=a==null?"":String(a)}}}#v(){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 s=Number(this.dataset.focusFactor??.6),r=Number(this.dataset.minCapacity??1),a;this.#t.capacitySource==="manual"&&this.#s!=null?a=this.#s:a=be(this.#t.time,this.#t.cost,s),Number.isFinite(r)&&a>0&&a<r&&(a=r),this.#t.capacityPoints=a,this.#t.hash=ge(this.#t),this.#h(),this.#y(),this.#k(),this.#f(),this.dispatchEvent(new CustomEvent("iron-triangle:change",{bubbles:!0,composed:!0,detail:{...this.value,source:t,field:e}}))}#h(){let t=ye({value:this.#t,vertices:Ut(this.#t),capacityPoints:this.#t.capacityPoints,capacitySource:this.#t.capacitySource,qualitySummary:this.#r}),e=this.querySelector(":scope > svg");e?e.replaceWith(t):this.prepend(t),this.#_(),this.dataset.capacityPoints=String(this.#t.capacityPoints),this.dataset.capacitySource=this.#t.capacitySource}#y(){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 s=new Date(t).getTime();Number.isFinite(s)&&(e=s<Date.now())}this.setState("over-deadline",e)}#f(){try{this.#e.setFormValue(JSON.stringify(this.value))}catch{}}get#w(){return this.hasAttribute("disabled")||this.hasAttribute("locked")}#x(){let t=this.#w;this.#o&&(this.#o.disabled=t);for(let e of Object.values(this.#n))for(let s of e.querySelectorAll("input, select, textarea, button"))s.disabled=t;this.#_()}#_(){let t=this.#w,e=this.hasAttribute("disabled");for(let s of this.querySelectorAll(':scope > svg [role="button"][tabindex]')){let r=s.matches('.center[data-target="quality"]')?e:t;s.setAttribute("tabindex",r?"-1":"0"),r?s.setAttribute("aria-disabled","true"):s.removeAttribute("aria-disabled")}}#A(){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 s=document.createElement("button");s.type="button",s.className="iron-triangle-mode ghost",s.setAttribute("aria-pressed","false"),s.textContent="Manual capacity",s.addEventListener("click",()=>this.#C());let r=document.createElement("p");r.className="iron-triangle-warning",r.setAttribute("data-warning","over-deadline"),r.hidden=!0,t.append(e,s,r);let a=this.querySelector(":scope > svg");a?a.after(t):this.prepend(t),this.#a=e,this.#o=s,this.#c=r,this.#x()}#k(){if(!this.#a)return;let{capacityPoints:t,capacitySource:e}=this.#t,s=e==="manual",r=this.#t.time?.deadline,a=this.matches(":state(over-deadline)"),i=[];i.push(t>0?`Capacity: ${t} points (${s?"manual":"formula"}).`:"Capacity: not yet budgeted."),a&&i.push(`Deadline has passed (${r}).`);let o=i.join(" ");if(this.#a.textContent!==o&&(this.#a.textContent=o),this.#o){this.#o.setAttribute("aria-pressed",s?"true":"false");let c=s&&t>0?`Manual capacity: ${t} pts`:"Manual capacity";this.#o.textContent!==c&&(this.#o.textContent=c),this.#o.setAttribute("aria-label",s?`${c}. Activate to edit or return to the formula.`:`${c}. Activate to override the formula with a fixed number.`)}this.#c&&(this.#c.textContent=a?`Deadline has passed (${r})`:"",this.#c.hidden=!a)}#C(){let t=this.#T(),e=t.querySelector('[name="capacity.points"]');e.value=String(this.#t.capacityPoints>0?this.#t.capacityPoints:1);let s=t.querySelector('button[value="formula"]');s.hidden=this.#t.capacitySource!=="manual",typeof t.showModal=="function"?t.showModal():t.setAttribute("open","")}#T(){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 s=document.createElement("h3");s.textContent="Manual capacity",e.append(s);let r=document.createElement("p");r.className="iron-triangle-dialog__hint",r.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(r),e.append(_e("capacity",{key:"points",label:"Capacity (points)",type:"number",min:1,step:1,width:"6rem"},this.#t.capacityPoints));let a=document.createElement("div");a.setAttribute("data-layout","cluster"),a.setAttribute("data-layout-gap","s"),a.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",a.append(i,o,c),e.append(a),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)}),this.#x(),t}#N(t){if(t==="capacityPoints")return this.#t.capacityPoints;let[e,s]=t.split(".");return e&&s?this.#t[e]?.[s]:void 0}#E(t,e){if(t==="capacityPoints"){this.setManual(e);return}let[s,r]=t.split(".");!s||!r||(this.#t[s]||(this.#t[s]={}),this.#t[s][r]=e)}};function _e(n,t,e){let s=document.createElement("form-field"),r=`${n}-${t.key}`,a=document.createElement("label");a.setAttribute("for",r),a.textContent=t.label,s.append(a);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=r,i.name=`${n}.${t.key}`,t.width&&(i.style.inlineSize=t.width),s.append(i),s}w("iron-triangle",Vt);function vs(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 we(n){let t=0;for(let e of n||[])t+=vs(e);return t}function Wt({capacityPoints:n,qualitySum:t,featureSum:e}){let s=Number.isFinite(n)?n:1/0,r=Math.max(0,Number(t)||0),a=Math.max(0,Number(e)||0),i=Number.isFinite(s)?s-r-a:1/0;return{capacity:s,quality:r,features:a,slack:i}}function Ae({capacity:n,quality:t,features:e}){if(!Number.isFinite(n)||n<=0){let a=t+e;return a<=0?{quality:0,features:0,slack:100}:{quality:t/a*100,features:e/a*100,slack:0}}let s=t+e,r=Math.max(n,s);return{quality:t/r*100,features:e/r*100,slack:Math.max(0,(n-s)/r*100)}}var Qt=class extends C{static get observedAttributes(){return["data-bind-triangle","data-bind-quality"]}#e=null;#t=null;#s=null;#i=null;#r=!1;setup(){this.#a(),this.#o(),this.#c(),this.#u()}teardown(){this.#e?.(),this.#t?.(),this.#s?.disconnect(),this.#e=null,this.#t=null,this.#s=null}attributeChangedCallback(t){this.isConnected&&(t==="data-bind-triangle"?(this.#a(),this.#u()):t==="data-bind-quality"&&(this.#o(),this.#u()))}get capacityPoints(){return this.#p()}get qualitySum(){return this.#l()}get featureSum(){return this.#i!=null?this.#i:we(this.querySelectorAll("[data-capacity-cost]"))}set featureSum(t){this.#i=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)}#a(){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.#s||(this.#s=new MutationObserver(t=>{t.some(s=>!s.target.closest?.("[data-capacity-table]"))&&this.#u()}),this.#s.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=Ae(t),s=this.querySelector(":scope > [data-capacity-table]");s||(s=document.createElement("section"),s.dataset.capacityTable="",this.prepend(s));let r=ys(t.capacity),a=t.quality>0?`\u2212${t.quality} pts`:"0 pts",i=t.features>0?`\u2212${t.features} pts`:"0 pts",o=xs(t.slack);s.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>
|
|
3163
|
-
<dd class="num">${
|
|
3163
|
+
<dd class="num">${r}</dd>
|
|
3164
3164
|
<dd class="bar"><span class="bar-track"><span class="bar-fill bar-capacity" style="--w:100%"></span></span></dd>
|
|
3165
3165
|
</div>
|
|
3166
3166
|
<div data-row="quality">
|
|
3167
3167
|
<dt>Quality</dt>
|
|
3168
|
-
<dd class="num">${
|
|
3168
|
+
<dd class="num">${a}</dd>
|
|
3169
3169
|
<dd class="bar"><span class="bar-track"><span class="bar-fill bar-quality" style="--w:${e.quality.toFixed(1)}%"></span></span></dd>
|
|
3170
3170
|
</div>
|
|
3171
3171
|
<div data-row="features">
|
|
@@ -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.#r&&(this.dispatchEvent(new CustomEvent("capacity-plan:overdrawn",{bubbles:!0,composed:!0,detail:{ledger:t,source:"render"}})),this.#r=c)}};function ys(n){return Number.isFinite(n)?`${n} pts`:"\u221E"}function xs(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"}),ke=Object.freeze({accessibility:3,performance:5,security:5,reliability:4,observability:3,internationalization:4,compatibility:2,portability:3,privacy:4,scalability:5,maintainability:2}),Ce=Object.freeze({performance:"Performance",accessibility:"Accessibility",security:"Security",reliability:"Reliability",maintainability:"Maintainability",observability:"Observability",compatibility:"Compatibility",scalability:"Scalability",portability:"Portability",internationalization:"Internationalization",privacy:"Privacy"}),ya=Object.freeze({accessibility:"a11y",internationalization:"i18n",maintainability:"maint",observability:"obs",compatibility:"compat",portability:"porta",performance:"perf",reliability:"rely",scalability:"scale",security:"sec",privacy:"priv"}),_s=Object.freeze({critical:1,important:.6,acceptable:.3,"not-relevant":0});function G(n){return Ce[n]?Ce[n]:String(n).replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function Jt(n,t={}){let e={};for(let s of n)Object.prototype.hasOwnProperty.call(t,s)&&Number.isFinite(Number(t[s]))?e[s]=Math.max(0,Math.floor(Number(t[s]))):Object.prototype.hasOwnProperty.call(ke,s)?e[s]=ke[s]:e[s]=1;return Object.freeze(e)}function pt(n,t){let e=0;for(let[s,r]of Object.entries(n||{}))r==="critical"&&(e+=Number(t?.[s]??0));return e}function Se(n){return Object.keys(n||{}).filter(t=>n[t]==="critical")}function Gt(n){let{vector:t={},rationales:e={},costWeights:s={},capacityPoints:r=1/0,overrunRationale:a="",minRationale:i=10,minOverrunRationale:o=10}=n||{},c=[],d=Se(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,s);return Number.isFinite(r)&&l>r&&(typeof a!="string"||a.trim().length<o)&&c.push(`Over budget by ${l-r} points (${l}/${r}); 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 Ee({ility:n,level:t,costWeight:e}){let s=G(n),r=t?Kt[t]||t:"unset",a=Number(e),i=Number.isFinite(a)?`${a} pts`:"? pts";return`${s} \u2014 ${r} \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 ws({ilities:n,vector:t={},radius:e}){let s=Ie(n.length);return n.map((r,a)=>{let i=t[r]||null,o=_s[i]??0;return{ility:r,level:i,x:U(Math.cos(s[a])*e*o),y:U(Math.sin(s[a])*e*o)}})}function Xt({ilities:n,radius:t}){let e=Ie(n.length);return n.map((s,r)=>({ility:s,x:U(Math.cos(e[r])*t),y:U(Math.sin(e[r])*t)}))}var I="http://www.w3.org/2000/svg",As=Object.freeze([{ratio:1,label:"Critical",className:"ring-critical"},{ratio:.6,label:"Important",className:"ring-important"},{ratio:.3,label:"Acceptable",className:"ring-acceptable"}]),ks=.22;function Ne({ilities:n=[],vector:t={},costWeights:e={},capacityPoints:s=0,radius:r=100}={}){let a=document.createElementNS(I,"svg"),i=r+14,o=i+140,c=i+30;a.setAttribute("viewBox",`${-o} ${-c} ${o*2} ${c*2}`),a.setAttribute("role","group"),a.setAttribute("aria-label",`Quality target. ${Se(t||{}).length} critical of ${n.length} ilities. Click any axis to edit.`);for(let y of As){let A=document.createElementNS(I,"polygon");A.setAttribute("class",`ring ${y.className}`);let S=Xt({ilities:n,radius:r*y.ratio});A.setAttribute("points",S.map($=>`${$.x},${$.y}`).join(" ")),a.append(A)}let d=Xt({ilities:n,radius:r});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)),a.append(A)}let l=ws({ilities:n,vector:t,radius:r}),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(" ")),a.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)),a.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",`${Ee({ility:A,level:z,costWeight:T})}. Activate to edit.`);let D=document.createElementNS(I,"rect");D.setAttribute("class","hit");let ht=Cs($),mt=100,ee=22,ze=$.x+(ht==="end"?-mt:ht==="start"?0:-mt/2),Pe=$.y-ee/2;if(D.setAttribute("x",String(U(ze))),D.setAttribute("y",String(U(Pe))),D.setAttribute("width",String(mt)),D.setAttribute("height",String(ee)),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 se=document.createElementNS(I,"title");se.textContent=Ee({ility:A,level:z,costWeight:T}),N.append(se),a.append(N)}let h=document.createElementNS(I,"g");h.setAttribute("class","center");let f=pt(t,e);Number.isFinite(s)&&f>s&&h.setAttribute("data-over","");let v=r*ks,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(s)?`of ${s}`:"unbounded",h.append(g),a.append(h),a}function U(n){return Math.round(n*100)/100}function Cs(n){return Math.abs(n.x)<4?"middle":n.x>0?"start":"end"}var Es=0,Zt=class extends C{static formAssociated=!0;static get observedAttributes(){return["data-bind-to","data-capacity-points","data-cost-weights","data-radius","data-min-rationale","data-max-rationale","data-min-overrun-rationale","data-max-overrun-rationale","disabled","locked"]}#e;#t=[...Yt];#s={};#i={};#r=Jt(Yt);#n="";#a=!1;#o=null;#c=null;#p={};#l=null;#u=`quality-target-${++Es}`;constructor(){super(),this.#e=this.attachInternals(),this._adoptInternals(this.#e)}setup(){this.#f(),this.#N(),this.#E(),this.#h(),this.#q(),this.listen(this,"click",t=>this.#m(t)),this.listen(this,"keydown",t=>this.#g(t)),this.listen(this,"input",t=>this.#b(t))}teardown(){this.#o?.(),this.#o=null}attributeChangedCallback(t){this.isConnected&&(t==="data-bind-to"?(this.#N(),this.#E()):t==="data-capacity-points"?this.#E():t==="data-cost-weights"?(this.#f(),this.#E()):t==="data-radius"?this.#E():t==="data-min-overrun-rationale"||t==="data-max-overrun-rationale"?(this.#y(),this.#q()):(t==="disabled"||t==="locked")&&this.#L())}get vector(){return{...this.#s}}set vector(t){this.#w(t),this.#S("property")}get rationales(){return{...this.#i}}set rationales(t){this.#x(t),this.#S("property")}get costWeights(){return{...this.#r}}get capacityPoints(){return this.#_()}set capacityPoints(t){this.#c=Number.isFinite(+t)?+t:null,this.#S("property")}get criticalSum(){return pt(this.#s,this.#r)}get overBudget(){let t=this.#_();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.#q()}get ilities(){return[...this.#t]}set ilities(t){!Array.isArray(t)||t.length===0||(this.#t=[...t],this.#f(),this.#S("property"))}get value(){return{vector:{...this.#s},rationales:{...this.#i},costWeights:{...this.#r},capacityPoints:this.#A(),capacitySource:this.#k(),criticalSum:this.criticalSum,overrunRationale:this.#n||void 0,ironTriangleHash:this.#T()}}openEditor(t){if(!this.#t.includes(t)||this.#M)return;let e=this.#v(t);typeof e.showModal=="function"?e.showModal():e.setAttribute("open","")}checkValidity(){let{valid:t,errors:e}=Gt({vector:this.#s,rationales:this.#i,costWeights:this.#r,capacityPoints:this.#_(),overrunRationale:this.#n,minRationale:this.#$(),minOverrunRationale:this.#I()});this.setState("missing-rationale",!t);let s=this.querySelector("[data-quality-errors]");return s&&(s.textContent=e.join(" ")),t}#m(t){let e=t.target.closest?.(".axis[data-ility]");e&&this.contains(e)&&(t.preventDefault(),this.openEditor(e.dataset.ility))}#g(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))}#b(t){let e=t.target;e?.matches?.("[data-quality-overrun] textarea")&&(this.#n=e.value,this.checkValidity(),this.#q())}#v(t){if(this.#p[t])return this.#d(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 s=document.createElement("form");s.method="dialog",s.setAttribute("data-layout","stack"),s.setAttribute("data-layout-gap","m");let r=document.createElement("h3");r.textContent=G(t),s.append(r);let a=document.createElement("fieldset");a.setAttribute("data-layout","stack"),a.setAttribute("data-layout-gap","2xs");let i=document.createElement("legend");i.textContent="Priority",a.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])),a.append(b)}s.append(a);let o=document.createElement("form-field"),c=document.createElement("label");c.setAttribute("for",`${this.#u}-${t}-rationale`),c.textContent="Rationale (required when Critical)";let d=document.createElement("textarea");d.id=`${this.#u}-${t}-rationale`,d.name="rationale",d.rows=3,d.minLength=this.#$(),d.maxLength=this.#j(),d.placeholder=`Why \u2265 ${this.#$()} chars`,o.append(c,d),s.append(o);let l=document.createElement("p");l.className="message message-error",l.dataset.dialogError="",l.hidden=!0,s.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),s.append(u),e.append(s),this.append(e),this.#p[t]=e,s.addEventListener("submit",f=>{f.preventDefault();let v=s.querySelector('input[name="level"]:checked')?.value,_=s.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.#s[t]=v??"",v==="critical"?this.#i[t]=_.trim():delete this.#i[t],e.close("save"),this.#S("dialog",t)}),this.#d(t),this.#L(),e}#d(t){let e=this.#p[t];if(!e)return;let s=this.#s[t];for(let i of e.querySelectorAll('input[name="level"]')){let o=i;o.checked=o.value===s}let r=e.querySelector('textarea[name="rationale"]');r&&(r.value=this.#i[t]||"");let a=e.querySelector("[data-dialog-error]");a&&(a.hidden=!0,a.textContent="")}#h(){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="
|
|
3187
|
-
<textarea id="
|
|
3188
|
-
minlength="${this.#
|
|
3189
|
-
maxlength="${this.#
|
|
3186
|
+
<label for="${this.#u}-overrun">Overrun rationale (\u2265 ${this.#I()} chars)</label>
|
|
3187
|
+
<textarea id="${this.#u}-overrun" name="overrunRationale"
|
|
3188
|
+
minlength="${this.#I()}"
|
|
3189
|
+
maxlength="${this.#P()}"
|
|
3190
3190
|
rows="3"></textarea>
|
|
3191
3191
|
</form-field>
|
|
3192
|
-
`,t.append(e);let
|
|
3192
|
+
`,t.append(e);let s=document.createElement("p");s.dataset.qualityErrors="",s.className="message message-error",s.setAttribute("role","alert"),t.append(s),this.append(t),this.#l=t,this.#L()}#y(){if(!this.#l)return;let t=this.#_(),e=this.criticalSum,s=Number.isFinite(t)&&e>t,r=this.#l.querySelector("[data-quality-overrun]");if(r){r.hidden=!s;let a=r.querySelector("[data-overrun-prompt]");if(a){let d=e-t;a.textContent=s?`You're over budget by ${d} ${d===1?"point":"points"} (${e}/${t}).`:""}let i=this.#I(),o=r.querySelector("label");o&&(o.textContent=`Overrun rationale (\u2265 ${i} chars)`);let c=r.querySelector("textarea");c&&(c.minLength=i,c.maxLength=this.#P())}}#f(){let t=qe(this.getAttribute("data-cost-weights")||"");this.#r=Jt(this.#t,t)}#w(t){if(!(!t||typeof t!="object"))for(let[e,s]of Object.entries(t))ut.includes(s)&&(this.#s[e]=s)}#x(t){if(!(!t||typeof t!="object"))for(let[e,s]of Object.entries(t))this.#i[e]=String(s??"")}#_(){let t=this.#C();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 s=this.#c;return s!==null&&Number.isFinite(s)&&s>0?s:1/0}#A(){let t=this.#_();return Number.isFinite(t)?t:null}#k(){let t=this.#C();return t?.capacitySource==="manual"?"manual":t?"formula":(this.getAttribute("data-capacity-points"),"manual")}#C(){let t=this.getAttribute("data-bind-to");if(!t)return null;let e=this.getRootNode(),s=e.getElementById?e.getElementById(t):document.getElementById(t);return s&&s.localName==="iron-triangle"?s:null}#T(){return this.#C()?.hash||null}#N(){this.#o?.(),this.#o=null;let t=this.#C();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=Ss(Number(this.dataset.radius??100),30,400),e=this.#_(),s=Ne({ilities:this.#t,vector:this.#s,costWeights:this.#r,capacityPoints:e,radius:t}),r=this.querySelector(":scope > svg");r?r.replaceWith(s):this.prepend(s),this.#z()}#S(t,e){this.#E(),this.#y();let s=this.#_(),r=this.criticalSum,a=Number.isFinite(s)&&r>s;if(this.setState("over-budget",a),this.#q(),a!==this.#a){let i=a?"quality-target:over-budget":"quality-target:under-budget",o=a?{delta:r-s,criticalSum:r,capacityPoints:s}:{slack:s-r,criticalSum:r,capacityPoints:s};this.dispatchEvent(new CustomEvent(i,{bubbles:!0,composed:!0,detail:o})),this.#a=a}this.dispatchEvent(new CustomEvent("quality-target:change",{bubbles:!0,composed:!0,detail:{...this.value,source:t,field:e}}))}#q(){try{this.#e.setFormValue(JSON.stringify(this.value))}catch{}this.#R()}#R(){if(typeof this.#e.setValidity!="function")return;let{valid:t,errors:e}=Gt({vector:this.#s,rationales:this.#i,costWeights:this.#r,capacityPoints:this.#_(),overrunRationale:this.#n,minRationale:this.#$(),minOverrunRationale:this.#I()});if(t){this.#e.setValidity({});return}let s=this.overBudget?this.querySelector("[data-quality-overrun] textarea"):null;try{this.#e.setValidity({customError:!0},e.join(" "),s??void 0)}catch{this.#e.setValidity({customError:!0},e.join(" "))}}get#M(){return this.hasAttribute("disabled")||this.hasAttribute("locked")}#L(){let t=this.#M;for(let e of Object.values(this.#p))for(let s of e.querySelectorAll("input, textarea, select, button"))s.disabled=t;for(let e of this.#l?.querySelectorAll("textarea")??[])e.disabled=t;this.#z()}#z(){let t=this.#M;for(let e of this.querySelectorAll(":scope > svg .axis[data-ility]"))e.setAttribute("tabindex",t?"-1":"0"),t?e.setAttribute("aria-disabled","true"):e.removeAttribute("aria-disabled")}#$(){return Math.max(0,parseInt(this.dataset.minRationale??"10",10)||10)}#j(){return Math.max(10,parseInt(this.dataset.maxRationale??"200",10)||200)}#I(){return Math.max(0,parseInt(this.dataset.minOverrunRationale??"10",10)||10)}#P(){return Math.max(10,parseInt(this.dataset.maxOverrunRationale??"400",10)||400)}};function Ss(n,t,e){return Math.max(t,Math.min(e,n))}w("quality-target",Zt);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"]),$s=Object.freeze({critical:"Critical",important:"Important",acceptable:"Acceptable","not-relevant":"Not relevant"}),Le=["badge","priority-pill","rationale","conflicts"],qs=`
|
|
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
|
-
`,
|
|
3312
|
+
`,te=class extends C{#e=!1;static get observedAttributes(){return["data-priority","data-conflict","tabindex"]}setup(){if(this.shadowRoot)for(let e of Le){let s=this.shadowRoot.querySelector(`slot[name="${e}"]`);this.#s(e,s)}else{let e=this.attachShadow({mode:"open"});e.innerHTML=qs;for(let s of Le){let r=e.querySelector(`slot[name="${s}"]`);r?.addEventListener("slotchange",()=>this.#s(s,r)),this.#s(s,r)}}this.#i(),this.#r(),this.#n(),this.listen(this,"click",e=>this.#a(e));let t=this.closest("a[href], button");t&&this.listen(t,"click",e=>{this.contains(e.target)||this.#a(e)}),this.listen(this,"keydown",e=>{let s=e;(s.key==="Enter"||s.key===" ")&&this.#t&&(s.preventDefault(),this.#a(s))})}attributeChangedCallback(t){this.isConnected&&(t==="data-priority"?(this.#i(),this.#r()):t==="data-conflict"||t==="tabindex"&&this.#n())}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#t(){return this.hasAttribute("tabindex")||this.closest("a[href], button")}#s(t,e){let s=!!e&&e.assignedNodes().some(r=>r.nodeType===Node.ELEMENT_NODE||r.nodeType===Node.TEXT_NODE&&r.textContent.trim().length>0);this.setState(`has-${t}`,s)}#i(){let t=(this.dataset.priority||"").toLowerCase();for(let e of Me)this.setState(`priority-${e}`,e===t)}#r(){let t=(this.dataset.priority||"").toLowerCase(),e=this.shadowRoot?.querySelector("[data-priority-default]");e&&(e.textContent=$s[t]||"")}#n(){this.setState("interactive",!!this.#t);let t=this.hasAttribute("tabindex")&&!this.closest("a[href], button");t&&!this.hasAttribute("role")?(this.setAttribute("role","button"),this.#e=!0):!t&&this.#e&&(this.removeAttribute("role"),this.#e=!1)}#a(t){this.#t&&this.dispatchEvent(new CustomEvent("requirement-card:click",{bubbles:!0,composed:!0,detail:{priority:this.priority||null,hasConflict:this.hasConflict,originalEvent:t}}))}};w("requirement-card",te);
|