diff --git a/node_modules/lucide-vue-next/dist/esm/createLucideIcon.js b/node_modules/lucide-vue-next/dist/esm/createLucideIcon.js index 0678861..b359b1e 100644 --- a/node_modules/lucide-vue-next/dist/esm/createLucideIcon.js +++ b/node_modules/lucide-vue-next/dist/esm/createLucideIcon.js @@ -5,18 +5,57 @@ * See the LICENSE file in the root directory of this source tree. */ -import { h } from 'vue'; +import { renderToString } from '@vue/server-renderer' +import { h, ref, watchEffect, createApp, defineComponent } from 'vue'; import Icon from './Icon.js'; -const createLucideIcon = (iconName, iconNode) => (props, { slots }) => h( - Icon, - { - ...props, - iconNode, - name: iconName - }, - slots -); +const createLucideIcon = (iconName, iconNode) => defineComponent((props, { slots }) => { + const svgHtml = ref(null); + const cssColor = ref(''); + + watchEffect(() => { + const color = props.color || cssColor.value || undefined; + const fill = props.fill === 'currentcolor' ? cssColor.value : props.fill || 'none'; + const app = createApp(h( + Icon, + { + ...props, + iconNode, + name: iconName, + color, + fill + }, + slots + )); + renderToString(app).then((html) => { + svgHtml.value = html + }); + }); + + function onCssColorChange(args) { + cssColor.value = args?.value?.hex; + } + + function onLoaded(args) { + const view = args.object; + view?.style.addEventListener('colorChange', onCssColorChange); + cssColor.value = view?.style?.color?.hex; + } + + function onUnloaded(args) { + args?.object?.style.removeEventListener('colorChange', onCssColorChange); + } + + return () => svgHtml.value ? h("SVGView", { + src: svgHtml.value, + height: props.size, + width: props.size, + onUnloaded, + onLoaded, + }) : null; +}, { + props: ['size', 'color', 'strokeWidth', 'absoluteStrokeWidth', 'defaultClass', 'fill'] +}); export { createLucideIcon as default }; //# sourceMappingURL=createLucideIcon.js.map