@marianmeres/stuic 2.1.15 → 2.1.17

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.
@@ -57,12 +57,12 @@
57
57
 
58
58
  let current = $derived(acp?.current!);
59
59
 
60
- let iconFn = $derived.by(() => {
61
- let out = current.iconFn;
60
+ let iconHtml = $derived.by(() => {
61
+ let fn = current.iconFn as any;
62
62
  if (current.iconFn === true) {
63
- out = defaultIcons[current.variant];
63
+ fn = defaultIcons[current.variant];
64
64
  }
65
- return out;
65
+ return fn?.();
66
66
  });
67
67
 
68
68
  let CmpButtonOk = $derived(current.CmpButtonOk ?? Button);
@@ -124,28 +124,24 @@
124
124
 
125
125
  <div class={twMerge("stuic-acp", _class, classProp)}>
126
126
  <div class={twMerge("wrap", _classWrap, classWrap)}>
127
- {#if typeof iconFn === "function"}
128
- {@const iconHtml = iconFn()}
129
- <!-- fn can return empty -->
130
- {#if iconHtml}
131
- <div
132
- class={twMerge(
133
- "icon-box",
134
- debug("outline-green-500"),
135
- _classIconBox,
136
- classIconBox
137
- )}
138
- >
139
- {@html iconFn()}
140
- </div>
141
- {/if}
127
+ {#if iconHtml}
128
+ <div
129
+ class={twMerge(
130
+ "icon-box",
131
+ debug("outline-green-500"),
132
+ _classIconBox,
133
+ classIconBox
134
+ )}
135
+ >
136
+ {@html iconHtml}
137
+ </div>
142
138
  {/if}
143
139
  <div class={twMerge("content-box", _classContentBox, classContentBox)}>
144
140
  <h1
145
141
  class={twMerge(
146
142
  "title",
147
143
  _classTitle,
148
- typeof iconFn === "function" && "pt-2",
144
+ typeof iconHtml === "function" && "pt-2",
149
145
  classTitle
150
146
  )}
151
147
  >
@@ -133,7 +133,7 @@
133
133
 
134
134
  let _iconFns = $derived({ ...notificationsDefaultIcons, ...iconFns });
135
135
 
136
- const maybeIcon = (n: Notification) => n.iconFn ?? _iconFns?.[n.type];
136
+ const maybeIcon = (n: Notification) => (n.iconFn ?? _iconFns?.[n.type])?.();
137
137
 
138
138
  const _classWrapX = `
139
139
  fixed z-50 flex flex-row inset-0
@@ -222,7 +222,7 @@
222
222
  <div class={twMerge("wrap-y", _classWrapY, YMAP_M[yMobile], YMAP[y], classWrapY)}>
223
223
  {#each notifications.stack as n (n.id)}
224
224
  {@const { Cmp, props } = maybeComponent(n)}
225
- {@const iconFn = maybeIcon(n)}
225
+ {@const iconHtml = maybeIcon(n)}
226
226
  {@const showXButton = !noXButton || n.ttl > 1000}
227
227
  {#if Cmp}
228
228
  <Cmp {...props || {}} notification={n} {notifications} />
@@ -247,9 +247,9 @@
247
247
  {n.count}
248
248
  </div>
249
249
  {/if}
250
- {#if !noIcons && typeof iconFn === "function"}
250
+ {#if !noIcons && iconHtml}
251
251
  <div class={twMerge("icon", _classNotifIcon, classNotifIcon)}>
252
- {@html iconFn()}
252
+ {@html iconHtml}
253
253
  </div>
254
254
  {/if}
255
255
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "2.1.15",
3
+ "version": "2.1.17",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",