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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -24
- package/dist/index.js.map +1 -1
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +2 -2
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +1 -1
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +1 -1
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index18.cjs +1 -1
- package/dist/index18.cjs.map +1 -1
- package/dist/index18.js +22 -117
- package/dist/index18.js.map +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index19.cjs.map +1 -1
- package/dist/index19.js +83 -69
- package/dist/index19.js.map +1 -1
- package/dist/index20.cjs +1 -1
- package/dist/index20.cjs.map +1 -1
- package/dist/index20.js +100 -76
- package/dist/index20.js.map +1 -1
- package/dist/index21.cjs +1 -1
- package/dist/index21.cjs.map +1 -1
- package/dist/index21.js +77 -138
- package/dist/index21.js.map +1 -1
- package/dist/index22.cjs +1 -1
- package/dist/index22.cjs.map +1 -1
- package/dist/index22.js +139 -36
- package/dist/index22.js.map +1 -1
- package/dist/index23.cjs +1 -1
- package/dist/index23.cjs.map +1 -1
- package/dist/index23.js +35 -34
- package/dist/index23.js.map +1 -1
- package/dist/index24.cjs +1 -1
- package/dist/index24.cjs.map +1 -1
- package/dist/index24.js +27 -28
- package/dist/index24.js.map +1 -1
- package/dist/index25.cjs +1 -1
- package/dist/index25.cjs.map +1 -1
- package/dist/index25.js +38 -40
- package/dist/index25.js.map +1 -1
- package/dist/index26.cjs +1 -1
- package/dist/index26.cjs.map +1 -1
- package/dist/index26.js +39 -4
- package/dist/index26.js.map +1 -1
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +4 -4
- package/dist/index28.cjs +1 -1
- package/dist/index28.cjs.map +1 -1
- package/dist/index28.js +5 -71
- package/dist/index28.js.map +1 -1
- package/dist/index29.cjs +1 -1
- package/dist/index29.cjs.map +1 -1
- package/dist/index29.js +70 -4
- package/dist/index29.js.map +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.cjs.map +1 -1
- package/dist/index30.js +4 -991
- package/dist/index30.js.map +1 -1
- package/dist/index31.cjs +2 -0
- package/dist/index31.cjs.map +1 -0
- package/dist/index31.js +995 -0
- package/dist/index31.js.map +1 -0
- package/dist/index5.cjs +1 -1
- package/dist/index5.cjs.map +1 -1
- package/dist/index5.js +63 -56
- package/dist/index5.js.map +1 -1
- package/dist/index9.cjs +1 -1
- package/dist/index9.cjs.map +1 -1
- package/dist/index9.js +17 -15
- package/dist/index9.js.map +1 -1
- 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"),
|
|
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
|
package/dist/index.cjs.map
CHANGED
|
@@ -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.
|
|
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
|
|
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 {
|
|
17
|
+
import { inkToStrokes as F } from "./index18.js";
|
|
18
18
|
import { default as K } from "./index19.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
z as BLUE_PRESET,
|
|
30
|
+
G as DEFAULT_PRESET,
|
|
31
|
+
K as GradualRenderer,
|
|
31
32
|
a as LIB_NAME,
|
|
32
|
-
|
|
33
|
+
H as MINIMAL_PRESET,
|
|
33
34
|
p as PDFRenderer,
|
|
34
|
-
|
|
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
|
-
|
|
40
|
+
X as annotationTools,
|
|
40
41
|
L as arrowToStrokes,
|
|
41
42
|
_ as circleToStrokes,
|
|
42
43
|
e as coordinateUtils,
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
oe as createHighlight,
|
|
45
|
+
ae as createText,
|
|
45
46
|
c as extractAllBlocks,
|
|
46
47
|
P as extractMultiplePages,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
|
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("./
|
|
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 "./
|
|
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("./
|
|
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
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("./
|
|
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
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("./
|
|
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
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("./
|
|
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
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("./
|
|
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
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("./
|
|
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
package/dist/index18.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.
|
|
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
|
package/dist/index18.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index18.cjs","sources":["../src/
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
+
l as inkToStrokes
|
|
120
25
|
};
|
|
121
26
|
//# sourceMappingURL=index18.js.map
|
package/dist/index18.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index18.js","sources":["../src/
|
|
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
|
|
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
|