@windrun-huaiin/third-ui 29.2.1 → 30.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/dist/fuma/fuma-page-genarator.d.ts +2 -6
- package/dist/fuma/fuma-page-genarator.js +3 -2
- package/dist/fuma/fuma-page-genarator.mjs +3 -2
- package/dist/fuma/mdx/cheet-table.d.ts +13 -0
- package/dist/fuma/mdx/cheet-table.js +295 -0
- package/dist/fuma/mdx/cheet-table.mjs +293 -0
- package/dist/fuma/mdx/index.d.ts +1 -0
- package/dist/fuma/mdx/index.js +2 -0
- package/dist/fuma/mdx/index.mjs +1 -0
- package/dist/fuma/server/features/widgets.js +2 -0
- package/dist/fuma/server/features/widgets.mjs +2 -0
- package/dist/lib/fuma-schema-check-util.d.ts +1 -1
- package/dist/main/404-page.d.ts +12 -0
- package/dist/main/404-page.js +66 -0
- package/dist/main/404-page.mjs +64 -0
- package/dist/main/alert-dialog/confirm-dialog.js +1 -1
- package/dist/main/alert-dialog/confirm-dialog.mjs +2 -2
- package/dist/main/alert-dialog/dialog-loading-action.js +5 -2
- package/dist/main/alert-dialog/dialog-loading-action.mjs +5 -2
- package/dist/main/alert-dialog/dialog-styles.d.ts +4 -2
- package/dist/main/alert-dialog/dialog-styles.js +8 -4
- package/dist/main/alert-dialog/dialog-styles.mjs +7 -5
- package/dist/main/alert-dialog/high-priority-confirm-dialog.js +5 -5
- package/dist/main/alert-dialog/high-priority-confirm-dialog.mjs +6 -6
- package/dist/main/alert-dialog/info-dialog.js +1 -1
- package/dist/main/alert-dialog/info-dialog.mjs +2 -2
- package/dist/main/alert-dialog/undoable-confirm-dialog.js +2 -2
- package/dist/main/alert-dialog/undoable-confirm-dialog.mjs +3 -3
- package/dist/main/anime/anime-404-page.d.ts +14 -0
- package/dist/main/anime/anime-404-page.js +197 -0
- package/dist/main/anime/anime-404-page.mjs +195 -0
- package/dist/main/anime/anime-beam-frame.d.ts +3 -0
- package/dist/main/anime/anime-beam-frame.js +63 -0
- package/dist/main/anime/anime-beam-frame.mjs +61 -0
- package/dist/main/anime/anime-not-found-page.d.ts +7 -0
- package/dist/main/anime/anime-not-found-page.js +142 -0
- package/dist/main/anime/anime-not-found-page.mjs +140 -0
- package/dist/main/anime/anime-spiral-loading.d.ts +10 -0
- package/dist/main/anime/anime-spiral-loading.js +77 -0
- package/dist/main/anime/anime-spiral-loading.mjs +75 -0
- package/dist/main/anime/index.d.ts +3 -0
- package/dist/main/anime/index.js +12 -0
- package/dist/main/anime/index.mjs +4 -0
- package/dist/main/beam-frame/animate.d.ts +3 -0
- package/dist/main/beam-frame/animate.js +63 -0
- package/dist/main/beam-frame/animate.mjs +61 -0
- package/dist/main/beam-frame/beam-frame.d.ts +4 -0
- package/dist/main/beam-frame/beam-frame.js +262 -0
- package/dist/main/beam-frame/beam-frame.mjs +258 -0
- package/dist/main/beam-frame/index.d.ts +4 -0
- package/dist/main/beam-frame/index.js +11 -0
- package/dist/main/beam-frame/index.mjs +3 -0
- package/dist/main/beam-frame/motion.d.ts +3 -0
- package/dist/main/beam-frame/motion.js +61 -0
- package/dist/main/beam-frame/motion.mjs +59 -0
- package/dist/main/beam-frame/share-config.d.ts +54 -0
- package/dist/main/beam-frame/share-config.js +161 -0
- package/dist/main/beam-frame/share-config.mjs +152 -0
- package/dist/main/beam-frame-config.d.ts +54 -0
- package/dist/main/beam-frame-config.js +161 -0
- package/dist/main/beam-frame-config.mjs +152 -0
- package/dist/main/calendar/random-date-range-dialog.js +177 -51
- package/dist/main/calendar/random-date-range-dialog.mjs +178 -52
- package/dist/main/cta.js +17 -1
- package/dist/main/cta.mjs +18 -2
- package/dist/main/delayed-img.d.ts +1 -1
- package/dist/main/delayed-img.js +8 -5
- package/dist/main/delayed-img.mjs +8 -5
- package/dist/main/index.d.ts +1 -0
- package/dist/main/index.js +2 -0
- package/dist/main/index.mjs +1 -0
- package/dist/main/info-tooltip.js +70 -9
- package/dist/main/info-tooltip.mjs +70 -9
- package/dist/main/loading-frame/index.d.ts +1 -0
- package/dist/main/loading.d.ts +2 -1
- package/dist/main/loading.js +64 -26
- package/dist/main/loading.mjs +64 -26
- package/dist/main/motion/creative-left-panel.d.ts +7 -0
- package/dist/main/motion/creative-left-panel.js +11 -0
- package/dist/main/motion/creative-left-panel.mjs +9 -0
- package/dist/main/motion/creative-right-panel.d.ts +7 -0
- package/dist/main/motion/creative-right-panel.js +11 -0
- package/dist/main/motion/creative-right-panel.mjs +9 -0
- package/dist/main/motion/index.d.ts +1 -0
- package/dist/main/motion/index.js +9 -0
- package/dist/main/motion/index.mjs +2 -0
- package/dist/main/motion/motion-beam-frame.d.ts +3 -0
- package/dist/main/motion/motion-beam-frame.js +61 -0
- package/dist/main/motion/motion-beam-frame.mjs +59 -0
- package/dist/main/snake-loading-frame.d.ts +7 -3
- package/dist/main/snake-loading-frame.js +45 -252
- package/dist/main/snake-loading-frame.mjs +47 -254
- package/package.json +16 -5
- package/src/fuma/fuma-page-genarator.tsx +2 -22
- package/src/fuma/mdx/cheet-table.tsx +650 -0
- package/src/fuma/mdx/index.ts +1 -0
- package/src/fuma/server/features/widgets.tsx +2 -0
- package/src/main/404-page.tsx +162 -0
- package/src/main/alert-dialog/confirm-dialog.tsx +2 -1
- package/src/main/alert-dialog/dialog-loading-action.tsx +7 -5
- package/src/main/alert-dialog/dialog-styles.ts +13 -3
- package/src/main/alert-dialog/high-priority-confirm-dialog.tsx +26 -23
- package/src/main/alert-dialog/info-dialog.tsx +2 -1
- package/src/main/alert-dialog/undoable-confirm-dialog.tsx +18 -17
- package/src/main/anime/anime-404-page.tsx +344 -0
- package/src/main/anime/anime-beam-frame.tsx +128 -0
- package/src/main/anime/anime-spiral-loading.tsx +123 -0
- package/src/main/anime/index.ts +10 -0
- package/src/main/beam-frame-config.tsx +341 -0
- package/src/main/calendar/random-date-range-dialog.tsx +225 -69
- package/src/main/cta.tsx +50 -21
- package/src/main/delayed-img.tsx +9 -4
- package/src/main/index.ts +1 -0
- package/src/main/info-tooltip.tsx +116 -20
- package/src/main/loading-frame/index.ts +4 -0
- package/src/main/loading.tsx +75 -24
- package/src/main/motion/index.ts +8 -0
- package/src/main/motion/motion-beam-frame.tsx +137 -0
- package/src/main/snake-loading-frame.tsx +95 -496
- package/src/styles/cta.css +21 -4
- package/src/styles/third-ui.css +0 -20
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __rest, __awaiter } from 'tslib';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { EyeIcon, EyeOffIcon, CheckIcon, CopyIcon } from '@windrun-huaiin/base-ui/icons';
|
|
5
|
+
import { themeSvgIconColor, themeIconColor, themeRingColor } from '@windrun-huaiin/base-ui/lib';
|
|
6
|
+
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
|
+
import { useState, useRef, useMemo, useEffect, isValidElement, Children } from 'react';
|
|
8
|
+
import { InfoTooltip } from '../../main/info-tooltip.mjs';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_COLUMN_WIDTH = 180;
|
|
11
|
+
const MIN_COLUMN_WIDTH = 140;
|
|
12
|
+
const CHEET_TABLE_BORDER_COLOR = `color-mix(in srgb, ${themeSvgIconColor} 35%, transparent)`;
|
|
13
|
+
const CHEET_TABLE_BORDER_CLASS = 'border-[color:var(--cheet-table-border-color)]';
|
|
14
|
+
function parseCheetCell(raw) {
|
|
15
|
+
let value = raw.trim();
|
|
16
|
+
let force = false;
|
|
17
|
+
if (value.startsWith('!!')) {
|
|
18
|
+
force = true;
|
|
19
|
+
value = value.slice(2).trimStart();
|
|
20
|
+
}
|
|
21
|
+
const descriptionIndex = value.indexOf('??');
|
|
22
|
+
if (descriptionIndex === -1) {
|
|
23
|
+
return {
|
|
24
|
+
text: value,
|
|
25
|
+
force,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const description = value.slice(descriptionIndex + 2).trim();
|
|
29
|
+
return {
|
|
30
|
+
text: value.slice(0, descriptionIndex).trimEnd(),
|
|
31
|
+
description: description ? description : undefined,
|
|
32
|
+
force,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function normalizeText(value) {
|
|
36
|
+
return value.replace(/\s+/g, ' ').trim();
|
|
37
|
+
}
|
|
38
|
+
function collectText(node) {
|
|
39
|
+
if (typeof node === 'string' || typeof node === 'number') {
|
|
40
|
+
return String(node);
|
|
41
|
+
}
|
|
42
|
+
if (Array.isArray(node)) {
|
|
43
|
+
return node.map(collectText).join('');
|
|
44
|
+
}
|
|
45
|
+
if (isValidElement(node)) {
|
|
46
|
+
return collectText(node.props.children);
|
|
47
|
+
}
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
function getElementChildren(element) {
|
|
51
|
+
return Children.toArray(element.props.children);
|
|
52
|
+
}
|
|
53
|
+
function isElementType(node, type) {
|
|
54
|
+
return isValidElement(node) && node.type === type;
|
|
55
|
+
}
|
|
56
|
+
function findFirstElement(node, type) {
|
|
57
|
+
if (isElementType(node, type)) {
|
|
58
|
+
return node;
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(node)) {
|
|
61
|
+
for (const child of node) {
|
|
62
|
+
const match = findFirstElement(child, type);
|
|
63
|
+
if (match) {
|
|
64
|
+
return match;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (isValidElement(node)) {
|
|
69
|
+
return findFirstElement(node.props.children, type);
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function collectRowElements(node) {
|
|
74
|
+
if (isElementType(node, 'tr')) {
|
|
75
|
+
return [node];
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(node)) {
|
|
78
|
+
return node.flatMap(collectRowElements);
|
|
79
|
+
}
|
|
80
|
+
if (isValidElement(node)) {
|
|
81
|
+
return collectRowElements(node.props.children);
|
|
82
|
+
}
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
function parseRow(row) {
|
|
86
|
+
return getElementChildren(row)
|
|
87
|
+
.filter(isValidElement)
|
|
88
|
+
.map((cell) => {
|
|
89
|
+
const rawText = normalizeText(collectText(cell.props.children));
|
|
90
|
+
return Object.assign({ rawText }, parseCheetCell(rawText));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function parseCheetTable(children) {
|
|
94
|
+
var _a;
|
|
95
|
+
const rows = collectRowElements(children);
|
|
96
|
+
if (rows.length > 0) {
|
|
97
|
+
const headerRow = rows[0];
|
|
98
|
+
const dataRows = rows.slice(1);
|
|
99
|
+
const headers = parseRow(headerRow);
|
|
100
|
+
if (headers.length === 0) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
headers,
|
|
105
|
+
rows: dataRows.map(parseRow).filter((row) => row.length > 0),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const table = findFirstElement(children, 'table');
|
|
109
|
+
if (!table) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const thead = findFirstElement(table.props.children, 'thead');
|
|
113
|
+
const tbody = findFirstElement(table.props.children, 'tbody');
|
|
114
|
+
const headRows = thead ? collectRowElements(thead.props.children) : [];
|
|
115
|
+
const bodyRows = tbody ? collectRowElements(tbody.props.children) : [];
|
|
116
|
+
const fallbackRows = !thead && !tbody ? collectRowElements(table.props.children) : [];
|
|
117
|
+
const headerRow = (_a = headRows[0]) !== null && _a !== void 0 ? _a : fallbackRows[0];
|
|
118
|
+
const dataRows = bodyRows.length > 0 ? bodyRows : fallbackRows.slice(1);
|
|
119
|
+
if (!headerRow) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const headers = parseRow(headerRow);
|
|
123
|
+
if (headers.length === 0) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
headers,
|
|
128
|
+
rows: dataRows.map(parseRow).filter((row) => row.length > 0),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function parseCheetTableElement(element) {
|
|
132
|
+
const table = element === null || element === void 0 ? void 0 : element.querySelector('table');
|
|
133
|
+
if (!table) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const headRow = table.querySelector('thead tr');
|
|
137
|
+
const bodyRows = Array.from(table.querySelectorAll('tbody tr'));
|
|
138
|
+
const fallbackRows = Array.from(table.querySelectorAll('tr'));
|
|
139
|
+
const headerRow = headRow !== null && headRow !== void 0 ? headRow : fallbackRows[0];
|
|
140
|
+
const dataRows = bodyRows.length > 0
|
|
141
|
+
? bodyRows
|
|
142
|
+
: fallbackRows.slice(headerRow ? 1 : 0);
|
|
143
|
+
if (!headerRow) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
const parseDomRow = (row) => Array.from(row.querySelectorAll('th,td')).map((cell) => {
|
|
147
|
+
var _a;
|
|
148
|
+
const rawText = normalizeText((_a = cell.textContent) !== null && _a !== void 0 ? _a : '');
|
|
149
|
+
return Object.assign({ rawText }, parseCheetCell(rawText));
|
|
150
|
+
});
|
|
151
|
+
const headers = parseDomRow(headerRow);
|
|
152
|
+
if (headers.length === 0) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
headers,
|
|
157
|
+
rows: dataRows.map(parseDomRow).filter((row) => row.length > 0),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function createCopyableColumnSet(headers, copyableColumns) {
|
|
161
|
+
const names = copyableColumns !== null && copyableColumns !== void 0 ? copyableColumns : [];
|
|
162
|
+
return new Set(names.map((name) => {
|
|
163
|
+
const header = headers.find((item) => item.text === name || item.rawText === name);
|
|
164
|
+
return header ? header.text : name;
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
function CheetCellContent({ cell, force, copied, copyable, onCopy, }) {
|
|
168
|
+
return (jsxs("span", { className: "flex min-w-0 items-center gap-0.5", children: [jsx("span", { className: cn('block min-w-0 truncate', force && cn('font-semibold', themeIconColor)), children: cell.text }), cell.description ? (jsx(InfoTooltip, { content: cell.description, className: "not-prose -mx-0.5", desktopSide: "bottom" })) : null, copyable ? (jsx("button", { type: "button", "aria-label": copied ? 'Copied' : 'Copy cell content', className: cn('not-prose inline-flex size-6 shrink-0 touch-manipulation items-center justify-center rounded text-fd-muted-foreground transition', 'hover:bg-fd-accent hover:text-fd-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-slate-950', copied && themeIconColor, themeRingColor), onClick: (event) => {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
event.stopPropagation();
|
|
171
|
+
onCopy === null || onCopy === void 0 ? void 0 : onCopy();
|
|
172
|
+
}, onPointerDown: (event) => {
|
|
173
|
+
event.stopPropagation();
|
|
174
|
+
}, children: copied ? jsx(CheckIcon, { className: "size-3.5" }) : jsx(CopyIcon, { className: "size-3.5" }) })) : null] }));
|
|
175
|
+
}
|
|
176
|
+
function CheetTable(_a) {
|
|
177
|
+
var _b;
|
|
178
|
+
var { title, description, copyableColumns, defaultOpen = true, collapsible = true, striped = true, stickyHeader = false, emptyText = 'No data', className, children, style } = _a, props = __rest(_a, ["title", "description", "copyableColumns", "defaultOpen", "collapsible", "striped", "stickyHeader", "emptyText", "className", "children", "style"]);
|
|
179
|
+
const [mounted, setMounted] = useState(false);
|
|
180
|
+
const [model, setModel] = useState(null);
|
|
181
|
+
const [parsed, setParsed] = useState(false);
|
|
182
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
183
|
+
const [copiedCell, setCopiedCell] = useState(null);
|
|
184
|
+
const [columnWidths, setColumnWidths] = useState([]);
|
|
185
|
+
const sourceRef = useRef(null);
|
|
186
|
+
const resizeStartRef = useRef(null);
|
|
187
|
+
const headerCount = (_b = model === null || model === void 0 ? void 0 : model.headers.length) !== null && _b !== void 0 ? _b : 0;
|
|
188
|
+
const copyableColumnSet = useMemo(() => { var _a; return createCopyableColumnSet((_a = model === null || model === void 0 ? void 0 : model.headers) !== null && _a !== void 0 ? _a : [], copyableColumns); }, [copyableColumns, model === null || model === void 0 ? void 0 : model.headers]);
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
var _a;
|
|
191
|
+
setMounted(true);
|
|
192
|
+
setModel((_a = parseCheetTableElement(sourceRef.current)) !== null && _a !== void 0 ? _a : parseCheetTable(children));
|
|
193
|
+
setParsed(true);
|
|
194
|
+
}, [children]);
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
if (headerCount === 0) {
|
|
197
|
+
setColumnWidths([]);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
setColumnWidths((current) => Array.from({ length: headerCount }, (_, index) => { var _a; return Math.max((_a = current[index]) !== null && _a !== void 0 ? _a : DEFAULT_COLUMN_WIDTH, MIN_COLUMN_WIDTH); }));
|
|
201
|
+
}, [headerCount]);
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
function handlePointerMove(event) {
|
|
204
|
+
const start = resizeStartRef.current;
|
|
205
|
+
if (!start) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const nextWidth = Math.max(MIN_COLUMN_WIDTH, start.startWidth + event.clientX - start.startX);
|
|
209
|
+
setColumnWidths((current) => {
|
|
210
|
+
const next = [...current];
|
|
211
|
+
next[start.columnIndex] = nextWidth;
|
|
212
|
+
return next;
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function handlePointerUp() {
|
|
216
|
+
resizeStartRef.current = null;
|
|
217
|
+
document.body.style.removeProperty('cursor');
|
|
218
|
+
document.body.style.removeProperty('user-select');
|
|
219
|
+
}
|
|
220
|
+
window.addEventListener('pointermove', handlePointerMove);
|
|
221
|
+
window.addEventListener('pointerup', handlePointerUp);
|
|
222
|
+
return () => {
|
|
223
|
+
window.removeEventListener('pointermove', handlePointerMove);
|
|
224
|
+
window.removeEventListener('pointerup', handlePointerUp);
|
|
225
|
+
document.body.style.removeProperty('cursor');
|
|
226
|
+
document.body.style.removeProperty('user-select');
|
|
227
|
+
};
|
|
228
|
+
}, []);
|
|
229
|
+
const startResize = (event, columnIndex) => {
|
|
230
|
+
var _a;
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
event.stopPropagation();
|
|
233
|
+
resizeStartRef.current = {
|
|
234
|
+
columnIndex,
|
|
235
|
+
startX: event.clientX,
|
|
236
|
+
startWidth: (_a = columnWidths[columnIndex]) !== null && _a !== void 0 ? _a : DEFAULT_COLUMN_WIDTH,
|
|
237
|
+
};
|
|
238
|
+
document.body.style.cursor = 'col-resize';
|
|
239
|
+
document.body.style.userSelect = 'none';
|
|
240
|
+
};
|
|
241
|
+
const handleCopy = (text, cellId) => __awaiter(this, void 0, void 0, function* () {
|
|
242
|
+
if (!text || !navigator.clipboard) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
yield navigator.clipboard.writeText(text);
|
|
247
|
+
setCopiedCell(cellId);
|
|
248
|
+
window.setTimeout(() => setCopiedCell(null), 1200);
|
|
249
|
+
}
|
|
250
|
+
catch (_a) {
|
|
251
|
+
// Keep MDX reading uninterrupted when clipboard permission is unavailable.
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
const shellClassName = cn('not-prose my-6 overflow-hidden rounded-lg border bg-fd-card text-fd-card-foreground shadow-sm', CHEET_TABLE_BORDER_CLASS, className);
|
|
255
|
+
const shellStyle = Object.assign({ '--cheet-table-border-color': CHEET_TABLE_BORDER_COLOR }, style);
|
|
256
|
+
const titleBar = title || description || collapsible ? (jsxs("div", { className: "grid min-w-0 grid-cols-[minmax(0,90%)_minmax(2rem,10%)] items-center bg-fd-muted/35 px-4 py-2", children: [jsxs("div", { className: "flex min-w-0 items-center justify-center gap-0.5", children: [title ? (jsx("h3", { className: "truncate text-center text-sm font-semibold leading-6 text-fd-foreground", children: title })) : null, description ? (jsx(InfoTooltip, { content: description, className: "not-prose -mx-0.5", desktopSide: "bottom" })) : null] }), collapsible ? (jsx("button", { type: "button", className: cn('justify-self-end inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fd-muted-foreground transition', 'hover:text-fd-accent-foreground', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-slate-950', open && themeIconColor, themeRingColor), "aria-expanded": open, onClick: () => setOpen((value) => !value), children: open ? jsx(EyeIcon, { className: "size-4" }) : jsx(EyeOffIcon, { className: "size-4" }) })) : null] })) : null;
|
|
257
|
+
if (!mounted) {
|
|
258
|
+
return (jsxs("section", Object.assign({ "data-cheet-table": true, className: shellClassName, style: shellStyle }, props, { children: [titleBar, jsx("div", { ref: sourceRef, hidden: true, children: children })] })));
|
|
259
|
+
}
|
|
260
|
+
if (!model) {
|
|
261
|
+
return (jsxs("section", Object.assign({ "data-cheet-table": true, className: shellClassName, style: shellStyle }, props, { children: [titleBar, jsx("div", { ref: sourceRef, hidden: true, children: children }), open && parsed ? (jsx("div", { className: "px-4 py-6 text-center text-sm text-fd-muted-foreground", children: emptyText })) : null] })));
|
|
262
|
+
}
|
|
263
|
+
const content = model.rows.length > 0 ? (jsx("div", { className: "overflow-x-auto", children: jsxs("table", { className: "table-fixed border-separate border-spacing-0 text-sm", style: {
|
|
264
|
+
width: columnWidths.length
|
|
265
|
+
? columnWidths.reduce((total, width) => total + width, 0)
|
|
266
|
+
: '100%',
|
|
267
|
+
minWidth: '100%',
|
|
268
|
+
}, children: [jsx("colgroup", { children: model.headers.map((header, index) => {
|
|
269
|
+
var _a;
|
|
270
|
+
return (jsx("col", { style: {
|
|
271
|
+
width: (_a = columnWidths[index]) !== null && _a !== void 0 ? _a : DEFAULT_COLUMN_WIDTH,
|
|
272
|
+
minWidth: MIN_COLUMN_WIDTH,
|
|
273
|
+
} }, `${header.text}-${index}-col`));
|
|
274
|
+
}) }), jsx("thead", { className: cn(stickyHeader && 'sticky top-0 z-10'), children: jsx("tr", { children: model.headers.map((header, index) => (jsxs("th", { className: cn('relative border-t border-b bg-fd-muted/80 px-3 py-2.5 align-middle text-xs font-semibold uppercase tracking-normal text-fd-muted-foreground first:pl-4 last:pr-4', index > 0 && 'border-l', CHEET_TABLE_BORDER_CLASS, 'text-left'), scope: "col", children: [jsx(CheetCellContent, { cell: header, force: header.force }), index < model.headers.length - 1 ? (jsx("button", { type: "button", "aria-label": "Resize column", className: cn('absolute top-0 right-0 h-full w-2 cursor-col-resize touch-none select-none', 'after:absolute after:top-2 after:right-0 after:bottom-2 after:w-px after:bg-transparent after:transition-colors', 'hover:after:bg-fd-muted-foreground/40'), onPointerDown: (event) => startResize(event, index) })) : null] }, `${header.text}-${index}`))) }) }), jsx("tbody", { children: model.rows.map((row, rowIndex) => (jsx("tr", { className: cn('transition-colors hover:bg-fd-accent/45', striped && rowIndex % 2 === 1 && 'bg-fd-muted/30'), children: model.headers.map((header, columnIndex) => {
|
|
275
|
+
var _a;
|
|
276
|
+
const cell = (_a = row[columnIndex]) !== null && _a !== void 0 ? _a : {
|
|
277
|
+
rawText: '',
|
|
278
|
+
text: '',
|
|
279
|
+
force: false,
|
|
280
|
+
};
|
|
281
|
+
const cellId = `${rowIndex}:${columnIndex}`;
|
|
282
|
+
const copyable = copyableColumnSet.has(header.text);
|
|
283
|
+
return (jsx("td", { className: cn('group px-3 py-2.5 align-top text-fd-foreground first:pl-4 last:pr-4', rowIndex < model.rows.length - 1 && 'border-b', columnIndex > 0 && 'border-l', 'text-left', CHEET_TABLE_BORDER_CLASS), onDoubleClick: (event) => {
|
|
284
|
+
event.preventDefault();
|
|
285
|
+
event.stopPropagation();
|
|
286
|
+
}, children: jsx(CheetCellContent, { cell: cell, force: header.force || cell.force, copyable: copyable, copied: copiedCell === cellId, onCopy: copyable
|
|
287
|
+
? () => handleCopy(cell.text, cellId)
|
|
288
|
+
: undefined }) }, cellId));
|
|
289
|
+
}) }, rowIndex))) })] }) })) : (jsx("div", { className: "px-4 py-6 text-center text-sm text-fd-muted-foreground", children: emptyText }));
|
|
290
|
+
return (jsxs("section", Object.assign({ "data-cheet-table": true, className: shellClassName, style: shellStyle }, props, { children: [titleBar, jsx("div", { ref: sourceRef, hidden: true, children: children }), open ? content : null] })));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export { CheetTable };
|
package/dist/fuma/mdx/index.d.ts
CHANGED
package/dist/fuma/mdx/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var tocFooterWrapper = require('./toc-footer-wrapper.js');
|
|
|
10
10
|
var tocClerkPortable = require('./toc-clerk-portable.js');
|
|
11
11
|
var banner = require('./banner.js');
|
|
12
12
|
var sunoEmbed = require('./suno-embed.js');
|
|
13
|
+
var cheetTable = require('./cheet-table.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
@@ -29,3 +30,4 @@ exports.PortableClerkTOCScrollArea = tocClerkPortable.PortableClerkTOCScrollArea
|
|
|
29
30
|
exports.PortableClerkTOCTitle = tocClerkPortable.PortableClerkTOCTitle;
|
|
30
31
|
exports.Banner = banner.Banner;
|
|
31
32
|
exports.SunoEmbed = sunoEmbed.SunoEmbed;
|
|
33
|
+
exports.CheetTable = cheetTable.CheetTable;
|
package/dist/fuma/mdx/index.mjs
CHANGED
|
@@ -8,3 +8,4 @@ export { TocFooterWrapper } from './toc-footer-wrapper.mjs';
|
|
|
8
8
|
export { PortableClerkTOC, PortableClerkTOCItems, PortableClerkTOCPopover, PortableClerkTOCScrollArea, PortableClerkTOCTitle } from './toc-clerk-portable.mjs';
|
|
9
9
|
export { Banner } from './banner.mjs';
|
|
10
10
|
export { SunoEmbed } from './suno-embed.mjs';
|
|
11
|
+
export { CheetTable } from './cheet-table.mjs';
|
|
@@ -11,6 +11,7 @@ require('@windrun-huaiin/base-ui/lib');
|
|
|
11
11
|
require('@windrun-huaiin/lib/utils');
|
|
12
12
|
var ziaFile = require('../../mdx/zia-file.js');
|
|
13
13
|
var sunoEmbed = require('../../mdx/suno-embed.js');
|
|
14
|
+
var cheetTable = require('../../mdx/cheet-table.js');
|
|
14
15
|
|
|
15
16
|
const ImageGrid = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/image-grid.js'); }).then((mod) => ({ default: mod.ImageGrid })));
|
|
16
17
|
const ImageZoom = React.lazy(() => Promise.resolve().then(function () { return require('../../heavy/image-zoom.js'); }).then((mod) => ({ default: mod.ImageZoom })));
|
|
@@ -22,6 +23,7 @@ function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
|
22
23
|
ZiaFile: ziaFile.ZiaFile,
|
|
23
24
|
ZiaFolder: ziaFile.ZiaFolder,
|
|
24
25
|
SunoEmbed: sunoEmbed.SunoEmbed,
|
|
26
|
+
CheetTable: cheetTable.CheetTable,
|
|
25
27
|
ImageGrid: (props) => (jsxRuntime.jsx(ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
26
28
|
ImageZoom: (props) => (jsxRuntime.jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
27
29
|
};
|
|
@@ -9,6 +9,7 @@ import '@windrun-huaiin/base-ui/lib';
|
|
|
9
9
|
import '@windrun-huaiin/lib/utils';
|
|
10
10
|
import { ZiaFolder, ZiaFile } from '../../mdx/zia-file.mjs';
|
|
11
11
|
import { SunoEmbed } from '../../mdx/suno-embed.mjs';
|
|
12
|
+
import { CheetTable } from '../../mdx/cheet-table.mjs';
|
|
12
13
|
|
|
13
14
|
const ImageGrid = lazy(() => import('../../heavy/image-grid.mjs').then((mod) => ({ default: mod.ImageGrid })));
|
|
14
15
|
const ImageZoom = lazy(() => import('../../heavy/image-zoom.mjs').then((mod) => ({ default: mod.ImageZoom })));
|
|
@@ -20,6 +21,7 @@ function createWidgetMdxComponents(cdnBaseUrl, imageFallbackSrc) {
|
|
|
20
21
|
ZiaFile,
|
|
21
22
|
ZiaFolder,
|
|
22
23
|
SunoEmbed,
|
|
24
|
+
CheetTable,
|
|
23
25
|
ImageGrid: (props) => (jsx(ImageGrid, Object.assign({}, props, { cdnBaseUrl: cdnBaseUrl }))),
|
|
24
26
|
ImageZoom: (props) => (jsx(ImageZoom, Object.assign({}, props, { fallbackSrc: imageFallbackSrc }))),
|
|
25
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodObject } from 'zod';
|
|
2
|
-
export declare const createDateSchema: () => z.
|
|
2
|
+
export declare const createDateSchema: () => z.ZodPreprocess<z.ZodString>;
|
|
3
3
|
export declare const createCommonDocsSchema: () => ZodObject<any>;
|
|
4
4
|
export declare const createCommonMetaSchema: () => ZodObject<any>;
|
|
5
5
|
export declare const remarkInstallOptions: {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SupportedThemeColor } from '@windrun-huaiin/base-ui/lib';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
interface NotFoundPageProps {
|
|
4
|
+
siteIcon: ReactNode;
|
|
5
|
+
errorIcon?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
compact?: boolean;
|
|
8
|
+
themeClass?: SupportedThemeColor;
|
|
9
|
+
animated?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function NotFoundPage({ siteIcon, errorIcon, className, compact, themeClass, animated, }: NotFoundPageProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var shared = require('@windrun-huaiin/base-ui/components/shared');
|
|
6
|
+
var lib = require('@windrun-huaiin/base-ui/lib');
|
|
7
|
+
var utils = require('@windrun-huaiin/lib/utils');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
|
|
10
|
+
const THEME_BG_CLASS_MAP = {
|
|
11
|
+
'text-purple-500': 'bg-purple-500/20',
|
|
12
|
+
'text-orange-500': 'bg-orange-500/20',
|
|
13
|
+
'text-indigo-500': 'bg-indigo-500/20',
|
|
14
|
+
'text-emerald-500': 'bg-emerald-500/20',
|
|
15
|
+
'text-rose-500': 'bg-rose-500/20',
|
|
16
|
+
};
|
|
17
|
+
const THEME_VIA_CLASS_MAP = {
|
|
18
|
+
'text-purple-500': 'via-purple-500/20',
|
|
19
|
+
'text-orange-500': 'via-orange-500/20',
|
|
20
|
+
'text-indigo-500': 'via-indigo-500/20',
|
|
21
|
+
'text-emerald-500': 'via-emerald-500/20',
|
|
22
|
+
'text-rose-500': 'via-rose-500/20',
|
|
23
|
+
};
|
|
24
|
+
function NotFoundPage({ siteIcon, errorIcon, className, compact = false, themeClass, animated = true, }) {
|
|
25
|
+
const [glitchText, setGlitchText] = React.useState('404');
|
|
26
|
+
const homeUrl = process.env.NEXT_PUBLIC_BASE_URL || '/';
|
|
27
|
+
const activeThemeClass = themeClass !== null && themeClass !== void 0 ? themeClass : lib.themeIconColor;
|
|
28
|
+
const activeGradientClass = themeClass ? lib.THEME_BUTTON_GRADIENT_CLASS_MAP[themeClass] : lib.themeButtonGradientClass;
|
|
29
|
+
const activeBgClass = themeClass ? THEME_BG_CLASS_MAP[themeClass] : lib.themeBgColor;
|
|
30
|
+
const activeViaClass = themeClass ? THEME_VIA_CLASS_MAP[themeClass] : lib.themeViaColor;
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (!animated) {
|
|
33
|
+
setGlitchText('404');
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const glitchChars = ['4', '0', '4', '?', '#', '!', '*', '&', '%', '$'];
|
|
37
|
+
const interval = setInterval(() => {
|
|
38
|
+
if (Math.random() < 0.5) {
|
|
39
|
+
setGlitchText('404');
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const randomChars = Array.from({ length: 3 }, () => glitchChars[Math.floor(Math.random() * glitchChars.length)]).join('');
|
|
43
|
+
setGlitchText(randomChars);
|
|
44
|
+
}
|
|
45
|
+
}, 600);
|
|
46
|
+
return () => clearInterval(interval);
|
|
47
|
+
}, [animated]);
|
|
48
|
+
return (jsxRuntime.jsxs("div", { className: utils.cn('relative flex w-full flex-col items-center justify-center px-4 py-8', compact ? 'h-full min-h-full' : 'min-h-dvh', className), children: [jsxRuntime.jsxs("div", { className: "text-center space-y-8 max-w-2xl", children: [jsxRuntime.jsxs("div", { className: "relative flex justify-center", children: [jsxRuntime.jsx("h1", { className: utils.cn('text-8xl md:text-9xl font-bold bg-linear-to-r bg-clip-text text-transparent select-none', activeGradientClass), style: {
|
|
49
|
+
fontFamily: 'Montserrat, monospace',
|
|
50
|
+
textShadow: '0 0 30px rgba(172, 98, 253, 0.3)',
|
|
51
|
+
letterSpacing: '0.1em',
|
|
52
|
+
}, children: glitchText }), jsxRuntime.jsx("div", { className: "absolute inset-0 pointer-events-none", children: jsxRuntime.jsx("div", { className: utils.cn('h-full w-full bg-linear-to-b from-transparent to-transparent', animated && 'animate-pulse', activeViaClass) }) })] }), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx("h2", { className: "text-2xl md:text-3xl font-semibold text-foreground", children: "Page Not Found" }), jsxRuntime.jsx("p", { className: "text-lg text-muted-foreground max-w-md mx-auto leading-relaxed", children: "The page you're looking for doesn't exist" }), jsxRuntime.jsx("a", { href: homeUrl, className: utils.cn('inline-flex text-sm font-medium underline underline-offset-4 transition-opacity hover:opacity-80', activeThemeClass, 'decoration-current'), children: "Back to Homepage" })] }), jsxRuntime.jsxs("div", { className: "flex justify-center items-center gap-8 pt-8 opacity-60", children: [jsxRuntime.jsxs("a", { href: homeUrl, className: "flex items-center gap-2 text-sm text-muted-foreground transition-opacity hover:opacity-80", children: [siteIcon, jsxRuntime.jsx("span", { children: "Woops!" })] }), jsxRuntime.jsx("div", { className: utils.cn('w-2 h-2 rounded-full', animated && 'animate-ping', activeBgClass) }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [errorIcon !== null && errorIcon !== void 0 ? errorIcon : jsxRuntime.jsx(shared.NotFoundIcon, {}), jsxRuntime.jsx("span", { children: "Error Code: 404" })] })] })] }), jsxRuntime.jsxs("div", { className: utils.cn('pointer-events-none inset-0 overflow-hidden -z-10', compact ? 'absolute' : 'fixed'), children: [jsxRuntime.jsx("div", { className: "absolute inset-0 opacity-[0.02] dark:opacity-[0.05]", style: {
|
|
53
|
+
backgroundImage: `
|
|
54
|
+
linear-gradient(rgba(172, 98, 253, 0.1) 1px, transparent 1px),
|
|
55
|
+
linear-gradient(90deg, rgba(172, 98, 253, 0.1) 1px, transparent 1px)
|
|
56
|
+
`,
|
|
57
|
+
backgroundSize: '50px 50px',
|
|
58
|
+
} }), Array.from({ length: 6 }).map((_, i) => (jsxRuntime.jsx("div", { className: utils.cn('absolute w-2 h-2 rounded-full', animated && 'animate-bounce', activeBgClass), style: {
|
|
59
|
+
left: `${20 + i * 15}%`,
|
|
60
|
+
top: `${30 + (i % 3) * 20}%`,
|
|
61
|
+
animationDelay: `${i * 0.5}s`,
|
|
62
|
+
animationDuration: `${2 + i * 0.3}s`,
|
|
63
|
+
} }, i)))] })] }));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.NotFoundPage = NotFoundPage;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { NotFoundIcon } from '@windrun-huaiin/base-ui/components/shared';
|
|
4
|
+
import { THEME_BUTTON_GRADIENT_CLASS_MAP, themeButtonGradientClass, themeViaColor, themeIconColor, themeBgColor } from '@windrun-huaiin/base-ui/lib';
|
|
5
|
+
import { cn } from '@windrun-huaiin/lib/utils';
|
|
6
|
+
import { useState, useEffect } from 'react';
|
|
7
|
+
|
|
8
|
+
const THEME_BG_CLASS_MAP = {
|
|
9
|
+
'text-purple-500': 'bg-purple-500/20',
|
|
10
|
+
'text-orange-500': 'bg-orange-500/20',
|
|
11
|
+
'text-indigo-500': 'bg-indigo-500/20',
|
|
12
|
+
'text-emerald-500': 'bg-emerald-500/20',
|
|
13
|
+
'text-rose-500': 'bg-rose-500/20',
|
|
14
|
+
};
|
|
15
|
+
const THEME_VIA_CLASS_MAP = {
|
|
16
|
+
'text-purple-500': 'via-purple-500/20',
|
|
17
|
+
'text-orange-500': 'via-orange-500/20',
|
|
18
|
+
'text-indigo-500': 'via-indigo-500/20',
|
|
19
|
+
'text-emerald-500': 'via-emerald-500/20',
|
|
20
|
+
'text-rose-500': 'via-rose-500/20',
|
|
21
|
+
};
|
|
22
|
+
function NotFoundPage({ siteIcon, errorIcon, className, compact = false, themeClass, animated = true, }) {
|
|
23
|
+
const [glitchText, setGlitchText] = useState('404');
|
|
24
|
+
const homeUrl = process.env.NEXT_PUBLIC_BASE_URL || '/';
|
|
25
|
+
const activeThemeClass = themeClass !== null && themeClass !== void 0 ? themeClass : themeIconColor;
|
|
26
|
+
const activeGradientClass = themeClass ? THEME_BUTTON_GRADIENT_CLASS_MAP[themeClass] : themeButtonGradientClass;
|
|
27
|
+
const activeBgClass = themeClass ? THEME_BG_CLASS_MAP[themeClass] : themeBgColor;
|
|
28
|
+
const activeViaClass = themeClass ? THEME_VIA_CLASS_MAP[themeClass] : themeViaColor;
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!animated) {
|
|
31
|
+
setGlitchText('404');
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const glitchChars = ['4', '0', '4', '?', '#', '!', '*', '&', '%', '$'];
|
|
35
|
+
const interval = setInterval(() => {
|
|
36
|
+
if (Math.random() < 0.5) {
|
|
37
|
+
setGlitchText('404');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const randomChars = Array.from({ length: 3 }, () => glitchChars[Math.floor(Math.random() * glitchChars.length)]).join('');
|
|
41
|
+
setGlitchText(randomChars);
|
|
42
|
+
}
|
|
43
|
+
}, 600);
|
|
44
|
+
return () => clearInterval(interval);
|
|
45
|
+
}, [animated]);
|
|
46
|
+
return (jsxs("div", { className: cn('relative flex w-full flex-col items-center justify-center px-4 py-8', compact ? 'h-full min-h-full' : 'min-h-dvh', className), children: [jsxs("div", { className: "text-center space-y-8 max-w-2xl", children: [jsxs("div", { className: "relative flex justify-center", children: [jsx("h1", { className: cn('text-8xl md:text-9xl font-bold bg-linear-to-r bg-clip-text text-transparent select-none', activeGradientClass), style: {
|
|
47
|
+
fontFamily: 'Montserrat, monospace',
|
|
48
|
+
textShadow: '0 0 30px rgba(172, 98, 253, 0.3)',
|
|
49
|
+
letterSpacing: '0.1em',
|
|
50
|
+
}, children: glitchText }), jsx("div", { className: "absolute inset-0 pointer-events-none", children: jsx("div", { className: cn('h-full w-full bg-linear-to-b from-transparent to-transparent', animated && 'animate-pulse', activeViaClass) }) })] }), jsxs("div", { className: "space-y-4", children: [jsx("h2", { className: "text-2xl md:text-3xl font-semibold text-foreground", children: "Page Not Found" }), jsx("p", { className: "text-lg text-muted-foreground max-w-md mx-auto leading-relaxed", children: "The page you're looking for doesn't exist" }), jsx("a", { href: homeUrl, className: cn('inline-flex text-sm font-medium underline underline-offset-4 transition-opacity hover:opacity-80', activeThemeClass, 'decoration-current'), children: "Back to Homepage" })] }), jsxs("div", { className: "flex justify-center items-center gap-8 pt-8 opacity-60", children: [jsxs("a", { href: homeUrl, className: "flex items-center gap-2 text-sm text-muted-foreground transition-opacity hover:opacity-80", children: [siteIcon, jsx("span", { children: "Woops!" })] }), jsx("div", { className: cn('w-2 h-2 rounded-full', animated && 'animate-ping', activeBgClass) }), jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [errorIcon !== null && errorIcon !== void 0 ? errorIcon : jsx(NotFoundIcon, {}), jsx("span", { children: "Error Code: 404" })] })] })] }), jsxs("div", { className: cn('pointer-events-none inset-0 overflow-hidden -z-10', compact ? 'absolute' : 'fixed'), children: [jsx("div", { className: "absolute inset-0 opacity-[0.02] dark:opacity-[0.05]", style: {
|
|
51
|
+
backgroundImage: `
|
|
52
|
+
linear-gradient(rgba(172, 98, 253, 0.1) 1px, transparent 1px),
|
|
53
|
+
linear-gradient(90deg, rgba(172, 98, 253, 0.1) 1px, transparent 1px)
|
|
54
|
+
`,
|
|
55
|
+
backgroundSize: '50px 50px',
|
|
56
|
+
} }), Array.from({ length: 6 }).map((_, i) => (jsx("div", { className: cn('absolute w-2 h-2 rounded-full', animated && 'animate-bounce', activeBgClass), style: {
|
|
57
|
+
left: `${20 + i * 15}%`,
|
|
58
|
+
top: `${30 + (i % 3) * 20}%`,
|
|
59
|
+
animationDelay: `${i * 0.5}s`,
|
|
60
|
+
animationDuration: `${2 + i * 0.3}s`,
|
|
61
|
+
} }, i)))] })] }));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { NotFoundPage };
|
|
@@ -37,7 +37,7 @@ function ConfirmDialog({ open, onOpenChange, type = 'normal', title, description
|
|
|
37
37
|
const handleClose = () => {
|
|
38
38
|
onOpenChange(false);
|
|
39
39
|
};
|
|
40
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ui.AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(ui.AlertDialogContent, { className: utils.cn(dialogStyles.dialogContentClass, typeClass.content), overlayClassName: dialogStyles.dialogThemedOverlayClass, onOverlayClick: handleClose, children: [jsxRuntime.jsxs("div", { className: dialogStyles.dialogHeaderClass, children: [jsxRuntime.jsx(ui.AlertDialogTitle, { asChild: true, children: jsxRuntime.jsxs("div", { className: dialogStyles.dialogTitleClass, children: [jsxRuntime.jsx("span", { className: utils.cn('inline-flex size-9 shrink-0 items-center justify-center rounded-full ring-1', typeClass.iconWrap), children: jsxRuntime.jsx(Icon, { className: utils.cn('size-5', typeClass.icon) }) }), jsxRuntime.jsx("span", { className:
|
|
40
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ui.AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(ui.AlertDialogContent, { className: utils.cn(dialogStyles.dialogContentClass, typeClass.content), overlayClassName: dialogStyles.dialogThemedOverlayClass, onOverlayClick: handleClose, children: [jsxRuntime.jsxs("div", { className: dialogStyles.dialogHeaderClass, children: [jsxRuntime.jsx(ui.AlertDialogTitle, { asChild: true, children: jsxRuntime.jsxs("div", { className: dialogStyles.dialogTitleClass, children: [jsxRuntime.jsx("span", { className: utils.cn('inline-flex size-9 shrink-0 items-center justify-center rounded-full ring-1', typeClass.iconWrap), children: jsxRuntime.jsx(Icon, { className: utils.cn('size-5', typeClass.icon) }) }), jsxRuntime.jsx("span", { className: dialogStyles.dialogTitleTextClass, children: title })] }) }), jsxRuntime.jsx("button", { type: "button", className: dialogStyles.closeButtonClass, onClick: handleClose, "aria-label": "Close", children: jsxRuntime.jsx(icons.XIcon, { className: "size-4" }) })] }), jsxRuntime.jsx(ui.AlertDialogDescription, { className: dialogStyles.dialogDescriptionClass, children: description }), jsxRuntime.jsxs("div", { className: dialogStyles.dialogFooterClass, children: [jsxRuntime.jsx(ui.AlertDialogCancel, { className: cancelButtonClass, onClick: handleCancel, children: cancelText }), jsxRuntime.jsx(ui.AlertDialogAction, { className: confirmButtonClass, onClick: () => {
|
|
41
41
|
void runDialogAction('confirm', onConfirm);
|
|
42
42
|
}, children: confirmText })] })] }) }), dialogLoading] }));
|
|
43
43
|
}
|
|
@@ -4,7 +4,7 @@ import { CircleAlertIcon, CircleQuestionMarkIcon, XIcon } from '@windrun-huaiin/
|
|
|
4
4
|
import { themeBgColor, themeIconColor } from '@windrun-huaiin/base-ui/lib';
|
|
5
5
|
import { AlertDialog, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } from '@windrun-huaiin/base-ui/ui';
|
|
6
6
|
import { cn } from '@windrun-huaiin/lib/utils';
|
|
7
|
-
import { dangerButtonClass, primaryButtonClass, secondaryButtonClass, dialogThemedOverlayClass, dialogHeaderClass, dialogTitleClass, closeButtonClass, dialogDescriptionClass, dialogFooterClass, dialogContentClass } from './dialog-styles.mjs';
|
|
7
|
+
import { dangerButtonClass, primaryButtonClass, secondaryButtonClass, dialogThemedOverlayClass, dialogHeaderClass, dialogTitleClass, dialogTitleTextClass, closeButtonClass, dialogDescriptionClass, dialogFooterClass, dialogContentClass } from './dialog-styles.mjs';
|
|
8
8
|
import { useDialogLoadingAction } from './dialog-loading-action.mjs';
|
|
9
9
|
|
|
10
10
|
const confirmTypeClassMap = {
|
|
@@ -35,7 +35,7 @@ function ConfirmDialog({ open, onOpenChange, type = 'normal', title, description
|
|
|
35
35
|
const handleClose = () => {
|
|
36
36
|
onOpenChange(false);
|
|
37
37
|
};
|
|
38
|
-
return (jsxs(Fragment, { children: [jsx(AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxs(AlertDialogContent, { className: cn(dialogContentClass, typeClass.content), overlayClassName: dialogThemedOverlayClass, onOverlayClick: handleClose, children: [jsxs("div", { className: dialogHeaderClass, children: [jsx(AlertDialogTitle, { asChild: true, children: jsxs("div", { className: dialogTitleClass, children: [jsx("span", { className: cn('inline-flex size-9 shrink-0 items-center justify-center rounded-full ring-1', typeClass.iconWrap), children: jsx(Icon, { className: cn('size-5', typeClass.icon) }) }), jsx("span", { className:
|
|
38
|
+
return (jsxs(Fragment, { children: [jsx(AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxs(AlertDialogContent, { className: cn(dialogContentClass, typeClass.content), overlayClassName: dialogThemedOverlayClass, onOverlayClick: handleClose, children: [jsxs("div", { className: dialogHeaderClass, children: [jsx(AlertDialogTitle, { asChild: true, children: jsxs("div", { className: dialogTitleClass, children: [jsx("span", { className: cn('inline-flex size-9 shrink-0 items-center justify-center rounded-full ring-1', typeClass.iconWrap), children: jsx(Icon, { className: cn('size-5', typeClass.icon) }) }), jsx("span", { className: dialogTitleTextClass, children: title })] }) }), jsx("button", { type: "button", className: closeButtonClass, onClick: handleClose, "aria-label": "Close", children: jsx(XIcon, { className: "size-4" }) })] }), jsx(AlertDialogDescription, { className: dialogDescriptionClass, children: description }), jsxs("div", { className: dialogFooterClass, children: [jsx(AlertDialogCancel, { className: cancelButtonClass, onClick: handleCancel, children: cancelText }), jsx(AlertDialogAction, { className: confirmButtonClass, onClick: () => {
|
|
39
39
|
void runDialogAction('confirm', onConfirm);
|
|
40
40
|
}, children: confirmText })] })] }) }), dialogLoading] }));
|
|
41
41
|
}
|
|
@@ -6,6 +6,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactDom = require('react-dom');
|
|
8
8
|
var loading = require('../loading.js');
|
|
9
|
+
var dialogStyles = require('./dialog-styles.js');
|
|
9
10
|
|
|
10
11
|
function useDialogLoadingAction({ loadingActions, loadingFullPage = false, onOpenChange, }) {
|
|
11
12
|
const [mounted, setMounted] = React.useState(false);
|
|
@@ -14,15 +15,17 @@ function useDialogLoadingAction({ loadingActions, loadingFullPage = false, onOpe
|
|
|
14
15
|
setMounted(true);
|
|
15
16
|
}, []);
|
|
16
17
|
const runDialogAction = React.useCallback((action, handler) => tslib.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
onOpenChange(false);
|
|
18
18
|
if (!handler) {
|
|
19
|
+
onOpenChange(false);
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
22
|
if (!(loadingActions === null || loadingActions === void 0 ? void 0 : loadingActions.includes(action))) {
|
|
23
|
+
onOpenChange(false);
|
|
22
24
|
yield handler();
|
|
23
25
|
return;
|
|
24
26
|
}
|
|
25
27
|
setLoading(true);
|
|
28
|
+
onOpenChange(false);
|
|
26
29
|
try {
|
|
27
30
|
yield handler();
|
|
28
31
|
}
|
|
@@ -31,7 +34,7 @@ function useDialogLoadingAction({ loadingActions, loadingFullPage = false, onOpe
|
|
|
31
34
|
}
|
|
32
35
|
}), [loadingActions, onOpenChange]);
|
|
33
36
|
const dialogLoading = mounted && loading$1
|
|
34
|
-
? reactDom.createPortal(loadingFullPage ? (jsxRuntime.jsx("div", { className: "fixed inset-0 z-10000", children: jsxRuntime.jsx(loading.Loading, { className: "h-full w-full" }) })) : (jsxRuntime.jsx("div", { className: "
|
|
37
|
+
? reactDom.createPortal(loadingFullPage ? (jsxRuntime.jsx("div", { className: "fixed inset-0 z-10000", children: jsxRuntime.jsx(loading.Loading, { className: "h-full w-full" }) })) : (jsxRuntime.jsx("div", { className: "fixed inset-0 z-10000", children: jsxRuntime.jsx("div", { className: dialogStyles.dialogLoadingContentClass, children: jsxRuntime.jsx(loading.Loading, { compact: true, label: "Loading", className: "min-h-[220px] w-fit max-w-full rounded-none bg-transparent px-0 py-0 dark:bg-transparent", labelClassName: "text-foreground" }) }) })), document.body)
|
|
35
38
|
: null;
|
|
36
39
|
return {
|
|
37
40
|
dialogLoading,
|
|
@@ -4,6 +4,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
import { Loading } from '../loading.mjs';
|
|
7
|
+
import { dialogLoadingContentClass } from './dialog-styles.mjs';
|
|
7
8
|
|
|
8
9
|
function useDialogLoadingAction({ loadingActions, loadingFullPage = false, onOpenChange, }) {
|
|
9
10
|
const [mounted, setMounted] = React__default.useState(false);
|
|
@@ -12,15 +13,17 @@ function useDialogLoadingAction({ loadingActions, loadingFullPage = false, onOpe
|
|
|
12
13
|
setMounted(true);
|
|
13
14
|
}, []);
|
|
14
15
|
const runDialogAction = React__default.useCallback((action, handler) => __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
onOpenChange(false);
|
|
16
16
|
if (!handler) {
|
|
17
|
+
onOpenChange(false);
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
20
|
if (!(loadingActions === null || loadingActions === void 0 ? void 0 : loadingActions.includes(action))) {
|
|
21
|
+
onOpenChange(false);
|
|
20
22
|
yield handler();
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
25
|
setLoading(true);
|
|
26
|
+
onOpenChange(false);
|
|
24
27
|
try {
|
|
25
28
|
yield handler();
|
|
26
29
|
}
|
|
@@ -29,7 +32,7 @@ function useDialogLoadingAction({ loadingActions, loadingFullPage = false, onOpe
|
|
|
29
32
|
}
|
|
30
33
|
}), [loadingActions, onOpenChange]);
|
|
31
34
|
const dialogLoading = mounted && loading
|
|
32
|
-
? createPortal(loadingFullPage ? (jsx("div", { className: "fixed inset-0 z-10000", children: jsx(Loading, { className: "h-full w-full" }) })) : (jsx("div", { className: "
|
|
35
|
+
? createPortal(loadingFullPage ? (jsx("div", { className: "fixed inset-0 z-10000", children: jsx(Loading, { className: "h-full w-full" }) })) : (jsx("div", { className: "fixed inset-0 z-10000", children: jsx("div", { className: dialogLoadingContentClass, children: jsx(Loading, { compact: true, label: "Loading", className: "min-h-[220px] w-fit max-w-full rounded-none bg-transparent px-0 py-0 dark:bg-transparent", labelClassName: "text-foreground" }) }) })), document.body)
|
|
33
36
|
: null;
|
|
34
37
|
return {
|
|
35
38
|
dialogLoading,
|