@velastack/cms 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 (99) hide show
  1. package/README.md +66 -43
  2. package/dist/components/admin-bar/admin-bar.css +1 -1
  3. package/dist/components/admin-bar/field-input.svelte +20 -1
  4. package/dist/components/admin-bar/field-input.svelte.d.ts +2 -1
  5. package/dist/components/admin-bar/fields-form.svelte +218 -0
  6. package/dist/components/admin-bar/fields-form.svelte.d.ts +16 -0
  7. package/dist/components/admin-bar/link-input.svelte +102 -0
  8. package/dist/components/admin-bar/link-input.svelte.d.ts +9 -0
  9. package/dist/components/admin-bar/list-field.svelte +93 -0
  10. package/dist/components/admin-bar/list-field.svelte.d.ts +20 -0
  11. package/dist/components/admin-bar/locales-panel.svelte +1 -1
  12. package/dist/components/admin-bar/page-options.d.ts +24 -0
  13. package/dist/components/admin-bar/page-options.js +53 -0
  14. package/dist/components/admin-bar/rich-text-input.svelte +92 -0
  15. package/dist/components/admin-bar/rich-text-input.svelte.d.ts +9 -0
  16. package/dist/components/admin-bar/structured-editor-popover.svelte +15 -6
  17. package/dist/components/cms/cms-collection.svelte +46 -0
  18. package/dist/components/cms/cms-collection.svelte.d.ts +25 -0
  19. package/dist/components/cms/cms-contact.svelte +26 -0
  20. package/dist/components/cms/cms-contact.svelte.d.ts +14 -0
  21. package/dist/components/cms/cms-faq.svelte +22 -0
  22. package/dist/components/cms/cms-faq.svelte.d.ts +15 -0
  23. package/dist/components/cms/cms-gallery.svelte +31 -0
  24. package/dist/components/cms/cms-gallery.svelte.d.ts +16 -0
  25. package/dist/components/cms/cms-hours-editable.svelte +160 -0
  26. package/dist/components/cms/cms-hours-editable.svelte.d.ts +17 -0
  27. package/dist/components/cms/cms-hours.svelte +42 -0
  28. package/dist/components/cms/cms-hours.svelte.d.ts +19 -0
  29. package/dist/components/cms/cms-image.svelte +3 -25
  30. package/dist/components/cms/cms-image.svelte.d.ts +3 -11
  31. package/dist/components/cms/cms-link-editable.svelte +4 -60
  32. package/dist/components/cms/cms-link.svelte +3 -23
  33. package/dist/components/cms/cms-link.svelte.d.ts +3 -10
  34. package/dist/components/cms/cms-logos.svelte +29 -0
  35. package/dist/components/cms/cms-logos.svelte.d.ts +16 -0
  36. package/dist/components/cms/cms-nav.svelte +22 -0
  37. package/dist/components/cms/cms-nav.svelte.d.ts +15 -0
  38. package/dist/components/cms/cms-pricing.svelte +36 -0
  39. package/dist/components/cms/cms-pricing.svelte.d.ts +14 -0
  40. package/dist/components/cms/cms-schedule.svelte +35 -0
  41. package/dist/components/cms/cms-schedule.svelte.d.ts +16 -0
  42. package/dist/components/cms/cms-social-links.svelte +35 -0
  43. package/dist/components/cms/cms-social-links.svelte.d.ts +15 -0
  44. package/dist/components/cms/cms-stats.svelte +31 -0
  45. package/dist/components/cms/cms-stats.svelte.d.ts +16 -0
  46. package/dist/components/cms/cms-steps.svelte +31 -0
  47. package/dist/components/cms/cms-steps.svelte.d.ts +16 -0
  48. package/dist/components/cms/cms-structured-editable.svelte +29 -0
  49. package/dist/components/cms/{cms-repeater-editable.svelte.d.ts → cms-structured-editable.svelte.d.ts} +12 -8
  50. package/dist/components/cms/cms-structured.svelte +50 -0
  51. package/dist/components/cms/cms-structured.svelte.d.ts +49 -0
  52. package/dist/components/cms/cms-team.svelte +22 -0
  53. package/dist/components/cms/cms-team.svelte.d.ts +15 -0
  54. package/dist/components/cms/cms-testimonials.svelte +36 -0
  55. package/dist/components/cms/cms-testimonials.svelte.d.ts +15 -0
  56. package/dist/components/cms/cms-timeline.svelte +35 -0
  57. package/dist/components/cms/cms-timeline.svelte.d.ts +16 -0
  58. package/dist/components/cms/index.d.ts +15 -1
  59. package/dist/components/cms/index.js +15 -1
  60. package/dist/core/shapes/collection.d.ts +60 -0
  61. package/dist/core/shapes/collection.js +194 -0
  62. package/dist/core/shapes/contact.d.ts +70 -0
  63. package/dist/core/shapes/contact.js +214 -0
  64. package/dist/core/shapes/faq.d.ts +12 -0
  65. package/dist/core/shapes/faq.js +48 -0
  66. package/dist/core/shapes/form.d.ts +46 -0
  67. package/dist/core/shapes/form.js +7 -0
  68. package/dist/core/shapes/hours.d.ts +91 -0
  69. package/dist/core/shapes/hours.js +325 -0
  70. package/dist/core/shapes/image.d.ts +15 -0
  71. package/dist/core/shapes/image.js +27 -0
  72. package/dist/core/shapes/index.d.ts +31 -0
  73. package/dist/core/shapes/index.js +13 -0
  74. package/dist/core/shapes/link.d.ts +15 -0
  75. package/dist/core/shapes/link.js +42 -0
  76. package/dist/core/shapes/nav.d.ts +21 -0
  77. package/dist/core/shapes/nav.js +71 -0
  78. package/dist/core/shapes/presets.d.ts +65 -0
  79. package/dist/core/shapes/presets.js +152 -0
  80. package/dist/core/shapes/pricing.d.ts +40 -0
  81. package/dist/core/shapes/pricing.js +115 -0
  82. package/dist/core/shapes/social-links.d.ts +19 -0
  83. package/dist/core/shapes/social-links.js +83 -0
  84. package/dist/core/shapes/team.d.ts +22 -0
  85. package/dist/core/shapes/team.js +70 -0
  86. package/dist/core/shapes/testimonials.d.ts +24 -0
  87. package/dist/core/shapes/testimonials.js +86 -0
  88. package/dist/{components/cms → core}/structured-registry.d.ts +2 -2
  89. package/dist/core/structured.d.ts +33 -10
  90. package/dist/core/structured.js +98 -47
  91. package/dist/editor.d.ts +4 -0
  92. package/dist/editor.js +4 -0
  93. package/dist/index.d.ts +22 -8
  94. package/dist/index.js +24 -5
  95. package/package.json +1 -1
  96. package/dist/components/cms/cms-repeater-editable.svelte +0 -137
  97. package/dist/components/cms/cms-repeater.svelte +0 -52
  98. package/dist/components/cms/cms-repeater.svelte.d.ts +0 -31
  99. /package/dist/{components/cms → core}/structured-registry.js +0 -0
@@ -0,0 +1,29 @@
1
+ <script lang="ts" module>
2
+ /** `CmsLogos` preset: logo image, name, optional link. */
3
+ export type { CmsLogosValue, LogoItem, LogoItemView } from '../../core/shapes/presets.js';
4
+ export { cmsLogos, logosView } from '../../core/shapes/presets.js';
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import type { Snippet } from 'svelte';
9
+ import Structured from './cms-structured.svelte';
10
+ import {
11
+ cmsLogos,
12
+ logosView,
13
+ type CmsLogosValue,
14
+ type LogoItem,
15
+ type LogoItemView
16
+ } from '../../core/shapes/presets.js';
17
+
18
+ type Props = {
19
+ name: string;
20
+ scope?: string;
21
+ /** The full value, or a bare item list. */
22
+ fallback?: Partial<CmsLogosValue> | Partial<LogoItem>[];
23
+ value?: unknown;
24
+ children: Snippet<[LogoItemView[]]>;
25
+ };
26
+ let { name, scope, fallback, value, children }: Props = $props();
27
+ </script>
28
+
29
+ <Structured schema={cmsLogos} {name} {scope} {fallback} {value} view={logosView} {children} />
@@ -0,0 +1,16 @@
1
+ /** `CmsLogos` preset: logo image, name, optional link. */
2
+ export type { CmsLogosValue, LogoItem, LogoItemView } from '../../core/shapes/presets.js';
3
+ export { cmsLogos, logosView } from '../../core/shapes/presets.js';
4
+ import type { Snippet } from 'svelte';
5
+ import { type CmsLogosValue, type LogoItem, type LogoItemView } from '../../core/shapes/presets.js';
6
+ type Props = {
7
+ name: string;
8
+ scope?: string;
9
+ /** The full value, or a bare item list. */
10
+ fallback?: Partial<CmsLogosValue> | Partial<LogoItem>[];
11
+ value?: unknown;
12
+ children: Snippet<[LogoItemView[]]>;
13
+ };
14
+ declare const CmsLogos: import("svelte").Component<Props, {}, "">;
15
+ type CmsLogos = ReturnType<typeof CmsLogos>;
16
+ export default CmsLogos;
@@ -0,0 +1,22 @@
1
+ <script lang="ts" module>
2
+ /** `CmsNav`: site navigation. Lives in the root layout; other places read it with `scope="root"`. */
3
+ export * from '../../core/shapes/nav.js';
4
+ </script>
5
+
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+ import Structured from './cms-structured.svelte';
9
+ import { cmsNav, navView, type CmsNavValue, type NavItemView } from '../../core/shapes/nav.js';
10
+
11
+ type Props = {
12
+ name: string;
13
+ scope?: string;
14
+ /** The full value, or a bare item list. */
15
+ fallback?: Partial<CmsNavValue> | Array<Partial<CmsNavValue['items'][number]>>;
16
+ value?: unknown;
17
+ children: Snippet<[NavItemView[]]>;
18
+ };
19
+ let { name, scope, fallback, value, children }: Props = $props();
20
+ </script>
21
+
22
+ <Structured schema={cmsNav} {name} {scope} {fallback} {value} view={navView} {children} />
@@ -0,0 +1,15 @@
1
+ /** `CmsNav`: site navigation. Lives in the root layout; other places read it with `scope="root"`. */
2
+ export * from '../../core/shapes/nav.js';
3
+ import type { Snippet } from 'svelte';
4
+ import { type CmsNavValue, type NavItemView } from '../../core/shapes/nav.js';
5
+ type Props = {
6
+ name: string;
7
+ scope?: string;
8
+ /** The full value, or a bare item list. */
9
+ fallback?: Partial<CmsNavValue> | Array<Partial<CmsNavValue['items'][number]>>;
10
+ value?: unknown;
11
+ children: Snippet<[NavItemView[]]>;
12
+ };
13
+ declare const CmsNav: import("svelte").Component<Props, {}, "">;
14
+ type CmsNav = ReturnType<typeof CmsNav>;
15
+ export default CmsNav;
@@ -0,0 +1,36 @@
1
+ <script lang="ts" module>
2
+ /** `CmsPricing`: tiers with a feature checklist, formatted in the visitor's locale. */
3
+ export * from '../../core/shapes/pricing.js';
4
+ </script>
5
+
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+ import Structured from './cms-structured.svelte';
9
+ import { cmsStore } from './cms-store.svelte.js';
10
+ import {
11
+ cmsPricing,
12
+ pricingView,
13
+ type CmsPricingValue,
14
+ type PricingTierView
15
+ } from '../../core/shapes/pricing.js';
16
+
17
+ type Props = {
18
+ name: string;
19
+ scope?: string;
20
+ fallback?: CmsPricingValue;
21
+ value?: unknown;
22
+ children: Snippet<[PricingTierView[]]>;
23
+ };
24
+ let { name, scope, fallback, value, children }: Props = $props();
25
+ const locale = $derived(cmsStore.activeLocale || 'en');
26
+ </script>
27
+
28
+ <Structured
29
+ schema={cmsPricing}
30
+ {name}
31
+ {scope}
32
+ {fallback}
33
+ {value}
34
+ view={(v: CmsPricingValue) => pricingView(v, locale)}
35
+ {children}
36
+ />
@@ -0,0 +1,14 @@
1
+ /** `CmsPricing`: tiers with a feature checklist, formatted in the visitor's locale. */
2
+ export * from '../../core/shapes/pricing.js';
3
+ import type { Snippet } from 'svelte';
4
+ import { type CmsPricingValue, type PricingTierView } from '../../core/shapes/pricing.js';
5
+ type Props = {
6
+ name: string;
7
+ scope?: string;
8
+ fallback?: CmsPricingValue;
9
+ value?: unknown;
10
+ children: Snippet<[PricingTierView[]]>;
11
+ };
12
+ declare const CmsPricing: import("svelte").Component<Props, {}, "">;
13
+ type CmsPricing = ReturnType<typeof CmsPricing>;
14
+ export default CmsPricing;
@@ -0,0 +1,35 @@
1
+ <script lang="ts" module>
2
+ /** `CmsSchedule` preset: day, time, title, body, location. `scheduleByDay` groups them. */
3
+ export type { CmsScheduleValue, ScheduleItem } from '../../core/shapes/presets.js';
4
+ export { cmsSchedule, scheduleByDay } from '../../core/shapes/presets.js';
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import type { Snippet } from 'svelte';
9
+ import Structured from './cms-structured.svelte';
10
+ import {
11
+ cmsSchedule,
12
+ type CmsScheduleValue,
13
+ type ScheduleItem
14
+ } from '../../core/shapes/presets.js';
15
+
16
+ type Props = {
17
+ name: string;
18
+ scope?: string;
19
+ /** The full value, or a bare item list. */
20
+ fallback?: Partial<CmsScheduleValue> | Partial<ScheduleItem>[];
21
+ value?: unknown;
22
+ children: Snippet<[ScheduleItem[]]>;
23
+ };
24
+ let { name, scope, fallback, value, children }: Props = $props();
25
+ </script>
26
+
27
+ <Structured
28
+ schema={cmsSchedule}
29
+ {name}
30
+ {scope}
31
+ {fallback}
32
+ {value}
33
+ view={(v: CmsScheduleValue) => v.items}
34
+ {children}
35
+ />
@@ -0,0 +1,16 @@
1
+ /** `CmsSchedule` preset: day, time, title, body, location. `scheduleByDay` groups them. */
2
+ export type { CmsScheduleValue, ScheduleItem } from '../../core/shapes/presets.js';
3
+ export { cmsSchedule, scheduleByDay } from '../../core/shapes/presets.js';
4
+ import type { Snippet } from 'svelte';
5
+ import { type CmsScheduleValue, type ScheduleItem } from '../../core/shapes/presets.js';
6
+ type Props = {
7
+ name: string;
8
+ scope?: string;
9
+ /** The full value, or a bare item list. */
10
+ fallback?: Partial<CmsScheduleValue> | Partial<ScheduleItem>[];
11
+ value?: unknown;
12
+ children: Snippet<[ScheduleItem[]]>;
13
+ };
14
+ declare const CmsSchedule: import("svelte").Component<Props, {}, "">;
15
+ type CmsSchedule = ReturnType<typeof CmsSchedule>;
16
+ export default CmsSchedule;
@@ -0,0 +1,35 @@
1
+ <script lang="ts" module>
2
+ /** `CmsSocialLinks`: profile links; the template supplies the icons. */
3
+ export * from '../../core/shapes/social-links.js';
4
+ </script>
5
+
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+ import Structured from './cms-structured.svelte';
9
+ import {
10
+ cmsSocialLinks,
11
+ socialLinksView,
12
+ type CmsSocialLinksValue,
13
+ type SocialLinkView
14
+ } from '../../core/shapes/social-links.js';
15
+
16
+ type Props = {
17
+ name: string;
18
+ scope?: string;
19
+ /** The full value, or a bare item list. */
20
+ fallback?: Partial<CmsSocialLinksValue> | Array<Partial<CmsSocialLinksValue['items'][number]>>;
21
+ value?: unknown;
22
+ children: Snippet<[SocialLinkView[]]>;
23
+ };
24
+ let { name, scope, fallback, value, children }: Props = $props();
25
+ </script>
26
+
27
+ <Structured
28
+ schema={cmsSocialLinks}
29
+ {name}
30
+ {scope}
31
+ {fallback}
32
+ {value}
33
+ view={socialLinksView}
34
+ {children}
35
+ />
@@ -0,0 +1,15 @@
1
+ /** `CmsSocialLinks`: profile links; the template supplies the icons. */
2
+ export * from '../../core/shapes/social-links.js';
3
+ import type { Snippet } from 'svelte';
4
+ import { type CmsSocialLinksValue, type SocialLinkView } from '../../core/shapes/social-links.js';
5
+ type Props = {
6
+ name: string;
7
+ scope?: string;
8
+ /** The full value, or a bare item list. */
9
+ fallback?: Partial<CmsSocialLinksValue> | Array<Partial<CmsSocialLinksValue['items'][number]>>;
10
+ value?: unknown;
11
+ children: Snippet<[SocialLinkView[]]>;
12
+ };
13
+ declare const CmsSocialLinks: import("svelte").Component<Props, {}, "">;
14
+ type CmsSocialLinks = ReturnType<typeof CmsSocialLinks>;
15
+ export default CmsSocialLinks;
@@ -0,0 +1,31 @@
1
+ <script lang="ts" module>
2
+ /** `CmsStats` preset: value, label, note. */
3
+ export type { CmsStatsValue, StatItem } from '../../core/shapes/presets.js';
4
+ export { cmsStats } from '../../core/shapes/presets.js';
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import type { Snippet } from 'svelte';
9
+ import Structured from './cms-structured.svelte';
10
+ import { cmsStats, type CmsStatsValue, type StatItem } from '../../core/shapes/presets.js';
11
+
12
+ type Props = {
13
+ name: string;
14
+ scope?: string;
15
+ /** The full value, or a bare item list. */
16
+ fallback?: Partial<CmsStatsValue> | Partial<StatItem>[];
17
+ value?: unknown;
18
+ children: Snippet<[StatItem[]]>;
19
+ };
20
+ let { name, scope, fallback, value, children }: Props = $props();
21
+ </script>
22
+
23
+ <Structured
24
+ schema={cmsStats}
25
+ {name}
26
+ {scope}
27
+ {fallback}
28
+ {value}
29
+ view={(v: CmsStatsValue) => v.items}
30
+ {children}
31
+ />
@@ -0,0 +1,16 @@
1
+ /** `CmsStats` preset: value, label, note. */
2
+ export type { CmsStatsValue, StatItem } from '../../core/shapes/presets.js';
3
+ export { cmsStats } from '../../core/shapes/presets.js';
4
+ import type { Snippet } from 'svelte';
5
+ import { type CmsStatsValue, type StatItem } from '../../core/shapes/presets.js';
6
+ type Props = {
7
+ name: string;
8
+ scope?: string;
9
+ /** The full value, or a bare item list. */
10
+ fallback?: Partial<CmsStatsValue> | Partial<StatItem>[];
11
+ value?: unknown;
12
+ children: Snippet<[StatItem[]]>;
13
+ };
14
+ declare const CmsStats: import("svelte").Component<Props, {}, "">;
15
+ type CmsStats = ReturnType<typeof CmsStats>;
16
+ export default CmsStats;
@@ -0,0 +1,31 @@
1
+ <script lang="ts" module>
2
+ /** `CmsSteps` preset: title, body, image. */
3
+ export type { CmsStepsValue, StepItem } from '../../core/shapes/presets.js';
4
+ export { cmsSteps } from '../../core/shapes/presets.js';
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import type { Snippet } from 'svelte';
9
+ import Structured from './cms-structured.svelte';
10
+ import { cmsSteps, type CmsStepsValue, type StepItem } from '../../core/shapes/presets.js';
11
+
12
+ type Props = {
13
+ name: string;
14
+ scope?: string;
15
+ /** The full value, or a bare item list. */
16
+ fallback?: Partial<CmsStepsValue> | Partial<StepItem>[];
17
+ value?: unknown;
18
+ children: Snippet<[StepItem[]]>;
19
+ };
20
+ let { name, scope, fallback, value, children }: Props = $props();
21
+ </script>
22
+
23
+ <Structured
24
+ schema={cmsSteps}
25
+ {name}
26
+ {scope}
27
+ {fallback}
28
+ {value}
29
+ view={(v: CmsStepsValue) => v.items}
30
+ {children}
31
+ />
@@ -0,0 +1,16 @@
1
+ /** `CmsSteps` preset: title, body, image. */
2
+ export type { CmsStepsValue, StepItem } from '../../core/shapes/presets.js';
3
+ export { cmsSteps } from '../../core/shapes/presets.js';
4
+ import type { Snippet } from 'svelte';
5
+ import { type CmsStepsValue, type StepItem } from '../../core/shapes/presets.js';
6
+ type Props = {
7
+ name: string;
8
+ scope?: string;
9
+ /** The full value, or a bare item list. */
10
+ fallback?: Partial<CmsStepsValue> | Partial<StepItem>[];
11
+ value?: unknown;
12
+ children: Snippet<[StepItem[]]>;
13
+ };
14
+ declare const CmsSteps: import("svelte").Component<Props, {}, "">;
15
+ type CmsSteps = ReturnType<typeof CmsSteps>;
16
+ export default CmsSteps;
@@ -0,0 +1,29 @@
1
+ <script lang="ts" generics="T extends Record<string, unknown>">
2
+ /**
3
+ * The generic editable sibling of a structured component: the popover
4
+ * over the shape's declared fields. Loaded lazily, only in edit mode.
5
+ */
6
+ import type { Snippet } from 'svelte';
7
+ import type { FormShape } from '../../core/shapes/form.js';
8
+ import type { Tree } from '../../core/path.js';
9
+ import type { CmsField } from './use-cms-field.svelte.js';
10
+ import StructuredEditorPopover from '../admin-bar/structured-editor-popover.svelte';
11
+ import FieldsForm from '../admin-bar/fields-form.svelte';
12
+
13
+ type Props = {
14
+ field: CmsField<T>;
15
+ schema: FormShape<T>;
16
+ preview: Snippet;
17
+ };
18
+ let { field, schema, preview }: Props = $props();
19
+ </script>
20
+
21
+ <StructuredEditorPopover {field} {schema} label={schema.label} {preview}>
22
+ {#snippet editor(draft: T, update: (next: T) => void)}
23
+ <FieldsForm
24
+ fields={schema.fields}
25
+ value={draft as Tree}
26
+ onChange={(next) => update(next as T)}
27
+ />
28
+ {/snippet}
29
+ </StructuredEditorPopover>
@@ -1,11 +1,15 @@
1
+ /**
2
+ * The generic editable sibling of a structured component: the popover
3
+ * over the shape's declared fields. Loaded lazily, only in edit mode.
4
+ */
1
5
  import type { Snippet } from 'svelte';
2
- import { type CmsScopeRef } from './cms-store.svelte.js';
6
+ import type { FormShape } from '../../core/shapes/form.js';
7
+ import type { CmsField } from './use-cms-field.svelte.js';
3
8
  declare function $$render<T extends Record<string, unknown>>(): {
4
9
  props: {
5
- scope: CmsScopeRef;
6
- name: string;
7
- items: T[];
8
- children: Snippet<[T, number]>;
10
+ field: CmsField<T>;
11
+ schema: FormShape<T>;
12
+ preview: Snippet;
9
13
  };
10
14
  exports: {};
11
15
  bindings: "";
@@ -26,6 +30,6 @@ interface $$IsomorphicComponent {
26
30
  <T extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
27
31
  z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
28
32
  }
29
- declare const CmsRepeaterEditable: $$IsomorphicComponent;
30
- type CmsRepeaterEditable<T extends Record<string, unknown>> = InstanceType<typeof CmsRepeaterEditable<T>>;
31
- export default CmsRepeaterEditable;
33
+ declare const CmsStructuredEditable: $$IsomorphicComponent;
34
+ type CmsStructuredEditable<T extends Record<string, unknown>> = InstanceType<typeof CmsStructuredEditable<T>>;
35
+ export default CmsStructuredEditable;
@@ -0,0 +1,50 @@
1
+ <script lang="ts" generics="T extends Record<string, unknown>, V">
2
+ /**
3
+ * The one display component behind every structured editor component.
4
+ * It reads the value through the shape, derives the template's view of
5
+ * it and renders `children(view)`; in edit mode it swaps in the lazily
6
+ * loaded editable sibling (the generic form, or a bespoke one).
7
+ */
8
+ import type { Component, Snippet } from 'svelte';
9
+ import type { FormShape } from '../../core/shapes/form.js';
10
+ import { useCmsField, type CmsField } from './use-cms-field.svelte.js';
11
+
12
+ type EditableProps = { field: CmsField<T>; schema: FormShape<T>; preview: Snippet };
13
+ type Props = {
14
+ schema: FormShape<T>;
15
+ name: string;
16
+ scope?: string;
17
+ fallback?: unknown;
18
+ value?: unknown;
19
+ view: (value: T) => V;
20
+ children: Snippet<[V]>;
21
+ /** Loader for a bespoke editable sibling; defaults to the generic form. */
22
+ editable?: () => Promise<{ default: Component<EditableProps> }>;
23
+ };
24
+ let { schema, name, scope, fallback, value, view, children, editable }: Props = $props();
25
+
26
+ const field = useCmsField(
27
+ () => ({ name, scope, value }),
28
+ (raw) => schema.read(raw, fallback as T | undefined)
29
+ );
30
+ const current = $derived(view(field.current));
31
+ const load = $derived(
32
+ editable ??
33
+ (() =>
34
+ import('./cms-structured-editable.svelte') as unknown as Promise<{
35
+ default: Component<EditableProps>;
36
+ }>)
37
+ );
38
+ </script>
39
+
40
+ {#snippet preview()}
41
+ {@render children(current)}
42
+ {/snippet}
43
+
44
+ {#if field.editable}
45
+ {#await load() then { default: Editable }}
46
+ <Editable {field} {schema} {preview} />
47
+ {/await}
48
+ {:else}
49
+ {@render children(current)}
50
+ {/if}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The one display component behind every structured editor component.
3
+ * It reads the value through the shape, derives the template's view of
4
+ * it and renders `children(view)`; in edit mode it swaps in the lazily
5
+ * loaded editable sibling (the generic form, or a bespoke one).
6
+ */
7
+ import type { Component, Snippet } from 'svelte';
8
+ import type { FormShape } from '../../core/shapes/form.js';
9
+ import { type CmsField } from './use-cms-field.svelte.js';
10
+ declare function $$render<T extends Record<string, unknown>, V>(): {
11
+ props: {
12
+ schema: FormShape<T>;
13
+ name: string;
14
+ scope?: string;
15
+ fallback?: unknown;
16
+ value?: unknown;
17
+ view: (value: T) => V;
18
+ children: Snippet<[V]>;
19
+ /** Loader for a bespoke editable sibling; defaults to the generic form. */
20
+ editable?: () => Promise<{
21
+ default: Component<{
22
+ field: CmsField<T>;
23
+ schema: FormShape<T>;
24
+ preview: Snippet;
25
+ }>;
26
+ }>;
27
+ };
28
+ exports: {};
29
+ bindings: "";
30
+ slots: {};
31
+ events: {};
32
+ };
33
+ declare class __sveltets_Render<T extends Record<string, unknown>, V> {
34
+ props(): ReturnType<typeof $$render<T, V>>['props'];
35
+ events(): ReturnType<typeof $$render<T, V>>['events'];
36
+ slots(): ReturnType<typeof $$render<T, V>>['slots'];
37
+ bindings(): "";
38
+ exports(): {};
39
+ }
40
+ interface $$IsomorphicComponent {
41
+ new <T extends Record<string, unknown>, V>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T, V>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T, V>['props']>, ReturnType<__sveltets_Render<T, V>['events']>, ReturnType<__sveltets_Render<T, V>['slots']>> & {
42
+ $$bindings?: ReturnType<__sveltets_Render<T, V>['bindings']>;
43
+ } & ReturnType<__sveltets_Render<T, V>['exports']>;
44
+ <T extends Record<string, unknown>, V>(internal: unknown, props: ReturnType<__sveltets_Render<T, V>['props']> & {}): ReturnType<__sveltets_Render<T, V>['exports']>;
45
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
46
+ }
47
+ declare const CmsStructured: $$IsomorphicComponent;
48
+ type CmsStructured<T extends Record<string, unknown>, V> = InstanceType<typeof CmsStructured<T, V>>;
49
+ export default CmsStructured;
@@ -0,0 +1,22 @@
1
+ <script lang="ts" module>
2
+ /** `CmsTeam`: people with a portrait, role and bio. */
3
+ export * from '../../core/shapes/team.js';
4
+ </script>
5
+
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+ import Structured from './cms-structured.svelte';
9
+ import { cmsTeam, teamView, type CmsTeamValue, type TeamMember } from '../../core/shapes/team.js';
10
+
11
+ type Props = {
12
+ name: string;
13
+ scope?: string;
14
+ /** The full value, or a bare item list. */
15
+ fallback?: Partial<CmsTeamValue> | Array<Partial<CmsTeamValue['items'][number]>>;
16
+ value?: unknown;
17
+ children: Snippet<[TeamMember[]]>;
18
+ };
19
+ let { name, scope, fallback, value, children }: Props = $props();
20
+ </script>
21
+
22
+ <Structured schema={cmsTeam} {name} {scope} {fallback} {value} view={teamView} {children} />
@@ -0,0 +1,15 @@
1
+ /** `CmsTeam`: people with a portrait, role and bio. */
2
+ export * from '../../core/shapes/team.js';
3
+ import type { Snippet } from 'svelte';
4
+ import { type CmsTeamValue, type TeamMember } from '../../core/shapes/team.js';
5
+ type Props = {
6
+ name: string;
7
+ scope?: string;
8
+ /** The full value, or a bare item list. */
9
+ fallback?: Partial<CmsTeamValue> | Array<Partial<CmsTeamValue['items'][number]>>;
10
+ value?: unknown;
11
+ children: Snippet<[TeamMember[]]>;
12
+ };
13
+ declare const CmsTeam: import("svelte").Component<Props, {}, "">;
14
+ type CmsTeam = ReturnType<typeof CmsTeam>;
15
+ export default CmsTeam;
@@ -0,0 +1,36 @@
1
+ <script lang="ts" module>
2
+ /** `CmsTestimonials`: quotes with author, rating and source. */
3
+ export * from '../../core/shapes/testimonials.js';
4
+ </script>
5
+
6
+ <script lang="ts">
7
+ import type { Snippet } from 'svelte';
8
+ import Structured from './cms-structured.svelte';
9
+ import {
10
+ cmsTestimonials,
11
+ testimonialsView,
12
+ type CmsTestimonialsValue,
13
+ type Testimonial
14
+ } from '../../core/shapes/testimonials.js';
15
+
16
+ type Props = {
17
+ name: string;
18
+ scope?: string;
19
+ /** The full value, or a bare item list. */
20
+ fallback?:
21
+ Partial<CmsTestimonialsValue> | Array<Partial<CmsTestimonialsValue['items'][number]>>;
22
+ value?: unknown;
23
+ children: Snippet<[Testimonial[]]>;
24
+ };
25
+ let { name, scope, fallback, value, children }: Props = $props();
26
+ </script>
27
+
28
+ <Structured
29
+ schema={cmsTestimonials}
30
+ {name}
31
+ {scope}
32
+ {fallback}
33
+ {value}
34
+ view={testimonialsView}
35
+ {children}
36
+ />
@@ -0,0 +1,15 @@
1
+ /** `CmsTestimonials`: quotes with author, rating and source. */
2
+ export * from '../../core/shapes/testimonials.js';
3
+ import type { Snippet } from 'svelte';
4
+ import { type CmsTestimonialsValue, type Testimonial } from '../../core/shapes/testimonials.js';
5
+ type Props = {
6
+ name: string;
7
+ scope?: string;
8
+ /** The full value, or a bare item list. */
9
+ fallback?: Partial<CmsTestimonialsValue> | Array<Partial<CmsTestimonialsValue['items'][number]>>;
10
+ value?: unknown;
11
+ children: Snippet<[Testimonial[]]>;
12
+ };
13
+ declare const CmsTestimonials: import("svelte").Component<Props, {}, "">;
14
+ type CmsTestimonials = ReturnType<typeof CmsTestimonials>;
15
+ export default CmsTestimonials;
@@ -0,0 +1,35 @@
1
+ <script lang="ts" module>
2
+ /** `CmsTimeline` preset: date, title, body, image. */
3
+ export type { CmsTimelineValue, TimelineItem } from '../../core/shapes/presets.js';
4
+ export { cmsTimeline } from '../../core/shapes/presets.js';
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import type { Snippet } from 'svelte';
9
+ import Structured from './cms-structured.svelte';
10
+ import {
11
+ cmsTimeline,
12
+ type CmsTimelineValue,
13
+ type TimelineItem
14
+ } from '../../core/shapes/presets.js';
15
+
16
+ type Props = {
17
+ name: string;
18
+ scope?: string;
19
+ /** The full value, or a bare item list. */
20
+ fallback?: Partial<CmsTimelineValue> | Partial<TimelineItem>[];
21
+ value?: unknown;
22
+ children: Snippet<[TimelineItem[]]>;
23
+ };
24
+ let { name, scope, fallback, value, children }: Props = $props();
25
+ </script>
26
+
27
+ <Structured
28
+ schema={cmsTimeline}
29
+ {name}
30
+ {scope}
31
+ {fallback}
32
+ {value}
33
+ view={(v: CmsTimelineValue) => v.items}
34
+ {children}
35
+ />
@@ -0,0 +1,16 @@
1
+ /** `CmsTimeline` preset: date, title, body, image. */
2
+ export type { CmsTimelineValue, TimelineItem } from '../../core/shapes/presets.js';
3
+ export { cmsTimeline } from '../../core/shapes/presets.js';
4
+ import type { Snippet } from 'svelte';
5
+ import { type CmsTimelineValue, type TimelineItem } from '../../core/shapes/presets.js';
6
+ type Props = {
7
+ name: string;
8
+ scope?: string;
9
+ /** The full value, or a bare item list. */
10
+ fallback?: Partial<CmsTimelineValue> | Partial<TimelineItem>[];
11
+ value?: unknown;
12
+ children: Snippet<[TimelineItem[]]>;
13
+ };
14
+ declare const CmsTimeline: import("svelte").Component<Props, {}, "">;
15
+ type CmsTimeline = ReturnType<typeof CmsTimeline>;
16
+ export default CmsTimeline;