create-lupine 1.0.28 → 1.0.30
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/index.js +410 -411
- package/package.json +17 -17
- package/templates/common/.env.development +7 -7
- package/templates/common/.env.mobile +9 -9
- package/templates/common/.env.production +7 -7
- package/templates/common/_env +58 -58
- package/templates/common/_gitignore +25 -25
- package/templates/common/apps/server/src/index.ts +78 -76
- package/templates/common/apps/server/src/server-env-keys.ts +0 -9
- package/templates/common/dev/cp-folder.js +45 -45
- package/templates/common/tsconfig.json +128 -128
- package/templates/lupine-template-cv-starter/api/package.json +5 -5
- package/templates/lupine-template-cv-starter/api/resources/config_default.json +6 -6
- package/templates/lupine-template-cv-starter/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-cv-starter/api/src/index.ts +15 -15
- package/templates/lupine-template-cv-starter/lupine.json +40 -38
- package/templates/lupine-template-cv-starter/web/markdown/en/01-experience/index.md +32 -32
- package/templates/lupine-template-cv-starter/web/markdown/en/02-projects/index.md +36 -36
- package/templates/lupine-template-cv-starter/web/markdown/en/03-skills/index.md +28 -28
- package/templates/lupine-template-cv-starter/web/markdown/en/04-education/index.md +16 -16
- package/templates/lupine-template-cv-starter/web/markdown/en/index.md +41 -41
- package/templates/lupine-template-cv-starter/web/markdown/index.md +7 -7
- package/templates/lupine-template-cv-starter/web/markdown/zh/01-experience/index.md +32 -32
- package/templates/lupine-template-cv-starter/web/markdown/zh/02-projects/index.md +36 -36
- package/templates/lupine-template-cv-starter/web/markdown/zh/03-skills/index.md +28 -28
- package/templates/lupine-template-cv-starter/web/markdown/zh/04-education/index.md +17 -17
- package/templates/lupine-template-cv-starter/web/markdown/zh/index.md +41 -41
- package/templates/lupine-template-cv-starter/web/package.json +5 -5
- package/templates/lupine-template-cv-starter/web/src/client-env-keys.ts +5 -5
- package/templates/lupine-template-cv-starter/web/src/index.html +16 -16
- package/templates/lupine-template-cv-starter/web/src/index.tsx +28 -28
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/404.html +38 -38
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.html +73 -73
- package/templates/lupine-template-cv-starter/web/src/lupine-template-cv-starter/index.tsx +30 -30
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/01-experience/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/02-projects/index.html +28 -28
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/03-skills/index.html +18 -18
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/04-education/index.html +10 -10
- package/templates/lupine-template-cv-starter/web/src/markdown-built/en/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/01-experience/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/02-projects/index.html +28 -28
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/03-skills/index.html +18 -18
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/04-education/index.html +11 -11
- package/templates/lupine-template-cv-starter/web/src/markdown-built/zh/index.html +20 -20
- package/templates/lupine-template-cv-starter/web/src/styles/base-css.ts +15 -15
- package/templates/lupine-template-doc-starter/api/package.json +5 -5
- package/templates/lupine-template-doc-starter/api/resources/config_default.json +6 -6
- package/templates/lupine-template-doc-starter/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-doc-starter/api/src/index.ts +15 -15
- package/templates/lupine-template-doc-starter/api/src/resources/config_default.json +6 -6
- package/templates/lupine-template-doc-starter/api/src/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-doc-starter/lupine.json +40 -38
- package/templates/lupine-template-doc-starter/web/markdown/en/essentials/index.md +6 -6
- package/templates/lupine-template-doc-starter/web/markdown/en/essentials/list.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/en/guide/install.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/en/guide/started.md +22 -22
- package/templates/lupine-template-doc-starter/web/markdown/en/index.md +42 -42
- package/templates/lupine-template-doc-starter/web/markdown/index.md +7 -7
- package/templates/lupine-template-doc-starter/web/markdown/zh/essentials/index.md +6 -6
- package/templates/lupine-template-doc-starter/web/markdown/zh/essentials/list.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/zh/guide/install.md +18 -18
- package/templates/lupine-template-doc-starter/web/markdown/zh/guide/started.md +22 -22
- package/templates/lupine-template-doc-starter/web/markdown/zh/index.md +42 -42
- package/templates/lupine-template-doc-starter/web/package.json +5 -5
- package/templates/lupine-template-doc-starter/web/src/client-env-keys.ts +5 -5
- package/templates/lupine-template-doc-starter/web/src/index.html +16 -16
- package/templates/lupine-template-doc-starter/web/src/index.tsx +28 -28
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/404.html +38 -38
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.html +27 -27
- package/templates/lupine-template-doc-starter/web/src/lupine-template-doc-starter/index.tsx +30 -30
- package/templates/lupine-template-doc-starter/web/src/markdown-built/en/essentials/list.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/en/guide/install.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/en/guide/started.html +12 -12
- package/templates/lupine-template-doc-starter/web/src/markdown-built/zh/essentials/list.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/zh/guide/install.html +8 -8
- package/templates/lupine-template-doc-starter/web/src/markdown-built/zh/guide/started.html +12 -12
- package/templates/lupine-template-doc-starter/web/src/styles/base-css.ts +15 -15
- package/templates/lupine-template-hello-world/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-hello-world/api/src/index.ts +4 -4
- package/templates/lupine-template-hello-world/api/src/service/root-api.ts +18 -18
- package/templates/lupine-template-hello-world/lupine.json +23 -23
- package/templates/lupine-template-hello-world/web/package.json +6 -6
- package/templates/lupine-template-hello-world/web/src/index.html +16 -16
- package/templates/lupine-template-hello-world/web/src/index.tsx +73 -73
- package/templates/lupine-template-responsive-starter/api/resources/install.sqlite.sql +3 -3
- package/templates/lupine-template-responsive-starter/api/src/index.ts +4 -4
- package/templates/lupine-template-responsive-starter/api/src/service/root-api.ts +18 -18
- package/templates/lupine-template-responsive-starter/lupine.json +7 -7
- package/templates/lupine-template-responsive-starter/web/src/app-icons.ts +76 -76
- package/templates/lupine-template-responsive-starter/web/src/components/input-history-component.tsx +93 -93
- package/templates/lupine-template-responsive-starter/web/src/components/mine-about-page.tsx +86 -86
- package/templates/lupine-template-responsive-starter/web/src/components/mine-premium-page.tsx +80 -80
- package/templates/lupine-template-responsive-starter/web/src/components/mine-settings-page.tsx +220 -219
- package/templates/lupine-template-responsive-starter/web/src/components/mobile-top-search-menu.tsx +119 -119
- package/templates/lupine-template-responsive-starter/web/src/components/note-detail.tsx +116 -116
- package/templates/lupine-template-responsive-starter/web/src/components/note-edit.tsx +154 -154
- package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx +193 -193
- package/templates/lupine-template-responsive-starter/web/src/components/search-input.tsx +95 -95
- package/templates/lupine-template-responsive-starter/web/src/components/side-menu-content.tsx +182 -182
- package/templates/lupine-template-responsive-starter/web/src/frames/app-responsive-frame.tsx +52 -52
- package/templates/lupine-template-responsive-starter/web/src/index.html +16 -16
- package/templates/lupine-template-responsive-starter/web/src/index.tsx +39 -39
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/404.html +35 -35
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.html +49 -49
- package/templates/lupine-template-responsive-starter/web/src/lupine-template-responsive-starter/index.tsx +32 -32
- package/templates/lupine-template-responsive-starter/web/src/pages/about-page.tsx +43 -43
- package/templates/lupine-template-responsive-starter/web/src/pages/finance-page.tsx +46 -46
- package/templates/lupine-template-responsive-starter/web/src/pages/home-page.tsx +452 -452
- package/templates/lupine-template-responsive-starter/web/src/pages/mine-page.tsx +325 -325
- package/templates/lupine-template-responsive-starter/web/src/pages/tools-page.tsx +46 -46
- package/templates/lupine-template-responsive-starter/web/src/services/local-notes-service.ts +87 -87
- package/templates/lupine-template-responsive-starter/web/src/services/mine-service.ts +45 -45
- package/templates/common/dev/dev-watch.js +0 -389
package/templates/lupine-template-responsive-starter/web/src/components/note-search-page.tsx
CHANGED
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
import { CssProps, HeaderWithBackFrame, HtmlVar, RefProps, SliderFrame, SliderFrameHookProps } from 'lupine.components';
|
|
2
|
-
import { SearchInput, SearchInputHookProps } from './search-input';
|
|
3
|
-
import { InputHistoryComponent, addHistoryItem } from './input-history-component';
|
|
4
|
-
import { LocalNoteProps, LocalNotesService } from '../services/local-notes-service';
|
|
5
|
-
import { NoteDetailComponent } from './note-detail';
|
|
6
|
-
import { clearHistoryList } from './input-history-component';
|
|
7
|
-
|
|
8
|
-
const extractText = (html: string) => {
|
|
9
|
-
const tmp = document.createElement('DIV');
|
|
10
|
-
tmp.innerHTML = html;
|
|
11
|
-
return tmp.textContent || tmp.innerText || '';
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const NoteSearchComponent = (props: { sliderFrameHook: SliderFrameHookProps }) => {
|
|
15
|
-
const listDom = new HtmlVar('');
|
|
16
|
-
const historyDom = new HtmlVar('');
|
|
17
|
-
|
|
18
|
-
const searchInputHook: SearchInputHookProps = {};
|
|
19
|
-
// this is the inner slide hook for editing from search results
|
|
20
|
-
const subSliderHook: SliderFrameHookProps = {};
|
|
21
|
-
|
|
22
|
-
const historyKey = 'note-search';
|
|
23
|
-
|
|
24
|
-
const onSearch = (value?: string) => {
|
|
25
|
-
const val = (value || '').trim();
|
|
26
|
-
if (val) {
|
|
27
|
-
addHistoryItem(historyKey, val);
|
|
28
|
-
hideHistory();
|
|
29
|
-
} else {
|
|
30
|
-
showHistory();
|
|
31
|
-
}
|
|
32
|
-
refreshList(val);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const onClearSearch = () => {
|
|
36
|
-
onSearch('');
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const showHistory = () => {
|
|
40
|
-
historyDom.value = (
|
|
41
|
-
<InputHistoryComponent
|
|
42
|
-
historyKey={historyKey}
|
|
43
|
-
onClearHistory={() => {
|
|
44
|
-
clearHistoryList(historyKey);
|
|
45
|
-
showHistory();
|
|
46
|
-
}}
|
|
47
|
-
onItemClick={(item) => {
|
|
48
|
-
searchInputHook.setValue!(item);
|
|
49
|
-
onSearch(item);
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const hideHistory = () => {
|
|
56
|
-
historyDom.value = '';
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const onViewNote = (note: LocalNoteProps) => {
|
|
60
|
-
subSliderHook.load!(
|
|
61
|
-
<NoteDetailComponent
|
|
62
|
-
note={note}
|
|
63
|
-
sliderFrameHook={subSliderHook}
|
|
64
|
-
onSaved={() => {
|
|
65
|
-
// We re-query the note values after saving. Easiest is to trigger search again.
|
|
66
|
-
const val = document.querySelector('.search-input .search-in-input') as HTMLInputElement;
|
|
67
|
-
if (val) onSearch(val.value);
|
|
68
|
-
}}
|
|
69
|
-
/>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const refreshList = (query: string) => {
|
|
74
|
-
if (!query) {
|
|
75
|
-
listDom.value = '';
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const allNotes = LocalNotesService.getAllNotes();
|
|
80
|
-
const filteredNotes = allNotes.filter(
|
|
81
|
-
(n) =>
|
|
82
|
-
n.title.toLowerCase().includes(query.toLowerCase()) || n.content.toLowerCase().includes(query.toLowerCase())
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
if (filteredNotes.length === 0) {
|
|
86
|
-
listDom.value = (
|
|
87
|
-
<div
|
|
88
|
-
class='note-empty-state'
|
|
89
|
-
style={{ marginTop: '40px', textAlign: 'center', color: 'var(--secondary-color)' }}
|
|
90
|
-
>
|
|
91
|
-
No search results
|
|
92
|
-
</div>
|
|
93
|
-
);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
listDom.value = (
|
|
98
|
-
<div class='note-list-container' style={{ paddingTop: '16px' }}>
|
|
99
|
-
{filteredNotes.map((note) => (
|
|
100
|
-
<div class='note-card-wrapper search-result-card-wrapper'>
|
|
101
|
-
<div class='note-card row-box search-result-card' onClick={() => onViewNote(note)}>
|
|
102
|
-
<div class='note-card-content flex-1'>
|
|
103
|
-
<div class='note-card-title'>{note.title}</div>
|
|
104
|
-
<div class='note-card-preview ellipsis'>{extractText(note.content)}</div>
|
|
105
|
-
<div class='note-card-date'>{new Date(note.updatedAt).toLocaleString()}</div>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
))}
|
|
110
|
-
</div>
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const css: CssProps = {
|
|
115
|
-
height: '100%',
|
|
116
|
-
display: 'flex',
|
|
117
|
-
flexDirection: 'column',
|
|
118
|
-
overflowY: 'auto',
|
|
119
|
-
backgroundColor: 'var(--primary-bg-color)',
|
|
120
|
-
padding: '0 16px',
|
|
121
|
-
|
|
122
|
-
'.search-result-card-wrapper': {
|
|
123
|
-
marginBottom: '16px',
|
|
124
|
-
borderRadius: '12px',
|
|
125
|
-
overflow: 'hidden',
|
|
126
|
-
boxShadow: '0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05)',
|
|
127
|
-
backgroundColor: 'var(--secondary-bg-color)',
|
|
128
|
-
},
|
|
129
|
-
'.search-result-card': {
|
|
130
|
-
backgroundColor: 'var(--primary-bg-color)',
|
|
131
|
-
borderRadius: '12px',
|
|
132
|
-
padding: '16px',
|
|
133
|
-
cursor: 'pointer',
|
|
134
|
-
alignItems: 'center',
|
|
135
|
-
transition: 'transform 0.2s ease, box-shadow 0.2s ease',
|
|
136
|
-
'&:active': {
|
|
137
|
-
transform: 'scale(0.98)',
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
'.note-card-title': {
|
|
141
|
-
fontSize: '16px',
|
|
142
|
-
fontWeight: 'bold',
|
|
143
|
-
color: 'var(--primary-color)',
|
|
144
|
-
marginBottom: '4px',
|
|
145
|
-
},
|
|
146
|
-
'.note-card-preview': {
|
|
147
|
-
fontSize: '14px',
|
|
148
|
-
color: 'var(--secondary-color)',
|
|
149
|
-
marginBottom: '6px',
|
|
150
|
-
},
|
|
151
|
-
'.note-card-date': {
|
|
152
|
-
fontSize: '12px',
|
|
153
|
-
color: 'var(--secondary-color)',
|
|
154
|
-
opacity: 0.8,
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const ref: RefProps = {
|
|
159
|
-
onLoad: async () => {
|
|
160
|
-
showHistory();
|
|
161
|
-
// focus input
|
|
162
|
-
const input = ref.$('.search-in-input') as HTMLInputElement;
|
|
163
|
-
if (input) {
|
|
164
|
-
requestAnimationFrame(() => input.focus());
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const headerTitle = (
|
|
170
|
-
<SearchInput
|
|
171
|
-
placeholder='Search title or content...'
|
|
172
|
-
onSearch={onSearch}
|
|
173
|
-
onClear={onClearSearch}
|
|
174
|
-
onFocus={showHistory}
|
|
175
|
-
class='w-100p'
|
|
176
|
-
hook={searchInputHook}
|
|
177
|
-
/>
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<HeaderWithBackFrame
|
|
182
|
-
title={headerTitle}
|
|
183
|
-
right={<span></span>}
|
|
184
|
-
onBack={(event) => props.sliderFrameHook.close!(event)}
|
|
185
|
-
>
|
|
186
|
-
<div ref={ref} css={css} class='note-search-page'>
|
|
187
|
-
<SliderFrame hook={subSliderHook} />
|
|
188
|
-
{historyDom.node}
|
|
189
|
-
{listDom.node}
|
|
190
|
-
</div>
|
|
191
|
-
</HeaderWithBackFrame>
|
|
192
|
-
);
|
|
193
|
-
};
|
|
1
|
+
import { CssProps, HeaderWithBackFrame, HtmlVar, RefProps, SliderFrame, SliderFrameHookProps } from 'lupine.components';
|
|
2
|
+
import { SearchInput, SearchInputHookProps } from './search-input';
|
|
3
|
+
import { InputHistoryComponent, addHistoryItem } from './input-history-component';
|
|
4
|
+
import { LocalNoteProps, LocalNotesService } from '../services/local-notes-service';
|
|
5
|
+
import { NoteDetailComponent } from './note-detail';
|
|
6
|
+
import { clearHistoryList } from './input-history-component';
|
|
7
|
+
|
|
8
|
+
const extractText = (html: string) => {
|
|
9
|
+
const tmp = document.createElement('DIV');
|
|
10
|
+
tmp.innerHTML = html;
|
|
11
|
+
return tmp.textContent || tmp.innerText || '';
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const NoteSearchComponent = (props: { sliderFrameHook: SliderFrameHookProps }) => {
|
|
15
|
+
const listDom = new HtmlVar('');
|
|
16
|
+
const historyDom = new HtmlVar('');
|
|
17
|
+
|
|
18
|
+
const searchInputHook: SearchInputHookProps = {};
|
|
19
|
+
// this is the inner slide hook for editing from search results
|
|
20
|
+
const subSliderHook: SliderFrameHookProps = {};
|
|
21
|
+
|
|
22
|
+
const historyKey = 'note-search';
|
|
23
|
+
|
|
24
|
+
const onSearch = (value?: string) => {
|
|
25
|
+
const val = (value || '').trim();
|
|
26
|
+
if (val) {
|
|
27
|
+
addHistoryItem(historyKey, val);
|
|
28
|
+
hideHistory();
|
|
29
|
+
} else {
|
|
30
|
+
showHistory();
|
|
31
|
+
}
|
|
32
|
+
refreshList(val);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const onClearSearch = () => {
|
|
36
|
+
onSearch('');
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const showHistory = () => {
|
|
40
|
+
historyDom.value = (
|
|
41
|
+
<InputHistoryComponent
|
|
42
|
+
historyKey={historyKey}
|
|
43
|
+
onClearHistory={() => {
|
|
44
|
+
clearHistoryList(historyKey);
|
|
45
|
+
showHistory();
|
|
46
|
+
}}
|
|
47
|
+
onItemClick={(item) => {
|
|
48
|
+
searchInputHook.setValue!(item);
|
|
49
|
+
onSearch(item);
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const hideHistory = () => {
|
|
56
|
+
historyDom.value = '';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const onViewNote = (note: LocalNoteProps) => {
|
|
60
|
+
subSliderHook.load!(
|
|
61
|
+
<NoteDetailComponent
|
|
62
|
+
note={note}
|
|
63
|
+
sliderFrameHook={subSliderHook}
|
|
64
|
+
onSaved={() => {
|
|
65
|
+
// We re-query the note values after saving. Easiest is to trigger search again.
|
|
66
|
+
const val = document.querySelector('.search-input .search-in-input') as HTMLInputElement;
|
|
67
|
+
if (val) onSearch(val.value);
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const refreshList = (query: string) => {
|
|
74
|
+
if (!query) {
|
|
75
|
+
listDom.value = '';
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const allNotes = LocalNotesService.getAllNotes();
|
|
80
|
+
const filteredNotes = allNotes.filter(
|
|
81
|
+
(n) =>
|
|
82
|
+
n.title.toLowerCase().includes(query.toLowerCase()) || n.content.toLowerCase().includes(query.toLowerCase())
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (filteredNotes.length === 0) {
|
|
86
|
+
listDom.value = (
|
|
87
|
+
<div
|
|
88
|
+
class='note-empty-state'
|
|
89
|
+
style={{ marginTop: '40px', textAlign: 'center', color: 'var(--secondary-color)' }}
|
|
90
|
+
>
|
|
91
|
+
No search results
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
listDom.value = (
|
|
98
|
+
<div class='note-list-container' style={{ paddingTop: '16px' }}>
|
|
99
|
+
{filteredNotes.map((note) => (
|
|
100
|
+
<div class='note-card-wrapper search-result-card-wrapper'>
|
|
101
|
+
<div class='note-card row-box search-result-card' onClick={() => onViewNote(note)}>
|
|
102
|
+
<div class='note-card-content flex-1'>
|
|
103
|
+
<div class='note-card-title'>{note.title}</div>
|
|
104
|
+
<div class='note-card-preview ellipsis'>{extractText(note.content)}</div>
|
|
105
|
+
<div class='note-card-date'>{new Date(note.updatedAt).toLocaleString()}</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
))}
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const css: CssProps = {
|
|
115
|
+
height: '100%',
|
|
116
|
+
display: 'flex',
|
|
117
|
+
flexDirection: 'column',
|
|
118
|
+
overflowY: 'auto',
|
|
119
|
+
backgroundColor: 'var(--primary-bg-color)',
|
|
120
|
+
padding: '0 16px',
|
|
121
|
+
|
|
122
|
+
'.search-result-card-wrapper': {
|
|
123
|
+
marginBottom: '16px',
|
|
124
|
+
borderRadius: '12px',
|
|
125
|
+
overflow: 'hidden',
|
|
126
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05)',
|
|
127
|
+
backgroundColor: 'var(--secondary-bg-color)',
|
|
128
|
+
},
|
|
129
|
+
'.search-result-card': {
|
|
130
|
+
backgroundColor: 'var(--primary-bg-color)',
|
|
131
|
+
borderRadius: '12px',
|
|
132
|
+
padding: '16px',
|
|
133
|
+
cursor: 'pointer',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
transition: 'transform 0.2s ease, box-shadow 0.2s ease',
|
|
136
|
+
'&:active': {
|
|
137
|
+
transform: 'scale(0.98)',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
'.note-card-title': {
|
|
141
|
+
fontSize: '16px',
|
|
142
|
+
fontWeight: 'bold',
|
|
143
|
+
color: 'var(--primary-color)',
|
|
144
|
+
marginBottom: '4px',
|
|
145
|
+
},
|
|
146
|
+
'.note-card-preview': {
|
|
147
|
+
fontSize: '14px',
|
|
148
|
+
color: 'var(--secondary-color)',
|
|
149
|
+
marginBottom: '6px',
|
|
150
|
+
},
|
|
151
|
+
'.note-card-date': {
|
|
152
|
+
fontSize: '12px',
|
|
153
|
+
color: 'var(--secondary-color)',
|
|
154
|
+
opacity: 0.8,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const ref: RefProps = {
|
|
159
|
+
onLoad: async () => {
|
|
160
|
+
showHistory();
|
|
161
|
+
// focus input
|
|
162
|
+
const input = ref.$('.search-in-input') as HTMLInputElement;
|
|
163
|
+
if (input) {
|
|
164
|
+
requestAnimationFrame(() => input.focus());
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const headerTitle = (
|
|
170
|
+
<SearchInput
|
|
171
|
+
placeholder='Search title or content...'
|
|
172
|
+
onSearch={onSearch}
|
|
173
|
+
onClear={onClearSearch}
|
|
174
|
+
onFocus={showHistory}
|
|
175
|
+
class='w-100p'
|
|
176
|
+
hook={searchInputHook}
|
|
177
|
+
/>
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<HeaderWithBackFrame
|
|
182
|
+
title={headerTitle}
|
|
183
|
+
right={<span></span>}
|
|
184
|
+
onBack={(event) => props.sliderFrameHook.close!(event)}
|
|
185
|
+
>
|
|
186
|
+
<div ref={ref} css={css} class='note-search-page'>
|
|
187
|
+
<SliderFrame hook={subSliderHook} />
|
|
188
|
+
{historyDom.node}
|
|
189
|
+
{listDom.node}
|
|
190
|
+
</div>
|
|
191
|
+
</HeaderWithBackFrame>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
import { bindGlobalStyle, CssProps, RefProps } from 'lupine.components';
|
|
2
|
-
|
|
3
|
-
export interface SearchInputHookProps {
|
|
4
|
-
setValue?: (value: string) => void;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface InputWithClearProps {
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
onSearch: (value: string) => void;
|
|
10
|
-
onClear?: () => void;
|
|
11
|
-
onFocus?: () => void;
|
|
12
|
-
onBlur?: () => void;
|
|
13
|
-
class?: string;
|
|
14
|
-
searchIcon?: string;
|
|
15
|
-
hook?: SearchInputHookProps;
|
|
16
|
-
}
|
|
17
|
-
export const SearchInput = (props: InputWithClearProps) => {
|
|
18
|
-
const css: CssProps = {
|
|
19
|
-
display: 'flex',
|
|
20
|
-
flex: 1,
|
|
21
|
-
position: 'relative',
|
|
22
|
-
fontSize: '16px',
|
|
23
|
-
'.search-in-input': {
|
|
24
|
-
flex: 1,
|
|
25
|
-
paddingRight: '30px',
|
|
26
|
-
height: '32px',
|
|
27
|
-
padding: '4px 30px 4px 12px',
|
|
28
|
-
borderRadius: '16px',
|
|
29
|
-
border: 'none',
|
|
30
|
-
backgroundColor: 'var(--secondary-bg-color)',
|
|
31
|
-
color: 'var(--primary-color)',
|
|
32
|
-
outline: 'none',
|
|
33
|
-
},
|
|
34
|
-
'.search-in-search, .search-in-clear': {
|
|
35
|
-
position: 'absolute',
|
|
36
|
-
top: '50%',
|
|
37
|
-
transform: 'translateY(-50%)',
|
|
38
|
-
cursor: 'pointer',
|
|
39
|
-
display: 'flex',
|
|
40
|
-
alignItems: 'center',
|
|
41
|
-
justifyContent: 'center',
|
|
42
|
-
color: 'var(--secondary-color)',
|
|
43
|
-
},
|
|
44
|
-
'.search-in-search': {
|
|
45
|
-
right: '12px',
|
|
46
|
-
},
|
|
47
|
-
'.search-in-clear': {
|
|
48
|
-
display: 'none',
|
|
49
|
-
right: '34px',
|
|
50
|
-
},
|
|
51
|
-
'input.search-in-input:not(:placeholder-shown) + .search-in-clear': {
|
|
52
|
-
display: 'flex',
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
bindGlobalStyle('search-input-component', css);
|
|
56
|
-
|
|
57
|
-
const ref: RefProps = {};
|
|
58
|
-
const onSearch = () => {
|
|
59
|
-
const value = ref.$('.search-in-input').value;
|
|
60
|
-
props.onSearch(value);
|
|
61
|
-
};
|
|
62
|
-
const onClear = () => {
|
|
63
|
-
ref.$('.search-in-input').value = '';
|
|
64
|
-
props.onClear?.();
|
|
65
|
-
};
|
|
66
|
-
if (props.hook) {
|
|
67
|
-
props.hook.setValue = (value: string) => {
|
|
68
|
-
ref.$('input.search-in-input').value = value;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
return (
|
|
72
|
-
<div ref={ref} class={'search-input-component ' + (props.class || '')}>
|
|
73
|
-
<input
|
|
74
|
-
type='text'
|
|
75
|
-
maxLength={30}
|
|
76
|
-
spellcheck={false}
|
|
77
|
-
class='search-in-input input-base'
|
|
78
|
-
placeholder={props.placeholder}
|
|
79
|
-
onKeyDown={(e) => {
|
|
80
|
-
if (e.key === 'Enter') {
|
|
81
|
-
onSearch();
|
|
82
|
-
}
|
|
83
|
-
}}
|
|
84
|
-
onBlur={() => props.onBlur?.()}
|
|
85
|
-
onFocus={() => props.onFocus?.()}
|
|
86
|
-
/>
|
|
87
|
-
<div class='search-in-clear' onClick={onClear}>
|
|
88
|
-
<i class='ifc-icon ma-close' />
|
|
89
|
-
</div>
|
|
90
|
-
<div class='search-in-search' onClick={onSearch}>
|
|
91
|
-
<i class={'ifc-icon ' + (props.searchIcon || 'bs-search')} />
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
);
|
|
95
|
-
};
|
|
1
|
+
import { bindGlobalStyle, CssProps, RefProps } from 'lupine.components';
|
|
2
|
+
|
|
3
|
+
export interface SearchInputHookProps {
|
|
4
|
+
setValue?: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface InputWithClearProps {
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
onSearch: (value: string) => void;
|
|
10
|
+
onClear?: () => void;
|
|
11
|
+
onFocus?: () => void;
|
|
12
|
+
onBlur?: () => void;
|
|
13
|
+
class?: string;
|
|
14
|
+
searchIcon?: string;
|
|
15
|
+
hook?: SearchInputHookProps;
|
|
16
|
+
}
|
|
17
|
+
export const SearchInput = (props: InputWithClearProps) => {
|
|
18
|
+
const css: CssProps = {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flex: 1,
|
|
21
|
+
position: 'relative',
|
|
22
|
+
fontSize: '16px',
|
|
23
|
+
'.search-in-input': {
|
|
24
|
+
flex: 1,
|
|
25
|
+
paddingRight: '30px',
|
|
26
|
+
height: '32px',
|
|
27
|
+
padding: '4px 30px 4px 12px',
|
|
28
|
+
borderRadius: '16px',
|
|
29
|
+
border: 'none',
|
|
30
|
+
backgroundColor: 'var(--secondary-bg-color)',
|
|
31
|
+
color: 'var(--primary-color)',
|
|
32
|
+
outline: 'none',
|
|
33
|
+
},
|
|
34
|
+
'.search-in-search, .search-in-clear': {
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
top: '50%',
|
|
37
|
+
transform: 'translateY(-50%)',
|
|
38
|
+
cursor: 'pointer',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
color: 'var(--secondary-color)',
|
|
43
|
+
},
|
|
44
|
+
'.search-in-search': {
|
|
45
|
+
right: '12px',
|
|
46
|
+
},
|
|
47
|
+
'.search-in-clear': {
|
|
48
|
+
display: 'none',
|
|
49
|
+
right: '34px',
|
|
50
|
+
},
|
|
51
|
+
'input.search-in-input:not(:placeholder-shown) + .search-in-clear': {
|
|
52
|
+
display: 'flex',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
bindGlobalStyle('search-input-component', css);
|
|
56
|
+
|
|
57
|
+
const ref: RefProps = {};
|
|
58
|
+
const onSearch = () => {
|
|
59
|
+
const value = ref.$('.search-in-input').value;
|
|
60
|
+
props.onSearch(value);
|
|
61
|
+
};
|
|
62
|
+
const onClear = () => {
|
|
63
|
+
ref.$('.search-in-input').value = '';
|
|
64
|
+
props.onClear?.();
|
|
65
|
+
};
|
|
66
|
+
if (props.hook) {
|
|
67
|
+
props.hook.setValue = (value: string) => {
|
|
68
|
+
ref.$('input.search-in-input').value = value;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return (
|
|
72
|
+
<div ref={ref} class={'search-input-component ' + (props.class || '')}>
|
|
73
|
+
<input
|
|
74
|
+
type='text'
|
|
75
|
+
maxLength={30}
|
|
76
|
+
spellcheck={false}
|
|
77
|
+
class='search-in-input input-base'
|
|
78
|
+
placeholder={props.placeholder}
|
|
79
|
+
onKeyDown={(e) => {
|
|
80
|
+
if (e.key === 'Enter') {
|
|
81
|
+
onSearch();
|
|
82
|
+
}
|
|
83
|
+
}}
|
|
84
|
+
onBlur={() => props.onBlur?.()}
|
|
85
|
+
onFocus={() => props.onFocus?.()}
|
|
86
|
+
/>
|
|
87
|
+
<div class='search-in-clear' onClick={onClear}>
|
|
88
|
+
<i class='ifc-icon ma-close' />
|
|
89
|
+
</div>
|
|
90
|
+
<div class='search-in-search' onClick={onSearch}>
|
|
91
|
+
<i class={'ifc-icon ' + (props.searchIcon || 'bs-search')} />
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
};
|