@pagefind/component-ui 1.5.0-alpha.3
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/README.md +66 -0
- package/components/base-element.ts +110 -0
- package/components/index.ts +31 -0
- package/components/instance-manager.ts +91 -0
- package/components/pagefind-config.ts +44 -0
- package/components/pagefind-filter-dropdown.ts +702 -0
- package/components/pagefind-filter-pane.ts +525 -0
- package/components/pagefind-input.ts +224 -0
- package/components/pagefind-keyboard-hints.ts +62 -0
- package/components/pagefind-modal-body.ts +19 -0
- package/components/pagefind-modal-footer.ts +16 -0
- package/components/pagefind-modal-header.ts +59 -0
- package/components/pagefind-modal-trigger.ts +195 -0
- package/components/pagefind-modal.ts +209 -0
- package/components/pagefind-results.ts +586 -0
- package/components/pagefind-searchbox.ts +888 -0
- package/components/pagefind-summary.ts +138 -0
- package/core/announcer.ts +134 -0
- package/core/focus-utils.ts +89 -0
- package/core/instance.ts +714 -0
- package/core/translations.ts +79 -0
- package/css/pagefind-component-ui.css +1448 -0
- package/npm_dist/cjs/component-ui.cjs +6285 -0
- package/npm_dist/cjs/instance.cjs +2849 -0
- package/npm_dist/mjs/component-ui.mjs +6268 -0
- package/npm_dist/mjs/instance.mjs +2826 -0
- package/package.json +48 -0
- package/types-entry.ts +27 -0
- package/types.ts +126 -0
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pagefind/component-ui",
|
|
3
|
+
"version": "1.5.0-alpha.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": [
|
|
6
|
+
"*.css",
|
|
7
|
+
"./component-ui.ts",
|
|
8
|
+
"./components/*.ts",
|
|
9
|
+
"./npm_dist/**/*.mjs",
|
|
10
|
+
"./npm_dist/**/*.cjs"
|
|
11
|
+
],
|
|
12
|
+
"main": "npm_dist/cjs/component-ui.cjs",
|
|
13
|
+
"module": "npm_dist/mjs/component-ui.mjs",
|
|
14
|
+
"types": "types-entry.ts",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"start": "PAGEFIND_DEV=true node ./build.js",
|
|
17
|
+
"build": "node ./build.js",
|
|
18
|
+
"typecheck": "tsc --noEmit"
|
|
19
|
+
},
|
|
20
|
+
"author": "Pagefind",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"adequate-little-templates": "^1.0.2",
|
|
24
|
+
"bcp-47": "^2.1.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"esbuild": "^0.25.0",
|
|
28
|
+
"esbuild-plugin-import-glob": "^0.1.1",
|
|
29
|
+
"typescript": "^5.0.0"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"npm_dist/**",
|
|
33
|
+
"css/pagefind-component-ui.css",
|
|
34
|
+
"types.ts",
|
|
35
|
+
"types-entry.ts",
|
|
36
|
+
"core/**/*.ts",
|
|
37
|
+
"components/**/*.ts"
|
|
38
|
+
],
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./types-entry.ts",
|
|
42
|
+
"import": "./npm_dist/mjs/component-ui.mjs",
|
|
43
|
+
"require": "./npm_dist/cjs/component-ui.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./css": "./css/pagefind-component-ui.css",
|
|
46
|
+
"./css/pagefind-component-ui.css": "./css/pagefind-component-ui.css"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/types-entry.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Type-only entry point for TypeScript consumers
|
|
2
|
+
// (avoids triggering side effects from component registration)
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
getInstanceManager,
|
|
6
|
+
configureInstance,
|
|
7
|
+
} from "./components/instance-manager";
|
|
8
|
+
|
|
9
|
+
// Component class types (using `export type` avoids executing the module)
|
|
10
|
+
export type { PagefindElement } from "./components/base-element";
|
|
11
|
+
export type { PagefindConfig } from "./components/pagefind-config";
|
|
12
|
+
export type { PagefindInput } from "./components/pagefind-input";
|
|
13
|
+
export type { PagefindSummary } from "./components/pagefind-summary";
|
|
14
|
+
export type { PagefindResults } from "./components/pagefind-results";
|
|
15
|
+
export type { PagefindFilterPane } from "./components/pagefind-filter-pane";
|
|
16
|
+
export type { PagefindFilterDropdown } from "./components/pagefind-filter-dropdown";
|
|
17
|
+
export type { PagefindModal } from "./components/pagefind-modal";
|
|
18
|
+
export type { PagefindModalTrigger } from "./components/pagefind-modal-trigger";
|
|
19
|
+
export type { PagefindModalHeader } from "./components/pagefind-modal-header";
|
|
20
|
+
export type { PagefindModalBody } from "./components/pagefind-modal-body";
|
|
21
|
+
export type { PagefindModalFooter } from "./components/pagefind-modal-footer";
|
|
22
|
+
export type { PagefindKeyboardHints } from "./components/pagefind-keyboard-hints";
|
|
23
|
+
export type { PagefindSearchbox } from "./components/pagefind-searchbox";
|
|
24
|
+
|
|
25
|
+
export type { Instance } from "./core/instance";
|
|
26
|
+
|
|
27
|
+
export type * from "./types";
|
package/types.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export type AnnouncerPriority = "polite" | "assertive";
|
|
2
|
+
|
|
3
|
+
// Pagefind search results (from WASM)
|
|
4
|
+
export interface PagefindSearchResult {
|
|
5
|
+
results: PagefindRawResult[];
|
|
6
|
+
filters?: FilterCounts;
|
|
7
|
+
totalFilters?: FilterCounts;
|
|
8
|
+
unfilteredTotalCount?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PagefindRawResult {
|
|
12
|
+
id: string;
|
|
13
|
+
data: () => Promise<PagefindResultData>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface PagefindResultData {
|
|
17
|
+
url: string;
|
|
18
|
+
excerpt: string;
|
|
19
|
+
meta: Record<string, string>;
|
|
20
|
+
sub_results?: PagefindSubResult[];
|
|
21
|
+
locations?: number[];
|
|
22
|
+
weighted_locations?: WeightedLocation[];
|
|
23
|
+
filters?: Record<string, string[]>;
|
|
24
|
+
anchors?: PagefindAnchor[];
|
|
25
|
+
content?: string;
|
|
26
|
+
word_count?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface PagefindSubResult {
|
|
30
|
+
url: string;
|
|
31
|
+
title: string;
|
|
32
|
+
excerpt: string;
|
|
33
|
+
locations?: number[];
|
|
34
|
+
weighted_locations?: WeightedLocation[];
|
|
35
|
+
anchors?: PagefindAnchor[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface WeightedLocation {
|
|
39
|
+
weight: number;
|
|
40
|
+
balanced_score: number;
|
|
41
|
+
location: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface PagefindAnchor {
|
|
45
|
+
element: string;
|
|
46
|
+
id: string;
|
|
47
|
+
text?: string;
|
|
48
|
+
location?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type FilterCounts = Record<string, Record<string, number>>;
|
|
52
|
+
export type FilterSelection = Record<string, string[]>;
|
|
53
|
+
|
|
54
|
+
export interface InstanceOptions {
|
|
55
|
+
bundlePath?: string;
|
|
56
|
+
mergeIndex?: MergeIndexConfig[];
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface MergeIndexConfig {
|
|
61
|
+
bundlePath: string;
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type InstanceEventMap = {
|
|
66
|
+
search: [term: string, filters: FilterSelection];
|
|
67
|
+
filters: [data: { available: FilterCounts; total: FilterCounts }];
|
|
68
|
+
loading: [];
|
|
69
|
+
results: [results: PagefindSearchResult];
|
|
70
|
+
error: [error: PagefindError];
|
|
71
|
+
translations: [translations: TranslationStrings, direction: TextDirection];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type InstanceEvent = keyof InstanceEventMap;
|
|
75
|
+
|
|
76
|
+
export interface PagefindError {
|
|
77
|
+
type?: string;
|
|
78
|
+
message: string;
|
|
79
|
+
bundlePath?: string;
|
|
80
|
+
error?: Error;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type TextDirection = "ltr" | "rtl";
|
|
84
|
+
|
|
85
|
+
export interface TranslationStrings {
|
|
86
|
+
language: string;
|
|
87
|
+
direction: TextDirection;
|
|
88
|
+
[key: string]: string | TextDirection;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface TranslationFile {
|
|
92
|
+
thanks_to?: string;
|
|
93
|
+
comments?: string;
|
|
94
|
+
direction?: TextDirection;
|
|
95
|
+
strings: Record<string, string>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface ComponentCapabilities {
|
|
99
|
+
keyboardNavigation?: boolean;
|
|
100
|
+
announcements?: boolean;
|
|
101
|
+
[key: string]: unknown;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface Shortcut {
|
|
105
|
+
label: string;
|
|
106
|
+
description: string;
|
|
107
|
+
owner?: Element;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type HookCallback = (...args: unknown[]) => void;
|
|
111
|
+
|
|
112
|
+
export interface HookEntry {
|
|
113
|
+
callback: HookCallback;
|
|
114
|
+
owner?: Element;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface PagefindAPI {
|
|
118
|
+
options: (opts: Record<string, unknown>) => Promise<void>;
|
|
119
|
+
search: (
|
|
120
|
+
term: string | null,
|
|
121
|
+
options?: { filters?: FilterSelection },
|
|
122
|
+
) => Promise<PagefindSearchResult>;
|
|
123
|
+
filters: () => Promise<FilterCounts>;
|
|
124
|
+
mergeIndex: (url: string, options?: Record<string, unknown>) => Promise<void>;
|
|
125
|
+
destroy?: () => void;
|
|
126
|
+
}
|