triiiceratops 0.9.12 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/ArrowCounterClockwise-aFffCOKw.js +136 -0
  2. package/dist/X-DZEgXrJ8.js +877 -0
  3. package/dist/annotation_tool_point-CZKsj4Nk.js +290 -0
  4. package/dist/components/AnnotationOverlay.svelte +179 -86
  5. package/dist/components/DemoHeader.svelte +12 -0
  6. package/dist/components/LeftFab.svelte +21 -9
  7. package/dist/components/OSDViewer.svelte +24 -4
  8. package/dist/components/SearchPanel.svelte +4 -1
  9. package/dist/components/TriiiceratopsViewer.svelte +114 -47
  10. package/dist/components/TriiiceratopsViewer.svelte.d.ts +5 -5
  11. package/dist/components/TriiiceratopsViewerElement.svelte +2 -2
  12. package/dist/components/TriiiceratopsViewerElement.svelte.d.ts +2 -2
  13. package/dist/custom-element.d.ts +10 -0
  14. package/dist/custom-element.js +13 -0
  15. package/dist/image_filters_reset-BEIf-_QA.js +108 -0
  16. package/dist/index.d.ts +1 -2
  17. package/dist/index.js +0 -1
  18. package/dist/paraglide/messages/_index.d.ts +31 -0
  19. package/dist/paraglide/messages/_index.js +32 -1
  20. package/dist/paraglide/messages/annotation_editor_add_content.d.ts +4 -0
  21. package/dist/paraglide/messages/annotation_editor_add_content.js +34 -0
  22. package/dist/paraglide/messages/annotation_editor_cancel.d.ts +4 -0
  23. package/dist/paraglide/messages/annotation_editor_cancel.js +34 -0
  24. package/dist/paraglide/messages/annotation_editor_create_mode.d.ts +4 -0
  25. package/dist/paraglide/messages/annotation_editor_create_mode.js +34 -0
  26. package/dist/paraglide/messages/annotation_editor_delete.d.ts +4 -0
  27. package/dist/paraglide/messages/annotation_editor_delete.js +34 -0
  28. package/dist/paraglide/messages/annotation_editor_delete_message.d.ts +4 -0
  29. package/dist/paraglide/messages/annotation_editor_delete_message.js +34 -0
  30. package/dist/paraglide/messages/annotation_editor_delete_title.d.ts +4 -0
  31. package/dist/paraglide/messages/annotation_editor_delete_title.js +34 -0
  32. package/dist/paraglide/messages/annotation_editor_delete_tooltip.d.ts +4 -0
  33. package/dist/paraglide/messages/annotation_editor_delete_tooltip.js +34 -0
  34. package/dist/paraglide/messages/annotation_editor_edit_mode.d.ts +4 -0
  35. package/dist/paraglide/messages/annotation_editor_edit_mode.js +34 -0
  36. package/dist/paraglide/messages/annotation_editor_edit_section.d.ts +4 -0
  37. package/dist/paraglide/messages/annotation_editor_edit_section.js +34 -0
  38. package/dist/paraglide/messages/annotation_editor_instruction_create.d.ts +4 -0
  39. package/dist/paraglide/messages/annotation_editor_instruction_create.js +34 -0
  40. package/dist/paraglide/messages/annotation_editor_instruction_edit.d.ts +4 -0
  41. package/dist/paraglide/messages/annotation_editor_instruction_edit.js +34 -0
  42. package/dist/paraglide/messages/annotation_editor_link_placeholder.d.ts +4 -0
  43. package/dist/paraglide/messages/annotation_editor_link_placeholder.js +34 -0
  44. package/dist/paraglide/messages/annotation_editor_redo.d.ts +4 -0
  45. package/dist/paraglide/messages/annotation_editor_redo.js +34 -0
  46. package/dist/paraglide/messages/annotation_editor_save.d.ts +4 -0
  47. package/dist/paraglide/messages/annotation_editor_save.js +34 -0
  48. package/dist/paraglide/messages/annotation_editor_tag_placeholder.d.ts +4 -0
  49. package/dist/paraglide/messages/annotation_editor_tag_placeholder.js +34 -0
  50. package/dist/paraglide/messages/annotation_editor_text_placeholder.d.ts +4 -0
  51. package/dist/paraglide/messages/annotation_editor_text_placeholder.js +34 -0
  52. package/dist/paraglide/messages/annotation_editor_title.d.ts +4 -0
  53. package/dist/paraglide/messages/annotation_editor_title.js +34 -0
  54. package/dist/paraglide/messages/annotation_editor_tool_label.d.ts +4 -0
  55. package/dist/paraglide/messages/annotation_editor_tool_label.js +34 -0
  56. package/dist/paraglide/messages/annotation_editor_undo.d.ts +4 -0
  57. package/dist/paraglide/messages/annotation_editor_undo.js +34 -0
  58. package/dist/paraglide/messages/annotation_tool_point.d.ts +4 -0
  59. package/dist/paraglide/messages/annotation_tool_point.js +34 -0
  60. package/dist/paraglide/messages/annotation_tool_polygon.d.ts +4 -0
  61. package/dist/paraglide/messages/annotation_tool_polygon.js +34 -0
  62. package/dist/paraglide/messages/annotation_tool_rectangle.d.ts +4 -0
  63. package/dist/paraglide/messages/annotation_tool_rectangle.js +34 -0
  64. package/dist/paraglide/messages/image_adjustments_title.d.ts +4 -0
  65. package/dist/paraglide/messages/image_adjustments_title.js +34 -0
  66. package/dist/paraglide/messages/image_filters_brightness.d.ts +4 -0
  67. package/dist/paraglide/messages/image_filters_brightness.js +34 -0
  68. package/dist/paraglide/messages/image_filters_contrast.d.ts +4 -0
  69. package/dist/paraglide/messages/image_filters_contrast.js +34 -0
  70. package/dist/paraglide/messages/image_filters_effects.d.ts +4 -0
  71. package/dist/paraglide/messages/image_filters_effects.js +34 -0
  72. package/dist/paraglide/messages/image_filters_grayscale.d.ts +4 -0
  73. package/dist/paraglide/messages/image_filters_grayscale.js +34 -0
  74. package/dist/paraglide/messages/image_filters_invert.d.ts +4 -0
  75. package/dist/paraglide/messages/image_filters_invert.js +34 -0
  76. package/dist/paraglide/messages/image_filters_reset.d.ts +4 -0
  77. package/dist/paraglide/messages/image_filters_reset.js +34 -0
  78. package/dist/paraglide/messages/image_filters_saturation.d.ts +4 -0
  79. package/dist/paraglide/messages/image_filters_saturation.js +34 -0
  80. package/dist/paraglide/messages/plugins_tooltip.js +1 -1
  81. package/dist/paraglide/messages/settings_transparent_background.d.ts +4 -0
  82. package/dist/paraglide/messages/settings_transparent_background.js +34 -0
  83. package/dist/plugins/annotation-editor/AnnotationEditorController.svelte +166 -0
  84. package/dist/plugins/annotation-editor/AnnotationEditorController.svelte.d.ts +9 -0
  85. package/dist/plugins/annotation-editor/AnnotationEditorPanel.svelte +315 -0
  86. package/dist/plugins/annotation-editor/AnnotationEditorPanel.svelte.d.ts +24 -0
  87. package/dist/plugins/annotation-editor/AnnotationManager.svelte.d.ts +39 -0
  88. package/dist/plugins/annotation-editor/AnnotationManager.svelte.js +433 -0
  89. package/dist/plugins/annotation-editor/adapters/LocalStorageAdapter.d.ts +20 -0
  90. package/dist/plugins/annotation-editor/adapters/LocalStorageAdapter.js +67 -0
  91. package/dist/plugins/annotation-editor/adapters/index.d.ts +2 -0
  92. package/dist/plugins/annotation-editor/adapters/index.js +1 -0
  93. package/dist/plugins/annotation-editor/adapters/types.d.ts +23 -0
  94. package/dist/plugins/annotation-editor/adapters/types.js +1 -0
  95. package/dist/plugins/annotation-editor/iife-entry.d.ts +15 -0
  96. package/dist/plugins/annotation-editor/iife-entry.js +35 -0
  97. package/dist/plugins/annotation-editor/index.d.ts +41 -0
  98. package/dist/plugins/annotation-editor/index.js +57 -0
  99. package/dist/plugins/annotation-editor/loader.svelte.d.ts +7 -0
  100. package/dist/plugins/annotation-editor/loader.svelte.js +32 -0
  101. package/dist/plugins/annotation-editor/types.d.ts +41 -0
  102. package/dist/plugins/annotation-editor/types.js +13 -0
  103. package/dist/plugins/annotation-editor.js +32824 -0
  104. package/dist/plugins/image-manipulation/ImageManipulationController.svelte +54 -0
  105. package/dist/plugins/image-manipulation/ImageManipulationController.svelte.d.ts +6 -0
  106. package/dist/plugins/image-manipulation/ImageManipulationPanel.svelte +19 -9
  107. package/dist/plugins/image-manipulation/ImageManipulationPanel.svelte.d.ts +1 -0
  108. package/dist/plugins/image-manipulation/iife-entry.d.ts +13 -0
  109. package/dist/plugins/image-manipulation/iife-entry.js +17 -0
  110. package/dist/plugins/image-manipulation/index.d.ts +15 -1
  111. package/dist/plugins/image-manipulation/index.js +21 -1
  112. package/dist/plugins/image-manipulation.js +265 -0
  113. package/dist/state/i18n.svelte.js +4 -2
  114. package/dist/state/manifests.svelte.d.ts +5 -0
  115. package/dist/state/manifests.svelte.js +42 -13
  116. package/dist/state/viewer.svelte.d.ts +14 -13
  117. package/dist/state/viewer.svelte.js +63 -74
  118. package/dist/triiiceratops-bundle.js +3208 -3124
  119. package/dist/triiiceratops-element.iife.js +99 -0
  120. package/dist/triiiceratops.css +1 -1
  121. package/dist/types/config.d.ts +5 -0
  122. package/dist/types/plugin.d.ts +21 -62
  123. package/dist/types/plugin.js +1 -23
  124. package/dist/utils/annotationAdapter.d.ts +12 -1
  125. package/dist/utils/annotationAdapter.js +98 -39
  126. package/package.json +13 -6
  127. package/dist/chunks/TriiiceratopsViewer-DpZQA17w.js +0 -10435
  128. package/dist/chunks/openseadragon-5MHeYuQz.js +0 -12427
  129. package/dist/components/TriiiceratopsViewerElementImage.svelte +0 -143
  130. package/dist/components/TriiiceratopsViewerElementImage.svelte.d.ts +0 -27
  131. package/dist/custom-element-image.d.ts +0 -1
  132. package/dist/custom-element-image.js +0 -2
  133. package/dist/plugins/image-manipulation/ImageManipulationPlugin.svelte.d.ts +0 -19
  134. package/dist/plugins/image-manipulation/ImageManipulationPlugin.svelte.js +0 -87
  135. package/dist/triiiceratops-element-image.js +0 -555
  136. package/dist/triiiceratops-element.js +0 -114
@@ -1,143 +0,0 @@
1
- <svelte:options
2
- customElement={{
3
- tag: 'triiiceratops-viewer-image',
4
- shadow: 'open',
5
- props: {
6
- manifestId: {
7
- attribute: 'manifest-id',
8
- type: 'String',
9
- reflect: true,
10
- },
11
- canvasId: {
12
- attribute: 'canvas-id',
13
- type: 'String',
14
- reflect: true,
15
- },
16
- theme: {
17
- attribute: 'theme',
18
- type: 'String',
19
- reflect: true,
20
- },
21
- themeConfig: {
22
- attribute: 'theme-config',
23
- type: 'String',
24
- reflect: false,
25
- },
26
- config: {
27
- attribute: 'config',
28
- type: 'String',
29
- reflect: false,
30
- },
31
- },
32
- }}
33
- />
34
-
35
- <script lang="ts">
36
- import styles from '../../app.css?inline';
37
- import TriiiceratopsViewer from './TriiiceratopsViewer.svelte';
38
- import { ImageManipulationPlugin } from '../plugins/image-manipulation';
39
- import type { TriiiceratopsPlugin } from '../types/plugin';
40
- import type { DaisyUITheme, ThemeConfig } from '../theme/types';
41
- import type { ViewerConfig } from '../types/config';
42
- import { isBuiltInTheme, parseThemeConfig } from '../theme/themeManager';
43
- import type { ViewerState } from '../state/viewer.svelte';
44
-
45
- let {
46
- manifestId = '',
47
- canvasId = '',
48
- plugins = [new ImageManipulationPlugin()],
49
- theme = undefined as string | undefined,
50
- themeConfig = undefined as string | ThemeConfig | undefined,
51
- config = undefined as string | ViewerConfig | undefined,
52
- }: {
53
- manifestId?: string;
54
- canvasId?: string;
55
- plugins?: TriiiceratopsPlugin[];
56
- /**
57
- * Built-in DaisyUI theme name (e.g., 'light', 'dark', 'cupcake').
58
- * When not specified, defaults to 'light' or 'dark' based on prefers-color-scheme.
59
- */
60
- theme?: string;
61
- /**
62
- * Custom theme configuration to override the base theme.
63
- * Can be a JSON string (for HTML attribute) or ThemeConfig object (for JS property).
64
- * @example HTML: theme-config='{"primary":"#3b82f6","radiusBox":"0.5rem"}'
65
- * @example JS: element.themeConfig = { primary: '#3b82f6', radiusBox: '0.5rem' }
66
- */
67
- themeConfig?: string | ThemeConfig;
68
- /**
69
- * Configuration options for the viewer UI.
70
- */
71
- config?: string | ViewerConfig;
72
- } = $props();
73
-
74
- // Reference to host element for event dispatch
75
- let hostElement: HTMLElement;
76
-
77
- // ViewerState from the inner component (via bindable prop)
78
- let internalViewerState: ViewerState | undefined = $state();
79
-
80
- // Track if we've already wired up the event target (only do once)
81
- let eventTargetSet = false;
82
-
83
- // Wire up eventTarget when viewerState is available - only once
84
- $effect(() => {
85
- if (internalViewerState && hostElement && !eventTargetSet) {
86
- eventTargetSet = true;
87
- internalViewerState.setEventTarget(hostElement);
88
- }
89
- });
90
-
91
- // Validate and convert theme string to DaisyUITheme type
92
- let validatedTheme = $derived.by((): DaisyUITheme | undefined => {
93
- if (!theme) return undefined;
94
- if (isBuiltInTheme(theme)) return theme;
95
- console.warn(
96
- `Invalid theme "${theme}". Using system preference fallback.`,
97
- );
98
- return undefined;
99
- });
100
-
101
- // Parse themeConfig if it's a JSON string, pass through if it's already an object
102
- let parsedThemeConfig = $derived.by((): ThemeConfig | undefined => {
103
- if (!themeConfig) return undefined;
104
- if (typeof themeConfig === 'string') {
105
- const parsed = parseThemeConfig(themeConfig);
106
- if (!parsed) {
107
- console.warn(
108
- `Invalid theme-config JSON: "${themeConfig}". Ignoring.`,
109
- );
110
- }
111
- return parsed ?? undefined;
112
- }
113
- return themeConfig;
114
- });
115
-
116
- // Parse config if it's a JSON string, pass through if it's already an object
117
- let parsedConfig = $derived.by((): ViewerConfig | undefined => {
118
- if (!config) return undefined;
119
- if (typeof config === 'string') {
120
- try {
121
- return JSON.parse(config);
122
- } catch (e) {
123
- console.warn(`Invalid config JSON: "${config}". Ignoring.`);
124
- return undefined;
125
- }
126
- }
127
- return config;
128
- });
129
- </script>
130
-
131
- {@html `<style>${styles}</style>`}
132
-
133
- <div bind:this={hostElement} class="w-full h-full">
134
- <TriiiceratopsViewer
135
- {manifestId}
136
- {canvasId}
137
- {plugins}
138
- theme={validatedTheme}
139
- themeConfig={parsedThemeConfig}
140
- config={parsedConfig}
141
- bind:viewerState={internalViewerState}
142
- />
143
- </div>
@@ -1,27 +0,0 @@
1
- import type { TriiiceratopsPlugin } from '../types/plugin';
2
- import type { ThemeConfig } from '../theme/types';
3
- import type { ViewerConfig } from '../types/config';
4
- type $$ComponentProps = {
5
- manifestId?: string;
6
- canvasId?: string;
7
- plugins?: TriiiceratopsPlugin[];
8
- /**
9
- * Built-in DaisyUI theme name (e.g., 'light', 'dark', 'cupcake').
10
- * When not specified, defaults to 'light' or 'dark' based on prefers-color-scheme.
11
- */
12
- theme?: string;
13
- /**
14
- * Custom theme configuration to override the base theme.
15
- * Can be a JSON string (for HTML attribute) or ThemeConfig object (for JS property).
16
- * @example HTML: theme-config='{"primary":"#3b82f6","radiusBox":"0.5rem"}'
17
- * @example JS: element.themeConfig = { primary: '#3b82f6', radiusBox: '0.5rem' }
18
- */
19
- themeConfig?: string | ThemeConfig;
20
- /**
21
- * Configuration options for the viewer UI.
22
- */
23
- config?: string | ViewerConfig;
24
- };
25
- declare const TriiiceratopsViewerElementImage: import("svelte").Component<$$ComponentProps, {}, "">;
26
- type TriiiceratopsViewerElementImage = ReturnType<typeof TriiiceratopsViewerElementImage>;
27
- export default TriiiceratopsViewerElementImage;
@@ -1 +0,0 @@
1
- import './components/TriiiceratopsViewerElementImage.svelte';
@@ -1,2 +0,0 @@
1
- // Entry point for custom element build (Image Plugin version)
2
- import './components/TriiiceratopsViewerElementImage.svelte';
@@ -1,19 +0,0 @@
1
- type OSDViewer = import('openseadragon').OpenSeadragon.Viewer;
2
- import { BasePlugin, type PluginContext } from '../../types/plugin';
3
- import { type ImageFilters } from './types';
4
- export declare class ImageManipulationPlugin extends BasePlugin {
5
- readonly id = "image-manipulation";
6
- readonly name = "Image Manipulation";
7
- readonly version = "1.0.0";
8
- private _panelOpen;
9
- private _filters;
10
- private osd;
11
- onRegister(context: PluginContext): void;
12
- onViewerReady(viewer: OSDViewer): void;
13
- onDestroy(): void;
14
- togglePanel(): void;
15
- setFilters(filters: ImageFilters): void;
16
- resetFilters(): void;
17
- getFilters(): ImageFilters;
18
- }
19
- export {};
@@ -1,87 +0,0 @@
1
- import Sliders from 'phosphor-svelte/lib/Sliders';
2
- import { BasePlugin } from '../../types/plugin';
3
- import { applyFilters, clearFilters, hasActiveFilters } from './filters';
4
- import { DEFAULT_FILTERS } from './types';
5
- import ImageManipulationPanel from './ImageManipulationPanel.svelte';
6
- import { m } from '../../state/i18n.svelte';
7
- export class ImageManipulationPlugin extends BasePlugin {
8
- id = 'image-manipulation';
9
- name = 'Image Manipulation';
10
- version = '1.0.0';
11
- // Reactive state using Svelte 5 runes
12
- _panelOpen = $state(false);
13
- _filters = $state({ ...DEFAULT_FILTERS });
14
- osd = null;
15
- onRegister(context) {
16
- super.onRegister(context);
17
- // Register menu button
18
- context.registerMenuButton({
19
- id: `${this.id}:toggle`,
20
- icon: Sliders,
21
- get tooltip() {
22
- return m.image_adjustments();
23
- },
24
- onClick: () => this.togglePanel(),
25
- isActive: () => this._panelOpen,
26
- activeClass: 'btn-secondary',
27
- order: 50,
28
- });
29
- // Register panel
30
- context.registerPanel({
31
- id: `${this.id}:panel`,
32
- component: ImageManipulationPanel,
33
- position: 'left',
34
- isVisible: () => this._panelOpen,
35
- props: {
36
- filters: this._filters,
37
- onFilterChange: (f) => this.setFilters(f),
38
- onReset: () => this.resetFilters(),
39
- onClose: () => this.togglePanel(),
40
- },
41
- });
42
- }
43
- onViewerReady(viewer) {
44
- this.osd = viewer;
45
- // Apply existing filters if any
46
- if (hasActiveFilters(this._filters)) {
47
- applyFilters(viewer, this._filters);
48
- }
49
- // Re-apply filters when new images unlock (canvas change)
50
- this.osd.addHandler('open', () => {
51
- if (this.osd && hasActiveFilters(this._filters)) {
52
- applyFilters(this.osd, this._filters);
53
- }
54
- });
55
- }
56
- onDestroy() {
57
- if (this.osd) {
58
- clearFilters(this.osd);
59
- }
60
- this.osd = null;
61
- super.onDestroy();
62
- }
63
- // Public API
64
- togglePanel() {
65
- this._panelOpen = !this._panelOpen;
66
- }
67
- setFilters(filters) {
68
- // Mutate properties to maintain reference for bound props
69
- this._filters.brightness = filters.brightness;
70
- this._filters.contrast = filters.contrast;
71
- this._filters.saturation = filters.saturation;
72
- this._filters.invert = filters.invert;
73
- this._filters.grayscale = filters.grayscale;
74
- if (this.osd) {
75
- applyFilters(this.osd, filters);
76
- }
77
- }
78
- resetFilters() {
79
- Object.assign(this._filters, DEFAULT_FILTERS);
80
- if (this.osd) {
81
- clearFilters(this.osd);
82
- }
83
- }
84
- getFilters() {
85
- return { ...this._filters };
86
- }
87
- }