@aphexcms/cms-core 0.1.17 → 0.2.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/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +7 -1
- package/dist/api/types.d.ts +2 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/cli/generate-types.js +59 -16
- package/dist/cli/index.js +1 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -1
- package/dist/components/AdminApp.svelte +278 -45
- package/dist/components/AdminApp.svelte.d.ts +2 -0
- package/dist/components/AdminApp.svelte.d.ts.map +1 -1
- package/dist/components/admin/DocumentEditor.svelte +60 -13
- package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
- package/dist/components/admin/ObjectModal.svelte +15 -4
- package/dist/components/admin/ObjectModal.svelte.d.ts +1 -0
- package/dist/components/admin/ObjectModal.svelte.d.ts.map +1 -1
- package/dist/components/admin/SchemaField.svelte +64 -5
- package/dist/components/admin/SchemaField.svelte.d.ts +1 -0
- package/dist/components/admin/SchemaField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/ArrayField.svelte +72 -17
- package/dist/components/admin/fields/ArrayField.svelte.d.ts +1 -0
- package/dist/components/admin/fields/ArrayField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/DateField.svelte +145 -0
- package/dist/components/admin/fields/DateField.svelte.d.ts +14 -0
- package/dist/components/admin/fields/DateField.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/DateTimeField.svelte +225 -0
- package/dist/components/admin/fields/DateTimeField.svelte.d.ts +14 -0
- package/dist/components/admin/fields/DateTimeField.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/ImageField.svelte +20 -7
- package/dist/components/admin/fields/ImageField.svelte.d.ts +1 -0
- package/dist/components/admin/fields/ImageField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/ReferenceField.svelte +1 -1
- package/dist/components/admin/fields/SlugField.svelte +1 -3
- package/dist/components/admin/fields/SlugField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/StringField.svelte +156 -12
- package/dist/components/admin/fields/StringField.svelte.d.ts +3 -2
- package/dist/components/admin/fields/StringField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/URLField.svelte +41 -0
- package/dist/components/admin/fields/URLField.svelte.d.ts +14 -0
- package/dist/components/admin/fields/URLField.svelte.d.ts.map +1 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/db/interfaces/document.d.ts +0 -2
- package/dist/db/interfaces/document.d.ts.map +1 -1
- package/dist/db/interfaces/index.d.ts +2 -1
- package/dist/db/interfaces/index.d.ts.map +1 -1
- package/dist/db/interfaces/user.d.ts +2 -0
- package/dist/db/interfaces/user.d.ts.map +1 -1
- package/dist/db/utils/reference-resolver.js +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +3 -0
- package/dist/field-validation/date-utils.d.ts +30 -0
- package/dist/field-validation/date-utils.d.ts.map +1 -0
- package/dist/field-validation/date-utils.js +147 -0
- package/dist/field-validation/rule.d.ts +4 -0
- package/dist/field-validation/rule.d.ts.map +1 -1
- package/dist/field-validation/rule.js +170 -4
- package/dist/field-validation/utils.d.ts +7 -3
- package/dist/field-validation/utils.d.ts.map +1 -1
- package/dist/field-validation/utils.js +129 -35
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +38 -21
- package/dist/lib/field-validation/date-utils.js +147 -0
- package/dist/lib/field-validation/rule.js +170 -4
- package/dist/lib/field-validation/utils.js +129 -35
- package/dist/local-api/collection-api.d.ts +16 -4
- package/dist/local-api/collection-api.d.ts.map +1 -1
- package/dist/local-api/collection-api.js +51 -17
- package/dist/local-api/index.d.ts +1 -1
- package/dist/local-api/index.d.ts.map +1 -1
- package/dist/routes/assets-cdn.d.ts.map +1 -1
- package/dist/routes/assets-cdn.js +14 -7
- package/dist/routes/assets.d.ts.map +1 -1
- package/dist/routes/assets.js +6 -1
- package/dist/routes/documents-by-id.d.ts.map +1 -1
- package/dist/routes/documents-by-id.js +18 -7
- package/dist/routes/documents-publish.js +2 -2
- package/dist/routes/documents-query.d.ts +3 -1
- package/dist/routes/documents-query.d.ts.map +1 -1
- package/dist/routes/documents-query.js +6 -2
- package/dist/routes/documents.d.ts.map +1 -1
- package/dist/routes/documents.js +20 -4
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +2 -0
- package/dist/routes/user-preferences.d.ts +4 -0
- package/dist/routes/user-preferences.d.ts.map +1 -0
- package/dist/routes/user-preferences.js +77 -0
- package/dist/schema-utils/utils.d.ts +4 -0
- package/dist/schema-utils/utils.d.ts.map +1 -1
- package/dist/schema-utils/utils.js +23 -2
- package/dist/schema-utils/validator.d.ts +4 -0
- package/dist/schema-utils/validator.d.ts.map +1 -1
- package/dist/schema-utils/validator.js +120 -0
- package/dist/types/filters.d.ts +13 -0
- package/dist/types/filters.d.ts.map +1 -1
- package/dist/types/organization.d.ts +3 -0
- package/dist/types/organization.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +67 -7
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/utils/default-orderings.d.ts +10 -0
- package/dist/utils/default-orderings.d.ts.map +1 -0
- package/dist/utils/default-orderings.js +63 -0
- package/dist/utils/field-defaults.d.ts +8 -0
- package/dist/utils/field-defaults.d.ts.map +1 -0
- package/dist/utils/field-defaults.js +20 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/initial-value-helpers.d.ts +50 -0
- package/dist/utils/initial-value-helpers.d.ts.map +1 -0
- package/dist/utils/initial-value-helpers.js +70 -0
- package/package.json +6 -4
- package/dist/components/admin/DocumentTypesList.svelte +0 -97
- package/dist/components/admin/DocumentTypesList.svelte.d.ts +0 -14
- package/dist/components/admin/DocumentTypesList.svelte.d.ts.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Ordering, SchemaType } from '../types/schemas.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generate default orderings for a schema following Sanity's heuristics:
|
|
4
|
+
* 1. If the schema has custom orderings defined, use those
|
|
5
|
+
* 2. Otherwise, look for common title-like fields (title, name, label, etc.)
|
|
6
|
+
* 3. If no common fields, generate orderings for all primitive fields
|
|
7
|
+
* 4. Always include createdAt and updatedAt meta fields
|
|
8
|
+
*/
|
|
9
|
+
export declare function getOrderingsForSchema(schema: SchemaType): Ordering[];
|
|
10
|
+
//# sourceMappingURL=default-orderings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-orderings.d.ts","sourceRoot":"","sources":["../../src/lib/utils/default-orderings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,EAAE,CAuEpE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate default orderings for a schema following Sanity's heuristics:
|
|
3
|
+
* 1. If the schema has custom orderings defined, use those
|
|
4
|
+
* 2. Otherwise, look for common title-like fields (title, name, label, etc.)
|
|
5
|
+
* 3. If no common fields, generate orderings for all primitive fields
|
|
6
|
+
* 4. Always include createdAt and updatedAt meta fields
|
|
7
|
+
*/
|
|
8
|
+
export function getOrderingsForSchema(schema) {
|
|
9
|
+
// If custom orderings are defined, use those
|
|
10
|
+
if (schema.orderings && schema.orderings.length > 0) {
|
|
11
|
+
return schema.orderings;
|
|
12
|
+
}
|
|
13
|
+
// Generate default orderings
|
|
14
|
+
const orderings = [];
|
|
15
|
+
// Priority 1: Use preview.select.title if defined
|
|
16
|
+
let titleField = schema.fields.find((field) => schema.preview?.select?.title &&
|
|
17
|
+
field.name === schema.preview.select.title &&
|
|
18
|
+
field.type === 'string');
|
|
19
|
+
// Priority 2: Common field names in priority order (Sanity's heuristic)
|
|
20
|
+
if (!titleField) {
|
|
21
|
+
const commonTitleFields = [
|
|
22
|
+
'title',
|
|
23
|
+
'name',
|
|
24
|
+
'label',
|
|
25
|
+
'heading',
|
|
26
|
+
'header',
|
|
27
|
+
'caption',
|
|
28
|
+
'description'
|
|
29
|
+
];
|
|
30
|
+
titleField = schema.fields.find((field) => field.type === 'string' && commonTitleFields.includes(field.name));
|
|
31
|
+
}
|
|
32
|
+
if (titleField) {
|
|
33
|
+
// Generate ordering for the single most relevant title field (desc only, UI handles toggle)
|
|
34
|
+
orderings.push({
|
|
35
|
+
title: titleField.title,
|
|
36
|
+
name: `${titleField.name}Desc`,
|
|
37
|
+
by: [{ field: titleField.name, direction: 'desc' }]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// No common fields found, generate for all primitive fields
|
|
42
|
+
const primitiveFields = schema.fields.filter((field) => ['string', 'number', 'boolean', 'date', 'datetime'].includes(field.type));
|
|
43
|
+
primitiveFields.forEach((field) => {
|
|
44
|
+
// Only generate desc version, UI handles toggle to asc
|
|
45
|
+
orderings.push({
|
|
46
|
+
title: field.title,
|
|
47
|
+
name: `${field.name}Desc`,
|
|
48
|
+
by: [{ field: field.name, direction: 'desc' }]
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// Always add meta field orderings at the end (desc only, UI handles toggle)
|
|
53
|
+
orderings.push({
|
|
54
|
+
title: 'Last Edited',
|
|
55
|
+
name: 'updatedAtDesc',
|
|
56
|
+
by: [{ field: 'updatedAt', direction: 'desc' }]
|
|
57
|
+
}, {
|
|
58
|
+
title: 'Created',
|
|
59
|
+
name: 'createdAtDesc',
|
|
60
|
+
by: [{ field: 'createdAt', direction: 'desc' }]
|
|
61
|
+
});
|
|
62
|
+
return orderings;
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FieldType } from '../types/schemas.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the default value for a field type
|
|
4
|
+
* @param fieldType - The field type
|
|
5
|
+
* @returns The default value for the field type
|
|
6
|
+
*/
|
|
7
|
+
export declare function getDefaultValueForFieldType(fieldType: FieldType): any;
|
|
8
|
+
//# sourceMappingURL=field-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-defaults.d.ts","sourceRoot":"","sources":["../../src/lib/utils/field-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAcrE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the default value for a field type
|
|
3
|
+
* @param fieldType - The field type
|
|
4
|
+
* @returns The default value for the field type
|
|
5
|
+
*/
|
|
6
|
+
export function getDefaultValueForFieldType(fieldType) {
|
|
7
|
+
switch (fieldType) {
|
|
8
|
+
case 'boolean':
|
|
9
|
+
return false;
|
|
10
|
+
case 'array':
|
|
11
|
+
return [];
|
|
12
|
+
case 'object':
|
|
13
|
+
return {};
|
|
14
|
+
case 'number':
|
|
15
|
+
return null;
|
|
16
|
+
default:
|
|
17
|
+
// string, text, slug, url, image, date, datetime, reference
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAGA,cAAc,uBAAuB,CAAC;AAGtC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAGA,cAAc,uBAAuB,CAAC;AAGtC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for initialValue date/datetime patterns
|
|
3
|
+
* These can be used directly as initialValue in field definitions
|
|
4
|
+
*
|
|
5
|
+
* Note: Returns values in storage format (ISO),
|
|
6
|
+
* which will be converted to the user's configured display format by the field components
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Returns the current date in YYYY-MM-DD format (storage format)
|
|
10
|
+
* Usage: initialValue: currentDate
|
|
11
|
+
*/
|
|
12
|
+
export declare function currentDate(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a specific date offset from today
|
|
15
|
+
* Usage: initialValue: () => dateFromToday(7) // 7 days from now
|
|
16
|
+
* Usage: initialValue: () => dateFromToday(-7) // 7 days ago
|
|
17
|
+
*/
|
|
18
|
+
export declare function dateFromToday(days: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the first day of the current month
|
|
21
|
+
* Usage: initialValue: firstDayOfMonth
|
|
22
|
+
*/
|
|
23
|
+
export declare function firstDayOfMonth(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the last day of the current month
|
|
26
|
+
* Usage: initialValue: lastDayOfMonth
|
|
27
|
+
*/
|
|
28
|
+
export declare function lastDayOfMonth(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the current datetime in ISO UTC format (storage format)
|
|
31
|
+
* Usage: initialValue: currentDateTime
|
|
32
|
+
*/
|
|
33
|
+
export declare function currentDateTime(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Returns a datetime offset from now in ISO UTC format
|
|
36
|
+
* Usage: initialValue: () => dateTimeFromNow(1, 'hour') // 1 hour from now
|
|
37
|
+
* Usage: initialValue: () => dateTimeFromNow(-30, 'minute') // 30 minutes ago
|
|
38
|
+
*/
|
|
39
|
+
export declare function dateTimeFromNow(amount: number, unit: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'): string;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the start of the current day in ISO UTC format
|
|
42
|
+
* Usage: initialValue: startOfToday
|
|
43
|
+
*/
|
|
44
|
+
export declare function startOfToday(): string;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the end of the current day in ISO UTC format
|
|
47
|
+
* Usage: initialValue: endOfToday
|
|
48
|
+
*/
|
|
49
|
+
export declare function endOfToday(): string;
|
|
50
|
+
//# sourceMappingURL=initial-value-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initial-value-helpers.d.ts","sourceRoot":"","sources":["../../src/lib/utils/initial-value-helpers.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAIH;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAID;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GACzD,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import utc from 'dayjs/plugin/utc';
|
|
3
|
+
dayjs.extend(utc);
|
|
4
|
+
/**
|
|
5
|
+
* Helper functions for initialValue date/datetime patterns
|
|
6
|
+
* These can be used directly as initialValue in field definitions
|
|
7
|
+
*
|
|
8
|
+
* Note: Returns values in storage format (ISO),
|
|
9
|
+
* which will be converted to the user's configured display format by the field components
|
|
10
|
+
*/
|
|
11
|
+
// ==================== Date Helpers ====================
|
|
12
|
+
/**
|
|
13
|
+
* Returns the current date in YYYY-MM-DD format (storage format)
|
|
14
|
+
* Usage: initialValue: currentDate
|
|
15
|
+
*/
|
|
16
|
+
export function currentDate() {
|
|
17
|
+
return dayjs().format('YYYY-MM-DD');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns a specific date offset from today
|
|
21
|
+
* Usage: initialValue: () => dateFromToday(7) // 7 days from now
|
|
22
|
+
* Usage: initialValue: () => dateFromToday(-7) // 7 days ago
|
|
23
|
+
*/
|
|
24
|
+
export function dateFromToday(days) {
|
|
25
|
+
return dayjs().add(days, 'day').format('YYYY-MM-DD');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the first day of the current month
|
|
29
|
+
* Usage: initialValue: firstDayOfMonth
|
|
30
|
+
*/
|
|
31
|
+
export function firstDayOfMonth() {
|
|
32
|
+
return dayjs().startOf('month').format('YYYY-MM-DD');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns the last day of the current month
|
|
36
|
+
* Usage: initialValue: lastDayOfMonth
|
|
37
|
+
*/
|
|
38
|
+
export function lastDayOfMonth() {
|
|
39
|
+
return dayjs().endOf('month').format('YYYY-MM-DD');
|
|
40
|
+
}
|
|
41
|
+
// ==================== DateTime Helpers ====================
|
|
42
|
+
/**
|
|
43
|
+
* Returns the current datetime in ISO UTC format (storage format)
|
|
44
|
+
* Usage: initialValue: currentDateTime
|
|
45
|
+
*/
|
|
46
|
+
export function currentDateTime() {
|
|
47
|
+
return dayjs().utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns a datetime offset from now in ISO UTC format
|
|
51
|
+
* Usage: initialValue: () => dateTimeFromNow(1, 'hour') // 1 hour from now
|
|
52
|
+
* Usage: initialValue: () => dateTimeFromNow(-30, 'minute') // 30 minutes ago
|
|
53
|
+
*/
|
|
54
|
+
export function dateTimeFromNow(amount, unit) {
|
|
55
|
+
return dayjs().add(amount, unit).utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the start of the current day in ISO UTC format
|
|
59
|
+
* Usage: initialValue: startOfToday
|
|
60
|
+
*/
|
|
61
|
+
export function startOfToday() {
|
|
62
|
+
return dayjs().startOf('day').utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns the end of the current day in ISO UTC format
|
|
66
|
+
* Usage: initialValue: endOfToday
|
|
67
|
+
*/
|
|
68
|
+
export function endOfToday() {
|
|
69
|
+
return dayjs().endOf('day').utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
70
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aphexcms/cms-core",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Aphex CMS Core - A Sanity-style CMS with ports and adapters architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"svelte": "./dist/index.js",
|
|
9
9
|
"bin": {
|
|
10
|
-
"aphex": "./dist/cli/index.
|
|
10
|
+
"aphex": "./dist/cli/index.ts"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -57,15 +57,17 @@
|
|
|
57
57
|
"svelte": "^5.0.0",
|
|
58
58
|
"tailwind-merge": "^3.3.1",
|
|
59
59
|
"tailwind-variants": "^3.1.1",
|
|
60
|
-
"@aphexcms/ui": "0.1.
|
|
60
|
+
"@aphexcms/ui": "0.1.8"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@clack/prompts": "^0.11.0",
|
|
64
64
|
"cac": "^6.7.14",
|
|
65
|
+
"dayjs": "^1.11.19",
|
|
65
66
|
"esbuild": "^0.24.0",
|
|
66
67
|
"picocolors": "^1.1.1",
|
|
67
68
|
"s3mini": "^0.5.0",
|
|
68
|
-
"sharp": "^0.34.4"
|
|
69
|
+
"sharp": "^0.34.4",
|
|
70
|
+
"tsx": "^4.19.2"
|
|
69
71
|
},
|
|
70
72
|
"devDependencies": {
|
|
71
73
|
"@eslint/compat": "^1.2.5",
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Badge } from '@aphexcms/ui/shadcn/badge';
|
|
3
|
-
import {
|
|
4
|
-
SidebarGroup,
|
|
5
|
-
SidebarGroupLabel,
|
|
6
|
-
SidebarGroupContent,
|
|
7
|
-
SidebarMenu,
|
|
8
|
-
SidebarMenuItem,
|
|
9
|
-
SidebarMenuButton
|
|
10
|
-
} from '@aphexcms/ui/shadcn/sidebar';
|
|
11
|
-
import { page } from '$app/state';
|
|
12
|
-
|
|
13
|
-
interface DocumentType {
|
|
14
|
-
name: string;
|
|
15
|
-
title: string;
|
|
16
|
-
description?: string;
|
|
17
|
-
documentCount?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface Props {
|
|
21
|
-
documentTypes: DocumentType[];
|
|
22
|
-
objectTypes: DocumentType[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let { documentTypes, objectTypes }: Props = $props();
|
|
26
|
-
|
|
27
|
-
const currentPath = $derived(page.url.pathname);
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<!-- Document Types Section -->
|
|
31
|
-
{#if documentTypes.length > 0}
|
|
32
|
-
<SidebarGroup class="max-w-[350px]">
|
|
33
|
-
<SidebarGroupLabel class="flex items-center justify-between">
|
|
34
|
-
<span class="flex items-center gap-2">
|
|
35
|
-
<span>📄</span>
|
|
36
|
-
Content
|
|
37
|
-
</span>
|
|
38
|
-
<Badge variant="secondary" class="text-xs">{documentTypes.length}</Badge>
|
|
39
|
-
</SidebarGroupLabel>
|
|
40
|
-
|
|
41
|
-
<SidebarGroupContent>
|
|
42
|
-
<SidebarMenu>
|
|
43
|
-
{#each documentTypes as docType, index (index)}
|
|
44
|
-
<SidebarMenuItem>
|
|
45
|
-
<SidebarMenuButton
|
|
46
|
-
onclick={goto(`/admin/documents/${docType.name}`)}
|
|
47
|
-
isActive={currentPath.includes(`/documents/${docType.name}`)}
|
|
48
|
-
class="group"
|
|
49
|
-
>
|
|
50
|
-
<div class="flex min-w-0 flex-1 items-center gap-2">
|
|
51
|
-
<div
|
|
52
|
-
class="flex h-5 w-5 flex-shrink-0 items-center justify-center rounded bg-blue-100 dark:bg-blue-900/20"
|
|
53
|
-
>
|
|
54
|
-
<span class="text-xs text-blue-600 dark:text-blue-400">📄</span>
|
|
55
|
-
</div>
|
|
56
|
-
<div class="min-w-0 flex-1">
|
|
57
|
-
<div class="truncate text-sm font-medium">{docType.title}</div>
|
|
58
|
-
{#if docType.description}
|
|
59
|
-
<div class="text-muted-foreground truncate text-xs">{docType.description}</div>
|
|
60
|
-
{/if}
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</SidebarMenuButton>
|
|
64
|
-
</SidebarMenuItem>
|
|
65
|
-
{/each}
|
|
66
|
-
</SidebarMenu>
|
|
67
|
-
</SidebarGroupContent>
|
|
68
|
-
</SidebarGroup>
|
|
69
|
-
{/if}
|
|
70
|
-
|
|
71
|
-
<!-- Object Types Section -->
|
|
72
|
-
{#if objectTypes.length > 0}
|
|
73
|
-
<SidebarGroup>
|
|
74
|
-
<SidebarGroupLabel class="flex items-center justify-between">
|
|
75
|
-
<span class="flex items-center gap-2">
|
|
76
|
-
<span>🧩</span>
|
|
77
|
-
Object Types
|
|
78
|
-
</span>
|
|
79
|
-
<Badge variant="secondary" class="text-xs">{objectTypes.length}</Badge>
|
|
80
|
-
</SidebarGroupLabel>
|
|
81
|
-
</SidebarGroup>
|
|
82
|
-
{/if}
|
|
83
|
-
|
|
84
|
-
<!-- Empty state -->
|
|
85
|
-
{#if documentTypes.length === 0 && objectTypes.length === 0}
|
|
86
|
-
<SidebarGroup>
|
|
87
|
-
<SidebarGroupContent>
|
|
88
|
-
<div class="text-muted-foreground space-y-2 py-6 text-center">
|
|
89
|
-
<div class="text-2xl">📄</div>
|
|
90
|
-
<div>
|
|
91
|
-
<p class="text-sm">No content types found</p>
|
|
92
|
-
<p class="text-xs">Define schemas in schemaTypes/</p>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
95
|
-
</SidebarGroupContent>
|
|
96
|
-
</SidebarGroup>
|
|
97
|
-
{/if}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface DocumentType {
|
|
2
|
-
name: string;
|
|
3
|
-
title: string;
|
|
4
|
-
description?: string;
|
|
5
|
-
documentCount?: number;
|
|
6
|
-
}
|
|
7
|
-
interface Props {
|
|
8
|
-
documentTypes: DocumentType[];
|
|
9
|
-
objectTypes: DocumentType[];
|
|
10
|
-
}
|
|
11
|
-
declare const DocumentTypesList: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type DocumentTypesList = ReturnType<typeof DocumentTypesList>;
|
|
13
|
-
export default DocumentTypesList;
|
|
14
|
-
//# sourceMappingURL=DocumentTypesList.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentTypesList.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/components/admin/DocumentTypesList.svelte.ts"],"names":[],"mappings":"AAeC,UAAU,YAAY;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,KAAK;IACd,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,WAAW,EAAE,YAAY,EAAE,CAAC;CAC5B;AA8EF,QAAA,MAAM,iBAAiB,2CAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|