@streamscloud/embeddable 16.0.7-1772099327648 → 16.0.7-1772105016226

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.
@@ -0,0 +1,8 @@
1
+ <script lang="ts">import { ShadowRoot } from '../../ui/shadow-dom';
2
+ import { default as ArticleView } from './article-view.svelte';
3
+ let { sections, metadata, theme, locale } = $props();
4
+ </script>
5
+
6
+ <ShadowRoot locale={locale} theme={theme} backgroundDisabled={true} backgroundImageUrl="not-applicable">
7
+ <ArticleView sections={sections} metadata={metadata} />
8
+ </ShadowRoot>
@@ -0,0 +1,12 @@
1
+ import type { ThemeValue } from '../../core/theme';
2
+ import type { ArticleMetadata, ArticleSectionModel } from './types';
3
+ import type { AppLocaleValue } from '@streamscloud/kit/core/locale';
4
+ type Props = {
5
+ sections: ArticleSectionModel[];
6
+ metadata: ArticleMetadata;
7
+ theme: ThemeValue;
8
+ locale: AppLocaleValue | undefined;
9
+ };
10
+ declare const ArticleProxy: import("svelte").Component<Props, {}, "">;
11
+ type ArticleProxy = ReturnType<typeof ArticleProxy>;
12
+ export default ArticleProxy;
@@ -0,0 +1,31 @@
1
+ <script lang="ts">import { default as ArticleSection } from './article-section.svelte';
2
+ import { sectionIsFilled } from './helpers';
3
+ let { sections, metadata } = $props();
4
+ const filledSections = $derived(sections.filter(sectionIsFilled));
5
+ const fieldMetadata = $derived({ displayDate: metadata.displayDate });
6
+ </script>
7
+
8
+ <div class="article-container">
9
+ <div class="article">
10
+ {#each filledSections as section (section.id)}
11
+ <ArticleSection section={section} metadata={fieldMetadata} />
12
+ {/each}
13
+ </div>
14
+ </div>
15
+
16
+ <style>.article-container {
17
+ --_article--min-height: var(--article--min-height, 0);
18
+ --_article--background: var(--article--background, light-dark(#ffffff, #1e1e1e));
19
+ --_article--text-color: var(--article--text-color, light-dark(#000000, #ffffff));
20
+ container-type: inline-size;
21
+ min-height: var(--_article--min-height);
22
+ }
23
+
24
+ .article {
25
+ --article-field--text-color: var(--_article--text-color);
26
+ min-height: var(--_article--min-height);
27
+ background: var(--_article--background);
28
+ padding-bottom: 6.25rem;
29
+ display: flex;
30
+ flex-direction: column;
31
+ }</style>
@@ -0,0 +1,8 @@
1
+ import type { ArticleMetadata, ArticleSectionModel } from './types';
2
+ type Props = {
3
+ sections: ArticleSectionModel[];
4
+ metadata: ArticleMetadata;
5
+ };
6
+ declare const ArticleView: import("svelte").Component<Props, {}, "">;
7
+ type ArticleView = ReturnType<typeof ArticleView>;
8
+ export default ArticleView;
@@ -1,31 +1,36 @@
1
- <script lang="ts">import { default as ArticleSection } from './article-section.svelte';
2
- import { sectionIsFilled } from './helpers';
3
- let { sections, metadata } = $props();
4
- const filledSections = $derived(sections.filter(sectionIsFilled));
5
- const fieldMetadata = $derived({ displayDate: metadata.displayDate });
1
+ <script lang="ts">import { createShadowRoot } from '../../ui/shadow-dom';
2
+ import { default as ArticleProxy } from './article-proxy.svelte';
3
+ import { mount, unmount } from 'svelte';
4
+ let { sections, metadata, theme = 'dark', locale } = $props();
5
+ const initHost = (node) => {
6
+ const shadowRoot = createShadowRoot(node);
7
+ const mounted = mount(ArticleProxy, {
8
+ target: shadowRoot,
9
+ props: {
10
+ get sections() {
11
+ return sections;
12
+ },
13
+ get metadata() {
14
+ return metadata;
15
+ },
16
+ get theme() {
17
+ return theme;
18
+ },
19
+ get locale() {
20
+ return locale;
21
+ }
22
+ }
23
+ });
24
+ return {
25
+ destroy: () => {
26
+ unmount(mounted);
27
+ }
28
+ };
29
+ };
6
30
  </script>
7
31
 
8
- <div class="article-container">
9
- <div class="article">
10
- {#each filledSections as section (section.id)}
11
- <ArticleSection section={section} metadata={fieldMetadata} />
12
- {/each}
13
- </div>
14
- </div>
32
+ <div class="article-host" use:initHost></div>
15
33
 
16
- <style>.article-container {
17
- --_article--min-height: var(--article--min-height, 0);
18
- --_article--background: var(--article--background, light-dark(#ffffff, #1e1e1e));
19
- --_article--text-color: var(--article--text-color, light-dark(#000000, #ffffff));
20
- container-type: inline-size;
21
- min-height: var(--_article--min-height);
22
- }
23
-
24
- .article {
25
- --article-field--text-color: var(--_article--text-color);
26
- min-height: var(--_article--min-height);
27
- background: var(--_article--background);
28
- padding-bottom: 6.25rem;
29
- display: flex;
30
- flex-direction: column;
34
+ <style>.article-host {
35
+ display: contents;
31
36
  }</style>
@@ -1,7 +1,11 @@
1
+ import type { ThemeValue } from '../../core/theme';
1
2
  import type { ArticleMetadata, ArticleSectionModel } from './types';
3
+ import type { AppLocaleValue } from '@streamscloud/kit/core/locale';
2
4
  type Props = {
3
5
  sections: ArticleSectionModel[];
4
6
  metadata: ArticleMetadata;
7
+ theme?: ThemeValue;
8
+ locale?: AppLocaleValue;
5
9
  };
6
10
  declare const Cmp: import("svelte").Component<Props, {}, "">;
7
11
  type Cmp = ReturnType<typeof Cmp>;
@@ -1,4 +1,5 @@
1
1
  export { default as Article } from './cmp.article.svelte';
2
+ export { default as ArticleView } from './article-view.svelte';
2
3
  export { default as FactsContainer } from './cmp.facts-container.svelte';
3
4
  export { fieldIsFilled, layoutIsFilled, sectionIsFilled } from './helpers';
4
5
  export { ArticleStylesHelper } from './styles-transformer';
@@ -1,4 +1,5 @@
1
1
  export { default as Article } from './cmp.article.svelte';
2
+ export { default as ArticleView } from './article-view.svelte';
2
3
  export { default as FactsContainer } from './cmp.facts-container.svelte';
3
4
  export { fieldIsFilled, layoutIsFilled, sectionIsFilled } from './helpers';
4
5
  export { ArticleStylesHelper } from './styles-transformer';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/embeddable",
3
- "version": "16.0.7-1772099327648",
3
+ "version": "16.0.7-1772105016226",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",