@absolutejs/absolute 0.19.0-beta.376 → 0.19.0-beta.377

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.
@@ -1,39 +0,0 @@
1
- <script lang="ts">
2
- import StreamSlot from './StreamSlot.svelte';
3
-
4
- type Resolver = () => Promise<string> | string;
5
-
6
- let {
7
- className,
8
- errorHtml,
9
- fallbackHtml = '',
10
- id,
11
- promise,
12
- resolve,
13
- timeoutMs
14
- }: {
15
- className?: string;
16
- errorHtml?: string;
17
- fallbackHtml?: string;
18
- id: string;
19
- promise?: Promise<string>;
20
- resolve?: Resolver;
21
- timeoutMs?: number;
22
- } = $props();
23
-
24
- const slotResolver = () => {
25
- if (resolve) return resolve();
26
- if (promise) return promise;
27
-
28
- return '';
29
- };
30
- </script>
31
-
32
- <StreamSlot
33
- {className}
34
- {errorHtml}
35
- {fallbackHtml}
36
- {id}
37
- resolve={slotResolver}
38
- {timeoutMs}
39
- />
@@ -1,71 +0,0 @@
1
- <script context="module" lang="ts">
2
- let islandSlotIndex = 0;
3
-
4
- const createSlotId = () => {
5
- const current = islandSlotIndex;
6
- islandSlotIndex += 1;
7
-
8
- return `absolute-svelte-island-${current.toString(36)}`;
9
- };
10
- </script>
11
-
12
- <script lang="ts">
13
- import type { RuntimeIslandRenderProps } from '../../../types/island';
14
-
15
- let {
16
- component,
17
- framework,
18
- hydrate = 'load',
19
- props
20
- }: RuntimeIslandRenderProps = $props();
21
-
22
- const slotId = createSlotId();
23
-
24
- const escapeHtmlAttribute = (value: string) =>
25
- value
26
- .replaceAll('&', '&amp;')
27
- .replaceAll('"', '&quot;')
28
- .replaceAll('<', '&lt;')
29
- .replaceAll('>', '&gt;');
30
-
31
- const buildFallbackMarkup = (runtimeProps: RuntimeIslandRenderProps) => {
32
- const attributes = [
33
- ['data-component', runtimeProps.component],
34
- ['data-framework', runtimeProps.framework],
35
- ['data-hydrate', runtimeProps.hydrate ?? 'load'],
36
- ['data-island', 'true'],
37
- ['data-props', JSON.stringify(runtimeProps.props ?? {})]
38
- ];
39
-
40
- const serialized = attributes
41
- .map(([name, value]) => `${name}="${escapeHtmlAttribute(value)}"`)
42
- .join(' ');
43
-
44
- return `<div ${serialized}></div>`;
45
- };
46
-
47
- const html = $derived(
48
- (() => {
49
- const runtimeProps = {
50
- component,
51
- framework,
52
- hydrate,
53
- props
54
- };
55
-
56
- if (typeof document === 'undefined') {
57
- return buildFallbackMarkup(runtimeProps);
58
- }
59
-
60
- const slot = document.querySelector<HTMLElement>(
61
- `[data-absolute-island-slot="${slotId}"]`
62
- );
63
-
64
- return slot?.innerHTML ?? buildFallbackMarkup(runtimeProps);
65
- })()
66
- );
67
- </script>
68
-
69
- <div data-absolute-island-slot={slotId} style="display: contents">
70
- {@html html}
71
- </div>
@@ -1,35 +0,0 @@
1
- <script lang="ts">
2
- import { registerStreamingSlot } from '../../core/streamingSlotRegistrar';
3
-
4
- type Resolver = () => Promise<string> | string;
5
-
6
- let {
7
- className,
8
- errorHtml,
9
- fallbackHtml = '',
10
- id,
11
- resolve,
12
- timeoutMs
13
- }: {
14
- className?: string;
15
- errorHtml?: string;
16
- fallbackHtml?: string;
17
- id: string;
18
- resolve: Resolver;
19
- timeoutMs?: number;
20
- } = $props();
21
-
22
- if (typeof window === 'undefined') {
23
- registerStreamingSlot({
24
- errorHtml,
25
- fallbackHtml,
26
- id,
27
- resolve,
28
- timeoutMs
29
- });
30
- }
31
- </script>
32
-
33
- <div class={className} data-absolute-slot="true" id={`slot-${id}`}>
34
- {@html fallbackHtml}
35
- </div>