@components-1812/svg-isolate
v0.0.1
Published
Custom SVG Isolate element
Maintainers
Readme
SVG Isolate Custom Element

In this example we have 4 svg:
circle.svg,triangle.svg,hexagon.svgandheart.svgEach one is using the same clipPath id
id="clipPath"and this generates a conflict in the light DOM.But using the
<custom-svg-isolate>wrapper we can isolate the svg in shadow DOM and avoid ids and classes conflicts.
Attributes
Reactive attributes
src: Path to the svg file. Changes trigger theloadSVGmethod.At init time, if the
srcattribute is not set, the svg in the light DOM is used.<custom-svg-isolate> <svg width="200" height="200"><!-- SVG content --></svg> </custom-svg-isolate>
Ready attributes
ready: Set when the component is ready, and the svg is loaded in the shadow DOM. Set every time you change thesrcattribute or callloadSVGmethod.ready-links: Set when the links stylesheets are loaded.
Events
ready: Dispatched when the component is ready, and the svg is loaded in the shadow DOM. shoot every time you change thesrcattribute or callloadSVGmethod.ready-links: Dispatched when the links stylesheets are loaded.
Methods
async loadSVG(src): Load an svg from a path and replace the current svg in the shadow DOM.
License
MIT
