Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 292 additions & 0 deletions api-extractor/next-utils.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,148 @@
],
"name": "getNextJsHeaders"
},
{
"kind": "TypeAlias",
"canonicalReference": "@asl-19/next-utils!IndexPageGetPreviewsAndHasNextPage:type",
"docComment": "/**\n * Index page getPreviewsAndHasNextPage function.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type IndexPageGetPreviewsAndHasNextPage<PageNormalizedQuery, Preview> = "
},
{
"kind": "Content",
"text": "(queryInfo: "
},
{
"kind": "Reference",
"text": "IndexPageQueryInfo",
"canonicalReference": "@asl-19/next-utils!IndexPageQueryInfo:type"
},
{
"kind": "Content",
"text": "<PageNormalizedQuery>) => "
},
{
"kind": "Reference",
"text": "Promise",
"canonicalReference": "!Promise:interface"
},
{
"kind": "Content",
"text": "<{\n hasNextPage: boolean;\n previews: "
},
{
"kind": "Reference",
"text": "Array",
"canonicalReference": "!Array:interface"
},
{
"kind": "Content",
"text": "<Preview>;\n}>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "dist/useIndexPageLoadingAndQueryLogic.d.ts",
"releaseTag": "Public",
"name": "IndexPageGetPreviewsAndHasNextPage",
"typeParameters": [
{
"typeParameterName": "PageNormalizedQuery",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "Preview",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 8
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@asl-19/next-utils!IndexPageLoadingState:type",
"docComment": "/**\n * Index page loading state. One of these possible types:\n *\n * - `error`: Encountered an error/timeout while loading new items - `loadingNew`: Loading a new set of items (because filter/ordering changed) - `loadingMore`: Loading more of the current set of items - `hasMore`: Has more items to load (should show \"Load more\" link) - `hasNoMore`: Has no more items to load (should NOT show load more link) - `hasNone`: Has no items (should show \"No items\" message)\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type IndexPageLoadingState = "
},
{
"kind": "Content",
"text": "{\n type: \"error\";\n} | {\n type: \"hasMore\";\n} | {\n type: \"hasNoMore\";\n} | {\n type: \"hasNone\";\n} | {\n type: \"loadingMore\";\n} | {\n type: \"loadingNew\";\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "dist/useIndexPageLoadingAndQueryLogic.d.ts",
"releaseTag": "Public",
"name": "IndexPageLoadingState",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@asl-19/next-utils!IndexPageQueryInfo:type",
"docComment": "/**\n * Index page query info.\n *\n * This is used to update indexPageLoadingState, and is passed to getPreviewsAndHasNextPage.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type IndexPageQueryInfo<PageNormalizedQuery> = "
},
{
"kind": "Content",
"text": "{\n isLoadMoreQuery: boolean;\n localeCode: string;\n normalizedQuery: PageNormalizedQuery;\n normalizedQueryHasChanged?: boolean;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "dist/useIndexPageLoadingAndQueryLogic.d.ts",
"releaseTag": "Public",
"name": "IndexPageQueryInfo",
"typeParameters": [
{
"typeParameterName": "PageNormalizedQuery",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "Function",
"canonicalReference": "@asl-19/next-utils!replaceCurrentRouteWithShallowRoute:function(1)",
Expand Down Expand Up @@ -274,6 +416,30 @@
],
"name": "replaceCurrentRouteWithShallowRoute"
},
{
"kind": "Function",
"canonicalReference": "@asl-19/next-utils!useFocusH1OnRouteChangeComplete:function(1)",
"docComment": "/**\n * Focus h1#main-heading on Next.js routeChangeComplete event.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "useFocusH1OnRouteChangeComplete: () => "
},
{
"kind": "Content",
"text": "void"
}
],
"fileUrlPath": "dist/useFocusH1OnRouteChangeComplete.d.ts",
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [],
"name": "useFocusH1OnRouteChangeComplete"
},
{
"kind": "Function",
"canonicalReference": "@asl-19/next-utils!useHrefIsActive:function(1)",
Expand Down Expand Up @@ -323,6 +489,132 @@
}
],
"name": "useHrefIsActive"
},
{
"kind": "Function",
"canonicalReference": "@asl-19/next-utils!useIndexPageLoadingAndQueryLogic:function(1)",
"docComment": "/**\n * Fetch and display new items when query changes.\n *\n * Takes two type parameters:\n *\n * 1. The page’s NormalizedQuery type. 2. The page’s preview item type (i.e. the type set by `setPreviews`, and the type fetched by `fetchNewItems`)\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "useIndexPageLoadingAndQueryLogic: <PageNormalizedQuery extends "
},
{
"kind": "Content",
"text": "{\n count: number;\n}"
},
{
"kind": "Content",
"text": ", Preview extends "
},
{
"kind": "Content",
"text": "{\n id: string;\n}"
},
{
"kind": "Content",
"text": ">({ announceLoadingNewItemsComplete, announceLoadingNewItemsStarted, getPageNormalizedQuery, getPreviewElementId, getPreviewsAndHasNextPage, initialHasNextPage, initialPreviews, localeCode, queryKeyPrefix, }: "
},
{
"kind": "Content",
"text": "{\n announceLoadingNewItemsComplete: ({ count }: {\n count: number;\n }) => void;\n announceLoadingNewItemsStarted: () => void;\n getPageNormalizedQuery: (query: "
},
{
"kind": "Reference",
"text": "ParsedUrlQuery",
"canonicalReference": "!\"\\\"querystring\\\"\".ParsedUrlQuery:interface"
},
{
"kind": "Content",
"text": ") => PageNormalizedQuery;\n getPreviewElementId: (preview: Preview) => string;\n getPreviewsAndHasNextPage: "
},
{
"kind": "Reference",
"text": "IndexPageGetPreviewsAndHasNextPage",
"canonicalReference": "@asl-19/next-utils!IndexPageGetPreviewsAndHasNextPage:type"
},
{
"kind": "Content",
"text": "<PageNormalizedQuery, Preview>;\n initialHasNextPage: boolean;\n initialPreviews: "
},
{
"kind": "Reference",
"text": "Array",
"canonicalReference": "!Array:interface"
},
{
"kind": "Content",
"text": "<Preview>;\n localeCode: string;\n queryKeyPrefix: string;\n}"
},
{
"kind": "Content",
"text": ") => "
},
{
"kind": "Content",
"text": "{\n indexPageLoadingState: "
},
{
"kind": "Reference",
"text": "IndexPageLoadingState",
"canonicalReference": "@asl-19/next-utils!IndexPageLoadingState:type"
},
{
"kind": "Content",
"text": ";\n previews: Preview[];\n queryInfo: "
},
{
"kind": "Reference",
"text": "IndexPageQueryInfo",
"canonicalReference": "@asl-19/next-utils!IndexPageQueryInfo:type"
},
{
"kind": "Content",
"text": "<PageNormalizedQuery>;\n}"
}
],
"fileUrlPath": "dist/useIndexPageLoadingAndQueryLogic.d.ts",
"returnTypeTokenRange": {
"startIndex": 13,
"endIndex": 18
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "{ announceLoadingNewItemsComplete, announceLoadingNewItemsStarted, getPageNormalizedQuery, getPreviewElementId, getPreviewsAndHasNextPage, initialHasNextPage, initialPreviews, localeCode, queryKeyPrefix, }",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 12
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "PageNormalizedQuery",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "Preview",
"constraintTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "useIndexPageLoadingAndQueryLogic"
}
]
}
Expand Down
56 changes: 56 additions & 0 deletions api-extractor/next-utils.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,78 @@
```ts

import { NextRouter } from 'next/router.js';
import { ParsedUrlQuery } from 'querystring';

// Warning: (ae-forgotten-export) The symbol "NextJsHeadersArray" needs to be exported by the entry point index.d.ts
//
// @public
export const getNextJsHeaders: (headers: Record<string, string>) => NextJsHeadersArray;

// @public
export type IndexPageGetPreviewsAndHasNextPage<PageNormalizedQuery, Preview> = (queryInfo: IndexPageQueryInfo<PageNormalizedQuery>) => Promise<{
hasNextPage: boolean;
previews: Array<Preview>;
}>;

// @public
export type IndexPageLoadingState = {
type: "error";
} | {
type: "hasMore";
} | {
type: "hasNoMore";
} | {
type: "hasNone";
} | {
type: "loadingMore";
} | {
type: "loadingNew";
};

// @public
export type IndexPageQueryInfo<PageNormalizedQuery> = {
isLoadMoreQuery: boolean;
localeCode: string;
normalizedQuery: PageNormalizedQuery;
normalizedQueryHasChanged?: boolean;
};

// @public
export const replaceCurrentRouteWithShallowRoute: ({ router, }: {
router: NextRouter;
}) => Promise<boolean>;

// @public
export const useFocusH1OnRouteChangeComplete: () => void;

// @public
export const useHrefIsActive: ({ activeUrlComparisonQueryKeys, href, webPublicUrl, }: {
activeUrlComparisonQueryKeys: Array<string>;
href: string;
webPublicUrl: string;
}) => boolean;

// @public
export const useIndexPageLoadingAndQueryLogic: <PageNormalizedQuery extends {
count: number;
}, Preview extends {
id: string;
}>({ announceLoadingNewItemsComplete, announceLoadingNewItemsStarted, getPageNormalizedQuery, getPreviewElementId, getPreviewsAndHasNextPage, initialHasNextPage, initialPreviews, localeCode, queryKeyPrefix, }: {
announceLoadingNewItemsComplete: ({ count }: {
count: number;
}) => void;
announceLoadingNewItemsStarted: () => void;
getPageNormalizedQuery: (query: ParsedUrlQuery) => PageNormalizedQuery;
getPreviewElementId: (preview: Preview) => string;
getPreviewsAndHasNextPage: IndexPageGetPreviewsAndHasNextPage<PageNormalizedQuery, Preview>;
initialHasNextPage: boolean;
initialPreviews: Array<Preview>;
localeCode: string;
queryKeyPrefix: string;
}) => {
indexPageLoadingState: IndexPageLoadingState;
previews: Preview[];
queryInfo: IndexPageQueryInfo<PageNormalizedQuery>;
};

```
Loading