@hollware/nuxt 1.0.0-rc.4 → 1.0.0-rc.5

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/index.mjs CHANGED
@@ -53,6 +53,10 @@ var src_default = defineNuxtModule({
53
53
  name: "HollwareContent",
54
54
  filePath: resolve("./runtime/components/HollwareContent")
55
55
  });
56
+ addComponent({
57
+ name: "HollwareImage",
58
+ filePath: resolve("./runtime/components/HollwareImage")
59
+ });
56
60
  if (options.generator) addPlugin(resolve("./runtime/generator"));
57
61
  addServerPlugin(resolve("./runtime/server/preview"));
58
62
  addServerHandler({
@@ -0,0 +1,40 @@
1
+ import { PropType } from "vue";
2
+ import { imageOf } from "@hollware/client";
3
+ //#region src/runtime/components/HollwareImage.d.ts
4
+ /**
5
+ * The image a frontmatter field holds, such as the cover of a post: an `<img>` with its alt, its
6
+ * size and the `srcset` of the copies Hollware made of it. An attribute given on the component
7
+ * wins. Nothing renders when the field holds no image.
8
+ */
9
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
10
+ /** An entry or a summary as `useHollwareEntry` or `useHollwareEntries` gives it. */
11
+ entry: {
12
+ type: PropType<Parameters<typeof imageOf>[0]>;
13
+ default: null;
14
+ };
15
+ /** The frontmatter field that holds the image, such as `img` or `cover`. */
16
+ field: {
17
+ type: StringConstructor;
18
+ required: true;
19
+ };
20
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ [key: string]: any;
22
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ /** An entry or a summary as `useHollwareEntry` or `useHollwareEntries` gives it. */
24
+ entry: {
25
+ type: PropType<Parameters<typeof imageOf>[0]>;
26
+ default: null;
27
+ };
28
+ /** The frontmatter field that holds the image, such as `img` or `cover`. */
29
+ field: {
30
+ type: StringConstructor;
31
+ required: true;
32
+ };
33
+ }>> & Readonly<{}>, {
34
+ entry: {
35
+ readonly frontmatter?: Readonly<Record<string, unknown>>;
36
+ readonly images?: Readonly<Record<string, import("@hollware/client").PageImage>>;
37
+ } | null | undefined;
38
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
39
+ //#endregion
40
+ export { _default as default };
@@ -0,0 +1,39 @@
1
+ import { defineComponent, h } from "vue";
2
+ import { imageOf } from "@hollware/client";
3
+ //#region src/runtime/components/HollwareImage.ts
4
+ /**
5
+ * The image a frontmatter field holds, such as the cover of a post: an `<img>` with its alt, its
6
+ * size and the `srcset` of the copies Hollware made of it. An attribute given on the component
7
+ * wins. Nothing renders when the field holds no image.
8
+ */
9
+ var HollwareImage_default = defineComponent({
10
+ name: "HollwareImage",
11
+ props: {
12
+ /** An entry or a summary as `useHollwareEntry` or `useHollwareEntries` gives it. */
13
+ entry: {
14
+ type: Object,
15
+ default: null
16
+ },
17
+ /** The frontmatter field that holds the image, such as `img` or `cover`. */
18
+ field: {
19
+ type: String,
20
+ required: true
21
+ }
22
+ },
23
+ setup(props) {
24
+ return () => {
25
+ const image = imageOf(props.entry, props.field);
26
+ if (image === null) return null;
27
+ return h("img", {
28
+ src: image.src,
29
+ alt: image.alt ?? "",
30
+ srcset: image.srcset,
31
+ sizes: image.sizes,
32
+ width: image.width,
33
+ height: image.height
34
+ });
35
+ };
36
+ }
37
+ });
38
+ //#endregion
39
+ export { HollwareImage_default as default };
@@ -35,7 +35,8 @@ const PUBLIC_FIELDS = [
35
35
  "tags",
36
36
  "publishedAt",
37
37
  "updatedAt",
38
- "document"
38
+ "document",
39
+ "images"
39
40
  ];
40
41
  /**
41
42
  * An entry for a page: its verdict, its revision and its last publication stay on the server, as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hollware/nuxt",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.0.0-rc.5",
4
4
  "description": "Read Hollware from a Nuxt site, over a service binding or HTTP.",
5
5
  "homepage": "https://hollware.com",
6
6
  "bugs": {
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@comark/vue": "0.7.0",
32
- "@hollware/client": "1.0.0-rc.4",
33
- "@hollware/core": "1.0.0-rc.4",
32
+ "@hollware/client": "1.0.0-rc.5",
33
+ "@hollware/core": "1.0.0-rc.5",
34
34
  "@nuxt/kit": "4.6.2"
35
35
  },
36
36
  "devDependencies": {