@sharadox/metadata-web-library 0.1.0 → 0.1.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/distribution/share-image/index.d.ts +2 -1
- package/distribution/share-image/index.d.ts.map +1 -1
- package/distribution/share-image/index.js +5 -3
- package/distribution/share-image/index.js.map +1 -1
- package/distribution/share-image/type.d.ts +1 -0
- package/distribution/share-image/type.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,8 @@ export declare const SHARE_IMAGE_SIZE: {
|
|
|
6
6
|
readonly height: 630;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Renders a share card (Open Graph and Twitter image) from JSX
|
|
9
|
+
* Renders a share card (Open Graph and Twitter image) from JSX as a PNG response, with the given fonts or, without
|
|
10
|
+
* any, Next.js's built-in default font. Use it in
|
|
10
11
|
* `opengraph-image.tsx` and `twitter-image.tsx`; the design stays in the site's own library.
|
|
11
12
|
*
|
|
12
13
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/share-image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAE5G,oDAAoD;AACpD,eAAO,MAAM,gBAAgB;;;CAAwC,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/share-image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAE5G,oDAAoD;AACpD,eAAO,MAAM,gBAAgB;;;CAAwC,CAAC;AAEtE;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,EAC1B,EAAE,KAA8B,EAAE,MAAgC,EAAE,KAAK,EAAE,GAAE,iBAAsB,GAClG,aAAa,CAGf"}
|
|
@@ -2,7 +2,8 @@ import { ImageResponse } from "next/og";
|
|
|
2
2
|
/** The size Open Graph and Twitter cards expect. */
|
|
3
3
|
export const SHARE_IMAGE_SIZE = { width: 1200, height: 630 };
|
|
4
4
|
/**
|
|
5
|
-
* Renders a share card (Open Graph and Twitter image) from JSX
|
|
5
|
+
* Renders a share card (Open Graph and Twitter image) from JSX as a PNG response, with the given fonts or, without
|
|
6
|
+
* any, Next.js's built-in default font. Use it in
|
|
6
7
|
* `opengraph-image.tsx` and `twitter-image.tsx`; the design stays in the site's own library.
|
|
7
8
|
*
|
|
8
9
|
* @example
|
|
@@ -10,7 +11,8 @@ export const SHARE_IMAGE_SIZE = { width: 1200, height: 630 };
|
|
|
10
11
|
* return shareImage(<div style={{ display: "flex" }}>Sharadox</div>, { fonts: [{ name: "Geist", data: font }] });
|
|
11
12
|
* }
|
|
12
13
|
*/
|
|
13
|
-
export function shareImage(element, { width = SHARE_IMAGE_SIZE.width, height = SHARE_IMAGE_SIZE.height, fonts
|
|
14
|
-
|
|
14
|
+
export function shareImage(element, { width = SHARE_IMAGE_SIZE.width, height = SHARE_IMAGE_SIZE.height, fonts } = {}) {
|
|
15
|
+
// An empty font list would replace the default font and leave nothing to lay text out with.
|
|
16
|
+
return new ImageResponse(element, fonts?.length ? { width, height, fonts } : { width, height });
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/share-image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,oDAAoD;AACpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAW,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/share-image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,oDAAoD;AACpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAW,CAAC;AAEtE;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CACxB,OAA0B,EAC1B,EAAE,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAAC,MAAM,EAAE,KAAK,KAAwB,EAAE;IAEnG,4FAA4F;IAC5F,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -10,6 +10,7 @@ export interface ShareImageOptions {
|
|
|
10
10
|
/** 1200×630 by default, the size Open Graph and Twitter cards expect. */
|
|
11
11
|
width?: number;
|
|
12
12
|
height?: number;
|
|
13
|
+
/** Next.js's built-in default font when none are given. */
|
|
13
14
|
fonts?: ShareImageFont[];
|
|
14
15
|
}
|
|
15
16
|
export type ShareImageElement = ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/share-image/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC7D,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/share-image/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC7D,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/metadata-web-library",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Everything search engines, share cards and installation need: page metadata, sitemaps, robots rules, web app manifests, JSON-LD structured data and share images for Next.js.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENCA.md",
|