@vobs/ui 1.3.1 → 1.3.3

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.
package/dist/index.js CHANGED
@@ -2338,14 +2338,18 @@ import {
2338
2338
  createIcon,
2339
2339
  createSvgIconNode
2340
2340
  } from "@vobs/icon-core";
2341
+ import { state as state6 } from "@vobs/vobs";
2341
2342
  function Icon(props = {}) {
2342
2343
  const root = createSvgIconNode(() => {
2344
+ registryVersion.value;
2343
2345
  const definition = resolveIcon(
2344
2346
  readProp(props, "icon", void 0) ?? readProp(props, "name", void 0)
2345
2347
  );
2346
2348
  if (!definition) {
2347
2349
  if (hasProp(props, "children")) return void 0;
2348
- throw new Error("Vobs UI: Icon requires a registered `name` or an `icon` definition");
2350
+ const requested = readProp(props, "icon", void 0) ?? readProp(props, "name", void 0);
2351
+ console.warn(`Vobs UI: \u672A\u6CE8\u518C\u7684\u56FE\u6807 "${String(requested)}"\uFF0C\u5DF2\u6E32\u67D3\u4E3A\u7A7A\u3002\u8BF7\u5148 registerIcon \u6216\u6539\u7528\u5DF2\u6CE8\u518C\u7684\u540D\u79F0\u3002`);
2352
+ return void 0;
2349
2353
  }
2350
2354
  return iconDefinitionToSvg(definition);
2351
2355
  }, props, {
@@ -2419,12 +2423,15 @@ var VUI_ICON_PATHS = {
2419
2423
  var iconRegistry = new Map(
2420
2424
  Object.entries(VUI_ICON_PATHS).map(([name, path]) => [name, { name, path }])
2421
2425
  );
2426
+ var registryVersion = state6(0, "vui.iconRegistry.version");
2422
2427
  function registerIcon(icon) {
2423
2428
  const previous = iconRegistry.get(icon.name);
2424
2429
  iconRegistry.set(icon.name, icon);
2430
+ registryVersion.value++;
2425
2431
  return () => {
2426
2432
  if (previous) iconRegistry.set(icon.name, previous);
2427
2433
  else iconRegistry.delete(icon.name);
2434
+ registryVersion.value++;
2428
2435
  };
2429
2436
  }
2430
2437
  __name(registerIcon, "registerIcon");