@stacksjs/stx 0.2.181 → 0.2.183

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.
@@ -33,5 +33,13 @@ export declare const IconBuiltin: BuiltinComponentDef;
33
33
  /**
34
34
  * Pre-load icon collections so they're available synchronously during render.
35
35
  * Call this before template processing starts.
36
+ *
37
+ * Silent when the collection is not installed. Callers preload on the chance a
38
+ * template wants it, so an absent collection here is a normal outcome and not
39
+ * a problem to report; the render path still says so if a template actually
40
+ * asks for one that is missing. Pass `speculative: false` when the caller knows
41
+ * the collection is required.
36
42
  */
37
- export declare function preloadIconCollection(prefix?: string): Promise<void>;
43
+ export declare function preloadIconCollection(prefix?: string, options?: {
44
+ speculative?: boolean;
45
+ }): Promise<void>;
@@ -42,12 +42,13 @@ function loadCollectionSync(prefix) {
42
42
  return null;
43
43
  }
44
44
  }
45
- async function loadCollection(prefix) {
45
+ async function loadCollection(prefix, speculative = !1) {
46
46
  if (collectionCache.has(prefix))
47
47
  return collectionCache.get(prefix);
48
48
  const jsonPath = resolveCollectionPath(prefix);
49
49
  if (!jsonPath) {
50
- warnMissingCollection(prefix);
50
+ if (!speculative)
51
+ warnMissingCollection(prefix);
51
52
  return null;
52
53
  }
53
54
  try {
@@ -94,6 +95,6 @@ export const IconBuiltin = {
94
95
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="${viewBox}" fill="none"${classAttr}${styleAttr}>${body}</svg>`;
95
96
  }
96
97
  };
97
- export async function preloadIconCollection(prefix = "lucide") {
98
- await loadCollection(prefix);
98
+ export async function preloadIconCollection(prefix = "lucide", options = {}) {
99
+ await loadCollection(prefix, options.speculative ?? !0);
99
100
  }