@aphexcms/cms-core 2.0.1 → 2.0.2

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.
@@ -31,6 +31,7 @@
31
31
  import type { Organization } from '../types/organization';
32
32
  import { getOrderingsForSchema } from '../utils/default-orderings';
33
33
  import { cmsLogger } from '../utils/logger';
34
+ import { pluralize } from '../utils/pluralize';
34
35
  import { toast } from 'svelte-sonner';
35
36
 
36
37
  interface Props {
@@ -785,8 +786,8 @@
785
786
  </button>
786
787
  <span class="text-muted-foreground mx-2">/</span>
787
788
  <span class="text-sm font-medium">
788
- {(documentTypes.find((t) => t.name === selectedDocumentType)?.title ||
789
- selectedDocumentType) + 's'}
789
+ {pluralize(documentTypes.find((t) => t.name === selectedDocumentType)?.title ||
790
+ selectedDocumentType)}
790
791
  </span>
791
792
  {:else if mobileView === 'editor'}
792
793
  <Button
@@ -894,7 +895,7 @@
894
895
  <FileText class="h-4 w-4" />
895
896
  {/if}
896
897
  </div>
897
- <span class="text-sm">{docType.title}s</span>
898
+ <span class="text-sm">{pluralize(docType.title)}</span>
898
899
  </div>
899
900
  <svg
900
901
  class="text-muted-foreground h-4 w-4 opacity-0 transition-opacity group-hover:opacity-100"
@@ -953,8 +954,8 @@
953
954
  >
954
955
  <div class="flex flex-1 items-start justify-center p-2 pt-8 text-left">
955
956
  <div class="text-foreground rotate-90 transform text-sm font-medium">
956
- {(documentTypes.find((t) => t.name === selectedDocumentType)?.title ||
957
- selectedDocumentType) + 's'}
957
+ {pluralize(documentTypes.find((t) => t.name === selectedDocumentType)?.title ||
958
+ selectedDocumentType)}
958
959
  </div>
959
960
  </div>
960
961
  </button>
@@ -978,7 +979,7 @@
978
979
  {/if}
979
980
  <div>
980
981
  <h3 class="text-sm font-medium">
981
- {(currentDocType?.title || selectedDocumentType) + 's'}
982
+ {pluralize(currentDocType?.title || selectedDocumentType)}
982
983
  </h3>
983
984
  <p class="text-muted-foreground text-xs">
984
985
  {docTotalDocs} document{docTotalDocs !== 1 ? 's' : ''}
@@ -1 +1 @@
1
- {"version":3,"file":"AdminApp.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/AdminApp.svelte.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAsBnE,UAAU,KAAK;IACd,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,aAAa,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAA;KAAE,CAAC;IACxD,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAChD;AAmuCF,QAAA,MAAM,QAAQ,2CAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"AdminApp.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/AdminApp.svelte.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAuBnE,UAAU,KAAK;IACd,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,aAAa,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAA;KAAE,CAAC;IACxD,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAChD;AAouCF,QAAA,MAAM,QAAQ,2CAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -12,6 +12,7 @@
12
12
  import { documents } from '../../../api/documents';
13
13
  import { toast } from 'svelte-sonner';
14
14
  import { cmsLogger } from '../../../utils/logger';
15
+ import { pluralize } from '../../../utils/pluralize';
15
16
 
16
17
  interface Props {
17
18
  field: Field;
@@ -213,7 +214,7 @@
213
214
  <Command.Empty>
214
215
  <div class="flex flex-col items-center gap-2 py-4">
215
216
  <p class="text-muted-foreground text-sm">
216
- No {targetType}s found
217
+ No {pluralize(targetType)} found
217
218
  </p>
218
219
  <Button size="sm" onclick={createNewDocument} disabled={creating} class="gap-1">
219
220
  <PlusIcon class="h-3 w-3" />
@@ -253,7 +254,7 @@
253
254
  </Command.Group>
254
255
  {:else}
255
256
  <Command.Empty>
256
- No {targetType}s available
257
+ No {pluralize(targetType)} available
257
258
  </Command.Empty>
258
259
  {/if}
259
260
  </Command.List>
@@ -1 +1 @@
1
- {"version":3,"file":"ReferenceField.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/admin/fields/ReferenceField.svelte.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAwC,MAAM,wBAAwB,CAAC;AAMzF,UAAU,KAAK;IACd,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAwOF,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ReferenceField.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/admin/fields/ReferenceField.svelte.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAwC,MAAM,wBAAwB,CAAC;AAOzF,UAAU,KAAK;IACd,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAyOF,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Simple English pluralization.
3
+ * Handles common patterns: y→ies, s/sh/ch/x/z→es, otherwise appends s.
4
+ */
5
+ export declare function pluralize(word: string): string;
6
+ //# sourceMappingURL=pluralize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluralize.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/pluralize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY9C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Simple English pluralization.
3
+ * Handles common patterns: y→ies, s/sh/ch/x/z→es, otherwise appends s.
4
+ */
5
+ export function pluralize(word) {
6
+ if (!word)
7
+ return word;
8
+ if (/[sxz]$/i.test(word) || /[sc]h$/i.test(word)) {
9
+ return word + 'es';
10
+ }
11
+ if (/[^aeiou]y$/i.test(word)) {
12
+ return word.slice(0, -1) + 'ies';
13
+ }
14
+ return word + 's';
15
+ }
16
+ //# sourceMappingURL=pluralize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluralize.js","sourceRoot":"","sources":["../../../src/lib/utils/pluralize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACrC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,OAAO,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAClC,CAAC;IAED,OAAO,IAAI,GAAG,GAAG,CAAC;AACnB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Simple English pluralization.
3
+ * Handles common patterns: y→ies, s/sh/ch/x/z→es, otherwise appends s.
4
+ */
5
+ export declare function pluralize(word: string): string;
6
+ //# sourceMappingURL=pluralize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluralize.d.ts","sourceRoot":"","sources":["../../src/lib/utils/pluralize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY9C"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Simple English pluralization.
3
+ * Handles common patterns: y→ies, s/sh/ch/x/z→es, otherwise appends s.
4
+ */
5
+ export function pluralize(word) {
6
+ if (!word)
7
+ return word;
8
+ if (/[sxz]$/i.test(word) || /[sc]h$/i.test(word)) {
9
+ return word + 'es';
10
+ }
11
+ if (/[^aeiou]y$/i.test(word)) {
12
+ return word.slice(0, -1) + 'ies';
13
+ }
14
+ return word + 's';
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aphexcms/cms-core",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Aphex CMS Core - A Sanity-style CMS with ports and adapters architecture",
5
5
  "publishConfig": {
6
6
  "access": "public",