@csedl/hotwire-svelte-helpers 4.4.0 → 4.5.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csedl/hotwire-svelte-helpers",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Hotwire + Svelte helpers for Rails: Stimulus floating dropdowns/toolips + Svelte global panels/modals + RTurbo-friendly utilities. Build together with the rubygem svelte-on-rails and its npm-package.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
}, 0)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
function isSnippet(value) {
|
|
30
|
+
return typeof value === 'function';
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
</script>
|
|
30
34
|
|
|
31
35
|
<div class="dropdown-panel {panelClass}" bind:this={panelElement} onclose={closeFunc}>
|
|
@@ -43,12 +47,20 @@
|
|
|
43
47
|
</span>
|
|
44
48
|
</div>
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
{#if content !== undefined}
|
|
51
|
+
<div class="content">
|
|
52
|
+
{#if Array.isArray(content)}
|
|
53
|
+
{#each content as item}
|
|
54
|
+
<p>{typeof item === 'string' ? item : JSON.stringify(item)}</p>
|
|
55
|
+
{/each}
|
|
56
|
+
{:else if typeof content === 'string'}
|
|
57
|
+
<p>{content}</p>
|
|
58
|
+
{:else if isSnippet(content)}
|
|
59
|
+
{@render content()}
|
|
60
|
+
{:else}
|
|
61
|
+
<div style="color: red;">Invalid content value: {JSON.stringify(content)}</div>
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
64
|
+
{/if}
|
|
53
65
|
|
|
54
66
|
</div>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
panelClass,
|
|
7
7
|
closeFunction,
|
|
8
8
|
content,
|
|
9
|
+
contentX,
|
|
9
10
|
actionButtonLabel,
|
|
10
11
|
actionButtonFunction,
|
|
11
12
|
} = $props()
|
|
@@ -24,6 +25,10 @@
|
|
|
24
25
|
export function setTitle(newTitle) {
|
|
25
26
|
title = newTitle
|
|
26
27
|
}
|
|
28
|
+
|
|
29
|
+
function isSnippet(value) {
|
|
30
|
+
return typeof value === 'function';
|
|
31
|
+
}
|
|
27
32
|
</script>
|
|
28
33
|
|
|
29
34
|
<div class="modal-overlay">
|
|
@@ -42,17 +47,22 @@
|
|
|
42
47
|
</span>
|
|
43
48
|
</div>
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
{#if content !== undefined}
|
|
47
51
|
<div class="content">
|
|
48
|
-
{#if content}
|
|
52
|
+
{#if Array.isArray(content)}
|
|
53
|
+
{#each content as item}
|
|
54
|
+
<p>{typeof item === 'string' ? item : JSON.stringify(item)}</p>
|
|
55
|
+
{/each}
|
|
56
|
+
{:else if typeof content === 'string'}
|
|
57
|
+
<p>{content}</p>
|
|
58
|
+
{:else if isSnippet(content)}
|
|
49
59
|
{@render content()}
|
|
50
60
|
{:else}
|
|
51
|
-
<div style="color: red;">
|
|
61
|
+
<div style="color: red;">Invalid content value: {JSON.stringify(content)}</div>
|
|
52
62
|
{/if}
|
|
53
63
|
</div>
|
|
64
|
+
{/if}
|
|
54
65
|
|
|
55
|
-
</div>
|
|
56
66
|
<div class="footer">
|
|
57
67
|
{#if actionButtonLabel}
|
|
58
68
|
<span
|