vanilla-breeze 0.1.2 → 0.1.4
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/dist/cdn/components/accessibility-specimen.js +11 -0
- package/dist/cdn/components/accordion-wc.js +1 -1
- package/dist/cdn/components/activity-feed.js +2 -0
- package/dist/cdn/components/adr-wc.js +17 -17
- package/dist/cdn/components/ai-chat.js +28 -0
- package/dist/cdn/components/ai-summary.js +10 -0
- package/dist/cdn/components/analytics-panel.js +5 -5
- package/dist/cdn/components/audio-player.js +3 -3
- package/dist/cdn/components/audio-visualizer.js +2 -2
- package/dist/cdn/components/author-index.js +2 -2
- package/dist/cdn/components/brand-mark.js +1 -1
- package/dist/cdn/components/bread-crumb.js +2 -0
- package/dist/cdn/components/breakpoint-specimen.js +26 -0
- package/dist/cdn/components/burndown-chart.js +2 -0
- package/dist/cdn/components/calendar-wc.js +2 -2
- package/dist/cdn/components/capacity-plan.js +25 -0
- package/dist/cdn/components/card-list.js +1 -1
- package/dist/cdn/components/carousel-wc.js +1 -1
- package/dist/cdn/components/change-set.js +2 -2
- package/dist/cdn/components/chart-wc.js +58 -36
- package/dist/cdn/components/chat-input.js +1 -1
- package/dist/cdn/components/chat-window.js +1 -1
- package/dist/cdn/components/color-palette.js +9 -9
- package/dist/cdn/components/color-picker.js +1 -1
- package/dist/cdn/components/combo-box.js +1 -1
- package/dist/cdn/components/command-palette.js +1 -1
- package/dist/cdn/components/comment-box.js +60 -0
- package/dist/cdn/components/comment-thread.js +60 -0
- package/dist/cdn/components/comment-wc.js +1 -1
- package/dist/cdn/components/compare-surface.js +1 -1
- package/dist/cdn/components/component-sampler.js +4 -4
- package/dist/cdn/components/consent-banner.js +1 -1
- package/dist/cdn/components/content-lens.js +1 -1
- package/dist/cdn/components/content-swap.js +1 -1
- package/dist/cdn/components/context-menu.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/date-picker.js +1 -1
- package/dist/cdn/components/day-view.js +1 -1
- package/dist/cdn/components/diagram-wc.js +3 -0
- package/dist/cdn/components/drag-surface.js +1 -1
- package/dist/cdn/components/drop-down.js +1 -1
- package/dist/cdn/components/emoji-picker.js +1 -1
- package/dist/cdn/components/empathy-map.js +41 -43
- package/dist/cdn/components/flow-diagram.js +1 -1
- package/dist/cdn/components/font-pairer.js +81 -81
- package/dist/cdn/components/foot-notes.js +1 -1
- package/dist/cdn/components/form-field.js +1 -1
- package/dist/cdn/components/gantt-chart.js +1 -1
- package/dist/cdn/components/geo-map.js +25 -23
- package/dist/cdn/components/glossary-index.js +1 -1
- package/dist/cdn/components/glossary-wc.js +1 -1
- package/dist/cdn/components/gradient-builder.js +29 -29
- package/dist/cdn/components/heading-links.js +1 -1
- package/dist/cdn/components/highlight-wc.js +2 -2
- package/dist/cdn/components/image-gallery.js +1 -1
- package/dist/cdn/components/image-map.js +1 -1
- package/dist/cdn/components/impact-effort.js +1 -1
- package/dist/cdn/components/include-file.js +1 -1
- package/dist/cdn/components/iron-triangle.js +2 -0
- package/dist/cdn/components/kanban-board.js +1 -1
- package/dist/cdn/components/layout-specimen.js +35 -0
- package/dist/cdn/components/manifest.json +228 -100
- package/dist/cdn/components/markdown-editor.js +1 -1
- package/dist/cdn/components/markdown-viewer.js +12 -12
- package/dist/cdn/components/motion-specimen.js +12 -12
- package/dist/cdn/components/nav-bar.js +2 -0
- package/dist/cdn/components/note-wc.js +2 -2
- package/dist/cdn/components/notification-wc.js +4 -4
- package/dist/cdn/components/page-info.js +21 -21
- package/dist/cdn/components/page-stats.js +1 -1
- package/dist/cdn/components/page-toc.js +1 -1
- package/dist/cdn/components/page-tools.js +1 -1
- package/dist/cdn/components/page-tour.js +6 -6
- package/dist/cdn/components/pager-wc.js +2 -0
- package/dist/cdn/components/palette-generator.js +11 -11
- package/dist/cdn/components/poll-wc.js +2 -0
- package/dist/cdn/components/pop-over.js +2 -0
- package/dist/cdn/components/popularity-index.js +2 -2
- package/dist/cdn/components/print-page.js +1 -1
- package/dist/cdn/components/product-roadmap.js +3 -0
- package/dist/cdn/components/progress-tracker.js +2 -0
- package/dist/cdn/components/qr-code.js +1 -1
- package/dist/cdn/components/quadrant-grid.js +3 -0
- package/dist/cdn/components/quality-target.js +12 -0
- package/dist/cdn/components/reaction-bar.js +2 -0
- package/dist/cdn/components/reader-view.js +3 -3
- package/dist/cdn/components/reading-progress.js +2 -0
- package/dist/cdn/components/recently-visited.js +26 -2
- package/dist/cdn/components/requirement-card.js +122 -0
- package/dist/cdn/components/review-surface.js +34 -40
- package/dist/cdn/components/risk-register.js +25 -0
- package/dist/cdn/components/roadmap.js +3 -0
- package/dist/cdn/components/score-card.js +197 -0
- package/dist/cdn/components/selection-menu.js +1 -1
- package/dist/cdn/components/semantic-palette.js +15 -15
- package/dist/cdn/components/settings-panel.js +12 -12
- package/dist/cdn/components/share-wc.js +2 -2
- package/dist/cdn/components/short-cuts.js +1 -1
- package/dist/cdn/components/site-index.js +4 -4
- package/dist/cdn/components/site-map-wc.js +1 -1
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/site-search.js +9 -9
- package/dist/cdn/components/slide-accept.js +1 -1
- package/dist/cdn/components/social-embed.js +1 -1
- package/dist/cdn/components/spacing-specimen.js +5 -5
- package/dist/cdn/components/split-surface.js +1 -1
- package/dist/cdn/components/star-rating.js +1 -1
- package/dist/cdn/components/status-wc.js +2 -0
- package/dist/cdn/components/stepper-wc.js +2 -0
- package/dist/cdn/components/story-map.js +1 -1
- package/dist/cdn/components/tab-set.js +1 -1
- package/dist/cdn/components/text-reader.js +2 -2
- package/dist/cdn/components/theme-catalog.js +28 -0
- package/dist/cdn/components/theme-export.js +20 -12
- package/dist/cdn/components/theme-import.js +44 -0
- package/dist/cdn/components/theme-picker.js +31 -28
- package/dist/cdn/components/time-index.js +2 -2
- package/dist/cdn/components/time-picker.js +1 -1
- package/dist/cdn/components/toast-msg.js +3 -3
- package/dist/cdn/components/token-specimen.js +14 -14
- package/dist/cdn/components/tool-tip.js +1 -1
- package/dist/cdn/components/topic-map.js +3 -2
- package/dist/cdn/components/traceability-matrix.js +3 -0
- package/dist/cdn/components/trust-filter.js +3 -3
- package/dist/cdn/components/type-specimen.js +15 -15
- package/dist/cdn/components/user-journey.js +63 -70
- package/dist/cdn/components/user-persona.js +75 -13
- package/dist/cdn/components/user-story.js +13 -12
- package/dist/cdn/components/version-switcher.js +17 -0
- package/dist/cdn/components/video-player.js +4 -4
- package/dist/cdn/components/watch-wc.js +2 -2
- package/dist/cdn/components/week-view.js +1 -1
- package/dist/cdn/components/work-item.js +29 -28
- package/dist/cdn/components/youtube-player.js +1 -1
- package/dist/cdn/packs/design-system.full.js +59 -51
- package/dist/cdn/packs/effects.full.js +1 -1
- package/dist/cdn/packs/icons.effects.js +1 -1
- package/dist/cdn/packs/icons.full.js +1 -1
- package/dist/cdn/packs/kawaii.full.css +1 -1
- package/dist/cdn/packs/kawaii.full.js +6 -6
- package/dist/cdn/packs/kawaii.theme.css +1 -1
- package/dist/cdn/packs/manifest.json +11 -11
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +54 -51
- package/dist/cdn/packs/ux-planning.full.css +1 -1
- package/dist/cdn/packs/ux-planning.full.js +324 -248
- package/dist/cdn/themes/8bit.css +1 -1
- package/dist/cdn/themes/8bit.tokens.json +662 -0
- package/dist/cdn/themes/alpha1999-dark.tokens.json +693 -0
- package/dist/cdn/themes/alpha1999.css +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +869 -0
- package/dist/cdn/themes/anthropic.css +2 -0
- package/dist/cdn/themes/anthropic.tokens.json +564 -0
- package/dist/cdn/themes/art-deco-dark.tokens.json +407 -0
- package/dist/cdn/themes/art-deco.css +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +581 -0
- package/dist/cdn/themes/bauhaus-dark.tokens.json +260 -0
- package/dist/cdn/themes/bauhaus.css +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +589 -0
- package/dist/cdn/themes/brutalist-dark.tokens.json +503 -0
- package/dist/cdn/themes/brutalist.tokens.json +677 -0
- package/dist/cdn/themes/catalog/atlassian.tokens.json +303 -0
- package/dist/cdn/themes/catalog/bootstrap.tokens.json +304 -0
- package/dist/cdn/themes/catalog/carbon.tokens.json +301 -0
- package/dist/cdn/themes/catalog/catppuccin-mocha.tokens.json +301 -0
- package/dist/cdn/themes/catalog/govuk.tokens.json +301 -0
- package/dist/cdn/themes/catalog/manifest.json +132 -0
- package/dist/cdn/themes/catalog/material.tokens.json +289 -0
- package/dist/cdn/themes/catalog/salesforce.tokens.json +301 -0
- package/dist/cdn/themes/catalog/tailwind.tokens.json +302 -0
- package/dist/cdn/themes/catppuccin-frappe.css +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +608 -0
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +472 -0
- package/dist/cdn/themes/catppuccin-latte.css +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +608 -0
- package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +608 -0
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +608 -0
- package/dist/cdn/themes/classic-dark.tokens.json +503 -0
- package/dist/cdn/themes/classic.tokens.json +640 -0
- package/dist/cdn/themes/claymorphism-dark.tokens.json +493 -0
- package/dist/cdn/themes/claymorphism.css +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +626 -0
- package/dist/cdn/themes/clinical-dark.tokens.json +472 -0
- package/dist/cdn/themes/clinical.tokens.json +608 -0
- package/dist/cdn/themes/cottagecore-dark.tokens.json +412 -0
- package/dist/cdn/themes/cottagecore.css +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +544 -0
- package/dist/cdn/themes/cyber.tokens.json +668 -0
- package/dist/cdn/themes/dawn-dark.tokens.json +472 -0
- package/dist/cdn/themes/dawn.css +1 -1
- package/dist/cdn/themes/dawn.tokens.json +608 -0
- package/dist/cdn/themes/dracula.tokens.json +534 -0
- package/dist/cdn/themes/dusk.tokens.json +533 -0
- package/dist/cdn/themes/editorial-dark.tokens.json +400 -0
- package/dist/cdn/themes/editorial.tokens.json +690 -0
- package/dist/cdn/themes/financial-dark.tokens.json +472 -0
- package/dist/cdn/themes/financial.css +1 -1
- package/dist/cdn/themes/financial.tokens.json +607 -0
- package/dist/cdn/themes/genai.tokens.json +534 -0
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +489 -0
- package/dist/cdn/themes/glassmorphism.css +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +632 -0
- package/dist/cdn/themes/government-dark.tokens.json +472 -0
- package/dist/cdn/themes/government.tokens.json +608 -0
- package/dist/cdn/themes/gruvbox-dark.tokens.json +472 -0
- package/dist/cdn/themes/gruvbox.tokens.json +608 -0
- package/dist/cdn/themes/high-noon-dark.tokens.json +397 -0
- package/dist/cdn/themes/high-noon.tokens.json +533 -0
- package/dist/cdn/themes/ibm.css +2 -0
- package/dist/cdn/themes/ibm.tokens.json +568 -0
- package/dist/cdn/themes/kawaii-dark.tokens.json +549 -0
- package/dist/cdn/themes/kawaii.css +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +641 -0
- package/dist/cdn/themes/magna-dark.tokens.json +482 -0
- package/dist/cdn/themes/magna.css +1 -1
- package/dist/cdn/themes/magna.tokens.json +632 -0
- package/dist/cdn/themes/manifest.json +162 -62
- package/dist/cdn/themes/mcdonalds.css +2 -0
- package/dist/cdn/themes/mcdonalds.tokens.json +533 -0
- package/dist/cdn/themes/midnight.tokens.json +534 -0
- package/dist/cdn/themes/minimal-dark.tokens.json +294 -0
- package/dist/cdn/themes/minimal.tokens.json +494 -0
- package/dist/cdn/themes/modern-dark.tokens.json +490 -0
- package/dist/cdn/themes/modern.tokens.json +573 -0
- package/dist/cdn/themes/nes-dark.tokens.json +564 -0
- package/dist/cdn/themes/nes.css +1 -1
- package/dist/cdn/themes/nes.tokens.json +687 -0
- package/dist/cdn/themes/neumorphism-dark.tokens.json +471 -0
- package/dist/cdn/themes/neumorphism.css +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +589 -0
- package/dist/cdn/themes/nord-dark.tokens.json +484 -0
- package/dist/cdn/themes/nord.tokens.json +619 -0
- package/dist/cdn/themes/organic-dark.tokens.json +532 -0
- package/dist/cdn/themes/organic.tokens.json +685 -0
- package/dist/cdn/themes/rose-pine-dark.tokens.json +472 -0
- package/dist/cdn/themes/rose-pine.tokens.json +608 -0
- package/dist/cdn/themes/rough-dark.tokens.json +515 -0
- package/dist/cdn/themes/rough.css +1 -1
- package/dist/cdn/themes/rough.tokens.json +650 -0
- package/dist/cdn/themes/solarized-dark.tokens.json +397 -0
- package/dist/cdn/themes/solarized.tokens.json +532 -0
- package/dist/cdn/themes/starbucks.css +2 -0
- package/dist/cdn/themes/starbucks.tokens.json +593 -0
- package/dist/cdn/themes/startup-dark.tokens.json +522 -0
- package/dist/cdn/themes/startup.css +1 -1
- package/dist/cdn/themes/startup.tokens.json +607 -0
- package/dist/cdn/themes/super2026-dark.tokens.json +667 -0
- package/dist/cdn/themes/super2026.tokens.json +863 -0
- package/dist/cdn/themes/swiss-dark.tokens.json +390 -0
- package/dist/cdn/themes/swiss.tokens.json +750 -0
- package/dist/cdn/themes/terminal.css +1 -1
- package/dist/cdn/themes/terminal.tokens.json +689 -0
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +472 -0
- package/dist/cdn/themes/tokyo-night.tokens.json +608 -0
- package/dist/cdn/themes/vaporwave-dark.tokens.json +413 -0
- package/dist/cdn/themes/vaporwave.tokens.json +549 -0
- package/dist/cdn/themes/win9x-dark.tokens.json +563 -0
- package/dist/cdn/themes/win9x.tokens.json +700 -0
- package/dist/cdn/vanilla-breeze-charts.css +1 -1
- package/dist/cdn/vanilla-breeze-charts.js +58 -36
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +246 -51
- package/dist/cdn/vanilla-breeze-dev.js +1 -1
- package/dist/cdn/vanilla-breeze-extras.js +90 -80
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +1395 -405
- package/package.json +14 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ce=window.matchMedia("(prefers-reduced-motion: reduce)");var zt=new Map;function x(c,t,e={}){let s=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=zt.get(c);if(customElements.get(c)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}zt.set(c,r),customElements.define(c,t)}var C=class extends HTMLElement{#e=[];#s;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.#s||(this.#s=this.attachInternals());let s=this.#s.states;try{e?s.add(t):s.delete(t)}catch{let r=`--${t}`;e?s.add(r):s.delete(r)}}_adoptInternals(t){this.#s||(this.#s=t)}};var st=class c extends C{#e=null;#s=null;#t=!1;#i=null;setup(){this.setAttribute("role","list"),this.#t=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.#o(),this.#n(),this.#m(),this.#r()}teardown(){this.#e&&(this.#e.remove(),this.#e=null),c.#C?.source===this&&(c.#C=null)}get draggableChildren(){return[...this.querySelectorAll(':scope > [draggable="true"]')]}get group(){return this.getAttribute("group")||null}get orientation(){return this.getAttribute("orientation")||"vertical"}get sortedOrder(){return this.draggableChildren.map(t=>t.dataset.id)}#r(){for(let t of this.draggableChildren)t.getAttribute("role")||t.setAttribute("role","listitem"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("aria-grabbed")||t.setAttribute("aria-grabbed","false")}#o(){this.#e=document.createElement("div"),this.#e.setAttribute("role","status"),this.#e.setAttribute("aria-live","polite"),this.#e.setAttribute("aria-atomic","true"),this.#e.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);",this.prepend(this.#e)}#a(t){let e=this.#e;e&&(e.textContent="",requestAnimationFrame(()=>{e.textContent=t}))}#n(){this.listen(this,"pointerdown",t=>{this.#i=t.target}),this.listen(this,"dragstart",this.#l.bind(this)),this.listen(this,"dragover",this.#c.bind(this)),this.listen(this,"dragleave",this.#p.bind(this)),this.listen(this,"drop",this.#d.bind(this)),this.listen(this,"dragend",this.#u.bind(this))}#l(t){let e=t.target.closest('[draggable="true"]');if(!e||e.parentElement!==this||this.hasAttribute("disabled"))return;let s=e.querySelector("[data-drag-handle]");if(s&&!s.contains(this.#i)){t.preventDefault();return}e.setAttribute("data-dragging",""),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",e.dataset.id||""),t.dataTransfer.setData("application/x-drag-surface-group",this.group||"");let r=this.#f(e);c.#C={item:e,source:this,originalIndex:r},this.dispatchEvent(new CustomEvent("drag-surface:reorder-start",{bubbles:!0}))}#c(t){let e=c.#C;if(!e||(this.group||e.source.group)&&this.group!==e.source.group)return;t.preventDefault(),t.dataTransfer.dropEffect="move",this.setAttribute("data-drag-over","");let s=this.orientation==="horizontal"?t.clientX:t.clientY;this.#A(s)}#p(t){t.relatedTarget&&!this.contains(t.relatedTarget)&&(this.removeAttribute("data-drag-over"),this.#_())}#d(t){t.preventDefault(),this.removeAttribute("data-drag-over"),this.#_();let e=c.#C;if(!e)return;let{item:s,source:r,originalIndex:i}=e,a=this.orientation==="horizontal"?t.clientX:t.clientY,o=this.#k(a);if(r===this){this.#g(s,o),this.#b();let n=this.#f(s);this.#h(s),this.dispatchEvent(new CustomEvent("drag-surface:reorder",{bubbles:!0,detail:{item:s,itemId:s.dataset.id,oldIndex:i,newIndex:n,order:this.sortedOrder}}))}else this.#g(s,o),this.#b(),r.#b(),this.#h(s),this.dispatchEvent(new CustomEvent("drag-surface:transfer",{bubbles:!0,detail:{item:s,itemId:s.dataset.id,fromSurface:r,toSurface:this,newIndex:this.#f(s),fromOrder:r.sortedOrder,toOrder:this.sortedOrder}}))}#u(){let t=c.#C;t?.item&&t.item.removeAttribute("data-dragging"),this.removeAttribute("data-drag-over"),this.#_(),c.#C=null,this.dispatchEvent(new CustomEvent("drag-surface:reorder-end",{bubbles:!0}))}#m(){this.listen(this,"keydown",this.#y.bind(this))}#y(t){let e=t.target.closest('[draggable="true"]');if(!e||e.parentElement!==this||this.hasAttribute("disabled"))return;let s=e.getAttribute("aria-grabbed")==="true",r=this.orientation==="horizontal",i=r?"ArrowLeft":"ArrowUp",a=r?"ArrowRight":"ArrowDown";if(t.key===" "||t.key==="Enter"){if(t.preventDefault(),s){e.setAttribute("aria-grabbed","false"),this.removeAttribute("data-reorder-mode"),this.#b(),this.#h(e);let d=this.#f(e),l=this.draggableChildren;this.#a(`${this.#x(e)}, dropped at position ${d+1} of ${l.length}`),this.dispatchEvent(new CustomEvent("drag-surface:reorder",{bubbles:!0,detail:{item:e,itemId:e.dataset.id,oldIndex:this.#s,newIndex:d,order:this.sortedOrder}})),this.dispatchEvent(new CustomEvent("drag-surface:reorder-end",{bubbles:!0})),this.#s=null}else{this.#s=this.#f(e),e.setAttribute("aria-grabbed","true"),this.setAttribute("data-reorder-mode","");let d=this.draggableChildren;this.#a(`${this.#x(e)}, grabbed. Position ${this.#s+1} of ${d.length}. Use arrow keys to move, Enter to drop, Escape to cancel.`),this.dispatchEvent(new CustomEvent("drag-surface:reorder-start",{bubbles:!0}))}return}if(!s&&(t.key===i||t.key===a)){t.preventDefault();let d=this.draggableChildren,l=d.indexOf(e),u=t.key===i?Math.max(0,l-1):Math.min(d.length-1,l+1);u!==l&&d[u].focus();return}if(s&&(t.key===i||t.key===a)){t.preventDefault();let d=this.draggableChildren,l=d.indexOf(e),u=t.key===i?Math.max(0,l-1):Math.min(d.length-1,l+1);u!==l&&(this.#g(e,u),e.focus(),this.#a(`Position ${u+1} of ${d.length}`));return}let o=r?"ArrowUp":"ArrowLeft",n=r?"ArrowDown":"ArrowRight";if(s&&(t.key===o||t.key===n)){if(t.preventDefault(),!this.group)return;let d=t.key===n?1:-1,l=this.#v(d);if(!l)return;l.appendChild(e),l.#b(),this.#b(),l.#h(e),e.focus();let u=l.getAttribute("aria-label")||"next surface";l.#a(`Moved to ${u}`),l.dispatchEvent(new CustomEvent("drag-surface:transfer",{bubbles:!0,detail:{item:e,itemId:e.dataset.id,fromSurface:this,toSurface:l,newIndex:l.draggableChildren.indexOf(e),fromOrder:this.sortedOrder,toOrder:l.sortedOrder}})),this.removeAttribute("data-reorder-mode"),l.setAttribute("data-reorder-mode",""),this.#s=null;return}if(s&&t.key==="Escape"){t.preventDefault(),e.setAttribute("aria-grabbed","false"),this.removeAttribute("data-reorder-mode"),this.#s!=null&&(this.#g(e,this.#s),e.focus()),this.#a("Reorder cancelled"),this.dispatchEvent(new CustomEvent("drag-surface:reorder-end",{bubbles:!0})),this.#s=null;return}!s&&t.key==="Escape"&&(t.preventDefault(),e.blur())}#h(t){t.setAttribute("data-just-dropped",""),t.addEventListener("animationend",()=>{t.removeAttribute("data-just-dropped")},{once:!0}),setTimeout(()=>t.removeAttribute("data-just-dropped"),500)}#v(t){if(!this.group)return null;let e=[...document.querySelectorAll(`drag-surface[group="${this.group}"]`)];if(e.length<2)return null;e.sort((i,a)=>{let o=i.getBoundingClientRect(),n=a.getBoundingClientRect();return o.left-n.left||o.top-n.top});let s=e.indexOf(this);return e[s+t]||null}#x(t){return t.dataset.id||t.textContent.trim().slice(0,40)}#f(t){return this.draggableChildren.indexOf(t)}#g(t,e){let r=this.draggableChildren.filter(i=>i!==t)[e]||null;r?this.insertBefore(t,r):this.appendChild(t)}#b(){this.draggableChildren.forEach((t,e)=>{t.dataset.sortOrder=String(e+1)})}#k(t){let e=this.orientation==="horizontal",s=this.draggableChildren.filter(r=>!r.hasAttribute("data-dragging"));for(let r=0;r<s.length;r++){let i=s[r].getBoundingClientRect(),a=e?i.left+i.width/2:i.top+i.height/2;if(t<a)return r}return s.length}#A(t){this.#_();let e=this.orientation==="horizontal",s=this.draggableChildren.filter(r=>!r.hasAttribute("data-dragging"));for(let r=0;r<s.length;r++){let i=s[r].getBoundingClientRect(),a=e?i.left+i.width/2:i.top+i.height/2;if(t<a){s[r].setAttribute("data-drop-target","before");return}}s.length>0&&s[s.length-1].setAttribute("data-drop-target","after")}#_(){for(let t of this.querySelectorAll("[data-drop-target]"))t.removeAttribute("data-drop-target")}static#C=null};x("drag-surface",st);var Dt=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
font-family: var(--user-persona-font, var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif));
|
|
@@ -13,6 +13,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
13
13
|
--_goals: var(--user-persona-goals, #22c55e);
|
|
14
14
|
--_frustrations: var(--user-persona-frustrations, #ef4444);
|
|
15
15
|
--_behaviors: var(--user-persona-behaviors, #8b5cf6);
|
|
16
|
+
--_stories: var(--user-persona-stories, #3b82f6);
|
|
16
17
|
--_shadow: var(--user-persona-shadow, var(--shadow-md));
|
|
17
18
|
--_space-2xs: var(--user-persona-space-2xs, var(--size-2xs, 0.25rem));
|
|
18
19
|
--_space-xs: var(--user-persona-space-xs, var(--size-xs, 0.5rem));
|
|
@@ -197,6 +198,53 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
197
198
|
.section-icon.goals { background: var(--_goals); }
|
|
198
199
|
.section-icon.frustrations { background: var(--_frustrations); }
|
|
199
200
|
.section-icon.behaviors { background: var(--_behaviors); }
|
|
201
|
+
.section-icon.stories { background: var(--_stories); }
|
|
202
|
+
|
|
203
|
+
/* Stories section \u2014 auto-rendered list of related <user-story> elements */
|
|
204
|
+
.section-count {
|
|
205
|
+
margin-inline-start: var(--_space-2xs);
|
|
206
|
+
padding: 0.05em 0.5ch;
|
|
207
|
+
border-radius: 999px;
|
|
208
|
+
background: var(--color-surface-raised, oklch(95% 0 0));
|
|
209
|
+
color: var(--color-text-muted);
|
|
210
|
+
font-size: 0.75em;
|
|
211
|
+
font-weight: 600;
|
|
212
|
+
}
|
|
213
|
+
.story-list {
|
|
214
|
+
list-style: none;
|
|
215
|
+
margin: 0;
|
|
216
|
+
padding: 0;
|
|
217
|
+
display: grid;
|
|
218
|
+
gap: var(--_space-2xs);
|
|
219
|
+
}
|
|
220
|
+
.story-item {
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
gap: var(--_space-s);
|
|
224
|
+
padding-block: var(--_space-2xs);
|
|
225
|
+
border-block-end: 1px solid var(--color-border-muted, var(--color-border, #e5e7eb));
|
|
226
|
+
}
|
|
227
|
+
.story-item:last-child { border-block-end: none; }
|
|
228
|
+
.story-item a {
|
|
229
|
+
color: var(--color-interactive, currentColor);
|
|
230
|
+
text-decoration: none;
|
|
231
|
+
flex: 1;
|
|
232
|
+
}
|
|
233
|
+
.story-item a:hover { text-decoration: underline; }
|
|
234
|
+
.story-meta {
|
|
235
|
+
font-size: var(--_font-xs);
|
|
236
|
+
color: var(--color-text-muted);
|
|
237
|
+
text-transform: uppercase;
|
|
238
|
+
letter-spacing: 0.05em;
|
|
239
|
+
padding: 0 0.5ch;
|
|
240
|
+
border: 1px solid var(--color-border-muted, var(--color-border, #e5e7eb));
|
|
241
|
+
border-radius: var(--_radius-m);
|
|
242
|
+
}
|
|
243
|
+
.empty-stories {
|
|
244
|
+
margin: 0;
|
|
245
|
+
color: var(--color-text-muted);
|
|
246
|
+
font-style: italic;
|
|
247
|
+
}
|
|
200
248
|
|
|
201
249
|
.section-title {
|
|
202
250
|
font-size: var(--_font-sm);
|
|
@@ -246,43 +294,55 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
246
294
|
transition: none !important;
|
|
247
295
|
}
|
|
248
296
|
}
|
|
249
|
-
`;function
|
|
250
|
-
<
|
|
297
|
+
`;function g(c){return String(c).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function z(c){return c.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function D(c){let t=0;for(let s=0;s<c.length;s++)t=c.charCodeAt(s)+((t<<5)-t);return`hsl(${(t%360+360)%360}, 65%, 55%)`}function A(c){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${c}</svg>`}var k={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"/>'},rt={says:{label:"Says",icon:k.messageCircle,color:"#3b82f6"},thinks:{label:"Thinks",icon:k.lightbulb,color:"#8b5cf6"},does:{label:"Does",icon:k.wrench,color:"#f59e0b"},feels:{label:"Feels",icon:k.heart,color:"#ef4444"}},N={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 Gt="https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait",U=[32,64,128,256,512];function Jt(c){let t=0;for(let e=0;e<c.length;e++)t=c.charCodeAt(e)+((t<<5)-t);return t}function Zt(c){let t=U[0],e=Math.abs(c-t);for(let s=1;s<U.length;s++){let r=Math.abs(c-U[s]);r<e&&(t=U[s],e=r)}return t}function Pt(c,t=128){let e=Jt(String(c)),s=(e%100+100)%100,r=(e>>>16&1)===0?"female":"male",i=Zt(t);return`${Gt}/${r}/${i}/${s}.jpg`}function it(c){let t=0;for(let e=0;e<c.length;e++)t=c.charCodeAt(e)+((t<<5)-t);return t}var te=["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"],ee=["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"],se=["San Francisco, CA","Austin, TX","London, UK","Toronto, CA","Berlin, DE","Tokyo, JP","Sydney, AU","S\xE3o Paulo, BR"],re=["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."],ie=["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"],ae=["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"],oe=["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"],at=class extends HTMLElement{static get observedAttributes(){return["role","age","location","avatar","compact","src","data-list-stories","id"]}#e=new Map;#s=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="${ne(this.id)}"]`))}#t(){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.#n(),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.#n()}catch(e){console.warn(`[user-persona] Failed to load src="${t}":`,e)}}connectedCallback(){this.#t(),this.hasAttribute("data-mock")?this.#a():this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#n(),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.#s?.disconnect(),this.#s=null}#i(){if(!this.hasAttribute("data-list-stories")||!this.id){this.#s?.disconnect(),this.#s=null;return}this.#s||(this.#s=new MutationObserver(()=>this.#r()),this.#s.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.#o())}#o(){if(!this.hasAttribute("data-list-stories")||!this.id)return"";let t=this.relatedStories();return`
|
|
298
|
+
<section class="section" part="section-stories" data-stories-section>
|
|
299
|
+
<div class="section-header">
|
|
300
|
+
<div class="section-icon stories" aria-hidden="true">
|
|
301
|
+
<svg viewBox="0 0 24 24"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
|
|
302
|
+
</div>
|
|
303
|
+
<span class="section-title">Stories <span class="section-count">${t.length}</span></span>
|
|
304
|
+
</div>
|
|
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 s=e.id||e.getAttribute("story-id")||"",r=e.querySelector('[slot="action"]')?.textContent?.trim()||e.getAttribute("action")||e.id||"untitled",i=e.getAttribute("priority")||"",a=e.getAttribute("status")||"";return`<li class="story-item" data-priority="${g(i)}" data-status="${g(a)}">${s?`<a href="#${g(s)}">${g(r)}</a>`:`<span>${g(r)}</span>`}${i?`<span class="story-meta">${g(i)}</span>`:""}${a?`<span class="story-meta">${g(a)}</span>`:""}</li>`}).join("")}</ul>`}
|
|
307
|
+
</div>
|
|
308
|
+
</section>
|
|
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.#n()}}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=i=>i[(it(t+i.length)%i.length+i.length)%i.length],s=(i,a)=>{let o=[];for(let n=0;n<a;n++)o.push(i[(it(t+n+i.length)%i.length+i.length)%i.length]);return[...new Set(o)]};if(!this.querySelector('[slot="name"]')){let i=document.createElement("h2");i.slot="name",i.textContent=e(te),this.appendChild(i)}if(this.getAttribute("role")||this.setAttribute("role",e(ee)),this.getAttribute("age")||this.setAttribute("age",String(25+(it(t)%30+30)%30)),this.getAttribute("location")||this.setAttribute("location",e(se)),!this.getAttribute("avatar")){let i=this.querySelector('[slot="name"]')?.textContent?.trim()||"Persona";this.setAttribute("avatar",Pt(i,256))}if(!this.querySelector('[slot="quote"]')){let i=document.createElement("p");i.slot="quote",i.textContent=e(re),this.appendChild(i)}let r=(i,a)=>{if(this.querySelector(`[slot="${i}"]`))return;let o=document.createElement("ul");o.setAttribute("slot",i);for(let n of a){let d=document.createElement("li");d.textContent=n,o.appendChild(d)}this.appendChild(o)};r("goals",s(ie,3)),r("frustrations",s(ae,3)),r("behaviors",s(oe,3))}#n(){let t=this.personaName,e=this.personaRole,s=this.age,r=this.location,i=this.avatar,a=this.quote,o=D(t),n=i?`background:url(${g(i)}) center/cover`:`background:${o}`;this.shadowRoot.innerHTML=`
|
|
310
|
+
<style>${Dt}</style>
|
|
251
311
|
|
|
252
312
|
<article class="persona-card" part="card" role="article"
|
|
253
|
-
aria-label="User persona: ${
|
|
313
|
+
aria-label="User persona: ${g(t)}">
|
|
254
314
|
|
|
255
315
|
<header class="persona-header" part="header">
|
|
256
316
|
<div class="avatar" part="avatar" style="${n}"
|
|
257
|
-
role="img" aria-label="Avatar for ${
|
|
258
|
-
${
|
|
317
|
+
role="img" aria-label="Avatar for ${g(t)}">
|
|
318
|
+
${i?"":g(z(t))}
|
|
259
319
|
</div>
|
|
260
320
|
<div class="header-info">
|
|
261
321
|
<div class="persona-name-wrap" part="name">
|
|
262
|
-
<slot name="name"><h2 class="persona-name-fallback">${
|
|
322
|
+
<slot name="name"><h2 class="persona-name-fallback">${g(t)}</h2></slot>
|
|
263
323
|
</div>
|
|
264
|
-
${e?`<p class="persona-role" part="role">${
|
|
324
|
+
${e?`<p class="persona-role" part="role">${g(e)}</p>`:""}
|
|
265
325
|
<div class="persona-meta" part="meta">
|
|
266
326
|
${s?`
|
|
267
327
|
<span class="meta-item">
|
|
268
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>
|
|
269
|
-
${
|
|
329
|
+
${g(s)} years old
|
|
270
330
|
</span>
|
|
271
331
|
`:""}
|
|
272
|
-
${
|
|
332
|
+
${r?`
|
|
273
333
|
<span class="meta-item">
|
|
274
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>
|
|
275
|
-
${
|
|
335
|
+
${g(r)}
|
|
276
336
|
</span>
|
|
277
337
|
`:""}
|
|
278
338
|
</div>
|
|
279
339
|
</div>
|
|
280
340
|
</header>
|
|
281
341
|
|
|
282
|
-
${
|
|
342
|
+
${a||this.querySelector('[slot="quote"]')?`
|
|
283
343
|
<div class="persona-quote" part="quote">
|
|
284
344
|
<span class="quote-mark" aria-hidden="true">“</span>
|
|
285
|
-
<div class="quote-text-wrap"><slot name="quote"><p class="quote-text">${
|
|
345
|
+
<div class="quote-text-wrap"><slot name="quote"><p class="quote-text">${g(a)}</p></slot></div>
|
|
286
346
|
</div>
|
|
287
347
|
`:""}
|
|
288
348
|
|
|
@@ -334,9 +394,11 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
334
394
|
<slot name="behaviors">No behaviors documented.</slot>
|
|
335
395
|
</div>
|
|
336
396
|
</div>
|
|
397
|
+
|
|
398
|
+
${this.#o()}
|
|
337
399
|
</div>
|
|
338
400
|
</article>
|
|
339
|
-
`}};x("user-persona",
|
|
401
|
+
`}};function ne(c){return typeof CSS<"u"&&CSS.escape?CSS.escape(String(c)):String(c).replace(/["\\]/g,"\\$&")}x("user-persona",at);var ot=`
|
|
340
402
|
:host {
|
|
341
403
|
--_bg: var(--user-story-bg, var(--color-surface, #ffffff));
|
|
342
404
|
--_text: var(--user-story-text, var(--color-text, #1a1a1a));
|
|
@@ -535,10 +597,11 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
535
597
|
fill: white;
|
|
536
598
|
}
|
|
537
599
|
|
|
538
|
-
/* Semantic section-icon colors
|
|
539
|
-
|
|
540
|
-
.section-icon.
|
|
541
|
-
.section-icon.
|
|
600
|
+
/* Semantic section-icon colors \u2014 driven by VB theme tokens so they shift
|
|
601
|
+
with the active theme rather than fighting it. */
|
|
602
|
+
.section-icon.acceptance { background: var(--color-success, #22c55e); }
|
|
603
|
+
.section-icon.notes { background: var(--color-warning, #f59e0b); }
|
|
604
|
+
.section-icon.tasks { background: var(--color-accent, #8b5cf6); }
|
|
542
605
|
|
|
543
606
|
.section-title {
|
|
544
607
|
font-size: var(--_font-xs);
|
|
@@ -658,41 +721,41 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
658
721
|
:host([detail="compact"]) .slot-fallback {
|
|
659
722
|
display: none;
|
|
660
723
|
}
|
|
661
|
-
`;var
|
|
662
|
-
<style>${
|
|
663
|
-
<article class="story-card story-card--minimal" role="article" aria-label="${
|
|
724
|
+
`;var nt=class c 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;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.#t(),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 i of t[s]){let a=document.createElement("li");a.textContent=String(i),r.appendChild(a)}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.#t()}catch(e){console.warn(`[user-story] Failed to load src="${t}":`,e)}}connectedCallback(){this.#s(),this.storyId&&!this.id&&(this.id=this.storyId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#t(),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.#t())}get persona(){return this.querySelector('[slot="persona"]')?.textContent?.trim()||this.#e.get("persona")||"user"}get personaId(){return this.getAttribute("persona-id")||""}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){c.STATUSES[t]&&(this.setAttribute("status",t),this.dispatchEvent(new CustomEvent("status-changed",{detail:{status:t,storyId:this.storyId},bubbles:!0,composed:!0})))}updatePriority(t){c.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"),i=document.createElement("h3");i.textContent=this.storyTitle||this.storyId||"Story Detail";let a=document.createElement("button");a.type="submit",a.setAttribute("aria-label","Close"),a.textContent="\xD7",r.appendChild(i),r.appendChild(a);let o=document.createElement("section"),n=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"||n.setAttribute(l,this.getAttribute(l)??"");let d=[...this.children].some(l=>l.getAttribute("slot")&&l.tagName!=="DIALOG");n.setAttribute("detail",d?"full":"compact"),n.removeAttribute("id");for(let l of[...this.children])l.tagName!=="DIALOG"&&n.appendChild(l.cloneNode(!0));o.appendChild(n),s.appendChild(r),s.appendChild(o),e.innerHTML="",e.appendChild(s),e.addEventListener("close",()=>{e.innerHTML=""},{once:!0}),e.showModal()}#t(){let t=c.PRIORITIES[this.priority]||c.PRIORITIES.medium,e=c.STATUSES[this.status]||c.STATUSES.backlog,s=this._detailLevel,r=this.storyId?`User story: ${g(this.storyId)}`:"User story";if(this.shadowRoot){if(s==="minimal"){this.shadowRoot.innerHTML=`
|
|
725
|
+
<style>${ot}</style>
|
|
726
|
+
<article class="story-card story-card--minimal" role="article" aria-label="${r}"
|
|
664
727
|
tabindex="0">
|
|
665
728
|
<div class="story-body">
|
|
666
|
-
${this.storyId?`<span class="story-id">${
|
|
729
|
+
${this.storyId?`<span class="story-id">${g(this.storyId)}</span>`:""}
|
|
667
730
|
<div class="story-title-wrap">
|
|
668
|
-
<slot name="title"><span class="story-title-fallback">${
|
|
731
|
+
<slot name="title"><span class="story-title-fallback">${g(this._minimalLabel||"[describe the action]")}</span></slot>
|
|
669
732
|
</div>
|
|
670
733
|
</div>
|
|
671
734
|
</article>
|
|
672
|
-
`;let
|
|
673
|
-
<style>${
|
|
735
|
+
`;let i=this.shadowRoot.querySelector(".story-card--minimal");if(!i)return;i.addEventListener("click",()=>this.showDetail()),i.addEventListener("keydown",a=>{let o=a;(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this.showDetail())})}else this.shadowRoot.innerHTML=`
|
|
736
|
+
<style>${ot}</style>
|
|
674
737
|
|
|
675
|
-
<article class="story-card story-card--${s}" part="card" role="article" aria-label="${
|
|
738
|
+
<article class="story-card story-card--${s}" part="card" role="article" aria-label="${r}">
|
|
676
739
|
<header class="story-header" part="header">
|
|
677
740
|
<div class="story-meta">
|
|
678
|
-
${this.storyId?`<span class="story-id" part="id">${
|
|
679
|
-
${this.epic?`<span class="epic-badge" part="epic">${
|
|
741
|
+
${this.storyId?`<span class="story-id" part="id">${g(this.storyId)}</span>`:""}
|
|
742
|
+
${this.epic?`<span class="epic-badge" part="epic">${g(this.epic)}</span>`:""}
|
|
680
743
|
</div>
|
|
681
744
|
<div class="story-badges">
|
|
682
745
|
<span class="priority-badge" part="priority"
|
|
683
746
|
style="color: ${t.color}; background: ${t.bg};"
|
|
684
|
-
>${
|
|
747
|
+
>${g(t.label)}</span>
|
|
685
748
|
<span class="status-badge" part="status"
|
|
686
749
|
style="color: ${e.color}; background: ${e.bg};"
|
|
687
|
-
>${
|
|
688
|
-
${this.points?`<span class="points-badge" part="points">${
|
|
750
|
+
>${g(e.label)}</span>
|
|
751
|
+
${this.points?`<span class="points-badge" part="points">${g(this.points)}</span>`:""}
|
|
689
752
|
</div>
|
|
690
753
|
</header>
|
|
691
754
|
|
|
692
755
|
<div class="story-body" part="body">
|
|
693
756
|
<p class="story-statement" part="statement">
|
|
694
757
|
<span class="keyword">As a</span>
|
|
695
|
-
${this.personaId?`<a class="persona-text persona-text--link" href="#${
|
|
758
|
+
${this.personaId?`<a class="persona-text persona-text--link" href="#${g(this.personaId)}">${A(k.user)} <slot name="persona"><span>user</span></slot></a>`:'<span class="persona-text"><slot name="persona"><span>user</span></slot></span>'},
|
|
696
759
|
<span class="keyword">I want</span>
|
|
697
760
|
<span class="action-text"><slot name="action"><span>[describe the action]</span></slot></span>${this.benefit||this.querySelector('[slot="benefit"]')?`
|
|
698
761
|
<span class="keyword">so that</span>
|
|
@@ -744,7 +807,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
744
807
|
</div>
|
|
745
808
|
</div>
|
|
746
809
|
</article>
|
|
747
|
-
`,s==="compact"&&this.shadowRoot.querySelectorAll(".section").forEach(
|
|
810
|
+
`,s==="compact"&&this.shadowRoot.querySelectorAll(".section").forEach(a=>{let o=a.querySelector("slot");o&&o.assignedNodes().length===0&&a.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}))}}};x("user-story",nt);var V=`
|
|
748
811
|
:host {
|
|
749
812
|
display: block;
|
|
750
813
|
font-family: var(--_font-sans);
|
|
@@ -752,13 +815,17 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
752
815
|
color: var(--_text);
|
|
753
816
|
container-type: inline-size;
|
|
754
817
|
|
|
755
|
-
--_bg:
|
|
756
|
-
--_card:
|
|
757
|
-
--_border:
|
|
758
|
-
--_muted:
|
|
759
|
-
--_text:
|
|
760
|
-
--
|
|
761
|
-
--
|
|
818
|
+
--_bg: var(--user-journey-bg, var(--color-surface-raised, #f8f9fa));
|
|
819
|
+
--_card: var(--user-journey-card, var(--color-surface, #ffffff));
|
|
820
|
+
--_border: var(--user-journey-border, var(--color-border, #e0e0e0));
|
|
821
|
+
--_muted: var(--user-journey-muted, var(--color-text-muted, #666666));
|
|
822
|
+
--_text: var(--user-journey-text, var(--color-text, #1a1a1a));
|
|
823
|
+
--_inverted: var(--user-journey-text-inverted, var(--color-text-inverted, #ffffff));
|
|
824
|
+
--_primary: var(--user-journey-primary, var(--color-primary, var(--color-interactive, #6366f1)));
|
|
825
|
+
--_accent: var(--user-journey-accent, var(--color-accent, #8b5cf6));
|
|
826
|
+
--_link: var(--user-journey-link, var(--color-interactive, var(--color-primary, #6366f1)));
|
|
827
|
+
--_curve-stroke: var(--user-journey-curve-stroke, var(--_primary));
|
|
828
|
+
--_radius: var(--user-journey-radius, var(--radius-l, 0.75rem));
|
|
762
829
|
|
|
763
830
|
--_font-sans: var(--user-journey-font, var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif));
|
|
764
831
|
--_font-mono: var(--user-journey-font-mono, var(--font-mono, ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace));
|
|
@@ -771,6 +838,20 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
771
838
|
--_space-s: var(--user-journey-space-s, var(--size-s, 0.75rem));
|
|
772
839
|
--_space-m: var(--user-journey-space-m, var(--size-m, 1rem));
|
|
773
840
|
--_space-l: var(--user-journey-space-l, var(--size-l, 1.5rem));
|
|
841
|
+
|
|
842
|
+
/* Semantic tints derived from theme tokens via color-mix.
|
|
843
|
+
Subtle backgrounds (10\u201314%) for body cells, header at 22%. */
|
|
844
|
+
--_tint-pos: color-mix(in oklch, var(--color-success, #22c55e) 14%, var(--_card));
|
|
845
|
+
--_tint-neu: color-mix(in oklch, var(--color-warning, #f59e0b) 12%, var(--_card));
|
|
846
|
+
--_tint-neg: color-mix(in oklch, var(--color-error, #ef4444) 12%, var(--_card));
|
|
847
|
+
--_tint-row-pain: color-mix(in oklch, var(--color-error, #ef4444) 8%, var(--_card));
|
|
848
|
+
--_tint-row-opp: color-mix(in oklch, var(--color-success, #22c55e) 8%, var(--_card));
|
|
849
|
+
--_chip-type-bg: color-mix(in oklch, var(--_accent) 18%, var(--_card));
|
|
850
|
+
--_chip-type-fg: var(--color-accent-text, var(--_accent));
|
|
851
|
+
--_chip-story-bg: color-mix(in oklch, var(--_link) 18%, var(--_card));
|
|
852
|
+
--_chip-story-bg-hover: color-mix(in oklch, var(--_link) 28%, var(--_card));
|
|
853
|
+
--_chip-story-fg: var(--_link);
|
|
854
|
+
--_grid-head-bg: color-mix(in oklch, var(--_primary) 85%, var(--color-text, #000));
|
|
774
855
|
}
|
|
775
856
|
|
|
776
857
|
*, *::before, *::after { box-sizing: border-box; margin: 0; }
|
|
@@ -797,7 +878,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
797
878
|
inset-block: 0;
|
|
798
879
|
inset-inline-start: 0;
|
|
799
880
|
width: 4px;
|
|
800
|
-
background: linear-gradient(135deg,
|
|
881
|
+
background: linear-gradient(135deg, var(--_primary), var(--_accent));
|
|
801
882
|
}
|
|
802
883
|
|
|
803
884
|
.journey__header-top {
|
|
@@ -829,22 +910,16 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
829
910
|
}
|
|
830
911
|
|
|
831
912
|
.chip--type {
|
|
832
|
-
color:
|
|
833
|
-
background:
|
|
913
|
+
color: var(--_chip-type-fg);
|
|
914
|
+
background: var(--_chip-type-bg);
|
|
834
915
|
}
|
|
835
916
|
|
|
836
917
|
.chip--story {
|
|
837
|
-
color:
|
|
838
|
-
background:
|
|
918
|
+
color: var(--_chip-story-fg);
|
|
919
|
+
background: var(--_chip-story-bg);
|
|
839
920
|
}
|
|
840
921
|
|
|
841
|
-
.chip--story:hover { background:
|
|
842
|
-
|
|
843
|
-
@media (prefers-color-scheme: dark) {
|
|
844
|
-
.chip--type { color: #a78bfa; background: #2e1065; }
|
|
845
|
-
.chip--story { color: #38bdf8; background: #082f49; }
|
|
846
|
-
.chip--story:hover { background: #0c4a6e; }
|
|
847
|
-
}
|
|
922
|
+
.chip--story:hover { background: var(--_chip-story-bg-hover); }
|
|
848
923
|
|
|
849
924
|
/* Persona ref */
|
|
850
925
|
.persona-ref {
|
|
@@ -858,7 +933,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
858
933
|
white-space: nowrap;
|
|
859
934
|
}
|
|
860
935
|
.persona-ref svg { width: 14px; height: 14px; flex-shrink: 0; }
|
|
861
|
-
a.persona-ref:hover { color:
|
|
936
|
+
a.persona-ref:hover { color: var(--_link); text-decoration: underline; }
|
|
862
937
|
|
|
863
938
|
/* Title & summary (slotted content) */
|
|
864
939
|
.journey__title-wrap {
|
|
@@ -907,16 +982,10 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
907
982
|
|
|
908
983
|
.journey--compact .curve-svg { height: 54px; }
|
|
909
984
|
|
|
910
|
-
.zone { opacity: 0.
|
|
911
|
-
.zone--pos { fill:
|
|
912
|
-
.zone--neu { fill:
|
|
913
|
-
.zone--neg { fill:
|
|
914
|
-
|
|
915
|
-
@media (prefers-color-scheme: dark) {
|
|
916
|
-
.zone--pos { fill: #14532d; }
|
|
917
|
-
.zone--neu { fill: #713f12; }
|
|
918
|
-
.zone--neg { fill: #7f1d1d; }
|
|
919
|
-
}
|
|
985
|
+
.zone { opacity: 0.55; }
|
|
986
|
+
.zone--pos { fill: var(--_tint-pos); }
|
|
987
|
+
.zone--neu { fill: var(--_tint-neu); }
|
|
988
|
+
.zone--neg { fill: var(--_tint-neg); }
|
|
920
989
|
|
|
921
990
|
.vline { stroke: var(--_border); stroke-width: 1; stroke-dasharray: 3 4; }
|
|
922
991
|
.curve-line { stroke: var(--_curve-stroke); stroke-width: 2.5; stroke-linecap: round; }
|
|
@@ -933,12 +1002,8 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
933
1002
|
|
|
934
1003
|
/* Head row */
|
|
935
1004
|
.journey__grid thead tr {
|
|
936
|
-
background:
|
|
937
|
-
color:
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
@media (prefers-color-scheme: dark) {
|
|
941
|
-
.journey__grid thead tr { background: #0f0d30; }
|
|
1005
|
+
background: var(--_grid-head-bg);
|
|
1006
|
+
color: var(--_inverted);
|
|
942
1007
|
}
|
|
943
1008
|
|
|
944
1009
|
.corner {
|
|
@@ -953,19 +1018,15 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
953
1018
|
min-width: 100px;
|
|
954
1019
|
position: sticky;
|
|
955
1020
|
left: 0;
|
|
956
|
-
background:
|
|
1021
|
+
background: var(--_grid-head-bg);
|
|
957
1022
|
z-index: 2;
|
|
958
1023
|
}
|
|
959
1024
|
|
|
960
|
-
@media (prefers-color-scheme: dark) {
|
|
961
|
-
.corner { background: #0f0d30; }
|
|
962
|
-
}
|
|
963
|
-
|
|
964
1025
|
.phase-head {
|
|
965
1026
|
padding: 10px 14px;
|
|
966
1027
|
text-align: left;
|
|
967
1028
|
vertical-align: top;
|
|
968
|
-
border-inline-start: 1px solid
|
|
1029
|
+
border-inline-start: 1px solid color-mix(in oklch, var(--_inverted) 12%, transparent);
|
|
969
1030
|
min-width: 160px;
|
|
970
1031
|
position: relative;
|
|
971
1032
|
}
|
|
@@ -977,7 +1038,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
977
1038
|
inset-block-start: 0;
|
|
978
1039
|
inset-inline: 0;
|
|
979
1040
|
height: 3px;
|
|
980
|
-
background: var(--ec,
|
|
1041
|
+
background: var(--ec, var(--_primary));
|
|
981
1042
|
}
|
|
982
1043
|
|
|
983
1044
|
.ph-num { display: block; font-size: 10px; opacity: 0.5; margin-block-end: 2px; }
|
|
@@ -1017,13 +1078,8 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1017
1078
|
.data-cell--empty { color: var(--_muted); opacity: 0.35; }
|
|
1018
1079
|
|
|
1019
1080
|
/* Semantic row tints */
|
|
1020
|
-
.grid-row--painpoints .data-cell { background:
|
|
1021
|
-
.grid-row--opportunities .data-cell { background:
|
|
1022
|
-
|
|
1023
|
-
@media (prefers-color-scheme: dark) {
|
|
1024
|
-
.grid-row--painpoints .data-cell { background: #2d0a0a; }
|
|
1025
|
-
.grid-row--opportunities .data-cell { background: #052e16; }
|
|
1026
|
-
}
|
|
1081
|
+
.grid-row--painpoints .data-cell { background: var(--_tint-row-pain); }
|
|
1082
|
+
.grid-row--opportunities .data-cell { background: var(--_tint-row-opp); }
|
|
1027
1083
|
|
|
1028
1084
|
/* Compact */
|
|
1029
1085
|
.journey--compact .phase-head { min-width: 120px; padding: 8px 10px; }
|
|
@@ -1032,7 +1088,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1032
1088
|
|
|
1033
1089
|
/* Utility */
|
|
1034
1090
|
.state-msg { padding: var(--_space-l); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
1035
|
-
.state-msg--error { color: #dc2626; }
|
|
1091
|
+
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
1036
1092
|
.journey__placeholder { padding: 20px 24px; font-size: var(--_font-sm); color: var(--_muted); }
|
|
1037
1093
|
code { font-family: var(--_font-mono); font-size: 0.88em; }
|
|
1038
1094
|
|
|
@@ -1049,35 +1105,35 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1049
1105
|
.journey__grid-wrap { overflow: visible; }
|
|
1050
1106
|
.row-label, .corner { position: relative; }
|
|
1051
1107
|
}
|
|
1052
|
-
`;var
|
|
1053
|
-
<article class="journey${
|
|
1108
|
+
`;var le=0;function q(c,t,e="vb-vt"){if(!c?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return t(),null;let s=`${e}-${++le}`;c.style.viewTransitionName=s;let r=document.startViewTransition(t);return r.finished.finally(()=>{c.style.viewTransitionName===s&&(c.style.viewTransitionName="")}),r}var ce=[{key:"actions",label:"Actions"},{key:"thoughts",label:"Thoughts"},{key:"touchpoints",label:"Touchpoints"},{key:"painPoints",label:"Pain Points"},{key:"opportunities",label:"Opportunities"}],lt=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}))}}#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)||""}connectedCallback(){this.#s(),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>${V}</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 i=document.createElement("h2");i.slot="title",i.textContent=r.title,this.appendChild(i)}if(r.summary&&!this.querySelector('[slot="summary"]')){let i=document.createElement("p");i.slot="summary",i.textContent=r.summary,this.appendChild(i)}this.__phases=r.phases||[],this._render()}catch(s){e.innerHTML=`<style>${V}</style><div class="state-msg state-msg--error">Could not load journey: ${g(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"),i=this.__phases,a=!!this.querySelector('[slot="summary"]')||this.#e.has("summary"),o=this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||"",n=`<style>${V}</style>
|
|
1109
|
+
<article class="journey${r?" journey--compact":""}">
|
|
1054
1110
|
|
|
1055
1111
|
<header class="journey__header">
|
|
1056
1112
|
<div class="journey__header-top">
|
|
1057
1113
|
<div class="journey__chips">
|
|
1058
1114
|
<span class="chip chip--type">Journey Map</span>
|
|
1059
|
-
${s.map(
|
|
1115
|
+
${s.map(u=>`<a class="chip chip--story" href="#${u}">${this._label(u)}</a>`).join("")}
|
|
1060
1116
|
</div>
|
|
1061
1117
|
${t?`
|
|
1062
1118
|
<div class="journey__persona">
|
|
1063
|
-
${e?`<a class="persona-ref" href="#${e}">${
|
|
1119
|
+
${e?`<a class="persona-ref" href="#${e}">${A(k.user)} ${g(t)}</a>`:`<span class="persona-ref">${A(k.user)} ${g(t)}</span>`}
|
|
1064
1120
|
</div>`:""}
|
|
1065
1121
|
</div>
|
|
1066
1122
|
<div class="journey__title-wrap">
|
|
1067
1123
|
<slot name="title"><h2 class="journey__title">User Journey</h2></slot>
|
|
1068
1124
|
</div>
|
|
1069
|
-
${
|
|
1125
|
+
${a?'<div class="journey__summary-wrap"><slot name="summary"></slot></div>':""}
|
|
1070
1126
|
</header>
|
|
1071
1127
|
|
|
1072
|
-
${
|
|
1128
|
+
${i&&i.length?this._curve(i)+this._grid(i):`<div class="journey__placeholder">
|
|
1073
1129
|
<p>Add phase data via <code>src</code> (JSON) or set <code>.phases</code> programmatically.</p>
|
|
1074
1130
|
</div>`}
|
|
1075
1131
|
|
|
1076
|
-
</article>`,this.dispatchEvent(new CustomEvent("journey-ready",{bubbles:!0,composed:!0,detail:{title,persona:t,phaseCount:
|
|
1132
|
+
</article>`,d=this.shadowRoot,l=()=>{d.innerHTML=n};d.querySelector("article")?q(this,l,"uj-vt"):l(),this.dispatchEvent(new CustomEvent("journey-ready",{bubbles:!0,composed:!0,detail:{title:o,persona:t,phaseCount:i?i.length:0}}))}_curve(t){let n=t.length,d=p=>28+(n<2?944/2:p/(n-1)*944),l=p=>14+(1-(N[p.emotion]||N.neutral).score)*72,u=t.map((p,b)=>({x:d(b),y:l(p),ph:p})),h=`M ${u[0].x},${u[0].y}`;for(let p=1;p<u.length;p++){let b=u[p-1],y=u[p],_=(b.x+y.x)/2;h+=` C ${_},${b.y} ${_},${y.y} ${y.x},${y.y}`}let m=`uj-${Math.random().toString(36).slice(2,8)}`,f=u.at(-1);return`
|
|
1077
1133
|
<div class="journey__curve" aria-hidden="true">
|
|
1078
1134
|
<svg viewBox="0 0 1000 100" preserveAspectRatio="none" class="curve-svg">
|
|
1079
1135
|
<defs>
|
|
1080
|
-
<linearGradient id="${
|
|
1136
|
+
<linearGradient id="${m}" x1="0" y1="0" x2="0" y2="1">
|
|
1081
1137
|
<stop offset="0%" stop-color="#6366f1" stop-opacity="0.22"/>
|
|
1082
1138
|
<stop offset="100%" stop-color="#6366f1" stop-opacity="0"/>
|
|
1083
1139
|
</linearGradient>
|
|
@@ -1085,28 +1141,28 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1085
1141
|
<rect x="0" y="0" width="1000" height="${100*.4}" class="zone zone--pos"/>
|
|
1086
1142
|
<rect x="0" y="${100*.4}" width="1000" height="${100*.2}" class="zone zone--neu"/>
|
|
1087
1143
|
<rect x="0" y="${100*.6}" width="1000" height="${100*.4}" class="zone zone--neg"/>
|
|
1088
|
-
${
|
|
1089
|
-
<path d="${
|
|
1090
|
-
<path d="${
|
|
1091
|
-
${
|
|
1144
|
+
${u.map(({x:p})=>`<line x1="${p}" y1="0" x2="${p}" y2="100" class="vline"/>`).join("")}
|
|
1145
|
+
<path d="${h} L ${f.x},100 L ${u[0].x},100 Z" fill="url(#${m})"/>
|
|
1146
|
+
<path d="${h}" fill="none" class="curve-line"/>
|
|
1147
|
+
${u.map(({x:p,y:b,ph:y})=>{let _=N[y.emotion]||N.neutral;return`<circle cx="${p}" cy="${b}" r="5" class="dot" style="fill:${_.color}"/>`}).join("")}
|
|
1092
1148
|
</svg>
|
|
1093
|
-
</div>`}_grid(t){let e=t.map((
|
|
1094
|
-
<th class="phase-head" data-emotion="${
|
|
1095
|
-
style="--ec:${
|
|
1096
|
-
<span class="ph-num">${
|
|
1097
|
-
<span class="ph-name">${
|
|
1098
|
-
<span class="ph-emoji" title="${
|
|
1149
|
+
</div>`}_grid(t){let e=t.map((r,i)=>{let a=N[r.emotion]||N.neutral,o=r.storyIds||[];return`
|
|
1150
|
+
<th class="phase-head" data-emotion="${r.emotion||"neutral"}"
|
|
1151
|
+
style="--ec:${a.color}">
|
|
1152
|
+
<span class="ph-num">${i+1}</span>
|
|
1153
|
+
<span class="ph-name">${g(r.name||"")}</span>
|
|
1154
|
+
<span class="ph-emoji" title="${r.emotion||"neutral"}"><span role="img" aria-label="${g(r.emotion||"neutral")}">${a.emoji}</span></span>
|
|
1099
1155
|
${o.length?`<div class="ph-stories">${o.map(n=>`<a class="chip chip--story" href="#${n}">${this._label(n)}</a>`).join("")}</div>`:""}
|
|
1100
|
-
</th>`}).join(""),s=
|
|
1101
|
-
${n.map(
|
|
1156
|
+
</th>`}).join(""),s=ce.map(({key:r,label:i})=>{let a=t.map(o=>{let n=o[r]||[];return n.length?`<td class="data-cell data-cell--${r.toLowerCase()}">
|
|
1157
|
+
${n.map(d=>`<p>${g(d)}</p>`).join("")}
|
|
1102
1158
|
</td>`:'<td class="data-cell data-cell--empty">\u2014</td>'}).join("");return`
|
|
1103
|
-
<tr class="grid-row grid-row--${
|
|
1104
|
-
<th class="row-label">${
|
|
1105
|
-
${
|
|
1159
|
+
<tr class="grid-row grid-row--${r.toLowerCase()}">
|
|
1160
|
+
<th class="row-label">${i}</th>
|
|
1161
|
+
${a}
|
|
1106
1162
|
</tr>`}).join("");return`
|
|
1107
1163
|
<div class="journey__grid-wrap">
|
|
1108
1164
|
<table class="journey__grid"
|
|
1109
|
-
aria-label="${
|
|
1165
|
+
aria-label="${g(this.getAttribute("title")||"User Journey")} \u2014 phase breakdown">
|
|
1110
1166
|
<thead>
|
|
1111
1167
|
<tr>
|
|
1112
1168
|
<th class="corner">Stage</th>
|
|
@@ -1115,7 +1171,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1115
1171
|
</thead>
|
|
1116
1172
|
<tbody>${s}</tbody>
|
|
1117
1173
|
</table>
|
|
1118
|
-
</div>`}_label(t){return t.replace(/^(activity|persona|journey|story|user)-/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};x("user-journey",
|
|
1174
|
+
</div>`}_label(t){return t.replace(/^(activity|persona|journey|story|user)-/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};x("user-journey",lt);var W=`
|
|
1119
1175
|
:host {
|
|
1120
1176
|
display: block;
|
|
1121
1177
|
font-family: var(--_font-sans);
|
|
@@ -1129,11 +1185,20 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1129
1185
|
--_muted: var(--empathy-map-muted, var(--color-text-muted, #666666));
|
|
1130
1186
|
--_text: var(--empathy-map-text, var(--color-text, #1a1a1a));
|
|
1131
1187
|
--_radius: var(--empathy-map-radius, var(--radius-xl, 1rem));
|
|
1132
|
-
--_accent: var(--empathy-map-accent, var(--color-interactive, #0066cc));
|
|
1133
|
-
--
|
|
1134
|
-
--
|
|
1135
|
-
--
|
|
1136
|
-
--
|
|
1188
|
+
--_accent: var(--empathy-map-accent, var(--color-interactive, var(--color-primary, #0066cc)));
|
|
1189
|
+
--_link: var(--empathy-map-link, var(--color-interactive, var(--color-primary, #6366f1)));
|
|
1190
|
+
--_primary: var(--empathy-map-primary, var(--color-primary, #6366f1));
|
|
1191
|
+
--_accent-bar: var(--empathy-map-accent-bar, var(--color-accent, #8b5cf6));
|
|
1192
|
+
--_says: var(--empathy-map-says, var(--color-info, #3b82f6));
|
|
1193
|
+
--_thinks: var(--empathy-map-thinks, var(--color-accent, #8b5cf6));
|
|
1194
|
+
--_does: var(--empathy-map-does, var(--color-warning, #f59e0b));
|
|
1195
|
+
--_feels: var(--empathy-map-feels, var(--color-error, #ef4444));
|
|
1196
|
+
--_says-bg: color-mix(in oklch, var(--_says) 16%, var(--_card));
|
|
1197
|
+
--_thinks-bg: color-mix(in oklch, var(--_thinks) 16%, var(--_card));
|
|
1198
|
+
--_does-bg: color-mix(in oklch, var(--_does) 16%, var(--_card));
|
|
1199
|
+
--_feels-bg: color-mix(in oklch, var(--_feels) 16%, var(--_card));
|
|
1200
|
+
--_chip-type-bg: color-mix(in oklch, var(--_accent-bar) 18%, var(--_card));
|
|
1201
|
+
--_chip-type-fg: var(--_accent-bar);
|
|
1137
1202
|
--_font-sans: var(--empathy-map-font, var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif));
|
|
1138
1203
|
--_font-xs: var(--empathy-map-font-xs, var(--font-size-xs, 0.75rem));
|
|
1139
1204
|
--_font-sm: var(--empathy-map-font-sm, var(--font-size-sm, 0.875rem));
|
|
@@ -1175,7 +1240,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1175
1240
|
inset-block: 0;
|
|
1176
1241
|
inset-inline-start: 0;
|
|
1177
1242
|
width: 4px;
|
|
1178
|
-
background: linear-gradient(135deg,
|
|
1243
|
+
background: linear-gradient(135deg, var(--_primary), var(--_accent-bar));
|
|
1179
1244
|
}
|
|
1180
1245
|
|
|
1181
1246
|
.empathy-map__header-top {
|
|
@@ -1207,12 +1272,8 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1207
1272
|
}
|
|
1208
1273
|
|
|
1209
1274
|
.chip--type {
|
|
1210
|
-
color:
|
|
1211
|
-
background:
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
@media (prefers-color-scheme: dark) {
|
|
1215
|
-
.chip--type { color: #a78bfa; background: #2e1065; }
|
|
1275
|
+
color: var(--_chip-type-fg);
|
|
1276
|
+
background: var(--_chip-type-bg);
|
|
1216
1277
|
}
|
|
1217
1278
|
|
|
1218
1279
|
/* \u2500\u2500 Persona ref \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 */
|
|
@@ -1233,7 +1294,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1233
1294
|
flex-shrink: 0;
|
|
1234
1295
|
}
|
|
1235
1296
|
|
|
1236
|
-
a.persona-ref:hover { color:
|
|
1297
|
+
a.persona-ref:hover { color: var(--_link); text-decoration: underline; }
|
|
1237
1298
|
|
|
1238
1299
|
/* \u2500\u2500 Title & summary (slotted content) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1239
1300
|
.empathy-map__title-wrap {
|
|
@@ -1322,17 +1383,10 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1322
1383
|
height: 16px;
|
|
1323
1384
|
}
|
|
1324
1385
|
|
|
1325
|
-
.quadrant--says .quadrant__icon { background:
|
|
1326
|
-
.quadrant--thinks .quadrant__icon { background:
|
|
1327
|
-
.quadrant--does .quadrant__icon { background:
|
|
1328
|
-
.quadrant--feels .quadrant__icon { background:
|
|
1329
|
-
|
|
1330
|
-
@media (prefers-color-scheme: dark) {
|
|
1331
|
-
.quadrant--says .quadrant__icon { background: #1e3a5f; }
|
|
1332
|
-
.quadrant--thinks .quadrant__icon { background: #2e1065; }
|
|
1333
|
-
.quadrant--does .quadrant__icon { background: #451a03; }
|
|
1334
|
-
.quadrant--feels .quadrant__icon { background: #450a0a; }
|
|
1335
|
-
}
|
|
1386
|
+
.quadrant--says .quadrant__icon { background: var(--_says-bg); color: var(--_says); }
|
|
1387
|
+
.quadrant--thinks .quadrant__icon { background: var(--_thinks-bg); color: var(--_thinks); }
|
|
1388
|
+
.quadrant--does .quadrant__icon { background: var(--_does-bg); color: var(--_does); }
|
|
1389
|
+
.quadrant--feels .quadrant__icon { background: var(--_feels-bg); color: var(--_feels); }
|
|
1336
1390
|
|
|
1337
1391
|
.quadrant__label {
|
|
1338
1392
|
font-size: 13px;
|
|
@@ -1609,7 +1663,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1609
1663
|
@media print {
|
|
1610
1664
|
.empathy-map {
|
|
1611
1665
|
break-inside: avoid;
|
|
1612
|
-
border-color:
|
|
1666
|
+
border-color: var(--_border);
|
|
1613
1667
|
}
|
|
1614
1668
|
|
|
1615
1669
|
.quadrant__edit-btn,
|
|
@@ -1628,9 +1682,9 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1628
1682
|
|
|
1629
1683
|
/* \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\u2500 */
|
|
1630
1684
|
.state-msg { padding: var(--_space-l); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
1631
|
-
.state-msg--error { color: #dc2626; }
|
|
1632
|
-
code { font-family: Monaco, Menlo, monospace; font-size: 0.88em; }
|
|
1633
|
-
`;var
|
|
1685
|
+
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
1686
|
+
code { font-family: var(--font-mono, Monaco, Menlo, monospace); font-size: 0.88em; }
|
|
1687
|
+
`;var ct=["says","thinks","does","feels"],dt=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()}#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)||""}connectedCallback(){this.#s(),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){ct.includes(t)&&this.hasAttribute("editable")&&this._openEdit(t)}closeQuadrant(t){ct.includes(t)&&this._closeEdit(t)}async _loadSrc(t){if(!(!t||!this.shadowRoot)){this.shadowRoot.innerHTML=`<style>${W}</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>${W}</style><div class="state-msg state-msg--error">Could not load empathy map: ${g(s)}</div>`}}}_render(){let t=this._resolve("persona")||"",e=this._resolve("persona-id")||"",s=this.hasAttribute("compact"),r=this.hasAttribute("editable"),i=!!this.querySelector('[slot="title"]')||this.#e.has("title"),a=!!this.querySelector('[slot="summary"]')||this.#e.has("summary"),o=this.__goals?.length||this.querySelector('[slot="goals"]'),n=this.__painPoints?.length||this.querySelector('[slot="pain-points"]'),d=`<style>${W}</style>
|
|
1634
1688
|
<article class="empathy-map${s?" empathy-map--compact":""}">
|
|
1635
1689
|
|
|
1636
1690
|
<header class="empathy-map__header">
|
|
@@ -1640,64 +1694,90 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1640
1694
|
</div>
|
|
1641
1695
|
${t?`
|
|
1642
1696
|
<div class="empathy-map__persona">
|
|
1643
|
-
${e?`<a class="persona-ref" href="#${
|
|
1697
|
+
${e?`<a class="persona-ref" href="#${g(e)}">${A(k.user)} ${g(t)}</a>`:`<span class="persona-ref">${A(k.user)} ${g(t)}</span>`}
|
|
1644
1698
|
</div>`:""}
|
|
1645
1699
|
</div>
|
|
1646
1700
|
<div class="empathy-map__title-wrap">
|
|
1647
1701
|
<slot name="title"><h2 class="empathy-map__title">Empathy Map</h2></slot>
|
|
1648
1702
|
</div>
|
|
1649
|
-
${
|
|
1703
|
+
${a?'<div class="empathy-map__summary-wrap"><slot name="summary"></slot></div>':""}
|
|
1650
1704
|
</header>
|
|
1651
1705
|
|
|
1652
1706
|
<div class="empathy-map__grid">
|
|
1653
|
-
${
|
|
1707
|
+
${ct.map(u=>this._renderQuadrant(u,r)).join("")}
|
|
1654
1708
|
</div>
|
|
1655
1709
|
|
|
1656
1710
|
${o||n?`
|
|
1657
1711
|
<footer class="empathy-map__footer">
|
|
1658
|
-
${this._renderSummaryRow("goals",
|
|
1659
|
-
${this._renderSummaryRow("pain-points",
|
|
1712
|
+
${this._renderSummaryRow("goals",A(k.target),"Goals")}
|
|
1713
|
+
${this._renderSummaryRow("pain-points",A(k.alertTriangle),"Pain Points")}
|
|
1660
1714
|
</footer>
|
|
1661
1715
|
`:""}
|
|
1662
1716
|
|
|
1663
|
-
</article>`,
|
|
1717
|
+
</article>`,l=()=>{this.shadowRoot&&(this.shadowRoot.innerHTML=d,r&&this._bindEditListeners())};this.shadowRoot?.querySelector("article")?q(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=rt[t],r=this.__quadrants?.[t],i=this._editingQuadrants.has(t),a=r&&r.length?t==="feels"?r.map(n=>this._renderEmotion(n)).join(""):r.map(n=>`<p>${g(n)}</p>`).join(""):`<slot name="${t}"><p class="placeholder">Add ${s.label.toLowerCase()} items\u2026</p></slot>`,o=r?.length?r.join(`
|
|
1664
1718
|
`):"";return`
|
|
1665
|
-
<section class="quadrant quadrant--${t}"${
|
|
1719
|
+
<section class="quadrant quadrant--${t}"${i?" data-editing":""}>
|
|
1666
1720
|
<div class="quadrant__inner">
|
|
1667
1721
|
<div class="quadrant__header">
|
|
1668
|
-
<div class="quadrant__icon" aria-hidden="true">${
|
|
1722
|
+
<div class="quadrant__icon" aria-hidden="true">${A(s.icon)}</div>
|
|
1669
1723
|
<span class="quadrant__label">${s.label}</span>
|
|
1670
1724
|
${e?`<button class="quadrant__edit-btn" data-quadrant="${t}"
|
|
1671
|
-
aria-label="Edit ${s.label}" title="Edit ${s.label}">${
|
|
1725
|
+
aria-label="Edit ${s.label}" title="Edit ${s.label}">${A(k.pencil)}</button>`:""}
|
|
1672
1726
|
</div>
|
|
1673
1727
|
<div class="quadrant__faces">
|
|
1674
|
-
<div class="quadrant__face quadrant__face--front"${
|
|
1728
|
+
<div class="quadrant__face quadrant__face--front"${i?" inert":""}>
|
|
1675
1729
|
<div class="quadrant__content">
|
|
1676
|
-
${
|
|
1730
|
+
${a}
|
|
1677
1731
|
</div>
|
|
1678
1732
|
</div>
|
|
1679
1733
|
${e?`
|
|
1680
|
-
<div class="quadrant__face quadrant__face--back"${
|
|
1734
|
+
<div class="quadrant__face quadrant__face--back"${i?"":" inert"}>
|
|
1681
1735
|
<textarea class="quadrant__editor" data-quadrant="${t}"
|
|
1682
1736
|
placeholder="One item per line\u2026"
|
|
1683
|
-
aria-label="Edit ${s.label} items">${
|
|
1737
|
+
aria-label="Edit ${s.label} items">${g(o)}</textarea>
|
|
1684
1738
|
<button class="quadrant__done-btn" data-quadrant="${t}"
|
|
1685
|
-
aria-label="Done editing ${s.label}">${
|
|
1739
|
+
aria-label="Done editing ${s.label}">${A(k.check)} Done</button>
|
|
1686
1740
|
</div>
|
|
1687
1741
|
`:""}
|
|
1688
1742
|
</div>
|
|
1689
1743
|
</div>
|
|
1690
|
-
</section>`}_renderEmotion(t){let e=t.toLowerCase().trim(),s=
|
|
1744
|
+
</section>`}_renderEmotion(t){let e=t.toLowerCase().trim(),s=N[e];return s?`<span class="emotion-tag" style="--ec:${s.color}"><span role="img" aria-label="${g(t)}">${s.emoji}</span> ${g(t)}</span>`:`<p>${g(t)}</p>`}_renderSummaryRow(t,e,s){let i=(t==="pain-points"?"painPoints":t)==="painPoints"?this.__painPoints:this.__goals,a=i?.length?i.map(o=>`<p>${g(o)}</p>`).join(""):`<slot name="${t}"><p class="placeholder">No ${s.toLowerCase()} specified.</p></slot>`;return`
|
|
1691
1745
|
<div class="summary-row">
|
|
1692
1746
|
<span class="summary-row__icon" aria-hidden="true">${e}</span>
|
|
1693
1747
|
<div class="summary-row__body">
|
|
1694
1748
|
<div class="summary-row__label">${s}</div>
|
|
1695
|
-
<div class="summary-row__content">${
|
|
1749
|
+
<div class="summary-row__content">${a}</div>
|
|
1696
1750
|
</div>
|
|
1697
|
-
</div>`}_bindEditListeners(){let t=this.shadowRoot;t.querySelectorAll(".quadrant__edit-btn").forEach(e=>{e.addEventListener("click",()=>{
|
|
1698
|
-
`);else{let o=e.querySelector(`slot[name="${t}"]`);if(o){let n=o.assignedElements();if(n.length){let
|
|
1699
|
-
`)}}}
|
|
1700
|
-
`).map(n=>n.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(n=>this._renderEmotion(n)).join(""):i.map(n=>`<p>${u(n)}</p>`).join("");else{let n=V[t];o.innerHTML=`<p class="placeholder">Add ${n.label.toLowerCase()} items\u2026</p>`}}this._editingQuadrants.delete(t),e.removeAttribute("data-editing");let a=e.querySelector(".quadrant__face--front"),r=e.querySelector(".quadrant__face--back");a&&a.removeAttribute("inert"),r&&r.setAttribute("inert",""),this.dispatchEvent(new CustomEvent("empathy-map:update",{bubbles:!0,composed:!0,detail:{quadrant:t,items:this.__quadrants?.[t]||[]}}))}};x("empathy-map",J);var Z=class d extends A{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#t=0;static get observedAttributes(){return["src","compact","title"]}#e=null;#s={};#a=null;#r="";#o=null;setup(){this.#r=`ie-${++d.#t}`;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 a=document.createElement("div");a.style.cssText="display:flex;flex-direction:column;flex:1;min-width:0;";let r=document.createElement("div");r.className="ie-grid",r.setAttribute("role","region"),r.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 d.QUADRANTS){let h=document.createElement("section");h.className="ie-quadrant",h.dataset.quadrantZone=l,h.setAttribute("aria-label",`${d.LABELS[l]}: ${d.DESCRIPTIONS[l]}`);let p=document.createElement("header");p.className="ie-quadrant-label",p.innerHTML=`${d.LABELS[l]}<br><span class="ie-quadrant-desc">${d.DESCRIPTIONS[l]}</span>`;let f=document.createElement("drag-surface");f.setAttribute("group",this.#r),f.setAttribute("aria-label",d.LABELS[l]),f.setAttribute("data-layout","stack"),f.setAttribute("data-layout-gap","xs"),h.appendChild(p),h.appendChild(f),r.appendChild(h),this.#s[l]=f}t.forEach((l,h)=>{let p=l.getAttribute("data-quadrant")||"quick-wins",f=this.#s[p]||this.#s["quick-wins"];l.hasAttribute("draggable")||l.setAttribute("draggable","true"),l.hasAttribute("data-id")||(l.dataset.id=`ie-item-${h}`),f.appendChild(l)});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 n=this.getAttribute("title");if(n){let l=document.createElement("h3");l.className="ie-title",l.textContent=n,this.prepend(l)}a.appendChild(r),a.appendChild(i),e.appendChild(s),e.appendChild(a),this.appendChild(e),this.appendChild(o),this.#e=r,this.#a=o,this.#o=e,this.listen(this,"drag-surface:transfer",l=>{let{item:h,fromSurface:p,toSurface:f}=l.detail,g=this.#l(p),m=this.#l(f);!g||!m||(h.setAttribute("data-quadrant",m),this.#n(`Moved ${this.#c(h)} to ${d.LABELS[m]}`),this.dispatchEvent(new CustomEvent("impact-effort:move",{bubbles:!0,detail:{itemId:h.dataset.id,from:g,to:m,item:h}})))});let c=this.getAttribute("src");c&&this.#i(c),this.#d()}teardown(){this.#o&&(this.#o.remove(),this.#o=null),this.#a&&(this.#a.remove(),this.#a=null),this.#e=null,this.#s={}}attributeChangedCallback(t,e,s){this.hasAttribute("data-upgraded")&&t==="src"&&s&&s!==e&&this.#i(s)}async#i(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;for(let a of d.QUADRANTS){let r=this.#s[a];if(r)for(let i of[...r.querySelectorAll("[draggable]")])i.remove()}s.forEach((a,r)=>{let i=a.quadrant||"quick-wins",o=a.id||`ie-item-${r}`,n;a.persona||a.action||a.storyId?(n=document.createElement("user-story"),n.setAttribute("detail","minimal"),a.storyId&&n.setAttribute("story-id",a.storyId),a.persona&&n.setAttribute("persona",a.persona),a.action&&n.setAttribute("action",a.action),a.benefit&&n.setAttribute("benefit",a.benefit),a.priority&&n.setAttribute("priority",a.priority),a.status&&n.setAttribute("status",a.status),a.points&&n.setAttribute("points",String(a.points))):(n=document.createElement("article"),n.textContent=a.label||a.text||""),n.setAttribute("draggable","true"),n.dataset.id=o,n.dataset.quadrant=i,(this.#s[i]||this.#s["quick-wins"]).appendChild(n)}),this.#d()}catch(e){console.warn(`[impact-effort] Failed to load src="${t}":`,e)}}#l(t){for(let[e,s]of Object.entries(this.#s))if(s===t)return e;return null}#n(t){let e=this.#a;e&&(e.textContent="",requestAnimationFrame(()=>{e.textContent=t}))}#c(t){return t.dataset.id||t.textContent.trim().slice(0,40)}#d(){let t={};for(let e of d.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}}))}};x("impact-effort",Z);var tt=class d extends A{static get observedAttributes(){return["src","compact","title"]}static#t=0;#e=null;#s={};#a={};#r=null;#o="";#i=[];setup(){this.#o=`kb-${++d.#t}`;let t=[...this.querySelectorAll(":scope > section[data-column]")];this.#i=t.map(r=>{let i=r.getAttribute("data-column")||"",n=r.getAttribute("data-column-label")||""||this.#f(i),c=r.getAttribute("data-wip"),l=c?parseInt(c,10):null,h=r.getAttribute("data-column-color")||null,p=[...r.children];return{id:i,label:n,wip:l,color:h,children:p}});for(let r of t)r.remove();this.#e=document.createElement("div"),this.#e.className="kb-columns",this.#e.setAttribute("role","region"),this.#e.setAttribute("aria-label","Kanban board");let e=0;for(let r of this.#i){let i=document.createElement("section");i.className="kb-column",i.setAttribute("data-column-id",r.id),r.color&&i.setAttribute("data-column-tint",r.color);let o=document.createElement("header");o.className="kb-column-header";let n=document.createElement("h3");n.textContent=r.label;let c=document.createElement("output");if(c.className="kb-count",c.textContent=String(r.children.length),n.appendChild(c),r.wip!==null&&!isNaN(r.wip)){let h=document.createElement("span");h.className="kb-wip",h.textContent=`/ ${r.wip}`,h.setAttribute("aria-label",`WIP limit ${r.wip}`),n.appendChild(h)}o.appendChild(n),i.appendChild(o);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#o),l.setAttribute("aria-label",`${r.label} items`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),r.children.length>0){for(let h of r.children)h.hasAttribute("draggable")||h.setAttribute("draggable","true"),h.hasAttribute("data-id")||(h.dataset.id=`kb-item-${e}`),l.appendChild(h);e+=r.children.length}else{let h=document.createElement("p");h.className="kb-empty",h.textContent="No items",l.appendChild(h)}i.appendChild(l),this.#e.appendChild(i),this.#s[r.id]=l,this.#a[r.id]=i,r.wip!==null&&r.children.length>r.wip&&i.setAttribute("data-wip-exceeded","")}let s=this.getAttribute("title");if(s){let r=document.createElement("h2");r.className="kb-title",r.textContent=s,this.appendChild(r)}this.appendChild(this.#e),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",r=>{let i=r.detail,o=r.target.closest("drag-surface"),n=this.#l(o);n&&(this.#n(n),this.dispatchEvent(new CustomEvent("kanban-board:reorder",{bubbles:!0,detail:{itemId:i.itemId,column:n,oldIndex:i.oldIndex,newIndex:i.newIndex}})))}),this.listen(this,"drag-surface:transfer",r=>{let i=r.detail,o=i.fromSurface,n=i.toSurface,c=this.#l(o),l=this.#l(n);if(!c||!l)return;i.item&&i.item.setAttribute("data-column",l),this.#n(c),this.#n(l);let h=n.querySelector(".kb-empty");if(h&&h.remove(),o.querySelectorAll(':scope > [draggable="true"]').length===0&&!o.querySelector(".kb-empty")){let w=document.createElement("p");w.className="kb-empty",w.textContent="No items",o.appendChild(w)}let f=this.#m(i.item),g=this.#c(c),m=this.#c(l);this.#d(`${f} moved from ${g} to ${m}`),this.dispatchEvent(new CustomEvent("kanban-board:transfer",{bubbles:!0,detail:{itemId:i.itemId,fromColumn:c,toColumn:l,newIndex:i.newIndex,item:i.item}}));let b=n.querySelectorAll(':scope > [draggable="true"]').length,y=this.#i.find(w=>w.id===l);y?.wip!==null&&y?.wip!==void 0&&b>y.wip&&this.dispatchEvent(new CustomEvent("kanban-board:wip-exceeded",{bubbles:!0,detail:{column:l,limit:y.wip,count:b}}))});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}}))}teardown(){let t=this.querySelector(".kb-title");t&&t.remove(),this.#e&&(this.#e.remove(),this.#e=null),this.#r&&(this.#r.remove(),this.#r=null),this.#s={},this.#a={},this.#i=[]}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 r=document.createElement("section");r.setAttribute("data-column",a.id),a.label&&r.setAttribute("data-column-label",a.label),a.wip!=null&&r.setAttribute("data-wip",String(a.wip)),a.color&&r.setAttribute("data-column-color",a.color);for(let i of a.items||[]){let o;i.persona||i.action||i.storyId?(o=document.createElement("user-story"),o.setAttribute("detail",i.detail||"minimal"),i.storyId&&o.setAttribute("story-id",i.storyId),i.persona&&o.setAttribute("persona",i.persona),i.action&&o.setAttribute("action",i.action),i.benefit&&o.setAttribute("benefit",i.benefit),i.priority&&o.setAttribute("priority",i.priority),i.status&&o.setAttribute("status",i.status),i.points&&o.setAttribute("points",String(i.points))):(o=document.createElement("article"),o.className="kb-card",o.textContent=i.text||i.label||""),o.setAttribute("draggable","true"),o.dataset.id=i.id||i.storyId||"",r.appendChild(o)}this.appendChild(r)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[kanban-board] Failed to load src="${t}":`,e)}}#l(t){if(!t)return null;for(let[e,s]of Object.entries(this.#s))if(s===t)return e;return null}#n(t){let e=this.#s[t],s=this.#a[t];if(!e||!s)return;let a=e.querySelectorAll(':scope > [draggable="true"]').length,r=s.querySelector(".kb-count");r&&(r.textContent=String(a));let i=this.#i.find(o=>o.id===t);i?.wip!==null&&i?.wip!==void 0&&(a>i.wip?s.setAttribute("data-wip-exceeded",""):s.removeAttribute("data-wip-exceeded"))}#c(t){return this.#i.find(s=>s.id===t)?.label||this.#f(t)}#d(t){this.#r&&(this.#r.textContent="",requestAnimationFrame(()=>{this.#r&&(this.#r.textContent=t)}))}#m(t){return t.getAttribute("story-id")||t.getAttribute("data-id")||t.textContent?.trim().slice(0,40)||"item"}#f(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};x("kanban-board",tt);var et=class d extends A{static get observedAttributes(){return["src","compact","title"]}static#t=0;#e=null;#s=null;#a={};#r=null;#o="";#i=[];setup(){this.#o=`sm-${++d.#t}`;let t=[...this.querySelectorAll(":scope > section[data-activity]")];this.#i=t.map(r=>{let i=r.getAttribute("data-activity")||"",n=r.getAttribute("data-activity-label")||""||this.#m(i),c=r.getAttribute("data-journey-phase")||null,l=[...r.children];return{id:i,label:n,journeyPhase:c,children:l}});for(let r of t)r.remove();this.#e=document.createElement("div"),this.#e.className="sm-scroll",this.#e.setAttribute("role","region"),this.#e.setAttribute("aria-label","Story map"),this.#e.setAttribute("tabindex","0"),this.#s=document.createElement("div"),this.#s.className="sm-columns";let e=0;for(let r of this.#i){let i=document.createElement("section");i.className="sm-column",i.setAttribute("data-activity-column",r.id);let o=document.createElement("header");o.className="sm-activity-header";let n=document.createElement("h3");n.textContent=r.label;let c=document.createElement("span");c.className="sm-activity-count",c.textContent=String(r.children.length),n.appendChild(c),o.appendChild(n),i.appendChild(o);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#o),l.setAttribute("aria-label",`${r.label} stories`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),r.children.length>0){for(let h of r.children)l.appendChild(h);e+=r.children.length}else{let h=document.createElement("p");h.className="sm-empty",h.textContent="No stories yet",l.appendChild(h)}i.appendChild(l),this.#s.appendChild(i),this.#a[r.id]=l}let s=this.getAttribute("title");if(s){let r=document.createElement("h2");r.className="sm-title",r.textContent=s,this.appendChild(r)}this.#e.appendChild(this.#s),this.appendChild(this.#e),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",r=>{let i=r.detail,o=r.target.closest("drag-surface"),n=this.#l(o);n&&(this.#n(n),this.dispatchEvent(new CustomEvent("story-map:reorder",{bubbles:!0,detail:{itemId:i.itemId,activity:n,oldIndex:i.oldIndex,newIndex:i.newIndex}})))}),this.listen(this,"drag-surface:transfer",r=>{let i=r.detail,o=i.fromSurface,n=i.toSurface,c=this.#l(o),l=this.#l(n);if(!c||!l)return;this.#n(c),this.#n(l);let h=n.querySelector(".sm-empty");if(h&&h.remove(),o.querySelectorAll(':scope > [draggable="true"]').length===0&&!o.querySelector(".sm-empty")){let g=document.createElement("p");g.className="sm-empty",g.textContent="No stories yet",o.appendChild(g)}let f=this.#d(i.item);this.#c(`${f} moved from ${c} to ${l}`),this.dispatchEvent(new CustomEvent("story-map:transfer",{bubbles:!0,detail:{itemId:i.itemId,fromActivity:c,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.#e&&(this.#e.remove(),this.#e=null),this.#r&&(this.#r.remove(),this.#r=null),this.#s=null,this.#a={},this.#i=[]}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 r=document.createElement("section");r.setAttribute("data-activity",a.id),r.setAttribute("data-activity-label",a.label||a.id),a.journeyPhase&&r.setAttribute("data-journey-phase",a.journeyPhase);for(let i of a.stories||[]){let o=document.createElement("user-story");o.setAttribute("draggable","true"),o.dataset.id=i.id||i.storyId,(i.storyId||i.id)&&o.setAttribute("story-id",i.storyId||i.id),i.title&&o.setAttribute("title",i.title),i.persona&&o.setAttribute("persona",i.persona),i.action&&o.setAttribute("action",i.action),i.benefit&&o.setAttribute("benefit",i.benefit),i.priority&&o.setAttribute("priority",i.priority),i.status&&o.setAttribute("status",i.status),i.points&&o.setAttribute("points",String(i.points)),o.setAttribute("detail",i.detail||"compact"),r.appendChild(o)}this.appendChild(r)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[story-map] Failed to load src="${t}":`,e)}}#l(t){if(!t)return null;for(let[e,s]of Object.entries(this.#a))if(s===t)return e;return null}#n(t){let e=this.#a[t];if(!e)return;let s=e.querySelectorAll(':scope > [draggable="true"]').length,a=e.closest("[data-activity-column]");if(!a)return;let r=a.querySelector(".sm-activity-count");r&&(r.textContent=String(s))}#c(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"}#m(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};x("story-map",et);var j=`
|
|
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 i=r;if(i.key==="Escape"){i.preventDefault();let a=s.dataset.quadrant;a&&this._closeEdit(a)}})}))}_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 i=e.querySelector(".quadrant__editor");if(i){let a=this.__quadrants?.[t];if(a?.length)i.value=a.join(`
|
|
1752
|
+
`);else{let o=e.querySelector(`slot[name="${t}"]`);if(o){let n=o.assignedElements();if(n.length){let d=[];n.forEach(l=>{let u=l.querySelectorAll("li");u.length?u.forEach(h=>d.push(h.textContent?.trim()??"")):d.push(l.textContent?.trim()??"")}),i.value=d.filter(Boolean).join(`
|
|
1753
|
+
`)}}}i.focus()}}_closeEdit(t){let e=this.shadowRoot?.querySelector(`.quadrant--${t}`);if(!e)return;let s=e.querySelector(".quadrant__editor");if(s){let a=s.value.split(`
|
|
1754
|
+
`).map(n=>n.trim()).filter(Boolean);this.__quadrants||(this.__quadrants={}),this.__quadrants[t]=a;let o=e.querySelector(".quadrant__content");if(o)if(a.length)o.innerHTML=t==="feels"?a.map(n=>this._renderEmotion(n)).join(""):a.map(n=>`<p>${g(n)}</p>`).join("");else{let n=rt[t];o.innerHTML=`<p class="placeholder">Add ${n.label.toLowerCase()} items\u2026</p>`}}this._editingQuadrants.delete(t),e.removeAttribute("data-editing");let r=e.querySelector(".quadrant__face--front"),i=e.querySelector(".quadrant__face--back");r&&r.removeAttribute("inert"),i&&i.setAttribute("inert",""),this.dispatchEvent(new CustomEvent("empathy-map:update",{bubbles:!0,composed:!0,detail:{quadrant:t,items:this.__quadrants?.[t]||[]}}))}};x("empathy-map",dt);function Y({newItems:c,nodes:t,keyOf:e,renderItem:s,containerFor:r}){let i=[],a=[],o=[],n=new Set;for(let l of c)n.add(e(l));for(let[l,u]of[...t])n.has(l)||(u.remove(),t.delete(l),o.push(l));let d=new Map;for(let l of c){let u=e(l),h=t.get(u)||null,m=r(l,h);d.has(m)||d.set(m,[]),d.get(m)?.push({item:l,key:u,existing:h})}for(let[l,u]of d)for(let h=0;h<u.length;h++){let{item:m,key:f,existing:p}=u[h],b=p;b?(b.parentElement!==l||l.children[h]!==b)&&a.push(f):(b=s(m),t.set(f,b),i.push(f));let y=l.children[h];y!==b&&l.insertBefore(b,y||null)}return{added:i,moved:a,removed:o}}var ut=class c 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"]}#s=null;#t={};#i=null;#r="";#o=null;setup(){this.#r=`ie-${++c.#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 i=document.createElement("div");i.className="ie-grid",i.setAttribute("role","region"),i.setAttribute("aria-label","Impact-Effort prioritization matrix");let a=document.createElement("div");a.className="ie-x-label",a.setAttribute("aria-hidden","true"),a.textContent="Effort \u2192";for(let l of c.QUADRANTS){let u=document.createElement("section");u.className="ie-quadrant",u.dataset.quadrantZone=l,u.setAttribute("aria-label",`${c.LABELS[l]}: ${c.DESCRIPTIONS[l]}`);let h=document.createElement("header");h.className="ie-quadrant-label",h.innerHTML=`${c.LABELS[l]}<br><span class="ie-quadrant-desc">${c.DESCRIPTIONS[l]}</span>`;let m=document.createElement("drag-surface");m.setAttribute("group",this.#r),m.setAttribute("aria-label",c.LABELS[l]),m.setAttribute("data-layout","stack"),m.setAttribute("data-layout-gap","xs"),u.appendChild(h),u.appendChild(m),i.appendChild(u),this.#t[l]=m}t.forEach((l,u)=>{let h=l,m=h.getAttribute("data-quadrant")||"quick-wins",f=this.#t[m]||this.#t["quick-wins"];h.hasAttribute("draggable")||h.setAttribute("draggable","true"),h.hasAttribute("data-id")||(h.dataset.id=`ie-item-${u}`),f.appendChild(h)});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 n=this.getAttribute("title");if(n){let l=document.createElement("h3");l.className="ie-title",l.textContent=n,this.prepend(l)}r.appendChild(i),r.appendChild(a),e.appendChild(s),e.appendChild(r),this.appendChild(e),this.appendChild(o),this.#s=i,this.#i=o,this.#o=e,this.listen(this,"drag-surface:transfer",l=>{let{item:u,fromSurface:h,toSurface:m}=l.detail,f=this.#c(h),p=this.#c(m);!f||!p||(u.setAttribute("data-quadrant",p),this.#p(`Moved ${this.#d(u)} to ${c.LABELS[p]}`),this.dispatchEvent(new CustomEvent("impact-effort:move",{bubbles:!0,detail:{itemId:u.dataset.id,from:f,to:p,item:u}})))});let d=this.getAttribute("src");d&&this.#l(d),this.#u()}teardown(){this.#o&&(this.#o.remove(),this.#o=null),this.#i&&(this.#i.remove(),this.#i=null),this.#s=null,this.#t={},this.#n.clear(),this.#a=[]}#a=[];#n=new Map;get items(){if(this.#a.length)return this.#a;let t=[];for(let[e,s]of Object.entries(this.#t))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.#s)return;let e=Array.isArray(t)?t:[];Y({newItems:e,nodes:this.#n,keyOf:s=>s.id??`${s.quadrant}:${s.text}`,renderItem:s=>{let r=this;if(typeof r.renderItem=="function"){let a=r.renderItem(s);if(a instanceof Element)return a.hasAttribute("draggable")||a.setAttribute("draggable","true"),a.hasAttribute("data-id")||a.setAttribute("data-id",String(s.id??"")),a}let i=document.createElement("article");return i.className="ie-card",i.setAttribute("draggable","true"),s.id&&i.setAttribute("data-id",String(s.id)),i.textContent=s.text||s.id||"",i},containerFor:s=>this.#t[s.quadrant]||this.#t["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.#l(s)}async#l(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 i of c.QUADRANTS){let a=this.#t[i];if(a)for(let o of[...a.querySelectorAll("[draggable]")])o.remove()}s.forEach((i,a)=>{let o=i.quadrant||"quick-wins",n=i.id||`ie-item-${a}`,d;i.persona||i.action||i.storyId?(d=document.createElement("user-story"),d.setAttribute("detail","minimal"),i.storyId&&d.setAttribute("story-id",i.storyId),i.persona&&d.setAttribute("persona",i.persona),i.action&&d.setAttribute("action",i.action),i.benefit&&d.setAttribute("benefit",i.benefit),i.priority&&d.setAttribute("priority",i.priority),i.status&&d.setAttribute("status",i.status),i.points&&d.setAttribute("points",String(i.points))):(d=document.createElement("article"),d.textContent=i.label||i.text||""),d.setAttribute("draggable","true"),d.dataset.id=n,d.dataset.quadrant=o,(this.#t[o]||this.#t["quick-wins"]).appendChild(d)})};this.hasAttribute("data-upgraded")&&this.#s?q(this,r,"ie-vt"):r(),this.#u()}catch(e){console.warn(`[impact-effort] Failed to load src="${t}":`,e)}}#c(t){for(let[e,s]of Object.entries(this.#t))if(s===t)return e;return null}#p(t){let e=this.#i;e&&(e.textContent="",requestAnimationFrame(()=>{e.textContent=t}))}#d(t){return t.dataset.id||t.textContent.trim().slice(0,40)}#u(){let t={};for(let e of c.QUADRANTS){let s=this.#t[e];t[e]=s?s.querySelectorAll('[draggable="true"]').length:0}this.dispatchEvent(new CustomEvent("impact-effort:ready",{bubbles:!0,detail:{quadrantCounts:t}}))}};x("impact-effort",ut);var ht=class c extends C{static#e=0;setup(){this.#d=`qg-${++c.#e}`;let t=this.getAttribute("x-label")||"",e=this.getAttribute("y-label")||"",s=this.getAttribute("x-low")||"Low",r=this.getAttribute("x-high")||"High",i=this.getAttribute("y-low")||"Low",a=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"],n=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 h=document.createElement("aside");h.className="qg-y-scale",h.setAttribute("aria-hidden","true"),h.innerHTML=`<span>${a}</span><span>${i}</span>`;let m=document.createElement("div");m.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 p=document.createElement("footer");p.className="qg-x-label",p.setAttribute("aria-hidden","true"),p.textContent=`${t} \u2192`;for(let y=0;y<4;y++){let _=document.createElement("section");_.className="qg-quadrant",_.dataset.quadrantZone=String(y),_.setAttribute("aria-label",o[y]);let v=document.createElement("header");if(v.className="qg-quadrant-label",v.textContent=o[y],_.appendChild(v),n){let w=document.createElement("drag-surface");w.setAttribute("group",this.#d),w.setAttribute("aria-label",o[y]),w.setAttribute("data-layout","stack"),w.setAttribute("data-layout-gap","xs"),_.appendChild(w),this.#u[y]=w}else{let w=document.createElement("ul");w.className="qg-items",_.appendChild(w),this.#m[y]=w}m.appendChild(_),this.#y[y]=_}d.forEach((y,_)=>{let v=y,w=this.#n(v),T=n?this.#u[w]:this.#m[w];if(n&&(v.hasAttribute("draggable")||v.setAttribute("draggable","true")),v.hasAttribute("data-id")||(v.dataset.id=`qg-item-${_}`),v.hasAttribute("data-x")&&v.hasAttribute("data-y")){let E=parseFloat(v.getAttribute("data-x")??""),$=parseFloat(v.getAttribute("data-y")??"");if(Number.isFinite(E)&&Number.isFinite($)){let I=w===0||w===3?(E-.5)*2:E*2,H=w===0||w===1?($-.5)*2:$*2;if(v.style.setProperty("--qg-local-x",I.toFixed(4)),v.style.setProperty("--qg-local-y",H.toFixed(4)),v.classList.add("qg-pinned"),!v.style.getPropertyValue("--qg-pin-hue")){let Kt=v.dataset.id||(v.textContent||"").trim();v.style.setProperty("--qg-pin-hue",`${c.#o(Kt)}deg`)}}}if(n)T.appendChild(v);else{let E=document.createElement("li");E.appendChild(v),T.appendChild(E)}});let b=document.createElement("div");b.className="qg-live-region visually-hidden",b.setAttribute("role","status"),b.setAttribute("aria-live","polite"),l.appendChild(u),l.appendChild(h),l.appendChild(m),l.appendChild(f),l.appendChild(p),this.appendChild(l),this.appendChild(b),this.#h=m,this.#v=b,this.#x=o,n&&this.listen(this,"drag-surface:transfer",this.#a),this.#s()}#s(){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.#f=new ResizeObserver(e=>{for(let s of e)t(s.target);this.#t()});for(let e of this.querySelectorAll(".qg-pinned"))this.#f.observe(e);this.#t()}#t(){this.#g||(this.#g=requestAnimationFrame(()=>{this.#g=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.#y[e];if(!s)continue;let r=[...s.querySelectorAll(".qg-pinned")];if(r.length<2)continue;let i=r.map(l=>l.getBoundingClientRect()),a=Array.from({length:r.length},(l,u)=>u),o=l=>a[l]===l?l:a[l]=o(a[l]),n=(l,u)=>{let h=o(l),m=o(u);h!==m&&(a[h]=m)};for(let l=0;l<r.length;l++)for(let u=l+1;u<r.length;u++)c.#r(i[l],i[u])&&n(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((h,m)=>{let f=r[h];f.classList.add("qg-clustered"),f.dataset.cluster=u,f.style.setProperty("--qg-cluster-i",String(m)),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.#f?.disconnect(),this.#f=null,this.#g&&cancelAnimationFrame(this.#g),this.#g=0}static#r(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 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,i=this.#l(s),a=this.#l(r);i==null||a==null||(e.setAttribute("data-quadrant",String(a)),this.#p(`Moved ${this.#c(e)} to ${this.#x[a]}`),this.dispatchEvent(new CustomEvent("quadrant-grid:move",{bubbles:!0,detail:{item:e,itemId:e.dataset.id,from:i,to:a}})))};#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 s=parseFloat(t.getAttribute("data-x")),r=parseFloat(t.getAttribute("data-y"));return c.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}#l(t){for(let e=0;e<4;e++)if(this.#u[e]===t)return e;return null}#c(t){return(t.textContent||"").trim().split(`
|
|
1755
|
+
`)[0]||"item"}#p(t){this.#v&&(this.#v.textContent=t)}#d="";#u={};#m={};#y={};#h=null;#v=null;#x=[];#f=null;#g=0};x("quadrant-grid",ht);var Rt=5,pt=class c extends C{setup(){let t=this.querySelector(":scope > template"),e=t?c.#s(t):[];if(this.hasAttribute("src")){this.#e(this.getAttribute("src"));return}this.#t(e)}async#e(t){try{let s=await(await fetch(t)).json();this.#t(Array.isArray(s)?s:[])}catch(e){console.warn("risk-register: failed to load src",t,e),this.#t([])}}static#s(t){let e=[],s=t.content.querySelectorAll("tr");for(let r of s){let i=[...r.children],a=i[0]?.textContent?.trim()||"",o=r.getAttribute("data-id")||a.toLowerCase().replace(/\s+/g,"-")||`risk-${e.length}`;e.push({id:o,title:a,likelihood:parseInt(i[1]?.textContent??"",10)||0,impact:parseInt(i[2]?.textContent??"",10)||0,owner:i[3]?.textContent?.trim()||"",mitigation:i[4]?.textContent?.trim()||""})}return e}#t(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
|
+
<thead>
|
|
1757
|
+
<tr>
|
|
1758
|
+
<th data-sort="string">Title</th>
|
|
1759
|
+
<th data-sort="number">Likelihood</th>
|
|
1760
|
+
<th data-sort="number">Impact</th>
|
|
1761
|
+
<th data-sort="number" data-rollup="product" data-heatmap="low-good">Severity</th>
|
|
1762
|
+
<th data-sort="string">Owner</th>
|
|
1763
|
+
<th data-sort="string">Mitigation</th>
|
|
1764
|
+
</tr>
|
|
1765
|
+
</thead>
|
|
1766
|
+
<tbody>
|
|
1767
|
+
${t.map(r=>`
|
|
1768
|
+
<tr data-id="${c.#o(r.id)}">
|
|
1769
|
+
<td>${c.#o(r.title)}</td>
|
|
1770
|
+
<td>${r.likelihood||""}</td>
|
|
1771
|
+
<td>${r.impact||""}</td>
|
|
1772
|
+
<td></td>
|
|
1773
|
+
<td>${c.#o(r.owner)}</td>
|
|
1774
|
+
<td>${c.#o(r.mitigation)}</td>
|
|
1775
|
+
</tr>
|
|
1776
|
+
`).join("")}
|
|
1777
|
+
</tbody>
|
|
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"),i=Math.min(1,Math.max(0,s.likelihood/Rt)),a=Math.min(1,Math.max(0,s.impact/Rt));r.setAttribute("data-x",i.toFixed(3)),r.setAttribute("data-y",a.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#o(t){return String(t??"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}#a=[];get rows(){return[...this.#a]}set rows(t){this.#t(Array.isArray(t)?t:[])}};x("risk-register",pt);var mt=class c 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(v=>v!==this&&!this.contains(v)),i=[...document.querySelectorAll(e)].filter(v=>v!==this&&!this.contains(v));if(!r.length||!i.length){this.#i();return}let a=this.getAttribute("row-label")||"",o=this.getAttribute("cell-mark")||"\u2713",n=this.hasAttribute("flag-orphans"),d=[],l=new WeakMap,u=new WeakMap;for(let v of r){let w=c.#r(v.getAttribute(s));for(let T of w){let E=i.find($=>$.id===T);E&&(d.push({rowEl:v,colEl:E}),l.set(v,(l.get(v)||0)+1),u.set(E,(u.get(E)||0)+1))}}let h=document.createElement("data-table"),m=document.createElement("table"),f=document.createElement("thead"),p=document.createElement("tr"),b=document.createElement("th");b.setAttribute("data-sort","string"),b.textContent=a,p.appendChild(b);for(let v of i){let w=document.createElement("th");w.setAttribute("data-sort","number"),w.textContent=c.#o(v),w.dataset.colId=v.id||"",n&&!u.get(v)&&(w.dataset.orphan=""),p.appendChild(w)}f.appendChild(p),m.appendChild(f);let y=document.createElement("tbody");for(let v of r){let w=document.createElement("tr");w.dataset.rowId=v.id||"",n&&!l.get(v)&&(w.dataset.orphan="");let T=document.createElement("th");T.scope="row",T.textContent=c.#o(v),w.appendChild(T);let E=c.#r(v.getAttribute(s));for(let $ of i){let I=document.createElement("td"),H=E.includes($.id);I.setAttribute("data-sort-value",H?"1":"0"),H?(I.dataset.linked="",I.textContent=o,I.setAttribute("aria-label","linked")):I.setAttribute("aria-label","not linked"),I.dataset.colId=$.id||"",w.appendChild(I)}y.appendChild(w)}m.appendChild(y),h.appendChild(m),[...this.children].forEach(v=>{v.tagName!=="TEMPLATE"&&v.remove()});let _=this.getAttribute("label");if(_){let v=document.createElement("header");v.className="tm-label",v.textContent=_,this.appendChild(v)}this.appendChild(h),this.#a=h,this.#n=new Map(r.map(v=>[v.id,v])),this.#l=new Map(i.map(v=>[v.id,v])),this.listen(h,"click",this.#s),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("traceability-matrix:ready",{bubbles:!0,detail:{rowCount:r.length,colCount:i.length,linkCount:d.length}}))})}#s=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,i=e.dataset.colId,a=r?this.#n.get(r):null,o=i?this.#l.get(i):null,n=e.hasAttribute("data-state-highlighted");if(this.#t(),n){this.dispatchEvent(new CustomEvent("traceability-matrix:highlight",{bubbles:!0,detail:{rowEl:a,colEl:o,on:!1}}));return}e.setAttribute("data-state-highlighted",""),a&&a.setAttribute("data-state-highlighted",""),o&&o!==a&&o.setAttribute("data-state-highlighted",""),s.setAttribute("data-state-highlighted",""),this.dispatchEvent(new CustomEvent("traceability-matrix:highlight",{bubbles:!0,detail:{rowEl:a,colEl:o,on:!0}}))};#t(){this.#a&&(this.#a.querySelectorAll("[data-state-highlighted]").forEach(t=>t.removeAttribute("data-state-highlighted")),document.querySelectorAll("[data-state-highlighted]").forEach(t=>{(this.#n.has(t.id)||this.#l.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#o(t){return t.getAttribute("data-matrix-label")||t.id||(t.textContent||"").trim().split(`
|
|
1779
|
+
`)[0].slice(0,60)||"(unnamed)"}#a=null;#n=new Map;#l=new Map};x("traceability-matrix",mt);var de=864e5,ft=class c 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=c.#t(t),i=c.#t(e);if(!r||!i||i<r)return console.warn("burndown-chart: start/end dates invalid",t,e),!1;let a=(this.getAttribute("weekends")||"include")!=="exclude",o=this.getAttribute("unit")||"points",n=this.getAttribute("label")||"",d=this.querySelector(":scope > template"),l=d?c.#s(d):[],u=l.filter(p=>p.delta!==0),h=c.#r(r,i),m=c.#o(h,s,a),f=c.#a(h,l);return this.#e({label:n,unit:o,dayLabels:h,actual:f,ideal:m,scopeChanges:u}),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent("burndown-chart:ready",{bubbles:!0,detail:{dayCount:h.length,total:s,scopeChanges:u.length}}))}),!0}#e({label:t,unit:e,dayLabels:s,actual:r,ideal:i,scopeChanges:a}){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 n={},d={};s.forEach((u,h)=>{n[u]=i[h],r[h]!==null&&(d[u]=r[h])});let l=[{name:"Actual",values:d},{name:"Ideal",values:n}];if(o.setAttribute("data-values",JSON.stringify(l)),this.appendChild(o),a.length){let u=document.createElement("aside");u.className="bdc-scope-changes";let h=document.createElement("h4");h.textContent="Scope changes",u.appendChild(h);let m=document.createElement("ul");for(let f of a){let p=document.createElement("li"),b=f.delta>0?"+":"";p.innerHTML=`<time datetime="${f.date}">${f.date}</time>: <strong>${b}${f.delta} ${e}</strong>`,m.appendChild(p)}u.appendChild(m),this.appendChild(u)}}static#s(t){let e=[],s=t.content.querySelectorAll("tr");for(let r of s){let i=[...r.children],a=i[0]?.textContent?.trim(),o=parseFloat(i[1]?.textContent??""),n=parseFloat(i[2]?.textContent??"0")||0;!a||!Number.isFinite(o)||e.push({date:a,remaining:o,delta:n})}return e}static#t(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+=de)s.push(c.#i(new Date(r)));return s}static#o(t,e,s){let r=l=>{let u=c.#t(l);if(!u)return!1;let h=u.getDay();return h===0||h===6},i=t.map((l,u)=>({d:l,i:u,weekend:r(l)})).filter(l=>s||!l.weekend),a=i.length>1?e/(i.length-1):0,o=new Array(t.length).fill(null),n=e,d=0;for(let l=0;l<t.length;l++){let u=r(t[l]);s||!u?(o[l]=Math.max(0,e-a*d),d++,n=o[l]):o[l]=n}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)}};x("burndown-chart",ft);var gt=class c extends C{setup(){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=c.#m(t,"start"),r=c.#m(e,"end");if(!s||!r||r<=s)return console.warn("product-roadmap: invalid start/end",t,e),!1;this.#h=s,this.#v=r,this.#x=r.getTime()-s.getTime(),this.#f=this.getAttribute("view")==="month"?"month":"quarter",this.#g=this.hasAttribute("editable");let i=[...this.querySelectorAll(":scope > section[data-lane]")];return i.length?(this.#b=i,this.#e(),!0):(console.warn("product-roadmap: no <section data-lane> children found"),!1)}attributeChangedCallback(){this.isConnected&&this.#b.length&&this.#e()}#e(){[...this.children].forEach(r=>{this.#b.includes(r)||r.remove()}),this.#b.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.#b){let i=r.getAttribute("data-lane")||"",a=document.createElement("section");a.className="rm-lane",a.dataset.lane=i;let o=document.createElement("header");o.className="rm-lane-label",o.textContent=i,a.appendChild(o);let n=document.createElement("div");n.className="rm-track",n.dataset.lane=i;let d=[...r.querySelectorAll(":scope > article[data-start][data-end]")];for(let l of d){let u=this.#t(l,i);u&&n.appendChild(u)}this.#g&&(n.addEventListener("dragover",this.#n),n.addEventListener("drop",this.#l)),a.appendChild(n),s.appendChild(a)}if(t.appendChild(s),this.hasAttribute("today-marker")&&this.#h&&this.#v){let r=new Date;if(r>=this.#h&&r<=this.#v){let i=document.createElement("div");i.className="rm-today",i.style.setProperty("--rm-x",this.#c(r).toFixed(4)),i.title=`Today: ${c.#y(r)}`,s.appendChild(i)}}this.appendChild(t),this.#k=t}#s(){let t=document.createElement("header");t.className="rm-axis";let e=this.#u();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}#t(t,e){let s=c.#m(t.getAttribute("data-start"),"start"),r=c.#m(t.getAttribute("data-end"),"end");if(!s||!r||!this.#h||!this.#v)return null;let i=s<this.#h?this.#h:s,a=r>this.#v?this.#v:r;if(i>=a)return null;let o=this.#c(i),n=this.#c(a)-o,d=document.createElement("article");d.className="rm-bar",d.style.setProperty("--rm-x",o.toFixed(4)),d.style.setProperty("--rm-w",n.toFixed(4)),d.dataset.lane=e,d.dataset.start=c.#y(s),d.dataset.end=c.#y(r),t.dataset.status&&(d.dataset.status=t.dataset.status),t.id&&(d.dataset.sourceId=t.id),this.#g&&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",h=>{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.#g){let h=document.createElement("span");h.className="rm-bar-handle",h.setAttribute("aria-label","Resize end date"),d.appendChild(h),h.addEventListener("pointerdown",m=>this.#r(m,d,t)),d.addEventListener("pointerdown",m=>{m.target!==h&&this.#i(m,d,t)}),d.addEventListener("dragstart",m=>{m.dataTransfer&&(m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",t.id||d.dataset.sourceId||"")),this.#_=t,this.#C=e}),d.addEventListener("dragend",()=>{this.#_=null,this.#C=null})}return d}#i(t,e,s){if(t.button!==0)return;t.preventDefault();let r=e.parentElement.getBoundingClientRect(),i=t.clientX,a=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:i,startFraction:a,widthFraction:o},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#o),e.addEventListener("pointerup",this.#a),e.addEventListener("pointercancel",this.#a)}#r(t,e,s){if(t.button!==0)return;t.preventDefault(),t.stopPropagation();let r=e.parentElement.getBoundingClientRect(),i=t.clientX,a=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:i,startFraction:a,widthFraction:o},e.setPointerCapture(t.pointerId),e.addEventListener("pointermove",this.#o),e.addEventListener("pointerup",this.#a),e.addEventListener("pointercancel",this.#a)}#o=t=>{if(!this.#A)return;let{kind:e,bar:s,trackRect:r,startX:i,startFraction:a,widthFraction:o}=this.#A,n=(t.clientX-i)/r.width;if(e==="move"){let d=Math.max(0,Math.min(1-o,a+n));s.style.setProperty("--rm-x",d.toFixed(4))}else if(e==="resize"){let d=Math.max(.02,Math.min(1-a,o+n));s.style.setProperty("--rm-w",d.toFixed(4))}};#a=t=>{if(!this.#A)return;let{kind:e,bar:s,initiative:r}=this.#A;s.releasePointerCapture(t.pointerId),s.removeEventListener("pointermove",this.#o),s.removeEventListener("pointerup",this.#a),s.removeEventListener("pointercancel",this.#a);let i=parseFloat(s.style.getPropertyValue("--rm-x"))||0,a=parseFloat(s.style.getPropertyValue("--rm-w"))||0,o=this.#d(this.#p(i)),n=this.#d(this.#p(i+a));s.dataset.start=c.#y(o),s.dataset.end=c.#y(n);let d=this.#c(o),l=this.#c(n)-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)};#n=t=>{this.#_&&(t.preventDefault(),t.dataTransfer.dropEffect="move")};#l=t=>{if(!this.#_)return;t.preventDefault();let e=t.currentTarget.dataset.lane,s=this.#_,r=this.#C;if(e===r)return;let i=this.#b.find(a=>a.getAttribute("data-lane")===e);i&&i.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.#e()};#c(t){if(!this.#h)return 0;let e=t.getTime()-this.#h.getTime();return Math.max(0,Math.min(1,e/this.#x))}#p(t){let e=this.#h??new Date;return new Date(e.getTime()+t*this.#x)}#d(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)}#u(){let t=[],e=this.#h,s=this.#v;if(!e||!s)return t;if(this.#f==="quarter"){let r=this.#d(e);for(;r<s;){let i=new Date(r.getFullYear(),r.getMonth()+3,1),a=this.#c(r<e?e:r),o=this.#c(i>s?s:i),n=Math.floor(r.getMonth()/3)+1;t.push({startFraction:a,endFraction:o,label:`Q${n} ${r.getFullYear()}`}),r=i}}else{let r=new Date(e.getFullYear(),e.getMonth(),1);for(;r<s;){let i=new Date(r.getFullYear(),r.getMonth()+1,1),a=this.#c(r<e?e:r),o=this.#c(i>s?s:i),n=r.toLocaleString(void 0,{month:"short"});t.push({startFraction:a,endFraction:o,label:`${n} ${r.getFullYear()}`}),r=i}}return t}static#m(t,e){if(!t)return null;let s=String(t).match(/^(\d{4})-Q([1-4])$/i);if(s){let a=Number(s[1]),n=(Number(s[2])-1)*3;return e==="end"?new Date(a,n+3,0):new Date(a,n,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 i=new Date(t);return isNaN(i.getTime())?null:i}static#y(t){let e=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${s}`}#h=null;#v=null;#x=0;#f="quarter";#g=!1;#b=[];#k=null;#A=null;#_=null;#C=null};x("product-roadmap",gt);function jt(c){let t=c;return class extends t{static keyOf(e){return e.id}#e=[];#s=new Map;get items(){return this.#e}set items(e){let s=e||[],r=Y({newItems:s,nodes:this.#s,keyOf:this.constructor.keyOf,renderItem:i=>this._renderItem(i),containerFor:(i,a)=>this._containerFor(i,a)});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.#s.get(e)||null}_seedCollection(e,s){this.#e=e,this.#s.clear();for(let[r,i]of s)this.#s.set(r,i)}_setItemsSilently(e){this.#e=e}}}var bt=class c extends jt(C){static get observedAttributes(){return["src","compact","title"]}static keyOf(t){return t.id??t.storyId}static#e=0;#s=null;#t={};#i={};#r=null;#o="";#a=[];#n=null;setup(){this.#o=`kb-${++c.#e}`;let t=[...this.querySelectorAll(":scope > section[data-column]")];this.#a=t.map(i=>{let a=i.getAttribute("data-column")||"",n=i.getAttribute("data-column-label")||""||this.#x(a),d=i.getAttribute("data-wip"),l=d?parseInt(d,10):null,u=i.getAttribute("data-column-color")||null,h=[...i.children];return{id:a,label:n,wip:l,color:u,children:h}});for(let i of t)i.remove();this.#s=document.createElement("div"),this.#s.className="kb-columns",this.#s.setAttribute("role","region"),this.#s.setAttribute("aria-label","Kanban board");let e=0;for(let i of this.#a){let a=document.createElement("section");a.className="kb-column",a.setAttribute("data-column-id",i.id),i.color&&a.setAttribute("data-column-tint",i.color);let o=document.createElement("header");o.className="kb-column-header";let n=document.createElement("h3");n.textContent=i.label;let d=document.createElement("output");if(d.className="kb-count",d.textContent=String(i.children.length),n.appendChild(d),i.wip!==null&&!isNaN(i.wip)){let u=document.createElement("span");u.className="kb-wip",u.textContent=`/ ${i.wip}`,u.setAttribute("aria-label",`WIP limit ${i.wip}`),n.appendChild(u)}o.appendChild(n),a.appendChild(o);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#o),l.setAttribute("aria-label",`${i.label} items`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),i.children.length>0){for(let u of i.children)u.hasAttribute("draggable")||u.setAttribute("draggable","true"),u.hasAttribute("data-id")||(u.dataset.id=`kb-item-${e}`),l.appendChild(u);e+=i.children.length}else{let u=document.createElement("p");u.className="kb-empty",u.textContent="No items",l.appendChild(u)}a.appendChild(l),this.#s.appendChild(a),this.#t[i.id]=l,this.#i[i.id]=a,i.wip!==null&&i.children.length>i.wip&&a.setAttribute("data-wip-exceeded","")}let s=this.getAttribute("title");if(s){let i=document.createElement("h2");i.className="kb-title",i.textContent=s,this.appendChild(i)}this.appendChild(this.#s),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",i=>{let a=i.detail,o=i.target.closest("drag-surface"),n=this.#u(o);n&&(this.#m(n),this.#c("drag"),this.dispatchEvent(new CustomEvent("kanban-board:reorder",{bubbles:!0,detail:{itemId:a.itemId,column:n,oldIndex:a.oldIndex,newIndex:a.newIndex}})))}),this.listen(this,"drag-surface:transfer",i=>{let a=i.detail,o=a.fromSurface,n=a.toSurface,d=this.#u(o),l=this.#u(n);if(!d||!l)return;a.item&&a.item.setAttribute("data-column",l),this.#m(d),this.#m(l);let u=n.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 m=this.#v(a.item),f=this.#y(d),p=this.#y(l);this.#h(`${m} moved from ${f} to ${p}`),this.#c("drag"),this.dispatchEvent(new CustomEvent("kanban-board:transfer",{bubbles:!0,detail:{itemId:a.itemId,fromColumn:d,toColumn:l,newIndex:a.newIndex,item:a.item}}));let b=n.querySelectorAll(':scope > [draggable="true"]').length,y=this.#a.find(_=>_.id===l);y?.wip!==null&&y?.wip!==void 0&&b>y.wip&&this.dispatchEvent(new CustomEvent("kanban-board:wip-exceeded",{bubbles:!0,detail:{column:l,limit:y.wip,count:b}}))}),this.#l();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}}))}#l(){let t=[],e=new Map;for(let[s,r]of Object.entries(this.#t)){let i=r.querySelectorAll(':scope > [draggable="true"]');for(let a of i){let o=a.getAttribute("data-id");o&&(t.push({id:o,column:s}),e.set(o,a))}}this._seedCollection(t,e)}#c(t){let e=[],s=new Map;for(let r of this.items){let i=String(r.id??r.storyId??"");i&&s.set(i,r)}for(let[r,i]of Object.entries(this.#t)){let a=i.querySelectorAll(':scope > [draggable="true"]');for(let o of a){let n=o.getAttribute("data-id");if(!n)continue;let d=s.get(n);e.push(d?{...d,column:r}:{id:n,column:r})}}this._setItemsSilently(e),this._emit("items-changed",{items:e},t)}teardown(){let t=this.querySelector(".kb-title");t&&t.remove(),this.#s&&(this.#s.remove(),this.#s=null),this.#r&&(this.#r.remove(),this.#r=null),this.#t={},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(a=>({id:a.id,label:a.label||this.#x(a.id),wip:a.wip??null,color:a.color??null,children:[]})),s=this.#s;this.#t={},this.#i={},this.#a=e;let r=this.#d();this.#s=r;let i=()=>{s&&s.remove(),this.appendChild(r)};this.hasAttribute("data-upgraded")&&s?q(this,i,"kb-vt"):i()}get renderItem(){return this.#n}set renderItem(t){this.#n=typeof t=="function"?t:null}_renderItem(t){let e;if(this.#n){let s=this.#n(t);if(!(s instanceof Element))throw new Error("kanban-board: renderItem must return an Element");e=s}else e=this.#p(t);return e.hasAttribute("draggable")||e.setAttribute("draggable","true"),e.hasAttribute("data-id")||e.setAttribute("data-id",String(c.keyOf(t))),e}_containerFor(t,e){let s=this.#t[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.#t)){this.#m(t);let e=this.#t[t],s=e.querySelectorAll(':scope > [draggable="true"]'),r=e.querySelector(":scope > .kb-empty");if(s.length===0&&!r){let i=document.createElement("p");i.className="kb-empty",i.textContent="No items",e.appendChild(i)}else s.length>0&&r&&r.remove()}}#p(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}#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.#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 i=document.createElement("h3");i.textContent=e.label;let a=document.createElement("output");if(a.className="kb-count",a.textContent="0",i.appendChild(a),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}`),i.appendChild(d)}r.appendChild(i),s.appendChild(r);let o=document.createElement("drag-surface");o.setAttribute("group",this.#o),o.setAttribute("aria-label",`${e.label} items`),o.setAttribute("data-layout","stack"),o.setAttribute("data-layout-gap","xs");let n=document.createElement("p");n.className="kb-empty",n.textContent="No items",o.appendChild(n),s.appendChild(o),t.appendChild(s),this.#t[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 i of s.columns||[]){let a=document.createElement("section");a.setAttribute("data-column",i.id),i.label&&a.setAttribute("data-column-label",i.label),i.wip!=null&&a.setAttribute("data-wip",String(i.wip)),i.color&&a.setAttribute("data-column-color",i.color);for(let o of i.items||[]){let n;o.persona||o.action||o.storyId?(n=document.createElement("user-story"),n.setAttribute("detail",o.detail||"minimal"),o.storyId&&n.setAttribute("story-id",o.storyId),o.persona&&n.setAttribute("persona",o.persona),o.action&&n.setAttribute("action",o.action),o.benefit&&n.setAttribute("benefit",o.benefit),o.priority&&n.setAttribute("priority",o.priority),o.status&&n.setAttribute("status",o.status),o.points&&n.setAttribute("points",String(o.points))):(n=document.createElement("article"),n.className="kb-card",n.textContent=o.text||o.label||""),n.setAttribute("draggable","true"),n.dataset.id=o.id||o.storyId||"",a.appendChild(n)}this.appendChild(a)}let r=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#s?q(this,r,"kb-vt"):r()}catch(e){console.warn(`[kanban-board] Failed to load src="${t}":`,e)}}#u(t){if(!t)return null;for(let[e,s]of Object.entries(this.#t))if(s===t)return e;return null}#m(t){let e=this.#t[t],s=this.#i[t];if(!e||!s)return;let r=e.querySelectorAll(':scope > [draggable="true"]').length,i=s.querySelector(".kb-count");i&&(i.textContent=String(r));let a=this.#a.find(o=>o.id===t);a?.wip!==null&&a?.wip!==void 0&&(r>a.wip?s.setAttribute("data-wip-exceeded",""):s.removeAttribute("data-wip-exceeded"))}#y(t){return this.#a.find(s=>s.id===t)?.label||this.#x(t)}#h(t){this.#r&&(this.#r.textContent="",requestAnimationFrame(()=>{this.#r&&(this.#r.textContent=t)}))}#v(t){return t.getAttribute("story-id")||t.getAttribute("data-id")||t.textContent?.trim().slice(0,40)||"item"}#x(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};x("kanban-board",bt);var vt=class c extends C{static get observedAttributes(){return["src","compact","title"]}static#e=0;#s=null;#t=null;#i={};#r=null;#o="";#a=[];setup(){this.#o=`sm-${++c.#e}`;let t=[...this.querySelectorAll(":scope > section[data-activity]")];this.#a=t.map(i=>{let a=i.getAttribute("data-activity")||"",n=i.getAttribute("data-activity-label")||""||this.#d(a),d=i.getAttribute("data-journey-phase")||null,l=[...i.children];return{id:a,label:n,journeyPhase:d,children:l}});for(let i of t)i.remove();this.#s=document.createElement("div"),this.#s.className="sm-scroll",this.#s.setAttribute("role","region"),this.#s.setAttribute("aria-label","Story map"),this.#s.setAttribute("tabindex","0"),this.#t=document.createElement("div"),this.#t.className="sm-columns";let e=0;for(let i of this.#a){let a=document.createElement("section");a.className="sm-column",a.setAttribute("data-activity-column",i.id);let o=document.createElement("header");o.className="sm-activity-header";let n=document.createElement("h3");n.textContent=i.label;let d=document.createElement("span");d.className="sm-activity-count",d.textContent=String(i.children.length),n.appendChild(d),o.appendChild(n),a.appendChild(o);let l=document.createElement("drag-surface");if(l.setAttribute("group",this.#o),l.setAttribute("aria-label",`${i.label} stories`),l.setAttribute("data-layout","stack"),l.setAttribute("data-layout-gap","xs"),i.children.length>0){for(let u of i.children)l.appendChild(u);e+=i.children.length}else{let u=document.createElement("p");u.className="sm-empty",u.textContent="No stories yet",l.appendChild(u)}a.appendChild(l),this.#t.appendChild(a),this.#i[i.id]=l}let s=this.getAttribute("title");if(s){let i=document.createElement("h2");i.className="sm-title",i.textContent=s,this.appendChild(i)}this.#s.appendChild(this.#t),this.appendChild(this.#s),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",i=>{let a=i.detail,o=i.target.closest("drag-surface"),n=this.#n(o);n&&(this.#l(n),this.dispatchEvent(new CustomEvent("story-map:reorder",{bubbles:!0,detail:{itemId:a.itemId,activity:n,oldIndex:a.oldIndex,newIndex:a.newIndex}})))}),this.listen(this,"drag-surface:transfer",i=>{let a=i.detail,o=a.fromSurface,n=a.toSurface,d=this.#n(o),l=this.#n(n);if(!d||!l)return;this.#l(d),this.#l(l);let u=n.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 m=this.#p(a.item);this.#c(`${m} moved from ${d} to ${l}`),this.dispatchEvent(new CustomEvent("story-map:transfer",{bubbles:!0,detail:{itemId:a.itemId,fromActivity:d,toActivity:l,newIndex:a.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.#s&&(this.#s.remove(),this.#s=null),this.#r&&(this.#r.remove(),this.#r=null),this.#t=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 i=document.createElement("section");i.setAttribute("data-activity",r.id||""),r.label&&i.setAttribute("data-activity-label",r.label),r.journeyPhase&&i.setAttribute("data-journey-phase",r.journeyPhase);for(let a of r.stories||[]){let o,n=this;if(typeof n.renderStory=="function"){let d=n.renderStory(a);o=d instanceof Element?d:null}o||(customElements.get("user-story")?(o=document.createElement("user-story"),o.data=a):(o=document.createElement("article"),o.className="sm-card",o.textContent=a.title||a.id||"")),o.hasAttribute("draggable")||o.setAttribute("draggable","true"),a.id&&!o.hasAttribute("data-id")&&o.setAttribute("data-id",String(a.id)),i.appendChild(o)}this.appendChild(i)}let s=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#s?q(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 i of s.activities||[]){let a=document.createElement("section");a.setAttribute("data-activity",i.id),a.setAttribute("data-activity-label",i.label||i.id),i.journeyPhase&&a.setAttribute("data-journey-phase",i.journeyPhase);for(let o of i.stories||[]){let n=document.createElement("user-story");n.setAttribute("draggable","true"),n.dataset.id=o.id||o.storyId,(o.storyId||o.id)&&n.setAttribute("story-id",o.storyId||o.id),o.title&&n.setAttribute("title",o.title),o.persona&&n.setAttribute("persona",o.persona),o.action&&n.setAttribute("action",o.action),o.benefit&&n.setAttribute("benefit",o.benefit),o.priority&&n.setAttribute("priority",o.priority),o.status&&n.setAttribute("status",o.status),o.points&&n.setAttribute("points",String(o.points)),n.setAttribute("detail",o.detail||"compact"),a.appendChild(n)}this.appendChild(a)}let r=()=>{this.teardown(),this.removeAttribute("data-upgraded"),this.setup()};this.hasAttribute("data-upgraded")&&this.#s?q(this,r,"sm-vt"):r()}catch(e){console.warn(`[story-map] Failed to load src="${t}":`,e)}}#n(t){if(!t)return null;for(let[e,s]of Object.entries(this.#i))if(s===t)return e;return null}#l(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 i=r.querySelector(".sm-activity-count");i&&(i.textContent=String(s))}#c(t){this.#r&&(this.#r.textContent="",requestAnimationFrame(()=>{this.#r&&(this.#r.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())}};x("story-map",vt);var X=`
|
|
1701
1781
|
:host {
|
|
1702
1782
|
display: block;
|
|
1703
1783
|
position: relative;
|
|
@@ -1881,12 +1961,12 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1881
1961
|
}
|
|
1882
1962
|
|
|
1883
1963
|
.rs-popover__btn--delete {
|
|
1884
|
-
color: #dc2626;
|
|
1964
|
+
color: var(--color-error-text, var(--color-error, #dc2626));
|
|
1885
1965
|
}
|
|
1886
1966
|
|
|
1887
1967
|
.rs-popover__btn--delete:hover {
|
|
1888
|
-
background: #
|
|
1889
|
-
color: #dc2626;
|
|
1968
|
+
background: color-mix(in oklch, var(--color-error, #dc2626) 8%, var(--_card));
|
|
1969
|
+
color: var(--color-error-text, var(--color-error, #dc2626));
|
|
1890
1970
|
}
|
|
1891
1971
|
|
|
1892
1972
|
/* \u2500\u2500 Comment thread \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 */
|
|
@@ -1910,7 +1990,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1910
1990
|
display: flex;
|
|
1911
1991
|
align-items: center;
|
|
1912
1992
|
justify-content: center;
|
|
1913
|
-
color: #fff;
|
|
1993
|
+
color: var(--color-text-inverted, #fff);
|
|
1914
1994
|
flex-shrink: 0;
|
|
1915
1995
|
}
|
|
1916
1996
|
|
|
@@ -1992,7 +2072,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
1992
2072
|
border: none;
|
|
1993
2073
|
border-radius: 6px;
|
|
1994
2074
|
background: var(--_accent);
|
|
1995
|
-
color: #fff;
|
|
2075
|
+
color: var(--color-text-inverted, #fff);
|
|
1996
2076
|
cursor: pointer;
|
|
1997
2077
|
padding: 0;
|
|
1998
2078
|
flex-shrink: 0;
|
|
@@ -2054,7 +2134,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2054
2134
|
|
|
2055
2135
|
.rs-toolbar__btn[aria-pressed="true"] {
|
|
2056
2136
|
background: var(--_accent);
|
|
2057
|
-
color: #fff;
|
|
2137
|
+
color: var(--color-text-inverted, #fff);
|
|
2058
2138
|
border-color: var(--_accent);
|
|
2059
2139
|
}
|
|
2060
2140
|
|
|
@@ -2144,75 +2224,69 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2144
2224
|
|
|
2145
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 */
|
|
2146
2226
|
.state-msg { padding: var(--_space-l); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
2147
|
-
.state-msg--error { color: #dc2626; }
|
|
2148
|
-
|
|
2149
|
-
@media (prefers-color-scheme: dark) {
|
|
2150
|
-
.rs-popover__btn--delete:hover {
|
|
2151
|
-
background: #450a0a;
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
`;function jt(){let d=globalThis.localStorage;if(!d)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return d.getItem(t)},async setRaw(t,e){d.setItem(t,e)},async removeRaw(t){d.removeItem(t)},async keys(t){let e=[];for(let s=0;s<d.length;s++){let a=d.key(s);a&&a.startsWith(t)&&e.push(a)}return e}}}var R=null;function k(){return R||(R=jt()),R}function st(d,t){if(typeof d!="string"||!d)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:${d}:${t}`}function gt(d){if(typeof d!="string"||!d)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${d}:`}function vt(d){try{let t=JSON.parse(d);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var P={configure(d={}){R=d.backend??null},async set(d,t,e){let s={data:e,timestamp:Date.now()};await k().setRaw(st(d,t),JSON.stringify(s))},async get(d,t,e){let s=await k().getRaw(st(d,t));if(s==null)return null;let a=vt(s);return!a||e?.maxAge!=null&&Date.now()-a.timestamp>e.maxAge?null:a.data},async remove(d,t){await k().removeRaw(st(d,t))},async list(d){let t=gt(d),e=await k().keys(t),s=[];for(let a of e){let r=await k().getRaw(a);if(r==null)continue;let i=vt(r);i&&s.push({key:a.slice(t.length),data:i.data,timestamp:i.timestamp})}return s},async clear(d){let t=gt(d),e=await k().keys(t);for(let s of e)await k().removeRaw(s)},async clearAll(){let d=await k().keys("vb:");for(let t of d)await k().removeRaw(t)},async setMany(d,t){for(let[e,s]of t)await P.set(d,e,s)}};var z=class{#t=new Map;async load(){return[...this.#t.values()]}async save(t){return t.id||(t.id=crypto.randomUUID()),this.#t.set(t.id,t),t}async update(t,e){let s=this.#t.get(t);if(!s)throw new Error(`Pin ${t} not found`);return Object.assign(s,e),s}async remove(t){this.#t.delete(t)}},D=class{#t;constructor(t="default"){this.#t=t}async#e(){let t=await P.get("reviews",this.#t);return Array.isArray(t)?t:[]}async#s(t){await P.set("reviews",this.#t,t)}async load(){return this.#e()}async save(t){t.id||(t.id=crypto.randomUUID());let e=await this.#e();return e.push(t),await this.#s(e),t}async update(t,e){let s=await this.#e(),a=s.findIndex(r=>r.id===t);if(a===-1)throw new Error(`Pin ${t} not found`);return Object.assign(s[a],e),await this.#s(s),s[a]}async remove(t){let e=(await this.#e()).filter(s=>s.id!==t);await this.#s(e)}},B=class{#t;constructor(t){if(!t)throw new Error("RestAdapter requires an endpoint URL");this.#t=t.replace(/\/$/,"")}async load(){let t=await fetch(this.#t);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.#t,{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.#t}/${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.#t}/${encodeURIComponent(t)}`,{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`)}},at=class extends HTMLElement{static get observedAttributes(){return["src","editable","adapter","endpoint","storage-key","author","compact","show-resolved"]}#t=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){this.__pins=Array.isArray(t)?t:[],this.isConnected&&this._render()}get adapter(){return this.__adapter}set adapter(t){this.__adapter=t,this.isConnected&&this._loadFromAdapter()}#e(){for(let t of this.children){let e=t.getAttribute("slot");e&&this.#t.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#t.get(t)||""}connectedCallback(){this.#e(),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 z)&&!(this.__adapter instanceof D)&&!(this.__adapter instanceof B))return;switch(this.getAttribute("adapter")||"memory"){case"local":this.__adapter=new D(this.getAttribute("storage-key")||"default");break;case"rest":try{this.__adapter=new B(this.getAttribute("endpoint"))}catch{this.__adapter=new z}break;default:this.__adapter=new z}}async _loadSrc(t){if(t){this.shadowRoot.innerHTML=`<style>${j}</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){this.shadowRoot.innerHTML=`<style>${j}</style><div class="state-msg state-msg--error">Could not load pins: ${u(e.message)}</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.#n(`Pin ${this.#a().length} added`),this.dispatchEvent(new CustomEvent("review-surface:add",{bubbles:!0,composed:!0,detail:{pin:e}})),e}async removePin(t){let e=this.__pins.find(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.#n("Pin removed"),this.dispatchEvent(new CustomEvent("review-surface:remove",{bubbles:!0,composed:!0,detail:{pin:e}})))}async resolvePin(t){let e=this.__pins.find(a=>a.id===t);if(!e)return;let 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.#n("Pin resolved"),this.dispatchEvent(new CustomEvent("review-surface:resolve",{bubbles:!0,composed:!0,detail:{pin:e}}))}async unresolvePin(t){let e=this.__pins.find(a=>a.id===t);if(!e)return;let s={resolved:!1,resolvedBy:null,resolvedAt:null};this.__adapter&&await this.__adapter.update(t,s),Object.assign(e,s),this._render(),this.#n("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()}#a(){let t=this.hasAttribute("show-resolved");return this.__pins.filter(e=>t||!e.resolved).sort((e,s)=>new Date(e.createdAt)-new Date(s.createdAt))}_render(){let t=this.hasAttribute("editable"),e=this.#a(),s=this._activePin?this.__pins.find(a=>a.id===this._activePin):null;this.setAttribute("pin-count",String(e.length)),this.shadowRoot.innerHTML=`<style>${j}</style>
|
|
2227
|
+
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
2228
|
+
`;function ue(){let c=globalThis.localStorage;if(!c)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return c.getItem(t)},async setRaw(t,e){c.setItem(t,e)},async removeRaw(t){c.removeItem(t)},async keys(t){let e=[];for(let s=0;s<c.length;s++){let r=c.key(s);r&&r.startsWith(t)&&e.push(r)}return e}}}var Q=null;function M(){return Q||(Q=ue()),Q}function yt(c,t){if(typeof c!="string"||!c)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:${c}:${t}`}function Bt(c){if(typeof c!="string"||!c)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${c}:`}function Ot(c){try{let t=JSON.parse(c);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var K={configure(c={}){Q=c.backend??null},async set(c,t,e){let s={data:e,timestamp:Date.now()};await M().setRaw(yt(c,t),JSON.stringify(s))},async get(c,t,e){let s=await M().getRaw(yt(c,t));if(s==null)return null;let r=Ot(s);return!r||e?.maxAge!=null&&Date.now()-r.timestamp>e.maxAge?null:r.data},async remove(c,t){await M().removeRaw(yt(c,t))},async list(c){let t=Bt(c),e=await M().keys(t),s=[];for(let r of e){let i=await M().getRaw(r);if(i==null)continue;let a=Ot(i);a&&s.push({key:r.slice(t.length),data:a.data,timestamp:a.timestamp})}return s},async clear(c){let t=Bt(c),e=await M().keys(t);for(let s of e)await M().removeRaw(s)},async clearAll(){let c=await M().keys("vb:");for(let t of c)await M().removeRaw(t)},async setMany(c,t){for(let[e,s]of t)await K.set(c,e,s)}};var wt="[data-copy], [data-copy-target], [data-paste-target]",he="Copied to clipboard",pe="Pasted from clipboard",xt=new WeakMap;async function At(c,t={}){if(c==null||c==="")return!1;let{button:e,announceMessage:s=he,duration:r=1500}=t;try{await navigator.clipboard.writeText(c)}catch{return!1}return Ht({button:e,duration:r,announceMessage:s,eventDetail:{text:c}}),!0}function Ht({button:c,duration:t,announceMessage:e,eventDetail:s,state:r="copied",eventName:i="copy"}){if(c){c.dataset.state=r;let a=xt.get(c);a&&clearTimeout(a),xt.set(c,setTimeout(()=>{delete c.dataset.state,xt.delete(c)},t)),c.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:s}))}ge(e,c??document.body)}async function me(c,t={}){let{button:e,announceMessage:s=pe,duration:r=1500}=t,i;try{i=await navigator.clipboard.readText()}catch{return null}return c&&("value"in c&&(c instanceof HTMLInputElement||c instanceof HTMLTextAreaElement||c instanceof HTMLSelectElement)?c.value=i:c.textContent=i,c.dispatchEvent(new Event("input",{bubbles:!0}))),Ht({button:e,duration:r,announceMessage:s,eventDetail:{text:i},state:"pasted",eventName:"paste"}),i}function Ft(c=document){c.querySelectorAll(wt).forEach(_t)}function _t(c){c.hasAttribute("data-copy-init")||(c.setAttribute("data-copy-init",""),c.addEventListener("click",()=>{if(c.dataset.pasteTarget){let e=document.querySelector(c.dataset.pasteTarget);if(!e)return;me(e,{button:c});return}let t=fe(c);t&&At(t,{button:c})}))}function fe(c){if(c.dataset.copy)return c.dataset.copy;if(c.dataset.copyTarget){let t=document.querySelector(c.dataset.copyTarget);if(!t)return"";let e=c.dataset.copyAttr;return e?t.getAttribute(e)??"":t.textContent??""}return""}function ge(c,t){let e=document.createElement("div");e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.className="visually-hidden",e.textContent=c,t.appendChild(e),setTimeout(()=>e.remove(),1e3)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Ft()):Ft();var be=new MutationObserver(c=>{for(let t of c)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let s=e;s.matches(wt)&&_t(s),s.querySelectorAll(wt).forEach(r=>_t(r))}});be.observe(document.documentElement,{childList:!0,subtree:!0});var j=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)}},G=class{#e;constructor(t="default"){this.#e=t}async#s(){let t=await K.get("reviews",this.#e);return Array.isArray(t)?t:[]}async#t(t){await K.set("reviews",this.#e,t)}async load(){return this.#s()}async save(t){t.id||(t.id=crypto.randomUUID());let e=await this.#s();return e.push(t),await this.#t(e),t}async update(t,e){let s=await this.#s(),r=s.findIndex(i=>i.id===t);if(r===-1)throw new Error(`Pin ${t} not found`);return Object.assign(s[r],e),await this.#t(s),s[r]}async remove(t){let e=(await this.#s()).filter(s=>s.id!==t);await this.#t(e)}},J=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}`)}},Ct=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()}#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)||""}connectedCallback(){this.#s(),this.setAttribute("data-upgraded",""),this.#t(),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.#t(),this._loadFromAdapter()):this._render())}#t(){if(this.__adapter&&!(this.__adapter instanceof j)&&!(this.__adapter instanceof G)&&!(this.__adapter instanceof J))return;switch(this.getAttribute("adapter")||"memory"){case"local":this.__adapter=new G(this.getAttribute("storage-key")||"default");break;case"rest":try{this.__adapter=new J(this.getAttribute("endpoint")??"")}catch{this.__adapter=new j}break;default:this.__adapter=new j}}async _loadSrc(t){if(!(!t||!this.shadowRoot)){this.shadowRoot.innerHTML=`<style>${X}</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>${X}</style><div class="state-msg state-msg--error">Could not load pins: ${g(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.#l(`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.#l("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.#l("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.#l("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>${X}</style>
|
|
2155
2229
|
<div class="rs-container">
|
|
2156
2230
|
<slot></slot>
|
|
2157
2231
|
<div class="rs-overlay" role="img" aria-label="Review annotation surface">
|
|
2158
|
-
${e.map((
|
|
2232
|
+
${e.map((r,i)=>this._renderPin(r,i+1)).join("")}
|
|
2159
2233
|
</div>
|
|
2160
2234
|
${s?this._renderPopover(s,t):""}
|
|
2161
2235
|
</div>
|
|
2162
2236
|
${t?this._renderToolbar(e.length):""}
|
|
2163
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"
|
|
2164
|
-
data-pin-id="${
|
|
2238
|
+
data-pin-id="${g(t.id)}"
|
|
2165
2239
|
${t.resolved?"data-resolved":""}
|
|
2166
2240
|
${this._activePin===t.id?"data-active":""}
|
|
2167
2241
|
style="left:${t.x}%;top:${t.y}%"
|
|
2168
|
-
aria-label="Pin ${e}: ${
|
|
2242
|
+
aria-label="Pin ${e}: ${g(s)}"
|
|
2169
2243
|
aria-expanded="${this._activePin===t.id}"
|
|
2170
2244
|
aria-haspopup="dialog">
|
|
2171
2245
|
<span class="rs-pin__number">${e}</span>
|
|
2172
|
-
</button>`}_renderPopover(t,e){let s=this.#
|
|
2246
|
+
</button>`}_renderPopover(t,e){let s=this.#i().findIndex(r=>r.id===t.id)+1;return`<div class="rs-popover" data-open
|
|
2173
2247
|
style="left:${Math.min(t.x,70)}%;top:${t.y}%"
|
|
2174
2248
|
role="dialog"
|
|
2175
|
-
aria-labelledby="rs-popover-title-${
|
|
2249
|
+
aria-labelledby="rs-popover-title-${g(t.id)}">
|
|
2176
2250
|
|
|
2177
2251
|
<div class="rs-popover__header">
|
|
2178
|
-
<span class="rs-popover__title" id="rs-popover-title-${
|
|
2252
|
+
<span class="rs-popover__title" id="rs-popover-title-${g(t.id)}">
|
|
2179
2253
|
Pin ${s}
|
|
2180
|
-
${t.resolved?`<span class="rs-resolved-badge">${
|
|
2254
|
+
${t.resolved?`<span class="rs-resolved-badge">${A(k.checkCircle)} Resolved</span>`:""}
|
|
2181
2255
|
</span>
|
|
2182
2256
|
<div class="rs-popover__actions">
|
|
2183
2257
|
${e&&!t.resolved?`
|
|
2184
|
-
<button class="rs-popover__btn rs-popover__btn--resolve" data-action="resolve" data-pin-id="${
|
|
2185
|
-
aria-label="Resolve pin" title="Resolve">${
|
|
2258
|
+
<button class="rs-popover__btn rs-popover__btn--resolve" data-action="resolve" data-pin-id="${g(t.id)}"
|
|
2259
|
+
aria-label="Resolve pin" title="Resolve">${A(k.checkCircle)}</button>`:""}
|
|
2186
2260
|
${e&&t.resolved?`
|
|
2187
|
-
<button class="rs-popover__btn" data-action="unresolve" data-pin-id="${
|
|
2188
|
-
aria-label="Re-open pin" title="Re-open">${
|
|
2261
|
+
<button class="rs-popover__btn" data-action="unresolve" data-pin-id="${g(t.id)}"
|
|
2262
|
+
aria-label="Re-open pin" title="Re-open">${A(k.messageCircle)}</button>`:""}
|
|
2189
2263
|
${e?`
|
|
2190
|
-
<button class="rs-popover__btn rs-popover__btn--delete" data-action="delete" data-pin-id="${
|
|
2191
|
-
aria-label="Delete pin" title="Delete">${
|
|
2264
|
+
<button class="rs-popover__btn rs-popover__btn--delete" data-action="delete" data-pin-id="${g(t.id)}"
|
|
2265
|
+
aria-label="Delete pin" title="Delete">${A(k.x)}</button>`:""}
|
|
2192
2266
|
<button class="rs-popover__btn" data-action="close"
|
|
2193
|
-
aria-label="Close">${
|
|
2267
|
+
aria-label="Close">${A(k.x)}</button>
|
|
2194
2268
|
</div>
|
|
2195
2269
|
</div>
|
|
2196
2270
|
|
|
2197
2271
|
<div class="rs-comment">
|
|
2198
2272
|
<div class="rs-comment__meta">
|
|
2199
|
-
<span class="rs-comment__avatar" style="background:${
|
|
2200
|
-
<span class="rs-comment__author">${
|
|
2201
|
-
<span class="rs-comment__time">${this.#
|
|
2273
|
+
<span class="rs-comment__avatar" style="background:${D(t.author||"Anonymous")}">${z(t.author||"Anonymous")}</span>
|
|
2274
|
+
<span class="rs-comment__author">${g(t.author||"Anonymous")}</span>
|
|
2275
|
+
<span class="rs-comment__time">${this.#n(t.createdAt)}</span>
|
|
2202
2276
|
</div>
|
|
2203
|
-
<div class="rs-comment__text">${
|
|
2277
|
+
<div class="rs-comment__text">${g(t.text)}</div>
|
|
2204
2278
|
</div>
|
|
2205
2279
|
|
|
2206
2280
|
${t.replies?.length?`
|
|
2207
2281
|
<div class="rs-replies">
|
|
2208
|
-
${t.replies.map(
|
|
2282
|
+
${t.replies.map(r=>`
|
|
2209
2283
|
<div class="rs-reply">
|
|
2210
2284
|
<div class="rs-comment__meta">
|
|
2211
|
-
<span class="rs-comment__avatar" style="background:${
|
|
2212
|
-
<span class="rs-comment__author">${
|
|
2213
|
-
<span class="rs-comment__time">${this.#
|
|
2285
|
+
<span class="rs-comment__avatar" style="background:${D(r.author||"Anonymous")}">${z(r.author||"Anonymous")}</span>
|
|
2286
|
+
<span class="rs-comment__author">${g(r.author||"Anonymous")}</span>
|
|
2287
|
+
<span class="rs-comment__time">${this.#n(r.createdAt)}</span>
|
|
2214
2288
|
</div>
|
|
2215
|
-
<div class="rs-comment__text">${
|
|
2289
|
+
<div class="rs-comment__text">${g(r.text)}</div>
|
|
2216
2290
|
</div>
|
|
2217
2291
|
`).join("")}
|
|
2218
2292
|
</div>`:""}
|
|
@@ -2221,22 +2295,22 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2221
2295
|
<div class="rs-input">
|
|
2222
2296
|
<textarea class="rs-input__field" placeholder="Reply\u2026" rows="1"
|
|
2223
2297
|
aria-label="Reply to pin ${s}"></textarea>
|
|
2224
|
-
<button class="rs-input__submit" data-action="reply" data-pin-id="${
|
|
2225
|
-
aria-label="Send reply">${
|
|
2298
|
+
<button class="rs-input__submit" data-action="reply" data-pin-id="${g(t.id)}"
|
|
2299
|
+
aria-label="Send reply">${A(k.send)}</button>
|
|
2226
2300
|
</div>`:""}
|
|
2227
2301
|
|
|
2228
2302
|
</div>`}_renderToolbar(t){return`<div class="rs-toolbar" role="toolbar" aria-label="Review tools">
|
|
2229
2303
|
<button class="rs-toolbar__btn" data-action="toggle-mode"
|
|
2230
2304
|
aria-pressed="${this._annotating}"
|
|
2231
2305
|
title="Toggle annotate mode">
|
|
2232
|
-
${
|
|
2306
|
+
${A(k.mapPin)} Annotate
|
|
2233
2307
|
</button>
|
|
2234
2308
|
<button class="rs-toolbar__btn" data-action="export"
|
|
2235
2309
|
title="Export pins as JSON">
|
|
2236
|
-
${
|
|
2310
|
+
${A(k.download)} Export
|
|
2237
2311
|
</button>
|
|
2238
2312
|
<output class="rs-toolbar__count">${t} pin${t!==1?"s":""}</output>
|
|
2239
|
-
</div>`}_bindListeners(t){let e=this.shadowRoot;e.querySelectorAll(".rs-pin").forEach(r=>{r.addEventListener("click",i=>{i.stopPropagation();let o=r.dataset.pinId;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(n=>n.id===o)}}))})});let s=e.querySelector(".rs-overlay");s&&t&&s.addEventListener("click",r=>{if(!this._annotating||r.target.closest(".rs-pin"))return;let i=s.getBoundingClientRect(),o=(r.clientX-i.left)/i.width*100,n=(r.clientY-i.top)/i.height*100;this.#r(o,n)}),e.querySelectorAll("[data-action]").forEach(r=>{r.addEventListener("click",i=>{i.stopPropagation();let o=r.dataset.action,n=r.dataset.pinId;switch(o){case"close":this._activePin=null,this._render();break;case"resolve":this.resolvePin(n);break;case"unresolve":this.unresolvePin(n);break;case"delete":this.removePin(n);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(n);break}})});let a=e.querySelector(".rs-input__field");a&&a.addEventListener("keydown",r=>{if(r.key==="Enter"&&!r.shiftKey){r.preventDefault();let i=e.querySelector('[data-action="reply"]')?.dataset.pinId;i&&this.#o(i)}}),e.addEventListener("keydown",r=>{r.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",a=await this.addPin({x:t,y:e,text:"",author:s});this._activePin=a.id,this._render(),requestAnimationFrame(()=>{let r=this.shadowRoot.querySelector(".rs-input__field");r&&r.focus()})}async#o(t){let e=this.shadowRoot.querySelector(".rs-input__field");if(!e)return;let s=e.value.trim();if(!s)return;let a=this.__pins.find(i=>i.id===t);if(!a)return;let r={id:crypto.randomUUID(),text:s,author:this.getAttribute("author")||"Anonymous",createdAt:new Date().toISOString()};a.replies||(a.replies=[]),a.text?(a.replies.push(r),this.__adapter&&await this.__adapter.update(t,{replies:a.replies})):(a.text=s,this.__adapter&&await this.__adapter.update(t,{text:s})),this._render(),this.#n("Reply added"),requestAnimationFrame(()=>{let i=this.shadowRoot.querySelector(".rs-input__field");i&&i.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);try{await navigator.clipboard.writeText(t),this.#n("Pins copied to clipboard")}catch{let e=new Blob([t],{type:"application/json"}),s=URL.createObjectURL(e),a=document.createElement("a");a.href=s,a.download="review-pins.json",a.click(),URL.revokeObjectURL(s),this.#n("Pins exported as file")}}#l(t){if(!t)return"";try{let e=new Date(t),a=new Date-e,r=Math.floor(a/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let o=Math.floor(i/24);return o<7?`${o}d ago`:e.toLocaleDateString()}catch{return""}}#n(t){let e=this.shadowRoot.querySelector(".rs-live");e&&(e.textContent=t)}};x("review-surface",at);var $=864e5,it=$*7,H=$*30,Rt=$*91,_t=$*365;function yt(d){return typeof d=="number"?d:new Date(d).getTime()}function Pt(d){return d<=it*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):d<=H*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):d<=_t?t=>t.toLocaleDateString(void 0,{month:"short",year:"2-digit"}):t=>t.toLocaleDateString(void 0,{year:"numeric"})}function Dt(d){return d<=it*3?"day":d<=H*3?"week":d<=_t?"month":"quarter"}function xt(d){return String(d).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var rt=class extends A{static get observedAttributes(){return["src","title","view","show-today","show-progress","show-dependencies","compact"]}#t=null;#e=null;#s=null;#a=[];#r=0;#o=0;#i=0;setup(){let t=this.querySelector(":scope > table");if(!t||(this.#a=this.#l(t),this.#a.length===0))return!1;this.#r=Math.min(...this.#a.map(e=>e.start)),this.#o=Math.max(...this.#a.map(e=>e.end)),this.#i=this.#o-this.#r,this.#i<=0&&(this.#i=$),this.#n(t),this.dispatchEvent(new CustomEvent("gantt-chart:ready",{bubbles:!0,detail:{taskCount:this.#a.length,dateRange:{start:new Date(this.#r).toISOString(),end:new Date(this.#o).toISOString()}}}))}teardown(){this.#s&&(this.#s.remove(),this.#s=null),this.#t&&(this.#t.remove(),this.#t=null),this.#e&&(this.#e.remove(),this.#e=null);let t=this.querySelector("table.gc-sr-only");t&&t.classList.remove("gc-sr-only"),this.#a=[]}attributeChangedCallback(t,e,s){e===s||!this.isConnected||(t==="src"?this._loadSrc(s):this.hasAttribute("data-upgraded")&&(this.teardown(),this.removeAttribute("data-upgraded"),this.setup()))}#l(t){let e=t.querySelectorAll("tbody tr"),s=[];for(let a=0;a<e.length;a++){let r=e[a],i=r.querySelectorAll("time[datetime]");if(i.length<2&&!r.hasAttribute("data-milestone"))continue;let o=i[0]?.getAttribute("datetime"),n=i.length>1?i[1].getAttribute("datetime"):o;if(!o)continue;let c=r.querySelector("progress"),l=c?c.value/(c.max||100):0,h=r.cells[0]?.textContent?.trim()||`Task ${a+1}`;s.push({id:r.dataset.taskId||`gc-task-${a}`,name:h,start:yt(o),end:yt(n),progress:l,group:r.dataset.group||null,depends:r.dataset.depends?r.dataset.depends.split(",").map(p=>p.trim()):[],status:r.dataset.status||null,assignee:r.dataset.assignee||null,milestone:r.hasAttribute("data-milestone"),color:r.dataset.color||null,storyIds:r.dataset.storyIds?r.dataset.storyIds.split(",").map(p=>p.trim()):[],itemIds:r.dataset.itemIds?r.dataset.itemIds.split(",").map(p=>p.trim()):[]})}return s}#n(t){let e=this.getAttribute("title"),s=this.hasAttribute("show-today"),a=this.hasAttribute("show-progress"),r=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.#t=document.createElement("div"),this.#t.className="gc-container",this.#t.setAttribute("role","region"),this.#t.setAttribute("aria-label",`Gantt chart${e?": "+e:""}`);let i=this.#c();this.#t.appendChild(i);let o=document.createElement("div");o.className="gc-body";let n=document.createElement("div");n.className="gc-task-list";let c=document.createElement("div");c.className="gc-bars";let l=this.#m();c.appendChild(l);let h=this.#f();for(let[p,f]of h){if(h.size>1&&p){let g=document.createElement("div");g.className="gc-group-header";let m=document.createElement("span");m.className="gc-group-label",m.textContent=p,g.appendChild(m),n.appendChild(g);let b=document.createElement("div");b.className="gc-group-spacer",c.appendChild(b)}for(let g of f){let m=document.createElement("div");m.className="gc-task-row",m.setAttribute("data-task-id",g.id);let b=document.createElement("span");b.className="gc-task-name",b.textContent=g.name,m.appendChild(b);let y=document.createElement("span");y.className="gc-task-dates",y.textContent=`${new Date(g.start).toLocaleDateString()} to ${new Date(g.end).toLocaleDateString()}`,m.appendChild(y),n.appendChild(m);let w=document.createElement("div");w.className="gc-bar-row",g.milestone?w.appendChild(this.#k(g)):w.appendChild(this.#C(g,a)),c.appendChild(w)}}if(s){let p=this.#b();p&&c.appendChild(p)}r&&requestAnimationFrame(()=>{let p=this.#E(c);p&&c.appendChild(p)}),o.appendChild(n),o.appendChild(c),this.#t.appendChild(o),this.insertBefore(this.#t,t),t.classList.add("gc-sr-only"),this.#e=document.createElement("div"),this.#e.className="gc-sr-only",this.#e.setAttribute("role","status"),this.#e.setAttribute("aria-live","polite"),this.#e.setAttribute("aria-atomic","true"),this.appendChild(this.#e),this.listen(this.#t,"click",p=>{let f=p.target.closest(".gc-bar, .gc-milestone");if(!f)return;let g=f.dataset.taskId,m=this.#a.find(b=>b.id===g);m&&(this.#p(`Selected: ${m.name}`),this.dispatchEvent(new CustomEvent("gantt-chart:task-click",{bubbles:!0,detail:{task:m}})))}),this.listen(this.#t,"keydown",p=>{if(p.key==="Enter"||p.key===" "){let f=p.target.closest(".gc-bar, .gc-milestone");f&&(p.preventDefault(),f.click())}})}#c(){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 a=this.#d();for(let{position:r,text:i}of a){let o=document.createElement("span");o.className="gc-date-label",o.style.left=`${r}%`,o.textContent=i,s.appendChild(o)}return t.appendChild(s),t}#d(){let t=this.getAttribute("view")||"auto",e=t==="auto"?Dt(this.#i):t,s=Pt(this.#i),a=[],r;switch(e){case"day":r=$;break;case"week":r=it;break;case"month":r=H;break;case"quarter":r=Rt;break;default:r=H}let i=new Date(this.#r);if(e==="week"){let c=i.getDay(),l=c===0?1:c===1?0:8-c;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 c=i.getMonth(),l=Math.ceil((c+1)/3)*3;i.setMonth(l),i.setDate(1)}let o=i.getTime();o>this.#r+r*.5&&a.push({position:0,text:s(new Date(this.#r))});let n=o;for(;n<=this.#o;){let c=(n-this.#r)/this.#i*100;if(c>=0&&c<=100&&a.push({position:c,text:s(new Date(n))}),e==="month"){let l=new Date(n);l.setMonth(l.getMonth()+1),n=l.getTime()}else if(e==="quarter"){let l=new Date(n);l.setMonth(l.getMonth()+3),n=l.getTime()}else n+=r}return a}#m(){let t=document.createElement("div");t.className="gc-grid-lines";let e=this.#d();for(let{position:s}of e){if(s<=0)continue;let a=document.createElement("div");a.className="gc-grid-line",a.style.left=`${s}%`,t.appendChild(a)}return t}#f(){let t=new Map;for(let e of this.#a){let s=e.group||"";t.has(s)||t.set(s,[]),t.get(s).push(e)}return t}#C(t,e){let s=(t.start-this.#r)/this.#i*100,a=(t.end-t.start)/this.#i*100,r=document.createElement("div");if(r.className="gc-bar",r.setAttribute("data-task-id",t.id),r.setAttribute("role","img"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label",`${xt(t.name)}: ${new Date(t.start).toLocaleDateString()} to ${new Date(t.end).toLocaleDateString()}`+(t.progress>0?`, ${Math.round(t.progress*100)}% complete`:"")),r.style.left=`${s}%`,r.style.width=`${Math.max(a,.5)}%`,t.status&&r.setAttribute("data-status",t.status),t.color&&r.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)}%`,r.appendChild(i)}if(a>8){let i=document.createElement("span");i.className="gc-bar-label",i.textContent=t.name,r.appendChild(i)}return r}#k(t){let e=(t.start-this.#r)/this.#i*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: ${xt(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}#b(){let t=Date.now();if(t<this.#r||t>this.#o)return null;let e=(t-this.#r)/this.#i*100,s=document.createElement("div");s.className="gc-today-line",s.style.left=`${e}%`;let a=document.createElement("span");return a.className="gc-today-label",a.textContent="Today",s.appendChild(a),s}#E(t){if(!this.#a.some(n=>n.depends.length>0))return null;let s="http://www.w3.org/2000/svg",a=document.createElementNS(s,"svg");a.setAttribute("class","gc-deps"),a.style.width="100%",a.style.height="100%";let r=document.createElementNS(s,"defs"),i=document.createElementNS(s,"marker");i.setAttribute("id","gc-arrowhead"),i.setAttribute("markerWidth","8"),i.setAttribute("markerHeight","6"),i.setAttribute("refX","8"),i.setAttribute("refY","3"),i.setAttribute("orient","auto");let o=document.createElementNS(s,"polygon");o.setAttribute("points","0 0, 8 3, 0 6"),o.setAttribute("fill","var(--color-text-muted, #666666)"),i.appendChild(o),r.appendChild(i),a.appendChild(r);for(let n of this.#a)for(let c of n.depends){let l=this.#a.find(Ct=>Ct.id===c);if(!l)continue;let h=(l.end-this.#r)/this.#i*100,p=(n.start-this.#r)/this.#i*100,f=this.#g(l.id,t),g=this.#g(n.id,t);if(f===-1||g===-1)continue;let m=36,b=f*m+m/2,y=g*m+m/2,w=document.createElementNS(s,"path"),ut=h+(p-h)/2;w.setAttribute("d",`M ${h}% ${b} C ${ut}% ${b}, ${ut}% ${y}, ${p}% ${y}`),w.setAttribute("class","gc-dep-line"),a.appendChild(w)}return a}#g(t,e){let s=e.querySelectorAll(".gc-bar-row");for(let a=0;a<s.length;a++){let r=s[a].querySelector("[data-task-id]");if(r&&r.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 s=await e.json();for(;this.firstChild;)this.firstChild.remove();let a=document.createElement("table"),r=document.createElement("thead"),i=document.createElement("tr");for(let n of["Task","Start","End","Progress"]){let c=document.createElement("th");c.textContent=n,i.appendChild(c)}r.appendChild(i),a.appendChild(r);let o=document.createElement("tbody");for(let n of s.tasks||[]){let c=document.createElement("tr");n.id&&(c.dataset.taskId=n.id),n.group&&(c.dataset.group=n.group),n.depends&&(c.dataset.depends=Array.isArray(n.depends)?n.depends.join(","):n.depends),n.status&&(c.dataset.status=n.status),n.assignee&&(c.dataset.assignee=n.assignee),n.milestone&&c.setAttribute("data-milestone",""),n.color&&(c.dataset.color=n.color),n.storyIds&&(c.dataset.storyIds=Array.isArray(n.storyIds)?n.storyIds.join(","):n.storyIds),n.itemIds&&(c.dataset.itemIds=Array.isArray(n.itemIds)?n.itemIds.join(","):n.itemIds);let l=document.createElement("td");l.textContent=n.name||"",c.appendChild(l);let h=document.createElement("td"),p=document.createElement("time");p.setAttribute("datetime",n.start),p.textContent=new Date(n.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),h.appendChild(p),c.appendChild(h);let f=document.createElement("td"),g=document.createElement("time");g.setAttribute("datetime",n.end||n.start),g.textContent=new Date(n.end||n.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),f.appendChild(g),c.appendChild(f);let m=document.createElement("td"),b=document.createElement("progress");b.value=n.progress||0,b.max=100,b.textContent=`${n.progress||0}%`,m.appendChild(b),c.appendChild(m),o.appendChild(c)}a.appendChild(o),this.appendChild(a),s.title&&this.setAttribute("title",s.title),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[gantt-chart] Failed to load src="${t}":`,e)}}#p(t){this.#e&&(this.#e.textContent="",requestAnimationFrame(()=>{this.#e&&(this.#e.textContent=t)}))}};x("gantt-chart",rt);var ot=class d extends A{static get observedAttributes(){return["src","compact","title","searchable"]}static#t=0;#e=null;#s=null;#a=null;#r=null;#o=null;#i="";#l=null;#n=[];#c=[];#d=new Map;#m=new Map;setup(){this.#i=`gloss-${++d.#t}`;let t=this.querySelector(":scope > dl");if(!t)return!1;let e=[...t.querySelectorAll(":scope > div[data-term-id]")];if(e.length===0)return!1;this.#n=e.map(r=>{let i=r.getAttribute("data-term-id")||"",o=r.getAttribute("data-category")||"Uncategorized",n=r.querySelector("dt"),c=r.querySelector("dd"),l=n?n.textContent.trim():"",h=c?c.textContent.trim():"";return r.id=i,{id:i,term:l,definition:h,category:o,el:r}});let s=new Set;this.#c=[];for(let r of this.#n)s.has(r.category)||(s.add(r.category),this.#c.push(r.category));t.remove(),this.#f();let a=this.getAttribute("src");if(a){this._loadSrc(a);return}this.dispatchEvent(new CustomEvent("glossary-wc:ready",{bubbles:!0,detail:{termCount:this.#n.length,categories:[...this.#c]}}))}teardown(){this.#l&&clearTimeout(this.#l);let t=this.querySelector(".gloss-title");t&&t.remove(),this.#e?.parentElement&&this.#e.parentElement.remove(),this.#s&&this.#s.remove(),this.#o&&this.#o.remove(),this.#r&&this.#r.remove(),this.#e=null,this.#s=null,this.#a=null,this.#r=null,this.#o=null,this.#n=[],this.#c=[],this.#d=new Map,this.#m=new Map}#f(){let t=this.getAttribute("title");if(t){let e=document.createElement("h2");e.className="gloss-title",e.textContent=t,this.#a=document.createElement("output"),this.#a.className="gloss-count",this.#a.textContent=String(this.#n.length),e.appendChild(this.#a),this.appendChild(e)}if(this.hasAttribute("searchable")){let e=document.createElement("div");e.className="gloss-search";let s=document.createElement("input");s.type="search",s.className="gloss-search-input",s.setAttribute("placeholder","Search terms\u2026"),s.setAttribute("aria-label","Search glossary terms"),e.appendChild(s),this.appendChild(e),this.#e=s,this.listen(s,"input",this.#b)}this.#C(),this.#o=document.createElement("div"),this.#o.className="gloss-categories",this.#o.setAttribute("role","region"),this.#o.setAttribute("aria-label","Glossary terms"),this.appendChild(this.#o);for(let e of this.#c){let s=this.#n.filter(a=>a.category===e);this.#k(e,s)}this.#r=document.createElement("div"),this.#r.className="gloss-live-region",this.#r.setAttribute("role","status"),this.#r.setAttribute("aria-live","polite"),this.#r.setAttribute("aria-atomic","true"),this.appendChild(this.#r)}#C(){this.#s=document.createElement("nav"),this.#s.className="gloss-jump-bar",this.#s.setAttribute("aria-label","Alphabet navigation");let t=new Set;for(let e of this.#n){let s=e.term.charAt(0).toUpperCase();/[A-Z]/.test(s)&&t.add(s)}for(let e=65;e<=90;e++){let s=String.fromCharCode(e),a=document.createElement("a");a.textContent=s,a.className="gloss-jump-letter",t.has(s)?(a.href=`#${this.#i}-letter-${s}`,a.setAttribute("data-active","")):(a.setAttribute("aria-disabled","true"),a.setAttribute("tabindex","-1")),this.#s.appendChild(a)}this.appendChild(this.#s)}#k(t,e){let s=document.createElement("section");s.className="gloss-category",s.setAttribute("data-category",t);let a=document.createElement("header");a.className="gloss-category-header";let r=document.createElement("button");r.type="button",r.className="gloss-category-toggle",r.setAttribute("aria-expanded","true"),r.innerHTML=`<span class="gloss-category-label">${u(t)}</span><output class="gloss-category-count">${e.length}</output><span class="gloss-chevron" aria-hidden="true"></span>`,a.appendChild(r),s.appendChild(a),this.#d.set(t,r);let i=document.createElement("dl");i.className="gloss-term-list";let o=[...e].sort((l,h)=>l.term.localeCompare(h.term)),n=[],c="";for(let l of o){let h=l.term.charAt(0).toUpperCase();if(/[A-Z]/.test(h)&&h!==c){c=h;let p=document.createElement("span");p.id=`${this.#i}-letter-${h}`,p.className="gloss-letter-anchor",i.appendChild(p)}l.el.className="gloss-term",l.el.id=l.id,i.appendChild(l.el),n.push(l.el)}this.#m.set(t,n),s.appendChild(i),this.#o.appendChild(s),this.listen(r,"click",()=>{let l=r.getAttribute("aria-expanded")==="true";r.setAttribute("aria-expanded",String(!l)),i.hidden=l})}#b=t=>{this.#l&&clearTimeout(this.#l),this.#l=setTimeout(()=>{let e=t.target.value.toLowerCase().trim();this.#E(e)},150)};#E(t){let e=0;for(let s of this.#n)t===""||s.term.toLowerCase().includes(t)||s.definition.toLowerCase().includes(t)?(s.el.removeAttribute("hidden"),e++):s.el.setAttribute("hidden","");for(let s of this.#c){let a=this.#m.get(s)||[],r=a[0]?.closest(".gloss-category");if(!r)continue;if(a.some(o=>!o.hasAttribute("hidden"))){r.removeAttribute("hidden");let o=a.filter(c=>!c.hasAttribute("hidden")).length,n=r.querySelector(".gloss-category-count");n&&(n.textContent=String(o))}else r.setAttribute("hidden","")}this.#a&&(this.#a.textContent=t===""?String(this.#n.length):`${e} / ${this.#n.length}`),t!==""&&this.#r&&(this.#r.textContent="",requestAnimationFrame(()=>{this.#r&&(this.#r.textContent=`${e} term${e!==1?"s":""} found`)})),this.dispatchEvent(new CustomEvent("glossary-wc:search",{bubbles:!0,detail:{query:t,matchCount:e}}))}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();let a=document.createElement("dl");for(let r of s.terms||[]){let i=document.createElement("div");i.setAttribute("data-term-id",r.id||""),i.setAttribute("data-category",r.category||"Uncategorized");let o=document.createElement("dt");o.textContent=r.term||"";let n=document.createElement("dd"),c=r.definition||"";if(r.seeAlso&&r.seeAlso.length>0){let l=r.seeAlso.map(h=>`<a href="#${u(h)}">${u(this.#g(h))}</a>`).join(", ");c+=` See also: ${l}.`}n.innerHTML=c,i.appendChild(o),i.appendChild(n),a.appendChild(i)}this.appendChild(a),s.title&&!this.getAttribute("title")&&this.setAttribute("title",s.title),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[glossary-wc] Failed to load src="${t}":`,e)}}#g(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};x("glossary-wc",ot);var I=`
|
|
2313
|
+
</div>`}_bindListeners(t){let e=this.shadowRoot;if(!e)return;e.querySelectorAll(".rs-pin").forEach(i=>{i.addEventListener("click",a=>{a.stopPropagation();let o=i.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(n=>n.id===o)}}))})});let s=e.querySelector(".rs-overlay");s&&t&&s.addEventListener("click",i=>{if(!this._annotating)return;let a=i;if(a.target?.closest(".rs-pin"))return;let n=s.getBoundingClientRect(),d=(a.clientX-n.left)/n.width*100,l=(a.clientY-n.top)/n.height*100;this.#r(d,l)}),e.querySelectorAll("[data-action]").forEach(i=>{i.addEventListener("click",a=>{a.stopPropagation();let o=i.dataset.action,n=i.dataset.pinId;switch(o){case"close":this._activePin=null,this._render();break;case"resolve":n&&this.resolvePin(n);break;case"unresolve":n&&this.unresolvePin(n);break;case"delete":n&&this.removePin(n);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.#o(n);break}})});let r=e.querySelector(".rs-input__field");r&&r.addEventListener("keydown",i=>{let a=i;if(a.key==="Enter"&&!a.shiftKey){a.preventDefault();let n=e.querySelector('[data-action="reply"]')?.dataset.pinId;n&&this.#o(n)}}),e.addEventListener("keydown",i=>{i.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#o(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(a=>a.id===t);if(!r)return;let i={id:crypto.randomUUID(),text:s,author:this.getAttribute("author")||"Anonymous",createdAt:new Date().toISOString()};r.replies||(r.replies=[]),r.text?(r.replies.push(i),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.#l("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 At(t,{announceMessage:"Pins copied to clipboard"}))return;let s=new Blob([t],{type:"application/json"}),r=URL.createObjectURL(s),i=document.createElement("a");i.href=r,i.download="review-pins.json",i.click(),URL.revokeObjectURL(r),this.#l("Pins exported as file")}#n(t){if(!t)return"";try{let e=new Date(t),r=new Date().getTime()-e.getTime(),i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;let a=Math.floor(i/60);if(a<24)return`${a}h ago`;let o=Math.floor(a/24);return o<7?`${o}d ago`:e.toLocaleDateString()}catch{return""}}#l(t){let e=this.shadowRoot?.querySelector(".rs-live");e&&(e.textContent=t)}};x("review-surface",Ct);var P=864e5,Et=P*7,Z=P*30,ve=P*91,Vt=P*365;function B(c){return typeof c=="number"?c:new Date(c).getTime()}function ye(c){return c<=Et*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):c<=Z*3?t=>t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):c<=Vt?t=>t.toLocaleDateString(void 0,{month:"short",year:"2-digit"}):t=>t.toLocaleDateString(void 0,{year:"numeric"})}function xe(c){return c<=Et*3?"day":c<=Z*3?"week":c<=Vt?"month":"quarter"}function Ut(c){return String(c).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var kt=class c extends C{static get observedAttributes(){return["src","title","view","show-today","show-progress","show-dependencies","compact"]}#e=null;#s=null;#t=null;#i=[];#r=0;#o=0;#a=0;setup(){let t=this.querySelector(":scope > table");return!t||(this.#i=this.#c(t),this.#i.length===0)?!1:(this.#r=Math.min(...this.#i.map(e=>e.start)),this.#o=Math.max(...this.#i.map(e=>e.end)),this.#a=this.#o-this.#r,this.#a<=0&&(this.#a=P),this.#p(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.#o).toISOString()}}})),!0)}teardown(){this.#t&&(this.#t.remove(),this.#t=null),this.#e&&(this.#e.remove(),this.#e=null),this.#s&&(this.#s.remove(),this.#s=null);let t=this.querySelector("table.gc-sr-only");t&&t.classList.remove("gc-sr-only"),this.#i=[]}static#n=0;attributeChangedCallback(t,e,s){e===s||!this.isConnected||(t==="src"?this._loadSrc(s):this.hasAttribute("data-upgraded")&&this.#l())}#l(){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-${++c.#n}`;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:B(s.start),end:typeof s.end=="number"?s.end:s.end!=null?B(s.end):typeof s.start=="number"?s.start:B(s.start),progress:s.progress??0,group:s.group??null,depends:Array.isArray(s.depends)?s.depends:s.depends?String(s.depends).split(",").map(i=>i.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.#t||this.#s)&&(this.#t&&(this.#t.remove(),this.#t=null),this.#e&&(this.#e.remove(),this.#e=null),this.#s&&(this.#s.remove(),this.#s=null)),this.#i=e,e.length>0){this.#r=Math.min(...e.map(r=>r.start)),this.#o=Math.max(...e.map(r=>r.end)),this.#a=this.#o-this.#r,this.#a<=0&&(this.#a=P);let s=this.querySelector(":scope > table");s||(s=document.createElement("table"),s.classList.add("gc-sr-only"),this.appendChild(s)),this.#p(s)}this.dispatchEvent(new CustomEvent("gantt-chart:tasks-changed",{detail:{tasks:e,source:"property"},bubbles:!0}))}#c(t){let e=t.querySelectorAll("tbody tr"),s=[];for(let r=0;r<e.length;r++){let i=e[r],a=i.querySelectorAll("time[datetime]");if(a.length<2&&!i.hasAttribute("data-milestone"))continue;let o=a[0]?.getAttribute("datetime"),n=a.length>1?a[1].getAttribute("datetime"):o;if(!o)continue;let d=i.querySelector("progress"),l=d?d.value/(d.max||100):0,u=i.cells[0]?.textContent?.trim()||`Task ${r+1}`;s.push({id:i.dataset.taskId||`gc-task-${r}`,name:u,start:B(o),end:B(n),progress:l,group:i.dataset.group||null,depends:i.dataset.depends?i.dataset.depends.split(",").map(h=>h.trim()):[],status:i.dataset.status||null,assignee:i.dataset.assignee||null,milestone:i.hasAttribute("data-milestone"),color:i.dataset.color||null,storyIds:i.dataset.storyIds?i.dataset.storyIds.split(",").map(h=>h.trim()):[],itemIds:i.dataset.itemIds?i.dataset.itemIds.split(",").map(h=>h.trim()):[]})}return s}#p(t){let e=this.getAttribute("title"),s=this.hasAttribute("show-today"),r=this.hasAttribute("show-progress"),i=this.hasAttribute("show-dependencies");e&&(this.#t=document.createElement("h2"),this.#t.className="gc-title",this.#t.textContent=e,this.insertBefore(this.#t,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 a=this.#d();this.#e.appendChild(a);let o=document.createElement("div");o.className="gc-body";let n=document.createElement("div");n.className="gc-task-list";let d=document.createElement("div");d.className="gc-bars";let l=this.#m();d.appendChild(l);let u=this.#y();for(let[h,m]of u){if(u.size>1&&h){let f=document.createElement("div");f.className="gc-group-header";let p=document.createElement("span");p.className="gc-group-label",p.textContent=h,f.appendChild(p),n.appendChild(f);let b=document.createElement("div");b.className="gc-group-spacer",d.appendChild(b)}for(let f of m){let p=document.createElement("div");p.className="gc-task-row",p.setAttribute("data-task-id",f.id);let b=document.createElement("span");b.className="gc-task-name",b.textContent=f.name,p.appendChild(b);let y=document.createElement("span");y.className="gc-task-dates",y.textContent=`${new Date(f.start).toLocaleDateString()} to ${new Date(f.end).toLocaleDateString()}`,p.appendChild(y),n.appendChild(p);let _=document.createElement("div");_.className="gc-bar-row",f.milestone?_.appendChild(this.#v(f)):_.appendChild(this.#h(f,r)),d.appendChild(_)}}if(s){let h=this.#x();h&&d.appendChild(h)}i&&requestAnimationFrame(()=>{let h=this.#f(d);h&&d.appendChild(h)}),o.appendChild(n),o.appendChild(d),this.#e.appendChild(o),this.insertBefore(this.#e,t),t.classList.add("gc-sr-only"),this.#s=document.createElement("div"),this.#s.className="gc-sr-only",this.#s.setAttribute("role","status"),this.#s.setAttribute("aria-live","polite"),this.#s.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.listen(this.#e,"click",h=>{let m=h.target.closest(".gc-bar, .gc-milestone");if(!m)return;let f=m.dataset.taskId,p=this.#i.find(b=>b.id===f);p&&(this.#b(`Selected: ${p.name}`),this.dispatchEvent(new CustomEvent("gantt-chart:task-click",{bubbles:!0,detail:{task:p}})))}),this.listen(this.#e,"keydown",h=>{let m=h;if(m.key==="Enter"||m.key===" "){let f=m.target.closest(".gc-bar, .gc-milestone");f&&(m.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 s=document.createElement("div");s.className="gc-timeline-dates";let r=this.#u();for(let{position:i,text:a}of r){let o=document.createElement("span");o.className="gc-date-label",o.style.left=`${i}%`,o.textContent=a,s.appendChild(o)}return t.appendChild(s),t}#u(){let t=this.getAttribute("view")||"auto",e=t==="auto"?xe(this.#a):t,s=ye(this.#a),r=[],i;switch(e){case"day":i=P;break;case"week":i=Et;break;case"month":i=Z;break;case"quarter":i=ve;break;default:i=Z}let a=new Date(this.#r);if(e==="week"){let d=a.getDay(),l=d===0?1:d===1?0:8-d;a.setDate(a.getDate()+l)}else if(e==="month")a.setDate(1),a.getTime()<this.#r&&a.setMonth(a.getMonth()+1);else if(e==="quarter"){let d=a.getMonth(),l=Math.ceil((d+1)/3)*3;a.setMonth(l),a.setDate(1)}let o=a.getTime();o>this.#r+i*.5&&r.push({position:0,text:s(new Date(this.#r))});let n=o;for(;n<=this.#o;){let d=(n-this.#r)/this.#a*100;if(d>=0&&d<=100&&r.push({position:d,text:s(new Date(n))}),e==="month"){let l=new Date(n);l.setMonth(l.getMonth()+1),n=l.getTime()}else if(e==="quarter"){let l=new Date(n);l.setMonth(l.getMonth()+3),n=l.getTime()}else n+=i}return r}#m(){let t=document.createElement("div");t.className="gc-grid-lines";let e=this.#u();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}#y(){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}#h(t,e){let s=(t.start-this.#r)/this.#a*100,r=(t.end-t.start)/this.#a*100,i=document.createElement("div");if(i.className="gc-bar",i.setAttribute("data-task-id",t.id),i.setAttribute("role","img"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",`${Ut(t.name)}: ${new Date(t.start).toLocaleDateString()} to ${new Date(t.end).toLocaleDateString()}`+(t.progress>0?`, ${Math.round(t.progress*100)}% complete`:"")),i.style.left=`${s}%`,i.style.width=`${Math.max(r,.5)}%`,t.status&&i.setAttribute("data-status",t.status),t.color&&i.style.setProperty("--gc-bar-color",t.color),e&&t.progress>0){let a=document.createElement("div");a.className="gc-bar-fill",a.style.width=`${Math.round(t.progress*100)}%`,i.appendChild(a)}if(r>8){let a=document.createElement("span");a.className="gc-bar-label",a.textContent=t.name,i.appendChild(a)}return i}#v(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: ${Ut(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}#x(){let t=Date.now();if(t<this.#r||t>this.#o)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}#f(t){if(!this.#i.some(n=>n.depends.length>0))return null;let s="http://www.w3.org/2000/svg",r=document.createElementNS(s,"svg");r.setAttribute("class","gc-deps"),r.style.width="100%",r.style.height="100%";let i=document.createElementNS(s,"defs"),a=document.createElementNS(s,"marker");a.setAttribute("id","gc-arrowhead"),a.setAttribute("markerWidth","8"),a.setAttribute("markerHeight","6"),a.setAttribute("refX","8"),a.setAttribute("refY","3"),a.setAttribute("orient","auto");let o=document.createElementNS(s,"polygon");o.setAttribute("points","0 0, 8 3, 0 6"),o.setAttribute("fill","var(--color-text-muted, #666666)"),a.appendChild(o),i.appendChild(a),r.appendChild(i);for(let n of this.#i)for(let d of n.depends){let l=this.#i.find(w=>w.id===d);if(!l)continue;let u=(l.end-this.#r)/this.#a*100,h=(n.start-this.#r)/this.#a*100,m=this.#g(l.id,t),f=this.#g(n.id,t);if(m===-1||f===-1)continue;let p=36,b=m*p+p/2,y=f*p+p/2,_=document.createElementNS(s,"path"),v=u+(h-u)/2;_.setAttribute("d",`M ${u}% ${b} C ${v}% ${b}, ${v}% ${y}, ${h}% ${y}`),_.setAttribute("class","gc-dep-line"),r.appendChild(_)}return r}#g(t,e){let s=e.querySelectorAll(".gc-bar-row");for(let r=0;r<s.length;r++){let i=s[r].querySelector("[data-task-id]");if(i&&i.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"),i=document.createElement("thead"),a=document.createElement("tr");for(let n of["Task","Start","End","Progress"]){let d=document.createElement("th");d.textContent=n,a.appendChild(d)}i.appendChild(a),r.appendChild(i);let o=document.createElement("tbody");for(let n of s.tasks||[]){let d=document.createElement("tr");n.id&&(d.dataset.taskId=n.id),n.group&&(d.dataset.group=n.group),n.depends&&(d.dataset.depends=Array.isArray(n.depends)?n.depends.join(","):n.depends),n.status&&(d.dataset.status=n.status),n.assignee&&(d.dataset.assignee=n.assignee),n.milestone&&d.setAttribute("data-milestone",""),n.color&&(d.dataset.color=n.color),n.storyIds&&(d.dataset.storyIds=Array.isArray(n.storyIds)?n.storyIds.join(","):n.storyIds),n.itemIds&&(d.dataset.itemIds=Array.isArray(n.itemIds)?n.itemIds.join(","):n.itemIds);let l=document.createElement("td");l.textContent=n.name||"",d.appendChild(l);let u=document.createElement("td"),h=document.createElement("time");h.setAttribute("datetime",n.start),h.textContent=new Date(n.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(h),d.appendChild(u);let m=document.createElement("td"),f=document.createElement("time");f.setAttribute("datetime",n.end||n.start),f.textContent=new Date(n.end||n.start).toLocaleDateString(void 0,{month:"short",day:"numeric"}),m.appendChild(f),d.appendChild(m);let p=document.createElement("td"),b=document.createElement("progress");b.value=n.progress||0,b.max=100,b.textContent=`${n.progress||0}%`,p.appendChild(b),d.appendChild(p),o.appendChild(d)}r.appendChild(o),this.appendChild(r),s.title&&this.setAttribute("title",s.title),this.#l()}catch(e){console.warn(`[gantt-chart] Failed to load src="${t}":`,e)}}#b(t){this.#s&&(this.#s.textContent="",requestAnimationFrame(()=>{this.#s&&(this.#s.textContent=t)}))}};x("gantt-chart",kt);var St=class c extends C{static get observedAttributes(){return["src","compact","title","searchable"]}static#e=0;#s=null;#t=null;#i=null;#r=null;#o=null;#a="";#n=null;#l=[];#c=[];#p=new Map;#d=new Map;setup(){this.#a=`gloss-${++c.#e}`;let t=this.querySelector(":scope > dl");if(!t)return!1;let e=[...t.querySelectorAll(":scope > div[data-term-id]")];if(e.length===0)return!1;this.#l=e.map(i=>{let a=i.getAttribute("data-term-id")||"",o=i.getAttribute("data-category")||"Uncategorized",n=i.querySelector("dt"),d=i.querySelector("dd"),l=n?n.textContent.trim():"",u=d?d.textContent.trim():"";return i.id=a,{id:a,term:l,definition:u,category:o,el:i}});let s=new Set;this.#c=[];for(let i of this.#l)s.has(i.category)||(s.add(i.category),this.#c.push(i.category));t.remove(),this.#u();let r=this.getAttribute("src");if(r){this._loadSrc(r);return}return this.dispatchEvent(new CustomEvent("glossary-wc:ready",{bubbles:!0,detail:{termCount:this.#l.length,categories:[...this.#c]}})),!0}get terms(){return this.#l.map(t=>({id:t.id,term:t.term,definition:t.definition,category:t.category}))}set terms(t){let e=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();let s=document.createElement("dl");for(let r of e){let i=document.createElement("div");i.setAttribute("data-term-id",r.id||""),r.category&&i.setAttribute("data-category",r.category);let a=document.createElement("dt");a.textContent=r.term||"";let o=document.createElement("dd");o.textContent=r.definition||"",i.appendChild(a),i.appendChild(o),s.appendChild(i)}this.appendChild(s),this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("glossary-wc:terms-changed",{detail:{terms:e,source:"property"},bubbles:!0}))}teardown(){this.#n&&clearTimeout(this.#n);let t=this.querySelector(".gloss-title");t&&t.remove(),this.#s?.parentElement&&this.#s.parentElement.remove(),this.#t&&this.#t.remove(),this.#o&&this.#o.remove(),this.#r&&this.#r.remove(),this.#s=null,this.#t=null,this.#i=null,this.#r=null,this.#o=null,this.#l=[],this.#c=[],this.#p=new Map,this.#d=new Map}#u(){let t=this.getAttribute("title");if(t){let e=document.createElement("h2");e.className="gloss-title",e.textContent=t,this.#i=document.createElement("output"),this.#i.className="gloss-count",this.#i.textContent=String(this.#l.length),e.appendChild(this.#i),this.appendChild(e)}if(this.hasAttribute("searchable")){let e=document.createElement("div");e.className="gloss-search";let s=document.createElement("input");s.type="search",s.className="gloss-search-input",s.setAttribute("placeholder","Search terms\u2026"),s.setAttribute("aria-label","Search glossary terms"),e.appendChild(s),this.appendChild(e),this.#s=s,this.listen(s,"input",this.#h)}this.#m(),this.#o=document.createElement("div"),this.#o.className="gloss-categories",this.#o.setAttribute("role","region"),this.#o.setAttribute("aria-label","Glossary terms"),this.appendChild(this.#o);for(let e of this.#c){let s=this.#l.filter(r=>r.category===e);this.#y(e,s)}this.#r=document.createElement("div"),this.#r.className="gloss-live-region",this.#r.setAttribute("role","status"),this.#r.setAttribute("aria-live","polite"),this.#r.setAttribute("aria-atomic","true"),this.appendChild(this.#r)}#m(){this.#t=document.createElement("nav"),this.#t.className="gloss-jump-bar",this.#t.setAttribute("aria-label","Alphabet navigation");let t=new Set;for(let e of this.#l){let s=e.term.charAt(0).toUpperCase();/[A-Z]/.test(s)&&t.add(s)}for(let e=65;e<=90;e++){let s=String.fromCharCode(e),r=document.createElement("a");r.textContent=s,r.className="gloss-jump-letter",t.has(s)?(r.href=`#${this.#a}-letter-${s}`,r.setAttribute("data-active","")):(r.setAttribute("aria-disabled","true"),r.setAttribute("tabindex","-1")),this.#t.appendChild(r)}this.appendChild(this.#t)}#y(t,e){let s=document.createElement("section");s.className="gloss-category",s.setAttribute("data-category",t);let r=document.createElement("header");r.className="gloss-category-header";let i=document.createElement("button");i.type="button",i.className="gloss-category-toggle",i.setAttribute("aria-expanded","true"),i.innerHTML=`<span class="gloss-category-label">${g(t)}</span><output class="gloss-category-count">${e.length}</output><span class="gloss-chevron" aria-hidden="true"></span>`,r.appendChild(i),s.appendChild(r),this.#p.set(t,i);let a=document.createElement("dl");a.className="gloss-term-list";let o=[...e].sort((l,u)=>l.term.localeCompare(u.term)),n=[],d="";for(let l of o){let u=l.term.charAt(0).toUpperCase();if(/[A-Z]/.test(u)&&u!==d){d=u;let h=document.createElement("span");h.id=`${this.#a}-letter-${u}`,h.className="gloss-letter-anchor",a.appendChild(h)}l.el.className="gloss-term",l.el.id=l.id,a.appendChild(l.el),n.push(l.el)}this.#d.set(t,n),s.appendChild(a),this.#o?.appendChild(s),this.listen(i,"click",()=>{let l=i.getAttribute("aria-expanded")==="true";i.setAttribute("aria-expanded",String(!l)),a.hidden=l})}#h=t=>{this.#n&&clearTimeout(this.#n),this.#n=setTimeout(()=>{let e=t.target.value.toLowerCase().trim();this.#v(e)},150)};#v(t){let e=0;for(let s of this.#l)t===""||s.term.toLowerCase().includes(t)||s.definition.toLowerCase().includes(t)?(s.el.removeAttribute("hidden"),e++):s.el.setAttribute("hidden","");for(let s of this.#c){let r=this.#d.get(s)||[],i=r[0]?.closest(".gloss-category");if(!i)continue;if(r.some(o=>!o.hasAttribute("hidden"))){i.removeAttribute("hidden");let o=r.filter(d=>!d.hasAttribute("hidden")).length,n=i.querySelector(".gloss-category-count");n&&(n.textContent=String(o))}else i.setAttribute("hidden","")}this.#i&&(this.#i.textContent=t===""?String(this.#l.length):`${e} / ${this.#l.length}`),t!==""&&this.#r&&(this.#r.textContent="",requestAnimationFrame(()=>{this.#r&&(this.#r.textContent=`${e} term${e!==1?"s":""} found`)})),this.dispatchEvent(new CustomEvent("glossary-wc:search",{bubbles:!0,detail:{query:t,matchCount:e}}))}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();let r=document.createElement("dl");for(let i of s.terms||[]){let a=document.createElement("div");a.setAttribute("data-term-id",i.id||""),a.setAttribute("data-category",i.category||"Uncategorized");let o=document.createElement("dt");o.textContent=i.term||"";let n=document.createElement("dd"),d=i.definition||"";if(i.seeAlso&&i.seeAlso.length>0){let l=i.seeAlso.map(u=>`<a href="#${g(u)}">${g(this.#x(u))}</a>`).join(", ");d+=` See also: ${l}.`}n.innerHTML=d,a.appendChild(o),a.appendChild(n),r.appendChild(a)}this.appendChild(r),s.title&&!this.getAttribute("title")&&this.setAttribute("title",s.title),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[glossary-wc] Failed to load src="${t}":`,e)}}#x(t){return t.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}};x("glossary-wc",St);var O=`
|
|
2240
2314
|
:host {
|
|
2241
2315
|
--_bg: var(--work-item-bg, var(--color-surface, #ffffff));
|
|
2242
2316
|
--_text: var(--work-item-text, var(--color-text, #1a1a1a));
|
|
@@ -2326,12 +2400,13 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2326
2400
|
height: 12px;
|
|
2327
2401
|
}
|
|
2328
2402
|
|
|
2329
|
-
/* Type colors
|
|
2330
|
-
|
|
2331
|
-
.wi-type[data-type="
|
|
2332
|
-
.wi-type[data-type="
|
|
2333
|
-
.wi-type[data-type="
|
|
2334
|
-
.wi-type[data-type="
|
|
2403
|
+
/* Type colors \u2014 driven by VB theme tokens, with color-mix surfaces so the
|
|
2404
|
+
pill background shifts with the active theme. */
|
|
2405
|
+
.wi-type[data-type="task"] { color: var(--color-info, #3b82f6); background: color-mix(in oklch, var(--color-info, #3b82f6) 12%, transparent); }
|
|
2406
|
+
.wi-type[data-type="bug"] { color: var(--color-error, #dc2626); background: color-mix(in oklch, var(--color-error, #dc2626) 12%, transparent); }
|
|
2407
|
+
.wi-type[data-type="chore"] { color: var(--color-text-muted, #6b7280); background: color-mix(in oklch, var(--color-text-muted, #6b7280) 12%, transparent); }
|
|
2408
|
+
.wi-type[data-type="spike"] { color: var(--color-accent, #8b5cf6); background: color-mix(in oklch, var(--color-accent, #8b5cf6) 12%, transparent); }
|
|
2409
|
+
.wi-type[data-type="feature"] { color: var(--color-success, #059669); background: color-mix(in oklch, var(--color-success, #059669) 12%, transparent); }
|
|
2335
2410
|
|
|
2336
2411
|
/* \u2500\u2500 Badges \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\u2500\u2500\u2500 */
|
|
2337
2412
|
.wi-badges {
|
|
@@ -2414,7 +2489,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2414
2489
|
display: flex;
|
|
2415
2490
|
align-items: center;
|
|
2416
2491
|
justify-content: center;
|
|
2417
|
-
color: #fff;
|
|
2492
|
+
color: var(--color-text-inverted, #fff);
|
|
2418
2493
|
flex-shrink: 0;
|
|
2419
2494
|
}
|
|
2420
2495
|
|
|
@@ -2481,12 +2556,12 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2481
2556
|
.wi-section-icon svg {
|
|
2482
2557
|
width: 13px;
|
|
2483
2558
|
height: 13px;
|
|
2484
|
-
fill:
|
|
2559
|
+
fill: var(--color-text-inverted, #fff);
|
|
2485
2560
|
}
|
|
2486
2561
|
|
|
2487
|
-
.wi-section-icon.description { background: #3b82f6; }
|
|
2488
|
-
.wi-section-icon.checklist { background: #22c55e; }
|
|
2489
|
-
.wi-section-icon.notes { background: #f59e0b; }
|
|
2562
|
+
.wi-section-icon.description { background: var(--color-info, #3b82f6); }
|
|
2563
|
+
.wi-section-icon.checklist { background: var(--color-success, #22c55e); }
|
|
2564
|
+
.wi-section-icon.notes { background: var(--color-warning, #f59e0b); }
|
|
2490
2565
|
|
|
2491
2566
|
.wi-section-title {
|
|
2492
2567
|
font-size: var(--_font-xs);
|
|
@@ -2597,31 +2672,31 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2597
2672
|
}
|
|
2598
2673
|
|
|
2599
2674
|
.state-msg { padding: var(--_space-m); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
2600
|
-
.state-msg--error { color: #dc2626; }
|
|
2601
|
-
`;var
|
|
2602
|
-
<article class="wi-card wi-card--minimal" role="article" aria-label="${
|
|
2675
|
+
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
2676
|
+
`;var Wt={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"/>'},$t={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)"}},qt={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)"}},Tt=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"})}#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)||""}connectedCallback(){this.#s(),this.itemId&&!this.id&&(this.id=this.itemId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#t(),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.#t())}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){qt[t]&&(this.setAttribute("status",t),this.dispatchEvent(new CustomEvent("work-item:status",{detail:{status:t,itemId:this.itemId},bubbles:!0,composed:!0})))}updatePriority(t){$t[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.#t(),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 i=document.createElement("li");i.textContent=String(r),e.appendChild(i)}this.appendChild(e)}}async _loadSrc(t){if(!t)return;let e=this.shadowRoot;e.innerHTML=`<style>${O}</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()}catch(s){e.innerHTML=`<style>${O}</style><div class="state-msg state-msg--error">Could not load: ${g(s.message)}</div>`}}#t(){let t=this.shadowRoot,e=$t[this.priority]||$t.medium,s=qt[this.status]||qt.backlog,r=this.itemType,i=Wt[r]||Wt.task,a=this._detailLevel,o=this.itemId?`Work item: ${g(this.itemId)}`:"Work item";if(a==="minimal"){t.innerHTML=`<style>${O}</style>
|
|
2677
|
+
<article class="wi-card wi-card--minimal" role="article" aria-label="${o}"
|
|
2603
2678
|
tabindex="0">
|
|
2604
2679
|
<div class="wi-body">
|
|
2605
2680
|
<div class="wi-meta">
|
|
2606
|
-
${this.itemId?`<span class="wi-id">${
|
|
2607
|
-
<span class="wi-type" data-type="${
|
|
2681
|
+
${this.itemId?`<span class="wi-id">${g(this.itemId)}</span>`:""}
|
|
2682
|
+
<span class="wi-type" data-type="${g(r)}">${A(i)} ${g(r)}</span>
|
|
2608
2683
|
</div>
|
|
2609
2684
|
<div class="wi-title-wrap">
|
|
2610
|
-
<slot name="title"><span class="wi-title-fallback">${
|
|
2685
|
+
<slot name="title"><span class="wi-title-fallback">${g(this._minimalLabel)}</span></slot>
|
|
2611
2686
|
</div>
|
|
2612
2687
|
</div>
|
|
2613
|
-
</article>`;return}if(
|
|
2614
|
-
<article class="wi-card wi-card--${
|
|
2688
|
+
</article>`;return}if(t.innerHTML=`<style>${O}</style>
|
|
2689
|
+
<article class="wi-card wi-card--${a}" role="article" aria-label="${o}">
|
|
2615
2690
|
|
|
2616
2691
|
<header class="wi-header">
|
|
2617
2692
|
<div class="wi-meta">
|
|
2618
|
-
${this.itemId?`<span class="wi-id">${
|
|
2619
|
-
<span class="wi-type" data-type="${
|
|
2693
|
+
${this.itemId?`<span class="wi-id">${g(this.itemId)}</span>`:""}
|
|
2694
|
+
<span class="wi-type" data-type="${g(r)}">${A(i)} ${g(r)}</span>
|
|
2620
2695
|
</div>
|
|
2621
2696
|
<div class="wi-badges">
|
|
2622
|
-
<span class="wi-priority" style="color:${
|
|
2623
|
-
<span class="wi-status" style="color:${
|
|
2624
|
-
${this.estimate?`<span class="wi-estimate" title="Estimate">${
|
|
2697
|
+
<span class="wi-priority" style="color:${e.color};background:${e.bg}">${g(e.label)}</span>
|
|
2698
|
+
<span class="wi-status" style="color:${s.color};background:${s.bg}">${g(s.label)}</span>
|
|
2699
|
+
${this.estimate?`<span class="wi-estimate" title="Estimate">${g(this.estimate)}</span>`:""}
|
|
2625
2700
|
</div>
|
|
2626
2701
|
</header>
|
|
2627
2702
|
|
|
@@ -2632,13 +2707,13 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2632
2707
|
|
|
2633
2708
|
${this.assignee?`
|
|
2634
2709
|
<div class="wi-assignee">
|
|
2635
|
-
<span class="wi-assignee__avatar" style="background:${
|
|
2636
|
-
${
|
|
2710
|
+
<span class="wi-assignee__avatar" style="background:${D(this.assignee)}">${z(this.assignee)}</span>
|
|
2711
|
+
${g(this.assignee)}
|
|
2637
2712
|
</div>`:""}
|
|
2638
2713
|
|
|
2639
2714
|
${this.storyIds.length?`
|
|
2640
2715
|
<div class="wi-links">
|
|
2641
|
-
${this.storyIds.map(
|
|
2716
|
+
${this.storyIds.map(n=>`<a class="wi-link" href="#${g(n)}">${A('<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 7h10"/><path d="M7 12h10"/><path d="M7 17h10"/>')} ${g(n)}</a>`).join("")}
|
|
2642
2717
|
</div>`:""}
|
|
2643
2718
|
</div>
|
|
2644
2719
|
|
|
@@ -2680,7 +2755,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2680
2755
|
</div>
|
|
2681
2756
|
</div>
|
|
2682
2757
|
|
|
2683
|
-
</article>`,r==="compact")for(let o of this.shadowRoot.querySelectorAll(".wi-section")){let n=o.querySelector("slot");n&&n.assignedNodes().length===0&&o.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("work-item:ready",{detail:{itemId:this.itemId,title:this.itemTitle,type:s,priority:this.priority,status:this.status},bubbles:!0,composed:!0}))}};x("work-item",ct);var O={layout:{label:"Layout",cssClass:"sm-badge--layout"},section:{label:"Section",cssClass:"sm-badge--section"},dashboard:{label:"Dashboard",cssClass:"sm-badge--dashboard"},page:{label:"Page",cssClass:"sm-badge--page"},modal:{label:"Modal",cssClass:"sm-badge--modal"},redirect:{label:"Redirect",cssClass:"sm-badge--redirect"}},U={draft:{label:"Draft",cssClass:"sm-status--draft"},ready:{label:"Ready",cssClass:"sm-status--ready"},live:{label:"Live",cssClass:"sm-status--live"},deprecated:{label:"Deprecated",cssClass:"sm-status--deprecated"}},dt=class d extends A{static get observedAttributes(){return["src","collapsed","compact","title","data-view","data-orientation","data-detail"]}static#t=0;#e=null;#s=null;#a=null;#r=null;#o=0;#i=0;setup(){d.#t++;let t=this.getAttribute("src");if(t&&!this.querySelector("nav")){this._loadSrc(t);return}let e=this.querySelector(":scope > nav");if(e){if(this.#o=0,this.#i=0,this.#l(e.querySelector("ul"),0),this.dataset.view==="visual"){this.#c(),this.#G(e),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#o,depth:this.#i}}));return}this.#n(e.querySelector("ul"),0),this.#c(),e.classList.add("sm-tree"),e.setAttribute("role","tree"),e.setAttribute("aria-label",this.getAttribute("title")||"Site map"),this.#e=e,this.hasAttribute("collapsed")&&this.#d(),this.listen(e,"keydown",s=>this.#k(s)),this.listen(e,"click",s=>this.#C(s)),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#o,depth:this.#i}}))}}teardown(){if(this.#a){this.#a.remove(),this.#a=null;let t=this.querySelector("nav");t&&(t.style.display="",t.removeAttribute("aria-hidden"))}this.#s&&(this.#s.remove(),this.#s=null),this.#e&&(this.#e.classList.remove("sm-tree"),this.#e.removeAttribute("role"),this.#e.removeAttribute("aria-label")),this.querySelectorAll(".sm-node-content, .sm-toggle").forEach(t=>t.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(t=>{t.removeAttribute("role"),t.removeAttribute("aria-expanded"),t.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(t=>{t.removeAttribute("role"),t.classList.remove("sm-subtree","sm-collapsed")}),this.#e=null,this.#r=null,this.#o=0,this.#i=0}attributeChangedCallback(t,e,s){e===s||!this.isConnected||t==="src"&&this._loadSrc(s)}#l(t,e){if(!t)return;let s=t.querySelectorAll(":scope > li");for(let a of s){this.#o++;let r=e+1;r>this.#i&&(this.#i=r);let i=a.querySelector(":scope > ul");i&&this.#l(i,r)}}#n(t,e){if(!t)return;e>0&&(t.setAttribute("role","group"),t.classList.add("sm-subtree"));let s=[...t.querySelectorAll(":scope > li")];for(let a of s){let r=!!a.querySelector(":scope > ul"),i=a.querySelector(":scope > a"),o=a.getAttribute("data-page-type")||"page",n=a.getAttribute("data-template")||"",c=a.getAttribute("data-status")||"";a.setAttribute("role","treeitem"),a.setAttribute("tabindex","-1");let l=document.createElement("span");if(l.className="sm-node-content",r){a.setAttribute("aria-expanded","true");let p=document.createElement("button");p.className="sm-toggle",p.setAttribute("type","button"),p.setAttribute("aria-hidden","true"),p.setAttribute("tabindex","-1"),p.textContent="\u25BE",l.appendChild(p)}else{let p=document.createElement("span");p.className="sm-leaf-marker",p.setAttribute("aria-hidden","true"),l.appendChild(p)}if(c&&U[c]){let p=document.createElement("span");p.className=`sm-status-dot ${U[c].cssClass}`,p.setAttribute("title",U[c].label),p.setAttribute("aria-label",U[c].label),l.appendChild(p)}if(i&&l.appendChild(i),O[o]){let p=document.createElement("span");p.className=`sm-badge ${O[o].cssClass}`,p.textContent=O[o].label,l.appendChild(p)}if(n){let p=document.createElement("span");p.className="sm-badge sm-badge--template",p.textContent=n,l.appendChild(p)}a.insertBefore(l,a.firstChild);let h=a.querySelector(":scope > ul");h&&this.#n(h,e+1)}}#c(){let t=this.getAttribute("title");if(!t&&this.#o===0)return;if(this.#s=document.createElement("div"),this.#s.className="sm-header",t){let a=document.createElement("h2");a.className="sm-title",a.textContent=t,this.#s.appendChild(a)}let e=document.createElement("span");e.className="sm-summary",e.textContent=`${this.#o} pages \xB7 ${this.#i} levels deep`,this.#s.appendChild(e);let s=document.createElement("button");s.className="sm-toggle-all",s.setAttribute("type","button"),s.textContent="Collapse all",s.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#d(),s.textContent="Expand all"):(this.#m(),s.textContent="Collapse all")}),this.#s.appendChild(s),this.insertBefore(this.#s,this.firstChild)}#d(){let t=this.querySelectorAll("li[aria-expanded]");for(let e of t){e.setAttribute("aria-expanded","false");let s=e.querySelector(":scope > ul");s&&s.classList.add("sm-collapsed");let a=e.querySelector(":scope > .sm-node-content > .sm-toggle");a&&(a.textContent="\u25B8")}}#m(){let t=this.querySelectorAll("li[aria-expanded]");for(let e of t){e.setAttribute("aria-expanded","true");let s=e.querySelector(":scope > ul");s&&s.classList.remove("sm-collapsed");let a=e.querySelector(":scope > .sm-node-content > .sm-toggle");a&&(a.textContent="\u25BE")}}#f(t){let e=t.getAttribute("aria-expanded")==="true";t.setAttribute("aria-expanded",e?"false":"true");let s=t.querySelector(":scope > ul");s&&s.classList.toggle("sm-collapsed",e);let a=t.querySelector(":scope > .sm-node-content > .sm-toggle");a&&(a.textContent=e?"\u25B8":"\u25BE")}#C(t){let e=t.target;if(e.closest(".sm-toggle")){t.preventDefault();let r=e.closest('li[role="treeitem"]');r&&this.#f(r);return}let s=e.closest('li[role="treeitem"]');if(!s)return;this.#p(s);let a=e.closest("a");a&&this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:a.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||""}}))}#k(t){let e=t.target.closest('li[role="treeitem"]');if(!e)return;let s=t.key,a=!1;switch(s){case"ArrowDown":a=!0,this.#E(e);break;case"ArrowUp":a=!0,this.#g(e);break;case"ArrowRight":if(a=!0,e.getAttribute("aria-expanded")==="false")this.#f(e);else if(e.getAttribute("aria-expanded")==="true"){let r=e.querySelector(':scope > ul > li[role="treeitem"]');r&&this.#p(r)}break;case"ArrowLeft":if(a=!0,e.getAttribute("aria-expanded")==="true")this.#f(e);else{let r=e.parentElement?.closest('li[role="treeitem"]');r&&this.#p(r)}break;case"Enter":a=!0,e.hasAttribute("aria-expanded")&&this.#f(e);break;case" ":a=!0;{let r=e.querySelector(":scope > .sm-node-content > a");r&&r.click()}break;case"Home":a=!0;{let r=this.querySelector('li[role="treeitem"]');r&&this.#p(r)}break;case"End":a=!0;{let r=this.#b();r.length&&this.#p(r[r.length-1])}break}a&&(t.preventDefault(),t.stopPropagation())}#b(){let t=[],e=a=>{if(!a)return;let r=[...a.querySelectorAll(':scope > li[role="treeitem"]')];for(let i of r)if(t.push(i),i.getAttribute("aria-expanded")==="true"){let o=i.querySelector(":scope > ul");o&&e(o)}},s=this.querySelector("nav > ul");return e(s),t}#E(t){let e=this.#b(),s=e.indexOf(t);s>=0&&s<e.length-1&&this.#p(e[s+1])}#g(t){let e=this.#b(),s=e.indexOf(t);s>0&&this.#p(e[s-1])}#p(t){this.#r&&this.#r.setAttribute("tabindex","-1"),t.setAttribute("tabindex","0"),t.focus(),this.#r=t}static#v="http://www.w3.org/2000/svg";static#u=150;static#y=70;static#q=30;static#w=50;static#x=20;static#j={layout:{stroke:"#8b5cf6",fill:"#f5f3ff",text:"#6d28d9"},section:{stroke:"#3b82f6",fill:"#eff6ff",text:"#1d4ed8"},dashboard:{stroke:"#22c55e",fill:"#f0fdf4",text:"#15803d"},page:{stroke:"#94a3b8",fill:"#f8fafc",text:"#475569"},modal:{stroke:"#f59e0b",fill:"#fffbeb",text:"#b45309"},redirect:{stroke:"#ef4444",fill:"#fef2f2",text:"#b91c1c"}};static#R={draft:"#94a3b8",ready:"#f59e0b",live:"#22c55e",deprecated:"#ef4444"};#P(t){let e=[];for(let s of t.querySelectorAll(":scope > li")){let a=s.querySelector(":scope > a"),r=s.querySelector(":scope > ul");e.push({label:a?.textContent?.trim()||s.firstChild?.textContent?.trim()||"",href:a?.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||"",status:s.getAttribute("data-status")||"",children:r?this.#P(r):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return e}#D(t,e=0){let s=d.#u,a=d.#y,r=d.#q,i=d.#w;for(let o of t)o.childCount=this.#B(o),o.children.length>0&&!o.collapsed?(this.#D(o.children,e+1),o.subtreeWidth=o.children.reduce((n,c)=>n+c.subtreeWidth,0)+r*(o.children.length-1)):o.subtreeWidth=s,o.subtreeWidth=Math.max(o.subtreeWidth,s)}#B(t){let e=0;for(let s of t.children)e+=1+this.#B(s);return e}#H(t,e,s){let a=d.#u,r=d.#y,i=d.#q,o=d.#w,n=e;for(let c of t)c.x=n+(c.subtreeWidth-a)/2,c.y=s,c.children.length>0&&!c.collapsed&&this.#H(c.children,n,s+r+o),n+=c.subtreeWidth+i}#G(t){t.style.display="none",t.setAttribute("aria-hidden","true");let e=t.querySelector("ul");e&&(this.#h=this.#P(e),this.#S())}#h=null;#_=1;get#N(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#O(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#z={zoomIn:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',zoomOut:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',reset:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',flip:'<path d="M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3"/><path d="M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3"/><path d="M4 12H2"/><path d="M10 12H8"/><path d="M16 12h-2"/><path d="M22 12h-2"/>'};static#U=["Shape","Shape + Title","Full","Full + Status","Wireframe"];#S(){if(!this.#h)return;this.#a&&this.#a.remove();let t=d.#v,e=d.#u,s=d.#y,a=d.#x,r=this.#N==="horizontal";this.#D(this.#h),this.#H(this.#h,a,a);let i=this.#Y(this.#h),o=i.maxX+e+a,n=i.maxY+s+a;r&&([o,n]=[n,o]),this.#a=document.createElement("div"),this.#a.className="sm-visual",this.#a.setAttribute("tabindex","-1"),this.#a.appendChild(this.#J());let c=document.createElementNS(t,"svg");c.setAttribute("viewBox",`0 0 ${o} ${n}`),c.setAttribute("width",String(o)),c.setAttribute("height",String(n)),c.setAttribute("role","img"),c.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`);let l=document.createElement("div");if(l.className="sm-visual-zoom",l.style.width=`${Math.round(o*this.#_)}px`,l.style.height=`${Math.round(n*this.#_)}px`,c.style.transform=`scale(${this.#_})`,c.style.transformOrigin="0 0",r){let f=document.createElementNS(t,"g");f.setAttribute("transform",`rotate(90 0 0) translate(0 -${n})`),this.#L(f,this.#h),this.#M(f,this.#h),c.appendChild(f)}else this.#L(c,this.#h),this.#M(c,this.#h);l.appendChild(c),this.#a.appendChild(l);let h=document.createElement("div");h.className="sm-visual-summary";let p=Math.round(this.#_*100);h.textContent=`${this.#o} pages \xB7 ${this.#i} levels \xB7 ${p}%`,this.#a.appendChild(h),this.appendChild(this.#a),this.#st(this.#a,c),this.listen(c,"click",f=>{let g=f.target,m=g.closest("[data-toggle]");if(m){let y=m.getAttribute("data-toggle");this.#Q(y);return}let b=g.closest("[data-node-id]");b&&(this.#A(b.getAttribute("data-node-id")),this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:b.getAttribute("data-href")||"",pageType:b.getAttribute("data-page-type")||"page",template:b.getAttribute("data-template")||""}})))}),c.setAttribute("tabindex","0"),c.setAttribute("role","tree"),c.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""} \u2014 use arrow keys to navigate`),c.addEventListener("keydown",f=>this.#tt(f)),requestAnimationFrame(()=>{let f=c.querySelector("[data-node-id]");f&&this.#V(f)})}#J(){let t=document.createElement("div");t.className="sm-vtoolbar",t.setAttribute("role","toolbar"),t.setAttribute("aria-label","Site map controls");let e=f=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${f}</svg>`,s=this.#I(e(d.#z.zoomIn),"Zoom in",()=>{this.#_=Math.min(3,this.#_+.25),this.#S()});t.appendChild(s);let a=this.#I(e(d.#z.zoomOut),"Zoom out",()=>{this.#_=Math.max(.25,this.#_-.25),this.#S()});t.appendChild(a);let r=this.#I(e(d.#z.reset),"Reset zoom",()=>{this.#_=1,this.#S()});t.appendChild(r);let i=document.createElement("span");i.className="sm-vtoolbar-sep",t.appendChild(i);let o=this.#N==="horizontal"?"Vertical":"Horizontal",n=this.#I(e(d.#z.flip),o,()=>{this.dataset.orientation=this.#N==="horizontal"?"vertical":"horizontal",this.#S()});t.appendChild(n),t.appendChild(i.cloneNode());let c=this.#O,l=document.createElement("label");l.className="sm-vtoolbar-detail",l.textContent="Detail ";let h=document.createElement("input");h.type="range",h.min="0",h.max="4",h.value=String(c),h.setAttribute("aria-label","Detail level"),h.className="sm-vtoolbar-slider",l.appendChild(h);let p=document.createElement("span");return p.className="sm-vtoolbar-detail-label",p.textContent=d.#U[c],l.appendChild(p),h.addEventListener("input",()=>{this.dataset.detail=h.value,p.textContent=d.#U[parseInt(h.value,10)],this.#S()}),t.appendChild(l),t}#I(t,e,s){let a=document.createElement("button");return a.type="button",a.className="sm-vtoolbar-btn",a.innerHTML=t,a.setAttribute("aria-label",e),a.setAttribute("title",e),a.addEventListener("click",s),a}#T=null;#F(t,e=""){let s=[];for(let a=0;a<t.length;a++){let r=t[a],i=e?`${e}-${a}`:String(a);s.push(i),r.children.length>0&&!r.collapsed&&s.push(...this.#F(r.children,i))}return s}#Z(t){let e=t.lastIndexOf("-");return e>0?t.slice(0,e):null}#at(t){let e=this.#$(t,this.#h);return!e||e.collapsed||e.children.length===0?null:`${t}-0`}#A(t){if(!t||!this.#a)return;let e=this.#a.querySelector('svg[role="tree"]');if(!e)return;let s=e.querySelector(`[data-node-id="${t}"]`);if(!s)return;this.#V(s),this.#T=t;let a=s.querySelector("rect");if(a&&this.#a){let r=a.getBoundingClientRect(),i=this.#a.getBoundingClientRect();(r.left<i.left||r.right>i.right||r.top<i.top||r.bottom>i.bottom)&&a.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#V(t){let e=t.closest("svg");if(!e)return;e.querySelectorAll(".sm-vfocus-ring").forEach(r=>r.remove()),e.querySelectorAll("[data-node-id]").forEach(r=>r.removeAttribute("aria-current"));let s=d.#v,a=t.querySelector("rect");if(a){let r=document.createElementNS(s,"rect");r.setAttribute("x",String(parseFloat(a.getAttribute("x"))-3)),r.setAttribute("y",String(parseFloat(a.getAttribute("y"))-3)),r.setAttribute("width",String(parseFloat(a.getAttribute("width"))+6)),r.setAttribute("height",String(parseFloat(a.getAttribute("height"))+6)),r.setAttribute("rx","11"),r.setAttribute("fill","none"),r.setAttribute("stroke","#3b82f6"),r.setAttribute("stroke-width","2"),r.setAttribute("class","sm-vfocus-ring"),t.parentNode.insertBefore(r,t)}t.setAttribute("aria-current","true"),this.#T=t.getAttribute("data-node-id")}#tt(t){if(!this.#h)return;let e=this.#T||"0",s=!1;switch(t.key){case"ArrowDown":{s=!0;let a=this.#$(e,this.#h);a&&a.children.length>0&&!a.collapsed&&this.#A(`${e}-0`);break}case"ArrowUp":{s=!0;let a=this.#Z(e);a&&this.#A(a);break}case"ArrowRight":{s=!0;let a=this.#W(e,1);a&&this.#A(a);break}case"ArrowLeft":{s=!0;let a=this.#W(e,-1);a&&this.#A(a);break}case"Enter":case" ":{s=!0;let a=this.#$(e,this.#h);a&&a.children.length>0&&this.#Q(e);break}case"Home":{s=!0,this.#A("0");break}case"End":{s=!0;let a=this.#F(this.#h);a.length&&this.#A(a[a.length-1]);break}}s&&(t.preventDefault(),t.stopPropagation())}#W(t,e){let s=t.split("-").map(Number),a=s[s.length-1]+e;if(a<0)return null;let r=s.length>1?s.slice(0,-1).join("-"):null,i=r?this.#$(r,this.#h):null,o=i?i.children:this.#h;if(!o||a>=o.length)return null;let n=[...s];return n[n.length-1]=a,n.join("-")}#X=!1;#et={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#st(t,e){if(e.style.cursor="grab",this.#X)return;this.#X=!0;let s=this.#et;this.listen(this,"pointerdown",a=>{if(a.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let r=this.querySelector(".sm-visual");if(!r)return;s.dragging=!0,s.moved=!1,s.startX=a.clientX,s.startY=a.clientY,s.scrollLeft=r.scrollLeft,s.scrollTop=r.scrollTop;let i=this.querySelector('svg[role="tree"]');i&&(i.style.cursor="grabbing")}),this.listen(window,"pointermove",a=>{if(!s.dragging)return;let r=a.clientX-s.startX,i=a.clientY-s.startY;(Math.abs(r)>3||Math.abs(i)>3)&&(s.moved=!0);let o=this.querySelector(".sm-visual");o&&(o.scrollLeft=s.scrollLeft-r,o.scrollTop=s.scrollTop-i)}),this.listen(window,"pointerup",()=>{if(!s.dragging)return;s.dragging=!1;let a=this.querySelector('svg[role="tree"]');a&&(a.style.cursor="grab")}),this.listen(this,"click",a=>{s.moved&&(a.stopPropagation(),s.moved=!1)},{capture:!0})}#Y(t){let e=0,s=0;for(let a of t)if(a.x+d.#u>e&&(e=a.x+d.#u),a.y+d.#y>s&&(s=a.y+d.#y),a.children.length>0&&!a.collapsed){let r=this.#Y(a.children);r.maxX>e&&(e=r.maxX),r.maxY>s&&(s=r.maxY)}return{maxX:e,maxY:s}}#L(t,e){let s=d.#v,a=d.#u,r=d.#y,i=d.#w;for(let o of e){if(o.children.length===0||o.collapsed)continue;let n=o.x+a/2,c=o.y+r,l=c+i/2;for(let h of o.children){let p=h.x+a/2,f=h.y,g=document.createElementNS(s,"path");g.setAttribute("d",`M ${n} ${c} L ${n} ${l} L ${p} ${l} L ${p} ${f}`),g.setAttribute("fill","none"),g.setAttribute("stroke","#cbd5e1"),g.setAttribute("stroke-width","1.5"),t.appendChild(g)}this.#L(t,o.children)}}#M(t,e,s=""){let a=d.#v,r=d.#u,i=d.#y,o=this.#O,n=o>=4;for(let c=0;c<e.length;c++){let l=e[c],h=s?`${s}-${c}`:String(c),p=n?{stroke:"#94a3b8",fill:"#ffffff",text:"#475569"}:d.#j[l.pageType]||d.#j.page,f=document.createElementNS(a,"g");f.setAttribute("data-node-id",h),f.setAttribute("data-href",l.href),f.setAttribute("data-page-type",l.pageType),f.setAttribute("data-template",l.template),f.style.cursor="pointer";let g=document.createElementNS(a,"rect");if(g.setAttribute("x",String(l.x)),g.setAttribute("y",String(l.y)),g.setAttribute("width",String(r)),g.setAttribute("height",String(i)),g.setAttribute("rx","8"),g.setAttribute("fill",p.fill),g.setAttribute("stroke",p.stroke),g.setAttribute("stroke-width",n?"1":"2"),(n||l.pageType==="modal")&&g.setAttribute("stroke-dasharray","6 3"),f.appendChild(g),o>=1){let m=document.createElementNS(a,"text");m.setAttribute("x",String(l.x+r/2)),m.setAttribute("y",String(o===1?l.y+i/2+5:l.y+24)),m.setAttribute("text-anchor","middle"),m.setAttribute("font-size","13"),m.setAttribute("font-weight","600"),m.setAttribute("fill",p.text),m.setAttribute("font-family","system-ui, sans-serif"),m.textContent=l.label.length>18?l.label.slice(0,17)+"\u2026":l.label,f.appendChild(m)}if(o>=2){let m=document.createElementNS(a,"text");if(m.setAttribute("x",String(l.x+r/2)),m.setAttribute("y",String(l.y+40)),m.setAttribute("text-anchor","middle"),m.setAttribute("font-size","9"),m.setAttribute("font-weight","700"),m.setAttribute("fill",p.stroke),m.setAttribute("font-family","system-ui, sans-serif"),m.textContent=(O[l.pageType]?.label||l.pageType).toUpperCase(),f.appendChild(m),l.template){let b=document.createElementNS(a,"text");b.setAttribute("x",String(l.x+r/2)),b.setAttribute("y",String(l.y+54)),b.setAttribute("text-anchor","middle"),b.setAttribute("font-size","9"),b.setAttribute("fill","#94a3b8"),b.setAttribute("font-family","system-ui, sans-serif"),b.textContent=l.template,f.appendChild(b)}}if(o>=3&&l.status&&d.#R[l.status]){let m=document.createElementNS(a,"circle");m.setAttribute("cx",String(l.x+r/2)),m.setAttribute("cy",String(l.y+i-8)),m.setAttribute("r","4"),m.setAttribute("fill",n?"#94a3b8":d.#R[l.status]),f.appendChild(m)}if(n)for(let m=0;m<2;m++){let b=document.createElementNS(a,"line");b.setAttribute("x1",String(l.x+12)),b.setAttribute("x2",String(l.x+r-12)),b.setAttribute("y1",String(l.y+i-22+m*8)),b.setAttribute("y2",String(l.y+i-22+m*8)),b.setAttribute("stroke","#cbd5e1"),b.setAttribute("stroke-width","1"),b.setAttribute("stroke-dasharray","3 2"),f.appendChild(b)}if(l.children.length>0){let m=document.createElementNS(a,"g");m.setAttribute("data-toggle",h),m.style.cursor="pointer";let b=document.createElementNS(a,"circle");b.setAttribute("cx",String(l.x+r/2)),b.setAttribute("cy",String(l.y+i+10)),b.setAttribute("r","10"),b.setAttribute("fill",n?"#fff":"#f1f5f9"),b.setAttribute("stroke","#cbd5e1"),b.setAttribute("stroke-width","1"),m.appendChild(b);let y=document.createElementNS(a,"text");y.setAttribute("x",String(l.x+r/2)),y.setAttribute("y",String(l.y+i+14)),y.setAttribute("text-anchor","middle"),y.setAttribute("font-size","11"),y.setAttribute("font-weight","700"),y.setAttribute("fill","#64748b"),y.setAttribute("font-family","system-ui, sans-serif"),y.textContent=l.collapsed?`+${l.childCount}`:"\u2212",m.appendChild(y),f.appendChild(m)}t.appendChild(f),l.children.length>0&&!l.collapsed&&this.#M(t,l.children,h)}}#Q(t){let e=this.#$(t,this.#h);if(!e)return;e.collapsed=!e.collapsed;let s=this.#T||t;this.#S(),requestAnimationFrame(()=>{this.#A(s);let a=this.#a?.querySelector('svg[role="tree"]');a&&a.focus({preventScroll:!0})})}#$(t,e){if(!e)return null;let s=t.split("-").map(Number),a=e,r=null;for(let i of s){if(!a||i>=a.length)return null;r=a[i],a=r.children}return 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();for(;this.firstChild;)this.firstChild.remove();s.title&&!this.getAttribute("title")&&this.setAttribute("title",s.title);let a=document.createElement("nav"),r=document.createElement("ul");this.#K(r,s.pages||[]),a.appendChild(r),this.appendChild(a),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[site-map-wc] Failed to load src="${t}":`,e)}}#K(t,e){for(let s of e){let a=document.createElement("li");s.pageType&&a.setAttribute("data-page-type",s.pageType),s.template&&a.setAttribute("data-template",s.template),s.status&&a.setAttribute("data-status",s.status);let r=document.createElement("a");if(r.href=s.href||"#",r.textContent=s.label||"",a.appendChild(r),s.children&&s.children.length>0){let i=document.createElement("ul");this.#K(i,s.children),a.appendChild(i)}t.appendChild(a)}}};x("site-map-wc",dt);var T=`
|
|
2758
|
+
</article>`,a==="compact")for(let n of t.querySelectorAll(".wi-section")){let d=n.querySelector("slot");d&&d.assignedNodes().length===0&&n.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}))}};x("work-item",Tt);var tt={layout:{label:"Layout",cssClass:"sm-badge--layout"},section:{label:"Section",cssClass:"sm-badge--section"},dashboard:{label:"Dashboard",cssClass:"sm-badge--dashboard"},page:{label:"Page",cssClass:"sm-badge--page"},modal:{label:"Modal",cssClass:"sm-badge--modal"},redirect:{label:"Redirect",cssClass:"sm-badge--redirect"}},et={draft:{label:"Draft",cssClass:"sm-status--draft"},ready:{label:"Ready",cssClass:"sm-status--ready"},live:{label:"Live",cssClass:"sm-status--live"},deprecated:{label:"Deprecated",cssClass:"sm-status--deprecated"}},It=class c extends C{static get observedAttributes(){return["src","collapsed","compact","title","data-view","data-orientation","data-detail"]}static#e=0;#s=null;#t=null;#i=null;#r=null;#o=0;#a=0;setup(){c.#e++;let t=this.getAttribute("src");if(t&&!this.querySelector("nav")){this._loadSrc(t);return}let e=this.querySelector(":scope > nav");if(e){if(this.#o=0,this.#a=0,this.#n(e.querySelector("ul"),0),this.dataset.view==="visual"){this.#c(),this.#Z(e),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#o,depth:this.#a}}));return}this.#l(e.querySelector("ul"),0),this.#c(),e.classList.add("sm-tree"),e.setAttribute("role","tree"),e.setAttribute("aria-label",this.getAttribute("title")||"Site map"),this.#s=e,this.hasAttribute("collapsed")&&this.#p(),this.listen(e,"keydown",s=>this.#y(s)),this.listen(e,"click",s=>this.#m(s)),this.dispatchEvent(new CustomEvent("site-map-wc:ready",{bubbles:!0,detail:{nodeCount:this.#o,depth:this.#a}}))}}teardown(){if(this.#i){this.#i.remove(),this.#i=null;let t=this.querySelector("nav");t&&(t.style.display="",t.removeAttribute("aria-hidden"))}this.#t&&(this.#t.remove(),this.#t=null),this.#s&&(this.#s.classList.remove("sm-tree"),this.#s.removeAttribute("role"),this.#s.removeAttribute("aria-label")),this.querySelectorAll(".sm-node-content, .sm-toggle").forEach(t=>t.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(t=>{t.removeAttribute("role"),t.removeAttribute("aria-expanded"),t.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(t=>{t.removeAttribute("role"),t.classList.remove("sm-subtree","sm-collapsed")}),this.#s=null,this.#r=null,this.#o=0,this.#a=0}attributeChangedCallback(t,e,s){e===s||!this.isConnected||t==="src"&&this._loadSrc(s)}#n(t,e){if(!t)return;let s=t.querySelectorAll(":scope > li");for(let r of s){this.#o++;let i=e+1;i>this.#a&&(this.#a=i);let a=r.querySelector(":scope > ul");a&&this.#n(a,i)}}#l(t,e){if(!t)return;e>0&&(t.setAttribute("role","group"),t.classList.add("sm-subtree"));let s=[...t.querySelectorAll(":scope > li")];for(let r of s){let i=!!r.querySelector(":scope > ul"),a=r.querySelector(":scope > a"),o=r.getAttribute("data-page-type")||"page",n=r.getAttribute("data-template")||"",d=r.getAttribute("data-status")||"";r.setAttribute("role","treeitem"),r.setAttribute("tabindex","-1");let l=document.createElement("span");if(l.className="sm-node-content",i){r.setAttribute("aria-expanded","true");let h=document.createElement("button");h.className="sm-toggle",h.setAttribute("type","button"),h.setAttribute("aria-hidden","true"),h.setAttribute("tabindex","-1"),h.textContent="\u25BE",l.appendChild(h)}else{let h=document.createElement("span");h.className="sm-leaf-marker",h.setAttribute("aria-hidden","true"),l.appendChild(h)}if(d&&et[d]){let h=document.createElement("span");h.className=`sm-status-dot ${et[d].cssClass}`,h.setAttribute("title",et[d].label),h.setAttribute("aria-label",et[d].label),l.appendChild(h)}if(a&&l.appendChild(a),tt[o]){let h=document.createElement("span");h.className=`sm-badge ${tt[o].cssClass}`,h.textContent=tt[o].label,l.appendChild(h)}if(n){let h=document.createElement("span");h.className="sm-badge sm-badge--template",h.textContent=n,l.appendChild(h)}r.insertBefore(l,r.firstChild);let u=r.querySelector(":scope > ul");u&&this.#l(u,e+1)}}#c(){let t=this.getAttribute("title");if(!t&&this.#o===0)return;if(this.#t=document.createElement("div"),this.#t.className="sm-header",t){let r=document.createElement("h2");r.className="sm-title",r.textContent=t,this.#t.appendChild(r)}let e=document.createElement("span");e.className="sm-summary",e.textContent=`${this.#o} pages \xB7 ${this.#a} levels deep`,this.#t.appendChild(e);let s=document.createElement("button");s.className="sm-toggle-all",s.setAttribute("type","button"),s.textContent="Collapse all",s.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#p(),s.textContent="Expand all"):(this.#d(),s.textContent="Collapse all")}),this.#t.appendChild(s),this.insertBefore(this.#t,this.firstChild)}#p(){let t=this.querySelectorAll("li[aria-expanded]");for(let e of t){e.setAttribute("aria-expanded","false");let s=e.querySelector(":scope > ul");s&&s.classList.add("sm-collapsed");let r=e.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent="\u25B8")}}#d(){let t=this.querySelectorAll("li[aria-expanded]");for(let e of t){e.setAttribute("aria-expanded","true");let s=e.querySelector(":scope > ul");s&&s.classList.remove("sm-collapsed");let r=e.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent="\u25BE")}}#u(t){let e=t.getAttribute("aria-expanded")==="true";t.setAttribute("aria-expanded",e?"false":"true");let s=t.querySelector(":scope > ul");s&&s.classList.toggle("sm-collapsed",e);let r=t.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent=e?"\u25B8":"\u25BE")}#m(t){let e=t.target;if(e.closest(".sm-toggle")){t.preventDefault();let i=e.closest('li[role="treeitem"]');i&&this.#u(i);return}let s=e.closest('li[role="treeitem"]');if(!s)return;this.#f(s);let r=e.closest("a");r&&this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:r.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||""}}))}#y(t){let e=t.target.closest('li[role="treeitem"]');if(!e)return;let s=t.key,r=!1;switch(s){case"ArrowDown":r=!0,this.#v(e);break;case"ArrowUp":r=!0,this.#x(e);break;case"ArrowRight":if(r=!0,e.getAttribute("aria-expanded")==="false")this.#u(e);else if(e.getAttribute("aria-expanded")==="true"){let i=e.querySelector(':scope > ul > li[role="treeitem"]');i&&this.#f(i)}break;case"ArrowLeft":if(r=!0,e.getAttribute("aria-expanded")==="true")this.#u(e);else{let i=e.parentElement?.closest('li[role="treeitem"]');i&&this.#f(i)}break;case"Enter":r=!0,e.hasAttribute("aria-expanded")&&this.#u(e);break;case" ":r=!0;{let i=e.querySelector(":scope > .sm-node-content > a");i&&i.click()}break;case"Home":r=!0;{let i=this.querySelector('li[role="treeitem"]');i&&this.#f(i)}break;case"End":r=!0;{let i=this.#h();i.length&&this.#f(i[i.length-1])}break}r&&(t.preventDefault(),t.stopPropagation())}#h(){let t=[],e=r=>{if(!r)return;let i=[...r.querySelectorAll(':scope > li[role="treeitem"]')];for(let a of i)if(t.push(a),a.getAttribute("aria-expanded")==="true"){let o=a.querySelector(":scope > ul");o&&e(o)}},s=this.querySelector("nav > ul");return e(s),t}#v(t){let e=this.#h(),s=e.indexOf(t);s>=0&&s<e.length-1&&this.#f(e[s+1])}#x(t){let e=this.#h(),s=e.indexOf(t);s>0&&this.#f(e[s-1])}#f(t){this.#r&&this.#r.setAttribute("tabindex","-1"),t.setAttribute("tabindex","0"),t.focus(),this.#r=t}static#g="http://www.w3.org/2000/svg";static#b=150;static#k=70;static#A=30;static#_=50;static#C=20;static#D={layout:{stroke:"#8b5cf6",fill:"#f5f3ff",text:"#6d28d9"},section:{stroke:"#3b82f6",fill:"#eff6ff",text:"#1d4ed8"},dashboard:{stroke:"#22c55e",fill:"#f0fdf4",text:"#15803d"},page:{stroke:"#94a3b8",fill:"#f8fafc",text:"#475569"},modal:{stroke:"#f59e0b",fill:"#fffbeb",text:"#b45309"},redirect:{stroke:"#ef4444",fill:"#fef2f2",text:"#b91c1c"}};static#P={draft:"#94a3b8",ready:"#f59e0b",live:"#22c55e",deprecated:"#ef4444"};#R(t){let e=[];for(let s of t.querySelectorAll(":scope > li")){let r=s.querySelector(":scope > a"),i=s.querySelector(":scope > ul");e.push({label:r?.textContent?.trim()||s.firstChild?.textContent?.trim()||"",href:r?.getAttribute("href")||"",pageType:s.getAttribute("data-page-type")||"page",template:s.getAttribute("data-template")||"",status:s.getAttribute("data-status")||"",children:i?this.#R(i):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return e}#j(t,e=0){let s=c.#b,r=c.#k,i=c.#A,a=c.#_;for(let o of t)o.childCount=this.#B(o),o.children.length>0&&!o.collapsed?(this.#j(o.children,e+1),o.subtreeWidth=o.children.reduce((n,d)=>n+d.subtreeWidth,0)+i*(o.children.length-1)):o.subtreeWidth=s,o.subtreeWidth=Math.max(o.subtreeWidth,s)}#B(t){let e=0;for(let s of t.children)e+=1+this.#B(s);return e}#O(t,e,s){let r=c.#b,i=c.#k,a=c.#A,o=c.#_,n=e;for(let d of t)d.x=n+(d.subtreeWidth-r)/2,d.y=s,d.children.length>0&&!d.collapsed&&this.#O(d.children,n,s+i+o),n+=d.subtreeWidth+a}#Z(t){t.style.display="none",t.setAttribute("aria-hidden","true");let e=t.querySelector("ul");e&&(this.#w=this.#R(e),this.#$())}#w=null;#E=1;get#M(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#F(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#I={zoomIn:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',zoomOut:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',reset:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',flip:'<path d="M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3"/><path d="M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3"/><path d="M4 12H2"/><path d="M10 12H8"/><path d="M16 12h-2"/><path d="M22 12h-2"/>'};static#H=["Shape","Shape + Title","Full","Full + Status","Wireframe"];static#tt=0;#et(t){let e=this.#i?.querySelector(".sm-visual-scroll"),s=this.#i?.querySelector('svg[role="tree"]'),r={nodeId:null,rectTop:0,rectLeft:0,focusId:this.#q};if(!e||!s)return r;let i=t||this.#q;if(!i)return r;let o=s.querySelector(`[data-node-id="${i}"]`)?.querySelector("rect");if(!o)return r;let n=o.getBoundingClientRect(),d=e.getBoundingClientRect();return r.nodeId=i,r.rectTop=n.top-d.top,r.rectLeft=n.left-d.left,r}#U(t){let e=this.#i?.querySelector(".sm-visual-scroll"),s=this.#i?.querySelector('svg[role="tree"]');if(!(!e||!s)){if(t.nodeId){let i=s.querySelector(`[data-node-id="${t.nodeId}"]`)?.querySelector("rect");if(i){let a=i.getBoundingClientRect(),o=e.getBoundingClientRect(),n=a.top-o.top-t.rectTop,d=a.left-o.left-t.rectLeft;e.scrollTop+=n,e.scrollLeft+=d}}t.focusId&&(this.#S(t.focusId),s.focus({preventScroll:!0}))}}#$(t={}){if(!this.#w)return;let e=this.#et(t.anchorId||null),s=this.#i,r=c.#g,i=c.#b,a=c.#k,o=c.#C,n=this.#M==="horizontal";this.#j(this.#w),this.#O(this.#w,o,o);let d=this.#Q(this.#w),l=d.maxX+i+o,u=d.maxY+a+o;n&&([l,u]=[u,l]),this.#i=document.createElement("div"),this.#i.className="sm-visual",this.#i.setAttribute("tabindex","-1"),this.#i.appendChild(this.#st());let h=document.createElement("div");h.className="sm-visual-scroll";let m=document.createElementNS(r,"svg");m.setAttribute("viewBox",`0 0 ${l} ${u}`),m.setAttribute("width",String(l)),m.setAttribute("height",String(u)),m.setAttribute("role","img"),m.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`);let f=document.createElement("div");if(f.className="sm-visual-zoom",f.style.width=`${Math.round(l*this.#E)}px`,f.style.height=`${Math.round(u*this.#E)}px`,m.style.transform=`scale(${this.#E})`,m.style.transformOrigin="0 0",n){let v=document.createElementNS(r,"g");v.setAttribute("transform",`rotate(90 0 0) translate(0 -${u})`),this.#L(v,this.#w),this.#z(v,this.#w),m.appendChild(v)}else this.#L(m,this.#w),this.#z(m,this.#w);f.appendChild(m),h.appendChild(f),this.#i.appendChild(h);let p=document.createElement("div");p.className="sm-visual-summary";let b=Math.round(this.#E*100);p.textContent=`${this.#o} pages \xB7 ${this.#a} levels \xB7 ${b}%`,this.#i.appendChild(p);let y=this.#i,_=()=>{s&&s.isConnected?s.replaceWith(y):this.appendChild(y)};if(s?.isConnected&&"startViewTransition"in document&&!matchMedia("(prefers-reduced-motion: reduce)").matches){let v=`sm-vt-${++c.#tt}`;s.style.viewTransitionName=v,y.style.viewTransitionName=v;let w=document.startViewTransition(_);w.finished.finally(()=>{y.style.viewTransitionName=""}),w.updateCallbackDone.then(()=>this.#U(e))}else _(),this.#U(e);this.#ot(this.#i,m),this.listen(m,"click",v=>{let w=v.target,T=w.closest("[data-toggle]");if(T){let $=T.getAttribute("data-toggle");$&&this.#K($);return}let E=w.closest("[data-node-id]");if(E){let $=E.getAttribute("data-node-id");$&&this.#S($),this.dispatchEvent(new CustomEvent("site-map-wc:select",{bubbles:!0,detail:{href:E.getAttribute("data-href")||"",pageType:E.getAttribute("data-page-type")||"page",template:E.getAttribute("data-template")||""}}))}}),m.setAttribute("tabindex","0"),m.setAttribute("role","tree"),m.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""} \u2014 use arrow keys to navigate`),m.addEventListener("keydown",v=>this.#it(v)),requestAnimationFrame(()=>{let v=m.querySelector("[data-node-id]");v&&this.#W(v)})}#st(){let t=document.createElement("div");t.className="sm-vtoolbar",t.setAttribute("role","toolbar"),t.setAttribute("aria-label","Site map controls");let e=m=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${m}</svg>`,s=this.#N(e(c.#I.zoomIn),"Zoom in",()=>{this.#E=Math.min(3,this.#E+.25),this.#$()});t.appendChild(s);let r=this.#N(e(c.#I.zoomOut),"Zoom out",()=>{this.#E=Math.max(.25,this.#E-.25),this.#$()});t.appendChild(r);let i=this.#N(e(c.#I.reset),"Reset zoom",()=>{this.#E=1,this.#$()});t.appendChild(i);let a=document.createElement("span");a.className="sm-vtoolbar-sep",t.appendChild(a);let o=this.#M==="horizontal"?"Vertical":"Horizontal",n=this.#N(e(c.#I.flip),o,()=>{this.dataset.orientation=this.#M==="horizontal"?"vertical":"horizontal",this.#$()});t.appendChild(n),t.appendChild(a.cloneNode());let d=this.#F,l=document.createElement("label");l.className="sm-vtoolbar-detail",l.textContent="Detail ";let u=document.createElement("input");u.type="range",u.min="0",u.max="4",u.value=String(d),u.setAttribute("aria-label","Detail level"),u.className="sm-vtoolbar-slider",l.appendChild(u);let h=document.createElement("span");return h.className="sm-vtoolbar-detail-label",h.textContent=c.#H[d],l.appendChild(h),u.addEventListener("input",()=>{this.dataset.detail=u.value,h.textContent=c.#H[parseInt(u.value,10)],this.#$()}),t.appendChild(l),t}#N(t,e,s){let r=document.createElement("button");return r.type="button",r.className="sm-vtoolbar-btn",r.innerHTML=t,r.setAttribute("aria-label",e),r.setAttribute("title",e),r.addEventListener("click",s),r}#q=null;#V(t,e=""){let s=[];for(let r=0;r<t.length;r++){let i=t[r],a=e?`${e}-${r}`:String(r);s.push(a),i.children.length>0&&!i.collapsed&&s.push(...this.#V(i.children,a))}return s}#rt(t){let e=t.lastIndexOf("-");return e>0?t.slice(0,e):null}#nt(t){let e=this.#T(t,this.#w);return!e||e.collapsed||e.children.length===0?null:`${t}-0`}#S(t){if(!t||!this.#i)return;let e=this.#i.querySelector('svg[role="tree"]');if(!e)return;let s=e.querySelector(`[data-node-id="${t}"]`);if(!s)return;this.#W(s),this.#q=t;let r=s.querySelector("rect"),i=this.#i?.querySelector(".sm-visual-scroll");if(r&&i){let a=r.getBoundingClientRect(),o=i.getBoundingClientRect();(a.left<o.left||a.right>o.right||a.top<o.top||a.bottom>o.bottom)&&r.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#W(t){let e=t.closest("svg");if(!e)return;e.querySelectorAll(".sm-vfocus-ring").forEach(i=>i.remove()),e.querySelectorAll("[data-node-id]").forEach(i=>i.removeAttribute("aria-current"));let s=c.#g,r=t.querySelector("rect");if(r){let i=document.createElementNS(s,"rect");i.setAttribute("x",String(parseFloat(r.getAttribute("x")??"0")-3)),i.setAttribute("y",String(parseFloat(r.getAttribute("y")??"0")-3)),i.setAttribute("width",String(parseFloat(r.getAttribute("width")??"0")+6)),i.setAttribute("height",String(parseFloat(r.getAttribute("height")??"0")+6)),i.setAttribute("rx","11"),i.setAttribute("fill","none"),i.setAttribute("stroke","#3b82f6"),i.setAttribute("stroke-width","2"),i.setAttribute("class","sm-vfocus-ring"),t.parentNode?.insertBefore(i,t)}t.setAttribute("aria-current","true"),this.#q=t.getAttribute("data-node-id")}#it(t){if(!this.#w)return;let e=this.#q||"0",s=!1;switch(t.key){case"ArrowDown":{s=!0;let r=this.#T(e,this.#w);r&&r.children.length>0&&!r.collapsed&&this.#S(`${e}-0`);break}case"ArrowUp":{s=!0;let r=this.#rt(e);r&&this.#S(r);break}case"ArrowRight":{s=!0;let r=this.#Y(e,1);r&&this.#S(r);break}case"ArrowLeft":{s=!0;let r=this.#Y(e,-1);r&&this.#S(r);break}case"Enter":case" ":{s=!0;let r=this.#T(e,this.#w);r&&r.children.length>0&&this.#K(e);break}case"Home":{s=!0,this.#S("0");break}case"End":{s=!0;let r=this.#V(this.#w);r.length&&this.#S(r[r.length-1]);break}}s&&(t.preventDefault(),t.stopPropagation())}#Y(t,e){let s=t.split("-").map(Number),r=s[s.length-1]+e;if(r<0)return null;let i=s.length>1?s.slice(0,-1).join("-"):null,a=i?this.#T(i,this.#w):null,o=a?a.children:this.#w;if(!o||r>=o.length)return null;let n=[...s];return n[n.length-1]=r,n.join("-")}#X=!1;#at={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#ot(t,e){if(e.style.cursor="grab",this.#X)return;this.#X=!0;let s=this.#at;this.listen(this,"pointerdown",r=>{let i=r;if(i.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let a=this.querySelector(".sm-visual-scroll");if(!a)return;s.dragging=!0,s.moved=!1,s.startX=i.clientX,s.startY=i.clientY,s.scrollLeft=a.scrollLeft,s.scrollTop=a.scrollTop;let o=this.querySelector('svg[role="tree"]');o&&(o.style.cursor="grabbing")}),this.listen(window,"pointermove",r=>{if(!s.dragging)return;let i=r,a=i.clientX-s.startX,o=i.clientY-s.startY;(Math.abs(a)>3||Math.abs(o)>3)&&(s.moved=!0);let n=this.querySelector(".sm-visual-scroll");n&&(n.scrollLeft=s.scrollLeft-a,n.scrollTop=s.scrollTop-o)}),this.listen(window,"pointerup",()=>{if(!s.dragging)return;s.dragging=!1;let r=this.querySelector('svg[role="tree"]');r&&(r.style.cursor="grab")}),this.listen(this,"click",r=>{s.moved&&(r.stopPropagation(),s.moved=!1)},{capture:!0})}#Q(t){let e=0,s=0;for(let r of t)if(r.x+c.#b>e&&(e=r.x+c.#b),r.y+c.#k>s&&(s=r.y+c.#k),r.children.length>0&&!r.collapsed){let i=this.#Q(r.children);i.maxX>e&&(e=i.maxX),i.maxY>s&&(s=i.maxY)}return{maxX:e,maxY:s}}#L(t,e){let s=c.#g,r=c.#b,i=c.#k,a=c.#_;for(let o of e){if(o.children.length===0||o.collapsed)continue;let n=o.x+r/2,d=o.y+i,l=d+a/2;for(let u of o.children){let h=u.x+r/2,m=u.y,f=document.createElementNS(s,"path");f.setAttribute("d",`M ${n} ${d} L ${n} ${l} L ${h} ${l} L ${h} ${m}`),f.setAttribute("fill","none"),f.setAttribute("stroke","#cbd5e1"),f.setAttribute("stroke-width","1.5"),t.appendChild(f)}this.#L(t,o.children)}}#z(t,e,s=""){let r=c.#g,i=c.#b,a=c.#k,o=this.#F,n=o>=4;for(let d=0;d<e.length;d++){let l=e[d],u=s?`${s}-${d}`:String(d),h=n?{stroke:"#94a3b8",fill:"#ffffff",text:"#475569"}:c.#D[l.pageType]||c.#D.page,m=document.createElementNS(r,"g");m.setAttribute("data-node-id",u),m.setAttribute("data-href",l.href),m.setAttribute("data-page-type",l.pageType),m.setAttribute("data-template",l.template),m.style.cursor="pointer";let f=document.createElementNS(r,"rect");if(f.setAttribute("x",String(l.x)),f.setAttribute("y",String(l.y)),f.setAttribute("width",String(i)),f.setAttribute("height",String(a)),f.setAttribute("rx","8"),f.setAttribute("fill",h.fill),f.setAttribute("stroke",h.stroke),f.setAttribute("stroke-width",n?"1":"2"),(n||l.pageType==="modal")&&f.setAttribute("stroke-dasharray","6 3"),m.appendChild(f),o>=1){let p=document.createElementNS(r,"text");p.setAttribute("x",String(l.x+i/2)),p.setAttribute("y",String(o===1?l.y+a/2+5:l.y+24)),p.setAttribute("text-anchor","middle"),p.setAttribute("font-size","13"),p.setAttribute("font-weight","600"),p.setAttribute("fill",h.text),p.setAttribute("font-family","system-ui, sans-serif"),p.textContent=l.label.length>18?l.label.slice(0,17)+"\u2026":l.label,m.appendChild(p)}if(o>=2){let p=document.createElementNS(r,"text");if(p.setAttribute("x",String(l.x+i/2)),p.setAttribute("y",String(l.y+40)),p.setAttribute("text-anchor","middle"),p.setAttribute("font-size","9"),p.setAttribute("font-weight","700"),p.setAttribute("fill",h.stroke),p.setAttribute("font-family","system-ui, sans-serif"),p.textContent=(tt[l.pageType]?.label||l.pageType).toUpperCase(),m.appendChild(p),l.template){let b=document.createElementNS(r,"text");b.setAttribute("x",String(l.x+i/2)),b.setAttribute("y",String(l.y+54)),b.setAttribute("text-anchor","middle"),b.setAttribute("font-size","9"),b.setAttribute("fill","#94a3b8"),b.setAttribute("font-family","system-ui, sans-serif"),b.textContent=l.template,m.appendChild(b)}}if(o>=3&&l.status&&c.#P[l.status]){let p=document.createElementNS(r,"circle");p.setAttribute("cx",String(l.x+i/2)),p.setAttribute("cy",String(l.y+a-8)),p.setAttribute("r","4"),p.setAttribute("fill",n?"#94a3b8":c.#P[l.status]),m.appendChild(p)}if(n)for(let p=0;p<2;p++){let b=document.createElementNS(r,"line");b.setAttribute("x1",String(l.x+12)),b.setAttribute("x2",String(l.x+i-12)),b.setAttribute("y1",String(l.y+a-22+p*8)),b.setAttribute("y2",String(l.y+a-22+p*8)),b.setAttribute("stroke","#cbd5e1"),b.setAttribute("stroke-width","1"),b.setAttribute("stroke-dasharray","3 2"),m.appendChild(b)}if(l.children.length>0){let p=document.createElementNS(r,"g");p.setAttribute("data-toggle",u),p.style.cursor="pointer";let b=document.createElementNS(r,"circle");b.setAttribute("cx",String(l.x+i/2)),b.setAttribute("cy",String(l.y+a+10)),b.setAttribute("r","10"),b.setAttribute("fill",n?"#fff":"#f1f5f9"),b.setAttribute("stroke","#cbd5e1"),b.setAttribute("stroke-width","1"),p.appendChild(b);let y=document.createElementNS(r,"text");y.setAttribute("x",String(l.x+i/2)),y.setAttribute("y",String(l.y+a+14)),y.setAttribute("text-anchor","middle"),y.setAttribute("font-size","11"),y.setAttribute("font-weight","700"),y.setAttribute("fill","#64748b"),y.setAttribute("font-family","system-ui, sans-serif"),y.textContent=l.collapsed?`+${l.childCount}`:"\u2212",p.appendChild(y),m.appendChild(p)}t.appendChild(m),l.children.length>0&&!l.collapsed&&this.#z(t,l.children,u)}}#K(t){let e=this.#T(t,this.#w);e&&(e.collapsed=!e.collapsed,this.#q||(this.#q=t),this.#$({anchorId:t}))}#T(t,e){if(!e)return null;let s=t.split("-").map(Number),r=e,i=null;for(let a of s){if(!r||a>=r.length)return null;i=r[a],r=i.children}return i}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();s.title&&!this.getAttribute("title")&&this.setAttribute("title",s.title),this._setPages(s.pages||[])}catch(e){console.warn(`[site-map-wc] Failed to load src="${t}":`,e)}}get pages(){let e=this.querySelector(":scope > nav")?.querySelector("ul");return e?this.#G(e):[]}set pages(t){this._setPages(Array.isArray(t)?t:[]),this.dispatchEvent(new CustomEvent("site-map-wc:pages-changed",{detail:{pages:this.pages,source:"property"},bubbles:!0}))}_setPages(t){for(;this.firstChild;)this.firstChild.remove();let e=document.createElement("nav"),s=document.createElement("ul");this.#J(s,t),e.appendChild(s),this.appendChild(e),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}#G(t){let e=[];for(let s of t.querySelectorAll(":scope > li")){let r=s.querySelector(":scope > a"),i=s.querySelector(":scope > ul"),a={label:r?.textContent?.trim()||"",href:r?.getAttribute("href")||void 0,pageType:s.getAttribute("data-page-type")||void 0,template:s.getAttribute("data-template")||void 0,status:s.getAttribute("data-status")||void 0};i&&(a.children=this.#G(i)),e.push(a)}return e}#J(t,e){for(let s of e){let r=document.createElement("li");s.pageType&&r.setAttribute("data-page-type",s.pageType),s.template&&r.setAttribute("data-template",s.template),s.status&&r.setAttribute("data-status",s.status);let i=document.createElement("a");if(i.href=s.href||"#",i.textContent=s.label||"",r.appendChild(i),s.children&&s.children.length>0){let a=document.createElement("ul");this.#J(a,s.children),r.appendChild(a)}t.appendChild(r)}}};x("site-map-wc",It);var F=`
|
|
2684
2759
|
:host {
|
|
2685
2760
|
--_bg: var(--adr-wc-bg, var(--color-surface, #ffffff));
|
|
2686
2761
|
--_text: var(--adr-wc-text, var(--color-text, #1a1a1a));
|
|
@@ -2889,12 +2964,12 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
2889
2964
|
.adr-section-icon svg {
|
|
2890
2965
|
width: 13px;
|
|
2891
2966
|
height: 13px;
|
|
2892
|
-
fill:
|
|
2967
|
+
fill: var(--color-text-inverted, #fff);
|
|
2893
2968
|
}
|
|
2894
2969
|
|
|
2895
|
-
.adr-section-icon.context { background: #8b5cf6; }
|
|
2896
|
-
.adr-section-icon.decision { background: #22c55e; }
|
|
2897
|
-
.adr-section-icon.consequences { background: #f59e0b; }
|
|
2970
|
+
.adr-section-icon.context { background: var(--color-accent, #8b5cf6); }
|
|
2971
|
+
.adr-section-icon.decision { background: var(--color-success, #22c55e); }
|
|
2972
|
+
.adr-section-icon.consequences { background: var(--color-warning, #f59e0b); }
|
|
2898
2973
|
|
|
2899
2974
|
.adr-section-title {
|
|
2900
2975
|
font-size: var(--_font-xs);
|
|
@@ -3005,29 +3080,29 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
3005
3080
|
}
|
|
3006
3081
|
|
|
3007
3082
|
.state-msg { padding: var(--_space-m); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
|
|
3008
|
-
.state-msg--error { color: #dc2626; }
|
|
3009
|
-
`;var
|
|
3010
|
-
<article class="adr-card adr-card--minimal" role="article" aria-label="${
|
|
3083
|
+
.state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
|
|
3084
|
+
`;var Yt={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)"}},R={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"/>'},Nt=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"})}#s(){for(let t of[...this.children]){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}connectedCallback(){this.#s(),this.adrId&&!this.id&&(this.id=this.adrId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#t(),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.#t())}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.#s(),this.shadowRoot&&this.#t(),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 i=document.createElement("li");i.textContent=String(r),e.appendChild(i)}this.appendChild(e)}}async _loadSrc(t){if(!t)return;let e=this.shadowRoot;e.innerHTML=`<style>${F}</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(),this.#t()}catch(s){e.innerHTML=`<style>${F}</style><div class="state-msg state-msg--error">Could not load: ${g(s.message)}</div>`}}#t(){let t=this.shadowRoot,e=Yt[this.status]||Yt.proposed,s=this._detailLevel,r=this.adrId?`ADR: ${g(this.adrId)}`:"Architectural Decision Record",i=!!this.querySelector('[slot="date"]')||this.#e.has("date");if(s==="minimal"){t.innerHTML=`<style>${F}</style>
|
|
3085
|
+
<article class="adr-card adr-card--minimal" role="article" aria-label="${r}"
|
|
3011
3086
|
tabindex="0">
|
|
3012
3087
|
<div class="adr-body">
|
|
3013
3088
|
<div class="adr-meta">
|
|
3014
|
-
${this.adrId?`<span class="adr-id">${
|
|
3015
|
-
<span class="adr-status" style="color:${
|
|
3089
|
+
${this.adrId?`<span class="adr-id">${g(this.adrId)}</span>`:""}
|
|
3090
|
+
<span class="adr-status" style="color:${e.color};background:${e.bg}">${g(e.label)}</span>
|
|
3016
3091
|
</div>
|
|
3017
3092
|
<div class="adr-title-wrap">
|
|
3018
|
-
<slot name="title"><span class="adr-title-fallback">${
|
|
3093
|
+
<slot name="title"><span class="adr-title-fallback">${g(this._minimalLabel)}</span></slot>
|
|
3019
3094
|
</div>
|
|
3020
3095
|
</div>
|
|
3021
|
-
</article>`;return}if(
|
|
3022
|
-
<article class="adr-card adr-card--${
|
|
3096
|
+
</article>`;return}if(t.innerHTML=`<style>${F}</style>
|
|
3097
|
+
<article class="adr-card adr-card--${s}" role="article" aria-label="${r}">
|
|
3023
3098
|
|
|
3024
3099
|
<header class="adr-header">
|
|
3025
3100
|
<div class="adr-meta">
|
|
3026
|
-
${this.adrId?`<span class="adr-id">${
|
|
3027
|
-
${
|
|
3101
|
+
${this.adrId?`<span class="adr-id">${g(this.adrId)}</span>`:""}
|
|
3102
|
+
${i?`<span class="adr-date-wrap">${A(R.calendar)} <slot name="date"></slot></span>`:""}
|
|
3028
3103
|
</div>
|
|
3029
3104
|
<div class="adr-badges">
|
|
3030
|
-
<span class="adr-status" style="color:${
|
|
3105
|
+
<span class="adr-status" style="color:${e.color};background:${e.bg}">${g(e.label)}</span>
|
|
3031
3106
|
</div>
|
|
3032
3107
|
</header>
|
|
3033
3108
|
|
|
@@ -3039,20 +3114,20 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
3039
3114
|
${this.supersedes.length?`
|
|
3040
3115
|
<div class="adr-links">
|
|
3041
3116
|
<span class="adr-links-label">Supersedes</span>
|
|
3042
|
-
${this.supersedes.map(
|
|
3117
|
+
${this.supersedes.map(a=>`<a class="adr-link" href="#${g(a)}">${A(R.arrowRight)} ${g(a)}</a>`).join("")}
|
|
3043
3118
|
</div>`:""}
|
|
3044
3119
|
|
|
3045
3120
|
${this.supersededBy.length?`
|
|
3046
3121
|
<div class="adr-links">
|
|
3047
3122
|
<span class="adr-links-label">Superseded by</span>
|
|
3048
|
-
${this.supersededBy.map(
|
|
3123
|
+
${this.supersededBy.map(a=>`<a class="adr-link" href="#${g(a)}">${A(R.arrowRight)} ${g(a)}</a>`).join("")}
|
|
3049
3124
|
</div>`:""}
|
|
3050
3125
|
</div>
|
|
3051
3126
|
|
|
3052
3127
|
<div class="adr-sections">
|
|
3053
3128
|
<div class="adr-section">
|
|
3054
3129
|
<div class="adr-section-header">
|
|
3055
|
-
<div class="adr-section-icon context">${
|
|
3130
|
+
<div class="adr-section-icon context">${A(R.context)}</div>
|
|
3056
3131
|
<span class="adr-section-title">Context</span>
|
|
3057
3132
|
</div>
|
|
3058
3133
|
<div class="adr-section-content">
|
|
@@ -3062,7 +3137,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
3062
3137
|
|
|
3063
3138
|
<div class="adr-section">
|
|
3064
3139
|
<div class="adr-section-header">
|
|
3065
|
-
<div class="adr-section-icon decision">${
|
|
3140
|
+
<div class="adr-section-icon decision">${A(R.decision)}</div>
|
|
3066
3141
|
<span class="adr-section-title">Decision</span>
|
|
3067
3142
|
</div>
|
|
3068
3143
|
<div class="adr-section-content">
|
|
@@ -3072,7 +3147,7 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
3072
3147
|
|
|
3073
3148
|
<div class="adr-section">
|
|
3074
3149
|
<div class="adr-section-header">
|
|
3075
|
-
<div class="adr-section-icon consequences">${
|
|
3150
|
+
<div class="adr-section-icon consequences">${A(R.consequences)}</div>
|
|
3076
3151
|
<span class="adr-section-title">Consequences</span>
|
|
3077
3152
|
</div>
|
|
3078
3153
|
<div class="adr-section-content">
|
|
@@ -3081,5 +3156,6 @@ var Bt=window.matchMedia("(prefers-reduced-motion: reduce)");var mt=new Map;func
|
|
|
3081
3156
|
</div>
|
|
3082
3157
|
</div>
|
|
3083
3158
|
|
|
3084
|
-
</article>`,e==="compact")for(let r of this.shadowRoot.querySelectorAll(".adr-section")){let i=r.querySelector("slot");i&&i.assignedNodes().length===0&&r.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("adr-wc:ready",{detail:{adrId:this.adrId,title:this.adrTitle,status:this.status},bubbles:!0,composed:!0}))}};x("adr-wc",ht);var pt=class extends A{static get observedAttributes(){return["src","title","compact"]}#t=null;#e=null;#s=null;#a=0;setup(){let t=this.querySelector(":scope > ol");if(!t)return!1;let e=this.#r(t);if(e.length===0)return!1;t.style.display="none",t.setAttribute("aria-hidden","true");let s=this.getAttribute("title");s&&(this.#e=document.createElement("h2"),this.#e.className="fd-title",this.#e.textContent=s,this.insertBefore(this.#e,t)),this.#t=document.createElement("div"),this.#t.className="fd-container",this.#t.setAttribute("role","img"),this.#t.setAttribute("aria-label",`Flow diagram${s?": "+s:""}`),this.#a=0,this.#i(e,this.#t);let a=document.createElement("div");a.className="fd-summary",a.textContent=`${this.#a} step${this.#a!==1?"s":""}`,this.#t.appendChild(a),this.insertBefore(this.#t,t),this.#s=document.createElement("div"),this.#s.className="fd-live",this.#s.setAttribute("role","status"),this.#s.setAttribute("aria-live","polite"),this.#s.setAttribute("aria-atomic","true"),this.appendChild(this.#s),this.listen(this.#t,"click",r=>{let i=r.target.closest(".fd-node-shape");if(!i)return;let n=i.closest(".fd-node")?.dataset.type||"action",c=i.textContent?.trim()||"";this.#d(`Selected: ${c}`),this.dispatchEvent(new CustomEvent("flow-diagram:select",{bubbles:!0,detail:{type:n,text:c}}))}),this.dispatchEvent(new CustomEvent("flow-diagram:ready",{bubbles:!0,detail:{nodeCount:this.#a}}))}teardown(){this.#e&&(this.#e.remove(),this.#e=null),this.#t&&(this.#t.remove(),this.#t=null),this.#s&&(this.#s.remove(),this.#s=null);let t=this.querySelector("ol");t&&(t.style.display="",t.removeAttribute("aria-hidden")),this.#a=0}attributeChangedCallback(t,e,s){e===s||!this.isConnected||(t==="src"?this._loadSrc(s):this.hasAttribute("data-upgraded")&&(this.teardown(),this.removeAttribute("data-upgraded"),this.setup()))}#r(t){let e=[];for(let s of t.querySelectorAll(":scope > li")){let a=this.#o(s);a&&e.push(a)}return e}#o(t){let e=t.dataset.type||"action",s=t.dataset.annotation||"",a=[],r=t.querySelectorAll(":scope > ol > li[data-branch]");if(r.length>0)for(let o of r){let n=o.dataset.branch||"",c=o.querySelector(":scope > ol"),l=c?this.#r(c):[];a.push({label:n,steps:l})}let i="";for(let o of t.childNodes)(o.nodeType===Node.TEXT_NODE||o.nodeType===Node.ELEMENT_NODE&&o.tagName!=="OL")&&(i+=o.textContent);return i=i.trim(),{type:e,text:i,annotation:s,branches:a}}#i(t,e){for(let s=0;s<t.length;s++){let a=t[s];s>0&&e.appendChild(this.#n());let r=this.#l(a);if(e.appendChild(r),a.branches.length>0){let i=document.createElement("div");i.className="fd-branches",i.setAttribute("data-branch-count",String(a.branches.length));let o=document.createElement("div");o.className="fd-split-line",o.setAttribute("aria-hidden","true"),i.appendChild(o);let n=document.createElement("div");n.className="fd-branch-columns";let c=(50/a.branches.length).toFixed(2);n.style.setProperty("--fd-inset",`${c}%`);for(let l of a.branches){let h=document.createElement("div");h.className="fd-branch",h.appendChild(this.#n());let p=document.createElement("span");p.className="fd-branch-label",p.textContent=l.label,p.setAttribute("data-branch",l.label.toLowerCase()),h.appendChild(p),this.#i(l.steps,h),n.appendChild(h)}i.appendChild(n),e.appendChild(i)}}}#l(t){this.#a++;let e=document.createElement("div");e.className="fd-node",e.dataset.type=t.type;let s=document.createElement("div");if(s.className="fd-node-shape",s.setAttribute("tabindex","0"),s.setAttribute("role","img"),s.setAttribute("aria-label",`${t.type}: ${t.text}`),s.textContent=t.text,e.appendChild(s),t.annotation){let a=document.createElement("div");a.className="fd-annotation",a.textContent=t.annotation,e.appendChild(a)}return e}#n(t){let e=document.createElement("div");e.className="fd-connector",e.setAttribute("aria-hidden","true");let s=document.createElement("div");if(s.className="fd-connector-line",e.appendChild(s),t){let r=document.createElement("span");r.className="fd-connector-label",r.textContent=t,e.appendChild(r)}let a=document.createElement("div");return a.className="fd-connector-arrow",e.appendChild(a),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();for(;this.firstChild;)this.firstChild.remove();s.title&&this.setAttribute("title",s.title);let a=document.createElement("ol");this.#c(s.steps||[],a),this.appendChild(a),this.teardown(),this.removeAttribute("data-upgraded"),this.setup()}catch(e){console.warn(`[flow-diagram] Failed to load src="${t}":`,e)}}#c(t,e){for(let s of t){let a=document.createElement("li");if(s.type&&(a.dataset.type=s.type),s.annotation&&(a.dataset.annotation=s.annotation),a.textContent=s.text||"",s.branches&&s.branches.length>0){let r=document.createElement("ol");for(let i of s.branches){let o=document.createElement("li");o.dataset.branch=i.label||"";let n=document.createElement("ol");this.#c(i.steps||[],n),o.appendChild(n),r.appendChild(o)}a.appendChild(r)}e.appendChild(a)}}#d(t){this.#s&&(this.#s.textContent="",requestAnimationFrame(()=>{this.#s&&(this.#s.textContent=t)}))}};x("flow-diagram",pt);
|
|
3159
|
+
</article>`,s==="compact")for(let a of t.querySelectorAll(".adr-section")){let o=a.querySelector("slot");o&&o.assignedNodes().length===0&&a.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("adr-wc:ready",{detail:{adrId:this.adrId,title:this.adrTitle,status:this.status},bubbles:!0,composed:!0}))}};x("adr-wc",Nt);var Mt=class c extends C{static get observedAttributes(){return["src","title","compact"]}#e=null;#s=null;#t=null;#i=0;#r=[];setup(){let t=this.querySelector(":scope > ol");if(!t)return!1;let e=this.#n(t);if(e.length===0)return!1;this.#r=e,t.style.display="none",t.setAttribute("aria-hidden","true");let s=this.getAttribute("title");s&&(this.#s=document.createElement("h2"),this.#s.className="fd-title",this.#s.textContent=s,this.insertBefore(this.#s,t)),this.#e=document.createElement("div"),this.#e.className="fd-container",this.#e.setAttribute("role","img"),this.#e.setAttribute("aria-label",`Flow diagram${s?": "+s:""}`),this.#i=0,this.#c(e,this.#e);let r=document.createElement("div");return r.className="fd-summary",r.textContent=`${this.#i} step${this.#i!==1?"s":""}`,this.#e.appendChild(r),this.insertBefore(this.#e,t),this.#t=document.createElement("div"),this.#t.className="fd-live",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",i=>{let a=i.target.closest(".fd-node-shape");if(!a)return;let n=a.closest(".fd-node")?.dataset.type||"action",d=a.textContent?.trim()||"";this.#m(`Selected: ${d}`),this.dispatchEvent(new CustomEvent("flow-diagram:select",{bubbles:!0,detail:{type:n,text:d}}))}),this.dispatchEvent(new CustomEvent("flow-diagram:ready",{bubbles:!0,detail:{nodeCount:this.#i}})),!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("ol");t&&(t.style.display="",t.removeAttribute("aria-hidden")),this.#i=0}static#o=0;attributeChangedCallback(t,e,s){e===s||!this.isConnected||(t==="src"?this._loadSrc(s):this.hasAttribute("data-upgraded")&&this.#a())}#a(){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=`fd-vt-${++c.#o}`;this.style.viewTransitionName=e,document.startViewTransition(t).finished.finally(()=>{this.style.viewTransitionName=""})}else t()}get steps(){return this.#r}set steps(t){let e=Array.isArray(t)?t:[];this.#r=e,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 s=this.querySelector(":scope > ol");if(s||(s=document.createElement("ol"),s.style.display="none",s.setAttribute("aria-hidden","true"),this.appendChild(s)),e.length===0){this.dispatchEvent(new CustomEvent("flow-diagram:steps-changed",{detail:{steps:e,source:"property"},bubbles:!0}));return}let r=this.getAttribute("title");r&&(this.#s=document.createElement("h2"),this.#s.className="fd-title",this.#s.textContent=r,this.insertBefore(this.#s,s)),this.#e=document.createElement("div"),this.#e.className="fd-container",this.#e.setAttribute("role","img"),this.#e.setAttribute("aria-label",`Flow diagram${r?": "+r:""}`),this.#i=0,this.#c(e,this.#e);let i=document.createElement("div");i.className="fd-summary",i.textContent=`${this.#i} step${this.#i!==1?"s":""}`,this.#e.appendChild(i),this.insertBefore(this.#e,s),this.#t=document.createElement("div"),this.#t.className="fd-live",this.#t.setAttribute("role","status"),this.#t.setAttribute("aria-live","polite"),this.#t.setAttribute("aria-atomic","true"),this.appendChild(this.#t),this.dispatchEvent(new CustomEvent("flow-diagram:steps-changed",{detail:{steps:e,source:"property"},bubbles:!0}))}#n(t){let e=[];for(let s of t.querySelectorAll(":scope > li")){let r=this.#l(s);r&&e.push(r)}return e}#l(t){let e=t.dataset.type||"action",s=t.dataset.annotation||"",r=[],i=t.querySelectorAll(":scope > ol > li[data-branch]");if(i.length>0)for(let o of i){let n=o.dataset.branch||"",d=o.querySelector(":scope > ol"),l=d?this.#n(d):[];r.push({label:n,steps:l})}let a="";for(let o of t.childNodes)(o.nodeType===Node.TEXT_NODE||o.nodeType===Node.ELEMENT_NODE&&o.tagName!=="OL")&&(a+=o.textContent);return a=a.trim(),{type:e,text:a,annotation:s,branches:r}}#c(t,e){for(let s=0;s<t.length;s++){let r=t[s];s>0&&e.appendChild(this.#d());let i=this.#p(r);if(e.appendChild(i),r.branches.length>0){let a=document.createElement("div");a.className="fd-branches",a.setAttribute("data-branch-count",String(r.branches.length));let o=document.createElement("div");o.className="fd-split-line",o.setAttribute("aria-hidden","true"),a.appendChild(o);let n=document.createElement("div");n.className="fd-branch-columns";let d=(50/r.branches.length).toFixed(2);n.style.setProperty("--fd-inset",`${d}%`);for(let l of r.branches){let u=document.createElement("div");u.className="fd-branch",u.appendChild(this.#d());let h=document.createElement("span");h.className="fd-branch-label",h.textContent=l.label,h.setAttribute("data-branch",l.label.toLowerCase()),u.appendChild(h),this.#c(l.steps,u),n.appendChild(u)}a.appendChild(n),e.appendChild(a)}}}#p(t){this.#i++;let e=document.createElement("div");e.className="fd-node",e.dataset.type=t.type;let s=document.createElement("div");if(s.className="fd-node-shape",s.setAttribute("tabindex","0"),s.setAttribute("role","img"),s.setAttribute("aria-label",`${t.type}: ${t.text}`),s.textContent=t.text,e.appendChild(s),t.annotation){let r=document.createElement("div");r.className="fd-annotation",r.textContent=t.annotation,e.appendChild(r)}return e}#d(t){let e=document.createElement("div");e.className="fd-connector",e.setAttribute("aria-hidden","true");let s=document.createElement("div");if(s.className="fd-connector-line",e.appendChild(s),t){let i=document.createElement("span");i.className="fd-connector-label",i.textContent=t,e.appendChild(i)}let r=document.createElement("div");return r.className="fd-connector-arrow",e.appendChild(r),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();for(;this.firstChild;)this.firstChild.remove();s.title&&this.setAttribute("title",s.title);let r=document.createElement("ol");this.#u(s.steps||[],r),this.appendChild(r),this.#a()}catch(e){console.warn(`[flow-diagram] Failed to load src="${t}":`,e)}}#u(t,e){for(let s of t){let r=document.createElement("li");if(s.type&&(r.dataset.type=s.type),s.annotation&&(r.dataset.annotation=s.annotation),r.textContent=s.text||"",s.branches&&s.branches.length>0){let i=document.createElement("ol");for(let a of s.branches){let o=document.createElement("li");o.dataset.branch=a.label||"";let n=document.createElement("ol");this.#u(a.steps||[],n),o.appendChild(n),i.appendChild(o)}r.appendChild(i)}e.appendChild(r)}}#m(t){this.#t&&(this.#t.textContent="",requestAnimationFrame(()=>{this.#t&&(this.#t.textContent=t)}))}};x("flow-diagram",Mt);function S(c,t,e){return c.getPropertyValue(t).trim()||e}function L(c,t){if(!t)return t;let e=document.createElement("span");e.style.color=t,e.style.position="absolute",e.style.visibility="hidden",e.style.pointerEvents="none",(c.parentElement||document.body).appendChild(e);let s=getComputedStyle(e).color;if(e.remove(),!s)return t;let r=L,i=r._canvas||(r._canvas=document.createElement("canvas"));i.width=i.height=1;let a=r._ctx||(r._ctx=i.getContext("2d",{willReadFrequently:!0}));a.clearRect(0,0,1,1),a.fillStyle=s,a.fillRect(0,0,1,1);let[o,n,d,l]=a.getImageData(0,0,1,1).data;return l===255?`rgb(${o},${n},${d})`:`rgba(${o},${n},${d},${(l/255).toFixed(3)})`}function we(c){let t=getComputedStyle(c),e=L(c,S(t,"--color-text","#1a1a1a")),s=L(c,S(t,"--color-surface","#ffffff")),r=L(c,S(t,"--color-surface-raised",S(t,"--color-surface","#ffffff"))),i=L(c,S(t,"--color-border","#e0e0e0")),a=L(c,S(t,"--color-primary",S(t,"--color-interactive","#3b82f6"))),o=L(c,S(t,"--color-secondary",S(t,"--color-surface-raised","#f8f9fa"))),n=L(c,S(t,"--color-accent",S(t,"--color-primary","#3b82f6"))),d=L(c,S(t,"--color-text-muted",S(t,"--color-text","#1a1a1a"))),l=S(t,"--font-sans",'system-ui, -apple-system, "Segoe UI", sans-serif'),u=S(t,"--font-size-md","14px"),h=[a,n,o],m={};for(let p=0;p<12;p++)m[`cScale${p}`]=h[p%h.length],m[`cScaleLabel${p}`]=e,m[`cScalePeer${p}`]=i,m[`cScaleInv${p}`]=s;let f={};for(let p=0;p<8;p++)f[`git${p}`]=h[p%h.length],f[`gitInv${p}`]=s,f[`gitBranchLabel${p}`]=e;return{primaryColor:a,primaryBorderColor:i,primaryTextColor:e,nodeTextColor:e,secondaryColor:o,secondaryBorderColor:i,secondaryTextColor:e,tertiaryColor:n,tertiaryBorderColor:i,tertiaryTextColor:e,background:s,mainBkg:s,secondBkg:r,tertiaryBkg:r,lineColor:i,nodeBorder:i,gridColor:i,defaultLinkColor:d,clusterBkg:r,clusterBorder:i,actorBkg:s,actorBorder:i,actorTextColor:e,actorLineColor:i,signalColor:e,signalTextColor:e,labelBoxBkgColor:r,labelBoxBorderColor:i,labelTextColor:e,loopTextColor:e,noteBkgColor:r,noteBorderColor:i,noteTextColor:e,edgeLabelBackground:s,titleColor:e,fontFamily:l,fontSize:u,...m,...f}}function Xt(c,t={}){return{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:t.themeBase||"base",themeVariables:we(c)}}var _e="https://cdn.jsdelivr.net/npm/mermaid@11.14.0/dist/mermaid.esm.min.mjs",Qt=new Map;function Ae(c){let t=c||typeof window<"u"&&window.VB_MERMAID_URL||_e,e=Qt.get(t);return e||(e=import(t).then(s=>s.default||s),Qt.set(t,e)),e}var Lt=class c extends C{static#e=0;static#s=0;#t=null;#i=null;#r=null;#o=null;#a=null;#n=!1;setup(){this.hasAttribute("type")||this.setAttribute("type","mermaid");let t=this.getAttribute("min-height");t&&(this.style.minBlockSize=t);let e=this.querySelector(":scope > pre");e&&(this.#i=document.createElement("template"),this.#i.appendChild(e.cloneNode(!0)),this.#t=this.#u(e),this.setAttribute("data-rendering",""));let s=this.querySelector(":scope > .dwc-figure");s&&(this.#r=s,this.#n=!0,this.removeAttribute("data-rendering")),this.listen(window,"vb:theme-change",()=>{this.#a&&clearTimeout(this.#a),this.#a=setTimeout(()=>{this.#n&&this.#c()},50)});let r=this.getAttribute("src");r?this.#m(r).then(()=>this.#l()):this.#t&&this.#l()}teardown(){if(this.#o&&(this.#o.disconnect(),this.#o=null),this.#a&&(clearTimeout(this.#a),this.#a=null),this.#r&&(this.#r.remove(),this.#r=null),this.#i){let t=this.#i.content.firstElementChild;t&&!this.querySelector(":scope > pre")&&this.appendChild(t.cloneNode(!0))}this.#n=!1}#l(){if(this.getAttribute("loading")!=="lazy"){this.#c();return}if(!("IntersectionObserver"in window)){this.#c();return}this.#o=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting){this.#o?.disconnect(),this.#o=null,this.#c();break}},{rootMargin:"200px"}),this.#o.observe(this)}async#c(){if(!this.#t)return;let t=this.getAttribute("type")||"mermaid";if(t!=="mermaid"){this.#d(new Error(`Unsupported diagram type "${t}". v1 supports "mermaid" only.`));return}try{let e=await Ae(this.dataset.mermaidSrc),s=Xt(this,{themeBase:this.dataset.themeBase||"base"});e.initialize(s);let r=`diagram-wc-${++c.#e}`,{svg:i}=await e.render(r,this.#t);this.#p(i),this.#n=!0,this.removeAttribute("data-rendering"),this.removeAttribute("data-error"),this.querySelector(":scope > .dwc-error")?.remove(),this.dispatchEvent(new CustomEvent("diagram-wc:ready",{bubbles:!0,detail:{svg:i,type:t,source:this.#t}}))}catch(e){this.removeAttribute("data-rendering"),this.#n||this.setAttribute("data-error",""),this.#d(e)}}#p(t){let e=document.createElement("figure");e.className="dwc-figure",e.setAttribute("role","img");let s=this.getAttribute("caption")||`${this.getAttribute("type")||"diagram"} diagram`;e.setAttribute("aria-label",s),e.innerHTML=t;let r=this.getAttribute("caption");if(r){let o=document.createElement("figcaption");o.className="dwc-caption",o.textContent=r,e.appendChild(o)}let i=this.#r,a=()=>{i&&i.isConnected?i.replaceWith(e):this.appendChild(e),this.querySelector(":scope > pre")?.remove(),this.#r=e};if(i?.isConnected&&"startViewTransition"in document&&!matchMedia("(prefers-reduced-motion: reduce)").matches){let o=`dwc-vt-${++c.#s}`;i.style.viewTransitionName=o,e.style.viewTransitionName=o,document.startViewTransition(a).finished.finally(()=>{e.style.viewTransitionName=""})}else a()}#d(t){if(!this.#n){if(!this.querySelector(":scope > pre")&&this.#i){let r=this.#i.content.firstElementChild;r&&this.appendChild(r.cloneNode(!0))}this.#r&&(this.#r.remove(),this.#r=null)}this.querySelector(":scope > .dwc-error")?.remove();let e=document.createElement("p");e.className="dwc-error",e.setAttribute("role","status");let s=(t.message||String(t)).split(`
|
|
3160
|
+
`)[0].slice(0,240);e.textContent=`Diagram syntax error: ${s}`,this.appendChild(e),this.dispatchEvent(new CustomEvent("diagram-wc:error",{bubbles:!0,detail:{error:t,source:this.#t,type:this.getAttribute("type")}}))}#u(t){let e=t.querySelector("code");return(e?e.textContent:t.textContent)||""}async#m(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);this.#t=await e.text()}catch(e){this.#d(e)}}get source(){return this.#t||""}set source(t){let e=String(t||"");e!==this.#t&&(this.#t=e,this.#r&&(this.#r.remove(),this.#r=null),this.querySelector(":scope > .dwc-error")?.remove(),this.dispatchEvent(new CustomEvent("diagram-wc:source-changed",{bubbles:!0,detail:{source:e}})),this.#c())}get svg(){return this.#r?.querySelector("svg")?.outerHTML||""}};x("diagram-wc",Lt);
|
|
3085
3161
|
//# sourceMappingURL=ux-planning.full.js.map
|