@mhkeller/layercake-annotations 0.2.1 → 0.3.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
CHANGED
|
@@ -70,6 +70,8 @@ import annotations from 'annotations.js' // ✗ edits won't persist
|
|
|
70
70
|
text: 'Peak value', // Annotation text (supports line breaks)
|
|
71
71
|
width: '120px', // Optional: fixed width
|
|
72
72
|
align: 'left', // Optional: 'left', 'center', or 'right'
|
|
73
|
+
style: 'background: yellow;', // Optional: inline CSS styles
|
|
74
|
+
class: 'highlight', // Optional: CSS class name(s)
|
|
73
75
|
arrows: [] // Array of arrows (see below)
|
|
74
76
|
}
|
|
75
77
|
```
|
package/dist/Editor.svelte
CHANGED
|
@@ -206,9 +206,23 @@
|
|
|
206
206
|
|
|
207
207
|
<style>
|
|
208
208
|
.note-listener {
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: 0;
|
|
211
|
+
left: 0;
|
|
209
212
|
width: 100%;
|
|
210
213
|
height: 100%;
|
|
211
214
|
cursor: copy;
|
|
212
215
|
outline: none;
|
|
216
|
+
z-index: 0;
|
|
217
|
+
}
|
|
218
|
+
.layercake-annotations {
|
|
219
|
+
position: relative;
|
|
220
|
+
width: 100%;
|
|
221
|
+
height: 100%;
|
|
222
|
+
z-index: 1;
|
|
223
|
+
pointer-events: none;
|
|
224
|
+
}
|
|
225
|
+
.layercake-annotations :global(.draggable) {
|
|
226
|
+
pointer-events: auto;
|
|
213
227
|
}
|
|
214
228
|
</style>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
style:top={`calc(${$yGet(d)}${units} + ${d.dy || 0}%)`}
|
|
26
26
|
style:width={d.width}
|
|
27
27
|
>
|
|
28
|
-
<div class="layercake-annotation" style:text-align={d.align || 'left'}>
|
|
28
|
+
<div class="layercake-annotation {d.class || ''}" style={d.style} style:text-align={d.align || 'left'}>
|
|
29
29
|
<pre>{getText(d)}</pre>
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
package/dist/types.d.ts
CHANGED
|
@@ -58,6 +58,10 @@ export interface Annotation {
|
|
|
58
58
|
width?: string;
|
|
59
59
|
/** Text alignment: 'left', 'center', or 'right' */
|
|
60
60
|
align?: 'left' | 'center' | 'right';
|
|
61
|
+
/** Custom inline CSS styles (e.g., "background: yellow; padding: 8px;") */
|
|
62
|
+
style?: string;
|
|
63
|
+
/** Custom CSS class name(s) to add to the annotation element */
|
|
64
|
+
class?: string;
|
|
61
65
|
/** Arrows attached to this annotation */
|
|
62
66
|
arrows: Arrow[];
|
|
63
67
|
}
|