@datocms/svelte 1.4.3 → 2.0.1
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/README.md +19 -5
- package/package/components/Head/Head.svelte.d.ts +1 -1
- package/package/components/Head/README.md +24 -19
- package/package/components/Image/Image.svelte +107 -119
- package/package/components/Image/Image.svelte.d.ts +6 -30
- package/package/components/Image/README.md +120 -67
- package/package/components/Image/utils.d.ts +13 -0
- package/package/components/Image/utils.js +36 -0
- package/package/components/NakedImage/NakedImage.svelte +71 -0
- package/package/components/NakedImage/NakedImage.svelte.d.ts +39 -0
- package/package/components/NakedImage/utils.d.ts +31 -0
- package/package/components/NakedImage/utils.js +48 -0
- package/package/components/StructuredText/README.md +9 -2
- package/package/components/StructuredText/StructuredText.svelte +3 -1
- package/package/components/StructuredText/nodes/Span.svelte +1 -1
- package/package/components/StructuredText/nodes/ThematicBreak.svelte +1 -1
- package/package/components/VideoPlayer/README.md +16 -4
- package/package/components/VideoPlayer/VideoPlayer.svelte.d.ts +2 -2
- package/package/components/VideoPlayer/__tests__/VideoPlayer.svelte.test.js +2 -2
- package/package/index.d.ts +4 -2
- package/package/index.js +3 -2
- package/package.json +6 -5
- package/package/components/Image/Placeholder.svelte +0 -30
- package/package/components/Image/Placeholder.svelte.d.ts +0 -22
- package/package/components/Image/Sizer.svelte +0 -17
- package/package/components/Image/Sizer.svelte.d.ts +0 -19
- package/package/components/Image/Source.svelte +0 -6
- package/package/components/Image/Source.svelte.d.ts +0 -18
package/package/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Node } from 'datocms-structured-text-utils';
|
|
2
2
|
import type { SvelteComponent } from 'svelte';
|
|
3
|
-
export { default as
|
|
4
|
-
export {
|
|
3
|
+
export { default as NakedImage } from './components/NakedImage/NakedImage.svelte';
|
|
4
|
+
export type { ResponsiveImageType } from './components/NakedImage/utils';
|
|
5
5
|
export { default as Head } from './components/Head/Head.svelte';
|
|
6
|
+
export { default as Image } from './components/Image/Image.svelte';
|
|
7
|
+
export { default as StructuredText } from './components/StructuredText/StructuredText.svelte';
|
|
6
8
|
export { default as VideoPlayer } from './components/VideoPlayer/VideoPlayer.svelte';
|
|
7
9
|
export type PredicateComponentTuple = [
|
|
8
10
|
(n: Node) => boolean,
|
package/package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as Image } from './components/Image/Image.svelte';
|
|
1
|
+
export { default as NakedImage } from './components/NakedImage/NakedImage.svelte';
|
|
3
2
|
export { default as Head } from './components/Head/Head.svelte';
|
|
3
|
+
export { default as Image } from './components/Image/Image.svelte';
|
|
4
|
+
export { default as StructuredText } from './components/StructuredText/StructuredText.svelte';
|
|
4
5
|
export { default as VideoPlayer } from './components/VideoPlayer/VideoPlayer.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datocms/svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A set of components and utilities to work faster with DatoCMS in Svelte",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"test:unit": "vitest",
|
|
23
23
|
"test": "npm run test:unit",
|
|
24
24
|
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
|
25
|
-
"format": "prettier --plugin-search-dir . --write ."
|
|
25
|
+
"format": "npm run toc && prettier --plugin-search-dir . --write .",
|
|
26
|
+
"toc": "doctoc --github src README.md"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
28
29
|
"@mux/mux-player": "*",
|
|
@@ -59,13 +60,13 @@
|
|
|
59
60
|
"tslib": "^2.6.2",
|
|
60
61
|
"typescript": "^5.0.0",
|
|
61
62
|
"vite": "^5.0.0",
|
|
62
|
-
"vitest": "^1.0.0"
|
|
63
|
+
"vitest": "^1.0.0",
|
|
64
|
+
"doctoc": "^2.0.0"
|
|
63
65
|
},
|
|
64
66
|
"type": "module",
|
|
65
67
|
"dependencies": {
|
|
66
68
|
"datocms-structured-text-utils": "^2.0.4",
|
|
67
|
-
"svelte-intersection-observer": "^1.0.0"
|
|
68
|
-
"universal-base64": "^2.1.0"
|
|
69
|
+
"svelte-intersection-observer": "^1.0.0"
|
|
69
70
|
},
|
|
70
71
|
"exports": {
|
|
71
72
|
"./package.json": "./package.json",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script>export let base64 = null;
|
|
2
|
-
export let backgroundColor = null;
|
|
3
|
-
export let objectFit;
|
|
4
|
-
export let objectPosition;
|
|
5
|
-
export let showImage;
|
|
6
|
-
export let fadeInDuration = 0;
|
|
7
|
-
let transition = fadeInDuration > 0 ? `opacity ${fadeInDuration}ms` : void 0;
|
|
8
|
-
let opacity = showImage ? 0 : 1;
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<img
|
|
12
|
-
class="placeholder"
|
|
13
|
-
aria-hidden="true"
|
|
14
|
-
alt=""
|
|
15
|
-
src={base64}
|
|
16
|
-
style:background-color={backgroundColor}
|
|
17
|
-
style:object-fit={objectFit}
|
|
18
|
-
style:object-position={objectPosition}
|
|
19
|
-
style:transition
|
|
20
|
-
style:opacity
|
|
21
|
-
/>
|
|
22
|
-
|
|
23
|
-
<style>
|
|
24
|
-
.placeholder {
|
|
25
|
-
position: absolute;
|
|
26
|
-
width: 100%;
|
|
27
|
-
top: 0;
|
|
28
|
-
scale: 110%;
|
|
29
|
-
}
|
|
30
|
-
</style>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type * as CSS from 'csstype';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
base64?: string | null | undefined;
|
|
6
|
-
backgroundColor?: string | null | undefined;
|
|
7
|
-
objectFit: CSS.Properties['objectFit'];
|
|
8
|
-
objectPosition: CSS.Properties['objectPosition'];
|
|
9
|
-
showImage: boolean;
|
|
10
|
-
fadeInDuration?: number | undefined;
|
|
11
|
-
};
|
|
12
|
-
events: {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {};
|
|
16
|
-
};
|
|
17
|
-
export type PlaceholderProps = typeof __propDef.props;
|
|
18
|
-
export type PlaceholderEvents = typeof __propDef.events;
|
|
19
|
-
export type PlaceholderSlots = typeof __propDef.slots;
|
|
20
|
-
export default class Placeholder extends SvelteComponentTyped<PlaceholderProps, PlaceholderEvents, PlaceholderSlots> {
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>import { encode } from "universal-base64";
|
|
2
|
-
let klass = null;
|
|
3
|
-
export { klass as class };
|
|
4
|
-
export let width;
|
|
5
|
-
export let height;
|
|
6
|
-
export let aspectRatio;
|
|
7
|
-
let svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height ?? (aspectRatio ? width / aspectRatio : 0)}"></svg>`;
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<img
|
|
11
|
-
class={klass}
|
|
12
|
-
style:display="block"
|
|
13
|
-
style:width="100%"
|
|
14
|
-
src="data:image/svg+xml;base64,{encode(svg)}"
|
|
15
|
-
aria-hidden="true"
|
|
16
|
-
alt=""
|
|
17
|
-
/>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
class?: string | null | undefined;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number | null | undefined;
|
|
7
|
-
aspectRatio: number | undefined;
|
|
8
|
-
};
|
|
9
|
-
events: {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
};
|
|
14
|
-
export type SizerProps = typeof __propDef.props;
|
|
15
|
-
export type SizerEvents = typeof __propDef.events;
|
|
16
|
-
export type SizerSlots = typeof __propDef.slots;
|
|
17
|
-
export default class Sizer extends SvelteComponentTyped<SizerProps, SizerEvents, SizerSlots> {
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
srcset: string | null;
|
|
5
|
-
sizes: string | null;
|
|
6
|
-
type?: string | null | undefined;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
export type SourceProps = typeof __propDef.props;
|
|
14
|
-
export type SourceEvents = typeof __propDef.events;
|
|
15
|
-
export type SourceSlots = typeof __propDef.slots;
|
|
16
|
-
export default class Source extends SvelteComponentTyped<SourceProps, SourceEvents, SourceSlots> {
|
|
17
|
-
}
|
|
18
|
-
export {};
|