@pierre/diffs 1.6.1 → 1.6.2

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.
@@ -1,5 +1,5 @@
1
1
  //#region src/editor/editor.css?inline
2
- var editor_default = "@layer base,theme,rendered,unsafe;::selection{background-color:#0000}[data-deleted-text-selection] [data-deletions] ::selection,[data-deleted-text-selection] [data-line-type=change-deletion] ::selection{background-color:var(--diffs-editor-selection-bg)}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content],[data-diff-type=split][data-overflow=wrap]{position:relative}[data-code]{container-type:inline-size}[data-content]{cursor:text;caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-line]{cursor:text;background-color:#0000}[data-line]:after{content:\"\";z-index:-20;background-color:var(--diffs-line-bg);pointer-events:none;position:absolute;inset:0}[data-line][data-editor-active-line]:after{box-shadow:inset 0 0 0 1px var(--diffs-editor-line-highlight-border)}[data-editor-overlay]{display:contents}[data-caret],[data-edit-prediction],[data-selection-range],[data-match-range],[data-bracket-match-range],[data-edit-prediction-deletion-range],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range],[data-marker-range],[data-remote-caret],[data-caret-highlight-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-edit-prediction]{z-index:1;user-select:none;width:max-content;height:auto;color:var(--diffs-editor-edit-prediction-fg,color-mix(in lab, var(--diffs-fg) 45%, transparent));overflow:visible}[data-edit-prediction-line]{box-sizing:border-box;white-space:pre;width:max-content;min-height:1lh;display:block}[data-edit-prediction][data-replacement] [data-edit-prediction-line],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range]{background-color:var(--diffs-edit-prediction-bg,var(--diffs-bg))}[data-edit-prediction-suffix]{color:var(--diffs-fg)}[data-edit-prediction][data-wrap] [data-edit-prediction-line]{overflow-wrap:anywhere;white-space:pre-wrap;max-width:100%}[data-edit-prediction-line][data-empty]:after{content:\"↵\"}[data-edit-prediction-spacer]{margin-block-end:var(--diffs-edit-prediction-spacer-height)}[data-code][data-deletions] [data-edit-prediction-spacer]{box-sizing:content-box;margin-block-end:0;padding-block-end:var(--diffs-edit-prediction-spacer-height)}[data-edit-prediction-deletion-range]{--diffs-edit-prediction-deletion-color:var(--diffs-editor-edit-prediction-deletion-fg,color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));z-index:1;background:linear-gradient(to bottom, transparent calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% + .5px), transparent calc(50% + .5px))}[data-edit-prediction-insertion-range]{z-index:0}[data-edit-prediction-replacement-range]{z-index:1}[data-caret]{z-index:2;background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px}@media (prefers-reduced-motion:no-preference){[data-caret]{animation:1.2s .8s infinite blinking}}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-caret-highlight-range]{z-index:-10;background-color:var(--diffs-caret-highlight-bg,var(--diffs-editor-selection-bg))}[data-selection-corner]{background-color:var(--diffs-selection-corner-bg,var(--diffs-bg));width:100%;height:100%}[data-match-range]{z-index:-10;background-color:var(--diffs-editor-match-bg,var(--diffs-editor-selection-bg))}[data-match-range]:not([data-focus]){background-color:var(--diffs-editor-match-highlight-bg,light-dark(#ff963288,#ff963266))}[data-bracket-match-range]{z-index:-9;box-sizing:border-box;border-bottom:1px solid var(--diffs-editor-bracket-match-border,color-mix(in lab, var(--diffs-fg) 60%, transparent));background-color:var(--diffs-editor-bracket-match-bg,color-mix(in lab, var(--diffs-fg) 5%, transparent))}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}[data-marker-range]{z-index:1;background-color:var(--diffs-marker-bg);mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-error-fg,var(--diffs-deletion-base))}[data-marker-warning]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-warning-fg,light-dark(var(--diffs-warning-light),var(--diffs-warning-dark)))}[data-marker-info]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-info-fg,var(--diffs-modified-base))}[data-marker-hint]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-hint-fg,var(--diffs-fg-number))}@media (width>=480px){[data-content]{caret-color:#0000}[data-content]:focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-fg:var(--diffs-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;width:fit-content;max-width:calc(100% - 24px);font:14px/20px var(--diffs-header-font-fallback);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popover],[data-selection-action-popover]{--popover-gap:var(--diffs-popover-gap,var(--diffs-gap-fallback,8px));--popover-viewport-left:0px;--popover-viewport-right:100cqw;--popover-viewport-top:-99999px;--popover-viewport-bottom:99999px;--popover-min-left:calc(var(--popover-viewport-left) + var(--gutter-width,0px) + var(--popover-gap));--popover-available-width:max(0px, calc(var(--popover-viewport-right) - var(--popover-min-left) - var(--popover-gap)));max-width:min(640px, var(--popover-available-width));translate:clamp(var(--popover-min-left), var(--popover-x,var(--popover-min-left)), calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)) clamp(var(--popover-viewport-top), calc(var(--popover-y,0px) + var(--popover-y-shift,0px)), calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%))}[data-marker-popover]{--diffs-widget-bg:var(--diffs-marker-bg);--diffs-widget-shadow:0 4px 8px #00000026, 0 6px 18px #00000026;min-width:min(180px, var(--popover-available-width));overflow-wrap:anywhere;color:var(--diffs-marker-contrast);white-space:normal;pointer-events:auto;border:0;padding:8px 12px;@supports (color:contrast-color(red)){color:contrast-color(var(--diffs-marker-bg,var(--diffs-bg)))}& [data-marker-message]{white-space:normal;overflow-wrap:anywhere;& code{white-space:normal;color:inherit;background-color:#0000;display:inline}}}[data-selection-action-popover]{pointer-events:auto;flex-wrap:wrap;align-items:center;gap:4px;width:max-content;padding:4px;display:flex}[data-search-panel]{z-index:100;flex-direction:column;justify-content:right;width:100%;height:0;display:flex;position:sticky;top:16px;right:16px;container:search-panel/inline-size;& [data-editor-widget]{z-index:100;flex-shrink:0;align-items:stretch;gap:8px;min-width:260px;max-width:100%;margin-inline:auto 16px;padding:4px;display:flex;position:relative}& svg{fill:currentColor;width:12px;height:12px;display:block}}[data-search-grid]{grid-template-columns:auto auto auto;grid-template-areas:\"find matches nav\"\"replace actions.\";align-items:center;gap:4px 6px;width:100%;display:grid}[data-input-box][data-find]{grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find]{grid-template-areas:\"find matches nav\"}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-search-panel] [data-editor-widget]{padding:10px}[data-search-grid][data-mode=replace]{grid-template-columns:auto 1fr auto;grid-template-areas:\"find find find\"\"replace replace replace\"\"nav matches actions\"}[data-search-grid][data-mode=find]{grid-template-columns:auto 1fr auto;grid-template-areas:\"find find find\"\"nav matches matches\"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative;& input{width:100%;min-width:0;color:var(--diffs-fg);background-color:var(--diffs-bg);border:1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));border-radius:6px;outline:none;flex-grow:1;padding-inline:6px;font-size:13px;line-height:24px;&::selection{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg))}&:focus-visible{outline:1px solid var(--diffs-modified-base)}}&[data-find] input{padding-inline-end:72px}& [data-search-icon]{--diffs-search-icon-size:20px}}[data-search-toggles]{align-items:center;gap:1px;display:flex;position:absolute;top:50%;right:4px;transform:translateY(-50%)}[data-matches]{white-space:nowrap;min-width:50px;color:color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));flex-shrink:0;grid-area:matches;font-size:12px;font-weight:500;line-height:20px;&[data-no-matches]{color:color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg))}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex;&:disabled{opacity:.25;cursor:default}&:not(:disabled):hover{color:var(--diffs-fg)}&:focus-visible{outline:1px solid var(--diffs-modified-base)}&[aria-pressed=true]{color:var(--diffs-modified-base)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);&:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}\n";
2
+ var editor_default = "@layer base,theme,rendered,unsafe;::selection{background-color:#0000}[data-deleted-text-selection] [data-deletions] ::selection,[data-deleted-text-selection] [data-line-type=change-deletion] ::selection{background-color:var(--diffs-editor-selection-bg)}@keyframes blinking{0%{opacity:1}50%{opacity:0}to{opacity:1}}:host,[data-code],[data-content],[data-diff-type=split][data-overflow=wrap]{position:relative}[data-code]{container-type:inline-size}[data-content]{cursor:text;caret-color:var(--diffs-bg-caret);background-color:#0000;outline:none}[data-line]{cursor:text;background-color:#0000}[data-line]:after{content:\"\";z-index:-20;background-color:var(--diffs-line-bg);pointer-events:none;position:absolute;inset:0}[data-line][data-editor-active-line]:after{box-shadow:inset 0 0 0 1px var(--diffs-editor-line-highlight-border)}[data-editor-overlay]{display:contents}[data-caret],[data-edit-prediction],[data-selection-range],[data-match-range],[data-bracket-match-range],[data-edit-prediction-deletion-range],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range],[data-marker-range],[data-remote-caret],[data-caret-highlight-range]{height:1lh;line-height:var(--diffs-line-height);pointer-events:none;position:absolute;top:0;left:0}[data-edit-prediction]{z-index:1;user-select:none;width:max-content;height:auto;color:var(--diffs-editor-edit-prediction-fg,color-mix(in lab, var(--diffs-fg) 45%, transparent));overflow:visible}[data-edit-prediction-line]{box-sizing:border-box;white-space:pre;width:max-content;min-height:1lh;display:block}[data-edit-prediction][data-replacement] [data-edit-prediction-line],[data-edit-prediction-insertion-range],[data-edit-prediction-replacement-range]{background-color:var(--diffs-edit-prediction-bg,var(--diffs-bg))}[data-edit-prediction-suffix]{color:var(--diffs-fg)}[data-edit-prediction][data-wrap] [data-edit-prediction-line]{overflow-wrap:anywhere;white-space:pre-wrap;max-width:100%}[data-edit-prediction-line][data-empty]:after{content:\"↵\"}[data-edit-prediction-spacer]{margin-block-end:var(--diffs-edit-prediction-spacer-height)}[data-code][data-deletions] [data-edit-prediction-spacer]{box-sizing:content-box;margin-block-end:0;padding-block-end:var(--diffs-edit-prediction-spacer-height)}[data-edit-prediction-deletion-range]{--diffs-edit-prediction-deletion-color:var(--diffs-editor-edit-prediction-deletion-fg,color-mix(in lab, var(--diffs-deletion-base) 70%, transparent));z-index:1;background:linear-gradient(to bottom, transparent calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% - .5px), var(--diffs-edit-prediction-deletion-color) calc(50% + .5px), transparent calc(50% + .5px))}[data-edit-prediction-insertion-range]{z-index:0}[data-edit-prediction-replacement-range]{z-index:1}[data-caret]{z-index:2;background-color:var(--diffs-bg-caret-override,var(--diffs-editor-cursor-fg,light-dark(color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg)))));visibility:hidden;width:2px}@media (prefers-reduced-motion:no-preference){[data-caret]{animation:1.2s .8s infinite blinking}}[data-selection-range]{z-index:-10;background-color:var(--diffs-editor-selection-bg)}[data-caret-highlight-range]{z-index:-10;background-color:var(--diffs-caret-highlight-bg,var(--diffs-editor-selection-bg))}[data-selection-corner]{background-color:var(--diffs-selection-corner-bg,var(--diffs-bg));width:100%;height:100%}[data-match-range]{z-index:-10;background-color:var(--diffs-editor-match-bg,var(--diffs-editor-selection-bg))}[data-match-range]:not([data-focus]){background-color:var(--diffs-editor-match-highlight-bg,light-dark(#ff963288,#ff963266))}[data-bracket-match-range]{z-index:-9;box-sizing:border-box;border-bottom:1px solid var(--diffs-editor-bracket-match-border,color-mix(in lab, var(--diffs-fg) 60%, transparent));background-color:var(--diffs-editor-bracket-match-bg,color-mix(in lab, var(--diffs-fg) 5%, transparent))}[data-rtl]{border-top-left-radius:3px}[data-rtr]{border-top-right-radius:3px}[data-rbl]{border-bottom-left-radius:3px}[data-rbr]{border-bottom-right-radius:3px}[data-marker-range]{z-index:1;background-color:var(--diffs-marker-bg);mask-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+);mask-position:0 100%;mask-size:6px 3px;mask-repeat:repeat-x}[data-marker-error]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-error-fg,var(--diffs-deletion-base))}[data-marker-warning]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-warning-fg,light-dark(var(--diffs-warning-light),var(--diffs-warning-dark)))}[data-marker-info]{--diffs-marker-contrast:#000;--diffs-marker-bg:var(--diffs-editor-info-fg,var(--diffs-modified-base))}[data-marker-hint]{--diffs-marker-contrast:light-dark(#fff,#000);--diffs-marker-bg:var(--diffs-editor-hint-fg,var(--diffs-fg-number))}@media (width>=480px){[data-content]{caret-color:#0000}[data-content]:focus~[data-editor-overlay] [data-caret]{visibility:visible}}[data-editor-widget]{--diffs-widget-fg:var(--diffs-fg);--diffs-widget-bg:color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));--diffs-widget-border:color-mix(in lab, var(--diffs-fg) 20%, transparent);--diffs-widget-shadow:inset 0 0 0 1px var(--diffs-bg), 0 4px 8px #00000013, 0 6px 18px #00000013;z-index:100;width:fit-content;max-width:calc(100% - 24px);font:14px/20px var(--diffs-header-font-fallback);border:1px solid var(--diffs-widget-border);background-color:var(--diffs-widget-bg);box-shadow:var(--diffs-widget-shadow);background-clip:padding-box;border-radius:9px;position:absolute;top:0;left:0}[data-marker-popover],[data-selection-action-popover]{--popover-gap:var(--diffs-popover-gap,var(--diffs-gap-fallback,8px));--popover-viewport-left:0px;--popover-viewport-right:100cqw;--popover-viewport-top:-99999px;--popover-viewport-bottom:99999px;--popover-min-left:calc(var(--popover-viewport-left) + var(--gutter-width,0px) + var(--popover-gap));--popover-available-width:max(0px, calc(var(--popover-viewport-right) - var(--popover-min-left) - var(--popover-gap)));max-width:min(640px, var(--popover-available-width));translate:clamp(var(--popover-min-left), var(--popover-x,var(--popover-min-left)), calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)) clamp(var(--popover-viewport-top), calc(var(--popover-y,0px) + var(--popover-y-shift,0px)), calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%))}[data-marker-popover]{--diffs-widget-bg:var(--diffs-marker-bg);--diffs-widget-shadow:0 4px 8px #00000026, 0 6px 18px #00000026;min-width:min(180px, var(--popover-available-width));overflow-wrap:anywhere;color:var(--diffs-marker-contrast);white-space:normal;pointer-events:auto;border:0;padding:8px 12px;@supports (color:contrast-color(red)){color:contrast-color(var(--diffs-marker-bg,var(--diffs-bg)))}& [data-marker-message]{white-space:normal;overflow-wrap:anywhere;& code{white-space:normal;color:inherit;background-color:#0000;display:inline}}}[data-selection-action-popover]{pointer-events:auto;flex-wrap:wrap;align-items:center;gap:4px;width:max-content;padding:4px;display:flex}[data-search-panel]{z-index:100;flex-direction:column;justify-content:right;width:100%;height:0;display:flex;position:sticky;top:16px;right:16px;container:search-panel/inline-size;& [data-editor-widget]{z-index:100;flex-shrink:0;align-items:stretch;gap:8px;min-width:260px;max-width:100%;margin-inline:auto 16px;padding:4px;display:flex;position:relative}& svg{fill:currentColor;width:12px;height:12px;display:block}}[data-search-grid]{grid-template-columns:auto auto auto auto;grid-template-areas:\"toggle find matches nav\"\".replace actions.\";align-items:center;gap:4px 6px;width:100%;display:grid}[data-input-box][data-find]{grid-area:find}[data-search-nav]{grid-area:nav}[data-input-box][data-replace]{grid-area:replace}[data-replace-actions]{grid-area:actions}[data-search-grid][data-mode=find]{grid-template-areas:\"toggle find matches nav\"}[data-search-grid][data-mode=find] [data-replace-cell]{display:none}@container search-panel (width<400px){[data-search-panel] [data-editor-widget]{padding:10px}[data-search-grid][data-mode=replace]{grid-template-columns:auto auto 1fr auto;grid-template-areas:\"toggle find find find\"\".replace replace replace\"\".nav matches actions\"}[data-search-grid][data-mode=find]{grid-template-columns:auto auto 1fr auto;grid-template-areas:\"toggle find find find\"\".nav matches matches\"}[data-replace-actions]{justify-self:end}[data-search-grid] [data-input-box]{width:auto}}[data-input-box]{align-items:center;width:200px;display:flex;position:relative;& input{width:100%;min-width:0;color:var(--diffs-fg);background-color:var(--diffs-bg);border:1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));border-radius:6px;outline:none;flex-grow:1;padding-inline:6px;font-size:13px;line-height:24px;&::selection{background-color:color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg))}&:focus-visible{outline:1px solid var(--diffs-modified-base)}}&[data-find] input{padding-inline-end:72px}& [data-search-icon]{--diffs-search-icon-size:20px}}[data-search-toggles]{align-items:center;gap:1px;display:flex;position:absolute;top:50%;right:4px;transform:translateY(-50%)}[data-matches]{white-space:nowrap;min-width:50px;color:color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));flex-shrink:0;grid-area:matches;font-size:12px;font-weight:500;line-height:20px;&[data-no-matches]{color:color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg))}}[data-replace-actions],[data-search-nav]{align-items:center;display:flex}[data-search-icon]{appearance:none;width:var(--diffs-search-icon-size,24px);height:var(--diffs-search-icon-size,24px);color:color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));border-radius:var(--diffs-search-icon-radius,4px);cursor:pointer;background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;margin:0;padding:0;transition:background-color .1s ease-in-out,color .1s ease-in-out;display:flex;&:disabled{opacity:.25;cursor:default}&:not(:disabled):hover{color:var(--diffs-fg)}&:focus-visible{outline:1px solid var(--diffs-modified-base)}&[aria-pressed=true]{color:var(--diffs-modified-base)}}[data-replace-toggle]{--diffs-search-icon-size:16px;grid-area:toggle;align-self:stretch;height:auto;&[aria-expanded=false] svg{transform:rotate(-90deg)}}[data-search-close]{--diffs-search-icon-size:20px;--diffs-search-icon-radius:50%;color:var(--diffs-widget-bg);background-color:color-mix(in lab, var(--diffs-widget-fg) 50%, var(--diffs-bg));position:absolute;top:0;right:0;transform:translate(50%,-50%);&:not(:disabled):hover{opacity:1;color:var(--diffs-widget-bg);background-color:var(--diffs-widget-fg)}}\n";
3
3
  //#endregion
4
4
  export { editor_default as default };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"editor2.js","names":[],"sources":["../../src/editor/editor.css?inline"],"sourcesContent":["::selection {\n background-color: transparent;\n}\n\n/* Read-only deletion text sits outside the editor's selection overlay, so the\n global transparent ::selection above hides its selection by default. Reveal\n the native selection (so users can see what they select and copy) only while\n the user is actively selecting within deleted text: the editor sets\n data-deleted-text-selection on the diff while a pointer gesture starts there.\n Gating it this way means a normal selection of editable code that merely\n sweeps across an interleaved deleted line (unified view) does not highlight\n that line. Covers the whole deletions column in split view and individual\n deleted lines in unified view. */\n[data-deleted-text-selection] [data-deletions] ::selection,\n[data-deleted-text-selection] [data-line-type='change-deletion'] ::selection {\n background-color: var(--diffs-editor-selection-bg);\n}\n\n@keyframes blinking {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n:host, /* for scroll anchor */\n[data-code], /* for editor overlay */\n[data-content] /* for wrap line measurement */,\n[data-diff-type='split'][data-overflow='wrap'] {\n position: relative;\n}\n[data-code] {\n container-type: inline-size;\n}\n[data-content] {\n cursor: text;\n background-color: transparent;\n caret-color: var(--diffs-bg-caret);\n outline: none;\n}\n[data-line] {\n cursor: text;\n /* Transparent so the line's in-flow background can't hide the selection\n overlay (z-index -10); the line color moves to the ::after layer below it. */\n background-color: transparent;\n}\n/* Line background layer below the selection overlay (z-index -10) so the\n translucent selection composites over it. ::before is the +/- indicator. */\n[data-line]::after {\n content: '';\n position: absolute;\n inset: 0;\n z-index: -20;\n background-color: var(--diffs-line-bg);\n pointer-events: none;\n}\n/* The line-state pipeline resolves the active background. Keep the theme's\n border as an additional cue, including for border-only themes. */\n[data-line][data-editor-active-line]::after {\n box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);\n}\n\n[data-editor-overlay] {\n display: contents;\n}\n[data-caret],\n[data-edit-prediction],\n[data-selection-range],\n[data-match-range],\n[data-bracket-match-range],\n[data-edit-prediction-deletion-range],\n[data-edit-prediction-insertion-range],\n[data-edit-prediction-replacement-range],\n[data-marker-range],\n[data-remote-caret],\n[data-caret-highlight-range] {\n position: absolute;\n top: 0;\n left: 0;\n height: 1lh;\n line-height: var(--diffs-line-height);\n pointer-events: none;\n}\n[data-edit-prediction] {\n z-index: 1;\n height: auto;\n overflow: visible;\n width: max-content;\n user-select: none;\n color: var(\n --diffs-editor-edit-prediction-fg,\n color-mix(in lab, var(--diffs-fg) 45%, transparent)\n );\n}\n[data-edit-prediction-line] {\n box-sizing: border-box;\n display: block;\n min-height: 1lh;\n width: max-content;\n white-space: pre;\n}\n[data-edit-prediction][data-replacement] [data-edit-prediction-line],\n[data-edit-prediction-insertion-range],\n[data-edit-prediction-replacement-range] {\n background-color: var(--diffs-edit-prediction-bg, var(--diffs-bg));\n}\n[data-edit-prediction-suffix] {\n color: var(--diffs-fg);\n}\n[data-edit-prediction][data-wrap] [data-edit-prediction-line] {\n max-width: 100%;\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n[data-edit-prediction-line][data-empty]::after {\n content: '↵';\n}\n[data-edit-prediction-spacer] {\n margin-block-end: var(--diffs-edit-prediction-spacer-height);\n}\n/* The deletions column of a split diff shows no ghost text, so its reserved\n rows are padding: the row tint and the buffer hatch extend over them instead\n of leaving a blank strip. Buffers size themselves with a border-box\n min-height that would absorb the padding, hence content-box. */\n[data-code][data-deletions] [data-edit-prediction-spacer] {\n margin-block-end: 0;\n padding-block-end: var(--diffs-edit-prediction-spacer-height);\n box-sizing: content-box;\n}\n[data-edit-prediction-deletion-range] {\n --diffs-edit-prediction-deletion-color: var(\n --diffs-editor-edit-prediction-deletion-fg,\n color-mix(in lab, var(--diffs-deletion-base) 70%, transparent)\n );\n\n z-index: 1;\n background: linear-gradient(\n to bottom,\n transparent calc(50% - 0.5px),\n var(--diffs-edit-prediction-deletion-color) calc(50% - 0.5px),\n var(--diffs-edit-prediction-deletion-color) calc(50% + 0.5px),\n transparent calc(50% + 0.5px)\n );\n}\n[data-edit-prediction-insertion-range] {\n z-index: 0;\n}\n[data-edit-prediction-replacement-range] {\n z-index: 1;\n}\n[data-caret] {\n z-index: 2;\n width: 2px;\n background-color: var(\n --diffs-bg-caret-override,\n var(\n --diffs-editor-cursor-fg,\n light-dark(\n color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg))\n )\n )\n );\n visibility: hidden;\n}\n/* Reduce motion only if user has set a preference */\n@media (prefers-reduced-motion: no-preference) {\n [data-caret] {\n animation: blinking 1.2s infinite;\n animation-delay: 0.8s;\n }\n}\n[data-selection-range] {\n z-index: -10;\n background-color: var(--diffs-editor-selection-bg);\n}\n[data-caret-highlight-range] {\n z-index: -10;\n background-color: var(\n --diffs-caret-highlight-bg,\n var(--diffs-editor-selection-bg)\n );\n}\n/* Masks the selection's square corner to fake rounding, so it must match the bg\n behind the selection: the line's diff color (passed in via\n --diffs-selection-corner-bg) or the editor base for context lines. */\n[data-selection-corner] {\n width: 100%;\n height: 100%;\n background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));\n}\n[data-match-range] {\n z-index: -10;\n background-color: var(\n --diffs-editor-match-bg,\n var(--diffs-editor-selection-bg)\n );\n}\n[data-match-range]:not([data-focus]) {\n background-color: var(\n --diffs-editor-match-highlight-bg,\n light-dark(#ff963288, #ff963266)\n );\n}\n[data-bracket-match-range] {\n z-index: -9;\n box-sizing: border-box;\n border-bottom: 1px solid\n var(\n --diffs-editor-bracket-match-border,\n color-mix(in lab, var(--diffs-fg) 60%, transparent)\n );\n background-color: var(\n --diffs-editor-bracket-match-bg,\n color-mix(in lab, var(--diffs-fg) 5%, transparent)\n );\n}\n\n[data-rtl] {\n border-top-left-radius: 3px;\n}\n[data-rtr] {\n border-top-right-radius: 3px;\n}\n[data-rbl] {\n border-bottom-left-radius: 3px;\n}\n[data-rbr] {\n border-bottom-right-radius: 3px;\n}\n\n/* Markers\n *\n * Marker range applies a wavy underline. Severity attributes are used by both\n * `[data-marker-range]` and `[data-marker-popover]` alike.\n */\n\n[data-marker-range] {\n z-index: 1;\n background-color: var(--diffs-marker-bg);\n mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+');\n mask-position: left bottom;\n mask-repeat: repeat-x;\n mask-size: 6px 3px;\n}\n\n[data-marker-error] {\n --diffs-marker-contrast: light-dark(#fff, #000);\n --diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));\n}\n[data-marker-warning] {\n --diffs-marker-contrast: #000;\n --diffs-marker-bg: var(\n --diffs-editor-warning-fg,\n light-dark(var(--diffs-warning-light), var(--diffs-warning-dark))\n );\n}\n[data-marker-info] {\n --diffs-marker-contrast: #000;\n --diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));\n}\n[data-marker-hint] {\n --diffs-marker-contrast: light-dark(#fff, #000);\n --diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));\n}\n\n@media (width >= 480px) {\n [data-content] {\n caret-color: transparent;\n }\n [data-content]:focus ~ [data-editor-overlay] [data-caret] {\n visibility: visible;\n }\n}\n\n/* Editor widgets\n *\n * Positioned popovers used across edit mode. Used by markers, search panel,\n * and selection action.\n */\n\n[data-editor-widget] {\n --diffs-widget-fg: var(--diffs-fg);\n --diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));\n --diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);\n --diffs-widget-shadow:\n inset 0 0 0 1px var(--diffs-bg), 0 4px 8px rgb(0 0 0 / 0.075),\n 0 6px 18px rgb(0 0 0 / 0.075);\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n width: fit-content;\n max-width: calc(100% - 24px);\n font: 14px/20px var(--diffs-header-font-fallback);\n border: 1px solid var(--diffs-widget-border);\n border-radius: 9px;\n background-color: var(--diffs-widget-bg);\n background-clip: padding-box;\n box-shadow: var(--diffs-widget-shadow);\n}\n\n/* Shared geometry for the overlay popovers (marker hover popover and\n selection-action popover). Both are positioned in overlay coordinate space via\n --popover-x/--popover-y (set in JS). The left edge is clamped so the popover\n never slides under the line-number gutter (--gutter-width, also set in JS) or\n outside the visible scroll viewport, and the width is capped to match. Builds\n on [data-editor-widget]. */\n[data-marker-popover],\n[data-selection-action-popover] {\n --popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));\n --popover-viewport-left: 0px;\n --popover-viewport-right: 100cqw;\n /* Sentinels disable the vertical clamp until JS sets the real scrollport. */\n --popover-viewport-top: -99999px;\n --popover-viewport-bottom: 99999px;\n --popover-min-left: calc(\n var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap)\n );\n --popover-available-width: max(\n 0px,\n calc(\n var(--popover-viewport-right) - var(--popover-min-left) -\n var(--popover-gap)\n )\n );\n max-width: min(640px, var(--popover-available-width));\n translate: clamp(\n var(--popover-min-left),\n var(--popover-x, var(--popover-min-left)),\n calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)\n )\n /* Clamp into the scrollport so a popover with no fitting side stays in view. */\n clamp(\n var(--popover-viewport-top),\n calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),\n calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%)\n );\n}\n\n[data-marker-popover] {\n --diffs-widget-bg: var(--diffs-marker-bg);\n --diffs-widget-shadow:\n 0 4px 8px rgb(0 0 0 / 0.15), 0 6px 18px rgb(0 0 0 / 0.15);\n\n padding: 8px 12px;\n min-width: min(180px, var(--popover-available-width));\n overflow-wrap: anywhere;\n color: var(--diffs-marker-contrast);\n white-space: normal;\n border: 0;\n pointer-events: auto;\n\n @supports (color: contrast-color(red)) {\n color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));\n }\n\n [data-marker-message] {\n white-space: normal;\n overflow-wrap: anywhere;\n\n code {\n display: inline;\n background-color: transparent;\n white-space: normal;\n color: inherit;\n }\n }\n}\n\n/* Selection Action Widget: a floating popover hosting the consumer's\n selection-action element. It reuses the shared [data-editor-widget] chrome and\n sits in the overlay layer (which is pointer-events: none), so it re-enables\n pointer events for its own actions. */\n[data-selection-action-popover] {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n align-items: center;\n width: max-content;\n padding: 4px;\n pointer-events: auto;\n}\n\n/* Search Panel Widget */\n[data-search-panel] {\n position: sticky;\n top: 16px;\n right: 16px;\n z-index: 100;\n display: flex;\n justify-content: right;\n flex-direction: column;\n width: 100%;\n /* Zero height ensures panel appears stickied immediately */\n height: 0;\n container: search-panel / inline-size;\n\n [data-editor-widget] {\n position: relative;\n z-index: 100;\n display: flex;\n flex-shrink: 0;\n align-items: stretch;\n gap: 8px;\n padding: 4px;\n max-width: 100%;\n min-width: 260px;\n margin-inline: auto 16px;\n }\n\n svg {\n display: block;\n fill: currentColor;\n width: 12px;\n height: 12px;\n }\n}\n\n[data-search-grid] {\n display: grid;\n grid-template-columns: auto auto auto;\n grid-template-areas:\n 'find matches nav'\n 'replace actions .';\n align-items: center;\n gap: 4px 6px;\n width: 100%;\n}\n[data-input-box][data-find] {\n grid-area: find;\n}\n[data-search-nav] {\n grid-area: nav;\n}\n[data-input-box][data-replace] {\n grid-area: replace;\n}\n[data-replace-actions] {\n grid-area: actions;\n}\n[data-search-grid][data-mode='find'] {\n grid-template-areas: 'find matches nav';\n}\n[data-search-grid][data-mode='find'] [data-replace-cell] {\n display: none;\n}\n\n@container search-panel (width < 400px) {\n [data-search-panel] [data-editor-widget] {\n padding: 10px;\n }\n [data-search-grid][data-mode='replace'] {\n grid-template-columns: auto 1fr auto;\n grid-template-areas:\n 'find find find'\n 'replace replace replace'\n 'nav matches actions';\n }\n [data-search-grid][data-mode='find'] {\n grid-template-columns: auto 1fr auto;\n grid-template-areas:\n 'find find find'\n 'nav matches matches';\n }\n [data-replace-actions] {\n justify-self: end;\n }\n [data-search-grid] [data-input-box] {\n width: auto;\n }\n}\n\n[data-input-box] {\n position: relative;\n display: flex;\n align-items: center;\n width: 200px;\n\n input {\n flex-grow: 1;\n width: 100%;\n min-width: 0;\n font-size: 13px;\n line-height: 24px;\n padding-inline: 6px;\n color: var(--diffs-fg);\n background-color: var(--diffs-bg);\n border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));\n border-radius: 6px;\n outline: none;\n\n &::selection {\n background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));\n }\n\n &:focus-visible {\n outline: 1px solid var(--diffs-modified-base);\n }\n }\n\n &[data-find] input {\n /* Space for overlaid search icon toggles */\n padding-inline-end: 72px;\n }\n\n [data-search-icon] {\n --diffs-search-icon-size: 20px;\n }\n}\n\n[data-search-toggles] {\n position: absolute;\n top: 50%;\n right: 4px;\n transform: translateY(-50%);\n display: flex;\n align-items: center;\n gap: 1px;\n}\n\n[data-matches] {\n grid-area: matches;\n flex-shrink: 0;\n min-width: 50px;\n font-size: 12px;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));\n\n &[data-no-matches] {\n color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));\n }\n}\n\n[data-replace-actions],\n[data-search-nav] {\n display: flex;\n align-items: center;\n}\n\n/* Every clickable control is a real <button> tagged with data-search-icon;\n strip the UA chrome here so this single rule is the source of their\n appearance. */\n[data-search-icon] {\n display: flex;\n align-items: center;\n justify-content: center;\n appearance: none;\n flex-shrink: 0;\n width: var(--diffs-search-icon-size, 24px);\n height: var(--diffs-search-icon-size, 24px);\n margin: 0;\n padding: 0;\n color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));\n border: 0;\n border-radius: var(--diffs-search-icon-radius, 4px);\n background: none;\n cursor: pointer;\n transition:\n background-color 0.1s ease-in-out,\n color 0.1s ease-in-out;\n\n &:disabled {\n opacity: 0.25;\n cursor: default;\n }\n &:not(:disabled):hover {\n color: var(--diffs-fg);\n }\n &:focus-visible {\n outline: 1px solid var(--diffs-modified-base);\n }\n &[aria-pressed='true'] {\n color: var(--diffs-modified-base);\n }\n}\n\n[data-search-close] {\n --diffs-search-icon-size: 20px;\n --diffs-search-icon-radius: 50%;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n color: var(--diffs-widget-bg);\n background-color: color-mix(\n in lab,\n var(--diffs-widget-fg) 50%,\n var(--diffs-bg)\n );\n\n &:not(:disabled):hover {\n opacity: 1;\n color: var(--diffs-widget-bg);\n background-color: var(--diffs-widget-fg);\n }\n}\n"],"mappings":";AAAA,IAAA,iBAAe"}
1
+ {"version":3,"file":"editor2.js","names":[],"sources":["../../src/editor/editor.css?inline"],"sourcesContent":["::selection {\n background-color: transparent;\n}\n\n/* Read-only deletion text sits outside the editor's selection overlay, so the\n global transparent ::selection above hides its selection by default. Reveal\n the native selection (so users can see what they select and copy) only while\n the user is actively selecting within deleted text: the editor sets\n data-deleted-text-selection on the diff while a pointer gesture starts there.\n Gating it this way means a normal selection of editable code that merely\n sweeps across an interleaved deleted line (unified view) does not highlight\n that line. Covers the whole deletions column in split view and individual\n deleted lines in unified view. */\n[data-deleted-text-selection] [data-deletions] ::selection,\n[data-deleted-text-selection] [data-line-type='change-deletion'] ::selection {\n background-color: var(--diffs-editor-selection-bg);\n}\n\n@keyframes blinking {\n 0% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n:host, /* for scroll anchor */\n[data-code], /* for editor overlay */\n[data-content] /* for wrap line measurement */,\n[data-diff-type='split'][data-overflow='wrap'] {\n position: relative;\n}\n[data-code] {\n container-type: inline-size;\n}\n[data-content] {\n cursor: text;\n background-color: transparent;\n caret-color: var(--diffs-bg-caret);\n outline: none;\n}\n[data-line] {\n cursor: text;\n /* Transparent so the line's in-flow background can't hide the selection\n overlay (z-index -10); the line color moves to the ::after layer below it. */\n background-color: transparent;\n}\n/* Line background layer below the selection overlay (z-index -10) so the\n translucent selection composites over it. ::before is the +/- indicator. */\n[data-line]::after {\n content: '';\n position: absolute;\n inset: 0;\n z-index: -20;\n background-color: var(--diffs-line-bg);\n pointer-events: none;\n}\n/* The line-state pipeline resolves the active background. Keep the theme's\n border as an additional cue, including for border-only themes. */\n[data-line][data-editor-active-line]::after {\n box-shadow: inset 0 0 0 1px var(--diffs-editor-line-highlight-border);\n}\n\n[data-editor-overlay] {\n display: contents;\n}\n[data-caret],\n[data-edit-prediction],\n[data-selection-range],\n[data-match-range],\n[data-bracket-match-range],\n[data-edit-prediction-deletion-range],\n[data-edit-prediction-insertion-range],\n[data-edit-prediction-replacement-range],\n[data-marker-range],\n[data-remote-caret],\n[data-caret-highlight-range] {\n position: absolute;\n top: 0;\n left: 0;\n height: 1lh;\n line-height: var(--diffs-line-height);\n pointer-events: none;\n}\n[data-edit-prediction] {\n z-index: 1;\n height: auto;\n overflow: visible;\n width: max-content;\n user-select: none;\n color: var(\n --diffs-editor-edit-prediction-fg,\n color-mix(in lab, var(--diffs-fg) 45%, transparent)\n );\n}\n[data-edit-prediction-line] {\n box-sizing: border-box;\n display: block;\n min-height: 1lh;\n width: max-content;\n white-space: pre;\n}\n[data-edit-prediction][data-replacement] [data-edit-prediction-line],\n[data-edit-prediction-insertion-range],\n[data-edit-prediction-replacement-range] {\n background-color: var(--diffs-edit-prediction-bg, var(--diffs-bg));\n}\n[data-edit-prediction-suffix] {\n color: var(--diffs-fg);\n}\n[data-edit-prediction][data-wrap] [data-edit-prediction-line] {\n max-width: 100%;\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n[data-edit-prediction-line][data-empty]::after {\n content: '↵';\n}\n[data-edit-prediction-spacer] {\n margin-block-end: var(--diffs-edit-prediction-spacer-height);\n}\n/* The deletions column of a split diff shows no ghost text, so its reserved\n rows are padding: the row tint and the buffer hatch extend over them instead\n of leaving a blank strip. Buffers size themselves with a border-box\n min-height that would absorb the padding, hence content-box. */\n[data-code][data-deletions] [data-edit-prediction-spacer] {\n margin-block-end: 0;\n padding-block-end: var(--diffs-edit-prediction-spacer-height);\n box-sizing: content-box;\n}\n[data-edit-prediction-deletion-range] {\n --diffs-edit-prediction-deletion-color: var(\n --diffs-editor-edit-prediction-deletion-fg,\n color-mix(in lab, var(--diffs-deletion-base) 70%, transparent)\n );\n\n z-index: 1;\n background: linear-gradient(\n to bottom,\n transparent calc(50% - 0.5px),\n var(--diffs-edit-prediction-deletion-color) calc(50% - 0.5px),\n var(--diffs-edit-prediction-deletion-color) calc(50% + 0.5px),\n transparent calc(50% + 0.5px)\n );\n}\n[data-edit-prediction-insertion-range] {\n z-index: 0;\n}\n[data-edit-prediction-replacement-range] {\n z-index: 1;\n}\n[data-caret] {\n z-index: 2;\n width: 2px;\n background-color: var(\n --diffs-bg-caret-override,\n var(\n --diffs-editor-cursor-fg,\n light-dark(\n color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg)),\n color-mix(in lab, var(--diffs-fg) 75%, var(--diffs-bg))\n )\n )\n );\n visibility: hidden;\n}\n/* Reduce motion only if user has set a preference */\n@media (prefers-reduced-motion: no-preference) {\n [data-caret] {\n animation: blinking 1.2s infinite;\n animation-delay: 0.8s;\n }\n}\n[data-selection-range] {\n z-index: -10;\n background-color: var(--diffs-editor-selection-bg);\n}\n[data-caret-highlight-range] {\n z-index: -10;\n background-color: var(\n --diffs-caret-highlight-bg,\n var(--diffs-editor-selection-bg)\n );\n}\n/* Masks the selection's square corner to fake rounding, so it must match the bg\n behind the selection: the line's diff color (passed in via\n --diffs-selection-corner-bg) or the editor base for context lines. */\n[data-selection-corner] {\n width: 100%;\n height: 100%;\n background-color: var(--diffs-selection-corner-bg, var(--diffs-bg));\n}\n[data-match-range] {\n z-index: -10;\n background-color: var(\n --diffs-editor-match-bg,\n var(--diffs-editor-selection-bg)\n );\n}\n[data-match-range]:not([data-focus]) {\n background-color: var(\n --diffs-editor-match-highlight-bg,\n light-dark(#ff963288, #ff963266)\n );\n}\n[data-bracket-match-range] {\n z-index: -9;\n box-sizing: border-box;\n border-bottom: 1px solid\n var(\n --diffs-editor-bracket-match-border,\n color-mix(in lab, var(--diffs-fg) 60%, transparent)\n );\n background-color: var(\n --diffs-editor-bracket-match-bg,\n color-mix(in lab, var(--diffs-fg) 5%, transparent)\n );\n}\n\n[data-rtl] {\n border-top-left-radius: 3px;\n}\n[data-rtr] {\n border-top-right-radius: 3px;\n}\n[data-rbl] {\n border-bottom-left-radius: 3px;\n}\n[data-rbr] {\n border-bottom-right-radius: 3px;\n}\n\n/* Markers\n *\n * Marker range applies a wavy underline. Severity attributes are used by both\n * `[data-marker-range]` and `[data-marker-popover]` alike.\n */\n\n[data-marker-range] {\n z-index: 1;\n background-color: var(--diffs-marker-bg);\n mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2IiBoZWlnaHQ9IjMiPjxwYXRoIGQ9Im0wIDIuNSBsMiAtMS41IGwxIDAgbDIgMS41IGwxIDAiIHN0cm9rZT0iI2ZmZiIgZmlsbD0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIi8+PC9zdmc+');\n mask-position: left bottom;\n mask-repeat: repeat-x;\n mask-size: 6px 3px;\n}\n\n[data-marker-error] {\n --diffs-marker-contrast: light-dark(#fff, #000);\n --diffs-marker-bg: var(--diffs-editor-error-fg, var(--diffs-deletion-base));\n}\n[data-marker-warning] {\n --diffs-marker-contrast: #000;\n --diffs-marker-bg: var(\n --diffs-editor-warning-fg,\n light-dark(var(--diffs-warning-light), var(--diffs-warning-dark))\n );\n}\n[data-marker-info] {\n --diffs-marker-contrast: #000;\n --diffs-marker-bg: var(--diffs-editor-info-fg, var(--diffs-modified-base));\n}\n[data-marker-hint] {\n --diffs-marker-contrast: light-dark(#fff, #000);\n --diffs-marker-bg: var(--diffs-editor-hint-fg, var(--diffs-fg-number));\n}\n\n@media (width >= 480px) {\n [data-content] {\n caret-color: transparent;\n }\n [data-content]:focus ~ [data-editor-overlay] [data-caret] {\n visibility: visible;\n }\n}\n\n/* Editor widgets\n *\n * Positioned popovers used across edit mode. Used by markers, search panel,\n * and selection action.\n */\n\n[data-editor-widget] {\n --diffs-widget-fg: var(--diffs-fg);\n --diffs-widget-bg: color-mix(in lab, var(--diffs-fg) 4%, var(--diffs-bg));\n --diffs-widget-border: color-mix(in lab, var(--diffs-fg) 20%, transparent);\n --diffs-widget-shadow:\n inset 0 0 0 1px var(--diffs-bg), 0 4px 8px rgb(0 0 0 / 0.075),\n 0 6px 18px rgb(0 0 0 / 0.075);\n position: absolute;\n top: 0;\n left: 0;\n z-index: 100;\n width: fit-content;\n max-width: calc(100% - 24px);\n font: 14px/20px var(--diffs-header-font-fallback);\n border: 1px solid var(--diffs-widget-border);\n border-radius: 9px;\n background-color: var(--diffs-widget-bg);\n background-clip: padding-box;\n box-shadow: var(--diffs-widget-shadow);\n}\n\n/* Shared geometry for the overlay popovers (marker hover popover and\n selection-action popover). Both are positioned in overlay coordinate space via\n --popover-x/--popover-y (set in JS). The left edge is clamped so the popover\n never slides under the line-number gutter (--gutter-width, also set in JS) or\n outside the visible scroll viewport, and the width is capped to match. Builds\n on [data-editor-widget]. */\n[data-marker-popover],\n[data-selection-action-popover] {\n --popover-gap: var(--diffs-popover-gap, var(--diffs-gap-fallback, 8px));\n --popover-viewport-left: 0px;\n --popover-viewport-right: 100cqw;\n /* Sentinels disable the vertical clamp until JS sets the real scrollport. */\n --popover-viewport-top: -99999px;\n --popover-viewport-bottom: 99999px;\n --popover-min-left: calc(\n var(--popover-viewport-left) + var(--gutter-width, 0px) + var(--popover-gap)\n );\n --popover-available-width: max(\n 0px,\n calc(\n var(--popover-viewport-right) - var(--popover-min-left) -\n var(--popover-gap)\n )\n );\n max-width: min(640px, var(--popover-available-width));\n translate: clamp(\n var(--popover-min-left),\n var(--popover-x, var(--popover-min-left)),\n calc(var(--popover-viewport-right) - var(--popover-gap) - 100%)\n )\n /* Clamp into the scrollport so a popover with no fitting side stays in view. */\n clamp(\n var(--popover-viewport-top),\n calc(var(--popover-y, 0px) + var(--popover-y-shift, 0px)),\n calc(var(--popover-viewport-bottom) - var(--popover-gap) - 100%)\n );\n}\n\n[data-marker-popover] {\n --diffs-widget-bg: var(--diffs-marker-bg);\n --diffs-widget-shadow:\n 0 4px 8px rgb(0 0 0 / 0.15), 0 6px 18px rgb(0 0 0 / 0.15);\n\n padding: 8px 12px;\n min-width: min(180px, var(--popover-available-width));\n overflow-wrap: anywhere;\n color: var(--diffs-marker-contrast);\n white-space: normal;\n border: 0;\n pointer-events: auto;\n\n @supports (color: contrast-color(red)) {\n color: contrast-color(var(--diffs-marker-bg, var(--diffs-bg)));\n }\n\n [data-marker-message] {\n white-space: normal;\n overflow-wrap: anywhere;\n\n code {\n display: inline;\n background-color: transparent;\n white-space: normal;\n color: inherit;\n }\n }\n}\n\n/* Selection Action Widget: a floating popover hosting the consumer's\n selection-action element. It reuses the shared [data-editor-widget] chrome and\n sits in the overlay layer (which is pointer-events: none), so it re-enables\n pointer events for its own actions. */\n[data-selection-action-popover] {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n align-items: center;\n width: max-content;\n padding: 4px;\n pointer-events: auto;\n}\n\n/* Search Panel Widget */\n[data-search-panel] {\n position: sticky;\n top: 16px;\n right: 16px;\n z-index: 100;\n display: flex;\n justify-content: right;\n flex-direction: column;\n width: 100%;\n /* Zero height ensures panel appears stickied immediately */\n height: 0;\n container: search-panel / inline-size;\n\n [data-editor-widget] {\n position: relative;\n z-index: 100;\n display: flex;\n flex-shrink: 0;\n align-items: stretch;\n gap: 8px;\n padding: 4px;\n max-width: 100%;\n min-width: 260px;\n margin-inline: auto 16px;\n }\n\n svg {\n display: block;\n fill: currentColor;\n width: 12px;\n height: 12px;\n }\n}\n\n[data-search-grid] {\n display: grid;\n grid-template-columns: auto auto auto auto;\n grid-template-areas:\n 'toggle find matches nav'\n '. replace actions .';\n align-items: center;\n gap: 4px 6px;\n width: 100%;\n}\n[data-input-box][data-find] {\n grid-area: find;\n}\n[data-search-nav] {\n grid-area: nav;\n}\n[data-input-box][data-replace] {\n grid-area: replace;\n}\n[data-replace-actions] {\n grid-area: actions;\n}\n[data-search-grid][data-mode='find'] {\n grid-template-areas: 'toggle find matches nav';\n}\n[data-search-grid][data-mode='find'] [data-replace-cell] {\n display: none;\n}\n\n@container search-panel (width < 400px) {\n [data-search-panel] [data-editor-widget] {\n padding: 10px;\n }\n [data-search-grid][data-mode='replace'] {\n grid-template-columns: auto auto 1fr auto;\n grid-template-areas:\n 'toggle find find find'\n '. replace replace replace'\n '. nav matches actions';\n }\n [data-search-grid][data-mode='find'] {\n grid-template-columns: auto auto 1fr auto;\n grid-template-areas:\n 'toggle find find find'\n '. nav matches matches';\n }\n [data-replace-actions] {\n justify-self: end;\n }\n [data-search-grid] [data-input-box] {\n width: auto;\n }\n}\n\n[data-input-box] {\n position: relative;\n display: flex;\n align-items: center;\n width: 200px;\n\n input {\n flex-grow: 1;\n width: 100%;\n min-width: 0;\n font-size: 13px;\n line-height: 24px;\n padding-inline: 6px;\n color: var(--diffs-fg);\n background-color: var(--diffs-bg);\n border: 1px solid color-mix(in lab, var(--diffs-fg) 12%, var(--diffs-bg));\n border-radius: 6px;\n outline: none;\n\n &::selection {\n background-color: color-mix(in lab, var(--diffs-fg) 8%, var(--diffs-bg));\n }\n\n &:focus-visible {\n outline: 1px solid var(--diffs-modified-base);\n }\n }\n\n &[data-find] input {\n /* Space for overlaid search icon toggles */\n padding-inline-end: 72px;\n }\n\n [data-search-icon] {\n --diffs-search-icon-size: 20px;\n }\n}\n\n[data-search-toggles] {\n position: absolute;\n top: 50%;\n right: 4px;\n transform: translateY(-50%);\n display: flex;\n align-items: center;\n gap: 1px;\n}\n\n[data-matches] {\n grid-area: matches;\n flex-shrink: 0;\n min-width: 50px;\n font-size: 12px;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n color: color-mix(in lab, var(--diffs-fg) 50%, var(--diffs-bg));\n\n &[data-no-matches] {\n color: color-mix(in lab, var(--diffs-fg) 35%, var(--diffs-bg));\n }\n}\n\n[data-replace-actions],\n[data-search-nav] {\n display: flex;\n align-items: center;\n}\n\n/* Every clickable control is a real <button> tagged with data-search-icon;\n strip the UA chrome here so this single rule is the source of their\n appearance. */\n[data-search-icon] {\n display: flex;\n align-items: center;\n justify-content: center;\n appearance: none;\n flex-shrink: 0;\n width: var(--diffs-search-icon-size, 24px);\n height: var(--diffs-search-icon-size, 24px);\n margin: 0;\n padding: 0;\n color: color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg));\n border: 0;\n border-radius: var(--diffs-search-icon-radius, 4px);\n background: none;\n cursor: pointer;\n transition:\n background-color 0.1s ease-in-out,\n color 0.1s ease-in-out;\n\n &:disabled {\n opacity: 0.25;\n cursor: default;\n }\n &:not(:disabled):hover {\n color: var(--diffs-fg);\n }\n &:focus-visible {\n outline: 1px solid var(--diffs-modified-base);\n }\n &[aria-pressed='true'] {\n color: var(--diffs-modified-base);\n }\n}\n\n[data-replace-toggle] {\n --diffs-search-icon-size: 16px;\n grid-area: toggle;\n align-self: stretch;\n height: auto;\n\n &[aria-expanded='false'] svg {\n transform: rotate(-90deg);\n }\n}\n\n[data-search-close] {\n --diffs-search-icon-size: 20px;\n --diffs-search-icon-radius: 50%;\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n color: var(--diffs-widget-bg);\n background-color: color-mix(\n in lab,\n var(--diffs-widget-fg) 50%,\n var(--diffs-bg)\n );\n\n &:not(:disabled):hover {\n opacity: 1;\n color: var(--diffs-widget-bg);\n background-color: var(--diffs-widget-fg);\n }\n}\n"],"mappings":";AAAA,IAAA,iBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"searchPanel.d.ts","names":[],"sources":["../../src/editor/searchPanel.ts"],"mappings":";;;KAQY,cAAc,qBAAqB;KAEnC;UAEK;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf,cAAc;EACd,kBAAkB;EAClB;EACA,OAAO;EACP,eAAe;EACf,gBAAgB,WAAW,YAAY;EACvC,eAAe,OAAO;EACtB,WACE,SAAS,cACT;IAAY;QACT;EACL;;cAGW;;EAQX,YAAY,SAAS;EAiZrB;EAIA,SAAS;EAIT,cAAc;IAAY;;EAI1B,QAAQ,MAAM;EAOd;EAOA"}
1
+ {"version":3,"file":"searchPanel.d.ts","names":[],"sources":["../../src/editor/searchPanel.ts"],"mappings":";;;KAQY,cAAc,qBAAqB;KAEnC;UAEK;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf,cAAc;EACd,kBAAkB;EAClB;EACA,OAAO;EACP,eAAe;EACf,gBAAgB,WAAW,YAAY;EACvC,eAAe,OAAO;EACtB,WACE,SAAS,cACT;IAAY;QACT;EACL;;cAGW;;EAQX,YAAY,SAAS;EAuarB;EAIA,SAAS;EAIT,cAAc;IAAY;;EAI1B,QAAQ,MAAM;EAOd;EAOA"}
@@ -263,12 +263,26 @@ var SearchPanelWidget = class {
263
263
  onClick: close,
264
264
  dataset: { searchClose: "" }
265
265
  });
266
+ const replaceToggleElement = iconButton({
267
+ icon: "chevron",
268
+ label: "Toggle Replace",
269
+ dataset: { replaceToggle: "" },
270
+ onClick: () => {
271
+ if (gridElement.dataset.mode === "replace") applyMode("find");
272
+ else {
273
+ applyMode("replace");
274
+ replaceInputElement.focus();
275
+ }
276
+ }
277
+ });
278
+ replaceToggleElement.ariaExpanded = String(mode === "replace");
266
279
  const gridElement = h("div", {
267
280
  dataset: {
268
281
  searchGrid: "",
269
282
  mode
270
283
  },
271
284
  children: [
285
+ replaceToggleElement,
272
286
  findInputBox,
273
287
  replaceInputBox,
274
288
  replaceActionsElement,
@@ -279,6 +293,7 @@ var SearchPanelWidget = class {
279
293
  });
280
294
  const applyMode = (next) => {
281
295
  gridElement.dataset.mode = next;
296
+ replaceToggleElement.ariaExpanded = String(next === "replace");
282
297
  this.#inputElement.focus();
283
298
  this.#inputElement.select();
284
299
  };
@@ -1 +1 @@
1
- {"version":3,"file":"searchPanel.js","names":[],"sources":["../../src/editor/searchPanel.ts"],"sourcesContent":["import { resolveFindAgainShortcut } from './command';\nimport { buildSearchReplacementText } from './pieceTable';\nimport { isPrimaryModifier } from './platform';\nimport { getEditorIconSvg, type SVGSpriteNames } from './sprite';\nimport type { TextDocument } from './textDocument';\nimport type { ResolvedTextEdit } from './types';\nimport { h } from './utils';\n\nexport type MatchRange = [startOffset: number, endOffset: number];\n\nexport type SearchPanelMode = 'find' | 'replace';\n\nexport interface SearchParams {\n text: string;\n replaceText: string;\n caseSensitive: boolean;\n wholeWord: boolean;\n regex: boolean;\n}\n\nexport interface SearchPanelOptions {\n textDocument: TextDocument;\n containerElement: HTMLElement;\n defaultQuery: string;\n mode?: SearchPanelMode;\n initialMatch?: MatchRange;\n scrollToMatch: (nextMatch: MatchRange, retainFocus: boolean) => void;\n applyReplace: (edits: ResolvedTextEdit[]) => void;\n onUpdate: (\n matches: MatchRange[],\n options?: { syncSelection?: boolean }\n ) => MatchRange | undefined;\n onClose: () => void;\n}\n\nexport class SearchPanelWidget {\n #container: HTMLDivElement;\n #inputElement: HTMLInputElement;\n #updateMatches?: (options?: { syncSelection?: boolean }) => void;\n #applyMode?: (mode: SearchPanelMode) => void;\n #navigate?: (findPrevious: boolean) => void;\n #close?: () => void;\n\n constructor(options: SearchPanelOptions) {\n const {\n textDocument,\n containerElement,\n defaultQuery,\n mode = 'find',\n initialMatch,\n scrollToMatch,\n applyReplace,\n onUpdate,\n onClose,\n } = options;\n\n const searchParams: SearchParams = {\n text: defaultQuery,\n replaceText: '',\n caseSensitive: false,\n wholeWord: false,\n regex: false,\n };\n\n const matches = {\n all: [] as MatchRange[],\n current: undefined as MatchRange | undefined,\n };\n\n // Default to the empty-query \"no results\" state so it shows on open before\n // any search runs.\n const matchResultElement = h('div', {\n dataset: { matches: '', noMatches: '' },\n textContent: 'No results',\n });\n const updateMatches = (options?: { syncSelection?: boolean }) => {\n matches.all =\n searchParams.text !== '' ? textDocument.search(searchParams) : [];\n const noMatches = matches.all.length === 0;\n prevButton.disabled = noMatches;\n nextButton.disabled = noMatches;\n\n // An empty query and a query with zero hits are the same \"no results\"\n // state. Both push an empty match set through onUpdate so the editor\n // drops #matches and clears the painted highlights.\n if (noMatches) {\n matchResultElement.textContent = 'No results';\n matchResultElement.dataset.noMatches = '';\n matches.current = undefined;\n onUpdate([]);\n return;\n }\n\n delete matchResultElement.dataset.noMatches;\n if (options?.syncSelection === false) {\n const currentMatch = onUpdate(matches.all, { syncSelection: false });\n updateCurrentMatch(currentMatch);\n return;\n }\n\n updateCurrentMatch(onUpdate(matches.all));\n };\n this.#updateMatches = updateMatches;\n\n const updateCurrentMatch = (currentMatch: MatchRange | undefined) => {\n if (currentMatch === undefined) {\n matchResultElement.textContent = `${matches.all.length} results`;\n } else {\n const [start, end] = currentMatch;\n const index = matches.all.findIndex(\n (m) => m[0] === start && m[1] === end\n );\n matchResultElement.textContent = `${index + 1} of ${matches.all.length}`;\n }\n matches.current = currentMatch;\n };\n\n const updateSearchParam = <K extends keyof SearchParams>(\n key: K,\n value: SearchParams[K]\n ) => {\n searchParams[key] = value;\n updateMatches();\n };\n\n const findNextMatch = (\n findPrevious: boolean = false,\n retainFocus: boolean = false\n ) => {\n const allMatches = matches.all;\n let nextMatch: MatchRange | undefined = allMatches[0];\n if (allMatches.length > 0) {\n if (findPrevious) {\n const searchOffset = matches.current?.[0] ?? 0;\n nextMatch = allMatches.at(-1);\n for (const m of allMatches) {\n if (m[1] <= searchOffset) {\n nextMatch = m;\n } else {\n break;\n }\n }\n } else {\n const searchOffset = matches.current?.[1] ?? 0;\n for (const m of allMatches) {\n if (m[0] >= searchOffset) {\n nextMatch = m;\n break;\n }\n }\n }\n }\n if (nextMatch !== undefined) {\n updateCurrentMatch(nextMatch);\n scrollToMatch(nextMatch, retainFocus);\n }\n matches.current = nextMatch;\n };\n // Keep focus in the panel when stepping through matches from the inputs.\n this.#navigate = (findPrevious: boolean) =>\n findNextMatch(findPrevious, true);\n\n const buildReplacementEdit = (\n matchStart: number,\n matchEnd: number\n ): ResolvedTextEdit => ({\n start: matchStart,\n end: matchEnd,\n text: buildSearchReplacementText(\n (offset) => textDocument.positionAt(offset),\n (position) => textDocument.offsetAt(position),\n (line) => textDocument.getLineText(line),\n searchParams,\n matchStart,\n matchEnd\n ),\n });\n\n const replace = () => {\n if (searchParams.text === '' || matches.all.length === 0) {\n return;\n }\n\n let currentMatch = matches.current;\n if (currentMatch === undefined) {\n findNextMatch(false, true);\n currentMatch = matches.current;\n if (currentMatch === undefined) {\n return;\n }\n }\n\n const [start, end] = currentMatch;\n const edit = buildReplacementEdit(start, end);\n applyReplace([edit]);\n\n // Collapse after the replacement so the next search pass advances.\n scrollToMatch([start + edit.text.length, start + edit.text.length], true);\n matches.current = undefined;\n updateMatches();\n };\n\n const replaceAll = () => {\n if (searchParams.text === '' || matches.all.length === 0) {\n return;\n }\n\n applyReplace(\n matches.all.map(([start, end]) => buildReplacementEdit(start, end))\n );\n matches.current = undefined;\n updateMatches();\n };\n\n const close = () => {\n this.cleanup();\n onClose();\n };\n this.#close = close;\n\n // Shared builder for the panel's icon controls. Every clickable control is a\n // real <button> so it gets focus, keyboard activation, and native disabled\n // handling for free; `getEditorIconSvg` marks the glyph aria-hidden, so the\n // accessible name comes from `label` (also used as the hover title).\n const iconButton = (opts: {\n icon: SVGSpriteNames;\n label: string;\n size?: number;\n dataset?: Record<string, string>;\n onClick: () => void;\n }) =>\n h('button', {\n type: 'button',\n title: opts.label,\n ariaLabel: opts.label,\n dataset: { searchIcon: '', ...opts.dataset },\n innerHTML: getEditorIconSvg(opts.icon, opts.size ?? 16),\n onclick: opts.onClick,\n });\n\n // Builds an always-visible icon button that toggles one boolean search\n // option (case/whole-word/regex). The button reflects its on/off state via\n // `aria-pressed` so the stylesheet can highlight it and assistive tech can\n // announce it.\n const makeToggle = (\n icon: SVGSpriteNames,\n title: string,\n key: 'caseSensitive' | 'wholeWord' | 'regex'\n ) => {\n const button = iconButton({\n icon,\n label: title,\n size: 14,\n onClick: () => {\n const next = !searchParams[key];\n button.ariaPressed = String(next);\n updateSearchParam(key, next);\n },\n });\n button.ariaPressed = String(searchParams[key]);\n return button;\n };\n\n const caseSensitiveToggle = makeToggle(\n 'case',\n 'Match Case',\n 'caseSensitive'\n );\n const wholeWordToggle = makeToggle('whole-word', 'Whole Word', 'wholeWord');\n const regexToggle = makeToggle('regex', 'Regexp', 'regex');\n\n const replaceInputElement = h('input', {\n type: 'text',\n placeholder: 'Replace',\n dataset: 'replace',\n value: '',\n oninput: (e: Event) => {\n searchParams.replaceText = (e.target as HTMLInputElement).value;\n },\n onkeydown: (e: KeyboardEvent) => {\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n const findAgain = resolveFindAgainShortcut(e);\n if (e.key === 'Escape') {\n e.preventDefault();\n close();\n } else if (e.key === 'Enter') {\n e.preventDefault();\n replace();\n } else if (findAgain !== undefined) {\n e.preventDefault();\n findNextMatch(findAgain === 'previous', true);\n }\n },\n });\n\n this.#inputElement = h('input', {\n type: 'text',\n placeholder: 'Search',\n dataset: 'search',\n value: defaultQuery,\n oninput: (e: Event) => {\n searchParams.text = (e.target as HTMLInputElement).value;\n matches.current = undefined;\n updateMatches();\n },\n onkeydown: (e: KeyboardEvent) => {\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n const findAgain = resolveFindAgainShortcut(e);\n if (e.key === 'Escape') {\n e.preventDefault();\n close();\n } else if (e.key === 'Enter') {\n e.preventDefault();\n findNextMatch(e.shiftKey, true);\n } else if (findAgain !== undefined) {\n // Override the native browser find-again shortcut so cmd+g steps to\n // the next match and cmd+shift+g to the previous one.\n e.preventDefault();\n findNextMatch(findAgain === 'previous', true);\n } else if (\n isPrimaryModifier(e) &&\n (e.key === 'f' || e.code === 'KeyF')\n ) {\n // Prevent the default browser search panel and switch the panel mode\n // in place (cmd+f -> find, cmd+opt+f -> find/replace).\n e.preventDefault();\n applyMode(e.altKey ? 'replace' : 'find');\n }\n },\n });\n\n // The three search-option toggles are overlaid on the right edge of the\n // find input instead of sitting beside it.\n const searchTogglesElement = h('div', {\n dataset: 'searchToggles',\n children: [caseSensitiveToggle, wholeWordToggle, regexToggle],\n });\n\n const findInputBox = h('div', {\n dataset: { inputBox: '', find: '' },\n children: [this.#inputElement, searchTogglesElement],\n });\n\n // The replace input and its action buttons are tagged as replace cells so\n // they can be hidden together when the panel is in find-only mode.\n const replaceInputBox = h('div', {\n dataset: { inputBox: '', replace: '', replaceCell: '' },\n children: [replaceInputElement],\n });\n\n const replaceActionsElement = h('div', {\n dataset: { replaceActions: '', replaceCell: '' },\n children: [\n iconButton({ icon: 'replace', label: 'Replace', onClick: replace }),\n iconButton({\n icon: 'replace-all',\n label: 'Replace All',\n onClick: replaceAll,\n }),\n ],\n });\n\n // Held so the no-results state can toggle their native disabled flag.\n const prevButton = iconButton({\n icon: 'arrow-up',\n label: 'Previous',\n onClick: () => {\n findNextMatch(true);\n },\n });\n const nextButton = iconButton({\n icon: 'arrow-down',\n label: 'Next',\n onClick: () => {\n findNextMatch();\n },\n });\n prevButton.disabled = true;\n nextButton.disabled = true;\n\n const navElement = h('div', {\n dataset: 'searchNav',\n children: [prevButton, nextButton],\n });\n\n const closeElement = iconButton({\n icon: 'close',\n label: 'Close',\n onClick: close,\n dataset: { searchClose: '' },\n });\n\n // Cells are positioned by CSS grid-template-areas (see editor.css), so DOM\n // order here only drives tab/reading order, not layout. Keep the replace\n // input directly after the find input (and its toggles) so Tab walks\n // find -> replace before reaching the nav arrows and close button.\n const gridElement = h('div', {\n dataset: { searchGrid: '', mode },\n children: [\n findInputBox,\n replaceInputBox,\n replaceActionsElement,\n matchResultElement,\n navElement,\n closeElement,\n ],\n });\n\n // Toggles the panel between find and find/replace modes by showing or\n // hiding the replace cells, then returns focus to the find input.\n const applyMode = (next: SearchPanelMode) => {\n gridElement.dataset.mode = next;\n this.#inputElement.focus();\n this.#inputElement.select();\n };\n this.#applyMode = applyMode;\n\n this.#container = h('div', {\n dataset: 'searchPanel',\n children: [\n h('div', {\n dataset: 'editorWidget',\n children: [gridElement],\n }),\n ],\n });\n\n matches.current = initialMatch;\n containerElement.before(this.#container);\n\n requestAnimationFrame(() => {\n if (initialMatch !== undefined) {\n updateMatches();\n } else {\n onUpdate([]);\n }\n this.#inputElement.select();\n });\n }\n\n focus(): void {\n this.#inputElement.focus();\n }\n\n navigate(findPrevious: boolean): void {\n this.#navigate?.(findPrevious);\n }\n\n updateMatches(options?: { syncSelection?: boolean }): void {\n this.#updateMatches?.(options);\n }\n\n setMode(mode: SearchPanelMode): void {\n this.#applyMode?.(mode);\n }\n\n // Tears the panel down the way the close button and Escape-in-input do:\n // removes the DOM and runs onClose so the editor clears its match highlights.\n // Prefer this over cleanup() for any user-initiated dismissal.\n close(): void {\n this.#close?.();\n }\n\n // DOM-only teardown. Does NOT run onClose, so it leaves the editor's match\n // highlights in place; only use it when the caller clears that state itself\n // (e.g. a full editor reset). User-initiated dismissals should call close().\n cleanup(): void {\n this.#container.remove();\n }\n}\n"],"mappings":";;;;;;AAmCA,IAAa,oBAAb,MAA+B;CAC7B;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA6B;EACvC,MAAM,EACJ,cACA,kBACA,cACA,OAAO,QACP,cACA,eACA,cACA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c,IAAI;GACpB;EACF,CAAC;EACD,MAAM,aAAa,WAAW;GAC5B,MAAM;GACN,OAAO;GACP,eAAe;IACb,cAAc;GAChB;EACF,CAAC;EACD,WAAW,WAAW;EACtB,WAAW,WAAW;EAEtB,MAAM,aAAa,EAAE,OAAO;GAC1B,SAAS;GACT,UAAU,CAAC,YAAY,UAAU;EACnC,CAAC;EAED,MAAM,eAAe,WAAW;GAC9B,MAAM;GACN,OAAO;GACP,SAAS;GACT,SAAS,EAAE,aAAa,GAAG;EAC7B,CAAC;EAMD,MAAM,cAAc,EAAE,OAAO;GAC3B,SAAS;IAAE,YAAY;IAAI;GAAK;GAChC,UAAU;IACR;IACA;IACA;IACA;IACA;IACA;GACF;EACF,CAAC;EAID,MAAM,aAAa,SAA0B;GAC3C,YAAY,QAAQ,OAAO;GAC3B,KAAK,cAAc,MAAM;GACzB,KAAK,cAAc,OAAO;EAC5B;EACA,KAAK,aAAa;EAElB,KAAK,aAAa,EAAE,OAAO;GACzB,SAAS;GACT,UAAU,CACR,EAAE,OAAO;IACP,SAAS;IACT,UAAU,CAAC,WAAW;GACxB,CAAC,CACH;EACF,CAAC;EAED,QAAQ,UAAU;EAClB,iBAAiB,OAAO,KAAK,UAAU;EAEvC,4BAA4B;GAC1B,IAAI,iBAAiB,KAAA,GACnB,cAAc;QAEd,SAAS,CAAC,CAAC;GAEb,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH;CAEA,QAAc;EACZ,KAAK,cAAc,MAAM;CAC3B;CAEA,SAAS,cAA6B;EACpC,KAAK,YAAY,YAAY;CAC/B;CAEA,cAAc,SAA6C;EACzD,KAAK,iBAAiB,OAAO;CAC/B;CAEA,QAAQ,MAA6B;EACnC,KAAK,aAAa,IAAI;CACxB;CAKA,QAAc;EACZ,KAAK,SAAS;CAChB;CAKA,UAAgB;EACd,KAAK,WAAW,OAAO;CACzB;AACF"}
1
+ {"version":3,"file":"searchPanel.js","names":[],"sources":["../../src/editor/searchPanel.ts"],"sourcesContent":["import { resolveFindAgainShortcut } from './command';\nimport { buildSearchReplacementText } from './pieceTable';\nimport { isPrimaryModifier } from './platform';\nimport { getEditorIconSvg, type SVGSpriteNames } from './sprite';\nimport type { TextDocument } from './textDocument';\nimport type { ResolvedTextEdit } from './types';\nimport { h } from './utils';\n\nexport type MatchRange = [startOffset: number, endOffset: number];\n\nexport type SearchPanelMode = 'find' | 'replace';\n\nexport interface SearchParams {\n text: string;\n replaceText: string;\n caseSensitive: boolean;\n wholeWord: boolean;\n regex: boolean;\n}\n\nexport interface SearchPanelOptions {\n textDocument: TextDocument;\n containerElement: HTMLElement;\n defaultQuery: string;\n mode?: SearchPanelMode;\n initialMatch?: MatchRange;\n scrollToMatch: (nextMatch: MatchRange, retainFocus: boolean) => void;\n applyReplace: (edits: ResolvedTextEdit[]) => void;\n onUpdate: (\n matches: MatchRange[],\n options?: { syncSelection?: boolean }\n ) => MatchRange | undefined;\n onClose: () => void;\n}\n\nexport class SearchPanelWidget {\n #container: HTMLDivElement;\n #inputElement: HTMLInputElement;\n #updateMatches?: (options?: { syncSelection?: boolean }) => void;\n #applyMode?: (mode: SearchPanelMode) => void;\n #navigate?: (findPrevious: boolean) => void;\n #close?: () => void;\n\n constructor(options: SearchPanelOptions) {\n const {\n textDocument,\n containerElement,\n defaultQuery,\n mode = 'find',\n initialMatch,\n scrollToMatch,\n applyReplace,\n onUpdate,\n onClose,\n } = options;\n\n const searchParams: SearchParams = {\n text: defaultQuery,\n replaceText: '',\n caseSensitive: false,\n wholeWord: false,\n regex: false,\n };\n\n const matches = {\n all: [] as MatchRange[],\n current: undefined as MatchRange | undefined,\n };\n\n // Default to the empty-query \"no results\" state so it shows on open before\n // any search runs.\n const matchResultElement = h('div', {\n dataset: { matches: '', noMatches: '' },\n textContent: 'No results',\n });\n const updateMatches = (options?: { syncSelection?: boolean }) => {\n matches.all =\n searchParams.text !== '' ? textDocument.search(searchParams) : [];\n const noMatches = matches.all.length === 0;\n prevButton.disabled = noMatches;\n nextButton.disabled = noMatches;\n\n // An empty query and a query with zero hits are the same \"no results\"\n // state. Both push an empty match set through onUpdate so the editor\n // drops #matches and clears the painted highlights.\n if (noMatches) {\n matchResultElement.textContent = 'No results';\n matchResultElement.dataset.noMatches = '';\n matches.current = undefined;\n onUpdate([]);\n return;\n }\n\n delete matchResultElement.dataset.noMatches;\n if (options?.syncSelection === false) {\n const currentMatch = onUpdate(matches.all, { syncSelection: false });\n updateCurrentMatch(currentMatch);\n return;\n }\n\n updateCurrentMatch(onUpdate(matches.all));\n };\n this.#updateMatches = updateMatches;\n\n const updateCurrentMatch = (currentMatch: MatchRange | undefined) => {\n if (currentMatch === undefined) {\n matchResultElement.textContent = `${matches.all.length} results`;\n } else {\n const [start, end] = currentMatch;\n const index = matches.all.findIndex(\n (m) => m[0] === start && m[1] === end\n );\n matchResultElement.textContent = `${index + 1} of ${matches.all.length}`;\n }\n matches.current = currentMatch;\n };\n\n const updateSearchParam = <K extends keyof SearchParams>(\n key: K,\n value: SearchParams[K]\n ) => {\n searchParams[key] = value;\n updateMatches();\n };\n\n const findNextMatch = (\n findPrevious: boolean = false,\n retainFocus: boolean = false\n ) => {\n const allMatches = matches.all;\n let nextMatch: MatchRange | undefined = allMatches[0];\n if (allMatches.length > 0) {\n if (findPrevious) {\n const searchOffset = matches.current?.[0] ?? 0;\n nextMatch = allMatches.at(-1);\n for (const m of allMatches) {\n if (m[1] <= searchOffset) {\n nextMatch = m;\n } else {\n break;\n }\n }\n } else {\n const searchOffset = matches.current?.[1] ?? 0;\n for (const m of allMatches) {\n if (m[0] >= searchOffset) {\n nextMatch = m;\n break;\n }\n }\n }\n }\n if (nextMatch !== undefined) {\n updateCurrentMatch(nextMatch);\n scrollToMatch(nextMatch, retainFocus);\n }\n matches.current = nextMatch;\n };\n // Keep focus in the panel when stepping through matches from the inputs.\n this.#navigate = (findPrevious: boolean) =>\n findNextMatch(findPrevious, true);\n\n const buildReplacementEdit = (\n matchStart: number,\n matchEnd: number\n ): ResolvedTextEdit => ({\n start: matchStart,\n end: matchEnd,\n text: buildSearchReplacementText(\n (offset) => textDocument.positionAt(offset),\n (position) => textDocument.offsetAt(position),\n (line) => textDocument.getLineText(line),\n searchParams,\n matchStart,\n matchEnd\n ),\n });\n\n const replace = () => {\n if (searchParams.text === '' || matches.all.length === 0) {\n return;\n }\n\n let currentMatch = matches.current;\n if (currentMatch === undefined) {\n findNextMatch(false, true);\n currentMatch = matches.current;\n if (currentMatch === undefined) {\n return;\n }\n }\n\n const [start, end] = currentMatch;\n const edit = buildReplacementEdit(start, end);\n applyReplace([edit]);\n\n // Collapse after the replacement so the next search pass advances.\n scrollToMatch([start + edit.text.length, start + edit.text.length], true);\n matches.current = undefined;\n updateMatches();\n };\n\n const replaceAll = () => {\n if (searchParams.text === '' || matches.all.length === 0) {\n return;\n }\n\n applyReplace(\n matches.all.map(([start, end]) => buildReplacementEdit(start, end))\n );\n matches.current = undefined;\n updateMatches();\n };\n\n const close = () => {\n this.cleanup();\n onClose();\n };\n this.#close = close;\n\n // Shared builder for the panel's icon controls. Every clickable control is a\n // real <button> so it gets focus, keyboard activation, and native disabled\n // handling for free; `getEditorIconSvg` marks the glyph aria-hidden, so the\n // accessible name comes from `label` (also used as the hover title).\n const iconButton = (opts: {\n icon: SVGSpriteNames;\n label: string;\n size?: number;\n dataset?: Record<string, string>;\n onClick: () => void;\n }) =>\n h('button', {\n type: 'button',\n title: opts.label,\n ariaLabel: opts.label,\n dataset: { searchIcon: '', ...opts.dataset },\n innerHTML: getEditorIconSvg(opts.icon, opts.size ?? 16),\n onclick: opts.onClick,\n });\n\n // Builds an always-visible icon button that toggles one boolean search\n // option (case/whole-word/regex). The button reflects its on/off state via\n // `aria-pressed` so the stylesheet can highlight it and assistive tech can\n // announce it.\n const makeToggle = (\n icon: SVGSpriteNames,\n title: string,\n key: 'caseSensitive' | 'wholeWord' | 'regex'\n ) => {\n const button = iconButton({\n icon,\n label: title,\n size: 14,\n onClick: () => {\n const next = !searchParams[key];\n button.ariaPressed = String(next);\n updateSearchParam(key, next);\n },\n });\n button.ariaPressed = String(searchParams[key]);\n return button;\n };\n\n const caseSensitiveToggle = makeToggle(\n 'case',\n 'Match Case',\n 'caseSensitive'\n );\n const wholeWordToggle = makeToggle('whole-word', 'Whole Word', 'wholeWord');\n const regexToggle = makeToggle('regex', 'Regexp', 'regex');\n\n const replaceInputElement = h('input', {\n type: 'text',\n placeholder: 'Replace',\n dataset: 'replace',\n value: '',\n oninput: (e: Event) => {\n searchParams.replaceText = (e.target as HTMLInputElement).value;\n },\n onkeydown: (e: KeyboardEvent) => {\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n const findAgain = resolveFindAgainShortcut(e);\n if (e.key === 'Escape') {\n e.preventDefault();\n close();\n } else if (e.key === 'Enter') {\n e.preventDefault();\n replace();\n } else if (findAgain !== undefined) {\n e.preventDefault();\n findNextMatch(findAgain === 'previous', true);\n }\n },\n });\n\n this.#inputElement = h('input', {\n type: 'text',\n placeholder: 'Search',\n dataset: 'search',\n value: defaultQuery,\n oninput: (e: Event) => {\n searchParams.text = (e.target as HTMLInputElement).value;\n matches.current = undefined;\n updateMatches();\n },\n onkeydown: (e: KeyboardEvent) => {\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n const findAgain = resolveFindAgainShortcut(e);\n if (e.key === 'Escape') {\n e.preventDefault();\n close();\n } else if (e.key === 'Enter') {\n e.preventDefault();\n findNextMatch(e.shiftKey, true);\n } else if (findAgain !== undefined) {\n // Override the native browser find-again shortcut so cmd+g steps to\n // the next match and cmd+shift+g to the previous one.\n e.preventDefault();\n findNextMatch(findAgain === 'previous', true);\n } else if (\n isPrimaryModifier(e) &&\n (e.key === 'f' || e.code === 'KeyF')\n ) {\n // Prevent the default browser search panel and switch the panel mode\n // in place (cmd+f -> find, cmd+opt+f -> find/replace).\n e.preventDefault();\n applyMode(e.altKey ? 'replace' : 'find');\n }\n },\n });\n\n // The three search-option toggles are overlaid on the right edge of the\n // find input instead of sitting beside it.\n const searchTogglesElement = h('div', {\n dataset: 'searchToggles',\n children: [caseSensitiveToggle, wholeWordToggle, regexToggle],\n });\n\n const findInputBox = h('div', {\n dataset: { inputBox: '', find: '' },\n children: [this.#inputElement, searchTogglesElement],\n });\n\n // The replace input and its action buttons are tagged as replace cells so\n // they can be hidden together when the panel is in find-only mode.\n const replaceInputBox = h('div', {\n dataset: { inputBox: '', replace: '', replaceCell: '' },\n children: [replaceInputElement],\n });\n\n const replaceActionsElement = h('div', {\n dataset: { replaceActions: '', replaceCell: '' },\n children: [\n iconButton({ icon: 'replace', label: 'Replace', onClick: replace }),\n iconButton({\n icon: 'replace-all',\n label: 'Replace All',\n onClick: replaceAll,\n }),\n ],\n });\n\n // Held so the no-results state can toggle their native disabled flag.\n const prevButton = iconButton({\n icon: 'arrow-up',\n label: 'Previous',\n onClick: () => {\n findNextMatch(true);\n },\n });\n const nextButton = iconButton({\n icon: 'arrow-down',\n label: 'Next',\n onClick: () => {\n findNextMatch();\n },\n });\n prevButton.disabled = true;\n nextButton.disabled = true;\n\n const navElement = h('div', {\n dataset: 'searchNav',\n children: [prevButton, nextButton],\n });\n\n const closeElement = iconButton({\n icon: 'close',\n label: 'Close',\n onClick: close,\n dataset: { searchClose: '' },\n });\n\n // Opens and closes the replace row, so replace isn't hidden behind the\n // cmd+opt+f shortcut. `aria-expanded` lets assistive tech announce the\n // state and the stylesheet point the chevron down while the row is open.\n const replaceToggleElement = iconButton({\n icon: 'chevron',\n label: 'Toggle Replace',\n dataset: { replaceToggle: '' },\n onClick: () => {\n if (gridElement.dataset.mode === 'replace') {\n applyMode('find');\n } else {\n applyMode('replace');\n // Opening the row from here means a replacement comes next.\n replaceInputElement.focus();\n }\n },\n });\n replaceToggleElement.ariaExpanded = String(mode === 'replace');\n\n // Cells are positioned by CSS grid-template-areas (see editor.css), so DOM\n // order here only drives tab/reading order, not layout. Keep the replace\n // input directly after the find input (and its toggles) so Tab walks\n // chevron -> find -> replace before reaching the nav arrows and close\n // button.\n const gridElement = h('div', {\n dataset: { searchGrid: '', mode },\n children: [\n replaceToggleElement,\n findInputBox,\n replaceInputBox,\n replaceActionsElement,\n matchResultElement,\n navElement,\n closeElement,\n ],\n });\n\n // Toggles the panel between find and find/replace modes by showing or\n // hiding the replace cells, then returns focus to the find input.\n const applyMode = (next: SearchPanelMode) => {\n gridElement.dataset.mode = next;\n replaceToggleElement.ariaExpanded = String(next === 'replace');\n this.#inputElement.focus();\n this.#inputElement.select();\n };\n this.#applyMode = applyMode;\n\n this.#container = h('div', {\n dataset: 'searchPanel',\n children: [\n h('div', {\n dataset: 'editorWidget',\n children: [gridElement],\n }),\n ],\n });\n\n matches.current = initialMatch;\n containerElement.before(this.#container);\n\n requestAnimationFrame(() => {\n if (initialMatch !== undefined) {\n updateMatches();\n } else {\n onUpdate([]);\n }\n this.#inputElement.select();\n });\n }\n\n focus(): void {\n this.#inputElement.focus();\n }\n\n navigate(findPrevious: boolean): void {\n this.#navigate?.(findPrevious);\n }\n\n updateMatches(options?: { syncSelection?: boolean }): void {\n this.#updateMatches?.(options);\n }\n\n setMode(mode: SearchPanelMode): void {\n this.#applyMode?.(mode);\n }\n\n // Tears the panel down the way the close button and Escape-in-input do:\n // removes the DOM and runs onClose so the editor clears its match highlights.\n // Prefer this over cleanup() for any user-initiated dismissal.\n close(): void {\n this.#close?.();\n }\n\n // DOM-only teardown. Does NOT run onClose, so it leaves the editor's match\n // highlights in place; only use it when the caller clears that state itself\n // (e.g. a full editor reset). User-initiated dismissals should call close().\n cleanup(): void {\n this.#container.remove();\n }\n}\n"],"mappings":";;;;;;AAmCA,IAAa,oBAAb,MAA+B;CAC7B;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA6B;EACvC,MAAM,EACJ,cACA,kBACA,cACA,OAAO,QACP,cACA,eACA,cACA,UACA,YACE;EAEJ,MAAM,eAA6B;GACjC,MAAM;GACN,aAAa;GACb,eAAe;GACf,WAAW;GACX,OAAO;EACT;EAEA,MAAM,UAAU;GACd,KAAK,CAA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,IAAI;CACxB;CAKA,QAAc;EACZ,KAAK,SAAS;CAChB;CAKA,UAAgB;EACd,KAAK,WAAW,OAAO;CACzB;AACF"}
@@ -1,6 +1,6 @@
1
1
  //#region src/editor/sprite.d.ts
2
- type SVGSpriteNames = 'arrow-down' | 'arrow-up' | 'case' | 'close' | 'regex' | 'whole-word' | 'replace' | 'replace-all';
3
- declare const SVGSpriteSheet = "<svg data-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace-all\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z\"></path>\n </symbol>\n</svg>";
2
+ type SVGSpriteNames = 'arrow-down' | 'arrow-up' | 'case' | 'chevron' | 'close' | 'regex' | 'whole-word' | 'replace' | 'replace-all';
3
+ declare const SVGSpriteSheet = "<svg data-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-chevron\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M1.46967 4.46967C1.76256 4.17678 2.23744 4.17678 2.53033 4.46967L8 9.93934L13.4697 4.46967C13.7626 4.17678 14.2374 4.17678 14.5303 4.46967C14.8232 4.76256 14.8232 5.23744 14.5303 5.53033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L1.46967 5.53033C1.17678 5.23744 1.17678 4.76256 1.46967 4.46967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace-all\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z\"></path>\n </symbol>\n</svg>";
4
4
  declare const createSpriteElement: () => SVGSVGElement;
5
5
  declare const getEditorIconSvg: (name: SVGSpriteNames, size?: number) => string;
6
6
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"sprite.d.ts","names":[],"sources":["../../src/editor/sprite.ts"],"mappings":";KAAY;cAiBC;cA+BA,2BAA0B;cAU1B,mBAAgB,MAAU,gBAAc"}
1
+ {"version":3,"file":"sprite.d.ts","names":[],"sources":["../../src/editor/sprite.ts"],"mappings":";KAAY;cAkBC;cAkCA,2BAA0B;cAU1B,mBAAgB,MAAU,gBAAc"}
@@ -13,6 +13,9 @@ const SVGSpriteSheet = `<svg data-icon-sprite aria-hidden="true" width="0" heigh
13
13
  <path fill="currentColor" d="M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z"></path>
14
14
  <path fill="currentColor" d="M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z"></path>
15
15
  </symbol>
16
+ <symbol id="diffs-editor-icon-chevron" viewBox="0 0 16 16">
17
+ <path fill="currentColor" d="M1.46967 4.46967C1.76256 4.17678 2.23744 4.17678 2.53033 4.46967L8 9.93934L13.4697 4.46967C13.7626 4.17678 14.2374 4.17678 14.5303 4.46967C14.8232 4.76256 14.8232 5.23744 14.5303 5.53033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L1.46967 5.53033C1.17678 5.23744 1.17678 4.76256 1.46967 4.46967Z"></path>
18
+ </symbol>
16
19
  <symbol id="diffs-editor-icon-whole-word" viewBox="0 0 16 16">
17
20
  <path fill="currentColor" d="M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z"></path>
18
21
  <path fill="currentColor" d="M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z"></path>
@@ -1 +1 @@
1
- {"version":3,"file":"sprite.js","names":[],"sources":["../../src/editor/sprite.ts"],"sourcesContent":["export type SVGSpriteNames =\n | 'arrow-down'\n | 'arrow-up'\n | 'case'\n | 'close'\n | 'regex'\n | 'whole-word'\n | 'replace'\n | 'replace-all';\n\n// Icon artwork is sourced from `@pierre/icons` (IconSearch, IconX,\n// IconArrowRight, IconType, IconTypeWord, IconRegex, IconReplace,\n// IconReplaceAll) so the editor matches the rest of the product. The arrow glyph\n// is the full-size right arrow rotated to point up/down for the search\n// \"previous\"/\"next\" controls. `getEditorIconSvg` omits an outer viewBox so each\n// symbol scales to fill the requested size regardless of its intrinsic\n// coordinate system.\nexport const SVGSpriteSheet = `<svg data-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace-all\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z\"></path>\n </symbol>\n</svg>`;\n\nexport const createSpriteElement = (): SVGSVGElement => {\n const fragment = document.createElement('div');\n fragment.innerHTML = SVGSpriteSheet;\n const sprite = fragment.firstElementChild;\n if (sprite === null || !(sprite instanceof SVGSVGElement)) {\n throw new Error('Failed to create sprite element');\n }\n return sprite;\n};\n\nexport const getEditorIconSvg = (name: SVGSpriteNames, size = 16): string =>\n `<svg width=\"${size}\" height=\"${size}\" aria-hidden=\"true\" focusable=\"false\">\n<use href=\"#diffs-editor-icon-${name}\"></use>\n</svg>`;\n"],"mappings":";AAiBA,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B9B,MAAa,4BAA2C;CACtD,MAAM,WAAW,SAAS,cAAc,KAAK;CAC7C,SAAS,YAAY;CACrB,MAAM,SAAS,SAAS;CACxB,IAAI,WAAW,QAAQ,EAAE,kBAAkB,gBACzC,MAAM,IAAI,MAAM,iCAAiC;CAEnD,OAAO;AACT;AAEA,MAAa,oBAAoB,MAAsB,OAAO,OAC5D,eAAe,KAAK,YAAY,KAAK;gCACP,KAAK"}
1
+ {"version":3,"file":"sprite.js","names":[],"sources":["../../src/editor/sprite.ts"],"sourcesContent":["export type SVGSpriteNames =\n | 'arrow-down'\n | 'arrow-up'\n | 'case'\n | 'chevron'\n | 'close'\n | 'regex'\n | 'whole-word'\n | 'replace'\n | 'replace-all';\n\n// Icon artwork is sourced from `@pierre/icons` (IconSearch, IconX,\n// IconArrowRight, IconType, IconTypeWord, IconRegex, IconReplace, IconChevron,\n// IconReplaceAll) so the editor matches the rest of the product. The arrow glyph\n// is the full-size right arrow rotated to point up/down for the search\n// \"previous\"/\"next\" controls. `getEditorIconSvg` omits an outer viewBox so each\n// symbol scales to fill the requested size regardless of its intrinsic\n// coordinate system.\nexport const SVGSpriteSheet = `<svg data-icon-sprite aria-hidden=\"true\" width=\"0\" height=\"0\">\n <symbol id=\"diffs-editor-icon-close\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M3.21967 3.21967C3.51256 2.92678 3.98744 2.92678 4.28033 3.21967L8 6.93934L11.7197 3.21967C12.0126 2.92678 12.4874 2.92678 12.7803 3.21967C13.0732 3.51256 13.0732 3.98744 12.7803 4.28033L9.06066 8L12.7803 11.7197C13.0732 12.0126 13.0732 12.4874 12.7803 12.7803C12.4874 13.0732 12.0126 13.0732 11.7197 12.7803L8 9.06066L4.28033 12.7803C3.98744 13.0732 3.51256 13.0732 3.21967 12.7803C2.92678 12.4874 2.92678 12.0126 3.21967 11.7197L6.93934 8L3.21967 4.28033C2.92678 3.98744 2.92678 3.51256 3.21967 3.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-up\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(-90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-arrow-down\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" transform=\"rotate(90 8 8)\" d=\"M8.46967 2.21967C8.17678 2.51256 8.17678 2.98744 8.46967 3.28033L12.4393 7.25H1.75C1.33579 7.25 1 7.58579 1 8C1 8.41421 1.33579 8.75 1.75 8.75H12.4393L8.46967 12.7197C8.17678 13.0126 8.17678 13.4874 8.46967 13.7803C8.76256 14.0732 9.23744 14.0732 9.53033 13.7803L14.7803 8.53033C15.0732 8.23744 15.0732 7.76256 14.7803 7.46967L9.53033 2.21967C9.23744 1.92678 8.76256 1.92678 8.46967 2.21967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-case\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M12.2969 12.9969C10.7109 12.9969 9.61719 12.0125 9.61719 10.5047C9.61719 9.06719 10.6172 8.16094 12.5 8.15312H14.6641V7.31719C14.6641 6.23906 14.0391 5.64531 12.9297 5.64531C11.875 5.64531 11.2734 6.18437 11.1953 7.00469H9.92969C10.0156 5.56719 10.9922 4.52031 12.9766 4.52031C14.7266 4.52031 16 5.47344 16 7.2V12.8641H14.7109V11.8406H14.6719C14.2578 12.5047 13.5078 12.9969 12.2969 12.9969ZM12.6562 11.8797C13.8047 11.8797 14.6641 11.1609 14.6641 10.1375V9.18437H12.6016C11.4766 9.18437 10.9922 9.71562 10.9922 10.4578C10.9922 11.4266 11.7969 11.8797 12.6562 11.8797Z\"></path>\n <path fill=\"currentColor\" d=\"M1.42188 12.8641H0L3.79688 2H5.1875L8.98438 12.8641H7.54688L6.46875 9.66094H2.5L1.42188 12.8641ZM4.50781 3.60938H4.46875L2.86719 8.55937H6.10156L4.50781 3.60938Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-chevron\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M1.46967 4.46967C1.76256 4.17678 2.23744 4.17678 2.53033 4.46967L8 9.93934L13.4697 4.46967C13.7626 4.17678 14.2374 4.17678 14.5303 4.46967C14.8232 4.76256 14.8232 5.23744 14.5303 5.53033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L1.46967 5.53033C1.17678 5.23744 1.17678 4.76256 1.46967 4.46967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-whole-word\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M11.4089 9.99449C11.1417 9.99449 10.8961 9.95595 10.6722 9.87887C10.4519 9.80179 10.2605 9.69167 10.098 9.54852C9.93551 9.40537 9.81453 9.23469 9.73508 9.03648H9.67007V9.91191H8.5V2H9.70258V5.01721H9.76758C9.81092 4.86671 9.88314 4.7309 9.98426 4.60977C10.089 4.48497 10.2136 4.37853 10.358 4.29043C10.5025 4.19867 10.6668 4.13076 10.851 4.08672C11.0352 4.039 11.2302 4.01514 11.436 4.01514C11.8802 4.01514 12.2648 4.11792 12.5898 4.32347C12.9149 4.52535 13.164 4.81532 13.3374 5.19339C13.5107 5.57146 13.5974 6.02478 13.5974 6.55334V7.45079C13.5974 7.97568 13.5089 8.429 13.332 8.81074C13.1586 9.1888 12.9076 9.48061 12.579 9.68617C12.2504 9.89172 11.8604 9.99449 11.4089 9.99449ZM11.0785 8.99243C11.353 8.99243 11.5859 8.92636 11.7773 8.79422C11.9723 8.66208 12.1204 8.46937 12.2215 8.2161C12.3226 7.95916 12.3732 7.65267 12.3732 7.29663V6.73503C12.3732 6.37164 12.3208 6.06332 12.2161 5.81005C12.115 5.55311 11.9669 5.35673 11.7719 5.22092C11.5769 5.08511 11.3385 5.01721 11.0568 5.01721C10.7824 5.01721 10.5422 5.08328 10.3364 5.21542C10.1341 5.34389 9.97704 5.52925 9.86509 5.77151C9.75675 6.01009 9.70258 6.2964 9.70258 6.63042V7.47281C9.70258 7.77013 9.76036 8.03441 9.87592 8.26566C9.99509 8.49323 10.1576 8.67125 10.3635 8.79972C10.5729 8.92819 10.8113 8.99243 11.0785 8.99243Z\"></path>\n <path fill=\"currentColor\" d=\"M4.70482 9.99449C4.15229 9.99449 3.70087 9.83482 3.35057 9.51548C3.00388 9.19247 2.83054 8.75935 2.83054 8.2161C2.83054 7.70223 3.00207 7.28745 3.34515 6.97178C3.69184 6.65244 4.19562 6.49277 4.8565 6.49277H6.30284V5.94769C6.30284 5.61367 6.20533 5.36774 6.01032 5.20991C5.81531 5.04841 5.55349 4.96765 5.22485 4.96765C5.00817 4.96765 4.82941 4.99702 4.68857 5.05575C4.54773 5.11081 4.43758 5.18789 4.35813 5.28699C4.27868 5.38243 4.22271 5.49621 4.19021 5.62835H3.04722C3.06527 5.3861 3.12305 5.16586 3.22056 4.96765C3.32168 4.76577 3.46252 4.59326 3.64309 4.4501C3.82727 4.30328 4.05297 4.19133 4.32021 4.11425C4.59106 4.03716 4.90525 3.99862 5.26277 3.99862C5.67086 3.99862 6.04463 4.06286 6.38409 4.19133C6.72356 4.31613 6.99441 4.52168 7.19665 4.80798C7.39888 5.09429 7.5 5.4797 7.5 5.96421V9.9064H6.35701V9.1521H6.30284C6.21978 9.29892 6.10783 9.43657 5.96698 9.56504C5.82614 9.69351 5.65099 9.79812 5.44153 9.87887C5.23569 9.95595 4.99012 9.99449 4.70482 9.99449ZM5.07318 9.04749C5.3043 9.04749 5.51196 8.99977 5.69613 8.90434C5.88031 8.80523 6.02657 8.67309 6.13491 8.50791C6.24686 8.34274 6.30284 8.1537 6.30284 7.94081V7.31314H5.04609C4.69579 7.31314 4.43939 7.39206 4.27688 7.5499C4.11798 7.70773 4.03853 7.90961 4.03853 8.15554C4.03853 8.4602 4.14326 8.68594 4.35272 8.83276C4.56578 8.97591 4.80594 9.04749 5.07318 9.04749Z\"></path>\n <path fill=\"currentColor\" d=\"M2.5 12.5L13.5 12.5C14.3284 12.5 15 11.8284 15 11V9.5C15 9.22386 15.2239 9 15.5 9C15.7761 9 16 9.22386 16 9.5V11C16 12.3807 14.8807 13.5 13.5 13.5L2.5 13.5C1.11929 13.5 -7.56324e-07 12.3807 0 11L6.55675e-08 9.5C3.58362e-07 9.22386 0.223858 9 0.5 9C0.776142 9 1 9.22386 1 9.5L1 11C0.999999 11.8284 1.67157 12.5 2.5 12.5Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-regex\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" d=\"M8.60788 6.59074C8.78227 6.46701 9.02141 6.60508 9.00146 6.81797L8.77564 9.22666C8.76189 9.37331 8.87726 9.5 9.02455 9.5H9.97548C10.1228 9.5 10.2381 9.37331 10.2244 9.22667L9.99858 6.81801C9.97862 6.60513 10.2178 6.46706 10.3922 6.59079L12.3652 7.99066C12.4853 8.07589 12.6527 8.03932 12.7264 7.91177L13.2018 7.08823C13.2755 6.96068 13.2234 6.79742 13.0896 6.73601L10.8907 5.72723C10.6963 5.63807 10.6963 5.36193 10.8907 5.27277L13.0896 4.264C13.2234 4.20258 13.2755 4.03932 13.2018 3.91177L12.7263 3.08824C12.6527 2.96068 12.4853 2.92411 12.3652 3.00934L10.3922 4.40921C10.2178 4.53294 9.97862 4.39486 9.99858 4.18198L10.2244 1.77334C10.2381 1.62669 10.1228 1.5 9.97548 1.5H9.02455C8.87726 1.5 8.76189 1.62669 8.77564 1.77334L9.00146 4.18203C9.02141 4.39491 8.78227 4.53298 8.60788 4.40926L6.63479 3.00934C6.51466 2.92411 6.34726 2.96068 6.27362 3.08823L5.79815 3.91177C5.72451 4.03932 5.77654 4.20258 5.91041 4.26399L8.10929 5.27277C8.30363 5.36193 8.30363 5.63807 8.10929 5.72723L5.91041 6.73601C5.77653 6.79742 5.7245 6.96068 5.79814 7.08824L6.27361 7.91177C6.34725 8.03932 6.51466 8.07589 6.63478 7.99066L8.60788 6.59074Z\"></path>\n <path fill=\"currentColor\" d=\"M4 11C3.44772 11 3 11.4477 3 12V13C3 13.5523 3.44772 14 4 14H5C5.55228 14 6 13.5523 6 13V12C6 11.4477 5.55228 11 5 11H4Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M5.28033 5.71967C5.57322 6.01256 5.57322 6.48744 5.28033 6.78033L3.56066 8.5H11.75C12.7165 8.5 13.5 7.7165 13.5 6.75V2.75C13.5 2.33579 13.8358 2 14.25 2C14.6642 2 15 2.33579 15 2.75V6.75C15 8.54493 13.5449 10 11.75 10H3.56066L5.28033 11.7197C5.57322 12.0126 5.57322 12.4874 5.28033 12.7803C4.98744 13.0732 4.51256 13.0732 4.21967 12.7803L1.21967 9.78033C0.926777 9.48744 0.926777 9.01256 1.21967 8.71967L4.21967 5.71967C4.51256 5.42678 4.98744 5.42678 5.28033 5.71967Z\"></path>\n </symbol>\n <symbol id=\"diffs-editor-icon-replace-all\" viewBox=\"0 0 16 16\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.7197 0.21967C11.0126 -0.0732233 11.4874 -0.0732233 11.7803 0.21967L14.7803 3.21967C15.0732 3.51256 15.0732 3.98744 14.7803 4.28033L11.7803 7.28033C11.4874 7.57322 11.0126 7.57322 10.7197 7.28033C10.4268 6.98744 10.4268 6.51256 10.7197 6.21967L12.4393 4.5H4.25C3.2835 4.5 2.5 5.2835 2.5 6.25V6.875C2.5 7.28921 2.16421 7.625 1.75 7.625C1.33579 7.625 1 7.28921 1 6.875V6.25C1 4.45507 2.45508 3 4.25 3H12.4393L10.7197 1.28033C10.4268 0.987437 10.4268 0.512563 10.7197 0.21967ZM5.28033 8.71967C5.57322 9.01256 5.57322 9.48744 5.28033 9.78033L3.56066 11.5H11.75C12.7165 11.5 13.5 10.7165 13.5 9.75V9.125C13.5 8.71079 13.8358 8.375 14.25 8.375C14.6642 8.375 15 8.71079 15 9.125V9.75C15 11.5449 13.5449 13 11.75 13H3.56066L5.28033 14.7197C5.57322 15.0126 5.57322 15.4874 5.28033 15.7803C4.98744 16.0732 4.51256 16.0732 4.21967 15.7803L1.21967 12.7803C0.926777 12.4874 0.926777 12.0126 1.21967 11.7197L4.21967 8.71967C4.51256 8.42678 4.98744 8.42678 5.28033 8.71967Z\"></path>\n </symbol>\n</svg>`;\n\nexport const createSpriteElement = (): SVGSVGElement => {\n const fragment = document.createElement('div');\n fragment.innerHTML = SVGSpriteSheet;\n const sprite = fragment.firstElementChild;\n if (sprite === null || !(sprite instanceof SVGSVGElement)) {\n throw new Error('Failed to create sprite element');\n }\n return sprite;\n};\n\nexport const getEditorIconSvg = (name: SVGSpriteNames, size = 16): string =>\n `<svg width=\"${size}\" height=\"${size}\" aria-hidden=\"true\" focusable=\"false\">\n<use href=\"#diffs-editor-icon-${name}\"></use>\n</svg>`;\n"],"mappings":";AAkBA,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkC9B,MAAa,4BAA2C;CACtD,MAAM,WAAW,SAAS,cAAc,KAAK;CAC7C,SAAS,YAAY;CACrB,MAAM,SAAS,SAAS;CACxB,IAAI,WAAW,QAAQ,EAAE,kBAAkB,gBACzC,MAAM,IAAI,MAAM,iCAAiC;CAEnD,OAAO;AACT;AAEA,MAAa,oBAAoB,MAAsB,OAAO,OAC5D,eAAe,KAAK,YAAY,KAAK;gCACP,KAAK"}
@@ -1,5 +1,7 @@
1
1
  //#region src/utils/setDeferredArrayItem.d.ts
2
- declare function setDeferredArrayItem<T>(array: T[], index: number, create: () => T): void;
2
+ declare function setDeferredArrayItem<T>(array: T[], index: number, create: () => T, { retain }?: {
3
+ retain?: boolean;
4
+ }): void;
3
5
  //#endregion
4
6
  export { setDeferredArrayItem };
5
7
  //# sourceMappingURL=setDeferredArrayItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setDeferredArrayItem.d.ts","names":[],"sources":["../../src/utils/setDeferredArrayItem.ts"],"mappings":";iBAAgB,qBAAqB,GACnC,OAAO,KACP,eACA,cAAc"}
1
+ {"version":3,"file":"setDeferredArrayItem.d.ts","names":[],"sources":["../../src/utils/setDeferredArrayItem.ts"],"mappings":";iBAKgB,qBAAqB,GACnC,OAAO,KACP,eACA,cAAc,KACZ;EAAmB"}
@@ -1,15 +1,16 @@
1
1
  //#region src/utils/setDeferredArrayItem.ts
2
- function setDeferredArrayItem(array, index, create) {
2
+ function setDeferredArrayItem(array, index, create, { retain = true } = {}) {
3
3
  let initialized = false;
4
4
  let cached;
5
5
  Object.defineProperty(array, index, {
6
6
  configurable: true,
7
7
  enumerable: true,
8
8
  get() {
9
- if (!initialized) {
10
- cached = create();
11
- initialized = true;
12
- }
9
+ if (initialized) return cached;
10
+ const value = create();
11
+ if (!retain) return value;
12
+ cached = value;
13
+ initialized = true;
13
14
  if (Object.getOwnPropertyDescriptor(array, index)?.configurable === true) Object.defineProperty(array, index, {
14
15
  configurable: true,
15
16
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"setDeferredArrayItem.js","names":[],"sources":["../../src/utils/setDeferredArrayItem.ts"],"sourcesContent":["export function setDeferredArrayItem<T>(\n array: T[],\n index: number,\n create: () => T\n): void {\n let initialized = false;\n let cached: T;\n Object.defineProperty(array, index, {\n configurable: true,\n enumerable: true,\n get() {\n if (!initialized) {\n cached = create();\n initialized = true;\n }\n if (\n Object.getOwnPropertyDescriptor(array, index)?.configurable === true\n ) {\n Object.defineProperty(array, index, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: cached,\n });\n }\n return cached;\n },\n set(value: T) {\n if (\n Object.getOwnPropertyDescriptor(array, index)?.configurable === true\n ) {\n Object.defineProperty(array, index, {\n configurable: true,\n enumerable: true,\n writable: true,\n value,\n });\n } else if (Object.isFrozen(array)) {\n throw new TypeError(\n `Cannot assign to read only array index '${index}'`\n );\n } else {\n cached = value;\n initialized = true;\n }\n },\n });\n}\n"],"mappings":";AAAA,SAAgB,qBACd,OACA,OACA,QACM;CACN,IAAI,cAAc;CAClB,IAAI;CACJ,OAAO,eAAe,OAAO,OAAO;EAClC,cAAc;EACd,YAAY;EACZ,MAAM;GACJ,IAAI,CAAC,aAAa;IAChB,SAAS,OAAO;IAChB,cAAc;GAChB;GACA,IACE,OAAO,yBAAyB,OAAO,KAAK,CAAC,EAAE,iBAAiB,MAEhE,OAAO,eAAe,OAAO,OAAO;IAClC,cAAc;IACd,YAAY;IACZ,UAAU;IACV,OAAO;GACT,CAAC;GAEH,OAAO;EACT;EACA,IAAI,OAAU;GACZ,IACE,OAAO,yBAAyB,OAAO,KAAK,CAAC,EAAE,iBAAiB,MAEhE,OAAO,eAAe,OAAO,OAAO;IAClC,cAAc;IACd,YAAY;IACZ,UAAU;IACV;GACF,CAAC;QACI,IAAI,OAAO,SAAS,KAAK,GAC9B,MAAM,IAAI,UACR,2CAA2C,MAAM,EACnD;QACK;IACL,SAAS;IACT,cAAc;GAChB;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"setDeferredArrayItem.js","names":[],"sources":["../../src/utils/setDeferredArrayItem.ts"],"sourcesContent":["// Defines `array[index]` as an item that `create` builds on read. By default\n// the first read keeps the built value as a plain array item. With\n// `retain: false`, every read builds a fresh value and nothing built is kept,\n// for items whose source stays available anyway. Assignments store the given\n// value like a normal array write and follow sealed/frozen array semantics.\nexport function setDeferredArrayItem<T>(\n array: T[],\n index: number,\n create: () => T,\n { retain = true }: { retain?: boolean } = {}\n): void {\n let initialized = false;\n let cached: T;\n Object.defineProperty(array, index, {\n configurable: true,\n enumerable: true,\n get() {\n if (initialized) return cached;\n const value = create();\n if (!retain) return value;\n cached = value;\n initialized = true;\n if (\n Object.getOwnPropertyDescriptor(array, index)?.configurable === true\n ) {\n Object.defineProperty(array, index, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: cached,\n });\n }\n return cached;\n },\n set(value: T) {\n if (\n Object.getOwnPropertyDescriptor(array, index)?.configurable === true\n ) {\n Object.defineProperty(array, index, {\n configurable: true,\n enumerable: true,\n writable: true,\n value,\n });\n } else if (Object.isFrozen(array)) {\n throw new TypeError(\n `Cannot assign to read only array index '${index}'`\n );\n } else {\n cached = value;\n initialized = true;\n }\n },\n });\n}\n"],"mappings":";AAKA,SAAgB,qBACd,OACA,OACA,QACA,EAAE,SAAS,SAA+B,CAAC,GACrC;CACN,IAAI,cAAc;CAClB,IAAI;CACJ,OAAO,eAAe,OAAO,OAAO;EAClC,cAAc;EACd,YAAY;EACZ,MAAM;GACJ,IAAI,aAAa,OAAO;GACxB,MAAM,QAAQ,OAAO;GACrB,IAAI,CAAC,QAAQ,OAAO;GACpB,SAAS;GACT,cAAc;GACd,IACE,OAAO,yBAAyB,OAAO,KAAK,CAAC,EAAE,iBAAiB,MAEhE,OAAO,eAAe,OAAO,OAAO;IAClC,cAAc;IACd,YAAY;IACZ,UAAU;IACV,OAAO;GACT,CAAC;GAEH,OAAO;EACT;EACA,IAAI,OAAU;GACZ,IACE,OAAO,yBAAyB,OAAO,KAAK,CAAC,EAAE,iBAAiB,MAEhE,OAAO,eAAe,OAAO,OAAO;IAClC,cAAc;IACd,YAAY;IACZ,UAAU;IACV;GACF,CAAC;QACI,IAAI,OAAO,SAAS,KAAK,GAC9B,MAAM,IAAI,UACR,2CAA2C,MAAM,EACnD;QACK;IACL,SAAS;IACT,cAAc;GAChB;EACF;CACF,CAAC;AACH"}
@@ -146,7 +146,7 @@ function decodeHastLines(encoded) {
146
146
  position = offsets[index * 2];
147
147
  textPosition = offsets[index * 2 + 1];
148
148
  return decodeNodes(1)[0];
149
- });
149
+ }, { retain: false });
150
150
  }
151
151
  return lines;
152
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hastLinesTransport.js","names":[],"sources":["../../src/worker/hastLinesTransport.ts"],"sourcesContent":["import type { ElementContent, Properties } from 'hast';\n\nimport { setDeferredArrayItem } from '../utils/setDeferredArrayItem';\n\nconst HOLE = 0;\nconst TEXT = 1;\nconst ELEMENT = 2;\nconst OTHER = 3;\nconst UNDEFINED = 0;\nconst NULL = 1;\nconst TRUE = 2;\nconst FALSE = 3;\nconst STRING = 4;\nconst INTEGER = 5;\nconst EXTRA = 6;\nconst PRIMITIVES = [undefined, null, true, false];\n\nexport interface EncodedHastLines {\n ops: Int32Array<ArrayBuffer>;\n offsets: Uint32Array<ArrayBuffer>;\n strings: string[];\n text: string;\n extras: unknown[];\n}\n\nexport function encodeHastLines(lines: ElementContent[]): EncodedHastLines {\n let ops = new Int32Array(Math.max(32, Math.min(65536, lines.length * 32)));\n let length = 0;\n const offsets = new Uint32Array(lines.length * 2);\n const strings: string[] = [];\n const stringIds = new Map<string, number>();\n const extras: unknown[] = [];\n let text = '';\n\n function push(value: number): void {\n if (length === ops.length) {\n const next = new Int32Array(ops.length * 2);\n next.set(ops);\n ops = next;\n }\n ops[length++] = value;\n }\n\n function intern(value: string): number {\n let id = stringIds.get(value);\n if (id == null) {\n id = strings.length;\n strings.push(value);\n stringIds.set(value, id);\n }\n return id;\n }\n\n function encodeNode(node: ElementContent): void {\n let keys = 0;\n for (const _ in node) keys++;\n if (node?.type === 'text' && keys === 2) {\n push(TEXT);\n push(node.value.length);\n text += node.value;\n } else if (\n node?.type === 'element' &&\n keys === 4 &&\n node.properties != null &&\n Object.getPrototypeOf(node.properties) === Object.prototype\n ) {\n push(ELEMENT);\n push(intern(node.tagName));\n let count = 0;\n for (const _ in node.properties) count++;\n push(count);\n for (const key in node.properties) {\n const value = node.properties[key];\n push(intern(key));\n if (value === undefined) push(UNDEFINED);\n else if (value === null) push(NULL);\n else if (value === true) push(TRUE);\n else if (value === false) push(FALSE);\n else if (typeof value === 'string') {\n push(STRING);\n push(intern(value));\n } else if (\n typeof value === 'number' &&\n (value | 0) === value &&\n !Object.is(value, -0)\n ) {\n push(INTEGER);\n push(value);\n } else {\n push(EXTRA);\n push(extras.length);\n extras.push(value);\n }\n }\n push(node.children.length);\n for (let index = 0; index < node.children.length; index++) {\n if (index in node.children) encodeNode(node.children[index]);\n else push(HOLE);\n }\n } else {\n push(OTHER);\n push(extras.length);\n extras.push(node);\n }\n }\n\n for (let index = 0; index < lines.length; index++) {\n offsets[index * 2] = length;\n offsets[index * 2 + 1] = text.length;\n if (index in lines) encodeNode(lines[index]);\n else push(HOLE);\n }\n return { ops: ops.subarray(0, length), offsets, strings, text, extras };\n}\n\nexport function decodeHastLines(\n encoded: EncodedHastLines | ElementContent[]\n): ElementContent[] {\n if (Array.isArray(encoded)) return encoded;\n const { ops, offsets, strings, text, extras } = encoded;\n const lines: ElementContent[] = new Array(offsets.length / 2);\n let position = 0;\n let textPosition = 0;\n\n function decodeNodes(count: number): ElementContent[] {\n const nodes: ElementContent[] = new Array(count);\n for (let index = 0; index < count; index++) {\n const kind = ops[position++];\n if (kind === HOLE) continue;\n if (kind === TEXT) {\n const end = textPosition + ops[position++];\n nodes[index] = { type: 'text', value: text.slice(textPosition, end) };\n textPosition = end;\n } else if (kind === ELEMENT) {\n const tagName = strings[ops[position++]];\n const properties: Properties = {};\n for (let remaining = ops[position++]; remaining > 0; remaining--) {\n const key = strings[ops[position++]];\n const type = ops[position++];\n const value =\n type === STRING\n ? strings[ops[position++]]\n : type === INTEGER\n ? ops[position++]\n : type === EXTRA\n ? (extras[ops[position++]] as Properties[string])\n : PRIMITIVES[type];\n if (key === '__proto__') {\n Object.defineProperty(properties, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n } else properties[key] = value;\n }\n nodes[index] = {\n type: 'element',\n tagName,\n properties,\n children: decodeNodes(ops[position++]),\n };\n } else nodes[index] = extras[ops[position++]] as ElementContent;\n }\n return nodes;\n }\n\n for (let index = 0; index < lines.length; index++) {\n if (ops[offsets[index * 2]] === HOLE) continue;\n setDeferredArrayItem(lines, index, () => {\n position = offsets[index * 2];\n textPosition = offsets[index * 2 + 1];\n return decodeNodes(1)[0];\n });\n }\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ACA,OAAO;AACT"}
1
+ {"version":3,"file":"hastLinesTransport.js","names":[],"sources":["../../src/worker/hastLinesTransport.ts"],"sourcesContent":["import type { ElementContent, Properties } from 'hast';\n\nimport { setDeferredArrayItem } from '../utils/setDeferredArrayItem';\n\nconst HOLE = 0;\nconst TEXT = 1;\nconst ELEMENT = 2;\nconst OTHER = 3;\nconst UNDEFINED = 0;\nconst NULL = 1;\nconst TRUE = 2;\nconst FALSE = 3;\nconst STRING = 4;\nconst INTEGER = 5;\nconst EXTRA = 6;\nconst PRIMITIVES = [undefined, null, true, false];\n\nexport interface EncodedHastLines {\n ops: Int32Array<ArrayBuffer>;\n offsets: Uint32Array<ArrayBuffer>;\n strings: string[];\n text: string;\n extras: unknown[];\n}\n\nexport function encodeHastLines(lines: ElementContent[]): EncodedHastLines {\n let ops = new Int32Array(Math.max(32, Math.min(65536, lines.length * 32)));\n let length = 0;\n const offsets = new Uint32Array(lines.length * 2);\n const strings: string[] = [];\n const stringIds = new Map<string, number>();\n const extras: unknown[] = [];\n let text = '';\n\n function push(value: number): void {\n if (length === ops.length) {\n const next = new Int32Array(ops.length * 2);\n next.set(ops);\n ops = next;\n }\n ops[length++] = value;\n }\n\n function intern(value: string): number {\n let id = stringIds.get(value);\n if (id == null) {\n id = strings.length;\n strings.push(value);\n stringIds.set(value, id);\n }\n return id;\n }\n\n function encodeNode(node: ElementContent): void {\n let keys = 0;\n for (const _ in node) keys++;\n if (node?.type === 'text' && keys === 2) {\n push(TEXT);\n push(node.value.length);\n text += node.value;\n } else if (\n node?.type === 'element' &&\n keys === 4 &&\n node.properties != null &&\n Object.getPrototypeOf(node.properties) === Object.prototype\n ) {\n push(ELEMENT);\n push(intern(node.tagName));\n let count = 0;\n for (const _ in node.properties) count++;\n push(count);\n for (const key in node.properties) {\n const value = node.properties[key];\n push(intern(key));\n if (value === undefined) push(UNDEFINED);\n else if (value === null) push(NULL);\n else if (value === true) push(TRUE);\n else if (value === false) push(FALSE);\n else if (typeof value === 'string') {\n push(STRING);\n push(intern(value));\n } else if (\n typeof value === 'number' &&\n (value | 0) === value &&\n !Object.is(value, -0)\n ) {\n push(INTEGER);\n push(value);\n } else {\n push(EXTRA);\n push(extras.length);\n extras.push(value);\n }\n }\n push(node.children.length);\n for (let index = 0; index < node.children.length; index++) {\n if (index in node.children) encodeNode(node.children[index]);\n else push(HOLE);\n }\n } else {\n push(OTHER);\n push(extras.length);\n extras.push(node);\n }\n }\n\n for (let index = 0; index < lines.length; index++) {\n offsets[index * 2] = length;\n offsets[index * 2 + 1] = text.length;\n if (index in lines) encodeNode(lines[index]);\n else push(HOLE);\n }\n return { ops: ops.subarray(0, length), offsets, strings, text, extras };\n}\n\nexport function decodeHastLines(\n encoded: EncodedHastLines | ElementContent[]\n): ElementContent[] {\n if (Array.isArray(encoded)) return encoded;\n const { ops, offsets, strings, text, extras } = encoded;\n const lines: ElementContent[] = new Array(offsets.length / 2);\n let position = 0;\n let textPosition = 0;\n\n function decodeNodes(count: number): ElementContent[] {\n const nodes: ElementContent[] = new Array(count);\n for (let index = 0; index < count; index++) {\n const kind = ops[position++];\n if (kind === HOLE) continue;\n if (kind === TEXT) {\n const end = textPosition + ops[position++];\n nodes[index] = { type: 'text', value: text.slice(textPosition, end) };\n textPosition = end;\n } else if (kind === ELEMENT) {\n const tagName = strings[ops[position++]];\n const properties: Properties = {};\n for (let remaining = ops[position++]; remaining > 0; remaining--) {\n const key = strings[ops[position++]];\n const type = ops[position++];\n const value =\n type === STRING\n ? strings[ops[position++]]\n : type === INTEGER\n ? ops[position++]\n : type === EXTRA\n ? (extras[ops[position++]] as Properties[string])\n : PRIMITIVES[type];\n if (key === '__proto__') {\n Object.defineProperty(properties, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n } else properties[key] = value;\n }\n nodes[index] = {\n type: 'element',\n tagName,\n properties,\n children: decodeNodes(ops[position++]),\n };\n } else nodes[index] = extras[ops[position++]] as ElementContent;\n }\n return nodes;\n }\n\n for (let index = 0; index < lines.length; index++) {\n if (ops[offsets[index * 2]] === HOLE) continue;\n // The encoded buffers outlive every row, so rows are re-decoded on read\n // rather than kept as a second copy of the whole result.\n setDeferredArrayItem(\n lines,\n index,\n () => {\n position = offsets[index * 2];\n textPosition = offsets[index * 2 + 1];\n return decodeNodes(1)[0];\n },\n { retain: false }\n );\n }\n return lines;\n}\n"],"mappings":";;AAIA,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,UAAU;AAChB,MAAM,QAAQ;AACd,MAAM,YAAY;AAClB,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,UAAU;AAChB,MAAM,QAAQ;AACd,MAAM,aAAa;CAAC,KAAA;CAAW;CAAM;CAAM;AAAK;AAUhD,SAAgB,gBAAgB,OAA2C;CACzE,IAAI,MAAM,IAAI,WAAW,KAAK,IAAI,IAAI,KAAK,IAAI,OAAO,MAAM,SAAS,EAAE,CAAC,CAAC;CACzE,IAAI,SAAS;CACb,MAAM,UAAU,IAAI,YAAY,MAAM,SAAS,CAAC;CAChD,MAAM,UAAoB,CAAC;CAC3B,MAAM,4BAAY,IAAI,IAAoB;CAC1C,MAAM,SAAoB,CAAC;CAC3B,IAAI,OAAO;CAEX,SAAS,KAAK,OAAqB;EACjC,IAAI,WAAW,IAAI,QAAQ;GACzB,MAAM,OAAO,IAAI,WAAW,IAAI,SAAS,CAAC;GAC1C,KAAK,IAAI,GAAG;GACZ,MAAM;EACR;EACA,IAAI,YAAY;CAClB;CAEA,SAAS,OAAO,OAAuB;EACrC,IAAI,KAAK,UAAU,IAAI,KAAK;EAC5B,IAAI,MAAM,MAAM;GACd,KAAK,QAAQ;GACb,QAAQ,KAAK,KAAK;GAClB,UAAU,IAAI,OAAO,EAAE;EACzB;EACA,OAAO;CACT;CAEA,SAAS,WAAW,MAA4B;EAC9C,IAAI,OAAO;EACX,KAAK,MAAM,KAAK,MAAM;EACtB,IAAI,MAAM,SAAS,UAAU,SAAS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