@xsynaptic/share-kit 0.4.0 → 0.5.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 +4 -2
- package/dist/index.d.mts +22 -16
- package/dist/index.mjs +161 -85
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +45 -16
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -90,7 +90,9 @@ Sharing and saving fire once they finish, with an `outcome`:
|
|
|
90
90
|
|
|
91
91
|
`shared` means the share sheet took it, not that it was posted.
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
A trigger can name a destination, as in `data-share-kit-trigger="instagram"`, to open the dialog with it selected. With a single destination, the dialog leaves out the destination row.
|
|
94
|
+
|
|
95
|
+
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. When several elements share one, only the first on the page opens.
|
|
94
96
|
|
|
95
97
|
`strings` in the payload overrides the dialog's wording by key, including `destination.<id>` and `hint.<id>`.
|
|
96
98
|
|
|
@@ -121,7 +123,7 @@ The dialog downloads the images in `assets` to save, copy or share them, so serv
|
|
|
121
123
|
|
|
122
124
|
## Icons
|
|
123
125
|
|
|
124
|
-
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
|
|
126
|
+
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` and `more`, or pass a function that returns a promise of that map to load them lazily. `shareKitInterfaceIcons` holds the four drawn for this package. For brand marks, [Simple Icons](https://simpleicons.org) has every built-in but LinkedIn.
|
|
125
127
|
|
|
126
128
|
## Styles
|
|
127
129
|
|
package/dist/index.d.mts
CHANGED
|
@@ -36,7 +36,7 @@ type ShareKitImageFormats = readonly [ShareKitImageFormat, ...Array<ShareKitImag
|
|
|
36
36
|
export declare function getShareKitImageFormats(destinations: ReadonlyArray<{
|
|
37
37
|
images: ShareKitImageFormats;
|
|
38
38
|
}>): ShareKitImageFormat[];
|
|
39
|
-
type ShareKitActionKind = 'copy-caption' | 'open-composer' | 'share-image' | 'share-link' | 'share-text';
|
|
39
|
+
type ShareKitActionKind = 'copy-caption' | 'open-composer' | 'save-image' | 'share-image' | 'share-link' | 'share-text';
|
|
40
40
|
type ShareKitDevice = 'desktop' | 'mobile';
|
|
41
41
|
interface ShareKitComposerInput {
|
|
42
42
|
description?: string;
|
|
@@ -100,7 +100,7 @@ export declare const shareKitFacebook: {
|
|
|
100
100
|
};
|
|
101
101
|
readonly composer: ({ url }: ShareKitComposerInput) => string;
|
|
102
102
|
readonly count: typeof shareKitCountLength;
|
|
103
|
-
readonly hint: "Facebook only takes the link. Your
|
|
103
|
+
readonly hint: "Facebook only takes the link. Your text is copied, so paste it into your post.";
|
|
104
104
|
readonly id: "facebook";
|
|
105
105
|
readonly images: readonly [{
|
|
106
106
|
readonly height: 630;
|
|
@@ -117,11 +117,11 @@ export declare const shareKitFacebook: {
|
|
|
117
117
|
};
|
|
118
118
|
export declare const shareKitInstagram: {
|
|
119
119
|
readonly actions: {
|
|
120
|
-
readonly desktop: readonly [];
|
|
120
|
+
readonly desktop: readonly ["save-image"];
|
|
121
121
|
readonly mobile: readonly ["share-image"];
|
|
122
122
|
};
|
|
123
123
|
readonly count: typeof shareKitCountLength;
|
|
124
|
-
readonly hint: "
|
|
124
|
+
readonly hint: "Your text is copied, so paste it as the caption. Links in it aren't clickable.";
|
|
125
125
|
readonly id: "instagram";
|
|
126
126
|
readonly images: readonly [{
|
|
127
127
|
readonly height: 1350;
|
|
@@ -134,11 +134,11 @@ export declare const shareKitInstagram: {
|
|
|
134
134
|
};
|
|
135
135
|
export declare const shareKitInstagramStory: {
|
|
136
136
|
readonly actions: {
|
|
137
|
-
readonly desktop: readonly [];
|
|
137
|
+
readonly desktop: readonly ["save-image"];
|
|
138
138
|
readonly mobile: readonly ["share-image"];
|
|
139
139
|
};
|
|
140
140
|
readonly count: typeof shareKitCountLength;
|
|
141
|
-
readonly hint: "
|
|
141
|
+
readonly hint: "The link is copied, so add it to your Story with a link sticker.";
|
|
142
142
|
readonly id: "instagram-story";
|
|
143
143
|
readonly images: readonly [{
|
|
144
144
|
readonly height: 1920;
|
|
@@ -159,7 +159,7 @@ export declare const shareKitLinkedin: {
|
|
|
159
159
|
};
|
|
160
160
|
readonly composer: ({ url }: ShareKitComposerInput) => string;
|
|
161
161
|
readonly count: typeof shareKitCountLength;
|
|
162
|
-
readonly hint: "LinkedIn only takes the link. Your
|
|
162
|
+
readonly hint: "LinkedIn only takes the link. Your text is copied, so paste it into your post.";
|
|
163
163
|
readonly id: "linkedin";
|
|
164
164
|
readonly images: readonly [{
|
|
165
165
|
readonly height: 630;
|
|
@@ -177,6 +177,7 @@ export declare const shareKitLine: {
|
|
|
177
177
|
};
|
|
178
178
|
readonly composer: ({ device, text, url }: ShareKitComposerInput) => string;
|
|
179
179
|
readonly count: typeof shareKitCountLength;
|
|
180
|
+
readonly hint: "Opens the LINE app if you have it, or LINE on the web, which asks you to sign in.";
|
|
180
181
|
readonly id: "line";
|
|
181
182
|
readonly images: readonly [{
|
|
182
183
|
readonly height: 630;
|
|
@@ -188,9 +189,10 @@ export declare const shareKitLine: {
|
|
|
188
189
|
};
|
|
189
190
|
export declare const shareKitMastodon: {
|
|
190
191
|
readonly actions: {
|
|
191
|
-
readonly desktop: readonly [];
|
|
192
|
-
readonly mobile: readonly ["share-image"];
|
|
192
|
+
readonly desktop: readonly ["open-composer"];
|
|
193
|
+
readonly mobile: readonly ["share-image", "open-composer"];
|
|
193
194
|
};
|
|
195
|
+
readonly composer: ({ text }: ShareKitComposerInput) => string;
|
|
194
196
|
readonly count: ShareKitCounter;
|
|
195
197
|
readonly id: "mastodon";
|
|
196
198
|
readonly images: readonly [{
|
|
@@ -294,7 +296,7 @@ export declare const shareKitX: {
|
|
|
294
296
|
readonly limit: 280;
|
|
295
297
|
readonly shape: "full";
|
|
296
298
|
};
|
|
297
|
-
declare const shareKitInterfaceIconNames: readonly ["close", "more"
|
|
299
|
+
declare const shareKitInterfaceIconNames: readonly ["close", "more"];
|
|
298
300
|
type ShareKitIconName<Id extends string> = (typeof shareKitInterfaceIconNames)[number] | Id;
|
|
299
301
|
type ShareKitIcons<Id extends string> = Partial<Record<ShareKitIconName<Id>, string>>;
|
|
300
302
|
type ShareKitIconsOption<Id extends string> = (() => Promise<ShareKitIcons<Id>>) | ShareKitIcons<Id>;
|
|
@@ -303,7 +305,6 @@ export declare const shareKitInterfaceIcons: {
|
|
|
303
305
|
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";
|
|
304
306
|
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";
|
|
305
307
|
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";
|
|
306
|
-
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";
|
|
307
308
|
};
|
|
308
309
|
declare class ShareIconSource {
|
|
309
310
|
#private;
|
|
@@ -338,27 +339,32 @@ declare const shareKitStringDefaults: {
|
|
|
338
339
|
readonly assetCopy: "Copy";
|
|
339
340
|
readonly assetSave: "Save";
|
|
340
341
|
readonly assetShare: "Share";
|
|
341
|
-
readonly captionCopy: "Copy caption";
|
|
342
342
|
readonly captionOver: "{count} over the limit for {destination}";
|
|
343
343
|
readonly captionReset: "Reset";
|
|
344
|
-
readonly captionTitle: "Caption";
|
|
345
344
|
readonly close: "Close";
|
|
346
345
|
readonly copied: "Copied";
|
|
347
|
-
readonly copyManual: "Couldn't copy. The
|
|
346
|
+
readonly copyManual: "Couldn't copy. The text is selected, so you can copy it yourself.";
|
|
347
|
+
readonly copyText: "Copy text";
|
|
348
|
+
readonly copyTitle: "Copy title";
|
|
349
|
+
readonly countOver: "{count} over";
|
|
348
350
|
readonly destinationsMore: "More";
|
|
349
351
|
readonly destinationsTitle: "Post to";
|
|
350
352
|
readonly error: "Something went wrong. Try saving instead.";
|
|
353
|
+
readonly fieldText: "Text";
|
|
354
|
+
readonly fieldTitle: "Title";
|
|
355
|
+
readonly imagesHint: "Save or copy one, then add it to your post.";
|
|
356
|
+
readonly imagesHintMobile: "Share one straight to an app, or save it.";
|
|
351
357
|
readonly imagesTitle: "Images";
|
|
352
358
|
readonly linkCopy: "Copy link";
|
|
353
359
|
readonly linkTitle: "Link";
|
|
354
|
-
readonly primaryCopy: "Copy caption";
|
|
355
360
|
readonly primaryOpen: "Open {destination}";
|
|
361
|
+
readonly primarySaveImage: "Save image";
|
|
356
362
|
readonly primaryShareImage: "Share image";
|
|
357
363
|
readonly primaryShareLink: "Share link";
|
|
358
364
|
readonly primaryShareText: "Share";
|
|
359
365
|
readonly qrAlt: "QR code for this page";
|
|
360
366
|
readonly qrTitle: "Scan to continue on your phone";
|
|
361
|
-
readonly qrToggle: "
|
|
367
|
+
readonly qrToggle: "Open on phone";
|
|
362
368
|
readonly retry: "Ready. Tap again to share.";
|
|
363
369
|
readonly saved: "Saved";
|
|
364
370
|
readonly saveError: "Couldn't save. Try again.";
|