@streamscloud/embeddable 16.0.7-1772105016226 → 16.0.7-1772107327250
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.
|
@@ -14,17 +14,24 @@ const fieldMetadata = $derived({ displayDate: metadata.displayDate });
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<style>.article-container {
|
|
17
|
+
--_article--max-width: var(--article--max-width, 100%);
|
|
17
18
|
--_article--min-height: var(--article--min-height, 0);
|
|
18
|
-
--_article--background: var(--article--background, light-dark(#ffffff, #
|
|
19
|
+
--_article--background: var(--article--background, light-dark(#ffffff, #2e2e2e));
|
|
20
|
+
--_article--container-background: var(--article--container-background, light-dark(#fafafa, #1c1c1c));
|
|
19
21
|
--_article--text-color: var(--article--text-color, light-dark(#000000, #ffffff));
|
|
20
22
|
container-type: inline-size;
|
|
21
23
|
min-height: var(--_article--min-height);
|
|
24
|
+
background: var(--_article--container-background);
|
|
25
|
+
overflow: hidden;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
.article {
|
|
25
29
|
--article-field--text-color: var(--_article--text-color);
|
|
30
|
+
max-width: var(--_article--max-width);
|
|
31
|
+
margin: 0 auto;
|
|
26
32
|
min-height: var(--_article--min-height);
|
|
27
33
|
background: var(--_article--background);
|
|
34
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
|
|
28
35
|
padding-bottom: 6.25rem;
|
|
29
36
|
display: flex;
|
|
30
37
|
flex-direction: column;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">import { Article } from '../../articles/article';
|
|
2
2
|
import { createLocalGQLClient } from '../../core/graphql';
|
|
3
3
|
import { GetEmbedArticleDocument } from './operations.generated';
|
|
4
|
+
import { Loading } from '@streamscloud/kit/ui/loading';
|
|
4
5
|
import { untrack } from 'svelte';
|
|
5
|
-
let { id, slug, initiator, graphqlOrigin, on } = $props();
|
|
6
|
+
let { id, slug, initiator, graphqlOrigin, theme = 'light', on } = $props();
|
|
6
7
|
let sections = $state.raw(null);
|
|
7
8
|
let metadata = $state.raw(null);
|
|
8
9
|
let notFound = $state(false);
|
|
@@ -58,7 +59,11 @@ $effect(() => {
|
|
|
58
59
|
{#if notFound}
|
|
59
60
|
<div class="embed-article__not-found">¯\_(ツ)_/¯</div>
|
|
60
61
|
{:else if sections && metadata}
|
|
61
|
-
<Article sections={sections} metadata={metadata} />
|
|
62
|
+
<Article sections={sections} metadata={metadata} theme={theme} />
|
|
63
|
+
{:else}
|
|
64
|
+
<div class="embed-article__loading">
|
|
65
|
+
<Loading positionAbsoluteCenter timeout={600} />
|
|
66
|
+
</div>
|
|
62
67
|
{/if}
|
|
63
68
|
|
|
64
69
|
<!--
|
|
@@ -73,6 +78,7 @@ Displays a placeholder when the article is not found.
|
|
|
73
78
|
| `slug` | `string?` | Article slug to fetch (alternative to `id`) |
|
|
74
79
|
| `initiator` | `string?` | Value for the `x-initiator` header |
|
|
75
80
|
| `graphqlOrigin` | `string?` | Custom GraphQL API origin |
|
|
81
|
+
| `theme` | `'light' \| 'dark'` | Color theme (default: `'light'`) |
|
|
76
82
|
|
|
77
83
|
### Callbacks (`on`)
|
|
78
84
|
| Callback | Type | Description |
|
|
@@ -82,7 +88,9 @@ Displays a placeholder when the article is not found.
|
|
|
82
88
|
### CSS Custom Properties
|
|
83
89
|
| Property | Description | Default |
|
|
84
90
|
|---|---|---|
|
|
85
|
-
| `--article--
|
|
91
|
+
| `--article--max-width` | Article max width (centered when constrained) | `100%` |
|
|
92
|
+
| `--article--container-background` | Outer container background (visible when width constrained) | `gray-50` / `gray-900` |
|
|
93
|
+
| `--article--background` | Article background color | `white` / `gray-800` |
|
|
86
94
|
| `--article--text-color` | Article text color | `black` / `white` |
|
|
87
95
|
| `--article--min-height` | Minimum article height | `0` |
|
|
88
96
|
-->
|
|
@@ -94,4 +102,9 @@ Displays a placeholder when the article is not found.
|
|
|
94
102
|
min-height: 12.5rem;
|
|
95
103
|
font-size: 1.5rem;
|
|
96
104
|
color: light-dark(#9ca3af, #6b7280);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.embed-article__loading {
|
|
108
|
+
position: relative;
|
|
109
|
+
min-height: 12.5rem;
|
|
97
110
|
}</style>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ThemeValue } from '../../core/theme';
|
|
1
2
|
export type ArticleSeoModel = {
|
|
2
3
|
title: string;
|
|
3
4
|
description: string;
|
|
@@ -9,6 +10,7 @@ type Props = {
|
|
|
9
10
|
slug?: string;
|
|
10
11
|
initiator?: string;
|
|
11
12
|
graphqlOrigin?: string;
|
|
13
|
+
theme?: ThemeValue;
|
|
12
14
|
on?: {
|
|
13
15
|
seoLoaded?: (seo: ArticleSeoModel) => void;
|
|
14
16
|
};
|
|
@@ -24,6 +26,7 @@ type Props = {
|
|
|
24
26
|
* | `slug` | `string?` | Article slug to fetch (alternative to `id`) |
|
|
25
27
|
* | `initiator` | `string?` | Value for the `x-initiator` header |
|
|
26
28
|
* | `graphqlOrigin` | `string?` | Custom GraphQL API origin |
|
|
29
|
+
* | `theme` | `'light' \| 'dark'` | Color theme (default: `'light'`) |
|
|
27
30
|
*
|
|
28
31
|
* ### Callbacks (`on`)
|
|
29
32
|
* | Callback | Type | Description |
|
|
@@ -33,7 +36,9 @@ type Props = {
|
|
|
33
36
|
* ### CSS Custom Properties
|
|
34
37
|
* | Property | Description | Default |
|
|
35
38
|
* |---|---|---|
|
|
36
|
-
* | `--article--
|
|
39
|
+
* | `--article--max-width` | Article max width (centered when constrained) | `100%` |
|
|
40
|
+
* | `--article--container-background` | Outer container background (visible when width constrained) | `gray-50` / `gray-900` |
|
|
41
|
+
* | `--article--background` | Article background color | `white` / `gray-800` |
|
|
37
42
|
* | `--article--text-color` | Article text color | `black` / `white` |
|
|
38
43
|
* | `--article--min-height` | Minimum article height | `0` |
|
|
39
44
|
*/
|