@semiont/react-ui 0.3.4 → 0.3.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/react-ui",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "React components and hooks for Semiont",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.mts",
@@ -81,7 +81,7 @@
81
81
  "@testing-library/react": "^16.1.0",
82
82
  "@types/react": "^19",
83
83
  "@types/react-dom": "^19",
84
- "@vitest/coverage-v8": "^4.1.0",
84
+ "@vitest/coverage-v8": "^4.0.18",
85
85
  "autoprefixer": "^10.4.23",
86
86
  "axe-core": "^4.11.0",
87
87
  "cssnano": "^7.1.2",
@@ -90,7 +90,7 @@
90
90
  "postcss-import": "^16.1.1",
91
91
  "tsup": "^8.0.1",
92
92
  "typescript": "^5.6.3",
93
- "vitest": "^4.1.0"
93
+ "vitest": "^4.0.18"
94
94
  },
95
95
  "publishConfig": {
96
96
  "access": "public"
@@ -104,6 +104,7 @@
104
104
  },
105
105
  "dependencies": {
106
106
  "@semiont/api-client": "*",
107
- "@semiont/core": "*"
107
+ "@semiont/core": "*",
108
+ "@vitest/ui": "4.0.18"
108
109
  }
109
110
  }
@@ -109,6 +109,11 @@ export function AssessmentEntry({
109
109
  <div className="semiont-annotation-entry__metadata">
110
110
  By {typeof assessment.creator === 'string' ? assessment.creator : assessment.creator?.name || 'Unknown'} • {formatRelativeTime(assessment.created || new Date().toISOString())}
111
111
  </div>
112
+ {assessment.generator && (
113
+ <div className="semiont-annotation-entry__metadata">
114
+ Via {typeof assessment.generator === 'string' ? assessment.generator : assessment.generator.name}
115
+ </div>
116
+ )}
112
117
  </div>
113
118
  );
114
119
  }
@@ -139,6 +139,11 @@ export function CommentEntry({
139
139
  <div className="semiont-annotation-entry__metadata">
140
140
  By {typeof comment.creator === 'string' ? comment.creator : comment.creator?.name || 'Unknown'} • {formatRelativeTime(comment.created || new Date().toISOString())}
141
141
  </div>
142
+ {comment.generator && (
143
+ <div className="semiont-annotation-entry__metadata">
144
+ Via {typeof comment.generator === 'string' ? comment.generator : comment.generator.name}
145
+ </div>
146
+ )}
142
147
  {annotateMode && (
143
148
  <div className="semiont-annotation-entry__actions" onClick={(e) => e.stopPropagation()}>
144
149
  <button
@@ -65,6 +65,11 @@ export function HighlightEntry({
65
65
  <div className="semiont-annotation-entry__metadata">
66
66
  By {typeof highlight.creator === 'string' ? highlight.creator : highlight.creator?.name || 'Unknown'} • {formatRelativeTime(highlight.created || new Date().toISOString())}
67
67
  </div>
68
+ {highlight.generator && (
69
+ <div className="semiont-annotation-entry__metadata">
70
+ Via {typeof highlight.generator === 'string' ? highlight.generator : highlight.generator.name}
71
+ </div>
72
+ )}
68
73
  </div>
69
74
  );
70
75
  }
@@ -169,6 +169,11 @@ export function ReferenceEntry({
169
169
  ))}
170
170
  </div>
171
171
  )}
172
+ {reference.generator && (
173
+ <div className="semiont-annotation-entry__metadata">
174
+ Via {typeof reference.generator === 'string' ? reference.generator : reference.generator.name}
175
+ </div>
176
+ )}
172
177
  </div>
173
178
  );
174
179
  }
@@ -58,6 +58,11 @@ export function TagEntry({
58
58
  <div className="semiont-annotation-entry__quote" data-type="tag">
59
59
  "{selectedText.substring(0, 150)}{selectedText.length > 150 ? '...' : ''}"
60
60
  </div>
61
+ {tag.generator && (
62
+ <div className="semiont-annotation-entry__metadata">
63
+ Via {typeof tag.generator === 'string' ? tag.generator : tag.generator.name}
64
+ </div>
65
+ )}
61
66
  </div>
62
67
  );
63
68
  }
@@ -1,547 +0,0 @@
1
- 'use client';
2
- import "./chunk-D4GAAQMM.mjs";
3
-
4
- // ../../node_modules/tinybench/dist/index.js
5
- var $ = Object.defineProperty;
6
- var C = (s) => {
7
- throw TypeError(s);
8
- };
9
- var D = (s, n, t) => n in s ? $(s, n, { enumerable: true, configurable: true, writable: true, value: t }) : s[n] = t;
10
- var O = (s, n, t) => D(s, typeof n != "symbol" ? n + "" : n, t);
11
- var q = (s, n, t) => n.has(s) || C("Cannot " + t);
12
- var d = (s, n, t) => (q(s, n, "read from private field"), t ? t.call(s) : n.get(s));
13
- var k = (s, n, t) => n.has(s) ? C("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(s) : n.set(s, t);
14
- var f = (s, n, t, e) => (q(s, n, "write to private field"), e ? e.call(s, t) : n.set(s, t), t);
15
- var F = (s, n, t, e) => ({
16
- set _(r) {
17
- f(s, n, r, t);
18
- },
19
- get _() {
20
- return d(s, n, e);
21
- }
22
- });
23
- var M = class {
24
- constructor(n) {
25
- O(this, "value");
26
- O(this, "next");
27
- this.value = n;
28
- }
29
- };
30
- var m;
31
- var w;
32
- var E;
33
- var g = class {
34
- constructor() {
35
- k(this, m);
36
- k(this, w);
37
- k(this, E);
38
- this.clear();
39
- }
40
- enqueue(n) {
41
- let t = new M(n);
42
- d(this, m) ? (d(this, w).next = t, f(this, w, t)) : (f(this, m, t), f(this, w, t)), F(this, E)._++;
43
- }
44
- dequeue() {
45
- let n = d(this, m);
46
- if (n)
47
- return f(this, m, d(this, m).next), F(this, E)._--, n.value;
48
- }
49
- clear() {
50
- f(this, m, void 0), f(this, w, void 0), f(this, E, 0);
51
- }
52
- get size() {
53
- return d(this, E);
54
- }
55
- *[Symbol.iterator]() {
56
- let n = d(this, m);
57
- for (; n; )
58
- yield n.value, n = n.next;
59
- }
60
- };
61
- m = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap();
62
- function y(s) {
63
- if (!((Number.isInteger(s) || s === Number.POSITIVE_INFINITY) && s > 0))
64
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
65
- let n = new g(), t = 0, e = () => {
66
- t--, n.size > 0 && n.dequeue()();
67
- }, r = async (h, p, a) => {
68
- t++;
69
- let l = (async () => h(...a))();
70
- p(l);
71
- try {
72
- await l;
73
- } catch (T) {
74
- }
75
- e();
76
- }, i = (h, p, a) => {
77
- n.enqueue(r.bind(void 0, h, p, a)), (async () => (await Promise.resolve(), t < s && n.size > 0 && n.dequeue()()))();
78
- }, c = (h, ...p) => new Promise((a) => {
79
- i(h, a, p);
80
- });
81
- return Object.defineProperties(c, {
82
- activeCount: {
83
- get: () => t
84
- },
85
- pendingCount: {
86
- get: () => n.size
87
- },
88
- clearQueue: {
89
- value: () => {
90
- n.clear();
91
- }
92
- }
93
- }), c;
94
- }
95
- function o(s, n = null) {
96
- let t = new Event(s);
97
- return n && Object.defineProperty(t, "task", {
98
- value: n,
99
- enumerable: true,
100
- writable: false,
101
- configurable: false
102
- }), t;
103
- }
104
- var G = {
105
- 1: 12.71,
106
- 2: 4.303,
107
- 3: 3.182,
108
- 4: 2.776,
109
- 5: 2.571,
110
- 6: 2.447,
111
- 7: 2.365,
112
- 8: 2.306,
113
- 9: 2.262,
114
- 10: 2.228,
115
- 11: 2.201,
116
- 12: 2.179,
117
- 13: 2.16,
118
- 14: 2.145,
119
- 15: 2.131,
120
- 16: 2.12,
121
- 17: 2.11,
122
- 18: 2.101,
123
- 19: 2.093,
124
- 20: 2.086,
125
- 21: 2.08,
126
- 22: 2.074,
127
- 23: 2.069,
128
- 24: 2.064,
129
- 25: 2.06,
130
- 26: 2.056,
131
- 27: 2.052,
132
- 28: 2.048,
133
- 29: 2.045,
134
- 30: 2.042,
135
- 31: 2.0399,
136
- 32: 2.0378,
137
- 33: 2.0357,
138
- 34: 2.0336,
139
- 35: 2.0315,
140
- 36: 2.0294,
141
- 37: 2.0273,
142
- 38: 2.0252,
143
- 39: 2.0231,
144
- 40: 2.021,
145
- 41: 2.0198,
146
- 42: 2.0186,
147
- 43: 2.0174,
148
- 44: 2.0162,
149
- 45: 2.015,
150
- 46: 2.0138,
151
- 47: 2.0126,
152
- 48: 2.0114,
153
- 49: 2.0102,
154
- 50: 2.009,
155
- 51: 2.0081,
156
- 52: 2.0072,
157
- 53: 2.0063,
158
- 54: 2.0054,
159
- 55: 2.0045,
160
- 56: 2.0036,
161
- 57: 2.0027,
162
- 58: 2.0018,
163
- 59: 2.0009,
164
- 60: 2,
165
- 61: 1.9995,
166
- 62: 1.999,
167
- 63: 1.9985,
168
- 64: 1.998,
169
- 65: 1.9975,
170
- 66: 1.997,
171
- 67: 1.9965,
172
- 68: 1.996,
173
- 69: 1.9955,
174
- 70: 1.995,
175
- 71: 1.9945,
176
- 72: 1.994,
177
- 73: 1.9935,
178
- 74: 1.993,
179
- 75: 1.9925,
180
- 76: 1.992,
181
- 77: 1.9915,
182
- 78: 1.991,
183
- 79: 1.9905,
184
- 80: 1.99,
185
- 81: 1.9897,
186
- 82: 1.9894,
187
- 83: 1.9891,
188
- 84: 1.9888,
189
- 85: 1.9885,
190
- 86: 1.9882,
191
- 87: 1.9879,
192
- 88: 1.9876,
193
- 89: 1.9873,
194
- 90: 1.987,
195
- 91: 1.9867,
196
- 92: 1.9864,
197
- 93: 1.9861,
198
- 94: 1.9858,
199
- 95: 1.9855,
200
- 96: 1.9852,
201
- 97: 1.9849,
202
- 98: 1.9846,
203
- 99: 1.9843,
204
- 100: 1.984,
205
- 101: 1.9838,
206
- 102: 1.9836,
207
- 103: 1.9834,
208
- 104: 1.9832,
209
- 105: 1.983,
210
- 106: 1.9828,
211
- 107: 1.9826,
212
- 108: 1.9824,
213
- 109: 1.9822,
214
- 110: 1.982,
215
- 111: 1.9818,
216
- 112: 1.9816,
217
- 113: 1.9814,
218
- 114: 1.9812,
219
- 115: 1.9819,
220
- 116: 1.9808,
221
- 117: 1.9806,
222
- 118: 1.9804,
223
- 119: 1.9802,
224
- 120: 1.98,
225
- infinity: 1.96
226
- };
227
- var N = G;
228
- var J = (s) => s / 1e6;
229
- var U = () => J(Number(process.hrtime.bigint()));
230
- var B = () => performance.now();
231
- function W(s) {
232
- return s !== null && typeof s == "object" && typeof s.then == "function";
233
- }
234
- var S = (s, n) => s.reduce((e, r) => e + (r - n) ** 2, 0) / (s.length - 1) || 0;
235
- var X = (async () => {
236
- }).constructor;
237
- var Z = (s) => s.constructor === X;
238
- var z = async (s) => {
239
- if (Z(s.fn))
240
- return true;
241
- try {
242
- if (s.opts.beforeEach != null)
243
- try {
244
- await s.opts.beforeEach.call(s);
245
- } catch (e) {
246
- }
247
- let n = s.fn(), t = W(n);
248
- if (t)
249
- try {
250
- await n;
251
- } catch (e) {
252
- }
253
- if (s.opts.afterEach != null)
254
- try {
255
- await s.opts.afterEach.call(s);
256
- } catch (e) {
257
- }
258
- return t;
259
- } catch (n) {
260
- return false;
261
- }
262
- };
263
- var b = class extends EventTarget {
264
- constructor(t, e, r, i = {}) {
265
- super();
266
- this.runs = 0;
267
- this.bench = t, this.name = e, this.fn = r, this.opts = i;
268
- }
269
- async loop(t, e) {
270
- var T;
271
- let r = this.bench.concurrency === "task", { threshold: i } = this.bench, c = 0, h = [];
272
- if (this.opts.beforeAll != null)
273
- try {
274
- await this.opts.beforeAll.call(this);
275
- } catch (u) {
276
- return { error: u };
277
- }
278
- let p = await z(this), a = async () => {
279
- this.opts.beforeEach != null && await this.opts.beforeEach.call(this);
280
- let u = 0;
281
- if (p) {
282
- let v = this.bench.now();
283
- await this.fn.call(this), u = this.bench.now() - v;
284
- } else {
285
- let v = this.bench.now();
286
- this.fn.call(this), u = this.bench.now() - v;
287
- }
288
- h.push(u), c += u, this.opts.afterEach != null && await this.opts.afterEach.call(this);
289
- }, l = y(i);
290
- try {
291
- let u = [];
292
- for (; (c < t || h.length + l.activeCount + l.pendingCount < e) && !((T = this.bench.signal) != null && T.aborted); )
293
- r ? u.push(l(a)) : await a();
294
- u.length && await Promise.all(u);
295
- } catch (u) {
296
- return { error: u };
297
- }
298
- if (this.opts.afterAll != null)
299
- try {
300
- await this.opts.afterAll.call(this);
301
- } catch (u) {
302
- return { error: u };
303
- }
304
- return { samples: h };
305
- }
306
- /**
307
- * run the current task and write the results in `Task.result` object
308
- */
309
- async run() {
310
- var r, i;
311
- if ((r = this.result) != null && r.error)
312
- return this;
313
- this.dispatchEvent(o("start", this)), await this.bench.setup(this, "run");
314
- let { samples: t, error: e } = await this.loop(this.bench.time, this.bench.iterations);
315
- if (this.bench.teardown(this, "run"), t) {
316
- let c = t.reduce((L, A) => L + A, 0);
317
- this.runs = t.length, t.sort((L, A) => L - A);
318
- let h = c / this.runs, p = 1e3 / h, a = t.length, l = a - 1, T = t[0], u = t[l], v = c / t.length || 0, P = S(t, v), R = Math.sqrt(P), I = R / Math.sqrt(a), _ = N[String(Math.round(l) || 1)] || N.infinity, K = I * _, j = K / v * 100, H = t[Math.ceil(a * 0.75) - 1], V = t[Math.ceil(a * 0.99) - 1], Q = t[Math.ceil(a * 0.995) - 1], Y = t[Math.ceil(a * 0.999) - 1];
319
- if ((i = this.bench.signal) != null && i.aborted)
320
- return this;
321
- this.setResult({
322
- totalTime: c,
323
- min: T,
324
- max: u,
325
- hz: p,
326
- period: h,
327
- samples: t,
328
- mean: v,
329
- variance: P,
330
- sd: R,
331
- sem: I,
332
- df: l,
333
- critical: _,
334
- moe: K,
335
- rme: j,
336
- p75: H,
337
- p99: V,
338
- p995: Q,
339
- p999: Y
340
- });
341
- }
342
- if (e) {
343
- if (this.setResult({ error: e }), this.bench.throws)
344
- throw e;
345
- this.dispatchEvent(o("error", this)), this.bench.dispatchEvent(o("error", this));
346
- }
347
- return this.dispatchEvent(o("cycle", this)), this.bench.dispatchEvent(o("cycle", this)), this.dispatchEvent(o("complete", this)), this;
348
- }
349
- /**
350
- * warmup the current task
351
- */
352
- async warmup() {
353
- var e;
354
- if ((e = this.result) != null && e.error)
355
- return;
356
- this.dispatchEvent(o("warmup", this)), await this.bench.setup(this, "warmup");
357
- let { error: t } = await this.loop(this.bench.warmupTime, this.bench.warmupIterations);
358
- if (this.bench.teardown(this, "warmup"), t && (this.setResult({ error: t }), this.bench.throws))
359
- throw t;
360
- }
361
- addEventListener(t, e, r) {
362
- super.addEventListener(t, e, r);
363
- }
364
- removeEventListener(t, e, r) {
365
- super.removeEventListener(t, e, r);
366
- }
367
- /**
368
- * change the result object values
369
- */
370
- setResult(t) {
371
- this.result = { ...this.result, ...t }, Object.freeze(this.result);
372
- }
373
- /**
374
- * reset the task to make the `Task.runs` a zero-value and remove the `Task.result`
375
- * object
376
- */
377
- reset() {
378
- this.dispatchEvent(o("reset", this)), this.runs = 0, this.result = void 0;
379
- }
380
- };
381
- var x = class extends EventTarget {
382
- constructor(t = {}) {
383
- var e, r, i, c, h, p, a, l;
384
- super();
385
- this._tasks = /* @__PURE__ */ new Map();
386
- this._todos = /* @__PURE__ */ new Map();
387
- this.concurrency = null;
388
- this.threshold = 1 / 0;
389
- this.warmupTime = 100;
390
- this.warmupIterations = 5;
391
- this.time = 500;
392
- this.iterations = 10;
393
- this.now = B;
394
- this.now = (e = t.now) != null ? e : this.now, this.warmupTime = (r = t.warmupTime) != null ? r : this.warmupTime, this.warmupIterations = (i = t.warmupIterations) != null ? i : this.warmupIterations, this.time = (c = t.time) != null ? c : this.time, this.iterations = (h = t.iterations) != null ? h : this.iterations, this.signal = t.signal, this.throws = (p = t.throws) != null ? p : false, this.setup = (a = t.setup) != null ? a : () => {
395
- }, this.teardown = (l = t.teardown) != null ? l : () => {
396
- }, this.signal && this.signal.addEventListener(
397
- "abort",
398
- () => {
399
- this.dispatchEvent(o("abort"));
400
- },
401
- { once: true }
402
- );
403
- }
404
- runTask(t) {
405
- var e;
406
- return (e = this.signal) != null && e.aborted ? t : t.run();
407
- }
408
- /**
409
- * run the added tasks that were registered using the
410
- * {@link add} method.
411
- * Note: This method does not do any warmup. Call {@link warmup} for that.
412
- */
413
- async run() {
414
- if (this.concurrency === "bench")
415
- return this.runConcurrently(this.threshold, this.concurrency);
416
- this.dispatchEvent(o("start"));
417
- let t = [];
418
- for (let e of [...this._tasks.values()])
419
- t.push(await this.runTask(e));
420
- return this.dispatchEvent(o("complete")), t;
421
- }
422
- /**
423
- * See Bench.{@link concurrency}
424
- */
425
- async runConcurrently(t = 1 / 0, e = "bench") {
426
- if (this.threshold = t, this.concurrency = e, e === "task")
427
- return this.run();
428
- this.dispatchEvent(o("start"));
429
- let r = y(t), i = [];
430
- for (let h of [...this._tasks.values()])
431
- i.push(r(() => this.runTask(h)));
432
- let c = await Promise.all(i);
433
- return this.dispatchEvent(o("complete")), c;
434
- }
435
- /**
436
- * warmup the benchmark tasks.
437
- * This is not run by default by the {@link run} method.
438
- */
439
- async warmup() {
440
- if (this.concurrency === "bench") {
441
- await this.warmupConcurrently(this.threshold, this.concurrency);
442
- return;
443
- }
444
- this.dispatchEvent(o("warmup"));
445
- for (let [, t] of this._tasks)
446
- await t.warmup();
447
- }
448
- /**
449
- * warmup the benchmark tasks concurrently.
450
- * This is not run by default by the {@link runConcurrently} method.
451
- */
452
- async warmupConcurrently(t = 1 / 0, e = "bench") {
453
- if (this.threshold = t, this.concurrency = e, e === "task") {
454
- await this.warmup();
455
- return;
456
- }
457
- this.dispatchEvent(o("warmup"));
458
- let r = y(t), i = [];
459
- for (let [, c] of this._tasks)
460
- i.push(r(() => c.warmup()));
461
- await Promise.all(i);
462
- }
463
- /**
464
- * reset each task and remove its result
465
- */
466
- reset() {
467
- this.dispatchEvent(o("reset")), this._tasks.forEach((t) => {
468
- t.reset();
469
- });
470
- }
471
- /**
472
- * add a benchmark task to the task map
473
- */
474
- add(t, e, r = {}) {
475
- let i = new b(this, t, e, r);
476
- return this._tasks.set(t, i), this.dispatchEvent(o("add", i)), this;
477
- }
478
- /**
479
- * add a benchmark todo to the todo map
480
- */
481
- // eslint-disable-next-line @typescript-eslint/no-empty-function
482
- todo(t, e = () => {
483
- }, r = {}) {
484
- let i = new b(this, t, e, r);
485
- return this._todos.set(t, i), this.dispatchEvent(o("todo", i)), this;
486
- }
487
- /**
488
- * remove a benchmark task from the task map
489
- */
490
- remove(t) {
491
- let e = this.getTask(t);
492
- return e && (this.dispatchEvent(o("remove", e)), this._tasks.delete(t)), this;
493
- }
494
- addEventListener(t, e, r) {
495
- super.addEventListener(t, e, r);
496
- }
497
- removeEventListener(t, e, r) {
498
- super.removeEventListener(t, e, r);
499
- }
500
- /**
501
- * table of the tasks results
502
- */
503
- table(t) {
504
- return this.tasks.map((e) => {
505
- if (e.result) {
506
- if (e.result.error)
507
- throw e.result.error;
508
- return (t == null ? void 0 : t(e)) || {
509
- "Task Name": e.name,
510
- "ops/sec": e.result.error ? "NaN" : parseInt(e.result.hz.toString(), 10).toLocaleString(),
511
- "Average Time (ns)": e.result.error ? "NaN" : e.result.mean * 1e3 * 1e3,
512
- Margin: e.result.error ? "NaN" : `\xB1${e.result.rme.toFixed(2)}%`,
513
- Samples: e.result.error ? "NaN" : e.result.samples.length
514
- };
515
- }
516
- return null;
517
- });
518
- }
519
- /**
520
- * (getter) tasks results as an array
521
- */
522
- get results() {
523
- return [...this._tasks.values()].map((t) => t.result);
524
- }
525
- /**
526
- * (getter) tasks as an array
527
- */
528
- get tasks() {
529
- return [...this._tasks.values()];
530
- }
531
- get todos() {
532
- return [...this._todos.values()];
533
- }
534
- /**
535
- * get a task based on the task name
536
- */
537
- getTask(t) {
538
- return this._tasks.get(t);
539
- }
540
- };
541
- export {
542
- x as Bench,
543
- b as Task,
544
- U as hrtimeNow,
545
- B as now
546
- };
547
- //# sourceMappingURL=dist-YLEIY3JJ.mjs.map