UNPKG

@poupe/vue

Version:

Vue component library for Poupe UI framework with theme customization and accessibility support

37 lines (36 loc) 1.12 kB
const components = [ "Button", "Card", "Icon", "Input", "Placeholder", "Surface" ]; const themeComponents = ["ThemeScheme"]; const DEFAULT_PREFIX = "P"; const normalizedComponentPrefix = (s) => { return s.replaceAll(/^[-_]+|[-_]+$/g, "").replaceAll(/(^|[-_]+)([a-z])/g, (_, prefix, char) => char.toUpperCase()); }; const createResolver = (options = {}) => { const { prefix: $prefix = "P" } = options; const prefix = normalizedComponentPrefix($prefix); return { type: "component", resolve: (name) => { const componentName = prefix ? stripPrefix(name, prefix) : name; if (componentName) { if (components.includes(componentName)) return { name: componentName, from: "@poupe/vue" }; if (themeComponents.includes(componentName)) return { name: componentName, from: "@poupe/vue/theme-scheme" }; } } }; }; const stripPrefix = (name, prefix) => name.startsWith(prefix) ? name.slice(prefix.length) : void 0; export { DEFAULT_PREFIX, components, createResolver, createResolver as default, normalizedComponentPrefix, themeComponents }; //# sourceMappingURL=index.mjs.map