@kurbo/dkit 0.5.0 → 0.5.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.
Files changed (96) hide show
  1. package/dist/bin.js +119 -26
  2. package/dist/bin.js.map +1 -1
  3. package/package.json +1 -1
  4. package/vendor/registry/blocks/blog-detail/ui/minimal/next/blog-detail.tsx +0 -1
  5. package/vendor/registry/blocks/blog-detail/ui/shadcn/next/blog-detail.tsx +0 -1
  6. package/vendor/registry/blocks/blog-list/ui/minimal/next/blog-list.tsx +0 -1
  7. package/vendor/registry/blocks/blog-list/ui/shadcn/next/blog-list.tsx +0 -1
  8. package/vendor/registry/blocks/blog-list-cards/ui/minimal/next/blog-list-cards.tsx +0 -1
  9. package/vendor/registry/blocks/blog-list-cards/ui/shadcn/next/blog-list-cards.tsx +0 -1
  10. package/vendor/registry/blocks/booking-form-ui/ui/minimal/next/booking-form.tsx +0 -1
  11. package/vendor/registry/blocks/booking-form-ui/ui/shadcn/next/booking-form.tsx +0 -1
  12. package/vendor/registry/blocks/contact-form-ui/ui/minimal/next/contact-form.tsx +0 -1
  13. package/vendor/registry/blocks/contact-form-ui/ui/shadcn/next/contact-form.tsx +0 -1
  14. package/vendor/registry/blocks/faq-list/ui/minimal/next/faq-list.tsx +0 -1
  15. package/vendor/registry/blocks/faq-list/ui/shadcn/next/faq-list.tsx +0 -1
  16. package/vendor/registry/blocks/page-detail/ui/minimal/next/page-detail.tsx +0 -1
  17. package/vendor/registry/blocks/page-detail/ui/shadcn/next/page-detail.tsx +0 -1
  18. package/vendor/registry/blocks/project-detail/ui/minimal/next/project-detail.tsx +0 -1
  19. package/vendor/registry/blocks/project-detail/ui/shadcn/next/project-detail.tsx +0 -1
  20. package/vendor/registry/blocks/project-list/ui/minimal/next/project-list.tsx +0 -1
  21. package/vendor/registry/blocks/project-list/ui/shadcn/next/project-list.tsx +0 -1
  22. package/vendor/registry/blocks/project-list-cards/ui/minimal/next/project-list-cards.tsx +0 -1
  23. package/vendor/registry/blocks/project-list-cards/ui/shadcn/next/project-list-cards.tsx +0 -1
  24. package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel-client.tsx +0 -4
  25. package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel.tsx +0 -1
  26. package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel-client.tsx +0 -1
  27. package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel.tsx +0 -1
  28. package/vendor/registry/blocks/service-detail/ui/minimal/next/service-detail.tsx +0 -1
  29. package/vendor/registry/blocks/service-detail/ui/shadcn/next/service-detail.tsx +0 -1
  30. package/vendor/registry/blocks/service-list/ui/minimal/next/service-list.tsx +0 -1
  31. package/vendor/registry/blocks/service-list/ui/shadcn/next/service-list.tsx +0 -1
  32. package/vendor/registry/blocks/service-list-cards/ui/minimal/next/service-list-cards.tsx +0 -1
  33. package/vendor/registry/blocks/service-list-cards/ui/shadcn/next/service-list-cards.tsx +0 -1
  34. package/vendor/registry/blocks/social-links/ui/minimal/next/social-links.tsx +0 -1
  35. package/vendor/registry/blocks/social-links/ui/shadcn/next/social-links.tsx +0 -1
  36. package/vendor/registry/blocks/team-detail/ui/minimal/next/team-detail.tsx +0 -1
  37. package/vendor/registry/blocks/team-detail/ui/shadcn/next/team-detail.tsx +0 -1
  38. package/vendor/registry/blocks/team-list/ui/minimal/next/team-list.tsx +0 -1
  39. package/vendor/registry/blocks/team-list/ui/shadcn/next/team-list.tsx +0 -1
  40. package/vendor/registry/blocks/team-list-cards/ui/minimal/next/team-list-cards.tsx +0 -1
  41. package/vendor/registry/blocks/team-list-cards/ui/shadcn/next/team-list-cards.tsx +0 -1
  42. package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel-client.tsx +0 -4
  43. package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel.tsx +0 -1
  44. package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel-client.tsx +0 -1
  45. package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel.tsx +0 -1
  46. package/vendor/registry/blocks/testimonials-list/ui/minimal/next/testimonials-list.tsx +0 -1
  47. package/vendor/registry/blocks/testimonials-list/ui/shadcn/next/testimonials-list.tsx +0 -1
  48. package/vendor/registry/blocks/testimonials-list-cards/ui/minimal/next/testimonials-list-cards.tsx +0 -1
  49. package/vendor/registry/blocks/testimonials-list-cards/ui/shadcn/next/testimonials-list-cards.tsx +0 -1
  50. package/vendor/registry/modules/blog/lib.multilocale.ts +124 -129
  51. package/vendor/registry/modules/blog/lib.ts +12 -9
  52. package/vendor/registry/modules/blog/services/seed.json +1 -1
  53. package/vendor/registry/modules/blog/services/seed.multilocale.json +1 -1
  54. package/vendor/registry/modules/blog/types.multilocale.ts +41 -12
  55. package/vendor/registry/modules/blog/types.ts +8 -6
  56. package/vendor/registry/modules/faq/lib.multilocale.ts +30 -30
  57. package/vendor/registry/modules/faq/lib.ts +4 -5
  58. package/vendor/registry/modules/faq/types.multilocale.ts +13 -2
  59. package/vendor/registry/modules/faq/types.ts +4 -2
  60. package/vendor/registry/modules/navigation/lib.multilocale.ts +207 -76
  61. package/vendor/registry/modules/navigation/lib.ts +18 -17
  62. package/vendor/registry/modules/navigation/types.multilocale.ts +24 -4
  63. package/vendor/registry/modules/navigation/types.ts +6 -4
  64. package/vendor/registry/modules/pages/lib.multilocale.ts +34 -39
  65. package/vendor/registry/modules/pages/lib.ts +4 -3
  66. package/vendor/registry/modules/pages/types.multilocale.ts +14 -3
  67. package/vendor/registry/modules/pages/types.ts +5 -3
  68. package/vendor/registry/modules/projects/lib.multilocale.ts +149 -65
  69. package/vendor/registry/modules/projects/lib.ts +6 -6
  70. package/vendor/registry/modules/projects/services/seed.json +2 -2
  71. package/vendor/registry/modules/projects/services/seed.multilocale.json +2 -2
  72. package/vendor/registry/modules/projects/types.multilocale.ts +15 -3
  73. package/vendor/registry/modules/projects/types.ts +5 -3
  74. package/vendor/registry/modules/services/lib.multilocale.ts +143 -63
  75. package/vendor/registry/modules/services/lib.ts +6 -6
  76. package/vendor/registry/modules/services/services/seed.json +4 -4
  77. package/vendor/registry/modules/services/services/seed.multilocale.json +2 -2
  78. package/vendor/registry/modules/services/types.multilocale.ts +13 -3
  79. package/vendor/registry/modules/services/types.ts +5 -3
  80. package/vendor/registry/modules/settings/lib.multilocale.ts +159 -57
  81. package/vendor/registry/modules/settings/types.multilocale.ts +15 -0
  82. package/vendor/registry/modules/settings/types.ts +2 -2
  83. package/vendor/registry/modules/team/lib.multilocale.ts +116 -49
  84. package/vendor/registry/modules/team/lib.ts +4 -3
  85. package/vendor/registry/modules/team/services/seed.json +4 -4
  86. package/vendor/registry/modules/team/services/seed.multilocale.json +2 -2
  87. package/vendor/registry/modules/team/types.multilocale.ts +16 -3
  88. package/vendor/registry/modules/team/types.ts +5 -3
  89. package/vendor/registry/modules/testimonials/lib.multilocale.ts +82 -50
  90. package/vendor/registry/modules/testimonials/services/seed.json +4 -4
  91. package/vendor/registry/modules/testimonials/services/seed.multilocale.json +2 -2
  92. package/vendor/registry/modules/testimonials/types.multilocale.ts +14 -2
  93. package/vendor/registry/modules/testimonials/types.ts +4 -2
  94. package/vendor/registry/shared/helpers.ts +9 -3
  95. package/vendor/registry/shared/i18n.ts +84 -12
  96. package/vendor/registry/shared/prose.css +1 -1
package/dist/bin.js CHANGED
@@ -4766,9 +4766,21 @@ import fs8 from "fs";
4766
4766
  import path9 from "path";
4767
4767
  var COLLECTION_TYPES = {
4768
4768
  /* blog */
4769
- posts: { moduleId: "blog", typeName: "BlogPost" },
4770
- authors: { moduleId: "blog", typeName: "BlogAuthor" },
4771
- categories: { moduleId: "blog", typeName: "BlogCategory" },
4769
+ posts: {
4770
+ moduleId: "blog",
4771
+ typeName: "BlogPost",
4772
+ wireTypeName: "BlogPostRow"
4773
+ },
4774
+ authors: {
4775
+ moduleId: "blog",
4776
+ typeName: "BlogAuthor",
4777
+ wireTypeName: "BlogAuthorRow"
4778
+ },
4779
+ categories: {
4780
+ moduleId: "blog",
4781
+ typeName: "BlogCategory",
4782
+ wireTypeName: "BlogCategoryRow"
4783
+ },
4772
4784
  posts_categories: { moduleId: "blog", typeName: "PostsCategoriesRow" },
4773
4785
  posts_translations: { moduleId: "blog", typeName: "BlogPostTranslation" },
4774
4786
  categories_translations: {
@@ -4780,24 +4792,62 @@ var COLLECTION_TYPES = {
4780
4792
  typeName: "BlogAuthorTranslation"
4781
4793
  },
4782
4794
  /* pages */
4783
- pages: { moduleId: "pages", typeName: "SitePage" },
4795
+ pages: {
4796
+ moduleId: "pages",
4797
+ typeName: "SitePage",
4798
+ wireTypeName: "SitePageRow"
4799
+ },
4784
4800
  pages_translations: { moduleId: "pages", typeName: "SitePageTranslation" },
4785
4801
  /* page-builder */
4786
- builder_pages: { moduleId: "page-builder", typeName: "BuilderPage" },
4787
- block_hero: { moduleId: "page-builder", typeName: "BlockHero" },
4788
- block_richtext: { moduleId: "page-builder", typeName: "BlockRichtext" },
4789
- block_cta: { moduleId: "page-builder", typeName: "BlockCta" },
4790
- block_faq: { moduleId: "page-builder", typeName: "BlockFaq" },
4791
- block_faq_items: { moduleId: "page-builder", typeName: "BlockFaqItem" },
4792
- block_card_grid: { moduleId: "page-builder", typeName: "BlockCardGrid" },
4802
+ builder_pages: {
4803
+ moduleId: "page-builder",
4804
+ typeName: "BuilderPage",
4805
+ wireTypeName: "BuilderPageRow"
4806
+ },
4807
+ block_hero: {
4808
+ moduleId: "page-builder",
4809
+ typeName: "BlockHero",
4810
+ wireTypeName: "BlockHeroRow"
4811
+ },
4812
+ block_richtext: {
4813
+ moduleId: "page-builder",
4814
+ typeName: "BlockRichtext",
4815
+ wireTypeName: "BlockRichtextRow"
4816
+ },
4817
+ block_cta: {
4818
+ moduleId: "page-builder",
4819
+ typeName: "BlockCta",
4820
+ wireTypeName: "BlockCtaRow"
4821
+ },
4822
+ block_faq: {
4823
+ moduleId: "page-builder",
4824
+ typeName: "BlockFaq",
4825
+ wireTypeName: "BlockFaqRow"
4826
+ },
4827
+ block_faq_items: {
4828
+ moduleId: "page-builder",
4829
+ typeName: "BlockFaqItem",
4830
+ wireTypeName: "BlockFaqItemRow"
4831
+ },
4832
+ block_card_grid: {
4833
+ moduleId: "page-builder",
4834
+ typeName: "BlockCardGrid",
4835
+ wireTypeName: "BlockCardGridRow"
4836
+ },
4793
4837
  block_card_grid_cards: {
4794
4838
  moduleId: "page-builder",
4795
- typeName: "BlockCardGridCard"
4839
+ typeName: "BlockCardGridCard",
4840
+ wireTypeName: "BlockCardGridCardRow"
4841
+ },
4842
+ block_carousel: {
4843
+ moduleId: "page-builder",
4844
+ typeName: "BlockCarousel",
4845
+ wireTypeName: "BlockCarouselRow"
4796
4846
  },
4797
- block_carousel: { moduleId: "page-builder", typeName: "BlockCarousel" },
4798
4847
  block_carousel_slides: {
4799
4848
  moduleId: "page-builder",
4800
- typeName: "BlockCarouselSlide"
4849
+ typeName: "BlockCarouselSlide",
4850
+ wireTypeName: "BlockCarouselSlideRow"
4801
4851
  },
4802
4852
  block_featured_blog: {
4803
4853
  moduleId: "page-builder",
@@ -4860,6 +4910,7 @@ var COLLECTION_TYPES = {
4860
4910
  site_settings: {
4861
4911
  moduleId: "settings",
4862
4912
  typeName: "SiteSettings",
4913
+ wireTypeName: "SiteSettingsRow",
4863
4914
  singleton: true
4864
4915
  },
4865
4916
  site_settings_translations: {
@@ -4867,8 +4918,16 @@ var COLLECTION_TYPES = {
4867
4918
  typeName: "SiteSettingsTranslation"
4868
4919
  },
4869
4920
  /* navigation */
4870
- nav_menus: { moduleId: "navigation", typeName: "NavMenu" },
4871
- nav_items: { moduleId: "navigation", typeName: "NavItem" },
4921
+ nav_menus: {
4922
+ moduleId: "navigation",
4923
+ typeName: "NavMenu",
4924
+ wireTypeName: "NavMenuRow"
4925
+ },
4926
+ nav_items: {
4927
+ moduleId: "navigation",
4928
+ typeName: "NavItem",
4929
+ wireTypeName: "NavItemRow"
4930
+ },
4872
4931
  nav_menus_translations: {
4873
4932
  moduleId: "navigation",
4874
4933
  typeName: "NavMenuTranslation"
@@ -4878,31 +4937,51 @@ var COLLECTION_TYPES = {
4878
4937
  typeName: "NavItemTranslation"
4879
4938
  },
4880
4939
  /* faq */
4881
- faq_items: { moduleId: "faq", typeName: "FaqItem" },
4940
+ faq_items: {
4941
+ moduleId: "faq",
4942
+ typeName: "FaqItem",
4943
+ wireTypeName: "FaqItemRow"
4944
+ },
4882
4945
  faq_items_translations: {
4883
4946
  moduleId: "faq",
4884
4947
  typeName: "FaqItemTranslation"
4885
4948
  },
4886
4949
  /* testimonials */
4887
- testimonials: { moduleId: "testimonials", typeName: "Testimonial" },
4950
+ testimonials: {
4951
+ moduleId: "testimonials",
4952
+ typeName: "Testimonial",
4953
+ wireTypeName: "TestimonialRow"
4954
+ },
4888
4955
  testimonials_translations: {
4889
4956
  moduleId: "testimonials",
4890
4957
  typeName: "TestimonialTranslation"
4891
4958
  },
4892
4959
  /* projects */
4893
- projects: { moduleId: "projects", typeName: "Project" },
4960
+ projects: {
4961
+ moduleId: "projects",
4962
+ typeName: "Project",
4963
+ wireTypeName: "ProjectRow"
4964
+ },
4894
4965
  projects_translations: {
4895
4966
  moduleId: "projects",
4896
4967
  typeName: "ProjectTranslation"
4897
4968
  },
4898
4969
  /* services */
4899
- services: { moduleId: "services", typeName: "Service" },
4970
+ services: {
4971
+ moduleId: "services",
4972
+ typeName: "Service",
4973
+ wireTypeName: "ServiceRow"
4974
+ },
4900
4975
  services_translations: {
4901
4976
  moduleId: "services",
4902
4977
  typeName: "ServiceTranslation"
4903
4978
  },
4904
4979
  /* team */
4905
- team_members: { moduleId: "team", typeName: "TeamMember" },
4980
+ team_members: {
4981
+ moduleId: "team",
4982
+ typeName: "TeamMember",
4983
+ wireTypeName: "TeamMemberRow"
4984
+ },
4906
4985
  team_members_translations: {
4907
4986
  moduleId: "team",
4908
4987
  typeName: "TeamMemberTranslation"
@@ -4914,17 +4993,19 @@ function writeDkitClient(projectRoot, config, collectionMap = config.collections
4914
4993
  const installed = new Set(Object.keys(config.modules ?? {}));
4915
4994
  const importsByModule = /* @__PURE__ */ new Map();
4916
4995
  const schemaFields = [];
4996
+ const useWire = Boolean(config.multilocale);
4917
4997
  for (const [logical, physical] of Object.entries(collectionMap)) {
4918
4998
  const binding = COLLECTION_TYPES[logical];
4919
4999
  if (!binding) continue;
4920
5000
  if (!installed.has(binding.moduleId)) continue;
5001
+ const schemaType = useWire && binding.wireTypeName ? binding.wireTypeName : binding.typeName;
4921
5002
  let set = importsByModule.get(binding.moduleId);
4922
5003
  if (!set) {
4923
5004
  set = /* @__PURE__ */ new Set();
4924
5005
  importsByModule.set(binding.moduleId, set);
4925
5006
  }
4926
- set.add(binding.typeName);
4927
- const typeExpr = binding.singleton ? binding.typeName : `${binding.typeName}[]`;
5007
+ set.add(schemaType);
5008
+ const typeExpr = binding.singleton ? schemaType : `${schemaType}[]`;
4928
5009
  schemaFields.push(` ${JSON.stringify(physical)}: ${typeExpr};`);
4929
5010
  }
4930
5011
  const importLines = [...importsByModule.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([moduleId, types]) => {
@@ -4956,6 +5037,8 @@ ${schemaFields.length ? `${schemaFields.join("\n")}
4956
5037
  const clientContents = `/** Generated by dkit \u2014 shared typed Directus client + asset helpers.
4957
5038
  * Modules must import getDirectus / directusFileId / directusAssetUrl from here \u2014
4958
5039
  * never redefine them in lib/dkit/<module>.ts.
5040
+ *
5041
+ * Typing pipeline: module *.types \u2192 schema (DkitSchema) \u2192 this client \u2192 services \u2192 UI.
4959
5042
  */
4960
5043
  import {
4961
5044
  createDirectus,
@@ -4971,6 +5054,8 @@ export type { DkitSchema } from "./schema";
4971
5054
 
4972
5055
  export type DirectusFileRef = { id: string };
4973
5056
 
5057
+ export type DkitClient = ReturnType<typeof createDkitClient>;
5058
+
4974
5059
  function directusBaseUrl(): string | undefined {
4975
5060
  return (
4976
5061
  process.env.DIRECTUS_URL ||
@@ -4980,6 +5065,10 @@ function directusBaseUrl(): string | undefined {
4980
5065
  );
4981
5066
  }
4982
5067
 
5068
+ function createDkitClient(url: string) {
5069
+ return createDirectus<DkitSchema>(url).with(rest());
5070
+ }
5071
+
4983
5072
  /**
4984
5073
  * Log soft-fail query problems in development.
4985
5074
  * Production stays quiet so empty lists don\u2019t spam logs.
@@ -4997,7 +5086,7 @@ export function dkitQueryFailed(context: string, err?: unknown): void {
4997
5086
  * Server-side Directus client (public role / no admin token).
4998
5087
  * Returns null when DIRECTUS_URL is unset so pages can fail soft.
4999
5088
  */
5000
- export function getDirectus() {
5089
+ export function getDirectus(): DkitClient | null {
5001
5090
  const url = directusBaseUrl();
5002
5091
  if (!url) {
5003
5092
  dkitQueryFailed(
@@ -5005,7 +5094,7 @@ export function getDirectus() {
5005
5094
  );
5006
5095
  return null;
5007
5096
  }
5008
- return createDirectus<DkitSchema>(url).with(rest());
5097
+ return createDkitClient(url);
5009
5098
  }
5010
5099
 
5011
5100
  /** Normalize a string id or expanded file object to a file id. */
@@ -6443,12 +6532,16 @@ ${collectionsEntries}
6443
6532
  } as const;
6444
6533
 
6445
6534
  export type DkitCollection = keyof typeof collections;
6535
+ /** Physical Directus collection name (schema key). */
6536
+ export type DkitCollectionName = (typeof collections)[DkitCollection];
6446
6537
 
6447
6538
  export const modules = {
6448
6539
  ${modulesEntries}
6449
6540
  } as const;
6450
6541
 
6451
- export function collection(name: DkitCollection): string {
6542
+ export function collection<K extends DkitCollection>(
6543
+ name: K,
6544
+ ): (typeof collections)[K] {
6452
6545
  return collections[name];
6453
6546
  }
6454
6547