@semiont/api-client 0.2.2-build.15 → 0.2.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 (73) hide show
  1. package/dist/{types.d.ts → index-DHh0ToZB.d.ts} +460 -6
  2. package/dist/index.d.ts +909 -13
  3. package/dist/index.js +1598 -60
  4. package/dist/index.js.map +1 -1
  5. package/dist/utils/index.d.ts +1 -12
  6. package/dist/utils/index.js +597 -26
  7. package/dist/utils/index.js.map +1 -1
  8. package/package.json +11 -8
  9. package/dist/__tests__/client.test.d.ts +0 -28
  10. package/dist/__tests__/client.test.d.ts.map +0 -1
  11. package/dist/__tests__/client.test.js +0 -567
  12. package/dist/__tests__/client.test.js.map +0 -1
  13. package/dist/__tests__/sse-client.test.d.ts +0 -7
  14. package/dist/__tests__/sse-client.test.d.ts.map +0 -1
  15. package/dist/__tests__/sse-client.test.js +0 -421
  16. package/dist/__tests__/sse-client.test.js.map +0 -1
  17. package/dist/__tests__/sse-stream.test.d.ts +0 -7
  18. package/dist/__tests__/sse-stream.test.d.ts.map +0 -1
  19. package/dist/__tests__/sse-stream.test.js +0 -394
  20. package/dist/__tests__/sse-stream.test.js.map +0 -1
  21. package/dist/__tests__/svg-selectors.test.d.ts +0 -5
  22. package/dist/__tests__/svg-selectors.test.d.ts.map +0 -1
  23. package/dist/__tests__/svg-selectors.test.js +0 -124
  24. package/dist/__tests__/svg-selectors.test.js.map +0 -1
  25. package/dist/branded-types.d.ts +0 -70
  26. package/dist/branded-types.d.ts.map +0 -1
  27. package/dist/branded-types.js +0 -62
  28. package/dist/branded-types.js.map +0 -1
  29. package/dist/client.d.ts +0 -243
  30. package/dist/client.d.ts.map +0 -1
  31. package/dist/client.js +0 -460
  32. package/dist/client.js.map +0 -1
  33. package/dist/index.d.ts.map +0 -1
  34. package/dist/mime-utils.d.ts +0 -27
  35. package/dist/mime-utils.d.ts.map +0 -1
  36. package/dist/mime-utils.js +0 -49
  37. package/dist/mime-utils.js.map +0 -1
  38. package/dist/sse/index.d.ts +0 -343
  39. package/dist/sse/index.d.ts.map +0 -1
  40. package/dist/sse/index.js +0 -404
  41. package/dist/sse/index.js.map +0 -1
  42. package/dist/sse/stream.d.ts +0 -58
  43. package/dist/sse/stream.d.ts.map +0 -1
  44. package/dist/sse/stream.js +0 -187
  45. package/dist/sse/stream.js.map +0 -1
  46. package/dist/sse/types.d.ts +0 -295
  47. package/dist/sse/types.d.ts.map +0 -1
  48. package/dist/sse/types.js +0 -10
  49. package/dist/sse/types.js.map +0 -1
  50. package/dist/types.d.ts.map +0 -1
  51. package/dist/types.js +0 -7
  52. package/dist/types.js.map +0 -1
  53. package/dist/utils/annotations.d.ts +0 -191
  54. package/dist/utils/annotations.d.ts.map +0 -1
  55. package/dist/utils/annotations.js +0 -404
  56. package/dist/utils/annotations.js.map +0 -1
  57. package/dist/utils/events.d.ts +0 -74
  58. package/dist/utils/events.d.ts.map +0 -1
  59. package/dist/utils/events.js +0 -329
  60. package/dist/utils/events.js.map +0 -1
  61. package/dist/utils/index.d.ts.map +0 -1
  62. package/dist/utils/locales.d.ts +0 -31
  63. package/dist/utils/locales.d.ts.map +0 -1
  64. package/dist/utils/locales.js +0 -83
  65. package/dist/utils/locales.js.map +0 -1
  66. package/dist/utils/resources.d.ts +0 -34
  67. package/dist/utils/resources.d.ts.map +0 -1
  68. package/dist/utils/resources.js +0 -63
  69. package/dist/utils/resources.js.map +0 -1
  70. package/dist/utils/validation.d.ts +0 -57
  71. package/dist/utils/validation.d.ts.map +0 -1
  72. package/dist/utils/validation.js +0 -89
  73. package/dist/utils/validation.js.map +0 -1
@@ -1,191 +0,0 @@
1
- /**
2
- * Annotation and Selector Utilities
3
- *
4
- * Pure TypeScript utilities for working with W3C Web Annotations.
5
- * No React dependencies - safe to use in any JavaScript environment.
6
- *
7
- * Body is either empty array (stub) or single SpecificResource (resolved)
8
- * Body can be array of TextualBody (tagging) + SpecificResource (linking)
9
- * Target can be simple string IRI or object with source and optional selector
10
- */
11
- import type { components } from '../types';
12
- import type { ResourceUri } from '../branded-types';
13
- type Annotation = components['schemas']['Annotation'];
14
- type HighlightAnnotation = Annotation;
15
- type ReferenceAnnotation = Annotation;
16
- type TextPositionSelector = components['schemas']['TextPositionSelector'];
17
- type TextQuoteSelector = components['schemas']['TextQuoteSelector'];
18
- type SvgSelector = components['schemas']['SvgSelector'];
19
- type Selector = TextPositionSelector | TextQuoteSelector | SvgSelector;
20
- export type { TextPositionSelector, TextQuoteSelector, SvgSelector, Selector };
21
- /**
22
- * Get the source from an annotation body (null if stub)
23
- * Search for SpecificResource in body array
24
- */
25
- export declare function getBodySource(body: Annotation['body']): ResourceUri | null;
26
- /**
27
- * Get the type from an annotation body (returns first body type in array)
28
- */
29
- export declare function getBodyType(body: Annotation['body']): 'TextualBody' | 'SpecificResource' | null;
30
- /**
31
- * Check if body is resolved (has a source)
32
- * Check for SpecificResource in body array
33
- */
34
- export declare function isBodyResolved(body: Annotation['body']): boolean;
35
- /**
36
- * Get the source IRI from target (handles both string and object forms)
37
- */
38
- export declare function getTargetSource(target: Annotation['target']): ResourceUri;
39
- /**
40
- * Get the selector from target (undefined if string or no selector)
41
- */
42
- export declare function getTargetSelector(target: Annotation['target']): {
43
- type: "TextPositionSelector";
44
- start: number;
45
- end: number;
46
- } | {
47
- type: "TextQuoteSelector";
48
- exact: string;
49
- prefix?: string;
50
- suffix?: string;
51
- } | {
52
- type: "SvgSelector";
53
- value: string;
54
- } | ({
55
- type: "TextPositionSelector";
56
- start: number;
57
- end: number;
58
- } | {
59
- type: "TextQuoteSelector";
60
- exact: string;
61
- prefix?: string;
62
- suffix?: string;
63
- } | {
64
- type: "SvgSelector";
65
- value: string;
66
- })[] | undefined;
67
- /**
68
- * Check if target has a selector
69
- */
70
- export declare function hasTargetSelector(target: Annotation['target']): boolean;
71
- /**
72
- * Extract entity types from annotation bodies
73
- * Entity types are stored as TextualBody with purpose: "tagging"
74
- * Accepts any object with a body property matching Annotation['body']
75
- */
76
- export declare function getEntityTypes(annotation: {
77
- body: Annotation['body'];
78
- }): string[];
79
- /**
80
- * Type guard to check if an annotation is a highlight
81
- */
82
- export declare function isHighlight(annotation: Annotation): annotation is HighlightAnnotation;
83
- /**
84
- * Type guard to check if an annotation is a reference (linking)
85
- */
86
- export declare function isReference(annotation: Annotation): annotation is ReferenceAnnotation;
87
- /**
88
- * Type guard to check if an annotation is an assessment
89
- */
90
- export declare function isAssessment(annotation: Annotation): annotation is Annotation;
91
- /**
92
- * Type guard to check if an annotation is a comment
93
- */
94
- export declare function isComment(annotation: Annotation): annotation is Annotation;
95
- /**
96
- * Type guard to check if an annotation is a tag
97
- */
98
- export declare function isTag(annotation: Annotation): annotation is Annotation;
99
- /**
100
- * Extract comment text from a comment annotation's body
101
- * @param annotation - The annotation to extract comment text from
102
- * @returns The comment text, or undefined if not a comment or no text found
103
- */
104
- export declare function getCommentText(annotation: Annotation): string | undefined;
105
- /**
106
- * Extract tag category from a tag annotation's body
107
- * Tags use dual-body structure: first body has purpose: "tagging" with category value
108
- * @param annotation - The annotation to extract category from
109
- * @returns The tag category (e.g., "Issue", "Rule"), or undefined if not a tag or no category found
110
- */
111
- export declare function getTagCategory(annotation: Annotation): string | undefined;
112
- /**
113
- * Extract tag schema ID from a tag annotation's body
114
- * Tags use dual-body structure: second body has purpose: "classifying" with schema ID
115
- * @param annotation - The annotation to extract schema ID from
116
- * @returns The schema ID (e.g., "legal-irac"), or undefined if not a tag or no schema found
117
- */
118
- export declare function getTagSchemaId(annotation: Annotation): string | undefined;
119
- /**
120
- * Type guard to check if a reference annotation is a stub (unresolved)
121
- * Stub if no SpecificResource in body array
122
- */
123
- export declare function isStubReference(annotation: Annotation): boolean;
124
- /**
125
- * Type guard to check if a reference annotation is resolved
126
- * Resolved if SpecificResource exists in body array
127
- */
128
- export declare function isResolvedReference(annotation: Annotation): annotation is ReferenceAnnotation;
129
- /**
130
- * Get the exact text from a selector (single or array)
131
- *
132
- * When selector is an array, tries to find a TextQuoteSelector (which has exact text).
133
- * TextPositionSelector does not have exact text, only character offsets.
134
- * Handles undefined selector (when target is a string IRI with no selector)
135
- */
136
- export declare function getExactText(selector: Selector | Selector[] | undefined): string;
137
- /**
138
- * Get the exact text from an annotation's target selector
139
- * Uses getTargetSelector helper to safely get selector
140
- */
141
- export declare function getAnnotationExactText(annotation: Annotation): string;
142
- /**
143
- * Get the primary selector from a selector (single or array)
144
- *
145
- * When selector is an array, returns the first selector.
146
- * When selector is a single object, returns it as-is.
147
- */
148
- export declare function getPrimarySelector(selector: Selector | Selector[]): Selector;
149
- /**
150
- * Get TextPositionSelector from a selector (single or array)
151
- *
152
- * Returns the first TextPositionSelector found, or null if none exists.
153
- * Handles undefined selector (when target is a string IRI with no selector)
154
- */
155
- export declare function getTextPositionSelector(selector: Selector | Selector[] | undefined): TextPositionSelector | null;
156
- /**
157
- * Get TextQuoteSelector from a selector (single or array)
158
- *
159
- * Returns the first TextQuoteSelector found, or null if none exists.
160
- */
161
- export declare function getTextQuoteSelector(selector: Selector | Selector[]): TextQuoteSelector | null;
162
- /**
163
- * Get SvgSelector from a selector (single or array)
164
- *
165
- * Returns the first SvgSelector found, or null if none exists.
166
- */
167
- export declare function getSvgSelector(selector: Selector | Selector[] | undefined): SvgSelector | null;
168
- /**
169
- * Validate SVG markup for W3C compliance
170
- *
171
- * Checks that:
172
- * - SVG contains xmlns attribute
173
- * - SVG is well-formed XML
174
- * - SVG contains at least one shape element
175
- *
176
- * @returns null if valid, error message if invalid
177
- */
178
- export declare function validateSvgMarkup(svg: string): string | null;
179
- /**
180
- * Extract bounding box from SVG markup
181
- *
182
- * Attempts to extract x, y, width, height from the SVG viewBox or root element.
183
- * Returns null if bounding box cannot be determined.
184
- */
185
- export declare function extractBoundingBox(svg: string): {
186
- x: number;
187
- y: number;
188
- width: number;
189
- height: number;
190
- } | null;
191
- //# sourceMappingURL=annotations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"annotations.d.ts","sourceRoot":"","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sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAGrE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAY5E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,SAAS,GAAG,oBAAoB,GAAG,IAAI,CAMhH;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,iBAAiB,GAAG,IAAI,CAK9F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAM9F;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsB5D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAiC9G"}
@@ -1,404 +0,0 @@
1
- "use strict";
2
- /**
3
- * Annotation and Selector Utilities
4
- *
5
- * Pure TypeScript utilities for working with W3C Web Annotations.
6
- * No React dependencies - safe to use in any JavaScript environment.
7
- *
8
- * Body is either empty array (stub) or single SpecificResource (resolved)
9
- * Body can be array of TextualBody (tagging) + SpecificResource (linking)
10
- * Target can be simple string IRI or object with source and optional selector
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.getBodySource = getBodySource;
14
- exports.getBodyType = getBodyType;
15
- exports.isBodyResolved = isBodyResolved;
16
- exports.getTargetSource = getTargetSource;
17
- exports.getTargetSelector = getTargetSelector;
18
- exports.hasTargetSelector = hasTargetSelector;
19
- exports.getEntityTypes = getEntityTypes;
20
- exports.isHighlight = isHighlight;
21
- exports.isReference = isReference;
22
- exports.isAssessment = isAssessment;
23
- exports.isComment = isComment;
24
- exports.isTag = isTag;
25
- exports.getCommentText = getCommentText;
26
- exports.getTagCategory = getTagCategory;
27
- exports.getTagSchemaId = getTagSchemaId;
28
- exports.isStubReference = isStubReference;
29
- exports.isResolvedReference = isResolvedReference;
30
- exports.getExactText = getExactText;
31
- exports.getAnnotationExactText = getAnnotationExactText;
32
- exports.getPrimarySelector = getPrimarySelector;
33
- exports.getTextPositionSelector = getTextPositionSelector;
34
- exports.getTextQuoteSelector = getTextQuoteSelector;
35
- exports.getSvgSelector = getSvgSelector;
36
- exports.validateSvgMarkup = validateSvgMarkup;
37
- exports.extractBoundingBox = extractBoundingBox;
38
- const branded_types_1 = require("../branded-types");
39
- /**
40
- * Get the source from an annotation body (null if stub)
41
- * Search for SpecificResource in body array
42
- */
43
- function getBodySource(body) {
44
- if (Array.isArray(body)) {
45
- // Search for SpecificResource with source
46
- for (const item of body) {
47
- if (typeof item === 'object' &&
48
- item !== null &&
49
- 'type' in item &&
50
- 'source' in item) {
51
- const itemType = item.type;
52
- const itemSource = item.source;
53
- if (itemType === 'SpecificResource' && typeof itemSource === 'string') {
54
- return (0, branded_types_1.resourceUri)(itemSource);
55
- }
56
- }
57
- }
58
- return null; // No SpecificResource found = stub
59
- }
60
- // Single body object (SpecificResource)
61
- if (typeof body === 'object' &&
62
- body !== null &&
63
- 'type' in body &&
64
- 'source' in body) {
65
- const bodyType = body.type;
66
- const bodySource = body.source;
67
- if (bodyType === 'SpecificResource' && typeof bodySource === 'string') {
68
- return (0, branded_types_1.resourceUri)(bodySource);
69
- }
70
- }
71
- return null;
72
- }
73
- /**
74
- * Get the type from an annotation body (returns first body type in array)
75
- */
76
- function getBodyType(body) {
77
- if (Array.isArray(body)) {
78
- if (body.length === 0) {
79
- return null;
80
- }
81
- // Return type of first body item
82
- if (typeof body[0] === 'object' && body[0] !== null && 'type' in body[0]) {
83
- const firstType = body[0].type;
84
- if (firstType === 'TextualBody' || firstType === 'SpecificResource') {
85
- return firstType;
86
- }
87
- }
88
- return null;
89
- }
90
- // Single body object
91
- if (typeof body === 'object' && body !== null && 'type' in body) {
92
- const bodyType = body.type;
93
- if (bodyType === 'TextualBody' || bodyType === 'SpecificResource') {
94
- return bodyType;
95
- }
96
- }
97
- return null;
98
- }
99
- /**
100
- * Check if body is resolved (has a source)
101
- * Check for SpecificResource in body array
102
- */
103
- function isBodyResolved(body) {
104
- return getBodySource(body) !== null;
105
- }
106
- /**
107
- * Get the source IRI from target (handles both string and object forms)
108
- */
109
- function getTargetSource(target) {
110
- if (typeof target === 'string') {
111
- return (0, branded_types_1.resourceUri)(target);
112
- }
113
- return (0, branded_types_1.resourceUri)(target.source);
114
- }
115
- /**
116
- * Get the selector from target (undefined if string or no selector)
117
- */
118
- function getTargetSelector(target) {
119
- if (typeof target === 'string') {
120
- return undefined;
121
- }
122
- return target.selector;
123
- }
124
- /**
125
- * Check if target has a selector
126
- */
127
- function hasTargetSelector(target) {
128
- return typeof target !== 'string' && target.selector !== undefined;
129
- }
130
- /**
131
- * Extract entity types from annotation bodies
132
- * Entity types are stored as TextualBody with purpose: "tagging"
133
- * Accepts any object with a body property matching Annotation['body']
134
- */
135
- function getEntityTypes(annotation) {
136
- // Extract from TextualBody bodies with purpose: "tagging"
137
- if (Array.isArray(annotation.body)) {
138
- const entityTags = [];
139
- for (const item of annotation.body) {
140
- // Runtime check for TextualBody with tagging purpose
141
- // TypeScript incorrectly narrows the union type here, so we use runtime checks only
142
- if (typeof item === 'object' &&
143
- item !== null &&
144
- 'type' in item &&
145
- 'value' in item &&
146
- 'purpose' in item) {
147
- // Access properties as unknown first to avoid TypeScript narrowing issues
148
- const itemType = item.type;
149
- const itemValue = item.value;
150
- const itemPurpose = item.purpose;
151
- if (itemType === 'TextualBody' && itemPurpose === 'tagging' && typeof itemValue === 'string' && itemValue.length > 0) {
152
- entityTags.push(itemValue);
153
- }
154
- }
155
- }
156
- return entityTags;
157
- }
158
- return [];
159
- }
160
- /**
161
- * Type guard to check if an annotation is a highlight
162
- */
163
- function isHighlight(annotation) {
164
- return annotation.motivation === 'highlighting';
165
- }
166
- /**
167
- * Type guard to check if an annotation is a reference (linking)
168
- */
169
- function isReference(annotation) {
170
- return annotation.motivation === 'linking';
171
- }
172
- /**
173
- * Type guard to check if an annotation is an assessment
174
- */
175
- function isAssessment(annotation) {
176
- return annotation.motivation === 'assessing';
177
- }
178
- /**
179
- * Type guard to check if an annotation is a comment
180
- */
181
- function isComment(annotation) {
182
- return annotation.motivation === 'commenting';
183
- }
184
- /**
185
- * Type guard to check if an annotation is a tag
186
- */
187
- function isTag(annotation) {
188
- return annotation.motivation === 'tagging';
189
- }
190
- /**
191
- * Extract comment text from a comment annotation's body
192
- * @param annotation - The annotation to extract comment text from
193
- * @returns The comment text, or undefined if not a comment or no text found
194
- */
195
- function getCommentText(annotation) {
196
- if (!isComment(annotation))
197
- return undefined;
198
- const body = Array.isArray(annotation.body) ? annotation.body[0] : annotation.body;
199
- if (body && 'value' in body) {
200
- return body.value;
201
- }
202
- return undefined;
203
- }
204
- /**
205
- * Extract tag category from a tag annotation's body
206
- * Tags use dual-body structure: first body has purpose: "tagging" with category value
207
- * @param annotation - The annotation to extract category from
208
- * @returns The tag category (e.g., "Issue", "Rule"), or undefined if not a tag or no category found
209
- */
210
- function getTagCategory(annotation) {
211
- if (!isTag(annotation))
212
- return undefined;
213
- const bodies = Array.isArray(annotation.body) ? annotation.body : [annotation.body];
214
- const taggingBody = bodies.find(b => b && 'purpose' in b && b.purpose === 'tagging');
215
- if (taggingBody && 'value' in taggingBody) {
216
- return taggingBody.value;
217
- }
218
- return undefined;
219
- }
220
- /**
221
- * Extract tag schema ID from a tag annotation's body
222
- * Tags use dual-body structure: second body has purpose: "classifying" with schema ID
223
- * @param annotation - The annotation to extract schema ID from
224
- * @returns The schema ID (e.g., "legal-irac"), or undefined if not a tag or no schema found
225
- */
226
- function getTagSchemaId(annotation) {
227
- if (!isTag(annotation))
228
- return undefined;
229
- const bodies = Array.isArray(annotation.body) ? annotation.body : [annotation.body];
230
- const classifyingBody = bodies.find(b => b && 'purpose' in b && b.purpose === 'classifying');
231
- if (classifyingBody && 'value' in classifyingBody) {
232
- return classifyingBody.value;
233
- }
234
- return undefined;
235
- }
236
- /**
237
- * Type guard to check if a reference annotation is a stub (unresolved)
238
- * Stub if no SpecificResource in body array
239
- */
240
- function isStubReference(annotation) {
241
- return isReference(annotation) && !isBodyResolved(annotation.body);
242
- }
243
- /**
244
- * Type guard to check if a reference annotation is resolved
245
- * Resolved if SpecificResource exists in body array
246
- */
247
- function isResolvedReference(annotation) {
248
- return isReference(annotation) && isBodyResolved(annotation.body);
249
- }
250
- // =============================================================================
251
- // SELECTOR UTILITIES
252
- // =============================================================================
253
- /**
254
- * Get the exact text from a selector (single or array)
255
- *
256
- * When selector is an array, tries to find a TextQuoteSelector (which has exact text).
257
- * TextPositionSelector does not have exact text, only character offsets.
258
- * Handles undefined selector (when target is a string IRI with no selector)
259
- */
260
- function getExactText(selector) {
261
- if (!selector) {
262
- return ''; // No selector means entire resource
263
- }
264
- const selectors = Array.isArray(selector) ? selector : [selector];
265
- // Try to find TextQuoteSelector (has exact text)
266
- const quoteSelector = selectors.find(s => s.type === 'TextQuoteSelector');
267
- if (quoteSelector) {
268
- return quoteSelector.exact;
269
- }
270
- // No TextQuoteSelector found
271
- return '';
272
- }
273
- /**
274
- * Get the exact text from an annotation's target selector
275
- * Uses getTargetSelector helper to safely get selector
276
- */
277
- function getAnnotationExactText(annotation) {
278
- const selector = getTargetSelector(annotation.target);
279
- return getExactText(selector);
280
- }
281
- /**
282
- * Get the primary selector from a selector (single or array)
283
- *
284
- * When selector is an array, returns the first selector.
285
- * When selector is a single object, returns it as-is.
286
- */
287
- function getPrimarySelector(selector) {
288
- if (Array.isArray(selector)) {
289
- if (selector.length === 0) {
290
- throw new Error('Empty selector array');
291
- }
292
- const first = selector[0];
293
- if (!first) {
294
- throw new Error('Invalid selector array');
295
- }
296
- return first;
297
- }
298
- return selector;
299
- }
300
- /**
301
- * Get TextPositionSelector from a selector (single or array)
302
- *
303
- * Returns the first TextPositionSelector found, or null if none exists.
304
- * Handles undefined selector (when target is a string IRI with no selector)
305
- */
306
- function getTextPositionSelector(selector) {
307
- if (!selector)
308
- return null; // No selector means entire resource
309
- const selectors = Array.isArray(selector) ? selector : [selector];
310
- const found = selectors.find(s => s.type === 'TextPositionSelector');
311
- if (!found)
312
- return null;
313
- return found.type === 'TextPositionSelector' ? found : null;
314
- }
315
- /**
316
- * Get TextQuoteSelector from a selector (single or array)
317
- *
318
- * Returns the first TextQuoteSelector found, or null if none exists.
319
- */
320
- function getTextQuoteSelector(selector) {
321
- const selectors = Array.isArray(selector) ? selector : [selector];
322
- const found = selectors.find(s => s.type === 'TextQuoteSelector');
323
- if (!found)
324
- return null;
325
- return found.type === 'TextQuoteSelector' ? found : null;
326
- }
327
- /**
328
- * Get SvgSelector from a selector (single or array)
329
- *
330
- * Returns the first SvgSelector found, or null if none exists.
331
- */
332
- function getSvgSelector(selector) {
333
- if (!selector)
334
- return null;
335
- const selectors = Array.isArray(selector) ? selector : [selector];
336
- const found = selectors.find(s => s.type === 'SvgSelector');
337
- if (!found)
338
- return null;
339
- return found.type === 'SvgSelector' ? found : null;
340
- }
341
- /**
342
- * Validate SVG markup for W3C compliance
343
- *
344
- * Checks that:
345
- * - SVG contains xmlns attribute
346
- * - SVG is well-formed XML
347
- * - SVG contains at least one shape element
348
- *
349
- * @returns null if valid, error message if invalid
350
- */
351
- function validateSvgMarkup(svg) {
352
- // Check for xmlns attribute (required by W3C spec)
353
- if (!svg.includes('xmlns="http://www.w3.org/2000/svg"')) {
354
- return 'SVG must include xmlns="http://www.w3.org/2000/svg" attribute';
355
- }
356
- // Check for basic SVG tag structure
357
- if (!svg.includes('<svg') || !svg.includes('</svg>')) {
358
- return 'SVG must have opening and closing tags';
359
- }
360
- // Check for at least one shape element
361
- const shapeElements = ['rect', 'circle', 'ellipse', 'polygon', 'polyline', 'path', 'line'];
362
- const hasShape = shapeElements.some(shape => svg.includes(`<${shape}`) || svg.includes(`<${shape} `));
363
- if (!hasShape) {
364
- return 'SVG must contain at least one shape element (rect, circle, ellipse, polygon, polyline, path, or line)';
365
- }
366
- return null; // Valid
367
- }
368
- /**
369
- * Extract bounding box from SVG markup
370
- *
371
- * Attempts to extract x, y, width, height from the SVG viewBox or root element.
372
- * Returns null if bounding box cannot be determined.
373
- */
374
- function extractBoundingBox(svg) {
375
- // Try to extract viewBox attribute from SVG element
376
- const viewBoxMatch = svg.match(/<svg[^>]*viewBox="([^"]+)"/);
377
- if (viewBoxMatch) {
378
- const values = viewBoxMatch[1].split(/\s+/).map(parseFloat);
379
- if (values.length === 4 && values.every(v => !isNaN(v))) {
380
- return {
381
- x: values[0],
382
- y: values[1],
383
- width: values[2],
384
- height: values[3]
385
- };
386
- }
387
- }
388
- // Try to extract width/height attributes from SVG element (assume x=0, y=0)
389
- const svgTagMatch = svg.match(/<svg[^>]*>/);
390
- if (svgTagMatch) {
391
- const svgTag = svgTagMatch[0];
392
- const widthMatch = svgTag.match(/width="([^"]+)"/);
393
- const heightMatch = svgTag.match(/height="([^"]+)"/);
394
- if (widthMatch && heightMatch) {
395
- const width = parseFloat(widthMatch[1]);
396
- const height = parseFloat(heightMatch[1]);
397
- if (!isNaN(width) && !isNaN(height)) {
398
- return { x: 0, y: 0, width, height };
399
- }
400
- }
401
- }
402
- return null;
403
- }
404
- //# sourceMappingURL=annotations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"annotations.js","sourceRoot":"","sources":["../../src/utils/annotations.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAqBH,sCAqCC;AAKD,kCAwBC;AAMD,wCAEC;AAKD,0CAKC;AAKD,8CAKC;AAKD,8CAEC;AAOD,wCA8BC;AAKD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