@marianmeres/stuic 1.101.0 → 1.102.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.
|
@@ -5,19 +5,21 @@ export const isTHCNotEmpty = (m) => _is(m) || _is(m?.text) || _is(m?.html) || m?
|
|
|
5
5
|
<script>export let thc;
|
|
6
6
|
export let forceAsHtml = false;
|
|
7
7
|
export let allowCastToStringFallback = true;
|
|
8
|
+
export let filter = void 0;
|
|
9
|
+
const _filter = (s) => typeof filter === "function" ? filter(s) : s;
|
|
8
10
|
</script>
|
|
9
11
|
|
|
10
12
|
{#if typeof thc === 'string'}
|
|
11
|
-
{#if forceAsHtml}{@html thc}{:else}{thc}{/if}
|
|
13
|
+
{#if forceAsHtml}{@html _filter(thc)}{:else}{_filter(thc)}{/if}
|
|
12
14
|
{:else if thc?.text}
|
|
13
|
-
{#if forceAsHtml}{@html thc.text}{:else}{thc.text}{/if}
|
|
15
|
+
{#if forceAsHtml}{@html _filter(thc.text)}{:else}{_filter(thc.text)}{/if}
|
|
14
16
|
{:else if thc?.html}
|
|
15
|
-
{@html thc.html}
|
|
17
|
+
{@html _filter(thc.html)}
|
|
16
18
|
{:else if thc?.component}
|
|
17
19
|
<svelte:component this={thc.component} {...thc?.props || {}} {...$$restProps || {}} />
|
|
18
20
|
{:else if allowCastToStringFallback}
|
|
19
21
|
<!-- cast to string as the last resort (if enabled) -->
|
|
20
|
-
{thc}
|
|
22
|
+
{_filter(thc)}
|
|
21
23
|
{:else}
|
|
22
24
|
<!-- silence -->
|
|
23
25
|
{/if}
|