@streamscloud/embeddable 16.0.7-1772056193230 → 16.0.7-1772099327648
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/dist/articles/article/article-layout.svelte +4 -4
- package/dist/articles/article/article-section.svelte +5 -5
- package/dist/articles/article/cmp.article.svelte +1 -1
- package/dist/articles/article/cmp.facts-container.svelte.d.ts +7 -0
- package/dist/articles/article/fields/article-field.svelte +10 -10
- package/dist/articles/article/fields/image-field.svelte +1 -1
- package/dist/articles/article/fields/media-field.svelte +1 -1
- package/dist/articles/article/fields/media-gallery-field.svelte +1 -1
- package/dist/articles/article/fields/text-field.svelte +1 -1
- package/dist/articles/article/fields/video-field.svelte +1 -1
- package/dist/articles/article/index.d.ts +2 -0
- package/dist/articles/article/index.js +2 -0
- package/dist/articles/article/styles-transformer.d.ts +47 -19
- package/dist/articles/article/styles-transformer.js +36 -34
- package/package.json +1 -1
- package/dist/articles/article/facts-container.svelte.d.ts +0 -7
- /package/dist/articles/article/{facts-container.svelte → cmp.facts-container.svelte} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script lang="ts">import ArticleField from './fields/article-field.svelte';
|
|
1
|
+
<script lang="ts">import { default as ArticleField } from './fields/article-field.svelte';
|
|
2
2
|
import { fieldIsFilled } from './helpers';
|
|
3
|
-
import {
|
|
3
|
+
import { ArticleStylesHelper } from './styles-transformer';
|
|
4
4
|
let { layout, metadata } = $props();
|
|
5
5
|
const filledFields = $derived(layout.fields.filter(fieldIsFilled));
|
|
6
6
|
const styles = $derived.by(() => {
|
|
7
7
|
if (!layout.styles) {
|
|
8
8
|
return '';
|
|
9
9
|
}
|
|
10
|
-
const mobileStyles = generatePaddingsCssVar({ styles: layout.styles, mobileView: true });
|
|
11
|
-
const desktopStyles = generatePaddingsCssVar({ styles: layout.styles, mobileView: false });
|
|
10
|
+
const mobileStyles = ArticleStylesHelper.generatePaddingsCssVar({ styles: layout.styles, mobileView: true });
|
|
11
|
+
const desktopStyles = ArticleStylesHelper.generatePaddingsCssVar({ styles: layout.styles, mobileView: false });
|
|
12
12
|
return `--_article-layout--padding--desktop:${desktopStyles};--_article-layout--padding--mobile:${mobileStyles};`;
|
|
13
13
|
});
|
|
14
14
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<script lang="ts">import ArticleLayout from './article-layout.svelte';
|
|
2
|
-
import FactsContainer from './facts-container.svelte';
|
|
1
|
+
<script lang="ts">import { default as ArticleLayout } from './article-layout.svelte';
|
|
2
|
+
import { default as FactsContainer } from './cmp.facts-container.svelte';
|
|
3
3
|
import { layoutIsFilled } from './helpers';
|
|
4
|
-
import {
|
|
4
|
+
import { ArticleStylesHelper } from './styles-transformer';
|
|
5
5
|
import { HtmlHelper } from '@streamscloud/kit/core/utils';
|
|
6
6
|
import { HtmlBlock } from '@streamscloud/kit/ui/html-block';
|
|
7
7
|
let { section, metadata } = $props();
|
|
@@ -10,8 +10,8 @@ const styles = $derived.by(() => {
|
|
|
10
10
|
if (!section.styles) {
|
|
11
11
|
return '';
|
|
12
12
|
}
|
|
13
|
-
const mobileStyles = generatePaddingsCssVar({ styles: section.styles, mobileView: true });
|
|
14
|
-
const desktopStyles = generatePaddingsCssVar({ styles: section.styles, mobileView: false });
|
|
13
|
+
const mobileStyles = ArticleStylesHelper.generatePaddingsCssVar({ styles: section.styles, mobileView: true });
|
|
14
|
+
const desktopStyles = ArticleStylesHelper.generatePaddingsCssVar({ styles: section.styles, mobileView: false });
|
|
15
15
|
return `--_article-section--padding--desktop:${desktopStyles};--_article-section--padding--mobile:${mobileStyles};`;
|
|
16
16
|
});
|
|
17
17
|
const sectionFactsText = $derived(section.facts ? HtmlHelper.sanitizeHtml(section.facts) : null);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts">import ArticleSection from './article-section.svelte';
|
|
1
|
+
<script lang="ts">import { default as ArticleSection } from './article-section.svelte';
|
|
2
2
|
import { sectionIsFilled } from './helpers';
|
|
3
3
|
let { sections, metadata } = $props();
|
|
4
4
|
const filledSections = $derived(sections.filter(sectionIsFilled));
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script lang="ts">import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
1
|
+
<script lang="ts">import { ArticleStylesHelper } from '../styles-transformer';
|
|
2
|
+
import { default as BylineField } from './byline-field.svelte';
|
|
3
|
+
import { default as ImageField } from './image-field.svelte';
|
|
4
|
+
import { default as MediaField } from './media-field.svelte';
|
|
5
|
+
import { default as MediaGalleryField } from './media-gallery-field.svelte';
|
|
6
|
+
import { default as RichTextField } from './rich-text-field.svelte';
|
|
7
|
+
import { default as TextField } from './text-field.svelte';
|
|
8
|
+
import { default as VideoField } from './video-field.svelte';
|
|
9
9
|
let { field, metadata } = $props();
|
|
10
10
|
const styles = $derived.by(() => {
|
|
11
|
-
const mobileStyles = generateMarginsCssVar({ styles: field.styles, mobileView: true });
|
|
12
|
-
const desktopStyles = generateMarginsCssVar({ styles: field.styles, mobileView: false });
|
|
11
|
+
const mobileStyles = ArticleStylesHelper.generateMarginsCssVar({ styles: field.styles, mobileView: true });
|
|
12
|
+
const desktopStyles = ArticleStylesHelper.generateMarginsCssVar({ styles: field.styles, mobileView: false });
|
|
13
13
|
return `--_article-field--margin--desktop:${desktopStyles};--_article-field--margin--mobile:${mobileStyles};`;
|
|
14
14
|
});
|
|
15
15
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">import { MediaItemView } from '../../../ui/media-items/media-item-view';
|
|
2
|
-
import AltText from './alt-text.svelte';
|
|
2
|
+
import { default as AltText } from './alt-text.svelte';
|
|
3
3
|
let { field } = $props();
|
|
4
4
|
const fieldData = $derived(field.fieldData.imageData);
|
|
5
5
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">import { MediaItemView } from '../../../ui/media-items/media-item-view';
|
|
2
|
-
import AltText from './alt-text.svelte';
|
|
2
|
+
import { default as AltText } from './alt-text.svelte';
|
|
3
3
|
let { field } = $props();
|
|
4
4
|
const fieldData = $derived(field.fieldData.mediaData);
|
|
5
5
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">import { MediaItemsGallery } from '../../../ui/media-items/media-items-gallery';
|
|
2
|
-
import AltText from './alt-text.svelte';
|
|
2
|
+
import { default as AltText } from './alt-text.svelte';
|
|
3
3
|
let { field } = $props();
|
|
4
4
|
const fieldData = $derived(field.fieldData.mediaGalleryData);
|
|
5
5
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">import { MediaItemView } from '../../../ui/media-items/media-item-view';
|
|
2
|
-
import AltText from './alt-text.svelte';
|
|
2
|
+
import { default as AltText } from './alt-text.svelte';
|
|
3
3
|
let { field } = $props();
|
|
4
4
|
const fieldData = $derived(field.fieldData.videoData);
|
|
5
5
|
</script>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { default as Article } from './cmp.article.svelte';
|
|
2
|
+
export { default as FactsContainer } from './cmp.facts-container.svelte';
|
|
2
3
|
export { fieldIsFilled, layoutIsFilled, sectionIsFilled } from './helpers';
|
|
4
|
+
export { ArticleStylesHelper } from './styles-transformer';
|
|
3
5
|
export type { ArticleLayoutModel, ArticleLayoutStylesModel, ArticleMetadata, ArticleSectionModel, ArticleSectionStylesModel } from './types';
|
|
4
6
|
export type { ArticleFieldDataModel, ArticleFieldModel, ArticleFieldStylesModel, BylineFieldDataModel, FieldMetadata, ImageFieldDataModel, MediaFieldDataModel, MediaGalleryFieldDataModel, RichTextFieldDataModel, TextFieldDataModel, VideoFieldDataModel } from './fields/types';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { default as Article } from './cmp.article.svelte';
|
|
2
|
+
export { default as FactsContainer } from './cmp.facts-container.svelte';
|
|
2
3
|
export { fieldIsFilled, layoutIsFilled, sectionIsFilled } from './helpers';
|
|
4
|
+
export { ArticleStylesHelper } from './styles-transformer';
|
|
@@ -1,19 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
type IndentValues = {
|
|
2
|
+
top: number;
|
|
3
|
+
right: number;
|
|
4
|
+
bottom: number;
|
|
5
|
+
left: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class ArticleStylesHelper {
|
|
8
|
+
static generatePaddingsCssVar: (data: {
|
|
9
|
+
styles: {
|
|
10
|
+
paddingTop?: number | null;
|
|
11
|
+
paddingBottom?: number | null;
|
|
12
|
+
paddingLeft?: number | null;
|
|
13
|
+
paddingRight?: number | null;
|
|
14
|
+
};
|
|
15
|
+
mobileView: boolean;
|
|
16
|
+
}) => string;
|
|
17
|
+
static parsePaddingValues: (data: {
|
|
18
|
+
styles: {
|
|
19
|
+
paddingTop?: number | null;
|
|
20
|
+
paddingBottom?: number | null;
|
|
21
|
+
paddingLeft?: number | null;
|
|
22
|
+
paddingRight?: number | null;
|
|
23
|
+
};
|
|
24
|
+
mobileView: boolean;
|
|
25
|
+
}) => IndentValues;
|
|
26
|
+
static generateMarginsCssVar: (data: {
|
|
27
|
+
styles: {
|
|
28
|
+
marginTop?: number | null;
|
|
29
|
+
marginBottom?: number | null;
|
|
30
|
+
marginLeft?: number | null;
|
|
31
|
+
marginRight?: number | null;
|
|
32
|
+
} | null;
|
|
33
|
+
mobileView: boolean;
|
|
34
|
+
useFallbackIfMissing?: boolean;
|
|
35
|
+
}) => string;
|
|
36
|
+
static parseMarginValues: (data: {
|
|
37
|
+
styles: {
|
|
38
|
+
marginTop?: number | null;
|
|
39
|
+
marginBottom?: number | null;
|
|
40
|
+
marginLeft?: number | null;
|
|
41
|
+
marginRight?: number | null;
|
|
42
|
+
} | null;
|
|
43
|
+
mobileView: boolean;
|
|
44
|
+
useFallbackIfMissing?: boolean;
|
|
45
|
+
}) => IndentValues;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const parsePaddingValues = (data) => {
|
|
7
|
-
const { styles, mobileView } = data;
|
|
8
|
-
const verticalScaleFactor = mobileView ? 0.7 : 1;
|
|
9
|
-
const horizontalScaleFactor = mobileView ? 0.3 : 1;
|
|
10
|
-
return {
|
|
11
|
-
top: styles.paddingTop ? styles.paddingTop * verticalScaleFactor : 0,
|
|
12
|
-
right: styles.paddingRight ? styles.paddingRight * horizontalScaleFactor : 0,
|
|
13
|
-
bottom: styles.paddingBottom ? styles.paddingBottom * verticalScaleFactor : 0,
|
|
14
|
-
left: styles.paddingLeft ? styles.paddingLeft * horizontalScaleFactor : 0
|
|
1
|
+
export class ArticleStylesHelper {
|
|
2
|
+
static generatePaddingsCssVar = (data) => {
|
|
3
|
+
const indents = ArticleStylesHelper.parsePaddingValues(data);
|
|
4
|
+
const paddings = [indents.top, indents.right, indents.bottom, indents.left];
|
|
5
|
+
return paddings.map((p) => p + 'rem').join(' ');
|
|
15
6
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const parsedStyles = styles || { marginBottom: 0.875 };
|
|
28
|
-
const verticalScaleFactor = mobileView ? 0.7 : 1;
|
|
29
|
-
const horizontalScaleFactor = mobileView ? 0.3 : 1;
|
|
30
|
-
return {
|
|
31
|
-
top: 'marginTop' in parsedStyles && parsedStyles.marginTop ? parsedStyles.marginTop * verticalScaleFactor : 0,
|
|
32
|
-
right: 'marginRight' in parsedStyles && parsedStyles.marginRight ? parsedStyles.marginRight * horizontalScaleFactor : 0,
|
|
33
|
-
bottom: 'marginBottom' in parsedStyles && parsedStyles.marginBottom ? parsedStyles.marginBottom * verticalScaleFactor : 0,
|
|
34
|
-
left: 'marginLeft' in parsedStyles && parsedStyles.marginLeft ? parsedStyles.marginLeft * horizontalScaleFactor : 0
|
|
7
|
+
static parsePaddingValues = (data) => {
|
|
8
|
+
const { styles, mobileView } = data;
|
|
9
|
+
const verticalScaleFactor = mobileView ? 0.7 : 1;
|
|
10
|
+
const horizontalScaleFactor = mobileView ? 0.3 : 1;
|
|
11
|
+
return {
|
|
12
|
+
top: styles.paddingTop ? styles.paddingTop * verticalScaleFactor : 0,
|
|
13
|
+
right: styles.paddingRight ? styles.paddingRight * horizontalScaleFactor : 0,
|
|
14
|
+
bottom: styles.paddingBottom ? styles.paddingBottom * verticalScaleFactor : 0,
|
|
15
|
+
left: styles.paddingLeft ? styles.paddingLeft * horizontalScaleFactor : 0
|
|
16
|
+
};
|
|
35
17
|
};
|
|
36
|
-
|
|
18
|
+
static generateMarginsCssVar = (data) => {
|
|
19
|
+
const indents = ArticleStylesHelper.parseMarginValues(data);
|
|
20
|
+
const margins = [indents.top, indents.right, indents.bottom, indents.left];
|
|
21
|
+
return margins.map((p) => p + 'rem').join(' ');
|
|
22
|
+
};
|
|
23
|
+
static parseMarginValues = (data) => {
|
|
24
|
+
const { styles, useFallbackIfMissing = true, mobileView } = data;
|
|
25
|
+
if (!styles && !useFallbackIfMissing) {
|
|
26
|
+
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
27
|
+
}
|
|
28
|
+
const parsedStyles = styles || { marginBottom: 0.875 };
|
|
29
|
+
const verticalScaleFactor = mobileView ? 0.7 : 1;
|
|
30
|
+
const horizontalScaleFactor = mobileView ? 0.3 : 1;
|
|
31
|
+
return {
|
|
32
|
+
top: 'marginTop' in parsedStyles && parsedStyles.marginTop ? parsedStyles.marginTop * verticalScaleFactor : 0,
|
|
33
|
+
right: 'marginRight' in parsedStyles && parsedStyles.marginRight ? parsedStyles.marginRight * horizontalScaleFactor : 0,
|
|
34
|
+
bottom: 'marginBottom' in parsedStyles && parsedStyles.marginBottom ? parsedStyles.marginBottom * verticalScaleFactor : 0,
|
|
35
|
+
left: 'marginLeft' in parsedStyles && parsedStyles.marginLeft ? parsedStyles.marginLeft * horizontalScaleFactor : 0
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
package/package.json
CHANGED
|
File without changes
|