@efolusi/meridian 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/icons/Icon.js +12 -0
  2. package/package.json +1 -1
package/icons/Icon.js CHANGED
@@ -2,8 +2,20 @@
2
2
  import React from 'react';
3
3
  import { SVGS } from './_svg.js';
4
4
 
5
+ // Every name is known at build time here, so a miss is always a typo or a
6
+ // glyph that was never added. Saying so beats rendering an empty box in
7
+ // silence, which reads as a styling bug and sends you looking in the wrong
8
+ // place. Once per name, so a bad icon in a list does not flood the console.
9
+ const _warned = new Set();
10
+ function warnMissing(name) {
11
+ if (_warned.has(name) || typeof console === 'undefined') return;
12
+ _warned.add(name);
13
+ console.warn('[meridian] <Icon name="' + name + '"> is not a Meridian glyph, so nothing will render. Check the name against the icon gallery, or add ' + name + '.svg to assets/icons/.');
14
+ }
15
+
5
16
  export function Icon({ name, size = 16, strokeWidth = 1.5, title, className, style, ...rest }) {
6
17
  const svg = SVGS[name] || '';
18
+ if (!svg) warnMissing(name);
7
19
  const html = svg
8
20
  ? svg.replace('width="24"', 'width="' + size + '"').replace('height="24"', 'height="' + size + '"').replace('stroke-width="2"', 'stroke-width="' + strokeWidth + '"')
9
21
  : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efolusi/meridian",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "A general-purpose open-source design system by Efolusi: accessible React components, design tokens, blocks and example apps.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://meridian.efolusi.com",