@unhead/schema 0.2.5 → 0.2.7
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/dist/index.d.ts +24 -24
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -220,13 +220,20 @@ interface EntryResolveCtx<T> {
|
|
|
220
220
|
entries: HeadEntry<T>[];
|
|
221
221
|
}
|
|
222
222
|
interface DomRenderTagContext {
|
|
223
|
-
|
|
223
|
+
shouldRender: boolean;
|
|
224
224
|
tag: HeadTag;
|
|
225
|
-
|
|
225
|
+
}
|
|
226
|
+
interface BeforeRenderContext {
|
|
227
|
+
shouldRender: boolean;
|
|
228
|
+
tags: HeadTag[];
|
|
229
|
+
}
|
|
230
|
+
interface SSRRenderContext {
|
|
231
|
+
tags: HeadTag[];
|
|
232
|
+
html: SSRHeadPayload;
|
|
226
233
|
}
|
|
227
234
|
interface HeadHooks {
|
|
228
|
-
'init': (ctx:
|
|
229
|
-
'entries:updated': (ctx:
|
|
235
|
+
'init': (ctx: Unhead<any>) => HookResult;
|
|
236
|
+
'entries:updated': (ctx: Unhead<any>) => HookResult;
|
|
230
237
|
'entries:resolve': (ctx: EntryResolveCtx<any>) => HookResult;
|
|
231
238
|
'tag:normalise': (ctx: {
|
|
232
239
|
tag: HeadTag;
|
|
@@ -235,19 +242,10 @@ interface HeadHooks {
|
|
|
235
242
|
'tags:resolve': (ctx: {
|
|
236
243
|
tags: HeadTag[];
|
|
237
244
|
}) => HookResult;
|
|
238
|
-
'dom:beforeRender': (ctx:
|
|
239
|
-
head: HeadClient;
|
|
240
|
-
tags: HeadTag[];
|
|
241
|
-
document: Document;
|
|
242
|
-
}) => HookResult;
|
|
245
|
+
'dom:beforeRender': (ctx: BeforeRenderContext) => HookResult;
|
|
243
246
|
'dom:renderTag': (ctx: DomRenderTagContext) => HookResult;
|
|
244
|
-
'ssr:beforeRender': (ctx:
|
|
245
|
-
|
|
246
|
-
}) => HookResult;
|
|
247
|
-
'ssr:render': (ctx: {
|
|
248
|
-
tags: HeadTag[];
|
|
249
|
-
html: SSRHeadPayload;
|
|
250
|
-
}) => HookResult;
|
|
247
|
+
'ssr:beforeRender': (ctx: BeforeRenderContext) => HookResult;
|
|
248
|
+
'ssr:render': (ctx: SSRRenderContext) => HookResult;
|
|
251
249
|
}
|
|
252
250
|
|
|
253
251
|
/**
|
|
@@ -257,11 +255,11 @@ interface HeadHooks {
|
|
|
257
255
|
*/
|
|
258
256
|
declare type SideEffectsRecord = Record<string, () => void>;
|
|
259
257
|
declare type RuntimeMode = 'server' | 'client' | 'all';
|
|
260
|
-
interface HeadEntry<
|
|
258
|
+
interface HeadEntry<Input> {
|
|
261
259
|
/**
|
|
262
260
|
* User provided input for the entry.
|
|
263
261
|
*/
|
|
264
|
-
input:
|
|
262
|
+
input: Input;
|
|
265
263
|
/**
|
|
266
264
|
* The mode that the entry should be used in.
|
|
267
265
|
*
|
|
@@ -285,13 +283,13 @@ declare type HeadPlugin = Omit<CreateHeadOptions, 'plugins'>;
|
|
|
285
283
|
/**
|
|
286
284
|
* An active head entry provides an API to manipulate it.
|
|
287
285
|
*/
|
|
288
|
-
interface ActiveHeadEntry<
|
|
286
|
+
interface ActiveHeadEntry<Input> {
|
|
289
287
|
/**
|
|
290
288
|
* Updates the entry with new input.
|
|
291
289
|
*
|
|
292
290
|
* Will first clear any side effects for previous input.
|
|
293
291
|
*/
|
|
294
|
-
patch: (
|
|
292
|
+
patch: (input: Input) => void;
|
|
295
293
|
/**
|
|
296
294
|
* Dispose the entry, removing it from the active head.
|
|
297
295
|
*
|
|
@@ -300,21 +298,23 @@ interface ActiveHeadEntry<T> {
|
|
|
300
298
|
dispose: () => void;
|
|
301
299
|
}
|
|
302
300
|
interface CreateHeadOptions {
|
|
301
|
+
domDelayFn?: (fn: () => void) => void;
|
|
302
|
+
document?: Document;
|
|
303
303
|
plugins?: HeadPlugin[];
|
|
304
304
|
hooks?: NestedHooks<HeadHooks>;
|
|
305
305
|
}
|
|
306
306
|
interface HeadEntryOptions {
|
|
307
307
|
mode?: RuntimeMode;
|
|
308
308
|
}
|
|
309
|
-
interface
|
|
309
|
+
interface Unhead<Input extends {} = Head> {
|
|
310
310
|
/**
|
|
311
311
|
* The active head entries.
|
|
312
312
|
*/
|
|
313
|
-
headEntries: () => HeadEntry<
|
|
313
|
+
headEntries: () => HeadEntry<Input>[];
|
|
314
314
|
/**
|
|
315
315
|
* Create a new head entry.
|
|
316
316
|
*/
|
|
317
|
-
push: (entry:
|
|
317
|
+
push: (entry: Input, options?: HeadEntryOptions) => ActiveHeadEntry<Input>;
|
|
318
318
|
/**
|
|
319
319
|
* Resolve tags from head entries.
|
|
320
320
|
*/
|
|
@@ -333,4 +333,4 @@ interface HeadClient<T extends {} = Head> {
|
|
|
333
333
|
_flushQueuedSideEffects: () => void;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, Head,
|
|
336
|
+
export { ActiveHeadEntry, Base, BaseBodyAttr, BaseHtmlAttr, BeforeRenderContext, BodyAttributes, CreateHeadOptions, DomRenderTagContext, EntryAugmentation, EntryResolveCtx, Head, HeadEntry, HeadEntryOptions, HeadHooks, HeadPlugin, HeadTag, HeadTagKeys, HookResult, HtmlAttributes, InnerContent, Link, MaybeArray, Meta, Never, Noscript, ResolvesDuplicates, RuntimeMode, SSRHeadPayload, SSRRenderContext, SchemaAugmentations, Script, SideEffectsRecord, Style, TagInternalProperties, TagPosition, TagPriority, TagUserProperties, Title, TitleTemplate, Unhead, UserAttributesConfig, UserTagConfigWithoutInnerContent };
|