diff --git a/icons.js b/icons.js index c342375..9bf996c 100644 --- a/icons.js +++ b/icons.js @@ -1,4 +1,4 @@ -// Generated by build.js at 2024-11-13T00:05:09.492Z +// Generated by build.js at 2025-06-02T19:11:24.112Z export default { "a-b-2": " \n", @@ -55,6 +55,7 @@ export default { "alarm-minus": " \n", "alarm-off": " \n", "alarm-plus": " \n", + "alarm-smoke": " \n", "alarm-snooze": " \n", "alarm": " \n", "album-off": " \n", @@ -157,9 +158,13 @@ export default { "arrow-bar-down": " \n", "arrow-bar-left": " \n", "arrow-bar-right": " \n", + "arrow-bar-to-down-dashed": " \n", "arrow-bar-to-down": " \n", + "arrow-bar-to-left-dashed": " \n", "arrow-bar-to-left": " \n", + "arrow-bar-to-right-dashed": " \n", "arrow-bar-to-right": " \n", + "arrow-bar-to-up-dashed": " \n", "arrow-bar-to-up": " \n", "arrow-bar-up": " \n", "arrow-bear-left-2": " \n", @@ -327,8 +332,8 @@ export default { "article": " \n", "aspect-ratio-off": " \n", "aspect-ratio": " \n", - "assembly-off": " \n", - "assembly": " \n", + "assembly-off": " \n", + "assembly": " \n", "asset": " \n", "asterisk-simple": " \n", "asterisk": " \n", @@ -357,9 +362,12 @@ export default { "backpack": " \n", "backslash": " \n", "backspace": " \n", + "badge-2k": " \n", "badge-3d": " \n", + "badge-3k": " \n", "badge-4k": " \n", - "badge-8k": " \n", + "badge-5k": " \n", + "badge-8k": " \n", "badge-ad-off": " \n", "badge-ad": " \n", "badge-ar": " \n", @@ -502,6 +510,7 @@ export default { "blender": " \n", "blob": " \n", "blockquote": " \n", + "blocks": " \n", "bluetooth-connected": " \n", "bluetooth-off": " \n", "bluetooth-x": " \n", @@ -567,6 +576,7 @@ export default { "bowl-chopsticks": " \n", "bowl-spoon": " \n", "bowl": " \n", + "bowling": " \n", "box-align-bottom-left": " \n", "box-align-bottom-right": " \n", "box-align-bottom": " \n", @@ -988,10 +998,13 @@ export default { "broadcast-off": " \n", "broadcast": " \n", "browser-check": " \n", + "browser-maximize": " \n", + "browser-minus": " \n", "browser-off": " \n", - "browser-plus": " \n", + "browser-plus": " \n", + "browser-share": " \n", "browser-x": " \n", - "browser": " \n", + "browser": " \n", "brush-off": " \n", "brush": " \n", "bubble-minus": " \n", @@ -1052,6 +1065,7 @@ export default { "cactus-off": " \n", "cactus": " \n", "cake-off": " \n", + "cake-roll": " \n", "cake": " \n", "calculator-off": " \n", "calculator": " \n", @@ -1069,7 +1083,7 @@ export default { "calendar-exclamation": " \n", "calendar-heart": " \n", "calendar-minus": " \n", - "calendar-month": " \n", + "calendar-month": " \n", "calendar-off": " \n", "calendar-pause": " \n", "calendar-pin": " \n", @@ -1085,7 +1099,7 @@ export default { "calendar-time": " \n", "calendar-up": " \n", "calendar-user": " \n", - "calendar-week": " \n", + "calendar-week": " \n", "calendar-x": " \n", "calendar": " \n", "camera-ai": " \n", @@ -1118,7 +1132,7 @@ export default { "camper": " \n", "campfire": " \n", "cancel": " \n", - "candle": " \n", + "candle": " \n", "candy-off": " \n", "candy": " \n", "cane": " \n", @@ -1158,11 +1172,23 @@ export default { "carousel-vertical": " \n", "carrot-off": " \n", "carrot": " \n", + "cash-banknote-edit": " \n", + "cash-banknote-heart": " \n", + "cash-banknote-minus": " \n", + "cash-banknote-move-back": " \n", + "cash-banknote-move": " \n", "cash-banknote-off": " \n", - "cash-banknote": " \n", + "cash-banknote-plus": " \n", + "cash-banknote": " \n", + "cash-edit": " \n", + "cash-heart": " \n", + "cash-minus": " \n", + "cash-move-back": " \n", + "cash-move": " \n", "cash-off": " \n", + "cash-plus": " \n", "cash-register": " \n", - "cash": " \n", + "cash": " \n", "cast-off": " \n", "cast": " \n", "cat": " \n", @@ -1185,6 +1211,7 @@ export default { "certificate": " \n", "chair-director": " \n", "chalkboard-off": " \n", + "chalkboard-teacher": " \n", "chalkboard": " \n", "charging-pile": " \n", "chart-arcs-3": " \n", @@ -1534,6 +1561,9 @@ export default { "code-minus": " \n", "code-off": " \n", "code-plus": " \n", + "code-variable-minus": " \n", + "code-variable-plus": " \n", + "code-variable": " \n", "code": " \n", "coffee-off": " \n", "coffee": " \n", @@ -2090,8 +2120,8 @@ export default { "equal": " \n", "eraser-off": " \n", "eraser": " \n", - "error-404-off": " \n", - "error-404": " \n", + "error-404-off": " \n", + "error-404": " \n", "escalator-down": " \n", "escalator-up": " \n", "escalator": " \n", @@ -2105,10 +2135,10 @@ export default { "exposure-0": " \n", "exposure-minus-1": " \n", "exposure-minus-2": " \n", - "exposure-off": " \n", + "exposure-off": " \n", "exposure-plus-1": " \n", "exposure-plus-2": " \n", - "exposure": " \n", + "exposure": " \n", "external-link-off": " \n", "external-link": " \n", "eye-bitcoin": " \n", @@ -2152,7 +2182,7 @@ export default { "feather": " \n", "fence-off": " \n", "fence": " \n", - "ferry": " ", + "ferry": " \n", "fidget-spinner": " \n", "file-3d": " \n", "file-ai": " \n", @@ -2215,6 +2245,7 @@ export default { "file-star": " \n", "file-symlink": " \n", "file-text-ai": " \n", + "file-text-shield": " \n", "file-text-spark": " \n", "file-text": " \n", "file-time": " \n", @@ -2251,6 +2282,27 @@ export default { "file": " \n", "files-off": " \n", "files": " \n", + "filter-2-bolt": " \n", + "filter-2-cancel": " \n", + "filter-2-check": " \n", + "filter-2-code": " \n", + "filter-2-cog": " \n", + "filter-2-discount": " \n", + "filter-2-dollar": " \n", + "filter-2-down": " \n", + "filter-2-edit": " \n", + "filter-2-exclamation": " \n", + "filter-2-minus": " \n", + "filter-2-pause": " \n", + "filter-2-pin": " \n", + "filter-2-plus": " \n", + "filter-2-question": " \n", + "filter-2-search": " \n", + "filter-2-share": " \n", + "filter-2-spark": " \n", + "filter-2-up": " \n", + "filter-2-x": " \n", + "filter-2": " \n", "filter-bolt": " \n", "filter-cancel": " \n", "filter-check": " \n", @@ -2270,6 +2322,7 @@ export default { "filter-question": " \n", "filter-search": " \n", "filter-share": " \n", + "filter-spark": " \n", "filter-star": " \n", "filter-up": " \n", "filter-x": " \n", @@ -2318,7 +2371,7 @@ export default { "flag-x": " \n", "flag": " \n", "flame-off": " \n", - "flame": " \n", + "flame": " \n", "flare": " \n", "flask-2-off": " \n", "flask-2": " \n", @@ -2365,7 +2418,7 @@ export default { "folder-x": " \n", "folder": " \n", "folders-off": " \n", - "folders": " \n", + "folders": " \n", "forbid-2": " \n", "forbid": " \n", "forklift": " \n", @@ -2474,6 +2527,7 @@ export default { "h-6": " \n", "hammer-off": " \n", "hammer": " \n", + "hand-click-off": " \n", "hand-click": " \n", "hand-finger-down": " \n", "hand-finger-left": " \n", @@ -2656,16 +2710,26 @@ export default { "hours-12": " \n", "hours-24": " \n", "html": " \n", - "http-connect": " \n", - "http-delete": " \n", + "http-connect-off": " \n", + "http-connect": " \n", + "http-delete-off": " \n", + "http-delete": " \n", + "http-get-off": " \n", "http-get": " \n", + "http-head-off": " \n", "http-head": " \n", - "http-options": " \n", + "http-options-off": " \n", + "http-options": " \n", + "http-patch-off": " \n", "http-patch": " \n", - "http-post": " \n", + "http-post-off": " \n", + "http-post": " \n", + "http-put-off": " \n", "http-put": " \n", - "http-que": " \n", - "http-trace": " \n", + "http-que-off": " \n", + "http-que": " \n", + "http-trace-off": " \n", + "http-trace": " \n", "ice-cream-2": " \n", "ice-cream-off": " \n", "ice-cream": " \n", @@ -3116,6 +3180,7 @@ export default { "math-y-minus-y": " \n", "math-y-plus-y": " \n", "math": " \n", + "matrix": " \n", "maximize-off": " \n", "maximize": " \n", "meat-off": " \n", @@ -3237,7 +3302,13 @@ export default { "mist": " \n", "mobiledata-off": " \n", "mobiledata": " \n", - "moneybag": " \n", + "moneybag-edit": " \n", + "moneybag-heart": " \n", + "moneybag-minus": " \n", + "moneybag-move-back": " \n", + "moneybag-move": " \n", + "moneybag-plus": " \n", + "moneybag": " \n", "monkeybar": " \n", "mood-angry": " \n", "mood-annoyed-2": " \n", @@ -3886,6 +3957,7 @@ export default { "repeat-once": " \n", "repeat": " \n", "replace-off": " \n", + "replace-user": " \n", "replace": " \n", "report-analytics": " \n", "report-medical": " \n", @@ -4025,8 +4097,8 @@ export default { "search": " \n", "section-sign": " \n", "section": " \n", - "seeding-off": " \n", - "seeding": " \n", + "seedling-off": " \n", + "seedling": " \n", "select-all": " \n", "select": " \n", "selector": " \n", @@ -4221,7 +4293,7 @@ export default { "spade": " \n", "sparkles": " \n", "speakerphone": " \n", - "speedboat": " \n", + "speedboat": " \n", "sphere-off": " \n", "sphere-plus": " \n", "sphere": " \n", @@ -4247,6 +4319,7 @@ export default { "square-chevrons-left": " \n", "square-chevrons-right": " \n", "square-chevrons-up": " \n", + "square-dashed": " \n", "square-dot": " \n", "square-f0": " \n", "square-f1": " \n", @@ -4441,6 +4514,7 @@ export default { "swords": " \n", "table-alias": " \n", "table-column": " \n", + "table-dashed": " \n", "table-down": " \n", "table-export": " \n", "table-heart": " \n", @@ -4585,7 +4659,7 @@ export default { "traffic-cone": " \n", "traffic-lights-off": " \n", "traffic-lights": " \n", - "train": " \n", + "train": " \n", "transaction-bitcoin": " \n", "transaction-dollar": " \n", "transaction-euro": " \n", @@ -4647,6 +4721,7 @@ export default { "u-turn-right": " \n", "ufo-off": " \n", "ufo": " \n", + "uhd": " \n", "umbrella-2": " \n", "umbrella-closed-2": " \n", "umbrella-closed": " \n", @@ -4791,6 +4866,8 @@ export default { "webhook-off": " \n", "webhook": " \n", "weight": " \n", + "wheat-off": " \n", + "wheat": " \n", "wheel": " \n", "wheelchair-off": " \n", "wheelchair": " \n", diff --git a/package-lock.json b/package-lock.json index a74821a..3a7b507 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "@cdransf/eleventy-plugin-tabler-icons", - "version": "2.2.0", + "version": "2.13.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cdransf/eleventy-plugin-tabler-icons", - "version": "2.2.0", + "version": "2.13.1", "license": "MIT", "devDependencies": { "@11ty/eleventy": "v3.0.0", - "@tabler/icons": "^3.22.0" + "@tabler/icons": "^3.34.0" } }, "node_modules/@11ty/dependency-tree": { @@ -349,9 +349,9 @@ } }, "node_modules/@tabler/icons": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-3.22.0.tgz", - "integrity": "sha512-IfgGzhFph5OBr2wTieWL/hyAs0FThnq9O155a6kfGYxqx7h5LQw91wnRswhEaGhXCcfmR7ZVDUr9H+x4b9Pb8g==", + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-3.34.0.tgz", + "integrity": "sha512-jtVqv0JC1WU2TTEBN32D9+R6mc1iEBuPwLnBsWaR02SIEciu9aq5806AWkCHuObhQ4ERhhXErLEK7Fs+tEZxiA==", "dev": true, "license": "MIT", "funding": { diff --git a/package.json b/package.json index 6881b0d..94dede0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cdransf/eleventy-plugin-tabler-icons", - "version": "2.2.0", + "version": "2.13.1", "description": "Shortcodes to add Tabler icons to your Eleventy projects", "type": "module", "main": "tablericons.js", @@ -25,15 +25,15 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/cdransf/eleventy-plugin-tabler-icons.git" + "url": "git+https://git.apps.coryd.dev/cdransf/eleventy-plugin-tabler-icons.git" }, - "homepage": "https://github.com/cdransf/eleventy-plugin-tabler-icons#readme", + "homepage": "https://git.apps.coryd.dev/cdransf/eleventy-plugin-tabler-icons#readme", "bugs": { - "url": "https://github.com/cdransf/eleventy-plugin-tabler-icons/issues" + "url": "https://git.apps.coryd.dev/cdransf/eleventy-plugin-tabler-icons/issues" }, "license": "MIT", "devDependencies": { "@11ty/eleventy": "v3.0.0", - "@tabler/icons": "^3.22.0" + "@tabler/icons": "^3.34.0" } } diff --git a/tablericons.js b/tablericons.js index b959cba..4cb477e 100644 --- a/tablericons.js +++ b/tablericons.js @@ -1,48 +1,58 @@ -import ICONS from './icons.js' +import ICONS from './icons.js'; const tablericons = (eleventyConfig, config = {}) => { - const { className = '', errorOnMissing = false } = config + const { className = '', errorOnMissing = false } = config; - const renderIcon = (context = this, name, alt, attrs) => { - const contents = ICONS[name] + const renderIcon = (context = {}, name, alt = '', attrs = {}) => { + const contents = ICONS[name]; if (!contents) { - handleMissingIcon(name, context.page.inputPath) - return '' + handleMissingIcon(name, context.page?.inputPath); + return ''; } - return `${head(alt, className, name, attrs)}${contents}${ICONS.TAIL}` - } + return `${buildHead(alt, className, name, attrs)}${contents}${ICONS.TAIL}`; + }; const handleMissingIcon = (name, inputPath) => { - const message = `No tablericons found for name '${name}'` + const message = `No tablericon found for name '${name}'`; if (errorOnMissing) { - throw new Error(message) + throw new Error(message); } else { - console.warn(`${message} in ${inputPath}`) + console.warn(`${message}${inputPath ? ` in ${inputPath}` : ''}`); } - } + }; - // Register shortcode for Eleventy 3.0 - eleventyConfig.addShortcode('tablericon', (name, alt, attrs) => { - return renderIcon(this, name, alt, attrs) - }) -} + eleventyConfig.addShortcode('tablericon', function (name, alt, attrs) { + return renderIcon(this, name, alt, attrs); + }); +}; -const head = (alt, className, iconName, attrs) => { - let output = `${ICONS.HEAD.slice(0, -1)} aria-hidden='true'` +const buildHead = (alt = '', className = '', iconName, attrs = {}) => { + let output = `${ICONS.HEAD.slice(0, -1)} aria-hidden="true"`; - if (className) output += ` class='${className}'` - output += ` data-tablericon-name='${iconName}'` + if (className) output += ` class="${className}"`; + output += ` data-tablericon-name="${iconName}"`; if (typeof attrs === 'string') { - output += ` ${attrs}` + output += ` ${attrs}`; } else if (attrs && typeof attrs === 'object') { output += Object.entries(attrs) - .map(([property, value]) => (property && value ? ` ${property}='${value}'` : '')) - .join('') + .map(([key, val]) => (key && val ? ` ${key}="${val}"` : '')) + .join(''); } - return `${output}>` + return `${output}>`; +}; + +export function renderTablerIcon(name, alt = '', attrs = {}, options = {}) { + const context = { page: { inputPath: options.inputPath || '' } }; + const contents = ICONS[name]; + if (!contents) { + console.warn(`No tablericon found for name '${name}'${options.inputPath ? ` in ${options.inputPath}` : ''}`); + return ''; + } + + return `${buildHead(alt, options.className || '', name, attrs)}${contents}${ICONS.TAIL}`; } -export default tablericons \ No newline at end of file +export default tablericons;