Skip to content

Conversation

@kevinchappell
Copy link
Collaborator

  • fix: svg icon fetching
  • fix: loadResources, multiple tooltip dom
  • chore: update tests to work with new sprite logic

Copilot AI review requested due to automatic review settings November 13, 2025 02:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors SVG sprite handling from a DOM-injected approach to a bundled, in-memory approach for improved performance and reliability. The sprite is now bundled with the package and parsed in memory rather than fetched and inserted into the DOM. Icons are inlined when used, eliminating the need for xlink:href references.

Key changes include:

  • Bundled SVG sprite using Vite's ?raw import instead of remote fetching
  • In-memory sprite parsing with DOMParser instead of DOM insertion
  • Icon inlining by cloning symbol children directly into SVG elements
  • Removed unused component-corner icon and related styles
  • Updated test infrastructure to support bundled sprite in Node.js environment
  • Fixed multiple tooltip instantiation by creating single global instance

Reviewed Changes

Copilot reviewed 18 out of 25 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/lib/js/common/loaders.js Refactored sprite loading to use in-memory parsing instead of DOM injection; removed polyfill loading
src/lib/js/constants.js Added bundled sprite import; set default sprite URL to null to use bundled version
src/lib/js/common/dom.js Updated icon rendering to inline SVG content from in-memory sprite instead of using xlink references
src/lib/js/editor.js Moved SmartTooltip instantiation to module level to prevent multiple instances; removed await on resource loading
src/lib/js/config.js Removed polyfills config and isIE check; updated default sprite config to null
src/lib/js/common/helpers.mjs Removed deprecated isIE browser detection function
src/lib/js/components/component.js Removed component-corner icons from component tags
tools/test-setup.cjs Added sprite initialization for test environment using global function
tools/svg-loader.mjs New custom loader to handle SVG imports with ?raw suffix in Node.js tests
tools/mocks/sprite-init.mjs Test initialization module to populate loaded.formeoSprite
tools/generate-sprite.js Added prefixIds SVGO plugin configuration; converted callback to arrow function
package.json Updated test scripts to use experimental loader and import flags; updated contributor email
vite.config.lib.mjs Added dedupe and optimizeDeps config for @draggable/i18n
src/lib/sass/components/*.scss Removed .f-i-component-corner styles and related corner icon references
src/lib/icons/*.svg Optimized/minified multiple icon SVG files; deleted component-corner icon
src/lib/icons/formeo-sprite.svg Regenerated sprite with optimized icons and without component-corner
src/demo/js/options/index.js Commented out i18n location config (now bundled)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kevinchappell kevinchappell merged commit 64eb6f7 into main Nov 13, 2025
2 checks passed
@kevinchappell kevinchappell deleted the fix/svg-icons branch November 13, 2025 22:38
@kevinchappell
Copy link
Collaborator Author

🎉 This PR is included in version 4.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants