@quartz-community/search 0.1.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 +14 -0
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +549 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +549 -0
- package/dist/index.js.map +1 -0
- package/package.json +126 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Listen for `content-index-updated` `CustomEvent` dispatches and incrementally add the new entries to the FlexSearch index. This enables runtime extension of the search index by other plugins — in particular `@quartz-community/encrypted-pages`, which patches the in-memory content index with newly-decrypted unlisted pages and dispatches this event so the user can find and open those pages via search within the same browser session.
|
|
13
|
+
|
|
14
|
+
- Initial Quartz community plugin template.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Quartz Community
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @quartz-community/search
|
|
2
|
+
|
|
3
|
+
The Search component for Quartz - full-text search with FlexSearch integration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔍 **Full-Text Search** - Search across all your content instantly
|
|
8
|
+
- ⚡ **Fast Indexing** - Uses FlexSearch for high-performance search
|
|
9
|
+
- 📱 **Mobile Responsive** - Works great on all devices
|
|
10
|
+
- 🎯 **Search Preview** - Optional content preview panel
|
|
11
|
+
- 🌐 **Multi-Language** - Supports 30+ locales
|
|
12
|
+
- ⌨️ **Keyboard Shortcuts** - `Ctrl/Cmd + K` to open, `Escape` to close
|
|
13
|
+
- 🏷️ **Tag Search** - Search by tags with special syntax
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx quartz plugin add github:quartz-community/search
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```yaml title="quartz.config.yaml"
|
|
24
|
+
plugins:
|
|
25
|
+
- source: github:quartz-community/search
|
|
26
|
+
enabled: true
|
|
27
|
+
layout:
|
|
28
|
+
position: left
|
|
29
|
+
priority: 20
|
|
30
|
+
group: toolbar
|
|
31
|
+
groupOptions:
|
|
32
|
+
grow: true
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For advanced use cases, you can override in TypeScript:
|
|
36
|
+
|
|
37
|
+
```ts title="quartz.ts (override)"
|
|
38
|
+
import * as ExternalPlugin from "./.quartz/plugins";
|
|
39
|
+
|
|
40
|
+
ExternalPlugin.Search({
|
|
41
|
+
enablePreview: true,
|
|
42
|
+
placeholder: "Search for something",
|
|
43
|
+
title: "Search",
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration Options
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
interface SearchOptions {
|
|
51
|
+
/** Enable content preview panel */
|
|
52
|
+
enablePreview?: boolean;
|
|
53
|
+
/** Custom placeholder text */
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
/** Custom title for the search button */
|
|
56
|
+
title?: string;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Default Behavior
|
|
61
|
+
|
|
62
|
+
By default, the search component:
|
|
63
|
+
|
|
64
|
+
- Displays as a button with a search icon
|
|
65
|
+
- Opens a fullscreen search modal when clicked
|
|
66
|
+
- Shows up to 8 search results
|
|
67
|
+
- Enables content preview on desktop (can be disabled)
|
|
68
|
+
- Supports keyboard navigation (arrow keys, Enter, Escape)
|
|
69
|
+
- Uses FlexSearch from CDN for indexing
|
|
70
|
+
|
|
71
|
+
## How It Works
|
|
72
|
+
|
|
73
|
+
The Search component:
|
|
74
|
+
|
|
75
|
+
1. Loads FlexSearch library from CDN when initialized
|
|
76
|
+
2. Fetches content data via the `fetchData` global (resolves `contentIndex.json` with the correct base path)
|
|
77
|
+
3. Builds a search index from your content
|
|
78
|
+
4. Performs real-time search as you type
|
|
79
|
+
5. Shows results with optional content preview
|
|
80
|
+
|
|
81
|
+
> [!info]
|
|
82
|
+
> Search requires the `ContentIndex` emitter plugin to be present in your Quartz configuration.
|
|
83
|
+
|
|
84
|
+
## Keyboard Shortcuts
|
|
85
|
+
|
|
86
|
+
- `Ctrl/Cmd + K` - Open/Close search
|
|
87
|
+
- `Escape` - Close search
|
|
88
|
+
- `Arrow Up/Down` - Navigate results
|
|
89
|
+
- `Enter` - Open selected result
|
|
90
|
+
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
This is a first-party Quartz community plugin. It serves as both:
|
|
94
|
+
|
|
95
|
+
1. A production-ready Search component
|
|
96
|
+
2. A reference implementation for building Quartz community plugins
|
|
97
|
+
|
|
98
|
+
To build locally:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm install
|
|
102
|
+
npm run build
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The `prepare` script automatically builds during installation.
|
|
106
|
+
|
|
107
|
+
## Documentation
|
|
108
|
+
|
|
109
|
+
See the [Quartz documentation](https://quartz.jzhao.xyz/features/full-text%20search) for more information.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT
|