@semiont/react-ui 0.5.11 → 0.5.12
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/{PdfAnnotationCanvas.client-KWQ7XDWT.js → PdfAnnotationCanvas.client-75GY2EDR.js} +12 -6
- package/dist/PdfAnnotationCanvas.client-75GY2EDR.js.map +1 -0
- package/dist/{chunk-O2MD7TGE.js → chunk-VXASXU4K.js} +10 -2
- package/dist/chunk-VXASXU4K.js.map +1 -0
- package/dist/index.d.ts +54 -16
- package/dist/index.js +395 -343
- package/dist/index.js.map +1 -1
- package/dist/test-utils.d.ts +5 -1
- package/dist/test-utils.js +3 -2
- package/dist/test-utils.js.map +1 -1
- package/package.json +5 -5
- package/src/components/image-annotation/AnnotationOverlay.tsx +6 -6
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +12 -4
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +137 -0
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +108 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +12 -4
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +137 -1
- package/src/components/resource/BrowseView.tsx +14 -6
- package/src/components/resource/ResourceViewer.tsx +6 -4
- package/src/components/resource/__tests__/BrowseView.test.tsx +98 -31
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +40 -1
- package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +113 -0
- package/src/components/resource/browse-renderers.tsx +26 -4
- package/src/components/resource/panels/AssessmentEntry.tsx +5 -4
- package/src/components/resource/panels/AssessmentPanel.tsx +8 -5
- package/src/components/resource/panels/AssistSection.tsx +4 -3
- package/src/components/resource/panels/CommentEntry.tsx +5 -4
- package/src/components/resource/panels/CommentsPanel.tsx +8 -5
- package/src/components/resource/panels/HighlightEntry.tsx +5 -4
- package/src/components/resource/panels/HighlightPanel.tsx +8 -5
- package/src/components/resource/panels/ReferenceEntry.tsx +9 -10
- package/src/components/resource/panels/ReferencesPanel.tsx +11 -6
- package/src/components/resource/panels/ResourceInfoPanel.tsx +4 -3
- package/src/components/resource/panels/TagEntry.tsx +5 -3
- package/src/components/resource/panels/TaggingPanel.tsx +7 -4
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +10 -0
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +28 -20
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +38 -28
- package/src/components/resource/panels/__tests__/AssistSection.test.tsx +46 -17
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +65 -57
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +53 -24
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +27 -17
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +23 -17
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +48 -77
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +87 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +15 -9
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +77 -59
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +11 -4
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +33 -19
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +15 -7
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +3 -0
- package/dist/PdfAnnotationCanvas.client-KWQ7XDWT.js.map +0 -1
- package/dist/chunk-O2MD7TGE.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
|
-
setPdfWorkerSrc
|
|
4
|
-
|
|
3
|
+
setPdfWorkerSrc,
|
|
4
|
+
toViewportAnchorRect
|
|
5
|
+
} from "./chunk-VXASXU4K.js";
|
|
5
6
|
import {
|
|
6
7
|
AVAILABLE_LOCALES,
|
|
7
8
|
SemiontProvider,
|
|
@@ -2462,6 +2463,9 @@ var FacetProvider = class {
|
|
|
2462
2463
|
}
|
|
2463
2464
|
};
|
|
2464
2465
|
}
|
|
2466
|
+
get extension() {
|
|
2467
|
+
return this;
|
|
2468
|
+
}
|
|
2465
2469
|
};
|
|
2466
2470
|
function compareArray(a15, b8, compare2) {
|
|
2467
2471
|
if (a15.length != b8.length)
|
|
@@ -2636,6 +2640,9 @@ var PrecExtension = class {
|
|
|
2636
2640
|
this.inner = inner;
|
|
2637
2641
|
this.prec = prec2;
|
|
2638
2642
|
}
|
|
2643
|
+
get extension() {
|
|
2644
|
+
return this;
|
|
2645
|
+
}
|
|
2639
2646
|
};
|
|
2640
2647
|
var Compartment = class _Compartment {
|
|
2641
2648
|
/**
|
|
@@ -2665,6 +2672,9 @@ var CompartmentInstance = class {
|
|
|
2665
2672
|
this.compartment = compartment;
|
|
2666
2673
|
this.inner = inner;
|
|
2667
2674
|
}
|
|
2675
|
+
get extension() {
|
|
2676
|
+
return this;
|
|
2677
|
+
}
|
|
2668
2678
|
};
|
|
2669
2679
|
var Configuration = class _Configuration {
|
|
2670
2680
|
constructor(base2, compartments, dynamicSlots, address, staticValues, facets) {
|
|
@@ -2772,6 +2782,8 @@ function flatten(extension, compartments, newCompartments) {
|
|
|
2772
2782
|
} else {
|
|
2773
2783
|
let content2 = ext.extension;
|
|
2774
2784
|
if (!content2)
|
|
2785
|
+
throw new Error(`Unrecognized extension value in extension set (${ext}).`);
|
|
2786
|
+
if (content2 == ext)
|
|
2775
2787
|
throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);
|
|
2776
2788
|
inner(content2, prec2);
|
|
2777
2789
|
}
|
|
@@ -4964,8 +4976,11 @@ function scanFor(node, off, targetNode, targetOff, dir) {
|
|
|
4964
4976
|
function maxOffset(node) {
|
|
4965
4977
|
return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
|
|
4966
4978
|
}
|
|
4967
|
-
function flattenRect(rect,
|
|
4968
|
-
let
|
|
4979
|
+
function flattenRect(rect, toLeft) {
|
|
4980
|
+
let { left, right } = rect;
|
|
4981
|
+
if (left == right)
|
|
4982
|
+
return rect;
|
|
4983
|
+
let x8 = toLeft ? left : right;
|
|
4969
4984
|
return { left: x8, right: x8, top: rect.top, bottom: rect.bottom };
|
|
4970
4985
|
}
|
|
4971
4986
|
function windowRect(win) {
|
|
@@ -6047,7 +6062,7 @@ var Tile = class {
|
|
|
6047
6062
|
covers(side) {
|
|
6048
6063
|
return true;
|
|
6049
6064
|
}
|
|
6050
|
-
coordsIn(pos, side) {
|
|
6065
|
+
coordsIn(pos, side, rtl) {
|
|
6051
6066
|
return null;
|
|
6052
6067
|
}
|
|
6053
6068
|
domPosFor(off, side) {
|
|
@@ -6255,7 +6270,7 @@ var LineTile = class _LineTile extends CompositeTile {
|
|
|
6255
6270
|
if (end >= pos2) {
|
|
6256
6271
|
if (child.isComposite()) {
|
|
6257
6272
|
scan(child, pos2 - off);
|
|
6258
|
-
} else if ((!after || after.isHidden && (side > 0 || forCoords && onSameLine(after, child))) && (end > pos2 || child.flags & 32)) {
|
|
6273
|
+
} else if ((!after || after.isHidden && (side > 0 && !(after.flags & 32) || forCoords && onSameLine(after, child))) && (end > pos2 || child.flags & 32)) {
|
|
6259
6274
|
after = child;
|
|
6260
6275
|
afterOff = pos2 - off;
|
|
6261
6276
|
} else if (off < pos2 || child.flags & 16 && !child.isHidden) {
|
|
@@ -6270,11 +6285,11 @@ var LineTile = class _LineTile extends CompositeTile {
|
|
|
6270
6285
|
let target = (side < 0 ? before : after) || before || after;
|
|
6271
6286
|
return target ? { tile: target, offset: target == before ? beforeOff : afterOff } : null;
|
|
6272
6287
|
}
|
|
6273
|
-
coordsIn(pos, side) {
|
|
6288
|
+
coordsIn(pos, side, rtl) {
|
|
6274
6289
|
let found = this.resolveInline(pos, side, true);
|
|
6275
6290
|
if (!found)
|
|
6276
6291
|
return fallbackRect(this);
|
|
6277
|
-
return found.tile.coordsIn(Math.max(0, found.offset), side);
|
|
6292
|
+
return found.tile.coordsIn(Math.max(0, found.offset), side, rtl);
|
|
6278
6293
|
}
|
|
6279
6294
|
domIn(pos, side) {
|
|
6280
6295
|
let found = this.resolveInline(pos, side);
|
|
@@ -6344,7 +6359,7 @@ var TextTile = class _TextTile extends Tile {
|
|
|
6344
6359
|
toString() {
|
|
6345
6360
|
return JSON.stringify(this.text);
|
|
6346
6361
|
}
|
|
6347
|
-
coordsIn(pos, side) {
|
|
6362
|
+
coordsIn(pos, side, rtl) {
|
|
6348
6363
|
let length = this.dom.nodeValue.length;
|
|
6349
6364
|
if (pos > length)
|
|
6350
6365
|
pos = length;
|
|
@@ -6371,7 +6386,7 @@ var TextTile = class _TextTile extends Tile {
|
|
|
6371
6386
|
let rect = rects[(flatten2 ? flatten2 < 0 : side >= 0) ? 0 : rects.length - 1];
|
|
6372
6387
|
if (browser.safari && !flatten2 && rect.width == 0)
|
|
6373
6388
|
rect = Array.prototype.find.call(rects, (r13) => r13.width) || rect;
|
|
6374
|
-
return
|
|
6389
|
+
return rtl == null ? rect : flattenRect(rect, (flatten2 ? flatten2 > 0 : side < 0) == rtl);
|
|
6375
6390
|
}
|
|
6376
6391
|
static of(text, dom) {
|
|
6377
6392
|
let tile = new _TextTile(dom || document.createTextNode(text), text);
|
|
@@ -6453,8 +6468,9 @@ var WidgetBufferTile = class extends Tile {
|
|
|
6453
6468
|
get overrideDOMText() {
|
|
6454
6469
|
return Text.empty;
|
|
6455
6470
|
}
|
|
6456
|
-
coordsIn(pos) {
|
|
6457
|
-
|
|
6471
|
+
coordsIn(pos, side, rtl) {
|
|
6472
|
+
let rect = this.dom.getBoundingClientRect();
|
|
6473
|
+
return rtl == null ? rect : flattenRect(rect, side > 0 == rtl);
|
|
6458
6474
|
}
|
|
6459
6475
|
};
|
|
6460
6476
|
var TilePointer = class {
|
|
@@ -6814,7 +6830,7 @@ var TileCache = class {
|
|
|
6814
6830
|
find(cls, test, type = 2) {
|
|
6815
6831
|
let i13 = cls.bucket;
|
|
6816
6832
|
let bucket = this.buckets[i13], off = this.index[i13];
|
|
6817
|
-
for (let j7 =
|
|
6833
|
+
for (let j7 = 0; j7 < bucket.length; j7++) {
|
|
6818
6834
|
let index = (j7 + off) % bucket.length, tile = bucket[index];
|
|
6819
6835
|
if ((!test || test(tile)) && !this.reused.has(tile)) {
|
|
6820
6836
|
bucket.splice(index, 1);
|
|
@@ -7019,7 +7035,7 @@ var TileUpdate = class {
|
|
|
7019
7035
|
}
|
|
7020
7036
|
emit(from, to) {
|
|
7021
7037
|
let pendingLineAttrs = null;
|
|
7022
|
-
let b8 = this.builder, markCount =
|
|
7038
|
+
let b8 = this.builder, markCount = -1;
|
|
7023
7039
|
let openEnd = RangeSet.spans(this.decorations, from, to, {
|
|
7024
7040
|
point: (from2, to2, deco, active, openStart, index) => {
|
|
7025
7041
|
if (deco instanceof PointDecoration) {
|
|
@@ -7069,7 +7085,8 @@ var TileUpdate = class {
|
|
|
7069
7085
|
markCount = active.length;
|
|
7070
7086
|
}
|
|
7071
7087
|
});
|
|
7072
|
-
|
|
7088
|
+
if (markCount > -1)
|
|
7089
|
+
this.openWidget = openEnd > markCount;
|
|
7073
7090
|
if (!this.openWidget)
|
|
7074
7091
|
b8.addLineStartIfNotCovered(pendingLineAttrs);
|
|
7075
7092
|
this.openMarks = openEnd;
|
|
@@ -7438,7 +7455,7 @@ var DocView = class {
|
|
|
7438
7455
|
domAtPos(pos, side) {
|
|
7439
7456
|
let { tile, offset } = this.tile.resolveBlock(pos, side);
|
|
7440
7457
|
if (tile.isWidget())
|
|
7441
|
-
return tile.domPosFor(
|
|
7458
|
+
return tile.domPosFor(offset, side);
|
|
7442
7459
|
return tile.domIn(offset, side);
|
|
7443
7460
|
}
|
|
7444
7461
|
inlineDOMNearPos(pos, side) {
|
|
@@ -7474,14 +7491,16 @@ var DocView = class {
|
|
|
7474
7491
|
after = null;
|
|
7475
7492
|
return before && side < 0 || !after ? before.domIn(beforeOff, side) : after.domIn(afterOff, side);
|
|
7476
7493
|
}
|
|
7477
|
-
|
|
7494
|
+
// Get the coord of the element at the given side of the given
|
|
7495
|
+
// position. If rtl is given, flatten it using that text direction.
|
|
7496
|
+
coordsAt(pos, side, rtl) {
|
|
7478
7497
|
let { tile, offset } = this.tile.resolveBlock(pos, side);
|
|
7479
7498
|
if (tile.isWidget()) {
|
|
7480
7499
|
if (tile.widget instanceof BlockGapWidget)
|
|
7481
7500
|
return null;
|
|
7482
7501
|
return tile.coordsInWidget(offset, side, true);
|
|
7483
7502
|
}
|
|
7484
|
-
return tile.coordsIn(offset, side);
|
|
7503
|
+
return tile.coordsIn(offset, side, rtl);
|
|
7485
7504
|
}
|
|
7486
7505
|
lineAt(pos, side) {
|
|
7487
7506
|
let { tile } = this.tile.resolveBlock(pos, side);
|
|
@@ -7652,7 +7671,6 @@ var DocView = class {
|
|
|
7652
7671
|
this.blockWrappers = this.view.state.facet(blockWrappers).map((v4) => typeof v4 == "function" ? v4(this.view) : v4);
|
|
7653
7672
|
}
|
|
7654
7673
|
scrollIntoView(target) {
|
|
7655
|
-
var _a2;
|
|
7656
7674
|
if (target.isSnapshot) {
|
|
7657
7675
|
let ref = this.view.viewState.lineBlockAt(target.range.head);
|
|
7658
7676
|
this.view.scrollDOM.scrollTop = ref.top - target.yMargin;
|
|
@@ -7668,7 +7686,7 @@ var DocView = class {
|
|
|
7668
7686
|
}
|
|
7669
7687
|
}
|
|
7670
7688
|
let { range } = target;
|
|
7671
|
-
let rect = this.coordsAt(range.head,
|
|
7689
|
+
let rect = this.coordsAt(range.head, range.assoc || (range.head > range.anchor ? -1 : 1)), other;
|
|
7672
7690
|
if (!rect)
|
|
7673
7691
|
return;
|
|
7674
7692
|
if (!range.empty && (other = this.coordsAt(range.anchor, range.anchor > range.head ? -1 : 1)))
|
|
@@ -8615,6 +8633,7 @@ var InputState = class {
|
|
|
8615
8633
|
this.view = view;
|
|
8616
8634
|
this.lastKeyCode = 0;
|
|
8617
8635
|
this.lastKeyTime = 0;
|
|
8636
|
+
this.touchActive = false;
|
|
8618
8637
|
this.lastTouchTime = 0;
|
|
8619
8638
|
this.lastTouchX = 0;
|
|
8620
8639
|
this.lastTouchY = 0;
|
|
@@ -8623,6 +8642,7 @@ var InputState = class {
|
|
|
8623
8642
|
this.lastScrollLeft = 0;
|
|
8624
8643
|
this.lastWheelEvent = 0;
|
|
8625
8644
|
this.pendingIOSKey = void 0;
|
|
8645
|
+
this.lastIOSMomentumScroll = 0;
|
|
8626
8646
|
this.tabFocusMode = -1;
|
|
8627
8647
|
this.lastSelectionOrigin = null;
|
|
8628
8648
|
this.lastSelectionTime = 0;
|
|
@@ -8994,8 +9014,11 @@ function doPaste(view, input) {
|
|
|
8994
9014
|
});
|
|
8995
9015
|
}
|
|
8996
9016
|
observers.scroll = (view) => {
|
|
8997
|
-
|
|
8998
|
-
|
|
9017
|
+
let iState = view.inputState;
|
|
9018
|
+
iState.lastScrollTop = view.scrollDOM.scrollTop;
|
|
9019
|
+
iState.lastScrollLeft = view.scrollDOM.scrollLeft;
|
|
9020
|
+
if (browser.ios && !iState.touchActive)
|
|
9021
|
+
iState.lastIOSMomentumScroll = Date.now();
|
|
8999
9022
|
};
|
|
9000
9023
|
observers.wheel = observers.mousewheel = (view) => {
|
|
9001
9024
|
view.inputState.lastWheelEvent = Date.now();
|
|
@@ -9008,6 +9031,7 @@ handlers.keydown = (view, event) => {
|
|
|
9008
9031
|
};
|
|
9009
9032
|
observers.touchstart = (view, e6) => {
|
|
9010
9033
|
let iState = view.inputState, touch = e6.targetTouches[0];
|
|
9034
|
+
iState.touchActive = true;
|
|
9011
9035
|
iState.lastTouchTime = Date.now();
|
|
9012
9036
|
if (touch) {
|
|
9013
9037
|
iState.lastTouchX = touch.clientX;
|
|
@@ -9018,6 +9042,9 @@ observers.touchstart = (view, e6) => {
|
|
|
9018
9042
|
observers.touchmove = (view) => {
|
|
9019
9043
|
view.inputState.setSelectionOrigin("select.pointer");
|
|
9020
9044
|
};
|
|
9045
|
+
observers.touchend = (view, e6) => {
|
|
9046
|
+
view.inputState.touchActive = false;
|
|
9047
|
+
};
|
|
9021
9048
|
handlers.mousedown = (view, event) => {
|
|
9022
9049
|
view.observer.flush();
|
|
9023
9050
|
if (view.inputState.lastTouchTime > Date.now() - 2e3)
|
|
@@ -12059,7 +12086,7 @@ var EditorView = class _EditorView {
|
|
|
12059
12086
|
} else {
|
|
12060
12087
|
let newAnchorHeight = scrollAnchorPos < 0 ? this.viewState.heightMap.height : this.viewState.lineBlockAt(scrollAnchorPos).top;
|
|
12061
12088
|
let diff = (newAnchorHeight - scrollAnchorHeight) / this.scaleY;
|
|
12062
|
-
if ((diff > 1 || diff < -1) && (scroll == this.scrollDOM || this.hasFocus || Math.max(this.inputState.lastWheelEvent, this.inputState.lastTouchTime) > Date.now() - 100)) {
|
|
12089
|
+
if ((diff > 1 || diff < -1) && !(browser.ios && this.inputState.lastIOSMomentumScroll > Date.now() - 100) && (scroll == this.scrollDOM || this.hasFocus || Math.max(this.inputState.lastWheelEvent, this.inputState.lastTouchTime) > Date.now() - 100)) {
|
|
12063
12090
|
scrollOffset = scrollOffset + diff;
|
|
12064
12091
|
if (scroll)
|
|
12065
12092
|
scroll.scrollTop += diff;
|
|
@@ -12350,12 +12377,9 @@ var EditorView = class _EditorView {
|
|
|
12350
12377
|
*/
|
|
12351
12378
|
coordsAtPos(pos, side = 1) {
|
|
12352
12379
|
this.readMeasured();
|
|
12353
|
-
let rect = this.docView.coordsAt(pos, side);
|
|
12354
|
-
if (!rect || rect.left == rect.right)
|
|
12355
|
-
return rect;
|
|
12356
12380
|
let line = this.state.doc.lineAt(pos), order = this.bidiSpans(line);
|
|
12357
12381
|
let span = order[BidiSpan.find(order, pos - line.from, -1, side)];
|
|
12358
|
-
return
|
|
12382
|
+
return this.docView.coordsAt(pos, side, span.dir == Direction.RTL);
|
|
12359
12383
|
}
|
|
12360
12384
|
/**
|
|
12361
12385
|
Return the rectangle around a given character. If `pos` does not
|
|
@@ -17744,32 +17768,13 @@ function useLineNumbers() {
|
|
|
17744
17768
|
}
|
|
17745
17769
|
|
|
17746
17770
|
// src/hooks/useHoverDelay.ts
|
|
17747
|
-
import { useState as
|
|
17771
|
+
import { useState as useState4, useCallback as useCallback5 } from "react";
|
|
17748
17772
|
|
|
17749
17773
|
// src/hooks/useHoverEmitter.ts
|
|
17750
|
-
import { useRef as useRef3, useCallback as useCallback4, useEffect as
|
|
17774
|
+
import { useRef as useRef3, useCallback as useCallback4, useEffect as useEffect4 } from "react";
|
|
17751
17775
|
import { HOVER_DELAY_MS } from "@semiont/sdk";
|
|
17752
|
-
|
|
17753
|
-
// src/hooks/useObservable.ts
|
|
17754
|
-
import { useState as useState4, useEffect as useEffect4 } from "react";
|
|
17755
|
-
function useObservable(obs$) {
|
|
17756
|
-
const [value, setValue] = useState4(() => {
|
|
17757
|
-
if (!obs$) return void 0;
|
|
17758
|
-
const getValue = obs$.getValue;
|
|
17759
|
-
return typeof getValue === "function" ? getValue.call(obs$) : void 0;
|
|
17760
|
-
});
|
|
17761
|
-
useEffect4(() => {
|
|
17762
|
-
if (!obs$) return;
|
|
17763
|
-
const sub = obs$.subscribe(setValue);
|
|
17764
|
-
return () => sub.unsubscribe();
|
|
17765
|
-
}, [obs$]);
|
|
17766
|
-
return value;
|
|
17767
|
-
}
|
|
17768
|
-
|
|
17769
|
-
// src/hooks/useHoverEmitter.ts
|
|
17770
17776
|
import { HOVER_DELAY_MS as HOVER_DELAY_MS2 } from "@semiont/sdk";
|
|
17771
|
-
function useHoverEmitter(annotationId2, hoverDelayMs = HOVER_DELAY_MS) {
|
|
17772
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
17777
|
+
function useHoverEmitter(session, annotationId2, hoverDelayMs = HOVER_DELAY_MS) {
|
|
17773
17778
|
const currentHoverRef = useRef3(null);
|
|
17774
17779
|
const timerRef = useRef3(null);
|
|
17775
17780
|
const onMouseEnter = useCallback4(() => {
|
|
@@ -17793,7 +17798,7 @@ function useHoverEmitter(annotationId2, hoverDelayMs = HOVER_DELAY_MS) {
|
|
|
17793
17798
|
session?.client.beckon.hover(null);
|
|
17794
17799
|
}
|
|
17795
17800
|
}, [session]);
|
|
17796
|
-
|
|
17801
|
+
useEffect4(() => {
|
|
17797
17802
|
return () => {
|
|
17798
17803
|
if (timerRef.current !== null) {
|
|
17799
17804
|
clearTimeout(timerRef.current);
|
|
@@ -17806,7 +17811,7 @@ function useHoverEmitter(annotationId2, hoverDelayMs = HOVER_DELAY_MS) {
|
|
|
17806
17811
|
|
|
17807
17812
|
// src/hooks/useHoverDelay.ts
|
|
17808
17813
|
function useHoverDelay() {
|
|
17809
|
-
const [hoverDelayMs, setHoverDelayMsState] =
|
|
17814
|
+
const [hoverDelayMs, setHoverDelayMsState] = useState4(() => {
|
|
17810
17815
|
if (typeof window !== "undefined") {
|
|
17811
17816
|
const stored = localStorage.getItem("hoverDelayMs");
|
|
17812
17817
|
return stored ? Number(stored) : HOVER_DELAY_MS2;
|
|
@@ -17865,7 +17870,7 @@ function useObservableExternalNavigation() {
|
|
|
17865
17870
|
}
|
|
17866
17871
|
|
|
17867
17872
|
// src/hooks/usePanelWidth.ts
|
|
17868
|
-
import { useState as
|
|
17873
|
+
import { useState as useState5, useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
17869
17874
|
function usePanelWidth({
|
|
17870
17875
|
defaultWidth = 384,
|
|
17871
17876
|
// 24rem
|
|
@@ -17875,9 +17880,9 @@ function usePanelWidth({
|
|
|
17875
17880
|
// 50rem
|
|
17876
17881
|
storageKey = "semiont-panel-width"
|
|
17877
17882
|
} = {}) {
|
|
17878
|
-
const [width, setWidthInternal] =
|
|
17883
|
+
const [width, setWidthInternal] = useState5(defaultWidth);
|
|
17879
17884
|
const userChangedRef = useRef4(false);
|
|
17880
|
-
|
|
17885
|
+
useEffect5(() => {
|
|
17881
17886
|
if (typeof window === "undefined") return;
|
|
17882
17887
|
const saved = localStorage.getItem(storageKey);
|
|
17883
17888
|
if (saved) {
|
|
@@ -17891,7 +17896,7 @@ function usePanelWidth({
|
|
|
17891
17896
|
userChangedRef.current = true;
|
|
17892
17897
|
setWidthInternal(constrained);
|
|
17893
17898
|
};
|
|
17894
|
-
|
|
17899
|
+
useEffect5(() => {
|
|
17895
17900
|
if (!userChangedRef.current) return;
|
|
17896
17901
|
localStorage.setItem(storageKey, width.toString());
|
|
17897
17902
|
}, [width, storageKey]);
|
|
@@ -17899,7 +17904,7 @@ function usePanelWidth({
|
|
|
17899
17904
|
}
|
|
17900
17905
|
|
|
17901
17906
|
// src/hooks/useRovingTabIndex.ts
|
|
17902
|
-
import { useRef as useRef5, useEffect as
|
|
17907
|
+
import { useRef as useRef5, useEffect as useEffect6, useCallback as useCallback7 } from "react";
|
|
17903
17908
|
function useRovingTabIndex(itemCount, options = {}) {
|
|
17904
17909
|
const { orientation = "horizontal", loop = true, cols = 1 } = options;
|
|
17905
17910
|
const containerRef = useRef5(null);
|
|
@@ -17979,7 +17984,7 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
17979
17984
|
},
|
|
17980
17985
|
[orientation, cols, getFocusableItems, focusItem]
|
|
17981
17986
|
);
|
|
17982
|
-
|
|
17987
|
+
useEffect6(() => {
|
|
17983
17988
|
const items = getFocusableItems();
|
|
17984
17989
|
if (items.length === 0) return;
|
|
17985
17990
|
items.forEach((item, i13) => {
|
|
@@ -18015,6 +18020,24 @@ function useRovingTabIndex(itemCount, options = {}) {
|
|
|
18015
18020
|
|
|
18016
18021
|
// src/hooks/useSessionExpiry.ts
|
|
18017
18022
|
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
18023
|
+
|
|
18024
|
+
// src/hooks/useObservable.ts
|
|
18025
|
+
import { useState as useState6, useEffect as useEffect7 } from "react";
|
|
18026
|
+
function useObservable(obs$) {
|
|
18027
|
+
const [value, setValue] = useState6(() => {
|
|
18028
|
+
if (!obs$) return void 0;
|
|
18029
|
+
const getValue = obs$.getValue;
|
|
18030
|
+
return typeof getValue === "function" ? getValue.call(obs$) : void 0;
|
|
18031
|
+
});
|
|
18032
|
+
useEffect7(() => {
|
|
18033
|
+
if (!obs$) return;
|
|
18034
|
+
const sub = obs$.subscribe(setValue);
|
|
18035
|
+
return () => sub.unsubscribe();
|
|
18036
|
+
}, [obs$]);
|
|
18037
|
+
return value;
|
|
18038
|
+
}
|
|
18039
|
+
|
|
18040
|
+
// src/hooks/useSessionExpiry.ts
|
|
18018
18041
|
function useSessionExpiry() {
|
|
18019
18042
|
const session = useObservable(useSemiont().activeSession$);
|
|
18020
18043
|
useObservable(session?.token$);
|
|
@@ -29512,7 +29535,7 @@ function AnnotationOverlay({
|
|
|
29512
29535
|
className: "semiont-annotation-overlay__shape",
|
|
29513
29536
|
"data-hovered": isHovered ? "true" : "false",
|
|
29514
29537
|
"data-selected": isSelected ? "true" : "false",
|
|
29515
|
-
onClick: () => session?.client.browse.click(annotation.id, annotation.motivation),
|
|
29538
|
+
onClick: (e6) => session?.client.browse.click(annotation.id, annotation.motivation, e6.currentTarget.getBoundingClientRect()),
|
|
29516
29539
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29517
29540
|
onMouseLeave: handleMouseLeave
|
|
29518
29541
|
}
|
|
@@ -29527,7 +29550,7 @@ function AnnotationOverlay({
|
|
|
29527
29550
|
style: { userSelect: "none" },
|
|
29528
29551
|
onClick: (e6) => {
|
|
29529
29552
|
e6.stopPropagation();
|
|
29530
|
-
session?.client.browse.click(annotation.id, annotation.motivation);
|
|
29553
|
+
session?.client.browse.click(annotation.id, annotation.motivation, e6.currentTarget.getBoundingClientRect());
|
|
29531
29554
|
},
|
|
29532
29555
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29533
29556
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29557,7 +29580,7 @@ function AnnotationOverlay({
|
|
|
29557
29580
|
className: "semiont-annotation-overlay__shape",
|
|
29558
29581
|
"data-hovered": isHovered ? "true" : "false",
|
|
29559
29582
|
"data-selected": isSelected ? "true" : "false",
|
|
29560
|
-
onClick: () => session?.client.browse.click(annotation.id, annotation.motivation),
|
|
29583
|
+
onClick: (e6) => session?.client.browse.click(annotation.id, annotation.motivation, e6.currentTarget.getBoundingClientRect()),
|
|
29561
29584
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29562
29585
|
onMouseLeave: handleMouseLeave
|
|
29563
29586
|
}
|
|
@@ -29572,7 +29595,7 @@ function AnnotationOverlay({
|
|
|
29572
29595
|
style: { userSelect: "none" },
|
|
29573
29596
|
onClick: (e6) => {
|
|
29574
29597
|
e6.stopPropagation();
|
|
29575
|
-
session?.client.browse.click(annotation.id, annotation.motivation);
|
|
29598
|
+
session?.client.browse.click(annotation.id, annotation.motivation, e6.currentTarget.getBoundingClientRect());
|
|
29576
29599
|
},
|
|
29577
29600
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29578
29601
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29606,7 +29629,7 @@ function AnnotationOverlay({
|
|
|
29606
29629
|
className: "semiont-annotation-overlay__shape",
|
|
29607
29630
|
"data-hovered": isHovered ? "true" : "false",
|
|
29608
29631
|
"data-selected": isSelected ? "true" : "false",
|
|
29609
|
-
onClick: () => session?.client.browse.click(annotation.id, annotation.motivation),
|
|
29632
|
+
onClick: (e6) => session?.client.browse.click(annotation.id, annotation.motivation, e6.currentTarget.getBoundingClientRect()),
|
|
29610
29633
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29611
29634
|
onMouseLeave: handleMouseLeave
|
|
29612
29635
|
}
|
|
@@ -29621,7 +29644,7 @@ function AnnotationOverlay({
|
|
|
29621
29644
|
style: { userSelect: "none" },
|
|
29622
29645
|
onClick: (e6) => {
|
|
29623
29646
|
e6.stopPropagation();
|
|
29624
|
-
session?.client.browse.click(annotation.id, annotation.motivation);
|
|
29647
|
+
session?.client.browse.click(annotation.id, annotation.motivation, e6.currentTarget.getBoundingClientRect());
|
|
29625
29648
|
},
|
|
29626
29649
|
onMouseEnter: () => handleMouseEnter(annotation.id),
|
|
29627
29650
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29753,6 +29776,7 @@ function SvgDrawingCanvas({
|
|
|
29753
29776
|
const MIN_DRAG_DISTANCE = 10;
|
|
29754
29777
|
if (dragDistance < MIN_DRAG_DISTANCE) {
|
|
29755
29778
|
if (existingAnnotations.length > 0) {
|
|
29779
|
+
let hitRect;
|
|
29756
29780
|
const clickedAnnotation = existingAnnotations.find((ann) => {
|
|
29757
29781
|
if (typeof ann.target === "string") return false;
|
|
29758
29782
|
const svgSelector = ann.target.selector;
|
|
@@ -29770,12 +29794,16 @@ function SvgDrawingCanvas({
|
|
|
29770
29794
|
const displayY = y4 * scaleY;
|
|
29771
29795
|
const displayWidth = width * scaleX;
|
|
29772
29796
|
const displayHeight = height * scaleY;
|
|
29773
|
-
|
|
29797
|
+
const hit = endPoint.x >= displayX && endPoint.x <= displayX + displayWidth && endPoint.y >= displayY && endPoint.y <= displayY + displayHeight;
|
|
29798
|
+
if (hit && imageRef.current) {
|
|
29799
|
+
hitRect = toViewportAnchorRect(imageRef.current.getBoundingClientRect(), displayX, displayY, displayWidth, displayHeight);
|
|
29800
|
+
}
|
|
29801
|
+
return hit;
|
|
29774
29802
|
}
|
|
29775
29803
|
return false;
|
|
29776
29804
|
});
|
|
29777
29805
|
if (clickedAnnotation) {
|
|
29778
|
-
session?.client.browse.click(clickedAnnotation.id, clickedAnnotation.motivation);
|
|
29806
|
+
session?.client.browse.click(clickedAnnotation.id, clickedAnnotation.motivation, hitRect);
|
|
29779
29807
|
setIsDrawing(false);
|
|
29780
29808
|
setStartPoint(null);
|
|
29781
29809
|
setCurrentPoint(null);
|
|
@@ -30414,7 +30442,7 @@ function fallbackTextPosition(content2, selectedText) {
|
|
|
30414
30442
|
|
|
30415
30443
|
// src/components/resource/AnnotateView.tsx
|
|
30416
30444
|
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
30417
|
-
var PdfAnnotationCanvas = lazy(() => import("./PdfAnnotationCanvas.client-
|
|
30445
|
+
var PdfAnnotationCanvas = lazy(() => import("./PdfAnnotationCanvas.client-75GY2EDR.js").then((mod) => ({ default: mod.PdfAnnotationCanvas })));
|
|
30418
30446
|
function AnnotateView({
|
|
30419
30447
|
content: content2,
|
|
30420
30448
|
mimeType = "text/plain",
|
|
@@ -31072,42 +31100,37 @@ import { createHoverHandlers as createHoverHandlers3 } from "@semiont/sdk";
|
|
|
31072
31100
|
import { lazy as lazy2, Suspense as Suspense2, memo } from "react";
|
|
31073
31101
|
import ReactMarkdown from "react-markdown";
|
|
31074
31102
|
import remarkGfm from "remark-gfm";
|
|
31075
|
-
|
|
31076
|
-
// src/components/viewers/ImageViewer.tsx
|
|
31077
31103
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
31078
|
-
|
|
31079
|
-
return /* @__PURE__ */ jsx25("div", { className: "semiont-image-viewer", children: /* @__PURE__ */ jsx25(
|
|
31080
|
-
"img",
|
|
31081
|
-
{
|
|
31082
|
-
src: imageUrl,
|
|
31083
|
-
alt,
|
|
31084
|
-
className: "semiont-image-viewer__image",
|
|
31085
|
-
style: { imageRendering: "auto" }
|
|
31086
|
-
}
|
|
31087
|
-
) });
|
|
31088
|
-
}
|
|
31089
|
-
|
|
31090
|
-
// src/components/resource/browse-renderers.tsx
|
|
31091
|
-
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
31092
|
-
var PdfAnnotationCanvas2 = lazy2(() => import("./PdfAnnotationCanvas.client-KWQ7XDWT.js").then((mod) => ({ default: mod.PdfAnnotationCanvas })));
|
|
31104
|
+
var PdfAnnotationCanvas2 = lazy2(() => import("./PdfAnnotationCanvas.client-75GY2EDR.js").then((mod) => ({ default: mod.PdfAnnotationCanvas })));
|
|
31093
31105
|
var MemoizedMarkdown = memo(function MemoizedMarkdown2({ content: content2 }) {
|
|
31094
|
-
return /* @__PURE__ */
|
|
31106
|
+
return /* @__PURE__ */ jsx25(ReactMarkdown, { remarkPlugins: [remarkGfm], children: content2 });
|
|
31095
31107
|
});
|
|
31096
31108
|
function TextBrowseRenderer({ content: content2 }) {
|
|
31097
|
-
return /* @__PURE__ */
|
|
31109
|
+
return /* @__PURE__ */ jsx25(MemoizedMarkdown, { content: content2 });
|
|
31098
31110
|
}
|
|
31099
|
-
function ImageBrowseRenderer({ content: content2,
|
|
31100
|
-
return /* @__PURE__ */
|
|
31111
|
+
function ImageBrowseRenderer({ content: content2, resourceUri, annotations, session }) {
|
|
31112
|
+
return /* @__PURE__ */ jsx25(
|
|
31113
|
+
SvgDrawingCanvas,
|
|
31114
|
+
{
|
|
31115
|
+
imageUrl: content2,
|
|
31116
|
+
resourceUri,
|
|
31117
|
+
existingAnnotations: annotations,
|
|
31118
|
+
drawingMode: null,
|
|
31119
|
+
selectedMotivation: null,
|
|
31120
|
+
session
|
|
31121
|
+
}
|
|
31122
|
+
);
|
|
31101
31123
|
}
|
|
31102
|
-
function PdfBrowseRenderer({ content: content2, resourceUri, annotations }) {
|
|
31103
|
-
return /* @__PURE__ */
|
|
31124
|
+
function PdfBrowseRenderer({ content: content2, resourceUri, annotations, session }) {
|
|
31125
|
+
return /* @__PURE__ */ jsx25(Suspense2, { fallback: /* @__PURE__ */ jsx25("div", { className: "semiont-browse-view__loading", children: "Loading PDF viewer..." }), children: /* @__PURE__ */ jsx25(
|
|
31104
31126
|
PdfAnnotationCanvas2,
|
|
31105
31127
|
{
|
|
31106
31128
|
pdfUrl: content2,
|
|
31107
31129
|
resourceUri,
|
|
31108
31130
|
existingAnnotations: annotations,
|
|
31109
31131
|
drawingMode: null,
|
|
31110
|
-
selectedMotivation: null
|
|
31132
|
+
selectedMotivation: null,
|
|
31133
|
+
session
|
|
31111
31134
|
}
|
|
31112
31135
|
) });
|
|
31113
31136
|
}
|
|
@@ -31118,7 +31141,7 @@ var defaultBrowseRenderers = {
|
|
|
31118
31141
|
};
|
|
31119
31142
|
|
|
31120
31143
|
// src/components/resource/BrowseView.tsx
|
|
31121
|
-
import { jsx as
|
|
31144
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
31122
31145
|
var BrowseView = memo2(function BrowseView2({
|
|
31123
31146
|
content: content2,
|
|
31124
31147
|
mimeType,
|
|
@@ -31166,12 +31189,13 @@ var BrowseView = memo2(function BrowseView2({
|
|
|
31166
31189
|
const target = e6.target;
|
|
31167
31190
|
const annotationElement = target.closest("[data-annotation-id]");
|
|
31168
31191
|
if (!annotationElement) return;
|
|
31192
|
+
const selection2 = window.getSelection();
|
|
31193
|
+
if (selection2 && !selection2.isCollapsed) return;
|
|
31169
31194
|
const annotationId2 = annotationElement.getAttribute("data-annotation-id");
|
|
31170
|
-
|
|
31171
|
-
if (annotationId2 && annotationType === "reference") {
|
|
31195
|
+
if (annotationId2) {
|
|
31172
31196
|
const annotation = allAnnotations.find((a15) => a15.id === annotationId2);
|
|
31173
31197
|
if (annotation) {
|
|
31174
|
-
session.client.browse.click(annotation.id, annotation.motivation);
|
|
31198
|
+
session.client.browse.click(annotation.id, annotation.motivation, annotationElement.getBoundingClientRect());
|
|
31175
31199
|
}
|
|
31176
31200
|
}
|
|
31177
31201
|
};
|
|
@@ -31274,12 +31298,12 @@ var BrowseView = memo2(function BrowseView2({
|
|
|
31274
31298
|
const mediaRenderers = { ...defaultBrowseRenderers, ...renderers };
|
|
31275
31299
|
const Renderer = render === "none" ? void 0 : mediaRenderers[render];
|
|
31276
31300
|
if (!Renderer) {
|
|
31277
|
-
return /* @__PURE__ */
|
|
31301
|
+
return /* @__PURE__ */ jsx26("div", { ref: containerRef, className: `semiont-browse-view semiont-browse-view--unsupported${inlineMod}`, "data-mime-type": "unsupported", children: /* @__PURE__ */ jsxs19("div", { className: "semiont-browse-view__empty", children: [
|
|
31278
31302
|
/* @__PURE__ */ jsxs19("p", { className: "semiont-browse-view__empty-message", children: [
|
|
31279
31303
|
"Preview not available for ",
|
|
31280
31304
|
mimeType
|
|
31281
31305
|
] }),
|
|
31282
|
-
/* @__PURE__ */
|
|
31306
|
+
/* @__PURE__ */ jsx26(
|
|
31283
31307
|
"a",
|
|
31284
31308
|
{
|
|
31285
31309
|
href: `/api/resources/${resourceUri}`,
|
|
@@ -31291,7 +31315,7 @@ var BrowseView = memo2(function BrowseView2({
|
|
|
31291
31315
|
] }) });
|
|
31292
31316
|
}
|
|
31293
31317
|
return /* @__PURE__ */ jsxs19("div", { className: `semiont-browse-view${inlineMod}`, "data-mime-type": render, children: [
|
|
31294
|
-
showToolbar && /* @__PURE__ */
|
|
31318
|
+
showToolbar && /* @__PURE__ */ jsx26(
|
|
31295
31319
|
AnnotateToolbar,
|
|
31296
31320
|
{
|
|
31297
31321
|
selectedMotivation: null,
|
|
@@ -31305,14 +31329,14 @@ var BrowseView = memo2(function BrowseView2({
|
|
|
31305
31329
|
compact: inline
|
|
31306
31330
|
}
|
|
31307
31331
|
),
|
|
31308
|
-
/* @__PURE__ */
|
|
31332
|
+
/* @__PURE__ */ jsx26("div", { ref: containerRef, className: "semiont-browse-view__content", onClick: handleContentClick, children: /* @__PURE__ */ jsx26(Renderer, { content: content2, mimeType, resourceUri, annotations: allAnnotations, session }) })
|
|
31309
31333
|
] });
|
|
31310
31334
|
});
|
|
31311
31335
|
|
|
31312
31336
|
// src/components/resource/ResourceViewer.tsx
|
|
31313
31337
|
import { useState as useState23, useCallback as useCallback19, useRef as useRef18, useMemo as useMemo7 } from "react";
|
|
31314
31338
|
import { getExactText as getExactText3, getTargetSelector as getTargetSelector4, isHighlight as isHighlight5, isAssessment as isAssessment4, isReference as isReference6, isComment as isComment5, isTag as isTag5, getBodySource as getBodySource5 } from "@semiont/core";
|
|
31315
|
-
import { jsx as
|
|
31339
|
+
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
31316
31340
|
function ResourceViewer({
|
|
31317
31341
|
resource,
|
|
31318
31342
|
annotations,
|
|
@@ -31441,7 +31465,7 @@ function ResourceViewer({
|
|
|
31441
31465
|
return;
|
|
31442
31466
|
}
|
|
31443
31467
|
}, [annotateMode, selectedClick, focusAnnotation, onOpenResource]);
|
|
31444
|
-
const handleAnnotationClickEvent = useCallback19(({ annotationId: annotationId2, motivation }) => {
|
|
31468
|
+
const handleAnnotationClickEvent = useCallback19(({ annotationId: annotationId2, motivation, anchorRect }) => {
|
|
31445
31469
|
const metadata = Object.values(ANNOTATORS).find((a15) => a15.matchesAnnotation({ motivation }));
|
|
31446
31470
|
if (!metadata?.hasSidePanel) {
|
|
31447
31471
|
const allAnnotations = [...highlights, ...references, ...assessments, ...comments, ...tags3];
|
|
@@ -31459,7 +31483,7 @@ function ResourceViewer({
|
|
|
31459
31483
|
}
|
|
31460
31484
|
return;
|
|
31461
31485
|
}
|
|
31462
|
-
onOpenPanel?.({ panel: "annotations", scrollToAnnotationId: annotationId2, motivation });
|
|
31486
|
+
onOpenPanel?.({ panel: "annotations", scrollToAnnotationId: annotationId2, motivation, ...anchorRect ? { anchorRect } : {} });
|
|
31463
31487
|
}, [highlights, references, assessments, comments, tags3, handleAnnotationClick2, selectedClick, onOpenPanel]);
|
|
31464
31488
|
useSessionEventSubscriptions(session, {
|
|
31465
31489
|
// Annotation cache invalidation
|
|
@@ -31485,7 +31509,7 @@ function ResourceViewer({
|
|
|
31485
31509
|
return referencedResource ? getExactText3(getTargetSelector4(referencedResource.target)) : void 0;
|
|
31486
31510
|
}, [references]);
|
|
31487
31511
|
return /* @__PURE__ */ jsxs20("div", { ref: documentViewerRef, className: `semiont-resource-viewer${inline ? " semiont-resource-viewer--inline" : ""}`, children: [
|
|
31488
|
-
activeView === "annotate" ? /* @__PURE__ */
|
|
31512
|
+
activeView === "annotate" ? /* @__PURE__ */ jsx27(
|
|
31489
31513
|
AnnotateView,
|
|
31490
31514
|
{
|
|
31491
31515
|
content: resource.content,
|
|
@@ -31509,7 +31533,7 @@ function ResourceViewer({
|
|
|
31509
31533
|
session,
|
|
31510
31534
|
newAnnotationIds
|
|
31511
31535
|
}
|
|
31512
|
-
) : /* @__PURE__ */
|
|
31536
|
+
) : /* @__PURE__ */ jsx27(
|
|
31513
31537
|
BrowseView,
|
|
31514
31538
|
{
|
|
31515
31539
|
content: resource.content,
|
|
@@ -31529,14 +31553,14 @@ function ResourceViewer({
|
|
|
31529
31553
|
inline
|
|
31530
31554
|
}
|
|
31531
31555
|
),
|
|
31532
|
-
jsonLdAnnotation && /* @__PURE__ */
|
|
31556
|
+
jsonLdAnnotation && /* @__PURE__ */ jsx27(
|
|
31533
31557
|
PopupContainer,
|
|
31534
31558
|
{
|
|
31535
31559
|
isOpen: showJsonLdView,
|
|
31536
31560
|
onClose: () => setShowJsonLdView(false),
|
|
31537
31561
|
position: getJsonLdModalPosition(),
|
|
31538
31562
|
wide: true,
|
|
31539
|
-
children: /* @__PURE__ */
|
|
31563
|
+
children: /* @__PURE__ */ jsx27(
|
|
31540
31564
|
JsonLdView,
|
|
31541
31565
|
{
|
|
31542
31566
|
annotation: jsonLdAnnotation,
|
|
@@ -31554,7 +31578,7 @@ function ResourceViewer({
|
|
|
31554
31578
|
const targetSelector = getTargetSelector4(annotation.target);
|
|
31555
31579
|
const selectedText = getExactText3(targetSelector);
|
|
31556
31580
|
const motivationEmoji = metadata?.iconEmoji || "\u{1F4DD}";
|
|
31557
|
-
return /* @__PURE__ */
|
|
31581
|
+
return /* @__PURE__ */ jsx27(
|
|
31558
31582
|
PopupContainer,
|
|
31559
31583
|
{
|
|
31560
31584
|
isOpen: !!deleteConfirmation,
|
|
@@ -31562,17 +31586,17 @@ function ResourceViewer({
|
|
|
31562
31586
|
position: deleteConfirmation.position,
|
|
31563
31587
|
children: /* @__PURE__ */ jsxs20("div", { className: "semiont-delete-confirmation", children: [
|
|
31564
31588
|
/* @__PURE__ */ jsxs20("div", { className: "semiont-delete-confirmation__header", children: [
|
|
31565
|
-
/* @__PURE__ */
|
|
31566
|
-
/* @__PURE__ */
|
|
31589
|
+
/* @__PURE__ */ jsx27("span", { className: "semiont-delete-confirmation__icon", children: motivationEmoji }),
|
|
31590
|
+
/* @__PURE__ */ jsx27("h3", { className: "semiont-delete-confirmation__title", children: t12("deleteConfirmationTitle") })
|
|
31567
31591
|
] }),
|
|
31568
|
-
selectedText && /* @__PURE__ */
|
|
31592
|
+
selectedText && /* @__PURE__ */ jsx27("div", { className: "semiont-delete-confirmation__quote", children: /* @__PURE__ */ jsxs20("p", { className: "semiont-delete-confirmation__text", children: [
|
|
31569
31593
|
'"',
|
|
31570
31594
|
selectedText.length > 100 ? selectedText.substring(0, 100) + "..." : selectedText,
|
|
31571
31595
|
'"'
|
|
31572
31596
|
] }) }),
|
|
31573
|
-
/* @__PURE__ */
|
|
31597
|
+
/* @__PURE__ */ jsx27("p", { className: "semiont-delete-confirmation__message", children: t12("deleteConfirmationMessage") }),
|
|
31574
31598
|
/* @__PURE__ */ jsxs20("div", { className: "semiont-delete-confirmation__actions", children: [
|
|
31575
|
-
/* @__PURE__ */
|
|
31599
|
+
/* @__PURE__ */ jsx27(
|
|
31576
31600
|
"button",
|
|
31577
31601
|
{
|
|
31578
31602
|
onClick: () => setDeleteConfirmation(null),
|
|
@@ -31580,7 +31604,7 @@ function ResourceViewer({
|
|
|
31580
31604
|
children: t12("deleteConfirmationCancel")
|
|
31581
31605
|
}
|
|
31582
31606
|
),
|
|
31583
|
-
/* @__PURE__ */
|
|
31607
|
+
/* @__PURE__ */ jsx27(
|
|
31584
31608
|
"button",
|
|
31585
31609
|
{
|
|
31586
31610
|
onClick: () => {
|
|
@@ -31615,7 +31639,7 @@ function renderAgentLabel(agent) {
|
|
|
31615
31639
|
}
|
|
31616
31640
|
|
|
31617
31641
|
// src/components/resource/panels/AssessmentEntry.tsx
|
|
31618
|
-
import { jsx as
|
|
31642
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
31619
31643
|
function formatRelativeTime2(isoString) {
|
|
31620
31644
|
const date = new Date(isoString);
|
|
31621
31645
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -31645,13 +31669,13 @@ function getAssessmentText(annotation) {
|
|
|
31645
31669
|
return null;
|
|
31646
31670
|
}
|
|
31647
31671
|
function AssessmentEntry({
|
|
31672
|
+
session,
|
|
31648
31673
|
assessment,
|
|
31649
31674
|
isFocused,
|
|
31650
31675
|
isHovered = false,
|
|
31651
31676
|
ref
|
|
31652
31677
|
}) {
|
|
31653
|
-
const
|
|
31654
|
-
const hoverProps = useHoverEmitter(assessment.id);
|
|
31678
|
+
const hoverProps = useHoverEmitter(session, assessment.id);
|
|
31655
31679
|
const selectedText = getAnnotationExactText(assessment);
|
|
31656
31680
|
const assessmentText = getAssessmentText(assessment);
|
|
31657
31681
|
return /* @__PURE__ */ jsxs21(
|
|
@@ -31672,7 +31696,7 @@ function AssessmentEntry({
|
|
|
31672
31696
|
selectedText.length > 100 ? "..." : "",
|
|
31673
31697
|
'"'
|
|
31674
31698
|
] }),
|
|
31675
|
-
assessmentText && /* @__PURE__ */
|
|
31699
|
+
assessmentText && /* @__PURE__ */ jsx28("div", { className: "semiont-annotation-entry__body", "data-type": "assessment", children: assessmentText }),
|
|
31676
31700
|
/* @__PURE__ */ jsxs21("div", { className: "semiont-annotation-entry__metadata", children: [
|
|
31677
31701
|
"By ",
|
|
31678
31702
|
typeof assessment.creator === "string" ? assessment.creator : assessment.creator?.name || "Unknown",
|
|
@@ -31694,8 +31718,9 @@ import { getTextPositionSelector as getTextPositionSelector3, getTargetSelector
|
|
|
31694
31718
|
|
|
31695
31719
|
// src/components/resource/panels/AssistSection.tsx
|
|
31696
31720
|
import { useState as useState24, useEffect as useEffect28, useCallback as useCallback20 } from "react";
|
|
31697
|
-
import { Fragment as Fragment4, jsx as
|
|
31721
|
+
import { Fragment as Fragment4, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
31698
31722
|
function AssistSection({
|
|
31723
|
+
session,
|
|
31699
31724
|
annotationType,
|
|
31700
31725
|
isAssisting,
|
|
31701
31726
|
locale,
|
|
@@ -31704,7 +31729,6 @@ function AssistSection({
|
|
|
31704
31729
|
}) {
|
|
31705
31730
|
const panelName = annotationType === "highlight" ? "HighlightPanel" : annotationType === "assessment" ? "AssessmentPanel" : "CommentsPanel";
|
|
31706
31731
|
const t12 = useTranslations(panelName);
|
|
31707
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
31708
31732
|
const [instructions, setInstructions] = useState24("");
|
|
31709
31733
|
const [tone, setTone] = useState24("");
|
|
31710
31734
|
const defaultDensity = annotationType === "comment" ? 5 : annotationType === "assessment" ? 4 : annotationType === "highlight" ? 5 : 5;
|
|
@@ -31747,8 +31771,8 @@ function AssistSection({
|
|
|
31747
31771
|
"aria-expanded": isExpanded,
|
|
31748
31772
|
type: "button",
|
|
31749
31773
|
children: [
|
|
31750
|
-
/* @__PURE__ */
|
|
31751
|
-
/* @__PURE__ */
|
|
31774
|
+
/* @__PURE__ */ jsx29("span", { children: t12(annotationType === "highlight" ? "annotateHighlights" : annotationType === "assessment" ? "annotateAssessments" : "annotateComments") }),
|
|
31775
|
+
/* @__PURE__ */ jsx29("span", { className: "semiont-panel__section-chevron", "data-expanded": isExpanded, children: "\u203A" })
|
|
31752
31776
|
]
|
|
31753
31777
|
}
|
|
31754
31778
|
),
|
|
@@ -31766,7 +31790,7 @@ function AssistSection({
|
|
|
31766
31790
|
" ",
|
|
31767
31791
|
t12("optional")
|
|
31768
31792
|
] }),
|
|
31769
|
-
/* @__PURE__ */
|
|
31793
|
+
/* @__PURE__ */ jsx29(
|
|
31770
31794
|
"textarea",
|
|
31771
31795
|
{
|
|
31772
31796
|
value: instructions,
|
|
@@ -31795,18 +31819,18 @@ function AssistSection({
|
|
|
31795
31819
|
onChange: (e6) => setTone(e6.target.value),
|
|
31796
31820
|
className: "semiont-select",
|
|
31797
31821
|
children: [
|
|
31798
|
-
/* @__PURE__ */
|
|
31822
|
+
/* @__PURE__ */ jsx29("option", { value: "", children: "Default" }),
|
|
31799
31823
|
annotationType === "comment" && /* @__PURE__ */ jsxs22(Fragment4, { children: [
|
|
31800
|
-
/* @__PURE__ */
|
|
31801
|
-
/* @__PURE__ */
|
|
31802
|
-
/* @__PURE__ */
|
|
31803
|
-
/* @__PURE__ */
|
|
31824
|
+
/* @__PURE__ */ jsx29("option", { value: "scholarly", children: t12("toneScholarly") }),
|
|
31825
|
+
/* @__PURE__ */ jsx29("option", { value: "explanatory", children: t12("toneExplanatory") }),
|
|
31826
|
+
/* @__PURE__ */ jsx29("option", { value: "conversational", children: t12("toneConversational") }),
|
|
31827
|
+
/* @__PURE__ */ jsx29("option", { value: "technical", children: t12("toneTechnical") })
|
|
31804
31828
|
] }),
|
|
31805
31829
|
annotationType === "assessment" && /* @__PURE__ */ jsxs22(Fragment4, { children: [
|
|
31806
|
-
/* @__PURE__ */
|
|
31807
|
-
/* @__PURE__ */
|
|
31808
|
-
/* @__PURE__ */
|
|
31809
|
-
/* @__PURE__ */
|
|
31830
|
+
/* @__PURE__ */ jsx29("option", { value: "analytical", children: t12("toneAnalytical") }),
|
|
31831
|
+
/* @__PURE__ */ jsx29("option", { value: "critical", children: t12("toneCritical") }),
|
|
31832
|
+
/* @__PURE__ */ jsx29("option", { value: "balanced", children: t12("toneBalanced") }),
|
|
31833
|
+
/* @__PURE__ */ jsx29("option", { value: "constructive", children: t12("toneConstructive") })
|
|
31810
31834
|
] })
|
|
31811
31835
|
]
|
|
31812
31836
|
}
|
|
@@ -31815,7 +31839,7 @@ function AssistSection({
|
|
|
31815
31839
|
(annotationType === "comment" || annotationType === "assessment" || annotationType === "highlight") && /* @__PURE__ */ jsxs22("div", { className: "semiont-form-field", children: [
|
|
31816
31840
|
/* @__PURE__ */ jsxs22("div", { className: "semiont-form-field__header", children: [
|
|
31817
31841
|
/* @__PURE__ */ jsxs22("label", { className: "semiont-form-field__label semiont-form-field__label--with-checkbox", children: [
|
|
31818
|
-
/* @__PURE__ */
|
|
31842
|
+
/* @__PURE__ */ jsx29(
|
|
31819
31843
|
"input",
|
|
31820
31844
|
{
|
|
31821
31845
|
type: "checkbox",
|
|
@@ -31825,7 +31849,7 @@ function AssistSection({
|
|
|
31825
31849
|
"data-variant": annotationType
|
|
31826
31850
|
}
|
|
31827
31851
|
),
|
|
31828
|
-
/* @__PURE__ */
|
|
31852
|
+
/* @__PURE__ */ jsx29("span", { children: t12("densityLabel") })
|
|
31829
31853
|
] }),
|
|
31830
31854
|
useDensity && /* @__PURE__ */ jsxs22("span", { className: "semiont-form-field__info", children: [
|
|
31831
31855
|
density,
|
|
@@ -31833,7 +31857,7 @@ function AssistSection({
|
|
|
31833
31857
|
] })
|
|
31834
31858
|
] }),
|
|
31835
31859
|
useDensity && /* @__PURE__ */ jsxs22(Fragment4, { children: [
|
|
31836
|
-
/* @__PURE__ */
|
|
31860
|
+
/* @__PURE__ */ jsx29(
|
|
31837
31861
|
"input",
|
|
31838
31862
|
{
|
|
31839
31863
|
type: "range",
|
|
@@ -31845,8 +31869,8 @@ function AssistSection({
|
|
|
31845
31869
|
}
|
|
31846
31870
|
),
|
|
31847
31871
|
/* @__PURE__ */ jsxs22("div", { className: "semiont-slider__labels", children: [
|
|
31848
|
-
/* @__PURE__ */
|
|
31849
|
-
/* @__PURE__ */
|
|
31872
|
+
/* @__PURE__ */ jsx29("span", { children: t12("densitySparse") }),
|
|
31873
|
+
/* @__PURE__ */ jsx29("span", { children: t12("densityDense") })
|
|
31850
31874
|
] })
|
|
31851
31875
|
] })
|
|
31852
31876
|
] }),
|
|
@@ -31858,15 +31882,15 @@ function AssistSection({
|
|
|
31858
31882
|
"data-variant": "assist",
|
|
31859
31883
|
"data-type": annotationType,
|
|
31860
31884
|
children: [
|
|
31861
|
-
/* @__PURE__ */
|
|
31862
|
-
/* @__PURE__ */
|
|
31885
|
+
/* @__PURE__ */ jsx29("span", { className: "semiont-button-icon", children: "\u2728" }),
|
|
31886
|
+
/* @__PURE__ */ jsx29("span", { children: t12("annotate") })
|
|
31863
31887
|
]
|
|
31864
31888
|
}
|
|
31865
31889
|
)
|
|
31866
31890
|
] }),
|
|
31867
31891
|
progress && /* @__PURE__ */ jsxs22("div", { className: "semiont-annotation-progress", "data-type": annotationType, children: [
|
|
31868
31892
|
progress.requestParams && progress.requestParams.length > 0 && /* @__PURE__ */ jsxs22("div", { className: "semiont-annotation-progress__params", "data-type": annotationType, children: [
|
|
31869
|
-
/* @__PURE__ */
|
|
31893
|
+
/* @__PURE__ */ jsx29("div", { className: "semiont-annotation-progress__params-title", children: "Request Parameters:" }),
|
|
31870
31894
|
progress.requestParams.map((param, idx) => /* @__PURE__ */ jsxs22("div", { className: "semiont-annotation-progress__param", children: [
|
|
31871
31895
|
/* @__PURE__ */ jsxs22("span", { className: "semiont-annotation-progress__param-label", children: [
|
|
31872
31896
|
param.label,
|
|
@@ -31878,10 +31902,10 @@ function AssistSection({
|
|
|
31878
31902
|
] }),
|
|
31879
31903
|
/* @__PURE__ */ jsxs22("div", { className: "semiont-annotation-progress__status", children: [
|
|
31880
31904
|
/* @__PURE__ */ jsxs22("div", { className: "semiont-annotation-progress__message", children: [
|
|
31881
|
-
/* @__PURE__ */
|
|
31882
|
-
/* @__PURE__ */
|
|
31905
|
+
/* @__PURE__ */ jsx29("span", { className: "semiont-annotation-progress__icon", children: "\u2728" }),
|
|
31906
|
+
/* @__PURE__ */ jsx29("span", { children: progress.message })
|
|
31883
31907
|
] }),
|
|
31884
|
-
!isAssisting && /* @__PURE__ */
|
|
31908
|
+
!isAssisting && /* @__PURE__ */ jsx29(
|
|
31885
31909
|
"button",
|
|
31886
31910
|
{
|
|
31887
31911
|
onClick: handleDismissProgress,
|
|
@@ -31901,10 +31925,10 @@ function AssistSection({
|
|
|
31901
31925
|
}
|
|
31902
31926
|
|
|
31903
31927
|
// src/components/resource/panels/PanelHeader.tsx
|
|
31904
|
-
import { jsx as
|
|
31928
|
+
import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
31905
31929
|
function PanelHeader({ count: count2, title }) {
|
|
31906
|
-
return /* @__PURE__ */
|
|
31907
|
-
/* @__PURE__ */
|
|
31930
|
+
return /* @__PURE__ */ jsx30("div", { className: "semiont-panel-header", children: /* @__PURE__ */ jsxs23("h2", { className: "semiont-panel-header__title", children: [
|
|
31931
|
+
/* @__PURE__ */ jsx30("span", { className: "semiont-panel-header__text", children: title }),
|
|
31908
31932
|
/* @__PURE__ */ jsxs23("span", { className: "semiont-panel-header__count", children: [
|
|
31909
31933
|
"(",
|
|
31910
31934
|
count2,
|
|
@@ -31914,7 +31938,7 @@ function PanelHeader({ count: count2, title }) {
|
|
|
31914
31938
|
}
|
|
31915
31939
|
|
|
31916
31940
|
// src/components/resource/panels/AssessmentPanel.tsx
|
|
31917
|
-
import { jsx as
|
|
31941
|
+
import { jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
31918
31942
|
function getSelectorDisplayText(selector) {
|
|
31919
31943
|
if (Array.isArray(selector)) {
|
|
31920
31944
|
const quoteSelector = selector.find((s11) => s11.type === "TextQuoteSelector");
|
|
@@ -31929,6 +31953,7 @@ function getSelectorDisplayText(selector) {
|
|
|
31929
31953
|
return null;
|
|
31930
31954
|
}
|
|
31931
31955
|
function AssessmentPanel({
|
|
31956
|
+
session,
|
|
31932
31957
|
resourceId: resourceId2,
|
|
31933
31958
|
annotations,
|
|
31934
31959
|
pendingAnnotation,
|
|
@@ -31942,7 +31967,6 @@ function AssessmentPanel({
|
|
|
31942
31967
|
hoveredAnnotationId
|
|
31943
31968
|
}) {
|
|
31944
31969
|
const t12 = useTranslations("AssessmentPanel");
|
|
31945
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
31946
31970
|
const [newAssessmentText, setNewAssessmentText] = useState25("");
|
|
31947
31971
|
const [focusedAnnotationId, setFocusedAnnotationId] = useState25(null);
|
|
31948
31972
|
const containerRef = useRef19(null);
|
|
@@ -32021,20 +32045,20 @@ function AssessmentPanel({
|
|
|
32021
32045
|
setFocusedAnnotationId(annotationId2);
|
|
32022
32046
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
32023
32047
|
}, []);
|
|
32024
|
-
|
|
32048
|
+
useSessionEventSubscriptions(session, {
|
|
32025
32049
|
"browse:click": handleAnnotationClick2
|
|
32026
32050
|
});
|
|
32027
32051
|
return /* @__PURE__ */ jsxs24("div", { className: "semiont-panel", children: [
|
|
32028
|
-
/* @__PURE__ */
|
|
32052
|
+
/* @__PURE__ */ jsx31(PanelHeader, { annotationType: "assessment", count: annotations.length, title: t12("title") }),
|
|
32029
32053
|
pendingAnnotation && pendingAnnotation.motivation === "assessing" && /* @__PURE__ */ jsxs24("div", { className: "semiont-annotation-prompt", "data-type": "assessment", children: [
|
|
32030
|
-
/* @__PURE__ */
|
|
32054
|
+
/* @__PURE__ */ jsx31("div", { className: "semiont-annotation-prompt__quote", children: (() => {
|
|
32031
32055
|
const displayText = getSelectorDisplayText(pendingAnnotation.selector);
|
|
32032
32056
|
if (displayText) {
|
|
32033
32057
|
return `"${displayText.substring(0, 100)}${displayText.length > 100 ? "..." : ""}"`;
|
|
32034
32058
|
}
|
|
32035
32059
|
return t12("fragmentSelected");
|
|
32036
32060
|
})() }),
|
|
32037
|
-
/* @__PURE__ */
|
|
32061
|
+
/* @__PURE__ */ jsx31(
|
|
32038
32062
|
"textarea",
|
|
32039
32063
|
{
|
|
32040
32064
|
value: newAssessmentText,
|
|
@@ -32052,7 +32076,7 @@ function AssessmentPanel({
|
|
|
32052
32076
|
"/2000"
|
|
32053
32077
|
] }),
|
|
32054
32078
|
/* @__PURE__ */ jsxs24("div", { className: "semiont-annotation-prompt__actions", children: [
|
|
32055
|
-
/* @__PURE__ */
|
|
32079
|
+
/* @__PURE__ */ jsx31(
|
|
32056
32080
|
"button",
|
|
32057
32081
|
{
|
|
32058
32082
|
onClick: () => {
|
|
@@ -32064,7 +32088,7 @@ function AssessmentPanel({
|
|
|
32064
32088
|
children: t12("cancel")
|
|
32065
32089
|
}
|
|
32066
32090
|
),
|
|
32067
|
-
/* @__PURE__ */
|
|
32091
|
+
/* @__PURE__ */ jsx31(
|
|
32068
32092
|
"button",
|
|
32069
32093
|
{
|
|
32070
32094
|
onClick: handleSaveNewAssessment,
|
|
@@ -32077,9 +32101,10 @@ function AssessmentPanel({
|
|
|
32077
32101
|
] })
|
|
32078
32102
|
] }),
|
|
32079
32103
|
/* @__PURE__ */ jsxs24("div", { ref: containerRef, className: "semiont-panel__content", children: [
|
|
32080
|
-
annotateMode && /* @__PURE__ */
|
|
32104
|
+
annotateMode && /* @__PURE__ */ jsx31(
|
|
32081
32105
|
AssistSection,
|
|
32082
32106
|
{
|
|
32107
|
+
session,
|
|
32083
32108
|
annotationType: "assessment",
|
|
32084
32109
|
isAssisting,
|
|
32085
32110
|
locale,
|
|
@@ -32087,9 +32112,10 @@ function AssessmentPanel({
|
|
|
32087
32112
|
progress
|
|
32088
32113
|
}
|
|
32089
32114
|
),
|
|
32090
|
-
/* @__PURE__ */
|
|
32115
|
+
/* @__PURE__ */ jsx31("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx31("p", { className: "semiont-panel__empty", children: t12("noAssessments") }) : sortedAnnotations.map((assessment) => /* @__PURE__ */ jsx31(
|
|
32091
32116
|
AssessmentEntry,
|
|
32092
32117
|
{
|
|
32118
|
+
session,
|
|
32093
32119
|
assessment,
|
|
32094
32120
|
isFocused: assessment.id === focusedAnnotationId,
|
|
32095
32121
|
isHovered: assessment.id === hoveredAnnotationId,
|
|
@@ -32102,7 +32128,7 @@ function AssessmentPanel({
|
|
|
32102
32128
|
}
|
|
32103
32129
|
|
|
32104
32130
|
// src/components/resource/panels/CollaborationPanel.tsx
|
|
32105
|
-
import { jsx as
|
|
32131
|
+
import { jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
32106
32132
|
function CollaborationPanel({
|
|
32107
32133
|
state,
|
|
32108
32134
|
eventCount,
|
|
@@ -32138,20 +32164,20 @@ function CollaborationPanel({
|
|
|
32138
32164
|
}
|
|
32139
32165
|
}
|
|
32140
32166
|
return /* @__PURE__ */ jsxs25("div", { className: "semiont-collaboration-panel", children: [
|
|
32141
|
-
/* @__PURE__ */
|
|
32142
|
-
knowledgeBaseName && /* @__PURE__ */
|
|
32167
|
+
/* @__PURE__ */ jsx32("h3", { className: "semiont-collaboration-panel__title", children: t12("title") }),
|
|
32168
|
+
knowledgeBaseName && /* @__PURE__ */ jsx32("div", { style: { padding: "0 0.75rem 0.5rem", fontSize: "0.8rem", color: "var(--semiont-color-neutral-400)" }, children: knowledgeBaseName }),
|
|
32143
32169
|
/* @__PURE__ */ jsxs25("div", { className: "semiont-collaboration-panel__section", children: [
|
|
32144
|
-
/* @__PURE__ */
|
|
32170
|
+
/* @__PURE__ */ jsx32("h3", { className: "semiont-collaboration-panel__heading", children: t12("connectionStatus") }),
|
|
32145
32171
|
/* @__PURE__ */ jsxs25("div", { className: "semiont-collaboration-panel__status", children: [
|
|
32146
32172
|
/* @__PURE__ */ jsxs25("span", { className: "semiont-collaboration-panel__indicator", children: [
|
|
32147
|
-
/* @__PURE__ */
|
|
32173
|
+
/* @__PURE__ */ jsx32(
|
|
32148
32174
|
"span",
|
|
32149
32175
|
{
|
|
32150
32176
|
className: "semiont-collaboration-panel__dot",
|
|
32151
32177
|
"data-connected": isHealthy ? "true" : "false"
|
|
32152
32178
|
}
|
|
32153
32179
|
),
|
|
32154
|
-
/* @__PURE__ */
|
|
32180
|
+
/* @__PURE__ */ jsx32(
|
|
32155
32181
|
"span",
|
|
32156
32182
|
{
|
|
32157
32183
|
className: "semiont-collaboration-panel__status-text",
|
|
@@ -32168,16 +32194,16 @@ function CollaborationPanel({
|
|
|
32168
32194
|
] }),
|
|
32169
32195
|
/* @__PURE__ */ jsxs25("div", { className: "semiont-collaboration-panel__details", children: [
|
|
32170
32196
|
/* @__PURE__ */ jsxs25("div", { children: [
|
|
32171
|
-
/* @__PURE__ */
|
|
32197
|
+
/* @__PURE__ */ jsx32("span", { className: "semiont-collaboration-panel__label", children: t12("lastSync") }),
|
|
32172
32198
|
" ",
|
|
32173
32199
|
lastSyncText
|
|
32174
32200
|
] }),
|
|
32175
|
-
/* @__PURE__ */
|
|
32201
|
+
/* @__PURE__ */ jsx32("div", { children: isHealthy ? t12("realtimeActive") : t12("reconnecting") })
|
|
32176
32202
|
] })
|
|
32177
32203
|
] }),
|
|
32178
32204
|
/* @__PURE__ */ jsxs25("div", { className: "semiont-collaboration-panel__section semiont-collaboration-panel__section--bordered", children: [
|
|
32179
|
-
/* @__PURE__ */
|
|
32180
|
-
/* @__PURE__ */
|
|
32205
|
+
/* @__PURE__ */ jsx32("h3", { className: "semiont-collaboration-panel__heading", children: t12("sharing") }),
|
|
32206
|
+
/* @__PURE__ */ jsx32("p", { className: "semiont-collaboration-panel__description", children: t12("collaborationComingSoon") })
|
|
32181
32207
|
] })
|
|
32182
32208
|
] });
|
|
32183
32209
|
}
|
|
@@ -32185,7 +32211,7 @@ function CollaborationPanel({
|
|
|
32185
32211
|
// src/components/resource/panels/CommentEntry.tsx
|
|
32186
32212
|
import { useState as useState26, useEffect as useEffect30, useRef as useRef20, useImperativeHandle } from "react";
|
|
32187
32213
|
import { getAnnotationExactText as getAnnotationExactText2, getCommentText } from "@semiont/core";
|
|
32188
|
-
import { jsx as
|
|
32214
|
+
import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
32189
32215
|
function formatRelativeTime3(isoString) {
|
|
32190
32216
|
const date = new Date(isoString);
|
|
32191
32217
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -32201,6 +32227,7 @@ function formatRelativeTime3(isoString) {
|
|
|
32201
32227
|
return date.toLocaleDateString();
|
|
32202
32228
|
}
|
|
32203
32229
|
function CommentEntry({
|
|
32230
|
+
session,
|
|
32204
32231
|
comment: comment2,
|
|
32205
32232
|
isFocused,
|
|
32206
32233
|
isHovered = false,
|
|
@@ -32208,8 +32235,7 @@ function CommentEntry({
|
|
|
32208
32235
|
ref
|
|
32209
32236
|
}) {
|
|
32210
32237
|
const t12 = useTranslations("CommentsPanel");
|
|
32211
|
-
const
|
|
32212
|
-
const hoverProps = useHoverEmitter(comment2.id);
|
|
32238
|
+
const hoverProps = useHoverEmitter(session, comment2.id);
|
|
32213
32239
|
const [isEditing, setIsEditing] = useState26(false);
|
|
32214
32240
|
const [editText, setEditText] = useState26("");
|
|
32215
32241
|
const internalRef = useRef20(null);
|
|
@@ -32254,7 +32280,7 @@ function CommentEntry({
|
|
|
32254
32280
|
'"'
|
|
32255
32281
|
] }),
|
|
32256
32282
|
isEditing ? /* @__PURE__ */ jsxs26("div", { className: "semiont-annotation-entry__edit", onClick: (e6) => e6.stopPropagation(), children: [
|
|
32257
|
-
/* @__PURE__ */
|
|
32283
|
+
/* @__PURE__ */ jsx33(
|
|
32258
32284
|
"textarea",
|
|
32259
32285
|
{
|
|
32260
32286
|
value: editText,
|
|
@@ -32271,7 +32297,7 @@ function CommentEntry({
|
|
|
32271
32297
|
"/2000"
|
|
32272
32298
|
] }),
|
|
32273
32299
|
/* @__PURE__ */ jsxs26("div", { className: "semiont-annotation-entry__button-group", children: [
|
|
32274
|
-
/* @__PURE__ */
|
|
32300
|
+
/* @__PURE__ */ jsx33(
|
|
32275
32301
|
"button",
|
|
32276
32302
|
{
|
|
32277
32303
|
onClick: handleSave,
|
|
@@ -32280,7 +32306,7 @@ function CommentEntry({
|
|
|
32280
32306
|
children: t12("save")
|
|
32281
32307
|
}
|
|
32282
32308
|
),
|
|
32283
|
-
/* @__PURE__ */
|
|
32309
|
+
/* @__PURE__ */ jsx33(
|
|
32284
32310
|
"button",
|
|
32285
32311
|
{
|
|
32286
32312
|
onClick: handleCancel,
|
|
@@ -32290,7 +32316,7 @@ function CommentEntry({
|
|
|
32290
32316
|
)
|
|
32291
32317
|
] })
|
|
32292
32318
|
] })
|
|
32293
|
-
] }) : /* @__PURE__ */
|
|
32319
|
+
] }) : /* @__PURE__ */ jsx33("div", { className: "semiont-annotation-entry__body", children: commentText }),
|
|
32294
32320
|
!isEditing && /* @__PURE__ */ jsxs26("div", { className: "semiont-annotation-entry__footer", children: [
|
|
32295
32321
|
/* @__PURE__ */ jsxs26("div", { className: "semiont-annotation-entry__metadata", children: [
|
|
32296
32322
|
"By ",
|
|
@@ -32302,7 +32328,7 @@ function CommentEntry({
|
|
|
32302
32328
|
"Via ",
|
|
32303
32329
|
Array.isArray(comment2.generator) ? comment2.generator.map(renderAgentLabel).join(", ") : renderAgentLabel(comment2.generator)
|
|
32304
32330
|
] }),
|
|
32305
|
-
annotateMode && /* @__PURE__ */
|
|
32331
|
+
annotateMode && /* @__PURE__ */ jsx33("div", { className: "semiont-annotation-entry__actions", onClick: (e6) => e6.stopPropagation(), children: /* @__PURE__ */ jsx33(
|
|
32306
32332
|
"button",
|
|
32307
32333
|
{
|
|
32308
32334
|
onClick: handleEditClick,
|
|
@@ -32320,7 +32346,7 @@ function CommentEntry({
|
|
|
32320
32346
|
// src/components/resource/panels/CommentsPanel.tsx
|
|
32321
32347
|
import { useState as useState27, useEffect as useEffect31, useRef as useRef21, useCallback as useCallback22, useMemo as useMemo9 } from "react";
|
|
32322
32348
|
import { getTextPositionSelector as getTextPositionSelector4, getTargetSelector as getTargetSelector6 } from "@semiont/core";
|
|
32323
|
-
import { jsx as
|
|
32349
|
+
import { jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
32324
32350
|
function getSelectorDisplayText2(selector) {
|
|
32325
32351
|
if (Array.isArray(selector)) {
|
|
32326
32352
|
const quoteSelector = selector.find((s11) => s11.type === "TextQuoteSelector");
|
|
@@ -32335,6 +32361,7 @@ function getSelectorDisplayText2(selector) {
|
|
|
32335
32361
|
return null;
|
|
32336
32362
|
}
|
|
32337
32363
|
function CommentsPanel({
|
|
32364
|
+
session,
|
|
32338
32365
|
resourceId: resourceId2,
|
|
32339
32366
|
annotations,
|
|
32340
32367
|
pendingAnnotation,
|
|
@@ -32348,7 +32375,6 @@ function CommentsPanel({
|
|
|
32348
32375
|
hoveredAnnotationId
|
|
32349
32376
|
}) {
|
|
32350
32377
|
const t12 = useTranslations("CommentsPanel");
|
|
32351
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
32352
32378
|
const [newCommentText, setNewCommentText] = useState27("");
|
|
32353
32379
|
const [focusedAnnotationId, setFocusedAnnotationId] = useState27(null);
|
|
32354
32380
|
const containerRef = useRef21(null);
|
|
@@ -32405,7 +32431,7 @@ function CommentsPanel({
|
|
|
32405
32431
|
setFocusedAnnotationId(annotationId2);
|
|
32406
32432
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
32407
32433
|
}, []);
|
|
32408
|
-
|
|
32434
|
+
useSessionEventSubscriptions(session, {
|
|
32409
32435
|
"browse:click": handleAnnotationClick2
|
|
32410
32436
|
});
|
|
32411
32437
|
const handleSaveNewComment = () => {
|
|
@@ -32431,16 +32457,16 @@ function CommentsPanel({
|
|
|
32431
32457
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
32432
32458
|
}, [pendingAnnotation, session]);
|
|
32433
32459
|
return /* @__PURE__ */ jsxs27("div", { className: "semiont-panel", children: [
|
|
32434
|
-
/* @__PURE__ */
|
|
32460
|
+
/* @__PURE__ */ jsx34(PanelHeader, { annotationType: "comment", count: annotations.length, title: t12("title") }),
|
|
32435
32461
|
pendingAnnotation && pendingAnnotation.motivation === "commenting" && /* @__PURE__ */ jsxs27("div", { className: "semiont-annotation-prompt", "data-type": "comment", children: [
|
|
32436
|
-
/* @__PURE__ */
|
|
32462
|
+
/* @__PURE__ */ jsx34("div", { className: "semiont-annotation-prompt__quote", children: (() => {
|
|
32437
32463
|
const displayText = getSelectorDisplayText2(pendingAnnotation.selector);
|
|
32438
32464
|
if (displayText) {
|
|
32439
32465
|
return `"${displayText.substring(0, 100)}${displayText.length > 100 ? "..." : ""}"`;
|
|
32440
32466
|
}
|
|
32441
32467
|
return t12("fragmentSelected");
|
|
32442
32468
|
})() }),
|
|
32443
|
-
/* @__PURE__ */
|
|
32469
|
+
/* @__PURE__ */ jsx34(
|
|
32444
32470
|
"textarea",
|
|
32445
32471
|
{
|
|
32446
32472
|
value: newCommentText,
|
|
@@ -32458,7 +32484,7 @@ function CommentsPanel({
|
|
|
32458
32484
|
"/2000"
|
|
32459
32485
|
] }),
|
|
32460
32486
|
/* @__PURE__ */ jsxs27("div", { className: "semiont-annotation-prompt__actions", children: [
|
|
32461
|
-
/* @__PURE__ */
|
|
32487
|
+
/* @__PURE__ */ jsx34(
|
|
32462
32488
|
"button",
|
|
32463
32489
|
{
|
|
32464
32490
|
onClick: () => {
|
|
@@ -32470,7 +32496,7 @@ function CommentsPanel({
|
|
|
32470
32496
|
children: t12("cancel")
|
|
32471
32497
|
}
|
|
32472
32498
|
),
|
|
32473
|
-
/* @__PURE__ */
|
|
32499
|
+
/* @__PURE__ */ jsx34(
|
|
32474
32500
|
"button",
|
|
32475
32501
|
{
|
|
32476
32502
|
onClick: handleSaveNewComment,
|
|
@@ -32484,9 +32510,10 @@ function CommentsPanel({
|
|
|
32484
32510
|
] })
|
|
32485
32511
|
] }),
|
|
32486
32512
|
/* @__PURE__ */ jsxs27("div", { ref: containerRef, className: "semiont-panel__content", children: [
|
|
32487
|
-
annotateMode && /* @__PURE__ */
|
|
32513
|
+
annotateMode && /* @__PURE__ */ jsx34(
|
|
32488
32514
|
AssistSection,
|
|
32489
32515
|
{
|
|
32516
|
+
session,
|
|
32490
32517
|
annotationType: "comment",
|
|
32491
32518
|
isAssisting,
|
|
32492
32519
|
locale,
|
|
@@ -32494,9 +32521,10 @@ function CommentsPanel({
|
|
|
32494
32521
|
progress
|
|
32495
32522
|
}
|
|
32496
32523
|
),
|
|
32497
|
-
/* @__PURE__ */
|
|
32524
|
+
/* @__PURE__ */ jsx34("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx34("p", { className: "semiont-panel__empty", children: t12("noComments") }) : sortedAnnotations.map((comment2) => /* @__PURE__ */ jsx34(
|
|
32498
32525
|
CommentEntry,
|
|
32499
32526
|
{
|
|
32527
|
+
session,
|
|
32500
32528
|
comment: comment2,
|
|
32501
32529
|
isFocused: comment2.id === focusedAnnotationId,
|
|
32502
32530
|
isHovered: comment2.id === hoveredAnnotationId,
|
|
@@ -32527,13 +32555,13 @@ function formatRelativeTime4(isoString) {
|
|
|
32527
32555
|
return date.toLocaleDateString();
|
|
32528
32556
|
}
|
|
32529
32557
|
function HighlightEntry({
|
|
32558
|
+
session,
|
|
32530
32559
|
highlight,
|
|
32531
32560
|
isFocused,
|
|
32532
32561
|
isHovered = false,
|
|
32533
32562
|
ref
|
|
32534
32563
|
}) {
|
|
32535
|
-
const
|
|
32536
|
-
const hoverProps = useHoverEmitter(highlight.id);
|
|
32564
|
+
const hoverProps = useHoverEmitter(session, highlight.id);
|
|
32537
32565
|
const selectedText = getAnnotationExactText3(highlight);
|
|
32538
32566
|
return /* @__PURE__ */ jsxs28(
|
|
32539
32567
|
"div",
|
|
@@ -32571,8 +32599,9 @@ function HighlightEntry({
|
|
|
32571
32599
|
// src/components/resource/panels/HighlightPanel.tsx
|
|
32572
32600
|
import { useEffect as useEffect32, useState as useState28, useRef as useRef22, useCallback as useCallback23, useMemo as useMemo10 } from "react";
|
|
32573
32601
|
import { getTextPositionSelector as getTextPositionSelector5, getTargetSelector as getTargetSelector7 } from "@semiont/core";
|
|
32574
|
-
import { jsx as
|
|
32602
|
+
import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
32575
32603
|
function HighlightPanel({
|
|
32604
|
+
session,
|
|
32576
32605
|
resourceId: resourceId2,
|
|
32577
32606
|
annotations,
|
|
32578
32607
|
pendingAnnotation,
|
|
@@ -32585,7 +32614,6 @@ function HighlightPanel({
|
|
|
32585
32614
|
sourceLanguage
|
|
32586
32615
|
}) {
|
|
32587
32616
|
const t12 = useTranslations("HighlightPanel");
|
|
32588
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
32589
32617
|
const [focusedAnnotationId, setFocusedAnnotationId] = useState28(null);
|
|
32590
32618
|
const containerRef = useRef22(null);
|
|
32591
32619
|
const entryRefs = useRef22(/* @__PURE__ */ new Map());
|
|
@@ -32639,7 +32667,7 @@ function HighlightPanel({
|
|
|
32639
32667
|
setFocusedAnnotationId(annotationId2);
|
|
32640
32668
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
32641
32669
|
}, []);
|
|
32642
|
-
|
|
32670
|
+
useSessionEventSubscriptions(session, {
|
|
32643
32671
|
"browse:click": handleAnnotationClick2
|
|
32644
32672
|
});
|
|
32645
32673
|
useEffect32(() => {
|
|
@@ -32652,20 +32680,22 @@ function HighlightPanel({
|
|
|
32652
32680
|
}
|
|
32653
32681
|
}, [pendingAnnotation, session]);
|
|
32654
32682
|
return /* @__PURE__ */ jsxs29("div", { className: "semiont-panel", children: [
|
|
32655
|
-
/* @__PURE__ */
|
|
32683
|
+
/* @__PURE__ */ jsx35(PanelHeader, { annotationType: "highlight", count: annotations.length, title: t12("title") }),
|
|
32656
32684
|
/* @__PURE__ */ jsxs29("div", { ref: containerRef, className: "semiont-panel__content", children: [
|
|
32657
|
-
annotateMode && /* @__PURE__ */
|
|
32685
|
+
annotateMode && /* @__PURE__ */ jsx35(
|
|
32658
32686
|
AssistSection,
|
|
32659
32687
|
{
|
|
32688
|
+
session,
|
|
32660
32689
|
annotationType: "highlight",
|
|
32661
32690
|
isAssisting,
|
|
32662
32691
|
progress,
|
|
32663
32692
|
sourceLanguage
|
|
32664
32693
|
}
|
|
32665
32694
|
),
|
|
32666
|
-
/* @__PURE__ */
|
|
32695
|
+
/* @__PURE__ */ jsx35("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx35("p", { className: "semiont-panel__empty", children: t12("noHighlights") }) : sortedAnnotations.map((highlight) => /* @__PURE__ */ jsx35(
|
|
32667
32696
|
HighlightEntry,
|
|
32668
32697
|
{
|
|
32698
|
+
session,
|
|
32669
32699
|
highlight,
|
|
32670
32700
|
isFocused: highlight.id === focusedAnnotationId,
|
|
32671
32701
|
isHovered: highlight.id === hoveredAnnotationId,
|
|
@@ -32712,7 +32742,7 @@ function useResourceGraph(id2) {
|
|
|
32712
32742
|
}
|
|
32713
32743
|
|
|
32714
32744
|
// src/components/resource/panels/JsonLdPanel.tsx
|
|
32715
|
-
import { jsx as
|
|
32745
|
+
import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
32716
32746
|
function JsonLdPanel({ resourceId: resourceId2 }) {
|
|
32717
32747
|
const editorRef = useRef23(null);
|
|
32718
32748
|
const viewRef = useRef23(null);
|
|
@@ -32760,8 +32790,8 @@ function JsonLdPanel({ resourceId: resourceId2 }) {
|
|
|
32760
32790
|
};
|
|
32761
32791
|
return /* @__PURE__ */ jsxs30("div", { className: "semiont-jsonld-panel", children: [
|
|
32762
32792
|
/* @__PURE__ */ jsxs30("div", { className: "semiont-jsonld-panel__header", children: [
|
|
32763
|
-
/* @__PURE__ */
|
|
32764
|
-
/* @__PURE__ */
|
|
32793
|
+
/* @__PURE__ */ jsx36("h3", { className: "semiont-jsonld-panel__title", children: "JSON-LD" }),
|
|
32794
|
+
/* @__PURE__ */ jsx36(
|
|
32765
32795
|
"button",
|
|
32766
32796
|
{
|
|
32767
32797
|
onClick: handleCopyToClipboard,
|
|
@@ -32772,9 +32802,9 @@ function JsonLdPanel({ resourceId: resourceId2 }) {
|
|
|
32772
32802
|
}
|
|
32773
32803
|
)
|
|
32774
32804
|
] }),
|
|
32775
|
-
loading && /* @__PURE__ */
|
|
32776
|
-
error && !loading && /* @__PURE__ */
|
|
32777
|
-
/* @__PURE__ */
|
|
32805
|
+
loading && /* @__PURE__ */ jsx36("p", { className: "semiont-jsonld-panel__status", role: "status", children: "Loading JSON-LD\u2026" }),
|
|
32806
|
+
error && !loading && /* @__PURE__ */ jsx36("p", { className: "semiont-jsonld-panel__status semiont-jsonld-panel__status--error", role: "alert", children: "Failed to load JSON-LD." }),
|
|
32807
|
+
/* @__PURE__ */ jsx36(
|
|
32778
32808
|
"div",
|
|
32779
32809
|
{
|
|
32780
32810
|
ref: editorRef,
|
|
@@ -32833,21 +32863,20 @@ function getTagSchemaId(annotation) {
|
|
|
32833
32863
|
}
|
|
32834
32864
|
|
|
32835
32865
|
// src/components/resource/panels/ReferenceEntry.tsx
|
|
32836
|
-
import { jsx as
|
|
32866
|
+
import { jsx as jsx37, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
32837
32867
|
function ReferenceEntry({
|
|
32868
|
+
session,
|
|
32838
32869
|
reference,
|
|
32839
32870
|
isFocused,
|
|
32840
32871
|
isHovered = false,
|
|
32841
|
-
|
|
32872
|
+
onOpenResource,
|
|
32842
32873
|
annotateMode = true,
|
|
32843
32874
|
isGenerating = false,
|
|
32844
32875
|
ref
|
|
32845
32876
|
}) {
|
|
32846
32877
|
const t12 = useTranslations("ReferencesPanel");
|
|
32847
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
32848
32878
|
const semiont = session?.client;
|
|
32849
|
-
const
|
|
32850
|
-
const hoverProps = useHoverEmitter(reference.id);
|
|
32879
|
+
const hoverProps = useHoverEmitter(session, reference.id);
|
|
32851
32880
|
const selectedText = getAnnotationExactText4(reference) || "";
|
|
32852
32881
|
const isResolved = isBodyResolved2(reference.body);
|
|
32853
32882
|
const resolvedResourceUri = isResolved ? getBodySource6(reference.body) : null;
|
|
@@ -32862,7 +32891,7 @@ function ReferenceEntry({
|
|
|
32862
32891
|
const resourceIcon = getResourceIcon(resolvedDocumentMediaType);
|
|
32863
32892
|
const handleOpen = () => {
|
|
32864
32893
|
if (resolvedResourceUri) {
|
|
32865
|
-
|
|
32894
|
+
onOpenResource?.(resolvedResourceUri);
|
|
32866
32895
|
}
|
|
32867
32896
|
};
|
|
32868
32897
|
const source = typeof reference.target === "object" && "source" in reference.target ? reference.target.source : "";
|
|
@@ -32907,7 +32936,7 @@ function ReferenceEntry({
|
|
|
32907
32936
|
children: [
|
|
32908
32937
|
/* @__PURE__ */ jsxs31("div", { className: "semiont-annotation-entry__header", children: [
|
|
32909
32938
|
/* @__PURE__ */ jsxs31("div", { className: "semiont-reference-icon-group", children: [
|
|
32910
|
-
/* @__PURE__ */
|
|
32939
|
+
/* @__PURE__ */ jsx37(
|
|
32911
32940
|
"button",
|
|
32912
32941
|
{
|
|
32913
32942
|
className: `semiont-reference-icon${iconIsClickable ? " semiont-reference-icon--clickable" : ""}`,
|
|
@@ -32918,7 +32947,7 @@ function ReferenceEntry({
|
|
|
32918
32947
|
children: isResolved ? "\u{1F517}" : "\u2753"
|
|
32919
32948
|
}
|
|
32920
32949
|
),
|
|
32921
|
-
annotateMode && isResolved && /* @__PURE__ */
|
|
32950
|
+
annotateMode && isResolved && /* @__PURE__ */ jsx37(
|
|
32922
32951
|
"button",
|
|
32923
32952
|
{
|
|
32924
32953
|
className: "semiont-reference-unlink",
|
|
@@ -32938,8 +32967,8 @@ function ReferenceEntry({
|
|
|
32938
32967
|
selectedText.length > 100 ? "..." : "",
|
|
32939
32968
|
'"'
|
|
32940
32969
|
] }),
|
|
32941
|
-
!selectedText && /* @__PURE__ */
|
|
32942
|
-
resolvedDocumentName && /* @__PURE__ */
|
|
32970
|
+
!selectedText && /* @__PURE__ */ jsx37("div", { className: "semiont-annotation-entry__meta", children: annotationType }),
|
|
32971
|
+
resolvedDocumentName && /* @__PURE__ */ jsx37("div", { className: "semiont-reference-link", children: /* @__PURE__ */ jsxs31("span", { children: [
|
|
32943
32972
|
"\u2192 ",
|
|
32944
32973
|
resourceIcon,
|
|
32945
32974
|
" ",
|
|
@@ -32947,7 +32976,7 @@ function ReferenceEntry({
|
|
|
32947
32976
|
] }) })
|
|
32948
32977
|
] })
|
|
32949
32978
|
] }),
|
|
32950
|
-
entityTypes.length > 0 && /* @__PURE__ */
|
|
32979
|
+
entityTypes.length > 0 && /* @__PURE__ */ jsx37("div", { className: "semiont-annotation-entry__tags", children: entityTypes.map((type, index) => /* @__PURE__ */ jsx37(
|
|
32951
32980
|
"span",
|
|
32952
32981
|
{
|
|
32953
32982
|
className: "semiont-tag",
|
|
@@ -32968,7 +32997,7 @@ function ReferenceEntry({
|
|
|
32968
32997
|
// src/components/resource/panels/ReferencesPanel.tsx
|
|
32969
32998
|
import { useState as useState30, useRef as useRef24, useEffect as useEffect35, useCallback as useCallback24, useMemo as useMemo11 } from "react";
|
|
32970
32999
|
import { getTextPositionSelector as getTextPositionSelector6, getTargetSelector as getTargetSelector9 } from "@semiont/core";
|
|
32971
|
-
import { Fragment as Fragment5, jsx as
|
|
33000
|
+
import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
32972
33001
|
function getSelectorDisplayText3(selector) {
|
|
32973
33002
|
if (Array.isArray(selector)) {
|
|
32974
33003
|
const quoteSelector = selector.find((s11) => s11.type === "TextQuoteSelector");
|
|
@@ -32983,6 +33012,8 @@ function getSelectorDisplayText3(selector) {
|
|
|
32983
33012
|
return null;
|
|
32984
33013
|
}
|
|
32985
33014
|
function ReferencesPanel({
|
|
33015
|
+
session,
|
|
33016
|
+
onOpenResource,
|
|
32986
33017
|
resourceId: resourceId2,
|
|
32987
33018
|
annotations = [],
|
|
32988
33019
|
isAssisting,
|
|
@@ -33002,7 +33033,6 @@ function ReferencesPanel({
|
|
|
33002
33033
|
sourceLanguage
|
|
33003
33034
|
}) {
|
|
33004
33035
|
const t12 = useTranslations("ReferencesPanel");
|
|
33005
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
33006
33036
|
const [selectedEntityTypes, setSelectedEntityTypes] = useState30([]);
|
|
33007
33037
|
const [lastAnnotationLog, setLastDetectionLog] = useState30(null);
|
|
33008
33038
|
const [pendingEntityTypes, setPendingEntityTypes] = useState30([]);
|
|
@@ -33073,7 +33103,7 @@ function ReferencesPanel({
|
|
|
33073
33103
|
setFocusedAnnotationId(annotationId2);
|
|
33074
33104
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
33075
33105
|
}, []);
|
|
33076
|
-
|
|
33106
|
+
useSessionEventSubscriptions(session, {
|
|
33077
33107
|
"browse:click": handleAnnotationClick2
|
|
33078
33108
|
});
|
|
33079
33109
|
const handleAssist = () => {
|
|
@@ -33128,9 +33158,9 @@ function ReferencesPanel({
|
|
|
33128
33158
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
33129
33159
|
}, [pendingAnnotation, session]);
|
|
33130
33160
|
return /* @__PURE__ */ jsxs32("div", { className: "semiont-panel", children: [
|
|
33131
|
-
/* @__PURE__ */
|
|
33161
|
+
/* @__PURE__ */ jsx38(PanelHeader, { annotationType: "reference", count: annotations.length, title: t12("title") }),
|
|
33132
33162
|
pendingAnnotation && pendingAnnotation.motivation === "linking" && /* @__PURE__ */ jsxs32("div", { className: "semiont-annotation-prompt", "data-type": "reference", children: [
|
|
33133
|
-
/* @__PURE__ */
|
|
33163
|
+
/* @__PURE__ */ jsx38("div", { className: "semiont-annotation-prompt__quote", children: (() => {
|
|
33134
33164
|
const displayText = getSelectorDisplayText3(pendingAnnotation.selector);
|
|
33135
33165
|
if (displayText) {
|
|
33136
33166
|
return `"${displayText.substring(0, 100)}${displayText.length > 100 ? "..." : ""}"`;
|
|
@@ -33138,8 +33168,8 @@ function ReferencesPanel({
|
|
|
33138
33168
|
return t12("fragmentSelected");
|
|
33139
33169
|
})() }),
|
|
33140
33170
|
allEntityTypes.length > 0 && /* @__PURE__ */ jsxs32("div", { className: "semiont-form-field", children: [
|
|
33141
|
-
/* @__PURE__ */
|
|
33142
|
-
/* @__PURE__ */
|
|
33171
|
+
/* @__PURE__ */ jsx38("p", { className: "semiont-form-field__label", children: t12("entityTypesOptional") }),
|
|
33172
|
+
/* @__PURE__ */ jsx38("div", { className: "semiont-tag-selector", children: allEntityTypes.map((type) => /* @__PURE__ */ jsx38(
|
|
33143
33173
|
"button",
|
|
33144
33174
|
{
|
|
33145
33175
|
onClick: () => togglePendingEntityType(type),
|
|
@@ -33150,8 +33180,8 @@ function ReferencesPanel({
|
|
|
33150
33180
|
type
|
|
33151
33181
|
)) })
|
|
33152
33182
|
] }),
|
|
33153
|
-
/* @__PURE__ */
|
|
33154
|
-
/* @__PURE__ */
|
|
33183
|
+
/* @__PURE__ */ jsx38("div", { className: "semiont-annotation-prompt__footer", children: /* @__PURE__ */ jsxs32("div", { className: "semiont-annotation-prompt__actions", children: [
|
|
33184
|
+
/* @__PURE__ */ jsx38(
|
|
33155
33185
|
"button",
|
|
33156
33186
|
{
|
|
33157
33187
|
onClick: () => {
|
|
@@ -33187,24 +33217,24 @@ function ReferencesPanel({
|
|
|
33187
33217
|
"aria-expanded": isAssistExpanded,
|
|
33188
33218
|
type: "button",
|
|
33189
33219
|
children: [
|
|
33190
|
-
/* @__PURE__ */
|
|
33191
|
-
/* @__PURE__ */
|
|
33220
|
+
/* @__PURE__ */ jsx38("span", { children: t12("annotateReferences") }),
|
|
33221
|
+
/* @__PURE__ */ jsx38("span", { className: "semiont-panel__section-chevron", "data-expanded": isAssistExpanded, children: "\u203A" })
|
|
33192
33222
|
]
|
|
33193
33223
|
}
|
|
33194
33224
|
),
|
|
33195
33225
|
isAssistExpanded && /* @__PURE__ */ jsxs32(Fragment5, { children: [
|
|
33196
|
-
!isAssisting && /* @__PURE__ */
|
|
33197
|
-
lastAnnotationLog && lastAnnotationLog.length > 0 && /* @__PURE__ */
|
|
33198
|
-
/* @__PURE__ */
|
|
33226
|
+
!isAssisting && /* @__PURE__ */ jsx38("div", { className: "semiont-assist-widget", "data-type": "reference", children: /* @__PURE__ */ jsxs32(Fragment5, { children: [
|
|
33227
|
+
lastAnnotationLog && lastAnnotationLog.length > 0 && /* @__PURE__ */ jsx38("div", { className: "semiont-assist-widget__log", children: /* @__PURE__ */ jsx38("div", { className: "semiont-assist-widget__log-items", children: lastAnnotationLog.map((item, index) => /* @__PURE__ */ jsxs32("div", { className: "semiont-assist-widget__log-item", children: [
|
|
33228
|
+
/* @__PURE__ */ jsx38("span", { className: "semiont-assist-widget__log-check", children: "\u2713" }),
|
|
33199
33229
|
/* @__PURE__ */ jsxs32("span", { className: "semiont-assist-widget__log-type", children: [
|
|
33200
33230
|
item.entityType,
|
|
33201
33231
|
":"
|
|
33202
33232
|
] }),
|
|
33203
|
-
/* @__PURE__ */
|
|
33233
|
+
/* @__PURE__ */ jsx38("span", { children: t12("found", { count: item.foundCount }) })
|
|
33204
33234
|
] }, index)) }) }),
|
|
33205
33235
|
/* @__PURE__ */ jsxs32("div", { className: "semiont-assist-widget__entity-types", children: [
|
|
33206
|
-
/* @__PURE__ */
|
|
33207
|
-
/* @__PURE__ */
|
|
33236
|
+
/* @__PURE__ */ jsx38("p", { className: "semiont-assist-widget__label", children: t12("selectEntityTypes") }),
|
|
33237
|
+
/* @__PURE__ */ jsx38("div", { className: "semiont-assist-widget__chips", children: allEntityTypes.length > 0 ? allEntityTypes.map((type) => /* @__PURE__ */ jsx38(
|
|
33208
33238
|
"button",
|
|
33209
33239
|
{
|
|
33210
33240
|
onClick: () => {
|
|
@@ -33219,12 +33249,12 @@ function ReferencesPanel({
|
|
|
33219
33249
|
children: type
|
|
33220
33250
|
},
|
|
33221
33251
|
type
|
|
33222
|
-
)) : /* @__PURE__ */
|
|
33252
|
+
)) : /* @__PURE__ */ jsx38("p", { className: "semiont-assist-widget__no-types", children: t12("noEntityTypes") }) })
|
|
33223
33253
|
] }),
|
|
33224
|
-
selectedEntityTypes.length > 0 && /* @__PURE__ */
|
|
33254
|
+
selectedEntityTypes.length > 0 && /* @__PURE__ */ jsx38("p", { className: "semiont-assist-widget__count", children: t12("typesSelected", { count: selectedEntityTypes.length }) }),
|
|
33225
33255
|
/* @__PURE__ */ jsxs32("div", { className: "semiont-assist-widget__checkbox-group", children: [
|
|
33226
33256
|
/* @__PURE__ */ jsxs32("label", { className: "semiont-assist-widget__checkbox-label", children: [
|
|
33227
|
-
/* @__PURE__ */
|
|
33257
|
+
/* @__PURE__ */ jsx38(
|
|
33228
33258
|
"input",
|
|
33229
33259
|
{
|
|
33230
33260
|
type: "checkbox",
|
|
@@ -33233,9 +33263,9 @@ function ReferencesPanel({
|
|
|
33233
33263
|
className: "semiont-assist-widget__checkbox"
|
|
33234
33264
|
}
|
|
33235
33265
|
),
|
|
33236
|
-
/* @__PURE__ */
|
|
33266
|
+
/* @__PURE__ */ jsx38("span", { children: t12("includeDescriptiveReferences") })
|
|
33237
33267
|
] }),
|
|
33238
|
-
/* @__PURE__ */
|
|
33268
|
+
/* @__PURE__ */ jsx38("p", { className: "semiont-assist-widget__checkbox-hint", children: t12("descriptiveReferencesTooltip") })
|
|
33239
33269
|
] }),
|
|
33240
33270
|
/* @__PURE__ */ jsxs32(
|
|
33241
33271
|
"button",
|
|
@@ -33247,13 +33277,13 @@ function ReferencesPanel({
|
|
|
33247
33277
|
"data-variant": "assist",
|
|
33248
33278
|
"data-type": "reference",
|
|
33249
33279
|
children: [
|
|
33250
|
-
/* @__PURE__ */
|
|
33251
|
-
/* @__PURE__ */
|
|
33280
|
+
/* @__PURE__ */ jsx38("span", { className: "semiont-button-icon", children: "\u2728" }),
|
|
33281
|
+
/* @__PURE__ */ jsx38("span", { children: t12("annotate") })
|
|
33252
33282
|
]
|
|
33253
33283
|
}
|
|
33254
33284
|
)
|
|
33255
33285
|
] }) }),
|
|
33256
|
-
isAssisting && progress && /* @__PURE__ */
|
|
33286
|
+
isAssisting && progress && /* @__PURE__ */ jsx38(
|
|
33257
33287
|
AnnotateReferencesProgressWidget,
|
|
33258
33288
|
{
|
|
33259
33289
|
progress,
|
|
@@ -33273,19 +33303,20 @@ function ReferencesPanel({
|
|
|
33273
33303
|
] })
|
|
33274
33304
|
] }),
|
|
33275
33305
|
/* @__PURE__ */ jsxs32("div", { children: [
|
|
33276
|
-
/* @__PURE__ */
|
|
33306
|
+
/* @__PURE__ */ jsx38("div", { className: "semiont-panel__divider", children: /* @__PURE__ */ jsxs32("h3", { className: "semiont-panel__subtitle", children: [
|
|
33277
33307
|
t12("outgoingReferences"),
|
|
33278
33308
|
" (",
|
|
33279
33309
|
sortedAnnotations.length,
|
|
33280
33310
|
")"
|
|
33281
33311
|
] }) }),
|
|
33282
|
-
/* @__PURE__ */
|
|
33312
|
+
/* @__PURE__ */ jsx38("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx38("p", { className: "semiont-panel__empty-message", children: t12("noReferences") }) : sortedAnnotations.map((reference) => /* @__PURE__ */ jsx38(
|
|
33283
33313
|
ReferenceEntry,
|
|
33284
33314
|
{
|
|
33315
|
+
session,
|
|
33285
33316
|
reference,
|
|
33286
33317
|
isFocused: reference.id === focusedAnnotationId,
|
|
33287
33318
|
isHovered: reference.id === hoveredAnnotationId,
|
|
33288
|
-
|
|
33319
|
+
onOpenResource,
|
|
33289
33320
|
annotateMode,
|
|
33290
33321
|
isGenerating: reference.id === generatingReferenceId,
|
|
33291
33322
|
ref: (el) => setEntryRef(reference.id, el)
|
|
@@ -33294,7 +33325,7 @@ function ReferencesPanel({
|
|
|
33294
33325
|
)) })
|
|
33295
33326
|
] }),
|
|
33296
33327
|
/* @__PURE__ */ jsxs32("div", { children: [
|
|
33297
|
-
/* @__PURE__ */
|
|
33328
|
+
/* @__PURE__ */ jsx38("div", { className: "semiont-panel__divider", children: /* @__PURE__ */ jsxs32("h3", { className: "semiont-panel__subtitle", children: [
|
|
33298
33329
|
t12("incomingReferences"),
|
|
33299
33330
|
" (",
|
|
33300
33331
|
referencedBy.length,
|
|
@@ -33305,12 +33336,12 @@ function ReferencesPanel({
|
|
|
33305
33336
|
")"
|
|
33306
33337
|
] })
|
|
33307
33338
|
] }) }),
|
|
33308
|
-
referencedBy.length > 0 ? /* @__PURE__ */
|
|
33339
|
+
referencedBy.length > 0 ? /* @__PURE__ */ jsx38("div", { className: "semiont-panel__list", children: referencedBy.map((ref) => {
|
|
33309
33340
|
const resourceId3 = ref.target.source;
|
|
33310
33341
|
return /* @__PURE__ */ jsxs32("div", { className: "semiont-reference-item semiont-reference-item--incoming", children: [
|
|
33311
33342
|
/* @__PURE__ */ jsxs32("div", { className: "semiont-reference-item__header", children: [
|
|
33312
|
-
/* @__PURE__ */
|
|
33313
|
-
/* @__PURE__ */
|
|
33343
|
+
/* @__PURE__ */ jsx38("span", { className: "semiont-reference-item__title", children: ref.resourceName || t12("untitledResource") }),
|
|
33344
|
+
/* @__PURE__ */ jsx38(
|
|
33314
33345
|
Link,
|
|
33315
33346
|
{
|
|
33316
33347
|
href: routes.resourceDetail(resourceId3),
|
|
@@ -33326,7 +33357,7 @@ function ReferencesPanel({
|
|
|
33326
33357
|
'"'
|
|
33327
33358
|
] })
|
|
33328
33359
|
] }, ref.id);
|
|
33329
|
-
}) }) : /* @__PURE__ */
|
|
33360
|
+
}) }) : /* @__PURE__ */ jsx38("p", { className: "semiont-panel__empty-message semiont-panel__empty-message--small", children: referencedByLoading ? t12("loadingEllipsis") : t12("noIncomingReferences") })
|
|
33330
33361
|
] })
|
|
33331
33362
|
] })
|
|
33332
33363
|
] });
|
|
@@ -33335,8 +33366,9 @@ function ReferencesPanel({
|
|
|
33335
33366
|
// src/components/resource/panels/ResourceInfoPanel.tsx
|
|
33336
33367
|
import { formatLocaleDisplay } from "@semiont/core";
|
|
33337
33368
|
import { resourceId as makeResourceId } from "@semiont/core";
|
|
33338
|
-
import { Fragment as Fragment6, jsx as
|
|
33369
|
+
import { Fragment as Fragment6, jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
33339
33370
|
function ResourceInfoPanel({
|
|
33371
|
+
session,
|
|
33340
33372
|
resourceId: resourceId2,
|
|
33341
33373
|
documentEntityTypes,
|
|
33342
33374
|
documentLocale,
|
|
@@ -33352,52 +33384,51 @@ function ResourceInfoPanel({
|
|
|
33352
33384
|
onGenerate
|
|
33353
33385
|
}) {
|
|
33354
33386
|
const t12 = useTranslations("ResourceInfoPanel");
|
|
33355
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
33356
33387
|
const attribution = wasAttributedTo ? Array.isArray(wasAttributedTo) ? wasAttributedTo : [wasAttributedTo] : generator ? Array.isArray(generator) ? generator : [generator] : [];
|
|
33357
33388
|
return /* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel", children: [
|
|
33358
|
-
/* @__PURE__ */
|
|
33389
|
+
/* @__PURE__ */ jsx39("h3", { className: "semiont-resource-info-panel__title", children: t12("title") }),
|
|
33359
33390
|
/* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel__section", children: [
|
|
33360
|
-
/* @__PURE__ */
|
|
33361
|
-
documentLocale ? /* @__PURE__ */
|
|
33391
|
+
/* @__PURE__ */ jsx39("h3", { className: "semiont-resource-info-panel__heading", children: t12("locale") }),
|
|
33392
|
+
documentLocale ? /* @__PURE__ */ jsx39("div", { className: "semiont-resource-info-panel__value", children: formatLocaleDisplay(documentLocale) }) : /* @__PURE__ */ jsx39("div", { className: "semiont-resource-info-panel__value semiont-resource-info-panel__value--empty", children: t12("notSpecified") })
|
|
33362
33393
|
] }),
|
|
33363
33394
|
(primaryMediaType || primaryByteSize !== void 0) && /* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel__section", children: [
|
|
33364
|
-
/* @__PURE__ */
|
|
33395
|
+
/* @__PURE__ */ jsx39("h3", { className: "semiont-resource-info-panel__heading", children: t12("representation") }),
|
|
33365
33396
|
/* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel__field-group", children: [
|
|
33366
33397
|
primaryMediaType && /* @__PURE__ */ jsxs33("div", { children: [
|
|
33367
|
-
/* @__PURE__ */
|
|
33368
|
-
/* @__PURE__ */
|
|
33398
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__label", children: t12("mediaType") }),
|
|
33399
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__value", children: primaryMediaType })
|
|
33369
33400
|
] }),
|
|
33370
33401
|
primaryByteSize !== void 0 && /* @__PURE__ */ jsxs33("div", { children: [
|
|
33371
|
-
/* @__PURE__ */
|
|
33402
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__label", children: t12("byteSize") }),
|
|
33372
33403
|
/* @__PURE__ */ jsxs33("span", { className: "semiont-resource-info-panel__value", children: [
|
|
33373
33404
|
primaryByteSize.toLocaleString(),
|
|
33374
33405
|
" bytes"
|
|
33375
33406
|
] })
|
|
33376
33407
|
] }),
|
|
33377
33408
|
storageUri && /* @__PURE__ */ jsxs33("div", { children: [
|
|
33378
|
-
/* @__PURE__ */
|
|
33379
|
-
/* @__PURE__ */
|
|
33409
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__label", children: t12("storageUri") }),
|
|
33410
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__value", children: storageUri })
|
|
33380
33411
|
] })
|
|
33381
33412
|
] })
|
|
33382
33413
|
] }),
|
|
33383
33414
|
(dateCreated || dateModified || attribution.length > 0 || wasDerivedFrom) && /* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel__section", children: [
|
|
33384
|
-
/* @__PURE__ */
|
|
33415
|
+
/* @__PURE__ */ jsx39("h3", { className: "semiont-resource-info-panel__heading", children: t12("provenance") }),
|
|
33385
33416
|
/* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel__field-group", children: [
|
|
33386
33417
|
dateCreated && /* @__PURE__ */ jsxs33("div", { children: [
|
|
33387
|
-
/* @__PURE__ */
|
|
33388
|
-
/* @__PURE__ */
|
|
33418
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__label", children: t12("createdAt") }),
|
|
33419
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__value", children: new Date(dateCreated).toLocaleString() })
|
|
33389
33420
|
] }),
|
|
33390
33421
|
dateModified && /* @__PURE__ */ jsxs33("div", { children: [
|
|
33391
|
-
/* @__PURE__ */
|
|
33392
|
-
/* @__PURE__ */
|
|
33422
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__label", children: t12("modifiedAt") }),
|
|
33423
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__value", children: new Date(dateModified).toLocaleString() })
|
|
33393
33424
|
] }),
|
|
33394
33425
|
attribution.length > 0 && /* @__PURE__ */ jsxs33("div", { children: [
|
|
33395
|
-
/* @__PURE__ */
|
|
33396
|
-
/* @__PURE__ */
|
|
33426
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__label", children: t12("attributedTo") }),
|
|
33427
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__value", children: attribution.map(renderAgentLabel).join(", ") })
|
|
33397
33428
|
] }),
|
|
33398
33429
|
wasDerivedFrom && /* @__PURE__ */ jsxs33("div", { children: [
|
|
33399
|
-
/* @__PURE__ */
|
|
33400
|
-
/* @__PURE__ */
|
|
33430
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__label", children: t12("derivedFrom") }),
|
|
33431
|
+
/* @__PURE__ */ jsx39("span", { className: "semiont-resource-info-panel__value", children: (Array.isArray(wasDerivedFrom) ? wasDerivedFrom : [wasDerivedFrom]).map((id2, i13) => /* @__PURE__ */ jsxs33(
|
|
33401
33432
|
"button",
|
|
33402
33433
|
{
|
|
33403
33434
|
className: "semiont-resource-info-panel__link",
|
|
@@ -33413,8 +33444,8 @@ function ResourceInfoPanel({
|
|
|
33413
33444
|
] })
|
|
33414
33445
|
] }),
|
|
33415
33446
|
documentEntityTypes.length > 0 && /* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel__section", children: [
|
|
33416
|
-
/* @__PURE__ */
|
|
33417
|
-
/* @__PURE__ */
|
|
33447
|
+
/* @__PURE__ */ jsx39("h3", { className: "semiont-resource-info-panel__heading", children: t12("entityTypeTags") }),
|
|
33448
|
+
/* @__PURE__ */ jsx39("div", { className: "semiont-resource-info-panel__tag-list", children: documentEntityTypes.map((tag) => /* @__PURE__ */ jsx39(
|
|
33418
33449
|
"span",
|
|
33419
33450
|
{
|
|
33420
33451
|
className: "semiont-tag",
|
|
@@ -33436,7 +33467,7 @@ function ResourceInfoPanel({
|
|
|
33436
33467
|
]
|
|
33437
33468
|
}
|
|
33438
33469
|
),
|
|
33439
|
-
/* @__PURE__ */
|
|
33470
|
+
/* @__PURE__ */ jsx39("p", { className: "semiont-resource-info-panel__description", children: t12("generateDescription") })
|
|
33440
33471
|
] }),
|
|
33441
33472
|
/* @__PURE__ */ jsxs33("div", { className: "semiont-resource-info-panel__action-section", children: [
|
|
33442
33473
|
/* @__PURE__ */ jsxs33(
|
|
@@ -33450,9 +33481,9 @@ function ResourceInfoPanel({
|
|
|
33450
33481
|
]
|
|
33451
33482
|
}
|
|
33452
33483
|
),
|
|
33453
|
-
/* @__PURE__ */
|
|
33484
|
+
/* @__PURE__ */ jsx39("p", { className: "semiont-resource-info-panel__description", children: t12("cloneDescription") })
|
|
33454
33485
|
] }),
|
|
33455
|
-
/* @__PURE__ */
|
|
33486
|
+
/* @__PURE__ */ jsx39("div", { className: "semiont-resource-info-panel__action-section", children: isArchived ? /* @__PURE__ */ jsxs33(Fragment6, { children: [
|
|
33456
33487
|
/* @__PURE__ */ jsxs33(
|
|
33457
33488
|
"button",
|
|
33458
33489
|
{
|
|
@@ -33464,7 +33495,7 @@ function ResourceInfoPanel({
|
|
|
33464
33495
|
]
|
|
33465
33496
|
}
|
|
33466
33497
|
),
|
|
33467
|
-
/* @__PURE__ */
|
|
33498
|
+
/* @__PURE__ */ jsx39("p", { className: "semiont-resource-info-panel__description", children: t12("unarchiveDescription") })
|
|
33468
33499
|
] }) : /* @__PURE__ */ jsxs33(Fragment6, { children: [
|
|
33469
33500
|
/* @__PURE__ */ jsxs33(
|
|
33470
33501
|
"button",
|
|
@@ -33477,14 +33508,14 @@ function ResourceInfoPanel({
|
|
|
33477
33508
|
]
|
|
33478
33509
|
}
|
|
33479
33510
|
),
|
|
33480
|
-
/* @__PURE__ */
|
|
33511
|
+
/* @__PURE__ */ jsx39("p", { className: "semiont-resource-info-panel__description", children: t12("archiveDescription") })
|
|
33481
33512
|
] }) })
|
|
33482
33513
|
] });
|
|
33483
33514
|
}
|
|
33484
33515
|
|
|
33485
33516
|
// src/components/resource/panels/StatisticsPanel.tsx
|
|
33486
33517
|
import { isBodyResolved as isBodyResolved3 } from "@semiont/core";
|
|
33487
|
-
import { jsx as
|
|
33518
|
+
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
33488
33519
|
function StatisticsPanel({
|
|
33489
33520
|
highlights,
|
|
33490
33521
|
comments,
|
|
@@ -33503,48 +33534,48 @@ function StatisticsPanel({
|
|
|
33503
33534
|
});
|
|
33504
33535
|
});
|
|
33505
33536
|
const entityTypesList = Array.from(entityTypeCounts.entries()).sort((a15, b8) => b8[1] - a15[1]);
|
|
33506
|
-
return /* @__PURE__ */
|
|
33507
|
-
/* @__PURE__ */
|
|
33537
|
+
return /* @__PURE__ */ jsx40("div", { className: "semiont-statistics-panel", children: /* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__content", children: [
|
|
33538
|
+
/* @__PURE__ */ jsx40("h2", { className: "semiont-statistics-panel__title", children: t12("title") }),
|
|
33508
33539
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__list", children: [
|
|
33509
33540
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__item", children: [
|
|
33510
|
-
/* @__PURE__ */
|
|
33511
|
-
/* @__PURE__ */
|
|
33541
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__label", children: t12("highlights") }),
|
|
33542
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__value", children: highlights.length })
|
|
33512
33543
|
] }),
|
|
33513
33544
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__item", children: [
|
|
33514
|
-
/* @__PURE__ */
|
|
33515
|
-
/* @__PURE__ */
|
|
33545
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__label", children: t12("comments") }),
|
|
33546
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__value", children: comments.length })
|
|
33516
33547
|
] }),
|
|
33517
33548
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__item", children: [
|
|
33518
|
-
/* @__PURE__ */
|
|
33519
|
-
/* @__PURE__ */
|
|
33549
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__label", children: t12("assessments") }),
|
|
33550
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__value", children: assessments.length })
|
|
33520
33551
|
] }),
|
|
33521
33552
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__item", children: [
|
|
33522
|
-
/* @__PURE__ */
|
|
33523
|
-
/* @__PURE__ */
|
|
33553
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__label", children: t12("tags") }),
|
|
33554
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__value", children: tags3.length })
|
|
33524
33555
|
] }),
|
|
33525
33556
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__item", children: [
|
|
33526
|
-
/* @__PURE__ */
|
|
33527
|
-
/* @__PURE__ */
|
|
33557
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__label", children: t12("references") }),
|
|
33558
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__value", children: references.length }),
|
|
33528
33559
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__subitems", children: [
|
|
33529
33560
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__subitem", children: [
|
|
33530
|
-
/* @__PURE__ */
|
|
33531
|
-
/* @__PURE__ */
|
|
33561
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__sublabel", children: t12("stub") }),
|
|
33562
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__subvalue", children: stubCount })
|
|
33532
33563
|
] }),
|
|
33533
33564
|
/* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__subitem", children: [
|
|
33534
|
-
/* @__PURE__ */
|
|
33535
|
-
/* @__PURE__ */
|
|
33565
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__sublabel", children: t12("resolved") }),
|
|
33566
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__subvalue", children: resolvedCount })
|
|
33536
33567
|
] })
|
|
33537
33568
|
] })
|
|
33538
33569
|
] }),
|
|
33539
33570
|
entityTypesList.length > 0 && /* @__PURE__ */ jsxs34("div", { className: "semiont-statistics-panel__entity-types", children: [
|
|
33540
|
-
/* @__PURE__ */
|
|
33541
|
-
/* @__PURE__ */
|
|
33571
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__label", children: t12("entityTypes") }),
|
|
33572
|
+
/* @__PURE__ */ jsx40("div", { className: "semiont-statistics-panel__entity-list", children: entityTypesList.map(([type, count2]) => /* @__PURE__ */ jsxs34(
|
|
33542
33573
|
"div",
|
|
33543
33574
|
{
|
|
33544
33575
|
className: "semiont-statistics-panel__entity-item",
|
|
33545
33576
|
children: [
|
|
33546
|
-
/* @__PURE__ */
|
|
33547
|
-
/* @__PURE__ */
|
|
33577
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-statistics-panel__entity-name", children: type }),
|
|
33578
|
+
/* @__PURE__ */ jsx40("span", { className: "semiont-tag", "data-variant": "blue", children: count2 })
|
|
33548
33579
|
]
|
|
33549
33580
|
},
|
|
33550
33581
|
type
|
|
@@ -33557,15 +33588,15 @@ function StatisticsPanel({
|
|
|
33557
33588
|
// src/components/resource/panels/TagEntry.tsx
|
|
33558
33589
|
import { useMemo as useMemo12 } from "react";
|
|
33559
33590
|
import { getAnnotationExactText as getAnnotationExactText5 } from "@semiont/core";
|
|
33560
|
-
import { jsx as
|
|
33591
|
+
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
33561
33592
|
function TagEntry({
|
|
33593
|
+
session,
|
|
33562
33594
|
tag,
|
|
33563
33595
|
isFocused,
|
|
33564
33596
|
isHovered = false,
|
|
33565
33597
|
ref
|
|
33566
33598
|
}) {
|
|
33567
|
-
const
|
|
33568
|
-
const hoverProps = useHoverEmitter(tag.id);
|
|
33599
|
+
const hoverProps = useHoverEmitter(session, tag.id);
|
|
33569
33600
|
const selectedText = getAnnotationExactText5(tag);
|
|
33570
33601
|
const category = getTagCategory(tag);
|
|
33571
33602
|
const schemaId = getTagSchemaId(tag);
|
|
@@ -33588,8 +33619,8 @@ function TagEntry({
|
|
|
33588
33619
|
"data-focused": isFocused ? "true" : "false",
|
|
33589
33620
|
children: [
|
|
33590
33621
|
/* @__PURE__ */ jsxs35("div", { className: "semiont-annotation-entry__header", children: [
|
|
33591
|
-
/* @__PURE__ */
|
|
33592
|
-
schema && /* @__PURE__ */
|
|
33622
|
+
/* @__PURE__ */ jsx41("span", { className: "semiont-tag-badge", "data-variant": "tag", children: category }),
|
|
33623
|
+
schema && /* @__PURE__ */ jsx41("span", { className: "semiont-annotation-entry__meta", children: schema.name })
|
|
33593
33624
|
] }),
|
|
33594
33625
|
/* @__PURE__ */ jsxs35("div", { className: "semiont-annotation-entry__quote", "data-type": "tag", children: [
|
|
33595
33626
|
'"',
|
|
@@ -33609,7 +33640,7 @@ function TagEntry({
|
|
|
33609
33640
|
// src/components/resource/panels/TaggingPanel.tsx
|
|
33610
33641
|
import { useState as useState31, useEffect as useEffect36, useRef as useRef25, useCallback as useCallback25, useMemo as useMemo13 } from "react";
|
|
33611
33642
|
import { getTextPositionSelector as getTextPositionSelector7, getTargetSelector as getTargetSelector10 } from "@semiont/core";
|
|
33612
|
-
import { Fragment as Fragment7, jsx as
|
|
33643
|
+
import { Fragment as Fragment7, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
33613
33644
|
function getSelectorDisplayText4(selector) {
|
|
33614
33645
|
if (Array.isArray(selector)) {
|
|
33615
33646
|
const quoteSelector = selector.find((s11) => s11.type === "TextQuoteSelector");
|
|
@@ -33624,6 +33655,7 @@ function getSelectorDisplayText4(selector) {
|
|
|
33624
33655
|
return null;
|
|
33625
33656
|
}
|
|
33626
33657
|
function TaggingPanel({
|
|
33658
|
+
session,
|
|
33627
33659
|
resourceId: resourceId2,
|
|
33628
33660
|
annotations,
|
|
33629
33661
|
annotateMode = true,
|
|
@@ -33637,7 +33669,6 @@ function TaggingPanel({
|
|
|
33637
33669
|
sourceLanguage
|
|
33638
33670
|
}) {
|
|
33639
33671
|
const t12 = useTranslations("TaggingPanel");
|
|
33640
|
-
const session = useObservable(useSemiont().activeSession$);
|
|
33641
33672
|
const tagSchemas$ = useMemo13(
|
|
33642
33673
|
() => session?.client.browse.tagSchemas() ?? null,
|
|
33643
33674
|
[session]
|
|
@@ -33667,7 +33698,7 @@ function TaggingPanel({
|
|
|
33667
33698
|
setFocusedAnnotationId(annotationId2);
|
|
33668
33699
|
setTimeout(() => setFocusedAnnotationId(null), 3e3);
|
|
33669
33700
|
}, []);
|
|
33670
|
-
|
|
33701
|
+
useSessionEventSubscriptions(session, {
|
|
33671
33702
|
"browse:click": handleAnnotationClick2
|
|
33672
33703
|
});
|
|
33673
33704
|
const entryRefs = useRef25(/* @__PURE__ */ new Map());
|
|
@@ -33763,32 +33794,32 @@ function TaggingPanel({
|
|
|
33763
33794
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
33764
33795
|
}, [pendingAnnotation, session]);
|
|
33765
33796
|
return /* @__PURE__ */ jsxs36("div", { className: "semiont-panel", children: [
|
|
33766
|
-
/* @__PURE__ */
|
|
33797
|
+
/* @__PURE__ */ jsx42(PanelHeader, { annotationType: "tag", count: annotations.length, title: t12("title") }),
|
|
33767
33798
|
/* @__PURE__ */ jsxs36("div", { ref: containerRef, className: "semiont-panel__content", children: [
|
|
33768
33799
|
pendingAnnotation && pendingAnnotation.motivation === "tagging" && /* @__PURE__ */ jsxs36("div", { className: "semiont-annotation-prompt", "data-type": "tag", children: [
|
|
33769
|
-
/* @__PURE__ */
|
|
33770
|
-
/* @__PURE__ */
|
|
33800
|
+
/* @__PURE__ */ jsx42("h3", { className: "semiont-annotation-prompt__title", children: t12("createTagForSelection") }),
|
|
33801
|
+
/* @__PURE__ */ jsx42("div", { className: "semiont-annotation-prompt__quote", children: /* @__PURE__ */ jsx42("p", { className: "semiont-annotation-prompt__text", children: (() => {
|
|
33771
33802
|
const displayText = getSelectorDisplayText4(pendingAnnotation.selector);
|
|
33772
33803
|
if (displayText) {
|
|
33773
33804
|
return `"${displayText.substring(0, 100)}${displayText.length > 100 ? "..." : ""}"`;
|
|
33774
33805
|
}
|
|
33775
33806
|
return t12("fragmentSelected");
|
|
33776
33807
|
})() }) }),
|
|
33777
|
-
noSchemasRegistered && /* @__PURE__ */
|
|
33808
|
+
noSchemasRegistered && /* @__PURE__ */ jsx42("p", { className: "semiont-form__help", "data-type": "tag-no-schemas", children: t12("noSchemas") }),
|
|
33778
33809
|
!noSchemasRegistered && /* @__PURE__ */ jsxs36("div", { className: "semiont-form-field", children: [
|
|
33779
|
-
/* @__PURE__ */
|
|
33780
|
-
/* @__PURE__ */
|
|
33810
|
+
/* @__PURE__ */ jsx42("label", { className: "semiont-form-field__label", children: t12("selectSchema") }),
|
|
33811
|
+
/* @__PURE__ */ jsx42(
|
|
33781
33812
|
"select",
|
|
33782
33813
|
{
|
|
33783
33814
|
value: selectedSchemaId,
|
|
33784
33815
|
onChange: (e6) => handleSchemaChange(e6.target.value),
|
|
33785
33816
|
className: "semiont-select",
|
|
33786
|
-
children: schemas.map((schema) => /* @__PURE__ */
|
|
33817
|
+
children: schemas.map((schema) => /* @__PURE__ */ jsx42("option", { value: schema.id, children: schema.name }, schema.id))
|
|
33787
33818
|
}
|
|
33788
33819
|
)
|
|
33789
33820
|
] }),
|
|
33790
33821
|
selectedSchema && /* @__PURE__ */ jsxs36("div", { className: "semiont-form-field", children: [
|
|
33791
|
-
/* @__PURE__ */
|
|
33822
|
+
/* @__PURE__ */ jsx42("label", { className: "semiont-form-field__label", children: t12("selectCategory") }),
|
|
33792
33823
|
/* @__PURE__ */ jsxs36(
|
|
33793
33824
|
"select",
|
|
33794
33825
|
{
|
|
@@ -33816,13 +33847,13 @@ function TaggingPanel({
|
|
|
33816
33847
|
},
|
|
33817
33848
|
defaultValue: "",
|
|
33818
33849
|
children: [
|
|
33819
|
-
/* @__PURE__ */
|
|
33820
|
-
selectedSchema.tags.map((tag) => /* @__PURE__ */
|
|
33850
|
+
/* @__PURE__ */ jsx42("option", { value: "", children: t12("chooseCategory") }),
|
|
33851
|
+
selectedSchema.tags.map((tag) => /* @__PURE__ */ jsx42("option", { value: tag.name, children: tag.name }, tag.name))
|
|
33821
33852
|
]
|
|
33822
33853
|
}
|
|
33823
33854
|
)
|
|
33824
33855
|
] }),
|
|
33825
|
-
/* @__PURE__ */
|
|
33856
|
+
/* @__PURE__ */ jsx42("div", { className: "semiont-annotation-prompt__footer", children: /* @__PURE__ */ jsx42(
|
|
33826
33857
|
"button",
|
|
33827
33858
|
{
|
|
33828
33859
|
onClick: () => session?.client.mark.cancelPending(),
|
|
@@ -33841,31 +33872,31 @@ function TaggingPanel({
|
|
|
33841
33872
|
"aria-expanded": isAssistExpanded,
|
|
33842
33873
|
type: "button",
|
|
33843
33874
|
children: [
|
|
33844
|
-
/* @__PURE__ */
|
|
33845
|
-
/* @__PURE__ */
|
|
33875
|
+
/* @__PURE__ */ jsx42("span", { children: t12("annotateTags") }),
|
|
33876
|
+
/* @__PURE__ */ jsx42("span", { className: "semiont-panel__section-chevron", "data-expanded": isAssistExpanded, children: "\u203A" })
|
|
33846
33877
|
]
|
|
33847
33878
|
}
|
|
33848
33879
|
),
|
|
33849
33880
|
isAssistExpanded && /* @__PURE__ */ jsxs36("div", { className: "semiont-assist-widget", "data-assisting": isAssisting && progress ? "true" : "false", "data-type": "tag", children: [
|
|
33850
33881
|
!isAssisting && !progress && /* @__PURE__ */ jsxs36(Fragment7, { children: [
|
|
33851
|
-
noSchemasRegistered && /* @__PURE__ */
|
|
33882
|
+
noSchemasRegistered && /* @__PURE__ */ jsx42("p", { className: "semiont-form__help", "data-type": "tag-no-schemas", children: t12("noSchemas") }),
|
|
33852
33883
|
!noSchemasRegistered && /* @__PURE__ */ jsxs36("div", { className: "semiont-form-field", children: [
|
|
33853
|
-
/* @__PURE__ */
|
|
33854
|
-
/* @__PURE__ */
|
|
33884
|
+
/* @__PURE__ */ jsx42("label", { className: "semiont-form-field__label", children: t12("selectSchema") }),
|
|
33885
|
+
/* @__PURE__ */ jsx42(
|
|
33855
33886
|
"select",
|
|
33856
33887
|
{
|
|
33857
33888
|
value: selectedSchemaId,
|
|
33858
33889
|
onChange: (e6) => handleSchemaChange(e6.target.value),
|
|
33859
33890
|
className: "semiont-select",
|
|
33860
|
-
children: schemas.map((schema) => /* @__PURE__ */
|
|
33891
|
+
children: schemas.map((schema) => /* @__PURE__ */ jsx42("option", { value: schema.id, children: schema.name }, schema.id))
|
|
33861
33892
|
}
|
|
33862
33893
|
),
|
|
33863
|
-
selectedSchema && /* @__PURE__ */
|
|
33894
|
+
selectedSchema && /* @__PURE__ */ jsx42("p", { className: "semiont-form__help", children: selectedSchema.description })
|
|
33864
33895
|
] }),
|
|
33865
33896
|
selectedSchema && /* @__PURE__ */ jsxs36("div", { className: "semiont-form-field", children: [
|
|
33866
|
-
/* @__PURE__ */
|
|
33897
|
+
/* @__PURE__ */ jsx42("label", { className: "semiont-form-field__label", children: t12("selectCategories") }),
|
|
33867
33898
|
/* @__PURE__ */ jsxs36("div", { style: { display: "flex", gap: "0.5rem", marginBottom: "0.75rem" }, children: [
|
|
33868
|
-
/* @__PURE__ */
|
|
33899
|
+
/* @__PURE__ */ jsx42(
|
|
33869
33900
|
"button",
|
|
33870
33901
|
{
|
|
33871
33902
|
onClick: handleSelectAll,
|
|
@@ -33875,7 +33906,7 @@ function TaggingPanel({
|
|
|
33875
33906
|
children: t12("selectAll")
|
|
33876
33907
|
}
|
|
33877
33908
|
),
|
|
33878
|
-
/* @__PURE__ */
|
|
33909
|
+
/* @__PURE__ */ jsx42(
|
|
33879
33910
|
"button",
|
|
33880
33911
|
{
|
|
33881
33912
|
onClick: handleDeselectAll,
|
|
@@ -33886,8 +33917,8 @@ function TaggingPanel({
|
|
|
33886
33917
|
}
|
|
33887
33918
|
)
|
|
33888
33919
|
] }),
|
|
33889
|
-
/* @__PURE__ */
|
|
33890
|
-
/* @__PURE__ */
|
|
33920
|
+
/* @__PURE__ */ jsx42("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: selectedSchema.tags.map((category) => /* @__PURE__ */ jsxs36("div", { className: "semiont-form__checkbox-field", children: [
|
|
33921
|
+
/* @__PURE__ */ jsx42(
|
|
33891
33922
|
"input",
|
|
33892
33923
|
{
|
|
33893
33924
|
type: "checkbox",
|
|
@@ -33904,13 +33935,13 @@ function TaggingPanel({
|
|
|
33904
33935
|
className: "semiont-form__checkbox-label",
|
|
33905
33936
|
style: { display: "flex", flexDirection: "column", gap: "0.25rem" },
|
|
33906
33937
|
children: [
|
|
33907
|
-
/* @__PURE__ */
|
|
33908
|
-
/* @__PURE__ */
|
|
33938
|
+
/* @__PURE__ */ jsx42("span", { style: { fontWeight: 500 }, children: category.name }),
|
|
33939
|
+
/* @__PURE__ */ jsx42("span", { style: { fontSize: "var(--semiont-text-xs)", color: "var(--semiont-text-secondary)" }, children: category.description })
|
|
33909
33940
|
]
|
|
33910
33941
|
}
|
|
33911
33942
|
)
|
|
33912
33943
|
] }, category.name)) }),
|
|
33913
|
-
/* @__PURE__ */
|
|
33944
|
+
/* @__PURE__ */ jsx42("p", { className: "semiont-form__help", children: t12("categoriesSelected", { count: selectedCategories.size }) })
|
|
33914
33945
|
] })
|
|
33915
33946
|
] }),
|
|
33916
33947
|
/* @__PURE__ */ jsxs36(
|
|
@@ -33922,14 +33953,14 @@ function TaggingPanel({
|
|
|
33922
33953
|
"data-variant": "assist",
|
|
33923
33954
|
"data-type": "tag",
|
|
33924
33955
|
children: [
|
|
33925
|
-
/* @__PURE__ */
|
|
33926
|
-
/* @__PURE__ */
|
|
33956
|
+
/* @__PURE__ */ jsx42("span", { className: "semiont-button-icon", children: "\u2728" }),
|
|
33957
|
+
/* @__PURE__ */ jsx42("span", { children: t12("annotate") })
|
|
33927
33958
|
]
|
|
33928
33959
|
}
|
|
33929
33960
|
),
|
|
33930
33961
|
isAssisting && progress && /* @__PURE__ */ jsxs36("div", { className: "semiont-annotation-progress", "data-type": "tag", children: [
|
|
33931
33962
|
progress.requestParams && progress.requestParams.length > 0 && /* @__PURE__ */ jsxs36("div", { className: "semiont-annotation-progress__params", "data-type": "tag", children: [
|
|
33932
|
-
/* @__PURE__ */
|
|
33963
|
+
/* @__PURE__ */ jsx42("div", { className: "semiont-annotation-progress__params-title", children: "Request Parameters:" }),
|
|
33933
33964
|
progress.requestParams.map((param, idx) => /* @__PURE__ */ jsxs36("div", { className: "semiont-annotation-progress__param", children: [
|
|
33934
33965
|
/* @__PURE__ */ jsxs36("span", { className: "semiont-annotation-progress__param-label", children: [
|
|
33935
33966
|
param.label,
|
|
@@ -33941,8 +33972,8 @@ function TaggingPanel({
|
|
|
33941
33972
|
] }),
|
|
33942
33973
|
/* @__PURE__ */ jsxs36("div", { className: "semiont-annotation-progress__status", children: [
|
|
33943
33974
|
/* @__PURE__ */ jsxs36("div", { className: "semiont-annotation-progress__message", children: [
|
|
33944
|
-
/* @__PURE__ */
|
|
33945
|
-
/* @__PURE__ */
|
|
33975
|
+
/* @__PURE__ */ jsx42("span", { className: "semiont-annotation-progress__icon", children: "\u2728" }),
|
|
33976
|
+
/* @__PURE__ */ jsx42("span", { children: progress.message })
|
|
33946
33977
|
] }),
|
|
33947
33978
|
progress.currentCategory && /* @__PURE__ */ jsxs36("div", { className: "semiont-annotation-progress__details", children: [
|
|
33948
33979
|
"Processing: ",
|
|
@@ -33956,7 +33987,7 @@ function TaggingPanel({
|
|
|
33956
33987
|
] })
|
|
33957
33988
|
] })
|
|
33958
33989
|
] }),
|
|
33959
|
-
progress.percentage !== void 0 && /* @__PURE__ */
|
|
33990
|
+
progress.percentage !== void 0 && /* @__PURE__ */ jsx42("div", { className: "semiont-progress-bar", children: /* @__PURE__ */ jsx42(
|
|
33960
33991
|
"div",
|
|
33961
33992
|
{
|
|
33962
33993
|
className: "semiont-progress-bar__fill",
|
|
@@ -33967,9 +33998,10 @@ function TaggingPanel({
|
|
|
33967
33998
|
] })
|
|
33968
33999
|
] })
|
|
33969
34000
|
] }),
|
|
33970
|
-
/* @__PURE__ */
|
|
34001
|
+
/* @__PURE__ */ jsx42("div", { className: "semiont-panel__list", children: sortedAnnotations.length === 0 ? /* @__PURE__ */ jsx42("p", { className: "semiont-panel__empty", children: t12("noTags") }) : sortedAnnotations.map((tag) => /* @__PURE__ */ jsx42(
|
|
33971
34002
|
TagEntry,
|
|
33972
34003
|
{
|
|
34004
|
+
session,
|
|
33973
34005
|
tag,
|
|
33974
34006
|
isFocused: tag.id === focusedAnnotationId,
|
|
33975
34007
|
isHovered: tag.id === hoveredAnnotationId,
|
|
@@ -33983,7 +34015,7 @@ function TaggingPanel({
|
|
|
33983
34015
|
|
|
33984
34016
|
// src/components/resource/panels/UnifiedAnnotationsPanel.tsx
|
|
33985
34017
|
import { useState as useState32, useEffect as useEffect37 } from "react";
|
|
33986
|
-
import { jsx as
|
|
34018
|
+
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
33987
34019
|
var TAB_ORDER = ["statistics", "reference", "highlight", "assessment", "comment", "tag"];
|
|
33988
34020
|
function UnifiedAnnotationsPanel(props) {
|
|
33989
34021
|
const t12 = useTranslations("UnifiedAnnotationsPanel");
|
|
@@ -34046,38 +34078,38 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34046
34078
|
return `semiont-unified-panel__tab-button${isActive ? " semiont-unified-panel__tab-button--active" : ""}`;
|
|
34047
34079
|
};
|
|
34048
34080
|
return /* @__PURE__ */ jsxs37("div", { className: "semiont-unified-panel", children: [
|
|
34049
|
-
/* @__PURE__ */
|
|
34050
|
-
/* @__PURE__ */
|
|
34081
|
+
/* @__PURE__ */ jsx43("h3", { className: "semiont-unified-panel__title", children: t12("title") }),
|
|
34082
|
+
/* @__PURE__ */ jsx43("div", { className: "semiont-unified-panel__tabs", children: TAB_ORDER.map((key) => {
|
|
34051
34083
|
if (key === "statistics") {
|
|
34052
|
-
return /* @__PURE__ */
|
|
34084
|
+
return /* @__PURE__ */ jsx43(
|
|
34053
34085
|
"button",
|
|
34054
34086
|
{
|
|
34055
34087
|
onClick: () => handleTabClick(key),
|
|
34056
34088
|
className: tabButtonClass(key),
|
|
34057
34089
|
title: t12(key),
|
|
34058
34090
|
"aria-pressed": activeTab === key,
|
|
34059
|
-
children: /* @__PURE__ */
|
|
34091
|
+
children: /* @__PURE__ */ jsx43("span", { className: "semiont-unified-panel__tab-icon", children: "\u{1F4CA}" })
|
|
34060
34092
|
},
|
|
34061
34093
|
key
|
|
34062
34094
|
);
|
|
34063
34095
|
}
|
|
34064
34096
|
const annotator = props.annotators[key];
|
|
34065
34097
|
if (!annotator) return null;
|
|
34066
|
-
return /* @__PURE__ */
|
|
34098
|
+
return /* @__PURE__ */ jsx43(
|
|
34067
34099
|
"button",
|
|
34068
34100
|
{
|
|
34069
34101
|
onClick: () => handleTabClick(key),
|
|
34070
34102
|
className: tabButtonClass(key),
|
|
34071
34103
|
title: t12(key),
|
|
34072
34104
|
"aria-pressed": activeTab === key,
|
|
34073
|
-
children: /* @__PURE__ */
|
|
34105
|
+
children: /* @__PURE__ */ jsx43("span", { className: "semiont-unified-panel__tab-icon", children: annotator.iconEmoji })
|
|
34074
34106
|
},
|
|
34075
34107
|
key
|
|
34076
34108
|
);
|
|
34077
34109
|
}) }),
|
|
34078
|
-
/* @__PURE__ */
|
|
34110
|
+
/* @__PURE__ */ jsx43("div", { className: "semiont-unified-panel__content", children: (() => {
|
|
34079
34111
|
if (activeTab === "statistics") {
|
|
34080
|
-
return /* @__PURE__ */
|
|
34112
|
+
return /* @__PURE__ */ jsx43(
|
|
34081
34113
|
StatisticsPanel,
|
|
34082
34114
|
{
|
|
34083
34115
|
highlights: grouped.highlight || [],
|
|
@@ -34094,6 +34126,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34094
34126
|
const isAssisting = props.assistingMotivation === annotator.motivation;
|
|
34095
34127
|
const progress = isAssisting ? props.progress ?? null : null;
|
|
34096
34128
|
const commonProps = {
|
|
34129
|
+
session: props.session,
|
|
34097
34130
|
resourceId: props.resourceId,
|
|
34098
34131
|
annotations,
|
|
34099
34132
|
pendingAnnotation: props.pendingAnnotation,
|
|
@@ -34107,7 +34140,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34107
34140
|
hoveredAnnotationId: props.hoveredAnnotationId
|
|
34108
34141
|
};
|
|
34109
34142
|
if (activeTab === "highlight") {
|
|
34110
|
-
return /* @__PURE__ */
|
|
34143
|
+
return /* @__PURE__ */ jsx43(
|
|
34111
34144
|
HighlightPanel,
|
|
34112
34145
|
{
|
|
34113
34146
|
...commonProps
|
|
@@ -34115,9 +34148,11 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34115
34148
|
);
|
|
34116
34149
|
}
|
|
34117
34150
|
if (activeTab === "reference") {
|
|
34118
|
-
return /* @__PURE__ */
|
|
34151
|
+
return /* @__PURE__ */ jsx43(
|
|
34119
34152
|
ReferencesPanel,
|
|
34120
34153
|
{
|
|
34154
|
+
session: commonProps.session,
|
|
34155
|
+
onOpenResource: props.onOpenResource,
|
|
34121
34156
|
resourceId: commonProps.resourceId,
|
|
34122
34157
|
annotations: commonProps.annotations,
|
|
34123
34158
|
pendingAnnotation: commonProps.pendingAnnotation,
|
|
@@ -34139,7 +34174,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34139
34174
|
);
|
|
34140
34175
|
}
|
|
34141
34176
|
if (activeTab === "assessment") {
|
|
34142
|
-
return /* @__PURE__ */
|
|
34177
|
+
return /* @__PURE__ */ jsx43(
|
|
34143
34178
|
AssessmentPanel,
|
|
34144
34179
|
{
|
|
34145
34180
|
...commonProps
|
|
@@ -34147,7 +34182,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34147
34182
|
);
|
|
34148
34183
|
}
|
|
34149
34184
|
if (activeTab === "comment") {
|
|
34150
|
-
return /* @__PURE__ */
|
|
34185
|
+
return /* @__PURE__ */ jsx43(
|
|
34151
34186
|
CommentsPanel,
|
|
34152
34187
|
{
|
|
34153
34188
|
...commonProps
|
|
@@ -34155,7 +34190,7 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34155
34190
|
);
|
|
34156
34191
|
}
|
|
34157
34192
|
if (activeTab === "tag") {
|
|
34158
|
-
return /* @__PURE__ */
|
|
34193
|
+
return /* @__PURE__ */ jsx43(
|
|
34159
34194
|
TaggingPanel,
|
|
34160
34195
|
{
|
|
34161
34196
|
...commonProps
|
|
@@ -34167,6 +34202,20 @@ function UnifiedAnnotationsPanel(props) {
|
|
|
34167
34202
|
] });
|
|
34168
34203
|
}
|
|
34169
34204
|
|
|
34205
|
+
// src/components/viewers/ImageViewer.tsx
|
|
34206
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
34207
|
+
function ImageViewer({ imageUrl, alt = "Resource image" }) {
|
|
34208
|
+
return /* @__PURE__ */ jsx44("div", { className: "semiont-image-viewer", children: /* @__PURE__ */ jsx44(
|
|
34209
|
+
"img",
|
|
34210
|
+
{
|
|
34211
|
+
src: imageUrl,
|
|
34212
|
+
alt,
|
|
34213
|
+
className: "semiont-image-viewer__image",
|
|
34214
|
+
style: { imageRendering: "auto" }
|
|
34215
|
+
}
|
|
34216
|
+
) });
|
|
34217
|
+
}
|
|
34218
|
+
|
|
34170
34219
|
// src/components/navigation/Footer.tsx
|
|
34171
34220
|
import { useState as useState33 } from "react";
|
|
34172
34221
|
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -44157,6 +44206,8 @@ function ResourceViewerPage({
|
|
|
44157
44206
|
activePanel === "annotations" && !resource.archived && /* @__PURE__ */ jsx93(
|
|
44158
44207
|
UnifiedAnnotationsPanel,
|
|
44159
44208
|
{
|
|
44209
|
+
session: session ?? null,
|
|
44210
|
+
onOpenResource: handleViewerOpenResource,
|
|
44160
44211
|
annotations,
|
|
44161
44212
|
annotators: ANNOTATORS,
|
|
44162
44213
|
annotateMode,
|
|
@@ -44193,6 +44244,7 @@ function ResourceViewerPage({
|
|
|
44193
44244
|
activePanel === "info" && /* @__PURE__ */ jsx93(
|
|
44194
44245
|
ResourceInfoPanel,
|
|
44195
44246
|
{
|
|
44247
|
+
session: session ?? null,
|
|
44196
44248
|
resourceId: rUri,
|
|
44197
44249
|
documentEntityTypes,
|
|
44198
44250
|
documentLocale: getLanguage(resource),
|