web-annotation-renderer 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +26 -24
  4. package/dist/index.js.map +1 -1
  5. package/dist/index10.cjs +1 -1
  6. package/dist/index10.js +1 -1
  7. package/dist/index11.cjs +1 -1
  8. package/dist/index11.js +2 -2
  9. package/dist/index13.cjs +1 -1
  10. package/dist/index13.js +1 -1
  11. package/dist/index14.cjs +1 -1
  12. package/dist/index14.js +1 -1
  13. package/dist/index15.cjs +1 -1
  14. package/dist/index15.js +1 -1
  15. package/dist/index16.cjs +1 -1
  16. package/dist/index16.js +1 -1
  17. package/dist/index17.cjs +1 -1
  18. package/dist/index17.js +1 -1
  19. package/dist/index18.cjs +1 -1
  20. package/dist/index18.cjs.map +1 -1
  21. package/dist/index18.js +22 -117
  22. package/dist/index18.js.map +1 -1
  23. package/dist/index19.cjs +1 -1
  24. package/dist/index19.cjs.map +1 -1
  25. package/dist/index19.js +83 -69
  26. package/dist/index19.js.map +1 -1
  27. package/dist/index20.cjs +1 -1
  28. package/dist/index20.cjs.map +1 -1
  29. package/dist/index20.js +100 -76
  30. package/dist/index20.js.map +1 -1
  31. package/dist/index21.cjs +1 -1
  32. package/dist/index21.cjs.map +1 -1
  33. package/dist/index21.js +77 -138
  34. package/dist/index21.js.map +1 -1
  35. package/dist/index22.cjs +1 -1
  36. package/dist/index22.cjs.map +1 -1
  37. package/dist/index22.js +139 -36
  38. package/dist/index22.js.map +1 -1
  39. package/dist/index23.cjs +1 -1
  40. package/dist/index23.cjs.map +1 -1
  41. package/dist/index23.js +35 -34
  42. package/dist/index23.js.map +1 -1
  43. package/dist/index24.cjs +1 -1
  44. package/dist/index24.cjs.map +1 -1
  45. package/dist/index24.js +27 -28
  46. package/dist/index24.js.map +1 -1
  47. package/dist/index25.cjs +1 -1
  48. package/dist/index25.cjs.map +1 -1
  49. package/dist/index25.js +38 -40
  50. package/dist/index25.js.map +1 -1
  51. package/dist/index26.cjs +1 -1
  52. package/dist/index26.cjs.map +1 -1
  53. package/dist/index26.js +39 -4
  54. package/dist/index26.js.map +1 -1
  55. package/dist/index27.cjs +1 -1
  56. package/dist/index27.js +4 -4
  57. package/dist/index28.cjs +1 -1
  58. package/dist/index28.cjs.map +1 -1
  59. package/dist/index28.js +5 -71
  60. package/dist/index28.js.map +1 -1
  61. package/dist/index29.cjs +1 -1
  62. package/dist/index29.cjs.map +1 -1
  63. package/dist/index29.js +70 -4
  64. package/dist/index29.js.map +1 -1
  65. package/dist/index30.cjs +1 -1
  66. package/dist/index30.cjs.map +1 -1
  67. package/dist/index30.js +4 -991
  68. package/dist/index30.js.map +1 -1
  69. package/dist/index31.cjs +2 -0
  70. package/dist/index31.cjs.map +1 -0
  71. package/dist/index31.js +995 -0
  72. package/dist/index31.js.map +1 -0
  73. package/dist/index5.cjs +1 -1
  74. package/dist/index5.cjs.map +1 -1
  75. package/dist/index5.js +63 -56
  76. package/dist/index5.js.map +1 -1
  77. package/dist/index9.cjs +1 -1
  78. package/dist/index9.cjs.map +1 -1
  79. package/dist/index9.js +17 -15
  80. package/dist/index9.js.map +1 -1
  81. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index2.cjs"),s=require("./index3.cjs"),a=require("./index4.cjs"),l=require("./index5.cjs"),c=require("./index6.cjs"),d=require("./index7.cjs"),r=require("./index8.cjs"),u=require("./index9.cjs"),T=require("./index10.cjs"),t=require("./index11.cjs"),S=require("./index12.cjs"),g=require("./index13.cjs"),P=require("./index14.cjs"),q=require("./index15.cjs"),h=require("./index16.cjs"),E=require("./index17.cjs"),A=require("./index18.cjs"),R=require("./index19.cjs"),e=require("./index20.cjs"),o=require("./index21.cjs"),n=require("./index22.cjs"),k=require("./index23.cjs"),x=require("./index24.cjs"),m="0.5.3",p="web-annotation-renderer";exports.AnnotationRenderer=i.AnnotationRenderer;exports.PDFRenderer=s.PDFRenderer;exports.TimelineSync=a.TimelineSync;exports.StrokeRenderer=l.StrokeRenderer;exports.coordinateUtils=c;exports.viewportUtils=d;exports.extractAllBlocks=r.extractAllBlocks;exports.extractMultiplePages=r.extractMultiplePages;exports.extractPDFBlocks=r.extractAllBlocks;exports.normalizeAnnotationArray=u.normalizeAnnotationArray;exports.TypeValidators=T;exports.preloadCJK=t.preloadCJK;exports.setCJKDataUrl=t.setCJKDataUrl;exports.AnnotPdf=S.default;exports.highlightToStrokes=g.highlightToStrokes;exports.textToStrokes=P.textToStrokes;exports.underlineToStrokes=q.underlineToStrokes;exports.arrowToStrokes=h.arrowToStrokes;exports.circleToStrokes=E.circleToStrokes;exports.GradualRenderer=A.default;exports.StrokeDrawer=R.default;exports.BLUE_PRESET=e.BLUE_PRESET;exports.DEFAULT_PRESET=e.DEFAULT_PRESET;exports.MINIMAL_PRESET=e.MINIMAL_PRESET;exports.getPenPreset=e.getPreset;exports.getPenPresetNames=e.getPresetNames;exports.getPreset=e.getPreset;exports.getPresetNames=e.getPresetNames;exports.annotationTools=o.annotationTools;exports.getAnnotationTools=o.getAnnotationTools;exports.handleToolCall=n.handleToolCall;exports.handleToolCalls=n.handleToolCalls;exports.createHighlight=k.createHighlight;exports.createText=x.createText;exports.LIB_NAME=p;exports.VERSION=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index2.cjs"),s=require("./index3.cjs"),a=require("./index4.cjs"),l=require("./index5.cjs"),c=require("./index6.cjs"),d=require("./index7.cjs"),r=require("./index8.cjs"),u=require("./index9.cjs"),T=require("./index10.cjs"),t=require("./index11.cjs"),S=require("./index12.cjs"),g=require("./index13.cjs"),P=require("./index14.cjs"),k=require("./index15.cjs"),q=require("./index16.cjs"),h=require("./index17.cjs"),E=require("./index18.cjs"),A=require("./index19.cjs"),R=require("./index20.cjs"),e=require("./index21.cjs"),o=require("./index22.cjs"),n=require("./index23.cjs"),x=require("./index24.cjs"),m=require("./index25.cjs"),p="0.6.2",D="web-annotation-renderer";exports.AnnotationRenderer=i.AnnotationRenderer;exports.PDFRenderer=s.PDFRenderer;exports.TimelineSync=a.TimelineSync;exports.StrokeRenderer=l.StrokeRenderer;exports.coordinateUtils=c;exports.viewportUtils=d;exports.extractAllBlocks=r.extractAllBlocks;exports.extractMultiplePages=r.extractMultiplePages;exports.extractPDFBlocks=r.extractAllBlocks;exports.normalizeAnnotationArray=u.normalizeAnnotationArray;exports.TypeValidators=T;exports.preloadCJK=t.preloadCJK;exports.setCJKDataUrl=t.setCJKDataUrl;exports.AnnotPdf=S.default;exports.highlightToStrokes=g.highlightToStrokes;exports.textToStrokes=P.textToStrokes;exports.underlineToStrokes=k.underlineToStrokes;exports.arrowToStrokes=q.arrowToStrokes;exports.circleToStrokes=h.circleToStrokes;exports.inkToStrokes=E.inkToStrokes;exports.GradualRenderer=A.default;exports.StrokeDrawer=R.default;exports.BLUE_PRESET=e.BLUE_PRESET;exports.DEFAULT_PRESET=e.DEFAULT_PRESET;exports.MINIMAL_PRESET=e.MINIMAL_PRESET;exports.getPenPreset=e.getPreset;exports.getPenPresetNames=e.getPresetNames;exports.getPreset=e.getPreset;exports.getPresetNames=e.getPresetNames;exports.annotationTools=o.annotationTools;exports.getAnnotationTools=o.getAnnotationTools;exports.handleToolCall=n.handleToolCall;exports.handleToolCalls=n.handleToolCalls;exports.createHighlight=x.createHighlight;exports.createText=m.createText;exports.LIB_NAME=D;exports.VERSION=p;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.js"],"sourcesContent":["/**\n * @ai-annotator/renderer - Public API\n *\n * Single entry point for the Dynamic PDF Annotation Renderer library.\n * Exports all core subsystems, utilities, and types.\n *\n * @module @ai-annotator/renderer\n */\n\n// ============================================================================\n// Core Rendering Engine\n// ============================================================================\n\nimport { AnnotationRenderer } from './core/AnnotationRenderer.js';\nimport { PDFRenderer } from './core/PDFRenderer.js';\nimport { TimelineSync } from './core/TimelineSync.js';\n\nexport { AnnotationRenderer };\nexport { PDFRenderer };\nexport { TimelineSync };\n\n// ============================================================================\n// Stroke Renderer - Unified Canvas-Based Annotation Rendering\n// ============================================================================\n\nimport { StrokeRenderer } from './renderer/StrokeRenderer.js';\n\nexport { StrokeRenderer };\n\n// ============================================================================\n// Converters - Annotation to Stroke Conversion\n// ============================================================================\n\nimport {\n highlightToStrokes,\n textToStrokes,\n underlineToStrokes,\n arrowToStrokes,\n circleToStrokes\n} from './converters/index.js';\n\nexport { highlightToStrokes };\nexport { textToStrokes };\nexport { underlineToStrokes };\nexport { arrowToStrokes };\nexport { circleToStrokes };\n\n// ============================================================================\n// Pen Module - Legacy Stroke Rendering (Retained for Compatibility)\n// ============================================================================\n\nimport { GradualRenderer, StrokeDrawer, getPreset, getPresetNames, DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET } from './pen/index.js';\n\nexport { GradualRenderer };\nexport { StrokeDrawer };\nexport { getPreset as getPenPreset };\nexport { getPresetNames as getPenPresetNames };\n\n// ============================================================================\n// Style Presets - Ready-to-use configurations for strokeConfig\n// ============================================================================\n\nexport { getPreset, getPresetNames };\nexport { DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET };\n\n// ============================================================================\n// Utilities\n// ============================================================================\n\nimport * as coordinateUtils from './utils/coordinateUtils.js';\nimport * as viewportUtils from './utils/viewportUtils.js';\n\nexport { coordinateUtils };\nexport { viewportUtils };\n\n// ============================================================================\n// PDF Extraction Utilities\n// ============================================================================\n\nimport { extractAllBlocks, extractMultiplePages } from './utils/pdfExtractor.js';\n\nexport { extractAllBlocks };\nexport { extractMultiplePages };\nexport { extractAllBlocks as extractPDFBlocks };\n\n// ============================================================================\n// Type Definitions & Validators\n// ============================================================================\n\nexport { normalizeAnnotationArray } from './types/validators.js';\nexport * as TypeValidators from './types/index.js';\n\n// ============================================================================\n// Framework Adapters\n// ============================================================================\n\nexport { AnnotPdf } from './adapters/index.js';\n\n// ============================================================================\n// AI Tools for Annotation Generation\n// ============================================================================\n\nexport {\n annotationTools,\n getAnnotationTools,\n handleToolCall,\n handleToolCalls,\n createHighlight,\n createText\n} from './ai-tools/index.js';\n\n// ============================================================================\n// Multilingual Text Support\n// ============================================================================\n\nexport { preloadCJK, setCJKDataUrl } from './converters/glyphResolver.js';\n\n// ============================================================================\n// Package Metadata\n// ============================================================================\n\nexport const VERSION = '0.5.3';\nexport const LIB_NAME = 'web-annotation-renderer';\n"],"names":["VERSION","LIB_NAME"],"mappings":"2rBAyHaA,EAAU,QACVC,EAAW"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.js"],"sourcesContent":["/**\n * @ai-annotator/renderer - Public API\n *\n * Single entry point for the Dynamic PDF Annotation Renderer library.\n * Exports all core subsystems, utilities, and types.\n *\n * @module @ai-annotator/renderer\n */\n\n// ============================================================================\n// Core Rendering Engine\n// ============================================================================\n\nimport { AnnotationRenderer } from './core/AnnotationRenderer.js';\nimport { PDFRenderer } from './core/PDFRenderer.js';\nimport { TimelineSync } from './core/TimelineSync.js';\n\nexport { AnnotationRenderer };\nexport { PDFRenderer };\nexport { TimelineSync };\n\n// ============================================================================\n// Stroke Renderer - Unified Canvas-Based Annotation Rendering\n// ============================================================================\n\nimport { StrokeRenderer } from './renderer/StrokeRenderer.js';\n\nexport { StrokeRenderer };\n\n// ============================================================================\n// Converters - Annotation to Stroke Conversion\n// ============================================================================\n\nimport {\n highlightToStrokes,\n textToStrokes,\n underlineToStrokes,\n arrowToStrokes,\n circleToStrokes,\n inkToStrokes\n} from './converters/index.js';\n\nexport { highlightToStrokes };\nexport { textToStrokes };\nexport { underlineToStrokes };\nexport { arrowToStrokes };\nexport { circleToStrokes };\nexport { inkToStrokes };\n\n// ============================================================================\n// Pen Module - Legacy Stroke Rendering (Retained for Compatibility)\n// ============================================================================\n\nimport { GradualRenderer, StrokeDrawer, getPreset, getPresetNames, DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET } from './pen/index.js';\n\nexport { GradualRenderer };\nexport { StrokeDrawer };\nexport { getPreset as getPenPreset };\nexport { getPresetNames as getPenPresetNames };\n\n// ============================================================================\n// Style Presets - Ready-to-use configurations for strokeConfig\n// ============================================================================\n\nexport { getPreset, getPresetNames };\nexport { DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET };\n\n// ============================================================================\n// Utilities\n// ============================================================================\n\nimport * as coordinateUtils from './utils/coordinateUtils.js';\nimport * as viewportUtils from './utils/viewportUtils.js';\n\nexport { coordinateUtils };\nexport { viewportUtils };\n\n// ============================================================================\n// PDF Extraction Utilities\n// ============================================================================\n\nimport { extractAllBlocks, extractMultiplePages } from './utils/pdfExtractor.js';\n\nexport { extractAllBlocks };\nexport { extractMultiplePages };\nexport { extractAllBlocks as extractPDFBlocks };\n\n// ============================================================================\n// Type Definitions & Validators\n// ============================================================================\n\nexport { normalizeAnnotationArray } from './types/validators.js';\nexport * as TypeValidators from './types/index.js';\n\n// ============================================================================\n// Framework Adapters\n// ============================================================================\n\nexport { AnnotPdf } from './adapters/index.js';\n\n// ============================================================================\n// AI Tools for Annotation Generation\n// ============================================================================\n\nexport {\n annotationTools,\n getAnnotationTools,\n handleToolCall,\n handleToolCalls,\n createHighlight,\n createText\n} from './ai-tools/index.js';\n\n// ============================================================================\n// Multilingual Text Support\n// ============================================================================\n\nexport { preloadCJK, setCJKDataUrl } from './converters/glyphResolver.js';\n\n// ============================================================================\n// Package Metadata\n// ============================================================================\n\nexport const VERSION = '0.6.2';\nexport const LIB_NAME = 'web-annotation-renderer';\n"],"names":["VERSION","LIB_NAME"],"mappings":"stBA2HaA,EAAU,QACVC,EAAW"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { TimelineSync as f } from "./index4.js";
4
4
  import { StrokeRenderer as d } from "./index5.js";
5
5
  import * as e from "./index6.js";
6
6
  import * as r from "./index7.js";
7
- import { extractAllBlocks as c, extractMultiplePages as P, extractAllBlocks as g } from "./index8.js";
7
+ import { extractAllBlocks as c, extractMultiplePages as P, extractAllBlocks as S } from "./index8.js";
8
8
  import { normalizeAnnotationArray as k } from "./index9.js";
9
9
  import * as o from "./index10.js";
10
10
  import { preloadCJK as E, setCJKDataUrl as R } from "./index11.js";
@@ -14,45 +14,47 @@ import { textToStrokes as U } from "./index14.js";
14
14
  import { underlineToStrokes as C } from "./index15.js";
15
15
  import { arrowToStrokes as L } from "./index16.js";
16
16
  import { circleToStrokes as _ } from "./index17.js";
17
- import { default as F } from "./index18.js";
17
+ import { inkToStrokes as F } from "./index18.js";
18
18
  import { default as K } from "./index19.js";
19
- import { BLUE_PRESET as b, DEFAULT_PRESET as v, MINIMAL_PRESET as z, getPreset as G, getPresetNames as H, getPreset as O, getPresetNames as j } from "./index20.js";
20
- import { annotationTools as Q, getAnnotationTools as W } from "./index21.js";
21
- import { handleToolCall as Y, handleToolCalls as Z } from "./index22.js";
22
- import { createHighlight as ee } from "./index23.js";
23
- import { createText as oe } from "./index24.js";
24
- const t = "0.5.3", a = "web-annotation-renderer";
19
+ import { default as b } from "./index20.js";
20
+ import { BLUE_PRESET as z, DEFAULT_PRESET as G, MINIMAL_PRESET as H, getPreset as O, getPresetNames as j, getPreset as q, getPresetNames as Q } from "./index21.js";
21
+ import { annotationTools as X, getAnnotationTools as Y } from "./index22.js";
22
+ import { handleToolCall as $, handleToolCalls as ee } from "./index23.js";
23
+ import { createHighlight as oe } from "./index24.js";
24
+ import { createText as ae } from "./index25.js";
25
+ const t = "0.6.2", a = "web-annotation-renderer";
25
26
  export {
26
27
  u as AnnotPdf,
27
28
  l as AnnotationRenderer,
28
- b as BLUE_PRESET,
29
- v as DEFAULT_PRESET,
30
- F as GradualRenderer,
29
+ z as BLUE_PRESET,
30
+ G as DEFAULT_PRESET,
31
+ K as GradualRenderer,
31
32
  a as LIB_NAME,
32
- z as MINIMAL_PRESET,
33
+ H as MINIMAL_PRESET,
33
34
  p as PDFRenderer,
34
- K as StrokeDrawer,
35
+ b as StrokeDrawer,
35
36
  d as StrokeRenderer,
36
37
  f as TimelineSync,
37
38
  o as TypeValidators,
38
39
  t as VERSION,
39
- Q as annotationTools,
40
+ X as annotationTools,
40
41
  L as arrowToStrokes,
41
42
  _ as circleToStrokes,
42
43
  e as coordinateUtils,
43
- ee as createHighlight,
44
- oe as createText,
44
+ oe as createHighlight,
45
+ ae as createText,
45
46
  c as extractAllBlocks,
46
47
  P as extractMultiplePages,
47
- g as extractPDFBlocks,
48
- W as getAnnotationTools,
49
- G as getPenPreset,
50
- H as getPenPresetNames,
51
- O as getPreset,
52
- j as getPresetNames,
53
- Y as handleToolCall,
54
- Z as handleToolCalls,
48
+ S as extractPDFBlocks,
49
+ Y as getAnnotationTools,
50
+ O as getPenPreset,
51
+ j as getPenPresetNames,
52
+ q as getPreset,
53
+ Q as getPresetNames,
54
+ $ as handleToolCall,
55
+ ee as handleToolCalls,
55
56
  B as highlightToStrokes,
57
+ F as inkToStrokes,
56
58
  k as normalizeAnnotationArray,
57
59
  E as preloadCJK,
58
60
  R as setCJKDataUrl,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["/**\n * @ai-annotator/renderer - Public API\n *\n * Single entry point for the Dynamic PDF Annotation Renderer library.\n * Exports all core subsystems, utilities, and types.\n *\n * @module @ai-annotator/renderer\n */\n\n// ============================================================================\n// Core Rendering Engine\n// ============================================================================\n\nimport { AnnotationRenderer } from './core/AnnotationRenderer.js';\nimport { PDFRenderer } from './core/PDFRenderer.js';\nimport { TimelineSync } from './core/TimelineSync.js';\n\nexport { AnnotationRenderer };\nexport { PDFRenderer };\nexport { TimelineSync };\n\n// ============================================================================\n// Stroke Renderer - Unified Canvas-Based Annotation Rendering\n// ============================================================================\n\nimport { StrokeRenderer } from './renderer/StrokeRenderer.js';\n\nexport { StrokeRenderer };\n\n// ============================================================================\n// Converters - Annotation to Stroke Conversion\n// ============================================================================\n\nimport {\n highlightToStrokes,\n textToStrokes,\n underlineToStrokes,\n arrowToStrokes,\n circleToStrokes\n} from './converters/index.js';\n\nexport { highlightToStrokes };\nexport { textToStrokes };\nexport { underlineToStrokes };\nexport { arrowToStrokes };\nexport { circleToStrokes };\n\n// ============================================================================\n// Pen Module - Legacy Stroke Rendering (Retained for Compatibility)\n// ============================================================================\n\nimport { GradualRenderer, StrokeDrawer, getPreset, getPresetNames, DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET } from './pen/index.js';\n\nexport { GradualRenderer };\nexport { StrokeDrawer };\nexport { getPreset as getPenPreset };\nexport { getPresetNames as getPenPresetNames };\n\n// ============================================================================\n// Style Presets - Ready-to-use configurations for strokeConfig\n// ============================================================================\n\nexport { getPreset, getPresetNames };\nexport { DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET };\n\n// ============================================================================\n// Utilities\n// ============================================================================\n\nimport * as coordinateUtils from './utils/coordinateUtils.js';\nimport * as viewportUtils from './utils/viewportUtils.js';\n\nexport { coordinateUtils };\nexport { viewportUtils };\n\n// ============================================================================\n// PDF Extraction Utilities\n// ============================================================================\n\nimport { extractAllBlocks, extractMultiplePages } from './utils/pdfExtractor.js';\n\nexport { extractAllBlocks };\nexport { extractMultiplePages };\nexport { extractAllBlocks as extractPDFBlocks };\n\n// ============================================================================\n// Type Definitions & Validators\n// ============================================================================\n\nexport { normalizeAnnotationArray } from './types/validators.js';\nexport * as TypeValidators from './types/index.js';\n\n// ============================================================================\n// Framework Adapters\n// ============================================================================\n\nexport { AnnotPdf } from './adapters/index.js';\n\n// ============================================================================\n// AI Tools for Annotation Generation\n// ============================================================================\n\nexport {\n annotationTools,\n getAnnotationTools,\n handleToolCall,\n handleToolCalls,\n createHighlight,\n createText\n} from './ai-tools/index.js';\n\n// ============================================================================\n// Multilingual Text Support\n// ============================================================================\n\nexport { preloadCJK, setCJKDataUrl } from './converters/glyphResolver.js';\n\n// ============================================================================\n// Package Metadata\n// ============================================================================\n\nexport const VERSION = '0.5.3';\nexport const LIB_NAME = 'web-annotation-renderer';\n"],"names":["VERSION","LIB_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyHY,MAACA,IAAU,SACVC,IAAW;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.js"],"sourcesContent":["/**\n * @ai-annotator/renderer - Public API\n *\n * Single entry point for the Dynamic PDF Annotation Renderer library.\n * Exports all core subsystems, utilities, and types.\n *\n * @module @ai-annotator/renderer\n */\n\n// ============================================================================\n// Core Rendering Engine\n// ============================================================================\n\nimport { AnnotationRenderer } from './core/AnnotationRenderer.js';\nimport { PDFRenderer } from './core/PDFRenderer.js';\nimport { TimelineSync } from './core/TimelineSync.js';\n\nexport { AnnotationRenderer };\nexport { PDFRenderer };\nexport { TimelineSync };\n\n// ============================================================================\n// Stroke Renderer - Unified Canvas-Based Annotation Rendering\n// ============================================================================\n\nimport { StrokeRenderer } from './renderer/StrokeRenderer.js';\n\nexport { StrokeRenderer };\n\n// ============================================================================\n// Converters - Annotation to Stroke Conversion\n// ============================================================================\n\nimport {\n highlightToStrokes,\n textToStrokes,\n underlineToStrokes,\n arrowToStrokes,\n circleToStrokes,\n inkToStrokes\n} from './converters/index.js';\n\nexport { highlightToStrokes };\nexport { textToStrokes };\nexport { underlineToStrokes };\nexport { arrowToStrokes };\nexport { circleToStrokes };\nexport { inkToStrokes };\n\n// ============================================================================\n// Pen Module - Legacy Stroke Rendering (Retained for Compatibility)\n// ============================================================================\n\nimport { GradualRenderer, StrokeDrawer, getPreset, getPresetNames, DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET } from './pen/index.js';\n\nexport { GradualRenderer };\nexport { StrokeDrawer };\nexport { getPreset as getPenPreset };\nexport { getPresetNames as getPenPresetNames };\n\n// ============================================================================\n// Style Presets - Ready-to-use configurations for strokeConfig\n// ============================================================================\n\nexport { getPreset, getPresetNames };\nexport { DEFAULT_PRESET, BLUE_PRESET, MINIMAL_PRESET };\n\n// ============================================================================\n// Utilities\n// ============================================================================\n\nimport * as coordinateUtils from './utils/coordinateUtils.js';\nimport * as viewportUtils from './utils/viewportUtils.js';\n\nexport { coordinateUtils };\nexport { viewportUtils };\n\n// ============================================================================\n// PDF Extraction Utilities\n// ============================================================================\n\nimport { extractAllBlocks, extractMultiplePages } from './utils/pdfExtractor.js';\n\nexport { extractAllBlocks };\nexport { extractMultiplePages };\nexport { extractAllBlocks as extractPDFBlocks };\n\n// ============================================================================\n// Type Definitions & Validators\n// ============================================================================\n\nexport { normalizeAnnotationArray } from './types/validators.js';\nexport * as TypeValidators from './types/index.js';\n\n// ============================================================================\n// Framework Adapters\n// ============================================================================\n\nexport { AnnotPdf } from './adapters/index.js';\n\n// ============================================================================\n// AI Tools for Annotation Generation\n// ============================================================================\n\nexport {\n annotationTools,\n getAnnotationTools,\n handleToolCall,\n handleToolCalls,\n createHighlight,\n createText\n} from './ai-tools/index.js';\n\n// ============================================================================\n// Multilingual Text Support\n// ============================================================================\n\nexport { preloadCJK, setCJKDataUrl } from './converters/glyphResolver.js';\n\n// ============================================================================\n// Package Metadata\n// ============================================================================\n\nexport const VERSION = '0.6.2';\nexport const LIB_NAME = 'web-annotation-renderer';\n"],"names":["VERSION","LIB_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2HY,MAACA,IAAU,SACVC,IAAW;"}
package/dist/index10.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index9.cjs"),e=require("./index25.cjs");exports.normalizeAnnotation=o.normalizeAnnotation;exports.normalizeAnnotationArray=o.normalizeAnnotationArray;exports.normalizeBaseFields=o.normalizeBaseFields;exports.normalizeColor=o.normalizeColor;exports.normalizeCoordinate=o.normalizeCoordinate;exports.normalizeHighlight=o.normalizeHighlight;exports.normalizePositiveNumber=o.normalizePositiveNumber;exports.normalizeText=o.normalizeText;exports.BASE_DEFAULTS=e.BASE_DEFAULTS;exports.HIGHLIGHT_DEFAULTS=e.HIGHLIGHT_DEFAULTS;exports.TEXT_DEFAULTS=e.TEXT_DEFAULTS;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index9.cjs"),e=require("./index26.cjs");exports.normalizeAnnotation=o.normalizeAnnotation;exports.normalizeAnnotationArray=o.normalizeAnnotationArray;exports.normalizeBaseFields=o.normalizeBaseFields;exports.normalizeColor=o.normalizeColor;exports.normalizeCoordinate=o.normalizeCoordinate;exports.normalizeHighlight=o.normalizeHighlight;exports.normalizePositiveNumber=o.normalizePositiveNumber;exports.normalizeText=o.normalizeText;exports.BASE_DEFAULTS=e.BASE_DEFAULTS;exports.HIGHLIGHT_DEFAULTS=e.HIGHLIGHT_DEFAULTS;exports.TEXT_DEFAULTS=e.TEXT_DEFAULTS;
2
2
  //# sourceMappingURL=index10.cjs.map
package/dist/index10.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { normalizeAnnotation as e, normalizeAnnotationArray as i, normalizeBaseFields as n, normalizeColor as a, normalizeCoordinate as l, normalizeHighlight as m, normalizePositiveNumber as t, normalizeText as z } from "./index9.js";
2
- import { BASE_DEFAULTS as T, HIGHLIGHT_DEFAULTS as E, TEXT_DEFAULTS as F } from "./index25.js";
2
+ import { BASE_DEFAULTS as T, HIGHLIGHT_DEFAULTS as E, TEXT_DEFAULTS as F } from "./index26.js";
3
3
  export {
4
4
  T as BASE_DEFAULTS,
5
5
  E as HIGHLIGHT_DEFAULTS,
package/dist/index11.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./index26.cjs"),s=require("./index27.cjs");let r=null,l=null;function f(t){const e=s.default.syllables?.[t];return!e||!e.paths?null:{paths:e.paths,width:1,pathTiming:"sequential"}}function c(t){return{paths:t.map(e=>({points:e})),width:1,pathTiming:"sequential"}}function p(t){if(!r)return null;const e=`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,n=r[e];return n?c(n):null}let o="/cjk.json";function d(t){o=t}async function u(t){return r?void 0:l||(l=fetch(t||o).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}).then(n=>{r=n}).catch(n=>{console.warn("Failed to load CJK font data:",n),l=null}),l)}function a(t){if(!t||t.length===0)return null;const e=t.charCodeAt(0);return t===" "?{paths:[],width:.35}:e>=0&&e<=127?i.default.glyphs?.[t]||null:e>=44032&&e<=55203?f(t):e>=19968&&e<=40959?(!r&&!l&&u(),p(e)):null}exports.default=a;exports.preloadCJK=u;exports.resolveGlyph=a;exports.setCJKDataUrl=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./index27.cjs"),s=require("./index28.cjs");let r=null,l=null;function f(t){const e=s.default.syllables?.[t];return!e||!e.paths?null:{paths:e.paths,width:1,pathTiming:"sequential"}}function c(t){return{paths:t.map(e=>({points:e})),width:1,pathTiming:"sequential"}}function p(t){if(!r)return null;const e=`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,n=r[e];return n?c(n):null}let o="/cjk.json";function d(t){o=t}async function u(t){return r?void 0:l||(l=fetch(t||o).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}).then(n=>{r=n}).catch(n=>{console.warn("Failed to load CJK font data:",n),l=null}),l)}function a(t){if(!t||t.length===0)return null;const e=t.charCodeAt(0);return t===" "?{paths:[],width:.35}:e>=0&&e<=127?i.default.glyphs?.[t]||null:e>=44032&&e<=55203?f(t):e>=19968&&e<=40959?(!r&&!l&&u(),p(e)):null}exports.default=a;exports.preloadCJK=u;exports.resolveGlyph=a;exports.setCJKDataUrl=d;
2
2
  //# sourceMappingURL=index11.cjs.map
package/dist/index11.js CHANGED
@@ -1,5 +1,5 @@
1
- import a from "./index26.js";
2
- import i from "./index27.js";
1
+ import a from "./index27.js";
2
+ import i from "./index28.js";
3
3
  let r = null, l = null;
4
4
  function u(t) {
5
5
  const n = i.syllables?.[t];
package/dist/index13.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./index28.cjs"),n=1e3;function g(l,t){const{id:s,start:r,end:S,quads:e}=l;if(!e||e.length===0)return[];const u=[],f=S-r,b=e.length,i=f/b,p=t.roughness??.5,q=t.bowing??.5,C=t.curveFitting??.95,m=t.curveStepCount??9,v=t.maxRandomnessOffset??2,k=t.disableMultiStroke??!1;for(let o=0;o<e.length;o++){const w=e[o],{x:a,y:x,w:M,h:P}=w,c=x+P/2,$=h.roughLine(a*n,c*n,(a+M)*n,c*n,{roughness:p,bowing:q,seed:h.hashSeed(`${s}-${o}`),curveFitting:C,curveStepCount:m,maxRandomnessOffset:v,disableMultiStroke:k}).map(([O,T])=>[O/n,T/n]),d=r+o*i,E=d+i;u.push({id:`${s}-${o}`,points:$,start:d,end:E,color:t.color||"rgba(255, 255, 0, 0.3)",width:t.width||24,lineCap:t.lineCap||"butt"})}return u}exports.default=g;exports.highlightToStrokes=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./index29.cjs"),n=1e3;function g(l,t){const{id:s,start:r,end:S,quads:e}=l;if(!e||e.length===0)return[];const u=[],f=S-r,b=e.length,i=f/b,p=t.roughness??.5,q=t.bowing??.5,C=t.curveFitting??.95,m=t.curveStepCount??9,v=t.maxRandomnessOffset??2,k=t.disableMultiStroke??!1;for(let o=0;o<e.length;o++){const w=e[o],{x:a,y:x,w:M,h:P}=w,c=x+P/2,$=h.roughLine(a*n,c*n,(a+M)*n,c*n,{roughness:p,bowing:q,seed:h.hashSeed(`${s}-${o}`),curveFitting:C,curveStepCount:m,maxRandomnessOffset:v,disableMultiStroke:k}).map(([O,T])=>[O/n,T/n]),d=r+o*i,E=d+i;u.push({id:`${s}-${o}`,points:$,start:d,end:E,color:t.color||"rgba(255, 255, 0, 0.3)",width:t.width||24,lineCap:t.lineCap||"butt"})}return u}exports.default=g;exports.highlightToStrokes=g;
2
2
  //# sourceMappingURL=index13.cjs.map
package/dist/index13.js CHANGED
@@ -1,4 +1,4 @@
1
- import { roughLine as L, hashSeed as M } from "./index28.js";
1
+ import { roughLine as L, hashSeed as M } from "./index29.js";
2
2
  const o = 1e3;
3
3
  function R(h, t) {
4
4
  const { id: e, start: r, end: g, quads: s } = h;
package/dist/index14.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("./index11.cjs"),X=require("./index28.cjs");function P(e){const t=Math.sin(e)*1e4;return(t-Math.floor(t))*2-1}function _(e,t,n){return e.map(([r,c],o)=>[r+P(n+o*2)*t,c+P(n+o*2+1)*t])}function A(e,t,n){return e.map(([r,c])=>[(t+r)*n,c*n])}function $(e,t){const{id:n,start:r,end:c,content:o,x:b,y:D,fontSize:T}=e;if(!o||o.length===0)return[];const g=[],v=c-r,w=T||t.fontSize||16,z=t.roughness??1.5,C=w/1e3;let i=0;const M=o.length,p=v/M;for(let a=0;a<o.length;a++){const k=o[a],h=R.resolveGlyph(k);if(!h){i+=.5+.18;continue}const S=h.width||.5,l=h.paths||[],q=h.pathTiming||"sequential";if(l.length===0){i+=S+.18;continue}const d=r+a*p,y=d+p,E=l.length;for(let s=0;s<l.length;s++){const m=l[s].points||[];if(m.length<2)continue;const j=A(m,i,C),G=z*7e-4,I=X.hashSeed(`${n}-${a}-${s}`),O=_(j,G,I);let u,f;if(q==="parallel")u=d,f=y;else{const x=p/E;u=d+s*x,f=u+x}g.push({id:`${n}-${a}-${s}`,points:O,baseX:b,baseY:D,start:u,end:f,color:t.color||"rgba(220, 20, 60, 1.0)",width:t.width||2,lineCap:t.lineCap||"round",uniformScale:!0})}i+=S+.18}return g}exports.default=$;exports.textToStrokes=$;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("./index11.cjs"),X=require("./index29.cjs");function P(e){const t=Math.sin(e)*1e4;return(t-Math.floor(t))*2-1}function _(e,t,n){return e.map(([r,c],o)=>[r+P(n+o*2)*t,c+P(n+o*2+1)*t])}function A(e,t,n){return e.map(([r,c])=>[(t+r)*n,c*n])}function $(e,t){const{id:n,start:r,end:c,content:o,x:b,y:D,fontSize:T}=e;if(!o||o.length===0)return[];const g=[],v=c-r,w=T||t.fontSize||16,z=t.roughness??1.5,C=w/1e3;let i=0;const M=o.length,p=v/M;for(let a=0;a<o.length;a++){const k=o[a],h=R.resolveGlyph(k);if(!h){i+=.5+.18;continue}const S=h.width||.5,l=h.paths||[],q=h.pathTiming||"sequential";if(l.length===0){i+=S+.18;continue}const d=r+a*p,y=d+p,E=l.length;for(let s=0;s<l.length;s++){const m=l[s].points||[];if(m.length<2)continue;const j=A(m,i,C),G=z*7e-4,I=X.hashSeed(`${n}-${a}-${s}`),O=_(j,G,I);let u,f;if(q==="parallel")u=d,f=y;else{const x=p/E;u=d+s*x,f=u+x}g.push({id:`${n}-${a}-${s}`,points:O,baseX:b,baseY:D,start:u,end:f,color:t.color||"rgba(220, 20, 60, 1.0)",width:t.width||2,lineCap:t.lineCap||"round",uniformScale:!0})}i+=S+.18}return g}exports.default=$;exports.textToStrokes=$;
2
2
  //# sourceMappingURL=index14.cjs.map
package/dist/index14.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolveGlyph as y } from "./index11.js";
2
- import { hashSeed as A } from "./index28.js";
2
+ import { hashSeed as A } from "./index29.js";
3
3
  function $(e) {
4
4
  const t = Math.sin(e) * 1e4;
5
5
  return (t - Math.floor(t)) * 2 - 1;
package/dist/index15.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("./index28.cjs"),o=1e3;function h(l,t){const{id:s,start:r,end:S,quads:e}=l;if(!e||e.length===0)return[];const u=[],f=S-r,p=e.length,i=f/p,b=t.roughness??1,q=t.bowing??1,m=t.curveFitting??.95,v=t.curveStepCount??9,C=t.maxRandomnessOffset??2,k=t.disableMultiStroke??!1;for(let n=0;n<e.length;n++){const w=e[n],{x:a,y:x,w:M,h:P}=w,c=x+P,$=g.roughLine(a*o,c*o,(a+M)*o,c*o,{roughness:b,bowing:q,seed:g.hashSeed(`${s}-${n}`),curveFitting:m,curveStepCount:v,maxRandomnessOffset:C,disableMultiStroke:k}).map(([O,T])=>[O/o,T/o]),d=r+n*i,E=d+i;u.push({id:`${s}-${n}`,points:$,start:d,end:E,color:t.color||"rgba(0, 0, 255, 0.8)",width:t.width||2,lineCap:t.lineCap||"round"})}return u}exports.default=h;exports.underlineToStrokes=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("./index29.cjs"),o=1e3;function h(l,t){const{id:s,start:r,end:S,quads:e}=l;if(!e||e.length===0)return[];const u=[],f=S-r,p=e.length,i=f/p,b=t.roughness??1,q=t.bowing??1,m=t.curveFitting??.95,v=t.curveStepCount??9,C=t.maxRandomnessOffset??2,k=t.disableMultiStroke??!1;for(let n=0;n<e.length;n++){const w=e[n],{x:a,y:x,w:M,h:P}=w,c=x+P,$=g.roughLine(a*o,c*o,(a+M)*o,c*o,{roughness:b,bowing:q,seed:g.hashSeed(`${s}-${n}`),curveFitting:m,curveStepCount:v,maxRandomnessOffset:C,disableMultiStroke:k}).map(([O,T])=>[O/o,T/o]),d=r+n*i,E=d+i;u.push({id:`${s}-${n}`,points:$,start:d,end:E,color:t.color||"rgba(0, 0, 255, 0.8)",width:t.width||2,lineCap:t.lineCap||"round"})}return u}exports.default=h;exports.underlineToStrokes=h;
2
2
  //# sourceMappingURL=index15.cjs.map
package/dist/index15.js CHANGED
@@ -1,4 +1,4 @@
1
- import { roughLine as L, hashSeed as M } from "./index28.js";
1
+ import { roughLine as L, hashSeed as M } from "./index29.js";
2
2
  const o = 1e3;
3
3
  function R(h, n) {
4
4
  const { id: e, start: r, end: g, quads: s } = h;
package/dist/index16.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./index28.cjs"),t=1e3;function E(W,n){const{id:i,start:h,end:_,from_x:c,from_y:u,to_x:o,to_y:e}=W;if(typeof c!="number"||typeof u!="number"||typeof o!="number"||typeof e!="number")return[];const d=[],L=_-h,P=L*.7,$=L*.3,m=n.roughness??.8,S=n.bowing??.8,b=n.curveFitting??.95,M=n.curveStepCount??9,w=n.maxRandomnessOffset??2,C=n.disableMultiStroke??!1,k=r.roughLine(c*t,u*t,o*t,e*t,{roughness:m,bowing:S,seed:r.hashSeed(`${i}-line`),curveFitting:b,curveStepCount:M,maxRandomnessOffset:w,disableMultiStroke:C}).map(([s,a])=>[s/t,a/t]);d.push({id:`${i}-0`,points:k,start:h,end:h+P,color:n.color||"rgba(255, 0, 0, 0.8)",width:n.width||2,lineCap:n.lineCap||"round"});const x=Math.sqrt((o-c)**2+(e-u)**2),g=Math.min(x*.2,.03),p=Math.atan2(e-u,o-c),f=Math.PI/6,D=o-g*Math.cos(p-f),R=e-g*Math.sin(p-f),O=o-g*Math.cos(p+f),T=e-g*Math.sin(p+f),q=r.roughLine(o*t,e*t,D*t,R*t,{roughness:m,bowing:S,seed:r.hashSeed(`${i}-left`),curveFitting:b,curveStepCount:M,maxRandomnessOffset:w,disableMultiStroke:C}).map(([s,a])=>[s/t,a/t]),A=r.roughLine(o*t,e*t,O*t,T*t,{roughness:m,bowing:S,seed:r.hashSeed(`${i}-right`),curveFitting:b,curveStepCount:M,maxRandomnessOffset:w,disableMultiStroke:C}).map(([s,a])=>[s/t,a/t]),l=h+P,v=$/2;return d.push({id:`${i}-1`,points:q,start:l,end:l+v,color:n.color||"rgba(255, 0, 0, 0.8)",width:n.width||2,lineCap:n.lineCap||"round"}),d.push({id:`${i}-2`,points:A,start:l,end:l+v,color:n.color||"rgba(255, 0, 0, 0.8)",width:n.width||2,lineCap:n.lineCap||"round"}),d}exports.arrowToStrokes=E;exports.default=E;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./index29.cjs"),t=1e3;function E(W,n){const{id:i,start:h,end:_,from_x:c,from_y:u,to_x:o,to_y:e}=W;if(typeof c!="number"||typeof u!="number"||typeof o!="number"||typeof e!="number")return[];const d=[],L=_-h,P=L*.7,$=L*.3,m=n.roughness??.8,S=n.bowing??.8,b=n.curveFitting??.95,M=n.curveStepCount??9,w=n.maxRandomnessOffset??2,C=n.disableMultiStroke??!1,k=r.roughLine(c*t,u*t,o*t,e*t,{roughness:m,bowing:S,seed:r.hashSeed(`${i}-line`),curveFitting:b,curveStepCount:M,maxRandomnessOffset:w,disableMultiStroke:C}).map(([s,a])=>[s/t,a/t]);d.push({id:`${i}-0`,points:k,start:h,end:h+P,color:n.color||"rgba(255, 0, 0, 0.8)",width:n.width||2,lineCap:n.lineCap||"round"});const x=Math.sqrt((o-c)**2+(e-u)**2),g=Math.min(x*.2,.03),p=Math.atan2(e-u,o-c),f=Math.PI/6,D=o-g*Math.cos(p-f),R=e-g*Math.sin(p-f),O=o-g*Math.cos(p+f),T=e-g*Math.sin(p+f),q=r.roughLine(o*t,e*t,D*t,R*t,{roughness:m,bowing:S,seed:r.hashSeed(`${i}-left`),curveFitting:b,curveStepCount:M,maxRandomnessOffset:w,disableMultiStroke:C}).map(([s,a])=>[s/t,a/t]),A=r.roughLine(o*t,e*t,O*t,T*t,{roughness:m,bowing:S,seed:r.hashSeed(`${i}-right`),curveFitting:b,curveStepCount:M,maxRandomnessOffset:w,disableMultiStroke:C}).map(([s,a])=>[s/t,a/t]),l=h+P,v=$/2;return d.push({id:`${i}-1`,points:q,start:l,end:l+v,color:n.color||"rgba(255, 0, 0, 0.8)",width:n.width||2,lineCap:n.lineCap||"round"}),d.push({id:`${i}-2`,points:A,start:l,end:l+v,color:n.color||"rgba(255, 0, 0, 0.8)",width:n.width||2,lineCap:n.lineCap||"round"}),d}exports.arrowToStrokes=E;exports.default=E;
2
2
  //# sourceMappingURL=index16.cjs.map
package/dist/index16.js CHANGED
@@ -1,4 +1,4 @@
1
- import { roughLine as S, hashSeed as L } from "./index28.js";
1
+ import { roughLine as S, hashSeed as L } from "./index29.js";
2
2
  const n = 1e3;
3
3
  function T(x, t) {
4
4
  const { id: r, start: a, end: E, from_x: c, from_y: h, to_x: o, to_y: i } = x;
package/dist/index17.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./index28.cjs"),e=1e3;function c(a,o){const{id:t,start:d,end:f,cx:n,cy:r,rx:u,ry:s}=a;if(typeof n!="number"||typeof r!="number"||typeof u!="number"||typeof s!="number")return[];const g=o.roughness??1,p=o.bowing??1,b=o.curveFitting??.95,h=o.curveStepCount??9,l=o.maxRandomnessOffset??2,m=o.disableMultiStroke??!1,S=i.roughEllipse(n*e,r*e,u*2*e,s*2*e,{roughness:g,bowing:p,seed:i.hashSeed(t),curveFitting:b,curveStepCount:h,maxRandomnessOffset:l,disableMultiStroke:m}).map(([v,x])=>[v/e,x/e]);return[{id:t,points:S,start:d,end:f,color:o.color||"rgba(255, 165, 0, 0.8)",width:o.width||3,lineCap:o.lineCap||"round"}]}exports.circleToStrokes=c;exports.default=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./index29.cjs"),e=1e3;function c(a,o){const{id:t,start:d,end:f,cx:n,cy:r,rx:u,ry:s}=a;if(typeof n!="number"||typeof r!="number"||typeof u!="number"||typeof s!="number")return[];const g=o.roughness??1,p=o.bowing??1,b=o.curveFitting??.95,h=o.curveStepCount??9,l=o.maxRandomnessOffset??2,m=o.disableMultiStroke??!1,S=i.roughEllipse(n*e,r*e,u*2*e,s*2*e,{roughness:g,bowing:p,seed:i.hashSeed(t),curveFitting:b,curveStepCount:h,maxRandomnessOffset:l,disableMultiStroke:m}).map(([v,x])=>[v/e,x/e]);return[{id:t,points:S,start:d,end:f,color:o.color||"rgba(255, 165, 0, 0.8)",width:o.width||3,lineCap:o.lineCap||"round"}]}exports.circleToStrokes=c;exports.default=c;
2
2
  //# sourceMappingURL=index17.cjs.map
package/dist/index17.js CHANGED
@@ -1,4 +1,4 @@
1
- import { roughEllipse as x, hashSeed as C } from "./index28.js";
1
+ import { roughEllipse as x, hashSeed as C } from "./index29.js";
2
2
  const n = 1e3;
3
3
  function k(u, o) {
4
4
  const { id: t, start: c, end: a, cx: e, cy: r, rx: s, ry: i } = u;
package/dist/index18.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./index19.cjs");class o{constructor(t,s){this.canvas=t,this.dimensions={...s},this.ctx=null,this.strokeDrawer=null,this.strokeCommands=[],this.currentTime=0,this.isDestroyed=!1,this._setupCanvas()}_setupCanvas(){const t=window.devicePixelRatio||1,{width:s,height:e}=this.dimensions;this.canvas.width=Math.round(s*t),this.canvas.height=Math.round(e*t),this.canvas.style.width=`${s}px`,this.canvas.style.height=`${e}px`,this.ctx=this.canvas.getContext("2d"),this.ctx.setTransform(t,0,0,t,0,0),this.strokeDrawer=new n.default(this.ctx,this.dimensions)}setStrokeCommands(t){this.isDestroyed||(this.strokeCommands=t||[],this.strokeCommands.sort((s,e)=>{const r=s.start??0,i=e.start??0;return r-i}))}setTime(t){this.isDestroyed||(this.currentTime=t)}setDimensions(t){this.isDestroyed||(this.dimensions={...t},this._setupCanvas())}render(){if(!(this.isDestroyed||!this.ctx)){this.strokeDrawer.clear();for(const t of this.strokeCommands){const s=t.start??0,e=t.end??s+1;if(this.currentTime<s)continue;const r=this._calculateProgress(s,e);this.strokeDrawer.drawStroke(t,r)}}}_calculateProgress(t,s){if(this.currentTime>=s)return 1;const e=s-t;if(e<=0)return 1;const r=this.currentTime-t;return Math.max(0,Math.min(1,r/e))}clear(){this.isDestroyed||!this.strokeDrawer||this.strokeDrawer.clear()}getVisibleStrokeCount(){let t=0;for(const s of this.strokeCommands){const e=s.start??0;this.currentTime>=e&&t++}return t}destroy(){this.isDestroyed||(this.strokeCommands=[],this.strokeDrawer=null,this.ctx=null,this.canvas=null,this.isDestroyed=!0)}}exports.default=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(d,i){const{id:c,start:n,end:r,strokes:o}=d;if(!o||o.length===0)return[];const a=r-n;if(a<=0)return[];const f=o.reduce((t,e)=>Math.max(t,(e.timeOffset||0)+(e.duration||.5)),0)||1,s=a/f;return o.filter(t=>t.points&&t.points.length>=2).map((t,e)=>({id:`${c}-${e}`,points:t.points,start:n+(t.timeOffset||0)*s,end:Math.min(n+((t.timeOffset||0)+(t.duration||.5))*s,r),color:t.color||i.color||"#DC143C",width:t.width||i.width||2,lineCap:i.lineCap||"round"}))}exports.inkToStrokes=l;
2
2
  //# sourceMappingURL=index18.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index18.cjs","sources":["../src/pen/GradualRenderer.js"],"sourcesContent":["import StrokeDrawer from './StrokeDrawer.js';\n\n/**\n * GradualRenderer - Progressive stroke rendering synced to timeline\n *\n * Renders stroke commands with progressive reveal based on current\n * audio/video timeline position.\n *\n * Features:\n * - Progressive stroke reveal synced to audio timeline\n * - High-DPI canvas support for crisp rendering\n * - Efficient single-pass render per timeline update\n * - Accepts timing in seconds (start/end fields)\n *\n * @example\n * const renderer = new GradualRenderer(canvas, { width: 800, height: 600 });\n * renderer.setStrokeCommands(commands);\n * renderer.setTime(1.5); // seconds\n * renderer.render();\n */\nclass GradualRenderer {\n /**\n * Creates a new GradualRenderer instance\n *\n * @param {HTMLCanvasElement} canvas - Canvas element for rendering\n * @param {Object} pdfDimensions - PDF page dimensions\n * @param {number} pdfDimensions.width - Page width in pixels\n * @param {number} pdfDimensions.height - Page height in pixels\n */\n constructor(canvas, pdfDimensions) {\n this.canvas = canvas;\n this.dimensions = { ...pdfDimensions };\n this.ctx = null;\n this.strokeDrawer = null;\n this.strokeCommands = [];\n this.currentTime = 0; // seconds\n this.isDestroyed = false;\n\n this._setupCanvas();\n }\n\n /**\n * Configures canvas for high-DPI rendering\n *\n * @private\n */\n _setupCanvas() {\n const dpr = window.devicePixelRatio || 1;\n const { width, height } = this.dimensions;\n\n // Set canvas buffer resolution (high-res)\n this.canvas.width = Math.round(width * dpr);\n this.canvas.height = Math.round(height * dpr);\n\n // Set canvas display size (CSS)\n this.canvas.style.width = `${width}px`;\n this.canvas.style.height = `${height}px`;\n\n // Get context and scale for DPR\n this.ctx = this.canvas.getContext('2d');\n this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n\n // Create stroke drawer\n this.strokeDrawer = new StrokeDrawer(this.ctx, this.dimensions);\n }\n\n /**\n * Sets the stroke commands to render\n *\n * @param {Array} commands - Array of stroke command objects\n * @param {string} commands[].id - Unique stroke identifier\n * @param {Array} commands[].points - [[x, y], ...] normalized coordinates\n * @param {string} commands[].color - Stroke color\n * @param {number} commands[].width - Stroke width in pixels\n * @param {number} commands[].start - Start time in seconds\n * @param {number} commands[].end - End time in seconds\n */\n setStrokeCommands(commands) {\n if (this.isDestroyed) return;\n\n this.strokeCommands = commands || [];\n\n // Sort by start time for efficient rendering\n this.strokeCommands.sort((a, b) => {\n const startA = a.start ?? 0;\n const startB = b.start ?? 0;\n return startA - startB;\n });\n }\n\n /**\n * Sets the current timeline position\n *\n * @param {number} time - Current time in seconds\n */\n setTime(time) {\n if (this.isDestroyed) return;\n this.currentTime = time;\n }\n\n /**\n * Updates dimensions when viewport changes\n *\n * @param {Object} dimensions - New dimensions\n * @param {number} dimensions.width - Width in pixels\n * @param {number} dimensions.height - Height in pixels\n */\n setDimensions(dimensions) {\n if (this.isDestroyed) return;\n\n this.dimensions = { ...dimensions };\n this._setupCanvas();\n }\n\n /**\n * Renders all visible strokes at current timeline position\n *\n * Called once per timeline update. Clears canvas and redraws\n * all strokes with appropriate progress.\n */\n render() {\n if (this.isDestroyed || !this.ctx) return;\n\n // Clear canvas\n this.strokeDrawer.clear();\n\n // Draw each stroke based on timing\n for (const stroke of this.strokeCommands) {\n const start = stroke.start ?? 0;\n const end = stroke.end ?? start + 1;\n\n // Skip strokes that haven't started\n if (this.currentTime < start) {\n continue;\n }\n\n // Calculate progress\n const progress = this._calculateProgress(start, end);\n\n // Draw stroke with progress\n this.strokeDrawer.drawStroke(stroke, progress);\n }\n }\n\n /**\n * Calculates stroke progress based on timing\n *\n * @private\n * @param {number} start - Stroke start time in seconds\n * @param {number} end - Stroke end time in seconds\n * @returns {number} Progress from 0 to 1\n */\n _calculateProgress(start, end) {\n if (this.currentTime >= end) {\n return 1.0; // Fully visible\n }\n\n const duration = end - start;\n if (duration <= 0) return 1.0;\n\n const elapsed = this.currentTime - start;\n return Math.max(0, Math.min(1, elapsed / duration));\n }\n\n /**\n * Clears the canvas\n */\n clear() {\n if (this.isDestroyed || !this.strokeDrawer) return;\n this.strokeDrawer.clear();\n }\n\n /**\n * Gets visible stroke count at current time\n *\n * @returns {number} Number of visible strokes\n */\n getVisibleStrokeCount() {\n let count = 0;\n for (const stroke of this.strokeCommands) {\n const start = stroke.start ?? 0;\n if (this.currentTime >= start) {\n count++;\n }\n }\n return count;\n }\n\n /**\n * Destroys the renderer and releases resources\n */\n destroy() {\n if (this.isDestroyed) return;\n\n this.strokeCommands = [];\n this.strokeDrawer = null;\n this.ctx = null;\n this.canvas = null;\n this.isDestroyed = true;\n }\n}\n\nexport default GradualRenderer;\n"],"names":["GradualRenderer","canvas","pdfDimensions","dpr","width","height","StrokeDrawer","commands","a","b","startA","startB","time","dimensions","stroke","start","end","progress","duration","elapsed","count"],"mappings":"6IAoBA,MAAMA,CAAgB,CASpB,YAAYC,EAAQC,EAAe,CACjC,KAAK,OAASD,EACd,KAAK,WAAa,CAAE,GAAGC,CAAa,EACpC,KAAK,IAAM,KACX,KAAK,aAAe,KACpB,KAAK,eAAiB,CAAA,EACtB,KAAK,YAAc,EACnB,KAAK,YAAc,GAEnB,KAAK,aAAY,CACnB,CAOA,cAAe,CACb,MAAMC,EAAM,OAAO,kBAAoB,EACjC,CAAE,MAAAC,EAAO,OAAAC,CAAM,EAAK,KAAK,WAG/B,KAAK,OAAO,MAAQ,KAAK,MAAMD,EAAQD,CAAG,EAC1C,KAAK,OAAO,OAAS,KAAK,MAAME,EAASF,CAAG,EAG5C,KAAK,OAAO,MAAM,MAAQ,GAAGC,CAAK,KAClC,KAAK,OAAO,MAAM,OAAS,GAAGC,CAAM,KAGpC,KAAK,IAAM,KAAK,OAAO,WAAW,IAAI,EACtC,KAAK,IAAI,aAAaF,EAAK,EAAG,EAAGA,EAAK,EAAG,CAAC,EAG1C,KAAK,aAAe,IAAIG,EAAAA,QAAa,KAAK,IAAK,KAAK,UAAU,CAChE,CAaA,kBAAkBC,EAAU,CACtB,KAAK,cAET,KAAK,eAAiBA,GAAY,CAAA,EAGlC,KAAK,eAAe,KAAK,CAACC,EAAGC,IAAM,CACjC,MAAMC,EAASF,EAAE,OAAS,EACpBG,EAASF,EAAE,OAAS,EAC1B,OAAOC,EAASC,CAClB,CAAC,EACH,CAOA,QAAQC,EAAM,CACR,KAAK,cACT,KAAK,YAAcA,EACrB,CASA,cAAcC,EAAY,CACpB,KAAK,cAET,KAAK,WAAa,CAAE,GAAGA,CAAU,EACjC,KAAK,aAAY,EACnB,CAQA,QAAS,CACP,GAAI,OAAK,aAAe,CAAC,KAAK,KAG9B,MAAK,aAAa,MAAK,EAGvB,UAAWC,KAAU,KAAK,eAAgB,CACxC,MAAMC,EAAQD,EAAO,OAAS,EACxBE,EAAMF,EAAO,KAAOC,EAAQ,EAGlC,GAAI,KAAK,YAAcA,EACrB,SAIF,MAAME,EAAW,KAAK,mBAAmBF,EAAOC,CAAG,EAGnD,KAAK,aAAa,WAAWF,EAAQG,CAAQ,CAC/C,EACF,CAUA,mBAAmBF,EAAOC,EAAK,CAC7B,GAAI,KAAK,aAAeA,EACtB,MAAO,GAGT,MAAME,EAAWF,EAAMD,EACvB,GAAIG,GAAY,EAAG,MAAO,GAE1B,MAAMC,EAAU,KAAK,YAAcJ,EACnC,OAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAGI,EAAUD,CAAQ,CAAC,CACpD,CAKA,OAAQ,CACF,KAAK,aAAe,CAAC,KAAK,cAC9B,KAAK,aAAa,MAAK,CACzB,CAOA,uBAAwB,CACtB,IAAIE,EAAQ,EACZ,UAAWN,KAAU,KAAK,eAAgB,CACxC,MAAMC,EAAQD,EAAO,OAAS,EAC1B,KAAK,aAAeC,GACtBK,GAEJ,CACA,OAAOA,CACT,CAKA,SAAU,CACJ,KAAK,cAET,KAAK,eAAiB,CAAA,EACtB,KAAK,aAAe,KACpB,KAAK,IAAM,KACX,KAAK,OAAS,KACd,KAAK,YAAc,GACrB,CACF"}
1
+ {"version":3,"file":"index18.cjs","sources":["../src/converters/ink.js"],"sourcesContent":["/**\n * Ink Annotation Converter\n *\n * Converts freehand ink annotations to renderer stroke commands.\n * Unlike other converters, ink does NOT use RoughJS strokes are\n * already hand-drawn and only need timing mapped to the annotation window.\n *\n * @module converters/ink\n */\n\n/**\n * Convert ink annotation to renderer strokes\n *\n * Maps each sub-stroke's recorded timing (timeOffset + duration) to the\n * annotation's playback window [start, end] using a proportional timeScale.\n *\n * @param {Object} annotation - Ink annotation object\n * @param {string} annotation.id - Annotation ID\n * @param {number} annotation.start - Playback start time (seconds)\n * @param {number} annotation.end - Playback end time (seconds)\n * @param {Array} annotation.strokes - Sub-strokes with points and timing\n * @param {Object} style - Resolved style from StrokeRenderer config\n * @returns {Array} Renderer stroke commands\n */\nexport function inkToStrokes(annotation, style) {\n const { id, start, end, strokes: subStrokes } = annotation;\n if (!subStrokes || subStrokes.length === 0) return [];\n\n const totalDuration = end - start;\n if (totalDuration <= 0) return [];\n\n // Calculate recorded session length from stroke timing\n const sessionDuration = subStrokes.reduce(\n (max, s) => Math.max(max, (s.timeOffset || 0) + (s.duration || 0.5)),\n 0\n ) || 1;\n const timeScale = totalDuration / sessionDuration;\n\n return subStrokes\n .filter((sub) => sub.points && sub.points.length >= 2)\n .map((sub, i) => ({\n id: `${id}-${i}`,\n points: sub.points,\n start: start + (sub.timeOffset || 0) * timeScale,\n end: Math.min(\n start + ((sub.timeOffset || 0) + (sub.duration || 0.5)) * timeScale,\n end\n ),\n color: sub.color || style.color || '#DC143C',\n width: sub.width || style.width || 2,\n lineCap: style.lineCap || 'round',\n }));\n}\n"],"names":["inkToStrokes","annotation","style","id","start","end","subStrokes","totalDuration","sessionDuration","max","s","timeScale","sub","i"],"mappings":"gFAwBO,SAASA,EAAaC,EAAYC,EAAO,CAC9C,KAAM,CAAE,GAAAC,EAAI,MAAAC,EAAO,IAAAC,EAAK,QAASC,CAAU,EAAKL,EAChD,GAAI,CAACK,GAAcA,EAAW,SAAW,EAAG,MAAO,CAAA,EAEnD,MAAMC,EAAgBF,EAAMD,EAC5B,GAAIG,GAAiB,EAAG,MAAO,CAAA,EAG/B,MAAMC,EAAkBF,EAAW,OACjC,CAACG,EAAKC,IAAM,KAAK,IAAID,GAAMC,EAAE,YAAc,IAAMA,EAAE,UAAY,GAAI,EACnE,CACJ,GAAO,EACCC,EAAYJ,EAAgBC,EAElC,OAAOF,EACJ,OAAQM,GAAQA,EAAI,QAAUA,EAAI,OAAO,QAAU,CAAC,EACpD,IAAI,CAACA,EAAKC,KAAO,CAChB,GAAI,GAAGV,CAAE,IAAIU,CAAC,GACd,OAAQD,EAAI,OACZ,MAAOR,GAASQ,EAAI,YAAc,GAAKD,EACvC,IAAK,KAAK,IACRP,IAAUQ,EAAI,YAAc,IAAMA,EAAI,UAAY,KAAQD,EAC1DN,CACR,EACM,MAAOO,EAAI,OAASV,EAAM,OAAS,UACnC,MAAOU,EAAI,OAASV,EAAM,OAAS,EACnC,QAASA,EAAM,SAAW,OAChC,EAAM,CACN"}
package/dist/index18.js CHANGED
@@ -1,121 +1,26 @@
1
- import n from "./index19.js";
2
- class h {
3
- /**
4
- * Creates a new GradualRenderer instance
5
- *
6
- * @param {HTMLCanvasElement} canvas - Canvas element for rendering
7
- * @param {Object} pdfDimensions - PDF page dimensions
8
- * @param {number} pdfDimensions.width - Page width in pixels
9
- * @param {number} pdfDimensions.height - Page height in pixels
10
- */
11
- constructor(t, s) {
12
- this.canvas = t, this.dimensions = { ...s }, this.ctx = null, this.strokeDrawer = null, this.strokeCommands = [], this.currentTime = 0, this.isDestroyed = !1, this._setupCanvas();
13
- }
14
- /**
15
- * Configures canvas for high-DPI rendering
16
- *
17
- * @private
18
- */
19
- _setupCanvas() {
20
- const t = window.devicePixelRatio || 1, { width: s, height: e } = this.dimensions;
21
- this.canvas.width = Math.round(s * t), this.canvas.height = Math.round(e * t), this.canvas.style.width = `${s}px`, this.canvas.style.height = `${e}px`, this.ctx = this.canvas.getContext("2d"), this.ctx.setTransform(t, 0, 0, t, 0, 0), this.strokeDrawer = new n(this.ctx, this.dimensions);
22
- }
23
- /**
24
- * Sets the stroke commands to render
25
- *
26
- * @param {Array} commands - Array of stroke command objects
27
- * @param {string} commands[].id - Unique stroke identifier
28
- * @param {Array} commands[].points - [[x, y], ...] normalized coordinates
29
- * @param {string} commands[].color - Stroke color
30
- * @param {number} commands[].width - Stroke width in pixels
31
- * @param {number} commands[].start - Start time in seconds
32
- * @param {number} commands[].end - End time in seconds
33
- */
34
- setStrokeCommands(t) {
35
- this.isDestroyed || (this.strokeCommands = t || [], this.strokeCommands.sort((s, e) => {
36
- const r = s.start ?? 0, i = e.start ?? 0;
37
- return r - i;
38
- }));
39
- }
40
- /**
41
- * Sets the current timeline position
42
- *
43
- * @param {number} time - Current time in seconds
44
- */
45
- setTime(t) {
46
- this.isDestroyed || (this.currentTime = t);
47
- }
48
- /**
49
- * Updates dimensions when viewport changes
50
- *
51
- * @param {Object} dimensions - New dimensions
52
- * @param {number} dimensions.width - Width in pixels
53
- * @param {number} dimensions.height - Height in pixels
54
- */
55
- setDimensions(t) {
56
- this.isDestroyed || (this.dimensions = { ...t }, this._setupCanvas());
57
- }
58
- /**
59
- * Renders all visible strokes at current timeline position
60
- *
61
- * Called once per timeline update. Clears canvas and redraws
62
- * all strokes with appropriate progress.
63
- */
64
- render() {
65
- if (!(this.isDestroyed || !this.ctx)) {
66
- this.strokeDrawer.clear();
67
- for (const t of this.strokeCommands) {
68
- const s = t.start ?? 0, e = t.end ?? s + 1;
69
- if (this.currentTime < s)
70
- continue;
71
- const r = this._calculateProgress(s, e);
72
- this.strokeDrawer.drawStroke(t, r);
73
- }
74
- }
75
- }
76
- /**
77
- * Calculates stroke progress based on timing
78
- *
79
- * @private
80
- * @param {number} start - Stroke start time in seconds
81
- * @param {number} end - Stroke end time in seconds
82
- * @returns {number} Progress from 0 to 1
83
- */
84
- _calculateProgress(t, s) {
85
- if (this.currentTime >= s)
86
- return 1;
87
- const e = s - t;
88
- if (e <= 0) return 1;
89
- const r = this.currentTime - t;
90
- return Math.max(0, Math.min(1, r / e));
91
- }
92
- /**
93
- * Clears the canvas
94
- */
95
- clear() {
96
- this.isDestroyed || !this.strokeDrawer || this.strokeDrawer.clear();
97
- }
98
- /**
99
- * Gets visible stroke count at current time
100
- *
101
- * @returns {number} Number of visible strokes
102
- */
103
- getVisibleStrokeCount() {
104
- let t = 0;
105
- for (const s of this.strokeCommands) {
106
- const e = s.start ?? 0;
107
- this.currentTime >= e && t++;
108
- }
109
- return t;
110
- }
111
- /**
112
- * Destroys the renderer and releases resources
113
- */
114
- destroy() {
115
- this.isDestroyed || (this.strokeCommands = [], this.strokeDrawer = null, this.ctx = null, this.canvas = null, this.isDestroyed = !0);
116
- }
1
+ function l(d, i) {
2
+ const { id: c, start: e, end: r, strokes: n } = d;
3
+ if (!n || n.length === 0) return [];
4
+ const a = r - e;
5
+ if (a <= 0) return [];
6
+ const f = n.reduce(
7
+ (t, o) => Math.max(t, (o.timeOffset || 0) + (o.duration || 0.5)),
8
+ 0
9
+ ) || 1, s = a / f;
10
+ return n.filter((t) => t.points && t.points.length >= 2).map((t, o) => ({
11
+ id: `${c}-${o}`,
12
+ points: t.points,
13
+ start: e + (t.timeOffset || 0) * s,
14
+ end: Math.min(
15
+ e + ((t.timeOffset || 0) + (t.duration || 0.5)) * s,
16
+ r
17
+ ),
18
+ color: t.color || i.color || "#DC143C",
19
+ width: t.width || i.width || 2,
20
+ lineCap: i.lineCap || "round"
21
+ }));
117
22
  }
118
23
  export {
119
- h as default
24
+ l as inkToStrokes
120
25
  };
121
26
  //# sourceMappingURL=index18.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index18.js","sources":["../src/pen/GradualRenderer.js"],"sourcesContent":["import StrokeDrawer from './StrokeDrawer.js';\n\n/**\n * GradualRenderer - Progressive stroke rendering synced to timeline\n *\n * Renders stroke commands with progressive reveal based on current\n * audio/video timeline position.\n *\n * Features:\n * - Progressive stroke reveal synced to audio timeline\n * - High-DPI canvas support for crisp rendering\n * - Efficient single-pass render per timeline update\n * - Accepts timing in seconds (start/end fields)\n *\n * @example\n * const renderer = new GradualRenderer(canvas, { width: 800, height: 600 });\n * renderer.setStrokeCommands(commands);\n * renderer.setTime(1.5); // seconds\n * renderer.render();\n */\nclass GradualRenderer {\n /**\n * Creates a new GradualRenderer instance\n *\n * @param {HTMLCanvasElement} canvas - Canvas element for rendering\n * @param {Object} pdfDimensions - PDF page dimensions\n * @param {number} pdfDimensions.width - Page width in pixels\n * @param {number} pdfDimensions.height - Page height in pixels\n */\n constructor(canvas, pdfDimensions) {\n this.canvas = canvas;\n this.dimensions = { ...pdfDimensions };\n this.ctx = null;\n this.strokeDrawer = null;\n this.strokeCommands = [];\n this.currentTime = 0; // seconds\n this.isDestroyed = false;\n\n this._setupCanvas();\n }\n\n /**\n * Configures canvas for high-DPI rendering\n *\n * @private\n */\n _setupCanvas() {\n const dpr = window.devicePixelRatio || 1;\n const { width, height } = this.dimensions;\n\n // Set canvas buffer resolution (high-res)\n this.canvas.width = Math.round(width * dpr);\n this.canvas.height = Math.round(height * dpr);\n\n // Set canvas display size (CSS)\n this.canvas.style.width = `${width}px`;\n this.canvas.style.height = `${height}px`;\n\n // Get context and scale for DPR\n this.ctx = this.canvas.getContext('2d');\n this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n\n // Create stroke drawer\n this.strokeDrawer = new StrokeDrawer(this.ctx, this.dimensions);\n }\n\n /**\n * Sets the stroke commands to render\n *\n * @param {Array} commands - Array of stroke command objects\n * @param {string} commands[].id - Unique stroke identifier\n * @param {Array} commands[].points - [[x, y], ...] normalized coordinates\n * @param {string} commands[].color - Stroke color\n * @param {number} commands[].width - Stroke width in pixels\n * @param {number} commands[].start - Start time in seconds\n * @param {number} commands[].end - End time in seconds\n */\n setStrokeCommands(commands) {\n if (this.isDestroyed) return;\n\n this.strokeCommands = commands || [];\n\n // Sort by start time for efficient rendering\n this.strokeCommands.sort((a, b) => {\n const startA = a.start ?? 0;\n const startB = b.start ?? 0;\n return startA - startB;\n });\n }\n\n /**\n * Sets the current timeline position\n *\n * @param {number} time - Current time in seconds\n */\n setTime(time) {\n if (this.isDestroyed) return;\n this.currentTime = time;\n }\n\n /**\n * Updates dimensions when viewport changes\n *\n * @param {Object} dimensions - New dimensions\n * @param {number} dimensions.width - Width in pixels\n * @param {number} dimensions.height - Height in pixels\n */\n setDimensions(dimensions) {\n if (this.isDestroyed) return;\n\n this.dimensions = { ...dimensions };\n this._setupCanvas();\n }\n\n /**\n * Renders all visible strokes at current timeline position\n *\n * Called once per timeline update. Clears canvas and redraws\n * all strokes with appropriate progress.\n */\n render() {\n if (this.isDestroyed || !this.ctx) return;\n\n // Clear canvas\n this.strokeDrawer.clear();\n\n // Draw each stroke based on timing\n for (const stroke of this.strokeCommands) {\n const start = stroke.start ?? 0;\n const end = stroke.end ?? start + 1;\n\n // Skip strokes that haven't started\n if (this.currentTime < start) {\n continue;\n }\n\n // Calculate progress\n const progress = this._calculateProgress(start, end);\n\n // Draw stroke with progress\n this.strokeDrawer.drawStroke(stroke, progress);\n }\n }\n\n /**\n * Calculates stroke progress based on timing\n *\n * @private\n * @param {number} start - Stroke start time in seconds\n * @param {number} end - Stroke end time in seconds\n * @returns {number} Progress from 0 to 1\n */\n _calculateProgress(start, end) {\n if (this.currentTime >= end) {\n return 1.0; // Fully visible\n }\n\n const duration = end - start;\n if (duration <= 0) return 1.0;\n\n const elapsed = this.currentTime - start;\n return Math.max(0, Math.min(1, elapsed / duration));\n }\n\n /**\n * Clears the canvas\n */\n clear() {\n if (this.isDestroyed || !this.strokeDrawer) return;\n this.strokeDrawer.clear();\n }\n\n /**\n * Gets visible stroke count at current time\n *\n * @returns {number} Number of visible strokes\n */\n getVisibleStrokeCount() {\n let count = 0;\n for (const stroke of this.strokeCommands) {\n const start = stroke.start ?? 0;\n if (this.currentTime >= start) {\n count++;\n }\n }\n return count;\n }\n\n /**\n * Destroys the renderer and releases resources\n */\n destroy() {\n if (this.isDestroyed) return;\n\n this.strokeCommands = [];\n this.strokeDrawer = null;\n this.ctx = null;\n this.canvas = null;\n this.isDestroyed = true;\n }\n}\n\nexport default GradualRenderer;\n"],"names":["GradualRenderer","canvas","pdfDimensions","dpr","width","height","StrokeDrawer","commands","a","b","startA","startB","time","dimensions","stroke","start","end","progress","duration","elapsed","count"],"mappings":";AAoBA,MAAMA,EAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpB,YAAYC,GAAQC,GAAe;AACjC,SAAK,SAASD,GACd,KAAK,aAAa,EAAE,GAAGC,EAAa,GACpC,KAAK,MAAM,MACX,KAAK,eAAe,MACpB,KAAK,iBAAiB,CAAA,GACtB,KAAK,cAAc,GACnB,KAAK,cAAc,IAEnB,KAAK,aAAY;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,eAAe;AACb,UAAMC,IAAM,OAAO,oBAAoB,GACjC,EAAE,OAAAC,GAAO,QAAAC,EAAM,IAAK,KAAK;AAG/B,SAAK,OAAO,QAAQ,KAAK,MAAMD,IAAQD,CAAG,GAC1C,KAAK,OAAO,SAAS,KAAK,MAAME,IAASF,CAAG,GAG5C,KAAK,OAAO,MAAM,QAAQ,GAAGC,CAAK,MAClC,KAAK,OAAO,MAAM,SAAS,GAAGC,CAAM,MAGpC,KAAK,MAAM,KAAK,OAAO,WAAW,IAAI,GACtC,KAAK,IAAI,aAAaF,GAAK,GAAG,GAAGA,GAAK,GAAG,CAAC,GAG1C,KAAK,eAAe,IAAIG,EAAa,KAAK,KAAK,KAAK,UAAU;AAAA,EAChE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,kBAAkBC,GAAU;AAC1B,IAAI,KAAK,gBAET,KAAK,iBAAiBA,KAAY,CAAA,GAGlC,KAAK,eAAe,KAAK,CAACC,GAAGC,MAAM;AACjC,YAAMC,IAASF,EAAE,SAAS,GACpBG,IAASF,EAAE,SAAS;AAC1B,aAAOC,IAASC;AAAA,IAClB,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,QAAQC,GAAM;AACZ,IAAI,KAAK,gBACT,KAAK,cAAcA;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,cAAcC,GAAY;AACxB,IAAI,KAAK,gBAET,KAAK,aAAa,EAAE,GAAGA,EAAU,GACjC,KAAK,aAAY;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,SAAS;AACP,QAAI,OAAK,eAAe,CAAC,KAAK,MAG9B;AAAA,WAAK,aAAa,MAAK;AAGvB,iBAAWC,KAAU,KAAK,gBAAgB;AACxC,cAAMC,IAAQD,EAAO,SAAS,GACxBE,IAAMF,EAAO,OAAOC,IAAQ;AAGlC,YAAI,KAAK,cAAcA;AACrB;AAIF,cAAME,IAAW,KAAK,mBAAmBF,GAAOC,CAAG;AAGnD,aAAK,aAAa,WAAWF,GAAQG,CAAQ;AAAA,MAC/C;AAAA;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,mBAAmBF,GAAOC,GAAK;AAC7B,QAAI,KAAK,eAAeA;AACtB,aAAO;AAGT,UAAME,IAAWF,IAAMD;AACvB,QAAIG,KAAY,EAAG,QAAO;AAE1B,UAAMC,IAAU,KAAK,cAAcJ;AACnC,WAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGI,IAAUD,CAAQ,CAAC;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQ;AACN,IAAI,KAAK,eAAe,CAAC,KAAK,gBAC9B,KAAK,aAAa,MAAK;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,wBAAwB;AACtB,QAAIE,IAAQ;AACZ,eAAWN,KAAU,KAAK,gBAAgB;AACxC,YAAMC,IAAQD,EAAO,SAAS;AAC9B,MAAI,KAAK,eAAeC,KACtBK;AAAA,IAEJ;AACA,WAAOA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AACR,IAAI,KAAK,gBAET,KAAK,iBAAiB,CAAA,GACtB,KAAK,eAAe,MACpB,KAAK,MAAM,MACX,KAAK,SAAS,MACd,KAAK,cAAc;AAAA,EACrB;AACF;"}
1
+ {"version":3,"file":"index18.js","sources":["../src/converters/ink.js"],"sourcesContent":["/**\n * Ink Annotation Converter\n *\n * Converts freehand ink annotations to renderer stroke commands.\n * Unlike other converters, ink does NOT use RoughJS strokes are\n * already hand-drawn and only need timing mapped to the annotation window.\n *\n * @module converters/ink\n */\n\n/**\n * Convert ink annotation to renderer strokes\n *\n * Maps each sub-stroke's recorded timing (timeOffset + duration) to the\n * annotation's playback window [start, end] using a proportional timeScale.\n *\n * @param {Object} annotation - Ink annotation object\n * @param {string} annotation.id - Annotation ID\n * @param {number} annotation.start - Playback start time (seconds)\n * @param {number} annotation.end - Playback end time (seconds)\n * @param {Array} annotation.strokes - Sub-strokes with points and timing\n * @param {Object} style - Resolved style from StrokeRenderer config\n * @returns {Array} Renderer stroke commands\n */\nexport function inkToStrokes(annotation, style) {\n const { id, start, end, strokes: subStrokes } = annotation;\n if (!subStrokes || subStrokes.length === 0) return [];\n\n const totalDuration = end - start;\n if (totalDuration <= 0) return [];\n\n // Calculate recorded session length from stroke timing\n const sessionDuration = subStrokes.reduce(\n (max, s) => Math.max(max, (s.timeOffset || 0) + (s.duration || 0.5)),\n 0\n ) || 1;\n const timeScale = totalDuration / sessionDuration;\n\n return subStrokes\n .filter((sub) => sub.points && sub.points.length >= 2)\n .map((sub, i) => ({\n id: `${id}-${i}`,\n points: sub.points,\n start: start + (sub.timeOffset || 0) * timeScale,\n end: Math.min(\n start + ((sub.timeOffset || 0) + (sub.duration || 0.5)) * timeScale,\n end\n ),\n color: sub.color || style.color || '#DC143C',\n width: sub.width || style.width || 2,\n lineCap: style.lineCap || 'round',\n }));\n}\n"],"names":["inkToStrokes","annotation","style","id","start","end","subStrokes","totalDuration","sessionDuration","max","s","timeScale","sub","i"],"mappings":"AAwBO,SAASA,EAAaC,GAAYC,GAAO;AAC9C,QAAM,EAAE,IAAAC,GAAI,OAAAC,GAAO,KAAAC,GAAK,SAASC,EAAU,IAAKL;AAChD,MAAI,CAACK,KAAcA,EAAW,WAAW,EAAG,QAAO,CAAA;AAEnD,QAAMC,IAAgBF,IAAMD;AAC5B,MAAIG,KAAiB,EAAG,QAAO,CAAA;AAG/B,QAAMC,IAAkBF,EAAW;AAAA,IACjC,CAACG,GAAKC,MAAM,KAAK,IAAID,IAAMC,EAAE,cAAc,MAAMA,EAAE,YAAY,IAAI;AAAA,IACnE;AAAA,EACJ,KAAO,GACCC,IAAYJ,IAAgBC;AAElC,SAAOF,EACJ,OAAO,CAACM,MAAQA,EAAI,UAAUA,EAAI,OAAO,UAAU,CAAC,EACpD,IAAI,CAACA,GAAKC,OAAO;AAAA,IAChB,IAAI,GAAGV,CAAE,IAAIU,CAAC;AAAA,IACd,QAAQD,EAAI;AAAA,IACZ,OAAOR,KAASQ,EAAI,cAAc,KAAKD;AAAA,IACvC,KAAK,KAAK;AAAA,MACRP,MAAUQ,EAAI,cAAc,MAAMA,EAAI,YAAY,QAAQD;AAAA,MAC1DN;AAAA,IACR;AAAA,IACM,OAAOO,EAAI,SAASV,EAAM,SAAS;AAAA,IACnC,OAAOU,EAAI,SAASV,EAAM,SAAS;AAAA,IACnC,SAASA,EAAM,WAAW;AAAA,EAChC,EAAM;AACN;"}
package/dist/index19.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class d{constructor(t,o){this.ctx=t,this.viewport=o}setViewport(t){this.viewport=t}drawStroke(t,o=1){const{points:i,color:e,width:s,pressures:h}=t;if(!i||i.length<2)return;const n=Math.max(2,Math.floor(i.length*o)),r=i.slice(0,n);this.ctx.strokeStyle=e||"rgba(0, 0, 0, 0.5)",this.ctx.lineCap="round",this.ctx.lineJoin="round",h&&h.length>=r.length?this._drawVariableWidthStroke(r,s,h.slice(0,n)):this._drawConstantWidthStroke(r,s)}_drawConstantWidthStroke(t,o){this.ctx.lineWidth=o||2,this.ctx.beginPath();for(let i=0;i<t.length;i++){const[e,s]=this._normalizedToPixel(t[i]);i===0?this.ctx.moveTo(e,s):this.ctx.lineTo(e,s)}this.ctx.stroke()}_drawVariableWidthStroke(t,o,i){for(let e=1;e<t.length;e++){const[s,h]=this._normalizedToPixel(t[e-1]),[n,r]=this._normalizedToPixel(t[e]),l=i[e-1]||1,c=i[e]||1,a=(l+c)/2,x=Math.max(.5,o*a);this.ctx.lineWidth=x,this.ctx.beginPath(),this.ctx.moveTo(s,h),this.ctx.lineTo(n,r),this.ctx.stroke()}}drawPoint(t,o,i,e){const[s,h]=this._normalizedToPixel([t,o]);this.ctx.fillStyle=e||"rgba(0, 0, 0, 0.5)",this.ctx.beginPath(),this.ctx.arc(s,h,i,0,Math.PI*2),this.ctx.fill()}clear(){const t=window.devicePixelRatio||1;this.ctx.clearRect(0,0,this.viewport.width*t,this.viewport.height*t)}_normalizedToPixel(t){const[o,i]=t;return[o*this.viewport.width,i*this.viewport.height]}}exports.default=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./index20.cjs");class o{constructor(t,s){this.canvas=t,this.dimensions={...s},this.ctx=null,this.strokeDrawer=null,this.strokeCommands=[],this.currentTime=0,this.isDestroyed=!1,this._setupCanvas()}_setupCanvas(){const t=window.devicePixelRatio||1,{width:s,height:e}=this.dimensions;this.canvas.width=Math.round(s*t),this.canvas.height=Math.round(e*t),this.canvas.style.width=`${s}px`,this.canvas.style.height=`${e}px`,this.ctx=this.canvas.getContext("2d"),this.ctx.setTransform(t,0,0,t,0,0),this.strokeDrawer=new n.default(this.ctx,this.dimensions)}setStrokeCommands(t){this.isDestroyed||(this.strokeCommands=t||[],this.strokeCommands.sort((s,e)=>{const r=s.start??0,i=e.start??0;return r-i}))}setTime(t){this.isDestroyed||(this.currentTime=t)}setDimensions(t){this.isDestroyed||(this.dimensions={...t},this._setupCanvas())}render(){if(!(this.isDestroyed||!this.ctx)){this.strokeDrawer.clear();for(const t of this.strokeCommands){const s=t.start??0,e=t.end??s+1;if(this.currentTime<s)continue;const r=this._calculateProgress(s,e);this.strokeDrawer.drawStroke(t,r)}}}_calculateProgress(t,s){if(this.currentTime>=s)return 1;const e=s-t;if(e<=0)return 1;const r=this.currentTime-t;return Math.max(0,Math.min(1,r/e))}clear(){this.isDestroyed||!this.strokeDrawer||this.strokeDrawer.clear()}getVisibleStrokeCount(){let t=0;for(const s of this.strokeCommands){const e=s.start??0;this.currentTime>=e&&t++}return t}destroy(){this.isDestroyed||(this.strokeCommands=[],this.strokeDrawer=null,this.ctx=null,this.canvas=null,this.isDestroyed=!0)}}exports.default=o;
2
2
  //# sourceMappingURL=index19.cjs.map