progressive-share-button 1.0.0-alpha.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +51 -23
- package/dist/progressive-share-button.d.ts +15 -0
- package/dist/progressive-share-button.es.js +37 -25
- package/dist/progressive-share-button.umd.js +39 -27
- package/package.json +44 -35
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,34 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
|
|
9
|
+
## [1.0.0-alpha.11] - 2021-03-01
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed: Previous solution didn't fix build system issue. Switched the build script to use `tsc` instead of `vite` to build the package.
|
|
14
|
+
|
|
15
|
+
## [1.0.0-alpha.10] - 2021-03-01
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixed: The build system didn't include the @types directory in the published package. This has been fixed.
|
|
20
|
+
|
|
21
|
+
## [1.0.0-alpha.9] - 2021-03-01
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Added typescript types for the `ProgressiveShareButton` class and default function.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Changed: (breaking change) the import statement no longer initialized the web component on import. On some builds using typescript, the button would not be initialized without using the imported function. Now, after import, you must call the init function to initialize the web component, like `ProgressButton.init()`.
|
|
30
|
+
- Changed: (breaking change) the `ProgressiveShareButtonElement` class is now exported as `ProgressiveShareButtonClass`.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- Fixed: The demo page has some incorrect class names in the example code. These have been corrected.
|
|
35
|
+
|
|
8
36
|
## [1.0.0-alpha.8] - 2023-02-27
|
|
9
37
|
|
|
10
38
|
### Changed
|
package/README.md
CHANGED
|
@@ -4,6 +4,11 @@ The _Progressive Share Button_ web component is a simple way to add a share butt
|
|
|
4
4
|
|
|
5
5
|
The web component is a wrapper around the [Web Share API](https://w3c.github.io/web-share/) that attempts to display a share icon appropriate to the user's device with icons that will be recognizable to iOS/Mac, Android and Windows. If the device type can't be determined, the component will display a Windows share icon.
|
|
6
6
|
|
|
7
|
+
## Demo
|
|
8
|
+
|
|
9
|
+
Check out the demo page, [https://johnfmorton.github.io/progressive-share-button/](https://johnfmorton.github.io/progressive-share-button/), to see the component in action.
|
|
10
|
+
|
|
11
|
+
|
|
7
12
|
## Basic Usage
|
|
8
13
|
|
|
9
14
|
The most basic usage of the component is to use no attributes. The component will share the current page's URL.
|
|
@@ -18,7 +23,9 @@ You may also pass the URL to be shared. The component will share the URL that ha
|
|
|
18
23
|
<progressive-share-button url="https://example.com" />
|
|
19
24
|
```
|
|
20
25
|
|
|
21
|
-
This will render one of the following, depending on the device and browser.
|
|
26
|
+
This will render one of the following, depending on the device and browser.
|
|
27
|
+
|
|
28
|
+
This example image below shows the Windows sharing icon, the Android sharing icon, and the iOS/Mac sharing icon.
|
|
22
29
|
|
|
23
30
|

|
|
24
31
|
|
|
@@ -41,8 +48,10 @@ npm install progressive-share-button
|
|
|
41
48
|
main.js, if installed with npm
|
|
42
49
|
|
|
43
50
|
```javascript
|
|
44
|
-
// Import the component
|
|
51
|
+
// Import the component
|
|
45
52
|
import ProgressiveShareButton from 'progressive-share-button';
|
|
53
|
+
// Initialize the component
|
|
54
|
+
ProgressiveShareButton();
|
|
46
55
|
```
|
|
47
56
|
|
|
48
57
|
### Customizing the component name
|
|
@@ -51,9 +60,9 @@ If you want to customize the component name, you can import the element class di
|
|
|
51
60
|
|
|
52
61
|
|
|
53
62
|
```javascript
|
|
54
|
-
import {
|
|
63
|
+
import { ProgressiveShareButtonClass } from 'progressive-share-button';
|
|
55
64
|
// Initialize the component
|
|
56
|
-
customElements.define('my-share-button',
|
|
65
|
+
customElements.define('my-share-button', ProgressiveShareButtonClass);
|
|
57
66
|
|
|
58
67
|
```
|
|
59
68
|
|
|
@@ -67,9 +76,7 @@ customElements.define('my-share-button', ProgressiveShareButtonElement);
|
|
|
67
76
|
|
|
68
77
|
## Typescript support
|
|
69
78
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
The component is written in Typescript and includes type definitions. If you are using Typescript, you can import the component directly into your project and see code completion hints. See the [Custom events](#custom-events) section for more information about using the custom event type definitions.
|
|
73
80
|
|
|
74
81
|
## Customizing the Component
|
|
75
82
|
|
|
@@ -218,29 +225,50 @@ https://w3c.github.io/web-share/demos/share-files.html
|
|
|
218
225
|
|
|
219
226
|
There are two custom event emitted by the component: `progressive-share-success` and `progressive-share-fail`.
|
|
220
227
|
|
|
221
|
-
| Event name | Description |
|
|
222
|
-
| --- | --- |
|
|
223
|
-
| `progressive-share-success` | Emitted when the Web Share API is supported and the data is successfully shared. |
|
|
224
|
-
| `progressive-share-fail` | Emitted when the Web Share API is supported but the data is not successfully shared. This is typically emitted when a user opens the share dialog box but exits out of it without sharing. |
|
|
228
|
+
| Event name | Description | TypeScript type |
|
|
229
|
+
| --- | --- | --- |
|
|
230
|
+
| `progressive-share-success` | Emitted when the Web Share API is supported and the data is successfully shared. | `ProgressiveShareSuccessEvent` |
|
|
231
|
+
| `progressive-share-fail` | Emitted when the Web Share API is supported but the data is not successfully shared. This is typically emitted when a user opens the share dialog box but exits out of it without sharing. | `ProgressiveShareFailEvent` |
|
|
225
232
|
|
|
233
|
+
If you're writing in Typescript, you can import the custom event types and use them like this:
|
|
226
234
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// example of listening for the custom events
|
|
235
|
+
```typescript
|
|
236
|
+
import { ProgressiveShareSuccessEvent, ProgressiveShareFailEvent } from 'progressive-share-button';
|
|
230
237
|
document.addEventListener('progressive-share-success', (e) => {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
238
|
+
const { detail } = e as ProgressiveShareSuccessEvent
|
|
239
|
+
// e.detail contains the share data
|
|
240
|
+
// check if e.detail exists
|
|
241
|
+
if (detail) {
|
|
242
|
+
console.log('The progressive-share-success event was heard.', detail)
|
|
243
|
+
}
|
|
244
|
+
})
|
|
234
245
|
document.addEventListener('progressive-share-fail', (e) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
246
|
+
const { detail } = e as ProgressiveShareFailEvent
|
|
247
|
+
// check if e.detail exists
|
|
248
|
+
if (detail) {
|
|
249
|
+
console.log('The progressive-share-fail event was heard.', detail)
|
|
250
|
+
}
|
|
251
|
+
})
|
|
238
252
|
```
|
|
239
253
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
[https://johnfmorton.github.io/progressive-share-button/](https://johnfmorton.github.io/progressive-share-button/)
|
|
254
|
+
Or if you're writing in Javascript, you can skip importing the types and just use the `detail` property of the event object.
|
|
243
255
|
|
|
256
|
+
```javascript
|
|
257
|
+
document.addEventListener('progressive-share-success', (e) => {
|
|
258
|
+
const { detail } = e
|
|
259
|
+
// check if e.detail exists
|
|
260
|
+
if (detail) {
|
|
261
|
+
console.log('The progressive-share-success event was heard.', detail)
|
|
262
|
+
}
|
|
263
|
+
})
|
|
264
|
+
document.addEventListener('progressive-share-fail', (e) => {
|
|
265
|
+
const { detail } = e
|
|
266
|
+
// check if e.detail exists
|
|
267
|
+
if (detail) {
|
|
268
|
+
console.log('The progressive-share-fail event was heard.', detail)
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
```
|
|
244
272
|
## License
|
|
245
273
|
|
|
246
274
|
MIT
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare module "progressive-share-button" {
|
|
2
|
+
export interface ProgressiveShareSuccessEvent extends Event {
|
|
3
|
+
detail: any;
|
|
4
|
+
}
|
|
5
|
+
export interface ProgressiveShareFailEvent extends Event {
|
|
6
|
+
detail: any;
|
|
7
|
+
}
|
|
8
|
+
class ProgressiveShareButtonClass extends HTMLElement {
|
|
9
|
+
iconSize: () => string;
|
|
10
|
+
constructor();
|
|
11
|
+
share(): void;
|
|
12
|
+
}
|
|
13
|
+
const ProgressiveShareButton: () => boolean;
|
|
14
|
+
export { ProgressiveShareButton, ProgressiveShareButtonClass };
|
|
15
|
+
}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* name: progressive-share-button
|
|
3
|
+
* version: v1.0.0
|
|
4
|
+
* description: A web componet that creates a OS-native share button.
|
|
5
|
+
* author: John F. Morton <john@johnfmorton.com> (https://supergeekery.com)
|
|
6
|
+
* repository: https://github.com/johnfmorton/progressive-share-button
|
|
7
|
+
*/
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __publicField = (obj, key, value) => {
|
|
11
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
class ProgressiveShareButtonClass extends HTMLElement {
|
|
2
15
|
constructor() {
|
|
3
16
|
super();
|
|
17
|
+
__publicField(this, "iconSize");
|
|
4
18
|
this.attachShadow({ mode: "open" });
|
|
5
19
|
this.iconSize = () => {
|
|
6
20
|
const size = this.getAttribute("icon-size") ?? "";
|
|
@@ -46,7 +60,9 @@ class ProgressiveShareButtonElement extends HTMLElement {
|
|
|
46
60
|
this.addEventListener("click", this.share);
|
|
47
61
|
}
|
|
48
62
|
} else {
|
|
49
|
-
console.warn(
|
|
63
|
+
console.warn(
|
|
64
|
+
"ProgressiveShareButton disabled due to lack of Web Share API support on this browser."
|
|
65
|
+
);
|
|
50
66
|
}
|
|
51
67
|
}
|
|
52
68
|
share() {
|
|
@@ -79,12 +95,15 @@ class ProgressiveShareButtonElement extends HTMLElement {
|
|
|
79
95
|
if (!data.url && !data.text && !data.title) {
|
|
80
96
|
data.url = window.location.href;
|
|
81
97
|
}
|
|
82
|
-
let shareEvent = new CustomEvent(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
98
|
+
let shareEvent = new CustomEvent(
|
|
99
|
+
"progressive-share-success",
|
|
100
|
+
{
|
|
101
|
+
bubbles: true,
|
|
102
|
+
cancelable: false,
|
|
103
|
+
composed: true,
|
|
104
|
+
detail: data
|
|
105
|
+
}
|
|
106
|
+
);
|
|
88
107
|
if (navigator.share) {
|
|
89
108
|
if (debug == 1) {
|
|
90
109
|
console.debug("data to be shared", data);
|
|
@@ -92,15 +111,12 @@ class ProgressiveShareButtonElement extends HTMLElement {
|
|
|
92
111
|
navigator.share(data).then(() => {
|
|
93
112
|
this.dispatchEvent(shareEvent);
|
|
94
113
|
}).catch((e) => {
|
|
95
|
-
let shareEventFail = new CustomEvent(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
detail: e
|
|
102
|
-
}
|
|
103
|
-
);
|
|
114
|
+
let shareEventFail = new CustomEvent("progressive-share-fail", {
|
|
115
|
+
bubbles: true,
|
|
116
|
+
cancelable: false,
|
|
117
|
+
composed: true,
|
|
118
|
+
detail: e
|
|
119
|
+
});
|
|
104
120
|
this.dispatchEvent(shareEventFail);
|
|
105
121
|
});
|
|
106
122
|
}
|
|
@@ -109,7 +125,7 @@ class ProgressiveShareButtonElement extends HTMLElement {
|
|
|
109
125
|
}
|
|
110
126
|
}
|
|
111
127
|
}
|
|
112
|
-
|
|
128
|
+
const ProgressiveShareButton = () => {
|
|
113
129
|
if (typeof navigator.share === "function") {
|
|
114
130
|
console.log(
|
|
115
131
|
"ProgressiveShareButton support initialized. <progressive-share-success /> element now available"
|
|
@@ -121,10 +137,10 @@ function ProgressiveShareButton() {
|
|
|
121
137
|
}
|
|
122
138
|
customElements.define(
|
|
123
139
|
"progressive-share-button",
|
|
124
|
-
|
|
140
|
+
ProgressiveShareButtonClass
|
|
125
141
|
);
|
|
126
142
|
return true;
|
|
127
|
-
}
|
|
143
|
+
};
|
|
128
144
|
const iosShareIcon = '<svg xmlns="http://www.w3.org/2000/svg" part="shareIcon" viewBox="0 0 84.53 108.43" class="icon"><title>Share icon</title><desc>Square with upward arrow</desc><path d="m76.21,33.15h-23.38v5.28h23.38c1.72,0,3.04,1.32,3.04,2.91v58.77c0,1.58-1.32,2.91-3.04,2.91H8.32c-1.72,0-3.04-1.32-3.04-2.9v-58.64c0-1.58,1.32-2.91,3.04-2.91h20.74v-5.28H8.32c-4.62,0-8.32,3.7-8.32,8.19v58.77c0,4.49,3.7,8.19,8.32,8.19h67.88c4.62,0,8.32-3.7,8.32-8.19v-58.77c0-4.62-3.7-8.32-8.32-8.32h0Z"/><path d="m39.62,8.58v69.21h5.28V8.58l13.6,10.04,3.17-4.23L42.26,0l-19.41,14.4,3.17,4.23,13.6-10.04Z"/></svg>';
|
|
129
145
|
const androidShareIcon = '<svg id="b" xmlns="http://www.w3.org/2000/svg" part="shareIcon" viewBox="0 0 18.19 21.46" class="icon"><title>Share icon</title><desc>Circle with smaller circles radiating out</desc><g id="c"><path d="m15.1,15.29c-.89,0-1.7.38-2.28.98l-6.98-3.84c.24-.43.38-.94.38-1.49s-.14-1.03-.38-1.49l7.22-4.03c.55.48,1.25.77,2.04.77,1.7,0,3.1-1.39,3.1-3.1s-1.39-3.1-3.1-3.1-3.1,1.39-3.1,3.1c0,.67.22,1.27.58,1.78l-7.18,4.01c-.58-.62-1.39-1.03-2.3-1.03-1.7,0-3.1,1.39-3.1,3.1s1.39,3.1,3.1,3.1c.91,0,1.73-.41,2.3-1.03l6.98,3.84c-.26.46-.41.96-.41,1.51,0,1.7,1.39,3.1,3.1,3.1s3.1-1.39,3.1-3.1-1.37-3.07-3.07-3.07h0Zm0-14.54c1.32,0,2.38,1.08,2.38,2.38s-1.08,2.38-2.38,2.38-2.38-1.08-2.38-2.38,1.06-2.38,2.38-2.38ZM3.1,13.32c-1.32,0-2.38-1.08-2.38-2.38s1.08-2.38,2.38-2.38,2.38,1.08,2.38,2.38-1.06,2.38-2.38,2.38Zm12,7.44c-1.32,0-2.38-1.08-2.38-2.38s1.08-2.38,2.38-2.38,2.38,1.08,2.38,2.38-1.08,2.38-2.38,2.38Z"/></g></svg>';
|
|
130
146
|
const winShareIcon = '<svg id="b" xmlns="http://www.w3.org/2000/svg" part="shareIcon" viewBox="0 0 112.98 100.64" class="icon" ><title>Share icon</title><desc>Square with arrow coming out to the right</desc><g id="c"><path d="m80.68,16.3l22.7,22.65-22.7,22.64v-11.44h-6.78c-18.27,0-33.35,6.91-43.25,13.14,2.34-12.07,7.94-21.2,16.75-27.16,10.12-6.84,22.02-7.83,26.67-7.94l6.6-.15v-11.73M73.93,0v21.43c-12.15.29-51.56,5.17-51.27,56.46,0,0,21.02-20.94,51.27-20.98v20.98l39.05-38.98L73.93,0ZM0,28.24v72.39h86.95v-20.98l-6.6,6.61v7.26H8.12V28.24H0Z"/></g></svg>';
|
|
@@ -172,11 +188,7 @@ function _getBoolean(stringValue) {
|
|
|
172
188
|
return JSON.parse(stringValue);
|
|
173
189
|
}
|
|
174
190
|
}
|
|
175
|
-
const main = (() => {
|
|
176
|
-
ProgressiveShareButton();
|
|
177
|
-
})();
|
|
178
191
|
export {
|
|
179
192
|
ProgressiveShareButton,
|
|
180
|
-
|
|
181
|
-
main as default
|
|
193
|
+
ProgressiveShareButtonClass
|
|
182
194
|
};
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: progressive-share-button
|
|
3
|
+
* version: v1.0.0
|
|
4
|
+
* description: A web componet that creates a OS-native share button.
|
|
5
|
+
* author: John F. Morton <john@johnfmorton.com> (https://supergeekery.com)
|
|
6
|
+
* repository: https://github.com/johnfmorton/progressive-share-button
|
|
7
|
+
*/
|
|
1
8
|
(function(global, factory) {
|
|
2
9
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["progressive-share-button"] = {}));
|
|
3
10
|
})(this, function(exports2) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
11
|
+
"use strict";var __defProp = Object.defineProperty;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __publicField = (obj, key, value) => {
|
|
14
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
class ProgressiveShareButtonClass extends HTMLElement {
|
|
6
19
|
constructor() {
|
|
7
20
|
super();
|
|
21
|
+
__publicField(this, "iconSize");
|
|
8
22
|
this.attachShadow({ mode: "open" });
|
|
9
23
|
this.iconSize = () => {
|
|
10
24
|
const size = this.getAttribute("icon-size") ?? "";
|
|
@@ -50,7 +64,9 @@
|
|
|
50
64
|
this.addEventListener("click", this.share);
|
|
51
65
|
}
|
|
52
66
|
} else {
|
|
53
|
-
console.warn(
|
|
67
|
+
console.warn(
|
|
68
|
+
"ProgressiveShareButton disabled due to lack of Web Share API support on this browser."
|
|
69
|
+
);
|
|
54
70
|
}
|
|
55
71
|
}
|
|
56
72
|
share() {
|
|
@@ -83,12 +99,15 @@
|
|
|
83
99
|
if (!data.url && !data.text && !data.title) {
|
|
84
100
|
data.url = window.location.href;
|
|
85
101
|
}
|
|
86
|
-
let shareEvent = new CustomEvent(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
let shareEvent = new CustomEvent(
|
|
103
|
+
"progressive-share-success",
|
|
104
|
+
{
|
|
105
|
+
bubbles: true,
|
|
106
|
+
cancelable: false,
|
|
107
|
+
composed: true,
|
|
108
|
+
detail: data
|
|
109
|
+
}
|
|
110
|
+
);
|
|
92
111
|
if (navigator.share) {
|
|
93
112
|
if (debug == 1) {
|
|
94
113
|
console.debug("data to be shared", data);
|
|
@@ -96,15 +115,12 @@
|
|
|
96
115
|
navigator.share(data).then(() => {
|
|
97
116
|
this.dispatchEvent(shareEvent);
|
|
98
117
|
}).catch((e) => {
|
|
99
|
-
let shareEventFail = new CustomEvent(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
detail: e
|
|
106
|
-
}
|
|
107
|
-
);
|
|
118
|
+
let shareEventFail = new CustomEvent("progressive-share-fail", {
|
|
119
|
+
bubbles: true,
|
|
120
|
+
cancelable: false,
|
|
121
|
+
composed: true,
|
|
122
|
+
detail: e
|
|
123
|
+
});
|
|
108
124
|
this.dispatchEvent(shareEventFail);
|
|
109
125
|
});
|
|
110
126
|
}
|
|
@@ -113,7 +129,7 @@
|
|
|
113
129
|
}
|
|
114
130
|
}
|
|
115
131
|
}
|
|
116
|
-
|
|
132
|
+
const ProgressiveShareButton = () => {
|
|
117
133
|
if (typeof navigator.share === "function") {
|
|
118
134
|
console.log(
|
|
119
135
|
"ProgressiveShareButton support initialized. <progressive-share-success /> element now available"
|
|
@@ -125,10 +141,10 @@
|
|
|
125
141
|
}
|
|
126
142
|
customElements.define(
|
|
127
143
|
"progressive-share-button",
|
|
128
|
-
|
|
144
|
+
ProgressiveShareButtonClass
|
|
129
145
|
);
|
|
130
146
|
return true;
|
|
131
|
-
}
|
|
147
|
+
};
|
|
132
148
|
const iosShareIcon = '<svg xmlns="http://www.w3.org/2000/svg" part="shareIcon" viewBox="0 0 84.53 108.43" class="icon"><title>Share icon</title><desc>Square with upward arrow</desc><path d="m76.21,33.15h-23.38v5.28h23.38c1.72,0,3.04,1.32,3.04,2.91v58.77c0,1.58-1.32,2.91-3.04,2.91H8.32c-1.72,0-3.04-1.32-3.04-2.9v-58.64c0-1.58,1.32-2.91,3.04-2.91h20.74v-5.28H8.32c-4.62,0-8.32,3.7-8.32,8.19v58.77c0,4.49,3.7,8.19,8.32,8.19h67.88c4.62,0,8.32-3.7,8.32-8.19v-58.77c0-4.62-3.7-8.32-8.32-8.32h0Z"/><path d="m39.62,8.58v69.21h5.28V8.58l13.6,10.04,3.17-4.23L42.26,0l-19.41,14.4,3.17,4.23,13.6-10.04Z"/></svg>';
|
|
133
149
|
const androidShareIcon = '<svg id="b" xmlns="http://www.w3.org/2000/svg" part="shareIcon" viewBox="0 0 18.19 21.46" class="icon"><title>Share icon</title><desc>Circle with smaller circles radiating out</desc><g id="c"><path d="m15.1,15.29c-.89,0-1.7.38-2.28.98l-6.98-3.84c.24-.43.38-.94.38-1.49s-.14-1.03-.38-1.49l7.22-4.03c.55.48,1.25.77,2.04.77,1.7,0,3.1-1.39,3.1-3.1s-1.39-3.1-3.1-3.1-3.1,1.39-3.1,3.1c0,.67.22,1.27.58,1.78l-7.18,4.01c-.58-.62-1.39-1.03-2.3-1.03-1.7,0-3.1,1.39-3.1,3.1s1.39,3.1,3.1,3.1c.91,0,1.73-.41,2.3-1.03l6.98,3.84c-.26.46-.41.96-.41,1.51,0,1.7,1.39,3.1,3.1,3.1s3.1-1.39,3.1-3.1-1.37-3.07-3.07-3.07h0Zm0-14.54c1.32,0,2.38,1.08,2.38,2.38s-1.08,2.38-2.38,2.38-2.38-1.08-2.38-2.38,1.06-2.38,2.38-2.38ZM3.1,13.32c-1.32,0-2.38-1.08-2.38-2.38s1.08-2.38,2.38-2.38,2.38,1.08,2.38,2.38-1.06,2.38-2.38,2.38Zm12,7.44c-1.32,0-2.38-1.08-2.38-2.38s1.08-2.38,2.38-2.38,2.38,1.08,2.38,2.38-1.08,2.38-2.38,2.38Z"/></g></svg>';
|
|
134
150
|
const winShareIcon = '<svg id="b" xmlns="http://www.w3.org/2000/svg" part="shareIcon" viewBox="0 0 112.98 100.64" class="icon" ><title>Share icon</title><desc>Square with arrow coming out to the right</desc><g id="c"><path d="m80.68,16.3l22.7,22.65-22.7,22.64v-11.44h-6.78c-18.27,0-33.35,6.91-43.25,13.14,2.34-12.07,7.94-21.2,16.75-27.16,10.12-6.84,22.02-7.83,26.67-7.94l6.6-.15v-11.73M73.93,0v21.43c-12.15.29-51.56,5.17-51.27,56.46,0,0,21.02-20.94,51.27-20.98v20.98l39.05-38.98L73.93,0ZM0,28.24v72.39h86.95v-20.98l-6.6,6.61v7.26H8.12V28.24H0Z"/></g></svg>';
|
|
@@ -176,11 +192,7 @@
|
|
|
176
192
|
return JSON.parse(stringValue);
|
|
177
193
|
}
|
|
178
194
|
}
|
|
179
|
-
const main = (() => {
|
|
180
|
-
ProgressiveShareButton();
|
|
181
|
-
})();
|
|
182
195
|
exports2.ProgressiveShareButton = ProgressiveShareButton;
|
|
183
|
-
exports2.
|
|
184
|
-
exports2.
|
|
185
|
-
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
196
|
+
exports2.ProgressiveShareButtonClass = ProgressiveShareButtonClass;
|
|
197
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
186
198
|
});
|
package/package.json
CHANGED
|
@@ -1,38 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
"name": "progressive-share-button",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A web componet that creates a OS-native share button.",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"main": "./dist/progressive-share-button.umd.js",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/johnfmorton/progressive-share-button"
|
|
12
|
+
},
|
|
13
|
+
"module": "./dist/progressive-share-button.es.js",
|
|
14
|
+
"unpkg": "./dist/progressive-share-button.umd.js",
|
|
15
|
+
"types": "./dist/progressive-share-button.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/progressive-share-button.es.js",
|
|
19
|
+
"require": "./dist/progressive-share-button.umd.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"clean": "rm -rf dist es demo",
|
|
24
|
+
"dev": "vite --host 0.0.0.0 --port 8888",
|
|
25
|
+
"vite-build": "vite build --config vite.demo.config.js",
|
|
26
|
+
"build": "vite build --config vite.demo.config.js && vite build && tsc lib/progressive-share-button.ts --declaration --emitDeclarationOnly --outFile dist/progressive-share-button.d.ts",
|
|
27
|
+
"preview": "vite preview",
|
|
28
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"share",
|
|
32
|
+
"button",
|
|
33
|
+
"progressive",
|
|
34
|
+
"web-components",
|
|
35
|
+
"web-share-api"
|
|
36
|
+
],
|
|
37
|
+
"author": "John F. Morton <john@johnfmorton.com> (https://supergeekery.com)",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"autoprefixer": "^10.4.13",
|
|
41
|
+
"postcss": "^8.4.21",
|
|
42
|
+
"tailwindcss": "^3.2.7",
|
|
43
|
+
"typescript": "^4.9.5",
|
|
44
|
+
"vite": "^4.1.3",
|
|
45
|
+
"vite-plugin-banner": "^0.7.0"
|
|
18
46
|
}
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"dev": "vite --host 0.0.0.0 --port 8888",
|
|
22
|
-
"build": "vite build",
|
|
23
|
-
"preview": "vite preview",
|
|
24
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
25
|
-
},
|
|
26
|
-
"keywords": [
|
|
27
|
-
"share",
|
|
28
|
-
"button",
|
|
29
|
-
"progressive",
|
|
30
|
-
"web-components",
|
|
31
|
-
"web-share-api"
|
|
32
|
-
],
|
|
33
|
-
"author": "John F. Morton <john@johnfmorton.com> (https://supergeekery.com)",
|
|
34
|
-
"license": "MIT",
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"vite": "^4.1.3"
|
|
37
|
-
}
|
|
38
47
|
}
|