progressive-share-button 1.0.3 → 1.0.4
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.
|
@@ -8,7 +8,9 @@ declare module "progressive-share-button" {
|
|
|
8
8
|
class ProgressiveShareButtonClass extends HTMLElement {
|
|
9
9
|
iconSize: () => string;
|
|
10
10
|
osOverride: () => string | null;
|
|
11
|
+
private boundShare;
|
|
11
12
|
constructor();
|
|
13
|
+
disconnectedCallback(): void;
|
|
12
14
|
share(): void;
|
|
13
15
|
}
|
|
14
16
|
const ProgressiveShareButton: () => boolean;
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: progressive-share-button
|
|
3
|
-
* version: v1.0.
|
|
3
|
+
* version: v1.0.4
|
|
4
4
|
* description: A web componet that creates a OS-native share button.
|
|
5
5
|
* author: John F. Morton <john@johnfmorton.com> (https://supergeekery.com)
|
|
6
6
|
* repository: https://github.com/johnfmorton/progressive-share-button
|
|
7
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
8
|
class ProgressiveShareButtonClass extends HTMLElement {
|
|
9
|
+
iconSize;
|
|
10
|
+
osOverride;
|
|
11
|
+
boundShare;
|
|
15
12
|
constructor() {
|
|
16
13
|
super();
|
|
17
|
-
__publicField(this, "iconSize");
|
|
18
|
-
__publicField(this, "osOverride");
|
|
19
14
|
this.attachShadow({ mode: "open" });
|
|
15
|
+
this.boundShare = this.share.bind(this);
|
|
20
16
|
this.iconSize = () => {
|
|
21
17
|
const size = this.getAttribute("icon-size") ?? "";
|
|
22
18
|
if (_isNumeric(size)) {
|
|
@@ -58,15 +54,13 @@ class ProgressiveShareButtonClass extends HTMLElement {
|
|
|
58
54
|
margin: 0;
|
|
59
55
|
cursor: pointer;
|
|
60
56
|
}
|
|
61
|
-
:host(:hover) {
|
|
62
|
-
}
|
|
63
57
|
</style>
|
|
64
58
|
<button part="shareButton">
|
|
65
59
|
<slot>
|
|
66
60
|
${_whichIcon(this.osOverride())}
|
|
67
61
|
</slot>
|
|
68
62
|
</button>`;
|
|
69
|
-
this.addEventListener("click", this.
|
|
63
|
+
this.addEventListener("click", this.boundShare);
|
|
70
64
|
}
|
|
71
65
|
} else {
|
|
72
66
|
console.warn(
|
|
@@ -74,6 +68,9 @@ class ProgressiveShareButtonClass extends HTMLElement {
|
|
|
74
68
|
);
|
|
75
69
|
}
|
|
76
70
|
}
|
|
71
|
+
disconnectedCallback() {
|
|
72
|
+
this.removeEventListener("click", this.boundShare);
|
|
73
|
+
}
|
|
77
74
|
share() {
|
|
78
75
|
const debug = _getBoolean(this.getAttribute("debug"));
|
|
79
76
|
const smartShare = _getBoolean(this.getAttribute("smart-share"));
|
|
@@ -114,7 +111,7 @@ class ProgressiveShareButtonClass extends HTMLElement {
|
|
|
114
111
|
}
|
|
115
112
|
);
|
|
116
113
|
if (navigator.share) {
|
|
117
|
-
if (debug
|
|
114
|
+
if (debug) {
|
|
118
115
|
console.debug("data to be shared", data);
|
|
119
116
|
} else {
|
|
120
117
|
navigator.share(data).then(() => {
|
|
@@ -137,7 +134,7 @@ class ProgressiveShareButtonClass extends HTMLElement {
|
|
|
137
134
|
const ProgressiveShareButton = () => {
|
|
138
135
|
if (typeof navigator.share === "function") {
|
|
139
136
|
console.log(
|
|
140
|
-
"ProgressiveShareButton support initialized. <progressive-share-
|
|
137
|
+
"ProgressiveShareButton support initialized. <progressive-share-button> element now available"
|
|
141
138
|
);
|
|
142
139
|
} else {
|
|
143
140
|
console.log(
|
|
@@ -188,11 +185,10 @@ const _whichIcon = (osOverride) => {
|
|
|
188
185
|
}
|
|
189
186
|
};
|
|
190
187
|
function _getBoolean(stringValue) {
|
|
191
|
-
var _a;
|
|
192
188
|
if (!stringValue) {
|
|
193
189
|
return false;
|
|
194
190
|
}
|
|
195
|
-
switch (
|
|
191
|
+
switch (stringValue.toLowerCase().trim()) {
|
|
196
192
|
case "true":
|
|
197
193
|
case "1":
|
|
198
194
|
return true;
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: progressive-share-button
|
|
3
|
-
* version: v1.0.
|
|
3
|
+
* version: v1.0.4
|
|
4
4
|
* description: A web componet that creates a OS-native share button.
|
|
5
5
|
* author: John F. Morton <john@johnfmorton.com> (https://supergeekery.com)
|
|
6
6
|
* repository: https://github.com/johnfmorton/progressive-share-button
|
|
7
7
|
*/
|
|
8
8
|
(function(global, factory) {
|
|
9
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"] = {}));
|
|
10
|
-
})(this, function(exports2) {
|
|
11
|
-
"use strict";
|
|
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
|
-
|
|
10
|
+
})(this, (function(exports2) {
|
|
11
|
+
"use strict";
|
|
18
12
|
class ProgressiveShareButtonClass extends HTMLElement {
|
|
13
|
+
iconSize;
|
|
14
|
+
osOverride;
|
|
15
|
+
boundShare;
|
|
19
16
|
constructor() {
|
|
20
17
|
super();
|
|
21
|
-
__publicField(this, "iconSize");
|
|
22
|
-
__publicField(this, "osOverride");
|
|
23
18
|
this.attachShadow({ mode: "open" });
|
|
19
|
+
this.boundShare = this.share.bind(this);
|
|
24
20
|
this.iconSize = () => {
|
|
25
21
|
const size = this.getAttribute("icon-size") ?? "";
|
|
26
22
|
if (_isNumeric(size)) {
|
|
@@ -62,15 +58,13 @@ var __publicField = (obj, key, value) => {
|
|
|
62
58
|
margin: 0;
|
|
63
59
|
cursor: pointer;
|
|
64
60
|
}
|
|
65
|
-
:host(:hover) {
|
|
66
|
-
}
|
|
67
61
|
</style>
|
|
68
62
|
<button part="shareButton">
|
|
69
63
|
<slot>
|
|
70
64
|
${_whichIcon(this.osOverride())}
|
|
71
65
|
</slot>
|
|
72
66
|
</button>`;
|
|
73
|
-
this.addEventListener("click", this.
|
|
67
|
+
this.addEventListener("click", this.boundShare);
|
|
74
68
|
}
|
|
75
69
|
} else {
|
|
76
70
|
console.warn(
|
|
@@ -78,6 +72,9 @@ var __publicField = (obj, key, value) => {
|
|
|
78
72
|
);
|
|
79
73
|
}
|
|
80
74
|
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
this.removeEventListener("click", this.boundShare);
|
|
77
|
+
}
|
|
81
78
|
share() {
|
|
82
79
|
const debug = _getBoolean(this.getAttribute("debug"));
|
|
83
80
|
const smartShare = _getBoolean(this.getAttribute("smart-share"));
|
|
@@ -118,7 +115,7 @@ var __publicField = (obj, key, value) => {
|
|
|
118
115
|
}
|
|
119
116
|
);
|
|
120
117
|
if (navigator.share) {
|
|
121
|
-
if (debug
|
|
118
|
+
if (debug) {
|
|
122
119
|
console.debug("data to be shared", data);
|
|
123
120
|
} else {
|
|
124
121
|
navigator.share(data).then(() => {
|
|
@@ -141,7 +138,7 @@ var __publicField = (obj, key, value) => {
|
|
|
141
138
|
const ProgressiveShareButton = () => {
|
|
142
139
|
if (typeof navigator.share === "function") {
|
|
143
140
|
console.log(
|
|
144
|
-
"ProgressiveShareButton support initialized. <progressive-share-
|
|
141
|
+
"ProgressiveShareButton support initialized. <progressive-share-button> element now available"
|
|
145
142
|
);
|
|
146
143
|
} else {
|
|
147
144
|
console.log(
|
|
@@ -192,11 +189,10 @@ var __publicField = (obj, key, value) => {
|
|
|
192
189
|
}
|
|
193
190
|
};
|
|
194
191
|
function _getBoolean(stringValue) {
|
|
195
|
-
var _a;
|
|
196
192
|
if (!stringValue) {
|
|
197
193
|
return false;
|
|
198
194
|
}
|
|
199
|
-
switch (
|
|
195
|
+
switch (stringValue.toLowerCase().trim()) {
|
|
200
196
|
case "true":
|
|
201
197
|
case "1":
|
|
202
198
|
return true;
|
|
@@ -210,4 +206,4 @@ var __publicField = (obj, key, value) => {
|
|
|
210
206
|
exports2.ProgressiveShareButton = ProgressiveShareButton;
|
|
211
207
|
exports2.ProgressiveShareButtonClass = ProgressiveShareButtonClass;
|
|
212
208
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
213
|
-
});
|
|
209
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "progressive-share-button",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A web componet that creates a OS-native share button.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -37,11 +37,12 @@
|
|
|
37
37
|
"author": "John F. Morton <john@johnfmorton.com> (https://supergeekery.com)",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
40
41
|
"autoprefixer": "^10.4.13",
|
|
41
42
|
"postcss": "^8.4.21",
|
|
42
43
|
"tailwindcss": "^3.2.7",
|
|
43
44
|
"typescript": "^4.9.5",
|
|
44
|
-
"vite": "^
|
|
45
|
+
"vite": "^7.3.1",
|
|
45
46
|
"vite-plugin-banner": "^0.7.0"
|
|
46
47
|
}
|
|
47
48
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [1.0.3] - 2023-11-17
|
|
9
|
-
|
|
10
|
-
## Added
|
|
11
|
-
|
|
12
|
-
- Added documentation for using the Progressive Share Button with the unpkg CDN.
|
|
13
|
-
|
|
14
|
-
## [1.0.2] - 2023-11-17
|
|
15
|
-
|
|
16
|
-
## Added
|
|
17
|
-
|
|
18
|
-
- A new attribute has been added to the component called `os`. This option allows you to force the button to use a specific operating system icon. The default is `auto` which will use the operating system of the device that the button is being displayed on. The other options are `ios`, `android`, and `windows`. Setting this option is useful during development when combined with the `debug` option to force the button to use a specific icon set regardless of the device the button is being viewed on. For production, leaving it unset or set to `auto` will provide the best user experience for end users.
|
|
19
|
-
|
|
20
|
-
### Fixed
|
|
21
|
-
|
|
22
|
-
- The share icons between iOS, Android and Windows had different line widths. The icons have been remade to have the same line widths to provide a more consistent look across platforms.
|
|
23
|
-
- Fixed a typo in a console log message.
|
|
24
|
-
|
|
25
|
-
## [1.0.1] - 2023-04-10
|
|
26
|
-
|
|
27
|
-
### Fixed
|
|
28
|
-
|
|
29
|
-
- There are no code changes to this version, but the documentation now correctly shows the correct import statement for the module. The previous version had the incorrect import statement showing the module having a default export, but it does not. The import statement should be `import { ProgressiveShareButton } from 'progressive-share-button';`.
|
|
30
|
-
- Fixed the dates in this changelog. I had 2021 instead of 2023. I'm not sure how I missed that!
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## [1.0.0] - 2023-03-04
|
|
34
|
-
|
|
35
|
-
- Initial release of 1.0.0.
|
|
36
|
-
|
|
37
|
-
## [1.0.0-alpha.11] - 2023-03-01
|
|
38
|
-
|
|
39
|
-
### Fixed
|
|
40
|
-
|
|
41
|
-
- Fixed: Previous solution didn't fix build system issue. Switched the build script to use `tsc` instead of `vite` to build the package.
|
|
42
|
-
|
|
43
|
-
## [1.0.0-alpha.10] - 2023-03-01
|
|
44
|
-
|
|
45
|
-
### Fixed
|
|
46
|
-
|
|
47
|
-
- Fixed: The build system didn't include the @types directory in the published package. This has been fixed.
|
|
48
|
-
|
|
49
|
-
## [1.0.0-alpha.9] - 2023-03-01
|
|
50
|
-
|
|
51
|
-
### Added
|
|
52
|
-
|
|
53
|
-
- Added typescript types for the `ProgressiveShareButton` class and default function.
|
|
54
|
-
|
|
55
|
-
### Changed
|
|
56
|
-
|
|
57
|
-
- 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()`.
|
|
58
|
-
- Changed: (breaking change) the `ProgressiveShareButtonElement` class is now exported as `ProgressiveShareButtonClass`.
|
|
59
|
-
|
|
60
|
-
### Fixed
|
|
61
|
-
|
|
62
|
-
- Fixed: The demo page has some incorrect class names in the example code. These have been corrected.
|
|
63
|
-
|
|
64
|
-
## [1.0.0-alpha.8] - 2023-02-27
|
|
65
|
-
|
|
66
|
-
### Changed
|
|
67
|
-
|
|
68
|
-
- Turned off minification for production builds because module will be ultimately be bundled with the application using the module and minification will be handled by the application's build process.
|
|
69
|
-
|
|
70
|
-
## [1.0.0-alpha.7] - 2023-02-27
|
|
71
|
-
|
|
72
|
-
### Added
|
|
73
|
-
|
|
74
|
-
- Added `CHANGELOG.md` file. Sorry for the delay on this one, if you've been watching this as it has gone through development. I'll try to keep this up to date from now on. We're still in an alpha state, so breaking changes will still happen, but I will document them here.
|
|
75
|
-
|
|
76
|
-
### Changed
|
|
77
|
-
|
|
78
|
-
- Changed: (breaking change) the import statement now initialized the web component without needing to call the imported function.
|