@singapore-editor/minimap 0.1.1 → 0.2.11

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/LICENSE +22 -0
  2. package/README.md +27 -10
  3. package/dist/assets/{minimap.worker-i4S59IOV.js → minimap.worker-C_eNmhCg.js} +114 -35
  4. package/dist/assets/minimap.worker-C_eNmhCg.js.map +1 -0
  5. package/dist/color.js +1 -2
  6. package/dist/decorationMerge.js +2 -3
  7. package/dist/decorationMerge.js.map +1 -1
  8. package/dist/documentSource.d.ts +42 -0
  9. package/dist/documentSource.d.ts.map +1 -0
  10. package/dist/documentSource.js +170 -0
  11. package/dist/documentSource.js.map +1 -0
  12. package/dist/index.d.ts +0 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -3
  15. package/dist/layout.js +0 -1
  16. package/dist/minimapCharRenderer.d.ts.map +1 -1
  17. package/dist/minimapCharRendererFactory.d.ts.map +1 -1
  18. package/dist/minimapCharSheet.d.ts.map +1 -1
  19. package/dist/minimapCharSheet.js +1 -2
  20. package/dist/options.js +1 -2
  21. package/dist/plugin.d.ts +1 -0
  22. package/dist/plugin.d.ts.map +1 -1
  23. package/dist/plugin.js +18 -5
  24. package/dist/plugin.js.map +1 -1
  25. package/dist/raster.d.ts.map +1 -1
  26. package/dist/renderer.d.ts +4 -1
  27. package/dist/renderer.d.ts.map +1 -1
  28. package/dist/sourceIdentity.d.ts +4 -0
  29. package/dist/sourceIdentity.d.ts.map +1 -0
  30. package/dist/sourceIdentity.js +10 -0
  31. package/dist/sourceIdentity.js.map +1 -0
  32. package/dist/sourceProtocol.d.ts +16 -0
  33. package/dist/sourceProtocol.d.ts.map +1 -0
  34. package/dist/style.css +1 -1
  35. package/dist/summary.d.ts +21 -0
  36. package/dist/summary.d.ts.map +1 -0
  37. package/dist/summary.js +174 -0
  38. package/dist/summary.js.map +1 -0
  39. package/dist/types.d.ts +27 -17
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/types.js +1 -2
  42. package/dist/types.js.map +1 -1
  43. package/dist/viewportGeometry.js +1 -2
  44. package/dist/workerClient.d.ts +21 -50
  45. package/dist/workerClient.d.ts.map +1 -1
  46. package/dist/workerClient.js +175 -680
  47. package/dist/workerClient.js.map +1 -1
  48. package/dist/workerOwner.d.ts +34 -0
  49. package/dist/workerOwner.d.ts.map +1 -0
  50. package/dist/workerOwner.js +168 -0
  51. package/dist/workerOwner.js.map +1 -0
  52. package/package.json +26 -8
  53. package/dist/assets/minimap.worker-i4S59IOV.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentSource.js","names":[],"sources":["../src/documentSource.ts"],"sourcesContent":["import type { EditorDocumentContributions } from '@singapore-editor/core/editor'\nimport {\n defineDocumentOperation,\n type DocumentOperationContext,\n type DocumentProjectionConnection,\n type DocumentProjectionReceipt,\n type DocumentProjectionUpdate,\n type DocumentWorkerIdentity,\n} from '@singapore-editor/core/internal/document-worker'\nimport { createError } from '@singapore-editor/core/logging/evlog'\nimport { sourceIdentitiesEqual } from './sourceIdentity'\nimport {\n documentSummaryPayload,\n documentSummaryPatchPayload,\n sequentialMinimapEdits,\n summarySource,\n} from './summary'\nimport type { MinimapSourceProjection, MinimapWorkerRequest, MinimapWorkerResponse } from './types'\nimport {\n MinimapWorkerOwner,\n type MinimapWorkerOwnerOptions,\n type MinimapWorkerOwnerSnapshot,\n} from './workerOwner'\n\ntype PendingProjection = {\n readonly identity: DocumentWorkerIdentity\n readonly tokensRebased: boolean\n resolve(receipt: DocumentProjectionReceipt): void\n reject(error: unknown): void\n detach(): void\n}\n\nexport type MinimapSourceResult = {\n readonly point: DocumentProjectionUpdate['read']['revision']['point']\n readonly receipt: DocumentProjectionReceipt\n readonly tokensRebased: boolean\n}\n\nlet nextWorkerGeneration = 0\n\nconst minimapDocumentOperation = defineDocumentOperation(\n (context, source: MinimapDocumentSource) => source.bind(context),\n (left, right) => left === right,\n)\n\nexport function retainMinimapDocumentSource(\n contributions: EditorDocumentContributions,\n options: MinimapWorkerOwnerOptions & { readonly maxColumn: number },\n) {\n const source = new MinimapDocumentSource(options)\n const lease = contributions.retain(minimapDocumentOperation, source)\n return lease ? { source, lease } : null\n}\n\nclass MinimapDocumentSource {\n private worker: MinimapWorkerOwner | null = null\n private connection: DocumentProjectionConnection | null = null\n private nextRegistration = 0\n private nextRequest = 0\n private tokensRebased = false\n private readonly pending = new Map<number, PendingProjection>()\n\n public constructor(\n private readonly options: MinimapWorkerOwnerOptions & { readonly maxColumn: number },\n ) {}\n\n public bind(context: DocumentOperationContext) {\n this.worker = new MinimapWorkerOwner({\n ...this.options,\n onMessage: this.handleMessage,\n onError: this.handleError,\n })\n this.connection = {\n generation: ++nextWorkerGeneration,\n nextRegistration: () => ++this.nextRegistration,\n admit: this.admit,\n release: this.release,\n }\n return {\n analyze: async (\n read: DocumentProjectionUpdate['read'],\n ): Promise<MinimapSourceResult | null> => {\n const point = read.revision.point\n const receipt = await context.source.prepareProjection(this, read)\n return receipt ? { point, receipt, tokensRebased: this.tokensRebased } : null\n },\n dispose: () => this.dispose(),\n }\n }\n\n public connect(): Promise<DocumentProjectionConnection | null> {\n return Promise.resolve(this.connection)\n }\n\n public inspect(): MinimapWorkerOwnerSnapshot {\n return this.worker?.inspect() ?? { lifecycle: 'disposed', postedRequests: 0, lastError: null }\n }\n\n public post(request: MinimapWorkerRequest, transfer?: Transferable[]): boolean {\n const posted = this.worker?.post(request, transfer) ?? false\n if (posted && request.type === 'updateTokens') this.tokensRebased = true\n return posted\n }\n\n private readonly admit = (\n update: DocumentProjectionUpdate,\n signal: AbortSignal,\n ): Promise<DocumentProjectionReceipt> => {\n if (signal.aborted) return Promise.reject(cancelledProjection())\n const request: Extract<MinimapWorkerRequest, { type: 'projectSource' }> = {\n type: 'projectSource',\n requestId: ++this.nextRequest,\n identity: update.identity,\n base: update.base,\n target: update.target,\n projection: projectSource(update, this.options.maxColumn),\n }\n return new Promise((resolve, reject) => {\n const abort = () => this.rejectRequest(request.requestId, cancelledProjection())\n signal.addEventListener('abort', abort, { once: true })\n this.pending.set(request.requestId, {\n identity: request.identity,\n tokensRebased: projectionPreservesTokenCoordinates(update),\n resolve,\n reject,\n detach: () => signal.removeEventListener('abort', abort),\n })\n if (this.post(request)) return\n this.rejectRequest(request.requestId, projectionPostFailure(request))\n })\n }\n\n private readonly release = (identity: DocumentWorkerIdentity): void => {\n this.post({ type: 'releaseSource', identity })\n for (const [requestId, pending] of this.pending) {\n if (!sourceIdentitiesEqual(pending.identity, identity)) continue\n this.rejectRequest(requestId, cancelledProjection())\n }\n }\n\n private readonly handleMessage = (response: MinimapWorkerResponse): void => {\n if (response.type !== 'sourceApplied') {\n this.options.onMessage(response)\n return\n }\n const pending = this.pending.get(response.requestId)\n if (!pending) return\n this.pending.delete(response.requestId)\n pending.detach()\n this.tokensRebased = this.tokensRebased && pending.tokensRebased\n pending.resolve(response.receipt)\n }\n\n private readonly handleError = (error: Error): void => {\n for (const requestId of this.pending.keys()) this.rejectRequest(requestId, error)\n this.options.onError?.(error)\n }\n\n private rejectRequest(requestId: number, error: unknown): void {\n const pending = this.pending.get(requestId)\n if (!pending) return\n this.pending.delete(requestId)\n pending.detach()\n pending.reject(error)\n }\n\n private dispose(): void {\n this.connection = null\n for (const requestId of this.pending.keys())\n this.rejectRequest(requestId, cancelledProjection())\n void this.worker?.dispose().catch(this.handleError)\n }\n}\n\nfunction projectSource(\n update: DocumentProjectionUpdate,\n maxColumn: number,\n): MinimapSourceProjection {\n const base = update.baseRead?.text\n const canonical = update.changes?.edits\n if (!base || !canonical) {\n return { kind: 'reset', summary: documentSummaryPayload(update.read.text, maxColumn) }\n }\n const edits = sequentialMinimapEdits(canonical)\n return {\n kind: 'patch',\n edits,\n summary: documentSummaryPatchPayload(update.read.text, summarySource(base), edits, maxColumn, {\n textLength: base.length,\n lineCount: base.lineCount,\n }),\n }\n}\n\nfunction projectionPreservesTokenCoordinates(update: DocumentProjectionUpdate): boolean {\n const base = update.baseRead?.text\n const edits = update.changes?.edits\n return Boolean(\n base &&\n edits &&\n edits.every(\n (edit) => !edit.text.includes('\\n') && base.lineAt(edit.from) === base.lineAt(edit.to),\n ),\n )\n}\n\nfunction cancelledProjection(): DOMException {\n return new DOMException('Minimap document source was released', 'AbortError')\n}\n\nfunction projectionPostFailure(request: Extract<MinimapWorkerRequest, { type: 'projectSource' }>) {\n return createError({\n code: 'minimap.SOURCE_POST_FAILED',\n message: 'Minimap source request failed',\n why: 'The worker stopped accepting projected source requests.',\n fix: 'Reopen the document to create a fresh minimap worker.',\n internal: {\n requestId: request.requestId,\n endpointGeneration: request.identity.endpointGeneration,\n },\n })\n}\n"],"mappings":";;;;;;AAsCA,IAAI,uBAAuB;AAE3B,IAAM,2BAA2B,yBAC9B,SAAS,WAAkC,OAAO,KAAK,OAAO,IAC9D,MAAM,UAAU,SAAS,KAC5B;AAEA,SAAgB,4BACd,eACA,SACA;CACA,MAAM,SAAS,IAAI,sBAAsB,OAAO;CAChD,MAAM,QAAQ,cAAc,OAAO,0BAA0B,MAAM;CACnE,OAAO,QAAQ;EAAE;EAAQ;CAAM,IAAI;AACrC;AAEA,IAAM,wBAAN,MAA4B;CASP;CARnB,SAA4C;CAC5C,aAA0D;CAC1D,mBAA2B;CAC3B,cAAsB;CACtB,gBAAwB;CACxB,0BAA2B,IAAI,IAA+B;CAE9D,YACE,SACA;EADiB,KAAA,UAAA;CAChB;CAEH,KAAY,SAAmC;EAC7C,KAAK,SAAS,IAAI,mBAAmB;GACnC,GAAG,KAAK;GACR,WAAW,KAAK;GAChB,SAAS,KAAK;EAChB,CAAC;EACD,KAAK,aAAa;GAChB,YAAY,EAAE;GACd,wBAAwB,EAAE,KAAK;GAC/B,OAAO,KAAK;GACZ,SAAS,KAAK;EAChB;EACA,OAAO;GACL,SAAS,OACP,SACwC;IACxC,MAAM,QAAQ,KAAK,SAAS;IAC5B,MAAM,UAAU,MAAM,QAAQ,OAAO,kBAAkB,MAA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CACH;AACF;AAEA,SAAS,oCAAoC,QAA2C;CACtF,MAAM,OAAO,OAAO,UAAU;CAC9B,MAAM,QAAQ,OAAO,SAAS;CAC9B,OAAO,QACL,QACA,SACA,MAAM,OACH,SAAS,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,OAAO,KAAK,IAAI,MAAM,KAAK,OAAO,KAAK,EAAE,CACvF,CACF;AACF;AAEA,SAAS,sBAAoC;CAC3C,OAAO,IAAI,aAAa,wCAAwC,YAAY;AAC9E;AAEA,SAAS,sBAAsB,SAAmE;CAChG,OAAO,YAAY;EACjB,MAAM;EACN,SAAS;EACT,KAAK;EACL,KAAK;EACL,UAAU;GACR,WAAW,QAAQ;GACnB,oBAAoB,QAAQ,SAAS;EACvC;CACF,CAAC;AACH"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import './style.css';
2
1
  export { createMinimapPlugin } from './plugin';
3
2
  export type { EditorMinimapDecoration, EditorMinimapOptions, MinimapAutohide, MinimapDecorationPosition, MinimapSectionHeaderStyle, MinimapSide, MinimapSize, MinimapSliderVisibility, } from './types';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,WAAW,EACX,uBAAuB,GACxB,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,WAAW,EACX,uBAAuB,GACxB,MAAM,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1 @@
1
- import { createMinimapPlugin } from "./plugin.js";
2
- import "./style.css";
3
- export { createMinimapPlugin };
1
+ export { createMinimapPlugin } from "./plugin.js";
package/dist/layout.js CHANGED
@@ -131,7 +131,6 @@ function computeMinimapWidth(options) {
131
131
  const proportionalWidth = Math.floor((availableWidth - 2) * options.charWidth / (options.characterWidth + options.charWidth));
132
132
  return Math.min(minimapMaxWidth, Math.max(0, proportionalWidth) + 2 + 8);
133
133
  }
134
- //#endregion
135
134
  export { computeFrameLayout, computeRenderLayout, documentLineForSliderY, visibleDocumentLineRange };
136
135
 
137
136
  //# sourceMappingURL=layout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"minimapCharRenderer.d.ts","sourceRoot":"","sources":["../src/minimapCharRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,mBAAmB;aAMZ,KAAK,EAAE,MAAM;IAL/B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmB;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;gBAG/C,QAAQ,EAAE,iBAAiB,EACX,KAAK,EAAE,MAAM;IAMxB,UAAU,CACf,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,KAAK,EACtB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,OAAO,EACvB,cAAc,EAAE,OAAO,GACtB,IAAI;IAqBA,eAAe,CACpB,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,KAAK,EACtB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,OAAO,GACtB,IAAI;IAwBP,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,yBAAyB;IAkBjC,OAAO,CAAC,MAAM,CAAC,MAAM;CAMtB"}
1
+ {"version":3,"file":"minimapCharRenderer.d.ts","sourceRoot":"","sources":["../src/minimapCharRenderer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,mBAAmB;aAMZ,KAAK,EAAE,MAAM;IAL/B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmB;IAClD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IAEjD,YACE,QAAQ,EAAE,iBAAiB,EACX,KAAK,EAAE,MAAM,EAI9B;IAEM,UAAU,CACf,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,KAAK,EACtB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,OAAO,EACvB,cAAc,EAAE,OAAO,GACtB,IAAI,CAmBN;IAEM,eAAe,CACpB,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,KAAK,EACtB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,OAAO,GACtB,IAAI,CAsBN;IAED,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,yBAAyB;IAkBjC,OAAO,CAAC,MAAM,CAAC,MAAM;CAMtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"minimapCharRendererFactory.d.ts","sourceRoot":"","sources":["../src/minimapCharRendererFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAG3D;;;GAGG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAqB;IAChD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAQ;WAExB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,mBAAmB;WAe9D,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS;WAsB/C,oBAAoB,CAChC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,GACZ,mBAAmB;IAYtB,OAAO,CAAC,MAAM,CAAC,UAAU;CAqB1B"}
1
+ {"version":3,"file":"minimapCharRendererFactory.d.ts","sourceRoot":"","sources":["../src/minimapCharRendererFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAG3D;;;GAGG;AACH,qBAAa,0BAA0B;IACrC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAqB;IAChD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAQ;IAEtC,OAAc,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,mBAAmB,CAa3E;IAED,OAAc,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAoB5D;IAED,OAAc,oBAAoB,CAChC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,GACZ,mBAAmB,CAUrB;IAED,OAAO,CAAC,MAAM,CAAC,UAAU;CAqB1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"minimapCharSheet.d.ts","sourceRoot":"","sources":["../src/minimapCharSheet.ts"],"names":[],"mappings":"AAAA,0BAAkB,SAAS;IACzB,aAAa,KAAK;IAClB,WAAW,MAAM;IACjB,YAAY,QAAQ;IACpB,UAAU,KAAkC;IAC5C,mBAAmB,KAAK;IACxB,kBAAkB,KAAK;IACvB,gBAAgB,IAAI;IACpB,eAAe,IAAI;IACnB,iBAAiB,IAAI;IACrB,sBAAsB,OAAsD;CAC7E;AAED,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,MAAM,CAQ3C,CAAA;AAEJ,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,WAAW,MAAM,KAAG,MAKhE,CAAA"}
1
+ {"version":3,"file":"minimapCharSheet.d.ts","sourceRoot":"","sources":["../src/minimapCharSheet.ts"],"names":[],"mappings":"AAAA,0BAAkB,SAAS;IACzB,aAAa,KAAK;IAClB,WAAW,MAAM;IACjB,YAAY,QAAQ;IACpB,UAAU,KAAkC;IAC5C,mBAAmB,KAAK;IACxB,kBAAkB,KAAK;IACvB,gBAAgB,IAAI;IACpB,eAAe,IAAI;IACnB,iBAAiB,IAAI;IACrB,sBAAsB,OAAsD;CAC7E;AAED,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,MAAM,CAQ3C,CAAA;AAEJ,eAAO,MAAM,YAAY,WAAY,MAAM,aAAa,MAAM,KAAG,MAKhE,CAAA"}
@@ -1,4 +1,4 @@
1
- //#region src/minimapCharSheet.ts
1
+ // src/minimapCharSheet.ts
2
2
  var Constants = /* @__PURE__ */ function(Constants) {
3
3
  Constants[Constants["START_CH_CODE"] = 32] = "START_CH_CODE";
4
4
  Constants[Constants["END_CH_CODE"] = 126] = "END_CH_CODE";
@@ -18,7 +18,6 @@ var Constants = /* @__PURE__ */ function(Constants) {
18
18
  values.push(65533);
19
19
  return values;
20
20
  })();
21
- //#endregion
22
21
  export { Constants };
23
22
 
24
23
  //# sourceMappingURL=minimapCharSheet.js.map
package/dist/options.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/options.ts
1
+ // src/options.ts
2
2
  var DEFAULT_MINIMAP_OPTIONS = {
3
3
  enabled: true,
4
4
  autohide: "none",
@@ -59,7 +59,6 @@ function validRegexSource(value, fallback) {
59
59
  return fallback;
60
60
  }
61
61
  }
62
- //#endregion
63
62
  export { resolveMinimapOptions };
64
63
 
65
64
  //# sourceMappingURL=options.js.map
package/dist/plugin.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './style.css';
1
2
  import type { EditorPlugin } from '@singapore-editor/core/extensions';
2
3
  import type { EditorMinimapOptions } from './types';
3
4
  export declare function createMinimapPlugin(options?: EditorMinimapOptions): EditorPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOV,YAAY,EAMb,MAAM,mCAAmC,CAAA;AAQ1C,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,SAAS,CAAA;AAI3E,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,YAAY,CAmBpF"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,KAAK,EAMV,YAAY,EAMb,MAAM,mCAAmC,CAAA;AAQ1C,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,SAAS,CAAA;AAI3E,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,YAAY,CAmBpF"}
package/dist/plugin.js CHANGED
@@ -3,8 +3,9 @@ import { computeRenderLayout, documentLineForSliderY, visibleDocumentLineRange }
3
3
  import { resolveMinimapOptions } from "./options.js";
4
4
  import { minimapViewportGeometry } from "./viewportGeometry.js";
5
5
  import { MinimapWorkerClient, canUseMinimapWorker } from "./workerClient.js";
6
+ import "./style.css";
6
7
  import { EDITOR_MINIMAP_FEATURE, registerWheelScrollTarget } from "@singapore-editor/core/extensions";
7
- //#region src/plugin.ts
8
+ // src/plugin.ts
8
9
  function createMinimapPlugin(options = {}) {
9
10
  const resolved = resolveMinimapOptions(options);
10
11
  const decorations = new MinimapDecorationRegistry();
@@ -57,21 +58,34 @@ var MinimapContribution = class {
57
58
  snapshot: this.latestSnapshot,
58
59
  decorations: this.collectDecorations(),
59
60
  onLayoutWidth: this.reserveWidth,
60
- reservedLane: () => this.appliedReservedWidth
61
+ reservedLane: () => this.appliedReservedWidth,
62
+ contributions: context.getDocumentContributions()
61
63
  });
62
64
  this.decorationSubscription = decorations.subscribe(this.handleDecorationsChanged);
63
65
  this.wheelScrollRegistration = registerWheelScrollTarget(context, this.host.root);
64
66
  this.installPointerHandlers();
65
67
  this.client.update(this.latestSnapshot, "document");
66
68
  }
67
- update(snapshot, kind, change) {
69
+ update(snapshot, kind) {
68
70
  if (this.disposed) return;
69
71
  this.latestSnapshot = snapshot;
70
72
  this.latestViewport = snapshot.viewport;
73
+ if (kind === "document" || kind === "clear") {
74
+ const contributions = this.context.getDocumentContributions();
75
+ this.client.setDocumentContributions(contributions, snapshot);
76
+ this.host.root.style.display = contributions ? "" : "none";
77
+ if (!contributions) {
78
+ this.appliedReservedWidth = 0;
79
+ this.layoutSignature = "";
80
+ this.scrollBox = null;
81
+ this.context.reserveOverlayWidth(this.options.side, 0);
82
+ return;
83
+ }
84
+ }
71
85
  if (snapshot.geometryCommitted === false) return;
72
86
  if (kind === "document" || kind === "layout") this.scrollBox = null;
73
87
  if (kind === "document" || kind === "layout" || kind === "viewport") this.synchronizeLayoutReservation();
74
- this.client.update(snapshot, kind, change);
88
+ this.client.update(snapshot, kind);
75
89
  }
76
90
  updateViewport(viewport) {
77
91
  if (this.disposed || this.latestSnapshot.geometryCommitted === false) return;
@@ -409,7 +423,6 @@ function cssPixels(value, fallback = 0) {
409
423
  const parsed = Number.parseFloat(value ?? "");
410
424
  return Number.isFinite(parsed) ? Math.max(0, parsed) : fallback;
411
425
  }
412
- //#endregion
413
426
  export { createMinimapPlugin };
414
427
 
415
428
  //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import type {\n EditorContributionChange,\n EditorDisposable,\n EditorCapabilityContribution,\n EditorCapabilityContributionContext,\n EditorMinimapDecoration,\n EditorMinimapFeature,\n EditorPlugin,\n EditorViewContribution,\n EditorViewContributionContext,\n EditorViewContributionUpdateKind,\n EditorViewSnapshot,\n EditorViewportSnapshot,\n} from '@singapore-editor/core/extensions'\nimport {\n EDITOR_MINIMAP_FEATURE,\n registerWheelScrollTarget,\n} from '@singapore-editor/core/extensions'\nimport { mergeDenseDecorations } from './decorationMerge'\nimport { computeRenderLayout, documentLineForSliderY, visibleDocumentLineRange } from './layout'\nimport { resolveMinimapOptions } from './options'\nimport type { EditorMinimapOptions, ResolvedMinimapOptions } from './types'\nimport { minimapViewportGeometry, type MinimapScrollGeometry } from './viewportGeometry'\nimport { canUseMinimapWorker, MinimapWorkerClient, type MinimapHost } from './workerClient'\n\nexport function createMinimapPlugin(options: EditorMinimapOptions = {}): EditorPlugin {\n const resolved = resolveMinimapOptions(options)\n const decorations = new MinimapDecorationRegistry()\n\n return {\n name: 'minimap',\n activate(context) {\n return [\n context.registerCapabilityContribution({\n createContribution: (contributionContext) =>\n createMinimapFeatureContribution(contributionContext, decorations),\n }),\n context.registerViewContribution({\n createContribution: (contributionContext) =>\n createMinimapContribution(contributionContext, resolved, decorations),\n }),\n ]\n },\n }\n}\n\nfunction createMinimapFeatureContribution(\n context: EditorCapabilityContributionContext,\n decorations: MinimapDecorationRegistry,\n): EditorCapabilityContribution {\n const registration = context.registerFeature(EDITOR_MINIMAP_FEATURE, decorations)\n\n return {\n dispose: () => registration.dispose(),\n }\n}\n\nfunction createMinimapContribution(\n context: EditorViewContributionContext,\n options: ResolvedMinimapOptions,\n decorations: MinimapDecorationRegistry,\n): EditorViewContribution | null {\n if (!options.enabled) return null\n if (!canUseMinimapWorker()) return null\n\n return new MinimapContribution(context, options, decorations)\n}\n\nclass MinimapContribution implements EditorViewContribution {\n public readonly snapshotKey: string\n private readonly context: EditorViewContributionContext\n private readonly options: ResolvedMinimapOptions\n private readonly host: MinimapHost\n private readonly client: MinimapWorkerClient\n private readonly decorationSubscription: EditorDisposable\n private readonly wheelScrollRegistration: EditorDisposable\n private latestSnapshot: EditorViewSnapshot\n private latestViewport: EditorViewportSnapshot\n private activeSliderDrag: SliderDrag | null = null\n private appliedReservedWidth = 0\n private layoutSignature = ''\n private scrollBox: MinimapScrollBox | null = null\n private pendingSliderLine: number | null = null\n private sliderScrollFrame = 0\n private disposed = false\n\n public constructor(\n context: EditorViewContributionContext,\n options: ResolvedMinimapOptions,\n private readonly decorations: MinimapDecorationRegistry,\n ) {\n this.context = context\n this.options = options\n this.snapshotKey = `minimap:${JSON.stringify(options)}`\n this.latestSnapshot = context.getSnapshot()\n this.latestViewport = this.latestSnapshot.viewport\n this.host = createHost(context, options)\n if (this.latestSnapshot.geometryCommitted !== false) this.synchronizeLayoutReservation()\n this.client = new MinimapWorkerClient({\n host: this.host,\n options,\n snapshot: this.latestSnapshot,\n decorations: this.collectDecorations(),\n onLayoutWidth: this.reserveWidth,\n reservedLane: () => this.appliedReservedWidth,\n })\n this.decorationSubscription = decorations.subscribe(this.handleDecorationsChanged)\n this.wheelScrollRegistration = registerWheelScrollTarget(context, this.host.root)\n this.installPointerHandlers()\n this.client.update(this.latestSnapshot, 'document')\n }\n\n public update(\n snapshot: EditorViewSnapshot,\n kind: EditorViewContributionUpdateKind,\n change?: EditorContributionChange | null,\n ): void {\n if (this.disposed) return\n\n this.latestSnapshot = snapshot\n this.latestViewport = snapshot.viewport\n if (snapshot.geometryCommitted === false) return\n if (kind === 'document' || kind === 'layout') this.scrollBox = null\n if (kind === 'document' || kind === 'layout' || kind === 'viewport') {\n this.synchronizeLayoutReservation()\n }\n this.client.update(snapshot, kind, change)\n }\n\n public updateViewport(viewport: EditorViewportSnapshot): void {\n if (this.disposed || this.latestSnapshot.geometryCommitted === false) return\n this.latestViewport = viewport\n this.client.updateViewport(viewport)\n }\n\n public dispose(): void {\n if (this.disposed) return\n\n this.disposed = true\n this.stopSliderDrag()\n this.wheelScrollRegistration.dispose()\n this.decorationSubscription.dispose()\n this.client.dispose()\n this.context.reserveOverlayWidth(this.options.side, 0)\n this.host.root.remove()\n }\n\n private installPointerHandlers(): void {\n this.host.root.addEventListener('pointerdown', this.handlePointerDown)\n this.host.slider.addEventListener('pointerdown', this.handleSliderPointerDown)\n }\n\n private readonly reserveWidth = (_width: number): void => {\n if (this.context.getSnapshot().geometryCommitted === false) return\n this.scrollBox = null\n this.layoutSignature = ''\n this.synchronizeLayoutReservation()\n }\n\n private synchronizeLayoutReservation(): void {\n const snapshot = this.latestSnapshot\n const scroll = this.measureScrollGeometry()\n const { clientWidth, clientHeight } = scroll\n const signature = [\n scroll.width,\n scroll.height,\n clientWidth,\n clientHeight,\n scroll.overflowsX,\n scroll.overflowsY,\n scroll.borders.left,\n scroll.borders.right,\n scroll.borders.top,\n scroll.borders.bottom,\n scroll.overlayScrollbars.vertical,\n scroll.overlayScrollbars.horizontal,\n snapshot.metrics.characterWidth,\n snapshot.metrics.rowHeight,\n this.context.scrollElement.ownerDocument.defaultView?.devicePixelRatio ?? 1,\n this.options.size === 'proportional' ? 0 : snapshot.lineCount,\n ].join(':')\n if (signature === this.layoutSignature) return\n this.layoutSignature = signature\n const minimapHeight = minimapViewportGeometry(this.options.side, 0, scroll).height\n const minimapWidth = Math.ceil(\n this.currentLayoutWidth(clientWidth, clientHeight, minimapHeight),\n )\n const geometry = minimapViewportGeometry(this.options.side, minimapWidth, scroll)\n this.host.root.style.width = `${minimapWidth}px`\n this.host.root.style.top = `${geometry.top}px`\n this.host.root.style.height = `${geometry.height}px`\n const side = this.options.side\n this.host.root.style[side] = `${geometry[side]}px`\n const nextWidth = geometry.reservedWidth\n if (nextWidth === this.appliedReservedWidth) return\n\n const previousWidth = this.appliedReservedWidth\n this.appliedReservedWidth = nextWidth\n this.logLane(previousWidth, scroll, geometry)\n this.context.reserveOverlayWidth(this.options.side, nextWidth)\n }\n\n private measureScrollGeometry(): MinimapScrollGeometry {\n const viewport = this.latestViewport\n const box = this.currentScrollBox()\n return {\n ...box,\n overflowsX: viewport.clientWidth > 0 && viewport.scrollWidth > viewport.clientWidth,\n overflowsY:\n box.clientHeight > 0 &&\n Math.max(viewport.scrollHeight, this.latestSnapshot.totalHeight) > box.clientHeight,\n }\n }\n\n // The box is read from the DOM (computed style and a forced layout) only when something could\n // have changed it: a document or layout update, a lane change, or a viewport whose height or\n // border box no longer matches. A scroll reuses the last measurement.\n private currentScrollBox(): MinimapScrollBox {\n const viewport = this.latestViewport\n const cached = this.scrollBox\n if (cached && scrollBoxMatchesViewport(cached, viewport)) return cached\n\n const element = this.context.scrollElement\n const style = element.ownerDocument.defaultView?.getComputedStyle(element)\n const clientWidth =\n element.clientWidth ||\n (viewport.clientWidth > 0 ? viewport.clientWidth + this.appliedReservedWidth : 0)\n const clientHeight = element.clientHeight || viewport.clientHeight\n const box: MinimapScrollBox = {\n width: element.offsetWidth || viewport.borderBoxWidth || clientWidth,\n height: element.offsetHeight || viewport.borderBoxHeight || clientHeight,\n clientWidth,\n clientHeight,\n borders: {\n left: cssPixels(style?.borderLeftWidth),\n right: cssPixels(style?.borderRightWidth),\n top: cssPixels(style?.borderTopWidth),\n bottom: cssPixels(style?.borderBottomWidth),\n },\n overlayScrollbars: overlayScrollbarDimensions(element, style),\n }\n this.scrollBox = box\n return box\n }\n\n private currentLayoutWidth(\n clientWidth: number,\n clientHeight: number,\n minimapHeight: number,\n ): number {\n const snapshot = this.latestSnapshot\n const element = this.context.scrollElement\n const range = visibleDocumentLineRange(snapshot, this.latestViewport)\n return computeRenderLayout({\n minimap: this.options,\n lineCount: snapshot.lineCount,\n metrics: {\n ...snapshot.metrics,\n devicePixelRatio: element.ownerDocument.defaultView?.devicePixelRatio ?? 1,\n },\n viewport: {\n ...this.latestViewport,\n clientWidth,\n clientHeight,\n minimapHeight,\n reservedWidth: 0,\n visibleStart: range.start,\n visibleEnd: range.end,\n },\n }).width\n }\n\n private readonly handlePointerDown = (event: PointerEvent): void => {\n if (event.button !== 0) return\n if (this.context.getSnapshot().geometryCommitted === false) return\n if (event.target === this.host.slider || this.host.slider.contains(event.target as Node)) return\n\n event.preventDefault()\n const frame = this.client.frameLayout()\n const y = event.clientY - this.host.root.getBoundingClientRect().top\n if (y >= frame.sliderTop && y <= frame.sliderTop + frame.sliderHeight) return\n const line = documentLineForSliderY(frame, y - frame.sliderHeight / 2)\n this.revealDocumentLine(line)\n }\n\n private readonly handleSliderPointerDown = (event: PointerEvent): void => {\n if (event.button !== 0) return\n if (this.context.getSnapshot().geometryCommitted === false) return\n\n event.preventDefault()\n this.stopSliderDrag()\n const startY = event.clientY\n const frame = this.client.frameLayout()\n const startLine = documentLineForSliderY(frame, frame.sliderTop)\n\n let moved = false\n const onMove = (move: PointerEvent): void => {\n if (this.context.getSnapshot().geometryCommitted === false) {\n this.stopSliderDrag()\n return\n }\n if (!moved && move.clientY === startY) return\n if (frame.sliderLineHeight <= 0) return\n moved = true\n const line = startLine + (move.clientY - startY) / frame.sliderLineHeight\n this.scheduleSliderScroll(line)\n }\n const onEnd = (): void => this.stopSliderDrag()\n\n this.captureSliderPointer(event.pointerId)\n this.host.slider.classList.add('active')\n this.activeSliderDrag = { pointerId: event.pointerId, onMove, onEnd }\n this.host.slider.ownerDocument.addEventListener('pointermove', onMove)\n this.host.slider.ownerDocument.addEventListener('pointerup', onEnd, { once: true })\n this.host.slider.ownerDocument.addEventListener('pointercancel', onEnd, { once: true })\n this.host.slider.addEventListener('lostpointercapture', onEnd, { once: true })\n }\n\n private captureSliderPointer(pointerId: number): void {\n try {\n this.host.slider.setPointerCapture(pointerId)\n } catch {\n return\n }\n }\n\n private stopSliderDrag(): void {\n const drag = this.activeSliderDrag\n if (!drag) return\n\n this.activeSliderDrag = null\n this.cancelSliderScroll()\n this.flushSliderScroll()\n this.host.slider.ownerDocument.removeEventListener('pointermove', drag.onMove)\n this.host.slider.ownerDocument.removeEventListener('pointerup', drag.onEnd)\n this.host.slider.ownerDocument.removeEventListener('pointercancel', drag.onEnd)\n this.host.slider.removeEventListener('lostpointercapture', drag.onEnd)\n this.releaseSliderPointer(drag.pointerId)\n this.host.slider.classList.remove('active')\n }\n\n private scheduleSliderScroll(line: number): void {\n this.pendingSliderLine = line\n if (this.sliderScrollFrame !== 0) return\n\n this.sliderScrollFrame = requestFrame(() => {\n this.sliderScrollFrame = 0\n this.flushSliderScroll()\n })\n }\n\n private flushSliderScroll(): void {\n const line = this.pendingSliderLine\n this.pendingSliderLine = null\n if (line === null) return\n if (this.context.getSnapshot().geometryCommitted === false) return\n\n this.revealDocumentLine(line)\n }\n\n private cancelSliderScroll(): void {\n if (this.sliderScrollFrame === 0) return\n\n cancelFrame(this.sliderScrollFrame)\n this.sliderScrollFrame = 0\n }\n\n private releaseSliderPointer(pointerId: number): void {\n if (!this.host.slider.hasPointerCapture(pointerId)) return\n\n try {\n this.host.slider.releasePointerCapture(pointerId)\n } catch {\n return\n }\n }\n\n private revealDocumentLine(line: number): void {\n this.context.revealLine(clamp(Math.floor(line), 0, this.latestSnapshot.lineCount - 1))\n }\n\n private logLane(\n previousWidth: number,\n scroll: MinimapScrollGeometry,\n geometry: ReturnType<typeof minimapViewportGeometry>,\n ): void {\n const viewport = this.latestViewport\n this.context.log({\n action: 'editor.minimap.lane_changed',\n level: 'info',\n minimap: {\n documentId: this.latestSnapshot.documentId,\n scrollElementClass: this.context.scrollElement.className,\n containerClass: this.context.container.className,\n appliedOverlayWidth: this.appliedReservedWidth,\n availableWidth: scroll.clientWidth,\n borderBoxWidth: viewport.borderBoxWidth ?? null,\n clientWidth: viewport.clientWidth,\n previousOverlayWidth: previousWidth,\n side: this.options.side,\n horizontalScrollbar: geometry.horizontalScrollbar,\n verticalScrollbar: geometry.verticalScrollbar,\n },\n })\n }\n\n private readonly handleDecorationsChanged = (): void => {\n this.client.setExternalDecorations(this.collectDecorations())\n }\n\n // The height a whole document is projected onto is the editor's own, so how\n // dense a source is on screen is answerable from the snapshot, without\n // waiting on the worker that owns the render layout.\n private collectDecorations(): readonly EditorMinimapDecoration[] {\n return mergeDenseDecorations(\n this.decorations.getDecorations(),\n this.latestViewport.clientHeight,\n this.latestSnapshot.lineCount,\n )\n }\n}\n\nclass MinimapDecorationRegistry implements EditorMinimapFeature {\n private readonly decorationsBySource = new Map<string, readonly EditorMinimapDecoration[]>()\n private readonly listeners = new Set<() => void>()\n\n public setDecorations(sourceId: string, decorations: readonly EditorMinimapDecoration[]): void {\n this.decorationsBySource.set(sourceId, decorations)\n this.notify()\n }\n\n public clearDecorations(sourceId: string): void {\n if (!this.decorationsBySource.delete(sourceId)) return\n\n this.notify()\n }\n\n public getDecorations(): readonly EditorMinimapDecoration[] {\n return Array.from(this.decorationsBySource.values()).flat()\n }\n\n public subscribe(listener: () => void): EditorDisposable {\n this.listeners.add(listener)\n return {\n dispose: () => this.listeners.delete(listener),\n }\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener()\n }\n}\n\ntype SliderDrag = {\n readonly pointerId: number\n readonly onMove: (event: PointerEvent) => void\n readonly onEnd: () => void\n}\n\nfunction createHost(\n context: EditorViewContributionContext,\n options: ResolvedMinimapOptions,\n): MinimapHost {\n const document = context.container.ownerDocument\n const root = document.createElement('div')\n const shadow = document.createElement('div')\n const mainCanvas = document.createElement('canvas')\n const decorationsCanvas = document.createElement('canvas')\n const slider = document.createElement('div')\n const sliderHorizontal = document.createElement('div')\n\n root.className = hostClassName(options)\n shadow.className = 'editor-minimap-shadow editor-minimap-shadow-hidden'\n mainCanvas.className = 'editor-minimap-canvas'\n decorationsCanvas.className = 'editor-minimap-canvas editor-minimap-decorations'\n slider.className = 'editor-minimap-slider'\n sliderHorizontal.className = 'editor-minimap-slider-horizontal'\n slider.appendChild(sliderHorizontal)\n root.append(shadow, mainCanvas, decorationsCanvas, slider)\n if (getComputedStyle(context.container).position === 'static') {\n context.container.style.position = 'relative'\n }\n context.container.appendChild(root)\n\n return {\n root,\n colorScope: context.scrollElement,\n shadow,\n mainCanvas,\n decorationsCanvas,\n slider,\n sliderHorizontal,\n }\n}\n\ntype MinimapScrollBox = Omit<MinimapScrollGeometry, 'overflowsX' | 'overflowsY'>\n\nfunction scrollBoxMatchesViewport(\n box: MinimapScrollBox,\n viewport: EditorViewportSnapshot,\n): boolean {\n // ResizeObserver retains fractional pixels; offsetWidth/Height round them to integers.\n if (viewport.borderBoxWidth !== undefined && viewport.borderBoxHeight !== undefined) {\n return (\n Math.round(viewport.borderBoxWidth) === box.width &&\n Math.round(viewport.borderBoxHeight) === box.height\n )\n }\n return viewport.clientHeight <= 0 || viewport.clientHeight === box.clientHeight\n}\n\nfunction hostClassName(options: ResolvedMinimapOptions): string {\n const classes = ['editor-minimap', `editor-minimap-${options.side}`]\n if (options.showSlider === 'always') classes.push('slider-always')\n if (options.showSlider === 'mouseover') classes.push('slider-mouseover')\n if (options.autohide !== 'none') classes.push(`editor-minimap-autohide-${options.autohide}`)\n return classes.join(' ')\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value))\n}\n\nfunction requestFrame(callback: () => void): number {\n if (typeof requestAnimationFrame === 'function') return requestAnimationFrame(callback)\n return setTimeout(callback, 16) as unknown as number\n}\n\nfunction cancelFrame(handle: number): void {\n if (typeof cancelAnimationFrame === 'function') {\n cancelAnimationFrame(handle)\n return\n }\n\n clearTimeout(handle)\n}\n\nfunction overlayScrollbarDimensions(\n element: HTMLElement,\n style: CSSStyleDeclaration | undefined,\n): MinimapScrollGeometry['overlayScrollbars'] {\n const keyword = style?.getPropertyValue('scrollbar-width').trim()\n if (keyword === 'none') return { vertical: 0, horizontal: 0 }\n if (keyword === 'thin') return { vertical: 7, horizontal: 7 }\n\n const pseudo = element.ownerDocument.defaultView?.getComputedStyle(element, '::-webkit-scrollbar')\n return {\n vertical: cssPixels(pseudo?.width, 15),\n horizontal: cssPixels(pseudo?.height, 15),\n }\n}\n\nfunction cssPixels(value: string | undefined, fallback = 0): number {\n const parsed = Number.parseFloat(value ?? '')\n return Number.isFinite(parsed) ? Math.max(0, parsed) : fallback\n}\n"],"mappings":";;;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AqB;CAC9D,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;AAEA,SAAS,aAAa,UAA8B;CAClD,IAAI,OAAO,0BAA0B,YAAY,OAAO,sBAAsB,QAAQ;CACtF,OAAO,WAAW,UAAU,EAAE;AAChC;AAEA,SAAS,YAAY,QAAsB;CACzC,IAAI,OAAO,yBAAyB,YAAY;EAC9C,qBAAqB,MAAM;EAC3B;CACF;CAEA,aAAa,MAAM;AACrB;AAEA,SAAS,2BACP,SACA,OAC4C;CAC5C,MAAM,UAAU,OAAO,iBAAiB,iBAAiB,CAAC,CAAC,KAAK;CAChE,IAAI,YAAY,QAAQ,OAAO;EAAE,UAAU;EAAG,YAAY;CAAE;CAC5D,IAAI,YAAY,QAAQ,OAAO;EAAE,UAAU;EAAG,YAAY;CAAE;CAE5D,MAAM,SAAS,QAAQ,cAAc,aAAa,iBAAiB,SAAS,qBAAqB;CACjG,OAAO;EACL,UAAU,UAAU,QAAQ,OAAO,EAAE;EACrC,YAAY,UAAU,QAAQ,QAAQ,EAAE;CAC1C;AACF;AAEA,SAAS,UAAU,OAA2B,WAAW,GAAW;CAClE,MAAM,SAAS,OAAO,WAAW,SAAS,EAAE;CAC5C,OAAO,OAAO,SAAS,MAAM,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI;AACzD"}
1
+ {"version":3,"file":"plugin.js","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import './style.css'\nimport type {\n EditorDisposable,\n EditorCapabilityContribution,\n EditorCapabilityContributionContext,\n EditorMinimapDecoration,\n EditorMinimapFeature,\n EditorPlugin,\n EditorViewContribution,\n EditorViewContributionContext,\n EditorViewContributionUpdateKind,\n EditorViewSnapshot,\n EditorViewportSnapshot,\n} from '@singapore-editor/core/extensions'\nimport {\n EDITOR_MINIMAP_FEATURE,\n registerWheelScrollTarget,\n} from '@singapore-editor/core/extensions'\nimport { mergeDenseDecorations } from './decorationMerge'\nimport { computeRenderLayout, documentLineForSliderY, visibleDocumentLineRange } from './layout'\nimport { resolveMinimapOptions } from './options'\nimport type { EditorMinimapOptions, ResolvedMinimapOptions } from './types'\nimport { minimapViewportGeometry, type MinimapScrollGeometry } from './viewportGeometry'\nimport { canUseMinimapWorker, MinimapWorkerClient, type MinimapHost } from './workerClient'\n\nexport function createMinimapPlugin(options: EditorMinimapOptions = {}): EditorPlugin {\n const resolved = resolveMinimapOptions(options)\n const decorations = new MinimapDecorationRegistry()\n\n return {\n name: 'minimap',\n activate(context) {\n return [\n context.registerCapabilityContribution({\n createContribution: (contributionContext) =>\n createMinimapFeatureContribution(contributionContext, decorations),\n }),\n context.registerViewContribution({\n createContribution: (contributionContext) =>\n createMinimapContribution(contributionContext, resolved, decorations),\n }),\n ]\n },\n }\n}\n\nfunction createMinimapFeatureContribution(\n context: EditorCapabilityContributionContext,\n decorations: MinimapDecorationRegistry,\n): EditorCapabilityContribution {\n const registration = context.registerFeature(EDITOR_MINIMAP_FEATURE, decorations)\n\n return {\n dispose: () => registration.dispose(),\n }\n}\n\nfunction createMinimapContribution(\n context: EditorViewContributionContext,\n options: ResolvedMinimapOptions,\n decorations: MinimapDecorationRegistry,\n): EditorViewContribution | null {\n if (!options.enabled) return null\n if (!canUseMinimapWorker()) return null\n\n return new MinimapContribution(context, options, decorations)\n}\n\nclass MinimapContribution implements EditorViewContribution {\n public readonly snapshotKey: string\n private readonly context: EditorViewContributionContext\n private readonly options: ResolvedMinimapOptions\n private readonly host: MinimapHost\n private readonly client: MinimapWorkerClient\n private readonly decorationSubscription: EditorDisposable\n private readonly wheelScrollRegistration: EditorDisposable\n private latestSnapshot: EditorViewSnapshot\n private latestViewport: EditorViewportSnapshot\n private activeSliderDrag: SliderDrag | null = null\n private appliedReservedWidth = 0\n private layoutSignature = ''\n private scrollBox: MinimapScrollBox | null = null\n private pendingSliderLine: number | null = null\n private sliderScrollFrame = 0\n private disposed = false\n\n public constructor(\n context: EditorViewContributionContext,\n options: ResolvedMinimapOptions,\n private readonly decorations: MinimapDecorationRegistry,\n ) {\n this.context = context\n this.options = options\n this.snapshotKey = `minimap:${JSON.stringify(options)}`\n this.latestSnapshot = context.getSnapshot()\n this.latestViewport = this.latestSnapshot.viewport\n this.host = createHost(context, options)\n if (this.latestSnapshot.geometryCommitted !== false) this.synchronizeLayoutReservation()\n this.client = new MinimapWorkerClient({\n host: this.host,\n options,\n snapshot: this.latestSnapshot,\n decorations: this.collectDecorations(),\n onLayoutWidth: this.reserveWidth,\n reservedLane: () => this.appliedReservedWidth,\n contributions: context.getDocumentContributions(),\n })\n this.decorationSubscription = decorations.subscribe(this.handleDecorationsChanged)\n this.wheelScrollRegistration = registerWheelScrollTarget(context, this.host.root)\n this.installPointerHandlers()\n this.client.update(this.latestSnapshot, 'document')\n }\n\n public update(snapshot: EditorViewSnapshot, kind: EditorViewContributionUpdateKind): void {\n if (this.disposed) return\n\n this.latestSnapshot = snapshot\n this.latestViewport = snapshot.viewport\n if (kind === 'document' || kind === 'clear') {\n const contributions = this.context.getDocumentContributions()\n this.client.setDocumentContributions(contributions, snapshot)\n this.host.root.style.display = contributions ? '' : 'none'\n if (!contributions) {\n this.appliedReservedWidth = 0\n this.layoutSignature = ''\n this.scrollBox = null\n this.context.reserveOverlayWidth(this.options.side, 0)\n return\n }\n }\n if (snapshot.geometryCommitted === false) return\n if (kind === 'document' || kind === 'layout') this.scrollBox = null\n if (kind === 'document' || kind === 'layout' || kind === 'viewport') {\n this.synchronizeLayoutReservation()\n }\n this.client.update(snapshot, kind)\n }\n\n public updateViewport(viewport: EditorViewportSnapshot): void {\n if (this.disposed || this.latestSnapshot.geometryCommitted === false) return\n this.latestViewport = viewport\n this.client.updateViewport(viewport)\n }\n\n public dispose(): void {\n if (this.disposed) return\n\n this.disposed = true\n this.stopSliderDrag()\n this.wheelScrollRegistration.dispose()\n this.decorationSubscription.dispose()\n this.client.dispose()\n this.context.reserveOverlayWidth(this.options.side, 0)\n this.host.root.remove()\n }\n\n private installPointerHandlers(): void {\n this.host.root.addEventListener('pointerdown', this.handlePointerDown)\n this.host.slider.addEventListener('pointerdown', this.handleSliderPointerDown)\n }\n\n private readonly reserveWidth = (_width: number): void => {\n if (this.context.getSnapshot().geometryCommitted === false) return\n this.scrollBox = null\n this.layoutSignature = ''\n this.synchronizeLayoutReservation()\n }\n\n private synchronizeLayoutReservation(): void {\n const snapshot = this.latestSnapshot\n const scroll = this.measureScrollGeometry()\n const { clientWidth, clientHeight } = scroll\n const signature = [\n scroll.width,\n scroll.height,\n clientWidth,\n clientHeight,\n scroll.overflowsX,\n scroll.overflowsY,\n scroll.borders.left,\n scroll.borders.right,\n scroll.borders.top,\n scroll.borders.bottom,\n scroll.overlayScrollbars.vertical,\n scroll.overlayScrollbars.horizontal,\n snapshot.metrics.characterWidth,\n snapshot.metrics.rowHeight,\n this.context.scrollElement.ownerDocument.defaultView?.devicePixelRatio ?? 1,\n this.options.size === 'proportional' ? 0 : snapshot.lineCount,\n ].join(':')\n if (signature === this.layoutSignature) return\n this.layoutSignature = signature\n const minimapHeight = minimapViewportGeometry(this.options.side, 0, scroll).height\n const minimapWidth = Math.ceil(\n this.currentLayoutWidth(clientWidth, clientHeight, minimapHeight),\n )\n const geometry = minimapViewportGeometry(this.options.side, minimapWidth, scroll)\n this.host.root.style.width = `${minimapWidth}px`\n this.host.root.style.top = `${geometry.top}px`\n this.host.root.style.height = `${geometry.height}px`\n const side = this.options.side\n this.host.root.style[side] = `${geometry[side]}px`\n const nextWidth = geometry.reservedWidth\n if (nextWidth === this.appliedReservedWidth) return\n\n const previousWidth = this.appliedReservedWidth\n this.appliedReservedWidth = nextWidth\n this.logLane(previousWidth, scroll, geometry)\n this.context.reserveOverlayWidth(this.options.side, nextWidth)\n }\n\n private measureScrollGeometry(): MinimapScrollGeometry {\n const viewport = this.latestViewport\n const box = this.currentScrollBox()\n return {\n ...box,\n overflowsX: viewport.clientWidth > 0 && viewport.scrollWidth > viewport.clientWidth,\n overflowsY:\n box.clientHeight > 0 &&\n Math.max(viewport.scrollHeight, this.latestSnapshot.totalHeight) > box.clientHeight,\n }\n }\n\n // The box is read from the DOM (computed style and a forced layout) only when something could\n // have changed it: a document or layout update, a lane change, or a viewport whose height or\n // border box no longer matches. A scroll reuses the last measurement.\n private currentScrollBox(): MinimapScrollBox {\n const viewport = this.latestViewport\n const cached = this.scrollBox\n if (cached && scrollBoxMatchesViewport(cached, viewport)) return cached\n\n const element = this.context.scrollElement\n const style = element.ownerDocument.defaultView?.getComputedStyle(element)\n const clientWidth =\n element.clientWidth ||\n (viewport.clientWidth > 0 ? viewport.clientWidth + this.appliedReservedWidth : 0)\n const clientHeight = element.clientHeight || viewport.clientHeight\n const box: MinimapScrollBox = {\n width: element.offsetWidth || viewport.borderBoxWidth || clientWidth,\n height: element.offsetHeight || viewport.borderBoxHeight || clientHeight,\n clientWidth,\n clientHeight,\n borders: {\n left: cssPixels(style?.borderLeftWidth),\n right: cssPixels(style?.borderRightWidth),\n top: cssPixels(style?.borderTopWidth),\n bottom: cssPixels(style?.borderBottomWidth),\n },\n overlayScrollbars: overlayScrollbarDimensions(element, style),\n }\n this.scrollBox = box\n return box\n }\n\n private currentLayoutWidth(\n clientWidth: number,\n clientHeight: number,\n minimapHeight: number,\n ): number {\n const snapshot = this.latestSnapshot\n const element = this.context.scrollElement\n const range = visibleDocumentLineRange(snapshot, this.latestViewport)\n return computeRenderLayout({\n minimap: this.options,\n lineCount: snapshot.lineCount,\n metrics: {\n ...snapshot.metrics,\n devicePixelRatio: element.ownerDocument.defaultView?.devicePixelRatio ?? 1,\n },\n viewport: {\n ...this.latestViewport,\n clientWidth,\n clientHeight,\n minimapHeight,\n reservedWidth: 0,\n visibleStart: range.start,\n visibleEnd: range.end,\n },\n }).width\n }\n\n private readonly handlePointerDown = (event: PointerEvent): void => {\n if (event.button !== 0) return\n if (this.context.getSnapshot().geometryCommitted === false) return\n if (event.target === this.host.slider || this.host.slider.contains(event.target as Node)) return\n\n event.preventDefault()\n const frame = this.client.frameLayout()\n const y = event.clientY - this.host.root.getBoundingClientRect().top\n if (y >= frame.sliderTop && y <= frame.sliderTop + frame.sliderHeight) return\n const line = documentLineForSliderY(frame, y - frame.sliderHeight / 2)\n this.revealDocumentLine(line)\n }\n\n private readonly handleSliderPointerDown = (event: PointerEvent): void => {\n if (event.button !== 0) return\n if (this.context.getSnapshot().geometryCommitted === false) return\n\n event.preventDefault()\n this.stopSliderDrag()\n const startY = event.clientY\n const frame = this.client.frameLayout()\n const startLine = documentLineForSliderY(frame, frame.sliderTop)\n\n let moved = false\n const onMove = (move: PointerEvent): void => {\n if (this.context.getSnapshot().geometryCommitted === false) {\n this.stopSliderDrag()\n return\n }\n if (!moved && move.clientY === startY) return\n if (frame.sliderLineHeight <= 0) return\n moved = true\n const line = startLine + (move.clientY - startY) / frame.sliderLineHeight\n this.scheduleSliderScroll(line)\n }\n const onEnd = (): void => this.stopSliderDrag()\n\n this.captureSliderPointer(event.pointerId)\n this.host.slider.classList.add('active')\n this.activeSliderDrag = { pointerId: event.pointerId, onMove, onEnd }\n this.host.slider.ownerDocument.addEventListener('pointermove', onMove)\n this.host.slider.ownerDocument.addEventListener('pointerup', onEnd, { once: true })\n this.host.slider.ownerDocument.addEventListener('pointercancel', onEnd, { once: true })\n this.host.slider.addEventListener('lostpointercapture', onEnd, { once: true })\n }\n\n private captureSliderPointer(pointerId: number): void {\n try {\n this.host.slider.setPointerCapture(pointerId)\n } catch {\n return\n }\n }\n\n private stopSliderDrag(): void {\n const drag = this.activeSliderDrag\n if (!drag) return\n\n this.activeSliderDrag = null\n this.cancelSliderScroll()\n this.flushSliderScroll()\n this.host.slider.ownerDocument.removeEventListener('pointermove', drag.onMove)\n this.host.slider.ownerDocument.removeEventListener('pointerup', drag.onEnd)\n this.host.slider.ownerDocument.removeEventListener('pointercancel', drag.onEnd)\n this.host.slider.removeEventListener('lostpointercapture', drag.onEnd)\n this.releaseSliderPointer(drag.pointerId)\n this.host.slider.classList.remove('active')\n }\n\n private scheduleSliderScroll(line: number): void {\n this.pendingSliderLine = line\n if (this.sliderScrollFrame !== 0) return\n\n this.sliderScrollFrame = requestFrame(() => {\n this.sliderScrollFrame = 0\n this.flushSliderScroll()\n })\n }\n\n private flushSliderScroll(): void {\n const line = this.pendingSliderLine\n this.pendingSliderLine = null\n if (line === null) return\n if (this.context.getSnapshot().geometryCommitted === false) return\n\n this.revealDocumentLine(line)\n }\n\n private cancelSliderScroll(): void {\n if (this.sliderScrollFrame === 0) return\n\n cancelFrame(this.sliderScrollFrame)\n this.sliderScrollFrame = 0\n }\n\n private releaseSliderPointer(pointerId: number): void {\n if (!this.host.slider.hasPointerCapture(pointerId)) return\n\n try {\n this.host.slider.releasePointerCapture(pointerId)\n } catch {\n return\n }\n }\n\n private revealDocumentLine(line: number): void {\n this.context.revealLine(clamp(Math.floor(line), 0, this.latestSnapshot.lineCount - 1))\n }\n\n private logLane(\n previousWidth: number,\n scroll: MinimapScrollGeometry,\n geometry: ReturnType<typeof minimapViewportGeometry>,\n ): void {\n const viewport = this.latestViewport\n this.context.log({\n action: 'editor.minimap.lane_changed',\n level: 'info',\n minimap: {\n documentId: this.latestSnapshot.documentId,\n scrollElementClass: this.context.scrollElement.className,\n containerClass: this.context.container.className,\n appliedOverlayWidth: this.appliedReservedWidth,\n availableWidth: scroll.clientWidth,\n borderBoxWidth: viewport.borderBoxWidth ?? null,\n clientWidth: viewport.clientWidth,\n previousOverlayWidth: previousWidth,\n side: this.options.side,\n horizontalScrollbar: geometry.horizontalScrollbar,\n verticalScrollbar: geometry.verticalScrollbar,\n },\n })\n }\n\n private readonly handleDecorationsChanged = (): void => {\n this.client.setExternalDecorations(this.collectDecorations())\n }\n\n // The height a whole document is projected onto is the editor's own, so how\n // dense a source is on screen is answerable from the snapshot, without\n // waiting on the worker that owns the render layout.\n private collectDecorations(): readonly EditorMinimapDecoration[] {\n return mergeDenseDecorations(\n this.decorations.getDecorations(),\n this.latestViewport.clientHeight,\n this.latestSnapshot.lineCount,\n )\n }\n}\n\nclass MinimapDecorationRegistry implements EditorMinimapFeature {\n private readonly decorationsBySource = new Map<string, readonly EditorMinimapDecoration[]>()\n private readonly listeners = new Set<() => void>()\n\n public setDecorations(sourceId: string, decorations: readonly EditorMinimapDecoration[]): void {\n this.decorationsBySource.set(sourceId, decorations)\n this.notify()\n }\n\n public clearDecorations(sourceId: string): void {\n if (!this.decorationsBySource.delete(sourceId)) return\n\n this.notify()\n }\n\n public getDecorations(): readonly EditorMinimapDecoration[] {\n return Array.from(this.decorationsBySource.values()).flat()\n }\n\n public subscribe(listener: () => void): EditorDisposable {\n this.listeners.add(listener)\n return {\n dispose: () => this.listeners.delete(listener),\n }\n }\n\n private notify(): void {\n for (const listener of this.listeners) listener()\n }\n}\n\ntype SliderDrag = {\n readonly pointerId: number\n readonly onMove: (event: PointerEvent) => void\n readonly onEnd: () => void\n}\n\nfunction createHost(\n context: EditorViewContributionContext,\n options: ResolvedMinimapOptions,\n): MinimapHost {\n const document = context.container.ownerDocument\n const root = document.createElement('div')\n const shadow = document.createElement('div')\n const mainCanvas = document.createElement('canvas')\n const decorationsCanvas = document.createElement('canvas')\n const slider = document.createElement('div')\n const sliderHorizontal = document.createElement('div')\n\n root.className = hostClassName(options)\n shadow.className = 'editor-minimap-shadow editor-minimap-shadow-hidden'\n mainCanvas.className = 'editor-minimap-canvas'\n decorationsCanvas.className = 'editor-minimap-canvas editor-minimap-decorations'\n slider.className = 'editor-minimap-slider'\n sliderHorizontal.className = 'editor-minimap-slider-horizontal'\n slider.appendChild(sliderHorizontal)\n root.append(shadow, mainCanvas, decorationsCanvas, slider)\n if (getComputedStyle(context.container).position === 'static') {\n context.container.style.position = 'relative'\n }\n context.container.appendChild(root)\n\n return {\n root,\n colorScope: context.scrollElement,\n shadow,\n mainCanvas,\n decorationsCanvas,\n slider,\n sliderHorizontal,\n }\n}\n\ntype MinimapScrollBox = Omit<MinimapScrollGeometry, 'overflowsX' | 'overflowsY'>\n\nfunction scrollBoxMatchesViewport(\n box: MinimapScrollBox,\n viewport: EditorViewportSnapshot,\n): boolean {\n // ResizeObserver retains fractional pixels; offsetWidth/Height round them to integers.\n if (viewport.borderBoxWidth !== undefined && viewport.borderBoxHeight !== undefined) {\n return (\n Math.round(viewport.borderBoxWidth) === box.width &&\n Math.round(viewport.borderBoxHeight) === box.height\n )\n }\n return viewport.clientHeight <= 0 || viewport.clientHeight === box.clientHeight\n}\n\nfunction hostClassName(options: ResolvedMinimapOptions): string {\n const classes = ['editor-minimap', `editor-minimap-${options.side}`]\n if (options.showSlider === 'always') classes.push('slider-always')\n if (options.showSlider === 'mouseover') classes.push('slider-mouseover')\n if (options.autohide !== 'none') classes.push(`editor-minimap-autohide-${options.autohide}`)\n return classes.join(' ')\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value))\n}\n\nfunction requestFrame(callback: () => void): number {\n if (typeof requestAnimationFrame === 'function') return requestAnimationFrame(callback)\n return setTimeout(callback, 16) as unknown as number\n}\n\nfunction cancelFrame(handle: number): void {\n if (typeof cancelAnimationFrame === 'function') {\n cancelAnimationFrame(handle)\n return\n }\n\n clearTimeout(handle)\n}\n\nfunction overlayScrollbarDimensions(\n element: HTMLElement,\n style: CSSStyleDeclaration | undefined,\n): MinimapScrollGeometry['overlayScrollbars'] {\n const keyword = style?.getPropertyValue('scrollbar-width').trim()\n if (keyword === 'none') return { vertical: 0, horizontal: 0 }\n if (keyword === 'thin') return { vertical: 7, horizontal: 7 }\n\n const pseudo = element.ownerDocument.defaultView?.getComputedStyle(element, '::-webkit-scrollbar')\n return {\n vertical: cssPixels(pseudo?.width, 15),\n horizontal: cssPixels(pseudo?.height, 15),\n }\n}\n\nfunction cssPixels(value: string | undefined, fallback = 0): number {\n const parsed = Number.parseFloat(value ?? '')\n return Number.isFinite(parsed) ? Math.max(0, parsed) : fallback\n}\n"],"mappings":";;;;;;;;AAyBA,SAAgB,oBAAoB,UAAgC,CAAC,GAAiB;CACpF,MAAM,WAAW,sBAAsB,OAAO;CAC9C,MA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BAAa,YAAY;IACvB,SAAgB,SAAS,EAAE,SAAS,CAAA;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;gBAGjC,OAAO,EAAE,iCAAiC,EAC1C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,KAAK;IAQZ,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAI3C,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAI1E"}
1
+ {"version":3,"file":"raster.d.ts","sourceRoot":"","sources":["../src/raster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,YAAY;IACvB,SAAgB,SAAS,EAAE,SAAS,CAAA;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IAEnC,YACE,OAAO,EAAE,iCAAiC,EAC1C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,KAAK,EAMlB;IAEM,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAEjD;IAEM,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGxE;CACF"}
@@ -1,5 +1,5 @@
1
1
  import type { TextEdit } from '@singapore-editor/core/document';
2
- import type { EditorMinimapDecoration, MinimapBaseStyles, MinimapDocumentEditPayload, MinimapDocumentPayload, MinimapMetrics, MinimapRenderLayout, MinimapSelection, MinimapToken, MinimapTokenPatch, MinimapViewport, ResolvedMinimapOptions } from './types';
2
+ import type { EditorMinimapDecoration, MinimapBaseStyles, MinimapDocumentEditPayload, MinimapDocumentPayload, MinimapDocumentSummaryPatch, MinimapDocumentSummaryPayload, MinimapMetrics, MinimapRenderLayout, MinimapSelection, MinimapToken, MinimapTokenPatch, MinimapViewport, ResolvedMinimapOptions } from './types';
3
3
  export declare class MinimapWorkerRenderer {
4
4
  private state;
5
5
  init(options: {
@@ -10,6 +10,8 @@ export declare class MinimapWorkerRenderer {
10
10
  }): void;
11
11
  setDocument(document: MinimapDocumentPayload): void;
12
12
  applyEdit(edit: TextEdit, document: MinimapDocumentEditPayload): void;
13
+ applySourceSummary(summary: MinimapDocumentSummaryPayload): void;
14
+ applySourcePatch(edits: readonly TextEdit[], summaryPatch: MinimapDocumentSummaryPatch): void;
13
15
  applyEdits(edits: readonly TextEdit[], document: MinimapDocumentEditPayload): void;
14
16
  setExternalDecorations(decorations: readonly EditorMinimapDecoration[]): void;
15
17
  private setEditedDocument;
@@ -49,6 +51,7 @@ type RenderResult = {
49
51
  readonly sliderHeight: number;
50
52
  readonly shadowVisible: boolean;
51
53
  };
54
+ export declare function applyTextEditsToMinimapDocument(document: Pick<MinimapDocumentPayload, 'lineStarts' | 'lines' | 'textLength' | 'tokens'>, edits: readonly TextEdit[], summaryPatch: MinimapDocumentSummaryPatch): MinimapDocumentSummaryPayload & Pick<MinimapDocumentPayload, 'tokens'>;
52
55
  export declare function projectMinimapTokensThroughEdit(tokens: readonly MinimapToken[], edit: TextEdit, previousText: MinimapTokenProjectionText): readonly MinimapToken[];
53
56
  type MinimapTokenProjectionText = string | {
54
57
  isWordBeforeOffset(offset: number): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAc/D,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EAGtB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,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AG,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CASxE;AAkPD,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,0BAA0B,GACvC,SAAS,YAAY,EAAE,CAQzB;AAuED,KAAK,0BAA0B,GAC3B,MAAM,GACN;IACE,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3C,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3C,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { DocumentWorkerIdentity, DocumentWorkerPoint } from '@singapore-editor/core/internal/document-worker';
2
+ export declare function sourceIdentitiesEqual(left: DocumentWorkerIdentity, right: DocumentWorkerIdentity): boolean;
3
+ export declare function sourcePointsEqual(left: DocumentWorkerPoint | null, right: DocumentWorkerPoint): boolean;
4
+ //# sourceMappingURL=sourceIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceIdentity.d.ts","sourceRoot":"","sources":["../src/sourceIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,iDAAiD,CAAA;AAExD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,EAC5B,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAOT;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,mBAAmB,GAAG,IAAI,EAChC,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAOT"}
@@ -0,0 +1,10 @@
1
+ // src/sourceIdentity.ts
2
+ function sourceIdentitiesEqual(left, right) {
3
+ return left.documentId === right.documentId && left.documentGeneration === right.documentGeneration && left.endpointGeneration === right.endpointGeneration && left.registrationId === right.registrationId;
4
+ }
5
+ function sourcePointsEqual(left, right) {
6
+ return Boolean(left && left.segment === right.segment && left.revision === right.revision && left.textVersion === right.textVersion);
7
+ }
8
+ export { sourceIdentitiesEqual, sourcePointsEqual };
9
+
10
+ //# sourceMappingURL=sourceIdentity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceIdentity.js","names":[],"sources":["../src/sourceIdentity.ts"],"sourcesContent":["import type {\n DocumentWorkerIdentity,\n DocumentWorkerPoint,\n} from '@singapore-editor/core/internal/document-worker'\n\nexport function sourceIdentitiesEqual(\n left: DocumentWorkerIdentity,\n right: DocumentWorkerIdentity,\n): boolean {\n return (\n left.documentId === right.documentId &&\n left.documentGeneration === right.documentGeneration &&\n left.endpointGeneration === right.endpointGeneration &&\n left.registrationId === right.registrationId\n )\n}\n\nexport function sourcePointsEqual(\n left: DocumentWorkerPoint | null,\n right: DocumentWorkerPoint,\n): boolean {\n return Boolean(\n left &&\n left.segment === right.segment &&\n left.revision === right.revision &&\n left.textVersion === right.textVersion,\n )\n}\n"],"mappings":";AAKA,SAAgB,sBACd,MACA,OACS;CACT,OACE,KAAK,eAAe,MAAM,cAC1B,KAAK,uBAAuB,MAAM,sBAClC,KAAK,uBAAuB,MAAM,sBAClC,KAAK,mBAAmB,MAAM;AAElC;AAEA,SAAgB,kBACd,MACA,OACS;CACT,OAAO,QACL,QACA,KAAK,YAAY,MAAM,WACvB,KAAK,aAAa,MAAM,YACxB,KAAK,gBAAgB,MAAM,WAC7B;AACF"}
@@ -0,0 +1,16 @@
1
+ import type { DocumentProjectionReceipt, DocumentWorkerIdentity } from '@singapore-editor/core/internal/document-worker';
2
+ import type { MinimapWorkerRequest } from './types';
3
+ import { MinimapWorkerRenderer } from './renderer';
4
+ export declare class MinimapSourceProtocol {
5
+ private readonly renderer;
6
+ private accepted;
7
+ constructor(renderer: MinimapWorkerRenderer);
8
+ apply(request: Extract<MinimapWorkerRequest, {
9
+ type: 'projectSource';
10
+ }>): DocumentProjectionReceipt;
11
+ release(identity: DocumentWorkerIdentity): void;
12
+ current(): DocumentProjectionReceipt | null;
13
+ accepts(receipt: DocumentProjectionReceipt): boolean;
14
+ private matchesBase;
15
+ }
16
+ //# sourceMappingURL=sourceProtocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceProtocol.d.ts","sourceRoot":"","sources":["../src/sourceProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,iDAAiD,CAAA;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAGlD,qBAAa,qBAAqB;IAGb,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAF5C,OAAO,CAAC,QAAQ,CAAyC;IAEzD,YAAoC,QAAQ,EAAE,qBAAqB,EAAI;IAEhE,KAAK,CACV,OAAO,EAAE,OAAO,CAAC,oBAAoB,EAAE;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC,GAChE,yBAAyB,CAe3B;IAEM,OAAO,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAWrD;IAEM,OAAO,IAAI,yBAAyB,GAAG,IAAI,CAEjD;IAEM,OAAO,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAM1D;IAED,OAAO,CAAC,WAAW;CAOpB"}
package/dist/style.css CHANGED
@@ -1,5 +1,5 @@
1
1
  .editor-minimap {
2
- --editor-minimap-background: #1e1e1e;
2
+ --editor-minimap-background: var(--editor-background);
3
3
  --editor-minimap-background-opacity: 0.5;
4
4
  --editor-minimap-selection-highlight: rgba(56, 189, 248, 0.5);
5
5
  --editor-minimap-slider-background: rgba(121, 121, 121, 0.12);
@@ -0,0 +1,21 @@
1
+ import type { TextEdit, TextReadSnapshot } from '@singapore-editor/core/document';
2
+ import type { MinimapDocumentSummaryPayload, MinimapDocumentSummaryPatch } from './types';
3
+ type SummaryLineStarts = {
4
+ readonly length: number;
5
+ at(index: number): number | undefined;
6
+ indexForOffset(offset: number): number;
7
+ };
8
+ export type SummarySource = {
9
+ readonly textLength: number;
10
+ readonly lineStarts: SummaryLineStarts;
11
+ };
12
+ export declare function summarySource(read: TextReadSnapshot): SummarySource;
13
+ export declare function documentSummaryPayload(text: TextReadSnapshot, maxColumn: number): MinimapDocumentSummaryPayload;
14
+ export type SummaryShape = {
15
+ readonly textLength: number;
16
+ readonly lineCount: number;
17
+ };
18
+ export declare function sequentialMinimapEdits(canonical: readonly TextEdit[]): readonly TextEdit[];
19
+ export declare function documentSummaryPatchPayload(text: TextReadSnapshot, previous: SummarySource, edits: readonly TextEdit[], maxColumn: number, workerDocument: SummaryShape | null): MinimapDocumentSummaryPatch;
20
+ export {};
21
+ //# sourceMappingURL=summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACjF,OAAO,KAAK,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAEzF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACrC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAA;CACvC,CAAA;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,aAAa,CAEnE;AAUD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,gBAAgB,EACtB,SAAS,EAAE,MAAM,GAChB,6BAA6B,CAU/B;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtF,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,QAAQ,EAAE,CAU1F;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,gBAAgB,EACtB,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,YAAY,GAAG,IAAI,GAClC,2BAA2B,CAsB7B"}