@dataverse-kit/form-runtime 0.1.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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -0
  3. package/dist/businessRules-U1_MBgyG.d.cts +372 -0
  4. package/dist/businessRules-U1_MBgyG.d.ts +372 -0
  5. package/dist/context.cjs +151 -0
  6. package/dist/context.cjs.map +1 -0
  7. package/dist/context.d.cts +132 -0
  8. package/dist/context.d.ts +132 -0
  9. package/dist/context.mjs +113 -0
  10. package/dist/context.mjs.map +1 -0
  11. package/dist/control-DFOg_pc_.d.cts +1027 -0
  12. package/dist/control-DaXBm-52.d.ts +1027 -0
  13. package/dist/gridCustomizer-C0V9FAE_.d.ts +569 -0
  14. package/dist/gridCustomizer-mJO-kmQ4.d.cts +569 -0
  15. package/dist/hooks.cjs +85 -0
  16. package/dist/hooks.cjs.map +1 -0
  17. package/dist/hooks.d.cts +24 -0
  18. package/dist/hooks.d.ts +24 -0
  19. package/dist/hooks.mjs +60 -0
  20. package/dist/hooks.mjs.map +1 -0
  21. package/dist/icons.cjs +202 -0
  22. package/dist/icons.cjs.map +1 -0
  23. package/dist/icons.d.cts +130 -0
  24. package/dist/icons.d.ts +130 -0
  25. package/dist/icons.mjs +165 -0
  26. package/dist/icons.mjs.map +1 -0
  27. package/dist/index.cjs +6509 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +410 -0
  30. package/dist/index.d.ts +410 -0
  31. package/dist/index.mjs +6490 -0
  32. package/dist/index.mjs.map +1 -0
  33. package/dist/runtime-capabilities-BdGDdu0d.d.cts +119 -0
  34. package/dist/runtime-capabilities-Brfc7loJ.d.ts +119 -0
  35. package/dist/theme-BfeZIxmZ.d.cts +74 -0
  36. package/dist/theme-BfeZIxmZ.d.ts +74 -0
  37. package/dist/theme.cjs +215 -0
  38. package/dist/theme.cjs.map +1 -0
  39. package/dist/theme.d.cts +32 -0
  40. package/dist/theme.d.ts +32 -0
  41. package/dist/theme.mjs +186 -0
  42. package/dist/theme.mjs.map +1 -0
  43. package/dist/types.cjs +976 -0
  44. package/dist/types.cjs.map +1 -0
  45. package/dist/types.d.cts +813 -0
  46. package/dist/types.d.ts +813 -0
  47. package/dist/types.mjs +902 -0
  48. package/dist/types.mjs.map +1 -0
  49. package/dist/utils.cjs +250 -0
  50. package/dist/utils.cjs.map +1 -0
  51. package/dist/utils.d.cts +99 -0
  52. package/dist/utils.d.ts +99 -0
  53. package/dist/utils.mjs +220 -0
  54. package/dist/utils.mjs.map +1 -0
  55. package/dist/v8.cjs +4622 -0
  56. package/dist/v8.cjs.map +1 -0
  57. package/dist/v8.d.cts +730 -0
  58. package/dist/v8.d.ts +730 -0
  59. package/dist/v8.mjs +4622 -0
  60. package/dist/v8.mjs.map +1 -0
  61. package/dist/v9.cjs +19 -0
  62. package/dist/v9.cjs.map +1 -0
  63. package/dist/v9.d.cts +2 -0
  64. package/dist/v9.d.ts +2 -0
  65. package/dist/v9.mjs +1 -0
  66. package/dist/v9.mjs.map +1 -0
  67. package/package.json +113 -0
@@ -0,0 +1,132 @@
1
+ import React from 'react';
2
+ import { F as FormRuntimeCapabilities } from './runtime-capabilities-Brfc7loJ.js';
3
+ export { a as FormRuntimeConnection, b as FormRuntimePreviewContext, L as LiveDataResult, c as LookupResult, d as LookupSearchOptions, T as TimelineItem, W as WebResourceData } from './runtime-capabilities-Brfc7loJ.js';
4
+ import { h as CalloutDefinition, ai as RelatedFormTab, A as AuditFormTab } from './control-DaXBm-52.js';
5
+ import { F as FieldState, S as SectionState, T as TabState } from './businessRules-U1_MBgyG.js';
6
+ import './theme-BfeZIxmZ.js';
7
+
8
+ interface FormRuntimeProviderProps {
9
+ capabilities: FormRuntimeCapabilities;
10
+ children: React.ReactNode;
11
+ }
12
+ /**
13
+ * Provider wrapper. Caller supplies a `FormRuntimeCapabilities` value;
14
+ * descendants read it via `useFormRuntimeContext()`. Wrap the runtime's
15
+ * mount point (`<FormRuntime>`) with this; failing to do so causes
16
+ * capability-consuming controls to throw on first render.
17
+ */
18
+ declare const FormRuntimeProvider: React.FC<FormRuntimeProviderProps>;
19
+ /**
20
+ * Hook for runtime-internal callers that REQUIRE capabilities. Throws
21
+ * with a directed error message if no provider is present so the
22
+ * integration gap is visible at the call site (rather than a vague
23
+ * "Cannot read properties of null" that points at the consumer).
24
+ */
25
+ declare function useFormRuntimeContext(): FormRuntimeCapabilities;
26
+ /**
27
+ * Same as `useFormRuntimeContext()` but returns `null` when no provider
28
+ * is present. Use for OPTIONAL capability access — controls that have a
29
+ * sensible offline rendering (e.g. timeline, which renders a placeholder
30
+ * when not connected) prefer this over the throwing variant.
31
+ */
32
+ declare function useOptionalFormRuntimeContext(): FormRuntimeCapabilities | null;
33
+
34
+ /**
35
+ * CalloutsContext — exposes `form.callouts` to descendants so
36
+ * SectionShell's CellShell can look up the CalloutDefinition that a
37
+ * control's `calloutId` references without prop-drilling the array
38
+ * through every shell layer.
39
+ *
40
+ * The runtime emits a provider once, at the FormRuntime mount point;
41
+ * shells use {@link useCallout} to resolve an id to its definition (or
42
+ * undefined when no provider is mounted, when the array is empty, or
43
+ * when the id doesn't match — all of which should render the host
44
+ * control without callout chrome).
45
+ */
46
+
47
+ interface CalloutsProviderProps {
48
+ callouts?: CalloutDefinition[];
49
+ children: React.ReactNode;
50
+ }
51
+ declare const CalloutsProvider: React.FC<CalloutsProviderProps>;
52
+ /**
53
+ * Look up a callout by id. Returns undefined when no provider is
54
+ * mounted, when the id is undefined, or when no callout with that id
55
+ * exists — all should render the host control without chrome.
56
+ */
57
+ declare function useCallout(id: string | undefined): CalloutDefinition | undefined;
58
+
59
+ /**
60
+ * RuleStatesContext — exposes business-rule evaluation outputs
61
+ * (fieldStates / sectionStates / tabStates) to the runtime's shells so
62
+ * they can gate visibility and override control props (readOnly,
63
+ * required) at render time.
64
+ *
65
+ * The runtime does NOT own the rule engine — that's editor/host state.
66
+ * It only consumes pre-computed state maps. The form-builder's
67
+ * `useRuleExecutionStore` feeds these in via FormRuntime's `ruleStates`
68
+ * prop; generated apps pass equivalent maps from their host integration.
69
+ *
70
+ * Missing entries are treated as "no rule constraint" — the underlying
71
+ * control's own props (hidden / readOnly / required) take effect. This
72
+ * matches the legacy SectionPreview's fallthrough behavior.
73
+ */
74
+
75
+ interface RuleStatesContextValue {
76
+ fieldStates: Record<string, FieldState>;
77
+ sectionStates: Record<string, SectionState>;
78
+ tabStates: Record<string, TabState>;
79
+ }
80
+ interface RuleStatesProviderProps {
81
+ fieldStates?: Record<string, FieldState>;
82
+ sectionStates?: Record<string, SectionState>;
83
+ tabStates?: Record<string, TabState>;
84
+ children: React.ReactNode;
85
+ }
86
+ declare const RuleStatesProvider: React.FC<RuleStatesProviderProps>;
87
+ /**
88
+ * Returns the full rule-state maps. Use this when you need to walk
89
+ * multiple field/section ids in a single render pass (e.g. RowShell
90
+ * checking "is every cell in this row hidden") — avoids violating
91
+ * the rules of hooks by calling useFieldState in a loop.
92
+ */
93
+ declare function useRuleStates(): RuleStatesContextValue;
94
+ /** Returns the field's rule state, or undefined if no rule has set one. */
95
+ declare function useFieldState(controlName: string | undefined): FieldState | undefined;
96
+ /** Returns the section's rule state, or undefined if no rule has set one. */
97
+ declare function useSectionState(sectionId: string): SectionState | undefined;
98
+ /** Returns the tab's rule state, or undefined if no rule has set one. */
99
+ declare function useTabState(tabId: string): TabState | undefined;
100
+
101
+ /**
102
+ * TabContentSlotsContext — pluggable render slots for non-main tabs
103
+ * (related-records, audit-history). The runtime ships a placeholder
104
+ * for these tab types because they depend on host-specific concerns
105
+ * (dataverse queries, related-record metadata) that don't belong in
106
+ * the runtime itself.
107
+ *
108
+ * Hosts that want full fidelity (form-builder preview, generated
109
+ * apps) provide render functions for these slots via
110
+ * `TabContentSlotsProvider`. TabsShell consumes them via
111
+ * `useTabContentSlots()`; missing slots fall through to the
112
+ * placeholder.
113
+ *
114
+ * Phase 3 m6 — replaces the legacy preview's direct imports of
115
+ * RelatedTabPreview / AuditTabPreview without making the runtime
116
+ * depend on either component.
117
+ */
118
+
119
+ interface TabContentSlots {
120
+ /** Render override for related-records tabs. */
121
+ renderRelatedTab?: (tab: RelatedFormTab) => React.ReactNode;
122
+ /** Render override for audit-history tabs. */
123
+ renderAuditTab?: (tab: AuditFormTab) => React.ReactNode;
124
+ }
125
+ interface TabContentSlotsProviderProps {
126
+ slots?: TabContentSlots;
127
+ children: React.ReactNode;
128
+ }
129
+ declare const TabContentSlotsProvider: React.FC<TabContentSlotsProviderProps>;
130
+ declare function useTabContentSlots(): TabContentSlots;
131
+
132
+ export { CalloutsProvider, type CalloutsProviderProps, FormRuntimeCapabilities, FormRuntimeProvider, type FormRuntimeProviderProps, type RuleStatesContextValue, RuleStatesProvider, type RuleStatesProviderProps, type TabContentSlots, TabContentSlotsProvider, type TabContentSlotsProviderProps, useCallout, useFieldState, useFormRuntimeContext, useOptionalFormRuntimeContext, useRuleStates, useSectionState, useTabContentSlots, useTabState };
@@ -0,0 +1,113 @@
1
+ // src/context/FormRuntimeContext.tsx
2
+ import { createContext, useContext } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var FormRuntimeContext = createContext(null);
5
+ FormRuntimeContext.displayName = "FormRuntimeContext";
6
+ var FormRuntimeProvider = ({
7
+ capabilities,
8
+ children
9
+ }) => /* @__PURE__ */ jsx(FormRuntimeContext.Provider, { value: capabilities, children });
10
+ function useFormRuntimeContext() {
11
+ const value = useContext(FormRuntimeContext);
12
+ if (value === null) {
13
+ throw new Error(
14
+ "[@dataverse-kit/form-runtime] useFormRuntimeContext was called outside of a <FormRuntimeProvider>. Wrap your <FormRuntime> mount with a provider that supplies FormRuntimeCapabilities (the editor app uses EditorFormRuntimeProvider; generated host code uses ServiceFactory-backed capabilities). See packages/form-runtime/src/context/FormRuntimeContext.tsx."
15
+ );
16
+ }
17
+ return value;
18
+ }
19
+ function useOptionalFormRuntimeContext() {
20
+ return useContext(FormRuntimeContext);
21
+ }
22
+
23
+ // src/context/CalloutsContext.tsx
24
+ import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
25
+ import { jsx as jsx2 } from "react/jsx-runtime";
26
+ var EMPTY = { byId: /* @__PURE__ */ new Map() };
27
+ var CalloutsContext = createContext2(EMPTY);
28
+ CalloutsContext.displayName = "CalloutsContext";
29
+ var CalloutsProvider = ({ callouts, children }) => {
30
+ const value = useMemo(() => {
31
+ if (!callouts || callouts.length === 0) return EMPTY;
32
+ return { byId: new Map(callouts.map((c) => [c.id, c])) };
33
+ }, [callouts]);
34
+ return /* @__PURE__ */ jsx2(CalloutsContext.Provider, { value, children });
35
+ };
36
+ function useCallout(id) {
37
+ const ctx = useContext2(CalloutsContext);
38
+ if (!id) return void 0;
39
+ return ctx.byId.get(id);
40
+ }
41
+
42
+ // src/context/RuleStatesContext.tsx
43
+ import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2 } from "react";
44
+ import { jsx as jsx3 } from "react/jsx-runtime";
45
+ var EMPTY2 = {
46
+ fieldStates: {},
47
+ sectionStates: {},
48
+ tabStates: {}
49
+ };
50
+ var RuleStatesContext = createContext3(EMPTY2);
51
+ RuleStatesContext.displayName = "RuleStatesContext";
52
+ var RuleStatesProvider = ({
53
+ fieldStates,
54
+ sectionStates,
55
+ tabStates,
56
+ children
57
+ }) => {
58
+ const value = useMemo2(
59
+ () => ({
60
+ fieldStates: fieldStates ?? {},
61
+ sectionStates: sectionStates ?? {},
62
+ tabStates: tabStates ?? {}
63
+ }),
64
+ [fieldStates, sectionStates, tabStates]
65
+ );
66
+ return /* @__PURE__ */ jsx3(RuleStatesContext.Provider, { value, children });
67
+ };
68
+ function useRuleStates() {
69
+ return useContext3(RuleStatesContext);
70
+ }
71
+ function useFieldState(controlName) {
72
+ const ctx = useContext3(RuleStatesContext);
73
+ if (!controlName) return void 0;
74
+ return ctx.fieldStates[controlName];
75
+ }
76
+ function useSectionState(sectionId) {
77
+ return useContext3(RuleStatesContext).sectionStates[sectionId];
78
+ }
79
+ function useTabState(tabId) {
80
+ return useContext3(RuleStatesContext).tabStates[tabId];
81
+ }
82
+
83
+ // src/context/TabContentSlotsContext.tsx
84
+ import { createContext as createContext4, useContext as useContext4, useMemo as useMemo3 } from "react";
85
+ import { jsx as jsx4 } from "react/jsx-runtime";
86
+ var EMPTY3 = {};
87
+ var TabContentSlotsContext = createContext4(EMPTY3);
88
+ TabContentSlotsContext.displayName = "TabContentSlotsContext";
89
+ var TabContentSlotsProvider = ({
90
+ slots,
91
+ children
92
+ }) => {
93
+ const value = useMemo3(() => slots ?? EMPTY3, [slots]);
94
+ return /* @__PURE__ */ jsx4(TabContentSlotsContext.Provider, { value, children });
95
+ };
96
+ function useTabContentSlots() {
97
+ return useContext4(TabContentSlotsContext);
98
+ }
99
+ export {
100
+ CalloutsProvider,
101
+ FormRuntimeProvider,
102
+ RuleStatesProvider,
103
+ TabContentSlotsProvider,
104
+ useCallout,
105
+ useFieldState,
106
+ useFormRuntimeContext,
107
+ useOptionalFormRuntimeContext,
108
+ useRuleStates,
109
+ useSectionState,
110
+ useTabContentSlots,
111
+ useTabState
112
+ };
113
+ //# sourceMappingURL=context.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/context/FormRuntimeContext.tsx","../src/context/CalloutsContext.tsx","../src/context/RuleStatesContext.tsx","../src/context/TabContentSlotsContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport type { FormRuntimeCapabilities } from '../types/runtime-capabilities';\n\n/**\n * Context that exposes editor- or host-supplied async capabilities to\n * the runtime's controls.\n *\n * Two implementations exist (Phase 1 Task 6.5 onwards):\n * - `EditorFormRuntimeProvider` in `apps/form-builder/src/contexts/` —\n * wires capabilities to the form-builder's Zustand stores (designer,\n * dataverse, previewRecord, gridCustomizer).\n * - Generated host code's provider (Phase 3) — wires capabilities to\n * `IApiService` from `@dataverse-kit/api-service`.\n *\n * Per `feedback_v1_migrations`, the runtime DOES NOT define a default\n * mock or no-op provider. Controls that depend on capabilities throw if\n * the consumer hasn't wrapped them in a provider — the error names the\n * provider that's expected, so the failure points at the integration\n * gap rather than masking it with silent no-ops.\n */\nconst FormRuntimeContext = createContext<FormRuntimeCapabilities | null>(null);\n\nFormRuntimeContext.displayName = 'FormRuntimeContext';\n\nexport interface FormRuntimeProviderProps {\n capabilities: FormRuntimeCapabilities;\n children: React.ReactNode;\n}\n\n/**\n * Provider wrapper. Caller supplies a `FormRuntimeCapabilities` value;\n * descendants read it via `useFormRuntimeContext()`. Wrap the runtime's\n * mount point (`<FormRuntime>`) with this; failing to do so causes\n * capability-consuming controls to throw on first render.\n */\nexport const FormRuntimeProvider: React.FC<FormRuntimeProviderProps> = ({\n capabilities,\n children,\n}) => <FormRuntimeContext.Provider value={capabilities}>{children}</FormRuntimeContext.Provider>;\n\n/**\n * Hook for runtime-internal callers that REQUIRE capabilities. Throws\n * with a directed error message if no provider is present so the\n * integration gap is visible at the call site (rather than a vague\n * \"Cannot read properties of null\" that points at the consumer).\n */\nexport function useFormRuntimeContext(): FormRuntimeCapabilities {\n const value = useContext(FormRuntimeContext);\n if (value === null) {\n throw new Error(\n '[@dataverse-kit/form-runtime] useFormRuntimeContext was called outside of a ' +\n '<FormRuntimeProvider>. Wrap your <FormRuntime> mount with a provider that ' +\n 'supplies FormRuntimeCapabilities (the editor app uses ' +\n 'EditorFormRuntimeProvider; generated host code uses ServiceFactory-backed ' +\n 'capabilities). See packages/form-runtime/src/context/FormRuntimeContext.tsx.',\n );\n }\n return value;\n}\n\n/**\n * Same as `useFormRuntimeContext()` but returns `null` when no provider\n * is present. Use for OPTIONAL capability access — controls that have a\n * sensible offline rendering (e.g. timeline, which renders a placeholder\n * when not connected) prefer this over the throwing variant.\n */\nexport function useOptionalFormRuntimeContext(): FormRuntimeCapabilities | null {\n return useContext(FormRuntimeContext);\n}\n","/**\n * CalloutsContext — exposes `form.callouts` to descendants so\n * SectionShell's CellShell can look up the CalloutDefinition that a\n * control's `calloutId` references without prop-drilling the array\n * through every shell layer.\n *\n * The runtime emits a provider once, at the FormRuntime mount point;\n * shells use {@link useCallout} to resolve an id to its definition (or\n * undefined when no provider is mounted, when the array is empty, or\n * when the id doesn't match — all of which should render the host\n * control without callout chrome).\n */\n\nimport React, { createContext, useContext, useMemo } from 'react';\nimport type { CalloutDefinition } from '../types';\n\ninterface CalloutsContextValue {\n /** Map from callout id -> definition for O(1) lookup. */\n byId: Map<string, CalloutDefinition>;\n}\n\nconst EMPTY: CalloutsContextValue = { byId: new Map() };\n\nconst CalloutsContext = createContext<CalloutsContextValue>(EMPTY);\nCalloutsContext.displayName = 'CalloutsContext';\n\nexport interface CalloutsProviderProps {\n callouts?: CalloutDefinition[];\n children: React.ReactNode;\n}\n\nexport const CalloutsProvider: React.FC<CalloutsProviderProps> = ({ callouts, children }) => {\n const value = useMemo<CalloutsContextValue>(() => {\n if (!callouts || callouts.length === 0) return EMPTY;\n return { byId: new Map(callouts.map((c) => [c.id, c])) };\n }, [callouts]);\n return <CalloutsContext.Provider value={value}>{children}</CalloutsContext.Provider>;\n};\n\n/**\n * Look up a callout by id. Returns undefined when no provider is\n * mounted, when the id is undefined, or when no callout with that id\n * exists — all should render the host control without chrome.\n */\nexport function useCallout(id: string | undefined): CalloutDefinition | undefined {\n const ctx = useContext(CalloutsContext);\n if (!id) return undefined;\n return ctx.byId.get(id);\n}\n","/**\n * RuleStatesContext — exposes business-rule evaluation outputs\n * (fieldStates / sectionStates / tabStates) to the runtime's shells so\n * they can gate visibility and override control props (readOnly,\n * required) at render time.\n *\n * The runtime does NOT own the rule engine — that's editor/host state.\n * It only consumes pre-computed state maps. The form-builder's\n * `useRuleExecutionStore` feeds these in via FormRuntime's `ruleStates`\n * prop; generated apps pass equivalent maps from their host integration.\n *\n * Missing entries are treated as \"no rule constraint\" — the underlying\n * control's own props (hidden / readOnly / required) take effect. This\n * matches the legacy SectionPreview's fallthrough behavior.\n */\n\nimport React, { createContext, useContext, useMemo } from 'react';\nimport type { FieldState, SectionState, TabState } from '../types/businessRules';\n\nexport interface RuleStatesContextValue {\n fieldStates: Record<string, FieldState>;\n sectionStates: Record<string, SectionState>;\n tabStates: Record<string, TabState>;\n}\n\nconst EMPTY: RuleStatesContextValue = {\n fieldStates: {},\n sectionStates: {},\n tabStates: {},\n};\n\nconst RuleStatesContext = createContext<RuleStatesContextValue>(EMPTY);\nRuleStatesContext.displayName = 'RuleStatesContext';\n\nexport interface RuleStatesProviderProps {\n fieldStates?: Record<string, FieldState>;\n sectionStates?: Record<string, SectionState>;\n tabStates?: Record<string, TabState>;\n children: React.ReactNode;\n}\n\nexport const RuleStatesProvider: React.FC<RuleStatesProviderProps> = ({\n fieldStates,\n sectionStates,\n tabStates,\n children,\n}) => {\n const value = useMemo<RuleStatesContextValue>(\n () => ({\n fieldStates: fieldStates ?? {},\n sectionStates: sectionStates ?? {},\n tabStates: tabStates ?? {},\n }),\n [fieldStates, sectionStates, tabStates],\n );\n return <RuleStatesContext.Provider value={value}>{children}</RuleStatesContext.Provider>;\n};\n\n/**\n * Returns the full rule-state maps. Use this when you need to walk\n * multiple field/section ids in a single render pass (e.g. RowShell\n * checking \"is every cell in this row hidden\") — avoids violating\n * the rules of hooks by calling useFieldState in a loop.\n */\nexport function useRuleStates(): RuleStatesContextValue {\n return useContext(RuleStatesContext);\n}\n\n/** Returns the field's rule state, or undefined if no rule has set one. */\nexport function useFieldState(controlName: string | undefined): FieldState | undefined {\n const ctx = useContext(RuleStatesContext);\n if (!controlName) return undefined;\n return ctx.fieldStates[controlName];\n}\n\n/** Returns the section's rule state, or undefined if no rule has set one. */\nexport function useSectionState(sectionId: string): SectionState | undefined {\n return useContext(RuleStatesContext).sectionStates[sectionId];\n}\n\n/** Returns the tab's rule state, or undefined if no rule has set one. */\nexport function useTabState(tabId: string): TabState | undefined {\n return useContext(RuleStatesContext).tabStates[tabId];\n}\n","/**\n * TabContentSlotsContext — pluggable render slots for non-main tabs\n * (related-records, audit-history). The runtime ships a placeholder\n * for these tab types because they depend on host-specific concerns\n * (dataverse queries, related-record metadata) that don't belong in\n * the runtime itself.\n *\n * Hosts that want full fidelity (form-builder preview, generated\n * apps) provide render functions for these slots via\n * `TabContentSlotsProvider`. TabsShell consumes them via\n * `useTabContentSlots()`; missing slots fall through to the\n * placeholder.\n *\n * Phase 3 m6 — replaces the legacy preview's direct imports of\n * RelatedTabPreview / AuditTabPreview without making the runtime\n * depend on either component.\n */\n\nimport React, { createContext, useContext, useMemo } from 'react';\nimport type { RelatedFormTab, AuditFormTab } from '../types';\n\nexport interface TabContentSlots {\n /** Render override for related-records tabs. */\n renderRelatedTab?: (tab: RelatedFormTab) => React.ReactNode;\n /** Render override for audit-history tabs. */\n renderAuditTab?: (tab: AuditFormTab) => React.ReactNode;\n}\n\nconst EMPTY: TabContentSlots = {};\n\nconst TabContentSlotsContext = createContext<TabContentSlots>(EMPTY);\nTabContentSlotsContext.displayName = 'TabContentSlotsContext';\n\nexport interface TabContentSlotsProviderProps {\n slots?: TabContentSlots;\n children: React.ReactNode;\n}\n\nexport const TabContentSlotsProvider: React.FC<TabContentSlotsProviderProps> = ({\n slots,\n children,\n}) => {\n const value = useMemo<TabContentSlots>(() => slots ?? EMPTY, [slots]);\n return <TabContentSlotsContext.Provider value={value}>{children}</TabContentSlotsContext.Provider>;\n};\n\nexport function useTabContentSlots(): TabContentSlots {\n return useContext(TabContentSlotsContext);\n}\n"],"mappings":"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","names":["createContext","useContext","jsx","createContext","useContext","useMemo","jsx","EMPTY","createContext","useContext","useMemo","jsx","EMPTY"]}