838eec30a8
- Implemented a new composable `useTheme` for managing theme state. - Added functions to read and write theme preference to local storage. - Applied theme styles to the DOM based on user preference. - Introduced a toggle function to switch between light and dark themes. refactor: enhance copilot plugin functionality - Improved request handling with sequence and document versioning. - Refactored ghost text handling to improve clarity and efficiency. - Updated markdown insertion logic to handle parsed content more robustly. - Enhanced error handling and logging for better debugging. style: update global styles for light and dark themes - Defined CSS variables for light and dark themes to streamline styling. - Improved overall styling consistency and responsiveness. - Added transitions for smoother theme changes and interactions.
2 lines
5.7 KiB
JavaScript
2 lines
5.7 KiB
JavaScript
import{f as g}from"./vendor-micromark-factory-space-BM4zcA-B.js";import{m as O,f as R,j as P}from"./vendor-micromark-util-character-Cn8n62xE.js";class N{constructor(){this.map=[]}add(n,i,r){x(this,n,i,r)}consume(n){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let i=this.map.length;const r=[];for(;i>0;)i-=1,r.push(n.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),n.length=this.map[i][0];r.push(n.slice()),n.length=0;let a=r.pop();for(;a;){for(const l of a)n.push(l);a=r.pop()}this.map.length=0}}function x(t,n,i,r){let a=0;if(!(i===0&&r.length===0)){for(;a<t.map.length;){if(t.map[a][0]===n){t.map[a][1]+=i,t.map[a][2].push(...r);return}a+=1}t.map.push([n,i,r])}}function V(t,n){let i=!1;const r=[];for(;n<t.length;){const a=t[n];if(i){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(t[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(t[n-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(i=!0);n+=1}return r}function Q(){return{flow:{null:{name:"table",tokenize:_,resolveAll:q}}}}function _(t,n,i){const r=this;let a=0,l=0,u;return w;function w(e){let o=r.events.length-1;for(;o>-1;){const M=r.events[o][1].type;if(M==="lineEnding"||M==="linePrefix")o--;else break}const S=o>-1?r.events[o][1].type:null,z=S==="tableHead"||S==="tableRow"?H:h;return z===H&&r.parser.lazy[r.now().line]?i(e):z(e)}function h(e){return t.enter("tableHead"),t.enter("tableRow"),D(e)}function D(e){return e===124||(u=!0,l+=1),p(e)}function p(e){return e===null?i(e):O(e)?l>1?(l=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(e),t.exit("lineEnding"),f):i(e):R(e)?g(t,p,"whitespace")(e):(l+=1,u&&(u=!1,a+=1),e===124?(t.enter("tableCellDivider"),t.consume(e),t.exit("tableCellDivider"),u=!0,p):(t.enter("data"),b(e)))}function b(e){return e===null||e===124||P(e)?(t.exit("data"),p(e)):(t.consume(e),e===92?m:b)}function m(e){return e===92||e===124?(t.consume(e),b):b(e)}function f(e){return r.interrupt=!1,r.parser.lazy[r.now().line]?i(e):(t.enter("tableDelimiterRow"),u=!1,R(e)?g(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(e):s(e))}function s(e){return e===45||e===58?A(e):e===124?(u=!0,t.enter("tableCellDivider"),t.consume(e),t.exit("tableCellDivider"),T):d(e)}function T(e){return R(e)?g(t,A,"whitespace")(e):A(e)}function A(e){return e===58?(l+=1,u=!0,t.enter("tableDelimiterMarker"),t.consume(e),t.exit("tableDelimiterMarker"),E):e===45?(l+=1,E(e)):e===null||O(e)?C(e):d(e)}function E(e){return e===45?(t.enter("tableDelimiterFiller"),B(e)):d(e)}function B(e){return e===45?(t.consume(e),B):e===58?(u=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(e),t.exit("tableDelimiterMarker"),F):(t.exit("tableDelimiterFiller"),F(e))}function F(e){return R(e)?g(t,C,"whitespace")(e):C(e)}function C(e){return e===124?s(e):e===null||O(e)?!u||a!==l?d(e):(t.exit("tableDelimiterRow"),t.exit("tableHead"),n(e)):d(e)}function d(e){return i(e)}function H(e){return t.enter("tableRow"),k(e)}function k(e){return e===124?(t.enter("tableCellDivider"),t.consume(e),t.exit("tableCellDivider"),k):e===null||O(e)?(t.exit("tableRow"),n(e)):R(e)?g(t,k,"whitespace")(e):(t.enter("data"),j(e))}function j(e){return e===null||e===124||P(e)?(t.exit("data"),k(e)):(t.consume(e),e===92?L:j)}function L(e){return e===92||e===124?(t.consume(e),j):j(e)}}function q(t,n){let i=-1,r=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],w=!1,h=0,D,p,b;const m=new N;for(;++i<t.length;){const f=t[i],s=f[1];f[0]==="enter"?s.type==="tableHead"?(w=!1,h!==0&&(I(m,n,h,D,p),p=void 0,h=0),D={type:"table",start:Object.assign({},s.start),end:Object.assign({},s.end)},m.add(i,0,[["enter",D,n]])):s.type==="tableRow"||s.type==="tableDelimiterRow"?(r=!0,b=void 0,l=[0,0,0,0],u=[0,i+1,0,0],w&&(w=!1,p={type:"tableBody",start:Object.assign({},s.start),end:Object.assign({},s.end)},m.add(i,0,[["enter",p,n]])),a=s.type==="tableDelimiterRow"?2:p?3:1):a&&(s.type==="data"||s.type==="tableDelimiterMarker"||s.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],b=v(m,n,l,a,void 0,b),l=[0,0,0,0]),u[2]=i)):s.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(u[0]=u[1],b=v(m,n,l,a,void 0,b)),l=u,u=[l[1],i,0,0])):s.type==="tableHead"?(w=!0,h=i):s.type==="tableRow"||s.type==="tableDelimiterRow"?(h=i,l[1]!==0?(u[0]=u[1],b=v(m,n,l,a,i,b)):u[1]!==0&&(b=v(m,n,u,a,i,b)),a=0):a&&(s.type==="data"||s.type==="tableDelimiterMarker"||s.type==="tableDelimiterFiller")&&(u[3]=i)}for(h!==0&&I(m,n,h,D,p),m.consume(n.events),i=-1;++i<n.events.length;){const f=n.events[i];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=V(n.events,i))}return t}function v(t,n,i,r,a,l){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",w="tableContent";i[0]!==0&&(l.end=Object.assign({},y(n.events,i[0])),t.add(i[0],0,[["exit",l,n]]));const h=y(n.events,i[1]);if(l={type:u,start:Object.assign({},h),end:Object.assign({},h)},t.add(i[1],0,[["enter",l,n]]),i[2]!==0){const D=y(n.events,i[2]),p=y(n.events,i[3]),b={type:w,start:Object.assign({},D),end:Object.assign({},p)};if(t.add(i[2],0,[["enter",b,n]]),r!==2){const m=n.events[i[2]],f=n.events[i[3]];if(m[1].end=Object.assign({},f[1].end),m[1].type="chunkText",m[1].contentType="text",i[3]>i[2]+1){const s=i[2]+1,T=i[3]-i[2]-1;t.add(s,T,[])}}t.add(i[3]+1,0,[["exit",b,n]])}return a!==void 0&&(l.end=Object.assign({},y(n.events,a)),t.add(a,0,[["exit",l,n]]),l=void 0),l}function I(t,n,i,r,a){const l=[],u=y(n.events,i);a&&(a.end=Object.assign({},u),l.push(["exit",a,n])),r.end=Object.assign({},u),l.push(["exit",r,n]),t.add(i+1,0,l)}function y(t,n){const i=t[n],r=i[0]==="enter"?"start":"end";return i[1][r]}export{Q as g};
|