@marianmeres/stuic 1.49.0 → 1.51.0

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.
@@ -56,10 +56,13 @@ export let duration = 150;
56
56
  export let message;
57
57
  export let onDismiss = () => message = "";
58
58
  export let theme = "primary";
59
+ export let forceAsHtml = false;
59
60
  let show = false;
60
61
  $:
61
62
  if (isTHCNotEmpty(message)) {
62
63
  requestAnimationFrame(() => show = true);
64
+ } else {
65
+ show = false;
63
66
  }
64
67
  </script>
65
68
 
@@ -81,7 +84,7 @@ $:
81
84
  classContent
82
85
  )}
83
86
  >
84
- <Thc thc={message} />
87
+ <Thc thc={message} {forceAsHtml} />
85
88
  </div>
86
89
 
87
90
  {#if typeof onDismiss === 'function'}
@@ -21,6 +21,7 @@ declare const __propDef: {
21
21
  message: THC;
22
22
  onDismiss?: false | (() => void) | null | undefined;
23
23
  theme?: "primary" | TW_COLORS | "secondary" | undefined;
24
+ forceAsHtml?: boolean | undefined;
24
25
  };
25
26
  events: {
26
27
  [evt: string]: CustomEvent<any>;
@@ -2,8 +2,9 @@
2
2
  export const isTHCNotEmpty = (m) => _is(m) || _is(m?.text) || _is(m?.html) || m?.component;
3
3
  </script>
4
4
 
5
- <script>export let forceAsHtml = false;
6
- export let thc;
5
+ <script>export let thc;
6
+ export let forceAsHtml = false;
7
+ export let allowCastToStringFallback = true;
7
8
  </script>
8
9
 
9
10
  {#if typeof thc === 'string'}
@@ -14,7 +15,9 @@ export let thc;
14
15
  {@html thc.html}
15
16
  {:else if thc?.component}
16
17
  <svelte:component this={thc.component} {...thc?.props || {}} {...$$restProps || {}} />
17
- {:else}
18
- <!-- cast to string as the last resort -->
18
+ {:else if allowCastToStringFallback}
19
+ <!-- cast to string as the last resort (if enabled) -->
19
20
  {thc}
21
+ {:else}
22
+ <!-- silence -->
20
23
  {/if}
@@ -14,8 +14,9 @@ export declare const isTHCNotEmpty: (m: any) => any;
14
14
  declare const __propDef: {
15
15
  props: {
16
16
  [x: string]: any;
17
- forceAsHtml?: boolean | undefined;
18
17
  thc: THC;
18
+ forceAsHtml?: boolean | undefined;
19
+ allowCastToStringFallback?: boolean | undefined;
19
20
  };
20
21
  events: {
21
22
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "1.49.0",
3
+ "version": "1.51.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package && node ./scripts/date.js",