@phun-ky/arclace 0.3.0 → 1.1.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/CHANGELOG.md +35 -0
- package/README.md +90 -14
- package/dist/arclace.d.ts +2 -1
- package/dist/arclace.js +334 -304
- package/dist/arclace.js.map +1 -1
- package/dist/arclace.umd.cjs +1 -1
- package/dist/arclace.umd.cjs.map +1 -1
- package/dist/style.css +18 -6
- package/package.json +6 -3
- package/src/Connection.ts +57 -6
- package/src/style.css +18 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.0](https://github.com/phun-ky/arclace/compare/1.0.0...1.1.0) (2026-11-23)
|
|
4
|
+
|
|
5
|
+
### Tasks
|
|
6
|
+
|
|
7
|
+
* 🤖 bump rollup from 4.67.4 to 4.67.5 in the minor-and-patch group ([e896761](https://github.com/phun-ky/arclace/commit/e896761322a7b50bb28307bf7347e110b18a7a4a))
|
|
8
|
+
* 🤖 ignore unfixable dev-dependency advisories in osv-scanner ([2121472](https://github.com/phun-ky/arclace/commit/2121472ccb0424aa1927531e7d917cf6aa37750c))
|
|
9
|
+
* 🤖 only ignore advisories present in the lockfile ([0e57eb9](https://github.com/phun-ky/arclace/commit/0e57eb948439e737bda2279fcc9f8fee152250c0))
|
|
10
|
+
* 🤖 update typescript to 6.0 ([ce09299](https://github.com/phun-ky/arclace/commit/ce09299d87349c239040bdd2c54fe6d232e3e10a))
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* ✏️ give the styling examples their markup ([90e5174](https://github.com/phun-ky/arclace/commit/90e5174498cbec917c322607e61d7b9880866449))
|
|
15
|
+
* ✏️ remove the backdrop behind the hero copy ([bf3eaae](https://github.com/phun-ky/arclace/commit/bf3eaae49010e88d8ec5c5109da61fa631ddf814))
|
|
16
|
+
* ✏️ zoom the playground from the centre ([e32e930](https://github.com/phun-ky/arclace/commit/e32e9304b2c82d2706ab6b8d98f8658b32f60ce1)), closes [#78](https://github.com/phun-ky/arclace/issues/78)
|
|
17
|
+
|
|
18
|
+
### Feature
|
|
19
|
+
|
|
20
|
+
* 🎸 draw a styleable background behind labels ([92ad7d3](https://github.com/phun-ky/arclace/commit/92ad7d3a4bdcc2c6fc60a6a8696df3740caaa11f))
|
|
21
|
+
|
|
22
|
+
## [1.0.0](https://github.com/phun-ky/arclace/compare/0.3.0...1.0.0) (2026-11-04)
|
|
23
|
+
|
|
24
|
+
### Documentation
|
|
25
|
+
|
|
26
|
+
* ✏️ 1.0 release notes, banners and policies ([e929cea](https://github.com/phun-ky/arclace/commit/e929ceace112eca7bc265b9bd57210d40a9ed347)), closes [#21](https://github.com/phun-ky/arclace/issues/21)
|
|
27
|
+
* ✏️ a docs site design to match the Bow mark ([a769977](https://github.com/phun-ky/arclace/commit/a769977f01a220e30da64c02422a11775053d838)), closes [#75](https://github.com/phun-ky/arclace/issues/75)
|
|
28
|
+
* ✏️ a logo for Arclace ([84b5dae](https://github.com/phun-ky/arclace/commit/84b5dae26ac836e4369506cd7e76351714386e24)), closes [#73](https://github.com/phun-ky/arclace/issues/73), references [#73](https://github.com/phun-ky/arclace/issues/73)
|
|
29
|
+
* ✏️ meet AA text contrast on the docs site ([793ae66](https://github.com/phun-ky/arclace/commit/793ae66f53f1e999e8d2fdcd7b7f82ae25a14d6e)), closes [#68](https://github.com/phun-ky/arclace/issues/68), references [#99acb2](https://github.com/phun-ky/arclace/issues/99acb2) [#5d747b](https://github.com/phun-ky/arclace/issues/5d747b) [#2865f0](https://github.com/phun-ky/arclace/issues/2865f0) [#f2f6ff](https://github.com/phun-ky/arclace/issues/f2f6ff)
|
|
30
|
+
* ✏️ record signed releases from 0.3.0 on ([7d84dfc](https://github.com/phun-ky/arclace/commit/7d84dfc53074013a9d360bbf08f140a9b8ce0f1b)), closes [#66](https://github.com/phun-ky/arclace/issues/66)
|
|
31
|
+
* ✏️ say how the lines work with assistive technology ([f4b8419](https://github.com/phun-ky/arclace/commit/f4b84197b6f216d76cfda9f9884104555e12b8cf)), closes [#60](https://github.com/phun-ky/arclace/issues/60), references [#68](https://github.com/phun-ky/arclace/issues/68)
|
|
32
|
+
* ✏️ switch the logo to the Bow mark ([9b3f6ac](https://github.com/phun-ky/arclace/commit/9b3f6ac5d57b219b6faa81f702ebd239d99fb33b)), references [#73](https://github.com/phun-ky/arclace/issues/73) [#73](https://github.com/phun-ky/arclace/issues/73)
|
|
33
|
+
|
|
34
|
+
### Refactoring
|
|
35
|
+
|
|
36
|
+
* 💡 share the Chrome renderer between the logo and the banners ([d626118](https://github.com/phun-ky/arclace/commit/d626118eba5efb3e17408e225079c0a634d86037)), references [#21](https://github.com/phun-ky/arclace/issues/21)
|
|
37
|
+
|
|
3
38
|
## [0.3.0](https://github.com/phun-ky/arclace/compare/0.2.0...0.3.0) (2026-11-04)
|
|
4
39
|
|
|
5
40
|
### ⚠ BREAKING CHANGES
|
package/README.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# @phun-ky/arclace
|
|
2
2
|
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/public/logo/banner-dark.png">
|
|
5
|
+
<img alt="Arclace: a tied lace with two loops and two tails, with the tagline: draw SVG lines between DOM elements" src="./docs/public/logo/banner-light.png">
|
|
6
|
+
</picture>
|
|
7
|
+
|
|
3
8
|
[](https://www.bestpractices.dev/projects/16333)
|
|
4
9
|
[](https://scorecard.dev/viewer/?uri=github.com/phun-ky/arclace)
|
|
5
10
|
|
|
6
11
|
> Draw SVG lines between DOM elements.
|
|
7
12
|
|
|
13
|
+
**1.0 is out:** [release notes](https://phun-ky.net/arclace/guide/releases/1.0)
|
|
14
|
+
and [upgrading from 0.x](https://phun-ky.net/arclace/guide/upgrading).
|
|
15
|
+
|
|
8
16
|
Point it at two elements and it draws a line between them: a curve, a straight
|
|
9
17
|
line or an orthogonal "circuit board" line, with optional arrows, labels and
|
|
10
18
|
anchors. The lines follow the elements when they move, resize, scroll or get
|
|
@@ -47,7 +55,7 @@ script tags (see [Without a bundler](#without-a-bundler)).
|
|
|
47
55
|
|
|
48
56
|
```ts
|
|
49
57
|
import { Arclace } from '@phun-ky/arclace';
|
|
50
|
-
// Optional: label
|
|
58
|
+
// Optional: label backgrounds, hollow anchors and the dash animation
|
|
51
59
|
import '@phun-ky/arclace/style.css';
|
|
52
60
|
|
|
53
61
|
const arclace = new Arclace({ container: '#diagram' });
|
|
@@ -89,7 +97,8 @@ const arclace = createConnections(
|
|
|
89
97
|
|
|
90
98
|
Each instance adds one `<svg class="arc-svg">` to its container, absolutely
|
|
91
99
|
positioned over the container's content, and draws every line into it. The
|
|
92
|
-
overlay doesn't block clicks (`pointer-events: none`)
|
|
100
|
+
overlay doesn't block clicks (`pointer-events: none`), and is hidden from
|
|
101
|
+
assistive technology (`aria-hidden`); see [Accessibility](#accessibility).
|
|
93
102
|
|
|
94
103
|
- Put all the elements you connect inside the container. If the container is
|
|
95
104
|
`position: static` it is changed to `position: relative` so the overlay
|
|
@@ -223,17 +232,24 @@ colors all of them:
|
|
|
223
232
|
}
|
|
224
233
|
```
|
|
225
234
|
|
|
226
|
-
`style.css` is optional. It adds a
|
|
227
|
-
`animated` dash animation (turned off with `prefers-reduced-motion`), and
|
|
228
|
-
custom properties:
|
|
229
|
-
|
|
230
|
-
| Property
|
|
231
|
-
|
|
|
232
|
-
| `--arc-color`
|
|
233
|
-
| `--arc-label-color`
|
|
234
|
-
| `--arc-label-
|
|
235
|
-
| `--arc-label-
|
|
236
|
-
| `--arc-
|
|
235
|
+
`style.css` is optional. It adds a background behind labels, hollow anchors and
|
|
236
|
+
the `animated` dash animation (turned off with `prefers-reduced-motion`), and
|
|
237
|
+
these custom properties:
|
|
238
|
+
|
|
239
|
+
| Property | Default |
|
|
240
|
+
| --------------------- | -------------------------- |
|
|
241
|
+
| `--arc-color` | `currentColor` |
|
|
242
|
+
| `--arc-label-color` | `currentColor` |
|
|
243
|
+
| `--arc-label-size` | `12px` |
|
|
244
|
+
| `--arc-label-bg` | `--arc-label-halo`, `#fff` |
|
|
245
|
+
| `--arc-label-border` | `none` |
|
|
246
|
+
| `--arc-label-radius` | `4px` |
|
|
247
|
+
| `--arc-label-padding` | `3px 6px` |
|
|
248
|
+
| `--arc-anchor-fill` | `#fff` |
|
|
249
|
+
|
|
250
|
+
Set `--arc-label-bg` and `--arc-anchor-fill` to the background behind the lines,
|
|
251
|
+
so labels and hollow anchors blend in. `--arc-label-halo` from earlier versions
|
|
252
|
+
still works as the label background.
|
|
237
253
|
|
|
238
254
|
### Clickable lines
|
|
239
255
|
|
|
@@ -247,8 +263,25 @@ clickable, turn pointer events back on for the paths:
|
|
|
247
263
|
}
|
|
248
264
|
```
|
|
249
265
|
|
|
266
|
+
A line can't take keyboard focus and is hidden from screen readers, so make a
|
|
267
|
+
click on it a shortcut for a control that is in your page anyway, such as a
|
|
268
|
+
button:
|
|
269
|
+
|
|
270
|
+
```html
|
|
271
|
+
<div id="diagram">
|
|
272
|
+
<div class="box" id="a">A</div>
|
|
273
|
+
<div class="box" id="b">B</div>
|
|
274
|
+
<div class="box" id="c">C</div>
|
|
275
|
+
<button type="button" id="details">Show A to B</button>
|
|
276
|
+
</div>
|
|
277
|
+
```
|
|
278
|
+
|
|
250
279
|
```ts
|
|
251
|
-
|
|
280
|
+
const showDetails = () => console.log(connection.id);
|
|
281
|
+
|
|
282
|
+
document.querySelector('#details')?.addEventListener('click', showDetails);
|
|
283
|
+
// The same action for pointer users who click the line
|
|
284
|
+
connection.path.addEventListener('click', showDetails);
|
|
252
285
|
```
|
|
253
286
|
|
|
254
287
|
## Keeping lines in sync
|
|
@@ -280,6 +313,49 @@ useEffect(() => {
|
|
|
280
313
|
}, []);
|
|
281
314
|
```
|
|
282
315
|
|
|
316
|
+
## Accessibility
|
|
317
|
+
|
|
318
|
+
The lines are decorative. The overlay has `aria-hidden="true"`, so screen
|
|
319
|
+
readers don't announce lines, arrows or labels, and a line can't take keyboard
|
|
320
|
+
focus. Whatever a line tells sighted users must also be in your page's own HTML.
|
|
321
|
+
|
|
322
|
+
The simplest way is to connect elements whose markup already says how they
|
|
323
|
+
relate. Lines between the items of an ordered list show a sequence that a screen
|
|
324
|
+
reader reads out as a list of steps:
|
|
325
|
+
|
|
326
|
+
```html
|
|
327
|
+
<ol id="diagram">
|
|
328
|
+
<li class="box" id="a">Build</li>
|
|
329
|
+
<li class="box" id="b">Test</li>
|
|
330
|
+
<li class="box" id="c">Deploy</li>
|
|
331
|
+
</ol>
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
const arclace = new Arclace({ container: '#diagram' });
|
|
336
|
+
|
|
337
|
+
arclace.connect('#a', '#b', { arrow: 'end' });
|
|
338
|
+
arclace.connect('#b', '#c', { arrow: 'end' });
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Beyond that:
|
|
342
|
+
|
|
343
|
+
- **Describe other relationships in text,** for example in a table of what
|
|
344
|
+
connects to what, or in a sentence that `aria-describedby` on a focusable
|
|
345
|
+
element points at.
|
|
346
|
+
- **Repeat labels in the page.** A label is part of the overlay, so its text
|
|
347
|
+
isn't announced either.
|
|
348
|
+
- **Don't tell lines apart by color alone.** Use `dashed`, `arrow` or a label as
|
|
349
|
+
well, and give lines a contrast of at least 3:1 with the background so they
|
|
350
|
+
stay visible with low vision.
|
|
351
|
+
- **Motion:** with the stylesheet, `animated` lines stop moving when the user
|
|
352
|
+
asks for reduced motion (`prefers-reduced-motion`).
|
|
353
|
+
- **Clickable lines** need the same action on a control in the page; see
|
|
354
|
+
[Clickable lines](#clickable-lines).
|
|
355
|
+
|
|
356
|
+
Arclace doesn't add `aria-describedby` or any other attribute to your elements:
|
|
357
|
+
it only changes what it draws.
|
|
358
|
+
|
|
283
359
|
## Development
|
|
284
360
|
|
|
285
361
|
```shell
|
package/dist/arclace.d.ts
CHANGED
|
@@ -191,7 +191,8 @@ declare const DEFAULT_CONNECTION_OPTIONS: Readonly<Required<Omit<ArcConnectionOp
|
|
|
191
191
|
* <g class="arc-connection arc-bezier">
|
|
192
192
|
* <marker class="arc-marker">…</marker> <!-- when `arrow` is set -->
|
|
193
193
|
* <path class="arc-path" />
|
|
194
|
-
* <
|
|
194
|
+
* <rect class="arc-label-bg" /> <!-- when `label` is set -->
|
|
195
|
+
* <text class="arc-label">…</text>
|
|
195
196
|
* <circle class="arc-anchor arc-anchor-start" /> <!-- when `anchors` is set -->
|
|
196
197
|
* <circle class="arc-anchor arc-anchor-end" />
|
|
197
198
|
* </g>
|