@kyro-cms/admin 0.12.7 → 0.12.9
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/index.cjs +23 -23
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +18 -18
- package/package.json +6 -5
- package/src/components/AuthBridge.tsx +2 -2
- package/src/components/AutoForm.tsx +14 -12
- package/src/components/BrandingHub.tsx +1 -1
- package/src/components/DetailView.tsx +5 -3
- package/src/components/ListView.tsx +15 -5
- package/src/components/MediaGallery.tsx +1 -1
- package/src/components/PluginsManager.tsx +2 -1
- package/src/components/UserMenu.tsx +10 -9
- package/src/components/autoform/AutoFormApiView.tsx +1 -1
- package/src/components/autoform/AutoFormHeader.tsx +1 -1
- package/src/components/autoform/ErrorBoundary.tsx +1 -1
- package/src/components/fields/IconField.tsx +1 -1
- package/src/components/ui/Button.tsx +5 -2
- package/src/components/users/UserDetail.tsx +7 -7
- package/src/components/users/UserForm.tsx +3 -2
- package/src/components/users/UsersList.tsx +5 -4
- package/src/env.d.ts +4 -0
- package/src/hooks/useQueue.ts +3 -2
- package/src/kyro-cms.d.ts +5 -0
- package/src/lib/autoform-store.ts +4 -3
- package/src/lib/normalize-upload-fields.ts +17 -4
- package/src/pages/[collection]/index.astro +1 -1
- package/src/pages/users/index.astro +1 -1
- package/src/plugins/seo-admin.tsx +1 -1
- package/src/components/fix_imports.cjs +0 -23
- package/src/components/fix_imports2.cjs +0 -19
- package/src/components/replace_svgs.cjs +0 -63
|
@@ -32,7 +32,7 @@ if (!isSettings) {
|
|
|
32
32
|
|
|
33
33
|
try {
|
|
34
34
|
const response = await fetch(
|
|
35
|
-
`${Astro.url.origin}${apiPath}/${collection}?page=${page}&limit=${limit}&t=${Date.now()}`,
|
|
35
|
+
`${Astro.url.origin}${apiPath}/${collection}?page=${page}&limit=${limit}&depth=1&t=${Date.now()}`,
|
|
36
36
|
{
|
|
37
37
|
headers: Astro.request.headers,
|
|
38
38
|
credentials: "include",
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
|
|
3
|
-
const addImport = (file, icons, relativePath) => {
|
|
4
|
-
let content = fs.readFileSync(file, 'utf8');
|
|
5
|
-
if (!content.includes('from "' + relativePath + '"')) {
|
|
6
|
-
const importStatement = `import { ${icons.join(', ')} } from "${relativePath}";\n`;
|
|
7
|
-
content = importStatement + content;
|
|
8
|
-
fs.writeFileSync(file, content);
|
|
9
|
-
} else {
|
|
10
|
-
// If it exists, we might need to append to the existing import.
|
|
11
|
-
// To be safe and simple, let's just add a new line. TS merges imports.
|
|
12
|
-
const importStatement = `import { ${icons.join(', ')} } from "${relativePath}";\n`;
|
|
13
|
-
content = importStatement + content;
|
|
14
|
-
fs.writeFileSync(file, content);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/MediaGallery.tsx', ['Search', 'Check', 'Server'], './ui/icons');
|
|
19
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/ui/Modal.tsx', ['X'], './icons');
|
|
20
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/ui/PromptModal.tsx', ['X'], './icons');
|
|
21
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/ui/SlidePanel.tsx', ['X'], './icons');
|
|
22
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/users/UsersList.tsx', ['Plus', 'Lock', 'CheckCircle2', 'Edit2', 'Trash2', 'XCircle', 'X'], '../ui/icons');
|
|
23
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
|
|
3
|
-
const addImport = (file, icons, relativePath) => {
|
|
4
|
-
let content = fs.readFileSync(file, 'utf8');
|
|
5
|
-
if (!content.includes('from "' + relativePath + '"')) {
|
|
6
|
-
const importStatement = `import { ${icons.join(', ')} } from "${relativePath}";\n`;
|
|
7
|
-
content = importStatement + content;
|
|
8
|
-
fs.writeFileSync(file, content);
|
|
9
|
-
} else {
|
|
10
|
-
const importStatement = `import { ${icons.join(', ')} } from "${relativePath}";\n`;
|
|
11
|
-
content = importStatement + content;
|
|
12
|
-
fs.writeFileSync(file, content);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/AuditLogsPage.tsx', ['Search'], './ui/icons');
|
|
17
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/AutoForm.tsx', ['ChevronRight', 'Check', 'ExternalLink', 'X'], './ui/icons');
|
|
18
|
-
addImport('/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components/ListView.tsx', ['Search', 'Filter', 'Columns3', 'X', 'Trash2', 'Archive', 'ChevronUp', 'Edit2'], './ui/icons');
|
|
19
|
-
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const dir = '/Users/macbook/Dev/Web/Astro/kyro-cms/admin/src/components';
|
|
5
|
-
const getFiles = (dir) => {
|
|
6
|
-
const dirents = fs.readdirSync(dir, { withFileTypes: true });
|
|
7
|
-
const files = dirents.map((dirent) => {
|
|
8
|
-
const res = path.resolve(dir, dirent.name);
|
|
9
|
-
return dirent.isDirectory() ? getFiles(res) : res;
|
|
10
|
-
});
|
|
11
|
-
return Array.prototype.concat(...files).filter(f => f.endsWith('.tsx'));
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const files = getFiles(dir);
|
|
15
|
-
|
|
16
|
-
const replacements = [
|
|
17
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M12 4v16m8-8H4"[^>]*\/>\s*<\/svg>/g, replace: '<Plus className="w-4 h-4" />', icon: 'Plus' },
|
|
18
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"[^>]*\/>\s*<\/svg>/g, replace: '<Upload className="w-4 h-4" />', icon: 'Upload' },
|
|
19
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"[^>]*\/>\s*<\/svg>/g, replace: '<Copy className="w-4 h-4" />', icon: 'Copy' },
|
|
20
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M19 7l-\.867 12\.142A2 2 0 0116\.138 21H7\.862a2 2 0 01-1\.995-1\.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"[^>]*\/>\s*<\/svg>/g, replace: '<Trash2 className="w-4 h-4" />', icon: 'Trash2' },
|
|
21
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z"[^>]*\/>\s*<\/svg>/g, replace: '<Lock className="w-4 h-4" />', icon: 'Lock' },
|
|
22
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M10 18a8 8 0 100-16 8 8 0 000 16zm3\.707-9\.293a1 1 0 00-1\.414-1\.414L9 10\.586 7\.707 9\.293a1 1 0 00-1\.414 1\.414l2 2a1 1 0 001\.414 0l4-4z"[^>]*\/>\s*<\/svg>/g, replace: '<CheckCircle2 className="w-4 h-4" />', icon: 'CheckCircle2' },
|
|
23
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1\.414-9\.414a2 2 0 112\.828 2\.828L11\.828 15H9v-2\.828l8\.586-8\.586z"[^>]*\/>\s*<\/svg>/g, replace: '<Edit2 className="w-4 h-4" />', icon: 'Edit2' },
|
|
24
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M10 18a8 8 0 100-16 8 8 0 000 16zM8\.707 7\.293a1 1 0 00-1\.414 1\.414L8\.586 10l-1\.293 1\.293a1 1 0 101\.414 1\.414L10 11\.414l1\.293 1\.293a1 1 0 001\.414-1\.414L11\.414 10l1\.293-1\.293a1 1 0 00-1\.414-1\.414L10 8\.586 8\.707 7\.293z"[^>]*\/>\s*<\/svg>/g, replace: '<XCircle className="w-4 h-4" />', icon: 'XCircle' },
|
|
25
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M6 18L18 6M6 6l12 12"[^>]*\/>\s*<\/svg>/g, replace: '<X className="w-4 h-4" />', icon: 'X' },
|
|
26
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"[^>]*\/>\s*<\/svg>/g, replace: '<Search className="w-4 h-4" />', icon: 'Search' },
|
|
27
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M5 13l4 4L19 7"[^>]*\/>\s*<\/svg>/g, replace: '<Check className="w-4 h-4" />', icon: 'Check' },
|
|
28
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2\.586a1 1 0 01-\.293\.707l-6\.414 6\.414a1 1 0 00-\.293\.707V17l-4 4v-6\.586a1 1 0 00-\.293-\.707L3\.293 7\.293A1 1 0 013 6\.586V4z"[^>]*\/>\s*<\/svg>/g, replace: '<Filter className="w-4 h-4" />', icon: 'Filter' },
|
|
29
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"[^>]*\/>\s*<\/svg>/g, replace: '<Columns3 className="w-4 h-4" />', icon: 'Columns3' },
|
|
30
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M12 5v14M5 12h14"[^>]*\/>\s*<\/svg>/g, replace: '<Plus className="w-4 h-4" />', icon: 'Plus' },
|
|
31
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"[^>]*\/>\s*<\/svg>/g, replace: '<Archive className="w-4 h-4" />', icon: 'Archive' },
|
|
32
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M5 15l7-7 7 7"[^>]*\/>\s*<\/svg>/g, replace: '<ChevronUp className="w-4 h-4" />', icon: 'ChevronUp' },
|
|
33
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M15 19l-7-7 7-7"[^>]*\/>\s*<\/svg>/g, replace: '<ChevronRight className="w-4 h-4" />', icon: 'ChevronRight' },
|
|
34
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M20 6L9 17l-5-5"[^>]*\/>\s*<\/svg>/g, replace: '<Check className="w-4 h-4" />', icon: 'Check' },
|
|
35
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3"[^>]*\/>\s*<\/svg>/g, replace: '<ExternalLink className="w-4 h-4" />', icon: 'ExternalLink' },
|
|
36
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"[^>]*\/>\s*<\/svg>/g, replace: '<File className="w-4 h-4" />', icon: 'File' },
|
|
37
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"[^>]*\/>\s*<\/svg>/g, replace: '<Clipboard className="w-4 h-4" />', icon: 'Clipboard' },
|
|
38
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M18 6L6 18M6 6l12 12"[^>]*\/>\s*<\/svg>/g, replace: '<X className="w-4 h-4" />', icon: 'X' },
|
|
39
|
-
{ match: /<svg[^>]*>\s*<path[^>]*d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2H5a2 2 0 00-2 2v1m2 2a2 2 0 11-4 0 2 2 0 014 0zm2 2h\.008v\.008H5v-\.008z"[^>]*\/>\s*<\/svg>/g, replace: '<Server className="w-8 h-8 text-[var(--kyro-sidebar-text-active)]" />', icon: 'Server' }
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const results = {};
|
|
43
|
-
|
|
44
|
-
for (const file of files) {
|
|
45
|
-
let content = fs.readFileSync(file, 'utf8');
|
|
46
|
-
let changed = false;
|
|
47
|
-
let addedIcons = new Set();
|
|
48
|
-
|
|
49
|
-
for (const r of replacements) {
|
|
50
|
-
if (content.match(r.match)) {
|
|
51
|
-
content = content.replace(r.match, r.replace);
|
|
52
|
-
addedIcons.add(r.icon);
|
|
53
|
-
changed = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (changed) {
|
|
58
|
-
results[file] = Array.from(addedIcons);
|
|
59
|
-
fs.writeFileSync(file, content);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
console.log(JSON.stringify(results, null, 2));
|