@mhkeller/layercake-annotations 0.2.1 → 0.3.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/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
  ```
@@ -206,9 +206,24 @@
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
+ .layercake-annotations :global(.arrow-zone) {
227
+ pointer-events: auto;
213
228
  }
214
229
  </style>
@@ -108,7 +108,7 @@
108
108
  bind:noteDimensions
109
109
  {containerClass}
110
110
  >
111
- <div class="layercake-annotation" data-id={d.id}>
111
+ <div class="layercake-annotation {d.class || ''}" style={d.style} data-id={d.id}>
112
112
  <EditableText
113
113
  bind:text={d.text}
114
114
  bind:isEditable
@@ -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>
@@ -19,8 +19,8 @@ export default function newAnnotation(e, id, { xScale, yScale, config }) {
19
19
  [config.y]: yVal[0],
20
20
  dx: xVal[1],
21
21
  dy: yVal[1],
22
- text: 'Enter your note here...',
23
- width: '168px',
22
+ text: 'New note...',
23
+ width: '91px',
24
24
  arrows: []
25
25
  };
26
26
  }
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhkeller/layercake-annotations",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && pnpm package",