@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.
- package/CHANGELOG.md +150 -0
- package/README.md +2 -2
- package/dist/basics.d.mts +492 -0
- package/dist/basics.d.ts +492 -0
- package/dist/basics.mjs +416 -0
- package/dist/cli/index.mjs +54 -55
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +3 -3
- package/dist/internal/search.mjs +6 -3
- package/dist/internal.d.mts +387 -41
- package/dist/internal.d.ts +387 -41
- package/dist/internal.mjs +267 -101
- package/dist/nuxt/module.d.mts +2 -2
- package/dist/nuxt/module.d.ts +2 -2
- package/dist/nuxt/module.mjs +105 -13
- package/dist/nuxt/runtime/GinkoImage.d.mts +1 -1
- package/dist/nuxt/runtime/GinkoMarkdown.mjs +2 -2
- package/dist/nuxt/runtime/composables.d.mts +4 -3
- package/dist/nuxt/runtime/composables.mjs +19 -15
- package/dist/nuxt/runtime/fetch.d.mts +3 -1
- package/dist/nuxt/runtime/fetch.mjs +12 -6
- package/dist/nuxt/runtime/markdown.d.mts +3 -0
- package/dist/nuxt/runtime/markdown.mjs +15 -3
- package/dist/nuxt/runtime/plugin.mjs +6 -35
- package/dist/nuxt/runtime/preview-listener.d.mts +13 -0
- package/dist/nuxt/runtime/preview-listener.mjs +37 -0
- package/dist/nuxt/runtime/preview.vue +3 -1
- package/dist/nuxt/runtime/schema.d.ts +6 -0
- package/dist/nuxt/runtime/server/bundles.d.ts +4 -0
- package/dist/nuxt/runtime/server/files-md.d.ts +2 -0
- package/dist/nuxt/runtime/server/files.d.ts +2 -0
- package/dist/nuxt/runtime/server/headers.d.ts +2 -0
- package/dist/nuxt/runtime/server/items.d.mts +12 -0
- package/dist/nuxt/runtime/server/items.d.ts +12 -0
- package/dist/nuxt/runtime/server/items.mjs +17 -0
- package/dist/nuxt/runtime/server/llms-full.d.ts +2 -0
- package/dist/nuxt/runtime/server/llms.d.ts +2 -0
- package/dist/nuxt/runtime/server/markdown-trees.d.ts +2 -0
- package/dist/nuxt/runtime/server/markdown.d.ts +2 -0
- package/dist/nuxt/runtime/server/markdown.mjs +1 -1
- package/dist/nuxt/runtime/server/platform-md.d.mts +3 -0
- package/dist/nuxt/runtime/server/platform-md.d.ts +3 -0
- package/dist/nuxt/runtime/server/platform-md.mjs +71 -0
- package/dist/nuxt/runtime/server/redirects.d.ts +2 -0
- package/dist/nuxt/runtime/server/robots.d.ts +2 -0
- package/dist/nuxt/runtime/server/search.d.ts +2 -0
- package/dist/nuxt/runtime/server/site-config.d.ts +14 -0
- package/dist/nuxt/runtime/server/sitemap-source.d.ts +2 -0
- package/dist/nuxt/runtime/server/sitemap-xml.d.ts +24 -0
- package/dist/nuxt/runtime/server/sitemap.d.ts +2 -0
- package/dist/nuxt/runtime/shared.d.mts +10 -3
- package/dist/nuxt/runtime/shared.mjs +2 -2
- package/dist/shared/ginko.1wwZv4B_.d.ts +1622 -0
- package/dist/shared/{ginko.BBkZW2nW.d.ts → ginko.6cI8KXZP.d.mts} +2 -2
- package/dist/shared/{ginko.CQvxhyez.mjs → ginko.AprJymER.mjs} +30 -1
- package/dist/shared/ginko.BNVC-g9n.mjs +10389 -0
- package/dist/shared/{ginko.Bwan3BB-.d.mts → ginko.B_pACpVU.d.ts} +2 -2
- package/dist/shared/{ginko.CrNRBkS5.mjs → ginko.C4gcOovG.mjs} +253 -309
- package/dist/shared/{ginko.C90fPpMP.mjs → ginko.CXA2R3aS.mjs} +128 -101
- package/dist/shared/ginko.CjWB8N7f.d.ts +128 -0
- package/dist/shared/ginko.D1PeQ3ds.mjs +36 -0
- package/dist/shared/ginko.DIl7l-75.mjs +26 -0
- package/dist/shared/ginko.DY7RbCEw.mjs +601 -0
- package/dist/shared/ginko.Dmgixfpf.mjs +130 -0
- package/dist/shared/{ginko.D-fNojn9.d.mts → ginko.DrkUeYFP.d.mts} +824 -10
- package/dist/shared/{ginko.D-fNojn9.d.ts → ginko.DrkUeYFP.d.ts} +824 -10
- package/dist/shared/{ginko.akHewCGt.d.mts → ginko.DvPtlHIz.d.mts} +50 -5
- package/dist/shared/{ginko.BDF3bW0C.d.ts → ginko.EelR5dt9.d.ts} +50 -5
- package/dist/shared/ginko.ULKQnAWd.d.ts +91 -0
- package/dist/shared/ginko.loGIxGZg.d.mts +91 -0
- package/dist/shared/ginko.o1yIKlgj.d.mts +128 -0
- package/dist/shared/ginko.plW4dLmm.d.mts +1622 -0
- package/dist/shared/{ginko.Dht0xxE5.mjs → ginko.raCzOPYC.mjs} +1 -2
- package/dist/shared/ginko.yKMIjJ68.mjs +84 -0
- package/dist/vue.d.mts +5 -4
- package/dist/vue.d.ts +5 -4
- package/dist/vue.mjs +1 -1
- package/i18n/ar.json +212 -0
- package/i18n/de.json +9 -1
- package/i18n/en.json +9 -1
- package/i18n/es.json +12 -4
- package/i18n/fr.json +212 -0
- package/i18n/it.json +212 -0
- package/package.json +7 -3
- package/dist/shared/ginko.BTUfZCfa.d.mts +0 -172
- package/dist/shared/ginko.C-QjDn3O.mjs +0 -4944
- package/dist/shared/ginko.Dc0oNcDv.d.ts +0 -172
- package/dist/shared/ginko.Mn30dmlm.mjs +0 -20
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import './ginko.BDF3bW0C.js';
|
|
2
|
-
import { Z as Money, F as Fields, L as Locale } from './ginko.D-fNojn9.js';
|
|
3
|
-
import { a as BundleItem, B as Bundle } from './ginko.BBkZW2nW.js';
|
|
4
|
-
|
|
5
|
-
/** http(s), mailto, tel, a same-site path or fragment, or a `$` route link. Everything else (javascript:, data:, //host) is unsafe. */
|
|
6
|
-
declare function isSafeHref(href: string): boolean;
|
|
7
|
-
/** The link or image URL when it is safe (see `isSafeHref`), else undefined: for `href`/`src` from content. */
|
|
8
|
-
declare function safeHref(href: string | undefined): string | undefined;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Money is stored as an integer count of the currency's minor units (cents for EUR, whole yen for JPY).
|
|
12
|
-
* `minorDigits` says how many decimals one unit has: 2 for EUR, 0 for JPY, 3 for KWD.
|
|
13
|
-
*/
|
|
14
|
-
declare function minorDigits(currency: string): number;
|
|
15
|
-
/**
|
|
16
|
-
* The amount in the notation of `language`, a BCP 47 tag such as `de-AT` (use `useI18n().language`, not the URL
|
|
17
|
-
* code): `12,50 €` in de, `€ 12,50` in de-AT, `€12.50` in en, `¥1,250` for JPY.
|
|
18
|
-
* Every space is a no-break space: Node and browsers ship different ICU data (one uses a plain
|
|
19
|
-
* space), so a server-rendered price would otherwise differ from the hydrated one.
|
|
20
|
-
*/
|
|
21
|
-
declare function formatMoney(money: Money, language: string): string;
|
|
22
|
-
|
|
23
|
-
type Data = Record<string, unknown>;
|
|
24
|
-
/** What a condition compares a value with: one element of a list value, money by `amount`, a daterange by its start date. */
|
|
25
|
-
type Comparable<V> = V extends readonly (infer E)[] ? E : V extends Money ? Pick<Money, 'amount'> : V extends {
|
|
26
|
-
from: string;
|
|
27
|
-
} ? string : V;
|
|
28
|
-
/**
|
|
29
|
-
* A test on one field. `eq`/`ne`: equal or not (for a list value: one element is). `gt`, `gte`, `lt`, `lte`: compare.
|
|
30
|
-
* `in`: equal to one of these. `contains`: a text contains this text (case-insensitive), a list contains this element.
|
|
31
|
-
*/
|
|
32
|
-
interface Condition<V = unknown> {
|
|
33
|
-
eq?: Comparable<V> | null;
|
|
34
|
-
ne?: Comparable<V> | null;
|
|
35
|
-
gt?: Comparable<V>;
|
|
36
|
-
gte?: Comparable<V>;
|
|
37
|
-
lt?: Comparable<V>;
|
|
38
|
-
lte?: Comparable<V>;
|
|
39
|
-
in?: readonly Comparable<V>[];
|
|
40
|
-
contains?: Comparable<V>;
|
|
41
|
-
}
|
|
42
|
-
/** A sort order: the text `'price desc, name'` (`asc` is the default) or `{ field, dir? }` like a brick's `order`. */
|
|
43
|
-
type QueryOrder<D = Data> = string | {
|
|
44
|
-
field: keyof D & string;
|
|
45
|
-
dir?: 'asc' | 'desc';
|
|
46
|
-
};
|
|
47
|
-
/** `D` is the data of the brick's entries; `useGinkoQuery` sets it, so field names and values are checked. */
|
|
48
|
-
interface Query<D = Data> {
|
|
49
|
-
/** Per field a value (equal to it) or a `Condition`; every field must match. */
|
|
50
|
-
where?: {
|
|
51
|
-
[K in keyof D]?: Comparable<D[K]> | null | Condition<D[K]>;
|
|
52
|
-
};
|
|
53
|
-
/** Default: the bundle's item order. */
|
|
54
|
-
order?: QueryOrder<D>;
|
|
55
|
-
/** At least 1; without it, every matching entry. */
|
|
56
|
-
limit?: number;
|
|
57
|
-
/** 1-based. */
|
|
58
|
-
page?: number;
|
|
59
|
-
fields?: (keyof D & string)[];
|
|
60
|
-
facets?: (keyof D & string)[];
|
|
61
|
-
include?: (keyof D & string)[];
|
|
62
|
-
}
|
|
63
|
-
interface QueryResult {
|
|
64
|
-
items: BundleItem[];
|
|
65
|
-
total: number;
|
|
66
|
-
page: number;
|
|
67
|
-
pages: number;
|
|
68
|
-
facets?: Record<string, Record<string, number>>;
|
|
69
|
-
}
|
|
70
|
-
/** What `query` reads of the schema: the fields of each brick (a full `Schema` fits). */
|
|
71
|
-
interface QuerySchema {
|
|
72
|
-
bricks: Record<string, {
|
|
73
|
-
fields: Fields;
|
|
74
|
-
}>;
|
|
75
|
-
}
|
|
76
|
-
/** Filter, order, page, project and enrich the items of one collection brick. Pure; throws on a field the brick does not have. */
|
|
77
|
-
declare function query(bundle: Bundle, brick: string, q?: Query, schema?: QuerySchema): QueryResult;
|
|
78
|
-
/** The items before and after `id` in the given (or default) order. Both are missing for an unknown id. */
|
|
79
|
-
declare function neighbors(bundle: Bundle, brick: string, id: string, order?: QueryOrder): {
|
|
80
|
-
prev?: BundleItem;
|
|
81
|
-
next?: BundleItem;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
interface NavNode {
|
|
85
|
-
title: string;
|
|
86
|
-
path: string;
|
|
87
|
-
id?: string;
|
|
88
|
-
brick?: string;
|
|
89
|
-
children: NavNode[];
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Navigation tree of the collections `bricks` in `locale`, built from item URLs. An item is a child of the
|
|
93
|
-
* node at its nearest existing path prefix, else a root node. A string `parent` field (item id) overrides that.
|
|
94
|
-
* Siblings keep the item order of the bundle (bricks in the given order).
|
|
95
|
-
*/
|
|
96
|
-
declare function navTree(bundle: Bundle, bricks: string[], locale: Locale): NavNode[];
|
|
97
|
-
/** Nodes from the root down to the node at `path`; empty when the path is not in the tree. */
|
|
98
|
-
declare function breadcrumbs(tree: NavNode[], path: string): NavNode[];
|
|
99
|
-
|
|
100
|
-
interface SeoImage {
|
|
101
|
-
url: string;
|
|
102
|
-
width?: number;
|
|
103
|
-
height?: number;
|
|
104
|
-
alt?: string;
|
|
105
|
-
}
|
|
106
|
-
interface SeoInput {
|
|
107
|
-
siteName: string;
|
|
108
|
-
/** `%s` is replaced by the page title; default '%s · <siteName>'. A page without title gets siteName alone. */
|
|
109
|
-
titleTemplate?: string;
|
|
110
|
-
title?: string;
|
|
111
|
-
description?: string;
|
|
112
|
-
image?: SeoImage;
|
|
113
|
-
type?: 'website' | 'article';
|
|
114
|
-
noindex?: boolean;
|
|
115
|
-
}
|
|
116
|
-
interface SeoHead {
|
|
117
|
-
title: string;
|
|
118
|
-
meta: (({
|
|
119
|
-
name: string;
|
|
120
|
-
} | {
|
|
121
|
-
property: string;
|
|
122
|
-
}) & {
|
|
123
|
-
content: string;
|
|
124
|
-
})[];
|
|
125
|
-
}
|
|
126
|
-
declare function seoHead(input: SeoInput): SeoHead;
|
|
127
|
-
/** 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. */
|
|
128
|
-
declare function isPreviewHost(host: string | undefined, siteUrl: string): boolean;
|
|
129
|
-
declare function robotsTxt(options: {
|
|
130
|
-
sitemap?: string;
|
|
131
|
-
noindex?: boolean;
|
|
132
|
-
disallow?: string[];
|
|
133
|
-
}): string;
|
|
134
|
-
declare function websiteLd(o: {
|
|
135
|
-
name: string;
|
|
136
|
-
url: string;
|
|
137
|
-
lang: string;
|
|
138
|
-
}): Record<string, unknown>;
|
|
139
|
-
declare function organizationLd(o: {
|
|
140
|
-
name: string;
|
|
141
|
-
url: string;
|
|
142
|
-
logo?: string;
|
|
143
|
-
sameAs?: string[];
|
|
144
|
-
}): Record<string, unknown>;
|
|
145
|
-
declare function breadcrumbLd(nodes: NavNode[], origin: string): Record<string, unknown>;
|
|
146
|
-
declare function articleLd(o: {
|
|
147
|
-
title: string;
|
|
148
|
-
url: string;
|
|
149
|
-
description?: string;
|
|
150
|
-
image?: string;
|
|
151
|
-
published?: string;
|
|
152
|
-
modified?: string;
|
|
153
|
-
author?: string;
|
|
154
|
-
lang: string;
|
|
155
|
-
}): Record<string, unknown>;
|
|
156
|
-
declare function faqLd(pairs: {
|
|
157
|
-
question: string;
|
|
158
|
-
answer: string;
|
|
159
|
-
}[]): Record<string, unknown>;
|
|
160
|
-
/**
|
|
161
|
-
* Headers every response of a Ginko site carries. Only the platform may frame `/__ginko` (the preview); nothing
|
|
162
|
-
* else is framed. `nosniff` stops a browser from reading user text (`.md`, `llms.txt`, JSON) as HTML, and the
|
|
163
|
-
* referrer policy keeps full URLs from leaving the site.
|
|
164
|
-
*/
|
|
165
|
-
declare function siteHeaders(input: {
|
|
166
|
-
preview: boolean;
|
|
167
|
-
platformOrigin: string;
|
|
168
|
-
noindex: boolean;
|
|
169
|
-
}): Record<string, string>;
|
|
170
|
-
|
|
171
|
-
export { articleLd as f, breadcrumbLd as g, breadcrumbs as h, faqLd as i, formatMoney as j, isPreviewHost as k, isSafeHref as l, minorDigits as m, navTree as n, neighbors as o, organizationLd as p, query as q, robotsTxt as r, safeHref as s, seoHead as t, siteHeaders as u, websiteLd as w };
|
|
172
|
-
export type { Condition as C, NavNode as N, Query as Q, SeoHead as S, QueryOrder as a, QueryResult as b, QuerySchema as c, SeoImage as d, SeoInput as e };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
function defineSite(site) {
|
|
2
|
-
return site;
|
|
3
|
-
}
|
|
4
|
-
function single(input) {
|
|
5
|
-
return { kind: "single", ...input, tasks: input.tasks };
|
|
6
|
-
}
|
|
7
|
-
function collection(input) {
|
|
8
|
-
return { kind: "collection", ...input, tasks: input.tasks };
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function minorDigits(currency) {
|
|
12
|
-
return new Intl.NumberFormat("en", { style: "currency", currency }).resolvedOptions().maximumFractionDigits ?? 2;
|
|
13
|
-
}
|
|
14
|
-
function formatMoney(money, language) {
|
|
15
|
-
const digits = minorDigits(money.currency);
|
|
16
|
-
const text = new Intl.NumberFormat(language, { style: "currency", currency: money.currency }).format(money.amount / 10 ** digits);
|
|
17
|
-
return text.replace(/\s/g, "\xA0");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { collection as c, defineSite as d, formatMoney as f, minorDigits as m, single as s };
|