@xsynaptic/share-kit 0.1.0 → 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 +24 -7
- package/dist/index.d.mts +8 -1
- package/dist/index.mjs +15 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A `<share-kit>` custom element that opens a share dialog for the current page. Pick a destination like Bluesky, Threads or Instagram, and the dialog trims your caption to that platform's length limit, suggests an image in the right shape, and opens the platform's composer or your device's share sheet. It works without a framework.
|
|
4
4
|
|
|
5
|
-
This is an early release, and the API will change.
|
|
6
|
-
|
|
7
5
|
## Usage
|
|
8
6
|
|
|
9
7
|
```sh
|
|
@@ -34,19 +32,38 @@ const payload: ShareKitPayload = {
|
|
|
34
32
|
</share-kit>
|
|
35
33
|
|
|
36
34
|
<script>
|
|
37
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
defineShareKit,
|
|
37
|
+
shareKitActionEventName,
|
|
38
|
+
shareKitInterfaceIcons,
|
|
39
|
+
} from '@xsynaptic/share-kit';
|
|
40
|
+
import { siBluesky, siThreads } from 'simple-icons';
|
|
38
41
|
|
|
39
42
|
document.addEventListener(shareKitActionEventName, ({ detail }) => console.log(detail));
|
|
40
|
-
defineShareKit(
|
|
43
|
+
defineShareKit({
|
|
44
|
+
icons: {
|
|
45
|
+
...shareKitInterfaceIcons,
|
|
46
|
+
bluesky: siBluesky.path,
|
|
47
|
+
threads: siThreads.path,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
41
50
|
</script>
|
|
42
51
|
```
|
|
43
52
|
|
|
44
|
-
Every action in the dialog fires a `share-kit:action` event.
|
|
53
|
+
Every action in the dialog fires a `share-kit:action` event. Listen in the same script as `defineShareKit()`, before or after the call.
|
|
54
|
+
|
|
55
|
+
If `settings.openHash` matches the URL hash, the dialog opens on load. Pick a fragment that no element id on the page uses, or the page also scrolls there.
|
|
45
56
|
|
|
46
|
-
`
|
|
57
|
+
`strings` in the payload overrides the dialog's wording by key (`ShareKitStringKey`).
|
|
47
58
|
|
|
48
59
|
The dialog downloads the images in `assets` to save, copy or share them, so serve them from the same origin or with CORS headers.
|
|
49
60
|
|
|
61
|
+
## Icons
|
|
62
|
+
|
|
63
|
+
The package ships no brand icons. Pass the ones you show to `defineShareKit({ icons })` as 24×24 SVG path data, keyed by destination id or by `close`, `more` and `qr`. A missing icon falls back to text. Only the first call counts.
|
|
64
|
+
|
|
65
|
+
`shareKitInterfaceIcons` holds the five drawn for this package: `any`, `close`, `messages`, `more` and `qr`. For brand marks, [Simple Icons](https://simpleicons.org) exports each one as `si<Name>` with its path on `.path`, and its current release has every destination but LinkedIn.
|
|
66
|
+
|
|
50
67
|
## Styles
|
|
51
68
|
|
|
52
69
|
```css
|
|
@@ -67,4 +84,4 @@ Chrome 120, Safari 17.2 and Firefox 125 or later.
|
|
|
67
84
|
|
|
68
85
|
## License
|
|
69
86
|
|
|
70
|
-
MIT.
|
|
87
|
+
MIT.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
declare const shareKitStringDefaults: {
|
|
2
2
|
readonly assetCopy: "Copy";
|
|
3
3
|
readonly assetSave: "Save";
|
|
4
4
|
readonly assetShare: "Share";
|
|
@@ -201,6 +201,13 @@ declare const shareDestinations: {
|
|
|
201
201
|
type ShareKitDestinationId = keyof typeof shareDestinations;
|
|
202
202
|
type ShareKitIconName = 'close' | 'more' | 'qr' | ShareKitDestinationId;
|
|
203
203
|
type ShareKitIcons = Partial<Record<ShareKitIconName, string>>;
|
|
204
|
+
export declare const shareKitInterfaceIcons: {
|
|
205
|
+
readonly any: "M3.16 14.47L5.99 11.65A4.5 4.5 0 0 1 12.35 18.01L9.53 20.84A4.5 4.5 0 0 1 3.16 14.47ZM4.58 15.89A2.5 2.5 0 0 0 8.11 19.42L10.94 16.6A2.5 2.5 0 0 0 7.4 13.06ZM11.65 5.99L14.47 3.16A4.5 4.5 0 0 1 20.84 9.53L18.01 12.35A4.5 4.5 0 0 1 11.65 5.99ZM13.06 7.4A2.5 2.5 0 0 0 16.6 10.94L19.42 8.11A2.5 2.5 0 0 0 15.89 4.58ZM8.46 14.12L14.12 8.46L15.54 9.88L9.88 15.54Z";
|
|
206
|
+
readonly close: "M6 7.41 7.41 6 12 10.59 16.59 6 18 7.41 13.41 12 18 16.59 16.59 18 12 13.41 7.41 18 6 16.59 10.59 12Z";
|
|
207
|
+
readonly messages: "M5 4h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2ZM5 6v9h14V6ZM7 17v4l4-4Z";
|
|
208
|
+
readonly more: "M4 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM10 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM16 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0Z";
|
|
209
|
+
readonly qr: "M3 3h7v7H3ZM4.5 4.5v4h4v-4ZM5.5 5.5h2v2h-2ZM14 3h7v7h-7ZM15.5 4.5v4h4v-4ZM16.5 5.5h2v2h-2ZM3 14h7v7H3ZM4.5 15.5v4h4v-4ZM5.5 16.5h2v2h-2ZM14 14h2v2h-2ZM18 14h3v2h-3ZM16 16h2v2h-2ZM14 18h2v3h-2ZM18 18h3v3h-3Z";
|
|
210
|
+
};
|
|
204
211
|
interface ShareKitOptions {
|
|
205
212
|
icons?: ShareKitIcons;
|
|
206
213
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -563,25 +563,6 @@ var ShareFeedback = class {
|
|
|
563
563
|
}, flashDurationMs);
|
|
564
564
|
}
|
|
565
565
|
};
|
|
566
|
-
// src/icons.ts
|
|
567
|
-
const instagram = "M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077";
|
|
568
|
-
const shareKitIcons = {
|
|
569
|
-
any: "M3.16 14.47L5.99 11.65A4.5 4.5 0 0 1 12.35 18.01L9.53 20.84A4.5 4.5 0 0 1 3.16 14.47ZM4.58 15.89A2.5 2.5 0 0 0 8.11 19.42L10.94 16.6A2.5 2.5 0 0 0 7.4 13.06ZM11.65 5.99L14.47 3.16A4.5 4.5 0 0 1 20.84 9.53L18.01 12.35A4.5 4.5 0 0 1 11.65 5.99ZM13.06 7.4A2.5 2.5 0 0 0 16.6 10.94L19.42 8.11A2.5 2.5 0 0 0 15.89 4.58ZM8.46 14.12L14.12 8.46L15.54 9.88L9.88 15.54Z",
|
|
570
|
-
bluesky: "M5.202 2.857C7.954 4.922 10.913 9.11 12 11.358c1.087-2.247 4.046-6.436 6.798-8.501C20.783 1.366 24 .213 24 3.883c0 .732-.42 6.156-.667 7.037-.856 3.061-3.978 3.842-6.755 3.37 4.854.826 6.089 3.562 3.422 6.299-5.065 5.196-7.28-1.304-7.847-2.97-.104-.305-.152-.448-.153-.327 0-.121-.05.022-.153.327-.568 1.666-2.782 8.166-7.847 2.97-2.667-2.737-1.432-5.473 3.422-6.3-2.777.473-5.899-.308-6.755-3.369C.42 10.04 0 4.615 0 3.883c0-3.67 3.217-2.517 5.202-1.026",
|
|
571
|
-
close: "M6 7.41 7.41 6 12 10.59 16.59 6 18 7.41 13.41 12 18 16.59 16.59 18 12 13.41 7.41 18 6 16.59 10.59 12Z",
|
|
572
|
-
facebook: "M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z",
|
|
573
|
-
instagram,
|
|
574
|
-
"instagram-story": instagram,
|
|
575
|
-
linkedin: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",
|
|
576
|
-
mastodon: "M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z",
|
|
577
|
-
messages: "M5 4h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2ZM5 6v9h14V6ZM7 17v4l4-4Z",
|
|
578
|
-
more: "M4 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM10 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM16 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0Z",
|
|
579
|
-
pinterest: "M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z",
|
|
580
|
-
qr: "M3 3h7v7H3ZM4.5 4.5v4h4v-4ZM5.5 5.5h2v2h-2ZM14 3h7v7h-7ZM15.5 4.5v4h4v-4ZM16.5 5.5h2v2h-2ZM3 14h7v7H3ZM4.5 15.5v4h4v-4ZM5.5 16.5h2v2h-2ZM14 14h2v2h-2ZM18 14h3v2h-3ZM16 16h2v2h-2ZM14 18h2v3h-2ZM18 18h3v3h-3Z",
|
|
581
|
-
reddit: "M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z",
|
|
582
|
-
threads: "M12.186 24h-.007c-3.581-.024-6.334-1.205-8.184-3.509C2.35 18.44 1.5 15.586 1.472 12.01v-.017c.03-3.579.879-6.43 2.525-8.482C5.845 1.205 8.6.024 12.18 0h.014c2.746.02 5.043.725 6.826 2.098 1.677 1.29 2.858 3.13 3.509 5.467l-2.04.569c-1.104-3.96-3.898-5.984-8.304-6.015-2.91.022-5.11.936-6.54 2.717C4.307 6.504 3.616 8.914 3.589 12c.027 3.086.718 5.496 2.057 7.164 1.43 1.783 3.631 2.698 6.54 2.717 2.623-.02 4.358-.631 5.8-2.045 1.647-1.613 1.618-3.593 1.09-4.798-.31-.71-.873-1.3-1.634-1.75-.192 1.352-.622 2.446-1.284 3.272-.886 1.102-2.14 1.704-3.73 1.79-1.202.065-2.361-.218-3.259-.801-1.063-.689-1.685-1.74-1.752-2.964-.065-1.19.408-2.285 1.33-3.082.88-.76 2.119-1.207 3.583-1.291a13.853 13.853 0 0 1 3.02.142c-.126-.742-.375-1.332-.75-1.757-.513-.586-1.308-.883-2.359-.89h-.029c-.844 0-1.992.232-2.721 1.32L7.734 7.847c.98-1.454 2.568-2.256 4.478-2.256h.044c3.194.02 5.097 1.975 5.287 5.388.108.046.216.094.321.142 1.49.7 2.58 1.761 3.154 3.07.797 1.82.871 4.79-1.548 7.158-1.85 1.81-4.094 2.628-7.277 2.65Zm1.003-11.69c-.242 0-.487.007-.739.021-1.836.103-2.98.946-2.916 2.143.067 1.256 1.452 1.839 2.784 1.767 1.224-.065 2.818-.543 3.086-3.71a10.5 10.5 0 0 0-2.215-.221z",
|
|
583
|
-
x: "M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z"
|
|
584
|
-
};
|
|
585
566
|
// src/strings.ts
|
|
586
567
|
const shareKitStringDefaults = {
|
|
587
568
|
assetCopy: "Copy",
|
|
@@ -1033,7 +1014,7 @@ function isKeyOf(record, key) {
|
|
|
1033
1014
|
}
|
|
1034
1015
|
const BaseElement = typeof HTMLElement === "undefined" ? Object : HTMLElement;
|
|
1035
1016
|
var ShareKitElement = class extends BaseElement {
|
|
1036
|
-
icons =
|
|
1017
|
+
icons = {};
|
|
1037
1018
|
#abortController;
|
|
1038
1019
|
#actions = {
|
|
1039
1020
|
close: () => {
|
|
@@ -1143,7 +1124,9 @@ var ShareKitElement = class extends BaseElement {
|
|
|
1143
1124
|
this.addEventListener("pointerover", ({ target }) => this.#files?.warm(target), { signal });
|
|
1144
1125
|
window.addEventListener("hashchange", this.#handleHashChange, { signal });
|
|
1145
1126
|
this.querySelector("[data-share-kit-trigger]")?.toggleAttribute("disabled", false);
|
|
1146
|
-
|
|
1127
|
+
queueMicrotask(() => {
|
|
1128
|
+
if (!signal.aborted && isOpenHash(payload.settings.openHash)) this.#open();
|
|
1129
|
+
});
|
|
1147
1130
|
}
|
|
1148
1131
|
disconnectedCallback() {
|
|
1149
1132
|
this.#parts?.dialog.remove();
|
|
@@ -1377,16 +1360,20 @@ var ShareKitElement = class extends BaseElement {
|
|
|
1377
1360
|
};
|
|
1378
1361
|
// src/define.ts
|
|
1379
1362
|
const tagName = "share-kit";
|
|
1380
|
-
function defineShareKit({ icons } = {}) {
|
|
1363
|
+
function defineShareKit({ icons = {} } = {}) {
|
|
1381
1364
|
if (customElements.get(tagName)) return;
|
|
1382
|
-
const resolvedIcons = {
|
|
1383
|
-
...shareKitIcons,
|
|
1384
|
-
...icons
|
|
1385
|
-
};
|
|
1386
1365
|
customElements.define(tagName, class extends ShareKitElement {
|
|
1387
|
-
icons =
|
|
1366
|
+
icons = icons;
|
|
1388
1367
|
});
|
|
1389
1368
|
}
|
|
1390
|
-
|
|
1369
|
+
// src/icons.ts
|
|
1370
|
+
const shareKitInterfaceIcons = {
|
|
1371
|
+
any: "M3.16 14.47L5.99 11.65A4.5 4.5 0 0 1 12.35 18.01L9.53 20.84A4.5 4.5 0 0 1 3.16 14.47ZM4.58 15.89A2.5 2.5 0 0 0 8.11 19.42L10.94 16.6A2.5 2.5 0 0 0 7.4 13.06ZM11.65 5.99L14.47 3.16A4.5 4.5 0 0 1 20.84 9.53L18.01 12.35A4.5 4.5 0 0 1 11.65 5.99ZM13.06 7.4A2.5 2.5 0 0 0 16.6 10.94L19.42 8.11A2.5 2.5 0 0 0 15.89 4.58ZM8.46 14.12L14.12 8.46L15.54 9.88L9.88 15.54Z",
|
|
1372
|
+
close: "M6 7.41 7.41 6 12 10.59 16.59 6 18 7.41 13.41 12 18 16.59 16.59 18 12 13.41 7.41 18 6 16.59 10.59 12Z",
|
|
1373
|
+
messages: "M5 4h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2ZM5 6v9h14V6ZM7 17v4l4-4Z",
|
|
1374
|
+
more: "M4 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM10 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM16 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0Z",
|
|
1375
|
+
qr: "M3 3h7v7H3ZM4.5 4.5v4h4v-4ZM5.5 5.5h2v2h-2ZM14 3h7v7h-7ZM15.5 4.5v4h4v-4ZM16.5 5.5h2v2h-2ZM3 14h7v7H3ZM4.5 15.5v4h4v-4ZM5.5 16.5h2v2h-2ZM14 14h2v2h-2ZM18 14h3v2h-3ZM16 16h2v2h-2ZM14 18h2v3h-2ZM18 18h3v3h-3Z"
|
|
1376
|
+
};
|
|
1377
|
+
export { defineShareKit, serializeShareKitPayload, shareKitActionEventName, shareKitInterfaceIcons };
|
|
1391
1378
|
|
|
1392
1379
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/actions.ts","../src/assets.ts","../src/count.ts","../src/destinations.ts","../src/caption.ts","../src/dom.ts","../src/feedback.ts","../src/icons.ts","../src/strings.ts","../src/payload.ts","../src/qr.ts","../src/render.ts","../src/sync.ts","../src/types.ts","../src/element.ts","../src/define.ts"],"sourcesContent":["const shareCapabilities = ['files', 'link', 'copy-image', 'handheld'] as const;\n\nexport type ShareCapability = (typeof shareCapabilities)[number];\n\nexport interface ShareAssetSource {\n\tfilename: string;\n\tsrc: string;\n\ttype: string;\n}\n\nconst pngType = 'image/png';\n\nfunction canShareFiles() {\n\tif (!('canShare' in navigator)) return false;\n\n\treturn navigator.canShare({ files: [new File([], 'probe.jpg', { type: 'image/jpeg' })] });\n}\n\nfunction canCopyImage() {\n\tif (!('clipboard' in navigator) || !('ClipboardItem' in globalThis)) return false;\n\n\treturn 'supports' in ClipboardItem && ClipboardItem.supports(pngType);\n}\n\nconst capabilityTests = {\n\t'copy-image': canCopyImage,\n\tfiles: canShareFiles,\n\t// A phone's share sheet reaches its apps; a desktop's mostly reaches Mail and AirDrop\n\thandheld: () => matchMedia('(pointer: coarse)').matches,\n\tlink: () => 'share' in navigator,\n} as const satisfies Record<ShareCapability, () => boolean>;\n\nfunction isShareCapability(value: string): value is ShareCapability {\n\treturn shareCapabilities.some((capability) => capability === value);\n}\n\n// A list already on the element wins, so a page can show how the dialog looks on another device\nexport function getShareCapabilities(preset: string | undefined) {\n\tif (preset !== undefined) return preset.split(' ').filter(isShareCapability);\n\n\treturn shareCapabilities.filter((capability) => capabilityTests[capability]());\n}\n\nexport function isDomError(error: unknown, name: string) {\n\treturn error instanceof DOMException && error.name === name;\n}\n\n// `no-cache` revalidates a copy cached without CORS headers, which this fetch would reject\nexport async function fetchFile({ filename, src, type }: ShareAssetSource, signal: AbortSignal) {\n\tconst response = await fetch(src, { cache: 'no-cache', signal });\n\n\tif (!response.ok) throw new Error(`${String(response.status)} for ${src}`);\n\n\treturn new File([await response.blob()], filename, { type });\n}\n\n// `download` is ignored on a cross-origin href, so the file goes through an object URL\nexport function saveFile(file: File) {\n\tconst objectUrl = URL.createObjectURL(file);\n\tconst link = document.createElement('a');\n\n\tlink.download = file.name;\n\tlink.href = objectUrl;\n\tlink.hidden = true;\n\tdocument.body.append(link);\n\tlink.click();\n\tlink.remove();\n\n\treturn objectUrl;\n}\n\n// PNG is the only image type every browser's async clipboard accepts\nasync function toPngBlob(pending: Promise<File | undefined>) {\n\tconst file = await pending;\n\n\tif (!file) throw new Error('The image did not load');\n\n\tconst bitmap = await createImageBitmap(file);\n\tconst canvas = new OffscreenCanvas(bitmap.width, bitmap.height);\n\tconst context = canvas.getContext('2d');\n\n\tif (!context) throw new Error('No 2D context for the PNG conversion');\n\n\tcontext.drawImage(bitmap, 0, 0);\n\tbitmap.close();\n\n\treturn canvas.convertToBlob({ type: pngType });\n}\n\nexport function copyImage(file: Promise<File | undefined>) {\n\treturn navigator.clipboard.write([new ClipboardItem({ [pngType]: toPngBlob(file) })]);\n}\n\nexport function isOpenHash(openHash: string | undefined) {\n\treturn openHash !== undefined && location.hash === `#${openHash}`;\n}\n\n// Replacing the entry keeps the router's state and stops a reload or Back from reopening the dialog\nexport function clearOpenHash(openHash: string | undefined) {\n\tif (!isOpenHash(openHash)) return;\n\n\thistory.replaceState(history.state, '', `${location.pathname}${location.search}`);\n}\n","import type { ShareAssetSource } from './actions.js';\n\nimport { fetchFile, isDomError, saveFile } from './actions.js';\n\nexport type ShareOutcome = 'dismissed' | 'error' | 'retry' | 'saved' | 'shared' | 'unsaved';\n\ninterface ShareAssetFilesOptions {\n\tcanShare: boolean;\n\tgetSource: (tile: HTMLElement) => ShareAssetSource | undefined;\n\tsignal: AbortSignal;\n}\n\nfunction isFile(file: File | undefined): file is File {\n\treturn file !== undefined;\n}\n\nexport class ShareAssetFiles {\n\t#files = new Map<HTMLElement, File>();\n\t#loads = new Map<HTMLElement, Promise<File | undefined>>();\n\t#objectUrls = new Set<string>();\n\t#options: ShareAssetFilesOptions;\n\n\tconstructor(options: ShareAssetFilesOptions) {\n\t\tthis.#options = options;\n\t}\n\n\tdispose() {\n\t\tfor (const objectUrl of this.#objectUrls) URL.revokeObjectURL(objectUrl);\n\n\t\tthis.#objectUrls.clear();\n\t\tthis.#files.clear();\n\t\tthis.#loads.clear();\n\t}\n\n\tload(tile: HTMLElement) {\n\t\tconst pending = this.#loads.get(tile);\n\n\t\tif (pending) return pending;\n\n\t\tconst promise = this.#fetch(tile);\n\n\t\tthis.#loads.set(tile, promise);\n\n\t\treturn promise;\n\t}\n\n\tasync save(tile: HTMLElement): Promise<ShareOutcome> {\n\t\tconst file = await this.load(tile);\n\n\t\treturn file ? this.#saveFiles([file]) : 'unsaved';\n\t}\n\n\tasync share(tiles: Array<HTMLElement>): Promise<ShareOutcome> {\n\t\tconst ready = tiles.map((tile) => this.#files.get(tile));\n\n\t\t// Calling `share()` before any await keeps the tap's user activation valid\n\t\tif (ready.every(isFile)) return this.#shareFiles(ready);\n\n\t\tconst loaded = await Promise.all(tiles.map((tile) => this.load(tile)));\n\n\t\treturn loaded.every(isFile) ? this.#shareFiles(loaded) : 'error';\n\t}\n\n\t// Warming on hover lets the share call still start inside the tap\n\twarm(target: EventTarget | null) {\n\t\tif (!(target instanceof Element)) return;\n\n\t\tconst tile = target\n\t\t\t.closest('[data-share-kit-action=\"share\"]')\n\t\t\t?.closest<HTMLElement>('[data-share-kit-asset]');\n\n\t\tif (tile) void this.load(tile);\n\t}\n\n\t// A failed load is forgotten so the next tap tries again\n\tasync #fetch(tile: HTMLElement) {\n\t\tconst source = this.#options.getSource(tile);\n\n\t\tif (!source) return;\n\n\t\ttry {\n\t\t\tconst file = await fetchFile(source, this.#options.signal);\n\n\t\t\tthis.#files.set(tile, file);\n\n\t\t\treturn file;\n\t\t} catch {\n\t\t\tthis.#loads.delete(tile);\n\n\t\t\treturn;\n\t\t}\n\t}\n\n\t#saveFiles(files: Array<File>): ShareOutcome {\n\t\tfor (const file of files) this.#objectUrls.add(saveFile(file));\n\n\t\treturn 'saved';\n\t}\n\n\tasync #shareFiles(files: Array<File>): Promise<ShareOutcome> {\n\t\tif (!this.#options.canShare || !navigator.canShare({ files })) return this.#saveFiles(files);\n\n\t\ttry {\n\t\t\tawait navigator.share({ files });\n\n\t\t\treturn 'shared';\n\t\t} catch (error) {\n\t\t\tif (isDomError(error, 'AbortError') || this.#options.signal.aborted) return 'dismissed';\n\n\t\t\t// A slow load used up the tap's activation; the files are ready now, so another tap works\n\t\t\tif (isDomError(error, 'NotAllowedError')) return 'retry';\n\n\t\t\treturn this.#saveFiles(files);\n\t\t}\n\t}\n}\n","type ShareCounter = 'graphemes' | 'length' | 'stringz' | 'utf8' | 'weighted';\n\ntype ShareUrlCost = 'actual' | 'fixed' | 'shortened';\n\n// X and Mastodon both charge 23 for any link, whatever its length\nconst urlFixedCost = 23;\n\nconst urlPattern = /https?:\\/\\/[\\w!#$%&'()*+,./:;=?@~-]+/giu;\n\nconst urlTrailingPunctuation = /[!'),.:;?]+$/u;\n\nconst graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\nconst utf8Encoder = new TextEncoder();\n\nconst latinCombiningMarkRanges = [\n\t[0x03_00, 0x03_6f],\n\t[0x1a_b0, 0x1a_ff],\n\t[0x1d_c0, 0x1d_ff],\n\t[0x20_d0, 0x20_ff],\n\t[0xfe_20, 0xfe_2f],\n] as const;\n\n// The `v` flag is newer than `Intl.Segmenter`; without it emoji are charged per code point, which only overcounts\nfunction getEmojiPattern() {\n\ttry {\n\t\treturn new RegExp(String.raw`^\\p{RGI_Emoji}$`, 'v');\n\t} catch {\n\t\treturn;\n\t}\n}\n\nconst emojiPattern = getEmojiPattern();\n\nexport function getGraphemes(text: string) {\n\treturn Array.from(graphemeSegmenter.segment(text), ({ segment }) => segment);\n}\n\n// twitter-text config v3; every code point outside these ranges weighs double\nfunction isLightCodePoint(codePoint: number) {\n\treturn (\n\t\tcodePoint <= 0x10_ff ||\n\t\t(codePoint >= 0x20_00 && codePoint <= 0x20_0d) ||\n\t\t(codePoint >= 0x20_10 && codePoint <= 0x20_1f) ||\n\t\t(codePoint >= 0x20_32 && codePoint <= 0x20_37)\n\t);\n}\n\nfunction getWeightedLength(text: string) {\n\tconst graphemes = getGraphemes(text.normalize('NFC'));\n\tlet total = 0;\n\n\tfor (const grapheme of graphemes) {\n\t\tif (emojiPattern?.test(grapheme)) {\n\t\t\ttotal += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const character of grapheme) {\n\t\t\ttotal += isLightCodePoint(character.codePointAt(0) ?? 0) ? 1 : 2;\n\t\t}\n\t}\n\n\treturn total;\n}\n\nfunction isLatinCombiningMark(codePoint: number) {\n\treturn latinCombiningMarkRanges.some(([start, end]) => codePoint >= start && codePoint <= end);\n}\n\n// Mirrors stringz, which Mastodon's web composer counts with: one per code point, except Latin combining marks; Thai marks count apart\nfunction getStringzLength(text: string) {\n\tlet total = 0;\n\n\tfor (const character of text) {\n\t\tif (!isLatinCombiningMark(character.codePointAt(0) ?? 0)) total += 1;\n\t}\n\n\treturn total;\n}\n\n// Mirrors `toShortUrl` in bluesky-social/social-app, which the composer applies before it counts\nfunction getShortenedUrlLength(url: string) {\n\tif (!URL.canParse(url)) return getGraphemes(url).length;\n\n\tconst { hash, host, pathname, search } = new URL(url);\n\tconst path = `${pathname === '/' ? '' : pathname}${search}${hash}`;\n\n\treturn host.length + Math.min(path.length, 16);\n}\n\nconst textCounters = {\n\tgraphemes: (text: string) => getGraphemes(text).length,\n\tlength: (text: string) => text.length,\n\tstringz: getStringzLength,\n\tutf8: (text: string) => utf8Encoder.encode(text).length,\n\tweighted: getWeightedLength,\n} as const satisfies Record<ShareCounter, (text: string) => number>;\n\nfunction splitLinks(text: string) {\n\tconst links: Array<string> = [];\n\n\tconst rest = text.replaceAll(urlPattern, (match) => {\n\t\tconst trailing = urlTrailingPunctuation.exec(match)?.[0] ?? '';\n\n\t\tlinks.push(match.slice(0, match.length - trailing.length));\n\n\t\treturn trailing;\n\t});\n\n\treturn { links, rest };\n}\n\nexport interface ShareCountRule {\n\tcounter: ShareCounter;\n\turlCost: ShareUrlCost;\n}\n\nexport function countText(text: string, { counter, urlCost }: ShareCountRule) {\n\tconst count = textCounters[counter];\n\n\tif (urlCost === 'actual') return count(text);\n\n\tconst { links, rest } = splitLinks(text);\n\tlet total = count(rest);\n\n\tfor (const link of links) {\n\t\ttotal += urlCost === 'fixed' ? urlFixedCost : getShortenedUrlLength(link);\n\t}\n\n\treturn total;\n}\n","import type { ShareCountRule } from './count.js';\nimport type { ShareKitAssetRole } from './types.js';\n\ntype ShareCaptionShape = 'full' | 'text' | 'title' | 'url';\n\ninterface ShareComposerInput {\n\tmedia: string | undefined;\n\ttext: string;\n\turl: string;\n}\n\nexport interface ShareDestination extends ShareCountRule {\n\tassetRole: Exclude<ShareKitAssetRole, 'photo'>;\n\tgetComposerUrl?: (input: ShareComposerInput) => string | undefined;\n\t// The post is an image, so a phone hands the file to the share sheet rather than opening a composer\n\tisImagePost: boolean;\n\tisLinkOnly?: boolean;\n\tlimit?: number;\n\tshape: ShareCaptionShape;\n}\n\nfunction withQuery(base: string, parameters: Record<string, string | undefined>) {\n\tconst url = new URL(base);\n\n\tfor (const [name, value] of Object.entries(parameters)) {\n\t\tif (value) url.searchParams.set(name, value);\n\t}\n\n\treturn url.href;\n}\n\nexport const shareDestinationAny = 'any';\n\nexport const shareDestinations = {\n\tbluesky: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'graphemes',\n\t\tgetComposerUrl: ({ text }) => withQuery('https://bsky.app/intent/compose', { text }),\n\t\tisImagePost: true,\n\t\tlimit: 300,\n\t\tshape: 'full',\n\t\turlCost: 'shortened',\n\t},\n\tfacebook: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ url }) =>\n\t\t\twithQuery('https://www.facebook.com/sharer/sharer.php', { u: url }),\n\t\tisImagePost: false,\n\t\tisLinkOnly: true,\n\t\tlimit: 63_206,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\tinstagram: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'length',\n\t\tisImagePost: true,\n\t\tlimit: 2200,\n\t\tshape: 'text',\n\t\turlCost: 'actual',\n\t},\n\t'instagram-story': {\n\t\tassetRole: 'story',\n\t\tcounter: 'length',\n\t\tisImagePost: true,\n\t\tshape: 'url',\n\t\turlCost: 'actual',\n\t},\n\tlinkedin: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ url }) =>\n\t\t\twithQuery('https://www.linkedin.com/sharing/share-offsite/', { url }),\n\t\tisImagePost: false,\n\t\tisLinkOnly: true,\n\t\tlimit: 3000,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\t// Each reader posts from their own server, so there is no composer to open\n\tmastodon: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'stringz',\n\t\tisImagePost: true,\n\t\tlimit: 500,\n\t\tshape: 'full',\n\t\turlCost: 'fixed',\n\t},\n\tmessages: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tisImagePost: false,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\tpinterest: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ media, text, url }) =>\n\t\t\twithQuery('https://www.pinterest.com/pin/create/button/', {\n\t\t\t\tdescription: text,\n\t\t\t\tmedia,\n\t\t\t\turl,\n\t\t\t}),\n\t\tisImagePost: false,\n\t\tlimit: 800,\n\t\tshape: 'text',\n\t\turlCost: 'actual',\n\t},\n\treddit: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ text, url }) =>\n\t\t\twithQuery('https://www.reddit.com/submit', { title: text, url }),\n\t\tisImagePost: false,\n\t\tlimit: 300,\n\t\tshape: 'title',\n\t\turlCost: 'actual',\n\t},\n\t[shareDestinationAny]: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tisImagePost: false,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\t// Threads' docs give the limit in characters but count emoji in bytes; bytes is the reading that can't overshoot\n\tthreads: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'utf8',\n\t\tgetComposerUrl: ({ text }) => withQuery('https://www.threads.com/intent/post', { text }),\n\t\tisImagePost: true,\n\t\tlimit: 500,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\tx: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'weighted',\n\t\tgetComposerUrl: ({ text }) => withQuery('https://x.com/intent/tweet', { text }),\n\t\tisImagePost: false,\n\t\tlimit: 280,\n\t\tshape: 'full',\n\t\turlCost: 'fixed',\n\t},\n} as const satisfies Record<string, ShareDestination>;\n\nexport type ShareKitDestinationId = keyof typeof shareDestinations;\n\nexport function isShareDestinationId(id: string): id is ShareKitDestinationId {\n\treturn Object.hasOwn(shareDestinations, id);\n}\n\nexport function getShareDestination(id: ShareKitDestinationId): ShareDestination {\n\treturn shareDestinations[id];\n}\n\nexport function getDestinationUrl(\n\turl: string,\n\tid: ShareKitDestinationId,\n\tutmMedium: string | undefined,\n) {\n\tif (!utmMedium || id === shareDestinationAny || !URL.canParse(url)) return url;\n\n\treturn withQuery(url, { utm_medium: utmMedium, utm_source: id });\n}\n\nexport type SharePrimaryAction =\n\t'copy-caption' | 'open-composer' | 'share-image' | 'share-link' | 'share-text';\n\ninterface SharePrimaryActionInput {\n\tcanShareFiles: boolean;\n\tcanShareText: boolean;\n\thasComposerUrl: boolean;\n\tid: ShareKitDestinationId;\n\tisHandheld: boolean;\n}\n\n// A phone's share sheet reaches the platform's app, where the reader is signed in; its web composer often isn't\nfunction getHandheldAction({\n\tcanShareFiles,\n\tcanShareText,\n\tid,\n}: SharePrimaryActionInput): SharePrimaryAction | undefined {\n\tconst { isImagePost, isLinkOnly } = getShareDestination(id);\n\n\tif (isImagePost && canShareFiles) return 'share-image';\n\tif (isLinkOnly === true && canShareText) return 'share-link';\n\tif (id === shareDestinationAny && canShareText) return 'share-text';\n\n\treturn undefined;\n}\n\nexport function getPrimaryAction(input: SharePrimaryActionInput): SharePrimaryAction {\n\tconst handheldAction = input.isHandheld ? getHandheldAction(input) : undefined;\n\n\tif (handheldAction) return handheldAction;\n\tif (input.hasComposerUrl) return 'open-composer';\n\tif (input.id === 'messages' && input.canShareText) return 'share-text';\n\n\treturn 'copy-caption';\n}\n","import type { ShareKitDestinationId } from './destinations.js';\n\nimport { countText, getGraphemes } from './count.js';\nimport { getShareDestination } from './destinations.js';\n\nexport interface ShareCaptionFields {\n\tdescription?: string | undefined;\n\ttitle: string;\n\turl: string;\n}\n\nexport interface ShareCaption {\n\tcount: number;\n\tisTruncated: boolean;\n\tlimit: number | undefined;\n\ttext: string;\n}\n\nconst separator = '\\n\\n';\n\nconst ellipsis = '…';\n\n// The locale comes from the payload, and a malformed tag like `en_US` throws\nfunction createSegmenter(locale: string, granularity: 'sentence' | 'word') {\n\ttry {\n\t\treturn new Intl.Segmenter(locale, { granularity });\n\t} catch {\n\t\treturn new Intl.Segmenter(undefined, { granularity });\n\t}\n}\n\nfunction getSegmentEnds(text: string, granularity: 'sentence' | 'word', locale: string) {\n\tconst segments = createSegmenter(locale, granularity).segment(text);\n\n\treturn Array.from(segments, ({ index, segment }) => index + segment.length);\n}\n\nfunction getGraphemeEnds(text: string) {\n\tlet end = 0;\n\n\treturn getGraphemes(text).map((grapheme) => (end += grapheme.length));\n}\n\nfunction join(parts: Array<string | undefined>) {\n\treturn parts.filter(Boolean).join(separator);\n}\n\ninterface CutInput {\n\tcanFit: (candidate: string) => boolean;\n\tends: Array<number>;\n\tsuffix: string;\n\ttext: string;\n}\n\n// Counts grow with the cut, so the scan stops at the first miss\nfunction findCut({ canFit, ends, suffix, text }: CutInput) {\n\tlet fitted: string | undefined;\n\n\tfor (const end of ends) {\n\t\tconst cut = text.slice(0, end).trimEnd();\n\n\t\tif (cut.length === 0 || cut.length === text.length) continue;\n\n\t\tconst candidate = `${cut}${suffix}`;\n\n\t\tif (!canFit(candidate)) break;\n\n\t\tfitted = candidate;\n\t}\n\n\treturn fitted;\n}\n\ninterface FitInput {\n\tbody: string | undefined;\n\tcanFit: (text: string) => boolean;\n\tlink: string | undefined;\n\tlocale: string;\n\ttitle: string;\n}\n\nfunction fitBody({ body, canFit, link, locale, title }: FitInput) {\n\tif (!body) return;\n\n\tconst canFitBody = (candidate: string) => canFit(join([title, candidate, link]));\n\n\treturn (\n\t\tfindCut({\n\t\t\tcanFit: canFitBody,\n\t\t\tends: getSegmentEnds(body, 'sentence', locale),\n\t\t\tsuffix: '',\n\t\t\ttext: body,\n\t\t}) ??\n\t\tfindCut({\n\t\t\tcanFit: canFitBody,\n\t\t\tends: getSegmentEnds(body, 'word', locale),\n\t\t\tsuffix: ellipsis,\n\t\t\ttext: body,\n\t\t})\n\t);\n}\n\nfunction fitTitle({ canFit, link, locale, title }: FitInput) {\n\tconst canFitTitle = (candidate: string) => canFit(join([candidate, link]));\n\n\treturn (\n\t\tfindCut({\n\t\t\tcanFit: canFitTitle,\n\t\t\tends: getSegmentEnds(title, 'word', locale),\n\t\t\tsuffix: ellipsis,\n\t\t\ttext: title,\n\t\t}) ??\n\t\tfindCut({ canFit: canFitTitle, ends: getGraphemeEnds(title), suffix: ellipsis, text: title }) ??\n\t\ttitle\n\t);\n}\n\nfunction fitParts(input: FitInput) {\n\tconst { canFit, link, title } = input;\n\tconst body = fitBody(input);\n\n\tif (body) return join([title, body, link]);\n\n\tconst bare = join([title, link]);\n\n\treturn canFit(bare) ? bare : join([fitTitle(input), link]);\n}\n\nexport function countCaption(text: string, id: ShareKitDestinationId) {\n\treturn countText(text, getShareDestination(id));\n}\n\n// The link is kept whole, then the title; the description takes what is left, cut at a sentence end or failing that a word\n// A link too long to leave room for one grapheme of title comes back over the limit; nothing sensible fits\nexport function fitCaption(\n\t{ description, title, url }: ShareCaptionFields,\n\tid: ShareKitDestinationId,\n\tlocale = 'en',\n): ShareCaption {\n\tconst { limit, shape } = getShareDestination(id);\n\tconst link = shape === 'full' ? url : undefined;\n\tconst body = shape === 'title' ? undefined : description?.trim() || undefined;\n\tconst whole = shape === 'url' ? url : join([title, body, link]);\n\tconst canFit = (text: string) => limit === undefined || countCaption(text, id) <= limit;\n\tconst text = canFit(whole) ? whole : fitParts({ body, canFit, link, locale, title });\n\n\treturn { count: countCaption(text, id), isTruncated: text !== whole, limit, text };\n}\n","type Child = Node | string | undefined;\n\ntype Attributes = Record<string, string | undefined>;\n\nexport function createElement<Tag extends keyof HTMLElementTagNameMap>(\n\ttag: Tag,\n\tattributes: Attributes = {},\n\tchildren: Array<Child> = [],\n) {\n\tconst element = document.createElement(tag);\n\n\tfor (const [name, value] of Object.entries(attributes)) {\n\t\tif (value !== undefined) element.setAttribute(name, value);\n\t}\n\n\telement.append(...children.filter((child) => child !== undefined));\n\n\treturn element;\n}\n\nexport function joinClasses(...classes: Array<string | undefined>) {\n\treturn classes.filter(Boolean).join(' ');\n}\n\nconst svgNamespace = 'http://www.w3.org/2000/svg';\n\nexport function createIcon(path: string, size: number) {\n\tconst svg = document.createElementNS(svgNamespace, 'svg');\n\tconst shape = document.createElementNS(svgNamespace, 'path');\n\n\tsvg.setAttribute('aria-hidden', 'true');\n\tsvg.setAttribute('height', String(size));\n\tsvg.setAttribute('viewBox', '0 0 24 24');\n\tsvg.setAttribute('width', String(size));\n\tshape.setAttribute('d', path);\n\tshape.setAttribute('fill', 'currentColor');\n\tsvg.append(shape);\n\n\treturn svg;\n}\n\nfunction isOnBackdrop(dialog: HTMLDialogElement, event: PointerEvent) {\n\tif (event.target !== dialog) return false;\n\n\tconst rect = dialog.getBoundingClientRect();\n\n\treturn (\n\t\tevent.clientX < rect.left ||\n\t\tevent.clientX > rect.right ||\n\t\tevent.clientY < rect.top ||\n\t\tevent.clientY > rect.bottom\n\t);\n}\n\n// Checking both ends of the press means a drag that ends past the edge won't close the dialog\nexport function polyfillLightDismiss(dialog: HTMLDialogElement, signal: AbortSignal) {\n\tif ('closedBy' in HTMLDialogElement.prototype) return;\n\n\tlet isBackdropPress = false;\n\n\tdialog.addEventListener(\n\t\t'pointerdown',\n\t\t(event) => {\n\t\t\tisBackdropPress = isOnBackdrop(dialog, event);\n\t\t},\n\t\t{ signal },\n\t);\n\tdialog.addEventListener(\n\t\t'pointerup',\n\t\t(event) => {\n\t\t\tif (isBackdropPress && isOnBackdrop(dialog, event)) dialog.close();\n\n\t\t\tisBackdropPress = false;\n\t\t},\n\t\t{ signal },\n\t);\n}\n\nexport const radioKeys: Partial<Record<string, (index: number, count: number) => number>> = {\n\tArrowDown: (index, count) => (index + 1) % count,\n\tArrowLeft: (index, count) => (index - 1 + count) % count,\n\tArrowRight: (index, count) => (index + 1) % count,\n\tArrowUp: (index, count) => (index - 1 + count) % count,\n\tEnd: (_index, count) => count - 1,\n\tHome: () => 0,\n};\n","import type { ShareKitStrings } from './strings.js';\n\nimport { copyImage } from './actions.js';\n\nconst statusDurationMs = 4000;\n\nconst flashDurationMs = 2000;\n\nexport class ShareFeedback {\n\t#flashing = new WeakSet<HTMLElement>();\n\t#getStatus: () => HTMLElement | undefined;\n\t#strings: ShareKitStrings;\n\t#timeout: ReturnType<typeof setTimeout> | undefined;\n\n\tconstructor(getStatus: () => HTMLElement | undefined, strings: ShareKitStrings) {\n\t\tthis.#getStatus = getStatus;\n\t\tthis.#strings = strings;\n\t}\n\n\tannounce(message: string) {\n\t\tconst status = this.#getStatus();\n\n\t\tif (!status) return;\n\n\t\tstatus.textContent = message;\n\n\t\tclearTimeout(this.#timeout);\n\t\tthis.#timeout = setTimeout(() => {\n\t\t\tstatus.textContent = '';\n\t\t}, statusDurationMs);\n\t}\n\n\t// Safari only allows the clipboard write if it starts inside the click, before any await\n\tasync copyImage(file: Promise<File | undefined>, button: HTMLElement) {\n\t\ttry {\n\t\t\tawait copyImage(file);\n\t\t\tthis.#flash(button);\n\t\t} catch {\n\t\t\tthis.announce(this.#strings.error);\n\t\t}\n\t}\n\n\tasync copyText(text: string, button?: HTMLElement, fallback?: HTMLTextAreaElement) {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(text);\n\t\t\tthis.#flash(button);\n\t\t} catch {\n\t\t\tfallback?.select();\n\t\t\tthis.announce(fallback ? this.#strings.copyManual : this.#strings.error);\n\t\t}\n\t}\n\n\tdispose() {\n\t\tclearTimeout(this.#timeout);\n\t}\n\n\t#flash(button: HTMLElement | undefined) {\n\t\tthis.announce(this.#strings.copied);\n\n\t\tif (!button || this.#flashing.has(button)) return;\n\n\t\tconst label = button.textContent;\n\n\t\tthis.#flashing.add(button);\n\t\tbutton.textContent = this.#strings.copied;\n\n\t\tsetTimeout(() => {\n\t\t\tbutton.textContent = label;\n\t\t\tthis.#flashing.delete(button);\n\t\t}, flashDurationMs);\n\t}\n}\n","import type { ShareKitDestinationId } from './destinations.js';\n\nexport type ShareKitIconName = 'close' | 'more' | 'qr' | ShareKitDestinationId;\n\nexport type ShareKitIcons = Partial<Record<ShareKitIconName, string>>;\n\nconst instagram =\n\t'M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077';\n\nexport const shareKitIcons = {\n\tany: 'M3.16 14.47L5.99 11.65A4.5 4.5 0 0 1 12.35 18.01L9.53 20.84A4.5 4.5 0 0 1 3.16 14.47ZM4.58 15.89A2.5 2.5 0 0 0 8.11 19.42L10.94 16.6A2.5 2.5 0 0 0 7.4 13.06ZM11.65 5.99L14.47 3.16A4.5 4.5 0 0 1 20.84 9.53L18.01 12.35A4.5 4.5 0 0 1 11.65 5.99ZM13.06 7.4A2.5 2.5 0 0 0 16.6 10.94L19.42 8.11A2.5 2.5 0 0 0 15.89 4.58ZM8.46 14.12L14.12 8.46L15.54 9.88L9.88 15.54Z',\n\tbluesky:\n\t\t'M5.202 2.857C7.954 4.922 10.913 9.11 12 11.358c1.087-2.247 4.046-6.436 6.798-8.501C20.783 1.366 24 .213 24 3.883c0 .732-.42 6.156-.667 7.037-.856 3.061-3.978 3.842-6.755 3.37 4.854.826 6.089 3.562 3.422 6.299-5.065 5.196-7.28-1.304-7.847-2.97-.104-.305-.152-.448-.153-.327 0-.121-.05.022-.153.327-.568 1.666-2.782 8.166-7.847 2.97-2.667-2.737-1.432-5.473 3.422-6.3-2.777.473-5.899-.308-6.755-3.369C.42 10.04 0 4.615 0 3.883c0-3.67 3.217-2.517 5.202-1.026',\n\tclose:\n\t\t'M6 7.41 7.41 6 12 10.59 16.59 6 18 7.41 13.41 12 18 16.59 16.59 18 12 13.41 7.41 18 6 16.59 10.59 12Z',\n\tfacebook:\n\t\t'M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z',\n\tinstagram,\n\t'instagram-story': instagram,\n\tlinkedin:\n\t\t'M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z',\n\tmastodon:\n\t\t'M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z',\n\tmessages:\n\t\t'M5 4h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2ZM5 6v9h14V6ZM7 17v4l4-4Z',\n\tmore: 'M4 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM10 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0ZM16 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0Z',\n\tpinterest:\n\t\t'M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z',\n\tqr: 'M3 3h7v7H3ZM4.5 4.5v4h4v-4ZM5.5 5.5h2v2h-2ZM14 3h7v7h-7ZM15.5 4.5v4h4v-4ZM16.5 5.5h2v2h-2ZM3 14h7v7H3ZM4.5 15.5v4h4v-4ZM5.5 16.5h2v2h-2ZM14 14h2v2h-2ZM18 14h3v2h-3ZM16 16h2v2h-2ZM14 18h2v3h-2ZM18 18h3v3h-3Z',\n\treddit:\n\t\t'M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z',\n\tthreads:\n\t\t'M12.186 24h-.007c-3.581-.024-6.334-1.205-8.184-3.509C2.35 18.44 1.5 15.586 1.472 12.01v-.017c.03-3.579.879-6.43 2.525-8.482C5.845 1.205 8.6.024 12.18 0h.014c2.746.02 5.043.725 6.826 2.098 1.677 1.29 2.858 3.13 3.509 5.467l-2.04.569c-1.104-3.96-3.898-5.984-8.304-6.015-2.91.022-5.11.936-6.54 2.717C4.307 6.504 3.616 8.914 3.589 12c.027 3.086.718 5.496 2.057 7.164 1.43 1.783 3.631 2.698 6.54 2.717 2.623-.02 4.358-.631 5.8-2.045 1.647-1.613 1.618-3.593 1.09-4.798-.31-.71-.873-1.3-1.634-1.75-.192 1.352-.622 2.446-1.284 3.272-.886 1.102-2.14 1.704-3.73 1.79-1.202.065-2.361-.218-3.259-.801-1.063-.689-1.685-1.74-1.752-2.964-.065-1.19.408-2.285 1.33-3.082.88-.76 2.119-1.207 3.583-1.291a13.853 13.853 0 0 1 3.02.142c-.126-.742-.375-1.332-.75-1.757-.513-.586-1.308-.883-2.359-.89h-.029c-.844 0-1.992.232-2.721 1.32L7.734 7.847c.98-1.454 2.568-2.256 4.478-2.256h.044c3.194.02 5.097 1.975 5.287 5.388.108.046.216.094.321.142 1.49.7 2.58 1.761 3.154 3.07.797 1.82.871 4.79-1.548 7.158-1.85 1.81-4.094 2.628-7.277 2.65Zm1.003-11.69c-.242 0-.487.007-.739.021-1.836.103-2.98.946-2.916 2.143.067 1.256 1.452 1.839 2.784 1.767 1.224-.065 2.818-.543 3.086-3.71a10.5 10.5 0 0 0-2.215-.221z',\n\tx: 'M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z',\n} as const satisfies Record<ShareKitIconName, string>;\n","export const shareKitStringDefaults = {\n\tassetCopy: 'Copy',\n\tassetSave: 'Save',\n\tassetShare: 'Share',\n\tcaptionCopy: 'Copy caption',\n\tcaptionOver: '{count} over the limit for {destination}',\n\tcaptionReset: 'Reset',\n\tcaptionTitle: 'Caption',\n\tclose: 'Close',\n\tcopied: 'Copied',\n\tcopyManual: \"Couldn't copy. The caption is selected, so you can copy it yourself.\",\n\t'destination.any': 'Anywhere',\n\t'destination.bluesky': 'Bluesky',\n\t'destination.facebook': 'Facebook',\n\t'destination.instagram': 'Instagram',\n\t'destination.instagram-story': 'Story',\n\t'destination.linkedin': 'LinkedIn',\n\t'destination.mastodon': 'Mastodon',\n\t'destination.messages': 'Messages',\n\t'destination.pinterest': 'Pinterest',\n\t'destination.reddit': 'Reddit',\n\t'destination.threads': 'Threads',\n\t'destination.x': 'X',\n\tdestinationsMore: 'More',\n\tdestinationsTitle: 'Post to',\n\terror: 'Something went wrong. Try saving instead.',\n\t'hint.facebook':\n\t\t'Facebook only takes the link. Your caption is copied, so paste it into your post.',\n\t'hint.instagram':\n\t\t\"Links in Instagram captions aren't clickable. Point people to the link in your bio.\",\n\t'hint.instagram-story': 'Add the link to your Story with a link sticker.',\n\t'hint.linkedin':\n\t\t'LinkedIn only takes the link. Your caption is copied, so paste it into your post.',\n\t'hint.reddit': 'Reddit takes a title and the link.',\n\timagesTitle: 'Images',\n\tlinkCopy: 'Copy link',\n\tlinkTitle: 'Link',\n\tprimaryCopy: 'Copy caption',\n\tprimaryOpen: 'Open {destination}',\n\tprimaryShareImage: 'Share image',\n\tprimaryShareLink: 'Share link',\n\tprimaryShareText: 'Share',\n\tqrAlt: 'QR code for this page',\n\tqrTitle: 'Scan to continue on your phone',\n\tqrToggle: 'Continue on your phone',\n\tretry: 'Ready. Tap again to share.',\n\tsaved: 'Saved',\n\tsaveError: \"Couldn't save. Try again.\",\n\tsuggested: 'Suggested',\n\ttitle: 'Share this page',\n} as const;\n\nexport type ShareKitStringKey = keyof typeof shareKitStringDefaults;\n\nexport type ShareKitStrings = Record<ShareKitStringKey, string>;\n\nexport function isShareStringKey(key: string): key is ShareKitStringKey {\n\treturn Object.hasOwn(shareKitStringDefaults, key);\n}\n\nexport function formatShareString(template: string, values: Record<string, string>) {\n\treturn template.replaceAll(/\\{(\\w+)\\}/gu, (match, name: string) => values[name] ?? match);\n}\n","import type { ShareKitDestinationId } from './destinations.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitPayload, ShareKitSettings } from './types.js';\n\nimport { isShareDestinationId, shareDestinationAny } from './destinations.js';\nimport { isShareStringKey, shareKitStringDefaults } from './strings.js';\n\nfunction isPayload(value: unknown): value is ShareKitPayload {\n\tif (typeof value !== 'object' || value === null) return false;\n\n\tconst { assets, settings, title, url }: Partial<Record<keyof ShareKitPayload, unknown>> = value;\n\n\treturn (\n\t\ttypeof title === 'string' &&\n\t\ttypeof url === 'string' &&\n\t\tArray.isArray(assets) &&\n\t\ttypeof settings === 'object' &&\n\t\tsettings !== null\n\t);\n}\n\n// `<` is escaped so a title or description can't close the script element early\nexport function serializeShareKitPayload(payload: ShareKitPayload) {\n\treturn JSON.stringify(payload).replaceAll('<', String.raw`\\u003c`);\n}\n\nexport function readSharePayload(host: HTMLElement) {\n\tconst source = host.querySelector(':scope > script[type=\"application/json\"]')?.textContent;\n\n\tif (!source) return;\n\n\ttry {\n\t\tconst value: unknown = JSON.parse(source);\n\n\t\treturn isPayload(value) ? value : undefined;\n\t} catch {\n\t\treturn;\n\t}\n}\n\nexport function getShareStrings(overrides: Partial<Record<string, string>> = {}): ShareKitStrings {\n\tconst strings: ShareKitStrings = { ...shareKitStringDefaults };\n\n\tfor (const [key, value] of Object.entries(overrides)) {\n\t\tif (value !== undefined && isShareStringKey(key)) strings[key] = value;\n\t}\n\n\treturn strings;\n}\n\nfunction getIds(value: unknown) {\n\tif (!Array.isArray(value)) return [];\n\n\treturn [...new Set<unknown>(value)].filter(\n\t\t(id): id is ShareKitDestinationId => typeof id === 'string' && isShareDestinationId(id),\n\t);\n}\n\n// The payload arrives as JSON, so ids are checked again; an empty row would leave the radio group unreachable\nexport function getDestinationLists({ destinations, destinationsMore }: ShareKitSettings) {\n\tconst shown = getIds(destinations);\n\tconst main: Array<ShareKitDestinationId> = shown.length > 0 ? shown : [shareDestinationAny];\n\tconst more = getIds(destinationsMore).filter((id) => !main.includes(id));\n\n\treturn { main, more };\n}\n","import type { ShareCapability } from './actions.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitPayload } from './types.js';\n\nimport { createElement, createIcon, polyfillLightDismiss } from './dom.js';\n\ninterface ShareQrInput {\n\tcloseIcon: string | undefined;\n\tid: string;\n\tsignal: AbortSignal;\n\tstrings: Pick<ShareKitStrings, 'close' | 'qrAlt' | 'qrTitle'>;\n\turl: string;\n}\n\nconst iconSize = 24;\n\nconst qrSize = 200;\n\nasync function createQrSource(text: string) {\n\tconst [{ generate }, { toSvgDataURL }] = await Promise.all([\n\t\timport('lean-qr'),\n\t\timport('lean-qr/extras/svg'),\n\t]);\n\n\treturn toSvgDataURL(generate(text), { off: '#ffffff', on: '#000000', pad: 4, scale: 8 });\n}\n\n// Stacks over the share dialog rather than inside it, so opening the code moves nothing beneath\nclass ShareQrDialog {\n\treadonly dialog: HTMLDialogElement;\n\t#image: HTMLImageElement;\n\t#url: string;\n\n\tconstructor({ closeIcon, id, signal, strings, url }: ShareQrInput) {\n\t\tconst titleId = `${id}-title`;\n\n\t\tthis.#url = url;\n\t\tthis.#image = createElement('img', {\n\t\t\talt: strings.qrAlt,\n\t\t\tclass: 'share-kit-qr-image',\n\t\t\theight: String(qrSize),\n\t\t\twidth: String(qrSize),\n\t\t});\n\t\tthis.dialog = createElement(\n\t\t\t'dialog',\n\t\t\t{ 'aria-labelledby': titleId, class: 'share-kit-qr-dialog', closedby: 'any', id },\n\t\t\t[\n\t\t\t\tcreateElement('form', { class: 'share-kit-header', method: 'dialog' }, [\n\t\t\t\t\tcreateElement('h2', { class: 'share-kit-title', id: titleId }, [strings.qrTitle]),\n\t\t\t\t\tcreateElement(\n\t\t\t\t\t\t'button',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'aria-label': strings.close,\n\t\t\t\t\t\t\tclass: 'share-kit-icon-button',\n\t\t\t\t\t\t\ttitle: strings.close,\n\t\t\t\t\t\t\ttype: 'submit',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[closeIcon ? createIcon(closeIcon, iconSize) : '×'],\n\t\t\t\t\t),\n\t\t\t\t]),\n\t\t\t\tthis.#image,\n\t\t\t],\n\t\t);\n\n\t\tpolyfillLightDismiss(this.dialog, signal);\n\t}\n\n\tasync open() {\n\t\tif (!this.#image.getAttribute('src')) this.#image.src = await createQrSource(this.#url);\n\n\t\tthis.dialog.showModal();\n\t}\n}\n\ninterface ShareQrOptions extends Omit<ShareQrInput, 'url'> {\n\tcapabilities: ReadonlySet<ShareCapability>;\n\tpayload: ShareKitPayload;\n}\n\nfunction getQrUrl(url: string, openHash: string | undefined) {\n\tif (!openHash || !URL.canParse(url)) return url;\n\n\tconst target = new URL(url);\n\n\ttarget.hash = openHash;\n\n\treturn target.href;\n}\n\n// A phone is already where the code would lead, so it gets none\nexport function createShareQr({ capabilities, payload, ...input }: ShareQrOptions) {\n\tif (capabilities.has('handheld')) return;\n\n\treturn new ShareQrDialog({ ...input, url: getQrUrl(payload.url, payload.settings.openHash) });\n}\n","import type { ShareCapability } from './actions.js';\nimport type { ShareKitDestinationId } from './destinations.js';\nimport type { ShareKitIcons } from './icons.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitAsset, ShareKitClassRole, ShareKitPayload } from './types.js';\n\nimport { createElement, createIcon, joinClasses } from './dom.js';\n\ninterface RenderInput {\n\tcapabilities: ReadonlySet<ShareCapability>;\n\tdestinations: Array<ShareKitDestinationId>;\n\tdestinationsMore: Array<ShareKitDestinationId>;\n\ticons: ShareKitIcons;\n\tid: string;\n\tpayload: ShareKitPayload;\n\tstrings: ShareKitStrings;\n}\n\ntype RenderContext = RenderInput & {\n\tclassNames: Partial<Record<ShareKitClassRole, string>>;\n};\n\nconst destinationIconSize = 24;\n\ninterface ActionInput {\n\taction: string;\n\tdescribedBy?: string;\n\tlabel: string;\n}\n\nfunction renderAction({ classNames }: RenderContext, { action, describedBy, label }: ActionInput) {\n\treturn createElement(\n\t\t'button',\n\t\t{\n\t\t\t'aria-describedby': describedBy,\n\t\t\tclass: joinClasses('share-kit-action', classNames.action),\n\t\t\t'data-share-kit-action': action,\n\t\t\ttype: 'button',\n\t\t},\n\t\t[label],\n\t);\n}\n\nfunction renderHeading({ classNames }: RenderContext, children: Array<Node | string>, id?: string) {\n\treturn createElement(\n\t\t'h3',\n\t\t{ class: joinClasses('share-kit-heading', classNames.heading), id },\n\t\tchildren,\n\t);\n}\n\ninterface IconButtonInput {\n\taction: string;\n\tattributes?: Record<string, string>;\n\tfallback: string;\n\ticon: string | undefined;\n\tlabel: string;\n}\n\nfunction renderIconButton({ action, attributes, fallback, icon, label }: IconButtonInput) {\n\treturn createElement(\n\t\t'button',\n\t\t{\n\t\t\t...attributes,\n\t\t\t'aria-label': label,\n\t\t\tclass: 'share-kit-icon-button',\n\t\t\t'data-share-kit-action': action,\n\t\t\ttitle: label,\n\t\t\ttype: 'button',\n\t\t},\n\t\t[icon ? createIcon(icon, destinationIconSize) : fallback],\n\t);\n}\n\nfunction renderHeader(context: RenderContext) {\n\tconst { capabilities, icons, id, strings } = context;\n\tconst heading = createElement(\n\t\t'h2',\n\t\t{ class: 'share-kit-title', id: `${id}-title`, tabindex: '-1' },\n\t\t[strings.title],\n\t);\n\tconst qrToggle = capabilities.has('handheld')\n\t\t? undefined\n\t\t: renderIconButton({\n\t\t\t\taction: 'qr',\n\t\t\t\tattributes: { 'aria-haspopup': 'dialog' },\n\t\t\t\tfallback: 'QR',\n\t\t\t\ticon: icons.qr,\n\t\t\t\tlabel: strings.qrToggle,\n\t\t\t});\n\tconst close = renderIconButton({\n\t\taction: 'close',\n\t\tfallback: '×',\n\t\ticon: icons.close,\n\t\tlabel: strings.close,\n\t});\n\n\treturn {\n\t\theader: createElement('header', { class: 'share-kit-header' }, [\n\t\t\theading,\n\t\t\tcreateElement('div', { class: 'share-kit-header-actions' }, [qrToggle, close]),\n\t\t]),\n\t\theading,\n\t};\n}\n\nfunction renderDestination(context: RenderContext, destination: ShareKitDestinationId) {\n\tconst { classNames, icons, strings } = context;\n\tconst icon = icons[destination];\n\n\treturn createElement(\n\t\t'button',\n\t\t{\n\t\t\t'aria-checked': 'false',\n\t\t\tclass: joinClasses('share-kit-destination', classNames.destination),\n\t\t\t'data-share-kit-action': 'destination',\n\t\t\t'data-share-kit-destination': destination,\n\t\t\trole: 'radio',\n\t\t\ttabindex: '-1',\n\t\t\ttype: 'button',\n\t\t},\n\t\t[\n\t\t\ticon ? createIcon(icon, destinationIconSize) : undefined,\n\t\t\tcreateElement('span', {}, [strings[`destination.${destination}`]]),\n\t\t],\n\t);\n}\n\nfunction renderDestinations(context: RenderContext) {\n\tconst { destinations, destinationsMore, icons, id, strings } = context;\n\tconst headingId = `${id}-destinations`;\n\tconst more =\n\t\tdestinationsMore.length > 0\n\t\t\t? createElement(\n\t\t\t\t\t'button',\n\t\t\t\t\t{\n\t\t\t\t\t\tclass: joinClasses('share-kit-destination', context.classNames.destination),\n\t\t\t\t\t\t'data-share-kit-action': 'more',\n\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\ticons.more ? createIcon(icons.more, destinationIconSize) : undefined,\n\t\t\t\t\t\tcreateElement('span', {}, [strings.destinationsMore]),\n\t\t\t\t\t],\n\t\t\t\t)\n\t\t\t: undefined;\n\tconst extra = destinationsMore.map((destination) => {\n\t\tconst button = renderDestination(context, destination);\n\n\t\tbutton.hidden = true;\n\n\t\treturn button;\n\t});\n\tconst group = createElement(\n\t\t'div',\n\t\t{ 'aria-labelledby': headingId, class: 'share-kit-destinations', role: 'radiogroup' },\n\t\t[...destinations.map((destination) => renderDestination(context, destination)), ...extra],\n\t);\n\n\treturn {\n\t\tmore,\n\t\tsection: createElement('section', { class: 'share-kit-section' }, [\n\t\t\trenderHeading(context, [strings.destinationsTitle], headingId),\n\t\t\tcreateElement('div', { class: 'share-kit-destinations-row' }, [group, more]),\n\t\t]),\n\t};\n}\n\nfunction renderCaption(context: RenderContext) {\n\tconst { classNames, id, payload, strings } = context;\n\tconst captionId = `${id}-caption`;\n\tconst countId = `${id}-count`;\n\tconst hintId = `${id}-hint`;\n\tconst caption = createElement('textarea', {\n\t\t'aria-describedby': `${countId} ${hintId}`,\n\t\tclass: joinClasses('share-kit-caption', classNames.input),\n\t\tdir: 'auto',\n\t\tid: captionId,\n\t\tlang: payload.locale,\n\t\trows: '6',\n\t});\n\tconst count = createElement('span', { class: 'share-kit-count', id: countId });\n\tconst captionCopy = renderAction(context, { action: 'copy-caption', label: strings.captionCopy });\n\tconst hint = createElement('p', { class: 'share-kit-hint', id: hintId });\n\n\treturn {\n\t\tcaption,\n\t\tcaptionCopy,\n\t\tcount,\n\t\thint,\n\t\tsection: createElement('section', { class: 'share-kit-section' }, [\n\t\t\trenderHeading(context, [createElement('label', { for: captionId }, [strings.captionTitle])]),\n\t\t\tcaption,\n\t\t\tcreateElement('div', { class: 'share-kit-caption-meta' }, [\n\t\t\t\tcount,\n\t\t\t\tcreateElement('span', { class: 'share-kit-actions' }, [\n\t\t\t\t\trenderAction(context, { action: 'reset', label: strings.captionReset }),\n\t\t\t\t\tcaptionCopy,\n\t\t\t\t]),\n\t\t\t]),\n\t\t\thint,\n\t\t]),\n\t};\n}\n\ninterface TileInput {\n\tactions: Array<[action: string, label: string]>;\n\tasset: ShareKitAsset;\n\tkey: string;\n}\n\nfunction renderTile(context: RenderContext, { actions, asset, key }: TileInput) {\n\tconst labelId = `${context.id}-asset-${key}`;\n\tconst badge = createElement('span', { class: 'share-kit-badge' }, [context.strings.suggested]);\n\n\tbadge.hidden = true;\n\n\treturn createElement(\n\t\t'li',\n\t\t{\n\t\t\tclass: 'share-kit-tile',\n\t\t\t'data-share-kit-asset': key,\n\t\t\t'data-share-kit-role': asset.role,\n\t\t},\n\t\t[\n\t\t\tcreateElement('img', {\n\t\t\t\talt: asset.alt,\n\t\t\t\tclass: 'share-kit-preview',\n\t\t\t\tdecoding: 'async',\n\t\t\t\theight: String(asset.height),\n\t\t\t\tloading: 'lazy',\n\t\t\t\tsrc: asset.previewSrc,\n\t\t\t\twidth: String(asset.width),\n\t\t\t}),\n\t\t\tcreateElement('div', { class: 'share-kit-tile-label' }, [\n\t\t\t\tcreateElement('span', { id: labelId }, [asset.label]),\n\t\t\t\tbadge,\n\t\t\t]),\n\t\t\tcreateElement(\n\t\t\t\t'div',\n\t\t\t\t{ class: 'share-kit-actions' },\n\t\t\t\tactions.map(([action, label]) =>\n\t\t\t\t\trenderAction(context, { action, describedBy: labelId, label }),\n\t\t\t\t),\n\t\t\t),\n\t\t],\n\t);\n}\n\nfunction getAssetActions({ capabilities, strings }: RenderContext) {\n\tconst actions: Array<[string, string]> = [];\n\tconst canShare = capabilities.has('files');\n\n\tif (canShare) actions.push(['share', strings.assetShare]);\n\n\t// On a phone the share sheet already offers copying\n\tif (capabilities.has('copy-image') && !(canShare && capabilities.has('handheld'))) {\n\t\tactions.push(['copy', strings.assetCopy]);\n\t}\n\n\tactions.push(['save', strings.assetSave]);\n\n\treturn actions;\n}\n\nfunction renderImages(context: RenderContext) {\n\tconst { payload, strings } = context;\n\tconst actions = getAssetActions(context);\n\tconst counts = new Map<string, number>();\n\tconst assets = new Map<HTMLElement, ShareKitAsset>();\n\n\tfor (const asset of payload.assets) {\n\t\tconst number = (counts.get(asset.role) ?? 0) + 1;\n\t\tconst key = asset.role === 'photo' ? `photo-${String(number)}` : asset.role;\n\n\t\tcounts.set(asset.role, number);\n\t\tassets.set(renderTile(context, { actions, asset, key }), asset);\n\t}\n\n\tconst grid = createElement('ul', { class: 'share-kit-grid' }, [...assets.keys()]);\n\n\treturn {\n\t\tassets,\n\t\tgrid,\n\t\tsection: createElement('section', { class: 'share-kit-section' }, [\n\t\t\trenderHeading(context, [strings.imagesTitle]),\n\t\t\tgrid,\n\t\t]),\n\t};\n}\n\nfunction renderLink(context: RenderContext) {\n\tconst { payload, strings } = context;\n\n\treturn createElement('section', { class: 'share-kit-section' }, [\n\t\trenderHeading(context, [strings.linkTitle]),\n\t\tcreateElement('div', { class: 'share-kit-link-row' }, [\n\t\t\tcreateElement('p', { class: 'share-kit-link' }, [payload.url]),\n\t\t\trenderAction(context, { action: 'copy-link', label: strings.linkCopy }),\n\t\t]),\n\t]);\n}\n\nexport interface ShareKitParts {\n\tassets: ReadonlyMap<HTMLElement, ShareKitAsset>;\n\tcaption: HTMLTextAreaElement;\n\tcaptionCopy: HTMLElement;\n\tcount: HTMLElement;\n\tdialog: HTMLDialogElement;\n\tgrid: HTMLElement;\n\theading: HTMLElement;\n\thint: HTMLElement;\n\tmore: HTMLElement | undefined;\n\tprimary: HTMLButtonElement;\n\tstatus: HTMLElement;\n\ttiles: Array<HTMLElement>;\n}\n\nexport function renderShareKit(input: RenderInput): ShareKitParts {\n\tconst context: RenderContext = { ...input, classNames: input.payload.settings.classNames ?? {} };\n\tconst { header, heading } = renderHeader(context);\n\tconst destinations = renderDestinations(context);\n\tconst caption = renderCaption(context);\n\tconst images = renderImages(context);\n\tconst status = createElement('p', { class: 'share-kit-status', role: 'status' });\n\tconst primary = createElement('button', {\n\t\tclass: joinClasses('share-kit-primary', context.classNames.primary),\n\t\t'data-share-kit-action': 'primary',\n\t\ttype: 'button',\n\t});\n\tconst dialog = createElement(\n\t\t'dialog',\n\t\t{ 'aria-labelledby': heading.id, class: 'share-kit-dialog', closedby: 'any', id: input.id },\n\t\t[\n\t\t\tcreateElement('div', { class: 'share-kit-body' }, [\n\t\t\t\theader,\n\t\t\t\tcreateElement('div', { class: 'share-kit-scroll' }, [\n\t\t\t\t\tdestinations.section,\n\t\t\t\t\tcaption.section,\n\t\t\t\t\timages.section,\n\t\t\t\t\trenderLink(context),\n\t\t\t\t]),\n\t\t\t\tcreateElement('footer', { class: 'share-kit-footer' }, [status, primary]),\n\t\t\t]),\n\t\t],\n\t);\n\n\treturn {\n\t\tassets: images.assets,\n\t\tcaption: caption.caption,\n\t\tcaptionCopy: caption.captionCopy,\n\t\tcount: caption.count,\n\t\tdialog,\n\t\tgrid: images.grid,\n\t\theading,\n\t\thint: caption.hint,\n\t\tmore: destinations.more,\n\t\tprimary,\n\t\tstatus,\n\t\ttiles: [...images.assets.keys()],\n\t};\n}\n","import type { ShareKitDestinationId, SharePrimaryAction } from './destinations.js';\nimport type { ShareKitParts } from './render.js';\nimport type { ShareKitStrings } from './strings.js';\n\nimport { countCaption } from './caption.js';\nimport { getShareDestination } from './destinations.js';\nimport { formatShareString, isShareStringKey } from './strings.js';\n\nconst primaryLabels = {\n\t'copy-caption': 'primaryCopy',\n\t'open-composer': 'primaryOpen',\n\t'share-image': 'primaryShareImage',\n\t'share-link': 'primaryShareLink',\n\t'share-text': 'primaryShareText',\n} as const satisfies Record<SharePrimaryAction, keyof ShareKitStrings>;\n\nexport function getSuggestedAsset(assets: Array<HTMLElement>, destination: ShareKitDestinationId) {\n\tconst { assetRole } = getShareDestination(destination);\n\n\treturn (\n\t\tassets.find((asset) => asset.dataset.shareKitRole === assetRole) ??\n\t\tassets.find((asset) => asset.dataset.shareKitRole === 'landscape') ??\n\t\tassets[0]\n\t);\n}\n\ninterface SyncInput {\n\tdestination: ShareKitDestinationId;\n\tparts: ShareKitParts;\n\tstrings: ShareKitStrings;\n}\n\ninterface SyncCaptionInput extends SyncInput {\n\tprimaryAction: SharePrimaryAction;\n}\n\nexport function syncCaptionView({ destination, parts, primaryAction, strings }: SyncCaptionInput) {\n\tconst { limit } = getShareDestination(destination);\n\tconst count = countCaption(parts.caption.value, destination);\n\tconst isOver = limit !== undefined && count > limit;\n\tconst label = strings[`destination.${destination}`];\n\n\tparts.count.textContent =\n\t\tlimit === undefined ? String(count) : `${String(count)} / ${String(limit)}`;\n\tparts.count.toggleAttribute('data-share-kit-over', isOver);\n\tparts.caption.setAttribute('aria-invalid', String(isOver));\n\tparts.captionCopy.hidden = primaryAction === 'copy-caption';\n\tparts.primary.textContent = formatShareString(strings[primaryLabels[primaryAction]], {\n\t\tdestination: label,\n\t});\n\n\treturn {\n\t\tisOver,\n\t\tmessage: formatShareString(strings.captionOver, {\n\t\t\tcount: String(count - (limit ?? 0)),\n\t\t\tdestination: label,\n\t\t}),\n\t};\n}\n\ninterface SyncDestinationInput extends SyncInput {\n\tassets: Array<HTMLElement>;\n\tsuggested: HTMLElement | undefined;\n}\n\nexport function syncDestinationView({\n\tassets,\n\tdestination,\n\tparts,\n\tstrings,\n\tsuggested,\n}: SyncDestinationInput) {\n\tfor (const radio of parts.dialog.querySelectorAll<HTMLElement>('[role=\"radio\"]')) {\n\t\tconst isSelected = radio.dataset.shareKitDestination === destination;\n\n\t\tradio.setAttribute('aria-checked', String(isSelected));\n\t\tradio.tabIndex = isSelected ? 0 : -1;\n\t}\n\n\tconst hintKey = `hint.${destination}`;\n\n\tparts.hint.textContent = isShareStringKey(hintKey) ? strings[hintKey] : '';\n\tparts.hint.hidden = parts.hint.textContent === '';\n\n\tfor (const asset of assets) {\n\t\tconst badge = asset.querySelector<HTMLElement>('.share-kit-badge');\n\n\t\tif (badge) badge.hidden = asset !== suggested;\n\t}\n\n\tparts.grid.append(...parts.tiles);\n\n\tif (suggested) parts.grid.prepend(suggested);\n}\n","import type { ShareKitDestinationId } from './destinations.js';\nimport type { ShareKitStringKey } from './strings.js';\n\nexport type ShareKitAssetRole = 'landscape' | 'photo' | 'portrait' | 'story';\n\nexport interface ShareKitAsset {\n\talt: string;\n\tfilename: string;\n\theight: number;\n\tlabel: string;\n\tpreviewSrc: string;\n\trole: ShareKitAssetRole;\n\tsrc: string;\n\ttype: string;\n\twidth: number;\n}\n\nexport type ShareKitClassRole = 'action' | 'destination' | 'heading' | 'input' | 'primary';\n\nexport interface ShareKitSettings {\n\tclassNames?: Partial<Record<ShareKitClassRole, string>>;\n\tdestinations: ReadonlyArray<ShareKitDestinationId>;\n\tdestinationsMore?: ReadonlyArray<ShareKitDestinationId>;\n\topenHash?: string;\n\tutmMedium?: string;\n}\n\nexport interface ShareKitPayload {\n\tassets: ReadonlyArray<ShareKitAsset>;\n\tdescription?: string;\n\tlocale: string;\n\tsettings: ShareKitSettings;\n\tstrings?: Partial<Record<ShareKitStringKey, string>>;\n\ttitle: string;\n\turl: string;\n}\n\nexport const shareKitActionEventName = 'share-kit:action';\n\nexport type ShareKitAction =\n\t| 'copy'\n\t| 'copy-caption'\n\t| 'copy-link'\n\t| 'destination'\n\t| 'open'\n\t| 'open-composer'\n\t| 'qr'\n\t| 'save'\n\t| 'share'\n\t| 'share-link'\n\t| 'share-text';\n\nexport interface ShareKitActionDetail {\n\taction: ShareKitAction;\n\tasset?: string;\n\tdestination: ShareKitDestinationId;\n}\n\ndeclare global {\n\tinterface GlobalEventHandlersEventMap {\n\t\t[shareKitActionEventName]: CustomEvent<ShareKitActionDetail>;\n\t}\n}\n","import type { ShareCapability } from './actions.js';\nimport type { ShareOutcome } from './assets.js';\nimport type { ShareKitDestinationId, SharePrimaryAction } from './destinations.js';\nimport type { ShareKitIcons } from './icons.js';\nimport type { ShareKitParts } from './render.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitAction, ShareKitActionDetail, ShareKitPayload } from './types.js';\n\nimport { clearOpenHash, getShareCapabilities, isDomError, isOpenHash } from './actions.js';\nimport { ShareAssetFiles } from './assets.js';\nimport { fitCaption } from './caption.js';\nimport {\n\tgetDestinationUrl,\n\tgetPrimaryAction,\n\tgetShareDestination,\n\tisShareDestinationId,\n\tshareDestinationAny,\n} from './destinations.js';\nimport { polyfillLightDismiss, radioKeys } from './dom.js';\nimport { ShareFeedback } from './feedback.js';\nimport { shareKitIcons } from './icons.js';\nimport { getDestinationLists, getShareStrings, readSharePayload } from './payload.js';\nimport { createShareQr } from './qr.js';\nimport { renderShareKit } from './render.js';\nimport { shareKitStringDefaults } from './strings.js';\nimport { getSuggestedAsset, syncCaptionView, syncDestinationView } from './sync.js';\nimport { shareKitActionEventName } from './types.js';\n\nconst outcomeMessages = {\n\terror: 'error',\n\tretry: 'retry',\n\tsaved: 'saved',\n\tunsaved: 'saveError',\n} as const satisfies Partial<Record<ShareOutcome, keyof ShareKitStrings>>;\n\nlet dialogCount = 0;\n\nfunction isKeyOf<Key extends string>(record: Record<Key, unknown>, key: string): key is Key {\n\treturn Object.hasOwn(record, key);\n}\n\n// Server rendering has no `HTMLElement`; the stand-in lets the module load there and is never constructed\nconst BaseElement =\n\ttypeof HTMLElement === 'undefined' ? (Object as unknown as typeof HTMLElement) : HTMLElement;\n\nexport class ShareKitElement extends BaseElement {\n\tprotected readonly icons: ShareKitIcons = shareKitIcons;\n\n\t#abortController: AbortController | undefined;\n\t#actions = {\n\t\tclose: () => {\n\t\t\tthis.#parts?.dialog.close();\n\t\t},\n\t\tcopy: (button: HTMLElement, tile?: HTMLElement) => {\n\t\t\tif (!tile) return;\n\n\t\t\tthis.#track('copy', tile);\n\t\t\tvoid this.#feedback?.copyImage(this.#files?.load(tile) ?? Promise.resolve(undefined), button);\n\t\t},\n\t\t'copy-caption': (button: HTMLElement) => {\n\t\t\tthis.#track('copy-caption');\n\t\t\tvoid this.#copyCaption(button);\n\t\t},\n\t\t'copy-link': (button: HTMLElement) => {\n\t\t\tthis.#track('copy-link');\n\t\t\tvoid this.#feedback?.copyText(this.#payload?.url ?? '', button);\n\t\t},\n\t\tdestination: (button: HTMLElement) => {\n\t\t\tconst id = button.dataset.shareKitDestination;\n\n\t\t\tif (!id || !isShareDestinationId(id)) return;\n\n\t\t\tthis.#selectDestination(id);\n\t\t\tthis.#track('destination');\n\t\t},\n\t\tmore: (button: HTMLElement) => {\n\t\t\tthis.#showMore(button);\n\t\t},\n\t\tprimary: () => {\n\t\t\tthis.#primaryActions[this.#getPrimaryAction()]();\n\t\t},\n\t\tqr: () => {\n\t\t\tvoid this.#openQr();\n\t\t},\n\t\treset: () => {\n\t\t\tthis.#isCaptionEdited = false;\n\t\t\tthis.#syncDestination();\n\t\t},\n\t\tsave: (_button: HTMLElement, tile?: HTMLElement) => {\n\t\t\tif (tile) void this.#saveAsset(tile);\n\t\t},\n\t\tshare: (_button: HTMLElement, tile?: HTMLElement) => {\n\t\t\tif (tile) void this.#shareAssets([tile]);\n\t\t},\n\t};\n\t#capabilities = new Set<ShareCapability>();\n\t#destination: ShareKitDestinationId = shareDestinationAny;\n\t#feedback: ShareFeedback | undefined;\n\t#files: ShareAssetFiles | undefined;\n\t#isCaptionEdited = false;\n\t#isOver = false;\n\t#parts: ShareKitParts | undefined;\n\t#payload: ShareKitPayload | undefined;\n\t#primaryActions = {\n\t\t'copy-caption': () => {\n\t\t\tthis.#track('copy-caption');\n\t\t\tvoid this.#copyCaption();\n\t\t},\n\t\t// The composer can't always take the text, so it rides along on the clipboard\n\t\t'open-composer': () => {\n\t\t\tconst url = this.#getComposerUrl();\n\n\t\t\tif (!url) return;\n\n\t\t\tthis.#track('open-composer');\n\t\t\tvoid this.#copyCaption();\n\t\t\twindow.open(url, '_blank', 'noopener');\n\t\t},\n\t\t// Both start inside the tap, before any await, or the browser refuses one of them\n\t\t'share-image': () => {\n\t\t\tconst tile = this.#getSuggestedAsset();\n\n\t\t\tif (!tile) return;\n\n\t\t\tvoid this.#copyCaption();\n\t\t\tvoid this.#shareAssets([tile]);\n\t\t},\n\t\t// The platform's app drops shared text too, so the caption rides on the clipboard as with an image\n\t\t'share-link': () => {\n\t\t\tvoid this.#copyCaption();\n\t\t\tvoid this.#shareData('share-link', { url: this.#getUrl() });\n\t\t},\n\t\t'share-text': () => {\n\t\t\tconst text = this.#parts?.caption.value;\n\n\t\t\tif (text) void this.#shareData('share-text', { text });\n\t\t},\n\t} satisfies Record<SharePrimaryAction, () => void>;\n\t#qr: ReturnType<typeof createShareQr>;\n\t#strings: ShareKitStrings = shareKitStringDefaults;\n\n\tconnectedCallback() {\n\t\tif (this.#abortController) return;\n\n\t\tconst payload = readSharePayload(this);\n\n\t\tif (!payload) {\n\t\t\tthis.#retryWhenParsed();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#abortController = new AbortController();\n\t\tthis.#payload = payload;\n\t\tthis.#strings = getShareStrings(payload.strings);\n\t\tthis.#feedback = new ShareFeedback(() => this.#parts?.status, this.#strings);\n\n\t\tconst { signal } = this.#abortController;\n\n\t\tthis.#capabilities = new Set(getShareCapabilities(this.dataset.can));\n\t\tthis.#files = new ShareAssetFiles({\n\t\t\tcanShare: this.#capabilities.has('files'),\n\t\t\tgetSource: (tile) => this.#parts?.assets.get(tile),\n\t\t\tsignal,\n\t\t});\n\n\t\tthis.addEventListener('click', this.#handleClick, { signal });\n\t\tthis.addEventListener('input', this.#handleInput, { signal });\n\t\tthis.addEventListener('keydown', this.#handleKeydown, { signal });\n\t\tthis.addEventListener('error', this.#handlePreviewError, { capture: true, signal });\n\t\tthis.addEventListener('pointerover', ({ target }) => this.#files?.warm(target), { signal });\n\t\twindow.addEventListener('hashchange', this.#handleHashChange, { signal });\n\t\t// The trigger ships disabled so a tap before this runs isn't silently lost\n\t\tthis.querySelector('[data-share-kit-trigger]')?.toggleAttribute('disabled', false);\n\n\t\tif (isOpenHash(payload.settings.openHash)) this.#open();\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.#parts?.dialog.remove();\n\t\tthis.#parts = undefined;\n\t\tthis.#qr = undefined;\n\t\tthis.#abortController?.abort();\n\t\tthis.#abortController = undefined;\n\t\tthis.#feedback?.dispose();\n\t\tthis.#feedback = undefined;\n\t\tthis.#files?.dispose();\n\t\tthis.#files = undefined;\n\t\tthis.#destination = shareDestinationAny;\n\t\tthis.#isCaptionEdited = false;\n\t\tthis.#isOver = false;\n\t}\n\n\t// A failed write selects the caption, so it is ready to copy by hand once the reader is back\n\tasync #copyCaption(button?: HTMLElement) {\n\t\tconst caption = this.#parts?.caption;\n\n\t\tif (caption) await this.#feedback?.copyText(caption.value, button, caption);\n\t}\n\n\t#getAssets() {\n\t\treturn (this.#parts?.tiles ?? []).filter((tile) => tile.dataset.shareKitState !== 'failed');\n\t}\n\n\t#getComposerUrl() {\n\t\tconst parts = this.#parts;\n\n\t\tif (!parts) return;\n\n\t\tconst suggested = this.#getSuggestedAsset();\n\t\tconst media = suggested ? parts.assets.get(suggested)?.src : undefined;\n\n\t\treturn getShareDestination(this.#destination).getComposerUrl?.({\n\t\t\tmedia: media ? new URL(media, location.href).href : undefined,\n\t\t\ttext: parts.caption.value,\n\t\t\turl: this.#getUrl(),\n\t\t});\n\t}\n\n\t#getPrimaryAction() {\n\t\treturn getPrimaryAction({\n\t\t\tcanShareFiles: this.#capabilities.has('files') && this.#getSuggestedAsset() !== undefined,\n\t\t\tcanShareText: this.#capabilities.has('link'),\n\t\t\thasComposerUrl: this.#getComposerUrl() !== undefined,\n\t\t\tid: this.#destination,\n\t\t\tisHandheld: this.#capabilities.has('handheld'),\n\t\t});\n\t}\n\n\t#getSuggestedAsset() {\n\t\treturn getSuggestedAsset(this.#getAssets(), this.#destination);\n\t}\n\n\t#getUrl() {\n\t\tconst payload = this.#payload;\n\n\t\tif (!payload) return '';\n\n\t\treturn getDestinationUrl(payload.url, this.#destination, payload.settings.utmMedium);\n\t}\n\n\t#handleClick = (event: MouseEvent) => {\n\t\tif (!(event.target instanceof Element)) return;\n\n\t\tif (event.target.closest('[data-share-kit-trigger]')) {\n\t\t\tthis.#open();\n\t\t\treturn;\n\t\t}\n\n\t\tconst button = event.target.closest<HTMLElement>('[data-share-kit-action]');\n\t\tconst action = button?.dataset.shareKitAction;\n\n\t\tif (!button || !action || !isKeyOf(this.#actions, action)) return;\n\n\t\tthis.#actions[action](\n\t\t\tbutton,\n\t\t\tbutton.closest<HTMLElement>('[data-share-kit-asset]') ?? undefined,\n\t\t);\n\t};\n\n\t#handleClose = () => {\n\t\tclearOpenHash(this.#payload?.settings.openHash);\n\t};\n\n\t#handleHashChange = () => {\n\t\tif (isOpenHash(this.#payload?.settings.openHash)) this.#open();\n\t};\n\n\t#handleInput = (event: Event) => {\n\t\tif (event.target === this.#parts?.caption) this.#isCaptionEdited = true;\n\n\t\tthis.#syncCaption();\n\t};\n\n\t#handleKeydown = (event: KeyboardEvent) => {\n\t\tconst move = radioKeys[event.key];\n\n\t\tif (!move || !(event.target instanceof HTMLElement) || event.target.role !== 'radio') return;\n\n\t\tconst radios = [...this.querySelectorAll<HTMLElement>('[role=\"radio\"]:not([hidden])')];\n\t\tconst next = radios[move(radios.indexOf(event.target), radios.length)];\n\t\tconst id = next?.dataset.shareKitDestination;\n\n\t\tif (!next || !id || !isShareDestinationId(id)) return;\n\n\t\tevent.preventDefault();\n\t\tthis.#selectDestination(id);\n\t\tnext.focus();\n\t};\n\n\t#handlePreviewError = (event: Event) => {\n\t\tif (!(event.target instanceof HTMLImageElement)) return;\n\n\t\tconst tile = event.target.closest<HTMLElement>('[data-share-kit-asset]');\n\n\t\tif (!tile) return;\n\n\t\ttile.dataset.shareKitState = 'failed';\n\t\tthis.#syncDestination();\n\t};\n\n\t#open() {\n\t\tconst parts = this.#parts ?? this.#render();\n\n\t\tif (!parts || parts.dialog.open) return;\n\n\t\tparts.dialog.showModal();\n\t\t// Focusing the heading lets a screen reader start from the dialog's name\n\t\tparts.heading.focus();\n\t\tthis.#track('open');\n\t\t// Synced again once open, since a status written to a closed dialog goes unannounced\n\t\tthis.#isOver = false;\n\t\tthis.#syncCaption();\n\t}\n\n\tasync #openQr() {\n\t\tthis.#track('qr');\n\n\t\ttry {\n\t\t\tawait this.#qr?.open();\n\t\t} catch {\n\t\t\tthis.#feedback?.announce(this.#strings.error);\n\t\t}\n\t}\n\n\t// The primary button shares the suggested image on a phone, so only that file is fetched ahead\n\t#prefetch() {\n\t\tif (!this.#capabilities.has('files') || !this.#capabilities.has('handheld')) return;\n\n\t\tconst tile = this.#getSuggestedAsset();\n\n\t\tif (tile) void this.#files?.load(tile);\n\t}\n\n\t#render() {\n\t\tconst payload = this.#payload;\n\t\tconst signal = this.#abortController?.signal;\n\n\t\tif (!payload || !signal) return;\n\n\t\tconst { main, more } = getDestinationLists(payload.settings);\n\n\t\tdialogCount += 1;\n\n\t\tconst id = `share-kit-${String(dialogCount)}`;\n\t\tconst parts = renderShareKit({\n\t\t\tcapabilities: this.#capabilities,\n\t\t\tdestinations: main,\n\t\t\tdestinationsMore: more,\n\t\t\ticons: this.icons,\n\t\t\tid,\n\t\t\tpayload,\n\t\t\tstrings: this.#strings,\n\t\t});\n\n\t\tthis.#qr = createShareQr({\n\t\t\tcapabilities: this.#capabilities,\n\t\t\tcloseIcon: this.icons.close,\n\t\t\tid: `${id}-qr`,\n\t\t\tpayload,\n\t\t\tsignal,\n\t\t\tstrings: this.#strings,\n\t\t});\n\n\t\tif (this.#qr) parts.dialog.append(this.#qr.dialog);\n\n\t\tparts.dialog.addEventListener('close', this.#handleClose, { signal });\n\t\tpolyfillLightDismiss(parts.dialog, signal);\n\t\tthis.append(parts.dialog);\n\t\tthis.#parts = parts;\n\t\tthis.#destination = main[0] ?? shareDestinationAny;\n\t\tthis.#syncDestination();\n\n\t\treturn parts;\n\t}\n\n\t#report(outcome: ShareOutcome | undefined) {\n\t\tif (outcome && isKeyOf(outcomeMessages, outcome)) {\n\t\t\tthis.#feedback?.announce(this.#strings[outcomeMessages[outcome]]);\n\t\t}\n\t}\n\n\t// A classic script in the head defines the element before its children are parsed\n\t#retryWhenParsed() {\n\t\tif (document.readyState !== 'loading') return;\n\n\t\tdocument.addEventListener(\n\t\t\t'DOMContentLoaded',\n\t\t\t() => {\n\t\t\t\tif (this.isConnected) this.connectedCallback();\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t}\n\n\tasync #saveAsset(tile: HTMLElement) {\n\t\tthis.#track('save', tile);\n\t\tthis.#report(await this.#files?.save(tile));\n\t}\n\n\t// An edited caption keeps the reader's words but swaps in the new destination's tagged link\n\t#selectDestination(id: ShareKitDestinationId) {\n\t\tconst previousUrl = this.#getUrl();\n\t\tconst caption = this.#parts?.caption;\n\n\t\tthis.#destination = id;\n\n\t\tif (caption && this.#isCaptionEdited) {\n\t\t\tconst url = this.#getUrl();\n\n\t\t\tcaption.value = caption.value.replaceAll(previousUrl, () => url);\n\t\t}\n\n\t\tthis.#syncDestination();\n\t}\n\n\tasync #shareAssets(tiles: Array<HTMLElement>) {\n\t\tconst [first] = tiles;\n\n\t\tif (!first) return;\n\n\t\tthis.#track('share', first);\n\t\tthis.#report(await this.#files?.share(tiles));\n\t}\n\n\tasync #shareData(action: 'share-link' | 'share-text', data: ShareData) {\n\t\tthis.#track(action);\n\n\t\ttry {\n\t\t\tawait navigator.share(data);\n\t\t} catch (error) {\n\t\t\tif (!isDomError(error, 'AbortError')) this.#feedback?.announce(this.#strings.error);\n\t\t}\n\t}\n\n\t#showMore(button: HTMLElement) {\n\t\tconst hidden = [...this.querySelectorAll<HTMLElement>('[role=\"radio\"][hidden]')];\n\n\t\tfor (const radio of hidden) radio.hidden = false;\n\n\t\tbutton.hidden = true;\n\t\thidden[0]?.focus();\n\t}\n\n\t#syncCaption() {\n\t\tconst parts = this.#parts;\n\n\t\tif (!parts) return;\n\n\t\tconst { isOver, message } = syncCaptionView({\n\t\t\tdestination: this.#destination,\n\t\t\tparts,\n\t\t\tprimaryAction: this.#getPrimaryAction(),\n\t\t\tstrings: this.#strings,\n\t\t});\n\n\t\tif (isOver && !this.#isOver && parts.dialog.open) this.#feedback?.announce(message);\n\n\t\tthis.#isOver = isOver;\n\t}\n\n\t#syncDestination() {\n\t\tconst parts = this.#parts;\n\t\tconst payload = this.#payload;\n\n\t\tif (!parts || !payload) return;\n\n\t\tsyncDestinationView({\n\t\t\tassets: this.#getAssets(),\n\t\t\tdestination: this.#destination,\n\t\t\tparts,\n\t\t\tstrings: this.#strings,\n\t\t\tsuggested: this.#getSuggestedAsset(),\n\t\t});\n\n\t\tif (!this.#isCaptionEdited) {\n\t\t\tparts.caption.value = fitCaption(\n\t\t\t\t{ description: payload.description, title: payload.title, url: this.#getUrl() },\n\t\t\t\tthis.#destination,\n\t\t\t\tpayload.locale,\n\t\t\t).text;\n\t\t}\n\n\t\tthis.#syncCaption();\n\t\tthis.#prefetch();\n\t}\n\n\t#track(action: ShareKitAction, tile?: HTMLElement) {\n\t\tconst detail: ShareKitActionDetail = { action, destination: this.#destination };\n\n\t\tif (tile?.dataset.shareKitAsset) detail.asset = tile.dataset.shareKitAsset;\n\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(shareKitActionEventName, { bubbles: true, composed: true, detail }),\n\t\t);\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'share-kit': ShareKitElement;\n\t}\n}\n","import type { ShareKitIcons } from './icons.js';\n\nimport { ShareKitElement } from './element.js';\nimport { shareKitIcons } from './icons.js';\n\nexport interface ShareKitOptions {\n\ticons?: ShareKitIcons;\n}\n\nconst tagName = 'share-kit';\n\n// An element name registers once per page, so the first call's options stand\nexport function defineShareKit({ icons }: ShareKitOptions = {}) {\n\tif (customElements.get(tagName)) return;\n\n\tconst resolvedIcons: ShareKitIcons = { ...shareKitIcons, ...icons };\n\n\tcustomElements.define(\n\t\ttagName,\n\t\tclass extends ShareKitElement {\n\t\t\tprotected override readonly icons = resolvedIcons;\n\t\t},\n\t);\n}\n"],"mappings":";AAAA,MAAM,oBAAoB;CAAC;CAAS;CAAQ;CAAc;AAAU;AAUpE,MAAM,UAAU;AAEhB,SAAS,gBAAgB;CACxB,IAAI,EAAE,cAAc,YAAY,OAAO;CAEvC,OAAO,UAAU,SAAS,EAAE,OAAO,CAAC,IAAI,KAAK,CAAC,GAAG,aAAa,EAAE,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC;AACzF;AAEA,SAAS,eAAe;CACvB,IAAI,EAAE,eAAe,cAAc,EAAE,mBAAmB,aAAa,OAAO;CAE5E,OAAO,cAAc,iBAAiB,cAAc,SAAS,OAAO;AACrE;AAEA,MAAM,kBAAkB;CACvB,cAAc;CACd,OAAO;CAEP,gBAAgB,WAAW,mBAAmB,CAAC,CAAC;CAChD,YAAY,WAAW;AACxB;AAEA,SAAS,kBAAkB,OAAyC;CACnE,OAAO,kBAAkB,MAAM,eAAe,eAAe,KAAK;AACnE;AAGA,SAAgB,qBAAqB,QAA4B;CAChE,IAAI,WAAW,KAAA,GAAW,OAAO,OAAO,MAAM,GAAG,CAAC,CAAC,OAAO,iBAAiB;CAE3E,OAAO,kBAAkB,QAAQ,eAAe,gBAAgB,WAAW,CAAC,CAAC;AAC9E;AAEA,SAAgB,WAAW,OAAgB,MAAc;CACxD,OAAO,iBAAiB,gBAAgB,MAAM,SAAS;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;EAClB,KAAK,UAAU;CAChB;CAEA,OAAO,QAAwB,MAAoB;EAClD,MAAM,SAA+B;GAAE;GAAQ,aAAa,KAAK;EAAa;EAE9E,IAAI,MAAM,QAAQ,eAAe,OAAO,QAAQ,KAAK,QAAQ;EAE7D,KAAK,cACJ,IAAI,YAAY,yBAAyB;GAAE,SAAS;GAAM,UAAU;GAAM;EAAO,CAAC,CACnF;CACD;AACD;;ACteA,MAAM,UAAU;AAGhB,SAAgB,eAAe,EAAE,UAA2B,CAAC,GAAG;CAC/D,IAAI,eAAe,IAAI,OAAO,GAAG;CAEjC,MAAM,gBAA+B;EAAE,GAAG;EAAe,GAAG;CAAM;CAElE,eAAe,OACd,SACA,cAAc,gBAAgB;EACD,QAAQ;CACrC,CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/actions.ts","../src/assets.ts","../src/count.ts","../src/destinations.ts","../src/caption.ts","../src/dom.ts","../src/feedback.ts","../src/strings.ts","../src/payload.ts","../src/qr.ts","../src/render.ts","../src/sync.ts","../src/types.ts","../src/element.ts","../src/define.ts","../src/icons.ts"],"sourcesContent":["const shareCapabilities = ['files', 'link', 'copy-image', 'handheld'] as const;\n\nexport type ShareCapability = (typeof shareCapabilities)[number];\n\nexport interface ShareAssetSource {\n\tfilename: string;\n\tsrc: string;\n\ttype: string;\n}\n\nconst pngType = 'image/png';\n\nfunction canShareFiles() {\n\tif (!('canShare' in navigator)) return false;\n\n\treturn navigator.canShare({ files: [new File([], 'probe.jpg', { type: 'image/jpeg' })] });\n}\n\nfunction canCopyImage() {\n\tif (!('clipboard' in navigator) || !('ClipboardItem' in globalThis)) return false;\n\n\treturn 'supports' in ClipboardItem && ClipboardItem.supports(pngType);\n}\n\nconst capabilityTests = {\n\t'copy-image': canCopyImage,\n\tfiles: canShareFiles,\n\t// A phone's share sheet reaches its apps; a desktop's mostly reaches Mail and AirDrop\n\thandheld: () => matchMedia('(pointer: coarse)').matches,\n\tlink: () => 'share' in navigator,\n} as const satisfies Record<ShareCapability, () => boolean>;\n\nfunction isShareCapability(value: string): value is ShareCapability {\n\treturn shareCapabilities.some((capability) => capability === value);\n}\n\n// A list already on the element wins, so a page can show how the dialog looks on another device\nexport function getShareCapabilities(preset: string | undefined) {\n\tif (preset !== undefined) return preset.split(' ').filter(isShareCapability);\n\n\treturn shareCapabilities.filter((capability) => capabilityTests[capability]());\n}\n\nexport function isDomError(error: unknown, name: string) {\n\treturn error instanceof DOMException && error.name === name;\n}\n\n// `no-cache` revalidates a copy cached without CORS headers, which this fetch would reject\nexport async function fetchFile({ filename, src, type }: ShareAssetSource, signal: AbortSignal) {\n\tconst response = await fetch(src, { cache: 'no-cache', signal });\n\n\tif (!response.ok) throw new Error(`${String(response.status)} for ${src}`);\n\n\treturn new File([await response.blob()], filename, { type });\n}\n\n// `download` is ignored on a cross-origin href, so the file goes through an object URL\nexport function saveFile(file: File) {\n\tconst objectUrl = URL.createObjectURL(file);\n\tconst link = document.createElement('a');\n\n\tlink.download = file.name;\n\tlink.href = objectUrl;\n\tlink.hidden = true;\n\tdocument.body.append(link);\n\tlink.click();\n\tlink.remove();\n\n\treturn objectUrl;\n}\n\n// PNG is the only image type every browser's async clipboard accepts\nasync function toPngBlob(pending: Promise<File | undefined>) {\n\tconst file = await pending;\n\n\tif (!file) throw new Error('The image did not load');\n\n\tconst bitmap = await createImageBitmap(file);\n\tconst canvas = new OffscreenCanvas(bitmap.width, bitmap.height);\n\tconst context = canvas.getContext('2d');\n\n\tif (!context) throw new Error('No 2D context for the PNG conversion');\n\n\tcontext.drawImage(bitmap, 0, 0);\n\tbitmap.close();\n\n\treturn canvas.convertToBlob({ type: pngType });\n}\n\nexport function copyImage(file: Promise<File | undefined>) {\n\treturn navigator.clipboard.write([new ClipboardItem({ [pngType]: toPngBlob(file) })]);\n}\n\nexport function isOpenHash(openHash: string | undefined) {\n\treturn openHash !== undefined && location.hash === `#${openHash}`;\n}\n\n// Replacing the entry keeps the router's state and stops a reload or Back from reopening the dialog\nexport function clearOpenHash(openHash: string | undefined) {\n\tif (!isOpenHash(openHash)) return;\n\n\thistory.replaceState(history.state, '', `${location.pathname}${location.search}`);\n}\n","import type { ShareAssetSource } from './actions.js';\n\nimport { fetchFile, isDomError, saveFile } from './actions.js';\n\nexport type ShareOutcome = 'dismissed' | 'error' | 'retry' | 'saved' | 'shared' | 'unsaved';\n\ninterface ShareAssetFilesOptions {\n\tcanShare: boolean;\n\tgetSource: (tile: HTMLElement) => ShareAssetSource | undefined;\n\tsignal: AbortSignal;\n}\n\nfunction isFile(file: File | undefined): file is File {\n\treturn file !== undefined;\n}\n\nexport class ShareAssetFiles {\n\t#files = new Map<HTMLElement, File>();\n\t#loads = new Map<HTMLElement, Promise<File | undefined>>();\n\t#objectUrls = new Set<string>();\n\t#options: ShareAssetFilesOptions;\n\n\tconstructor(options: ShareAssetFilesOptions) {\n\t\tthis.#options = options;\n\t}\n\n\tdispose() {\n\t\tfor (const objectUrl of this.#objectUrls) URL.revokeObjectURL(objectUrl);\n\n\t\tthis.#objectUrls.clear();\n\t\tthis.#files.clear();\n\t\tthis.#loads.clear();\n\t}\n\n\tload(tile: HTMLElement) {\n\t\tconst pending = this.#loads.get(tile);\n\n\t\tif (pending) return pending;\n\n\t\tconst promise = this.#fetch(tile);\n\n\t\tthis.#loads.set(tile, promise);\n\n\t\treturn promise;\n\t}\n\n\tasync save(tile: HTMLElement): Promise<ShareOutcome> {\n\t\tconst file = await this.load(tile);\n\n\t\treturn file ? this.#saveFiles([file]) : 'unsaved';\n\t}\n\n\tasync share(tiles: Array<HTMLElement>): Promise<ShareOutcome> {\n\t\tconst ready = tiles.map((tile) => this.#files.get(tile));\n\n\t\t// Calling `share()` before any await keeps the tap's user activation valid\n\t\tif (ready.every(isFile)) return this.#shareFiles(ready);\n\n\t\tconst loaded = await Promise.all(tiles.map((tile) => this.load(tile)));\n\n\t\treturn loaded.every(isFile) ? this.#shareFiles(loaded) : 'error';\n\t}\n\n\t// Warming on hover lets the share call still start inside the tap\n\twarm(target: EventTarget | null) {\n\t\tif (!(target instanceof Element)) return;\n\n\t\tconst tile = target\n\t\t\t.closest('[data-share-kit-action=\"share\"]')\n\t\t\t?.closest<HTMLElement>('[data-share-kit-asset]');\n\n\t\tif (tile) void this.load(tile);\n\t}\n\n\t// A failed load is forgotten so the next tap tries again\n\tasync #fetch(tile: HTMLElement) {\n\t\tconst source = this.#options.getSource(tile);\n\n\t\tif (!source) return;\n\n\t\ttry {\n\t\t\tconst file = await fetchFile(source, this.#options.signal);\n\n\t\t\tthis.#files.set(tile, file);\n\n\t\t\treturn file;\n\t\t} catch {\n\t\t\tthis.#loads.delete(tile);\n\n\t\t\treturn;\n\t\t}\n\t}\n\n\t#saveFiles(files: Array<File>): ShareOutcome {\n\t\tfor (const file of files) this.#objectUrls.add(saveFile(file));\n\n\t\treturn 'saved';\n\t}\n\n\tasync #shareFiles(files: Array<File>): Promise<ShareOutcome> {\n\t\tif (!this.#options.canShare || !navigator.canShare({ files })) return this.#saveFiles(files);\n\n\t\ttry {\n\t\t\tawait navigator.share({ files });\n\n\t\t\treturn 'shared';\n\t\t} catch (error) {\n\t\t\tif (isDomError(error, 'AbortError') || this.#options.signal.aborted) return 'dismissed';\n\n\t\t\t// A slow load used up the tap's activation; the files are ready now, so another tap works\n\t\t\tif (isDomError(error, 'NotAllowedError')) return 'retry';\n\n\t\t\treturn this.#saveFiles(files);\n\t\t}\n\t}\n}\n","type ShareCounter = 'graphemes' | 'length' | 'stringz' | 'utf8' | 'weighted';\n\ntype ShareUrlCost = 'actual' | 'fixed' | 'shortened';\n\n// X and Mastodon both charge 23 for any link, whatever its length\nconst urlFixedCost = 23;\n\nconst urlPattern = /https?:\\/\\/[\\w!#$%&'()*+,./:;=?@~-]+/giu;\n\nconst urlTrailingPunctuation = /[!'),.:;?]+$/u;\n\nconst graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\nconst utf8Encoder = new TextEncoder();\n\nconst latinCombiningMarkRanges = [\n\t[0x03_00, 0x03_6f],\n\t[0x1a_b0, 0x1a_ff],\n\t[0x1d_c0, 0x1d_ff],\n\t[0x20_d0, 0x20_ff],\n\t[0xfe_20, 0xfe_2f],\n] as const;\n\n// The `v` flag is newer than `Intl.Segmenter`; without it emoji are charged per code point, which only overcounts\nfunction getEmojiPattern() {\n\ttry {\n\t\treturn new RegExp(String.raw`^\\p{RGI_Emoji}$`, 'v');\n\t} catch {\n\t\treturn;\n\t}\n}\n\nconst emojiPattern = getEmojiPattern();\n\nexport function getGraphemes(text: string) {\n\treturn Array.from(graphemeSegmenter.segment(text), ({ segment }) => segment);\n}\n\n// twitter-text config v3; every code point outside these ranges weighs double\nfunction isLightCodePoint(codePoint: number) {\n\treturn (\n\t\tcodePoint <= 0x10_ff ||\n\t\t(codePoint >= 0x20_00 && codePoint <= 0x20_0d) ||\n\t\t(codePoint >= 0x20_10 && codePoint <= 0x20_1f) ||\n\t\t(codePoint >= 0x20_32 && codePoint <= 0x20_37)\n\t);\n}\n\nfunction getWeightedLength(text: string) {\n\tconst graphemes = getGraphemes(text.normalize('NFC'));\n\tlet total = 0;\n\n\tfor (const grapheme of graphemes) {\n\t\tif (emojiPattern?.test(grapheme)) {\n\t\t\ttotal += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const character of grapheme) {\n\t\t\ttotal += isLightCodePoint(character.codePointAt(0) ?? 0) ? 1 : 2;\n\t\t}\n\t}\n\n\treturn total;\n}\n\nfunction isLatinCombiningMark(codePoint: number) {\n\treturn latinCombiningMarkRanges.some(([start, end]) => codePoint >= start && codePoint <= end);\n}\n\n// Mirrors stringz, which Mastodon's web composer counts with: one per code point, except Latin combining marks; Thai marks count apart\nfunction getStringzLength(text: string) {\n\tlet total = 0;\n\n\tfor (const character of text) {\n\t\tif (!isLatinCombiningMark(character.codePointAt(0) ?? 0)) total += 1;\n\t}\n\n\treturn total;\n}\n\n// Mirrors `toShortUrl` in bluesky-social/social-app, which the composer applies before it counts\nfunction getShortenedUrlLength(url: string) {\n\tif (!URL.canParse(url)) return getGraphemes(url).length;\n\n\tconst { hash, host, pathname, search } = new URL(url);\n\tconst path = `${pathname === '/' ? '' : pathname}${search}${hash}`;\n\n\treturn host.length + Math.min(path.length, 16);\n}\n\nconst textCounters = {\n\tgraphemes: (text: string) => getGraphemes(text).length,\n\tlength: (text: string) => text.length,\n\tstringz: getStringzLength,\n\tutf8: (text: string) => utf8Encoder.encode(text).length,\n\tweighted: getWeightedLength,\n} as const satisfies Record<ShareCounter, (text: string) => number>;\n\nfunction splitLinks(text: string) {\n\tconst links: Array<string> = [];\n\n\tconst rest = text.replaceAll(urlPattern, (match) => {\n\t\tconst trailing = urlTrailingPunctuation.exec(match)?.[0] ?? '';\n\n\t\tlinks.push(match.slice(0, match.length - trailing.length));\n\n\t\treturn trailing;\n\t});\n\n\treturn { links, rest };\n}\n\nexport interface ShareCountRule {\n\tcounter: ShareCounter;\n\turlCost: ShareUrlCost;\n}\n\nexport function countText(text: string, { counter, urlCost }: ShareCountRule) {\n\tconst count = textCounters[counter];\n\n\tif (urlCost === 'actual') return count(text);\n\n\tconst { links, rest } = splitLinks(text);\n\tlet total = count(rest);\n\n\tfor (const link of links) {\n\t\ttotal += urlCost === 'fixed' ? urlFixedCost : getShortenedUrlLength(link);\n\t}\n\n\treturn total;\n}\n","import type { ShareCountRule } from './count.js';\nimport type { ShareKitAssetRole } from './types.js';\n\ntype ShareCaptionShape = 'full' | 'text' | 'title' | 'url';\n\ninterface ShareComposerInput {\n\tmedia: string | undefined;\n\ttext: string;\n\turl: string;\n}\n\nexport interface ShareDestination extends ShareCountRule {\n\tassetRole: Exclude<ShareKitAssetRole, 'photo'>;\n\tgetComposerUrl?: (input: ShareComposerInput) => string | undefined;\n\t// The post is an image, so a phone hands the file to the share sheet rather than opening a composer\n\tisImagePost: boolean;\n\tisLinkOnly?: boolean;\n\tlimit?: number;\n\tshape: ShareCaptionShape;\n}\n\nfunction withQuery(base: string, parameters: Record<string, string | undefined>) {\n\tconst url = new URL(base);\n\n\tfor (const [name, value] of Object.entries(parameters)) {\n\t\tif (value) url.searchParams.set(name, value);\n\t}\n\n\treturn url.href;\n}\n\nexport const shareDestinationAny = 'any';\n\nexport const shareDestinations = {\n\tbluesky: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'graphemes',\n\t\tgetComposerUrl: ({ text }) => withQuery('https://bsky.app/intent/compose', { text }),\n\t\tisImagePost: true,\n\t\tlimit: 300,\n\t\tshape: 'full',\n\t\turlCost: 'shortened',\n\t},\n\tfacebook: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ url }) =>\n\t\t\twithQuery('https://www.facebook.com/sharer/sharer.php', { u: url }),\n\t\tisImagePost: false,\n\t\tisLinkOnly: true,\n\t\tlimit: 63_206,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\tinstagram: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'length',\n\t\tisImagePost: true,\n\t\tlimit: 2200,\n\t\tshape: 'text',\n\t\turlCost: 'actual',\n\t},\n\t'instagram-story': {\n\t\tassetRole: 'story',\n\t\tcounter: 'length',\n\t\tisImagePost: true,\n\t\tshape: 'url',\n\t\turlCost: 'actual',\n\t},\n\tlinkedin: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ url }) =>\n\t\t\twithQuery('https://www.linkedin.com/sharing/share-offsite/', { url }),\n\t\tisImagePost: false,\n\t\tisLinkOnly: true,\n\t\tlimit: 3000,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\t// Each reader posts from their own server, so there is no composer to open\n\tmastodon: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'stringz',\n\t\tisImagePost: true,\n\t\tlimit: 500,\n\t\tshape: 'full',\n\t\turlCost: 'fixed',\n\t},\n\tmessages: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tisImagePost: false,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\tpinterest: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ media, text, url }) =>\n\t\t\twithQuery('https://www.pinterest.com/pin/create/button/', {\n\t\t\t\tdescription: text,\n\t\t\t\tmedia,\n\t\t\t\turl,\n\t\t\t}),\n\t\tisImagePost: false,\n\t\tlimit: 800,\n\t\tshape: 'text',\n\t\turlCost: 'actual',\n\t},\n\treddit: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tgetComposerUrl: ({ text, url }) =>\n\t\t\twithQuery('https://www.reddit.com/submit', { title: text, url }),\n\t\tisImagePost: false,\n\t\tlimit: 300,\n\t\tshape: 'title',\n\t\turlCost: 'actual',\n\t},\n\t[shareDestinationAny]: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'length',\n\t\tisImagePost: false,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\t// Threads' docs give the limit in characters but count emoji in bytes; bytes is the reading that can't overshoot\n\tthreads: {\n\t\tassetRole: 'portrait',\n\t\tcounter: 'utf8',\n\t\tgetComposerUrl: ({ text }) => withQuery('https://www.threads.com/intent/post', { text }),\n\t\tisImagePost: true,\n\t\tlimit: 500,\n\t\tshape: 'full',\n\t\turlCost: 'actual',\n\t},\n\tx: {\n\t\tassetRole: 'landscape',\n\t\tcounter: 'weighted',\n\t\tgetComposerUrl: ({ text }) => withQuery('https://x.com/intent/tweet', { text }),\n\t\tisImagePost: false,\n\t\tlimit: 280,\n\t\tshape: 'full',\n\t\turlCost: 'fixed',\n\t},\n} as const satisfies Record<string, ShareDestination>;\n\nexport type ShareKitDestinationId = keyof typeof shareDestinations;\n\nexport function isShareDestinationId(id: string): id is ShareKitDestinationId {\n\treturn Object.hasOwn(shareDestinations, id);\n}\n\nexport function getShareDestination(id: ShareKitDestinationId): ShareDestination {\n\treturn shareDestinations[id];\n}\n\nexport function getDestinationUrl(\n\turl: string,\n\tid: ShareKitDestinationId,\n\tutmMedium: string | undefined,\n) {\n\tif (!utmMedium || id === shareDestinationAny || !URL.canParse(url)) return url;\n\n\treturn withQuery(url, { utm_medium: utmMedium, utm_source: id });\n}\n\nexport type SharePrimaryAction =\n\t'copy-caption' | 'open-composer' | 'share-image' | 'share-link' | 'share-text';\n\ninterface SharePrimaryActionInput {\n\tcanShareFiles: boolean;\n\tcanShareText: boolean;\n\thasComposerUrl: boolean;\n\tid: ShareKitDestinationId;\n\tisHandheld: boolean;\n}\n\n// A phone's share sheet reaches the platform's app, where the reader is signed in; its web composer often isn't\nfunction getHandheldAction({\n\tcanShareFiles,\n\tcanShareText,\n\tid,\n}: SharePrimaryActionInput): SharePrimaryAction | undefined {\n\tconst { isImagePost, isLinkOnly } = getShareDestination(id);\n\n\tif (isImagePost && canShareFiles) return 'share-image';\n\tif (isLinkOnly === true && canShareText) return 'share-link';\n\tif (id === shareDestinationAny && canShareText) return 'share-text';\n\n\treturn undefined;\n}\n\nexport function getPrimaryAction(input: SharePrimaryActionInput): SharePrimaryAction {\n\tconst handheldAction = input.isHandheld ? getHandheldAction(input) : undefined;\n\n\tif (handheldAction) return handheldAction;\n\tif (input.hasComposerUrl) return 'open-composer';\n\tif (input.id === 'messages' && input.canShareText) return 'share-text';\n\n\treturn 'copy-caption';\n}\n","import type { ShareKitDestinationId } from './destinations.js';\n\nimport { countText, getGraphemes } from './count.js';\nimport { getShareDestination } from './destinations.js';\n\nexport interface ShareCaptionFields {\n\tdescription?: string | undefined;\n\ttitle: string;\n\turl: string;\n}\n\nexport interface ShareCaption {\n\tcount: number;\n\tisTruncated: boolean;\n\tlimit: number | undefined;\n\ttext: string;\n}\n\nconst separator = '\\n\\n';\n\nconst ellipsis = '…';\n\n// The locale comes from the payload, and a malformed tag like `en_US` throws\nfunction createSegmenter(locale: string, granularity: 'sentence' | 'word') {\n\ttry {\n\t\treturn new Intl.Segmenter(locale, { granularity });\n\t} catch {\n\t\treturn new Intl.Segmenter(undefined, { granularity });\n\t}\n}\n\nfunction getSegmentEnds(text: string, granularity: 'sentence' | 'word', locale: string) {\n\tconst segments = createSegmenter(locale, granularity).segment(text);\n\n\treturn Array.from(segments, ({ index, segment }) => index + segment.length);\n}\n\nfunction getGraphemeEnds(text: string) {\n\tlet end = 0;\n\n\treturn getGraphemes(text).map((grapheme) => (end += grapheme.length));\n}\n\nfunction join(parts: Array<string | undefined>) {\n\treturn parts.filter(Boolean).join(separator);\n}\n\ninterface CutInput {\n\tcanFit: (candidate: string) => boolean;\n\tends: Array<number>;\n\tsuffix: string;\n\ttext: string;\n}\n\n// Counts grow with the cut, so the scan stops at the first miss\nfunction findCut({ canFit, ends, suffix, text }: CutInput) {\n\tlet fitted: string | undefined;\n\n\tfor (const end of ends) {\n\t\tconst cut = text.slice(0, end).trimEnd();\n\n\t\tif (cut.length === 0 || cut.length === text.length) continue;\n\n\t\tconst candidate = `${cut}${suffix}`;\n\n\t\tif (!canFit(candidate)) break;\n\n\t\tfitted = candidate;\n\t}\n\n\treturn fitted;\n}\n\ninterface FitInput {\n\tbody: string | undefined;\n\tcanFit: (text: string) => boolean;\n\tlink: string | undefined;\n\tlocale: string;\n\ttitle: string;\n}\n\nfunction fitBody({ body, canFit, link, locale, title }: FitInput) {\n\tif (!body) return;\n\n\tconst canFitBody = (candidate: string) => canFit(join([title, candidate, link]));\n\n\treturn (\n\t\tfindCut({\n\t\t\tcanFit: canFitBody,\n\t\t\tends: getSegmentEnds(body, 'sentence', locale),\n\t\t\tsuffix: '',\n\t\t\ttext: body,\n\t\t}) ??\n\t\tfindCut({\n\t\t\tcanFit: canFitBody,\n\t\t\tends: getSegmentEnds(body, 'word', locale),\n\t\t\tsuffix: ellipsis,\n\t\t\ttext: body,\n\t\t})\n\t);\n}\n\nfunction fitTitle({ canFit, link, locale, title }: FitInput) {\n\tconst canFitTitle = (candidate: string) => canFit(join([candidate, link]));\n\n\treturn (\n\t\tfindCut({\n\t\t\tcanFit: canFitTitle,\n\t\t\tends: getSegmentEnds(title, 'word', locale),\n\t\t\tsuffix: ellipsis,\n\t\t\ttext: title,\n\t\t}) ??\n\t\tfindCut({ canFit: canFitTitle, ends: getGraphemeEnds(title), suffix: ellipsis, text: title }) ??\n\t\ttitle\n\t);\n}\n\nfunction fitParts(input: FitInput) {\n\tconst { canFit, link, title } = input;\n\tconst body = fitBody(input);\n\n\tif (body) return join([title, body, link]);\n\n\tconst bare = join([title, link]);\n\n\treturn canFit(bare) ? bare : join([fitTitle(input), link]);\n}\n\nexport function countCaption(text: string, id: ShareKitDestinationId) {\n\treturn countText(text, getShareDestination(id));\n}\n\n// The link is kept whole, then the title; the description takes what is left, cut at a sentence end or failing that a word\n// A link too long to leave room for one grapheme of title comes back over the limit; nothing sensible fits\nexport function fitCaption(\n\t{ description, title, url }: ShareCaptionFields,\n\tid: ShareKitDestinationId,\n\tlocale = 'en',\n): ShareCaption {\n\tconst { limit, shape } = getShareDestination(id);\n\tconst link = shape === 'full' ? url : undefined;\n\tconst body = shape === 'title' ? undefined : description?.trim() || undefined;\n\tconst whole = shape === 'url' ? url : join([title, body, link]);\n\tconst canFit = (text: string) => limit === undefined || countCaption(text, id) <= limit;\n\tconst text = canFit(whole) ? whole : fitParts({ body, canFit, link, locale, title });\n\n\treturn { count: countCaption(text, id), isTruncated: text !== whole, limit, text };\n}\n","type Child = Node | string | undefined;\n\ntype Attributes = Record<string, string | undefined>;\n\nexport function createElement<Tag extends keyof HTMLElementTagNameMap>(\n\ttag: Tag,\n\tattributes: Attributes = {},\n\tchildren: Array<Child> = [],\n) {\n\tconst element = document.createElement(tag);\n\n\tfor (const [name, value] of Object.entries(attributes)) {\n\t\tif (value !== undefined) element.setAttribute(name, value);\n\t}\n\n\telement.append(...children.filter((child) => child !== undefined));\n\n\treturn element;\n}\n\nexport function joinClasses(...classes: Array<string | undefined>) {\n\treturn classes.filter(Boolean).join(' ');\n}\n\nconst svgNamespace = 'http://www.w3.org/2000/svg';\n\nexport function createIcon(path: string, size: number) {\n\tconst svg = document.createElementNS(svgNamespace, 'svg');\n\tconst shape = document.createElementNS(svgNamespace, 'path');\n\n\tsvg.setAttribute('aria-hidden', 'true');\n\tsvg.setAttribute('height', String(size));\n\tsvg.setAttribute('viewBox', '0 0 24 24');\n\tsvg.setAttribute('width', String(size));\n\tshape.setAttribute('d', path);\n\tshape.setAttribute('fill', 'currentColor');\n\tsvg.append(shape);\n\n\treturn svg;\n}\n\nfunction isOnBackdrop(dialog: HTMLDialogElement, event: PointerEvent) {\n\tif (event.target !== dialog) return false;\n\n\tconst rect = dialog.getBoundingClientRect();\n\n\treturn (\n\t\tevent.clientX < rect.left ||\n\t\tevent.clientX > rect.right ||\n\t\tevent.clientY < rect.top ||\n\t\tevent.clientY > rect.bottom\n\t);\n}\n\n// Checking both ends of the press means a drag that ends past the edge won't close the dialog\nexport function polyfillLightDismiss(dialog: HTMLDialogElement, signal: AbortSignal) {\n\tif ('closedBy' in HTMLDialogElement.prototype) return;\n\n\tlet isBackdropPress = false;\n\n\tdialog.addEventListener(\n\t\t'pointerdown',\n\t\t(event) => {\n\t\t\tisBackdropPress = isOnBackdrop(dialog, event);\n\t\t},\n\t\t{ signal },\n\t);\n\tdialog.addEventListener(\n\t\t'pointerup',\n\t\t(event) => {\n\t\t\tif (isBackdropPress && isOnBackdrop(dialog, event)) dialog.close();\n\n\t\t\tisBackdropPress = false;\n\t\t},\n\t\t{ signal },\n\t);\n}\n\nexport const radioKeys: Partial<Record<string, (index: number, count: number) => number>> = {\n\tArrowDown: (index, count) => (index + 1) % count,\n\tArrowLeft: (index, count) => (index - 1 + count) % count,\n\tArrowRight: (index, count) => (index + 1) % count,\n\tArrowUp: (index, count) => (index - 1 + count) % count,\n\tEnd: (_index, count) => count - 1,\n\tHome: () => 0,\n};\n","import type { ShareKitStrings } from './strings.js';\n\nimport { copyImage } from './actions.js';\n\nconst statusDurationMs = 4000;\n\nconst flashDurationMs = 2000;\n\nexport class ShareFeedback {\n\t#flashing = new WeakSet<HTMLElement>();\n\t#getStatus: () => HTMLElement | undefined;\n\t#strings: ShareKitStrings;\n\t#timeout: ReturnType<typeof setTimeout> | undefined;\n\n\tconstructor(getStatus: () => HTMLElement | undefined, strings: ShareKitStrings) {\n\t\tthis.#getStatus = getStatus;\n\t\tthis.#strings = strings;\n\t}\n\n\tannounce(message: string) {\n\t\tconst status = this.#getStatus();\n\n\t\tif (!status) return;\n\n\t\tstatus.textContent = message;\n\n\t\tclearTimeout(this.#timeout);\n\t\tthis.#timeout = setTimeout(() => {\n\t\t\tstatus.textContent = '';\n\t\t}, statusDurationMs);\n\t}\n\n\t// Safari only allows the clipboard write if it starts inside the click, before any await\n\tasync copyImage(file: Promise<File | undefined>, button: HTMLElement) {\n\t\ttry {\n\t\t\tawait copyImage(file);\n\t\t\tthis.#flash(button);\n\t\t} catch {\n\t\t\tthis.announce(this.#strings.error);\n\t\t}\n\t}\n\n\tasync copyText(text: string, button?: HTMLElement, fallback?: HTMLTextAreaElement) {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(text);\n\t\t\tthis.#flash(button);\n\t\t} catch {\n\t\t\tfallback?.select();\n\t\t\tthis.announce(fallback ? this.#strings.copyManual : this.#strings.error);\n\t\t}\n\t}\n\n\tdispose() {\n\t\tclearTimeout(this.#timeout);\n\t}\n\n\t#flash(button: HTMLElement | undefined) {\n\t\tthis.announce(this.#strings.copied);\n\n\t\tif (!button || this.#flashing.has(button)) return;\n\n\t\tconst label = button.textContent;\n\n\t\tthis.#flashing.add(button);\n\t\tbutton.textContent = this.#strings.copied;\n\n\t\tsetTimeout(() => {\n\t\t\tbutton.textContent = label;\n\t\t\tthis.#flashing.delete(button);\n\t\t}, flashDurationMs);\n\t}\n}\n","export const shareKitStringDefaults = {\n\tassetCopy: 'Copy',\n\tassetSave: 'Save',\n\tassetShare: 'Share',\n\tcaptionCopy: 'Copy caption',\n\tcaptionOver: '{count} over the limit for {destination}',\n\tcaptionReset: 'Reset',\n\tcaptionTitle: 'Caption',\n\tclose: 'Close',\n\tcopied: 'Copied',\n\tcopyManual: \"Couldn't copy. The caption is selected, so you can copy it yourself.\",\n\t'destination.any': 'Anywhere',\n\t'destination.bluesky': 'Bluesky',\n\t'destination.facebook': 'Facebook',\n\t'destination.instagram': 'Instagram',\n\t'destination.instagram-story': 'Story',\n\t'destination.linkedin': 'LinkedIn',\n\t'destination.mastodon': 'Mastodon',\n\t'destination.messages': 'Messages',\n\t'destination.pinterest': 'Pinterest',\n\t'destination.reddit': 'Reddit',\n\t'destination.threads': 'Threads',\n\t'destination.x': 'X',\n\tdestinationsMore: 'More',\n\tdestinationsTitle: 'Post to',\n\terror: 'Something went wrong. Try saving instead.',\n\t'hint.facebook':\n\t\t'Facebook only takes the link. Your caption is copied, so paste it into your post.',\n\t'hint.instagram':\n\t\t\"Links in Instagram captions aren't clickable. Point people to the link in your bio.\",\n\t'hint.instagram-story': 'Add the link to your Story with a link sticker.',\n\t'hint.linkedin':\n\t\t'LinkedIn only takes the link. Your caption is copied, so paste it into your post.',\n\t'hint.reddit': 'Reddit takes a title and the link.',\n\timagesTitle: 'Images',\n\tlinkCopy: 'Copy link',\n\tlinkTitle: 'Link',\n\tprimaryCopy: 'Copy caption',\n\tprimaryOpen: 'Open {destination}',\n\tprimaryShareImage: 'Share image',\n\tprimaryShareLink: 'Share link',\n\tprimaryShareText: 'Share',\n\tqrAlt: 'QR code for this page',\n\tqrTitle: 'Scan to continue on your phone',\n\tqrToggle: 'Continue on your phone',\n\tretry: 'Ready. Tap again to share.',\n\tsaved: 'Saved',\n\tsaveError: \"Couldn't save. Try again.\",\n\tsuggested: 'Suggested',\n\ttitle: 'Share this page',\n} as const;\n\nexport type ShareKitStringKey = keyof typeof shareKitStringDefaults;\n\nexport type ShareKitStrings = Record<ShareKitStringKey, string>;\n\nexport function isShareStringKey(key: string): key is ShareKitStringKey {\n\treturn Object.hasOwn(shareKitStringDefaults, key);\n}\n\nexport function formatShareString(template: string, values: Record<string, string>) {\n\treturn template.replaceAll(/\\{(\\w+)\\}/gu, (match, name: string) => values[name] ?? match);\n}\n","import type { ShareKitDestinationId } from './destinations.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitPayload, ShareKitSettings } from './types.js';\n\nimport { isShareDestinationId, shareDestinationAny } from './destinations.js';\nimport { isShareStringKey, shareKitStringDefaults } from './strings.js';\n\nfunction isPayload(value: unknown): value is ShareKitPayload {\n\tif (typeof value !== 'object' || value === null) return false;\n\n\tconst { assets, settings, title, url }: Partial<Record<keyof ShareKitPayload, unknown>> = value;\n\n\treturn (\n\t\ttypeof title === 'string' &&\n\t\ttypeof url === 'string' &&\n\t\tArray.isArray(assets) &&\n\t\ttypeof settings === 'object' &&\n\t\tsettings !== null\n\t);\n}\n\n// `<` is escaped so a title or description can't close the script element early\nexport function serializeShareKitPayload(payload: ShareKitPayload) {\n\treturn JSON.stringify(payload).replaceAll('<', String.raw`\\u003c`);\n}\n\nexport function readSharePayload(host: HTMLElement) {\n\tconst source = host.querySelector(':scope > script[type=\"application/json\"]')?.textContent;\n\n\tif (!source) return;\n\n\ttry {\n\t\tconst value: unknown = JSON.parse(source);\n\n\t\treturn isPayload(value) ? value : undefined;\n\t} catch {\n\t\treturn;\n\t}\n}\n\nexport function getShareStrings(overrides: Partial<Record<string, string>> = {}): ShareKitStrings {\n\tconst strings: ShareKitStrings = { ...shareKitStringDefaults };\n\n\tfor (const [key, value] of Object.entries(overrides)) {\n\t\tif (value !== undefined && isShareStringKey(key)) strings[key] = value;\n\t}\n\n\treturn strings;\n}\n\nfunction getIds(value: unknown) {\n\tif (!Array.isArray(value)) return [];\n\n\treturn [...new Set<unknown>(value)].filter(\n\t\t(id): id is ShareKitDestinationId => typeof id === 'string' && isShareDestinationId(id),\n\t);\n}\n\n// The payload arrives as JSON, so ids are checked again; an empty row would leave the radio group unreachable\nexport function getDestinationLists({ destinations, destinationsMore }: ShareKitSettings) {\n\tconst shown = getIds(destinations);\n\tconst main: Array<ShareKitDestinationId> = shown.length > 0 ? shown : [shareDestinationAny];\n\tconst more = getIds(destinationsMore).filter((id) => !main.includes(id));\n\n\treturn { main, more };\n}\n","import type { ShareCapability } from './actions.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitPayload } from './types.js';\n\nimport { createElement, createIcon, polyfillLightDismiss } from './dom.js';\n\ninterface ShareQrInput {\n\tcloseIcon: string | undefined;\n\tid: string;\n\tsignal: AbortSignal;\n\tstrings: Pick<ShareKitStrings, 'close' | 'qrAlt' | 'qrTitle'>;\n\turl: string;\n}\n\nconst iconSize = 24;\n\nconst qrSize = 200;\n\nasync function createQrSource(text: string) {\n\tconst [{ generate }, { toSvgDataURL }] = await Promise.all([\n\t\timport('lean-qr'),\n\t\timport('lean-qr/extras/svg'),\n\t]);\n\n\treturn toSvgDataURL(generate(text), { off: '#ffffff', on: '#000000', pad: 4, scale: 8 });\n}\n\n// Stacks over the share dialog rather than inside it, so opening the code moves nothing beneath\nclass ShareQrDialog {\n\treadonly dialog: HTMLDialogElement;\n\t#image: HTMLImageElement;\n\t#url: string;\n\n\tconstructor({ closeIcon, id, signal, strings, url }: ShareQrInput) {\n\t\tconst titleId = `${id}-title`;\n\n\t\tthis.#url = url;\n\t\tthis.#image = createElement('img', {\n\t\t\talt: strings.qrAlt,\n\t\t\tclass: 'share-kit-qr-image',\n\t\t\theight: String(qrSize),\n\t\t\twidth: String(qrSize),\n\t\t});\n\t\tthis.dialog = createElement(\n\t\t\t'dialog',\n\t\t\t{ 'aria-labelledby': titleId, class: 'share-kit-qr-dialog', closedby: 'any', id },\n\t\t\t[\n\t\t\t\tcreateElement('form', { class: 'share-kit-header', method: 'dialog' }, [\n\t\t\t\t\tcreateElement('h2', { class: 'share-kit-title', id: titleId }, [strings.qrTitle]),\n\t\t\t\t\tcreateElement(\n\t\t\t\t\t\t'button',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'aria-label': strings.close,\n\t\t\t\t\t\t\tclass: 'share-kit-icon-button',\n\t\t\t\t\t\t\ttitle: strings.close,\n\t\t\t\t\t\t\ttype: 'submit',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[closeIcon ? createIcon(closeIcon, iconSize) : '×'],\n\t\t\t\t\t),\n\t\t\t\t]),\n\t\t\t\tthis.#image,\n\t\t\t],\n\t\t);\n\n\t\tpolyfillLightDismiss(this.dialog, signal);\n\t}\n\n\tasync open() {\n\t\tif (!this.#image.getAttribute('src')) this.#image.src = await createQrSource(this.#url);\n\n\t\tthis.dialog.showModal();\n\t}\n}\n\ninterface ShareQrOptions extends Omit<ShareQrInput, 'url'> {\n\tcapabilities: ReadonlySet<ShareCapability>;\n\tpayload: ShareKitPayload;\n}\n\nfunction getQrUrl(url: string, openHash: string | undefined) {\n\tif (!openHash || !URL.canParse(url)) return url;\n\n\tconst target = new URL(url);\n\n\ttarget.hash = openHash;\n\n\treturn target.href;\n}\n\n// A phone is already where the code would lead, so it gets none\nexport function createShareQr({ capabilities, payload, ...input }: ShareQrOptions) {\n\tif (capabilities.has('handheld')) return;\n\n\treturn new ShareQrDialog({ ...input, url: getQrUrl(payload.url, payload.settings.openHash) });\n}\n","import type { ShareCapability } from './actions.js';\nimport type { ShareKitDestinationId } from './destinations.js';\nimport type { ShareKitIcons } from './icons.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitAsset, ShareKitClassRole, ShareKitPayload } from './types.js';\n\nimport { createElement, createIcon, joinClasses } from './dom.js';\n\ninterface RenderInput {\n\tcapabilities: ReadonlySet<ShareCapability>;\n\tdestinations: Array<ShareKitDestinationId>;\n\tdestinationsMore: Array<ShareKitDestinationId>;\n\ticons: ShareKitIcons;\n\tid: string;\n\tpayload: ShareKitPayload;\n\tstrings: ShareKitStrings;\n}\n\ntype RenderContext = RenderInput & {\n\tclassNames: Partial<Record<ShareKitClassRole, string>>;\n};\n\nconst destinationIconSize = 24;\n\ninterface ActionInput {\n\taction: string;\n\tdescribedBy?: string;\n\tlabel: string;\n}\n\nfunction renderAction({ classNames }: RenderContext, { action, describedBy, label }: ActionInput) {\n\treturn createElement(\n\t\t'button',\n\t\t{\n\t\t\t'aria-describedby': describedBy,\n\t\t\tclass: joinClasses('share-kit-action', classNames.action),\n\t\t\t'data-share-kit-action': action,\n\t\t\ttype: 'button',\n\t\t},\n\t\t[label],\n\t);\n}\n\nfunction renderHeading({ classNames }: RenderContext, children: Array<Node | string>, id?: string) {\n\treturn createElement(\n\t\t'h3',\n\t\t{ class: joinClasses('share-kit-heading', classNames.heading), id },\n\t\tchildren,\n\t);\n}\n\ninterface IconButtonInput {\n\taction: string;\n\tattributes?: Record<string, string>;\n\tfallback: string;\n\ticon: string | undefined;\n\tlabel: string;\n}\n\nfunction renderIconButton({ action, attributes, fallback, icon, label }: IconButtonInput) {\n\treturn createElement(\n\t\t'button',\n\t\t{\n\t\t\t...attributes,\n\t\t\t'aria-label': label,\n\t\t\tclass: 'share-kit-icon-button',\n\t\t\t'data-share-kit-action': action,\n\t\t\ttitle: label,\n\t\t\ttype: 'button',\n\t\t},\n\t\t[icon ? createIcon(icon, destinationIconSize) : fallback],\n\t);\n}\n\nfunction renderHeader(context: RenderContext) {\n\tconst { capabilities, icons, id, strings } = context;\n\tconst heading = createElement(\n\t\t'h2',\n\t\t{ class: 'share-kit-title', id: `${id}-title`, tabindex: '-1' },\n\t\t[strings.title],\n\t);\n\tconst qrToggle = capabilities.has('handheld')\n\t\t? undefined\n\t\t: renderIconButton({\n\t\t\t\taction: 'qr',\n\t\t\t\tattributes: { 'aria-haspopup': 'dialog' },\n\t\t\t\tfallback: 'QR',\n\t\t\t\ticon: icons.qr,\n\t\t\t\tlabel: strings.qrToggle,\n\t\t\t});\n\tconst close = renderIconButton({\n\t\taction: 'close',\n\t\tfallback: '×',\n\t\ticon: icons.close,\n\t\tlabel: strings.close,\n\t});\n\n\treturn {\n\t\theader: createElement('header', { class: 'share-kit-header' }, [\n\t\t\theading,\n\t\t\tcreateElement('div', { class: 'share-kit-header-actions' }, [qrToggle, close]),\n\t\t]),\n\t\theading,\n\t};\n}\n\nfunction renderDestination(context: RenderContext, destination: ShareKitDestinationId) {\n\tconst { classNames, icons, strings } = context;\n\tconst icon = icons[destination];\n\n\treturn createElement(\n\t\t'button',\n\t\t{\n\t\t\t'aria-checked': 'false',\n\t\t\tclass: joinClasses('share-kit-destination', classNames.destination),\n\t\t\t'data-share-kit-action': 'destination',\n\t\t\t'data-share-kit-destination': destination,\n\t\t\trole: 'radio',\n\t\t\ttabindex: '-1',\n\t\t\ttype: 'button',\n\t\t},\n\t\t[\n\t\t\ticon ? createIcon(icon, destinationIconSize) : undefined,\n\t\t\tcreateElement('span', {}, [strings[`destination.${destination}`]]),\n\t\t],\n\t);\n}\n\nfunction renderDestinations(context: RenderContext) {\n\tconst { destinations, destinationsMore, icons, id, strings } = context;\n\tconst headingId = `${id}-destinations`;\n\tconst more =\n\t\tdestinationsMore.length > 0\n\t\t\t? createElement(\n\t\t\t\t\t'button',\n\t\t\t\t\t{\n\t\t\t\t\t\tclass: joinClasses('share-kit-destination', context.classNames.destination),\n\t\t\t\t\t\t'data-share-kit-action': 'more',\n\t\t\t\t\t\ttype: 'button',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\ticons.more ? createIcon(icons.more, destinationIconSize) : undefined,\n\t\t\t\t\t\tcreateElement('span', {}, [strings.destinationsMore]),\n\t\t\t\t\t],\n\t\t\t\t)\n\t\t\t: undefined;\n\tconst extra = destinationsMore.map((destination) => {\n\t\tconst button = renderDestination(context, destination);\n\n\t\tbutton.hidden = true;\n\n\t\treturn button;\n\t});\n\tconst group = createElement(\n\t\t'div',\n\t\t{ 'aria-labelledby': headingId, class: 'share-kit-destinations', role: 'radiogroup' },\n\t\t[...destinations.map((destination) => renderDestination(context, destination)), ...extra],\n\t);\n\n\treturn {\n\t\tmore,\n\t\tsection: createElement('section', { class: 'share-kit-section' }, [\n\t\t\trenderHeading(context, [strings.destinationsTitle], headingId),\n\t\t\tcreateElement('div', { class: 'share-kit-destinations-row' }, [group, more]),\n\t\t]),\n\t};\n}\n\nfunction renderCaption(context: RenderContext) {\n\tconst { classNames, id, payload, strings } = context;\n\tconst captionId = `${id}-caption`;\n\tconst countId = `${id}-count`;\n\tconst hintId = `${id}-hint`;\n\tconst caption = createElement('textarea', {\n\t\t'aria-describedby': `${countId} ${hintId}`,\n\t\tclass: joinClasses('share-kit-caption', classNames.input),\n\t\tdir: 'auto',\n\t\tid: captionId,\n\t\tlang: payload.locale,\n\t\trows: '6',\n\t});\n\tconst count = createElement('span', { class: 'share-kit-count', id: countId });\n\tconst captionCopy = renderAction(context, { action: 'copy-caption', label: strings.captionCopy });\n\tconst hint = createElement('p', { class: 'share-kit-hint', id: hintId });\n\n\treturn {\n\t\tcaption,\n\t\tcaptionCopy,\n\t\tcount,\n\t\thint,\n\t\tsection: createElement('section', { class: 'share-kit-section' }, [\n\t\t\trenderHeading(context, [createElement('label', { for: captionId }, [strings.captionTitle])]),\n\t\t\tcaption,\n\t\t\tcreateElement('div', { class: 'share-kit-caption-meta' }, [\n\t\t\t\tcount,\n\t\t\t\tcreateElement('span', { class: 'share-kit-actions' }, [\n\t\t\t\t\trenderAction(context, { action: 'reset', label: strings.captionReset }),\n\t\t\t\t\tcaptionCopy,\n\t\t\t\t]),\n\t\t\t]),\n\t\t\thint,\n\t\t]),\n\t};\n}\n\ninterface TileInput {\n\tactions: Array<[action: string, label: string]>;\n\tasset: ShareKitAsset;\n\tkey: string;\n}\n\nfunction renderTile(context: RenderContext, { actions, asset, key }: TileInput) {\n\tconst labelId = `${context.id}-asset-${key}`;\n\tconst badge = createElement('span', { class: 'share-kit-badge' }, [context.strings.suggested]);\n\n\tbadge.hidden = true;\n\n\treturn createElement(\n\t\t'li',\n\t\t{\n\t\t\tclass: 'share-kit-tile',\n\t\t\t'data-share-kit-asset': key,\n\t\t\t'data-share-kit-role': asset.role,\n\t\t},\n\t\t[\n\t\t\tcreateElement('img', {\n\t\t\t\talt: asset.alt,\n\t\t\t\tclass: 'share-kit-preview',\n\t\t\t\tdecoding: 'async',\n\t\t\t\theight: String(asset.height),\n\t\t\t\tloading: 'lazy',\n\t\t\t\tsrc: asset.previewSrc,\n\t\t\t\twidth: String(asset.width),\n\t\t\t}),\n\t\t\tcreateElement('div', { class: 'share-kit-tile-label' }, [\n\t\t\t\tcreateElement('span', { id: labelId }, [asset.label]),\n\t\t\t\tbadge,\n\t\t\t]),\n\t\t\tcreateElement(\n\t\t\t\t'div',\n\t\t\t\t{ class: 'share-kit-actions' },\n\t\t\t\tactions.map(([action, label]) =>\n\t\t\t\t\trenderAction(context, { action, describedBy: labelId, label }),\n\t\t\t\t),\n\t\t\t),\n\t\t],\n\t);\n}\n\nfunction getAssetActions({ capabilities, strings }: RenderContext) {\n\tconst actions: Array<[string, string]> = [];\n\tconst canShare = capabilities.has('files');\n\n\tif (canShare) actions.push(['share', strings.assetShare]);\n\n\t// On a phone the share sheet already offers copying\n\tif (capabilities.has('copy-image') && !(canShare && capabilities.has('handheld'))) {\n\t\tactions.push(['copy', strings.assetCopy]);\n\t}\n\n\tactions.push(['save', strings.assetSave]);\n\n\treturn actions;\n}\n\nfunction renderImages(context: RenderContext) {\n\tconst { payload, strings } = context;\n\tconst actions = getAssetActions(context);\n\tconst counts = new Map<string, number>();\n\tconst assets = new Map<HTMLElement, ShareKitAsset>();\n\n\tfor (const asset of payload.assets) {\n\t\tconst number = (counts.get(asset.role) ?? 0) + 1;\n\t\tconst key = asset.role === 'photo' ? `photo-${String(number)}` : asset.role;\n\n\t\tcounts.set(asset.role, number);\n\t\tassets.set(renderTile(context, { actions, asset, key }), asset);\n\t}\n\n\tconst grid = createElement('ul', { class: 'share-kit-grid' }, [...assets.keys()]);\n\n\treturn {\n\t\tassets,\n\t\tgrid,\n\t\tsection: createElement('section', { class: 'share-kit-section' }, [\n\t\t\trenderHeading(context, [strings.imagesTitle]),\n\t\t\tgrid,\n\t\t]),\n\t};\n}\n\nfunction renderLink(context: RenderContext) {\n\tconst { payload, strings } = context;\n\n\treturn createElement('section', { class: 'share-kit-section' }, [\n\t\trenderHeading(context, [strings.linkTitle]),\n\t\tcreateElement('div', { class: 'share-kit-link-row' }, [\n\t\t\tcreateElement('p', { class: 'share-kit-link' }, [payload.url]),\n\t\t\trenderAction(context, { action: 'copy-link', label: strings.linkCopy }),\n\t\t]),\n\t]);\n}\n\nexport interface ShareKitParts {\n\tassets: ReadonlyMap<HTMLElement, ShareKitAsset>;\n\tcaption: HTMLTextAreaElement;\n\tcaptionCopy: HTMLElement;\n\tcount: HTMLElement;\n\tdialog: HTMLDialogElement;\n\tgrid: HTMLElement;\n\theading: HTMLElement;\n\thint: HTMLElement;\n\tmore: HTMLElement | undefined;\n\tprimary: HTMLButtonElement;\n\tstatus: HTMLElement;\n\ttiles: Array<HTMLElement>;\n}\n\nexport function renderShareKit(input: RenderInput): ShareKitParts {\n\tconst context: RenderContext = { ...input, classNames: input.payload.settings.classNames ?? {} };\n\tconst { header, heading } = renderHeader(context);\n\tconst destinations = renderDestinations(context);\n\tconst caption = renderCaption(context);\n\tconst images = renderImages(context);\n\tconst status = createElement('p', { class: 'share-kit-status', role: 'status' });\n\tconst primary = createElement('button', {\n\t\tclass: joinClasses('share-kit-primary', context.classNames.primary),\n\t\t'data-share-kit-action': 'primary',\n\t\ttype: 'button',\n\t});\n\tconst dialog = createElement(\n\t\t'dialog',\n\t\t{ 'aria-labelledby': heading.id, class: 'share-kit-dialog', closedby: 'any', id: input.id },\n\t\t[\n\t\t\tcreateElement('div', { class: 'share-kit-body' }, [\n\t\t\t\theader,\n\t\t\t\tcreateElement('div', { class: 'share-kit-scroll' }, [\n\t\t\t\t\tdestinations.section,\n\t\t\t\t\tcaption.section,\n\t\t\t\t\timages.section,\n\t\t\t\t\trenderLink(context),\n\t\t\t\t]),\n\t\t\t\tcreateElement('footer', { class: 'share-kit-footer' }, [status, primary]),\n\t\t\t]),\n\t\t],\n\t);\n\n\treturn {\n\t\tassets: images.assets,\n\t\tcaption: caption.caption,\n\t\tcaptionCopy: caption.captionCopy,\n\t\tcount: caption.count,\n\t\tdialog,\n\t\tgrid: images.grid,\n\t\theading,\n\t\thint: caption.hint,\n\t\tmore: destinations.more,\n\t\tprimary,\n\t\tstatus,\n\t\ttiles: [...images.assets.keys()],\n\t};\n}\n","import type { ShareKitDestinationId, SharePrimaryAction } from './destinations.js';\nimport type { ShareKitParts } from './render.js';\nimport type { ShareKitStrings } from './strings.js';\n\nimport { countCaption } from './caption.js';\nimport { getShareDestination } from './destinations.js';\nimport { formatShareString, isShareStringKey } from './strings.js';\n\nconst primaryLabels = {\n\t'copy-caption': 'primaryCopy',\n\t'open-composer': 'primaryOpen',\n\t'share-image': 'primaryShareImage',\n\t'share-link': 'primaryShareLink',\n\t'share-text': 'primaryShareText',\n} as const satisfies Record<SharePrimaryAction, keyof ShareKitStrings>;\n\nexport function getSuggestedAsset(assets: Array<HTMLElement>, destination: ShareKitDestinationId) {\n\tconst { assetRole } = getShareDestination(destination);\n\n\treturn (\n\t\tassets.find((asset) => asset.dataset.shareKitRole === assetRole) ??\n\t\tassets.find((asset) => asset.dataset.shareKitRole === 'landscape') ??\n\t\tassets[0]\n\t);\n}\n\ninterface SyncInput {\n\tdestination: ShareKitDestinationId;\n\tparts: ShareKitParts;\n\tstrings: ShareKitStrings;\n}\n\ninterface SyncCaptionInput extends SyncInput {\n\tprimaryAction: SharePrimaryAction;\n}\n\nexport function syncCaptionView({ destination, parts, primaryAction, strings }: SyncCaptionInput) {\n\tconst { limit } = getShareDestination(destination);\n\tconst count = countCaption(parts.caption.value, destination);\n\tconst isOver = limit !== undefined && count > limit;\n\tconst label = strings[`destination.${destination}`];\n\n\tparts.count.textContent =\n\t\tlimit === undefined ? String(count) : `${String(count)} / ${String(limit)}`;\n\tparts.count.toggleAttribute('data-share-kit-over', isOver);\n\tparts.caption.setAttribute('aria-invalid', String(isOver));\n\tparts.captionCopy.hidden = primaryAction === 'copy-caption';\n\tparts.primary.textContent = formatShareString(strings[primaryLabels[primaryAction]], {\n\t\tdestination: label,\n\t});\n\n\treturn {\n\t\tisOver,\n\t\tmessage: formatShareString(strings.captionOver, {\n\t\t\tcount: String(count - (limit ?? 0)),\n\t\t\tdestination: label,\n\t\t}),\n\t};\n}\n\ninterface SyncDestinationInput extends SyncInput {\n\tassets: Array<HTMLElement>;\n\tsuggested: HTMLElement | undefined;\n}\n\nexport function syncDestinationView({\n\tassets,\n\tdestination,\n\tparts,\n\tstrings,\n\tsuggested,\n}: SyncDestinationInput) {\n\tfor (const radio of parts.dialog.querySelectorAll<HTMLElement>('[role=\"radio\"]')) {\n\t\tconst isSelected = radio.dataset.shareKitDestination === destination;\n\n\t\tradio.setAttribute('aria-checked', String(isSelected));\n\t\tradio.tabIndex = isSelected ? 0 : -1;\n\t}\n\n\tconst hintKey = `hint.${destination}`;\n\n\tparts.hint.textContent = isShareStringKey(hintKey) ? strings[hintKey] : '';\n\tparts.hint.hidden = parts.hint.textContent === '';\n\n\tfor (const asset of assets) {\n\t\tconst badge = asset.querySelector<HTMLElement>('.share-kit-badge');\n\n\t\tif (badge) badge.hidden = asset !== suggested;\n\t}\n\n\tparts.grid.append(...parts.tiles);\n\n\tif (suggested) parts.grid.prepend(suggested);\n}\n","import type { ShareKitDestinationId } from './destinations.js';\nimport type { ShareKitStringKey } from './strings.js';\n\nexport type ShareKitAssetRole = 'landscape' | 'photo' | 'portrait' | 'story';\n\nexport interface ShareKitAsset {\n\talt: string;\n\tfilename: string;\n\theight: number;\n\tlabel: string;\n\tpreviewSrc: string;\n\trole: ShareKitAssetRole;\n\tsrc: string;\n\ttype: string;\n\twidth: number;\n}\n\nexport type ShareKitClassRole = 'action' | 'destination' | 'heading' | 'input' | 'primary';\n\nexport interface ShareKitSettings {\n\tclassNames?: Partial<Record<ShareKitClassRole, string>>;\n\tdestinations: ReadonlyArray<ShareKitDestinationId>;\n\tdestinationsMore?: ReadonlyArray<ShareKitDestinationId>;\n\topenHash?: string;\n\tutmMedium?: string;\n}\n\nexport interface ShareKitPayload {\n\tassets: ReadonlyArray<ShareKitAsset>;\n\tdescription?: string;\n\tlocale: string;\n\tsettings: ShareKitSettings;\n\tstrings?: Partial<Record<ShareKitStringKey, string>>;\n\ttitle: string;\n\turl: string;\n}\n\nexport const shareKitActionEventName = 'share-kit:action';\n\nexport type ShareKitAction =\n\t| 'copy'\n\t| 'copy-caption'\n\t| 'copy-link'\n\t| 'destination'\n\t| 'open'\n\t| 'open-composer'\n\t| 'qr'\n\t| 'save'\n\t| 'share'\n\t| 'share-link'\n\t| 'share-text';\n\nexport interface ShareKitActionDetail {\n\taction: ShareKitAction;\n\tasset?: string;\n\tdestination: ShareKitDestinationId;\n}\n\ndeclare global {\n\tinterface GlobalEventHandlersEventMap {\n\t\t[shareKitActionEventName]: CustomEvent<ShareKitActionDetail>;\n\t}\n}\n","import type { ShareCapability } from './actions.js';\nimport type { ShareOutcome } from './assets.js';\nimport type { ShareKitDestinationId, SharePrimaryAction } from './destinations.js';\nimport type { ShareKitIcons } from './icons.js';\nimport type { ShareKitParts } from './render.js';\nimport type { ShareKitStrings } from './strings.js';\nimport type { ShareKitAction, ShareKitActionDetail, ShareKitPayload } from './types.js';\n\nimport { clearOpenHash, getShareCapabilities, isDomError, isOpenHash } from './actions.js';\nimport { ShareAssetFiles } from './assets.js';\nimport { fitCaption } from './caption.js';\nimport {\n\tgetDestinationUrl,\n\tgetPrimaryAction,\n\tgetShareDestination,\n\tisShareDestinationId,\n\tshareDestinationAny,\n} from './destinations.js';\nimport { polyfillLightDismiss, radioKeys } from './dom.js';\nimport { ShareFeedback } from './feedback.js';\nimport { getDestinationLists, getShareStrings, readSharePayload } from './payload.js';\nimport { createShareQr } from './qr.js';\nimport { renderShareKit } from './render.js';\nimport { shareKitStringDefaults } from './strings.js';\nimport { getSuggestedAsset, syncCaptionView, syncDestinationView } from './sync.js';\nimport { shareKitActionEventName } from './types.js';\n\nconst outcomeMessages = {\n\terror: 'error',\n\tretry: 'retry',\n\tsaved: 'saved',\n\tunsaved: 'saveError',\n} as const satisfies Partial<Record<ShareOutcome, keyof ShareKitStrings>>;\n\nlet dialogCount = 0;\n\nfunction isKeyOf<Key extends string>(record: Record<Key, unknown>, key: string): key is Key {\n\treturn Object.hasOwn(record, key);\n}\n\n// Server rendering has no `HTMLElement`; the stand-in lets the module load there and is never constructed\nconst BaseElement =\n\ttypeof HTMLElement === 'undefined' ? (Object as unknown as typeof HTMLElement) : HTMLElement;\n\nexport class ShareKitElement extends BaseElement {\n\tprotected readonly icons: ShareKitIcons = {};\n\n\t#abortController: AbortController | undefined;\n\t#actions = {\n\t\tclose: () => {\n\t\t\tthis.#parts?.dialog.close();\n\t\t},\n\t\tcopy: (button: HTMLElement, tile?: HTMLElement) => {\n\t\t\tif (!tile) return;\n\n\t\t\tthis.#track('copy', tile);\n\t\t\tvoid this.#feedback?.copyImage(this.#files?.load(tile) ?? Promise.resolve(undefined), button);\n\t\t},\n\t\t'copy-caption': (button: HTMLElement) => {\n\t\t\tthis.#track('copy-caption');\n\t\t\tvoid this.#copyCaption(button);\n\t\t},\n\t\t'copy-link': (button: HTMLElement) => {\n\t\t\tthis.#track('copy-link');\n\t\t\tvoid this.#feedback?.copyText(this.#payload?.url ?? '', button);\n\t\t},\n\t\tdestination: (button: HTMLElement) => {\n\t\t\tconst id = button.dataset.shareKitDestination;\n\n\t\t\tif (!id || !isShareDestinationId(id)) return;\n\n\t\t\tthis.#selectDestination(id);\n\t\t\tthis.#track('destination');\n\t\t},\n\t\tmore: (button: HTMLElement) => {\n\t\t\tthis.#showMore(button);\n\t\t},\n\t\tprimary: () => {\n\t\t\tthis.#primaryActions[this.#getPrimaryAction()]();\n\t\t},\n\t\tqr: () => {\n\t\t\tvoid this.#openQr();\n\t\t},\n\t\treset: () => {\n\t\t\tthis.#isCaptionEdited = false;\n\t\t\tthis.#syncDestination();\n\t\t},\n\t\tsave: (_button: HTMLElement, tile?: HTMLElement) => {\n\t\t\tif (tile) void this.#saveAsset(tile);\n\t\t},\n\t\tshare: (_button: HTMLElement, tile?: HTMLElement) => {\n\t\t\tif (tile) void this.#shareAssets([tile]);\n\t\t},\n\t};\n\t#capabilities = new Set<ShareCapability>();\n\t#destination: ShareKitDestinationId = shareDestinationAny;\n\t#feedback: ShareFeedback | undefined;\n\t#files: ShareAssetFiles | undefined;\n\t#isCaptionEdited = false;\n\t#isOver = false;\n\t#parts: ShareKitParts | undefined;\n\t#payload: ShareKitPayload | undefined;\n\t#primaryActions = {\n\t\t'copy-caption': () => {\n\t\t\tthis.#track('copy-caption');\n\t\t\tvoid this.#copyCaption();\n\t\t},\n\t\t// The composer can't always take the text, so it rides along on the clipboard\n\t\t'open-composer': () => {\n\t\t\tconst url = this.#getComposerUrl();\n\n\t\t\tif (!url) return;\n\n\t\t\tthis.#track('open-composer');\n\t\t\tvoid this.#copyCaption();\n\t\t\twindow.open(url, '_blank', 'noopener');\n\t\t},\n\t\t// Both start inside the tap, before any await, or the browser refuses one of them\n\t\t'share-image': () => {\n\t\t\tconst tile = this.#getSuggestedAsset();\n\n\t\t\tif (!tile) return;\n\n\t\t\tvoid this.#copyCaption();\n\t\t\tvoid this.#shareAssets([tile]);\n\t\t},\n\t\t// The platform's app drops shared text too, so the caption rides on the clipboard as with an image\n\t\t'share-link': () => {\n\t\t\tvoid this.#copyCaption();\n\t\t\tvoid this.#shareData('share-link', { url: this.#getUrl() });\n\t\t},\n\t\t'share-text': () => {\n\t\t\tconst text = this.#parts?.caption.value;\n\n\t\t\tif (text) void this.#shareData('share-text', { text });\n\t\t},\n\t} satisfies Record<SharePrimaryAction, () => void>;\n\t#qr: ReturnType<typeof createShareQr>;\n\t#strings: ShareKitStrings = shareKitStringDefaults;\n\n\tconnectedCallback() {\n\t\tif (this.#abortController) return;\n\n\t\tconst payload = readSharePayload(this);\n\n\t\tif (!payload) {\n\t\t\tthis.#retryWhenParsed();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#abortController = new AbortController();\n\t\tthis.#payload = payload;\n\t\tthis.#strings = getShareStrings(payload.strings);\n\t\tthis.#feedback = new ShareFeedback(() => this.#parts?.status, this.#strings);\n\n\t\tconst { signal } = this.#abortController;\n\n\t\tthis.#capabilities = new Set(getShareCapabilities(this.dataset.can));\n\t\tthis.#files = new ShareAssetFiles({\n\t\t\tcanShare: this.#capabilities.has('files'),\n\t\t\tgetSource: (tile) => this.#parts?.assets.get(tile),\n\t\t\tsignal,\n\t\t});\n\n\t\tthis.addEventListener('click', this.#handleClick, { signal });\n\t\tthis.addEventListener('input', this.#handleInput, { signal });\n\t\tthis.addEventListener('keydown', this.#handleKeydown, { signal });\n\t\tthis.addEventListener('error', this.#handlePreviewError, { capture: true, signal });\n\t\tthis.addEventListener('pointerover', ({ target }) => this.#files?.warm(target), { signal });\n\t\twindow.addEventListener('hashchange', this.#handleHashChange, { signal });\n\t\t// The trigger ships disabled so a tap before this runs isn't silently lost\n\t\tthis.querySelector('[data-share-kit-trigger]')?.toggleAttribute('disabled', false);\n\n\t\t// Deferred so a listener added after `defineShareKit()` in the same task still hears `open`\n\t\tqueueMicrotask(() => {\n\t\t\tif (!signal.aborted && isOpenHash(payload.settings.openHash)) this.#open();\n\t\t});\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.#parts?.dialog.remove();\n\t\tthis.#parts = undefined;\n\t\tthis.#qr = undefined;\n\t\tthis.#abortController?.abort();\n\t\tthis.#abortController = undefined;\n\t\tthis.#feedback?.dispose();\n\t\tthis.#feedback = undefined;\n\t\tthis.#files?.dispose();\n\t\tthis.#files = undefined;\n\t\tthis.#destination = shareDestinationAny;\n\t\tthis.#isCaptionEdited = false;\n\t\tthis.#isOver = false;\n\t}\n\n\t// A failed write selects the caption, so it is ready to copy by hand once the reader is back\n\tasync #copyCaption(button?: HTMLElement) {\n\t\tconst caption = this.#parts?.caption;\n\n\t\tif (caption) await this.#feedback?.copyText(caption.value, button, caption);\n\t}\n\n\t#getAssets() {\n\t\treturn (this.#parts?.tiles ?? []).filter((tile) => tile.dataset.shareKitState !== 'failed');\n\t}\n\n\t#getComposerUrl() {\n\t\tconst parts = this.#parts;\n\n\t\tif (!parts) return;\n\n\t\tconst suggested = this.#getSuggestedAsset();\n\t\tconst media = suggested ? parts.assets.get(suggested)?.src : undefined;\n\n\t\treturn getShareDestination(this.#destination).getComposerUrl?.({\n\t\t\tmedia: media ? new URL(media, location.href).href : undefined,\n\t\t\ttext: parts.caption.value,\n\t\t\turl: this.#getUrl(),\n\t\t});\n\t}\n\n\t#getPrimaryAction() {\n\t\treturn getPrimaryAction({\n\t\t\tcanShareFiles: this.#capabilities.has('files') && this.#getSuggestedAsset() !== undefined,\n\t\t\tcanShareText: this.#capabilities.has('link'),\n\t\t\thasComposerUrl: this.#getComposerUrl() !== undefined,\n\t\t\tid: this.#destination,\n\t\t\tisHandheld: this.#capabilities.has('handheld'),\n\t\t});\n\t}\n\n\t#getSuggestedAsset() {\n\t\treturn getSuggestedAsset(this.#getAssets(), this.#destination);\n\t}\n\n\t#getUrl() {\n\t\tconst payload = this.#payload;\n\n\t\tif (!payload) return '';\n\n\t\treturn getDestinationUrl(payload.url, this.#destination, payload.settings.utmMedium);\n\t}\n\n\t#handleClick = (event: MouseEvent) => {\n\t\tif (!(event.target instanceof Element)) return;\n\n\t\tif (event.target.closest('[data-share-kit-trigger]')) {\n\t\t\tthis.#open();\n\t\t\treturn;\n\t\t}\n\n\t\tconst button = event.target.closest<HTMLElement>('[data-share-kit-action]');\n\t\tconst action = button?.dataset.shareKitAction;\n\n\t\tif (!button || !action || !isKeyOf(this.#actions, action)) return;\n\n\t\tthis.#actions[action](\n\t\t\tbutton,\n\t\t\tbutton.closest<HTMLElement>('[data-share-kit-asset]') ?? undefined,\n\t\t);\n\t};\n\n\t#handleClose = () => {\n\t\tclearOpenHash(this.#payload?.settings.openHash);\n\t};\n\n\t#handleHashChange = () => {\n\t\tif (isOpenHash(this.#payload?.settings.openHash)) this.#open();\n\t};\n\n\t#handleInput = (event: Event) => {\n\t\tif (event.target === this.#parts?.caption) this.#isCaptionEdited = true;\n\n\t\tthis.#syncCaption();\n\t};\n\n\t#handleKeydown = (event: KeyboardEvent) => {\n\t\tconst move = radioKeys[event.key];\n\n\t\tif (!move || !(event.target instanceof HTMLElement) || event.target.role !== 'radio') return;\n\n\t\tconst radios = [...this.querySelectorAll<HTMLElement>('[role=\"radio\"]:not([hidden])')];\n\t\tconst next = radios[move(radios.indexOf(event.target), radios.length)];\n\t\tconst id = next?.dataset.shareKitDestination;\n\n\t\tif (!next || !id || !isShareDestinationId(id)) return;\n\n\t\tevent.preventDefault();\n\t\tthis.#selectDestination(id);\n\t\tnext.focus();\n\t};\n\n\t#handlePreviewError = (event: Event) => {\n\t\tif (!(event.target instanceof HTMLImageElement)) return;\n\n\t\tconst tile = event.target.closest<HTMLElement>('[data-share-kit-asset]');\n\n\t\tif (!tile) return;\n\n\t\ttile.dataset.shareKitState = 'failed';\n\t\tthis.#syncDestination();\n\t};\n\n\t#open() {\n\t\tconst parts = this.#parts ?? this.#render();\n\n\t\tif (!parts || parts.dialog.open) return;\n\n\t\tparts.dialog.showModal();\n\t\t// Focusing the heading lets a screen reader start from the dialog's name\n\t\tparts.heading.focus();\n\t\tthis.#track('open');\n\t\t// Synced again once open, since a status written to a closed dialog goes unannounced\n\t\tthis.#isOver = false;\n\t\tthis.#syncCaption();\n\t}\n\n\tasync #openQr() {\n\t\tthis.#track('qr');\n\n\t\ttry {\n\t\t\tawait this.#qr?.open();\n\t\t} catch {\n\t\t\tthis.#feedback?.announce(this.#strings.error);\n\t\t}\n\t}\n\n\t// The primary button shares the suggested image on a phone, so only that file is fetched ahead\n\t#prefetch() {\n\t\tif (!this.#capabilities.has('files') || !this.#capabilities.has('handheld')) return;\n\n\t\tconst tile = this.#getSuggestedAsset();\n\n\t\tif (tile) void this.#files?.load(tile);\n\t}\n\n\t#render() {\n\t\tconst payload = this.#payload;\n\t\tconst signal = this.#abortController?.signal;\n\n\t\tif (!payload || !signal) return;\n\n\t\tconst { main, more } = getDestinationLists(payload.settings);\n\n\t\tdialogCount += 1;\n\n\t\tconst id = `share-kit-${String(dialogCount)}`;\n\t\tconst parts = renderShareKit({\n\t\t\tcapabilities: this.#capabilities,\n\t\t\tdestinations: main,\n\t\t\tdestinationsMore: more,\n\t\t\ticons: this.icons,\n\t\t\tid,\n\t\t\tpayload,\n\t\t\tstrings: this.#strings,\n\t\t});\n\n\t\tthis.#qr = createShareQr({\n\t\t\tcapabilities: this.#capabilities,\n\t\t\tcloseIcon: this.icons.close,\n\t\t\tid: `${id}-qr`,\n\t\t\tpayload,\n\t\t\tsignal,\n\t\t\tstrings: this.#strings,\n\t\t});\n\n\t\tif (this.#qr) parts.dialog.append(this.#qr.dialog);\n\n\t\tparts.dialog.addEventListener('close', this.#handleClose, { signal });\n\t\tpolyfillLightDismiss(parts.dialog, signal);\n\t\tthis.append(parts.dialog);\n\t\tthis.#parts = parts;\n\t\tthis.#destination = main[0] ?? shareDestinationAny;\n\t\tthis.#syncDestination();\n\n\t\treturn parts;\n\t}\n\n\t#report(outcome: ShareOutcome | undefined) {\n\t\tif (outcome && isKeyOf(outcomeMessages, outcome)) {\n\t\t\tthis.#feedback?.announce(this.#strings[outcomeMessages[outcome]]);\n\t\t}\n\t}\n\n\t// A classic script in the head defines the element before its children are parsed\n\t#retryWhenParsed() {\n\t\tif (document.readyState !== 'loading') return;\n\n\t\tdocument.addEventListener(\n\t\t\t'DOMContentLoaded',\n\t\t\t() => {\n\t\t\t\tif (this.isConnected) this.connectedCallback();\n\t\t\t},\n\t\t\t{ once: true },\n\t\t);\n\t}\n\n\tasync #saveAsset(tile: HTMLElement) {\n\t\tthis.#track('save', tile);\n\t\tthis.#report(await this.#files?.save(tile));\n\t}\n\n\t// An edited caption keeps the reader's words but swaps in the new destination's tagged link\n\t#selectDestination(id: ShareKitDestinationId) {\n\t\tconst previousUrl = this.#getUrl();\n\t\tconst caption = this.#parts?.caption;\n\n\t\tthis.#destination = id;\n\n\t\tif (caption && this.#isCaptionEdited) {\n\t\t\tconst url = this.#getUrl();\n\n\t\t\tcaption.value = caption.value.replaceAll(previousUrl, () => url);\n\t\t}\n\n\t\tthis.#syncDestination();\n\t}\n\n\tasync #shareAssets(tiles: Array<HTMLElement>) {\n\t\tconst [first] = tiles;\n\n\t\tif (!first) return;\n\n\t\tthis.#track('share', first);\n\t\tthis.#report(await this.#files?.share(tiles));\n\t}\n\n\tasync #shareData(action: 'share-link' | 'share-text', data: ShareData) {\n\t\tthis.#track(action);\n\n\t\ttry {\n\t\t\tawait navigator.share(data);\n\t\t} catch (error) {\n\t\t\tif (!isDomError(error, 'AbortError')) this.#feedback?.announce(this.#strings.error);\n\t\t}\n\t}\n\n\t#showMore(button: HTMLElement) {\n\t\tconst hidden = [...this.querySelectorAll<HTMLElement>('[role=\"radio\"][hidden]')];\n\n\t\tfor (const radio of hidden) radio.hidden = false;\n\n\t\tbutton.hidden = true;\n\t\thidden[0]?.focus();\n\t}\n\n\t#syncCaption() {\n\t\tconst parts = this.#parts;\n\n\t\tif (!parts) return;\n\n\t\tconst { isOver, message } = syncCaptionView({\n\t\t\tdestination: this.#destination,\n\t\t\tparts,\n\t\t\tprimaryAction: this.#getPrimaryAction(),\n\t\t\tstrings: this.#strings,\n\t\t});\n\n\t\tif (isOver && !this.#isOver && parts.dialog.open) this.#feedback?.announce(message);\n\n\t\tthis.#isOver = isOver;\n\t}\n\n\t#syncDestination() {\n\t\tconst parts = this.#parts;\n\t\tconst payload = this.#payload;\n\n\t\tif (!parts || !payload) return;\n\n\t\tsyncDestinationView({\n\t\t\tassets: this.#getAssets(),\n\t\t\tdestination: this.#destination,\n\t\t\tparts,\n\t\t\tstrings: this.#strings,\n\t\t\tsuggested: this.#getSuggestedAsset(),\n\t\t});\n\n\t\tif (!this.#isCaptionEdited) {\n\t\t\tparts.caption.value = fitCaption(\n\t\t\t\t{ description: payload.description, title: payload.title, url: this.#getUrl() },\n\t\t\t\tthis.#destination,\n\t\t\t\tpayload.locale,\n\t\t\t).text;\n\t\t}\n\n\t\tthis.#syncCaption();\n\t\tthis.#prefetch();\n\t}\n\n\t#track(action: ShareKitAction, tile?: HTMLElement) {\n\t\tconst detail: ShareKitActionDetail = { action, destination: this.#destination };\n\n\t\tif (tile?.dataset.shareKitAsset) detail.asset = tile.dataset.shareKitAsset;\n\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(shareKitActionEventName, { bubbles: true, composed: true, detail }),\n\t\t);\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'share-kit': ShareKitElement;\n\t}\n}\n","import type { ShareKitIcons } from './icons.js';\n\nimport { ShareKitElement } from './element.js';\n\nexport interface ShareKitOptions {\n\ticons?: ShareKitIcons;\n}\n\nconst tagName = 'share-kit';\n\n// An element name registers once per page, so the first call's options stand\nexport function defineShareKit({ icons = {} }: ShareKitOptions = {}) {\n\tif (customElements.get(tagName)) return;\n\n\tcustomElements.define(\n\t\ttagName,\n\t\tclass extends ShareKitElement {\n\t\t\tprotected override readonly icons = icons;\n\t\t},\n\t);\n}\n","import type { ShareKitDestinationId } from './destinations.js';\n\nexport type ShareKitIconName = 'close' | 'more' | 'qr' | ShareKitDestinationId;\n\nexport type ShareKitIcons = Partial<Record<ShareKitIconName, string>>;\n\nexport const shareKitInterfaceIcons = {\n\tany: 'M3.16 14.47L5.99 11.65A4.5 4.5 0 0 1 12.35 18.01L9.53 20.84A4.5 4.5 0 0 1 3.16 14.47ZM4.58 15.89A2.5 2.5 0 0 0 8.11 19.42L10.94 16.6A2.5 2.5 0 0 0 7.4 13.06ZM11.65 5.99L14.47 3.16A4.5 4.5 0 0 1 20.84 9.53L18.01 12.35A4.5 4.5 0 0 1 11.65 5.99ZM13.06 7.4A2.5 2.5 0 0 0 16.6 10.94L19.42 8.11A2.5 2.5 0 0 0 15.89 4.58ZM8.46 14.12L14.12 8.46L15.54 9.88L9.88 15.54Z',\n\tclose:\n\t\t'M6 7.41 7.41 6 12 10.59 16.59 6 18 7.41 13.41 12 18 16.59 16.59 18 12 13.41 7.41 18 6 16.59 10.59 12Z',\n\tmessages:\n\t\t'M5 4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EA,OAAO,QAAwB,MAAoB;EAClD,MAAM,SAA+B;GAAE;GAAQ,aAAa,KAAK;EAAa;EAE9E,IAAI,MAAM,QAAQ,eAAe,OAAO,QAAQ,KAAK,QAAQ;EAE7D,KAAK,cACJ,IAAI,YAAY,yBAAyB;GAAE,SAAS;GAAM,UAAU;GAAM;EAAO,CAAC,CACnF;CACD;AACD;;ACzeA,MAAM,UAAU;AAGhB,SAAgB,eAAe,EAAE,QAAQ,CAAC,MAAuB,CAAC,GAAG;CACpE,IAAI,eAAe,IAAI,OAAO,GAAG;CAEjC,eAAe,OACd,SACA,cAAc,gBAAgB;EACD,QAAQ;CACrC,CACD;AACD;;ACdA,MAAa,yBAAyB;CACrC,KAAK;CACL,OACC;CACD,UACC;CACD,MAAM;CACN,IAAI;AACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsynaptic/share-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A share dialog custom element for posting a page to social platforms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown",
|
|
51
51
|
"dev": "tsdown --watch",
|
|
52
|
-
"check-types": "tsc --noEmit",
|
|
53
52
|
"test:e2e": "playwright test"
|
|
54
53
|
}
|
|
55
54
|
}
|