@docubook/create 1.14.2 → 1.15.1
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/package.json +3 -2
- package/src/dist/app/page.tsx +1 -1
- package/src/dist/components/DocSearch.tsx +32 -0
- package/src/dist/components/search.tsx +24 -20
- package/src/dist/contents/docs/changelog/version-1/index.mdx +29 -0
- package/src/dist/package.json +5 -1
- package/src/dist/styles/algolia.css +162 -0
- package/src/dist/styles/globals.css +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docubook/create",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "CLI to create DocuBook projects",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,5 +26,6 @@
|
|
|
26
26
|
"figlet": "^1.8.0",
|
|
27
27
|
"ora": "^8.1.0",
|
|
28
28
|
"prompts": "^2.4.2"
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
|
+
"packageManager": "yarn@4.9.2+sha512.1fc009bc09d13cfd0e19efa44cbfc2b9cf6ca61482725eb35bbc5e257e093ebf4130db6dfe15d604ff4b79efd8e1e8e99b25fa7d0a6197c9f9826358d4d65c3c"
|
|
30
31
|
}
|
package/src/dist/app/page.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export default function Home() {
|
|
|
25
25
|
)}
|
|
26
26
|
>
|
|
27
27
|
<AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-100 hover:duration-300 hover:dark:text-neutral-200">
|
|
28
|
-
<span>🚀 New Version - Release v1.
|
|
28
|
+
<span>🚀 New Version - Release v1.15.1</span>
|
|
29
29
|
<ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />
|
|
30
30
|
</AnimatedShinyText>
|
|
31
31
|
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { DocSearch } from "@docsearch/react";
|
|
5
|
+
|
|
6
|
+
export default function DocSearchComponent() {
|
|
7
|
+
const appId = process.env.NEXT_PUBLIC_ALGOLIA_DOCSEARCH_APP_ID;
|
|
8
|
+
const apiKey = process.env.NEXT_PUBLIC_ALGOLIA_DOCSEARCH_API_KEY;
|
|
9
|
+
const indexName = process.env.NEXT_PUBLIC_ALGOLIA_DOCSEARCH_INDEX_NAME;
|
|
10
|
+
|
|
11
|
+
if (!appId || !apiKey || !indexName) {
|
|
12
|
+
console.error(
|
|
13
|
+
"DocSearch credentials are not set in the environment variables."
|
|
14
|
+
);
|
|
15
|
+
return (
|
|
16
|
+
<button className="text-sm text-muted-foreground" disabled>
|
|
17
|
+
Search... (misconfigured)
|
|
18
|
+
</button>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="docsearch">
|
|
24
|
+
<DocSearch
|
|
25
|
+
appId={appId}
|
|
26
|
+
apiKey={apiKey}
|
|
27
|
+
indexName={indexName}
|
|
28
|
+
placeholder="Type something to search..."
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -4,11 +4,12 @@ import { useState, useEffect } from "react";
|
|
|
4
4
|
import { Dialog } from "@/components/ui/dialog";
|
|
5
5
|
import { SearchTrigger } from "@/components/SearchTrigger";
|
|
6
6
|
import { SearchModal } from "@/components/SearchModal";
|
|
7
|
+
import DocSearchComponent from "@/components/DocSearch";
|
|
8
|
+
import { DialogTrigger } from "@radix-ui/react-dialog";
|
|
7
9
|
|
|
8
|
-
// Define props for the Search component
|
|
9
10
|
interface SearchProps {
|
|
10
11
|
/**
|
|
11
|
-
* Specify
|
|
12
|
+
* Specify which search engine to use.
|
|
12
13
|
* @default 'default'
|
|
13
14
|
*/
|
|
14
15
|
type?: "default" | "algolia";
|
|
@@ -17,33 +18,36 @@ interface SearchProps {
|
|
|
17
18
|
export default function Search({ type = "default" }: SearchProps) {
|
|
18
19
|
const [isOpen, setIsOpen] = useState(false);
|
|
19
20
|
|
|
20
|
-
//
|
|
21
|
+
// The useEffect below is ONLY for the 'default' type, which is correct.
|
|
22
|
+
// DocSearch handles its own keyboard shortcut.
|
|
21
23
|
useEffect(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
event.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
if (type === 'default') {
|
|
25
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
26
|
+
if ((event.ctrlKey || event.metaKey) && event.key === "k") {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
setIsOpen((open) => !open);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
33
|
+
return () => {
|
|
34
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}, [type]);
|
|
34
38
|
|
|
35
|
-
// Here you can add logic for different search types if needed in the future
|
|
36
39
|
if (type === "algolia") {
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
// For now, we will fall back to the default search implementation
|
|
40
|
+
// Just render the component without passing any state props
|
|
41
|
+
return <DocSearchComponent />;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
//
|
|
44
|
+
// Logic for 'default' search
|
|
43
45
|
return (
|
|
44
46
|
<div>
|
|
45
47
|
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
|
46
|
-
<
|
|
48
|
+
<DialogTrigger asChild>
|
|
49
|
+
<SearchTrigger />
|
|
50
|
+
</DialogTrigger>
|
|
47
51
|
<SearchModal isOpen={isOpen} setIsOpen={setIsOpen} />
|
|
48
52
|
</Dialog>
|
|
49
53
|
</div>
|
|
@@ -8,6 +8,35 @@ date: 02-08-2025
|
|
|
8
8
|
This changelog contains a list of all the changes made to the DocuBook template. It will be updated with each new release and will include information about new features, bug fixes, and other improvements.
|
|
9
9
|
</Note>
|
|
10
10
|
|
|
11
|
+
<div className="sr-only">
|
|
12
|
+
### v 1.15.1
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<Release version="1.15.1" date="2025-08-06" title="Algolia DocSearch for better search result">
|
|
16
|
+
<Changes type="added">
|
|
17
|
+
- new DocSearch.tsx components
|
|
18
|
+
- add props type algolia
|
|
19
|
+
- add searchprops
|
|
20
|
+
- add algolia.css
|
|
21
|
+
</Changes>
|
|
22
|
+
</Release>
|
|
23
|
+
|
|
24
|
+
<Note type="warning" title="environment">
|
|
25
|
+
To use Algolia DocSearch, you need to configure the following environment variables:
|
|
26
|
+
|
|
27
|
+
```plaintext
|
|
28
|
+
NEXT_PUBLIC_ALGOLIA_DOCSEARCH_APP_ID="your_app_id"
|
|
29
|
+
NEXT_PUBLIC_ALGOLIA_DOCSEARCH_API_KEY="your_api_key"
|
|
30
|
+
NEXT_PUBLIC_ALGOLIA_DOCSEARCH_INDEX_NAME="your_index_name"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
in the navbar component, add a prop to the class
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Change <Search /> to <Search type="algolia" />
|
|
37
|
+
```
|
|
38
|
+
</Note>
|
|
39
|
+
|
|
11
40
|
<div className="sr-only">
|
|
12
41
|
### v 1.14.2
|
|
13
42
|
</div>
|
package/src/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docubook",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "next dev",
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"lint": "next lint"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"@docsearch/css": "3",
|
|
13
|
+
"@docsearch/react": "^3.9.0",
|
|
12
14
|
"@radix-ui/react-accordion": "^1.2.0",
|
|
13
15
|
"@radix-ui/react-avatar": "^1.1.0",
|
|
14
16
|
"@radix-ui/react-collapsible": "^1.1.0",
|
|
@@ -21,12 +23,14 @@
|
|
|
21
23
|
"@radix-ui/react-tabs": "^1.1.0",
|
|
22
24
|
"@radix-ui/react-toggle": "^1.1.2",
|
|
23
25
|
"@radix-ui/react-toggle-group": "^1.1.2",
|
|
26
|
+
"algoliasearch": "^5.35.0",
|
|
24
27
|
"class-variance-authority": "^0.7.0",
|
|
25
28
|
"clsx": "^2.1.1",
|
|
26
29
|
"cmdk": "1.0.0",
|
|
27
30
|
"framer-motion": "^12.4.1",
|
|
28
31
|
"geist": "^1.3.1",
|
|
29
32
|
"gray-matter": "^4.0.3",
|
|
33
|
+
"install": "^0.13.0",
|
|
30
34
|
"lucide-react": "^0.511.0",
|
|
31
35
|
"next": "^14.2.6",
|
|
32
36
|
"next-mdx-remote": "^5.0.0",
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*
|
|
2
|
+
================================================================================
|
|
3
|
+
DocSearch Component Styling (Refactored Version)
|
|
4
|
+
================================================================================
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* -- LANGKAH 1: Definisi Variabel Global --
|
|
8
|
+
Variabel tema DocSearch sekarang didefinisikan secara global di :root.
|
|
9
|
+
Ini menyederhanakan pewarisan tema dan memastikan konsistensi.
|
|
10
|
+
Mode gelap secara otomatis menimpa variabel ini karena .dark di globals.css.
|
|
11
|
+
*/
|
|
12
|
+
:root {
|
|
13
|
+
--docsearch-primary-color: hsl(var(--primary));
|
|
14
|
+
--docsearch-text-color: hsl(var(--muted-foreground));
|
|
15
|
+
--docsearch-spacing: 12px;
|
|
16
|
+
--docsearch-icon-stroke-width: 1.4;
|
|
17
|
+
--docsearch-highlight-color: var(--docsearch-primary-color);
|
|
18
|
+
--docsearch-muted-color: hsl(var(--muted-foreground));
|
|
19
|
+
--docsearch-container-background: rgba(0, 0, 0, 0.7);
|
|
20
|
+
--docsearch-logo-color: hsl(var(--primary-foreground));
|
|
21
|
+
|
|
22
|
+
/* Modal */
|
|
23
|
+
--docsearch-modal-width: 560px;
|
|
24
|
+
--docsearch-modal-height: 600px;
|
|
25
|
+
--docsearch-modal-background: hsl(var(--background));
|
|
26
|
+
--docsearch-modal-shadow: 0 0 0 1px hsl(var(--border)), 0 8px 20px rgba(0, 0, 0, 0.2);
|
|
27
|
+
|
|
28
|
+
/* SearchBox */
|
|
29
|
+
--docsearch-searchbox-height: 56px;
|
|
30
|
+
--docsearch-searchbox-background: hsl(var(--input));
|
|
31
|
+
--docsearch-searchbox-focus-background: hsl(var(--card));
|
|
32
|
+
--docsearch-searchbox-shadow: none;
|
|
33
|
+
|
|
34
|
+
/* Hit (Hasil Pencarian) */
|
|
35
|
+
--docsearch-hit-height: 56px;
|
|
36
|
+
--docsearch-hit-color: hsl(var(--foreground));
|
|
37
|
+
--docsearch-hit-active-color: hsl(var(--primary-foreground));
|
|
38
|
+
--docsearch-hit-background: hsl(var(--card));
|
|
39
|
+
--docsearch-hit-shadow: none;
|
|
40
|
+
|
|
41
|
+
/* Keys */
|
|
42
|
+
--docsearch-key-gradient: none;
|
|
43
|
+
--docsearch-key-shadow: none;
|
|
44
|
+
--docsearch-key-pressed-shadow: none;
|
|
45
|
+
|
|
46
|
+
/* Footer */
|
|
47
|
+
--docsearch-footer-height: 44px;
|
|
48
|
+
--docsearch-footer-background: hsl(var(--background));
|
|
49
|
+
--docsearch-footer-shadow: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* -- LANGKAH 2: Gaya untuk Tombol Awal --
|
|
53
|
+
Gaya ini spesifik untuk tombol yang ada di Navbar,
|
|
54
|
+
yang dibungkus oleh <div class="docsearch">.
|
|
55
|
+
*/
|
|
56
|
+
.docsearch .DocSearch-Button {
|
|
57
|
+
background-color: hsl(var(--secondary));
|
|
58
|
+
border: 1px solid hsl(var(--border));
|
|
59
|
+
border-radius: 9999px;
|
|
60
|
+
width: 160px;
|
|
61
|
+
height: 40px;
|
|
62
|
+
color: hsl(var(--muted-foreground));
|
|
63
|
+
transition: width 0.3s ease;
|
|
64
|
+
margin: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.docsearch .DocSearch-Button:hover {
|
|
68
|
+
border-color: var(--docsearch-primary-color);
|
|
69
|
+
box-shadow: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.docsearch .DocSearch-Search-Icon {
|
|
73
|
+
color: var(--docsearch-muted-color);
|
|
74
|
+
width: 1rem;
|
|
75
|
+
height: 1rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.docsearch .DocSearch-Button-Placeholder {
|
|
79
|
+
font-style: normal;
|
|
80
|
+
margin-left: 0.25rem;
|
|
81
|
+
font-size: 0.875rem;
|
|
82
|
+
line-height: 1.25rem;
|
|
83
|
+
color: var(--docsearch-muted-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.docsearch .DocSearch-Button-Key {
|
|
87
|
+
background: var(--docsearch-primary-color);
|
|
88
|
+
color: var(--docsearch-logo-color); /* Menggunakan variabel yg relevan */
|
|
89
|
+
border-radius: 6px;
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
height: 24px;
|
|
93
|
+
padding: 0 6px;
|
|
94
|
+
border: none;
|
|
95
|
+
box-shadow: none;
|
|
96
|
+
top: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* -- LANGKAH 3: Gaya untuk Modal dan Isinya --
|
|
100
|
+
Gaya ini menargetkan elemen-elemen modal yang dirender terpisah.
|
|
101
|
+
Karena variabel sudah global, kita hanya perlu menata elemennya.
|
|
102
|
+
*/
|
|
103
|
+
.DocSearch-Container .DocSearch-Modal {
|
|
104
|
+
backdrop-filter: blur(8px);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.DocSearch-Form {
|
|
108
|
+
border: 1px solid hsl(var(--border));
|
|
109
|
+
background-color: transparent;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.DocSearch-Input {
|
|
113
|
+
font-size: 15px !important;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.DocSearch-Footer {
|
|
117
|
+
border-top: 1px solid hsl(var(--border));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Gaya untuk tombol keyboard di footer */
|
|
121
|
+
.DocSearch-Footer--commands kbd {
|
|
122
|
+
background-color: hsl(var(--secondary));
|
|
123
|
+
border: 1px solid hsl(var(--border));
|
|
124
|
+
border-bottom-width: 2px;
|
|
125
|
+
border-radius: 6px;
|
|
126
|
+
color: var(--docsearch-muted-color);
|
|
127
|
+
padding: 4px 8px;
|
|
128
|
+
display: flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Menghilangkan gaya default dari ikon di dalam tombol footer */
|
|
134
|
+
.DocSearch-Commands-Key {
|
|
135
|
+
background: none;
|
|
136
|
+
color: hsl(var(--muted-foreground));
|
|
137
|
+
border: 1px solid hsl(var(--border));
|
|
138
|
+
box-shadow: none;
|
|
139
|
+
padding: 2px 4px;
|
|
140
|
+
margin-right: 0.4em;
|
|
141
|
+
height: 20px;
|
|
142
|
+
width: 32px;
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* -- LANGKAH 4: Gaya Responsif --
|
|
147
|
+
Tidak ada perubahan, hanya mempertahankan fungsionalitas mobile.
|
|
148
|
+
*/
|
|
149
|
+
@media (max-width: 768px) {
|
|
150
|
+
.docsearch .DocSearch-Button {
|
|
151
|
+
width: 40px;
|
|
152
|
+
height: 40px;
|
|
153
|
+
padding: 0;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
background: none;
|
|
156
|
+
border: none;
|
|
157
|
+
}
|
|
158
|
+
.docsearch .DocSearch-Button-Placeholder,
|
|
159
|
+
.docsearch .DocSearch-Button-Key {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
@import "@docsearch/css";
|
|
2
|
+
@import "./algolia.css";
|
|
3
|
+
|
|
1
4
|
@tailwind base;
|
|
2
5
|
@tailwind components;
|
|
3
6
|
@tailwind utilities;
|
|
4
7
|
|
|
5
|
-
@import url("
|
|
6
|
-
|
|
8
|
+
@import url("./syntax.css");
|
|
7
9
|
/* Modern Blue Theme */
|
|
8
10
|
@layer base {
|
|
9
11
|
:root {
|
|
@@ -136,4 +138,4 @@ pre>code {
|
|
|
136
138
|
background-position: 0% 0%;
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
|
-
}
|
|
141
|
+
}
|