triiiceratops 0.10.0 → 0.10.1

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.
@@ -1,4 +1,4 @@
1
- import { a as t } from "./X-DZEgXrJ8.js";
1
+ import { a as t } from "./X-BUzsFa3u.js";
2
2
  const a = (
3
3
  /** @type {(inputs: {}) => LocalizedString} */
4
4
  () => (
@@ -483,7 +483,7 @@
483
483
 
484
484
  <!-- Content (Grid or Horizontal Scroll) -->
485
485
  <div
486
- class="flex-1 p-1 bg-base-100 {isHorizontal
486
+ class="flex-1 px-1 bg-base-100 {isHorizontal
487
487
  ? 'overflow-x-auto overflow-y-hidden h-full'
488
488
  : 'overflow-y-auto overflow-x-hidden'}"
489
489
  >
@@ -493,12 +493,12 @@
493
493
  : 'grid gap-2'}
494
494
  style={isHorizontal
495
495
  ? ''
496
- : 'grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));'}
496
+ : 'grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));'}
497
497
  >
498
498
  {#each thumbnails as thumb}
499
499
  <button
500
500
  class="group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 {isHorizontal
501
- ? 'w-[140px]'
501
+ ? 'w-[90px]'
502
502
  : ''} {viewerState.canvasId === thumb.id
503
503
  ? 'ring-2 ring-primary bg-primary/5'
504
504
  : ''}"
@@ -506,7 +506,7 @@
506
506
  aria-label="Select canvas {thumb.label}"
507
507
  >
508
508
  <div
509
- class="aspect-4/3 bg-base-300 rounded overflow-hidden relative w-full flex items-center justify-center"
509
+ class="aspect-3/4 bg-base-300 rounded overflow-hidden relative w-full flex items-center justify-center"
510
510
  >
511
511
  {#if thumb.src}
512
512
  <img
@@ -176,10 +176,45 @@
176
176
  ),
177
177
  );
178
178
 
179
- let manifestData = $derived(internalViewerState.manifest);
179
+ let manifestData = $derived(internalViewerState.manifestEntry);
180
180
  let canvases = $derived(internalViewerState.canvases);
181
181
  let currentCanvasIndex = $derived(internalViewerState.currentCanvasIndex);
182
182
 
183
+ // Effect to trigger deferred search once manifest is loaded
184
+ $effect(() => {
185
+ if (
186
+ internalViewerState.pendingSearchQuery &&
187
+ manifestData &&
188
+ !manifestData.isFetching &&
189
+ !manifestData.error &&
190
+ manifestData.manifesto
191
+ ) {
192
+ const query = internalViewerState.pendingSearchQuery;
193
+ internalViewerState.pendingSearchQuery = null;
194
+ console.log(
195
+ '[Viewer] Manifest loaded, triggering deferred search:',
196
+ query,
197
+ );
198
+ internalViewerState.search(query);
199
+ }
200
+ });
201
+
202
+ // Auto-select first canvas if none selected
203
+ $effect(() => {
204
+ if (
205
+ canvases &&
206
+ canvases.length > 0 &&
207
+ !internalViewerState.canvasId &&
208
+ !manifestData?.isFetching
209
+ ) {
210
+ console.log(
211
+ '[Viewer] Auto-selecting first canvas:',
212
+ canvases[0].id,
213
+ );
214
+ internalViewerState.setCanvas(canvases[0].id);
215
+ }
216
+ });
217
+
183
218
  let tileSources = $derived.by(() => {
184
219
  if (
185
220
  !canvases ||
@@ -340,7 +375,7 @@
340
375
  >
341
376
  <!-- Gallery (when docked left) -->
342
377
  {#if internalViewerState.showThumbnailGallery && internalViewerState.dockSide === 'left'}
343
- <div class="h-full w-[200px] pointer-events-auto relative">
378
+ <div class="h-full w-[140px] pointer-events-auto relative">
344
379
  <ThumbnailGallery {canvases} />
345
380
  </div>
346
381
  {/if}
@@ -366,7 +401,7 @@
366
401
  <!-- Top Area (Gallery) -->
367
402
  {#if internalViewerState.showThumbnailGallery && internalViewerState.dockSide === 'top'}
368
403
  <div
369
- class="flex-none h-[140px] w-full pointer-events-auto relative z-20"
404
+ class="flex-none h-[160px] w-full pointer-events-auto relative z-20"
370
405
  >
371
406
  <ThumbnailGallery {canvases} />
372
407
  </div>
@@ -399,7 +434,7 @@
399
434
  viewerState={internalViewerState}
400
435
  />
401
436
  {/key}
402
- {:else}
437
+ {:else if manifestData && !manifestData.isFetching && !tileSources}
403
438
  <div
404
439
  class="w-full h-full flex items-center justify-center text-base-content/50"
405
440
  >
@@ -444,7 +479,7 @@
444
479
  <!-- Bottom Area (Gallery) -->
445
480
  {#if internalViewerState.showThumbnailGallery && internalViewerState.dockSide === 'bottom'}
446
481
  <div
447
- class="flex-none h-[140px] w-full pointer-events-auto relative z-20"
482
+ class="flex-none h-[160px] w-full pointer-events-auto relative z-20"
448
483
  >
449
484
  <ThumbnailGallery {canvases} />
450
485
  </div>
@@ -480,7 +515,7 @@
480
515
 
481
516
  <!-- Gallery (when docked right) -->
482
517
  {#if internalViewerState.showThumbnailGallery && internalViewerState.dockSide === 'right'}
483
- <div class="h-full w-[200px] pointer-events-auto relative">
518
+ <div class="h-full w-[140px] pointer-events-auto relative">
484
519
  <ThumbnailGallery {canvases} />
485
520
  </div>
486
521
  {/if}
@@ -499,3 +534,33 @@
499
534
  </div>
500
535
  {/if}
501
536
  </div>
537
+
538
+ <style>
539
+ /* Scoped scrollbar styles for the viewer */
540
+ :global(#triiiceratops-viewer *) {
541
+ scrollbar-width: thin;
542
+ scrollbar-color: var(--fallback-bc, oklch(var(--bc) / 0.2)) transparent;
543
+ }
544
+
545
+ :global(#triiiceratops-viewer ::-webkit-scrollbar) {
546
+ width: 4px;
547
+ height: 4px;
548
+ }
549
+
550
+ :global(#triiiceratops-viewer ::-webkit-scrollbar-track) {
551
+ background: transparent;
552
+ }
553
+
554
+ :global(#triiiceratops-viewer ::-webkit-scrollbar-thumb) {
555
+ background-color: var(--fallback-bc, oklch(var(--bc) / 0.2));
556
+ border-radius: 9999px;
557
+ }
558
+
559
+ :global(#triiiceratops-viewer ::-webkit-scrollbar-thumb:hover) {
560
+ background-color: var(--fallback-bc, oklch(var(--bc) / 0.4));
561
+ }
562
+
563
+ :global(#triiiceratops-viewer ::-webkit-scrollbar-corner) {
564
+ background: transparent;
565
+ }
566
+ </style>
@@ -1,4 +1,4 @@
1
- import { a as t } from "./X-DZEgXrJ8.js";
1
+ import { a as t } from "./X-BUzsFa3u.js";
2
2
  const s = (
3
3
  /** @type {(inputs: {}) => LocalizedString} */
4
4
  () => (
@@ -4,10 +4,10 @@ var nt = (s, e, t) => Mf(s, typeof e != "symbol" ? e + "" : e, t);
4
4
  import "svelte/internal/disclose-version";
5
5
  import * as d from "svelte/internal/client";
6
6
  import { getContext as Rf, onMount as If, onDestroy as Cf } from "svelte";
7
- import { m as xl, g as as, l as Pf, s as Df, X as bl, c as Lf, V as Of } from "../X-DZEgXrJ8.js";
7
+ import { m as xl, g as as, l as Pf, s as Df, X as bl, c as Lf, V as Of } from "../X-BUzsFa3u.js";
8
8
  import Hs from "openseadragon";
9
- import { A as Bf } from "../ArrowCounterClockwise-aFffCOKw.js";
10
- import { q as Nf, h as Ff, c as kf, j as Uf, k as $f, t as Gf, u as Hf, v as Vf, r as Xf, s as zf, m as jf, i as Yf, g as Wf, a as Zf, n as qf, f as Kf, e as Jf, b as Qf, d as ep, o as tp, l as sp, p as ip } from "../annotation_tool_point-CZKsj4Nk.js";
9
+ import { A as Bf } from "../ArrowCounterClockwise-C6n_F9YZ.js";
10
+ import { q as Nf, h as Ff, c as kf, j as Uf, k as $f, t as Gf, u as Hf, v as Vf, r as Xf, s as zf, m as jf, i as Yf, g as Wf, a as Zf, n as qf, f as Kf, e as Jf, b as Qf, d as ep, o as tp, l as sp, p as ip } from "../annotation_tool_point-CCJi2I8J.js";
11
11
  import "manifesto.js";
12
12
  var np = Object.defineProperty, rp = (s, e, t) => e in s ? np(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, El = (s, e, t) => rp(s, typeof e != "symbol" ? e + "" : e, t), wl = Object.prototype.hasOwnProperty;
13
13
  function Vs(s, e) {
@@ -1,9 +1,9 @@
1
1
  import "svelte/internal/disclose-version";
2
2
  import * as e from "svelte/internal/client";
3
3
  import { getContext as s0 } from "svelte";
4
- import { l as l0, s as i0, X as n0, c as o0, V as c0, g as v0 } from "../X-DZEgXrJ8.js";
5
- import { A as d0 } from "../ArrowCounterClockwise-aFffCOKw.js";
6
- import { i as _0, a as g0, b as f0, g as u0, c as h0, e as m0, d as p0, f as b0 } from "../image_filters_reset-BEIf-_QA.js";
4
+ import { l as l0, s as i0, X as n0, c as o0, V as c0, g as v0 } from "../X-BUzsFa3u.js";
5
+ import { A as d0 } from "../ArrowCounterClockwise-C6n_F9YZ.js";
6
+ import { i as _0, a as g0, b as f0, g as u0, c as h0, e as m0, d as p0, f as b0 } from "../image_filters_reset-CWe7vTJU.js";
7
7
  const G = {
8
8
  brightness: 100,
9
9
  contrast: 100,
@@ -1,4 +1,4 @@
1
- interface ManifestEntry {
1
+ export interface ManifestEntry {
2
2
  json?: any;
3
3
  manifesto?: any;
4
4
  error?: any;
@@ -14,10 +14,10 @@ export declare class ManifestsState {
14
14
  getUserAnnotations(manifestId: string, canvasId: string): any[];
15
15
  fetchManifest(manifestId: string): Promise<void>;
16
16
  getManifest(manifestId: string): any;
17
+ getManifestEntry(manifestId: string): ManifestEntry | undefined;
17
18
  fetchAnnotationList(url: string): Promise<void>;
18
19
  getCanvases(manifestId: string): any;
19
20
  getAnnotations(manifestId: string, canvasId: string): any[];
20
21
  manualGetAnnotations(manifestId: string, canvasId: string): any[];
21
22
  }
22
23
  export declare const manifestsState: ManifestsState;
23
- export {};
@@ -57,6 +57,9 @@ export class ManifestsState {
57
57
  const entry = this.manifests[manifestId];
58
58
  return entry?.manifesto;
59
59
  }
60
+ getManifestEntry(manifestId) {
61
+ return this.manifests[manifestId];
62
+ }
60
63
  async fetchAnnotationList(url) {
61
64
  if (this.manifests[url])
62
65
  return; // Already fetched or fetching
@@ -73,6 +73,7 @@ export declare class ViewerState {
73
73
  private dispatchStateChange;
74
74
  constructor(initialManifestId?: string | null, initialCanvasId?: string | null, initialPlugins?: PluginDef[]);
75
75
  get manifest(): any;
76
+ get manifestEntry(): import("./manifests.svelte.js").ManifestEntry | null | undefined;
76
77
  get canvases(): any;
77
78
  get currentCanvasIndex(): any;
78
79
  get hasNext(): boolean;
@@ -87,6 +88,7 @@ export declare class ViewerState {
87
88
  toggleFullScreen(): void;
88
89
  toggleMetadataDialog(): void;
89
90
  searchQuery: string;
91
+ pendingSearchQuery: string | null;
90
92
  searchResults: any[];
91
93
  isSearching: boolean;
92
94
  showSearchPanel: boolean;
@@ -111,19 +111,16 @@ export class ViewerState {
111
111
  return null;
112
112
  return manifestsState.getManifest(this.manifestId);
113
113
  }
114
+ get manifestEntry() {
115
+ if (!this.manifestId)
116
+ return null;
117
+ return manifestsState.getManifestEntry(this.manifestId);
118
+ }
114
119
  get canvases() {
115
120
  if (!this.manifestId)
116
121
  return [];
117
122
  const canvases = manifestsState.getCanvases(this.manifestId);
118
123
  // Auto-initialize canvasId to first canvas if not set
119
- if (canvases.length > 0 && !this.canvasId) {
120
- // Use setTimeout to avoid updating state during a derived computation
121
- setTimeout(() => {
122
- if (!this.canvasId && canvases.length > 0) {
123
- this.canvasId = canvases[0].id;
124
- }
125
- }, 0);
126
- }
127
124
  return canvases;
128
125
  }
129
126
  get currentCanvasIndex() {
@@ -232,6 +229,7 @@ export class ViewerState {
232
229
  this.showMetadataDialog = !this.showMetadataDialog;
233
230
  }
234
231
  searchQuery = $state('');
232
+ pendingSearchQuery = $state(null);
235
233
  searchResults = $state([]);
236
234
  isSearching = $state(false);
237
235
  showSearchPanel = $state(false);
@@ -262,8 +260,12 @@ export class ViewerState {
262
260
  this.searchResults = [];
263
261
  try {
264
262
  const manifest = this.manifest;
265
- if (!manifest)
266
- throw new Error('No manifest loaded');
263
+ if (!manifest) {
264
+ // Defer search until manifest is loaded
265
+ console.log('[ViewerState] Manifest not loaded, deferring search:', query);
266
+ this.pendingSearchQuery = query;
267
+ return;
268
+ }
267
269
  let service = manifest.getService('http://iiif.io/api/search/1/search') ||
268
270
  manifest.getService('http://iiif.io/api/search/0/search');
269
271
  if (!service) {