@mhmo91/schmancy 0.9.18 → 0.9.20
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/agent/{flow-CaPi2G8y.js.map → flow-3RrZM-e7.js.map} +1 -1
- package/dist/agent/index.es-Dymj8REP.js +489 -0
- package/dist/agent/index.es-Dymj8REP.js.map +1 -0
- package/dist/agent/{rolldown-runtime-DsMetpgY.js → rolldown-runtime-BIIoCavz.js} +9 -2
- package/dist/agent/schmancy.agent.js +3330 -3805
- package/dist/agent/schmancy.agent.js.map +1 -1
- package/dist/agent/{vendor-highlight-CHJZQQB7.js → vendor-highlight-BmnMldIa.js} +90 -85
- package/dist/agent/{vendor-highlight-CHJZQQB7.js.map → vendor-highlight-BmnMldIa.js.map} +1 -1
- package/dist/agent/{vendor-jsqr-r7GNh4P3.js → vendor-jsqr-1wQ5xc49.js} +1 -1
- package/dist/agent/{vendor-jsqr-r7GNh4P3.js.map → vendor-jsqr-1wQ5xc49.js.map} +1 -1
- package/dist/agent/{vendor-material-color-Be96dpGE.js.map → vendor-material-color-33Mj762T.js.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/{code-highlight-zSYcSfCz.cjs → code-highlight-B_l8vDzn.cjs} +11 -11
- package/dist/code-highlight-B_l8vDzn.cjs.map +1 -0
- package/dist/{code-highlight-BgExKEto.js → code-highlight-CI_gqXYX.js} +30 -22
- package/dist/code-highlight-CI_gqXYX.js.map +1 -0
- package/dist/code-highlight.cjs +1 -1
- package/dist/code-highlight.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{flow-BGkHnOnd.js.map → flow-BPDtbhLe.js.map} +1 -1
- package/dist/{flow-ClAJ6Qby.cjs.map → flow-Dn9AZktE.cjs.map} +1 -1
- package/dist/handover/agent-runtime-followups.md +1 -1
- package/dist/handover/agent-runtime-v1.md +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.es-BgmFX1JM.cjs +1 -0
- package/dist/index.es-BgmFX1JM.cjs.map +1 -0
- package/dist/index.es-CLyb_o3Y.js +489 -0
- package/dist/index.es-CLyb_o3Y.js.map +1 -0
- package/dist/index.js +5 -5
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/navigation-bar.cjs +1 -1
- package/dist/navigation-bar.js +1 -1
- package/dist/{splash-screen-COg3Z6n8.js.map → splash-screen-BHgb3c3Q.js.map} +1 -1
- package/dist/{splash-screen-C9HqX2nR.cjs.map → splash-screen-DteUfSV3.cjs.map} +1 -1
- package/dist/splash-screen.cjs +1 -1
- package/dist/splash-screen.js +1 -1
- package/dist/{src-C7niWYur.js → src-Dw-PjtMH.js} +5 -5
- package/dist/{src-C7niWYur.js.map → src-Dw-PjtMH.js.map} +1 -1
- package/dist/{src-I4M33WK2.cjs → src-sG7Ihf0e.cjs} +1 -1
- package/dist/{src-I4M33WK2.cjs.map → src-sG7Ihf0e.cjs.map} +1 -1
- package/dist/{table-B-DsOqzT.cjs → table-DFlJhG5E.cjs} +1 -1
- package/dist/{table-B-DsOqzT.cjs.map → table-DFlJhG5E.cjs.map} +1 -1
- package/dist/{table-hBEZRxM_.js → table-Dwt66SR6.js} +1 -1
- package/dist/{table-hBEZRxM_.js.map → table-Dwt66SR6.js.map} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/dist/typewriter.cjs +123 -1
- package/dist/typewriter.cjs.map +1 -0
- package/dist/typewriter.js +214 -2
- package/dist/typewriter.js.map +1 -0
- package/dist/{utils-xBXLvebz.js.map → utils-Bp2jhyZc.js.map} +1 -1
- package/dist/{utils-2qrmPb78.cjs.map → utils-CBPQvxNW.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/src/code-highlight/code-highlight.ts +56 -24
- package/src/typewriter/typewriter.ts +26 -4
- package/types/src/code-highlight/code-highlight.d.ts +8 -1
- package/types/src/typewriter/typewriter.d.ts +4 -1
- package/dist/code-highlight-BgExKEto.js.map +0 -1
- package/dist/code-highlight-zSYcSfCz.cjs.map +0 -1
- package/dist/typewriter-DyN7xa0n.js +0 -701
- package/dist/typewriter-DyN7xa0n.js.map +0 -1
- package/dist/typewriter-LK0S4NEr.cjs +0 -123
- package/dist/typewriter-LK0S4NEr.cjs.map +0 -1
- /package/dist/agent/{flow-CaPi2G8y.js → flow-3RrZM-e7.js} +0 -0
- /package/dist/agent/{vendor-material-color-Be96dpGE.js → vendor-material-color-33Mj762T.js} +0 -0
- /package/dist/{flow-BGkHnOnd.js → flow-BPDtbhLe.js} +0 -0
- /package/dist/{flow-ClAJ6Qby.cjs → flow-Dn9AZktE.cjs} +0 -0
- /package/dist/{splash-screen-COg3Z6n8.js → splash-screen-BHgb3c3Q.js} +0 -0
- /package/dist/{splash-screen-C9HqX2nR.cjs → splash-screen-DteUfSV3.cjs} +0 -0
- /package/dist/{utils-xBXLvebz.js → utils-Bp2jhyZc.js} +0 -0
- /package/dist/{utils-2qrmPb78.cjs → utils-CBPQvxNW.cjs} +0 -0
package/dist/badge.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-sG7Ihf0e.cjs`);Object.defineProperty(exports,`ScBadgeV2`,{enumerable:!0,get:function(){return e.T}}),Object.defineProperty(exports,`SchmancyBadgeV2`,{enumerable:!0,get:function(){return e.E}});
|
package/dist/badge.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { E as e, T as t } from "./src-
|
|
1
|
+
import { E as e, T as t } from "./src-Dw-PjtMH.js";
|
|
2
2
|
export { t as ScBadgeV2, e as SchmancyBadgeV2 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
require(`./chunk-CncqDLb2.cjs`);const e=require(`./tailwind.mixin-Bh58QnlW.cjs`),t=require(`./decorate-F9CuyeHg.cjs`);require(`./mixins.cjs`);let n=require(`rxjs`),r=require(`rxjs/operators`),i=require(`lit/decorators.js`),a=require(`lit`),o=require(`lit/directives/unsafe-html.js`);var s=null,c=class extends e.t(a.css`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
width: 100%;
|
|
@@ -118,8 +118,8 @@ const e=require(`./chunk-CncqDLb2.cjs`),t=require(`./tailwind.mixin-Bh58QnlW.cjs
|
|
|
118
118
|
user-select: none;
|
|
119
119
|
font-size: inherit;
|
|
120
120
|
}
|
|
121
|
-
`){constructor(...e){super(...e),this.language=`javascript`,this.code=``,this.lineNumbers=!1,this.copyButton=!0,this.copied=!1}
|
|
122
|
-
`),n=this.getHighlightedLines();return t.map((e,t)=>{let r=t+1,i=n.has(r)?`code-line highlighted`:`code-line`,a=``;return this.lineNumbers&&(a+=`<span class="line-number">${r}</span>`),a+=e,`<div class="${i}">${a}</div>`}).join(``)}async copyCode(){try{await navigator.clipboard.writeText(this.code),this.copied=!0,setTimeout(()=>{this.copied=!1},2e3)}catch{}}getLanguageLabel(){return this.filename?this.filename:{javascript:`JavaScript`,typescript:`TypeScript`,html:`HTML`,markdown:`Markdown`,bash:`Bash`}[this.language.toLowerCase()]||this.language.toUpperCase()}render(){let e=this.lineNumbers||this.highlightLines?`code-with-lines`:`hljs`;return
|
|
121
|
+
`){constructor(...e){super(...e),this.language=`javascript`,this.code=``,this.lineNumbers=!1,this.copyButton=!0,this.copied=!1,this._highlightedCode=``}updated(e){super.updated?.(e),(e.has(`code`)||e.has(`language`)||e.has(`lineNumbers`)||e.has(`highlightLines`))&&this._rehighlight()}async _rehighlight(){if(!this.code)return void(this._highlightedCode=``);let e=await(s||=Promise.all([import(`highlight.js/lib/core`),import(`highlight.js/lib/languages/bash`),import(`highlight.js/lib/languages/javascript`),import(`highlight.js/lib/languages/markdown`),import(`highlight.js/lib/languages/typescript`),import(`highlight.js/lib/languages/xml`)]).then(([e,t,n,r,i,a])=>{let o=e.default;return o.registerLanguage(`javascript`,n.default),o.registerLanguage(`typescript`,i.default),o.registerLanguage(`html`,a.default),o.registerLanguage(`xml`,a.default),o.registerLanguage(`markdown`,r.default),o.registerLanguage(`bash`,t.default),o}));if(!this.isConnected)return;let t=``;try{t=e.highlight(this.code.trim(),{language:this.language}).value}catch{try{t=e.highlightAuto(this.code.trim()).value}catch{t=this.escapeHtml(this.code.trim())}}this.lineNumbers||this.highlightLines?this._highlightedCode=this.addLineFeatures(t):this._highlightedCode=t}escapeHtml(e){let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}getHighlightedLines(){let e=new Set;if(!this.highlightLines)return e;let t=this.highlightLines.split(`,`);for(let n of t){let t=n.trim();if(t.includes(`-`)){let[n,r]=t.split(`-`).map(e=>parseInt(e.trim()));if(!isNaN(n)&&!isNaN(r))for(let t=n;t<=r;t++)e.add(t)}else{let n=parseInt(t);isNaN(n)||e.add(n)}}return e}addLineFeatures(e){let t=e.split(`
|
|
122
|
+
`),n=this.getHighlightedLines();return t.map((e,t)=>{let r=t+1,i=n.has(r)?`code-line highlighted`:`code-line`,a=``;return this.lineNumbers&&(a+=`<span class="line-number">${r}</span>`),a+=e,`<div class="${i}">${a}</div>`}).join(``)}async copyCode(){try{await navigator.clipboard.writeText(this.code),this.copied=!0,setTimeout(()=>{this.copied=!1},2e3)}catch{}}getLanguageLabel(){return this.filename?this.filename:{javascript:`JavaScript`,typescript:`TypeScript`,html:`HTML`,markdown:`Markdown`,bash:`Bash`}[this.language.toLowerCase()]||this.language.toUpperCase()}render(){let e=this.lineNumbers||this.highlightLines?`code-with-lines`:`hljs`;return a.html`
|
|
123
123
|
<schmancy-details class="bg-surface-default">
|
|
124
124
|
<section slot="summary">
|
|
125
125
|
<!-- Header -->
|
|
@@ -135,7 +135,7 @@ const e=require(`./chunk-CncqDLb2.cjs`),t=require(`./tailwind.mixin-Bh58QnlW.cjs
|
|
|
135
135
|
${this.getLanguageLabel()}
|
|
136
136
|
</span>
|
|
137
137
|
</div>
|
|
138
|
-
${this.copyButton?
|
|
138
|
+
${this.copyButton?a.html`
|
|
139
139
|
<schmancy-button
|
|
140
140
|
.variant="${this.copied?`filled tonal`:`text`}"
|
|
141
141
|
@click=${this.copyCode}
|
|
@@ -149,17 +149,17 @@ const e=require(`./chunk-CncqDLb2.cjs`),t=require(`./tailwind.mixin-Bh58QnlW.cjs
|
|
|
149
149
|
</section>
|
|
150
150
|
<!-- Code -->
|
|
151
151
|
<div class="overflow-auto" style="${this.maxHeight?`max-height: ${this.maxHeight}`:``}">
|
|
152
|
-
<pre class="m-0"><code class="${e}">${(0,
|
|
152
|
+
<pre class="m-0"><code class="${e}">${(0,o.unsafeHTML)(this._highlightedCode)}</code></pre>
|
|
153
153
|
</div>
|
|
154
154
|
</schmancy-details>
|
|
155
|
-
`}};
|
|
155
|
+
`}};t.t([(0,i.property)({type:String})],c.prototype,`language`,void 0),t.t([(0,i.property)({type:String})],c.prototype,`code`,void 0),t.t([(0,i.property)({type:String})],c.prototype,`filename`,void 0),t.t([(0,i.property)({type:Boolean})],c.prototype,`lineNumbers`,void 0),t.t([(0,i.property)({type:Boolean})],c.prototype,`copyButton`,void 0),t.t([(0,i.property)({type:String})],c.prototype,`highlightLines`,void 0),t.t([(0,i.property)({type:String})],c.prototype,`maxHeight`,void 0),t.t([(0,i.state)()],c.prototype,`copied`,void 0),t.t([(0,i.state)()],c.prototype,`_highlightedCode`,void 0),c=t.t([(0,i.customElement)(`schmancy-code`)],c);var l=class extends e.t(a.css`:host{
|
|
156
156
|
display:block;
|
|
157
157
|
overflow:hidden;
|
|
158
158
|
position:relative;
|
|
159
159
|
inset:0;
|
|
160
|
-
}`){constructor(...e){super(...e),this.language=`html`,this.layout=`vertical`,this.preview=!0,this.slotContent=``}connectedCallback(){super.connectedCallback(),(0,
|
|
160
|
+
}`){constructor(...e){super(...e),this.language=`html`,this.layout=`vertical`,this.preview=!0,this.slotContent=``}connectedCallback(){super.connectedCallback(),(0,n.timer)(0).pipe((0,r.take)(1)).subscribe(()=>{let e=this.shadowRoot?.querySelector(`slot`);if(e){let t=e.assignedNodes({flatten:!0}).map(e=>e.nodeType===Node.ELEMENT_NODE?e.outerHTML:e.nodeType===Node.TEXT_NODE&&e.textContent||``).join(``).split(`
|
|
161
161
|
`),n=t.filter(e=>e.trim().length>0).reduce((e,t)=>{let n=t.match(/^(\s*)/)?.[1].length||0;return Math.min(e,n)},1/0);this.slotContent=t.map(e=>e.slice(n)).join(`
|
|
162
|
-
`).trim()}})}render(){let e=this.layout===`horizontal`?`grid grid-cols-1 lg:grid-cols-2 gap-0`:`flex flex-col`,t=this.preview&&this.language.toLowerCase()===`html`;return
|
|
162
|
+
`).trim()}})}render(){let e=this.layout===`horizontal`?`grid grid-cols-1 lg:grid-cols-2 gap-0`:`flex flex-col`,t=this.preview&&this.language.toLowerCase()===`html`;return a.html`
|
|
163
163
|
<schmancy-surface class="rounded-lg overflow-hidden">
|
|
164
164
|
<div class="${t?e:``}">
|
|
165
165
|
<!-- Code section with proper overflow handling -->
|
|
@@ -173,13 +173,13 @@ const e=require(`./chunk-CncqDLb2.cjs`),t=require(`./tailwind.mixin-Bh58QnlW.cjs
|
|
|
173
173
|
</div>
|
|
174
174
|
|
|
175
175
|
<!-- Preview section (only visible for HTML and when preview is enabled) -->
|
|
176
|
-
${t?
|
|
176
|
+
${t?a.html`
|
|
177
177
|
<div class="min-w-0 overflow-auto">
|
|
178
178
|
<schmancy-surface type="solid" class="p-2 h-full">
|
|
179
179
|
<slot></slot>
|
|
180
180
|
</schmancy-surface>
|
|
181
181
|
</div>
|
|
182
|
-
`:
|
|
182
|
+
`:a.html`
|
|
183
183
|
<!-- Hidden slot to capture content -->
|
|
184
184
|
<div class="hidden">
|
|
185
185
|
<slot></slot>
|
|
@@ -187,4 +187,4 @@ const e=require(`./chunk-CncqDLb2.cjs`),t=require(`./tailwind.mixin-Bh58QnlW.cjs
|
|
|
187
187
|
`}
|
|
188
188
|
</div>
|
|
189
189
|
</schmancy-surface>
|
|
190
|
-
`}};
|
|
190
|
+
`}};t.t([(0,i.property)({type:String})],l.prototype,`language`,void 0),t.t([(0,i.property)({type:String})],l.prototype,`layout`,void 0),t.t([(0,i.property)({type:Boolean})],l.prototype,`preview`,void 0),t.t([(0,i.state)()],l.prototype,`slotContent`,void 0),l=t.t([(0,i.customElement)(`schmancy-code-preview`)],l),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-highlight-B_l8vDzn.cjs","names":[],"sources":["../src/code-highlight/code-highlight.ts","../src/code-highlight/code-preview.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'\n\n// highlight.js + all 6 language grammars are loaded lazily on first render.\n// Static imports were previously responsible for ~15 KB gzipped (vendor-\n// highlight chunk) being eagerly fetched on every agent-bundle first paint,\n// even for pages that never rendered <schmancy-code>. See ADR 0014 in the\n// parent monorepo.\ntype Hljs = typeof import('highlight.js/lib/core').default\n\nlet hljsPromise: Promise<Hljs> | null = null\nfunction loadHljs(): Promise<Hljs> {\n\tif (hljsPromise) return hljsPromise\n\thljsPromise = Promise.all([\n\t\timport('highlight.js/lib/core'),\n\t\timport('highlight.js/lib/languages/bash'),\n\t\timport('highlight.js/lib/languages/javascript'),\n\t\timport('highlight.js/lib/languages/markdown'),\n\t\timport('highlight.js/lib/languages/typescript'),\n\t\timport('highlight.js/lib/languages/xml'),\n\t]).then(([core, bash, javascript, markdown, typescript, xml]) => {\n\t\tconst hljs = core.default\n\t\thljs.registerLanguage('javascript', javascript.default)\n\t\thljs.registerLanguage('typescript', typescript.default)\n\t\thljs.registerLanguage('html', xml.default)\n\t\thljs.registerLanguage('xml', xml.default)\n\t\thljs.registerLanguage('markdown', markdown.default)\n\t\thljs.registerLanguage('bash', bash.default)\n\t\treturn hljs\n\t})\n\treturn hljsPromise\n}\n\n/**\n * @element schmancy-code\n * Code highlighting component using highlight.js with schmancy theming support\n */\n@customElement('schmancy-code')\nexport class SchmancyCode extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\twidth: 100%;\n\t\toverflow: hidden;\n\t}\n\n\t/* Code block styling using schmancy color system */\n\t.hljs {\n\t\tdisplay: block;\n\t\toverflow-x: auto;\n\t\tpadding: 0.5em;\n\t\tcolor: var(--md-sys-color-on-surface-variant);\n\t\tbackground: var(--md-sys-color-surface-container-lowest);\n\t\tfont-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;\n\t}\n\n\t/* Comments and documentation */\n\t.hljs-comment,\n\t.hljs-quote {\n\t\tcolor: var(--md-sys-color-outline);\n\t\tfont-style: italic;\n\t}\n\n\t/* Keywords, doctags, formulas */\n\t.hljs-doctag,\n\t.hljs-keyword,\n\t.hljs-formula {\n\t\tcolor: var(--md-sys-color-primary);\n\t}\n\n\t/* Tags, sections, names, deletions */\n\t.hljs-section,\n\t.hljs-name,\n\t.hljs-selector-tag,\n\t.hljs-deletion,\n\t.hljs-subst {\n\t\tcolor: var(--md-sys-color-error);\n\t}\n\n\t/* Literals */\n\t.hljs-literal {\n\t\tcolor: var(--md-sys-color-tertiary);\n\t}\n\n\t/* Strings, regex, additions */\n\t.hljs-string,\n\t.hljs-regexp,\n\t.hljs-addition,\n\t.hljs-attribute,\n\t.hljs-meta-string {\n\t\tcolor: var(--md-sys-color-secondary);\n\t}\n\n\t/* Built-ins and class titles */\n\t.hljs-built_in,\n\t.hljs-class .hljs-title {\n\t\tcolor: var(--md-sys-color-tertiary);\n\t}\n\n\t/* Variables, attributes, types */\n\t.hljs-attr,\n\t.hljs-variable,\n\t.hljs-template-variable,\n\t.hljs-type,\n\t.hljs-selector-class,\n\t.hljs-selector-attr,\n\t.hljs-selector-pseudo,\n\t.hljs-number {\n\t\tcolor: var(--md-sys-color-on-surface);\n\t}\n\n\t/* Symbols, bullets, links, meta */\n\t.hljs-symbol,\n\t.hljs-bullet,\n\t.hljs-link,\n\t.hljs-meta,\n\t.hljs-selector-id,\n\t.hljs-title {\n\t\tcolor: var(--md-sys-color-secondary);\n\t}\n\n\t.hljs-emphasis {\n\t\tfont-style: italic;\n\t}\n\n\t.hljs-strong {\n\t\tfont-weight: bold;\n\t}\n\n\t.hljs-link {\n\t\ttext-decoration: underline;\n\t}\n\n\t/* Line features styling */\n\t.code-with-lines {\n\t\tbackground: transparent;\n\t\tpadding: 0;\n\t}\n\n\t.code-line {\n\t\tdisplay: block;\n\t\tpadding-left: 0;\n\t\ttransition: background-color 0.2s ease;\n\t}\n\n\t.code-line.highlighted {\n\t\tbackground-color: var(--md-sys-color-primary-container);\n\t\topacity: 0.2;\n\t}\n\n\t.line-number {\n\t\tdisplay: inline-block;\n\t\twidth: 3rem;\n\t\tpadding-right: 1rem;\n\t\ttext-align: right;\n\t\tcolor: var(--md-sys-color-outline);\n\t\tuser-select: none;\n\t\tfont-size: inherit;\n\t}\n`) {\n\t/**\n\t * Programming language for syntax highlighting\n\t */\n\t@property({ type: String })\n\tlanguage: string = 'javascript'\n\n\t/**\n\t * Code content to highlight\n\t */\n\t@property({ type: String })\n\tcode: string = ''\n\n\t/**\n\t * Optional filename or title to display in header\n\t */\n\t@property({ type: String })\n\tfilename?: string\n\n\t/**\n\t * Show line numbers\n\t */\n\t@property({ type: Boolean })\n\tlineNumbers: boolean = false\n\n\t/**\n\t * Show copy button\n\t */\n\t@property({ type: Boolean })\n\tcopyButton: boolean = true\n\n\t/**\n\t * Highlighted line numbers (comma-separated or ranges like \"1-3,5,7-9\")\n\t */\n\t@property({ type: String })\n\thighlightLines?: string\n\n\t/**\n\t * Maximum height before scrolling\n\t */\n\t@property({ type: String })\n\tmaxHeight?: string\n\n\t@state()\n\tprivate copied: boolean = false\n\n\t/**\n\t * Fully-rendered highlighted HTML — populated asynchronously after\n\t * `loadHljs()` resolves. Empty on first render (one microtask) for a\n\t * cold component; non-empty from then on.\n\t */\n\t@state()\n\tprivate _highlightedCode: string = ''\n\n\tprotected override updated(changed: Map<string, unknown>): void {\n\t\tsuper.updated?.(changed)\n\t\tif (changed.has('code') || changed.has('language') || changed.has('lineNumbers') || changed.has('highlightLines')) {\n\t\t\tvoid this._rehighlight()\n\t\t}\n\t}\n\n\tprivate async _rehighlight(): Promise<void> {\n\t\tif (!this.code) {\n\t\t\tthis._highlightedCode = ''\n\t\t\treturn\n\t\t}\n\t\tconst hljs = await loadHljs()\n\t\t// Guard against unmount + racing property changes.\n\t\tif (!this.isConnected) return\n\n\t\tlet highlightedHtml = ''\n\t\ttry {\n\t\t\tconst result = hljs.highlight(this.code.trim(), { language: this.language })\n\t\t\thighlightedHtml = result.value\n\t\t} catch {\n\t\t\ttry {\n\t\t\t\tconst result = hljs.highlightAuto(this.code.trim())\n\t\t\t\thighlightedHtml = result.value\n\t\t\t} catch {\n\t\t\t\thighlightedHtml = this.escapeHtml(this.code.trim())\n\t\t\t}\n\t\t}\n\n\t\tif (this.lineNumbers || this.highlightLines) {\n\t\t\tthis._highlightedCode = this.addLineFeatures(highlightedHtml)\n\t\t} else {\n\t\t\tthis._highlightedCode = highlightedHtml\n\t\t}\n\t}\n\n\tprivate escapeHtml(text: string): string {\n\t\tconst div = document.createElement('div')\n\t\tdiv.textContent = text\n\t\treturn div.innerHTML\n\t}\n\n\tprivate getHighlightedLines(): Set<number> {\n\t\tconst lines = new Set<number>()\n\t\tif (!this.highlightLines) return lines\n\n\t\tconst parts = this.highlightLines.split(',')\n\t\tfor (const part of parts) {\n\t\t\tconst trimmed = part.trim()\n\t\t\tif (trimmed.includes('-')) {\n\t\t\t\tconst [start, end] = trimmed.split('-').map(n => parseInt(n.trim()))\n\t\t\t\tif (!isNaN(start) && !isNaN(end)) {\n\t\t\t\t\tfor (let i = start; i <= end; i++) {\n\t\t\t\t\t\tlines.add(i)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst lineNum = parseInt(trimmed)\n\t\t\t\tif (!isNaN(lineNum)) {\n\t\t\t\t\tlines.add(lineNum)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn lines\n\t}\n\n\tprivate addLineFeatures(highlightedHtml: string): string {\n\t\tconst lines = highlightedHtml.split('\\n')\n\t\tconst highlightedLines = this.getHighlightedLines()\n\n\t\treturn lines\n\t\t\t.map((line, index) => {\n\t\t\t\tconst lineNumber = index + 1\n\t\t\t\tconst isHighlighted = highlightedLines.has(lineNumber)\n\t\t\t\tconst lineClass = isHighlighted ? 'code-line highlighted' : 'code-line'\n\n\t\t\t\tlet content = ''\n\t\t\t\tif (this.lineNumbers) {\n\t\t\t\t\tcontent += `<span class=\"line-number\">${lineNumber}</span>`\n\t\t\t\t}\n\t\t\t\tcontent += line\n\n\t\t\t\treturn `<div class=\"${lineClass}\">${content}</div>`\n\t\t\t})\n\t\t\t.join('')\n\t}\n\n\tprivate async copyCode() {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(this.code)\n\t\t\tthis.copied = true\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.copied = false\n\t\t\t}, 2000)\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy code:', err)\n\t\t}\n\t}\n\n\tprivate getLanguageLabel(): string {\n\t\tconst languageMap: Record<string, string> = {\n\t\t\tjavascript: 'JavaScript',\n\t\t\ttypescript: 'TypeScript',\n\t\t\thtml: 'HTML',\n\t\t\tmarkdown: 'Markdown',\n\t\t\tbash: 'Bash',\n\t\t}\n\n\t\tif (this.filename) {\n\t\t\treturn this.filename\n\t\t}\n\n\t\treturn languageMap[this.language.toLowerCase()] || this.language.toUpperCase()\n\t}\n\n\trender() {\n\t\tconst codeClass = this.lineNumbers || this.highlightLines ? 'code-with-lines' : 'hljs'\n\n\t\treturn html`\n\t\t\t<schmancy-details class=\"bg-surface-default\">\n\t\t\t\t<section slot=\"summary\">\n\t\t\t\t\t<!-- Header -->\n\t\t\t\t\t<div class=\"flex items-center justify-between\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t<div class=\"flex gap-1.5\">\n\t\t\t\t\t\t\t\t<div class=\"w-3 h-3 rounded-full opacity-60\" style=\"background-color: var(--md-sys-color-error);\"></div>\n\t\t\t\t\t\t\t\t<div class=\"w-3 h-3 rounded-full opacity-60\" style=\"background-color: var(--md-sys-color-tertiary);\"></div>\n\t\t\t\t\t\t\t\t<div class=\"w-3 h-3 rounded-full opacity-60\" style=\"background-color: var(--md-sys-color-secondary);\"></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<span class=\"text-xs font-medium opacity-70 ml-2\" style=\"color: var(--md-sys-color-on-surface-variant);\">\n\t\t\t\t\t\t\t\t${this.getLanguageLabel()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t${this.copyButton\n\t\t\t\t\t\t\t? html`\n\t\t\t\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t\t\t\t.variant=\"${this.copied ? 'filled tonal' : 'text'}\"\n\t\t\t\t\t\t\t\t\t\t@click=${this.copyCode}\n\t\t\t\t\t\t\t\t\t\tclass=\"transition-all\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<schmancy-icon > ${this.copied ? 'check' : 'content_copy'} </schmancy-icon>\n\t\t\t\t\t\t\t\t\t\t<span class=\"ml-1\">${this.copied ? 'Copied!' : 'Copy'}</span>\n\t\t\t\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t\t\t\t`\n\t\t\t\t\t\t\t: ''}\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t\t<!-- Code -->\n\t\t\t\t<div class=\"overflow-auto\" style=\"${this.maxHeight ? `max-height: ${this.maxHeight}` : ''}\">\n\t\t\t\t\t<pre class=\"m-0\"><code class=\"${codeClass}\">${unsafeHTML(this._highlightedCode)}</code></pre>\n\t\t\t\t</div>\n\t\t\t</schmancy-details>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-code': SchmancyCode\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { timer } from 'rxjs'\nimport { take } from 'rxjs/operators'\n\n/**\n * @element schmancy-code-preview\n * A component that shows code and its rendered preview side by side\n * Takes the content as a slot and displays both the source and rendered result\n */\n@customElement('schmancy-code-preview')\nexport class SchmancyCodePreview extends TailwindElement(\n\tcss`:host{\n\t\tdisplay:block;\n\t\toverflow:hidden;\n\t\tposition:relative;\n\t\tinset:0;\n\t}`\n) {\n\t/**\n\t * Programming language for syntax highlighting\n\t */\n\t@property({ type: String })\n\tlanguage: string = 'html'\n\n\t/**\n\t * Show code on top or side-by-side\n\t */\n\t@property({ type: String })\n\tlayout: 'vertical' | 'horizontal' = 'vertical'\n\n\t/**\n\t * Whether to render/execute the code in preview section\n\t * When false, only shows the code without rendering\n\t */\n\t@property({ type: Boolean })\n\tpreview: boolean = true\n\n\t@state()\n\tprivate slotContent: string = ''\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\t// Capture the slot content as HTML string\n\t\ttimer(0).pipe(take(1)).subscribe(() => {\n\t\t\tconst slot = this.shadowRoot?.querySelector('slot')\n\t\t\tif (slot) {\n\t\t\t\tconst nodes = slot.assignedNodes({ flatten: true })\n\t\t\t\tconst htmlStrings = nodes.map(node => {\n\t\t\t\t\tif (node.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\t\t\treturn (node as HTMLElement).outerHTML\n\t\t\t\t\t} else if (node.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\treturn node.textContent || ''\n\t\t\t\t\t}\n\t\t\t\t\treturn ''\n\t\t\t\t})\n\t\t\t\t\n\t\t\t\t// Clean up the HTML string\n\t\t\t\tconst rawContent = htmlStrings.join('')\n\t\t\t\t\n\t\t\t\t// Find the minimum indentation (excluding empty lines)\n\t\t\t\tconst lines = rawContent.split('\\n')\n\t\t\t\tconst minIndent = lines\n\t\t\t\t\t.filter(line => line.trim().length > 0)\n\t\t\t\t\t.reduce((min, line) => {\n\t\t\t\t\t\tconst indent = line.match(/^(\\s*)/)?.[1].length || 0\n\t\t\t\t\t\treturn Math.min(min, indent)\n\t\t\t\t\t}, Infinity)\n\t\t\t\t\n\t\t\t\t// Remove the minimum indentation from all lines\n\t\t\t\tthis.slotContent = lines\n\t\t\t\t\t.map(line => line.slice(minIndent))\n\t\t\t\t\t.join('\\n')\n\t\t\t\t\t.trim()\n\t\t\t}\n\t\t})\n\t}\n\n\trender() {\n\t\tconst containerClass = this.layout === 'horizontal' \n\t\t\t? 'grid grid-cols-1 lg:grid-cols-2 gap-0' \n\t\t\t: 'flex flex-col'\n\n\t\tconst showPreview = this.preview && this.language.toLowerCase() === 'html'\n\t\t\n\t\treturn html`\n\t\t\t<schmancy-surface class=\"rounded-lg overflow-hidden\">\n\t\t\t\t<div class=\"${showPreview ? containerClass : ''}\">\n\t\t\t\t\t<!-- Code section with proper overflow handling -->\n\t\t\t\t\t<div class=\"min-w-0 overflow-hidden\">\n\t\t\t\t\t\t<schmancy-code\n\t\t\t\t\t\t\tlanguage=\"${this.language}\"\n\t\t\t\t\t\t\t.code=\"${this.slotContent}\"\n\t\t\t\t\t\t\t?copyButton=\"${true}\"\n\t\t\t\t\t\t\tclass=\"block w-full\"\n\t\t\t\t\t\t></schmancy-code>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<!-- Preview section (only visible for HTML and when preview is enabled) -->\n\t\t\t\t\t${showPreview ? html`\n\t\t\t\t\t\t<div class=\"min-w-0 overflow-auto\">\n\t\t\t\t\t\t\t<schmancy-surface type=\"solid\" class=\"p-2 h-full\">\n\t\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t</schmancy-surface>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t` : html`\n\t\t\t\t\t\t<!-- Hidden slot to capture content -->\n\t\t\t\t\t\t<div class=\"hidden\">\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t`}\n\t\t\t\t</div>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-code-preview': SchmancyCodePreview\n\t}\n}"],"mappings":"2RAYA,IAAI,EAAoC,KA4BjC,EAAA,cAA2B,EAAA,EAAgB,EAAA,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA6HjC,aAAA,KAAA,KAMJ,GAAA,KAAA,YAAA,CAYQ,EAAA,KAAA,WAAA,CAMD,EAAA,KAAA,OAAA,CAeI,EAAA,KAAA,iBAQS,GAEnC,QAA2B,EAAA,CAC1B,MAAM,UAAU,EAAA,EACZ,EAAQ,IAAI,OAAA,EAAW,EAAQ,IAAI,WAAA,EAAe,EAAQ,IAAI,cAAA,EAAkB,EAAQ,IAAI,iBAAA,GAC1F,KAAK,cAAA,CAIZ,MAAA,cAAc,CACb,GAAA,CAAK,KAAK,KAET,OAAA,KADA,KAAK,iBAAmB,IAGzB,IAAM,EAAA,MApNH,AACJ,IAAc,QAAQ,IAAI,CACzB,OAAO,yBACP,OAAO,mCACP,OAAO,yCACP,OAAO,uCACP,OAAO,yCACP,OAAO,kCAAA,CAAA,CACL,MAAA,CAAO,EAAM,EAAM,EAAY,EAAU,EAAY,KAAA,CACvD,IAAM,EAAO,EAAK,QAOlB,OANA,EAAK,iBAAiB,aAAc,EAA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8 @@ import { timer as n } from "rxjs";
|
|
|
5
5
|
import { take as r } from "rxjs/operators";
|
|
6
6
|
import { customElement as i, property as a, state as o } from "lit/decorators.js";
|
|
7
7
|
import { css as s, html as c } from "lit";
|
|
8
|
-
import l from "
|
|
9
|
-
|
|
10
|
-
import d from "highlight.js/lib/languages/javascript";
|
|
11
|
-
import f from "highlight.js/lib/languages/markdown";
|
|
12
|
-
import p from "highlight.js/lib/languages/typescript";
|
|
13
|
-
import m from "highlight.js/lib/languages/xml";
|
|
14
|
-
import { unsafeHTML as h } from "lit/directives/unsafe-html.js";
|
|
15
|
-
l.registerLanguage("javascript", d), l.registerLanguage("typescript", p), l.registerLanguage("html", m), l.registerLanguage("xml", m), l.registerLanguage("markdown", f), l.registerLanguage("bash", u);
|
|
16
|
-
var g = class extends e(s`
|
|
8
|
+
import { unsafeHTML as l } from "lit/directives/unsafe-html.js";
|
|
9
|
+
var u = null, d = class extends e(s`
|
|
17
10
|
:host {
|
|
18
11
|
display: block;
|
|
19
12
|
width: 100%;
|
|
@@ -135,21 +128,36 @@ var g = class extends e(s`
|
|
|
135
128
|
}
|
|
136
129
|
`) {
|
|
137
130
|
constructor(...e) {
|
|
138
|
-
super(...e), this.language = "javascript", this.code = "", this.lineNumbers = !1, this.copyButton = !0, this.copied = !1;
|
|
131
|
+
super(...e), this.language = "javascript", this.code = "", this.lineNumbers = !1, this.copyButton = !0, this.copied = !1, this._highlightedCode = "";
|
|
139
132
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
133
|
+
updated(e) {
|
|
134
|
+
super.updated?.(e), (e.has("code") || e.has("language") || e.has("lineNumbers") || e.has("highlightLines")) && this._rehighlight();
|
|
135
|
+
}
|
|
136
|
+
async _rehighlight() {
|
|
137
|
+
if (!this.code) return void (this._highlightedCode = "");
|
|
138
|
+
let e = await (u ||= Promise.all([
|
|
139
|
+
import("highlight.js/lib/core"),
|
|
140
|
+
import("highlight.js/lib/languages/bash"),
|
|
141
|
+
import("highlight.js/lib/languages/javascript"),
|
|
142
|
+
import("highlight.js/lib/languages/markdown"),
|
|
143
|
+
import("highlight.js/lib/languages/typescript"),
|
|
144
|
+
import("highlight.js/lib/languages/xml")
|
|
145
|
+
]).then(([e, t, n, r, i, a]) => {
|
|
146
|
+
let o = e.default;
|
|
147
|
+
return o.registerLanguage("javascript", n.default), o.registerLanguage("typescript", i.default), o.registerLanguage("html", a.default), o.registerLanguage("xml", a.default), o.registerLanguage("markdown", r.default), o.registerLanguage("bash", t.default), o;
|
|
148
|
+
}));
|
|
149
|
+
if (!this.isConnected) return;
|
|
150
|
+
let t = "";
|
|
143
151
|
try {
|
|
144
|
-
|
|
152
|
+
t = e.highlight(this.code.trim(), { language: this.language }).value;
|
|
145
153
|
} catch {
|
|
146
154
|
try {
|
|
147
|
-
|
|
155
|
+
t = e.highlightAuto(this.code.trim()).value;
|
|
148
156
|
} catch {
|
|
149
|
-
|
|
157
|
+
t = this.escapeHtml(this.code.trim());
|
|
150
158
|
}
|
|
151
159
|
}
|
|
152
|
-
|
|
160
|
+
this.lineNumbers || this.highlightLines ? this._highlightedCode = this.addLineFeatures(t) : this._highlightedCode = t;
|
|
153
161
|
}
|
|
154
162
|
escapeHtml(e) {
|
|
155
163
|
let t = document.createElement("div");
|
|
@@ -226,14 +234,14 @@ var g = class extends e(s`
|
|
|
226
234
|
</section>
|
|
227
235
|
<!-- Code -->
|
|
228
236
|
<div class="overflow-auto" style="${this.maxHeight ? `max-height: ${this.maxHeight}` : ""}">
|
|
229
|
-
<pre class="m-0"><code class="${e}">${
|
|
237
|
+
<pre class="m-0"><code class="${e}">${l(this._highlightedCode)}</code></pre>
|
|
230
238
|
</div>
|
|
231
239
|
</schmancy-details>
|
|
232
240
|
`;
|
|
233
241
|
}
|
|
234
242
|
};
|
|
235
|
-
t([a({ type: String })],
|
|
236
|
-
var
|
|
243
|
+
t([a({ type: String })], d.prototype, "language", void 0), t([a({ type: String })], d.prototype, "code", void 0), t([a({ type: String })], d.prototype, "filename", void 0), t([a({ type: Boolean })], d.prototype, "lineNumbers", void 0), t([a({ type: Boolean })], d.prototype, "copyButton", void 0), t([a({ type: String })], d.prototype, "highlightLines", void 0), t([a({ type: String })], d.prototype, "maxHeight", void 0), t([o()], d.prototype, "copied", void 0), t([o()], d.prototype, "_highlightedCode", void 0), d = t([i("schmancy-code")], d);
|
|
244
|
+
var f = class extends e(s`:host{
|
|
237
245
|
display:block;
|
|
238
246
|
overflow:hidden;
|
|
239
247
|
position:relative;
|
|
@@ -287,5 +295,5 @@ var _ = class extends e(s`:host{
|
|
|
287
295
|
`;
|
|
288
296
|
}
|
|
289
297
|
};
|
|
290
|
-
t([a({ type: String })],
|
|
291
|
-
export {
|
|
298
|
+
t([a({ type: String })], f.prototype, "language", void 0), t([a({ type: String })], f.prototype, "layout", void 0), t([a({ type: Boolean })], f.prototype, "preview", void 0), t([o()], f.prototype, "slotContent", void 0), f = t([i("schmancy-code-preview")], f);
|
|
299
|
+
export { d as n, f as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-highlight-CI_gqXYX.js","names":[],"sources":["../src/code-highlight/code-highlight.ts","../src/code-highlight/code-preview.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js'\n\n// highlight.js + all 6 language grammars are loaded lazily on first render.\n// Static imports were previously responsible for ~15 KB gzipped (vendor-\n// highlight chunk) being eagerly fetched on every agent-bundle first paint,\n// even for pages that never rendered <schmancy-code>. See ADR 0014 in the\n// parent monorepo.\ntype Hljs = typeof import('highlight.js/lib/core').default\n\nlet hljsPromise: Promise<Hljs> | null = null\nfunction loadHljs(): Promise<Hljs> {\n\tif (hljsPromise) return hljsPromise\n\thljsPromise = Promise.all([\n\t\timport('highlight.js/lib/core'),\n\t\timport('highlight.js/lib/languages/bash'),\n\t\timport('highlight.js/lib/languages/javascript'),\n\t\timport('highlight.js/lib/languages/markdown'),\n\t\timport('highlight.js/lib/languages/typescript'),\n\t\timport('highlight.js/lib/languages/xml'),\n\t]).then(([core, bash, javascript, markdown, typescript, xml]) => {\n\t\tconst hljs = core.default\n\t\thljs.registerLanguage('javascript', javascript.default)\n\t\thljs.registerLanguage('typescript', typescript.default)\n\t\thljs.registerLanguage('html', xml.default)\n\t\thljs.registerLanguage('xml', xml.default)\n\t\thljs.registerLanguage('markdown', markdown.default)\n\t\thljs.registerLanguage('bash', bash.default)\n\t\treturn hljs\n\t})\n\treturn hljsPromise\n}\n\n/**\n * @element schmancy-code\n * Code highlighting component using highlight.js with schmancy theming support\n */\n@customElement('schmancy-code')\nexport class SchmancyCode extends TailwindElement(css`\n\t:host {\n\t\tdisplay: block;\n\t\twidth: 100%;\n\t\toverflow: hidden;\n\t}\n\n\t/* Code block styling using schmancy color system */\n\t.hljs {\n\t\tdisplay: block;\n\t\toverflow-x: auto;\n\t\tpadding: 0.5em;\n\t\tcolor: var(--md-sys-color-on-surface-variant);\n\t\tbackground: var(--md-sys-color-surface-container-lowest);\n\t\tfont-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;\n\t}\n\n\t/* Comments and documentation */\n\t.hljs-comment,\n\t.hljs-quote {\n\t\tcolor: var(--md-sys-color-outline);\n\t\tfont-style: italic;\n\t}\n\n\t/* Keywords, doctags, formulas */\n\t.hljs-doctag,\n\t.hljs-keyword,\n\t.hljs-formula {\n\t\tcolor: var(--md-sys-color-primary);\n\t}\n\n\t/* Tags, sections, names, deletions */\n\t.hljs-section,\n\t.hljs-name,\n\t.hljs-selector-tag,\n\t.hljs-deletion,\n\t.hljs-subst {\n\t\tcolor: var(--md-sys-color-error);\n\t}\n\n\t/* Literals */\n\t.hljs-literal {\n\t\tcolor: var(--md-sys-color-tertiary);\n\t}\n\n\t/* Strings, regex, additions */\n\t.hljs-string,\n\t.hljs-regexp,\n\t.hljs-addition,\n\t.hljs-attribute,\n\t.hljs-meta-string {\n\t\tcolor: var(--md-sys-color-secondary);\n\t}\n\n\t/* Built-ins and class titles */\n\t.hljs-built_in,\n\t.hljs-class .hljs-title {\n\t\tcolor: var(--md-sys-color-tertiary);\n\t}\n\n\t/* Variables, attributes, types */\n\t.hljs-attr,\n\t.hljs-variable,\n\t.hljs-template-variable,\n\t.hljs-type,\n\t.hljs-selector-class,\n\t.hljs-selector-attr,\n\t.hljs-selector-pseudo,\n\t.hljs-number {\n\t\tcolor: var(--md-sys-color-on-surface);\n\t}\n\n\t/* Symbols, bullets, links, meta */\n\t.hljs-symbol,\n\t.hljs-bullet,\n\t.hljs-link,\n\t.hljs-meta,\n\t.hljs-selector-id,\n\t.hljs-title {\n\t\tcolor: var(--md-sys-color-secondary);\n\t}\n\n\t.hljs-emphasis {\n\t\tfont-style: italic;\n\t}\n\n\t.hljs-strong {\n\t\tfont-weight: bold;\n\t}\n\n\t.hljs-link {\n\t\ttext-decoration: underline;\n\t}\n\n\t/* Line features styling */\n\t.code-with-lines {\n\t\tbackground: transparent;\n\t\tpadding: 0;\n\t}\n\n\t.code-line {\n\t\tdisplay: block;\n\t\tpadding-left: 0;\n\t\ttransition: background-color 0.2s ease;\n\t}\n\n\t.code-line.highlighted {\n\t\tbackground-color: var(--md-sys-color-primary-container);\n\t\topacity: 0.2;\n\t}\n\n\t.line-number {\n\t\tdisplay: inline-block;\n\t\twidth: 3rem;\n\t\tpadding-right: 1rem;\n\t\ttext-align: right;\n\t\tcolor: var(--md-sys-color-outline);\n\t\tuser-select: none;\n\t\tfont-size: inherit;\n\t}\n`) {\n\t/**\n\t * Programming language for syntax highlighting\n\t */\n\t@property({ type: String })\n\tlanguage: string = 'javascript'\n\n\t/**\n\t * Code content to highlight\n\t */\n\t@property({ type: String })\n\tcode: string = ''\n\n\t/**\n\t * Optional filename or title to display in header\n\t */\n\t@property({ type: String })\n\tfilename?: string\n\n\t/**\n\t * Show line numbers\n\t */\n\t@property({ type: Boolean })\n\tlineNumbers: boolean = false\n\n\t/**\n\t * Show copy button\n\t */\n\t@property({ type: Boolean })\n\tcopyButton: boolean = true\n\n\t/**\n\t * Highlighted line numbers (comma-separated or ranges like \"1-3,5,7-9\")\n\t */\n\t@property({ type: String })\n\thighlightLines?: string\n\n\t/**\n\t * Maximum height before scrolling\n\t */\n\t@property({ type: String })\n\tmaxHeight?: string\n\n\t@state()\n\tprivate copied: boolean = false\n\n\t/**\n\t * Fully-rendered highlighted HTML — populated asynchronously after\n\t * `loadHljs()` resolves. Empty on first render (one microtask) for a\n\t * cold component; non-empty from then on.\n\t */\n\t@state()\n\tprivate _highlightedCode: string = ''\n\n\tprotected override updated(changed: Map<string, unknown>): void {\n\t\tsuper.updated?.(changed)\n\t\tif (changed.has('code') || changed.has('language') || changed.has('lineNumbers') || changed.has('highlightLines')) {\n\t\t\tvoid this._rehighlight()\n\t\t}\n\t}\n\n\tprivate async _rehighlight(): Promise<void> {\n\t\tif (!this.code) {\n\t\t\tthis._highlightedCode = ''\n\t\t\treturn\n\t\t}\n\t\tconst hljs = await loadHljs()\n\t\t// Guard against unmount + racing property changes.\n\t\tif (!this.isConnected) return\n\n\t\tlet highlightedHtml = ''\n\t\ttry {\n\t\t\tconst result = hljs.highlight(this.code.trim(), { language: this.language })\n\t\t\thighlightedHtml = result.value\n\t\t} catch {\n\t\t\ttry {\n\t\t\t\tconst result = hljs.highlightAuto(this.code.trim())\n\t\t\t\thighlightedHtml = result.value\n\t\t\t} catch {\n\t\t\t\thighlightedHtml = this.escapeHtml(this.code.trim())\n\t\t\t}\n\t\t}\n\n\t\tif (this.lineNumbers || this.highlightLines) {\n\t\t\tthis._highlightedCode = this.addLineFeatures(highlightedHtml)\n\t\t} else {\n\t\t\tthis._highlightedCode = highlightedHtml\n\t\t}\n\t}\n\n\tprivate escapeHtml(text: string): string {\n\t\tconst div = document.createElement('div')\n\t\tdiv.textContent = text\n\t\treturn div.innerHTML\n\t}\n\n\tprivate getHighlightedLines(): Set<number> {\n\t\tconst lines = new Set<number>()\n\t\tif (!this.highlightLines) return lines\n\n\t\tconst parts = this.highlightLines.split(',')\n\t\tfor (const part of parts) {\n\t\t\tconst trimmed = part.trim()\n\t\t\tif (trimmed.includes('-')) {\n\t\t\t\tconst [start, end] = trimmed.split('-').map(n => parseInt(n.trim()))\n\t\t\t\tif (!isNaN(start) && !isNaN(end)) {\n\t\t\t\t\tfor (let i = start; i <= end; i++) {\n\t\t\t\t\t\tlines.add(i)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst lineNum = parseInt(trimmed)\n\t\t\t\tif (!isNaN(lineNum)) {\n\t\t\t\t\tlines.add(lineNum)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn lines\n\t}\n\n\tprivate addLineFeatures(highlightedHtml: string): string {\n\t\tconst lines = highlightedHtml.split('\\n')\n\t\tconst highlightedLines = this.getHighlightedLines()\n\n\t\treturn lines\n\t\t\t.map((line, index) => {\n\t\t\t\tconst lineNumber = index + 1\n\t\t\t\tconst isHighlighted = highlightedLines.has(lineNumber)\n\t\t\t\tconst lineClass = isHighlighted ? 'code-line highlighted' : 'code-line'\n\n\t\t\t\tlet content = ''\n\t\t\t\tif (this.lineNumbers) {\n\t\t\t\t\tcontent += `<span class=\"line-number\">${lineNumber}</span>`\n\t\t\t\t}\n\t\t\t\tcontent += line\n\n\t\t\t\treturn `<div class=\"${lineClass}\">${content}</div>`\n\t\t\t})\n\t\t\t.join('')\n\t}\n\n\tprivate async copyCode() {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(this.code)\n\t\t\tthis.copied = true\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.copied = false\n\t\t\t}, 2000)\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy code:', err)\n\t\t}\n\t}\n\n\tprivate getLanguageLabel(): string {\n\t\tconst languageMap: Record<string, string> = {\n\t\t\tjavascript: 'JavaScript',\n\t\t\ttypescript: 'TypeScript',\n\t\t\thtml: 'HTML',\n\t\t\tmarkdown: 'Markdown',\n\t\t\tbash: 'Bash',\n\t\t}\n\n\t\tif (this.filename) {\n\t\t\treturn this.filename\n\t\t}\n\n\t\treturn languageMap[this.language.toLowerCase()] || this.language.toUpperCase()\n\t}\n\n\trender() {\n\t\tconst codeClass = this.lineNumbers || this.highlightLines ? 'code-with-lines' : 'hljs'\n\n\t\treturn html`\n\t\t\t<schmancy-details class=\"bg-surface-default\">\n\t\t\t\t<section slot=\"summary\">\n\t\t\t\t\t<!-- Header -->\n\t\t\t\t\t<div class=\"flex items-center justify-between\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<div class=\"flex items-center gap-2\">\n\t\t\t\t\t\t\t<div class=\"flex gap-1.5\">\n\t\t\t\t\t\t\t\t<div class=\"w-3 h-3 rounded-full opacity-60\" style=\"background-color: var(--md-sys-color-error);\"></div>\n\t\t\t\t\t\t\t\t<div class=\"w-3 h-3 rounded-full opacity-60\" style=\"background-color: var(--md-sys-color-tertiary);\"></div>\n\t\t\t\t\t\t\t\t<div class=\"w-3 h-3 rounded-full opacity-60\" style=\"background-color: var(--md-sys-color-secondary);\"></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<span class=\"text-xs font-medium opacity-70 ml-2\" style=\"color: var(--md-sys-color-on-surface-variant);\">\n\t\t\t\t\t\t\t\t${this.getLanguageLabel()}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t${this.copyButton\n\t\t\t\t\t\t\t? html`\n\t\t\t\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t\t\t\t.variant=\"${this.copied ? 'filled tonal' : 'text'}\"\n\t\t\t\t\t\t\t\t\t\t@click=${this.copyCode}\n\t\t\t\t\t\t\t\t\t\tclass=\"transition-all\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<schmancy-icon > ${this.copied ? 'check' : 'content_copy'} </schmancy-icon>\n\t\t\t\t\t\t\t\t\t\t<span class=\"ml-1\">${this.copied ? 'Copied!' : 'Copy'}</span>\n\t\t\t\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t\t\t\t`\n\t\t\t\t\t\t\t: ''}\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t\t<!-- Code -->\n\t\t\t\t<div class=\"overflow-auto\" style=\"${this.maxHeight ? `max-height: ${this.maxHeight}` : ''}\">\n\t\t\t\t\t<pre class=\"m-0\"><code class=\"${codeClass}\">${unsafeHTML(this._highlightedCode)}</code></pre>\n\t\t\t\t</div>\n\t\t\t</schmancy-details>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-code': SchmancyCode\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { timer } from 'rxjs'\nimport { take } from 'rxjs/operators'\n\n/**\n * @element schmancy-code-preview\n * A component that shows code and its rendered preview side by side\n * Takes the content as a slot and displays both the source and rendered result\n */\n@customElement('schmancy-code-preview')\nexport class SchmancyCodePreview extends TailwindElement(\n\tcss`:host{\n\t\tdisplay:block;\n\t\toverflow:hidden;\n\t\tposition:relative;\n\t\tinset:0;\n\t}`\n) {\n\t/**\n\t * Programming language for syntax highlighting\n\t */\n\t@property({ type: String })\n\tlanguage: string = 'html'\n\n\t/**\n\t * Show code on top or side-by-side\n\t */\n\t@property({ type: String })\n\tlayout: 'vertical' | 'horizontal' = 'vertical'\n\n\t/**\n\t * Whether to render/execute the code in preview section\n\t * When false, only shows the code without rendering\n\t */\n\t@property({ type: Boolean })\n\tpreview: boolean = true\n\n\t@state()\n\tprivate slotContent: string = ''\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\t// Capture the slot content as HTML string\n\t\ttimer(0).pipe(take(1)).subscribe(() => {\n\t\t\tconst slot = this.shadowRoot?.querySelector('slot')\n\t\t\tif (slot) {\n\t\t\t\tconst nodes = slot.assignedNodes({ flatten: true })\n\t\t\t\tconst htmlStrings = nodes.map(node => {\n\t\t\t\t\tif (node.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\t\t\treturn (node as HTMLElement).outerHTML\n\t\t\t\t\t} else if (node.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\treturn node.textContent || ''\n\t\t\t\t\t}\n\t\t\t\t\treturn ''\n\t\t\t\t})\n\t\t\t\t\n\t\t\t\t// Clean up the HTML string\n\t\t\t\tconst rawContent = htmlStrings.join('')\n\t\t\t\t\n\t\t\t\t// Find the minimum indentation (excluding empty lines)\n\t\t\t\tconst lines = rawContent.split('\\n')\n\t\t\t\tconst minIndent = lines\n\t\t\t\t\t.filter(line => line.trim().length > 0)\n\t\t\t\t\t.reduce((min, line) => {\n\t\t\t\t\t\tconst indent = line.match(/^(\\s*)/)?.[1].length || 0\n\t\t\t\t\t\treturn Math.min(min, indent)\n\t\t\t\t\t}, Infinity)\n\t\t\t\t\n\t\t\t\t// Remove the minimum indentation from all lines\n\t\t\t\tthis.slotContent = lines\n\t\t\t\t\t.map(line => line.slice(minIndent))\n\t\t\t\t\t.join('\\n')\n\t\t\t\t\t.trim()\n\t\t\t}\n\t\t})\n\t}\n\n\trender() {\n\t\tconst containerClass = this.layout === 'horizontal' \n\t\t\t? 'grid grid-cols-1 lg:grid-cols-2 gap-0' \n\t\t\t: 'flex flex-col'\n\n\t\tconst showPreview = this.preview && this.language.toLowerCase() === 'html'\n\t\t\n\t\treturn html`\n\t\t\t<schmancy-surface class=\"rounded-lg overflow-hidden\">\n\t\t\t\t<div class=\"${showPreview ? containerClass : ''}\">\n\t\t\t\t\t<!-- Code section with proper overflow handling -->\n\t\t\t\t\t<div class=\"min-w-0 overflow-hidden\">\n\t\t\t\t\t\t<schmancy-code\n\t\t\t\t\t\t\tlanguage=\"${this.language}\"\n\t\t\t\t\t\t\t.code=\"${this.slotContent}\"\n\t\t\t\t\t\t\t?copyButton=\"${true}\"\n\t\t\t\t\t\t\tclass=\"block w-full\"\n\t\t\t\t\t\t></schmancy-code>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<!-- Preview section (only visible for HTML and when preview is enabled) -->\n\t\t\t\t\t${showPreview ? html`\n\t\t\t\t\t\t<div class=\"min-w-0 overflow-auto\">\n\t\t\t\t\t\t\t<schmancy-surface type=\"solid\" class=\"p-2 h-full\">\n\t\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t</schmancy-surface>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t` : html`\n\t\t\t\t\t\t<!-- Hidden slot to capture content -->\n\t\t\t\t\t\t<div class=\"hidden\">\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t`}\n\t\t\t\t</div>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-code-preview': SchmancyCodePreview\n\t}\n}"],"mappings":";;;;;;;;AAYA,IAAI,IAAoC,MA4BjC,IAAA,cAA2B,EAAgB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BA6HjC,cAAA,KAAA,OAMJ,IAAA,KAAA,cAAA,CAYQ,GAAA,KAAA,aAAA,CAMD,GAAA,KAAA,SAAA,CAeI,GAAA,KAAA,mBAQS;;CAEnC,QAA2B,GAAA;AAC1B,QAAM,UAAU,EAAA,GACZ,EAAQ,IAAI,OAAA,IAAW,EAAQ,IAAI,WAAA,IAAe,EAAQ,IAAI,cAAA,IAAkB,EAAQ,IAAI,iBAAA,KAC1F,KAAK,cAAA;;CAIZ,MAAA,eAAc;AACb,MAAA,CAAK,KAAK,KAET,QAAA,MADA,KAAK,mBAAmB;EAGzB,IAAM,IAAA,OApNH,AACJ,MAAc,QAAQ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,KAAK,GAAA,CAGX,MAAM,KAAA,EACzB,IAAY,EAChB,QAAO,MAAQ,EAAK,MAAA,CAAO,SAAS,EAAA,CACpC,QAAQ,GAAK,MAAA;KACb,IAAM,IAAS,EAAK,MAAM,SAAA,GAAY,GAAG,UAAU;AACnD,YAAO,KAAK,IAAI,GAAK,EAAA;OACnB,SAAA;AAGJ,SAAK,cAAc,EACjB,KAAI,MAAQ,EAAK,MAAM,EAAA,CAAA,CACvB,KAAK,KAAA,CACL,MAAA;;IAAA;;CAKL,SAAA;EACC,IAAM,IAAiB,KAAK,WAAW,eACpC,0CACA,iBAEG,IAAc,KAAK,WAAW,KAAK,SAAS,aAAA,KAAkB;AAEpE,SAAO,CAAI;;kBAEK,IAAc,IAAiB,GAAA;;;;mBAI9B,KAAK,SAAA;gBACR,KAAK,YAAA;uBACC,EAAA;;;;;;OAMf,IAAc,CAAI;;;;;;SAMhB,CAAI;;;;;;;;;;;GAnFX,EAAS,EAAE,MAAM,QAAA,CAAA,CAAA,EAAS,EAAA,WAAA,YAAA,KAAA,EAAA,EAAA,EAAA,CAM1B,EAAS,EAAE,MAAM,QAAA,CAAA,CAAA,EAAS,EAAA,WAAA,UAAA,KAAA,EAAA,EAAA,EAAA,CAO1B,EAAS,EAAE,MAAM,SAAA,CAAA,CAAA,EAAU,EAAA,WAAA,WAAA,KAAA,EAAA,EAAA,EAAA,CAG3B,GAAA,CAAA,EAAO,EAAA,WAAA,eAAA,KAAA,EAAA,EAAA,IAAA,EAAA,CA5BR,EAAc,wBAAA,CAAA,EAAwB,EAAA;AAAA,SAAA,KAAA,GAAA,KAAA"}
|
package/dist/code-highlight.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./code-highlight-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./code-highlight-B_l8vDzn.cjs`);Object.defineProperty(exports,`SchmancyCode`,{enumerable:!0,get:function(){return e.n}}),Object.defineProperty(exports,`SchmancyCodeHighlight`,{enumerable:!0,get:function(){return e.n}}),Object.defineProperty(exports,`SchmancyCodePreview`,{enumerable:!0,get:function(){return e.t}});
|
package/dist/code-highlight.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./code-highlight-
|
|
1
|
+
import { n as e, t } from "./code-highlight-CI_gqXYX.js";
|
|
2
2
|
export { e as SchmancyCode, e as SchmancyCodeHighlight, t as SchmancyCodePreview };
|
package/dist/content-drawer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./src-sG7Ihf0e.cjs`);Object.defineProperty(exports,`SchmancyContentDrawer`,{enumerable:!0,get:function(){return e.v}}),exports.SchmancyContentDrawerID=e.y,Object.defineProperty(exports,`SchmancyContentDrawerMain`,{enumerable:!0,get:function(){return e._}}),exports.SchmancyContentDrawerMaxHeight=e.b,exports.SchmancyContentDrawerMinWidth=e.x,Object.defineProperty(exports,`SchmancyContentDrawerSheet`,{enumerable:!0,get:function(){return e.g}}),exports.SchmancyContentDrawerSheetMode=e.S,exports.SchmancyContentDrawerSheetState=e.C,exports.schmancyContentDrawer=e.w;
|
package/dist/content-drawer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as e, S as t, _ as n, b as r, g as i, v as a, w as o, x as s, y as c } from "./src-
|
|
1
|
+
import { C as e, S as t, _ as n, b as r, g as i, v as a, w as o, x as s, y as c } from "./src-Dw-PjtMH.js";
|
|
2
2
|
export { a as SchmancyContentDrawer, c as SchmancyContentDrawerID, n as SchmancyContentDrawerMain, r as SchmancyContentDrawerMaxHeight, s as SchmancyContentDrawerMinWidth, i as SchmancyContentDrawerSheet, t as SchmancyContentDrawerSheetMode, e as SchmancyContentDrawerSheetState, o as schmancyContentDrawer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-BGkHnOnd.js","names":[],"sources":["../node_modules/@lit-labs/virtualizer/layouts/shared/SizeCache.js","../node_modules/@lit-labs/virtualizer/layouts/shared/BaseLayout.js","../node_modules/@lit-labs/virtualizer/layouts/flow.js"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nexport class SizeCache {\n constructor(config) {\n this._map = new Map();\n this._roundAverageSize = false;\n this.totalSize = 0;\n if (config?.roundAverageSize === true) {\n this._roundAverageSize = true;\n }\n }\n set(index, value) {\n const prev = this._map.get(index) || 0;\n this._map.set(index, value);\n this.totalSize += value - prev;\n }\n get averageSize() {\n if (this._map.size > 0) {\n const average = this.totalSize / this._map.size;\n return this._roundAverageSize ? Math.round(average) : average;\n }\n return 0;\n }\n getSize(index) {\n return this._map.get(index);\n }\n clear() {\n this._map.clear();\n this.totalSize = 0;\n }\n}\n//# sourceMappingURL=SizeCache.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nexport function dim1(direction) {\n return direction === 'horizontal' ? 'width' : 'height';\n}\nexport function dim2(direction) {\n return direction === 'horizontal' ? 'height' : 'width';\n}\nexport function pos1(direction) {\n return direction === 'horizontal' ? 'left' : 'top';\n}\nexport function pos2(direction) {\n return direction === 'horizontal' ? 'top' : 'left';\n}\nexport class BaseLayout {\n _getDefaultConfig() {\n return {\n direction: 'vertical',\n };\n }\n constructor(hostSink, config) {\n /**\n * The last set viewport scroll position.\n */\n this._latestCoords = { left: 0, top: 0 };\n /**\n * Scrolling direction.\n */\n this._direction = null;\n /**\n * Dimensions of the viewport.\n */\n this._viewportSize = { width: 0, height: 0 };\n this.totalScrollSize = { width: 0, height: 0 };\n this.offsetWithinScroller = { left: 0, top: 0 };\n /**\n * Flag for debouncing asynchronous reflow requests.\n */\n this._pendingReflow = false;\n this._pendingLayoutUpdate = false;\n this._pin = null;\n /**\n * The index of the first item intersecting the viewport.\n */\n this._firstVisible = 0;\n /**\n * The index of the last item intersecting the viewport.\n */\n this._lastVisible = 0;\n /**\n * Pixel offset in the scroll direction of the first child.\n */\n this._physicalMin = 0;\n /**\n * Pixel offset in the scroll direction of the last child.\n */\n this._physicalMax = 0;\n /**\n * Index of the first child.\n */\n this._first = -1;\n /**\n * Index of the last child.\n */\n this._last = -1;\n /**\n * Length in the scrolling direction.\n */\n this._sizeDim = 'height';\n /**\n * Length in the non-scrolling direction.\n */\n this._secondarySizeDim = 'width';\n /**\n * Position in the scrolling direction.\n */\n this._positionDim = 'top';\n /**\n * Position in the non-scrolling direction.\n */\n this._secondaryPositionDim = 'left';\n /**\n * Current scroll offset in pixels.\n */\n this._scrollPosition = 0;\n /**\n * Difference between current scroll offset and scroll offset calculated due\n * to a reflow.\n */\n this._scrollError = 0;\n /**\n * Total number of items that could possibly be displayed. Used to help\n * calculate the scroll size.\n */\n this._items = [];\n /**\n * The total (estimated) length of all items in the scrolling direction.\n */\n this._scrollSize = 1;\n /**\n * Number of pixels beyond the viewport to still include\n * in the active range of items.\n */\n // TODO (graynorton): Probably want to make this something we calculate based\n // on viewport size, item size, other factors, possibly still with a dial of some kind\n this._overhang = 1000;\n this._hostSink = hostSink;\n // Delay setting config so that subclasses do setup work first\n Promise.resolve().then(() => (this.config = config || this._getDefaultConfig()));\n }\n set config(config) {\n Object.assign(this, Object.assign({}, this._getDefaultConfig(), config));\n }\n get config() {\n return {\n direction: this.direction,\n };\n }\n /**\n * Maximum index of children + 1, to help estimate total height of the scroll\n * space.\n */\n get items() {\n return this._items;\n }\n set items(items) {\n this._setItems(items);\n }\n _setItems(items) {\n if (items !== this._items) {\n this._items = items;\n this._scheduleReflow();\n }\n }\n /**\n * Primary scrolling direction.\n */\n get direction() {\n return this._direction;\n }\n set direction(dir) {\n // Force it to be either horizontal or vertical.\n dir = dir === 'horizontal' ? dir : 'vertical';\n if (dir !== this._direction) {\n this._direction = dir;\n this._sizeDim = dir === 'horizontal' ? 'width' : 'height';\n this._secondarySizeDim = dir === 'horizontal' ? 'height' : 'width';\n this._positionDim = dir === 'horizontal' ? 'left' : 'top';\n this._secondaryPositionDim = dir === 'horizontal' ? 'top' : 'left';\n this._triggerReflow();\n }\n }\n /**\n * Height and width of the viewport.\n */\n get viewportSize() {\n return this._viewportSize;\n }\n set viewportSize(dims) {\n const { _viewDim1, _viewDim2 } = this;\n Object.assign(this._viewportSize, dims);\n if (_viewDim2 !== this._viewDim2) {\n // this._viewDim2Changed();\n this._scheduleLayoutUpdate();\n }\n else if (_viewDim1 !== this._viewDim1) {\n this._checkThresholds();\n }\n }\n /**\n * Scroll offset of the viewport.\n */\n get viewportScroll() {\n return this._latestCoords;\n }\n set viewportScroll(coords) {\n Object.assign(this._latestCoords, coords);\n const oldPos = this._scrollPosition;\n this._scrollPosition = this._latestCoords[this._positionDim];\n const change = Math.abs(oldPos - this._scrollPosition);\n if (change >= 1) {\n this._checkThresholds();\n }\n }\n /**\n * Perform a reflow if one has been scheduled.\n */\n reflowIfNeeded(force = false) {\n if (force || this._pendingReflow) {\n this._pendingReflow = false;\n this._reflow();\n }\n }\n set pin(options) {\n this._pin = options;\n this._triggerReflow();\n }\n get pin() {\n if (this._pin !== null) {\n const { index, block } = this._pin;\n return {\n index: Math.max(0, Math.min(index, this.items.length - 1)),\n block,\n };\n }\n return null;\n }\n _clampScrollPosition(val) {\n return Math.max(-this.offsetWithinScroller[this._positionDim], Math.min(val, this.totalScrollSize[dim1(this.direction)] - this._viewDim1));\n }\n unpin() {\n if (this._pin !== null) {\n this._sendUnpinnedMessage();\n this._pin = null;\n }\n }\n _updateLayout() {\n // Override\n }\n // protected _viewDim2Changed(): void {\n // this._scheduleLayoutUpdate();\n // }\n /**\n * The height or width of the viewport, whichever corresponds to the scrolling direction.\n */\n get _viewDim1() {\n return this._viewportSize[this._sizeDim];\n }\n /**\n * The height or width of the viewport, whichever does NOT correspond to the scrolling direction.\n */\n get _viewDim2() {\n return this._viewportSize[this._secondarySizeDim];\n }\n _scheduleReflow() {\n this._pendingReflow = true;\n }\n _scheduleLayoutUpdate() {\n this._pendingLayoutUpdate = true;\n this._scheduleReflow();\n }\n // For triggering a reflow based on incoming changes to\n // the layout config.\n _triggerReflow() {\n this._scheduleLayoutUpdate();\n // TODO graynorton@: reflowIfNeeded() isn't really supposed\n // to be called internally. Address in larger cleanup\n // of virtualizer / layout interaction pattern.\n // this.reflowIfNeeded(true);\n Promise.resolve().then(() => this.reflowIfNeeded());\n }\n _reflow() {\n if (this._pendingLayoutUpdate) {\n this._updateLayout();\n this._pendingLayoutUpdate = false;\n }\n this._updateScrollSize();\n this._setPositionFromPin();\n this._getActiveItems();\n this._updateVisibleIndices();\n this._sendStateChangedMessage();\n }\n /**\n * If we are supposed to be pinned to a particular\n * item or set of coordinates, we set `_scrollPosition`\n * accordingly and adjust `_scrollError` as needed\n * so that the virtualizer can keep the scroll\n * position in the DOM in sync\n */\n _setPositionFromPin() {\n if (this.pin !== null) {\n const lastScrollPosition = this._scrollPosition;\n const { index, block } = this.pin;\n this._scrollPosition =\n this._calculateScrollIntoViewPosition({\n index,\n block: block || 'start',\n }) - this.offsetWithinScroller[this._positionDim];\n this._scrollError = lastScrollPosition - this._scrollPosition;\n }\n }\n /**\n * Calculate the coordinates to scroll to, given\n * a request to scroll to the element at a specific\n * index.\n *\n * Supports the same positioning options (`start`,\n * `center`, `end`, `nearest`) as the standard\n * `Element.scrollIntoView()` method, but currently\n * only considers the provided value in the `block`\n * dimension, since we don't yet have any layouts\n * that support virtualization in two dimensions.\n */\n _calculateScrollIntoViewPosition(options) {\n const { block } = options;\n const index = Math.min(this.items.length, Math.max(0, options.index));\n const itemStartPosition = this._getItemPosition(index)[this._positionDim];\n let scrollPosition = itemStartPosition;\n if (block !== 'start') {\n const itemSize = this._getItemSize(index)[this._sizeDim];\n if (block === 'center') {\n scrollPosition =\n itemStartPosition - 0.5 * this._viewDim1 + 0.5 * itemSize;\n }\n else {\n const itemEndPosition = itemStartPosition - this._viewDim1 + itemSize;\n if (block === 'end') {\n scrollPosition = itemEndPosition;\n }\n else {\n // block === 'nearest'\n const currentScrollPosition = this._scrollPosition;\n scrollPosition =\n Math.abs(currentScrollPosition - itemStartPosition) <\n Math.abs(currentScrollPosition - itemEndPosition)\n ? itemStartPosition\n : itemEndPosition;\n }\n }\n }\n scrollPosition += this.offsetWithinScroller[this._positionDim];\n return this._clampScrollPosition(scrollPosition);\n }\n getScrollIntoViewCoordinates(options) {\n return {\n [this._positionDim]: this._calculateScrollIntoViewPosition(options),\n };\n }\n _sendUnpinnedMessage() {\n this._hostSink({\n type: 'unpinned',\n });\n }\n _sendVisibilityChangedMessage() {\n this._hostSink({\n type: 'visibilityChanged',\n firstVisible: this._firstVisible,\n lastVisible: this._lastVisible,\n });\n }\n _sendStateChangedMessage() {\n const childPositions = new Map();\n if (this._first !== -1 && this._last !== -1) {\n for (let idx = this._first; idx <= this._last; idx++) {\n childPositions.set(idx, this._getItemPosition(idx));\n }\n }\n const message = {\n type: 'stateChanged',\n scrollSize: {\n [this._sizeDim]: this._scrollSize,\n [this._secondarySizeDim]: null,\n },\n range: {\n first: this._first,\n last: this._last,\n firstVisible: this._firstVisible,\n lastVisible: this._lastVisible,\n },\n childPositions,\n };\n if (this._scrollError) {\n message.scrollError = {\n [this._positionDim]: this._scrollError,\n [this._secondaryPositionDim]: 0,\n };\n this._scrollError = 0;\n }\n this._hostSink(message);\n }\n /**\n * Number of items to display.\n */\n get _num() {\n if (this._first === -1 || this._last === -1) {\n return 0;\n }\n return this._last - this._first + 1;\n }\n _checkThresholds() {\n if ((this._viewDim1 === 0 && this._num > 0) || this._pin !== null) {\n this._scheduleReflow();\n }\n else {\n const min = Math.max(0, this._scrollPosition - this._overhang);\n const max = Math.min(this._scrollSize, this._scrollPosition + this._viewDim1 + this._overhang);\n if (this._physicalMin > min || this._physicalMax < max) {\n this._scheduleReflow();\n }\n else {\n this._updateVisibleIndices({ emit: true });\n }\n }\n }\n /**\n * Find the indices of the first and last items to intersect the viewport.\n * Emit a visibleindiceschange event when either index changes.\n */\n _updateVisibleIndices(options) {\n if (this._first === -1 || this._last === -1)\n return;\n let firstVisible = this._first;\n while (firstVisible < this._last &&\n Math.round(this._getItemPosition(firstVisible)[this._positionDim] +\n this._getItemSize(firstVisible)[this._sizeDim]) <= Math.round(this._scrollPosition)) {\n firstVisible++;\n }\n let lastVisible = this._last;\n while (lastVisible > this._first &&\n Math.round(this._getItemPosition(lastVisible)[this._positionDim]) >=\n Math.round(this._scrollPosition + this._viewDim1)) {\n lastVisible--;\n }\n if (firstVisible !== this._firstVisible ||\n lastVisible !== this._lastVisible) {\n this._firstVisible = firstVisible;\n this._lastVisible = lastVisible;\n if (options && options.emit) {\n this._sendVisibilityChangedMessage();\n }\n }\n }\n}\n//# sourceMappingURL=BaseLayout.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { SizeCache } from './shared/SizeCache.js';\nimport { BaseLayout, dim1 } from './shared/BaseLayout.js';\nexport const flow = (config) => Object.assign({\n type: FlowLayout,\n}, config);\nfunction leadingMargin(direction) {\n return direction === 'horizontal' ? 'marginLeft' : 'marginTop';\n}\nfunction trailingMargin(direction) {\n return direction === 'horizontal' ? 'marginRight' : 'marginBottom';\n}\nfunction offset(direction) {\n return direction === 'horizontal' ? 'xOffset' : 'yOffset';\n}\nfunction collapseMargins(a, b) {\n const m = [a, b].sort();\n return m[1] <= 0 ? Math.min(...m) : m[0] >= 0 ? Math.max(...m) : m[0] + m[1];\n}\nclass MetricsCache {\n constructor() {\n this._childSizeCache = new SizeCache();\n this._marginSizeCache = new SizeCache();\n this._metricsCache = new Map();\n }\n update(metrics, direction) {\n const marginsToUpdate = new Set();\n Object.keys(metrics).forEach((key) => {\n const k = Number(key);\n this._metricsCache.set(k, metrics[k]);\n this._childSizeCache.set(k, metrics[k][dim1(direction)]);\n marginsToUpdate.add(k);\n marginsToUpdate.add(k + 1);\n });\n for (const k of marginsToUpdate) {\n const a = this._metricsCache.get(k)?.[leadingMargin(direction)] || 0;\n const b = this._metricsCache.get(k - 1)?.[trailingMargin(direction)] || 0;\n this._marginSizeCache.set(k, collapseMargins(a, b));\n }\n }\n get averageChildSize() {\n return this._childSizeCache.averageSize;\n }\n get totalChildSize() {\n return this._childSizeCache.totalSize;\n }\n get averageMarginSize() {\n return this._marginSizeCache.averageSize;\n }\n get totalMarginSize() {\n return this._marginSizeCache.totalSize;\n }\n getLeadingMarginValue(index, direction) {\n return this._metricsCache.get(index)?.[leadingMargin(direction)] || 0;\n }\n getChildSize(index) {\n return this._childSizeCache.getSize(index);\n }\n getMarginSize(index) {\n return this._marginSizeCache.getSize(index);\n }\n clear() {\n this._childSizeCache.clear();\n this._marginSizeCache.clear();\n this._metricsCache.clear();\n }\n}\nexport class FlowLayout extends BaseLayout {\n constructor() {\n super(...arguments);\n /**\n * Initial estimate of item size\n */\n this._itemSize = { width: 100, height: 100 };\n /**\n * Indices of children mapped to their (position and length) in the scrolling\n * direction. Used to keep track of children that are in range.\n */\n this._physicalItems = new Map();\n /**\n * Used in tandem with _physicalItems to track children in range across\n * reflows.\n */\n this._newPhysicalItems = new Map();\n /**\n * Width and height of children by their index.\n */\n this._metricsCache = new MetricsCache();\n /**\n * anchorIdx is the anchor around which we reflow. It is designed to allow\n * jumping to any point of the scroll size. We choose it once and stick with\n * it until stable. _first and _last are deduced around it.\n */\n this._anchorIdx = null;\n /**\n * Position in the scrolling direction of the anchor child.\n */\n this._anchorPos = null;\n /**\n * Whether all children in range were in range during the previous reflow.\n */\n this._stable = true;\n this._measureChildren = true;\n this._estimate = true;\n }\n // protected _defaultConfig: BaseLayoutConfig = Object.assign({}, super._defaultConfig, {\n // })\n // constructor(config: Layout1dConfig) {\n // super(config);\n // }\n get measureChildren() {\n return this._measureChildren;\n }\n /**\n * Determine the average size of all children represented in the sizes\n * argument.\n */\n updateItemSizes(sizes) {\n this._metricsCache.update(sizes, this.direction);\n // if (this._nMeasured) {\n // this._updateItemSize();\n this._scheduleReflow();\n // }\n }\n /**\n * Set the average item size based on the total length and number of children\n * in range.\n */\n // _updateItemSize() {\n // // Keep integer values.\n // this._itemSize[this._sizeDim] = this._metricsCache.averageChildSize;\n // }\n _getPhysicalItem(idx) {\n return this._newPhysicalItems.get(idx) ?? this._physicalItems.get(idx);\n }\n _getSize(idx) {\n const item = this._getPhysicalItem(idx);\n return item && this._metricsCache.getChildSize(idx);\n }\n _getAverageSize() {\n return this._metricsCache.averageChildSize || this._itemSize[this._sizeDim];\n }\n _estimatePosition(idx) {\n const c = this._metricsCache;\n if (this._first === -1 || this._last === -1) {\n return (c.averageMarginSize +\n idx * (c.averageMarginSize + this._getAverageSize()));\n }\n else {\n if (idx < this._first) {\n const delta = this._first - idx;\n const refItem = this._getPhysicalItem(this._first);\n return (refItem.pos -\n (c.getMarginSize(this._first - 1) || c.averageMarginSize) -\n (delta * c.averageChildSize + (delta - 1) * c.averageMarginSize));\n }\n else {\n const delta = idx - this._last;\n const refItem = this._getPhysicalItem(this._last);\n return (refItem.pos +\n (c.getChildSize(this._last) || c.averageChildSize) +\n (c.getMarginSize(this._last) || c.averageMarginSize) +\n delta * (c.averageChildSize + c.averageMarginSize));\n }\n }\n }\n /**\n * Returns the position in the scrolling direction of the item at idx.\n * Estimates it if the item at idx is not in the DOM.\n */\n _getPosition(idx) {\n const item = this._getPhysicalItem(idx);\n const { averageMarginSize } = this._metricsCache;\n return idx === 0\n ? this._metricsCache.getMarginSize(0) ?? averageMarginSize\n : item\n ? item.pos\n : this._estimatePosition(idx);\n }\n _calculateAnchor(lower, upper) {\n if (lower <= 0) {\n return 0;\n }\n if (upper > this._scrollSize - this._viewDim1) {\n return this.items.length - 1;\n }\n return Math.max(0, Math.min(this.items.length - 1, Math.floor((lower + upper) / 2 / this._delta)));\n }\n _getAnchor(lower, upper) {\n if (this._physicalItems.size === 0) {\n return this._calculateAnchor(lower, upper);\n }\n if (this._first < 0) {\n return this._calculateAnchor(lower, upper);\n }\n if (this._last < 0) {\n return this._calculateAnchor(lower, upper);\n }\n const firstItem = this._getPhysicalItem(this._first), lastItem = this._getPhysicalItem(this._last), firstMin = firstItem.pos, lastMin = lastItem.pos, lastMax = lastMin + this._metricsCache.getChildSize(this._last);\n if (lastMax < lower) {\n // Window is entirely past physical items, calculate new anchor\n return this._calculateAnchor(lower, upper);\n }\n if (firstMin > upper) {\n // Window is entirely before physical items, calculate new anchor\n return this._calculateAnchor(lower, upper);\n }\n // Window contains a physical item\n // Find one, starting with the one that was previously first visible\n let candidateIdx = this._firstVisible - 1;\n let cMax = -Infinity;\n while (cMax < lower) {\n const candidate = this._getPhysicalItem(++candidateIdx);\n cMax = candidate.pos + this._metricsCache.getChildSize(candidateIdx);\n }\n return candidateIdx;\n }\n /**\n * Updates _first and _last based on items that should be in the current\n * viewed range.\n */\n _getActiveItems() {\n if (this._viewDim1 === 0 || this.items.length === 0) {\n this._clearItems();\n }\n else {\n this._getItems();\n }\n }\n /**\n * Sets the range to empty.\n */\n _clearItems() {\n this._first = -1;\n this._last = -1;\n this._physicalMin = 0;\n this._physicalMax = 0;\n const items = this._newPhysicalItems;\n this._newPhysicalItems = this._physicalItems;\n this._newPhysicalItems.clear();\n this._physicalItems = items;\n this._stable = true;\n }\n /*\n * Updates _first and _last based on items that should be in the given range.\n */\n _getItems() {\n const items = this._newPhysicalItems;\n this._stable = true;\n let lower, upper;\n // The anchorIdx is the anchor around which we reflow. It is designed to\n // allow jumping to any point of the scroll size. We choose it once and\n // stick with it until stable. first and last are deduced around it.\n // If we have a pinned item, we anchor on it\n if (this.pin !== null) {\n const { index } = this.pin;\n this._anchorIdx = index;\n this._anchorPos = this._getPosition(index);\n }\n // Determine the lower and upper bounds of the region to be\n // rendered, relative to the viewport\n lower = this._scrollPosition - this._overhang; //leadingOverhang;\n upper = this._scrollPosition + this._viewDim1 + this._overhang; // trailingOverhang;\n if (upper < 0 || lower > this._scrollSize) {\n this._clearItems();\n return;\n }\n // If we are scrolling to a specific index or if we are doing another\n // pass to stabilize a previously started reflow, we will already\n // have an anchor. If not, establish an anchor now.\n if (this._anchorIdx === null || this._anchorPos === null) {\n this._anchorIdx = this._getAnchor(lower, upper);\n this._anchorPos = this._getPosition(this._anchorIdx);\n }\n let anchorSize = this._getSize(this._anchorIdx);\n if (anchorSize === undefined) {\n this._stable = false;\n anchorSize = this._getAverageSize();\n }\n const anchorLeadingMargin = this._metricsCache.getMarginSize(this._anchorIdx) ??\n this._metricsCache.averageMarginSize;\n const anchorTrailingMargin = this._metricsCache.getMarginSize(this._anchorIdx + 1) ??\n this._metricsCache.averageMarginSize;\n if (this._anchorIdx === 0) {\n this._anchorPos = anchorLeadingMargin;\n }\n if (this._anchorIdx === this.items.length - 1) {\n this._anchorPos = this._scrollSize - anchorTrailingMargin - anchorSize;\n }\n // Anchor might be outside bounds, so prefer correcting the error and keep\n // that anchorIdx.\n let anchorErr = 0;\n if (this._anchorPos + anchorSize + anchorTrailingMargin < lower) {\n anchorErr = lower - (this._anchorPos + anchorSize + anchorTrailingMargin);\n }\n if (this._anchorPos - anchorLeadingMargin > upper) {\n anchorErr = upper - (this._anchorPos - anchorLeadingMargin);\n }\n if (anchorErr) {\n this._scrollPosition -= anchorErr;\n lower -= anchorErr;\n upper -= anchorErr;\n this._scrollError += anchorErr;\n }\n items.set(this._anchorIdx, { pos: this._anchorPos, size: anchorSize });\n this._first = this._last = this._anchorIdx;\n this._physicalMin = this._anchorPos - anchorLeadingMargin;\n this._physicalMax = this._anchorPos + anchorSize + anchorTrailingMargin;\n while (this._physicalMin > lower && this._first > 0) {\n let size = this._getSize(--this._first);\n if (size === undefined) {\n this._stable = false;\n size = this._getAverageSize();\n }\n let margin = this._metricsCache.getMarginSize(this._first);\n if (margin === undefined) {\n this._stable = false;\n margin = this._metricsCache.averageMarginSize;\n }\n this._physicalMin -= size;\n const pos = this._physicalMin;\n items.set(this._first, { pos, size });\n this._physicalMin -= margin;\n if (this._stable === false && this._estimate === false) {\n break;\n }\n }\n while (this._physicalMax < upper && this._last < this.items.length - 1) {\n let size = this._getSize(++this._last);\n if (size === undefined) {\n this._stable = false;\n size = this._getAverageSize();\n }\n let margin = this._metricsCache.getMarginSize(this._last);\n if (margin === undefined) {\n this._stable = false;\n margin = this._metricsCache.averageMarginSize;\n }\n const pos = this._physicalMax;\n items.set(this._last, { pos, size });\n this._physicalMax += size + margin;\n if (!this._stable && !this._estimate) {\n break;\n }\n }\n // This handles the cases where we were relying on estimated sizes.\n const extentErr = this._calculateError();\n if (extentErr) {\n this._physicalMin -= extentErr;\n this._physicalMax -= extentErr;\n this._anchorPos -= extentErr;\n this._scrollPosition -= extentErr;\n items.forEach((item) => (item.pos -= extentErr));\n this._scrollError += extentErr;\n }\n if (this._stable) {\n this._newPhysicalItems = this._physicalItems;\n this._newPhysicalItems.clear();\n this._physicalItems = items;\n }\n }\n _calculateError() {\n if (this._first === 0) {\n return this._physicalMin;\n }\n else if (this._physicalMin <= 0) {\n return this._physicalMin - this._first * this._delta;\n }\n else if (this._last === this.items.length - 1) {\n return this._physicalMax - this._scrollSize;\n }\n else if (this._physicalMax >= this._scrollSize) {\n return (this._physicalMax -\n this._scrollSize +\n (this.items.length - 1 - this._last) * this._delta);\n }\n return 0;\n }\n _reflow() {\n const { _first, _last } = this;\n super._reflow();\n if ((this._first === -1 && this._last == -1) ||\n (this._first === _first && this._last === _last)) {\n this._resetReflowState();\n }\n }\n _resetReflowState() {\n this._anchorIdx = null;\n this._anchorPos = null;\n this._stable = true;\n }\n _updateScrollSize() {\n const { averageMarginSize } = this._metricsCache;\n this._scrollSize = Math.max(1, this.items.length * (averageMarginSize + this._getAverageSize()) +\n averageMarginSize);\n }\n /**\n * Returns the average size (precise or estimated) of an item in the scrolling direction,\n * including any surrounding space.\n */\n get _delta() {\n const { averageMarginSize } = this._metricsCache;\n return this._getAverageSize() + averageMarginSize;\n }\n /**\n * Returns the top and left positioning of the item at idx.\n */\n _getItemPosition(idx) {\n return {\n [this._positionDim]: this._getPosition(idx),\n [this._secondaryPositionDim]: 0,\n [offset(this.direction)]: -(this._metricsCache.getLeadingMarginValue(idx, this.direction) ??\n this._metricsCache.averageMarginSize),\n };\n }\n /**\n * Returns the height and width of the item at idx.\n */\n _getItemSize(idx) {\n return {\n [this._sizeDim]: this._getSize(idx) || this._getAverageSize(),\n [this._secondarySizeDim]: this._itemSize[this._secondarySizeDim],\n };\n }\n _viewDim2Changed() {\n this._metricsCache.clear();\n this._scheduleReflow();\n }\n}\n//# sourceMappingURL=flow.js.map"],"x_google_ignoreList":[0,1,2],"mappings":"AAKA,IAAa,IAAb,MAAA;CACI,YAAY,GAAA;AACR,OAAK,uBAAO,IAAI,KAAA,EAChB,KAAK,oBAAA,CAAoB,GACzB,KAAK,YAAY,GAAA,CACgB,MAA7B,GAAQ,qBACR,KAAK,oBAAA,CAAoB;;CAGjC,IAAI,GAAO,GAAA;EACP,IAAM,IAAO,KAAK,KAAK,IAAI,EAAA,IAAU;AACrC,OAAK,KAAK,IAAI,GAAO,EAAA,EACrB,KAAK,aAAa,IAAQ;;CAE9B,IAAA,cAAI;AACA,MAAI,KAAK,KAAK,OAAO,GAAG;GACpB,IAAM,IAAU,KAAK,YAAY,KAAK,KAAK;AAC3C,UAAO,KAAK,oBAAoB,KAAK,MAAM,EAAA,GAAW;;AAE1D,SAAO;;CAEX,QAAQ,GAAA;AACJ,SAAO,KAAK,KAAK,IAAI,EAAA;;CAEzB,QAAA;AACI,OAAK,KAAK,OAAA,EACV,KAAK,YAAY;;;AC1BzB,SAAgB,EAAK,GAAA;AACjB,QAAO,MAAc,eAAe,UAAU;;AAWlD,IAAa,IAAb,MAAA;CACI,oBAAA;AACI,SAAO,EACH,WAAW,YAAA;;CAGnB,YAAY,GAAU,GAAA;AAIlB,OAAK,gBAAgB;GAAE,MAAM;GAAG,KAAK;GAAA,EAIrC,KAAK,aAAa,MAIlB,KAAK,gBAAgB;GAAE,OAAO;GAAG,QAAQ;GAAA,EAC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B,KAAK,iBAAA,IACzE,EAAA;;CAMR,IAAA,SAAI;EACA,IAAA,EAAM,mBAAE,MAAsB,KAAK;AACnC,SAAO,KAAK,iBAAA,GAAoB;;CAKpC,iBAAiB,GAAA;AACb,SAAO;IACF,KAAK,eAAe,KAAK,aAAa,EAAA;IACtC,KAAK,wBAAwB;IAC7B,EAAO,KAAK,UAAA,GAAA,EAAe,KAAK,cAAc,sBAAsB,GAAK,KAAK,UAAA,IAC3E,KAAK,cAAc;GAAA;;CAM/B,aAAa,GAAA;AACT,SAAO;IACF,KAAK,WAAW,KAAK,SAAS,EAAA,IAAQ,KAAK,iBAAA;IAC3C,KAAK,oBAAoB,KAAK,UAAU,KAAK;GAAA;;CAGtD,mBAAA;AACI,OAAK,cAAc,OAAA,EACnB,KAAK,iBAAA;;;AAAA,SAAA,KAAA"}
|
|
1
|
+
{"version":3,"file":"flow-BPDtbhLe.js","names":[],"sources":["../node_modules/@lit-labs/virtualizer/layouts/shared/SizeCache.js","../node_modules/@lit-labs/virtualizer/layouts/shared/BaseLayout.js","../node_modules/@lit-labs/virtualizer/layouts/flow.js"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nexport class SizeCache {\n constructor(config) {\n this._map = new Map();\n this._roundAverageSize = false;\n this.totalSize = 0;\n if (config?.roundAverageSize === true) {\n this._roundAverageSize = true;\n }\n }\n set(index, value) {\n const prev = this._map.get(index) || 0;\n this._map.set(index, value);\n this.totalSize += value - prev;\n }\n get averageSize() {\n if (this._map.size > 0) {\n const average = this.totalSize / this._map.size;\n return this._roundAverageSize ? Math.round(average) : average;\n }\n return 0;\n }\n getSize(index) {\n return this._map.get(index);\n }\n clear() {\n this._map.clear();\n this.totalSize = 0;\n }\n}\n//# sourceMappingURL=SizeCache.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nexport function dim1(direction) {\n return direction === 'horizontal' ? 'width' : 'height';\n}\nexport function dim2(direction) {\n return direction === 'horizontal' ? 'height' : 'width';\n}\nexport function pos1(direction) {\n return direction === 'horizontal' ? 'left' : 'top';\n}\nexport function pos2(direction) {\n return direction === 'horizontal' ? 'top' : 'left';\n}\nexport class BaseLayout {\n _getDefaultConfig() {\n return {\n direction: 'vertical',\n };\n }\n constructor(hostSink, config) {\n /**\n * The last set viewport scroll position.\n */\n this._latestCoords = { left: 0, top: 0 };\n /**\n * Scrolling direction.\n */\n this._direction = null;\n /**\n * Dimensions of the viewport.\n */\n this._viewportSize = { width: 0, height: 0 };\n this.totalScrollSize = { width: 0, height: 0 };\n this.offsetWithinScroller = { left: 0, top: 0 };\n /**\n * Flag for debouncing asynchronous reflow requests.\n */\n this._pendingReflow = false;\n this._pendingLayoutUpdate = false;\n this._pin = null;\n /**\n * The index of the first item intersecting the viewport.\n */\n this._firstVisible = 0;\n /**\n * The index of the last item intersecting the viewport.\n */\n this._lastVisible = 0;\n /**\n * Pixel offset in the scroll direction of the first child.\n */\n this._physicalMin = 0;\n /**\n * Pixel offset in the scroll direction of the last child.\n */\n this._physicalMax = 0;\n /**\n * Index of the first child.\n */\n this._first = -1;\n /**\n * Index of the last child.\n */\n this._last = -1;\n /**\n * Length in the scrolling direction.\n */\n this._sizeDim = 'height';\n /**\n * Length in the non-scrolling direction.\n */\n this._secondarySizeDim = 'width';\n /**\n * Position in the scrolling direction.\n */\n this._positionDim = 'top';\n /**\n * Position in the non-scrolling direction.\n */\n this._secondaryPositionDim = 'left';\n /**\n * Current scroll offset in pixels.\n */\n this._scrollPosition = 0;\n /**\n * Difference between current scroll offset and scroll offset calculated due\n * to a reflow.\n */\n this._scrollError = 0;\n /**\n * Total number of items that could possibly be displayed. Used to help\n * calculate the scroll size.\n */\n this._items = [];\n /**\n * The total (estimated) length of all items in the scrolling direction.\n */\n this._scrollSize = 1;\n /**\n * Number of pixels beyond the viewport to still include\n * in the active range of items.\n */\n // TODO (graynorton): Probably want to make this something we calculate based\n // on viewport size, item size, other factors, possibly still with a dial of some kind\n this._overhang = 1000;\n this._hostSink = hostSink;\n // Delay setting config so that subclasses do setup work first\n Promise.resolve().then(() => (this.config = config || this._getDefaultConfig()));\n }\n set config(config) {\n Object.assign(this, Object.assign({}, this._getDefaultConfig(), config));\n }\n get config() {\n return {\n direction: this.direction,\n };\n }\n /**\n * Maximum index of children + 1, to help estimate total height of the scroll\n * space.\n */\n get items() {\n return this._items;\n }\n set items(items) {\n this._setItems(items);\n }\n _setItems(items) {\n if (items !== this._items) {\n this._items = items;\n this._scheduleReflow();\n }\n }\n /**\n * Primary scrolling direction.\n */\n get direction() {\n return this._direction;\n }\n set direction(dir) {\n // Force it to be either horizontal or vertical.\n dir = dir === 'horizontal' ? dir : 'vertical';\n if (dir !== this._direction) {\n this._direction = dir;\n this._sizeDim = dir === 'horizontal' ? 'width' : 'height';\n this._secondarySizeDim = dir === 'horizontal' ? 'height' : 'width';\n this._positionDim = dir === 'horizontal' ? 'left' : 'top';\n this._secondaryPositionDim = dir === 'horizontal' ? 'top' : 'left';\n this._triggerReflow();\n }\n }\n /**\n * Height and width of the viewport.\n */\n get viewportSize() {\n return this._viewportSize;\n }\n set viewportSize(dims) {\n const { _viewDim1, _viewDim2 } = this;\n Object.assign(this._viewportSize, dims);\n if (_viewDim2 !== this._viewDim2) {\n // this._viewDim2Changed();\n this._scheduleLayoutUpdate();\n }\n else if (_viewDim1 !== this._viewDim1) {\n this._checkThresholds();\n }\n }\n /**\n * Scroll offset of the viewport.\n */\n get viewportScroll() {\n return this._latestCoords;\n }\n set viewportScroll(coords) {\n Object.assign(this._latestCoords, coords);\n const oldPos = this._scrollPosition;\n this._scrollPosition = this._latestCoords[this._positionDim];\n const change = Math.abs(oldPos - this._scrollPosition);\n if (change >= 1) {\n this._checkThresholds();\n }\n }\n /**\n * Perform a reflow if one has been scheduled.\n */\n reflowIfNeeded(force = false) {\n if (force || this._pendingReflow) {\n this._pendingReflow = false;\n this._reflow();\n }\n }\n set pin(options) {\n this._pin = options;\n this._triggerReflow();\n }\n get pin() {\n if (this._pin !== null) {\n const { index, block } = this._pin;\n return {\n index: Math.max(0, Math.min(index, this.items.length - 1)),\n block,\n };\n }\n return null;\n }\n _clampScrollPosition(val) {\n return Math.max(-this.offsetWithinScroller[this._positionDim], Math.min(val, this.totalScrollSize[dim1(this.direction)] - this._viewDim1));\n }\n unpin() {\n if (this._pin !== null) {\n this._sendUnpinnedMessage();\n this._pin = null;\n }\n }\n _updateLayout() {\n // Override\n }\n // protected _viewDim2Changed(): void {\n // this._scheduleLayoutUpdate();\n // }\n /**\n * The height or width of the viewport, whichever corresponds to the scrolling direction.\n */\n get _viewDim1() {\n return this._viewportSize[this._sizeDim];\n }\n /**\n * The height or width of the viewport, whichever does NOT correspond to the scrolling direction.\n */\n get _viewDim2() {\n return this._viewportSize[this._secondarySizeDim];\n }\n _scheduleReflow() {\n this._pendingReflow = true;\n }\n _scheduleLayoutUpdate() {\n this._pendingLayoutUpdate = true;\n this._scheduleReflow();\n }\n // For triggering a reflow based on incoming changes to\n // the layout config.\n _triggerReflow() {\n this._scheduleLayoutUpdate();\n // TODO graynorton@: reflowIfNeeded() isn't really supposed\n // to be called internally. Address in larger cleanup\n // of virtualizer / layout interaction pattern.\n // this.reflowIfNeeded(true);\n Promise.resolve().then(() => this.reflowIfNeeded());\n }\n _reflow() {\n if (this._pendingLayoutUpdate) {\n this._updateLayout();\n this._pendingLayoutUpdate = false;\n }\n this._updateScrollSize();\n this._setPositionFromPin();\n this._getActiveItems();\n this._updateVisibleIndices();\n this._sendStateChangedMessage();\n }\n /**\n * If we are supposed to be pinned to a particular\n * item or set of coordinates, we set `_scrollPosition`\n * accordingly and adjust `_scrollError` as needed\n * so that the virtualizer can keep the scroll\n * position in the DOM in sync\n */\n _setPositionFromPin() {\n if (this.pin !== null) {\n const lastScrollPosition = this._scrollPosition;\n const { index, block } = this.pin;\n this._scrollPosition =\n this._calculateScrollIntoViewPosition({\n index,\n block: block || 'start',\n }) - this.offsetWithinScroller[this._positionDim];\n this._scrollError = lastScrollPosition - this._scrollPosition;\n }\n }\n /**\n * Calculate the coordinates to scroll to, given\n * a request to scroll to the element at a specific\n * index.\n *\n * Supports the same positioning options (`start`,\n * `center`, `end`, `nearest`) as the standard\n * `Element.scrollIntoView()` method, but currently\n * only considers the provided value in the `block`\n * dimension, since we don't yet have any layouts\n * that support virtualization in two dimensions.\n */\n _calculateScrollIntoViewPosition(options) {\n const { block } = options;\n const index = Math.min(this.items.length, Math.max(0, options.index));\n const itemStartPosition = this._getItemPosition(index)[this._positionDim];\n let scrollPosition = itemStartPosition;\n if (block !== 'start') {\n const itemSize = this._getItemSize(index)[this._sizeDim];\n if (block === 'center') {\n scrollPosition =\n itemStartPosition - 0.5 * this._viewDim1 + 0.5 * itemSize;\n }\n else {\n const itemEndPosition = itemStartPosition - this._viewDim1 + itemSize;\n if (block === 'end') {\n scrollPosition = itemEndPosition;\n }\n else {\n // block === 'nearest'\n const currentScrollPosition = this._scrollPosition;\n scrollPosition =\n Math.abs(currentScrollPosition - itemStartPosition) <\n Math.abs(currentScrollPosition - itemEndPosition)\n ? itemStartPosition\n : itemEndPosition;\n }\n }\n }\n scrollPosition += this.offsetWithinScroller[this._positionDim];\n return this._clampScrollPosition(scrollPosition);\n }\n getScrollIntoViewCoordinates(options) {\n return {\n [this._positionDim]: this._calculateScrollIntoViewPosition(options),\n };\n }\n _sendUnpinnedMessage() {\n this._hostSink({\n type: 'unpinned',\n });\n }\n _sendVisibilityChangedMessage() {\n this._hostSink({\n type: 'visibilityChanged',\n firstVisible: this._firstVisible,\n lastVisible: this._lastVisible,\n });\n }\n _sendStateChangedMessage() {\n const childPositions = new Map();\n if (this._first !== -1 && this._last !== -1) {\n for (let idx = this._first; idx <= this._last; idx++) {\n childPositions.set(idx, this._getItemPosition(idx));\n }\n }\n const message = {\n type: 'stateChanged',\n scrollSize: {\n [this._sizeDim]: this._scrollSize,\n [this._secondarySizeDim]: null,\n },\n range: {\n first: this._first,\n last: this._last,\n firstVisible: this._firstVisible,\n lastVisible: this._lastVisible,\n },\n childPositions,\n };\n if (this._scrollError) {\n message.scrollError = {\n [this._positionDim]: this._scrollError,\n [this._secondaryPositionDim]: 0,\n };\n this._scrollError = 0;\n }\n this._hostSink(message);\n }\n /**\n * Number of items to display.\n */\n get _num() {\n if (this._first === -1 || this._last === -1) {\n return 0;\n }\n return this._last - this._first + 1;\n }\n _checkThresholds() {\n if ((this._viewDim1 === 0 && this._num > 0) || this._pin !== null) {\n this._scheduleReflow();\n }\n else {\n const min = Math.max(0, this._scrollPosition - this._overhang);\n const max = Math.min(this._scrollSize, this._scrollPosition + this._viewDim1 + this._overhang);\n if (this._physicalMin > min || this._physicalMax < max) {\n this._scheduleReflow();\n }\n else {\n this._updateVisibleIndices({ emit: true });\n }\n }\n }\n /**\n * Find the indices of the first and last items to intersect the viewport.\n * Emit a visibleindiceschange event when either index changes.\n */\n _updateVisibleIndices(options) {\n if (this._first === -1 || this._last === -1)\n return;\n let firstVisible = this._first;\n while (firstVisible < this._last &&\n Math.round(this._getItemPosition(firstVisible)[this._positionDim] +\n this._getItemSize(firstVisible)[this._sizeDim]) <= Math.round(this._scrollPosition)) {\n firstVisible++;\n }\n let lastVisible = this._last;\n while (lastVisible > this._first &&\n Math.round(this._getItemPosition(lastVisible)[this._positionDim]) >=\n Math.round(this._scrollPosition + this._viewDim1)) {\n lastVisible--;\n }\n if (firstVisible !== this._firstVisible ||\n lastVisible !== this._lastVisible) {\n this._firstVisible = firstVisible;\n this._lastVisible = lastVisible;\n if (options && options.emit) {\n this._sendVisibilityChangedMessage();\n }\n }\n }\n}\n//# sourceMappingURL=BaseLayout.js.map","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { SizeCache } from './shared/SizeCache.js';\nimport { BaseLayout, dim1 } from './shared/BaseLayout.js';\nexport const flow = (config) => Object.assign({\n type: FlowLayout,\n}, config);\nfunction leadingMargin(direction) {\n return direction === 'horizontal' ? 'marginLeft' : 'marginTop';\n}\nfunction trailingMargin(direction) {\n return direction === 'horizontal' ? 'marginRight' : 'marginBottom';\n}\nfunction offset(direction) {\n return direction === 'horizontal' ? 'xOffset' : 'yOffset';\n}\nfunction collapseMargins(a, b) {\n const m = [a, b].sort();\n return m[1] <= 0 ? Math.min(...m) : m[0] >= 0 ? Math.max(...m) : m[0] + m[1];\n}\nclass MetricsCache {\n constructor() {\n this._childSizeCache = new SizeCache();\n this._marginSizeCache = new SizeCache();\n this._metricsCache = new Map();\n }\n update(metrics, direction) {\n const marginsToUpdate = new Set();\n Object.keys(metrics).forEach((key) => {\n const k = Number(key);\n this._metricsCache.set(k, metrics[k]);\n this._childSizeCache.set(k, metrics[k][dim1(direction)]);\n marginsToUpdate.add(k);\n marginsToUpdate.add(k + 1);\n });\n for (const k of marginsToUpdate) {\n const a = this._metricsCache.get(k)?.[leadingMargin(direction)] || 0;\n const b = this._metricsCache.get(k - 1)?.[trailingMargin(direction)] || 0;\n this._marginSizeCache.set(k, collapseMargins(a, b));\n }\n }\n get averageChildSize() {\n return this._childSizeCache.averageSize;\n }\n get totalChildSize() {\n return this._childSizeCache.totalSize;\n }\n get averageMarginSize() {\n return this._marginSizeCache.averageSize;\n }\n get totalMarginSize() {\n return this._marginSizeCache.totalSize;\n }\n getLeadingMarginValue(index, direction) {\n return this._metricsCache.get(index)?.[leadingMargin(direction)] || 0;\n }\n getChildSize(index) {\n return this._childSizeCache.getSize(index);\n }\n getMarginSize(index) {\n return this._marginSizeCache.getSize(index);\n }\n clear() {\n this._childSizeCache.clear();\n this._marginSizeCache.clear();\n this._metricsCache.clear();\n }\n}\nexport class FlowLayout extends BaseLayout {\n constructor() {\n super(...arguments);\n /**\n * Initial estimate of item size\n */\n this._itemSize = { width: 100, height: 100 };\n /**\n * Indices of children mapped to their (position and length) in the scrolling\n * direction. Used to keep track of children that are in range.\n */\n this._physicalItems = new Map();\n /**\n * Used in tandem with _physicalItems to track children in range across\n * reflows.\n */\n this._newPhysicalItems = new Map();\n /**\n * Width and height of children by their index.\n */\n this._metricsCache = new MetricsCache();\n /**\n * anchorIdx is the anchor around which we reflow. It is designed to allow\n * jumping to any point of the scroll size. We choose it once and stick with\n * it until stable. _first and _last are deduced around it.\n */\n this._anchorIdx = null;\n /**\n * Position in the scrolling direction of the anchor child.\n */\n this._anchorPos = null;\n /**\n * Whether all children in range were in range during the previous reflow.\n */\n this._stable = true;\n this._measureChildren = true;\n this._estimate = true;\n }\n // protected _defaultConfig: BaseLayoutConfig = Object.assign({}, super._defaultConfig, {\n // })\n // constructor(config: Layout1dConfig) {\n // super(config);\n // }\n get measureChildren() {\n return this._measureChildren;\n }\n /**\n * Determine the average size of all children represented in the sizes\n * argument.\n */\n updateItemSizes(sizes) {\n this._metricsCache.update(sizes, this.direction);\n // if (this._nMeasured) {\n // this._updateItemSize();\n this._scheduleReflow();\n // }\n }\n /**\n * Set the average item size based on the total length and number of children\n * in range.\n */\n // _updateItemSize() {\n // // Keep integer values.\n // this._itemSize[this._sizeDim] = this._metricsCache.averageChildSize;\n // }\n _getPhysicalItem(idx) {\n return this._newPhysicalItems.get(idx) ?? this._physicalItems.get(idx);\n }\n _getSize(idx) {\n const item = this._getPhysicalItem(idx);\n return item && this._metricsCache.getChildSize(idx);\n }\n _getAverageSize() {\n return this._metricsCache.averageChildSize || this._itemSize[this._sizeDim];\n }\n _estimatePosition(idx) {\n const c = this._metricsCache;\n if (this._first === -1 || this._last === -1) {\n return (c.averageMarginSize +\n idx * (c.averageMarginSize + this._getAverageSize()));\n }\n else {\n if (idx < this._first) {\n const delta = this._first - idx;\n const refItem = this._getPhysicalItem(this._first);\n return (refItem.pos -\n (c.getMarginSize(this._first - 1) || c.averageMarginSize) -\n (delta * c.averageChildSize + (delta - 1) * c.averageMarginSize));\n }\n else {\n const delta = idx - this._last;\n const refItem = this._getPhysicalItem(this._last);\n return (refItem.pos +\n (c.getChildSize(this._last) || c.averageChildSize) +\n (c.getMarginSize(this._last) || c.averageMarginSize) +\n delta * (c.averageChildSize + c.averageMarginSize));\n }\n }\n }\n /**\n * Returns the position in the scrolling direction of the item at idx.\n * Estimates it if the item at idx is not in the DOM.\n */\n _getPosition(idx) {\n const item = this._getPhysicalItem(idx);\n const { averageMarginSize } = this._metricsCache;\n return idx === 0\n ? this._metricsCache.getMarginSize(0) ?? averageMarginSize\n : item\n ? item.pos\n : this._estimatePosition(idx);\n }\n _calculateAnchor(lower, upper) {\n if (lower <= 0) {\n return 0;\n }\n if (upper > this._scrollSize - this._viewDim1) {\n return this.items.length - 1;\n }\n return Math.max(0, Math.min(this.items.length - 1, Math.floor((lower + upper) / 2 / this._delta)));\n }\n _getAnchor(lower, upper) {\n if (this._physicalItems.size === 0) {\n return this._calculateAnchor(lower, upper);\n }\n if (this._first < 0) {\n return this._calculateAnchor(lower, upper);\n }\n if (this._last < 0) {\n return this._calculateAnchor(lower, upper);\n }\n const firstItem = this._getPhysicalItem(this._first), lastItem = this._getPhysicalItem(this._last), firstMin = firstItem.pos, lastMin = lastItem.pos, lastMax = lastMin + this._metricsCache.getChildSize(this._last);\n if (lastMax < lower) {\n // Window is entirely past physical items, calculate new anchor\n return this._calculateAnchor(lower, upper);\n }\n if (firstMin > upper) {\n // Window is entirely before physical items, calculate new anchor\n return this._calculateAnchor(lower, upper);\n }\n // Window contains a physical item\n // Find one, starting with the one that was previously first visible\n let candidateIdx = this._firstVisible - 1;\n let cMax = -Infinity;\n while (cMax < lower) {\n const candidate = this._getPhysicalItem(++candidateIdx);\n cMax = candidate.pos + this._metricsCache.getChildSize(candidateIdx);\n }\n return candidateIdx;\n }\n /**\n * Updates _first and _last based on items that should be in the current\n * viewed range.\n */\n _getActiveItems() {\n if (this._viewDim1 === 0 || this.items.length === 0) {\n this._clearItems();\n }\n else {\n this._getItems();\n }\n }\n /**\n * Sets the range to empty.\n */\n _clearItems() {\n this._first = -1;\n this._last = -1;\n this._physicalMin = 0;\n this._physicalMax = 0;\n const items = this._newPhysicalItems;\n this._newPhysicalItems = this._physicalItems;\n this._newPhysicalItems.clear();\n this._physicalItems = items;\n this._stable = true;\n }\n /*\n * Updates _first and _last based on items that should be in the given range.\n */\n _getItems() {\n const items = this._newPhysicalItems;\n this._stable = true;\n let lower, upper;\n // The anchorIdx is the anchor around which we reflow. It is designed to\n // allow jumping to any point of the scroll size. We choose it once and\n // stick with it until stable. first and last are deduced around it.\n // If we have a pinned item, we anchor on it\n if (this.pin !== null) {\n const { index } = this.pin;\n this._anchorIdx = index;\n this._anchorPos = this._getPosition(index);\n }\n // Determine the lower and upper bounds of the region to be\n // rendered, relative to the viewport\n lower = this._scrollPosition - this._overhang; //leadingOverhang;\n upper = this._scrollPosition + this._viewDim1 + this._overhang; // trailingOverhang;\n if (upper < 0 || lower > this._scrollSize) {\n this._clearItems();\n return;\n }\n // If we are scrolling to a specific index or if we are doing another\n // pass to stabilize a previously started reflow, we will already\n // have an anchor. If not, establish an anchor now.\n if (this._anchorIdx === null || this._anchorPos === null) {\n this._anchorIdx = this._getAnchor(lower, upper);\n this._anchorPos = this._getPosition(this._anchorIdx);\n }\n let anchorSize = this._getSize(this._anchorIdx);\n if (anchorSize === undefined) {\n this._stable = false;\n anchorSize = this._getAverageSize();\n }\n const anchorLeadingMargin = this._metricsCache.getMarginSize(this._anchorIdx) ??\n this._metricsCache.averageMarginSize;\n const anchorTrailingMargin = this._metricsCache.getMarginSize(this._anchorIdx + 1) ??\n this._metricsCache.averageMarginSize;\n if (this._anchorIdx === 0) {\n this._anchorPos = anchorLeadingMargin;\n }\n if (this._anchorIdx === this.items.length - 1) {\n this._anchorPos = this._scrollSize - anchorTrailingMargin - anchorSize;\n }\n // Anchor might be outside bounds, so prefer correcting the error and keep\n // that anchorIdx.\n let anchorErr = 0;\n if (this._anchorPos + anchorSize + anchorTrailingMargin < lower) {\n anchorErr = lower - (this._anchorPos + anchorSize + anchorTrailingMargin);\n }\n if (this._anchorPos - anchorLeadingMargin > upper) {\n anchorErr = upper - (this._anchorPos - anchorLeadingMargin);\n }\n if (anchorErr) {\n this._scrollPosition -= anchorErr;\n lower -= anchorErr;\n upper -= anchorErr;\n this._scrollError += anchorErr;\n }\n items.set(this._anchorIdx, { pos: this._anchorPos, size: anchorSize });\n this._first = this._last = this._anchorIdx;\n this._physicalMin = this._anchorPos - anchorLeadingMargin;\n this._physicalMax = this._anchorPos + anchorSize + anchorTrailingMargin;\n while (this._physicalMin > lower && this._first > 0) {\n let size = this._getSize(--this._first);\n if (size === undefined) {\n this._stable = false;\n size = this._getAverageSize();\n }\n let margin = this._metricsCache.getMarginSize(this._first);\n if (margin === undefined) {\n this._stable = false;\n margin = this._metricsCache.averageMarginSize;\n }\n this._physicalMin -= size;\n const pos = this._physicalMin;\n items.set(this._first, { pos, size });\n this._physicalMin -= margin;\n if (this._stable === false && this._estimate === false) {\n break;\n }\n }\n while (this._physicalMax < upper && this._last < this.items.length - 1) {\n let size = this._getSize(++this._last);\n if (size === undefined) {\n this._stable = false;\n size = this._getAverageSize();\n }\n let margin = this._metricsCache.getMarginSize(this._last);\n if (margin === undefined) {\n this._stable = false;\n margin = this._metricsCache.averageMarginSize;\n }\n const pos = this._physicalMax;\n items.set(this._last, { pos, size });\n this._physicalMax += size + margin;\n if (!this._stable && !this._estimate) {\n break;\n }\n }\n // This handles the cases where we were relying on estimated sizes.\n const extentErr = this._calculateError();\n if (extentErr) {\n this._physicalMin -= extentErr;\n this._physicalMax -= extentErr;\n this._anchorPos -= extentErr;\n this._scrollPosition -= extentErr;\n items.forEach((item) => (item.pos -= extentErr));\n this._scrollError += extentErr;\n }\n if (this._stable) {\n this._newPhysicalItems = this._physicalItems;\n this._newPhysicalItems.clear();\n this._physicalItems = items;\n }\n }\n _calculateError() {\n if (this._first === 0) {\n return this._physicalMin;\n }\n else if (this._physicalMin <= 0) {\n return this._physicalMin - this._first * this._delta;\n }\n else if (this._last === this.items.length - 1) {\n return this._physicalMax - this._scrollSize;\n }\n else if (this._physicalMax >= this._scrollSize) {\n return (this._physicalMax -\n this._scrollSize +\n (this.items.length - 1 - this._last) * this._delta);\n }\n return 0;\n }\n _reflow() {\n const { _first, _last } = this;\n super._reflow();\n if ((this._first === -1 && this._last == -1) ||\n (this._first === _first && this._last === _last)) {\n this._resetReflowState();\n }\n }\n _resetReflowState() {\n this._anchorIdx = null;\n this._anchorPos = null;\n this._stable = true;\n }\n _updateScrollSize() {\n const { averageMarginSize } = this._metricsCache;\n this._scrollSize = Math.max(1, this.items.length * (averageMarginSize + this._getAverageSize()) +\n averageMarginSize);\n }\n /**\n * Returns the average size (precise or estimated) of an item in the scrolling direction,\n * including any surrounding space.\n */\n get _delta() {\n const { averageMarginSize } = this._metricsCache;\n return this._getAverageSize() + averageMarginSize;\n }\n /**\n * Returns the top and left positioning of the item at idx.\n */\n _getItemPosition(idx) {\n return {\n [this._positionDim]: this._getPosition(idx),\n [this._secondaryPositionDim]: 0,\n [offset(this.direction)]: -(this._metricsCache.getLeadingMarginValue(idx, this.direction) ??\n this._metricsCache.averageMarginSize),\n };\n }\n /**\n * Returns the height and width of the item at idx.\n */\n _getItemSize(idx) {\n return {\n [this._sizeDim]: this._getSize(idx) || this._getAverageSize(),\n [this._secondarySizeDim]: this._itemSize[this._secondarySizeDim],\n };\n }\n _viewDim2Changed() {\n this._metricsCache.clear();\n this._scheduleReflow();\n }\n}\n//# sourceMappingURL=flow.js.map"],"x_google_ignoreList":[0,1,2],"mappings":"AAKA,IAAa,IAAb,MAAA;CACI,YAAY,GAAA;AACR,OAAK,uBAAO,IAAI,KAAA,EAChB,KAAK,oBAAA,CAAoB,GACzB,KAAK,YAAY,GAAA,CACgB,MAA7B,GAAQ,qBACR,KAAK,oBAAA,CAAoB;;CAGjC,IAAI,GAAO,GAAA;EACP,IAAM,IAAO,KAAK,KAAK,IAAI,EAAA,IAAU;AACrC,OAAK,KAAK,IAAI,GAAO,EAAA,EACrB,KAAK,aAAa,IAAQ;;CAE9B,IAAA,cAAI;AACA,MAAI,KAAK,KAAK,OAAO,GAAG;GACp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