@limetech/lime-elements 39.35.0 → 39.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-code-diff.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +56 -18
- package/dist/cjs/limel-text-editor.cjs.entry.js +21 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/code-diff/code-diff.js +11 -3
- package/dist/collection/components/code-diff/code-diff.types.js +1 -0
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +73 -18
- package/dist/collection/components/text-editor/text-editor.js +38 -1
- package/dist/collection/interface.js +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-code-diff.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +56 -18
- package/dist/esm/limel-text-editor.entry.js +21 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-366419ee.entry.js +1 -0
- package/dist/lime-elements/{p-e54bbdb3.entry.js → p-b7d734d2.entry.js} +1 -1
- package/dist/lime-elements/{p-4f396a5e.entry.js → p-d98168a1.entry.js} +1 -1
- package/dist/types/components/code-diff/code-diff.d.ts +3 -1
- package/dist/types/components/code-diff/code-diff.types.d.ts +9 -0
- package/dist/types/components/text-editor/prosemirror-adapter/prosemirror-adapter.d.ts +16 -0
- package/dist/types/components/text-editor/text-editor.d.ts +17 -0
- package/dist/types/components.d.ts +17 -3
- package/dist/types/interface.d.ts +1 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-13d56964.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t,H as n,a as o}from"./p-BGxJfR2f.js";import{t as r}from"./p-EPnIW0K5.js";class i{diff(e,t,n={}){let o;"function"==typeof n?(o=n,n={}):"callback"in n&&(o=n.callback);const r=this.castInput(e,n),i=this.castInput(t,n),s=this.removeEmpty(this.tokenize(r,n)),l=this.removeEmpty(this.tokenize(i,n));return this.diffWithOptionsObj(s,l,n,o)}diffWithOptionsObj(e,t,n,o){var r;const i=e=>(e=this.postProcess(e,n),o?void setTimeout((function(){o(e)}),0):e),s=t.length,l=e.length;let a=1,d=s+l;null!=n.maxEditLength&&(d=Math.min(d,n.maxEditLength));const c=null!==(r=n.timeout)&&void 0!==r?r:1/0,f=Date.now()+c,u=[{oldPos:-1,lastComponent:void 0}];let h=this.extractCommon(u[0],t,e,0,n);if(u[0].oldPos+1>=l&&h+1>=s)return i(this.buildValues(u[0].lastComponent,t,e));let b=-1/0,v=1/0;const p=()=>{for(let o=Math.max(b,-a);o<=Math.min(v,a);o+=2){let r;const a=u[o-1],d=u[o+1];a&&(u[o-1]=void 0);let c=!1;if(d){const e=d.oldPos-o;c=d&&0<=e&&e<s}const f=a&&a.oldPos+1<l;if(c||f){if(r=!f||c&&a.oldPos<d.oldPos?this.addToPath(d,!0,!1,0,n):this.addToPath(a,!1,!0,1,n),h=this.extractCommon(r,t,e,o,n),r.oldPos+1>=l&&h+1>=s)return i(this.buildValues(r.lastComponent,t,e))||!0;u[o]=r,r.oldPos+1>=l&&(v=Math.min(v,o-1)),h+1>=s&&(b=Math.max(b,o+1))}else u[o]=void 0}a++};if(o)!function e(){setTimeout((function(){if(a>d||Date.now()>f)return o(void 0);p()||e()}),0)}();else for(;a<=d&&Date.now()<=f;){const e=p();if(e)return e}}addToPath(e,t,n,o,r){const i=e.lastComponent;return i&&!r.oneChangePerToken&&i.added===t&&i.removed===n?{oldPos:e.oldPos+o,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}}extractCommon(e,t,n,o,r){const i=t.length,s=n.length;let l=e.oldPos,a=l-o,d=0;for(;a+1<i&&l+1<s&&this.equals(n[l+1],t[a+1],r);)a++,l++,d++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!r.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,a}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const o=[];let r;for(;e;)o.push(e),r=e.previousComponent,delete e.previousComponent,e=r;o.reverse();const i=o.length;let s=0,l=0,a=0;for(;s<i;s++){const e=o[s];if(e.removed)e.value=this.join(n.slice(a,a+e.count)),a+=e.count;else{if(!e.added&&this.useLongestToken){let o=t.slice(l,l+e.count);o=o.map((function(e,t){const o=n[a+t];return o.length>e.length?o:e})),e.value=this.join(o)}else e.value=this.join(t.slice(l,l+e.count));l+=e.count,e.added||(a+=e.count)}}return o}}function s(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function l(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function a(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function d(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function c(e,t){return a(e,t,"")}function f(e,t){return d(e,t,"")}function u(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let o=t.length;e.length<t.length&&(o=e.length);const r=Array(o);let i=0;r[0]=0;for(let e=1;e<o;e++){for(r[e]=t[e]==t[i]?r[i]:i;i>0&&t[e]!=t[i];)i=r[i];t[e]==t[i]&&i++}i=0;for(let o=n;o<e.length;o++){for(;i>0&&e[o]!=t[i];)i=r[i];e[o]==t[i]&&i++}return i}(e,t))}function h(e,t){const n=[];for(const o of Array.from(t.segment(e))){const e=o.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function b(e,t){if(t)return p(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function v(e,t){if(t)return p(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function p(e,t){if(!t)return[v(e),b(e)];if("word"!=t.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');const n=h(e,t),o=n[0],r=n[n.length-1];return[/\s/.test(o)?o:"",/\s/.test(r)?r:""]}const m="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",g=new RegExp(`[${m}]+|\\s+|[^${m}]`,"ug"),x=new class extends i{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){const o=t.intlSegmenter;if("word"!=o.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');n=h(e,o)}else n=e.match(g)||[];const o=[];let r=null;return n.forEach((e=>{/\s/.test(e)?o.push(null==r?e:o.pop()+e):null!=r&&/\s/.test(r)?o.push(o[o.length-1]==r?o.pop()+e:r+e):o.push(e),r=e})),o}join(e){return e.map(((e,t)=>0==t?e:e.replace(/^\s+/,""))).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,o=null,r=null;return e.forEach((e=>{e.added?o=e:e.removed?r=e:((o||r)&&y(n,r,o,e,t.intlSegmenter),n=e,o=null,r=null)})),(o||r)&&y(n,r,o,null,t.intlSegmenter),e}};function y(e,t,n,o,r){if(t&&n){const[i,u]=p(t.value,r),[h,b]=p(n.value,r);if(e){const o=s(i,h);e.value=d(e.value,h,o),t.value=c(t.value,o),n.value=c(n.value,o)}if(o){const e=l(u,b);o.value=a(o.value,b,e),t.value=f(t.value,e),n.value=f(n.value,e)}}else if(n){if(e){const e=v(n.value,r);n.value=n.value.substring(e.length)}if(o){const e=v(o.value,r);o.value=o.value.substring(e.length)}}else if(e&&o){const n=v(o.value,r),[i,u]=p(t.value,r),h=s(n,i);t.value=c(t.value,h);const b=l(c(n,h),u);t.value=f(t.value,b),o.value=a(o.value,n,b),e.value=d(e.value,n,n.slice(0,n.length-b.length))}else if(o){const e=v(o.value,r),n=u(b(t.value,r),e);t.value=f(t.value,n)}else if(e){const n=u(b(e.value,r),v(t.value,r));t.value=c(t.value,n)}}const w=new class extends i{constructor(){super(...arguments),this.tokenize=k}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function k(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));const n=[],o=e.split(/(\n|\r\n)/);o[o.length-1]||o.pop();for(let e=0;e<o.length;e++){const r=o[e];e%2&&!t.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}function _(e,t,n){const o=[];for(;t<e.length&&"removed"===e[t].type;)o.push(e[t]),t++;const r=[];for(;t<e.length&&"added"===e[t].type;)r.push(e[t]),t++;const i=Math.max(o.length,r.length);for(let e=0;e<i;e++)n.push({left:e<o.length?o[e]:void 0,right:e<r.length?r[e]:void 0});return t}function C(e,t=!1){if("object"==typeof e&&null!==e)return JSON.stringify(S(e),null,4);if("string"==typeof e&&t)try{const t=JSON.parse(e);return JSON.stringify(S(t),null,4)}catch(t){return e}return String(null!=e?e:"")}function S(e){if(Array.isArray(e))return e.map(S);if(null!==e&&"object"==typeof e){const t={},n=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));for(const o of n)t[o]=S(e[o]);return t}return e}function j(e){if(!e)return[];const t=e.split("\n");return t.length>0&&""===t.at(-1)&&t.pop(),t}function D(e,t){const n=x.diff(e,t,undefined);const o=[],r=[];for(const e of n)e.added?r.push({value:e.value,type:"added"}):e.removed?o.push({value:e.value,type:"removed"}):(o.push({value:e.value,type:"equal"}),r.push({value:e.value,type:"equal"}));return[o,r]}const O=[[/"(?:[^"\\]|\\.)*"/,"string"],[/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/,"number"],[/\b(?:true|false)\b/,"boolean"],[/\bnull\b/,"null"],[/[{}[\]:,]/,"punctuation"]],M=new RegExp(O.map((([e])=>`(${e.source})`)).join("|"),"g");function $(e){for(const[t,[,n]]of O.entries())if(void 0!==e[t+1])return n;return"plain"}const A=class{constructor(t){e(this,t),this.oldValue="",this.newValue="",this.layout="unified",this.contextLines=3,this.lineWrapping=!0,this.reformatJson=!1,this.translationLanguage="en",this.diffResult={hunks:[],additions:0,deletions:0,allLines:[]},this.liveAnnouncement="",this.copyState="idle",this.searchVisible=!1,this.searchTerm="",this.currentMatchIndex=0,this.focusedRowIndex=-1,this.normalizedOldText="",this.searchMatchCounter=0,this.totalSearchMatches=0,this.isRenderingRemovedLine=!1,this.activeSearchRegex=null,this.prevSearchVisible=!1}componentWillLoad(){this.recomputeDiff()}componentDidRender(){var e,t;if(this.searchVisible&&!this.prevSearchVisible&&(null===(e=this.searchInputEl)||void 0===e||e.focus()),this.prevSearchVisible=this.searchVisible,this.searchTerm&&this.totalSearchMatches>0){const e=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".search-match--current");null==e||e.scrollIntoView({block:"center",behavior:"smooth"})}}render(){var e;this.searchMatchCounter=0,this.activeSearchRegex=(e=this.searchTerm)?new RegExp(`(${function(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(e)})`,"gi"):null;const o=this.renderDiff();this.totalSearchMatches=this.searchMatchCounter;const r=this.computeLineNumberWidth();return t(n,{key:"85dc5cd00f441edf194ce90698bf1f6a44e1630a",style:{"--limel-line-number-min-width":r}},this.renderHeader(),this.renderScreenReaderSummary(),this.searchVisible&&this.renderSearchBar(),t("div",{key:"a381e603b3e177a184711dfa46deb0d1c3d7080c",class:"diff-body",role:"table","aria-label":this.getTranslation("code-diff.table-label"),tabindex:"0",onKeyDown:e=>this.handleKeyDown(e)},o),t("div",{key:"827d60b982ca309f6225290ff6c40f1df05cd2d2",class:"screen-reader-only",role:"status","aria-live":"polite","aria-atomic":"true"},this.liveAnnouncement))}watchInputs(){this.recomputeDiff()}recomputeDiff(){const e=C(this.oldValue,this.reformatJson),t=C(this.newValue,this.reformatJson);this.normalizedOldText=e,this.diffResult=function(e,t,n=3){const o=function(e,t){const n=w.diff(e,t,void 0),o=[];let r=1,i=1;for(const e of n){const t=j(e.value);for(const n of t)o.push(e.added?{type:"added",content:n,newLineNumber:i++}:e.removed?{type:"removed",content:n,oldLineNumber:r++}:{type:"context",content:n,oldLineNumber:r++,newLineNumber:i++})}return function(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&"removed"===e[t].type;)t++;const o=t,r=t;for(;t<e.length&&"added"===e[t].type;)t++;const i=o-n,s=t-r;if(i>0&&s>0){const t=Math.min(i,s);for(let o=0;o<t;o++){const t=e[n+o],i=e[r+o],[s,l]=D(t.content,i.content);t.segments=s,i.segments=l}}t===n&&t++}}(o),o}(e,t);return function(e,t){if(0===e.length)return{hunks:[],additions:0,deletions:0,allLines:e};let n=0,o=0;for(const t of e)"added"===t.type?n++:"removed"===t.type&&o++;if(0===n&&0===o)return{hunks:[],additions:0,deletions:0,allLines:e};const r=[];for(const[t,n]of e.entries())"context"!==n.type&&r.push(t);const i=function(e,t,n){if(0===e.length)return[];const o=[];let r=Math.max(0,e[0]-n),i=Math.min(t,e[0]+n+1);for(let s=1;s<e.length;s++){const l=Math.max(0,e[s]-n),a=Math.min(t,e[s]+n+1);l<=i?i=Math.max(i,a):(o.push({start:r,end:i}),r=l,i=a)}return o.push({start:r,end:i}),o}(r,e.length,t),s=[];let l=0;for(const t of i){const n=e.slice(t.start,t.end),o=t.start-l;s.push({lines:n,collapsedBefore:o>0?o:void 0,startIndex:t.start}),l=t.end}const a=i.at(-1);return{hunks:s,additions:n,deletions:o,collapsedAfter:a.end<e.length?e.length-a.end:void 0,allLines:e}}(o,n)}(e,t,this.contextLines),this.focusedRowIndex=-1}formatSrSummary(){const{additions:e,deletions:t}=this.diffResult;if(0===e&&0===t)return null;const n=[];return e>0&&n.push(this.getTranslation(1===e?"code-diff.diff-addition":"code-diff.diff-additions",{count:e})),t>0&&n.push(this.getTranslation(1===t?"code-diff.diff-deletion":"code-diff.diff-deletions",{count:t})),this.getTranslation("code-diff.diff-summary",{parts:n.join(", ")})}renderScreenReaderSummary(){const e=this.formatSrSummary();return t("div",{class:"screen-reader-only",role:"status","aria-live":"polite"},null!=e?e:this.getTranslation("code-diff.no-differences-found"))}handleKeyDown(e){if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t=this.getDiffRows();0!==t.length&&(this.focusedRowIndex="ArrowDown"===e.key?Math.min(this.focusedRowIndex+1,t.length-1):Math.max(this.focusedRowIndex-1,0),this.updateRowFocus(t))}getDiffRows(){var e;const t=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector(".diff-body");return t?[...t.querySelectorAll(".diff-line:not(.diff-line--collapsed)")]:[]}updateRowFocus(e){for(const t of e)t.removeAttribute("tabindex"),t.classList.remove("diff-line--focused");const t=e[this.focusedRowIndex];t&&(t.setAttribute("tabindex","-1"),t.classList.add("diff-line--focused"),t.focus(),this.announceLine(t))}announceLine(e){var t,n;let o=this.getTranslation("code-diff.line-context");e.classList.contains("diff-line--added")?o=this.getTranslation("code-diff.line-added"):e.classList.contains("diff-line--removed")&&(o=this.getTranslation("code-diff.line-removed"));const r=null!==(n=null===(t=e.querySelector(".line-content, .split-content"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:"",i=r.length>80?r.slice(0,80)+"…":r;this.liveAnnouncement=`${o}: ${i}`}renderHeader(){var e,n;const o=null!==(e=this.oldHeading)&&void 0!==e?e:this.getTranslation("code-diff.old-heading"),r=null!==(n=this.newHeading)&&void 0!==n?n:this.getTranslation("code-diff.new-heading"),{additions:i,deletions:s}=this.diffResult,l=i>0||s>0;return t("div",{class:"diff-header"},t("div",{class:"diff-header__labels"},t("span",{class:"diff-header__old"},o),t("span",{class:"diff-header__new"},r)),t("div",{class:"diff-header__actions"},t("div",{class:"diff-header__stats"},i>0&&t("span",{class:"stat stat--added"},"+",i),s>0&&t("span",{class:"stat stat--removed"},"-",s)),l&&this.renderCopyButton(),s>0&&this.renderSearchToggle()))}renderCopyButton(){const e=this.getTranslation("copied"===this.copyState?"code-diff.copied":"code-diff.copy-old-version");return t("limel-icon-button",{label:e,icon:"copied"===this.copyState?"checkmark":"copy",onClick:()=>this.copyToClipboard(this.normalizedOldText)})}async copyToClipboard(e){try{await navigator.clipboard.writeText(e),this.copyState="copied",this.liveAnnouncement=this.getTranslation("code-diff.copied-to-clipboard"),setTimeout((()=>{this.copyState="idle"}),2e3)}catch(e){}}renderSearchToggle(){return t("limel-icon-button",{class:{"search-toggle--active":this.searchVisible},label:this.getTranslation("code-diff.search"),icon:"search",onClick:()=>this.toggleSearch()})}renderSearchBar(){const e=0===this.totalSearchMatches?this.getTranslation("code-diff.no-matches"):this.getTranslation("code-diff.match-count",{current:this.currentMatchIndex+1,total:this.totalSearchMatches});return t("div",{class:"search-bar"},t("limel-input-field",{class:"search-bar__input",type:"search",placeholder:this.getTranslation("code-diff.search")+"…",value:this.searchTerm,onChange:e=>this.onSearchInput(e),onKeyDown:e=>this.onSearchKeyDown(e),ref:e=>this.searchInputEl=e}),t("span",{class:"search-bar__count"},e),t("limel-action-bar",{actions:this.getSearchActions(),onItemSelected:e=>this.onSearchAction(e)}))}toggleSearch(){this.searchVisible=!this.searchVisible,this.searchVisible||(this.searchTerm="",this.currentMatchIndex=0)}onSearchInput(e){this.searchTerm=e.detail,this.currentMatchIndex=0}onSearchKeyDown(e){"Enter"===e.key?(e.preventDefault(),this.navigateSearch(e.shiftKey?-1:1)):"Escape"===e.key&&this.toggleSearch()}computeLineNumberWidth(){return`calc(${String(this.diffResult.allLines.length).length}ch + 2 * var(--limel-code-diff-line-number-padding))`}getSearchActions(){const e=0===this.totalSearchMatches;return[{text:this.getTranslation("code-diff.previous-match"),icon:"-lime-caret-top",iconOnly:!0,disabled:e,value:"prev"},{text:this.getTranslation("code-diff.next-match"),icon:"-lime-caret-bottom",iconOnly:!0,disabled:e,value:"next"},{text:this.getTranslation("code-diff.close-search"),icon:"cancel",iconOnly:!0,value:"close"}]}onSearchAction(e){const{value:t}=e.detail;"prev"===t?this.navigateSearch(-1):"next"===t?this.navigateSearch(1):"close"===t&&this.toggleSearch()}navigateSearch(e){this.currentMatchIndex=function(e,t,n){return 0===n?0:(e+t+n)%n}(this.currentMatchIndex,e,this.totalSearchMatches)}renderDiff(){const{hunks:e,collapsedAfter:n}=this.diffResult;return 0===e.length?t("div",{class:"diff-empty"},this.getTranslation("code-diff.no-differences")):this.renderHunks(e,n,"split"===this.layout?e=>this.renderSplitHunkRows(e):e=>this.renderHunkLines(e))}renderHunks(e,t,n){const o=[];for(const[t,r]of e.entries())r.collapsedBefore&&o.push(this.renderCollapsedRow(r.collapsedBefore,t)),o.push(...n(r));return t&&o.push(this.renderCollapsedAfterRow(t)),o}renderHunkLines(e){const t=[];let n=0;for(;n<e.lines.length;){const o=e.lines[n];if("context"===o.type){t.push(this.renderLine(o)),n++;continue}const r=[];for(;n<e.lines.length&&"context"!==e.lines[n].type;)r.push(e.lines[n]),n++;t.push(this.renderChangeBlock(r))}return t}renderChangeBlock(e){const n=function(e){return e.filter((e=>"removed"===e.type)).map((e=>e.content)).join("\n")}(e);return t("div",{class:"change-group"},e.map((e=>this.renderLine(e))),n&&this.renderBlockCopyButton(n))}renderLine(e){var n,o;const r={added:"+",removed:"-",context:" "}[e.type];return t("div",{class:{"diff-line":!0,[`diff-line--${e.type}`]:!0},role:"row"},t("span",{class:"line-number line-number--old",role:"cell","aria-label":e.oldLineNumber?this.getTranslation("code-diff.old-line",{number:e.oldLineNumber}):void 0},null!==(n=e.oldLineNumber)&&void 0!==n?n:""),t("span",{class:"line-number line-number--new",role:"cell","aria-label":e.newLineNumber?this.getTranslation("code-diff.new-line",{number:e.newLineNumber}):void 0},null!==(o=e.newLineNumber)&&void 0!==o?o:""),t("span",{class:"line-indicator",role:"cell"},r),t("span",{class:"line-content",role:"cell"},this.renderContent(e)))}renderSplitHunkRows(e){var t,n,o,r;const i=function(e){const t=[];let n=0;for(;n<e.length;){const o=e[n];"context"!==o.type?n=_(e,n,t):(t.push({left:o,right:o}),n++)}return t}(e.lines),s=[];let l=0;for(;l<i.length;){const e=i[l];if("context"===(null===(t=e.left)||void 0===t?void 0:t.type)&&"context"===(null===(n=e.right)||void 0===n?void 0:n.type)){s.push(this.renderSplitRow(e)),l++;continue}const a=[];for(;l<i.length;){const e=i[l];if("context"===(null===(o=e.left)||void 0===o?void 0:o.type)&&"context"===(null===(r=e.right)||void 0===r?void 0:r.type))break;a.push(e),l++}s.push(this.renderSplitChangeBlock(a))}return s}renderSplitChangeBlock(e){const n=function(e){return e.filter((e=>{var t;return"removed"===(null===(t=e.left)||void 0===t?void 0:t.type)})).map((e=>e.left.content)).join("\n")}(e);return t("div",{class:"change-group"},e.map((e=>this.renderSplitRow(e))),n&&this.renderBlockCopyButton(n))}renderSplitRow(e){var n,o,r,i,s,l,a,d,c,f;const u=null!==(o=null===(n=e.left)||void 0===n?void 0:n.type)&&void 0!==o?o:"empty",h=null!==(i=null===(r=e.right)||void 0===r?void 0:r.type)&&void 0!==i?i:"empty",b=(null===(s=e.left)||void 0===s?void 0:s.oldLineNumber)?this.getTranslation("code-diff.old-line",{number:e.left.oldLineNumber}):void 0,v=(null===(l=e.right)||void 0===l?void 0:l.newLineNumber)?this.getTranslation("code-diff.new-line",{number:e.right.newLineNumber}):void 0;return t("div",{class:"diff-line diff-line--split",role:"row"},t("span",{class:"line-number line-number--old",role:"cell","aria-label":b},null!==(d=null===(a=e.left)||void 0===a?void 0:a.oldLineNumber)&&void 0!==d?d:""),t("span",{class:`split-content split-content--left split-content--${u}`,role:"cell"},e.left?this.renderContent(e.left):""),t("span",{class:"line-number line-number--new",role:"cell","aria-label":v},null!==(f=null===(c=e.right)||void 0===c?void 0:c.newLineNumber)&&void 0!==f?f:""),t("span",{class:`split-content split-content--right split-content--${h}`,role:"cell"},e.right?this.renderContent(e.right):""))}renderBlockCopyButton(e){return t("limel-icon-button",{class:"change-group__copy",elevated:!0,label:this.getTranslation("code-diff.copy-change"),icon:"copy",onClick:()=>this.copyToClipboard(e)})}renderContent(e){return this.isRenderingRemovedLine="removed"===e.type&&this.searchTerm.length>0,e.segments&&0!==e.segments.length?e.segments.map((t=>this.renderSegment(t,e.type))):this.renderSyntaxTokens(e.content)}renderSegment(e,n){const o=this.renderSyntaxTokens(e.value);return"equal"===e.type?o:t("mark",{class:"removed"===n?"segment--removed":"segment--added"},o)}renderSyntaxTokens(e){const t=function(e,t){return t&&0!==e.length&&"json"===t?function(e){const t=[];let n=0;M.lastIndex=0;let o=M.exec(e);for(;null!==o;){o.index>n&&t.push({value:e.slice(n,o.index),type:"plain"});const r=$(o),i=o[0];if("string"===r){const n=e.slice(o.index+i.length);/^\s*:/.test(n)?t.push({value:i,type:"key"}):t.push({value:i,type:"string"})}else t.push({value:i,type:r});n=o.index+i.length,o=M.exec(e)}return n<e.length&&t.push({value:e.slice(n),type:"plain"}),t}(e):[{value:e,type:"plain"}]}(e,this.language);return 1===t.length&&"plain"===t[0].type?this.renderSearchableText(e):t.map((e=>this.renderSyntaxToken(e)))}renderSyntaxToken(e){const n=this.renderSearchableText(e.value);return"plain"===e.type?n:t("span",{class:`syntax--${e.type}`},n)}renderSearchableText(e){if(!this.isRenderingRemovedLine||!this.activeSearchRegex)return e;const n=e.split(this.activeSearchRegex);return 1===n.length?e:n.map(((e,n)=>{if(n%2==0)return e;const o=this.searchMatchCounter++;return t("mark",{key:`match-${o}`,class:{"search-match":!0,"search-match--current":o===this.currentMatchIndex}},e)}))}renderCollapsedRow(e,n){return t("div",{class:"diff-line diff-line--collapsed",role:"row"},t("button",{class:"expand-button",type:"button",onClick:()=>this.expandHunk(n),"aria-label":this.getTranslation("code-diff.show-hidden-lines",{count:e})},this.getTranslation("code-diff.hidden-lines",{count:e})))}renderCollapsedAfterRow(e){return t("div",{class:"diff-line diff-line--collapsed",role:"row"},t("button",{class:"expand-button",type:"button",onClick:()=>this.expandAfter(),"aria-label":this.getTranslation("code-diff.show-hidden-lines",{count:e})},this.getTranslation("code-diff.hidden-lines",{count:e})))}expandHunk(e){const t=[...this.diffResult.hunks],n=t[e],o=e>0?t[e-1].startIndex+t[e-1].lines.length:0,r=this.diffResult.allLines.slice(o,n.startIndex);t[e]=Object.assign(Object.assign({},n),{lines:[...r,...n.lines],collapsedBefore:void 0,startIndex:o}),this.diffResult=Object.assign(Object.assign({},this.diffResult),{hunks:t}),this.liveAnnouncement=this.getTranslation("code-diff.expanded-lines")}expandAfter(){const e=[...this.diffResult.hunks],t=e.length-1,n=e[t],o=this.diffResult.allLines.slice(n.startIndex+n.lines.length);e[t]=Object.assign(Object.assign({},n),{lines:[...n.lines,...o]}),this.diffResult=Object.assign(Object.assign({},this.diffResult),{hunks:e,collapsedAfter:void 0}),this.liveAnnouncement=this.getTranslation("code-diff.expanded-lines-end")}getTranslation(e,t){return r.get(e,this.translationLanguage,t)}get host(){return o(this)}static get watchers(){return{oldValue:[{watchInputs:0}],newValue:[{watchInputs:0}],contextLines:[{watchInputs:0}],reformatJson:[{watchInputs:0}],layout:[{watchInputs:0}]}}};A.style='@charset "UTF-8";*,*::before,*::after{box-sizing:border-box;min-width:0;min-height:0}:host(limel-code-diff){--diff-added-bg:rgb(var(--color-green-default), 0.1);--diff-added-bg-hover:rgb(var(--color-green-default), 0.3);--diff-added-highlight-bg:rgb(var(--color-green-default), 0.3);--diff-removed-bg:rgb(var(--color-red-default), 0.1);--diff-removed-bg-hover:rgb(var(--color-red-default), 0.3);--diff-removed-highlight-bg:rgb(var(--color-red-default), 0.3);--diff-context-bg:transparent;--diff-indicator-added-color:rgb(var(--color-green-default));--diff-indicator-removed-color:rgb(var(--color-red-default));--diff-stat-added-color:rgb(var(--color-green-default));--diff-stat-removed-color:rgb(var(--color-red-default));--search-match-bg:rgb(var(--color-amber-default), 0.3);--search-match-current-bg:rgb(var(--color-amber-default), 0.6);--diff-line-hover-bg:rgb(var(--contrast-800), 0.08);--diff-gutter-bg:rgb(var(--contrast-200));--diff-gutter-text-color:rgb(var(--contrast-700));--diff-text-color:rgb(var(--contrast-1100));--diff-border-color:rgb(var(--contrast-400));--diff-collapsed-bg:rgb(var(--contrast-200));--diff-collapsed-text-color:rgb(var(--contrast-800));--diff-header-bg:rgb(var(--contrast-200));--diff-empty-text-color:rgb(var(--contrast-700));--diff-split-divider-color:rgb(var(--contrast-400));--diff-empty-cell-bg:rgb(var(--contrast-100));--syntax-string-color:rgb(var(--color-green-dark));--syntax-number-color:rgb(var(--color-blue-default));--syntax-boolean-color:rgb(var(--color-amber-darker));--syntax-key-color:rgb(var(--color-sky-dark));--syntax-null-color:rgb(var(--contrast-700));--syntax-punctuation-color:rgb(var(--contrast-700));--search-bar-bg:rgb(var(--contrast-100));--search-bar-border:rgb(var(--contrast-400));--limel-code-diff-line-number-padding:0.25rem;font-family:ui-sans-serif, system-ui, sans-serif;display:flex;flex-direction:column;width:100%;height:100%;color:var(--diff-text-color);border:1px solid var(--diff-border-color);border-radius:0.5rem;max-height:var(--code-diff-max-height, none)}.screen-reader-only{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}.diff-header{flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0.125rem 0.125rem 0.125rem 0.5rem;background:var(--diff-header-bg);border-bottom:1px solid var(--diff-border-color);font-family:ui-sans-serif, system-ui, sans-serif;font-size:0.75rem;border-radius:0.5rem 0.5rem 0 0}.diff-header__labels{display:flex;gap:0.75rem;font-weight:500}.diff-header__old,.diff-header__new{padding:0.125rem 0.25rem;border-radius:0.25rem;box-shadow:var(--shadow-brighten-edges-outside)}.diff-header__old{background-color:var(--diff-removed-bg)}.diff-header__new{background-color:var(--diff-added-bg)}.diff-header__actions{display:flex;align-items:center;gap:0.25rem}.search-toggle--active{--limel-theme-on-surface-color:var(--mdc-theme-primary)}.diff-header__stats{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;display:flex;gap:0.5rem;margin-right:0.5rem}.stat{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.8125rem;font-weight:600}.stat--added{color:var(--diff-stat-added-color)}.stat--removed{color:var(--diff-stat-removed-color)}.search-bar{flex-shrink:0;display:flex;align-items:center;gap:0.25rem;padding:0.25rem 0 0.25rem 0.25rem;background:var(--search-bar-bg);border-bottom:1px solid var(--search-bar-border)}.search-bar limel-action-bar{--action-bar-background-color:transparent;min-width:2.5rem;flex-shrink:0}.search-bar limel-input-field{flex-grow:1}.search-bar__count{color:var(--diff-collapsed-text-color);white-space:nowrap;min-width:4rem;text-align:center;font-size:0.75rem}.search-match{background:var(--search-match-bg);color:inherit;border-radius:0.125rem}.search-match--current{background:var(--search-match-current-bg);outline:1px solid rgb(var(--color-amber-dark), 0.5)}.change-group{position:relative}.change-group__copy{--icon-background-color:rgb(var(--contrast-100));scale:0.9;position:absolute;top:0.125rem;right:0.5rem;display:none}.change-group:hover .change-group__copy{display:inline-flex}.diff-body{flex-grow:1;overflow-x:auto;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:var(--code-diff-font-size, 0.75rem)}.diff-body:focus{outline:none}.diff-body:focus-visible{outline:0.125rem solid rgb(var(--color-blue-default));outline-offset:0.125rem;border-radius:0.25rem}.diff-line{display:flex;align-items:stretch;min-height:1.25rem;line-height:1.25rem}.diff-line:hover .line-content{transition-duration:0.2s;background:var(--diff-line-hover-bg)}.diff-line--added .line-content{background:var(--diff-added-bg)}.diff-line--added .line-indicator{color:var(--diff-indicator-added-color)}.diff-line--added:hover .line-content{background:var(--diff-added-bg-hover)}.diff-line--removed .line-content{background:var(--diff-removed-bg)}.diff-line--removed .line-indicator{color:var(--diff-indicator-removed-color)}.diff-line--removed:hover .line-content{background:var(--diff-removed-bg-hover)}.diff-line--context .line-content{background:var(--diff-context-bg)}.diff-line--collapsed{display:flex;justify-content:center;background:var(--diff-collapsed-bg);border-top:1px solid var(--diff-border-color);border-bottom:1px solid var(--diff-border-color)}.diff-line--focused{outline:0.125rem solid rgb(var(--color-blue-default));outline-offset:-0.125rem;z-index:1}.line-number{display:inline-flex;align-items:center;justify-content:flex-end;min-width:calc(1ch + 2 * var(--limel-code-diff-line-number-padding));width:var(--limel-line-number-min-width);padding:0 var(--limel-code-diff-line-number-padding);background:var(--diff-gutter-bg);color:var(--diff-gutter-text-color);user-select:none;text-align:right;flex-shrink:0}.line-number--old{border-right:1px solid var(--diff-border-color)}.line-indicator{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;flex-shrink:0;user-select:none;font-weight:600;background:var(--diff-gutter-bg)}.line-content{flex:1;padding:0 0.75rem;white-space:pre;overflow-x:visible;min-width:0;transition:background-color 0.6s ease}mark{background:transparent;color:inherit;border-radius:0.125rem}mark.segment--added{background:var(--diff-added-highlight-bg)}mark.segment--removed{background:var(--diff-removed-highlight-bg)}.syntax--string{color:var(--syntax-string-color)}.syntax--number{color:var(--syntax-number-color)}.syntax--boolean{color:var(--syntax-boolean-color)}.syntax--null{color:var(--syntax-null-color);font-style:italic}.syntax--key{color:var(--syntax-key-color)}.syntax--punctuation{color:var(--syntax-punctuation-color)}button.expand-button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:transparent}button.expand-button:hover,button.expand-button:focus,button.expand-button:focus-visible{will-change:color, background-color, box-shadow, transform}button.expand-button:hover,button.expand-button:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}button.expand-button:hover{box-shadow:var(--button-shadow-hovered)}button.expand-button:active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}button.expand-button:hover,button.expand-button:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}button.expand-button:focus{outline:none}button.expand-button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.expand-button{padding:0 0.75rem;border-radius:0.25rem;margin:0.125rem;width:calc(100% - 0.25rem);text-align:center}.diff-empty{padding:2rem;text-align:center;color:var(--diff-empty-text-color);font-style:italic}.diff-line--split{display:flex;align-items:stretch;min-height:1.25rem;line-height:1.25rem}.diff-line--split:hover .split-content--removed{background:var(--diff-removed-bg-hover)}.diff-line--split:hover .split-content--added{background:var(--diff-added-bg-hover)}.diff-line--split:hover .split-content--context{background:var(--diff-line-hover-bg)}.split-content{flex:1;padding:0 0.75rem;white-space:pre;overflow-x:visible;min-width:0}.split-content--left{border-right:1px solid var(--diff-split-divider-color)}.split-content--removed{background:var(--diff-removed-bg)}.split-content--added{background:var(--diff-added-bg)}.split-content--context{background:var(--diff-context-bg)}.split-content--empty{background:var(--diff-empty-cell-bg)}.split-content--left{overflow-x:hidden;text-overflow:ellipsis}.change-group:has(.diff-line--split)>.change-group__copy{right:calc(50% - var(--limel-line-number-min-width))}:host(limel-code-diff[line-wrapping]) .diff-body{overflow-x:hidden}:host(limel-code-diff[line-wrapping]) .line-content,:host(limel-code-diff[line-wrapping]) .split-content{white-space:pre-wrap;overflow-wrap:break-word;word-break:break-all}:host(limel-code-diff[line-wrapping]) .diff-line--split .split-content{flex:1 1 0%;max-width:calc(50% - var(--limel-line-number-min-width))}';export{A as limel_code_diff}
|
|
1
|
+
import{r as e,h as t,H as n,a as o}from"./p-BGxJfR2f.js";import{t as r}from"./p-EPnIW0K5.js";class i{diff(e,t,n={}){let o;"function"==typeof n?(o=n,n={}):"callback"in n&&(o=n.callback);const r=this.castInput(e,n),i=this.castInput(t,n),s=this.removeEmpty(this.tokenize(r,n)),l=this.removeEmpty(this.tokenize(i,n));return this.diffWithOptionsObj(s,l,n,o)}diffWithOptionsObj(e,t,n,o){var r;const i=e=>(e=this.postProcess(e,n),o?void setTimeout((function(){o(e)}),0):e),s=t.length,l=e.length;let a=1,d=s+l;null!=n.maxEditLength&&(d=Math.min(d,n.maxEditLength));const c=null!==(r=n.timeout)&&void 0!==r?r:1/0,f=Date.now()+c,u=[{oldPos:-1,lastComponent:void 0}];let h=this.extractCommon(u[0],t,e,0,n);if(u[0].oldPos+1>=l&&h+1>=s)return i(this.buildValues(u[0].lastComponent,t,e));let b=-1/0,v=1/0;const p=()=>{for(let o=Math.max(b,-a);o<=Math.min(v,a);o+=2){let r;const a=u[o-1],d=u[o+1];a&&(u[o-1]=void 0);let c=!1;if(d){const e=d.oldPos-o;c=d&&0<=e&&e<s}const f=a&&a.oldPos+1<l;if(c||f){if(r=!f||c&&a.oldPos<d.oldPos?this.addToPath(d,!0,!1,0,n):this.addToPath(a,!1,!0,1,n),h=this.extractCommon(r,t,e,o,n),r.oldPos+1>=l&&h+1>=s)return i(this.buildValues(r.lastComponent,t,e))||!0;u[o]=r,r.oldPos+1>=l&&(v=Math.min(v,o-1)),h+1>=s&&(b=Math.max(b,o+1))}else u[o]=void 0}a++};if(o)!function e(){setTimeout((function(){if(a>d||Date.now()>f)return o(void 0);p()||e()}),0)}();else for(;a<=d&&Date.now()<=f;){const e=p();if(e)return e}}addToPath(e,t,n,o,r){const i=e.lastComponent;return i&&!r.oneChangePerToken&&i.added===t&&i.removed===n?{oldPos:e.oldPos+o,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}}extractCommon(e,t,n,o,r){const i=t.length,s=n.length;let l=e.oldPos,a=l-o,d=0;for(;a+1<i&&l+1<s&&this.equals(n[l+1],t[a+1],r);)a++,l++,d++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!r.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,a}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const o=[];let r;for(;e;)o.push(e),r=e.previousComponent,delete e.previousComponent,e=r;o.reverse();const i=o.length;let s=0,l=0,a=0;for(;s<i;s++){const e=o[s];if(e.removed)e.value=this.join(n.slice(a,a+e.count)),a+=e.count;else{if(!e.added&&this.useLongestToken){let o=t.slice(l,l+e.count);o=o.map((function(e,t){const o=n[a+t];return o.length>e.length?o:e})),e.value=this.join(o)}else e.value=this.join(t.slice(l,l+e.count));l+=e.count,e.added||(a+=e.count)}}return o}}function s(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function l(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function a(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function d(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function c(e,t){return a(e,t,"")}function f(e,t){return d(e,t,"")}function u(e,t){return t.slice(0,function(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let o=t.length;e.length<t.length&&(o=e.length);const r=Array(o);let i=0;r[0]=0;for(let e=1;e<o;e++){for(r[e]=t[e]==t[i]?r[i]:i;i>0&&t[e]!=t[i];)i=r[i];t[e]==t[i]&&i++}i=0;for(let o=n;o<e.length;o++){for(;i>0&&e[o]!=t[i];)i=r[i];e[o]==t[i]&&i++}return i}(e,t))}function h(e,t){const n=[];for(const o of Array.from(t.segment(e))){const e=o.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function b(e,t){if(t)return p(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function v(e,t){if(t)return p(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function p(e,t){if(!t)return[v(e),b(e)];if("word"!=t.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');const n=h(e,t),o=n[0],r=n[n.length-1];return[/\s/.test(o)?o:"",/\s/.test(r)?r:""]}const m="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",g=new RegExp(`[${m}]+|\\s+|[^${m}]`,"ug"),x=new class extends i{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){const o=t.intlSegmenter;if("word"!=o.resolvedOptions().granularity)throw new Error('The segmenter passed must have a granularity of "word"');n=h(e,o)}else n=e.match(g)||[];const o=[];let r=null;return n.forEach((e=>{/\s/.test(e)?o.push(null==r?e:o.pop()+e):null!=r&&/\s/.test(r)?o.push(o[o.length-1]==r?o.pop()+e:r+e):o.push(e),r=e})),o}join(e){return e.map(((e,t)=>0==t?e:e.replace(/^\s+/,""))).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,o=null,r=null;return e.forEach((e=>{e.added?o=e:e.removed?r=e:((o||r)&&y(n,r,o,e,t.intlSegmenter),n=e,o=null,r=null)})),(o||r)&&y(n,r,o,null,t.intlSegmenter),e}};function y(e,t,n,o,r){if(t&&n){const[i,u]=p(t.value,r),[h,b]=p(n.value,r);if(e){const o=s(i,h);e.value=d(e.value,h,o),t.value=c(t.value,o),n.value=c(n.value,o)}if(o){const e=l(u,b);o.value=a(o.value,b,e),t.value=f(t.value,e),n.value=f(n.value,e)}}else if(n){if(e){const e=v(n.value,r);n.value=n.value.substring(e.length)}if(o){const e=v(o.value,r);o.value=o.value.substring(e.length)}}else if(e&&o){const n=v(o.value,r),[i,u]=p(t.value,r),h=s(n,i);t.value=c(t.value,h);const b=l(c(n,h),u);t.value=f(t.value,b),o.value=a(o.value,n,b),e.value=d(e.value,n,n.slice(0,n.length-b.length))}else if(o){const e=v(o.value,r),n=u(b(t.value,r),e);t.value=f(t.value,n)}else if(e){const n=u(b(e.value,r),v(t.value,r));t.value=c(t.value,n)}}const w=new class extends i{constructor(){super(...arguments),this.tokenize=k}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function k(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));const n=[],o=e.split(/(\n|\r\n)/);o[o.length-1]||o.pop();for(let e=0;e<o.length;e++){const r=o[e];e%2&&!t.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}function _(e,t,n){const o=[];for(;t<e.length&&"removed"===e[t].type;)o.push(e[t]),t++;const r=[];for(;t<e.length&&"added"===e[t].type;)r.push(e[t]),t++;const i=Math.max(o.length,r.length);for(let e=0;e<i;e++)n.push({left:e<o.length?o[e]:void 0,right:e<r.length?r[e]:void 0});return t}function C(e,t=!1){if("object"==typeof e&&null!==e)return JSON.stringify(S(e),null,4);if("string"==typeof e&&t)try{const t=JSON.parse(e);return JSON.stringify(S(t),null,4)}catch(t){return e}return String(null!=e?e:"")}function S(e){if(Array.isArray(e))return e.map(S);if(null!==e&&"object"==typeof e){const t={},n=Object.keys(e).sort(((e,t)=>e.localeCompare(t)));for(const o of n)t[o]=S(e[o]);return t}return e}function j(e){if(!e)return[];const t=e.split("\n");return t.length>0&&""===t.at(-1)&&t.pop(),t}function D(e,t){const n=x.diff(e,t,undefined);const o=[],r=[];for(const e of n)e.added?r.push({value:e.value,type:"added"}):e.removed?o.push({value:e.value,type:"removed"}):(o.push({value:e.value,type:"equal"}),r.push({value:e.value,type:"equal"}));return[o,r]}const O=[[/"(?:[^"\\]|\\.)*"/,"string"],[/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/,"number"],[/\b(?:true|false)\b/,"boolean"],[/\bnull\b/,"null"],[/[{}[\]:,]/,"punctuation"]],M=new RegExp(O.map((([e])=>`(${e.source})`)).join("|"),"g");function $(e){for(const[t,[,n]]of O.entries())if(void 0!==e[t+1])return n;return"plain"}const A=class{constructor(t){e(this,t),this.oldValue="",this.newValue="",this.layout="unified",this.contextLines=3,this.lineWrapping=!0,this.reformatJson=!1,this.translationLanguage="en",this.diffResult={hunks:[],additions:0,deletions:0,allLines:[]},this.liveAnnouncement="",this.copyState="idle",this.searchVisible=!1,this.searchTerm="",this.currentMatchIndex=0,this.focusedRowIndex=-1,this.normalizedOldText="",this.searchMatchCounter=0,this.totalSearchMatches=0,this.isRenderingRemovedLine=!1,this.activeSearchRegex=null,this.prevSearchVisible=!1}componentWillLoad(){this.recomputeDiff()}componentDidRender(){var e,t;if(this.searchVisible&&!this.prevSearchVisible&&(null===(e=this.searchInputEl)||void 0===e||e.focus()),this.prevSearchVisible=this.searchVisible,this.searchTerm&&this.totalSearchMatches>0){const e=null===(t=this.host.shadowRoot)||void 0===t?void 0:t.querySelector(".search-match--current");null==e||e.scrollIntoView({block:"center",behavior:"smooth"})}}render(){var e;this.searchMatchCounter=0,this.activeSearchRegex=(e=this.searchTerm)?new RegExp(`(${function(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(e)})`,"gi"):null;const o=this.renderDiff();this.totalSearchMatches=this.searchMatchCounter;const r=this.computeLineNumberWidth();return t(n,{key:"b96c5b9625e734cd951697360efd2ca9637d4c3c",style:{"--limel-line-number-min-width":r}},this.renderHeader(),this.renderScreenReaderSummary(),this.searchVisible&&this.renderSearchBar(),t("div",{key:"6a53529bee76c32d996b766118df5ebdb767bb7e",class:"diff-body",role:"table","aria-label":this.getTranslation("code-diff.table-label"),tabindex:"0",onKeyDown:e=>this.handleKeyDown(e)},o),t("div",{key:"f1c882328e8b6144c004150f0237010744e46b94",class:"screen-reader-only",role:"status","aria-live":"polite","aria-atomic":"true"},this.liveAnnouncement))}watchInputs(){this.recomputeDiff()}recomputeDiff(){const e=C(this.oldValue,this.reformatJson),t=C(this.newValue,this.reformatJson);this.normalizedOldText=e,this.diffResult=function(e,t,n=3){const o=function(e,t){const n=w.diff(e,t,void 0),o=[];let r=1,i=1;for(const e of n){const t=j(e.value);for(const n of t)o.push(e.added?{type:"added",content:n,newLineNumber:i++}:e.removed?{type:"removed",content:n,oldLineNumber:r++}:{type:"context",content:n,oldLineNumber:r++,newLineNumber:i++})}return function(e){let t=0;for(;t<e.length;){const n=t;for(;t<e.length&&"removed"===e[t].type;)t++;const o=t,r=t;for(;t<e.length&&"added"===e[t].type;)t++;const i=o-n,s=t-r;if(i>0&&s>0){const t=Math.min(i,s);for(let o=0;o<t;o++){const t=e[n+o],i=e[r+o],[s,l]=D(t.content,i.content);t.segments=s,i.segments=l}}t===n&&t++}}(o),o}(e,t);return function(e,t){if(0===e.length)return{hunks:[],additions:0,deletions:0,allLines:e};let n=0,o=0;for(const t of e)"added"===t.type?n++:"removed"===t.type&&o++;if(0===n&&0===o)return{hunks:[],additions:0,deletions:0,allLines:e};const r=[];for(const[t,n]of e.entries())"context"!==n.type&&r.push(t);const i=function(e,t,n){if(0===e.length)return[];const o=[];let r=Math.max(0,e[0]-n),i=Math.min(t,e[0]+n+1);for(let s=1;s<e.length;s++){const l=Math.max(0,e[s]-n),a=Math.min(t,e[s]+n+1);l<=i?i=Math.max(i,a):(o.push({start:r,end:i}),r=l,i=a)}return o.push({start:r,end:i}),o}(r,e.length,t),s=[];let l=0;for(const t of i){const n=e.slice(t.start,t.end),o=t.start-l;s.push({lines:n,collapsedBefore:o>0?o:void 0,startIndex:t.start}),l=t.end}const a=i.at(-1);return{hunks:s,additions:n,deletions:o,collapsedAfter:a.end<e.length?e.length-a.end:void 0,allLines:e}}(o,n)}(e,t,this.contextLines),this.focusedRowIndex=-1}formatSrSummary(){const{additions:e,deletions:t}=this.diffResult;if(0===e&&0===t)return null;const n=[];return e>0&&n.push(this.getTranslation(1===e?"code-diff.diff-addition":"code-diff.diff-additions",{count:e})),t>0&&n.push(this.getTranslation(1===t?"code-diff.diff-deletion":"code-diff.diff-deletions",{count:t})),this.getTranslation("code-diff.diff-summary",{parts:n.join(", ")})}renderScreenReaderSummary(){const e=this.formatSrSummary();return t("div",{class:"screen-reader-only",role:"status","aria-live":"polite"},null!=e?e:this.getTranslation("code-diff.no-differences-found"))}handleKeyDown(e){if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t=this.getDiffRows();0!==t.length&&(this.focusedRowIndex="ArrowDown"===e.key?Math.min(this.focusedRowIndex+1,t.length-1):Math.max(this.focusedRowIndex-1,0),this.updateRowFocus(t))}getDiffRows(){var e;const t=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector(".diff-body");return t?[...t.querySelectorAll(".diff-line:not(.diff-line--collapsed)")]:[]}updateRowFocus(e){for(const t of e)t.removeAttribute("tabindex"),t.classList.remove("diff-line--focused");const t=e[this.focusedRowIndex];t&&(t.setAttribute("tabindex","-1"),t.classList.add("diff-line--focused"),t.focus(),this.announceLine(t))}announceLine(e){var t,n;let o=this.getTranslation("code-diff.line-context");e.classList.contains("diff-line--added")?o=this.getTranslation("code-diff.line-added"):e.classList.contains("diff-line--removed")&&(o=this.getTranslation("code-diff.line-removed"));const r=null!==(n=null===(t=e.querySelector(".line-content, .split-content"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:"",i=r.length>80?r.slice(0,80)+"…":r;this.liveAnnouncement=`${o}: ${i}`}renderHeader(){var e,n;const o=null!==(e=this.oldHeading)&&void 0!==e?e:this.getTranslation("code-diff.old-heading"),r=null!==(n=this.newHeading)&&void 0!==n?n:this.getTranslation("code-diff.new-heading"),{additions:i,deletions:s}=this.diffResult,l=i>0||s>0;return t("div",{class:"diff-header"},t("div",{class:"diff-header__labels"},t("span",{class:"diff-header__old"},o),t("span",{class:"diff-header__new"},r)),t("div",{class:"diff-header__actions"},t("div",{class:"diff-header__stats"},i>0&&t("span",{class:"stat stat--added"},"+",i),s>0&&t("span",{class:"stat stat--removed"},"-",s)),l&&this.renderCopyButton(),s>0&&this.renderSearchToggle()))}renderCopyButton(){const e=this.getTranslation("copied"===this.copyState?"code-diff.copied":"code-diff.copy-old-version");return t("limel-icon-button",{label:e,icon:"copied"===this.copyState?"checkmark":"copy",onClick:()=>this.copyToClipboard(this.normalizedOldText)})}async copyToClipboard(e){try{await navigator.clipboard.writeText(e),this.copyState="copied",this.liveAnnouncement=this.getTranslation("code-diff.copied-to-clipboard"),setTimeout((()=>{this.copyState="idle"}),2e3)}catch(e){}}renderSearchToggle(){return t("limel-icon-button",{class:{"search-toggle--active":this.searchVisible},label:this.getTranslation("code-diff.search"),icon:"search",onClick:()=>this.toggleSearch()})}renderSearchBar(){const e=0===this.totalSearchMatches?this.getTranslation("code-diff.no-matches"):this.getTranslation("code-diff.match-count",{current:this.currentMatchIndex+1,total:this.totalSearchMatches});return t("div",{class:"search-bar"},t("limel-input-field",{class:"search-bar__input",type:"search",placeholder:this.getTranslation("code-diff.search")+"…",value:this.searchTerm,onChange:e=>this.onSearchInput(e),onKeyDown:e=>this.onSearchKeyDown(e),ref:e=>this.searchInputEl=e}),t("span",{class:"search-bar__count"},e),t("limel-action-bar",{actions:this.getSearchActions(),onItemSelected:e=>this.onSearchAction(e)}))}toggleSearch(){this.searchVisible=!this.searchVisible,this.searchVisible||(this.searchTerm="",this.currentMatchIndex=0)}onSearchInput(e){this.searchTerm=e.detail,this.currentMatchIndex=0}onSearchKeyDown(e){"Enter"===e.key?(e.preventDefault(),this.navigateSearch(e.shiftKey?-1:1)):"Escape"===e.key&&this.toggleSearch()}computeLineNumberWidth(){return`calc(${String(this.diffResult.allLines.length).length}ch + 2 * var(--limel-code-diff-line-number-padding))`}getSearchActions(){const e=0===this.totalSearchMatches;return[{text:this.getTranslation("code-diff.previous-match"),icon:"-lime-caret-top",iconOnly:!0,disabled:e,value:"prev"},{text:this.getTranslation("code-diff.next-match"),icon:"-lime-caret-bottom",iconOnly:!0,disabled:e,value:"next"},{text:this.getTranslation("code-diff.close-search"),icon:"cancel",iconOnly:!0,value:"close"}]}onSearchAction(e){const{value:t}=e.detail;"prev"===t?this.navigateSearch(-1):"next"===t?this.navigateSearch(1):"close"===t&&this.toggleSearch()}navigateSearch(e){this.currentMatchIndex=function(e,t,n){return 0===n?0:(e+t+n)%n}(this.currentMatchIndex,e,this.totalSearchMatches)}renderDiff(){const{hunks:e,collapsedAfter:n}=this.diffResult;return 0===e.length?t("div",{class:"diff-empty"},this.getTranslation("code-diff.no-differences")):this.renderHunks(e,n,"split"===this.layout?e=>this.renderSplitHunkRows(e):e=>this.renderHunkLines(e))}renderHunks(e,t,n){const o=[];for(const[t,r]of e.entries())r.collapsedBefore&&o.push(this.renderCollapsedRow(r.collapsedBefore,t)),o.push(...n(r));return t&&o.push(this.renderCollapsedAfterRow(t)),o}renderHunkLines(e){const t=[];let n=0;for(;n<e.lines.length;){const o=e.lines[n];if("context"===o.type){t.push(this.renderLine(o)),n++;continue}const r=[];for(;n<e.lines.length&&"context"!==e.lines[n].type;)r.push(e.lines[n]),n++;t.push(this.renderChangeBlock(r))}return t}renderChangeBlock(e){const n=function(e){return e.filter((e=>"removed"===e.type)).map((e=>e.content)).join("\n")}(e);return t("div",{class:"change-group"},e.map((e=>this.renderLine(e))),n&&this.renderBlockCopyButton(n))}renderLine(e){var n,o;const r={added:"+",removed:"-",context:" "}[e.type];return t("div",{class:{"diff-line":!0,[`diff-line--${e.type}`]:!0},role:"row"},t("span",{class:"line-number line-number--old",role:"cell","aria-label":e.oldLineNumber?this.getTranslation("code-diff.old-line",{number:e.oldLineNumber}):void 0},null!==(n=e.oldLineNumber)&&void 0!==n?n:""),t("span",{class:"line-number line-number--new",role:"cell","aria-label":e.newLineNumber?this.getTranslation("code-diff.new-line",{number:e.newLineNumber}):void 0},null!==(o=e.newLineNumber)&&void 0!==o?o:""),t("span",{class:"line-indicator",role:"cell"},r),t("span",{class:"line-content",role:"cell"},this.renderContent(e)))}renderSplitHunkRows(e){var t,n,o,r;const i=function(e){const t=[];let n=0;for(;n<e.length;){const o=e[n];"context"!==o.type?n=_(e,n,t):(t.push({left:o,right:o}),n++)}return t}(e.lines),s=[];let l=0;for(;l<i.length;){const e=i[l];if("context"===(null===(t=e.left)||void 0===t?void 0:t.type)&&"context"===(null===(n=e.right)||void 0===n?void 0:n.type)){s.push(this.renderSplitRow(e)),l++;continue}const a=[];for(;l<i.length;){const e=i[l];if("context"===(null===(o=e.left)||void 0===o?void 0:o.type)&&"context"===(null===(r=e.right)||void 0===r?void 0:r.type))break;a.push(e),l++}s.push(this.renderSplitChangeBlock(a))}return s}renderSplitChangeBlock(e){const n=function(e){return e.filter((e=>{var t;return"removed"===(null===(t=e.left)||void 0===t?void 0:t.type)})).map((e=>e.left.content)).join("\n")}(e);return t("div",{class:"change-group"},e.map((e=>this.renderSplitRow(e))),n&&this.renderBlockCopyButton(n))}renderSplitRow(e){var n,o,r,i,s,l,a,d,c,f;const u=null!==(o=null===(n=e.left)||void 0===n?void 0:n.type)&&void 0!==o?o:"empty",h=null!==(i=null===(r=e.right)||void 0===r?void 0:r.type)&&void 0!==i?i:"empty",b=(null===(s=e.left)||void 0===s?void 0:s.oldLineNumber)?this.getTranslation("code-diff.old-line",{number:e.left.oldLineNumber}):void 0,v=(null===(l=e.right)||void 0===l?void 0:l.newLineNumber)?this.getTranslation("code-diff.new-line",{number:e.right.newLineNumber}):void 0;return t("div",{class:"diff-line diff-line--split",role:"row"},t("span",{class:"line-number line-number--old",role:"cell","aria-label":b},null!==(d=null===(a=e.left)||void 0===a?void 0:a.oldLineNumber)&&void 0!==d?d:""),t("span",{class:`split-content split-content--left split-content--${u}`,role:"cell"},e.left?this.renderContent(e.left):""),t("span",{class:"line-number line-number--new",role:"cell","aria-label":v},null!==(f=null===(c=e.right)||void 0===c?void 0:c.newLineNumber)&&void 0!==f?f:""),t("span",{class:`split-content split-content--right split-content--${h}`,role:"cell"},e.right?this.renderContent(e.right):""))}renderBlockCopyButton(e){return t("limel-icon-button",{class:"change-group__copy",elevated:!0,label:this.getTranslation("code-diff.copy-change"),icon:"copy",onClick:()=>this.copyToClipboard(e)})}renderContent(e){return this.isRenderingRemovedLine="removed"===e.type&&this.searchTerm.length>0,e.segments&&0!==e.segments.length?e.segments.map((t=>this.renderSegment(t,e.type))):this.renderSyntaxTokens(e.content)}renderSegment(e,n){const o=this.renderSyntaxTokens(e.value);return"equal"===e.type?o:t("mark",{class:"removed"===n?"segment--removed":"segment--added"},o)}renderSyntaxTokens(e){const t=function(e,t){return t&&0!==e.length&&"json"===t?function(e){const t=[];let n=0;M.lastIndex=0;let o=M.exec(e);for(;null!==o;){o.index>n&&t.push({value:e.slice(n,o.index),type:"plain"});const r=$(o),i=o[0];if("string"===r){const n=e.slice(o.index+i.length);/^\s*:/.test(n)?t.push({value:i,type:"key"}):t.push({value:i,type:"string"})}else t.push({value:i,type:r});n=o.index+i.length,o=M.exec(e)}return n<e.length&&t.push({value:e.slice(n),type:"plain"}),t}(e):[{value:e,type:"plain"}]}(e,this.language);return 1===t.length&&"plain"===t[0].type?this.renderSearchableText(e):t.map((e=>this.renderSyntaxToken(e)))}renderSyntaxToken(e){const n=this.renderSearchableText(e.value);return"plain"===e.type?n:t("span",{class:`syntax--${e.type}`},n)}renderSearchableText(e){if(!this.isRenderingRemovedLine||!this.activeSearchRegex)return e;const n=e.split(this.activeSearchRegex);return 1===n.length?e:n.map(((e,n)=>{if(n%2==0)return e;const o=this.searchMatchCounter++;return t("mark",{key:`match-${o}`,class:{"search-match":!0,"search-match--current":o===this.currentMatchIndex}},e)}))}renderCollapsedRow(e,n){return t("div",{class:"diff-line diff-line--collapsed",role:"row"},t("button",{class:"expand-button",type:"button",onClick:()=>this.expandHunk(n),"aria-label":this.getTranslation("code-diff.show-hidden-lines",{count:e})},this.getTranslation("code-diff.hidden-lines",{count:e})))}renderCollapsedAfterRow(e){return t("div",{class:"diff-line diff-line--collapsed",role:"row"},t("button",{class:"expand-button",type:"button",onClick:()=>this.expandAfter(),"aria-label":this.getTranslation("code-diff.show-hidden-lines",{count:e})},this.getTranslation("code-diff.hidden-lines",{count:e})))}expandHunk(e){const t=[...this.diffResult.hunks],n=t[e],o=e>0?t[e-1].startIndex+t[e-1].lines.length:0,r=this.diffResult.allLines.slice(o,n.startIndex);t[e]=Object.assign(Object.assign({},n),{lines:[...r,...n.lines],collapsedBefore:void 0,startIndex:o}),this.diffResult=Object.assign(Object.assign({},this.diffResult),{hunks:t}),this.liveAnnouncement=this.getTranslation("code-diff.expanded-lines")}expandAfter(){const e=[...this.diffResult.hunks],t=e.length-1,n=e[t],o=this.diffResult.allLines.slice(n.startIndex+n.lines.length);e[t]=Object.assign(Object.assign({},n),{lines:[...n.lines,...o]}),this.diffResult=Object.assign(Object.assign({},this.diffResult),{hunks:e,collapsedAfter:void 0}),this.liveAnnouncement=this.getTranslation("code-diff.expanded-lines-end")}getTranslation(e,t){return r.get(e,this.translationLanguage,t)}get host(){return o(this)}static get watchers(){return{oldValue:[{watchInputs:0}],newValue:[{watchInputs:0}],contextLines:[{watchInputs:0}],reformatJson:[{watchInputs:0}],layout:[{watchInputs:0}]}}};A.style='@charset "UTF-8";*,*::before,*::after{box-sizing:border-box;min-width:0;min-height:0}:host(limel-code-diff){--diff-added-bg:rgb(var(--color-green-default), 0.1);--diff-added-bg-hover:rgb(var(--color-green-default), 0.3);--diff-added-highlight-bg:rgb(var(--color-green-default), 0.3);--diff-removed-bg:rgb(var(--color-red-default), 0.1);--diff-removed-bg-hover:rgb(var(--color-red-default), 0.3);--diff-removed-highlight-bg:rgb(var(--color-red-default), 0.3);--diff-context-bg:transparent;--diff-indicator-added-color:rgb(var(--color-green-default));--diff-indicator-removed-color:rgb(var(--color-red-default));--diff-stat-added-color:rgb(var(--color-green-default));--diff-stat-removed-color:rgb(var(--color-red-default));--search-match-bg:rgb(var(--color-amber-default), 0.3);--search-match-current-bg:rgb(var(--color-amber-default), 0.6);--diff-line-hover-bg:rgb(var(--contrast-800), 0.08);--diff-gutter-bg:rgb(var(--contrast-200));--diff-gutter-text-color:rgb(var(--contrast-700));--diff-text-color:rgb(var(--contrast-1100));--diff-border-color:rgb(var(--contrast-400));--diff-collapsed-bg:rgb(var(--contrast-200));--diff-collapsed-text-color:rgb(var(--contrast-800));--diff-header-bg:rgb(var(--contrast-200));--diff-empty-text-color:rgb(var(--contrast-700));--diff-split-divider-color:rgb(var(--contrast-400));--diff-empty-cell-bg:rgb(var(--contrast-100));--syntax-string-color:rgb(var(--color-green-dark));--syntax-number-color:rgb(var(--color-blue-default));--syntax-boolean-color:rgb(var(--color-amber-darker));--syntax-key-color:rgb(var(--color-sky-dark));--syntax-null-color:rgb(var(--contrast-700));--syntax-punctuation-color:rgb(var(--contrast-700));--search-bar-bg:rgb(var(--contrast-100));--search-bar-border:rgb(var(--contrast-400));--limel-code-diff-line-number-padding:0.25rem;font-family:ui-sans-serif, system-ui, sans-serif;display:flex;flex-direction:column;width:100%;height:100%;color:var(--diff-text-color);border:1px solid var(--diff-border-color);border-radius:0.5rem;max-height:var(--code-diff-max-height, none)}.screen-reader-only{position:absolute;width:0;height:0;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0, 0, 0, 0);clip-path:inset(50%);white-space:nowrap}.diff-header{flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0.125rem 0.125rem 0.125rem 0.5rem;background:var(--diff-header-bg);border-bottom:1px solid var(--diff-border-color);font-family:ui-sans-serif, system-ui, sans-serif;font-size:0.75rem;border-radius:0.5rem 0.5rem 0 0}.diff-header__labels{display:flex;gap:0.75rem;font-weight:500}.diff-header__old,.diff-header__new{padding:0.125rem 0.25rem;border-radius:0.25rem;box-shadow:var(--shadow-brighten-edges-outside)}.diff-header__old{background-color:var(--diff-removed-bg)}.diff-header__new{background-color:var(--diff-added-bg)}.diff-header__actions{display:flex;align-items:center;gap:0.25rem}.search-toggle--active{--limel-theme-on-surface-color:var(--mdc-theme-primary)}.diff-header__stats{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;display:flex;gap:0.5rem;margin-right:0.5rem}.stat{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.8125rem;font-weight:600}.stat--added{color:var(--diff-stat-added-color)}.stat--removed{color:var(--diff-stat-removed-color)}.search-bar{flex-shrink:0;display:flex;align-items:center;gap:0.25rem;padding:0.25rem 0 0.25rem 0.25rem;background:var(--search-bar-bg);border-bottom:1px solid var(--search-bar-border)}.search-bar limel-action-bar{--action-bar-background-color:transparent;min-width:2.5rem;flex-shrink:0}.search-bar limel-input-field{flex-grow:1}.search-bar__count{color:var(--diff-collapsed-text-color);white-space:nowrap;min-width:4rem;text-align:center;font-size:0.75rem}.search-match{background:var(--search-match-bg);color:inherit;border-radius:0.125rem}.search-match--current{background:var(--search-match-current-bg);outline:1px solid rgb(var(--color-amber-dark), 0.5)}.change-group{position:relative}.change-group__copy{--icon-background-color:rgb(var(--contrast-100));scale:0.9;position:absolute;top:0.125rem;right:0.5rem;display:none}.change-group:hover .change-group__copy{display:inline-flex}.diff-body{flex-grow:1;overflow-x:auto;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:var(--code-diff-font-size, 0.75rem)}.diff-body:focus{outline:none}.diff-body:focus-visible{outline:0.125rem solid rgb(var(--color-blue-default));outline-offset:0.125rem;border-radius:0.25rem}.diff-line{display:flex;align-items:stretch;min-height:1.25rem;line-height:1.25rem}.diff-line:hover .line-content{transition-duration:0.2s;background:var(--diff-line-hover-bg)}.diff-line--added .line-content{background:var(--diff-added-bg)}.diff-line--added .line-indicator{color:var(--diff-indicator-added-color)}.diff-line--added:hover .line-content{background:var(--diff-added-bg-hover)}.diff-line--removed .line-content{background:var(--diff-removed-bg)}.diff-line--removed .line-indicator{color:var(--diff-indicator-removed-color)}.diff-line--removed:hover .line-content{background:var(--diff-removed-bg-hover)}.diff-line--context .line-content{background:var(--diff-context-bg)}.diff-line--collapsed{display:flex;justify-content:center;background:var(--diff-collapsed-bg);border-top:1px solid var(--diff-border-color);border-bottom:1px solid var(--diff-border-color)}.diff-line--focused{outline:0.125rem solid rgb(var(--color-blue-default));outline-offset:-0.125rem;z-index:1}.line-number{display:inline-flex;align-items:center;justify-content:flex-end;min-width:calc(1ch + 2 * var(--limel-code-diff-line-number-padding));width:var(--limel-line-number-min-width);padding:0 var(--limel-code-diff-line-number-padding);background:var(--diff-gutter-bg);color:var(--diff-gutter-text-color);user-select:none;text-align:right;flex-shrink:0}.line-number--old{border-right:1px solid var(--diff-border-color)}.line-indicator{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;flex-shrink:0;user-select:none;font-weight:600;background:var(--diff-gutter-bg)}.line-content{flex:1;padding:0 0.75rem;white-space:pre;overflow-x:visible;min-width:0;transition:background-color 0.6s ease}mark{background:transparent;color:inherit;border-radius:0.125rem}mark.segment--added{background:var(--diff-added-highlight-bg)}mark.segment--removed{background:var(--diff-removed-highlight-bg)}.syntax--string{color:var(--syntax-string-color)}.syntax--number{color:var(--syntax-number-color)}.syntax--boolean{color:var(--syntax-boolean-color)}.syntax--null{color:var(--syntax-null-color);font-style:italic}.syntax--key{color:var(--syntax-key-color)}.syntax--punctuation{color:var(--syntax-punctuation-color)}button.expand-button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:transparent}button.expand-button:hover,button.expand-button:focus,button.expand-button:focus-visible{will-change:color, background-color, box-shadow, transform}button.expand-button:hover,button.expand-button:focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}button.expand-button:hover{box-shadow:var(--button-shadow-hovered)}button.expand-button:active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}button.expand-button:hover,button.expand-button:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}button.expand-button:focus{outline:none}button.expand-button:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button.expand-button{padding:0 0.75rem;border-radius:0.25rem;margin:0.125rem;width:calc(100% - 0.25rem);text-align:center}.diff-empty{padding:2rem;text-align:center;color:var(--diff-empty-text-color);font-style:italic}.diff-line--split{display:flex;align-items:stretch;min-height:1.25rem;line-height:1.25rem}.diff-line--split:hover .split-content--removed{background:var(--diff-removed-bg-hover)}.diff-line--split:hover .split-content--added{background:var(--diff-added-bg-hover)}.diff-line--split:hover .split-content--context{background:var(--diff-line-hover-bg)}.split-content{flex:1;padding:0 0.75rem;white-space:pre;overflow-x:visible;min-width:0}.split-content--left{border-right:1px solid var(--diff-split-divider-color)}.split-content--removed{background:var(--diff-removed-bg)}.split-content--added{background:var(--diff-added-bg)}.split-content--context{background:var(--diff-context-bg)}.split-content--empty{background:var(--diff-empty-cell-bg)}.split-content--left{overflow-x:hidden;text-overflow:ellipsis}.change-group:has(.diff-line--split)>.change-group__copy{right:calc(50% - var(--limel-line-number-min-width))}:host(limel-code-diff[line-wrapping]) .diff-body{overflow-x:hidden}:host(limel-code-diff[line-wrapping]) .line-content,:host(limel-code-diff[line-wrapping]) .split-content{white-space:pre-wrap;overflow-wrap:break-word;word-break:break-all}:host(limel-code-diff[line-wrapping]) .diff-line--split .split-content{flex:1 1 0%;max-width:calc(50% - var(--limel-line-number-min-width))}';export{A as limel_code_diff}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Languages } from '../date-picker/date.types';
|
|
2
|
+
import { CodeDiffLayout } from './code-diff.types';
|
|
2
3
|
/**
|
|
3
4
|
* Displays a visual diff between two text values, modeled on
|
|
4
5
|
* GitHub's code difference view.
|
|
@@ -14,6 +15,7 @@ import { Languages } from '../date-picker/date.types';
|
|
|
14
15
|
* @exampleComponent limel-example-code-diff-split
|
|
15
16
|
* @exampleComponent limel-example-code-diff-line-wrap
|
|
16
17
|
* @exampleComponent limel-example-code-diff-expand
|
|
18
|
+
* @exampleComponent limel-example-code-diff-interactive
|
|
17
19
|
*/
|
|
18
20
|
export declare class CodeDiff {
|
|
19
21
|
/**
|
|
@@ -41,7 +43,7 @@ export declare class CodeDiff {
|
|
|
41
43
|
* - `unified` — single column with interleaved additions and removals
|
|
42
44
|
* - `split` — side-by-side comparison with old on left, new on right
|
|
43
45
|
*/
|
|
44
|
-
layout:
|
|
46
|
+
layout: CodeDiffLayout;
|
|
45
47
|
/**
|
|
46
48
|
* Number of unchanged context lines to display around each change.
|
|
47
49
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout of the code diff view.
|
|
3
|
+
* - `unified` — single column with interleaved additions and removals
|
|
4
|
+
* - `split` — side-by-side comparison with old on left, new on right
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type CodeDiffLayout = 'unified' | 'split';
|
|
9
|
+
//# sourceMappingURL=code-diff.types.d.ts.map
|
|
@@ -113,6 +113,22 @@ export declare class ProsemirrorAdapter {
|
|
|
113
113
|
* Does nothing if no change is pending.
|
|
114
114
|
*/
|
|
115
115
|
flushPendingChanges(): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Clear the editor's content imperatively.
|
|
118
|
+
*
|
|
119
|
+
* Assigning an empty `value` prop only clears the editor when the value
|
|
120
|
+
* changes. The editor debounces its `change` event, so a consumer's
|
|
121
|
+
* bound value can lag the live document; assigning `''` when the prop was
|
|
122
|
+
* already `''` is skipped by change detection and would leave the typed
|
|
123
|
+
* content untouched — for example, clearing the editor right after a
|
|
124
|
+
* send. Use this to empty the editor regardless of the prop's change
|
|
125
|
+
* detection.
|
|
126
|
+
*
|
|
127
|
+
* Does not emit a `change` event. Consumers that mirror the editor
|
|
128
|
+
* content on `change` (drafts, validation, dirty state) should reset
|
|
129
|
+
* their own copy when calling this.
|
|
130
|
+
*/
|
|
131
|
+
clear(): Promise<void>;
|
|
116
132
|
protected watchValue(newValue: string): void;
|
|
117
133
|
componentWillLoad(): void;
|
|
118
134
|
componentDidLoad(): void;
|
|
@@ -191,6 +191,23 @@ export declare class TextEditor implements FormComponent<string> {
|
|
|
191
191
|
* typing.
|
|
192
192
|
*/
|
|
193
193
|
flushPendingChanges(): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Clear the editor's content imperatively, bypassing the `value` prop's
|
|
196
|
+
* change detection.
|
|
197
|
+
*
|
|
198
|
+
* Assigning an empty `value` prop only clears the editor when the value
|
|
199
|
+
* changes. Because the editor debounces its `change` event, a consumer's
|
|
200
|
+
* bound value can lag the live content, so assigning `''` when the prop
|
|
201
|
+
* was already `''` is skipped and the content is left untouched — for
|
|
202
|
+
* example, clearing the editor immediately after a send. Use this to
|
|
203
|
+
* empty the editor regardless of the prop's change detection.
|
|
204
|
+
*
|
|
205
|
+
* Does not emit a `change` event. If you mirror the editor content on
|
|
206
|
+
* `change` (drafts, validation, dirty state), reset your own copy when
|
|
207
|
+
* calling this. In readonly mode no editor is rendered, so this is a
|
|
208
|
+
* silent no-op.
|
|
209
|
+
*/
|
|
210
|
+
clear(): Promise<void>;
|
|
194
211
|
render(): any;
|
|
195
212
|
private renderEditor;
|
|
196
213
|
private renderPlaceholder;
|
|
@@ -22,6 +22,7 @@ import { Link } from "./global/shared-types/link.types";
|
|
|
22
22
|
import { Chip, ChipType } from "./components/chip-set/chip.types";
|
|
23
23
|
import { MenuItem as MenuItem1 } from "./components";
|
|
24
24
|
import { CircularProgressSize } from "./components/circular-progress/circular-progress.types";
|
|
25
|
+
import { CodeDiffLayout } from "./components/code-diff/code-diff.types";
|
|
25
26
|
import { ColorScheme, Language } from "./components/code-editor/code-editor.types";
|
|
26
27
|
import { Action } from "./components/collapsible-section/action";
|
|
27
28
|
import { CustomColorSwatch, CustomPalette } from "./components/color-picker/color-picker.types";
|
|
@@ -68,6 +69,7 @@ export { Link } from "./global/shared-types/link.types";
|
|
|
68
69
|
export { Chip, ChipType } from "./components/chip-set/chip.types";
|
|
69
70
|
export { MenuItem as MenuItem1 } from "./components";
|
|
70
71
|
export { CircularProgressSize } from "./components/circular-progress/circular-progress.types";
|
|
72
|
+
export { CodeDiffLayout } from "./components/code-diff/code-diff.types";
|
|
71
73
|
export { ColorScheme, Language } from "./components/code-editor/code-editor.types";
|
|
72
74
|
export { Action } from "./components/collapsible-section/action";
|
|
73
75
|
export { CustomColorSwatch, CustomPalette } from "./components/color-picker/color-picker.types";
|
|
@@ -996,6 +998,7 @@ export namespace Components {
|
|
|
996
998
|
* @exampleComponent limel-example-code-diff-split
|
|
997
999
|
* @exampleComponent limel-example-code-diff-line-wrap
|
|
998
1000
|
* @exampleComponent limel-example-code-diff-expand
|
|
1001
|
+
* @exampleComponent limel-example-code-diff-interactive
|
|
999
1002
|
*/
|
|
1000
1003
|
interface LimelCodeDiff {
|
|
1001
1004
|
/**
|
|
@@ -1011,7 +1014,7 @@ export namespace Components {
|
|
|
1011
1014
|
* The layout of the diff view. - `unified` — single column with interleaved additions and removals - `split` — side-by-side comparison with old on left, new on right
|
|
1012
1015
|
* @default 'unified'
|
|
1013
1016
|
*/
|
|
1014
|
-
"layout":
|
|
1017
|
+
"layout": CodeDiffLayout;
|
|
1015
1018
|
/**
|
|
1016
1019
|
* When `true`, long lines are wrapped instead of causing horizontal scrolling. Useful when comparing prose or config files with long values.
|
|
1017
1020
|
* @default true
|
|
@@ -3155,6 +3158,10 @@ export namespace Components {
|
|
|
3155
3158
|
* @private
|
|
3156
3159
|
*/
|
|
3157
3160
|
interface LimelProsemirrorAdapter {
|
|
3161
|
+
/**
|
|
3162
|
+
* Clear the editor's content imperatively. Assigning an empty `value` prop only clears the editor when the value changes. The editor debounces its `change` event, so a consumer's bound value can lag the live document; assigning `''` when the prop was already `''` is skipped by change detection and would leave the typed content untouched — for example, clearing the editor right after a send. Use this to empty the editor regardless of the prop's change detection. Does not emit a `change` event. Consumers that mirror the editor content on `change` (drafts, validation, dirty state) should reset their own copy when calling this.
|
|
3163
|
+
*/
|
|
3164
|
+
"clear": () => Promise<void>;
|
|
3158
3165
|
/**
|
|
3159
3166
|
* The type of content that the editor should handle and emit, defaults to `markdown` Assumed to be set only once, so not reactive to changes
|
|
3160
3167
|
* @default 'markdown'
|
|
@@ -3803,6 +3810,10 @@ export namespace Components {
|
|
|
3803
3810
|
* @default true
|
|
3804
3811
|
*/
|
|
3805
3812
|
"allowResize": boolean;
|
|
3813
|
+
/**
|
|
3814
|
+
* Clear the editor's content imperatively, bypassing the `value` prop's change detection. Assigning an empty `value` prop only clears the editor when the value changes. Because the editor debounces its `change` event, a consumer's bound value can lag the live content, so assigning `''` when the prop was already `''` is skipped and the content is left untouched — for example, clearing the editor immediately after a send. Use this to empty the editor regardless of the prop's change detection. Does not emit a `change` event. If you mirror the editor content on `change` (drafts, validation, dirty state), reset your own copy when calling this. In readonly mode no editor is rendered, so this is a silent no-op.
|
|
3815
|
+
*/
|
|
3816
|
+
"clear": () => Promise<void>;
|
|
3806
3817
|
/**
|
|
3807
3818
|
* The type of content that the editor should handle and emit, defaults to `markdown` Assumed to be set only once, so not reactive to changes
|
|
3808
3819
|
* @default 'markdown'
|
|
@@ -4724,6 +4735,7 @@ declare global {
|
|
|
4724
4735
|
* @exampleComponent limel-example-code-diff-split
|
|
4725
4736
|
* @exampleComponent limel-example-code-diff-line-wrap
|
|
4726
4737
|
* @exampleComponent limel-example-code-diff-expand
|
|
4738
|
+
* @exampleComponent limel-example-code-diff-interactive
|
|
4727
4739
|
*/
|
|
4728
4740
|
interface HTMLLimelCodeDiffElement extends Components.LimelCodeDiff, HTMLStencilElement {
|
|
4729
4741
|
}
|
|
@@ -7505,6 +7517,7 @@ declare namespace LocalJSX {
|
|
|
7505
7517
|
* @exampleComponent limel-example-code-diff-split
|
|
7506
7518
|
* @exampleComponent limel-example-code-diff-line-wrap
|
|
7507
7519
|
* @exampleComponent limel-example-code-diff-expand
|
|
7520
|
+
* @exampleComponent limel-example-code-diff-interactive
|
|
7508
7521
|
*/
|
|
7509
7522
|
interface LimelCodeDiff {
|
|
7510
7523
|
/**
|
|
@@ -7520,7 +7533,7 @@ declare namespace LocalJSX {
|
|
|
7520
7533
|
* The layout of the diff view. - `unified` — single column with interleaved additions and removals - `split` — side-by-side comparison with old on left, new on right
|
|
7521
7534
|
* @default 'unified'
|
|
7522
7535
|
*/
|
|
7523
|
-
"layout"?:
|
|
7536
|
+
"layout"?: CodeDiffLayout;
|
|
7524
7537
|
/**
|
|
7525
7538
|
* When `true`, long lines are wrapped instead of causing horizontal scrolling. Useful when comparing prose or config files with long values.
|
|
7526
7539
|
* @default true
|
|
@@ -10910,7 +10923,7 @@ declare namespace LocalJSX {
|
|
|
10910
10923
|
"newValue": string | object;
|
|
10911
10924
|
"oldHeading": string;
|
|
10912
10925
|
"newHeading": string;
|
|
10913
|
-
"layout":
|
|
10926
|
+
"layout": CodeDiffLayout;
|
|
10914
10927
|
"contextLines": number;
|
|
10915
10928
|
"lineWrapping": boolean;
|
|
10916
10929
|
"language": string;
|
|
@@ -11815,6 +11828,7 @@ declare module "@stencil/core" {
|
|
|
11815
11828
|
* @exampleComponent limel-example-code-diff-split
|
|
11816
11829
|
* @exampleComponent limel-example-code-diff-line-wrap
|
|
11817
11830
|
* @exampleComponent limel-example-code-diff-expand
|
|
11831
|
+
* @exampleComponent limel-example-code-diff-interactive
|
|
11818
11832
|
*/
|
|
11819
11833
|
"limel-code-diff": LocalJSX.IntrinsicElements["limel-code-diff"] & JSXBase.HTMLAttributes<HTMLLimelCodeDiffElement>;
|
|
11820
11834
|
/**
|
|
@@ -4,6 +4,7 @@ export * from './components/button/button.types';
|
|
|
4
4
|
export * from './components/callout/callout.types';
|
|
5
5
|
export * from './components/chip-set/chip.types';
|
|
6
6
|
export * from './components/circular-progress/circular-progress.types';
|
|
7
|
+
export * from './components/code-diff/code-diff.types';
|
|
7
8
|
export * from './components/code-editor/code-editor.types';
|
|
8
9
|
export * from './components/collapsible-section/action';
|
|
9
10
|
export * from './components/chart/chart.types';
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as r}from"./p-BGxJfR2f.js";import{c as o}from"./p-JbKhhoXs.js";const l=class{constructor(r){t(this,r),this.change=e(this,"change"),this.imagePasted=e(this,"imagePasted"),this.imageRemoved=e(this,"imageRemoved"),this.metadataChange=e(this,"metadataChange"),this.triggerStart=e(this,"triggerStart"),this.triggerStop=e(this,"triggerStop"),this.triggerChange=e(this,"triggerChange"),this.contentType="markdown",this.language="en",this.disabled=!1,this.readonly=!1,this.invalid=!1,this.customElements=[],this.triggers=[],this.required=!1,this.allowResize=!0,this.ui="standard",this.renderHelperLine=()=>{if(this.helperText)return i("limel-helper-line",{helperText:this.helperText,helperTextId:this.helperTextId,invalid:this.isInvalid()})},this.isInvalid=()=>!this.readonly&&(!!this.invalid||void 0),this.handleChange=t=>{t.stopPropagation(),this.change.emit(t.detail)},this.handleImagePasted=t=>{t.stopPropagation(),this.imagePasted.emit(t.detail)},this.handleMetadataChange=t=>{t.stopPropagation(),this.metadataChange.emit(t.detail)},this.handleImageRemoved=t=>{t.stopPropagation(),this.imageRemoved.emit(t.detail)},this.helperTextId=o(),this.editorId=o()}async flushPendingChanges(){var t;await(null===(t=this.adapterElement)||void 0===t?void 0:t.flushPendingChanges())}render(){return i(r,{key:"5d73675909084c010819fb357d2b0b78d5ae3cfb"},i("limel-notched-outline",{key:"3fe07fb082afca0ba93f645f0f9a4a703ac62311",labelId:this.editorId,label:this.label,required:this.required,invalid:this.invalid,disabled:this.disabled,readonly:this.readonly,hasValue:!!this.value,hasFloatingLabel:!0},this.renderEditor(),this.renderPlaceholder()),this.renderHelperLine())}renderEditor(){return this.readonly?i("limel-markdown",{slot:"content",value:this.value,"aria-controls":this.helperText?this.helperTextId:void 0,id:this.editorId}):i("limel-prosemirror-adapter",{ref:t=>this.adapterElement=t,slot:"content","aria-placeholder":this.placeholder,contentType:this.contentType,onChange:this.handleChange,onImagePasted:this.handleImagePasted,onImageRemoved:this.handleImageRemoved,onMetadataChange:this.handleMetadataChange,customElements:this.customElements,value:this.value,"aria-controls":this.helperText?this.helperTextId:void 0,id:this.editorId,"aria-disabled":this.disabled,"aria-invalid":this.invalid,"aria-required":this.required,language:this.language,triggerCharacters:this.triggers,disabled:this.disabled,ui:this.ui})}renderPlaceholder(){if(this.placeholder&&!this.value)return i("span",{class:"placeholder","aria-hidden":"true",slot:"content"},this.placeholder)}static get delegatesFocus(){return!0}};l.style='@charset "UTF-8";*{box-sizing:border-box}:host(limel-text-editor){--limel-notched-outline-z-index:2;--limel-prosemirror-adapter-toolbar-opacity:0.6;--limel-text-editor-padding:0.25rem 1rem 0.75rem 1rem;--limel-prosemirror-adapter-toolbar-grid-template-rows:1fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.3s;--limel-prosemirror-adapter-toolbar-transition-timing-function:cubic-bezier( 0.19, 0.23, 0.26, 0.89 );position:relative;isolation:isolate;display:flex;flex-direction:column;width:100%;min-width:5rem;min-height:5rem;height:100%;max-height:var(--text-editor-max-height, calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)) - 4rem));padding:1px}:host(limel-text-editor) limel-notched-outline{height:100%}:host(limel-text-editor:focus-within),:host(limel-text-editor:not([ui=minimal]):hover){--limel-prosemirror-adapter-toolbar-opacity:1}:host(limel-text-editor[ui=minimal]:not(:focus-within)){--limel-prosemirror-adapter-toolbar-grid-template-rows:0fr;--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration:0.46s;--limel-prosemirror-adapter-action-bar-padding-top-bottom:0;--limel-prosemirror-adapter-toolbar-opacity:0}:host(limel-text-editor[ui=minimal]:not(:focus-within)),:host(limel-text-editor[ui=no-toolbar]){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-text-editor-placeholder-top:0;min-height:2.5rem}:host(limel-text-editor[ui=minimal]:not(:focus-within)) limel-prosemirror-adapter,:host(limel-text-editor[ui=no-toolbar]) limel-prosemirror-adapter{min-height:2.5rem}:host(limel-text-editor:focus-within) .placeholder,:host(limel-text-editor:focus) .placeholder{opacity:0}:host(limel-text-editor[disabled]:not([disabled=false])) limel-prosemirror-adapter{cursor:not-allowed;opacity:0.4;pointer-events:none}:host(limel-text-editor[readonly]:not([readonly=false])){--limel-text-editor-padding:0.75rem 1rem 0.75rem 1rem;--limel-text-editor-placeholder-top:0}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown{display:block;padding:var(--limel-text-editor-padding);overflow-y:auto;-webkit-overflow-scrolling:touch;height:100%}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before,:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{z-index:1;pointer-events:none;content:"";display:block;position:absolute;width:100%}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:after{height:1.75rem;top:0;background:linear-gradient(var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))), transparent)}:host(limel-text-editor[readonly]:not([readonly=false])) limel-markdown:before{height:2rem;bottom:-0.25rem;background:linear-gradient(transparent, var(--text-editor-fade-out-background-color, rgb(var(--contrast-100))))}.placeholder{transition-property:top;transition-duration:var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);transition-timing-function:var(--limel-prosemirror-adapter-toolbar-transition-timing-function);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;position:absolute;top:var(--limel-text-editor-placeholder-top, 2.25rem);left:0;right:0;padding:var(--limel-text-editor-padding);font-style:italic;font-size:var(--limel-theme-default-font-size);color:rgb(var(--contrast-900))}limel-prosemirror-adapter{flex-grow:1;min-width:0;min-height:5rem;height:100%;max-height:100%;overflow:hidden auto;-webkit-overflow-scrolling:touch}:host(limel-text-editor:focus),:host(limel-text-editor:focus-visible),:host(limel-text-editor:focus-within){--limel-h-l-grid-template-rows-transition-speed:0.46s;--limel-h-l-grid-template-rows:1fr}:host(limel-text-editor){--limel-h-l-grid-template-rows-transition-speed:0.3s;--limel-h-l-grid-template-rows:0fr}:host(limel-text-editor:focus) limel-helper-line,:host(limel-text-editor:focus-visible) limel-helper-line,:host(limel-text-editor:focus-within) limel-helper-line,:host(limel-text-editor:hover) limel-helper-line{will-change:grid-template-rows}:host(limel-text-editor[allow-resize]) limel-prosemirror-adapter{resize:vertical}';export{l as limel_text_editor}
|