Compare commits

...

369 Commits
v1.1.3 ... main

Author SHA1 Message Date
Nikita Karamov d5de42c40b
Release 2.5.0 2024-02-04 16:34:19 +01:00
Nikita Karamov f41dd8636f
Add Fediverse button (#108) 2024-02-04 16:32:46 +01:00
Nikita Karamov 13b1ca9804
Update CHANGELOG 2024-02-04 16:30:07 +01:00
Nikita Karamov 0682b0b0b0
Bump size limit 2024-02-04 15:45:32 +01:00
Nikita Karamov 3e0bae3461
Add s2f-instance parameter
Closes #79
2024-02-04 15:43:54 +01:00
Nikita Karamov 9d21baf43b
Add Fediverse button
Closes #107
2024-02-04 15:23:05 +01:00
Nikita Karamov d64e95e3a4
[pre-commit.ci] pre-commit autoupdate (#106) 2024-02-04 11:23:41 +01:00
Nikita Karamov fa7bb62967
Replace local SVGO hook with mirror repo 2024-02-04 11:20:21 +01:00
pre-commit-ci[bot] b31215510b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-01-29 18:18:01 +00:00
pre-commit-ci[bot] 4c6a6fb38e
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v9.0.0-alpha.1 → v9.0.0-alpha.2](https://github.com/pre-commit/mirrors-eslint/compare/v9.0.0-alpha.1...v9.0.0-alpha.2)
2024-01-29 18:17:42 +00:00
Nikita Karamov 7037b6bb6c
[pre-commit.ci] pre-commit autoupdate (#96) 2024-01-20 15:31:45 +01:00
Nikita Karamov 2a66e00dfd
Pin versions 2024-01-20 15:30:07 +01:00
pre-commit-ci[bot] d3915fea4a [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-01-15 18:03:45 +00:00
pre-commit-ci[bot] 14406a93f8
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-prettier: v3.1.0 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.1.0...v4.0.0-alpha.8)
- [github.com/pre-commit/mirrors-eslint: v8.54.0 → v9.0.0-alpha.1](https://github.com/pre-commit/mirrors-eslint/compare/v8.54.0...v9.0.0-alpha.1)
2024-01-15 18:03:28 +00:00
Nikita Karamov 00ec68742a
2.4.0 2023-12-07 17:35:28 +01:00
Nikita Karamov f8e4f260f7
Update CHANGELOG 2023-12-07 17:35:20 +01:00
Nikita Karamov 96e0aabd91
2.4.0-beta.0 2023-12-07 17:24:51 +01:00
Nikita Karamov 09b22f705d
Improve CI scripts (#101) 2023-12-07 17:23:17 +01:00
Nikita Karamov aaffdbf7dc
Add Publish job 2023-12-07 17:18:36 +01:00
Nikita Karamov c35a7d5a81
Shorten Size Limit job 2023-12-07 17:15:54 +01:00
Nikita Karamov c1dfacdcd4
Do not lint, but build in Test 2023-12-07 17:14:26 +01:00
Nikita Karamov a82093cf3f
Add 'Print' button (#100) 2023-12-07 17:08:31 +01:00
Nikita Karamov 65223a738e
Update CHANGELOG 2023-12-07 16:54:35 +01:00
Nikita Karamov da8bcdf609
Update README 2023-12-07 16:54:28 +01:00
Nikita Karamov 3640a8e05d
Add 'Print' button 2023-12-07 16:44:54 +01:00
Nikita Karamov 82965c4154
Add email button (#99) 2023-12-07 16:40:21 +01:00
Nikita Karamov 84b18b0371
Update CHANGELOG 2023-12-07 00:08:09 +01:00
Nikita Karamov 90eb6d92c5
Update README 2023-12-07 00:07:24 +01:00
Nikita Karamov 29e14cddf2
Add email button 2023-12-06 23:07:42 +01:00
Nikita Karamov 6394054207
Update packages (#98) 2023-12-06 22:49:28 +01:00
Nikita Karamov e09d68153d
Update packages 2023-12-06 22:26:46 +01:00
Nikita Karamov 39759faebf
Bump vite from 5.0.0 to 5.0.5 (#97) 2023-12-06 15:41:50 +01:00
dependabot[bot] ca7e1a940f
Bump vite from 5.0.0 to 5.0.5
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.0.0 to 5.0.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.0.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-05 23:38:20 +00:00
Nikita Karamov 0bc83571ff
Update Vite to v5 and other dependencies (#95) 2023-11-20 09:26:31 +01:00
Nikita Karamov b0dcf28ce2
Update pre-commit hooks 2023-11-20 09:22:57 +01:00
Nikita Karamov ebd35d9213
Use a different size-limit action 2023-11-20 09:22:52 +01:00
Nikita Karamov 3dd118b0bf
Update CSS tools 2023-11-20 09:22:52 +01:00
Nikita Karamov 7446a07f2f
Update size-limit 2023-11-20 09:22:52 +01:00
Nikita Karamov 5169986c3a
Update ESLint & Prettier 2023-11-20 09:06:10 +01:00
Nikita Karamov 989a18ed88
Update to Vite 5 2023-11-20 09:05:24 +01:00
Nikita Karamov b7ed60cd47
Update CI scripts 2023-11-20 08:51:54 +01:00
Nikita Karamov 347c7ccf36
[pre-commit.ci] pre-commit autoupdate (#89) 2023-08-29 08:07:46 +00:00
pre-commit-ci[bot] 0744c5b315
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-prettier: v3.0.1 → v3.0.2](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.1...v3.0.2)
- [github.com/pre-commit/mirrors-eslint: v8.47.0 → v8.48.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.47.0...v8.48.0)
2023-08-28 22:40:24 +00:00
Nikita Karamov 58319f5bb9
[pre-commit.ci] pre-commit autoupdate (#87) 2023-08-18 07:58:42 +00:00
pre-commit-ci[bot] b144ee3649
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.46.0 → v8.47.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.46.0...v8.47.0)
2023-08-14 22:56:58 +00:00
Nikita Karamov a3ddfd8210
[pre-commit.ci] pre-commit autoupdate (#85) 2023-08-08 15:19:30 +02:00
pre-commit-ci[bot] ca8e754dc2
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-prettier: v3.0.0 → v3.0.1](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0...v3.0.1)
2023-08-07 22:50:42 +00:00
Nikita Karamov dbe8ed5bb3
2.3.0 2023-08-01 16:19:33 +02:00
Nikita Karamov 2a95cabada
[pre-commit.ci] pre-commit autoupdate (#84) 2023-08-01 13:08:25 +02:00
pre-commit-ci[bot] 000f0db9e0
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.45.0 → v8.46.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.45.0...v8.46.0)
2023-07-31 23:08:15 +00:00
Nikita Karamov b9faaa6002
Add Tumblr button (#80) 2023-07-31 23:08:06 +02:00
Nikita Karamov f805295cc4
Update docs 2023-07-31 23:07:00 +02:00
Nikita Karamov 1258053c02
Add required canonical URL parameter 2023-07-31 22:59:00 +02:00
Isaac Kabucho cf704dec66 Added tumblr between telegram and twitter both in css and html 2023-07-31 15:55:52 +02:00
Isaac Kabucho d4865ddf54 made the requested changes and added the trailing comma in whatsapp 2023-07-31 15:55:52 +02:00
Isaac Kabucho b1af98b111 Made the necessary changes requested in the review 2023-07-31 15:55:52 +02:00
Isaac Kabucho 64f7e8d947 Removed package-lock.json 2023-07-31 15:55:52 +02:00
Isaac Kabucho bb746fcbd1 Added tumblr button 2023-07-31 15:55:52 +02:00
Nikita Karamov b2331876ba
Enforce PNPM a bit more (#82) 2023-07-31 15:45:52 +02:00
Nikita Karamov ea995ce107
Do not include only-allow as a dep 2023-07-31 15:44:30 +02:00
Anderson Joseph aba136b312
add only-allow pnpm 2023-07-29 13:16:36 -04:00
Anderson Joseph b92ac9baa7
enforce pnpm a bit more 2023-07-28 17:57:46 -04:00
Nikita Karamov 301277d018
Update CHANGELOG 2023-07-19 23:43:51 +02:00
Nikita Karamov 9ca9aa8740
2.2.3 2023-07-19 23:38:32 +02:00
Nikita Karamov afbd45d2eb
[pre-commit.ci] pre-commit autoupdate (#72) 2023-07-18 09:25:05 +02:00
pre-commit-ci[bot] c780131a93
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.43.0 → v8.45.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.43.0...v8.45.0)
2023-07-17 22:46:53 +00:00
Nikita Karamov d2370aeaf6
Release 2.2.2 2023-07-15 20:01:42 +02:00
Nikita Karamov 2be4684875
Fix web-share.svg icon
See: https://github.com/kytta/shareon/pull/71
2023-07-15 20:00:29 +02:00
Nikita Karamov 6b9ef4212e
Update src/icons/web-share.svg 2023-07-15 19:58:41 +02:00
pre-commit-ci[bot] 7ca6e9f201 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-07-15 13:38:40 +00:00
Jake Howard 3620323d7c
Fix web-share.svg icon
There was an encoding issue in the stroke color.
2023-07-15 14:37:38 +01:00
Nikita Karamov 3150d947f7
Release 2.2.1 2023-07-15 12:16:33 +02:00
Nikita Karamov d553e74367
Automate most parts of icon creation
See: https://github.com/kytta/shareon/pull/70
2023-07-15 12:14:44 +02:00
Nikita Karamov ec3e40623a
Update CHANGELOG 2023-07-15 12:12:36 +02:00
Nikita Karamov e689e2f401
Add contributing guide 2023-07-15 12:08:03 +02:00
Nikita Karamov de9b21ed33
Automatically compress SVGs with svgo 2023-07-15 11:36:09 +02:00
Nikita Karamov 000e3b1b1f
Move inline SVGs into separate files 2023-07-15 11:35:46 +02:00
Nikita Karamov 348bddf4fa
Inline URLs in CSS 2023-07-15 11:29:32 +02:00
Nikita Karamov 6733bf2b9e
Release 2.2.0 2023-07-15 00:39:03 +02:00
Nikita Karamov 55e512f6ad
Update README picture 2023-07-15 00:38:24 +02:00
Nikita Karamov b2ccbf3cb5
Update CHANGELOG 2023-07-15 00:33:44 +02:00
Nikita Karamov 174f113cd5
Fix changelog's entry for 1.6.3 2023-07-15 00:33:35 +02:00
Nikita Karamov f0018aeaf0
Update size-limit to use Brotli
See: https://github.com/kytta/shareon/pull/69

nice.
2023-07-15 00:28:51 +02:00
Nikita Karamov 9974a79c2a
Update README 2023-07-15 00:26:00 +02:00
Nikita Karamov 3566d4e096
Update size-limit to use Brotli 2023-07-15 00:25:19 +02:00
Nikita Karamov eca6736e3b
Bump dependencies
See: https://github.com/kytta/shareon/pull/68
2023-07-15 00:23:57 +02:00
Nikita Karamov 505740fe78
Bump prettier in lint step 2023-07-15 00:20:29 +02:00
Nikita Karamov f67de79932
Major dep bump 2023-07-15 00:20:29 +02:00
Nikita Karamov 33b02be656
Minor dep bump 2023-07-15 00:17:22 +02:00
Nikita Karamov 3aea6e72eb
Add Web Share API button
Co-authored-by: Dimitrios Douros <dourosdimitris@outlook.com>
See: https://github.com/kytta/shareon/pull/67
2023-07-15 00:13:13 +02:00
Nikita Karamov 845ea065c7
Update specimen 2023-07-15 00:11:45 +02:00
Nikita Karamov df97c8aaf5
Temporarily increase size limit
See also: https://github.com/kytta/shareon/issues/62
2023-07-14 23:59:03 +02:00
Dimitrios Douros de29ba84b8
webshare api 2023-07-14 23:40:00 +02:00
Nikita Karamov e97fc400a2
Add MS Teams
Co-authored-by: Dimitrios Douros <dourosdimitris@outlook.com>
See: https://github.com/kytta/shareon/pull/66
2023-07-14 23:09:02 +02:00
Nikita Karamov 21c2c92211
Update README 2023-07-14 23:06:31 +02:00
Nikita Karamov 3af15fa7df
Update specimen 2023-07-14 23:03:27 +02:00
Dimitrios Douros a551eca0e3
Added MS Teams
Co-authored-by: Nikita Karamov <me@kytta.dev>
2023-07-14 23:00:04 +02:00
Nikita Karamov db2d9f1b5a
Update Prettier to v3
See: https://github.com/kytta/shareon/pull/65
2023-07-14 22:30:19 +02:00
Nikita Karamov 9977dde3c7
Apply new formatting 2023-07-14 22:28:45 +02:00
Nikita Karamov 625d5a02e5
Return old Markdown behaviour 2023-07-14 22:28:45 +02:00
Nikita Karamov b3a9fa6c59
Bump version in pnpm-lock 2023-07-14 22:28:44 +02:00
Nikita Karamov 44fee3a639
Update pre-commit hook 2023-07-14 22:22:34 +02:00
Nikita Karamov be50ea5028
Add `data-hashtags` for Facebook and Twitter
See: https://github.com/kytta/shareon/pull/60
2023-07-14 22:13:24 +02:00
Edward Cui cac6350bf0 Add explanation on how to use `data-hashtags` in README.md 2023-07-13 23:56:04 +08:00
Edward 73a7467cb4
Update src/shareon.js
Use url encoded string to replace `#`.

Co-authored-by: Nikita Karamov <me@kytta.dev>
2023-07-11 07:24:02 -07:00
Edward 59ba22638a
Apply suggestions from code review
Remove `hashtag` but use the first element of `hastags` instead for facebook hashtag parameter.

Co-authored-by: Nikita Karamov <me@kytta.dev>
2023-07-06 20:50:57 +08:00
Edward Cui c00e449749 Add hashtag to facebook and hastags to twitter
Hashtag and hastags are the most commonly used features on facebook and
twitter respectively. Adding support to those two will make the library
even more powerful.

This PR add two optional attribute `data-hashtag` for facebook and
`data-hashtags` for twitter.

`data-hashtag` is a single key word without `#` while `data-hashtags`
are comma seperated strings without `#`.
2023-07-04 21:52:20 +08:00
Nikita Karamov 1fbefa9fd3
[pre-commit.ci] pre-commit autoupdate (#57) 2023-06-20 10:05:37 +02:00
pre-commit-ci[bot] 3ed9a9e2da
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.42.0 → v8.43.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.42.0...v8.43.0)
2023-06-19 22:10:08 +00:00
Nikita Karamov 9ac9df4a94
[pre-commit.ci] pre-commit autoupdate (#55) 2023-06-05 23:54:19 +02:00
pre-commit-ci[bot] ca748bf45e
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.41.0 → v8.42.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.41.0...v8.42.0)
2023-06-05 21:24:11 +00:00
Nikita Karamov f94218a36f
[pre-commit.ci] pre-commit autoupdate (#54) 2023-05-26 15:18:01 +02:00
pre-commit-ci[bot] 31841b115c
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.40.0 → v8.41.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.40.0...v8.41.0)
2023-05-22 21:29:08 +00:00
Nikita Karamov 0a06484a1e
[pre-commit.ci] pre-commit autoupdate (#53) 2023-05-09 11:19:52 +02:00
pre-commit-ci[bot] 7a149c12c0
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.39.0 → v8.40.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.39.0...v8.40.0)
2023-05-08 21:57:12 +00:00
Nikita Karamov 0669eb6c3a
[pre-commit.ci] pre-commit autoupdate (#52) 2023-04-25 12:32:40 +02:00
pre-commit-ci[bot] d91e28296b
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.6 → v3.0.0-alpha.9-for-vscode](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0-alpha.6...v3.0.0-alpha.9-for-vscode)
- [github.com/pre-commit/mirrors-eslint: v8.38.0 → v8.39.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.38.0...v8.39.0)
2023-04-24 21:40:12 +00:00
Nikita Karamov cfa741865a
[pre-commit.ci] pre-commit autoupdate (#51) 2023-04-10 23:58:03 +00:00
pre-commit-ci[bot] 5894d3c319
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.37.0 → v8.38.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.37.0...v8.38.0)
2023-04-10 21:32:16 +00:00
Nikita Karamov 39c5d71105
[pre-commit.ci] pre-commit autoupdate (#50) 2023-04-05 18:44:15 +00:00
pre-commit-ci[bot] 25ddf81bba
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-eslint: v8.36.0 → v8.37.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.36.0...v8.37.0)
2023-04-05 20:41:26 +02:00
Nikita Karamov f45a158b0a
Move to PNPM 8 2023-04-05 20:40:44 +02:00
Nikita Karamov 25c8de44f8
Always run size checks
In other case, the size-limit will not have an available baseline for PRs
2023-03-20 20:36:07 +01:00
Nikita Karamov 5938e8a9e7
Update demo banner 2023-03-20 19:43:35 +01:00
Nikita Karamov 5592ca9930
Release 2.1.0 2023-03-20 19:24:19 +01:00
Nikita Karamov 83edc92103
Update dependencies 2023-03-20 19:24:12 +01:00
Nikita Karamov 45d5c12442
Update README 2023-03-20 19:23:03 +01:00
Nikita Karamov 2378f55de5
Update CHANGELOG 2023-03-20 19:23:03 +01:00
Nikita Karamov fdf4c946c0
Add "Copy URL" button (#44) 2023-03-20 19:16:57 +01:00
Nikita Karamov d49120ed0f Change icon for a second after copying 2023-03-20 19:15:22 +01:00
Nikita Karamov 10cf0143d8 Use a different link icon 2023-03-20 19:15:22 +01:00
Nikita Karamov 1d766385c9 Update specimen so that it looks good 2023-03-20 19:15:22 +01:00
Nikita Karamov 618627c418 Add "Copy URL" buttons to test page 2023-03-20 19:15:22 +01:00
Nikita Karamov 2493e6d014 Add "Copy URL" button
Closes #41
2023-03-20 19:15:22 +01:00
Nikita Karamov 63e5733a72 Make default background darker 2023-03-20 19:15:22 +01:00
Nikita Karamov 5fbda7a112
Fix size-limit-action branch (#48) 2023-03-20 19:14:46 +01:00
Nikita Karamov 582f4dc939
Fix size-limit-action branch 2023-03-20 19:13:11 +01:00
Nikita Karamov 22f913c1c6
Add pre-commit (#47) 2023-03-20 19:09:39 +01:00
Nikita Karamov bdc583b787
Fix pre-commit issue 2023-03-20 19:08:07 +01:00
Nikita Karamov 7bfbccea66
Add pre-commit config 2023-03-20 19:08:01 +01:00
Nikita Karamov 2a0b7fa669
2.0.2 2023-01-25 20:53:49 +01:00
Nikita Karamov bacd69cdc0
Improve build process (#46) 2023-01-25 20:52:21 +01:00
Nikita Karamov c611962f90
Re-lock deps 2023-01-25 20:30:18 +01:00
Nikita Karamov ee3a9f280b
2.0.2-0 2023-01-25 20:29:15 +01:00
Nikita Karamov 9726efc022
Update CHANGELOG 2023-01-25 20:29:15 +01:00
Nikita Karamov 5aeb9831bd
Move ESLint config to package.json 2023-01-25 20:29:15 +01:00
Nikita Karamov 8a24871a0d
Move PostCSS config to package.json 2023-01-25 20:29:15 +01:00
Nikita Karamov 6453f15d70
Remove banner 2023-01-25 20:29:15 +01:00
Nikita Karamov 48e44e25aa
Fix code style 2023-01-25 20:29:14 +01:00
Nikita Karamov 38155afa8a
Remove Browserslist config to always target the defaults 2023-01-25 20:29:14 +01:00
Nikita Karamov d57a8cae50
Disable sourcemaps on the output 2023-01-25 20:29:14 +01:00
Nikita Karamov 1550573923
Build CSS using Vite 2023-01-25 20:29:14 +01:00
Nikita Karamov ae67a19233
Update to Vite v4 2023-01-25 20:29:13 +01:00
Nikita Karamov 70477e05c1
Minify with esbuild instead of terser
In the end, the files are basically of the same size, but esbuild is
faster. We also do not need any extra packages.
2023-01-25 20:29:13 +01:00
Nikita Karamov bae7f40ef4
Make project type module 2023-01-25 20:29:13 +01:00
Nikita Karamov 54601a5bac
Correct indentation (I hate YAML) 2023-01-25 20:28:31 +01:00
Nikita Karamov 079411fc49
Fix Prettier 2023-01-25 20:26:49 +01:00
Nikita Karamov bb19f28656
Fix CI (hopefully) 2023-01-25 20:25:21 +01:00
Nikita Karamov a532a37a8e
Disable caching in workflow 2023-01-25 20:11:08 +01:00
Nikita Karamov af902c144e
Create main.yml 2023-01-25 20:06:33 +01:00
Nikita Karamov 8bd8b0f31f
v2.0.1 2023-01-23 06:07:51 +01:00
Nikita Karamov 85803d0fd3
Move project back to GitHub 2023-01-23 06:07:17 +01:00
Nikita Karamov e36dfb6101
Update Mastodon branding (#45) 2023-01-23 06:00:41 +01:00
Nikita Karamov 739422c6a0
Update CHANGELOG 2023-01-23 05:58:18 +01:00
Nikita Karamov ff84b3ceda
Update specimen image 2023-01-23 05:57:32 +01:00
Nikita Karamov a69c3f7469
Update Mastodon branding
Closes #42
2023-01-23 05:55:44 +01:00
Nikita Karamov bbcb19ef56
Update dev dependencies 2022-11-16 10:45:17 +01:00
Nikita Karamov 2a974a5cac
Update Browserslist config 2022-11-16 10:40:27 +01:00
Nikita Karamov c07f0138b9
v2.0.0 2022-02-13 15:58:45 +01:00
Nikita Karamov 60b1f0541a
Merge branch 'prepare-v2-release'
https://codeberg.org/kytta/shareon/pulls/9
2022-02-13 15:56:41 +01:00
Nikita Karamov 13f9ffcc68
v2.0.0-rc.0 2022-02-13 15:51:16 +01:00
Nikita Karamov e3c09dc69f
Add funding links 2022-02-11 17:10:01 +01:00
Nikita Karamov a9571908b4
Add trailing slash in personal URL 2022-02-11 17:07:51 +01:00
Nikita Karamov 7c01217f87
Update URL to repo 2022-02-11 17:07:35 +01:00
Nikita Karamov f91643b831
Add CHANGELOG entry and docs for CSS export
Closes https://github.com/kytta/shareon/issues/35
See: https://codeberg.org/kytta/shareon/pulls/12
2022-02-11 16:14:26 +01:00
Nikita Karamov 89c84b053f
Update links in CHANGELOG 2022-02-11 16:14:25 +01:00
Nikita Karamov 952fe10d67
Update logos and colours 2022-02-11 16:14:24 +01:00
Nikita Karamov db05a94838
Remove unneeded TODO 2022-02-11 16:14:23 +01:00
Nikita Karamov 4bb70cb405
Add link to Wordpress plugin
Sorry Gareth, it took me too long... 😅

Closes https://github.com/kytta/shareon/issues/7
2022-02-11 16:14:22 +01:00
Nikita Karamov 018b4e0dc9
Delete GitHub-specific files
After migration to Codeberg, GitHub's CI definitions aren't needed any
more. The project will be migrated to Codeberg CI when it exits private
beta.

Also delete banner image file, since it wasn't being used anywhere.
2022-02-11 16:14:21 +01:00
Nikita Karamov 846570dd31
Delete docs/
Docs will be hosted on the separate branch, `pages`. They will not be
automatically built any more.
2022-02-11 16:14:20 +01:00
Nikita Karamov d28556e142
Update year in LICENSE 2022-02-11 16:14:19 +01:00
Nikita Karamov 2877fef357
Update README
- update installation instruction

 - use clearer text for descriptions

 - update licence footer; add information about Simple Icons

 - update URLs and permalinks to related projects
2022-02-11 16:14:18 +01:00
Nikita Karamov 6e4ec8ea26
Add new demo picture 2022-02-11 16:14:17 +01:00
Nikita Karamov a31564ae33
Merge branch 'css-export'
https://codeberg.org/kytta/shareon/pulls/12
2022-02-11 16:12:15 +01:00
Nikita Karamov f64371fcab
v2.0.0-beta.3 2022-02-11 15:08:48 +01:00
Nikita Karamov 27bdff424f
Add CSS export for the package
See https://github.com/kytta/shareon/issues/35
2022-02-11 15:06:25 +01:00
Nikita Karamov a4a27fb567
Merge branch 'clean-publish'
https://codeberg.org/kytta/shareon/pulls/11
2022-02-11 14:56:11 +01:00
Nikita Karamov 56b90f7006
v2.0.0-beta.2 2022-02-11 14:49:28 +01:00
Nikita Karamov db92342732
Add clean-publish 2022-02-11 14:49:03 +01:00
Nikita Karamov bdda39b8ef
Merge branch 'non-default-export'
https://codeberg.org/kytta/shareon/pulls/10
2022-02-10 23:06:56 +01:00
Nikita Karamov 288fc56528
Update CHANGELOG 2022-02-10 23:05:04 +01:00
Nikita Karamov d5141a6383
Use non-default export 2022-02-10 23:02:50 +01:00
Nikita Karamov 51ec64b236
Merge branch 'postcss-csso'
https://codeberg.org/kytta/shareon/pulls/8
2022-02-10 22:38:43 +01:00
Nikita Karamov 20e05d2ca2
Replace cssnano with CSSO
CSSO has better PostCSS API, has less dependencies and produces more
optimized CSS.
2022-02-10 22:37:46 +01:00
Nikita Karamov d3081f3446
Merge branch 'for-of-loop'
https://codeberg.org/kytta/shareon/pulls/7
message to explain why this merge is necessary,
2022-02-10 22:34:43 +01:00
Nikita Karamov a0a7c02e0a
Replace index loops with for-of-loops 2022-02-10 22:34:16 +01:00
Nikita Karamov 733a8da0b7
Merge branch 'update-eslint-config'
https://codeberg.org/kytta/shareon/pulls/6
2022-02-10 22:22:33 +01:00
Nikita Karamov 15ce773189
Tweak ESLint config 2022-02-10 22:21:17 +01:00
Nikita Karamov e0e0f9bf63
Use "node" protocol for import 2022-02-10 22:21:09 +01:00
Nikita Karamov dd3afd72b3
Use clearer name for package.json variable 2022-02-10 22:20:53 +01:00
Nikita Karamov 4bd28fa8aa
Lint all files 2022-02-10 22:20:18 +01:00
Nikita Karamov 95cb4ce158
Rename index variables in loops 2022-02-10 22:20:06 +01:00
Nikita Karamov 51a7597235
Use querySelectorAll instead of getElementsByClassName 2022-02-10 22:19:54 +01:00
Nikita Karamov 9a6f39af4a
Move button listener outside the loop 2022-02-10 22:19:03 +01:00
Nikita Karamov bea94e545d
Re-export shareon with `export ... from` 2022-02-10 22:16:26 +01:00
Nikita Karamov db7c10048f
Add eslint-plugin-unicorn 2022-02-10 22:06:50 +01:00
Nikita Karamov 9d86369877
Remove Airbnb config in favour of the default one 2022-02-10 22:02:17 +01:00
Nikita Karamov bae3f9cda4
v2.0.0-beta.1 2022-02-10 21:55:43 +01:00
Nikita Karamov 9982e074b1
Merge branch 'vite-build'
https://codeberg.org/kytta/shareon/pulls/5
2022-02-10 21:53:56 +01:00
Nikita Karamov c2e1ee5bd9
Rename fields in package.json 2022-02-10 21:51:37 +01:00
Nikita Karamov c9364937b4
Update changelog 2022-02-10 21:48:45 +01:00
Nikita Karamov a401180d4a
Remove unneeded dependencies 2022-02-10 21:47:21 +01:00
Nikita Karamov 50d9e900f2
Add new build scripts 2022-02-10 21:44:53 +01:00
Nikita Karamov f6d5e43bcb
Add banner options from Rollup config 2022-02-10 21:44:35 +01:00
Nikita Karamov 4b13754597
Extract PostCSS config 2022-02-10 21:44:22 +01:00
Nikita Karamov 1b151450cd
Add demo page 2022-02-10 21:34:06 +01:00
Nikita Karamov 77123986bf
Add vite as devDependency 2022-02-10 21:26:35 +01:00
Nikita Karamov 6816879bbc
Merge branch 'remove-mixins'
https://codeberg.org/kytta/shareon/pulls/4

message to explain why this merge is necessary,
2022-02-10 21:20:54 +01:00
Nikita Karamov c9db249c9c
Update changelog 2022-02-10 21:18:45 +01:00
Nikita Karamov 0591f86461
Remove now unused plugins 2022-02-10 21:18:36 +01:00
Nikita Karamov c5e4ab0bd7
Move urlBuilderMap to shareon.js 2022-02-10 21:16:53 +01:00
Nikita Karamov 70aaddb0c3
Add the style definitions directly to the CSS file
Also rename file to `shareon.css`
2022-02-10 21:16:26 +01:00
Nikita Karamov a367bc5dfa
Merge branch 'remove-np'
https://codeberg.org/kytta/shareon/pulls/3
2022-02-10 21:00:02 +01:00
Nikita Karamov 75fab9b57b
Remove `np`
Instead, I will be using standard `pnpm publish` command. This action
alone removed 250+ packages from the devDependencies tree 🎉
2022-02-10 20:58:37 +01:00
Nikita Karamov 6081dba557
v2.0.0-beta.0 2022-02-10 20:53:25 +01:00
Nikita Karamov 3226d8442d
Merge branch 'smart-autoinit'
https://codeberg.org/kytta/shareon/pulls/2
2022-02-10 20:37:45 +01:00
Nikita Karamov af7060fb98
Update CHANGELOG 2022-02-10 20:32:58 +01:00
Nikita Karamov 305751a361
Build the new version 2022-02-10 20:32:52 +01:00
Nikita Karamov 73b54c385a
Write new index.js for the package 2022-02-10 20:32:40 +01:00
Nikita Karamov 8d8037ee1a
Merge branch 'prettier-code-style'
Merges https://codeberg.org/kytta/shareon/pulls/1
2022-02-08 19:21:30 +01:00
Nikita Karamov 0e924799a6
Update changelog 2022-02-08 19:19:25 +01:00
Nikita Karamov dcb1079aa6
Add .git-blame-ignore-revs
On supported systems, this will make sure that the commit that changes
the syntax will be excluded from Git blame output.
2022-02-08 19:11:12 +01:00
Nikita Karamov d95105353f
Convert code using Prettier 2022-02-08 18:56:39 +01:00
Nikita Karamov c626ffdb39
Add Prettier as dependency 2022-02-08 18:52:13 +01:00
Nikita Karamov c3295cc821
Update GitHub Actions to use PNPM 2022-02-02 15:19:03 +01:00
Nikita Karamov 941338890e
Update CHANGELOG 2022-02-02 15:15:47 +01:00
Nikita Karamov 6b6ad40b68
1.6.3 2022-02-02 15:12:35 +01:00
Nikita Karamov 57b9769417
Update toot URL 2022-02-02 15:08:47 +01:00
Nikita Karamov 58ae955e6f
Update dev dependencies 2022-02-02 15:08:38 +01:00
Nikita Karamov d51c6e860d
Migrate to PNPM
Also remove lockfile from Git repository
2022-02-02 15:06:04 +01:00
Nikita Karamov 6ee4f6da92
Update usernames
- update GitHub username

 - update Liberapay username

 - update website address
2022-02-02 15:02:32 +01:00
Nikita Karamov 56c83b197c
v1.6.2 2021-06-29 20:50:50 +02:00
Nikita Karamov 6d7493b5b1
Update CHANGELOG 2021-06-29 20:47:19 +02:00
Nikita Karamov 25bcdc6b5b
Bump dependencies
https://github.com/NickKaramoff/shareon/pull/33
2021-06-29 20:39:51 +02:00
Nikita Karamov c16a5ab654
Add description to tab/website title (see #32)
Co-authored by: rugk <rugk+git@posteo.de>
2021-03-21 20:15:59 +01:00
Nikita Karamov b53c7aac45
v1.6.1 2021-01-18 00:02:46 +03:00
Nikita Karamov e1f8c2cdb8
Update CHANGELOG 2021-01-17 23:59:34 +03:00
Nikita Karamov da71d0f227
Fix LinkedIn link 2021-01-17 23:58:15 +03:00
Nikita Karamov a0ed639379
Simplify build config and dev environment (#30) 2021-01-17 23:11:41 +03:00
Nikita Karamov 08774496ec
Add release task 2021-01-17 23:07:23 +03:00
Nikita Karamov e89eaecf12
Update dependencies 2021-01-17 22:36:20 +03:00
Nikita Karamov 3441effc98
Move all build config to Rollup 2021-01-17 22:32:59 +03:00
Nikita Karamov 2165abbb52
Update Rollup toolchain 2021-01-17 11:50:47 +03:00
Nikita Karamov fbec8b0cff
Simplify Rollup config
- replace rollup-plugin-license with Rollup's own output.banner
- use path.join to join paths
2021-01-17 11:25:39 +03:00
Nikita Karamov 47ece2215d
Bump dependencies 2021-01-17 02:04:12 +03:00
Nikita Karamov 1614fb4c94
Remove unused dependency 2021-01-17 02:02:19 +03:00
Nikita Karamov 689d4399a2
Add logo license information to README 2021-01-17 01:50:16 +03:00
Nikita Karamov 3c4b76a176
Update favicons
Cred: https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs
2021-01-17 01:44:33 +03:00
Nikita Karamov 4e16129279
Move assets to 'assets/'
The new directory will host project's logo, banner and demo screenshot
2021-01-17 01:33:46 +03:00
Nikita Karamov bab3369d79
Update branch name references 2021-01-17 01:02:36 +03:00
Nikita Karamov e2ea950ec7
Update .gitignore 2021-01-17 00:58:25 +03:00
Nikita Karamov 00c6666124
Add CHANGELOG 2021-01-17 00:57:56 +03:00
Nikita Karamov f771ae427b
Update README 2021-01-17 00:15:19 +03:00
Nikita Karamov 26b5640b58
Update years in LICENSE 2021-01-17 00:13:38 +03:00
Nikita Karamov 36f0a73c91
Add EditorConfig
Files remain unformatted for now
2021-01-17 00:11:48 +03:00
Nikita Karamov 334e3c5682
Simplify GH Action workflow 2021-01-17 00:10:57 +03:00
Nikita Karamov 39bd59b8eb
Remake build scripts 2021-01-17 00:10:33 +03:00
Nikita Karamov 5fc3e5beb2
Update FUNDING.yml
Replace Patreon with GH Sponsor and add direct PayPal
2020-10-07 20:18:27 +02:00
Nikita Karamov b208b2b7e5
v1.6.0 2020-09-28 14:02:44 +02:00
Nikita Karamov 31fd9e5d72
Remove data-text from Mastodon example 2020-09-28 14:01:29 +02:00
Nikita Karamov f98bd00a4f
Add Oxford comma 2020-09-28 14:01:13 +02:00
Nikita Karamov 8e88037b44
Add proper data-via to Twitter and Mastodon buttons 2020-09-28 14:01:03 +02:00
Nikita Karamov fc45e769cb
Merge pull request #29 from NickKaramoff/fix/messenger-app-id 2020-09-28 13:59:51 +02:00
Nikita Karamov 35f497d3c1
Update the docs accordingly 2020-09-28 13:48:10 +02:00
Nikita Karamov 9da80abfa5
Add FB App ID to possible data-attributes 2020-09-28 13:33:36 +02:00
Nikita Karamov e090b9da0d
Update docs/index.html 2020-09-24 20:28:13 +02:00
Nikita Karamov 0b92b4c0dc
Fix GITHUB_TOKEN not present 2020-09-24 20:23:43 +02:00
Nikita Karamov 40b671bf56
Once again fix GitHub action 2020-09-24 20:19:26 +02:00
Nikita Karamov 2d04b2a279
Fix ref name 2020-09-24 20:15:33 +02:00
Nikita Karamov 953b136b14
Add GitHub Pages Action 2020-09-24 20:12:47 +02:00
Nikita Karamov 5f1f60d757
v1.5.0 2020-09-24 17:15:52 +02:00
Nikita Karamov cb897e8e5b
Merge pull request #27 from andybalaam/add-mastodon-via-toot 2020-09-24 17:15:08 +02:00
Andy Balaam ad3e762782
Update Mastodon colour to the correct one for a white logo.
Co-authored-by: Nikita Karamov <nick@karamoff.dev>
2020-09-24 16:13:31 +01:00
Nikita Karamov 4340d58e57
Add task for building a development version of shareon 2020-09-24 16:25:18 +02:00
Andy Balaam 72dcc91321 Note that the Mastodon logo was modified 2020-09-24 00:57:55 +01:00
Andy Balaam 8a18980dfa Add Mastodon button using NickKaramoff's toot.karamoff.dev 2020-09-24 00:53:15 +01:00
Nikita Karamov bc1fa34391
v1.4.5 2020-09-22 15:23:31 +02:00
Nikita Karamov d3919b1821
Fix PostCSS not applying any plugins 2020-09-22 15:23:04 +02:00
Nikita Karamov e1af6c49c8
v1.4.4 2020-09-18 20:27:56 +02:00
Nikita Karamov abd4b2459f
Merge pull request #21 from NickKaramoff/feature/transpilation 2020-09-18 20:26:54 +02:00
Nikita Karamov 4fc6d5e8f0
v1.4.4-0 2020-09-18 20:25:04 +02:00
Nikita Karamov fb4a0651f9
Fix button listeners 2020-09-18 20:24:22 +02:00
Nikita Karamov 6bda2f5abe
v1.4.3-0 2020-09-18 19:44:48 +02:00
Nikita Karamov a27b6fb434
Migrate from Rollup to Gulp and add Buble 2020-09-18 19:40:26 +02:00
Nikita Karamov 045ca283c3
v1.4.2 2020-09-18 10:37:04 +02:00
Nikita Karamov 3e2c5b24dd
Merge pull request #20 from NickKaramoff/fix/whatsapp
Fix WhatsApp button to work on PCs without app
2020-09-18 10:35:57 +02:00
Nikita Karamov f74b1e0d8c
Fix WhatsApp button to work on PCs w/o app
Closes #18
2020-09-17 22:18:44 +02:00
Nikita Karamov 87b33d0005
Replace Travis CI with GitHub Action 2020-08-03 11:36:01 +02:00
Nikita Karamov caf8b5802b
Merge pull request #16 from matthew-e-brown/master
Remove border on hovered <button> elements in the docs
2020-08-03 09:47:29 +02:00
Matthew Brown 6991166dc8 Remove border on hovered <button> elements 2020-08-03 01:26:20 -04:00
Nikita Karamov b1ab655e65
v1.4.1 2020-08-01 00:42:10 +02:00
Nikita Karamov d008f7e1cd
Merge branch 'feature/simplified-management' 2020-08-01 00:40:10 +02:00
Nikita Karamov d158e50926
v1.4.1-0 2020-07-31 18:58:19 +02:00
Nikita Karamov 7ce6516d39
Reformat networks.js 2020-07-31 18:57:09 +02:00
Nikita Karamov f0e78a31ca
Uninstall unneded packages 2020-07-31 18:57:02 +02:00
Nikita Karamov becdbb870e
Update build 2020-07-31 18:54:51 +02:00
Nikita Karamov 65969039a4
Add mixin to populate CSS 2020-07-31 18:54:43 +02:00
Nikita Karamov f856eb3474
Move from Sass to CSS 2020-07-31 18:54:12 +02:00
Nikita Karamov 12187ca227
Move from TS to JS 2020-07-31 18:18:17 +02:00
Nikita Karamov 841ed23855
Extract networks to another file 2020-07-31 18:16:59 +02:00
Nikita Karamov 854bb77dfa
v1.4.0 2020-07-30 12:42:32 +02:00
Nikita Karamov 6eae37e54f
Optimize code
* optimize loops to reduce execution time
* inline functions to reduce output file size
* flatten PublishPreset structure
* remove extra checks
2020-07-30 12:40:00 +02:00
Nikita Karamov 24561c6a45
Bump dependencies (major) 2020-07-30 12:23:54 +02:00
Nikita Karamov e7a50c239d
Bump dependencies (minor) 2020-07-30 12:18:27 +02:00
Nikita Karamov 8b72376e9c
Bump dependencies (patch) 2020-07-30 12:09:39 +02:00
Nikita Karamov fd4e25d5a4
v1.3.1 2020-07-30 12:05:32 +02:00
Nikita Karamov 6df84bc649
Fix documentation 2020-07-30 11:58:57 +02:00
Nikita Karamov 248db40b75
v1.3.0 2020-07-26 14:44:53 +02:00
Nikita Karamov 8ccc88d99a
Merge pull request #14 from NickKaramoff/feature/default-export
Export the `shareon` function
2020-07-26 14:44:10 +02:00
Nikita Karamov bece4cdcf2
Update docs 2020-07-26 14:40:37 +02:00
Nikita Karamov 14558ac201
v1.3.0-6 2020-07-26 14:18:33 +02:00
Nikita Karamov 51c294b471
Revert previous changes 2020-07-26 14:17:16 +02:00
Nikita Karamov 7132702f57
v1.3.0-5 2020-07-23 20:20:05 +02:00
Nikita Karamov 88f92e7026
Move files outside the dist folder 2020-07-23 20:19:32 +02:00
Nikita Karamov f868a8fd3f
v1.3.0-4 2020-07-23 20:00:55 +02:00
Nikita Karamov 59399f5a1c
Rename shareon to index 2020-07-23 20:00:31 +02:00
Nikita Karamov bac84769e8
v1.3.0-3 2020-07-23 19:26:32 +02:00
Nikita Karamov baa669fabf
Some 'exports' field magic 2020-07-23 19:26:07 +02:00
Nikita Karamov 69edba6b9f
v1.3.0-2 2020-07-23 19:22:20 +02:00
Nikita Karamov e0c32b79d6
Ignoring .DS_Store 2020-07-23 19:21:57 +02:00
Nikita Karamov 79869a6e26
Some 'browser' field magic 2020-07-23 19:18:19 +02:00
Nikita Karamov db8b0751d7
v1.3.0-0 2020-07-23 18:41:41 +02:00
Nikita Karamov 522f0960d4
A better split into two versions
Additionally add some typing to the Rollup config files
2020-07-23 18:39:28 +02:00
Nikita Karamov 8f1d52e281
Split package into two files 2020-07-23 11:17:51 +02:00
Nikita Karamov b3a4cd1593
Merge pull request #13 from amiceli/add-default-export
Closes #11
2020-07-23 11:17:25 +02:00
amiceli 3c23d28ed2 Revert "publish temporary version waiting merge pull request on shareon original repo."
This reverts commit fe31d87512.
2020-07-16 12:02:07 +02:00
amiceli fe31d87512 publish temporary version waiting merge pull request on shareon original repo. 2020-07-15 19:00:58 +02:00
amiceli 4db5ac324b Add default export for initializeShareon.
It allows to initialize share button after window.load, for example on SPA dynamic element.
2020-07-14 17:47:27 +02:00
Nikita Karamov 5f5abd1611
docs: Update version from CDN in other places 2020-07-12 17:13:24 +02:00
Nikita Karamov f3420ac1a2
docs: Update version from CDN 2020-07-12 17:12:04 +02:00
Nikita Karamov 39c89ccab8
v1.2.1 2020-07-12 17:08:46 +02:00
Nikita Karamov d0881b4c59
Optimize all icons to match one standard
Closes #8
2020-07-12 17:08:19 +02:00
Nikita Karamov 51b918ef94
Fix image proportions 2020-07-06 10:35:02 +02:00
Nikita Karamov 8f718f6571
New screenshot for README 2020-07-06 10:33:27 +02:00
Nikita Karamov f3a5d68138
Add Google Search Console verification [skip ci] 2020-07-04 23:18:06 +02:00
Nikita Karamov 51c0ab0b52
Pin JSDelivr version 2020-07-04 23:05:42 +02:00
Nikita Karamov 0ad5496466
Add new size to README 2020-07-04 23:02:35 +02:00
Nikita Karamov 723a0814f1
Fix website 2020-07-04 22:59:22 +02:00
Nikita Karamov 2fc7584fef
v1.2.0 2020-07-04 22:55:13 +02:00
Nikita Karamov 9a932f2fd8
Update README and docs to include new buttons 2020-07-04 22:53:53 +02:00
Nikita Karamov c6baa8f79e
Add Pocket button 2020-07-04 22:40:49 +02:00
Nikita Karamov 27d7826e51
Add Viber button 2020-07-04 22:31:43 +02:00
Nikita Karamov d4caf0c1f6
Add Reddit button 2020-07-04 22:24:26 +02:00
Nikita Karamov 58cc6dda84
Add LinkedIn 2020-07-04 22:11:16 +02:00
Nikita Karamov ed9b763ad2
Fix build config 2020-07-04 22:10:58 +02:00
Nikita Karamov 62bde9aef0
v1.1.5 2020-06-26 17:33:08 +02:00
Nikita Karamov 28183e70ac
Fix dev build bug 2020-06-26 17:32:37 +02:00
Nikita Karamov 8fef814d0c
Update grammar in README and docs 2020-06-26 17:32:02 +02:00
Nikita Karamov ae0413558e
Update docs 2020-06-26 17:28:27 +02:00
Nikita Karamov 7a695a6567
Fix border on <button> hover 2020-06-26 17:26:43 +02:00
Nikita Karamov ab1ee0613a
Add ESM build 2020-06-26 17:17:49 +02:00
Nikita Karamov 78da7f7fb9
v1.1.4 2020-06-26 17:04:53 +02:00
Nikita Karamov 478970ff25
Rearrange entries in package.json 2020-06-26 17:04:15 +02:00
Nikita Karamov 54bf529b5c
Migrate to 'sass' 2020-06-26 16:53:54 +02:00
Nikita Karamov 93dc9d0b84
New Rollup configuration 2020-06-26 16:51:22 +02:00
Nikita Karamov c2bf29fff2
Reformat files 2020-06-26 15:51:34 +02:00
Nikita Karamov 05cd1d874e
Add 'dev' to .eslintignore 2020-06-26 15:46:41 +02:00
Nikita Karamov fe0a0f12a6
Update ESLint config 2020-06-26 15:45:37 +02:00
62 changed files with 3497 additions and 8381 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

View File

@ -1 +0,0 @@
dist

1
.eslintignore Symbolic link
View File

@ -0,0 +1 @@
./.gitignore

View File

@ -1,6 +0,0 @@
module.exports = {
extends: ['airbnb-typescript/base'],
parserOptions: {
project: './tsconfig.json',
},
};

1
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1 @@
d95105353f659f1dfc16aa00e97dde9a18406be4

5
.github/FUNDING.yml vendored
View File

@ -1,2 +1,3 @@
patreon: NickKaramoff
liberapay: NickKaramoff
github: kytta
liberapay: kytta
custom: paypal.me/NickKaramoff

36
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: Publish
on:
release:
types:
- published
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: pnpm
- name: Install dependencies
run: pnpm install --ignore-scripts
- name: Build
run: pnpm run build
- name: Publish to NPM (with provenance)
run: pnpm publish --no-git-checks --access public --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"

31
.github/workflows/size.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Size Limit
on:
pull_request:
branches:
- main
permissions:
pull-requests: write
jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v4
- name: Fetch Git refs
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Check package size
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

33
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
FORCE_COLOR: 2
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --ignore-scripts
# pre-commit dioes this for us
# - name: Lint
# run: pnpm run lint
- name: Build
run: pnpm run build

12
.gitignore vendored
View File

@ -1,5 +1,7 @@
dev
dist
.idea
node_modules
yarn-error.log
dev/
dist/
.idea/
node_modules/
.vscode/
package-lock.json
yarn.lock

35
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
exclude: 'src/icons/.*\.svg'
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: check-json
- id: check-toml
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
additional_dependencies:
- prettier@3
- repo: https://github.com/pre-commit/mirrors-eslint
rev: "v9.0.0-alpha.2"
hooks:
- id: eslint
files: \.([jt]s|astro)$ # *.js, *.ts and *.astro
types: [file]
additional_dependencies:
- eslint@8
- eslint-config-prettier@9
- eslint-plugin-unicorn@49
- prettier@3
- repo: https://github.com/kytta/mirrors-svgo
rev: v3.2.0
hooks:
- id: svgo
files: "^src/icons/"

2
.prettierignore Normal file
View File

@ -0,0 +1,2 @@
dist/
pnpm-lock.yaml

View File

@ -1,9 +0,0 @@
language: node_js
node_js:
- node
- lts/erbium
- lts/dubnium
cache: yarn
install: yarn
script: yarn test

386
CHANGELOG.md Normal file
View File

@ -0,0 +1,386 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.5.0] - 2024-02-04
### Added
- [#108](https://github.com/kytta/shareon/pull/108)
Fediverse button (via [Share₂Fedi](https://github.com/kytta/share2fedi))
## [2.4.0] - 2023-12-07
### Added
- [#99](https://github.com/kytta/shareon/pull/99)
Email button
- [#100](https://github.com/kytta/shareon/pull/100)
Print button
### Behind-the-scenes
- [#95](https://github.com/kytta/shareon/pull/95)
Update to Vite v5
- [#101](https://github.com/kytta/shareon/pull/101)
Enable automatic package publishing
## [2.3.0] - 2023-08-01
### Added
- [#80](https://github.com/kytta/shareon/pull/80):
Tumblr button by [Isaac](https://github.com/kabszac)
### Behind-the-scenes
- [#82](https://github.com/kytta/shareon/pull/82):
PNPM is now enforced by [Anderson](https://github.com/andersonjoseph)
## [2.2.3] - 2023-07-19
### Fixed
- v2.2.2 was published with the bug not fixed.
## [2.2.2] - 2023-07-15
### Fixed
- [#71](https://github.com/kytta/shareon/pull/71):
Web Share icon got minified incorrectly, causing it to not show up at all.
Fixed by Jake.
## [2.2.1] - 2023-07-15
### Behind-the-scenes
- [#70](https://github.com/kytta/shareon/pull/70):
Icon minification and inlining happens automatically now. As a bonus, the CSS
size went a bit down :)
## [2.2.0] - 2023-07-15
### Added
- `data-hashtags` for Facebook and Twitter by Edward in https://github.com/kytta/shareon/pull/60
- Microsoft Teams button by Dimitrios in https://github.com/kytta/shareon/pull/66
- Web Share API button by Dimitrios in https://github.com/kytta/shareon/pull/67
### Changed
- the advertized bundle size now uses Brotli for compression (https://github.com/kytta/shareon/pull/69)
## [2.1.0] - 2023-03-20
### Added
- "Copy URL" button in https://github.com/kytta/shareon/pull/44
### Behind-the-scenes
- Added pre-commit hooks in https://github.com/kytta/shareon/pull/47
- Fixed `size-limit-action` branch in https://github.com/kytta/shareon/pull/48
## [2.0.2] - 2023-01-25
### Changed
- Sourcemaps are not being output any more
- They're being loaded automatically and don't serve any other purpose.
Disabling those helps us save a few bytes
- Change minifier to esbuild (instead of terser)
- This disables the minification of ESM, which is a good thing, because
otherwise the file can't be tree-shaken properly
- Shareon is now `type: "module"`
- This doesn't change anything for the end users
- Banner was removed
- It took unnecessary bytes, and embedding it was somewhat buggy
- Browserslist config now targets `defaults`
- Opera 90 and Samsung Browser 17 aren't targeted. Shareon will still work on
these browsers.
- the previous config (using `last 3 versions instead` of `last 2 versions`)
didn't change coverage that much
### Behind-the-scenes
- Updated to Vite v4
- CSS is now bundled using Vite
- this makes the build script leaner; it's still processed with PostCSS
- Moved PostCSS and ESLint config to package.json
## [2.0.1] - 2023-01-23
### Changed
- Mastodon button updated to match the new style (#42)
## [2.0.0] - 2021-02-13
### Added
- **BREAKING:** new (auto-)init behaviour, inspired by [petite-vue](https://github.com/vuejs/petite-vue)
- `require`, `import`, or use `<script>` to include Shareon without
initialization
- use exported `initializeShareon` function in Node to initialize Shareon
- use `init` attribute in `script` to initialize Shareon in-browser
```html
<script src="path/to/shareon.js" init>
```
- CSS export for use in Webpack/Rollup/etc. ([#35](https://github.com/kytta/shareon/issues/35))
```js
import "shareon/css";
```
```js
require("shareon/css");
```
### Changed
- **BREAKING:** default version of the package doesn't auto-initialize buttons
- **BREAKING:** instead of default export, named exports are now used. If IIFE
is used, the global object's name is now `Shareon`, and it has one `init()`
method
- updated logos and colours for some social networks
- removed mixins, defining the code/styles directly in the files
- use [Vite](https://vitejs.dev/) for building, reducing the devDependencies
tree and build times drastically
- **BREAKING:** newly built files offer worse browser support
- change code style to [Prettier](https://prettier.io/)
### Removed
- **BREAKING:** `noinit` version of the package is removed
## [1.6.3] - 2022-02-02
### Changed
- update URL for the [toot](https://github.com/kytta/toot) instance
- update URLs and usernames in metadata
- update dev dependencies
- migrate to PNPM
## [1.6.2] - 2021-06-29
### Security
- updated build dependencies
## [1.6.1] - 2021-01-17
### Added
- Add CHANGELOG as file
### Fixed
- Fix LinkedIn URL
## [1.6.0] - 2020-09-28
### Changed
- Add parameter for App ID for Messenger button (#17, #29)
- now you **have to** include `data-fb-app-id` to your Messenger buttons
## [1.5.0] - 2020-09-24
### Added
- Add Mastodon button (#23, #27)
## [1.4.5] - 2020-09-22
> Version 1.4.3 was skipped due to an error in the deployment process
> Version 1.4.4 is deprecated due to non-minified build files
### Fixed
- Fix transpilation for legacy browsers (#19, #21)
- Fix `<button>`s not behaving correctly if there are `<a>`s further on the page
- Fix PostCSS not applying any plugins (#22)
## [1.4.2] - 2020-09-18
### Fixed
- Fix WhatsApp button on desktop (#18, #20)
## [1.4.1] - 2020-08-01
### Changed
- move codebase from TypeScript to JavaScript+JSDoc
- replace Sass with CSS+PostCSS
## [1.4.0] - 2020-07-30
### Changed
- Optimise code
- package size got reduced down to 937 kb (.min.js) / 840 kb (.cjs/.mjs)
- `for` loops were optimised to cut down execution time
## [1.3.1] - 2020-07-30
### Fixed
- Fix documentation
## [1.3.0] - 2020-07-26
### Added
- Add `init()` function to shareon (#11, #13)
- this allows not only to postpone the initialization of shareon but also to re-run it
## [1.2.1] - 2020-07-12
### Changed
- Optimize icon SVG files to match one standard (#8)
## [1.2.0] - 2020-07-04
### Added
- Add LinkedIn button (#5)
- Add Pocket button
- Add Reddit button
- Add Viber button
## [1.1.5] - 2020-06-26
### Added
- Add building to ESM
### Changed
- Update README and docs
### Fixed
- Fix unwanted border on `<button>` hover
## [1.1.4] - 2020-06-26
### Changed
- Rearrange fields in package.json
- Change `node-sass` to `sass`
- Update Rollup config
- Update ESLint config
## [1.1.3] - 2020-06-25
### Changed
- Update dependencies
## [1.1.2] - 2020-03-30
### Changed
- Shorten the banner in JS and CSS files
### Fixed
- Fix inconsistent spacing between buttons
## [1.1.1] - 2020-03-27
### Fixed
- Fix incorrect spacing between button rows when wrapped
## [1.1.0] - 2020-03-27
### Added
- Add Odnoklassniki button
- Add VK button
## [1.0.0] - 2020-03-26
### Added
- Add install instructions to README
- Add usage instructions to README
## [1.0.0-beta.3] - 2020-03-26
### Added
- Add Facebook button
- Add Messenger button
- Add Pinterest button
- Add WhatsApp button
### Changed
- Update colour of Telegram button
- Rename `shareon.css` to `shareon.min.css`
### Removed
- Remove building to ESM
## [1.0.0-beta.2] - 2020-03-26
### Fixed
- Fix package files not being published to NPM
## [1.0.0-beta.1] - 2020-03-26
Initial release of shareon
### Added
- Add Telegram button
- Add Twitter button
[unreleased]: https://github.com/kytta/shareon/compare/v2.5.0...main
[2.4.0]: https://github.com/kytta/shareon/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/kytta/shareon/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/kytta/shareon/compare/v2.2.3...v2.3.0
[2.2.3]: https://github.com/kytta/shareon/compare/v2.2.2...v2.2.3
[2.2.2]: https://github.com/kytta/shareon/compare/v2.2.1...v2.2.2
[2.2.1]: https://github.com/kytta/shareon/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/kytta/shareon/compare/v2.1.0...v2.2.0
[2.1.0]: https://github.com/kytta/shareon/compare/v2.0.2...v2.1.0
[2.0.2]: https://github.com/kytta/shareon/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/kytta/shareon/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/kytta/shareon/compare/v1.6.3...v2.0.0
[1.6.3]: https://github.com/kytta/shareon/compare/v1.6.2...v1.6.3
[1.6.2]: https://github.com/kytta/shareon/compare/v1.6.1...v1.6.2
[1.6.1]: https://github.com/kytta/shareon/compare/v1.6.0...v1.6.1
[1.6.0]: https://github.com/kytta/shareon/compare/v1.5.0...v1.6.0
[1.5.0]: https://github.com/kytta/shareon/compare/v1.4.5...v1.5.0
[1.4.5]: https://github.com/kytta/shareon/compare/v1.4.2...v1.4.5
[1.4.2]: https://github.com/kytta/shareon/compare/v1.4.1...v1.4.2
[1.4.1]: https://github.com/kytta/shareon/compare/v1.4.0...v1.4.1
[1.4.0]: https://github.com/kytta/shareon/compare/v1.3.1...v1.4.0
[1.3.1]: https://github.com/kytta/shareon/compare/v1.3.0...v1.3.1
[1.3.0]: https://github.com/kytta/shareon/compare/v1.2.1...v1.3.0
[1.2.1]: https://github.com/kytta/shareon/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/kytta/shareon/compare/v1.1.5...v1.2.0
[1.1.5]: https://github.com/kytta/shareon/compare/v1.1.4...v1.1.5
[1.1.4]: https://github.com/kytta/shareon/compare/v1.1.3...v1.1.4
[1.1.3]: https://github.com/kytta/shareon/compare/v1.1.2...v1.1.3
[1.1.2]: https://github.com/kytta/shareon/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com/kytta/shareon/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/kytta/shareon/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/kytta/shareon/compare/v1.0.0-beta.3...v1.0.0
[1.0.0-beta.3]: https://github.com/kytta/shareon/compare/v1.0.0-beta.2...v1.0.0-beta.3
[1.0.0-beta.2]: https://github.com/kytta/shareon/compare/v1.0.0-beta.1...v1.0.0-beta.2
[1.0.0-beta.1]: https://github.com/kytta/shareon/compare/3722ada1da60abb768e00621e66b269f8fa60689...v1.0.0-beta.1

117
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,117 @@
# Contributing to Shareon
Shareon welcomes contributions and corrections. Before contributing, please make sure you have read the guidelines below. If you decide to contribute anything, please follow the steps below.
0. Install [pnpm](https://pnpm.io/installation):
1. Install [pre-commit](https://pre-commit.com/)
2. Fork this repository
3. Clone the fork
4. Enable pre-commit in the repo:
```sh
pre-commit install
```
5. Create a new branch from the latest commit on `main`
6. Start hacking on the new branch
7. Commit and push to the new branch
8. Make a pull request to `main`
## Table of contents
- [Requesting a button](#requesting-a-button)
- [Adding or updating a button](#adding-or-updating-a-button)
- [Testing Package Locally](#testing-package-locally)
## Requesting a button
We welcome requests for new buttons. Before you submit a new issue, make sure:
- No one has requested the button before. If you find an existing issue or pull request, add a reaction to show your support.
- The website in question has a share page. Usually, such websites offer their own 'Share' buttons.
- The website is not illegal (e.g. piracy, malware, threatening material, spam, etc.)
If you have additional information, such as the address of the Share page, links to the documentation or to other implementations, put it in the issue description.
## Adding or updating a button
**Note**: If you decide to add a new button without requesting it first, the requirements above still apply.
### 1. Identify share page address
If a website has its own 'Share' button, it will also usually have some documentation for it. This might be the SDK docs or the button constructor. In some cases, there is nothing of sorts, and one has to reverse-engineer this.
Most websites use a fixed share page that expects URL parameters to contain metadata like URL, page title, and/or post text. For example, the Twitter share page has the base URL `https://twitter.com/intent/tweet` and can accept URL parameters `url`, `text`, `via`, and `hashtags`.
### 2. Add JavaScript code for the button
For the button to work, it needs an entry in the `urlBuilderMap`. It's located on top of `src/shareon.js`.
The key of the map is the ID of the website, which is usually its name. It should be all lowercase and only include dashes. Try to keep it as short as possible, e.g. `teams` instead of `microsoft-teams`.
The value of the map is a function that accepts a "preset" (aka "page data") object. This object contains data about the page or of the post, such as url, title, media, text, via, hashtags, and Facebook app ID, all URL-encoded. The function should return a complete Share URL.
> **Note** This is subject to change in Shareon v3, where we plan to migrate to a `URL` builder. See [issue #61 on GitHub](https://github.com/kytta/shareon/issues/61) for information.
Once you;ve added the entry, the button is ready to go. If the button accepts properties that are not defined in the "preset", let us know before implementing it.
### 3. Add the icon
We heavily rely on icons from the [Simple Icons](https://github.com/simple-icons/simple-icons) project. As such, the requirements for the icons are similar.
- The icon MUST be SVG
- The name the icon MUST match the `urlBuilderMap` key
- The icon MUST have a `viewBox` of `0 0 24 24` and have no dimensions
- The icon must have the maximal size possible, i.e. the icon should be touching at least two sides of the viewbox
- The icon MUST be all white, either via the `fill` or via the `stroke` attribute
The easiest path for you to go is to just find the icon on Simple Icons and download it to `src/icons/`. They already meet all requirements. You do have to change the colour from `currentColor` to `#fff`, though.
If the website does not have its icon on Simple Icons, follow [their contributing guide](https://github.com/simple-icons/simple-icons/blob/develop/CONTRIBUTING.md) to request and/or add it. We will assist you in this task, if needed.
### 4. Optimize the icon
All icons for Shareon should be optimized with the [SVGO tool](https://github.com/svg/svgo). The pre-commit hook you've installed does it automatically before commiting. Alternatively, you can run SVGO on the icon you've just added like so:
```bash
npx svgo src/icons/ICONNAME.svg
```
After optimizing the icon, double-check it against your original version to ensure no visual imperfections have crept in.
### 5. Add styles
In `src/shareon.css`, add two lines for the icon: one for the colour and one for the icon. The class of the button MUST match the `urlBuilderMap` key and the icon name. The colour should be the official website colour, preferably taken from Simple Icons. The icon should be referenced using the local path, it will be inlined on build. Example:
```css
.shareon > .pinterest {
background-color: #bd081c; /* Official colour, as taken from Simple Icons */
}
.shareon > .pinterest:before {
background-image: url("icons/pinterest.svg"); /* Icon taken Simple Icons and optimized with SVGO */
}
```
### 6. Test the icon
Open `index.html` in the repository root and add the icon to the list of all buttons. Then, launch the dev server:
```sh
pnpm dev --open
```
The final button should:
- Have a proper icon. It should:
- be white
- be vertically and horizontally centered
- Open the share page on click
- Fill out the data on the share page
### 7. Update docs
Update `README.md` to include the new button in the code snippets. If the button supports non-standard (not just `url` or `title`) `data-` attributes, mention it in 'Share metadata'
### 8. Create a Pull Request
Once you've completed the previous steps, create a pull request to merge your edits into the `main` branch. You can run `pnpm lint` to check if there are any issues you still need to address. If there are any, run `pre-commit`, and it will fix most of them.

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020 Nikita Karamov
Copyright (c) 2020-2022 Nikita Karamov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.

206
README.md
View File

@ -1,89 +1,197 @@
# shareon
# Shareon
<img src="https://raw.githubusercontent.com/googlefonts/noto-emoji/master/png/128/emoji_u1f4ef.png" align="right" alt="Postal Horn emoji" width="96" height="96">
<img src="./assets/logo.svg" align="right" alt="Shareon logo — the Postal Horn emoji" width="96" height="96">
Lightweight, stylish and ethical share buttons.
> Lightweight, stylish, and ethical share buttons
- **Small.** Dependency-free. CSS+JS bundle is only 3.15 KB minified and gzipped.
- **Stylish.** Uses official vector logos and colors with no visual mess.
- **Ethical.** No tracking code is being embedded. JS is used for quick setup only.
- **Small.** Dependency-free. CSS+JS bundle is only 6 KB minified and brotlied.
- **Stylish.** Uses official vector logos and colours with no visual mess.
- **Ethical.** Embeds no tracking code. JS is required only for the setup.
<img src="https://raw.githubusercontent.com/NickKaramoff/shareon/master/docs/screen01@2x.png" height="100" width="570" alt="shareon example">
<a href="https://shareon.js.org/"><img src="./assets/demo@2x.png" height="126" width="333" alt="Shareon demo screenshot"></a>
----
Observe the live demo here: [shareon.js.org](https://shareon.js.org)
See the live demo at [shareon.js.org](https://shareon.js.org)
## Install
Include the link to shareon's JS and CSS in your website:
Simply load the needed files from the CDN:
```html
<link href="https://cdn.jsdelivr.net/npm/shareon@1/dist/shareon.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/shareon@1/dist/shareon.min.js" type="text/javascript"></script>
<link
href="https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.min.css"
rel="stylesheet"
/>
<script
src="https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.iife.js"
defer
init
></script>
```
or install it via NPM use it in a JS file that you will bundle:
- `defer` makes sure Shareon is loaded after HTML is parsed
- `init` will automatically initialize Shareon buttons
### Do not auto-initialize
Remove the `init` attribute and initialize Shareon when you need it:
```html
<script
src="https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.iife.js"
defer
></script>
<script>
// do something
Shareon.init();
</script>
```
### Use ESM build
There is also a ESM build for the browsers, which doesn't support
auto-initialization:
```html
<script type="module">
import { init } from "https://cdn.jsdelivr.net/npm/shareon@2/dist/shareon.es.js";
// do something
init();
</script>
```
### Bundle with Node
You can also install Shareon using your favourite package manager and include it
in your source files:
```sh
npm install shareon
# or
yarn add shareon
pnpm add shareon # or `npm install`, or `yarn add`
```
```js
require('shareon');
import { init } from "shareon";
import "shareon/css"; // most bundlers will transpile this CSS
init();
```
CommonJS imports are also supported:
```js
const Shareon = require("shareon");
require("shareon/css"); // most bundlers will transpile this CSS
Shareon.init();
```
## Usage
> shareon was heavily inspired by [Likely](https://ilyabirman.net/projects/likely/),
and has a backwards-compatible API (excluding themes and sizes).
Create a container with class `shareon` and populate it with elements, whose
classes match the names of social networks:
Create a container with class `shareon` and populate it with elements, class
names of which match the names of the social networks (or `copy-url`, for the
'Copy URL' button, or `print` for the 'Print' button):
```html
<div class="shareon">
<a class="facebook"></a>
<a class="messenger"></a>
<a class="odnoklassniki"></a>
<a class="pinterest"></a>
<a class="telegram"></a>
<a class="twitter"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
<a class="facebook"></a>
<a class="fediverse"></a>
<a class="linkedin"></a>
<a class="mastodon"></a>
<!-- FB App ID is required for the Messenger button to function -->
<a class="messenger" data-fb-app-id="0123456789012345"></a>
<a class="odnoklassniki"></a>
<a class="pinterest"></a>
<a class="pocket"></a>
<a class="reddit"></a>
<a class="teams"></a>
<a class="telegram"></a>
<a class="tumblr"></a>
<a class="twitter"></a>
<a class="viber"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
<a class="copy-url"></a>
<a class="email"></a>
<a class="print"></a>
</div>
```
If you use `<a>`, the buttons will get a `href`-attribute to them. In other cases
they will get a listener on `click` event, so you can use `<button>`s if you wish.
Shareon will populate these `<a>` elements with correct `href` attributes.
By default the URL and the title of the page will be used in sharing dialogs.
To change this, you can use the `data-url` and `data-title` attributes. Use them
on the whole container or on the specific buttons:
### Use with `<button>`s
You can use `<button>` (or any other element) instead of `<a>`s. In this case,
Shareon will create an `onclick`-listener for each button. **I do not recommend
doing this**, as this is not so good for semantics.
### Share metadata
By default, the URL and the title of the active page will be shared. You can
customize it with `data-` attributes. These can be applied on a specific button
or on the whole `.shareon` container:
```html
<div class="shareon" data-url="https://example.com">
<a class="facebook" data-title="Custom Facebook title"></a>
<a class="twitter" data-title="Custom Twitter title"></a>
<div class="shareon" data-url="https://custom.url/for-this-page">
<a class="facebook" data-title="Custom Facebook title"></a>
<a class="twitter" data-title="Custom Twitter title"></a>
</div>
```
Apart from the URL and title, some networks support extra parameters:
- add `data-media` to an Odnoklassniki, Pinterest or VK button to customize the pinned picture
- add `data-text` to a WhatsApp or Telegram button to add custom message text
- add `data-via` to a Twitter button to mention a user
- you **MUST** add `data-fb-app-id` to the FB Messenger button to make sharing
even possible
- add `data-s2f-instance` to the Fediverse button to set your Share₂Fedi
instance
- add `data-media` to an Odnoklassniki, Pinterest, or VK button to customize
the pinned picture
- add `data-text` to a Mastodon, Telegram, Tumblr, Viber, or WhatsApp button to add
custom message text
- add `data-via` to a Mastodon, Tumblr, or Twitter button to mention a user
- add `data-hashtags` to a Facebook, Tumblr, or Twitter button to include hashtags in the shared post.
- should be a comma-separated string, for example `stuff,tech,buttons`
- Twitter & Tumblr support multiple hashtags
- Facebook only supports a single hashtag; only the first one will be used
Here are all the custom parameters in their glory:
Here are all custom parameters:
```html
<div class="shareon" data-url="https://example.com/custom-url">
<a class="facebook" data-title="Custom Facebook title"></a>
<a class="messenger" data-url="https://my-cool-website.com"></a>
<a class="pinterest" data-media="https://picsum.photos/500">Pin</a>
<a class="telegram" data-text="Check this out!"></a>
<a class="twitter" data-via="MyNickname"></a>
<a class="whatsapp">Send</a>
<div class="shareon" data-url="https://custom.url/for-this-page">
<a class="facebook" data-title="Custom Facebook title" data-hashtags="awesome"></a>
<a class="fediverse" data-s2f-instance="s2f.mydomain.example"></a>
<a class="messenger" data-fb-app-id="0123456789012345"></a>
<a class="pinterest" data-media="https://custom.picture/for-pinterest">Pin</a>
<a class="telegram" data-text="Check this out!"></a>
<a class="tumblr" data-hashtags="nice,buttons" data-text="These are some nice buttons" data-via="myblog"></a>
<a class="twitter" data-via="MyNickname" data-hashtags="shareon,awesome,brilliant"></a>
<a class="mastodon" data-via="@MyNickname@myserver.social"></a>
<a class="whatsapp" data-url="https://custom.url/for-whatsapp">Send</a>
</div>
```
## Other versions
- [**WordPress plugin**](https://wordpress.org/plugins/shareon/) by [Gareth](https://github.com/gareth-gillman)
## Licence
Copyright © 20202022 [Nikita Karamov](https://www.kytta.dev/)
Licenced under the [MIT License](https://spdx.org/licenses/MIT.html).
Shareon was heavily inspired by [Likely](https://ilyabirman.net/likely/),
and has a somewhat backwards-compatible API (excluding themes and sizes).
Likely is licenced under the MIT License.
Shareon's logo is the
[Postal Horn emoji](https://github.com/googlefonts/noto-emoji/blob/43f47be9404018cd9d8f73a227363a8f20acdab5/svg/emoji_u1f4ef.svg)
from [Noto Emoji](https://github.com/googlefonts/noto-emoji).
Noto Emoji is licenced under the
[Apache License v2.0](https://github.com/googlefonts/noto-emoji/blob/43f47be9404018cd9d8f73a227363a8f20acdab5/LICENSE).
Share icons are being sourced from [Simple Icons](https://github.com/simple-icons/simple-icons/).
Simple Icons is released under [CC0](https://spdx.org/licenses/CC0-1.0.html),
but the icons themselves may be subject to copyright of the respective owners.
---
This project is hosted on GitHub: <https://github.com/kytta/shareon>

BIN
assets/demo@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

1
assets/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -1 +0,0 @@
shareon.js.org

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,218 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Lightweight, stylish and ethical share buttons for popular social networks">
<meta name="keywords" content="share buttons, sharing, social networks, share via, share on">
<meta name="author" content="Nikita Karamov">
<meta property="og:title" content="shareon">
<meta property="og:url" content="https://shareon.js.org">
<meta property="og:image" content="https://raw.githubusercontent.com/NickKaramoff/shareon/develop/docs/banner.png">
<meta property="og:description" content="Lightweight, stylish and ethical share buttons for popular social networks">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:creator" content="@NickKaramoff">
<title>shareon</title>
<style>
.shareon > a:hover {
color: #fff;
}
</style>
<link rel="stylesheet" href="https://igoradamenko.github.io/awsm.css/css/awsm.min.css">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
</head>
<body>
<header>
<p>
<img src="https://raw.githubusercontent.com/googlefonts/noto-emoji/master/png/128/emoji_u1f4ef.png"
alt="Postal Horn emoji"
width="64"
height="64">
</p>
<h1>shareon</h1>
<p>Lightweight, stylish and ethical share buttons</p>
<nav>
<ul>
<li>
<a href="https://www.npmjs.com/package/shareon" target="_blank">npm</a>
</li>
<li>
<a href="https://github.com/NickKaramoff/shareon" target="_blank">github</a>
</li>
</ul>
</nav>
</header>
<main>
<article>
<h2>
<a id="what-is-it" href="#what-is-it" aria-hidden="true"></a>
What is it?
</h2>
<p>
<code>shareon</code> are share buttons for popular social networks.
</p>
<div class="shareon" data-title="shareon — lightweight, stylish and ethical share buttons"
style="text-align: center">
<a class="facebook"></a>
<a class="messenger"></a>
<a class="odnoklassniki"></a>
<a class="pinterest"></a>
<a class="telegram"></a>
<a class="twitter"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
</div>
<p>
Unlike many other share buttons, <code>shareon</code> are:
</p>
<ul>
<li><b>lightweight</b>, clocking in at only 3.15 KB gzipped code (JS+CSS)</li>
<li><b>stylish</b>, by having no visual features other than official colors and logos</li>
<li><b>ethical</b>, since they do not insert any pesky tracking code</li>
</ul>
<p>
The whole JavaScript code is quick and simple: it only populates the buttons with set up links. The
speed
and easy customization make <code>shareon</code> the perfect choice for your blog, news site or project
page!
</p>
</article>
<article>
<h2>
<a id="install" href="#install" aria-hidden="true"></a>
Install
</h2>
<p>
Include the link to shareon's JS and CSS in your website:
</p>
<pre><code>&lt;link href="https://cdn.jsdelivr.net/npm/shareon@1/dist/shareon.min.css"
rel="stylesheet"&gt;
&lt;script src="https://cdn.jsdelivr.net/npm/shareon@1/dist/shareon.min.js"
type="text/javascript"&gt;&lt;/script&gt;</code></pre>
<p>or install it via NPM use it in a JS file that you will later bundle:</p>
<pre><code>require('shareon');</code></pre>
</article>
<article>
<h2>
<a id="usage" href="#usage" aria-hidden="true"></a>
Usage
</h2>
<aside>
<p>
<code>shareon</code> was heavily inspired by
<a href="https://ilyabirman.net/projects/likely/">Likely</a>,
and has a backwards-compatible API
</p>
</aside>
<p>
Create a container with class <code>shareon</code> and populate it with elements, whose classes match
the
names of social networks:
</p>
<pre><code>&lt;div class="shareon"&gt;
&lt;a class="facebook"&gt;&lt;/a&gt;
&lt;a class="messenger"&gt;&lt;/a&gt;
&lt;a class="odnoklassniki"&gt;&lt;/a&gt;
&lt;a class="pinterest"&gt;&lt;/a&gt;
&lt;a class="telegram"&gt;&lt;/a&gt;
&lt;a class="twitter"&gt;&lt;/a&gt;
&lt;a class="vkontakte"&gt;&lt;/a&gt;
&lt;a class="whatsapp"&gt;&lt;/a&gt;
&lt;/div&gt;</code></pre>
<div class="shareon">
<a class="facebook"></a>
<a class="messenger"></a>
<a class="odnoklassniki"></a>
<a class="pinterest"></a>
<a class="telegram"></a>
<a class="twitter"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
</div>
<p>
If you use <code>&lt;a&gt;</code>, the buttons will get a `href`-attribute to them. In other cases they
will get a listener on <code>click</code> event, so you can use <code>&lt;button&gt;</code>s if you
wish.
</p>
<p>
By default the URL and the title of the page will be used in sharing dialogs. To change this, you can
use
the <code>data-url</code> and <code>data-title</code> attributes. Use them on the whole container or on
the specific buttons:
</p>
<pre><code>&lt;div class="shareon" data-url="https://example.com"&gt;
&lt;a class="whatsapp" data-title="Custom WhatsApp title"&gt;&lt;/a&gt;
&lt;a class="twitter" data-title="Custom Twitter title"&gt;&lt;/a&gt;
&lt;/div&gt;</code></pre>
<div class="shareon" data-url="https://example.com">
<a class="whatsapp" data-title="Custom WhatsApp title"></a>
<a class="twitter" data-title="Custom Twitter title"></a>
</div>
<p>
Apart from the URL and title, some networks support extra parameters:
</p>
<ul>
<li>add <code>data-media</code> to an Odnoklassniki, Pinterest or VK button to customize the pinned picture</li>
<li>add <code>data-text</code> to a WhatsApp or Telegram button to add custom message text</li>
<li>add <code>data-via</code> to a Twitter button to mention a user</li>
</ul>
<p>
Here are all the custom parameters in their glory:
</p>
<pre><code>&lt;div class="shareon" data-url="https://example.com/custom-url"&gt;
&lt;a class="facebook" data-title="Custom Facebook title"&gt;&lt;/a&gt;
&lt;a class="messenger" data-url="https://my-cool-website.com"&gt;&lt;/a&gt;
&lt;a class="pinterest" data-media="https://picsum.photos/500"&gt;Pin&lt;/a&gt;
&lt;a class="telegram" data-text="Check this out!"&gt;&lt;/a&gt;
&lt;a class="twitter" data-via="MyNickname"&gt;&lt;/a&gt;
&lt;a class="whatsapp"&gt;Send&lt;/a&gt;
&lt;/div></code></pre>
<div class="shareon" data-url="https://example.com/custom-url">
<a class="facebook" data-title="Custom Facebook title"></a>
<a class="messenger" data-url="https://my-cool-website.com"></a>
<a class="pinterest" data-media="https://picsum.photos/500">Pin</a>
<a class="telegram" data-text="Check this out!"></a>
<a class="twitter" data-via="MyNickname"></a>
<a class="whatsapp">Send</a>
</div>
</article>
</main>
<footer>
<p>by <a href="https://karamoff.dev" target="_blank">Nikita Karamov</a></p>
<p>Website built with <a href="https://igoradamenko.github.io/awsm.css/index.html" target="_blank">awsm.css</a>
</p>
</footer>
<link rel="stylesheet" href="../dist/shareon.min.css">
<script src="../dist/shareon.min.js"></script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

141
index.html Normal file
View File

@ -0,0 +1,141 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shareon Demo Page</title>
<style>
body {
max-width: 800px;
margin: 0 auto;
font-family: sans-serif;
}
code {
font-family: monospace;
font-size: 1em;
}
.shareon.specimen {
font-weight: 600;
}
</style>
</head>
<body>
<main>
<h1>Shareon Demo Page</h1>
<section>
<h2><code>&lt;a&gt;</code></h2>
<div class="shareon">
<a class="facebook"></a>
<a class="fediverse"></a>
<a class="linkedin"></a>
<a class="mastodon"></a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
<a class="odnoklassniki"></a>
<a class="pinterest"></a>
<a class="pocket"></a>
<a class="reddit"></a>
<a class="teams"></a>
<a class="telegram"></a>
<a class="tumblr"></a>
<a class="twitter"></a>
<a class="viber"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
<a class="copy-url"></a>
<a class="email"></a>
<a class="print"></a>
<a class="web-share"></a>
</div>
</section>
<section>
<h2><code>&lt;button&gt;</code></h2>
<div class="shareon">
<button class="facebook"></button>
<button class="fediverse"></button>
<button class="linkedin"></button>
<button class="mastodon"></button>
<button class="messenger" data-fb-app-id="3619024578167617"></button>
<button class="odnoklassniki"></button>
<button class="pinterest"></button>
<button class="pocket"></button>
<button class="reddit"></button>
<button class="teams"></button>
<button class="telegram"></button>
<button class="tumblr"></button>
<button class="twitter"></button>
<button class="viber"></button>
<button class="vkontakte"></button>
<button class="whatsapp"></button>
<button class="copy-url"></button>
<button class="email"></button>
<button class="print"></button>
<button class="web-share"></button>
</div>
</section>
<section>
<h2><code>&lt;a&gt;</code> with custom params</h2>
<div
class="shareon"
data-title="shareon demo page test"
data-url="https://demo.shareon.js.org"
data-text="hey check this out"
>
<a class="facebook"></a>
<a class="fediverse" data-s2f-instance="share2fedi.vercel.app"></a>
<a class="linkedin"></a>
<a class="mastodon" data-via="@NickKaramoff@fosstodon.org"></a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
<a class="odnoklassniki"></a>
<a class="pinterest"></a>
<a class="pocket"></a>
<a class="reddit"></a>
<a class="teams"></a>
<a class="telegram"></a>
<a class="tumblr"></a>
<a class="twitter" data-via="nickkaramoff"></a>
<a class="viber"></a>
<a class="vkontakte"></a>
<a class="whatsapp"></a>
<a class="copy-url"></a>
<a class="email"></a>
<a class="web-share"></a>
</div>
</section>
<section>
<h2>Specimen</h2>
<div class="shareon specimen">
<a class="facebook"></a>
<a class="fediverse"></a>
<a class="linkedin"></a>
<a class="mastodon">Toot</a>
<a class="messenger" data-fb-app-id="3619024578167617"></a>
<a class="odnoklassniki"></a>
<a class="pinterest">Pin</a>
<br />
<a class="pocket"></a>
<a class="reddit"></a>
<a class="teams"></a>
<a class="telegram"></a>
<a class="tumblr"></a>
<a class="twitter">Tweet</a>
<a class="viber"></a>
<br />
<a class="vkontakte">Поделиться</a>
<a class="whatsapp"></a>
<a class="copy-url"></a>
<a class="email"></a>
<a class="web-share">Share</a>
</div>
</section>
</main>
<script type="module">
import { init } from "./src/shareon.js";
init();
</script>
</body>
</html>

View File

@ -1,79 +1,133 @@
{
"name": "shareon",
"version": "1.1.3",
"homepage": "https://shareon.js.org",
"repository": {
"type": "git",
"url": "git+https://github.com/NickKaramoff/shareon.git"
},
"bugs": {
"url": "https://github.com/NickKaramoff/shareon/issues"
},
"license": "MIT",
"author": "Nikita Karamov <nick@karamoff.dev>",
"version": "2.5.0",
"description": "Lightweight, stylish and ethical share buttons for popular social networks",
"license": "MIT",
"homepage": "https://shareon.js.org",
"keywords": [
"share buttons",
"sharing",
"social networks"
],
"files": [
"dist",
"LICENSE",
"README.md"
"repository": {
"type": "git",
"url": "https://github.com/kytta/shareon.git"
},
"bugs": {
"url": "https://github.com/kytta/shareon/issues"
},
"author": {
"name": "Nikita Karamov",
"email": "me@kytta.dev",
"url": "https://www.kytta.dev/"
},
"funding": [
"https://github.com/sponsors/kytta/",
"https://liberapay.com/kytta",
"https://www.paypal.com/paypalme/NickKaramoff"
],
"main": "./dist/shareon.cjs",
"type": "module",
"main": "./dist/shareon.umd.js",
"unpkg": "./dist/shareon.iife.js",
"jsdelivr": "./dist/shareon.iife.js",
"module": "./dist/shareon.es.js",
"exports": {
"require": "./dist/shareon.cjs"
".": {
"import": "./dist/shareon.es.js",
"require": "./dist/shareon.umd.js"
},
"./css": "./dist/shareon.min.css"
},
"unpkg": "./dist/shareon.min.js",
"files": [
"dist"
],
"scripts": {
"build": "rollup -c ./rollup/rollup.config.prod.js",
"dev": "rollup -w -c ./rollup/rollup.config.dev.js",
"pretest": "run-s build",
"test:lint": "eslint-ci --ext .js,.ts ./src/",
"test:size": "size-limit",
"test": "run-p test:*",
"postversion": "run-s build"
"build": "vite build",
"dev": "vite",
"lint": "prettier --check . && eslint .",
"size": "size-limit",
"test": "pnpm run lint && pnpm run build && pnpm run size",
"postversion": "pnpm run build",
"prepublishOnly": "rm -rf ./package && clean-publish",
"postpublish": "rm -rf ./package",
"preinstall": "npx only-allow pnpm"
},
"dependencies": {},
"devDependencies": {
"@rollup/plugin-strip": "^1.3.3",
"@rollup/plugin-typescript": "^5.0.0",
"@size-limit/preset-small-lib": "^4.5.2",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"cssnano": "^4.1.10",
"eslint": "^6.8.0",
"eslint-ci": "^1.0.0",
"eslint-config-airbnb-typescript": "^7.2.0",
"eslint-plugin-import": "^2.20.1",
"node-sass": "^4.13.1",
"np": "^6.2.4",
"npm-run-all": "^4.1.5",
"postcss-banner": "^3.0.2",
"rollup": "^2.18.0",
"rollup-plugin-license": "^2.1.0",
"rollup-plugin-postcss": "^3.1.2",
"rollup-plugin-terser": "^6.1.0",
"size-limit": "^4.5.2",
"typescript": "^3.8.3"
"@size-limit/preset-small-lib": "^11.0.1",
"autoprefixer": "^10.4.16",
"clean-publish": "^4.2.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-unicorn": "^49.0.0",
"postcss": "^8.4.32",
"postcss-calc": "^9.0.1",
"postcss-css-variables": "^0.19.0",
"postcss-csso": "^6.0.1",
"postcss-url": "^10.1.3",
"prettier": "^3.1.0",
"size-limit": "^11.0.1",
"vite": "^5.0.6"
},
"prettier": {
"embeddedLanguageFormatting": "off"
},
"eslintConfig": {
"env": {
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:unicorn/recommended",
"prettier"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"overrides": [
{
"files": [
"vite.config.js"
],
"env": {
"node": true,
"browser": false
}
}
]
},
"postcss": {
"plugins": {
"postcss-url": {
"url": "inline",
"optimizeSvgEncode": true
},
"postcss-css-variables": {},
"postcss-calc": {},
"autoprefixer": {},
"postcss-csso": {}
}
},
"size-limit": [
{
"limit": "1 KB",
"path": "./dist/shareon.min.js",
"webpack": false
},
{
"limit": "1 KB",
"path": [
"./dist/shareon.cjs"
]
},
{
"limit": "7 KB",
"limit": "6 KiB",
"path": "./dist/shareon.min.css",
"webpack": false
"brotli": true
},
{
"limit": "1 KiB",
"path": "./dist/shareon.es.js",
"brotli": true
}
]
],
"publishConfig": {
"directory": "package"
},
"clean-publish": {
"withoutPublish": true,
"tempDir": "package",
"fields": [
"postcss"
]
}
}

1905
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +0,0 @@
import path from 'path';
import postcssPluginBanner from 'postcss-banner';
import postcssPluginCssnano from 'cssnano';
import rollupPluginLicense from 'rollup-plugin-license';
import rollupPluginPostcss from 'rollup-plugin-postcss';
import rollupPluginStrip from '@rollup/plugin-strip';
import { terser as rollupPluginTerser } from 'rollup-plugin-terser';
import rollupPluginTypescript from '@rollup/plugin-typescript';
const pkg = require(path.join(process.cwd(), 'package.json'));
const bannerText = `${pkg.name} v${pkg.version} by Nikita Karamov
${pkg.homepage}`;
export const license = () => rollupPluginLicense({
banner: {
commentStyle: 'ignored',
content: bannerText
}
});
/**
* @param {boolean|string} file
* @param {boolean} minify
*/
export const postcss = (file = true, minify) => rollupPluginPostcss({
extract: file,
plugins: [
minify && postcssPluginCssnano({
preset: 'default',
}),
postcssPluginBanner({
banner: bannerText,
important: true
})
],
});
export const strip = () => rollupPluginStrip({
debugger: true,
include: ['**/*.js', '**/*.ts'],
functions: ['console.log', 'console.debug', 'assert.*'],
sourceMap: false,
});
export const terser = () => rollupPluginTerser({
output: {
comments: false,
ecma: 5,
},
});
export const typescript = () => rollupPluginTypescript();

View File

@ -1,19 +0,0 @@
import { postcss, typescript } from './plugins';
const input = './src/index.ts';
const name = 'shareon';
const outputDir = './dev/';
export default {
input,
output: {
name,
format: 'iife',
file: `${outputDir}${name}.js`,
},
plugins: [
typescript(),
postcss(`${name}.css`, false),
],
};

View File

@ -1,29 +0,0 @@
import { license, postcss, strip, terser, typescript } from './plugins';
const input = './src/index.ts';
const name = 'shareon';
const outputDir = './dist/';
export default {
input,
output: [
{
name,
format: 'cjs',
file: `${outputDir}${name}.cjs`,
},
{
name,
format: 'iife',
file: `${outputDir}${name}.min.js`,
plugins: [terser()],
},
],
plugins: [
typescript(),
strip(),
postcss(`${name}.min.css`, true),
license()
],
};

View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 6 9 17l-5-5"/></svg>

After

Width:  |  Height:  |  Size: 183 B

1
src/icons/copy-url.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>

After

Width:  |  Height:  |  Size: 287 B

1
src/icons/email.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect height="16" rx="2" width="20" x="2" y="4"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/></g></svg>

After

Width:  |  Height:  |  Size: 265 B

1
src/icons/facebook.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073"/></svg>

After

Width:  |  Height:  |  Size: 375 B

1
src/icons/fediverse.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5.239 8.64a2.43 2.43 0 0 1-1.041 1.036l5.714 5.736 1.377-.698zm7.537 7.566-1.378.698 2.895 2.907a2.43 2.43 0 0 1 1.041-1.037zm6.61-5.297-3.234 1.64.238 1.526 3.66-1.856a2.43 2.43 0 0 1-.663-1.31m-5.113 2.592-7.649 3.876a2.43 2.43 0 0 1 .664 1.31l7.223-3.66zm-2.46-9.549-3.69 7.205 1.089 1.094 3.908-7.628a2.43 2.43 0 0 1-1.307-.67m-4.65 9.078-1.87 3.65a2.44 2.44 0 0 1 1.307.67l1.652-3.226zm-2.998-3.34a2.44 2.44 0 0 1-1.216.255 3 3 0 0 1-.235-.025l1.092 6.983a2.44 2.44 0 0 1 1.216-.255q.118.007.234.025zm3.129 9.03a2.4 2.4 0 0 1 .025.49 2.4 2.4 0 0 1-.256.96l6.98 1.121a2.4 2.4 0 0 1-.025-.49 2.4 2.4 0 0 1 .257-.96zm12.78-6.476-3.222 6.29a2.43 2.43 0 0 1 1.307.671l3.222-6.29a2.43 2.43 0 0 1-1.307-.671M15.68 3.348a2.44 2.44 0 0 1-1.04 1.036l4.99 5.01a2.43 2.43 0 0 1 1.04-1.037zm-4.554-.731L4.818 5.813a2.43 2.43 0 0 1 .663 1.31l6.309-3.197a2.43 2.43 0 0 1-.664-1.31m3.502 1.774a2.44 2.44 0 0 1-1.236.264 3 3 0 0 1-.213-.022l.559 3.578 1.524.244zm-.565 5.9 1.32 8.46a2.43 2.43 0 0 1 1.199-.246q.128.007.254.028l-1.249-7.998zM5.486 7.15a2.4 2.4 0 0 1 .027.498 2.4 2.4 0 0 1-.253.953l3.58.575.704-1.374zm6.137.986L10.92 9.51l8.46 1.36a2.4 2.4 0 0 1-.024-.485 2.4 2.4 0 0 1 .26-.966zM13.645.015a2.212 2.212 0 1 0-.24 4.418 2.212 2.212 0 1 0 .24-4.418m8.261 8.293a2.212 2.212 0 1 0-.24 4.418 2.212 2.212 0 1 0 .24-4.418M16.57 18.725a2.212 2.212 0 1 0-.24 4.419 2.212 2.212 0 1 0 .24-4.419M5.01 16.871a2.212 2.212 0 1 0-.24 4.418 2.212 2.212 0 1 0 .24-4.418M3.204 5.307a2.212 2.212 0 1 0-.24 4.418 2.212 2.212 0 1 0 .24-4.418"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M23.722 23.72h-4.91v-7.692c0-1.834-.038-4.194-2.559-4.194-2.56 0-2.95 1.995-2.95 4.06v7.827H8.394V7.902h4.716v2.157h.063c.659-1.244 2.261-2.556 4.655-2.556 4.974 0 5.894 3.274 5.894 7.535v8.683ZM.388 7.902h4.923v15.819H.388zM2.85 5.738A2.85 2.85 0 0 1 0 2.886a2.851 2.851 0 1 1 2.85 2.852"/></svg>

After

Width:  |  Height:  |  Size: 378 B

1
src/icons/linkedin.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="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.433a2.06 2.06 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065m1.782 13.019H3.555V9h3.564zM22.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 0z"/></svg>

After

Width:  |  Height:  |  Size: 512 B

1
src/icons/mastodon.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="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.38q.398-.092.786-.213c.585-.184 1.27-.39 1.774-.753a.06.06 0 0 0 .023-.043v-1.809a.05.05 0 0 0-.02-.041.05.05 0 0 0-.046-.01 20.3 20.3 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.6 5.6 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-.422q.059-.011.11-.024c2.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.545m-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.102q0-1.965 1.011-3.12c.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.164q1.012 1.155 1.012 3.12z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

1
src/icons/messenger.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M.001 11.639C.001 4.949 5.241 0 12.001 0S24 4.95 24 11.639s-5.24 11.638-12 11.638c-1.21 0-2.38-.16-3.47-.46a.96.96 0 0 0-.64.05l-2.39 1.05a.96.96 0 0 1-1.35-.85l-.07-2.14a.97.97 0 0 0-.32-.68A11.39 11.389 0 0 1 .002 11.64zm8.32-2.19-3.52 5.6c-.35.53.32 1.139.82.75l3.79-2.87c.26-.2.6-.2.87 0l2.8 2.1c.84.63 2.04.4 2.6-.48l3.52-5.6c.35-.53-.32-1.13-.82-.75l-3.79 2.87c-.25.2-.6.2-.86 0l-2.8-2.1a1.8 1.8 0 0 0-2.61.48"/></svg>

After

Width:  |  Height:  |  Size: 505 B

View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0a6.2 6.2 0 0 0-6.194 6.195 6.2 6.2 0 0 0 6.195 6.192 6.2 6.2 0 0 0 6.193-6.192A6.2 6.2 0 0 0 12.001 0zm0 3.63a2.567 2.567 0 0 1 2.565 2.565 2.57 2.57 0 0 1-2.564 2.564 2.57 2.57 0 0 1-2.565-2.564 2.567 2.567 0 0 1 2.565-2.564zM6.807 12.6a1.814 1.814 0 0 0-.91 3.35 11.6 11.6 0 0 0 3.597 1.49l-3.462 3.463a1.815 1.815 0 0 0 2.567 2.566L12 20.066l3.405 3.403a1.813 1.813 0 0 0 2.564 0c.71-.709.71-1.858 0-2.566l-3.462-3.462a11.6 11.6 0 0 0 3.596-1.49 1.814 1.814 0 1 0-1.932-3.073 7.87 7.87 0 0 1-8.34 0c-.318-.2-.674-.29-1.024-.278"/></svg>

After

Width:  |  Height:  |  Size: 625 B

1
src/icons/pinterest.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="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.026z"/></svg>

After

Width:  |  Height:  |  Size: 877 B

1
src/icons/pocket.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m18.813 10.259-5.646 5.419a1.65 1.65 0 0 1-2.282 0l-5.646-5.419a1.645 1.645 0 0 1 2.276-2.376l4.511 4.322 4.517-4.322a1.643 1.643 0 0 1 2.326.049 1.64 1.64 0 0 1-.045 2.326zm5.083-7.546a2.16 2.16 0 0 0-2.041-1.436H2.179c-.9 0-1.717.564-2.037 1.405-.094.25-.142.511-.142.774v7.245l.084 1.441c.348 3.277 2.047 6.142 4.682 8.139q.069.053.143.105l.03.023a11.9 11.9 0 0 0 4.694 2.072c.786.158 1.591.24 2.389.24.739 0 1.481-.067 2.209-.204.088-.029.176-.045.264-.06.023 0 .049-.015.074-.029a12 12 0 0 0 4.508-2.025l.029-.031.135-.105c2.627-1.995 4.324-4.862 4.686-8.148L24 10.678V3.445c0-.251-.031-.5-.121-.742z"/></svg>

After

Width:  |  Height:  |  Size: 695 B

1
src/icons/print.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 9V2h12v7M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2M6 14h12v8H6z"/></svg>

After

Width:  |  Height:  |  Size: 266 B

1
src/icons/reddit.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19.512 1.173a1.88 1.88 0 0 1 1.877 1.874 1.884 1.884 0 0 1-1.877 1.857c-.99 0-1.817-.783-1.873-1.773l-3.897-.82-1.201 5.623c2.737.105 5.223.949 7.015 2.234a2.53 2.53 0 0 1 1.812-.737A2.634 2.634 0 0 1 24 12.063c0 1.075-.653 2-1.516 2.423q.066.388.063.78c0 4.043-4.698 7.31-10.512 7.31s-10.512-3.267-10.512-7.31c0-.275.022-.55.064-.801a2.63 2.63 0 0 1-1.559-2.402 2.634 2.634 0 0 1 2.633-2.632c.694 0 1.347.294 1.811.735 1.812-1.325 4.32-2.146 7.12-2.232l1.329-6.276a.5.5 0 0 1 .21-.296.52.52 0 0 1 .357-.063l4.361.926c.3-.644.952-1.057 1.663-1.052M7.917 18.052c-.13 0-.254.05-.347.14a.497.497 0 0 0 0 .696c1.264 1.263 3.728 1.37 4.444 1.37s3.16-.084 4.444-1.37a.545.545 0 0 0 .044-.695.5.5 0 0 0-.697 0c-.82.8-2.527 1.095-3.77 1.095s-2.97-.294-3.77-1.095a.5.5 0 0 0-.348-.143zm-.051-5.989A1.88 1.88 0 0 0 5.99 13.94c0 1.031.842 1.873 1.876 1.873a1.88 1.88 0 0 0 1.873-1.874 1.88 1.88 0 0 0-1.873-1.875Zm8.254 0a1.88 1.88 0 0 0-1.873 1.876c0 1.031.842 1.873 1.875 1.873a1.88 1.88 0 0 0 1.875-1.874 1.88 1.88 0 0 0-1.877-1.875"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

1
src/icons/teams.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20.625 8.127q-.55 0-1.025-.205t-.832-.563-.563-.832T18 5.502q0-.54.205-1.02t.563-.837q.357-.358.832-.563.474-.205 1.025-.205.54 0 1.02.205t.837.563q.358.357.563.837t.205 1.02q0 .55-.205 1.025t-.563.832q-.357.358-.837.563t-1.02.205m0-3.75q-.469 0-.797.328t-.328.797.328.797.797.328.797-.328.328-.797-.328-.797-.797-.328M24 10.002v5.578q0 .774-.293 1.46t-.803 1.194q-.51.51-1.195.803-.686.293-1.459.293-.445 0-.908-.105-.463-.106-.85-.329-.293.95-.855 1.729t-1.319 1.336-1.67.861-1.898.305q-1.148 0-2.162-.398-1.014-.399-1.805-1.102t-1.312-1.664-.674-2.086h-5.8q-.411 0-.704-.293T0 16.881V6.873q0-.41.293-.703t.703-.293h8.59q-.34-.715-.34-1.5 0-.727.275-1.365.276-.639.75-1.114.475-.474 1.114-.75.638-.275 1.365-.275t1.365.275 1.114.75q.474.475.75 1.114.275.638.275 1.365t-.275 1.365q-.276.639-.75 1.113-.475.475-1.114.75-.638.276-1.365.276-.188 0-.375-.024-.188-.023-.375-.058v1.078h10.875q.469 0 .797.328t.328.797M12.75 2.373q-.41 0-.78.158-.368.158-.638.434-.27.275-.428.639-.158.363-.158.773t.158.78q.159.368.428.638.27.27.639.428t.779.158.773-.158q.364-.159.64-.428.274-.27.433-.639t.158-.779-.158-.773q-.159-.364-.434-.64-.275-.275-.639-.433-.363-.158-.773-.158M6.937 9.814h2.25V7.94H2.814v1.875h2.25v6h1.875zm10.313 7.313v-6.75H12v6.504q0 .41-.293.703t-.703.293H8.309q.152.809.556 1.5.405.691.985 1.19.58.497 1.318.779.738.281 1.582.281.926 0 1.746-.352.82-.351 1.436-.966.615-.616.966-1.43.352-.815.352-1.752m5.25-1.547v-5.203h-3.75v6.855q.305.305.691.452.387.146.809.146.469 0 .879-.176.41-.175.715-.48.304-.305.48-.715t.176-.879"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

1
src/icons/telegram.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20.888 3.551c.168-.003.54.039.781.235.162.14.264.335.288.547.026.156.06.514.033.793-.302 3.189-1.616 10.924-2.285 14.495-.282 1.512-.838 2.017-1.378 2.066-1.17.11-2.058-.773-3.192-1.515-1.774-1.165-2.777-1.889-4.5-3.025-1.99-1.31-.7-2.033.434-3.209.297-.309 5.455-5.002 5.556-5.427.012-.054.024-.252-.094-.356s-.292-.069-.418-.04q-.267.061-8.504 5.62-1.208.831-2.187.806c-.72-.013-2.104-.405-3.134-.739C1.025 13.39.022 13.174.11 12.476q.068-.544 1.5-1.114 8.816-3.84 11.758-5.064c5.599-2.328 6.763-2.733 7.521-2.747Z"/></svg>

After

Width:  |  Height:  |  Size: 607 B

1
src/icons/tumblr.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M14.563 24c-5.093 0-7.031-3.756-7.031-6.411V9.747H5.116V6.648c3.63-1.313 4.512-4.596 4.71-6.469C9.84.051 9.941 0 9.999 0h3.517v6.114h4.801v3.633h-4.82v7.47c.016 1.001.375 2.371 2.207 2.371h.09c.631-.02 1.486-.205 1.936-.419l1.156 3.425c-.436.636-2.4 1.374-4.156 1.404h-.178z"/></svg>

After

Width:  |  Height:  |  Size: 364 B

1
src/icons/twitter.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21.543 7.104c.015.211.015.423.015.636 0 6.507-4.954 14.01-14.01 14.01v-.003A13.94 13.94 0 0 1 0 19.539a9.88 9.88 0 0 0 7.287-2.041 4.93 4.93 0 0 1-4.6-3.42 4.9 4.9 0 0 0 2.223-.084A4.926 4.926 0 0 1 .96 9.167v-.062a4.9 4.9 0 0 0 2.235.616A4.93 4.93 0 0 1 1.67 3.148a13.98 13.98 0 0 0 10.15 5.144 4.929 4.929 0 0 1 8.39-4.49 9.9 9.9 0 0 0 3.128-1.196 4.94 4.94 0 0 1-2.165 2.724A9.8 9.8 0 0 0 24 4.555a10 10 0 0 1-2.457 2.549"/></svg>

After

Width:  |  Height:  |  Size: 515 B

1
src/icons/viber.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11.4 0C9.473.028 5.333.344 3.02 2.467 1.302 4.187.696 6.7.633 9.817S.488 18.776 6.12 20.36h.003l-.004 2.416s-.037.977.61 1.177c.777.242 1.234-.5 1.98-1.302.407-.44.972-1.084 1.397-1.58 3.85.326 6.812-.416 7.15-.525.776-.252 5.176-.816 5.892-6.657.74-6.02-.36-9.83-2.34-11.546-.596-.55-3.006-2.3-8.375-2.323 0 0-.395-.025-1.037-.017zm.058 1.693c.545-.004.88.017.88.017 4.542.02 6.717 1.388 7.222 1.846 1.675 1.435 2.53 4.868 1.906 9.897v.002c-.604 4.878-4.174 5.184-4.832 5.395-.28.09-2.882.737-6.153.524 0 0-2.436 2.94-3.197 3.704-.12.12-.26.167-.352.144-.13-.033-.166-.188-.165-.414l.02-4.018c-4.762-1.32-4.485-6.292-4.43-8.895.054-2.604.543-4.738 1.996-6.173 1.96-1.773 5.474-2.018 7.11-2.03zm.38 2.602a.304.304 0 0 0-.004.607c1.624.01 2.946.537 4.028 1.592 1.073 1.046 1.62 2.468 1.633 4.334.002.167.14.3.307.3a.304.304 0 0 0 .3-.304c-.014-1.984-.618-3.596-1.816-4.764-1.19-1.16-2.692-1.753-4.447-1.765zm-3.96.695a.98.98 0 0 0-.616.117l-.01.002c-.43.247-.816.562-1.146.932l-.008.008q-.4.484-.46.948a.6.6 0 0 0-.007.14q0 .205.065.4l.013.01c.135.48.473 1.276 1.205 2.604.42.768.903 1.5 1.446 2.186q.405.517.87.984l.132.132q.466.463.984.87a15.5 15.5 0 0 0 2.186 1.447c1.328.733 2.126 1.07 2.604 1.206l.01.014a1.3 1.3 0 0 0 .54.055q.466-.055.948-.46c.004 0 .003-.002.008-.005.37-.33.683-.72.93-1.148l.003-.01c.225-.432.15-.842-.18-1.12-.004 0-.698-.58-1.037-.83q-.54-.383-1.113-.71c-.51-.285-1.032-.106-1.248.174l-.447.564c-.23.283-.657.246-.657.246-3.12-.796-3.955-3.955-3.955-3.955s-.037-.426.248-.656l.563-.448c.277-.215.456-.737.17-1.248a13 13 0 0 0-.71-1.115 28 28 0 0 0-.83-1.035.82.82 0 0 0-.502-.297zm4.49.88a.303.303 0 0 0-.018.606c1.16.085 2.017.466 2.645 1.15.63.688.93 1.524.906 2.57a.306.306 0 0 0 .61.013c.025-1.175-.334-2.193-1.067-2.994-.74-.81-1.777-1.253-3.05-1.346h-.024zm.463 1.63a.305.305 0 0 0-.3.287c-.008.167.12.31.288.32.523.028.875.175 1.113.422.24.245.388.62.416 1.164a.304.304 0 0 0 .605-.03c-.03-.644-.215-1.178-.58-1.557-.367-.378-.893-.574-1.52-.607h-.018z"/></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

1
src/icons/vkontakte.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.199 4.841H.11c.194 9.312 4.85 14.907 13.012 14.907h.462v-5.327c3 .299 5.268 2.492 6.178 5.327H24c-1.164-4.237-4.223-6.58-6.133-7.475 1.91-1.105 4.596-3.79 5.238-7.432h-3.85c-.836 2.955-3.313 5.641-5.67 5.895V4.84h-3.85v10.326C7.347 14.57 4.333 11.675 4.199 4.84Z"/></svg>

After

Width:  |  Height:  |  Size: 355 B

1
src/icons/web-share.svg Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="#fff" stroke-width="2" d="M18 2a3 3 0 1 0 0 6 3 3 0 1 0 0-6zM6 9a3 3 0 1 0 0 6 3 3 0 1 0 0-6zm12 7a3 3 0 1 0 0 6 3 3 0 1 0 0-6zm-9.41-2.49 6.83 3.98m-.01-10.98-6.82 3.98"/></svg>

After

Width:  |  Height:  |  Size: 264 B

1
src/icons/whatsapp.svg Normal file
View File

@ -0,0 +1 @@
<svg fill="#fff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52s.198-.298.298-.497c.099-.198.05-.371-.025-.52s-.669-1.612-.916-2.207c-.242-.579-.487-.5-.669-.51a13 13 0 0 0-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074s2.096 3.2 5.077 4.487c.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413s.248-1.289.173-1.413c-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.82 9.82 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.82 11.82 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.9 11.9 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.82 11.82 0 0 0-3.48-8.413"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

8
src/index.js Normal file
View File

@ -0,0 +1,8 @@
import { init } from "./shareon";
const s = document.currentScript;
if (s && s.hasAttribute("init")) {
init();
}
export { init } from "./shareon";

View File

@ -1,68 +0,0 @@
import './style.scss';
interface PublishPreset {
url: string,
title: string,
extra: {
media: string,
text: string,
via: string,
}
}
type UrlBuilder = (data: PublishPreset) => string;
const NETWORKS: { [name: string]: UrlBuilder } = {
facebook: (d) => `https://www.facebook.com/sharer/sharer.php?u=${d.url}`,
messenger: (d) => `https://www.facebook.com/dialog/send?app_id=3619024578167617&link=${d.url}&redirect_uri=${d.url}`,
odnoklassniki: (d) => `https://connect.ok.ru/offer?url=${d.url}&title=${d.title}${d.extra.media ? `&imageUrl=${d.extra.media}` : ''}`,
pinterest: (d) => `https://pinterest.com/pin/create/button/?url=${d.url}&description=${d.title}${d.extra.media ? `&media=${d.extra.media}` : ''}`,
telegram: (d) => `https://telegram.me/share/url?url=${d.url}${d.extra.text ? `&text=${d.extra.text}` : ''}`,
twitter: (d) => `https://twitter.com/intent/tweet?url=${d.url}&text=${d.title}${d.extra.via ? `&via=${d.extra.via}` : ''}`,
vkontakte: (d) => `https://vk.com/share.php?url=${d.url}&title=${d.title}${d.extra.media ? `&image=${d.extra.media}` : ''}`,
whatsapp: (d) => `whatsapp://send?text=${d.title}%0D%0A${d.url}${d.extra.text ? `%0D%0A%0D%0A${d.extra.text}` : ''}`,
};
function initShareonChild(child: HTMLElement, preset: PublishPreset) {
if (child) {
child.classList.forEach((cls) => {
if (Object.prototype.hasOwnProperty.call(NETWORKS, cls)) {
const url = NETWORKS[cls](preset);
if (child.tagName.toLowerCase() === 'a') {
child.setAttribute('href', url);
child.setAttribute('rel', 'noopener noreferrer');
child.setAttribute('target', '_blank');
} else {
child.addEventListener('click', () => { window.open(url, '_blank', 'noopener,noreferrer').opener = null; });
}
}
});
}
}
window.onload = () => {
const shareonContainers = document.getElementsByClassName('shareon');
for (let i = 0; i < shareonContainers.length; i += 1) {
const container = shareonContainers[i] as HTMLElement;
for (let j = 0; j < container.children.length; j += 1) {
const child = container.children[j] as HTMLElement;
const preset: PublishPreset = {
url: encodeURIComponent(child.dataset.url || container.dataset.url || window.location.href),
title: encodeURIComponent(child.dataset.title || container.dataset.title || document.title || ''),
extra: {
media: encodeURIComponent(child.dataset.media || container.dataset.media || ''),
text: encodeURIComponent(child.dataset.text || container.dataset.text || ''),
via: encodeURIComponent(child.dataset.via || container.dataset.via || ''),
},
};
initShareonChild(
child as HTMLElement,
preset,
);
}
}
};

209
src/shareon.css Normal file
View File

@ -0,0 +1,209 @@
:root {
--button-size: 36px;
--icon-size: 20px;
--padding-ver: calc(0.3 * var(--icon-size));
--padding-hor: calc(var(--icon-size) / 2);
--padding-icon: calc((var(--button-size) - var(--icon-size)) / 2);
--height: calc(var(--button-size) - 2 * var(--padding-ver));
--width: calc(var(--button-size) - 2 * var(--padding-hor));
}
.shareon {
font-size: 0 !important;
}
.shareon > * {
display: inline-block;
position: relative;
height: var(--height);
min-width: var(--width);
margin: calc(var(--padding-ver) / 2);
padding: var(--padding-ver) var(--padding-hor);
background-color: #333;
border-radius: calc(var(--icon-size) / 6);
border: none;
box-sizing: content-box;
color: white;
line-height: 1.5;
transition: opacity 300ms ease;
vertical-align: middle;
}
.shareon > *:hover {
border: none;
cursor: pointer;
opacity: 0.7;
}
.shareon > *:not(:empty) {
font-size: calc(0.8 * var(--icon-size));
text-decoration: none;
}
.shareon > *:not(:empty)::before {
position: relative;
height: 100%;
width: calc(var(--icon-size) + var(--padding-icon));
top: 0;
left: 0;
background-position: 0 50%;
}
.shareon > *::before {
display: inline-block;
position: absolute;
height: var(--icon-size);
width: var(--icon-size);
top: var(--padding-icon);
left: var(--padding-icon);
background-repeat: no-repeat;
background-size: var(--icon-size) var(--icon-size);
content: "";
vertical-align: bottom;
}
.shareon > .copy-url:before {
background-image: url("icons/copy-url.svg");
}
.shareon > .copy-url.done:before {
background-image: url("icons/copy-url-done.svg");
}
.shareon > .email:before {
background-image: url("icons/email.svg");
}
.shareon > .facebook {
background-color: #1877f2;
}
.shareon > .facebook:before {
background-image: url("icons/facebook.svg");
}
.shareon > .fediverse {
background-color: #8a54af;
}
.shareon > .fediverse:before {
background-image: url("icons/fediverse.svg");
}
.shareon > .linkedin {
background-color: #0a66c2;
}
.shareon > .linkedin:before {
background-image: url("icons/linkedin-in.svg");
}
.shareon > .linkedin:not(:empty):before {
background-image: url("icons/linkedin.svg");
}
.shareon > .mastodon {
background-color: #6364ff;
}
.shareon > .mastodon:before {
background-image: url("icons/mastodon.svg");
}
.shareon > .messenger {
background-color: #00b2ff;
}
.shareon > .messenger:before {
background-image: url("icons/messenger.svg");
}
.shareon > .odnoklassniki {
background-color: #ee8208;
}
.shareon > .odnoklassniki:before {
background-image: url("icons/odnoklassniki.svg");
}
.shareon > .pinterest {
background-color: #bd081c;
}
.shareon > .pinterest:before {
background-image: url("icons/pinterest.svg");
}
.shareon > .pocket {
background-color: #ef3f56;
}
.shareon > .pocket:before {
background-image: url("icons/pocket.svg");
}
.shareon > .print:before {
background-image: url("icons/print.svg");
}
.shareon > .reddit {
background-color: #ff4500;
}
.shareon > .reddit:before {
background-image: url("icons/reddit.svg");
}
.shareon > .teams {
background-color: #6264a7;
}
.shareon > .teams:before {
background-image: url("icons/teams.svg");
}
.shareon > .telegram {
background-color: #26a5e4;
}
.shareon > .telegram:before {
background-image: url("icons/telegram.svg");
}
.shareon > .tumblr {
background-color: #36465d;
}
.shareon > .tumblr:before {
background-image: url("icons/tumblr.svg");
}
.shareon > .twitter {
background-color: #1d9bf0;
}
.shareon > .twitter:before {
background-image: url("icons/twitter.svg");
}
.shareon > .viber {
background-color: #7360f2;
}
.shareon > .viber:before {
background-image: url("icons/viber.svg");
}
.shareon > .vkontakte {
background-color: #0077ff;
}
.shareon > .vkontakte:before {
background-image: url("icons/vkontakte.svg");
}
.shareon > .web-share:before {
background-image: url("icons/web-share.svg");
}
.shareon > .whatsapp {
background-color: #25d366;
}
.shareon > .whatsapp:before {
background-image: url("icons/whatsapp.svg");
}

155
src/shareon.js Normal file
View File

@ -0,0 +1,155 @@
import "./shareon.css";
// prettier-ignore
/**
* Map of social networks to their respective URL builders.
*
* The `d` argument of each builder is the object with the page metadata, such
* as page title, URL, author name, etc.
*
* @type {{ [network: string]: (d: {
* url: string,
* title?: string,
* media?: string,
* text?: string,
* via?: string,
* fbAppId?: string,
* s2fInstance?: string,
* }) => string}}
*/
const urlBuilderMap = {
facebook: (d) => `https://www.facebook.com/sharer/sharer.php?u=${d.url}${d.hashtags ? `&hashtag=%23${d.hashtags.split('%2C')[0]}` : ''}`,
fediverse: (d) => `https://${d.s2fInstance}/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}${d.via ? `%0D%0A%0D%0A${d.via}` : ''}`,
email: (d) => `mailto:?subject=${d.title}&body=${d.url}`,
linkedin: (d) => `https://www.linkedin.com/sharing/share-offsite/?url=${d.url}`,
mastodon: (d) => `https://toot.kytta.dev/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}${d.via ? `%0D%0A%0D%0A${d.via}` : ''}`,
messenger: (d) => `https://www.facebook.com/dialog/send?app_id=${d.fbAppId}&link=${d.url}&redirect_uri=${d.url}`,
odnoklassniki: (d) => `https://connect.ok.ru/offer?url=${d.url}&title=${d.title}${d.media ? `&imageUrl=${d.media}` : ''}`,
pinterest: (d) => `https://pinterest.com/pin/create/button/?url=${d.url}&description=${d.title}${d.media ? `&media=${d.media}` : ''}`,
pocket: (d) => `https://getpocket.com/edit.php?url=${d.url}`,
reddit: (d) => `https://www.reddit.com/submit?title=${d.title}&url=${d.url}`,
teams: (d) => `https://teams.microsoft.com/share?href=${d.url}${d.text ? `&msgText=${d.text}` : ''}`,
telegram: (d) => `https://telegram.me/share/url?url=${d.url}${d.text ? `&text=${d.text}` : ''}`,
tumblr: (d) => `https://www.tumblr.com/widgets/share/tool?posttype=link${d.hashtags ? `&tags=${d.hashtags}` : ''}&title=${d.title}&content=${d.url}&canonicalUrl=${d.url}${d.text ? `&caption=${d.text}` : ''}${d.via ? `&show-via=${d.via}` : ''}`,
twitter: (d) => `https://twitter.com/intent/tweet?url=${d.url}&text=${d.title}${d.via ? `&via=${d.via}` : ''}${d.hashtags ? `&hashtags=${d.hashtags}` : ''}`,
viber: (d) => `viber://forward?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}`,
vkontakte: (d) => `https://vk.com/share.php?url=${d.url}&title=${d.title}${d.media ? `&image=${d.media}` : ''}`,
whatsapp: (d) => `https://wa.me/?text=${d.title}%0D%0A${d.url}${d.text ? `%0D%0A%0D%0A${d.text}` : ''}`,
};
const openUrl = (buttonUrl) => () => {
window.open(buttonUrl, "_blank", "noopener,noreferrer");
};
const init = () => {
const shareonContainers = document.querySelectorAll(".shareon");
// iterate over <div class="shareon">
for (const container of shareonContainers) {
// iterate over children of <div class="shareon">
for (const child of container.children) {
if (child) {
const classListLength = child.classList.length;
// iterate over classes of the child element
for (let k = 0; k < classListLength; k += 1) {
const cls = child.classList.item(k);
// if it's "Copy URL"
if (cls === "copy-url") {
child.addEventListener("click", () => {
const url =
child.dataset.url ||
container.dataset.url ||
window.location.href;
navigator.clipboard.writeText(url);
child.classList.add("done");
setTimeout(() => {
child.classList.remove("done");
}, 1000);
});
}
// if it's "Print"
if (cls === "print") {
child.addEventListener("click", () => {
window.print();
});
}
// if it's "Web Share"
if (cls === "web-share") {
const data = {
title:
child.dataset.title ||
container.dataset.title ||
document.title,
text: child.dataset.text || container.dataset.text || "",
url:
child.dataset.url ||
container.dataset.url ||
window.location.href,
};
if (navigator.canShare && navigator.canShare(data)) {
child.addEventListener("click", () => {
navigator.share(data);
});
} else {
child.style.display = "none";
}
}
// if it's one of the networks
if (Object.prototype.hasOwnProperty.call(urlBuilderMap, cls)) {
const preset = {
url: encodeURIComponent(
child.dataset.url ||
container.dataset.url ||
window.location.href,
),
title: encodeURIComponent(
child.dataset.title ||
container.dataset.title ||
document.title,
),
media: encodeURIComponent(
child.dataset.media || container.dataset.media || "",
),
text: encodeURIComponent(
child.dataset.text || container.dataset.text || "",
),
via: encodeURIComponent(
child.dataset.via || container.dataset.via || "",
),
hashtags: encodeURIComponent(
child.dataset.hashtags || container.dataset.hashtags || "",
),
fbAppId: encodeURIComponent(
child.dataset.fbAppId || container.dataset.fbAppId || "",
),
s2fInstance: encodeURIComponent(
child.dataset.s2fInstance ||
container.dataset.s2fInstance ||
"s2f.kytta.dev",
),
};
const url = urlBuilderMap[cls](preset);
if (child.tagName.toLowerCase() === "a") {
child.setAttribute("href", url);
child.setAttribute("rel", "noopener noreferrer");
child.setAttribute("target", "_blank");
} else {
child.addEventListener("click", openUrl(url));
}
break; // once a network is detected we don't want to check further
}
}
}
}
}
};
export { init };

View File

@ -1,136 +0,0 @@
$button-size: 36px;
$icon-size: 20px;
$padding-ver: 0.3*$icon-size;
$padding-hor: $icon-size / 2;
$padding-icon: ($button-size - $icon-size) / 2;
$height: $button-size - 2*$padding-ver;
$width: $button-size - 2*$padding-hor;
.shareon {
font-size: 0 !important;
& > * {
display: inline-block;
position: relative;
height: $height;
min-width: $width;
margin: $padding-ver / 2;
padding: $padding-ver $padding-hor;
background-color: #ccc;
border-radius: $icon-size / 6;
border: none;
box-sizing: content-box;
color: white;
line-height: 1.5;
transition: opacity 300ms ease;
vertical-align: middle;
&:hover {
cursor: pointer;
opacity: .7;
}
&:not(:empty) {
font-size: 0.8 * $icon-size;
text-decoration: none;
&::before {
position: relative;
height: 100%;
width: $icon-size+$padding-icon;
top: 0;
left: 0;
background-position: 0 50%;
}
}
&::before {
display: inline-block;
position: absolute;
height: $icon-size;
width: $icon-size;
top: $padding-icon;
left: $padding-icon;
background-repeat: no-repeat;
background-size: $icon-size $icon-size;
content: '';
vertical-align: bottom;
}
&.facebook {
background-color: #1877F2;
&::before {
background-image: url("data:image/svg+xml,%3Csvg fill='%23fff' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M23.998 12c0-6.628-5.372-12-11.999-12C5.372 0 0 5.372 0 12c0 5.988 4.388 10.952 10.124 11.852v-8.384H7.078v-3.469h3.046V9.356c0-3.008 1.792-4.669 4.532-4.669 1.313 0 2.686.234 2.686.234v2.953H15.83c-1.49 0-1.955.925-1.955 1.874V12h3.328l-.532 3.469h-2.796v8.384c5.736-.9 10.124-5.864 10.124-11.853z'/%3E%3C/svg%3E");
}
}
&.messenger {
background-color: #0099FF;
&::before {
background-image: url("data:image/svg+xml,%3Csvg fill='%23fff' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 11.64C0 4.95 5.24 0 12 0s12 4.95 12 11.64-5.24 11.64-12 11.64c-1.21 0-2.38-.16-3.47-.46a.96.96 0 00-.64.05L5.5 23.92a.96.96 0 01-1.35-.85l-.07-2.14a.97.97 0 00-.32-.68A11.39 11.39 0 010 11.64zm8.32-2.19l-3.52 5.6c-.35.53.32 1.14.82.75l3.79-2.87c.26-.2.6-.2.87 0l2.8 2.1c.84.63 2.04.4 2.6-.48l3.52-5.6c.35-.53-.32-1.13-.82-.75l-3.79 2.87c-.25.2-.6.2-.86 0l-2.8-2.1a1.8 1.8 0 00-2.61.48z'/%3E%3C/svg%3E");
}
}
&.odnoklassniki {
background-color: #EE8208;
&::before {
background-image: url("data:image/svg+xml,%3Csvg fill='%23fff' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.505 17.44a11.599 11.599 0 003.6-1.49 1.816 1.816 0 00-1.935-3.073 7.866 7.866 0 01-8.34 0 1.814 1.814 0 00-2.5.565c0 .002 0 .004-.002.005a1.812 1.812 0 00.567 2.5l.002.002c1.105.695 2.322 1.2 3.596 1.488l-3.465 3.465A1.796 1.796 0 006 23.439l.03.03c.344.354.81.53 1.274.53.465 0 .93-.176 1.275-.53L12 20.065l3.404 3.406a1.815 1.815 0 002.566-2.565l-3.465-3.466zM12 12.388a6.202 6.202 0 006.195-6.193C18.195 2.78 15.415 0 12 0S5.805 2.78 5.805 6.197A6.2 6.2 0 0012 12.389zm0-8.757a2.566 2.566 0 010 5.13 2.569 2.569 0 01-2.565-2.564A2.57 2.57 0 0112 3.63z'/%3E%3C/svg%3E");
}
}
&.pinterest {
background-color: #e60023;
&::before {
background-image: url("data:image/svg+xml,%3Csvg fill='%23fff' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='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.026z'/%3E%3C/svg%3E");
}
}
&.telegram {
background-color: #179CDE;
&::before {
background-image: url("data:image/svg+xml,%3Csvg viewBox='4.4 5 14 14' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M4.987 11.948c3.69-1.487 6.151-2.468 7.382-2.941 3.515-1.352 4.245-1.587 4.721-1.595.105-.002.339.022.491.136a.482.482 0 01.18.317c.017.091.038.299.021.461-.19 1.851-1.015 6.343-1.434 8.417-.177.877-.529 1.065-.867 1.094-.736.062-1.291-.343-2.003-.775-1.114-.675-1.788-.987-2.869-1.646-1.25-.762-.15-1.118.562-1.802.186-.179 3.371-3.042 3.357-3.128-.005-.032-.099-.34-.173-.401s-.184-.04-.262-.024c-.112.024-1.892 1.112-5.339 3.264-.506.321-.963.477-1.373.469-.452-.009-1.321-.236-1.968-.43-.792-.239-1.085-.351-1.03-.756.028-.211.23-.431.604-.66z'/%3E%3C/svg%3E");
}
}
&.twitter {
background-color: #1da1f2;
&::before {
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23fff' d='M23.954 4.569a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.691 8.094 4.066 6.13 1.64 3.161a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.061a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.937 4.937 0 004.604 3.417 9.868 9.868 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63a9.936 9.936 0 002.46-2.548l-.047-.02z'/%3E%3C/svg%3E");
}
}
&.vkontakte {
background-color: #4680C2;
&::before {
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M97.647 24.37c.741-2.33 0-4.024-3.283-4.024H83.455c-2.753 0-4.024 1.483-4.766 3.071 0 0-5.613 13.556-13.45 22.347-2.542 2.541-3.707 3.389-5.083 3.389-.742 0-1.695-.848-1.695-3.177V24.264c0-2.753-.847-4.024-3.177-4.024H38.127c-1.695 0-2.754 1.271-2.754 2.542 0 2.647 3.919 3.283 4.342 10.696v16.098c0 3.495-.635 4.131-2.012 4.131-3.707 0-12.709-13.662-18.11-29.231-1.059-3.071-2.118-4.236-4.872-4.236H3.707C.53 20.24 0 21.723 0 23.311c0 2.86 3.707 17.263 17.263 36.327 9.002 13.026 21.817 20.016 33.361 20.016 6.99 0 7.837-1.588 7.837-4.236v-9.85c0-3.177.635-3.706 2.86-3.706 1.588 0 4.448.847 10.908 7.095 7.414 7.414 8.684 10.803 12.815 10.803h10.908c3.178 0 4.66-1.589 3.813-4.66-.953-3.071-4.554-7.519-9.214-12.815-2.542-2.965-6.354-6.248-7.519-7.837-1.589-2.118-1.165-2.965 0-4.872-.106 0 13.238-18.851 14.615-25.206' fill='%23fff'/%3E%3C/svg%3E");
}
}
&.whatsapp {
background-color: #25D366;
&::before {
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23fff' d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51a12.8 12.8 0 00-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E");
}
}
}
}

92
svgo.config.js Normal file
View File

@ -0,0 +1,92 @@
/*!
* SVGO configuration from simple-icons, modified.
*
* See: https://github.com/simple-icons/simple-icons/blob/4e36921e759278e83f2e6775e0fb78ba76131eec/svgo.config.mjs
*/
export default {
multipass: true,
eol: "lf",
plugins: [
"cleanupAttrs",
"mergeStyles",
"minifyStyles",
"inlineStyles",
"removeDoctype",
"removeXMLProcInst",
"removeComments",
"removeMetadata",
"removeDesc",
"removeUselessDefs",
"removeEditorsNSData",
"removeEmptyAttrs",
"removeHiddenElems",
"removeEmptyText",
"removeEmptyContainers",
"convertStyleToAttrs",
"convertColors",
"cleanupEnableBackground",
{
name: "convertPathData",
params: {
// 3 decimals of precision in floating point numbers
floatPrecision: 3,
},
},
"convertTransform",
{
name: "removeUnknownsAndDefaults",
},
"removeUselessStrokeAndFill",
"removeNonInheritableGroupAttrs",
"removeUnusedNS",
"cleanupIds",
"cleanupNumericValues",
"cleanupListOfValues",
"collapseGroups",
"removeRasterImages",
{
// Compound all <path>s into one
name: "mergePaths",
params: {
force: true,
},
},
{
// Convert basic shapes (such as <circle>) to <path>
name: "convertShapeToPath",
params: {
// including <arc>
convertArcs: true,
},
},
"convertEllipseToCircle",
{
// Sort the attributes on the <svg> tag
name: "sortAttrs",
params: {
order: ["fill", "stroke", "viewBox"],
xmlnsOrder: "end",
},
},
"sortDefsChildren",
"removeDimensions",
{
name: "removeAttrs",
params: {
attrs: ["svg:(?!(role|xmlns))", "path:(?!d)"],
},
},
{
name: "addAttributesToSVGElement",
params: {
attributes: [{ xmlns: "http://www.w3.org/2000/svg" }],
},
},
"removeOffCanvasPaths",
"removeStyleElement",
"removeScriptElement",
"removeTitle",
],
};

View File

@ -1,18 +0,0 @@
{
"compilerOptions": {
"lib": [
"dom",
"es6"
],
"module": "ES2020",
"noImplicitAny": true,
"noImplicitReturns": true,
"target": "es5"
},
"include": [
"./src/**/*"
],
"exclude": [
"node_modules"
]
}

27
vite.config.js Normal file
View File

@ -0,0 +1,27 @@
import { defineConfig } from "vite";
import * as path from "node:path";
export default defineConfig({
build: {
lib: {
entry: path.resolve("./src/index.js"),
name: "Shareon",
formats: ["es", "umd", "iife"],
// Workaround to keep the old file names
fileName: (format) => `shareon.${format}.js`,
},
rollupOptions: {
output: {
// Workaround for a correct file name
// See: https://github.com/vitejs/vite/issues/4863
assetFileNames: (assetInfo) => {
if (assetInfo.name === "style.css") return "shareon.min.css";
return assetInfo.name;
},
},
},
},
css: {
devSourcemap: true,
},
});

7706
yarn.lock

File diff suppressed because it is too large Load Diff