From 2e64aed40b75e3df81c956868a1a84c35a49873c Mon Sep 17 00:00:00 2001 From: Murhaf Sousli Date: Fri, 31 May 2024 04:57:22 +0300 Subject: [PATCH] Update --- CHANGELOG.MD | 1 + LICENSE | 2 +- README.md | 52 +----------------- .../src/app/app.config.ts | 53 +++++++++---------- .../pages/button-c/button-c.component.html | 4 +- .../pages/buttons-c/buttons-c.component.html | 8 +-- .../custom-button.component.html | 6 ++- .../src/app/shared/lab/lab.component.html | 6 +-- .../shared-info/shared-info.component.html | 6 +-- .../code-examples/faq/buttons-order.html | 2 +- .../code-examples/install-with-icons.bash | 2 + .../share-buttons/basic-example.ts | 2 +- .../share-buttons/recommended-example.html | 1 - .../src/assets/code-examples/theme.scss | 2 +- .../src/assets/data/component-api.json | 12 ++--- .../src/assets/data/container-api.json | 15 ++---- .../src/assets/data/directive-api.json | 4 +- projects/ngx-sharebuttons/README.md | 52 +----------------- .../buttons/src/expand-button.ts | 3 +- projects/ngx-sharebuttons/package.json | 5 +- .../ngx-sharebuttons/src/lib/share.models.ts | 3 +- .../ngx-sharebuttons/src/lib/share.service.ts | 2 +- 22 files changed, 72 insertions(+), 171 deletions(-) create mode 100644 projects/ngx-sharebuttons-demo/src/assets/code-examples/install-with-icons.bash delete mode 100644 projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/recommended-example.html diff --git a/CHANGELOG.MD b/CHANGELOG.MD index d4238fc5..77dac89c 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -9,6 +9,7 @@ - enhance: Replace Twitter with X, closes [#650](https://github.com/MurhafSousli/ngx-sharebuttons/issues/650) and [#657](https://github.com/MurhafSousli/ngx-sharebuttons/issues/657). - feat: Ability to create a sharer links through the share service. - feat: Add `args` input to add additional custom parameters to the sharer link. +- feat: Remove `rxjs` dependency. - fix: Cannot override `windowObj` due to `mergeDeep`, closes [#572](https://github.com/MurhafSousli/ngx-sharebuttons/issues/572). - fix: config is ignored if the module is lazy loaded, closes [#579](https://github.com/MurhafSousli/ngx-sharebuttons/issues/579). - fix: `opened` output not firing, closes [#633](https://github.com/MurhafSousli/ngx-sharebuttons/issues/633). diff --git a/LICENSE b/LICENSE index 47f7365e..089357fb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2023 Murhaf Sousli +Copyright (c) 2016-2024 Murhaf Sousli Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 17305d3c..fad57ddf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

Angular Share Buttons

-

Capture

+

Capture

[![Demo](https://img.shields.io/badge/demo-online-ed1c46.svg)](https://ngx-sharebuttons.netlify.app/) @@ -18,17 +18,10 @@ For the documentation see the [WIKI](https://github.com/MurhafSousli/ngx-sharebuttons/wiki) page. -## Packages - -- **ngx-sharebuttons** - Share button directive to convert any element to a share button. -- **ngx-sharebuttons/button** - Share button component to add buttons individually. -- **ngx-sharebuttons/buttons** - Share buttons component to add a collection of share buttons. -- **ngx-sharebuttons/icons** - Simplifies import the share icons from FontAwesome. - ## Available buttons 1. Facebook -2. Twitter +2. X (Twitter) 3. LinkedIn 4. Pinterest 5. WhatsApp @@ -46,20 +39,10 @@ For the documentation see the [WIKI](https://github.com/MurhafSousli/ngx-sharebu 17. Copy link 18. Print - -#### Need more buttons? - -> The plugin allows you to add your own buttons as well. if you like to add a new share button to this package feel free to submit a PR, or open an issue with dev docs link of the social network you want to include. - - ## Issues If you identify any errors in this component, or have an idea for an improvement, please open an [issue](https://github.com/MurhafSousli/ngx-sharebuttons/issues). -## Support - -[![npm](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/bePatron?u=5594898) - ## Author **Murhaf Sousli** @@ -73,37 +56,6 @@ If you identify any errors in this component, or have an idea for an improvement - [ngx-progressbar](https://github.com/MurhafSousli/ngx-progressbar) - [ngx-bar-rating](https://github.com/MurhafSousli/ngx-bar-rating) - [ngx-disqus](https://github.com/MurhafSousli/ngx-disqus) -- [ngx-wordpress](https://github.com/MurhafSousli/ngx-wordpress) - [ngx-highlightjs](https://github.com/MurhafSousli/ngx-highlightjs) - [ngx-scrollbar](https://github.com/MurhafSousli/ngx-scrollbar) - [ngx-teximate](https://github.com/MurhafSousli/ngx-teximate) - -## Contributors - -### Code Contributors - -This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. - - -### Financial Contributors - -Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/ngx-sharebuttons/contribute)] - -#### Individuals - - - -#### Organizations - -Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/ngx-sharebuttons/contribute)] - - - - - - - - - - - diff --git a/projects/ngx-sharebuttons-demo/src/app/app.config.ts b/projects/ngx-sharebuttons-demo/src/app/app.config.ts index 18e70d83..11bb2f42 100644 --- a/projects/ngx-sharebuttons-demo/src/app/app.config.ts +++ b/projects/ngx-sharebuttons-demo/src/app/app.config.ts @@ -22,30 +22,29 @@ const scrollConfig: InMemoryScrollingOptions = { const inMemoryScrollingFeature: InMemoryScrollingFeature = withInMemoryScrolling(scrollConfig); export const appConfig: ApplicationConfig = { - providers: [ - provideHttpClient(withFetch()), - provideRouter(routes, withHashLocation(), inMemoryScrollingFeature), - provideShareButtonsOptions( - withIcons(), - withConfig({ - debug: true, - sharerMethod: SharerMethods.Anchor - // xAccount: 'MurhafSousli' - }), - // customShareButton('x', { - // color: 'purple' - // }), - // customShareButton('facebook', { - // color: 'orange', - // icon: faFacebookSquare - // }) - ), - provideClientHydration(), - provideAnimationsAsync(), - provideHighlightOptions({ - fullLibraryLoader: () => import('highlight.js'), - themePath: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/atom-one-light.min.css' - }) - ] - } -; + providers: [ + provideHttpClient(withFetch()), + provideRouter(routes, withHashLocation(), inMemoryScrollingFeature), + provideShareButtonsOptions( + withIcons(), + withConfig({ + debug: true, + sharerMethod: SharerMethods.Anchor + // xAccount: 'MurhafSousli' + }), + // customShareButton('x', { + // color: 'purple' + // }), + // customShareButton('facebook', { + // color: 'orange', + // icon: faFacebookSquare + // }) + ), + provideClientHydration(), + provideAnimationsAsync(), + provideHighlightOptions({ + fullLibraryLoader: () => import('highlight.js'), + themePath: 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/atom-one-light.min.css' + }) + ] +} diff --git a/projects/ngx-sharebuttons-demo/src/app/pages/button-c/button-c.component.html b/projects/ngx-sharebuttons-demo/src/app/pages/button-c/button-c.component.html index 9cf6367b..0870ce98 100644 --- a/projects/ngx-sharebuttons-demo/src/app/pages/button-c/button-c.component.html +++ b/projects/ngx-sharebuttons-demo/src/app/pages/button-c/button-c.component.html @@ -6,7 +6,7 @@

Share Button Component

Overview -

is a component to add a single share button.

+

is a component that adds a single share button.

This component is available through the ngx-sharebuttons/button package. @@ -17,7 +17,7 @@

Share Button Component

Install the following packages

NPM

- +
diff --git a/projects/ngx-sharebuttons-demo/src/app/pages/buttons-c/buttons-c.component.html b/projects/ngx-sharebuttons-demo/src/app/pages/buttons-c/buttons-c.component.html index 96e89a52..35c6f6a3 100644 --- a/projects/ngx-sharebuttons-demo/src/app/pages/buttons-c/buttons-c.component.html +++ b/projects/ngx-sharebuttons-demo/src/app/pages/buttons-c/buttons-c.component.html @@ -7,7 +7,7 @@

Share Buttons Component

Overview -

is a component to add a collection of share +

is a component that displays a collection of share buttons.

This component is available through the ngx-sharebuttons/buttonspackage. @@ -19,7 +19,7 @@

Share Buttons Component

Install the following packages

NPM

- +
@@ -41,8 +41,8 @@

NPM

Basic Usage - + Add custom share button
Overview -

To use your own share button use the ShareService to add a custom button.

+

To create a new share button or to modify an existing share button, you can provide the options using + customShareButton function inside provideShareButtonsOptions + in your app.config file.

-

The available input for sharing parameters are url, url, +

The available inputs for sharing parameters are url, title, description, image, tags and via. diff --git a/projects/ngx-sharebuttons-demo/src/app/shared/lab/lab.component.html b/projects/ngx-sharebuttons-demo/src/app/shared/lab/lab.component.html index 02625476..1de752d8 100644 --- a/projects/ngx-sharebuttons-demo/src/app/shared/lab/lab.component.html +++ b/projects/ngx-sharebuttons-demo/src/app/shared/lab/lab.component.html @@ -144,7 +144,7 @@ + [disabled]="component === 'share-button' && ['print'].includes(config.button)"> If empty! It uses the current page URL

@@ -155,7 +155,7 @@ + [disabled]="component === 'share-button' && !['reddit', 'email'].includes(config.button)"> @@ -163,7 +163,7 @@ + [disabled]="component === 'share-button' && !['x', 'whatsapp', 'telegram', 'pinterest', 'sms', 'email', 'viber'].includes(config.button)"> diff --git a/projects/ngx-sharebuttons-demo/src/app/shared/shared-info/shared-info.component.html b/projects/ngx-sharebuttons-demo/src/app/shared/shared-info/shared-info.component.html index 814b92f5..b73f9d52 100644 --- a/projects/ngx-sharebuttons-demo/src/app/shared/shared-info/shared-info.component.html +++ b/projects/ngx-sharebuttons-demo/src/app/shared/shared-info/shared-info.component.html @@ -11,7 +11,7 @@

Using Meta Tags inputs

specific social network.

- Some of the meta tag inputs may seem not working, see compatibility - here, to properly set the meta tags, SSR is needed! read more.... + Some of the meta tag inputs may not work as expected. You can check their compatibility + here. To properly set the meta tags, server-side rendering (SSR) is needed. Read more... diff --git a/projects/ngx-sharebuttons-demo/src/assets/code-examples/faq/buttons-order.html b/projects/ngx-sharebuttons-demo/src/assets/code-examples/faq/buttons-order.html index 1ad27c1c..c58fa32c 100644 --- a/projects/ngx-sharebuttons-demo/src/assets/code-examples/faq/buttons-order.html +++ b/projects/ngx-sharebuttons-demo/src/assets/code-examples/faq/buttons-order.html @@ -1 +1 @@ - + diff --git a/projects/ngx-sharebuttons-demo/src/assets/code-examples/install-with-icons.bash b/projects/ngx-sharebuttons-demo/src/assets/code-examples/install-with-icons.bash new file mode 100644 index 00000000..ed251566 --- /dev/null +++ b/projects/ngx-sharebuttons-demo/src/assets/code-examples/install-with-icons.bash @@ -0,0 +1,2 @@ +npm i ngx-sharebuttons @angular/cdk +npm i @fortawesome/fontawesome-svg-core @fortawesome/angular-fontawesome @fortawesome/free-solid-svg-icons @fortawesome/free-brands-svg-icons diff --git a/projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/basic-example.ts b/projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/basic-example.ts index ae03c231..045b8252 100644 --- a/projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/basic-example.ts +++ b/projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/basic-example.ts @@ -9,5 +9,5 @@ import { ShareButtons } from 'ngx-sharebuttons/buttons'; ` }) -export class ShareButtonExample { +export class ShareButtonsExample { } diff --git a/projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/recommended-example.html b/projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/recommended-example.html deleted file mode 100644 index 0dfceedb..00000000 --- a/projects/ngx-sharebuttons-demo/src/assets/code-examples/share-buttons/recommended-example.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/projects/ngx-sharebuttons-demo/src/assets/code-examples/theme.scss b/projects/ngx-sharebuttons-demo/src/assets/code-examples/theme.scss index 50fd3a3e..694f40d8 100644 --- a/projects/ngx-sharebuttons-demo/src/assets/code-examples/theme.scss +++ b/projects/ngx-sharebuttons-demo/src/assets/code-examples/theme.scss @@ -1 +1 @@ -@import 'ngx-sharebuttons/button/themes/default'; +@import 'ngx-sharebuttons/themes/default'; diff --git a/projects/ngx-sharebuttons-demo/src/assets/data/component-api.json b/projects/ngx-sharebuttons-demo/src/assets/data/component-api.json index 92eb0e20..142f1f95 100644 --- a/projects/ngx-sharebuttons-demo/src/assets/data/component-api.json +++ b/projects/ngx-sharebuttons-demo/src/assets/data/component-api.json @@ -6,7 +6,7 @@ }, { "name": "button", - "description": "Button type, e.g. 'facebook', 'twitter' ...etc. default: null", + "description": "Button type, e.g. 'facebook', 'x' ...etc. default: null", "type": "input" }, { @@ -26,12 +26,12 @@ }, { "name": "title", - "description": "Override title meta tag for LinkedIn and Reddit, default: null", + "description": "Override title meta tag for Reddit and Email, default: null", "type": "input" }, { "name": "description", - "description": "Override description meta tag for LinkedIn, WhatsApp, Telegram and Pinterest, default: null", + "description": "Override description meta tag for WhatsApp, Telegram, Viber, SMS, Email and Pinterest, default: null", "type": "input" }, { @@ -41,7 +41,7 @@ }, { "name": "tags", - "description": "Override tags for Tumblr and Twitter, default: null", + "description": "Override tags for Tumblr and X, default: null", "type": "input" }, { @@ -60,8 +60,8 @@ "type": "input" }, { - "name": "autoSetMeta", - "description": "Initializes meta tag inputs from SEO meta tags, default: true", + "name": "redirectUrl", + "description": "Override redirectUrl for Messenger (desktop), default: null", "type": "input" }, { diff --git a/projects/ngx-sharebuttons-demo/src/assets/data/container-api.json b/projects/ngx-sharebuttons-demo/src/assets/data/container-api.json index e1572c22..7acd05d6 100644 --- a/projects/ngx-sharebuttons-demo/src/assets/data/container-api.json +++ b/projects/ngx-sharebuttons-demo/src/assets/data/container-api.json @@ -1,12 +1,12 @@ [ { "name": "text", - "description": "Popup's button custom text, default: ['fas', 'share']", + "description": "Popup's button custom icon, default: 'Share'", "type": "input" }, { "name": "icon", - "description": "Popup's button custom icon, default: 'Share'", + "description": "Popup's button custom text, default: ['fas', 'share']", "type": "input" }, { @@ -36,12 +36,12 @@ }, { "name": "title", - "description": "Override title meta tag for LinkedIn and Reddit, default: null", + "description": "Override title meta tag for Reddit and Email, default: null", "type": "input" }, { "name": "description", - "description": "Override description meta tag for LinkedIn, WhatsApp, Telegram and Pinterest, default: null", + "description": "Override description meta tag for WhatsApp, Telegram, Viber, SMS, Email and Pinterest, default: null", "type": "input" }, { @@ -51,7 +51,7 @@ }, { "name": "tags", - "description": "Override tags for Tumblr and Twitter, default: null", + "description": "Override tags for Tumblr and X, default: null", "type": "input" }, { @@ -69,11 +69,6 @@ "description": "Show buttons text, default: false", "type": "input" }, - { - "name": "autoSetMeta", - "description": "Initializes meta tag inputs from SEO meta tags, default: true", - "type": "input" - }, { "name": "disabled", "description": "A boolean flag that indicates if share buttons clicks should be disabled", diff --git a/projects/ngx-sharebuttons-demo/src/assets/data/directive-api.json b/projects/ngx-sharebuttons-demo/src/assets/data/directive-api.json index 23d0c196..66b1db43 100644 --- a/projects/ngx-sharebuttons-demo/src/assets/data/directive-api.json +++ b/projects/ngx-sharebuttons-demo/src/assets/data/directive-api.json @@ -11,12 +11,12 @@ }, { "name": "title", - "description": "Override title meta tag for LinkedIn and Reddit, default: null", + "description": "Override title meta tag for Reddit and Email, default: null", "type": "input" }, { "name": "description", - "description": "Override description meta tag for LinkedIn, WhatsApp, Telegram and Pinterest, default: null", + "description": "Override description meta tag for WhatsApp, Telegram, Viber, SMS, Email and Pinterest, default: null", "type": "input" }, { diff --git a/projects/ngx-sharebuttons/README.md b/projects/ngx-sharebuttons/README.md index 7b8dba61..ac86ec01 100644 --- a/projects/ngx-sharebuttons/README.md +++ b/projects/ngx-sharebuttons/README.md @@ -1,7 +1,7 @@

Angular Share Buttons

-

Capture

+

Capture

[![Demo](https://img.shields.io/badge/demo-online-ed1c46.svg)](https://ngx-sharebuttons.netlify.app/) @@ -18,17 +18,10 @@ For the documentation see the [WIKI](https://github.com/MurhafSousli/ngx-sharebuttons/wiki) page. -## Packages - -- **ngx-sharebuttons** - Share button directive to convert any element to a share button. -- **ngx-sharebuttons/button** - Share button component to add buttons individually. -- **ngx-sharebuttons/buttons** - Share buttons component to add a collection of share buttons. -- **ngx-sharebuttons/icons** - Simplifies import the share icons from FontAwesome. - ## Available buttons 1. Facebook -2. Twitter +2. X (Twitter) 3. LinkedIn 4. Pinterest 5. WhatsApp @@ -46,20 +39,10 @@ For the documentation see the [WIKI](https://github.com/MurhafSousli/ngx-sharebu 17. Copy link 18. Print - -#### Need more buttons? - -> The plugin allows you to add your own buttons as well. if you like to add a new share button to this package feel free to submit a PR, or open an issue with dev docs link of the social network you want to include. - - ## Issues If you identify any errors in this component, or have an idea for an improvement, please open an [issue](https://github.com/MurhafSousli/ngx-sharebuttons/issues). -## Support - -[![npm](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/bePatron?u=5594898) - ## Author **Murhaf Sousli** @@ -73,37 +56,6 @@ If you identify any errors in this component, or have an idea for an improvement - [ngx-progressbar](https://github.com/MurhafSousli/ngx-progressbar) - [ngx-bar-rating](https://github.com/MurhafSousli/ngx-bar-rating) - [ngx-disqus](https://github.com/MurhafSousli/ngx-disqus) -- [ngx-wordpress](https://github.com/MurhafSousli/ngx-wordpress) - [ngx-highlightjs](https://github.com/MurhafSousli/ngx-highlightjs) - [ngx-scrollbar](https://github.com/MurhafSousli/ngx-scrollbar) - [ngx-teximate](https://github.com/MurhafSousli/ngx-teximate) - -## Contributors - -### Code Contributors - -This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. - - -### Financial Contributors - -Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/ngx-sharebuttons/contribute)] - -#### Individuals - - - -#### Organizations - -Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/ngx-sharebuttons/contribute)] - - - - - - - - - - - diff --git a/projects/ngx-sharebuttons/buttons/src/expand-button.ts b/projects/ngx-sharebuttons/buttons/src/expand-button.ts index cbffa4d0..8901696d 100644 --- a/projects/ngx-sharebuttons/buttons/src/expand-button.ts +++ b/projects/ngx-sharebuttons/buttons/src/expand-button.ts @@ -1,4 +1,4 @@ -import { Component, Input, Output, EventEmitter, ElementRef, ChangeDetectionStrategy, inject } from '@angular/core'; +import { Component, Input, Output, EventEmitter, ElementRef, ChangeDetectionStrategy } from '@angular/core'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; import { ShareButtonsConfig } from 'ngx-sharebuttons'; @@ -26,6 +26,7 @@ export class ExpandButton { @Input() options: ShareButtonsConfig; @Input() expand: boolean; + @Output() expandChange: EventEmitter = new EventEmitter(); constructor(el: ElementRef) { diff --git a/projects/ngx-sharebuttons/package.json b/projects/ngx-sharebuttons/package.json index 02db582e..b391d930 100644 --- a/projects/ngx-sharebuttons/package.json +++ b/projects/ngx-sharebuttons/package.json @@ -1,11 +1,10 @@ { "name": "ngx-sharebuttons", - "version": "v14.0.0-beta.1", + "version": "14.0.0", "peerDependencies": { "@angular/common": ">=17.0.0", "@angular/core": ">=17.0.0", - "@angular/cdk": ">=17.0.0", - "rxjs": ">=7.0.0" + "@angular/cdk": ">=17.0.0" }, "dependencies": { "tslib": "^2.3.0" diff --git a/projects/ngx-sharebuttons/src/lib/share.models.ts b/projects/ngx-sharebuttons/src/lib/share.models.ts index 389ac7aa..228a1e4a 100644 --- a/projects/ngx-sharebuttons/src/lib/share.models.ts +++ b/projects/ngx-sharebuttons/src/lib/share.models.ts @@ -1,8 +1,7 @@ import { InjectionToken, Provider, WritableSignal } from '@angular/core'; import { Clipboard } from '@angular/cdk/clipboard'; -import { Observable } from 'rxjs'; -import { ShareButtonProp } from './share.defaults'; import { IconProp } from '@fortawesome/fontawesome-svg-core'; +import { ShareButtonProp } from './share.defaults'; export const SHARE_BUTTONS_CONFIG: InjectionToken = new InjectionToken('shareButtonsConfig'); diff --git a/projects/ngx-sharebuttons/src/lib/share.service.ts b/projects/ngx-sharebuttons/src/lib/share.service.ts index 7b7e5236..580ca3cd 100644 --- a/projects/ngx-sharebuttons/src/lib/share.service.ts +++ b/projects/ngx-sharebuttons/src/lib/share.service.ts @@ -107,7 +107,7 @@ export class ShareService { if (computedParams[key]) { // Check if param has a resolver function const resolver: ShareParamsFunc = shareButton.paramsFunc?.[key]; - params[realKey] = resolver ? resolver(shareButton.params) : computedParams[key]; + params[realKey] = resolver ? resolver(computedParams) : computedParams[key]; } return params; }, {});