@kurbo/dkit 0.4.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/README.md +24 -0
- package/dist/bin.js +8066 -0
- package/dist/bin.js.map +1 -0
- package/package.json +58 -0
- package/vendor/registry/blocks/blog-detail/module.json +27 -0
- package/vendor/registry/blocks/blog-detail/ui/minimal/next/blog-detail.tsx +26 -0
- package/vendor/registry/blocks/blog-detail/ui/minimal/nuxt/BlogDetail.vue +27 -0
- package/vendor/registry/blocks/blog-detail/ui/shadcn/next/blog-detail.tsx +106 -0
- package/vendor/registry/blocks/blog-detail/ui/shadcn/nuxt/BlogDetail.vue +116 -0
- package/vendor/registry/blocks/blog-list/module.json +26 -0
- package/vendor/registry/blocks/blog-list/ui/minimal/next/blog-list.tsx +130 -0
- package/vendor/registry/blocks/blog-list/ui/minimal/nuxt/BlogList.vue +62 -0
- package/vendor/registry/blocks/blog-list/ui/shadcn/next/blog-list.tsx +109 -0
- package/vendor/registry/blocks/blog-list/ui/shadcn/nuxt/BlogList.vue +100 -0
- package/vendor/registry/blocks/blog-list-cards/module.json +27 -0
- package/vendor/registry/blocks/blog-list-cards/ui/minimal/next/blog-list-cards.tsx +130 -0
- package/vendor/registry/blocks/blog-list-cards/ui/minimal/nuxt/BlogListCards.vue +114 -0
- package/vendor/registry/blocks/blog-list-cards/ui/shadcn/next/blog-list-cards.tsx +119 -0
- package/vendor/registry/blocks/blog-list-cards/ui/shadcn/nuxt/BlogListCards.vue +113 -0
- package/vendor/registry/blocks/booking-form-ui/module.json +15 -0
- package/vendor/registry/blocks/booking-form-ui/ui/minimal/next/booking-form.tsx +89 -0
- package/vendor/registry/blocks/booking-form-ui/ui/shadcn/next/booking-form.tsx +92 -0
- package/vendor/registry/blocks/contact-form-ui/module.json +27 -0
- package/vendor/registry/blocks/contact-form-ui/ui/minimal/next/contact-form.tsx +45 -0
- package/vendor/registry/blocks/contact-form-ui/ui/minimal/nuxt/ContactForm.vue +79 -0
- package/vendor/registry/blocks/contact-form-ui/ui/shadcn/next/contact-form.tsx +55 -0
- package/vendor/registry/blocks/contact-form-ui/ui/shadcn/nuxt/ContactForm.vue +92 -0
- package/vendor/registry/blocks/faq-list/module.json +15 -0
- package/vendor/registry/blocks/faq-list/ui/minimal/next/faq-list.tsx +78 -0
- package/vendor/registry/blocks/faq-list/ui/shadcn/next/faq-list.tsx +77 -0
- package/vendor/registry/blocks/maintenance-gate/module.json +13 -0
- package/vendor/registry/blocks/maintenance-gate/ui/minimal/next/maintenance-gate.tsx +135 -0
- package/vendor/registry/blocks/maintenance-gate/ui/shadcn/next/maintenance-gate.tsx +87 -0
- package/vendor/registry/blocks/nav-footer/module.json +13 -0
- package/vendor/registry/blocks/nav-footer/ui/minimal/next/nav-footer.tsx +55 -0
- package/vendor/registry/blocks/nav-footer/ui/shadcn/next/nav-footer.tsx +41 -0
- package/vendor/registry/blocks/nav-header/module.json +14 -0
- package/vendor/registry/blocks/nav-header/ui/minimal/next/nav-header.tsx +244 -0
- package/vendor/registry/blocks/nav-header/ui/shadcn/next/nav-header-client.tsx +185 -0
- package/vendor/registry/blocks/nav-header/ui/shadcn/next/nav-header.tsx +12 -0
- package/vendor/registry/blocks/page-detail/module.json +26 -0
- package/vendor/registry/blocks/page-detail/ui/minimal/next/page-detail.tsx +26 -0
- package/vendor/registry/blocks/page-detail/ui/minimal/nuxt/PageDetail.vue +26 -0
- package/vendor/registry/blocks/page-detail/ui/shadcn/next/page-detail.tsx +61 -0
- package/vendor/registry/blocks/page-detail/ui/shadcn/nuxt/PageDetail.vue +62 -0
- package/vendor/registry/blocks/project-detail/module.json +15 -0
- package/vendor/registry/blocks/project-detail/ui/minimal/next/project-detail.tsx +58 -0
- package/vendor/registry/blocks/project-detail/ui/shadcn/next/project-detail.tsx +91 -0
- package/vendor/registry/blocks/project-list/module.json +14 -0
- package/vendor/registry/blocks/project-list/ui/minimal/next/project-list.tsx +104 -0
- package/vendor/registry/blocks/project-list/ui/shadcn/next/project-list.tsx +81 -0
- package/vendor/registry/blocks/project-list-cards/module.json +15 -0
- package/vendor/registry/blocks/project-list-cards/ui/minimal/next/project-list-cards.tsx +125 -0
- package/vendor/registry/blocks/project-list-cards/ui/shadcn/next/project-list-cards.tsx +94 -0
- package/vendor/registry/blocks/projects-carousel/module.json +15 -0
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel-client.tsx +239 -0
- package/vendor/registry/blocks/projects-carousel/ui/minimal/next/projects-carousel.tsx +24 -0
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel-client.tsx +102 -0
- package/vendor/registry/blocks/projects-carousel/ui/shadcn/next/projects-carousel.tsx +24 -0
- package/vendor/registry/blocks/service-detail/module.json +15 -0
- package/vendor/registry/blocks/service-detail/ui/minimal/next/service-detail.tsx +49 -0
- package/vendor/registry/blocks/service-detail/ui/shadcn/next/service-detail.tsx +75 -0
- package/vendor/registry/blocks/service-list/module.json +14 -0
- package/vendor/registry/blocks/service-list/ui/minimal/next/service-list.tsx +103 -0
- package/vendor/registry/blocks/service-list/ui/shadcn/next/service-list.tsx +80 -0
- package/vendor/registry/blocks/service-list-cards/module.json +15 -0
- package/vendor/registry/blocks/service-list-cards/ui/minimal/next/service-list-cards.tsx +124 -0
- package/vendor/registry/blocks/service-list-cards/ui/shadcn/next/service-list-cards.tsx +92 -0
- package/vendor/registry/blocks/site-brand/module.json +13 -0
- package/vendor/registry/blocks/site-brand/ui/minimal/next/site-brand.tsx +61 -0
- package/vendor/registry/blocks/site-brand/ui/shadcn/next/site-brand.tsx +48 -0
- package/vendor/registry/blocks/site-logo/module.json +13 -0
- package/vendor/registry/blocks/site-logo/ui/minimal/next/site-logo.tsx +37 -0
- package/vendor/registry/blocks/site-logo/ui/shadcn/next/site-logo.tsx +34 -0
- package/vendor/registry/blocks/social-links/module.json +13 -0
- package/vendor/registry/blocks/social-links/ui/minimal/next/social-links.tsx +55 -0
- package/vendor/registry/blocks/social-links/ui/shadcn/next/social-links.tsx +46 -0
- package/vendor/registry/blocks/team-detail/module.json +15 -0
- package/vendor/registry/blocks/team-detail/ui/minimal/next/team-detail.tsx +113 -0
- package/vendor/registry/blocks/team-detail/ui/shadcn/next/team-detail.tsx +77 -0
- package/vendor/registry/blocks/team-list/module.json +14 -0
- package/vendor/registry/blocks/team-list/ui/minimal/next/team-list.tsx +113 -0
- package/vendor/registry/blocks/team-list/ui/shadcn/next/team-list.tsx +77 -0
- package/vendor/registry/blocks/team-list-cards/module.json +15 -0
- package/vendor/registry/blocks/team-list-cards/ui/minimal/next/team-list-cards.tsx +111 -0
- package/vendor/registry/blocks/team-list-cards/ui/shadcn/next/team-list-cards.tsx +83 -0
- package/vendor/registry/blocks/testimonials-carousel/module.json +15 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel-client.tsx +230 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/minimal/next/testimonials-carousel.tsx +23 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel-client.tsx +91 -0
- package/vendor/registry/blocks/testimonials-carousel/ui/shadcn/next/testimonials-carousel.tsx +23 -0
- package/vendor/registry/blocks/testimonials-list/module.json +14 -0
- package/vendor/registry/blocks/testimonials-list/ui/minimal/next/testimonials-list.tsx +109 -0
- package/vendor/registry/blocks/testimonials-list/ui/shadcn/next/testimonials-list.tsx +72 -0
- package/vendor/registry/blocks/testimonials-list-cards/module.json +15 -0
- package/vendor/registry/blocks/testimonials-list-cards/ui/minimal/next/testimonials-list-cards.tsx +114 -0
- package/vendor/registry/blocks/testimonials-list-cards/ui/shadcn/next/testimonials-list-cards.tsx +72 -0
- package/vendor/registry/core/languages/policies.json +25 -0
- package/vendor/registry/core/languages/seed.json +16 -0
- package/vendor/registry/core/languages/snapshot.json +94 -0
- package/vendor/registry/modules/blog/access/policies.json +49 -0
- package/vendor/registry/modules/blog/access/policies.multilocale.json +67 -0
- package/vendor/registry/modules/blog/lib.multilocale.ts +552 -0
- package/vendor/registry/modules/blog/lib.ts +346 -0
- package/vendor/registry/modules/blog/module.json +50 -0
- package/vendor/registry/modules/blog/schema/snapshot.json +701 -0
- package/vendor/registry/modules/blog/schema/snapshot.multilocale.json +884 -0
- package/vendor/registry/modules/blog/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/blog/services/assets/ada-lovelace-avatar.jpg +0 -0
- package/vendor/registry/modules/blog/services/assets/hello-from-dkit-cover.jpg +0 -0
- package/vendor/registry/modules/blog/services/seed.json +70 -0
- package/vendor/registry/modules/blog/services/seed.multilocale.json +90 -0
- package/vendor/registry/modules/blog/types.multilocale.ts +96 -0
- package/vendor/registry/modules/blog/types.ts +62 -0
- package/vendor/registry/modules/booking-form/access/policies.json +25 -0
- package/vendor/registry/modules/booking-form/access/policies.multilocale.json +27 -0
- package/vendor/registry/modules/booking-form/lib.multilocale.ts +71 -0
- package/vendor/registry/modules/booking-form/lib.ts +77 -0
- package/vendor/registry/modules/booking-form/module.json +32 -0
- package/vendor/registry/modules/booking-form/schema/snapshot.json +294 -0
- package/vendor/registry/modules/booking-form/schema/snapshot.multilocale.json +467 -0
- package/vendor/registry/modules/booking-form/services/flows.json +19 -0
- package/vendor/registry/modules/booking-form/types.multilocale.ts +29 -0
- package/vendor/registry/modules/booking-form/types.ts +27 -0
- package/vendor/registry/modules/contact-form/access/policies.json +25 -0
- package/vendor/registry/modules/contact-form/access/policies.multilocale.json +27 -0
- package/vendor/registry/modules/contact-form/lib.multilocale.ts +65 -0
- package/vendor/registry/modules/contact-form/lib.ts +67 -0
- package/vendor/registry/modules/contact-form/module.json +32 -0
- package/vendor/registry/modules/contact-form/schema/snapshot.json +193 -0
- package/vendor/registry/modules/contact-form/schema/snapshot.multilocale.json +293 -0
- package/vendor/registry/modules/contact-form/services/flows.json +19 -0
- package/vendor/registry/modules/contact-form/types.multilocale.ts +21 -0
- package/vendor/registry/modules/contact-form/types.ts +19 -0
- package/vendor/registry/modules/faq/access/policies.json +25 -0
- package/vendor/registry/modules/faq/access/policies.multilocale.json +18 -0
- package/vendor/registry/modules/faq/lib.multilocale.ts +120 -0
- package/vendor/registry/modules/faq/lib.ts +73 -0
- package/vendor/registry/modules/faq/module.json +31 -0
- package/vendor/registry/modules/faq/schema/snapshot.json +180 -0
- package/vendor/registry/modules/faq/schema/snapshot.multilocale.json +116 -0
- package/vendor/registry/modules/faq/services/seed.json +38 -0
- package/vendor/registry/modules/faq/services/seed.multilocale.json +32 -0
- package/vendor/registry/modules/faq/types.multilocale.ts +31 -0
- package/vendor/registry/modules/faq/types.ts +17 -0
- package/vendor/registry/modules/navigation/access/policies.json +31 -0
- package/vendor/registry/modules/navigation/access/policies.multilocale.json +51 -0
- package/vendor/registry/modules/navigation/lib.multilocale.ts +198 -0
- package/vendor/registry/modules/navigation/lib.ts +252 -0
- package/vendor/registry/modules/navigation/module.json +46 -0
- package/vendor/registry/modules/navigation/schema/snapshot.json +453 -0
- package/vendor/registry/modules/navigation/schema/snapshot.multilocale.json +864 -0
- package/vendor/registry/modules/navigation/services/seed.json +103 -0
- package/vendor/registry/modules/navigation/services/seed.multilocale.json +88 -0
- package/vendor/registry/modules/navigation/types.multilocale.ts +60 -0
- package/vendor/registry/modules/navigation/types.ts +44 -0
- package/vendor/registry/modules/pages/access/policies.json +25 -0
- package/vendor/registry/modules/pages/access/policies.multilocale.json +18 -0
- package/vendor/registry/modules/pages/lib.multilocale.ts +166 -0
- package/vendor/registry/modules/pages/lib.ts +123 -0
- package/vendor/registry/modules/pages/module.json +39 -0
- package/vendor/registry/modules/pages/schema/snapshot.json +247 -0
- package/vendor/registry/modules/pages/schema/snapshot.multilocale.json +187 -0
- package/vendor/registry/modules/pages/services/seed.json +24 -0
- package/vendor/registry/modules/pages/services/seed.multilocale.json +34 -0
- package/vendor/registry/modules/pages/types.multilocale.ts +37 -0
- package/vendor/registry/modules/pages/types.ts +21 -0
- package/vendor/registry/modules/projects/access/policies.json +31 -0
- package/vendor/registry/modules/projects/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/projects/lib.multilocale.ts +111 -0
- package/vendor/registry/modules/projects/lib.ts +138 -0
- package/vendor/registry/modules/projects/module.json +48 -0
- package/vendor/registry/modules/projects/schema/snapshot.json +348 -0
- package/vendor/registry/modules/projects/schema/snapshot.multilocale.json +577 -0
- package/vendor/registry/modules/projects/services/ATTRIBUTION.md +7 -0
- package/vendor/registry/modules/projects/services/assets/brand-identity-cover.jpg +0 -0
- package/vendor/registry/modules/projects/services/seed.json +40 -0
- package/vendor/registry/modules/projects/services/seed.multilocale.json +31 -0
- package/vendor/registry/modules/projects/types.multilocale.ts +38 -0
- package/vendor/registry/modules/projects/types.ts +28 -0
- package/vendor/registry/modules/services/access/policies.json +31 -0
- package/vendor/registry/modules/services/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/services/lib.multilocale.ts +109 -0
- package/vendor/registry/modules/services/lib.ts +134 -0
- package/vendor/registry/modules/services/module.json +47 -0
- package/vendor/registry/modules/services/schema/snapshot.json +305 -0
- package/vendor/registry/modules/services/schema/snapshot.multilocale.json +510 -0
- package/vendor/registry/modules/services/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/services/services/assets/design-development.jpg +0 -0
- package/vendor/registry/modules/services/services/assets/strategy-consulting.jpg +0 -0
- package/vendor/registry/modules/services/services/seed.json +44 -0
- package/vendor/registry/modules/services/services/seed.multilocale.json +31 -0
- package/vendor/registry/modules/services/types.multilocale.ts +36 -0
- package/vendor/registry/modules/services/types.ts +26 -0
- package/vendor/registry/modules/settings/access/policies.json +31 -0
- package/vendor/registry/modules/settings/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/settings/lib.multilocale.ts +158 -0
- package/vendor/registry/modules/settings/lib.ts +259 -0
- package/vendor/registry/modules/settings/module.json +33 -0
- package/vendor/registry/modules/settings/schema/snapshot.json +315 -0
- package/vendor/registry/modules/settings/schema/snapshot.multilocale.json +586 -0
- package/vendor/registry/modules/settings/services/assets/dkit-logo.svg +4 -0
- package/vendor/registry/modules/settings/services/seed.json +31 -0
- package/vendor/registry/modules/settings/services/seed.multilocale.json +42 -0
- package/vendor/registry/modules/settings/types.multilocale.ts +72 -0
- package/vendor/registry/modules/settings/types.ts +94 -0
- package/vendor/registry/modules/team/access/policies.json +31 -0
- package/vendor/registry/modules/team/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/team/lib.multilocale.ts +88 -0
- package/vendor/registry/modules/team/lib.ts +120 -0
- package/vendor/registry/modules/team/module.json +47 -0
- package/vendor/registry/modules/team/schema/snapshot.json +295 -0
- package/vendor/registry/modules/team/schema/snapshot.multilocale.json +525 -0
- package/vendor/registry/modules/team/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/team/services/assets/morgan-lee-photo.jpg +0 -0
- package/vendor/registry/modules/team/services/assets/taylor-kim-photo.jpg +0 -0
- package/vendor/registry/modules/team/services/seed.json +52 -0
- package/vendor/registry/modules/team/services/seed.multilocale.json +30 -0
- package/vendor/registry/modules/team/types.multilocale.ts +33 -0
- package/vendor/registry/modules/team/types.ts +27 -0
- package/vendor/registry/modules/testimonials/access/policies.json +31 -0
- package/vendor/registry/modules/testimonials/access/policies.multilocale.json +43 -0
- package/vendor/registry/modules/testimonials/lib.multilocale.ts +93 -0
- package/vendor/registry/modules/testimonials/lib.ts +85 -0
- package/vendor/registry/modules/testimonials/module.json +41 -0
- package/vendor/registry/modules/testimonials/schema/snapshot.json +248 -0
- package/vendor/registry/modules/testimonials/schema/snapshot.multilocale.json +462 -0
- package/vendor/registry/modules/testimonials/services/ATTRIBUTION.md +8 -0
- package/vendor/registry/modules/testimonials/services/assets/jane-doe-avatar.jpg +0 -0
- package/vendor/registry/modules/testimonials/services/assets/sample-author-avatar.jpg +0 -0
- package/vendor/registry/modules/testimonials/services/seed.json +49 -0
- package/vendor/registry/modules/testimonials/services/seed.multilocale.json +30 -0
- package/vendor/registry/modules/testimonials/types.multilocale.ts +27 -0
- package/vendor/registry/modules/testimonials/types.ts +22 -0
- package/vendor/registry/registry.json +832 -0
- package/vendor/registry/shared/helpers.ts +16 -0
- package/vendor/registry/shared/i18n.ts +74 -0
- package/vendor/registry/shared/minimal.css +83 -0
- package/vendor/registry/shared/paths.ts +50 -0
- package/vendor/registry/shared/prose.css +113 -0
- package/vendor/registry/tsconfig.json +49 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Directus query helpers for module services.
|
|
3
|
+
* Installed as `lib/dkit/helpers.ts` on init/add.
|
|
4
|
+
* Safe to edit.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Default status=published; pass `status: null` to skip the filter. */
|
|
8
|
+
export function statusFilter(status: string | null | undefined) {
|
|
9
|
+
if (status === null) return undefined;
|
|
10
|
+
return { status: { _eq: status ?? "published" } };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Directus rejects `limit=undefined` — only send a finite number. */
|
|
14
|
+
export function queryLimit(limit: number | undefined): number | undefined {
|
|
15
|
+
return typeof limit === "number" && Number.isFinite(limit) ? limit : undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Directus content-locale helpers.
|
|
3
|
+
* Installed as `lib/dkit/i18n.ts` when project `multilocale` is on.
|
|
4
|
+
* Safe to edit.
|
|
5
|
+
*/
|
|
6
|
+
import { defaultLocale } from "@/lib/dkit/config";
|
|
7
|
+
import { getRequestLocale } from "@/lib/dkit/locale";
|
|
8
|
+
|
|
9
|
+
export function translationCode(
|
|
10
|
+
languages_code: string | { code?: string } | null | undefined,
|
|
11
|
+
): string | undefined {
|
|
12
|
+
if (typeof languages_code === "string") return languages_code;
|
|
13
|
+
return languages_code?.code;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Exact locale only — never fall back to another language's row. */
|
|
17
|
+
export function pickTranslation<
|
|
18
|
+
T extends { languages_code?: string | { code?: string } },
|
|
19
|
+
>(rows: T[] | null | undefined, locale: string): T | undefined {
|
|
20
|
+
if (!Array.isArray(rows) || rows.length === 0) return undefined;
|
|
21
|
+
return rows.find((r) => translationCode(r.languages_code) === locale);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Resolve explicit locale → request adapter → project defaultLocale. */
|
|
25
|
+
export async function resolveLocale(
|
|
26
|
+
explicit?: string | null,
|
|
27
|
+
): Promise<string> {
|
|
28
|
+
if (explicit) return explicit;
|
|
29
|
+
try {
|
|
30
|
+
const req = await getRequestLocale();
|
|
31
|
+
if (req) return req;
|
|
32
|
+
} catch {
|
|
33
|
+
/* locale helper unavailable */
|
|
34
|
+
}
|
|
35
|
+
return defaultLocale;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Filter: item must have a translation for `locale` with every listed field
|
|
40
|
+
* non-empty. Defaults to title + slug (posts, pages, projects, services).
|
|
41
|
+
*/
|
|
42
|
+
export function requireLocaleTranslation(
|
|
43
|
+
locale: string,
|
|
44
|
+
fields: string[] = ["title", "slug"],
|
|
45
|
+
) {
|
|
46
|
+
return {
|
|
47
|
+
translations: {
|
|
48
|
+
_and: [
|
|
49
|
+
{ languages_code: { _eq: locale } },
|
|
50
|
+
...fields.map((field) => ({ [field]: { _nempty: true } })),
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Deep query: only load translation rows for this locale. */
|
|
57
|
+
export function translationsDeepFilter(locale: string) {
|
|
58
|
+
return {
|
|
59
|
+
translations: { _filter: { languages_code: { _eq: locale } } },
|
|
60
|
+
} as Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* True when every listed field is a non-empty string on the translation row.
|
|
65
|
+
* Defaults to title + slug.
|
|
66
|
+
*/
|
|
67
|
+
export function isUsableTranslation(
|
|
68
|
+
trans: object | null | undefined,
|
|
69
|
+
fields: string[] = ["title", "slug"],
|
|
70
|
+
): boolean {
|
|
71
|
+
if (!trans) return false;
|
|
72
|
+
const row = trans as Record<string, unknown>;
|
|
73
|
+
return fields.every((f) => Boolean(String(row[f] ?? "").trim()));
|
|
74
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared minimal-kit primitives for dkit UI blocks.
|
|
3
|
+
* Import once in your app CSS (alongside prose.css). Override tokens below
|
|
4
|
+
* to match your brand.
|
|
5
|
+
*
|
|
6
|
+
* Uses shadcn CSS variables when present (--foreground, --muted-foreground,
|
|
7
|
+
* --primary, --border) with sensible fallbacks for bare projects.
|
|
8
|
+
*
|
|
9
|
+
* Classes: .dkit-card, .dkit-card--media, .dkit-card__body,
|
|
10
|
+
* .dkit-label, .dkit-headline, .dkit-subtitle, .dkit-link
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
--dkit-fg: var(--foreground, #1c1917);
|
|
15
|
+
--dkit-muted: var(--muted-foreground, #78716c);
|
|
16
|
+
--dkit-accent: var(--primary, #0f766e);
|
|
17
|
+
--dkit-border: var(--border, #ddd);
|
|
18
|
+
--dkit-border-hover: color-mix(in oklab, var(--dkit-fg) 35%, transparent);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dkit-card {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
height: 100%;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 1.5rem;
|
|
28
|
+
border: 1px solid var(--dkit-border);
|
|
29
|
+
border-radius: 0;
|
|
30
|
+
color: inherit;
|
|
31
|
+
text-decoration: none;
|
|
32
|
+
background: transparent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dkit-card:hover {
|
|
36
|
+
border-color: var(--dkit-border-hover, #999);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.dkit-card--media {
|
|
40
|
+
padding: 0;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dkit-card__body {
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
flex: 1;
|
|
49
|
+
padding: 0.75rem 1rem 1rem;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.dkit-label {
|
|
54
|
+
margin: 0;
|
|
55
|
+
font-size: 0.75rem;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
letter-spacing: 0.2em;
|
|
58
|
+
text-transform: uppercase;
|
|
59
|
+
color: var(--dkit-accent);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dkit-headline {
|
|
63
|
+
margin: 0.5rem 0 0;
|
|
64
|
+
font-size: 1.75rem;
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
letter-spacing: -0.025em;
|
|
67
|
+
color: var(--dkit-fg);
|
|
68
|
+
line-height: 1.2;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.dkit-subtitle {
|
|
72
|
+
margin: 0.5rem 0 0;
|
|
73
|
+
font-size: 1rem;
|
|
74
|
+
line-height: 1.5;
|
|
75
|
+
color: var(--dkit-muted);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.dkit-link {
|
|
79
|
+
color: var(--dkit-accent);
|
|
80
|
+
font-size: 0.875rem;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
text-decoration: none;
|
|
83
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module URL helpers.
|
|
3
|
+
* Installed as `lib/dkit/paths.ts`. Safe to edit.
|
|
4
|
+
*
|
|
5
|
+
* Prefer `moduleHref` in UI blocks instead of prop-drilling `basePath` from routes.
|
|
6
|
+
*/
|
|
7
|
+
import {
|
|
8
|
+
joinModulePath,
|
|
9
|
+
moduleBasePath,
|
|
10
|
+
multilocale,
|
|
11
|
+
} from "@/lib/dkit/config";
|
|
12
|
+
|
|
13
|
+
/** Sync join of module basePath + segments (no locale prefix). */
|
|
14
|
+
export function modulePath(moduleId: string, ...parts: string[]): string {
|
|
15
|
+
return joinModulePath(moduleBasePath(moduleId), ...parts);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Prefix a path with the active request locale when multilocales is on.
|
|
20
|
+
* `/blog/post` → `/en-US/blog/post`
|
|
21
|
+
*/
|
|
22
|
+
export async function withLocalePrefix(pathname: string): Promise<string> {
|
|
23
|
+
const path =
|
|
24
|
+
!pathname || pathname === "/"
|
|
25
|
+
? "/"
|
|
26
|
+
: pathname.startsWith("/")
|
|
27
|
+
? pathname
|
|
28
|
+
: `/${pathname}`;
|
|
29
|
+
if (!multilocale) return path;
|
|
30
|
+
try {
|
|
31
|
+
const { getRequestLocale } = await import("@/lib/dkit/locale");
|
|
32
|
+
const locale = await getRequestLocale();
|
|
33
|
+
if (!locale) return path;
|
|
34
|
+
if (path === "/") return `/${locale}`;
|
|
35
|
+
return `/${locale}${path}`;
|
|
36
|
+
} catch {
|
|
37
|
+
return path;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Locale-aware href for a module route.
|
|
43
|
+
* `moduleHref("blog", slug)` → `/blog/slug` or `/en-US/blog/slug` when multilocales.
|
|
44
|
+
*/
|
|
45
|
+
export async function moduleHref(
|
|
46
|
+
moduleId: string,
|
|
47
|
+
...parts: string[]
|
|
48
|
+
): Promise<string> {
|
|
49
|
+
return withLocalePrefix(modulePath(moduleId, ...parts));
|
|
50
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared rich-text styles for dkit content modules (blog, pages, page-builder, …).
|
|
3
|
+
* Import once in your app CSS. Override tokens below to match your brand.
|
|
4
|
+
*
|
|
5
|
+
* Uses shadcn / shadcn-vue CSS variables when present
|
|
6
|
+
* (--foreground, --muted-foreground, --primary, --border, --muted, --radius)
|
|
7
|
+
* with sensible fallbacks for bare projects.
|
|
8
|
+
*
|
|
9
|
+
* Contract: wrap Directus HTML in an element with class `dkit-prose`
|
|
10
|
+
* (optional modifier: `dkit-prose--compact`).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
.dkit-prose {
|
|
14
|
+
--dkit-prose-body: var(--foreground, #44403c);
|
|
15
|
+
--dkit-prose-heading: var(--foreground, #1c1917);
|
|
16
|
+
--dkit-prose-muted: var(--muted-foreground, #78716c);
|
|
17
|
+
--dkit-prose-link: var(--primary, #00c769);
|
|
18
|
+
--dkit-prose-quote-border: color-mix(
|
|
19
|
+
in oklab,
|
|
20
|
+
var(--primary, #00c769) 40%,
|
|
21
|
+
transparent
|
|
22
|
+
);
|
|
23
|
+
--dkit-prose-code-bg: var(--muted, color-mix(in oklab, var(--foreground, #1c1917) 6%, transparent));
|
|
24
|
+
--dkit-prose-radius: var(--radius, 0.5rem);
|
|
25
|
+
|
|
26
|
+
color: var(--dkit-prose-body);
|
|
27
|
+
font-size: 1.05rem;
|
|
28
|
+
line-height: 1.75;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dkit-prose--compact {
|
|
32
|
+
font-size: 1rem;
|
|
33
|
+
line-height: 1.7;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dkit-prose :where(p) {
|
|
37
|
+
margin-bottom: 1rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dkit-prose :where(a) {
|
|
41
|
+
color: var(--dkit-prose-link);
|
|
42
|
+
text-decoration: underline;
|
|
43
|
+
text-underline-offset: 2px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dkit-prose :where(h2) {
|
|
47
|
+
margin-top: 2.5rem;
|
|
48
|
+
font-size: 1.5rem;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
letter-spacing: -0.025em;
|
|
51
|
+
color: var(--dkit-prose-heading);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dkit-prose :where(h3) {
|
|
55
|
+
margin-top: 2rem;
|
|
56
|
+
font-size: 1.25rem;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
color: var(--dkit-prose-heading);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dkit-prose :where(blockquote) {
|
|
62
|
+
border-left: 2px solid var(--dkit-prose-quote-border);
|
|
63
|
+
padding-left: 1rem;
|
|
64
|
+
color: var(--dkit-prose-muted);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.dkit-prose :where(ul) {
|
|
68
|
+
margin-bottom: 1rem;
|
|
69
|
+
padding-left: 1.25rem;
|
|
70
|
+
list-style: disc;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.dkit-prose :where(ol) {
|
|
74
|
+
margin-bottom: 1rem;
|
|
75
|
+
padding-left: 1.25rem;
|
|
76
|
+
list-style: decimal;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dkit-prose :where(li) {
|
|
80
|
+
margin-left: 0.25rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dkit-prose :where(img) {
|
|
84
|
+
max-width: 100%;
|
|
85
|
+
height: auto;
|
|
86
|
+
border-radius: calc(var(--dkit-prose-radius) + 0.25rem);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.dkit-prose :where(pre) {
|
|
90
|
+
overflow-x: auto;
|
|
91
|
+
border-radius: var(--dkit-prose-radius);
|
|
92
|
+
background: var(--dkit-prose-code-bg);
|
|
93
|
+
padding: 1rem;
|
|
94
|
+
font-size: 0.875rem;
|
|
95
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
96
|
+
line-height: 1.55;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dkit-prose :where(:not(pre) > code) {
|
|
100
|
+
border-radius: calc(var(--dkit-prose-radius) - 0.125rem);
|
|
101
|
+
background: var(--dkit-prose-code-bg);
|
|
102
|
+
padding: 0.15em 0.4em;
|
|
103
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
104
|
+
font-size: 0.8125em;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.dkit-prose :where(pre code) {
|
|
109
|
+
background: transparent;
|
|
110
|
+
padding: 0;
|
|
111
|
+
font-size: inherit;
|
|
112
|
+
font-weight: inherit;
|
|
113
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"jsx": "preserve",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"allowJs": false,
|
|
15
|
+
"baseUrl": ".",
|
|
16
|
+
"paths": {
|
|
17
|
+
"@/lib/dkit/client": ["./ts-shims/client.ts"],
|
|
18
|
+
"@/lib/dkit/config": ["./ts-shims/config.ts"],
|
|
19
|
+
"@/lib/dkit/helpers": ["./shared/helpers.ts"],
|
|
20
|
+
"@/lib/dkit/i18n": ["./shared/i18n.ts"],
|
|
21
|
+
"@/lib/dkit/locale": ["./ts-shims/locale.ts"],
|
|
22
|
+
"@/lib/dkit/page-builder-peers": ["./ts-shims/page-builder-peers.ts"],
|
|
23
|
+
"@/lib/dkit/blog": ["./modules/blog/lib.ts"],
|
|
24
|
+
"@/lib/dkit/pages": ["./modules/pages/lib.ts"],
|
|
25
|
+
"@/lib/dkit/page-builder": ["./modules/page-builder/lib.ts"],
|
|
26
|
+
"@/lib/dkit/contact-form": ["./modules/contact-form/lib.ts"],
|
|
27
|
+
"@/lib/dkit/booking-form": ["./modules/booking-form/lib.ts"],
|
|
28
|
+
"@/lib/dkit/settings": ["./modules/settings/lib.ts"],
|
|
29
|
+
"@/lib/dkit/navigation": ["./modules/navigation/lib.ts"],
|
|
30
|
+
"@/lib/dkit/faq": ["./modules/faq/lib.ts"],
|
|
31
|
+
"@/lib/dkit/projects": ["./modules/projects/lib.ts"],
|
|
32
|
+
"@/lib/dkit/services": ["./modules/services/lib.ts"],
|
|
33
|
+
"@/lib/dkit/team": ["./modules/team/lib.ts"],
|
|
34
|
+
"@/lib/dkit/testimonials": ["./modules/testimonials/lib.ts"],
|
|
35
|
+
"@/lib/utils": ["./ts-shims/utils.ts"],
|
|
36
|
+
"@/components/ui/*": ["./ui-kits/shadcn/next/*"]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"include": [
|
|
40
|
+
"blocks/**/*.ts",
|
|
41
|
+
"blocks/**/*.tsx",
|
|
42
|
+
"modules/**/*.ts",
|
|
43
|
+
"shared/**/*.ts",
|
|
44
|
+
"ui-kits/**/*.ts",
|
|
45
|
+
"ui-kits/**/*.tsx",
|
|
46
|
+
"ts-shims/**/*.ts"
|
|
47
|
+
],
|
|
48
|
+
"exclude": ["blocks/**/nuxt/**", "ui-kits/**/nuxt/**"]
|
|
49
|
+
}
|