feat: add Nuxt.js integration wrapper and demo documentation#148
feat: add Nuxt.js integration wrapper and demo documentation#148amankv1234 wants to merge 23 commits into
Conversation
- Added try-catch blocks to createButton and _getContainer to handle invalid CSS selectors. - Improved fallbackCopy error visibility by logging to _debugWarn. - Fixed HTML syntax error in index.html (removed stray closing div). - Removed duplicate CTA section in index.html for cleaner code. - Ran project-wide formatting and linting. Closes AOSSIE-Org#132
- Implemented defensive try-catch blocks for container selector resolution. - Refactored createButton() to deduplicate logic via _getContainer() helper. - Enhanced fallbackCopy() to log clipboard errors using the _debugWarn helper. - Fixed a SyntaxError in index.html and removed a redundant CTA section. - Ran project-wide formatting and linting for full code consistency. Closes AOSSIE-Org#132
- Implemented defensive try-catch blocks for container selector resolution. - Added DOM Element type safety check in _getContainer() to prevent crashes. - Refactored createButton() to deduplicate logic via _getContainer() helper. - Enhanced fallbackCopy() to log clipboard errors using the _debugWarn helper. - Fixed a SyntaxError in index.html and removed a redundant CTA section. - Ran project-wide formatting and linting for full code consistency. Closes AOSSIE-Org#132
- Added a new 'WordPress Integration' section to index.html with step-by-step instructions. - Included PHP code snippets for enqueuing assets in unctions.php via standard WordPress hooks (wp_enqueue_scripts, wp_footer). - Implemented copy-to-clipboard functionality for the new code blocks. - Updated README.md to list WordPress as a formally supported platform. Fixes AOSSIE-Org#52, Fixes AOSSIE-Org#112
- Replaced raw => characters with the HTML-escaped => equivalent in the Qwik component code block within index.html. - Resolves potential HTML linting/validation errors caused by raw greater-than signs inside <code> tags.
- Replaced incorrect npm CDN URLs with the correct jsDelivr + GitHub CDN pointing to AOSSIE-Org/SocialShareButton@v1.0.4 in both index.html and README.md. - Updated wp_footer add_action priority from default (10) to 21 so enqueued footer scripts are printed before initialization runs. - Added a note in README clarifying the package is not published to npm.
- Removed his._debugWarn logging inside the allbackCopy method's catch block within src/social-share-button.js. - The failed copy action is now completely silent internally (since old browsers gracefully failing to copy isn't an unexpected app error), but still visually updates the UI button text to
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThe PR adds a Nuxt.js wrapper component, expands README and demo coverage for WordPress and Nuxt.js, updates Preact integration defaults and CDN references, improves demo clipboard copying, and hardens core container resolution. ChangesIntegration Expansion & Library Hardening
Sequence Diagram(s)sequenceDiagram
participant NuxtWrapper as src/social-share-button-nuxt.vue
participant SocialShareButton as window.SocialShareButton
participant ContainerRef as container ref
NuxtWrapper->>NuxtWrapper: onMounted() checks window and window.SocialShareButton
NuxtWrapper->>SocialShareButton: new window.SocialShareButton({ container, url, title, ... })
SocialShareButton->>ContainerRef: render share button into container
NuxtWrapper->>SocialShareButton: watch(props) -> updateOptions(newProps)
NuxtWrapper->>SocialShareButton: onBeforeUnmount() -> destroy()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@index.html`:
- Around line 569-609: The Nuxt integration docs miss instructions for acquiring
the wrapper file social-share-button-nuxt.vue; update the Nuxt.js Integration
section to explicitly tell users how to obtain that file (e.g., copy
social-share-button-nuxt.vue from the repository's src/ or components/ folder
into their Nuxt project's components/, install via the package if published on
npm, or download a raw file link), and include a short note that the wrapper is
not on the CDN until the next release and must be added manually until then;
reference the SocialShareButton usage example and mention
social-share-button-nuxt.vue by name so users know where to place it.
- Around line 611-647: The Next.js, Vue/Vite and Angular demo blocks are missing
the copy button UI pattern; add a <button type="button" class="copy-btn">
element and a <span class="copy-status"> next to each code-block in those
sections so they match the React/Preact/WordPress/Qwik/Nuxt examples, and ensure
the button markup references the same copy handler identifiers used elsewhere
(i.e., same class names/data attributes your copy script expects) so the
existing copy behavior works without changing the copy script or handlers.
In `@README.md`:
- Line 75: Add a Nuxt.js integration section to README.md (or at minimum a
cross-reference to the Nuxt demo in index.html) so Nuxt isn't advertised without
instructions; create a <details><summary><b>💚 Nuxt.js</b></summary> block
mirroring the WordPress integration block with copy-paste install/run snippets
or a clear link to the index.html demo, and while doing so audit any
CDN/npm/download URLs in README and index.html to ensure they reference the new
file version (update acquisition instructions if they point to an older build).
- Around line 502-506: The README WordPress CDN URLs reference an unreleased tag
`@v1.0.4` which will break until that release exists; update the CDN URLs in the
WordPress integration snippet to use the current released version `@v1.0.3` (the
two URLs pointing to social-share-button.css and social-share-button.js) or, if
you intend to ship these new wrapper files (src/social-share-button-nuxt.vue,
src/social-share-button-preact.jsx, src/social-share-button-react.jsx,
src/social-share-button-qwik.tsx) immediately, coordinate this PR merge with
creating and pushing a v1.0.4 release tag so the CDN paths remain correct.
In `@src/social-share-button-nuxt.vue`:
- Around line 8-28: The props object defined via defineProps is missing
buttonColor, buttonHoverColor, and showButton which the core SocialShareButton
library expects; add these three props to the props declaration (names:
buttonColor, buttonHoverColor, showButton) with appropriate types and defaults,
and ensure the onMounted initialization (where SocialShareButton is
configured/instantiated) reads these props and passes them into the library
options so the wrapper matches the vanilla API.
In `@src/social-share-button.js`:
- Around line 679-702: The _getContainer() method currently calls
this._debugWarn("Provided container is not a valid DOM Element", { container }),
but _debugWarn is documented to accept (message, err) where err should be an
Error; change this call in _getContainer to pass an Error (e.g., new Error with
the container info in the message or attach container on the Error) or pass null
as the second arg to match the JSDoc signature and keep the container details in
the message string, updating only the call site in _getContainer and leaving
_debugWarn implementation unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a77fddeb-27dd-4012-96c2-d82e68ae47ee
📒 Files selected for processing (13)
CONTRIBUTING.mdREADME.mddocs/Roadmap.mdeslint.config.jsindex.htmllanding-page/README.mdlanding-page/src/app/globals.csssrc/social-share-analytics.jssrc/social-share-button-nuxt.vuesrc/social-share-button-preact.jsxsrc/social-share-button-react.jsxsrc/social-share-button.csssrc/social-share-button.js
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
index.html (1)
623-629:⚠️ Potential issue | 🟡 MinorRestore the copy controls for these three integration blocks.
The clipboard handler only wires
.copy-btn, so the Next.js, Vue/Vite, and Angular sections are now the only framework demos without copy UI oraria-livefeedback.Also applies to: 636-642, 649-653
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@index.html` around lines 623 - 629, The three integration code blocks for Next.js (the Home component with SocialShareButton), Vue/Vite, and Angular are missing the copy UI and aria-live feedback because the clipboard handler only targets elements with the .copy-btn class; restore each block's copy control by adding a button element with class "copy-btn" and the appropriate label/icon and by including an aria-live region (e.g., a span with aria-live="polite" and a unique id) near the block so the existing clipboard handler can announce success/failure; ensure the Next.js Home/SocialShareButton block and the Vue/Vite and Angular snippets include the same .copy-btn markup and aria-live element so they integrate with the existing clipboard handler.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@index.html`:
- Around line 555-558: The script tag(s) for the SocialShareButton CDN in the
Qwik/Nuxt examples are currently blocking; update the script include(s) (the
<script
src="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.4/src/social-share-button.js">
instances) to use deferred loading by adding the defer attribute so they don't
block parsing (also update the matching snippet at the other occurrence around
lines 582-585 to be consistent).
- Around line 494-499: The wp snippet's inline comment inside the
wp_enqueue_script call is accidentally commenting out the closing ");", the
function closing "}" and the add_action call; fix the
enqueue_social_share_button function by moving or removing the inline comment so
the wp_enqueue_script call ends with ), null, true ); then close the function
with } and re-add the
add_action('wp_enqueue_scripts','enqueue_social_share_button'); line; ensure the
symbols enqueue_social_share_button, wp_enqueue_style, wp_enqueue_script and
add_action are intact and properly terminated.
---
Duplicate comments:
In `@index.html`:
- Around line 623-629: The three integration code blocks for Next.js (the Home
component with SocialShareButton), Vue/Vite, and Angular are missing the copy UI
and aria-live feedback because the clipboard handler only targets elements with
the .copy-btn class; restore each block's copy control by adding a button
element with class "copy-btn" and the appropriate label/icon and by including an
aria-live region (e.g., a span with aria-live="polite" and a unique id) near the
block so the existing clipboard handler can announce success/failure; ensure the
Next.js Home/SocialShareButton block and the Vue/Vite and Angular snippets
include the same .copy-btn markup and aria-live element so they integrate with
the existing clipboard handler.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 40210eb6-5176-4ad3-b7e7-f1035bc71fad
📒 Files selected for processing (1)
index.html
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 489-576: The Preact documentation block still uses the CDN version
tag `@v1.0.4`; update the Preact CDN URLs to use `@v1.0.3` so they match the
WordPress/Nuxt examples. Locate the Preact section that references the jsDelivr
GitHub CDN for the Preact distributables (the links referencing `@v1.0.4` and the
Preact files like social-share-button-preact.js / .css) and replace the version
suffix `@v1.0.4` with `@v1.0.3` in both stylesheet and script URLs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0ee5ad61-9a47-4c22-a60a-9b5a39fad09e
📒 Files selected for processing (4)
README.mdindex.htmlsrc/social-share-button-nuxt.vuesrc/social-share-button.js
|
Hi @kpj2006 , I would like to request you to kindly review my PR. If everything looks good, please consider merging it. Your feedback would really help me improve and contribute more effectively to the project. Looking forward to your response. Thank you! |
|
Hello 👋 This PR has had no activity for more than 2 weeks. If you are still working on it, please push an update or leave a comment. Ping a maintainer if you believe it is ready for review or merge! This PR will be automatically closed in 7 days if there is no further activity. |
|
Please resolve the merge conflicts before review. Your PR will only be reviewed by a maintainer after all conflicts have been resolved. 📺 Watch this video to understand why conflicts occur and how to resolve them: |
|
Hi @kpj2006 , I have resolved all the conflicts in my PR. Could you please review and merge it when you get a chance? I’m eager to continue contributing to the project and work on further tasks. Thank you! |
|
@amankv1234 complete all acceptance criteria mentioned in issue if any left (ask coderabbit in chat for clarification in pr chat )and made an video showcasing https://github.com/AOSSIE-Org/SocialShareButton/blob/main/docs/demo-video-instruction.md |
|
Hi @kpj2006, I have completed the Nuxt.js integration and thoroughly checked all the Acceptance Criteria. Everything is working perfectly and all checks are passing. Here is the quick summary of what's been done:
📹 Integration Demo Video: https://drive.google.com/file/d/1ItSRZnlNxMAeskWXpk-egVKyNs_Vrs2k/view?usp=sharing Please review the PR. Let me know if any further changes are required, otherwise, it's ready to be merged! Thanks! |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/social-share-button.js (1)
89-93:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGate initialization when container resolution fails.
createButton()now skips append when_getContainer()returnsnull, butinit()still creates/appends the modal and binds listeners. With an invalid selector/non-element container, this leaves orphan DOM and handlers indocument.body. Fail fast beforecreateModal()/attachEvents()when container cannot be resolved.Suggested fix
init() { + const container = this._getContainer(); + if (!container) return; + if (this.options.showButton) { - this.createButton(); + this.createButton(); } this.createModal(); this.attachEvents(); this.applyCustomColors(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/social-share-button.js` around lines 89 - 93, The init() method currently creates the modal and binds event listeners before checking if the container can be properly resolved, which leaves orphan DOM elements and handlers when _getContainer() returns null. Add a guard clause at the beginning of the init() method that checks if _getContainer() returns a valid container before proceeding with createModal() and attachEvents(). If the container cannot be resolved, the method should return early to prevent initialization of modal and event listeners on an invalid container.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 646-647: Remove the empty markdown list item that appears after
the Discord bullet point. The blank dash on the second line of the diff creates
an empty list entry that renders incorrectly in the documentation. Simply delete
the entire empty line containing only the dash character to resolve the
rendering issue.
In `@src/social-share-button-preact.jsx`:
- Line 18: The platforms array in the Preact wrapper is missing "pinterest"
which breaks prop parity with the React wrapper. Update the platforms array
assignment to include "pinterest" in the same position as the React wrapper,
specifically adding it between "reddit" and "discord" in the platforms array to
maintain consistency across both integrations.
---
Outside diff comments:
In `@src/social-share-button.js`:
- Around line 89-93: The init() method currently creates the modal and binds
event listeners before checking if the container can be properly resolved, which
leaves orphan DOM elements and handlers when _getContainer() returns null. Add a
guard clause at the beginning of the init() method that checks if
_getContainer() returns a valid container before proceeding with createModal()
and attachEvents(). If the container cannot be resolved, the method should
return early to prevent initialization of modal and event listeners on an
invalid container.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: cec05846-1f13-4d2e-bf6d-f3aeac7bad9c
📒 Files selected for processing (5)
README.mdindex.htmlsrc/social-share-button-preact.jsxsrc/social-share-button-react.jsxsrc/social-share-button.js
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/social-share-button.js (1)
89-93:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGate initialization when container resolution fails.
createButton()now skips append when_getContainer()returnsnull, butinit()still creates/appends the modal and binds listeners. With an invalid selector/non-element container, this leaves orphan DOM and handlers indocument.body. Fail fast beforecreateModal()/attachEvents()when container cannot be resolved.Suggested fix
init() { + const container = this._getContainer(); + if (!container) return; + if (this.options.showButton) { - this.createButton(); + this.createButton(); } this.createModal(); this.attachEvents(); this.applyCustomColors(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/social-share-button.js` around lines 89 - 93, The init() method currently creates the modal and binds event listeners before checking if the container can be properly resolved, which leaves orphan DOM elements and handlers when _getContainer() returns null. Add a guard clause at the beginning of the init() method that checks if _getContainer() returns a valid container before proceeding with createModal() and attachEvents(). If the container cannot be resolved, the method should return early to prevent initialization of modal and event listeners on an invalid container.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 646-647: Remove the empty markdown list item that appears after
the Discord bullet point. The blank dash on the second line of the diff creates
an empty list entry that renders incorrectly in the documentation. Simply delete
the entire empty line containing only the dash character to resolve the
rendering issue.
In `@src/social-share-button-preact.jsx`:
- Line 18: The platforms array in the Preact wrapper is missing "pinterest"
which breaks prop parity with the React wrapper. Update the platforms array
assignment to include "pinterest" in the same position as the React wrapper,
specifically adding it between "reddit" and "discord" in the platforms array to
maintain consistency across both integrations.
---
Outside diff comments:
In `@src/social-share-button.js`:
- Around line 89-93: The init() method currently creates the modal and binds
event listeners before checking if the container can be properly resolved, which
leaves orphan DOM elements and handlers when _getContainer() returns null. Add a
guard clause at the beginning of the init() method that checks if
_getContainer() returns a valid container before proceeding with createModal()
and attachEvents(). If the container cannot be resolved, the method should
return early to prevent initialization of modal and event listeners on an
invalid container.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: cec05846-1f13-4d2e-bf6d-f3aeac7bad9c
📒 Files selected for processing (5)
README.mdindex.htmlsrc/social-share-button-preact.jsxsrc/social-share-button-react.jsxsrc/social-share-button.js
🛑 Comments failed to post (2)
README.md (1)
646-647:
⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRemove the empty markdown list item.
Line 647 contains a blank bullet (
-) that renders as an empty list entry in the docs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 646 - 647, Remove the empty markdown list item that appears after the Discord bullet point. The blank dash on the second line of the diff creates an empty list entry that renders incorrectly in the documentation. Simply delete the entire empty line containing only the dash character to resolve the rendering issue.src/social-share-button-preact.jsx (1)
18-18:
⚠️ Potential issue | 🟠 Major | ⚡ Quick winPlatform array missing "pinterest" compared to React wrapper—breaks prop parity.
The Preact wrapper's default
platformslist excludes"pinterest", while the React wrapper includes it:["whatsapp", "facebook", "twitter", "linkedin", "telegram", "reddit", "pinterest", "discord"]. This breaks the prop-parity objective stated in the PR description ("full prop parity with other integrations") and prevents Preact users from sharing to Pinterest.🔧 Proposed fix to match React wrapper
- platforms = ["whatsapp", "facebook", "twitter", "linkedin", "telegram", "reddit", "discord"], + platforms = ["whatsapp", "facebook", "twitter", "linkedin", "telegram", "reddit", "pinterest", "discord"],🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/social-share-button-preact.jsx` at line 18, The platforms array in the Preact wrapper is missing "pinterest" which breaks prop parity with the React wrapper. Update the platforms array assignment to include "pinterest" in the same position as the React wrapper, specifically adding it between "reddit" and "discord" in the platforms array to maintain consistency across both integrations.
…t, add guard clause in init
|
Please resolve the merge conflicts before review. Your PR will only be reviewed by a maintainer after all conflicts have been resolved. 📺 Watch this video to understand why conflicts occur and how to resolve them: |
|
Please resolve the merge conflicts before review. Your PR will only be reviewed by a maintainer after all conflicts have been resolved. 📺 Watch this video to understand why conflicts occur and how to resolve them: |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/social-share-button.js (1)
715-716: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winTighten the cross-frame container validation.
nodeType === 1also accepts plain objects, soinit()can now pass this guard with something like{ nodeType: 1 }, and the library will still crash later whencreateButton()callsappendChild()or_emit()callsdispatchEvent(). Validate DOM behavior as well, or resolve the properElementconstructor fromownerDocument.defaultViewbefore accepting the container.Suggested fix
- if (container && !(container instanceof Element || container.nodeType === 1)) { + const isDomElement = + !!container && + ((typeof Element !== "undefined" && container instanceof Element) || + (container.nodeType === 1 && + typeof container.appendChild === "function" && + typeof container.dispatchEvent === "function")); + + if (container && !isDomElement) { this._debugWarn(`Provided container is not a valid DOM Element: ${container}`, null); return null; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/social-share-button.js` around lines 715 - 716, Tighten the container validation in init() so non-DOM objects with nodeType === 1 do not pass the guard. Update the check around the container validation to ensure the value is a real Element with DOM behavior, either by resolving Element from container.ownerDocument.defaultView for cross-frame cases or by verifying appendChild/dispatchEvent-compatible DOM methods before accepting it. Keep the existing _debugWarn path in place for invalid containers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@index.html`:
- Around line 564-566: The CDN URLs in the HTML snippet are using the unreleased
SocialShareButton tag v1.0.4, which causes the stylesheet and script to 404.
Update the version string in both the href and src references to the stable
v1.0.3 tag in the same HTML block so the assets load correctly.
- Around line 569-572: The Qwik snippet inside the `<code>` sample contains a
raw arrow-function `>` that is causing the HTMLHint failure. Update the example
in the `component$`/`SocialShareButton` sample so the arrow token is escaped as
`=>` while keeping the rest of the snippet unchanged. Make sure the fix is
applied in the code sample content, not in the rendered component logic, so the
HTML remains valid and the snippet still reads correctly.
---
Outside diff comments:
In `@src/social-share-button.js`:
- Around line 715-716: Tighten the container validation in init() so non-DOM
objects with nodeType === 1 do not pass the guard. Update the check around the
container validation to ensure the value is a real Element with DOM behavior,
either by resolving Element from container.ownerDocument.defaultView for
cross-frame cases or by verifying appendChild/dispatchEvent-compatible DOM
methods before accepting it. Keep the existing _debugWarn path in place for
invalid containers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0cd38e0e-3abe-4bac-9ecf-5ffe73cbeaa4
📒 Files selected for processing (4)
README.mdindex.htmlsrc/social-share-button-preact.jsxsrc/social-share-button.js
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/social-share-button.js (1)
715-716: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winTighten the cross-frame container validation.
nodeType === 1also accepts plain objects, soinit()can now pass this guard with something like{ nodeType: 1 }, and the library will still crash later whencreateButton()callsappendChild()or_emit()callsdispatchEvent(). Validate DOM behavior as well, or resolve the properElementconstructor fromownerDocument.defaultViewbefore accepting the container.Suggested fix
- if (container && !(container instanceof Element || container.nodeType === 1)) { + const isDomElement = + !!container && + ((typeof Element !== "undefined" && container instanceof Element) || + (container.nodeType === 1 && + typeof container.appendChild === "function" && + typeof container.dispatchEvent === "function")); + + if (container && !isDomElement) { this._debugWarn(`Provided container is not a valid DOM Element: ${container}`, null); return null; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/social-share-button.js` around lines 715 - 716, Tighten the container validation in init() so non-DOM objects with nodeType === 1 do not pass the guard. Update the check around the container validation to ensure the value is a real Element with DOM behavior, either by resolving Element from container.ownerDocument.defaultView for cross-frame cases or by verifying appendChild/dispatchEvent-compatible DOM methods before accepting it. Keep the existing _debugWarn path in place for invalid containers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@index.html`:
- Around line 564-566: The CDN URLs in the HTML snippet are using the unreleased
SocialShareButton tag v1.0.4, which causes the stylesheet and script to 404.
Update the version string in both the href and src references to the stable
v1.0.3 tag in the same HTML block so the assets load correctly.
- Around line 569-572: The Qwik snippet inside the `<code>` sample contains a
raw arrow-function `>` that is causing the HTMLHint failure. Update the example
in the `component$`/`SocialShareButton` sample so the arrow token is escaped as
`=>` while keeping the rest of the snippet unchanged. Make sure the fix is
applied in the code sample content, not in the rendered component logic, so the
HTML remains valid and the snippet still reads correctly.
---
Outside diff comments:
In `@src/social-share-button.js`:
- Around line 715-716: Tighten the container validation in init() so non-DOM
objects with nodeType === 1 do not pass the guard. Update the check around the
container validation to ensure the value is a real Element with DOM behavior,
either by resolving Element from container.ownerDocument.defaultView for
cross-frame cases or by verifying appendChild/dispatchEvent-compatible DOM
methods before accepting it. Keep the existing _debugWarn path in place for
invalid containers.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0cd38e0e-3abe-4bac-9ecf-5ffe73cbeaa4
📒 Files selected for processing (4)
README.mdindex.htmlsrc/social-share-button-preact.jsxsrc/social-share-button.js
🛑 Comments failed to post (2)
index.html (2)
564-566: 🎯 Functional Correctness | 🔴 Critical
🧩 Analysis chain
🌐 Web query:
`Has AOSSIE-Org/SocialShareButton published tag v1.0.4, and are these jsDelivr URLs available?
- https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.4/src/social-share-button.css
- https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.4/src/social-share-button.js
Also confirm whether the project docs were intended to standardize framework CDN snippets on v1.0.3.`💡 Result:
As of June 26, 2026, AOSSIE-Org/SocialShareButton has not published a v1.0.4 tag [1][2][3]. Consequently, the jsDelivr URLs referencing v1.0.4 are not available and will result in 404 errors [2][3]. Regarding the project documentation, it was intended to standardize framework CDN snippets on v1.0.3 [3]. During the development of various framework integrations (such as Nuxt, Preact, and Qwik), contributors identified that documentation snippets were prematurely referencing the unreleased v1.0.4 tag, causing broken links [2][3]. Reviewers explicitly instructed that these snippets be updated to use the stable v1.0.3 version until a v1.0.4 release is officially tagged and pushed to the repository [3]. Following this feedback, commits were made to revert or update these CDN paths to either v1.0.3 or
@latestto ensure accessibility [1][4].Citations:
Update the Qwik framework CDN version to v1.0.3 to prevent 404 errors.
The provided snippet references the unreleased tag
@v1.0.4. This tag does not exist in theAOSSIE-Org/SocialShareButtonrepository, causing thejsDelivrlinks for both the CSS and JS assets to return 404 errors.Update the version string to the current stable release
@v1.0.3to ensure the library loads correctly.Snippet to update
href="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.css"> <script src="https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.js"></script>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@index.html` around lines 564 - 566, The CDN URLs in the HTML snippet are using the unreleased SocialShareButton tag v1.0.4, which causes the stylesheet and script to 404. Update the version string in both the href and src references to the stable v1.0.3 tag in the same HTML block so the assets load correctly.
569-572: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Escape the raw
>in the Qwik code sample.Line 570 leaves the arrow-function
>unescaped inside<code>, which is the HTMLHint failure here. Encode it as=>so the snippet remains valid HTML and the page lints cleanly.Suggested fix
- './social-share-button-qwik'; export default component$(() => ( <SocialShareButton + './social-share-button-qwik'; export default component$(() => ( <SocialShareButton📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.import { component$ } from '`@builder.io/qwik`'; import { SocialShareButton } from './social-share-button-qwik'; export default component$(() => ( <SocialShareButton url="https://your-website.com" theme="light" buttonText="Share Now" buttonStyle="primary" /> ));</code🧰 Tools
🪛 HTMLHint (1.9.2)
[error] 570-570: Special characters must be escaped : [ > ].
(spec-char-escape)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@index.html` around lines 569 - 572, The Qwik snippet inside the `<code>` sample contains a raw arrow-function `>` that is causing the HTMLHint failure. Update the example in the `component$`/`SocialShareButton` sample so the arrow token is escaped as `=>` while keeping the rest of the snippet unchanged. Make sure the fix is applied in the code sample content, not in the rendered component logic, so the HTML remains valid and the snippet still reads correctly.Source: Linters/SAST tools
🚀 Addressed Issues
Fixes #48
📌 Description
This PR extends the library's ecosystem by adding first-class support for Nuxt.js (Vue 3 meta-framework).
Since Nuxt follows an SSR-first architecture, this implementation introduces a dedicated wrapper that:
Prevents server-side crashes during pre-rendering
Ensures proper client-side initialization of the component
✨ Key Changes
🔹 Core Wrapper
Created src/social-share-button-nuxt.vue
Built using Vue 3 Composition API (<script setup>) for modern and type-safe development
🔹 SSR Safety
Used onMounted lifecycle hook
Added typeof window !== "undefined" guards
Ensures safe handling of browser-only APIs (window, document)
🔹 Reactive Synchronization
Implemented deep watch on props
Keeps component in sync with dynamic updates (e.g., URL/title changes during navigation)
Uses shareButton.updateOptions()
🔹 Memory Hygiene
Calls shareButton.destroy() inside onBeforeUnmount
Prevents memory leaks in SPA environments
📸 Screenshots / Recordings
Added 💚 Nuxt.js Integration section in index.html demo page
📚 Documentation
Updated README.md
Added Nuxt.js to supported frameworks list
📝 Additional Notes
Works seamlessly with Nuxt 3 auto-import feature when placed inside the components/ directory
Code is fully linted and formatted using Prettier
Follows existing project structure and conventions
✅ Checklist
My code follows the project's code style and conventions
I have made corresponding changes to the documentation
My changes generate no new warnings or errors
I have joined the Discord server and will share this PR with maintainers
I have read the Contributing Guidelines
Summary by CodeRabbit
New Features
Bug Fixes
Documentation