@lupinum/ginko 0.4.0 → 0.5.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 (89) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/README.md +2 -2
  3. package/dist/basics.d.mts +492 -0
  4. package/dist/basics.d.ts +492 -0
  5. package/dist/basics.mjs +416 -0
  6. package/dist/cli/index.mjs +54 -55
  7. package/dist/index.d.mts +5 -4
  8. package/dist/index.d.ts +5 -4
  9. package/dist/index.mjs +3 -3
  10. package/dist/internal/search.mjs +6 -3
  11. package/dist/internal.d.mts +387 -41
  12. package/dist/internal.d.ts +387 -41
  13. package/dist/internal.mjs +267 -101
  14. package/dist/nuxt/module.d.mts +2 -2
  15. package/dist/nuxt/module.d.ts +2 -2
  16. package/dist/nuxt/module.mjs +105 -13
  17. package/dist/nuxt/runtime/GinkoImage.d.mts +1 -1
  18. package/dist/nuxt/runtime/GinkoMarkdown.mjs +2 -2
  19. package/dist/nuxt/runtime/composables.d.mts +4 -3
  20. package/dist/nuxt/runtime/composables.mjs +19 -15
  21. package/dist/nuxt/runtime/fetch.d.mts +3 -1
  22. package/dist/nuxt/runtime/fetch.mjs +12 -6
  23. package/dist/nuxt/runtime/markdown.d.mts +3 -0
  24. package/dist/nuxt/runtime/markdown.mjs +15 -3
  25. package/dist/nuxt/runtime/plugin.mjs +6 -35
  26. package/dist/nuxt/runtime/preview-listener.d.mts +13 -0
  27. package/dist/nuxt/runtime/preview-listener.mjs +37 -0
  28. package/dist/nuxt/runtime/preview.vue +3 -1
  29. package/dist/nuxt/runtime/schema.d.ts +6 -0
  30. package/dist/nuxt/runtime/server/bundles.d.ts +4 -0
  31. package/dist/nuxt/runtime/server/files-md.d.ts +2 -0
  32. package/dist/nuxt/runtime/server/files.d.ts +2 -0
  33. package/dist/nuxt/runtime/server/headers.d.ts +2 -0
  34. package/dist/nuxt/runtime/server/items.d.mts +12 -0
  35. package/dist/nuxt/runtime/server/items.d.ts +12 -0
  36. package/dist/nuxt/runtime/server/items.mjs +17 -0
  37. package/dist/nuxt/runtime/server/llms-full.d.ts +2 -0
  38. package/dist/nuxt/runtime/server/llms.d.ts +2 -0
  39. package/dist/nuxt/runtime/server/markdown-trees.d.ts +2 -0
  40. package/dist/nuxt/runtime/server/markdown.d.ts +2 -0
  41. package/dist/nuxt/runtime/server/markdown.mjs +1 -1
  42. package/dist/nuxt/runtime/server/platform-md.d.mts +3 -0
  43. package/dist/nuxt/runtime/server/platform-md.d.ts +3 -0
  44. package/dist/nuxt/runtime/server/platform-md.mjs +71 -0
  45. package/dist/nuxt/runtime/server/redirects.d.ts +2 -0
  46. package/dist/nuxt/runtime/server/robots.d.ts +2 -0
  47. package/dist/nuxt/runtime/server/search.d.ts +2 -0
  48. package/dist/nuxt/runtime/server/site-config.d.ts +14 -0
  49. package/dist/nuxt/runtime/server/sitemap-source.d.ts +2 -0
  50. package/dist/nuxt/runtime/server/sitemap-xml.d.ts +24 -0
  51. package/dist/nuxt/runtime/server/sitemap.d.ts +2 -0
  52. package/dist/nuxt/runtime/shared.d.mts +10 -3
  53. package/dist/nuxt/runtime/shared.mjs +2 -2
  54. package/dist/shared/ginko.1wwZv4B_.d.ts +1622 -0
  55. package/dist/shared/{ginko.BBkZW2nW.d.ts → ginko.6cI8KXZP.d.mts} +2 -2
  56. package/dist/shared/{ginko.CQvxhyez.mjs → ginko.AprJymER.mjs} +30 -1
  57. package/dist/shared/ginko.BNVC-g9n.mjs +10389 -0
  58. package/dist/shared/{ginko.Bwan3BB-.d.mts → ginko.B_pACpVU.d.ts} +2 -2
  59. package/dist/shared/{ginko.CrNRBkS5.mjs → ginko.C4gcOovG.mjs} +253 -309
  60. package/dist/shared/{ginko.C90fPpMP.mjs → ginko.CXA2R3aS.mjs} +128 -101
  61. package/dist/shared/ginko.CjWB8N7f.d.ts +128 -0
  62. package/dist/shared/ginko.D1PeQ3ds.mjs +36 -0
  63. package/dist/shared/ginko.DIl7l-75.mjs +26 -0
  64. package/dist/shared/ginko.DY7RbCEw.mjs +601 -0
  65. package/dist/shared/ginko.Dmgixfpf.mjs +130 -0
  66. package/dist/shared/{ginko.D-fNojn9.d.mts → ginko.DrkUeYFP.d.mts} +824 -10
  67. package/dist/shared/{ginko.D-fNojn9.d.ts → ginko.DrkUeYFP.d.ts} +824 -10
  68. package/dist/shared/{ginko.akHewCGt.d.mts → ginko.DvPtlHIz.d.mts} +50 -5
  69. package/dist/shared/{ginko.BDF3bW0C.d.ts → ginko.EelR5dt9.d.ts} +50 -5
  70. package/dist/shared/ginko.ULKQnAWd.d.ts +91 -0
  71. package/dist/shared/ginko.loGIxGZg.d.mts +91 -0
  72. package/dist/shared/ginko.o1yIKlgj.d.mts +128 -0
  73. package/dist/shared/ginko.plW4dLmm.d.mts +1622 -0
  74. package/dist/shared/{ginko.Dht0xxE5.mjs → ginko.raCzOPYC.mjs} +1 -2
  75. package/dist/shared/ginko.yKMIjJ68.mjs +84 -0
  76. package/dist/vue.d.mts +5 -4
  77. package/dist/vue.d.ts +5 -4
  78. package/dist/vue.mjs +1 -1
  79. package/i18n/ar.json +212 -0
  80. package/i18n/de.json +9 -1
  81. package/i18n/en.json +9 -1
  82. package/i18n/es.json +12 -4
  83. package/i18n/fr.json +212 -0
  84. package/i18n/it.json +212 -0
  85. package/package.json +7 -3
  86. package/dist/shared/ginko.BTUfZCfa.d.mts +0 -172
  87. package/dist/shared/ginko.C-QjDn3O.mjs +0 -4944
  88. package/dist/shared/ginko.Dc0oNcDv.d.ts +0 -172
  89. package/dist/shared/ginko.Mn30dmlm.mjs +0 -20
@@ -1,5 +1,5 @@
1
- import { b as Msg, S as Schema, F as Fields, J as Json, L as Locale, C as Currency, B as Brick, a as ComponentRegistry, R as RetiredRule, c as Label, d as BrickSource, T as Task, V as Visibility, e as CollectionBrick, f as SingleBrick } from './ginko.D-fNojn9.mjs';
2
- import { B as Bundle } from './ginko.Bwan3BB-.mjs';
1
+ import { a as Msg, S as Schema, F as Fields, J as Json, L as Locale, C as Currency, H as HolidaysOption, B as Brick, b as ComponentRegistry, R as RetiredRule, c as Label, d as BrickSource, T as Task, V as Visibility, e as CollectionStatus, f as CollectionBrick, g as SingleStatus, h as SingleBrick } from './ginko.DrkUeYFP.mjs';
2
+ import { B as Bundle } from './ginko.6cI8KXZP.mjs';
3
3
 
4
4
  interface Redirect {
5
5
  from: string;
@@ -59,10 +59,12 @@ type Pages = Pick<Schema, 'pages' | 'bricks'>;
59
59
  /**
60
60
  * The bundle with `$…` links turned into paths and `::snippet` components replaced by their text.
61
61
  * `$page.<key>` is a page of `schema.pages`; `$<brick>.<slug-or-id>` is an entry's URL; a `#anchor` is kept.
62
+ * `main` is the main-language bundle (from `buildBundle`, links unresolved): an entry left out of this locale because
63
+ * it is not translated (`untranslated: 'hide'`) is found there, and the link goes to its main-language page.
62
64
  * What cannot be resolved stays as it is and gets `data-broken: true`. A snippet is the `body` of the entry
63
65
  * `snippets/<name>` of the collection `snippets`; a snippet inside a snippet stays as it is. No mutation.
64
66
  */
65
- declare function resolveRouteLinks(bundle: Bundle, schema: Pages): Bundle;
67
+ declare function resolveRouteLinks(bundle: Bundle, schema: Pages, main?: Bundle): Bundle;
66
68
  /**
67
69
  * Link check over bundles (one per locale) before any HTML exists. Errors: route links and snippets that
68
70
  * `resolveRouteLinks` could not resolve, and `/…` paths that match no entry URL, no page and no public file.
@@ -117,6 +119,16 @@ interface SiteInput {
117
119
  */
118
120
  firstDayOfWeek?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
119
121
  currency: Currency;
122
+ /**
123
+ * The country of the site (ISO 3166-1 alpha-2, e.g. `AT`). It picks the public-holiday calendar (`calendar`) and is
124
+ * the default `addressCountry` of JSON-LD. A country Ginko has no calendar for keeps no public holidays (`ginko check` warns).
125
+ */
126
+ country?: string;
127
+ /**
128
+ * Which public holidays count for opening hours: `AT`, `DE` (nationwide only), `SG`, `none`, or your own function
129
+ * `(year) => Holiday[]`. Default: the calendar of `country`. Stored in the schema as `holidays` (a function as `custom`).
130
+ */
131
+ calendar?: HolidaysOption;
120
132
  /**
121
133
  * Static pages by key: `{ menu: { de: '/speisekarte', en: '/en/menu' } }`. A plain path is the page in
122
134
  * the main locale only. The home page is the page whose main-locale path is `/`. The sitemap pairs a page's locales by key.
@@ -136,6 +148,7 @@ interface SiteInput {
136
148
  image?: string;
137
149
  /** The brand colour, `#rrggbb` or `#rgb`: the background of generated share cards (nuxt-og-image). */
138
150
  color?: string;
151
+ /** The home page's Organization JSON-LD. A page with its own (`siteJsonLd` of `@lupinum/ginko/basics`) gets none from here. */
139
152
  organization?: {
140
153
  logo?: string;
141
154
  sameAs?: string[];
@@ -170,12 +183,34 @@ type RetiredInput<S extends SiteInput> = {
170
183
  declare function defineSite<const S extends SiteInput>(site: S & {
171
184
  retired?: RetiredInput<S>;
172
185
  }): S;
186
+ /**
187
+ * `site` as it runs on the platform: every brick without `source`, so the owner edits it in the Studio. A template
188
+ * that reads its content from files and this twin must both pass `checkSite`; tools and tests use it to prove that a
189
+ * files site can move to the platform without changing its bricks.
190
+ */
191
+ declare function withoutFiles<const S extends SiteInput>(site: S): WithoutFiles<S>;
192
+ /** `S` with no `source` on any brick. */
193
+ type WithoutFiles<S extends SiteInput> = Omit<S, 'bricks'> & {
194
+ bricks: {
195
+ [K in keyof S['bricks']]: Omit<S['bricks'][K], 'source'>;
196
+ };
197
+ };
173
198
  /** The names of the fields in `F` whose type is one of `T`. */
174
199
  type FieldsOfType<F, T extends string> = {
175
200
  [K in keyof F]: F[K] extends {
176
201
  type: T;
177
202
  } ? K : never;
178
203
  }[keyof F] & string;
204
+ /**
205
+ * A planned change of one field (`planned`): from the date in the date field `from` on, `next` replaces `field`. `next`
206
+ * and `from` are optional and set together; every edit task that changes `field` lists them too. Field names only:
207
+ * a factory with generic fields could not name its date field otherwise, so `ginko check` reports the other rules.
208
+ */
209
+ type Planned<F> = {
210
+ field: keyof F & string;
211
+ next: keyof F & string;
212
+ from: keyof F & string;
213
+ };
179
214
  /** A collection's detail page per locale: a path with `[slug]` where the entry's slug goes, e.g. `/blog/[slug]`. */
180
215
  type RouteTemplate = `/${string}[slug]${string}`;
181
216
  declare function single<const F extends Fields>(input: {
@@ -185,6 +220,8 @@ declare function single<const F extends Fields>(input: {
185
220
  fields: F;
186
221
  layout?: 'sections' | 'tabs';
187
222
  tasks?: readonly Task<F>[];
223
+ planned?: Planned<F>;
224
+ status?: SingleStatus;
188
225
  }): SingleBrick<F>;
189
226
  declare function collection<const F extends Fields, const R extends Record<Locale, RouteTemplate> | undefined = undefined>(input: {
190
227
  label: Label;
@@ -193,6 +230,8 @@ declare function collection<const F extends Fields, const R extends Record<Local
193
230
  fields: F;
194
231
  layout?: 'sections' | 'tabs';
195
232
  tasks?: readonly Task<F>[];
233
+ /** A planned change of one field: from the date in `from` on, `next` replaces `field`. */
234
+ planned?: Planned<F>;
196
235
  max: number;
197
236
  order: 'manual' | {
198
237
  field: keyof F & string;
@@ -200,6 +239,10 @@ declare function collection<const F extends Fields, const R extends Record<Local
200
239
  };
201
240
  route?: R;
202
241
  visible?: Visibility<FieldsOfType<F, 'date' | 'daterange'>>;
242
+ /**
243
+ * A required translatable field is missing in a language: `'hide'` (default with a `route`) leaves the entry out
244
+ * there; `'fallback'` (default without) shows the main language and links to the main-language page.
245
+ */
203
246
  untranslated?: 'fallback' | 'hide';
204
247
  /** Entries plan weeks of the single brick `brick`; `field` (a date field of this collection) holds the first day of the week (`firstDayOfWeek`). */
205
248
  plans?: {
@@ -207,7 +250,9 @@ declare function collection<const F extends Fields, const R extends Record<Local
207
250
  field: FieldsOfType<F, 'date'>;
208
251
  };
209
252
  drafts?: boolean;
253
+ /** The status line on the Studio's Today page (see `CollectionStatus`). */
254
+ status?: CollectionStatus<FieldsOfType<F, 'date' | 'daterange'>, keyof F & string>;
210
255
  }): CollectionBrick<F, R>;
211
256
 
212
- export { checkLinks as d, collection as e, defineSite as f, entryRedirects as g, externalLinks as h, findRedirect as i, resolveRouteLinks as j, linkTargets as l, matchRedirect as m, redirectProblems as r, single as s };
213
- export type { CheckLinksOptions as C, ExternalLink as E, LinkConfig as L, Migration as M, Redirect as R, SiteInput as S, LinkIssue as a, MigrationContext as b, RouteTemplate as c };
257
+ export { checkLinks as d, collection as e, defineSite as f, entryRedirects as g, externalLinks as h, findRedirect as i, resolveRouteLinks as j, linkTargets as l, matchRedirect as m, redirectProblems as r, single as s, withoutFiles as w };
258
+ export type { CheckLinksOptions as C, ExternalLink as E, LinkConfig as L, Migration as M, RouteTemplate as R, SiteInput as S, WithoutFiles as W, LinkIssue as a, MigrationContext as b, Redirect as c };
@@ -1,5 +1,5 @@
1
- import { b as Msg, S as Schema, F as Fields, J as Json, L as Locale, C as Currency, B as Brick, a as ComponentRegistry, R as RetiredRule, c as Label, d as BrickSource, T as Task, V as Visibility, e as CollectionBrick, f as SingleBrick } from './ginko.D-fNojn9.js';
2
- import { B as Bundle } from './ginko.BBkZW2nW.js';
1
+ import { a as Msg, S as Schema, F as Fields, J as Json, L as Locale, C as Currency, H as HolidaysOption, B as Brick, b as ComponentRegistry, R as RetiredRule, c as Label, d as BrickSource, T as Task, V as Visibility, e as CollectionStatus, f as CollectionBrick, g as SingleStatus, h as SingleBrick } from './ginko.DrkUeYFP.js';
2
+ import { B as Bundle } from './ginko.B_pACpVU.js';
3
3
 
4
4
  interface Redirect {
5
5
  from: string;
@@ -59,10 +59,12 @@ type Pages = Pick<Schema, 'pages' | 'bricks'>;
59
59
  /**
60
60
  * The bundle with `$…` links turned into paths and `::snippet` components replaced by their text.
61
61
  * `$page.<key>` is a page of `schema.pages`; `$<brick>.<slug-or-id>` is an entry's URL; a `#anchor` is kept.
62
+ * `main` is the main-language bundle (from `buildBundle`, links unresolved): an entry left out of this locale because
63
+ * it is not translated (`untranslated: 'hide'`) is found there, and the link goes to its main-language page.
62
64
  * What cannot be resolved stays as it is and gets `data-broken: true`. A snippet is the `body` of the entry
63
65
  * `snippets/<name>` of the collection `snippets`; a snippet inside a snippet stays as it is. No mutation.
64
66
  */
65
- declare function resolveRouteLinks(bundle: Bundle, schema: Pages): Bundle;
67
+ declare function resolveRouteLinks(bundle: Bundle, schema: Pages, main?: Bundle): Bundle;
66
68
  /**
67
69
  * Link check over bundles (one per locale) before any HTML exists. Errors: route links and snippets that
68
70
  * `resolveRouteLinks` could not resolve, and `/…` paths that match no entry URL, no page and no public file.
@@ -117,6 +119,16 @@ interface SiteInput {
117
119
  */
118
120
  firstDayOfWeek?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
119
121
  currency: Currency;
122
+ /**
123
+ * The country of the site (ISO 3166-1 alpha-2, e.g. `AT`). It picks the public-holiday calendar (`calendar`) and is
124
+ * the default `addressCountry` of JSON-LD. A country Ginko has no calendar for keeps no public holidays (`ginko check` warns).
125
+ */
126
+ country?: string;
127
+ /**
128
+ * Which public holidays count for opening hours: `AT`, `DE` (nationwide only), `SG`, `none`, or your own function
129
+ * `(year) => Holiday[]`. Default: the calendar of `country`. Stored in the schema as `holidays` (a function as `custom`).
130
+ */
131
+ calendar?: HolidaysOption;
120
132
  /**
121
133
  * Static pages by key: `{ menu: { de: '/speisekarte', en: '/en/menu' } }`. A plain path is the page in
122
134
  * the main locale only. The home page is the page whose main-locale path is `/`. The sitemap pairs a page's locales by key.
@@ -136,6 +148,7 @@ interface SiteInput {
136
148
  image?: string;
137
149
  /** The brand colour, `#rrggbb` or `#rgb`: the background of generated share cards (nuxt-og-image). */
138
150
  color?: string;
151
+ /** The home page's Organization JSON-LD. A page with its own (`siteJsonLd` of `@lupinum/ginko/basics`) gets none from here. */
139
152
  organization?: {
140
153
  logo?: string;
141
154
  sameAs?: string[];
@@ -170,12 +183,34 @@ type RetiredInput<S extends SiteInput> = {
170
183
  declare function defineSite<const S extends SiteInput>(site: S & {
171
184
  retired?: RetiredInput<S>;
172
185
  }): S;
186
+ /**
187
+ * `site` as it runs on the platform: every brick without `source`, so the owner edits it in the Studio. A template
188
+ * that reads its content from files and this twin must both pass `checkSite`; tools and tests use it to prove that a
189
+ * files site can move to the platform without changing its bricks.
190
+ */
191
+ declare function withoutFiles<const S extends SiteInput>(site: S): WithoutFiles<S>;
192
+ /** `S` with no `source` on any brick. */
193
+ type WithoutFiles<S extends SiteInput> = Omit<S, 'bricks'> & {
194
+ bricks: {
195
+ [K in keyof S['bricks']]: Omit<S['bricks'][K], 'source'>;
196
+ };
197
+ };
173
198
  /** The names of the fields in `F` whose type is one of `T`. */
174
199
  type FieldsOfType<F, T extends string> = {
175
200
  [K in keyof F]: F[K] extends {
176
201
  type: T;
177
202
  } ? K : never;
178
203
  }[keyof F] & string;
204
+ /**
205
+ * A planned change of one field (`planned`): from the date in the date field `from` on, `next` replaces `field`. `next`
206
+ * and `from` are optional and set together; every edit task that changes `field` lists them too. Field names only:
207
+ * a factory with generic fields could not name its date field otherwise, so `ginko check` reports the other rules.
208
+ */
209
+ type Planned<F> = {
210
+ field: keyof F & string;
211
+ next: keyof F & string;
212
+ from: keyof F & string;
213
+ };
179
214
  /** A collection's detail page per locale: a path with `[slug]` where the entry's slug goes, e.g. `/blog/[slug]`. */
180
215
  type RouteTemplate = `/${string}[slug]${string}`;
181
216
  declare function single<const F extends Fields>(input: {
@@ -185,6 +220,8 @@ declare function single<const F extends Fields>(input: {
185
220
  fields: F;
186
221
  layout?: 'sections' | 'tabs';
187
222
  tasks?: readonly Task<F>[];
223
+ planned?: Planned<F>;
224
+ status?: SingleStatus;
188
225
  }): SingleBrick<F>;
189
226
  declare function collection<const F extends Fields, const R extends Record<Locale, RouteTemplate> | undefined = undefined>(input: {
190
227
  label: Label;
@@ -193,6 +230,8 @@ declare function collection<const F extends Fields, const R extends Record<Local
193
230
  fields: F;
194
231
  layout?: 'sections' | 'tabs';
195
232
  tasks?: readonly Task<F>[];
233
+ /** A planned change of one field: from the date in `from` on, `next` replaces `field`. */
234
+ planned?: Planned<F>;
196
235
  max: number;
197
236
  order: 'manual' | {
198
237
  field: keyof F & string;
@@ -200,6 +239,10 @@ declare function collection<const F extends Fields, const R extends Record<Local
200
239
  };
201
240
  route?: R;
202
241
  visible?: Visibility<FieldsOfType<F, 'date' | 'daterange'>>;
242
+ /**
243
+ * A required translatable field is missing in a language: `'hide'` (default with a `route`) leaves the entry out
244
+ * there; `'fallback'` (default without) shows the main language and links to the main-language page.
245
+ */
203
246
  untranslated?: 'fallback' | 'hide';
204
247
  /** Entries plan weeks of the single brick `brick`; `field` (a date field of this collection) holds the first day of the week (`firstDayOfWeek`). */
205
248
  plans?: {
@@ -207,7 +250,9 @@ declare function collection<const F extends Fields, const R extends Record<Local
207
250
  field: FieldsOfType<F, 'date'>;
208
251
  };
209
252
  drafts?: boolean;
253
+ /** The status line on the Studio's Today page (see `CollectionStatus`). */
254
+ status?: CollectionStatus<FieldsOfType<F, 'date' | 'daterange'>, keyof F & string>;
210
255
  }): CollectionBrick<F, R>;
211
256
 
212
- export { checkLinks as d, collection as e, defineSite as f, entryRedirects as g, externalLinks as h, findRedirect as i, resolveRouteLinks as j, linkTargets as l, matchRedirect as m, redirectProblems as r, single as s };
213
- export type { CheckLinksOptions as C, ExternalLink as E, LinkConfig as L, Migration as M, Redirect as R, SiteInput as S, LinkIssue as a, MigrationContext as b, RouteTemplate as c };
257
+ export { checkLinks as d, collection as e, defineSite as f, entryRedirects as g, externalLinks as h, findRedirect as i, resolveRouteLinks as j, linkTargets as l, matchRedirect as m, redirectProblems as r, single as s, withoutFiles as w };
258
+ export type { CheckLinksOptions as C, ExternalLink as E, LinkConfig as L, Migration as M, RouteTemplate as R, SiteInput as S, WithoutFiles as W, LinkIssue as a, MigrationContext as b, Redirect as c };
@@ -0,0 +1,91 @@
1
+ import './ginko.EelR5dt9.js';
2
+ import { af as Money, F as Fields } from './ginko.DrkUeYFP.js';
3
+ import './ginko.CjWB8N7f.js';
4
+ import { a as BundleItem, B as Bundle } from './ginko.B_pACpVU.js';
5
+
6
+ /** http(s), mailto, tel, a same-site path or fragment, or a `$` route link. Everything else (javascript:, data:, //host) is unsafe. */
7
+ declare function isSafeHref(href: string): boolean;
8
+ /** The link or image URL when it is safe (see `isSafeHref`), else undefined: for `href`/`src` from content. */
9
+ declare function safeHref(href: string | undefined): string | undefined;
10
+
11
+ /**
12
+ * Money is stored as an integer count of the currency's minor units (cents for EUR, whole yen for JPY).
13
+ * `minorDigits` says how many decimals one unit has: 2 for EUR, 0 for JPY, 3 for KWD.
14
+ */
15
+ declare function minorDigits(currency: string): number;
16
+ /** Options of `formatMoney`. */
17
+ interface FormatMoneyOptions {
18
+ /** A whole amount without its minor units: `€390` instead of `€390.00`; `€12.50` stays as it is. Default false. */
19
+ wholeWithoutMinor?: boolean;
20
+ }
21
+ /**
22
+ * The amount in the notation of `language`, a BCP 47 tag such as `de-AT` (use `useI18n().language`, not the URL
23
+ * code): `12,50 €` in de, `€ 12,50` in de-AT, `€12.50` in en, `¥1,250` for JPY.
24
+ * Every space is a no-break space: Node and browsers ship different ICU data (one uses a plain
25
+ * space), so a server-rendered price would otherwise differ from the hydrated one, and a price never breaks in two.
26
+ */
27
+ declare function formatMoney(money: Money, language: string, options?: FormatMoneyOptions): string;
28
+
29
+ type Data = Record<string, unknown>;
30
+ /** What a condition compares a value with: one element of a list value, money by `amount`, a daterange by its start date. */
31
+ type Comparable<V> = V extends readonly (infer E)[] ? E : V extends Money ? Pick<Money, 'amount'> : V extends {
32
+ from: string;
33
+ } ? string : V;
34
+ /**
35
+ * A test on one field. `eq`/`ne`: equal or not (for a list value: one element is). `gt`, `gte`, `lt`, `lte`: compare.
36
+ * `in`: equal to one of these. `contains`: a text contains this text (case-insensitive), a list contains this element.
37
+ */
38
+ interface Condition<V = unknown> {
39
+ eq?: Comparable<V> | null;
40
+ ne?: Comparable<V> | null;
41
+ gt?: Comparable<V>;
42
+ gte?: Comparable<V>;
43
+ lt?: Comparable<V>;
44
+ lte?: Comparable<V>;
45
+ in?: readonly Comparable<V>[];
46
+ contains?: Comparable<V>;
47
+ }
48
+ /** A sort order: the text `'price desc, name'` (`asc` is the default) or `{ field, dir? }` like a brick's `order`. */
49
+ type QueryOrder<D = Data> = string | {
50
+ field: keyof D & string;
51
+ dir?: 'asc' | 'desc';
52
+ };
53
+ /** `D` is the data of the brick's entries; `useGinkoQuery` sets it, so field names and values are checked. */
54
+ interface Query<D = Data> {
55
+ /** Per field a value (equal to it) or a `Condition`; every field must match. */
56
+ where?: {
57
+ [K in keyof D]?: Comparable<D[K]> | null | Condition<D[K]>;
58
+ };
59
+ /** Default: the bundle's item order. */
60
+ order?: QueryOrder<D>;
61
+ /** At least 1; without it, every matching entry. */
62
+ limit?: number;
63
+ /** 1-based. */
64
+ page?: number;
65
+ fields?: (keyof D & string)[];
66
+ facets?: (keyof D & string)[];
67
+ include?: (keyof D & string)[];
68
+ }
69
+ interface QueryResult {
70
+ items: BundleItem[];
71
+ total: number;
72
+ page: number;
73
+ pages: number;
74
+ facets?: Record<string, Record<string, number>>;
75
+ }
76
+ /** What `query` reads of the schema: the fields of each brick (a full `Schema` fits). */
77
+ interface QuerySchema {
78
+ bricks: Record<string, {
79
+ fields: Fields;
80
+ }>;
81
+ }
82
+ /** Filter, order, page, project and enrich the items of one collection brick. Pure; throws on a field the brick does not have. */
83
+ declare function query(bundle: Bundle, brick: string, q?: Query, schema?: QuerySchema): QueryResult;
84
+ /** The items before and after `id` in the given (or default) order. Both are missing for an unknown id. */
85
+ declare function neighbors(bundle: Bundle, brick: string, id: string, order?: QueryOrder): {
86
+ prev?: BundleItem;
87
+ next?: BundleItem;
88
+ };
89
+
90
+ export { formatMoney as f, isSafeHref as i, minorDigits as m, neighbors as n, query as q, safeHref as s };
91
+ export type { Condition as C, FormatMoneyOptions as F, Query as Q, QueryOrder as a, QueryResult as b, QuerySchema as c };
@@ -0,0 +1,91 @@
1
+ import './ginko.DvPtlHIz.mjs';
2
+ import { af as Money, F as Fields } from './ginko.DrkUeYFP.mjs';
3
+ import './ginko.o1yIKlgj.mjs';
4
+ import { a as BundleItem, B as Bundle } from './ginko.6cI8KXZP.mjs';
5
+
6
+ /** http(s), mailto, tel, a same-site path or fragment, or a `$` route link. Everything else (javascript:, data:, //host) is unsafe. */
7
+ declare function isSafeHref(href: string): boolean;
8
+ /** The link or image URL when it is safe (see `isSafeHref`), else undefined: for `href`/`src` from content. */
9
+ declare function safeHref(href: string | undefined): string | undefined;
10
+
11
+ /**
12
+ * Money is stored as an integer count of the currency's minor units (cents for EUR, whole yen for JPY).
13
+ * `minorDigits` says how many decimals one unit has: 2 for EUR, 0 for JPY, 3 for KWD.
14
+ */
15
+ declare function minorDigits(currency: string): number;
16
+ /** Options of `formatMoney`. */
17
+ interface FormatMoneyOptions {
18
+ /** A whole amount without its minor units: `€390` instead of `€390.00`; `€12.50` stays as it is. Default false. */
19
+ wholeWithoutMinor?: boolean;
20
+ }
21
+ /**
22
+ * The amount in the notation of `language`, a BCP 47 tag such as `de-AT` (use `useI18n().language`, not the URL
23
+ * code): `12,50 €` in de, `€ 12,50` in de-AT, `€12.50` in en, `¥1,250` for JPY.
24
+ * Every space is a no-break space: Node and browsers ship different ICU data (one uses a plain
25
+ * space), so a server-rendered price would otherwise differ from the hydrated one, and a price never breaks in two.
26
+ */
27
+ declare function formatMoney(money: Money, language: string, options?: FormatMoneyOptions): string;
28
+
29
+ type Data = Record<string, unknown>;
30
+ /** What a condition compares a value with: one element of a list value, money by `amount`, a daterange by its start date. */
31
+ type Comparable<V> = V extends readonly (infer E)[] ? E : V extends Money ? Pick<Money, 'amount'> : V extends {
32
+ from: string;
33
+ } ? string : V;
34
+ /**
35
+ * A test on one field. `eq`/`ne`: equal or not (for a list value: one element is). `gt`, `gte`, `lt`, `lte`: compare.
36
+ * `in`: equal to one of these. `contains`: a text contains this text (case-insensitive), a list contains this element.
37
+ */
38
+ interface Condition<V = unknown> {
39
+ eq?: Comparable<V> | null;
40
+ ne?: Comparable<V> | null;
41
+ gt?: Comparable<V>;
42
+ gte?: Comparable<V>;
43
+ lt?: Comparable<V>;
44
+ lte?: Comparable<V>;
45
+ in?: readonly Comparable<V>[];
46
+ contains?: Comparable<V>;
47
+ }
48
+ /** A sort order: the text `'price desc, name'` (`asc` is the default) or `{ field, dir? }` like a brick's `order`. */
49
+ type QueryOrder<D = Data> = string | {
50
+ field: keyof D & string;
51
+ dir?: 'asc' | 'desc';
52
+ };
53
+ /** `D` is the data of the brick's entries; `useGinkoQuery` sets it, so field names and values are checked. */
54
+ interface Query<D = Data> {
55
+ /** Per field a value (equal to it) or a `Condition`; every field must match. */
56
+ where?: {
57
+ [K in keyof D]?: Comparable<D[K]> | null | Condition<D[K]>;
58
+ };
59
+ /** Default: the bundle's item order. */
60
+ order?: QueryOrder<D>;
61
+ /** At least 1; without it, every matching entry. */
62
+ limit?: number;
63
+ /** 1-based. */
64
+ page?: number;
65
+ fields?: (keyof D & string)[];
66
+ facets?: (keyof D & string)[];
67
+ include?: (keyof D & string)[];
68
+ }
69
+ interface QueryResult {
70
+ items: BundleItem[];
71
+ total: number;
72
+ page: number;
73
+ pages: number;
74
+ facets?: Record<string, Record<string, number>>;
75
+ }
76
+ /** What `query` reads of the schema: the fields of each brick (a full `Schema` fits). */
77
+ interface QuerySchema {
78
+ bricks: Record<string, {
79
+ fields: Fields;
80
+ }>;
81
+ }
82
+ /** Filter, order, page, project and enrich the items of one collection brick. Pure; throws on a field the brick does not have. */
83
+ declare function query(bundle: Bundle, brick: string, q?: Query, schema?: QuerySchema): QueryResult;
84
+ /** The items before and after `id` in the given (or default) order. Both are missing for an unknown id. */
85
+ declare function neighbors(bundle: Bundle, brick: string, id: string, order?: QueryOrder): {
86
+ prev?: BundleItem;
87
+ next?: BundleItem;
88
+ };
89
+
90
+ export { formatMoney as f, isSafeHref as i, minorDigits as m, neighbors as n, query as q, safeHref as s };
91
+ export type { Condition as C, FormatMoneyOptions as F, Query as Q, QueryOrder as a, QueryResult as b, QuerySchema as c };
@@ -0,0 +1,128 @@
1
+ import { B as Bundle } from './ginko.6cI8KXZP.mjs';
2
+ import { L as Locale } from './ginko.DrkUeYFP.mjs';
3
+
4
+ interface NavNode {
5
+ title: string;
6
+ path: string;
7
+ id?: string;
8
+ brick?: string;
9
+ children: NavNode[];
10
+ }
11
+ /**
12
+ * Navigation tree of the collections `bricks` in `locale`, built from item URLs. An item is a child of the
13
+ * node at its nearest existing path prefix, else a root node. A string `parent` field (item id) overrides that.
14
+ * Siblings keep the item order of the bundle (bricks in the given order).
15
+ */
16
+ declare function navTree(bundle: Bundle, bricks: string[], locale: Locale): NavNode[];
17
+ /** Nodes from the root down to the node at `path`; empty when the path is not in the tree. */
18
+ declare function breadcrumbs(tree: NavNode[], path: string): NavNode[];
19
+
20
+ interface SeoImage {
21
+ url: string;
22
+ width?: number;
23
+ height?: number;
24
+ alt?: string;
25
+ }
26
+ interface SeoInput {
27
+ siteName: string;
28
+ /** `%s` is replaced by the page title; default '%s · <siteName>'. A page without title gets siteName alone. */
29
+ titleTemplate?: string;
30
+ title?: string;
31
+ description?: string;
32
+ image?: SeoImage;
33
+ type?: 'website' | 'article';
34
+ noindex?: boolean;
35
+ }
36
+ interface SeoHead {
37
+ title: string;
38
+ meta: (({
39
+ name: string;
40
+ } | {
41
+ property: string;
42
+ }) & {
43
+ content: string;
44
+ })[];
45
+ }
46
+ declare function seoHead(input: SeoInput): SeoHead;
47
+ /** True when a request for `host` (with port, as in the Host header) is not for the site's own address: preview deployments, staging, localhost. Those must never be indexed. */
48
+ declare function isPreviewHost(host: string | undefined, siteUrl: string): boolean;
49
+ declare function robotsTxt(options: {
50
+ sitemap?: string;
51
+ noindex?: boolean;
52
+ disallow?: string[];
53
+ }): string;
54
+ declare function websiteLd(o: {
55
+ name: string;
56
+ url: string;
57
+ lang: string;
58
+ }): Record<string, unknown>;
59
+ /**
60
+ * `node` with the site's `country` (ISO 3166 code) where a builder left it out: `addressCountry` of every PostalAddress,
61
+ * and where remote applicants of a remote JobPosting must live. The Nuxt module applies it to a page's JSON-LD, so
62
+ * `siteJsonLd` and `jobJsonLd` need no `country` (an explicit one wins). An empty `country` changes nothing.
63
+ */
64
+ declare function withCountry<T>(node: T, country: string): T;
65
+ /** The schema.org types `organizationLd` writes. A page whose JSON-LD has a node of one of them is the site's organisation node. */
66
+ declare const ORGANIZATION_TYPES: readonly ["Organization", "LocalBusiness", "NGO"];
67
+ interface OrganizationLdInput {
68
+ name: string;
69
+ url: string;
70
+ /** `Organization` (default), `LocalBusiness` for a shop or practice, `NGO` for a nonprofit. */
71
+ type?: (typeof ORGANIZATION_TYPES)[number];
72
+ legalName?: string;
73
+ /** Absolute URL of the logo. */
74
+ logo?: string;
75
+ email?: string;
76
+ telephone?: string;
77
+ address?: {
78
+ street?: string;
79
+ postalCode?: string;
80
+ city?: string;
81
+ country?: string;
82
+ };
83
+ vatID?: string;
84
+ /** Absolute URLs of the organisation's profiles elsewhere. */
85
+ sameAs?: string[];
86
+ }
87
+ declare function organizationLd(o: OrganizationLdInput): Record<string, unknown>;
88
+ /**
89
+ * A schema.org BreadcrumbList from the first step (usually the home page) to the page itself. Each step has a `title`
90
+ * and a `path` of the site, as the nodes of `useGinkoBreadcrumbs` do; `siteUrl` (`useGinkoSite().url`) makes the
91
+ * paths absolute.
92
+ */
93
+ declare function breadcrumbJsonLd(steps: readonly Pick<NavNode, 'title' | 'path'>[], siteUrl: string): Record<string, unknown>;
94
+ interface ArticleLdInput {
95
+ /** `Article` (default) or `BlogPosting` for a post of a blog. */
96
+ type?: 'Article' | 'BlogPosting';
97
+ title: string;
98
+ url: string;
99
+ description?: string;
100
+ image?: string;
101
+ published?: string;
102
+ modified?: string;
103
+ /** One author by name, or a list of authors with an optional website each. */
104
+ author?: string | readonly {
105
+ name: string;
106
+ url?: string;
107
+ }[];
108
+ keywords?: readonly string[];
109
+ lang: string;
110
+ }
111
+ declare function articleLd(o: ArticleLdInput): Record<string, unknown>;
112
+ declare function faqLd(pairs: {
113
+ question: string;
114
+ answer: string;
115
+ }[]): Record<string, unknown>;
116
+ /**
117
+ * Headers every response of a Ginko site carries. Only the platform may frame `/__ginko` (the preview); nothing
118
+ * else is framed. `nosniff` stops a browser from reading user text (`.md`, `llms.txt`, JSON) as HTML, and the
119
+ * referrer policy keeps full URLs from leaving the site.
120
+ */
121
+ declare function siteHeaders(input: {
122
+ preview: boolean;
123
+ platformOrigin: string;
124
+ noindex: boolean;
125
+ }): Record<string, string>;
126
+
127
+ export { ORGANIZATION_TYPES as a, articleLd as d, breadcrumbJsonLd as e, breadcrumbs as f, faqLd as g, siteHeaders as h, isPreviewHost as i, withCountry as j, navTree as n, organizationLd as o, robotsTxt as r, seoHead as s, websiteLd as w };
128
+ export type { ArticleLdInput as A, NavNode as N, OrganizationLdInput as O, SeoHead as S, SeoImage as b, SeoInput as c };