@triiiceratops/plugin-annotation-editor 1.0.0-rc.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/LICENSE +21 -0
- package/dist/AnnotationManager.svelte.d.ts +260 -0
- package/dist/AnnotationStore.svelte.d.ts +211 -0
- package/dist/adapters/LocalStorageAdapter.d.ts +37 -0
- package/dist/adapters/index.d.ts +2 -0
- package/dist/adapters/types.d.ts +78 -0
- package/dist/catalog.d.ts +9 -0
- package/dist/components/viewerControls.d.ts +43 -0
- package/dist/contextKey.d.ts +10 -0
- package/dist/i18n.svelte.d.ts +18 -0
- package/dist/icons.d.ts +29 -0
- package/dist/iife.d.ts +24 -0
- package/dist/iife.js +1273 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +5962 -0
- package/dist/loader.svelte.d.ts +11 -0
- package/dist/mount.svelte.d.ts +3 -0
- package/dist/plugin.d.ts +37 -0
- package/dist/styles.d.ts +11 -0
- package/dist/testing/index.d.ts +48 -0
- package/dist/testing/index.js +158 -0
- package/dist/types.d.ts +177 -0
- package/dist/utils/iiifTargets.d.ts +12 -0
- package/dist/utils/languageMap.d.ts +21 -0
- package/dist/utils/pointMarker.d.ts +27 -0
- package/dist/viewerMirror.svelte.d.ts +35 -0
- package/package.json +78 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte component-context keys the plugin's UI reads.
|
|
3
|
+
*
|
|
4
|
+
* `VIEWER_STATE_KEY` carries the owning viewer's state (the live `ViewerState`,
|
|
5
|
+
* or the reactive mirror `view.mount` builds so the plugin's own Svelte runtime
|
|
6
|
+
* tracks cross-realm state changes) to the controller. It replaces core's
|
|
7
|
+
* internal `VIEWER_STATE_KEY` (the plugin no longer imports core internals); the
|
|
8
|
+
* controller reads it with `getContext(VIEWER_STATE_KEY)` exactly as before.
|
|
9
|
+
*/
|
|
10
|
+
export declare const VIEWER_STATE_KEY: unique symbol;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PluginLocaleService } from '@triiiceratops/plugin-sdk';
|
|
2
|
+
export type TFn = (key: string, params?: Record<string, string | number>) => string;
|
|
3
|
+
/** Context key under which `view.mount` provides the reactive `t`. */
|
|
4
|
+
export declare const LOCALE_T_KEY: unique symbol;
|
|
5
|
+
/** English-catalog resolver used when no host locale service is present. */
|
|
6
|
+
export declare function defaultT(key: string, params?: Record<string, string | number>): string;
|
|
7
|
+
/** Resolve the active `t` for a component (context-provided, else English). */
|
|
8
|
+
export declare function useT(): TFn;
|
|
9
|
+
/**
|
|
10
|
+
* Build a reactive `t` bound to the owning viewer's locale service. The returned
|
|
11
|
+
* `t` reads a `$state` tick bumped on every active-locale change, so template
|
|
12
|
+
* reads re-render when the viewer's locale changes. `unsubscribe` drops the
|
|
13
|
+
* locale subscription (the SDK also auto-releases it on deactivation).
|
|
14
|
+
*/
|
|
15
|
+
export declare function createLocaleBridge(locale: PluginLocaleService): {
|
|
16
|
+
t: TFn;
|
|
17
|
+
unsubscribe: () => void;
|
|
18
|
+
};
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-neutral icon assets for the plugin.
|
|
3
|
+
*
|
|
4
|
+
* `ICON` is the toolbar glyph descriptor produced by the SDK's `svgIcon` — core
|
|
5
|
+
* owns the rendered `<svg>` wrapper (sizing, `currentColor`, a11y). `GLYPHS` are
|
|
6
|
+
* the raw inner-SVG strings the Svelte panel renders inline via `{@html}` (the
|
|
7
|
+
* panel used core's internal `Icon` component before the migration; the glyphs
|
|
8
|
+
* are the same @phosphor-icons/core paths, on the 256×256 viewBox).
|
|
9
|
+
*/
|
|
10
|
+
import { type IconDescriptor } from '@triiiceratops/plugin-sdk';
|
|
11
|
+
/** Shared phosphor viewBox for every glyph below. */
|
|
12
|
+
export declare const VIEW_BOX = "0 0 256 256";
|
|
13
|
+
/** Raw inner-SVG markup (path children) for the glyphs the panel renders. */
|
|
14
|
+
export declare const GLYPHS: {
|
|
15
|
+
readonly PencilSimple: "<path d=\"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z\"/>";
|
|
16
|
+
readonly Warning: "<path d=\"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z\"/>";
|
|
17
|
+
readonly X: "<path d=\"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z\"/>";
|
|
18
|
+
readonly Rectangle: "<path d=\"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H40V56H216V200Z\"/>";
|
|
19
|
+
readonly Polygon: "<path d=\"M230.64,49.36a32,32,0,0,0-45.26,0h0a31.9,31.9,0,0,0-5.16,6.76L152,48.42A32,32,0,0,0,97.37,25.36h0a32.06,32.06,0,0,0-5.76,37.41L57.67,93.32a32.05,32.05,0,0,0-40.31,4.05h0a32,32,0,0,0,42.89,47.41l70,51.36a32,32,0,1,0,47.57-14.69l27.39-77.59q1.38.12,2.76.12a32,32,0,0,0,22.63-54.62Zm-122-12.69h0a16,16,0,1,1,0,22.64A16,16,0,0,1,108.68,36.67Zm-80,94.65a16,16,0,0,1,0-22.64h0a16,16,0,1,1,0,22.64Zm142.65,88a16,16,0,0,1-22.63-22.63h0a16,16,0,1,1,22.63,22.63Zm-8.55-43.18a32,32,0,0,0-23,7.08l-70-51.36a32.17,32.17,0,0,0-1.34-26.65l33.95-30.55a32,32,0,0,0,45.47-10.81L176,71.56a32,32,0,0,0,14.12,27Zm56.56-92.84A16,16,0,1,1,196.7,60.68h0a16,16,0,0,1,22.63,22.63Z\"/>";
|
|
20
|
+
readonly Target: "<path d=\"M221.87,83.16A104.1,104.1,0,1,1,195.67,49l22.67-22.68a8,8,0,0,1,11.32,11.32l-96,96a8,8,0,0,1-11.32-11.32l27.72-27.72a40,40,0,1,0,17.87,31.09,8,8,0,1,1,16-.9,56,56,0,1,1-22.38-41.65L184.3,60.39a87.88,87.88,0,1,0,23.13,29.67,8,8,0,0,1,14.44-6.9Z\"/>";
|
|
21
|
+
readonly ArrowCounterClockwise: "<path d=\"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z\"/>";
|
|
22
|
+
readonly ArrowClockwise: "<path d=\"M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z\"/>";
|
|
23
|
+
readonly Trash: "<path d=\"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z\"/>";
|
|
24
|
+
readonly Plus: "<path d=\"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z\"/>";
|
|
25
|
+
readonly Check: "<path d=\"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z\"/>";
|
|
26
|
+
};
|
|
27
|
+
export type GlyphName = keyof typeof GLYPHS;
|
|
28
|
+
/** The toolbar glyph (pencil), validated by `svgIcon`; core renders the wrapper. */
|
|
29
|
+
export declare const ICON: IconDescriptor;
|
package/dist/iife.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-contained IIFE entry — loadable from a `<script>` tag with no bundler.
|
|
3
|
+
*
|
|
4
|
+
* Loading this bundle bootstraps the `window.Triiiceratops` namespace if absent
|
|
5
|
+
* and registers the plugin factory into `window.Triiiceratops.plugins` (SPEC.md
|
|
6
|
+
* "Browser IIFEs register package-qualified factories in one `window.Triiiceratops`
|
|
7
|
+
* namespace"). It does NOT activate anything — activation is explicit and per
|
|
8
|
+
* viewer:
|
|
9
|
+
*
|
|
10
|
+
* ```html
|
|
11
|
+
* <script src="triiiceratops-element.iife.js"></script>
|
|
12
|
+
* <script src="triiiceratops-plugin-annotation-editor.iife.js"></script>
|
|
13
|
+
* <script>
|
|
14
|
+
* const viewer = document.querySelector('triiiceratops-viewer');
|
|
15
|
+
* viewer.plugins = [
|
|
16
|
+
* window.Triiiceratops.plugins.get('@triiiceratops/plugin-annotation-editor'),
|
|
17
|
+
* ];
|
|
18
|
+
* </script>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* The plugin script may load before OR after core: the registry is bootstrapped
|
|
22
|
+
* order-independently, so both script orders work.
|
|
23
|
+
*/
|
|
24
|
+
export {};
|