@mhkeller/layercake-annotations 0.1.1 → 0.2.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.
- package/README.md +8 -0
- package/dist/Static.svelte +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,6 +50,14 @@ pnpm add @mhkeller/layercake-annotations
|
|
|
50
50
|
| `annotations` | `Annotation[]` | `[]` | Array of annotation objects (bindable) |
|
|
51
51
|
| `editable` | `boolean` | `true` | Enable editing. Set `false` for read-only display |
|
|
52
52
|
|
|
53
|
+
**Note:** The `annotations` prop uses Svelte 5's `$bindable` for two-way binding. For edits to persist, the parent component must store annotations in a `$state` variable:
|
|
54
|
+
|
|
55
|
+
```svelte
|
|
56
|
+
let annotations = $state([]); // ✓ edits persist
|
|
57
|
+
let annotations = []; // ✗ edits won't persist
|
|
58
|
+
import annotations from 'annotations.js' // ✗ edits won't persist
|
|
59
|
+
```
|
|
60
|
+
|
|
53
61
|
## Annotation Data Structure
|
|
54
62
|
|
|
55
63
|
```js
|
package/dist/Static.svelte
CHANGED
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
{#snippet defs()}
|
|
15
|
-
|
|
15
|
+
<ArrowheadMarker />
|
|
16
16
|
{/snippet}
|
|
17
17
|
|
|
18
|
-
<Svg {defs}>
|
|
18
|
+
<Svg {defs} pointerEvents={false}>
|
|
19
19
|
<Arrows {annotations} />
|
|
20
20
|
</Svg>
|
|
21
21
|
|
|
22
|
-
<Html>
|
|
22
|
+
<Html pointerEvents={false}>
|
|
23
23
|
<AnnotationsData {annotations} />
|
|
24
24
|
</Html>
|