triiiceratops 0.8.2 → 0.9.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.
- package/dist/components/AnnotationOverlay.svelte +288 -0
- package/dist/components/AnnotationOverlay.svelte.d.ts +3 -0
- package/dist/components/CanvasNavigation.svelte +32 -0
- package/dist/components/CanvasNavigation.svelte.d.ts +11 -0
- package/dist/components/DemoHeader.svelte +703 -0
- package/dist/components/DemoHeader.svelte.d.ts +9 -0
- package/dist/components/FloatingMenu.svelte +208 -0
- package/dist/components/FloatingMenu.svelte.d.ts +3 -0
- package/dist/components/LeftFab.svelte +69 -0
- package/dist/components/LeftFab.svelte.d.ts +3 -0
- package/dist/components/MetadataDialog.svelte +151 -0
- package/dist/components/MetadataDialog.svelte.d.ts +3 -0
- package/dist/components/OSDViewer.svelte +260 -0
- package/dist/components/OSDViewer.svelte.d.ts +8 -0
- package/dist/components/SearchPanel.svelte +150 -0
- package/dist/components/SearchPanel.svelte.d.ts +3 -0
- package/dist/components/ThemeToggle.svelte +118 -0
- package/dist/components/ThemeToggle.svelte.d.ts +3 -0
- package/dist/components/ThumbnailGallery.svelte +601 -0
- package/dist/components/ThumbnailGallery.svelte.d.ts +36 -0
- package/dist/components/TriiiceratopsViewer.svelte +434 -0
- package/dist/components/TriiiceratopsViewer.svelte.d.ts +20 -0
- package/dist/components/TriiiceratopsViewerElement.svelte +139 -0
- package/dist/components/TriiiceratopsViewerElement.svelte.d.ts +27 -0
- package/dist/components/TriiiceratopsViewerElementImage.svelte +143 -0
- package/dist/components/TriiiceratopsViewerElementImage.svelte.d.ts +27 -0
- package/dist/custom-element-image.d.ts +1 -0
- package/dist/custom-element-image.js +2 -0
- package/dist/custom-element.d.ts +1 -0
- package/dist/custom-element.js +3 -0
- package/dist/index.js +9 -4153
- package/dist/plugins/image-manipulation/ImageManipulationPanel.svelte +134 -0
- package/dist/plugins/image-manipulation/ImageManipulationPanel.svelte.d.ts +10 -0
- package/dist/{src/lib/plugins → plugins}/image-manipulation/ImageManipulationPlugin.svelte.d.ts +2 -2
- package/dist/plugins/image-manipulation/ImageManipulationPlugin.svelte.js +122 -0
- package/dist/{src/lib/plugins → plugins}/image-manipulation/filters.d.ts +1 -1
- package/dist/plugins/image-manipulation/filters.js +48 -0
- package/dist/plugins/image-manipulation/index.js +2 -0
- package/dist/plugins/image-manipulation/types.js +7 -0
- package/dist/state/i18n.svelte.d.ts +4 -0
- package/dist/state/i18n.svelte.js +18 -0
- package/dist/state/manifests.svelte.js +210 -0
- package/dist/state/manifests.test.d.ts +1 -0
- package/dist/state/manifests.test.js +242 -0
- package/dist/{src/lib/state → state}/viewer.svelte.d.ts +4 -4
- package/dist/state/viewer.svelte.js +693 -0
- package/dist/theme/colorUtils.js +196 -0
- package/dist/theme/colorUtils.test.d.ts +1 -0
- package/dist/theme/colorUtils.test.js +90 -0
- package/dist/theme/index.js +52 -0
- package/dist/{src/lib/theme → theme}/themeManager.d.ts +4 -1
- package/dist/theme/themeManager.js +177 -0
- package/dist/theme/types.js +40 -0
- package/dist/triiiceratops-bundle.js +4676 -0
- package/dist/types/config.js +1 -0
- package/dist/{src/lib/types → types}/plugin.d.ts +3 -3
- package/dist/types/plugin.js +36 -0
- package/dist/utils/annotationAdapter.js +354 -0
- package/dist/utils/annotationAdapter.test.d.ts +1 -0
- package/dist/utils/annotationAdapter.test.js +91 -0
- package/package.json +6 -5
- package/dist/plugin-CHYleMsW.js +0 -538
- package/dist/plugins/image-manipulation.js +0 -411
- package/dist/src/lib/components/AnnotationOverlay.svelte.d.ts +0 -1
- package/dist/src/lib/components/CanvasNavigation.svelte.d.ts +0 -1
- package/dist/src/lib/components/FloatingMenu.svelte.d.ts +0 -1
- package/dist/src/lib/components/LeftFab.svelte.d.ts +0 -1
- package/dist/src/lib/components/MetadataDialog.svelte.d.ts +0 -1
- package/dist/src/lib/components/OSDViewer.svelte.d.ts +0 -1
- package/dist/src/lib/components/SearchPanel.svelte.d.ts +0 -1
- package/dist/src/lib/components/ThumbnailGallery.svelte.d.ts +0 -1
- package/dist/src/lib/components/TriiiceratopsViewer.svelte.d.ts +0 -1
- package/dist/src/lib/custom-element-image.d.ts +0 -0
- package/dist/src/lib/custom-element.d.ts +0 -0
- package/dist/src/lib/paraglide/messages/de.d.ts +0 -96
- package/dist/src/lib/paraglide/messages/en.d.ts +0 -96
- package/dist/src/lib/paraglide/messages.d.ts +0 -272
- package/dist/src/lib/paraglide/runtime.d.ts +0 -52
- package/dist/src/lib/plugins/image-manipulation/ImageManipulationPanel.svelte.d.ts +0 -1
- package/dist/src/lib/state/i18n.svelte.d.ts +0 -5
- package/dist/triiiceratops.css +0 -1
- /package/dist/{src/lib/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/lib/plugins → plugins}/image-manipulation/index.d.ts +0 -0
- /package/dist/{src/lib/plugins → plugins}/image-manipulation/types.d.ts +0 -0
- /package/dist/{src/lib/state → state}/manifests.svelte.d.ts +0 -0
- /package/dist/{src/lib/theme → theme}/colorUtils.d.ts +0 -0
- /package/dist/{src/lib/theme → theme}/index.d.ts +0 -0
- /package/dist/{src/lib/theme → theme}/types.d.ts +0 -0
- /package/dist/{src/lib/types → types}/config.d.ts +0 -0
- /package/dist/{src/lib/utils → utils}/annotationAdapter.d.ts +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
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>
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './components/TriiiceratopsViewerElementImage.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './components/TriiiceratopsViewerElement.svelte';
|