@sharadox/metadata-web-library 0.0.0-stage → 0.1.0

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.
Files changed (58) hide show
  1. package/LICENCA.md +76 -0
  2. package/LICENSE.md +76 -0
  3. package/NOTICE.md +3 -0
  4. package/README.md +75 -2
  5. package/distribution/manifest/index.d.ts +14 -0
  6. package/distribution/manifest/index.d.ts.map +1 -0
  7. package/distribution/manifest/index.js +29 -0
  8. package/distribution/manifest/index.js.map +1 -0
  9. package/distribution/manifest/type.d.ts +24 -0
  10. package/distribution/manifest/type.d.ts.map +1 -0
  11. package/distribution/manifest/type.js +2 -0
  12. package/distribution/manifest/type.js.map +1 -0
  13. package/distribution/page-metadata/index.d.ts +16 -0
  14. package/distribution/page-metadata/index.d.ts.map +1 -0
  15. package/distribution/page-metadata/index.js +42 -0
  16. package/distribution/page-metadata/index.js.map +1 -0
  17. package/distribution/page-metadata/type.d.ts +23 -0
  18. package/distribution/page-metadata/type.d.ts.map +1 -0
  19. package/distribution/page-metadata/type.js +2 -0
  20. package/distribution/page-metadata/type.js.map +1 -0
  21. package/distribution/robots/index.d.ts +11 -0
  22. package/distribution/robots/index.d.ts.map +1 -0
  23. package/distribution/robots/index.js +14 -0
  24. package/distribution/robots/index.js.map +1 -0
  25. package/distribution/robots/type.d.ts +17 -0
  26. package/distribution/robots/type.d.ts.map +1 -0
  27. package/distribution/robots/type.js +2 -0
  28. package/distribution/robots/type.js.map +1 -0
  29. package/distribution/share-image/index.d.ts +18 -0
  30. package/distribution/share-image/index.d.ts.map +1 -0
  31. package/distribution/share-image/index.js +16 -0
  32. package/distribution/share-image/index.js.map +1 -0
  33. package/distribution/share-image/type.d.ts +16 -0
  34. package/distribution/share-image/type.d.ts.map +1 -0
  35. package/distribution/share-image/type.js +2 -0
  36. package/distribution/share-image/type.js.map +1 -0
  37. package/distribution/sitemap/index.d.ts +10 -0
  38. package/distribution/sitemap/index.d.ts.map +1 -0
  39. package/distribution/sitemap/index.js +20 -0
  40. package/distribution/sitemap/index.js.map +1 -0
  41. package/distribution/sitemap/type.d.ts +25 -0
  42. package/distribution/sitemap/type.d.ts.map +1 -0
  43. package/distribution/sitemap/type.js +2 -0
  44. package/distribution/sitemap/type.js.map +1 -0
  45. package/distribution/structured-data/index.d.ts +9 -0
  46. package/distribution/structured-data/index.d.ts.map +1 -0
  47. package/distribution/structured-data/index.js +11 -0
  48. package/distribution/structured-data/index.js.map +1 -0
  49. package/distribution/structured-data/type.d.ts +6 -0
  50. package/distribution/structured-data/type.d.ts.map +1 -0
  51. package/distribution/structured-data/type.js +2 -0
  52. package/distribution/structured-data/type.js.map +1 -0
  53. package/distribution/structured-data-graph/index.d.ts +10 -0
  54. package/distribution/structured-data-graph/index.d.ts.map +1 -0
  55. package/distribution/structured-data-graph/index.js +11 -0
  56. package/distribution/structured-data-graph/index.js.map +1 -0
  57. package/llms.txt +11 -0
  58. package/package.json +91 -3
package/LICENCA.md ADDED
@@ -0,0 +1,76 @@
1
+ # Licença Sharadox de Código Aberto
2
+
3
+ Versão 0.1.0
4
+
5
+ O texto em língua portuguesa é o único texto original e vinculativo desta licença. A tradução para inglês (`LICENSE.md`) é meramente informativa; em caso de divergência prevalece o texto em português.
6
+
7
+ ## 1. Definições
8
+
9
+ Para efeitos desta licença:
10
+
11
+ 1. **«Obra»** — o programa de computador, a sua documentação e quaisquer outros conteúdos disponibilizados pelo Licenciante ao abrigo desta licença, em código-fonte ou em qualquer outra forma.
12
+ 2. **«Licenciante»** — o titular dos direitos de autor identificado no aviso de direitos de autor que acompanha a Obra.
13
+ 3. **«Licenciado»** — qualquer pessoa, singular ou coletiva, que exerça os direitos concedidos por esta licença.
14
+ 4. **«Obra Derivada»** — qualquer obra baseada na Obra ou que a incorpore, total ou parcialmente, com ou sem modificações, incluindo traduções, adaptações e programas que a integrem.
15
+ 5. **«Aviso»** — o aviso de direitos de autor do Licenciante e a indicação de que a Obra está licenciada ao abrigo desta licença, incluindo a respetiva versão.
16
+
17
+ ## 2. Concessão de direitos
18
+
19
+ 1. Nos termos desta licença, o Licenciante concede ao Licenciado uma licença mundial, gratuita, não exclusiva e por todo o prazo de proteção dos direitos de autor para:
20
+ 1. utilizar a Obra para qualquer finalidade, incluindo finalidades comerciais;
21
+ 2. reproduzir a Obra, total ou parcialmente, por qualquer meio e sob qualquer forma;
22
+ 3. modificar, traduzir, adaptar e transformar a Obra e criar Obras Derivadas;
23
+ 4. distribuir, publicar, comunicar ao público, colocar à disposição, vender e sublicenciar a Obra e as Obras Derivadas.
24
+ 2. Na medida em que o Licenciante seja titular de patentes necessariamente infringidas pela Obra tal como por si disponibilizada, concede igualmente ao Licenciado, nos mesmos termos, uma licença para utilizar essas patentes no exercício dos direitos previstos no número anterior.
25
+ 3. Esta licença não transmite a titularidade de quaisquer direitos, que permanecem do Licenciante.
26
+
27
+ ## 3. Condições
28
+
29
+ O exercício dos direitos concedidos fica sujeito às seguintes condições:
30
+
31
+ 1. Todas as cópias da Obra, ou de partes substanciais da mesma, e todas as Obras Derivadas distribuídas devem incluir o Aviso e uma cópia desta licença ou uma ligação estável para o seu texto.
32
+ 2. Quem distribuir uma versão modificada da Obra deve indicar de forma visível que a mesma foi modificada, não podendo apresentá-la como versão original do Licenciante.
33
+ 3. O Licenciado pode licenciar as suas próprias modificações ao abrigo de outros termos, desde que a parte da Obra que delas faça parte continue sujeita às condições desta licença.
34
+
35
+ ## 4. Nomes e marcas
36
+
37
+ Esta licença não concede qualquer direito sobre o nome, as marcas, os logótipos ou outros sinais distintivos do Licenciante, incluindo a designação «Sharadox», salvo na medida estritamente necessária para cumprir o dever de incluir o Aviso. É proibido utilizá-los para promover ou sugerir o apoio do Licenciante a Obras Derivadas ou a quaisquer produtos ou serviços sem autorização prévia e escrita.
38
+
39
+ ## 5. Exclusão de garantias
40
+
41
+ A Obra é disponibilizada «tal como está» e «conforme disponível», sem qualquer garantia, expressa ou tácita, incluindo, designadamente, garantias de comerciabilidade, de adequação a um fim específico, de ausência de erros ou de não violação de direitos de terceiros, na medida máxima permitida pela lei aplicável.
42
+
43
+ ## 6. Limitação de responsabilidade
44
+
45
+ 1. Na medida máxima permitida pela lei aplicável, o Licenciante não é responsável por quaisquer danos, diretos ou indiretos, incluindo lucros cessantes, perda de dados ou interrupção de atividade, resultantes da utilização ou da impossibilidade de utilização da Obra, ainda que tenha sido avisado da possibilidade da sua ocorrência.
46
+ 2. Nada nesta licença exclui ou limita a responsabilidade do Licenciante nos casos em que tal exclusão ou limitação não seja permitida por lei, designadamente por atos praticados com dolo ou culpa grave, nos termos do artigo 809.º e do n.º 2 do artigo 800.º do Código Civil, nem afeta os direitos que a lei imperativamente reconheça aos consumidores.
47
+
48
+ ## 7. Cessação
49
+
50
+ 1. Os direitos concedidos por esta licença cessam automaticamente se o Licenciado violar qualquer das suas condições.
51
+ 2. Os direitos são repostos se a violação for sanada no prazo de 30 dias a contar do momento em que o Licenciado dela tome conhecimento, salvo se o Licenciante tiver entretanto comunicado por escrito a sua oposição.
52
+ 3. A cessação não afeta as licenças validamente concedidas pelo Licenciado a terceiros que cumpram esta licença.
53
+
54
+ ## 8. Lei aplicável e foro
55
+
56
+ 1. Esta licença rege-se pela lei portuguesa, designadamente pelo Código do Direito de Autor e dos Direitos Conexos, aprovado pelo Decreto-Lei n.º 63/85, de 14 de março, e pelo Decreto-Lei n.º 252/94, de 20 de outubro, relativo à proteção jurídica dos programas de computador.
57
+ 2. Para a resolução de quaisquer litígios emergentes desta licença é competente o Tribunal Judicial da Comarca de Faro, sem prejuízo das normas imperativas de competência aplicáveis, nomeadamente as que protegem os consumidores.
58
+
59
+ ## 9. Versões da licença
60
+
61
+ O Licenciante pode publicar novas versões desta licença, identificadas por um número de versão. A Obra fica sujeita à versão indicada no Aviso. O Licenciado pode, se o Aviso o permitir, optar por qualquer versão posterior.
62
+
63
+ ## 10. Disposições finais
64
+
65
+ 1. Se alguma disposição desta licença for considerada inválida ou ineficaz, as restantes mantêm-se em vigor, devendo a disposição afetada ser interpretada de forma a aproximar-se, tanto quanto possível, da intenção original.
66
+ 2. A não exigência, em qualquer momento, do cumprimento de uma disposição desta licença não constitui renúncia ao direito de o exigir posteriormente.
67
+
68
+ ## Como aplicar esta licença
69
+
70
+ Inclua na Obra um ficheiro `LICENCA.md` com este texto, a tradução `LICENSE.md` e o seguinte aviso, preenchendo o ano e o titular:
71
+
72
+ ```
73
+ Direitos de autor © <ano> <titular>.
74
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
75
+ https://github.com/Sharadox/sharadox-open-source-license
76
+ ```
package/LICENSE.md ADDED
@@ -0,0 +1,76 @@
1
+ # Sharadox Open Source Licence
2
+
3
+ Version 0.1.0
4
+
5
+ This is an informative English translation. The Portuguese text (`LICENCA.md`) is the only original and binding text of this licence; if the two differ, the Portuguese text prevails.
6
+
7
+ ## 1. Definitions
8
+
9
+ For the purposes of this licence:
10
+
11
+ 1. **"Work"** — the computer program, its documentation and any other content made available by the Licensor under this licence, in source code or in any other form.
12
+ 2. **"Licensor"** — the copyright holder identified in the copyright notice that accompanies the Work.
13
+ 3. **"Licensee"** — any natural or legal person exercising the rights granted by this licence.
14
+ 4. **"Derivative Work"** — any work based on or incorporating the Work, in whole or in part, with or without modifications, including translations, adaptations and programs that integrate it.
15
+ 5. **"Notice"** — the Licensor's copyright notice and the statement that the Work is licensed under this licence, including its version.
16
+
17
+ ## 2. Grant of rights
18
+
19
+ 1. Under this licence, the Licensor grants the Licensee a worldwide, royalty-free, non-exclusive licence, for the whole term of copyright protection, to:
20
+ 1. use the Work for any purpose, including commercial purposes;
21
+ 2. reproduce the Work, in whole or in part, by any means and in any form;
22
+ 3. modify, translate, adapt and transform the Work and create Derivative Works;
23
+ 4. distribute, publish, communicate to the public, make available, sell and sublicense the Work and Derivative Works.
24
+ 2. To the extent the Licensor holds patents necessarily infringed by the Work as made available by it, the Licensor also grants the Licensee, on the same terms, a licence to use those patents in exercising the rights in the previous paragraph.
25
+ 3. This licence does not transfer ownership of any rights, which remain with the Licensor.
26
+
27
+ ## 3. Conditions
28
+
29
+ The exercise of the rights granted is subject to the following conditions:
30
+
31
+ 1. Every copy of the Work, or of substantial parts of it, and every distributed Derivative Work must include the Notice and a copy of this licence or a stable link to its text.
32
+ 2. Anyone distributing a modified version of the Work must state visibly that it has been modified and may not present it as the Licensor's original version.
33
+ 3. The Licensee may license their own modifications under other terms, provided the part of the Work included in them remains subject to the conditions of this licence.
34
+
35
+ ## 4. Names and trademarks
36
+
37
+ This licence grants no rights to the Licensor's name, trademarks, logos or other distinctive signs, including the name "Sharadox", except as strictly necessary to comply with the duty to include the Notice. Using them to promote or suggest the Licensor's endorsement of Derivative Works or of any products or services without prior written permission is prohibited.
38
+
39
+ ## 5. Disclaimer of warranties
40
+
41
+ The Work is provided "as is" and "as available", without any warranty, express or implied, including in particular warranties of merchantability, fitness for a particular purpose, absence of errors or non-infringement of third-party rights, to the maximum extent permitted by applicable law.
42
+
43
+ ## 6. Limitation of liability
44
+
45
+ 1. To the maximum extent permitted by applicable law, the Licensor is not liable for any damages, direct or indirect, including loss of profits, loss of data or business interruption, arising from the use of or inability to use the Work, even if advised of the possibility of such damages.
46
+ 2. Nothing in this licence excludes or limits the Licensor's liability where such exclusion or limitation is not permitted by law, in particular for acts committed with intent or gross negligence, under article 809 and article 800(2) of the Portuguese Civil Code, nor does it affect rights that the law mandatorily grants to consumers.
47
+
48
+ ## 7. Termination
49
+
50
+ 1. The rights granted by this licence terminate automatically if the Licensee breaches any of its conditions.
51
+ 2. The rights are reinstated if the breach is remedied within 30 days of the Licensee becoming aware of it, unless the Licensor has meanwhile objected in writing.
52
+ 3. Termination does not affect licences validly granted by the Licensee to third parties who comply with this licence.
53
+
54
+ ## 8. Governing law and jurisdiction
55
+
56
+ 1. This licence is governed by Portuguese law, in particular the Code of Copyright and Related Rights, approved by Decree-Law no. 63/85 of 14 March, and Decree-Law no. 252/94 of 20 October on the legal protection of computer programs.
57
+ 2. The Judicial Court of the District of Faro has jurisdiction over any dispute arising from this licence, without prejudice to applicable mandatory rules of jurisdiction, in particular those protecting consumers.
58
+
59
+ ## 9. Licence versions
60
+
61
+ The Licensor may publish new versions of this licence, identified by a version number. The Work is subject to the version stated in the Notice. If the Notice allows it, the Licensee may choose any later version.
62
+
63
+ ## 10. Final provisions
64
+
65
+ 1. If any provision of this licence is held invalid or unenforceable, the remaining provisions stay in force, and the affected provision shall be interpreted as closely as possible to its original intent.
66
+ 2. Failure to enforce any provision of this licence at any time does not waive the right to enforce it later.
67
+
68
+ ## How to apply this licence
69
+
70
+ Include in the Work a `LICENCA.md` file with the Portuguese text, this translation as `LICENSE.md`, and the following notice, filling in the year and holder:
71
+
72
+ ```
73
+ Direitos de autor © <ano> <titular>.
74
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
75
+ https://github.com/Sharadox/sharadox-open-source-license
76
+ ```
package/NOTICE.md ADDED
@@ -0,0 +1,3 @@
1
+ Direitos de autor © 2026 Micael Pires (Sharadox).
2
+ Licenciado ao abrigo da Licença Sharadox de Código Aberto, versão 0.1.0.
3
+ https://github.com/Sharadox/sharadox-open-source-license
package/README.md CHANGED
@@ -1,3 +1,76 @@
1
- # Temporary Holding Version
1
+ # @sharadox/metadata-web-library
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Everything search engines, share cards and installation need from a Next.js site, built from a few facts about it.
4
+
5
+ - **Page metadata:** title and template, description, canonical address, hreflang alternates, Open Graph with locales, a large Twitter card, robots rules.
6
+ - **Search engine routes:** a localized sitemap with alternates, and robots rules.
7
+ - **Installation:** a web app manifest for an installable, online-only site (stable id, standalone window, icons including maskable).
8
+ - **Structured data:** JSON-LD rendered safely, and a graph helper to link several nodes.
9
+ - **Share images:** Open Graph and Twitter cards rendered from JSX with your fonts.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ pnpm add @sharadox/metadata-web-library @sharadox/internationalization-web-library
15
+ ```
16
+
17
+ ## Use
18
+
19
+ ```ts
20
+ // src/app/[locale]/layout.tsx
21
+ import { pageMetadata } from "@sharadox/metadata-web-library/page-metadata";
22
+
23
+ export async function generateMetadata({ params }) {
24
+ const { locale } = await params;
25
+ return pageMetadata({
26
+ name: "Sharadox",
27
+ url: "https://sharadox.com",
28
+ locales: LOCALES,
29
+ locale,
30
+ title: "Sharadox • Technologies that simplify the world",
31
+ description: "…",
32
+ titleTemplate: "%s • Sharadox",
33
+ });
34
+ }
35
+ ```
36
+
37
+ ```ts
38
+ // src/app/sitemap.ts, robots.ts, manifest.ts
39
+ export default () => localizedSitemap({ url: "https://sharadox.com", locales: LOCALES, otherPriority: 0.9 });
40
+ export default () => robots({ url: "https://sharadox.com", indexable: true });
41
+ export default () => webManifest({ name: "Sharadox", backgroundColor: "#000000", themeColor: "#000000" });
42
+ ```
43
+
44
+ ```tsx
45
+ <StructuredData data={structuredDataGraph(organization, website)} />
46
+ ```
47
+
48
+ ```tsx
49
+ // src/app/[locale]/opengraph-image.tsx
50
+ export const size = SHARE_IMAGE_SIZE;
51
+ export default async function Image() {
52
+ return shareImage(<div style={{ display: "flex" }}>Sharadox</div>, {
53
+ fonts: [{ name: "Geist", data: font, weight: 600 }],
54
+ });
55
+ }
56
+ ```
57
+
58
+ ## API
59
+
60
+ | Import | Export |
61
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
62
+ | `…/page-metadata` | `pageMetadata({ name, url, locales, locale, title, description, path?, titleTemplate?, keywords?, indexable? })` → Next.js `Metadata` |
63
+ | `…/sitemap` | `localizedSitemap({ url, locales, paths?, priority?, otherPriority?, changeFrequency?, lastModified? })` |
64
+ | `…/robots` | `robots({ url, indexable })` |
65
+ | `…/manifest` | `webManifest({ name, shortName?, description?, id?, startUrl?, backgroundColor, themeColor, icons? })`, `DEFAULT_ICONS` (`/icon.svg`, `/icon-192.png`, `/icon-512.png`, `/icon-maskable-512.png`) |
66
+ | `…/structured-data` | `<StructuredData data>` (escapes `<`) |
67
+ | `…/structured-data-graph` | `structuredDataGraph(...nodes)` → `{ "@context", "@graph" }` |
68
+ | `…/share-image` | `shareImage(element, { width?, height?, fonts? })`, `SHARE_IMAGE_SIZE` (1200×630) |
69
+
70
+ ## Develop
71
+
72
+ `pnpm verify` runs formatting, lint, type-check, tests with 100% coverage and the build. Branches follow `<feature>.development` → `development` → `index`, and releases are `v<version>` tags on `index`.
73
+
74
+ ## Licence
75
+
76
+ Licença Sharadox de Código Aberto, versão 0.1.0. See [português](LICENCA.md) (the binding text) and the [English translation](LICENSE.md).
@@ -0,0 +1,14 @@
1
+ import type { MetadataRoute } from "next";
2
+ import type { WebManifestOptions } from "@sharadox/metadata-web-library/manifest/type";
3
+ /** The icon files every installable Sharadox site ships in `public/`. */
4
+ export declare const DEFAULT_ICONS: NonNullable<WebManifestOptions["icons"]>;
5
+ /**
6
+ * The web app manifest of an installable, online-only site: it opens in its own window (`standalone`), with a
7
+ * stable id, its colours and icons. No service worker or offline support is involved.
8
+ *
9
+ * @example
10
+ * // src/app/manifest.ts
11
+ * export default () => webManifest({ name: "Sharadox", backgroundColor: "#000000", themeColor: "#000000" });
12
+ */
13
+ export declare function webManifest({ name, shortName, description, id, startUrl, backgroundColor, themeColor, icons, }: WebManifestOptions): MetadataRoute.Manifest;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAEvF,yEAAyE;AACzE,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAKlE,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,SAAgB,EAChB,WAAW,EACX,EAAQ,EACR,QAAc,EACd,eAAe,EACf,UAAU,EACV,KAAqB,GACtB,EAAE,kBAAkB,GAAG,aAAa,CAAC,QAAQ,CAY7C"}
@@ -0,0 +1,29 @@
1
+ /** The icon files every installable Sharadox site ships in `public/`. */
2
+ export const DEFAULT_ICONS = [
3
+ { src: "/icon.svg", sizes: "any", type: "image/svg+xml" },
4
+ { src: "/icon-192.png", sizes: "192x192", type: "image/png" },
5
+ { src: "/icon-512.png", sizes: "512x512", type: "image/png" },
6
+ { src: "/icon-maskable-512.png", sizes: "512x512", type: "image/png", purpose: "maskable" },
7
+ ];
8
+ /**
9
+ * The web app manifest of an installable, online-only site: it opens in its own window (`standalone`), with a
10
+ * stable id, its colours and icons. No service worker or offline support is involved.
11
+ *
12
+ * @example
13
+ * // src/app/manifest.ts
14
+ * export default () => webManifest({ name: "Sharadox", backgroundColor: "#000000", themeColor: "#000000" });
15
+ */
16
+ export function webManifest({ name, shortName = name, description, id = "/", startUrl = "/", backgroundColor, themeColor, icons = DEFAULT_ICONS, }) {
17
+ return {
18
+ id,
19
+ name,
20
+ short_name: shortName,
21
+ ...(description ? { description } : {}),
22
+ start_url: startUrl,
23
+ display: "standalone",
24
+ background_color: backgroundColor,
25
+ theme_color: themeColor,
26
+ icons: icons.map((icon) => ({ ...icon })),
27
+ };
28
+ }
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/manifest/index.ts"],"names":[],"mappings":"AAGA,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAA6C;IACrE,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE;IACzD,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7D,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7D,EAAE,GAAG,EAAE,wBAAwB,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE;CAC5F,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,IAAI,EACJ,SAAS,GAAG,IAAI,EAChB,WAAW,EACX,EAAE,GAAG,GAAG,EACR,QAAQ,GAAG,GAAG,EACd,eAAe,EACf,UAAU,EACV,KAAK,GAAG,aAAa,GACF;IACnB,OAAO;QACL,EAAE;QACF,IAAI;QACJ,UAAU,EAAE,SAAS;QACrB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,YAAY;QACrB,gBAAgB,EAAE,eAAe;QACjC,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;KAC1C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ export interface WebManifestOptions {
2
+ name: string;
3
+ /** Shown under the home screen icon (about 12 characters); `name` by default. */
4
+ shortName?: string;
5
+ description?: string;
6
+ /** A stable identity, so browsers treat the app as the same one if `startUrl` changes; "/" by default. */
7
+ id?: string;
8
+ /** "/" by default. */
9
+ startUrl?: string;
10
+ /** Splash and window colours. */
11
+ backgroundColor: string;
12
+ themeColor: string;
13
+ /**
14
+ * Icons; by default `/icon.svg` (any size), `/icon-192.png`, `/icon-512.png` and `/icon-maskable-512.png`
15
+ * (purpose "maskable", with safe padding for round launchers).
16
+ */
17
+ icons?: {
18
+ src: string;
19
+ sizes: string;
20
+ type: string;
21
+ purpose?: "any" | "maskable" | "monochrome";
22
+ }[];
23
+ }
24
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/manifest/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0GAA0G;IAC1G,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,YAAY,CAAA;KAAE,EAAE,CAAC;CACrG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/manifest/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { Metadata } from "next";
2
+ import type { PageMetadataOptions } from "@sharadox/metadata-web-library/page-metadata/type";
3
+ /**
4
+ * Everything search engines and share cards need for a localized page, as a Next.js `Metadata` object: title and
5
+ * template, description, canonical address and hreflang alternates, Open Graph (with the locale and its
6
+ * alternatives), a large-image Twitter card and robots rules.
7
+ *
8
+ * @example
9
+ * export async function generateMetadata({ params }) {
10
+ * const { locale } = await params;
11
+ * return pageMetadata({ name: "Sharadox", url: "https://sharadox.com", locales: LOCALES, locale,
12
+ * title: "Sharadox • Technologies that simplify the world", description: "…" });
13
+ * }
14
+ */
15
+ export declare function pageMetadata<Locale extends string>({ name, url, locales, locale, title, description, path, titleTemplate, keywords, indexable, }: PageMetadataOptions<Locale>): Metadata;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/page-metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAE7F;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS,MAAM,EAAE,EAClD,IAAI,EACJ,GAAG,EACH,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,IAAS,EACT,aAA8B,EAC9B,QAAQ,EACR,SAAgB,GACjB,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,QAAQ,CA4BxC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Everything search engines and share cards need for a localized page, as a Next.js `Metadata` object: title and
3
+ * template, description, canonical address and hreflang alternates, Open Graph (with the locale and its
4
+ * alternatives), a large-image Twitter card and robots rules.
5
+ *
6
+ * @example
7
+ * export async function generateMetadata({ params }) {
8
+ * const { locale } = await params;
9
+ * return pageMetadata({ name: "Sharadox", url: "https://sharadox.com", locales: LOCALES, locale,
10
+ * title: "Sharadox • Technologies that simplify the world", description: "…" });
11
+ * }
12
+ */
13
+ export function pageMetadata({ name, url, locales, locale, title, description, path = "", titleTemplate = `%s | ${name}`, keywords, indexable = true, }) {
14
+ const address = locales.localePath(locale, path);
15
+ return {
16
+ metadataBase: new URL(url),
17
+ title: { default: title, template: titleTemplate },
18
+ description,
19
+ applicationName: name,
20
+ authors: [{ name, url }],
21
+ creator: name,
22
+ ...(keywords ? { keywords: [...keywords] } : {}),
23
+ alternates: { canonical: address, languages: locales.alternates(path) },
24
+ openGraph: {
25
+ type: "website",
26
+ url: address,
27
+ siteName: name,
28
+ title,
29
+ description,
30
+ locale: locales.openGraphLocale(locale),
31
+ alternateLocale: locales.locales
32
+ .filter((other) => other !== locale)
33
+ .map((other) => locales.openGraphLocale(other)),
34
+ },
35
+ twitter: { card: "summary_large_image", title, description },
36
+ robots: indexable
37
+ ? { index: true, follow: true, googleBot: { index: true, follow: true, "max-image-preview": "large" } }
38
+ : { index: false, follow: false },
39
+ formatDetection: { telephone: false },
40
+ };
41
+ }
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/page-metadata/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAwB,EAClD,IAAI,EACJ,GAAG,EACH,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,IAAI,GAAG,EAAE,EACT,aAAa,GAAG,QAAQ,IAAI,EAAE,EAC9B,QAAQ,EACR,SAAS,GAAG,IAAI,GACY;IAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO;QACL,YAAY,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC;QAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE;QAClD,WAAW;QACX,eAAe,EAAE,IAAI;QACrB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QACxB,OAAO,EAAE,IAAI;QACb,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,UAAU,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QACvE,SAAS,EAAE;YACT,IAAI,EAAE,SAAS;YACf,GAAG,EAAE,OAAO;YACZ,QAAQ,EAAE,IAAI;YACd,KAAK;YACL,WAAW;YACX,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC;YACvC,eAAe,EAAE,OAAO,CAAC,OAAO;iBAC7B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC;iBACnC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;SAClD;QACD,OAAO,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,WAAW,EAAE;QAC5D,MAAM,EAAE,SAAS;YACf,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,EAAE;YACvG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;QACnC,eAAe,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;KACtC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { Locales } from "@sharadox/internationalization-web-library/locale/type";
2
+ export interface PageMetadataOptions<Locale extends string> {
3
+ /** The site's name, for example "Sharadox". */
4
+ name: string;
5
+ /** The public address without a trailing slash, for example "https://sharadox.com". */
6
+ url: string;
7
+ /** The site's locales (from `defineLocales`). */
8
+ locales: Locales<Locale>;
9
+ /** The locale of this page. */
10
+ locale: Locale;
11
+ /** The page title, as shown in search results and share cards. */
12
+ title: string;
13
+ /** The page description (about 150 characters). */
14
+ description: string;
15
+ /** The path after the locale, for example "/contact"; the home page by default. */
16
+ path?: string;
17
+ /** How sub-pages build their titles from this one; `%s` is the sub-page's title. Default: "%s | <name>" (brands pass their own separator). */
18
+ titleTemplate?: string;
19
+ keywords?: readonly string[];
20
+ /** False keeps the page out of search engines (previews, demos). True by default. */
21
+ indexable?: boolean;
22
+ }
23
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/page-metadata/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AAEtF,MAAM,WAAW,mBAAmB,CAAC,MAAM,SAAS,MAAM;IACxD,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8IAA8I;IAC9I,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,qFAAqF;IACrF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/page-metadata/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { RobotsOptions, RobotsRules } from "@sharadox/metadata-web-library/robots/type";
2
+ /**
3
+ * robots.txt rules: everything allowed, with the sitemap and host, or everything disallowed while the site isn't
4
+ * indexable.
5
+ *
6
+ * @example
7
+ * // src/app/robots.ts
8
+ * export default () => robots({ url: "https://sharadox.com", indexable: true });
9
+ */
10
+ export declare function robots({ url, indexable }: RobotsOptions): RobotsRules;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/robots/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAE7F;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,aAAa,GAAG,WAAW,CAIrE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * robots.txt rules: everything allowed, with the sitemap and host, or everything disallowed while the site isn't
3
+ * indexable.
4
+ *
5
+ * @example
6
+ * // src/app/robots.ts
7
+ * export default () => robots({ url: "https://sharadox.com", indexable: true });
8
+ */
9
+ export function robots({ url, indexable }) {
10
+ return indexable
11
+ ? { rules: { userAgent: "*", allow: "/" }, sitemap: `${url}/sitemap.xml`, host: url }
12
+ : { rules: { userAgent: "*", disallow: "/" } };
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/robots/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,GAAG,EAAE,SAAS,EAAiB;IACtD,OAAO,SAAS;QACd,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,GAAG,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE;QACrF,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC;AACnD,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface RobotsOptions {
2
+ /** The site's public address without a trailing slash. */
3
+ url: string;
4
+ /** False keeps the whole site out of search engines (previews before a launch). */
5
+ indexable: boolean;
6
+ }
7
+ /** The rules Next.js's `robots()` returns. */
8
+ export interface RobotsRules {
9
+ rules: {
10
+ userAgent: string;
11
+ allow?: string;
12
+ disallow?: string;
13
+ };
14
+ sitemap?: string;
15
+ host?: string;
16
+ }
17
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/robots/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,mFAAmF;IACnF,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/robots/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { ImageResponse } from "next/og";
2
+ import type { ShareImageElement, ShareImageOptions } from "@sharadox/metadata-web-library/share-image/type";
3
+ /** The size Open Graph and Twitter cards expect. */
4
+ export declare const SHARE_IMAGE_SIZE: {
5
+ readonly width: 1200;
6
+ readonly height: 630;
7
+ };
8
+ /**
9
+ * Renders a share card (Open Graph and Twitter image) from JSX with the given fonts, as a PNG response. Use it in
10
+ * `opengraph-image.tsx` and `twitter-image.tsx`; the design stays in the site's own library.
11
+ *
12
+ * @example
13
+ * export default async function Image() {
14
+ * return shareImage(<div style={{ display: "flex" }}>Sharadox</div>, { fonts: [{ name: "Geist", data: font }] });
15
+ * }
16
+ */
17
+ export declare function shareImage(element: ShareImageElement, { width, height, fonts }?: ShareImageOptions): ImageResponse;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,EAC1B,EAAE,KAA8B,EAAE,MAAgC,EAAE,KAAU,EAAE,GAAE,iBAAsB,GACvG,aAAa,CAEf"}
@@ -0,0 +1,16 @@
1
+ import { ImageResponse } from "next/og";
2
+ /** The size Open Graph and Twitter cards expect. */
3
+ export const SHARE_IMAGE_SIZE = { width: 1200, height: 630 };
4
+ /**
5
+ * Renders a share card (Open Graph and Twitter image) from JSX with the given fonts, as a PNG response. Use it in
6
+ * `opengraph-image.tsx` and `twitter-image.tsx`; the design stays in the site's own library.
7
+ *
8
+ * @example
9
+ * export default async function Image() {
10
+ * return shareImage(<div style={{ display: "flex" }}>Sharadox</div>, { fonts: [{ name: "Geist", data: font }] });
11
+ * }
12
+ */
13
+ export function shareImage(element, { width = SHARE_IMAGE_SIZE.width, height = SHARE_IMAGE_SIZE.height, fonts = [] } = {}) {
14
+ return new ImageResponse(element, { width, height, fonts });
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,OAA0B,EAC1B,EAAE,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAAC,MAAM,EAAE,KAAK,GAAG,EAAE,KAAwB,EAAE;IAExG,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ReactElement } from "react";
2
+ /** A font for the share image: its family name, file contents and weight. */
3
+ export interface ShareImageFont {
4
+ name: string;
5
+ data: ArrayBuffer | Buffer;
6
+ weight?: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
7
+ style?: "normal" | "italic";
8
+ }
9
+ export interface ShareImageOptions {
10
+ /** 1200×630 by default, the size Open Graph and Twitter cards expect. */
11
+ width?: number;
12
+ height?: number;
13
+ fonts?: ShareImageFont[];
14
+ }
15
+ export type ShareImageElement = ReactElement;
16
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/share-image/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { LocalizedSitemapOptions, SitemapEntry } from "@sharadox/metadata-web-library/sitemap/type";
2
+ /**
3
+ * A sitemap with one entry per page and locale, each listing every language version (hreflang) as an alternate.
4
+ *
5
+ * @example
6
+ * // src/app/sitemap.ts
7
+ * export default () => localizedSitemap({ url: "https://sharadox.com", locales: LOCALES, otherPriority: 0.9 });
8
+ */
9
+ export declare function localizedSitemap<Locale extends string>({ url, locales, paths, priority, otherPriority, changeFrequency, lastModified, }: LocalizedSitemapOptions<Locale>): SitemapEntry[];
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAEzG;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,SAAS,MAAM,EAAE,EACtD,GAAG,EACH,OAAO,EACP,KAAY,EACZ,QAAY,EACZ,aAAwB,EACxB,eAA2B,EAC3B,YAAyB,GAC1B,EAAE,uBAAuB,CAAC,MAAM,CAAC,GAAG,YAAY,EAAE,CAalD"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * A sitemap with one entry per page and locale, each listing every language version (hreflang) as an alternate.
3
+ *
4
+ * @example
5
+ * // src/app/sitemap.ts
6
+ * export default () => localizedSitemap({ url: "https://sharadox.com", locales: LOCALES, otherPriority: 0.9 });
7
+ */
8
+ export function localizedSitemap({ url, locales, paths = [""], priority = 1, otherPriority = priority, changeFrequency = "monthly", lastModified = new Date(), }) {
9
+ return paths.flatMap((path) => {
10
+ const languages = Object.fromEntries(locales.locales.map((locale) => [locale, `${url}${locales.localePath(locale, path)}`]));
11
+ return locales.locales.map((locale) => ({
12
+ url: `${url}${locales.localePath(locale, path)}`,
13
+ lastModified,
14
+ changeFrequency,
15
+ priority: locale === locales.defaultLocale ? priority : otherPriority,
16
+ alternates: { languages },
17
+ }));
18
+ });
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/sitemap/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAwB,EACtD,GAAG,EACH,OAAO,EACP,KAAK,GAAG,CAAC,EAAE,CAAC,EACZ,QAAQ,GAAG,CAAC,EACZ,aAAa,GAAG,QAAQ,EACxB,eAAe,GAAG,SAAS,EAC3B,YAAY,GAAG,IAAI,IAAI,EAAE,GACO;IAChC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAClC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CACvF,CAAC;QACF,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACtC,GAAG,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;YAChD,YAAY;YACZ,eAAe;YACf,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa;YACrE,UAAU,EAAE,EAAE,SAAS,EAAE;SAC1B,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { Locales } from "@sharadox/internationalization-web-library/locale/type";
2
+ export interface LocalizedSitemapOptions<Locale extends string> {
3
+ /** The site's public address without a trailing slash, for example "https://sharadox.com". */
4
+ url: string;
5
+ locales: Locales<Locale>;
6
+ /** Paths after the locale; the home page (`""`) by default. */
7
+ paths?: readonly string[];
8
+ /** Priority of the default locale's pages; the others get `otherPriority`. */
9
+ priority?: number;
10
+ otherPriority?: number;
11
+ changeFrequency?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
12
+ /** Now by default. */
13
+ lastModified?: Date;
14
+ }
15
+ /** One sitemap entry, in the shape Next.js's `sitemap()` returns. */
16
+ export interface SitemapEntry {
17
+ url: string;
18
+ lastModified: Date;
19
+ changeFrequency: NonNullable<LocalizedSitemapOptions<string>["changeFrequency"]>;
20
+ priority: number;
21
+ alternates: {
22
+ languages: Record<string, string>;
23
+ };
24
+ }
25
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/sitemap/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wDAAwD,CAAC;AAEtF,MAAM,WAAW,uBAAuB,CAAC,MAAM,SAAS,MAAM;IAC5D,8FAA8F;IAC9F,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5F,sBAAsB;IACtB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,IAAI,CAAC;IACnB,eAAe,EAAE,WAAW,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CACnD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/sitemap/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { StructuredDataProperties } from "@sharadox/metadata-web-library/structured-data/type";
2
+ /**
3
+ * Renders JSON-LD for search engines. `<` is escaped, so the data can never close the script tag early.
4
+ *
5
+ * @example
6
+ * <StructuredData data={structuredDataGraph(organization, website)} />
7
+ */
8
+ export declare function StructuredData({ data }: StructuredDataProperties): import("react").JSX.Element;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/structured-data/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAEpG;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,+BAOhE"}
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Renders JSON-LD for search engines. `<` is escaped, so the data can never close the script tag early.
4
+ *
5
+ * @example
6
+ * <StructuredData data={structuredDataGraph(organization, website)} />
7
+ */
8
+ export function StructuredData({ data }) {
9
+ return (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(data).replace(/</g, "\\u003c") } }));
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/structured-data/index.tsx"],"names":[],"mappings":";AAEA;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,IAAI,EAA4B;IAC/D,OAAO,CACL,iBACE,IAAI,EAAC,qBAAqB,EAC1B,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,GAClF,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** A schema.org JSON-LD object, for example `{ "@context": "https://schema.org", "@type": "Restaurant", … }`. */
2
+ export type JsonLinkedData = Readonly<Record<string, unknown>>;
3
+ export interface StructuredDataProperties {
4
+ data: JsonLinkedData;
5
+ }
6
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/structured-data/type.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/D,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,cAAc,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/structured-data/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { JsonLinkedData } from "@sharadox/metadata-web-library/structured-data/type";
2
+ /**
3
+ * Wraps schema.org nodes in one JSON-LD document (`@context` and `@graph`), so a page can describe several linked
4
+ * things (the business, the website, its services).
5
+ *
6
+ * @example
7
+ * structuredDataGraph({ "@type": "Organization", name: "Sharadox" }, { "@type": "WebSite", url: "https://sharadox.com" });
8
+ */
9
+ export declare function structuredDataGraph(...nodes: JsonLinkedData[]): JsonLinkedData;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/structured-data-graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAE1F;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,KAAK,EAAE,cAAc,EAAE,GAAG,cAAc,CAE9E"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Wraps schema.org nodes in one JSON-LD document (`@context` and `@graph`), so a page can describe several linked
3
+ * things (the business, the website, its services).
4
+ *
5
+ * @example
6
+ * structuredDataGraph({ "@type": "Organization", name: "Sharadox" }, { "@type": "WebSite", url: "https://sharadox.com" });
7
+ */
8
+ export function structuredDataGraph(...nodes) {
9
+ return { "@context": "https://schema.org", "@graph": nodes };
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/structured-data-graph/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAG,KAAuB;IAC5D,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC/D,CAAC"}
package/llms.txt ADDED
@@ -0,0 +1,11 @@
1
+ # @sharadox/metadata-web-library
2
+
3
+ > SEO/share/install metadata for Next.js App Router sites, built on @sharadox/internationalization-web-library locales.
4
+
5
+ - `/page-metadata` pageMetadata({ name, url, locales, locale, title, description, path?, titleTemplate? = "%s | name", keywords?, indexable? = true }) → Metadata (metadataBase, title template, canonical, hreflang alternates incl. x-default, openGraph with locale/alternateLocale, twitter summary_large_image, robots, formatDetection)
6
+ - `/sitemap` localizedSitemap({ url, locales, paths? = [""], priority?, otherPriority?, changeFrequency? = "monthly", lastModified? })
7
+ - `/robots` robots({ url, indexable })
8
+ - `/manifest` webManifest({ name, shortName?, description?, id? = "/", startUrl? = "/", backgroundColor, themeColor, icons? = DEFAULT_ICONS }) → standalone, online-only
9
+ - `/structured-data` <StructuredData data /> ; `/structured-data-graph` structuredDataGraph(...nodes)
10
+ - `/share-image` shareImage(jsx, { width?, height?, fonts? }) → ImageResponse; SHARE_IMAGE_SIZE 1200x630
11
+ - Peer deps: next, react. Licence: Sharadox Open Source Licence 0.1.0
package/package.json CHANGED
@@ -1,6 +1,94 @@
1
1
  {
2
2
  "name": "@sharadox/metadata-web-library",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
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
+ "private": false,
6
+ "license": "SEE LICENSE IN LICENCA.md",
7
+ "author": "Sharadox <contact@sharadox.com>",
8
+ "type": "module",
9
+ "exports": {
10
+ "./*/type": {
11
+ "sharadox-source": "./source/*/type.ts",
12
+ "types": "./distribution/*/type.d.ts"
13
+ },
14
+ "./*": {
15
+ "sharadox-source": [
16
+ "./source/*/index.ts",
17
+ "./source/*/index.tsx"
18
+ ],
19
+ "types": "./distribution/*/index.d.ts",
20
+ "default": "./distribution/*/index.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "distribution",
25
+ "LICENCA.md",
26
+ "LICENSE.md",
27
+ "NOTICE.md",
28
+ "llms.txt"
29
+ ],
30
+ "sideEffects": [
31
+ "**/*.css"
32
+ ],
33
+ "engines": {
34
+ "node": ">=24"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "lint-staged": {
40
+ "*.{ts,tsx,js,mjs,cjs}": [
41
+ "prettier --write",
42
+ "eslint --fix --max-warnings=0"
43
+ ],
44
+ "*.{json,md,yml,yaml,scss}": "prettier --write"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/Sharadox/metadata-web-library.git"
49
+ },
50
+ "homepage": "https://github.com/Sharadox/metadata-web-library#readme",
51
+ "devDependencies": {
52
+ "@sharadox/es-lint-configuration-web-library": "^0.1.1",
53
+ "@sharadox/prettier-configuration-web-library": "^0.1.0",
54
+ "@sharadox/turborepo-configuration-web-library": "^0.1.0",
55
+ "@sharadox/type-script-configuration-web-library": "^0.2.0",
56
+ "@sharadox/vitest-configuration-web-library": "^0.1.2",
57
+ "@testing-library/dom": "^10.4.2",
58
+ "@testing-library/react": "^16.3.3",
59
+ "@types/node": "^24.19.2",
60
+ "@types/react": "^19.3.0",
61
+ "@types/react-dom": "^19.3.0",
62
+ "@vitest/coverage-v8": "^5.1.0",
63
+ "eslint": "9.39.5",
64
+ "husky": "^9.1.7",
65
+ "lint-staged": "^17.6.0",
66
+ "next": "16.4.5",
67
+ "prettier": "^3.10.0",
68
+ "react": "^19.3.1",
69
+ "react-dom": "^19.3.1",
70
+ "turbo": "^2.11.10",
71
+ "typedoc": "^0.28.20",
72
+ "typescript": "6.0.3",
73
+ "vitest": "^5.1.0"
74
+ },
75
+ "dependencies": {
76
+ "@sharadox/internationalization-web-library": "^0.1.0",
77
+ "@sharadox/web-library": "^0.5.0"
78
+ },
79
+ "peerDependencies": {
80
+ "next": ">=16",
81
+ "react": ">=19"
82
+ },
83
+ "scripts": {
84
+ "build": "rm -rf distribution && tsc -p tsconfig.build.json",
85
+ "lint": "eslint --max-warnings=0 .",
86
+ "format": "prettier --write .",
87
+ "format:check": "prettier --check .",
88
+ "type-check": "tsc --noEmit",
89
+ "test:unit": "vitest run --coverage",
90
+ "documentation": "typedoc",
91
+ "verify": "turbo run format:check lint type-check test:unit build",
92
+ "test:benchmark": "vitest bench --run --passWithNoTests"
93
+ }
6
94
  }