@stratal/inertia 0.0.23 → 0.0.25

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.
@@ -1,148 +0,0 @@
1
- import { RouterContext } from "stratal/router";
2
- import { MessageKeys } from "stratal/i18n";
3
- import { InertiaAppSSRResponse, Page, Page as InertiaPage, SharedPageProps } from "@inertiajs/core";
4
- import { ContentfulStatusCode } from "hono/utils/http-status";
5
-
6
- //#region src/seo/types.d.ts
7
- /**
8
- * Public SEO data model for `@stratal/inertia`.
9
- *
10
- * These types are framework-free (no DI, worker, or React imports) so the same
11
- * definitions can be shared by the server-side {@link import('../services/seo.service').SeoService}
12
- * and the client-side head-sync runtime.
13
- */
14
- /** Open Graph metadata. Maps to `<meta property="og:*">` tags. */
15
- interface SeoOpenGraph {
16
- title?: string;
17
- description?: string;
18
- image?: string;
19
- type?: string;
20
- url?: string;
21
- siteName?: string;
22
- }
23
- /** Twitter card metadata. Maps to `<meta name="twitter:*">` tags. */
24
- interface SeoTwitter {
25
- card?: 'summary' | 'summary_large_image' | 'app' | 'player';
26
- title?: string;
27
- description?: string;
28
- image?: string;
29
- site?: string;
30
- creator?: string;
31
- }
32
- /** A custom `<meta>` tag. Provide either `name` or `property` plus `content`. */
33
- interface SeoMetaTag {
34
- name?: string;
35
- property?: string;
36
- content: string;
37
- }
38
- /** A custom `<link>` tag. `rel` and `href` are required; extra attributes are passed through. */
39
- type SeoLinkTag = {
40
- rel: string;
41
- href: string;
42
- } & Record<string, string>;
43
- /**
44
- * SEO metadata for a page. Set per-request via `ctx.seo()` and/or as app-wide
45
- * defaults through {@link import('../inertia.options').InertiaSeoOptions}.
46
- */
47
- interface SeoData {
48
- /** Document title (`<title>`). Subject to the configured `titleTemplate`. */
49
- title?: string;
50
- /** Meta description (`<meta name="description">`). */
51
- description?: string;
52
- /** Canonical URL (`<link rel="canonical">`). */
53
- canonical?: string;
54
- /** Robots directive (`<meta name="robots">`), e.g. `"noindex, nofollow"`. */
55
- robots?: string;
56
- /** Keywords (`<meta name="keywords">`). Arrays are joined with `", "`. */
57
- keywords?: string | string[];
58
- /** Author (`<meta name="author">`). */
59
- author?: string;
60
- /** Open Graph metadata. */
61
- openGraph?: SeoOpenGraph;
62
- /** Twitter card metadata. */
63
- twitter?: SeoTwitter;
64
- /** Arbitrary additional `<meta>` tags. */
65
- meta?: SeoMetaTag[];
66
- /** Arbitrary additional `<link>` tags. */
67
- link?: SeoLinkTag[];
68
- }
69
- /**
70
- * A renderable description of a single head tag, produced by
71
- * {@link import('./build-seo-tags').buildSeoTags}. The server turns these into
72
- * HTML strings; the client turns them into DOM nodes — one source of truth.
73
- */
74
- interface SeoTagDescriptor {
75
- tag: 'title' | 'meta' | 'link';
76
- attrs: Record<string, string>;
77
- content?: string;
78
- }
79
- //#endregion
80
- //#region src/types.d.ts
81
- interface InertiaPageRegistry {}
82
- interface InertiaI18nConfig {}
83
- type InertiaTranslationKeys = InertiaI18nConfig extends {
84
- translationKeys: infer T extends string;
85
- } ? T : MessageKeys;
86
- type InertiaSharedProps = SharedPageProps;
87
- type InertiaPageComponent = keyof InertiaPageRegistry extends never ? string : Extract<keyof InertiaPageRegistry, string>;
88
- type AllowInertiaWrappers<T> = { [K in keyof T]: T[K] | InertiaDeferredProp | InertiaMergeProp | InertiaOptionalProp | InertiaOnceProp | InertiaAlwaysProp };
89
- type ResolvedInertiaPageProps<C extends InertiaPageComponent> = C extends keyof InertiaPageRegistry ? AllowInertiaWrappers<InertiaPageRegistry[C]> : Record<string, unknown>;
90
- type InertiaFullPageProps<C extends InertiaPageComponent> = (C extends keyof InertiaPageRegistry ? InertiaPageRegistry[C] : Record<string, unknown>) & InertiaSharedProps;
91
- interface InertiaRenderOptions {
92
- encryptHistory?: boolean;
93
- clearHistory?: boolean;
94
- preserveFragment?: boolean;
95
- /**
96
- * HTTP status code to use for the rendered response. Defaults to `200`.
97
- * Useful for rendering Inertia error pages (e.g. `Errors/404` with status 404).
98
- */
99
- status?: ContentfulStatusCode;
100
- }
101
- type InertiaSsrResult = InertiaAppSSRResponse;
102
- interface InertiaSsrBundle {
103
- render(page: Page): Promise<InertiaSsrResult>;
104
- }
105
- type SharedDataResolver = (ctx: RouterContext) => any;
106
- interface ViteManifestEntry {
107
- file: string;
108
- css?: string[];
109
- isEntry?: boolean;
110
- imports?: string[];
111
- dynamicImports?: string[];
112
- src?: string;
113
- }
114
- type ViteManifest = Record<string, ViteManifestEntry>;
115
- declare const INERTIA_PROP_OPTIONAL: unique symbol;
116
- declare const INERTIA_PROP_DEFERRED: unique symbol;
117
- declare const INERTIA_PROP_MERGE: unique symbol;
118
- declare const INERTIA_PROP_ONCE: unique symbol;
119
- declare const INERTIA_PROP_ALWAYS: unique symbol;
120
- interface InertiaOptionalProp<T = unknown> {
121
- [INERTIA_PROP_OPTIONAL]: true;
122
- callback: () => T;
123
- }
124
- interface InertiaDeferredProp<T = unknown> {
125
- [INERTIA_PROP_DEFERRED]: true;
126
- callback: () => T;
127
- group: string;
128
- }
129
- type InertiaMergeStrategy = 'append' | 'prepend' | 'deep';
130
- interface InertiaMergeProp<T = unknown> {
131
- [INERTIA_PROP_MERGE]: true;
132
- callback: () => T;
133
- strategy: InertiaMergeStrategy;
134
- matchOn?: string;
135
- }
136
- interface InertiaOnceProp<T = unknown> {
137
- [INERTIA_PROP_ONCE]: true;
138
- callback: () => T;
139
- expiresAt?: number | null;
140
- key?: string;
141
- }
142
- interface InertiaAlwaysProp<T = unknown> {
143
- [INERTIA_PROP_ALWAYS]: true;
144
- callback: () => T;
145
- }
146
- //#endregion
147
- export { SeoMetaTag as C, SeoTwitter as E, SeoLinkTag as S, SeoTagDescriptor as T, ResolvedInertiaPageProps as _, InertiaMergeProp as a, ViteManifestEntry as b, InertiaOptionalProp as c, InertiaPageRegistry as d, InertiaRenderOptions as f, InertiaTranslationKeys as g, InertiaSsrResult as h, InertiaI18nConfig as i, InertiaPage as l, InertiaSsrBundle as m, InertiaDeferredProp as n, InertiaMergeStrategy as o, InertiaSharedProps as p, InertiaFullPageProps as r, InertiaOnceProp as s, InertiaAlwaysProp as t, InertiaPageComponent as u, SharedDataResolver as v, SeoOpenGraph as w, SeoData as x, ViteManifest as y };
148
- //# sourceMappingURL=types--_iJ04lT.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types--_iJ04lT.d.mts","names":[],"sources":["../src/seo/types.ts","../src/types.ts"],"mappings":";;;;;;;;;;;;AASA;;UAAiB,YAAA;EACf,KAAA;EACA,WAAA;EACA,KAAA;EACA,IAAA;EACA,GAAA;EACA,QAAA;AAAA;;UAIe,UAAA;EACf,IAAA;EACA,KAAA;EACA,WAAA;EACA,KAAA;EACA,IAAA;EACA,OAAA;AAAA;;UAIe,UAAA;EACf,IAAA;EACA,QAAA;EACA,OAAA;AAAA;;KAIU,UAAA;EAAe,GAAA;EAAa,IAAA;AAAA,IAAiB,MAAM;;;AAJtD;AAIT;UAMiB,OAAA;;EAEf,KAAA;EARyB;EAUzB,WAAA;EAVuD;EAYvD,SAAA;EAZ6D;EAc7D,MAAA;EARsB;EAUtB,QAAA;EAIY;EAFZ,MAAA;EAMO;EAJP,SAAA,GAAY,YAAA;EAMK;EAJjB,OAAA,GAAU,UAAA;EAdV;EAgBA,IAAA,GAAO,UAAA;EAZP;EAcA,IAAA,GAAO,UAAA;AAAA;;;;;;UAQQ,gBAAA;EACf,GAAA;EACA,KAAA,EAAO,MAAM;EACb,OAAA;AAAA;;;UCnEe,mBAAA;AAAA,UAEA,iBAAA;AAAA,KAEL,sBAAA,GACV,iBAAA;EAA4B,eAAA;AAAA,IAA4C,CAAA,GAAI,WAAW;AAAA,KAI7E,kBAAA,GAAqB,eAAe;AAAA,KAEpC,oBAAA,SAA6B,mBAAA,0BAErC,OAAA,OAAc,mBAAA;AAAA,KAGb,oBAAA,oBACS,CAAA,GAAI,CAAA,CAAE,CAAA,IAAK,mBAAA,GAAsB,gBAAA,GAAmB,mBAAA,GAAsB,eAAA,GAAkB,iBAAA;AA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