@pierre/diffs 1.2.8 → 1.2.10

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.
Files changed (53) hide show
  1. package/dist/components/CodeView.d.ts.map +1 -1
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/highlighter/shared_highlighter.js +3 -29
  4. package/dist/highlighter/shared_highlighter.js.map +1 -1
  5. package/dist/highlighter/themes/attachResolvedThemes.js +4 -3
  6. package/dist/highlighter/themes/attachResolvedThemes.js.map +1 -1
  7. package/dist/highlighter/themes/cleanUpResolvedThemes.js +3 -2
  8. package/dist/highlighter/themes/cleanUpResolvedThemes.js.map +1 -1
  9. package/dist/highlighter/themes/constants.d.ts +1 -7
  10. package/dist/highlighter/themes/constants.d.ts.map +1 -1
  11. package/dist/highlighter/themes/constants.js +1 -4
  12. package/dist/highlighter/themes/constants.js.map +1 -1
  13. package/dist/highlighter/themes/getResolvedOrResolveTheme.js +2 -2
  14. package/dist/highlighter/themes/getResolvedOrResolveTheme.js.map +1 -1
  15. package/dist/highlighter/themes/getResolvedThemes.js +2 -8
  16. package/dist/highlighter/themes/getResolvedThemes.js.map +1 -1
  17. package/dist/highlighter/themes/hasResolvedThemes.js +2 -3
  18. package/dist/highlighter/themes/hasResolvedThemes.js.map +1 -1
  19. package/dist/highlighter/themes/registerCustomCSSVariableTheme.js +1 -1
  20. package/dist/highlighter/themes/registerCustomTheme.d.ts +5 -3
  21. package/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
  22. package/dist/highlighter/themes/registerCustomTheme.js +15 -5
  23. package/dist/highlighter/themes/registerCustomTheme.js.map +1 -1
  24. package/dist/highlighter/themes/resolveTheme.js +6 -27
  25. package/dist/highlighter/themes/resolveTheme.js.map +1 -1
  26. package/dist/highlighter/themes/resolveThemes.js +5 -12
  27. package/dist/highlighter/themes/resolveThemes.js.map +1 -1
  28. package/dist/highlighter/themes/themeResolution.d.ts +8 -0
  29. package/dist/highlighter/themes/themeResolution.d.ts.map +1 -0
  30. package/dist/highlighter/themes/themeResolution.js +22 -0
  31. package/dist/highlighter/themes/themeResolution.js.map +1 -0
  32. package/dist/highlighter/themes/themeResolver.d.ts +8 -0
  33. package/dist/highlighter/themes/themeResolver.d.ts.map +1 -0
  34. package/dist/highlighter/themes/themeResolver.js +8 -0
  35. package/dist/highlighter/themes/themeResolver.js.map +1 -0
  36. package/dist/index.d.ts +4 -4
  37. package/dist/index.js +3 -3
  38. package/dist/react/index.d.ts +2 -2
  39. package/dist/react/jsx.d.ts.map +1 -1
  40. package/dist/ssr/index.d.ts +2 -2
  41. package/dist/types.d.ts +3 -3
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/utils/getHighlighterThemeStyles.js +16 -12
  44. package/dist/utils/getHighlighterThemeStyles.js.map +1 -1
  45. package/dist/utils/parsePatchFiles.js +93 -4
  46. package/dist/utils/parsePatchFiles.js.map +1 -1
  47. package/dist/worker/{wasm-BaDzIkIn.js → wasm-qE0LgnY3.js} +2 -2
  48. package/dist/worker/{wasm-BaDzIkIn.js.map → wasm-qE0LgnY3.js.map} +1 -1
  49. package/dist/worker/worker-portable.js +1005 -277
  50. package/dist/worker/worker-portable.js.map +1 -1
  51. package/dist/worker/worker.js +23 -15
  52. package/dist/worker/worker.js.map +1 -1
  53. package/package.json +4 -3
@@ -1 +1 @@
1
- {"version":3,"file":"CodeView.d.ts","names":["SelectionWriteOptions","CodeViewDiffItem","CodeViewFileItem","CodeViewItem","CodeViewLayout","CodeViewScrollTarget","HunkSeparators","SelectedLineRange","SmoothScrollSettings","VirtualFileMetrics","VirtualWindowSpecs","WorkerPoolManager","FileOptions","FileDiffOptions","VirtualizedFile","VirtualizedFileDiff","VirtualizerConfig","AdvancedVirtualizedBaseItem","HTMLElement","CodeViewDiffItemContext","LAnnotation","CodeViewFileItemContext","CodeViewRenderedDiffItem","CodeViewRenderedFileItem","CodeViewRenderedItem","CodeViewLineSelection","CodeViewCoordinator","CodeViewScrollListener","CodeView","OverloadCallbackArgs","TCallback","TArgs","CallbackReturn","TReturn","OverloadFileCallbackArgs","TKey","NonNullable","OverloadDiffCallbackArgs","CodeViewOptionCallback","CODE_VIEW_DIFF_OPTION_KEYS","CodeViewDiffOptionKeys","CodeViewPassThroughOptions","Pick","CODE_VIEW_SHARED_CALLBACK_KEYS","CODE_VIEW_SELECTION_CALLBACK_KEYS","CodeViewSharedCallbackKeys","CodeViewSelectionCallbackKeys","CodeViewSharedCallbackOptions","CodeViewSelectionCallbackOptions","CodeViewOptions","Exclude","Partial"],"sources":["../../src/components/CodeView.d.ts"],"sourcesContent":["import type { SelectionWriteOptions } from '../managers/InteractionManager';\nimport type { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewLayout, CodeViewScrollTarget, HunkSeparators, SelectedLineRange, SmoothScrollSettings, VirtualFileMetrics, VirtualWindowSpecs } from '../types';\nimport type { WorkerPoolManager } from '../worker';\nimport type { FileOptions } from './File';\nimport type { FileDiffOptions } from './FileDiff';\nimport { VirtualizedFile } from './VirtualizedFile';\nimport { VirtualizedFileDiff } from './VirtualizedFileDiff';\nimport type { VirtualizerConfig } from './Virtualizer';\ninterface AdvancedVirtualizedBaseItem {\n /** Current index of this record in the ordered items array. */\n index: number;\n /** Absolute top offset of this item inside the scroll content. */\n top: number;\n /** Total measured height reserved for this item. */\n height: number;\n /** Root <diffs-container> node currently mounted for this item, only exists\n * when rendered. */\n element: HTMLElement | undefined;\n /** Last controlled version observed for this record. */\n version: number | undefined;\n /** Last CodeView option revision this item rendered with. */\n renderedOptionsRevision: number;\n}\ninterface CodeViewDiffItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'diff';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewDiffItem<LAnnotation>;\n /** Virtualized diff instance responsible for rendering this item. */\n instance: VirtualizedFileDiff<LAnnotation>;\n}\ninterface CodeViewFileItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'file';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewFileItem<LAnnotation>;\n /** Virtualized file instance responsible for rendering this item. */\n instance: VirtualizedFile<LAnnotation>;\n}\nexport interface CodeViewRenderedDiffItem<LAnnotation> {\n id: string;\n type: 'diff';\n item: CodeViewDiffItem<LAnnotation>;\n version: number | undefined;\n element: HTMLElement;\n instance: VirtualizedFileDiff<LAnnotation>;\n}\nexport interface CodeViewRenderedFileItem<LAnnotation> {\n id: string;\n type: 'file';\n item: CodeViewFileItem<LAnnotation>;\n version: number | undefined;\n element: HTMLElement;\n instance: VirtualizedFile<LAnnotation>;\n}\nexport type CodeViewRenderedItem<LAnnotation> = CodeViewRenderedDiffItem<LAnnotation> | CodeViewRenderedFileItem<LAnnotation>;\nexport interface CodeViewLineSelection {\n id: string;\n range: SelectedLineRange;\n}\nexport interface CodeViewCoordinator<LAnnotation> {\n hasHeaderRenderers: boolean;\n hasAnnotationRenderer: boolean;\n hasGutterRenderer: boolean;\n onSnapshotChange(snapshot: CodeViewRenderedItem<LAnnotation>[] | undefined): void;\n}\nexport type CodeViewScrollListener<LAnnotation> = (scrollTop: number, viewer: CodeView<LAnnotation>) => void;\ntype OverloadCallbackArgs<TCallback> = TCallback extends (...args: infer TArgs) => unknown ? TArgs : never;\ntype CallbackReturn<TCallback> = TCallback extends (...args: never[]) => infer TReturn ? TReturn : never;\ntype OverloadFileCallbackArgs<LAnnotation, TKey extends keyof FileOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileOptions<LAnnotation>[TKey]>>;\ntype OverloadDiffCallbackArgs<LAnnotation, TKey extends keyof FileDiffOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\ntype CodeViewOptionCallback<LAnnotation, TKey extends keyof FileOptions<LAnnotation> & keyof FileDiffOptions<LAnnotation>> = {\n (...args: [\n ...OverloadFileCallbackArgs<LAnnotation, TKey>,\n context: CodeViewFileItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileOptions<LAnnotation>[TKey]>>;\n (...args: [\n ...OverloadDiffCallbackArgs<LAnnotation, TKey>,\n context: CodeViewDiffItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\n};\ndeclare const CODE_VIEW_DIFF_OPTION_KEYS: readonly [\"theme\", \"disableLineNumbers\", \"overflow\", \"themeType\", \"disableFileHeader\", \"disableVirtualizationBuffers\", \"preferredHighlighter\", \"useCSSClasses\", \"useTokenTransformer\", \"tokenizeMaxLineLength\", \"tokenizeMaxLength\", \"unsafeCSS\", \"diffStyle\", \"diffIndicators\", \"disableBackground\", \"expandUnchanged\", \"collapsedContextThreshold\", \"lineDiffType\", \"maxLineDiffLength\", \"expansionLineCount\", \"lineHoverHighlight\", \"enableTokenInteractionsOnWhitespace\", \"enableGutterUtility\", \"__debugPointerEvents\", \"enableLineSelection\", \"controlledSelection\", \"disableErrorHandling\"];\ntype CodeViewDiffOptionKeys = (typeof CODE_VIEW_DIFF_OPTION_KEYS)[number];\ntype CodeViewPassThroughOptions<LAnnotation> = Pick<FileDiffOptions<LAnnotation>, CodeViewDiffOptionKeys>;\ndeclare const CODE_VIEW_SHARED_CALLBACK_KEYS: readonly [\"renderCustomHeader\", \"renderHeaderPrefix\", \"renderHeaderMetadata\", \"renderAnnotation\", \"renderGutterUtility\", \"onPostRender\", \"onGutterUtilityClick\", \"onLineClick\", \"onLineNumberClick\", \"onLineEnter\", \"onLineLeave\", \"onTokenClick\", \"onTokenEnter\", \"onTokenLeave\"];\ndeclare const CODE_VIEW_SELECTION_CALLBACK_KEYS: readonly [\"onLineSelected\", \"onLineSelectionStart\", \"onLineSelectionChange\", \"onLineSelectionEnd\"];\ntype CodeViewSharedCallbackKeys = (typeof CODE_VIEW_SHARED_CALLBACK_KEYS)[number];\ntype CodeViewSelectionCallbackKeys = (typeof CODE_VIEW_SELECTION_CALLBACK_KEYS)[number];\ntype CodeViewSharedCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSharedCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\ntype CodeViewSelectionCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSelectionCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\nexport interface CodeViewOptions<LAnnotation> extends CodeViewPassThroughOptions<LAnnotation>, CodeViewSharedCallbackOptions<LAnnotation>, CodeViewSelectionCallbackOptions<LAnnotation> {\n hunkSeparators?: Exclude<HunkSeparators, 'custom'>;\n itemMetrics?: Partial<VirtualFileMetrics>;\n pointerEventsOnScroll?: boolean;\n smoothScrollSettings?: SmoothScrollSettings;\n stickyHeaders?: boolean;\n controlledSelection?: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n layout?: CodeViewLayout;\n /** Internal dev-only check to ensure your `itemMetrics` are correct. Its\n * automatically disabled in a production build because it will hurt\n * performance fairly significantly */\n __devOnlyValidateItemHeights?: boolean;\n}\nexport declare class CodeView<LAnnotation = undefined> {\n static __STOP: boolean;\n static __lastScrollPosition: number;\n type: \"advanced\";\n readonly config: VirtualizerConfig;\n private items;\n private idToItem;\n private selectedLines;\n private instanceToItem;\n private layoutDirtyIndex;\n private pendingLayoutReset;\n private renderOptionsRevision;\n private slotCoordinator;\n private slotSnapshot;\n private scrollListeners;\n private scrollHeight;\n private containerHeight;\n private scrollTop;\n private scrollPageOffset;\n private scrollDirty;\n private scrollInteractionFixTimer;\n private pointerEventsDisabled;\n private codeOverflowFix;\n private height;\n private heightDirty;\n private windowSpecs;\n private renderState;\n private itemMetricsCache;\n private readonly fileOptionsPrototype;\n private readonly diffOptionsPrototype;\n private pendingScrollTarget;\n private pendingLayoutAnchor;\n private shouldFixContainerFocus;\n private scrollAnimation;\n private root;\n private resizeObserver;\n private container;\n private stickyContainer;\n private stickyOffset;\n private elementPool;\n private elementPoolVersion;\n private elementPoolTracker;\n private pendingElementPool;\n private options;\n private workerManager;\n private isContainerManaged;\n constructor(options?: CodeViewOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);\n private getLayout;\n private computeMetricsCache;\n private getSmoothScrollSettings;\n private shouldDisablePointerEvents;\n private shouldValidateItemHeights;\n private validateRenderedItemHeight;\n private validateStickyContainerHeight;\n private clearScrollInteractionTimer;\n private suspendScrollInteractions;\n private restoreScrollInteractions;\n private syncLayout;\n setup(root: HTMLElement): void;\n reset(): void;\n cleanUp(): void;\n private cleanAllRenderedItems;\n private primeScrollTarget;\n private getElementPoolLimit;\n private acquireElement;\n private releaseRenderedItem;\n private renderedItemOwnsFocus;\n private fixContainerFocus;\n private cleanElement;\n private queueElementForPool;\n private promotePendingPooledElements;\n private isElementClean;\n private getElementPoolSize;\n private clearElementPool;\n private invalidateElementPool;\n private markElementPoolGenerationCurrent;\n private isElementPoolGenerationCurrent;\n private resolveEffectiveScrollBehavior;\n scrollTo(target: CodeViewScrollTarget): void;\n setSelectedLines(selection: CodeViewLineSelection | null, options?: SelectionWriteOptions): void;\n getSelectedLines(): CodeViewLineSelection | null;\n clearSelectedLines(options?: SelectionWriteOptions): void;\n getItem(itemId: string): CodeViewItem<LAnnotation> | undefined;\n updateItem(input: CodeViewItem<LAnnotation>): boolean;\n updateItemId(oldId: string, newId: string): boolean;\n addItem(input: CodeViewItem<LAnnotation>): void;\n addItems(inputs: readonly CodeViewItem<LAnnotation>[]): void;\n setItems(items: readonly CodeViewItem<LAnnotation>[]): void;\n /**\n * Append new records to the viewer while preserving existing layout state.\n * This is the shared path for imperative adds and the append-only reconcile\n * fast path, so it measures new items immediately and only triggers render\n * once at the end.\n */\n private appendItemsInternal;\n private canSkipRenderForAppend;\n onThemeChange(): void;\n setOptions(options: CodeViewOptions<LAnnotation> | undefined): void;\n private capturePendingLayoutAnchor;\n render(immediate?: boolean): void;\n instanceChanged(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>, layoutDirty: boolean): void;\n getWindowSpecs(): VirtualWindowSpecs;\n getContainerElement(): HTMLElement | undefined;\n getRenderedItems(): CodeViewRenderedItem<LAnnotation>[];\n setSlotCoordinator(coordinator?: CodeViewCoordinator<LAnnotation>): boolean;\n getSlotSnapshot(coordinator: CodeViewCoordinator<LAnnotation>): CodeViewRenderedItem<LAnnotation>[] | undefined;\n subscribeToScroll(listener: CodeViewScrollListener<LAnnotation>): () => void;\n getLocalTopForInstance(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>): number;\n getTopForItem(id: string): number | undefined;\n private createItem;\n private applySelectedLines;\n private syncSelection;\n private renamePendingScrollTarget;\n private renamePendingLayoutAnchor;\n private createFileOptionsPrototype;\n private createDiffOptionsPrototype;\n private createFileOptions;\n private createDiffOptions;\n private updateItemOptionsId;\n private getItemOptions;\n private defineItemSharedCallback;\n private defineItemSelectionCallback;\n /**\n * Track the earliest index whose measured layout may now be stale. Later\n * render passes relayout from this point forward so we do not have to rebuild\n * positions for the whole list after every change.\n */\n private markLayoutDirtyFromIndex;\n /**\n * Mark the earliest affected item as layout-dirty after an imperative change.\n * Each record carries its current array index so this stays O(1) even when\n * the viewer holds a very large number of items.\n */\n private markItemLayoutDirty;\n /**\n * Detect the common controlled-update case where the new list simply extends\n * the existing ordered prefix. When that happens we can reuse every current\n * record in place, sync any versioned payload changes, and append only the new\n * tail instead of rebuilding the whole list.\n */\n private tryAppendItems;\n /**\n * Reconcile a new controlled item list against the existing records by id.\n * This reuses records and instances when type matches, cleans up removed\n * records, rebuilds the lookup maps, and marks layout dirty whenever order,\n * membership, or versioned item data changes.\n */\n private reconcileItems;\n /**\n * Update a reused record from the latest controlled item only when its item\n * version changes. Matching versions mean CodeView keeps the current record\n * snapshot, which lets imperative updates remain in place until the caller\n * intentionally publishes a newer version.\n */\n private syncItemRecord;\n private getMaxScrollTopForHeight;\n private getMaxScrollTop;\n private shouldRebaseScroll;\n private getPagedScrollHeight;\n private getMaxPagedScrollTop;\n private clampPagedScrollTop;\n /**\n * Clamps a logical scroll position to the min/max allowable scroll range\n * based on the full computed content height.\n */\n private clampScrollTop;\n private getMaxScrollPageOffset;\n private clampScrollPageOffset;\n private resolveScrollPageWindow;\n /**\n * Resolve how a logical scrollTop maps onto the reusable paged scroll window\n * without mutating the current page offset.\n */\n private resolvePagedScrollPosition;\n private needsScrollPageUpdate;\n private getPagedLayoutTop;\n private getStickyHeaderOffset;\n private getScrollTargetRect;\n private normalizeScrollTarget;\n /**\n * Resolve a target's scroll position\n \n * Returns `undefined` when we can't resolve a target for whatever reason\n */\n private resolveScrollTargetTop;\n /**\n * Given an existing scroll target (scroll top and height), figure out the\n * correct scroll position to target based on the desired alignment, offset\n * and stickyOffset if necessary\n */\n private resolveAlignedScrollPosition;\n private getLineScrollPosition;\n private getRangeScrollPosition;\n /**\n * Determine target scroll position for current frame.\n *\n * If there's no pendingScrollTarget then we just return the current scroll\n * position\n *\n * If there's a pendingScrollTarget then we depend on whether there's a\n * smooth scroll animation or not. If not just return the destination, or\n * compute next position given the smooth scroll spring physics\n */\n private computeTargetScrollTopForFrame;\n /**\n * Closed-form critical-damped ODE step.\n *\n * Stable at any dt (Euler would blow up once ω·dt ≳ 1), so this survives\n * big RAF gaps (tab-wake, offscreen frames) and resize-driven ticks that\n * fire outside the normal RAF cadence.\n */\n private computeSpringStep;\n /**\n * For any given pendingScrollTarget, updates any in flight smooth scroll\n * animations and returns the target scrollTop to move towards\n *\n * Resolves the animation based on frame time and adopts any necessary scroll\n * anchoring corrections if necessary\n */\n private advanceScrollAnimation;\n private computeRenderRangeAndEmit;\n private flushManagers;\n private syncContainerHeight;\n private getStickyBounds;\n private applyStickyPositioning;\n private syncPagedScrollScaffolding;\n private reconcileRenderedItems;\n private updateStickyPositioning;\n private handleScroll;\n private clearPendingScroll;\n private handleResize;\n /**\n * Figure out scrollTop accounting for sticky header if enabled and\n * necessary\n */\n private getScrollAnchorViewportTop;\n /**\n * Attempt to find a scroll anchor based on build in metrics of the existing\n * rendered files/diff.\n *\n * A scroll anchor represents the first fully visible element (in other\n * words, the first file or first line who's top is fully in the viewport).\n */\n private getScrollAnchor;\n /**\n * Given a scroll anchor, attempt to resolve a newly updated (and clamped)\n * scroll position to keep the anchored element in place.\n *\n * If we can't resolve a position for whatever reason, we'll return\n * undefined.\n */\n private resolveAnchoredScrollTop;\n /**\n * Apply a device-pixel-rounded scroll position if it differs from the last\n * logical scrollTop synchronized into the paged scroll scaffold.\n */\n private applyScrollFix;\n /**\n * Decide whether a pending programmatic scroll has reached its\n * destination and should be cleared.\n */\n private isPendingTargetSettled;\n getScrollTop(): number;\n getHeight(): number;\n getScrollHeight(): number;\n private flushSlotCoordinator;\n private notifyScroll;\n /**\n * Find the first item whose bottom edge crosses into the viewport window.\n * This lets scroll-time rendering jump directly near the visible range instead\n * of linearly scanning from the start of very large item lists.\n */\n private findFirstVisibleIndex;\n /**\n * Find the last item whose top edge is still within the viewport window.\n * Paired with findFirstVisibleIndex, this bounds the render loop to only the\n * slice of items that can actually intersect the current scroll range.\n */\n private findLastVisibleIndex;\n /**\n * Recompute measured tops and heights starting from the earliest dirty item.\n * Earlier items keep their existing layout, while everything from startIndex\n * onward is remeasured so downstream positions and total scroll height stay\n * consistent after inserts, removals, or versioned item updates.\n */\n private recomputeLayout;\n private resetRenderState;\n private getFitPerfectlyOverscroll;\n}\nexport {};\n//# sourceMappingURL=CodeView.d.ts.map"],"mappings":";;;;;;;;;;;UAQUiB,2BAAAA;;;EAAAA;EAeAE,GAAAA,EAAAA,MAAAA;EAGiBC;EAAjBnB,MAAAA,EAAAA,MAAAA;EAEwBmB;;EALqBH,OAAAA,EAN1CC,WAM0CD,GAAAA,SAAAA;EAA2B;EAOxEI,OAAAA,EAAAA,MAAAA,GAAAA,SAAuB;EAGND;EAAjBlB,uBAAAA,EAAAA,MAAAA;;UAVAiB,uBAYIL,CAAAA,WAAAA,CAAAA,SAZyCG,2BAYzCH,CAAAA;EALyCG,IAAAA,EAAAA,MAAAA;EAA2B;EAOjEK,IAAAA,EAXPrB,gBAWOqB,CAXUF,WAWcA,CA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BP;mCAClBN,gBAAgBM,eAAeL,oBAAoBK"}
1
+ {"version":3,"file":"CodeView.d.ts","names":["SelectionWriteOptions","CodeViewDiffItem","CodeViewFileItem","CodeViewItem","CodeViewLayout","CodeViewScrollTarget","HunkSeparators","SelectedLineRange","SmoothScrollSettings","VirtualFileMetrics","VirtualWindowSpecs","WorkerPoolManager","FileOptions","FileDiffOptions","VirtualizedFile","VirtualizedFileDiff","VirtualizerConfig","AdvancedVirtualizedBaseItem","HTMLElement","CodeViewDiffItemContext","LAnnotation","CodeViewFileItemContext","CodeViewRenderedDiffItem","CodeViewRenderedFileItem","CodeViewRenderedItem","CodeViewLineSelection","CodeViewCoordinator","CodeViewScrollListener","CodeView","OverloadCallbackArgs","TCallback","TArgs","CallbackReturn","TReturn","OverloadFileCallbackArgs","TKey","NonNullable","OverloadDiffCallbackArgs","CodeViewOptionCallback","CODE_VIEW_DIFF_OPTION_KEYS","CodeViewDiffOptionKeys","CodeViewPassThroughOptions","Pick","CODE_VIEW_SHARED_CALLBACK_KEYS","CODE_VIEW_SELECTION_CALLBACK_KEYS","CodeViewSharedCallbackKeys","CodeViewSelectionCallbackKeys","CodeViewSharedCallbackOptions","CodeViewSelectionCallbackOptions","CodeViewOptions","Exclude","Partial"],"sources":["../../src/components/CodeView.d.ts"],"sourcesContent":["import type { SelectionWriteOptions } from '../managers/InteractionManager';\nimport type { CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewLayout, CodeViewScrollTarget, HunkSeparators, SelectedLineRange, SmoothScrollSettings, VirtualFileMetrics, VirtualWindowSpecs } from '../types';\nimport type { WorkerPoolManager } from '../worker';\nimport type { FileOptions } from './File';\nimport type { FileDiffOptions } from './FileDiff';\nimport { VirtualizedFile } from './VirtualizedFile';\nimport { VirtualizedFileDiff } from './VirtualizedFileDiff';\nimport type { VirtualizerConfig } from './Virtualizer';\ninterface AdvancedVirtualizedBaseItem {\n /** Current index of this record in the ordered items array. */\n index: number;\n /** Absolute top offset of this item inside the scroll content. */\n top: number;\n /** Total measured height reserved for this item. */\n height: number;\n /** Root <diffs-container> node currently mounted for this item, only exists\n * when rendered. */\n element: HTMLElement | undefined;\n /** Last controlled version observed for this record. */\n version: number | undefined;\n /** Last CodeView option revision this item rendered with. */\n renderedOptionsRevision: number;\n}\ninterface CodeViewDiffItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'diff';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewDiffItem<LAnnotation>;\n /** Virtualized diff instance responsible for rendering this item. */\n instance: VirtualizedFileDiff<LAnnotation>;\n}\ninterface CodeViewFileItemContext<LAnnotation> extends AdvancedVirtualizedBaseItem {\n type: 'file';\n /** Latest item snapshot for this record. Controlled updates can replace it. */\n item: CodeViewFileItem<LAnnotation>;\n /** Virtualized file instance responsible for rendering this item. */\n instance: VirtualizedFile<LAnnotation>;\n}\nexport interface CodeViewRenderedDiffItem<LAnnotation> {\n id: string;\n type: 'diff';\n item: CodeViewDiffItem<LAnnotation>;\n version: number | undefined;\n element: HTMLElement;\n instance: VirtualizedFileDiff<LAnnotation>;\n}\nexport interface CodeViewRenderedFileItem<LAnnotation> {\n id: string;\n type: 'file';\n item: CodeViewFileItem<LAnnotation>;\n version: number | undefined;\n element: HTMLElement;\n instance: VirtualizedFile<LAnnotation>;\n}\nexport type CodeViewRenderedItem<LAnnotation> = CodeViewRenderedDiffItem<LAnnotation> | CodeViewRenderedFileItem<LAnnotation>;\nexport interface CodeViewLineSelection {\n id: string;\n range: SelectedLineRange;\n}\nexport interface CodeViewCoordinator<LAnnotation> {\n hasHeaderRenderers: boolean;\n hasAnnotationRenderer: boolean;\n hasGutterRenderer: boolean;\n onSnapshotChange(snapshot: CodeViewRenderedItem<LAnnotation>[] | undefined): void;\n}\nexport type CodeViewScrollListener<LAnnotation> = (scrollTop: number, viewer: CodeView<LAnnotation>) => void;\ntype OverloadCallbackArgs<TCallback> = TCallback extends (...args: infer TArgs) => unknown ? TArgs : never;\ntype CallbackReturn<TCallback> = TCallback extends (...args: never[]) => infer TReturn ? TReturn : never;\ntype OverloadFileCallbackArgs<LAnnotation, TKey extends keyof FileOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileOptions<LAnnotation>[TKey]>>;\ntype OverloadDiffCallbackArgs<LAnnotation, TKey extends keyof FileDiffOptions<LAnnotation>> = OverloadCallbackArgs<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\ntype CodeViewOptionCallback<LAnnotation, TKey extends keyof FileOptions<LAnnotation> & keyof FileDiffOptions<LAnnotation>> = {\n (...args: [\n ...OverloadFileCallbackArgs<LAnnotation, TKey>,\n context: CodeViewFileItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileOptions<LAnnotation>[TKey]>>;\n (...args: [\n ...OverloadDiffCallbackArgs<LAnnotation, TKey>,\n context: CodeViewDiffItemContext<LAnnotation>\n ]): CallbackReturn<NonNullable<FileDiffOptions<LAnnotation>[TKey]>>;\n};\ndeclare const CODE_VIEW_DIFF_OPTION_KEYS: readonly [\"theme\", \"disableLineNumbers\", \"overflow\", \"themeType\", \"disableFileHeader\", \"disableVirtualizationBuffers\", \"preferredHighlighter\", \"useCSSClasses\", \"useTokenTransformer\", \"tokenizeMaxLineLength\", \"tokenizeMaxLength\", \"unsafeCSS\", \"diffStyle\", \"diffIndicators\", \"disableBackground\", \"expandUnchanged\", \"collapsedContextThreshold\", \"lineDiffType\", \"maxLineDiffLength\", \"expansionLineCount\", \"lineHoverHighlight\", \"enableTokenInteractionsOnWhitespace\", \"enableGutterUtility\", \"__debugPointerEvents\", \"enableLineSelection\", \"controlledSelection\", \"disableErrorHandling\"];\ntype CodeViewDiffOptionKeys = (typeof CODE_VIEW_DIFF_OPTION_KEYS)[number];\ntype CodeViewPassThroughOptions<LAnnotation> = Pick<FileDiffOptions<LAnnotation>, CodeViewDiffOptionKeys>;\ndeclare const CODE_VIEW_SHARED_CALLBACK_KEYS: readonly [\"renderCustomHeader\", \"renderHeaderPrefix\", \"renderHeaderMetadata\", \"renderAnnotation\", \"renderGutterUtility\", \"onPostRender\", \"onGutterUtilityClick\", \"onLineClick\", \"onLineNumberClick\", \"onLineEnter\", \"onLineLeave\", \"onTokenClick\", \"onTokenEnter\", \"onTokenLeave\"];\ndeclare const CODE_VIEW_SELECTION_CALLBACK_KEYS: readonly [\"onLineSelected\", \"onLineSelectionStart\", \"onLineSelectionChange\", \"onLineSelectionEnd\"];\ntype CodeViewSharedCallbackKeys = (typeof CODE_VIEW_SHARED_CALLBACK_KEYS)[number];\ntype CodeViewSelectionCallbackKeys = (typeof CODE_VIEW_SELECTION_CALLBACK_KEYS)[number];\ntype CodeViewSharedCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSharedCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\ntype CodeViewSelectionCallbackOptions<LAnnotation> = {\n [TKey in CodeViewSelectionCallbackKeys]?: CodeViewOptionCallback<LAnnotation, TKey>;\n};\nexport interface CodeViewOptions<LAnnotation> extends CodeViewPassThroughOptions<LAnnotation>, CodeViewSharedCallbackOptions<LAnnotation>, CodeViewSelectionCallbackOptions<LAnnotation> {\n hunkSeparators?: Exclude<HunkSeparators, 'custom'>;\n itemMetrics?: Partial<VirtualFileMetrics>;\n pointerEventsOnScroll?: boolean;\n smoothScrollSettings?: SmoothScrollSettings;\n stickyHeaders?: boolean;\n controlledSelection?: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n layout?: CodeViewLayout;\n /** Internal dev-only check to ensure your `itemMetrics` are correct. Its\n * automatically disabled in a production build because it will hurt\n * performance fairly significantly */\n __devOnlyValidateItemHeights?: boolean;\n}\nexport declare class CodeView<LAnnotation = undefined> {\n static __STOP: boolean;\n static __lastScrollPosition: number;\n type: \"advanced\";\n readonly config: VirtualizerConfig;\n private items;\n private idToItem;\n private selectedLines;\n private instanceToItem;\n private layoutDirtyIndex;\n private pendingLayoutReset;\n private renderOptionsRevision;\n private slotCoordinator;\n private slotSnapshot;\n private scrollListeners;\n private scrollHeight;\n private containerHeight;\n private scrollTop;\n private scrollPageOffset;\n private scrollDirty;\n private scrollInteractionFixTimer;\n private pointerEventsDisabled;\n private codeOverflowFix;\n private height;\n private heightDirty;\n private windowSpecs;\n private renderState;\n private itemMetricsCache;\n private readonly fileOptionsPrototype;\n private readonly diffOptionsPrototype;\n private pendingScrollTarget;\n private pendingLayoutAnchor;\n private shouldFixContainerFocus;\n private scrollAnimation;\n private root;\n private resizeObserver;\n private container;\n private stickyContainer;\n private stickyOffset;\n private elementPool;\n private elementPoolVersion;\n private elementPoolTracker;\n private pendingElementPool;\n private options;\n private workerManager;\n private isContainerManaged;\n constructor(options?: CodeViewOptions<LAnnotation>, workerManager?: WorkerPoolManager | undefined, isContainerManaged?: boolean);\n private getLayout;\n private computeMetricsCache;\n private getSmoothScrollSettings;\n private shouldDisablePointerEvents;\n private shouldValidateItemHeights;\n private validateRenderedItemHeight;\n private validateStickyContainerHeight;\n private clearScrollInteractionTimer;\n private suspendScrollInteractions;\n private restoreScrollInteractions;\n private syncLayout;\n setup(root: HTMLElement): void;\n reset(): void;\n cleanUp(): void;\n private cleanAllRenderedItems;\n private primeScrollTarget;\n private getElementPoolLimit;\n private acquireElement;\n private releaseRenderedItem;\n private renderedItemOwnsFocus;\n private fixContainerFocus;\n private cleanElement;\n private queueElementForPool;\n private promotePendingPooledElements;\n private isElementClean;\n private getElementPoolSize;\n private clearElementPool;\n private invalidateElementPool;\n private markElementPoolGenerationCurrent;\n private isElementPoolGenerationCurrent;\n private resolveEffectiveScrollBehavior;\n scrollTo(target: CodeViewScrollTarget): void;\n setSelectedLines(selection: CodeViewLineSelection | null, options?: SelectionWriteOptions): void;\n getSelectedLines(): CodeViewLineSelection | null;\n clearSelectedLines(options?: SelectionWriteOptions): void;\n getItem(itemId: string): CodeViewItem<LAnnotation> | undefined;\n updateItem(input: CodeViewItem<LAnnotation>): boolean;\n updateItemId(oldId: string, newId: string): boolean;\n addItem(input: CodeViewItem<LAnnotation>): void;\n addItems(inputs: readonly CodeViewItem<LAnnotation>[]): void;\n setItems(items: readonly CodeViewItem<LAnnotation>[]): void;\n /**\n * Append new records to the viewer while preserving existing layout state.\n * This is the shared path for imperative adds and the append-only reconcile\n * fast path, so it measures new items immediately and only triggers render\n * once at the end.\n */\n private appendItemsInternal;\n private canSkipRenderForAppend;\n onThemeChange(): void;\n setOptions(options: CodeViewOptions<LAnnotation> | undefined): void;\n private capturePendingLayoutAnchor;\n render(immediate?: boolean): void;\n instanceChanged(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>, layoutDirty: boolean): void;\n getWindowSpecs(): VirtualWindowSpecs;\n getContainerElement(): HTMLElement | undefined;\n getRenderedItems(): CodeViewRenderedItem<LAnnotation>[];\n setSlotCoordinator(coordinator?: CodeViewCoordinator<LAnnotation>): boolean;\n getSlotSnapshot(coordinator: CodeViewCoordinator<LAnnotation>): CodeViewRenderedItem<LAnnotation>[] | undefined;\n subscribeToScroll(listener: CodeViewScrollListener<LAnnotation>): () => void;\n getLocalTopForInstance(instance: VirtualizedFile<LAnnotation> | VirtualizedFileDiff<LAnnotation>): number;\n getTopForItem(id: string): number | undefined;\n private createItem;\n private applySelectedLines;\n private syncSelection;\n private renamePendingScrollTarget;\n private renamePendingLayoutAnchor;\n private createFileOptionsPrototype;\n private createDiffOptionsPrototype;\n private createFileOptions;\n private createDiffOptions;\n private updateItemOptionsId;\n private getItemOptions;\n private defineItemSharedCallback;\n private defineItemSelectionCallback;\n /**\n * Track the earliest index whose measured layout may now be stale. Later\n * render passes relayout from this point forward so we do not have to rebuild\n * positions for the whole list after every change.\n */\n private markLayoutDirtyFromIndex;\n /**\n * Mark the earliest affected item as layout-dirty after an imperative change.\n * Each record carries its current array index so this stays O(1) even when\n * the viewer holds a very large number of items.\n */\n private markItemLayoutDirty;\n /**\n * Detect the common controlled-update case where the new list simply extends\n * the existing ordered prefix. When that happens we can reuse every current\n * record in place, sync any versioned payload changes, and append only the new\n * tail instead of rebuilding the whole list.\n */\n private tryAppendItems;\n /**\n * Reconcile a new controlled item list against the existing records by id.\n * This reuses records and instances when type matches, cleans up removed\n * records, rebuilds the lookup maps, and marks layout dirty whenever order,\n * membership, or versioned item data changes.\n */\n private reconcileItems;\n /**\n * Update a reused record from the latest controlled item only when its item\n * version changes. Matching versions mean CodeView keeps the current record\n * snapshot, which lets imperative updates remain in place until the caller\n * intentionally publishes a newer version.\n */\n private syncItemRecord;\n private getMaxScrollTopForHeight;\n private getMaxScrollTop;\n private shouldRebaseScroll;\n private getPagedScrollHeight;\n private getMaxPagedScrollTop;\n private clampPagedScrollTop;\n /**\n * Clamps a logical scroll position to the min/max allowable scroll range\n * based on the full computed content height.\n */\n private clampScrollTop;\n private getMaxScrollPageOffset;\n private clampScrollPageOffset;\n private resolveScrollPageWindow;\n /**\n * Resolve how a logical scrollTop maps onto the reusable paged scroll window\n * without mutating the current page offset.\n */\n private resolvePagedScrollPosition;\n private needsScrollPageUpdate;\n private getPagedLayoutTop;\n private getStickyHeaderOffset;\n private getScrollTargetRect;\n private normalizeScrollTarget;\n /**\n * Resolve a target's scroll position\n \n * Returns `undefined` when we can't resolve a target for whatever reason\n */\n private resolveScrollTargetTop;\n /**\n * Given an existing scroll target (scroll top and height), figure out the\n * correct scroll position to target based on the desired alignment, offset\n * and stickyOffset if necessary\n */\n private resolveAlignedScrollPosition;\n private getLineScrollPosition;\n private getRangeScrollPosition;\n /**\n * Determine target scroll position for current frame.\n *\n * If there's no pendingScrollTarget then we just return the current scroll\n * position\n *\n * If there's a pendingScrollTarget then we depend on whether there's a\n * smooth scroll animation or not. If not just return the destination, or\n * compute next position given the smooth scroll spring physics\n */\n private computeTargetScrollTopForFrame;\n /**\n * Closed-form critical-damped ODE step.\n *\n * Stable at any dt (Euler would blow up once ω·dt ≳ 1), so this survives\n * big RAF gaps (tab-wake, offscreen frames) and resize-driven ticks that\n * fire outside the normal RAF cadence.\n */\n private computeSpringStep;\n /**\n * For any given pendingScrollTarget, updates any in flight smooth scroll\n * animations and returns the target scrollTop to move towards\n *\n * Resolves the animation based on frame time and adopts any necessary scroll\n * anchoring corrections if necessary\n */\n private advanceScrollAnimation;\n private computeRenderRangeAndEmit;\n private flushManagers;\n private syncContainerHeight;\n private getStickyBounds;\n private applyStickyPositioning;\n private syncPagedScrollScaffolding;\n private reconcileRenderedItems;\n private updateStickyPositioning;\n private handleScroll;\n private clearPendingScroll;\n private handleResize;\n /**\n * Figure out scrollTop accounting for sticky header if enabled and\n * necessary\n */\n private getScrollAnchorViewportTop;\n /**\n * Attempt to find a scroll anchor based on build in metrics of the existing\n * rendered files/diff.\n *\n * A scroll anchor represents the first fully visible element (in other\n * words, the first file or first line who's top is fully in the viewport).\n */\n private getScrollAnchor;\n /**\n * Given a scroll anchor, attempt to resolve a newly updated (and clamped)\n * scroll position to keep the anchored element in place.\n *\n * If we can't resolve a position for whatever reason, we'll return\n * undefined.\n */\n private resolveAnchoredScrollTop;\n /**\n * Apply a device-pixel-rounded scroll position if it differs from the last\n * logical scrollTop synchronized into the paged scroll scaffold.\n */\n private applyScrollFix;\n /**\n * Decide whether a pending programmatic scroll has reached its\n * destination and should be cleared.\n */\n private isPendingTargetSettled;\n getScrollTop(): number;\n getHeight(): number;\n getScrollHeight(): number;\n private flushSlotCoordinator;\n private notifyScroll;\n /**\n * Find the first item whose bottom edge crosses into the viewport window.\n * This lets scroll-time rendering jump directly near the visible range instead\n * of linearly scanning from the start of very large item lists.\n */\n private findFirstVisibleIndex;\n /**\n * Find the last item whose top edge is still within the viewport window.\n * Paired with findFirstVisibleIndex, this bounds the render loop to only the\n * slice of items that can actually intersect the current scroll range.\n */\n private findLastVisibleIndex;\n /**\n * Recompute measured tops and heights starting from the earliest dirty item.\n * Earlier items keep their existing layout, while everything from startIndex\n * onward is remeasured so downstream positions and total scroll height stay\n * consistent after inserts, removals, or versioned item updates.\n */\n private recomputeLayout;\n private resetRenderState;\n private getFitPerfectlyOverscroll;\n}\nexport {};\n//# source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BAAAA;EACqBP,QAAAA,iBAAAA;EAAhBN,QAAAA,YAAAA;EAAmDM,QAAAA,mBAAAA;EAApBL,QAAAA,4BAAAA;EAAmB,QAAA,cAAA;;;;;;;mBA7BlEV;8BACWoB,wCAAwCzB;sBAChDyB;+BACSzB;2BACJG,aAAaiB;oBACpBjB,aAAaiB;;iBAEhBjB,aAAaiB;4BACFjB,aAAaiB;2BACdjB,aAAaiB;;;;;;;;;;sBAUlB6B,gBAAgB7B;;;4BAGVN,gBAAgBM,eAAeL,oBAAoBK;oBAC3DV;yBACKQ;sBACHM,qBAAqBJ;mCACRM,oBAAoBN;+BACxBM,oBAAoBN,eAAeI,qBAAqBJ;8BACzDO,uBAAuBP;mCAClBN,gBAAgBM,eAAeL,oBAAoBK"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","names":["CodeViewLayout","HunkExpansionRegion","RenderRange","SmoothScrollSettings","ThemesType","VirtualFileMetrics","DIFFS_TAG_NAME","DIFFS_DEVELOPMENT_BUILD","COMMIT_METADATA_SPLIT","RegExp","GIT_DIFF_FILE_BREAK_REGEX","UNIFIED_DIFF_FILE_BREAK_REGEX","FILE_CONTEXT_BLOB","HUNK_HEADER","SPLIT_WITH_NEWLINES","FILENAME_HEADER_REGEX","FILENAME_HEADER_REGEX_GIT","ALTERNATE_FILE_NAMES_GIT","INDEX_LINE_METADATA","MERGE_CONFLICT_START_MARKER_REGEX","MERGE_CONFLICT_BASE_MARKER_REGEX","MERGE_CONFLICT_SEPARATOR_MARKER_REGEX","MERGE_CONFLICT_END_MARKER_REGEX","HEADER_PREFIX_SLOT_ID","HEADER_METADATA_SLOT_ID","CUSTOM_HEADER_SLOT_ID","DEFAULT_THEMES","THEME_CSS_ATTRIBUTE","UNSAFE_CSS_ATTRIBUTE","CORE_CSS_ATTRIBUTE","DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE","DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY","DEFAULT_COLLAPSED_CONTEXT_THRESHOLD","DEFAULT_TOKENIZE_MAX_LENGTH","DEFAULT_VIRTUAL_FILE_METRICS","DEFAULT_CODE_VIEW_FILE_METRICS","DEFAULT_CODE_VIEW_LAYOUT","DEFAULT_SMOOTH_SCROLL_SETTINGS","DEFAULT_EXPANDED_REGION","DEFAULT_RENDER_RANGE","EMPTY_RENDER_RANGE"],"sources":["../src/constants.d.ts"],"sourcesContent":["import type { CodeViewLayout, HunkExpansionRegion, RenderRange, SmoothScrollSettings, ThemesType, VirtualFileMetrics } from './types';\nexport declare const DIFFS_TAG_NAME: \"diffs-container\";\nexport declare const DIFFS_DEVELOPMENT_BUILD: boolean;\nexport declare const COMMIT_METADATA_SPLIT: RegExp;\nexport declare const GIT_DIFF_FILE_BREAK_REGEX: RegExp;\nexport declare const UNIFIED_DIFF_FILE_BREAK_REGEX: RegExp;\nexport declare const FILE_CONTEXT_BLOB: RegExp;\nexport declare const HUNK_HEADER: RegExp;\nexport declare const SPLIT_WITH_NEWLINES: RegExp;\nexport declare const FILENAME_HEADER_REGEX: RegExp;\nexport declare const FILENAME_HEADER_REGEX_GIT: RegExp;\nexport declare const ALTERNATE_FILE_NAMES_GIT: RegExp;\nexport declare const INDEX_LINE_METADATA: RegExp;\nexport declare const MERGE_CONFLICT_START_MARKER_REGEX: RegExp;\nexport declare const MERGE_CONFLICT_BASE_MARKER_REGEX: RegExp;\nexport declare const MERGE_CONFLICT_SEPARATOR_MARKER_REGEX: RegExp;\nexport declare const MERGE_CONFLICT_END_MARKER_REGEX: RegExp;\nexport declare const HEADER_PREFIX_SLOT_ID = \"header-prefix\";\nexport declare const HEADER_METADATA_SLOT_ID = \"header-metadata\";\nexport declare const CUSTOM_HEADER_SLOT_ID = \"header-custom\";\nexport declare const DEFAULT_THEMES: ThemesType;\nexport declare const THEME_CSS_ATTRIBUTE = \"data-theme-css\";\nexport declare const UNSAFE_CSS_ATTRIBUTE = \"data-unsafe-css\";\nexport declare const CORE_CSS_ATTRIBUTE = \"data-core-css\";\nexport declare const DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE = \"data-diffs-scrollbar-measure\";\nexport declare const DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY = \"--diffs-scrollbar-gutter-measured\";\nexport declare const DEFAULT_COLLAPSED_CONTEXT_THRESHOLD = 1;\nexport declare const DEFAULT_TOKENIZE_MAX_LENGTH = 100000;\nexport declare const DEFAULT_VIRTUAL_FILE_METRICS: VirtualFileMetrics;\nexport declare const DEFAULT_CODE_VIEW_FILE_METRICS: VirtualFileMetrics;\nexport declare const DEFAULT_CODE_VIEW_LAYOUT: CodeViewLayout;\nexport declare const DEFAULT_SMOOTH_SCROLL_SETTINGS: SmoothScrollSettings;\nexport declare const DEFAULT_EXPANDED_REGION: HunkExpansionRegion;\nexport declare const DEFAULT_RENDER_RANGE: RenderRange;\nexport declare const EMPTY_RENDER_RANGE: RenderRange;\n//# sourceMappingURL=constants.d.ts.map"],"mappings":";;;cACqBM;cACAC;AADAD,cAEAE,qBAFiC,EAEVC,MAFU;AACjCF,cAEAG,yBAFgC,EAELD,MAFK;AAChCD,cAEAG,6BAF6B,EAEEF,MAFF;AAC7BC,cAEAE,iBAFiC,EAEdH,MAFQA;AAC3BE,cAEAE,WAFAF,EAEaF,MAFwB;AACrCG,cAEAE,mBAFmBL,EAEEA,MAFI;AACzBI,cAEAE,qBAFmB,EAEIN,MAFJ;AACnBK,cAEAE,yBAF2B,EAEAP,MAFA;AAC3BM,cAEAE,wBAFuBR,EAEGA,MAFG;AAC7BO,cAEAE,mBAFiC,EAEZT,MAFMA;AAC3BQ,cAEAE,iCAFgC,EAEGV,MAFH;AAChCS,cAEAE,gCAF2B,EAEOX,MAFP;AAC3BU,cAEAE,qCAFmCZ,EAEIA,MAFE;AACzCW,cAEAE,+BAFkCb,EAEDA,MAFO;AACxCY,cAEAE,qBAAAA,GAF6C,eAANd;AACvCa,cAEAE,uBAAAA,GAFuC,iBAAA;AACvCD,cAEAE,qBAAAA,GAFqB,eAAA;AACrBD,cAEAE,cAFuB,EAEPtB,UAFO;AACvBqB,cAEAE,mBAAAA,GAFqB,gBAAA;AACrBD,cAEAE,oBAAAA,GAFgBxB,iBAAU;AAC1BuB,cAEAE,kBAAAA,GAFmB,eAAA;AACnBD,cAEAE,iCAAAA,GAFoB,8BAAA;AACpBD,cAEAE,wCAAAA,GAFkB,mCAAA;AAClBD,cAEAE,mCAAAA,GAFiC,CAAA;AACjCD,cAEAE,2BAAAA,GAFwC,MAAA;AACxCD,cAEAE,4BAFmC,EAEL7B,kBAFK;AACnC4B,cAEAE,8BAF2B,EAEK9B,kBAFL;AAC3B6B,cAEAE,wBAFgD,EAEtBpC,cAFIK;AAC9B8B,cAEAE,8BAFgChC,EAEAF,oBAFkB;AAClDiC,cAEAE,uBAF0BtC,EAEDC,mBAFe;AACxCoC,cAEAE,oBAFoD,EAE9BrC,WAFUC;AAChCmC,cAEAE,kBAF4C,EAExBtC,WAFKD"}
1
+ {"version":3,"file":"constants.d.ts","names":["CodeViewLayout","HunkExpansionRegion","RenderRange","SmoothScrollSettings","ThemesType","VirtualFileMetrics","DIFFS_TAG_NAME","DIFFS_DEVELOPMENT_BUILD","COMMIT_METADATA_SPLIT","RegExp","GIT_DIFF_FILE_BREAK_REGEX","UNIFIED_DIFF_FILE_BREAK_REGEX","FILE_CONTEXT_BLOB","HUNK_HEADER","SPLIT_WITH_NEWLINES","FILENAME_HEADER_REGEX","FILENAME_HEADER_REGEX_GIT","ALTERNATE_FILE_NAMES_GIT","INDEX_LINE_METADATA","MERGE_CONFLICT_START_MARKER_REGEX","MERGE_CONFLICT_BASE_MARKER_REGEX","MERGE_CONFLICT_SEPARATOR_MARKER_REGEX","MERGE_CONFLICT_END_MARKER_REGEX","HEADER_PREFIX_SLOT_ID","HEADER_METADATA_SLOT_ID","CUSTOM_HEADER_SLOT_ID","DEFAULT_THEMES","THEME_CSS_ATTRIBUTE","UNSAFE_CSS_ATTRIBUTE","CORE_CSS_ATTRIBUTE","DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE","DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY","DEFAULT_COLLAPSED_CONTEXT_THRESHOLD","DEFAULT_TOKENIZE_MAX_LENGTH","DEFAULT_VIRTUAL_FILE_METRICS","DEFAULT_CODE_VIEW_FILE_METRICS","DEFAULT_CODE_VIEW_LAYOUT","DEFAULT_SMOOTH_SCROLL_SETTINGS","DEFAULT_EXPANDED_REGION","DEFAULT_RENDER_RANGE","EMPTY_RENDER_RANGE"],"sources":["../src/constants.d.ts"],"sourcesContent":["import type { CodeViewLayout, HunkExpansionRegion, RenderRange, SmoothScrollSettings, ThemesType, VirtualFileMetrics } from './types';\nexport declare const DIFFS_TAG_NAME: \"diffs-container\";\nexport declare const DIFFS_DEVELOPMENT_BUILD: boolean;\nexport declare const COMMIT_METADATA_SPLIT: RegExp;\nexport declare const GIT_DIFF_FILE_BREAK_REGEX: RegExp;\nexport declare const UNIFIED_DIFF_FILE_BREAK_REGEX: RegExp;\nexport declare const FILE_CONTEXT_BLOB: RegExp;\nexport declare const HUNK_HEADER: RegExp;\nexport declare const SPLIT_WITH_NEWLINES: RegExp;\nexport declare const FILENAME_HEADER_REGEX: RegExp;\nexport declare const FILENAME_HEADER_REGEX_GIT: RegExp;\nexport declare const ALTERNATE_FILE_NAMES_GIT: RegExp;\nexport declare const INDEX_LINE_METADATA: RegExp;\nexport declare const MERGE_CONFLICT_START_MARKER_REGEX: RegExp;\nexport declare const MERGE_CONFLICT_BASE_MARKER_REGEX: RegExp;\nexport declare const MERGE_CONFLICT_SEPARATOR_MARKER_REGEX: RegExp;\nexport declare const MERGE_CONFLICT_END_MARKER_REGEX: RegExp;\nexport declare const HEADER_PREFIX_SLOT_ID = \"header-prefix\";\nexport declare const HEADER_METADATA_SLOT_ID = \"header-metadata\";\nexport declare const CUSTOM_HEADER_SLOT_ID = \"header-custom\";\nexport declare const DEFAULT_THEMES: ThemesType;\nexport declare const THEME_CSS_ATTRIBUTE = \"data-theme-css\";\nexport declare const UNSAFE_CSS_ATTRIBUTE = \"data-unsafe-css\";\nexport declare const CORE_CSS_ATTRIBUTE = \"data-core-css\";\nexport declare const DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE = \"data-diffs-scrollbar-measure\";\nexport declare const DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY = \"--diffs-scrollbar-gutter-measured\";\nexport declare const DEFAULT_COLLAPSED_CONTEXT_THRESHOLD = 1;\nexport declare const DEFAULT_TOKENIZE_MAX_LENGTH = 100000;\nexport declare const DEFAULT_VIRTUAL_FILE_METRICS: VirtualFileMetrics;\nexport declare const DEFAULT_CODE_VIEW_FILE_METRICS: VirtualFileMetrics;\nexport declare const DEFAULT_CODE_VIEW_LAYOUT: CodeViewLayout;\nexport declare const DEFAULT_SMOOTH_SCROLL_SETTINGS: SmoothScrollSettings;\nexport declare const DEFAULT_EXPANDED_REGION: HunkExpansionRegion;\nexport declare const DEFAULT_RENDER_RANGE: RenderRange;\nexport declare const EMPTY_RENDER_RANGE: RenderRange;\n//# sourceMappingURL=constants.d.ts.map"],"mappings":";;;cACqBM;cACAC;AADAD,cAEAE,qBAFiC,EAEVC,MAFU;AACjCF,cAEAG,yBAFgC,EAELD,MAFK;AAChCD,cAEAG,6BAF6B,EAEEF,MAFF;AAC7BC,cAEAE,iBAFiC,EAEdH,MAFQA;AAC3BE,cAEAE,WAFAF,EAEaF,MAFwB;AACrCG,cAEAE,mBAFmBL,EAEEA,MAFI;AACzBI,cAEAE,qBAFmB,EAEIN,MAFJ;AACnBK,cAEAE,yBAF2B,EAEAP,MAFA;AAC3BM,cAEAE,wBAFuBR,EAEGA,MAFG;AAC7BO,cAEAE,mBAFiC,EAEZT,MAFMA;AAC3BQ,cAEAE,iCAFgC,EAEGV,MAFH;AAChCS,cAEAE,gCAF2B,EAEOX,MAFP;AAC3BU,cAEAE,qCAFmCZ,EAEIA,MAFE;AACzCW,cAEAE,+BAFkCb,EAEDA,MAFO;AACxCY,cAEAE,qBAAAA,GAF6C,eAANd;AACvCa,cAEAE,uBAAAA,GAFuC,iBAAA;AACvCD,cAEAE,qBAAAA,GAFqB,eAAA;AACrBD,cAEAE,cAFuB,EAEPtB,UAFO;AACvBqB,cAEAE,mBAAAA,GAFqB,gBAAA;AACrBD,cAEAE,oBAAAA,GAF0B,iBAAA;AAC1BD,cAEAE,kBAAAA,GAFmB,eAAA;AACnBD,cAEAE,iCAAAA,GAFoB,8BAAA;AACpBD,cAEAE,wCAAAA,GAFkB,mCAAA;AAClBD,cAEAE,mCAAAA,GAFiC,CAAA;AACjCD,cAEAE,2BAAAA,GAFwC,MAAA;AACxCD,cAEAE,4BAFmC,EAEL7B,kBAFK;AACnC4B,cAEAE,8BAF2B,EAEK9B,kBAFL;AAC3B6B,cAEAE,wBAFgD,EAEtBpC,cAFIK;AAC9B8B,cAEAE,8BAFgChC,EAEAF,oBAFkB;AAClDiC,cAEAE,uBAF0BtC,EAEDC,mBAFe;AACxCoC,cAEAE,oBAFoD,EAE9BrC,WAFUC;AAChCmC,cAEAE,kBAF4C,EAExBtC,WAFKD"}
@@ -1,11 +1,12 @@
1
1
  import { attachResolvedLanguages } from "./languages/attachResolvedLanguages.js";
2
2
  import { cleanUpResolvedLanguages } from "./languages/cleanUpResolvedLanguages.js";
3
3
  import { getResolvedOrResolveLanguage } from "./languages/getResolvedOrResolveLanguage.js";
4
+ import { themeResolver } from "./themes/themeResolver.js";
4
5
  import { attachResolvedThemes } from "./themes/attachResolvedThemes.js";
5
6
  import { cleanUpResolvedThemes } from "./themes/cleanUpResolvedThemes.js";
6
7
  import { getResolvedOrResolveTheme } from "./themes/getResolvedOrResolveTheme.js";
7
- import { registerCustomTheme } from "./themes/registerCustomTheme.js";
8
8
  import { createHighlighter, createJavaScriptRegexEngine, createOnigurumaEngine } from "shiki";
9
+ import { pierreThemes } from "@pierre/theming/themes";
9
10
 
10
11
  //#region src/highlighter/shared_highlighter.ts
11
12
  let highlighter;
@@ -59,34 +60,7 @@ async function disposeHighlighter() {
59
60
  cleanUpResolvedThemes();
60
61
  highlighter = void 0;
61
62
  }
62
- registerCustomTheme("pierre-dark", async () => {
63
- const { default: theme } = await import("@pierre/theme/pierre-dark");
64
- return {
65
- ...theme,
66
- name: "pierre-dark"
67
- };
68
- });
69
- registerCustomTheme("pierre-dark-soft", async () => {
70
- const { default: theme } = await import("@pierre/theme/pierre-dark-soft");
71
- return {
72
- ...theme,
73
- name: "pierre-dark-soft"
74
- };
75
- });
76
- registerCustomTheme("pierre-light", async () => {
77
- const { default: theme } = await import("@pierre/theme/pierre-light");
78
- return {
79
- ...theme,
80
- name: "pierre-light"
81
- };
82
- });
83
- registerCustomTheme("pierre-light-soft", async () => {
84
- const { default: theme } = await import("@pierre/theme/pierre-light-soft");
85
- return {
86
- ...theme,
87
- name: "pierre-light-soft"
88
- };
89
- });
63
+ for (const descriptor of pierreThemes.getThemes()) themeResolver.registerThemeIfAbsent(descriptor.name, descriptor.load);
90
64
 
91
65
  //#endregion
92
66
  export { disposeHighlighter, getHighlighterIfLoaded, getSharedHighlighter, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, preloadHighlighter };
@@ -1 +1 @@
1
- {"version":3,"file":"shared_highlighter.js","names":["highlighter: CachedOrLoadingHighlighterType","languageLoaders: Promise<ResolvedLanguage>[]","themeLoaders: Promise<ThemeRegistrationResolved>[]","themes"],"sources":["../../src/highlighter/shared_highlighter.ts"],"sourcesContent":["import {\n createHighlighter,\n createJavaScriptRegexEngine,\n createOnigurumaEngine,\n} from 'shiki';\n\nimport type {\n DiffsHighlighter,\n DiffsThemeNames,\n HighlighterTypes,\n SupportedLanguages,\n ThemeRegistrationResolved,\n} from '../types';\nimport type { ResolvedLanguage } from '../worker/types';\nimport { attachResolvedLanguages } from './languages/attachResolvedLanguages';\nimport { cleanUpResolvedLanguages } from './languages/cleanUpResolvedLanguages';\nimport { getResolvedOrResolveLanguage } from './languages/getResolvedOrResolveLanguage';\nimport { attachResolvedThemes } from './themes/attachResolvedThemes';\nimport { cleanUpResolvedThemes } from './themes/cleanUpResolvedThemes';\nimport { getResolvedOrResolveTheme } from './themes/getResolvedOrResolveTheme';\nimport { registerCustomTheme } from './themes/registerCustomTheme';\n\ntype CachedOrLoadingHighlighterType =\n | Promise<DiffsHighlighter>\n | DiffsHighlighter\n | undefined;\n\nlet highlighter: CachedOrLoadingHighlighterType;\n\ninterface HighlighterOptions {\n themes: DiffsThemeNames[];\n langs: SupportedLanguages[];\n preferredHighlighter?: HighlighterTypes;\n}\n\nexport async function getSharedHighlighter({\n themes,\n langs,\n preferredHighlighter = 'shiki-js',\n}: HighlighterOptions): Promise<DiffsHighlighter> {\n highlighter ??= createHighlighter({\n themes: [],\n langs: ['text'],\n engine:\n preferredHighlighter === 'shiki-wasm'\n ? createOnigurumaEngine(import('shiki/wasm'))\n : createJavaScriptRegexEngine(),\n }) as Promise<DiffsHighlighter>;\n\n const instance = isHighlighterLoading(highlighter)\n ? await highlighter\n : highlighter;\n highlighter = instance;\n\n const languageLoaders: Promise<ResolvedLanguage>[] = [];\n for (const language of langs) {\n if (language === 'text' || language === 'ansi') continue;\n const maybeResolvedLanguage = getResolvedOrResolveLanguage(language);\n if ('then' in maybeResolvedLanguage) {\n languageLoaders.push(maybeResolvedLanguage);\n } else {\n attachResolvedLanguages(maybeResolvedLanguage, instance);\n }\n }\n\n const themeLoaders: Promise<ThemeRegistrationResolved>[] = [];\n for (const themeName of themes) {\n const maybeResolvedTheme = getResolvedOrResolveTheme(themeName);\n if ('then' in maybeResolvedTheme) {\n themeLoaders.push(maybeResolvedTheme);\n } else {\n attachResolvedThemes(maybeResolvedTheme, highlighter);\n }\n }\n\n // If we need to load any languages or themes, lets do that now\n if (languageLoaders.length > 0 || themeLoaders.length > 0) {\n await Promise.all([\n Promise.all(languageLoaders).then((languages) => {\n attachResolvedLanguages(languages, instance);\n }),\n Promise.all(themeLoaders).then((themes) => {\n attachResolvedThemes(themes, instance);\n }),\n ]);\n }\n\n return instance;\n}\n\nexport function isHighlighterLoaded(\n h: CachedOrLoadingHighlighterType = highlighter\n): h is DiffsHighlighter {\n return h != null && !('then' in h);\n}\n\nexport function getHighlighterIfLoaded(): DiffsHighlighter | undefined {\n if (highlighter != null && !('then' in highlighter)) {\n return highlighter;\n }\n return undefined;\n}\n\nexport function isHighlighterLoading(\n h: CachedOrLoadingHighlighterType = highlighter\n): h is Promise<DiffsHighlighter> {\n return h != null && 'then' in h;\n}\n\nexport function isHighlighterNull(\n h: CachedOrLoadingHighlighterType = highlighter\n): h is undefined {\n return h == null;\n}\n\nexport async function preloadHighlighter(\n options: HighlighterOptions\n): Promise<void> {\n return void (await getSharedHighlighter(options));\n}\n\nexport async function disposeHighlighter(): Promise<void> {\n if (highlighter == null) return;\n (await highlighter).dispose();\n cleanUpResolvedLanguages();\n cleanUpResolvedThemes();\n highlighter = undefined;\n}\n\nregisterCustomTheme('pierre-dark', async () => {\n const { default: theme } = await import('@pierre/theme/pierre-dark');\n return { ...theme, name: 'pierre-dark' } as ThemeRegistrationResolved;\n});\n\nregisterCustomTheme('pierre-dark-soft', async () => {\n const { default: theme } = await import('@pierre/theme/pierre-dark-soft');\n return { ...theme, name: 'pierre-dark-soft' } as ThemeRegistrationResolved;\n});\n\nregisterCustomTheme('pierre-light', async () => {\n const { default: theme } = await import('@pierre/theme/pierre-light');\n return { ...theme, name: 'pierre-light' } as ThemeRegistrationResolved;\n});\n\nregisterCustomTheme('pierre-light-soft', async () => {\n const { default: theme } = await import('@pierre/theme/pierre-light-soft');\n return { ...theme, name: 'pierre-light-soft' } as ThemeRegistrationResolved;\n});\n"],"mappings":";;;;;;;;;;AA2BA,IAAIA;AAQJ,eAAsB,qBAAqB,EACzC,QACA,OACA,uBAAuB,cACyB;AAChD,iBAAgB,kBAAkB;EAChC,QAAQ,EAAE;EACV,OAAO,CAAC,OAAO;EACf,QACE,yBAAyB,eACrB,sBAAsB,OAAO,cAAc,GAC3C,6BAA6B;EACpC,CAAC;CAEF,MAAM,WAAW,qBAA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EACxC;AAEF,oBAAoB,oBAAoB,YAAY;CAClD,MAAM,EAAE,SAAS,UAAU,MAAM,OAAO;AACxC,QAAO;EAAE,GAAG;EAAO,MAAM;EAAoB;EAC7C;AAEF,oBAAoB,gBAAgB,YAAY;CAC9C,MAAM,EAAE,SAAS,UAAU,MAAM,OAAO;AACxC,QAAO;EAAE,GAAG;EAAO,MAAM;EAAgB;EACzC;AAEF,oBAAoB,qBAAqB,YAAY;CACnD,MAAM,EAAE,SAAS,UAAU,MAAM,OAAO;AACxC,QAAO;EAAE,GAAG;EAAO,MAAM;EAAqB;EAC9C"}
1
+ {"version":3,"file":"shared_highlighter.js","names":["highlighter: CachedOrLoadingHighlighterType","languageLoaders: Promise<ResolvedLanguage>[]","themeLoaders: Promise<ThemeRegistrationResolved>[]","themes"],"sources":["../../src/highlighter/shared_highlighter.ts"],"sourcesContent":["import type { ThemeLoader } from '@pierre/theming';\nimport { pierreThemes } from '@pierre/theming/themes';\nimport {\n createHighlighter,\n createJavaScriptRegexEngine,\n createOnigurumaEngine,\n} from 'shiki';\n\nimport type {\n DiffsHighlighter,\n DiffsThemeNames,\n HighlighterTypes,\n SupportedLanguages,\n ThemeRegistrationResolved,\n} from '../types';\nimport type { ResolvedLanguage } from '../worker/types';\nimport { attachResolvedLanguages } from './languages/attachResolvedLanguages';\nimport { cleanUpResolvedLanguages } from './languages/cleanUpResolvedLanguages';\nimport { getResolvedOrResolveLanguage } from './languages/getResolvedOrResolveLanguage';\nimport { attachResolvedThemes } from './themes/attachResolvedThemes';\nimport { cleanUpResolvedThemes } from './themes/cleanUpResolvedThemes';\nimport { getResolvedOrResolveTheme } from './themes/getResolvedOrResolveTheme';\nimport { themeResolver } from './themes/themeResolver';\n\ntype CachedOrLoadingHighlighterType =\n | Promise<DiffsHighlighter>\n | DiffsHighlighter\n | undefined;\n\nlet highlighter: CachedOrLoadingHighlighterType;\n\ninterface HighlighterOptions {\n themes: DiffsThemeNames[];\n langs: SupportedLanguages[];\n preferredHighlighter?: HighlighterTypes;\n}\n\nexport async function getSharedHighlighter({\n themes,\n langs,\n preferredHighlighter = 'shiki-js',\n}: HighlighterOptions): Promise<DiffsHighlighter> {\n highlighter ??= createHighlighter({\n themes: [],\n langs: ['text'],\n engine:\n preferredHighlighter === 'shiki-wasm'\n ? createOnigurumaEngine(import('shiki/wasm'))\n : createJavaScriptRegexEngine(),\n }) as Promise<DiffsHighlighter>;\n\n const instance = isHighlighterLoading(highlighter)\n ? await highlighter\n : highlighter;\n highlighter = instance;\n\n const languageLoaders: Promise<ResolvedLanguage>[] = [];\n for (const language of langs) {\n if (language === 'text' || language === 'ansi') continue;\n const maybeResolvedLanguage = getResolvedOrResolveLanguage(language);\n if ('then' in maybeResolvedLanguage) {\n languageLoaders.push(maybeResolvedLanguage);\n } else {\n attachResolvedLanguages(maybeResolvedLanguage, instance);\n }\n }\n\n const themeLoaders: Promise<ThemeRegistrationResolved>[] = [];\n for (const themeName of themes) {\n const maybeResolvedTheme = getResolvedOrResolveTheme(themeName);\n if ('then' in maybeResolvedTheme) {\n themeLoaders.push(maybeResolvedTheme);\n } else {\n attachResolvedThemes(maybeResolvedTheme, highlighter);\n }\n }\n\n // If we need to load any languages or themes, lets do that now\n if (languageLoaders.length > 0 || themeLoaders.length > 0) {\n await Promise.all([\n Promise.all(languageLoaders).then((languages) => {\n attachResolvedLanguages(languages, instance);\n }),\n Promise.all(themeLoaders).then((themes) => {\n attachResolvedThemes(themes, instance);\n }),\n ]);\n }\n\n return instance;\n}\n\nexport function isHighlighterLoaded(\n h: CachedOrLoadingHighlighterType = highlighter\n): h is DiffsHighlighter {\n return h != null && !('then' in h);\n}\n\nexport function getHighlighterIfLoaded(): DiffsHighlighter | undefined {\n if (highlighter != null && !('then' in highlighter)) {\n return highlighter;\n }\n return undefined;\n}\n\nexport function isHighlighterLoading(\n h: CachedOrLoadingHighlighterType = highlighter\n): h is Promise<DiffsHighlighter> {\n return h != null && 'then' in h;\n}\n\nexport function isHighlighterNull(\n h: CachedOrLoadingHighlighterType = highlighter\n): h is undefined {\n return h == null;\n}\n\nexport async function preloadHighlighter(\n options: HighlighterOptions\n): Promise<void> {\n return void (await getSharedHighlighter(options));\n}\n\nexport async function disposeHighlighter(): Promise<void> {\n if (highlighter == null) return;\n (await highlighter).dispose();\n cleanUpResolvedLanguages();\n cleanUpResolvedThemes();\n highlighter = undefined;\n}\n\nfor (const descriptor of pierreThemes.getThemes()) {\n themeResolver.registerThemeIfAbsent(\n descriptor.name,\n descriptor.load as ThemeLoader<ThemeRegistrationResolved>\n );\n}\n"],"mappings":";;;;;;;;;;;AA6BA,IAAIA;AAQJ,eAAsB,qBAAqB,EACzC,QACA,OACA,uBAAuB,cACyB;AAChD,iBAAgB,kBAAkB;EAChC,QAAQ,EAAE;EACV,OAAO,CAAC,OAAO;EACf,QACE,yBAAyB,eACrB,sBAAsB,OAAO,cAAc,GAC3C,6BAA6B;EACpC,CAAC;CAEF,MAAM,WAAW,qBAAqB,YAAY,GAC9C,MAAM,cACN;AACJ,eAAc;CAEd,MAAMC,kBAA+C,EAAE;AACvD,MAAK,MAAM,YAAY,OAAO;AAC5B,MAAI,aAAa,UAAU,aAAa,OAAQ;EAChD,MAAM,wBAAwB,6BAA6B,SAAS;AACpE,MAAI,UAAU,sBACZ,iBAAgB,KAAK,sBAAsB;MAE3C,yBAAwB,uBAAuB,SAAS;;CAI5D,MAAMC,eAAqD,EAAE;AAC7D,MAAK,MAAM,aAAa,QAAQ;EAC9B,MAAM,qBAAqB,0BAA0B,UAAU;AAC/D,MAAI,UAAU,mBACZ,cAAa,KAAK,mBAAmB;MAErC,sBAAqB,oBAAoB,YAAY;;AAKzD,KAAI,gBAAgB,SAAS,KAAK,aAAa,SAAS,EACtD,OAAM,QAAQ,IAAI,CAChB,QAAQ,IAAI,gBAAgB,CAAC,MAAM,cAAc;AAC/C,0BAAwB,WAAW,SAAS;GAC5C,EACF,QAAQ,IAAI,aAAa,CAAC,MAAM,aAAW;AACzC,uBAAqBC,UAAQ,SAAS;GACtC,CACH,CAAC;AAGJ,QAAO;;AAGT,SAAgB,oBACd,IAAoC,aACb;AACvB,QAAO,KAAK,QAAQ,EAAE,UAAU;;AAGlC,SAAgB,yBAAuD;AACrE,KAAI,eAAe,QAAQ,EAAE,UAAU,aACrC,QAAO;;AAKX,SAAgB,qBACd,IAAoC,aACJ;AAChC,QAAO,KAAK,QAAQ,UAAU;;AAGhC,SAAgB,kBACd,IAAoC,aACpB;AAChB,QAAO,KAAK;;AAGd,eAAsB,mBACpB,SACe;AACR,CAAM,MAAM,qBAAqB,QAAQ;;AAGlD,eAAsB,qBAAoC;AACxD,KAAI,eAAe,KAAM;AACzB,EAAC,MAAM,aAAa,SAAS;AAC7B,2BAA0B;AAC1B,wBAAuB;AACvB,eAAc;;AAGhB,KAAK,MAAM,cAAc,aAAa,WAAW,CAC/C,eAAc,sBACZ,WAAW,MACX,WAAW,KACZ"}
@@ -1,4 +1,5 @@
1
- import { AttachedThemes, ResolvedThemes } from "./constants.js";
1
+ import { AttachedThemes } from "./constants.js";
2
+ import { themeResolver } from "./themeResolver.js";
2
3
 
3
4
  //#region src/highlighter/themes/attachResolvedThemes.ts
4
5
  function attachResolvedThemes(themes, highlighter) {
@@ -6,12 +7,12 @@ function attachResolvedThemes(themes, highlighter) {
6
7
  for (let themeRef of themes) {
7
8
  let resolvedTheme;
8
9
  if (typeof themeRef === "string") {
9
- resolvedTheme = ResolvedThemes.get(themeRef);
10
+ resolvedTheme = themeResolver.getResolvedTheme(themeRef);
10
11
  if (resolvedTheme == null) throw new Error(`loadResolvedThemes: ${themeRef} is not resolved, you must resolve it before calling loadResolvedThemes`);
11
12
  } else {
12
13
  resolvedTheme = themeRef;
13
14
  themeRef = themeRef.name;
14
- if (!ResolvedThemes.has(themeRef)) ResolvedThemes.set(themeRef, resolvedTheme);
15
+ if (themeResolver.getResolvedTheme(themeRef) == null) themeResolver.seedResolvedTheme(themeRef, resolvedTheme);
15
16
  }
16
17
  if (AttachedThemes.has(themeRef)) continue;
17
18
  AttachedThemes.add(themeRef);
@@ -1 +1 @@
1
- {"version":3,"file":"attachResolvedThemes.js","names":["resolvedTheme: ThemeRegistrationResolved | undefined"],"sources":["../../../src/highlighter/themes/attachResolvedThemes.ts"],"sourcesContent":["import type {\n DiffsHighlighter,\n DiffsThemeNames,\n ThemeRegistrationResolved,\n} from '../../types';\nimport { AttachedThemes, ResolvedThemes } from './constants';\n\nexport function attachResolvedThemes(\n themes:\n | DiffsThemeNames\n | ThemeRegistrationResolved\n | (DiffsThemeNames | ThemeRegistrationResolved)[],\n highlighter: DiffsHighlighter\n): void {\n themes = Array.isArray(themes) ? themes : [themes];\n for (let themeRef of themes) {\n let resolvedTheme: ThemeRegistrationResolved | undefined;\n if (typeof themeRef === 'string') {\n resolvedTheme = ResolvedThemes.get(themeRef);\n if (resolvedTheme == null) {\n throw new Error(\n `loadResolvedThemes: ${themeRef} is not resolved, you must resolve it before calling loadResolvedThemes`\n );\n }\n } else {\n resolvedTheme = themeRef;\n themeRef = themeRef.name;\n if (!ResolvedThemes.has(themeRef)) {\n ResolvedThemes.set(themeRef, resolvedTheme);\n }\n }\n if (AttachedThemes.has(themeRef)) continue;\n AttachedThemes.add(themeRef);\n highlighter.loadThemeSync(resolvedTheme);\n }\n}\n"],"mappings":";;;AAOA,SAAgB,qBACd,QAIA,aACM;AACN,UAAS,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO;AAClD,MAAK,IAAI,YAAY,QAAQ;EAC3B,IAAIA;AACJ,MAAI,OAAO,aAAa,UAAU;AAChC,mBAAgB,eAAe,IAAI,SAAS;AAC5C,OAAI,iBAAiB,KACnB,OAAM,IAAI,MACR,uBAAuB,SAAS,yEACjC;SAEE;AACL,mBAAgB;AAChB,cAAW,SAAS;AACpB,OAAI,CAAC,eAAe,IAAI,SAAS,CAC/B,gBAAe,IAAI,UAAU,cAAc;;AAG/C,MAAI,eAAe,IAAI,SAAS,CAAE;AAClC,iBAAe,IAAI,SAAS;AAC5B,cAAY,cAAc,cAAc"}
1
+ {"version":3,"file":"attachResolvedThemes.js","names":["resolvedTheme: ThemeRegistrationResolved | undefined"],"sources":["../../../src/highlighter/themes/attachResolvedThemes.ts"],"sourcesContent":["import type {\n DiffsHighlighter,\n DiffsThemeNames,\n ThemeRegistrationResolved,\n} from '../../types';\nimport { AttachedThemes } from './constants';\nimport { themeResolver } from './themeResolver';\n\n// Loads resolved themes into the highlighter (loadThemeSync) and records them\n// in AttachedThemes so each theme is attached at most once. Accepts either a\n// name (which must already be resolved/cached) or a fully-resolved theme\n// object. Theme objects are seeded into the resolver when not already present —\n// this is the path workers use: they receive pre-resolved themes from the main\n// thread (they cannot call resolveTheme themselves) and need them available so\n// getResolvedThemes works synchronously.\nexport function attachResolvedThemes(\n themes:\n | DiffsThemeNames\n | ThemeRegistrationResolved\n | (DiffsThemeNames | ThemeRegistrationResolved)[],\n highlighter: DiffsHighlighter\n): void {\n themes = Array.isArray(themes) ? themes : [themes];\n for (let themeRef of themes) {\n let resolvedTheme: ThemeRegistrationResolved | undefined;\n if (typeof themeRef === 'string') {\n resolvedTheme = themeResolver.getResolvedTheme(themeRef);\n if (resolvedTheme == null) {\n throw new Error(\n `loadResolvedThemes: ${themeRef} is not resolved, you must resolve it before calling loadResolvedThemes`\n );\n }\n } else {\n resolvedTheme = themeRef;\n themeRef = themeRef.name;\n if (themeResolver.getResolvedTheme(themeRef) == null) {\n themeResolver.seedResolvedTheme(themeRef, resolvedTheme);\n }\n }\n if (AttachedThemes.has(themeRef)) continue;\n AttachedThemes.add(themeRef);\n highlighter.loadThemeSync(resolvedTheme);\n }\n}\n"],"mappings":";;;;AAeA,SAAgB,qBACd,QAIA,aACM;AACN,UAAS,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO;AAClD,MAAK,IAAI,YAAY,QAAQ;EAC3B,IAAIA;AACJ,MAAI,OAAO,aAAa,UAAU;AAChC,mBAAgB,cAAc,iBAAiB,SAAS;AACxD,OAAI,iBAAiB,KACnB,OAAM,IAAI,MACR,uBAAuB,SAAS,yEACjC;SAEE;AACL,mBAAgB;AAChB,cAAW,SAAS;AACpB,OAAI,cAAc,iBAAiB,SAAS,IAAI,KAC9C,eAAc,kBAAkB,UAAU,cAAc;;AAG5D,MAAI,eAAe,IAAI,SAAS,CAAE;AAClC,iBAAe,IAAI,SAAS;AAC5B,cAAY,cAAc,cAAc"}
@@ -1,8 +1,9 @@
1
- import { AttachedThemes, ResolvedThemes } from "./constants.js";
1
+ import { AttachedThemes } from "./constants.js";
2
+ import { themeResolver } from "./themeResolver.js";
2
3
 
3
4
  //#region src/highlighter/themes/cleanUpResolvedThemes.ts
4
5
  function cleanUpResolvedThemes() {
5
- ResolvedThemes.clear();
6
+ themeResolver.clearResolvedThemes();
6
7
  AttachedThemes.clear();
7
8
  }
8
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"cleanUpResolvedThemes.js","names":[],"sources":["../../../src/highlighter/themes/cleanUpResolvedThemes.ts"],"sourcesContent":["import { AttachedThemes, ResolvedThemes } from './constants';\n\nexport function cleanUpResolvedThemes(): void {\n ResolvedThemes.clear();\n AttachedThemes.clear();\n}\n"],"mappings":";;;AAEA,SAAgB,wBAA8B;AAC5C,gBAAe,OAAO;AACtB,gBAAe,OAAO"}
1
+ {"version":3,"file":"cleanUpResolvedThemes.js","names":[],"sources":["../../../src/highlighter/themes/cleanUpResolvedThemes.ts"],"sourcesContent":["import { AttachedThemes } from './constants';\nimport { themeResolver } from './themeResolver';\n\n// Clears the resolved-theme cache (and any in-flight loads) plus the set of\n// themes attached to the highlighter. Registered loaders are intentionally\n// preserved, so previously registered custom/pierre/bundled themes can be\n// resolved again without re-registering.\nexport function cleanUpResolvedThemes(): void {\n themeResolver.clearResolvedThemes();\n AttachedThemes.clear();\n}\n"],"mappings":";;;;AAOA,SAAgB,wBAA8B;AAC5C,eAAc,qBAAqB;AACnC,gBAAe,OAAO"}
@@ -1,11 +1,5 @@
1
- import { DiffsThemeNames } from "../../types.js";
2
- import { ThemeRegistration, ThemeRegistrationResolved } from "shiki";
3
-
4
1
  //#region src/highlighter/themes/constants.d.ts
5
- declare const ResolvedThemes: Map<DiffsThemeNames, ThemeRegistrationResolved>;
6
- declare const ResolvingThemes: Map<DiffsThemeNames, Promise<ThemeRegistrationResolved>>;
7
- declare const RegisteredCustomThemes: Map<string, () => Promise<ThemeRegistrationResolved | ThemeRegistration>>;
8
2
  declare const AttachedThemes: Set<string>;
9
3
  //#endregion
10
- export { AttachedThemes, RegisteredCustomThemes, ResolvedThemes, ResolvingThemes };
4
+ export { AttachedThemes };
11
5
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","names":["ThemeRegistration","ThemeRegistrationResolved","DiffsThemeNames","ResolvedThemes","Map","ResolvingThemes","Promise","RegisteredCustomThemes","AttachedThemes","Set"],"sources":["../../../src/highlighter/themes/constants.d.ts"],"sourcesContent":["import type { ThemeRegistration, ThemeRegistrationResolved } from 'shiki';\nimport type { DiffsThemeNames } from '../../types';\nexport declare const ResolvedThemes: Map<DiffsThemeNames, ThemeRegistrationResolved>;\nexport declare const ResolvingThemes: Map<DiffsThemeNames, Promise<ThemeRegistrationResolved>>;\nexport declare const RegisteredCustomThemes: Map<string, () => Promise<ThemeRegistrationResolved | ThemeRegistration>>;\nexport declare const AttachedThemes: Set<string>;\n//# sourceMappingURL=constants.d.ts.map"],"mappings":";;;;cAEqBG,gBAAgBC,IAAIF,iBAAiBD;cACrCI,iBAAiBD,IAAIF,iBAAiBI,QAAQL;AAD9CE,cAEAI,sBAF+D,EAEvCH,GAFuC,CAAA,MAAA,EAAA,GAAA,GAErBE,OAFqB,CAEbL,yBAFa,GAEeD,iBAFf,CAAA,CAAA;AAA3CE,cAGpBM,cAHoBN,EAGJO,GAHIP,CAAAA,MAAAA,CAAAA"}
1
+ {"version":3,"file":"constants.d.ts","names":["AttachedThemes","Set"],"sources":["../../../src/highlighter/themes/constants.d.ts"],"sourcesContent":["export declare const AttachedThemes: Set<string>;\n//# sourceMappingURL=constants.d.ts.map"],"mappings":";cAAqBA,gBAAgBC"}
@@ -1,9 +1,6 @@
1
1
  //#region src/highlighter/themes/constants.ts
2
- const ResolvedThemes = /* @__PURE__ */ new Map();
3
- const ResolvingThemes = /* @__PURE__ */ new Map();
4
- const RegisteredCustomThemes = /* @__PURE__ */ new Map();
5
2
  const AttachedThemes = /* @__PURE__ */ new Set();
6
3
 
7
4
  //#endregion
8
- export { AttachedThemes, RegisteredCustomThemes, ResolvedThemes, ResolvingThemes };
5
+ export { AttachedThemes };
9
6
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["ResolvedThemes: Map<DiffsThemeNames, ThemeRegistrationResolved>","ResolvingThemes: Map<\n DiffsThemeNames,\n Promise<ThemeRegistrationResolved>\n>","RegisteredCustomThemes: Map<\n string,\n () => Promise<ThemeRegistrationResolved | ThemeRegistration>\n>","AttachedThemes: Set<string>"],"sources":["../../../src/highlighter/themes/constants.ts"],"sourcesContent":["import type { ThemeRegistration, ThemeRegistrationResolved } from 'shiki';\n\nimport type { DiffsThemeNames } from '../../types';\n\nexport const ResolvedThemes: Map<DiffsThemeNames, ThemeRegistrationResolved> =\n new Map();\n\nexport const ResolvingThemes: Map<\n DiffsThemeNames,\n Promise<ThemeRegistrationResolved>\n> = new Map();\n\nexport const RegisteredCustomThemes: Map<\n string,\n () => Promise<ThemeRegistrationResolved | ThemeRegistration>\n> = new Map();\n\nexport const AttachedThemes: Set<string> = new Set();\n"],"mappings":";AAIA,MAAaA,iCACX,IAAI,KAAK;AAEX,MAAaC,kCAGT,IAAI,KAAK;AAEb,MAAaC,yCAGT,IAAI,KAAK;AAEb,MAAaC,iCAA8B,IAAI,KAAK"}
1
+ {"version":3,"file":"constants.js","names":["AttachedThemes: Set<string>"],"sources":["../../../src/highlighter/themes/constants.ts"],"sourcesContent":["// Names of themes that have been loaded into the active highlighter via\n// loadThemeSync. This is the highlighter-attachment concern, kept separate from\n// the resolved-theme cache in the diffs theme resolver. Cleared by\n// cleanUpResolvedThemes when the highlighter is disposed.\nexport const AttachedThemes: Set<string> = new Set();\n"],"mappings":";AAIA,MAAaA,iCAA8B,IAAI,KAAK"}
@@ -1,9 +1,9 @@
1
- import { ResolvedThemes } from "./constants.js";
1
+ import { themeResolver } from "./themeResolver.js";
2
2
  import { resolveTheme } from "./resolveTheme.js";
3
3
 
4
4
  //#region src/highlighter/themes/getResolvedOrResolveTheme.ts
5
5
  function getResolvedOrResolveTheme(themeName) {
6
- return ResolvedThemes.get(themeName) ?? resolveTheme(themeName);
6
+ return themeResolver.getResolvedTheme(themeName) ?? resolveTheme(themeName);
7
7
  }
8
8
 
9
9
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getResolvedOrResolveTheme.js","names":[],"sources":["../../../src/highlighter/themes/getResolvedOrResolveTheme.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { ResolvedThemes } from './constants';\nimport { resolveTheme } from './resolveTheme';\n\nexport function getResolvedOrResolveTheme(\n themeName: DiffsThemeNames\n): ThemeRegistrationResolved | Promise<ThemeRegistrationResolved> {\n return ResolvedThemes.get(themeName) ?? resolveTheme(themeName);\n}\n"],"mappings":";;;;AAIA,SAAgB,0BACd,WACgE;AAChE,QAAO,eAAe,IAAI,UAAU,IAAI,aAAa,UAAU"}
1
+ {"version":3,"file":"getResolvedOrResolveTheme.js","names":[],"sources":["../../../src/highlighter/themes/getResolvedOrResolveTheme.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { resolveTheme } from './resolveTheme';\nimport { themeResolver } from './themeResolver';\n\n// Returns the resolved theme synchronously when it is already cached, otherwise\n// kicks off (and returns the Promise for) a full resolveTheme. Uses the diffs\n// resolveTheme wrapper for the cold path so the worker guard, bundled fallback,\n// and name validation still apply.\nexport function getResolvedOrResolveTheme(\n themeName: DiffsThemeNames\n): ThemeRegistrationResolved | Promise<ThemeRegistrationResolved> {\n return themeResolver.getResolvedTheme(themeName) ?? resolveTheme(themeName);\n}\n"],"mappings":";;;;AAQA,SAAgB,0BACd,WACgE;AAChE,QAAO,cAAc,iBAAiB,UAAU,IAAI,aAAa,UAAU"}
@@ -1,14 +1,8 @@
1
- import { ResolvedThemes } from "./constants.js";
1
+ import { themeResolver } from "./themeResolver.js";
2
2
 
3
3
  //#region src/highlighter/themes/getResolvedThemes.ts
4
4
  function getResolvedThemes(themeNames) {
5
- const resolvedThemes = [];
6
- for (const themeName of themeNames) {
7
- const theme = ResolvedThemes.get(themeName);
8
- if (theme == null) throw new Error(`getAllResolvedThemes: ${themeName} is unresolved, you must resolve all necessary themes before calling this function`);
9
- resolvedThemes.push(theme);
10
- }
11
- return resolvedThemes;
5
+ return themeResolver.getResolvedThemes(themeNames);
12
6
  }
13
7
 
14
8
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getResolvedThemes.js","names":["resolvedThemes: ThemeRegistrationResolved[]"],"sources":["../../../src/highlighter/themes/getResolvedThemes.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { ResolvedThemes } from './constants';\n\n// This method should only be called if you know all themes are resolved,\n// otherwise it will fail. The main intention is a helper to avoid an async\n// tick if we don't actually need it\nexport function getResolvedThemes(\n themeNames: DiffsThemeNames[]\n): ThemeRegistrationResolved[] {\n const resolvedThemes: ThemeRegistrationResolved[] = [];\n for (const themeName of themeNames) {\n const theme = ResolvedThemes.get(themeName);\n if (theme == null) {\n throw new Error(\n `getAllResolvedThemes: ${themeName} is unresolved, you must resolve all necessary themes before calling this function`\n );\n }\n resolvedThemes.push(theme);\n }\n return resolvedThemes;\n}\n"],"mappings":";;;AAMA,SAAgB,kBACd,YAC6B;CAC7B,MAAMA,iBAA8C,EAAE;AACtD,MAAK,MAAM,aAAa,YAAY;EAClC,MAAM,QAAQ,eAAe,IAAI,UAAU;AAC3C,MAAI,SAAS,KACX,OAAM,IAAI,MACR,yBAAyB,UAAU,oFACpC;AAEH,iBAAe,KAAK,MAAM;;AAE5B,QAAO"}
1
+ {"version":3,"file":"getResolvedThemes.js","names":[],"sources":["../../../src/highlighter/themes/getResolvedThemes.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { themeResolver } from './themeResolver';\n\n// This method should only be called if you know all themes are resolved,\n// otherwise it will fail. The main intention is a helper to avoid an async\n// tick if we don't actually need it\nexport function getResolvedThemes(\n themeNames: DiffsThemeNames[]\n): ThemeRegistrationResolved[] {\n return themeResolver.getResolvedThemes(themeNames);\n}\n"],"mappings":";;;AAMA,SAAgB,kBACd,YAC6B;AAC7B,QAAO,cAAc,kBAAkB,WAAW"}
@@ -1,9 +1,8 @@
1
- import { ResolvedThemes } from "./constants.js";
1
+ import { themeResolver } from "./themeResolver.js";
2
2
 
3
3
  //#region src/highlighter/themes/hasResolvedThemes.ts
4
4
  function hasResolvedThemes(themeNames) {
5
- for (const themeName of themeNames) if (!ResolvedThemes.has(themeName)) return false;
6
- return true;
5
+ return themeResolver.hasResolvedThemes(themeNames);
7
6
  }
8
7
 
9
8
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"hasResolvedThemes.js","names":[],"sources":["../../../src/highlighter/themes/hasResolvedThemes.ts"],"sourcesContent":["import type { DiffsThemeNames } from '../../types';\nimport { ResolvedThemes } from './constants';\n\nexport function hasResolvedThemes(themeNames: DiffsThemeNames[]): boolean {\n for (const themeName of themeNames) {\n if (!ResolvedThemes.has(themeName)) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";;;AAGA,SAAgB,kBAAkB,YAAwC;AACxE,MAAK,MAAM,aAAa,WACtB,KAAI,CAAC,eAAe,IAAI,UAAU,CAChC,QAAO;AAGX,QAAO"}
1
+ {"version":3,"file":"hasResolvedThemes.js","names":[],"sources":["../../../src/highlighter/themes/hasResolvedThemes.ts"],"sourcesContent":["import type { DiffsThemeNames } from '../../types';\nimport { themeResolver } from './themeResolver';\n\nexport function hasResolvedThemes(themeNames: DiffsThemeNames[]): boolean {\n return themeResolver.hasResolvedThemes(themeNames);\n}\n"],"mappings":";;;AAGA,SAAgB,kBAAkB,YAAwC;AACxE,QAAO,cAAc,kBAAkB,WAAW"}
@@ -1,5 +1,5 @@
1
- import { registerCustomTheme } from "./registerCustomTheme.js";
2
1
  import { formatCSSVariablePrefix } from "../../utils/formatCSSVariablePrefix.js";
2
+ import { registerCustomTheme } from "./registerCustomTheme.js";
3
3
  import { createCssVariablesTheme } from "shiki";
4
4
 
5
5
  //#region src/highlighter/themes/registerCustomCSSVariableTheme.ts
@@ -1,7 +1,9 @@
1
- import { ThemeRegistration, ThemeRegistrationResolved } from "shiki";
1
+ import { ThemeRegistration, ThemeRegistrationResolved } from "../../types.js";
2
+ import { ThemeLoader } from "@pierre/theming";
2
3
 
3
4
  //#region src/highlighter/themes/registerCustomTheme.d.ts
4
- declare function registerCustomTheme(themeName: string, loader: () => Promise<ThemeRegistrationResolved | ThemeRegistration>): void;
5
+ type CustomThemeLoader = ThemeLoader<ThemeRegistration | ThemeRegistrationResolved>;
6
+ declare function registerCustomTheme(themeName: string, loader: CustomThemeLoader): void;
5
7
  //#endregion
6
- export { registerCustomTheme };
8
+ export { CustomThemeLoader, registerCustomTheme };
7
9
  //# sourceMappingURL=registerCustomTheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registerCustomTheme.d.ts","names":["ThemeRegistration","ThemeRegistrationResolved","registerCustomTheme","Promise"],"sources":["../../../src/highlighter/themes/registerCustomTheme.d.ts"],"sourcesContent":["import type { ThemeRegistration, ThemeRegistrationResolved } from 'shiki';\nexport declare function registerCustomTheme(themeName: string, loader: () => Promise<ThemeRegistrationResolved | ThemeRegistration>): void;\n//# sourceMappingURL=registerCustomTheme.d.ts.map"],"mappings":";;;iBACwBE,mBAAAA,kCAAqDC,QAAQF,4BAA4BD"}
1
+ {"version":3,"file":"registerCustomTheme.d.ts","names":["ThemeLoader","ThemeRegistration","ThemeRegistrationResolved","CustomThemeLoader","registerCustomTheme"],"sources":["../../../src/highlighter/themes/registerCustomTheme.d.ts"],"sourcesContent":["import { type ThemeLoader } from '@pierre/theming';\nimport type { ThemeRegistration, ThemeRegistrationResolved } from '../../types';\nexport type CustomThemeLoader = ThemeLoader<ThemeRegistration | ThemeRegistrationResolved>;\nexport declare function registerCustomTheme(themeName: string, loader: CustomThemeLoader): void;\n//# sourceMappingURL=registerCustomTheme.d.ts.map"],"mappings":";;;;KAEYG,iBAAAA,GAAoBH,YAAYC,oBAAoBC;iBACxCE,mBAAAA,4BAA+CD"}
@@ -1,12 +1,22 @@
1
- import { RegisteredCustomThemes } from "./constants.js";
1
+ import { themeResolver } from "./themeResolver.js";
2
+ import { createTheme } from "@pierre/theming/themes";
3
+ import { DuplicateThemeError } from "@pierre/theming";
2
4
 
3
5
  //#region src/highlighter/themes/registerCustomTheme.ts
4
6
  function registerCustomTheme(themeName, loader) {
5
- if (RegisteredCustomThemes.has(themeName)) {
6
- console.error("SharedHighlight.registerCustomTheme: theme name already registered", themeName);
7
- return;
7
+ try {
8
+ const descriptor = createTheme({
9
+ name: themeName,
10
+ load: loader
11
+ });
12
+ themeResolver.registerTheme(descriptor.name, descriptor.load);
13
+ } catch (error) {
14
+ if (error instanceof DuplicateThemeError) {
15
+ console.error("SharedHighlight.registerCustomTheme: theme name already registered", themeName);
16
+ return;
17
+ }
18
+ throw error;
8
19
  }
9
- RegisteredCustomThemes.set(themeName, loader);
10
20
  }
11
21
 
12
22
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"registerCustomTheme.js","names":[],"sources":["../../../src/highlighter/themes/registerCustomTheme.ts"],"sourcesContent":["import type { ThemeRegistration, ThemeRegistrationResolved } from 'shiki';\n\nimport { RegisteredCustomThemes } from './constants';\n\nexport function registerCustomTheme(\n themeName: string,\n loader: () => Promise<ThemeRegistrationResolved | ThemeRegistration>\n): void {\n if (RegisteredCustomThemes.has(themeName)) {\n console.error(\n 'SharedHighlight.registerCustomTheme: theme name already registered',\n themeName\n );\n return;\n }\n RegisteredCustomThemes.set(themeName, loader);\n}\n"],"mappings":";;;AAIA,SAAgB,oBACd,WACA,QACM;AACN,KAAI,uBAAuB,IAAI,UAAU,EAAE;AACzC,UAAQ,MACN,sEACA,UACD;AACD;;AAEF,wBAAuB,IAAI,WAAW,OAAO"}
1
+ {"version":3,"file":"registerCustomTheme.js","names":[],"sources":["../../../src/highlighter/themes/registerCustomTheme.ts"],"sourcesContent":["import { DuplicateThemeError, type ThemeLoader } from '@pierre/theming';\nimport { createTheme } from '@pierre/theming/themes';\n\nimport type { ThemeRegistration, ThemeRegistrationResolved } from '../../types';\nimport { themeResolver } from './themeResolver';\n\nexport type CustomThemeLoader = ThemeLoader<\n ThemeRegistration | ThemeRegistrationResolved\n>;\n\n// Registers a named custom theme loader on the diffs resolver. The loader is\n// wrapped by createTheme so its result is run through Shiki's\n// normalizeTheme before caching — this preserves the legacy behavior where\n// every resolved theme (custom, Pierre, or Shiki-provided) was normalized, so\n// its fg/bg are derived from the colors map. Re-registering an existing name is\n// a no-op that logs, matching the previous contract (the generic resolver throws\n// DuplicateThemeError, which we translate back into the log-and-return shape).\nexport function registerCustomTheme(\n themeName: string,\n loader: CustomThemeLoader\n): void {\n try {\n const descriptor = createTheme<ThemeRegistrationResolved>({\n name: themeName,\n load: loader,\n });\n themeResolver.registerTheme(descriptor.name, descriptor.load);\n } catch (error) {\n if (error instanceof DuplicateThemeError) {\n console.error(\n 'SharedHighlight.registerCustomTheme: theme name already registered',\n themeName\n );\n return;\n }\n throw error;\n }\n}\n"],"mappings":";;;;;AAiBA,SAAgB,oBACd,WACA,QACM;AACN,KAAI;EACF,MAAM,aAAa,YAAuC;GACxD,MAAM;GACN,MAAM;GACP,CAAC;AACF,gBAAc,cAAc,WAAW,MAAM,WAAW,KAAK;UACtD,OAAO;AACd,MAAI,iBAAiB,qBAAqB;AACxC,WAAQ,MACN,sEACA,UACD;AACD;;AAEF,QAAM"}
@@ -1,33 +1,12 @@
1
- import { isWorkerContext } from "../../utils/isWorkerContext.js";
2
- import { RegisteredCustomThemes, ResolvedThemes, ResolvingThemes } from "./constants.js";
3
- import { bundledThemes, normalizeTheme } from "shiki";
1
+ import { themeResolver } from "./themeResolver.js";
2
+ import { prepareThemeResolution, validateResolvedThemeName } from "./themeResolution.js";
4
3
 
5
4
  //#region src/highlighter/themes/resolveTheme.ts
6
5
  async function resolveTheme(themeName) {
7
- if (isWorkerContext()) throw new Error(`resolveTheme("${themeName}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);
8
- const resolver = ResolvingThemes.get(themeName);
9
- if (resolver != null) return resolver;
10
- try {
11
- const loader = RegisteredCustomThemes.get(themeName) ?? bundledThemes[themeName];
12
- if (loader == null) throw new Error(`resolveTheme: No valid loader for ${themeName}`);
13
- const resolver$1 = loader().then((result) => {
14
- return normalizeAndCacheResolvedTheme(themeName, "default" in result ? result.default : result);
15
- });
16
- ResolvingThemes.set(themeName, resolver$1);
17
- const theme = await resolver$1;
18
- if (theme.name !== themeName) throw new Error(`resolvedTheme: themeName: ${themeName} does not match theme.name: ${theme.name}`);
19
- ResolvedThemes.set(theme.name, theme);
20
- return theme;
21
- } finally {
22
- ResolvingThemes.delete(themeName);
23
- }
24
- }
25
- function normalizeAndCacheResolvedTheme(themeName, themeData) {
26
- const resolvedTheme = ResolvedThemes.get(themeName);
27
- if (resolvedTheme != null) return resolvedTheme;
28
- themeData = normalizeTheme(themeData);
29
- ResolvedThemes.set(themeName, themeData);
30
- return themeData;
6
+ prepareThemeResolution(themeName);
7
+ const theme = await themeResolver.resolveTheme(themeName);
8
+ validateResolvedThemeName(themeName, theme);
9
+ return theme;
31
10
  }
32
11
 
33
12
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"resolveTheme.js","names":["resolver"],"sources":["../../../src/highlighter/themes/resolveTheme.ts"],"sourcesContent":["import { bundledThemes, normalizeTheme } from 'shiki';\n\nimport type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { isWorkerContext } from '../../utils/isWorkerContext';\nimport {\n RegisteredCustomThemes,\n ResolvedThemes,\n ResolvingThemes,\n} from './constants';\n\nexport async function resolveTheme(\n themeName: DiffsThemeNames\n): Promise<ThemeRegistrationResolved> {\n if (isWorkerContext()) {\n throw new Error(\n `resolveTheme(\"${themeName}\") cannot be called from a worker context. ` +\n 'Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.'\n );\n }\n\n const resolver = ResolvingThemes.get(themeName);\n if (resolver != null) {\n return resolver;\n }\n\n try {\n const loader =\n RegisteredCustomThemes.get(themeName) ??\n bundledThemes[themeName as keyof typeof bundledThemes];\n\n if (loader == null) {\n throw new Error(`resolveTheme: No valid loader for ${themeName}`);\n }\n\n const resolver = loader().then((result) => {\n return normalizeAndCacheResolvedTheme(\n themeName,\n ('default' in result\n ? result.default\n : result) as ThemeRegistrationResolved\n );\n });\n\n ResolvingThemes.set(themeName, resolver);\n const theme = await resolver;\n if (theme.name !== themeName) {\n throw new Error(\n `resolvedTheme: themeName: ${themeName} does not match theme.name: ${theme.name}`\n );\n }\n ResolvedThemes.set(theme.name, theme);\n return theme;\n } finally {\n ResolvingThemes.delete(themeName);\n }\n}\n\nfunction normalizeAndCacheResolvedTheme(\n themeName: string,\n themeData: ThemeRegistrationResolved\n): ThemeRegistrationResolved {\n const resolvedTheme = ResolvedThemes.get(themeName);\n if (resolvedTheme != null) {\n return resolvedTheme;\n }\n themeData = normalizeTheme(themeData);\n ResolvedThemes.set(themeName, themeData);\n return themeData;\n}\n"],"mappings":";;;;;AAUA,eAAsB,aACpB,WACoC;AACpC,KAAI,iBAAiB,CACnB,OAAM,IAAI,MACR,iBAAiB,UAAU,yJAE5B;CAGH,MAAM,WAAW,gBAAgB,IAAI,UAAU;AAC/C,KAAI,YAAY,KACd,QAAO;AAGT,KAAI;EACF,MAAM,SACJ,uBAAuB,IAAI,UAAU,IACrC,cAAc;AAEhB,MAAI,UAAU,KACZ,OAAM,IAAI,MAAM,qCAAqC,YAAY;EAGnE,MAAMA,aAAW,QAAQ,CAAC,MAAM,WAAW;AACzC,UAAO,+BACL,WACC,aAAa,SACV,OAAO,UACP,OACL;IACD;AAEF,kBAAgB,IAAI,WAAWA,WAAS;EACxC,MAAM,QAAQ,MAAMA;AACpB,MAAI,MAAM,SAAS,UACjB,OAAM,IAAI,MACR,6BAA6B,UAAU,8BAA8B,MAAM,OAC5E;AAEH,iBAAe,IAAI,MAAM,MAAM,MAAM;AACrC,SAAO;WACC;AACR,kBAAgB,OAAO,UAAU;;;AAIrC,SAAS,+BACP,WACA,WAC2B;CAC3B,MAAM,gBAAgB,eAAe,IAAI,UAAU;AACnD,KAAI,iBAAiB,KACnB,QAAO;AAET,aAAY,eAAe,UAAU;AACrC,gBAAe,IAAI,WAAW,UAAU;AACxC,QAAO"}
1
+ {"version":3,"file":"resolveTheme.js","names":[],"sources":["../../../src/highlighter/themes/resolveTheme.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport {\n prepareThemeResolution,\n validateResolvedThemeName,\n} from './themeResolution';\nimport { themeResolver } from './themeResolver';\n\n// Resolves a theme by name to a normalized Shiki theme, delegating the cache,\n// concurrent-load dedupe, normalization, and registry to the shared\n// @pierre/theming resolver. The diffs-specific behavior layered on top:\n// 1. Worker-context guard — themes must be pre-resolved on the main thread\n// and handed to the worker, which seeds them via attachResolvedThemes.\n// 2. Bundled-theme fallback a name with no registered loader that matches a\n// Shiki bundled theme is registered on demand (per-name dynamic import),\n// so callers never have to pre-register the full Shiki theme set.\n// 3. theme.name validation the resolved theme's own name must match the\n// requested name, catching mismatched registrations early.\nexport async function resolveTheme(\n themeName: DiffsThemeNames\n): Promise<ThemeRegistrationResolved> {\n prepareThemeResolution(themeName);\n\n const theme = await themeResolver.resolveTheme(themeName);\n\n validateResolvedThemeName(themeName, theme);\n\n return theme;\n}\n"],"mappings":";;;;AAiBA,eAAsB,aACpB,WACoC;AACpC,wBAAuB,UAAU;CAEjC,MAAM,QAAQ,MAAM,cAAc,aAAa,UAAU;AAEzD,2BAA0B,WAAW,MAAM;AAE3C,QAAO"}
@@ -1,18 +1,11 @@
1
- import { resolveTheme } from "./resolveTheme.js";
2
- import { getResolvedOrResolveTheme } from "./getResolvedOrResolveTheme.js";
1
+ import { themeResolver } from "./themeResolver.js";
2
+ import { prepareThemeResolution, validateResolvedThemeName } from "./themeResolution.js";
3
3
 
4
4
  //#region src/highlighter/themes/resolveThemes.ts
5
5
  async function resolveThemes(themes) {
6
- const resolvedThemes = [];
7
- const themesToResolve = [];
8
- for (const themeName of themes) {
9
- const themeData = getResolvedOrResolveTheme(themeName) ?? resolveTheme(themeName);
10
- if ("then" in themeData) themesToResolve.push(themeData);
11
- else resolvedThemes.push(themeData);
12
- }
13
- if (themesToResolve.length > 0) await Promise.all(themesToResolve).then((resolved) => {
14
- for (const theme of resolved) if (theme != null) resolvedThemes.push(theme);
15
- });
6
+ for (const themeName of themes) prepareThemeResolution(themeName);
7
+ const resolvedThemes = await themeResolver.resolveThemes(themes);
8
+ for (let i = 0; i < themes.length; i++) validateResolvedThemeName(themes[i], resolvedThemes[i]);
16
9
  return resolvedThemes;
17
10
  }
18
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"resolveThemes.js","names":["resolvedThemes: ThemeRegistrationResolved[]","themesToResolve: Promise<ThemeRegistrationResolved | undefined>[]"],"sources":["../../../src/highlighter/themes/resolveThemes.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { getResolvedOrResolveTheme } from './getResolvedOrResolveTheme';\nimport { resolveTheme } from './resolveTheme';\n\nexport async function resolveThemes(\n themes: DiffsThemeNames[]\n): Promise<ThemeRegistrationResolved[]> {\n const resolvedThemes: ThemeRegistrationResolved[] = [];\n const themesToResolve: Promise<ThemeRegistrationResolved | undefined>[] = [];\n for (const themeName of themes) {\n const themeData =\n getResolvedOrResolveTheme(themeName) ?? resolveTheme(themeName);\n if ('then' in themeData) {\n themesToResolve.push(themeData);\n } else {\n resolvedThemes.push(themeData);\n }\n }\n\n if (themesToResolve.length > 0) {\n await Promise.all(themesToResolve).then((resolved) => {\n for (const theme of resolved) {\n if (theme != null) {\n resolvedThemes.push(theme);\n }\n }\n });\n }\n\n return resolvedThemes;\n}\n"],"mappings":";;;;AAIA,eAAsB,cACpB,QACsC;CACtC,MAAMA,iBAA8C,EAAE;CACtD,MAAMC,kBAAoE,EAAE;AAC5E,MAAK,MAAM,aAAa,QAAQ;EAC9B,MAAM,YACJ,0BAA0B,UAAU,IAAI,aAAa,UAAU;AACjE,MAAI,UAAU,UACZ,iBAAgB,KAAK,UAAU;MAE/B,gBAAe,KAAK,UAAU;;AAIlC,KAAI,gBAAgB,SAAS,EAC3B,OAAM,QAAQ,IAAI,gBAAgB,CAAC,MAAM,aAAa;AACpD,OAAK,MAAM,SAAS,SAClB,KAAI,SAAS,KACX,gBAAe,KAAK,MAAM;GAG9B;AAGJ,QAAO"}
1
+ {"version":3,"file":"resolveThemes.js","names":[],"sources":["../../../src/highlighter/themes/resolveThemes.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport {\n prepareThemeResolution,\n validateResolvedThemeName,\n} from './themeResolution';\nimport { themeResolver } from './themeResolver';\n\nexport async function resolveThemes(\n themes: DiffsThemeNames[]\n): Promise<ThemeRegistrationResolved[]> {\n for (const themeName of themes) {\n prepareThemeResolution(themeName);\n }\n\n const resolvedThemes = await themeResolver.resolveThemes(themes);\n for (let i = 0; i < themes.length; i++) {\n validateResolvedThemeName(themes[i], resolvedThemes[i]);\n }\n\n return resolvedThemes;\n}\n"],"mappings":";;;;AAOA,eAAsB,cACpB,QACsC;AACtC,MAAK,MAAM,aAAa,OACtB,wBAAuB,UAAU;CAGnC,MAAM,iBAAiB,MAAM,cAAc,cAAc,OAAO;AAChE,MAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,IACjC,2BAA0B,OAAO,IAAI,eAAe,GAAG;AAGzD,QAAO"}
@@ -0,0 +1,8 @@
1
+ import { DiffsThemeNames, ThemeRegistrationResolved } from "../../types.js";
2
+
3
+ //#region src/highlighter/themes/themeResolution.d.ts
4
+ declare function prepareThemeResolution(themeName: DiffsThemeNames): void;
5
+ declare function validateResolvedThemeName(themeName: DiffsThemeNames, theme: ThemeRegistrationResolved): void;
6
+ //#endregion
7
+ export { prepareThemeResolution, validateResolvedThemeName };
8
+ //# sourceMappingURL=themeResolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeResolution.d.ts","names":["DiffsThemeNames","ThemeRegistrationResolved","prepareThemeResolution","validateResolvedThemeName"],"sources":["../../../src/highlighter/themes/themeResolution.d.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nexport declare function prepareThemeResolution(themeName: DiffsThemeNames): void;\nexport declare function validateResolvedThemeName(themeName: DiffsThemeNames, theme: ThemeRegistrationResolved): void;\n//# sourceMappingURL=themeResolution.d.ts.map"],"mappings":";;;iBACwBE,sBAAAA,YAAkCF;iBAClCG,yBAAAA,YAAqCH,wBAAwBC"}